Author: mcayland Date: Mon Aug 8 14:33:10 2011 New Revision: 1046 URL: http://tracker.coreboot.org/trac/openbios/changeset/1046
Log: Make select-dev and unselect-dev compatible with OBP.
From the 1275 errata for section H.8, select-dev and unselect-dev are
pre Open Firmware, but not the same as open-dev/device-end. Make them Sun OBP compatible by pulling the functionality for select-dev/ unselect-dev out of (and simplifying) begin-package/end-package.
For the Sun OBP definition of begin-package/end-package, along with descriptions and example usage, see the "Debugging and Testing FCode Programs" chapter of "Writing FCode 3.x Programs".
Signed-off-by: Bob Breuer breuerr@mc.net Signed-off-by: Mark Cave-Ayland mark.cave-ayland@siriusit.co.uk
Modified: trunk/openbios-devel/forth/admin/devices.fs trunk/openbios-devel/forth/debugging/fcode.fs trunk/openbios-devel/forth/device/pathres.fs
Modified: trunk/openbios-devel/forth/admin/devices.fs ============================================================================== --- trunk/openbios-devel/forth/admin/devices.fs Thu Jul 14 16:37:34 2011 (r1045) +++ trunk/openbios-devel/forth/admin/devices.fs Mon Aug 8 14:33:10 2011 (r1046) @@ -46,10 +46,34 @@ 0 active-package! ;
+\ Open selected device node and make it the current instance +\ section H.8 errata: pre OpenFirmware, but Sun OBP compatible +: select-dev ( -- ) + open-dev dup 0= abort" failed opening parent." + dup to my-self + ihandle>phandle active-package! +; + +\ Close current node, deselect active package and current instance, +\ leaving no instance selected +\ section H.8 errata: pre OpenFirmware, but Sun OBP compatible : unselect-dev ( -- ) + my-self close-dev device-end + 0 to my-self +; + +: begin-package ( arg-str arg-len reg-str reg-len dev-str dev-len -- ) + select-dev + new-device + set-args +; + +: end-package ( -- ) + finish-device + unselect-dev ; - + : ?active-package ( -- phandle ) active-package dup 0= abort" no active device" ;
Modified: trunk/openbios-devel/forth/debugging/fcode.fs ============================================================================== --- trunk/openbios-devel/forth/debugging/fcode.fs Thu Jul 14 16:37:34 2011 (r1045) +++ trunk/openbios-devel/forth/debugging/fcode.fs Mon Aug 8 14:33:10 2011 (r1046) @@ -10,21 +10,5 @@ : headers ( -- ) ;
-: begin-package ( arg-str arg-len reg-str reg-len dev-str dev-len -- ) - open-dev dup 0= abort" failed opening parent." - dup to my-self - ihandle>phandle active-package! - new-device - set-args -; - -: end-package ( -- ) - my-parent >r - finish-device - 0 active-package! - 0 to my-self - r> close-dev -; - : apply ( ... "method-name< >device-specifier< >" -- ??? ) ;
Modified: trunk/openbios-devel/forth/device/pathres.fs ============================================================================== --- trunk/openbios-devel/forth/device/pathres.fs Thu Jul 14 16:37:34 2011 (r1045) +++ trunk/openbios-devel/forth/device/pathres.fs Mon Aug 8 14:33:10 2011 (r1046) @@ -471,10 +471,6 @@ ( ihandle ) ;
-: select-dev ( dev-str dev-len -- ihandle | 0 ) - open-dev -; - : execute-device-method ( ... dev-str dev-len met-str met-len -- ... false | ?? true ) 2swap