diff options
author | Jeremy Kerr <jeremy.kerr@canonical.com> | 2010-01-11 17:17:34 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-02-15 16:39:13 -0500 |
commit | 2b0d8c251b8876d530a6bf671eb5425838fa698a (patch) | |
tree | f8b85d4ee0f76be6a45738452e91fbbb94602b4c /arch/arm | |
parent | e119bfff1f102f8d1505910cd6c09df55c776b43 (diff) |
ARM: 5880/1: arm: use generic infrastructure for early params
The ARM setup code includes its own parser for early params, there's
also one in the generic init code.
This patch removes __early_init (and related code) from
arch/arm/kernel/setup.c, and changes users to the generic early_init
macro instead.
The generic macro takes a char * argument, rather than char **, so we
need to update the parser functions a little.
Signed-off-by: Jeremy Kerr <jeremy.kerr@canonical.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/include/asm/setup.h | 12 | ||||
-rw-r--r-- | arch/arm/kernel/setup.c | 62 | ||||
-rw-r--r-- | arch/arm/kernel/vmlinux.lds.S | 4 | ||||
-rw-r--r-- | arch/arm/mach-footbridge/common.c | 7 | ||||
-rw-r--r-- | arch/arm/mm/init.c | 12 | ||||
-rw-r--r-- | arch/arm/mm/mmu.c | 41 |
6 files changed, 48 insertions, 90 deletions
diff --git a/arch/arm/include/asm/setup.h b/arch/arm/include/asm/setup.h index 5ccce0a9b03c..f392fb4437af 100644 --- a/arch/arm/include/asm/setup.h +++ b/arch/arm/include/asm/setup.h | |||
@@ -223,18 +223,6 @@ extern struct meminfo meminfo; | |||
223 | #define bank_phys_end(bank) ((bank)->start + (bank)->size) | 223 | #define bank_phys_end(bank) ((bank)->start + (bank)->size) |
224 | #define bank_phys_size(bank) (bank)->size | 224 | #define bank_phys_size(bank) (bank)->size |
225 | 225 | ||
226 | /* | ||
227 | * Early command line parameters. | ||
228 | */ | ||
229 | struct early_params { | ||
230 | const char *arg; | ||
231 | void (*fn)(char **p); | ||
232 | }; | ||
233 | |||
234 | #define __early_param(name,fn) \ | ||
235 | static struct early_params __early_##fn __used \ | ||
236 | __attribute__((__section__(".early_param.init"))) = { name, fn } | ||
237 | |||
238 | #endif /* __KERNEL__ */ | 226 | #endif /* __KERNEL__ */ |
239 | 227 | ||
240 | #endif | 228 | #endif |
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 5357e48f2c39..b01a56a03ed8 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c | |||
@@ -418,10 +418,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, | 418 | * Pick out the memory size. We look for mem=size@start, |
419 | * where start and size are "size[KkMm]" | 419 | * where start and size are "size[KkMm]" |
420 | */ | 420 | */ |
421 | static void __init early_mem(char **p) | 421 | static int __init early_mem(char *p) |
422 | { | 422 | { |
423 | static int usermem __initdata = 0; | 423 | static int usermem __initdata = 0; |
424 | unsigned long size, start; | 424 | unsigned long size, start; |
425 | char *endp; | ||
425 | 426 | ||
426 | /* | 427 | /* |
427 | * If the user specifies memory size, we | 428 | * If the user specifies memory size, we |
@@ -434,52 +435,15 @@ static void __init early_mem(char **p) | |||
434 | } | 435 | } |
435 | 436 | ||
436 | start = PHYS_OFFSET; | 437 | start = PHYS_OFFSET; |
437 | size = memparse(*p, p); | 438 | size = memparse(p, &endp); |
438 | if (**p == '@') | 439 | if (*endp == '@') |
439 | start = memparse(*p + 1, p); | 440 | start = memparse(endp + 1, NULL); |
440 | 441 | ||
441 | arm_add_memory(start, size); | 442 | arm_add_memory(start, size); |
442 | } | ||
443 | __early_param("mem=", early_mem); | ||
444 | 443 | ||
445 | /* | 444 | return 0; |
446 | * Initial parsing of the command line. | ||
447 | */ | ||
448 | static 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 | } | 445 | } |
446 | early_param("mem", early_mem); | ||
483 | 447 | ||
484 | static void __init | 448 | static void __init |
485 | setup_ramdisk(int doload, int prompt, int image_start, unsigned int rd_sz) | 449 | setup_ramdisk(int doload, int prompt, int image_start, unsigned int rd_sz) |
@@ -740,9 +704,15 @@ void __init setup_arch(char **cmdline_p) | |||
740 | init_mm.end_data = (unsigned long) _edata; | 704 | init_mm.end_data = (unsigned long) _edata; |
741 | init_mm.brk = (unsigned long) _end; | 705 | init_mm.brk = (unsigned long) _end; |
742 | 706 | ||
743 | memcpy(boot_command_line, from, COMMAND_LINE_SIZE); | 707 | /* parse_early_param needs a boot_command_line */ |
744 | boot_command_line[COMMAND_LINE_SIZE-1] = '\0'; | 708 | strlcpy(boot_command_line, from, COMMAND_LINE_SIZE); |
745 | parse_cmdline(cmdline_p, from); | 709 | |
710 | /* populate command_line too for later use, preserving boot_command_line */ | ||
711 | strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE); | ||
712 | *cmdline_p = command_line; | ||
713 | |||
714 | parse_early_param(); | ||
715 | |||
746 | paging_init(mdesc); | 716 | paging_init(mdesc); |
747 | request_standard_resources(&meminfo, mdesc); | 717 | request_standard_resources(&meminfo, mdesc); |
748 | 718 | ||
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S index 4957e13ef55b..b16c07914b55 100644 --- a/arch/arm/kernel/vmlinux.lds.S +++ b/arch/arm/kernel/vmlinux.lds.S | |||
@@ -43,10 +43,6 @@ SECTIONS | |||
43 | 43 | ||
44 | INIT_SETUP(16) | 44 | INIT_SETUP(16) |
45 | 45 | ||
46 | __early_begin = .; | ||
47 | *(.early_param.init) | ||
48 | __early_end = .; | ||
49 | |||
50 | INIT_CALLS | 46 | INIT_CALLS |
51 | CON_INITCALL | 47 | CON_INITCALL |
52 | SECURITY_INITCALL | 48 | SECURITY_INITCALL |
diff --git a/arch/arm/mach-footbridge/common.c b/arch/arm/mach-footbridge/common.c index 41febc796b1c..e3bc3f6f6b10 100644 --- a/arch/arm/mach-footbridge/common.c +++ b/arch/arm/mach-footbridge/common.c | |||
@@ -32,12 +32,13 @@ unsigned int mem_fclk_21285 = 50000000; | |||
32 | 32 | ||
33 | EXPORT_SYMBOL(mem_fclk_21285); | 33 | EXPORT_SYMBOL(mem_fclk_21285); |
34 | 34 | ||
35 | static void __init early_fclk(char **arg) | 35 | static int __init early_fclk(char *arg) |
36 | { | 36 | { |
37 | mem_fclk_21285 = simple_strtoul(*arg, arg, 0); | 37 | mem_fclk_21285 = simple_strtoul(arg, NULL, 0); |
38 | return 0; | ||
38 | } | 39 | } |
39 | 40 | ||
40 | __early_param("mem_fclk_21285=", early_fclk); | 41 | early_param("mem_fclk_21285", early_fclk); |
41 | 42 | ||
42 | static int __init parse_tag_memclk(const struct tag *tag) | 43 | static int __init parse_tag_memclk(const struct tag *tag) |
43 | { | 44 | { |
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index a04ffbbbe253..a340569b991e 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c | |||
@@ -32,19 +32,21 @@ | |||
32 | static unsigned long phys_initrd_start __initdata = 0; | 32 | static unsigned long phys_initrd_start __initdata = 0; |
33 | static unsigned long phys_initrd_size __initdata = 0; | 33 | static unsigned long phys_initrd_size __initdata = 0; |
34 | 34 | ||
35 | static void __init early_initrd(char **p) | 35 | static int __init early_initrd(char *p) |
36 | { | 36 | { |
37 | unsigned long start, size; | 37 | unsigned long start, size; |
38 | char *endp; | ||
38 | 39 | ||
39 | start = memparse(*p, p); | 40 | start = memparse(p, &endp); |
40 | if (**p == ',') { | 41 | if (*endp == ',') { |
41 | size = memparse((*p) + 1, p); | 42 | size = memparse(endp + 1, NULL); |
42 | 43 | ||
43 | phys_initrd_start = start; | 44 | phys_initrd_start = start; |
44 | phys_initrd_size = size; | 45 | phys_initrd_size = size; |
45 | } | 46 | } |
47 | return 0; | ||
46 | } | 48 | } |
47 | __early_param("initrd=", early_initrd); | 49 | early_param("initrd", early_initrd); |
48 | 50 | ||
49 | static int __init parse_tag_initrd(const struct tag *tag) | 51 | static int __init parse_tag_initrd(const struct tag *tag) |
50 | { | 52 | { |
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 1708da82da96..88f5d71248d9 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c | |||
@@ -100,18 +100,17 @@ static struct cachepolicy cache_policies[] __initdata = { | |||
100 | * writebuffer to be turned off. (Note: the write | 100 | * writebuffer to be turned off. (Note: the write |
101 | * buffer should not be on and the cache off). | 101 | * buffer should not be on and the cache off). |
102 | */ | 102 | */ |
103 | static void __init early_cachepolicy(char **p) | 103 | static int __init early_cachepolicy(char *p) |
104 | { | 104 | { |
105 | int i; | 105 | int i; |
106 | 106 | ||
107 | for (i = 0; i < ARRAY_SIZE(cache_policies); i++) { | 107 | for (i = 0; i < ARRAY_SIZE(cache_policies); i++) { |
108 | int len = strlen(cache_policies[i].policy); | 108 | int len = strlen(cache_policies[i].policy); |
109 | 109 | ||
110 | if (memcmp(*p, cache_policies[i].policy, len) == 0) { | 110 | if (memcmp(p, cache_policies[i].policy, len) == 0) { |
111 | cachepolicy = i; | 111 | cachepolicy = i; |
112 | cr_alignment &= ~cache_policies[i].cr_mask; | 112 | cr_alignment &= ~cache_policies[i].cr_mask; |
113 | cr_no_alignment &= ~cache_policies[i].cr_mask; | 113 | cr_no_alignment &= ~cache_policies[i].cr_mask; |
114 | *p += len; | ||
115 | break; | 114 | break; |
116 | } | 115 | } |
117 | } | 116 | } |
@@ -130,36 +129,37 @@ static void __init early_cachepolicy(char **p) | |||
130 | } | 129 | } |
131 | flush_cache_all(); | 130 | flush_cache_all(); |
132 | set_cr(cr_alignment); | 131 | set_cr(cr_alignment); |
132 | return 0; | ||
133 | } | 133 | } |
134 | __early_param("cachepolicy=", early_cachepolicy); | 134 | early_param("cachepolicy", early_cachepolicy); |
135 | 135 | ||
136 | static void __init early_nocache(char **__unused) | 136 | static int __init early_nocache(char *__unused) |
137 | { | 137 | { |
138 | char *p = "buffered"; | 138 | char *p = "buffered"; |
139 | printk(KERN_WARNING "nocache is deprecated; use cachepolicy=%s\n", p); | 139 | printk(KERN_WARNING "nocache is deprecated; use cachepolicy=%s\n", p); |
140 | early_cachepolicy(&p); | 140 | early_cachepolicy(p); |
141 | return 0; | ||
141 | } | 142 | } |
142 | __early_param("nocache", early_nocache); | 143 | early_param("nocache", early_nocache); |
143 | 144 | ||
144 | static void __init early_nowrite(char **__unused) | 145 | static int __init early_nowrite(char *__unused) |
145 | { | 146 | { |
146 | char *p = "uncached"; | 147 | char *p = "uncached"; |
147 | printk(KERN_WARNING "nowb is deprecated; use cachepolicy=%s\n", p); | 148 | printk(KERN_WARNING "nowb is deprecated; use cachepolicy=%s\n", p); |
148 | early_cachepolicy(&p); | 149 | early_cachepolicy(p); |
150 | return 0; | ||
149 | } | 151 | } |
150 | __early_param("nowb", early_nowrite); | 152 | early_param("nowb", early_nowrite); |
151 | 153 | ||
152 | static void __init early_ecc(char **p) | 154 | static int __init early_ecc(char *p) |
153 | { | 155 | { |
154 | if (memcmp(*p, "on", 2) == 0) { | 156 | if (memcmp(p, "on", 2) == 0) |
155 | ecc_mask = PMD_PROTECTION; | 157 | ecc_mask = PMD_PROTECTION; |
156 | *p += 2; | 158 | else if (memcmp(p, "off", 3) == 0) |
157 | } else if (memcmp(*p, "off", 3) == 0) { | ||
158 | ecc_mask = 0; | 159 | ecc_mask = 0; |
159 | *p += 3; | 160 | return 0; |
160 | } | ||
161 | } | 161 | } |
162 | __early_param("ecc=", early_ecc); | 162 | early_param("ecc", early_ecc); |
163 | 163 | ||
164 | static int __init noalign_setup(char *__unused) | 164 | static int __init noalign_setup(char *__unused) |
165 | { | 165 | { |
@@ -670,9 +670,9 @@ static unsigned long __initdata vmalloc_reserve = SZ_128M; | |||
670 | * bytes. This can be used to increase (or decrease) the vmalloc | 670 | * bytes. This can be used to increase (or decrease) the vmalloc |
671 | * area - the default is 128m. | 671 | * area - the default is 128m. |
672 | */ | 672 | */ |
673 | static void __init early_vmalloc(char **arg) | 673 | static int __init early_vmalloc(char *arg) |
674 | { | 674 | { |
675 | vmalloc_reserve = memparse(*arg, arg); | 675 | vmalloc_reserve = memparse(arg, NULL); |
676 | 676 | ||
677 | if (vmalloc_reserve < SZ_16M) { | 677 | if (vmalloc_reserve < SZ_16M) { |
678 | vmalloc_reserve = SZ_16M; | 678 | vmalloc_reserve = SZ_16M; |
@@ -687,8 +687,9 @@ static void __init early_vmalloc(char **arg) | |||
687 | "vmalloc area is too big, limiting to %luMB\n", | 687 | "vmalloc area is too big, limiting to %luMB\n", |
688 | vmalloc_reserve >> 20); | 688 | vmalloc_reserve >> 20); |
689 | } | 689 | } |
690 | return 0; | ||
690 | } | 691 | } |
691 | __early_param("vmalloc=", early_vmalloc); | 692 | early_param("vmalloc", early_vmalloc); |
692 | 693 | ||
693 | #define VMALLOC_MIN (void *)(VMALLOC_END - vmalloc_reserve) | 694 | #define VMALLOC_MIN (void *)(VMALLOC_END - vmalloc_reserve) |
694 | 695 | ||