Make sure that if are in fact using 'full SMP', make the interrupt

flags include INTR_MPSAFE. Put the flags in a common place so that
both isp_sbus && isp_pci DTRT.

In isp_mbxdma setup, drop any locks prior to calling things like
bus_dmatag_create. This gets rid of these obnoxious WITNESS messages
about 'sleeping with locks held' blah blah blah blah blah.
This commit is contained in:
mjacob 2002-07-25 16:02:09 +00:00
parent 340952314a
commit bdf708d20a
3 changed files with 25 additions and 12 deletions

View File

@ -70,6 +70,13 @@
#endif
#define HANDLE_LOOPSTATE_IN_OUTER_LAYERS 1
#define ISP_SMPLOCK 1
#ifdef ISP_SMPLOCK
#define ISP_IFLAGS INTR_TYPE_CAM | INTR_ENTROPY | INTR_MPSAFE
#else
#define ISP_IFLAGS INTR_TYPE_CAM | INTR_ENTROPY
#endif
typedef void ispfwfunc(int, int, int, u_int16_t **);

View File

@ -692,12 +692,7 @@ isp_pci_attach(device_t dev)
mtx_init(&isp->isp_osinfo.lock, "isp", NULL, MTX_DEF);
locksetup++;
#ifdef ISP_SMPLOCK
#define INTR_FLAGS INTR_TYPE_CAM | INTR_MPSAFE | INTR_ENTROPY
#else
#define INTR_FLAGS INTR_TYPE_CAM | INTR_ENTROPY
#endif
if (bus_setup_intr(dev, irq, INTR_FLAGS, isp_pci_intr, isp, &pcs->ih)) {
if (bus_setup_intr(dev, irq, ISP_IFLAGS, isp_pci_intr, isp, &pcs->ih)) {
device_printf(dev, "could not setup interrupt\n");
goto bad;
}
@ -1065,10 +1060,12 @@ isp_pci_mbxdma(struct ispsoftc *isp)
bl = BUS_SPACE_MAXADDR_24BIT;
}
ISP_UNLOCK(isp);
if (bus_dma_tag_create(NULL, 1, 0, BUS_SPACE_MAXADDR,
BUS_SPACE_MAXADDR, NULL, NULL, BUS_SPACE_MAXSIZE,
ISP_NSEGS, bl, 0, &pcs->dmat)) {
isp_prt(isp, ISP_LOGERR, "could not create master dma tag");
ISP_LOCK(isp);
return(1);
}
@ -1077,6 +1074,7 @@ isp_pci_mbxdma(struct ispsoftc *isp)
isp->isp_xflist = (XS_T **) malloc(len, M_DEVBUF, M_WAITOK | M_ZERO);
if (isp->isp_xflist == NULL) {
isp_prt(isp, ISP_LOGERR, "cannot alloc xflist array");
ISP_LOCK(isp);
return (1);
}
len = sizeof (bus_dmamap_t) * isp->isp_maxcmds;
@ -1084,6 +1082,7 @@ isp_pci_mbxdma(struct ispsoftc *isp)
if (pcs->dmaps == NULL) {
isp_prt(isp, ISP_LOGERR, "can't alloc dma map storage");
free(isp->isp_xflist, M_DEVBUF);
ISP_LOCK(isp);
return (1);
}
@ -1103,6 +1102,7 @@ isp_pci_mbxdma(struct ispsoftc *isp)
"cannot create a dma tag for control spaces");
free(pcs->dmaps, M_DEVBUF);
free(isp->isp_xflist, M_DEVBUF);
ISP_LOCK(isp);
return (1);
}
@ -1113,6 +1113,7 @@ isp_pci_mbxdma(struct ispsoftc *isp)
bus_dma_tag_destroy(isp->isp_cdmat);
free(isp->isp_xflist, M_DEVBUF);
free(pcs->dmaps, M_DEVBUF);
ISP_LOCK(isp);
return (1);
}
@ -1144,6 +1145,7 @@ isp_pci_mbxdma(struct ispsoftc *isp)
base += ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(isp));
FCPARAM(isp)->isp_scratch = base;
}
ISP_LOCK(isp);
return (0);
bad:
@ -1151,6 +1153,7 @@ bad:
bus_dma_tag_destroy(isp->isp_cdmat);
free(isp->isp_xflist, M_DEVBUF);
free(pcs->dmaps, M_DEVBUF);
ISP_LOCK(isp);
isp->isp_rquest = NULL;
return (1);
}

