From: Tom Rini - Remove saved_command_line (and saving of the command line). - Call parse_early_options - Convert initrd=, mem=, *cache* options. --- 25-akpm/arch/arm/kernel/setup.c | 70 +++++++++------------------------------- 25-akpm/arch/arm/mm/mm-armv.c | 31 ++++++++++------- 25-akpm/include/asm-arm/setup.h | 12 ------ 3 files changed, 34 insertions(+), 79 deletions(-) diff -puN arch/arm/kernel/setup.c~early-param-arm arch/arm/kernel/setup.c --- 25/arch/arm/kernel/setup.c~early-param-arm 2004-03-30 19:49:06.370970048 -0800 +++ 25-akpm/arch/arm/kernel/setup.c 2004-03-30 19:49:06.376969136 -0800 @@ -81,7 +81,6 @@ struct cpu_cache_fns cpu_cache; unsigned char aux_device_present; char elf_platform[ELF_PLATFORM_SIZE]; -char saved_command_line[COMMAND_LINE_SIZE]; unsigned long phys_initrd_start __initdata = 0; unsigned long phys_initrd_size __initdata = 0; @@ -330,17 +329,19 @@ static struct machine_desc * __init setu return list; } -static void __init early_initrd(char **p) +static int __init early_initrd(char *p) { unsigned long start, size; - start = memparse(*p, p); - if (**p == ',') { - size = memparse((*p) + 1, p); + start = memparse(p, &p); + if (*p == ',') { + size = memparse(p++, &p); phys_initrd_start = start; phys_initrd_size = size; } + + return 0; } __early_param("initrd=", early_initrd); @@ -348,15 +349,14 @@ __early_param("initrd=", early_initrd); * Pick out the memory size. We look for mem=size@start, * where start and size are "size[KkMm]" */ -static void __init early_mem(char **p) +static int __init early_mem(char *p) { static int usermem __initdata = 0; unsigned long size, start; /* - * If the user specifies memory size, we - * blow away any automatically generated - * size. + * The user has specified the memory size for the first time, + * so we blow away any automatically generated size. */ if (usermem == 0) { usermem = 1; @@ -364,55 +364,18 @@ static void __init early_mem(char **p) } start = PHYS_OFFSET; - size = memparse(*p, p); - if (**p == '@') - start = memparse(*p + 1, p); + size = memparse(p, &p); + if (*p == '@') + start = memparse(p + 1, &p); meminfo.bank[meminfo.nr_banks].start = start; meminfo.bank[meminfo.nr_banks].size = size; meminfo.bank[meminfo.nr_banks].node = PHYS_TO_NID(start); meminfo.nr_banks += 1; -} -__early_param("mem=", early_mem); - -/* - * Initial parsing of the command line. - */ -static void __init parse_cmdline(char **cmdline_p, char *from) -{ - char c = ' ', *to = command_line; - int len = 0; - for (;;) { - if (c == ' ') { - extern struct early_params __early_begin, __early_end; - struct early_params *p; - - for (p = &__early_begin; p < &__early_end; p++) { - int len = strlen(p->arg); - - if (memcmp(from, p->arg, len) == 0) { - if (to != command_line) - to -= 1; - from += len; - p->fn(&from); - - while (*from != ' ' && *from != '\0') - from++; - break; - } - } - } - c = *from++; - if (!c) - break; - if (COMMAND_LINE_SIZE <= ++len) - break; - *to++ = c; - } - *to = '\0'; - *cmdline_p = command_line; + return 0; } +__early_param("mem=", early_mem); static void __init setup_ramdisk(int doload, int prompt, int image_start, unsigned int rd_sz) @@ -704,9 +667,8 @@ void __init setup_arch(char **cmdline_p) init_mm.end_data = (unsigned long) &_edata; init_mm.brk = (unsigned long) &_end; - memcpy(saved_command_line, from, COMMAND_LINE_SIZE); - saved_command_line[COMMAND_LINE_SIZE-1] = '\0'; - parse_cmdline(cmdline_p, from); + *cmdline_p = from; + parse_early_options(cmdline_p); bootmem_init(&meminfo); paging_init(&meminfo, mdesc); request_standard_resources(&meminfo, mdesc); diff -puN arch/arm/mm/mm-armv.c~early-param-arm arch/arm/mm/mm-armv.c --- 25/arch/arm/mm/mm-armv.c~early-param-arm 2004-03-30 19:49:06.372969744 -0800 +++ 25-akpm/arch/arm/mm/mm-armv.c 2004-03-30 19:49:06.377968984 -0800 @@ -80,18 +80,18 @@ static struct cachepolicy cache_policies * writebuffer to be turned off. (Note: the write * buffer should not be on and the cache off). */ -static void __init early_cachepolicy(char **p) +static int __init early_cachepolicy(char *p) { int i; for (i = 0; i < ARRAY_SIZE(cache_policies); i++) { int len = strlen(cache_policies[i].policy); - if (memcmp(*p, cache_policies[i].policy, len) == 0) { + if (memcmp(p, cache_policies[i].policy, len) == 0) { cachepolicy = i; cr_alignment &= ~cache_policies[i].cr_mask; cr_no_alignment &= ~cache_policies[i].cr_mask; - *p += len; + p += len; break; } } @@ -99,31 +99,36 @@ static void __init early_cachepolicy(cha printk(KERN_ERR "ERROR: unknown or unsupported cache policy\n"); flush_cache_all(); set_cr(cr_alignment); + + return 0; } -static void __init early_nocache(char **__unused) +static int __init early_nocache(char *__unused) { char *p = "buffered"; printk(KERN_WARNING "nocache is deprecated; use cachepolicy=%s\n", p); - early_cachepolicy(&p); + early_cachepolicy(p); + + return 0; } -static void __init early_nowrite(char **__unused) +static int __init early_nowrite(char *__unused) { char *p = "uncached"; printk(KERN_WARNING "nowb is deprecated; use cachepolicy=%s\n", p); - early_cachepolicy(&p); + early_cachepolicy(p); + + return 0; } -static void __init early_ecc(char **p) +static int __init early_ecc(char *p) { - if (memcmp(*p, "on", 2) == 0) { + if (memcmp(p, "on", 2) == 0) ecc_mask = PMD_PROTECTION; - *p += 2; - } else if (memcmp(*p, "off", 3) == 0) { + else if (memcmp(p, "off", 3) == 0) ecc_mask = 0; - *p += 3; - } + + return 0; } __early_param("nocache", early_nocache); diff -puN include/asm-arm/setup.h~early-param-arm include/asm-arm/setup.h --- 25/include/asm-arm/setup.h~early-param-arm 2004-03-30 19:49:06.373969592 -0800 +++ 25-akpm/include/asm-arm/setup.h 2004-03-30 19:49:06.378968832 -0800 @@ -202,16 +202,4 @@ struct meminfo { extern struct meminfo meminfo; -/* - * Early command line parameters. - */ -struct early_params { - const char *arg; - void (*fn)(char **p); -}; - -#define __early_param(name,fn) \ -static struct early_params __early_##fn __attribute_used__ \ -__attribute__((__section__("__early_param"))) = { name, fn } - #endif _