Merge branches 'clk-range', 'clk-uniphier', 'clk-apple' and 'clk-qcom' into clk-next
[linux-2.6-microblaze.git] / drivers / scsi / lpfc / lpfc_attr.c
index dd4c51b..bac78fb 100644 (file)
@@ -1709,25 +1709,25 @@ lpfc_sli4_pdev_reg_request(struct lpfc_hba *phba, uint32_t opcode)
        before_fc_flag = phba->pport->fc_flag;
        sriov_nr_virtfn = phba->cfg_sriov_nr_virtfn;
 
-       /* Disable SR-IOV virtual functions if enabled */
-       if (phba->cfg_sriov_nr_virtfn) {
-               pci_disable_sriov(pdev);
-               phba->cfg_sriov_nr_virtfn = 0;
-       }
+       if (opcode == LPFC_FW_DUMP) {
+               init_completion(&online_compl);
+               phba->fw_dump_cmpl = &online_compl;
+       } else {
+               /* Disable SR-IOV virtual functions if enabled */
+               if (phba->cfg_sriov_nr_virtfn) {
+                       pci_disable_sriov(pdev);
+                       phba->cfg_sriov_nr_virtfn = 0;
+               }
 
-       if (opcode == LPFC_FW_DUMP)
-               phba->hba_flag |= HBA_FW_DUMP_OP;
+               status = lpfc_do_offline(phba, LPFC_EVT_OFFLINE);
 
-       status = lpfc_do_offline(phba, LPFC_EVT_OFFLINE);
+               if (status != 0)
+                       return status;
 
-       if (status != 0) {
-               phba->hba_flag &= ~HBA_FW_DUMP_OP;
-               return status;
+               /* wait for the device to be quiesced before firmware reset */
+               msleep(100);
        }
 
-       /* wait for the device to be quiesced before firmware reset */
-       msleep(100);
-
        reg_val = readl(phba->sli4_hba.conf_regs_memmap_p +
                        LPFC_CTL_PDEV_CTL_OFFSET);
 
@@ -1756,24 +1756,42 @@ lpfc_sli4_pdev_reg_request(struct lpfc_hba *phba, uint32_t opcode)
                lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
                                "3153 Fail to perform the requested "
                                "access: x%x\n", reg_val);
+               if (phba->fw_dump_cmpl)
+                       phba->fw_dump_cmpl = NULL;
                return rc;
        }
 
        /* keep the original port state */
-       if (before_fc_flag & FC_OFFLINE_MODE)
-               goto out;
-
-       init_completion(&online_compl);
-       job_posted = lpfc_workq_post_event(phba, &status, &online_compl,
-                                          LPFC_EVT_ONLINE);
-       if (!job_posted)
+       if (before_fc_flag & FC_OFFLINE_MODE) {
+               if (phba->fw_dump_cmpl)
+                       phba->fw_dump_cmpl = NULL;
                goto out;
+       }
 
-       wait_for_completion(&online_compl);
+       /* Firmware dump will trigger an HA_ERATT event, and
+        * lpfc_handle_eratt_s4 routine already handles bringing the port back
+        * online.
+        */
+       if (opcode == LPFC_FW_DUMP) {
+               wait_for_completion(phba->fw_dump_cmpl);
+       } else  {
+               init_completion(&online_compl);
+               job_posted = lpfc_workq_post_event(phba, &status, &online_compl,
+                                                  LPFC_EVT_ONLINE);
+               if (!job_posted)
+                       goto out;
 
+               wait_for_completion(&online_compl);
+       }
 out:
        /* in any case, restore the virtual functions enabled as before */
        if (sriov_nr_virtfn) {
+               /* If fw_dump was performed, first disable to clean up */
+               if (opcode == LPFC_FW_DUMP) {
+                       pci_disable_sriov(pdev);
+                       phba->cfg_sriov_nr_virtfn = 0;
+               }
+
                sriov_err =
                        lpfc_sli_probe_sriov_nr_virtfn(phba, sriov_nr_virtfn);
                if (!sriov_err)
@@ -3960,8 +3978,8 @@ LPFC_ATTR_R(nvmet_mrq_post,
  *                    3 - register both FCP and NVME
  * Supported values are [1,3]. Default value is 3
  */
-LPFC_ATTR_R(enable_fc4_type, LPFC_ENABLE_BOTH,
-           LPFC_ENABLE_FCP, LPFC_ENABLE_BOTH,
+LPFC_ATTR_R(enable_fc4_type, LPFC_DEF_ENBL_FC4_TYPE,
+           LPFC_ENABLE_FCP, LPFC_MAX_ENBL_FC4_TYPE,
            "Enable FC4 Protocol support - FCP / NVME");
 
 /*