summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/hwgpe.c
diff options
context:
space:
mode:
authormsmith <msmith@FreeBSD.org>2001-10-04 23:12:13 +0000
committermsmith <msmith@FreeBSD.org>2001-10-04 23:12:13 +0000
commitba72040ab6da527cb4f4a663259ca7417976499a (patch)
tree3c5d09bf67f1ee0a9b4f77e77f3a31bdd33a253f /sys/contrib/dev/acpica/hwgpe.c
parent9d39e615a85d5e81e8442ec3bf65c8dff5e393c5 (diff)
downloadFreeBSD-src-ba72040ab6da527cb4f4a663259ca7417976499a.zip
FreeBSD-src-ba72040ab6da527cb4f4a663259ca7417976499a.tar.gz
Import of the Intel ACPI CA 20010920 snapshot.
Diffstat (limited to 'sys/contrib/dev/acpica/hwgpe.c')
-rw-r--r--sys/contrib/dev/acpica/hwgpe.c162
1 files changed, 161 insertions, 1 deletions
diff --git a/sys/contrib/dev/acpica/hwgpe.c b/sys/contrib/dev/acpica/hwgpe.c
index 761cd93..27e343a 100644
--- a/sys/contrib/dev/acpica/hwgpe.c
+++ b/sys/contrib/dev/acpica/hwgpe.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: hwgpe - Low level GPE enable/disable/clear functions
- * $Revision: 32 $
+ * $Revision: 34 $
*
*****************************************************************************/
@@ -168,6 +168,45 @@ AcpiHwEnableGpe (
(InByte | BitMask), 8);
}
+/******************************************************************************
+ *
+ * FUNCTION: AcpiHwEnableGpeForWakeup
+ *
+ * PARAMETERS: GpeNumber - The GPE
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Keep track of which GPEs the OS has requested not be
+ * disabled when going to sleep.
+ *
+ ******************************************************************************/
+
+void
+AcpiHwEnableGpeForWakeup (
+ UINT32 GpeNumber)
+{
+ UINT32 RegisterIndex;
+ UINT32 BitMask;
+
+
+ FUNCTION_ENTRY ();
+
+
+ /*
+ * Translate GPE number to index into global registers array.
+ */
+ RegisterIndex = AcpiGbl_GpeValid[GpeNumber];
+
+ /*
+ * Figure out the bit offset for this GPE within the target register.
+ */
+ BitMask = AcpiGbl_DecodeTo8bit [MOD_8 (GpeNumber)];
+
+ /*
+ * Set the bit so we will not disable this when sleeping
+ */
+ AcpiGbl_GpeRegisters[RegisterIndex].WakeEnable |= BitMask;
+}
/******************************************************************************
*
@@ -211,8 +250,49 @@ AcpiHwDisableGpe (
AcpiOsReadPort (AcpiGbl_GpeRegisters[RegisterIndex].EnableAddr, &InByte, 8);
AcpiOsWritePort (AcpiGbl_GpeRegisters[RegisterIndex].EnableAddr,
(InByte & ~BitMask), 8);
+
+ AcpiHwDisableGpeForWakeup(GpeNumber);
}
+/******************************************************************************
+ *
+ * FUNCTION: AcpiHwDisableGpeForWakeup
+ *
+ * PARAMETERS: GpeNumber - The GPE
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Keep track of which GPEs the OS has requested not be
+ * disabled when going to sleep.
+ *
+ ******************************************************************************/
+
+void
+AcpiHwDisableGpeForWakeup (
+ UINT32 GpeNumber)
+{
+ UINT32 RegisterIndex;
+ UINT32 BitMask;
+
+
+ FUNCTION_ENTRY ();
+
+
+ /*
+ * Translate GPE number to index into global registers array.
+ */
+ RegisterIndex = AcpiGbl_GpeValid[GpeNumber];
+
+ /*
+ * Figure out the bit offset for this GPE within the target register.
+ */
+ BitMask = AcpiGbl_DecodeTo8bit [MOD_8 (GpeNumber)];
+
+ /*
+ * Clear the bit so we will disable this when sleeping
+ */
+ AcpiGbl_GpeRegisters[RegisterIndex].WakeEnable &= ~BitMask;
+}
/******************************************************************************
*
@@ -308,6 +388,14 @@ AcpiHwGetGpeStatus (
}
/*
+ * Enabled for wake?:
+ */
+ if (BitMask & AcpiGbl_GpeRegisters[RegisterIndex].WakeEnable)
+ {
+ (*EventStatus) |= ACPI_EVENT_FLAG_WAKE_ENABLED;
+ }
+
+ /*
* Set?
*/
InByte = 0;
@@ -317,3 +405,75 @@ AcpiHwGetGpeStatus (
(*EventStatus) |= ACPI_EVENT_FLAG_SET;
}
}
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiHwDisableNonWakeupGpes
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Disable all non-wakeup GPEs
+ * Call with interrupts disabled. The interrupt handler also
+ * modifies AcpiGbl_GpeRegisters[i].Enable, so it should not be
+ * given the chance to run until after non-wake GPEs are
+ * re-enabled.
+ *
+ ******************************************************************************/
+
+void
+AcpiHwDisableNonWakeupGpes (
+ void)
+{
+ UINT32 i;
+
+ FUNCTION_ENTRY ();
+
+ for (i = 0; i < AcpiGbl_GpeRegisterCount; i++)
+ {
+ /*
+ * Read the enabled status of all GPEs. We
+ * will be using it to restore all the GPEs later.
+ */
+ AcpiOsReadPort (AcpiGbl_GpeRegisters[i].EnableAddr,
+ &AcpiGbl_GpeRegisters[i].Enable, 8);
+
+ /*
+ * Disable all GPEs but wakeup GPEs.
+ */
+ AcpiOsWritePort(AcpiGbl_GpeRegisters[i].EnableAddr,
+ AcpiGbl_GpeRegisters[i].WakeEnable, 8);
+ }
+}
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiHwEnableNonWakeupGpes
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Enable all non-wakeup GPEs we previously enabled.
+ *
+ ******************************************************************************/
+
+void
+AcpiHwEnableNonWakeupGpes (
+ void)
+{
+ UINT32 i;
+
+ FUNCTION_ENTRY ();
+
+ for (i = 0; i < AcpiGbl_GpeRegisterCount; i++)
+ {
+ /*
+ * We previously stored the enabled status of all GPEs.
+ * Blast them back in.
+ */
+ AcpiOsWritePort(AcpiGbl_GpeRegisters[i].EnableAddr,
+ AcpiGbl_GpeRegisters[i].Enable, 8);
+ }
+}
OpenPOWER on IntegriCloud