From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id AE951740032 for ; Mon, 11 Sep 2023 22:14:50 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=rLUgpdjBdmnofdjYw9HUXEXx5tXn3YdBjfNcvj2ghQg=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:Received-SPF: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:Content-Type; s=20140610; t=1694470489; v=1; b=wyPZsa5ty6iNDWiBh6SrhnyJ4LbS34AcekKERwZdeuelyMZdEs/mivyXbplp/Mz4YrMp0o8I YE5cwFIYG7juj3QMYxUjQfm98Gmz33IbvxI2rT+qSyNDfNWbp08m/JJgTiXo+UyHsq7Rr4hNlwv dQnkbXa6MnJg+nh39Owu4uEA= X-Received: by 127.0.0.2 with SMTP id dGbsYY7687511xBOZQfclOLA; Mon, 11 Sep 2023 15:14:49 -0700 X-Received: from NAM12-MW2-obe.outbound.protection.outlook.com (NAM12-MW2-obe.outbound.protection.outlook.com [40.107.244.40]) by mx.groups.io with SMTP id smtpd.web11.11616.1694470488428857541 for ; Mon, 11 Sep 2023 15:14:48 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CqCAQhyJj+0riOVPYrg/JTAS8ydim0pSrXoQsAOxb4LIoDzlsbuo6Lv0jns+C+JRIdVPDNTWYf22XQn7CAfcbcSl0lGgINvVDIv3yCMdI7d96MY3szEUwxMPWAQTF0WgQyT+4lfzqzQ5ROqoRSgrVmvHv1QM8FXd5B+N7du2pjl5CzVLB6z7inYUxqwJuFg17BxFUlvCRCWhqwpTd6MY3oDos3zn0qtchIBJGjWMspm3mq7+Cpyi4g6mQcnIIzbcyl/G26piu5oQ82qPJKqA45TPr4GAfq6QP6yYyPaMlazgAt6eVkHVFR1ku0hahR8rPCbF2zH2zselnu1cIAyfbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=yIy12+NtzYnTxQ63iFaUJImph5aiV8PS4igVA1D2ZN0=; b=OQZOB/x9AMXe4wGk5lvY7BKo03Pb4QYLz2XdwC4SRENT2blJJwG0J/LBp+gPUYc3LwaydaMRi2Woc6+4oIH8UWQxCQter6tB/58adgP5iRFsg644eO91IXDG9YATbnQfGdPpklbea53asH9tcVVKye+jRz3Ne42JKBuGbUnbbHkyyZ9ULRoHAIyHbMUDTMzJU6rSLHYJXPnmpBLLaG5BVi/Lx7V8hzk66AfyM4bT0BAmjHtzvYt4SRhnSA8spbdkwzjDLE55UZ6oF17tiERzS1Ujy7QpHoy5reRsL110PF9U0iVXLTdbvf+VDdqf5qczJcS+hnVFdxe9Zb+ssij/bA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none X-Received: from DS7PR03CA0334.namprd03.prod.outlook.com (2603:10b6:8:55::11) by SJ0PR12MB8114.namprd12.prod.outlook.com (2603:10b6:a03:4e8::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.30; Mon, 11 Sep 2023 22:14:45 +0000 X-Received: from DS3PEPF000099DE.namprd04.prod.outlook.com (2603:10b6:8:55:cafe::c5) by DS7PR03CA0334.outlook.office365.com (2603:10b6:8:55::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.35 via Frontend Transport; Mon, 11 Sep 2023 22:14:45 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.232 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C X-Received: from mail.nvidia.com (216.228.118.232) by DS3PEPF000099DE.mail.protection.outlook.com (10.167.17.200) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.11 via Frontend Transport; Mon, 11 Sep 2023 22:14:45 +0000 X-Received: from drhqmail202.nvidia.com (10.126.190.181) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Mon, 11 Sep 2023 15:14:36 -0700 X-Received: from drhqmail203.nvidia.com (10.126.190.182) by drhqmail202.nvidia.com (10.126.190.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Mon, 11 Sep 2023 15:14:36 -0700 X-Received: from localhost.localdomain (10.127.8.11) by mail.nvidia.com (10.126.190.182) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Mon, 11 Sep 2023 15:14:35 -0700 From: "Jeff Brasen via groups.io" To: CC: , , , Jeff Brasen , "Swatisri Kantamsetti" , Ashish Singhal Subject: [edk2-devel] [PATCH v3 1/4] DynamicTablesPkg: Add ThermalZone CodeGen function Date: Mon, 11 Sep 2023 18:07:17 +0000 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099DE:EE_|SJ0PR12MB8114:EE_ X-MS-Office365-Filtering-Correlation-Id: 9acb8476-04b7-4aa4-4db6-08dbb3148164 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: q5SpK1q8M9JAKNDcBbhiZMRny53vwo3achAY0Ie7JZt378Sq/faI4UU/U8rINa60gvVDtSkEP/b0wA3kY4oBDNjxf9HZcEDU605XMqt15JZEs8b1c4DHuUPId3VUDyXv7/KoQpkEnvkuSwCgxeQI6x0zj3NrRYFDDJk3pG4BvuQcCNsXwVlGMB1P6lAPR1sws4u/+9Y7CQGs9LoMCl0ca9M91p0u6h+Fdot3MxLOi5qaidRmxO+qc4jBMjICGazwaAnYnoCaNK1S4V5duqAyTy1uucnwa0yKJKS2Gz8eEfhMKCTmQW9r8zJOupxKuYJvm1RV2szk/L0wkSrf23pb3+jyXhVbhiNtZu6XF2byVSta+jJ5cKutCYgZOEvokDO1BaWmr647qRW7PjdnvHYy37yMCSpjzVewxTi6opbqFxCUBhgIjT2spRxdEgRn+4X/VoSSHTvNo2cWumN5pkY/1CI5GZCKXhZ6bZ1WD0W2lpqwkzOg9gNLWwOaKryvTgyyTO217vez08eSZf/fyPsCMh9puluUYSG4Qk1T4fitWNB8G0rdetPz3KNTZDEPKIvaYbCtVqc0OqwxnlU0wsrOBtB9rp+zyB84RnpPzZ5En/Iaj49qB3txJ1W1dwUBB3zogHDN9Z+5eqKIWqAIzQ6OcGsxEO2aSx12BecYou2FyNVWLVeR037m7p3PU8pJVafxtOSF4QbT/HqXQgZuO18o/uWCgZukftPx9l92IwFLoz1OkEM9D5wN2mc3vwCDD7z4 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2023 22:14:45.3203 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9acb8476-04b7-4aa4-4db6-08dbb3148164 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.232];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF000099DE.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB8114 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,jbrasen@nvidia.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: zag9Evnj6qxoo2OvNJ9QaJKPx7686176AA= Content-Transfer-Encoding: quoted-printable Content-Type: text/plain X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=wyPZsa5t; dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}") Add API to generate a ThermalZone object to AmlLib. Bug 4063340 Signed-off-by: Jeff Brasen Reviewed-by: Swatisri Kantamsetti Reviewed-by: Ashish Singhal --- .../Include/Library/AmlLib/AmlLib.h | 28 +++++ .../Common/AmlLib/CodeGen/AmlCodeGen.c | 116 ++++++++++++++++++ 2 files changed, 144 insertions(+) diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h b/DynamicTabl= esPkg/Include/Library/AmlLib/AmlLib.h index 9210c50915..d201ae9499 100644 --- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h +++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h @@ -1038,6 +1038,34 @@ AmlCodeGenDevice ( OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL ); =20 +/** AML code generation for a ThermalZone object node. + + AmlCodeGenThermalZone ("TZ00", ParentNode, NewObjectNode) is + equivalent of the following ASL code: + ThermalZone(TZ00) {} + + @ingroup CodeGenApis + + @param [in] NameString The new ThermalZone's name. + Must be a NULL-terminated ASL NameString + e.g.: "DEV0", "DV15.DEV0", etc. + The input string is copied. + @param [in] ParentNode If provided, set ParentNode as the parent + of the node created. + @param [out] NewObjectNode If success, contains the created node. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. +**/ +EFI_STATUS +EFIAPI +AmlCodeGenThermalZone ( + IN CONST CHAR8 *NameString, + IN AML_NODE_HANDLE ParentNode OPTIONAL, + OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL + ); + /** AML code generation for a Scope object node. =20 AmlCodeGenScope ("_SB", ParentNode, NewObjectNode) is diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c b/= DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c index 0b223379fa..88537b7e2d 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c @@ -1218,6 +1218,122 @@ error_handler1: return Status; } =20 +/** AML code generation for a ThermalZone object node. + + AmlCodeGenThermalZone ("TZ00", ParentNode, NewObjectNode) is + equivalent of the following ASL code: + ThermalZone(TZ00) {} + + @ingroup CodeGenApis + + @param [in] NameString The new ThermalZone's name. + Must be a NULL-terminated ASL NameString + e.g.: "DEV0", "DV15.DEV0", etc. + The input string is copied. + @param [in] ParentNode If provided, set ParentNode as the parent + of the node created. + @param [out] NewObjectNode If success, contains the created node. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. +**/ +EFI_STATUS +EFIAPI +AmlCodeGenThermalZone ( + IN CONST CHAR8 *NameString, + IN AML_NODE_HANDLE ParentNode OPTIONAL, + OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL + ) +{ + EFI_STATUS Status; + AML_OBJECT_NODE *ObjectNode; + AML_DATA_NODE *DataNode; + CHAR8 *AmlNameString; + UINT32 AmlNameStringSize; + + if ((NameString =3D=3D NULL) || + ((ParentNode =3D=3D NULL) && (NewObjectNode =3D=3D NULL))) + { + ASSERT (0); + return EFI_INVALID_PARAMETER; + } + + ObjectNode =3D NULL; + DataNode =3D NULL; + AmlNameString =3D NULL; + + Status =3D ConvertAslNameToAmlName (NameString, &AmlNameString); + if (EFI_ERROR (Status)) { + ASSERT (0); + return Status; + } + + Status =3D AmlGetNameStringSize (AmlNameString, &AmlNameStringSize); + if (EFI_ERROR (Status)) { + ASSERT (0); + goto error_handler1; + } + + Status =3D AmlCreateObjectNode ( + AmlGetByteEncodingByOpCode (AML_EXT_OP, AML_EXT_THERMAL_ZONE_= OP), + AmlNameStringSize + AmlComputePkgLengthWidth (AmlNameStringSi= ze), + &ObjectNode + ); + if (EFI_ERROR (Status)) { + ASSERT (0); + goto error_handler1; + } + + Status =3D AmlCreateDataNode ( + EAmlNodeDataTypeNameString, + (UINT8 *)AmlNameString, + AmlNameStringSize, + &DataNode + ); + if (EFI_ERROR (Status)) { + ASSERT (0); + goto error_handler2; + } + + Status =3D AmlSetFixedArgument ( + ObjectNode, + EAmlParseIndexTerm0, + (AML_NODE_HEADER *)DataNode + ); + if (EFI_ERROR (Status)) { + ASSERT (0); + AmlDeleteTree ((AML_NODE_HEADER *)DataNode); + goto error_handler2; + } + + Status =3D LinkNode ( + ObjectNode, + ParentNode, + NewObjectNode + ); + if (EFI_ERROR (Status)) { + ASSERT (0); + goto error_handler2; + } + + // Free AmlNameString before returning as it is copied + // in the call to AmlCreateDataNode(). + goto error_handler1; + +error_handler2: + if (ObjectNode !=3D NULL) { + AmlDeleteTree ((AML_NODE_HEADER *)ObjectNode); + } + +error_handler1: + if (AmlNameString !=3D NULL) { + FreePool (AmlNameString); + } + + return Status; +} + /** AML code generation for a Scope object node. =20 AmlCodeGenScope ("_SB", ParentNode, NewObjectNode) is --=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 (#108500): https://edk2.groups.io/g/devel/message/108500 Mute This Topic: https://groups.io/mt/101303760/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-