Files
openbios/arch/x86/boot.c
Mark Cave-Ayland f9bdcf050c 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
2010-08-01 15:13:48 +00:00

77 lines
1.6 KiB
C

/* tag: openbios boot command for x86
*
* Copyright (C) 2003-2004 Stefan Reinauer
*
* See the file "COPYING" for further information about
* the copyright and warranty status of this work.
*/
#undef BOOTSTRAP
#include "config.h"
#include "libopenbios/bindings.h"
#include "arch/common/nvram.h"
#include "libc/diskio.h"
#include "libopenbios/sys_info.h"
#include "boot.h"
void *elf_boot_notes = NULL;
void go(void)
{
ucell address, type, size;
int image_retval = 0;
/* Get the entry point and the type (see forth/debugging/client.fs) */
feval("saved-program-state >sps.entry @");
address = POP();
feval("saved-program-state >sps.file-type @");
type = POP();
feval("saved-program-state >sps.file-size @");
size = POP();
printk("\nJumping to entry point " FMT_ucellx " for type " FMT_ucellx "...\n", address, type);
switch (type) {
case 0x0:
/* Start ELF boot image */
image_retval = start_elf(address, (uint32_t)&boot_notes);
break;
case 0x1:
/* Start ELF image */
image_retval = start_elf(address, (uint32_t)NULL);
break;
case 0x5:
/* Start a.out image */
image_retval = start_elf(address, (uint32_t)NULL);
break;
case 0x10:
/* Start Fcode image */
printk("Evaluating FCode...\n");
PUSH(address);
PUSH(1);
fword("byte-load");
image_retval = 0;
break;
case 0x11:
/* Start Forth image */
PUSH(address);
PUSH(size);
fword("eval2");
image_retval = 0;
break;
}
printk("Image returned with return value %#x\n", image_retval);
}
void boot(void)
{
/* No platform-specific boot code */
return;
}