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>

git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@832 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
Blue Swirl
2010-08-03 20:48:23 +00:00
parent 6e79d1d9c3
commit b11569eb24
2 changed files with 20 additions and 40 deletions

View File

@@ -20,6 +20,7 @@
#include "libopenbios/sys_info.h" #include "libopenbios/sys_info.h"
#include "openbios.h" #include "openbios.h"
#include "boot.h" #include "boot.h"
#include "openprom.h"
#include "packages/video.h" #include "packages/video.h"
#define NO_QEMU_PROTOS #define NO_QEMU_PROTOS
#include "arch/common/fw_cfg.h" #include "arch/common/fw_cfg.h"
@@ -134,7 +135,8 @@ static void
arch_init( void ) arch_init( void )
{ {
static char cmdline[128]; static char cmdline[128];
int size; int size = 0;
const char *kernel_cmdline;
openbios_init(); openbios_init();
modules_init(); modules_init();
@@ -154,26 +156,32 @@ arch_init( void )
#endif #endif
device_end(); device_end();
/* Initialiase openprom romvec */
romvec = init_openprom();
kernel_size = fw_cfg_read_i32(FW_CFG_KERNEL_SIZE); kernel_size = fw_cfg_read_i32(FW_CFG_KERNEL_SIZE);
if (kernel_size) if (kernel_size)
kernel_image = fw_cfg_read_i32(FW_CFG_KERNEL_ADDR); kernel_image = fw_cfg_read_i32(FW_CFG_KERNEL_ADDR);
size = fw_cfg_read_i32(FW_CFG_CMDLINE_SIZE); kernel_cmdline = (const char *) fw_cfg_read_i32(FW_CFG_KERNEL_CMDLINE);
if (size) { if (kernel_cmdline) {
fw_cfg_read(FW_CFG_CMDLINE_DATA, cmdline, size); size = strlen(kernel_cmdline);
} memcpy(cmdline, kernel_cmdline, size);
obp_arg.argv[1] = cmdline;
}
cmdline[size] = '\0'; cmdline[size] = '\0';
qemu_cmdline = (uint32_t)cmdline; qemu_cmdline = (uint32_t)cmdline;
/* Setup nvram variables */
push_str("/options");
fword("find-device");
push_str(cmdline);
fword("encode-string");
push_str("boot-file");
fword("property");
boot_device = fw_cfg_read_i16(FW_CFG_BOOT_DEVICE); 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");
switch (boot_device) { switch (boot_device) {
case 'a': case 'a':
push_str("floppy"); push_str("floppy");
@@ -194,11 +202,6 @@ arch_init( void )
push_str("boot-device"); push_str("boot-device");
fword("property"); fword("property");
push_str("");
fword("encode-string");
push_str("boot-file");
fword("property");
/* Set up other properties */ /* Set up other properties */
push_str("/chosen"); push_str("/chosen");
fword("find-device"); fword("find-device");

View File

@@ -38,12 +38,6 @@
*/ */
#define SUN4M_NCPU 4 #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 data structures for the nodes. */
DECLARE_UNNAMED_NODE( ob_obio, INSTALL_OPEN, sizeof(int) ); DECLARE_UNNAMED_NODE( ob_obio, INSTALL_OPEN, sizeof(int) );
@@ -651,14 +645,12 @@ ob_nvram_init(uint64_t base, uint64_t offset)
const char *stdin, *stdout; const char *stdin, *stdout;
unsigned int i; unsigned int i;
char nographic; char nographic;
uint32_t size = 0;
uint16_t machine_id; uint16_t machine_id;
const struct cpudef *cpu; const struct cpudef *cpu;
const struct machdef *mach; const struct machdef *mach;
char buf[256]; char buf[256];
uint32_t temp; uint32_t temp;
phandle_t chosen; phandle_t chosen;
const char *kernel_cmdline;
ob_new_obio_device("eeprom", NULL); ob_new_obio_device("eeprom", NULL);
@@ -691,21 +683,6 @@ ob_nvram_init(uint64_t base, uint64_t offset)
for(;;); 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); fw_cfg_read(FW_CFG_NOGRAPHIC, &nographic, 1);
graphic_depth = fw_cfg_read_i16(FW_CFG_SUN4M_DEPTH); graphic_depth = fw_cfg_read_i16(FW_CFG_SUN4M_DEPTH);