[OpenBIOS] [PATCH v2] make select-dev and unselect-dev compatible with OBP
Bob Breuer
breuerr at mc.net
Fri Aug 5 18:53:52 CEST 2011
>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 at mc.net>
---
v2: updated commit message and comments to mention the 1275 errata,
moved the words to forth/admin/devices.fs, begin-package/end-package
followed along to avoid "unknown word" errors while building the
dictionary.
forth/admin/devices.fs | 26 +++++++++++++++++++++++++-
forth/debugging/fcode.fs | 16 ----------------
forth/device/pathres.fs | 4 ----
3 files changed, 25 insertions(+), 21 deletions(-)
Index: forth/device/pathres.fs
===================================================================
--- forth/device/pathres.fs (revision 1045)
+++ forth/device/pathres.fs (working copy)
@@ -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
Index: forth/admin/devices.fs
===================================================================
--- forth/admin/devices.fs (revision 1045)
+++ forth/admin/devices.fs (working copy)
@@ -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"
;
Index: forth/debugging/fcode.fs
===================================================================
--- forth/debugging/fcode.fs (revision 1045)
+++ forth/debugging/fcode.fs (working copy)
@@ -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< >" -- ??? )
;
More information about the OpenBIOS
mailing list