aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/isp
diff options
context:
space:
mode:
authorMatt Jacob <mjacob@FreeBSD.org>2012-08-12 20:45:47 +0000
committerMatt Jacob <mjacob@FreeBSD.org>2012-08-12 20:45:47 +0000
commit405b7a290372d08bb6f232d31ae1c045ce0b09fb (patch)
treedfd478a66cf4863f18253026e820d0b0ac26cc30 /sys/dev/isp
parente5561269e1ee4da655ac1aaf8c11f833e4ebf0dd (diff)
Notes
Diffstat (limited to 'sys/dev/isp')
-rw-r--r--sys/dev/isp/isp_freebsd.c29
-rw-r--r--sys/dev/isp/isp_pci.c22
2 files changed, 33 insertions, 18 deletions
diff --git a/sys/dev/isp/isp_freebsd.c b/sys/dev/isp/isp_freebsd.c
index 52c1c7eef0cc3..8adea0a305e7f 100644
--- a/sys/dev/isp/isp_freebsd.c
+++ b/sys/dev/isp/isp_freebsd.c
@@ -779,8 +779,13 @@ static ISP_INLINE void
isp_free_pcmd(ispsoftc_t *isp, union ccb *ccb)
{
if (ISP_PCMD(ccb)) {
- memset(ISP_PCMD(ccb), 0, sizeof (struct isp_pcmd));
- ((struct isp_pcmd *)ISP_PCMD(ccb))->next = isp->isp_osinfo.pcmd_free;
+#ifdef ISP_TARGET_MODE
+ PISP_PCMD(ccb)->datalen = 0;
+ PISP_PCMD(ccb)->totslen = 0;
+ PISP_PCMD(ccb)->cumslen = 0;
+ PISP_PCMD(ccb)->crn = 0;
+#endif
+ PISP_PCMD(ccb)->next = isp->isp_osinfo.pcmd_free;
isp->isp_osinfo.pcmd_free = ISP_PCMD(ccb);
ISP_PCMD(ccb) = NULL;
}
@@ -6326,12 +6331,20 @@ isp_common_dmateardown(ispsoftc_t *isp, struct ccb_scsiio *csio, uint32_t hdl)
int
isp_fcp_next_crn(ispsoftc_t *isp, uint8_t *crnp, XS_T *cmd)
{
- uint32_t chan = XS_CHANNEL(cmd);
- uint32_t tgt = XS_TGT(cmd);
- uint32_t lun = XS_LUN(cmd);
- struct isp_fc *fc = &isp->isp_osinfo.pc.fc[chan];
- int idx = NEXUS_HASH(tgt, lun);
- struct isp_nexus *nxp = fc->nexus_hash[idx];
+ uint32_t chan, tgt, lun;
+ struct isp_fc *fc;
+ struct isp_nexus *nxp;
+ int idx;
+
+ if (isp->isp_type < ISP_HA_FC_2300)
+ return (0);
+
+ chan = XS_CHANNEL(cmd);
+ tgt = XS_TGT(cmd);
+ lun = XS_LUN(cmd);
+ fc = &isp->isp_osinfo.pc.fc[chan];
+ idx = NEXUS_HASH(tgt, lun);
+ nxp = fc->nexus_hash[idx];
while (nxp) {
if (nxp->tgt == tgt && nxp->lun == lun)
diff --git a/sys/dev/isp/isp_pci.c b/sys/dev/isp/isp_pci.c
index d4a214b69518e..853856a277269 100644
--- a/sys/dev/isp/isp_pci.c
+++ b/sys/dev/isp/isp_pci.c
@@ -1690,18 +1690,20 @@ isp_pci_mbxdma(ispsoftc_t *isp)
bus_dma_tag_destroy(fc->tdmat);
goto bad;
}
- for (i = 0; i < INITIAL_NEXUS_COUNT; i++) {
- struct isp_nexus *n = malloc(sizeof (struct isp_nexus), M_DEVBUF, M_NOWAIT | M_ZERO);
- if (n == NULL) {
- while (fc->nexus_free_list) {
- n = fc->nexus_free_list;
- fc->nexus_free_list = n->next;
- free(n, M_DEVBUF);
+ if (isp->isp_type >= ISP_HA_FC_2300) {
+ for (i = 0; i < INITIAL_NEXUS_COUNT; i++) {
+ struct isp_nexus *n = malloc(sizeof (struct isp_nexus), M_DEVBUF, M_NOWAIT | M_ZERO);
+ if (n == NULL) {
+ while (fc->nexus_free_list) {
+ n = fc->nexus_free_list;
+ fc->nexus_free_list = n->next;
+ free(n, M_DEVBUF);
+ }
+ goto bad;
}
- goto bad;
+ n->next = fc->nexus_free_list;
+ fc->nexus_free_list = n;
}
- n->next = fc->nexus_free_list;
- fc->nexus_free_list = n;
}
}
}