From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (NAM10-DM6-obe.outbound.protection.outlook.com [40.107.93.43]) by mx.groups.io with SMTP id smtpd.web10.210.1689027976069846243 for ; Mon, 10 Jul 2023 15:26:16 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@nvidia.com header.s=selector2 header.b=Gerc3e0g; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: nvidia.com, ip: 40.107.93.43, mailfrom: jbrasen@nvidia.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Tw5P2/HHlU7mJuOhRS9I9gYgSc/hwuxph7hO2iVM8mHKujafDTr5+J1pbnaIk1e/L0v0sVjfROKa5AmKYAhU7/Zd1MfHKN3BE7fXzQKAOg9khwwil9WtmmtHLe1px0/0nmxYzrLhB6RYdLUxYrsGLG3T8Q03/gRelDP4kUK6owM5IfAIe8cZaQ5tLrN5EmzVhPClTWraXHMBZN5dO9IKVNwlNDvHDhUJKLwT7grJJlSTZUMibtilkqqXvy6bwcuag8Gg+QNs3QRd1ZjB9w6K/YK3yC7vGvvZvhvr8YBDZsI6qlRTDwoF19ZjHqS/q6XIoKyGWaa/s92RXAKaNHuX3w== 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=3U0K6rmGR1FMn0I08sxsNTtraTGa1SORQsuZWm5NATE=; b=DzhUVC7S2uTfCfG5tu4zhiB/N7JBnjIqVhT+AEPimc9HzqhzkiUguiw3FAHaxgIO0YxywY10NSVCM090wtEQb9BYZl3+Ion2KTkWL6bDQEE6yjovwsAP2fKt1NS+17S5PVWX749k9SY/UdgRThkHAxNGG+fNCNjFmdO3SQHz6sJE2HCecrAvANrav799tD8rWZYFzFAGB/p4FKcF6TbWWdk+qOvtcM0qN+/WHk6fPl0cHrY7Zpz0tf92wpIz6f7WT8WUhY8Jrx5htwietTgI/LXPLulNpUeIF3tcsiHvqlq6ax7csJZhuOqA8z6WYm9N5h1pieojDMLjHI8Aqii8gg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3U0K6rmGR1FMn0I08sxsNTtraTGa1SORQsuZWm5NATE=; b=Gerc3e0gPARCwpIL/FNIevwY7g/inkATKYgnj4o9sfJuqRbLrsf2JC6fk3qD04fj1LQX1Umrod4HMPSOemG8rHc5BIywZsX7p8LNUHp484xek48B39J9O8otlEyVVYrMXPBGVYO/skUP/8PBJ9zaeuZWm1qPmgQl7S7q89/zA8wdlr74rR+dp0sVtkTfsVoNiulrD3F7xAAExM8+NvjV+7ZseYx8l4BMz66ir8LL4BfTAiuXMCkN6Z5YrZ8PXairRI92d21WjEzI2WI7noramJhTEYaDWk06fNEjQ80z8jkyP4NCvEQK9+C8Lm1e+hx5Vls9z2qg6mR1le8Tf0iIMg== Received: from MW4PR04CA0336.namprd04.prod.outlook.com (2603:10b6:303:8a::11) by SN7PR12MB6888.namprd12.prod.outlook.com (2603:10b6:806:260::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.26; Mon, 10 Jul 2023 22:26:13 +0000 Received: from CO1NAM11FT108.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8a:cafe::44) by MW4PR04CA0336.outlook.office365.com (2603:10b6:303:8a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.31 via Frontend Transport; Mon, 10 Jul 2023 22:26:13 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CO1NAM11FT108.mail.protection.outlook.com (10.13.175.226) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.18 via Frontend Transport; Mon, 10 Jul 2023 22:26:13 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Mon, 10 Jul 2023 15:26:02 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail202.nvidia.com (10.129.68.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Mon, 10 Jul 2023 15:26:01 -0700 Received: from 6cd8174ac25c.nvidia.com (10.127.8.9) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Mon, 10 Jul 2023 15:26:01 -0700 From: "Jeff Brasen" To: CC: , , , Jeff Brasen , "Swatisri Kantamsetti" , Ashish Singhal Subject: [PATCH v2 1/4] DynamicTablesPkg: Add ThermalZone CodeGen function Date: Mon, 10 Jul 2023 22:25:56 +0000 Message-ID: <36ae608754277a623eeadb39f4188cababac0b51.1689027745.git.jbrasen@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-NVConfidentiality: public Return-Path: jbrasen@nvidia.com X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT108:EE_|SN7PR12MB6888:EE_ X-MS-Office365-Filtering-Correlation-Id: e92c7722-1d0a-49c4-12a5-08db8194ab87 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EMu0szlsLrWFUwxFJKHXOpGDwqLabiKHgeE1CdNBEIltYikawwDvbYPpvsnzU8mAhj/BGE/GenkXGt7dXjzHIak5HkMt42Z8m+NMnUtTMESaRFCAAtwKsAlOJLdiP1/mjEsav9jTTQPvxNlL9wEkKjW4oWOv5+L0c/OTWq6ug0TEULJMjdJtaer6UMbdpaA1zG5H1ApMaiRf7nT5qGvw+0kVUhvkhPre9KO5Fzelz0qpfjogb6OOG3KBjvebpthIjasiyxmQDhNRLmxXlBHh44FWcsWdNg5fp8GtsKP333oldodz5fSBia4X8blonwS2f/hkZ98VO/796lNlzbCmlhS2AZA8copVZUjS+TybAfOg+asF7qHE1wmP0v/ckzyVOZI901WiN+ikGR/c5BkLouV1E/OD6WMAUiloBvlnrf7jEjv4zl0P1w62ZlXaZuHOpJi6I77eCmAIzJ1vMVFdFA+/5ksKchJOD5S2DmRXW/GTl7C4HDkPjzBXSqbF1xuLIE5Na88KX24Os2sWr9A/3xXbTSMCi+dTGRsU0Rv7ta4O1x5EFecchStRKCR4ifDNc/NALeYFKiLWlp0pmxaFVk5/Rs2cNdEcuSC1vuE13LCGfXyBS+UTVEjaXe/Q1Z0o3O/vtiDLdyHbvGkU1Yt8HRipp+LmaVsj8A5ighYSTR0tDcpolcNshlkl7+SOUSQSpl8mRo5mJ7894ZW6KQGrRogPSrxA5LwDWI7iUu1QuTLSaHTJVukrfAYLjz+iK/Lp X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230028)(4636009)(396003)(376002)(346002)(39860400002)(136003)(451199021)(40470700004)(46966006)(36840700001)(86362001)(82310400005)(40460700003)(40480700001)(36756003)(70206006)(478600001)(70586007)(6666004)(54906003)(356005)(7636003)(82740400003)(7696005)(36860700001)(336012)(186003)(107886003)(26005)(316002)(2906002)(8936002)(5660300002)(8676002)(426003)(47076005)(2616005)(6916009)(41300700001)(83380400001)(4326008);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2023 22:26:13.4393 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e92c7722-1d0a-49c4-12a5-08db8194ab87 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT108.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB6888 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain Add API to generate a ThermalZone object to AmlLib. 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 9210c5091548..d201ae9499fa 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 0b223379fa4b..88537b7e2d27 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c @@ -1218,6 +1218,122 @@ AmlCodeGenDevice ( 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