From b47337d34728ed762ba5ea6e4fc5c77ab86dee2f Mon Sep 17 00:00:00 2001 From: Nick Hibma Date: Fri, 3 Dec 1999 01:34:42 +0000 Subject: [PATCH] Fix the 'usb0: USB revision unknown, not supported' people have been seeing by identifying the version in the PCI drivers. The OHCI driver just presets this to 1.0 as it is not specified in the PCI registers anywhere. This should be revisited once USB 2.0 is in wide spread use. --- sys/dev/usb/ohci_pci.c | 3 +++ sys/dev/usb/uhci_pci.c | 25 ++++++++++--------------- sys/dev/usb/usb.c | 2 -- sys/pci/ohci_pci.c | 3 +++ sys/pci/uhci_pci.c | 25 ++++++++++--------------- 5 files changed, 26 insertions(+), 32 deletions(-) diff --git a/sys/dev/usb/ohci_pci.c b/sys/dev/usb/ohci_pci.c index 8d911c8563f2..8e1378b813e5 100644 --- a/sys/dev/usb/ohci_pci.c +++ b/sys/dev/usb/ohci_pci.c @@ -146,6 +146,9 @@ ohci_pci_attach(device_t self) void *ih; int intr; + /* XXX where does it say so in the spec? */ + sc->sc_bus.usbrev = USBREV_1_0; + rid = PCI_CBMEM; res = bus_alloc_resource(self, SYS_RES_MEMORY, &rid, 0, ~0, 1, RF_ACTIVE); diff --git a/sys/dev/usb/uhci_pci.c b/sys/dev/usb/uhci_pci.c index bec8edb5d058..9285174b07c8 100644 --- a/sys/dev/usb/uhci_pci.c +++ b/sys/dev/usb/uhci_pci.c @@ -155,7 +155,6 @@ uhci_pci_attach(device_t self) void *ih; struct resource *res; device_t usbus; - char *typestr; int intr; int legsup; int err; @@ -208,20 +207,16 @@ uhci_pci_attach(device_t self) sprintf(sc->sc_vendor, "(0x%08x)", pci_get_devid(self)); } - if (bootverbose) { - switch(pci_read_config(self, PCI_USBREV, 4) & PCI_USBREV_MASK) { - case PCI_USBREV_PRE_1_0: - typestr = "pre 1.0"; - break; - case PCI_USBREV_1_0: - typestr = "1.0"; - break; - default: - typestr = "unknown"; - break; - } - device_printf(self, "USB version %s, chip rev. %d\n", - typestr, pci_get_revid(self)); + switch(pci_read_config(self, PCI_USBREV, 4) & PCI_USBREV_MASK) { + case PCI_USBREV_PRE_1_0: + sc->sc_bus.usbrev = USBREV_PRE_1_0; + break; + case PCI_USBREV_1_0: + sc->sc_bus.usbrev = USBREV_1_0; + break; + default: + sc->sc_bus.usbrev = USBREV_UNKNOWN; + break; } intr = pci_read_config(self, PCIR_INTLINE, 1); diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c index 9724b3a17fb3..891aca757e66 100644 --- a/sys/dev/usb/usb.c +++ b/sys/dev/usb/usb.c @@ -211,9 +211,7 @@ USB_ATTACH(usb) printf(": USB revision %s", usbrev_str[usbrev]); if (usbrev != USBREV_1_0 && usbrev != USBREV_1_1) { printf(", not supported\n"); -#if BROKEN USB_ATTACH_ERROR_RETURN; -#endif } printf("\n"); diff --git a/sys/pci/ohci_pci.c b/sys/pci/ohci_pci.c index 8d911c8563f2..8e1378b813e5 100644 --- a/sys/pci/ohci_pci.c +++ b/sys/pci/ohci_pci.c @@ -146,6 +146,9 @@ ohci_pci_attach(device_t self) void *ih; int intr; + /* XXX where does it say so in the spec? */ + sc->sc_bus.usbrev = USBREV_1_0; + rid = PCI_CBMEM; res = bus_alloc_resource(self, SYS_RES_MEMORY, &rid, 0, ~0, 1, RF_ACTIVE); diff --git a/sys/pci/uhci_pci.c b/sys/pci/uhci_pci.c index bec8edb5d058..9285174b07c8 100644 --- a/sys/pci/uhci_pci.c +++ b/sys/pci/uhci_pci.c @@ -155,7 +155,6 @@ uhci_pci_attach(device_t self) void *ih; struct resource *res; device_t usbus; - char *typestr; int intr; int legsup; int err; @@ -208,20 +207,16 @@ uhci_pci_attach(device_t self) sprintf(sc->sc_vendor, "(0x%08x)", pci_get_devid(self)); } - if (bootverbose) { - switch(pci_read_config(self, PCI_USBREV, 4) & PCI_USBREV_MASK) { - case PCI_USBREV_PRE_1_0: - typestr = "pre 1.0"; - break; - case PCI_USBREV_1_0: - typestr = "1.0"; - break; - default: - typestr = "unknown"; - break; - } - device_printf(self, "USB version %s, chip rev. %d\n", - typestr, pci_get_revid(self)); + switch(pci_read_config(self, PCI_USBREV, 4) & PCI_USBREV_MASK) { + case PCI_USBREV_PRE_1_0: + sc->sc_bus.usbrev = USBREV_PRE_1_0; + break; + case PCI_USBREV_1_0: + sc->sc_bus.usbrev = USBREV_1_0; + break; + default: + sc->sc_bus.usbrev = USBREV_UNKNOWN; + break; } intr = pci_read_config(self, PCIR_INTLINE, 1);