Commit 48d5b973 authored by Stanley Chu's avatar Stanley Chu Committed by Martin K. Petersen

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: default avatarStanley Chu <stanley.chu@mediatek.com>
Reviewed-by: default avatarAvri Altman <avri.altman@wdc.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 5f9e832c
...@@ -390,14 +390,15 @@ static void ufshcd_print_clk_freqs(struct ufs_hba *hba) ...@@ -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, static void ufshcd_print_err_hist(struct ufs_hba *hba,
struct ufs_uic_err_reg_hist *err_hist, char *err_name) struct ufs_err_reg_hist *err_hist,
char *err_name)
{ {
int i; int i;
bool found = false; bool found = false;
for (i = 0; i < UIC_ERR_REG_HIST_LENGTH; i++) { for (i = 0; i < UFS_ERR_REG_HIST_LENGTH; i++) {
int p = (i + err_hist->pos) % UIC_ERR_REG_HIST_LENGTH; int p = (i + err_hist->pos) % UFS_ERR_REG_HIST_LENGTH;
if (err_hist->reg[p] == 0) if (err_hist->reg[p] == 0)
continue; continue;
...@@ -407,7 +408,7 @@ static void ufshcd_print_uic_err_hist(struct ufs_hba *hba, ...@@ -407,7 +408,7 @@ static void ufshcd_print_uic_err_hist(struct ufs_hba *hba,
} }
if (!found) 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) static void ufshcd_print_host_regs(struct ufs_hba *hba)
...@@ -423,11 +424,11 @@ 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), ktime_to_us(hba->ufs_stats.last_hibern8_exit_tstamp),
hba->ufs_stats.hibern8_exit_cnt); hba->ufs_stats.hibern8_exit_cnt);
ufshcd_print_uic_err_hist(hba, &hba->ufs_stats.pa_err, "pa_err"); ufshcd_print_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_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_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_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.dme_err, "dme_err");
ufshcd_print_clk_freqs(hba); ufshcd_print_clk_freqs(hba);
...@@ -5345,12 +5346,12 @@ static void ufshcd_err_handler(struct work_struct *work) ...@@ -5345,12 +5346,12 @@ static void ufshcd_err_handler(struct work_struct *work)
pm_runtime_put_sync(hba->dev); pm_runtime_put_sync(hba->dev);
} }
static void ufshcd_update_uic_reg_hist(struct ufs_uic_err_reg_hist *reg_hist, static void ufshcd_update_reg_hist(struct ufs_err_reg_hist *reg_hist,
u32 reg) u32 reg)
{ {
reg_hist->reg[reg_hist->pos] = reg; reg_hist->reg[reg_hist->pos] = reg;
reg_hist->tstamp[reg_hist->pos] = ktime_get(); 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) ...@@ -5371,13 +5372,13 @@ static void ufshcd_update_uic_error(struct ufs_hba *hba)
* must be checked but this error is handled separately. * must be checked but this error is handled separately.
*/ */
dev_dbg(hba->dev, "%s: UIC Lane error reported\n", __func__); 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 */ /* PA_INIT_ERROR is fatal and needs UIC reset */
reg = ufshcd_readl(hba, REG_UIC_ERROR_CODE_DATA_LINK_LAYER); reg = ufshcd_readl(hba, REG_UIC_ERROR_CODE_DATA_LINK_LAYER);
if (reg) 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) if (reg & UIC_DATA_LINK_LAYER_ERROR_PA_INIT)
hba->uic_error |= UFSHCD_UIC_DL_PA_INIT_ERROR; hba->uic_error |= UFSHCD_UIC_DL_PA_INIT_ERROR;
...@@ -5393,19 +5394,19 @@ static void ufshcd_update_uic_error(struct ufs_hba *hba) ...@@ -5393,19 +5394,19 @@ static void ufshcd_update_uic_error(struct ufs_hba *hba)
/* UIC NL/TL/DME errors needs software retry */ /* UIC NL/TL/DME errors needs software retry */
reg = ufshcd_readl(hba, REG_UIC_ERROR_CODE_NETWORK_LAYER); reg = ufshcd_readl(hba, REG_UIC_ERROR_CODE_NETWORK_LAYER);
if (reg) { 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; hba->uic_error |= UFSHCD_UIC_NL_ERROR;
} }
reg = ufshcd_readl(hba, REG_UIC_ERROR_CODE_TRANSPORT_LAYER); reg = ufshcd_readl(hba, REG_UIC_ERROR_CODE_TRANSPORT_LAYER);
if (reg) { 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; hba->uic_error |= UFSHCD_UIC_TL_ERROR;
} }
reg = ufshcd_readl(hba, REG_UIC_ERROR_CODE_DME); reg = ufshcd_readl(hba, REG_UIC_ERROR_CODE_DME);
if (reg) { 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; hba->uic_error |= UFSHCD_UIC_DME_ERROR;
} }
...@@ -6681,7 +6682,7 @@ static void ufshcd_tune_unipro_params(struct ufs_hba *hba) ...@@ -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) 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.hibern8_exit_cnt = 0;
hba->ufs_stats.last_hibern8_exit_tstamp = ktime_set(0, 0); hba->ufs_stats.last_hibern8_exit_tstamp = ktime_set(0, 0);
......
...@@ -412,17 +412,17 @@ struct ufs_init_prefetch { ...@@ -412,17 +412,17 @@ struct ufs_init_prefetch {
u32 icc_level; 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 * @pos: index to indicate cyclic buffer position
* @reg: cyclic buffer for registers value * @reg: cyclic buffer for registers value
* @tstamp: cyclic buffer for time stamp * @tstamp: cyclic buffer for time stamp
*/ */
struct ufs_uic_err_reg_hist { struct ufs_err_reg_hist {
int pos; int pos;
u32 reg[UIC_ERR_REG_HIST_LENGTH]; u32 reg[UFS_ERR_REG_HIST_LENGTH];
ktime_t tstamp[UIC_ERR_REG_HIST_LENGTH]; ktime_t tstamp[UFS_ERR_REG_HIST_LENGTH];
}; };
/** /**
...@@ -440,11 +440,11 @@ struct ufs_uic_err_reg_hist { ...@@ -440,11 +440,11 @@ struct ufs_uic_err_reg_hist {
struct ufs_stats { struct ufs_stats {
u32 hibern8_exit_cnt; u32 hibern8_exit_cnt;
ktime_t last_hibern8_exit_tstamp; ktime_t last_hibern8_exit_tstamp;
struct ufs_uic_err_reg_hist pa_err; struct ufs_err_reg_hist pa_err;
struct ufs_uic_err_reg_hist dl_err; struct ufs_err_reg_hist dl_err;
struct ufs_uic_err_reg_hist nl_err; struct ufs_err_reg_hist nl_err;
struct ufs_uic_err_reg_hist tl_err; struct ufs_err_reg_hist tl_err;
struct ufs_uic_err_reg_hist dme_err; struct ufs_err_reg_hist dme_err;
}; };
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment