diff options
author | Marcus Glocker <mglocker@cvs.openbsd.org> | 2007-03-18 20:14:52 +0000 |
---|---|---|
committer | Marcus Glocker <mglocker@cvs.openbsd.org> | 2007-03-18 20:14:52 +0000 |
commit | 2820d116979e135234d1261ada149c763a9c0e8f (patch) | |
tree | 0bf89f6bb84c1a9536807c2a741a63210ccaa24d /sys/dev/usb | |
parent | ac1137b6a847c7588490a81e52944d5a73b778ac (diff) |
Backout pascoe@'s last USB change because it page faults at attachment
time.
Chris; Get your shiz fixed and tested for the next time. We have
better todo then wasting our time by backing out untested stuff.
OK deraadt, OK ckuethe
Diffstat (limited to 'sys/dev/usb')
-rw-r--r-- | sys/dev/usb/ohci.c | 28 | ||||
-rw-r--r-- | sys/dev/usb/uhci.c | 9 | ||||
-rw-r--r-- | sys/dev/usb/uhub.c | 8 | ||||
-rw-r--r-- | sys/dev/usb/usb.c | 8 |
4 files changed, 27 insertions, 26 deletions
diff --git a/sys/dev/usb/ohci.c b/sys/dev/usb/ohci.c index 4e3c6bc2a2f..122a67ee846 100644 --- a/sys/dev/usb/ohci.c +++ b/sys/dev/usb/ohci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ohci.c,v 1.74 2007/03/18 06:08:24 pascoe Exp $ */ +/* $OpenBSD: ohci.c,v 1.75 2007/03/18 20:14:51 mglocker Exp $ */ /* $NetBSD: ohci.c,v 1.139 2003/02/22 05:24:16 tsutsui Exp $ */ /* $FreeBSD: src/sys/dev/usb/ohci.c,v 1.22 1999/11/17 22:33:40 n_hibma Exp $ */ @@ -616,7 +616,7 @@ ohci_init(ohci_softc_t *sc) ohci_soft_ed_t *sed, *psed; usbd_status err; int i; - u_int32_t ctl, rwc, ival, hcr, fm, per, rev, desca, descb; + u_int32_t s, ctl, rwc, ival, hcr, fm, per, rev, desca, descb; DPRINTF(("ohci_init: start\n")); printf(","); @@ -718,12 +718,26 @@ ohci_init(ohci_softc_t *sc) desca = OREAD4(sc, OHCI_RH_DESCRIPTOR_A); descb = OREAD4(sc, OHCI_RH_DESCRIPTOR_B); - /* SMM handover performed by the PCI code didn't work? */ + /* Determine in what context we are running. */ if (ctl & OHCI_IR) { - printf("%s: SMM does not respond, resetting\n", - USBDEVNAME(sc->sc_bus.bdev)); - OWRITE4(sc, OHCI_CONTROL, OHCI_HCFS_RESET | rwc); - goto reset; + /* SMM active, request change */ + DPRINTF(("ohci_init: SMM active, request owner change\n")); + if ((sc->sc_intre & (OHCI_OC | OHCI_MIE)) == + (OHCI_OC | OHCI_MIE)) + OWRITE4(sc, OHCI_INTERRUPT_ENABLE, OHCI_MIE); + s = OREAD4(sc, OHCI_COMMAND_STATUS); + OWRITE4(sc, OHCI_COMMAND_STATUS, s | OHCI_OCR); + for (i = 0; i < 100 && (ctl & OHCI_IR); i++) { + usb_delay_ms(&sc->sc_bus, 1); + ctl = OREAD4(sc, OHCI_CONTROL); + } + OWRITE4(sc, OHCI_INTERRUPT_DISABLE, OHCI_MIE); + if (ctl & OHCI_IR) { + printf("%s: SMM does not respond, resetting\n", + USBDEVNAME(sc->sc_bus.bdev)); + OWRITE4(sc, OHCI_CONTROL, OHCI_HCFS_RESET | rwc); + goto reset; + } #if 0 /* Don't bother trying to reuse the BIOS init, we'll reset it anyway. */ } else if ((ctl & OHCI_HCFS_MASK) != OHCI_HCFS_RESET) { diff --git a/sys/dev/usb/uhci.c b/sys/dev/usb/uhci.c index e83cecaadb1..50ec3b3e891 100644 --- a/sys/dev/usb/uhci.c +++ b/sys/dev/usb/uhci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uhci.c,v 1.49 2007/03/18 05:55:24 pascoe Exp $ */ +/* $OpenBSD: uhci.c,v 1.50 2007/03/18 20:14:51 mglocker Exp $ */ /* $NetBSD: uhci.c,v 1.172 2003/02/23 04:19:26 simonb Exp $ */ /* $FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $ */ @@ -409,16 +409,10 @@ uhci_init(uhci_softc_t *sc) uhci_dumpregs(sc); #endif - /* Save SOF over HC reset. */ - sc->sc_saved_sof = UREAD1(sc, UHCI_SOF); - UWRITE2(sc, UHCI_INTR, 0); /* disable interrupts */ uhci_globalreset(sc); /* reset the controller */ uhci_reset(sc); - /* Restore saved SOF. */ - UWRITE1(sc, UHCI_SOF, sc->sc_saved_sof); - /* Allocate and initialize real frame array. */ err = usb_allocmem(&sc->sc_bus, UHCI_FRAMELIST_COUNT * sizeof(uhci_physaddr_t), @@ -726,6 +720,7 @@ uhci_power(int why, void *v) /* save some state if BIOS doesn't */ sc->sc_saved_frnum = UREAD2(sc, UHCI_FRNUM); + sc->sc_saved_sof = UREAD1(sc, UHCI_SOF); UWRITE2(sc, UHCI_INTR, 0); /* disable intrs */ diff --git a/sys/dev/usb/uhub.c b/sys/dev/usb/uhub.c index 056158408e2..631607cdb14 100644 --- a/sys/dev/usb/uhub.c +++ b/sys/dev/usb/uhub.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uhub.c,v 1.35 2007/03/18 06:00:45 pascoe Exp $ */ +/* $OpenBSD: uhub.c,v 1.36 2007/03/18 20:14:51 mglocker Exp $ */ /* $NetBSD: uhub.c,v 1.64 2003/02/08 03:32:51 ichiro Exp $ */ /* $FreeBSD: src/sys/dev/usb/uhub.c,v 1.18 1999/11/17 22:33:43 n_hibma Exp $ */ @@ -338,11 +338,9 @@ USB_ATTACH(uhub) USBDEVNAME(sc->sc_dev), port, usbd_errstr(err)); DPRINTF(("usb_init_port: turn on port %d power\n", port)); - } - - /* Wait for stable power. Root hubs delay in their event thread. */ - if (dev->powersrc->parent != NULL) + /* Wait for stable power. */ usbd_delay_ms(dev, pwrdly); + } /* The usual exploration will finish the setup. */ diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c index c8256f255dd..b8012f31e27 100644 --- a/sys/dev/usb/usb.c +++ b/sys/dev/usb/usb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usb.c,v 1.36 2007/03/18 06:00:45 pascoe Exp $ */ +/* $OpenBSD: usb.c,v 1.37 2007/03/18 20:14:51 mglocker Exp $ */ /* $NetBSD: usb.c,v 1.77 2003/01/01 00:10:26 thorpej Exp $ */ /* @@ -304,15 +304,9 @@ void usb_event_thread(void *arg) { struct usb_softc *sc = arg; - int pwrdly; DPRINTF(("usb_event_thread: start\n")); - /* Wait for power to come good. */ - pwrdly = sc->sc_bus->root_hub->hub->hubdesc.bPwrOn2PwrGood * - UHD_PWRON_FACTOR + USB_EXTRA_POWER_UP_TIME; - usb_delay_ms(sc->sc_bus, pwrdly); - /* USB1 threads wait for USB2 threads to finish their first probe. */ while (sc->sc_bus->usbrev != USBREV_2_0 && threads_pending) (void)tsleep((void *)&threads_pending, PWAIT, "config", 0); |