Make ehci deal with pci devices that have multiple companion functions and
ehci functions. We can't assume that there will only be one ehci per device. The existing code could not deal with: Netmos MCS9990 Quad USB 2.0 Port (USB serial bus, interface 0x10) at pci1 dev 0 function 0 not configured Netmos MCS9990 Quad USB 2.0 Port (USB serial bus, interface 0x20) at pci1 dev 0 function 1 not configured Netmos MCS9990 Quad USB 2.0 Port (USB serial bus, interface 0x10) at pci1 dev 0 function 2 not configured Netmos MCS9990 Quad USB 2.0 Port (USB serial bus, interface 0x20) at pci1 dev 0 function 3 not configured Netmos MCS9990 Quad USB 2.0 Port (USB serial bus, interface 0x10) at pci1 dev 0 function 4 not configured Netmos MCS9990 Quad USB 2.0 Port (USB serial bus, interface 0x20) at pci1 dev 0 function 5 not configured Netmos MCS9990 Quad USB 2.0 Port (USB serial bus, interface 0x10) at pci1 dev 0 function 6 not configured Netmos MCS9990 Quad USB 2.0 Port (USB serial bus, interface 0x20) at pci1 dev 0 function 7 not configured
This commit is contained in:
parent
c25d92f48d
commit
3becbb1c42
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ehci_pci.c,v 1.49 2010/05/25 08:37:10 pgoyette Exp $ */
|
||||
/* $NetBSD: ehci_pci.c,v 1.50 2010/12/11 17:58:41 matt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
|
||||
|
@ -30,7 +30,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ehci_pci.c,v 1.49 2010/05/25 08:37:10 pgoyette Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ehci_pci.c,v 1.50 2010/12/11 17:58:41 matt Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -231,13 +231,17 @@ ehci_pci_attach(device_t parent, device_t self, void *aux)
|
|||
* Find companion controllers. According to the spec they always
|
||||
* have lower function numbers so they should be enumerated already.
|
||||
*/
|
||||
const u_int maxncomp = EHCI_HCS_N_CC(EREAD4(&sc->sc, EHCI_HCSPARAMS));
|
||||
KASSERT(maxncomp <= EHCI_COMPANION_MAX);
|
||||
ncomp = 0;
|
||||
TAILQ_FOREACH(up, &ehci_pci_alldevs, next) {
|
||||
if (up->bus == pa->pa_bus && up->device == pa->pa_device) {
|
||||
if (up->bus == pa->pa_bus && up->device == pa->pa_device
|
||||
&& !up->claimed) {
|
||||
DPRINTF(("ehci_pci_attach: companion %s\n",
|
||||
device_xname(up->usb)));
|
||||
sc->sc.sc_comps[ncomp++] = up->usb;
|
||||
if (ncomp >= EHCI_COMPANION_MAX)
|
||||
up->claimed = true;
|
||||
if (ncomp == maxncomp)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: usb_pci.h,v 1.5 2008/04/28 20:23:55 martin Exp $ */
|
||||
/* $NetBSD: usb_pci.h,v 1.6 2010/12/11 17:58:41 matt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
|
||||
|
@ -41,6 +41,7 @@ struct usb_pci {
|
|||
u_int device;
|
||||
u_int function;
|
||||
device_t usb;
|
||||
bool claimed;
|
||||
};
|
||||
|
||||
TAILQ_HEAD(usb_pci_alldevs, usb_pci);
|
||||
|
|
Loading…
Reference in New Issue