Kapil Porwal has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/87130?usp=email )
Change subject: acpi: Add method write _PRW using GPIO ......................................................................
acpi: Add method write _PRW using GPIO
Change-Id: I35c717f5996d2b0110bff93221e35e44169e4154 Signed-off-by: Kapil Porwal kapilporwal@google.com --- M src/acpi/device.c M src/include/acpi/acpi_device.h 2 files changed, 27 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/30/87130/1
diff --git a/src/acpi/device.c b/src/acpi/device.c index af3d262..66c8abb 100644 --- a/src/acpi/device.c +++ b/src/acpi/device.c @@ -435,6 +435,30 @@ acpi_device_fill_len(desc_length); }
+/* ACPI 6.1 section 7.3.13 _PRW (Power Resources for Wake) */ +void acpigen_write_gpio_PRW(const struct acpi_gpio *gpio, u32 level) +{ + if (!gpio || gpio->type != ACPI_GPIO_TYPE_INTERRUPT) + return; + + /* + * Name (_PRW, Package () { Package () { path, index }, level }) + */ + acpigen_write_name("_PRW"); + acpigen_write_package(2); + acpigen_write_package(2); +#if CONFIG(GENERIC_GPIO_LIB) + acpigen_emit_string(gpio->resource ? : gpio_acpi_path(gpio->pins[0])); + acpigen_write_integer(gpio_acpi_pin(gpio->pins[0])); +#else + acpigen_emit_string(gpio->resource); + acpigen_write_integer(gpio->pins[0]); +#endif + acpigen_pop_len(); + acpigen_write_integer(level); + acpigen_pop_len(); +} + /* ACPI 6.1 section 6.4.3.8.2.1 - I2cSerialBus() */ void acpi_device_write_i2c(const struct acpi_i2c *i2c) { diff --git a/src/include/acpi/acpi_device.h b/src/include/acpi/acpi_device.h index 3b66989..ad7c822 100644 --- a/src/include/acpi/acpi_device.h +++ b/src/include/acpi/acpi_device.h @@ -280,6 +280,9 @@ /* Write GpioIo() or GpioInt() descriptor to SSDT AML output */ void acpi_device_write_gpio(const struct acpi_gpio *gpio);
+/* Write _PRW with a GPIO to SSDT AML output */ +void acpigen_write_gpio_PRW(const struct acpi_gpio *gpio, u32 level); + /* * ACPI Descriptors for Serial Bus interfaces */