Skip to contentSkip to conversation

Add EVPD page 0x83 entries to sysfs

PATCH New Hannes Reinecke 1 participant 1 message Feb 11, 2014 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 Add EVPD page 0x83 entries to sysfs

EVPD page 0x83 is used to uniquely identify the device. So instead of having each and every program issue a separate SG_IO call to retrieve this information it does make far more sense to display it in sysfs.

Cc Jeremy Linton <[email protected]>
Cc Doug Gilbert <[email protected]>
Cc Kai Makisara <[email protected]>
---
 drivers/scsi/scsi_scan.c   |   3 +
 drivers/scsi/scsi_sysfs.c  | 289 ++++++++++++++++++++++++++++++++++++++++++++-
 include/scsi/scsi.h        |   4 +-
 include/scsi/scsi_device.h |   3 +
 4 files changed, 297 insertions(+), 2 deletions(-)
drivers/scsi/scsi_scan.c +3 -0
index 307a811..073fb84 100644
@@ -929,6 +929,9 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result,
 	if (*bflags & BLIST_SKIP_VPD_PAGES)
 		sdev->skip_vpd_pages = 1;
 
+	if (sdev->scsi_level >= SCSI_3)
+		scsi_attach_vpd_ident(sdev);
+
 	transport_configure_device(&sdev->sdev_gendev);
 
 	if (sdev->host->hostt->slave_configure) {
drivers/scsi/scsi_sysfs.c +288 -1

308 lines not on this page · raw message

include/scsi/scsi.h +3 -1
index 0a4edfe..8fd13bb 100644
@@ -334,7 +334,7 @@ static inline int scsi_status_is_good(int status)
 #define TYPE_OSD            0x11
 #define TYPE_NO_LUN         0x7f
 
-/* SCSI protocols; these are taken from SPC-3 section 7.5 */
+/* SCSI protocols; these are taken from SPC-4 section 7.6 */
 enum scsi_protocol {
 	SCSI_PROTOCOL_FCP = 0,	/* Fibre Channel */
 	SCSI_PROTOCOL_SPI = 1,	/* parallel SCSI */
@@ -345,6 +345,8 @@ enum scsi_protocol {
 	SCSI_PROTOCOL_SAS = 6,
 	SCSI_PROTOCOL_ADT = 7,	/* Media Changers */
 	SCSI_PROTOCOL_ATA = 8,
+	SCSI_PROTOCOL_UAS = 9,
+	SCSI_PROTOCOL_SOP = 0xa,
 	SCSI_PROTOCOL_UNSPEC = 0xf, /* No specific protocol */
 };
 
include/scsi/scsi_device.h +3 -0
index dcb2b73..81c7900 100644
@@ -113,6 +113,8 @@ struct scsi_device {
 	const char * vendor;		/* [back_compat] point into 'inquiry' ... */
 	const char * model;		/* ... after scan; point to static string */
 	const char * rev;		/* ... "nullnullnullnull" before scan */
+	unsigned char vpd_ident_len;
+	unsigned char *vpd_ident;
 	struct scsi_target      *sdev_target;   /* used only for single_lun */
 
 	unsigned int	sdev_bflags; /* black/white flags as also found in
@@ -308,6 +310,7 @@ extern int scsi_add_device(struct Scsi_Host *host, uint channel,
 extern int scsi_register_device_handler(struct scsi_device_handler *scsi_dh);
 extern void scsi_remove_device(struct scsi_device *);
 extern int scsi_unregister_device_handler(struct scsi_device_handler *scsi_dh);
+void scsi_attach_vpd_ident(struct scsi_device *sdev);
 
 extern int scsi_device_get(struct scsi_device *);
 extern void scsi_device_put(struct scsi_device *);
Signature · 1 line
1.7.12.4