aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/kernel/setup.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/kernel/setup.c')
-rw-r--r--arch/arm/kernel/setup.c57
1 files changed, 32 insertions, 25 deletions
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 1f1eecca7f55..7049815d66d5 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -29,6 +29,7 @@
29#include <asm/cputype.h> 29#include <asm/cputype.h>
30#include <asm/elf.h> 30#include <asm/elf.h>
31#include <asm/procinfo.h> 31#include <asm/procinfo.h>
32#include <asm/sections.h>
32#include <asm/setup.h> 33#include <asm/setup.h>
33#include <asm/mach-types.h> 34#include <asm/mach-types.h>
34#include <asm/cacheflush.h> 35#include <asm/cacheflush.h>
@@ -59,9 +60,8 @@ static int __init fpe_setup(char *line)
59__setup("fpe=", fpe_setup); 60__setup("fpe=", fpe_setup);
60#endif 61#endif
61 62
62extern void paging_init(struct meminfo *, struct machine_desc *desc); 63extern void paging_init(struct machine_desc *desc);
63extern void reboot_setup(char *str); 64extern void reboot_setup(char *str);
64extern void _text, _etext, __data_start, _edata, _end;
65 65
66unsigned int processor_id; 66unsigned int processor_id;
67EXPORT_SYMBOL(processor_id); 67EXPORT_SYMBOL(processor_id);
@@ -112,7 +112,6 @@ static struct stack stacks[NR_CPUS];
112char elf_platform[ELF_PLATFORM_SIZE]; 112char elf_platform[ELF_PLATFORM_SIZE];
113EXPORT_SYMBOL(elf_platform); 113EXPORT_SYMBOL(elf_platform);
114 114
115static struct meminfo meminfo __initdata = { 0, };
116static const char *cpu_name; 115static const char *cpu_name;
117static const char *machine_name; 116static const char *machine_name;
118static char __initdata command_line[COMMAND_LINE_SIZE]; 117static 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
370static void __init arm_add_memory(unsigned long start, unsigned long size) 369static 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/*
@@ -472,10 +484,10 @@ request_standard_resources(struct meminfo *mi, struct machine_desc *mdesc)
472 struct resource *res; 484 struct resource *res;
473 int i; 485 int i;
474 486
475 kernel_code.start = virt_to_phys(&_text); 487 kernel_code.start = virt_to_phys(_text);
476 kernel_code.end = virt_to_phys(&_etext - 1); 488 kernel_code.end = virt_to_phys(_etext - 1);
477 kernel_data.start = virt_to_phys(&__data_start); 489 kernel_data.start = virt_to_phys(_data);
478 kernel_data.end = virt_to_phys(&_end - 1); 490 kernel_data.end = virt_to_phys(_end - 1);
479 491
480 for (i = 0; i < mi->nr_banks; i++) { 492 for (i = 0; i < mi->nr_banks; i++) {
481 if (mi->bank[i].size == 0) 493 if (mi->bank[i].size == 0)
@@ -539,14 +551,7 @@ __tagtable(ATAG_CORE, parse_tag_core);
539 551
540static int __init parse_tag_mem32(const struct tag *tag) 552static 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);
@@ -710,15 +715,15 @@ void __init setup_arch(char **cmdline_p)
710 parse_tags(tags); 715 parse_tags(tags);
711 } 716 }
712 717
713 init_mm.start_code = (unsigned long) &_text; 718 init_mm.start_code = (unsigned long) _text;
714 init_mm.end_code = (unsigned long) &_etext; 719 init_mm.end_code = (unsigned long) _etext;
715 init_mm.end_data = (unsigned long) &_edata; 720 init_mm.end_data = (unsigned long) _edata;
716 init_mm.brk = (unsigned long) &_end; 721 init_mm.brk = (unsigned long) _end;
717 722
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
@@ -772,6 +777,8 @@ static const char *hwcap_str[] = {
772 "java", 777 "java",
773 "iwmmxt", 778 "iwmmxt",
774 "crunch", 779 "crunch",
780 "thumbee",
781 "neon",
775 NULL 782 NULL
776}; 783};
777 784