]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoPeiLibConstructor.c
ArmVirtPkg/QemuVirtMemInfoLib: use HOB not PCD to record the memory size
[mirror_edk2.git] / ArmVirtPkg / Library / QemuVirtMemInfoLib / QemuVirtMemInfoPeiLibConstructor.c
index 33d3597d57ab35c941609b502e574805243ea7bd..c47ab8296622a28a5f73e04aa2242dfeae2896a1 100644 (file)
@@ -6,9 +6,10 @@
 \r
 **/\r
 \r
-#include <Base.h>\r
+#include <Uefi.h>\r
+#include <Pi/PiMultiPhase.h>\r
 #include <Library/DebugLib.h>\r
-#include <Library/PcdLib.h>\r
+#include <Library/HobLib.h>\r
 #include <libfdt.h>\r
 \r
 RETURN_STATUS\r
@@ -17,14 +18,14 @@ QemuVirtMemInfoPeiLibConstructor (
   VOID\r
   )\r
 {\r
-  VOID           *DeviceTreeBase;\r
-  INT32          Node, Prev;\r
-  UINT64         NewBase, CurBase;\r
-  UINT64         NewSize, CurSize;\r
-  CONST CHAR8    *Type;\r
-  INT32          Len;\r
-  CONST UINT64   *RegProp;\r
-  RETURN_STATUS  PcdStatus;\r
+  VOID          *DeviceTreeBase;\r
+  INT32         Node, Prev;\r
+  UINT64        NewBase, CurBase;\r
+  UINT64        NewSize, CurSize;\r
+  CONST CHAR8   *Type;\r
+  INT32         Len;\r
+  CONST UINT64  *RegProp;\r
+  VOID          *Hob;\r
 \r
   NewBase = 0;\r
   NewSize = 0;\r
@@ -86,8 +87,13 @@ QemuVirtMemInfoPeiLibConstructor (
   // Make sure the start of DRAM matches our expectation\r
   //\r
   ASSERT (FixedPcdGet64 (PcdSystemMemoryBase) == NewBase);\r
-  PcdStatus = PcdSet64S (PcdSystemMemorySize, NewSize);\r
-  ASSERT_RETURN_ERROR (PcdStatus);\r
+\r
+  Hob = BuildGuidDataHob (\r
+          &gArmVirtSystemMemorySizeGuid,\r
+          &NewSize,\r
+          sizeof NewSize\r
+          );\r
+  ASSERT (Hob != NULL);\r
 \r
   //\r
   // We need to make sure that the machine we are running on has at least\r