diff options
author | Thomas Huth <thuth@linux.vnet.ibm.com> | 2011-11-18 16:47:19 +0100 |
---|---|---|
committer | Thomas Huth <thuth@linux.vnet.ibm.com> | 2011-11-24 10:21:56 +0100 |
commit | 0be6560d6589781867a11d3a3847842cf1d9f935 (patch) | |
tree | 568273bcf2e113f18a5948ef944776f0e16df159 | |
parent | a5a2d445918c6157835ff388d6d6358855e675c6 (diff) | |
download | SLOF-0be6560d6589781867a11d3a3847842cf1d9f935.zip SLOF-0be6560d6589781867a11d3a3847842cf1d9f935.tar.gz SLOF-0be6560d6589781867a11d3a3847842cf1d9f935.tar.bz2 |
OHCI: Reworked USB scan code a little bit
Refactored the ohci-scan function a little bit and use the new "extend-device"
function to extend the ohci node properly.
Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
-rw-r--r-- | slof/fs/usb/usb-static.fs | 48 | ||||
-rw-r--r-- | slof/fs/usb/usb-support.fs | 7 |
2 files changed, 35 insertions, 20 deletions
diff --git a/slof/fs/usb/usb-static.fs b/slof/fs/usb/usb-static.fs index 338bb12..a35dbff 100644 --- a/slof/fs/usb/usb-static.fs +++ b/slof/fs/usb/usb-static.fs @@ -116,6 +116,36 @@ FALSE VALUE ext-disk-alias \ first external disk: not yet assigned r> [char] 0 + swap c! ( str len R: ) ; +: ohci-scan-node ( str len -- ) + 2dup find-node ?dup IF + ( str len phandle ) + dup set-node + dup child ?dup IF + delete-node s" Deleting node" usb-debug-print + THEN + \ Check whether usb-ohci.fs has already been included: + s" enumerate" rot find-method IF + drop + \ Create instance for enumeration: + open-dev dup to my-self + s" enumerate" 2 pick $call-method \ Scan host controller + close-dev 0 to my-self + 0 set-node + ELSE + 2drop get-node + dup parent node>path select-dev \ Open parent + extend-device + s" usb-ohci.fs" included + s" open" $call-my-method 0= ABORT" OHCI open failed" + s" enumerate" $call-my-method + s" close" $call-my-method + finish-device + unselect-dev + THEN ( str len R: num ) + ELSE + 2drop + THEN +; \ Scan all USB OHCI host controllers for attached devices: : ohci-scan @@ -139,23 +169,7 @@ FALSE VALUE ext-disk-alias \ first external disk: not yet assigned usb-debug-flag IF ." * Scanning hub " 2dup type ." ..." cr THEN - 2dup find-node ?dup IF ( str len phandle R: num ) - dup set-node - dup child ?dup IF - delete-node s" Deleting node" usb-debug-print - THEN - \ Check whether usb-ohci.fs has already been included: - s" enumerate" rot find-method IF - drop - ELSE - s" usb-ohci.fs" included - THEN ( str len R: num ) - \ Create instance for enumeration: - open-dev dup to my-self - s" enumerate" 2 pick $call-method \ Scan host controller - close-dev 0 to my-self - 0 set-node - THEN ( R: num ) + ohci-scan-node ( R: num ) r> 1+ >r ( R: num+1 ) REPEAT r> drop diff --git a/slof/fs/usb/usb-support.fs b/slof/fs/usb/usb-support.fs index a62c45c..aa85ab9 100644 --- a/slof/fs/usb/usb-support.fs +++ b/slof/fs/usb/usb-support.fs @@ -22,9 +22,10 @@ VARIABLE controlxfer-cmd : (ed-prepare) ( dir addr dlen setup-packet MPS ep-fun -- FALSE | dir addr dlen ed-ptr setup-ptr ) - allocate-ed dup 0= IF ( dir addr dlen setup-packet MPS ep-fun ed-ptr ) - drop 3drop 2drop FALSE EXIT ( FALSE ) - THEN + allocate-ed ?dup 0= IF + s" allocate-ed failed!" usb-debug-print + 4drop 2drop FALSE EXIT ( FALSE ) + THEN ( dir addr dlen setup-packet MPS ep-fun ed-ptr ) TO temp1 ( dir addr dlen setup-packet MPS ep-fun ) temp1 zero-out-an-ed-except-link ( dir addr dlen setup-packet MPS ep-fun ) temp1 ed>eattr l@-le or temp1 ed>eattr l!-le ( dir addr dlen setup-ptr MPS ) |