Cache phandle of /chosen

We constantly access /chosen, among other in the console I/O routines
so instead of doing a path walk every time, cache the phandle

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
This commit is contained in:
Benjamin Herrenschmidt 2013-08-05 10:55:17 +10:00
parent ec5c9e8bf4
commit 63b072735e
1 changed files with 10 additions and 2 deletions

View File

@ -19,11 +19,19 @@ defer client-exec
defer callback
defer continue-client
0 VALUE chosen-node
: chosen
chosen-node dup 0= IF
drop s" /chosen" find-node dup to chosen-node
THEN
;
: set-chosen ( prop len name len -- )
s" /chosen" find-node set-property ;
chosen set-property ;
: get-chosen ( name len -- [ prop len ] success )
s" /chosen" find-node get-property 0= ;
chosen get-property 0= ;
\ Look for an exising root, create one if needed
" /" find-node dup 0= IF