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>
This commit is contained in:
Furquan Shaikh 2018-10-18 16:20:40 -07:00
parent e7864ceabc
commit 1ef2c5303b
1 changed files with 35 additions and 24 deletions

View File

@ -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);