diff options
Diffstat (limited to 'arch/arm/kernel/setup.c')
-rw-r--r-- | arch/arm/kernel/setup.c | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 1f1eecca7f55..d21786712c88 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c | |||
@@ -59,7 +59,7 @@ static int __init fpe_setup(char *line) | |||
59 | __setup("fpe=", fpe_setup); | 59 | __setup("fpe=", fpe_setup); |
60 | #endif | 60 | #endif |
61 | 61 | ||
62 | extern void paging_init(struct meminfo *, struct machine_desc *desc); | 62 | extern void paging_init(struct machine_desc *desc); |
63 | extern void reboot_setup(char *str); | 63 | extern void reboot_setup(char *str); |
64 | extern void _text, _etext, __data_start, _edata, _end; | 64 | extern void _text, _etext, __data_start, _edata, _end; |
65 | 65 | ||
@@ -112,7 +112,6 @@ static struct stack stacks[NR_CPUS]; | |||
112 | char elf_platform[ELF_PLATFORM_SIZE]; | 112 | char elf_platform[ELF_PLATFORM_SIZE]; |
113 | EXPORT_SYMBOL(elf_platform); | 113 | EXPORT_SYMBOL(elf_platform); |
114 | 114 | ||
115 | static struct meminfo meminfo __initdata = { 0, }; | ||
116 | static const char *cpu_name; | 115 | static const char *cpu_name; |
117 | static const char *machine_name; | 116 | static const char *machine_name; |
118 | static char __initdata command_line[COMMAND_LINE_SIZE]; | 117 | static char __initdata command_line[COMMAND_LINE_SIZE]; |
@@ -367,21 +366,34 @@ static struct machine_desc * __init setup_machine(unsigned int nr) | |||
367 | return list; | 366 | return list; |
368 | } | 367 | } |
369 | 368 | ||
370 | static void __init arm_add_memory(unsigned long start, unsigned long size) | 369 | static int __init arm_add_memory(unsigned long start, unsigned long size) |
371 | { | 370 | { |
372 | struct membank *bank; | 371 | struct membank *bank = &meminfo.bank[meminfo.nr_banks]; |
372 | |||
373 | if (meminfo.nr_banks >= NR_BANKS) { | ||
374 | printk(KERN_CRIT "NR_BANKS too low, " | ||
375 | "ignoring memory at %#lx\n", start); | ||
376 | return -EINVAL; | ||
377 | } | ||
373 | 378 | ||
374 | /* | 379 | /* |
375 | * Ensure that start/size are aligned to a page boundary. | 380 | * Ensure that start/size are aligned to a page boundary. |
376 | * Size is appropriately rounded down, start is rounded up. | 381 | * Size is appropriately rounded down, start is rounded up. |
377 | */ | 382 | */ |
378 | size -= start & ~PAGE_MASK; | 383 | size -= start & ~PAGE_MASK; |
379 | |||
380 | bank = &meminfo.bank[meminfo.nr_banks++]; | ||
381 | |||
382 | bank->start = PAGE_ALIGN(start); | 384 | bank->start = PAGE_ALIGN(start); |
383 | bank->size = size & PAGE_MASK; | 385 | bank->size = size & PAGE_MASK; |
384 | bank->node = PHYS_TO_NID(start); | 386 | bank->node = PHYS_TO_NID(start); |
387 | |||
388 | /* | ||
389 | * Check whether this memory region has non-zero size or | ||
390 | * invalid node number. | ||
391 | */ | ||
392 | if (bank->size == 0 || bank->node >= MAX_NUMNODES) | ||
393 | return -EINVAL; | ||
394 | |||
395 | meminfo.nr_banks++; | ||
396 | return 0; | ||
385 | } | 397 | } |
386 | 398 | ||
387 | /* | 399 | /* |
@@ -539,14 +551,7 @@ __tagtable(ATAG_CORE, parse_tag_core); | |||
539 | 551 | ||
540 | static int __init parse_tag_mem32(const struct tag *tag) | 552 | static int __init parse_tag_mem32(const struct tag *tag) |
541 | { | 553 | { |
542 | if (meminfo.nr_banks >= NR_BANKS) { | 554 | return arm_add_memory(tag->u.mem.start, tag->u.mem.size); |
543 | printk(KERN_WARNING | ||
544 | "Ignoring memory bank 0x%08x size %dKB\n", | ||
545 | tag->u.mem.start, tag->u.mem.size / 1024); | ||
546 | return -EINVAL; | ||
547 | } | ||
548 | arm_add_memory(tag->u.mem.start, tag->u.mem.size); | ||
549 | return 0; | ||
550 | } | 555 | } |
551 | 556 | ||
552 | __tagtable(ATAG_MEM, parse_tag_mem32); | 557 | __tagtable(ATAG_MEM, parse_tag_mem32); |
@@ -718,7 +723,7 @@ void __init setup_arch(char **cmdline_p) | |||
718 | memcpy(boot_command_line, from, COMMAND_LINE_SIZE); | 723 | memcpy(boot_command_line, from, COMMAND_LINE_SIZE); |
719 | boot_command_line[COMMAND_LINE_SIZE-1] = '\0'; | 724 | boot_command_line[COMMAND_LINE_SIZE-1] = '\0'; |
720 | parse_cmdline(cmdline_p, from); | 725 | parse_cmdline(cmdline_p, from); |
721 | paging_init(&meminfo, mdesc); | 726 | paging_init(mdesc); |
722 | request_standard_resources(&meminfo, mdesc); | 727 | request_standard_resources(&meminfo, mdesc); |
723 | 728 | ||
724 | #ifdef CONFIG_SMP | 729 | #ifdef CONFIG_SMP |