aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx/qla_attr.c
diff options
context:
space:
mode:
authorLalit Chandivade <lalit.chandivade@qlogic.com>2009-03-26 11:49:17 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2009-04-03 10:22:49 -0400
commit6e181be508cf81fda4407b4689befeb7e4149607 (patch)
tree27765812d249113374e9fdf9267f3043811fcb2e /drivers/scsi/qla2xxx/qla_attr.c
parent2533cf671da0603129c8af9c31c735e1d2654e20 (diff)
[SCSI] qla2xxx: Add reset capabilities for application support.
Signed-off-by: Lalit Chandivade <lalit.chandivade@qlogic.com> Additional cleanups and Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_attr.c')
-rw-r--r--drivers/scsi/qla2xxx/qla_attr.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index 117517dcbe44..1f1a7c0e88e7 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -479,6 +479,61 @@ static struct bin_attribute sysfs_sfp_attr = {
479 .read = qla2x00_sysfs_read_sfp, 479 .read = qla2x00_sysfs_read_sfp,
480}; 480};
481 481
482static ssize_t
483qla2x00_sysfs_write_reset(struct kobject *kobj,
484 struct bin_attribute *bin_attr,
485 char *buf, loff_t off, size_t count)
486{
487 struct scsi_qla_host *vha = shost_priv(dev_to_shost(container_of(kobj,
488 struct device, kobj)));
489 struct qla_hw_data *ha = vha->hw;
490 int type;
491
492 if (off != 0)
493 return 0;
494
495 type = simple_strtol(buf, NULL, 10);
496 switch (type) {
497 case 0x2025c:
498 qla_printk(KERN_INFO, ha,
499 "Issuing ISP reset on (%ld).\n", vha->host_no);
500
501 scsi_block_requests(vha->host);
502 set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags);
503 qla2xxx_wake_dpc(vha);
504 qla2x00_wait_for_chip_reset(vha);
505 scsi_unblock_requests(vha->host);
506 break;
507 case 0x2025d:
508 if (!IS_QLA81XX(ha))
509 break;
510
511 qla_printk(KERN_INFO, ha,
512 "Issuing MPI reset on (%ld).\n", vha->host_no);
513
514 /* Make sure FC side is not in reset */
515 qla2x00_wait_for_hba_online(vha);
516
517 /* Issue MPI reset */
518 scsi_block_requests(vha->host);
519 if (qla81xx_restart_mpi_firmware(vha) != QLA_SUCCESS)
520 qla_printk(KERN_WARNING, ha,
521 "MPI reset failed on (%ld).\n", vha->host_no);
522 scsi_unblock_requests(vha->host);
523 break;
524 }
525 return count;
526}
527
528static struct bin_attribute sysfs_reset_attr = {
529 .attr = {
530 .name = "reset",
531 .mode = S_IWUSR,
532 },
533 .size = 0,
534 .write = qla2x00_sysfs_write_reset,
535};
536
482static struct sysfs_entry { 537static struct sysfs_entry {
483 char *name; 538 char *name;
484 struct bin_attribute *attr; 539 struct bin_attribute *attr;
@@ -490,6 +545,7 @@ static struct sysfs_entry {
490 { "optrom_ctl", &sysfs_optrom_ctl_attr, }, 545 { "optrom_ctl", &sysfs_optrom_ctl_attr, },
491 { "vpd", &sysfs_vpd_attr, 1 }, 546 { "vpd", &sysfs_vpd_attr, 1 },
492 { "sfp", &sysfs_sfp_attr, 1 }, 547 { "sfp", &sysfs_sfp_attr, 1 },
548 { "reset", &sysfs_reset_attr, },
493 { NULL }, 549 { NULL },
494}; 550};
495 551