[PATCH v2 02/11] efi_selftest: add ACPI configuration table test

Heinrich Schuchardt heinrich.schuchardt at canonical.com
Thu Jun 25 13:26:43 CEST 2026


On 6/25/26 10:52, Simon Glass wrote:
> Hi Heinrich,
> 
> On 2026-06-21T08:19:04, Heinrich Schuchardt
> <heinrich.schuchardt at canonical.com> wrote:
>> efi_selftest: add ACPI configuration table test
>>
>> The new unit test checks if ACPI tables are available.
>>
>> If yes, it checks if the RSDP correctly points to the RSDT or XSDT.
>>
>> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
>>
>> lib/efi_selftest/Makefile            |   1 +
>>   lib/efi_selftest/efi_selftest_acpi.c | 138 +++++++++++++++++++++++++++++++++++
>>   2 files changed, 139 insertions(+)
> 
> Reviewed-by: Simon Glass <sjg at chromium.org>
> 
>> diff --git a/lib/efi_selftest/efi_selftest_acpi.c b/lib/efi_selftest/efi_selftest_acpi.c
>> @@ -0,0 +1,138 @@
>> +     if (!checksum_ok(rsdp, 20)) {
>> +             efi_st_error("Invalid RSDP checksum\n");
>> +             return EFI_ST_FAILURE;
>> +     }
> 
> Please avoid the magic 20 - how about offsetof(struct acpi_rsdp,
> length) or a named constant?
> 
> Regards,
> Simon

Thank you for reviewing.

20 is not an offset. It is the length of the ACPI 1.0 RSDP header.

Below is the precedent that Bin and you have been setting:

arch/x86/lib/acpi.c:18: if (table_compute_checksum((void *)rsdp, 20) != 0)
drivers/misc/qfw_acpi.c:310:    rsdp->checksum = 
table_compute_checksum(rsdp, 20);
lib/acpi/base.c:36:     rsdp->checksum = table_compute_checksum(rsdp, 20);
test/dm/acpi.c:371:     ut_assertok(table_compute_checksum(rsdp, 20));

Best regards

Heinrich


More information about the U-Boot mailing list