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 D410C941B77 for ; Mon, 18 Sep 2023 15:47:31 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=N3gskhmsnJ45lmmK2N7GOPKgLwh6NeI5USmpQ3unUHE=; 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=1695052050; v=1; b=hOHae0BLMaAzwrdE4oWktrqUqPKHGLXAD6E5k4JYT4bsZV7zuLWj85M8JeEfeZthCm0TvGfX cyh65VYdkBohXdmPoYkkEAQ98wA/6scGXD2lUH51Eij4ydr5WLHKc3k9ttxDNG18uRL28ESTDjk hXoIEwypmEcOtH/LEOLDkPlY= X-Received: by 127.0.0.2 with SMTP id uEy3YY7687511xTUsRoOQrcU; Mon, 18 Sep 2023 08:47:30 -0700 X-Received: from NAM12-BN8-obe.outbound.protection.outlook.com (NAM12-BN8-obe.outbound.protection.outlook.com [40.107.237.46]) by mx.groups.io with SMTP id smtpd.web10.54930.1695052049662953113 for ; Mon, 18 Sep 2023 08:47:29 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Kk8ywUlEqqKPMb/XfQj+uHp5du92Zvt7RcrtJi4+xM0q+vr6hSDHMmnzoVlcEFGkv/ipl0QT0uNWhqhUZIPeb7MNEXjLao8+6vH9kTH6BDcxRwcBZmtM1IuNBRnC0dKYI6+2gOCxcr+pWr1J8406LsFQCL1R3XtUul/b9he3kz+8lLlEqJTNkuzeLu6n0GfYGxwloQni/TIdTgdZARkpY11VbbOEWkCMdx56PBhxPaQRTzlJaQNTL81qVRH2bw05hbXcQia3usQAptVGWWiQex0aH64zE93eveTbH+LQmte15HWz/AGs2safJkGTkk8GyBP9vlLGGfrnfL+c5kAeLA== 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=ApMw6u8u2Zm3Gr5prtJX+nkfgB5KokdtJlewCIPQ3Y0=; b=FllMj0Bx9eMOJecGuwUX03ACMHO9YCovP/gAM7sTnkgD7ulBOk56yODtei5TbVmvo1JhpCfYBGoQVIOaLCD/f6mmVsKTUKi8g08sZ1HWkwxgHfgZd/jLBjFw8e3lEwzbIM0irSgwlaWfKafD5Jgy7LxePTTV6IF75pSmEUCB+K2HlH3ICKaHb4Gf7GlAJz3c7nJ46CfxgKgYWk3O07KtWj5x5hBbb4RkP6nHPfbXMSmtLFwGEJ5OughxCPWXkTDb6KQHDp4fuU5UA3N0Cu+C5TIdU9Ucw7ImRPULXkpBewnNkUGXjW4amXgi3TbbFF/wcojGscDZxQ96PGz+oYJJTQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) 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 BL1PR13CA0260.namprd13.prod.outlook.com (2603:10b6:208:2ba::25) by DS7PR12MB6095.namprd12.prod.outlook.com (2603:10b6:8:9c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.26; Mon, 18 Sep 2023 15:47:25 +0000 X-Received: from MN1PEPF0000F0E3.namprd04.prod.outlook.com (2603:10b6:208:2ba:cafe::6d) by BL1PR13CA0260.outlook.office365.com (2603:10b6:208:2ba::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.27 via Frontend Transport; Mon, 18 Sep 2023 15:47:25 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C X-Received: from mail.nvidia.com (216.228.117.161) by MN1PEPF0000F0E3.mail.protection.outlook.com (10.167.242.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.20 via Frontend Transport; Mon, 18 Sep 2023 15:47:24 +0000 X-Received: from rnnvmail202.nvidia.com (10.129.68.7) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 18 Sep 2023 08:47:06 -0700 X-Received: from rnnvmail205.nvidia.com (10.129.68.10) by rnnvmail202.nvidia.com (10.129.68.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 18 Sep 2023 08:47:05 -0700 X-Received: from 82ca859bd651.nvidia.com (10.127.8.9) by mail.nvidia.com (10.129.68.10) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Mon, 18 Sep 2023 08:47:05 -0700 From: "Jeff Brasen via groups.io" To: CC: , , , , , Jeff Brasen Subject: [edk2-devel] [PATCH v4 4/4] DynamicTablesPkg: Add Aml NameUnicodeString API Date: Mon, 18 Sep 2023 15:47:00 +0000 Message-ID: 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: MN1PEPF0000F0E3:EE_|DS7PR12MB6095:EE_ X-MS-Office365-Filtering-Correlation-Id: 62607423-ba9d-41c4-35c6-08dbb85e8ddc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: RpnQT7QZ41/s4bm2urFcEfJ7Oyga3MPi23tXABzTkCDDLcH9NY9kqKAv1aJyrsEq+ozpdGG57xGUo0SMiuAqoYHWqhhm4iWeddEUS4gsEX2p/61Kn+JGiHLY8dCGkeZgmOu6GMcfPbuj2Ehgnk8zKZ6u4CCQcDREz8KJlKe4GUQVtPLLtjdB/IGQd0hzxbO8LKySfvR/G+r6uEW1S+CN7hE06mC8eUfbVZiWsZ5lv8NMpKB2dw8fFOiC5ZH0NoH9DbFPYwWVYEKLr3UXfv9Si91TatAsNMZgpSKg9/hpFXPT++ZgrpLzdFq4ko0jsalL9K0GqxdZ7Tkd61R8blHfMP+8BPbJ8AHioireLLwf2MueoiWqBF39gyE52IjYAhD+IpvoBlEHes2Kw4vvsJ1bTygM/YcmyIK0+oG/d+Vo78dGhAY+n27U3jSkTKMDd0jn6C1CsuIRJyz/GTWZBaZ2eeY6AHHwQcMUzYG/+Xmf0gZi8zlDh+cCL1tFeh0gbbwiEPc1hNjhCSwzPHw7mlEed+tjtqX8smcvtbrNuduFPvktQ3QXNX4Qxxgwv2LWNbnJOy26lJvrMQeln58Fo1gaL24MD/TRs0XfUaslIdrWnxG62zpSLfKMP/513ZXYyld75Hk+noW+hEapkuYxnOUQJ2tjjpB/SRWVtKHBwL365jX7YTFDVaWOl0pFuJpedbckVDvH7hI2aD1PT5ZQjO+BOpCKZSIu9NifAwPtHpQe33ffw8s6wRzDFtC3RAj9T1SA X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Sep 2023 15:47:24.7637 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 62607423-ba9d-41c4-35c6-08dbb85e8ddc 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.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: MN1PEPF0000F0E3.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB6095 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: rSHnfnNUhYxHsKjj4rdFx7Dvx7686176AA= 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=hOHae0BL; 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. Signed-off-by: Jeff Brasen --- .../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 2afd405750..51eece5958 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 (#108803): https://edk2.groups.io/g/devel/message/108803 Mute This Topic: https://groups.io/mt/101436339/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-