diff options
Diffstat (limited to 'arch/arm/kernel/setup.c')
-rw-r--r-- | arch/arm/kernel/setup.c | 80 |
1 files changed, 32 insertions, 48 deletions
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index c6c57b640b6b..c91c77b54dea 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/interrupt.h> | 24 | #include <linux/interrupt.h> |
25 | #include <linux/smp.h> | 25 | #include <linux/smp.h> |
26 | #include <linux/fs.h> | 26 | #include <linux/fs.h> |
27 | #include <linux/proc_fs.h> | ||
27 | 28 | ||
28 | #include <asm/unified.h> | 29 | #include <asm/unified.h> |
29 | #include <asm/cpu.h> | 30 | #include <asm/cpu.h> |
@@ -102,6 +103,7 @@ struct cpu_cache_fns cpu_cache; | |||
102 | #endif | 103 | #endif |
103 | #ifdef CONFIG_OUTER_CACHE | 104 | #ifdef CONFIG_OUTER_CACHE |
104 | struct outer_cache_fns outer_cache; | 105 | struct outer_cache_fns outer_cache; |
106 | EXPORT_SYMBOL(outer_cache); | ||
105 | #endif | 107 | #endif |
106 | 108 | ||
107 | struct stack { | 109 | struct stack { |
@@ -117,7 +119,7 @@ EXPORT_SYMBOL(elf_platform); | |||
117 | 119 | ||
118 | static const char *cpu_name; | 120 | static const char *cpu_name; |
119 | static const char *machine_name; | 121 | static const char *machine_name; |
120 | static char __initdata command_line[COMMAND_LINE_SIZE]; | 122 | static char __initdata cmd_line[COMMAND_LINE_SIZE]; |
121 | 123 | ||
122 | static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE; | 124 | static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE; |
123 | static union { char c[4]; unsigned long l; } endian_test __initdata = { { 'l', '?', '?', 'b' } }; | 125 | static union { char c[4]; unsigned long l; } endian_test __initdata = { { 'l', '?', '?', 'b' } }; |
@@ -417,10 +419,11 @@ static int __init arm_add_memory(unsigned long start, unsigned long size) | |||
417 | * Pick out the memory size. We look for mem=size@start, | 419 | * Pick out the memory size. We look for mem=size@start, |
418 | * where start and size are "size[KkMm]" | 420 | * where start and size are "size[KkMm]" |
419 | */ | 421 | */ |
420 | static void __init early_mem(char **p) | 422 | static int __init early_mem(char *p) |
421 | { | 423 | { |
422 | static int usermem __initdata = 0; | 424 | static int usermem __initdata = 0; |
423 | unsigned long size, start; | 425 | unsigned long size, start; |
426 | char *endp; | ||
424 | 427 | ||
425 | /* | 428 | /* |
426 | * If the user specifies memory size, we | 429 | * If the user specifies memory size, we |
@@ -433,52 +436,15 @@ static void __init early_mem(char **p) | |||
433 | } | 436 | } |
434 | 437 | ||
435 | start = PHYS_OFFSET; | 438 | start = PHYS_OFFSET; |
436 | size = memparse(*p, p); | 439 | size = memparse(p, &endp); |
437 | if (**p == '@') | 440 | if (*endp == '@') |
438 | start = memparse(*p + 1, p); | 441 | start = memparse(endp + 1, NULL); |
439 | 442 | ||
440 | arm_add_memory(start, size); | 443 | arm_add_memory(start, size); |
441 | } | ||
442 | __early_param("mem=", early_mem); | ||
443 | 444 | ||
444 | /* | 445 | return 0; |
445 | * Initial parsing of the command line. | ||
446 | */ | ||
447 | static void __init parse_cmdline(char **cmdline_p, char *from) | ||
448 | { | ||
449 | char c = ' ', *to = command_line; | ||
450 | int len = 0; | ||
451 | |||
452 | for (;;) { | ||
453 | if (c == ' ') { | ||
454 | extern struct early_params __early_begin, __early_end; | ||
455 | struct early_params *p; | ||
456 | |||
457 | for (p = &__early_begin; p < &__early_end; p++) { | ||
458 | int arglen = strlen(p->arg); | ||
459 | |||
460 | if (memcmp(from, p->arg, arglen) == 0) { | ||
461 | if (to != command_line) | ||
462 | to -= 1; | ||
463 | from += arglen; | ||
464 | p->fn(&from); | ||
465 | |||
466 | while (*from != ' ' && *from != '\0') | ||
467 | from++; | ||
468 | break; | ||
469 | } | ||
470 | } | ||
471 | } | ||
472 | c = *from++; | ||
473 | if (!c) | ||
474 | break; | ||
475 | if (COMMAND_LINE_SIZE <= ++len) | ||
476 | break; | ||
477 | *to++ = c; | ||
478 | } | ||
479 | *to = '\0'; | ||
480 | *cmdline_p = command_line; | ||
481 | } | 446 | } |
447 | early_param("mem", early_mem); | ||
482 | 448 | ||
483 | static void __init | 449 | static void __init |
484 | setup_ramdisk(int doload, int prompt, int image_start, unsigned int rd_sz) | 450 | setup_ramdisk(int doload, int prompt, int image_start, unsigned int rd_sz) |
@@ -739,9 +705,15 @@ void __init setup_arch(char **cmdline_p) | |||
739 | init_mm.end_data = (unsigned long) _edata; | 705 | init_mm.end_data = (unsigned long) _edata; |
740 | init_mm.brk = (unsigned long) _end; | 706 | init_mm.brk = (unsigned long) _end; |
741 | 707 | ||
742 | memcpy(boot_command_line, from, COMMAND_LINE_SIZE); | 708 | /* parse_early_param needs a boot_command_line */ |
743 | boot_command_line[COMMAND_LINE_SIZE-1] = '\0'; | 709 | strlcpy(boot_command_line, from, COMMAND_LINE_SIZE); |
744 | parse_cmdline(cmdline_p, from); | 710 | |
711 | /* populate cmd_line too for later use, preserving boot_command_line */ | ||
712 | strlcpy(cmd_line, boot_command_line, COMMAND_LINE_SIZE); | ||
713 | *cmdline_p = cmd_line; | ||
714 | |||
715 | parse_early_param(); | ||
716 | |||
745 | paging_init(mdesc); | 717 | paging_init(mdesc); |
746 | request_standard_resources(&meminfo, mdesc); | 718 | request_standard_resources(&meminfo, mdesc); |
747 | 719 | ||
@@ -782,9 +754,21 @@ static int __init topology_init(void) | |||
782 | 754 | ||
783 | return 0; | 755 | return 0; |
784 | } | 756 | } |
785 | |||
786 | subsys_initcall(topology_init); | 757 | subsys_initcall(topology_init); |
787 | 758 | ||
759 | #ifdef CONFIG_HAVE_PROC_CPU | ||
760 | static int __init proc_cpu_init(void) | ||
761 | { | ||
762 | struct proc_dir_entry *res; | ||
763 | |||
764 | res = proc_mkdir("cpu", NULL); | ||
765 | if (!res) | ||
766 | return -ENOMEM; | ||
767 | return 0; | ||
768 | } | ||
769 | fs_initcall(proc_cpu_init); | ||
770 | #endif | ||
771 | |||
788 | static const char *hwcap_str[] = { | 772 | static const char *hwcap_str[] = { |
789 | "swp", | 773 | "swp", |
790 | "half", | 774 | "half", |