Propagate the USB revision number to the usb driver.

This commit is contained in:
augustss 1999-11-20 00:57:08 +00:00
parent 046d593425
commit 7b92ed07bd
5 changed files with 37 additions and 12 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: uhci_pci.c,v 1.12 1999/10/12 11:21:24 augustss Exp $ */
/* $NetBSD: uhci_pci.c,v 1.13 1999/11/20 00:57:08 augustss Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -100,7 +100,7 @@ uhci_pci_attach(parent, self, aux)
char const *intrstr;
pci_intr_handle_t ih;
pcireg_t csr;
char *typestr, *vendor;
char *vendor;
char *devname = sc->sc.sc_bus.bdev.dv_xname;
char devinfo[256];
usbd_status r;
@ -145,16 +145,18 @@ uhci_pci_attach(parent, self, aux)
switch(pci_conf_read(pc, pa->pa_tag, PCI_USBREV) & PCI_USBREV_MASK) {
case PCI_USBREV_PRE_1_0:
typestr = "pre 1.0";
sc->sc.sc_bus.usbrev = USBREV_PRE_1_0;
break;
case PCI_USBREV_1_0:
typestr = "1.0";
sc->sc.sc_bus.usbrev = USBREV_1_0;
break;
case PCI_USBREV_1_1:
sc->sc.sc_bus.usbrev = USBREV_1_1;
break;
default:
typestr = "unknown";
sc->sc.sc_bus.usbrev = USBREV_UNKNOWN;
break;
}
printf("%s: USB version %s\n", devname, typestr);
/* Figure out vendor for root hub descriptor. */
vendor = pci_findvendor(pa->pa_id);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ohci.c,v 1.55 1999/11/18 23:32:26 augustss Exp $ */
/* $NetBSD: ohci.c,v 1.56 1999/11/20 00:57:09 augustss Exp $ */
/* $FreeBSD: src/sys/dev/usb/ohci.c,v 1.22 1999/11/17 22:33:40 n_hibma Exp $ */
/*
@ -524,20 +524,22 @@ ohci_init(sc)
u_int32_t s, ctl, ival, hcr, fm, per;
DPRINTF(("ohci_init: start\n"));
rev = OREAD4(sc, OHCI_REVISION);
#if defined(__OpenBSD__)
printf(",");
#else
printf("%s:", USBDEVNAME(sc->sc_bus.bdev));
#endif
rev = OREAD4(sc, OHCI_REVISION);
printf(" OHCI version %d.%d%s\n", OHCI_REV_HI(rev), OHCI_REV_LO(rev),
OHCI_REV_LEGACY(rev) ? ", legacy support" : "");
if (OHCI_REV_HI(rev) != 1 || OHCI_REV_LO(rev) != 0) {
printf("%s: unsupported OHCI revision\n",
USBDEVNAME(sc->sc_bus.bdev));
sc->sc_bus.usbrev = USBREV_UNKNOWN;
return (USBD_INVAL);
}
sc->sc_bus.usbrev = USBREV_1_0;
for (i = 0; i < OHCI_HASH_SIZE; i++)
LIST_INIT(&sc->sc_hash_tds[i]);

View File

@ -1,4 +1,4 @@
/* $NetBSD: uhcireg.h,v 1.8 1999/11/18 23:32:28 augustss Exp $ */
/* $NetBSD: uhcireg.h,v 1.9 1999/11/20 00:57:09 augustss Exp $ */
/* $FreeBSD: src/sys/dev/usb/uhcireg.h,v 1.12 1999/11/17 22:33:42 n_hibma Exp $ */
/*
@ -47,6 +47,7 @@
#define PCI_USBREV_MASK 0xff
#define PCI_USBREV_PRE_1_0 0x00
#define PCI_USBREV_1_0 0x10
#define PCI_USBREV_1_1 0x11
#define PCI_LEGSUP 0xc0 /* Legacy Support register */
#define PCI_LEGSUP_USBPIRQDEN 0x2000 /* USB PIRQ D Enable */

View File

@ -1,4 +1,4 @@
/* $NetBSD: usb.c,v 1.30 1999/11/18 23:32:30 augustss Exp $ */
/* $NetBSD: usb.c,v 1.31 1999/11/20 00:57:09 augustss Exp $ */
/* $FreeBSD: src/sys/dev/usb/usb.c,v 1.20 1999/11/17 22:33:46 n_hibma Exp $ */
/*
@ -164,6 +164,8 @@ static int usb_get_next_event __P((struct usb_event *));
extern int cold;
#endif
static const char *usbrev_str[] = USBREV_STR;
USB_DECLARE_DRIVER(usb);
USB_MATCH(usb)
@ -182,6 +184,7 @@ USB_ATTACH(usb)
#endif
usbd_device_handle dev;
usbd_status err;
int usbrev;
#if defined(__NetBSD__) || defined(__OpenBSD__)
printf("\n");
@ -190,13 +193,23 @@ USB_ATTACH(usb)
#endif
DPRINTF(("usbd_attach\n"));
usbd_init();
sc->sc_bus = aux;
sc->sc_bus->usbctl = sc;
sc->sc_port.power = USB_MAX_POWER;
usbrev = sc->sc_bus->usbrev;
printf("%s: USB revision %s", USBDEVNAME(sc->sc_dev),
usbrev_str[usbrev]);
if (usbrev != USBREV_1_0 && usbrev != USBREV_1_1) {
printf(", not supported\n");
USB_ATTACH_ERROR_RETURN;
} else
printf("\n");
err = usbd_new_device(USBDEV(sc->sc_dev), sc->sc_bus, 0, 0, 0,
&sc->sc_port);
if (!err) {
dev = sc->sc_port.device;
if (dev->hub == NULL) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: usbdivar.h,v 1.41 1999/11/18 23:32:37 augustss Exp $ */
/* $NetBSD: usbdivar.h,v 1.42 1999/11/20 00:57:10 augustss Exp $ */
/* $FreeBSD: src/sys/dev/usb/usbdivar.h,v 1.11 1999/11/17 22:33:51 n_hibma Exp $ */
/*
@ -101,6 +101,13 @@ struct usbd_bus {
struct usb_device_stats stats;
int intr_context;
u_int no_intrs;
int usbrev; /* USB revision */
#define USBREV_UNKNOWN 0
#define USBREV_PRE_1_0 1
#define USBREV_1_0 2
#define USBREV_1_1 3
#define USBREV_STR { "unknown", "pre 1.0", "1.0", "1.1" }
#if defined(__NetBSD__) || defined(__OpenBSD__)
bus_dma_tag_t dmatag; /* DMA tag */
#endif