acpi: x86: Move MADT to common code

Write MADT in common code and let the SoC fill out the body by
calling acpi_fill_madt() which must be implemented at SoC level.

Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
Patrick Rudolph
2024-10-23 15:19:46 +02:00
committed by Tom Rini
parent f5f7962091
commit 4a3fc0f525
8 changed files with 86 additions and 53 deletions

View File

@@ -240,6 +240,37 @@ int acpi_write_fadt(struct acpi_ctx *ctx, const struct acpi_writer *entry)
ACPI_WRITER(5fadt, "FADT", acpi_write_fadt, 0);
int acpi_write_madt(struct acpi_ctx *ctx, const struct acpi_writer *entry)
{
struct acpi_table_header *header;
struct acpi_madt *madt;
void *current;
madt = ctx->current;
memset(madt, '\0', sizeof(struct acpi_madt));
header = &madt->header;
/* Fill out header fields */
acpi_fill_header(header, "APIC");
header->length = sizeof(struct acpi_madt);
header->revision = ACPI_MADT_REV_ACPI_3_0;
acpi_inc(ctx, sizeof(struct acpi_madt));
current = acpi_fill_madt(madt, ctx);
/* (Re)calculate length and checksum */
header->length = (uintptr_t)current - (uintptr_t)madt;
header->checksum = table_compute_checksum((void *)madt, header->length);
acpi_add_table(ctx, madt);
ctx->current = (void *)madt + madt->header.length;
return 0;
}
ACPI_WRITER(5madt, "MADT", acpi_write_madt, 0);
void acpi_create_dbg2(struct acpi_dbg2_header *dbg2,
int port_type, int port_subtype,
struct acpi_gen_regaddr *address, u32 address_size,