aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-07-31 20:30:59 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-07-31 20:30:59 -0400
commit968e75fc13b6d582f42ce44172e13ba58157e11f (patch)
tree306eacdf2815f8a49b47228c3b50e7a6083ef7d4 /arch
parenta00ed25cce6fe856388f89c7cd40da0eee7666a6 (diff)
parentd3690f8b713f9710e68214ca38fb8b07b587a2a7 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k: m68k/math-emu: Remove unnecessary code m68k/math-emu: Remove commented out old code m68k: Kill warning in setup_arch() when compiling for Sun3 m68k/atari: Prefix GPIO_{IN,OUT} with CODEC_ sparc: iounmap() and *_free_coherent() - Use lookup_resource() m68k/atari: Reserve some ST-RAM early on for device buffer use m68k/amiga: Chip RAM - Use lookup_resource() resources: Add lookup_resource() sparc: _sparc_find_resource() should check for exact matches m68k/amiga: Chip RAM - Offset resource end by CHIP_PHYSADDR m68k/amiga: Chip RAM - Use resource_size() to fix off-by-one error m68k/amiga: Chip RAM - Change chipavail to an atomic_t m68k/amiga: Chip RAM - Always allocate from the start of memory m68k/amiga: Chip RAM - Convert from printk() to pr_*() m68k/amiga: Chip RAM - Use tabs for indentation
Diffstat (limited to 'arch')
-rw-r--r--arch/m68k/Kconfig.mmu6
-rw-r--r--arch/m68k/amiga/chipram.c136
-rw-r--r--arch/m68k/atari/stram.c354
-rw-r--r--arch/m68k/include/asm/atari_stram.h3
-rw-r--r--arch/m68k/include/asm/atarihw.h4
-rw-r--r--arch/m68k/kernel/setup_mm.c2
-rw-r--r--arch/m68k/math-emu/fp_log.c3
-rw-r--r--arch/m68k/math-emu/multi_arith.h530
-rw-r--r--arch/m68k/mm/init_mm.c5
-rw-r--r--arch/sparc/kernel/ioport.c32
10 files changed, 144 insertions, 931 deletions
diff --git a/arch/m68k/Kconfig.mmu b/arch/m68k/Kconfig.mmu
index 16539b1d5d3a..13e20bbc4079 100644
--- a/arch/m68k/Kconfig.mmu
+++ b/arch/m68k/Kconfig.mmu
@@ -372,12 +372,6 @@ config AMIGA_PCMCIA
372 Include support in the kernel for pcmcia on Amiga 1200 and Amiga 372 Include support in the kernel for pcmcia on Amiga 1200 and Amiga
373 600. If you intend to use pcmcia cards say Y; otherwise say N. 373 600. If you intend to use pcmcia cards say Y; otherwise say N.
374 374
375config STRAM_PROC
376 bool "ST-RAM statistics in /proc"
377 depends on ATARI
378 help
379 Say Y here to report ST-RAM usage statistics in /proc/stram.
380
381config HEARTBEAT 375config HEARTBEAT
382 bool "Use power LED as a heartbeat" if AMIGA || APOLLO || ATARI || MAC ||Q40 376 bool "Use power LED as a heartbeat" if AMIGA || APOLLO || ATARI || MAC ||Q40
383 default y if !AMIGA && !APOLLO && !ATARI && !MAC && !Q40 && HP300 377 default y if !AMIGA && !APOLLO && !ATARI && !MAC && !Q40 && HP300
diff --git a/arch/m68k/amiga/chipram.c b/arch/m68k/amiga/chipram.c
index dd0447db1c90..99449fbf9a72 100644
--- a/arch/m68k/amiga/chipram.c
+++ b/arch/m68k/amiga/chipram.c
@@ -16,6 +16,7 @@
16#include <linux/string.h> 16#include <linux/string.h>
17#include <linux/module.h> 17#include <linux/module.h>
18 18
19#include <asm/atomic.h>
19#include <asm/page.h> 20#include <asm/page.h>
20#include <asm/amigahw.h> 21#include <asm/amigahw.h>
21 22
@@ -23,111 +24,100 @@ unsigned long amiga_chip_size;
23EXPORT_SYMBOL(amiga_chip_size); 24EXPORT_SYMBOL(amiga_chip_size);
24 25
25static struct resource chipram_res = { 26static struct resource chipram_res = {
26 .name = "Chip RAM", .start = CHIP_PHYSADDR 27 .name = "Chip RAM", .start = CHIP_PHYSADDR
27}; 28};
28static unsigned long chipavail; 29static atomic_t chipavail;
29 30
30 31
31void __init amiga_chip_init(void) 32void __init amiga_chip_init(void)
32{ 33{
33 if (!AMIGAHW_PRESENT(CHIP_RAM)) 34 if (!AMIGAHW_PRESENT(CHIP_RAM))
34 return; 35 return;
35 36
36 chipram_res.end = amiga_chip_size-1; 37 chipram_res.end = CHIP_PHYSADDR + amiga_chip_size - 1;
37 request_resource(&iomem_resource, &chipram_res); 38 request_resource(&iomem_resource, &chipram_res);
38 39
39 chipavail = amiga_chip_size; 40 atomic_set(&chipavail, amiga_chip_size);
40} 41}
41 42
42 43
43void *amiga_chip_alloc(unsigned long size, const char *name) 44void *amiga_chip_alloc(unsigned long size, const char *name)
44{ 45{
45 struct resource *res; 46 struct resource *res;
47 void *p;
46 48
47 /* round up */ 49 res = kzalloc(sizeof(struct resource), GFP_KERNEL);
48 size = PAGE_ALIGN(size); 50 if (!res)
51 return NULL;
49 52
50#ifdef DEBUG 53 res->name = name;
51 printk("amiga_chip_alloc: allocate %ld bytes\n", size); 54 p = amiga_chip_alloc_res(size, res);
52#endif 55 if (!p) {
53 res = kzalloc(sizeof(struct resource), GFP_KERNEL); 56 kfree(res);
54 if (!res) 57 return NULL;
55 return NULL; 58 }
56 res->name = name;
57 59
58 if (allocate_resource(&chipram_res, res, size, 0, UINT_MAX, PAGE_SIZE, NULL, NULL) < 0) { 60 return p;
59 kfree(res);
60 return NULL;
61 }
62 chipavail -= size;
63#ifdef DEBUG
64 printk("amiga_chip_alloc: returning %lx\n", res->start);
65#endif
66 return (void *)ZTWO_VADDR(res->start);
67} 61}
68EXPORT_SYMBOL(amiga_chip_alloc); 62EXPORT_SYMBOL(amiga_chip_alloc);
69 63
70 64
71 /* 65 /*
72 * Warning: 66 * Warning:
73 * amiga_chip_alloc_res is meant only for drivers that need to allocate 67 * amiga_chip_alloc_res is meant only for drivers that need to
74 * Chip RAM before kmalloc() is functional. As a consequence, those 68 * allocate Chip RAM before kmalloc() is functional. As a consequence,
75 * drivers must not free that Chip RAM afterwards. 69 * those drivers must not free that Chip RAM afterwards.
76 */ 70 */
77 71
78void * __init amiga_chip_alloc_res(unsigned long size, struct resource *res) 72void *amiga_chip_alloc_res(unsigned long size, struct resource *res)
79{ 73{
80 unsigned long start; 74 int error;
81 75
82 /* round up */ 76 /* round up */
83 size = PAGE_ALIGN(size); 77 size = PAGE_ALIGN(size);
84 /* dmesg into chipmem prefers memory at the safe end */ 78
85 start = CHIP_PHYSADDR + chipavail - size; 79 pr_debug("amiga_chip_alloc_res: allocate %lu bytes\n", size);
86 80 error = allocate_resource(&chipram_res, res, size, 0, UINT_MAX,
87#ifdef DEBUG 81 PAGE_SIZE, NULL, NULL);
88 printk("amiga_chip_alloc_res: allocate %ld bytes\n", size); 82 if (error < 0) {
89#endif 83 pr_err("amiga_chip_alloc_res: allocate_resource() failed %d!\n",
90 if (allocate_resource(&chipram_res, res, size, start, UINT_MAX, PAGE_SIZE, NULL, NULL) < 0) { 84 error);
91 printk("amiga_chip_alloc_res: first alloc failed!\n"); 85 return NULL;
92 if (allocate_resource(&chipram_res, res, size, 0, UINT_MAX, PAGE_SIZE, NULL, NULL) < 0) 86 }
93 return NULL; 87
94 } 88 atomic_sub(size, &chipavail);
95 chipavail -= size; 89 pr_debug("amiga_chip_alloc_res: returning %pR\n", res);
96#ifdef DEBUG 90 return (void *)ZTWO_VADDR(res->start);
97 printk("amiga_chip_alloc_res: returning %lx\n", res->start);
98#endif
99 return (void *)ZTWO_VADDR(res->start);
100} 91}
101 92
102void amiga_chip_free(void *ptr) 93void amiga_chip_free(void *ptr)
103{ 94{
104 unsigned long start = ZTWO_PADDR(ptr); 95 unsigned long start = ZTWO_PADDR(ptr);
105 struct resource **p, *res; 96 struct resource *res;
106 unsigned long size; 97 unsigned long size;
107 98
108 for (p = &chipram_res.child; (res = *p); p = &res->sibling) { 99 res = lookup_resource(&chipram_res, start);
109 if (res->start != start) 100 if (!res) {
110 continue; 101 pr_err("amiga_chip_free: trying to free nonexistent region at "
111 *p = res->sibling; 102 "%p\n", ptr);
112 size = res->end-start; 103 return;
113#ifdef DEBUG 104 }
114 printk("amiga_chip_free: free %ld bytes at %p\n", size, ptr); 105
115#endif 106 size = resource_size(res);
116 chipavail += size; 107 pr_debug("amiga_chip_free: free %lu bytes at %p\n", size, ptr);
108 atomic_add(size, &chipavail);
109 release_resource(res);
117 kfree(res); 110 kfree(res);
118 return;
119 }
120 printk("amiga_chip_free: trying to free nonexistent region at %p\n", ptr);
121} 111}
122EXPORT_SYMBOL(amiga_chip_free); 112EXPORT_SYMBOL(amiga_chip_free);
123 113
124 114
125unsigned long amiga_chip_avail(void) 115unsigned long amiga_chip_avail(void)
126{ 116{
127#ifdef DEBUG 117 unsigned long n = atomic_read(&chipavail);
128 printk("amiga_chip_avail : %ld bytes\n", chipavail); 118
129#endif 119 pr_debug("amiga_chip_avail : %lu bytes\n", n);
130 return chipavail; 120 return n;
131} 121}
132EXPORT_SYMBOL(amiga_chip_avail); 122EXPORT_SYMBOL(amiga_chip_avail);
133 123
diff --git a/arch/m68k/atari/stram.c b/arch/m68k/atari/stram.c
index 6ec3b7f33779..0810c8d56e59 100644
--- a/arch/m68k/atari/stram.c
+++ b/arch/m68k/atari/stram.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * arch/m68k/atari/stram.c: Functions for ST-RAM allocations 2 * Functions for ST-RAM allocations
3 * 3 *
4 * Copyright 1994-97 Roman Hodek <Roman.Hodek@informatik.uni-erlangen.de> 4 * Copyright 1994-97 Roman Hodek <Roman.Hodek@informatik.uni-erlangen.de>
5 * 5 *
@@ -30,91 +30,35 @@
30#include <asm/atari_stram.h> 30#include <asm/atari_stram.h>
31#include <asm/io.h> 31#include <asm/io.h>
32 32
33#undef DEBUG
34
35#ifdef DEBUG
36#define DPRINTK(fmt,args...) printk( fmt, ##args )
37#else
38#define DPRINTK(fmt,args...)
39#endif
40
41#if defined(CONFIG_PROC_FS) && defined(CONFIG_STRAM_PROC)
42/* abbrev for the && above... */
43#define DO_PROC
44#include <linux/proc_fs.h>
45#include <linux/seq_file.h>
46#endif
47 33
48/* 34/*
49 * ++roman: 35 * The ST-RAM allocator allocates memory from a pool of reserved ST-RAM of
50 * 36 * configurable size, set aside on ST-RAM init.
51 * New version of ST-Ram buffer allocation. Instead of using the 37 * As long as this pool is not exhausted, allocation of real ST-RAM can be
52 * 1 MB - 4 KB that remain when the ST-Ram chunk starts at $1000 38 * guaranteed.
53 * (1 MB granularity!), such buffers are reserved like this:
54 *
55 * - If the kernel resides in ST-Ram anyway, we can take the buffer
56 * from behind the current kernel data space the normal way
57 * (incrementing start_mem).
58 *
59 * - If the kernel is in TT-Ram, stram_init() initializes start and
60 * end of the available region. Buffers are allocated from there
61 * and mem_init() later marks the such used pages as reserved.
62 * Since each TT-Ram chunk is at least 4 MB in size, I hope there
63 * won't be an overrun of the ST-Ram region by normal kernel data
64 * space.
65 *
66 * For that, ST-Ram may only be allocated while kernel initialization
67 * is going on, or exactly: before mem_init() is called. There is also
68 * no provision now for freeing ST-Ram buffers. It seems that isn't
69 * really needed.
70 *
71 */ 39 */
72 40
73/* Start and end (virtual) of ST-RAM */
74static void *stram_start, *stram_end;
75
76/* set after memory_init() executed and allocations via start_mem aren't
77 * possible anymore */
78static int mem_init_done;
79
80/* set if kernel is in ST-RAM */ 41/* set if kernel is in ST-RAM */
81static int kernel_in_stram; 42static int kernel_in_stram;
82 43
83typedef struct stram_block { 44static struct resource stram_pool = {
84 struct stram_block *next; 45 .name = "ST-RAM Pool"
85 void *start; 46};
86 unsigned long size;
87 unsigned flags;
88 const char *owner;
89} BLOCK;
90
91/* values for flags field */
92#define BLOCK_FREE 0x01 /* free structure in the BLOCKs pool */
93#define BLOCK_KMALLOCED 0x02 /* structure allocated by kmalloc() */
94#define BLOCK_GFP 0x08 /* block allocated with __get_dma_pages() */
95 47
96/* list of allocated blocks */ 48static unsigned long pool_size = 1024*1024;
97static BLOCK *alloc_list;
98 49
99/* We can't always use kmalloc() to allocate BLOCK structures, since
100 * stram_alloc() can be called rather early. So we need some pool of
101 * statically allocated structures. 20 of them is more than enough, so in most
102 * cases we never should need to call kmalloc(). */
103#define N_STATIC_BLOCKS 20
104static BLOCK static_blocks[N_STATIC_BLOCKS];
105 50
106/***************************** Prototypes *****************************/ 51static int __init atari_stram_setup(char *arg)
52{
53 if (!MACH_IS_ATARI)
54 return 0;
107 55
108static BLOCK *add_region( void *addr, unsigned long size ); 56 pool_size = memparse(arg, NULL);
109static BLOCK *find_region( void *addr ); 57 return 0;
110static int remove_region( BLOCK *block ); 58}
111 59
112/************************* End of Prototypes **************************/ 60early_param("stram_pool", atari_stram_setup);
113 61
114
115/* ------------------------------------------------------------------------ */
116/* Public Interface */
117/* ------------------------------------------------------------------------ */
118 62
119/* 63/*
120 * This init function is called very early by atari/config.c 64 * This init function is called very early by atari/config.c
@@ -123,25 +67,23 @@ static int remove_region( BLOCK *block );
123void __init atari_stram_init(void) 67void __init atari_stram_init(void)
124{ 68{
125 int i; 69 int i;
70 void *stram_start;
126 71
127 /* initialize static blocks */ 72 /*
128 for( i = 0; i < N_STATIC_BLOCKS; ++i ) 73 * determine whether kernel code resides in ST-RAM
129 static_blocks[i].flags = BLOCK_FREE; 74 * (then ST-RAM is the first memory block at virtual 0x0)
130 75 */
131 /* determine whether kernel code resides in ST-RAM (then ST-RAM is the
132 * first memory block at virtual 0x0) */
133 stram_start = phys_to_virt(0); 76 stram_start = phys_to_virt(0);
134 kernel_in_stram = (stram_start == 0); 77 kernel_in_stram = (stram_start == 0);
135 78
136 for( i = 0; i < m68k_num_memory; ++i ) { 79 for (i = 0; i < m68k_num_memory; ++i) {
137 if (m68k_memory[i].addr == 0) { 80 if (m68k_memory[i].addr == 0) {
138 /* skip first 2kB or page (supervisor-only!) */
139 stram_end = stram_start + m68k_memory[i].size;
140 return; 81 return;
141 } 82 }
142 } 83 }
84
143 /* Should never come here! (There is always ST-Ram!) */ 85 /* Should never come here! (There is always ST-Ram!) */
144 panic( "atari_stram_init: no ST-RAM found!" ); 86 panic("atari_stram_init: no ST-RAM found!");
145} 87}
146 88
147 89
@@ -151,226 +93,68 @@ void __init atari_stram_init(void)
151 */ 93 */
152void __init atari_stram_reserve_pages(void *start_mem) 94void __init atari_stram_reserve_pages(void *start_mem)
153{ 95{
154 /* always reserve first page of ST-RAM, the first 2 kB are 96 /*
155 * supervisor-only! */ 97 * always reserve first page of ST-RAM, the first 2 KiB are
98 * supervisor-only!
99 */
156 if (!kernel_in_stram) 100 if (!kernel_in_stram)
157 reserve_bootmem(0, PAGE_SIZE, BOOTMEM_DEFAULT); 101 reserve_bootmem(0, PAGE_SIZE, BOOTMEM_DEFAULT);
158 102
159} 103 stram_pool.start = (resource_size_t)alloc_bootmem_low_pages(pool_size);
104 stram_pool.end = stram_pool.start + pool_size - 1;
105 request_resource(&iomem_resource, &stram_pool);
160 106
161void atari_stram_mem_init_hook (void) 107 pr_debug("atari_stram pool: size = %lu bytes, resource = %pR\n",
162{ 108 pool_size, &stram_pool);
163 mem_init_done = 1;
164} 109}
165 110
166 111
167/* 112void *atari_stram_alloc(unsigned long size, const char *owner)
168 * This is main public interface: somehow allocate a ST-RAM block
169 *
170 * - If we're before mem_init(), we have to make a static allocation. The
171 * region is taken in the kernel data area (if the kernel is in ST-RAM) or
172 * from the start of ST-RAM (if the kernel is in TT-RAM) and added to the
173 * rsvd_stram_* region. The ST-RAM is somewhere in the middle of kernel
174 * address space in the latter case.
175 *
176 * - If mem_init() already has been called, try with __get_dma_pages().
177 * This has the disadvantage that it's very hard to get more than 1 page,
178 * and it is likely to fail :-(
179 *
180 */
181void *atari_stram_alloc(long size, const char *owner)
182{ 113{
183 void *addr = NULL; 114 struct resource *res;
184 BLOCK *block; 115 int error;
185 int flags; 116
186 117 pr_debug("atari_stram_alloc: allocate %lu bytes\n", size);
187 DPRINTK("atari_stram_alloc(size=%08lx,owner=%s)\n", size, owner); 118
188 119 /* round up */
189 if (!mem_init_done) 120 size = PAGE_ALIGN(size);
190 return alloc_bootmem_low(size); 121
191 else { 122 res = kzalloc(sizeof(struct resource), GFP_KERNEL);
192 /* After mem_init(): can only resort to __get_dma_pages() */ 123 if (!res)
193 addr = (void *)__get_dma_pages(GFP_KERNEL, get_order(size)); 124 return NULL;
194 flags = BLOCK_GFP; 125
195 DPRINTK( "atari_stram_alloc: after mem_init, " 126 res->name = owner;
196 "get_pages=%p\n", addr ); 127 error = allocate_resource(&stram_pool, res, size, 0, UINT_MAX,
128 PAGE_SIZE, NULL, NULL);
129 if (error < 0) {
130 pr_err("atari_stram_alloc: allocate_resource() failed %d!\n",
131 error);
132 kfree(res);
133 return NULL;
197 } 134 }
198 135
199 if (addr) { 136 pr_debug("atari_stram_alloc: returning %pR\n", res);
200 if (!(block = add_region( addr, size ))) { 137 return (void *)res->start;
201 /* out of memory for BLOCK structure :-( */
202 DPRINTK( "atari_stram_alloc: out of mem for BLOCK -- "
203 "freeing again\n" );
204 free_pages((unsigned long)addr, get_order(size));
205 return( NULL );
206 }
207 block->owner = owner;
208 block->flags |= flags;
209 }
210 return( addr );
211} 138}
212EXPORT_SYMBOL(atari_stram_alloc); 139EXPORT_SYMBOL(atari_stram_alloc);
213 140
214void atari_stram_free( void *addr )
215 141
142void atari_stram_free(void *addr)
216{ 143{
217 BLOCK *block; 144 unsigned long start = (unsigned long)addr;
218 145 struct resource *res;
219 DPRINTK( "atari_stram_free(addr=%p)\n", addr ); 146 unsigned long size;
220 147
221 if (!(block = find_region( addr ))) { 148 res = lookup_resource(&stram_pool, start);
222 printk( KERN_ERR "Attempt to free non-allocated ST-RAM block at %p " 149 if (!res) {
223 "from %p\n", addr, __builtin_return_address(0) ); 150 pr_err("atari_stram_free: trying to free nonexistent region "
151 "at %p\n", addr);
224 return; 152 return;
225 } 153 }
226 DPRINTK( "atari_stram_free: found block (%p): size=%08lx, owner=%s, "
227 "flags=%02x\n", block, block->size, block->owner, block->flags );
228
229 if (!(block->flags & BLOCK_GFP))
230 goto fail;
231 154
232 DPRINTK("atari_stram_free: is kmalloced, order_size=%d\n", 155 size = resource_size(res);
233 get_order(block->size)); 156 pr_debug("atari_stram_free: free %lu bytes at %p\n", size, addr);
234 free_pages((unsigned long)addr, get_order(block->size)); 157 release_resource(res);
235 remove_region( block ); 158 kfree(res);
236 return;
237
238 fail:
239 printk( KERN_ERR "atari_stram_free: cannot free block at %p "
240 "(called from %p)\n", addr, __builtin_return_address(0) );
241} 159}
242EXPORT_SYMBOL(atari_stram_free); 160EXPORT_SYMBOL(atari_stram_free);
243
244
245/* ------------------------------------------------------------------------ */
246/* Region Management */
247/* ------------------------------------------------------------------------ */
248
249
250/* insert a region into the alloced list (sorted) */
251static BLOCK *add_region( void *addr, unsigned long size )
252{
253 BLOCK **p, *n = NULL;
254 int i;
255
256 for( i = 0; i < N_STATIC_BLOCKS; ++i ) {
257 if (static_blocks[i].flags & BLOCK_FREE) {
258 n = &static_blocks[i];
259 n->flags = 0;
260 break;
261 }
262 }
263 if (!n && mem_init_done) {
264 /* if statics block pool exhausted and we can call kmalloc() already
265 * (after mem_init()), try that */
266 n = kmalloc( sizeof(BLOCK), GFP_KERNEL );
267 if (n)
268 n->flags = BLOCK_KMALLOCED;
269 }
270 if (!n) {
271 printk( KERN_ERR "Out of memory for ST-RAM descriptor blocks\n" );
272 return( NULL );
273 }
274 n->start = addr;
275 n->size = size;
276
277 for( p = &alloc_list; *p; p = &((*p)->next) )
278 if ((*p)->start > addr) break;
279 n->next = *p;
280 *p = n;
281
282 return( n );
283}
284
285
286/* find a region (by start addr) in the alloced list */
287static BLOCK *find_region( void *addr )
288{
289 BLOCK *p;
290
291 for( p = alloc_list; p; p = p->next ) {
292 if (p->start == addr)
293 return( p );
294 if (p->start > addr)
295 break;
296 }
297 return( NULL );
298}
299
300
301/* remove a block from the alloced list */
302static int remove_region( BLOCK *block )
303{
304 BLOCK **p;
305
306 for( p = &alloc_list; *p; p = &((*p)->next) )
307 if (*p == block) break;
308 if (!*p)
309 return( 0 );
310
311 *p = block->next;
312 if (block->flags & BLOCK_KMALLOCED)
313 kfree( block );
314 else
315 block->flags |= BLOCK_FREE;
316 return( 1 );
317}
318
319
320
321/* ------------------------------------------------------------------------ */
322/* /proc statistics file stuff */
323/* ------------------------------------------------------------------------ */
324
325#ifdef DO_PROC
326
327#define PRINT_PROC(fmt,args...) seq_printf( m, fmt, ##args )
328
329static int stram_proc_show(struct seq_file *m, void *v)
330{
331 BLOCK *p;
332
333 PRINT_PROC("Total ST-RAM: %8u kB\n",
334 (stram_end - stram_start) >> 10);
335 PRINT_PROC( "Allocated regions:\n" );
336 for( p = alloc_list; p; p = p->next ) {
337 PRINT_PROC("0x%08lx-0x%08lx: %s (",
338 virt_to_phys(p->start),
339 virt_to_phys(p->start+p->size-1),
340 p->owner);
341 if (p->flags & BLOCK_GFP)
342 PRINT_PROC( "page-alloced)\n" );
343 else
344 PRINT_PROC( "??)\n" );
345 }
346
347 return 0;
348}
349
350static int stram_proc_open(struct inode *inode, struct file *file)
351{
352 return single_open(file, stram_proc_show, NULL);
353}
354
355static const struct file_operations stram_proc_fops = {
356 .open = stram_proc_open,
357 .read = seq_read,
358 .llseek = seq_lseek,
359 .release = single_release,
360};
361
362static int __init proc_stram_init(void)
363{
364 proc_create("stram", 0, NULL, &stram_proc_fops);
365 return 0;
366}
367module_init(proc_stram_init);
368#endif
369
370
371/*
372 * Local variables:
373 * c-indent-level: 4
374 * tab-width: 4
375 * End:
376 */
diff --git a/arch/m68k/include/asm/atari_stram.h b/arch/m68k/include/asm/atari_stram.h
index 7546d13963be..62e27598af91 100644
--- a/arch/m68k/include/asm/atari_stram.h
+++ b/arch/m68k/include/asm/atari_stram.h
@@ -6,12 +6,11 @@
6 */ 6 */
7 7
8/* public interface */ 8/* public interface */
9void *atari_stram_alloc(long size, const char *owner); 9void *atari_stram_alloc(unsigned long size, const char *owner);
10void atari_stram_free(void *); 10void atari_stram_free(void *);
11 11
12/* functions called internally by other parts of the kernel */ 12/* functions called internally by other parts of the kernel */
13void atari_stram_init(void); 13void atari_stram_init(void);
14void atari_stram_reserve_pages(void *start_mem); 14void atari_stram_reserve_pages(void *start_mem);
15void atari_stram_mem_init_hook (void);
16 15
17#endif /*_M68K_ATARI_STRAM_H */ 16#endif /*_M68K_ATARI_STRAM_H */
diff --git a/arch/m68k/include/asm/atarihw.h b/arch/m68k/include/asm/atarihw.h
index f51f709bbf30..0392b28656ab 100644
--- a/arch/m68k/include/asm/atarihw.h
+++ b/arch/m68k/include/asm/atarihw.h
@@ -399,8 +399,8 @@ struct CODEC
399#define CODEC_OVERFLOW_LEFT 2 399#define CODEC_OVERFLOW_LEFT 2
400 u_char unused2, unused3, unused4, unused5; 400 u_char unused2, unused3, unused4, unused5;
401 u_char gpio_directions; 401 u_char gpio_directions;
402#define GPIO_IN 0 402#define CODEC_GPIO_IN 0
403#define GPIO_OUT 1 403#define CODEC_GPIO_OUT 1
404 u_char unused6; 404 u_char unused6;
405 u_char gpio_data; 405 u_char gpio_data;
406}; 406};
diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c
index 334d83640376..c3b45061dd08 100644
--- a/arch/m68k/kernel/setup_mm.c
+++ b/arch/m68k/kernel/setup_mm.c
@@ -216,7 +216,9 @@ static void __init m68k_parse_bootinfo(const struct bi_record *record)
216 216
217void __init setup_arch(char **cmdline_p) 217void __init setup_arch(char **cmdline_p)
218{ 218{
219#ifndef CONFIG_SUN3
219 int i; 220 int i;
221#endif
220 222
221 /* The bootinfo is located right after the kernel bss */ 223 /* The bootinfo is located right after the kernel bss */
222 m68k_parse_bootinfo((const struct bi_record *)_end); 224 m68k_parse_bootinfo((const struct bi_record *)_end);
diff --git a/arch/m68k/math-emu/fp_log.c b/arch/m68k/math-emu/fp_log.c
index 367ecee2f981..3384a5244fbd 100644
--- a/arch/m68k/math-emu/fp_log.c
+++ b/arch/m68k/math-emu/fp_log.c
@@ -105,9 +105,6 @@ fp_fetoxm1(struct fp_ext *dest, struct fp_ext *src)
105 105
106 fp_monadic_check(dest, src); 106 fp_monadic_check(dest, src);
107 107
108 if (IS_ZERO(dest))
109 return dest;
110
111 return dest; 108 return dest;
112} 109}
113 110
diff --git a/arch/m68k/math-emu/multi_arith.h b/arch/m68k/math-emu/multi_arith.h
index 4ad0ca918e2e..4b5eb3d85638 100644
--- a/arch/m68k/math-emu/multi_arith.h
+++ b/arch/m68k/math-emu/multi_arith.h
@@ -19,246 +19,6 @@
19#ifndef MULTI_ARITH_H 19#ifndef MULTI_ARITH_H
20#define MULTI_ARITH_H 20#define MULTI_ARITH_H
21 21
22#if 0 /* old code... */
23
24/* Unsigned only, because we don't need signs to multiply and divide. */
25typedef unsigned int int128[4];
26
27/* Word order */
28enum {
29 MSW128,
30 NMSW128,
31 NLSW128,
32 LSW128
33};
34
35/* big-endian */
36#define LO_WORD(ll) (((unsigned int *) &ll)[1])
37#define HI_WORD(ll) (((unsigned int *) &ll)[0])
38
39/* Convenience functions to stuff various integer values into int128s */
40
41static inline void zero128(int128 a)
42{
43 a[LSW128] = a[NLSW128] = a[NMSW128] = a[MSW128] = 0;
44}
45
46/* Human-readable word order in the arguments */
47static inline void set128(unsigned int i3, unsigned int i2, unsigned int i1,
48 unsigned int i0, int128 a)
49{
50 a[LSW128] = i0;
51 a[NLSW128] = i1;
52 a[NMSW128] = i2;
53 a[MSW128] = i3;
54}
55
56/* Convenience functions (for testing as well) */
57static inline void int64_to_128(unsigned long long src, int128 dest)
58{
59 dest[LSW128] = (unsigned int) src;
60 dest[NLSW128] = src >> 32;
61 dest[NMSW128] = dest[MSW128] = 0;
62}
63
64static inline void int128_to_64(const int128 src, unsigned long long *dest)
65{
66 *dest = src[LSW128] | (long long) src[NLSW128] << 32;
67}
68
69static inline void put_i128(const int128 a)
70{
71 printk("%08x %08x %08x %08x\n", a[MSW128], a[NMSW128],
72 a[NLSW128], a[LSW128]);
73}
74
75/* Internal shifters:
76
77 Note that these are only good for 0 < count < 32.
78 */
79
80static inline void _lsl128(unsigned int count, int128 a)
81{
82 a[MSW128] = (a[MSW128] << count) | (a[NMSW128] >> (32 - count));
83 a[NMSW128] = (a[NMSW128] << count) | (a[NLSW128] >> (32 - count));
84 a[NLSW128] = (a[NLSW128] << count) | (a[LSW128] >> (32 - count));
85 a[LSW128] <<= count;
86}
87
88static inline void _lsr128(unsigned int count, int128 a)
89{
90 a[LSW128] = (a[LSW128] >> count) | (a[NLSW128] << (32 - count));
91 a[NLSW128] = (a[NLSW128] >> count) | (a[NMSW128] << (32 - count));
92 a[NMSW128] = (a[NMSW128] >> count) | (a[MSW128] << (32 - count));
93 a[MSW128] >>= count;
94}
95
96/* Should be faster, one would hope */
97
98static inline void lslone128(int128 a)
99{
100 asm volatile ("lsl.l #1,%0\n"
101 "roxl.l #1,%1\n"
102 "roxl.l #1,%2\n"
103 "roxl.l #1,%3\n"
104 :
105 "=d" (a[LSW128]),
106 "=d"(a[NLSW128]),
107 "=d"(a[NMSW128]),
108 "=d"(a[MSW128])
109 :
110 "0"(a[LSW128]),
111 "1"(a[NLSW128]),
112 "2"(a[NMSW128]),
113 "3"(a[MSW128]));
114}
115
116static inline void lsrone128(int128 a)
117{
118 asm volatile ("lsr.l #1,%0\n"
119 "roxr.l #1,%1\n"
120 "roxr.l #1,%2\n"
121 "roxr.l #1,%3\n"
122 :
123 "=d" (a[MSW128]),
124 "=d"(a[NMSW128]),
125 "=d"(a[NLSW128]),
126 "=d"(a[LSW128])
127 :
128 "0"(a[MSW128]),
129 "1"(a[NMSW128]),
130 "2"(a[NLSW128]),
131 "3"(a[LSW128]));
132}
133
134/* Generalized 128-bit shifters:
135
136 These bit-shift to a multiple of 32, then move whole longwords. */
137
138static inline void lsl128(unsigned int count, int128 a)
139{
140 int wordcount, i;
141
142 if (count % 32)
143 _lsl128(count % 32, a);
144
145 if (0 == (wordcount = count / 32))
146 return;
147
148 /* argh, gak, endian-sensitive */
149 for (i = 0; i < 4 - wordcount; i++) {
150 a[i] = a[i + wordcount];
151 }
152 for (i = 3; i >= 4 - wordcount; --i) {
153 a[i] = 0;
154 }
155}
156
157static inline void lsr128(unsigned int count, int128 a)
158{
159 int wordcount, i;
160
161 if (count % 32)
162 _lsr128(count % 32, a);
163
164 if (0 == (wordcount = count / 32))
165 return;
166
167 for (i = 3; i >= wordcount; --i) {
168 a[i] = a[i - wordcount];
169 }
170 for (i = 0; i < wordcount; i++) {
171 a[i] = 0;
172 }
173}
174
175static inline int orl128(int a, int128 b)
176{
177 b[LSW128] |= a;
178}
179
180static inline int btsthi128(const int128 a)
181{
182 return a[MSW128] & 0x80000000;
183}
184
185/* test bits (numbered from 0 = LSB) up to and including "top" */
186static inline int bftestlo128(int top, const int128 a)
187{
188 int r = 0;
189
190 if (top > 31)
191 r |= a[LSW128];
192 if (top > 63)
193 r |= a[NLSW128];
194 if (top > 95)
195 r |= a[NMSW128];
196
197 r |= a[3 - (top / 32)] & ((1 << (top % 32 + 1)) - 1);
198
199 return (r != 0);
200}
201
202/* Aargh. We need these because GCC is broken */
203/* FIXME: do them in assembly, for goodness' sake! */
204static inline void mask64(int pos, unsigned long long *mask)
205{
206 *mask = 0;
207
208 if (pos < 32) {
209 LO_WORD(*mask) = (1 << pos) - 1;
210 return;
211 }
212 LO_WORD(*mask) = -1;
213 HI_WORD(*mask) = (1 << (pos - 32)) - 1;
214}
215
216static inline void bset64(int pos, unsigned long long *dest)
217{
218 /* This conditional will be optimized away. Thanks, GCC! */
219 if (pos < 32)
220 asm volatile ("bset %1,%0":"=m"
221 (LO_WORD(*dest)):"id"(pos));
222 else
223 asm volatile ("bset %1,%0":"=m"
224 (HI_WORD(*dest)):"id"(pos - 32));
225}
226
227static inline int btst64(int pos, unsigned long long dest)
228{
229 if (pos < 32)
230 return (0 != (LO_WORD(dest) & (1 << pos)));
231 else
232 return (0 != (HI_WORD(dest) & (1 << (pos - 32))));
233}
234
235static inline void lsl64(int count, unsigned long long *dest)
236{
237 if (count < 32) {
238 HI_WORD(*dest) = (HI_WORD(*dest) << count)
239 | (LO_WORD(*dest) >> count);
240 LO_WORD(*dest) <<= count;
241 return;
242 }
243 count -= 32;
244 HI_WORD(*dest) = LO_WORD(*dest) << count;
245 LO_WORD(*dest) = 0;
246}
247
248static inline void lsr64(int count, unsigned long long *dest)
249{
250 if (count < 32) {
251 LO_WORD(*dest) = (LO_WORD(*dest) >> count)
252 | (HI_WORD(*dest) << (32 - count));
253 HI_WORD(*dest) >>= count;
254 return;
255 }
256 count -= 32;
257 LO_WORD(*dest) = HI_WORD(*dest) >> count;
258 HI_WORD(*dest) = 0;
259}
260#endif
261
262static inline void fp_denormalize(struct fp_ext *reg, unsigned int cnt) 22static inline void fp_denormalize(struct fp_ext *reg, unsigned int cnt)
263{ 23{
264 reg->exp += cnt; 24 reg->exp += cnt;
@@ -481,117 +241,6 @@ static inline void fp_dividemant(union fp_mant128 *dest, struct fp_ext *src,
481 } 241 }
482} 242}
483 243
484#if 0
485static inline unsigned int fp_fls128(union fp_mant128 *src)
486{
487 unsigned long data;
488 unsigned int res, off;
489
490 if ((data = src->m32[0]))
491 off = 0;
492 else if ((data = src->m32[1]))
493 off = 32;
494 else if ((data = src->m32[2]))
495 off = 64;
496 else if ((data = src->m32[3]))
497 off = 96;
498 else
499 return 128;
500
501 asm ("bfffo %1{#0,#32},%0" : "=d" (res) : "dm" (data));
502 return res + off;
503}
504
505static inline void fp_shiftmant128(union fp_mant128 *src, int shift)
506{
507 unsigned long sticky;
508
509 switch (shift) {
510 case 0:
511 return;
512 case 1:
513 asm volatile ("lsl.l #1,%0"
514 : "=d" (src->m32[3]) : "0" (src->m32[3]));
515 asm volatile ("roxl.l #1,%0"
516 : "=d" (src->m32[2]) : "0" (src->m32[2]));
517 asm volatile ("roxl.l #1,%0"
518 : "=d" (src->m32[1]) : "0" (src->m32[1]));
519 asm volatile ("roxl.l #1,%0"
520 : "=d" (src->m32[0]) : "0" (src->m32[0]));
521 return;
522 case 2 ... 31:
523 src->m32[0] = (src->m32[0] << shift) | (src->m32[1] >> (32 - shift));
524 src->m32[1] = (src->m32[1] << shift) | (src->m32[2] >> (32 - shift));
525 src->m32[2] = (src->m32[2] << shift) | (src->m32[3] >> (32 - shift));
526 src->m32[3] = (src->m32[3] << shift);
527 return;
528 case 32 ... 63:
529 shift -= 32;
530 src->m32[0] = (src->m32[1] << shift) | (src->m32[2] >> (32 - shift));
531 src->m32[1] = (src->m32[2] << shift) | (src->m32[3] >> (32 - shift));
532 src->m32[2] = (src->m32[3] << shift);
533 src->m32[3] = 0;
534 return;
535 case 64 ... 95:
536 shift -= 64;
537 src->m32[0] = (src->m32[2] << shift) | (src->m32[3] >> (32 - shift));
538 src->m32[1] = (src->m32[3] << shift);
539 src->m32[2] = src->m32[3] = 0;
540 return;
541 case 96 ... 127:
542 shift -= 96;
543 src->m32[0] = (src->m32[3] << shift);
544 src->m32[1] = src->m32[2] = src->m32[3] = 0;
545 return;
546 case -31 ... -1:
547 shift = -shift;
548 sticky = 0;
549 if (src->m32[3] << (32 - shift))
550 sticky = 1;
551 src->m32[3] = (src->m32[3] >> shift) | (src->m32[2] << (32 - shift)) | sticky;
552 src->m32[2] = (src->m32[2] >> shift) | (src->m32[1] << (32 - shift));
553 src->m32[1] = (src->m32[1] >> shift) | (src->m32[0] << (32 - shift));
554 src->m32[0] = (src->m32[0] >> shift);
555 return;
556 case -63 ... -32:
557 shift = -shift - 32;
558 sticky = 0;
559 if ((src->m32[2] << (32 - shift)) || src->m32[3])
560 sticky = 1;
561 src->m32[3] = (src->m32[2] >> shift) | (src->m32[1] << (32 - shift)) | sticky;
562 src->m32[2] = (src->m32[1] >> shift) | (src->m32[0] << (32 - shift));
563 src->m32[1] = (src->m32[0] >> shift);
564 src->m32[0] = 0;
565 return;
566 case -95 ... -64:
567 shift = -shift - 64;
568 sticky = 0;
569 if ((src->m32[1] << (32 - shift)) || src->m32[2] || src->m32[3])
570 sticky = 1;
571 src->m32[3] = (src->m32[1] >> shift) | (src->m32[0] << (32 - shift)) | sticky;
572 src->m32[2] = (src->m32[0] >> shift);
573 src->m32[1] = src->m32[0] = 0;
574 return;
575 case -127 ... -96:
576 shift = -shift - 96;
577 sticky = 0;
578 if ((src->m32[0] << (32 - shift)) || src->m32[1] || src->m32[2] || src->m32[3])
579 sticky = 1;
580 src->m32[3] = (src->m32[0] >> shift) | sticky;
581 src->m32[2] = src->m32[1] = src->m32[0] = 0;
582 return;
583 }
584
585 if (shift < 0 && (src->m32[0] || src->m32[1] || src->m32[2] || src->m32[3]))
586 src->m32[3] = 1;
587 else
588 src->m32[3] = 0;
589 src->m32[2] = 0;
590 src->m32[1] = 0;
591 src->m32[0] = 0;
592}
593#endif
594
595static inline void fp_putmant128(struct fp_ext *dest, union fp_mant128 *src, 244static inline void fp_putmant128(struct fp_ext *dest, union fp_mant128 *src,
596 int shift) 245 int shift)
597{ 246{
@@ -637,183 +286,4 @@ static inline void fp_putmant128(struct fp_ext *dest, union fp_mant128 *src,
637 } 286 }
638} 287}
639 288
640#if 0 /* old code... */
641static inline int fls(unsigned int a)
642{
643 int r;
644
645 asm volatile ("bfffo %1{#0,#32},%0"
646 : "=d" (r) : "md" (a));
647 return r;
648}
649
650/* fls = "find last set" (cf. ffs(3)) */
651static inline int fls128(const int128 a)
652{
653 if (a[MSW128])
654 return fls(a[MSW128]);
655 if (a[NMSW128])
656 return fls(a[NMSW128]) + 32;
657 /* XXX: it probably never gets beyond this point in actual
658 use, but that's indicative of a more general problem in the
659 algorithm (i.e. as per the actual 68881 implementation, we
660 really only need at most 67 bits of precision [plus
661 overflow]) so I'm not going to fix it. */
662 if (a[NLSW128])
663 return fls(a[NLSW128]) + 64;
664 if (a[LSW128])
665 return fls(a[LSW128]) + 96;
666 else
667 return -1;
668}
669
670static inline int zerop128(const int128 a)
671{
672 return !(a[LSW128] | a[NLSW128] | a[NMSW128] | a[MSW128]);
673}
674
675static inline int nonzerop128(const int128 a)
676{
677 return (a[LSW128] | a[NLSW128] | a[NMSW128] | a[MSW128]);
678}
679
680/* Addition and subtraction */
681/* Do these in "pure" assembly, because "extended" asm is unmanageable
682 here */
683static inline void add128(const int128 a, int128 b)
684{
685 /* rotating carry flags */
686 unsigned int carry[2];
687
688 carry[0] = a[LSW128] > (0xffffffff - b[LSW128]);
689 b[LSW128] += a[LSW128];
690
691 carry[1] = a[NLSW128] > (0xffffffff - b[NLSW128] - carry[0]);
692 b[NLSW128] = a[NLSW128] + b[NLSW128] + carry[0];
693
694 carry[0] = a[NMSW128] > (0xffffffff - b[NMSW128] - carry[1]);
695 b[NMSW128] = a[NMSW128] + b[NMSW128] + carry[1];
696
697 b[MSW128] = a[MSW128] + b[MSW128] + carry[0];
698}
699
700/* Note: assembler semantics: "b -= a" */
701static inline void sub128(const int128 a, int128 b)
702{
703 /* rotating borrow flags */
704 unsigned int borrow[2];
705
706 borrow[0] = b[LSW128] < a[LSW128];
707 b[LSW128] -= a[LSW128];
708
709 borrow[1] = b[NLSW128] < a[NLSW128] + borrow[0];
710 b[NLSW128] = b[NLSW128] - a[NLSW128] - borrow[0];
711
712 borrow[0] = b[NMSW128] < a[NMSW128] + borrow[1];
713 b[NMSW128] = b[NMSW128] - a[NMSW128] - borrow[1];
714
715 b[MSW128] = b[MSW128] - a[MSW128] - borrow[0];
716}
717
718/* Poor man's 64-bit expanding multiply */
719static inline void mul64(unsigned long long a, unsigned long long b, int128 c)
720{
721 unsigned long long acc;
722 int128 acc128;
723
724 zero128(acc128);
725 zero128(c);
726
727 /* first the low words */
728 if (LO_WORD(a) && LO_WORD(b)) {
729 acc = (long long) LO_WORD(a) * LO_WORD(b);
730 c[NLSW128] = HI_WORD(acc);
731 c[LSW128] = LO_WORD(acc);
732 }
733 /* Next the high words */
734 if (HI_WORD(a) && HI_WORD(b)) {
735 acc = (long long) HI_WORD(a) * HI_WORD(b);
736 c[MSW128] = HI_WORD(acc);
737 c[NMSW128] = LO_WORD(acc);
738 }
739 /* The middle words */
740 if (LO_WORD(a) && HI_WORD(b)) {
741 acc = (long long) LO_WORD(a) * HI_WORD(b);
742 acc128[NMSW128] = HI_WORD(acc);
743 acc128[NLSW128] = LO_WORD(acc);
744 add128(acc128, c);
745 }
746 /* The first and last words */
747 if (HI_WORD(a) && LO_WORD(b)) {
748 acc = (long long) HI_WORD(a) * LO_WORD(b);
749 acc128[NMSW128] = HI_WORD(acc);
750 acc128[NLSW128] = LO_WORD(acc);
751 add128(acc128, c);
752 }
753}
754
755/* Note: unsigned */
756static inline int cmp128(int128 a, int128 b)
757{
758 if (a[MSW128] < b[MSW128])
759 return -1;
760 if (a[MSW128] > b[MSW128])
761 return 1;
762 if (a[NMSW128] < b[NMSW128])
763 return -1;
764 if (a[NMSW128] > b[NMSW128])
765 return 1;
766 if (a[NLSW128] < b[NLSW128])
767 return -1;
768 if (a[NLSW128] > b[NLSW128])
769 return 1;
770
771 return (signed) a[LSW128] - b[LSW128];
772}
773
774inline void div128(int128 a, int128 b, int128 c)
775{
776 int128 mask;
777
778 /* Algorithm:
779
780 Shift the divisor until it's at least as big as the
781 dividend, keeping track of the position to which we've
782 shifted it, i.e. the power of 2 which we've multiplied it
783 by.
784
785 Then, for this power of 2 (the mask), and every one smaller
786 than it, subtract the mask from the dividend and add it to
787 the quotient until the dividend is smaller than the raised
788 divisor. At this point, divide the dividend and the mask
789 by 2 (i.e. shift one place to the right). Lather, rinse,
790 and repeat, until there are no more powers of 2 left. */
791
792 /* FIXME: needless to say, there's room for improvement here too. */
793
794 /* Shift up */
795 /* XXX: since it just has to be "at least as big", we can
796 probably eliminate this horribly wasteful loop. I will
797 have to prove this first, though */
798 set128(0, 0, 0, 1, mask);
799 while (cmp128(b, a) < 0 && !btsthi128(b)) {
800 lslone128(b);
801 lslone128(mask);
802 }
803
804 /* Shift down */
805 zero128(c);
806 do {
807 if (cmp128(a, b) >= 0) {
808 sub128(b, a);
809 add128(mask, c);
810 }
811 lsrone128(mask);
812 lsrone128(b);
813 } while (nonzerop128(mask));
814
815 /* The remainder is in a... */
816}
817#endif
818
819#endif /* MULTI_ARITH_H */ 289#endif /* MULTI_ARITH_H */
diff --git a/arch/m68k/mm/init_mm.c b/arch/m68k/mm/init_mm.c
index 9113c2f17607..bbe525434ccb 100644
--- a/arch/m68k/mm/init_mm.c
+++ b/arch/m68k/mm/init_mm.c
@@ -83,11 +83,6 @@ void __init mem_init(void)
83 int initpages = 0; 83 int initpages = 0;
84 int i; 84 int i;
85 85
86#ifdef CONFIG_ATARI
87 if (MACH_IS_ATARI)
88 atari_stram_mem_init_hook();
89#endif
90
91 /* this will put all memory onto the freelists */ 86 /* this will put all memory onto the freelists */
92 totalram_pages = num_physpages = 0; 87 totalram_pages = num_physpages = 0;
93 for_each_online_pgdat(pgdat) { 88 for_each_online_pgdat(pgdat) {
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
index 6ffccd6e0156..d0479e2163fa 100644
--- a/arch/sparc/kernel/ioport.c
+++ b/arch/sparc/kernel/ioport.c
@@ -65,9 +65,6 @@ static inline void dma_make_coherent(unsigned long pa, unsigned long len)
65} 65}
66#endif 66#endif
67 67
68static struct resource *_sparc_find_resource(struct resource *r,
69 unsigned long);
70
71static void __iomem *_sparc_ioremap(struct resource *res, u32 bus, u32 pa, int sz); 68static void __iomem *_sparc_ioremap(struct resource *res, u32 bus, u32 pa, int sz);
72static void __iomem *_sparc_alloc_io(unsigned int busno, unsigned long phys, 69static void __iomem *_sparc_alloc_io(unsigned int busno, unsigned long phys,
73 unsigned long size, char *name); 70 unsigned long size, char *name);
@@ -143,7 +140,11 @@ void iounmap(volatile void __iomem *virtual)
143 unsigned long vaddr = (unsigned long) virtual & PAGE_MASK; 140 unsigned long vaddr = (unsigned long) virtual & PAGE_MASK;
144 struct resource *res; 141 struct resource *res;
145 142
146 if ((res = _sparc_find_resource(&sparc_iomap, vaddr)) == NULL) { 143 /*
144 * XXX Too slow. Can have 8192 DVMA pages on sun4m in the worst case.
145 * This probably warrants some sort of hashing.
146 */
147 if ((res = lookup_resource(&sparc_iomap, vaddr)) == NULL) {
147 printk("free_io/iounmap: cannot free %lx\n", vaddr); 148 printk("free_io/iounmap: cannot free %lx\n", vaddr);
148 return; 149 return;
149 } 150 }
@@ -319,7 +320,7 @@ static void sbus_free_coherent(struct device *dev, size_t n, void *p,
319 struct resource *res; 320 struct resource *res;
320 struct page *pgv; 321 struct page *pgv;
321 322
322 if ((res = _sparc_find_resource(&_sparc_dvma, 323 if ((res = lookup_resource(&_sparc_dvma,
323 (unsigned long)p)) == NULL) { 324 (unsigned long)p)) == NULL) {
324 printk("sbus_free_consistent: cannot free %p\n", p); 325 printk("sbus_free_consistent: cannot free %p\n", p);
325 return; 326 return;
@@ -492,7 +493,7 @@ static void pci32_free_coherent(struct device *dev, size_t n, void *p,
492{ 493{
493 struct resource *res; 494 struct resource *res;
494 495
495 if ((res = _sparc_find_resource(&_sparc_dvma, 496 if ((res = lookup_resource(&_sparc_dvma,
496 (unsigned long)p)) == NULL) { 497 (unsigned long)p)) == NULL) {
497 printk("pci_free_consistent: cannot free %p\n", p); 498 printk("pci_free_consistent: cannot free %p\n", p);
498 return; 499 return;
@@ -715,25 +716,6 @@ static const struct file_operations sparc_io_proc_fops = {
715}; 716};
716#endif /* CONFIG_PROC_FS */ 717#endif /* CONFIG_PROC_FS */
717 718
718/*
719 * This is a version of find_resource and it belongs to kernel/resource.c.
720 * Until we have agreement with Linus and Martin, it lingers here.
721 *
722 * XXX Too slow. Can have 8192 DVMA pages on sun4m in the worst case.
723 * This probably warrants some sort of hashing.
724 */
725static struct resource *_sparc_find_resource(struct resource *root,
726 unsigned long hit)
727{
728 struct resource *tmp;
729
730 for (tmp = root->child; tmp != 0; tmp = tmp->sibling) {
731 if (tmp->start <= hit && tmp->end >= hit)
732 return tmp;
733 }
734 return NULL;
735}
736
737static void register_proc_sparc_ioport(void) 719static void register_proc_sparc_ioport(void)
738{ 720{
739#ifdef CONFIG_PROC_FS 721#ifdef CONFIG_PROC_FS