]> xenbits.xensource.com Git - people/aperard/ovmf.git/commitdiff
UefiPayloadPkg: Handle simple reserved ranges from DT
authorDhaval <dhaval@rivosinc.com>
Tue, 13 Aug 2024 14:44:40 +0000 (20:14 +0530)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Sat, 14 Sep 2024 03:38:47 +0000 (03:38 +0000)
DT has a way to provide reserved images in a simpler tabular
manner. UPL should be able to support that.

Signed-off-by: Dhaval Sharma <dhaval@rivosinc.com>
UefiPayloadPkg/Library/FdtParserLib/FdtParserLib.c

index 93387e0ad543c13a7da38ca10d9766ba79b36b48..09b7372b9ab47213516dcbe43d1e8bd96bd5a9d2 100644 (file)
@@ -816,6 +816,9 @@ ParseDtb (
   UINT8                 NodeType;\r
   EFI_BOOT_MODE         BootMode;\r
   CHAR8                 *GmaStr;\r
+  INTN                  NumRsv;\r
+  EFI_PHYSICAL_ADDRESS  Addr;\r
+  UINT64                Size;\r
   UINT16                SegmentNumber;\r
   UINT64                CurrentPciBaseAddress;\r
   UINT64                NextPciBaseAddress;\r
@@ -886,6 +889,16 @@ ParseDtb (
     }\r
   }\r
 \r
+  NumRsv = FdtNumRsv (Fdt);\r
+  /* Look for an existing entry and add it to the efi mem map. */\r
+  for (index = 0; index < NumRsv; index++) {\r
+    if (FdtGetMemRsv (Fdt, index, &Addr, &Size) != 0) {\r
+      continue;\r
+    }\r
+\r
+    BuildMemoryAllocationHob (Addr, Size, EfiReservedMemoryType);\r
+  }\r
+\r
   index = RootBridgeCount - 1;\r
   Depth = 0;\r
   for (Node = FdtNextNode (Fdt, 0, &Depth); Node >= 0; Node = FdtNextNode (Fdt, Node, &Depth)) {\r