diff options
author | Stephen M. Cameron <scameron@beardog.cce.hp.com> | 2010-05-27 16:14:34 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-07-27 13:01:17 -0400 |
commit | d28ce020fb0ef9254fc9e0bd07f5898c69af9f7d (patch) | |
tree | 00e0cc4b764b2ff928f999755001ffc931a6ea08 | |
parent | 992ebcf14f3cf029b8d0da4f479d752c19d8c726 (diff) |
[SCSI] hpsa: expose controller firmware revision via /sys.
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
-rw-r--r-- | Documentation/scsi/hpsa.txt | 7 | ||||
-rw-r--r-- | drivers/scsi/hpsa.c | 20 |
2 files changed, 27 insertions, 0 deletions
diff --git a/Documentation/scsi/hpsa.txt b/Documentation/scsi/hpsa.txt index 4055657340a2..dca658362cbf 100644 --- a/Documentation/scsi/hpsa.txt +++ b/Documentation/scsi/hpsa.txt | |||
@@ -38,6 +38,7 @@ HPSA specific entries in /sys | |||
38 | ------------------------------ | 38 | ------------------------------ |
39 | 39 | ||
40 | /sys/class/scsi_host/host*/rescan | 40 | /sys/class/scsi_host/host*/rescan |
41 | /sys/class/scsi_host/host*/firmware_revision | ||
41 | 42 | ||
42 | the host "rescan" attribute is a write only attribute. Writing to this | 43 | the host "rescan" attribute is a write only attribute. Writing to this |
43 | attribute will cause the driver to scan for new, changed, or removed devices | 44 | attribute will cause the driver to scan for new, changed, or removed devices |
@@ -48,6 +49,12 @@ HPSA specific entries in /sys | |||
48 | normally have to use this. It may be useful when hot plugging devices like | 49 | normally have to use this. It may be useful when hot plugging devices like |
49 | tape drives, or entire storage boxes containing pre-configured logical drives. | 50 | tape drives, or entire storage boxes containing pre-configured logical drives. |
50 | 51 | ||
52 | The "firmware_revision" attribute contains the firmware version of the Smart Array. | ||
53 | For example: | ||
54 | |||
55 | root@host:/sys/class/scsi_host/host4# cat firmware_revision | ||
56 | 7.14 | ||
57 | |||
51 | HPSA specific disk attributes: | 58 | HPSA specific disk attributes: |
52 | ------------------------------ | 59 | ------------------------------ |
53 | 60 | ||
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index 50fddf84e47f..410910762fc5 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c | |||
@@ -148,6 +148,8 @@ static ssize_t lunid_show(struct device *dev, | |||
148 | struct device_attribute *attr, char *buf); | 148 | struct device_attribute *attr, char *buf); |
149 | static ssize_t unique_id_show(struct device *dev, | 149 | static ssize_t unique_id_show(struct device *dev, |
150 | struct device_attribute *attr, char *buf); | 150 | struct device_attribute *attr, char *buf); |
151 | static ssize_t host_show_firmware_revision(struct device *dev, | ||
152 | struct device_attribute *attr, char *buf); | ||
151 | static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno); | 153 | static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno); |
152 | static ssize_t host_store_rescan(struct device *dev, | 154 | static ssize_t host_store_rescan(struct device *dev, |
153 | struct device_attribute *attr, const char *buf, size_t count); | 155 | struct device_attribute *attr, const char *buf, size_t count); |
@@ -165,6 +167,8 @@ static DEVICE_ATTR(raid_level, S_IRUGO, raid_level_show, NULL); | |||
165 | static DEVICE_ATTR(lunid, S_IRUGO, lunid_show, NULL); | 167 | static DEVICE_ATTR(lunid, S_IRUGO, lunid_show, NULL); |
166 | static DEVICE_ATTR(unique_id, S_IRUGO, unique_id_show, NULL); | 168 | static DEVICE_ATTR(unique_id, S_IRUGO, unique_id_show, NULL); |
167 | static DEVICE_ATTR(rescan, S_IWUSR, NULL, host_store_rescan); | 169 | static DEVICE_ATTR(rescan, S_IWUSR, NULL, host_store_rescan); |
170 | static DEVICE_ATTR(firmware_revision, S_IRUGO, | ||
171 | host_show_firmware_revision, NULL); | ||
168 | 172 | ||
169 | static struct device_attribute *hpsa_sdev_attrs[] = { | 173 | static struct device_attribute *hpsa_sdev_attrs[] = { |
170 | &dev_attr_raid_level, | 174 | &dev_attr_raid_level, |
@@ -175,6 +179,7 @@ static struct device_attribute *hpsa_sdev_attrs[] = { | |||
175 | 179 | ||
176 | static struct device_attribute *hpsa_shost_attrs[] = { | 180 | static struct device_attribute *hpsa_shost_attrs[] = { |
177 | &dev_attr_rescan, | 181 | &dev_attr_rescan, |
182 | &dev_attr_firmware_revision, | ||
178 | NULL, | 183 | NULL, |
179 | }; | 184 | }; |
180 | 185 | ||
@@ -260,6 +265,21 @@ static ssize_t host_store_rescan(struct device *dev, | |||
260 | return count; | 265 | return count; |
261 | } | 266 | } |
262 | 267 | ||
268 | static ssize_t host_show_firmware_revision(struct device *dev, | ||
269 | struct device_attribute *attr, char *buf) | ||
270 | { | ||
271 | struct ctlr_info *h; | ||
272 | struct Scsi_Host *shost = class_to_shost(dev); | ||
273 | unsigned char *fwrev; | ||
274 | |||
275 | h = shost_to_hba(shost); | ||
276 | if (!h->hba_inquiry_data) | ||
277 | return 0; | ||
278 | fwrev = &h->hba_inquiry_data[32]; | ||
279 | return snprintf(buf, 20, "%c%c%c%c\n", | ||
280 | fwrev[0], fwrev[1], fwrev[2], fwrev[3]); | ||
281 | } | ||
282 | |||
263 | /* Enqueuing and dequeuing functions for cmdlists. */ | 283 | /* Enqueuing and dequeuing functions for cmdlists. */ |
264 | static inline void addQ(struct hlist_head *list, struct CommandList *c) | 284 | static inline void addQ(struct hlist_head *list, struct CommandList *c) |
265 | { | 285 | { |