X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=UefiCpuPkg%2FLibrary%2FCpuCommonFeaturesLib%2FMachineCheck.c;h=c4eca062fdcdecda72235e9035ff4805c6161c2e;hp=b012c6926e602126e7ea6953a715fe7cbd7b8ad8;hb=7367cc6c24d01b400d2370ffd58ae02854a56b32;hpb=306a5bcc6b0170d28b0db10bd359817bb4b1db9f diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/MachineCheck.c b/UefiCpuPkg/Library/CpuCommonFeaturesLib/MachineCheck.c index b012c6926e..c4eca062fd 100644 --- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/MachineCheck.c +++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/MachineCheck.c @@ -1,7 +1,7 @@ /** @file Machine Check features. - Copyright (c) 2017, Intel Corporation. All rights reserved.
+ Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -105,6 +105,9 @@ McaSupport ( IN VOID *ConfigData OPTIONAL ) { + if (!MceSupport (ProcessorNumber, CpuInfo, ConfigData)) { + return FALSE; + } return (CpuInfo->CpuIdVersionInfoEdx.Bits.MCA == 1); } @@ -137,25 +140,27 @@ McaInitialize ( MSR_IA32_MCG_CAP_REGISTER McgCap; UINT32 BankIndex; - McgCap.Uint64 = AsmReadMsr64 (MSR_IA32_MCG_CAP); - for (BankIndex = 0; BankIndex < (UINT32) McgCap.Bits.Count; BankIndex++) { - CPU_REGISTER_TABLE_WRITE64 ( - ProcessorNumber, - Msr, - MSR_IA32_MC0_CTL + BankIndex * 4, - MAX_UINT64 - ); - } - - if (PcdGetBool (PcdIsPowerOnReset)) { - for (BankIndex = 0; BankIndex < (UINTN) McgCap.Bits.Count; BankIndex++) { + if (State) { + McgCap.Uint64 = AsmReadMsr64 (MSR_IA32_MCG_CAP); + for (BankIndex = 0; BankIndex < (UINT32) McgCap.Bits.Count; BankIndex++) { CPU_REGISTER_TABLE_WRITE64 ( ProcessorNumber, Msr, - MSR_IA32_MC0_STATUS + BankIndex * 4, - 0 + MSR_IA32_MC0_CTL + BankIndex * 4, + MAX_UINT64 ); } + + if (PcdGetBool (PcdIsPowerOnReset)) { + for (BankIndex = 0; BankIndex < (UINTN) McgCap.Bits.Count; BankIndex++) { + CPU_REGISTER_TABLE_WRITE64 ( + ProcessorNumber, + Msr, + MSR_IA32_MC0_STATUS + BankIndex * 4, + 0 + ); + } + } } return RETURN_SUCCESS; @@ -230,7 +235,7 @@ McgCtlInitialize ( } /** - Detects if Local machine check exception feature supported on current + Detects if Local machine check exception feature supported on current processor. @param[in] ProcessorNumber The index of the CPU executing this function.