src/acpi/device: 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 BUG=b:225022810 TEST=Dump SSDT table for guybrush Signed-off-by: Tim Van Patten <timvp@google.com> Change-Id: I13aa41766555953b86eded4c72e3b317fe6db5c8 Reviewed-on: https://review.coreboot.org/c/coreboot/+/63613 Reviewed-by: Raul Rangel <rrangel@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
e9667f4df1
commit
3d4665cc71
|
@ -670,6 +670,19 @@ void acpi_device_add_power_res(const struct acpi_power_res_params *params)
|
|||
|
||||
/* 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. This avoids
|
||||
unnecessary delays while booting. */
|
||||
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) {
|
||||
|
|
Loading…
Reference in New Issue