dswload.c (151600) | dswload.c (151937) |
---|---|
1/****************************************************************************** 2 * 3 * Module Name: dswload - Dispatcher namespace load callbacks | 1/****************************************************************************** 2 * 3 * Module Name: dswload - Dispatcher namespace load callbacks |
4 * $Revision: 88 $ | 4 * $Revision: 1.98 $ |
5 * 6 *****************************************************************************/ 7 8/****************************************************************************** 9 * 10 * 1. Copyright Notice 11 * | 5 * 6 *****************************************************************************/ 7 8/****************************************************************************** 9 * 10 * 1. Copyright Notice 11 * |
12 * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. | 12 * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp. |
13 * All rights reserved. 14 * 15 * 2. License 16 * 17 * 2.1. This is your license from Intel Corp. under its intellectual property 18 * rights. You may have additional license terms from the party that provided 19 * you this software, covering your right to use that party's intellectual 20 * property rights. --- 98 unchanged lines hidden (view full) --- 119#include <contrib/dev/acpica/acpi.h> 120#include <contrib/dev/acpica/acparser.h> 121#include <contrib/dev/acpica/amlcode.h> 122#include <contrib/dev/acpica/acdispat.h> 123#include <contrib/dev/acpica/acinterp.h> 124#include <contrib/dev/acpica/acnamesp.h> 125#include <contrib/dev/acpica/acevents.h> 126 | 13 * All rights reserved. 14 * 15 * 2. License 16 * 17 * 2.1. This is your license from Intel Corp. under its intellectual property 18 * rights. You may have additional license terms from the party that provided 19 * you this software, covering your right to use that party's intellectual 20 * property rights. --- 98 unchanged lines hidden (view full) --- 119#include <contrib/dev/acpica/acpi.h> 120#include <contrib/dev/acpica/acparser.h> 121#include <contrib/dev/acpica/amlcode.h> 122#include <contrib/dev/acpica/acdispat.h> 123#include <contrib/dev/acpica/acinterp.h> 124#include <contrib/dev/acpica/acnamesp.h> 125#include <contrib/dev/acpica/acevents.h> 126 |
127#ifdef _ACPI_ASL_COMPILER | 127#ifdef ACPI_ASL_COMPILER |
128#include <contrib/dev/acpica/acdisasm.h> 129#endif 130 131#define _COMPONENT ACPI_DISPATCHER 132 ACPI_MODULE_NAME ("dswload") 133 134 135/******************************************************************************* --- 13 unchanged lines hidden (view full) --- 149AcpiDsInitCallbacks ( 150 ACPI_WALK_STATE *WalkState, 151 UINT32 PassNumber) 152{ 153 154 switch (PassNumber) 155 { 156 case 1: | 128#include <contrib/dev/acpica/acdisasm.h> 129#endif 130 131#define _COMPONENT ACPI_DISPATCHER 132 ACPI_MODULE_NAME ("dswload") 133 134 135/******************************************************************************* --- 13 unchanged lines hidden (view full) --- 149AcpiDsInitCallbacks ( 150 ACPI_WALK_STATE *WalkState, 151 UINT32 PassNumber) 152{ 153 154 switch (PassNumber) 155 { 156 case 1: |
157 WalkState->ParseFlags = ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE; | 157 WalkState->ParseFlags = ACPI_PARSE_LOAD_PASS1 | 158 ACPI_PARSE_DELETE_TREE; |
158 WalkState->DescendingCallback = AcpiDsLoad1BeginOp; 159 WalkState->AscendingCallback = AcpiDsLoad1EndOp; 160 break; 161 162 case 2: | 159 WalkState->DescendingCallback = AcpiDsLoad1BeginOp; 160 WalkState->AscendingCallback = AcpiDsLoad1EndOp; 161 break; 162 163 case 2: |
163 WalkState->ParseFlags = ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE; | 164 WalkState->ParseFlags = ACPI_PARSE_LOAD_PASS1 | 165 ACPI_PARSE_DELETE_TREE; |
164 WalkState->DescendingCallback = AcpiDsLoad2BeginOp; 165 WalkState->AscendingCallback = AcpiDsLoad2EndOp; 166 break; 167 168 case 3: 169#ifndef ACPI_NO_METHOD_EXECUTION | 166 WalkState->DescendingCallback = AcpiDsLoad2BeginOp; 167 WalkState->AscendingCallback = AcpiDsLoad2EndOp; 168 break; 169 170 case 3: 171#ifndef ACPI_NO_METHOD_EXECUTION |
170 WalkState->ParseFlags |= ACPI_PARSE_EXECUTE | ACPI_PARSE_DELETE_TREE; | 172 WalkState->ParseFlags |= ACPI_PARSE_EXECUTE | 173 ACPI_PARSE_DELETE_TREE; |
171 WalkState->DescendingCallback = AcpiDsExecBeginOp; 172 WalkState->AscendingCallback = AcpiDsExecEndOp; 173#endif 174 break; 175 176 default: 177 return (AE_BAD_PARAMETER); 178 } 179 180 return (AE_OK); 181} 182 183 184/******************************************************************************* 185 * 186 * FUNCTION: AcpiDsLoad1BeginOp 187 * 188 * PARAMETERS: WalkState - Current state of the parse tree walk | 174 WalkState->DescendingCallback = AcpiDsExecBeginOp; 175 WalkState->AscendingCallback = AcpiDsExecEndOp; 176#endif 177 break; 178 179 default: 180 return (AE_BAD_PARAMETER); 181 } 182 183 return (AE_OK); 184} 185 186 187/******************************************************************************* 188 * 189 * FUNCTION: AcpiDsLoad1BeginOp 190 * 191 * PARAMETERS: WalkState - Current state of the parse tree walk |
189 * Op - Op that has been just been reached in the 190 * walk; Arguments have not been evaluated yet. | 192 * OutOp - Where to return op if a new one is created |
191 * 192 * RETURN: Status 193 * 194 * DESCRIPTION: Descending callback used during the loading of ACPI tables. 195 * 196 ******************************************************************************/ 197 198ACPI_STATUS --- 16 unchanged lines hidden (view full) --- 215 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState)); 216 217 /* We are only interested in opcodes that have an associated name */ 218 219 if (Op) 220 { 221 if (!(WalkState->OpInfo->Flags & AML_NAMED)) 222 { | 193 * 194 * RETURN: Status 195 * 196 * DESCRIPTION: Descending callback used during the loading of ACPI tables. 197 * 198 ******************************************************************************/ 199 200ACPI_STATUS --- 16 unchanged lines hidden (view full) --- 217 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState)); 218 219 /* We are only interested in opcodes that have an associated name */ 220 221 if (Op) 222 { 223 if (!(WalkState->OpInfo->Flags & AML_NAMED)) 224 { |
223#if 0 224 if ((WalkState->OpInfo->Class == AML_CLASS_EXECUTE) || 225 (WalkState->OpInfo->Class == AML_CLASS_CONTROL)) 226 { 227 AcpiOsPrintf ("\n\n***EXECUTABLE OPCODE %s***\n\n", WalkState->OpInfo->Name); 228 *OutOp = Op; 229 return (AE_CTRL_SKIP); 230 } 231#endif | |
232 *OutOp = Op; 233 return (AE_OK); 234 } 235 236 /* Check if this object has already been installed in the namespace */ 237 238 if (Op->Common.Node) 239 { --- 17 unchanged lines hidden (view full) --- 257 258 /* 259 * The target name of the Scope() operator must exist at this point so 260 * that we can actually open the scope to enter new names underneath it. 261 * Allow search-to-root for single namesegs. 262 */ 263 Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, 264 ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &(Node)); | 225 *OutOp = Op; 226 return (AE_OK); 227 } 228 229 /* Check if this object has already been installed in the namespace */ 230 231 if (Op->Common.Node) 232 { --- 17 unchanged lines hidden (view full) --- 250 251 /* 252 * The target name of the Scope() operator must exist at this point so 253 * that we can actually open the scope to enter new names underneath it. 254 * Allow search-to-root for single namesegs. 255 */ 256 Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, 257 ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &(Node)); |
265#ifdef _ACPI_ASL_COMPILER | 258#ifdef ACPI_ASL_COMPILER |
266 if (Status == AE_NOT_FOUND) 267 { 268 /* 269 * Table disassembly: 270 * Target of Scope() not found. Generate an External for it, and 271 * insert the name into the namespace. 272 */ 273 AcpiDmAddToExternalList (Path); 274 Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, | 259 if (Status == AE_NOT_FOUND) 260 { 261 /* 262 * Table disassembly: 263 * Target of Scope() not found. Generate an External for it, and 264 * insert the name into the namespace. 265 */ 266 AcpiDmAddToExternalList (Path); 267 Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, |
275 ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT, WalkState, &(Node)); | 268 ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT, 269 WalkState, &(Node)); |
276 } 277#endif 278 if (ACPI_FAILURE (Status)) 279 { 280 ACPI_REPORT_NSERROR (Path, Status); 281 return (Status); 282 } 283 --- 18 unchanged lines hidden (view full) --- 302 303 /* 304 * These types we will allow, but we will change the type. This 305 * enables some existing code of the form: 306 * 307 * Name (DEB, 0) 308 * Scope (DEB) { ... } 309 * | 270 } 271#endif 272 if (ACPI_FAILURE (Status)) 273 { 274 ACPI_REPORT_NSERROR (Path, Status); 275 return (Status); 276 } 277 --- 18 unchanged lines hidden (view full) --- 296 297 /* 298 * These types we will allow, but we will change the type. This 299 * enables some existing code of the form: 300 * 301 * Name (DEB, 0) 302 * Scope (DEB) { ... } 303 * |
310 * Note: silently change the type here. On the second pass, we will report a warning | 304 * Note: silently change the type here. On the second pass, we will report 305 * a warning |
311 */ 312 | 306 */ 307 |
313 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n", | 308 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, 309 "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n", |
314 Path, AcpiUtGetTypeName (Node->Type))); 315 316 Node->Type = ACPI_TYPE_ANY; 317 WalkState->ScopeInfo->Common.Value = ACPI_TYPE_ANY; 318 break; 319 320 default: 321 322 /* All other types are an error */ 323 | 310 Path, AcpiUtGetTypeName (Node->Type))); 311 312 Node->Type = ACPI_TYPE_ANY; 313 WalkState->ScopeInfo->Common.Value = ACPI_TYPE_ANY; 314 break; 315 316 default: 317 318 /* All other types are an error */ 319 |
324 ACPI_REPORT_ERROR (("Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)\n", | 320 ACPI_REPORT_ERROR (( 321 "Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)\n", |
325 AcpiUtGetTypeName (Node->Type), Path)); 326 327 return (AE_AML_OPERAND_TYPE); 328 } 329 break; 330 331 332 default: 333 334 /* | 322 AcpiUtGetTypeName (Node->Type), Path)); 323 324 return (AE_AML_OPERAND_TYPE); 325 } 326 break; 327 328 329 default: 330 331 /* |
335 * For all other named opcodes, we will enter the name into the namespace. | 332 * For all other named opcodes, we will enter the name into 333 * the namespace. |
336 * 337 * Setup the search flags. 338 * Since we are entering a name into the namespace, we do not want to 339 * enable the search-to-root upsearch. 340 * 341 * There are only two conditions where it is acceptable that the name 342 * already exists: 343 * 1) the Scope() operator can reopen a scoping object that was --- 16 unchanged lines hidden (view full) --- 360 (!(WalkState->ParseFlags & ACPI_PARSE_DEFERRED_OP))) 361 { 362 Flags |= ACPI_NS_ERROR_IF_FOUND; 363 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[%s] Cannot already exist\n", 364 AcpiUtGetTypeName (ObjectType))); 365 } 366 else 367 { | 334 * 335 * Setup the search flags. 336 * Since we are entering a name into the namespace, we do not want to 337 * enable the search-to-root upsearch. 338 * 339 * There are only two conditions where it is acceptable that the name 340 * already exists: 341 * 1) the Scope() operator can reopen a scoping object that was --- 16 unchanged lines hidden (view full) --- 358 (!(WalkState->ParseFlags & ACPI_PARSE_DEFERRED_OP))) 359 { 360 Flags |= ACPI_NS_ERROR_IF_FOUND; 361 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[%s] Cannot already exist\n", 362 AcpiUtGetTypeName (ObjectType))); 363 } 364 else 365 { |
368 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[%s] Both Find or Create allowed\n", | 366 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, 367 "[%s] Both Find or Create allowed\n", |
369 AcpiUtGetTypeName (ObjectType))); 370 } 371 372 /* 373 * Enter the named type into the internal namespace. We enter the name | 368 AcpiUtGetTypeName (ObjectType))); 369 } 370 371 /* 372 * Enter the named type into the internal namespace. We enter the name |
374 * as we go downward in the parse tree. Any necessary subobjects that involve 375 * arguments to the opcode must be created as we go back up the parse tree later. | 373 * as we go downward in the parse tree. Any necessary subobjects that 374 * involve arguments to the opcode must be created as we go back up the 375 * parse tree later. |
376 */ 377 Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, 378 ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &(Node)); 379 if (ACPI_FAILURE (Status)) 380 { 381 ACPI_REPORT_NSERROR (Path, Status); 382 return (Status); 383 } --- 35 unchanged lines hidden (view full) --- 419} 420 421 422/******************************************************************************* 423 * 424 * FUNCTION: AcpiDsLoad1EndOp 425 * 426 * PARAMETERS: WalkState - Current state of the parse tree walk | 376 */ 377 Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, 378 ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &(Node)); 379 if (ACPI_FAILURE (Status)) 380 { 381 ACPI_REPORT_NSERROR (Path, Status); 382 return (Status); 383 } --- 35 unchanged lines hidden (view full) --- 419} 420 421 422/******************************************************************************* 423 * 424 * FUNCTION: AcpiDsLoad1EndOp 425 * 426 * PARAMETERS: WalkState - Current state of the parse tree walk |
427 * Op - Op that has been just been completed in the 428 * walk; Arguments have now been evaluated. | |
429 * 430 * RETURN: Status 431 * 432 * DESCRIPTION: Ascending callback used during the loading of the namespace, 433 * both control methods and everything else. 434 * 435 ******************************************************************************/ 436 --- 34 unchanged lines hidden (view full) --- 471 } 472 return (Status); 473 } 474 475 476 if (Op->Common.AmlOpcode == AML_REGION_OP) 477 { 478 Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length, | 427 * 428 * RETURN: Status 429 * 430 * DESCRIPTION: Ascending callback used during the loading of the namespace, 431 * both control methods and everything else. 432 * 433 ******************************************************************************/ 434 --- 34 unchanged lines hidden (view full) --- 469 } 470 return (Status); 471 } 472 473 474 if (Op->Common.AmlOpcode == AML_REGION_OP) 475 { 476 Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length, |
479 (ACPI_ADR_SPACE_TYPE) ((Op->Common.Value.Arg)->Common.Value.Integer), WalkState); | 477 (ACPI_ADR_SPACE_TYPE) 478 ((Op->Common.Value.Arg)->Common.Value.Integer), 479 WalkState); |
480 if (ACPI_FAILURE (Status)) 481 { 482 return (Status); 483 } 484 } 485#endif 486 487 if (Op->Common.AmlOpcode == AML_NAME_OP) 488 { 489 /* For Name opcode, get the object type from the argument */ 490 491 if (Op->Common.Value.Arg) 492 { | 480 if (ACPI_FAILURE (Status)) 481 { 482 return (Status); 483 } 484 } 485#endif 486 487 if (Op->Common.AmlOpcode == AML_NAME_OP) 488 { 489 /* For Name opcode, get the object type from the argument */ 490 491 if (Op->Common.Value.Arg) 492 { |
493 ObjectType = (AcpiPsGetOpcodeInfo ((Op->Common.Value.Arg)->Common.AmlOpcode))->ObjectType; | 493 ObjectType = (AcpiPsGetOpcodeInfo ( 494 (Op->Common.Value.Arg)->Common.AmlOpcode))->ObjectType; |
494 Op->Common.Node->Type = (UINT8) ObjectType; 495 } 496 } 497 498 if (Op->Common.AmlOpcode == AML_METHOD_OP) 499 { 500 /* 501 * MethodOp PkgLength NameString MethodFlags TermList --- 42 unchanged lines hidden (view full) --- 544} 545 546 547/******************************************************************************* 548 * 549 * FUNCTION: AcpiDsLoad2BeginOp 550 * 551 * PARAMETERS: WalkState - Current state of the parse tree walk | 495 Op->Common.Node->Type = (UINT8) ObjectType; 496 } 497 } 498 499 if (Op->Common.AmlOpcode == AML_METHOD_OP) 500 { 501 /* 502 * MethodOp PkgLength NameString MethodFlags TermList --- 42 unchanged lines hidden (view full) --- 545} 546 547 548/******************************************************************************* 549 * 550 * FUNCTION: AcpiDsLoad2BeginOp 551 * 552 * PARAMETERS: WalkState - Current state of the parse tree walk |
552 * Op - Op that has been just been reached in the 553 * walk; Arguments have not been evaluated yet. | 553 * OutOp - Wher to return op if a new one is created |
554 * 555 * RETURN: Status 556 * 557 * DESCRIPTION: Descending callback used during the loading of ACPI tables. 558 * 559 ******************************************************************************/ 560 561ACPI_STATUS --- 11 unchanged lines hidden (view full) --- 573 ACPI_FUNCTION_TRACE ("DsLoad2BeginOp"); 574 575 576 Op = WalkState->Op; 577 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState)); 578 579 if (Op) 580 { | 554 * 555 * RETURN: Status 556 * 557 * DESCRIPTION: Descending callback used during the loading of ACPI tables. 558 * 559 ******************************************************************************/ 560 561ACPI_STATUS --- 11 unchanged lines hidden (view full) --- 573 ACPI_FUNCTION_TRACE ("DsLoad2BeginOp"); 574 575 576 Op = WalkState->Op; 577 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState)); 578 579 if (Op) 580 { |
581 if ((WalkState->ControlState) && 582 (WalkState->ControlState->Common.State == 583 ACPI_CONTROL_CONDITIONAL_EXECUTING)) 584 { 585 /* We are executing a while loop outside of a method */ 586 587 Status = AcpiDsExecBeginOp (WalkState, OutOp); 588 return_ACPI_STATUS (Status); 589 } 590 |
|
581 /* We only care about Namespace opcodes here */ 582 | 591 /* We only care about Namespace opcodes here */ 592 |
583 if ((!(WalkState->OpInfo->Flags & AML_NSOPCODE) && (WalkState->Opcode != AML_INT_NAMEPATH_OP)) || | 593 if ((!(WalkState->OpInfo->Flags & AML_NSOPCODE) && 594 (WalkState->Opcode != AML_INT_NAMEPATH_OP)) || |
584 (!(WalkState->OpInfo->Flags & AML_NAMED))) 585 { | 595 (!(WalkState->OpInfo->Flags & AML_NAMED))) 596 { |
597#ifdef ACPI_ENABLE_MODULE_LEVEL_CODE 598 if ((WalkState->OpInfo->Class == AML_CLASS_EXECUTE) || 599 (WalkState->OpInfo->Class == AML_CLASS_CONTROL)) 600 { 601 602 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, 603 "Begin/EXEC: %s (fl %8.8X)\n", WalkState->OpInfo->Name, 604 WalkState->OpInfo->Flags)); 605 606 /* Executing a type1 or type2 opcode outside of a method */ 607 608 Status = AcpiDsExecBeginOp (WalkState, OutOp); 609 return_ACPI_STATUS (Status); 610 } 611#endif |
|
586 return_ACPI_STATUS (AE_OK); 587 } 588 | 612 return_ACPI_STATUS (AE_OK); 613 } 614 |
589 /* 590 * Get the name we are going to enter or lookup in the namespace 591 */ | 615 /* Get the name we are going to enter or lookup in the namespace */ 616 |
592 if (WalkState->Opcode == AML_INT_NAMEPATH_OP) 593 { 594 /* For Namepath op, get the path string */ 595 596 BufferPtr = Op->Common.Value.String; 597 if (!BufferPtr) 598 { 599 /* No name, just exit */ --- 31 unchanged lines hidden (view full) --- 631 632 Node = NULL; 633 Status = AE_OK; 634 break; 635 636 case AML_INT_NAMEPATH_OP: 637 638 /* | 617 if (WalkState->Opcode == AML_INT_NAMEPATH_OP) 618 { 619 /* For Namepath op, get the path string */ 620 621 BufferPtr = Op->Common.Value.String; 622 if (!BufferPtr) 623 { 624 /* No name, just exit */ --- 31 unchanged lines hidden (view full) --- 656 657 Node = NULL; 658 Status = AE_OK; 659 break; 660 661 case AML_INT_NAMEPATH_OP: 662 663 /* |
639 * The NamePath is an object reference to an existing object. Don't enter the 640 * name into the namespace, but look it up for use later | 664 * The NamePath is an object reference to an existing object. 665 * Don't enter the name into the namespace, but look it up 666 * for use later. |
641 */ 642 Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType, | 667 */ 668 Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType, |
643 ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &(Node)); | 669 ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, 670 WalkState, &(Node)); |
644 break; 645 646 case AML_SCOPE_OP: 647 648 /* | 671 break; 672 673 case AML_SCOPE_OP: 674 675 /* |
649 * The Path is an object reference to an existing object. Don't enter the 650 * name into the namespace, but look it up for use later | 676 * The Path is an object reference to an existing object. 677 * Don't enter the name into the namespace, but look it up 678 * for use later. |
651 */ 652 Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType, | 679 */ 680 Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType, |
653 ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &(Node)); | 681 ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, 682 WalkState, &(Node)); |
654 if (ACPI_FAILURE (Status)) 655 { | 683 if (ACPI_FAILURE (Status)) 684 { |
656#ifdef _ACPI_ASL_COMPILER | 685#ifdef ACPI_ASL_COMPILER |
657 if (Status == AE_NOT_FOUND) 658 { 659 Status = AE_OK; 660 } 661 else 662 { 663 ACPI_REPORT_NSERROR (BufferPtr, Status); 664 } --- 24 unchanged lines hidden (view full) --- 689 /* 690 * These types we will allow, but we will change the type. This 691 * enables some existing code of the form: 692 * 693 * Name (DEB, 0) 694 * Scope (DEB) { ... } 695 */ 696 | 686 if (Status == AE_NOT_FOUND) 687 { 688 Status = AE_OK; 689 } 690 else 691 { 692 ACPI_REPORT_NSERROR (BufferPtr, Status); 693 } --- 24 unchanged lines hidden (view full) --- 718 /* 719 * These types we will allow, but we will change the type. This 720 * enables some existing code of the form: 721 * 722 * Name (DEB, 0) 723 * Scope (DEB) { ... } 724 */ 725 |
697 ACPI_REPORT_WARNING (("Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n", | 726 ACPI_REPORT_WARNING (( 727 "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n", |
698 BufferPtr, AcpiUtGetTypeName (Node->Type))); 699 700 Node->Type = ACPI_TYPE_ANY; 701 WalkState->ScopeInfo->Common.Value = ACPI_TYPE_ANY; 702 break; 703 704 default: 705 706 /* All other types are an error */ 707 | 728 BufferPtr, AcpiUtGetTypeName (Node->Type))); 729 730 Node->Type = ACPI_TYPE_ANY; 731 WalkState->ScopeInfo->Common.Value = ACPI_TYPE_ANY; 732 break; 733 734 default: 735 736 /* All other types are an error */ 737 |
708 ACPI_REPORT_ERROR (("Invalid type (%s) for target of Scope operator [%4.4s]\n", | 738 ACPI_REPORT_ERROR (( 739 "Invalid type (%s) for target of Scope operator [%4.4s]\n", |
709 AcpiUtGetTypeName (Node->Type), BufferPtr)); 710 711 return (AE_AML_OPERAND_TYPE); 712 } 713 break; 714 715 default: 716 --- 14 unchanged lines hidden (view full) --- 731 } 732 733 } 734 return_ACPI_STATUS (AE_OK); 735 } 736 737 /* 738 * Enter the named type into the internal namespace. We enter the name | 740 AcpiUtGetTypeName (Node->Type), BufferPtr)); 741 742 return (AE_AML_OPERAND_TYPE); 743 } 744 break; 745 746 default: 747 --- 14 unchanged lines hidden (view full) --- 762 } 763 764 } 765 return_ACPI_STATUS (AE_OK); 766 } 767 768 /* 769 * Enter the named type into the internal namespace. We enter the name |
739 * as we go downward in the parse tree. Any necessary subobjects that involve 740 * arguments to the opcode must be created as we go back up the parse tree later. | 770 * as we go downward in the parse tree. Any necessary subobjects that 771 * involve arguments to the opcode must be created as we go back up the 772 * parse tree later. |
741 * 742 * Note: Name may already exist if we are executing a deferred opcode. 743 */ 744 if (WalkState->DeferredNode) 745 { 746 /* This name is already in the namespace, get the node */ 747 748 Node = WalkState->DeferredNode; 749 Status = AE_OK; 750 break; 751 } 752 | 773 * 774 * Note: Name may already exist if we are executing a deferred opcode. 775 */ 776 if (WalkState->DeferredNode) 777 { 778 /* This name is already in the namespace, get the node */ 779 780 Node = WalkState->DeferredNode; 781 Status = AE_OK; 782 break; 783 } 784 |
785 /* Add new entry into namespace */ 786 |
|
753 Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType, | 787 Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType, |
754 ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, WalkState, &(Node)); | 788 ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH, 789 WalkState, &(Node)); |
755 break; 756 } 757 758 if (ACPI_FAILURE (Status)) 759 { 760 ACPI_REPORT_NSERROR (BufferPtr, Status); 761 return_ACPI_STATUS (Status); 762 } 763 | 790 break; 791 } 792 793 if (ACPI_FAILURE (Status)) 794 { 795 ACPI_REPORT_NSERROR (BufferPtr, Status); 796 return_ACPI_STATUS (Status); 797 } 798 |
764 | |
765 if (!Op) 766 { 767 /* Create a new op */ 768 769 Op = AcpiPsAllocOp (WalkState->Opcode); 770 if (!Op) 771 { 772 return_ACPI_STATUS (AE_NO_MEMORY); 773 } 774 775 /* Initialize the new op */ 776 777 if (Node) 778 { 779 Op->Named.Name = Node->Name.Integer; 780 } | 799 if (!Op) 800 { 801 /* Create a new op */ 802 803 Op = AcpiPsAllocOp (WalkState->Opcode); 804 if (!Op) 805 { 806 return_ACPI_STATUS (AE_NO_MEMORY); 807 } 808 809 /* Initialize the new op */ 810 811 if (Node) 812 { 813 Op->Named.Name = Node->Name.Integer; 814 } |
781 if (OutOp) 782 { 783 *OutOp = Op; 784 } | 815 *OutOp = Op; |
785 } 786 787 /* 788 * Put the Node in the "op" object that the parser uses, so we 789 * can get it again quickly when this scope is closed 790 */ 791 Op->Common.Node = Node; 792 793 return_ACPI_STATUS (Status); 794} 795 796 797/******************************************************************************* 798 * 799 * FUNCTION: AcpiDsLoad2EndOp 800 * 801 * PARAMETERS: WalkState - Current state of the parse tree walk | 816 } 817 818 /* 819 * Put the Node in the "op" object that the parser uses, so we 820 * can get it again quickly when this scope is closed 821 */ 822 Op->Common.Node = Node; 823 824 return_ACPI_STATUS (Status); 825} 826 827 828/******************************************************************************* 829 * 830 * FUNCTION: AcpiDsLoad2EndOp 831 * 832 * PARAMETERS: WalkState - Current state of the parse tree walk |
802 * Op - Op that has been just been completed in the 803 * walk; Arguments have now been evaluated. | |
804 * 805 * RETURN: Status 806 * 807 * DESCRIPTION: Ascending callback used during the loading of the namespace, 808 * both control methods and everything else. 809 * 810 ******************************************************************************/ 811 --- 13 unchanged lines hidden (view full) --- 825 826 827 ACPI_FUNCTION_TRACE ("DsLoad2EndOp"); 828 829 Op = WalkState->Op; 830 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n", 831 WalkState->OpInfo->Name, Op, WalkState)); 832 | 833 * 834 * RETURN: Status 835 * 836 * DESCRIPTION: Ascending callback used during the loading of the namespace, 837 * both control methods and everything else. 838 * 839 ******************************************************************************/ 840 --- 13 unchanged lines hidden (view full) --- 854 855 856 ACPI_FUNCTION_TRACE ("DsLoad2EndOp"); 857 858 Op = WalkState->Op; 859 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n", 860 WalkState->OpInfo->Name, Op, WalkState)); 861 |
833 /* Only interested in opcodes that have namespace objects */ | 862 /* Check if opcode had an associated namespace object */ |
834 835 if (!(WalkState->OpInfo->Flags & AML_NSOBJECT)) 836 { | 863 864 if (!(WalkState->OpInfo->Flags & AML_NSOBJECT)) 865 { |
866#ifndef ACPI_NO_METHOD_EXECUTION 867#ifdef ACPI_ENABLE_MODULE_LEVEL_CODE 868 /* No namespace object. Executable opcode? */ 869 870 if ((WalkState->OpInfo->Class == AML_CLASS_EXECUTE) || 871 (WalkState->OpInfo->Class == AML_CLASS_CONTROL)) 872 { 873 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, 874 "End/EXEC: %s (fl %8.8X)\n", WalkState->OpInfo->Name, 875 WalkState->OpInfo->Flags)); 876 877 /* Executing a type1 or type2 opcode outside of a method */ 878 879 Status = AcpiDsExecEndOp (WalkState); 880 return_ACPI_STATUS (Status); 881 } 882#endif 883#endif |
|
837 return_ACPI_STATUS (AE_OK); 838 } 839 840 if (Op->Common.AmlOpcode == AML_SCOPE_OP) 841 { 842 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, 843 "Ending scope Op=%p State=%p\n", Op, WalkState)); 844 } 845 | 884 return_ACPI_STATUS (AE_OK); 885 } 886 887 if (Op->Common.AmlOpcode == AML_SCOPE_OP) 888 { 889 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, 890 "Ending scope Op=%p State=%p\n", Op, WalkState)); 891 } 892 |
846 | |
847 ObjectType = WalkState->OpInfo->ObjectType; 848 849 /* 850 * Get the Node/name from the earlier lookup 851 * (It was saved in the *op structure) 852 */ 853 Node = Op->Common.Node; 854 855 /* 856 * Put the Node on the object stack (Contains the ACPI Name of 857 * this object) 858 */ 859 WalkState->Operands[0] = (void *) Node; 860 WalkState->NumOperands = 1; 861 862 /* Pop the scope stack */ 863 | 893 ObjectType = WalkState->OpInfo->ObjectType; 894 895 /* 896 * Get the Node/name from the earlier lookup 897 * (It was saved in the *op structure) 898 */ 899 Node = Op->Common.Node; 900 901 /* 902 * Put the Node on the object stack (Contains the ACPI Name of 903 * this object) 904 */ 905 WalkState->Operands[0] = (void *) Node; 906 WalkState->NumOperands = 1; 907 908 /* Pop the scope stack */ 909 |
864 if (AcpiNsOpensScope (ObjectType) && (Op->Common.AmlOpcode != AML_INT_METHODCALL_OP)) | 910 if (AcpiNsOpensScope (ObjectType) && 911 (Op->Common.AmlOpcode != AML_INT_METHODCALL_OP)) |
865 { 866 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n", 867 AcpiUtGetTypeName (ObjectType), Op)); 868 869 Status = AcpiDsScopeStackPop (WalkState); 870 if (ACPI_FAILURE (Status)) 871 { 872 goto Cleanup; --- 52 unchanged lines hidden (view full) --- 925 926 case AML_TYPE_NAMED_FIELD: 927 928 switch (Op->Common.AmlOpcode) 929 { 930 case AML_INDEX_FIELD_OP: 931 932 Status = AcpiDsCreateIndexField (Op, (ACPI_HANDLE) Arg->Common.Node, | 912 { 913 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n", 914 AcpiUtGetTypeName (ObjectType), Op)); 915 916 Status = AcpiDsScopeStackPop (WalkState); 917 if (ACPI_FAILURE (Status)) 918 { 919 goto Cleanup; --- 52 unchanged lines hidden (view full) --- 972 973 case AML_TYPE_NAMED_FIELD: 974 975 switch (Op->Common.AmlOpcode) 976 { 977 case AML_INDEX_FIELD_OP: 978 979 Status = AcpiDsCreateIndexField (Op, (ACPI_HANDLE) Arg->Common.Node, |
933 WalkState); | 980 WalkState); |
934 break; 935 936 case AML_BANK_FIELD_OP: 937 938 Status = AcpiDsCreateBankField (Op, Arg->Common.Node, WalkState); 939 break; 940 941 case AML_FIELD_OP: --- 68 unchanged lines hidden (view full) --- 1010 1011 case AML_TYPE_NAMED_COMPLEX: 1012 1013 switch (Op->Common.AmlOpcode) 1014 { 1015#ifndef ACPI_NO_METHOD_EXECUTION 1016 case AML_REGION_OP: 1017 /* | 981 break; 982 983 case AML_BANK_FIELD_OP: 984 985 Status = AcpiDsCreateBankField (Op, Arg->Common.Node, WalkState); 986 break; 987 988 case AML_FIELD_OP: --- 68 unchanged lines hidden (view full) --- 1057 1058 case AML_TYPE_NAMED_COMPLEX: 1059 1060 switch (Op->Common.AmlOpcode) 1061 { 1062#ifndef ACPI_NO_METHOD_EXECUTION 1063 case AML_REGION_OP: 1064 /* |
1018 * The OpRegion is not fully parsed at this time. Only valid argument is the SpaceId. 1019 * (We must save the address of the AML of the address and length operands) | 1065 * The OpRegion is not fully parsed at this time. Only valid 1066 * argument is the SpaceId. (We must save the address of the 1067 * AML of the address and length operands) |
1020 */ 1021 /* 1022 * If we have a valid region, initialize it 1023 * Namespace is NOT locked at this point. 1024 */ | 1068 */ 1069 /* 1070 * If we have a valid region, initialize it 1071 * Namespace is NOT locked at this point. 1072 */ |
1025 Status = AcpiEvInitializeRegion (AcpiNsGetAttachedObject (Node), FALSE); | 1073 Status = AcpiEvInitializeRegion (AcpiNsGetAttachedObject (Node), 1074 FALSE); |
1026 if (ACPI_FAILURE (Status)) 1027 { 1028 /* 1029 * If AE_NOT_EXIST is returned, it is not fatal 1030 * because many regions get created before a handler 1031 * is installed for said region. 1032 */ 1033 if (AE_NOT_EXIST == Status) --- 37 unchanged lines hidden (view full) --- 1071 Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, 1072 ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS2, 1073 ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, 1074 WalkState, &(NewNode)); 1075 if (ACPI_SUCCESS (Status)) 1076 { 1077 /* 1078 * Make sure that what we found is indeed a method | 1075 if (ACPI_FAILURE (Status)) 1076 { 1077 /* 1078 * If AE_NOT_EXIST is returned, it is not fatal 1079 * because many regions get created before a handler 1080 * is installed for said region. 1081 */ 1082 if (AE_NOT_EXIST == Status) --- 37 unchanged lines hidden (view full) --- 1120 Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, 1121 ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS2, 1122 ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, 1123 WalkState, &(NewNode)); 1124 if (ACPI_SUCCESS (Status)) 1125 { 1126 /* 1127 * Make sure that what we found is indeed a method |
1079 * We didn't search for a method on purpose, to see if the name would resolve | 1128 * We didn't search for a method on purpose, to see if the name 1129 * would resolve |
1080 */ 1081 if (NewNode->Type != ACPI_TYPE_METHOD) 1082 { 1083 Status = AE_AML_OPERAND_TYPE; 1084 } 1085 | 1130 */ 1131 if (NewNode->Type != ACPI_TYPE_METHOD) 1132 { 1133 Status = AE_AML_OPERAND_TYPE; 1134 } 1135 |
1086 /* We could put the returned object (Node) on the object stack for later, but 1087 * for now, we will put it in the "op" object that the parser uses, so we 1088 * can get it again at the end of this scope | 1136 /* We could put the returned object (Node) on the object stack for 1137 * later, but for now, we will put it in the "op" object that the 1138 * parser uses, so we can get it again at the end of this scope |
1089 */ 1090 Op->Common.Node = NewNode; 1091 } 1092 else 1093 { 1094 ACPI_REPORT_NSERROR (Arg->Common.Value.String, Status); 1095 } 1096 break; --- 16 unchanged lines hidden --- | 1139 */ 1140 Op->Common.Node = NewNode; 1141 } 1142 else 1143 { 1144 ACPI_REPORT_NSERROR (Arg->Common.Value.String, Status); 1145 } 1146 break; --- 16 unchanged lines hidden --- |