]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - drivers/scsi/qla2xxx/qla_mr.c
[SCSI] qla2xxx: Notify ISPFX00 firmware when driver is unloaded or system is shut...
[mirror_ubuntu-artful-kernel.git] / drivers / scsi / qla2xxx / qla_mr.c
index d7993797f46e1339d4a36e05b88c6a49905c1d96..ab2ae8e26fea26521ee714929d733ed10d7c3061 100644 (file)
@@ -294,7 +294,7 @@ premature_exit:
  * Context:
  *     Kernel context.
  */
-static int
+int
 qlafx00_driver_shutdown(scsi_qla_host_t *vha, int tmo)
 {
        int rval;
@@ -775,6 +775,29 @@ qlafx00_lun_reset(fc_port_t *fcport, unsigned int l, int tag)
        return qlafx00_async_tm_cmd(fcport, TCF_LUN_RESET, l, tag);
 }
 
+int
+qlafx00_loop_reset(scsi_qla_host_t *vha)
+{
+       int ret;
+       struct fc_port *fcport;
+       struct qla_hw_data *ha = vha->hw;
+
+       if (ql2xtargetreset) {
+               list_for_each_entry(fcport, &vha->vp_fcports, list) {
+                       if (fcport->port_type != FCT_TARGET)
+                               continue;
+
+                       ret = ha->isp_ops->target_reset(fcport, 0, 0);
+                       if (ret != QLA_SUCCESS) {
+                               ql_dbg(ql_dbg_taskm, vha, 0x803d,
+                                   "Bus Reset failed: Reset=%d "
+                                   "d_id=%x.\n", ret, fcport->d_id.b24);
+                       }
+               }
+       }
+       return QLA_SUCCESS;
+}
+
 int
 qlafx00_iospace_config(struct qla_hw_data *ha)
 {
@@ -1539,6 +1562,9 @@ qlafx00_timer_routine(scsi_qla_host_t *vha)
                } else if ((aenmbx0 & 0xFF00) == MBA_FW_POLL_STATE) {
                        ha->mr.fw_reset_timer_tick =
                            QLAFX00_MAX_RESET_INTERVAL;
+               } else if (aenmbx0 == MBA_FW_RESET_FCT) {
+                       ha->mr.fw_reset_timer_tick =
+                           QLAFX00_MAX_RESET_INTERVAL;
                }
                ha->mr.old_aenmbx0_state = aenmbx0;
                ha->mr.fw_reset_timer_tick--;
@@ -1603,6 +1629,14 @@ qlafx00_abort_isp(scsi_qla_host_t *vha)
 
                scsi_block_requests(vha->host);
                qlafx00_abort_isp_cleanup(vha);
+       } else {
+               scsi_block_requests(vha->host);
+               clear_bit(ISP_ABORT_NEEDED, &vha->dpc_flags);
+               vha->qla_stats.total_isp_aborts++;
+               ha->isp_ops->reset_chip(vha);
+               set_bit(FX00_RESET_RECOVERY, &vha->dpc_flags);
+               /* Clear the Interrupts */
+               QLAFX00_CLR_INTR_REG(ha, QLAFX00_HST_INT_STS_BITS);
        }
 
        ql_log(ql_log_info, vha, 0x0145,
@@ -2028,7 +2062,6 @@ qlafx00_initialize_adapter(scsi_qla_host_t *vha)
        vha->flags.reset_active = 0;
        ha->flags.pci_channel_io_perm_failure = 0;
        ha->flags.eeh_busy = 0;
-       ha->thermal_support = 0;
        atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME);
        atomic_set(&vha->loop_state, LOOP_DOWN);
        vha->device_flags = DFLG_NO_CABLE;
@@ -2526,16 +2559,13 @@ check_scsi_status:
 
        if (logit)
                ql_dbg(ql_dbg_io, fcport->vha, 0x3058,
-                   "FCP command status: 0x%x-0x%x (0x%x) "
-                   "nexus=%ld:%d:%d tgt_id: 0x%x lscsi_status: 0x%x"
-                   "cdb=%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x len=0x%x "
-                   "rsp_info=0x%x resid=0x%x fw_resid=0x%x "
-                   "sense_len=0x%x, par_sense_len=0x%x, rsp_info_len=0x%x\n",
+                   "FCP command status: 0x%x-0x%x (0x%x) nexus=%ld:%d:%d "
+                   "tgt_id: 0x%x lscsi_status: 0x%x cdb=%10phN len=0x%x "
+                   "rsp_info=0x%x resid=0x%x fw_resid=0x%x sense_len=0x%x, "
+                   "par_sense_len=0x%x, rsp_info_len=0x%x\n",
                    comp_status, scsi_status, res, vha->host_no,
                    cp->device->id, cp->device->lun, fcport->tgt_id,
-                   lscsi_status, cp->cmnd[0], cp->cmnd[1], cp->cmnd[2],
-                   cp->cmnd[3], cp->cmnd[4], cp->cmnd[5], cp->cmnd[6],
-                   cp->cmnd[7], cp->cmnd[8], cp->cmnd[9], scsi_bufflen(cp),
+                   lscsi_status, cp->cmnd, scsi_bufflen(cp),
                    rsp_info_len, resid_len, fw_resid_len, sense_len,
                    par_sense_len, rsp_info_len);