From nobody Fri Dec 27 02:42:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+114411+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+114411+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1706195953; cv=none; d=zohomail.com; s=zohoarc; b=n9gP+mu1+GuW3hHVS9zmDWVBG/Bz0E8ey+OHNEunZR1P3zMGEOQuP2Hca4MinWxzavyBct0gvxjzfx7KvBYg/Cy8+bEOLCbVjJXC71QlapcKTt9M+CDzyUck51aTtnWZL28yIHJ3/8bJTBLXnfqdVPCJ9zcoqfLICSpIi7HeOQs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706195953; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=7MTUwsT3X/8QIz1Pl43DF9GWND07B04OMO1UNHDIbSA=; b=dn0Vm3aVm1Gkuuq8G80U2lPJ0U1bBrDvKvx7GKER2lmgWhIHXkzgDNo5c1x0Mf7vuc3mq31Vvp8317iYbHXdT9d6SmVasike+U6cAb2BiUt2a+ToapqnA6p4YV1IGVuCJvWCJzxVPjgvoL99TKEnr8SiaNrHFfNfavJTN4atKws= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+114411+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1706195953137601.8196562114636; Thu, 25 Jan 2024 07:19:13 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=uOQZ1ExMoWpIM6+jHsWdviw6tf9JDhe5C+3XIHgE0ho=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: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=1706195952; v=1; b=TCxLC2WBqB8esvkdIQsakGGlNZG+1cFWEULirX54yZ9bCFBRa9ICNP7KDVUZE28QpAxWkmPJ KgOQPOKZIe0KxiB/VtM+6fa5X6XEzrSynFXcGdOqdxZOMYJTv8NpHixTur+I7TApK/bf76F9xRi rHWeXnRuaXwcgFzbtPLEmqXc= X-Received: by 127.0.0.2 with SMTP id BYpnYY1788612xU5nrhxREvC; Thu, 25 Jan 2024 07:19:12 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.20291.1706195952081413714 for ; Thu, 25 Jan 2024 07:19:12 -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 D6895FEC; Thu, 25 Jan 2024 07:19:55 -0800 (PST) X-Received: from e126645.arm.com (unknown [10.57.47.22]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id EC5A33F5A1; Thu, 25 Jan 2024 07:19:09 -0800 (PST) From: "PierreGondois" To: devel@edk2.groups.io Cc: Sami Mujawar , Leif Lindholm , Ard Biesheuvel , Pierre Gondois Subject: [edk2-devel] [PATCH v5 01/11] ArmPkg/ArmScmiDxe: Rename PERFORMANCE_PROTOCOL_VERSION Date: Thu, 25 Jan 2024 16:18:40 +0100 Message-Id: <20240125151850.620749-2-pierre.gondois@arm.com> In-Reply-To: <20240125151850.620749-1-pierre.gondois@arm.com> References: <20240125151850.620749-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: Rm2moUeWdbpmBSR4uGHBU75Qx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1706195954845100007 Content-Type: text/plain; charset="utf-8" Rename PERFORMANCE_PROTOCOL_VERSION to reflect the different versions of the protocol. The macro is neither used in edk2 nor in edk2-platforms. Reviewed-by: Leif Lindholm Reviewed-by: Sami Mujawar Signed-off-by: Pierre Gondois Acked-by: Ard Biesheuvel --- .../Include/Protocol/ArmScmiPerformanceProtocol.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/ArmPkg/Include/Protocol/ArmScmiPerformanceProtocol.h b/ArmPkg/= Include/Protocol/ArmScmiPerformanceProtocol.h index 7e548e4765c2..a28f0f766e37 100644 --- a/ArmPkg/Include/Protocol/ArmScmiPerformanceProtocol.h +++ b/ArmPkg/Include/Protocol/ArmScmiPerformanceProtocol.h @@ -1,12 +1,12 @@ /** @file =20 - Copyright (c) 2017-2021, Arm Limited. All rights reserved. + Copyright (c) 2017-2023, Arm Limited. All rights reserved. =20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 - System Control and Management Interface V1.0 - http://infocenter.arm.com/help/topic/com.arm.doc.den0056a/ - DEN0056A_System_Control_and_Management_Interface.pdf + System Control and Management Interface V3.2, latest version at: + - https://developer.arm.com/documentation/den0056/latest/ + **/ =20 #ifndef ARM_SCMI_PERFORMANCE_PROTOCOL_H_ @@ -14,7 +14,10 @@ =20 #include =20 -#define PERFORMANCE_PROTOCOL_VERSION 0x10000 +/// Arm Scmi performance protocol versions. +#define PERFORMANCE_PROTOCOL_VERSION_V1 0x10000 +#define PERFORMANCE_PROTOCOL_VERSION_V2 0x20000 +#define PERFORMANCE_PROTOCOL_VERSION_V3 0x30000 =20 #define ARM_SCMI_PERFORMANCE_PROTOCOL_GUID { \ 0x9b8ba84, 0x3dd3, 0x49a6, {0xa0, 0x5a, 0x31, 0x34, 0xa5, 0xf0, 0x7b, 0x= ad} \ --=20 2.25.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#114411): https://edk2.groups.io/g/devel/message/114411 Mute This Topic: https://groups.io/mt/103955492/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Dec 27 02:42:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+114412+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+114412+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1706195954; cv=none; d=zohomail.com; s=zohoarc; b=F0i1LWqrsWwcXYUDON1nUWpij5Tz/RjzHYsvNiDJmWbmAuSViSR4ARaI0nuazb9jIq+o8EsoKSPD+zMzO4593C8ySxsIUXAYuqdZP6PkdbZIJlZVfVq+zYx9itiFRB9SNo9PgvPFrO6OiTfs/UJ0RQL7uwdScEcknOTwkEOzqqk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706195954; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=InDE+ygQUDl0393j83foEKvuuWtqVW1VxmglqPU1cCk=; b=ShScrYATIGPqGPPrskbVgbAT6J9a9vUzjB972QpeARWXn3sPFavSxPytvo276nUQRGdX4mHgkGv2wdAjYlWhnhPKxa/fqjkvf8ZjFbGtuODr2lV2Q/c8Do2Mph6WOrYl+1CJMM0pHgtfdwYmcIwenMT0tA6Ix45K3bssmpQbNcg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+114412+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1706195954394975.7233602079418; Thu, 25 Jan 2024 07:19:14 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=TUYt2NF7kbZhzW0frp5ahjTCCtk+Oc+CYAy5T+167w0=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: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=1706195954; v=1; b=BZmiFB/t8/rT5XNHwx5fx6zDcv1Abm1L735imEPy0rtThkoAGAkI9fMGXalQIU0Elu96JWBf DG/fbBnc2lQq7tkZd0teGbx7mZfQcgyIGspGHepYBD9X+4XWGhI8ENAT99BMmJcJYK15Mmn5W0L afg5FGtI9Hca20lLg/GYrXV8= X-Received: by 127.0.0.2 with SMTP id hXYBYY1788612xQ2nHGoZowc; Thu, 25 Jan 2024 07:19:14 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.20296.1706195953481782712 for ; Thu, 25 Jan 2024 07:19:13 -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 A233E1476; Thu, 25 Jan 2024 07:19:57 -0800 (PST) X-Received: from e126645.arm.com (unknown [10.57.47.22]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id C54AF3F5A1; Thu, 25 Jan 2024 07:19:11 -0800 (PST) From: "PierreGondois" To: devel@edk2.groups.io Cc: Sami Mujawar , Leif Lindholm , Ard Biesheuvel , Pierre Gondois Subject: [edk2-devel] [PATCH v5 02/11] ArmPkg/ArmScmiDxe: Add PERFORMANCE_DESCRIBE_FASTCHANNEL support Date: Thu, 25 Jan 2024 16:18:41 +0100 Message-Id: <20240125151850.620749-3-pierre.gondois@arm.com> In-Reply-To: <20240125151850.620749-1-pierre.gondois@arm.com> References: <20240125151850.620749-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: HHJUIoOFmrgGzL3X1HiYdnc1x1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1706195954878100008 Content-Type: text/plain; charset="utf-8" The PERFORMANCE_DESCRIBE_FASTCHANNEL Scmi command is available since SCMI v2.0 and allows to query information about the supported fast-channels of the Scmi performance protocol. Add support for this command. Also move SCMI_MESSAGE_ID_PERFORMANCE enum definition up in the file to use it in SCMI_PERFORMANCE_DESCRIBE_FASTCHANNEL function declaration. Reviewed-by: Leif Lindholm Reviewed-by: Sami Mujawar Signed-off-by: Pierre Gondois Acked-by: Ard Biesheuvel --- .../ArmScmiDxe/ScmiPerformanceProtocol.c | 80 +++++++++++++++-- .../Protocol/ArmScmiPerformanceProtocol.h | 88 +++++++++++++++++-- 2 files changed, 154 insertions(+), 14 deletions(-) diff --git a/ArmPkg/Drivers/ArmScmiDxe/ScmiPerformanceProtocol.c b/ArmPkg/D= rivers/ArmScmiDxe/ScmiPerformanceProtocol.c index 0f89808fbdf9..91efce4bf22d 100644 --- a/ArmPkg/Drivers/ArmScmiDxe/ScmiPerformanceProtocol.c +++ b/ArmPkg/Drivers/ArmScmiDxe/ScmiPerformanceProtocol.c @@ -1,12 +1,12 @@ /** @file =20 - Copyright (c) 2017-2021, Arm Limited. All rights reserved.
+ Copyright (c) 2017-2023, Arm Limited. All rights reserved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 - System Control and Management Interface V1.0 - http://infocenter.arm.com/help/topic/com.arm.doc.den0056a/ - DEN0056A_System_Control_and_Management_Interface.pdf + System Control and Management Interface V3.2, latest version at: + - https://developer.arm.com/documentation/den0056/latest/ + **/ =20 #include @@ -416,6 +416,75 @@ PerformanceLevelGet ( return EFI_SUCCESS; } =20 +/** Discover the attributes of the FastChannel for the specified + performance domain and the specified message. + + @param[in] This A Pointer to SCMI_PERFORMANCE_PROTOCOL Instance. + @param[in] DomainId Identifier for the performance domain. + @param[in] MessageId Message Id of the FastChannel to discover. + Must be one of: + - PERFORMANCE_LIMITS_SET + - PERFORMANCE_LIMITS_GET + - PERFORMANCE_LEVEL_SET + - PERFORMANCE_LEVEL_GET + @param[out] FastChannel If success, contains the FastChannel description. + + @retval EFI_SUCCESS Performance level got successfully. + @retval EFI_DEVICE_ERROR SCP returns an SCMI error. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_TIMEOUT Time out. + @retval EFI_UNSUPPORTED Unsupported. +**/ +EFI_STATUS +DescribeFastchannel ( + IN SCMI_PERFORMANCE_PROTOCOL *This, + IN UINT32 DomainId, + IN SCMI_MESSAGE_ID_PERFORMANCE MessageId, + OUT SCMI_PERFORMANCE_FASTCHANNEL *FastChannel + ) +{ + EFI_STATUS Status; + SCMI_COMMAND Cmd; + UINT32 PayloadLength; + UINT32 *ReturnValues; + UINT32 *MessageParams; + + if ((This =3D=3D NULL) || + (FastChannel =3D=3D NULL)) + { + return EFI_INVALID_PARAMETER; + } + + Status =3D ScmiCommandGetPayload (&MessageParams); + if (EFI_ERROR (Status)) { + return Status; + } + + *MessageParams++ =3D DomainId; + *MessageParams =3D MessageId; + + Cmd.ProtocolId =3D ScmiProtocolIdPerformance; + Cmd.MessageId =3D ScmiMessageIdPerformanceDescribeFastchannel; + PayloadLength =3D sizeof (DomainId) + sizeof (MessageId); + + Status =3D ScmiCommandExecute ( + &Cmd, + &PayloadLength, + &ReturnValues + ); + if (EFI_ERROR (Status)) { + return Status; + } + + CopyMem ( + FastChannel, + ReturnValues, + sizeof (SCMI_PERFORMANCE_FASTCHANNEL) + ); + + return Status; +} + // Instance of the SCMI performance management protocol. STATIC CONST SCMI_PERFORMANCE_PROTOCOL PerformanceProtocol =3D { PerformanceGetVersion, @@ -425,7 +494,8 @@ STATIC CONST SCMI_PERFORMANCE_PROTOCOL PerformanceProt= ocol =3D { PerformanceLimitsSet, PerformanceLimitsGet, PerformanceLevelSet, - PerformanceLevelGet + PerformanceLevelGet, + DescribeFastchannel, }; =20 /** Initialize performance management protocol and install on a given Hand= le. diff --git a/ArmPkg/Include/Protocol/ArmScmiPerformanceProtocol.h b/ArmPkg/= Include/Protocol/ArmScmiPerformanceProtocol.h index a28f0f766e37..c69efe7408e1 100644 --- a/ArmPkg/Include/Protocol/ArmScmiPerformanceProtocol.h +++ b/ArmPkg/Include/Protocol/ArmScmiPerformanceProtocol.h @@ -79,8 +79,58 @@ typedef struct { UINT32 RangeMin; } SCMI_PERFORMANCE_LIMITS; =20 +/// Doorbell Support bit. +#define SCMI_PERF_FC_ATTRIB_HAS_DOORBELL BIT0 + +/// Performance protocol describe fastchannel +typedef struct { + /// Attributes. + UINT32 Attributes; + + /// Rate limit. + UINT32 RateLimit; + + /// Lower 32 bits of the FastChannel address. + UINT32 ChanAddrLow; + + /// Higher 32 bits of the FastChannel address. + UINT32 ChanAddrHigh; + + /// Size of the FastChannel in bytes. + UINT32 ChanSize; + + /// Lower 32 bits of the doorbell address. + UINT32 DoorbellAddrLow; + + /// Higher 32 bits of the doorbell address. + UINT32 DoorbellAddrHigh; + + /// Mask of lower 32 bits to set when writing to the doorbell register. + UINT32 DoorbellSetMaskLow; + + /// Mask of higher 32 bits to set when writing to the doorbell register. + UINT32 DoorbellSetMaskHigh; + + /// Mask of lower 32 bits to preserve when writing to the doorbell regis= ter. + UINT32 DoorbellPreserveMaskLow; + + /// Mask of higher 32 bits to preserve when writing to the doorbell regi= ster. + UINT32 DoorbellPreserveMaskHigh; +} SCMI_PERFORMANCE_FASTCHANNEL; + #pragma pack() =20 +/// SCMI Message Ids for the Performance Protocol. +typedef enum { + ScmiMessageIdPerformanceDomainAttributes =3D 0x3, + ScmiMessageIdPerformanceDescribeLevels =3D 0x4, + ScmiMessageIdPerformanceLimitsSet =3D 0x5, + ScmiMessageIdPerformanceLimitsGet =3D 0x6, + ScmiMessageIdPerformanceLevelSet =3D 0x7, + ScmiMessageIdPerformanceLevelGet =3D 0x8, + ScmiMessageIdPerformanceDescribeFastchannel =3D 0xB, +} SCMI_MESSAGE_ID_PERFORMANCE; + /** Return version of the performance management protocol supported by SCP. firmware. =20 @@ -238,6 +288,34 @@ EFI_STATUS OUT UINT32 *Level ); =20 +/** Discover the attributes of the FastChannel for the specified + performance domain and the specified message. + + @param[in] This A Pointer to SCMI_PERFORMANCE_PROTOCOL Instance. + @param[in] DomainId Identifier for the performance domain. + @param[in] MessageId Message Id of the FastChannel to discover. + Must be one of: + - PERFORMANCE_LIMITS_SET + - PERFORMANCE_LIMITS_GET + - PERFORMANCE_LEVEL_SET + - PERFORMANCE_LEVEL_GET + @param[out] FastChannel If success, contains the FastChannel description. + + @retval EFI_SUCCESS Performance level got successfully. + @retval EFI_DEVICE_ERROR SCP returns an SCMI error. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_TIMEOUT Time out. + @retval EFI_UNSUPPORTED Unsupported. +**/ +typedef +EFI_STATUS +(EFIAPI *SCMI_PERFORMANCE_DESCRIBE_FASTCHANNEL)( + IN SCMI_PERFORMANCE_PROTOCOL *This, + IN UINT32 DomainId, + IN SCMI_MESSAGE_ID_PERFORMANCE MessageId, + OUT SCMI_PERFORMANCE_FASTCHANNEL *FastChannel + ); + typedef struct _SCMI_PERFORMANCE_PROTOCOL { SCMI_PERFORMANCE_GET_VERSION GetVersion; SCMI_PERFORMANCE_GET_ATTRIBUTES GetProtocolAttributes; @@ -247,15 +325,7 @@ typedef struct _SCMI_PERFORMANCE_PROTOCOL { SCMI_PERFORMANCE_LIMITS_GET LimitsGet; SCMI_PERFORMANCE_LEVEL_SET LevelSet; SCMI_PERFORMANCE_LEVEL_GET LevelGet; + SCMI_PERFORMANCE_DESCRIBE_FASTCHANNEL DescribeFastchannel; } SCMI_PERFORMANCE_PROTOCOL; =20 -typedef enum { - ScmiMessageIdPerformanceDomainAttributes =3D 0x3, - ScmiMessageIdPerformanceDescribeLevels =3D 0x4, - ScmiMessageIdPerformanceLimitsSet =3D 0x5, - ScmiMessageIdPerformanceLimitsGet =3D 0x6, - ScmiMessageIdPerformanceLevelSet =3D 0x7, - ScmiMessageIdPerformanceLevelGet =3D 0x8, -} SCMI_MESSAGE_ID_PERFORMANCE; - #endif /* ARM_SCMI_PERFORMANCE_PROTOCOL_H_ */ --=20 2.25.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#114412): https://edk2.groups.io/g/devel/message/114412 Mute This Topic: https://groups.io/mt/103955494/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Dec 27 02:42:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+114413+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+114413+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1706195956; cv=none; d=zohomail.com; s=zohoarc; b=CwxF8av+qSktW73pUlbd2GfhiJCgvfP3hUCAt0/q1LV82kagmn885UOCUawc0ev/a5ApLKSsBLSB7kBV9orrj8q4hKpovBMzGugh9nP/upyL7dbzCvuiG2zNZ11AMm4XFhkSYLupRN5kTfjQVQWBQbC0okrGaMSBsY8aJ76qVW0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706195956; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=+0jecTBa8Akl5AGWCk46378IWtyVYgtg8hKb3l5m4F8=; b=BrBpqDNj4mXbnjgSNjmMp4ejZRyG149iF+PpOod7RQxlUaiuob2aWQO/sEjogOlxN6KvaJVsL9oqkPNGoWTn0soew/LGfDGnQw8mjR5R/XVbRMQyOfIiaJCjI+opAf/0SVrJMZz6FmaY3VBD5dziV20Cy2MX1+pL5mAh/SYWpbM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+114413+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1706195956156490.91458115325895; Thu, 25 Jan 2024 07:19:16 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=rh4++l08e4zPpF/ahMH7lPdlMEWHDrFl+t1t+s6T2Us=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: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=1706195955; v=1; b=HvPJNVB26L3KwYBiy1ObXUyXtIJAEtyCSHB/qGLE8ubp9heXiXag0NdHTghTmKpngUYwc3j0 sN7qXxHHImuEBZFuKChyk758fZ8aoG4yVgflgqAZpsUiis4sz7OrJzo/NFgd8t4ezu/I75TV7r/ XEdgdGGx5T1y9aX9NMpkpXes= X-Received: by 127.0.0.2 with SMTP id QX96YY1788612xWz10JIWelq; Thu, 25 Jan 2024 07:19:15 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.20294.1706195955257560449 for ; Thu, 25 Jan 2024 07:19:15 -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 6AD8D1FB; Thu, 25 Jan 2024 07:19:59 -0800 (PST) X-Received: from e126645.arm.com (unknown [10.57.47.22]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 860DC3F5A1; Thu, 25 Jan 2024 07:19:13 -0800 (PST) From: "PierreGondois" To: devel@edk2.groups.io Cc: Sami Mujawar , Leif Lindholm , Ard Biesheuvel , Pierre Gondois Subject: [edk2-devel] [PATCH v5 03/11] DynamicTablesPkg: Use new CPC revision macro Date: Thu, 25 Jan 2024 16:18:42 +0100 Message-Id: <20240125151850.620749-4-pierre.gondois@arm.com> In-Reply-To: <20240125151850.620749-1-pierre.gondois@arm.com> References: <20240125151850.620749-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: FeYy7bv3rRSwThkMLtQK85w5x1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1706195956630100013 Content-Type: text/plain; charset="utf-8" Make use of the newly added CPC revision macro. Reviewed-by: Sami Mujawar Signed-off-by: Pierre Gondois Acked-by: Ard Biesheuvel --- DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c b/= DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c index d4e3e252cbe6..949aee2f6961 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c @@ -3524,7 +3524,7 @@ AmlCreateCpcNode ( } =20 // Revision 3 per ACPI 6.4 specification - if (CpcInfo->Revision =3D=3D 3) { + if (CpcInfo->Revision =3D=3D EFI_ACPI_6_5_AML_CPC_REVISION) { // NumEntries 23 per ACPI 6.4 specification NumberOfEntries =3D 23; } else { --=20 2.25.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#114413): https://edk2.groups.io/g/devel/message/114413 Mute This Topic: https://groups.io/mt/103955495/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Dec 27 02:42:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+114414+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+114414+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1706195958; cv=none; d=zohomail.com; s=zohoarc; b=TDkwryesJyHO2VpAGtO2DdjhiCy7BMvGbRkSeZLGC8ybzAHmvnBXuZgQ6mc4AHXzNWBp7IZ0gGlzydxD/sNb2xexJFBEk36GxQHEy87z81/e1LYwgtMQFKhYJKntuNtfbl8aVlhzCPee/iHcyznCHEAcJLh/g3jeXscQ//KsJFo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706195958; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=xHwHW0j3gB1VIxlMgd5yfaqEUk+3mP3mI5PMGFJMgOU=; b=EqPN/E0btrV23r3s6vQ53pJEP1Uld1z1jx1s/r1n3ZFa5sC5NbfdVki8VuVV1fR3Eyeoi6FedlDhz8lfKt8wuUyrO4aoHjtQ3RDSjbA7wjI3EAxfevb7gSfr5hNj55Xndm/Sm9DW10qo7X9cBf2YzUn9d2eJExAkcj5GUMYXqZc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+114414+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 170619595880672.56105383635293; Thu, 25 Jan 2024 07:19:18 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=t6J52oqCTWOSvXVvR8E5DdAXev7s10N6zZIelrNrjIQ=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: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=1706195958; v=1; b=TpHbHEjNNE4n2ow+Xu3Ay6rE1/UGxunDFNZmtXf6tx39BiE+aBsExEak+p9kGt7fBRmDwvEo 5KXhTCWCZ/Mrzsy7KhCuY1Fiqgrks+pEsjcnB0piN079UakOUbPnZxaJVAr8CUreeoMgGY+awQ9 JVGIi/RiUojPPCazySHs1AGY= X-Received: by 127.0.0.2 with SMTP id VQZOYY1788612x1xDQJF9cUt; Thu, 25 Jan 2024 07:19:18 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.20296.1706195957322846465 for ; Thu, 25 Jan 2024 07:19:17 -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 7C9601FB; Thu, 25 Jan 2024 07:20:01 -0800 (PST) X-Received: from e126645.arm.com (unknown [10.57.47.22]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 5FBB43F5A1; Thu, 25 Jan 2024 07:19:15 -0800 (PST) From: "PierreGondois" To: devel@edk2.groups.io Cc: Sami Mujawar , Leif Lindholm , Ard Biesheuvel , Pierre Gondois Subject: [edk2-devel] [PATCH v5 04/11] DynamicTablesPkg: Rename AmlCpcInfo.h to AcpiObjects.h Date: Thu, 25 Jan 2024 16:18:43 +0100 Message-Id: <20240125151850.620749-5-pierre.gondois@arm.com> In-Reply-To: <20240125151850.620749-1-pierre.gondois@arm.com> References: <20240125151850.620749-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: esVNlhEIqHwH7HqIlAa1mkWex1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1706195960680100003 Content-Type: text/plain; charset="utf-8" The DynamicTables framework uses the AmlLib to generate some Aml objects. It is done by using structured known by both frameworks, e.g. the AML_CPC_INFO/CM_ARM_CPC_INFO structures. To prepare adding similar structures (e.g. representing _PSD information), rename AmlCpcInfo.h to AcpiObjects.h. This new file will contain all the structures used by the AmlLib and the DynamicTables framework. Reviewed-by: Sami Mujawar Signed-off-by: Pierre Gondois Acked-by: Ard Biesheuvel --- DynamicTablesPkg/Include/{AmlCpcInfo.h =3D> AcpiObjects.h} | 0 DynamicTablesPkg/Include/ArmNameSpaceObjects.h | 2 +- DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h | 2 +- DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) rename DynamicTablesPkg/Include/{AmlCpcInfo.h =3D> AcpiObjects.h} (100%) diff --git a/DynamicTablesPkg/Include/AmlCpcInfo.h b/DynamicTablesPkg/Inclu= de/AcpiObjects.h similarity index 100% rename from DynamicTablesPkg/Include/AmlCpcInfo.h rename to DynamicTablesPkg/Include/AcpiObjects.h diff --git a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h b/DynamicTables= Pkg/Include/ArmNameSpaceObjects.h index 8c00bdac20bb..453cc3fe83fa 100644 --- a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h +++ b/DynamicTablesPkg/Include/ArmNameSpaceObjects.h @@ -13,7 +13,7 @@ #ifndef ARM_NAMESPACE_OBJECTS_H_ #define ARM_NAMESPACE_OBJECTS_H_ =20 -#include +#include #include =20 #pragma pack(1) diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h b/DynamicTabl= esPkg/Include/Library/AmlLib/AmlLib.h index 043ec3d8428f..01e37b089897 100644 --- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h +++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h @@ -37,7 +37,7 @@ @} */ =20 -#include +#include #include =20 #ifndef AML_HANDLE diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c b/= DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c index 949aee2f6961..9040192f8c3c 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c @@ -12,7 +12,7 @@ #include =20 #include -#include +#include #include #include #include --=20 2.25.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#114414): https://edk2.groups.io/g/devel/message/114414 Mute This Topic: https://groups.io/mt/103955498/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Dec 27 02:42:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+114415+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+114415+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1706195960; cv=none; d=zohomail.com; s=zohoarc; b=KV6a+iLnCRPqe6IoctYMbDmfoFC5E/5jBhXMYl1fFPdBUi0CqYsLDQAfdraSCl/E8qgiohfOEMdxByBPktbNXYKHgInqzSN2N+qKEJmtkclKLkHeyfCCTnPsII2WnpY+8pea1zFt/YGo5JH52bRyQA8U1zMePmzCRuG4OcKa3W8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706195960; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=gQm/SipAHQUYj9G0qCbUMccDNCtYQP9+6PYou6++564=; b=KmJY8bApjk4JMX3hvQYwg5lVuOhwBMiNPS/UT5tlJtH4pl4RSamSraMUkGA+Jt/COO9vG4yUBmf996GFXwG0PGmM9vkF4rRy2lu3uW7stMJ3yo+o2vRaU29rhQMLHxdSy7hrqWn0wHJONJD2c3xJPwKU2aR2zP3uoF/vU5OmTlo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+114415+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 170619596000145.0913971555284; Thu, 25 Jan 2024 07:19:20 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=HX5LRm7zwUtmmNn4E/Ec7TXixJ5IMZanZMJpstGZAl4=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: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=1706195959; v=1; b=wMy7hsfxOB3J+FlsQSxP93G0doygSHjMfF60QaDXjO0U8iuAISZCNbKDxvmalS1f5x1ESg63 Y8/1RofrdDDouhEagavDZrvrByVvE9QkSx6MqpxptCOFgsAsvaHCxZxDIk4y7laAwiZRAsCxDqb aPRtPsZd9u97PtRZoUsp9lcY= X-Received: by 127.0.0.2 with SMTP id KJDKYY1788612x9dOn1m69vH; Thu, 25 Jan 2024 07:19:19 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.20299.1706195959008295862 for ; Thu, 25 Jan 2024 07:19:19 -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 24B68FEC; Thu, 25 Jan 2024 07:20:03 -0800 (PST) X-Received: from e126645.arm.com (unknown [10.57.47.22]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 5BEDC3F5A1; Thu, 25 Jan 2024 07:19:17 -0800 (PST) From: "PierreGondois" To: devel@edk2.groups.io Cc: Sami Mujawar , Leif Lindholm , Ard Biesheuvel , Pierre Gondois Subject: [edk2-devel] [PATCH v5 05/11] DynamicTablesPkg: Add CM_ARM_PSD_INFO object Date: Thu, 25 Jan 2024 16:18:44 +0100 Message-Id: <20240125151850.620749-6-pierre.gondois@arm.com> In-Reply-To: <20240125151850.620749-1-pierre.gondois@arm.com> References: <20240125151850.620749-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: PjT19Q6rQZcCmEL3wTsPzTrex1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1706195960689100004 Content-Type: text/plain; charset="utf-8" Add an object describing _PSD information, cf. ACPI 6.5, s8.4.5.5 _PSD (P-State Dependency). Also add the corresponding CmObjParser. Signed-off-by: Pierre Gondois Acked-by: Ard Biesheuvel Reviewed-by: Sami Mujawar --- DynamicTablesPkg/Include/AcpiObjects.h | 20 +++++++++++++++++++ .../Include/ArmNameSpaceObjects.h | 10 ++++++++++ .../ConfigurationManagerObjectParser.c | 11 ++++++++++ 3 files changed, 41 insertions(+) diff --git a/DynamicTablesPkg/Include/AcpiObjects.h b/DynamicTablesPkg/Incl= ude/AcpiObjects.h index 8981c229544a..2bdabb2724bd 100644 --- a/DynamicTablesPkg/Include/AcpiObjects.h +++ b/DynamicTablesPkg/Include/AcpiObjects.h @@ -1,6 +1,7 @@ /** @file =20 Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved= .
+ Copyright (c) 2022 - 2023, Arm Limited. All rights reserved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -119,6 +120,25 @@ typedef struct AmlCpcInfo { UINT32 NominalFrequencyInteger; } AML_CPC_INFO; =20 +/** A structure that describes a + P-State Dependency (PSD) Info. + + Cf. ACPI 6.5, s8.4.5.5 _PSD (P-State Dependency). +*/ +typedef struct AmlPsdInfo { + /// Revision. + UINT8 Revision; + + /// Domain Id. + UINT32 Domain; + + /// Coordination type. + UINT32 CoordType; + + /// Number of processors belonging to the Domain. + UINT32 NumProc; +} AML_PSD_INFO; + #pragma pack() =20 #endif //AML_CPC_INFO_H_ diff --git a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h b/DynamicTables= Pkg/Include/ArmNameSpaceObjects.h index 453cc3fe83fa..3748cb7c8085 100644 --- a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h +++ b/DynamicTablesPkg/Include/ArmNameSpaceObjects.h @@ -72,6 +72,7 @@ typedef enum ArmObjectID { EArmObjPccSubspaceType4Info, ///< 47 - P= cc Subspace Type 4 Info EArmObjPccSubspaceType5Info, ///< 48 - P= cc Subspace Type 5 Info EArmObjEtInfo, ///< 49 - E= mbedded Trace Extension/Module Info + EArmObjPsdInfo, ///< 50 - P= -State Dependency (PSD) Info EArmObjMax } EARM_OBJECT_ID; =20 @@ -1327,6 +1328,15 @@ typedef struct CmArmEtInfo { ARM_ET_TYPE EtType; } CM_ARM_ET_INFO; =20 +/** A structure that describes a + P-State Dependency (PSD) Info. + + Cf. ACPI 6.5, s8.4.5.5 _PSD (P-State Dependency). + + ID: EArmObjPsdInfo +*/ +typedef AML_PSD_INFO CM_ARM_PSD_INFO; + #pragma pack() =20 #endif // ARM_NAMESPACE_OBJECTS_H_ diff --git a/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationMa= nagerObjectParser.c b/DynamicTablesPkg/Library/Common/TableHelperLib/Config= urationManagerObjectParser.c index c1a752841943..dc60a75eabb1 100644 --- a/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerOb= jectParser.c +++ b/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerOb= jectParser.c @@ -669,6 +669,15 @@ STATIC CONST CM_OBJ_PARSER CmArmEtInfo[] =3D { { "EtType", sizeof (ARM_ET_TYPE), "0x%x", NULL } }; =20 +/** A parser for EArmObjPsdInfo. +*/ +STATIC CONST CM_OBJ_PARSER CmArmPsdInfoParser[] =3D { + { "Revision", 1, "0x%x", NULL }, + { "DomainId", 4, "0x%x", NULL }, + { "CoordType", 4, "0x%x", NULL }, + { "NumProc", 4, "0x%x", NULL }, +}; + /** A parser for Arm namespace objects. */ STATIC CONST CM_OBJ_PARSER_ARRAY ArmNamespaceObjectParser[] =3D { @@ -767,6 +776,8 @@ STATIC CONST CM_OBJ_PARSER_ARRAY ArmNamespaceObjectPar= ser[] =3D { ARRAY_SIZE (CmArmPccSubspaceType5InfoParser) }, { "EArmObjEtInfo", CmArmEtInfo, ARRAY_SIZE (CmArmEtInfo) }, + { "EArmObjPsdInfo", CmArmPsdInfoParser, + ARRAY_SIZE (CmArmPsdInfoParser) }, { "EArmObjMax", NULL, = 0 }, }; =20 --=20 2.25.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#114415): https://edk2.groups.io/g/devel/message/114415 Mute This Topic: https://groups.io/mt/103955499/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Dec 27 02:42:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+114416+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+114416+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1706195961; cv=none; d=zohomail.com; s=zohoarc; b=E3n7NHnCOQk2Z5nPqSD96IowJzr4OllwEhj27MYFgkkzyxW7+5jx/QWGdjVXwPoGdBcX4cgG4IuvWEA2vFsASfQ4tCOHxbZoFAcF1DshPlAQVr6N0wXsB97Fe2jW3qkvrLjal7/BCZ/+UzXzWUySwIQ1gRh14cXuDxy47b/T9Do= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706195961; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=AJ/N+A3i2QvzCyyVO6WuLzv05VXx9OUBLk9vXuOoQVE=; b=asUfim9YbwcCjMLKeOkOSnbf0m2NbYrDw6VSzNhETnjmVVcDhYDyiFvTLxU9Wl49et9KfjhUB+OUU/zm2hxhgDV591qu93VjHZho8Fwoa4JqXt/7Lvm+ue333WN44BPOT1ocXZG2XotAL0WbgWK9ZhoImgUYVXbsCKsfqBZhR/8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+114416+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1706195961576760.0268036611623; Thu, 25 Jan 2024 07:19:21 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=oCCxQTtXoGBNFEljsJiyuJ+u9vX2RZ22gwhTi4m6CFk=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: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=1706195961; v=1; b=ezzDRMkZDhGmrFXiC3YjcVOwK0j9cBa4lb1P5ODa+JHmBev4JyRSRctnyascrfpMS+l2+Wlt h/JqfuPdBG29eLPfegcxwUiE6lz5i0hqPgniLSWOwFNWYSSfl1YTLidDlR6X7HkB5DXYqdohTrQ NuD40l8/8Waw9oMKLys+TgEE= X-Received: by 127.0.0.2 with SMTP id cR8IYY1788612xPE3XTW3GNZ; Thu, 25 Jan 2024 07:19:21 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.20306.1706195960669343881 for ; Thu, 25 Jan 2024 07:19:20 -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 CC3741FB; Thu, 25 Jan 2024 07:20:04 -0800 (PST) X-Received: from e126645.arm.com (unknown [10.57.47.22]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 133503F5A1; Thu, 25 Jan 2024 07:19:18 -0800 (PST) From: "PierreGondois" To: devel@edk2.groups.io Cc: Sami Mujawar , Leif Lindholm , Ard Biesheuvel , Pierre Gondois Subject: [edk2-devel] [PATCH v5 06/11] DynamicTablesPkg: Add PsdToken field to CM_ARM_GICC_INFO object Date: Thu, 25 Jan 2024 16:18:45 +0100 Message-Id: <20240125151850.620749-7-pierre.gondois@arm.com> In-Reply-To: <20240125151850.620749-1-pierre.gondois@arm.com> References: <20240125151850.620749-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: AgVMkxCPaPMFeiQMPvql8HWbx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1706195962661100011 Content-Type: text/plain; charset="utf-8" The _PSD object (cf. ACPI 6.5, s8.4.5.5 _PSD (P-State Dependency) allows to describe CPU's power state dependencies. Add a PsdToken field to the CM_ARM_GICC_INFO object so that interdependent CPUs can reference the same CM_ARM_PSD_INFO object. Reviewed-by: Sami Mujawar Signed-off-by: Pierre Gondois Acked-by: Ard Biesheuvel --- DynamicTablesPkg/Include/ArmNameSpaceObjects.h | 5 +++++ .../Common/TableHelperLib/ConfigurationManagerObjectParser.c | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h b/DynamicTables= Pkg/Include/ArmNameSpaceObjects.h index 3748cb7c8085..3805c5824773 100644 --- a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h +++ b/DynamicTablesPkg/Include/ArmNameSpaceObjects.h @@ -218,6 +218,11 @@ typedef struct CmArmGicCInfo { i.e. a token referencing a CM_ARM_ET_INFO object. */ CM_OBJECT_TOKEN EtToken; + + /** Optional field: Reference Token for the Psd info of this processor. + i.e. a token referencing a CM_ARM_PSD_INFO object. + */ + CM_OBJECT_TOKEN PsdToken; } CM_ARM_GICC_INFO; =20 /** A structure that describes the diff --git a/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationMa= nagerObjectParser.c b/DynamicTablesPkg/Library/Common/TableHelperLib/Config= urationManagerObjectParser.c index dc60a75eabb1..69b6eba23cf4 100644 --- a/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerOb= jectParser.c +++ b/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerOb= jectParser.c @@ -85,7 +85,8 @@ STATIC CONST CM_OBJ_PARSER CmArmGicCInfoParser[] =3D { { "AffinityFlags", 4, "0x%x", N= ULL }, { "CpcToken", sizeof (CM_OBJECT_TOKEN), "0x%p", N= ULL }, { "TRBEInterrupt", 2, "0x%x", N= ULL }, - { "EtToken", sizeof (CM_OBJECT_TOKEN), "0x%p", N= ULL } + { "EtToken", sizeof (CM_OBJECT_TOKEN), "0x%p", N= ULL }, + { "PsdToken", sizeof (CM_OBJECT_TOKEN), "0x%p", N= ULL }, }; =20 /** A parser for EArmObjGicDInfo. --=20 2.25.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#114416): https://edk2.groups.io/g/devel/message/114416 Mute This Topic: https://groups.io/mt/103955503/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Dec 27 02:42:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+114417+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+114417+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1706195962; cv=none; d=zohomail.com; s=zohoarc; b=avaCaN9QZ9XrzoDUJA/fn9Oq2lwjFKLsMfJjnkPqVjO5zzHmxKdWOt9Ikt4yQSMdMVCvoD7U89Y57v/Xm98OdcoyM+xVB/z68VYnMRZMrDuHq5dY0dZurydJmL28WlgYeZL5Qi/SO1ccl5uPpzJfi2WVPCD9T5q1ifNHRzfc/1g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706195962; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=jhwGLJWLHMZeREgC+iLlYFqUPzYv1zADR1mMC+85tWI=; b=cbRPo6qKFki5bUu2akDQ85Iy2Fc8CmhhHkLJDPVRv/zDtSGqq3pm3Y/ls2jaUPsbAuYEZVM68dUWgnm/rGABAIj3IC7bKi5T/GfdFq+rt6b6SuedBLgvD0XcLQPw8FFJ9XDwSW5OnrC4QDWqUjzGM/LCYNmO0hTvXGdDyWAoGrE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+114417+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1706195962826331.02452419595977; Thu, 25 Jan 2024 07:19:22 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=Hp5gBAHYcrT/d6UgG2hkJ+eecPBS5EhkbTNunVs8VqQ=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: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=1706195962; v=1; b=FMeL16w8fRVucFziYTkERnMIg/GSMKQMRg0BSQNFJ6ni3ECGy9rmE9k2ZO63kdP2YLhmwQi6 86dr73R6hRqX8Hv9sq9AdO/pi6zE9bGITx/HFIPyLRf0jOwoBKoRlI50hiB77E9VilQ9gb29foD FXBPvc9zwl+sR24uyWcZ7v5Q= X-Received: by 127.0.0.2 with SMTP id WoTBYY1788612xgWHSqCD1wQ; Thu, 25 Jan 2024 07:19:22 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.20307.1706195961916139752 for ; Thu, 25 Jan 2024 07:19:22 -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 213961476; Thu, 25 Jan 2024 07:20:06 -0800 (PST) X-Received: from e126645.arm.com (unknown [10.57.47.22]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 9E9763F5A1; Thu, 25 Jan 2024 07:19:20 -0800 (PST) From: "PierreGondois" To: devel@edk2.groups.io Cc: Sami Mujawar , Leif Lindholm , Ard Biesheuvel , Pierre Gondois Subject: [edk2-devel] [PATCH v5 07/11] DynamicTablesPkg: Add AmlCreatePsdNode() to generate _PSD Date: Thu, 25 Jan 2024 16:18:46 +0100 Message-Id: <20240125151850.620749-8-pierre.gondois@arm.com> In-Reply-To: <20240125151850.620749-1-pierre.gondois@arm.com> References: <20240125151850.620749-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: sH6JCQoP6hWYUL8izXME7Qp9x1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1706195964689100015 Content-Type: text/plain; charset="utf-8" Add AmlCreatePsdNode() to the AmlLib to generate _PSD objects. _PSD objects allow to describe 'performance control, P-state or CPPC, logical processor dependency', Cf. ACPI 6.5, s8.4.5.5 _PSD (P-State Dependency). Signed-off-by: Pierre Gondois Acked-by: Ard Biesheuvel Reviewed-by: Sami Mujawar --- .../Include/Library/AmlLib/AmlLib.h | 35 +++- .../Common/AmlLib/CodeGen/AmlCodeGen.c | 188 +++++++++++++++++- 2 files changed, 221 insertions(+), 2 deletions(-) diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h b/DynamicTabl= esPkg/Include/Library/AmlLib/AmlLib.h index 01e37b089897..82d546408418 100644 --- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h +++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h @@ -1,7 +1,7 @@ /** @file AML Lib. =20 - Copyright (c) 2019 - 2021, Arm Limited. All rights reserved.
+ Copyright (c) 2019 - 2023, Arm Limited. All rights reserved.
Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent @@ -1805,4 +1805,37 @@ AmlCodeGenInvokeMethod ( IN AML_NODE_HANDLE ParentNode ); =20 +/** Create a _PSD node. + + Creates and optionally adds the following node + Name(_PSD, Package() + { + NumEntries, // Integer + Revision, // Integer + Domain, // Integer + CoordType, // Integer + NumProc, // Integer + }) + + Cf. ACPI 6.5, s8.4.5.5 _PSD (P-State Dependency) + + @ingroup CodeGenApis + + @param [in] PsdInfo PsdInfo object + @param [in] ParentNode If provided, set ParentNode as the parent + of the node created. + @param [out] NewPsdNode If success and provided, contains the created = node. + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. +**/ +EFI_STATUS +EFIAPI +AmlCreatePsdNode ( + IN AML_PSD_INFO *PsdInfo, + IN AML_NODE_HANDLE ParentNode OPTIONAL, + OUT AML_OBJECT_NODE_HANDLE *NewPsdNode OPTIONAL + ); + #endif // AML_LIB_H_ diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c b/= DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c index 9040192f8c3c..6f3f46e3b1ed 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c @@ -1,7 +1,7 @@ /** @file AML Code Generation. =20 - Copyright (c) 2020 - 2022, Arm Limited. All rights reserved.
+ Copyright (c) 2020 - 2023, Arm Limited. All rights reserved.
Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reser= ved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent @@ -4090,3 +4090,189 @@ exit_handler: FreePool (NodeStream); return Status; } + +/** Create a _PSD node. + + Creates and optionally adds the following node + Name(_PSD, Package() + { + NumEntries, // Integer + Revision, // Integer + Domain, // Integer + CoordType, // Integer + NumProc, // Integer + }) + + Cf. ACPI 6.5, s8.4.5.5 _PSD (P-State Dependency) + + @ingroup CodeGenApis + + @param [in] PsdInfo PsdInfo object + @param [in] ParentNode If provided, set ParentNode as the parent + of the node created. + @param [out] NewPsdNode If success and provided, contains the created = node. + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. +**/ +EFI_STATUS +EFIAPI +AmlCreatePsdNode ( + IN AML_PSD_INFO *PsdInfo, + IN AML_NODE_HANDLE ParentNode OPTIONAL, + OUT AML_OBJECT_NODE_HANDLE *NewPsdNode OPTIONAL + ) +{ + EFI_STATUS Status; + AML_OBJECT_NODE_HANDLE PsdNode; + AML_OBJECT_NODE_HANDLE PsdPackage; + AML_OBJECT_NODE_HANDLE IntegerNode; + UINT32 NumberOfEntries; + + if ((PsdInfo =3D=3D NULL) || + ((ParentNode =3D=3D NULL) && (NewPsdNode =3D=3D NULL))) + { + Status =3D EFI_INVALID_PARAMETER; + ASSERT_EFI_ERROR (Status); + return Status; + } + + // Revision 3 per ACPI 6.5 specification + if (PsdInfo->Revision =3D=3D EFI_ACPI_6_5_AML_PSD_REVISION) { + // NumEntries 5 per ACPI 6.5 specification + NumberOfEntries =3D 5; + } else { + Status =3D EFI_INVALID_PARAMETER; + ASSERT_EFI_ERROR (Status); + return Status; + } + + if (((PsdInfo->CoordType !=3D ACPI_AML_COORD_TYPE_SW_ALL) && + (PsdInfo->CoordType !=3D ACPI_AML_COORD_TYPE_SW_ANY) && + (PsdInfo->CoordType !=3D ACPI_AML_COORD_TYPE_HW_ALL)) || + (PsdInfo->NumProc =3D=3D 0)) + { + Status =3D EFI_INVALID_PARAMETER; + ASSERT_EFI_ERROR (Status); + return Status; + } + + Status =3D AmlCodeGenNamePackage ("_PSD", NULL, &PsdNode); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + return Status; + } + + // Get the Package object node of the _PSD node, + // which is the 2nd fixed argument (i.e. index 1). + PsdPackage =3D (AML_OBJECT_NODE_HANDLE)AmlGetFixedArgument ( + PsdNode, + EAmlParseIndexTerm1 + ); + if ((PsdPackage =3D=3D NULL) = || + (AmlGetNodeType ((AML_NODE_HANDLE)PsdPackage) !=3D EAmlNodeObject) = || + (!AmlNodeHasOpCode (PsdPackage, AML_PACKAGE_OP, 0))) + { + Status =3D EFI_INVALID_PARAMETER; + ASSERT_EFI_ERROR (Status); + goto error_handler; + } + + // NumEntries + Status =3D AmlCodeGenInteger (NumberOfEntries, &IntegerNode); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + goto error_handler; + } + + Status =3D AmlVarListAddTail ( + (AML_NODE_HANDLE)PsdPackage, + (AML_NODE_HANDLE)IntegerNode + ); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + FreePool (IntegerNode); + goto error_handler; + } + + // Revision + Status =3D AmlCodeGenInteger (PsdInfo->Revision, &IntegerNode); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + goto error_handler; + } + + Status =3D AmlVarListAddTail ( + (AML_NODE_HANDLE)PsdPackage, + (AML_NODE_HANDLE)IntegerNode + ); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + FreePool (IntegerNode); + goto error_handler; + } + + // Domain + Status =3D AmlCodeGenInteger (PsdInfo->Domain, &IntegerNode); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + goto error_handler; + } + + Status =3D AmlVarListAddTail ( + (AML_NODE_HANDLE)PsdPackage, + (AML_NODE_HANDLE)IntegerNode + ); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + FreePool (IntegerNode); + goto error_handler; + } + + // CoordType + Status =3D AmlCodeGenInteger (PsdInfo->CoordType, &IntegerNode); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + goto error_handler; + } + + Status =3D AmlVarListAddTail ( + (AML_NODE_HANDLE)PsdPackage, + (AML_NODE_HANDLE)IntegerNode + ); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + FreePool (IntegerNode); + goto error_handler; + } + + // Num Processors + Status =3D AmlCodeGenInteger (PsdInfo->NumProc, &IntegerNode); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + goto error_handler; + } + + Status =3D AmlVarListAddTail ( + (AML_NODE_HANDLE)PsdPackage, + (AML_NODE_HANDLE)IntegerNode + ); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + FreePool (IntegerNode); + goto error_handler; + } + + Status =3D LinkNode (PsdNode, ParentNode, NewPsdNode); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + goto error_handler; + } + + return Status; + +error_handler: + AmlDeleteTree ((AML_NODE_HANDLE)PsdNode); + return Status; +} --=20 2.25.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#114417): https://edk2.groups.io/g/devel/message/114417 Mute This Topic: https://groups.io/mt/103955504/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Dec 27 02:42:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+114418+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+114418+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1706195964; cv=none; d=zohomail.com; s=zohoarc; b=b5AB7sZVC/1VOUmSxZhpx8SRGw0qBbdd/EzMJQneHZb4SEcDdEWrDZXymLb/VF1oyJvWRYAdyiSo7QmOAMZww0zzdrGSOrYoHo/68UI0pc4QDbB9N6oM4ocZj/36JrIp+UEPXWCJ7TKRw/kgH4FZM50sTFe957AIOLq3NiIvM1g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706195964; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=tF4pHKy14K8VAhubJMj/RbY9nTbYd/NA6n2N1yMGyxo=; b=ghh3l6/ZaVb4+/BUusKZ4ieWI5rPIP5rapikMWWPND/hm17tBYQyrEdMamZfFp7SeyEfpn6UaszY+bAEPR8Sxq2d2jszXzA+BWTXOmR8jZPeT4wGh/mSsBRGeq1RFIe7ToOMvO1gub01IXzMpj9UM8BtS6zLzcxMGXx/ulnBRjs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+114418+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1706195964336827.7148600882844; Thu, 25 Jan 2024 07:19:24 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=F9rJYHOTjSzkNMcLVldRHTwseLgvLmPBJu/LRc6eQO4=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: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=1706195964; v=1; b=d1i4UGJbUzcol/W+1BS/4o676IVDPHq1mRuKxJmLYqArRM+BYFfUexFIDlpJkUJd9pLAihlh Hr3TXkv2zB/W+/fuI2+QVXiKH3MKyX01EYAPea8A7JLRM/TUmf9ho9qQE09oFwD0pWSc7jum6tU 1nDWKe02H2yJXsp/ORQVle/0= X-Received: by 127.0.0.2 with SMTP id m2eOYY1788612xFVbneonvdf; Thu, 25 Jan 2024 07:19:24 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.20310.1706195963427412619 for ; Thu, 25 Jan 2024 07:19:23 -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 971981FB; Thu, 25 Jan 2024 07:20:07 -0800 (PST) X-Received: from e126645.arm.com (unknown [10.57.47.22]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 0BE2A3F5A1; Thu, 25 Jan 2024 07:19:21 -0800 (PST) From: "PierreGondois" To: devel@edk2.groups.io Cc: Sami Mujawar , Leif Lindholm , Ard Biesheuvel , Pierre Gondois Subject: [edk2-devel] [PATCH v5 08/11] DynamicTablesPkg: Generate _PSD in SsdtCpuTopologyGenerator Date: Thu, 25 Jan 2024 16:18:47 +0100 Message-Id: <20240125151850.620749-9-pierre.gondois@arm.com> In-Reply-To: <20240125151850.620749-1-pierre.gondois@arm.com> References: <20240125151850.620749-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: 58VP5IlfPN1y4S2KWoJohiv0x1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1706195966669100021 Content-Type: text/plain; charset="utf-8" Make use of the newly added AmlCreatePsdNode() to generate _PSD objects. _PSD objects allow to describe 'performance control, P-state or CPPC, logical processor dependency', Cf. ACPI 6.4, s8.4.5.5 _PSD (P-State Dependency). Reviewed-by: Sami Mujawar Signed-off-by: Pierre Gondois Acked-by: Ard Biesheuvel --- .../SsdtCpuTopologyGenerator.c | 96 +++++++++++++++++++ 1 file changed, 96 insertions(+) diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/Ss= dtCpuTopologyGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTop= ologyLibArm/SsdtCpuTopologyGenerator.c index 724f33c660a8..9e3efb49e630 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTo= pologyGenerator.c +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTo= pologyGenerator.c @@ -42,6 +42,7 @@ Requirements: - EArmObjCmRef (OPTIONAL) - EArmObjLpiInfo (OPTIONAL) - GetEArmObjEtInfo (OPTIONAL) + - EArmObjPsdInfo (OPTIONAL) */ =20 /** This macro expands to a function that retrieves the GIC @@ -103,6 +104,16 @@ GET_OBJECT_LIST ( CM_ARM_ET_INFO ); =20 +/** + This macro expands to a function that retrieves the PSD + information from the Configuration Manager. +*/ +GET_OBJECT_LIST ( + EObjNameSpaceArm, + EArmObjPsdInfo, + CM_ARM_PSD_INFO + ); + /** Initialize the TokenTable. =20 One entry should be allocated for each CM_ARM_PROC_HIERARCHY_INFO @@ -256,6 +267,75 @@ WriteAslName ( return EFI_SUCCESS; } =20 +/** Create and add an _PSD Node to Cpu Node. + + For instance, transform an AML node from: + Device (C002) + { + Name (_UID, 2) + Name (_HID, "ACPI0007") + } + + To: + Device (C002) + { + Name (_UID, 2) + Name (_HID, "ACPI0007") + Name (_PSD, Package() + { + NumEntries, // Integer + Revision, // Integer + Domain, // Integer + CoordType, // Integer + NumProcessors, // Integer + }) + } + + @param [in] Generator The SSDT Cpu Topology generator. + @param [in] CfgMgrProtocol Pointer to the Configuration Manager + Protocol Interface. + @param [in] GicCInfo Pointer to the CM_ARM_GICC_INFO obje= ct + describing the Cpu. + @param [in] Node CPU Node to which the _CPC node is + attached. + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. +**/ +STATIC +EFI_STATUS +EFIAPI +CreateAmlPsdNode ( + IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator, + IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, + IN CM_ARM_GICC_INFO *GicCInfo, + IN AML_OBJECT_NODE_HANDLE *Node + ) +{ + EFI_STATUS Status; + CM_ARM_PSD_INFO *PsdInfo; + + Status =3D GetEArmObjPsdInfo ( + CfgMgrProtocol, + GicCInfo->PsdToken, + &PsdInfo, + NULL + ); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + return Status; + } + + Status =3D AmlCreatePsdNode ( + PsdInfo, + Node, + NULL + ); + ASSERT_EFI_ERROR (Status); + return Status; +} + /** Create and add an _CPC Node to Cpu Node. =20 For instance, transform an AML node from: @@ -842,6 +922,14 @@ CreateAmlCpuFromProcHierarchy ( } } =20 + if (GicCInfo->PsdToken !=3D CM_NULL_TOKEN) { + Status =3D CreateAmlPsdNode (Generator, CfgMgrProtocol, GicCInfo, CpuN= ode); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + return Status; + } + } + // If a CPC info is associated with the // GicCinfo, create an _CPC method returning them. if (GicCInfo->CpcToken !=3D CM_NULL_TOKEN) { @@ -1299,6 +1387,14 @@ CreateTopologyFromGicC ( break; } =20 + if (GicCInfo->PsdToken !=3D CM_NULL_TOKEN) { + Status =3D CreateAmlPsdNode (Generator, CfgMgrProtocol, GicCInfo, Cp= uNode); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + return Status; + } + } + // If a CPC info is associated with the // GicCinfo, create an _CPC method returning them. if (GicCInfo[Index].CpcToken !=3D CM_NULL_TOKEN) { --=20 2.25.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#114418): https://edk2.groups.io/g/devel/message/114418 Mute This Topic: https://groups.io/mt/103955506/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Dec 27 02:42:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+114419+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+114419+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1706195965; cv=none; d=zohomail.com; s=zohoarc; b=bGflCPjXT4yJTRmunFihfPhsICDNEVp/F10w6UYhoZDsHi/Chkpa+cWBRbAZTyuKfuT9FLFsq5HnPCTdbQ2+If851eljeT3BIgY/hp3cHympCB1GShM3CG6JEkVilL3/lKT3qIuyJGgHpqLyVqqPRr4x6JHlzeDbngi/TWDkfcA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706195965; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=cmWX3CAiIDSSAvbFV65zqKLFUu5wdAlb4pi4qUGck94=; b=Xfh7ihBh0EhAXhcsI54wr5PJty3Y91EcQHzttt4+PABUTL7nPPrt+ZgEsSq8JaT6t0gEjW5bryNHV8kOX228cNFz4rput3aLHaI1nfrV+oVY2xux8+iVd/9n+nnTzoKm/NynNkjc8CqXTPTrx+kiRWXFpEYh6RcSIu8fnTRJVrU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+114419+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1706195965657426.9144625211377; Thu, 25 Jan 2024 07:19:25 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=XzNTjNiO7YYjHX5pzreucWf6i7FOgSlSUd9Y9dULG5w=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: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=1706195965; v=1; b=oJf6Wh/y1q3j9kZvmAi9y4zZ6WGUhA12arbggXxOG9vFoa7+81xdobJ9swapwEc2wd+PblFL KyVk+IuPuuCmFnGlIBC+2AXxVmFR+TJZnpRBy4egVyyvMYjQtuCTjDZWeITAzHI/9n5Jp/Syx0Q fqYqffYDnU2vvtC6YU/gbvZE= X-Received: by 127.0.0.2 with SMTP id xmsbYY1788612xj6x4PuI8LM; Thu, 25 Jan 2024 07:19:25 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.20315.1706195964812568583 for ; Thu, 25 Jan 2024 07:19:24 -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 0771F1476; Thu, 25 Jan 2024 07:20:09 -0800 (PST) X-Received: from e126645.arm.com (unknown [10.57.47.22]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 676A03F5A1; Thu, 25 Jan 2024 07:19:23 -0800 (PST) From: "PierreGondois" To: devel@edk2.groups.io Cc: Sami Mujawar , Leif Lindholm , Ard Biesheuvel , Pierre Gondois Subject: [edk2-devel] [PATCH v5 09/11] DynamicTablesPkg: Add DynamicTablesScmiInfoLib Date: Thu, 25 Jan 2024 16:18:48 +0100 Message-Id: <20240125151850.620749-10-pierre.gondois@arm.com> In-Reply-To: <20240125151850.620749-1-pierre.gondois@arm.com> References: <20240125151850.620749-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: UK38vVd0HX6EDPlMqurvgaA5x1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1706195966713100022 Content-Type: text/plain; charset="utf-8" The SCP holds some power information that could be advertised through the _CPC object. The communication with the SCP is done through SCMI protocols (c.f. ArmScmiDxe). Use the SCMI protocols to query information and feed it to the DynamicTablesPkg. Acked-by: Leif Lindholm Signed-off-by: Pierre Gondois Acked-by: Ard Biesheuvel --- DynamicTablesPkg/DynamicTables.dsc.inc | 3 + DynamicTablesPkg/DynamicTablesPkg.dec | 4 + DynamicTablesPkg/DynamicTablesPkg.dsc | 3 + .../Library/DynamicTablesScmiInfoLib.h | 33 ++ .../DynamicTablesScmiInfoLib.c | 297 ++++++++++++++++++ .../DynamicTablesScmiInfoLib.inf | 31 ++ 6 files changed, 371 insertions(+) create mode 100644 DynamicTablesPkg/Include/Library/DynamicTablesScmiInfoL= ib.h create mode 100644 DynamicTablesPkg/Library/DynamicTablesScmiInfoLib/Dynam= icTablesScmiInfoLib.c create mode 100644 DynamicTablesPkg/Library/DynamicTablesScmiInfoLib/Dynam= icTablesScmiInfoLib.inf diff --git a/DynamicTablesPkg/DynamicTables.dsc.inc b/DynamicTablesPkg/Dyna= micTables.dsc.inc index 8c99574097ad..19ca62d6a85c 100644 --- a/DynamicTablesPkg/DynamicTables.dsc.inc +++ b/DynamicTablesPkg/DynamicTables.dsc.inc @@ -21,6 +21,9 @@ [LibraryClasses.common] TableHelperLib|DynamicTablesPkg/Library/Common/TableHelperLib/TableHelpe= rLib.inf SmbiosStringTableLib|DynamicTablesPkg/Library/Common/SmbiosStringTableLi= b/SmbiosStringTableLib.inf =20 +[LibraryClasses.AARCH64] + DynamicTablesScmiInfoLib|DynamicTablesPkg/Library/DynamicTablesScmiInfoL= ib/DynamicTablesScmiInfoLib.inf + [Components.common] # # Dynamic Tables Manager Dxe diff --git a/DynamicTablesPkg/DynamicTablesPkg.dec b/DynamicTablesPkg/Dynam= icTablesPkg.dec index cfbcbb9569f1..25355ace884b 100644 --- a/DynamicTablesPkg/DynamicTablesPkg.dec +++ b/DynamicTablesPkg/DynamicTablesPkg.dec @@ -42,6 +42,10 @@ [LibraryClasses] ## @libraryclass Defines a set of SMBIOS string helper methods. SmbiosStringTableLib|Include/Library/SmbiosStringTableLib.h =20 +[LibraryClasses.AARCH64] + ## @libraryclass Defines a set of APIs to populate CmObj using SCMI. + DynamicTablesScmiInfoLib|Include/Library/DynamicTablesScmiInfoLib.h + [Protocols] # Configuration Manager Protocol GUID gEdkiiConfigurationManagerProtocolGuid =3D { 0xd85a4835, 0x5a82, 0x4894,= { 0xac, 0x2, 0x70, 0x6f, 0x43, 0xd5, 0x97, 0x8e } } diff --git a/DynamicTablesPkg/DynamicTablesPkg.dsc b/DynamicTablesPkg/Dynam= icTablesPkg.dsc index 2f35ac82f20b..cf06f0731a23 100644 --- a/DynamicTablesPkg/DynamicTablesPkg.dsc +++ b/DynamicTablesPkg/DynamicTablesPkg.dsc @@ -51,6 +51,9 @@ [Components.common] [Components.ARM, Components.AARCH64] DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtHwInfoParserLib.inf =20 +[Components.AARCH64] + DynamicTablesPkg/Library/DynamicTablesScmiInfoLib/DynamicTablesScmiInfoL= ib.inf + [BuildOptions] *_*_*_CC_FLAGS =3D -D DISABLE_NEW_DEPRECATED_INTERFACES =20 diff --git a/DynamicTablesPkg/Include/Library/DynamicTablesScmiInfoLib.h b/= DynamicTablesPkg/Include/Library/DynamicTablesScmiInfoLib.h new file mode 100644 index 000000000000..ff6b47d51fe8 --- /dev/null +++ b/DynamicTablesPkg/Include/Library/DynamicTablesScmiInfoLib.h @@ -0,0 +1,33 @@ +/** @file + Arm SCMI Info Library. + + Copyright (c) 2022 - 2023, Arm Limited. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#ifndef ARM_SCMI_INFO_LIB_H_ +#define ARM_SCMI_INFO_LIB_H_ + +#include + +/** Populate a AML_CPC_INFO object based on SCMI information. + + @param[in] DomainId Identifier for the performance domain. + @param[out] CpcInfo If success, this structure was populated from + information queried to the SCP. + + @retval EFI_SUCCESS Success. + @retval EFI_DEVICE_ERROR Device error. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_TIMEOUT Time out. + @retval EFI_UNSUPPORTED Unsupported. +**/ +EFI_STATUS +EFIAPI +DynamicTablesScmiInfoGetFastChannel ( + IN UINT32 DomainId, + OUT AML_CPC_INFO *CpcInfo + ); + +#endif // ARM_SCMI_INFO_LIB_H_ diff --git a/DynamicTablesPkg/Library/DynamicTablesScmiInfoLib/DynamicTable= sScmiInfoLib.c b/DynamicTablesPkg/Library/DynamicTablesScmiInfoLib/DynamicT= ablesScmiInfoLib.c new file mode 100644 index 000000000000..da5bc1895778 --- /dev/null +++ b/DynamicTablesPkg/Library/DynamicTablesScmiInfoLib/DynamicTablesScmiIn= foLib.c @@ -0,0 +1,297 @@ +/** @file + Arm SCMI Info Library. + + Copyright (c) 2022 - 2023, Arm Limited. All rights reserved.
+ + Arm Functional Fixed Hardware Specification: + - https://developer.arm.com/documentation/den0048/latest/ + + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include +#include +#include +#include +#include +#include +#include + +/** Arm FFH registers + + Cf. Arm Functional Fixed Hardware Specification + s3.2 Performance management and Collaborative Processor Performance Cont= rol +*/ +#define ARM_FFH_DELIVERED_PERF_COUNTER_REGISTER 0x0 +#define ARM_FFH_REFERENCE_PERF_COUNTER_REGISTER 0x1 + +/// Arm SCMI performance protocol. +STATIC SCMI_PERFORMANCE_PROTOCOL *ScmiPerfProtocol; + +/** Arm SCMI Info Library constructor. + + @param ImageHandle Image of the loaded driver. + @param SystemTable Pointer to the System Table. + + @retval EFI_SUCCESS Success. + @retval EFI_DEVICE_ERROR Device error. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_NOT_FOUND Not Found + @retval EFI_TIMEOUT Timeout. + @retval EFI_UNSUPPORTED Unsupported. +**/ +EFI_STATUS +EFIAPI +DynamicTablesScmiInfoLibConstructor ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + UINT32 Version; + + Status =3D gBS->LocateProtocol ( + &gArmScmiPerformanceProtocolGuid, + NULL, + (VOID **)&ScmiPerfProtocol + ); + if (EFI_ERROR (Status)) { + return Status; + } + + Status =3D ScmiPerfProtocol->GetVersion (ScmiPerfProtocol, &Version); + if (EFI_ERROR (Status)) { + return Status; + } + + // FastChannels were added in SCMI v2.0 spec. + if (Version < PERFORMANCE_PROTOCOL_VERSION_V2) { + DEBUG (( + DEBUG_ERROR, + "DynamicTablesScmiInfoLib requires SCMI version > 2.0\n" + )); + return EFI_UNSUPPORTED; + } + + return Status; +} + +/** Get the OPPs/performance states of a power domain. + + This function is a wrapper around the SCMI PERFORMANCE_DESCRIBE_LEVELS + command. The list of discrete performance states is returned in a buffer + that must be freed by the caller. + + @param[in] DomainId Identifier for the performance domain. + @param[out] LevelArray If success, pointer to the list of list of + performance state. This memory must be freed= by + the caller. + @param[out] LevelArrayCount If success, contains the number of states in + LevelArray. + + @retval EFI_SUCCESS Success. + @retval EFI_DEVICE_ERROR Device error. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_TIMEOUT Time out. + @retval EFI_UNSUPPORTED Unsupported. +**/ +STATIC +EFI_STATUS +EFIAPI +DynamicTablesScmiInfoDescribeLevels ( + IN UINT32 DomainId, + OUT SCMI_PERFORMANCE_LEVEL **LevelArray, + OUT UINT32 *LevelArrayCount + ) +{ + EFI_STATUS Status; + SCMI_PERFORMANCE_LEVEL *Array; + UINT32 Count; + UINT32 Size; + + if ((ScmiPerfProtocol =3D=3D NULL) || + (LevelArray =3D=3D NULL) || + (LevelArrayCount =3D=3D NULL)) + { + return EFI_INVALID_PARAMETER; + } + + // First call to get the number of levels. + Size =3D 0; + Status =3D ScmiPerfProtocol->DescribeLevels ( + ScmiPerfProtocol, + DomainId, + &Count, + &Size, + NULL + ); + if (Status !=3D EFI_BUFFER_TOO_SMALL) { + // EFI_SUCCESS is not a valid option. + if (Status =3D=3D EFI_SUCCESS) { + return EFI_INVALID_PARAMETER; + } else { + return Status; + } + } + + Array =3D AllocateZeroPool (Size); + if (Array =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + // Second call to get the descriptions of the levels. + Status =3D ScmiPerfProtocol->DescribeLevels ( + ScmiPerfProtocol, + DomainId, + &Count, + &Size, + Array + ); + if (EFI_ERROR (Status)) { + return Status; + } + + *LevelArray =3D Array; + *LevelArrayCount =3D Count; + + return Status; +} + +/** Populate a AML_CPC_INFO object based on SCMI information. + + @param[in] DomainId Identifier for the performance domain. + @param[out] CpcInfo If success, this structure was populated from + information queried to the SCP. + + @retval EFI_SUCCESS Success. + @retval EFI_DEVICE_ERROR Device error. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_TIMEOUT Time out. + @retval EFI_UNSUPPORTED Unsupported. +**/ +EFI_STATUS +EFIAPI +DynamicTablesScmiInfoGetFastChannel ( + IN UINT32 DomainId, + OUT AML_CPC_INFO *CpcInfo + ) +{ + EFI_STATUS Status; + SCMI_PERFORMANCE_FASTCHANNEL FcLevelGet; + SCMI_PERFORMANCE_FASTCHANNEL FcLimitsSet; + SCMI_PERFORMANCE_DOMAIN_ATTRIBUTES DomainAttributes; + + SCMI_PERFORMANCE_LEVEL *LevelArray; + UINT32 LevelCount; + + UINT64 FcLevelGetAddr; + UINT64 FcLimitsMaxSetAddr; + UINT64 FcLimitsMinSetAddr; + + if ((ScmiPerfProtocol =3D=3D NULL) || + (CpcInfo =3D=3D NULL)) + { + return EFI_INVALID_PARAMETER; + } + + Status =3D ScmiPerfProtocol->DescribeFastchannel ( + ScmiPerfProtocol, + DomainId, + ScmiMessageIdPerformanceLevelSet, + &FcLevelGet + ); + if (EFI_ERROR (Status)) { + return Status; + } + + Status =3D ScmiPerfProtocol->DescribeFastchannel ( + ScmiPerfProtocol, + DomainId, + ScmiMessageIdPerformanceLimitsSet, + &FcLimitsSet + ); + if (EFI_ERROR (Status)) { + return Status; + } + + Status =3D ScmiPerfProtocol->GetDomainAttributes ( + ScmiPerfProtocol, + DomainId, + &DomainAttributes + ); + if (EFI_ERROR (Status)) { + return Status; + } + + Status =3D DynamicTablesScmiInfoDescribeLevels (DomainId, &LevelArray, &= LevelCount); + if (EFI_ERROR (Status)) { + return Status; + } + + /* Do some safety checks. + Only support FastChannels (and not doorbells) as this is + the only mechanism supported by SCP. + FcLimits[Get|Set] require 2 UINT32 values (max, then min) and + FcLimits[Get|Set] require 1 UINT32 value (level). + */ + if ((FcLevelGet.ChanSize !=3D sizeof (UINT32)) || + ((FcLevelGet.Attributes & SCMI_PERF_FC_ATTRIB_HAS_DOORBELL) =3D=3D + SCMI_PERF_FC_ATTRIB_HAS_DOORBELL) || + (FcLimitsSet.ChanSize !=3D 2 * sizeof (UINT32)) || + ((FcLimitsSet.Attributes & SCMI_PERF_FC_ATTRIB_HAS_DOORBELL) =3D=3D + SCMI_PERF_FC_ATTRIB_HAS_DOORBELL)) + { + Status =3D EFI_INVALID_PARAMETER; + goto exit_handler; + } + + FcLevelGetAddr =3D ((UINT64)FcLevelGet.ChanAddrHigh << 32) | + FcLevelGet.ChanAddrLow; + FcLimitsMaxSetAddr =3D ((UINT64)FcLimitsSet.ChanAddrHigh << 32) | + FcLimitsSet.ChanAddrLow; + FcLimitsMinSetAddr =3D FcLimitsMaxSetAddr + 0x4; + + CpcInfo->Revision =3D EFI_ACPI_6_5_AML_CPC_REVI= SION; + CpcInfo->HighestPerformanceInteger =3D LevelArray[LevelCount - 1= ].Level; + CpcInfo->NominalPerformanceInteger =3D DomainAttributes.Sustaine= dPerfLevel; + CpcInfo->LowestNonlinearPerformanceInteger =3D LevelArray[0].Level; + CpcInfo->LowestPerformanceInteger =3D LevelArray[0].Level; + + CpcInfo->DesiredPerformanceRegister.AddressSpaceId =3D EFI_ACPI_6_5_S= YSTEM_MEMORY; + CpcInfo->DesiredPerformanceRegister.RegisterBitWidth =3D 32; + CpcInfo->DesiredPerformanceRegister.RegisterBitOffset =3D 0; + CpcInfo->DesiredPerformanceRegister.AccessSize =3D EFI_ACPI_6_5_D= WORD; + CpcInfo->DesiredPerformanceRegister.Address =3D FcLevelGetAddr; + + CpcInfo->MinimumPerformanceRegister.AddressSpaceId =3D EFI_ACPI_6_5_S= YSTEM_MEMORY; + CpcInfo->MinimumPerformanceRegister.RegisterBitWidth =3D 32; + CpcInfo->MinimumPerformanceRegister.RegisterBitOffset =3D 0; + CpcInfo->MinimumPerformanceRegister.AccessSize =3D EFI_ACPI_6_5_D= WORD; + CpcInfo->MinimumPerformanceRegister.Address =3D FcLimitsMinSet= Addr; + + CpcInfo->MaximumPerformanceRegister.AddressSpaceId =3D EFI_ACPI_6_5_S= YSTEM_MEMORY; + CpcInfo->MaximumPerformanceRegister.RegisterBitWidth =3D 32; + CpcInfo->MaximumPerformanceRegister.RegisterBitOffset =3D 0; + CpcInfo->MaximumPerformanceRegister.AccessSize =3D EFI_ACPI_6_5_D= WORD; + CpcInfo->MaximumPerformanceRegister.Address =3D FcLimitsMaxSet= Addr; + + CpcInfo->ReferencePerformanceCounterRegister.AddressSpaceId =3D EFI_A= CPI_6_5_FUNCTIONAL_FIXED_HARDWARE; + CpcInfo->ReferencePerformanceCounterRegister.RegisterBitWidth =3D 0x40; + CpcInfo->ReferencePerformanceCounterRegister.RegisterBitOffset =3D 0; + CpcInfo->ReferencePerformanceCounterRegister.AccessSize =3D ARM_F= FH_REFERENCE_PERF_COUNTER_REGISTER; + CpcInfo->ReferencePerformanceCounterRegister.Address =3D 0x4; + + CpcInfo->DeliveredPerformanceCounterRegister.AddressSpaceId =3D EFI_A= CPI_6_5_FUNCTIONAL_FIXED_HARDWARE; + CpcInfo->DeliveredPerformanceCounterRegister.RegisterBitWidth =3D 0x40; + CpcInfo->DeliveredPerformanceCounterRegister.RegisterBitOffset =3D 0; + CpcInfo->DeliveredPerformanceCounterRegister.AccessSize =3D ARM_F= FH_DELIVERED_PERF_COUNTER_REGISTER; + CpcInfo->DeliveredPerformanceCounterRegister.Address =3D 0x4; + + // SCMI should advertise performance values on a unified scale. So frequ= ency + // values are not available. LowestFrequencyInteger and + // NominalFrequencyInteger are populated in the ConfigurationManager. + +exit_handler: + FreePool (LevelArray); + return Status; +} diff --git a/DynamicTablesPkg/Library/DynamicTablesScmiInfoLib/DynamicTable= sScmiInfoLib.inf b/DynamicTablesPkg/Library/DynamicTablesScmiInfoLib/Dynami= cTablesScmiInfoLib.inf new file mode 100644 index 000000000000..d49277f82bc3 --- /dev/null +++ b/DynamicTablesPkg/Library/DynamicTablesScmiInfoLib/DynamicTablesScmiIn= foLib.inf @@ -0,0 +1,31 @@ +## @file +# Arm SCMI Info Library. +# +# Copyright (c) 2022 - 2023, Arm Limited. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D DynamicTablesScmiInfoLib + FILE_GUID =3D 1A7CDB04-9FFC-40DA-A87C-A5ACADAF8136 + VERSION_STRING =3D 1.0 + MODULE_TYPE =3D DXE_DRIVER + LIBRARY_CLASS =3D DynamicTablesScmiInfoLib + CONSTRUCTOR =3D DynamicTablesScmiInfoLibConstructor + +[Sources] + DynamicTablesScmiInfoLib.c + +[Packages] + ArmPkg/ArmPkg.dec + DynamicTablesPkg/DynamicTablesPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + +[Protocols] + gArmScmiPerformanceProtocolGuid ## CONSUMES + +[Depex] + gArmScmiPerformanceProtocolGuid --=20 2.25.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#114419): https://edk2.groups.io/g/devel/message/114419 Mute This Topic: https://groups.io/mt/103955508/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Dec 27 02:42:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+114420+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+114420+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1706195972; cv=none; d=zohomail.com; s=zohoarc; b=USbXIQsm+xvgl1gBL3qPNA6PnfvOJ1ii4EROwxOonpPoMi6fMM5f4OhRbskEDJeXUy9FeOXlT6cHNdKk49aDO/AuAvaVR5eFkRZX3SKl0p31cUAVnKm7Bo5vpntB0ZRTo4Qdm65e9cUhgQaPiel3GHwnwK+fziJ/k3VMpq8G5vI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706195972; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=m6R0pstQ+rnKSxesHU7/CDnjLoihGRI6IhmWwFEQ544=; b=l1yBpMni+x1mIVP+NP1fmaFFKYThYFXRwxWf65jADOYz6TLquzS0EQZZSegknzMwQuekuxvOePwH2iESHnKDa6fpz6otXhG1LDI6RW/JPyvHYPoeCbWNHo6DSBQYRs7qIysl6q42qCtc+Q7JNH3xNhCQuMDHIua5tWh6ttPgsMo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+114420+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1706195972340892.7455618124682; Thu, 25 Jan 2024 07:19:32 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=JOOs5sxG3l+/+Jve/6UcxiLJz7Z3WXJH93CECt0A+4w=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: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=1706195972; v=1; b=bmVazbVBRDIhUaRCvTHwT137T1HQmMcMCApd7RHwl+yp/E1LbnQAhISunGWt3EQ2zNFTIIjF OIP9/0uV8KNhUs9MGytr6QiL6ipa3mUEDSZ7q2t0xVN3fsTDBNhmY60XDD63zTUQsK0p5ej75kl jT+FjQi6yDfmX2Yl+n5rg1Ss= X-Received: by 127.0.0.2 with SMTP id L5RSYY1788612xffj8XwWuoy; Thu, 25 Jan 2024 07:19:32 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.20316.1706195966514949789 for ; Thu, 25 Jan 2024 07:19:26 -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 AA1411FB; Thu, 25 Jan 2024 07:20:10 -0800 (PST) X-Received: from e126645.arm.com (unknown [10.57.47.22]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 046C73F5A1; Thu, 25 Jan 2024 07:19:24 -0800 (PST) From: "PierreGondois" To: devel@edk2.groups.io Cc: Sami Mujawar , Leif Lindholm , Ard Biesheuvel , Pierre Gondois Subject: [edk2-devel] [PATCH v5 10/11] DynamicTablesPkg: Add PcdDevelopmentPlatformRelaxations Pcd Date: Thu, 25 Jan 2024 16:18:49 +0100 Message-Id: <20240125151850.620749-11-pierre.gondois@arm.com> In-Reply-To: <20240125151850.620749-1-pierre.gondois@arm.com> References: <20240125151850.620749-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: BuZsJJNWjDMIXuCmoPSNBrUax1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1706195972680100005 Content-Type: text/plain; charset="utf-8" Some development platforms might not be compliant on some points of some specifications. In order to have a generic code accurately checking against specifications while still allowing some relaxation on specific points for the platforms that desire it, add a Pcd acting as a bitfield to warn instead of returning an error in case of non-compliance. Signed-off-by: Pierre Gondois Acked-by: Ard Biesheuvel --- DynamicTablesPkg/DynamicTablesPkg.dec | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/DynamicTablesPkg/DynamicTablesPkg.dec b/DynamicTablesPkg/Dynam= icTablesPkg.dec index 25355ace884b..2b3ad163191f 100644 --- a/DynamicTablesPkg/DynamicTablesPkg.dec +++ b/DynamicTablesPkg/DynamicTablesPkg.dec @@ -70,5 +70,9 @@ [PcdsFixedAtBuild] # Use PCI segment numbers as UID gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdPciUseSegmentAsUid|FALSE|BOOLEAN= |0x40000009 =20 + # Allow some relaxation on some specific points for the platforms that d= esire it. + # BIT0: Allow the absence of some registers in the _CPC object. + gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdDevelopmentPlatformRelaxations|0= |UINT64|0x4000000A + [Guids] gEdkiiDynamicTablesPkgTokenSpaceGuid =3D { 0xab226e66, 0x31d8, 0x4613, {= 0x87, 0x9d, 0xd2, 0xfa, 0xb6, 0x10, 0x26, 0x3c } } --=20 2.25.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#114420): https://edk2.groups.io/g/devel/message/114420 Mute This Topic: https://groups.io/mt/103955509/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Dec 27 02:42:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+114421+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+114421+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1706195969; cv=none; d=zohomail.com; s=zohoarc; b=KXlJKQDRoO1y0lCC95g5W6f2aW+CLIZDbW5I3wjcaz+x+bXc/Vpa1ns1/+tjRMIELZoD1yKfvCcXuFV068ipYnZwCyEnsJ6NjXiCwYAQCq+khAklbyf1NQA+LS1UHsnAna/EaCt2fE1BZZ2ENdvvJ+p7DaDEDg3N0GkF3LcgqWg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706195969; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=GL31vC9OqFYssEDAiOg7cYDIBwUriHQBFCMpVN8vTzM=; b=Wy2BUJPSkmTK4lMuR1MYVqwskNvwy+ZYKbJT4/Po6QQaRCCjmVLA/lMKM3Ub3sCaW2Z8iN61wm/dmfrEOtkCnr0b2Lat3DiTxJd5PpNxQ4yzh9hW7JROR4paZgUjXndmuosW0rTWuzVr7IbC748GurdJ/h8vE06gyMdCAP5Ss/4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+114421+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1706195969294286.27009830319173; Thu, 25 Jan 2024 07:19:29 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=yQDWstECrcTvBcgdbYzcXFoD3KDgPbRpASHGyvY2riM=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: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=1706195968; v=1; b=PRuMiE+8hY4ZFCbUrA0ZtkyDLG1sKL1qp9duXim6RrkYsPGaP/Oy2Ov0W7xEj8PF6599v1Wi TGgK6GGbFlL6+ZX9kgXrqfuW/oXonMvqHNxq/P0BXNftUW4Sy85O5PayDGK/DqLV7VbnezoboeY TEjE9llhf4d52yATJrx/WGGQ= X-Received: by 127.0.0.2 with SMTP id kJxiYY1788612xtSujOfH2X9; Thu, 25 Jan 2024 07:19:28 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.20311.1706195968246674669 for ; Thu, 25 Jan 2024 07:19:28 -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 58FB11476; Thu, 25 Jan 2024 07:20:12 -0800 (PST) X-Received: from e126645.arm.com (unknown [10.57.47.22]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 9BE923F5A1; Thu, 25 Jan 2024 07:19:26 -0800 (PST) From: "PierreGondois" To: devel@edk2.groups.io Cc: Sami Mujawar , Leif Lindholm , Ard Biesheuvel , Pierre Gondois Subject: [edk2-devel] [PATCH v5 11/11] DynamicTablesPkg: Exempt some _CPC field from checks Date: Thu, 25 Jan 2024 16:18:50 +0100 Message-Id: <20240125151850.620749-12-pierre.gondois@arm.com> In-Reply-To: <20240125151850.620749-1-pierre.gondois@arm.com> References: <20240125151850.620749-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: pVMVF5KjFxnUbyYihKbBxONdx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1706195970681100003 Content-Type: text/plain; charset="utf-8" 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 Also warn if one of the following optional fields is missing: - HighestPerformance[Buffer|Integer] - NominalPerformance[Buffer|Integer] [1] Cf. non-optional fields in: ACPI 6.5, s8.4.6.1 '_CPC (Continuous Performance Control)' Signed-off-by: Pierre Gondois Acked-by: Ard Biesheuvel --- .../Library/Common/AmlLib/AmlLib.inf | 3 ++ .../Common/AmlLib/CodeGen/AmlCodeGen.c | 36 ++++++++++++++++--- 2 files changed, 35 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 MemoryAllocationLib =20 +[FixedPcd] + gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdDevelopmentPlatformRelaxations + [BuildOptions] *_*_*_CC_FLAGS =3D -DAML_HANDLE =20 diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c b/= DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c index 6f3f46e3b1ed..a04e652588d6 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c @@ -3532,6 +3532,28 @@ AmlCreateCpcNode ( return EFI_INVALID_PARAMETER; } =20 + /// The following fields are theoretically mandatory, but not supported + /// by some platforms. + /// - PerformanceLimitedRegister + /// - ReferencePerformanceCounterRegister + /// - DeliveredPerformanceCounterRegister + if (IsNullGenericAddress (&CpcInfo->PerformanceLimitedRegister) || + IsNullGenericAddress (&CpcInfo->ReferencePerformanceCounterRegister)= || + IsNullGenericAddress (&CpcInfo->DeliveredPerformanceCounterRegister)) + { + if (PcdGet64 (PcdDevelopmentPlatformRelaxations) & BIT0) { + /// Just warn if DEVELOPMENT_PLATFORM_RELAXATIONS is set. + DEBUG (( + DEBUG_WARN, + "Missing PerformanceLimited|ReferencePerformanceCounter|" + "DeliveredPerformanceCounter field in _CPC object\n" + )); + } else { + ASSERT (0); + return EFI_INVALID_PARAMETER; + } + } + if ((IsNullGenericAddress (&CpcInfo->HighestPerformanceBuffer) && (CpcInfo->HighestPerformanceInteger =3D=3D 0)) || (IsNullGenericAddress (&CpcInfo->NominalPerformanceBuffer) && @@ -3540,13 +3562,19 @@ AmlCreateCpcNode ( (CpcInfo->LowestNonlinearPerformanceInteger =3D=3D 0)) || (IsNullGenericAddress (&CpcInfo->LowestPerformanceBuffer) && (CpcInfo->LowestPerformanceInteger =3D=3D 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 =3D=3D 0)) || + (IsNullGenericAddress (&CpcInfo->NominalPerformanceBuffer) && + (CpcInfo->NominalPerformanceInteger =3D=3D 0))) + { + DEBUG (( + DEBUG_WARN, + "Missing Reference|Delivered performance field in _CPC object\n" + )); } =20 CpcPackage =3D NULL; --=20 2.25.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#114421): https://edk2.groups.io/g/devel/message/114421 Mute This Topic: https://groups.io/mt/103955510/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-