summaryrefslogtreecommitdiffstats
path: root/sys/dev/ciss/ciss.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2013-02-12 16:57:20 +0000
committerkib <kib@FreeBSD.org>2013-02-12 16:57:20 +0000
commitbd7f0fa0bb4b7b0f87227e0c4d49a4bd9b113cf0 (patch)
treee550f2c754f1edf951a8b93963ebcfc4fa0d20ce /sys/dev/ciss/ciss.c
parente0a463e76c719f11788ec107b5aa3e2da4e57c0b (diff)
downloadFreeBSD-src-bd7f0fa0bb4b7b0f87227e0c4d49a4bd9b113cf0.zip
FreeBSD-src-bd7f0fa0bb4b7b0f87227e0c4d49a4bd9b113cf0.tar.gz
Reform the busdma API so that new types may be added without modifying
every architecture's busdma_machdep.c. It is done by unifying the bus_dmamap_load_buffer() routines so that they may be called from MI code. The MD busdma is then given a chance to do any final processing in the complete() callback. The cam changes unify the bus_dmamap_load* handling in cam drivers. The arm and mips implementations are updated to track virtual addresses for sync(). Previously this was done in a type specific way. Now it is done in a generic way by recording the list of virtuals in the map. Submitted by: jeff (sponsored by EMC/Isilon) Reviewed by: kan (previous version), scottl, mjacob (isp(4), no objections for target mode changes) Discussed with: ian (arm changes) Tested by: marius (sparc64), mips (jmallet), isci(4) on x86 (jharris), amd64 (Fabian Keil <freebsd-listen@fabiankeil.de>)
Diffstat (limited to 'sys/dev/ciss/ciss.c')
-rw-r--r--sys/dev/ciss/ciss.c30
1 files changed, 12 insertions, 18 deletions
diff --git a/sys/dev/ciss/ciss.c b/sys/dev/ciss/ciss.c
index a3f0a4a..9aef998 100644
--- a/sys/dev/ciss/ciss.c
+++ b/sys/dev/ciss/ciss.c
@@ -2688,9 +2688,14 @@ ciss_map_request(struct ciss_request *cr)
BUS_DMASYNC_PREWRITE);
if (cr->cr_data != NULL) {
- error = bus_dmamap_load(sc->ciss_buffer_dmat, cr->cr_datamap,
- cr->cr_data, cr->cr_length,
- ciss_request_map_helper, cr, 0);
+ if (cr->cr_flags & CISS_REQ_CCB)
+ error = bus_dmamap_load_ccb(sc->ciss_buffer_dmat,
+ cr->cr_datamap, cr->cr_data,
+ ciss_request_map_helper, cr, 0);
+ else
+ error = bus_dmamap_load(sc->ciss_buffer_dmat, cr->cr_datamap,
+ cr->cr_data, cr->cr_length,
+ ciss_request_map_helper, cr, 0);
if (error != 0)
return (error);
} else {
@@ -3056,18 +3061,6 @@ ciss_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(3, " 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(3, " 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(3, "abandoning CCB due to abort/validation failure");
@@ -3094,7 +3087,7 @@ ciss_cam_action_io(struct cam_sim *sim, struct ccb_scsiio *csio)
* Build the command.
*/
cc = cr->cr_cc;
- cr->cr_data = csio->data_ptr;
+ cr->cr_data = csio;
cr->cr_length = csio->dxfer_len;
cr->cr_complete = ciss_cam_complete;
cr->cr_private = csio;
@@ -3112,12 +3105,13 @@ ciss_cam_action_io(struct cam_sim *sim, struct ccb_scsiio *csio)
cc->cdb.type = CISS_CDB_TYPE_COMMAND;
cc->cdb.attribute = CISS_CDB_ATTRIBUTE_SIMPLE; /* XXX ordered tags? */
if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_OUT) {
- cr->cr_flags = CISS_REQ_DATAOUT;
+ cr->cr_flags = CISS_REQ_DATAOUT | CISS_REQ_CCB;
cc->cdb.direction = CISS_CDB_DIRECTION_WRITE;
} else if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) {
- cr->cr_flags = CISS_REQ_DATAIN;
+ cr->cr_flags = CISS_REQ_DATAIN | CISS_REQ_CCB;
cc->cdb.direction = CISS_CDB_DIRECTION_READ;
} else {
+ cr->cr_data = NULL;
cr->cr_flags = 0;
cc->cdb.direction = CISS_CDB_DIRECTION_NONE;
}
OpenPOWER on IntegriCloud