diff options
| author | Scott Long <scottl@FreeBSD.org> | 2013-06-18 00:36:53 +0000 |
|---|---|---|
| committer | Scott Long <scottl@FreeBSD.org> | 2013-06-18 00:36:53 +0000 |
| commit | 039e422c063977ba9073fd2c93883dd8a5a36d48 (patch) | |
| tree | ac9f929e7c22086aea07210a03683e5d77a1f585 /sys/dev/mly | |
| parent | de93d9ce32e709231bb626392d9ae78d08441eb2 (diff) | |
Notes
Diffstat (limited to 'sys/dev/mly')
| -rw-r--r-- | sys/dev/mly/mly.c | 26 | ||||
| -rw-r--r-- | sys/dev/mly/mlyvar.h | 1 |
2 files changed, 11 insertions, 16 deletions
diff --git a/sys/dev/mly/mly.c b/sys/dev/mly/mly.c index 826b89dd48d6..0ab3cd756cc4 100644 --- a/sys/dev/mly/mly.c +++ b/sys/dev/mly/mly.c @@ -1865,9 +1865,13 @@ mly_map_command(struct mly_command *mc) /* does the command have a data buffer? */ if (mc->mc_data != NULL) { - bus_dmamap_load(sc->mly_buffer_dmat, mc->mc_datamap, mc->mc_data, mc->mc_length, - mly_map_command_sg, mc, 0); - + if (mc->mc_flags & MLY_CMD_CCB) + bus_dmamap_load_ccb(sc->mly_buffer_dmat, mc->mc_datamap, + mc->mc_data, mly_map_command_sg, mc, 0); + else + bus_dmamap_load(sc->mly_buffer_dmat, mc->mc_datamap, + mc->mc_data, mc->mc_length, + mly_map_command_sg, mc, 0); if (mc->mc_flags & MLY_CMD_DATAIN) bus_dmamap_sync(sc->mly_buffer_dmat, mc->mc_datamap, BUS_DMASYNC_PREREAD); if (mc->mc_flags & MLY_CMD_DATAOUT) @@ -2221,18 +2225,6 @@ mly_cam_action_io(struct cam_sim *sim, struct ccb_scsiio *csio) csio->ccb_h.status = CAM_REQ_CMP_ERR; } - /* if there is data transfer, it must be to/from a virtual address */ - if ((csio->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE) { - if (csio->ccb_h.flags & CAM_DATA_PHYS) { /* we can't map it */ - debug(0, " data pointer is to physical address"); - csio->ccb_h.status = CAM_REQ_CMP_ERR; - } - if (csio->ccb_h.flags & CAM_SCATTER_VALID) { /* we want to do the s/g setup */ - debug(0, " data has premature s/g setup"); - csio->ccb_h.status = CAM_REQ_CMP_ERR; - } - } - /* abandon aborted ccbs or those that have failed validation */ if ((csio->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_INPROG) { debug(2, "abandoning CCB due to abort/validation failure"); @@ -2252,10 +2244,12 @@ mly_cam_action_io(struct cam_sim *sim, struct ccb_scsiio *csio) } /* build the command */ - mc->mc_data = csio->data_ptr; + mc->mc_data = csio; mc->mc_length = csio->dxfer_len; mc->mc_complete = mly_cam_complete; mc->mc_private = csio; + mc->mc_flags |= MLY_CMD_CCB; + /* XXX This code doesn't set the data direction in mc_flags. */ /* save the bus number in the ccb for later recovery XXX should be a better way */ csio->ccb_h.sim_priv.entries[0].field = bus; diff --git a/sys/dev/mly/mlyvar.h b/sys/dev/mly/mlyvar.h index 62e674c73634..7413fa40e9eb 100644 --- a/sys/dev/mly/mlyvar.h +++ b/sys/dev/mly/mlyvar.h @@ -126,6 +126,7 @@ struct mly_command { #define MLY_CMD_MAPPED (1<<3) /* command has had its data mapped */ #define MLY_CMD_DATAIN (1<<4) /* data moves controller->system */ #define MLY_CMD_DATAOUT (1<<5) /* data moves system->controller */ +#define MLY_CMD_CCB (1<<6) /* data is ccb. */ u_int16_t mc_status; /* command completion status */ u_int8_t mc_sense; /* sense data length */ int32_t mc_resid; /* I/O residual count */ |
