diff options
Diffstat (limited to 'source/components/namespace/nsparse.c')
-rw-r--r-- | source/components/namespace/nsparse.c | 185 |
1 files changed, 31 insertions, 154 deletions
diff --git a/source/components/namespace/nsparse.c b/source/components/namespace/nsparse.c index 331998941..6cfdd06fa 100644 --- a/source/components/namespace/nsparse.c +++ b/source/components/namespace/nsparse.c @@ -119,7 +119,6 @@ #include "acparser.h" #include "acdispat.h" #include "actables.h" -#include "acinterp.h" #define _COMPONENT ACPI_NAMESPACE @@ -128,111 +127,6 @@ /******************************************************************************* * - * FUNCTION: NsExecuteTable - * - * PARAMETERS: TableDesc - An ACPI table descriptor for table to parse - * StartNode - Where to enter the table into the namespace - * - * RETURN: Status - * - * DESCRIPTION: Load ACPI/AML table by executing the entire table as a - * TermList. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiNsExecuteTable ( - UINT32 TableIndex, - ACPI_NAMESPACE_NODE *StartNode) -{ - ACPI_STATUS Status; - ACPI_TABLE_HEADER *Table; - ACPI_OWNER_ID OwnerId; - ACPI_EVALUATE_INFO *Info = NULL; - UINT32 AmlLength; - UINT8 *AmlStart; - ACPI_OPERAND_OBJECT *MethodObj = NULL; - - - ACPI_FUNCTION_TRACE (NsExecuteTable); - - - Status = AcpiGetTableByIndex (TableIndex, &Table); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Table must consist of at least a complete header */ - - if (Table->Length < sizeof (ACPI_TABLE_HEADER)) - { - return_ACPI_STATUS (AE_BAD_HEADER); - } - - AmlStart = (UINT8 *) Table + sizeof (ACPI_TABLE_HEADER); - AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER); - - Status = AcpiTbGetOwnerId (TableIndex, &OwnerId); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Create, initialize, and link a new temporary method object */ - - MethodObj = AcpiUtCreateInternalObject (ACPI_TYPE_METHOD); - if (!MethodObj) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* Allocate the evaluation information block */ - - Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO)); - if (!Info) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "Create table code block: %p\n", MethodObj)); - - MethodObj->Method.AmlStart = AmlStart; - MethodObj->Method.AmlLength = AmlLength; - MethodObj->Method.OwnerId = OwnerId; - MethodObj->Method.InfoFlags |= ACPI_METHOD_MODULE_LEVEL; - - Info->PassNumber = ACPI_IMODE_EXECUTE; - Info->Node = StartNode; - Info->ObjDesc = MethodObj; - Info->NodeFlags = Info->Node->Flags; - Info->FullPathname = AcpiNsGetNormalizedPathname (Info->Node, TRUE); - if (!Info->FullPathname) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } - - (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - Status = AcpiPsExecuteTable (Info); - (void) AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - -Cleanup: - if (Info) - { - ACPI_FREE (Info->FullPathname); - Info->FullPathname = NULL; - } - ACPI_FREE (Info); - AcpiUtRemoveReference (MethodObj); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * * FUNCTION: NsOneCompleteParse * * PARAMETERS: PassNumber - 1 or 2 @@ -366,58 +260,41 @@ AcpiNsParseTable ( ACPI_FUNCTION_TRACE (NsParseTable); - AcpiExEnterInterpreter (); - - if (AcpiGbl_ParseTableAsTermList) + /* + * AML Parse, pass 1 + * + * In this pass, we load most of the namespace. Control methods + * are not parsed until later. A parse tree is not created. Instead, + * each Parser Op subtree is deleted when it is finished. This saves + * a great deal of memory, and allows a small cache of parse objects + * to service the entire parse. The second pass of the parse then + * performs another complete parse of the AML. + */ + ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 1\n")); + + Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS1, + TableIndex, StartNode); + if (ACPI_FAILURE (Status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start load pass\n")); - - Status = AcpiNsExecuteTable (TableIndex, StartNode); - if (ACPI_FAILURE (Status)) - { - goto ErrorExit; - } + return_ACPI_STATUS (Status); } - else - { - /* - * AML Parse, pass 1 - * - * In this pass, we load most of the namespace. Control methods - * are not parsed until later. A parse tree is not created. - * Instead, each Parser Op subtree is deleted when it is finished. - * This saves a great deal of memory, and allows a small cache of - * parse objects to service the entire parse. The second pass of - * the parse then performs another complete parse of the AML. - */ - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 1\n")); - - Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS1, - TableIndex, StartNode); - if (ACPI_FAILURE (Status)) - { - goto ErrorExit; - } - /* - * AML Parse, pass 2 - * - * In this pass, we resolve forward references and other things - * that could not be completed during the first pass. - * Another complete parse of the AML is performed, but the - * overhead of this is compensated for by the fact that the - * parse objects are all cached. - */ - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 2\n")); - Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS2, - TableIndex, StartNode); - if (ACPI_FAILURE (Status)) - { - goto ErrorExit; - } + /* + * AML Parse, pass 2 + * + * In this pass, we resolve forward references and other things + * that could not be completed during the first pass. + * Another complete parse of the AML is performed, but the + * overhead of this is compensated for by the fact that the + * parse objects are all cached. + */ + ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 2\n")); + Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS2, + TableIndex, StartNode); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); } -ErrorExit: - AcpiExExitInterpreter (); return_ACPI_STATUS (Status); } |