diff options
author | Simon Glass <sjg@chromium.org> | 2020-04-26 09:19:50 -0600 |
---|---|---|
committer | Bin Meng <bmeng.cn@gmail.com> | 2020-04-30 17:16:12 +0800 |
commit | 29b351122ed23124f70473a411c65074d5a61146 (patch) | |
tree | 3291b96b1660fcc0fad1db917def8f2f14768370 /include | |
parent | 288edc78213433526e42cbc7c3dabca4fdf8e671 (diff) |
acpi: Move acpi_add_table() to generic code
Move this code to a generic location so that we can test it with sandbox.
This requires adding a few new fields to acpi_ctx, so drop the local
variables used in the original code.
Also use mapmem to avoid pointer-to-address casts which don't work on
sandbox.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/acpi/acpi_table.h | 9 | ||||
-rw-r--r-- | include/dm/acpi.h | 5 |
2 files changed, 14 insertions, 0 deletions
diff --git a/include/acpi/acpi_table.h b/include/acpi/acpi_table.h index 6fd4c5241a..55349c0bb6 100644 --- a/include/acpi/acpi_table.h +++ b/include/acpi/acpi_table.h @@ -551,6 +551,15 @@ void acpi_inc(struct acpi_ctx *ctx, uint amount); */ void acpi_inc_align(struct acpi_ctx *ctx, uint amount); +/** + * acpi_add_table() - Add a new table to the RSDP and XSDT + * + * @ctx: ACPI context + * @table: Table to add + * @return 0 if OK, -E2BIG if too many tables + */ +int acpi_add_table(struct acpi_ctx *ctx, void *table); + #endif /* !__ACPI__*/ #include <asm/acpi_table.h> diff --git a/include/dm/acpi.h b/include/dm/acpi.h index 69d69d7f42..c6c63b8183 100644 --- a/include/dm/acpi.h +++ b/include/dm/acpi.h @@ -30,9 +30,14 @@ * This contains a few useful pieces of information used when writing * * @current: Current address for writing + * @rsdp: Pointer to the Root System Description Pointer, typically used when + * adding a new table. The RSDP holds pointers to the RSDT and XSDT. + * @rsdt: Pointer to the Root System Description Table */ struct acpi_ctx { void *current; + struct acpi_rsdp *rsdp; + struct acpi_rsdt *rsdt; }; /** |