summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCliff Huang <cliff.huang@intel.com>2023-03-01 14:30:41 -0800
committerFelix Held <felix-coreboot@felixheld.de>2023-05-17 11:30:30 +0000
commitf97598f22fc228e3dc7e3887e9697bc50c579c97 (patch)
treef9263a220761a15ed5d83b70cc94884d8f4a33ff
parentea49357e90441eaef30cb1cd3c80ca409eeb72ca (diff)
downloadcoreboot-f97598f22fc228e3dc7e3887e9697bc50c579c97.tar.gz
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>
-rw-r--r--src/acpi/acpigen.c7
1 files changed, 7 insertions, 0 deletions
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,