aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Huth <thuth@linux.vnet.ibm.com>2012-02-08 10:48:11 +0100
committerThomas Huth <thuth@linux.vnet.ibm.com>2012-02-14 09:01:46 +0100
commitb46da96a00138915b0aaa84bb2c16a467759205a (patch)
tree7aaaa9c75b061e1ca3f2f8ef1142bcb1e3daf469
parent5ab9ef4e7196d7edbd1f853dbd0887b1082145ba (diff)
downloadSLOF-b46da96a00138915b0aaa84bb2c16a467759205a.zip
SLOF-b46da96a00138915b0aaa84bb2c16a467759205a.tar.gz
SLOF-b46da96a00138915b0aaa84bb2c16a467759205a.tar.bz2
Added a possibility to debug the client interface calls
Set "debug-client-interface?" to TRUE to enable the debug messages. Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
-rw-r--r--slof/fs/client.fs68
1 files changed, 58 insertions, 10 deletions
diff --git a/slof/fs/client.fs b/slof/fs/client.fs
index 28d5684..7ffd506 100644
--- a/slof/fs/client.fs
+++ b/slof/fs/client.fs
@@ -13,6 +13,8 @@
\ Client interface.
+0 VALUE debug-client-interface?
+
\ First, the machinery.
VOCABULARY client-voc \ We store all client-interface callable words here.
@@ -65,7 +67,7 @@ VARIABLE client-callback \ Address of client's callback function
sc-exit OF drop r> drop EXIT ENDOF
sc-yield OF drop r> drop EXIT ENDOF
ENDCASE
- \ Some special call was made but we don't know that to do with it...
+ \ Some special call was made but we don't know that to do with it...
THROW
THEN
stack-to-client-data
@@ -103,7 +105,10 @@ ALSO client-voc DEFINITIONS
: test ( zstr -- missing? )
\ XXX: Should only look in client-voc...
- zcount
+ zcount
+ debug-client-interface? IF
+ ." ci: test " 2dup type cr
+ THEN
ALSO client-voc $find PREVIOUS IF
drop FALSE
ELSE
@@ -112,7 +117,12 @@ ALSO client-voc DEFINITIONS
;
: finddevice ( zstr -- phandle )
- zcount find-node dup 0= IF drop -1 THEN ;
+ zcount
+ debug-client-interface? IF
+ ." ci: finddevice " 2dup type cr
+ THEN
+ find-node dup 0= IF drop -1 THEN
+;
: getprop ( phandle zstr buf len -- len' )
>r >r zcount rot get-property
@@ -140,8 +150,20 @@ ALSO client-voc DEFINITIONS
: nextprop ( phandle zstr buf -- flag ) \ -1 invalid, 0 end, 1 ok
>r zcount rot next-property IF r> zplace 1 ELSE r> drop 0 THEN ;
-: open ( zstr -- ihandle ) zcount open-dev ;
-: close ( ihandle -- ) close-dev ;
+: open ( zstr -- ihandle )
+ zcount
+ debug-client-interface? IF
+ ." ci: open " 2dup type cr
+ THEN
+ open-dev
+;
+
+: close ( ihandle -- )
+ debug-client-interface? IF
+ ." ci: close " dup . cr
+ THEN
+ close-dev
+;
\ Now implemented: should return -1 if no such method exists in that node
: write ( ihandle str len -- len' ) rot s" write" rot
@@ -153,6 +175,9 @@ ALSO client-voc DEFINITIONS
\ A real claim implementation: 3.2% memory fat :-)
: claim ( addr len align -- base )
+ debug-client-interface? IF
+ ." ci: claim " .s cr
+ THEN
dup IF rot drop
['] claim CATCH IF 2drop -1 THEN
ELSE
@@ -160,7 +185,12 @@ ALSO client-voc DEFINITIONS
THEN
;
-: release ( addr len -- ) release ;
+: release ( addr len -- )
+ debug-client-interface? IF
+ ." ci: release " .s cr
+ THEN
+ release
+;
: instance-to-package ( ihandle -- phandle )
ihandle>phandle ;
@@ -173,15 +203,25 @@ ALSO client-voc DEFINITIONS
2>r instance>qpath 2r> string-to-buffer ;
: call-method ( str ihandle arg ... arg -- result return ... return )
- nargs flip-stack zcount rot ['] $call-method CATCH
+ nargs flip-stack zcount
+ debug-client-interface? IF
+ ." ci: call-method " 2dup type cr
+ THEN
+ rot ['] $call-method CATCH
nrets 0= IF drop ELSE \ if called with 0 return args do not return the catch result
dup IF nrets 1 ?DO -444 LOOP THEN
nrets flip-stack
- THEN ;
+ THEN
+;
\ From the PAPR.
: test-method ( phandle str -- missing? )
- zcount rot find-method dup IF nip THEN 0= ;
+ zcount
+ debug-client-interface? IF
+ ." ci: test-method " 2dup type cr
+ THEN
+ rot find-method dup IF nip THEN 0=
+;
: milliseconds milliseconds ;
@@ -195,6 +235,9 @@ ALSO client-voc DEFINITIONS
\ Quiesce firmware and assert that all hardware is in a sane state
\ (e.g. assert that no background DMA is running anymore)
: quiesce ( -- )
+ debug-client-interface? IF
+ ." ci: quiesce" cr
+ THEN
\ The main quiesce call is defined in quiesce.fs
quiesce
;
@@ -203,7 +246,12 @@ ALSO client-voc DEFINITIONS
\ User Interface, defined in 6.3.2.6
\
: interpret ( ... zstr -- result ... )
- zcount ['] evaluate CATCH ;
+ zcount
+ debug-client-interface? IF
+ ." ci: interpret " 2dup type cr
+ THEN
+ ['] evaluate CATCH
+;
\ Allow the client to register a callback
: set-callback ( newfunc -- oldfunc )