Commit 7468132f authored by Anton Blanchard's avatar Anton Blanchard Committed by Linus Torvalds

[PATCH] ppc64: clean up kernel command line code

Clean up some of our command line code:

- We were copying the command line out of the device tree twice, but the
  first time we forgot to add CONFIG_CMDLINE. Fix this and remove the
  second copy.
- The command line birec code ran after we had done some command line
  parsing in prom.c. This had the opportunity to really confuse the
  user, with some options being parsed out of the device tree and the
  other out of birecs. Luckily we could find no user of the command
  line birecs, so remove them.
- remove duplicate printing of kernel command line;
- clean up iseries inits and create an iSeries_parse_cmdline.
Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent c95e4713
......@@ -140,8 +140,6 @@ chrp_setup_arch(void)
ROOT_DEV = Root_SDA2;
}
printk("Boot arguments: %s\n", cmd_line);
fwnmi_init();
#ifndef CONFIG_PPC_ISERIES
......
......@@ -333,32 +333,31 @@ void __init iSeries_init_early(void)
#endif
if (itLpNaca.xPirEnvironMode == 0)
piranha_simulator = 1;
/* Associate Lp Event Queue 0 with processor 0 */
HvCallEvent_setLpEventQueueInterruptProc(0, 0);
mf_init();
mf_initialized = 1;
mb();
}
void __init iSeries_init(unsigned long r3, unsigned long r4, unsigned long r5,
unsigned long r6, unsigned long r7)
void __init iSeries_parse_cmdline(void)
{
char *p, *q;
/* Associate Lp Event Queue 0 with processor 0 */
HvCallEvent_setLpEventQueueInterruptProc(0, 0);
/* copy the command line parameter from the primary VSP */
HvCallEvent_dmaToSp(cmd_line, 2 * 64* 1024, 256,
HvLpDma_Direction_RemoteToLocal);
p = cmd_line;
q = cmd_line + 255;
while( p < q ) {
while(p < q) {
if (!*p || *p == '\n')
break;
++p;
}
*p = 0;
mf_init();
mf_initialized = 1;
mb();
}
/*
......
......@@ -1707,6 +1707,9 @@ prom_init(unsigned long r3, unsigned long r4, unsigned long pp,
}
RELOC(cmd_line[0]) = 0;
#ifdef CONFIG_CMDLINE
strlcpy(RELOC(cmd_line), CONFIG_CMDLINE, sizeof(cmd_line));
#endif /* CONFIG_CMDLINE */
if ((long)_prom->chosen > 0) {
prom_getprop(_prom->chosen, "bootargs", p, sizeof(cmd_line));
if (p != NULL && p[0] != 0)
......
......@@ -68,7 +68,6 @@ extern void pmac_init(unsigned long r3,
unsigned long r7);
extern void fw_feature_init(void);
extern void iSeries_init( void );
extern void iSeries_init_early( void );
extern void pSeries_init_early( void );
extern void pSeriesLP_init_early(void);
......@@ -77,6 +76,7 @@ extern void mm_init_ppc64( void );
extern void pseries_secondary_smp_init(unsigned long);
extern int idle_setup(void);
extern void vpa_init(int cpu);
extern void iSeries_parse_cmdline(void);
unsigned long decr_overclock = 1;
unsigned long decr_overclock_proc0 = 1;
......@@ -87,10 +87,6 @@ int powersave_nap;
unsigned char aux_device_present;
void parse_cmd_line(unsigned long r3, unsigned long r4, unsigned long r5,
unsigned long r6, unsigned long r7);
int parse_bootinfo(void);
#ifdef CONFIG_MAGIC_SYSRQ
unsigned long SYSRQ_KEY;
#endif /* CONFIG_MAGIC_SYSRQ */
......@@ -282,19 +278,16 @@ void setup_system(unsigned long r3, unsigned long r4, unsigned long r5,
case PLATFORM_PSERIES:
fw_feature_init();
pSeries_init_early();
parse_bootinfo();
break;
case PLATFORM_PSERIES_LPAR:
fw_feature_init();
pSeriesLP_init_early();
parse_bootinfo();
break;
#endif /* CONFIG_PPC_PSERIES */
#ifdef CONFIG_PPC_PMAC
case PLATFORM_POWERMAC:
pmac_init_early();
parse_bootinfo();
#endif /* CONFIG_PPC_PMAC */
}
......@@ -334,6 +327,10 @@ void setup_system(unsigned long r3, unsigned long r4, unsigned long r5,
}
#endif /* CONFIG_PPC_PSERIES */
#ifdef CONFIG_PPC_ISERIES
iSeries_parse_cmdline();
#endif
#ifdef CONFIG_SMP
#ifndef CONFIG_PPC_ISERIES
/*
......@@ -393,18 +390,6 @@ void setup_system(unsigned long r3, unsigned long r4, unsigned long r5,
/* Select the correct idle loop for the platform. */
idle_setup();
switch (systemcfg->platform) {
#ifdef CONFIG_PPC_ISERIES
case PLATFORM_ISERIES_LPAR:
iSeries_init();
break;
#endif
default:
/* The following relies on the device tree being */
/* fully configured. */
parse_cmd_line(r3, r4, r5, r6, r7);
}
}
void machine_restart(char *cmd)
......@@ -528,31 +513,6 @@ struct seq_operations cpuinfo_op = {
.show = show_cpuinfo,
};
/*
* Fetch the cmd_line from open firmware.
*/
void parse_cmd_line(unsigned long r3, unsigned long r4, unsigned long r5,
unsigned long r6, unsigned long r7)
{
cmd_line[0] = 0;
#ifdef CONFIG_CMDLINE
strlcpy(cmd_line, CONFIG_CMDLINE, sizeof(cmd_line));
#endif /* CONFIG_CMDLINE */
#ifdef CONFIG_PPC_PSERIES
{
struct device_node *chosen;
chosen = of_find_node_by_name(NULL, "chosen");
if (chosen != NULL) {
char *p;
p = get_property(chosen, "bootargs", NULL);
if (p != NULL && p[0] != 0)
strlcpy(cmd_line, p, sizeof(cmd_line));
of_node_put(chosen);
}
}
#endif
/* Look for mem= option on command line */
......@@ -652,26 +612,6 @@ static int __init set_preferred_console(void)
}
console_initcall(set_preferred_console);
int parse_bootinfo(void)
{
struct bi_record *rec;
rec = prom.bi_recs;
if ( rec == NULL || rec->tag != BI_FIRST )
return -1;
for ( ; rec->tag != BI_LAST ; rec = bi_rec_next(rec) ) {
switch (rec->tag) {
case BI_CMD_LINE:
strlcpy(cmd_line, (void *)rec->data, sizeof(cmd_line));
break;
}
}
return 0;
}
#endif
int __init ppc_init(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment