1 /******************************************************************************* 2 * 3 * Module Name: nsaccess - Top-level functions for accessing ACPI namespace 4 * 5 ******************************************************************************/ 6 7 /* 8 * Copyright (C) 2000 - 2017, Intel Corp. 9 * All rights reserved. 10 * 11 * Redistribution and use in source and binary forms, with or without 12 * modification, are permitted provided that the following conditions 13 * are met: 14 * 1. Redistributions of source code must retain the above copyright 15 * notice, this list of conditions, and the following disclaimer, 16 * without modification. 17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer 18 * substantially similar to the "NO WARRANTY" disclaimer below 19 * ("Disclaimer") and any redistribution must be conditioned upon 20 * including a substantially similar Disclaimer requirement for further 21 * binary redistribution. 22 * 3. Neither the names of the above-listed copyright holders nor the names 23 * of any contributors may be used to endorse or promote products derived 24 * from this software without specific prior written permission. 25 * 26 * Alternatively, this software may be distributed under the terms of the 27 * GNU General Public License ("GPL") version 2 as published by the Free 28 * Software Foundation. 29 * 30 * NO WARRANTY 31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 41 * POSSIBILITY OF SUCH DAMAGES. 42 */ 43 44 #include "acpi.h" 45 #include "accommon.h" 46 #include "amlcode.h" 47 #include "acnamesp.h" 48 #include "acdispat.h" 49 50 #ifdef ACPI_ASL_COMPILER 51 #include "acdisasm.h" 52 #endif 53 54 #define _COMPONENT ACPI_NAMESPACE 55 ACPI_MODULE_NAME ("nsaccess") 56 57 58 /******************************************************************************* 59 * 60 * FUNCTION: AcpiNsRootInitialize 61 * 62 * PARAMETERS: None 63 * 64 * RETURN: Status 65 * 66 * DESCRIPTION: Allocate and initialize the default root named objects 67 * 68 * MUTEX: Locks namespace for entire execution 69 * 70 ******************************************************************************/ 71 72 ACPI_STATUS 73 AcpiNsRootInitialize ( 74 void) 75 { 76 ACPI_STATUS Status; 77 const ACPI_PREDEFINED_NAMES *InitVal = NULL; 78 ACPI_NAMESPACE_NODE *NewNode; 79 ACPI_OPERAND_OBJECT *ObjDesc; 80 ACPI_STRING Val = NULL; 81 82 83 ACPI_FUNCTION_TRACE (NsRootInitialize); 84 85 86 Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); 87 if (ACPI_FAILURE (Status)) 88 { 89 return_ACPI_STATUS (Status); 90 } 91 92 /* 93 * The global root ptr is initially NULL, so a non-NULL value indicates 94 * that AcpiNsRootInitialize() has already been called; just return. 95 */ 96 if (AcpiGbl_RootNode) 97 { 98 Status = AE_OK; 99 goto UnlockAndExit; 100 } 101 102 /* 103 * Tell the rest of the subsystem that the root is initialized 104 * (This is OK because the namespace is locked) 105 */ 106 AcpiGbl_RootNode = &AcpiGbl_RootNodeStruct; 107 108 /* Enter the pre-defined names in the name table */ 109 110 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, 111 "Entering predefined entries into namespace\n")); 112 113 for (InitVal = AcpiGbl_PreDefinedNames; InitVal->Name; InitVal++) 114 { 115 /* _OSI is optional for now, will be permanent later */ 116 117 if (!strcmp (InitVal->Name, "_OSI") && !AcpiGbl_CreateOsiMethod) 118 { 119 continue; 120 } 121 122 Status = AcpiNsLookup (NULL, ACPI_CAST_PTR (char, InitVal->Name), 123 InitVal->Type, ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH, 124 NULL, &NewNode); 125 if (ACPI_FAILURE (Status)) 126 { 127 ACPI_EXCEPTION ((AE_INFO, Status, 128 "Could not create predefined name %s", 129 InitVal->Name)); 130 continue; 131 } 132 133 /* 134 * Name entered successfully. If entry in PreDefinedNames[] specifies 135 * an initial value, create the initial value. 136 */ 137 if (InitVal->Val) 138 { 139 Status = AcpiOsPredefinedOverride (InitVal, &Val); 140 if (ACPI_FAILURE (Status)) 141 { 142 ACPI_ERROR ((AE_INFO, 143 "Could not override predefined %s", 144 InitVal->Name)); 145 } 146 147 if (!Val) 148 { 149 Val = InitVal->Val; 150 } 151 152 /* 153 * Entry requests an initial value, allocate a 154 * descriptor for it. 155 */ 156 ObjDesc = AcpiUtCreateInternalObject (InitVal->Type); 157 if (!ObjDesc) 158 { 159 Status = AE_NO_MEMORY; 160 goto UnlockAndExit; 161 } 162 163 /* 164 * Convert value string from table entry to 165 * internal representation. Only types actually 166 * used for initial values are implemented here. 167 */ 168 switch (InitVal->Type) 169 { 170 case ACPI_TYPE_METHOD: 171 172 ObjDesc->Method.ParamCount = (UINT8) ACPI_TO_INTEGER (Val); 173 ObjDesc->Common.Flags |= AOPOBJ_DATA_VALID; 174 175 #if defined (ACPI_ASL_COMPILER) 176 177 /* Save the parameter count for the iASL compiler */ 178 179 NewNode->Value = ObjDesc->Method.ParamCount; 180 #else 181 /* Mark this as a very SPECIAL method */ 182 183 ObjDesc->Method.InfoFlags = ACPI_METHOD_INTERNAL_ONLY; 184 ObjDesc->Method.Dispatch.Implementation = AcpiUtOsiImplementation; 185 #endif 186 break; 187 188 case ACPI_TYPE_INTEGER: 189 190 ObjDesc->Integer.Value = ACPI_TO_INTEGER (Val); 191 break; 192 193 case ACPI_TYPE_STRING: 194 195 /* Build an object around the static string */ 196 197 ObjDesc->String.Length = (UINT32) strlen (Val); 198 ObjDesc->String.Pointer = Val; 199 ObjDesc->Common.Flags |= AOPOBJ_STATIC_POINTER; 200 break; 201 202 case ACPI_TYPE_MUTEX: 203 204 ObjDesc->Mutex.Node = NewNode; 205 ObjDesc->Mutex.SyncLevel = (UINT8) (ACPI_TO_INTEGER (Val) - 1); 206 207 /* Create a mutex */ 208 209 Status = AcpiOsCreateMutex (&ObjDesc->Mutex.OsMutex); 210 if (ACPI_FAILURE (Status)) 211 { 212 AcpiUtRemoveReference (ObjDesc); 213 goto UnlockAndExit; 214 } 215 216 /* Special case for ACPI Global Lock */ 217 218 if (strcmp (InitVal->Name, "_GL_") == 0) 219 { 220 AcpiGbl_GlobalLockMutex = ObjDesc; 221 222 /* Create additional counting semaphore for global lock */ 223 224 Status = AcpiOsCreateSemaphore ( 225 1, 0, &AcpiGbl_GlobalLockSemaphore); 226 if (ACPI_FAILURE (Status)) 227 { 228 AcpiUtRemoveReference (ObjDesc); 229 goto UnlockAndExit; 230 } 231 } 232 break; 233 234 default: 235 236 ACPI_ERROR ((AE_INFO, "Unsupported initial type value 0x%X", 237 InitVal->Type)); 238 AcpiUtRemoveReference (ObjDesc); 239 ObjDesc = NULL; 240 continue; 241 } 242 243 /* Store pointer to value descriptor in the Node */ 244 245 Status = AcpiNsAttachObject (NewNode, ObjDesc, 246 ObjDesc->Common.Type); 247 248 /* Remove local reference to the object */ 249 250 AcpiUtRemoveReference (ObjDesc); 251 } 252 } 253 254 255 UnlockAndExit: 256 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); 257 258 /* Save a handle to "_GPE", it is always present */ 259 260 if (ACPI_SUCCESS (Status)) 261 { 262 Status = AcpiNsGetNode (NULL, "\\_GPE", ACPI_NS_NO_UPSEARCH, 263 &AcpiGbl_FadtGpeDevice); 264 } 265 266 return_ACPI_STATUS (Status); 267 } 268 269 270 /******************************************************************************* 271 * 272 * FUNCTION: AcpiNsLookup 273 * 274 * PARAMETERS: ScopeInfo - Current scope info block 275 * Pathname - Search pathname, in internal format 276 * (as represented in the AML stream) 277 * Type - Type associated with name 278 * InterpreterMode - IMODE_LOAD_PASS2 => add name if not found 279 * Flags - Flags describing the search restrictions 280 * WalkState - Current state of the walk 281 * ReturnNode - Where the Node is placed (if found 282 * or created successfully) 283 * 284 * RETURN: Status 285 * 286 * DESCRIPTION: Find or enter the passed name in the name space. 287 * Log an error if name not found in Exec mode. 288 * 289 * MUTEX: Assumes namespace is locked. 290 * 291 ******************************************************************************/ 292 293 ACPI_STATUS 294 AcpiNsLookup ( 295 ACPI_GENERIC_STATE *ScopeInfo, 296 char *Pathname, 297 ACPI_OBJECT_TYPE Type, 298 ACPI_INTERPRETER_MODE InterpreterMode, 299 UINT32 Flags, 300 ACPI_WALK_STATE *WalkState, 301 ACPI_NAMESPACE_NODE **ReturnNode) 302 { 303 ACPI_STATUS Status; 304 char *Path = Pathname; 305 char *ExternalPath; 306 ACPI_NAMESPACE_NODE *PrefixNode; 307 ACPI_NAMESPACE_NODE *CurrentNode = NULL; 308 ACPI_NAMESPACE_NODE *ThisNode = NULL; 309 UINT32 NumSegments; 310 UINT32 NumCarats; 311 ACPI_NAME SimpleName; 312 ACPI_OBJECT_TYPE TypeToCheckFor; 313 ACPI_OBJECT_TYPE ThisSearchType; 314 UINT32 SearchParentFlag = ACPI_NS_SEARCH_PARENT; 315 UINT32 LocalFlags; 316 317 318 ACPI_FUNCTION_TRACE (NsLookup); 319 320 321 if (!ReturnNode) 322 { 323 return_ACPI_STATUS (AE_BAD_PARAMETER); 324 } 325 326 LocalFlags = Flags & 327 ~(ACPI_NS_ERROR_IF_FOUND | ACPI_NS_OVERRIDE_IF_FOUND | 328 ACPI_NS_SEARCH_PARENT); 329 *ReturnNode = ACPI_ENTRY_NOT_FOUND; 330 AcpiGbl_NsLookupCount++; 331 332 if (!AcpiGbl_RootNode) 333 { 334 return_ACPI_STATUS (AE_NO_NAMESPACE); 335 } 336 337 /* Get the prefix scope. A null scope means use the root scope */ 338 339 if ((!ScopeInfo) || 340 (!ScopeInfo->Scope.Node)) 341 { 342 ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, 343 "Null scope prefix, using root node (%p)\n", 344 AcpiGbl_RootNode)); 345 346 PrefixNode = AcpiGbl_RootNode; 347 } 348 else 349 { 350 PrefixNode = ScopeInfo->Scope.Node; 351 if (ACPI_GET_DESCRIPTOR_TYPE (PrefixNode) != ACPI_DESC_TYPE_NAMED) 352 { 353 ACPI_ERROR ((AE_INFO, "%p is not a namespace node [%s]", 354 PrefixNode, AcpiUtGetDescriptorName (PrefixNode))); 355 return_ACPI_STATUS (AE_AML_INTERNAL); 356 } 357 358 if (!(Flags & ACPI_NS_PREFIX_IS_SCOPE)) 359 { 360 /* 361 * This node might not be a actual "scope" node (such as a 362 * Device/Method, etc.) It could be a Package or other object 363 * node. Backup up the tree to find the containing scope node. 364 */ 365 while (!AcpiNsOpensScope (PrefixNode->Type) && 366 PrefixNode->Type != ACPI_TYPE_ANY) 367 { 368 PrefixNode = PrefixNode->Parent; 369 } 370 } 371 } 372 373 /* Save type. TBD: may be no longer necessary */ 374 375 TypeToCheckFor = Type; 376 377 /* 378 * Begin examination of the actual pathname 379 */ 380 if (!Pathname) 381 { 382 /* A Null NamePath is allowed and refers to the root */ 383 384 NumSegments = 0; 385 ThisNode = AcpiGbl_RootNode; 386 Path = ""; 387 388 ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, 389 "Null Pathname (Zero segments), Flags=%X\n", Flags)); 390 } 391 else 392 { 393 /* 394 * Name pointer is valid (and must be in internal name format) 395 * 396 * Check for scope prefixes: 397 * 398 * As represented in the AML stream, a namepath consists of an 399 * optional scope prefix followed by a name segment part. 400 * 401 * If present, the scope prefix is either a Root Prefix (in 402 * which case the name is fully qualified), or one or more 403 * Parent Prefixes (in which case the name's scope is relative 404 * to the current scope). 405 */ 406 if (*Path == (UINT8) AML_ROOT_PREFIX) 407 { 408 /* Pathname is fully qualified, start from the root */ 409 410 ThisNode = AcpiGbl_RootNode; 411 SearchParentFlag = ACPI_NS_NO_UPSEARCH; 412 413 /* Point to name segment part */ 414 415 Path++; 416 417 ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, 418 "Path is absolute from root [%p]\n", ThisNode)); 419 } 420 else 421 { 422 /* Pathname is relative to current scope, start there */ 423 424 ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, 425 "Searching relative to prefix scope [%4.4s] (%p)\n", 426 AcpiUtGetNodeName (PrefixNode), PrefixNode)); 427 428 /* 429 * Handle multiple Parent Prefixes (carat) by just getting 430 * the parent node for each prefix instance. 431 */ 432 ThisNode = PrefixNode; 433 NumCarats = 0; 434 while (*Path == (UINT8) AML_PARENT_PREFIX) 435 { 436 /* Name is fully qualified, no search rules apply */ 437 438 SearchParentFlag = ACPI_NS_NO_UPSEARCH; 439 440 /* 441 * Point past this prefix to the name segment 442 * part or the next Parent Prefix 443 */ 444 Path++; 445 446 /* Backup to the parent node */ 447 448 NumCarats++; 449 ThisNode = ThisNode->Parent; 450 if (!ThisNode) 451 { 452 /* 453 * Current scope has no parent scope. Externalize 454 * the internal path for error message. 455 */ 456 Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, Pathname, 457 NULL, &ExternalPath); 458 if (ACPI_SUCCESS (Status)) 459 { 460 ACPI_ERROR ((AE_INFO, 461 "%s: Path has too many parent prefixes (^)", 462 ExternalPath)); 463 464 ACPI_FREE (ExternalPath); 465 } 466 467 return_ACPI_STATUS (AE_NOT_FOUND); 468 } 469 } 470 471 if (SearchParentFlag == ACPI_NS_NO_UPSEARCH) 472 { 473 ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, 474 "Search scope is [%4.4s], path has %u carat(s)\n", 475 AcpiUtGetNodeName (ThisNode), NumCarats)); 476 } 477 } 478 479 /* 480 * Determine the number of ACPI name segments in this pathname. 481 * 482 * The segment part consists of either: 483 * - A Null name segment (0) 484 * - A DualNamePrefix followed by two 4-byte name segments 485 * - A MultiNamePrefix followed by a byte indicating the 486 * number of segments and the segments themselves. 487 * - A single 4-byte name segment 488 * 489 * Examine the name prefix opcode, if any, to determine the number of 490 * segments. 491 */ 492 switch (*Path) 493 { 494 case 0: 495 /* 496 * Null name after a root or parent prefixes. We already 497 * have the correct target node and there are no name segments. 498 */ 499 NumSegments = 0; 500 Type = ThisNode->Type; 501 502 ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, 503 "Prefix-only Pathname (Zero name segments), Flags=%X\n", 504 Flags)); 505 break; 506 507 case AML_DUAL_NAME_PREFIX: 508 509 /* More than one NameSeg, search rules do not apply */ 510 511 SearchParentFlag = ACPI_NS_NO_UPSEARCH; 512 513 /* Two segments, point to first name segment */ 514 515 NumSegments = 2; 516 Path++; 517 518 ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, 519 "Dual Pathname (2 segments, Flags=%X)\n", Flags)); 520 break; 521 522 case AML_MULTI_NAME_PREFIX: 523 524 /* More than one NameSeg, search rules do not apply */ 525 526 SearchParentFlag = ACPI_NS_NO_UPSEARCH; 527 528 /* Extract segment count, point to first name segment */ 529 530 Path++; 531 NumSegments = (UINT32) (UINT8) *Path; 532 Path++; 533 534 ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, 535 "Multi Pathname (%u Segments, Flags=%X)\n", 536 NumSegments, Flags)); 537 break; 538 539 default: 540 /* 541 * Not a Null name, no Dual or Multi prefix, hence there is 542 * only one name segment and Pathname is already pointing to it. 543 */ 544 NumSegments = 1; 545 546 ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, 547 "Simple Pathname (1 segment, Flags=%X)\n", Flags)); 548 break; 549 } 550 551 ACPI_DEBUG_EXEC (AcpiNsPrintPathname (NumSegments, Path)); 552 } 553 554 555 /* 556 * Search namespace for each segment of the name. Loop through and 557 * verify (or add to the namespace) each name segment. 558 * 559 * The object type is significant only at the last name 560 * segment. (We don't care about the types along the path, only 561 * the type of the final target object.) 562 */ 563 ThisSearchType = ACPI_TYPE_ANY; 564 CurrentNode = ThisNode; 565 while (NumSegments && CurrentNode) 566 { 567 NumSegments--; 568 if (!NumSegments) 569 { 570 /* This is the last segment, enable typechecking */ 571 572 ThisSearchType = Type; 573 574 /* 575 * Only allow automatic parent search (search rules) if the caller 576 * requested it AND we have a single, non-fully-qualified NameSeg 577 */ 578 if ((SearchParentFlag != ACPI_NS_NO_UPSEARCH) && 579 (Flags & ACPI_NS_SEARCH_PARENT)) 580 { 581 LocalFlags |= ACPI_NS_SEARCH_PARENT; 582 } 583 584 /* Set error flag according to caller */ 585 586 if (Flags & ACPI_NS_ERROR_IF_FOUND) 587 { 588 LocalFlags |= ACPI_NS_ERROR_IF_FOUND; 589 } 590 591 /* Set override flag according to caller */ 592 593 if (Flags & ACPI_NS_OVERRIDE_IF_FOUND) 594 { 595 LocalFlags |= ACPI_NS_OVERRIDE_IF_FOUND; 596 } 597 } 598 599 /* Extract one ACPI name from the front of the pathname */ 600 601 ACPI_MOVE_32_TO_32 (&SimpleName, Path); 602 603 /* Try to find the single (4 character) ACPI name */ 604 605 Status = AcpiNsSearchAndEnter (SimpleName, WalkState, CurrentNode, 606 InterpreterMode, ThisSearchType, LocalFlags, &ThisNode); 607 if (ACPI_FAILURE (Status)) 608 { 609 if (Status == AE_NOT_FOUND) 610 { 611 /* Name not found in ACPI namespace */ 612 613 ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, 614 "Name [%4.4s] not found in scope [%4.4s] %p\n", 615 (char *) &SimpleName, (char *) &CurrentNode->Name, 616 CurrentNode)); 617 } 618 619 #ifdef ACPI_ASL_COMPILER 620 /* 621 * If this ACPI name already exists within the namespace as an 622 * external declaration, then mark the external as a conflicting 623 * declaration and proceed to process the current node as if it did 624 * not exist in the namespace. If this node is not processed as 625 * normal, then it could cause improper namespace resolution 626 * by failing to open a new scope. 627 */ 628 if (AcpiGbl_DisasmFlag && 629 (Status == AE_ALREADY_EXISTS) && 630 ((ThisNode->Flags & ANOBJ_IS_EXTERNAL) || 631 (WalkState && WalkState->Opcode == AML_EXTERNAL_OP))) 632 { 633 ThisNode->Flags &= ~ANOBJ_IS_EXTERNAL; 634 ThisNode->Type = (UINT8)ThisSearchType; 635 if (WalkState->Opcode != AML_EXTERNAL_OP) 636 { 637 AcpiDmMarkExternalConflict (ThisNode); 638 } 639 break; 640 } 641 #endif 642 643 *ReturnNode = ThisNode; 644 return_ACPI_STATUS (Status); 645 } 646 647 /* More segments to follow? */ 648 649 if (NumSegments > 0) 650 { 651 /* 652 * If we have an alias to an object that opens a scope (such as a 653 * device or processor), we need to dereference the alias here so 654 * that we can access any children of the original node (via the 655 * remaining segments). 656 */ 657 if (ThisNode->Type == ACPI_TYPE_LOCAL_ALIAS) 658 { 659 if (!ThisNode->Object) 660 { 661 return_ACPI_STATUS (AE_NOT_EXIST); 662 } 663 664 if (AcpiNsOpensScope (((ACPI_NAMESPACE_NODE *) 665 ThisNode->Object)->Type)) 666 { 667 ThisNode = (ACPI_NAMESPACE_NODE *) ThisNode->Object; 668 } 669 } 670 #ifdef ACPI_ASL_COMPILER 671 if (!AcpiGbl_DisasmFlag && 672 (ThisNode->Flags & ANOBJ_IS_EXTERNAL)) 673 { 674 ThisNode->Flags |= IMPLICIT_EXTERNAL; 675 } 676 #endif 677 } 678 679 /* Special handling for the last segment (NumSegments == 0) */ 680 681 else 682 { 683 /* 684 * Sanity typecheck of the target object: 685 * 686 * If 1) This is the last segment (NumSegments == 0) 687 * 2) And we are looking for a specific type 688 * (Not checking for TYPE_ANY) 689 * 3) Which is not an alias 690 * 4) Which is not a local type (TYPE_SCOPE) 691 * 5) And the type of target object is known (not TYPE_ANY) 692 * 6) And target object does not match what we are looking for 693 * 694 * Then we have a type mismatch. Just warn and ignore it. 695 */ 696 if ((TypeToCheckFor != ACPI_TYPE_ANY) && 697 (TypeToCheckFor != ACPI_TYPE_LOCAL_ALIAS) && 698 (TypeToCheckFor != ACPI_TYPE_LOCAL_METHOD_ALIAS) && 699 (TypeToCheckFor != ACPI_TYPE_LOCAL_SCOPE) && 700 (ThisNode->Type != ACPI_TYPE_ANY) && 701 (ThisNode->Type != TypeToCheckFor)) 702 { 703 /* Complain about a type mismatch */ 704 705 ACPI_WARNING ((AE_INFO, 706 "NsLookup: Type mismatch on %4.4s (%s), searching for (%s)", 707 ACPI_CAST_PTR (char, &SimpleName), 708 AcpiUtGetTypeName (ThisNode->Type), 709 AcpiUtGetTypeName (TypeToCheckFor))); 710 } 711 712 /* 713 * If this is the last name segment and we are not looking for a 714 * specific type, but the type of found object is known, use that 715 * type to (later) see if it opens a scope. 716 */ 717 if (Type == ACPI_TYPE_ANY) 718 { 719 Type = ThisNode->Type; 720 } 721 } 722 723 /* Point to next name segment and make this node current */ 724 725 Path += ACPI_NAME_SIZE; 726 CurrentNode = ThisNode; 727 } 728 729 /* Always check if we need to open a new scope */ 730 731 if (!(Flags & ACPI_NS_DONT_OPEN_SCOPE) && (WalkState)) 732 { 733 /* 734 * If entry is a type which opens a scope, push the new scope on the 735 * scope stack. 736 */ 737 if (AcpiNsOpensScope (Type)) 738 { 739 Status = AcpiDsScopeStackPush (ThisNode, Type, WalkState); 740 if (ACPI_FAILURE (Status)) 741 { 742 return_ACPI_STATUS (Status); 743 } 744 } 745 } 746 747 *ReturnNode = ThisNode; 748 return_ACPI_STATUS (AE_OK); 749 } 750