Files
openbios/packages/disk-label.fs
cdrom - deblocker - disk-label - (misc-files | sun-parts | pc-parts | mac-parts) 7fc4e304c3 As documented on the mailing lists, change the interposition order of the disk packages from:
cdrom -> deblocker -> disk-label -> (misc-files | sun-parts | pc-parts | mac-parts) 

to:

cdrom -> deblocker -> disk-label -> (sun-parts | pc-parts | mac-parts) -> misc-files 

This makes the overall code much simpler, since instead of passing get-info structures between the different layers to work out 
the current device offset, each package can simply maintain its own offsets and bubble them back up to the parent.

There are also many, many bugfixes present is patch, some of which are given below:

- Add debugging in /packages/misc-files, augment debugging in all other disk packages
- Fix alignment issue in /packages/pc-parts so it works correctly on strictly align archs, e.g. SPARC64
- Fix parsing of [<id>,][filename] arguments to load (in preparation for next patch set)
- Fix byte-swapping issues in /packages/mac-parts (in theory it should now work regardless of endian)




git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@791 f158a5a8-5612-0410-a976-696ce0be7e32
2010-06-08 20:59:08 +00:00

103 lines
2.6 KiB
Forth

\ tag: Utility functions
\
\ deblocker / filesystem support
\
\ Copyright (C) 2003, 2004 Samuel Rydh
\
\ See the file "COPYING" for further information about
\ the copyright and warranty status of this work.
\
dev /packages
\ -------------------------------------------------------------
\ /packages/disk-label (partition handling)
\ -------------------------------------------------------------
[IFDEF] CONFIG_DISK_LABEL
new-device
" disk-label" device-name
external
variable part-handlers \ list with (probe-xt, phandle) elements
variable fs-handlers \ list with (fs-probe-xt, phandle) elements
: find-part-handler ( block0 -- phandle | 0 )
>r part-handlers
begin list-get while
( nextlist dictptr )
r@ over @ execute if
( nextlist dictptr )
na1+ @ r> rot 2drop exit
then
drop
repeat
r> drop 0
;
: find-filesystem ( offs.d ih -- ph | 0 )
>r fs-handlers ( offs.d listhead )
begin list-get while
2over ( offs.d nextlist dictptr offs.d )
r@ ( offs.d nextlist dictptr offs.d ih )
3 pick ( offs.d nextlist dictptr offs.d ih dictptr )
@ ( offs.d nextlist dictptr offs.d ih probe-xt )
execute ( offs.d nextlist dictptr flag? )
if
( offs.d nextlist dictptr )
na1+ ( offs.d nextlist dictptr+1 )
@ ( offs.d nextlist phandle )
r> ( offs.d nextlist phandle ih )
rot ( offs.d phandle ih nextlist )
2drop ( offs.d phandle )
-rot ( phandle offs.d )
2drop ( phandle )
exit
then
drop ( offs.d nextlist )
repeat
2drop ( offs.d )
r> drop 0
;
: register-part-handler ( handler-ph -- )
dup " probe" rot find-method
0= abort" Missing probe method!"
( phandle probe-xt )
part-handlers list-add , ,
;
: register-fs-handler ( handler-ph -- )
dup " probe" rot find-method
0= abort" Missing probe method!"
( phandle probe-xt )
fs-handlers list-add , ,
;
finish-device
\ ---------------------------------------------------------------------------
\ methods to register partion and filesystem packages used by disk-label
\ ---------------------------------------------------------------------------
device-end
: register-partition-package ( -- )
" register-part-handler" " disk-label" $find-package-method ?dup if
active-package swap execute
else
." [disk-label] internal error" cr
then
;
: register-fs-package ( -- )
" register-fs-handler" " disk-label" $find-package-method ?dup if
active-package swap execute
else
." [misc-files] internal error" cr
then
;
[THEN]
device-end