OSDN Git Service

scsi: ufs: dump hw regs on link failures
authorVenkat Gopalakrishnan <venkatg@codeaurora.org>
Fri, 26 Aug 2016 23:23:30 +0000 (16:23 -0700)
committerVenkat Gopalakrishnan <venkatg@codeaurora.org>
Mon, 12 Sep 2016 18:30:36 +0000 (11:30 -0700)
Dump host state, power info and host/vendor specific registers
on link failures. This provides useful info to debug the failures.

Change-Id: I76a4ea56f3aee6a51a5930381ad8d12ca8b43551
Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
drivers/scsi/ufs/ufshcd.c

index a49b3c7..d478767 100644 (file)
@@ -3932,8 +3932,12 @@ static int ufshcd_uic_pwr_ctrl(struct ufs_hba *hba, struct uic_command *cmd)
                ret = (status != PWR_OK) ? status : -1;
        }
 out:
-       if (ret)
+       if (ret) {
                ufsdbg_set_err_state(hba);
+               ufshcd_print_host_state(hba);
+               ufshcd_print_pwr_info(hba);
+               ufshcd_print_host_regs(hba);
+       }
 
        ufshcd_save_tstamp_of_last_dme_cmd(hba);
        spin_lock_irqsave(hba->host->host_lock, flags);
@@ -4644,8 +4648,12 @@ link_startup:
 
        ret = ufshcd_make_hba_operational(hba);
 out:
-       if (ret)
+       if (ret) {
                dev_err(hba->dev, "link startup failed %d\n", ret);
+               ufshcd_print_host_state(hba);
+               ufshcd_print_pwr_info(hba);
+               ufshcd_print_host_regs(hba);
+       }
        return ret;
 }