From nobody Thu Dec 26 01:45:35 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 1507126898782484.0092600162866; Wed, 4 Oct 2017 07:21:38 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 3638421CF58C1; Wed, 4 Oct 2017 07:18:12 -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 E00A121CF58BD for ; Wed, 4 Oct 2017 07:18:09 -0700 (PDT) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP; 04 Oct 2017 07:21:31 -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:29 -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="1202141500" From: Star Zeng To: edk2-devel@lists.01.org Date: Wed, 4 Oct 2017 22:21:20 +0800 Message-Id: <20171004142121.7404-5-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 4/5] MdeModulePkg Core: Propagate PEI-phase FV authentication status to DXE 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" FV3 HOB was introduced by new (>=3D 1.5) PI spec, it is intended to be used to propagate PEI-phase FV authentication status to DXE. This patch is to update PeiCore to build FV3 HOB with the authentication status and DxeCore to get the authentication status from FV3 HOB when producing FVB Protocol. Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng --- MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c | 41 +++++++++++++++++++++++= +--- MdeModulePkg/Core/Dxe/FwVol/FwVol.c | 13 ++++----- MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c | 23 +++++++++++---- MdeModulePkg/Core/Pei/FwVol/FwVol.c | 9 ++++++ 4 files changed, 69 insertions(+), 17 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c b/MdeModulePkg/Core/Dx= e/DxeMain/DxeMain.c index 91e94a78d205..433cca3a800c 100644 --- a/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c +++ b/MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c @@ -380,10 +380,43 @@ DxeMain ( } } for (Hob.Raw =3D HobStart; !END_OF_HOB_LIST(Hob); Hob.Raw =3D GET_NEXT= _HOB(Hob)) { - if (GET_HOB_TYPE (Hob) =3D=3D EFI_HOB_TYPE_FV2) { - DEBUG ((DEBUG_INFO | DEBUG_LOAD, "FV2 Hob 0x%0lx - 0x%0l= x\n", Hob.FirmwareVolume2->BaseAddress, Hob.FirmwareVolume2->BaseAddress + = Hob.FirmwareVolume2->Length - 1)); - } else if (GET_HOB_TYPE (Hob) =3D=3D EFI_HOB_TYPE_FV) { - DEBUG ((DEBUG_INFO | DEBUG_LOAD, "FV Hob 0x%0lx - 0x%0l= x\n", Hob.FirmwareVolume->BaseAddress, Hob.FirmwareVolume->BaseAddress + Ho= b.FirmwareVolume->Length - 1)); + if (GET_HOB_TYPE (Hob) =3D=3D EFI_HOB_TYPE_FV) { + DEBUG (( + DEBUG_INFO | DEBUG_LOAD, + "FV Hob 0x%0lx - 0x%0lx\n", + Hob.FirmwareVolume->BaseAddress, + Hob.FirmwareVolume->BaseAddress + Hob.FirmwareVolume->Length - 1 + )); + } else if (GET_HOB_TYPE (Hob) =3D=3D EFI_HOB_TYPE_FV2) { + DEBUG (( + DEBUG_INFO | DEBUG_LOAD, + "FV2 Hob 0x%0lx - 0x%0lx\n", + Hob.FirmwareVolume2->BaseAddress, + Hob.FirmwareVolume2->BaseAddress + Hob.FirmwareVolume2->Length -= 1 + )); + DEBUG (( + DEBUG_INFO | DEBUG_LOAD, + " %g - %g\n", + &Hob.FirmwareVolume2->FvName, + &Hob.FirmwareVolume2->FileName + )); + } else if (GET_HOB_TYPE (Hob) =3D=3D EFI_HOB_TYPE_FV3) { + DEBUG (( + DEBUG_INFO | DEBUG_LOAD, + "FV3 Hob 0x%0lx - 0x%0lx - 0x%x - 0x%x\n", + Hob.FirmwareVolume3->BaseAddress, + Hob.FirmwareVolume3->BaseAddress + Hob.FirmwareVolume3->Length -= 1, + Hob.FirmwareVolume3->AuthenticationStatus, + Hob.FirmwareVolume3->ExtractedFv + )); + if (Hob.FirmwareVolume3->ExtractedFv) { + DEBUG (( + DEBUG_INFO | DEBUG_LOAD, + " %g - %g\n", + &Hob.FirmwareVolume3->FvName, + &Hob.FirmwareVolume3->FileName + )); + } } } DEBUG_CODE_END (); diff --git a/MdeModulePkg/Core/Dxe/FwVol/FwVol.c b/MdeModulePkg/Core/Dxe/Fw= Vol/FwVol.c index fe12d6e0ac30..2f5867b59d90 100644 --- a/MdeModulePkg/Core/Dxe/FwVol/FwVol.c +++ b/MdeModulePkg/Core/Dxe/FwVol/FwVol.c @@ -3,7 +3,7 @@ Layers on top of Firmware Block protocol to produce a file abstraction of FV based files. =20 -Copyright (c) 2006 - 2014, 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 @@ -711,13 +711,10 @@ NotifyFwVolBlock ( FvDevice->FwVolHeader =3D FwVolHeader; FvDevice->IsFfs3Fv =3D CompareGuid (&FwVolHeader->FileSystemG= uid, &gEfiFirmwareFileSystem3Guid); FvDevice->Fv.ParentHandle =3D Fvb->ParentHandle; - - if (Fvb->ParentHandle !=3D NULL) { - // - // Inherit the authentication status from FVB. - // - FvDevice->AuthenticationStatus =3D GetFvbAuthenticationStatus (Fvb= ); - } + // + // Inherit the authentication status from FVB. + // + FvDevice->AuthenticationStatus =3D GetFvbAuthenticationStatus (Fvb); =20 if (!EFI_ERROR (FvCheck (FvDevice))) { // diff --git a/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c b/MdeModulePkg/C= ore/Dxe/FwVolBlock/FwVolBlock.c index bc7b34140f84..f7fb18ae15df 100644 --- a/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c +++ b/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c @@ -4,7 +4,7 @@ It consumes FV HOBs and creates read-only Firmare Volume Block protocol instances for each of them. =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 @@ -517,9 +517,7 @@ ProduceFVBProtocolOnBuffer ( FvbDev->BaseAddress =3D BaseAddress; FvbDev->FvbAttributes =3D FwVolHeader->Attributes; FvbDev->FwVolBlockInstance.ParentHandle =3D ParentHandle; - if (ParentHandle !=3D NULL) { - FvbDev->AuthenticationStatus =3D AuthenticationStatus; - } + FvbDev->AuthenticationStatus =3D AuthenticationStatus; =20 // // Init the block caching fields of the device @@ -630,16 +628,31 @@ FwVolBlockDriverInit ( ) { EFI_PEI_HOB_POINTERS FvHob; + EFI_PEI_HOB_POINTERS Fv3Hob; + UINT32 AuthenticationStatus; =20 // // Core Needs Firmware Volumes to function // FvHob.Raw =3D GetHobList (); while ((FvHob.Raw =3D GetNextHob (EFI_HOB_TYPE_FV, FvHob.Raw)) !=3D NULL= ) { + AuthenticationStatus =3D 0; + // + // Get the authentication status propagated from PEI-phase to DXE. + // + Fv3Hob.Raw =3D GetHobList (); + while ((Fv3Hob.Raw =3D GetNextHob (EFI_HOB_TYPE_FV3, Fv3Hob.Raw)) !=3D= NULL) { + if ((Fv3Hob.FirmwareVolume3->BaseAddress =3D=3D FvHob.FirmwareVolume= ->BaseAddress) && + (Fv3Hob.FirmwareVolume3->Length =3D=3D FvHob.FirmwareVolume->Len= gth)) { + AuthenticationStatus =3D Fv3Hob.FirmwareVolume3->AuthenticationSta= tus; + break; + } + Fv3Hob.Raw =3D GET_NEXT_HOB (Fv3Hob); + } // // Produce an FVB protocol for it // - ProduceFVBProtocolOnBuffer (FvHob.FirmwareVolume->BaseAddress, FvHob.F= irmwareVolume->Length, NULL, 0, NULL); + ProduceFVBProtocolOnBuffer (FvHob.FirmwareVolume->BaseAddress, FvHob.F= irmwareVolume->Length, NULL, AuthenticationStatus, NULL); FvHob.Raw =3D GET_NEXT_HOB (FvHob); } =20 diff --git a/MdeModulePkg/Core/Pei/FwVol/FwVol.c b/MdeModulePkg/Core/Pei/Fw= Vol/FwVol.c index c90a70b5f799..f3f93ac1a3af 100644 --- a/MdeModulePkg/Core/Pei/FwVol/FwVol.c +++ b/MdeModulePkg/Core/Pei/FwVol/FwVol.c @@ -1452,6 +1452,15 @@ ProcessFvFile ( &FileInfo.FileName ); =20 + BuildFv3Hob ( + (EFI_PHYSICAL_ADDRESS) (UINTN) FvHeader, + FvHeader->FvLength, + AuthenticationStatus, + TRUE, + &ParentFvImageInfo.FvName, + &FileInfo.FileName + ); + return EFI_SUCCESS; } =20 --=20 2.13.3.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel