summaryrefslogtreecommitdiffstats
path: root/sys/cam/scsi/scsi_all.c
diff options
context:
space:
mode:
authormjacob <mjacob@FreeBSD.org>2010-06-08 05:14:18 +0000
committermjacob <mjacob@FreeBSD.org>2010-06-08 05:14:18 +0000
commit3597cbf7d34333ab58b3a9d40a8c21db71c6aec0 (patch)
tree731de68005a4cd2f04fd06c528eaa5a6a07466fd /sys/cam/scsi/scsi_all.c
parent8bbbdc4764a3fb1583b5f25c105e7e73278c5f29 (diff)
downloadFreeBSD-src-3597cbf7d34333ab58b3a9d40a8c21db71c6aec0.zip
FreeBSD-src-3597cbf7d34333ab58b3a9d40a8c21db71c6aec0.tar.gz
Make additional definitions up to and including SPC-4. Add in definitions
for REPORT and SET TARGET PORT GROUP commands (foundations for future work). Regularize opcodes to be upper case hex. Pick *one* of tab or space after #define (tab) and stick with that. MFC after: 2 weeks
Diffstat (limited to 'sys/cam/scsi/scsi_all.c')
-rw-r--r--sys/cam/scsi/scsi_all.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/sys/cam/scsi/scsi_all.c b/sys/cam/scsi/scsi_all.c
index d40a536..cddac5c 100644
--- a/sys/cam/scsi/scsi_all.c
+++ b/sys/cam/scsi/scsi_all.c
@@ -3954,6 +3954,57 @@ scsi_report_luns(struct ccb_scsiio *csio, u_int32_t retries,
scsi_ulto4b(alloc_len, scsi_cmd->length);
}
+void
+scsi_report_target_group(struct ccb_scsiio *csio, u_int32_t retries,
+ void (*cbfcnp)(struct cam_periph *, union ccb *),
+ u_int8_t tag_action, u_int8_t pdf,
+ void *buf, u_int32_t alloc_len,
+ u_int8_t sense_len, u_int32_t timeout)
+{
+ struct scsi_target_group *scsi_cmd;
+
+ cam_fill_csio(csio,
+ retries,
+ cbfcnp,
+ /*flags*/CAM_DIR_IN,
+ tag_action,
+ /*data_ptr*/(u_int8_t *)buf,
+ /*dxfer_len*/alloc_len,
+ sense_len,
+ sizeof(*scsi_cmd),
+ timeout);
+ scsi_cmd = (struct scsi_target_group *)&csio->cdb_io.cdb_bytes;
+ bzero(scsi_cmd, sizeof(*scsi_cmd));
+ scsi_cmd->opcode = MAINTENANCE_IN;
+ scsi_cmd->service_action = REPORT_TARGET_PORT_GROUPS | pdf;
+ scsi_ulto4b(alloc_len, scsi_cmd->length);
+}
+
+void
+scsi_set_target_group(struct ccb_scsiio *csio, u_int32_t retries,
+ void (*cbfcnp)(struct cam_periph *, union ccb *),
+ u_int8_t tag_action, void *buf, u_int32_t alloc_len,
+ u_int8_t sense_len, u_int32_t timeout)
+{
+ struct scsi_target_group *scsi_cmd;
+
+ cam_fill_csio(csio,
+ retries,
+ cbfcnp,
+ /*flags*/CAM_DIR_OUT,
+ tag_action,
+ /*data_ptr*/(u_int8_t *)buf,
+ /*dxfer_len*/alloc_len,
+ sense_len,
+ sizeof(*scsi_cmd),
+ timeout);
+ scsi_cmd = (struct scsi_target_group *)&csio->cdb_io.cdb_bytes;
+ bzero(scsi_cmd, sizeof(*scsi_cmd));
+ scsi_cmd->opcode = MAINTENANCE_OUT;
+ scsi_cmd->service_action = SET_TARGET_PORT_GROUPS;
+ scsi_ulto4b(alloc_len, scsi_cmd->length);
+}
+
/*
* Syncronize the media to the contents of the cache for
* the given lba/count pair. Specifying 0/0 means sync
OpenPOWER on IntegriCloud