]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg: Search EFI_RESOURCE_MEMORY_UNACCEPTED for Fw hoblist
authorMin Xu <min.m.xu@intel.com>
Tue, 31 May 2022 14:31:17 +0000 (22:31 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Thu, 2 Jun 2022 09:10:00 +0000 (09:10 +0000)
In current TDVF implementation all unaccepted memory passed in Hoblist
are tagged as EFI_RESOURCE_MEMORY_UNACCEPTED. They're all accepted before
they can be accessed. After accepting memory region, the Hob ResourceType
is unchanged (still be EFI_RESOURCE_MEMORY_UNACCEPTED).

TDVF Config-B skip PEI phase and it tries to find a memory region which
is the largest one below 4GB. Then this memory region will be used as the
firmware hoblist.

So we should walk thru the input hoblist and search for the memory region
with the type of EFI_RESOURCE_MEMORY_UNACCEPTED.

Because EFI_RESOURCE_MEMORY_UNACCEPTED has not been officially in PI spec.
So it cannot be defined in MdePkg/Include/Pi/PiHob.h. As a temporary
solution it is defined in Hob.c.

There is a patch-set for lazy-accept very soon. In that patch-set
EFI_RESOURCE_MEMORY_UNACCEPTED will be defined in MdeModulePkg.

Config-B: https://edk2.groups.io/g/devel/message/76367

Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
OvmfPkg/Library/PeilessStartupLib/Hob.c

index 3c544ca1f67d5440e607fa794f48b9b12a8b66c8..5fc84a80902584f7798a05cb6b330dc9ad24066d 100644 (file)
@@ -22,6 +22,8 @@
 #include <OvmfPlatforms.h>\r
 #include "PeilessStartupInternal.h"\r
 \r
+#define EFI_RESOURCE_MEMORY_UNACCEPTED  7\r
+\r
 /**\r
  * Construct the HobList in SEC phase.\r
  *\r
@@ -90,7 +92,7 @@ ConstructFwHobList (
   //\r
   while (!END_OF_HOB_LIST (Hob)) {\r
     if (Hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) {\r
-      if (Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) {\r
+      if (Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_MEMORY_UNACCEPTED) {\r
         PhysicalEnd    = Hob.ResourceDescriptor->PhysicalStart + Hob.ResourceDescriptor->ResourceLength;\r
         ResourceLength = Hob.ResourceDescriptor->ResourceLength;\r
 \r