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 c6c57b640b6b..baf5959d639a 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>
@@ -117,7 +118,7 @@ EXPORT_SYMBOL(elf_platform);
117 118
118static const char *cpu_name; 119static const char *cpu_name;
119static const char *machine_name; 120static const char *machine_name;
120static char __initdata command_line[COMMAND_LINE_SIZE]; 121static char __initdata cmd_line[COMMAND_LINE_SIZE];
121 122
122static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE; 123static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE;
123static union { char c[4]; unsigned long l; } endian_test __initdata = { { 'l', '?', '?', 'b' } }; 124static union { char c[4]; unsigned long l; } endian_test __initdata = { { 'l', '?', '?', 'b' } };
@@ -417,10 +418,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, 418 * Pick out the memory size. We look for mem=size@start,
418 * where start and size are "size[KkMm]" 419 * where start and size are "size[KkMm]"
419 */ 420 */
420static void __init early_mem(char **p) 421static int __init early_mem(char *p)
421{ 422{
422 static int usermem __initdata = 0; 423 static int usermem __initdata = 0;
423 unsigned long size, start; 424 unsigned long size, start;
425 char *endp;
424 426
425 /* 427 /*
426 * If the user specifies memory size, we 428 * If the user specifies memory size, we
@@ -433,52 +435,15 @@ static void __init early_mem(char **p)
433 } 435 }
434 436
435 start = PHYS_OFFSET; 437 start = PHYS_OFFSET;
436 size = memparse(*p, p); 438 size = memparse(p, &endp);
437 if (**p == '@') 439 if (*endp == '@')
438 start = memparse(*p + 1, p); 440 start = memparse(endp + 1, NULL);
439 441
440 arm_add_memory(start, size); 442 arm_add_memory(start, size);
441}
442__early_param("mem=", early_mem);
443 443
444/* 444 return 0;
445 * Initial parsing of the command line.
446 */
447static 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} 445}
446early_param("mem", early_mem);
482 447
483static void __init 448static void __init
484setup_ramdisk(int doload, int prompt, int image_start, unsigned int rd_sz) 449setup_ramdisk(int doload, int prompt, int image_start, unsigned int rd_sz)
@@ -739,9 +704,15 @@ void __init setup_arch(char **cmdline_p)
739 init_mm.end_data = (unsigned long) _edata; 704 init_mm.end_data = (unsigned long) _edata;
740 init_mm.brk = (unsigned long) _end; 705 init_mm.brk = (unsigned long) _end;
741 706
742 memcpy(boot_command_line, from, COMMAND_LINE_SIZE); 707 /* parse_early_param needs a boot_command_line */
743 boot_command_line[COMMAND_LINE_SIZE-1] = '\0'; 708 strlcpy(boot_command_line, from, COMMAND_LINE_SIZE);
744 parse_cmdline(cmdline_p, from); 709
710 /* populate cmd_line too for later use, preserving boot_command_line */
711 strlcpy(cmd_line, boot_command_line, COMMAND_LINE_SIZE);
712 *cmdline_p = cmd_line;
713
714 parse_early_param();
715
745 paging_init(mdesc); 716 paging_init(mdesc);
746 request_standard_resources(&meminfo, mdesc); 717 request_standard_resources(&meminfo, mdesc);
747 718
@@ -782,9 +753,21 @@ static int __init topology_init(void)
782 753
783 return 0; 754 return 0;
784} 755}
785
786subsys_initcall(topology_init); 756subsys_initcall(topology_init);
787 757
758#ifdef CONFIG_HAVE_PROC_CPU
759static int __init proc_cpu_init(void)
760{
761 struct proc_dir_entry *res;
762
763 res = proc_mkdir("cpu", NULL);
764 if (!res)
765 return -ENOMEM;
766 return 0;
767}
768fs_initcall(proc_cpu_init);
769#endif
770
788static const char *hwcap_str[] = { 771static const char *hwcap_str[] = {
789 "swp", 772 "swp",
790 "half", 773 "half",