Rework the OpenBIOS internals so that boot, load and init-program now all use the unified libopenbios loader code with improved

IEEE-1275 spec compliance.

This patch implements the following:

1) Fix bootpath/bootargs handling so that default values are read from NVRAM, and allow multiple space-separated values to be 
specified.
2) With correct bootargs handling in place, move the ELF loader over to the new libopenbios unified loaders.
3) Remove all the loader code from all architecture directories sine we don't need it anymore.
4) Simplify the boot word so it invokes platform-specific code where required, then calls load and go as per the specification.

Tested on all my available images for SPARC32, SPARC64 and PPC, and compile-tested on x86.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@828 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
Mark Cave-Ayland
2010-08-01 15:13:48 +00:00
committed by Mark Cave-Ayland
parent f4564e0dc0
commit f9bdcf050c
15 changed files with 253 additions and 463 deletions

View File

@@ -12,71 +12,9 @@
#include "arch/common/nvram.h"
#include "libc/diskio.h"
#include "libopenbios/sys_info.h"
#include "libopenbios/elf_load.h"
#include "libopenbios/aout_load.h"
#include "libopenbios/fcode_load.h"
#include "libopenbios/forth_load.h"
#include "boot.h"
void *boot_notes = NULL;
static int try_path(const char *path, char *param)
{
ucell valid;
ihandle_t dev;
/* Open device used by this path */
dev = open_dev(path);
#ifdef CONFIG_LOADER_ELF
/* ELF Boot loader */
elf_load(&sys_info, path, param, &boot_notes);
feval("state-valid @");
valid = POP();
if (valid)
goto start_image;
#endif
/* Linux loader (not using Forth) */
linux_load(&sys_info, path, param);
#ifdef CONFIG_LOADER_AOUT
/* a.out loader */
aout_load(&sys_info, dev);
feval("state-valid @");
valid = POP();
if (valid)
goto start_image;
#endif
#ifdef CONFIG_LOADER_FCODE
/* Fcode loader */
fcode_load(dev);
feval("state-valid @");
valid = POP();
if (valid)
goto start_image;
#endif
#ifdef CONFIG_LOADER_FORTH
/* Forth loader */
forth_load(dev);
feval("state-valid @");
valid = POP();
if (valid)
goto start_image;
#endif
close_dev(dev);
return 0;
start_image:
go();
return -1;
}
void *elf_boot_notes = NULL;
void go(void)
{
@@ -133,24 +71,6 @@ void go(void)
void boot(void)
{
char *path=pop_fstr_copy(), *param;
if(!path) {
printk("[x86] Booting default not supported.\n");
return;
}
param = strchr(path, ' ');
if(param) {
*param = '\0';
param++;
}
printk("[x86] Booting file '%s' with parameters '%s'\n",path, param);
try_path(path, param);
printk("Unsupported image format\n");
free(path);
/* No platform-specific boot code */
return;
}