[OpenBIOS] [PATCH] make select-dev and unselect-dev compatible with OBP

Mark Cave-Ayland mark.cave-ayland at siriusit.co.uk
Fri Aug 5 14:52:47 CEST 2011


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 Breuer<breuerr at 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 - Senior Technical Architect
PostgreSQL - PostGIS
Sirius Corporation plc - control through freedom
http://www.siriusit.co.uk
t: +44 870 608 0063

Sirius Labs: http://www.siriusit.co.uk/labs



More information about the OpenBIOS mailing list