diff options
| author | Tom Rini <[email protected]> | 2025-04-08 15:23:06 -0600 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2025-04-08 16:23:27 -0600 |
| commit | fba8bfdd0bf2db1edd0383ba89a0c6037a6fe807 (patch) | |
| tree | e6389f796e17959417c99a9ca196d373ffec4c94 /arch | |
| parent | a1dd42950dee5e0da8fb5e053d8506eaa4000bf4 (diff) | |
| parent | fecc50b0517d362b4db173b08a769f7b975d8255 (diff) | |
Merge patch series "acpi: simplify updating ACPI table header checksum"
Heinrich Schuchardt <[email protected]> says:
Introduce a new function to update ACPI table headers.
This allows to simplify the existing code.
Link: https://lore.kernel.org/r/[email protected]
Diffstat (limited to 'arch')
| -rw-r--r-- | arch/arm/mach-bcm283x/bcm2711_acpi.c | 4 | ||||
| -rw-r--r-- | arch/x86/cpu/apollolake/hostbridge.c | 2 | ||||
| -rw-r--r-- | arch/x86/lib/acpi_nhlt.c | 2 | ||||
| -rw-r--r-- | arch/x86/lib/acpi_table.c | 11 |
4 files changed, 8 insertions, 11 deletions
diff --git a/arch/arm/mach-bcm283x/bcm2711_acpi.c b/arch/arm/mach-bcm283x/bcm2711_acpi.c index 79b283353cf..58f8ee232b9 100644 --- a/arch/arm/mach-bcm283x/bcm2711_acpi.c +++ b/arch/arm/mach-bcm283x/bcm2711_acpi.c @@ -81,7 +81,7 @@ static int acpi_write_pptt(struct acpi_ctx *ctx, const struct acpi_writer *entry } header->length = ctx->current - ctx->tab_start; - header->checksum = table_compute_checksum(header, header->length); + acpi_update_checksum(header); acpi_inc(ctx, header->length); acpi_add_table(ctx, header); @@ -116,7 +116,7 @@ static int rpi_write_gtdt(struct acpi_ctx *ctx, const struct acpi_writer *entry) gtdt->el2_flags = GTDT_FLAG_INT_ACTIVE_LOW; gtdt->cnt_read_base = 0xffffffffffffffff; - header->checksum = table_compute_checksum(header, header->length); + acpi_update_checksum(header); acpi_add_table(ctx, gtdt); diff --git a/arch/x86/cpu/apollolake/hostbridge.c b/arch/x86/cpu/apollolake/hostbridge.c index 039236df02d..284f16cfd91 100644 --- a/arch/x86/cpu/apollolake/hostbridge.c +++ b/arch/x86/cpu/apollolake/hostbridge.c @@ -298,7 +298,7 @@ static int apl_acpi_hb_write_tables(const struct udevice *dev, /* (Re)calculate length and checksum */ header->length = ctx->current - (void *)dmar; - header->checksum = table_compute_checksum((void *)dmar, header->length); + acpi_update_checksum(header); acpi_align(ctx); acpi_add_table(ctx, dmar); diff --git a/arch/x86/lib/acpi_nhlt.c b/arch/x86/lib/acpi_nhlt.c index 880ef31df7d..8aae5fa5af7 100644 --- a/arch/x86/lib/acpi_nhlt.c +++ b/arch/x86/lib/acpi_nhlt.c @@ -414,7 +414,7 @@ int nhlt_serialise_oem_overrides(struct acpi_ctx *ctx, struct nhlt *nhlt, cur.start = (void *)header; nhlt_serialise_endpoints(nhlt, &cur); - header->checksum = table_compute_checksum(header, sz); + acpi_update_checksum(header); nhlt_free_resources(nhlt); assert(cur.buf - cur.start == sz); diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c index 3186e48d63b..b13292c4150 100644 --- a/arch/x86/lib/acpi_table.c +++ b/arch/x86/lib/acpi_table.c @@ -173,7 +173,7 @@ int acpi_write_tcpa(struct acpi_ctx *ctx, const struct acpi_writer *entry) /* (Re)calculate length and checksum */ current = (u32)tcpa + sizeof(struct acpi_tcpa); header->length = current - (u32)tcpa; - header->checksum = table_compute_checksum(tcpa, header->length); + acpi_update_checksum(header); acpi_inc(ctx, tcpa->header.length); acpi_add_table(ctx, tcpa); @@ -242,7 +242,7 @@ static int acpi_write_tpm2(struct acpi_ctx *ctx, tpm2->lasa = nomap_to_sysmem(lasa); /* Calculate checksum. */ - header->checksum = table_compute_checksum(tpm2, header->length); + acpi_update_checksum(header); acpi_inc(ctx, tpm2->header.length); acpi_add_table(ctx, tpm2); @@ -279,9 +279,7 @@ int acpi_write_gnvs(struct acpi_ctx *ctx, const struct acpi_writer *entry) * patched the GNVS address. Set the checksum to zero since it * is part of the region being checksummed. */ - ctx->dsdt->checksum = 0; - ctx->dsdt->checksum = table_compute_checksum((void *)ctx->dsdt, - ctx->dsdt->length); + acpi_update_checksum(ctx->dsdt); } /* Fill in platform-specific global NVS variables */ @@ -330,8 +328,7 @@ static int acpi_create_hpet(struct acpi_hpet *hpet) hpet->number = 0; hpet->min_tick = 0; /* HPET_MIN_TICKS */ - header->checksum = table_compute_checksum(hpet, - sizeof(struct acpi_hpet)); + acpi_update_checksum(header); return 0; } |
