From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id 22264D8086D for ; Tue, 7 May 2024 09:41:51 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=2DGO3b1+WGM+ekQsunNFLpdOFGLXLemK4fjiMce8jfs=; c=relaxed/simple; d=groups.io; h=Received-SPF:From:To:CC:Subject:Date:Message-ID:In-Reply-To:References:MIME-Version:Received-SPF:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding:Content-Type; s=20240206; t=1715074910; v=1; b=Yj/Gqr7BWIvdHfpoIOFjKJi12jRRekNetrbg1GGzAlcSslo5YRh2/GI5DcnffVs7yTcaZfgD 7NNeJnHbjl762vCVmhbkpbfXl0Kubz7Jk+LegvK5PlQc1l8IBd4WJqVfnZpe8WQM+Z+iAY637Vf +qaksvEVLGxg4IjvuzVSI1mIL1QukZLSlOS3dBFS6ZykmcycthfOwg5Ey/BmCSXcPsghy9u/IPZ j4Osqn5hsyxsiXsWCz2PizxyvElq+2K2d7y2E3NVzliUQnb22h1VprQT1aqM5+HY790pa6pWrBf Wl3EVKp/VdbUkTNs3IGbVpJiJabiQ2twCZIzU2AZPNTIA== X-Received: by 127.0.0.2 with SMTP id dUElYY7687511xjurI9CMENq; Tue, 07 May 2024 02:41:50 -0700 X-Received: from NAM10-BN7-obe.outbound.protection.outlook.com (NAM10-BN7-obe.outbound.protection.outlook.com [40.107.92.80]) by mx.groups.io with SMTP id smtpd.web11.7548.1715074909616903272 for ; Tue, 07 May 2024 02:41:49 -0700 X-Received: from PH8PR02CA0008.namprd02.prod.outlook.com (2603:10b6:510:2d0::17) by BY5PR12MB4083.namprd12.prod.outlook.com (2603:10b6:a03:20d::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.43; Tue, 7 May 2024 09:41:46 +0000 X-Received: from CY4PEPF0000E9DC.namprd05.prod.outlook.com (2603:10b6:510:2d0:cafe::fb) by PH8PR02CA0008.outlook.office365.com (2603:10b6:510:2d0::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.43 via Frontend Transport; Tue, 7 May 2024 09:41:46 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C X-Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000E9DC.mail.protection.outlook.com (10.167.241.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7544.18 via Frontend Transport; Tue, 7 May 2024 09:41:46 +0000 X-Received: from SATLEXMB05.amd.com (10.181.40.146) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 7 May 2024 04:41:45 -0500 X-Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 7 May 2024 04:41:45 -0500 X-Received: from BLR-LAB-SFW01.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Tue, 7 May 2024 04:41:44 -0500 From: "Abdul Lateef Attar via groups.io" To: CC: Abdul Lateef Attar , Pierre Gondois , Sami Mujawar Subject: [edk2-devel] [PATCH v2 1/1] DynamicTablesPkg: Adds integer to the AML package node Date: Tue, 7 May 2024 15:11:33 +0530 Message-ID: <52ee80dff576b07666494d8cdd9ba059ae25ad75.1715074750.git.AbdulLateef.Attar@amd.com> In-Reply-To: References: MIME-Version: 1.0 Received-SPF: None (SATLEXMB05.amd.com: AbdulLateef.Attar@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9DC:EE_|BY5PR12MB4083:EE_ X-MS-Office365-Filtering-Correlation-Id: 0875a53d-f1d8-4c6b-053b-08dc6e79e93e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?V7Zt6HDHPo1bQMULIq/pRBbJOtBLo+QqIVuysBU8NfeaX2JE2NaQngRhssFr?= =?us-ascii?Q?f4Lj9ndhmzqLq7tvyb4keK0xS3N2qQAdcuebKyp70jfDgxafhpq2TE6vW/28?= =?us-ascii?Q?en621CTXcztf/izgOZAm+mvpB9eGtTowGGmnXVDKTaVTAa5xh8TiUDgYqQr8?= =?us-ascii?Q?yNcXuetMu/5qNHiKbGTCmMxzG3hbvr+peeQC+cUh9niSnVckjz+SnlS3t5hv?= =?us-ascii?Q?/ZOojHAXBM92cdljl6rXss02bI4updKpHq8VXzXKrPnBYhogC4Z7VmbrHfHh?= =?us-ascii?Q?bpJQ5x92ewqz0bBYYaeBUM/Od/Lg8H/FbRrjOY04dzzzCiO+UABtCJDuT+XU?= =?us-ascii?Q?qaqhjpvCWq2k2l2ea9UQqDQ6bh0KwE9vDgn1ddAMW1IiHX79mzY729v08Nai?= =?us-ascii?Q?ui6lHnXc0LQeXabEo3PfTZr34SRJmTHS9/W5KPLBi2BVeJBJLqO7nawDeSC+?= =?us-ascii?Q?PLrI/O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KnFq1KwvpfFS?= =?us-ascii?Q?aaDqCAQ=3D?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 May 2024 09:41:46.2084 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0875a53d-f1d8-4c6b-053b-08dc6e79e93e X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000E9DC.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4083 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 Resent-Date: Tue, 07 May 2024 02:41:50 -0700 Resent-From: AbdulLateef.Attar@amd.com Reply-To: devel@edk2.groups.io,AbdulLateef.Attar@amd.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: iBAgQ5Zua7PYBDYj93BdzvLmx7686176AA= 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=20240206 header.b="Yj/Gqr7B"; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=pass (policy=none) header.from=groups.io Adds an AmlAddIntegerToNamedPackage() API to generate AML code, which adds an integer value to the package node. Cc: Pierre Gondois Cc: Sami Mujawar Signed-off-by: Abdul Lateef Attar --- .../Include/Library/AmlLib/AmlLib.h | 41 +++++++++++- .../Common/AmlLib/CodeGen/AmlCodeGen.c | 67 +++++++++++++++++++ 2 files changed, 107 insertions(+), 1 deletion(-) diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h b/DynamicTabl= esPkg/Include/Library/AmlLib/AmlLib.h index 82d5464084..4427ab68fa 100644 --- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h +++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h @@ -2,7 +2,7 @@ AML Lib. =20 Copyright (c) 2019 - 2023, Arm Limited. All rights reserved.
- Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
+ Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reser= ved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -1743,6 +1743,45 @@ AmlAddNameStringToNamedPackage ( IN AML_OBJECT_NODE_HANDLE NamedNode ); =20 +/** Add an integer value to the named package node. + + AmlCodeGenNamePackage ("_CID", NULL, &PackageNode); + AmlGetEisaIdFromString ("PNP0A03", &EisaId); + AmlAddIntegerToNamedPackage (EisaId, NameNode); + AmlGetEisaIdFromString ("PNP0A08", &EisaId); + AmlAddIntegerToNamedPackage (EisaId, NameNode); + + equivalent of the following ASL code: + Name (_CID, Package (0x02) // _CID: Compatible ID + { + EisaId ("PNP0A03"), + EisaId ("PNP0A08") + }) + + The package is added at the tail of the list of the input package node + name: + Name ("NamePackageNode", Package () { + [Pre-existing package entries], + [Newly created integer entry] + }) + + + @ingroup CodeGenApis + + @param [in] Integer Integer value that need to be added to p= ackage node. + @param [in, out] NameNode Package named node to add the object to. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval Others Error occurred during the operation. +**/ +EFI_STATUS +EFIAPI +AmlAddIntegerToNamedPackage ( + IN UINT32 Integer, + IN OUT AML_OBJECT_NODE_HANDLE NameNode + ); + /** AML code generation to invoke/call another method. =20 This method is a subset implementation of MethodInvocation diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c b/= DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c index 22c2d598d0..89fa4e06f8 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c @@ -3871,6 +3871,73 @@ exit_handler: return Status; } =20 +/** Add an integer value to the named package node. + + AmlCodeGenNamePackage ("_CID", NULL, &PackageNode); + AmlGetEisaIdFromString ("PNP0A03", &EisaId); + AmlAddIntegerToNamedPackage (EisaId, NameNode); + AmlGetEisaIdFromString ("PNP0A08", &EisaId); + AmlAddIntegerToNamedPackage (EisaId, NameNode); + + equivalent of the following ASL code: + Name (_CID, Package (0x02) // _CID: Compatible ID + { + EisaId ("PNP0A03"), + EisaId ("PNP0A08") + }) + + The package is added at the tail of the list of the input package node + name: + Name ("NamePackageNode", Package () { + [Pre-existing package entries], + [Newly created integer entry] + }) + + + @ingroup CodeGenApis + + @param [in] Integer Integer value that need to be added to p= ackage node. + @param [in, out] NameNode Package named node to add the object to. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval Others Error occurred during the operation. +**/ +EFI_STATUS +EFIAPI +AmlAddIntegerToNamedPackage ( + IN UINT32 Integer, + IN OUT AML_OBJECT_NODE_HANDLE NameNode + ) +{ + EFI_STATUS Status; + AML_OBJECT_NODE *PackageNode; + + if (NameNode =3D=3D NULL) { + ASSERT_EFI_ERROR (FALSE); + return EFI_INVALID_PARAMETER; + } + + PackageNode =3D (AML_OBJECT_NODE_HANDLE)AmlGetFixedArgument ( + NameNode, + EAmlParseIndexTerm1 + ); + if ((PackageNode =3D=3D NULL) = || + (AmlGetNodeType ((AML_NODE_HANDLE)PackageNode) !=3D EAmlNodeObject) = || + (!AmlNodeHasOpCode (PackageNode, AML_PACKAGE_OP, 0))) + { + ASSERT_EFI_ERROR (FALSE); + return EFI_INVALID_PARAMETER; + } + + Status =3D AmlAddRegisterOrIntegerToPackage (NULL, Integer, PackageNode)= ; + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + } + + return Status; +} + /** AML code generation to invoke/call another method. =20 This method is a subset implementation of MethodInvocation --=20 2.34.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 (#118641): https://edk2.groups.io/g/devel/message/118641 Mute This Topic: https://groups.io/mt/105957057/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-