Reviewed-by: Andrei Warkentin <awarkentin@vmware.com>

From: Pete Batard <pete@akeo.ie>
Sent: Monday, February 8, 2021 11:08 AM
To: Jeremy Linton <jeremy.linton@arm.com>; devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Andrei Warkentin <awarkentin@vmware.com>; samer.el-haj-mahmoud@arm.com <samer.el-haj-mahmoud@arm.com>; leif@nuviainc.com <leif@nuviainc.com>; ardb+tianocore@kernel.org <ardb+tianocore@kernel.org>
Subject: Re: [PATCH v2 1/4] Platform/RaspberryPi: Add Negative table check
 
Looks good to me.

On 2021.02.01 22:53, Jeremy Linton wrote:
> Turns out its helpful to have a !PcdToken flag
> that enables a DSDT/SSDT. That simplifies
> both the emmc2 SSDT (it only installs when
> !SdIsArasan) and later for the XHCI/PCIe switch
> where we want to install one of two tables
> depending on whether a single Pcd is set.
>
> Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
> ---
>   Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 6 ++++++
>   1 file changed, 6 insertions(+)
>
> diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
> index 9581bc41e1..ca7533cbee 100644
> --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
> +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c
> @@ -616,6 +616,7 @@ typedef struct {
>   typedef struct {
>
>     UINT64                      OemTableId;
>
>     UINTN                       PcdToken;
>
> +  UINTN                       PcdTokenNot;
>
>     CONST AML_NAME_OP_REPLACE   *SdtNameOpReplace;
>
>   } NAMESPACE_TABLES;
>
>  
>
> @@ -713,6 +714,9 @@ VerifyUpdateTable (
>     if (SdtTable->PcdToken && !LibPcdGet32 (SdtTable->PcdToken)) {
>
>       Result = FALSE;
>
>     }
>
> +  if (SdtTable->PcdTokenNot && LibPcdGet32 (SdtTable->PcdTokenNot)) {
>
> +    Result = FALSE;
>
> +  }
>
>     if (Result && SdtTable->SdtNameOpReplace) {
>
>       UpdateSdtNameOps (AcpiHeader, SdtTable->SdtNameOpReplace);
>
>     }
>
> @@ -730,11 +734,13 @@ STATIC CONST NAMESPACE_TABLES SdtTables[] = {
>     {
>
>       SIGNATURE_64 ('R', 'P', 'I', 'T', 'H', 'F', 'A', 'N'),
>
>       PcdToken(PcdFanOnGpio),
>
> +    0,
>
>       SsdtNameOpReplace
>
>     },
>
>     {
>
>       SIGNATURE_64 ('R', 'P', 'I', 0, 0, 0, 0, 0),
>
>       0,
>
> +    0,
>
>       NULL
>
>     },
>
>     { }
>

Reviewed-by: Pete Batard <pete@akeo.ie>