mirror of
https://gitlab.com/qemu-project/openbios.git
synced 2024-02-13 08:34:06 +08:00
Fix up NVRAM settings for boot-device and boot-args.
This patch originally started as a fix for PPC, in that the NVRAM initialiser wasn't been run on startup (this is why printenv on PPC always showed much much less than on SPARC). However, it also showed up some inconsistent logic for boot device selection, which must also happen *before* boot is called in order for load to work correctly. With this patch applied, bootpath and bootargs are set from boot-device and boot-args respectively on startup for SPARC32, SPARC64 and PPC. Note: there is a small chance SPARC32 may break on some images - please let me know if it does. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk> git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@805 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
committed by
Mark Cave-Ayland
parent
6afdc00000
commit
004dc4cf85
@@ -714,9 +714,39 @@ arch_of_init( void )
|
|||||||
stdout_path = "screen";
|
stdout_path = "screen";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Setup nvram variables */
|
||||||
|
push_str("/options");
|
||||||
|
fword("find-device");
|
||||||
|
|
||||||
|
uint16_t boot_device = fw_cfg_read_i16(FW_CFG_BOOT_DEVICE);
|
||||||
|
switch (boot_device) {
|
||||||
|
case 'c':
|
||||||
|
push_str("hd:");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
case 'd':
|
||||||
|
push_str("cd:");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
fword("encode-string");
|
||||||
|
push_str("boot-device");
|
||||||
|
fword("property");
|
||||||
|
|
||||||
|
/* Set up other properties */
|
||||||
push_str("/chosen");
|
push_str("/chosen");
|
||||||
fword("find-device");
|
fword("find-device");
|
||||||
|
|
||||||
|
/* bootpath/bootargs should be set to NVRAM default */
|
||||||
|
fword("boot-device");
|
||||||
|
fword("encode-string");
|
||||||
|
push_str("bootpath");
|
||||||
|
fword("property");
|
||||||
|
fword("boot-args");
|
||||||
|
fword("encode-string");
|
||||||
|
push_str("bootargs");
|
||||||
|
fword("property");
|
||||||
|
|
||||||
push_str(stdin_path);
|
push_str(stdin_path);
|
||||||
fword("open-dev");
|
fword("open-dev");
|
||||||
fword("encode-int");
|
fword("encode-int");
|
||||||
|
|||||||
@@ -221,43 +221,19 @@ newworld_boot( void )
|
|||||||
|
|
||||||
if (!path) {
|
if (!path) {
|
||||||
NEWWORLD_DPRINTF("Entering boot, no path\n");
|
NEWWORLD_DPRINTF("Entering boot, no path\n");
|
||||||
push_str("boot-device");
|
|
||||||
push_str("/options");
|
/* No path specified, so grab defaults from /chosen */
|
||||||
|
push_str("bootpath");
|
||||||
|
push_str("/chosen");
|
||||||
fword("(find-dev)");
|
fword("(find-dev)");
|
||||||
POP();
|
POP();
|
||||||
fword("get-package-property");
|
fword("get-package-property");
|
||||||
if (!POP()) {
|
POP();
|
||||||
path = pop_fstr_copy();
|
path = pop_fstr_copy();
|
||||||
param = strchr(path, ' ');
|
|
||||||
if (param) {
|
for (i = 0; chrp_path[i]; i++)
|
||||||
*param = '\0';
|
try_path(path, chrp_path[i], param);
|
||||||
param++;
|
|
||||||
} else {
|
|
||||||
push_str("boot-args");
|
|
||||||
push_str("/options");
|
|
||||||
fword("(find-dev)");
|
|
||||||
POP();
|
|
||||||
fword("get-package-property");
|
|
||||||
POP();
|
|
||||||
param = pop_fstr_copy();
|
|
||||||
}
|
|
||||||
try_path(path, NULL, param);
|
|
||||||
for (i = 0; chrp_path[i]; i++)
|
|
||||||
try_path(path, chrp_path[i], param);
|
|
||||||
} else {
|
|
||||||
uint16_t boot_device = fw_cfg_read_i16(FW_CFG_BOOT_DEVICE);
|
|
||||||
switch (boot_device) {
|
|
||||||
case 'c':
|
|
||||||
path = strdup("hd:");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
case 'd':
|
|
||||||
path = strdup("cd:");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
for (i = 0; chrp_path[i]; i++)
|
|
||||||
try_path(path, chrp_path[i], param);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
NEWWORLD_DPRINTF("Entering boot, path %s\n", path);
|
NEWWORLD_DPRINTF("Entering boot, path %s\n", path);
|
||||||
try_path(path, NULL, param);
|
try_path(path, NULL, param);
|
||||||
|
|||||||
@@ -56,3 +56,7 @@
|
|||||||
stdout @ encode-int " stdout" property
|
stdout @ encode-int " stdout" property
|
||||||
device-end
|
device-end
|
||||||
;
|
;
|
||||||
|
|
||||||
|
:noname
|
||||||
|
set-defaults
|
||||||
|
; PREPOST-initializer
|
||||||
|
|||||||
@@ -21,6 +21,9 @@
|
|||||||
#include "openbios.h"
|
#include "openbios.h"
|
||||||
#include "boot.h"
|
#include "boot.h"
|
||||||
#include "packages/video.h"
|
#include "packages/video.h"
|
||||||
|
#define NO_QEMU_PROTOS
|
||||||
|
#define NO_OPENBIOS_PROTOS
|
||||||
|
#include "arch/common/fw_cfg.h"
|
||||||
|
|
||||||
#define MEMORY_SIZE (128*1024) /* 16K ram for hosted system */
|
#define MEMORY_SIZE (128*1024) /* 16K ram for hosted system */
|
||||||
#define DICTIONARY_SIZE (256*1024) /* 256K for the dictionary */
|
#define DICTIONARY_SIZE (256*1024) /* 256K for the dictionary */
|
||||||
@@ -149,6 +152,20 @@ arch_init( void )
|
|||||||
#endif
|
#endif
|
||||||
device_end();
|
device_end();
|
||||||
|
|
||||||
|
/* Set up other properties */
|
||||||
|
push_str("/chosen");
|
||||||
|
fword("find-device");
|
||||||
|
|
||||||
|
/* bootpath/bootargs should be set to NVRAM default */
|
||||||
|
fword("boot-device");
|
||||||
|
fword("encode-string");
|
||||||
|
push_str("bootpath");
|
||||||
|
fword("property");
|
||||||
|
fword("boot-args");
|
||||||
|
fword("encode-string");
|
||||||
|
push_str("bootargs");
|
||||||
|
fword("property");
|
||||||
|
|
||||||
bind_func("platform-boot", boot );
|
bind_func("platform-boot", boot );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -151,30 +151,14 @@ void boot(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!path) {
|
if(!path) {
|
||||||
push_str("boot-device");
|
/* No path specified, so grab defaults from /chosen */
|
||||||
push_str("/options");
|
push_str("bootpath");
|
||||||
|
push_str("/chosen");
|
||||||
fword("(find-dev)");
|
fword("(find-dev)");
|
||||||
POP();
|
POP();
|
||||||
fword("get-package-property");
|
fword("get-package-property");
|
||||||
if (!POP()) {
|
POP();
|
||||||
path = pop_fstr_copy();
|
path = pop_fstr_copy();
|
||||||
} else {
|
|
||||||
switch (boot_device) {
|
|
||||||
case 'a':
|
|
||||||
path = strdup("/obio/SUNW,fdtwo");
|
|
||||||
break;
|
|
||||||
case 'c':
|
|
||||||
path = strdup("disk");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
case 'd':
|
|
||||||
path = strdup("cdrom");
|
|
||||||
break;
|
|
||||||
case 'n':
|
|
||||||
path = strdup("net");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
param = strchr(path, ' ');
|
param = strchr(path, ' ');
|
||||||
|
|||||||
@@ -468,6 +468,31 @@ void arch_nvram_get(char *data)
|
|||||||
|
|
||||||
ob_mmu_init(cpu->name, ram_size);
|
ob_mmu_init(cpu->name, ram_size);
|
||||||
|
|
||||||
|
/* Setup nvram variables */
|
||||||
|
push_str("/options");
|
||||||
|
fword("find-device");
|
||||||
|
|
||||||
|
switch (boot_device) {
|
||||||
|
case 'a':
|
||||||
|
push_str("/obio/SUNW,fdtwo");
|
||||||
|
break;
|
||||||
|
case 'c':
|
||||||
|
push_str("disk");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
case 'd':
|
||||||
|
push_str("cdrom");
|
||||||
|
break;
|
||||||
|
case 'n':
|
||||||
|
push_str("net");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
fword("encode-string");
|
||||||
|
push_str("boot-device");
|
||||||
|
fword("property");
|
||||||
|
|
||||||
|
/* Set up other properties */
|
||||||
push_str("/chosen");
|
push_str("/chosen");
|
||||||
fword("find-device");
|
fword("find-device");
|
||||||
|
|
||||||
@@ -480,6 +505,16 @@ void arch_nvram_get(char *data)
|
|||||||
push_str("bootpath");
|
push_str("bootpath");
|
||||||
fword("property");
|
fword("property");
|
||||||
|
|
||||||
|
/* bootpath/bootargs should be set to NVRAM default */
|
||||||
|
fword("boot-device");
|
||||||
|
fword("encode-string");
|
||||||
|
push_str("bootpath");
|
||||||
|
fword("property");
|
||||||
|
fword("boot-args");
|
||||||
|
fword("encode-string");
|
||||||
|
push_str("bootargs");
|
||||||
|
fword("property");
|
||||||
|
|
||||||
push_str(obio_cmdline);
|
push_str(obio_cmdline);
|
||||||
fword("encode-string");
|
fword("encode-string");
|
||||||
push_str("bootargs");
|
push_str("bootargs");
|
||||||
|
|||||||
@@ -329,7 +329,6 @@ s" true" s" scroll-lock" bool-config
|
|||||||
|
|
||||||
[IFDEF] CONFIG_PPC
|
[IFDEF] CONFIG_PPC
|
||||||
\ ---- PPC ----
|
\ ---- PPC ----
|
||||||
s" disk" s" boot-device" str-config \ 7.4.3.5
|
|
||||||
s" false" s" little-endian?" bool-config
|
s" false" s" little-endian?" bool-config
|
||||||
s" false" s" real-mode?" bool-config
|
s" false" s" real-mode?" bool-config
|
||||||
s" -1" s" real-base" int-config
|
s" -1" s" real-base" int-config
|
||||||
@@ -341,7 +340,6 @@ s" -1" s" virt-size" int-config
|
|||||||
|
|
||||||
[IFDEF] CONFIG_X86
|
[IFDEF] CONFIG_X86
|
||||||
\ ---- X86 ----
|
\ ---- X86 ----
|
||||||
s" disk" s" boot-device" str-config \ 7.4.3.5
|
|
||||||
s" true" s" little-endian?" bool-config
|
s" true" s" little-endian?" bool-config
|
||||||
[THEN]
|
[THEN]
|
||||||
|
|
||||||
@@ -367,6 +365,7 @@ s" false" s" little-endian?" bool-config
|
|||||||
s" " s" boot-screen" str-config
|
s" " s" boot-screen" str-config
|
||||||
s" " s" boot-script" str-config
|
s" " s" boot-script" str-config
|
||||||
s" false" s" use-generic?" bool-config
|
s" false" s" use-generic?" bool-config
|
||||||
|
s" disk" s" boot-device" str-config \ 7.4.3.5
|
||||||
s" " s" boot-args" str-config \ ???
|
s" " s" boot-args" str-config \ ???
|
||||||
|
|
||||||
\ defers
|
\ defers
|
||||||
|
|||||||
Reference in New Issue
Block a user