Pull up the following revisions, requested by msaitoh in ticket #1787:

sys/dev/pci/xhci_pci.c				1.31 via patch
	sys/dev/usb/xhci.c				1.173-1.175
	sys/dev/usb/xhcivar.h				1.22

Support xHCI device which has USB 2 port only.
This commit is contained in:
martin 2023-01-23 12:10:12 +00:00
parent 17fb3867b4
commit 102035218e
3 changed files with 20 additions and 10 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: xhci_pci.c,v 1.8.6.3 2019/11/16 16:30:09 martin Exp $ */
/* $NetBSD: xhci_pci.c,v 1.8.6.4 2023/01/23 12:10:12 martin 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.8.6.3 2019/11/16 16:30:09 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: xhci_pci.c,v 1.8.6.4 2023/01/23 12:10:12 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -245,9 +245,11 @@ xhci_pci_attach(device_t parent, device_t self, void *aux)
aprint_error_dev(self, "couldn't establish power handler\n");
/* Attach usb buses. */
sc->sc_child = config_found(self, &sc->sc_bus, usbctlprint);
if (sc->sc_usb3nports != 0)
sc->sc_child = config_found(self, &sc->sc_bus, usbctlprint);
sc->sc_child2 = config_found(self, &sc->sc_bus2, usbctlprint);
if (sc->sc_usb2nports != 0)
sc->sc_child2 = config_found(self, &sc->sc_bus2, usbctlprint);
return;

View File

@ -1,4 +1,4 @@
/* $NetBSD: xhci.c,v 1.72.2.13 2022/09/16 18:34:20 martin Exp $ */
/* $NetBSD: xhci.c,v 1.72.2.14 2023/01/23 12:10:12 martin Exp $ */
/*
* Copyright (c) 2013 Jonathan A. Kollasch
@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.72.2.13 2022/09/16 18:34:20 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.72.2.14 2023/01/23 12:10:12 martin Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@ -783,7 +783,11 @@ xhci_id_protocols(struct xhci_softc *sc, bus_size_t ecp)
case 0x0310:
case 0x0320:
aprint_debug_dev(sc->sc_dev, " %s ports %d - %d\n",
major == 3 ? "ss" : "hs", cpo, cpo + cpc -1);
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_debug_dev(sc->sc_dev, " unknown major/minor (%d/%d)\n",
@ -987,11 +991,13 @@ xhci_init(struct xhci_softc *sc)
/* default all ports to bus 0, i.e. usb 3 */
sc->sc_ctlrportbus = kmem_zalloc(
howmany(sc->sc_maxports * sizeof(uint8_t), NBBY), KM_SLEEP);
sc->sc_ctlrportmap = kmem_zalloc(sc->sc_maxports * sizeof(int), KM_SLEEP);
sc->sc_ctlrportmap =
kmem_zalloc(sc->sc_maxports * sizeof(int), KM_SLEEP);
/* controller port to bus roothub port map */
for (size_t j = 0; j < __arraycount(sc->sc_rhportmap); j++) {
sc->sc_rhportmap[j] = kmem_zalloc(sc->sc_maxports * sizeof(int), KM_SLEEP);
sc->sc_rhportmap[j] =
kmem_zalloc(sc->sc_maxports * sizeof(int), KM_SLEEP);
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: xhcivar.h,v 1.7.6.1 2018/08/25 11:29:52 martin Exp $ */
/* $NetBSD: xhcivar.h,v 1.7.6.2 2023/01/23 12:10:12 martin Exp $ */
/*
* Copyright (c) 2013 Jonathan A. Kollasch
@ -100,6 +100,8 @@ struct xhci_softc {
* 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 */