
On Wed, Jul 8, 2020 at 3:12 AM Simon Glass sjg@chromium.org wrote:
Add a new file to handle generating ACPI code programatically. This is used when information must be dynamically added to the tables, e.g. the SSDT.
Initial support is just for writing simple values. Also add a 'base' value so that the table can be freed. This likely doesn't happen in normal code, but is nice to do in tests.
Reviewed-by: Wolfgang Wallner wolfgang.wallner@br-automation.com Signed-off-by: Simon Glass sjg@chromium.org
Changes in v4:
- Setup ctx->base as well as ctx->current in acpi_setup_base_tables()
- Add a comment about little-endian in acpigen_emit_dword()
- Add a #define for the context size in alloc_context()
Changes in v2:
- Update to add a new 'base' field to struct acpi_ctx
- Free the memory allocated to the table and context
include/acpi/acpigen.h | 49 ++++++++++++++++++++++++++++ include/dm/acpi.h | 2 ++ lib/acpi/Makefile | 1 + lib/acpi/acpi_table.c | 1 + lib/acpi/acpigen.c | 39 +++++++++++++++++++++++ test/dm/Makefile | 1 + test/dm/acpigen.c | 72 ++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 165 insertions(+) create mode 100644 include/acpi/acpigen.h create mode 100644 lib/acpi/acpigen.c create mode 100644 test/dm/acpigen.c
Reviewed-by: Bin Meng bmeng.cn@gmail.com