aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68k
diff options
context:
space:
mode:
authorRoman Zippel <zippel@linux-m68k.org>2007-05-31 03:40:54 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-31 10:58:14 -0400
commit12d810c1b8c2b913d48e629e2b5c01d105029839 (patch)
treeb39162d3168f6173af3d0e5790e16eb45a70dfaf /arch/m68k
parent00c541eae7a477e3d1adb1ebf27cccc0bdb5f824 (diff)
m68k: discontinuous memory support
Fix support for discontinuous memory Signed-off-by: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/m68k')
-rw-r--r--arch/m68k/Kconfig13
-rw-r--r--arch/m68k/kernel/module.c3
-rw-r--r--arch/m68k/kernel/setup.c37
-rw-r--r--arch/m68k/mm/init.c119
-rw-r--r--arch/m68k/mm/memory.c73
-rw-r--r--arch/m68k/mm/motorola.c101
-rw-r--r--arch/m68k/sun3/config.c2
7 files changed, 171 insertions, 177 deletions
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index b8536c7c0877..85cdd23b0447 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -355,8 +355,9 @@ config RMW_INSNS
355 adventurous. 355 adventurous.
356 356
357config SINGLE_MEMORY_CHUNK 357config SINGLE_MEMORY_CHUNK
358 bool "Use one physical chunk of memory only" 358 bool "Use one physical chunk of memory only" if ADVANCED && !SUN3
359 depends on ADVANCED && !SUN3 359 default y if SUN3
360 select NEED_MULTIPLE_NODES
360 help 361 help
361 Ignore all but the first contiguous chunk of physical memory for VM 362 Ignore all but the first contiguous chunk of physical memory for VM
362 purposes. This will save a few bytes kernel size and may speed up 363 purposes. This will save a few bytes kernel size and may speed up
@@ -377,6 +378,14 @@ config 060_WRITETHROUGH
377 is hardwired on. The 53c710 SCSI driver is known to suffer from 378 is hardwired on. The 53c710 SCSI driver is known to suffer from
378 this problem. 379 this problem.
379 380
381config ARCH_DISCONTIGMEM_ENABLE
382 def_bool !SINGLE_MEMORY_CHUNK
383
384config NODES_SHIFT
385 int
386 default "3"
387 depends on !SINGLE_MEMORY_CHUNK
388
380source "mm/Kconfig" 389source "mm/Kconfig"
381 390
382endmenu 391endmenu
diff --git a/arch/m68k/kernel/module.c b/arch/m68k/kernel/module.c
index 32969d0cecc4..774862bc6977 100644
--- a/arch/m68k/kernel/module.c
+++ b/arch/m68k/kernel/module.c
@@ -149,6 +149,9 @@ void module_fixup(struct module *mod, struct m68k_fixup_info *start,
149 case m68k_fixup_memoffset: 149 case m68k_fixup_memoffset:
150 *(u32 *)fixup->addr = m68k_memoffset; 150 *(u32 *)fixup->addr = m68k_memoffset;
151 break; 151 break;
152 case m68k_fixup_vnode_shift:
153 *(u16 *)fixup->addr += m68k_virt_to_node_shift;
154 break;
152 } 155 }
153 } 156 }
154} 157}
diff --git a/arch/m68k/kernel/setup.c b/arch/m68k/kernel/setup.c
index 610319356691..215c7bd43924 100644
--- a/arch/m68k/kernel/setup.c
+++ b/arch/m68k/kernel/setup.c
@@ -60,14 +60,12 @@ extern unsigned long availmem;
60int m68k_num_memory; 60int m68k_num_memory;
61int m68k_realnum_memory; 61int m68k_realnum_memory;
62EXPORT_SYMBOL(m68k_realnum_memory); 62EXPORT_SYMBOL(m68k_realnum_memory);
63#ifdef CONFIG_SINGLE_MEMORY_CHUNK
64unsigned long m68k_memoffset; 63unsigned long m68k_memoffset;
65EXPORT_SYMBOL(m68k_memoffset); 64EXPORT_SYMBOL(m68k_memoffset);
66#endif
67struct mem_info m68k_memory[NUM_MEMINFO]; 65struct mem_info m68k_memory[NUM_MEMINFO];
68EXPORT_SYMBOL(m68k_memory); 66EXPORT_SYMBOL(m68k_memory);
69 67
70static struct mem_info m68k_ramdisk; 68struct mem_info m68k_ramdisk;
71 69
72static char m68k_command_line[CL_SIZE]; 70static char m68k_command_line[CL_SIZE];
73 71
@@ -208,9 +206,6 @@ static void __init m68k_parse_bootinfo(const struct bi_record *record)
208void __init setup_arch(char **cmdline_p) 206void __init setup_arch(char **cmdline_p)
209{ 207{
210 extern int _etext, _edata, _end; 208 extern int _etext, _edata, _end;
211#ifndef CONFIG_SUN3
212 unsigned long endmem, startmem;
213#endif
214 int i; 209 int i;
215 210
216 /* The bootinfo is located right after the kernel bss */ 211 /* The bootinfo is located right after the kernel bss */
@@ -320,30 +315,16 @@ void __init setup_arch(char **cmdline_p)
320 panic("No configuration setup"); 315 panic("No configuration setup");
321 } 316 }
322 317
323#ifndef CONFIG_SUN3 318 paging_init();
324 startmem= m68k_memory[0].addr;
325 endmem = startmem + m68k_memory[0].size;
326 high_memory = (void *)PAGE_OFFSET;
327 for (i = 0; i < m68k_num_memory; i++) {
328 m68k_memory[i].size &= MASK_256K;
329 if (m68k_memory[i].addr < startmem)
330 startmem = m68k_memory[i].addr;
331 if (m68k_memory[i].addr+m68k_memory[i].size > endmem)
332 endmem = m68k_memory[i].addr+m68k_memory[i].size;
333 high_memory += m68k_memory[i].size;
334 }
335
336 availmem += init_bootmem_node(NODE_DATA(0), availmem >> PAGE_SHIFT,
337 startmem >> PAGE_SHIFT, endmem >> PAGE_SHIFT);
338
339 for (i = 0; i < m68k_num_memory; i++)
340 free_bootmem(m68k_memory[i].addr, m68k_memory[i].size);
341
342 reserve_bootmem(m68k_memory[0].addr, availmem - m68k_memory[0].addr);
343 319
320#ifndef CONFIG_SUN3
321 for (i = 1; i < m68k_num_memory; i++)
322 free_bootmem_node(NODE_DATA(i), m68k_memory[i].addr,
323 m68k_memory[i].size);
344#ifdef CONFIG_BLK_DEV_INITRD 324#ifdef CONFIG_BLK_DEV_INITRD
345 if (m68k_ramdisk.size) { 325 if (m68k_ramdisk.size) {
346 reserve_bootmem(m68k_ramdisk.addr, m68k_ramdisk.size); 326 reserve_bootmem_node(__virt_to_node(phys_to_virt(m68k_ramdisk.addr)),
327 m68k_ramdisk.addr, m68k_ramdisk.size);
347 initrd_start = (unsigned long)phys_to_virt(m68k_ramdisk.addr); 328 initrd_start = (unsigned long)phys_to_virt(m68k_ramdisk.addr);
348 initrd_end = initrd_start + m68k_ramdisk.size; 329 initrd_end = initrd_start + m68k_ramdisk.size;
349 printk("initrd: %08lx - %08lx\n", initrd_start, initrd_end); 330 printk("initrd: %08lx - %08lx\n", initrd_start, initrd_end);
@@ -362,8 +343,6 @@ void __init setup_arch(char **cmdline_p)
362 343
363#endif /* !CONFIG_SUN3 */ 344#endif /* !CONFIG_SUN3 */
364 345
365 paging_init();
366
367/* set ISA defs early as possible */ 346/* set ISA defs early as possible */
368#if defined(CONFIG_ISA) && defined(MULTI_ISA) 347#if defined(CONFIG_ISA) && defined(MULTI_ISA)
369#if defined(CONFIG_Q40) 348#if defined(CONFIG_Q40)
diff --git a/arch/m68k/mm/init.c b/arch/m68k/mm/init.c
index ab90213e5c54..f1de19e1dde6 100644
--- a/arch/m68k/mm/init.c
+++ b/arch/m68k/mm/init.c
@@ -7,6 +7,7 @@
7 * to motorola.c and sun3mmu.c 7 * to motorola.c and sun3mmu.c
8 */ 8 */
9 9
10#include <linux/module.h>
10#include <linux/signal.h> 11#include <linux/signal.h>
11#include <linux/sched.h> 12#include <linux/sched.h>
12#include <linux/mm.h> 13#include <linux/mm.h>
@@ -31,6 +32,37 @@
31 32
32DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); 33DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
33 34
35static bootmem_data_t __initdata bootmem_data[MAX_NUMNODES];
36
37pg_data_t pg_data_map[MAX_NUMNODES];
38EXPORT_SYMBOL(pg_data_map);
39
40int m68k_virt_to_node_shift;
41
42#ifndef CONFIG_SINGLE_MEMORY_CHUNK
43pg_data_t *pg_data_table[65];
44EXPORT_SYMBOL(pg_data_table);
45#endif
46
47void m68k_setup_node(int node)
48{
49#ifndef CONFIG_SINGLE_MEMORY_CHUNK
50 struct mem_info *info = m68k_memory + node;
51 int i, end;
52
53 i = (unsigned long)phys_to_virt(info->addr) >> __virt_to_node_shift();
54 end = (unsigned long)phys_to_virt(info->addr + info->size - 1) >> __virt_to_node_shift();
55 for (; i <= end; i++) {
56 if (pg_data_table[i])
57 printk("overlap at %u for chunk %u\n", i, node);
58 pg_data_table[i] = pg_data_map + node;
59 }
60#endif
61 pg_data_map[node].bdata = bootmem_data + node;
62 node_set_online(node);
63}
64
65
34/* 66/*
35 * ZERO_PAGE is a special page that is used for zero-initialized 67 * ZERO_PAGE is a special page that is used for zero-initialized
36 * data and COW. 68 * data and COW.
@@ -40,52 +72,51 @@ void *empty_zero_page;
40 72
41void show_mem(void) 73void show_mem(void)
42{ 74{
43 unsigned long i; 75 pg_data_t *pgdat;
44 int free = 0, total = 0, reserved = 0, shared = 0; 76 int free = 0, total = 0, reserved = 0, shared = 0;
45 int cached = 0; 77 int cached = 0;
46 78 int i;
47 printk("\nMem-info:\n"); 79
48 show_free_areas(); 80 printk("\nMem-info:\n");
49 printk("Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10)); 81 show_free_areas();
50 i = max_mapnr; 82 printk("Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10));
51 while (i-- > 0) { 83 for_each_online_pgdat(pgdat) {
52 total++; 84 for (i = 0; i < pgdat->node_spanned_pages; i++) {
53 if (PageReserved(mem_map+i)) 85 struct page *page = pgdat->node_mem_map + i;
54 reserved++; 86 total++;
55 else if (PageSwapCache(mem_map+i)) 87 if (PageReserved(page))
56 cached++; 88 reserved++;
57 else if (!page_count(mem_map+i)) 89 else if (PageSwapCache(page))
58 free++; 90 cached++;
59 else 91 else if (!page_count(page))
60 shared += page_count(mem_map+i) - 1; 92 free++;
61 } 93 else
62 printk("%d pages of RAM\n",total); 94 shared += page_count(page) - 1;
63 printk("%d free pages\n",free); 95 }
64 printk("%d reserved pages\n",reserved); 96 }
65 printk("%d pages shared\n",shared); 97 printk("%d pages of RAM\n",total);
66 printk("%d pages swap cached\n",cached); 98 printk("%d free pages\n",free);
99 printk("%d reserved pages\n",reserved);
100 printk("%d pages shared\n",shared);
101 printk("%d pages swap cached\n",cached);
67} 102}
68 103
69extern void init_pointer_table(unsigned long ptable); 104extern void init_pointer_table(unsigned long ptable);
70 105
71/* References to section boundaries */ 106/* References to section boundaries */
72 107
73extern char _text, _etext, _edata, __bss_start, _end; 108extern char _text[], _etext[];
74extern char __init_begin, __init_end; 109extern char __init_begin[], __init_end[];
75 110
76extern pmd_t *zero_pgtable; 111extern pmd_t *zero_pgtable;
77 112
78void __init mem_init(void) 113void __init mem_init(void)
79{ 114{
115 pg_data_t *pgdat;
80 int codepages = 0; 116 int codepages = 0;
81 int datapages = 0; 117 int datapages = 0;
82 int initpages = 0; 118 int initpages = 0;
83 unsigned long tmp;
84#ifndef CONFIG_SUN3
85 int i; 119 int i;
86#endif
87
88 max_mapnr = num_physpages = (((unsigned long)high_memory - PAGE_OFFSET) >> PAGE_SHIFT);
89 120
90#ifdef CONFIG_ATARI 121#ifdef CONFIG_ATARI
91 if (MACH_IS_ATARI) 122 if (MACH_IS_ATARI)
@@ -93,19 +124,25 @@ void __init mem_init(void)
93#endif 124#endif
94 125
95 /* this will put all memory onto the freelists */ 126 /* this will put all memory onto the freelists */
96 totalram_pages = free_all_bootmem(); 127 totalram_pages = num_physpages = 0;
97 128 for_each_online_pgdat(pgdat) {
98 for (tmp = PAGE_OFFSET ; tmp < (unsigned long)high_memory; tmp += PAGE_SIZE) { 129 num_physpages += pgdat->node_present_pages;
99 if (PageReserved(virt_to_page(tmp))) { 130
100 if (tmp >= (unsigned long)&_text 131 totalram_pages += free_all_bootmem_node(pgdat);
101 && tmp < (unsigned long)&_etext) 132 for (i = 0; i < pgdat->node_spanned_pages; i++) {
133 struct page *page = pgdat->node_mem_map + i;
134 char *addr = page_to_virt(page);
135
136 if (!PageReserved(page))
137 continue;
138 if (addr >= _text &&
139 addr < _etext)
102 codepages++; 140 codepages++;
103 else if (tmp >= (unsigned long) &__init_begin 141 else if (addr >= __init_begin &&
104 && tmp < (unsigned long) &__init_end) 142 addr < __init_end)
105 initpages++; 143 initpages++;
106 else 144 else
107 datapages++; 145 datapages++;
108 continue;
109 } 146 }
110 } 147 }
111 148
@@ -124,7 +161,7 @@ void __init mem_init(void)
124 161
125 printk("Memory: %luk/%luk available (%dk kernel code, %dk data, %dk init)\n", 162 printk("Memory: %luk/%luk available (%dk kernel code, %dk data, %dk init)\n",
126 (unsigned long)nr_free_pages() << (PAGE_SHIFT-10), 163 (unsigned long)nr_free_pages() << (PAGE_SHIFT-10),
127 max_mapnr << (PAGE_SHIFT-10), 164 totalram_pages << (PAGE_SHIFT-10),
128 codepages << (PAGE_SHIFT-10), 165 codepages << (PAGE_SHIFT-10),
129 datapages << (PAGE_SHIFT-10), 166 datapages << (PAGE_SHIFT-10),
130 initpages << (PAGE_SHIFT-10)); 167 initpages << (PAGE_SHIFT-10));
diff --git a/arch/m68k/mm/memory.c b/arch/m68k/mm/memory.c
index 13c0b4ad01eb..b7473525b431 100644
--- a/arch/m68k/mm/memory.c
+++ b/arch/m68k/mm/memory.c
@@ -127,67 +127,6 @@ int free_pointer_table (pmd_t *ptable)
127 return 0; 127 return 0;
128} 128}
129 129
130#ifdef DEBUG_INVALID_PTOV
131int mm_inv_cnt = 5;
132#endif
133
134#ifndef CONFIG_SINGLE_MEMORY_CHUNK
135/*
136 * The following two routines map from a physical address to a kernel
137 * virtual address and vice versa.
138 */
139unsigned long mm_vtop(unsigned long vaddr)
140{
141 int i=0;
142 unsigned long voff = (unsigned long)vaddr - PAGE_OFFSET;
143
144 do {
145 if (voff < m68k_memory[i].size) {
146#ifdef DEBUGPV
147 printk ("VTOP(%p)=%lx\n", vaddr,
148 m68k_memory[i].addr + voff);
149#endif
150 return m68k_memory[i].addr + voff;
151 }
152 voff -= m68k_memory[i].size;
153 } while (++i < m68k_num_memory);
154
155 /* As a special case allow `__pa(high_memory)'. */
156 if (voff == 0)
157 return m68k_memory[i-1].addr + m68k_memory[i-1].size;
158
159 return -1;
160}
161EXPORT_SYMBOL(mm_vtop);
162
163unsigned long mm_ptov (unsigned long paddr)
164{
165 int i = 0;
166 unsigned long poff, voff = PAGE_OFFSET;
167
168 do {
169 poff = paddr - m68k_memory[i].addr;
170 if (poff < m68k_memory[i].size) {
171#ifdef DEBUGPV
172 printk ("PTOV(%lx)=%lx\n", paddr, poff + voff);
173#endif
174 return poff + voff;
175 }
176 voff += m68k_memory[i].size;
177 } while (++i < m68k_num_memory);
178
179#ifdef DEBUG_INVALID_PTOV
180 if (mm_inv_cnt > 0) {
181 mm_inv_cnt--;
182 printk("Invalid use of phys_to_virt(0x%lx) at 0x%p!\n",
183 paddr, __builtin_return_address(0));
184 }
185#endif
186 return -1;
187}
188EXPORT_SYMBOL(mm_ptov);
189#endif
190
191/* invalidate page in both caches */ 130/* invalidate page in both caches */
192static inline void clear040(unsigned long paddr) 131static inline void clear040(unsigned long paddr)
193{ 132{
@@ -354,15 +293,3 @@ void cache_push (unsigned long paddr, int len)
354} 293}
355EXPORT_SYMBOL(cache_push); 294EXPORT_SYMBOL(cache_push);
356 295
357#ifndef CONFIG_SINGLE_MEMORY_CHUNK
358int mm_end_of_chunk (unsigned long addr, int len)
359{
360 int i;
361
362 for (i = 0; i < m68k_num_memory; i++)
363 if (m68k_memory[i].addr + m68k_memory[i].size == addr + len)
364 return 1;
365 return 0;
366}
367EXPORT_SYMBOL(mm_end_of_chunk);
368#endif
diff --git a/arch/m68k/mm/motorola.c b/arch/m68k/mm/motorola.c
index 98ef00547b37..7d571a2b44dd 100644
--- a/arch/m68k/mm/motorola.c
+++ b/arch/m68k/mm/motorola.c
@@ -43,6 +43,11 @@ unsigned long mm_cachebits;
43EXPORT_SYMBOL(mm_cachebits); 43EXPORT_SYMBOL(mm_cachebits);
44#endif 44#endif
45 45
46/* size of memory already mapped in head.S */
47#define INIT_MAPPED_SIZE (4UL<<20)
48
49extern unsigned long availmem;
50
46static pte_t * __init kernel_page_table(void) 51static pte_t * __init kernel_page_table(void)
47{ 52{
48 pte_t *ptablep; 53 pte_t *ptablep;
@@ -98,19 +103,20 @@ static pmd_t * __init kernel_ptr_table(void)
98 return last_pgtable; 103 return last_pgtable;
99} 104}
100 105
101static unsigned long __init 106static void __init map_node(int node)
102map_chunk (unsigned long addr, long size)
103{ 107{
104#define PTRTREESIZE (256*1024) 108#define PTRTREESIZE (256*1024)
105#define ROOTTREESIZE (32*1024*1024) 109#define ROOTTREESIZE (32*1024*1024)
106 static unsigned long virtaddr = PAGE_OFFSET; 110 unsigned long physaddr, virtaddr, size;
107 unsigned long physaddr;
108 pgd_t *pgd_dir; 111 pgd_t *pgd_dir;
109 pmd_t *pmd_dir; 112 pmd_t *pmd_dir;
110 pte_t *pte_dir; 113 pte_t *pte_dir;
111 114
112 physaddr = (addr | m68k_supervisor_cachemode | 115 size = m68k_memory[node].size;
113 _PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_DIRTY); 116 physaddr = m68k_memory[node].addr;
117 virtaddr = (unsigned long)phys_to_virt(physaddr);
118 physaddr |= m68k_supervisor_cachemode |
119 _PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_DIRTY;
114 if (CPU_IS_040_OR_060) 120 if (CPU_IS_040_OR_060)
115 physaddr |= _PAGE_GLOBAL040; 121 physaddr |= _PAGE_GLOBAL040;
116 122
@@ -190,8 +196,6 @@ map_chunk (unsigned long addr, long size)
190#ifdef DEBUG 196#ifdef DEBUG
191 printk("\n"); 197 printk("\n");
192#endif 198#endif
193
194 return virtaddr;
195} 199}
196 200
197/* 201/*
@@ -200,15 +204,16 @@ map_chunk (unsigned long addr, long size)
200 */ 204 */
201void __init paging_init(void) 205void __init paging_init(void)
202{ 206{
203 int chunk;
204 unsigned long mem_avail = 0;
205 unsigned long zones_size[MAX_NR_ZONES] = { 0, }; 207 unsigned long zones_size[MAX_NR_ZONES] = { 0, };
208 unsigned long min_addr, max_addr;
209 unsigned long addr, size, end;
210 int i;
206 211
207#ifdef DEBUG 212#ifdef DEBUG
208 { 213 {
209 extern unsigned long availmem; 214 extern unsigned long availmem;
210 printk ("start of paging_init (%p, %lx, %lx, %lx)\n", 215 printk ("start of paging_init (%p, %lx)\n",
211 kernel_pg_dir, availmem, start_mem, end_mem); 216 kernel_pg_dir, availmem);
212 } 217 }
213#endif 218#endif
214 219
@@ -222,27 +227,62 @@ void __init paging_init(void)
222 pgprot_val(protection_map[i]) |= _PAGE_CACHE040; 227 pgprot_val(protection_map[i]) |= _PAGE_CACHE040;
223 } 228 }
224 229
230 min_addr = m68k_memory[0].addr;
231 max_addr = min_addr + m68k_memory[0].size;
232 for (i = 1; i < m68k_num_memory;) {
233 if (m68k_memory[i].addr < min_addr) {
234 printk("Ignoring memory chunk at 0x%lx:0x%lx before the first chunk\n",
235 m68k_memory[i].addr, m68k_memory[i].size);
236 printk("Fix your bootloader or use a memfile to make use of this area!\n");
237 m68k_num_memory--;
238 memmove(m68k_memory + i, m68k_memory + i + 1,
239 (m68k_num_memory - i) * sizeof(struct mem_info));
240 continue;
241 }
242 addr = m68k_memory[i].addr + m68k_memory[i].size;
243 if (addr > max_addr)
244 max_addr = addr;
245 i++;
246 }
247 m68k_memoffset = min_addr - PAGE_OFFSET;
248 m68k_virt_to_node_shift = fls(max_addr - min_addr - 1) - 6;
249
225 module_fixup(NULL, __start_fixup, __stop_fixup); 250 module_fixup(NULL, __start_fixup, __stop_fixup);
226 flush_icache(); 251 flush_icache();
227 252
253 high_memory = phys_to_virt(max_addr);
254
255 min_low_pfn = availmem >> PAGE_SHIFT;
256 max_low_pfn = max_addr >> PAGE_SHIFT;
257
258 for (i = 0; i < m68k_num_memory; i++) {
259 addr = m68k_memory[i].addr;
260 end = addr + m68k_memory[i].size;
261 m68k_setup_node(i);
262 availmem = PAGE_ALIGN(availmem);
263 availmem += init_bootmem_node(NODE_DATA(i),
264 availmem >> PAGE_SHIFT,
265 addr >> PAGE_SHIFT,
266 end >> PAGE_SHIFT);
267 }
268
228 /* 269 /*
229 * Map the physical memory available into the kernel virtual 270 * Map the physical memory available into the kernel virtual
230 * address space. It may allocate some memory for page 271 * address space. First initialize the bootmem allocator with
231 * tables and thus modify availmem. 272 * the memory we already mapped, so map_node() has something
273 * to allocate.
232 */ 274 */
275 addr = m68k_memory[0].addr;
276 size = m68k_memory[0].size;
277 free_bootmem_node(NODE_DATA(0), availmem, min(INIT_MAPPED_SIZE, size) - (availmem - addr));
278 map_node(0);
279 if (size > INIT_MAPPED_SIZE)
280 free_bootmem_node(NODE_DATA(0), addr + INIT_MAPPED_SIZE, size - INIT_MAPPED_SIZE);
233 281
234 for (chunk = 0; chunk < m68k_num_memory; chunk++) { 282 for (i = 1; i < m68k_num_memory; i++)
235 mem_avail = map_chunk (m68k_memory[chunk].addr, 283 map_node(i);
236 m68k_memory[chunk].size);
237
238 }
239 284
240 flush_tlb_all(); 285 flush_tlb_all();
241#ifdef DEBUG
242 printk ("memory available is %ldKB\n", mem_avail >> 10);
243 printk ("start_mem is %#lx\nvirtual_end is %#lx\n",
244 start_mem, end_mem);
245#endif
246 286
247 /* 287 /*
248 * initialize the bad page table and bad page to point 288 * initialize the bad page table and bad page to point
@@ -259,14 +299,11 @@ void __init paging_init(void)
259#ifdef DEBUG 299#ifdef DEBUG
260 printk ("before free_area_init\n"); 300 printk ("before free_area_init\n");
261#endif 301#endif
262 zones_size[ZONE_DMA] = (mach_max_dma_address < (unsigned long)high_memory ? 302 for (i = 0; i < m68k_num_memory; i++) {
263 (mach_max_dma_address+1) : (unsigned long)high_memory); 303 zones_size[ZONE_DMA] = m68k_memory[i].size >> PAGE_SHIFT;
264 zones_size[ZONE_NORMAL] = (unsigned long)high_memory - zones_size[0]; 304 free_area_init_node(i, pg_data_map + i, zones_size,
265 305 m68k_memory[i].addr >> PAGE_SHIFT, NULL);
266 zones_size[ZONE_DMA] = (zones_size[ZONE_DMA] - PAGE_OFFSET) >> PAGE_SHIFT; 306 }
267 zones_size[ZONE_NORMAL] >>= PAGE_SHIFT;
268
269 free_area_init(zones_size);
270} 307}
271 308
272extern char __init_begin, __init_end; 309extern char __init_begin, __init_end;
diff --git a/arch/m68k/sun3/config.c b/arch/m68k/sun3/config.c
index 4851b8437a87..c0fbd278fbb1 100644
--- a/arch/m68k/sun3/config.c
+++ b/arch/m68k/sun3/config.c
@@ -21,6 +21,7 @@
21#include <asm/contregs.h> 21#include <asm/contregs.h>
22#include <asm/movs.h> 22#include <asm/movs.h>
23#include <asm/pgtable.h> 23#include <asm/pgtable.h>
24#include <asm/pgalloc.h>
24#include <asm/sun3-head.h> 25#include <asm/sun3-head.h>
25#include <asm/sun3mmu.h> 26#include <asm/sun3mmu.h>
26#include <asm/rtc.h> 27#include <asm/rtc.h>
@@ -127,6 +128,7 @@ void __init sun3_bootmem_alloc(unsigned long memory_start, unsigned long memory_
127 high_memory = (void *)memory_end; 128 high_memory = (void *)memory_end;
128 availmem = memory_start; 129 availmem = memory_start;
129 130
131 m68k_setup_node(0);
130 availmem += init_bootmem_node(NODE_DATA(0), start_page, 0, num_pages); 132 availmem += init_bootmem_node(NODE_DATA(0), start_page, 0, num_pages);
131 availmem = (availmem + (PAGE_SIZE-1)) & PAGE_MASK; 133 availmem = (availmem + (PAGE_SIZE-1)) & PAGE_MASK;
132 134