From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (EUR01-VE1-obe.outbound.protection.outlook.com [40.107.14.47]) by mx.groups.io with SMTP id smtpd.web08.7505.1633092950607766416 for ; Fri, 01 Oct 2021 05:55:51 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=aAs8zQxN; spf=pass (domain: arm.com, ip: 40.107.14.47, 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=KGvRLixueFRmF9sX6mE3hhTC73daUmtp00QVaBfpNU8=; b=aAs8zQxNq3Oe8v+qgyZSHIsUWgQ2nI40+HTsWoZy1TpF90/NbI1KRXpLbMFLJvHJbiuofGxXGLcgodFKIovJ4DPk+YgV5C+21TCjHTibzXXq5GpdTd80qBP0LDSefdWYo0ZUqouySqpw06l14CJdI8sD/Bpn0JfrcYaWltbDOgQ= Received: from AM6P193CA0121.EURP193.PROD.OUTLOOK.COM (2603:10a6:209:85::26) by PA4PR08MB6127.eurprd08.prod.outlook.com (2603:10a6:102:f3::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.17; Fri, 1 Oct 2021 12:55:44 +0000 Received: from VE1EUR03FT053.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:85:cafe::ec) by AM6P193CA0121.outlook.office365.com (2603:10a6:209:85::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.14 via Frontend Transport; Fri, 1 Oct 2021 12:55:44 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; edk2.groups.io; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;edk2.groups.io; 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 VE1EUR03FT053.mail.protection.outlook.com (10.152.19.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.14 via Frontend Transport; Fri, 1 Oct 2021 12:55:44 +0000 Received: ("Tessian outbound 010023020eef:v103"); Fri, 01 Oct 2021 12:55:44 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 3fe89efb93b7639e X-CR-MTA-TID: 64aa7808 Received: from 0a4d33ce9aa9.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id B4AB3D03-26AB-4AF7-BD38-7995C19B7A29.1; Fri, 01 Oct 2021 12:55:32 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 0a4d33ce9aa9.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 01 Oct 2021 12:55:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VOZgCsjiTEFdtsYUtLl/nRHawP9Agl9394fktBmj3j8IjJjPeBtdGiBugqaEOEXFztgfBO8qmll0fQLBpxrgtprUc5LiDyU+PKOvBv22Ll12krs096ACCLySj6+tMDHM5bFbRsOhce/IDWcnatnMHwF/rlfgMB79RfMFryPb6PjuWaPsdRtrrW6/rGZ9URwoksTt5lC920wozWpZbbH2L553AYLdCijJ5fWHKvjQ5NDNxwyCZMEttTK5jtG8j1x/2i4IPmOl/dJMvthjRrTXUeWAcKN9vBwJEs8G5sOojweF/1jO0YKrieG5P8zwNh7e18S//sRFqY0eXEXqbJnYDw== 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=KGvRLixueFRmF9sX6mE3hhTC73daUmtp00QVaBfpNU8=; b=eHyiI1XVjPLUFPnKnGjZg0Y9SQwsy/TXDvO8q4VRJfNttOchelWsFNDUcdSdWkFNAzPqhw2sk9tF6hMJJnGd7kM9JrX8yywRlRjMa7zoxzbwCZPQGEiUe+TNbcpb5VPM4un2C8GlKKesDGTf/extLWdhnvFJvYS6rbPJFk/hWYlIcI4ZGLbuKy5AC7eON9QlzAn0SkNhLphxkbiKIXOtw5YJtS5AJGoMrBmq2tfdPGWO5TNyN5bb2cLnmcXMXpJj4heHyCT/5aoHDgSzLk4KswubU0BzWPj39nJHL3mKSzs7Ac8gv5xDvWaUKc5QZZEd9gwTzNopuExrDuqSgWrsgA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; 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=KGvRLixueFRmF9sX6mE3hhTC73daUmtp00QVaBfpNU8=; b=aAs8zQxNq3Oe8v+qgyZSHIsUWgQ2nI40+HTsWoZy1TpF90/NbI1KRXpLbMFLJvHJbiuofGxXGLcgodFKIovJ4DPk+YgV5C+21TCjHTibzXXq5GpdTd80qBP0LDSefdWYo0ZUqouySqpw06l14CJdI8sD/Bpn0JfrcYaWltbDOgQ= Authentication-Results-Original: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com; Received: from AS8PR08MB6806.eurprd08.prod.outlook.com (2603:10a6:20b:39b::12) by AM5PR0801MB2098.eurprd08.prod.outlook.com (2603:10a6:203:4a::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.14; Fri, 1 Oct 2021 12:55:27 +0000 Received: from AS8PR08MB6806.eurprd08.prod.outlook.com ([fe80::c8a5:672a:9ff2:e554]) by AS8PR08MB6806.eurprd08.prod.outlook.com ([fe80::c8a5:672a:9ff2:e554%6]) with mapi id 15.20.4566.019; Fri, 1 Oct 2021 12:55:27 +0000 Subject: Re: [PATCH v1 04/13] DynamicTablesPkg: AML code generation for a Package To: Pierre.Gondois@arm.com, devel@edk2.groups.io, Alexei Fedorov Cc: Akanksha Jain , Alexandru Elisei , nd References: <20210623114039.24491-1-Pierre.Gondois@arm.com> <20210623114039.24491-5-Pierre.Gondois@arm.com> From: "Sami Mujawar" Message-ID: <8a6ac0a7-7749-e253-6871-60b2068d3f7c@arm.com> Date: Fri, 1 Oct 2021 13:55:28 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.0.1 In-Reply-To: <20210623114039.24491-5-Pierre.Gondois@arm.com> X-ClientProxiedBy: LO2P265CA0170.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a::14) To AS8PR08MB6806.eurprd08.prod.outlook.com (2603:10a6:20b:39b::12) MIME-Version: 1.0 Received: from [10.1.196.43] (217.140.106.52) by LO2P265CA0170.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.13 via Frontend Transport; Fri, 1 Oct 2021 12:55:27 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 856704c3-44af-4b42-1bf8-08d984dac83a X-MS-TrafficTypeDiagnostic: AM5PR0801MB2098:|PA4PR08MB6127: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:6790;OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: kVtDUDeL5Z58wteD6PhiH7I9vKZotXxGqQlRadM6guzES1IteSQdkuHc6HQu3aOQoS1NW0Zgss+E/qkV9RSuMW5M5DCx7/CPDou/WK9yfI2lbP3/VlbkhUH0+9c6cZAmBLU8wxBBbAHD1UD/vzvb0twfwcMpf5/GwNuGZgqTN0cUpQWVH6gSKqq1pH8KHsTldVwF1JmLocZrKTyTY7E1Y5WIkkJny/GNaummkLwNrQaciilwbrL5Txt8OrE3eXS0LllH9AVUgbFbg70fmWGC/7ZaRRTxcfzXtqjy/t7teeuzQqUJz4KIam7XU21egxaVA63RI5Dcr3H4mcq55i+wKv7trjEB0kqKKzTqAT4dbxKZ9YbS6sIVuWA1jE4obD3nYrwxhpy2Jk5ak6PuD/ErF9yN64l4Y6T0OZU4KV/cmDB231ox+U7Ir+szVPV8mO7+r+aIjJTQd25L2eKsB4Z9s81vhzt5MTz/iEbWG/Jv9bn1QeS1p7xO22Y/TmsogTfKgSvRPaUpFirFQmUW2kwH9M1KE+ACRB1kLUo4IsiIpVg5rO2Wu5/D2PZ6AG7jqIac2yKNxb8G11rMEPbU40GaN4gSmA2L7y2eEkCJHiYfOu1RwQebRyzOqoCe4Wxe5rD4wMi9XzT1tNvSDLPjJcOdFt3oOO5pNIDfqJwsWiRVL0aqkrd3f0S11YNz8sfo5w9MyE3RCgFtFsvfu+80fsPwbCK9CvTRq5VxhnoFF5jWtftUoVs3IIVpPTmctFRiP2q7HNDnKncbkEMNZ6+7n1ZHBA== 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:(4636009)(366004)(52116002)(2616005)(6636002)(186003)(83380400001)(36756003)(508600001)(86362001)(31696002)(31686004)(6862004)(956004)(316002)(38100700002)(16576012)(37006003)(38350700002)(6486002)(8676002)(26005)(44832011)(5660300002)(66946007)(53546011)(54906003)(4326008)(2906002)(66556008)(66476007)(8936002)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB2098 Original-Authentication-Results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com; Return-Path: Sami.Mujawar@arm.com X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT053.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 3efc85bc-58d6-4e9e-186d-08d984dabdfa X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VYjLtHfy+Om11++8iRbE0hoGasWLofgKOGFeTZxIEv+1YKGNXdVBB4iXWuuAJFYJO3XqEqwriYJpdqlJJgYNJjXqpmH/hUDmhqi158VPcv7diH0AXMmvhGE6LMppH3Sw8Qo06C9kkw5iKep3TjXK+gKyeMzai2L6JM4eyeMrIoit5zdDHa4Q+DFlMeeimv+Np8JIQ7mSf5P8DusIkThNT+a6sGa4vhC6N1YTGfCtQo6b2e0e/jFoA2KdCZhCtY3JuB9xvJSOtXW8dZN3Es3wVaCCegRYJe8b92hfMG/efAJSv+AuoYLDbjZ254FGw7vALwbWwSMQKEWpvr646n452p6wQ6ssVoaj6iqDkBpY7qQUsRIO/gyhX/49p+uRd90RVO0Xo5VeU3pHGE7aNGFOo0/XJQnmmpKwDroI7UeEof+UdabKi378g3bU6WZK+wLKh6tEXRQ9Ks2IxQiG9Wom5pnNOi+Fn/gs8qa125bcqphg3Nlnh8iGPCR/SlOk28CElH4BmHNYruUbtIkWL6pBJF1in1l3SpcIZ4NwrciFqh9VNYL07Rdp87bjv+zOHJzgwQGo5Bsi5a/S8pr2XJYfoTUtXTOVNEdX7uffAFokNAKp/pwWwT7/3D/6hkIsu6LNhUyoQW0GGoKus/jCUfdphQezQJ/hOPUseuS7kE1rbhoHtcKxsuTMdLSs4Xpi22OSN1ataQg91YmdzW3GDjc8CINWJgQ+XtRC6V7K3+b/UkE= 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:(4636009)(46966006)(36840700001)(2616005)(31686004)(6486002)(356005)(36860700001)(47076005)(956004)(4326008)(16576012)(6636002)(5660300002)(37006003)(86362001)(81166007)(31696002)(316002)(8936002)(508600001)(82310400003)(8676002)(44832011)(83380400001)(70206006)(53546011)(54906003)(70586007)(2906002)(26005)(186003)(36756003)(6862004)(336012)(43740500002);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Oct 2021 12:55:44.5516 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 856704c3-44af-4b42-1bf8-08d984dac83a 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: VE1EUR03FT053.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6127 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-GB Hi Pierre, Thank you for this patch. This patch looks good to me. Reviewed-by: Sami Mujawar Regards, Sami Mujawar On 23/06/2021 12:40 PM, Pierre.Gondois@arm.com wrote: > From: Pierre Gondois > > Add AmlCodeGenPackage() to generate AML code for declaring > a Package() object. This function generates an empty package > node. New elements can then be added to the package's variable > argument list. > > Signed-off-by: Pierre Gondois > --- > .../Common/AmlLib/CodeGen/AmlCodeGen.c | 82 ++++++++++++++++++- > 1 file changed, 81 insertions(+), 1 deletion(-) > > diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c > index 5d310f201319..ea9b73b464a4 100644 > --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c > +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c > @@ -1,7 +1,7 @@ > /** @file > AML Code Generation. > > - Copyright (c) 2020, Arm Limited. All rights reserved.
> + Copyright (c) 2020 - 2021, Arm Limited. All rights reserved.
> > SPDX-License-Identifier: BSD-2-Clause-Patent > **/ > @@ -235,6 +235,86 @@ AmlCodeGenInteger ( > return Status; > } > > +/** AML code generation for a Package object node. > + > + The package generated is empty. New elements can be added via its > + list of variable arguments. > + > + @param [out] NewObjectNode If success, contains the created > + Package object node. > + > + @retval EFI_SUCCESS Success. > + @retval EFI_INVALID_PARAMETER Invalid parameter. > + @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. > +**/ > +STATIC > +EFI_STATUS > +EFIAPI > +AmlCodeGenPackage ( > + OUT AML_OBJECT_NODE ** NewObjectNode > + ) > +{ > + EFI_STATUS Status; > + AML_DATA_NODE * DataNode; > + UINT8 NodeCount; > + > + if (NewObjectNode == NULL) { > + ASSERT (0); > + return EFI_INVALID_PARAMETER; > + } > + > + DataNode = NULL; > + NodeCount = 0; > + > + // Create an object node. > + // PkgLen is 2: > + // - one byte to store the PkgLength > + // - one byte for the NumElements. > + // Cf ACPI6.3, s20.2.5 "Term Objects Encoding" > + // DefPackage := PackageOp PkgLength NumElements PackageElementList > + // NumElements := ByteData > + Status = AmlCreateObjectNode ( > + AmlGetByteEncodingByOpCode (AML_PACKAGE_OP, 0), > + 2, > + NewObjectNode > + ); > + if (EFI_ERROR (Status)) { > + ASSERT (0); > + return Status; > + } > + > + // NumElements is a ByteData. > + Status = AmlCreateDataNode ( > + EAmlNodeDataTypeUInt, > + &NodeCount, > + sizeof (NodeCount), > + &DataNode > + ); > + if (EFI_ERROR (Status)) { > + ASSERT (0); > + goto error_handler; > + } > + > + Status = AmlSetFixedArgument ( > + *NewObjectNode, > + EAmlParseIndexTerm0, > + (AML_NODE_HEADER*)DataNode > + ); > + if (EFI_ERROR (Status)) { > + ASSERT (0); > + goto error_handler; > + } > + > + return Status; > + > +error_handler: > + AmlDeleteTree ((AML_NODE_HEADER*)*NewObjectNode); > + if (DataNode != NULL) { > + AmlDeleteTree ((AML_NODE_HEADER*)DataNode); > + } > + return Status; > +} > + > /** AML code generation for a Name object node. > > @param [in] NameString The new variable name.