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 E1479740034 for ; Thu, 9 May 2024 04:49:11 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=JHuIBNW3mm05E5dXopbsop0fDA1YprZguDaGHv1FsCY=; 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=1715230150; v=1; b=E+0wt+BBtZLSNgPLug8LZsnxGasG8EEJ5oq2ST0dLbhdtRswVYTolKtK4iuAtI11ZkIAm7az vo4a1ldKHtwTNaxrLrqh6f/eZxZUAlVc3rN7NaEi1MXYCUXKnwENQ5cWTn4Acb4aavMxrJMgwWF Dw6mk2GcN1r0Xe96G5Ypo9e+WkFKyJu24Pu/G2QKVcUqk+F+FVlQKamCvaRXl9c1VWz8fveOaBL nhveQEGOegpcCSCbmVK0DaUCYNQH54ebOlAKBbCdplaPDdZLbuVamJnlvWgbqR9ecYFdsloUKKy 77VcSgQh5eCekdnLpZetGvjo/spXE/vEdq+2OdUlG0cyg== X-Received: by 127.0.0.2 with SMTP id tFXLYY7687511xwoKKN5Ht6r; Wed, 08 May 2024 21:49:10 -0700 X-Received: from NAM11-CO1-obe.outbound.protection.outlook.com (NAM11-CO1-obe.outbound.protection.outlook.com [40.107.220.60]) by mx.groups.io with SMTP id smtpd.web10.2681.1715230149477676553 for ; Wed, 08 May 2024 21:49:09 -0700 X-Received: from BYAPR08CA0047.namprd08.prod.outlook.com (2603:10b6:a03:117::24) by MW4PR12MB6705.namprd12.prod.outlook.com (2603:10b6:303:1e3::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.47; Thu, 9 May 2024 04:49:05 +0000 X-Received: from SJ5PEPF000001D5.namprd05.prod.outlook.com (2603:10b6:a03:117:cafe::33) by BYAPR08CA0047.outlook.office365.com (2603:10b6:a03:117::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.47 via Frontend Transport; Thu, 9 May 2024 04:49:05 +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=SATLEXMB03.amd.com; pr=C X-Received: from SATLEXMB03.amd.com (165.204.84.17) by SJ5PEPF000001D5.mail.protection.outlook.com (10.167.242.57) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7544.18 via Frontend Transport; Thu, 9 May 2024 04:49:05 +0000 X-Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 8 May 2024 23:49:03 -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; Wed, 8 May 2024 23:49:02 -0500 From: "Abdul Lateef Attar via groups.io" To: CC: Abdul Lateef Attar , Pierre Gondois , Sami Mujawar Subject: [edk2-devel] [edk2-stable202405 RESEND PATCH v2 1/1] DynamicTablesPkg: Adds integer to the AML package node Date: Thu, 9 May 2024 10:18:50 +0530 Message-ID: <27f10d098dd8477df432534933dca5f688cfd66d.1715229678.git.AbdulLateef.Attar@amd.com> In-Reply-To: References: MIME-Version: 1.0 Received-SPF: None (SATLEXMB03.amd.com: AbdulLateef.Attar@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001D5:EE_|MW4PR12MB6705:EE_ X-MS-Office365-Filtering-Correlation-Id: 8c0cf668-1424-42cd-f1f8-08dc6fe35adb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?qABbpTz0aWbGln4Sh+MFa/UrA7zIdATWZfLYPEx8l1Xud+Q2auUWnVqbKECI?= =?us-ascii?Q?YVEiYSvVJ5ZuuvpJSfJKVkIpDBmbr9f3OIlRLBvhznNSQYy24ZZ5RzJ+mFGQ?= =?us-ascii?Q?dShsVyEFj/x5gSRRZN9RRdVmGcHnpj9Wmo8sVUwJAzw+2QED7CGIdpG3wuVE?= =?us-ascii?Q?yx4VgUitUta22Lo3aMYmgEm/yDa5co6sgk6PBgf2U+lV42E1S1qoI0/bQ8mW?= =?us-ascii?Q?RzpxmSU+gpFJCujmFzOvz+epwQTcHgVjAKWodQpAoaqHxsTsr+iaG2+VTtUc?= =?us-ascii?Q?TG4uzcCL/T2NqCDmpAVvGScduKLUZWP5VShFoan9Bd6L/gepsF6KjhiI5WJl?= =?us-ascii?Q?EYgR+82XBRpGRKE+8YOvlL+t57HXaVH4vTKg2Y4s+QsfL2vCx3NZhxpMYKZH?= =?us-ascii?Q?XgyaXbKcL8Hy8KkDMFNPX/ve5xVmgF49wPCGfQY2gL2FEWbb0nw6ghHDmZAp?= =?us-ascii?Q?gUNheQpVnGq37OJDLUqqzXoUrZ51vpTmT4fmZRFfEfjgjsZyUsCjaPvvDyUK?= =?us-ascii?Q?Myq1C5Z7c7v18emiQZbS6dGtW9BoFC+lbBpZUzha9IYfUPSnevGvSjYJRUBj?= =?us-ascii?Q?nff8IP6ibC1KJYhuX6hcmeJThDh1MFsz2j/+0l6O9l0fRXPgqRvfygGXAYeU?= =?us-ascii?Q?h/p1BPos0iEoQbfAtdFwZtLnpTDZEvU8llwCHcgLjfIhFU+MYkB4Nncp8qPH?= =?us-ascii?Q?kz0zURWzZVgGc9p+2FlKdvEiWqjOYBQXtstlPYoIdUimwKZUJbCkQJxOuRTG?= =?us-ascii?Q?5Nb5QUG06T6sVWluWxJRenrjnpJtxOrQKjKGWmuCRik1+ZPDaDUvkvzMVkU7?= =?us-ascii?Q?iHPsFVWN+X1fxbgFDx/cTsbkOFhDqYYOS9JVt/bR080Rza5iOxq/KSVfnybv?= =?us-ascii?Q?zUlqyiaf2J1oE8MFFn4LpITuek0kbl9gGmvCdwxISRZFwwwees/toh3OHOMC?= =?us-ascii?Q?/Dl5JOmhDEZzm2iCMddr6rigIkXjnkr5fmetHgp89wlDKPlT71XiwQPP6iR9?= =?us-ascii?Q?F7MOlM6rPHg/i36lv4Z5Tg//6glSr8eDN2avAe8Covp/HQXtQeZAzdJvQN/l?= =?us-ascii?Q?n5ZMGUEXCH7EnnX0q3mggDe7YKsPjTt7t6zG3+PZ1WyAke8W4EI8LsueXVqv?= =?us-ascii?Q?PyxvoTc88cdwlQEf87LMe1ehipa8ZsbAvodq9RO9+UJlD0Zc4CzifVePqPbr?= =?us-ascii?Q?4B1hvBcNRBnjWphvVNz0Na8q9JTnQX44meXOKFmwWKzuBhoT9hk3LrcWcKgJ?= =?us-ascii?Q?2NzhHu4T+Fw1aZutMUbpw+2N1bwjcvqYiyynrg1Ub1qfqm430Qnyn6zkTVs1?= =?us-ascii?Q?SK1AY66m8OGXCRNfL8Kzsa3cPpdal54j8UehrpY379dQ9bv11KKP3S8zXNnm?= =?us-ascii?Q?MdHDVIw=3D?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 May 2024 04:49:05.1140 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8c0cf668-1424-42cd-f1f8-08dc6fe35adb 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=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ5PEPF000001D5.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6705 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: Wed, 08 May 2024 21:49:09 -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: 3ZIsE05HLAR1XUdWrNRCvtzTx7686176AA= 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=E+0wt+BB; dmarc=pass (policy=none) header.from=groups.io; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@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 (#118714): https://edk2.groups.io/g/devel/message/118714 Mute This Topic: https://groups.io/mt/105995995/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-