From: "Zeng, Star" <star.zeng@intel.com>
To: Laszlo Ersek <lersek@redhat.com>,
"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Ni, Ruiyu" <ruiyu.ni@intel.com>,
"Dong, Eric" <eric.dong@intel.com>,
Younas khan <pmdyounaskhan786@gmail.com>,
"Gao, Liming" <liming.gao@intel.com>,
"Yao, Jiewen" <jiewen.yao@intel.com>,
"Kinney, Michael D" <michael.d.kinney@intel.com>,
"Zeng, Star" <star.zeng@intel.com>
Subject: Re: [PATCH 6/6] UefiCpuPkg PiSmmCpuDxeSmm: Use new EfiFindAcpiTableBySignature()
Date: Mon, 3 Sep 2018 03:28:31 +0000 [thread overview]
Message-ID: <0C09AFA07DD0434D9E2A0C6AEB0483103BBB4A0D@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <02b40ee9-78ab-4694-dfae-416268529de2@redhat.com>
Thanks Laszlo. :)
Star
-----Original Message-----
From: Laszlo Ersek [mailto:lersek@redhat.com]
Sent: Saturday, September 1, 2018 4:34 AM
To: Zeng, Star <star.zeng@intel.com>; edk2-devel@lists.01.org
Cc: Ni, Ruiyu <ruiyu.ni@intel.com>; Dong, Eric <eric.dong@intel.com>; Younas khan <pmdyounaskhan786@gmail.com>; Gao, Liming <liming.gao@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>
Subject: Re: [edk2] [PATCH 6/6] UefiCpuPkg PiSmmCpuDxeSmm: Use new EfiFindAcpiTableBySignature()
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 <pmdyounaskhan786@gmail.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Star Zeng <star.zeng@intel.com>
> ---
> 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.<BR>
> +# Copyright (c) 2009 - 2018, Intel Corporation. All rights
> +reserved.<BR>
> # Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR> #
> # 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.<BR>
> +Copyright (c) 2012 - 2018, Intel Corporation. All rights
> +reserved.<BR>
> Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
>
> 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.<BR>
> +Copyright (c) 2012 - 2018, Intel Corporation. All rights
> +reserved.<BR>
> 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 <Guid/GlobalVariable.h>
> -#include <Guid/Acpi.h>
> #include <Protocol/SmmReadyToLock.h>
> #include <Library/UefiRuntimeServicesTableLib.h>
> #include <Library/DxeServicesTableLib.h>
>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
(I realize the new API might change still.)
Thanks
Laszlo
prev parent reply other threads:[~2018-09-03 3:30 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-31 11:29 [PATCH 0/6] Add new EfiFindAcpiTableBySignature() API Star Zeng
2018-08-31 11:29 ` [PATCH 1/6] MdePkg UefiLib: " Star Zeng
2018-08-31 11:57 ` Yao, Jiewen
2018-08-31 16:28 ` Ni, Ruiyu
2018-08-31 16:29 ` Ni, Ruiyu
2018-08-31 23:04 ` Yao, Jiewen
2018-09-03 3:26 ` Zeng, Star
2018-09-03 5:09 ` Ni, Ruiyu
2018-09-03 6:11 ` Zeng, Star
2018-09-03 6:14 ` Yao, Jiewen
2018-09-03 6:32 ` Ni, Ruiyu
2018-09-05 10:02 ` Zeng, Star
2018-08-31 11:29 ` [PATCH 2/6] IntelSiliconPkg IntelVTdDxe: Use new EfiFindAcpiTableBySignature() Star Zeng
2018-08-31 11:29 ` [PATCH 3/6] MdeModulePkg S3SaveStateDxe: " Star Zeng
2018-08-31 11:29 ` [PATCH 4/6] PcAtChipsetPkg PcRtc: " Star Zeng
2018-08-31 11:29 ` [PATCH 5/6] ShellPkg DpDynamicCommand: " Star Zeng
2018-08-31 11:29 ` [PATCH 6/6] UefiCpuPkg PiSmmCpuDxeSmm: " Star Zeng
2018-08-31 20:33 ` Laszlo Ersek
2018-09-03 3:28 ` Zeng, Star [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0C09AFA07DD0434D9E2A0C6AEB0483103BBB4A0D@shsmsx102.ccr.corp.intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox