summaryrefslogtreecommitdiff
path: root/source/components/events/evrgnini.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/components/events/evrgnini.c')
-rw-r--r--source/components/events/evrgnini.c101
1 files changed, 29 insertions, 72 deletions
diff --git a/source/components/events/evrgnini.c b/source/components/events/evrgnini.c
index cc0240d9de17..6bb0e6e5bdff 100644
--- a/source/components/events/evrgnini.c
+++ b/source/components/events/evrgnini.c
@@ -567,9 +567,6 @@ AcpiEvInitializeRegion (
ACPI_ADR_SPACE_TYPE SpaceId;
ACPI_NAMESPACE_NODE *Node;
ACPI_STATUS Status;
- ACPI_NAMESPACE_NODE *MethodNode;
- ACPI_NAME *RegNamePtr = (ACPI_NAME *) METHOD_NAME__REG;
- ACPI_OPERAND_OBJECT *RegionObj2;
ACPI_FUNCTION_TRACE_U32 (EvInitializeRegion, AcpiNsLocked);
@@ -585,39 +582,15 @@ AcpiEvInitializeRegion (
return_ACPI_STATUS (AE_OK);
}
- RegionObj2 = AcpiNsGetSecondaryObject (RegionObj);
- if (!RegionObj2)
- {
- return_ACPI_STATUS (AE_NOT_EXIST);
- }
+ AcpiEvAssociateRegMethod (RegionObj);
+ RegionObj->Common.Flags |= AOPOBJ_OBJECT_INITIALIZED;
Node = RegionObj->Region.Node->Parent;
SpaceId = RegionObj->Region.SpaceId;
- /* Setup defaults */
-
- RegionObj->Region.Handler = NULL;
- RegionObj2->Extra.Method_REG = NULL;
- RegionObj->Common.Flags &= ~(AOPOBJ_SETUP_COMPLETE);
- RegionObj->Common.Flags |= AOPOBJ_OBJECT_INITIALIZED;
-
- /* Find any "_REG" method associated with this region definition */
-
- Status = AcpiNsSearchOneScope (
- *RegNamePtr, Node, ACPI_TYPE_METHOD, &MethodNode);
- if (ACPI_SUCCESS (Status))
- {
- /*
- * The _REG method is optional and there can be only one per region
- * definition. This will be executed when the handler is attached
- * or removed
- */
- RegionObj2->Extra.Method_REG = MethodNode;
- }
-
/*
* The following loop depends upon the root Node having no parent
- * ie: AcpiGbl_RootNode->ParentEntry being set to NULL
+ * ie: AcpiGbl_RootNode->Parent being set to NULL
*/
while (Node)
{
@@ -632,18 +605,10 @@ AcpiEvInitializeRegion (
switch (Node->Type)
{
case ACPI_TYPE_DEVICE:
-
- HandlerObj = ObjDesc->Device.Handler;
- break;
-
case ACPI_TYPE_PROCESSOR:
-
- HandlerObj = ObjDesc->Processor.Handler;
- break;
-
case ACPI_TYPE_THERMAL:
- HandlerObj = ObjDesc->ThermalZone.Handler;
+ HandlerObj = ObjDesc->CommonNotify.Handler;
break;
case ACPI_TYPE_METHOD:
@@ -667,51 +632,43 @@ AcpiEvInitializeRegion (
break;
}
- while (HandlerObj)
+ HandlerObj = AcpiEvFindRegionHandler (SpaceId, HandlerObj);
+ if (HandlerObj)
{
- /* Is this handler of the correct type? */
-
- if (HandlerObj->AddressSpace.SpaceId == SpaceId)
- {
- /* Found correct handler */
+ /* Found correct handler */
- ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
- "Found handler %p for region %p in obj %p\n",
- HandlerObj, RegionObj, ObjDesc));
+ ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
+ "Found handler %p for region %p in obj %p\n",
+ HandlerObj, RegionObj, ObjDesc));
- Status = AcpiEvAttachRegion (HandlerObj, RegionObj,
- AcpiNsLocked);
+ Status = AcpiEvAttachRegion (HandlerObj, RegionObj,
+ AcpiNsLocked);
- /*
- * Tell all users that this region is usable by
- * running the _REG method
- */
- if (AcpiNsLocked)
+ /*
+ * Tell all users that this region is usable by
+ * running the _REG method
+ */
+ if (AcpiNsLocked)
+ {
+ Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
{
- Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
+ return_ACPI_STATUS (Status);
}
+ }
- Status = AcpiEvExecuteRegMethod (RegionObj, ACPI_REG_CONNECT);
+ Status = AcpiEvExecuteRegMethod (RegionObj, ACPI_REG_CONNECT);
- if (AcpiNsLocked)
+ if (AcpiNsLocked)
+ {
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
{
- Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
+ return_ACPI_STATUS (Status);
}
-
- return_ACPI_STATUS (AE_OK);
}
- /* Try next handler in the list */
-
- HandlerObj = HandlerObj->AddressSpace.Next;
+ return_ACPI_STATUS (AE_OK);
}
}