From 25dbf33c268e183cf9df85f6e601623b9993925d Mon Sep 17 00:00:00 2001 From: n_hibma Date: Sun, 3 Oct 1999 20:23:25 +0000 Subject: Check for a valid irq number before calling BUS_SETUP_INTR. Requested-By: msmith --- sys/dev/usb/ohci_pci.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'sys/dev/usb/ohci_pci.c') diff --git a/sys/dev/usb/ohci_pci.c b/sys/dev/usb/ohci_pci.c index 28dff3e..6c90da4 100644 --- a/sys/dev/usb/ohci_pci.c +++ b/sys/dev/usb/ohci_pci.c @@ -56,7 +56,6 @@ #include #include #include -#include #include #include #include @@ -145,6 +144,7 @@ ohci_pci_attach(device_t self) int rid; struct resource *res; void *ih; + int intr; rid = PCI_CBMEM; res = bus_alloc_resource(self, SYS_RES_MEMORY, &rid, @@ -200,6 +200,14 @@ ohci_pci_attach(device_t self) sprintf(sc->sc_vendor, "(unknown)"); } + intr = pci_read_config(self, PCIR_INTLINE, 1); + if (intr == 0 || intr == 255) { + device_printf(self, "Invalid irq %d\n", intr); + device_printf(self, "Please switch on USB support and switch PNP-OS to 'No' in BIOS\n"); + device_delete_child(self, usbus); + return ENXIO; + } + err = BUS_SETUP_INTR(parent, self, res, INTR_TYPE_BIO, (driver_intr_t *) ohci_intr, sc, &ih); if (err) { -- cgit v1.1