summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/evevent.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/dev/acpica/evevent.c')
-rw-r--r--sys/contrib/dev/acpica/evevent.c85
1 files changed, 53 insertions, 32 deletions
diff --git a/sys/contrib/dev/acpica/evevent.c b/sys/contrib/dev/acpica/evevent.c
index 8b86893..0ff96e2 100644
--- a/sys/contrib/dev/acpica/evevent.c
+++ b/sys/contrib/dev/acpica/evevent.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evevent - Fixed and General Purpose Even handling and dispatch
- * $Revision: 71 $
+ * $Revision: 78 $
*
*****************************************************************************/
@@ -428,11 +428,14 @@ AcpiEvGpeInitialize (void)
* FADT table contain zeros. The GPE0_LEN and GPE1_LEN do not need
* to be the same size."
*/
- AcpiGbl_GpeBlockInfo[0].RegisterCount = (UINT16) ACPI_DIV_2 (AcpiGbl_FADT->Gpe0BlkLen);
- AcpiGbl_GpeBlockInfo[1].RegisterCount = (UINT16) ACPI_DIV_2 (AcpiGbl_FADT->Gpe1BlkLen);
+ AcpiGbl_GpeBlockInfo[0].AddressSpaceId = AcpiGbl_FADT->XGpe0Blk.AddressSpaceId;
+ AcpiGbl_GpeBlockInfo[1].AddressSpaceId = AcpiGbl_FADT->XGpe1Blk.AddressSpaceId;
- AcpiGbl_GpeBlockInfo[0].BlockAddress = (UINT16) ACPI_GET_ADDRESS (AcpiGbl_FADT->XGpe0Blk.Address);
- AcpiGbl_GpeBlockInfo[1].BlockAddress = (UINT16) ACPI_GET_ADDRESS (AcpiGbl_FADT->XGpe1Blk.Address);
+ AcpiGbl_GpeBlockInfo[0].RegisterCount = (UINT16) ACPI_DIV_16 (AcpiGbl_FADT->XGpe0Blk.RegisterBitWidth);
+ AcpiGbl_GpeBlockInfo[1].RegisterCount = (UINT16) ACPI_DIV_16 (AcpiGbl_FADT->XGpe1Blk.RegisterBitWidth);
+
+ AcpiGbl_GpeBlockInfo[0].BlockAddress = &AcpiGbl_FADT->XGpe0Blk;
+ AcpiGbl_GpeBlockInfo[1].BlockAddress = &AcpiGbl_FADT->XGpe1Blk;
AcpiGbl_GpeBlockInfo[0].BlockBaseNumber = 0;
AcpiGbl_GpeBlockInfo[1].BlockBaseNumber = AcpiGbl_FADT->Gpe1Base;
@@ -531,10 +534,21 @@ AcpiEvGpeInitialize (void)
/* Init the Register info for this entire GPE register (8 GPEs) */
- GpeRegisterInfo->BaseGpeNumber = (UINT8) (AcpiGbl_GpeBlockInfo[GpeBlock].BlockBaseNumber + (ACPI_MUL_8 (i)));
- GpeRegisterInfo->StatusAddr = (UINT16) (AcpiGbl_GpeBlockInfo[GpeBlock].BlockAddress + i);
- GpeRegisterInfo->EnableAddr = (UINT16) (AcpiGbl_GpeBlockInfo[GpeBlock].BlockAddress + i +
- AcpiGbl_GpeBlockInfo[GpeBlock].RegisterCount);
+ GpeRegisterInfo->BaseGpeNumber = (UINT8) (AcpiGbl_GpeBlockInfo[GpeBlock].BlockBaseNumber + (ACPI_MUL_8 (i)));
+
+ ACPI_STORE_ADDRESS (GpeRegisterInfo->StatusAddress.Address,
+ (ACPI_GET_ADDRESS (AcpiGbl_GpeBlockInfo[GpeBlock].BlockAddress->Address) + i));
+
+ ACPI_STORE_ADDRESS (GpeRegisterInfo->EnableAddress.Address,
+ (ACPI_GET_ADDRESS (AcpiGbl_GpeBlockInfo[GpeBlock].BlockAddress->Address) + i +
+ AcpiGbl_GpeBlockInfo[GpeBlock].RegisterCount));
+
+ GpeRegisterInfo->StatusAddress.AddressSpaceId = AcpiGbl_GpeBlockInfo[GpeBlock].AddressSpaceId;
+ GpeRegisterInfo->EnableAddress.AddressSpaceId = AcpiGbl_GpeBlockInfo[GpeBlock].AddressSpaceId;
+ GpeRegisterInfo->StatusAddress.RegisterBitWidth = 8;
+ GpeRegisterInfo->EnableAddress.RegisterBitWidth = 8;
+ GpeRegisterInfo->StatusAddress.RegisterBitOffset = 8;
+ GpeRegisterInfo->EnableAddress.RegisterBitOffset = 8;
/* Init the Index mapping info for each GPE number within this register */
@@ -552,18 +566,24 @@ AcpiEvGpeInitialize (void)
* are cleared by writing a '1', while enable registers are cleared
* by writing a '0'.
*/
- AcpiOsWritePort (GpeRegisterInfo->EnableAddr, 0x00, 8);
- AcpiOsWritePort (GpeRegisterInfo->StatusAddr, 0xFF, 8);
+
+ AcpiHwLowLevelWrite (8, 0x00, &GpeRegisterInfo->EnableAddress, 0);
+ AcpiHwLowLevelWrite (8, 0xFF, &GpeRegisterInfo->StatusAddress, 0);
GpeRegister++;
}
- }
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "GPE registers: %X@%8.8X%8.8X (Blk0) %X@%8.8X%8.8X (Blk1)\n",
- AcpiGbl_GpeBlockInfo[0].RegisterCount,
- ACPI_HIDWORD (AcpiGbl_FADT->XGpe0Blk.Address), ACPI_LODWORD (AcpiGbl_FADT->XGpe0Blk.Address),
- AcpiGbl_GpeBlockInfo[1].RegisterCount,
- ACPI_HIDWORD (AcpiGbl_FADT->XGpe1Blk.Address), ACPI_LODWORD (AcpiGbl_FADT->XGpe1Blk.Address)));
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "GPE Block%d: %X registers at %8.8X%8.8X\n",
+ GpeBlock, AcpiGbl_GpeBlockInfo[0].RegisterCount,
+ ACPI_HIDWORD (AcpiGbl_GpeBlockInfo[GpeBlock].BlockAddress->Address),
+ ACPI_LODWORD (AcpiGbl_GpeBlockInfo[GpeBlock].BlockAddress->Address)));
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "GPE Block%d Range GPE #%2.2X to GPE #%2.2X\n",
+ GpeBlock,
+ AcpiGbl_GpeBlockInfo[GpeBlock].BlockBaseNumber,
+ AcpiGbl_GpeBlockInfo[GpeBlock].BlockBaseNumber +
+ ((AcpiGbl_GpeBlockInfo[GpeBlock].RegisterCount * 8) -1)));
+ }
return_ACPI_STATUS (AE_OK);
@@ -762,17 +782,18 @@ AcpiEvGpeDetect (void)
{
GpeRegisterInfo = &AcpiGbl_GpeRegisterInfo[i];
- AcpiOsReadPort (GpeRegisterInfo->StatusAddr,
- &GpeRegisterInfo->Status, 8);
+ GpeRegisterInfo->Status = (UINT8) AcpiHwLowLevelRead (8,
+ &GpeRegisterInfo->StatusAddress, 0);
- AcpiOsReadPort (GpeRegisterInfo->EnableAddr,
- &GpeRegisterInfo->Enable, 8);
+ GpeRegisterInfo->Enable = (UINT8) AcpiHwLowLevelRead (8,
+ &GpeRegisterInfo->EnableAddress, 0);
ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
- "GPE block at %X - Enable %08X Status %08X\n",
- GpeRegisterInfo->EnableAddr,
- GpeRegisterInfo->Status,
- GpeRegisterInfo->Enable));
+ "GPE block at %8.8X%8.8X - Enable %08X Status %08X\n",
+ ACPI_HIDWORD (GpeRegisterInfo->EnableAddress.Address),
+ ACPI_LODWORD (GpeRegisterInfo->EnableAddress.Address),
+ GpeRegisterInfo->Enable,
+ GpeRegisterInfo->Status));
/* First check if there is anything active at all in this register */
@@ -945,19 +966,19 @@ AcpiEvGpeDispatch (
else if (GpeInfo->MethodHandle)
{
/*
+ * Disable GPE, so it doesn't keep firing before the method has a
+ * chance to run.
+ */
+ AcpiHwDisableGpe (GpeNumber);
+
+ /*
* Execute the method associated with the GPE.
*/
if (ACPI_FAILURE (AcpiOsQueueForExecution (OSD_PRIORITY_GPE,
AcpiEvAsynchExecuteGpeMethod,
ACPI_TO_POINTER (GpeNumber))))
{
- ACPI_REPORT_ERROR (("AcpiEvGpeDispatch: Unable to queue handler for GPE[%X], disabling event\n", GpeNumber));
-
- /*
- * Disable the GPE on error. The GPE will remain disabled until the ACPI
- * Core Subsystem is restarted, or the handler is reinstalled.
- */
- AcpiHwDisableGpe (GpeNumber);
+ ACPI_REPORT_ERROR (("AcpiEvGpeDispatch: Unable to queue handler for GPE[%X], event is disabled\n", GpeNumber));
}
}
else
OpenPOWER on IntegriCloud