Skip to contentSkip to conversation

tcm: Add support for Extended INQUIRY Data VPD Page

PATCH New Nicholas A. Bellinger 1 participant 1 message Sep 2, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tcm: Add support for Extended INQUIRY Data VPD Page

From: Nicholas Bellinger <[email protected]>

Greetings all,

This small patch updates transport_generic_emulate_inquiry() to add support for the Extended INQUIRY Data VPD Page in spc4r23 section 7.7.5.

By default, this page returns HEADSUP, ORDSUP, SIMPSUP bits enabled for SCSI Tasks Attr emulation. It also will set V_SUP (volatile cache supported) when DEV_ATTRIB(dev)->emulate_write_cache is enabled for FILEIO or IBLOCK backstores.

There is how it looks using 'sg_inq -ve $DEV' with emulate_write_cache=1:

target:/mnt/sdb/lio-core-2.6.git# sg_inq -ve /dev/sdg
VPD INQUIRY: extended INQUIRY data page
    inquiry cdb: 12 01 86 00 fc 00
    inquiry cdb: 12 01 86 3c 04 00
  SPT=0 GRD_CHK=0 APP_CHK=0 REF_CHK=0
  GRP_SUP=0 PRIOR_SUP=0 HEADSUP=1 ORDSUP=1 SIMPSUP=1
  CORR_D_SUP=0 NV_SUP=0 V_SUP=1 LUICLR=0
---
 drivers/target/target_core_transport.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
drivers/target/target_core_transport.c +17 -0
index ec67cb6..fbbe9fc 100644
@@ -4499,6 +4499,7 @@ after_tpgs:
 		buf[4] = 0x0;
 		buf[5] = 0x80;
 		buf[6] = 0x83;
+		buf[7] = 0x86;
 		len = 3;
 		break;
 	case 0x80: /* unit serial number */
@@ -4816,6 +4817,22 @@ set_len:
 		buf[2] = ((len >> 8) & 0xff);
 		buf[3] = (len & 0xff); /* Page Length for VPD 0x83 */
 		break;
+	case 0x86: /* Extended INQUIRY Data VPD Page */
+		/*
+		 * This page uses a hardcoded value of 60
+		 */
+		if (cmd->data_length < 60)
+			return 0;
+
+		buf[1] = 0x86;
+		buf[2] = 0x3c;
+		/* Set HEADSUP, ORDSUP, SIMPSUP */
+		buf[5] = 0x07;
+		/* If WriteCache emulation is enabled, set V_SUP */
+		if (DEV_ATTRIB(dev)->emulate_write_cache > 0)
+			buf[6] = 0x01;
+
+		break;
 	default:
 		printk(KERN_ERR "Unknown VPD Code: 0x%02x\n", cdb[2]);
 		return -1;
Signature · 1 line
1.5.6.5