Skip to content

Commit

Permalink
[SCSI] hpsa: expose controller firmware revision via /sys.
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
  • Loading branch information
Stephen M. Cameron authored and James Bottomley committed Jul 27, 2010
1 parent 992ebcf commit d28ce02
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Documentation/scsi/hpsa.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ HPSA specific entries in /sys
------------------------------

/sys/class/scsi_host/host*/rescan
/sys/class/scsi_host/host*/firmware_revision

the host "rescan" attribute is a write only attribute. Writing to this
attribute will cause the driver to scan for new, changed, or removed devices
Expand All @@ -48,6 +49,12 @@ HPSA specific entries in /sys
normally have to use this. It may be useful when hot plugging devices like
tape drives, or entire storage boxes containing pre-configured logical drives.

The "firmware_revision" attribute contains the firmware version of the Smart Array.
For example:

root@host:/sys/class/scsi_host/host4# cat firmware_revision
7.14

HPSA specific disk attributes:
------------------------------

Expand Down
20 changes: 20 additions & 0 deletions drivers/scsi/hpsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ static ssize_t lunid_show(struct device *dev,
struct device_attribute *attr, char *buf);
static ssize_t unique_id_show(struct device *dev,
struct device_attribute *attr, char *buf);
static ssize_t host_show_firmware_revision(struct device *dev,
struct device_attribute *attr, char *buf);
static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno);
static ssize_t host_store_rescan(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count);
Expand All @@ -165,6 +167,8 @@ static DEVICE_ATTR(raid_level, S_IRUGO, raid_level_show, NULL);
static DEVICE_ATTR(lunid, S_IRUGO, lunid_show, NULL);
static DEVICE_ATTR(unique_id, S_IRUGO, unique_id_show, NULL);
static DEVICE_ATTR(rescan, S_IWUSR, NULL, host_store_rescan);
static DEVICE_ATTR(firmware_revision, S_IRUGO,
host_show_firmware_revision, NULL);

static struct device_attribute *hpsa_sdev_attrs[] = {
&dev_attr_raid_level,
Expand All @@ -175,6 +179,7 @@ static struct device_attribute *hpsa_sdev_attrs[] = {

static struct device_attribute *hpsa_shost_attrs[] = {
&dev_attr_rescan,
&dev_attr_firmware_revision,
NULL,
};

Expand Down Expand Up @@ -260,6 +265,21 @@ static ssize_t host_store_rescan(struct device *dev,
return count;
}

static ssize_t host_show_firmware_revision(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct ctlr_info *h;
struct Scsi_Host *shost = class_to_shost(dev);
unsigned char *fwrev;

h = shost_to_hba(shost);
if (!h->hba_inquiry_data)
return 0;
fwrev = &h->hba_inquiry_data[32];
return snprintf(buf, 20, "%c%c%c%c\n",
fwrev[0], fwrev[1], fwrev[2], fwrev[3]);
}

/* Enqueuing and dequeuing functions for cmdlists. */
static inline void addQ(struct hlist_head *list, struct CommandList *c)
{
Expand Down

0 comments on commit d28ce02

Please sign in to comment.