From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 7E2B6AC0F21 for ; Mon, 29 Jan 2024 12:09:51 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=ay8PeLQ85zBrb2VPJpK3cVAwetefHVoAGXbEcXk5Dr8=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1706530190; v=1; b=fALDcGdW9/uUkYu5kbBK1Qh0L826l+eGCKjnaxoO6Dm6ecGBb1U0NCBGQcJaSsJf2REzyD9z rpjWUty/zl9VDkZh6X4EWyI5X4nV9rC15E0j8VjYcQ+l7xRFr4kvv59zwyfWkLcdTqYIJpmrGVc +kimSX7XvOdtAKauLQ1r9qK4= X-Received: by 127.0.0.2 with SMTP id GpgEYY7687511xIL0Loe4U6m; Mon, 29 Jan 2024 04:09:50 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.12949.1706530189510385827 for ; Mon, 29 Jan 2024 04:09:49 -0800 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E34521FB; Mon, 29 Jan 2024 04:10:32 -0800 (PST) X-Received: from cam-smtp0.cambridge.arm.com (e126645.nice.arm.com [10.34.100.129]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 8A9CC3F5A1; Mon, 29 Jan 2024 04:09:48 -0800 (PST) From: "PierreGondois" To: devel@edk2.groups.io Cc: Sami Mujawar , Pierre Gondois Subject: [edk2-devel] [PATCH v6 1/1] DynamicTablesPkg: Exempt some _CPC field from checks Date: Mon, 29 Jan 2024 13:09:35 +0100 Message-Id: <20240129120935.139976-1-pierre.gondois@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,pierre.gondois@arm.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: VmBi5pEmZi5tuaDdcjdK9sW4x7686176AA= Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=fALDcGdW; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=arm.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io When generating _CPC objects, some fields are mandatory by spec [1]. Some fields cannot be supported by a the Juno platform, which is used to test the _CPC generation. Therefore, rely on the PcdDevelopmentPlatformRelaxations Pcd to either: - warn about the missing fields and and let the OS handle the missing information - consider the missing fields as an error _CPC fields that are exempted from checks when the Pcd is set: - PerformanceLimitedRegister - ReferencePerformanceCounterRegister - DeliveredPerformanceCounterRegister [1] Cf. non-optional fields in: ACPI 6.5, s8.4.6.1 '_CPC (Continuous Performance Control)' Signed-off-by: Pierre Gondois --- Notes: v6: Do not warn if one of the following fields is missing: - HighestPerformanceBuffer - NominalPerformanceBuffer An error code should just be returned. .../Library/Common/AmlLib/AmlLib.inf | 3 ++ .../Common/AmlLib/CodeGen/AmlCodeGen.c | 28 ++++++++++++++++--- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/DynamicTablesPkg/Library/Common/AmlLib/AmlLib.inf b/DynamicTab= lesPkg/Library/Common/AmlLib/AmlLib.inf index 6d0aa6ff934c..f269691864d4 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/AmlLib.inf +++ b/DynamicTablesPkg/Library/Common/AmlLib/AmlLib.inf @@ -71,6 +71,9 @@ [LibraryClasses] BaseLib=0D MemoryAllocationLib=0D =0D +[FixedPcd]=0D + gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdDevelopmentPlatformRelaxations=0D +=0D [BuildOptions]=0D *_*_*_CC_FLAGS =3D -DAML_HANDLE=0D =0D diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c b/= DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c index 6f3f46e3b1ed..22c2d598d0d8 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c @@ -3532,6 +3532,29 @@ AmlCreateCpcNode ( return EFI_INVALID_PARAMETER;=0D }=0D =0D + /// The following fields are theoretically mandatory, but not supported= =0D + /// by some platforms.=0D + /// - PerformanceLimitedRegister=0D + /// - ReferencePerformanceCounterRegister=0D + /// - DeliveredPerformanceCounterRegister=0D + /// Warn if BIT0 in PcdDevelopmentPlatformRelaxations is set, otherwise= =0D + /// return an error.=0D + if (IsNullGenericAddress (&CpcInfo->PerformanceLimitedRegister) ||=0D + IsNullGenericAddress (&CpcInfo->ReferencePerformanceCounterRegister)= ||=0D + IsNullGenericAddress (&CpcInfo->DeliveredPerformanceCounterRegister)= )=0D + {=0D + if ((PcdGet64 (PcdDevelopmentPlatformRelaxations) & BIT0) !=3D 0) {=0D + DEBUG ((=0D + DEBUG_WARN,=0D + "Missing PerformanceLimited|ReferencePerformanceCounter|"=0D + "DeliveredPerformanceCounter field in _CPC object\n"=0D + ));=0D + } else {=0D + ASSERT (0);=0D + return EFI_INVALID_PARAMETER;=0D + }=0D + }=0D +=0D if ((IsNullGenericAddress (&CpcInfo->HighestPerformanceBuffer) &&=0D (CpcInfo->HighestPerformanceInteger =3D=3D 0)) ||=0D (IsNullGenericAddress (&CpcInfo->NominalPerformanceBuffer) &&=0D @@ -3540,10 +3563,7 @@ AmlCreateCpcNode ( (CpcInfo->LowestNonlinearPerformanceInteger =3D=3D 0)) ||=0D (IsNullGenericAddress (&CpcInfo->LowestPerformanceBuffer) &&=0D (CpcInfo->LowestPerformanceInteger =3D=3D 0)) ||=0D - IsNullGenericAddress (&CpcInfo->DesiredPerformanceRegister) ||=0D - IsNullGenericAddress (&CpcInfo->ReferencePerformanceCounterRegister)= ||=0D - IsNullGenericAddress (&CpcInfo->DeliveredPerformanceCounterRegister)= ||=0D - IsNullGenericAddress (&CpcInfo->PerformanceLimitedRegister))=0D + IsNullGenericAddress (&CpcInfo->DesiredPerformanceRegister))=0D {=0D ASSERT (0);=0D return EFI_INVALID_PARAMETER;=0D --=20 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#114694): https://edk2.groups.io/g/devel/message/114694 Mute This Topic: https://groups.io/mt/104029707/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-