diff options
author | Simon Glass <sjg@chromium.org> | 2020-04-26 09:19:47 -0600 |
---|---|---|
committer | Bin Meng <bmeng.cn@gmail.com> | 2020-04-30 17:16:12 +0800 |
commit | 86e1778ded011051774e20faaefe4b12a838b1a0 (patch) | |
tree | cdf0e908e1f9d3e2ec50187b6f42271984176e8b /include | |
parent | 93f7f82782cb3d2bd55215ce984887efc6cddfed (diff) | |
download | u-boot-86e1778ded011051774e20faaefe4b12a838b1a0.zip u-boot-86e1778ded011051774e20faaefe4b12a838b1a0.tar.gz u-boot-86e1778ded011051774e20faaefe4b12a838b1a0.tar.bz2 |
acpi: Convert part of acpi_table to use acpi_ctx
The current code uses an address but a pointer would result in fewer
casts. Also it repeats the alignment code in a lot of places so this would
be better done in a helper function.
Update write_acpi_tables() to make use of the new acpi_ctx structure,
adding a few helpers to clean things up.
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 | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/include/acpi/acpi_table.h b/include/acpi/acpi_table.h index a2bd929..6fd4c52 100644 --- a/include/acpi/acpi_table.h +++ b/include/acpi/acpi_table.h @@ -23,6 +23,8 @@ #if !defined(__ACPI__) +struct acpi_ctx; + /* * RSDP (Root System Description Pointer) * Note: ACPI 1.0 didn't have length, xsdt_address, and ext_checksum @@ -515,6 +517,40 @@ int acpi_create_dmar(struct acpi_dmar *dmar, enum dmar_flags flags); */ void acpi_fill_header(struct acpi_table_header *header, char *signature); +/** + * acpi_align() - Align the ACPI output pointer to a 16-byte boundary + * + * @ctx: ACPI context + */ +void acpi_align(struct acpi_ctx *ctx); + +/** + * acpi_align64() - Align the ACPI output pointer to a 64-byte boundary + * + * @ctx: ACPI context + */ +void acpi_align64(struct acpi_ctx *ctx); + +/** + * acpi_inc() - Increment the ACPI output pointer by a bit + * + * The pointer is NOT aligned afterwards. + * + * @ctx: ACPI context + * @amount: Amount to increment by + */ +void acpi_inc(struct acpi_ctx *ctx, uint amount); + +/** + * acpi_inc_align() - Increment the ACPI output pointer by a bit and align + * + * The pointer is aligned afterwards to a 16-byte boundary + * + * @ctx: ACPI context + * @amount: Amount to increment by + */ +void acpi_inc_align(struct acpi_ctx *ctx, uint amount); + #endif /* !__ACPI__*/ #include <asm/acpi_table.h> |