1 \ *****************************************************************************
2 \ * Copyright (c) 2004, 2011 IBM Corporation
3 \ * All rights reserved.
4 \ * This program and the accompanying materials
5 \ * are made available under the terms of the BSD License
6 \ * which accompanies this distribution, and is available at
7 \ * http://www.opensource.org/licenses/bsd-license.php
10 \ * IBM Corporation - initial implementation
11 \ ****************************************************************************/
13 s" serial bus [ " type my-space pci-class-name type s" ]" type cr
15 my-space pci-device-generic-setup
26 : usb-setup-hcidev ( num hci-dev -- )
28 10 config-l@ F AND case
29 0 OF 10 config-l@ translate-my-address ENDOF \ 32-bit memory space
30 4 OF \ 64-bit memory space
31 14 config-l@ 20 lshift \ Read two bars
32 10 config-l@ OR translate-my-address
36 ( io-base ) r@ hcd>base !
37 08 config-l@ 8 rshift 0000000F0 AND 4 rshift
38 ( usb-type ) r@ hcd>type !
39 ( usb-num ) r@ hcd>num !
43 \ Handle USB OHCI controllers:
44 : handle-usb-class ( -- )
45 \ set Memory Write and Invalidate Enable, SERR# Enable
46 \ (see PCI 3.0 Spec Chapter 6.2.2 device control):
47 4 config-w@ 110 or 4 config-w!
48 pci-master-enable \ set PCI Bus master bit and
49 pci-mem-enable \ memory space enable for USB scan
52 \ Check PCI sub-class and interface type of Serial Bus Controller
53 \ to include the appropriate driver:
54 : handle-sbc-subclass ( -- )
55 my-space pci-class@ ffff and CASE \ get PCI sub-class and interface
56 0310 OF \ OHCI controller
60 0320 OF \ EHCI controller
64 0330 OF \ XHCI controller