Set up to do a local interrupt fielding before calling common code-

allows us to grab lock as we should.
This commit is contained in:
mjacob 2000-12-29 19:10:16 +00:00
parent e2e4fb07d4
commit affd82f08f
2 changed files with 54 additions and 16 deletions

View File

@ -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 @@ isp_pci_attach(device_t dev)
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;

View File

@ -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 @@ isp_pci_attach(device_t dev)
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;