summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFurquan Shaikh <furquan@google.com>2018-10-18 16:20:40 -0700
committerFurquan Shaikh <furquan@google.com>2018-10-23 14:35:27 +0000
commit1ef2c5303b5847d52d66f4b57cb7d21dae9246a6 (patch)
tree285678ce419da8a87f7f43082772b0e3104c238b
parente7864ceabc2a5b808007688b2b6fb437a154b29a (diff)
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 <furquan@google.com> Reviewed-on: https://review.coreboot.org/29187 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
-rw-r--r--src/arch/x86/include/arch/acpi_device.h65
1 files changed, 38 insertions, 27 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_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_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_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_CFG(_pin, _mode, _pol, _shared, _wake) { \
+ .pin = (_pin), \
+ .mode = (_mode), \
+ .polarity = (_pol), \
+ .shared = (_shared), \
+ .wake = (_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_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_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);