Skip to contentSkip to conversation

Execute "orphan" _REG method for specified EC device

PATCH New Zhang Rui 1 participant 1 message Dec 13, 2012 ACPI component architecture (acpica)

lore
Share & tools
lore

Zhang Rui

author
#0 lore raw

PATCH 1/1 Execute "orphan" _REG method for specified EC device

From 7b7c81250eb6511d9f237bdd96f4f2f61231c1ec Mon Sep 17 00:00:00 2001
From: Zhang Rui <rui.zhang(a)intel.com>
Date: Thu, 13 Dec 2012 11:44:19 +0800
Subject: [PATCH] Execute "orphan" _REG method for specified EC device

As it is always the EC device driver that installs the EC address space handler, we can make the assumption that the ACPI_NAMESPACE_NODE parameter of AcpiEvInstallHandler always points to the EC device node.
Thus we do not need to look for EC device in ECDT.

https://bugzilla.kernel.org/show_bug.cgi?id=15707

Signed-off-by Zhang Rui <rui.zhang(a)intel.com>
---
 source/components/events/evregion.c |   39 +++++++----------------------------
 1 file changed, 8 insertions(+), 31 deletions(-)
source/components/events/evregion.c +8 -31
index 2ab7922..7a619be 100644
@@ -135,7 +135,7 @@ AcpiEvHasDefaultHandler (
 
 static void
 AcpiEvOrphanEcRegMethod (
-    void);
+    ACPI_NAMESPACE_NODE     *Node);
 
 static ACPI_STATUS
 AcpiEvRegRun (
@@ -1248,7 +1248,7 @@ AcpiEvExecuteRegMethods (
 
     if (SpaceId == ACPI_ADR_SPACE_EC)
     {
-        AcpiEvOrphanEcRegMethod ();
+        AcpiEvOrphanEcRegMethod (Node);
     }
 
     return_ACPI_STATUS (Status);
@@ -1326,7 +1326,7 @@ AcpiEvRegRun (
  *
  * FUNCTION:    AcpiEvOrphanEcRegMethod
  *
- * PARAMETERS:  None
+ * PARAMETERS:  Node:		- Namespace node for the EC device
  *
  * RETURN:      None
  *
@@ -1347,32 +1347,19 @@ AcpiEvRegRun (
 
 static void
 AcpiEvOrphanEcRegMethod (
-    void)
+    ACPI_NAMESPACE_NODE	    *Node)
 {
     ACPI_TABLE_ECDT         *Table;
     ACPI_STATUS             Status;
     ACPI_OBJECT_LIST        Args;
     ACPI_OBJECT             Objects[2];
-    ACPI_NAMESPACE_NODE     *EcDeviceNode;
     ACPI_NAMESPACE_NODE     *RegMethod;
     ACPI_NAMESPACE_NODE     *NextNode;
 
 
     ACPI_FUNCTION_TRACE (EvOrphanEcRegMethod);
 
-
-    /* Get the ECDT (if present in system) */
-
-    Status = AcpiGetTable (ACPI_SIG_ECDT, 0,
-        ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &Table));
-    if (ACPI_FAILURE (Status))
-    {
-        return_VOID;
-    }
-
-    /* We need a valid EC_ID string */
-
-    if (!(*Table->Id))
+    if (!Node)
     {
         return_VOID;
     }
@@ -1381,19 +1368,9 @@ AcpiEvOrphanEcRegMethod (
 
     (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
 
-    /* Get a handle to the EC device referenced in the ECDT */
-
-    Status = AcpiGetHandle (NULL,
-        ACPI_CAST_PTR (char, Table->Id),
-        ACPI_CAST_PTR (ACPI_HANDLE, &EcDeviceNode));
-    if (ACPI_FAILURE (Status))
-    {
-        goto Exit;
-    }
-
     /* Get a handle to a _REG method immediately under the EC device */
 
-    Status = AcpiGetHandle (EcDeviceNode,
+    Status = AcpiGetHandle (Node,
         METHOD_NAME__REG, ACPI_CAST_PTR (ACPI_HANDLE, &RegMethod));
     if (ACPI_FAILURE (Status))
     {
@@ -1407,7 +1384,7 @@ AcpiEvOrphanEcRegMethod (
      * with other space IDs to be present; but the code below will then
      * execute the _REG method with the EC space ID argument.
      */
-    NextNode = AcpiNsGetNextNode (EcDeviceNode, NULL);
+    NextNode = AcpiNsGetNextNode (Node, NULL);
     while (NextNode)
     {
         if ((NextNode->Type == ACPI_TYPE_REGION) &&
@@ -1416,7 +1393,7 @@ AcpiEvOrphanEcRegMethod (
         {
             goto Exit; /* Do not execute _REG */
         }
-        NextNode = AcpiNsGetNextNode (EcDeviceNode, NextNode);
+        NextNode = AcpiNsGetNextNode (Node, NextNode);
     }
 
     /* Evaluate the _REG(EC,Connect) method */
Signature · 1 line
1.7.9.5
Quoted 1 line

From 7b7c81250eb6511d9f237bdd96f4f2f61231c1ec Mon Sep 17 00:00:00 2001

From: Zhang Rui <[email protected]>
Date: Thu, 13 Dec 2012 11:44:19 +0800
Subject: [PATCH] Execute "orphan" _REG method for specified EC device

As it is always the EC device driver that installs the EC address space handler, we can make the assumption that the ACPI_NAMESPACE_NODE parameter of AcpiEvInstallHandler always points to the EC device node.
Thus we do not need to look for EC device in ECDT.

https://bugzilla.kernel.org/show_bug.cgi?id=15707

---
 source/components/events/evregion.c |   39 +++++++----------------------------
 1 file changed, 8 insertions(+), 31 deletions(-)
source/components/events/evregion.c +8 -31
index 2ab7922..7a619be 100644
@@ -135,7 +135,7 @@ AcpiEvHasDefaultHandler (
 
 static void
 AcpiEvOrphanEcRegMethod (
-    void);
+    ACPI_NAMESPACE_NODE     *Node);
 
 static ACPI_STATUS
 AcpiEvRegRun (
@@ -1248,7 +1248,7 @@ AcpiEvExecuteRegMethods (
 
     if (SpaceId == ACPI_ADR_SPACE_EC)
     {
-        AcpiEvOrphanEcRegMethod ();
+        AcpiEvOrphanEcRegMethod (Node);
     }
 
     return_ACPI_STATUS (Status);
@@ -1326,7 +1326,7 @@ AcpiEvRegRun (
  *
  * FUNCTION:    AcpiEvOrphanEcRegMethod
  *
- * PARAMETERS:  None
+ * PARAMETERS:  Node:		- Namespace node for the EC device
  *
  * RETURN:      None
  *
@@ -1347,32 +1347,19 @@ AcpiEvRegRun (
 
 static void
 AcpiEvOrphanEcRegMethod (
-    void)
+    ACPI_NAMESPACE_NODE	    *Node)
 {
     ACPI_TABLE_ECDT         *Table;
     ACPI_STATUS             Status;
     ACPI_OBJECT_LIST        Args;
     ACPI_OBJECT             Objects[2];
-    ACPI_NAMESPACE_NODE     *EcDeviceNode;
     ACPI_NAMESPACE_NODE     *RegMethod;
     ACPI_NAMESPACE_NODE     *NextNode;
 
 
     ACPI_FUNCTION_TRACE (EvOrphanEcRegMethod);
 
-
-    /* Get the ECDT (if present in system) */
-
-    Status = AcpiGetTable (ACPI_SIG_ECDT, 0,
-        ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &Table));
-    if (ACPI_FAILURE (Status))
-    {
-        return_VOID;
-    }
-
-    /* We need a valid EC_ID string */
-
-    if (!(*Table->Id))
+    if (!Node)
     {
         return_VOID;
     }
@@ -1381,19 +1368,9 @@ AcpiEvOrphanEcRegMethod (
 
     (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
 
-    /* Get a handle to the EC device referenced in the ECDT */
-
-    Status = AcpiGetHandle (NULL,
-        ACPI_CAST_PTR (char, Table->Id),
-        ACPI_CAST_PTR (ACPI_HANDLE, &EcDeviceNode));
-    if (ACPI_FAILURE (Status))
-    {
-        goto Exit;
-    }
-
     /* Get a handle to a _REG method immediately under the EC device */
 
-    Status = AcpiGetHandle (EcDeviceNode,
+    Status = AcpiGetHandle (Node,
         METHOD_NAME__REG, ACPI_CAST_PTR (ACPI_HANDLE, &RegMethod));
     if (ACPI_FAILURE (Status))
     {
@@ -1407,7 +1384,7 @@ AcpiEvOrphanEcRegMethod (
      * with other space IDs to be present; but the code below will then
      * execute the _REG method with the EC space ID argument.
      */
-    NextNode = AcpiNsGetNextNode (EcDeviceNode, NULL);
+    NextNode = AcpiNsGetNextNode (Node, NULL);
     while (NextNode)
     {
         if ((NextNode->Type == ACPI_TYPE_REGION) &&
@@ -1416,7 +1393,7 @@ AcpiEvOrphanEcRegMethod (
         {
             goto Exit; /* Do not execute _REG */
         }
-        NextNode = AcpiNsGetNextNode (EcDeviceNode, NextNode);
+        NextNode = AcpiNsGetNextNode (Node, NextNode);
     }
 
     /* Evaluate the _REG(EC,Connect) method */
Signature · 1 line
1.7.9.5