From f97598f22fc228e3dc7e3887e9697bc50c579c97 Mon Sep 17 00:00:00 2001 From: Cliff Huang Date: Wed, 1 Mar 2023 14:30:41 -0800 Subject: acpi: Warn on timeout in write_delay_until() Make ACPI code print a debug warning message when a timeout is detected in a loop waiting for a condition. This timeout message won't be displayed when this function is used as delay loop (ie. without checking variable condition). The following is required to get this log in kernel log buffer: echo 1 > /sys/module/acpi/parameters/aml_debug_output Here is an example of generated code when waiting for variable L23E to be 0. Local7 = 0x08 While ((Local7 > Zero)) { If ((L23E == Zero)) { Break } Sleep (0x10) Local7-- If ((Local7 == Zero)) { Debug = "WARN: Wait loop timeout for variable L23E" } } BRANCH=firmware-brya-14505.B TEST=Boot to OS and check that the Debug print is added to the function. Change-Id: I3843e51988527e99822017d1b5f653ff2eaa7958 Signed-off-by: Cliff Huang Signed-off-by: Jeremy Compostella Reviewed-on: https://review.coreboot.org/c/coreboot/+/73348 Reviewed-by: Nico Huber Tested-by: build bot (Jenkins) Reviewed-by: Lean Sheng Tan --- src/acpi/acpigen.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/acpi') diff --git a/src/acpi/acpigen.c b/src/acpi/acpigen.c index fdf98cdda2..fb84cd18a3 100644 --- a/src/acpi/acpigen.c +++ b/src/acpi/acpigen.c @@ -2391,6 +2391,13 @@ void acpigen_write_delay_until_namestr_int(uint32_t wait_ms, const char *name, u acpigen_emit_byte(DECREMENT_OP); acpigen_emit_byte(LOCAL7_OP); acpigen_pop_len(); /* While */ + + if (name) { + acpigen_write_if_lequal_op_op(LOCAL7_OP, ZERO_OP); + acpigen_write_debug_sprintf("WARN: Wait loop timeout for variable %s", + name); + acpigen_pop_len(); /* If */ + } } void acpigen_ssdt_override_sleep_states(bool enable_s1, bool enable_s2, bool enable_s3, -- cgit v1.2.3