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.c79
1 files changed, 31 insertions, 48 deletions
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 621acad8ea43..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>
@@ -118,7 +119,7 @@ EXPORT_SYMBOL(elf_platform);
118 119
119static const char *cpu_name; 120static const char *cpu_name;
120static const char *machine_name; 121static const char *machine_name;
121static char __initdata command_line[COMMAND_LINE_SIZE]; 122static char __initdata cmd_line[COMMAND_LINE_SIZE];
122 123
123static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE; 124static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE;
124static union { char c[4]; unsigned long l; } endian_test __initdata = { { 'l', '?', '?', 'b' } }; 125static union { char c[4]; unsigned long l; } endian_test __initdata = { { 'l', '?', '?', 'b' } };
@@ -418,10 +419,11 @@ static int __init arm_add_memory(unsigned long start, unsigned long size)
418 * Pick out the memory size. We look for mem=size@start, 419 * Pick out the memory size. We look for mem=size@start,
419 * where start and size are "size[KkMm]" 420 * where start and size are "size[KkMm]"
420 */ 421 */
421static void __init early_mem(char **p) 422static int __init early_mem(char *p)
422{ 423{
423 static int usermem __initdata = 0; 424 static int usermem __initdata = 0;
424 unsigned long size, start; 425 unsigned long size, start;
426 char *endp;
425 427
426 /* 428 /*
427 * If the user specifies memory size, we 429 * If the user specifies memory size, we
@@ -434,52 +436,15 @@ static void __init early_mem(char **p)
434 } 436 }
435 437
436 start = PHYS_OFFSET; 438 start = PHYS_OFFSET;
437 size = memparse(*p, p); 439 size = memparse(p, &endp);
438 if (**p == '@') 440 if (*endp == '@')
439 start = memparse(*p + 1, p); 441 start = memparse(endp + 1, NULL);
440 442
441 arm_add_memory(start, size); 443 arm_add_memory(start, size);
442}
443__early_param("mem=", early_mem);
444 444
445/* 445 return 0;
446 * Initial parsing of the command line.
447 */
448static void __init parse_cmdline(char **cmdline_p, char *from)
449{
450 char c = ' ', *to = command_line;
451 int len = 0;
452
453 for (;;) {
454 if (c == ' ') {
455 extern struct early_params __early_begin, __early_end;
456 struct early_params *p;
457
458 for (p = &__early_begin; p < &__early_end; p++) {
459 int arglen = strlen(p->arg);
460
461 if (memcmp(from, p->arg, arglen) == 0) {
462 if (to != command_line)
463 to -= 1;
464 from += arglen;
465 p->fn(&from);
466
467 while (*from != ' ' && *from != '\0')
468 from++;
469 break;
470 }
471 }
472 }
473 c = *from++;
474 if (!c)
475 break;
476 if (COMMAND_LINE_SIZE <= ++len)
477 break;
478 *to++ = c;
479 }
480 *to = '\0';
481 *cmdline_p = command_line;
482} 446}
447early_param("mem", early_mem);
483 448
484static void __init 449static void __init
485setup_ramdisk(int doload, int prompt, int image_start, unsigned int rd_sz) 450setup_ramdisk(int doload, int prompt, int image_start, unsigned int rd_sz)
@@ -740,9 +705,15 @@ void __init setup_arch(char **cmdline_p)
740 init_mm.end_data = (unsigned long) _edata; 705 init_mm.end_data = (unsigned long) _edata;
741 init_mm.brk = (unsigned long) _end; 706 init_mm.brk = (unsigned long) _end;
742 707
743 memcpy(boot_command_line, from, COMMAND_LINE_SIZE); 708 /* parse_early_param needs a boot_command_line */
744 boot_command_line[COMMAND_LINE_SIZE-1] = '\0'; 709 strlcpy(boot_command_line, from, COMMAND_LINE_SIZE);
745 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
746 paging_init(mdesc); 717 paging_init(mdesc);
747 request_standard_resources(&meminfo, mdesc); 718 request_standard_resources(&meminfo, mdesc);
748 719
@@ -783,9 +754,21 @@ static int __init topology_init(void)
783 754
784 return 0; 755 return 0;
785} 756}
786
787subsys_initcall(topology_init); 757subsys_initcall(topology_init);
788 758
759#ifdef CONFIG_HAVE_PROC_CPU
760static 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}
769fs_initcall(proc_cpu_init);
770#endif
771
789static const char *hwcap_str[] = { 772static const char *hwcap_str[] = {
790 "swp", 773 "swp",
791 "half", 774 "half",