dsutils.c (80062) | dsutils.c (82367) |
---|---|
1/******************************************************************************* 2 * 3 * Module Name: dsutils - Dispatcher utilities | 1/******************************************************************************* 2 * 3 * Module Name: dsutils - Dispatcher utilities |
4 * $Revision: 62 $ | 4 * $Revision: 68 $ |
5 * 6 ******************************************************************************/ 7 8/****************************************************************************** 9 * 10 * 1. Copyright Notice 11 * 12 * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp. --- 139 unchanged lines hidden (view full) --- 152 153 FUNCTION_TRACE_PTR ("DsIsResultUsed", Op); 154 155 156 /* Must have both an Op and a Result Object */ 157 158 if (!Op) 159 { | 5 * 6 ******************************************************************************/ 7 8/****************************************************************************** 9 * 10 * 1. Copyright Notice 11 * 12 * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp. --- 139 unchanged lines hidden (view full) --- 152 153 FUNCTION_TRACE_PTR ("DsIsResultUsed", Op); 154 155 156 /* Must have both an Op and a Result Object */ 157 158 if (!Op) 159 { |
160 DEBUG_PRINTP (ACPI_ERROR, ("Null Op\n")); | 160 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Op\n")); |
161 return_VALUE (TRUE); 162 } 163 164 165 /* 166 * If there is no parent, the result can't possibly be used! 167 * (An executing method typically has no parent, since each 168 * method is parsed separately) However, a method that is --- 7 unchanged lines hidden (view full) --- 176 177 /* 178 * Get info on the parent. The root Op is AML_SCOPE 179 */ 180 181 ParentInfo = AcpiPsGetOpcodeInfo (Op->Parent->Opcode); 182 if (ACPI_GET_OP_TYPE (ParentInfo) != ACPI_OP_TYPE_OPCODE) 183 { | 161 return_VALUE (TRUE); 162 } 163 164 165 /* 166 * If there is no parent, the result can't possibly be used! 167 * (An executing method typically has no parent, since each 168 * method is parsed separately) However, a method that is --- 7 unchanged lines hidden (view full) --- 176 177 /* 178 * Get info on the parent. The root Op is AML_SCOPE 179 */ 180 181 ParentInfo = AcpiPsGetOpcodeInfo (Op->Parent->Opcode); 182 if (ACPI_GET_OP_TYPE (ParentInfo) != ACPI_OP_TYPE_OPCODE) 183 { |
184 DEBUG_PRINTP (ACPI_ERROR, ("Unknown parent opcode. Op=%X\n", Op)); | 184 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown parent opcode. Op=%X\n", Op)); |
185 return_VALUE (FALSE); 186 } 187 188 189 /* 190 * Decide what to do with the result based on the parent. If 191 * the parent opcode will not use the result, delete the object. 192 * Otherwise leave it as is, it will be deleted when it is used --- 8 unchanged lines hidden (view full) --- 201 case OPTYPE_CONTROL: /* IF, ELSE, WHILE only */ 202 203 switch (Op->Parent->Opcode) 204 { 205 case AML_RETURN_OP: 206 207 /* Never delete the return value associated with a return opcode */ 208 | 185 return_VALUE (FALSE); 186 } 187 188 189 /* 190 * Decide what to do with the result based on the parent. If 191 * the parent opcode will not use the result, delete the object. 192 * Otherwise leave it as is, it will be deleted when it is used --- 8 unchanged lines hidden (view full) --- 201 case OPTYPE_CONTROL: /* IF, ELSE, WHILE only */ 202 203 switch (Op->Parent->Opcode) 204 { 205 case AML_RETURN_OP: 206 207 /* Never delete the return value associated with a return opcode */ 208 |
209 DEBUG_PRINTP (TRACE_DISPATCH, 210 ("Result used, [RETURN] opcode=%X Op=%X\n", Op->Opcode, Op)); | 209 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, 210 "Result used, [RETURN] opcode=%X Op=%X\n", Op->Opcode, Op)); |
211 return_VALUE (TRUE); 212 break; 213 214 case AML_IF_OP: 215 case AML_WHILE_OP: 216 217 /* 218 * If we are executing the predicate AND this is the predicate op, 219 * we will use the return value! 220 */ 221 222 if ((WalkState->ControlState->Common.State == CONTROL_PREDICATE_EXECUTING) && 223 (WalkState->ControlState->Control.PredicateOp == Op)) 224 { | 211 return_VALUE (TRUE); 212 break; 213 214 case AML_IF_OP: 215 case AML_WHILE_OP: 216 217 /* 218 * If we are executing the predicate AND this is the predicate op, 219 * we will use the return value! 220 */ 221 222 if ((WalkState->ControlState->Common.State == CONTROL_PREDICATE_EXECUTING) && 223 (WalkState->ControlState->Control.PredicateOp == Op)) 224 { |
225 DEBUG_PRINTP (TRACE_DISPATCH, 226 ("Result used as a predicate, [IF/WHILE] opcode=%X Op=%X\n", | 225 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, 226 "Result used as a predicate, [IF/WHILE] opcode=%X Op=%X\n", |
227 Op->Opcode, Op)); 228 return_VALUE (TRUE); 229 } 230 231 break; 232 } 233 234 --- 9 unchanged lines hidden (view full) --- 244 if ((Op->Parent->Opcode == AML_REGION_OP) || 245 (Op->Parent->Opcode == AML_CREATE_FIELD_OP) || 246 (Op->Parent->Opcode == AML_CREATE_BIT_FIELD_OP) || 247 (Op->Parent->Opcode == AML_CREATE_BYTE_FIELD_OP) || 248 (Op->Parent->Opcode == AML_CREATE_WORD_FIELD_OP) || 249 (Op->Parent->Opcode == AML_CREATE_DWORD_FIELD_OP) || 250 (Op->Parent->Opcode == AML_CREATE_QWORD_FIELD_OP)) 251 { | 227 Op->Opcode, Op)); 228 return_VALUE (TRUE); 229 } 230 231 break; 232 } 233 234 --- 9 unchanged lines hidden (view full) --- 244 if ((Op->Parent->Opcode == AML_REGION_OP) || 245 (Op->Parent->Opcode == AML_CREATE_FIELD_OP) || 246 (Op->Parent->Opcode == AML_CREATE_BIT_FIELD_OP) || 247 (Op->Parent->Opcode == AML_CREATE_BYTE_FIELD_OP) || 248 (Op->Parent->Opcode == AML_CREATE_WORD_FIELD_OP) || 249 (Op->Parent->Opcode == AML_CREATE_DWORD_FIELD_OP) || 250 (Op->Parent->Opcode == AML_CREATE_QWORD_FIELD_OP)) 251 { |
252 DEBUG_PRINTP (TRACE_DISPATCH, 253 ("Result used, [Region or CreateField] opcode=%X Op=%X\n", | 252 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, 253 "Result used, [Region or CreateField] opcode=%X Op=%X\n", |
254 Op->Opcode, Op)); 255 return_VALUE (TRUE); 256 } 257 | 254 Op->Opcode, Op)); 255 return_VALUE (TRUE); 256 } 257 |
258 DEBUG_PRINTP (TRACE_DISPATCH, 259 ("Result not used, Parent opcode=%X Op=%X\n", Op->Opcode, Op)); | 258 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, 259 "Result not used, Parent opcode=%X Op=%X\n", Op->Opcode, Op)); |
260 261 return_VALUE (FALSE); 262 break; 263 264 /* 265 * In all other cases. the parent will actually use the return 266 * object, so keep it. 267 */ --- 32 unchanged lines hidden (view full) --- 300 ACPI_STATUS Status; 301 302 303 FUNCTION_TRACE_PTR ("DsDeleteResultIfNotUsed", ResultObj); 304 305 306 if (!Op) 307 { | 260 261 return_VALUE (FALSE); 262 break; 263 264 /* 265 * In all other cases. the parent will actually use the return 266 * object, so keep it. 267 */ --- 32 unchanged lines hidden (view full) --- 300 ACPI_STATUS Status; 301 302 303 FUNCTION_TRACE_PTR ("DsDeleteResultIfNotUsed", ResultObj); 304 305 306 if (!Op) 307 { |
308 DEBUG_PRINTP (ACPI_ERROR, ("Null Op\n")); | 308 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Op\n")); |
309 return_VOID; 310 } 311 312 if (!ResultObj) 313 { 314 return_VOID; 315 } 316 317 318 if (!AcpiDsIsResultUsed (Op, WalkState)) 319 { 320 /* | 309 return_VOID; 310 } 311 312 if (!ResultObj) 313 { 314 return_VOID; 315 } 316 317 318 if (!AcpiDsIsResultUsed (Op, WalkState)) 319 { 320 /* |
321 * Must pop the result stack (ObjDesc should be equal 322 * to ResultObj) | 321 * Must pop the result stack (ObjDesc should be equal to ResultObj) |
323 */ | 322 */ |
324 | |
325 Status = AcpiDsResultPop (&ObjDesc, WalkState); 326 if (ACPI_SUCCESS (Status)) 327 { 328 AcpiUtRemoveReference (ResultObj); 329 } 330 } 331 332 return_VOID; --- 36 unchanged lines hidden (view full) --- 369 FUNCTION_TRACE_PTR ("DsCreateOperand", Arg); 370 371 372 /* A valid name must be looked up in the namespace */ 373 374 if ((Arg->Opcode == AML_INT_NAMEPATH_OP) && 375 (Arg->Value.String)) 376 { | 323 Status = AcpiDsResultPop (&ObjDesc, WalkState); 324 if (ACPI_SUCCESS (Status)) 325 { 326 AcpiUtRemoveReference (ResultObj); 327 } 328 } 329 330 return_VOID; --- 36 unchanged lines hidden (view full) --- 367 FUNCTION_TRACE_PTR ("DsCreateOperand", Arg); 368 369 370 /* A valid name must be looked up in the namespace */ 371 372 if ((Arg->Opcode == AML_INT_NAMEPATH_OP) && 373 (Arg->Value.String)) 374 { |
377 DEBUG_PRINTP (TRACE_DISPATCH, ("Getting a name: Arg=%p\n", Arg)); | 375 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Getting a name: Arg=%p\n", Arg)); |
378 379 /* Get the entire name string from the AML stream */ 380 381 Status = AcpiExGetNameString (ACPI_TYPE_ANY, Arg->Value.Buffer, 382 &NameString, &NameLength); 383 384 if (ACPI_FAILURE (Status)) 385 { --- 6 unchanged lines hidden (view full) --- 392 */ 393 394 /* 395 * Differentiate between a namespace "create" operation 396 * versus a "lookup" operation (IMODE_LOAD_PASS2 vs. 397 * IMODE_EXECUTE) in order to support the creation of 398 * namespace objects during the execution of control methods. 399 */ | 376 377 /* Get the entire name string from the AML stream */ 378 379 Status = AcpiExGetNameString (ACPI_TYPE_ANY, Arg->Value.Buffer, 380 &NameString, &NameLength); 381 382 if (ACPI_FAILURE (Status)) 383 { --- 6 unchanged lines hidden (view full) --- 390 */ 391 392 /* 393 * Differentiate between a namespace "create" operation 394 * versus a "lookup" operation (IMODE_LOAD_PASS2 vs. 395 * IMODE_EXECUTE) in order to support the creation of 396 * namespace objects during the execution of control methods. 397 */ |
400 | |
401 ParentOp = Arg->Parent; 402 if ((AcpiPsIsNodeOp (ParentOp->Opcode)) && 403 (ParentOp->Opcode != AML_INT_METHODCALL_OP) && 404 (ParentOp->Opcode != AML_REGION_OP) && 405 (ParentOp->Opcode != AML_INT_NAMEPATH_OP)) 406 { 407 /* Enter name into namespace if not found */ 408 --- 73 unchanged lines hidden (view full) --- 482 /* 483 * If the name is null, this means that this is an 484 * optional result parameter that was not specified 485 * in the original ASL. Create an Reference for a 486 * placeholder 487 */ 488 Opcode = AML_ZERO_OP; /* Has no arguments! */ 489 | 398 ParentOp = Arg->Parent; 399 if ((AcpiPsIsNodeOp (ParentOp->Opcode)) && 400 (ParentOp->Opcode != AML_INT_METHODCALL_OP) && 401 (ParentOp->Opcode != AML_REGION_OP) && 402 (ParentOp->Opcode != AML_INT_NAMEPATH_OP)) 403 { 404 /* Enter name into namespace if not found */ 405 --- 73 unchanged lines hidden (view full) --- 479 /* 480 * If the name is null, this means that this is an 481 * optional result parameter that was not specified 482 * in the original ASL. Create an Reference for a 483 * placeholder 484 */ 485 Opcode = AML_ZERO_OP; /* Has no arguments! */ 486 |
490 DEBUG_PRINTP (TRACE_DISPATCH, ("Null namepath: Arg=%p\n", Arg)); | 487 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Null namepath: Arg=%p\n", Arg)); |
491 492 /* 493 * TBD: [Investigate] anything else needed for the 494 * zero op lvalue? 495 */ 496 } 497 498 else --- 7 unchanged lines hidden (view full) --- 506 DataType = AcpiDsMapOpcodeToDataType (Opcode, &Flags); 507 if (DataType == INTERNAL_TYPE_INVALID) 508 { 509 return_ACPI_STATUS (AE_NOT_IMPLEMENTED); 510 } 511 512 if (Flags & OP_HAS_RETURN_VALUE) 513 { | 488 489 /* 490 * TBD: [Investigate] anything else needed for the 491 * zero op lvalue? 492 */ 493 } 494 495 else --- 7 unchanged lines hidden (view full) --- 503 DataType = AcpiDsMapOpcodeToDataType (Opcode, &Flags); 504 if (DataType == INTERNAL_TYPE_INVALID) 505 { 506 return_ACPI_STATUS (AE_NOT_IMPLEMENTED); 507 } 508 509 if (Flags & OP_HAS_RETURN_VALUE) 510 { |
514 DEBUG_PRINTP (TRACE_DISPATCH, 515 ("Argument previously created, already stacked \n")); | 511 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, 512 "Argument previously created, already stacked \n")); |
516 517 DEBUGGER_EXEC (AcpiDbDisplayArgumentObject (WalkState->Operands [WalkState->NumOperands - 1], WalkState)); 518 519 /* 520 * Use value that was already previously returned 521 * by the evaluation of this argument 522 */ 523 Status = AcpiDsResultPopFromBottom (&ObjDesc, WalkState); 524 if (ACPI_FAILURE (Status)) 525 { 526 /* 527 * Only error is underflow, and this indicates 528 * a missing or null operand! 529 */ | 513 514 DEBUGGER_EXEC (AcpiDbDisplayArgumentObject (WalkState->Operands [WalkState->NumOperands - 1], WalkState)); 515 516 /* 517 * Use value that was already previously returned 518 * by the evaluation of this argument 519 */ 520 Status = AcpiDsResultPopFromBottom (&ObjDesc, WalkState); 521 if (ACPI_FAILURE (Status)) 522 { 523 /* 524 * Only error is underflow, and this indicates 525 * a missing or null operand! 526 */ |
530 DEBUG_PRINTP (ACPI_ERROR, ("Missing or null operand, %s\n", | 527 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Missing or null operand, %s\n", |
531 AcpiFormatException (Status))); 532 return_ACPI_STATUS (Status); 533 } 534 535 } 536 537 else 538 { --- 63 unchanged lines hidden (view full) --- 602 while (Arg) 603 { 604 Status = AcpiDsCreateOperand (WalkState, Arg, ArgCount); 605 if (ACPI_FAILURE (Status)) 606 { 607 goto Cleanup; 608 } 609 | 528 AcpiFormatException (Status))); 529 return_ACPI_STATUS (Status); 530 } 531 532 } 533 534 else 535 { --- 63 unchanged lines hidden (view full) --- 599 while (Arg) 600 { 601 Status = AcpiDsCreateOperand (WalkState, Arg, ArgCount); 602 if (ACPI_FAILURE (Status)) 603 { 604 goto Cleanup; 605 } 606 |
610 DEBUG_PRINTP (TRACE_DISPATCH, ("Arg #%d (%p) done, Arg1=%p\n", | 607 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Arg #%d (%p) done, Arg1=%p\n", |
611 ArgCount, Arg, FirstArg)); 612 613 /* Move on to next argument, if any */ 614 615 Arg = Arg->Next; 616 ArgCount++; 617 } 618 --- 4 unchanged lines hidden (view full) --- 623 /* 624 * We must undo everything done above; meaning that we must 625 * pop everything off of the operand stack and delete those 626 * objects 627 */ 628 629 AcpiDsObjStackPopAndDelete (ArgCount, WalkState); 630 | 608 ArgCount, Arg, FirstArg)); 609 610 /* Move on to next argument, if any */ 611 612 Arg = Arg->Next; 613 ArgCount++; 614 } 615 --- 4 unchanged lines hidden (view full) --- 620 /* 621 * We must undo everything done above; meaning that we must 622 * pop everything off of the operand stack and delete those 623 * objects 624 */ 625 626 AcpiDsObjStackPopAndDelete (ArgCount, WalkState); 627 |
631 DEBUG_PRINTP (ACPI_ERROR, ("While creating Arg %d - %s\n", | 628 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "While creating Arg %d - %s\n", |
632 (ArgCount + 1), AcpiFormatException (Status))); 633 return_ACPI_STATUS (Status); 634} 635 636 637/******************************************************************************* 638 * 639 * FUNCTION: AcpiDsResolveOperands --- 70 unchanged lines hidden (view full) --- 710 PROC_NAME ("DsMapOpcodeToDataType"); 711 712 713 OpInfo = AcpiPsGetOpcodeInfo (Opcode); 714 if (ACPI_GET_OP_TYPE (OpInfo) != ACPI_OP_TYPE_OPCODE) 715 { 716 /* Unknown opcode */ 717 | 629 (ArgCount + 1), AcpiFormatException (Status))); 630 return_ACPI_STATUS (Status); 631} 632 633 634/******************************************************************************* 635 * 636 * FUNCTION: AcpiDsResolveOperands --- 70 unchanged lines hidden (view full) --- 707 PROC_NAME ("DsMapOpcodeToDataType"); 708 709 710 OpInfo = AcpiPsGetOpcodeInfo (Opcode); 711 if (ACPI_GET_OP_TYPE (OpInfo) != ACPI_OP_TYPE_OPCODE) 712 { 713 /* Unknown opcode */ 714 |
718 DEBUG_PRINTP (ACPI_ERROR, ("Unknown AML opcode: %x\n", Opcode)); | 715 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown AML opcode: %x\n", Opcode)); |
719 return (DataType); 720 } 721 722 switch (ACPI_GET_OP_CLASS (OpInfo)) 723 { 724 725 case OPTYPE_LITERAL: 726 727 switch (Opcode) 728 { 729 case AML_BYTE_OP: 730 case AML_WORD_OP: 731 case AML_DWORD_OP: | 716 return (DataType); 717 } 718 719 switch (ACPI_GET_OP_CLASS (OpInfo)) 720 { 721 722 case OPTYPE_LITERAL: 723 724 switch (Opcode) 725 { 726 case AML_BYTE_OP: 727 case AML_WORD_OP: 728 case AML_DWORD_OP: |
729 case AML_QWORD_OP: |
|
732 733 DataType = ACPI_TYPE_INTEGER; 734 break; 735 736 737 case AML_STRING_OP: 738 739 DataType = ACPI_TYPE_STRING; 740 break; 741 742 case AML_INT_NAMEPATH_OP: 743 DataType = INTERNAL_TYPE_REFERENCE; 744 break; 745 746 default: | 730 731 DataType = ACPI_TYPE_INTEGER; 732 break; 733 734 735 case AML_STRING_OP: 736 737 DataType = ACPI_TYPE_STRING; 738 break; 739 740 case AML_INT_NAMEPATH_OP: 741 DataType = INTERNAL_TYPE_REFERENCE; 742 break; 743 744 default: |
747 DEBUG_PRINTP (ACPI_ERROR, 748 ("Unknown (type LITERAL) AML opcode: %x\n", Opcode)); | 745 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 746 "Unknown (type LITERAL) AML opcode: %x\n", Opcode)); |
749 break; 750 } 751 break; 752 753 754 case OPTYPE_DATA_TERM: 755 756 switch (Opcode) --- 5 unchanged lines hidden (view full) --- 762 763 case AML_PACKAGE_OP: 764 case AML_VAR_PACKAGE_OP: 765 766 DataType = ACPI_TYPE_PACKAGE; 767 break; 768 769 default: | 747 break; 748 } 749 break; 750 751 752 case OPTYPE_DATA_TERM: 753 754 switch (Opcode) --- 5 unchanged lines hidden (view full) --- 760 761 case AML_PACKAGE_OP: 762 case AML_VAR_PACKAGE_OP: 763 764 DataType = ACPI_TYPE_PACKAGE; 765 break; 766 767 default: |
770 DEBUG_PRINTP (ACPI_ERROR, 771 ("Unknown (type DATA_TERM) AML opcode: %x\n", Opcode)); | 768 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 769 "Unknown (type DATA_TERM) AML opcode: %x\n", Opcode)); |
772 break; 773 } 774 break; 775 776 777 case OPTYPE_CONSTANT: 778 case OPTYPE_METHOD_ARGUMENT: 779 case OPTYPE_LOCAL_VARIABLE: --- 35 unchanged lines hidden (view full) --- 815 816 /* No mapping needed at this time */ 817 818 break; 819 820 821 default: 822 | 770 break; 771 } 772 break; 773 774 775 case OPTYPE_CONSTANT: 776 case OPTYPE_METHOD_ARGUMENT: 777 case OPTYPE_LOCAL_VARIABLE: --- 35 unchanged lines hidden (view full) --- 813 814 /* No mapping needed at this time */ 815 816 break; 817 818 819 default: 820 |
823 DEBUG_PRINTP (ACPI_ERROR, 824 ("Unimplemented data type opcode: %x\n", Opcode)); | 821 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 822 "Unimplemented data type opcode: %x\n", Opcode)); |
825 break; 826 } 827 828 /* Return flags to caller if requested */ 829 830 if (OutFlags) 831 { 832 *OutFlags = Flags; --- 102 unchanged lines hidden --- | 823 break; 824 } 825 826 /* Return flags to caller if requested */ 827 828 if (OutFlags) 829 { 830 *OutFlags = Flags; --- 102 unchanged lines hidden --- |