ACPICA: Events: Add support to return both enable/status register values for GPE...
authorLv Zheng <lv.zheng@intel.com>
Mon, 13 Apr 2015 03:49:13 +0000 (11:49 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 14 Apr 2015 12:51:52 +0000 (14:51 +0200)
ACPICA commit e25d791e4b3d5b9f4ead298269610cb05f89749a

There is a facility in Linux, developers can obtain GPE and fixed event
status via /sys/firmware/interrupts/. This is implemented using
acpi_get_event_status() and acpi_get_gpe_status(). Recently while debugging some
GPE race issues, it is found that the facility is lacking in the ability to
obtain real hardware register values, the confusing information makes
debugging difficult.

This patch modifies acpi_get_gpe_status() to return EN register values to fix
this gap. Then flags returned from acpi_get_event_status() and
acpi_get_gpe_status() are also cleaned up to reflect this change.

The old ACPI_EVENT_FLAG_SET is carefully kept to avoid regressions. It can
be deleted after we can make sure all its references are removed from OSPM
code. Lv Zheng.

Link: https://github.com/acpica/acpica/commit/e25d791e
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/acpica/evxfevnt.c
drivers/acpi/acpica/hwgpe.c
include/acpi/actypes.h

index df06a23c4197cbbb8755a9f2363a4eb951484a21..faad911d46b5eb71c4ae93a5300cf460e63c8738 100644 (file)
@@ -356,7 +356,8 @@ acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status)
        }
 
        if (in_byte) {
-               local_event_status |= ACPI_EVENT_FLAG_ENABLED;
+               local_event_status |=
+                   (ACPI_EVENT_FLAG_ENABLED | ACPI_EVENT_FLAG_ENABLE_SET);
        }
 
        /* Fixed event currently active? */
@@ -369,7 +370,7 @@ acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status)
        }
 
        if (in_byte) {
-               local_event_status |= ACPI_EVENT_FLAG_SET;
+               local_event_status |= ACPI_EVENT_FLAG_STATUS_SET;
        }
 
        (*event_status) = local_event_status;
index 84bc550f4f1d2bd9b8c3dec7b4dab9fdee013cf2..d7be3cbff1518a80a2344a2cf8d67b44575edb51 100644 (file)
@@ -250,6 +250,17 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info,
                local_event_status |= ACPI_EVENT_FLAG_WAKE_ENABLED;
        }
 
+       /* GPE currently enabled (enable bit == 1)? */
+
+       status = acpi_hw_read(&in_byte, &gpe_register_info->enable_address);
+       if (ACPI_FAILURE(status)) {
+               return (status);
+       }
+
+       if (register_bit & in_byte) {
+               local_event_status |= ACPI_EVENT_FLAG_ENABLE_SET;
+       }
+
        /* GPE currently active (status bit == 1)? */
 
        status = acpi_hw_read(&in_byte, &gpe_register_info->status_address);
@@ -258,7 +269,7 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info,
        }
 
        if (register_bit & in_byte) {
-               local_event_status |= ACPI_EVENT_FLAG_SET;
+               local_event_status |= ACPI_EVENT_FLAG_STATUS_SET;
        }
 
        /* Set return value */
index 658c42e25568140900e0afda151e558315b8e9e1..f18b7a814730c7f31202b6cc13cddaf73c01eba5 100644 (file)
@@ -733,23 +733,26 @@ typedef u32 acpi_event_type;
  * The encoding of acpi_event_status is illustrated below.
  * Note that a set bit (1) indicates the property is TRUE
  * (e.g. if bit 0 is set then the event is enabled).
- * +-------------+-+-+-+-+
- * |   Bits 31:4 |3|2|1|0|
- * +-------------+-+-+-+-+
- *          |     | | | |
- *          |     | | | +- Enabled?
- *          |     | | +--- Enabled for wake?
- *          |     | +----- Set?
- *          |     +------- Has a handler?
- *          +------------- <Reserved>
+ * +-------------+-+-+-+-+-+
+ * |   Bits 31:5 |4|3|2|1|0|
+ * +-------------+-+-+-+-+-+
+ *          |     | | | | |
+ *          |     | | | | +- Enabled?
+ *          |     | | | +--- Enabled for wake?
+ *          |     | | +----- Status bit set?
+ *          |     | +------- Enable bit set?
+ *          |     +--------- Has a handler?
+ *          +--------------- <Reserved>
  */
 typedef u32 acpi_event_status;
 
 #define ACPI_EVENT_FLAG_DISABLED        (acpi_event_status) 0x00
 #define ACPI_EVENT_FLAG_ENABLED         (acpi_event_status) 0x01
 #define ACPI_EVENT_FLAG_WAKE_ENABLED    (acpi_event_status) 0x02
-#define ACPI_EVENT_FLAG_SET             (acpi_event_status) 0x04
-#define ACPI_EVENT_FLAG_HAS_HANDLER     (acpi_event_status) 0x08
+#define ACPI_EVENT_FLAG_STATUS_SET      (acpi_event_status) 0x04
+#define ACPI_EVENT_FLAG_ENABLE_SET      (acpi_event_status) 0x08
+#define ACPI_EVENT_FLAG_HAS_HANDLER     (acpi_event_status) 0x10
+#define ACPI_EVENT_FLAG_SET             ACPI_EVENT_FLAG_STATUS_SET
 
 /* Actions for acpi_set_gpe, acpi_gpe_wakeup, acpi_hw_low_set_gpe */