aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/mpt2sas/mpt2sas_ctl.c
diff options
context:
space:
mode:
authorKashyap, Desai <kashyap.desai@lsi.com>2009-09-23 07:56:58 -0400
committerJames Bottomley <James.Bottomley@suse.de>2009-10-29 13:03:10 -0400
commitfa7f31673583a6e0876f8bb420735cdd8a3ffa57 (patch)
tree5b547d903081571bc2cc5950de513beba4895ed0 /drivers/scsi/mpt2sas/mpt2sas_ctl.c
parent9fec5f9fc2fbe7c6e39db01ae296528d9a20a5b1 (diff)
[SCSI] mpt2sas: Support for stopping driver when Firmware encounters
Added command line option and shost sysfs attribute called mpt2sas_fwfault_debug. When enduser writes a "1" to this parameter, this will enable support in the driver for debugging firmware timeout related issues. This handling was added in three areas (a) scsi error handling callback called task_abort, (b) IOCTL interface, and (c) other timeouts that result in diag resets, such as manufacturing config pages. When this support is enabled, the driver will provide dump_stack to console, halt controller firmware, and panic driver. The end user probably would want to setup serial console redirection so the dump stack can be seen. Here are the three methods for enable this support: (a) # insmod mpt2sas.ko mpt2sas_fwfault_debug=1 (b) # echo 1 > /sys/module/mpt2sas/parameters/mpt2sas_fwfault_debug (c) # echo 1 > /sys/class/scsi_host/host#/fwfault_debug (where # is the host number) Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com> Signed-off-by: Eric Moore <Eric.moore@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/mpt2sas/mpt2sas_ctl.c')
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_ctl.c41
1 files changed, 39 insertions, 2 deletions
diff --git a/drivers/scsi/mpt2sas/mpt2sas_ctl.c b/drivers/scsi/mpt2sas/mpt2sas_ctl.c
index 57d724633906..6901a6706ede 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_ctl.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_ctl.c
@@ -896,6 +896,7 @@ _ctl_do_mpt_command(struct MPT2SAS_ADAPTER *ioc,
896 printk(MPT2SAS_INFO_FMT "issue target reset: handle " 896 printk(MPT2SAS_INFO_FMT "issue target reset: handle "
897 "= (0x%04x)\n", ioc->name, 897 "= (0x%04x)\n", ioc->name,
898 mpi_request->FunctionDependent1); 898 mpi_request->FunctionDependent1);
899 mpt2sas_halt_firmware(ioc);
899 mutex_lock(&ioc->tm_cmds.mutex); 900 mutex_lock(&ioc->tm_cmds.mutex);
900 mpt2sas_scsih_issue_tm(ioc, 901 mpt2sas_scsih_issue_tm(ioc,
901 mpi_request->FunctionDependent1, 0, 902 mpi_request->FunctionDependent1, 0,
@@ -2474,6 +2475,43 @@ _ctl_logging_level_store(struct device *cdev, struct device_attribute *attr,
2474static DEVICE_ATTR(logging_level, S_IRUGO | S_IWUSR, 2475static DEVICE_ATTR(logging_level, S_IRUGO | S_IWUSR,
2475 _ctl_logging_level_show, _ctl_logging_level_store); 2476 _ctl_logging_level_show, _ctl_logging_level_store);
2476 2477
2478/* device attributes */
2479/*
2480 * _ctl_fwfault_debug_show - show/store fwfault_debug
2481 * @cdev - pointer to embedded class device
2482 * @buf - the buffer returned
2483 *
2484 * mpt2sas_fwfault_debug is command line option
2485 * A sysfs 'read/write' shost attribute.
2486 */
2487static ssize_t
2488_ctl_fwfault_debug_show(struct device *cdev,
2489 struct device_attribute *attr, char *buf)
2490{
2491 struct Scsi_Host *shost = class_to_shost(cdev);
2492 struct MPT2SAS_ADAPTER *ioc = shost_priv(shost);
2493
2494 return snprintf(buf, PAGE_SIZE, "%d\n", ioc->fwfault_debug);
2495}
2496static ssize_t
2497_ctl_fwfault_debug_store(struct device *cdev,
2498 struct device_attribute *attr, const char *buf, size_t count)
2499{
2500 struct Scsi_Host *shost = class_to_shost(cdev);
2501 struct MPT2SAS_ADAPTER *ioc = shost_priv(shost);
2502 int val = 0;
2503
2504 if (sscanf(buf, "%d", &val) != 1)
2505 return -EINVAL;
2506
2507 ioc->fwfault_debug = val;
2508 printk(MPT2SAS_INFO_FMT "fwfault_debug=%d\n", ioc->name,
2509 ioc->fwfault_debug);
2510 return strlen(buf);
2511}
2512static DEVICE_ATTR(fwfault_debug, S_IRUGO | S_IWUSR,
2513 _ctl_fwfault_debug_show, _ctl_fwfault_debug_store);
2514
2477struct device_attribute *mpt2sas_host_attrs[] = { 2515struct device_attribute *mpt2sas_host_attrs[] = {
2478 &dev_attr_version_fw, 2516 &dev_attr_version_fw,
2479 &dev_attr_version_bios, 2517 &dev_attr_version_bios,
@@ -2487,13 +2525,12 @@ struct device_attribute *mpt2sas_host_attrs[] = {
2487 &dev_attr_io_delay, 2525 &dev_attr_io_delay,
2488 &dev_attr_device_delay, 2526 &dev_attr_device_delay,
2489 &dev_attr_logging_level, 2527 &dev_attr_logging_level,
2528 &dev_attr_fwfault_debug,
2490 &dev_attr_fw_queue_depth, 2529 &dev_attr_fw_queue_depth,
2491 &dev_attr_host_sas_address, 2530 &dev_attr_host_sas_address,
2492 NULL, 2531 NULL,
2493}; 2532};
2494 2533
2495/* device attributes */
2496
2497/** 2534/**
2498 * _ctl_device_sas_address_show - sas address 2535 * _ctl_device_sas_address_show - sas address
2499 * @cdev - pointer to embedded class device 2536 * @cdev - pointer to embedded class device