summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/evxface.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/dev/acpica/evxface.c')
-rw-r--r--sys/contrib/dev/acpica/evxface.c127
1 files changed, 70 insertions, 57 deletions
diff --git a/sys/contrib/dev/acpica/evxface.c b/sys/contrib/dev/acpica/evxface.c
index d566c95..3c3db78 100644
--- a/sys/contrib/dev/acpica/evxface.c
+++ b/sys/contrib/dev/acpica/evxface.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evxface - External interfaces for ACPI events
- * $Revision: 135 $
+ * $Revision: 141 $
*
*****************************************************************************/
@@ -180,7 +180,7 @@ AcpiInstallFixedEventHandler (
AcpiGbl_FixedEventHandlers[Event].Handler = Handler;
AcpiGbl_FixedEventHandlers[Event].Context = Context;
- Status = AcpiEnableEvent (Event, ACPI_EVENT_FIXED, 0);
+ Status = AcpiEnableEvent (Event, 0);
if (ACPI_FAILURE (Status))
{
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Could not enable fixed event.\n"));
@@ -242,7 +242,7 @@ AcpiRemoveFixedEventHandler (
/* Disable the event before removing the handler */
- Status = AcpiDisableEvent(Event, ACPI_EVENT_FIXED, 0);
+ Status = AcpiDisableEvent (Event, 0);
/* Always Remove the handler */
@@ -332,9 +332,9 @@ AcpiInstallNotifyHandler (
/* Make sure the handler is not already installed */
if (((HandlerType == ACPI_SYSTEM_NOTIFY) &&
- AcpiGbl_SysNotify.Handler) ||
+ AcpiGbl_SystemNotify.Handler) ||
((HandlerType == ACPI_DEVICE_NOTIFY) &&
- AcpiGbl_DrvNotify.Handler))
+ AcpiGbl_DeviceNotify.Handler))
{
Status = AE_ALREADY_EXISTS;
goto UnlockAndExit;
@@ -342,15 +342,15 @@ AcpiInstallNotifyHandler (
if (HandlerType == ACPI_SYSTEM_NOTIFY)
{
- AcpiGbl_SysNotify.Node = Node;
- AcpiGbl_SysNotify.Handler = Handler;
- AcpiGbl_SysNotify.Context = Context;
+ AcpiGbl_SystemNotify.Node = Node;
+ AcpiGbl_SystemNotify.Handler = Handler;
+ AcpiGbl_SystemNotify.Context = Context;
}
else /* ACPI_DEVICE_NOTIFY */
{
- AcpiGbl_DrvNotify.Node = Node;
- AcpiGbl_DrvNotify.Handler = Handler;
- AcpiGbl_DrvNotify.Context = Context;
+ AcpiGbl_DeviceNotify.Node = Node;
+ AcpiGbl_DeviceNotify.Handler = Handler;
+ AcpiGbl_DeviceNotify.Context = Context;
}
/* Global notify handler installed */
@@ -376,13 +376,12 @@ AcpiInstallNotifyHandler (
ObjDesc = AcpiNsGetAttachedObject (Node);
if (ObjDesc)
{
-
/* Object exists - make sure there's no handler */
if (((HandlerType == ACPI_SYSTEM_NOTIFY) &&
- ObjDesc->CommonNotify.SysHandler) ||
+ ObjDesc->CommonNotify.SystemNotify) ||
((HandlerType == ACPI_DEVICE_NOTIFY) &&
- ObjDesc->CommonNotify.DrvHandler))
+ ObjDesc->CommonNotify.DeviceNotify))
{
Status = AE_ALREADY_EXISTS;
goto UnlockAndExit;
@@ -402,6 +401,11 @@ AcpiInstallNotifyHandler (
/* Attach new object to the Node */
Status = AcpiNsAttachObject (Device, ObjDesc, Node->Type);
+
+ /* Remove local reference to the object */
+
+ AcpiUtRemoveReference (ObjDesc);
+
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
@@ -417,17 +421,17 @@ AcpiInstallNotifyHandler (
goto UnlockAndExit;
}
- NotifyObj->NotifyHandler.Node = Node;
- NotifyObj->NotifyHandler.Handler = Handler;
- NotifyObj->NotifyHandler.Context = Context;
+ NotifyObj->Notify.Node = Node;
+ NotifyObj->Notify.Handler = Handler;
+ NotifyObj->Notify.Context = Context;
if (HandlerType == ACPI_SYSTEM_NOTIFY)
{
- ObjDesc->CommonNotify.SysHandler = NotifyObj;
+ ObjDesc->CommonNotify.SystemNotify = NotifyObj;
}
else /* ACPI_DEVICE_NOTIFY */
{
- ObjDesc->CommonNotify.DrvHandler = NotifyObj;
+ ObjDesc->CommonNotify.DeviceNotify = NotifyObj;
}
}
@@ -500,9 +504,9 @@ AcpiRemoveNotifyHandler (
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Removing notify handler for ROOT object.\n"));
if (((HandlerType == ACPI_SYSTEM_NOTIFY) &&
- !AcpiGbl_SysNotify.Handler) ||
+ !AcpiGbl_SystemNotify.Handler) ||
((HandlerType == ACPI_DEVICE_NOTIFY) &&
- !AcpiGbl_DrvNotify.Handler))
+ !AcpiGbl_DeviceNotify.Handler))
{
Status = AE_NOT_EXIST;
goto UnlockAndExit;
@@ -510,15 +514,15 @@ AcpiRemoveNotifyHandler (
if (HandlerType == ACPI_SYSTEM_NOTIFY)
{
- AcpiGbl_SysNotify.Node = NULL;
- AcpiGbl_SysNotify.Handler = NULL;
- AcpiGbl_SysNotify.Context = NULL;
+ AcpiGbl_SystemNotify.Node = NULL;
+ AcpiGbl_SystemNotify.Handler = NULL;
+ AcpiGbl_SystemNotify.Context = NULL;
}
else
{
- AcpiGbl_DrvNotify.Node = NULL;
- AcpiGbl_DrvNotify.Handler = NULL;
- AcpiGbl_DrvNotify.Context = NULL;
+ AcpiGbl_DeviceNotify.Node = NULL;
+ AcpiGbl_DeviceNotify.Handler = NULL;
+ AcpiGbl_DeviceNotify.Context = NULL;
}
}
@@ -548,15 +552,15 @@ AcpiRemoveNotifyHandler (
if (HandlerType == ACPI_SYSTEM_NOTIFY)
{
- NotifyObj = ObjDesc->CommonNotify.SysHandler;
+ NotifyObj = ObjDesc->CommonNotify.SystemNotify;
}
else
{
- NotifyObj = ObjDesc->CommonNotify.DrvHandler;
+ NotifyObj = ObjDesc->CommonNotify.DeviceNotify;
}
if ((!NotifyObj) ||
- (NotifyObj->NotifyHandler.Handler != Handler))
+ (NotifyObj->Notify.Handler != Handler))
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
@@ -566,11 +570,11 @@ AcpiRemoveNotifyHandler (
if (HandlerType == ACPI_SYSTEM_NOTIFY)
{
- ObjDesc->CommonNotify.SysHandler = NULL;
+ ObjDesc->CommonNotify.SystemNotify = NULL;
}
else
{
- ObjDesc->CommonNotify.DrvHandler = NULL;
+ ObjDesc->CommonNotify.DeviceNotify = NULL;
}
AcpiUtRemoveReference (NotifyObj);
@@ -587,8 +591,8 @@ UnlockAndExit:
*
* FUNCTION: AcpiInstallGpeHandler
*
- * PARAMETERS: GpeNumber - The GPE number. The numbering scheme is
- * bank 0 first, then bank 1.
+ * PARAMETERS: GpeNumber - The GPE number within the GPE block
+ * GpeBlock - GPE block (NULL == FADT GPEs)
* Type - Whether this GPE should be treated as an
* edge- or level-triggered interrupt.
* Handler - Address of the handler
@@ -602,6 +606,7 @@ UnlockAndExit:
ACPI_STATUS
AcpiInstallGpeHandler (
+ ACPI_HANDLE GpeDevice,
UINT32 GpeNumber,
UINT32 Type,
ACPI_GPE_HANDLER Handler,
@@ -621,46 +626,49 @@ AcpiInstallGpeHandler (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- /* Ensure that we have a valid GPE number */
-
- GpeEventInfo = AcpiEvGetGpeEventInfo (GpeNumber);
- if (!GpeEventInfo)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
+ /* Ensure that we have a valid GPE number */
+
+ GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
+ if (!GpeEventInfo)
+ {
+ Status = AE_BAD_PARAMETER;
+ goto UnlockAndExit;
+ }
+
/* Make sure that there isn't a handler there already */
if (GpeEventInfo->Handler)
{
Status = AE_ALREADY_EXISTS;
- goto Cleanup;
+ goto UnlockAndExit;
}
/* Install the handler */
+ AcpiOsAcquireLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
GpeEventInfo->Handler = Handler;
GpeEventInfo->Context = Context;
- GpeEventInfo->Type = (UINT8) Type;
+ GpeEventInfo->Flags = (UINT8) Type;
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
/* Clear the GPE (of stale events), the enable it */
Status = AcpiHwClearGpe (GpeEventInfo);
if (ACPI_FAILURE (Status))
{
- goto Cleanup;
+ goto UnlockAndExit;
}
Status = AcpiHwEnableGpe (GpeEventInfo);
-Cleanup:
+UnlockAndExit:
(void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
return_ACPI_STATUS (Status);
}
@@ -671,6 +679,7 @@ Cleanup:
* FUNCTION: AcpiRemoveGpeHandler
*
* PARAMETERS: GpeNumber - The event to remove a handler
+ * GpeBlock - GPE block (NULL == FADT GPEs)
* Handler - Address of the handler
*
* RETURN: Status
@@ -681,6 +690,7 @@ Cleanup:
ACPI_STATUS
AcpiRemoveGpeHandler (
+ ACPI_HANDLE GpeDevice,
UINT32 GpeNumber,
ACPI_GPE_HANDLER Handler)
{
@@ -698,12 +708,19 @@ AcpiRemoveGpeHandler (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
+ Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
/* Ensure that we have a valid GPE number */
- GpeEventInfo = AcpiEvGetGpeEventInfo (GpeNumber);
+ GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
if (!GpeEventInfo)
{
- return_ACPI_STATUS (AE_BAD_PARAMETER);
+ Status = AE_BAD_PARAMETER;
+ goto UnlockAndExit;
}
/* Disable the GPE before removing the handler */
@@ -711,13 +728,7 @@ AcpiRemoveGpeHandler (
Status = AcpiHwDisableGpe (GpeEventInfo);
if (ACPI_FAILURE (Status))
{
- return_ACPI_STATUS (Status);
- }
-
- Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
+ goto UnlockAndExit;
}
/* Make sure that the installed handler is the same */
@@ -726,16 +737,18 @@ AcpiRemoveGpeHandler (
{
(void) AcpiHwEnableGpe (GpeEventInfo);
Status = AE_BAD_PARAMETER;
- goto Cleanup;
+ goto UnlockAndExit;
}
/* Remove the handler */
+ AcpiOsAcquireLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
GpeEventInfo->Handler = NULL;
GpeEventInfo->Context = NULL;
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
-Cleanup:
+UnlockAndExit:
(void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
return_ACPI_STATUS (Status);
}
OpenPOWER on IntegriCloud