[PATCH v1 00/30] Add Dynamic AML generation support


Sami Mujawar
 

ACPI tables are categorised as Data tables (e.g. MADT, GTDT, etc.) or
Definition Block tables (DSDT or SSDT). The Dynamic Tables Framework
already supports generation of Data tables. Definition Block tables
are written in ACPI Source Language (ASL) and compiled to ACPI Machine
Language (AML). This AML bytecode is processed by the AML interpreter
that runs as part of the Operating System (OS).

AML has a complex grammar, making runtime modifications on an AML byte
stream difficult. Dynamic AML is a solution to simplify the generation
of Definition Block tables.

Dynamic AML introduces an AmlLib library that implements an AML parser
that parses the AML bytecode and represent it as a tree data structure.
This allows to easily modify the AML code by updating/adding/removing
the tree nodes. The modified AML tree is then serialised to a buffer
for installing as a Definition block table.

AmlLib Library provides a rich set of APIs to
- parse AML bytecode to generate an AML tree.
- search, update, traverse and serialise an AML tree.
- enumerate, add, delete nodes of an AML tree.
- generate small segments of AML code in the form of
AML nodes that can be used to form a branch/tree.

Dynamic AML introduces the following techniques:
* AML Fixup
* AML Codegen
* AML Fixup + Codegen

AML Fixup is a technique that involves run-time fixup of sections
of an AML template bytecode. An ASL template file is compiled to
AML bytecode at build time. At runtime, this AML template bytecode
is parsed using the AmlLib library APIs and is represented as an
AML tree. The AML tree nodes can be searched to locate a node that
needs updating and can be fixed up. The AML tree is then serialised
to a buffer representing the Definition Block table.

AML Codegen employs generating small segments of AML code and
populating a small AML tree that can be serialised.

AML Fixup + Codegen is a combination of Fixup and Codegen. Here the
AML template is parsed to generate an AML Tree. Sections of AML code
can be fixed-up as well as new AML nodes/branches can be attached to
the AML tree using the AML Codegen APIs.


A SSDT Serial Port generator has also been introduced to generate
definition block tables describing the serial ports on a platform.

A SSDT Serial Port Fixup library has been provided to generate
description of a serial port in a Definition Block table. This
library is shared by SPCR, DBG2 and the SSDT Serial Port generator
to describe the respective serial ports.

The SPCR and DBG2 table generators have also been updated to
generate the SSDT serial port tables describing the respective
serial ports.

The changes can be seen at:
https://github.com/samimujawar/edk2/tree/675_dynamic_aml_v1

Pierre Gondois (27):
DynamicTablesPkg: AmlLib definitions
DynamicTablesPkg: AML grammar definition
DynamicTablesPkg: AML node definitions
DynamicTablesPkg: AML tree interface
DynamicTablesPkg: AML tree enumerator
DynamicTablesPkg: AML tree traversal
DynamicTablesPkg: AML tree iterator
DynamicTablesPkg: AML tree/node cloning
DynamicTablesPkg: AML utility interfaces
DynamicTablesPkg: AML and ASL string helper
DynamicTablesPkg: AML serialise interface
DynamicTablesPkg: AML debug logging
DynamicTablesPkg: AML ACPI Namespace interface
DynamicTablesPkg: AML Parser
DynamicTablesPkg: AML resource data helper
DynamicTablesPkg: AML resource data parser
DynamicTablesPkg: AML Method parser
DynamicTablesPkg: AML Field list parser
DynamicTablesPkg: AML Codegen
DynamicTablesPkg: AML Resource Data Codegen
DynamicTablesPkg: AML Core interface
DynamicTablesPkg: AmlLib APIs
DynamicTablesPkg: Dynamic AML: Add AmlLib library
DynamicTablesPkg: SSDT Serial Port Fixup library
DynamicTablesPkg: SSDT Serial Port generator
DynamicTablesPkg: Add SSDT Serial port for SPCR
DynamicTablesPkg: Add SSDT Serial port for DBG2

Sami Mujawar (3):
DynamicTablesPkg: Introduction to Dynamic AML
DynamicTablesPkg: AML stream interface
DynamicTablesPkg: Add AsciiFromHex helper function

