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:
parent
4eb494274f
commit
72429e49f5
@ -70,6 +70,13 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define HANDLE_LOOPSTATE_IN_OUTER_LAYERS 1
|
#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 **);
|
typedef void ispfwfunc(int, int, int, u_int16_t **);
|
||||||
|
|
||||||
|
@ -692,12 +692,7 @@ isp_pci_attach(device_t dev)
|
|||||||
mtx_init(&isp->isp_osinfo.lock, "isp", NULL, MTX_DEF);
|
mtx_init(&isp->isp_osinfo.lock, "isp", NULL, MTX_DEF);
|
||||||
locksetup++;
|
locksetup++;
|
||||||
|
|
||||||
#ifdef ISP_SMPLOCK
|
if (bus_setup_intr(dev, irq, ISP_IFLAGS, isp_pci_intr, isp, &pcs->ih)) {
|
||||||
#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)) {
|
|
||||||
device_printf(dev, "could not setup interrupt\n");
|
device_printf(dev, "could not setup interrupt\n");
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
@ -1065,10 +1060,12 @@ isp_pci_mbxdma(struct ispsoftc *isp)
|
|||||||
bl = BUS_SPACE_MAXADDR_24BIT;
|
bl = BUS_SPACE_MAXADDR_24BIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ISP_UNLOCK(isp);
|
||||||
if (bus_dma_tag_create(NULL, 1, 0, BUS_SPACE_MAXADDR,
|
if (bus_dma_tag_create(NULL, 1, 0, BUS_SPACE_MAXADDR,
|
||||||
BUS_SPACE_MAXADDR, NULL, NULL, BUS_SPACE_MAXSIZE,
|
BUS_SPACE_MAXADDR, NULL, NULL, BUS_SPACE_MAXSIZE,
|
||||||
ISP_NSEGS, bl, 0, &pcs->dmat)) {
|
ISP_NSEGS, bl, 0, &pcs->dmat)) {
|
||||||
isp_prt(isp, ISP_LOGERR, "could not create master dma tag");
|
isp_prt(isp, ISP_LOGERR, "could not create master dma tag");
|
||||||
|
ISP_LOCK(isp);
|
||||||
return(1);
|
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);
|
isp->isp_xflist = (XS_T **) malloc(len, M_DEVBUF, M_WAITOK | M_ZERO);
|
||||||
if (isp->isp_xflist == NULL) {
|
if (isp->isp_xflist == NULL) {
|
||||||
isp_prt(isp, ISP_LOGERR, "cannot alloc xflist array");
|
isp_prt(isp, ISP_LOGERR, "cannot alloc xflist array");
|
||||||
|
ISP_LOCK(isp);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
len = sizeof (bus_dmamap_t) * isp->isp_maxcmds;
|
len = sizeof (bus_dmamap_t) * isp->isp_maxcmds;
|
||||||
@ -1084,6 +1082,7 @@ isp_pci_mbxdma(struct ispsoftc *isp)
|
|||||||
if (pcs->dmaps == NULL) {
|
if (pcs->dmaps == NULL) {
|
||||||
isp_prt(isp, ISP_LOGERR, "can't alloc dma map storage");
|
isp_prt(isp, ISP_LOGERR, "can't alloc dma map storage");
|
||||||
free(isp->isp_xflist, M_DEVBUF);
|
free(isp->isp_xflist, M_DEVBUF);
|
||||||
|
ISP_LOCK(isp);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1103,6 +1102,7 @@ isp_pci_mbxdma(struct ispsoftc *isp)
|
|||||||
"cannot create a dma tag for control spaces");
|
"cannot create a dma tag for control spaces");
|
||||||
free(pcs->dmaps, M_DEVBUF);
|
free(pcs->dmaps, M_DEVBUF);
|
||||||
free(isp->isp_xflist, M_DEVBUF);
|
free(isp->isp_xflist, M_DEVBUF);
|
||||||
|
ISP_LOCK(isp);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1113,6 +1113,7 @@ isp_pci_mbxdma(struct ispsoftc *isp)
|
|||||||
bus_dma_tag_destroy(isp->isp_cdmat);
|
bus_dma_tag_destroy(isp->isp_cdmat);
|
||||||
free(isp->isp_xflist, M_DEVBUF);
|
free(isp->isp_xflist, M_DEVBUF);
|
||||||
free(pcs->dmaps, M_DEVBUF);
|
free(pcs->dmaps, M_DEVBUF);
|
||||||
|
ISP_LOCK(isp);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1144,6 +1145,7 @@ isp_pci_mbxdma(struct ispsoftc *isp)
|
|||||||
base += ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(isp));
|
base += ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(isp));
|
||||||
FCPARAM(isp)->isp_scratch = base;
|
FCPARAM(isp)->isp_scratch = base;
|
||||||
}
|
}
|
||||||
|
ISP_LOCK(isp);
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
bad:
|
bad:
|
||||||
@ -1151,6 +1153,7 @@ bad:
|
|||||||
bus_dma_tag_destroy(isp->isp_cdmat);
|
bus_dma_tag_destroy(isp->isp_cdmat);
|
||||||
free(isp->isp_xflist, M_DEVBUF);
|
free(isp->isp_xflist, M_DEVBUF);
|
||||||
free(pcs->dmaps, M_DEVBUF);
|
free(pcs->dmaps, M_DEVBUF);
|
||||||
|
ISP_LOCK(isp);
|
||||||
isp->isp_rquest = NULL;
|
isp->isp_rquest = NULL;
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
@ -277,12 +277,7 @@ isp_sbus_attach(device_t dev)
|
|||||||
mtx_init(&isp->isp_osinfo.lock, "isp", NULL, MTX_DEF);
|
mtx_init(&isp->isp_osinfo.lock, "isp", NULL, MTX_DEF);
|
||||||
locksetup++;
|
locksetup++;
|
||||||
|
|
||||||
#ifdef ISP_SMPLOCK
|
if (bus_setup_intr(dev, sbs->sbus_ires, ISP_IFLAGS,
|
||||||
#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,
|
|
||||||
isp_sbus_intr, isp, &sbs->ih)) {
|
isp_sbus_intr, isp, &sbs->ih)) {
|
||||||
device_printf(dev, "could not setup interrupt\n");
|
device_printf(dev, "could not setup interrupt\n");
|
||||||
goto bad;
|
goto bad;
|
||||||
@ -476,12 +471,14 @@ isp_sbus_mbxdma(struct ispsoftc *isp)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ISP_UNLOCK(isp);
|
||||||
bl = BUS_SPACE_MAXADDR_24BIT;
|
bl = BUS_SPACE_MAXADDR_24BIT;
|
||||||
|
|
||||||
if (bus_dma_tag_create(NULL, 1, 0, BUS_SPACE_MAXADDR,
|
if (bus_dma_tag_create(NULL, 1, 0, BUS_SPACE_MAXADDR,
|
||||||
BUS_SPACE_MAXADDR, NULL, NULL, BUS_SPACE_MAXSIZE,
|
BUS_SPACE_MAXADDR, NULL, NULL, BUS_SPACE_MAXSIZE,
|
||||||
ISP_NSEGS, bl, 0, &sbs->dmat)) {
|
ISP_NSEGS, bl, 0, &sbs->dmat)) {
|
||||||
isp_prt(isp, ISP_LOGERR, "could not create master dma tag");
|
isp_prt(isp, ISP_LOGERR, "could not create master dma tag");
|
||||||
|
ISP_LOCK(isp);
|
||||||
return(1);
|
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);
|
isp->isp_xflist = (XS_T **) malloc(len, M_DEVBUF, M_WAITOK | M_ZERO);
|
||||||
if (isp->isp_xflist == NULL) {
|
if (isp->isp_xflist == NULL) {
|
||||||
isp_prt(isp, ISP_LOGERR, "cannot alloc xflist array");
|
isp_prt(isp, ISP_LOGERR, "cannot alloc xflist array");
|
||||||
|
ISP_LOCK(isp);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
len = sizeof (bus_dmamap_t) * isp->isp_maxcmds;
|
len = sizeof (bus_dmamap_t) * isp->isp_maxcmds;
|
||||||
@ -497,6 +495,7 @@ isp_sbus_mbxdma(struct ispsoftc *isp)
|
|||||||
if (sbs->dmaps == NULL) {
|
if (sbs->dmaps == NULL) {
|
||||||
isp_prt(isp, ISP_LOGERR, "can't alloc dma map storage");
|
isp_prt(isp, ISP_LOGERR, "can't alloc dma map storage");
|
||||||
free(isp->isp_xflist, M_DEVBUF);
|
free(isp->isp_xflist, M_DEVBUF);
|
||||||
|
ISP_LOCK(isp);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -513,6 +512,7 @@ isp_sbus_mbxdma(struct ispsoftc *isp)
|
|||||||
"cannot create a dma tag for control spaces");
|
"cannot create a dma tag for control spaces");
|
||||||
free(sbs->dmaps, M_DEVBUF);
|
free(sbs->dmaps, M_DEVBUF);
|
||||||
free(isp->isp_xflist, M_DEVBUF);
|
free(isp->isp_xflist, M_DEVBUF);
|
||||||
|
ISP_LOCK(isp);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -523,6 +523,7 @@ isp_sbus_mbxdma(struct ispsoftc *isp)
|
|||||||
bus_dma_tag_destroy(isp->isp_cdmat);
|
bus_dma_tag_destroy(isp->isp_cdmat);
|
||||||
free(isp->isp_xflist, M_DEVBUF);
|
free(isp->isp_xflist, M_DEVBUF);
|
||||||
free(sbs->dmaps, M_DEVBUF);
|
free(sbs->dmaps, M_DEVBUF);
|
||||||
|
ISP_LOCK(isp);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -549,6 +550,7 @@ isp_sbus_mbxdma(struct ispsoftc *isp)
|
|||||||
|
|
||||||
isp->isp_rquest = base;
|
isp->isp_rquest = base;
|
||||||
base += ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp));
|
base += ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp));
|
||||||
|
ISP_LOCK(isp);
|
||||||
isp->isp_result = base;
|
isp->isp_result = base;
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
@ -557,6 +559,7 @@ bad:
|
|||||||
bus_dma_tag_destroy(isp->isp_cdmat);
|
bus_dma_tag_destroy(isp->isp_cdmat);
|
||||||
free(isp->isp_xflist, M_DEVBUF);
|
free(isp->isp_xflist, M_DEVBUF);
|
||||||
free(sbs->dmaps, M_DEVBUF);
|
free(sbs->dmaps, M_DEVBUF);
|
||||||
|
ISP_LOCK(isp);
|
||||||
isp->isp_rquest = NULL;
|
isp->isp_rquest = NULL;
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user