From nobody Tue Dec 10 08:10:46 2024 Delivered-To: importer@patchew.org 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+108502+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1694470491618628.4897486384816; Mon, 11 Sep 2023 15:14:51 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=uwoeKlzmOZ+G0hSfcmtGn7cVX77uKid5Z4MlWqGvvzU=; 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=1694470491; v=1; b=v5PAEDfiJOykep7E+EI++CTVI7pypiXkmG5a1M5gzuhZAlwZab1TqnlI4HqsjAsFhXwlVWA7 coBjhZjgDi68vcfsHhKq2mai3CVhByI/TXqXIJIZtoKPx9IpI4fQ3jc7110TxNynopQK6n8pHPM NkuhDaf80647EVBxj45UnkVw= X-Received: by 127.0.0.2 with SMTP id ChdiYY1788612xT89n5UN81n; Mon, 11 Sep 2023 15:14:51 -0700 X-Received: from NAM10-DM6-obe.outbound.protection.outlook.com (NAM10-DM6-obe.outbound.protection.outlook.com [40.107.93.85]) by mx.groups.io with SMTP id smtpd.web11.11620.1694470490423670548 for ; Mon, 11 Sep 2023 15:14:50 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LAbdGnhAywRlA/0hlR7mVrpSUmO5A983ciuCQ6sDyBjE6GVuSSSBlWBztiZ6csytgZbvM0iG99zzfP8jyGNBtIXV1i6WqQe0MmFYNbpT31vXpgun1/Ez49ybMhV5ZV1ygCMFNXpoK6h71T6wdUuKIbKDvFqjI+uLMUjuEE17EpdtcW01DXAbUwyqFA9HOaNqIEjAvZGMLvL+78gYPj/Z9jPsUYmQIP/ZLoKGxn61Fr7sc/C/bc6z2dcZ/lgGbVI/rxq5AUmtkuemLcSi9VPy1OXObHOzwrx7ZVe7S3Y6nBBsYn1qIEOHFdqNP7qVOjU4hSlw0trEcQ+tvfb06Gdh5g== 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=HYgbnezxhmq1eH+i2VK7EkvsZkYkRyah0H3WP1Y88o8=; b=IomP3x1/+bqtGvvr/ukI+5zrjW7fq/kCEZR8gnM1NLPRRAW7YJ5EdTw1zoHKTAb6vXSSNDO9KzYjr2viwBikyGPGD7artLhW5xw3TYogDnplD5uD8BDqtH4pbqxuUyrUzAsHJxTqVTCeo+Dv95sNl/Viap073fTdqPW5XCn5Ye4TYyuKjTtsJ/mHlznUxMEl+UAtu5sSdPU7TiMQTD+I/9sgJH+36DWbxbjbRlnPf3Tct/4cY8/W2MxYUPEdiGo+Ib/fxLAkUR8rkrbhZNInXayADS1QWT1d8EpR9NLKrw9p/rCiFCkqWdmvkmeBKWEm4ermoTu4zKY2KMnUa9c6uA== 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 CH0PR04CA0023.namprd04.prod.outlook.com (2603:10b6:610:76::28) by DM3PR12MB9413.namprd12.prod.outlook.com (2603:10b6:8:1af::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.34; Mon, 11 Sep 2023 22:14:47 +0000 X-Received: from DS3PEPF000099DD.namprd04.prod.outlook.com (2603:10b6:610:76:cafe::c7) by CH0PR04CA0023.outlook.office365.com (2603:10b6:610:76::28) 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:47 +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 (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+108502+1787277+3901457@groups.io; helo=mail02.groups.io; 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 DS3PEPF000099DD.mail.protection.outlook.com (10.167.17.199) 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:47 +0000 X-Received: from drhqmail203.nvidia.com (10.126.190.182) 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:38 -0700 X-Received: from drhqmail203.nvidia.com (10.126.190.182) by drhqmail203.nvidia.com (10.126.190.182) 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:37 -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:37 -0700 From: "Jeff Brasen via groups.io" To: CC: , , , Jeff Brasen , "Swatisri Kantamsetti" , Ashish Singhal Subject: [edk2-devel] [PATCH v3 3/4] DynamicTablesPkg: Add support to add Strings to package Date: Mon, 11 Sep 2023 18:07:19 +0000 Message-ID: <117af812665c2e39b2ea75a2695965afb7cc86f9.1694455280.git.jbrasen@nvidia.com> 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: DS3PEPF000099DD:EE_|DM3PR12MB9413:EE_ X-MS-Office365-Filtering-Correlation-Id: c25ccb24-c4b1-4071-bdd7-08dbb3148279 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: r/v943lXsde2gzfCvnHsussl6yM+05atPblAqnHcFdTYFADWT8yaxibGXLTaEojDhbar0jHRXbZGdHFt9aZwlV7XT7wmVDchsFgdF5bVrEBystCUKnoVo00VatXF4hnZGRGP+VInvXLl+sgIsL2rPPgi0FgenLZiDVxIKfHzKZxuSM2+YyPfLMqen9ynHIBZeDbs16DsoYb9jGeOVAyIaTrBgA14ah630jljnOXVSOqHpMeC6S5Q0DZBMBcbLP23zxFr5fPEnt2BTgADoLLNo4BjDiqTec9+Ay66YmRW7v9eFhxiBkt04C5Yq8/Z7NoYc5dn4sTv/pSJpxKy9zvfVf58a0OUh6u6SFkWnAXZVsQFkzmwjyz5FuLJyA33jIK1QGtGnBo1+G04sAaeoe4oNYpzXGFjRSFncyIvKHoG1RK6vAM3MrS3+D5xUKkwBuixRK70Zi1paxe1BmDcKA1jcQgXMswWIyqeOmpJX0c8Va0rOgfBryTUmUp2PqlsOsciRz3ls7HkeLn0dxPmBttRmIB6mm3RATyZh3nF4tQd3rR8ad9xMp9iwdyRO71p2/ZJevUeY/BNVYc9DOPOUk+DQcLBxR8jIqfB0lspSZMSLKHEvdXaWGBJnIv8c+NtYJ9Gob30DJAuk/2fAT22jIun4IxPGqy4Ldi3GDqOUf+wx6TmqtBJPIZFxKtm9ebuZsuMFvA0h1xjn/aaIvo3+YS2XAG2IOQLJ+e14GCWVqnnbHg= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2023 22:14:47.1385 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c25ccb24-c4b1-4071-bdd7-08dbb3148279 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: DS3PEPF000099DD.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3PR12MB9413 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: tkUFwr3iecNaTbrg8aXTtXmyx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1694470496269100013 Content-Type: text/plain; charset="utf-8" Add API to add a String to a package created with NamedPackage API. Bug 4063340 Signed-off-by: Jeff Brasen Reviewed-by: Swatisri Kantamsetti Reviewed-by: Ashish Singhal --- .../Include/Library/AmlLib/AmlLib.h | 17 ++++ .../Common/AmlLib/CodeGen/AmlCodeGen.c | 88 +++++++++++++++++++ 2 files changed, 105 insertions(+) diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h b/DynamicTabl= esPkg/Include/Library/AmlLib/AmlLib.h index b82c7a3ce8..f4a4908753 100644 --- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h +++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h @@ -1472,4 +1472,21 @@ AmlCreateCpcNode ( OUT AML_OBJECT_NODE_HANDLE *NewCpcNode OPTIONAL ); =20 +/** AML code generation to add a NameString to the package in a named node. + + + @param [in] NameString NameString to add + @param [in] NamedNode Node to add the string to the included packa= ge. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. +**/ +EFI_STATUS +EFIAPI +AmlAddNameStringToNamedPackage ( + IN CHAR8 *NameString, + IN AML_OBJECT_NODE_HANDLE NamedNode + ); + #endif // AML_LIB_H_ diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c b/= DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c index 53c537e2d3..d7fec859ef 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c @@ -3677,3 +3677,91 @@ error_handler: AmlDeleteTree ((AML_NODE_HANDLE)CpcNode); return Status; } + +/** AML code generation to add a NameString to the package in a named node. + + + @param [in] NameString NameString to add + @param [in] NamedNode Node to add the string to the included packa= ge. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. +**/ +EFI_STATUS +EFIAPI +AmlAddNameStringToNamedPackage ( + IN CHAR8 *NameString, + IN AML_OBJECT_NODE_HANDLE NamedNode + ) +{ + EFI_STATUS Status; + AML_DATA_NODE *DataNode; + CHAR8 *AmlNameString; + UINT32 AmlNameStringSize; + AML_OBJECT_NODE_HANDLE PackageNode; + + DataNode =3D NULL; + + if ((NamedNode =3D=3D NULL) = || + (AmlGetNodeType ((AML_NODE_HANDLE)NamedNode) !=3D EAmlNodeObject) || + (!AmlNodeHasOpCode (NamedNode, AML_NAME_OP, 0))) + { + ASSERT (0); + return EFI_INVALID_PARAMETER; + } + + PackageNode =3D (AML_OBJECT_NODE_HANDLE)AmlGetFixedArgument ( + NamedNode, + EAmlParseIndexTerm1 + ); + if ((PackageNode =3D=3D NULL) = || + (AmlGetNodeType ((AML_NODE_HANDLE)PackageNode) !=3D EAmlNodeObject) = || + (!AmlNodeHasOpCode (PackageNode, AML_PACKAGE_OP, 0))) + { + ASSERT (0); + return EFI_INVALID_PARAMETER; + } + + 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 exit_handler; + } + + Status =3D AmlCreateDataNode ( + EAmlNodeDataTypeNameString, + (UINT8 *)AmlNameString, + AmlNameStringSize, + &DataNode + ); + if (EFI_ERROR (Status)) { + ASSERT (0); + goto exit_handler; + } + + Status =3D AmlVarListAddTail ( + (AML_NODE_HANDLE)PackageNode, + (AML_NODE_HANDLE)DataNode + ); + ASSERT_EFI_ERROR (Status); + +exit_handler: + if (AmlNameString !=3D NULL) { + FreePool (AmlNameString); + } + + if (EFI_ERROR (Status)) { + if (DataNode !=3D NULL) { + AmlDeleteTree ((AML_NODE_HANDLE)DataNode); + } + } + + 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 (#108502): https://edk2.groups.io/g/devel/message/108502 Mute This Topic: https://groups.io/mt/101303762/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-