summaryrefslogtreecommitdiff
path: root/events/evgpeutil.c
diff options
context:
space:
mode:
Diffstat (limited to 'events/evgpeutil.c')
-rw-r--r--events/evgpeutil.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/events/evgpeutil.c b/events/evgpeutil.c
index 1bd42b2cac1d6..d1558376251c5 100644
--- a/events/evgpeutil.c
+++ b/events/evgpeutil.c
@@ -241,6 +241,51 @@ AcpiEvValidGpeEvent (
/*******************************************************************************
*
+ * FUNCTION: AcpiEvGetGpeDevice
+ *
+ * PARAMETERS: GPE_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Matches the input GPE index (0-CurrentGpeCount) with a GPE
+ * block device. NULL if the GPE is one of the FADT-defined GPEs.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEvGetGpeDevice (
+ ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
+ ACPI_GPE_BLOCK_INFO *GpeBlock,
+ void *Context)
+{
+ ACPI_GPE_DEVICE_INFO *Info = Context;
+
+
+ /* Increment Index by the number of GPEs in this block */
+
+ Info->NextBlockBaseIndex += GpeBlock->GpeCount;
+
+ if (Info->Index < Info->NextBlockBaseIndex)
+ {
+ /*
+ * The GPE index is within this block, get the node. Leave the node
+ * NULL for the FADT-defined GPEs
+ */
+ if ((GpeBlock->Node)->Type == ACPI_TYPE_DEVICE)
+ {
+ Info->GpeDevice = GpeBlock->Node;
+ }
+
+ Info->Status = AE_OK;
+ return (AE_CTRL_END);
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiEvGetGpeXruptBlock
*
* PARAMETERS: InterruptNumber - Interrupt for a GPE block