diff options
author | Aaron Campbell <aaron@cvs.openbsd.org> | 2001-01-28 09:43:44 +0000 |
---|---|---|
committer | Aaron Campbell <aaron@cvs.openbsd.org> | 2001-01-28 09:43:44 +0000 |
commit | 068c901929c8e128152d9695e219c78a5c15d162 (patch) | |
tree | 2d13c329b2bb4222759f39870f2dbeb46cd477a5 /sys/dev/usb/uhci.c | |
parent | c4aeeb204ccb14898a9115b35ae590f15a16124f (diff) |
Another USB sync with NetBSD. We are still lacking an up-to-date umass(4)
driver. I would appreciate it if someone with the hardware looked into it.
I also have to take a closer look at changes to the USB Ethernet drivers,
as well as import some drivers we are missing (uftdi, if_upl, yap, etc.)
Diffstat (limited to 'sys/dev/usb/uhci.c')
-rw-r--r-- | sys/dev/usb/uhci.c | 52 |
1 files changed, 39 insertions, 13 deletions
diff --git a/sys/dev/usb/uhci.c b/sys/dev/usb/uhci.c index faa0dfec7fd..e626229beeb 100644 --- a/sys/dev/usb/uhci.c +++ b/sys/dev/usb/uhci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uhci.c,v 1.17 2000/12/11 04:23:20 ho Exp $ */ +/* $OpenBSD: uhci.c,v 1.18 2001/01/28 09:43:41 aaron Exp $ */ /* $NetBSD: uhci.c,v 1.125 2000/09/23 21:00:10 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $ */ @@ -43,8 +43,8 @@ * USB Universal Host Controller driver. * Handles e.g. PIIX3 and PIIX4. * - * UHCI spec: http://www.intel.com/design/usb/uhci11d.pdf - * USB spec: http://www.usb.org/developers/data/usb11.pdf + * UHCI spec: http://developer.intel.com/design/USB/UHCI11D.htm + * USB spec: http://www.usb.org/developers/data/usbspec.zip * PIIXn spec: ftp://download.intel.com/design/intarch/datashts/29055002.pdf * ftp://download.intel.com/design/intarch/datashts/29056201.pdf */ @@ -110,6 +110,20 @@ int uhcinoloop = 0; #define DPRINTFN(n,x) #endif +/* + * The UHCI controller is little endian, so on big endian machines + * the data strored in memory needs to be swapped. + */ +#if defined(__FreeBSD__) +#if BYTE_ORDER == BIG_ENDIAN +#define htole32(x) (bswap32(x)) +#define le32toh(x) (bswap32(x)) +#else +#define htole32(x) (x) +#define le32toh(x) (x) +#endif +#endif + struct uhci_pipe { struct usbd_pipe pipe; int nexttoggle; @@ -681,7 +695,9 @@ uhci_power(int why, void *v) DPRINTF(("uhci_power: sc=%p, why=%d (was %d), cmd=0x%x\n", sc, why, sc->sc_suspend, cmd)); - if (why != PWR_RESUME) { + switch (why) { + case PWR_SUSPEND: + case PWR_STANDBY: #ifdef UHCI_DEBUG if (uhcidebug > 2) uhci_dumpregs(sc); @@ -701,7 +717,8 @@ uhci_power(int why, void *v) sc->sc_suspend = why; sc->sc_bus.use_polling--; DPRINTF(("uhci_power: cmd=0x%x\n", UREAD2(sc, UHCI_CMD))); - } else { + break; + case PWR_RESUME: #ifdef DIAGNOSTIC if (sc->sc_suspend == PWR_RESUME) printf("uhci_power: weird, resume without suspend.\n"); @@ -731,6 +748,13 @@ uhci_power(int why, void *v) if (uhcidebug > 2) uhci_dumpregs(sc); #endif + break; +#if defined(__NetBSD__) + case PWR_SOFTSUSPEND: + case PWR_SOFTSTANDBY: + case PWR_SOFTRESUME: + break; +#endif } splx(s); } @@ -1139,16 +1163,16 @@ uhci_intr(void *arg) } #endif + status = UREAD2(sc, UHCI_STS); + if (status == 0) /* The interrupt was not for us. */ + return (0); + if (sc->sc_suspend != PWR_RESUME) { printf("%s: interrupt while not operating ignored\n", USBDEVNAME(sc->sc_bus.bdev)); return (0); } - status = UREAD2(sc, UHCI_STS); - if (status == 0) /* The interrupt was not for us. */ - return (0); - #if defined(DIAGNOSTIC) && defined(__NetBSD__) if (sc->sc_suspend != PWR_RESUME) printf("uhci_intr: suspended sts=0x%x\n", status); @@ -1178,7 +1202,7 @@ uhci_intr(void *arg) /* no acknowledge needed */ if (!sc->sc_dying) printf("%s: host controller halted\n", - USBDEVNAME(sc->sc_bus.bdev)); + USBDEVNAME(sc->sc_bus.bdev)); sc->sc_dying = 1; #ifdef UHCI_DEBUG uhci_dump_all(sc); @@ -1317,7 +1341,7 @@ uhci_idone(uhci_intr_info_t *ii) if (xfer->nframes != 0) { /* Isoc transfer, do things differently. */ uhci_soft_td_t **stds = upipe->u.iso.stds; - int i, n, nframes; + int i, n, nframes, len; DPRINTFN(5,("uhci_idone: ii=%p isoc ready\n", ii)); @@ -1335,7 +1359,9 @@ uhci_idone(uhci_intr_info_t *ii) if (++n >= UHCI_VFRAMELIST_COUNT) n = 0; status = le32toh(std->td.td_status); - actlen += UHCI_TD_GET_ACTLEN(status); + len = UHCI_TD_GET_ACTLEN(status); + xfer->frlengths[i] = len; + actlen += len; } upipe->u.iso.inuse -= nframes; xfer->actlen = actlen; @@ -2348,7 +2374,7 @@ uhci_device_isoc_abort(usbd_xfer_handle xfer) for (i = 0; i < nframes; i++) { std = stds[n]; std->td.td_status &= htole32(~(UHCI_TD_ACTIVE | UHCI_TD_IOC)); - len = UHCI_TD_GET_MAXLEN(std->td.td_token); + len = UHCI_TD_GET_MAXLEN(le32toh(std->td.td_token)); if (len > maxlen) maxlen = len; if (++n >= UHCI_VFRAMELIST_COUNT) |