Commit f2355862 authored by Yang Wang's avatar Yang Wang Committed by Alex Deucher

drm/amdgpu: add new aca smu callback func parse_error_code()

add new aca smu callback parse_error_code{} to avoid specific asic check
in amdgpu_aca.c file
Signed-off-by: default avatarYang Wang <kevinyang.wang@amd.com>
Reviewed-by: default avatarTao Zhou <tao.zhou1@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 86842046
...@@ -753,23 +753,13 @@ int aca_bank_info_decode(struct aca_bank *bank, struct aca_bank_info *info) ...@@ -753,23 +753,13 @@ int aca_bank_info_decode(struct aca_bank *bank, struct aca_bank_info *info)
static int aca_bank_get_error_code(struct amdgpu_device *adev, struct aca_bank *bank) static int aca_bank_get_error_code(struct amdgpu_device *adev, struct aca_bank *bank)
{ {
int error_code; struct amdgpu_aca *aca = &adev->aca;
const struct aca_smu_funcs *smu_funcs = aca->smu_funcs;
switch (amdgpu_ip_version(adev, MP1_HWIP, 0)) {
case IP_VERSION(13, 0, 6):
if (!(adev->flags & AMD_IS_APU) && adev->pm.fw_version >= 0x00555600) {
error_code = ACA_REG__SYND__ERRORINFORMATION(bank->regs[ACA_REG_IDX_SYND]);
return error_code & 0xff;
}
break;
default:
break;
}
/* NOTE: the true error code is encoded in status.errorcode[0:7] */ if (!smu_funcs || !smu_funcs->parse_error_code)
error_code = ACA_REG__STATUS__ERRORCODE(bank->regs[ACA_REG_IDX_STATUS]); return -EOPNOTSUPP;
return error_code & 0xff; return smu_funcs->parse_error_code(adev, bank);
} }
int aca_bank_check_error_codes(struct amdgpu_device *adev, struct aca_bank *bank, int *err_codes, int size) int aca_bank_check_error_codes(struct amdgpu_device *adev, struct aca_bank *bank, int *err_codes, int size)
...@@ -780,6 +770,9 @@ int aca_bank_check_error_codes(struct amdgpu_device *adev, struct aca_bank *bank ...@@ -780,6 +770,9 @@ int aca_bank_check_error_codes(struct amdgpu_device *adev, struct aca_bank *bank
return -EINVAL; return -EINVAL;
error_code = aca_bank_get_error_code(adev, bank); error_code = aca_bank_get_error_code(adev, bank);
if (error_code < 0)
return error_code;
for (i = 0; i < size; i++) { for (i = 0; i < size; i++) {
if (err_codes[i] == error_code) if (err_codes[i] == error_code)
return 0; return 0;
......
...@@ -173,6 +173,7 @@ struct aca_smu_funcs { ...@@ -173,6 +173,7 @@ struct aca_smu_funcs {
int (*set_debug_mode)(struct amdgpu_device *adev, bool enable); int (*set_debug_mode)(struct amdgpu_device *adev, bool enable);
int (*get_valid_aca_count)(struct amdgpu_device *adev, enum aca_smu_type type, u32 *count); int (*get_valid_aca_count)(struct amdgpu_device *adev, enum aca_smu_type type, u32 *count);
int (*get_valid_aca_bank)(struct amdgpu_device *adev, enum aca_smu_type type, int idx, struct aca_bank *bank); int (*get_valid_aca_bank)(struct amdgpu_device *adev, enum aca_smu_type type, int idx, struct aca_bank *bank);
int (*parse_error_code)(struct amdgpu_device *adev, struct aca_bank *bank);
}; };
struct amdgpu_aca { struct amdgpu_aca {
......
...@@ -3118,12 +3118,25 @@ static int aca_smu_get_valid_aca_bank(struct amdgpu_device *adev, ...@@ -3118,12 +3118,25 @@ static int aca_smu_get_valid_aca_bank(struct amdgpu_device *adev,
return 0; return 0;
} }
static int aca_smu_parse_error_code(struct amdgpu_device *adev, struct aca_bank *bank)
{
int error_code;
if (!(adev->flags & AMD_IS_APU) && adev->pm.fw_version >= 0x00555600)
error_code = ACA_REG__SYND__ERRORINFORMATION(bank->regs[ACA_REG_IDX_SYND]);
else
error_code = ACA_REG__STATUS__ERRORCODE(bank->regs[ACA_REG_IDX_STATUS]);
return error_code & 0xff;
}
static const struct aca_smu_funcs smu_v13_0_6_aca_smu_funcs = { static const struct aca_smu_funcs smu_v13_0_6_aca_smu_funcs = {
.max_ue_bank_count = 12, .max_ue_bank_count = 12,
.max_ce_bank_count = 12, .max_ce_bank_count = 12,
.set_debug_mode = aca_smu_set_debug_mode, .set_debug_mode = aca_smu_set_debug_mode,
.get_valid_aca_count = aca_smu_get_valid_aca_count, .get_valid_aca_count = aca_smu_get_valid_aca_count,
.get_valid_aca_bank = aca_smu_get_valid_aca_bank, .get_valid_aca_bank = aca_smu_get_valid_aca_bank,
.parse_error_code = aca_smu_parse_error_code,
}; };
static int smu_v13_0_6_select_xgmi_plpd_policy(struct smu_context *smu, static int smu_v13_0_6_select_xgmi_plpd_policy(struct smu_context *smu,
......
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