View File

@ -277,12 +277,7 @@ isp_sbus_attach(device_t dev)
mtx_init(&isp->isp_osinfo.lock, "isp", NULL, MTX_DEF);
locksetup++;
#ifdef ISP_SMPLOCK
#define INTR_FLAGS INTR_TYPE_CAM | INTR_MPSAFE | INTR_ENTROPY
#else
#define INTR_FLAGS INTR_TYPE_CAM | INTR_ENTROPY
#endif
if (bus_setup_intr(dev, sbs->sbus_ires, INTR_FLAGS,
if (bus_setup_intr(dev, sbs->sbus_ires, ISP_IFLAGS,
isp_sbus_intr, isp, &sbs->ih)) {
device_printf(dev, "could not setup interrupt\n");
goto bad;
@ -476,12 +471,14 @@ isp_sbus_mbxdma(struct ispsoftc *isp)
return (0);
}
ISP_UNLOCK(isp);
bl = BUS_SPACE_MAXADDR_24BIT;
if (bus_dma_tag_create(NULL, 1, 0, BUS_SPACE_MAXADDR,
BUS_SPACE_MAXADDR, NULL, NULL, BUS_SPACE_MAXSIZE,
ISP_NSEGS, bl, 0, &sbs->dmat)) {
isp_prt(isp, ISP_LOGERR, "could not create master dma tag");
ISP_LOCK(isp);
return(1);
}
@ -490,6 +487,7 @@ isp_sbus_mbxdma(struct ispsoftc *isp)
isp->isp_xflist = (XS_T **) malloc(len, M_DEVBUF, M_WAITOK | M_ZERO);
if (isp->isp_xflist == NULL) {
isp_prt(isp, ISP_LOGERR, "cannot alloc xflist array");
ISP_LOCK(isp);
return (1);
}
len = sizeof (bus_dmamap_t) * isp->isp_maxcmds;
@ -497,6 +495,7 @@ isp_sbus_mbxdma(struct ispsoftc *isp)
if (sbs->dmaps == NULL) {
isp_prt(isp, ISP_LOGERR, "can't alloc dma map storage");
free(isp->isp_xflist, M_DEVBUF);
ISP_LOCK(isp);
return (1);
}
@ -513,6 +512,7 @@ isp_sbus_mbxdma(struct ispsoftc *isp)
"cannot create a dma tag for control spaces");
free(sbs->dmaps, M_DEVBUF);
free(isp->isp_xflist, M_DEVBUF);
ISP_LOCK(isp);
return (1);
}
@ -523,6 +523,7 @@ isp_sbus_mbxdma(struct ispsoftc *isp)
bus_dma_tag_destroy(isp->isp_cdmat);
free(isp->isp_xflist, M_DEVBUF);
free(sbs->dmaps, M_DEVBUF);
ISP_LOCK(isp);
return (1);
}
@ -549,6 +550,7 @@ isp_sbus_mbxdma(struct ispsoftc *isp)
isp->isp_rquest = base;
base += ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp));
ISP_LOCK(isp);
isp->isp_result = base;
return (0);
@ -557,6 +559,7 @@ bad:
bus_dma_tag_destroy(isp->isp_cdmat);
free(isp->isp_xflist, M_DEVBUF);
free(sbs->dmaps, M_DEVBUF);
ISP_LOCK(isp);
isp->isp_rquest = NULL;
return (1);
}