diff options
author | Thomas Huth <thuth@linux.vnet.ibm.com> | 2011-12-15 15:41:34 +0100 |
---|---|---|
committer | Thomas Huth <thuth@linux.vnet.ibm.com> | 2011-12-20 17:56:48 +0100 |
commit | 82d381b5cffbeac520b33e2c5f907fd018226696 (patch) | |
tree | 639d4a100d4e60169010a389202e760ae7c03f4f /slof/fs/node.fs | |
parent | 8dc3a137ec8eb9739e1bb9574029c77ecfdee64e (diff) | |
download | SLOF-82d381b5cffbeac520b33e2c5f907fd018226696.zip SLOF-82d381b5cffbeac520b33e2c5f907fd018226696.tar.gz SLOF-82d381b5cffbeac520b33e2c5f907fd018226696.tar.bz2 |
Two minor improvements for the device tree node code
The "open-node" command always tried to execute the "open" method of the node
that should be opened and used CATCH to determine whether the method is
available or not (and assumed success if it is not available). That works fine
as long as the "open" method does not ABORT due to any reason - in that case
the "open" should be considered as failure instead. So the code is now using
"find-method" instead to determine whether the "open" method is available or
not.
Second fix is about "my-unit". According to IEEE1275, this value should be
initialized to the firt component of the "reg" property in case it has not
been specified by other means.
Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Diffstat (limited to 'slof/fs/node.fs')
-rw-r--r-- | slof/fs/node.fs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/slof/fs/node.fs b/slof/fs/node.fs index 2e43d14..76915e9 100644 --- a/slof/fs/node.fs +++ b/slof/fs/node.fs @@ -329,8 +329,9 @@ VARIABLE interpose-node : open-node ( arg len phandle -- ihandle | 0 ) current-node @ >r set-node create-instance set-my-args ( and set unit-addr ) -\ XXX: assume default of success for nodes without open method - s" open" ['] $call-my-method CATCH IF 2drop true THEN + \ Execute "open" method if available, and assume default of + \ success (=TRUE) for nodes without open method: + s" open" get-node find-method IF execute ELSE TRUE THEN 0= IF my-self destroy-instance 0 to my-self THEN my-self my-parent to my-self r> set-node \ Handle interposition. @@ -357,7 +358,12 @@ VARIABLE interpose-node ; : finish-device ( -- ) - ( check for "name" property here, delete this node if not there ) + \ Set unit address to first entry of reg property if it has not been set yet + get-node >space? 0= IF + s" reg" get-node get-property 0= IF + decode-int set-space 2drop + THEN + THEN finish-node my-parent to my-self ; |