Attention is currently required from: Lance Zhao, Tim Wawrzynczak. Tim Van Patten has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/63613 )
Change subject: src/acpi/device.c: Early return in _ON if device already enabled ......................................................................
src/acpi/device.c: Early return in _ON if device already enabled
If the device has enabled `use_gpio_for_status`, then call the `_STA` method in `_ON` to determine if the device is already enabled. If it is already enabled, return early to skip re-enabling the device and performing the associated sleep.
This change is necessary since the Linux kernel does not call `_STA` before calling `_ON`.
BRANCH=None Signed-off-by: Tim Van Patten timvp@google.com BUG=b:225022810 TEST=Dump SSDT table for guybrush Change-Id: I13aa41766555953b86eded4c72e3b317fe6db5c8 --- M src/acpi/device.c 1 file changed, 12 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/13/63613/1
diff --git a/src/acpi/device.c b/src/acpi/device.c index 1df179b..b514455 100644 --- a/src/acpi/device.c +++ b/src/acpi/device.c @@ -670,6 +670,18 @@
/* Method (_ON, 0, Serialized) */ acpigen_write_method_serialized("_ON", 0); + /* Call _STA and early return if the device is already enabled, since the Linux + kernel doesn't check the device status before calling _ON. */ + if (params->use_gpio_for_status) { + /* Local0 = _STA () */ + acpigen_write_store(); + acpigen_emit_namestring("_STA"); + acpigen_emit_byte(LOCAL0_OP); + /* If (( Local0 == ACPI_POWER_RESOURCE_STATUS_ON_OP)) */ + acpigen_write_if_lequal_op_op(LOCAL0_OP, ACPI_POWER_RESOURCE_STATUS_ON_OP); + acpigen_write_return_op(ZERO_OP); + acpigen_write_if_end(); + } if (reset_gpio) acpigen_enable_tx_gpio(params->reset_gpio); if (enable_gpio) {