diff options
author | jkim <jkim@FreeBSD.org> | 2012-04-20 23:39:48 +0000 |
---|---|---|
committer | jkim <jkim@FreeBSD.org> | 2012-04-20 23:39:48 +0000 |
commit | eb364ef2c90291c41e896d265d93fe21e48d02a7 (patch) | |
tree | 79677aa8d9d6e5b97246264fe36dcad25ae471a1 /source/components | |
parent | 1c3442fdc2bf7441ce8d61d4ce8920ce2fdd9c3e (diff) | |
download | FreeBSD-src-eb364ef2c90291c41e896d265d93fe21e48d02a7.zip FreeBSD-src-eb364ef2c90291c41e896d265d93fe21e48d02a7.tar.gz |
Import ACPICA 20120420.
Diffstat (limited to 'source/components')
-rw-r--r-- | source/components/debugger/dbcmds.c | 19 | ||||
-rw-r--r-- | source/components/debugger/dbdisply.c | 4 | ||||
-rw-r--r-- | source/components/debugger/dbstats.c | 28 | ||||
-rw-r--r-- | source/components/debugger/dbutils.c | 5 | ||||
-rw-r--r-- | source/components/events/evmisc.c | 183 | ||||
-rw-r--r-- | source/components/events/evxface.c | 342 | ||||
-rw-r--r-- | source/components/executer/exdump.c | 29 | ||||
-rw-r--r-- | source/components/hardware/hwesleep.c | 8 | ||||
-rw-r--r-- | source/components/utilities/utdelete.c | 21 | ||||
-rw-r--r-- | source/components/utilities/utglobal.c | 4 | ||||
-rw-r--r-- | source/components/utilities/uttrack.c | 6 |
11 files changed, 298 insertions, 351 deletions
diff --git a/source/components/debugger/dbcmds.c b/source/components/debugger/dbcmds.c index ba6181b..459cd91 100644 --- a/source/components/debugger/dbcmds.c +++ b/source/components/debugger/dbcmds.c @@ -373,25 +373,20 @@ AcpiDbSendNotify ( return; } - /* Decode Named object type */ + /* Dispatch the notify if legal */ - switch (Node->Type) + if (AcpiEvIsNotifyObject (Node)) { - case ACPI_TYPE_DEVICE: - case ACPI_TYPE_THERMAL: - - /* Send the notify */ - Status = AcpiEvQueueNotifyRequest (Node, Value); if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("Could not queue notify\n"); } - break; - - default: - AcpiOsPrintf ("Named object is not a device or a thermal object\n"); - break; + } + else + { + AcpiOsPrintf ("Named object [%4.4s] Type %s, must be Device/Thermal/Processor type\n", + AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type)); } } diff --git a/source/components/debugger/dbdisply.c b/source/components/debugger/dbdisply.c index fa943e7..7facc8d 100644 --- a/source/components/debugger/dbdisply.c +++ b/source/components/debugger/dbdisply.c @@ -107,8 +107,8 @@ typedef struct acpi_handler_info static ACPI_HANDLER_INFO AcpiGbl_HandlerList[] = { - {&AcpiGbl_SystemNotify.Handler, "System Notifications"}, - {&AcpiGbl_DeviceNotify.Handler, "Device Notifications"}, + {&AcpiGbl_GlobalNotify[0].Handler, "System Notifications"}, + {&AcpiGbl_GlobalNotify[1].Handler, "Device Notifications"}, {&AcpiGbl_TableHandler, "ACPI Table Events"}, {&AcpiGbl_ExceptionHandler, "Control Method Exceptions"}, {&AcpiGbl_InterfaceHandler, "OSI Invocations"} diff --git a/source/components/debugger/dbstats.c b/source/components/debugger/dbstats.c index 3794935..fcc4998 100644 --- a/source/components/debugger/dbstats.c +++ b/source/components/debugger/dbstats.c @@ -227,8 +227,8 @@ AcpiDbEnumerateObject ( case ACPI_TYPE_DEVICE: - AcpiDbEnumerateObject (ObjDesc->Device.SystemNotify); - AcpiDbEnumerateObject (ObjDesc->Device.DeviceNotify); + AcpiDbEnumerateObject (ObjDesc->Device.NotifyList[0]); + AcpiDbEnumerateObject (ObjDesc->Device.NotifyList[1]); AcpiDbEnumerateObject (ObjDesc->Device.Handler); break; @@ -248,21 +248,21 @@ AcpiDbEnumerateObject ( case ACPI_TYPE_POWER: - AcpiDbEnumerateObject (ObjDesc->PowerResource.SystemNotify); - AcpiDbEnumerateObject (ObjDesc->PowerResource.DeviceNotify); + AcpiDbEnumerateObject (ObjDesc->PowerResource.NotifyList[0]); + AcpiDbEnumerateObject (ObjDesc->PowerResource.NotifyList[1]); break; case ACPI_TYPE_PROCESSOR: - AcpiDbEnumerateObject (ObjDesc->Processor.SystemNotify); - AcpiDbEnumerateObject (ObjDesc->Processor.DeviceNotify); + AcpiDbEnumerateObject (ObjDesc->Processor.NotifyList[0]); + AcpiDbEnumerateObject (ObjDesc->Processor.NotifyList[1]); AcpiDbEnumerateObject (ObjDesc->Processor.Handler); break; case ACPI_TYPE_THERMAL: - AcpiDbEnumerateObject (ObjDesc->ThermalZone.SystemNotify); - AcpiDbEnumerateObject (ObjDesc->ThermalZone.DeviceNotify); + AcpiDbEnumerateObject (ObjDesc->ThermalZone.NotifyList[0]); + AcpiDbEnumerateObject (ObjDesc->ThermalZone.NotifyList[1]); AcpiDbEnumerateObject (ObjDesc->ThermalZone.Handler); break; @@ -522,6 +522,18 @@ AcpiDbDisplayStatistics ( AcpiOsPrintf ("NamespaceNode %3d\n", sizeof (ACPI_NAMESPACE_NODE)); AcpiOsPrintf ("AcpiObject %3d\n", sizeof (ACPI_OBJECT)); + AcpiOsPrintf ("\n"); + + AcpiOsPrintf ("Generic State %3d\n", sizeof (ACPI_GENERIC_STATE)); + AcpiOsPrintf ("Common State %3d\n", sizeof (ACPI_COMMON_STATE)); + AcpiOsPrintf ("Control State %3d\n", sizeof (ACPI_CONTROL_STATE)); + AcpiOsPrintf ("Update State %3d\n", sizeof (ACPI_UPDATE_STATE)); + AcpiOsPrintf ("Scope State %3d\n", sizeof (ACPI_SCOPE_STATE)); + AcpiOsPrintf ("Parse Scope %3d\n", sizeof (ACPI_PSCOPE_STATE)); + AcpiOsPrintf ("Package State %3d\n", sizeof (ACPI_PKG_STATE)); + AcpiOsPrintf ("Thread State %3d\n", sizeof (ACPI_THREAD_STATE)); + AcpiOsPrintf ("Result Values %3d\n", sizeof (ACPI_RESULT_VALUES)); + AcpiOsPrintf ("Notify Info %3d\n", sizeof (ACPI_NOTIFY_INFO)); break; diff --git a/source/components/debugger/dbutils.c b/source/components/debugger/dbutils.c index c44ff2e..cf29b22 100644 --- a/source/components/debugger/dbutils.c +++ b/source/components/debugger/dbutils.c @@ -190,10 +190,7 @@ AcpiDbDumpExternalObject ( case ACPI_TYPE_STRING: AcpiOsPrintf ("[String] Length %.2X = ", ObjDesc->String.Length); - for (i = 0; i < ObjDesc->String.Length; i++) - { - AcpiOsPrintf ("%c", ObjDesc->String.Pointer[i]); - } + AcpiUtPrintString (ObjDesc->String.Pointer, ACPI_UINT8_MAX); AcpiOsPrintf ("\n"); break; diff --git a/source/components/events/evmisc.c b/source/components/events/evmisc.c index 69a9087..68f751a 100644 --- a/source/components/events/evmisc.c +++ b/source/components/events/evmisc.c @@ -111,107 +111,82 @@ AcpiEvQueueNotifyRequest ( UINT32 NotifyValue) { ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_OPERAND_OBJECT *HandlerObj = NULL; - ACPI_GENERIC_STATE *NotifyInfo; + ACPI_OPERAND_OBJECT *HandlerListHead = NULL; + ACPI_GENERIC_STATE *Info; + UINT8 HandlerListId = 0; ACPI_STATUS Status = AE_OK; ACPI_FUNCTION_NAME (EvQueueNotifyRequest); - /* - * For value 0x03 (Ejection Request), may need to run a device method. - * For value 0x02 (Device Wake), if _PRW exists, may need to run - * the _PS0 method. - * For value 0x80 (Status Change) on the power button or sleep button, - * initiate soft-off or sleep operation. - * - * For all cases, simply dispatch the notify to the handler. - */ - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Dispatching Notify on [%4.4s] (%s) Value 0x%2.2X (%s) Node %p\n", - AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type), - NotifyValue, AcpiUtGetNotifyName (NotifyValue), Node)); + /* Are Notifies allowed on this object? */ - /* Get the notify object attached to the NS Node */ - - ObjDesc = AcpiNsGetAttachedObject (Node); - if (ObjDesc) + if (!AcpiEvIsNotifyObject (Node)) { - /* We have the notify object, Get the correct handler */ - - switch (Node->Type) - { - /* Notify is allowed only on these types */ + return (AE_TYPE); + } - case ACPI_TYPE_DEVICE: - case ACPI_TYPE_THERMAL: - case ACPI_TYPE_PROCESSOR: + /* Get the correct notify list type (System or Device) */ - if (NotifyValue <= ACPI_MAX_SYS_NOTIFY) - { - HandlerObj = ObjDesc->CommonNotify.SystemNotify; - } - else - { - HandlerObj = ObjDesc->CommonNotify.DeviceNotify; - } - break; + if (NotifyValue <= ACPI_MAX_SYS_NOTIFY) + { + HandlerListId = ACPI_SYSTEM_HANDLER_LIST; + } + else + { + HandlerListId = ACPI_DEVICE_HANDLER_LIST; + } - default: + /* Get the notify object attached to the namespace Node */ - /* All other types are not supported */ + ObjDesc = AcpiNsGetAttachedObject (Node); + if (ObjDesc) + { + /* We have an attached object, Get the correct handler list */ - return (AE_TYPE); - } + HandlerListHead = ObjDesc->CommonNotify.NotifyList[HandlerListId]; } /* - * If there is a handler to run, schedule the dispatcher. - * Check for: - * 1) Global system notify handler - * 2) Global device notify handler - * 3) Per-device notify handler + * If there is no notify handler (Global or Local) + * for this object, just ignore the notify */ - if ((AcpiGbl_SystemNotify.Handler && - (NotifyValue <= ACPI_MAX_SYS_NOTIFY)) || - (AcpiGbl_DeviceNotify.Handler && - (NotifyValue > ACPI_MAX_SYS_NOTIFY)) || - HandlerObj) + if (!AcpiGbl_GlobalNotify[HandlerListId].Handler && !HandlerListHead) { - NotifyInfo = AcpiUtCreateGenericState (); - if (!NotifyInfo) - { - return (AE_NO_MEMORY); - } + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, + "No notify handler for Notify, ignoring (%4.4s, %X) node %p\n", + AcpiUtGetNodeName (Node), NotifyValue, Node)); - if (!HandlerObj) - { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Executing system notify handler for Notify (%4.4s, %X) " - "node %p\n", - AcpiUtGetNodeName (Node), NotifyValue, Node)); - } + return (AE_OK); + } - NotifyInfo->Common.DescriptorType = ACPI_DESC_TYPE_STATE_NOTIFY; - NotifyInfo->Notify.Node = Node; - NotifyInfo->Notify.Value = (UINT16) NotifyValue; - NotifyInfo->Notify.HandlerObj = HandlerObj; + /* Setup notify info and schedule the notify dispatcher */ - Status = AcpiOsExecute ( - OSL_NOTIFY_HANDLER, AcpiEvNotifyDispatch, NotifyInfo); - if (ACPI_FAILURE (Status)) - { - AcpiUtDeleteGenericState (NotifyInfo); - } - } - else + Info = AcpiUtCreateGenericState (); + if (!Info) { - /* There is no notify handler (per-device or system) for this device */ + return (AE_NO_MEMORY); + } - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "No notify handler for Notify (%4.4s, %X) node %p\n", - AcpiUtGetNodeName (Node), NotifyValue, Node)); + Info->Common.DescriptorType = ACPI_DESC_TYPE_STATE_NOTIFY; + + Info->Notify.Node = Node; + Info->Notify.Value = (UINT16) NotifyValue; + Info->Notify.HandlerListId = HandlerListId; + Info->Notify.HandlerListHead = HandlerListHead; + Info->Notify.Global = &AcpiGbl_GlobalNotify[HandlerListId]; + + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, + "Dispatching Notify on [%4.4s] (%s) Value 0x%2.2X (%s) Node %p\n", + AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type), + NotifyValue, AcpiUtGetNotifyName (NotifyValue), Node)); + + Status = AcpiOsExecute (OSL_NOTIFY_HANDLER, AcpiEvNotifyDispatch, + Info); + if (ACPI_FAILURE (Status)) + { + AcpiUtDeleteGenericState (Info); } return (Status); @@ -235,61 +210,37 @@ static void ACPI_SYSTEM_XFACE AcpiEvNotifyDispatch ( void *Context) { - ACPI_GENERIC_STATE *NotifyInfo = (ACPI_GENERIC_STATE *) Context; - ACPI_NOTIFY_HANDLER GlobalHandler = NULL; - void *GlobalContext = NULL; + ACPI_GENERIC_STATE *Info = (ACPI_GENERIC_STATE *) Context; ACPI_OPERAND_OBJECT *HandlerObj; ACPI_FUNCTION_ENTRY (); - /* - * We will invoke a global notify handler if installed. This is done - * _before_ we invoke the per-device handler attached to the device. - */ - if (NotifyInfo->Notify.Value <= ACPI_MAX_SYS_NOTIFY) - { - /* Global system notification handler */ + /* Invoke a global notify handler if installed */ - if (AcpiGbl_SystemNotify.Handler) - { - GlobalHandler = AcpiGbl_SystemNotify.Handler; - GlobalContext = AcpiGbl_SystemNotify.Context; - } - } - else + if (Info->Notify.Global->Handler) { - /* Global driver notification handler */ - - if (AcpiGbl_DeviceNotify.Handler) - { - GlobalHandler = AcpiGbl_DeviceNotify.Handler; - GlobalContext = AcpiGbl_DeviceNotify.Context; - } + Info->Notify.Global->Handler (Info->Notify.Node, + Info->Notify.Value, + Info->Notify.Global->Context); } - /* Invoke the system handler first, if present */ + /* Now invoke the local notify handler(s) if any are installed */ - if (GlobalHandler) + HandlerObj = Info->Notify.HandlerListHead; + while (HandlerObj) { - GlobalHandler (NotifyInfo->Notify.Node, NotifyInfo->Notify.Value, - GlobalContext); - } - - /* Now invoke the per-device handler, if present */ - - HandlerObj = NotifyInfo->Notify.HandlerObj; - if (HandlerObj) - { - HandlerObj->Notify.Handler (NotifyInfo->Notify.Node, - NotifyInfo->Notify.Value, + HandlerObj->Notify.Handler (Info->Notify.Node, + Info->Notify.Value, HandlerObj->Notify.Context); + + HandlerObj = HandlerObj->Notify.Next[Info->Notify.HandlerListId]; } /* All done with the info object */ - AcpiUtDeleteGenericState (NotifyInfo); + AcpiUtDeleteGenericState (Info); } diff --git a/source/components/events/evxface.c b/source/components/events/evxface.c index cc558f7..1b709a5 100644 --- a/source/components/events/evxface.c +++ b/source/components/events/evxface.c @@ -60,15 +60,21 @@ * * PARAMETERS: Device - The device for which notifies will be handled * HandlerType - The type of handler: - * ACPI_SYSTEM_NOTIFY: SystemHandler (00-7f) - * ACPI_DEVICE_NOTIFY: DriverHandler (80-ff) - * ACPI_ALL_NOTIFY: both system and device + * ACPI_SYSTEM_NOTIFY: System Handler (00-7F) + * ACPI_DEVICE_NOTIFY: Device Handler (80-FF) + * ACPI_ALL_NOTIFY: Both System and Device * Handler - Address of the handler * Context - Value passed to the handler on each GPE * * RETURN: Status * - * DESCRIPTION: Install a handler for notifies on an ACPI device + * DESCRIPTION: Install a handler for notifications on an ACPI Device, + * ThermalZone, or Processor object. + * + * NOTES: The Root namespace object may have only one handler for each + * type of notify (System/Device). Device/Thermal/Processor objects + * may have one device notify handler, and multiple system notify + * handlers. * ******************************************************************************/ @@ -79,10 +85,11 @@ AcpiInstallNotifyHandler ( ACPI_NOTIFY_HANDLER Handler, void *Context) { + ACPI_NAMESPACE_NODE *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Device); ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_OPERAND_OBJECT *NotifyObj; - ACPI_NAMESPACE_NODE *Node; + ACPI_OPERAND_OBJECT *HandlerObj; ACPI_STATUS Status; + UINT32 i; ACPI_FUNCTION_TRACE (AcpiInstallNotifyHandler); @@ -90,8 +97,7 @@ AcpiInstallNotifyHandler ( /* Parameter validation */ - if ((!Device) || - (!Handler) || + if ((!Device) || (!Handler) || (!HandlerType) || (HandlerType > ACPI_MAX_NOTIFY_HANDLER_TYPE)) { return_ACPI_STATUS (AE_BAD_PARAMETER); @@ -103,135 +109,124 @@ AcpiInstallNotifyHandler ( return_ACPI_STATUS (Status); } - /* Convert and validate the device handle */ - - Node = AcpiNsValidateHandle (Device); - if (!Node) - { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; - } - /* * Root Object: * Registering a notify handler on the root object indicates that the * caller wishes to receive notifications for all objects. Note that - * only one <external> global handler can be regsitered (per notify type). + * only one global handler can be registered per notify type. + * Ensure that a handler is not already installed. */ if (Device == ACPI_ROOT_OBJECT) { - /* Make sure the handler is not already installed */ - - if (((HandlerType & ACPI_SYSTEM_NOTIFY) && - AcpiGbl_SystemNotify.Handler) || - ((HandlerType & ACPI_DEVICE_NOTIFY) && - AcpiGbl_DeviceNotify.Handler)) + for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++) { - Status = AE_ALREADY_EXISTS; - goto UnlockAndExit; - } - - if (HandlerType & ACPI_SYSTEM_NOTIFY) - { - AcpiGbl_SystemNotify.Node = Node; - AcpiGbl_SystemNotify.Handler = Handler; - AcpiGbl_SystemNotify.Context = Context; - } - - if (HandlerType & ACPI_DEVICE_NOTIFY) - { - AcpiGbl_DeviceNotify.Node = Node; - AcpiGbl_DeviceNotify.Handler = Handler; - AcpiGbl_DeviceNotify.Context = Context; + if (HandlerType & (i+1)) + { + if (AcpiGbl_GlobalNotify[i].Handler) + { + Status = AE_ALREADY_EXISTS; + goto UnlockAndExit; + } + + AcpiGbl_GlobalNotify[i].Handler = Handler; + AcpiGbl_GlobalNotify[i].Context = Context; + } } - /* Global notify handler installed */ + goto UnlockAndExit; /* Global notify handler installed, all done */ } /* * All Other Objects: - * Caller will only receive notifications specific to the target object. - * Note that only certain object types can receive notifications. + * Caller will only receive notifications specific to the target + * object. Note that only certain object types are allowed to + * receive notifications. */ - else + + /* Are Notifies allowed on this object? */ + + if (!AcpiEvIsNotifyObject (Node)) { - /* Notifies allowed on this object? */ + Status = AE_TYPE; + goto UnlockAndExit; + } + + /* Check for an existing internal object, might not exist */ + + ObjDesc = AcpiNsGetAttachedObject (Node); + if (!ObjDesc) + { + /* Create a new object */ - if (!AcpiEvIsNotifyObject (Node)) + ObjDesc = AcpiUtCreateInternalObject (Node->Type); + if (!ObjDesc) { - Status = AE_TYPE; + Status = AE_NO_MEMORY; goto UnlockAndExit; } - /* Check for an existing internal object */ + /* Attach new object to the Node, remove local reference */ - ObjDesc = AcpiNsGetAttachedObject (Node); - if (ObjDesc) + Status = AcpiNsAttachObject (Device, ObjDesc, Node->Type); + AcpiUtRemoveReference (ObjDesc); + if (ACPI_FAILURE (Status)) { - /* Object exists - make sure there's no handler */ - - if (((HandlerType & ACPI_SYSTEM_NOTIFY) && - ObjDesc->CommonNotify.SystemNotify) || - ((HandlerType & ACPI_DEVICE_NOTIFY) && - ObjDesc->CommonNotify.DeviceNotify)) - { - Status = AE_ALREADY_EXISTS; - goto UnlockAndExit; - } + goto UnlockAndExit; } - else - { - /* Create a new object */ - - ObjDesc = AcpiUtCreateInternalObject (Node->Type); - if (!ObjDesc) - { - Status = AE_NO_MEMORY; - goto UnlockAndExit; - } - - /* Attach new object to the Node */ - - Status = AcpiNsAttachObject (Device, ObjDesc, Node->Type); + } - /* Remove local reference to the object */ + /* Ensure that the handler is not already installed in the lists */ - AcpiUtRemoveReference (ObjDesc); - if (ACPI_FAILURE (Status)) + for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++) + { + if (HandlerType & (i+1)) + { + HandlerObj = ObjDesc->CommonNotify.NotifyList[i]; + while (HandlerObj) { - goto UnlockAndExit; + if (HandlerObj->Notify.Handler == Handler) + { + Status = AE_ALREADY_EXISTS; + goto UnlockAndExit; + } + + HandlerObj = HandlerObj->Notify.Next[i]; } } + } - /* Install the handler */ + /* Create and populate a new notify handler object */ - NotifyObj = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_NOTIFY); - if (!NotifyObj) - { - Status = AE_NO_MEMORY; - goto UnlockAndExit; - } + HandlerObj = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_NOTIFY); + if (!HandlerObj) + { + Status = AE_NO_MEMORY; + goto UnlockAndExit; + } - NotifyObj->Notify.Node = Node; - NotifyObj->Notify.Handler = Handler; - NotifyObj->Notify.Context = Context; + HandlerObj->Notify.Node = Node; + HandlerObj->Notify.HandlerType = HandlerType; + HandlerObj->Notify.Handler = Handler; + HandlerObj->Notify.Context = Context; - if (HandlerType & ACPI_SYSTEM_NOTIFY) - { - ObjDesc->CommonNotify.SystemNotify = NotifyObj; - } + /* Install the handler at the list head(s) */ - if (HandlerType & ACPI_DEVICE_NOTIFY) + for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++) + { + if (HandlerType & (i+1)) { - ObjDesc->CommonNotify.DeviceNotify = NotifyObj; + HandlerObj->Notify.Next[i] = + ObjDesc->CommonNotify.NotifyList[i]; + + ObjDesc->CommonNotify.NotifyList[i] = HandlerObj; } + } - if (HandlerType == ACPI_ALL_NOTIFY) - { - /* Extra ref if installed in both */ + /* Add an extra reference if handler was installed in both lists */ - AcpiUtAddReference (NotifyObj); - } + if (HandlerType == ACPI_ALL_NOTIFY) + { + AcpiUtAddReference (HandlerObj); } @@ -247,11 +242,11 @@ ACPI_EXPORT_SYMBOL (AcpiInstallNotifyHandler) * * FUNCTION: AcpiRemoveNotifyHandler * - * PARAMETERS: Device - The device for which notifies will be handled + * PARAMETERS: Device - The device for which the handler is installed * HandlerType - The type of handler: - * ACPI_SYSTEM_NOTIFY: SystemHandler (00-7f) - * ACPI_DEVICE_NOTIFY: DriverHandler (80-ff) - * ACPI_ALL_NOTIFY: both system and device + * ACPI_SYSTEM_NOTIFY: System Handler (00-7F) + * ACPI_DEVICE_NOTIFY: Device Handler (80-FF) + * ACPI_ALL_NOTIFY: Both System and Device * Handler - Address of the handler * * RETURN: Status @@ -266,10 +261,12 @@ AcpiRemoveNotifyHandler ( UINT32 HandlerType, ACPI_NOTIFY_HANDLER Handler) { - ACPI_OPERAND_OBJECT *NotifyObj; + ACPI_NAMESPACE_NODE *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Device); ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_NAMESPACE_NODE *Node; + ACPI_OPERAND_OBJECT *HandlerObj; + ACPI_OPERAND_OBJECT *PreviousHandlerObj; ACPI_STATUS Status; + UINT32 i; ACPI_FUNCTION_TRACE (AcpiRemoveNotifyHandler); @@ -277,122 +274,105 @@ AcpiRemoveNotifyHandler ( /* Parameter validation */ - if ((!Device) || - (!Handler) || + if ((!Device) || (!Handler) || (!HandlerType) || (HandlerType > ACPI_MAX_NOTIFY_HANDLER_TYPE)) { return_ACPI_STATUS (AE_BAD_PARAMETER); } +#ifdef _UNDER_DEVELOPMENT + /* Make sure all deferred tasks are completed */ + + AcpiOsWaitEventsComplete (NULL); +#endif + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } - /* Convert and validate the device handle */ - - Node = AcpiNsValidateHandle (Device); - if (!Node) - { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; - } - - /* Root Object */ + /* Root Object. Global handlers are removed here */ if (Device == ACPI_ROOT_OBJECT) { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Removing notify handler for namespace root object\n")); - - if (((HandlerType & ACPI_SYSTEM_NOTIFY) && - !AcpiGbl_SystemNotify.Handler) || - ((HandlerType & ACPI_DEVICE_NOTIFY) && - !AcpiGbl_DeviceNotify.Handler)) + for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++) { - Status = AE_NOT_EXIST; - goto UnlockAndExit; - } - - if (HandlerType & ACPI_SYSTEM_NOTIFY) - { - AcpiGbl_SystemNotify.Node = NULL; - AcpiGbl_SystemNotify.Handler = NULL; - AcpiGbl_SystemNotify.Context = NULL; + if (HandlerType & (i+1)) + { + if (!AcpiGbl_GlobalNotify[i].Handler || + (AcpiGbl_GlobalNotify[i].Handler != Handler)) + { + Status = AE_NOT_EXIST; + goto UnlockAndExit; + } + + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, + "Removing global notify handler\n")); + + AcpiGbl_GlobalNotify[i].Handler = NULL; + AcpiGbl_GlobalNotify[i].Context = NULL; + } } - if (HandlerType & ACPI_DEVICE_NOTIFY) - { - AcpiGbl_DeviceNotify.Node = NULL; - AcpiGbl_DeviceNotify.Handler = NULL; - AcpiGbl_DeviceNotify.Context = NULL; - } + goto UnlockAndExit; } - /* All Other Objects */ + /* All other objects: Are Notifies allowed on this object? */ - else + if (!AcpiEvIsNotifyObject (Node)) { - /* Notifies allowed on this object? */ + Status = AE_TYPE; + goto UnlockAndExit; + } - if (!AcpiEvIsNotifyObject (Node)) - { - Status = AE_TYPE; - goto UnlockAndExit; - } + /* Must have an existing internal object */ + + ObjDesc = AcpiNsGetAttachedObject (Node); + if (!ObjDesc) + { + Status = AE_NOT_EXIST; + goto UnlockAndExit; + } - /* Check for an existing internal object */ + /* Internal object exists. Find the handler and remove it */ - ObjDesc = AcpiNsGetAttachedObject (Node); - if (!ObjDesc) + for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++) + { + if (HandlerType & (i+1)) { - Status = AE_NOT_EXIST; - goto UnlockAndExit; - } + HandlerObj = ObjDesc->CommonNotify.NotifyList[i]; + PreviousHandlerObj = NULL; - /* Object exists - make sure there's an existing handler */ + /* Attempt to find the handler in the handler list */ - if (HandlerType & ACPI_SYSTEM_NOTIFY) - { - NotifyObj = ObjDesc->CommonNotify.SystemNotify; - if (!NotifyObj) + while (HandlerObj && + (HandlerObj->Notify.Handler != Handler)) { - Status = AE_NOT_EXIST; - goto UnlockAndExit; + PreviousHandlerObj = HandlerObj; + HandlerObj = HandlerObj->Notify.Next[i]; } - if (NotifyObj->Notify.Handler != Handler) + if (!HandlerObj) { - Status = AE_BAD_PARAMETER; + Status = AE_NOT_EXIST; goto UnlockAndExit; } - /* Remove the handler */ - - ObjDesc->CommonNotify.SystemNotify = NULL; - AcpiUtRemoveReference (NotifyObj); - } + /* Remove the handler object from the list */ - if (HandlerType & ACPI_DEVICE_NOTIFY) - { - NotifyObj = ObjDesc->CommonNotify.DeviceNotify; - if (!NotifyObj) + if (PreviousHandlerObj) /* Handler is not at the list head */ { - Status = AE_NOT_EXIST; - goto UnlockAndExit; + PreviousHandlerObj->Notify.Next[i] = + HandlerObj->Notify.Next[i]; } - - if (NotifyObj->Notify.Handler != Handler) + else /* Handler is at the list head */ { - Status = AE_BAD_PARAMETER; - goto UnlockAndExit; + ObjDesc->CommonNotify.NotifyList[i] = + HandlerObj->Notify.Next[i]; } - /* Remove the handler */ - - ObjDesc->CommonNotify.DeviceNotify = NULL; - AcpiUtRemoveReference (NotifyObj); + AcpiUtRemoveReference (HandlerObj); } } diff --git a/source/components/executer/exdump.c b/source/components/executer/exdump.c index 4b49cec..0943e66 100644 --- a/source/components/executer/exdump.c +++ b/source/components/executer/exdump.c @@ -131,8 +131,8 @@ static ACPI_EXDUMP_INFO AcpiExDumpDevice[4] = { {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpDevice), NULL}, {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Device.Handler), "Handler"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Device.SystemNotify), "System Notify"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Device.DeviceNotify), "Device Notify"} + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Device.NotifyList[0]), "System Notify"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Device.NotifyList[1]), "Device Notify"} }; static ACPI_EXDUMP_INFO AcpiExDumpEvent[2] = @@ -179,8 +179,8 @@ static ACPI_EXDUMP_INFO AcpiExDumpPower[5] = {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpPower), NULL}, {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (PowerResource.SystemLevel), "System Level"}, {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (PowerResource.ResourceOrder), "Resource Order"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (PowerResource.SystemNotify), "System Notify"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (PowerResource.DeviceNotify), "Device Notify"} + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (PowerResource.NotifyList[0]), "System Notify"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (PowerResource.NotifyList[1]), "Device Notify"} }; static ACPI_EXDUMP_INFO AcpiExDumpProcessor[7] = @@ -189,16 +189,16 @@ static ACPI_EXDUMP_INFO AcpiExDumpProcessor[7] = {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Processor.ProcId), "Processor ID"}, {ACPI_EXD_UINT8 , ACPI_EXD_OFFSET (Processor.Length), "Length"}, {ACPI_EXD_ADDRESS, ACPI_EXD_OFFSET (Processor.Address), "Address"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Processor.SystemNotify), "System Notify"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Processor.DeviceNotify), "Device Notify"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Processor.NotifyList[0]), "System Notify"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Processor.NotifyList[1]), "Device Notify"}, {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Processor.Handler), "Handler"} }; static ACPI_EXDUMP_INFO AcpiExDumpThermal[4] = { {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpThermal), NULL}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (ThermalZone.SystemNotify), "System Notify"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (ThermalZone.DeviceNotify), "Device Notify"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (ThermalZone.NotifyList[0]), "System Notify"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (ThermalZone.NotifyList[1]), "Device Notify"}, {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (ThermalZone.Handler), "Handler"} }; @@ -258,11 +258,15 @@ static ACPI_EXDUMP_INFO AcpiExDumpAddressHandler[6] = {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (AddressSpace.Context), "Context"} }; -static ACPI_EXDUMP_INFO AcpiExDumpNotify[3] = +static ACPI_EXDUMP_INFO AcpiExDumpNotify[7] = { {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpNotify), NULL}, {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Notify.Node), "Node"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Notify.Context), "Context"} + {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Notify.HandlerType), "Handler Type"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Notify.Handler), "Handler"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Notify.Context), "Context"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Notify.Next[0]), "Next System Notify"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Notify.Next[1]), "Next Device Notify"} }; @@ -1001,10 +1005,7 @@ AcpiExDumpPackageObj ( case ACPI_TYPE_STRING: AcpiOsPrintf ("[String] Value: "); - for (i = 0; i < ObjDesc->String.Length; i++) - { - AcpiOsPrintf ("%c", ObjDesc->String.Pointer[i]); - } + AcpiUtPrintString (ObjDesc->String.Pointer, ACPI_UINT8_MAX); AcpiOsPrintf ("\n"); break; diff --git a/source/components/hardware/hwesleep.c b/source/components/hardware/hwesleep.c index ce7b792..1587af0 100644 --- a/source/components/hardware/hwesleep.c +++ b/source/components/hardware/hwesleep.c @@ -132,7 +132,7 @@ AcpiHwExtendedSleep ( /* Clear wake status (WAK_STS) */ - Status = AcpiWrite (ACPI_X_WAKE_STATUS, &AcpiGbl_FADT.SleepStatus); + Status = AcpiWrite ((UINT64) ACPI_X_WAKE_STATUS, &AcpiGbl_FADT.SleepStatus); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -163,7 +163,7 @@ AcpiHwExtendedSleep ( SleepTypeValue = ((AcpiGbl_SleepTypeA << ACPI_X_SLEEP_TYPE_POSITION) & ACPI_X_SLEEP_TYPE_MASK); - Status = AcpiWrite ((SleepTypeValue | ACPI_X_SLEEP_ENABLE), + Status = AcpiWrite ((UINT64) (SleepTypeValue | ACPI_X_SLEEP_ENABLE), &AcpiGbl_FADT.SleepControl); if (ACPI_FAILURE (Status)) { @@ -219,7 +219,7 @@ AcpiHwExtendedWakePrep ( SleepTypeValue = ((AcpiGbl_SleepTypeA << ACPI_X_SLEEP_TYPE_POSITION) & ACPI_X_SLEEP_TYPE_MASK); - (void) AcpiWrite ((SleepTypeValue | ACPI_X_SLEEP_ENABLE), + (void) AcpiWrite ((UINT64) (SleepTypeValue | ACPI_X_SLEEP_ENABLE), &AcpiGbl_FADT.SleepControl); } @@ -269,7 +269,7 @@ AcpiHwExtendedWake ( * and use it to determine whether the system is rebooting or * resuming. Clear WAK_STS for compatibility. */ - (void) AcpiWrite (ACPI_X_WAKE_STATUS, &AcpiGbl_FADT.SleepStatus); + (void) AcpiWrite ((UINT64) ACPI_X_WAKE_STATUS, &AcpiGbl_FADT.SleepStatus); AcpiGbl_SystemAwakeAndRunning = TRUE; AcpiHwExecuteSleepMethod (METHOD_PATHNAME__SST, ACPI_SST_WORKING); diff --git a/source/components/utilities/utdelete.c b/source/components/utilities/utdelete.c index 90baa15..fb32611 100644 --- a/source/components/utilities/utdelete.c +++ b/source/components/utilities/utdelete.c @@ -167,7 +167,7 @@ AcpiUtDeleteInternalObj ( case ACPI_TYPE_PROCESSOR: case ACPI_TYPE_THERMAL: - /* Walk the notify handler list for this object */ + /* Walk the address handler list for this object */ HandlerDesc = Object->CommonNotify.Handler; while (HandlerDesc) @@ -523,6 +523,7 @@ AcpiUtUpdateObjectReference ( ACPI_STATUS Status = AE_OK; ACPI_GENERIC_STATE *StateList = NULL; ACPI_OPERAND_OBJECT *NextObject = NULL; + ACPI_OPERAND_OBJECT *PrevObject; ACPI_GENERIC_STATE *State; UINT32 i; @@ -552,10 +553,20 @@ AcpiUtUpdateObjectReference ( case ACPI_TYPE_POWER: case ACPI_TYPE_THERMAL: - /* Update the notify objects for these types (if present) */ - - AcpiUtUpdateRefCount (Object->CommonNotify.SystemNotify, Action); - AcpiUtUpdateRefCount (Object->CommonNotify.DeviceNotify, Action); + /* + * Update the notify objects for these types (if present) + * Two lists, system and device notify handlers. + */ + for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++) + { + PrevObject = Object->CommonNotify.NotifyList[i]; + while (PrevObject) + { + NextObject = PrevObject->Notify.Next[i]; + AcpiUtUpdateRefCount (PrevObject, Action); + PrevObject = NextObject; + } + } break; case ACPI_TYPE_PACKAGE: diff --git a/source/components/utilities/utglobal.c b/source/components/utilities/utglobal.c index faccfb2..f913e32 100644 --- a/source/components/utilities/utglobal.c +++ b/source/components/utilities/utglobal.c @@ -287,8 +287,8 @@ AcpiUtInitGlobals ( /* Global handlers */ - AcpiGbl_SystemNotify.Handler = NULL; - AcpiGbl_DeviceNotify.Handler = NULL; + AcpiGbl_GlobalNotify[0].Handler = NULL; + AcpiGbl_GlobalNotify[1].Handler = NULL; AcpiGbl_ExceptionHandler = NULL; AcpiGbl_InitHandler = NULL; AcpiGbl_TableHandler = NULL; diff --git a/source/components/utilities/uttrack.c b/source/components/utilities/uttrack.c index 106cc24..7d58f5c 100644 --- a/source/components/utilities/uttrack.c +++ b/source/components/utilities/uttrack.c @@ -633,21 +633,21 @@ AcpiUtDumpAllocations ( switch (ACPI_GET_DESCRIPTOR_TYPE (Descriptor)) { case ACPI_DESC_TYPE_OPERAND: - if (Element->Size == sizeof (ACPI_DESC_TYPE_OPERAND)) + if (Element->Size == sizeof (ACPI_OPERAND_OBJECT)) { DescriptorType = ACPI_DESC_TYPE_OPERAND; } break; case ACPI_DESC_TYPE_PARSER: - if (Element->Size == sizeof (ACPI_DESC_TYPE_PARSER)) + if (Element->Size == sizeof (ACPI_PARSE_OBJECT)) { DescriptorType = ACPI_DESC_TYPE_PARSER; } break; case ACPI_DESC_TYPE_NAMED: - if (Element->Size == sizeof (ACPI_DESC_TYPE_NAMED)) + if (Element->Size == sizeof (ACPI_NAMESPACE_NODE)) { DescriptorType = ACPI_DESC_TYPE_NAMED; } |