From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (EUR04-HE1-obe.outbound.protection.outlook.com [40.107.7.50]) by mx.groups.io with SMTP id smtpd.web10.17207.1597245832805824019 for ; Wed, 12 Aug 2020 08:23:53 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=fpty+GMC; spf=pass (domain: arm.com, ip: 40.107.7.50, 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=+jJWbHNqTv2BlSHRMXga5k5RbwlAF2C1m6L7x8Ag0Kk=; b=fpty+GMCVUNz0yO/tkgEWxemCADaWOHpX+PdFqry5gfznbCo55xRDvOfE0Ua1OQFl9Qd/qovxKjY+CsvYBX08ZnYAqCD/eVKLeytTx9ifa2ZeiBfdpQlw/84r0WNQCJIEN+LVh6tst8SprfKLXTkES1uc3XDDXKxbCojZxFzL/Q= Received: from MR2P264CA0056.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:31::20) by VE1PR08MB5054.eurprd08.prod.outlook.com (2603:10a6:803:10d::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.15; Wed, 12 Aug 2020 15:23:50 +0000 Received: from VE1EUR03FT028.eop-EUR03.prod.protection.outlook.com (2603:10a6:500:31:cafe::69) by MR2P264CA0056.outlook.office365.com (2603:10a6:500:31::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.15 via Frontend Transport; Wed, 12 Aug 2020 15:23:49 +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=bestguesspass 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 VE1EUR03FT028.mail.protection.outlook.com (10.152.18.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.16 via Frontend Transport; Wed, 12 Aug 2020 15:23:49 +0000 Received: ("Tessian outbound a0bffebca527:v64"); Wed, 12 Aug 2020 15:23:49 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 0e0a659e563a865d X-CR-MTA-TID: 64aa7808 Received: from f154c7f66504.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 58CD13BC-71DC-44C9-A740-BC7CD658CEDC.1; Wed, 12 Aug 2020 15:23:44 +0000 Received: from EUR03-AM5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id f154c7f66504.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 12 Aug 2020 15:23:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YNWorIVZC5h/Ckg/atOf0W0iGSdTYWyLJm5mRffEDfBVYrge3Si6ENSD3bhqtSGY/IXp6LchRT7AVkKE9GS0dCepUQb0IKAzqIRgFxFwPj53p14nmFt2rhtSAJL+/PlZ9mjhO4Su+mJdvtKfXH0cPbjvsQ+2kEARGA6zvIBZeF91+0yaHdnnSLzX65WiJHEzSNL2oOSs2sDnYFg+vv5vV84emPtfQzAgMjsK0EcpFQyC0tSffWGNSp+Lheoe5qaMpQ+HsG+j49HyBoBD2ajISSRSyHa5wUQ2nr69oO+OyTetsPQgAiPkzkimW0uJAeOPZ55DCgWXF7JXuezHduAp/w== 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-SenderADCheck; bh=+jJWbHNqTv2BlSHRMXga5k5RbwlAF2C1m6L7x8Ag0Kk=; b=KNkN9+nY4vqcJ/X1uxjbUUcO9bJOaFwMD99PQ6PQC6MlEtIl2DoJt5ydPHGER5BvvwW/IEjlP3p8ZXq43Cb5HJdVr1/66H4lrR98R8rUBuwbe3zyjX+QBAdITrS2/em9+eSW/Ei2/W4szf/KAQH490v/dFei11TZwKR28MeKPBckg2CDI203CsOqdOC3BUNlqasKlnyRCloWia9AoMyek7Ts6JFNB3V7fXalDwT2sVDmsItaHPqE4IekhbU13WImafMTRr0gK2YaVCRib/MY51xYVZEOgrN3lP/9XmVAqrs/LM2Kii4DgarfDWnW/cRqsW46ofP0+Y3QskKUt5/V0Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com; dmarc=bestguesspass action=none header.from=arm.com; dkim=none (message not signed); 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=+jJWbHNqTv2BlSHRMXga5k5RbwlAF2C1m6L7x8Ag0Kk=; b=fpty+GMCVUNz0yO/tkgEWxemCADaWOHpX+PdFqry5gfznbCo55xRDvOfE0Ua1OQFl9Qd/qovxKjY+CsvYBX08ZnYAqCD/eVKLeytTx9ifa2ZeiBfdpQlw/84r0WNQCJIEN+LVh6tst8SprfKLXTkES1uc3XDDXKxbCojZxFzL/Q= Received: from DB6PR07CA0061.eurprd07.prod.outlook.com (2603:10a6:6:2a::23) by VI1PR0802MB2399.eurprd08.prod.outlook.com (2603:10a6:800:bb::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.16; Wed, 12 Aug 2020 15:23:42 +0000 Received: from DB5EUR03FT059.eop-EUR03.prod.protection.outlook.com (2603:10a6:6:2a:cafe::2b) by DB6PR07CA0061.outlook.office365.com (2603:10a6:6:2a::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.10 via Frontend Transport; Wed, 12 Aug 2020 15:23:42 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; Received: from nebula.arm.com (40.67.248.234) by DB5EUR03FT059.mail.protection.outlook.com (10.152.21.175) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3283.16 via Frontend Transport; Wed, 12 Aug 2020 15:23:42 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2044.4; Wed, 12 Aug 2020 15:23:41 +0000 Received: from E107187.Arm.com (10.57.41.222) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2044.4 via Frontend Transport; Wed, 12 Aug 2020 15:23:40 +0000 From: "Sami Mujawar" To: CC: Sami Mujawar , , , , , , Subject: [PATCH v1 25/30] DynamicTablesPkg: Dynamic AML: Add AmlLib library Date: Wed, 12 Aug 2020 16:22:31 +0100 Message-ID: <20200812152236.31164-26-sami.mujawar@arm.com> X-Mailer: git-send-email 2.11.0.windows.3 In-Reply-To: <20200812152236.31164-1-sami.mujawar@arm.com> References: <20200812152236.31164-1-sami.mujawar@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1004d7af-a131-423a-1ef9-08d83ed3b6ca X-MS-TrafficTypeDiagnostic: VI1PR0802MB2399:|VE1PR08MB5054: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:7219;OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: h+D7ecW64mPe18by9L56lOpiHih1ONTjIxR5bd8kroOVGF9goSvvClaPOT6fDdUQ/QHu6R5rw/FQ9WR0x3Ymab+SCKiLlz84oO+2KeLc5uu/xqJ1G9y/cKTK5y+WJxI7uLUxVngg4z1zaCn64rNffK6S56DrwFQ4zP2PliXDpveGvLmRO+nU3ObgSWKjlaL6NhncTLzl8Ui04SYnJV6H2E6PKLONEBGd438iYyUmZBgz5StDrkY3lK2bXZDzU+qfXRqctvoqJmML790a+gs8PSoLcSV62Pskxht5D1JOYGlIbKgo8inUSM2feZSmzQ1CFHfNxwHFT2Wtky5pxRwFpSwgnY9nDWuqdNGbpu9plE2hu8cV9UD6pgpm0jnm9cHon0RY7JEAFhY8yMxEPxwvYw== X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFTY:;SFS:(4636009)(346002)(39860400002)(136003)(396003)(376002)(46966005)(186003)(1076003)(8936002)(36756003)(2906002)(26005)(6916009)(82740400003)(83380400001)(6666004)(478600001)(8676002)(54906003)(86362001)(70586007)(70206006)(5660300002)(7696005)(356005)(4326008)(2616005)(82310400002)(316002)(47076004)(81166007)(426003)(336012)(44832011);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0802MB2399 Return-Path: Sami.Mujawar@arm.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT028.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 599ef0b2-a7cd-495e-12d0-08d83ed3b28d X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5dZkQUnn5/OmzwULrmA0PaPduK5PvTAJDUTh+byQ5Xb/L0zyLRl+nVbxB82695P5rUnxXrYATf6JGHGcKpJ/w1Z4DzqjhFTJ6v1dmqIy69tpwAi0wL1oVb5nLXBAofSihS3i401WodruJynYg3KtQ2A3UXo2xvtZnu2PpHEMZb2eUwlct+B/Sw0kU+C0O6Fe9Fv5qJYosTDbISNGwjyZCnY5BCHGlKf+G1YWa8VWY/UBSxjttO92A6iVJatLeIOyGIXa2tyJgWXcC77snLb2+3UDwBzOItE4axcnyXv/d8ufZN09THb3Grrtjbt505d2kgEtsot8nhXoQ9eyAs4cK6cp5p4C5bwdneFHDPA2B7DpdMgEd85EunJrY+MkLnjEJ5/YyUZ9+ONvUMU7eAFd0g== 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)(396003)(346002)(376002)(136003)(39860400002)(46966005)(36756003)(81166007)(44832011)(86362001)(54906003)(426003)(5660300002)(2616005)(2906002)(8936002)(82310400002)(1076003)(6666004)(26005)(8676002)(36906005)(7696005)(4326008)(83380400001)(186003)(47076004)(336012)(6916009)(316002)(82740400003)(478600001)(70206006)(70586007);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Aug 2020 15:23:49.7526 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1004d7af-a131-423a-1ef9-08d83ed3b6ca 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: VE1EUR03FT028.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5054 Content-Type: text/plain From: Pierre Gondois ACPI Definition blocks are implemented using AML which has a complex grammar making run-time generation of definition blocks difficult. Dynamic AML is a feature of Dynamic Tables framework that provides a solution for dynamic generation of ACPI Definition block tables. Since, AML bytecode represents complex AML grammar, an AmlLib library is introduced to assist parsing and traversing of the AML bytecode at run-time. The AmlLib library parses a definition block and represents it as an AML tree. The AML objects, methods and data are represented as tree nodes. Since the AML data is represented as tree nodes, it is possible to traverse the tree, locate a node and modify the node data. The tree can then be serialized to a buffer (that represents the definition block). This definition block containing the fixed-up AML code can then be installed as an ACPI Definition Block table. Dynamic AML introduces the following techniques: * AML Fixup * AML Codegen * AML Fixup + Codegen AML Fixup is a technique that involves compiling an ASL template file to generate AML bytecode. This template AML bytecode can be parsed at run-time and a fixup code can update the required fields in the AML template. AML Codegen employs generating small segments of AML code. AmlLib provides a rich set of APIs to operate on AML data for AML Fixup and Codegen. Signed-off-by: Pierre Gondois Signed-off-by: Sami Mujawar --- DynamicTablesPkg/DynamicTables.dsc.inc | 1 + DynamicTablesPkg/DynamicTablesPkg.ci.yaml | 6 +- DynamicTablesPkg/DynamicTablesPkg.dec | 5 +- DynamicTablesPkg/DynamicTablesPkg.dsc | 3 +- DynamicTablesPkg/Library/Common/AmlLib/AmlLib.inf | 76 ++++++++++++++++++++ 5 files changed, 88 insertions(+), 3 deletions(-) diff --git a/DynamicTablesPkg/DynamicTables.dsc.inc b/DynamicTablesPkg/DynamicTables.dsc.inc index bc03c09d6c0ebb2c6b1458d27e0bde00224e55cd..928529f797b49f2f0dd52508a9aad557f568719a 100644 --- a/DynamicTablesPkg/DynamicTables.dsc.inc +++ b/DynamicTablesPkg/DynamicTables.dsc.inc @@ -13,6 +13,7 @@ [BuildOptions] RELEASE_*_*_CC_FLAGS = -DMDEPKG_NDEBUG [LibraryClasses.common] + AmlLib|DynamicTablesPkg/Library/Common/AmlLib/AmlLib.inf TableHelperLib|DynamicTablesPkg/Library/Common/TableHelperLib/TableHelperLib.inf [Components.common] diff --git a/DynamicTablesPkg/DynamicTablesPkg.ci.yaml b/DynamicTablesPkg/DynamicTablesPkg.ci.yaml index f39b8019461ea151f9b1cf4bc751604d6e044af2..5ee20357326f4b79444d63418f56aae0b00508de 100644 --- a/DynamicTablesPkg/DynamicTablesPkg.ci.yaml +++ b/DynamicTablesPkg/DynamicTablesPkg.ci.yaml @@ -1,7 +1,7 @@ ## @file # CI configuration for DynamicTablesPkg # -# Copyright (c) 2020, ARM Limited. All rights reserved.
+# Copyright (c) 2020, Arm Limited. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent ## { @@ -69,11 +69,15 @@ "IgnoreFiles": [], # use gitignore syntax to ignore errors # in matching files "ExtendWords": [ + "EISAID", "CCIDX", "CCSIDR", "countof", "EOBJECT", + "invoc", "GTBLOCK", + "lgreater", + "lless", "MPIDR", "pytool", "Roadmap", diff --git a/DynamicTablesPkg/DynamicTablesPkg.dec b/DynamicTablesPkg/DynamicTablesPkg.dec index 6cb8a0b4f2c91b59e888951fda034bfdc56d95e1..57e6815fa159c5ce8d5cb0c930375e7322bff211 100644 --- a/DynamicTablesPkg/DynamicTablesPkg.dec +++ b/DynamicTablesPkg/DynamicTablesPkg.dec @@ -1,7 +1,7 @@ ## @file # dec file for Dynamic Tables Framework. # -# Copyright (c) 2017 - 2020, ARM Limited. All rights reserved.
+# Copyright (c) 2017 - 2020, Arm Limited. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -17,6 +17,9 @@ [Includes] Include [LibraryClasses] + ## @libraryclass Defines a set of APIs for Dynamic AML generation. + AmlLib|Include/Library/AmlLib/AmlLib.h + ## @libraryclass Defines a set of helper methods. TableHelperLib|Include/Library/TableHelperLib.h diff --git a/DynamicTablesPkg/DynamicTablesPkg.dsc b/DynamicTablesPkg/DynamicTablesPkg.dsc index 5fb30a9315a75750a7d4c3e802c610a7991111c7..add6b192ad4187e2769b374ef68f93a65a1af8b6 100644 --- a/DynamicTablesPkg/DynamicTablesPkg.dsc +++ b/DynamicTablesPkg/DynamicTablesPkg.dsc @@ -2,7 +2,7 @@ # Dsc file for Dynamic Tables Framework. # # Copyright (c) 2019, Linaro Limited. All rights reserved.
-# Copyright (c) 2019 - 2020, ARM Limited. All rights reserved.
+# Copyright (c) 2019 - 2020, Arm Limited. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -36,6 +36,7 @@ [LibraryClasses.ARM, LibraryClasses.AARCH64] PL011UartLib|ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.inf [Components.common] + DynamicTablesPkg/Library/Common/AmlLib/AmlLib.inf DynamicTablesPkg/Library/Common/TableHelperLib/TableHelperLib.inf [BuildOptions] diff --git a/DynamicTablesPkg/Library/Common/AmlLib/AmlLib.inf b/DynamicTablesPkg/Library/Common/AmlLib/AmlLib.inf new file mode 100644 index 0000000000000000000000000000000000000000..e2babef445d5ed7dbd2f6aefbe26fa39df2b1ada --- /dev/null +++ b/DynamicTablesPkg/Library/Common/AmlLib/AmlLib.inf @@ -0,0 +1,76 @@ +## @file +# AML Generation Library +# +# Copyright (c) 2019 - 2020, Arm Limited. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x0001001B + BASE_NAME = DynamicAmlLib + FILE_GUID = 23A6AFDA-F2A5-45EC-BEFF-420639D345B9 + VERSION_STRING = 1.0 + MODULE_TYPE = DXE_DRIVER + LIBRARY_CLASS = AmlLib + +[Sources] + AmlCoreInterface.h + AmlDefines.h + AmlInclude.h + AmlNodeDefines.h + AmlDbgPrint/AmlDbgPrint.c + AmlDbgPrint/AmlDbgPrint.h + AmlEncoding/Aml.c + AmlEncoding/Aml.h + Api/AmlApi.c + Api/AmlApiHelper.c + Api/AmlApiHelper.h + Api/AmlResourceDataApi.c + CodeGen/AmlCodeGen.c + CodeGen/AmlResourceDataCodeGen.c + CodeGen/AmlResourceDataCodeGen.h + NameSpace/AmlNameSpace.c + NameSpace/AmlNameSpace.h + Parser/AmlFieldListParser.c + Parser/AmlFieldListParser.h + Parser/AmlMethodParser.c + Parser/AmlMethodParser.h + Parser/AmlParser.c + Parser/AmlParser.h + Parser/AmlResourceDataParser.c + Parser/AmlResourceDataParser.h + ResourceData/AmlResourceData.c + ResourceData/AmlResourceData.h + Serialize/AmlSerialize.c + Stream/AmlStream.c + Stream/AmlStream.h + String/AmlString.c + String/AmlString.h + Tree/AmlClone.c + Tree/AmlTreeIterator.h + Tree/AmlNode.c + Tree/AmlNode.h + Tree/AmlNodeInterface.c + Tree/AmlTree.c + Tree/AmlTree.h + Tree/AmlTreeEnumerator.c + Tree/AmlTreeIterator.c + Tree/AmlTreeTraversal.c + Tree/AmlTreeTraversal.h + Utils/AmlUtility.c + Utils/AmlUtility.h + +[Packages] + MdePkg/MdePkg.dec + DynamicTablesPkg/DynamicTablesPkg.dec + +[LibraryClasses] + BaseLib + +[BuildOptions] + *_*_*_CC_FLAGS = -DAML_HANDLE + +[Protocols] + +[Guids] -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'