summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authormjacob <mjacob@FreeBSD.org>2000-12-29 19:10:16 +0000
committermjacob <mjacob@FreeBSD.org>2000-12-29 19:10:16 +0000
commitaffd82f08f80e5c5f43f65b43b0615eb01d13df9 (patch)
treecebbbb6003eec3965e14438c1aaa6bd3fc4e2029 /sys
parente2e4fb07d4a4a0b7052691d0f7bbbb27aa21e596 (diff)
downloadFreeBSD-src-affd82f08f80e5c5f43f65b43b0615eb01d13df9.zip
FreeBSD-src-affd82f08f80e5c5f43f65b43b0615eb01d13df9.tar.gz
Set up to do a local interrupt fielding before calling common code-
allows us to grab lock as we should.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/isp/isp_pci.c35
-rw-r--r--sys/pci/isp_pci.c35
2 files changed, 54 insertions, 16 deletions
diff --git a/sys/dev/isp/isp_pci.c b/sys/dev/isp/isp_pci.c
index b559906..acc7048 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 b559906..acc7048 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;
OpenPOWER on IntegriCloud