Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev There is an xHCI device which has USB 2 port only. S...



details:   https://anonhg.NetBSD.org/src/rev/e7f64f12a9b3
branches:  trunk
changeset: 371790:e7f64f12a9b3
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Tue Oct 11 09:18:22 2022 +0000

description:
There is an xHCI device which has USB 2 port only. Support it.

 - Example:

xhci4 at pci17 dev 0 function 0: AMD product 15b8 (rev. 0x00)
xhci4: 64-bit DMA
allocated pic msix10 type edge pin 0 level 6 to cpu0 slot 32 idt entry 107
xhci4: interrupting at msix10 vec 0
xhci4: xHCI version 1.20
xhci4: hcs1=1000840 hcs2=140000f1 hcs3=7000a
xhci4: hcc=0x110ffc5<XECP=0x110,MAXPSA=0xf,CFC,SEC,SPC,PAE,NSS,LTC,CSZ,AC64>
xhci4: xECP 440
xhci4: hcc2=0x3f<CIC,LEC,CTC,FSC,CMC,U3C>
xhci4: ECR: 0x00000401
xhci4: ECR: 0x02000402
xhci4:  SP: 0x02000402 0x20425355 0x00180101 0x00000000
xhci4:  hs ports 1 - 1
xhci4: ECR: 0x000f000a
xhci4: PAGESIZE 0x00000001
xhci4: sc_pgsz 0x00001000
xhci4: sc_maxslots 0x00000040
xhci4: sc_maxports 1
xhci4: sc_maxspbuf 2
xhci4: eventst: 0x000000013ee60fc0 0xffffb08826f5afc0 1000
xhci4: dcbaa: 0x000000013ee63000 0xffffb08826f5b000 1000
xhci4: current IMOD 0
(snip)
usb8 at xhci4: USB revision 3.1
usb9 at xhci4: USB revision 2.0
uhub8 at usb8: NetBSD (0x0000) xHCI root hub (0x0000), class 9/0, rev 3.00/1.00, addr 0
uhub8: 0 ports with 0 removable, self powered
uhub8: no ports, hub ignored
uhub8: WARNING: power management not supported
autoconfiguration error: usb8: root device is not a hub
usb8: WARNING: power management not supported
uhub9 at usb9: NetBSD (0x0000) xHCI root hub (0x0000), class 9/0, rev 2.00/1.00, addr 0
uhub9: 1 port with 1 removable, self powered

 - To resolve this problem, keep number of ports of SS and HS and use
   it to attach child device(s).
 - Tested on ASUS TUF GAMING X670E-PLUS.
 - OK'd by skrll@.

diffstat:

 sys/dev/pci/xhci_pci.c |  13 ++++++++-----
 sys/dev/usb/xhci.c     |   8 ++++++--
 sys/dev/usb/xhcivar.h  |   4 +++-
 3 files changed, 17 insertions(+), 8 deletions(-)

diffs (82 lines):

diff -r da5614b95b45 -r e7f64f12a9b3 sys/dev/pci/xhci_pci.c
--- a/sys/dev/pci/xhci_pci.c    Tue Oct 11 02:58:52 2022 +0000
+++ b/sys/dev/pci/xhci_pci.c    Tue Oct 11 09:18:22 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xhci_pci.c,v 1.30 2021/08/07 16:19:14 thorpej Exp $    */
+/*     $NetBSD: xhci_pci.c,v 1.31 2022/10/11 09:18:22 msaitoh Exp $    */
 /*     OpenBSD: xhci_pci.c,v 1.4 2014/07/12 17:38:51 yuo Exp   */
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xhci_pci.c,v 1.30 2021/08/07 16:19:14 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci_pci.c,v 1.31 2022/10/11 09:18:22 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_xhci_pci.h"
@@ -287,10 +287,13 @@
                aprint_error_dev(self, "couldn't establish power handler\n");
 
        /* Attach usb buses. */
-       sc->sc_child = config_found(self, &sc->sc_bus, usbctlprint, CFARGS_NONE);
+       if (sc->sc_usb3nports != 0)
+               sc->sc_child =
+                   config_found(self, &sc->sc_bus, usbctlprint, CFARGS_NONE);
 
-       sc->sc_child2 = config_found(self, &sc->sc_bus2, usbctlprint,
-           CFARGS_NONE);
+       if (sc->sc_usb2nports != 0)
+               sc->sc_child2 =
+                   config_found(self, &sc->sc_bus2, usbctlprint, CFARGS_NONE);
 
        return;
 
diff -r da5614b95b45 -r e7f64f12a9b3 sys/dev/usb/xhci.c
--- a/sys/dev/usb/xhci.c        Tue Oct 11 02:58:52 2022 +0000
+++ b/sys/dev/usb/xhci.c        Tue Oct 11 09:18:22 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xhci.c,v 1.172 2022/09/25 07:23:07 skrll Exp $ */
+/*     $NetBSD: xhci.c,v 1.173 2022/10/11 09:18:22 msaitoh Exp $       */
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.172 2022/09/25 07:23:07 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.173 2022/10/11 09:18:22 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1214,6 +1214,10 @@
        case 0x0320:
                aprint_debug_dev(sc->sc_dev, " %s ports %d - %d\n",
                    major == 3 ? "ss" : "hs", cpo, cpo + cpc -1);
+               if (major == 3)
+                       sc->sc_usb3nports = cpo + cpc -1;
+               else
+                       sc->sc_usb2nports = cpo + cpc -1;
                break;
        default:
                aprint_error_dev(sc->sc_dev, " unknown major/minor (%d/%d)\n",
diff -r da5614b95b45 -r e7f64f12a9b3 sys/dev/usb/xhcivar.h
--- a/sys/dev/usb/xhcivar.h     Tue Oct 11 02:58:52 2022 +0000
+++ b/sys/dev/usb/xhcivar.h     Tue Oct 11 09:18:22 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xhcivar.h,v 1.21 2022/03/13 11:30:04 riastradh Exp $   */
+/*     $NetBSD: xhcivar.h,v 1.22 2022/10/11 09:18:22 msaitoh Exp $     */
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -112,6 +112,8 @@
         * Port routing and root hub - xHCI 4.19.7
         */
        int sc_maxports;                /* number of controller ports */
+       int sc_usb3nports;
+       int sc_usb2nports;
 
        uint8_t *sc_ctlrportbus;        /* a bus bit per port */
 



Home | Main Index | Thread Index | Old Index