diff options
author | Salyzyn, Mark <mark_salyzyn@adaptec.com> | 2007-06-19 16:29:24 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2007-06-20 00:59:09 -0400 |
commit | 24f02e1d819ad91de46ad3a636cd3f2bf11c720f (patch) | |
tree | 2b8d8d9fa79ad28a2c4c3a272f7807d05409794d /drivers | |
parent | b27e66df78a9d8d43c05a6a5777ef45f2e238951 (diff) |
[SCSI] aacraid: add support for long serial number information
Support displaying long serial number information. Reuse sysfs handler
internally as helper.
Signed-off-by: Mark Salyzyn <aacraid@adaptec.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/aacraid/aachba.c | 10 | ||||
-rw-r--r-- | drivers/scsi/aacraid/aacraid.h | 4 | ||||
-rw-r--r-- | drivers/scsi/aacraid/linit.c | 12 |
3 files changed, 19 insertions, 7 deletions
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index 6345dbe33c19..0b6fd0b654d2 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c | |||
@@ -1179,6 +1179,7 @@ int aac_get_adapter_info(struct aac_dev* dev) | |||
1179 | } | 1179 | } |
1180 | 1180 | ||
1181 | if (!dev->in_reset) { | 1181 | if (!dev->in_reset) { |
1182 | char buffer[16]; | ||
1182 | tmp = le32_to_cpu(dev->adapter_info.kernelrev); | 1183 | tmp = le32_to_cpu(dev->adapter_info.kernelrev); |
1183 | printk(KERN_INFO "%s%d: kernel %d.%d-%d[%d] %.*s\n", | 1184 | printk(KERN_INFO "%s%d: kernel %d.%d-%d[%d] %.*s\n", |
1184 | dev->name, | 1185 | dev->name, |
@@ -1199,10 +1200,11 @@ int aac_get_adapter_info(struct aac_dev* dev) | |||
1199 | dev->name, dev->id, | 1200 | dev->name, dev->id, |
1200 | tmp>>24,(tmp>>16)&0xff,tmp&0xff, | 1201 | tmp>>24,(tmp>>16)&0xff,tmp&0xff, |
1201 | le32_to_cpu(dev->adapter_info.biosbuild)); | 1202 | le32_to_cpu(dev->adapter_info.biosbuild)); |
1202 | if (le32_to_cpu(dev->adapter_info.serial[0]) != 0xBAD0) | 1203 | buffer[0] = '\0'; |
1203 | printk(KERN_INFO "%s%d: serial %x\n", | 1204 | if (aac_show_serial_number( |
1204 | dev->name, dev->id, | 1205 | shost_to_class(dev->scsi_host_ptr), buffer)) |
1205 | le32_to_cpu(dev->adapter_info.serial[0])); | 1206 | printk(KERN_INFO "%s%d: serial %s", |
1207 | dev->name, dev->id, buffer); | ||
1206 | if (dev->supplement_adapter_info.VpdInfo.Tsid[0]) { | 1208 | if (dev->supplement_adapter_info.VpdInfo.Tsid[0]) { |
1207 | printk(KERN_INFO "%s%d: TSID %.*s\n", | 1209 | printk(KERN_INFO "%s%d: TSID %.*s\n", |
1208 | dev->name, dev->id, | 1210 | dev->name, dev->id, |
diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index 8abe4f97b0af..f1d3b66af879 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h | |||
@@ -1822,6 +1822,10 @@ int aac_get_config_status(struct aac_dev *dev, int commit_flag); | |||
1822 | int aac_get_containers(struct aac_dev *dev); | 1822 | int aac_get_containers(struct aac_dev *dev); |
1823 | int aac_scsi_cmd(struct scsi_cmnd *cmd); | 1823 | int aac_scsi_cmd(struct scsi_cmnd *cmd); |
1824 | int aac_dev_ioctl(struct aac_dev *dev, int cmd, void __user *arg); | 1824 | int aac_dev_ioctl(struct aac_dev *dev, int cmd, void __user *arg); |
1825 | #ifndef shost_to_class | ||
1826 | #define shost_to_class(shost) &shost->shost_classdev | ||
1827 | #endif | ||
1828 | ssize_t aac_show_serial_number(struct class_device *class_dev, char *buf); | ||
1825 | int aac_do_ioctl(struct aac_dev * dev, int cmd, void __user *arg); | 1829 | int aac_do_ioctl(struct aac_dev * dev, int cmd, void __user *arg); |
1826 | int aac_rx_init(struct aac_dev *dev); | 1830 | int aac_rx_init(struct aac_dev *dev); |
1827 | int aac_rkt_init(struct aac_dev *dev); | 1831 | int aac_rkt_init(struct aac_dev *dev); |
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index 3870bd61f418..4fda01e97f46 100644 --- a/drivers/scsi/aacraid/linit.c +++ b/drivers/scsi/aacraid/linit.c | |||
@@ -770,15 +770,21 @@ static ssize_t aac_show_bios_version(struct class_device *class_dev, | |||
770 | return len; | 770 | return len; |
771 | } | 771 | } |
772 | 772 | ||
773 | static ssize_t aac_show_serial_number(struct class_device *class_dev, | 773 | ssize_t aac_show_serial_number(struct class_device *class_dev, char *buf) |
774 | char *buf) | ||
775 | { | 774 | { |
776 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; | 775 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; |
777 | int len = 0; | 776 | int len = 0; |
778 | 777 | ||
779 | if (le32_to_cpu(dev->adapter_info.serial[0]) != 0xBAD0) | 778 | if (le32_to_cpu(dev->adapter_info.serial[0]) != 0xBAD0) |
780 | len = snprintf(buf, PAGE_SIZE, "%x\n", | 779 | len = snprintf(buf, PAGE_SIZE, "%06X\n", |
781 | le32_to_cpu(dev->adapter_info.serial[0])); | 780 | le32_to_cpu(dev->adapter_info.serial[0])); |
781 | if (len && | ||
782 | !memcmp(&dev->supplement_adapter_info.MfgPcbaSerialNo[ | ||
783 | sizeof(dev->supplement_adapter_info.MfgPcbaSerialNo)+2-len], | ||
784 | buf, len)) | ||
785 | len = snprintf(buf, PAGE_SIZE, "%.*s\n", | ||
786 | (int)sizeof(dev->supplement_adapter_info.MfgPcbaSerialNo), | ||
787 | dev->supplement_adapter_info.MfgPcbaSerialNo); | ||
782 | return len; | 788 | return len; |
783 | } | 789 | } |
784 | 790 | ||