From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 29E7C1A1E3A for ; Mon, 24 Oct 2016 02:21:13 -0700 (PDT) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga101.jf.intel.com with ESMTP; 24 Oct 2016 02:21:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,541,1473145200"; d="scan'208";a="183087797" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga004.fm.intel.com with ESMTP; 24 Oct 2016 02:21:14 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 24 Oct 2016 02:21:12 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.206]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.96]) with mapi id 14.03.0248.002; Mon, 24 Oct 2016 17:21:08 +0800 From: "Zeng, Star" To: "Gao, Liming" , "edk2-devel@lists.01.org" , Sean Brogan CC: "Zeng, Star" Thread-Topic: [edk2] [PATCH] MdePkg PeiServicesLib: Make sure FvInfo has FFS2 format if FvFormat == NULL Thread-Index: AQHSLbL4lGFNAC4ZEEuRwA2kn5ekfaC2zOmAgACGW/A= Date: Mon, 24 Oct 2016 09:21:07 +0000 Message-ID: <0C09AFA07DD0434D9E2A0C6AEB04831039590C2C@shsmsx102.ccr.corp.intel.com> References: <1477284969-38320-1-git-send-email-star.zeng@intel.com> <4A89E2EF3DFEDB4C8BFDE51014F606A14B49879B@shsmsx102.ccr.corp.intel.com> In-Reply-To: <4A89E2EF3DFEDB4C8BFDE51014F606A14B49879B@shsmsx102.ccr.corp.intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] MdePkg PeiServicesLib: Make sure FvInfo has FFS2 format if FvFormat == NULL X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Oct 2016 09:21:13 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable You are right, platform may install the FvInfo(2) ppi directly without call= ing PeiServicesInstallFvInfo(2)Ppi, for example, edk2\Vlv2TbltDevicePkg\FvI= nfoPei\FvInfoPei.c. Just sent out another patch to cover it, please help review that. Thanks, Star -----Original Message----- From: Gao, Liming=20 Sent: Monday, October 24, 2016 5:16 PM To: Zeng, Star ; edk2-devel@lists.01.org Cc: Zeng, Star Subject: RE: [edk2] [PATCH] MdePkg PeiServicesLib: Make sure FvInfo has FFS= 2 format if FvFormat =3D=3D NULL Star: Besides this patch, I think PeiCore also requires to add this check to ma= ke sure FvInfo and FvImage match each other, because PPI may directly be in= stalled from PEI module, not from this library API.=20 Thanks Liming > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of=20 > Star Zeng > Sent: Monday, October 24, 2016 12:56 PM > To: edk2-devel@lists.01.org > Cc: Gao, Liming ; Zeng, Star=20 > > Subject: [edk2] [PATCH] MdePkg PeiServicesLib: Make sure FvInfo has=20 > FFS2 format if FvFormat =3D=3D NULL >=20 > Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D160 >=20 > Cc: Liming Gao > Cc: Sean Brogan > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Star Zeng > --- > MdePkg/Library/PeiServicesLib/PeiServicesLib.c | 15 ++++++++++++++- > 1 file changed, 14 insertions(+), 1 deletion(-) >=20 > diff --git a/MdePkg/Library/PeiServicesLib/PeiServicesLib.c > b/MdePkg/Library/PeiServicesLib/PeiServicesLib.c > index 3428addcc63b..2373251bc3e5 100644 > --- a/MdePkg/Library/PeiServicesLib/PeiServicesLib.c > +++ b/MdePkg/Library/PeiServicesLib/PeiServicesLib.c > @@ -1,7 +1,7 @@ > /** @file > Implementation for PEI Services Library. >=20 > - Copyright (c) 2006 - 2013, Intel Corporation. All rights=20 > reserved.
> + Copyright (c) 2006 - 2016, Intel Corporation. All rights=20 > + reserved.
> This program and the accompanying materials > are licensed and made available under the terms and conditions of=20 > the BSD License > which accompanies this distribution. The full text of the license=20 > may be found at @@ -574,6 +574,7 @@ PeiServicesFfsGetVolumeInfo ( > the parameters passed in to initialize the fields of the=20 > EFI_PEI_FIRMWARE_VOLUME_INFO(2)_PPI instance. > If the resources can not be allocated for=20 > EFI_PEI_FIRMWARE_VOLUME_INFO(2)_PPI, then ASSERT(). > If the EFI_PEI_FIRMWARE_VOLUME_INFO(2)_PPI can not be installed,=20 > then ASSERT(). > + If NULL is specified for FvFormat, but FvInfo does not have the=20 > + firmware > file system 2 format, then ASSERT. >=20 > @param InstallFvInfoPpi Install FvInfo Ppi if it is TRUE. Otherwi= se, install > FvInfo2 Ppi. > @param FvFormat Unique identifier of the format of the me= mory- > mapped > @@ -640,6 +641,16 @@ InternalPeiServicesInstallFvInfoPpi ( > CopyGuid (&FvInfoPpi->FvFormat, FvFormat); > } else { > CopyGuid (&FvInfoPpi->FvFormat, &gEfiFirmwareFileSystem2Guid); > + // > + // Since the EFI_FIRMWARE_FILE_SYSTEM2_GUID format is assumed if > NULL is specified for FvFormat, > + // check the FileSystemGuid pointed by FvInfo against > EFI_FIRMWARE_FILE_SYSTEM2_GUID to make sure > + // FvInfo has the firmware file system 2 format. > + // If the ASSERT really appears, FvFormat needs to be specified=20 > + correctly, > for example, > + // EFI_FIRMWARE_FILE_SYSTEM3_GUID can be used for firmware file > system 3 format, or > + // &(((EFI_FIRMWARE_VOLUME_HEADER *) FvInfo)->FileSystemGuid can > be just used for both > + // firmware file system 2 and 3 format. > + // > + ASSERT (CompareGuid (&(((EFI_FIRMWARE_VOLUME_HEADER *) > FvInfo)->FileSystemGuid), &gEfiFirmwareFileSystem2Guid)); > } > FvInfoPpi->FvInfo =3D (VOID *) FvInfo; > FvInfoPpi->FvInfoSize =3D FvInfoSize; @@ -672,6 +683,7 @@=20 > InternalPeiServicesInstallFvInfoPpi ( > the parameters passed in to initialize the fields of the=20 > EFI_PEI_FIRMWARE_VOLUME_INFO_PPI instance. > If the resources can not be allocated for=20 > EFI_PEI_FIRMWARE_VOLUME_INFO_PPI, then ASSERT(). > If the EFI_PEI_FIRMWARE_VOLUME_INFO_PPI can not be installed, then=20 > ASSERT(). > + If NULL is specified for FvFormat, but FvInfo does not have the=20 > + firmware > file system 2 format, then ASSERT. >=20 > @param FvFormat Unique identifier of the format of the me= mory- > mapped > firmware volume. This parameter is=20 > optional and @@ -714,6 +726,7 @@ PeiServicesInstallFvInfoPpi ( > the parameters passed in to initialize the fields of the=20 > EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI instance. > If the resources can not be allocated for=20 > EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI, then ASSERT(). > If the EFI_PEI_FIRMWARE_VOLUME_INFO2_PPI can not be installed, then=20 > ASSERT(). > + If NULL is specified for FvFormat, but FvInfo does not have the=20 > + firmware > file system 2 format, then ASSERT. >=20 > @param FvFormat Unique identifier of the format of the me= mory- > mapped > firmware volume. This parameter is=20 > optional and > -- > 2.7.0.windows.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel