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 <cliff.huang@intel.com>
Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/73348
Reviewed-by: Nico Huber <nico.h@gmx.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Lean Sheng Tan <sheng.tan@9elements.com>
This commit is contained in:
Cliff Huang 2023-03-01 14:30:41 -08:00 committed by Felix Held
parent ea49357e90
commit f97598f22f
1 changed files with 7 additions and 0 deletions

View File

@ -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,