From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=66.187.233.73; helo=mx1.redhat.com; envelope-from=lersek@redhat.com; receiver=edk2-devel@lists.01.org Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) (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 86EB42110785F for ; Fri, 31 Aug 2018 13:33:49 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 78896DFE5; Fri, 31 Aug 2018 20:33:48 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-122-213.rdu2.redhat.com [10.10.122.213]) by smtp.corp.redhat.com (Postfix) with ESMTP id 713997D4D3; Fri, 31 Aug 2018 20:33:46 +0000 (UTC) To: Star Zeng , edk2-devel@lists.01.org Cc: Ruiyu Ni , Eric Dong , Younas khan , Liming Gao , Jiewen Yao , Michael D Kinney References: <1535714959-73472-1-git-send-email-star.zeng@intel.com> <1535714959-73472-7-git-send-email-star.zeng@intel.com> From: Laszlo Ersek Message-ID: <02b40ee9-78ab-4694-dfae-416268529de2@redhat.com> Date: Fri, 31 Aug 2018 22:33:45 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <1535714959-73472-7-git-send-email-star.zeng@intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 31 Aug 2018 20:33:48 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 31 Aug 2018 20:33:48 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'lersek@redhat.com' RCPT:'' Subject: Re: [PATCH 6/6] UefiCpuPkg PiSmmCpuDxeSmm: Use new EfiFindAcpiTableBySignature() 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, 31 Aug 2018 20:33:50 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 08/31/18 13:29, Star Zeng wrote: > https://bugzilla.tianocore.org/show_bug.cgi?id=967 > Request to add a library function for GetAcpiTable() in order > to get ACPI table using signature as input. > > After evaluation, we found there are many duplicated code to > find ACPI table by signature in different modules. > > This patch updates PiSmmCpuDxeSmm to use new > EfiFindAcpiTableBySignature() and remove the duplicated code. > > 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(-) > > 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.
> # > # This 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 > > diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c > index a743cf64f907..df643b72c517 100644 > --- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c > +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c > @@ -1,7 +1,7 @@ > /** @file > Enable SMM profile. > > -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.
> > This program and the accompanying materials > @@ -726,84 +726,6 @@ InitPaging ( > } > > /** > - 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 = NULL; > - Rsdt = NULL; > - Fadt = NULL; > - // > - // found ACPI table RSD_PTR from system table > - // > - for (Index = 0; Index < gST->NumberOfTableEntries; Index++) { > - if (CompareGuid (&(gST->ConfigurationTable[Index].VendorGuid), AcpiTableGuid)) { > - // > - // A match was found. > - // > - Rsdp = gST->ConfigurationTable[Index].VendorTable; > - break; > - } > - } > - > - if (Rsdp == NULL) { > - return NULL; > - } > - > - Rsdt = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN) Rsdp->RsdtAddress; > - if (Rsdt == NULL || Rsdt->Signature != EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_TABLE_SIGNATURE) { > - return NULL; > - } > - > - for (Index = sizeof (EFI_ACPI_DESCRIPTION_HEADER); Index < Rsdt->Length; Index = Index + sizeof (UINT32)) { > - > - Data32 = *(UINT32 *) ((UINT8 *) Rsdt + Index); > - Fadt = (EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *) (UINT32 *) (UINTN) Data32; > - if (Fadt->Header.Signature == EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE) { > - break; > - } > - } > - > - if (Fadt == NULL || Fadt->Header.Signature != 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 = FindAcpiFadtTableByAcpiGuid (&gEfiAcpi20TableGuid); > - if (Fadt != NULL) { > - return Fadt; > - } > - > - return FindAcpiFadtTableByAcpiGuid (&gEfiAcpi10TableGuid); > -} > - > -/** > To get system port address of the SMI Command Port in FADT table. > > **/ > @@ -814,7 +736,9 @@ GetSmiCommandPort ( > { > EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt; > > - Fadt = FindAcpiFadtTable (); > + Fadt = (EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *) EfiFindAcpiTableBySignature ( > + EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE > + ); > ASSERT (Fadt != NULL); > > mSmiCommandPort = 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. > > -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_ > > #include > -#include > #include > #include > #include > Reviewed-by: Laszlo Ersek (I realize the new API might change still.) Thanks Laszlo