diff options
author | Jeff Fan <jeff.fan@intel.com> | 2015-12-10 07:21:55 +0000 |
---|---|---|
committer | vanjeff <vanjeff@Edk2> | 2015-12-10 07:21:55 +0000 |
commit | 53c6f25007d394164df6669506e643ed73c08577 (patch) | |
tree | 93bbd81bba3eee4811f723c5e59c3c50c1142d56 /UefiCpuPkg/Library/MtrrLib | |
parent | b0fdb34d967435c34f28a3da3b09398ff600f145 (diff) | |
download | edk2-53c6f25007d394164df6669506e643ed73c08577.tar.gz edk2-53c6f25007d394164df6669506e643ed73c08577.tar.bz2 edk2-53c6f25007d394164df6669506e643ed73c08577.zip |
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.
(Sync patch r19151 from main trunk.)
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/branches/UDK2015@19195 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'UefiCpuPkg/Library/MtrrLib')
-rw-r--r-- | UefiCpuPkg/Library/MtrrLib/MtrrLib.c | 6 | ||||
-rw-r--r-- | UefiCpuPkg/Library/MtrrLib/MtrrLib.inf | 5 |
2 files changed, 8 insertions, 3 deletions
diff --git a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c index a65560542c..82223379e7 100644 --- a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c +++ b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c @@ -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;
}
/**
diff --git a/UefiCpuPkg/Library/MtrrLib/MtrrLib.inf b/UefiCpuPkg/Library/MtrrLib/MtrrLib.inf index 64ec9bd0b0..01a4d84da0 100644 --- a/UefiCpuPkg/Library/MtrrLib/MtrrLib.inf +++ b/UefiCpuPkg/Library/MtrrLib/MtrrLib.inf @@ -1,7 +1,7 @@ ## @file
# MTRR library provides APIs for MTRR operation.
#
-# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
# 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
@@ -41,3 +41,6 @@ CpuLib
DebugLib
+[Pcd]
+ gUefiCpuPkgTokenSpaceGuid.PcdCpuNumberOfReservedVariableMtrrs ## SOMETIMES_CONSUMES
+
|