audk/UefiCpuPkg/Library
Ruiyu Ni 13a47cf925 UefiCpuPkg/MtrrLib: Fix a bug that may wrongly set memory <1MB to UC
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1481

Today's MtrrLib contains a bug, for example:
 when the original cache setting is WB for [0xF_0000, 0xF_8000) and,
 a new request to set [0xF_0000, 0xF_4000) to WP,
 the cache setting for [0xF_4000, 0xF_8000) is reset to UC.

The reason is when MtrrLibSetBelow1MBMemoryAttribute() is called the
WorkingFixedSettings doesn't contain the actual MSR value stored in
hardware, but when writing the fixed MTRRs, the code logic assumes
WorkingFixedSettings contains the actual MSR value.

The new fix is to change MtrrLibSetBelow1MBMemoryAttribute() to
calculate the correct ClearMasks[] and OrMasks[], and use them
directly when writing the fixed MTRRs.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>
2019-02-19 17:14:34 +08:00
..
BaseUefiCpuLib
BaseXApicLib
BaseXApicX2ApicLib
CpuCommonFeaturesLib UefiCpuPkg/CommonFeature: Always set FEATURE_CONTROL.Lock 2018-11-14 11:02:48 +08:00
CpuExceptionHandlerLib UefiCpuPkg/CpuExceptionHandlerLib: Fix spelling issue 2018-12-21 09:51:18 +08:00
MpInitLib UefiCpuPkg/MpInitLib: Rollback old change 2a5997f8. 2018-11-05 10:39:13 +08:00
MtrrLib UefiCpuPkg/MtrrLib: Fix a bug that may wrongly set memory <1MB to UC 2019-02-19 17:14:34 +08:00
PlatformSecLibNull
RegisterCpuFeaturesLib UefiCpuPkg/RegisterCpuFeaturesLib: Replace AcquireSpinLock. 2019-01-15 13:27:37 +08:00
SecPeiDxeTimerLibUefiCpu
SmmCpuFeaturesLib UefiCpuPkg: Merge StuffRsb.inc files into one in UefiCpuPkg/Include 2019-01-02 09:45:29 +08:00
SmmCpuPlatformHookLibNull