summaryrefslogtreecommitdiffstats
path: root/sys/dev/isp/isp_pci.c
diff options
context:
space:
mode:
authormjacob <mjacob@FreeBSD.org>2007-04-02 01:04:20 +0000
committermjacob <mjacob@FreeBSD.org>2007-04-02 01:04:20 +0000
commit00323bff58a4642e190d904bae8a04685867f87c (patch)
tree301dc2dba02ff47c95da310a9856c01c9754f539 /sys/dev/isp/isp_pci.c
parent65a30c481ba0f8b44f073c893e9d5dbc5747a5d1 (diff)
downloadFreeBSD-src-00323bff58a4642e190d904bae8a04685867f87c.zip
FreeBSD-src-00323bff58a4642e190d904bae8a04685867f87c.tar.gz
Temporarily desupport simultaneous target and initiator mode.
When the linux port changes were imported which split the target command list to be separate from the initiator command list and the handle format changed to encode a type in the handle the implications to the function isp_handle_index (which only the NetBSD/OpenBSD/FreeBSD ports use) were overlooked. The fault is twofold: first, the index into the DMA maps in isp_pci is wrong because a target command handle with the type bit left in place caused a bad index (and panic) into dma map. Secondly, the assumption of the array of DMA maps in either PCS or SBUS attachment structures is that there is a linear mapping between handle index and DMA map index. This can no longer be true if there are overlapping index spaces for initiator mode and target mode commands. These changes bandaid around the problem by forcing us to not have simultaneous dual roles and doing the appropriate masking to make sure things are indexed correctly. A longer term fix is being devloped.
Diffstat (limited to 'sys/dev/isp/isp_pci.c')
-rw-r--r--sys/dev/isp/isp_pci.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/sys/dev/isp/isp_pci.c b/sys/dev/isp/isp_pci.c
index 7b5a326..390a60f 100644
--- a/sys/dev/isp/isp_pci.c
+++ b/sys/dev/isp/isp_pci.c
@@ -1994,7 +1994,7 @@ tdma_mk(void *arg, bus_dma_segment_t *dm_segs, int nseg, int error)
cto->ct_scsi_status = 0;
pcs = (struct isp_pcisoftc *)isp;
- dp = &pcs->dmaps[isp_handle_index(handle)];
+ dp = &pcs->dmaps[isp_handle_index(handle & ISP_HANDLE_MASK)];
if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) {
bus_dmamap_sync(pcs->dmat, *dp, BUS_DMASYNC_PREREAD);
} else {
@@ -2388,7 +2388,7 @@ dma_2400(void *arg, bus_dma_segment_t *dm_segs, int nseg, int error)
isp = mp->isp;
rq = mp->rq;
pcs = (struct isp_pcisoftc *)mp->isp;
- dp = &pcs->dmaps[isp_handle_index(rq->req_handle)];
+ dp = &pcs->dmaps[isp_handle_index(rq->req_handle & ISP_HANDLE_MASK)];
nxti = *mp->nxtip;
if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) {
@@ -2494,7 +2494,7 @@ dma2_a64(void *arg, bus_dma_segment_t *dm_segs, int nseg, int error)
isp = mp->isp;
rq = mp->rq;
pcs = (struct isp_pcisoftc *)mp->isp;
- dp = &pcs->dmaps[isp_handle_index(rq->req_handle)];
+ dp = &pcs->dmaps[isp_handle_index(rq->req_handle & ISP_HANDLE_MASK)];
nxti = *mp->nxtip;
if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) {
@@ -2628,7 +2628,7 @@ dma2(void *arg, bus_dma_segment_t *dm_segs, int nseg, int error)
isp = mp->isp;
rq = mp->rq;
pcs = (struct isp_pcisoftc *)mp->isp;
- dp = &pcs->dmaps[isp_handle_index(rq->req_handle)];
+ dp = &pcs->dmaps[isp_handle_index(rq->req_handle & ISP_HANDLE_MASK)];
nxti = *mp->nxtip;
if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) {
@@ -2795,7 +2795,8 @@ isp_pci_dmasetup(ispsoftc_t *isp, struct ccb_scsiio *csio, ispreq_t *rq,
if ((csio->ccb_h.flags & CAM_SCATTER_VALID) == 0) {
if ((csio->ccb_h.flags & CAM_DATA_PHYS) == 0) {
int error, s;
- dp = &pcs->dmaps[isp_handle_index(rq->req_handle)];
+ dp = &pcs->dmaps[isp_handle_index(
+ rq->req_handle & ISP_HANDLE_MASK)];
s = splsoftvm();
error = bus_dmamap_load(pcs->dmat, *dp,
csio->data_ptr, csio->dxfer_len, eptr, mp, 0);
@@ -2880,7 +2881,8 @@ static void
isp_pci_dmateardown(ispsoftc_t *isp, XS_T *xs, uint32_t handle)
{
struct isp_pcisoftc *pcs = (struct isp_pcisoftc *)isp;
- bus_dmamap_t *dp = &pcs->dmaps[isp_handle_index(handle)];
+ bus_dmamap_t *dp;
+ dp = &pcs->dmaps[isp_handle_index(handle & ISP_HANDLE_MASK)];
if ((xs->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) {
bus_dmamap_sync(pcs->dmat, *dp, BUS_DMASYNC_POSTREAD);
} else {
OpenPOWER on IntegriCloud