Skip to content

Commit

Permalink
Add additional debug info/statements.
Browse files Browse the repository at this point in the history
For _REG methods and module-level code blocks.
For acpiexec, add deletion of module-level blocks in case
of an early abort.
  • Loading branch information
acpibob committed Aug 12, 2015
1 parent 5474f69 commit 74094ca
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 7 deletions.
21 changes: 16 additions & 5 deletions source/components/events/evregion.c
Expand Up @@ -732,10 +732,17 @@ AcpiEvExecuteRegMethods (
ACPI_ADR_SPACE_TYPE SpaceId)
{
ACPI_STATUS Status;
ACPI_REG_WALK_INFO Info;


ACPI_FUNCTION_TRACE (EvExecuteRegMethods);

Info.SpaceId = SpaceId;
Info.RegRunCount = 0;

ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
" Running _REG methods for SpaceId %s\n",
AcpiUtGetRegionName (Info.SpaceId)));

/*
* Run all _REG methods for all Operation Regions for this space ID. This
Expand All @@ -744,8 +751,7 @@ AcpiEvExecuteRegMethods (
* regions of this Space ID before we can run any _REG methods)
*/
Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, Node, ACPI_UINT32_MAX,
ACPI_NS_WALK_UNLOCK, AcpiEvRegRun, NULL,
&SpaceId, NULL);
ACPI_NS_WALK_UNLOCK, AcpiEvRegRun, NULL, &Info, NULL);

/* Special case for EC: handle "orphan" _REG methods with no region */

Expand All @@ -754,6 +760,10 @@ AcpiEvExecuteRegMethods (
AcpiEvOrphanEcRegMethod (Node);
}

ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
" Executed %u _REG methods for SpaceId %s\n",
Info.RegRunCount, AcpiUtGetRegionName (Info.SpaceId)));

return_ACPI_STATUS (Status);
}

Expand All @@ -777,11 +787,11 @@ AcpiEvRegRun (
{
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_NAMESPACE_NODE *Node;
ACPI_ADR_SPACE_TYPE SpaceId;
ACPI_STATUS Status;
ACPI_REG_WALK_INFO *Info;


SpaceId = *ACPI_CAST_PTR (ACPI_ADR_SPACE_TYPE, Context);
Info = ACPI_CAST_PTR (ACPI_REG_WALK_INFO, Context);

/* Convert and validate the device handle */

Expand Down Expand Up @@ -813,13 +823,14 @@ AcpiEvRegRun (

/* Object is a Region */

if (ObjDesc->Region.SpaceId != SpaceId)
if (ObjDesc->Region.SpaceId != Info->SpaceId)
{
/* This region is for a different address space, just ignore it */

return (AE_OK);
}

Info->RegRunCount++;
Status = AcpiEvExecuteRegMethod (ObjDesc, ACPI_REG_CONNECT);
return (Status);
}
Expand Down
3 changes: 2 additions & 1 deletion source/components/namespace/nseval.c
Expand Up @@ -563,7 +563,8 @@ AcpiNsExecModuleCode (

Status = AcpiNsEvaluate (Info);

ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "Executed module-level code at %p\n",
ACPI_DEBUG_PRINT ((ACPI_DB_INIT_NAMES,
"Executed module-level code at %p\n",
MethodObj->Method.AmlStart));

/* Delete a possible implicit return value (in slack mode) */
Expand Down
18 changes: 18 additions & 0 deletions source/components/namespace/nsutils.c
Expand Up @@ -769,6 +769,24 @@ AcpiNsTerminate (
ACPI_FUNCTION_TRACE (NsTerminate);


#ifdef ACPI_EXEC_APP
{
ACPI_OPERAND_OBJECT *Prev;
ACPI_OPERAND_OBJECT *Next;

/* Delete any module-level code blocks */

Next = AcpiGbl_ModuleCodeList;
while (Next)
{
Prev = Next;
Next = Next->Method.Mutex;
Prev->Method.Mutex = NULL; /* Clear the Mutex (cheated) field */
AcpiUtRemoveReference (Prev);
}
}
#endif

/*
* Free the entire namespace -- all nodes and all objects
* attached to the nodes
Expand Down
13 changes: 12 additions & 1 deletion source/components/parser/psloop.c
Expand Up @@ -390,6 +390,9 @@ AcpiPsLinkModuleCode (
ACPI_NAMESPACE_NODE *ParentNode;


ACPI_FUNCTION_TRACE (PsLinkModuleCode);


/* Get the tail of the list */

Prev = Next = AcpiGbl_ModuleCodeList;
Expand All @@ -411,9 +414,12 @@ AcpiPsLinkModuleCode (
MethodObj = AcpiUtCreateInternalObject (ACPI_TYPE_METHOD);
if (!MethodObj)
{
return;
return_VOID;
}

ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
"Create/Link new code block: %p\n", MethodObj));

if (ParentOp->Common.Node)
{
ParentNode = ParentOp->Common.Node;
Expand Down Expand Up @@ -446,8 +452,13 @@ AcpiPsLinkModuleCode (
}
else
{
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
"Appending to existing code block: %p\n", Prev));

Prev->Method.AmlLength += AmlLength;
}

return_VOID;
}

/*******************************************************************************
Expand Down
10 changes: 10 additions & 0 deletions source/include/aclocal.h
Expand Up @@ -535,6 +535,16 @@ typedef struct acpi_simple_repair_info
#define ACPI_NUM_RTYPES 5 /* Number of actual object types */


/* Info for running the _REG methods */

typedef struct acpi_reg_walk_info
{
ACPI_ADR_SPACE_TYPE SpaceId;
UINT32 RegRunCount;

} ACPI_REG_WALK_INFO;


/*****************************************************************************
*
* Event typedefs and structs
Expand Down

0 comments on commit 74094ca

Please sign in to comment.