select-dev and unselect-dev are pre Open Firmware, and 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.
Signed-off-by: Bob Breuer breuerr@mc.net --- forth/admin/devices.fs | 4 ---- forth/debugging/fcode.fs | 22 +++++++++++++++++----- forth/device/pathres.fs | 4 ---- 3 files changed, 17 insertions(+), 13 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,6 @@ 0 active-package! ;
-: unselect-dev ( -- ) - device-end -; - : ?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,33 @@ : headers ( -- ) ;
-: begin-package ( arg-str arg-len reg-str reg-len dev-str dev-len -- ) +\ Open specified device node and make it the current instance. +\ pre Open Firmware, but Sun OBP compatible +: select-dev ( dev-str dev-len -- ) open-dev dup 0= abort" failed opening parent." dup to my-self ihandle>phandle active-package! +; + +: begin-package ( arg-str arg-len reg-str reg-len dev-str dev-len -- ) + select-dev new-device set-args ;
-: end-package ( -- ) - my-parent >r - finish-device +\ Close current node, deselect active package and current instance, +\ leaving no instance selected +\ pre Open Firmware, but Sun OBP compatible +: unselect-dev ( -- ) + my-self close-dev 0 active-package! 0 to my-self - r> close-dev ;
+: end-package ( -- ) + finish-device + unselect-dev +; + : apply ( ... "method-name< >device-specifier< >" -- ??? ) ;
On 02/08/11 16:00, Bob Breuer wrote:
select-dev and unselect-dev are pre Open Firmware, and 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.
Signed-off-by: Bob Breuerbreuerr@mc.net
forth/admin/devices.fs | 4 ---- forth/debugging/fcode.fs | 22 +++++++++++++++++----- forth/device/pathres.fs | 4 ---- 3 files changed, 17 insertions(+), 13 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,6 @@ 0 active-package! ;
-: unselect-dev ( -- )
- device-end
-;
- : ?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,33 @@ : headers ( -- ) ;
-: begin-package ( arg-str arg-len reg-str reg-len dev-str dev-len -- ) +\ Open specified device node and make it the current instance. +\ pre Open Firmware, but Sun OBP compatible +: select-dev ( dev-str dev-len -- ) open-dev dup 0= abort" failed opening parent." dup to my-self ihandle>phandle active-package! +;
+: begin-package ( arg-str arg-len reg-str reg-len dev-str dev-len -- )
- select-dev new-device set-args ;
-: end-package ( -- )
- my-parent>r
- finish-device
+\ Close current node, deselect active package and current instance, +\ leaving no instance selected +\ pre Open Firmware, but Sun OBP compatible +: unselect-dev ( -- )
- my-self close-dev 0 active-package! 0 to my-self
- r> close-dev ;
+: end-package ( -- )
- finish-device
- unselect-dev
+;
- : apply ( ... "method-name< >device-specifier< >" -- ??? ) ;
I've applied this patch locally and tested it on my various SPARC32 images and everything seems to work fine. My only minor niggle is that logically I would expect all of the package words to be in forth/admin/devices.fs rather than forth/debugging/fcode.fs.
However... reading the IEEE 1275 specification once again I found this on page 251 (Section H.8): "The following user interface command names have changed from their pre-Open Firmware versions, with no change in behavior" and select-dev/unselect-dev are listed below. Hmmm. This seems to disagree with the original intent of the patch. Anyone have any further thoughts on this?
ATB,
Mark.
Mark Cave-Ayland wrote:
On 02/08/11 16:00, Bob Breuer wrote:
select-dev and unselect-dev are pre Open Firmware, and 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.
Signed-off-by: Bob Breuerbreuerr@mc.net
forth/admin/devices.fs | 4 ---- forth/debugging/fcode.fs | 22 +++++++++++++++++----- forth/device/pathres.fs | 4 ---- 3 files changed, 17 insertions(+), 13 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,6 @@ 0 active-package! ;
-: unselect-dev ( -- )
- device-end
-;
- : ?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,33 @@ : headers ( -- ) ;
-: begin-package ( arg-str arg-len reg-str reg-len dev-str dev-len -- ) +\ Open specified device node and make it the current instance. +\ pre Open Firmware, but Sun OBP compatible +: select-dev ( dev-str dev-len -- ) open-dev dup 0= abort" failed opening parent." dup to my-self ihandle>phandle active-package! +;
+: begin-package ( arg-str arg-len reg-str reg-len dev-str dev-len -- )
- select-dev new-device set-args ;
-: end-package ( -- )
- my-parent>r
- finish-device
+\ Close current node, deselect active package and current instance, +\ leaving no instance selected +\ pre Open Firmware, but Sun OBP compatible +: unselect-dev ( -- )
- my-self close-dev 0 active-package! 0 to my-self
- r> close-dev ;
+: end-package ( -- )
- finish-device
- unselect-dev
+;
- : apply ( ... "method-name< >device-specifier< >" -- ??? ) ;
I've applied this patch locally and tested it on my various SPARC32 images and everything seems to work fine. My only minor niggle is that logically I would expect all of the package words to be in forth/admin/devices.fs rather than forth/debugging/fcode.fs.
Both begin-package and end-package were already in forth/debugging/fcode.fs. This is mostly just code movement/refactoring so I moved select-dev/unselect-dev to where most of the code already was. Let me know if you want it another way. None of the words that I changed are used anywhere within OpenBIOS itself.
However... reading the IEEE 1275 specification once again I found this on page 251 (Section H.8): "The following user interface command names have changed from their pre-Open Firmware versions, with no change in behavior" and select-dev/unselect-dev are listed below. Hmmm. This seems to disagree with the original intent of the patch. Anyone have any further thoughts on this?
See the errata for section H.8. Also see the "Debugging and Testing Fcode Programs" section of "Writing FCode 3.x Programs" at http://download.oracle.com/docs/cd/E19253-01/806-1379-10/fctest.html#pgfId-3... which shows the simpler OBP definitions for begin-package/end-package along with descriptions of select-dev/unselect-dev. Maybe I should add this extra detail to the patch description and source comments.
Bob
ATB,
Mark.
On 05/08/11 15:29, Bob Breuer wrote:
I've applied this patch locally and tested it on my various SPARC32 images and everything seems to work fine. My only minor niggle is that logically I would expect all of the package words to be in forth/admin/devices.fs rather than forth/debugging/fcode.fs.
Both begin-package and end-package were already in forth/debugging/fcode.fs. This is mostly just code movement/refactoring so I moved select-dev/unselect-dev to where most of the code already was. Let me know if you want it another way. None of the words that I changed are used anywhere within OpenBIOS itself.
However... reading the IEEE 1275 specification once again I found this on page 251 (Section H.8): "The following user interface command names have changed from their pre-Open Firmware versions, with no change in behavior" and select-dev/unselect-dev are listed below. Hmmm. This seems to disagree with the original intent of the patch. Anyone have any further thoughts on this?
See the errata for section H.8. Also see the "Debugging and Testing Fcode Programs" section of "Writing FCode 3.x Programs" at http://download.oracle.com/docs/cd/E19253-01/806-1379-10/fctest.html#pgfId-3... which shows the simpler OBP definitions for begin-package/end-package along with descriptions of select-dev/unselect-dev. Maybe I should add this extra detail to the patch description and source comments.
Ah got it - in the core errata at http://www.openfirmware.com/1275/bindings/errata/12757d4.ps, select-dev and unselect-dev have been removed from this list.
In that case, if you can move the commands from forth/debugging/fcode.fs to forth/admin/devices.fs and update the commit comment to reflect this then I'm happy with the patch.
ATB,
Mark.