summaryrefslogtreecommitdiffstats
path: root/sys/dev/isp/isp_pci.c
diff options
context:
space:
mode:
authormjacob <mjacob@FreeBSD.org>2010-02-03 21:09:32 +0000
committermjacob <mjacob@FreeBSD.org>2010-02-03 21:09:32 +0000
commitdf42a0ca6b960167d6735a4fb358950b6d690ce6 (patch)
treefdde0434a01b70cd56bc51a41aa3aaccfc6b07f8 /sys/dev/isp/isp_pci.c
parentc499a83bba8f8470ae5c8ef7a572fe3892a87d8c (diff)
downloadFreeBSD-src-df42a0ca6b960167d6735a4fb358950b6d690ce6.zip
FreeBSD-src-df42a0ca6b960167d6735a4fb358950b6d690ce6.tar.gz
Redo how commands handles are created and managed and implement sequence
numbers and handle types in rational way. This will better protect from (unwittingly) dealing with stale handles/commands. Fix the watchdog timeout code to better protect itself from mistakes. If we run an abort on a putatively timed out command, the command may in fact get completed, so check to make sure the command we're timing it out is still around. If the abort succeeds, btw, the command should get returned via a different path.
Diffstat (limited to 'sys/dev/isp/isp_pci.c')
-rw-r--r--sys/dev/isp/isp_pci.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/sys/dev/isp/isp_pci.c b/sys/dev/isp/isp_pci.c
index 47dd350..4eb2e0c 100644
--- a/sys/dev/isp/isp_pci.c
+++ b/sys/dev/isp/isp_pci.c
@@ -1516,17 +1516,21 @@ isp_pci_mbxdma(ispsoftc_t *isp)
return (1);
}
- len = sizeof (XS_T **) * isp->isp_maxcmds;
- isp->isp_xflist = (XS_T **) malloc(len, M_DEVBUF, M_WAITOK | M_ZERO);
+ len = sizeof (isp_hdl_t) * isp->isp_maxcmds;
+ isp->isp_xflist = (isp_hdl_t *) malloc(len, M_DEVBUF, M_WAITOK | M_ZERO);
if (isp->isp_xflist == NULL) {
free(isp->isp_osinfo.pcmd_pool, M_DEVBUF);
ISP_LOCK(isp);
isp_prt(isp, ISP_LOGERR, "cannot alloc xflist array");
return (1);
}
+ for (len = 0; len < isp->isp_maxcmds - 1; len++) {
+ isp->isp_xflist[len].cmd = &isp->isp_xflist[len+1];
+ }
+ isp->isp_xffree = isp->isp_xflist;
#ifdef ISP_TARGET_MODE
- len = sizeof (void **) * isp->isp_maxcmds;
- isp->isp_tgtlist = (void **) malloc(len, M_DEVBUF, M_WAITOK | M_ZERO);
+ len = sizeof (isp_hdl_t *) * isp->isp_maxcmds;
+ isp->isp_tgtlist = (isp_hdl_t *) malloc(len, M_DEVBUF, M_WAITOK | M_ZERO);
if (isp->isp_tgtlist == NULL) {
free(isp->isp_osinfo.pcmd_pool, M_DEVBUF);
free(isp->isp_xflist, M_DEVBUF);
@@ -1534,6 +1538,10 @@ isp_pci_mbxdma(ispsoftc_t *isp)
isp_prt(isp, ISP_LOGERR, "cannot alloc tgtlist array");
return (1);
}
+ for (len = 0; len < isp->isp_maxcmds - 1; len++) {
+ isp->isp_tgtlist[len].cmd = &isp->isp_tgtlist[len+1];
+ }
+ isp->isp_tgtfree = isp->isp_tgtlist;
#endif
/*
OpenPOWER on IntegriCloud