Commit 24f02e1d authored by Salyzyn, Mark's avatar Salyzyn, Mark Committed by James Bottomley

[SCSI] aacraid: add support for long serial number information

Support displaying long serial number information. Reuse sysfs handler
internally as helper.
Signed-off-by: default avatarMark Salyzyn <aacraid@adaptec.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent b27e66df
...@@ -1179,6 +1179,7 @@ int aac_get_adapter_info(struct aac_dev* dev) ...@@ -1179,6 +1179,7 @@ int aac_get_adapter_info(struct aac_dev* dev)
} }
if (!dev->in_reset) { if (!dev->in_reset) {
char buffer[16];
tmp = le32_to_cpu(dev->adapter_info.kernelrev); tmp = le32_to_cpu(dev->adapter_info.kernelrev);
printk(KERN_INFO "%s%d: kernel %d.%d-%d[%d] %.*s\n", printk(KERN_INFO "%s%d: kernel %d.%d-%d[%d] %.*s\n",
dev->name, dev->name,
...@@ -1199,10 +1200,11 @@ int aac_get_adapter_info(struct aac_dev* dev) ...@@ -1199,10 +1200,11 @@ int aac_get_adapter_info(struct aac_dev* dev)
dev->name, dev->id, dev->name, dev->id,
tmp>>24,(tmp>>16)&0xff,tmp&0xff, tmp>>24,(tmp>>16)&0xff,tmp&0xff,
le32_to_cpu(dev->adapter_info.biosbuild)); le32_to_cpu(dev->adapter_info.biosbuild));
if (le32_to_cpu(dev->adapter_info.serial[0]) != 0xBAD0) buffer[0] = '\0';
printk(KERN_INFO "%s%d: serial %x\n", if (aac_show_serial_number(
dev->name, dev->id, shost_to_class(dev->scsi_host_ptr), buffer))
le32_to_cpu(dev->adapter_info.serial[0])); printk(KERN_INFO "%s%d: serial %s",
dev->name, dev->id, buffer);
if (dev->supplement_adapter_info.VpdInfo.Tsid[0]) { if (dev->supplement_adapter_info.VpdInfo.Tsid[0]) {
printk(KERN_INFO "%s%d: TSID %.*s\n", printk(KERN_INFO "%s%d: TSID %.*s\n",
dev->name, dev->id, dev->name, dev->id,
......
...@@ -1822,6 +1822,10 @@ int aac_get_config_status(struct aac_dev *dev, int commit_flag); ...@@ -1822,6 +1822,10 @@ int aac_get_config_status(struct aac_dev *dev, int commit_flag);
int aac_get_containers(struct aac_dev *dev); int aac_get_containers(struct aac_dev *dev);
int aac_scsi_cmd(struct scsi_cmnd *cmd); int aac_scsi_cmd(struct scsi_cmnd *cmd);
int aac_dev_ioctl(struct aac_dev *dev, int cmd, void __user *arg); int aac_dev_ioctl(struct aac_dev *dev, int cmd, void __user *arg);
#ifndef shost_to_class
#define shost_to_class(shost) &shost->shost_classdev
#endif
ssize_t aac_show_serial_number(struct class_device *class_dev, char *buf);
int aac_do_ioctl(struct aac_dev * dev, int cmd, void __user *arg); int aac_do_ioctl(struct aac_dev * dev, int cmd, void __user *arg);
int aac_rx_init(struct aac_dev *dev); int aac_rx_init(struct aac_dev *dev);
int aac_rkt_init(struct aac_dev *dev); int aac_rkt_init(struct aac_dev *dev);
......
...@@ -770,15 +770,21 @@ static ssize_t aac_show_bios_version(struct class_device *class_dev, ...@@ -770,15 +770,21 @@ static ssize_t aac_show_bios_version(struct class_device *class_dev,
return len; return len;
} }
static ssize_t aac_show_serial_number(struct class_device *class_dev, ssize_t aac_show_serial_number(struct class_device *class_dev, char *buf)
char *buf)
{ {
struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata;
int len = 0; int len = 0;
if (le32_to_cpu(dev->adapter_info.serial[0]) != 0xBAD0) if (le32_to_cpu(dev->adapter_info.serial[0]) != 0xBAD0)
len = snprintf(buf, PAGE_SIZE, "%x\n", len = snprintf(buf, PAGE_SIZE, "%06X\n",
le32_to_cpu(dev->adapter_info.serial[0])); le32_to_cpu(dev->adapter_info.serial[0]));
if (len &&
!memcmp(&dev->supplement_adapter_info.MfgPcbaSerialNo[
sizeof(dev->supplement_adapter_info.MfgPcbaSerialNo)+2-len],
buf, len))
len = snprintf(buf, PAGE_SIZE, "%.*s\n",
(int)sizeof(dev->supplement_adapter_info.MfgPcbaSerialNo),
dev->supplement_adapter_info.MfgPcbaSerialNo);
return len; return len;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment