From nobody Sat Nov 2 00:22:27 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1507126892793904.8134464957282; Wed, 4 Oct 2017 07:21:32 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id AF8BD21CF58C8; Wed, 4 Oct 2017 07:18:07 -0700 (PDT) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id D670C21CF58C1 for ; Wed, 4 Oct 2017 07:18:06 -0700 (PDT) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP; 04 Oct 2017 07:21:28 -0700 Received: from lzeng14-mobl2.ccr.corp.intel.com ([10.255.31.253]) by fmsmga001.fm.intel.com with ESMTP; 04 Oct 2017 07:21:26 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.43; helo=mga05.intel.com; envelope-from=star.zeng@intel.com; receiver=edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,477,1500966000"; d="scan'208";a="1202141488" From: Star Zeng To: edk2-devel@lists.01.org Date: Wed, 4 Oct 2017 22:21:18 +0800 Message-Id: <20171004142121.7404-3-star.zeng@intel.com> X-Mailer: git-send-email 2.13.3.windows.1 In-Reply-To: <20171004142121.7404-1-star.zeng@intel.com> References: <20171004142121.7404-1-star.zeng@intel.com> Subject: [edk2] [PATCH 2/5] MdePkg HobLib: Add BuildFv3Hob API X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao , Star Zeng MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add BuildFv3Hob API in HobLib.h and implement the API in HobLib instances PeiHobLib, DxeHobLib and DxeCoreHobLib. Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng --- MdePkg/Include/Library/HobLib.h | 34 ++++++++++++++++++++-- MdePkg/Library/DxeCoreHobLib/HobLib.c | 35 ++++++++++++++++++++++- MdePkg/Library/DxeHobLib/HobLib.c | 32 +++++++++++++++++++++ MdePkg/Library/PeiHobLib/HobLib.c | 54 +++++++++++++++++++++++++++++++= +++- 4 files changed, 151 insertions(+), 4 deletions(-) diff --git a/MdePkg/Include/Library/HobLib.h b/MdePkg/Include/Library/HobLi= b.h index fc48703826c5..6f1f7b3f5f20 100644 --- a/MdePkg/Include/Library/HobLib.h +++ b/MdePkg/Include/Library/HobLib.h @@ -6,9 +6,9 @@ defined in the PI Specification. A HOB is a Hand-Off Block, defined in the Framework architecture, that allows the PEI phase to pass information to the DXE phase. HOBs are posi= tion - independent and can be relocated easily to different memory memory locat= ions. + independent and can be relocated easily to different memory locations. =20 -Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD = License which accompanies this distribution. The full text of the license may be = found at @@ -343,6 +343,36 @@ BuildFv2Hob ( ); =20 /** + Builds a EFI_HOB_TYPE_FV3 HOB. + + This function builds a EFI_HOB_TYPE_FV3 HOB. + It can only be invoked during PEI phase; + for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. + + If there is no additional space for HOB creation, then ASSERT(). + If the FvImage buffer is not at its required alignment, then ASSERT(). + + @param BaseAddress The base address of the Firmware Volume. + @param Length The size of the Firmware Volume in bytes. + @param AuthenticationStatus The authentication status. + @param ExtractedFv TRUE if the FV was extracted as a file wit= hin another firmware volume. + FALSE otherwise. + @param FvName The name of the Firmware Volume. Valid onl= y if IsExtractedFv is TRUE + @param FileName The name of the file. Valid only if IsExtr= actedFv is TRUE + +**/ +VOID +EFIAPI +BuildFv3Hob ( + IN EFI_PHYSICAL_ADDRESS BaseAddress, + IN UINT64 Length, + IN UINT32 AuthenticationStatus, + IN BOOLEAN ExtractedFv, + IN CONST EFI_GUID *FvName, OPTIONAL + IN CONST EFI_GUID *FileName OPTIONAL + ); + +/** Builds a Capsule Volume HOB. =20 This function builds a Capsule Volume HOB. diff --git a/MdePkg/Library/DxeCoreHobLib/HobLib.c b/MdePkg/Library/DxeCore= HobLib/HobLib.c index 2e5fb1c6ee55..2f4f4b473386 100644 --- a/MdePkg/Library/DxeCoreHobLib/HobLib.c +++ b/MdePkg/Library/DxeCoreHobLib/HobLib.c @@ -1,7 +1,7 @@ /** @file HOB Library implementation for DxeCore driver. =20 -Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD = License which accompanies this distribution. The full text of the license may be = found at @@ -433,6 +433,39 @@ BuildFv2Hob ( } =20 /** + Builds a EFI_HOB_TYPE_FV3 HOB. + + This function builds a EFI_HOB_TYPE_FV3 HOB. + It can only be invoked during PEI phase; + for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. + + If there is no additional space for HOB creation, then ASSERT(). + If the FvImage buffer is not at its required alignment, then ASSERT(). + + @param BaseAddress The base address of the Firmware Volume. + @param Length The size of the Firmware Volume in bytes. + @param AuthenticationStatus The authentication status. + @param ExtractedFv TRUE if the FV was extracted as a file wit= hin another firmware volume. + FALSE otherwise. + @param FvName The name of the Firmware Volume. Valid onl= y if IsExtractedFv is TRUE + @param FileName The name of the file. Valid only if IsExtr= actedFv is TRUE + +**/ +VOID +EFIAPI +BuildFv3Hob ( + IN EFI_PHYSICAL_ADDRESS BaseAddress, + IN UINT64 Length, + IN UINT32 AuthenticationStatus, + IN BOOLEAN ExtractedFv, + IN CONST EFI_GUID *FvName, OPTIONAL + IN CONST EFI_GUID *FileName OPTIONAL + ) +{ + ASSERT (FALSE); +} + +/** Builds a Capsule Volume HOB. =20 This function builds a Capsule Volume HOB. diff --git a/MdePkg/Library/DxeHobLib/HobLib.c b/MdePkg/Library/DxeHobLib/H= obLib.c index bb65206b044a..dac593d5da9d 100644 --- a/MdePkg/Library/DxeHobLib/HobLib.c +++ b/MdePkg/Library/DxeHobLib/HobLib.c @@ -466,6 +466,38 @@ BuildFv2Hob ( ASSERT (FALSE); } =20 +/** + Builds a EFI_HOB_TYPE_FV3 HOB. + + This function builds a EFI_HOB_TYPE_FV3 HOB. + It can only be invoked during PEI phase; + for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. + + If there is no additional space for HOB creation, then ASSERT(). + If the FvImage buffer is not at its required alignment, then ASSERT(). + + @param BaseAddress The base address of the Firmware Volume. + @param Length The size of the Firmware Volume in bytes. + @param AuthenticationStatus The authentication status. + @param ExtractedFv TRUE if the FV was extracted as a file wit= hin another firmware volume. + FALSE otherwise. + @param FvName The name of the Firmware Volume. Valid onl= y if IsExtractedFv is TRUE + @param FileName The name of the file. Valid only if IsExtr= actedFv is TRUE + +**/ +VOID +EFIAPI +BuildFv3Hob ( + IN EFI_PHYSICAL_ADDRESS BaseAddress, + IN UINT64 Length, + IN UINT32 AuthenticationStatus, + IN BOOLEAN ExtractedFv, + IN CONST EFI_GUID *FvName, OPTIONAL + IN CONST EFI_GUID *FileName OPTIONAL + ) +{ + ASSERT (FALSE); +} =20 /** Builds a Capsule Volume HOB. diff --git a/MdePkg/Library/PeiHobLib/HobLib.c b/MdePkg/Library/PeiHobLib/H= obLib.c index a1522dd9f5ff..68df7292a7ec 100644 --- a/MdePkg/Library/PeiHobLib/HobLib.c +++ b/MdePkg/Library/PeiHobLib/HobLib.c @@ -1,7 +1,7 @@ /** @file Provide Hob Library functions for Pei phase. =20 -Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD = License which accompanies this distribution. The full text of the license may be = found at @@ -610,6 +610,58 @@ BuildFv2Hob ( } =20 /** + Builds a EFI_HOB_TYPE_FV3 HOB. + + This function builds a EFI_HOB_TYPE_FV3 HOB. + It can only be invoked during PEI phase; + for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase. + + If there is no additional space for HOB creation, then ASSERT(). + If the FvImage buffer is not at its required alignment, then ASSERT(). + + @param BaseAddress The base address of the Firmware Volume. + @param Length The size of the Firmware Volume in bytes. + @param AuthenticationStatus The authentication status. + @param ExtractedFv TRUE if the FV was extracted as a file wit= hin another firmware volume. + FALSE otherwise. + @param FvName The name of the Firmware Volume. Valid onl= y if IsExtractedFv is TRUE + @param FileName The name of the file. Valid only if IsExtr= actedFv is TRUE + +**/ +VOID +EFIAPI +BuildFv3Hob ( + IN EFI_PHYSICAL_ADDRESS BaseAddress, + IN UINT64 Length, + IN UINT32 AuthenticationStatus, + IN BOOLEAN ExtractedFv, + IN CONST EFI_GUID *FvName, OPTIONAL + IN CONST EFI_GUID *FileName OPTIONAL + ) +{ + EFI_HOB_FIRMWARE_VOLUME3 *Hob; + + if (!InternalCheckFvAlignment (BaseAddress, Length)) { + ASSERT (FALSE); + return; + } + + Hob =3D InternalPeiCreateHob (EFI_HOB_TYPE_FV3, (UINT16) sizeof (EFI_HOB= _FIRMWARE_VOLUME3)); + if (Hob =3D=3D NULL) { + return; + } + + Hob->BaseAddress =3D BaseAddress; + Hob->Length =3D Length; + Hob->AuthenticationStatus =3D AuthenticationStatus; + Hob->ExtractedFv =3D ExtractedFv; + if (ExtractedFv) { + CopyGuid (&Hob->FvName, FvName); + CopyGuid (&Hob->FileName, FileName); + } +} + +/** Builds a Capsule Volume HOB. =20 This function builds a Capsule Volume HOB. --=20 2.13.3.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel