public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] PcAtChipsetPkg/PcRtc: Handle NULL table entry in RSDT/XSDT
@ 2016-11-14  5:26 Ruiyu Ni
  2016-11-15  1:59 ` Ni, Ruiyu
  0 siblings, 1 reply; 5+ messages in thread
From: Ruiyu Ni @ 2016-11-14  5:26 UTC (permalink / raw)
  To: edk2-devel

The ACPI code may reserve the first entry for a certain table
(might be FACS) to help with OS compatible issues.
We need to skip the NULL table entry in RSDT/XSDT.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
---
 PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
index 2bb41e7..35e34b7 100644
--- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
+++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
@@ -1230,6 +1230,11 @@ ScanTableInSDT (
     //
     Table = 0;
     CopyMem (&Table, (VOID *) (EntryBase + Index * TablePointerSize), TablePointerSize);
+
+    if (Table == NULL) {
+      continue;
+    }

+
     if (Table->Signature == Signature) {
       return Table;
     }
-- 
2.9.0.windows.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] PcAtChipsetPkg/PcRtc: Handle NULL table entry in RSDT/XSDT
  2016-11-14  5:26 [PATCH] PcAtChipsetPkg/PcRtc: Handle NULL table entry in RSDT/XSDT Ruiyu Ni
@ 2016-11-15  1:59 ` Ni, Ruiyu
  2016-11-17 10:55   ` Zeng, Star
  0 siblings, 1 reply; 5+ messages in thread
From: Ni, Ruiyu @ 2016-11-15  1:59 UTC (permalink / raw)
  To: Ni, Ruiyu, edk2-devel@lists.01.org; +Cc: sean.brogan@microsoft.com, Zeng, Star



Thanks/Ray

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> Ruiyu Ni
> Sent: Monday, November 14, 2016 1:26 PM
> To: edk2-devel@lists.01.org
> Subject: [edk2] [PATCH] PcAtChipsetPkg/PcRtc: Handle NULL table entry in
> RSDT/XSDT
> 
> The ACPI code may reserve the first entry for a certain table
> (might be FACS) to help with OS compatible issues.
> We need to skip the NULL table entry in RSDT/XSDT.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Sean Brogan <sean.brogan@microsoft.com>
> ---
>  PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
> b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
> index 2bb41e7..35e34b7 100644
> --- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
> +++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
> @@ -1230,6 +1230,11 @@ ScanTableInSDT (
>      //
>      Table = 0;
>      CopyMem (&Table, (VOID *) (EntryBase + Index * TablePointerSize),
> TablePointerSize);
> +
> +    if (Table == NULL) {
> +      continue;
> +    }
> 
> +
>      if (Table->Signature == Signature) {
>        return Table;
>      }
> --
> 2.9.0.windows.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] PcAtChipsetPkg/PcRtc: Handle NULL table entry in RSDT/XSDT
  2016-11-15  1:59 ` Ni, Ruiyu
@ 2016-11-17 10:55   ` Zeng, Star
  2016-11-18  1:58     ` Ni, Ruiyu
  0 siblings, 1 reply; 5+ messages in thread
From: Zeng, Star @ 2016-11-17 10:55 UTC (permalink / raw)
  To: Ni, Ruiyu, edk2-devel@lists.01.org; +Cc: sean.brogan@microsoft.com, Zeng, Star

Hi Ray,

Add two minor comments inline.

Thanks,
Star
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of 
> Ruiyu Ni
> Sent: Monday, November 14, 2016 1:26 PM
> To: edk2-devel@lists.01.org
> Subject: [edk2] [PATCH] PcAtChipsetPkg/PcRtc: Handle NULL table entry 
> in RSDT/XSDT
> 
> The ACPI code may reserve the first entry for a certain table (might 
> be FACS) to help with OS compatible issues.

FACS is in FADT according to ACPI spec.

> We need to skip the NULL table entry in RSDT/XSDT.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Sean Brogan <sean.brogan@microsoft.com>
> ---
>  PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
> b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
> index 2bb41e7..35e34b7 100644
> --- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
> +++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
> @@ -1230,6 +1230,11 @@ ScanTableInSDT (
>      //
>      Table = 0;

How about to remove this superfluous line " Table = 0;"?

>      CopyMem (&Table, (VOID *) (EntryBase + Index * TablePointerSize), 
> TablePointerSize);
> +
> +    if (Table == NULL) {
> +      continue;
> +    }
> 
> +
>      if (Table->Signature == Signature) {
>        return Table;
>      }
> --
> 2.9.0.windows.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] PcAtChipsetPkg/PcRtc: Handle NULL table entry in RSDT/XSDT
  2016-11-17 10:55   ` Zeng, Star
@ 2016-11-18  1:58     ` Ni, Ruiyu
  2016-11-18  2:32       ` Zeng, Star
  0 siblings, 1 reply; 5+ messages in thread
From: Ni, Ruiyu @ 2016-11-18  1:58 UTC (permalink / raw)
  To: Zeng, Star, edk2-devel@lists.01.org



Regards,
Ray

>-----Original Message-----
>From: Zeng, Star
>Sent: Thursday, November 17, 2016 6:55 PM
>To: Ni, Ruiyu <ruiyu.ni@intel.com>; edk2-devel@lists.01.org
>Cc: sean.brogan@microsoft.com; Zeng, Star <star.zeng@intel.com>
>Subject: RE: [edk2] [PATCH] PcAtChipsetPkg/PcRtc: Handle NULL table entry in RSDT/XSDT
>
>Hi Ray,
>
>Add two minor comments inline.
>
>Thanks,
>Star
>> -----Original Message-----
>> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
>> Ruiyu Ni
>> Sent: Monday, November 14, 2016 1:26 PM
>> To: edk2-devel@lists.01.org
>> Subject: [edk2] [PATCH] PcAtChipsetPkg/PcRtc: Handle NULL table entry
>> in RSDT/XSDT
>>
>> The ACPI code may reserve the first entry for a certain table (might
>> be FACS) to help with OS compatible issues.
>
>FACS is in FADT according to ACPI spec.
>
do you suggest to use FADT in commit message?

>> We need to skip the NULL table entry in RSDT/XSDT.
>>
>> Contributed-under: TianoCore Contribution Agreement 1.0
>> Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
>> Cc: Sean Brogan <sean.brogan@microsoft.com>
>> ---
>>  PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
>> b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
>> index 2bb41e7..35e34b7 100644
>> --- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
>> +++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
>> @@ -1230,6 +1230,11 @@ ScanTableInSDT (
>>      //
>>      Table = 0;
>
>How about to remove this superfluous line " Table = 0;"?
>


  //
  // 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)
             );
  }
when above code runs in 64bit env, CopyMem only fills the 4-byte in Table leaving
hi-4-byte un-initialized.
so we need to set Table to 0 to fill hi-4-byte.

>>      CopyMem (&Table, (VOID *) (EntryBase + Index * TablePointerSize),
>> TablePointerSize);
>> +
>> +    if (Table == NULL) {
>> +      continue;
>> +    }
>>
>> +
>>      if (Table->Signature == Signature) {
>>        return Table;
>>      }
>> --
>> 2.9.0.windows.1
>>
>> _______________________________________________
>> edk2-devel mailing list
>> edk2-devel@lists.01.org
>> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] PcAtChipsetPkg/PcRtc: Handle NULL table entry in RSDT/XSDT
  2016-11-18  1:58     ` Ni, Ruiyu
@ 2016-11-18  2:32       ` Zeng, Star
  0 siblings, 0 replies; 5+ messages in thread
From: Zeng, Star @ 2016-11-18  2:32 UTC (permalink / raw)
  To: Ni, Ruiyu, edk2-devel@lists.01.org; +Cc: sean.brogan@microsoft.com, Zeng, Star

I agree to use FADT in commit log.
I got the reason why "Table = 0;" needs.

With that commit log updated, Reviewed-by: Star Zeng <star.zeng@intel.com>

Thanks,
Star
-----Original Message-----
From: Ni, Ruiyu 
Sent: Friday, November 18, 2016 9:59 AM
To: Zeng, Star <star.zeng@intel.com>; edk2-devel@lists.01.org
Cc: sean.brogan@microsoft.com
Subject: RE: [edk2] [PATCH] PcAtChipsetPkg/PcRtc: Handle NULL table entry in RSDT/XSDT



Regards,
Ray

>-----Original Message-----
>From: Zeng, Star
>Sent: Thursday, November 17, 2016 6:55 PM
>To: Ni, Ruiyu <ruiyu.ni@intel.com>; edk2-devel@lists.01.org
>Cc: sean.brogan@microsoft.com; Zeng, Star <star.zeng@intel.com>
>Subject: RE: [edk2] [PATCH] PcAtChipsetPkg/PcRtc: Handle NULL table 
>entry in RSDT/XSDT
>
>Hi Ray,
>
>Add two minor comments inline.
>
>Thanks,
>Star
>> -----Original Message-----
>> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf 
>> Of Ruiyu Ni
>> Sent: Monday, November 14, 2016 1:26 PM
>> To: edk2-devel@lists.01.org
>> Subject: [edk2] [PATCH] PcAtChipsetPkg/PcRtc: Handle NULL table entry 
>> in RSDT/XSDT
>>
>> The ACPI code may reserve the first entry for a certain table (might 
>> be FACS) to help with OS compatible issues.
>
>FACS is in FADT according to ACPI spec.
>
do you suggest to use FADT in commit message?

>> We need to skip the NULL table entry in RSDT/XSDT.
>>
>> Contributed-under: TianoCore Contribution Agreement 1.0
>> Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
>> Cc: Sean Brogan <sean.brogan@microsoft.com>
>> ---
>>  PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
>> b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
>> index 2bb41e7..35e34b7 100644
>> --- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
>> +++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
>> @@ -1230,6 +1230,11 @@ ScanTableInSDT (
>>      //
>>      Table = 0;
>
>How about to remove this superfluous line " Table = 0;"?
>


  //
  // 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)
             );
  }
when above code runs in 64bit env, CopyMem only fills the 4-byte in Table leaving hi-4-byte un-initialized.
so we need to set Table to 0 to fill hi-4-byte.

>>      CopyMem (&Table, (VOID *) (EntryBase + Index * 
>> TablePointerSize), TablePointerSize);
>> +
>> +    if (Table == NULL) {
>> +      continue;
>> +    }
>>
>> +
>>      if (Table->Signature == Signature) {
>>        return Table;
>>      }
>> --
>> 2.9.0.windows.1
>>
>> _______________________________________________
>> edk2-devel mailing list
>> edk2-devel@lists.01.org
>> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-11-18  2:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-14  5:26 [PATCH] PcAtChipsetPkg/PcRtc: Handle NULL table entry in RSDT/XSDT Ruiyu Ni
2016-11-15  1:59 ` Ni, Ruiyu
2016-11-17 10:55   ` Zeng, Star
2016-11-18  1:58     ` Ni, Ruiyu
2016-11-18  2:32       ` Zeng, Star

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox