diff mbox series

[3/3] cmd: acpi: check HW reduced flag in acpi list

Message ID 20231215164016.137794-4-heinrich.schuchardt@canonical.com
State Superseded, archived
Delegated to: Simon Glass
Headers show
Series cmd: acpi: fix list_fadt() | expand

Commit Message

Heinrich Schuchardt Dec. 15, 2023, 4:40 p.m. UTC
On non x86 platforms the hardware reduce flag must be set in the FADT
table. Write an error message if the flag is missing.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 cmd/acpi.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Andy Shevchenko Dec. 15, 2023, 5:46 p.m. UTC | #1
On Fri, Dec 15, 2023 at 05:40:16PM +0100, Heinrich Schuchardt wrote:
> On non x86 platforms the hardware reduce flag must be set in the FADT
> table. Write an error message if the flag is missing.

...

> +	if (!IS_ENABLED(CONFIG_X86) &&
> +	    !(fadt->flags & ACPI_FADT_HW_REDUCED_ACPI))
> +		log_err("FADT not ACPI hardware reduced compliant\n");

I guess it's half baked solution as this, HW reduced, flag adds more
limitations even on x86. If you want a good validation it should be done
in a separate function taking others aspects into account.

But since it doesn't affect my area of interest in U-Boot, I won't prevent
you from doing this way, it's up to the U-Boot maintainers how to proceed
with it.
Heinrich Schuchardt Dec. 15, 2023, 7:22 p.m. UTC | #2
On 12/15/23 18:46, Andy Shevchenko wrote:
> On Fri, Dec 15, 2023 at 05:40:16PM +0100, Heinrich Schuchardt wrote:
>> On non x86 platforms the hardware reduce flag must be set in the FADT
>> table. Write an error message if the flag is missing.
> 
> ...
> 
>> +	if (!IS_ENABLED(CONFIG_X86) &&
>> +	    !(fadt->flags & ACPI_FADT_HW_REDUCED_ACPI))
>> +		log_err("FADT not ACPI hardware reduced compliant\n");
> 
> I guess it's half baked solution as this, HW reduced, flag adds more
> limitations even on x86. If you want a good validation it should be done
> in a separate function taking others aspects into account.
> 
> But since it doesn't affect my area of interest in U-Boot, I won't prevent
> you from doing this way, it's up to the U-Boot maintainers how to proceed
> with it.
> 

This flag is checked by Linux. It won't boot at all if the flag is not 
set on arm64 or riscv64. See arch/arm64/kernel/acpi.c and 
arch/riscv/kernel/acpi.c, function acpi_fadt_sanity_check().

Once you have booted you can use the Firmware Test Suite (FWTS) to check 
the rest. I don't plan rewriting such a validation in U-Boot.

Best regards

Heinrich
diff mbox series

Patch

diff --git a/cmd/acpi.c b/cmd/acpi.c
index 24910c150b..2e9a333ffa 100644
--- a/cmd/acpi.c
+++ b/cmd/acpi.c
@@ -6,6 +6,7 @@ 
 #include <common.h>
 #include <command.h>
 #include <display_options.h>
+#include <log.h>
 #include <mapmem.h>
 #include <acpi/acpi_table.h>
 #include <asm/acpi_table.h>
@@ -57,6 +58,9 @@  static void list_fadt(struct acpi_fadt *fadt)
 		dump_hdr(map_sysmem(fadt->x_dsdt, 0));
 	else if (fadt->dsdt)
 		dump_hdr(map_sysmem(fadt->dsdt, 0));
+	if (!IS_ENABLED(CONFIG_X86) &&
+	    !(fadt->flags & ACPI_FADT_HW_REDUCED_ACPI))
+		log_err("FADT not ACPI hardware reduced compliant\n");
 	if (fadt->x_firmware_ctrl)
 		dump_hdr(map_sysmem(fadt->x_firmware_ctrl, 0));
 	else if (fadt->firmware_ctrl)