From c724abb001fe7546a8883a4bf611667176e9e64b Mon Sep 17 00:00:00 2001 From: Dale Rahn Date: Sat, 8 Jun 2002 14:53:01 +0000 Subject: i386 configures devices while at spl0, this causes problems if devices attach the interrupt before initializing the hardware to make sure that no interrupts are pending. By adding splusb() any possible interrupts are blocked and will be handled correctly. Discussed with niklas, ok art@ --- sys/dev/pci/ohci_pci.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'sys') diff --git a/sys/dev/pci/ohci_pci.c b/sys/dev/pci/ohci_pci.c index 861dcbb2fbd..d2ea08e3809 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.16 2002/06/07 22:26:33 miod Exp $ */ +/* $OpenBSD: ohci_pci.c,v 1.17 2002/06/08 14:53:00 drahn Exp $ */ /* $NetBSD: ohci_pci.c,v 1.9 1999/05/20 09:52:35 augustss Exp $ */ /* @@ -107,6 +107,7 @@ ohci_pci_attach(parent, self, aux) pci_intr_handle_t ih; pcireg_t csr; usbd_status r; + int s; /* Map I/O registers */ if (pci_mapreg_map(pa, PCI_CBMEM, PCI_MAPREG_TYPE_MEM, 0, @@ -132,9 +133,11 @@ ohci_pci_attach(parent, self, aux) bus_space_write_4(sc->sc.iot, sc->sc.ioh, OHCI_INTERRUPT_DISABLE, OHCI_ALL_INTRS); + s = splusb(); /* Map and establish the interrupt. */ if (pci_intr_map(pa, &ih)) { printf(": couldn't map interrupt\n"); + splx(s); return; } @@ -146,6 +149,7 @@ ohci_pci_attach(parent, self, aux) if (intrstr != NULL) printf(" at %s", intrstr); printf("\n"); + splx(s); return; } printf(": %s", intrstr); @@ -154,8 +158,10 @@ ohci_pci_attach(parent, self, aux) if (r != USBD_NORMAL_COMPLETION) { printf("%s: init failed, error=%d\n", sc->sc.sc_bus.bdev.dv_xname, r); + splx(s); return; } + splx(s); /* Attach usb device. */ sc->sc.sc_child = config_found((void *)sc, &sc->sc.sc_bus, -- cgit v1.2.3