aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message
diff options
context:
space:
mode:
authorPrakash, Sathya <sathya.prakash@lsi.com>2007-07-17 05:09:14 -0400
committerJames Bottomley <jejb@mulgrave.localdomain>2007-07-18 12:17:04 -0400
commitedb9068d0d7a3ba92f66b8c86cba625f3a439f64 (patch)
tree1a36c6a203c91e2584b8970ad6b5eb9c17d55460 /drivers/message
parentfc6e740d0b8619b7e5b6a1899d2db73e309de6a5 (diff)
[SCSI] mpt fusion: add sysfs attributes to display IOC parameters
New sysfs scsi_host attributes are added to provide information about Firmware version, BIOS version, MPI version and other product related information signed-off-by: Sathya Praksh <sathya.prakash@lsi.com> Acked-by: "Moore, Eric" <Eric.Moore@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/message')
-rw-r--r--drivers/message/fusion/mptbase.c45
-rw-r--r--drivers/message/fusion/mptbase.h7
-rw-r--r--drivers/message/fusion/mptfc.c1
-rw-r--r--drivers/message/fusion/mptsas.c64
-rw-r--r--drivers/message/fusion/mptscsih.c153
-rw-r--r--drivers/message/fusion/mptscsih.h1
-rw-r--r--drivers/message/fusion/mptspi.c1
7 files changed, 272 insertions, 0 deletions
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index 5a10c87239c2..9d29ee62b6eb 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -161,6 +161,7 @@ static int mpt_readScsiDevicePageHeaders(MPT_ADAPTER *ioc, int portnum);
161static void mpt_read_ioc_pg_1(MPT_ADAPTER *ioc); 161static void mpt_read_ioc_pg_1(MPT_ADAPTER *ioc);
162static void mpt_read_ioc_pg_4(MPT_ADAPTER *ioc); 162static void mpt_read_ioc_pg_4(MPT_ADAPTER *ioc);
163static void mpt_timer_expired(unsigned long data); 163static void mpt_timer_expired(unsigned long data);
164static void mpt_get_manufacturing_pg_0(MPT_ADAPTER *ioc);
164static int SendEventNotification(MPT_ADAPTER *ioc, u8 EvSwitch); 165static int SendEventNotification(MPT_ADAPTER *ioc, u8 EvSwitch);
165static int SendEventAck(MPT_ADAPTER *ioc, EventNotificationReply_t *evnp); 166static int SendEventAck(MPT_ADAPTER *ioc, EventNotificationReply_t *evnp);
166static int mpt_host_page_access_control(MPT_ADAPTER *ioc, u8 access_control_value, int sleepFlag); 167static int mpt_host_page_access_control(MPT_ADAPTER *ioc, u8 access_control_value, int sleepFlag);
@@ -1880,6 +1881,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
1880 } 1881 }
1881 1882
1882 GetIoUnitPage2(ioc); 1883 GetIoUnitPage2(ioc);
1884 mpt_get_manufacturing_pg_0(ioc);
1883 } 1885 }
1884 1886
1885 /* 1887 /*
@@ -5190,6 +5192,49 @@ mpt_read_ioc_pg_1(MPT_ADAPTER *ioc)
5190 return; 5192 return;
5191} 5193}
5192 5194
5195static void
5196mpt_get_manufacturing_pg_0(MPT_ADAPTER *ioc)
5197{
5198 CONFIGPARMS cfg;
5199 ConfigPageHeader_t hdr;
5200 dma_addr_t buf_dma;
5201 ManufacturingPage0_t *pbuf = NULL;
5202
5203 memset(&cfg, 0 , sizeof(CONFIGPARMS));
5204 memset(&hdr, 0 , sizeof(ConfigPageHeader_t));
5205
5206 hdr.PageType = MPI_CONFIG_PAGETYPE_MANUFACTURING;
5207 cfg.cfghdr.hdr = &hdr;
5208 cfg.physAddr = -1;
5209 cfg.action = MPI_CONFIG_ACTION_PAGE_HEADER;
5210 cfg.timeout = 10;
5211
5212 if (mpt_config(ioc, &cfg) != 0)
5213 goto out;
5214
5215 if (!cfg.cfghdr.hdr->PageLength)
5216 goto out;
5217
5218 cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT;
5219 pbuf = pci_alloc_consistent(ioc->pcidev, hdr.PageLength * 4, &buf_dma);
5220 if (!pbuf)
5221 goto out;
5222
5223 cfg.physAddr = buf_dma;
5224
5225 if (mpt_config(ioc, &cfg) != 0)
5226 goto out;
5227
5228 memcpy(ioc->board_name, pbuf->BoardName, sizeof(ioc->board_name));
5229 memcpy(ioc->board_assembly, pbuf->BoardAssembly, sizeof(ioc->board_assembly));
5230 memcpy(ioc->board_tracer, pbuf->BoardTracerNumber, sizeof(ioc->board_tracer));
5231
5232 out:
5233
5234 if (pbuf)
5235 pci_free_consistent(ioc->pcidev, hdr.PageLength * 4, pbuf, buf_dma);
5236}
5237
5193/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 5238/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5194/** 5239/**
5195 * SendEventNotification - Send EventNotification (on or off) request to adapter 5240 * SendEventNotification - Send EventNotification (on or off) request to adapter
diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h
index 05eb6e528753..959d24372d03 100644
--- a/drivers/message/fusion/mptbase.h
+++ b/drivers/message/fusion/mptbase.h
@@ -538,6 +538,13 @@ typedef struct _MPT_ADAPTER
538 int pci_irq; /* This irq */ 538 int pci_irq; /* This irq */
539 char name[MPT_NAME_LENGTH]; /* "iocN" */ 539 char name[MPT_NAME_LENGTH]; /* "iocN" */
540 char *prod_name; /* "LSIFC9x9" */ 540 char *prod_name; /* "LSIFC9x9" */
541 char board_name[16];
542 char board_assembly[16];
543 char board_tracer[16];
544 u16 nvdata_version_persistent;
545 u16 nvdata_version_default;
546 u8 io_missing_delay;
547 u8 device_missing_delay;
541 SYSIF_REGS __iomem *chip; /* == c8817000 (mmap) */ 548 SYSIF_REGS __iomem *chip; /* == c8817000 (mmap) */
542 SYSIF_REGS __iomem *pio_chip; /* Programmed IO (downloadboot) */ 549 SYSIF_REGS __iomem *pio_chip; /* Programmed IO (downloadboot) */
543 u8 bus_type; 550 u8 bus_type;
diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c
index b766445f19aa..d2db93b8aa99 100644
--- a/drivers/message/fusion/mptfc.c
+++ b/drivers/message/fusion/mptfc.c
@@ -130,6 +130,7 @@ static struct scsi_host_template mptfc_driver_template = {
130 .max_sectors = 8192, 130 .max_sectors = 8192,
131 .cmd_per_lun = 7, 131 .cmd_per_lun = 7,
132 .use_clustering = ENABLE_CLUSTERING, 132 .use_clustering = ENABLE_CLUSTERING,
133 .shost_attrs = mptscsih_host_attrs,
133}; 134};
134 135
135/**************************************************************************** 136/****************************************************************************
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
index 9e5424e1871f..030bb8389aee 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -1119,6 +1119,7 @@ static struct scsi_host_template mptsas_driver_template = {
1119 .max_sectors = 8192, 1119 .max_sectors = 8192,
1120 .cmd_per_lun = 7, 1120 .cmd_per_lun = 7,
1121 .use_clustering = ENABLE_CLUSTERING, 1121 .use_clustering = ENABLE_CLUSTERING,
1122 .shost_attrs = mptscsih_host_attrs,
1122}; 1123};
1123 1124
1124static int mptsas_get_linkerrors(struct sas_phy *phy) 1125static int mptsas_get_linkerrors(struct sas_phy *phy)
@@ -1390,6 +1391,11 @@ mptsas_sas_io_unit_pg0(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info)
1390 goto out_free_consistent; 1391 goto out_free_consistent;
1391 } 1392 }
1392 1393
1394 ioc->nvdata_version_persistent =
1395 le16_to_cpu(buffer->NvdataVersionPersistent);
1396 ioc->nvdata_version_default =
1397 le16_to_cpu(buffer->NvdataVersionDefault);
1398
1393 for (i = 0; i < port_info->num_phys; i++) { 1399 for (i = 0; i < port_info->num_phys; i++) {
1394 mptsas_print_phy_data(&buffer->PhyData[i]); 1400 mptsas_print_phy_data(&buffer->PhyData[i]);
1395 port_info->phy_info[i].phy_id = i; 1401 port_info->phy_info[i].phy_id = i;
@@ -1410,6 +1416,63 @@ mptsas_sas_io_unit_pg0(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info)
1410} 1416}
1411 1417
1412static int 1418static int
1419mptsas_sas_io_unit_pg1(MPT_ADAPTER *ioc)
1420{
1421 ConfigExtendedPageHeader_t hdr;
1422 CONFIGPARMS cfg;
1423 SasIOUnitPage1_t *buffer;
1424 dma_addr_t dma_handle;
1425 int error;
1426 u16 device_missing_delay;
1427
1428 memset(&hdr, 0, sizeof(ConfigExtendedPageHeader_t));
1429 memset(&cfg, 0, sizeof(CONFIGPARMS));
1430
1431 cfg.cfghdr.ehdr = &hdr;
1432 cfg.action = MPI_CONFIG_ACTION_PAGE_HEADER;
1433 cfg.timeout = 10;
1434 cfg.cfghdr.ehdr->PageType = MPI_CONFIG_PAGETYPE_EXTENDED;
1435 cfg.cfghdr.ehdr->ExtPageType = MPI_CONFIG_EXTPAGETYPE_SAS_IO_UNIT;
1436 cfg.cfghdr.ehdr->PageVersion = MPI_SASIOUNITPAGE1_PAGEVERSION;
1437 cfg.cfghdr.ehdr->PageNumber = 1;
1438
1439 error = mpt_config(ioc, &cfg);
1440 if (error)
1441 goto out;
1442 if (!hdr.ExtPageLength) {
1443 error = -ENXIO;
1444 goto out;
1445 }
1446
1447 buffer = pci_alloc_consistent(ioc->pcidev, hdr.ExtPageLength * 4,
1448 &dma_handle);
1449 if (!buffer) {
1450 error = -ENOMEM;
1451 goto out;
1452 }
1453
1454 cfg.physAddr = dma_handle;
1455 cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT;
1456
1457 error = mpt_config(ioc, &cfg);
1458 if (error)
1459 goto out_free_consistent;
1460
1461 ioc->io_missing_delay =
1462 le16_to_cpu(buffer->IODeviceMissingDelay);
1463 device_missing_delay = le16_to_cpu(buffer->ReportDeviceMissingDelay);
1464 ioc->device_missing_delay = (device_missing_delay & MPI_SAS_IOUNIT1_REPORT_MISSING_UNIT_16) ?
1465 (device_missing_delay & MPI_SAS_IOUNIT1_REPORT_MISSING_TIMEOUT_MASK) * 16 :
1466 device_missing_delay & MPI_SAS_IOUNIT1_REPORT_MISSING_TIMEOUT_MASK;
1467
1468 out_free_consistent:
1469 pci_free_consistent(ioc->pcidev, hdr.ExtPageLength * 4,
1470 buffer, dma_handle);
1471 out:
1472 return error;
1473}
1474
1475static int
1413mptsas_sas_phy_pg0(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info, 1476mptsas_sas_phy_pg0(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info,
1414 u32 form, u32 form_specific) 1477 u32 form, u32 form_specific)
1415{ 1478{
@@ -1990,6 +2053,7 @@ mptsas_probe_hba_phys(MPT_ADAPTER *ioc)
1990 if (error) 2053 if (error)
1991 goto out_free_port_info; 2054 goto out_free_port_info;
1992 2055
2056 mptsas_sas_io_unit_pg1(ioc);
1993 mutex_lock(&ioc->sas_topology_mutex); 2057 mutex_lock(&ioc->sas_topology_mutex);
1994 ioc->handle = hba->phy_info[0].handle; 2058 ioc->handle = hba->phy_info[0].handle;
1995 port_info = mptsas_find_portinfo_by_handle(ioc, ioc->handle); 2059 port_info = mptsas_find_portinfo_by_handle(ioc, ioc->handle);
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
index d35617376f87..fd3aa2619f42 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -3187,6 +3187,159 @@ mptscsih_synchronize_cache(MPT_SCSI_HOST *hd, VirtDevice *vdevice)
3187 mptscsih_do_cmd(hd, &iocmd); 3187 mptscsih_do_cmd(hd, &iocmd);
3188} 3188}
3189 3189
3190static ssize_t
3191mptscsih_version_fw_show(struct class_device *cdev, char *buf)
3192{
3193 struct Scsi_Host *host = class_to_shost(cdev);
3194 MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata;
3195 MPT_ADAPTER *ioc = hd->ioc;
3196
3197 return snprintf(buf, PAGE_SIZE, "%02d.%02d.%02d.%02d\n",
3198 (ioc->facts.FWVersion.Word & 0xFF000000) >> 24,
3199 (ioc->facts.FWVersion.Word & 0x00FF0000) >> 16,
3200 (ioc->facts.FWVersion.Word & 0x0000FF00) >> 8,
3201 ioc->facts.FWVersion.Word & 0x000000FF);
3202}
3203static CLASS_DEVICE_ATTR(version_fw, S_IRUGO, mptscsih_version_fw_show, NULL);
3204
3205static ssize_t
3206mptscsih_version_bios_show(struct class_device *cdev, char *buf)
3207{
3208 struct Scsi_Host *host = class_to_shost(cdev);
3209 MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata;
3210 MPT_ADAPTER *ioc = hd->ioc;
3211
3212 return snprintf(buf, PAGE_SIZE, "%02x.%02x.%02x.%02x\n",
3213 (ioc->biosVersion & 0xFF000000) >> 24,
3214 (ioc->biosVersion & 0x00FF0000) >> 16,
3215 (ioc->biosVersion & 0x0000FF00) >> 8,
3216 ioc->biosVersion & 0x000000FF);
3217}
3218static CLASS_DEVICE_ATTR(version_bios, S_IRUGO, mptscsih_version_bios_show, NULL);
3219
3220static ssize_t
3221mptscsih_version_mpi_show(struct class_device *cdev, char *buf)
3222{
3223 struct Scsi_Host *host = class_to_shost(cdev);
3224 MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata;
3225 MPT_ADAPTER *ioc = hd->ioc;
3226
3227 return snprintf(buf, PAGE_SIZE, "%03x\n", ioc->facts.MsgVersion);
3228}
3229static CLASS_DEVICE_ATTR(version_mpi, S_IRUGO, mptscsih_version_mpi_show, NULL);
3230
3231static ssize_t
3232mptscsih_version_product_show(struct class_device *cdev, char *buf)
3233{
3234 struct Scsi_Host *host = class_to_shost(cdev);
3235 MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata;
3236 MPT_ADAPTER *ioc = hd->ioc;
3237
3238 return snprintf(buf, PAGE_SIZE, "%s\n", ioc->prod_name);
3239}
3240static CLASS_DEVICE_ATTR(version_product, S_IRUGO,
3241 mptscsih_version_product_show, NULL);
3242
3243static ssize_t
3244mptscsih_version_nvdata_persistent_show(struct class_device *cdev, char *buf)
3245{
3246 struct Scsi_Host *host = class_to_shost(cdev);
3247 MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata;
3248 MPT_ADAPTER *ioc = hd->ioc;
3249
3250 return snprintf(buf, PAGE_SIZE, "%02xh\n",
3251 ioc->nvdata_version_persistent);
3252}
3253static CLASS_DEVICE_ATTR(version_nvdata_persistent, S_IRUGO,
3254 mptscsih_version_nvdata_persistent_show, NULL);
3255
3256static ssize_t
3257mptscsih_version_nvdata_default_show(struct class_device *cdev, char *buf)
3258{
3259 struct Scsi_Host *host = class_to_shost(cdev);
3260 MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata;
3261 MPT_ADAPTER *ioc = hd->ioc;
3262
3263 return snprintf(buf, PAGE_SIZE, "%02xh\n",ioc->nvdata_version_default);
3264}
3265static CLASS_DEVICE_ATTR(version_nvdata_default, S_IRUGO,
3266 mptscsih_version_nvdata_default_show, NULL);
3267
3268static ssize_t
3269mptscsih_board_name_show(struct class_device *cdev, char *buf)
3270{
3271 struct Scsi_Host *host = class_to_shost(cdev);
3272 MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata;
3273 MPT_ADAPTER *ioc = hd->ioc;
3274
3275 return snprintf(buf, PAGE_SIZE, "%s\n", ioc->board_name);
3276}
3277static CLASS_DEVICE_ATTR(board_name, S_IRUGO, mptscsih_board_name_show, NULL);
3278
3279static ssize_t
3280mptscsih_board_assembly_show(struct class_device *cdev, char *buf)
3281{
3282 struct Scsi_Host *host = class_to_shost(cdev);
3283 MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata;
3284 MPT_ADAPTER *ioc = hd->ioc;
3285
3286 return snprintf(buf, PAGE_SIZE, "%s\n", ioc->board_assembly);
3287}
3288static CLASS_DEVICE_ATTR(board_assembly, S_IRUGO,
3289 mptscsih_board_assembly_show, NULL);
3290
3291static ssize_t
3292mptscsih_board_tracer_show(struct class_device *cdev, char *buf)
3293{
3294 struct Scsi_Host *host = class_to_shost(cdev);
3295 MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata;
3296 MPT_ADAPTER *ioc = hd->ioc;
3297
3298 return snprintf(buf, PAGE_SIZE, "%s\n", ioc->board_tracer);
3299}
3300static CLASS_DEVICE_ATTR(board_tracer, S_IRUGO,
3301 mptscsih_board_tracer_show, NULL);
3302
3303static ssize_t
3304mptscsih_io_delay_show(struct class_device *cdev, char *buf)
3305{
3306 struct Scsi_Host *host = class_to_shost(cdev);
3307 MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata;
3308 MPT_ADAPTER *ioc = hd->ioc;
3309
3310 return snprintf(buf, PAGE_SIZE, "%02d\n", ioc->io_missing_delay);
3311}
3312static CLASS_DEVICE_ATTR(io_delay, S_IRUGO,
3313 mptscsih_io_delay_show, NULL);
3314
3315static ssize_t
3316mptscsih_device_delay_show(struct class_device *cdev, char *buf)
3317{
3318 struct Scsi_Host *host = class_to_shost(cdev);
3319 MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata;
3320 MPT_ADAPTER *ioc = hd->ioc;
3321
3322 return snprintf(buf, PAGE_SIZE, "%02d\n", ioc->device_missing_delay);
3323}
3324static CLASS_DEVICE_ATTR(device_delay, S_IRUGO,
3325 mptscsih_device_delay_show, NULL);
3326
3327struct class_device_attribute *mptscsih_host_attrs[] = {
3328 &class_device_attr_version_fw,
3329 &class_device_attr_version_bios,
3330 &class_device_attr_version_mpi,
3331 &class_device_attr_version_product,
3332 &class_device_attr_version_nvdata_persistent,
3333 &class_device_attr_version_nvdata_default,
3334 &class_device_attr_board_name,
3335 &class_device_attr_board_assembly,
3336 &class_device_attr_board_tracer,
3337 &class_device_attr_io_delay,
3338 &class_device_attr_device_delay,
3339 NULL,
3340};
3341EXPORT_SYMBOL(mptscsih_host_attrs);
3342
3190EXPORT_SYMBOL(mptscsih_remove); 3343EXPORT_SYMBOL(mptscsih_remove);
3191EXPORT_SYMBOL(mptscsih_shutdown); 3344EXPORT_SYMBOL(mptscsih_shutdown);
3192#ifdef CONFIG_PM 3345#ifdef CONFIG_PM
diff --git a/drivers/message/fusion/mptscsih.h b/drivers/message/fusion/mptscsih.h
index 8eccdfe5701a..67b088db2f10 100644
--- a/drivers/message/fusion/mptscsih.h
+++ b/drivers/message/fusion/mptscsih.h
@@ -129,3 +129,4 @@ extern void mptscsih_timer_expired(unsigned long data);
129extern int mptscsih_TMHandler(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, int lun, int ctx2abort, ulong timeout); 129extern int mptscsih_TMHandler(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, int lun, int ctx2abort, ulong timeout);
130extern u8 mptscsih_raid_id_to_num(MPT_ADAPTER *ioc, u8 channel, u8 id); 130extern u8 mptscsih_raid_id_to_num(MPT_ADAPTER *ioc, u8 channel, u8 id);
131extern int mptscsih_is_phys_disk(MPT_ADAPTER *ioc, u8 channel, u8 id); 131extern int mptscsih_is_phys_disk(MPT_ADAPTER *ioc, u8 channel, u8 id);
132extern struct class_device_attribute *mptscsih_host_attrs[];
diff --git a/drivers/message/fusion/mptspi.c b/drivers/message/fusion/mptspi.c
index 6b3e0c00952b..4d2c98104aeb 100644
--- a/drivers/message/fusion/mptspi.c
+++ b/drivers/message/fusion/mptspi.c
@@ -821,6 +821,7 @@ static struct scsi_host_template mptspi_driver_template = {
821 .max_sectors = 8192, 821 .max_sectors = 8192,
822 .cmd_per_lun = 7, 822 .cmd_per_lun = 7,
823 .use_clustering = ENABLE_CLUSTERING, 823 .use_clustering = ENABLE_CLUSTERING,
824 .shost_attrs = mptscsih_host_attrs,
824}; 825};
825 826
826static int mptspi_write_spi_device_pg1(struct scsi_target *starget, 827static int mptspi_write_spi_device_pg1(struct scsi_target *starget,