Add new USB code
* Create usb directory * Remove compilation of slof-usb code * Generalize pci-class_0c.fs * Add usb-static.fs with alias and dummy usb-scan Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Acked-by: Thomas Huth <thuth@linux.vnet.ibm.com>
This commit is contained in:
parent
beb8512fec
commit
3c7febb48f
|
@ -14,7 +14,7 @@ BOARD_TARGETS = tools_build romfs_build clients_build netdrivers stage1 subdirs
|
|||
|
||||
SUBDIRS = slof veth virtio-net
|
||||
|
||||
COMMON_LIBS = libc libbootmsg libbases libnvram libelf libhvcall libvirtio
|
||||
COMMON_LIBS = libc libbootmsg libbases libnvram libelf libhvcall libvirtio libusb
|
||||
|
||||
all: $(BOARD_TARGETS)
|
||||
$(MAKE) boot_rom.bin
|
||||
|
|
|
@ -14,23 +14,31 @@ s" serial bus [ " type my-space pci-class-name type s" ]" type cr
|
|||
|
||||
my-space pci-device-generic-setup
|
||||
|
||||
|
||||
\ Handle USB OHCI controllers:
|
||||
: handle-usb-ohci-class ( -- )
|
||||
: handle-usb-class ( -- )
|
||||
\ set Memory Write and Invalidate Enable, SERR# Enable
|
||||
\ (see PCI 3.0 Spec Chapter 6.2.2 device control):
|
||||
4 config-w@ 110 or 4 config-w!
|
||||
pci-master-enable \ set PCI Bus master bit and
|
||||
pci-mem-enable \ memory space enable for USB scan
|
||||
\ Create an alias for this controller:
|
||||
set-ohci-alias
|
||||
;
|
||||
|
||||
\ Check PCI sub-class and interface type of Serial Bus Controller
|
||||
\ to include the appropriate driver:
|
||||
: handle-sbc-subclass ( -- )
|
||||
my-space pci-class@ ffff and CASE \ get PCI sub-class and interface
|
||||
0310 OF handle-usb-ohci-class ENDOF \ USB OHCI controller
|
||||
my-space pci-class@ ffff and CASE \ get PCI sub-class and interface
|
||||
0310 OF \ OHCI controller
|
||||
handle-usb-class
|
||||
set-ohci-alias
|
||||
ENDOF
|
||||
0320 OF \ EHCI controller
|
||||
handle-usb-class
|
||||
set-ehci-alias
|
||||
ENDOF
|
||||
0330 OF \ XHCI controller
|
||||
handle-usb-class
|
||||
set-xhci-alias
|
||||
ENDOF
|
||||
ENDCASE
|
||||
;
|
||||
|
||||
|
|
|
@ -9,5 +9,36 @@
|
|||
\ * Contributors:
|
||||
\ * IBM Corporation - initial implementation
|
||||
\ ****************************************************************************/
|
||||
: usb-scan
|
||||
|
||||
\ register device alias
|
||||
: do-alias-setting ( num name-str name-len )
|
||||
rot $cathex strdup \ create alias name
|
||||
get-node node>path \ get path string
|
||||
set-alias \ and set the alias
|
||||
;
|
||||
|
||||
0 VALUE ohci-alias-num
|
||||
0 VALUE ehci-alias-num
|
||||
0 VALUE xhci-alias-num
|
||||
|
||||
\ create a new ohci device alias for the current node
|
||||
: set-ohci-alias ( -- )
|
||||
ohci-alias-num dup 1+ TO ohci-alias-num ( num )
|
||||
s" ohci" do-alias-setting
|
||||
;
|
||||
|
||||
\ create a new ehci device alias for the current node
|
||||
: set-ehci-alias ( -- )
|
||||
ehci-alias-num dup 1+ TO ehci-alias-num ( num )
|
||||
s" ehci" do-alias-setting
|
||||
;
|
||||
|
||||
\ create a new xhci device alias for the current node
|
||||
: set-xhci-alias ( -- )
|
||||
xhci-alias-num dup 1+ TO xhci-alias-num ( num )
|
||||
s" xhci" do-alias-setting
|
||||
;
|
||||
|
||||
: usb-scan ( -- )
|
||||
." Scanning USB " cr
|
||||
;
|
||||
|
|
Loading…
Reference in New Issue