table_compute_checksum() returns the value that makes the byte sum of
the buffer zero. If the ext_checksum field already contains a non-zero
value (as QEMU's firmware-provided RSDP does), adding that existing
value into the sum produces an incorrect complement. Zero the field
before calling table_compute_checksum() so the calculation starts from
a clean state, matching the pattern used in acpi_write_rsdp().

Signed-off-by: Heinrich Schuchardt <[email protected]>
---
v2:
        new patch
---
 drivers/misc/qfw_acpi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/misc/qfw_acpi.c b/drivers/misc/qfw_acpi.c
index 721f42ecbc3..afa3b820395 100644
--- a/drivers/misc/qfw_acpi.c
+++ b/drivers/misc/qfw_acpi.c
@@ -265,6 +265,7 @@ out:
        struct acpi_rsdp *rsdp = ctx->rsdp;
 
        rsdp->length = sizeof(*rsdp);
+       rsdp->ext_checksum = 0;
        rsdp->ext_checksum = table_compute_checksum((u8 *)rsdp, sizeof(*rsdp));
 
        gd_set_acpi_start(acpi_get_rsdp_addr());
-- 
2.53.0

Reply via email to