public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Sami Mujawar" <sami.mujawar@arm.com>
To: <devel@edk2.groups.io>
Cc: Sami Mujawar <sami.mujawar@arm.com>, <Alexei.Fedorov@arm.com>,
	<pierre.gondois@arm.com>, <ard.biesheuvel@arm.com>,
	<Matteo.Carlini@arm.com>, <Ben.Adderson@arm.com>, <nd@arm.com>
Subject: [PATCH v1 25/30] DynamicTablesPkg: Dynamic AML: Add AmlLib library
Date: Wed, 12 Aug 2020 16:22:31 +0100	[thread overview]
Message-ID: <20200812152236.31164-26-sami.mujawar@arm.com> (raw)
In-Reply-To: <20200812152236.31164-1-sami.mujawar@arm.com>

From: Pierre Gondois <pierre.gondois@arm.com>

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 <pierre.gondois@arm.com>
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
---
 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.<BR>
+# Copyright (c) 2020, Arm Limited. All rights reserved.<BR>
 # 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.<BR>
+# Copyright (c) 2017 - 2020, Arm Limited. All rights reserved.<BR>
 #
 # 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.<BR>
-#  Copyright (c) 2019 - 2020, ARM Limited. All rights reserved.<BR>
+#  Copyright (c) 2019 - 2020, Arm Limited. All rights reserved.<BR>
 #
 #  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.<BR>
+#
+#  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)'


  parent reply	other threads:[~2020-08-12 15:23 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-12 15:22 [PATCH v1 00/30] Add Dynamic AML generation support Sami Mujawar
2020-08-12 15:22 ` [PATCH v1 01/30] DynamicTablesPkg: Introduction to Dynamic AML Sami Mujawar
2020-08-12 15:22 ` [PATCH v1 02/30] DynamicTablesPkg: AmlLib definitions Sami Mujawar
2020-08-12 15:22 ` [PATCH v1 03/30] DynamicTablesPkg: AML grammar definition Sami Mujawar
2020-08-12 15:22 ` [PATCH v1 04/30] DynamicTablesPkg: AML node definitions Sami Mujawar
2020-08-12 15:22 ` [PATCH v1 05/30] DynamicTablesPkg: AML tree interface Sami Mujawar
2020-08-12 15:22 ` [PATCH v1 06/30] DynamicTablesPkg: AML tree enumerator Sami Mujawar
2020-08-12 15:22 ` [PATCH v1 07/30] DynamicTablesPkg: AML tree traversal Sami Mujawar
2020-08-12 15:22 ` [PATCH v1 08/30] DynamicTablesPkg: AML tree iterator Sami Mujawar
2020-08-12 15:22 ` [PATCH v1 09/30] DynamicTablesPkg: AML tree/node cloning Sami Mujawar
2020-08-12 15:22 ` [PATCH v1 10/30] DynamicTablesPkg: AML utility interfaces Sami Mujawar
2020-08-12 15:22 ` [PATCH v1 11/30] DynamicTablesPkg: AML and ASL string helper Sami Mujawar
2020-08-12 15:22 ` [PATCH v1 12/30] DynamicTablesPkg: AML stream interface Sami Mujawar
2020-08-12 15:22 ` [PATCH v1 13/30] DynamicTablesPkg: AML serialise interface Sami Mujawar
2020-08-12 15:22 ` [PATCH v1 14/30] DynamicTablesPkg: AML debug logging Sami Mujawar
2020-08-12 15:22 ` [PATCH v1 15/30] DynamicTablesPkg: AML ACPI Namespace interface Sami Mujawar
2020-08-12 15:22 ` [PATCH v1 16/30] DynamicTablesPkg: AML Parser Sami Mujawar
2020-08-12 15:22 ` [PATCH v1 17/30] DynamicTablesPkg: AML resource data helper Sami Mujawar
2020-08-12 15:22 ` [PATCH v1 18/30] DynamicTablesPkg: AML resource data parser Sami Mujawar
2020-08-12 15:22 ` [PATCH v1 19/30] DynamicTablesPkg: AML Method parser Sami Mujawar
2020-08-12 15:22 ` [PATCH v1 20/30] DynamicTablesPkg: AML Field list parser Sami Mujawar
2020-08-12 15:22 ` [PATCH v1 21/30] DynamicTablesPkg: AML Codegen Sami Mujawar
2020-08-12 15:22 ` [PATCH v1 22/30] DynamicTablesPkg: AML Resource Data Codegen Sami Mujawar
2020-08-12 15:22 ` [PATCH v1 23/30] DynamicTablesPkg: AML Core interface Sami Mujawar
2020-08-12 15:22 ` [PATCH v1 24/30] DynamicTablesPkg: AmlLib APIs Sami Mujawar
2020-08-12 15:22 ` Sami Mujawar [this message]
2020-08-12 15:22 ` [PATCH v1 26/30] DynamicTablesPkg: Add AsciiFromHex helper function Sami Mujawar
2020-08-12 15:22 ` [PATCH v1 27/30] DynamicTablesPkg: SSDT Serial Port Fixup library Sami Mujawar
2020-08-12 15:22 ` [PATCH v1 28/30] DynamicTablesPkg: SSDT Serial Port generator Sami Mujawar
2020-08-12 15:22 ` [PATCH v1 29/30] DynamicTablesPkg: Add SSDT Serial port for SPCR Sami Mujawar
2020-08-12 15:22 ` [PATCH v1 30/30] DynamicTablesPkg: Add SSDT Serial port for DBG2 Sami Mujawar
2020-08-13 15:16 ` [edk2-devel] [PATCH v1 00/30] Add Dynamic AML generation support Alexei Fedorov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200812152236.31164-26-sami.mujawar@arm.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox