diff options
Diffstat (limited to 'sys/contrib/dev/acpica/components/namespace/nsparse.c')
-rw-r--r-- | sys/contrib/dev/acpica/components/namespace/nsparse.c | 57 |
1 files changed, 32 insertions, 25 deletions
diff --git a/sys/contrib/dev/acpica/components/namespace/nsparse.c b/sys/contrib/dev/acpica/components/namespace/nsparse.c index 0f87fa1..d0f9e95 100644 --- a/sys/contrib/dev/acpica/components/namespace/nsparse.c +++ b/sys/contrib/dev/acpica/components/namespace/nsparse.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -84,6 +84,22 @@ AcpiNsOneCompleteParse ( ACPI_FUNCTION_TRACE (NsOneCompleteParse); + 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)) { @@ -92,7 +108,7 @@ AcpiNsOneCompleteParse ( /* Create and init a Root Node */ - ParseRoot = AcpiPsCreateScopeOp (); + ParseRoot = AcpiPsCreateScopeOp (AmlStart); if (!ParseRoot) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -107,39 +123,28 @@ AcpiNsOneCompleteParse ( return_ACPI_STATUS (AE_NO_MEMORY); } - Status = AcpiGetTableByIndex (TableIndex, &Table); + Status = AcpiDsInitAmlWalk (WalkState, ParseRoot, NULL, + AmlStart, AmlLength, NULL, (UINT8) PassNumber); if (ACPI_FAILURE (Status)) { AcpiDsDeleteWalkState (WalkState); - AcpiPsFreeOp (ParseRoot); - return_ACPI_STATUS (Status); + goto Cleanup; } - /* Table must consist of at least a complete header */ - - if (Table->Length < sizeof (ACPI_TABLE_HEADER)) - { - Status = AE_BAD_HEADER; - } - else - { - AmlStart = (UINT8 *) Table + sizeof (ACPI_TABLE_HEADER); - AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER); - Status = AcpiDsInitAmlWalk (WalkState, ParseRoot, NULL, - AmlStart, AmlLength, NULL, (UINT8) PassNumber); - } + /* Found OSDT table, enable the namespace override feature */ - if (ACPI_FAILURE (Status)) + if (ACPI_COMPARE_NAME(Table->Signature, ACPI_SIG_OSDT) && + PassNumber == ACPI_IMODE_LOAD_PASS1) { - AcpiDsDeleteWalkState (WalkState); - goto Cleanup; + WalkState->NamespaceOverride = TRUE; } /* StartNode is the default location to load the table */ if (StartNode && StartNode != AcpiGbl_RootNode) { - Status = AcpiDsScopeStackPush (StartNode, ACPI_TYPE_METHOD, WalkState); + Status = AcpiDsScopeStackPush ( + StartNode, ACPI_TYPE_METHOD, WalkState); if (ACPI_FAILURE (Status)) { AcpiDsDeleteWalkState (WalkState); @@ -149,7 +154,8 @@ AcpiNsOneCompleteParse ( /* Parse the AML */ - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "*PARSE* pass %u parse\n", PassNumber)); + ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, + "*PARSE* pass %u parse\n", PassNumber)); Status = AcpiPsParseAml (WalkState); Cleanup: @@ -193,8 +199,9 @@ AcpiNsParseTable ( * 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); + TableIndex, StartNode); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -211,7 +218,7 @@ AcpiNsParseTable ( */ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 2\n")); Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS2, - TableIndex, StartNode); + TableIndex, StartNode); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); |