From: "Ni, Ruiyu" <ruiyu.ni@Intel.com>
To: Star Zeng <star.zeng@intel.com>, edk2-devel@lists.01.org
Cc: Younas khan <pmdyounaskhan786@gmail.com>,
Michael D Kinney <michael.d.kinney@intel.com>,
Liming Gao <liming.gao@intel.com>,
Jiewen Yao <jiewen.yao@intel.com>
Subject: Re: [PATCH V3 4/6] PcAtChipsetPkg PcRtc: Use new EfiLocateFirstAcpiTable()
Date: Mon, 17 Sep 2018 17:15:46 +0800 [thread overview]
Message-ID: <ba30b11c-a032-1d5c-9ba4-de2e9bb97c20@Intel.com> (raw)
In-Reply-To: <1537175295-37508-5-git-send-email-star.zeng@intel.com>
On 9/17/2018 5:08 PM, 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 PcatRealTimeClockRuntimeDxe to use new
> EfiLocateFirstAcpiTable() 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>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Star Zeng <star.zeng@intel.com>
> ---
> PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c | 80 +---------------------
> 1 file changed, 3 insertions(+), 77 deletions(-)
>
> diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
> index 2105acf35f7b..7965eb8aa55b 100644
> --- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
> +++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
> @@ -1203,49 +1203,6 @@ IsWithinOneDay (
> }
>
> /**
> - This function find ACPI table with the specified signature in RSDT or XSDT.
> -
> - @param Sdt ACPI RSDT or XSDT.
> - @param Signature ACPI table signature.
> - @param TablePointerSize Size of table pointer: 4 or 8.
> -
> - @return ACPI table or NULL if not found.
> -**/
> -VOID *
> -ScanTableInSDT (
> - IN EFI_ACPI_DESCRIPTION_HEADER *Sdt,
> - IN UINT32 Signature,
> - IN UINTN TablePointerSize
> - )
> -{
> - UINTN Index;
> - UINTN EntryCount;
> - UINTN EntryBase;
> - EFI_ACPI_DESCRIPTION_HEADER *Table;
> -
> - EntryCount = (Sdt->Length - sizeof (EFI_ACPI_DESCRIPTION_HEADER)) / TablePointerSize;
> -
> - EntryBase = (UINTN) (Sdt + 1);
> - for (Index = 0; Index < EntryCount; Index++) {
> - //
> - // When TablePointerSize is 4 while sizeof (VOID *) is 8, make sure the upper 4 bytes are zero.
> - //
> - Table = 0;
> - CopyMem (&Table, (VOID *) (EntryBase + Index * TablePointerSize), TablePointerSize);
> -
> - if (Table == NULL) {
> - continue;
> - }
> -
> - if (Table->Signature == Signature) {
> - return Table;
> - }
> - }
> -
> - return NULL;
> -}
> -
> -/**
> Get the century RTC address from the ACPI FADT table.
>
> @return The century RTC address or 0 if not found.
> @@ -1255,42 +1212,11 @@ GetCenturyRtcAddress (
> VOID
> )
> {
> - EFI_STATUS Status;
> - EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER *Rsdp;
> EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt;
>
> - Status = EfiGetSystemConfigurationTable (&gEfiAcpiTableGuid, (VOID **) &Rsdp);
> - if (EFI_ERROR (Status)) {
> - Status = EfiGetSystemConfigurationTable (&gEfiAcpi10TableGuid, (VOID **) &Rsdp);
> - }
> -
> - if (EFI_ERROR (Status) || (Rsdp == NULL)) {
> - return 0;
> - }
> -
> - Fadt = NULL;
> -
> - //
> - // Find FADT in XSDT
> - //
> - if (Rsdp->Revision >= EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER_REVISION && Rsdp->XsdtAddress != 0) {
> - Fadt = ScanTableInSDT (
> - (EFI_ACPI_DESCRIPTION_HEADER *) (UINTN) Rsdp->XsdtAddress,
> - EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
> - sizeof (UINTN)
> - );
> - }
> -
> - //
> - // Find FADT in RSDT
> - //
> - if (Fadt == NULL && Rsdp->RsdtAddress != 0) {
> - Fadt = ScanTableInSDT (
> - (EFI_ACPI_DESCRIPTION_HEADER *) (UINTN) Rsdp->RsdtAddress,
> - EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
> - sizeof (UINT32)
> - );
> - }
> + Fadt = (EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *) EfiLocateFirstAcpiTable (
> + EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE
> + );
>
> if ((Fadt != NULL) &&
> (Fadt->Century > RTC_ADDRESS_REGISTER_D) && (Fadt->Century < 0x80)
>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
--
Thanks,
Ray
next prev parent reply other threads:[~2018-09-17 9:14 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-17 9:08 [PATCH V3 0/6] Add new EfiLocateXXXAcpiTable() APIs Star Zeng
2018-09-17 9:08 ` [PATCH V3 1/6] MdePkg UefiLib: " Star Zeng
2018-09-17 9:16 ` Ni, Ruiyu
2018-09-17 9:08 ` [PATCH V3 2/6] IntelSiliconPkg IntelVTdDxe: Use new EfiLocateFirstAcpiTable() Star Zeng
2018-09-19 5:59 ` Yao, Jiewen
2018-09-17 9:08 ` [PATCH V3 3/6] MdeModulePkg S3SaveStateDxe: " Star Zeng
2018-09-25 14:35 ` Yao, Jiewen
2018-09-17 9:08 ` [PATCH V3 4/6] PcAtChipsetPkg PcRtc: " Star Zeng
2018-09-17 9:15 ` Ni, Ruiyu [this message]
2018-09-17 9:08 ` [PATCH V3 5/6] ShellPkg DpDynamicCommand: " Star Zeng
2018-09-17 9:08 ` [PATCH V3 6/6] UefiCpuPkg PiSmmCpuDxeSmm: " Star Zeng
2018-09-18 14:18 ` [PATCH V3 0/6] Add new EfiLocateXXXAcpiTable() APIs Gao, Liming
2018-09-19 1:28 ` Zeng, Star
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=ba30b11c-a032-1d5c-9ba4-de2e9bb97c20@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