diff options
author | Lalit Chandivade <lalit.chandivade@qlogic.com> | 2009-03-26 11:49:17 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2009-04-03 10:22:49 -0400 |
commit | 6e181be508cf81fda4407b4689befeb7e4149607 (patch) | |
tree | 27765812d249113374e9fdf9267f3043811fcb2e /drivers | |
parent | 2533cf671da0603129c8af9c31c735e1d2654e20 (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')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_attr.c | 56 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_fw.h | 1 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_gbl.h | 1 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_mbx.c | 26 |
4 files changed, 84 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 | ||
482 | static ssize_t | ||
483 | qla2x00_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 | |||
528 | static 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 | |||
482 | static struct sysfs_entry { | 537 | static 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 | ||
diff --git a/drivers/scsi/qla2xxx/qla_fw.h b/drivers/scsi/qla2xxx/qla_fw.h index 98301931772a..e47c4c3602de 100644 --- a/drivers/scsi/qla2xxx/qla_fw.h +++ b/drivers/scsi/qla2xxx/qla_fw.h | |||
@@ -1403,6 +1403,7 @@ struct access_chip_rsp_84xx { | |||
1403 | #define MBA_IDC_TIME_EXT 0x8102 | 1403 | #define MBA_IDC_TIME_EXT 0x8102 |
1404 | 1404 | ||
1405 | #define MBC_IDC_ACK 0x101 | 1405 | #define MBC_IDC_ACK 0x101 |
1406 | #define MBC_RESTART_MPI_FW 0x3d | ||
1406 | #define MBC_FLASH_ACCESS_CTRL 0x3e /* Control flash access. */ | 1407 | #define MBC_FLASH_ACCESS_CTRL 0x3e /* Control flash access. */ |
1407 | 1408 | ||
1408 | /* Flash access control option field bit definitions */ | 1409 | /* Flash access control option field bit definitions */ |
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index c75e7f98c242..41c3f41e6869 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h | |||
@@ -73,6 +73,7 @@ extern void qla2x00_abort_all_cmds(scsi_qla_host_t *, int); | |||
73 | extern int qla2x00_post_aen_work(struct scsi_qla_host *, enum | 73 | extern int qla2x00_post_aen_work(struct scsi_qla_host *, enum |
74 | fc_host_event_code, u32); | 74 | fc_host_event_code, u32); |
75 | extern int qla2x00_post_idc_ack_work(struct scsi_qla_host *, uint16_t *); | 75 | extern int qla2x00_post_idc_ack_work(struct scsi_qla_host *, uint16_t *); |
76 | extern int qla81xx_restart_mpi_firmware(scsi_qla_host_t *); | ||
76 | 77 | ||
77 | extern void qla2x00_abort_fcport_cmds(fc_port_t *); | 78 | extern void qla2x00_abort_fcport_cmds(fc_port_t *); |
78 | extern struct scsi_qla_host *qla2x00_create_host(struct scsi_host_template *, | 79 | extern struct scsi_qla_host *qla2x00_create_host(struct scsi_host_template *, |
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c index 2bc08d3b3537..dc5e5d9530c1 100644 --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c | |||
@@ -3325,3 +3325,29 @@ qla81xx_fac_erase_sector(scsi_qla_host_t *vha, uint32_t start, uint32_t finish) | |||
3325 | 3325 | ||
3326 | return rval; | 3326 | return rval; |
3327 | } | 3327 | } |
3328 | |||
3329 | int | ||
3330 | qla81xx_restart_mpi_firmware(scsi_qla_host_t *vha) | ||
3331 | { | ||
3332 | int rval = 0; | ||
3333 | mbx_cmd_t mc; | ||
3334 | mbx_cmd_t *mcp = &mc; | ||
3335 | |||
3336 | DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no)); | ||
3337 | |||
3338 | mcp->mb[0] = MBC_RESTART_MPI_FW; | ||
3339 | mcp->out_mb = MBX_0; | ||
3340 | mcp->in_mb = MBX_0|MBX_1; | ||
3341 | mcp->tov = MBX_TOV_SECONDS; | ||
3342 | mcp->flags = 0; | ||
3343 | rval = qla2x00_mailbox_command(vha, mcp); | ||
3344 | |||
3345 | if (rval != QLA_SUCCESS) { | ||
3346 | DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=0x%x mb[1]=0x%x.\n", | ||
3347 | __func__, vha->host_no, rval, mcp->mb[0], mcp->mb[1])); | ||
3348 | } else { | ||
3349 | DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no)); | ||
3350 | } | ||
3351 | |||
3352 | return rval; | ||
3353 | } | ||