From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (EUR01-DB5-obe.outbound.protection.outlook.com [40.107.15.44]) by mx.groups.io with SMTP id smtpd.web08.64704.1643813606687470692 for ; Wed, 02 Feb 2022 06:53:27 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=NmqYIYcz; spf=pass (domain: arm.com, ip: 40.107.15.44, mailfrom: sami.mujawar@arm.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QPNNVQn9ugzEsJN3tsYVSeUYkg12VhHdXoMsteIiwgc=; b=NmqYIYczJ4pqi7p3FZMRnE96GOXqaYsFwP3NjXKEMuTLRkvXJTAek4kKVt8MGJpy4SrgvIAyXekTm+fgWtKITKkZr8sHOqlrYaMyDFxaeg3iySwjAg8WrPD3lj30fqYON4bK0v8grrPgsZlDXGAt/m4DVDm4gtxh955eqV4WFHg= Received: from AS9PR06CA0204.eurprd06.prod.outlook.com (2603:10a6:20b:45d::30) by VE1PR08MB5711.eurprd08.prod.outlook.com (2603:10a6:800:1ae::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.18; Wed, 2 Feb 2022 14:53:23 +0000 Received: from AM5EUR03FT026.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:45d:cafe::5c) by AS9PR06CA0204.outlook.office365.com (2603:10a6:20b:45d::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4951.11 via Frontend Transport; Wed, 2 Feb 2022 14:53:23 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT026.mail.protection.outlook.com (10.152.16.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4951.12 via Frontend Transport; Wed, 2 Feb 2022 14:53:23 +0000 Received: ("Tessian outbound 31aeb3346a45:v113"); Wed, 02 Feb 2022 14:53:23 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: a58fe811dd86e08a X-CR-MTA-TID: 64aa7808 Received: from 8830f49711e2.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 6A92FF5A-435E-47E1-8EEA-FE4D3CEAFDFB.1; Wed, 02 Feb 2022 14:53:16 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 8830f49711e2.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 02 Feb 2022 14:53:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CKNHZBldHQQNw+RVz7GElfUgBXSANG7MVoVO+1u+7l1ILJZR2vY3Q2wiqQnO6O2/TNEw07BomVYx2cbgGPU6qsOJfsdGBJVTsaQgrNfUI/GML9BFu7T8XwlPPNbQ1J7g+R6adxfjip6CMSUpOnyw9BVllTXh5/EuiIM9FUj6PmMP9AcJNkpr1D7lPWDQijFvHi9iNjORPx0eLzBWv3W0Pr3QV7b2QUGVT6SdyohdstjfRUtYc1Xn7paIFqp7ZkOhxyi4HCpbmLpevSb2XAHkZ+TebTUKHxnQmYk84ejN7eHeeoOXBf+/IjSspbXPzv5NUBd3uO63q8Ew4VLv2zO5oA== 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=QPNNVQn9ugzEsJN3tsYVSeUYkg12VhHdXoMsteIiwgc=; b=I0yIMdUqUxDVe8X32dTI9qr9VLDGX3/4M69RucIUfNrd70Vfq70UFvFvKlvBrqwCbsSQmOEi2ChjtEbUKx4qmWoDLtG8HC+x/qsk2OiFAxEwqJnW4+c3TLM+ReSqv49REoXlvP494gUj6lfwRadKdTvUdhjyYRCRSrCYQDPKOA1IjcAnU5cZ8nYOF+hUFoQYjkC/EaD7+qgHJZ9ad6iTwk2HAp8THIPY714ksoZBjPs5d/+TvOOFEkbFOk1GcWyTNkCQHucfPnlw3BWiJr4gk2l4/moJAnW+0z74XbPZPsKskeP0AueHkeiwriVL0p9cI0He8DRrpgqI1f1yXosURg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QPNNVQn9ugzEsJN3tsYVSeUYkg12VhHdXoMsteIiwgc=; b=NmqYIYczJ4pqi7p3FZMRnE96GOXqaYsFwP3NjXKEMuTLRkvXJTAek4kKVt8MGJpy4SrgvIAyXekTm+fgWtKITKkZr8sHOqlrYaMyDFxaeg3iySwjAg8WrPD3lj30fqYON4bK0v8grrPgsZlDXGAt/m4DVDm4gtxh955eqV4WFHg= Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from AS8PR08MB6806.eurprd08.prod.outlook.com (2603:10a6:20b:39b::12) by AS8PR08MB7025.eurprd08.prod.outlook.com (2603:10a6:20b:34c::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.20; Wed, 2 Feb 2022 14:53:14 +0000 Received: from AS8PR08MB6806.eurprd08.prod.outlook.com ([fe80::34b6:4579:9e43:6b95]) by AS8PR08MB6806.eurprd08.prod.outlook.com ([fe80::34b6:4579:9e43:6b95%8]) with mapi id 15.20.4909.019; Wed, 2 Feb 2022 14:53:13 +0000 Subject: Re: [PATCH v3 3/3] DynamicTablesPkg: Add AmlCodeGenMethodRetInteger function To: Rebecca Cran , devel@edk2.groups.io, PierreGondois , Alexei Fedorov , Leif Lindholm , nd References: <20220113164052.20841-1-quic_rcran@quicinc.com> <20220113164052.20841-4-quic_rcran@quicinc.com> From: "Sami Mujawar" Message-ID: <3a153d35-2509-ad08-3651-f96b411c053e@arm.com> Date: Wed, 2 Feb 2022 14:53:14 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.0.1 In-Reply-To: <20220113164052.20841-4-quic_rcran@quicinc.com> X-ClientProxiedBy: LO2P123CA0093.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:139::8) To AS8PR08MB6806.eurprd08.prod.outlook.com (2603:10a6:20b:39b::12) MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 1bbc98e7-195c-4657-f0b9-08d9e65bc2b8 X-MS-TrafficTypeDiagnostic: AS8PR08MB7025:EE_|AM5EUR03FT026:EE_|VE1PR08MB5711:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:9508;OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: TyHqUkwukW7ZhXVos1a77amcvFZZ/mhK7m69oPS6pOVVNFDBvD6Jk9jsLrnB4ff2UEtZV31eoyFfPsmJXHkpxenmQgbCTpGvk/0lciNoHHTbr4CugvlcnQ/f2gb2gQXUyuMpkr+BcGRJVlc9yjOkSWsVw3DxNQWn0dJCbBsJfwF1+mgZbg7DfHjVbRGjcXXDmTLQu3NtbNB22eCDUGRZfu9sRN16N80JKhOQm/UECdjsDkRBVp8juzc4buJotSOMKMQ4WFxTX9929BNZPhSlr9SuE0c3YTAmm5a5WpOzVVxVpr6mN9JkCjzAhebE1O3OrHWjj+VVKgFhEuy2ynCkyKWrr6LDnZodeoDvPYCsJ/Z2cfs2nToN56vVKmQiGP9I9pUy1ibonh1hRFdcDMJMye7Ts0jVTSymttpBTA5y+GbYCvG9Iad7vI7R0xtwYarrOPufX5zB4E+xDxfYCOMFH4DMGuTLYYds7ZUj/S/mqKbjpB+/EmsyWl0yCdfZQxXz9LIMx09/FLMfACh87mdtYIzLRgxEovCalMN9IWLvwfJaVBBlEaRc/8kvraYgZpZ8VcpNj4WAzcIwBSsnK8L9g2S3IXOjrdqDcoCvIuSUBV9lPNgp+2SPlJIGAXx74mY9zunU800kUTgktP3OBqFT+MXTub5Gx18qNapBtTsIJc4KwPO8XRyFT37QKcH83O0aFBXBxU5Gd1oHOBJRFPchtwAMuK1CTAiXUxVEEl7ljfjOyedr+2v0UsJcDqXCjJWOgFXVPWiwLcuDOHwEXwLr4UXHESImUuxuJ2Ybt1nwAc8= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR08MB6806.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(66946007)(66556008)(8936002)(110136005)(2906002)(66476007)(2616005)(83380400001)(8676002)(186003)(44832011)(5660300002)(86362001)(52116002)(31696002)(26005)(6486002)(36756003)(38100700002)(6636002)(316002)(508600001)(6512007)(6506007)(31686004)(38350700002)(53546011)(213903007)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB7025 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Return-Path: Sami.Mujawar@arm.com X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT026.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 7c4f9c89-84ed-4fa1-4f3f-08d9e65bbd00 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Me1wk2jgakMo3oAz6/0DlgeEQw2cPk6gHwVx5xMaxXs7a2GoMRZ9knN7NkK1PYlSssvwDUp18gw6ABNGwD7Cyc4BUnnssGDmhcu/s/hxXZLeEcYT9s2rx9JGuyqmDgATrUiydY5Ojdq1CdMk+Ae48YeYsEbZgQE0SFRKz9jBZYTmUGJVTCHLx5VFnkxV7Ak1arGM/52+d8+vwUv4qPgVMUbfmiMC0nCceSFgiQT0HlYJA/HDPPoTsgRwQ6rKBwo/AU1Rod0E2M+7iCDvTaSTU5N1PdfpD70fSZSJlV3lQDWf2d7XGgIGfnqx1tFwQ8Nq4lPD7u//ROnjDBLmNsGKZrGvmXWmjT1531ieaTKT/UMciE6Xgn0nILviiM79lQJRbe9Ea32I4O2+OSf8XGdm+MkozwKeppgyySDYcWwR5zj3qsmAxP6OaGqn/ebsp8vlqvMOFwDLWE7zuGbAoNsGpn8yIXOuy7l80Kin1poaekT8JtDfu+v+YPXpaVHGPZh4wio2vmwgDyijYwAfbDjS5xmVYkWARDw6ajFwyZgcR6WTQnZW2YbFwk0Pz3NAPDDM/tUq/Knydj6cCUjOngokhAeJKXwjQTy49Ch9bLNXR2d9tvQ3EMa7Y0oQ6gig8xAIzbcCuxlAnbwztxax8XS7tFDAZkwG1oajsgjc5YYinws057eSSEbhgSb5SZKbfptNYtzhyoRIpY5t75oX0/9x/YdZUkV1nctIhuMQWAb9b4zJLn3Uq8eFxRud1zCf03aP X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230001)(4636009)(46966006)(40470700004)(36840700001)(508600001)(8936002)(5660300002)(40460700003)(82310400004)(6506007)(53546011)(70206006)(70586007)(6512007)(44832011)(186003)(2616005)(26005)(2906002)(31696002)(6486002)(81166007)(86362001)(36860700001)(356005)(8676002)(316002)(6636002)(110136005)(336012)(83380400001)(31686004)(36756003)(47076005)(213903007)(43740500002);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Feb 2022 14:53:23.2167 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1bbc98e7-195c-4657-f0b9-08d9e65bc2b8 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM5EUR03FT026.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5711 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Content-Language: en-GB Hi Rebecca, Thank you for this patch. Please find my response inline marked [SAMI]. Regards, Sami Mujawar On 13/01/2022 04:40 PM, Rebecca Cran wrote: > Add AmlCodeGenMethodRetInteger function to generate AML code for > a Method returning an Integer. > > Signed-off-by: Rebecca Cran > Reviewed-by: Pierre Gondois > --- > DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h | 47 +++++= + > DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c | 156 +++++= +++++++++++++++ > 2 files changed, 203 insertions(+) > > diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h b/DynamicTa= blesPkg/Include/Library/AmlLib/AmlLib.h > index 80d05f74ee69..6f214c0dfad2 100644 > --- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h > +++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h > @@ -1118,6 +1118,53 @@ AmlCodeGenMethodRetNameString ( > OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL > ); > > +/** AML code generation for a method returning an Integer. > + > + AmlCodeGenMethodRetInteger ( > + "_CBA", 0, 1, TRUE, 3, ParentNode, NewObjectNode > + ); > + is equivalent of the following ASL code: > + Method(_CBA, 1, Serialized, 3) { > + Return (0) > + } > + > + The ASL parameters "ReturnType" and "ParameterTypes" are not asked > + in this function. They are optional parameters in ASL. > + > + @param [in] MethodNameString The new Method's name. > + Must be a NULL-terminated ASL NameSt= ring > + e.g.: "MET0", "_SB.MET0", etc. > + The input string is copied. > + @param [in] ReturnedInteger The value of the integer returned by= the > + method. > + @param [in] NumArgs Number of arguments. > + Must be 0 <=3D NumArgs <=3D 6. > + @param [in] IsSerialized TRUE is equivalent to Serialized. > + FALSE is equivalent to NotSerialized= . > + Default is NotSerialized in ASL spec= . > + @param [in] SyncLevel Synchronization level for the method= . > + Must be 0 <=3D SyncLevel <=3D 15. > + Default is 0 in ASL. > + @param [in] ParentNode If provided, set ParentNode as the p= arent > + of the node created. > + @param [out] NewObjectNode If success, contains the created nod= e. > + > + @retval EFI_SUCCESS Success. > + @retval EFI_INVALID_PARAMETER Invalid parameter. > + @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. > +**/ > +EFI_STATUS > +EFIAPI > +AmlCodeGenMethodRetInteger ( > + IN CONST CHAR8 *MethodNameString, > + IN UINT64 ReturnedInteger, > + IN UINT8 NumArgs, > + IN BOOLEAN IsSerialized, > + IN UINT8 SyncLevel, > + IN AML_NODE_HANDLE ParentNode OPTIONAL, > + OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL > + ); > + > /** Create a _LPI name. > > AmlCreateLpiNode ("_LPI", 0, 1, ParentNode, &LpiNode) is > diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c = b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c > index 838a892c6b58..07822ead5b70 100644 > --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c > +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c > @@ -1685,6 +1685,61 @@ exit_handler: > return Status; > } > > +/** AML code generation for a Return object node, > + returning an Integer. > + > + AmlCodeGenReturn (0), ParentNode, NewObjectNode) is > + equivalent of the following ASL code: > + Return (0) > + > + The ACPI 6.3 specification, 20.2.8 "Statement Opcodes Encoding" states= : > + DefReturn :=3D ReturnOp ArgObject > + ReturnOp :=3D 0xA4 > + ArgObject :=3D TermArg =3D> DataRefObject > + > + Thus, the ReturnNode must be evaluated as a DataRefObject. > + > + The ReturnNode must be generated inside a Method body scope. > + > + @param [in] Integer The integer is returned by the Return > + ASL statement. > + @param [in] ParentNode If provided, set ParentNode as the parent > + of the node created. > + Must be a MethodOp node. > + @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. > +**/ > +STATIC > +EFI_STATUS > +EFIAPI > +AmlCodeGenReturnInteger ( > + IN UINT64 Integer, > + IN AML_NODE_HEADER *ParentNode OPTIONAL, > + OUT AML_OBJECT_NODE **NewObjectNode OPTIONAL > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_NODE *IntNode; > + > + IntNode =3D NULL; > + > + Status =3D AmlCodeGenInteger (Integer, &IntNode); > + ASSERT_EFI_ERROR (Status); [SAMI] In release builds, ASSERT_EFI_ERROR() would vanish and we could end up accessing an invalid pointer. If you agree, I will change this to check the status and return the error code, before merging. [/SAMI] > + > + // AmlCodeGenReturn() deletes DataNode if error. > + Status =3D AmlCodeGenReturn ( > + (AML_NODE_HEADER *)IntNode, > + ParentNode, > + NewObjectNode > + ); > + ASSERT_EFI_ERROR (Status); > + > + return Status; > +} > + > /** AML code generation for a method returning a NameString. > > AmlCodeGenMethodRetNameString ( > @@ -1793,6 +1848,107 @@ error_handler: > return Status; > } > > +/** AML code generation for a method returning an Integer. > + > + AmlCodeGenMethodRetInteger ( > + "_CBA", 0, 1, TRUE, 3, ParentNode, NewObjectNode > + ); > + is equivalent of the following ASL code: > + Method(_CBA, 1, Serialized, 3) { > + Return (0) > + } > + > + The ASL parameters "ReturnType" and "ParameterTypes" are not asked > + in this function. They are optional parameters in ASL. > + > + @param [in] MethodNameString The new Method's name. > + Must be a NULL-terminated ASL NameSt= ring > + e.g.: "MET0", "_SB.MET0", etc. > + The input string is copied. > + @param [in] ReturnedInteger The value of the integer returned by= the > + method. > + @param [in] NumArgs Number of arguments. > + Must be 0 <=3D NumArgs <=3D 6. > + @param [in] IsSerialized TRUE is equivalent to Serialized. > + FALSE is equivalent to NotSerialized= . > + Default is NotSerialized in ASL spec= . > + @param [in] SyncLevel Synchronization level for the method= . > + Must be 0 <=3D SyncLevel <=3D 15. > + Default is 0 in ASL. > + @param [in] ParentNode If provided, set ParentNode as the p= arent > + of the node created. > + @param [out] NewObjectNode If success, contains the created nod= e. > + > + @retval EFI_SUCCESS Success. > + @retval EFI_INVALID_PARAMETER Invalid parameter. > + @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. > +**/ > +EFI_STATUS > +EFIAPI > +AmlCodeGenMethodRetInteger ( > + IN CONST CHAR8 *MethodNameString, > + IN UINT64 ReturnedInteger, > + IN UINT8 NumArgs, > + IN BOOLEAN IsSerialized, > + IN UINT8 SyncLevel, > + IN AML_NODE_HANDLE ParentNode OPTIONAL, > + OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL > + ) > +{ > + EFI_STATUS Status; > + AML_OBJECT_NODE_HANDLE MethodNode; > + > + if ((MethodNameString =3D=3D NULL) || > + ((ParentNode =3D=3D NULL) && (NewObjectNode =3D=3D NULL))) > + { > + ASSERT (0); > + return EFI_INVALID_PARAMETER; > + } > + > + // Create a Method named MethodNameString. > + Status =3D AmlCodeGenMethod ( > + MethodNameString, > + NumArgs, > + IsSerialized, > + SyncLevel, > + NULL, > + &MethodNode > + ); > + if (EFI_ERROR (Status)) { > + ASSERT (0); > + return Status; > + } > + > + Status =3D AmlCodeGenReturnInteger ( > + ReturnedInteger, > + (AML_NODE_HANDLE)MethodNode, > + NULL > + ); > + if (EFI_ERROR (Status)) { > + ASSERT (0); > + goto error_handler; > + } > + > + Status =3D LinkNode ( > + MethodNode, > + ParentNode, > + NewObjectNode > + ); > + if (EFI_ERROR (Status)) { > + ASSERT (0); > + goto error_handler; > + } > + > + return Status; > + > +error_handler: > + if (MethodNode !=3D NULL) { > + AmlDeleteTree ((AML_NODE_HANDLE)MethodNode); > + } > + > + return Status; > +} > + > /** Create a _LPI name. > > AmlCreateLpiNode ("_LPI", 0, 1, ParentNode, &LpiNode) is IMPORTANT NOTICE: The contents of this email and any attachments are confid= ential and may also be privileged. If you are not the intended recipient, p= lease notify the sender immediately and do not disclose the contents to any= other person, use it for any purpose, or store or copy the information in = any medium. Thank you.