summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormickey <mickey@openbsd.org>2001-06-12 19:11:58 +0000
committermickey <mickey@openbsd.org>2001-06-12 19:11:58 +0000
commitde346b4298eaa676244cfee02b487c4c7af7c4a3 (patch)
tree76cceb74c8f9538de5bcdf03414605eb4462d03f
parentdo not log() packet_set_maxsize (diff)
downloadwireguard-openbsd-de346b4298eaa676244cfee02b487c4c7af7c4a3.tar.xz
wireguard-openbsd-de346b4298eaa676244cfee02b487c4c7af7c4a3.zip
interrupts cannot happen before
*hci cannot receive interrupts before it has been initialized. this was changed to accomodate the pcibios strategy change back in pre-2.9 times since *hci_init enables interrupts at it's end and thus unmapped pci interrupt hangs the machine in the endless loop trying to deliver it (and no hci handler to ack it). this new way we disable interrupts by hands before we map 'em on pci and thus ensure that they will not crash an uninitialized *hci which, in turn, will run right after the interrupt map/establish and by the time it enables *hci interrupts all gonna be just fine. please allow us to end this stretched remark for cvs is getting a power outage in less than 20 minutes.
-rw-r--r--sys/dev/pci/ohci_pci.c17
-rw-r--r--sys/dev/pci/uhci_pci.c18
-rw-r--r--sys/dev/usb/uhci.c3
-rw-r--r--sys/dev/usb/uhcivar.h3
4 files changed, 26 insertions, 15 deletions
diff --git a/sys/dev/pci/ohci_pci.c b/sys/dev/pci/ohci_pci.c
index 569ad586e1b..b4fbe0867c7 100644
--- a/sys/dev/pci/ohci_pci.c
+++ b/sys/dev/pci/ohci_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ohci_pci.c,v 1.10 2001/06/12 15:40:32 niklas Exp $ */
+/* $OpenBSD: ohci_pci.c,v 1.11 2001/06/12 19:11:59 mickey Exp $ */
/* $NetBSD: ohci_pci.c,v 1.9 1999/05/20 09:52:35 augustss Exp $ */
/*
@@ -127,11 +127,10 @@ ohci_pci_attach(parent, self, aux)
pci_conf_write(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG,
csr | PCI_COMMAND_MASTER_ENABLE);
- r = ohci_init(&sc->sc);
- if (r != USBD_NORMAL_COMPLETION) {
- printf(": init failed, error=%d\n", r);
- return;
- }
+ bus_space_barrier(sc->sc.iot, sc->sc.ioh, 0, sc->sc.sc_size,
+ BUS_SPACE_BARRIER_READ|BUS_SPACE_BARRIER_WRITE);
+ bus_space_write_4(sc->sc.iot, sc->sc.ioh,
+ OHCI_INTERRUPT_DISABLE, OHCI_ALL_INTRS);
/* Map and establish the interrupt. */
if (pci_intr_map(pc, pa->pa_intrtag, pa->pa_intrpin,
@@ -152,6 +151,12 @@ ohci_pci_attach(parent, self, aux)
}
printf(": %s\n", intrstr);
+ r = ohci_init(&sc->sc);
+ if (r != USBD_NORMAL_COMPLETION) {
+ printf(": init failed, error=%d\n", r);
+ return;
+ }
+
/* Attach usb device. */
sc->sc.sc_child = config_found((void *)sc, &sc->sc.sc_bus,
usbctlprint);
diff --git a/sys/dev/pci/uhci_pci.c b/sys/dev/pci/uhci_pci.c
index b871a7237a3..71444830743 100644
--- a/sys/dev/pci/uhci_pci.c
+++ b/sys/dev/pci/uhci_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uhci_pci.c,v 1.10 2001/06/12 15:40:33 niklas Exp $ */
+/* $OpenBSD: uhci_pci.c,v 1.11 2001/06/12 19:11:59 mickey Exp $ */
/* $NetBSD: uhci_pci.c,v 1.14 2000/01/25 11:26:06 augustss Exp $ */
/*
@@ -142,11 +142,11 @@ uhci_pci_attach(parent, self, aux)
break;
}
- r = uhci_init(&sc->sc);
- if (r != USBD_NORMAL_COMPLETION) {
- printf(": init failed, error=%d\n", r);
- return;
- }
+ uhci_run(&sc->sc, 0); /* stop the controller */
+ /* disable interrupts */
+ bus_space_barrier(sc->sc.iot, sc->sc.ioh, 0, sc->sc.sc_size,
+ BUS_SPACE_BARRIER_READ|BUS_SPACE_BARRIER_WRITE);
+ bus_space_write_2(sc->sc.iot, sc->sc.ioh, UHCI_INTR, 0);
/* Map and establish the interrupt. */
if (pci_intr_map(pc, pa->pa_intrtag, pa->pa_intrpin,
@@ -166,6 +166,12 @@ uhci_pci_attach(parent, self, aux)
}
printf(": %s\n", intrstr);
+ r = uhci_init(&sc->sc);
+ if (r != USBD_NORMAL_COMPLETION) {
+ printf(": init failed, error=%d\n", r);
+ return;
+ }
+
/* Attach usb device. */
sc->sc.sc_child = config_found((void *)sc, &sc->sc.sc_bus,
usbctlprint);
diff --git a/sys/dev/usb/uhci.c b/sys/dev/usb/uhci.c
index 843b1a537b2..337fbf4aa9b 100644
--- a/sys/dev/usb/uhci.c
+++ b/sys/dev/usb/uhci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uhci.c,v 1.20 2001/05/03 02:20:33 aaron Exp $ */
+/* $OpenBSD: uhci.c,v 1.21 2001/06/12 19:11:58 mickey Exp $ */
/* $NetBSD: uhci.c,v 1.135 2001/04/01 14:59:52 augustss Exp $ */
/* $FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $ */
@@ -162,7 +162,6 @@ struct uhci_pipe {
Static void uhci_busreset(uhci_softc_t *);
Static void uhci_shutdown(void *v);
Static void uhci_power(int, void *);
-Static usbd_status uhci_run(uhci_softc_t *, int run);
Static uhci_soft_td_t *uhci_alloc_std(uhci_softc_t *);
Static void uhci_free_std(uhci_softc_t *, uhci_soft_td_t *);
Static uhci_soft_qh_t *uhci_alloc_sqh(uhci_softc_t *);
diff --git a/sys/dev/usb/uhcivar.h b/sys/dev/usb/uhcivar.h
index a6094b725c0..ef076c26dba 100644
--- a/sys/dev/usb/uhcivar.h
+++ b/sys/dev/usb/uhcivar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: uhcivar.h,v 1.10 2000/11/08 18:10:38 aaron Exp $ */
+/* $OpenBSD: uhcivar.h,v 1.11 2001/06/12 19:11:59 mickey Exp $ */
/* $NetBSD: uhcivar.h,v 1.32 2000/08/13 16:18:09 augustss Exp $ */
/* $FreeBSD: src/sys/dev/usb/uhcivar.h,v 1.14 1999/11/17 22:33:42 n_hibma Exp $ */
@@ -182,6 +182,7 @@ typedef struct uhci_softc {
} uhci_softc_t;
usbd_status uhci_init(uhci_softc_t *);
+usbd_status uhci_run(uhci_softc_t *, int run);
int uhci_intr(void *);
#if defined(__NetBSD__) || defined(__OpenBSD__)
int uhci_detach(uhci_softc_t *, int);