From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 5A098AC1B00 for ; Mon, 11 Sep 2023 22:14:52 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=peb1dO2Gz40ZWNGSinV25ib/rhgEAVmyF4/Cp3VMEos=; 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=H5hBHQuYnaxCzWlDQI4nao9hpk4N9fCTdktMxmW8qt/W6Xe+g3pnANxNCrfCY2VOYKFvxaHH Eur/gNeItThG3+vXP/lMtvKsis8WxyPUiKc7tLXJbfrT3w4mLsXqdO6RV/zwFtzcsjbkjV2nFbO 2Ob7VhQHkkyz/k2qpx71XuVE= X-Received: by 127.0.0.2 with SMTP id zIktYY7687511xkcYAya8MUZ; Mon, 11 Sep 2023 15:14:51 -0700 X-Received: from NAM12-MW2-obe.outbound.protection.outlook.com (NAM12-MW2-obe.outbound.protection.outlook.com [40.107.244.71]) by mx.groups.io with SMTP id smtpd.web11.11619.1694470490050079563 for ; Mon, 11 Sep 2023 15:14:50 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bYVmdN3TVLq46CiaJCnwAUXimbv1qMuL70sDeO40z6526Mn+B7tjntDV+mAU6bbBEL0co9SqtNCHkXAentsdzE0rGM6cmFnInuRmjBFP76U1CVIA30JC63LARi5AWffkocr9yN7UZpsAwtqO1asjPYNcUCTOluR6xrAj2yrBGraZ285EGr4zkWtyTq16BykgCUhWb0+DbZWdnZewc6JzfE1uRAnoy1VFxN2HE7Sr3xxIsivKwYMGpntOO8jJXnt3fIOPknQzxR+eTe1inLKohI+yj0zKVZ0udZsnMyCOsBhZY7eAt1pLdbDZv0vpGzZIlMbfLauwHhspEspwE2KyLw== 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=/tpitnoNIkusYPr9vOikcbBGomWdpldW/ITS6TyUwsI=; b=WyWFsjIfqfvxFCd7VF/oPr+bW/TgdREx/wM+t75zTD1ROErZJhzdMO/oeeSZ7EEIuKFD/v1+onprsgDTB7m63TVeDCEEx+6jzWj0aGokM/NG+MesN4eLx6Ao7WAmAAn0y6NW3HW7+p9IVlVpKcu3L83RWtAeHsAWaTgY7p17jdBa2ZG+YJLRgeW9JZZlA9meLZZPEkcgXT3LyxnbF9hVlMXGnj+JmYUJSKh//I97kewwCXTDF6k0DV/brtSCY0SapXJyplFoJJ0L6it63bdrAv52PJh2Q6dFu4gTUhlCR8sSSmyA7BVYjszRXbG8COI7m6zCEgknXoDvUPpNPHH+FA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) 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 MW2PR16CA0070.namprd16.prod.outlook.com (2603:10b6:907:1::47) by SA3PR12MB7903.namprd12.prod.outlook.com (2603:10b6:806:307::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.34; Mon, 11 Sep 2023 22:14:46 +0000 X-Received: from CO1PEPF000042A9.namprd03.prod.outlook.com (2603:10b6:907:1:cafe::d7) by MW2PR16CA0070.outlook.office365.com (2603:10b6:907:1::47) 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:46 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) 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.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C X-Received: from mail.nvidia.com (216.228.118.233) by CO1PEPF000042A9.mail.protection.outlook.com (10.167.243.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.17 via Frontend Transport; Mon, 11 Sep 2023 22:14:45 +0000 X-Received: from drhqmail203.nvidia.com (10.126.190.182) by mail.nvidia.com (10.127.129.6) 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:39 -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:38 -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:38 -0700 From: "Jeff Brasen via groups.io" To: CC: , , , Jeff Brasen , "Swatisri Kantamsetti" , Ashish Singhal Subject: [edk2-devel] [PATCH v3 4/4] DynamicTablesPkg: Add Aml NameUnicodeString API Date: Mon, 11 Sep 2023 18:07:20 +0000 Message-ID: <94ca3b37c4d11a9b3a754f2203a0f0f46cf90324.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: CO1PEPF000042A9:EE_|SA3PR12MB7903:EE_ X-MS-Office365-Filtering-Correlation-Id: e32ef676-ad64-4835-ad2e-08dbb31481aa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: 69oR0eV1v8hwg5JxfW1kPuQZW6djTwRxrwgulOgzz+VnEVRHVBOjGGq8IXZY3s7PnqSvpdj/Clwt7ATlmm/5OOYuUO7SczSJmAxxba8qYQp2JT0WNEoiwroYeoaQXm5zLVUtbruzQo7jHz3izV+AK4sbkGn0uf7B57zcmsVkrY+p+fxeLFZvbtYm7z0KBJ/OvF0iSYgaH34AAbJ51yy77RA67fnWaGvgy0/S71kbU8hrNQiCAKCDNGXBavzA7xyQWi9vPQLBB/utqG57LT0BVNUE4cCABMfIeoqH/g8jNIbvUaqk8KHXY04QnOewsmjD3PJKcqx9ALLqUcJ+AD3Ihxw3gwrjKz9knwyhFI7yulQqxaxgTCUXaZF0AiU3m3HClyH3z+sQ+xAhBP/Gbay3UH2xsDHT8mYy0j57EXFu1Giw8mFi/B9tLqY8lnMB8xL2MJDQLS6zUz3SQbxXqh1VznP348SJjva/12mN++UaWGzHGF7gcO4bBgiZT6lsC6kJdjPJ4QDqshcyMnECoFHfr9AEupNJQz/WQloxByw3BALJpZBMu5LC0gST0qq2gyMe/VJSs1mxxujkK/G/QEmJVCggZDU5SJTM8FRmJ9eoH0l/OnNUERf9I+wAsDyuJRc+HJ4YK+OBuk9jHEQiDZRo9Of9FdZBunkRMG6PeJuU5/LAxY7YHZ9w0l7/dvm04yrdgIBa3j+SqkGm74w7R9QqpmMQ0rWY8XSEkCRUT7jhwkSA+psgimqwLxr/hvMa6FdN X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2023 22:14:45.8283 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e32ef676-ad64-4835-ad2e-08dbb31481aa 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.233];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000042A9.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB7903 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: JaHyhM3lmROZjOuAH50ZTmXpx7686176AA= 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=20140610 header.b=H5hBHQuY; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}"); dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io Add API to generate a Name that contains a Unicode string buffer. Bug 4063340 Signed-off-by: Jeff Brasen Reviewed-by: Swatisri Kantamsetti Reviewed-by: Ashish Singhal --- .../Include/Library/AmlLib/AmlLib.h | 31 +++++++ .../Common/AmlLib/CodeGen/AmlCodeGen.c | 86 +++++++++++++++++++ 2 files changed, 117 insertions(+) diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h b/DynamicTabl= esPkg/Include/Library/AmlLib/AmlLib.h index f4a4908753..e0dc1340ab 100644 --- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h +++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h @@ -958,6 +958,37 @@ AmlCodeGenNameResourceTemplate ( OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL ); =20 +/** AML code generation for a Name object node, containing a String. + + AmlCodeGenNameUnicodeString ("_STR", L"String", ParentNode, NewObjectNod= e) is + equivalent of the following ASL code: + Name(_STR, Unicode ("String")) + + @ingroup CodeGenApis + + @param [in] NameString The new variable name. + Must be a NULL-terminated ASL NameString + e.g.: "DEV0", "DV15.DEV0", etc. + The input string is copied. + @param [in] String NULL terminated Unicode String to associate = to the + NameString. + @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 +AmlCodeGenNameUnicodeString ( + IN CONST CHAR8 *NameString, + IN CHAR16 *String, + IN AML_NODE_HANDLE ParentNode OPTIONAL, + OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL + ); + /** Add a _PRT entry. =20 AmlCodeGenPrtEntry (0x0FFFF, 0, "LNKA", 0, PrtNameNode) is diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c b/= DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c index d7fec859ef..0eba254193 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c @@ -869,6 +869,92 @@ AmlCodeGenNameResourceTemplate ( return Status; } =20 +/** AML code generation for a Name object node, containing a String. + + AmlCodeGenNameUnicodeString ("_STR", L"String", ParentNode, NewObjectNode= ) is + equivalent of the following ASL code: + Name(_STR, Unicode ("String")) + + @ingroup CodeGenApis + + @param [in] NameString The new variable name. + Must be a NULL-terminated ASL NameString + e.g.: "DEV0", "DV15.DEV0", etc. + The input string is copied. + @param [in] String NULL terminated Unicode String to associate t= o the + NameString. + @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 +AmlCodeGenNameUnicodeString ( + IN CONST CHAR8 *NameString, + IN CHAR16 *String, + IN AML_NODE_HANDLE ParentNode OPTIONAL, + OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL + ) +{ + EFI_STATUS Status; + AML_OBJECT_NODE *ObjectNode; + AML_DATA_NODE *DataNode; + + if ((NameString =3D=3D NULL) || + (String =3D=3D NULL) || + ((ParentNode =3D=3D NULL) && (NewObjectNode =3D=3D NULL))) + { + ASSERT (0); + return EFI_INVALID_PARAMETER; + } + + Status =3D AmlCodeGenBuffer (NULL, 0, &ObjectNode); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + return Status; + } + + Status =3D AmlCreateDataNode ( + EAmlNodeDataTypeRaw, + (CONST UINT8 *)String, + StrSize (String), + &DataNode + ); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + AmlDeleteTree ((AML_NODE_HEADER *)ObjectNode); + return Status; + } + + Status =3D AmlVarListAddTail ( + (AML_NODE_HEADER *)ObjectNode, + (AML_NODE_HEADER *)DataNode + ); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + AmlDeleteTree ((AML_NODE_HEADER *)ObjectNode); + AmlDeleteTree ((AML_NODE_HANDLE)DataNode); + return Status; + } + + Status =3D AmlCodeGenName ( + NameString, + ObjectNode, + ParentNode, + NewObjectNode + ); + if (EFI_ERROR (Status)) { + ASSERT (0); + AmlDeleteTree ((AML_NODE_HEADER *)ObjectNode); + } + + return Status; +} + /** Add a _PRT entry. =20 AmlCodeGenPrtEntry (0x0FFFF, 0, "LNKA", 0, PrtNameNode) is --=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 (#108501): https://edk2.groups.io/g/devel/message/108501 Mute This Topic: https://groups.io/mt/101303761/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-