[edk2-devel] [PATCH v2 11/11] DynamicTablesPkg: Remove check for _CPC field

Leif Lindholm quic_llindhol at quicinc.com
Thu Oct 26 11:05:43 UTC 2023


On Wed, Oct 25, 2023 at 13:25:40 +0200, pierre.gondois at arm.com wrote:
> From: Pierre Gondois <pierre.gondois at arm.com>
> 
> When generating _CPC objects, some fields are mandatory.

Mandatory by spec or mandatory by current API?
If the former, could we either warn or add a Pcd to enable the more
lenient behaviour?

/
    Leif

> Some fields cannot be supported by a the Juno platform, which is used
> to test the _CPC generation. Therefore, don't prevent from generating
> _CPC objects if the fields below are missing, and let the OS handle
> the missing information.
> 
> _CPC fields that are exempted from checks:
> - PerformanceLimitedRegister
> - ReferencePerformanceCounterRegister
> - DeliveredPerformanceCounterRegister
> 
> Signed-off-by: Pierre Gondois <pierre.gondois at arm.com>
> ---
>  .../Common/AmlLib/CodeGen/AmlCodeGen.c        | 19 +++++++++++++++----
>  1 file changed, 15 insertions(+), 4 deletions(-)
> 
> diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c
> index f350083b148c..423e64f12606 100644
> --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c
> +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c
> @@ -3531,6 +3531,11 @@ AmlCreateCpcNode (
>      return EFI_INVALID_PARAMETER;
>    }
>  
> +  // The following fields are theoretically mandatory, but not supported
> +  // by some platforms. Don't check them:
> +  // - PerformanceLimitedRegister
> +  // - ReferencePerformanceCounterRegister
> +  // - DeliveredPerformanceCounterRegister
>    if ((IsNullGenericAddress (&CpcInfo->HighestPerformanceBuffer) &&
>         (CpcInfo->HighestPerformanceInteger == 0)) ||
>        (IsNullGenericAddress (&CpcInfo->NominalPerformanceBuffer) &&
> @@ -3539,13 +3544,19 @@ AmlCreateCpcNode (
>         (CpcInfo->LowestNonlinearPerformanceInteger == 0)) ||
>        (IsNullGenericAddress (&CpcInfo->LowestPerformanceBuffer) &&
>         (CpcInfo->LowestPerformanceInteger == 0)) ||
> -      IsNullGenericAddress (&CpcInfo->DesiredPerformanceRegister) ||
> -      IsNullGenericAddress (&CpcInfo->ReferencePerformanceCounterRegister) ||
> -      IsNullGenericAddress (&CpcInfo->DeliveredPerformanceCounterRegister) ||
> -      IsNullGenericAddress (&CpcInfo->PerformanceLimitedRegister))
> +      IsNullGenericAddress (&CpcInfo->DesiredPerformanceRegister))
>    {
>      ASSERT (0);
>      return EFI_INVALID_PARAMETER;
> +  } else if ((IsNullGenericAddress (&CpcInfo->HighestPerformanceBuffer) &&
> +              (CpcInfo->HighestPerformanceInteger == 0)) ||
> +             (IsNullGenericAddress (&CpcInfo->NominalPerformanceBuffer) &&
> +              (CpcInfo->NominalPerformanceInteger == 0)))
> +  {
> +    DEBUG ((
> +      DEBUG_WARN,
> +      "Missing Reference|Delivered performance field in _CPC object\n"
> +      ));
>    }
>  
>    CpcPackage = NULL;
> -- 
> 2.25.1
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#110092): https://edk2.groups.io/g/devel/message/110092
Mute This Topic: https://groups.io/mt/102175822/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/3943202/1813853/130120423/xyzzy [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list