提交 1ce9cd7f 编写于 作者: B Borislav Petkov 提交者: Thomas Gleixner

x86/RAS: Simplify SMCA HWID descriptor struct

Call it simply smca_hwid and call local variables "hwid". More readable.
Signed-off-by: NBorislav Petkov <bp@suse.de>
Tested-by: NYazen Ghannam <yazen.ghannam@amd.com>
Link: http://lkml.kernel.org/r/20161103125556.15482-2-bp@alien8.deSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
上级 79349f52
...@@ -365,14 +365,14 @@ extern struct smca_bank_name smca_bank_names[N_SMCA_BANK_TYPES]; ...@@ -365,14 +365,14 @@ extern struct smca_bank_name smca_bank_names[N_SMCA_BANK_TYPES];
#define HWID_MCATYPE(hwid, mcatype) ((hwid << 16) | mcatype) #define HWID_MCATYPE(hwid, mcatype) ((hwid << 16) | mcatype)
struct smca_hwid_mcatype { struct smca_hwid {
unsigned int bank_type; /* Use with smca_bank_types for easy indexing. */ unsigned int bank_type; /* Use with smca_bank_types for easy indexing. */
u32 hwid_mcatype; /* (hwid,mcatype) tuple */ u32 hwid_mcatype; /* (hwid,mcatype) tuple */
u32 xec_bitmap; /* Bitmap of valid ExtErrorCodes; current max is 21. */ u32 xec_bitmap; /* Bitmap of valid ExtErrorCodes; current max is 21. */
}; };
struct smca_bank { struct smca_bank {
struct smca_hwid_mcatype *type; struct smca_hwid *hwid;
/* Instance ID */ /* Instance ID */
u32 id; u32 id;
}; };
......
...@@ -86,7 +86,7 @@ struct smca_bank_name smca_bank_names[] = { ...@@ -86,7 +86,7 @@ struct smca_bank_name smca_bank_names[] = {
}; };
EXPORT_SYMBOL_GPL(smca_bank_names); EXPORT_SYMBOL_GPL(smca_bank_names);
static struct smca_hwid_mcatype smca_hwid_mcatypes[] = { static struct smca_hwid smca_hwid_mcatypes[] = {
/* { bank_type, hwid_mcatype, xec_bitmap } */ /* { bank_type, hwid_mcatype, xec_bitmap } */
/* ZN Core (HWID=0xB0) MCA types */ /* ZN Core (HWID=0xB0) MCA types */
...@@ -142,16 +142,11 @@ static void default_deferred_error_interrupt(void) ...@@ -142,16 +142,11 @@ static void default_deferred_error_interrupt(void)
} }
void (*deferred_error_int_vector)(void) = default_deferred_error_interrupt; void (*deferred_error_int_vector)(void) = default_deferred_error_interrupt;
/*
* CPU Initialization
*/
static void get_smca_bank_info(unsigned int bank) static void get_smca_bank_info(unsigned int bank)
{ {
unsigned int i, hwid_mcatype, cpu = smp_processor_id(); unsigned int i, hwid_mcatype, cpu = smp_processor_id();
struct smca_hwid_mcatype *type; struct smca_hwid *s_hwid;
u32 high, instance_id; u32 high, instance_id;
u16 hwid, mcatype;
/* Collect bank_info using CPU 0 for now. */ /* Collect bank_info using CPU 0 for now. */
if (cpu) if (cpu)
...@@ -162,14 +157,13 @@ static void get_smca_bank_info(unsigned int bank) ...@@ -162,14 +157,13 @@ static void get_smca_bank_info(unsigned int bank)
return; return;
} }
hwid = high & MCI_IPID_HWID; hwid_mcatype = HWID_MCATYPE(high & MCI_IPID_HWID,
mcatype = (high & MCI_IPID_MCATYPE) >> 16; (high & MCI_IPID_MCATYPE) >> 16);
hwid_mcatype = HWID_MCATYPE(hwid, mcatype);
for (i = 0; i < ARRAY_SIZE(smca_hwid_mcatypes); i++) { for (i = 0; i < ARRAY_SIZE(smca_hwid_mcatypes); i++) {
type = &smca_hwid_mcatypes[i]; s_hwid = &smca_hwid_mcatypes[i];
if (hwid_mcatype == type->hwid_mcatype) { if (hwid_mcatype == s_hwid->hwid_mcatype) {
smca_banks[bank].type = type; smca_banks[bank].hwid = s_hwid;
smca_banks[bank].id = instance_id; smca_banks[bank].id = instance_id;
break; break;
} }
...@@ -826,10 +820,10 @@ static const char *get_name(unsigned int bank, struct threshold_block *b) ...@@ -826,10 +820,10 @@ static const char *get_name(unsigned int bank, struct threshold_block *b)
return th_names[bank]; return th_names[bank];
} }
if (!smca_banks[bank].type) if (!smca_banks[bank].hwid)
return NULL; return NULL;
bank_type = smca_banks[bank].type->bank_type; bank_type = smca_banks[bank].hwid->bank_type;
if (b && bank_type == SMCA_UMC) { if (b && bank_type == SMCA_UMC) {
if (b->block < ARRAY_SIZE(smca_umc_block_names)) if (b->block < ARRAY_SIZE(smca_umc_block_names))
......
...@@ -851,7 +851,7 @@ static void decode_mc6_mce(struct mce *m) ...@@ -851,7 +851,7 @@ static void decode_mc6_mce(struct mce *m)
/* Decode errors according to Scalable MCA specification */ /* Decode errors according to Scalable MCA specification */
static void decode_smca_errors(struct mce *m) static void decode_smca_errors(struct mce *m)
{ {
struct smca_hwid_mcatype *type; struct smca_hwid *hwid;
unsigned int bank_type; unsigned int bank_type;
const char *ip_name; const char *ip_name;
u8 xec = XEC(m->status, xec_mask); u8 xec = XEC(m->status, xec_mask);
...@@ -862,18 +862,18 @@ static void decode_smca_errors(struct mce *m) ...@@ -862,18 +862,18 @@ static void decode_smca_errors(struct mce *m)
if (boot_cpu_data.x86 >= 0x17 && m->bank == 4) if (boot_cpu_data.x86 >= 0x17 && m->bank == 4)
pr_emerg(HW_ERR "Bank 4 is reserved on Fam17h.\n"); pr_emerg(HW_ERR "Bank 4 is reserved on Fam17h.\n");
type = smca_banks[m->bank].type; hwid = smca_banks[m->bank].hwid;
if (!type) if (!hwid)
return; return;
bank_type = type->bank_type; bank_type = hwid->bank_type;
ip_name = smca_bank_names[bank_type].long_name; ip_name = smca_bank_names[bank_type].long_name;
pr_emerg(HW_ERR "%s Extended Error Code: %d\n", ip_name, xec); pr_emerg(HW_ERR "%s Extended Error Code: %d\n", ip_name, xec);
/* Only print the decode of valid error codes */ /* Only print the decode of valid error codes */
if (xec < smca_mce_descs[bank_type].num_descs && if (xec < smca_mce_descs[bank_type].num_descs &&
(type->xec_bitmap & BIT_ULL(xec))) { (hwid->xec_bitmap & BIT_ULL(xec))) {
pr_emerg(HW_ERR "%s Error: ", ip_name); pr_emerg(HW_ERR "%s Error: ", ip_name);
pr_cont("%s.\n", smca_mce_descs[bank_type].descs[xec]); pr_cont("%s.\n", smca_mce_descs[bank_type].descs[xec]);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册