From 1ef2c5303b5847d52d66f4b57cb7d21dae9246a6 Mon Sep 17 00:00:00 2001 From: Furquan Shaikh Date: Thu, 18 Oct 2018 16:20:40 -0700 Subject: [PATCH] acpi_device: Refine ACPI_IRQ_* macros This change does the following: 1. Adds a helper macro ACPI_IRQ_CFG that can be used by all other ACPI_IRQ* macros to initialize acpi_irq structure. 2. Provides ACPI_IRQ_WAKE* versions to allow board to define an irq as wake capable. BUG=b:117553222 Change-Id: Ic53c6019527bbd270806897247f547178cd1ad3c Signed-off-by: Furquan Shaikh Reviewed-on: https://review.coreboot.org/29187 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin Reviewed-by: Paul Menzel --- src/arch/x86/include/arch/acpi_device.h | 59 +++++++++++++++---------- 1 file changed, 35 insertions(+), 24 deletions(-) diff --git a/src/arch/x86/include/arch/acpi_device.h b/src/arch/x86/include/arch/acpi_device.h index 2711af5a60..d26f330695 100644 --- a/src/arch/x86/include/arch/acpi_device.h +++ b/src/arch/x86/include/arch/acpi_device.h @@ -101,33 +101,44 @@ struct acpi_irq { enum acpi_irq_wake wake; }; -#define ACPI_IRQ_EDGE_LOW(x) { \ - .pin = (x), \ - .mode = ACPI_IRQ_EDGE_TRIGGERED, \ - .polarity = ACPI_IRQ_ACTIVE_LOW, \ - .shared = ACPI_IRQ_EXCLUSIVE, \ - .wake = ACPI_IRQ_NO_WAKE } +#define ACPI_IRQ_CFG(_pin, _mode, _pol, _shared, _wake) { \ + .pin = (_pin), \ + .mode = (_mode), \ + .polarity = (_pol), \ + .shared = (_shared), \ + .wake = (_wake) } -#define ACPI_IRQ_EDGE_HIGH(x) { \ - .pin = (x), \ - .mode = ACPI_IRQ_EDGE_TRIGGERED, \ - .polarity = ACPI_IRQ_ACTIVE_HIGH, \ - .shared = ACPI_IRQ_EXCLUSIVE, \ - .wake = ACPI_IRQ_NO_WAKE } +#define ACPI_IRQ_EDGE_LOW(x) \ + ACPI_IRQ_CFG((x), ACPI_IRQ_EDGE_TRIGGERED, ACPI_IRQ_ACTIVE_LOW, \ + ACPI_IRQ_EXCLUSIVE, ACPI_IRQ_NO_WAKE) -#define ACPI_IRQ_LEVEL_LOW(x) { \ - .pin = (x), \ - .mode = ACPI_IRQ_LEVEL_TRIGGERED, \ - .polarity = ACPI_IRQ_ACTIVE_LOW, \ - .shared = ACPI_IRQ_SHARED, \ - .wake = ACPI_IRQ_NO_WAKE } +#define ACPI_IRQ_EDGE_HIGH(x) \ + ACPI_IRQ_CFG((x), ACPI_IRQ_EDGE_TRIGGERED, ACPI_IRQ_ACTIVE_HIGH, \ + ACPI_IRQ_EXCLUSIVE, ACPI_IRQ_NO_WAKE) -#define ACPI_IRQ_LEVEL_HIGH(x) { \ - .pin = (x), \ - .mode = ACPI_IRQ_LEVEL_TRIGGERED, \ - .polarity = ACPI_IRQ_ACTIVE_HIGH, \ - .shared = ACPI_IRQ_SHARED, \ - .wake = ACPI_IRQ_NO_WAKE } +#define ACPI_IRQ_LEVEL_LOW(x) \ + ACPI_IRQ_CFG((x), ACPI_IRQ_LEVEL_TRIGGERED, ACPI_IRQ_ACTIVE_LOW, \ + ACPI_IRQ_SHARED, ACPI_IRQ_NO_WAKE) + +#define ACPI_IRQ_LEVEL_HIGH(x) \ + ACPI_IRQ_CFG((x), ACPI_IRQ_LEVEL_TRIGGERED, ACPI_IRQ_ACTIVE_HIGH, \ + ACPI_IRQ_SHARED, ACPI_IRQ_NO_WAKE) + +#define ACPI_IRQ_WAKE_EDGE_LOW(x) \ + ACPI_IRQ_CFG((x), ACPI_IRQ_EDGE_TRIGGERED, ACPI_IRQ_ACTIVE_LOW, \ + ACPI_IRQ_EXCLUSIVE, ACPI_IRQ_WAKE) + +#define ACPI_IRQ_WAKE_EDGE_HIGH(x) \ + ACPI_IRQ_CFG((x), ACPI_IRQ_EDGE_TRIGGERED, ACPI_IRQ_ACTIVE_HIGH, \ + ACPI_IRQ_EXCLUSIVE, ACPI_IRQ_WAKE) + +#define ACPI_IRQ_WAKE_LEVEL_LOW(x) \ + ACPI_IRQ_CFG((x), ACPI_IRQ_LEVEL_TRIGGERED, ACPI_IRQ_ACTIVE_LOW, \ + ACPI_IRQ_SHARED, ACPI_IRQ_WAKE) + +#define ACPI_IRQ_WAKE_LEVEL_HIGH(x) \ + ACPI_IRQ_CFG((x), ACPI_IRQ_LEVEL_TRIGGERED, ACPI_IRQ_ACTIVE_HIGH, \ + ACPI_IRQ_SHARED, ACPI_IRQ_WAKE) /* Write extended Interrupt() descriptor to SSDT AML output */ void acpi_device_write_interrupt(const struct acpi_irq *irq);