]> git.proxmox.com Git - mirror_edk2.git/commitdiff
IntelFrameworkPkg PeiHobLibFramework: Implement BuildFv3Hob
authorStar Zeng <star.zeng@intel.com>
Tue, 3 Oct 2017 13:41:27 +0000 (21:41 +0800)
committerStar Zeng <star.zeng@intel.com>
Tue, 10 Oct 2017 12:54:37 +0000 (20:54 +0800)
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
IntelFrameworkPkg/Library/PeiHobLibFramework/HobLib.c

index 223e56a9db120ca6890a0e7c8aa653bf33b04183..eb89b4a535524050910e2ae1a5b748cacc7baf70 100644 (file)
@@ -5,7 +5,7 @@
  This library instance uses EFI_HOB_TYPE_CV defined in Intel framework HOB specification v0.9\r
  to implement HobLib BuildCvHob() API. \r
 \r
-Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -611,6 +611,60 @@ BuildFv2Hob (
   CopyGuid (&Hob->FileName, FileName);\r
 }\r
 \r
+/**\r
+  Builds a EFI_HOB_TYPE_FV3 HOB.\r
+\r
+  This function builds a EFI_HOB_TYPE_FV3 HOB.\r
+  It can only be invoked during PEI phase;\r
+  for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
+\r
+  If there is no additional space for HOB creation, then ASSERT().\r
+  If the FvImage buffer is not at its required alignment, then ASSERT().\r
+\r
+  @param BaseAddress            The base address of the Firmware Volume.\r
+  @param Length                 The size of the Firmware Volume in bytes.\r
+  @param AuthenticationStatus   The authentication status.\r
+  @param ExtractedFv            TRUE if the FV was extracted as a file within\r
+                                another firmware volume. FALSE otherwise.\r
+  @param FvName                 The name of the Firmware Volume.\r
+                                Valid only if IsExtractedFv is TRUE.\r
+  @param FileName               The name of the file.\r
+                                Valid only if IsExtractedFv is TRUE.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+BuildFv3Hob (\r
+  IN          EFI_PHYSICAL_ADDRESS        BaseAddress,\r
+  IN          UINT64                      Length,\r
+  IN          UINT32                      AuthenticationStatus,\r
+  IN          BOOLEAN                     ExtractedFv,\r
+  IN CONST    EFI_GUID                    *FvName, OPTIONAL\r
+  IN CONST    EFI_GUID                    *FileName OPTIONAL\r
+  )\r
+{\r
+  EFI_HOB_FIRMWARE_VOLUME3  *Hob;\r
+\r
+  if (!InternalCheckFvAlignment (BaseAddress, Length)) {\r
+    ASSERT (FALSE);\r
+    return;\r
+  }\r
+\r
+  Hob = InternalPeiCreateHob (EFI_HOB_TYPE_FV3, (UINT16) sizeof (EFI_HOB_FIRMWARE_VOLUME3));\r
+  if (Hob == NULL) {\r
+    return;\r
+  }\r
+\r
+  Hob->BaseAddress          = BaseAddress;\r
+  Hob->Length               = Length;\r
+  Hob->AuthenticationStatus = AuthenticationStatus;\r
+  Hob->ExtractedFv          = ExtractedFv;\r
+  if (ExtractedFv) {\r
+    CopyGuid (&Hob->FvName, FvName);\r
+    CopyGuid (&Hob->FileName, FileName);\r
+  }\r
+}\r
+\r
 /**\r
   Builds a Capsule Volume HOB.\r
 \r