summaryrefslogtreecommitdiffstats
path: root/sys/cam/scsi/scsi_all.h
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2014-07-15 16:53:04 +0000
committermav <mav@FreeBSD.org>2014-07-15 16:53:04 +0000
commitda977d403200a33558605a0f258a3e6077c11715 (patch)
treee062ae0acdb1b8c16556219c08351e0f214b2d20 /sys/cam/scsi/scsi_all.h
parenta64cd56a0c4811ba51098860f900a27da548caaf (diff)
downloadFreeBSD-src-da977d403200a33558605a0f258a3e6077c11715.zip
FreeBSD-src-da977d403200a33558605a0f258a3e6077c11715.tar.gz
MFC r268096, r268306, r268361:
Add more formal and strict command parsing and validation. For every supported command define CDB length and mask of bits that are allowed to be set. This allows to remove bunch of checks through the code and still make the validation more strict. To properly do it for commands supporting multiple service actions, formalize their parsing by adding subtables for each of such commands. As visible effect, this change allows to add support for REPORT SUPPORTED OPERATION CODES command, reporting to client all the data about supported SCSI commands, except timeouts.
Diffstat (limited to 'sys/cam/scsi/scsi_all.h')
-rw-r--r--sys/cam/scsi/scsi_all.h82
1 files changed, 82 insertions, 0 deletions
diff --git a/sys/cam/scsi/scsi_all.h b/sys/cam/scsi/scsi_all.h
index 11a500c..545f493 100644
--- a/sys/cam/scsi/scsi_all.h
+++ b/sys/cam/scsi/scsi_all.h
@@ -977,6 +977,88 @@ struct scsi_maintenance_in
uint8_t control;
};
+struct scsi_report_supported_opcodes
+{
+ uint8_t opcode;
+ uint8_t service_action;
+ uint8_t options;
+#define RSO_RCTD 0x80
+#define RSO_OPTIONS_MASK 0x07
+#define RSO_OPTIONS_ALL 0x00
+#define RSO_OPTIONS_OC 0x01
+#define RSO_OPTIONS_OC_SA 0x02
+ uint8_t requested_opcode;
+ uint8_t requested_service_action[2];
+ uint8_t length[4];
+ uint8_t reserved1;
+ uint8_t control;
+};
+
+struct scsi_report_supported_opcodes_timeout
+{
+ uint8_t length[2];
+ uint8_t reserved;
+ uint8_t cmd_specific;
+ uint8_t nominal_time[4];
+ uint8_t recommended_time[4];
+};
+
+struct scsi_report_supported_opcodes_descr
+{
+ uint8_t opcode;
+ uint8_t reserved;
+ uint8_t service_action[2];
+ uint8_t reserved2;
+ uint8_t flags;
+#define RSO_SERVACTV 0x01
+#define RSO_CTDP 0x02
+ uint8_t cdb_length[2];
+ struct scsi_report_supported_opcodes_timeout timeout[0];
+};
+
+struct scsi_report_supported_opcodes_all
+{
+ uint8_t length[4];
+ struct scsi_report_supported_opcodes_descr descr[0];
+};
+
+struct scsi_report_supported_opcodes_one
+{
+ uint8_t reserved;
+ uint8_t support;
+#define RSO_ONE_CTDP 0x80
+ uint8_t cdb_length[2];
+ uint8_t cdb_usage[];
+};
+
+struct scsi_report_supported_tmf
+{
+ uint8_t opcode;
+ uint8_t service_action;
+ uint8_t reserved[4];
+ uint8_t length[4];
+ uint8_t reserved1;
+ uint8_t control;
+};
+
+struct scsi_report_supported_tmf_data
+{
+ uint8_t byte1;
+#define RST_WAKES 0x01
+#define RST_TRS 0x02
+#define RST_QTS 0x04
+#define RST_LURS 0x08
+#define RST_CTSS 0x10
+#define RST_CACAS 0x20
+#define RST_ATSS 0x40
+#define RST_ATS 0x80
+ uint8_t byte2;
+#define RST_ITNRS 0x01
+#define RST_QTSS 0x02
+#define RST_QAES 0x04
+ uint8_t reserved[2];
+};
+
struct ata_pass_16 {
u_int8_t opcode;
u_int8_t protocol;
OpenPOWER on IntegriCloud