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.126; helo=mga18.intel.com; envelope-from=ruiyu.ni@intel.com; receiver=edk2-devel@lists.01.org Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) (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 7ACFD210F93EF for ; Sun, 16 Sep 2018 23:56:40 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Sep 2018 23:56:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,384,1531810800"; d="scan'208";a="86684789" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga002.fm.intel.com with ESMTP; 16 Sep 2018 23:54:09 -0700 Received: from fmsmsx121.amr.corp.intel.com (10.18.125.36) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 16 Sep 2018 23:54:09 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx121.amr.corp.intel.com (10.18.125.36) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 16 Sep 2018 23:54:09 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.143]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.16]) with mapi id 14.03.0319.002; Mon, 17 Sep 2018 14:54:06 +0800 From: "Ni, Ruiyu" To: "Zeng, Star" , "edk2-devel@lists.01.org" CC: Younas khan , "Kinney, Michael D" , "Gao, Liming" , "Yao, Jiewen" , "Bi, Dandan" Thread-Topic: [PATCH V2 5/6] ShellPkg DpDynamicCommand: Use new EfiLocateFirstAcpiTable() Thread-Index: AQHUS0xhWm48o9dMWkSCdyBvkzjC9aT0D5uw Date: Mon, 17 Sep 2018 06:54:05 +0000 Deferred-Delivery: Mon, 17 Sep 2018 06:54:00 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5BE0D673@SHSMSX104.ccr.corp.intel.com> References: <1536834420-16620-1-git-send-email-star.zeng@intel.com> <1536834420-16620-6-git-send-email-star.zeng@intel.com> In-Reply-To: <1536834420-16620-6-git-send-email-star.zeng@intel.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH V2 5/6] ShellPkg DpDynamicCommand: 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: Mon, 17 Sep 2018 06:56:40 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ruiyu Ni Thanks/Ray > -----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 ; Bi, Dandan > > Subject: [PATCH V2 5/6] ShellPkg DpDynamicCommand: 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 DpDynamicCommand 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: Dandan Bi > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Star Zeng > --- > ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c | 136 +------------ > -------- > ShellPkg/DynamicCommand/DpDynamicCommand/Dp.h | 1 - > ShellPkg/DynamicCommand/DpDynamicCommand/Dp.uni | 1 - > ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf | 2 - > .../DpDynamicCommand/DpDynamicCommand.inf | 2 - > 5 files changed, 3 insertions(+), 139 deletions(-) >=20 > diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c > b/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c > index 2c094b63c94a..c14931055cbf 100644 > --- a/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c > +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c > @@ -118,116 +118,6 @@ DumpStatistics( void ) } >=20 > /** > - This function scan ACPI table in RSDT. > - > - @param Rsdt ACPI RSDT > - @param Signature ACPI table signature > - > - @return ACPI table > -**/ > -VOID * > -ScanTableInRSDT ( > - IN RSDT_TABLE *Rsdt, > - IN UINT32 Signature > - ) > -{ > - UINTN Index; > - UINT32 EntryCount; > - UINT32 *EntryPtr; > - EFI_ACPI_DESCRIPTION_HEADER *Table; > - > - EntryCount =3D (Rsdt->Header.Length - sizeof > (EFI_ACPI_DESCRIPTION_HEADER)) / sizeof(UINT32); > - > - EntryPtr =3D &Rsdt->Entry; > - for (Index =3D 0; Index < EntryCount; Index ++, EntryPtr ++) { > - Table =3D (EFI_ACPI_DESCRIPTION_HEADER*)((UINTN)(*EntryPtr)); > - if (Table->Signature =3D=3D Signature) { > - return Table; > - } > - } > - > - return NULL; > -} > - > -/** > - This function scan ACPI table in XSDT. > - > - @param Xsdt ACPI XSDT > - @param Signature ACPI table signature > - > - @return ACPI table > -**/ > -VOID * > -ScanTableInXSDT ( > - IN XSDT_TABLE *Xsdt, > - IN UINT32 Signature > - ) > -{ > - UINTN Index; > - UINT32 EntryCount; > - UINT64 EntryPtr; > - UINTN BasePtr; > - EFI_ACPI_DESCRIPTION_HEADER *Table; > - > - EntryCount =3D (Xsdt->Header.Length - sizeof > (EFI_ACPI_DESCRIPTION_HEADER)) / sizeof(UINT64); > - > - BasePtr =3D (UINTN)(&(Xsdt->Entry)); > - for (Index =3D 0; Index < EntryCount; Index ++) { > - CopyMem (&EntryPtr, (VOID *)(BasePtr + Index * sizeof(UINT64)), > sizeof(UINT64)); > - Table =3D (EFI_ACPI_DESCRIPTION_HEADER*)((UINTN)(EntryPtr)); > - if (Table->Signature =3D=3D Signature) { > - return Table; > - } > - } > - > - return NULL; > -} > - > -/** > - This function scan ACPI table in RSDP. > - > - @param Rsdp ACPI RSDP > - @param Signature ACPI table signature > - > - @return ACPI table > -**/ > -VOID * > -FindAcpiPtr ( > - IN EFI_ACPI_5_0_ROOT_SYSTEM_DESCRIPTION_POINTER *Rsdp, > - IN UINT32 Signature > - ) > -{ > - EFI_ACPI_DESCRIPTION_HEADER *AcpiTable; > - RSDT_TABLE *Rsdt; > - XSDT_TABLE *Xsdt; > - > - AcpiTable =3D NULL; > - > - // > - // Check ACPI2.0 table > - // > - Rsdt =3D (RSDT_TABLE *)(UINTN)Rsdp->RsdtAddress; > - Xsdt =3D NULL; > - if ((Rsdp->Revision >=3D 2) && (Rsdp->XsdtAddress < (UINT64)(UINTN)-1)= ) { > - Xsdt =3D (XSDT_TABLE *)(UINTN)Rsdp->XsdtAddress; > - } > - // > - // Check Xsdt > - // > - if (Xsdt !=3D NULL) { > - AcpiTable =3D ScanTableInXSDT (Xsdt, Signature); > - } > - // > - // Check Rsdt > - // > - if ((AcpiTable =3D=3D NULL) && (Rsdt !=3D NULL)) { > - AcpiTable =3D ScanTableInRSDT (Rsdt, Signature); > - } > - > - return AcpiTable; > -} > - > -/** > Get Boot performance table form Acpi table. >=20 > **/ > @@ -235,31 +125,11 @@ EFI_STATUS > GetBootPerformanceTable ( > ) > { > - EFI_STATUS Status; > - VOID *AcpiTable; > FIRMWARE_PERFORMANCE_TABLE *FirmwarePerformanceTable; >=20 > - AcpiTable =3D NULL; > - > - Status =3D EfiGetSystemConfigurationTable ( > - &gEfiAcpi20TableGuid, > - &AcpiTable > - ); > - if (EFI_ERROR (Status)) { > - Status =3D EfiGetSystemConfigurationTable ( > - &gEfiAcpi10TableGuid, > - &AcpiTable > - ); > - } > - if (EFI_ERROR(Status) || AcpiTable =3D=3D NULL) { > - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_DP_GET_ACPI_TABLE_FAIL), mDpHiiHandle); > - return Status; > - } > - > - FirmwarePerformanceTable =3D FindAcpiPtr ( > - (EFI_ACPI_5_0_ROOT_SYSTEM_DESCRIPTION_POINTER > *)AcpiTable, > - > EFI_ACPI_5_0_FIRMWARE_PERFORMANCE_DATA_TABLE_SIGNATURE > - ); > + FirmwarePerformanceTable =3D (FIRMWARE_PERFORMANCE_TABLE *) > EfiLocateFirstAcpiTable ( > + > EFI_ACPI_5_0_FIRMWARE_PERFORMANCE_DATA_TABLE_SIGNATURE > + ); > if (FirmwarePerformanceTable =3D=3D NULL) { > ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_DP_GET_ACPI_FPDT_FAIL), mDpHiiHandle); > return EFI_NOT_FOUND; > diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.h > b/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.h > index 0e6e9422effc..db8472f6558f 100644 > --- a/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.h > +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.h > @@ -21,7 +21,6 @@ > #include > #include > #include > -#include >=20 > #include > #include > diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.uni > b/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.uni > index 1d6f25b8c252..7fc2b8d1c966 100644 > --- a/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.uni > +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.uni > @@ -94,7 +94,6 @@ > #string STR_DP_INCOMPLETE #language en-US " I " > #string STR_DP_COMPLETE #language en-US " " > #string STR_ALIT_UNKNOWN #language en-US "Unknown" > -#string STR_DP_GET_ACPI_TABLE_FAIL #language en-US "Fail to get ACP= I > Table\n" > #string STR_DP_GET_ACPI_FPDT_FAIL #language en-US "Fail to get > Firmware Performance Data Table (FPDT) in ACPI Table\n" >=20 > #string STR_GET_HELP_DP #language en-US "" > diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf > b/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf > index cedb333b285c..3a35fca310b0 100644 > --- a/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf > +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf > @@ -59,8 +59,6 @@ [LibraryClasses] >=20 > [Guids] > gPerformanceProtocolGuid ## CONSUMES ##= SystemTable > - gEfiAcpi20TableGuid ## CONSUMES ##= SystemTable > - gEfiAcpi10TableGuid ## CONSUMES ##= SystemTable >=20 > [Protocols] > gEfiLoadedImageProtocolGuid ## CONSUMES > diff --git > a/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.i > nf > b/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.i > nf > index 8fd3bbd5df83..62a3b5246500 100644 > --- > a/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.i > nf > +++ > b/ShellPkg/DynamicCommand/DpDynamicCommand/DpDynamicCommand.i > nf > @@ -60,8 +60,6 @@ [LibraryClasses] >=20 > [Guids] > gPerformanceProtocolGuid ## CONSUMES ##= SystemTable > - gEfiAcpi20TableGuid ## CONSUMES > - gEfiAcpi10TableGuid ## CONSUMES >=20 > [Protocols] > gEfiLoadedImageProtocolGuid ## CONSUMES > -- > 2.7.0.windows.1