summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/PlatformPei
diff options
context:
space:
mode:
authorLaszlo Ersek <lersek@redhat.com>2020-05-08 14:16:50 +0200
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2020-05-18 15:48:48 +0000
commit8db87f98357b40798a9446d96d9b9109c9cbb47e (patch)
tree0fcf0c0a038001f2431e6b13e24bbf30042e7e03 /OvmfPkg/PlatformPei
parent356b96b3a2dc4b5aa05a680a7c6a2f094266fdd3 (diff)
downloadedk2-8db87f98357b40798a9446d96d9b9109c9cbb47e.tar.gz
edk2-8db87f98357b40798a9446d96d9b9109c9cbb47e.tar.bz2
edk2-8db87f98357b40798a9446d96d9b9109c9cbb47e.zip
OvmfPkg/PlatformPei: extract memory type info defaults to PCDs
Some OvmfPkg modules already depend on "EmbeddedPkg.dec"; thus, replace the open-coded memory type info defaults in the source code with the EmbeddedPkg PCDs that stand for the same purpose. Consequently, platform builders can override these values with the "--pcd" option of "build", without source code updates. While at it, sort the memory type names alphabetically. Cc: Ard Biesheuvel <ard.biesheuvel@arm.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Philippe Mathieu-Daudé <philmd@redhat.com> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2706 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20200508121651.16045-4-lersek@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Diffstat (limited to 'OvmfPkg/PlatformPei')
-rw-r--r--OvmfPkg/PlatformPei/MemTypeInfo.c21
-rw-r--r--OvmfPkg/PlatformPei/PlatformPei.inf6
2 files changed, 15 insertions, 12 deletions
diff --git a/OvmfPkg/PlatformPei/MemTypeInfo.c b/OvmfPkg/PlatformPei/MemTypeInfo.c
index d287fb9d7d..f3ce2b6865 100644
--- a/OvmfPkg/PlatformPei/MemTypeInfo.c
+++ b/OvmfPkg/PlatformPei/MemTypeInfo.c
@@ -17,19 +17,16 @@
#include "Platform.h"
-//
-// The NumberOfPages values below are ad-hoc. They are updated sporadically at
-// best (please refer to git-blame for past updates). The values capture a set
-// of BIN hints that made sense at a particular time, for some (now likely
-// unknown) workloads / boot paths.
-//
+#define MEMORY_TYPE_INFO_DEFAULT(Type) \
+ { Type, FixedPcdGet32 (PcdMemoryType ## Type) }
+
STATIC EFI_MEMORY_TYPE_INFORMATION mMemoryTypeInformation[] = {
- { EfiACPIMemoryNVS, 0x004 },
- { EfiACPIReclaimMemory, 0x008 },
- { EfiReservedMemoryType, 0x004 },
- { EfiRuntimeServicesData, 0x024 },
- { EfiRuntimeServicesCode, 0x030 },
- { EfiMaxMemoryType, 0x000 }
+ MEMORY_TYPE_INFO_DEFAULT (EfiACPIMemoryNVS),
+ MEMORY_TYPE_INFO_DEFAULT (EfiACPIReclaimMemory),
+ MEMORY_TYPE_INFO_DEFAULT (EfiReservedMemoryType),
+ MEMORY_TYPE_INFO_DEFAULT (EfiRuntimeServicesCode),
+ MEMORY_TYPE_INFO_DEFAULT (EfiRuntimeServicesData),
+ { EfiMaxMemoryType, 0 }
};
STATIC
diff --git a/OvmfPkg/PlatformPei/PlatformPei.inf b/OvmfPkg/PlatformPei/PlatformPei.inf
index e72ef7963d..ff397b3ee9 100644
--- a/OvmfPkg/PlatformPei/PlatformPei.inf
+++ b/OvmfPkg/PlatformPei/PlatformPei.inf
@@ -37,6 +37,7 @@
Xen.h
[Packages]
+ EmbeddedPkg/EmbeddedPkg.dec
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
SecurityPkg/SecurityPkg.dec
@@ -105,6 +106,11 @@
[FixedPcd]
gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress
+ gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS
+ gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory
+ gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType
+ gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode
+ gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData
[FeaturePcd]
gUefiOvmfPkgTokenSpaceGuid.PcdCsmEnable