| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: xhci.c,v 1.68 2017/01/19 16:05:00 skrll Exp $ */ | | 1 | /* $NetBSD: xhci.c,v 1.69 2017/01/19 20:35:44 skrll Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2013 Jonathan A. Kollasch | | 4 | * Copyright (c) 2013 Jonathan A. Kollasch |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -24,27 +24,27 @@ | | | @@ -24,27 +24,27 @@ |
24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | | 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
25 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | | 25 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
26 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | 26 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | */ | | 27 | */ |
28 | | | 28 | |
29 | /* | | 29 | /* |
30 | * USB rev 2.0 and rev 3.1 specification | | 30 | * USB rev 2.0 and rev 3.1 specification |
31 | * http://www.usb.org/developers/docs/ | | 31 | * http://www.usb.org/developers/docs/ |
32 | * xHCI rev 1.1 specification | | 32 | * xHCI rev 1.1 specification |
33 | * http://www.intel.com/technology/usb/spec.htm | | 33 | * http://www.intel.com/technology/usb/spec.htm |
34 | */ | | 34 | */ |
35 | | | 35 | |
36 | #include <sys/cdefs.h> | | 36 | #include <sys/cdefs.h> |
37 | __KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.68 2017/01/19 16:05:00 skrll Exp $"); | | 37 | __KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.69 2017/01/19 20:35:44 skrll Exp $"); |
38 | | | 38 | |
39 | #ifdef _KERNEL_OPT | | 39 | #ifdef _KERNEL_OPT |
40 | #include "opt_usb.h" | | 40 | #include "opt_usb.h" |
41 | #endif | | 41 | #endif |
42 | | | 42 | |
43 | #include <sys/param.h> | | 43 | #include <sys/param.h> |
44 | #include <sys/systm.h> | | 44 | #include <sys/systm.h> |
45 | #include <sys/kernel.h> | | 45 | #include <sys/kernel.h> |
46 | #include <sys/kmem.h> | | 46 | #include <sys/kmem.h> |
47 | #include <sys/device.h> | | 47 | #include <sys/device.h> |
48 | #include <sys/select.h> | | 48 | #include <sys/select.h> |
49 | #include <sys/proc.h> | | 49 | #include <sys/proc.h> |
50 | #include <sys/queue.h> | | 50 | #include <sys/queue.h> |
| @@ -803,27 +803,27 @@ xhci_id_protocols(struct xhci_softc *sc, | | | @@ -803,27 +803,27 @@ xhci_id_protocols(struct xhci_softc *sc, |
803 | sc->sc_ctlrportmap[cp] = rhp + 1; | | 803 | sc->sc_ctlrportmap[cp] = rhp + 1; |
804 | } | | 804 | } |
805 | } | | 805 | } |
806 | | | 806 | |
807 | /* Process extended capabilities */ | | 807 | /* Process extended capabilities */ |
808 | static void | | 808 | static void |
809 | xhci_ecp(struct xhci_softc *sc, uint32_t hcc) | | 809 | xhci_ecp(struct xhci_softc *sc, uint32_t hcc) |
810 | { | | 810 | { |
811 | XHCIHIST_FUNC(); XHCIHIST_CALLED(); | | 811 | XHCIHIST_FUNC(); XHCIHIST_CALLED(); |
812 | | | 812 | |
813 | bus_size_t ecp = XHCI_HCC_XECP(hcc) * 4; | | 813 | bus_size_t ecp = XHCI_HCC_XECP(hcc) * 4; |
814 | while (ecp != 0) { | | 814 | while (ecp != 0) { |
815 | uint32_t ecr = xhci_read_4(sc, ecp); | | 815 | uint32_t ecr = xhci_read_4(sc, ecp); |
816 | aprint_debug_dev(sc->sc_dev, "ECR %lx: %08x\n", ecp, ecr); | | 816 | aprint_debug_dev(sc->sc_dev, "ECR: 0x%08x\n", ecr); |
817 | switch (XHCI_XECP_ID(ecr)) { | | 817 | switch (XHCI_XECP_ID(ecr)) { |
818 | case XHCI_ID_PROTOCOLS: { | | 818 | case XHCI_ID_PROTOCOLS: { |
819 | xhci_id_protocols(sc, ecp); | | 819 | xhci_id_protocols(sc, ecp); |
820 | break; | | 820 | break; |
821 | } | | 821 | } |
822 | case XHCI_ID_USB_LEGACY: { | | 822 | case XHCI_ID_USB_LEGACY: { |
823 | uint8_t bios_sem; | | 823 | uint8_t bios_sem; |
824 | | | 824 | |
825 | /* Take host controller ownership from BIOS */ | | 825 | /* Take host controller ownership from BIOS */ |
826 | bios_sem = xhci_read_1(sc, ecp + XHCI_XECP_BIOS_SEM); | | 826 | bios_sem = xhci_read_1(sc, ecp + XHCI_XECP_BIOS_SEM); |
827 | if (bios_sem) { | | 827 | if (bios_sem) { |
828 | /* sets xHCI to be owned by OS */ | | 828 | /* sets xHCI to be owned by OS */ |
829 | xhci_write_1(sc, ecp + XHCI_XECP_OS_SEM, 1); | | 829 | xhci_write_1(sc, ecp + XHCI_XECP_OS_SEM, 1); |