From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (NAM02-SN1-obe.outbound.protection.outlook.com [40.107.96.55]) by mx.groups.io with SMTP id smtpd.web10.103.1688079739011282977 for ; Thu, 29 Jun 2023 16:02:19 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nvidia.com header.s=selector2 header.b=RRJg50W7; 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.96.55, mailfrom: jbrasen@nvidia.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XuV6ouPKzEfTYqyXh4rHfUMnEpIGbdA5LUnwbayvfLTeIId/vqql4G68hlamXdNLttUJtXDTn/N25jTtVZDEydcf3h/CWGy2moPAxS7wsera6MJRsTtvQ6dUxP2DtRNE3Sl3p2Elh2B0yCvBS2cRMRKUnbUv3e1Cn8VGhpRDbVqCy2RxoiloExO2Cf39l3ZUmj0eulViPpF1nsuF1rRhDOPQiY5S5mnG62eIzW5KVux3D28KVtozKk1+0Brgl2eZW68jfYC9P39l76bWbRFE3udkoVQB8bG/K/cSUmiZWPs5/Lptd2MN7d8sLuhQbELicAZG+9x+XHrUKLsztFE10g== 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=TNXvHSJ2I5MRdtQJe8CzBoOmfqtrIP7cT4M0HxDKhsY=; b=EvDiP68YxB7+OVBp5nJpZGkBPSTQt+38fr6wjoSaJNP2va4picDtUKD8sUH3w+XG3un/KXtfi32fwM8wYt0VxAgZpxiNisZdkLVwlOiRmlxnrUwPZmOjYD5n0GGRtxd4bXPa48BwyjloV+KJBp8+z3HZ3ieHhf0eSJm8pbpHvEC0azV37P7hxcybfFLr9wWxjU9WnKZGS64aIisqRWW8h5ccWihGUTmjZ30j7pgHyVqM0RfCEK6etRWx/EFbKPiXeZp2rGju/vK06YxHBHs/Az2kKok8clSG38LkiOZUIsqJgF/z6kQLwgMx9rsYYLWV6Z36aLKunibJ+07/bO8/NQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) 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=TNXvHSJ2I5MRdtQJe8CzBoOmfqtrIP7cT4M0HxDKhsY=; b=RRJg50W7BhMtQOPgaSQ8CaqrJ+fI4Ep0xQNhrYyL0Hpd3h/PAvfOj6nfHaO55uCVRavHNlMXNoTd8PItimG30/eYa0vPBLIjFTCkSXs7FuenxEhC0lH6h8yBb4vFljax5GL3YmHxQkTmLbE0oa6qwRN31DdvQwD20gIiZGj0djuJbfWy++YNuOV49cHhJ1iCD2tsfvmxp5+WLy9inaHE2DK6VRa99B55MZgf9b3E8PqHOpa24y8fh+lrQgM9Exm3Ro8DrmPHS7Ja/EbOmd+qg33ZbM3848GRe8sOLgNSR6k9RRy94WaSEO0qNyYSTyXToapxgz8EsghE9Jvjx+I0tQ== Received: from BN0PR04CA0091.namprd04.prod.outlook.com (2603:10b6:408:ec::6) by CO6PR12MB5410.namprd12.prod.outlook.com (2603:10b6:5:35b::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.19; Thu, 29 Jun 2023 23:02:14 +0000 Received: from BN8NAM11FT061.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ec:cafe::df) by BN0PR04CA0091.outlook.office365.com (2603:10b6:408:ec::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.22 via Frontend Transport; Thu, 29 Jun 2023 23:02:14 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) 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.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BN8NAM11FT061.mail.protection.outlook.com (10.13.177.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.50 via Frontend Transport; Thu, 29 Jun 2023 23:02:14 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Thu, 29 Jun 2023 16:01:59 -0700 Received: from rnnvmail205.nvidia.com (10.129.68.10) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Thu, 29 Jun 2023 16:01:59 -0700 Received: from 6cd8174ac25c.nvidia.com (10.127.8.9) by mail.nvidia.com (10.129.68.10) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Thu, 29 Jun 2023 16:01:58 -0700 From: "Jeff Brasen" To: CC: , , , Jeff Brasen , "Swatisri Kantamsetti" , Ashish Singhal Subject: [PATCH 3/4] DynamicTablesPkg: Add support to add Strings to package Date: Thu, 29 Jun 2023 23:01:48 +0000 Message-ID: <407dc3cb79752a0a49fc06d8b85abd91733cb360.1688079404.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: BN8NAM11FT061:EE_|CO6PR12MB5410:EE_ X-MS-Office365-Filtering-Correlation-Id: 4afa61f2-9143-434f-1543-08db78f4e0f4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: R72rTCcL+rz/jY1Qt68FK12Xx84FeGbPldUQ1xbSwxVuPvRRMhm8XqRzU2oibuTyGUwIHWNRk5gnTOZgh1Uy2OWNl9Cmumw2kLzuxvhSRoA8iNTH55VMscY8Ck45FQfPeqBitkWwVPbs7/4EgVGTObNRzeYvF2vxaAYLY97Af3cX/tqE/hXiVa5xdS7nyB8npNTzypWmZ7qr1HVFhzJoQs4Sue/OHh4j3nhi+o5Br+VEvYywXnwnU7I5o1rHdjWiMsk6xyFHPCDBTLDFNqggYnuOjvmSSZkv7lievPHDi3FN0ZIbTWn8fB5z/VUCUaG2l7ey5opNxXQiyjWQRcqzL/p/fHQJxCHPnK8LLuRBFu47r+5gqM4V1x0BJ/EAaLD3dgSqz0dgydbeRWpizaITooOwQuNsMvAZG5hJqxjdNTeg7QKN8ZGDPv3IOhOjgxQ6fHfZ/E0DtBfeL8yas3PilRKHKV0XE8k+3aA9kjhQzwAQYCoxjB+xZeSR886MFZwFgwt5itaYlloZ47tNgbCaimikcvEmjyyO4SlwpheDr1LrFEEDA4h0MWOdQArSZBOEUmPrKkUcp5uhf3DYKPxoS49lIDg5MoKo7AtV9NEB6M85N6bYJMe9XfePttb5Ru97vih8LGB6ctYex/Dk9pV9exOEihKbHD+h7clXgf8x2dpToAAAC00w/RyG48AZ1FPp/zIyP2s/pE9+M99w6Sh0jMcOinkrq482G+Gucoqnm5Q= X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230028)(4636009)(396003)(39860400002)(376002)(346002)(136003)(451199021)(46966006)(40470700004)(36840700001)(40460700003)(41300700001)(316002)(83380400001)(82310400005)(426003)(336012)(36860700001)(86362001)(186003)(26005)(2616005)(2906002)(82740400003)(356005)(7636003)(40480700001)(47076005)(5660300002)(107886003)(36756003)(8676002)(8936002)(478600001)(54906003)(19627235002)(70206006)(70586007)(6916009)(4326008)(6666004)(7696005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jun 2023 23:02:14.2315 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4afa61f2-9143-434f-1543-08db78f4e0f4 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.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT061.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR12MB5410 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain Add API to add a String to a package created with NamedPackage API.=0D =0D Signed-off-by: Jeff Brasen =0D Reviewed-by: Swatisri Kantamsetti =0D Reviewed-by: Ashish Singhal =0D ---=0D .../Include/Library/AmlLib/AmlLib.h | 17 ++++=0D .../Common/AmlLib/CodeGen/AmlCodeGen.c | 82 +++++++++++++++++++=0D 2 files changed, 99 insertions(+)=0D =0D diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h b/DynamicTabl= esPkg/Include/Library/AmlLib/AmlLib.h=0D index b82c7a3ce8..043e7ee901 100644=0D --- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h=0D +++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h=0D @@ -1472,4 +1472,21 @@ AmlCreateCpcNode (=0D OUT AML_OBJECT_NODE_HANDLE *NewCpcNode OPTIONAL=0D );=0D =0D +/** AML code generation to add a string to the package in a named node.=0D +=0D +=0D + @param [in] String String to add=0D + @param [in] NamedNode Node to add the string to the included packa= ge.=0D +=0D + @retval EFI_SUCCESS Success.=0D + @retval EFI_INVALID_PARAMETER Invalid parameter.=0D + @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +AmlAddStringToNamedPackage (=0D + IN CHAR8 *String,=0D + IN AML_OBJECT_NODE_HANDLE NamedNode=0D + );=0D +=0D #endif // AML_LIB_H_=0D diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c b/= DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c=0D index 2b95839e4c..a0d01032d5 100644=0D --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c=0D +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c=0D @@ -3665,3 +3665,85 @@ error_handler:=0D AmlDeleteTree ((AML_NODE_HANDLE)CpcNode);=0D return Status;=0D }=0D +=0D +/** AML code generation to add a string to the package in a named node.=0D +=0D +=0D + @param [in] Name String to add=0D + @param [in] NamedNode Node to add the string to the included packa= ge.=0D +=0D + @retval EFI_SUCCESS Success.=0D + @retval EFI_INVALID_PARAMETER Invalid parameter.=0D + @retval EFI_OUT_OF_RESOURCES Failed to allocate memory.=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +AmlAddStringToNamedPackage (=0D + IN CHAR8 *String,=0D + IN AML_OBJECT_NODE_HANDLE NamedNode=0D + )=0D +{=0D + EFI_STATUS Status;=0D + AML_DATA_NODE *DataNode;=0D + CHAR8 *AmlNameString;=0D + UINT32 AmlNameStringSize;=0D + AML_OBJECT_NODE_HANDLE PackageNode;=0D +=0D + DataNode =3D NULL;=0D +=0D + if ((NamedNode =3D=3D NULL) = ||=0D + (AmlGetNodeType ((AML_NODE_HANDLE)NamedNode) !=3D EAmlNodeObject) |= |=0D + (!AmlNodeHasOpCode (NamedNode, AML_NAME_OP, 0)))=0D + {=0D + ASSERT (0);=0D + return EFI_INVALID_PARAMETER;=0D + }=0D +=0D + PackageNode =3D (AML_OBJECT_NODE_HANDLE)AmlGetFixedArgument (=0D + NamedNode,=0D + EAmlParseIndexTerm1=0D + );=0D + if ((PackageNode =3D=3D NULL) = ||=0D + (AmlGetNodeType ((AML_NODE_HANDLE)PackageNode) !=3D EAmlNodeObject) = ||=0D + (!AmlNodeHasOpCode (PackageNode, AML_PACKAGE_OP, 0)))=0D + {=0D + ASSERT (0);=0D + return EFI_INVALID_PARAMETER;=0D + }=0D +=0D + Status =3D ConvertAslNameToAmlName (String, &AmlNameString);=0D + if (EFI_ERROR (Status)) {=0D + ASSERT (0);=0D + return Status;=0D + }=0D +=0D + Status =3D AmlGetNameStringSize (AmlNameString, &AmlNameStringSize);=0D + if (EFI_ERROR (Status)) {=0D + ASSERT (0);=0D + goto exit_handler;=0D + }=0D +=0D + Status =3D AmlCreateDataNode (=0D + EAmlNodeDataTypeNameString,=0D + (UINT8 *)AmlNameString,=0D + AmlNameStringSize,=0D + &DataNode=0D + );=0D + if (EFI_ERROR (Status)) {=0D + ASSERT (0);=0D + goto exit_handler;=0D + }=0D +=0D + Status =3D AmlVarListAddTail (=0D + (AML_NODE_HANDLE)PackageNode,=0D + (AML_NODE_HANDLE)DataNode=0D + );=0D + ASSERT_EFI_ERROR (Status);=0D +=0D +exit_handler:=0D + if (AmlNameString !=3D NULL) {=0D + FreePool (AmlNameString);=0D + }=0D +=0D + return Status;=0D +}=0D -- =0D 2.25.1=0D =0D