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

@@ -1,16 +1,15 @@
\ 7.4.3.5 User commands for booting
: boot ( "{param-text}<cr>" -- )
(encode-bootpath)
: boot ( "{param-text}<cr>" -- )
(encode-bootpath) \ Setup bootpath/bootargs
s" platform-boot" $find if
execute
else
2drop
cr ." Booting " type cr
." ... not supported on this system." cr
execute \ Execute platform-specific boot code
then
$load \ load and go
go
;
\ : diagnostic-mode? ( -- diag? )
\ ;

View File

@@ -58,24 +58,55 @@ variable file-size
: (encode-bootpath) ( "{params}<cr>" -- bootpath-str bootpath-len)
\ Parse the current input buffer of a load/boot command and set both
\ the bootargs and bootpath properties as appropriate.
bl parse dup if
2dup encode-string
" /chosen" (find-dev) if
" bootpath" rot (property)
then
then
linefeed parse dup if
encode-string
" /chosen" (find-dev) if
" bootargs" rot (property)
then
else
cr
\ bootpath
bl parse dup 0= if
\ None specified. As per IEEE-1275 specification, search through each value
\ in boot-device and use the first that returns a valid ihandle on open.
s" boot-device" $find drop execute
bl left-split
begin
dup
while
2dup s" Trying " type type s" ..." type cr
2dup open-dev ?dup if
close-dev
2swap drop 0 \ Fake end of string so we exit loop
else
2drop
bl left-split
then
repeat
2drop
else
0 0 2swap \ Fake (empty) parse string
then
\ Set the bootpath property
2dup encode-string
" /chosen" (find-dev) if
" bootpath" rot (property)
then
\ bootargs
linefeed parse dup 0= if
\ None specified, use default from nvram
2drop s" boot-file" $find drop execute
then
\ Set the bootargs property
encode-string
" /chosen" (find-dev) if
" bootargs" rot (property)
then
\ Remove the remaining string
2swap 2drop
;
: load ( "{params}<cr>" -- )
(encode-bootpath)
: $load ( devstr len )
open-dev ( ihandle )
dup 0= if
drop
@@ -89,6 +120,11 @@ variable file-size
init-program
;
: load ( "{params}<cr>" -- )
(encode-bootpath)
$load
;
: dir ( "{paths}<cr>" -- )
linefeed parse
split-path-device