diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2001-01-21 02:42:50 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2001-01-21 02:42:50 +0000 |
commit | 6477cdd194ae18d13182fbd04f7d056334a5dcd8 (patch) | |
tree | 841389c6ca2cc7a111ca5335c431d37351fe8ac9 | |
parent | 9153c6da4864458de4076f912e7545d78398b878 (diff) |
map and establish interrupts _after_ chip was initialized
and driver has allocated it's internal data structures.
deraadt@ ok
-rw-r--r-- | sys/dev/pci/ohci_pci.c | 16 | ||||
-rw-r--r-- | sys/dev/pci/uhci_pci.c | 40 |
2 files changed, 28 insertions, 28 deletions
diff --git a/sys/dev/pci/ohci_pci.c b/sys/dev/pci/ohci_pci.c index 72c5b2c0660..a09d6a30a3a 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.7 2000/07/04 13:21:59 fgsch Exp $ */ +/* $OpenBSD: ohci_pci.c,v 1.8 2001/01/21 02:42:49 mickey Exp $ */ /* $NetBSD: ohci_pci.c,v 1.9 1999/05/20 09:52:35 augustss Exp $ */ /* @@ -127,6 +127,12 @@ 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; + } + /* Map and establish the interrupt. */ if (pci_intr_map(pc, pa->pa_intrtag, pa->pa_intrpin, pa->pa_intrline, &ih)) { @@ -146,15 +152,9 @@ ohci_pci_attach(parent, self, aux) } printf(": %s", 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); + usbctlprint); } int diff --git a/sys/dev/pci/uhci_pci.c b/sys/dev/pci/uhci_pci.c index 97aa3eb27bc..3678bc01b98 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.8 2000/07/04 13:21:59 fgsch Exp $ */ +/* $OpenBSD: uhci_pci.c,v 1.9 2001/01/21 02:42:49 mickey Exp $ */ /* $NetBSD: uhci_pci.c,v 1.14 2000/01/25 11:26:06 augustss Exp $ */ /* @@ -120,24 +120,6 @@ uhci_pci_attach(parent, self, aux) pci_conf_write(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG, csr | PCI_COMMAND_MASTER_ENABLE); - /* Map and establish the interrupt. */ - if (pci_intr_map(pc, pa->pa_intrtag, pa->pa_intrpin, - pa->pa_intrline, &ih)) { - printf(": couldn't map interrupt\n"); - return; - } - intrstr = pci_intr_string(pc, ih); - sc->sc_ih = pci_intr_establish(pc, ih, IPL_USB, uhci_intr, sc, - sc->sc.sc_bus.bdev.dv_xname); - if (sc->sc_ih == NULL) { - printf(": couldn't establish interrupt"); - if (intrstr != NULL) - printf(" at %s", intrstr); - printf("\n"); - return; - } - printf(": %s\n", intrstr); - /* Verify that the PIRQD enable bit is set, some BIOS's don't do that*/ legsup = pci_conf_read(pc, pa->pa_tag, PCI_LEGSUP); if (!(legsup & PCI_LEGSUP_USBPIRQDEN)) { @@ -166,9 +148,27 @@ uhci_pci_attach(parent, self, aux) return; } + /* Map and establish the interrupt. */ + if (pci_intr_map(pc, pa->pa_intrtag, pa->pa_intrpin, + pa->pa_intrline, &ih)) { + printf(": couldn't map interrupt\n"); + return; + } + intrstr = pci_intr_string(pc, ih); + sc->sc_ih = pci_intr_establish(pc, ih, IPL_USB, uhci_intr, sc, + sc->sc.sc_bus.bdev.dv_xname); + if (sc->sc_ih == NULL) { + printf(": couldn't establish interrupt"); + if (intrstr != NULL) + printf(" at %s", intrstr); + printf("\n"); + return; + } + printf(": %s\n", intrstr); + /* Attach usb device. */ sc->sc.sc_child = config_found((void *)sc, &sc->sc.sc_bus, - usbctlprint); + usbctlprint); } int |