scsi: split Inquiry peripheral type and qualifier

The SCSI spec defines two separate fields within the first byte of
the Inquiry data.  Define them as bitfields and add enum values for the
peripheral qualifier field.

Change-Id: Ibbb158338da199fc1b67b04c52ec91633577c571
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/382713
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
Daniel Verkamp 2017-10-16 13:12:03 -07:00 committed by Jim Harris
parent a07416d8d0
commit fc5f527c21
2 changed files with 14 additions and 4 deletions

View File

@ -328,6 +328,12 @@ enum spdk_spc_vpd {
SPDK_SPC_VPD_BLOCK_THIN_PROVISION = 0xb2,
};
enum spdk_spc_peripheral_qualifier {
SPDK_SPC_PERIPHERAL_QUALIFIER_CONNECTED = 0,
SPDK_SPC_PERIPHERAL_QUALIFIER_NOT_CONNECTED = 1,
SPDK_SPC_PERIPHERAL_QUALIFIER_NOT_CAPABLE = 3,
};
enum {
SPDK_SPC_PERIPHERAL_DEVICE_TYPE_DISK = 0x00,
SPDK_SPC_PERIPHERAL_DEVICE_TYPE_TAPE = 0x01,
@ -379,7 +385,8 @@ struct spdk_scsi_cdb_inquiry {
SPDK_STATIC_ASSERT(sizeof(struct spdk_scsi_cdb_inquiry) == 6, "incorrect CDB size");
struct spdk_scsi_cdb_inquiry_data {
uint8_t peripheral;
uint8_t peripheral_device_type : 5;
uint8_t peripheral_qualifier : 3;
uint8_t rmb;
uint8_t version;
uint8_t response;
@ -397,7 +404,8 @@ struct spdk_scsi_cdb_inquiry_data {
};
struct spdk_scsi_vpd_page {
uint8_t peripheral;
uint8_t peripheral_device_type : 5;
uint8_t peripheral_qualifier : 3;
uint8_t page_code;
uint8_t alloc_len[2];
uint8_t params[];

View File

@ -202,7 +202,8 @@ spdk_bdev_scsi_inquiry(struct spdk_bdev *bdev, struct spdk_scsi_task *task,
struct spdk_scsi_vpd_page *vpage = (struct spdk_scsi_vpd_page *)data;
/* PERIPHERAL QUALIFIER(7-5) PERIPHERAL DEVICE TYPE(4-0) */
vpage->peripheral = pd;
vpage->peripheral_device_type = pd;
vpage->peripheral_qualifier = SPDK_SPC_PERIPHERAL_QUALIFIER_CONNECTED;
/* PAGE CODE */
vpage->page_code = pc;
@ -670,7 +671,8 @@ spdk_bdev_scsi_inquiry(struct spdk_bdev *bdev, struct spdk_scsi_task *task,
/* Standard INQUIRY data */
/* PERIPHERAL QUALIFIER(7-5) PERIPHERAL DEVICE TYPE(4-0) */
inqdata->peripheral = pd;
inqdata->peripheral_device_type = pd;
inqdata->peripheral_qualifier = SPDK_SPC_PERIPHERAL_QUALIFIER_CONNECTED;
/* RMB(7) */
inqdata->rmb = 0;