From nobody Thu Dec 26 02:06:31 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 1507126902159495.21644148513883; Wed, 4 Oct 2017 07:21:42 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 73DBB21CF58CF; Wed, 4 Oct 2017 07:18:14 -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 59A0F21CF58BA for ; Wed, 4 Oct 2017 07:18:11 -0700 (PDT) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP; 04 Oct 2017 07:21:32 -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:31 -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="1202141509" From: Star Zeng To: edk2-devel@lists.01.org Date: Wed, 4 Oct 2017 22:21:21 +0800 Message-Id: <20171004142121.7404-6-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 5/5] IntelFrameworkModulePkg FwVolDxe: Get FV auth status propagated from PEI 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 FwVolDxe to get the authentication status propagated from PEI-phase to DXE by FV3 HOB when producing FV protocol. Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng --- .../Universal/FirmwareVolume/FwVolDxe/FwVol.c | 73 ++++++++++++++++--= ---- .../FirmwareVolume/FwVolDxe/FwVolDriver.h | 3 +- .../Universal/FirmwareVolume/FwVolDxe/FwVolDxe.inf | 4 +- 3 files changed, 57 insertions(+), 23 deletions(-) diff --git a/IntelFrameworkModulePkg/Universal/FirmwareVolume/FwVolDxe/FwVo= l.c b/IntelFrameworkModulePkg/Universal/FirmwareVolume/FwVolDxe/FwVol.c index 65a292db6b91..91fcd4721244 100644 --- a/IntelFrameworkModulePkg/Universal/FirmwareVolume/FwVolDxe/FwVol.c +++ b/IntelFrameworkModulePkg/Universal/FirmwareVolume/FwVolDxe/FwVol.c @@ -4,7 +4,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.
=20 This program and the accompanying materials are licensed and made available under the terms and conditions @@ -195,7 +195,7 @@ FreeFvDeviceResource ( /** =20 Firmware volume inherits authentication status from the FV image file an= d section(in another firmware volume) - where it came from. + where it came from or propagated from PEI-phase. =20 @param FvDevice A pointer to the FvDevice. =20 @@ -205,26 +205,30 @@ FwVolInheritAuthenticationStatus ( IN FV_DEVICE *FvDevice ) { - EFI_STATUS Status; - EFI_FIRMWARE_VOLUME_HEADER *CachedFvHeader; - EFI_FIRMWARE_VOLUME_EXT_HEADER *CachedFvExtHeader; - EFI_FIRMWARE_VOLUME2_PROTOCOL *ParentFvProtocol; - UINTN Key; - EFI_GUID FileNameGuid; - EFI_FV_FILETYPE FileType; - EFI_FV_FILE_ATTRIBUTES FileAttributes; - UINTN FileSize; - EFI_SECTION_TYPE SectionType; - UINT32 AuthenticationStatus; - EFI_FIRMWARE_VOLUME_HEADER *FvHeader; - EFI_FIRMWARE_VOLUME_EXT_HEADER *FvExtHeader; - UINTN BufferSize; - - CachedFvHeader =3D (EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) FvDevice->Cach= edFv; + EFI_STATUS Status; + EFI_FIRMWARE_VOLUME_HEADER *CachedFvHeader; + EFI_FIRMWARE_VOLUME_EXT_HEADER *CachedFvExtHeader; + EFI_FIRMWARE_VOLUME2_PROTOCOL *ParentFvProtocol; + UINTN Key; + EFI_GUID FileNameGuid; + EFI_FV_FILETYPE FileType; + EFI_FV_FILE_ATTRIBUTES FileAttributes; + UINTN FileSize; + EFI_SECTION_TYPE SectionType; + UINT32 AuthenticationStatus; + EFI_FIRMWARE_VOLUME_HEADER *FvHeader; + EFI_FIRMWARE_VOLUME_EXT_HEADER *FvExtHeader; + UINTN BufferSize; + EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb; + EFI_FVB_ATTRIBUTES_2 FvbAttributes; + EFI_PHYSICAL_ADDRESS BaseAddress; + EFI_PEI_HOB_POINTERS Fv3Hob; =20 if (FvDevice->Fv.ParentHandle !=3D NULL) { + CachedFvHeader =3D (EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) FvDevice->Ca= chedFv; + // - // By Parent Handle, find out the FV image file and section(in another= firmware volume) where the firmware volume came from=20 + // By Parent Handle, find out the FV image file and section(in another= firmware volume) where the firmware volume came from // Status =3D gBS->HandleProtocol (FvDevice->Fv.ParentHandle, &gEfiFirmwa= reVolume2ProtocolGuid, (VOID **) &ParentFvProtocol); if (!EFI_ERROR (Status) && (ParentFvProtocol !=3D NULL)) { @@ -258,7 +262,7 @@ FwVolInheritAuthenticationStatus ( if (!EFI_ERROR (Status)) { if ((FvHeader->FvLength =3D=3D CachedFvHeader->FvLength) && (FvHeader->ExtHeaderOffset =3D=3D CachedFvHeader->ExtHeaderO= ffset)) { - if (FvHeader->ExtHeaderOffset !=3D0) { + if (FvHeader->ExtHeaderOffset !=3D 0) { // // Both FVs contain extension header, then compare their FV = Name GUID // @@ -292,6 +296,35 @@ FwVolInheritAuthenticationStatus ( } } while (TRUE); } + } else { + Fvb =3D FvDevice->Fvb; + + Status =3D Fvb->GetAttributes (Fvb, &FvbAttributes); + if (EFI_ERROR (Status)) { + return; + } + + if ((FvbAttributes & EFI_FVB2_MEMORY_MAPPED) !=3D 0) { + // + // Get volume base address + // + Status =3D Fvb->GetPhysicalAddress (Fvb, &BaseAddress); + if (EFI_ERROR (Status)) { + return; + } + + // + // 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 BaseAddress) { + FvDevice->AuthenticationStatus =3D Fv3Hob.FirmwareVolume3->Authe= nticationStatus; + return; + } + Fv3Hob.Raw =3D GET_NEXT_HOB (Fv3Hob); + } + } } } =20 diff --git a/IntelFrameworkModulePkg/Universal/FirmwareVolume/FwVolDxe/FwVo= lDriver.h b/IntelFrameworkModulePkg/Universal/FirmwareVolume/FwVolDxe/FwVol= Driver.h index b1646dd39edf..b14a488ead88 100644 --- a/IntelFrameworkModulePkg/Universal/FirmwareVolume/FwVolDxe/FwVolDriver= .h +++ b/IntelFrameworkModulePkg/Universal/FirmwareVolume/FwVolDxe/FwVolDriver= .h @@ -1,7 +1,7 @@ /** @file Common defines and definitions for a FwVolDxe driver. =20 - Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
+ Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
=20 This program and the accompanying materials are licensed and made available under the terms and conditions @@ -33,6 +33,7 @@ #include #include #include +#include =20 #define FV_DEVICE_SIGNATURE SIGNATURE_32 ('_', 'F', 'V', '_') =20 diff --git a/IntelFrameworkModulePkg/Universal/FirmwareVolume/FwVolDxe/FwVo= lDxe.inf b/IntelFrameworkModulePkg/Universal/FirmwareVolume/FwVolDxe/FwVolD= xe.inf index 057266bb2b68..6844afb063e7 100644 --- a/IntelFrameworkModulePkg/Universal/FirmwareVolume/FwVolDxe/FwVolDxe.inf +++ b/IntelFrameworkModulePkg/Universal/FirmwareVolume/FwVolDxe/FwVolDxe.inf @@ -4,7 +4,7 @@ # This driver produces Firmware Volume2 protocol with full services # (read/write, get/set) based on Firmware Volume Block protocol. # -# 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 Li= cense @@ -55,7 +55,7 @@ [LibraryClasses] UefiLib UefiDriverEntryPoint DebugLib - + HobLib =20 [Guids] gEfiFirmwareVolumeTopFileGuid ## CONSUMES ## File # VTF f= ile --=20 2.13.3.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel