UefiCpuPkg/MtrrLib: Add PCD PcdCpuNumberOfReservedVariableMtrrs
Current MtrrLib reserves 2 variable MTRRs for some legacy OS boot (CSM boots) may require some MTRRs to be reserved for OS use. But UEFI OS boot will not use MTRRs. Per Scott's suggestion in link: http://article.gmane.org/gmane.comp.bios.edk2.devel/4099 Add one PCD PcdCpuNumberOfReservedVariableMtrrs to specify the number of variable MTRRs reserved for OS use. Setting its default value to 2 is for back-compatibility. Cc: Scott Duplichan <scott@notabs.org> Cc: Feng Tian <feng.tian@intel.com> Cc: Michael Kinney <michael.d.kinney@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan <jeff.fan@intel.com> Suggested-by: Scott Duplichan <scott@notabs.org> Reviewed-by: Feng Tian <feng.tian@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19151 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -140,13 +140,15 @@ GetFirmwareVariableMtrrCount (
|
||||
)
|
||||
{
|
||||
UINT32 VariableMtrrCount;
|
||||
UINT32 ReservedMtrrNumber;
|
||||
|
||||
VariableMtrrCount = GetVariableMtrrCount ();
|
||||
if (VariableMtrrCount < RESERVED_FIRMWARE_VARIABLE_MTRR_NUMBER) {
|
||||
ReservedMtrrNumber = PcdGet32 (PcdCpuNumberOfReservedVariableMtrrs);
|
||||
if (VariableMtrrCount < ReservedMtrrNumber) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return VariableMtrrCount - RESERVED_FIRMWARE_VARIABLE_MTRR_NUMBER;
|
||||
return VariableMtrrCount - ReservedMtrrNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user