audk/UefiCpuPkg
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
..
Application/Cpuid UefiCpuPkg/Cpuid: Add code to support new definition. 2018-12-10 15:33:50 +08:00
CpuDxe
CpuFeatures
CpuIo2Dxe
CpuIo2Smm
CpuIoPei
CpuMpPei
CpuS3DataDxe
Include UefiCpuPkg: Merge StuffRsb.inc files into one in UefiCpuPkg/Include 2019-01-02 09:45:29 +08:00
Library UefiCpuPkg/MtrrLib: Fix a bug that may wrongly set memory <1MB to UC 2019-02-19 17:14:34 +08:00
PiSmmCommunication
PiSmmCpuDxeSmm UefiCpuPkg: Merge StuffRsb.inc files into one in UefiCpuPkg/Include 2019-01-02 09:45:29 +08:00
ResetVector
SecCore UefiCpuPkg/SecCore: Support EFI_PEI_CORE_FV_LOCATION_PPI 2019-02-15 17:54:22 +08:00
Universal/Acpi/S3Resume2Pei UefiCpuPkg/S3Resume2Pei: check 64BIT_WAKE_F in FACS.OSPMFlags. 2019-01-15 13:17:26 +08:00
UefiCpuPkg.dec
UefiCpuPkg.dsc
UefiCpuPkg.uni
UefiCpuPkgExtra.uni