Add handling of inquiry version descriptors
This commit is contained in:
@@ -375,6 +375,43 @@ enum scsi_version {
|
|||||||
|
|
||||||
EXTERN const char *scsi_version_to_str(enum scsi_version version);
|
EXTERN const char *scsi_version_to_str(enum scsi_version version);
|
||||||
|
|
||||||
|
enum scsi_version_descriptor {
|
||||||
|
SCSI_VERSION_DESCRIPTOR_ISCSI = 0x0960,
|
||||||
|
SCSI_VERSION_DESCRIPTOR_SBC = 0x0180,
|
||||||
|
SCSI_VERSION_DESCRIPTOR_SBC_ANSI_INCITS_306_1998 = 0x019C,
|
||||||
|
SCSI_VERSION_DESCRIPTOR_SBC_T10_0996_D_R08C = 0x019B,
|
||||||
|
SCSI_VERSION_DESCRIPTOR_SBC_2 = 0x0320,
|
||||||
|
SCSI_VERSION_DESCRIPTOR_SBC_2_ISO_IEC_14776_322 = 0x033E,
|
||||||
|
SCSI_VERSION_DESCRIPTOR_SBC_2_ANSI_INCITS_405_2005 = 0x033D,
|
||||||
|
SCSI_VERSION_DESCRIPTOR_SBC_2_T10_1417_D_R16 = 0x033B,
|
||||||
|
SCSI_VERSION_DESCRIPTOR_SBC_2_T10_1417_D_R5A = 0x0322,
|
||||||
|
SCSI_VERSION_DESCRIPTOR_SBC_2_T10_1417_D_R15 = 0x0324,
|
||||||
|
SCSI_VERSION_DESCRIPTOR_SBC_3 = 0x04C0,
|
||||||
|
SCSI_VERSION_DESCRIPTOR_SPC = 0x0120,
|
||||||
|
SCSI_VERSION_DESCRIPTOR_SPC_ANSI_INCITS_301_1997 = 0x013C,
|
||||||
|
SCSI_VERSION_DESCRIPTOR_SPC_T10_0995_D_R11A = 0x013B,
|
||||||
|
SCSI_VERSION_DESCRIPTOR_SPC_2 = 0x0260,
|
||||||
|
SCSI_VERSION_DESCRIPTOR_SPC_2_ISO_IEC_14776_452 = 0x0278,
|
||||||
|
SCSI_VERSION_DESCRIPTOR_SPC_2_ANSI_INCITS_351_2001 = 0x0277,
|
||||||
|
SCSI_VERSION_DESCRIPTOR_SPC_2_T10_1236_D_R20 = 0x0276,
|
||||||
|
SCSI_VERSION_DESCRIPTOR_SPC_2_T10_1236_D_R12 = 0x0267,
|
||||||
|
SCSI_VERSION_DESCRIPTOR_SPC_2_T10_1236_D_R18 = 0x0269,
|
||||||
|
SCSI_VERSION_DESCRIPTOR_SPC_2_T10_1236_D_R19 = 0x0275,
|
||||||
|
SCSI_VERSION_DESCRIPTOR_SPC_3 = 0x0300,
|
||||||
|
SCSI_VERSION_DESCRIPTOR_SPC_3_ISO_IEC_14776_453 = 0x0316,
|
||||||
|
SCSI_VERSION_DESCRIPTOR_SPC_3_ANSI_INCITS_408_2005 = 0x0314,
|
||||||
|
SCSI_VERSION_DESCRIPTOR_SPC_3_T10_1416_D_R7 = 0x0301,
|
||||||
|
SCSI_VERSION_DESCRIPTOR_SPC_3_T10_1416_D_R21 = 0x0307,
|
||||||
|
SCSI_VERSION_DESCRIPTOR_SPC_3_T10_1416_D_R22 = 0x030F,
|
||||||
|
SCSI_VERSION_DESCRIPTOR_SPC_3_T10_1416_D_R23 = 0x0312,
|
||||||
|
SCSI_VERSION_DESCRIPTOR_SPC_4 = 0x0460,
|
||||||
|
SCSI_VERSION_DESCRIPTOR_SPC_4_T10_1731_D_R16 = 0x0461,
|
||||||
|
SCSI_VERSION_DESCRIPTOR_SPC_4_T10_1731_D_R18 = 0x0462,
|
||||||
|
SCSI_VERSION_DESCRIPTOR_SPC_4_T10_1731_D_R23 = 0x0463
|
||||||
|
};
|
||||||
|
|
||||||
|
EXTERN const char *scsi_version_descriptor_to_str(enum scsi_version_descriptor version_descriptor);
|
||||||
|
|
||||||
enum scsi_inquiry_tpgs {
|
enum scsi_inquiry_tpgs {
|
||||||
SCSI_INQUIRY_TPGS_NO_SUPPORT = 0x00,
|
SCSI_INQUIRY_TPGS_NO_SUPPORT = 0x00,
|
||||||
SCSI_INQUIRY_TPGS_IMPLICIT = 0x01,
|
SCSI_INQUIRY_TPGS_IMPLICIT = 0x01,
|
||||||
@@ -417,6 +454,8 @@ struct scsi_inquiry_standard {
|
|||||||
char vendor_identification[8+1];
|
char vendor_identification[8+1];
|
||||||
char product_identification[16+1];
|
char product_identification[16+1];
|
||||||
char product_revision_level[4+1];
|
char product_revision_level[4+1];
|
||||||
|
|
||||||
|
uint16_t version_descriptor[8];
|
||||||
};
|
};
|
||||||
|
|
||||||
enum scsi_inquiry_pagecode {
|
enum scsi_inquiry_pagecode {
|
||||||
|
|||||||
@@ -196,3 +196,4 @@ scsi_task_add_data_out_buffer
|
|||||||
scsi_task_set_iov_in
|
scsi_task_set_iov_in
|
||||||
scsi_task_set_iov_out
|
scsi_task_set_iov_out
|
||||||
scsi_version_to_str
|
scsi_version_to_str
|
||||||
|
scsi_version_descriptor_to_str
|
||||||
|
|||||||
@@ -195,3 +195,4 @@ scsi_task_add_data_out_buffer
|
|||||||
scsi_task_set_iov_in
|
scsi_task_set_iov_in
|
||||||
scsi_task_set_iov_out
|
scsi_task_set_iov_out
|
||||||
scsi_version_to_str
|
scsi_version_to_str
|
||||||
|
scsi_version_descriptor_to_str
|
||||||
|
|||||||
@@ -981,6 +981,8 @@ scsi_inquiry_datain_getfullsize(struct scsi_task *task)
|
|||||||
static struct scsi_inquiry_standard *
|
static struct scsi_inquiry_standard *
|
||||||
scsi_inquiry_unmarshall_standard(struct scsi_task *task)
|
scsi_inquiry_unmarshall_standard(struct scsi_task *task)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
struct scsi_inquiry_standard *inq = scsi_malloc(task, sizeof(*inq));
|
struct scsi_inquiry_standard *inq = scsi_malloc(task, sizeof(*inq));
|
||||||
if (inq == NULL) {
|
if (inq == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -1020,6 +1022,11 @@ scsi_inquiry_unmarshall_standard(struct scsi_task *task)
|
|||||||
inq->qas = !!(task->datain.data[56]&0x02);
|
inq->qas = !!(task->datain.data[56]&0x02);
|
||||||
inq->ius = !!(task->datain.data[56]&0x01);
|
inq->ius = !!(task->datain.data[56]&0x01);
|
||||||
|
|
||||||
|
for (i = 0; i < 8; i++) {
|
||||||
|
inq->version_descriptor[i] = scsi_get_uint16(
|
||||||
|
&task->datain.data[58 + i * 2]);
|
||||||
|
}
|
||||||
|
|
||||||
return inq;
|
return inq;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2926,6 +2933,77 @@ scsi_version_to_str(enum scsi_version version)
|
|||||||
return "unknown";
|
return "unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
scsi_version_descriptor_to_str(enum scsi_version_descriptor version_descriptor)
|
||||||
|
{
|
||||||
|
switch (version_descriptor) {
|
||||||
|
case SCSI_VERSION_DESCRIPTOR_ISCSI:
|
||||||
|
return "iSCSI";
|
||||||
|
case SCSI_VERSION_DESCRIPTOR_SBC:
|
||||||
|
return "SBC";
|
||||||
|
case SCSI_VERSION_DESCRIPTOR_SBC_ANSI_INCITS_306_1998:
|
||||||
|
return "SBC ANSI INCITS 306-1998";
|
||||||
|
case SCSI_VERSION_DESCRIPTOR_SBC_T10_0996_D_R08C:
|
||||||
|
return "SBC T10/0996-D revision 08c";
|
||||||
|
case SCSI_VERSION_DESCRIPTOR_SBC_2:
|
||||||
|
return "SBC-2";
|
||||||
|
case SCSI_VERSION_DESCRIPTOR_SBC_2_ISO_IEC_14776_322:
|
||||||
|
return "SBC-2 ISO/IEC 14776-322";
|
||||||
|
case SCSI_VERSION_DESCRIPTOR_SBC_2_ANSI_INCITS_405_2005:
|
||||||
|
return "SBC-2 ANSI INCITS 405-2005";
|
||||||
|
case SCSI_VERSION_DESCRIPTOR_SBC_2_T10_1417_D_R16:
|
||||||
|
return "SBC-2 T10/1417-D revision 16";
|
||||||
|
case SCSI_VERSION_DESCRIPTOR_SBC_2_T10_1417_D_R5A:
|
||||||
|
return "SBC-2 T10/1417-D revision 5A";
|
||||||
|
case SCSI_VERSION_DESCRIPTOR_SBC_2_T10_1417_D_R15:
|
||||||
|
return "SBC-2 T10/1417-D revision 15";
|
||||||
|
case SCSI_VERSION_DESCRIPTOR_SBC_3:
|
||||||
|
return "SBC-3";
|
||||||
|
case SCSI_VERSION_DESCRIPTOR_SPC:
|
||||||
|
return "SPC";
|
||||||
|
case SCSI_VERSION_DESCRIPTOR_SPC_ANSI_INCITS_301_1997:
|
||||||
|
return "SPC ANSI INCITS 301-1997";
|
||||||
|
case SCSI_VERSION_DESCRIPTOR_SPC_T10_0995_D_R11A:
|
||||||
|
return "SPC T10/0995-D revision 11a";
|
||||||
|
case SCSI_VERSION_DESCRIPTOR_SPC_2:
|
||||||
|
return "SPC-2";
|
||||||
|
case SCSI_VERSION_DESCRIPTOR_SPC_2_ISO_IEC_14776_452:
|
||||||
|
return "SPC-2 ISO.IEC 14776-452";
|
||||||
|
case SCSI_VERSION_DESCRIPTOR_SPC_2_ANSI_INCITS_351_2001:
|
||||||
|
return "SPC-2 ANSI INCITS 351-2001";
|
||||||
|
case SCSI_VERSION_DESCRIPTOR_SPC_2_T10_1236_D_R20:
|
||||||
|
return "SPC-2 T10/1236-D revision 20";
|
||||||
|
case SCSI_VERSION_DESCRIPTOR_SPC_2_T10_1236_D_R12:
|
||||||
|
return "SPC-2 T10/1236-D revision 12";
|
||||||
|
case SCSI_VERSION_DESCRIPTOR_SPC_2_T10_1236_D_R18:
|
||||||
|
return "SPC-2 T10/1236-D revision 18";
|
||||||
|
case SCSI_VERSION_DESCRIPTOR_SPC_2_T10_1236_D_R19:
|
||||||
|
return "SPC-2 T10/1236-D revision 19";
|
||||||
|
case SCSI_VERSION_DESCRIPTOR_SPC_3:
|
||||||
|
return "SPC-3";
|
||||||
|
case SCSI_VERSION_DESCRIPTOR_SPC_3_ISO_IEC_14776_453:
|
||||||
|
return "SPC-3 ISO/IEC 14776-453";
|
||||||
|
case SCSI_VERSION_DESCRIPTOR_SPC_3_ANSI_INCITS_408_2005:
|
||||||
|
return "SPC-3 ANSI INCITS 408-2005";
|
||||||
|
case SCSI_VERSION_DESCRIPTOR_SPC_3_T10_1416_D_R7:
|
||||||
|
return "SPC-3 T10/1416-D revision 7";
|
||||||
|
case SCSI_VERSION_DESCRIPTOR_SPC_3_T10_1416_D_R21:
|
||||||
|
return "SPC-3 T10/1416-D revision 21";
|
||||||
|
case SCSI_VERSION_DESCRIPTOR_SPC_3_T10_1416_D_R22:
|
||||||
|
return "SPC-3 T10/1416-D revision 22";
|
||||||
|
case SCSI_VERSION_DESCRIPTOR_SPC_3_T10_1416_D_R23:
|
||||||
|
return "SPC-3 T10/1416-D revision 23";
|
||||||
|
case SCSI_VERSION_DESCRIPTOR_SPC_4:
|
||||||
|
return "SPC-4";
|
||||||
|
case SCSI_VERSION_DESCRIPTOR_SPC_4_T10_1731_D_R16:
|
||||||
|
return "SPC-4 T10/1731-D revision 16";
|
||||||
|
case SCSI_VERSION_DESCRIPTOR_SPC_4_T10_1731_D_R18:
|
||||||
|
return "SPC-4 T10/1731-D revision 18";
|
||||||
|
case SCSI_VERSION_DESCRIPTOR_SPC_4_T10_1731_D_R23:
|
||||||
|
return "SPC-4 T10/1731-D revision 23";
|
||||||
|
}
|
||||||
|
return "unknown";
|
||||||
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
scsi_inquiry_pagecode_to_str(int pagecode)
|
scsi_inquiry_pagecode_to_str(int pagecode)
|
||||||
|
|||||||
@@ -110,6 +110,8 @@ void inquiry_supported_pages(struct scsi_inquiry_supported_pages *inq)
|
|||||||
|
|
||||||
void inquiry_standard(struct scsi_inquiry_standard *inq)
|
void inquiry_standard(struct scsi_inquiry_standard *inq)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
printf("Peripheral Qualifier:%s\n",
|
printf("Peripheral Qualifier:%s\n",
|
||||||
scsi_devqualifier_to_str(inq->qualifier));
|
scsi_devqualifier_to_str(inq->qualifier));
|
||||||
printf("Peripheral Device Type:%s\n",
|
printf("Peripheral Device Type:%s\n",
|
||||||
@@ -131,6 +133,17 @@ void inquiry_standard(struct scsi_inquiry_standard *inq)
|
|||||||
printf("Vendor:%s\n", inq->vendor_identification);
|
printf("Vendor:%s\n", inq->vendor_identification);
|
||||||
printf("Product:%s\n", inq->product_identification);
|
printf("Product:%s\n", inq->product_identification);
|
||||||
printf("Revision:%s\n", inq->product_revision_level);
|
printf("Revision:%s\n", inq->product_revision_level);
|
||||||
|
|
||||||
|
for (i = 0; i < 8; i++) {
|
||||||
|
if (inq->version_descriptor[i] == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("Version Descriptor:%04x %s\n",
|
||||||
|
inq->version_descriptor[i],
|
||||||
|
scsi_version_descriptor_to_str(
|
||||||
|
inq->version_descriptor[i]));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void do_inquiry(struct iscsi_context *iscsi, int lun, int evpd, int pc)
|
void do_inquiry(struct iscsi_context *iscsi, int lun, int evpd, int pc)
|
||||||
|
|||||||
Reference in New Issue
Block a user