DynamicTablesPkg/DynamicTables.dsc.inc | 8 +
DynamicTablesPkg/DynamicTablesPkg.ci.yaml | 9 +-
DynamicTablesPkg/DynamicTablesPkg.dec | 8 +-
DynamicTablesPkg/DynamicTablesPkg.dsc | 4 +-
DynamicTablesPkg/Include/AcpiTableGenerator.h | 7 +-
DynamicTablesPkg/Include/ArmNameSpaceObjects.h | 9 +-
DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h | 631 ++++++++
DynamicTablesPkg/Include/Library/SsdtSerialPortFixupLib.h | 68 +
DynamicTablesPkg/Include/Library/TableHelperLib.h | 15 +-
DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/AcpiDbg2LibArm.inf | 3 +-
DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c | 228 ++-
DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/AcpiSpcrLibArm.inf | 3 +-
DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c | 219 ++-
DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtSerialPortLibArm/SsdtSerialPortGenerator.c | 367 +++++
DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtSerialPortLibArm/SsdtSerialPortLibArm.inf | 33 +
DynamicTablesPkg/Library/Common/AmlLib/AmlCoreInterface.h | 767 ++++++++++
DynamicTablesPkg/Library/Common/AmlLib/AmlDbgPrint/AmlDbgPrint.c | 546 +++++++
DynamicTablesPkg/Library/Common/AmlLib/AmlDbgPrint/AmlDbgPrint.h | 154 ++
DynamicTablesPkg/Library/Common/AmlLib/AmlDefines.h | 188 +++
DynamicTablesPkg/Library/Common/AmlLib/AmlEncoding/Aml.c | 805 +++++++++++
DynamicTablesPkg/Library/Common/AmlLib/AmlEncoding/Aml.h | 330 +++++
DynamicTablesPkg/Library/Common/AmlLib/AmlInclude.h | 18 +
DynamicTablesPkg/Library/Common/AmlLib/AmlLib.inf | 76 +
DynamicTablesPkg/Library/Common/AmlLib/AmlNodeDefines.h | 183 +++
DynamicTablesPkg/Library/Common/AmlLib/Api/AmlApi.c | 382 +++++
DynamicTablesPkg/Library/Common/AmlLib/Api/AmlApiHelper.c | 219 +++
DynamicTablesPkg/Library/Common/AmlLib/Api/AmlApiHelper.h | 93 ++
DynamicTablesPkg/Library/Common/AmlLib/Api/AmlResourceDataApi.c | 320 +++++
DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c | 701 +++++++++
DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.c | 256 ++++
DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.h | 59 +
DynamicTablesPkg/Library/Common/AmlLib/NameSpace/AmlNameSpace.c | 1501 ++++++++++++++++++++
DynamicTablesPkg/Library/Common/AmlLib/NameSpace/AmlNameSpace.h | 74 +
DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlFieldListParser.c | 375 +++++
DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlFieldListParser.h | 77 +
DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlMethodParser.c | 1458 +++++++++++++++++++
DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlMethodParser.h | 188 +++
DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlParser.c | 1448 +++++++++++++++++++
DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlParser.h | 72 +
DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlResourceDataParser.c | 328 +++++
DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlResourceDataParser.h | 71 +
DynamicTablesPkg/Library/Common/AmlLib/ResourceData/AmlResourceData.c | 103 ++
DynamicTablesPkg/Library/Common/AmlLib/ResourceData/AmlResourceData.h | 174 +++
DynamicTablesPkg/Library/Common/AmlLib/Serialize/AmlSerialize.c | 324 +++++
DynamicTablesPkg/Library/Common/AmlLib/Stream/AmlStream.c | 665 +++++++++
DynamicTablesPkg/Library/Common/AmlLib/Stream/AmlStream.h | 451 ++++++
DynamicTablesPkg/Library/Common/AmlLib/String/AmlString.c | 1022 +++++++++++++
DynamicTablesPkg/Library/Common/AmlLib/String/AmlString.h | 401 ++++++
DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlClone.c | 205 +++
DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlNode.c | 673 +++++++++
DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlNode.h | 212 +++
DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlNodeInterface.c | 566 ++++++++
DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTree.c | 1047 ++++++++++++++
DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTree.h | 127 ++
DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTreeEnumerator.c | 98 ++
DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTreeIterator.c | 353 +++++
DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTreeIterator.h | 220 +++
DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTreeTraversal.c | 548 +++++++
DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTreeTraversal.h | 138 ++
DynamicTablesPkg/Library/Common/AmlLib/Utils/AmlUtility.c | 906 ++++++++++++
DynamicTablesPkg/Library/Common/AmlLib/Utils/AmlUtility.h | 95 ++
DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFixupLib.c | 524 +++++++
DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFixupLib.inf | 30 +
DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortTemplate.asl | 60 +
DynamicTablesPkg/Library/Common/TableHelperLib/TableHelper.c | 30 +-
DynamicTablesPkg/Readme.md | 128 +-
66 files changed, 21247 insertions(+), 154 deletions(-)
create mode 100644 DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h
create mode 100644 DynamicTablesPkg/Include/Library/SsdtSerialPortFixupLib.h
create mode 100644 DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtSerialPortLibArm/SsdtSerialPortGenerator.c
create mode 100644 DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtSerialPortLibArm/SsdtSerialPortLibArm.inf
create mode 100644 DynamicTablesPkg/Library/Common/AmlLib/AmlCoreInterface.h
create mode 100644 DynamicTablesPkg/Library/Common/AmlLib/AmlDbgPrint/AmlDbgPrint.c
create mode 100644 DynamicTablesPkg/Library/Common/AmlLib/AmlDbgPrint/AmlDbgPrint.h
create mode 100644 DynamicTablesPkg/Library/Common/AmlLib/AmlDefines.h
create mode 100644 DynamicTablesPkg/Library/Common/AmlLib/AmlEncoding/Aml.c
create mode 100644 DynamicTablesPkg/Library/Common/AmlLib/AmlEncoding/Aml.h
create mode 100644 DynamicTablesPkg/Library/Common/AmlLib/AmlInclude.h
create mode 100644 DynamicTablesPkg/Library/Common/AmlLib/AmlLib.inf
create mode 100644 DynamicTablesPkg/Library/Common/AmlLib/AmlNodeDefines.h
create mode 100644 DynamicTablesPkg/Library/Common/AmlLib/Api/AmlApi.c
create mode 100644 DynamicTablesPkg/Library/Common/AmlLib/Api/AmlApiHelper.c
create mode 100644 DynamicTablesPkg/Library/Common/AmlLib/Api/AmlApiHelper.h
create mode 100644 DynamicTablesPkg/Library/Common/AmlLib/Api/AmlResourceDataApi.c
create mode 100644 DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c
create mode 100644 DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.c
create mode 100644 DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeGen.h
create mode 100644 DynamicTablesPkg/Library/Common/AmlLib/NameSpace/AmlNameSpace.c
create mode 100644 DynamicTablesPkg/Library/Common/AmlLib/NameSpace/AmlNameSpace.h
create mode 100644 DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlFieldListParser.c
create mode 100644 DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlFieldListParser.h
create mode 100644 DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlMethodParser.c
create mode 100644 DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlMethodParser.h
create mode 100644 DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlParser.c
create mode 100644 DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlParser.h
create mode 100644 DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlResourceDataParser.c
create mode 100644 DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlResourceDataParser.h
create mode 100644 DynamicTablesPkg/Library/Common/AmlLib/ResourceData/AmlResourceData.c
create mode 100644 DynamicTablesPkg/Library/Common/AmlLib/ResourceData/AmlResourceData.h
create mode 100644 DynamicTablesPkg/Library/Common/AmlLib/Serialize/AmlSerialize.c
create mode 100644 DynamicTablesPkg/Library/Common/AmlLib/Stream/AmlStream.c
create mode 100644 DynamicTablesPkg/Library/Common/AmlLib/Stream/AmlStream.h
create mode 100644 DynamicTablesPkg/Library/Common/AmlLib/String/AmlString.c
create mode 100644 DynamicTablesPkg/Library/Common/AmlLib/String/AmlString.h
create mode 100644 DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlClone.c
create mode 100644 DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlNode.c
create mode 100644 DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlNode.h
create mode 100644 DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlNodeInterface.c
create mode 100644 DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTree.c
create mode 100644 DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTree.h
create mode 100644 DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTreeEnumerator.c
create mode 100644 DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTreeIterator.c
create mode 100644 DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTreeIterator.h
create mode 100644 DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTreeTraversal.c
create mode 100644 DynamicTablesPkg/Library/Common/AmlLib/Tree/AmlTreeTraversal.h
create mode 100644 DynamicTablesPkg/Library/Common/AmlLib/Utils/AmlUtility.c
create mode 100644 DynamicTablesPkg/Library/Common/AmlLib/Utils/AmlUtility.h
create mode 100644 DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFixupLib.c
create mode 100644 DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFixupLib.inf
create mode 100644 DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortTemplate.asl

--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'

Join devel@edk2.groups.io to automatically receive all group messages.