diff options
| author | Matt Jacob <mjacob@FreeBSD.org> | 2000-12-29 19:10:16 +0000 |
|---|---|---|
| committer | Matt Jacob <mjacob@FreeBSD.org> | 2000-12-29 19:10:16 +0000 |
| commit | f09b192280c7a13f533f9a2c1b66dfe3d346ac69 (patch) | |
| tree | 8896d9c1f90d491daaaddf06b5d70c9c6fd0d3ed | |
| parent | c40e096ed6f76670a8f8fb17f128cee30a061b4d (diff) | |
Notes
| -rw-r--r-- | sys/dev/isp/isp_pci.c | 35 | ||||
| -rw-r--r-- | sys/pci/isp_pci.c | 35 |
2 files changed, 54 insertions, 16 deletions
diff --git a/sys/dev/isp/isp_pci.c b/sys/dev/isp/isp_pci.c index b55990601e45..acc704849c84 100644 --- a/sys/dev/isp/isp_pci.c +++ b/sys/dev/isp/isp_pci.c @@ -240,6 +240,7 @@ static device_method_t isp_pci_methods[] = { DEVMETHOD(device_attach, isp_pci_attach), { 0, 0 } }; +static void isp_pci_intr __P((void *)); static driver_t isp_pci_driver = { "isp", isp_pci_methods, sizeof (struct isp_pcisoftc) @@ -576,11 +577,26 @@ isp_pci_attach(device_t dev) } isp_debug = 0; (void) getenv_int("isp_debug", &isp_debug); - if (bus_setup_intr(dev, irq, INTR_TYPE_CAM, (void (*)(void *))isp_intr, - isp, &pcs->ih)) { + +#ifdef ISP_SMPLOCK + /* Make sure the lock is set up. */ + mtx_init(&isp->isp_osinfo.lock, "isp", MTX_DEF); + locksetup++; +#endif + +#ifdef ISP_SMPLOCK + if (bus_setup_intr(dev, irq, INTR_TYPE_CAM | INTR_MPSAFE, + isp_pci_intr, isp, &pcs->ih)) { + device_printf(dev, "could not setup interrupt\n"); + goto bad; + } +#else + if (bus_setup_intr(dev, irq, INTR_TYPE_CAM, + isp_pci_intr, isp, &pcs->ih)) { device_printf(dev, "could not setup interrupt\n"); goto bad; } +#endif /* * Set up logging levels. @@ -593,12 +609,6 @@ isp_pci_attach(device_t dev) if (bootverbose) isp->isp_dblev |= ISP_LOGCONFIG|ISP_LOGINFO; -#ifdef ISP_SMPLOCK - /* Make sure the lock is set up. */ - mtx_init(&isp->isp_osinfo.lock, "isp", MTX_DEF); - locksetup++; -#endif - /* * Make sure we're in reset state. */ @@ -668,6 +678,15 @@ bad: return (ENXIO); } +static void +isp_pci_intr(void *arg) +{ + struct ispsoftc *isp = arg; + ISP_LOCK(isp); + (void) isp_intr(isp); + ISP_UNLOCK(isp); +} + static u_int16_t isp_pci_rd_reg(isp, regoff) struct ispsoftc *isp; diff --git a/sys/pci/isp_pci.c b/sys/pci/isp_pci.c index b55990601e45..acc704849c84 100644 --- a/sys/pci/isp_pci.c +++ b/sys/pci/isp_pci.c @@ -240,6 +240,7 @@ static device_method_t isp_pci_methods[] = { DEVMETHOD(device_attach, isp_pci_attach), { 0, 0 } }; +static void isp_pci_intr __P((void *)); static driver_t isp_pci_driver = { "isp", isp_pci_methods, sizeof (struct isp_pcisoftc) @@ -576,11 +577,26 @@ isp_pci_attach(device_t dev) } isp_debug = 0; (void) getenv_int("isp_debug", &isp_debug); - if (bus_setup_intr(dev, irq, INTR_TYPE_CAM, (void (*)(void *))isp_intr, - isp, &pcs->ih)) { + +#ifdef ISP_SMPLOCK + /* Make sure the lock is set up. */ + mtx_init(&isp->isp_osinfo.lock, "isp", MTX_DEF); + locksetup++; +#endif + +#ifdef ISP_SMPLOCK + if (bus_setup_intr(dev, irq, INTR_TYPE_CAM | INTR_MPSAFE, + isp_pci_intr, isp, &pcs->ih)) { + device_printf(dev, "could not setup interrupt\n"); + goto bad; + } +#else + if (bus_setup_intr(dev, irq, INTR_TYPE_CAM, + isp_pci_intr, isp, &pcs->ih)) { device_printf(dev, "could not setup interrupt\n"); goto bad; } +#endif /* * Set up logging levels. @@ -593,12 +609,6 @@ isp_pci_attach(device_t dev) if (bootverbose) isp->isp_dblev |= ISP_LOGCONFIG|ISP_LOGINFO; -#ifdef ISP_SMPLOCK - /* Make sure the lock is set up. */ - mtx_init(&isp->isp_osinfo.lock, "isp", MTX_DEF); - locksetup++; -#endif - /* * Make sure we're in reset state. */ @@ -668,6 +678,15 @@ bad: return (ENXIO); } +static void +isp_pci_intr(void *arg) +{ + struct ispsoftc *isp = arg; + ISP_LOCK(isp); + (void) isp_intr(isp); + ISP_UNLOCK(isp); +} + static u_int16_t isp_pci_rd_reg(isp, regoff) struct ispsoftc *isp; |
