summaryrefslogtreecommitdiff
path: root/sys/contrib/dev/acpica/nsinit.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/dev/acpica/nsinit.c')
-rw-r--r--sys/contrib/dev/acpica/nsinit.c127
1 files changed, 70 insertions, 57 deletions
diff --git a/sys/contrib/dev/acpica/nsinit.c b/sys/contrib/dev/acpica/nsinit.c
index eeedf6e7ab95..b9a8d33e186e 100644
--- a/sys/contrib/dev/acpica/nsinit.c
+++ b/sys/contrib/dev/acpica/nsinit.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: nsinit - namespace initialization
- * $Revision: 41 $
+ * $Revision: 43 $
*
*****************************************************************************/
@@ -152,15 +152,11 @@ AcpiNsInitializeObjects (
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"**** Starting initialization of namespace objects ****\n"));
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "Completing Region and Field initialization:"));
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "Completing Region/Field/Buffer/Package initialization:"));
+ /* Set all init info to zero */
- Info.FieldCount = 0;
- Info.FieldInit = 0;
- Info.OpRegionCount = 0;
- Info.OpRegionInit = 0;
- Info.ObjectCount = 0;
-
+ ACPI_MEMSET (&Info, 0, sizeof (ACPI_INIT_WALK_INFO));
/* Walk entire namespace from the supplied root */
@@ -173,9 +169,11 @@ AcpiNsInitializeObjects (
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
- "\n%d/%d Regions, %d/%d Fields initialized (%d nodes total)\n",
- Info.OpRegionInit, Info.OpRegionCount, Info.FieldInit,
- Info.FieldCount, Info.ObjectCount));
+ "\n Initialized %d/%d Regions %d/%d Fields %d/%d Buffers %d/%d Packages (%d nodes)\n",
+ Info.OpRegionInit, Info.OpRegionCount,
+ Info.FieldInit, Info.FieldCount,
+ Info.BufferInit, Info.BufferCount,
+ Info.PackageInit, Info.PackageCount, Info.ObjectCount));
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"%d Control Methods found\n", Info.MethodCount));
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
@@ -212,12 +210,15 @@ AcpiNsInitializeDevices (
ACPI_FUNCTION_TRACE ("NsInitializeDevices");
+ /* Init counters */
+
Info.DeviceCount = 0;
Info.Num_STA = 0;
Info.Num_INI = 0;
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "Executing all Device _STA and_INI methods:"));
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "Executing device _INI methods:"));
+ /* Walk namespace for all objects of type Device */
Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
ACPI_UINT32_MAX, FALSE, AcpiNsInitOneDevice, &Info, NULL);
@@ -227,9 +228,8 @@ AcpiNsInitializeDevices (
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "WalkNamespace failed! %x\n", Status));
}
-
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
- "\n%d Devices found: %d _STA, %d _INI\n",
+ "\n%d Devices found containing: %d _STA, %d _INI methods\n",
Info.DeviceCount, Info.Num_STA, Info.Num_INI));
return_ACPI_STATUS (Status);
@@ -275,7 +275,6 @@ AcpiNsInitOneObject (
Info->ObjectCount++;
-
/* And even then, we are only interested in a few object types */
Type = AcpiNsGetType (ObjHandle);
@@ -285,12 +284,39 @@ AcpiNsInitOneObject (
return (AE_OK);
}
- if ((Type != ACPI_TYPE_REGION) &&
- (Type != ACPI_TYPE_BUFFER_FIELD))
+ /* Increment counters for object types we are looking for */
+
+ switch (Type)
{
+ case ACPI_TYPE_REGION:
+ Info->OpRegionCount++;
+ break;
+
+ case ACPI_TYPE_BUFFER_FIELD:
+ Info->FieldCount++;
+ break;
+
+ case ACPI_TYPE_BUFFER:
+ Info->BufferCount++;
+ break;
+
+ case ACPI_TYPE_PACKAGE:
+ Info->PackageCount++;
+ break;
+
+ default:
+
+ /* No init required, just exit now */
return (AE_OK);
}
+ /*
+ * If the object is already initialized, nothing else to do
+ */
+ if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
+ {
+ return (AE_OK);
+ }
/*
* Must lock the interpreter before executing AML code
@@ -301,68 +327,56 @@ AcpiNsInitOneObject (
return (Status);
}
+ /*
+ * Each of these types can contain executable AML code within
+ * the declaration.
+ */
switch (Type)
{
-
case ACPI_TYPE_REGION:
- Info->OpRegionCount++;
- if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
- {
- break;
- }
-
Info->OpRegionInit++;
Status = AcpiDsGetRegionArguments (ObjDesc);
- if (ACPI_FAILURE (Status))
- {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ERROR, "\n"));
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "%s while getting region arguments [%4.4s]\n",
- AcpiFormatException (Status), (char *) &Node->Name));
- }
-
- if (!(AcpiDbgLevel & ACPI_LV_INIT))
- {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "."));
- }
-
break;
case ACPI_TYPE_BUFFER_FIELD:
- Info->FieldCount++;
- if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
- {
- break;
- }
-
Info->FieldInit++;
Status = AcpiDsGetBufferFieldArguments (ObjDesc);
- if (ACPI_FAILURE (Status))
- {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ERROR, "\n"));
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "%s while getting buffer field arguments [%4.4s]\n",
- AcpiFormatException (Status), (char *) &Node->Name));
- }
- if (!(AcpiDbgLevel & ACPI_LV_INIT))
- {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "."));
- }
+ break;
+
+ case ACPI_TYPE_BUFFER:
+ Info->BufferInit++;
+ Status = AcpiDsGetBufferArguments (ObjDesc);
break;
- default:
+
+ case ACPI_TYPE_PACKAGE:
+
+ Info->PackageInit++;
+ Status = AcpiDsGetPackageArguments (ObjDesc);
break;
}
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ERROR, "\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ "Could not execute arguments for [%4.4s] (%s), %s\n",
+ (char *) &Node->Name, AcpiUtGetTypeName (Type), AcpiFormatException (Status)));
+ }
+
+ if (!(AcpiDbgLevel & ACPI_LV_INIT))
+ {
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "."));
+ }
/*
* We ignore errors from above, and always return OK, since
- * we don't want to abort the walk on a single error.
+ * we don't want to abort the walk on any single error.
*/
AcpiExExitInterpreter ();
return (AE_OK);
@@ -446,7 +460,6 @@ AcpiNsInitOneDevice (
return_ACPI_STATUS(AE_CTRL_DEPTH);
}
-
/*
* The device is present. Run _INI.
*/