1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-01 00:32:04 +02:00

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>
This commit is contained in:
Simon Glass
2020-04-26 09:19:47 -06:00
committed by Bin Meng
parent 93f7f82782
commit 86e1778ded
4 changed files with 130 additions and 46 deletions

View File

@@ -6,10 +6,11 @@
*/
#include <common.h>
#include <acpi/acpi_table.h>
#include <dm.h>
#include <cpu.h>
#include <version.h>
#include <acpi/acpi_table.h>
#include <dm/acpi.h>
int acpi_create_dmar(struct acpi_dmar *dmar, enum dmar_flags flags)
{
@@ -98,3 +99,24 @@ void acpi_fill_header(struct acpi_table_header *header, char *signature)
header->oem_revision = U_BOOT_BUILD_DATE;
memcpy(header->aslc_id, ASLC_ID, 4);
}
void acpi_align(struct acpi_ctx *ctx)
{
ctx->current = (void *)ALIGN((ulong)ctx->current, 16);
}
void acpi_align64(struct acpi_ctx *ctx)
{
ctx->current = (void *)ALIGN((ulong)ctx->current, 64);
}
void acpi_inc(struct acpi_ctx *ctx, uint amount)
{
ctx->current += amount;
}
void acpi_inc_align(struct acpi_ctx *ctx, uint amount)
{
ctx->current += amount;
acpi_align(ctx);
}