diff --git a/board-qemu/Makefile b/board-qemu/Makefile index 6072a86..9826557 100644 --- a/board-qemu/Makefile +++ b/board-qemu/Makefile @@ -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 diff --git a/lib/libusb/Makefile b/lib/libusb/Makefile new file mode 100644 index 0000000..e69de29 diff --git a/slof/fs/devices/pci-class_0c.fs b/slof/fs/devices/pci-class_0c.fs index 89a9f0d..07da226 100644 --- a/slof/fs/devices/pci-class_0c.fs +++ b/slof/fs/devices/pci-class_0c.fs @@ -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 ; diff --git a/slof/fs/usb/usb-static.fs b/slof/fs/usb/usb-static.fs index 5a941e6..9d40fc0 100644 --- a/slof/fs/usb/usb-static.fs +++ b/slof/fs/usb/usb-static.fs @@ -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 ;