scsi: ufs: Change names related to error history

Remove "uic" term in below error history functions and structures for more
general usages,

struct ufs_uic_err_reg_hist;
void ufshcd_update_uic_reg_hist(struct ufs_uic_err_reg_hist *reg_hist,
	u32 reg);
void ufshcd_print_uic_err_hist(struct ufs_hba *hba,
	struct ufs_uic)err_reg_hist *err_hist, char *err_name);

Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
Stanley Chu 2019-07-10 21:38:18 +08:00 committed by Martin K. Petersen
parent 5f9e832c13
commit 48d5b97325
2 changed files with 30 additions and 29 deletions

View File

@ -390,14 +390,15 @@ static void ufshcd_print_clk_freqs(struct ufs_hba *hba)
}
}
static void ufshcd_print_uic_err_hist(struct ufs_hba *hba,
struct ufs_uic_err_reg_hist *err_hist, char *err_name)
static void ufshcd_print_err_hist(struct ufs_hba *hba,
struct ufs_err_reg_hist *err_hist,
char *err_name)
{
int i;
bool found = false;
for (i = 0; i < UIC_ERR_REG_HIST_LENGTH; i++) {
int p = (i + err_hist->pos) % UIC_ERR_REG_HIST_LENGTH;
for (i = 0; i < UFS_ERR_REG_HIST_LENGTH; i++) {
int p = (i + err_hist->pos) % UFS_ERR_REG_HIST_LENGTH;
if (err_hist->reg[p] == 0)
continue;
@ -407,7 +408,7 @@ static void ufshcd_print_uic_err_hist(struct ufs_hba *hba,
}
if (!found)
dev_err(hba->dev, "No record of %s uic errors\n", err_name);
dev_err(hba->dev, "No record of %s errors\n", err_name);
}
static void ufshcd_print_host_regs(struct ufs_hba *hba)
@ -423,11 +424,11 @@ static void ufshcd_print_host_regs(struct ufs_hba *hba)
ktime_to_us(hba->ufs_stats.last_hibern8_exit_tstamp),
hba->ufs_stats.hibern8_exit_cnt);
ufshcd_print_uic_err_hist(hba, &hba->ufs_stats.pa_err, "pa_err");
ufshcd_print_uic_err_hist(hba, &hba->ufs_stats.dl_err, "dl_err");
ufshcd_print_uic_err_hist(hba, &hba->ufs_stats.nl_err, "nl_err");
ufshcd_print_uic_err_hist(hba, &hba->ufs_stats.tl_err, "tl_err");
ufshcd_print_uic_err_hist(hba, &hba->ufs_stats.dme_err, "dme_err");
ufshcd_print_err_hist(hba, &hba->ufs_stats.pa_err, "pa_err");
ufshcd_print_err_hist(hba, &hba->ufs_stats.dl_err, "dl_err");
ufshcd_print_err_hist(hba, &hba->ufs_stats.nl_err, "nl_err");
ufshcd_print_err_hist(hba, &hba->ufs_stats.tl_err, "tl_err");
ufshcd_print_err_hist(hba, &hba->ufs_stats.dme_err, "dme_err");
ufshcd_print_clk_freqs(hba);
@ -5345,12 +5346,12 @@ out:
pm_runtime_put_sync(hba->dev);
}
static void ufshcd_update_uic_reg_hist(struct ufs_uic_err_reg_hist *reg_hist,
u32 reg)
static void ufshcd_update_reg_hist(struct ufs_err_reg_hist *reg_hist,
u32 reg)
{
reg_hist->reg[reg_hist->pos] = reg;
reg_hist->tstamp[reg_hist->pos] = ktime_get();
reg_hist->pos = (reg_hist->pos + 1) % UIC_ERR_REG_HIST_LENGTH;
reg_hist->pos = (reg_hist->pos + 1) % UFS_ERR_REG_HIST_LENGTH;
}
/**
@ -5371,13 +5372,13 @@ static void ufshcd_update_uic_error(struct ufs_hba *hba)
* must be checked but this error is handled separately.
*/
dev_dbg(hba->dev, "%s: UIC Lane error reported\n", __func__);
ufshcd_update_uic_reg_hist(&hba->ufs_stats.pa_err, reg);
ufshcd_update_reg_hist(&hba->ufs_stats.pa_err, reg);
}
/* PA_INIT_ERROR is fatal and needs UIC reset */
reg = ufshcd_readl(hba, REG_UIC_ERROR_CODE_DATA_LINK_LAYER);
if (reg)
ufshcd_update_uic_reg_hist(&hba->ufs_stats.dl_err, reg);
ufshcd_update_reg_hist(&hba->ufs_stats.dl_err, reg);
if (reg & UIC_DATA_LINK_LAYER_ERROR_PA_INIT)
hba->uic_error |= UFSHCD_UIC_DL_PA_INIT_ERROR;
@ -5393,19 +5394,19 @@ static void ufshcd_update_uic_error(struct ufs_hba *hba)
/* UIC NL/TL/DME errors needs software retry */
reg = ufshcd_readl(hba, REG_UIC_ERROR_CODE_NETWORK_LAYER);
if (reg) {
ufshcd_update_uic_reg_hist(&hba->ufs_stats.nl_err, reg);
ufshcd_update_reg_hist(&hba->ufs_stats.nl_err, reg);
hba->uic_error |= UFSHCD_UIC_NL_ERROR;
}
reg = ufshcd_readl(hba, REG_UIC_ERROR_CODE_TRANSPORT_LAYER);
if (reg) {
ufshcd_update_uic_reg_hist(&hba->ufs_stats.tl_err, reg);
ufshcd_update_reg_hist(&hba->ufs_stats.tl_err, reg);
hba->uic_error |= UFSHCD_UIC_TL_ERROR;
}
reg = ufshcd_readl(hba, REG_UIC_ERROR_CODE_DME);
if (reg) {
ufshcd_update_uic_reg_hist(&hba->ufs_stats.dme_err, reg);
ufshcd_update_reg_hist(&hba->ufs_stats.dme_err, reg);
hba->uic_error |= UFSHCD_UIC_DME_ERROR;
}
@ -6681,7 +6682,7 @@ static void ufshcd_tune_unipro_params(struct ufs_hba *hba)
static void ufshcd_clear_dbg_ufs_stats(struct ufs_hba *hba)
{
int err_reg_hist_size = sizeof(struct ufs_uic_err_reg_hist);
int err_reg_hist_size = sizeof(struct ufs_err_reg_hist);
hba->ufs_stats.hibern8_exit_cnt = 0;
hba->ufs_stats.last_hibern8_exit_tstamp = ktime_set(0, 0);

View File

@ -412,17 +412,17 @@ struct ufs_init_prefetch {
u32 icc_level;
};
#define UIC_ERR_REG_HIST_LENGTH 8
#define UFS_ERR_REG_HIST_LENGTH 8
/**
* struct ufs_uic_err_reg_hist - keeps history of uic errors
* struct ufs_err_reg_hist - keeps history of uic errors
* @pos: index to indicate cyclic buffer position
* @reg: cyclic buffer for registers value
* @tstamp: cyclic buffer for time stamp
*/
struct ufs_uic_err_reg_hist {
struct ufs_err_reg_hist {
int pos;
u32 reg[UIC_ERR_REG_HIST_LENGTH];
ktime_t tstamp[UIC_ERR_REG_HIST_LENGTH];
u32 reg[UFS_ERR_REG_HIST_LENGTH];
ktime_t tstamp[UFS_ERR_REG_HIST_LENGTH];
};
/**
@ -440,11 +440,11 @@ struct ufs_uic_err_reg_hist {
struct ufs_stats {
u32 hibern8_exit_cnt;
ktime_t last_hibern8_exit_tstamp;
struct ufs_uic_err_reg_hist pa_err;
struct ufs_uic_err_reg_hist dl_err;
struct ufs_uic_err_reg_hist nl_err;
struct ufs_uic_err_reg_hist tl_err;
struct ufs_uic_err_reg_hist dme_err;
struct ufs_err_reg_hist pa_err;
struct ufs_err_reg_hist dl_err;
struct ufs_err_reg_hist nl_err;
struct ufs_err_reg_hist tl_err;
struct ufs_err_reg_hist dme_err;
};
/**