summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/nsload.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/dev/acpica/nsload.c')
-rw-r--r--sys/contrib/dev/acpica/nsload.c76
1 files changed, 41 insertions, 35 deletions
diff --git a/sys/contrib/dev/acpica/nsload.c b/sys/contrib/dev/acpica/nsload.c
index f3de362..00aceb0 100644
--- a/sys/contrib/dev/acpica/nsload.c
+++ b/sys/contrib/dev/acpica/nsload.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: nsload - namespace loading/expanding/contracting procedures
- * $Revision: 48 $
+ * $Revision: 53 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -126,14 +126,14 @@
#define _COMPONENT ACPI_NAMESPACE
- MODULE_NAME ("nsload")
+ ACPI_MODULE_NAME ("nsload")
/*******************************************************************************
*
* FUNCTION: AcpiLoadNamespace
*
- * PARAMETERS: DisplayAmlDuringLoad
+ * PARAMETERS: None
*
* RETURN: Status
*
@@ -149,7 +149,7 @@ AcpiNsLoadNamespace (
ACPI_STATUS Status;
- FUNCTION_TRACE ("AcpiLoadNameSpace");
+ ACPI_FUNCTION_TRACE ("AcpiLoadNameSpace");
/* There must be at least a DSDT installed */
@@ -160,7 +160,6 @@ AcpiNsLoadNamespace (
return_ACPI_STATUS (AE_NO_ACPI_TABLES);
}
-
/*
* Load the namespace. The DSDT is required,
* but the SSDT and PSDT tables are optional.
@@ -176,12 +175,10 @@ AcpiNsLoadNamespace (
AcpiNsLoadTableByType (ACPI_TABLE_SSDT);
AcpiNsLoadTableByType (ACPI_TABLE_PSDT);
-
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
"ACPI Namespace successfully loaded at root %p\n",
AcpiGbl_RootNode));
-
return_ACPI_STATUS (Status);
}
@@ -190,11 +187,12 @@ AcpiNsLoadNamespace (
*
* FUNCTION: AcpiNsOneParsePass
*
- * PARAMETERS:
+ * PARAMETERS: PassNumber - 1 or 2
+ * TableDesc - The table to be parsed.
*
* RETURN: Status
*
- * DESCRIPTION:
+ * DESCRIPTION: Perform one complete parse of an ACPI/AML table.
*
******************************************************************************/
@@ -208,7 +206,7 @@ AcpiNsOneCompleteParse (
ACPI_WALK_STATE *WalkState;
- FUNCTION_TRACE ("NsOneCompleteParse");
+ ACPI_FUNCTION_TRACE ("NsOneCompleteParse");
/* Create and init a Root Node */
@@ -221,7 +219,6 @@ AcpiNsOneCompleteParse (
((ACPI_PARSE2_OBJECT *) ParseRoot)->Name = ACPI_ROOT_NAME;
-
/* Create and initialize a new walk state */
WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT,
@@ -271,7 +268,7 @@ AcpiNsParseTable (
ACPI_STATUS Status;
- FUNCTION_TRACE ("NsParseTable");
+ ACPI_FUNCTION_TRACE ("NsParseTable");
/*
@@ -290,7 +287,6 @@ AcpiNsParseTable (
return_ACPI_STATUS (Status);
}
-
/*
* AML Parse, pass 2
*
@@ -331,8 +327,19 @@ AcpiNsLoadTable (
ACPI_STATUS Status;
- FUNCTION_TRACE ("NsLoadTable");
+ ACPI_FUNCTION_TRACE ("NsLoadTable");
+
+
+ /* Check if table contains valid AML (must be DSDT, PSDT, SSDT, etc.) */
+
+ if (!(AcpiGbl_AcpiTableData[TableDesc->Type].Flags & ACPI_TABLE_EXECUTABLE))
+ {
+ /* Just ignore this table */
+
+ return_ACPI_STATUS (AE_OK);
+ }
+ /* Check validity of the AML start and length */
if (!TableDesc->AmlStart)
{
@@ -342,14 +349,12 @@ AcpiNsLoadTable (
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "AML block at %p\n", TableDesc->AmlStart));
-
if (!TableDesc->AmlLength)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Zero-length AML block\n"));
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
-
/*
* Parse the table and load the namespace with all named
* objects found within. Control methods are NOT parsed
@@ -361,9 +366,14 @@ AcpiNsLoadTable (
*/
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** Loading table into namespace ****\n"));
- AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
Status = AcpiNsParseTable (TableDesc, Node->Child);
- AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (Status))
{
@@ -407,15 +417,18 @@ AcpiNsLoadTableByType (
ACPI_TABLE_TYPE TableType)
{
UINT32 i;
- ACPI_STATUS Status = AE_OK;
+ ACPI_STATUS Status;
ACPI_TABLE_DESC *TableDesc;
- FUNCTION_TRACE ("NsLoadTableByType");
-
+ ACPI_FUNCTION_TRACE ("NsLoadTableByType");
- AcpiUtAcquireMutex (ACPI_MTX_TABLES);
+ Status = AcpiUtAcquireMutex (ACPI_MTX_TABLES);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
/*
* Table types supported are:
@@ -423,7 +436,6 @@ AcpiNsLoadTableByType (
*/
switch (TableType)
{
-
case ACPI_TABLE_DSDT:
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading DSDT\n"));
@@ -519,11 +531,8 @@ AcpiNsLoadTableByType (
UnlockAndExit:
-
- AcpiUtReleaseMutex (ACPI_MTX_TABLES);
-
+ (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
return_ACPI_STATUS (Status);
-
}
@@ -538,8 +547,8 @@ UnlockAndExit:
* DESCRIPTION: Walks the namespace starting at the given handle and deletes
* all objects, entries, and scopes in the entire subtree.
*
- * TBD: [Investigate] What if any part of this subtree is in use?
- * (i.e. on one of the object stacks?)
+ * Namespace/Interpreter should be locked or the subsystem should
+ * be in shutdown before this routine is called.
*
******************************************************************************/
@@ -555,7 +564,7 @@ AcpiNsDeleteSubtree (
UINT32 Level;
- FUNCTION_TRACE ("NsDeleteSubtree");
+ ACPI_FUNCTION_TRACE ("NsDeleteSubtree");
ParentHandle = StartHandle;
@@ -575,7 +584,6 @@ AcpiNsDeleteSubtree (
ChildHandle = NextChildHandle;
-
/* Did we get a new object? */
if (ACPI_SUCCESS (Status))
@@ -594,7 +602,6 @@ AcpiNsDeleteSubtree (
ChildHandle = 0;
}
}
-
else
{
/*
@@ -641,7 +648,7 @@ AcpiNsUnloadNamespace (
ACPI_STATUS Status;
- FUNCTION_TRACE ("NsUnloadNameSpace");
+ ACPI_FUNCTION_TRACE ("NsUnloadNameSpace");
/* Parameter validation */
@@ -656,7 +663,6 @@ AcpiNsUnloadNamespace (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
-
/* This function does the real work */
Status = AcpiNsDeleteSubtree (Handle);
OpenPOWER on IntegriCloud