Author: blueswirl Date: Tue Aug 3 22:48:23 2010 New Revision: 832 URL: http://tracker.coreboot.org/trac/openbios/changeset/832
Log: sparc32: fix pre-loaded kernel command line
Fix more breakage from r828:
For some reason, QEMU/Sparc32 does not set FW_CFG_CMDLINE_SIZE, so we have to use FW_CFG_KERNEL_CMDLINE instead.
Setup romvec obp_arg.argv[1] and "boot-file" property.
Remove obsolete command line setup code from obio.c.
Signed-off-by: Blue Swirl blauwirbel@gmail.com
Modified: trunk/openbios-devel/arch/sparc32/openbios.c trunk/openbios-devel/drivers/obio.c
Modified: trunk/openbios-devel/arch/sparc32/openbios.c ============================================================================== --- trunk/openbios-devel/arch/sparc32/openbios.c Tue Aug 3 20:39:27 2010 (r831) +++ trunk/openbios-devel/arch/sparc32/openbios.c Tue Aug 3 22:48:23 2010 (r832) @@ -20,6 +20,7 @@ #include "libopenbios/sys_info.h" #include "openbios.h" #include "boot.h" +#include "openprom.h" #include "packages/video.h" #define NO_QEMU_PROTOS #include "arch/common/fw_cfg.h" @@ -134,7 +135,8 @@ arch_init( void ) { static char cmdline[128]; - int size; + int size = 0; + const char *kernel_cmdline;
openbios_init(); modules_init(); @@ -154,25 +156,31 @@ #endif device_end();
+ /* Initialiase openprom romvec */ + romvec = init_openprom(); + kernel_size = fw_cfg_read_i32(FW_CFG_KERNEL_SIZE); if (kernel_size) kernel_image = fw_cfg_read_i32(FW_CFG_KERNEL_ADDR);
- size = fw_cfg_read_i32(FW_CFG_CMDLINE_SIZE); - if (size) { - fw_cfg_read(FW_CFG_CMDLINE_DATA, cmdline, size); - } + kernel_cmdline = (const char *) fw_cfg_read_i32(FW_CFG_KERNEL_CMDLINE); + if (kernel_cmdline) { + size = strlen(kernel_cmdline); + memcpy(cmdline, kernel_cmdline, size); + obp_arg.argv[1] = cmdline; + } cmdline[size] = '\0'; qemu_cmdline = (uint32_t)cmdline;
- boot_device = fw_cfg_read_i16(FW_CFG_BOOT_DEVICE); - - /* Initialiase openprom romvec */ - romvec = init_openprom(); + /* Setup nvram variables */ + push_str("/options"); + fword("find-device"); + push_str(cmdline); + fword("encode-string"); + push_str("boot-file"); + fword("property");
- /* Setup nvram variables */ - push_str("/options"); - fword("find-device"); + boot_device = fw_cfg_read_i16(FW_CFG_BOOT_DEVICE);
switch (boot_device) { case 'a': @@ -194,11 +202,6 @@ push_str("boot-device"); fword("property");
- push_str(""); - fword("encode-string"); - push_str("boot-file"); - fword("property"); - /* Set up other properties */ push_str("/chosen"); fword("find-device");
Modified: trunk/openbios-devel/drivers/obio.c ============================================================================== --- trunk/openbios-devel/drivers/obio.c Tue Aug 3 20:39:27 2010 (r831) +++ trunk/openbios-devel/drivers/obio.c Tue Aug 3 22:48:23 2010 (r832) @@ -38,12 +38,6 @@ */ #define SUN4M_NCPU 4
-/* The kernel may want to examine the arguments, so hold a copy in OBP's - * mapped memory. - */ -#define OBIO_CMDLINE_MAX 256 -static char obio_cmdline[OBIO_CMDLINE_MAX]; - /* DECLARE data structures for the nodes. */ DECLARE_UNNAMED_NODE( ob_obio, INSTALL_OPEN, sizeof(int) );
@@ -651,14 +645,12 @@ const char *stdin, *stdout; unsigned int i; char nographic; - uint32_t size = 0; uint16_t machine_id; const struct cpudef *cpu; const struct machdef *mach; char buf[256]; uint32_t temp; phandle_t chosen; - const char *kernel_cmdline;
ob_new_obio_device("eeprom", NULL);
@@ -691,21 +683,6 @@ for(;;); }
- kernel_size = fw_cfg_read_i32(FW_CFG_KERNEL_SIZE); - if (kernel_size) - kernel_image = fw_cfg_read_i32(FW_CFG_KERNEL_ADDR); - kernel_cmdline = (const char *) fw_cfg_read_i32(FW_CFG_KERNEL_CMDLINE); - if (kernel_cmdline) { - size = strlen(kernel_cmdline); - if (size > OBIO_CMDLINE_MAX - 1) - size = OBIO_CMDLINE_MAX - 1; - memcpy(&obio_cmdline, kernel_cmdline, size); - } - obio_cmdline[size] = '\0'; - qemu_cmdline = (uint32_t) &obio_cmdline; - cmdline_size = size; - boot_device = fw_cfg_read_i16(FW_CFG_BOOT_DEVICE); - fw_cfg_read(FW_CFG_NOGRAPHIC, &nographic, 1); graphic_depth = fw_cfg_read_i16(FW_CFG_SUN4M_DEPTH);