From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=eric.dong@intel.com; receiver=edk2-devel@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (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 8BDE82194D387 for ; Thu, 13 Sep 2018 17:19:49 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Sep 2018 17:19:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,371,1531810800"; d="scan'208";a="232743700" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga004.jf.intel.com with ESMTP; 13 Sep 2018 17:19:42 -0700 Received: from fmsmsx156.amr.corp.intel.com (10.18.116.74) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 13 Sep 2018 17:19:42 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx156.amr.corp.intel.com (10.18.116.74) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 13 Sep 2018 17:19:41 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.226]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.150]) with mapi id 14.03.0319.002; Fri, 14 Sep 2018 08:19:40 +0800 From: "Dong, Eric" To: "Zeng, Star" , "edk2-devel@lists.01.org" CC: Younas khan , "Kinney, Michael D" , "Gao, Liming" , "Yao, Jiewen" , "Ni, Ruiyu" , "Laszlo Ersek" Thread-Topic: [PATCH V2 6/6] UefiCpuPkg PiSmmCpuDxeSmm: Use new EfiLocateFirstAcpiTable() Thread-Index: AQHUS0xh8DfUfyC6rEKQd3uE6aElraTu6kHw Date: Fri, 14 Sep 2018 00:19:39 +0000 Message-ID: References: <1536834420-16620-1-git-send-email-star.zeng@intel.com> <1536834420-16620-7-git-send-email-star.zeng@intel.com> In-Reply-To: <1536834420-16620-7-git-send-email-star.zeng@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH V2 6/6] UefiCpuPkg PiSmmCpuDxeSmm: Use new EfiLocateFirstAcpiTable() X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Sep 2018 00:19:49 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Eric Dong > -----Original Message----- > From: Zeng, Star > Sent: Thursday, September 13, 2018 6:27 PM > To: edk2-devel@lists.01.org > Cc: Zeng, Star ; Younas khan > ; Kinney, Michael D > ; Gao, Liming ; Yao, > Jiewen ; Ni, Ruiyu ; Dong, Eric > ; Laszlo Ersek > Subject: [PATCH V2 6/6] UefiCpuPkg PiSmmCpuDxeSmm: Use new > EfiLocateFirstAcpiTable() >=20 > https://bugzilla.tianocore.org/show_bug.cgi?id=3D967 > Request to add a library function for GetAcpiTable() in order to get ACPI= table > using signature as input. >=20 > After evaluation, we found there are many duplicated code to find ACPI > table by signature in different modules. >=20 > This patch updates PiSmmCpuDxeSmm to use new > EfiLocateFirstAcpiTable() and remove the duplicated code. >=20 > Cc: Younas khan > Cc: Michael D Kinney > Cc: Liming Gao > Cc: Jiewen Yao > Cc: Ruiyu Ni > Cc: Eric Dong > Cc: Laszlo Ersek > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Star Zeng > --- > UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf | 4 +- > UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c | 84 ++------------------= ---- > -- > UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h | 3 +- > 3 files changed, 6 insertions(+), 85 deletions(-) >=20 > diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf > b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf > index a7fb7b0b1482..0fdc1b134ea3 100644 > --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf > +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf > @@ -4,7 +4,7 @@ > # This SMM driver performs SMM initialization, deploy SMM Entry Vector, = # > provides CPU specific services in SMM. > # > -# Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
> +# Copyright (c) 2009 - 2018, Intel Corporation. All rights > +reserved.
> # Copyright (c) 2017, AMD Incorporated. All rights reserved.
# # T= his > program and the accompanying materials @@ -114,8 +114,6 @@ [Protocols] > [Guids] > gEfiAcpiVariableGuid ## SOMETIMES_CONSUMES ## HOB = # it is > used for S3 boot. > gEfiGlobalVariableGuid ## SOMETIMES_PRODUCES ## > Variable:L"SmmProfileData" > - gEfiAcpi20TableGuid ## SOMETIMES_CONSUMES ## > SystemTable > - gEfiAcpi10TableGuid ## SOMETIMES_CONSUMES ## > SystemTable > gEdkiiPiSmmMemoryAttributesTableGuid ## CONSUMES ## SystemTable > gEfiMemoryAttributesTableGuid ## CONSUMES ## SystemTable >=20 > diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c > b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c > index a743cf64f907..91b8e7ddb991 100644 > --- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c > +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c > @@ -1,7 +1,7 @@ > /** @file > Enable SMM profile. >=20 > -Copyright (c) 2012 - 2017, Intel Corporation. All rights reserved.
> +Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.
> Copyright (c) 2017, AMD Incorporated. All rights reserved.
>=20 > This program and the accompanying materials @@ -726,84 +726,6 @@ > InitPaging ( } >=20 > /** > - To find FADT in ACPI tables. > - > - @param AcpiTableGuid The GUID used to find ACPI table in UEFI > ConfigurationTable. > - > - @return FADT table pointer. > -**/ > -EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE * - > FindAcpiFadtTableByAcpiGuid ( > - IN EFI_GUID *AcpiTableGuid > - ) > -{ > - EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER *Rsdp; > - EFI_ACPI_DESCRIPTION_HEADER *Rsdt; > - EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt; > - UINTN Index; > - UINT32 Data32; > - Rsdp =3D NULL; > - Rsdt =3D NULL; > - Fadt =3D NULL; > - // > - // found ACPI table RSD_PTR from system table > - // > - for (Index =3D 0; Index < gST->NumberOfTableEntries; Index++) { > - if (CompareGuid (&(gST->ConfigurationTable[Index].VendorGuid), > AcpiTableGuid)) { > - // > - // A match was found. > - // > - Rsdp =3D gST->ConfigurationTable[Index].VendorTable; > - break; > - } > - } > - > - if (Rsdp =3D=3D NULL) { > - return NULL; > - } > - > - Rsdt =3D (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN) Rsdp->RsdtAddress; > - if (Rsdt =3D=3D NULL || Rsdt->Signature !=3D > EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_TABLE_SIGNATURE) { > - return NULL; > - } > - > - for (Index =3D sizeof (EFI_ACPI_DESCRIPTION_HEADER); Index < Rsdt- > >Length; Index =3D Index + sizeof (UINT32)) { > - > - Data32 =3D *(UINT32 *) ((UINT8 *) Rsdt + Index); > - Fadt =3D (EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *) (UINT32 *) > (UINTN) Data32; > - if (Fadt->Header.Signature =3D=3D > EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE) { > - break; > - } > - } > - > - if (Fadt =3D=3D NULL || Fadt->Header.Signature !=3D > EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE) { > - return NULL; > - } > - > - return Fadt; > -} > - > -/** > - To find FADT in ACPI tables. > - > - @return FADT table pointer. > -**/ > -EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE * -FindAcpiFadtTable ( > - VOID > - ) > -{ > - EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt; > - > - Fadt =3D FindAcpiFadtTableByAcpiGuid (&gEfiAcpi20TableGuid); > - if (Fadt !=3D NULL) { > - return Fadt; > - } > - > - return FindAcpiFadtTableByAcpiGuid (&gEfiAcpi10TableGuid); -} > - > -/** > To get system port address of the SMI Command Port in FADT table. >=20 > **/ > @@ -814,7 +736,9 @@ GetSmiCommandPort ( > { > EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt; >=20 > - Fadt =3D FindAcpiFadtTable (); > + Fadt =3D (EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *) > EfiLocateFirstAcpiTable ( > + > EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE > + ); > ASSERT (Fadt !=3D NULL); >=20 > mSmiCommandPort =3D Fadt->SmiCmd; > diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h > b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h > index bacb2f8ad32c..f93e90c143d2 100644 > --- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h > +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h > @@ -1,7 +1,7 @@ > /** @file > SMM profile internal header file. >=20 > -Copyright (c) 2012 - 2017, Intel Corporation. All rights reserved.
> +Copyright (c) 2012 - 2018, 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 > @@ -16,7 +16,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY > KIND, EITHER EXPRESS OR IMPLIED. > #define _SMM_PROFILE_INTERNAL_H_ >=20 > #include > -#include > #include > #include > #include > -- > 2.7.0.windows.1