aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2013-08-05 10:56:23 +1000
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2013-08-06 16:00:30 +1000
commit4bb998db00206d32193011e7c0357e6a81578469 (patch)
tree425877f8108e4e8069274b2ba0956cc37fcc0ac0
parent63b072735e6f307cf24dc29261b37755bf984e8e (diff)
downloadSLOF-4bb998db00206d32193011e7c0357e6a81578469.zip
SLOF-4bb998db00206d32193011e7c0357e6a81578469.tar.gz
SLOF-4bb998db00206d32193011e7c0357e6a81578469.tar.bz2
Fix $cat-instance-unit
We were incorrectly checking ig instance>#units was 0 (forgot to actually load the value before testing it) and then didn't properly fallback to printing the node unit in that case. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r--slof/fs/node.fs16
1 files changed, 15 insertions, 1 deletions
diff --git a/slof/fs/node.fs b/slof/fs/node.fs
index 81a741f..73aa75c 100644
--- a/slof/fs/node.fs
+++ b/slof/fs/node.fs
@@ -13,6 +13,8 @@
\ Device nodes.
+false VALUE debug-find-component?
+
VARIABLE device-tree
VARIABLE current-node
: get-node current-node @ dup 0= ABORT" No active device tree node" ;
@@ -218,7 +220,11 @@ CREATE $indent 100 allot VARIABLE indent 0 indent !
: $cat-instance-unit
dup parent 0= IF drop EXIT THEN
- dup instance>#units 0= IF drop EXIT THEN
+ \ No instance unit, use node unit
+ dup instance>#units @ 0= IF
+ ihandle>phandle $cat-unit
+ EXIT
+ THEN
dup >r push-my-self
['] my-unit CATCH IF pop-my-self r> drop EXIT THEN
pop-my-self
@@ -529,6 +535,7 @@ CREATE search-unit 4 cells allot
\ XXX This is an old hack that allows wildcard nodes to work
\ by not having a #address-cells in the parent and no
\ decode unit. This should be removed.
+\ (It appears to be still used on js2x)
: set-instance-unit ( unitaddr len -- )
dup 0= IF 2drop 0 to user-instance-#units EXIT THEN
2dup 0 -rot bounds ?DO
@@ -548,7 +555,14 @@ CREATE search-unit 4 cells allot
;
: find-component ( path len -- path' len' args len node|0 )
+ debug-find-component? IF
+ ." find-component for " 2dup type cr
+ THEN
split-component ( path'. args. name. unit. )
+ debug-find-component? IF
+ ." -> unit =" 2dup type cr
+ ." -> stack =" .s cr
+ THEN
['] set-search-unit CATCH IF
\ XXX: See comment in set-instance-unit
." WARNING: Obsolete old wildcard hack " .s cr