mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
x86/mce/AMD: Carve out SMCA get_block_address() code
Carve out the SMCA code in get_block_address() into a separate helper function. No functional change. Signed-off-by: Yazen Ghannam <[email protected]> [ Save an indentation level. ] Signed-off-by: Borislav Petkov <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Tony Luck <[email protected]> Cc: linux-edac <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
This commit is contained in:
parent
27bd595027
commit
8a331f4a08
1 changed files with 31 additions and 26 deletions
|
|
@ -431,6 +431,35 @@ static void deferred_error_interrupt_enable(struct cpuinfo_x86 *c)
|
|||
wrmsr(MSR_CU_DEF_ERR, low, high);
|
||||
}
|
||||
|
||||
static u32 smca_get_block_address(unsigned int cpu, unsigned int bank,
|
||||
unsigned int block)
|
||||
{
|
||||
u32 low, high;
|
||||
u32 addr = 0;
|
||||
|
||||
if (smca_get_bank_type(bank) == SMCA_RESERVED)
|
||||
return addr;
|
||||
|
||||
if (!block)
|
||||
return MSR_AMD64_SMCA_MCx_MISC(bank);
|
||||
|
||||
/*
|
||||
* For SMCA enabled processors, BLKPTR field of the first MISC register
|
||||
* (MCx_MISC0) indicates presence of additional MISC regs set (MISC1-4).
|
||||
*/
|
||||
if (rdmsr_safe_on_cpu(cpu, MSR_AMD64_SMCA_MCx_CONFIG(bank), &low, &high))
|
||||
return addr;
|
||||
|
||||
if (!(low & MCI_CONFIG_MCAX))
|
||||
return addr;
|
||||
|
||||
if (!rdmsr_safe_on_cpu(cpu, MSR_AMD64_SMCA_MCx_MISC(bank), &low, &high) &&
|
||||
(low & MASK_BLKPTR_LO))
|
||||
return MSR_AMD64_SMCA_MCx_MISCy(bank, block - 1);
|
||||
|
||||
return addr;
|
||||
}
|
||||
|
||||
static u32 get_block_address(unsigned int cpu, u32 current_addr, u32 low, u32 high,
|
||||
unsigned int bank, unsigned int block)
|
||||
{
|
||||
|
|
@ -451,32 +480,8 @@ static u32 get_block_address(unsigned int cpu, u32 current_addr, u32 low, u32 hi
|
|||
}
|
||||
}
|
||||
|
||||
if (mce_flags.smca) {
|
||||
if (smca_get_bank_type(bank) == SMCA_RESERVED)
|
||||
return addr;
|
||||
|
||||
if (!block) {
|
||||
addr = MSR_AMD64_SMCA_MCx_MISC(bank);
|
||||
} else {
|
||||
/*
|
||||
* For SMCA enabled processors, BLKPTR field of the
|
||||
* first MISC register (MCx_MISC0) indicates presence of
|
||||
* additional MISC register set (MISC1-4).
|
||||
*/
|
||||
u32 low, high;
|
||||
|
||||
if (rdmsr_safe_on_cpu(cpu, MSR_AMD64_SMCA_MCx_CONFIG(bank), &low, &high))
|
||||
return addr;
|
||||
|
||||
if (!(low & MCI_CONFIG_MCAX))
|
||||
return addr;
|
||||
|
||||
if (!rdmsr_safe_on_cpu(cpu, MSR_AMD64_SMCA_MCx_MISC(bank), &low, &high) &&
|
||||
(low & MASK_BLKPTR_LO))
|
||||
addr = MSR_AMD64_SMCA_MCx_MISCy(bank, block - 1);
|
||||
}
|
||||
return addr;
|
||||
}
|
||||
if (mce_flags.smca)
|
||||
return smca_get_block_address(cpu, bank, block);
|
||||
|
||||
/* Fall back to method we used for older processors: */
|
||||
switch (block) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue