diff options
Diffstat (limited to 'arch/m68k')
-rw-r--r-- | arch/m68k/Kconfig | 13 | ||||
-rw-r--r-- | arch/m68k/Makefile | 1 | ||||
-rw-r--r-- | arch/m68k/kernel/Makefile | 3 | ||||
-rw-r--r-- | arch/m68k/kernel/module.c | 31 | ||||
-rw-r--r-- | arch/m68k/kernel/module.lds | 7 | ||||
-rw-r--r-- | arch/m68k/kernel/setup.c | 37 | ||||
-rw-r--r-- | arch/m68k/kernel/vmlinux-std.lds | 5 | ||||
-rw-r--r-- | arch/m68k/kernel/vmlinux-sun3.lds | 5 | ||||
-rw-r--r-- | arch/m68k/mac/debug.c | 2 | ||||
-rw-r--r-- | arch/m68k/mm/init.c | 119 | ||||
-rw-r--r-- | arch/m68k/mm/memory.c | 73 | ||||
-rw-r--r-- | arch/m68k/mm/motorola.c | 104 | ||||
-rw-r--r-- | arch/m68k/sun3/config.c | 2 |
13 files changed, 221 insertions, 181 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 | ||
357 | config SINGLE_MEMORY_CHUNK | 357 | config 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 | ||
381 | config ARCH_DISCONTIGMEM_ENABLE | ||
382 | def_bool !SINGLE_MEMORY_CHUNK | ||
383 | |||
384 | config NODES_SHIFT | ||
385 | int | ||
386 | default "3" | ||
387 | depends on !SINGLE_MEMORY_CHUNK | ||
388 | |||
380 | source "mm/Kconfig" | 389 | source "mm/Kconfig" |
381 | 390 | ||
382 | endmenu | 391 | endmenu |
diff --git a/arch/m68k/Makefile b/arch/m68k/Makefile index c20831a7e1a9..aa383a5ea7ac 100644 --- a/arch/m68k/Makefile +++ b/arch/m68k/Makefile | |||
@@ -19,6 +19,7 @@ COMPILE_ARCH = $(shell uname -m) | |||
19 | # override top level makefile | 19 | # override top level makefile |
20 | AS += -m68020 | 20 | AS += -m68020 |
21 | LDFLAGS := -m m68kelf | 21 | LDFLAGS := -m m68kelf |
22 | LDFLAGS_MODULE += -T $(srctree)/arch/m68k/kernel/module.lds | ||
22 | ifneq ($(COMPILE_ARCH),$(ARCH)) | 23 | ifneq ($(COMPILE_ARCH),$(ARCH)) |
23 | # prefix for cross-compiling binaries | 24 | # prefix for cross-compiling binaries |
24 | CROSS_COMPILE = m68k-linux-gnu- | 25 | CROSS_COMPILE = m68k-linux-gnu- |
diff --git a/arch/m68k/kernel/Makefile b/arch/m68k/kernel/Makefile index 0b68ab8d63d1..a806208c7fb5 100644 --- a/arch/m68k/kernel/Makefile +++ b/arch/m68k/kernel/Makefile | |||
@@ -9,13 +9,12 @@ else | |||
9 | endif | 9 | endif |
10 | extra-y += vmlinux.lds | 10 | extra-y += vmlinux.lds |
11 | 11 | ||
12 | obj-y := entry.o process.o traps.o ints.o signal.o ptrace.o \ | 12 | obj-y := entry.o process.o traps.o ints.o signal.o ptrace.o module.o \ |
13 | sys_m68k.o time.o semaphore.o setup.o m68k_ksyms.o devres.o | 13 | sys_m68k.o time.o semaphore.o setup.o m68k_ksyms.o devres.o |
14 | 14 | ||
15 | devres-y = ../../../kernel/irq/devres.o | 15 | devres-y = ../../../kernel/irq/devres.o |
16 | 16 | ||
17 | obj-$(CONFIG_PCI) += bios32.o | 17 | obj-$(CONFIG_PCI) += bios32.o |
18 | obj-$(CONFIG_MODULES) += module.o | ||
19 | obj-y$(CONFIG_MMU_SUN3) += dma.o # no, it's not a typo | 18 | obj-y$(CONFIG_MMU_SUN3) += dma.o # no, it's not a typo |
20 | 19 | ||
21 | EXTRA_AFLAGS := -traditional | 20 | EXTRA_AFLAGS := -traditional |
diff --git a/arch/m68k/kernel/module.c b/arch/m68k/kernel/module.c index 3b1a2ff61ddc..774862bc6977 100644 --- a/arch/m68k/kernel/module.c +++ b/arch/m68k/kernel/module.c | |||
@@ -1,3 +1,9 @@ | |||
1 | /* | ||
2 | * This file is subject to the terms and conditions of the GNU General Public | ||
3 | * License. See the file COPYING in the main directory of this archive | ||
4 | * for more details. | ||
5 | */ | ||
6 | |||
1 | #include <linux/moduleloader.h> | 7 | #include <linux/moduleloader.h> |
2 | #include <linux/elf.h> | 8 | #include <linux/elf.h> |
3 | #include <linux/vmalloc.h> | 9 | #include <linux/vmalloc.h> |
@@ -11,6 +17,8 @@ | |||
11 | #define DEBUGP(fmt...) | 17 | #define DEBUGP(fmt...) |
12 | #endif | 18 | #endif |
13 | 19 | ||
20 | #ifdef CONFIG_MODULES | ||
21 | |||
14 | void *module_alloc(unsigned long size) | 22 | void *module_alloc(unsigned long size) |
15 | { | 23 | { |
16 | if (size == 0) | 24 | if (size == 0) |
@@ -118,11 +126,32 @@ int apply_relocate_add(Elf32_Shdr *sechdrs, | |||
118 | 126 | ||
119 | int module_finalize(const Elf_Ehdr *hdr, | 127 | int module_finalize(const Elf_Ehdr *hdr, |
120 | const Elf_Shdr *sechdrs, | 128 | const Elf_Shdr *sechdrs, |
121 | struct module *me) | 129 | struct module *mod) |
122 | { | 130 | { |
131 | module_fixup(mod, mod->arch.fixup_start, mod->arch.fixup_end); | ||
132 | |||
123 | return 0; | 133 | return 0; |
124 | } | 134 | } |
125 | 135 | ||
126 | void module_arch_cleanup(struct module *mod) | 136 | void module_arch_cleanup(struct module *mod) |
127 | { | 137 | { |
128 | } | 138 | } |
139 | |||
140 | #endif /* CONFIG_MODULES */ | ||
141 | |||
142 | void module_fixup(struct module *mod, struct m68k_fixup_info *start, | ||
143 | struct m68k_fixup_info *end) | ||
144 | { | ||
145 | struct m68k_fixup_info *fixup; | ||
146 | |||
147 | for (fixup = start; fixup < end; fixup++) { | ||
148 | switch (fixup->type) { | ||
149 | case m68k_fixup_memoffset: | ||
150 | *(u32 *)fixup->addr = m68k_memoffset; | ||
151 | break; | ||
152 | case m68k_fixup_vnode_shift: | ||
153 | *(u16 *)fixup->addr += m68k_virt_to_node_shift; | ||
154 | break; | ||
155 | } | ||
156 | } | ||
157 | } | ||
diff --git a/arch/m68k/kernel/module.lds b/arch/m68k/kernel/module.lds new file mode 100644 index 000000000000..fda94fa38243 --- /dev/null +++ b/arch/m68k/kernel/module.lds | |||
@@ -0,0 +1,7 @@ | |||
1 | SECTIONS { | ||
2 | .m68k_fixup : { | ||
3 | __start_fixup = .; | ||
4 | *(.m68k_fixup) | ||
5 | __stop_fixup = .; | ||
6 | } | ||
7 | } | ||
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; | |||
60 | int m68k_num_memory; | 60 | int m68k_num_memory; |
61 | int m68k_realnum_memory; | 61 | int m68k_realnum_memory; |
62 | EXPORT_SYMBOL(m68k_realnum_memory); | 62 | EXPORT_SYMBOL(m68k_realnum_memory); |
63 | #ifdef CONFIG_SINGLE_MEMORY_CHUNK | ||
64 | unsigned long m68k_memoffset; | 63 | unsigned long m68k_memoffset; |
65 | EXPORT_SYMBOL(m68k_memoffset); | 64 | EXPORT_SYMBOL(m68k_memoffset); |
66 | #endif | ||
67 | struct mem_info m68k_memory[NUM_MEMINFO]; | 65 | struct mem_info m68k_memory[NUM_MEMINFO]; |
68 | EXPORT_SYMBOL(m68k_memory); | 66 | EXPORT_SYMBOL(m68k_memory); |
69 | 67 | ||
70 | static struct mem_info m68k_ramdisk; | 68 | struct mem_info m68k_ramdisk; |
71 | 69 | ||
72 | static char m68k_command_line[CL_SIZE]; | 70 | static char m68k_command_line[CL_SIZE]; |
73 | 71 | ||
@@ -208,9 +206,6 @@ static void __init m68k_parse_bootinfo(const struct bi_record *record) | |||
208 | void __init setup_arch(char **cmdline_p) | 206 | void __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/kernel/vmlinux-std.lds b/arch/m68k/kernel/vmlinux-std.lds index 78f139226a1b..40f02b128f22 100644 --- a/arch/m68k/kernel/vmlinux-std.lds +++ b/arch/m68k/kernel/vmlinux-std.lds | |||
@@ -60,6 +60,11 @@ SECTIONS | |||
60 | __con_initcall_start = .; | 60 | __con_initcall_start = .; |
61 | .con_initcall.init : { *(.con_initcall.init) } | 61 | .con_initcall.init : { *(.con_initcall.init) } |
62 | __con_initcall_end = .; | 62 | __con_initcall_end = .; |
63 | .m68k_fixup : { | ||
64 | __start_fixup = .; | ||
65 | *(.m68k_fixup) | ||
66 | __stop_fixup = .; | ||
67 | } | ||
63 | SECURITY_INIT | 68 | SECURITY_INIT |
64 | #ifdef CONFIG_BLK_DEV_INITRD | 69 | #ifdef CONFIG_BLK_DEV_INITRD |
65 | . = ALIGN(8192); | 70 | . = ALIGN(8192); |
diff --git a/arch/m68k/kernel/vmlinux-sun3.lds b/arch/m68k/kernel/vmlinux-sun3.lds index c8999b2db23b..f06425b6d206 100644 --- a/arch/m68k/kernel/vmlinux-sun3.lds +++ b/arch/m68k/kernel/vmlinux-sun3.lds | |||
@@ -54,6 +54,11 @@ __init_begin = .; | |||
54 | __con_initcall_start = .; | 54 | __con_initcall_start = .; |
55 | .con_initcall.init : { *(.con_initcall.init) } | 55 | .con_initcall.init : { *(.con_initcall.init) } |
56 | __con_initcall_end = .; | 56 | __con_initcall_end = .; |
57 | .m68k_fixup : { | ||
58 | __start_fixup = .; | ||
59 | *(.m68k_fixup) | ||
60 | __stop_fixup = .; | ||
61 | } | ||
57 | SECURITY_INIT | 62 | SECURITY_INIT |
58 | #ifdef CONFIG_BLK_DEV_INITRD | 63 | #ifdef CONFIG_BLK_DEV_INITRD |
59 | . = ALIGN(8192); | 64 | . = ALIGN(8192); |
diff --git a/arch/m68k/mac/debug.c b/arch/m68k/mac/debug.c index 7a5bed5bdc57..e8a57138b4a6 100644 --- a/arch/m68k/mac/debug.c +++ b/arch/m68k/mac/debug.c | |||
@@ -71,7 +71,7 @@ void mac_debugging_short(int pos, short num) | |||
71 | 71 | ||
72 | /* calculate current offset */ | 72 | /* calculate current offset */ |
73 | pengoffset = (unsigned char *)mac_videobase + | 73 | pengoffset = (unsigned char *)mac_videobase + |
74 | (150+line*2) * mac_rowbytes) + 80 * peng; | 74 | (150+line*2) * mac_rowbytes + 80 * peng; |
75 | 75 | ||
76 | pptr = pengoffset; | 76 | pptr = pengoffset; |
77 | 77 | ||
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 | ||
32 | DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); | 33 | DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); |
33 | 34 | ||
35 | static bootmem_data_t __initdata bootmem_data[MAX_NUMNODES]; | ||
36 | |||
37 | pg_data_t pg_data_map[MAX_NUMNODES]; | ||
38 | EXPORT_SYMBOL(pg_data_map); | ||
39 | |||
40 | int m68k_virt_to_node_shift; | ||
41 | |||
42 | #ifndef CONFIG_SINGLE_MEMORY_CHUNK | ||
43 | pg_data_t *pg_data_table[65]; | ||
44 | EXPORT_SYMBOL(pg_data_table); | ||
45 | #endif | ||
46 | |||
47 | void 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 | ||
41 | void show_mem(void) | 73 | void 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 | ||
69 | extern void init_pointer_table(unsigned long ptable); | 104 | extern void init_pointer_table(unsigned long ptable); |
70 | 105 | ||
71 | /* References to section boundaries */ | 106 | /* References to section boundaries */ |
72 | 107 | ||
73 | extern char _text, _etext, _edata, __bss_start, _end; | 108 | extern char _text[], _etext[]; |
74 | extern char __init_begin, __init_end; | 109 | extern char __init_begin[], __init_end[]; |
75 | 110 | ||
76 | extern pmd_t *zero_pgtable; | 111 | extern pmd_t *zero_pgtable; |
77 | 112 | ||
78 | void __init mem_init(void) | 113 | void __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 | ||
131 | int 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 | */ | ||
139 | unsigned 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 | } | ||
161 | EXPORT_SYMBOL(mm_vtop); | ||
162 | |||
163 | unsigned 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 | } | ||
188 | EXPORT_SYMBOL(mm_ptov); | ||
189 | #endif | ||
190 | |||
191 | /* invalidate page in both caches */ | 130 | /* invalidate page in both caches */ |
192 | static inline void clear040(unsigned long paddr) | 131 | static inline void clear040(unsigned long paddr) |
193 | { | 132 | { |
@@ -354,15 +293,3 @@ void cache_push (unsigned long paddr, int len) | |||
354 | } | 293 | } |
355 | EXPORT_SYMBOL(cache_push); | 294 | EXPORT_SYMBOL(cache_push); |
356 | 295 | ||
357 | #ifndef CONFIG_SINGLE_MEMORY_CHUNK | ||
358 | int 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 | } | ||
367 | EXPORT_SYMBOL(mm_end_of_chunk); | ||
368 | #endif | ||
diff --git a/arch/m68k/mm/motorola.c b/arch/m68k/mm/motorola.c index afcccdc6ad45..7d571a2b44dd 100644 --- a/arch/m68k/mm/motorola.c +++ b/arch/m68k/mm/motorola.c | |||
@@ -43,6 +43,11 @@ unsigned long mm_cachebits; | |||
43 | EXPORT_SYMBOL(mm_cachebits); | 43 | EXPORT_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 | |||
49 | extern unsigned long availmem; | ||
50 | |||
46 | static pte_t * __init kernel_page_table(void) | 51 | static 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 | ||
101 | static unsigned long __init | 106 | static void __init map_node(int node) |
102 | map_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 | */ |
201 | void __init paging_init(void) | 205 | void __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,24 +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 | |||
250 | module_fixup(NULL, __start_fixup, __stop_fixup); | ||
251 | flush_icache(); | ||
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 | |||
225 | /* | 269 | /* |
226 | * Map the physical memory available into the kernel virtual | 270 | * Map the physical memory available into the kernel virtual |
227 | * address space. It may allocate some memory for page | 271 | * address space. First initialize the bootmem allocator with |
228 | * tables and thus modify availmem. | 272 | * the memory we already mapped, so map_node() has something |
273 | * to allocate. | ||
229 | */ | 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); | ||
230 | 281 | ||
231 | for (chunk = 0; chunk < m68k_num_memory; chunk++) { | 282 | for (i = 1; i < m68k_num_memory; i++) |
232 | mem_avail = map_chunk (m68k_memory[chunk].addr, | 283 | map_node(i); |
233 | m68k_memory[chunk].size); | ||
234 | |||
235 | } | ||
236 | 284 | ||
237 | flush_tlb_all(); | 285 | flush_tlb_all(); |
238 | #ifdef DEBUG | ||
239 | printk ("memory available is %ldKB\n", mem_avail >> 10); | ||
240 | printk ("start_mem is %#lx\nvirtual_end is %#lx\n", | ||
241 | start_mem, end_mem); | ||
242 | #endif | ||
243 | 286 | ||
244 | /* | 287 | /* |
245 | * initialize the bad page table and bad page to point | 288 | * initialize the bad page table and bad page to point |
@@ -256,14 +299,11 @@ void __init paging_init(void) | |||
256 | #ifdef DEBUG | 299 | #ifdef DEBUG |
257 | printk ("before free_area_init\n"); | 300 | printk ("before free_area_init\n"); |
258 | #endif | 301 | #endif |
259 | zones_size[ZONE_DMA] = (mach_max_dma_address < (unsigned long)high_memory ? | 302 | for (i = 0; i < m68k_num_memory; i++) { |
260 | (mach_max_dma_address+1) : (unsigned long)high_memory); | 303 | zones_size[ZONE_DMA] = m68k_memory[i].size >> PAGE_SHIFT; |
261 | zones_size[ZONE_NORMAL] = (unsigned long)high_memory - zones_size[0]; | 304 | free_area_init_node(i, pg_data_map + i, zones_size, |
262 | 305 | m68k_memory[i].addr >> PAGE_SHIFT, NULL); | |
263 | zones_size[ZONE_DMA] = (zones_size[ZONE_DMA] - PAGE_OFFSET) >> PAGE_SHIFT; | 306 | } |
264 | zones_size[ZONE_NORMAL] >>= PAGE_SHIFT; | ||
265 | |||
266 | free_area_init(zones_size); | ||
267 | } | 307 | } |
268 | 308 | ||
269 | extern char __init_begin, __init_end; | 309 | extern 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 | ||