]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg/PlatformPei: extract memory type info defaults to PCDs
authorLaszlo Ersek <lersek@redhat.com>
Fri, 8 May 2020 12:16:50 +0000 (14:16 +0200)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Mon, 18 May 2020 15:48:48 +0000 (15:48 +0000)
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>
OvmfPkg/OvmfPkgIa32.dsc
OvmfPkg/OvmfPkgIa32X64.dsc
OvmfPkg/OvmfPkgX64.dsc
OvmfPkg/PlatformPei/MemTypeInfo.c
OvmfPkg/PlatformPei/PlatformPei.inf

index e54aecdf277660cc378eac2d198636e0cea818db..c3081e3299766e219c680f25ed083441ca178721 100644 (file)
   gEfiSourceLevelDebugPkgTokenSpaceGuid.PcdDebugLoadImageMethod|0x2\r
 !endif\r
 \r
+  #\r
+  # The NumberOfPages values below are ad-hoc. They are updated sporadically at\r
+  # best (please refer to git-blame for past updates). The values capture a set\r
+  # of BIN hints that made sense at a particular time, for some (now likely\r
+  # unknown) workloads / boot paths.\r
+  #\r
+  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS|0x4\r
+  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory|0x8\r
+  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType|0x4\r
+  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode|0x30\r
+  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData|0x24\r
+\r
   #\r
   # Network Pcds\r
   #\r
index c0c8397cb7284e981156e4dcbef7bc5624c4ee95..cb0c10e6f4ca1aeb7ff501128b340b161663ec64 100644 (file)
   gEfiSourceLevelDebugPkgTokenSpaceGuid.PcdDebugLoadImageMethod|0x2\r
 !endif\r
 \r
+[PcdsFixedAtBuild.IA32]\r
+  #\r
+  # The NumberOfPages values below are ad-hoc. They are updated sporadically at\r
+  # best (please refer to git-blame for past updates). The values capture a set\r
+  # of BIN hints that made sense at a particular time, for some (now likely\r
+  # unknown) workloads / boot paths.\r
+  #\r
+  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS|0x4\r
+  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory|0x8\r
+  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType|0x4\r
+  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode|0x30\r
+  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData|0x24\r
+\r
 [PcdsFixedAtBuild.X64]\r
   #\r
   # Network Pcds\r
index 22112bcb047b61f6d364b837055df61ea096ae8b..c1eaf6cdb26118c163fab403c21ebab4b3ce2244 100644 (file)
   gEfiSourceLevelDebugPkgTokenSpaceGuid.PcdDebugLoadImageMethod|0x2\r
 !endif\r
 \r
+  #\r
+  # The NumberOfPages values below are ad-hoc. They are updated sporadically at\r
+  # best (please refer to git-blame for past updates). The values capture a set\r
+  # of BIN hints that made sense at a particular time, for some (now likely\r
+  # unknown) workloads / boot paths.\r
+  #\r
+  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS|0x4\r
+  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory|0x8\r
+  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType|0x4\r
+  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode|0x30\r
+  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData|0x24\r
+\r
   #\r
   # Network Pcds\r
   #\r
index d287fb9d7df015e87b9cb37712261b0cb373311b..f3ce2b6865e1c3ebf075aac66b807e55c07d2308 100644 (file)
 \r
 #include "Platform.h"\r
 \r
-//\r
-// The NumberOfPages values below are ad-hoc. They are updated sporadically at\r
-// best (please refer to git-blame for past updates). The values capture a set\r
-// of BIN hints that made sense at a particular time, for some (now likely\r
-// unknown) workloads / boot paths.\r
-//\r
+#define MEMORY_TYPE_INFO_DEFAULT(Type) \\r
+  { Type, FixedPcdGet32 (PcdMemoryType ## Type) }\r
+\r
 STATIC EFI_MEMORY_TYPE_INFORMATION mMemoryTypeInformation[] = {\r
-  { EfiACPIMemoryNVS,       0x004 },\r
-  { EfiACPIReclaimMemory,   0x008 },\r
-  { EfiReservedMemoryType,  0x004 },\r
-  { EfiRuntimeServicesData, 0x024 },\r
-  { EfiRuntimeServicesCode, 0x030 },\r
-  { EfiMaxMemoryType,       0x000 }\r
+  MEMORY_TYPE_INFO_DEFAULT (EfiACPIMemoryNVS),\r
+  MEMORY_TYPE_INFO_DEFAULT (EfiACPIReclaimMemory),\r
+  MEMORY_TYPE_INFO_DEFAULT (EfiReservedMemoryType),\r
+  MEMORY_TYPE_INFO_DEFAULT (EfiRuntimeServicesCode),\r
+  MEMORY_TYPE_INFO_DEFAULT (EfiRuntimeServicesData),\r
+  { EfiMaxMemoryType, 0 }\r
 };\r
 \r
 STATIC\r
index e72ef7963d97247aa165381ca461c47c75aa05f0..ff397b3ee9d75fd0676f708ce50184bd6d97b2d5 100644 (file)
@@ -37,6 +37,7 @@
   Xen.h\r
 \r
 [Packages]\r
+  EmbeddedPkg/EmbeddedPkg.dec\r
   MdePkg/MdePkg.dec\r
   MdeModulePkg/MdeModulePkg.dec\r
   SecurityPkg/SecurityPkg.dec\r
 \r
 [FixedPcd]\r
   gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress\r
+  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS\r
+  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory\r
+  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType\r
+  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode\r
+  gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData\r
 \r
 [FeaturePcd]\r
   gUefiOvmfPkgTokenSpaceGuid.PcdCsmEnable\r