diff options
Diffstat (limited to 'sys/contrib/dev/acpica/evgpe.c')
-rw-r--r-- | sys/contrib/dev/acpica/evgpe.c | 63 |
1 files changed, 31 insertions, 32 deletions
diff --git a/sys/contrib/dev/acpica/evgpe.c b/sys/contrib/dev/acpica/evgpe.c index 6f6402d..925d032 100644 --- a/sys/contrib/dev/acpica/evgpe.c +++ b/sys/contrib/dev/acpica/evgpe.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: evgpe - General Purpose Event handling and dispatch - * $Revision: 27 $ + * $Revision: 31 $ * *****************************************************************************/ @@ -218,12 +218,10 @@ AcpiEvGpeDetect ( { UINT32 IntStatus = ACPI_INTERRUPT_NOT_HANDLED; UINT8 EnabledStatusByte; - UINT8 BitMask; ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; UINT32 InValue; ACPI_STATUS Status; ACPI_GPE_BLOCK_INFO *GpeBlock; - UINT32 GpeNumber; UINT32 i; UINT32 j; @@ -270,11 +268,9 @@ AcpiEvGpeDetect ( ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS, "GPE pair: Status %8.8X%8.8X = %02X, Enable %8.8X%8.8X = %02X\n", - ACPI_HIDWORD (ACPI_GET_ADDRESS (GpeRegisterInfo->StatusAddress.Address)), - ACPI_LODWORD (ACPI_GET_ADDRESS (GpeRegisterInfo->StatusAddress.Address)), + ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (GpeRegisterInfo->StatusAddress.Address)), GpeRegisterInfo->Status, - ACPI_HIDWORD (ACPI_GET_ADDRESS (GpeRegisterInfo->EnableAddress.Address)), - ACPI_LODWORD (ACPI_GET_ADDRESS (GpeRegisterInfo->EnableAddress.Address)), + ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (GpeRegisterInfo->EnableAddress.Address)), GpeRegisterInfo->Enable)); /* First check if there is anything active at all in this register */ @@ -290,21 +286,19 @@ AcpiEvGpeDetect ( /* Now look at the individual GPEs in this byte register */ - for (j = 0, BitMask = 1; j < ACPI_GPE_REGISTER_WIDTH; j++, BitMask <<= 1) + for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { /* Examine one GPE bit */ - if (EnabledStatusByte & BitMask) + if (EnabledStatusByte & AcpiGbl_DecodeTo8bit[j]) { /* * Found an active GPE. Dispatch the event to a handler * or method. */ - GpeNumber = (i * ACPI_GPE_REGISTER_WIDTH) + j; - IntStatus |= AcpiEvGpeDispatch ( - &GpeBlock->EventInfo[GpeNumber], - GpeNumber + GpeBlock->RegisterInfo[GpeNumber].BaseGpeNumber); + &GpeBlock->EventInfo[(i * ACPI_GPE_REGISTER_WIDTH) + j], + j + GpeRegisterInfo->BaseGpeNumber); } } } @@ -385,7 +379,7 @@ AcpiEvAsynchExecuteGpeMethod ( { ACPI_REPORT_ERROR (("%s while evaluating method [%4.4s] for GPE[%2X]\n", AcpiFormatException (Status), - LocalGpeEventInfo.MethodNode->Name.Ascii, GpeNumber)); + AcpiUtGetNodeName (LocalGpeEventInfo.MethodNode), GpeNumber)); } } @@ -463,6 +457,20 @@ AcpiEvGpeDispatch ( /* Invoke the installed handler (at interrupt level) */ GpeEventInfo->Handler (GpeEventInfo->Context); + + /* It is now safe to clear level-triggered events. */ + + if (GpeEventInfo->Flags & ACPI_EVENT_LEVEL_TRIGGERED) + { + Status = AcpiHwClearGpe (GpeEventInfo); + if (ACPI_FAILURE (Status)) + { + ACPI_REPORT_ERROR (( + "AcpiEvGpeDispatch: Unable to clear GPE[%2X]\n", + GpeNumber)); + return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); + } + } } else if (GpeEventInfo->MethodNode) { @@ -473,13 +481,16 @@ AcpiEvGpeDispatch ( Status = AcpiHwDisableGpe (GpeEventInfo); if (ACPI_FAILURE (Status)) { - ACPI_REPORT_ERROR (("AcpiEvGpeDispatch: Unable to disable GPE[%2X]\n", + ACPI_REPORT_ERROR (( + "AcpiEvGpeDispatch: Unable to disable GPE[%2X]\n", GpeNumber)); return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); } - /* Execute the method associated with the GPE. */ - + /* + * Execute the method associated with the GPE + * NOTE: Level-triggered GPEs are cleared after the method completes. + */ if (ACPI_FAILURE (AcpiOsQueueForExecution (OSD_PRIORITY_GPE, AcpiEvAsynchExecuteGpeMethod, GpeEventInfo))) @@ -499,25 +510,13 @@ AcpiEvGpeDispatch ( /* * Disable the GPE. The GPE will remain disabled until the ACPI - * Core Subsystem is restarted, or the handler is reinstalled. + * Core Subsystem is restarted, or a handler is installed. */ Status = AcpiHwDisableGpe (GpeEventInfo); if (ACPI_FAILURE (Status)) { - ACPI_REPORT_ERROR (("AcpiEvGpeDispatch: Unable to disable GPE[%2X]\n", - GpeNumber)); - return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); - } - } - - /* It is now safe to clear level-triggered events. */ - - if (GpeEventInfo->Flags & ACPI_EVENT_LEVEL_TRIGGERED) - { - Status = AcpiHwClearGpe (GpeEventInfo); - if (ACPI_FAILURE (Status)) - { - ACPI_REPORT_ERROR (("AcpiEvGpeDispatch: Unable to clear GPE[%2X]\n", + ACPI_REPORT_ERROR (( + "AcpiEvGpeDispatch: Unable to disable GPE[%2X]\n", GpeNumber)); return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); } |