Skip to content

Commit

Permalink
Events: Add support to return both enable/status register values for …
Browse files Browse the repository at this point in the history
…GPE and fixed event.

There is a facility in Linux, developers can obtain GPE and fixed event
status via /sys/firmware/interrupts/. This is implemented using
AcpiGetEventStatus() and AcpiGetGpeStatus(). 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 AcpiGetGpeStatus() to return EN register values to fix
this gap. Then flags returned from AcpiGetEventStatus() and
AcpiGetGpeStatus() 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.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
  • Loading branch information
Lv Zheng committed Jan 27, 2015
1 parent c70434d commit e25d791
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 14 deletions.
5 changes: 3 additions & 2 deletions source/components/events/evxfevnt.c
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,8 @@ AcpiGetEventStatus (

if (InByte)
{
LocalEventStatus |= ACPI_EVENT_FLAG_ENABLED;
LocalEventStatus |=
(ACPI_EVENT_FLAG_ENABLED | ACPI_EVENT_FLAG_ENABLE_SET);
}

/* Fixed event currently active? */
Expand All @@ -487,7 +488,7 @@ AcpiGetEventStatus (

if (InByte)
{
LocalEventStatus |= ACPI_EVENT_FLAG_SET;
LocalEventStatus |= ACPI_EVENT_FLAG_STATUS_SET;
}

(*EventStatus) = LocalEventStatus;
Expand Down
15 changes: 14 additions & 1 deletion source/components/hardware/hwgpe.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,19 @@ AcpiHwGetGpeStatus (
LocalEventStatus |= ACPI_EVENT_FLAG_WAKE_ENABLED;
}

/* GPE currently enabled (enable bit == 1)? */

Status = AcpiHwRead (&InByte, &GpeRegisterInfo->EnableAddress);
if (ACPI_FAILURE (Status))
{
return (Status);
}

if (RegisterBit & InByte)
{
LocalEventStatus |= ACPI_EVENT_FLAG_ENABLE_SET;
}

/* GPE currently active (status bit == 1)? */

Status = AcpiHwRead (&InByte, &GpeRegisterInfo->StatusAddress);
Expand All @@ -362,7 +375,7 @@ AcpiHwGetGpeStatus (

if (RegisterBit & InByte)
{
LocalEventStatus |= ACPI_EVENT_FLAG_SET;
LocalEventStatus |= ACPI_EVENT_FLAG_STATUS_SET;
}

/* Set return value */
Expand Down
25 changes: 14 additions & 11 deletions source/include/actypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -812,23 +812,26 @@ typedef UINT32 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 UINT32 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 AcpiSetGpe, AcpiGpeWakeup, AcpiHwLowSetGpe */

Expand Down

0 comments on commit e25d791

Please sign in to comment.