summaryrefslogtreecommitdiffstats
path: root/sys/cam
diff options
context:
space:
mode:
authorken <ken@FreeBSD.org>2006-08-21 13:24:50 +0000
committerken <ken@FreeBSD.org>2006-08-21 13:24:50 +0000
commitc31cf4b01516585cb63d0b90a8cecf736e3453a3 (patch)
tree16fa26af6dcf7ca80318714e8854e79e7946e6e6 /sys/cam
parent4bb293498f03b924b64e0987241f63cc81102adc (diff)
downloadFreeBSD-src-c31cf4b01516585cb63d0b90a8cecf736e3453a3.zip
FreeBSD-src-c31cf4b01516585cb63d0b90a8cecf736e3453a3.tar.gz
Implement 'camcontrol reportluns'. This allows users to send the SCSI
REPORT LUNS command to a device. camcontrol.[c8]: Implement reportluns. This tries to print the LUNs out in a reasonable format. Only the periph addressing method has been tested, since very little hardware that I know of supports the other methods. scsi_all.[ch]: Revamp the report luns CDB structure and helper functions. This constitutes a little bit of an API change, but since the old CDB length was 10 bytes, and the REPORT LUNS CDB length is actually 12 bytes, it's clear that no one was using this API in the first place. MFC After: 1 week
Diffstat (limited to 'sys/cam')
-rw-r--r--sys/cam/scsi/scsi_all.c8
-rw-r--r--sys/cam/scsi/scsi_all.h42
2 files changed, 35 insertions, 15 deletions
diff --git a/sys/cam/scsi/scsi_all.c b/sys/cam/scsi/scsi_all.c
index 4c51148..adaef35 100644
--- a/sys/cam/scsi/scsi_all.c
+++ b/sys/cam/scsi/scsi_all.c
@@ -2749,8 +2749,9 @@ scsi_read_capacity_16(struct ccb_scsiio *csio, uint32_t retries,
void
scsi_report_luns(struct ccb_scsiio *csio, u_int32_t retries,
void (*cbfcnp)(struct cam_periph *, union ccb *),
- u_int8_t tag_action, struct scsi_report_luns_data *rpl_buf,
- u_int32_t alloc_len, u_int8_t sense_len, u_int32_t timeout)
+ u_int8_t tag_action, u_int8_t select_report,
+ struct scsi_report_luns_data *rpl_buf, u_int32_t alloc_len,
+ u_int8_t sense_len, u_int32_t timeout)
{
struct scsi_report_luns *scsi_cmd;
@@ -2767,7 +2768,8 @@ scsi_report_luns(struct ccb_scsiio *csio, u_int32_t retries,
scsi_cmd = (struct scsi_report_luns *)&csio->cdb_io.cdb_bytes;
bzero(scsi_cmd, sizeof(*scsi_cmd));
scsi_cmd->opcode = REPORT_LUNS;
- scsi_ulto4b(alloc_len, scsi_cmd->addr);
+ scsi_cmd->select_report = select_report;
+ scsi_ulto4b(alloc_len, scsi_cmd->length);
}
/*
diff --git a/sys/cam/scsi/scsi_all.h b/sys/cam/scsi/scsi_all.h
index 33b26de..8d320d9 100644
--- a/sys/cam/scsi/scsi_all.h
+++ b/sys/cam/scsi/scsi_all.h
@@ -708,11 +708,16 @@ struct scsi_read_capacity_data_long
struct scsi_report_luns
{
- u_int8_t opcode;
- u_int8_t byte2;
- u_int8_t unused[3];
- u_int8_t addr[4];
- u_int8_t control;
+ uint8_t opcode;
+ uint8_t reserved1;
+#define RPL_REPORT_DEFAULT 0x00
+#define RPL_REPORT_WELLKNOWN 0x01
+#define RPL_REPORT_ALL 0x02
+ uint8_t select_report;
+ uint8_t reserved2[3];
+ uint8_t length[4];
+ uint8_t reserved3;
+ uint8_t control;
};
struct scsi_report_luns_data {
@@ -723,10 +728,22 @@ struct scsi_report_luns_data {
*/
struct {
u_int8_t lundata[8];
- } luns[1];
+ } luns[0];
};
+#define RPL_LUNDATA_PERIPH_BUS_MASK 0x3f
+#define RPL_LUNDATA_FLAT_LUN_MASK 0x3f
+#define RPL_LUNDATA_LUN_TARG_MASK 0x3f
+#define RPL_LUNDATA_LUN_BUS_MASK 0xe0
+#define RPL_LUNDATA_LUN_LUN_MASK 0x1f
+#define RPL_LUNDATA_EXT_LEN_MASK 0x30
+#define RPL_LUNDATA_EXT_EAM_MASK 0x0f
+#define RPL_LUNDATA_EXT_EAM_WK 0x01
+#define RPL_LUNDATA_EXT_EAM_NOT_SPEC 0x0f
#define RPL_LUNDATA_ATYP_MASK 0xc0 /* MBZ for type 0 lun */
-#define RPL_LUNDATA_T0LUN 1 /* @ lundata[1] */
+#define RPL_LUNDATA_ATYP_PERIPH 0x00
+#define RPL_LUNDATA_ATYP_FLAT 0x40
+#define RPL_LUNDATA_ATYP_LUN 0x80
+#define RPL_LUNDATA_ATYP_EXTLUN 0xc0
struct scsi_sense_data
@@ -1035,11 +1052,12 @@ void scsi_read_capacity_16(struct ccb_scsiio *csio, uint32_t retries,
uint32_t timeout);
void scsi_report_luns(struct ccb_scsiio *csio, u_int32_t retries,
- void (*cbfcnp)(struct cam_periph *,
- union ccb *), u_int8_t tag_action,
- struct scsi_report_luns_data *,
- u_int32_t alloc_len, u_int8_t sense_len,
- u_int32_t timeout);
+ void (*cbfcnp)(struct cam_periph *,
+ union ccb *), u_int8_t tag_action,
+ u_int8_t select_report,
+ struct scsi_report_luns_data *rpl_buf,
+ u_int32_t alloc_len, u_int8_t sense_len,
+ u_int32_t timeout);
void scsi_synchronize_cache(struct ccb_scsiio *csio,
u_int32_t retries,
OpenPOWER on IntegriCloud