diff options
Diffstat (limited to 'sys/contrib/dev/acpica/nsaccess.c')
-rw-r--r-- | sys/contrib/dev/acpica/nsaccess.c | 121 |
1 files changed, 59 insertions, 62 deletions
diff --git a/sys/contrib/dev/acpica/nsaccess.c b/sys/contrib/dev/acpica/nsaccess.c index 84ec3c4..d1b4f73 100644 --- a/sys/contrib/dev/acpica/nsaccess.c +++ b/sys/contrib/dev/acpica/nsaccess.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: nsaccess - Top-level functions for accessing ACPI namespace - * $Revision: 1.192 $ + * $Revision: 1.206 $ * ******************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. * All rights reserved. * * 2. License @@ -151,7 +151,7 @@ AcpiNsRootInitialize ( ACPI_STRING Val = NULL; - ACPI_FUNCTION_TRACE ("NsRootInitialize"); + ACPI_FUNCTION_TRACE (NsRootInitialize); Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); @@ -196,9 +196,9 @@ AcpiNsRootInitialize ( if (ACPI_FAILURE (Status) || (!NewNode)) /* Must be on same line for code converter */ { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Could not create predefined name %s, %s\n", - InitVal->Name, AcpiFormatException (Status))); + ACPI_EXCEPTION ((AE_INFO, Status, + "Could not create predefined name %s", + InitVal->Name)); } /* @@ -211,8 +211,8 @@ AcpiNsRootInitialize ( Status = AcpiOsPredefinedOverride (InitVal, &Val); if (ACPI_FAILURE (Status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Could not override predefined %s\n", + ACPI_ERROR ((AE_INFO, + "Could not override predefined %s", InitVal->Name)); } @@ -281,32 +281,25 @@ AcpiNsRootInitialize ( ObjDesc->Mutex.Node = NewNode; ObjDesc->Mutex.SyncLevel = (UINT8) (ACPI_TO_INTEGER (Val) - 1); - if (ACPI_STRCMP (InitVal->Name, "_GL_") == 0) - { - /* - * Create a counting semaphore for the - * global lock - */ - Status = AcpiOsCreateSemaphore (ACPI_NO_UNIT_LIMIT, - 1, &ObjDesc->Mutex.Semaphore); - if (ACPI_FAILURE (Status)) - { - AcpiUtRemoveReference (ObjDesc); - goto UnlockAndExit; - } + /* Create a mutex */ - /* - * We just created the mutex for the - * global lock, save it - */ - AcpiGbl_GlobalLockSemaphore = ObjDesc->Mutex.Semaphore; + Status = AcpiOsCreateMutex (&ObjDesc->Mutex.OsMutex); + if (ACPI_FAILURE (Status)) + { + AcpiUtRemoveReference (ObjDesc); + goto UnlockAndExit; } - else + + /* Special case for ACPI Global Lock */ + + if (ACPI_STRCMP (InitVal->Name, "_GL_") == 0) { - /* Create a mutex */ + AcpiGbl_GlobalLockMutex = ObjDesc; + + /* Create additional counting semaphore for global lock */ - Status = AcpiOsCreateSemaphore (1, 1, - &ObjDesc->Mutex.Semaphore); + Status = AcpiOsCreateSemaphore ( + 1, 0, &AcpiGbl_GlobalLockSemaphore); if (ACPI_FAILURE (Status)) { AcpiUtRemoveReference (ObjDesc); @@ -318,7 +311,7 @@ AcpiNsRootInitialize ( default: - ACPI_REPORT_ERROR (("Unsupported initial type value %X\n", + ACPI_ERROR ((AE_INFO, "Unsupported initial type value %X", InitVal->Type)); AcpiUtRemoveReference (ObjDesc); ObjDesc = NULL; @@ -344,8 +337,8 @@ UnlockAndExit: if (ACPI_SUCCESS (Status)) { - Status = AcpiNsGetNodeByPath ("\\_GPE", NULL, ACPI_NS_NO_UPSEARCH, - &AcpiGbl_FadtGpeDevice); + Status = AcpiNsGetNode (NULL, "\\_GPE", ACPI_NS_NO_UPSEARCH, + &AcpiGbl_FadtGpeDevice); } return_ACPI_STATUS (Status); @@ -396,11 +389,10 @@ AcpiNsLookup ( ACPI_OBJECT_TYPE TypeToCheckFor; ACPI_OBJECT_TYPE ThisSearchType; UINT32 SearchParentFlag = ACPI_NS_SEARCH_PARENT; - UINT32 LocalFlags = Flags & ~(ACPI_NS_ERROR_IF_FOUND | - ACPI_NS_SEARCH_PARENT); + UINT32 LocalFlags; - ACPI_FUNCTION_TRACE ("NsLookup"); + ACPI_FUNCTION_TRACE (NsLookup); if (!ReturnNode) @@ -408,8 +400,9 @@ AcpiNsLookup ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - AcpiGbl_NsLookupCount++; + LocalFlags = Flags & ~(ACPI_NS_ERROR_IF_FOUND | ACPI_NS_SEARCH_PARENT); *ReturnNode = ACPI_ENTRY_NOT_FOUND; + AcpiGbl_NsLookupCount++; if (!AcpiGbl_RootNode) { @@ -434,20 +427,23 @@ AcpiNsLookup ( PrefixNode = ScopeInfo->Scope.Node; if (ACPI_GET_DESCRIPTOR_TYPE (PrefixNode) != ACPI_DESC_TYPE_NAMED) { - ACPI_REPORT_ERROR (("NsLookup: %p is not a namespace node [%s]\n", - PrefixNode, AcpiUtGetDescriptorName (PrefixNode))); + ACPI_ERROR ((AE_INFO, "%p is not a namespace node [%s]", + PrefixNode, AcpiUtGetDescriptorName (PrefixNode))); return_ACPI_STATUS (AE_AML_INTERNAL); } - /* - * This node might not be a actual "scope" node (such as a - * Device/Method, etc.) It could be a Package or other object node. - * Backup up the tree to find the containing scope node. - */ - while (!AcpiNsOpensScope (PrefixNode->Type) && - PrefixNode->Type != ACPI_TYPE_ANY) + if (!(Flags & ACPI_NS_PREFIX_IS_SCOPE)) { - PrefixNode = AcpiNsGetParentNode (PrefixNode); + /* + * This node might not be a actual "scope" node (such as a + * Device/Method, etc.) It could be a Package or other object node. + * Backup up the tree to find the containing scope node. + */ + while (!AcpiNsOpensScope (PrefixNode->Type) && + PrefixNode->Type != ACPI_TYPE_ANY) + { + PrefixNode = AcpiNsGetParentNode (PrefixNode); + } } } @@ -462,9 +458,9 @@ AcpiNsLookup ( { /* A Null NamePath is allowed and refers to the root */ - NumSegments = 0; - ThisNode = AcpiGbl_RootNode; - Path = ""; + NumSegments = 0; + ThisNode = AcpiGbl_RootNode; + Path = ""; ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Null Pathname (Zero segments), Flags=%X\n", Flags)); @@ -531,8 +527,8 @@ AcpiNsLookup ( { /* Current scope has no parent scope */ - ACPI_REPORT_ERROR ( - ("ACPI path has too many parent prefixes (^) - reached beyond root node\n")); + ACPI_ERROR ((AE_INFO, + "ACPI path has too many parent prefixes (^) - reached beyond root node")); return_ACPI_STATUS (AE_NOT_FOUND); } } @@ -696,19 +692,20 @@ AcpiNsLookup ( * * Then we have a type mismatch. Just warn and ignore it. */ - if ((NumSegments == 0) && - (TypeToCheckFor != ACPI_TYPE_ANY) && - (TypeToCheckFor != ACPI_TYPE_LOCAL_ALIAS) && - (TypeToCheckFor != ACPI_TYPE_LOCAL_METHOD_ALIAS) && - (TypeToCheckFor != ACPI_TYPE_LOCAL_SCOPE) && - (ThisNode->Type != ACPI_TYPE_ANY) && - (ThisNode->Type != TypeToCheckFor)) + if ((NumSegments == 0) && + (TypeToCheckFor != ACPI_TYPE_ANY) && + (TypeToCheckFor != ACPI_TYPE_LOCAL_ALIAS) && + (TypeToCheckFor != ACPI_TYPE_LOCAL_METHOD_ALIAS) && + (TypeToCheckFor != ACPI_TYPE_LOCAL_SCOPE) && + (ThisNode->Type != ACPI_TYPE_ANY) && + (ThisNode->Type != TypeToCheckFor)) { /* Complain about a type mismatch */ - ACPI_REPORT_WARNING ( - ("NsLookup: Type mismatch on %4.4s (%s), searching for (%s)\n", - (char *) &SimpleName, AcpiUtGetTypeName (ThisNode->Type), + ACPI_WARNING ((AE_INFO, + "NsLookup: Type mismatch on %4.4s (%s), searching for (%s)", + ACPI_CAST_PTR (char, &SimpleName), + AcpiUtGetTypeName (ThisNode->Type), AcpiUtGetTypeName (TypeToCheckFor))); } |