Print this page
acpica-unix2-20130823
PANKOVs restructure
   1 
   2 /******************************************************************************
   3  *
   4  * Module Name: exresop - AML Interpreter operand/object resolution
   5  *
   6  *****************************************************************************/
   7 
   8 /*
   9  * Copyright (C) 2000 - 2011, Intel Corp.
  10  * All rights reserved.
  11  *
  12  * Redistribution and use in source and binary forms, with or without
  13  * modification, are permitted provided that the following conditions
  14  * are met:
  15  * 1. Redistributions of source code must retain the above copyright
  16  *    notice, this list of conditions, and the following disclaimer,
  17  *    without modification.
  18  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  19  *    substantially similar to the "NO WARRANTY" disclaimer below
  20  *    ("Disclaimer") and any redistribution must be conditioned upon
  21  *    including a substantially similar Disclaimer requirement for further
  22  *    binary redistribution.
  23  * 3. Neither the names of the above-listed copyright holders nor the names
  24  *    of any contributors may be used to endorse or promote products derived
  25  *    from this software without specific prior written permission.
  26  *
  27  * Alternatively, this software may be distributed under the terms of the
  28  * GNU General Public License ("GPL") version 2 as published by the Free
  29  * Software Foundation.


 208         {
 209         case ACPI_DESC_TYPE_NAMED:
 210 
 211             /* Namespace Node */
 212 
 213             ObjectType = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type;
 214 
 215             /*
 216              * Resolve an alias object. The construction of these objects
 217              * guarantees that there is only one level of alias indirection;
 218              * thus, the attached object is always the aliased namespace node
 219              */
 220             if (ObjectType == ACPI_TYPE_LOCAL_ALIAS)
 221             {
 222                 ObjDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) ObjDesc);
 223                 *StackPtr = ObjDesc;
 224                 ObjectType = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type;
 225             }
 226             break;
 227 
 228 
 229         case ACPI_DESC_TYPE_OPERAND:
 230 
 231             /* ACPI internal object */
 232 
 233             ObjectType = ObjDesc->Common.Type;
 234 
 235             /* Check for bad ACPI_OBJECT_TYPE */
 236 
 237             if (!AcpiUtValidObjectType (ObjectType))
 238             {
 239                 ACPI_ERROR ((AE_INFO,
 240                     "Bad operand object type [0x%X]", ObjectType));
 241 
 242                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
 243             }
 244 
 245             if (ObjectType == (UINT8) ACPI_TYPE_LOCAL_REFERENCE)
 246             {
 247                 /* Validate the Reference */
 248 


 261                 case ACPI_REFCLASS_TABLE:    /* DdbHandle from LOAD_OP or LOAD_TABLE_OP */
 262                 case ACPI_REFCLASS_NAME:     /* Reference to a named object */
 263 
 264                     ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
 265                         "Operand is a Reference, Class [%s] %2.2X\n",
 266                         AcpiUtGetReferenceName (ObjDesc),
 267                         ObjDesc->Reference.Class));
 268                     break;
 269 
 270                 default:
 271 
 272                     ACPI_ERROR ((AE_INFO,
 273                         "Unknown Reference Class 0x%2.2X in %p",
 274                         ObjDesc->Reference.Class, ObjDesc));
 275 
 276                     return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
 277                 }
 278             }
 279             break;
 280 
 281 
 282         default:
 283 
 284             /* Invalid descriptor */
 285 
 286             ACPI_ERROR ((AE_INFO, "Invalid descriptor %p [%s]",
 287                 ObjDesc, AcpiUtGetDescriptorName (ObjDesc)));
 288 
 289             return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
 290         }
 291 
 292         /* Get one argument type, point to the next */
 293 
 294         ThisArgType = GET_CURRENT_ARG_TYPE (ArgTypes);
 295         INCREMENT_ARG_LIST (ArgTypes);
 296 
 297         /*
 298          * Handle cases where the object does not need to be
 299          * resolved to a value
 300          */
 301         switch (ThisArgType)


 308                 /*
 309                  * String found - the string references a named object and
 310                  * must be resolved to a node
 311                  */
 312                 goto NextOperand;
 313             }
 314 
 315             /*
 316              * Else not a string - fall through to the normal Reference
 317              * case below
 318              */
 319             /*lint -fallthrough */
 320 
 321         case ARGI_REFERENCE:            /* References: */
 322         case ARGI_INTEGER_REF:
 323         case ARGI_OBJECT_REF:
 324         case ARGI_DEVICE_REF:
 325         case ARGI_TARGETREF:     /* Allows implicit conversion rules before store */
 326         case ARGI_FIXED_TARGET:  /* No implicit conversion before store to target */
 327         case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion  */
 328 
 329             /*
 330              * Need an operand of type ACPI_TYPE_LOCAL_REFERENCE
 331              * A Namespace Node is OK as-is
 332              */
 333             if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED)
 334             {
 335                 goto NextOperand;
 336             }
 337 
 338             Status = AcpiExCheckObjectType (ACPI_TYPE_LOCAL_REFERENCE,
 339                             ObjectType, ObjDesc);
 340             if (ACPI_FAILURE (Status))
 341             {
 342                 return_ACPI_STATUS (Status);
 343             }
 344             goto NextOperand;
 345 
 346 
 347         case ARGI_DATAREFOBJ:  /* Store operator only */
 348 
 349             /*
 350              * We don't want to resolve IndexOp reference objects during
 351              * a store because this would be an implicit DeRefOf operation.
 352              * Instead, we just want to store the reference object.
 353              * -- All others must be resolved below.
 354              */
 355             if ((Opcode == AML_STORE_OP) &&
 356                 ((*StackPtr)->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
 357                 ((*StackPtr)->Reference.Class == ACPI_REFCLASS_INDEX))
 358             {
 359                 goto NextOperand;
 360             }
 361             break;
 362 
 363         default:

 364             /* All cases covered above */

 365             break;
 366         }
 367 
 368         /*
 369          * Resolve this object to a value
 370          */
 371         Status = AcpiExResolveToValue (StackPtr, WalkState);
 372         if (ACPI_FAILURE (Status))
 373         {
 374             return_ACPI_STATUS (Status);
 375         }
 376 
 377         /* Get the resolved object */
 378 
 379         ObjDesc = *StackPtr;
 380 
 381         /*
 382          * Check the resulting object (value) type
 383          */
 384         switch (ThisArgType)


 437             if (ACPI_FAILURE (Status))
 438             {
 439                 if (Status == AE_TYPE)
 440                 {
 441                     ACPI_ERROR ((AE_INFO,
 442                         "Needed [Integer/String/Buffer], found [%s] %p",
 443                         AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
 444 
 445                     return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
 446                 }
 447 
 448                 return_ACPI_STATUS (Status);
 449             }
 450 
 451             if (ObjDesc != *StackPtr)
 452             {
 453                 AcpiUtRemoveReference (ObjDesc);
 454             }
 455             goto NextOperand;
 456 
 457 
 458         case ARGI_BUFFER:
 459 
 460             /*
 461              * Need an operand of type ACPI_TYPE_BUFFER,
 462              * But we can implicitly convert from a STRING or INTEGER
 463              * Aka - "Implicit Source Operand Conversion"
 464              */
 465             Status = AcpiExConvertToBuffer (ObjDesc, StackPtr);
 466             if (ACPI_FAILURE (Status))
 467             {
 468                 if (Status == AE_TYPE)
 469                 {
 470                     ACPI_ERROR ((AE_INFO,
 471                         "Needed [Integer/String/Buffer], found [%s] %p",
 472                         AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
 473 
 474                     return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
 475                 }
 476 
 477                 return_ACPI_STATUS (Status);
 478             }
 479 
 480             if (ObjDesc != *StackPtr)
 481             {
 482                 AcpiUtRemoveReference (ObjDesc);
 483             }
 484             goto NextOperand;
 485 
 486 
 487         case ARGI_STRING:
 488 
 489             /*
 490              * Need an operand of type ACPI_TYPE_STRING,
 491              * But we can implicitly convert from a BUFFER or INTEGER
 492              * Aka - "Implicit Source Operand Conversion"
 493              */
 494             Status = AcpiExConvertToString (ObjDesc, StackPtr,
 495                         ACPI_IMPLICIT_CONVERT_HEX);
 496             if (ACPI_FAILURE (Status))
 497             {
 498                 if (Status == AE_TYPE)
 499                 {
 500                     ACPI_ERROR ((AE_INFO,
 501                         "Needed [Integer/String/Buffer], found [%s] %p",
 502                         AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
 503 
 504                     return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
 505                 }
 506 
 507                 return_ACPI_STATUS (Status);
 508             }
 509 
 510             if (ObjDesc != *StackPtr)
 511             {
 512                 AcpiUtRemoveReference (ObjDesc);
 513             }
 514             goto NextOperand;
 515 
 516 
 517         case ARGI_COMPUTEDATA:
 518 
 519             /* Need an operand of type INTEGER, STRING or BUFFER */
 520 
 521             switch (ObjDesc->Common.Type)
 522             {
 523             case ACPI_TYPE_INTEGER:
 524             case ACPI_TYPE_STRING:
 525             case ACPI_TYPE_BUFFER:
 526 
 527                 /* Valid operand */
 528                break;
 529 
 530             default:
 531                 ACPI_ERROR ((AE_INFO,
 532                     "Needed [Integer/String/Buffer], found [%s] %p",
 533                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
 534 
 535                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
 536             }
 537             goto NextOperand;
 538 
 539 
 540         case ARGI_BUFFER_OR_STRING:
 541 
 542             /* Need an operand of type STRING or BUFFER */
 543 
 544             switch (ObjDesc->Common.Type)
 545             {
 546             case ACPI_TYPE_STRING:
 547             case ACPI_TYPE_BUFFER:
 548 
 549                 /* Valid operand */
 550                break;
 551 
 552             case ACPI_TYPE_INTEGER:
 553 
 554                 /* Highest priority conversion is to type Buffer */
 555 
 556                 Status = AcpiExConvertToBuffer (ObjDesc, StackPtr);
 557                 if (ACPI_FAILURE (Status))
 558                 {
 559                     return_ACPI_STATUS (Status);
 560                 }
 561 
 562                 if (ObjDesc != *StackPtr)
 563                 {
 564                     AcpiUtRemoveReference (ObjDesc);
 565                 }
 566                 break;
 567 
 568             default:
 569                 ACPI_ERROR ((AE_INFO,
 570                     "Needed [Integer/String/Buffer], found [%s] %p",
 571                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
 572 
 573                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
 574             }
 575             goto NextOperand;
 576 
 577 
 578         case ARGI_DATAOBJECT:
 579             /*
 580              * ARGI_DATAOBJECT is only used by the SizeOf operator.
 581              * Need a buffer, string, package, or RefOf reference.
 582              *
 583              * The only reference allowed here is a direct reference to
 584              * a namespace node.
 585              */
 586             switch (ObjDesc->Common.Type)
 587             {
 588             case ACPI_TYPE_PACKAGE:
 589             case ACPI_TYPE_STRING:
 590             case ACPI_TYPE_BUFFER:
 591             case ACPI_TYPE_LOCAL_REFERENCE:
 592 
 593                 /* Valid operand */
 594                 break;
 595 
 596             default:

 597                 ACPI_ERROR ((AE_INFO,
 598                     "Needed [Buffer/String/Package/Reference], found [%s] %p",
 599                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
 600 
 601                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
 602             }
 603             goto NextOperand;
 604 
 605 
 606         case ARGI_COMPLEXOBJ:
 607 
 608             /* Need a buffer or package or (ACPI 2.0) String */
 609 
 610             switch (ObjDesc->Common.Type)
 611             {
 612             case ACPI_TYPE_PACKAGE:
 613             case ACPI_TYPE_STRING:
 614             case ACPI_TYPE_BUFFER:
 615 
 616                 /* Valid operand */
 617                 break;
 618 
 619             default:

 620                 ACPI_ERROR ((AE_INFO,
 621                     "Needed [Buffer/String/Package], found [%s] %p",
 622                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
 623 
 624                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
 625             }
 626             goto NextOperand;
 627 
 628 
 629         case ARGI_REGION_OR_BUFFER: /* Used by Load() only */
 630 
 631             /* Need an operand of type REGION or a BUFFER (which could be a resolved region field) */
 632 
 633             switch (ObjDesc->Common.Type)
 634             {
 635             case ACPI_TYPE_BUFFER:
 636             case ACPI_TYPE_REGION:
 637 
 638                 /* Valid operand */
 639                 break;
 640 
 641             default:

 642                 ACPI_ERROR ((AE_INFO,
 643                     "Needed [Region/Buffer], found [%s] %p",
 644                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
 645 
 646                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
 647             }
 648             goto NextOperand;
 649 
 650 
 651         case ARGI_DATAREFOBJ:
 652 
 653             /* Used by the Store() operator only */
 654 
 655             switch (ObjDesc->Common.Type)
 656             {
 657             case ACPI_TYPE_INTEGER:
 658             case ACPI_TYPE_PACKAGE:
 659             case ACPI_TYPE_STRING:
 660             case ACPI_TYPE_BUFFER:
 661             case ACPI_TYPE_BUFFER_FIELD:
 662             case ACPI_TYPE_LOCAL_REFERENCE:
 663             case ACPI_TYPE_LOCAL_REGION_FIELD:
 664             case ACPI_TYPE_LOCAL_BANK_FIELD:
 665             case ACPI_TYPE_LOCAL_INDEX_FIELD:
 666             case ACPI_TYPE_DDB_HANDLE:
 667 
 668                 /* Valid operand */
 669                 break;
 670 


 678                      * allow this, however.
 679                      */
 680                     break;
 681                 }
 682 
 683                 if (TargetOp == AML_DEBUG_OP)
 684                 {
 685                     /* Allow store of any object to the Debug object */
 686 
 687                     break;
 688                 }
 689 
 690                 ACPI_ERROR ((AE_INFO,
 691                     "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p",
 692                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
 693 
 694                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
 695             }
 696             goto NextOperand;
 697 
 698 
 699         default:
 700 
 701             /* Unknown type */
 702 
 703             ACPI_ERROR ((AE_INFO,
 704                 "Internal - Unknown ARGI (required operand) type 0x%X",
 705                 ThisArgType));
 706 
 707             return_ACPI_STATUS (AE_BAD_PARAMETER);
 708         }
 709 
 710         /*
 711          * Make sure that the original object was resolved to the
 712          * required object type (Simple cases only).
 713          */
 714         Status = AcpiExCheckObjectType (TypeNeeded,
 715                         (*StackPtr)->Common.Type, *StackPtr);
 716         if (ACPI_FAILURE (Status))
 717         {
 718             return_ACPI_STATUS (Status);
 719         }
 720 
 721 NextOperand:
 722         /*
 723          * If more operands needed, decrement StackPtr to point
 724          * to next operand on stack
 725          */
 726         if (GET_CURRENT_ARG_TYPE (ArgTypes))
 727         {
 728             StackPtr--;
 729         }
 730     }
 731 
 732     ACPI_DUMP_OPERANDS (WalkState->Operands,
 733         AcpiPsGetOpcodeName (Opcode), WalkState->NumOperands);
 734 
 735     return_ACPI_STATUS (Status);
 736 }
 737 
 738 

   1 /******************************************************************************
   2  *
   3  * Module Name: exresop - AML Interpreter operand/object resolution
   4  *
   5  *****************************************************************************/
   6 
   7 /*
   8  * Copyright (C) 2000 - 2013, 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.


 207         {
 208         case ACPI_DESC_TYPE_NAMED:
 209 
 210             /* Namespace Node */
 211 
 212             ObjectType = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type;
 213 
 214             /*
 215              * Resolve an alias object. The construction of these objects
 216              * guarantees that there is only one level of alias indirection;
 217              * thus, the attached object is always the aliased namespace node
 218              */
 219             if (ObjectType == ACPI_TYPE_LOCAL_ALIAS)
 220             {
 221                 ObjDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) ObjDesc);
 222                 *StackPtr = ObjDesc;
 223                 ObjectType = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type;
 224             }
 225             break;
 226 

 227         case ACPI_DESC_TYPE_OPERAND:
 228 
 229             /* ACPI internal object */
 230 
 231             ObjectType = ObjDesc->Common.Type;
 232 
 233             /* Check for bad ACPI_OBJECT_TYPE */
 234 
 235             if (!AcpiUtValidObjectType (ObjectType))
 236             {
 237                 ACPI_ERROR ((AE_INFO,
 238                     "Bad operand object type [0x%X]", ObjectType));
 239 
 240                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
 241             }
 242 
 243             if (ObjectType == (UINT8) ACPI_TYPE_LOCAL_REFERENCE)
 244             {
 245                 /* Validate the Reference */
 246 


 259                 case ACPI_REFCLASS_TABLE:    /* DdbHandle from LOAD_OP or LOAD_TABLE_OP */
 260                 case ACPI_REFCLASS_NAME:     /* Reference to a named object */
 261 
 262                     ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
 263                         "Operand is a Reference, Class [%s] %2.2X\n",
 264                         AcpiUtGetReferenceName (ObjDesc),
 265                         ObjDesc->Reference.Class));
 266                     break;
 267 
 268                 default:
 269 
 270                     ACPI_ERROR ((AE_INFO,
 271                         "Unknown Reference Class 0x%2.2X in %p",
 272                         ObjDesc->Reference.Class, ObjDesc));
 273 
 274                     return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
 275                 }
 276             }
 277             break;
 278 

 279         default:
 280 
 281             /* Invalid descriptor */
 282 
 283             ACPI_ERROR ((AE_INFO, "Invalid descriptor %p [%s]",
 284                 ObjDesc, AcpiUtGetDescriptorName (ObjDesc)));
 285 
 286             return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
 287         }
 288 
 289         /* Get one argument type, point to the next */
 290 
 291         ThisArgType = GET_CURRENT_ARG_TYPE (ArgTypes);
 292         INCREMENT_ARG_LIST (ArgTypes);
 293 
 294         /*
 295          * Handle cases where the object does not need to be
 296          * resolved to a value
 297          */
 298         switch (ThisArgType)


 305                 /*
 306                  * String found - the string references a named object and
 307                  * must be resolved to a node
 308                  */
 309                 goto NextOperand;
 310             }
 311 
 312             /*
 313              * Else not a string - fall through to the normal Reference
 314              * case below
 315              */
 316             /*lint -fallthrough */
 317 
 318         case ARGI_REFERENCE:            /* References: */
 319         case ARGI_INTEGER_REF:
 320         case ARGI_OBJECT_REF:
 321         case ARGI_DEVICE_REF:
 322         case ARGI_TARGETREF:     /* Allows implicit conversion rules before store */
 323         case ARGI_FIXED_TARGET:  /* No implicit conversion before store to target */
 324         case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion  */

 325             /*
 326              * Need an operand of type ACPI_TYPE_LOCAL_REFERENCE
 327              * A Namespace Node is OK as-is
 328              */
 329             if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED)
 330             {
 331                 goto NextOperand;
 332             }
 333 
 334             Status = AcpiExCheckObjectType (ACPI_TYPE_LOCAL_REFERENCE,
 335                             ObjectType, ObjDesc);
 336             if (ACPI_FAILURE (Status))
 337             {
 338                 return_ACPI_STATUS (Status);
 339             }
 340             goto NextOperand;
 341 

 342         case ARGI_DATAREFOBJ:  /* Store operator only */

 343             /*
 344              * We don't want to resolve IndexOp reference objects during
 345              * a store because this would be an implicit DeRefOf operation.
 346              * Instead, we just want to store the reference object.
 347              * -- All others must be resolved below.
 348              */
 349             if ((Opcode == AML_STORE_OP) &&
 350                 ((*StackPtr)->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
 351                 ((*StackPtr)->Reference.Class == ACPI_REFCLASS_INDEX))
 352             {
 353                 goto NextOperand;
 354             }
 355             break;
 356 
 357         default:
 358 
 359             /* All cases covered above */
 360 
 361             break;
 362         }
 363 
 364         /*
 365          * Resolve this object to a value
 366          */
 367         Status = AcpiExResolveToValue (StackPtr, WalkState);
 368         if (ACPI_FAILURE (Status))
 369         {
 370             return_ACPI_STATUS (Status);
 371         }
 372 
 373         /* Get the resolved object */
 374 
 375         ObjDesc = *StackPtr;
 376 
 377         /*
 378          * Check the resulting object (value) type
 379          */
 380         switch (ThisArgType)


 433             if (ACPI_FAILURE (Status))
 434             {
 435                 if (Status == AE_TYPE)
 436                 {
 437                     ACPI_ERROR ((AE_INFO,
 438                         "Needed [Integer/String/Buffer], found [%s] %p",
 439                         AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
 440 
 441                     return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
 442                 }
 443 
 444                 return_ACPI_STATUS (Status);
 445             }
 446 
 447             if (ObjDesc != *StackPtr)
 448             {
 449                 AcpiUtRemoveReference (ObjDesc);
 450             }
 451             goto NextOperand;
 452 

 453         case ARGI_BUFFER:

 454             /*
 455              * Need an operand of type ACPI_TYPE_BUFFER,
 456              * But we can implicitly convert from a STRING or INTEGER
 457              * Aka - "Implicit Source Operand Conversion"
 458              */
 459             Status = AcpiExConvertToBuffer (ObjDesc, StackPtr);
 460             if (ACPI_FAILURE (Status))
 461             {
 462                 if (Status == AE_TYPE)
 463                 {
 464                     ACPI_ERROR ((AE_INFO,
 465                         "Needed [Integer/String/Buffer], found [%s] %p",
 466                         AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
 467 
 468                     return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
 469                 }
 470 
 471                 return_ACPI_STATUS (Status);
 472             }
 473 
 474             if (ObjDesc != *StackPtr)
 475             {
 476                 AcpiUtRemoveReference (ObjDesc);
 477             }
 478             goto NextOperand;
 479 

 480         case ARGI_STRING:

 481             /*
 482              * Need an operand of type ACPI_TYPE_STRING,
 483              * But we can implicitly convert from a BUFFER or INTEGER
 484              * Aka - "Implicit Source Operand Conversion"
 485              */
 486             Status = AcpiExConvertToString (ObjDesc, StackPtr,
 487                         ACPI_IMPLICIT_CONVERT_HEX);
 488             if (ACPI_FAILURE (Status))
 489             {
 490                 if (Status == AE_TYPE)
 491                 {
 492                     ACPI_ERROR ((AE_INFO,
 493                         "Needed [Integer/String/Buffer], found [%s] %p",
 494                         AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
 495 
 496                     return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
 497                 }
 498 
 499                 return_ACPI_STATUS (Status);
 500             }
 501 
 502             if (ObjDesc != *StackPtr)
 503             {
 504                 AcpiUtRemoveReference (ObjDesc);
 505             }
 506             goto NextOperand;
 507 

 508         case ARGI_COMPUTEDATA:
 509 
 510             /* Need an operand of type INTEGER, STRING or BUFFER */
 511 
 512             switch (ObjDesc->Common.Type)
 513             {
 514             case ACPI_TYPE_INTEGER:
 515             case ACPI_TYPE_STRING:
 516             case ACPI_TYPE_BUFFER:
 517 
 518                 /* Valid operand */
 519                break;
 520 
 521             default:
 522                 ACPI_ERROR ((AE_INFO,
 523                     "Needed [Integer/String/Buffer], found [%s] %p",
 524                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
 525 
 526                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
 527             }
 528             goto NextOperand;
 529 

 530         case ARGI_BUFFER_OR_STRING:
 531 
 532             /* Need an operand of type STRING or BUFFER */
 533 
 534             switch (ObjDesc->Common.Type)
 535             {
 536             case ACPI_TYPE_STRING:
 537             case ACPI_TYPE_BUFFER:
 538 
 539                 /* Valid operand */
 540                break;
 541 
 542             case ACPI_TYPE_INTEGER:
 543 
 544                 /* Highest priority conversion is to type Buffer */
 545 
 546                 Status = AcpiExConvertToBuffer (ObjDesc, StackPtr);
 547                 if (ACPI_FAILURE (Status))
 548                 {
 549                     return_ACPI_STATUS (Status);
 550                 }
 551 
 552                 if (ObjDesc != *StackPtr)
 553                 {
 554                     AcpiUtRemoveReference (ObjDesc);
 555                 }
 556                 break;
 557 
 558             default:
 559                 ACPI_ERROR ((AE_INFO,
 560                     "Needed [Integer/String/Buffer], found [%s] %p",
 561                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
 562 
 563                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
 564             }
 565             goto NextOperand;
 566 

 567         case ARGI_DATAOBJECT:
 568             /*
 569              * ARGI_DATAOBJECT is only used by the SizeOf operator.
 570              * Need a buffer, string, package, or RefOf reference.
 571              *
 572              * The only reference allowed here is a direct reference to
 573              * a namespace node.
 574              */
 575             switch (ObjDesc->Common.Type)
 576             {
 577             case ACPI_TYPE_PACKAGE:
 578             case ACPI_TYPE_STRING:
 579             case ACPI_TYPE_BUFFER:
 580             case ACPI_TYPE_LOCAL_REFERENCE:
 581 
 582                 /* Valid operand */
 583                 break;
 584 
 585             default:
 586 
 587                 ACPI_ERROR ((AE_INFO,
 588                     "Needed [Buffer/String/Package/Reference], found [%s] %p",
 589                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
 590 
 591                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
 592             }
 593             goto NextOperand;
 594 

 595         case ARGI_COMPLEXOBJ:
 596 
 597             /* Need a buffer or package or (ACPI 2.0) String */
 598 
 599             switch (ObjDesc->Common.Type)
 600             {
 601             case ACPI_TYPE_PACKAGE:
 602             case ACPI_TYPE_STRING:
 603             case ACPI_TYPE_BUFFER:
 604 
 605                 /* Valid operand */
 606                 break;
 607 
 608             default:
 609 
 610                 ACPI_ERROR ((AE_INFO,
 611                     "Needed [Buffer/String/Package], found [%s] %p",
 612                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
 613 
 614                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
 615             }
 616             goto NextOperand;
 617 

 618         case ARGI_REGION_OR_BUFFER: /* Used by Load() only */
 619 
 620             /* Need an operand of type REGION or a BUFFER (which could be a resolved region field) */
 621 
 622             switch (ObjDesc->Common.Type)
 623             {
 624             case ACPI_TYPE_BUFFER:
 625             case ACPI_TYPE_REGION:
 626 
 627                 /* Valid operand */
 628                 break;
 629 
 630             default:
 631 
 632                 ACPI_ERROR ((AE_INFO,
 633                     "Needed [Region/Buffer], found [%s] %p",
 634                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
 635 
 636                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
 637             }
 638             goto NextOperand;
 639 

 640         case ARGI_DATAREFOBJ:
 641 
 642             /* Used by the Store() operator only */
 643 
 644             switch (ObjDesc->Common.Type)
 645             {
 646             case ACPI_TYPE_INTEGER:
 647             case ACPI_TYPE_PACKAGE:
 648             case ACPI_TYPE_STRING:
 649             case ACPI_TYPE_BUFFER:
 650             case ACPI_TYPE_BUFFER_FIELD:
 651             case ACPI_TYPE_LOCAL_REFERENCE:
 652             case ACPI_TYPE_LOCAL_REGION_FIELD:
 653             case ACPI_TYPE_LOCAL_BANK_FIELD:
 654             case ACPI_TYPE_LOCAL_INDEX_FIELD:
 655             case ACPI_TYPE_DDB_HANDLE:
 656 
 657                 /* Valid operand */
 658                 break;
 659 


 667                      * allow this, however.
 668                      */
 669                     break;
 670                 }
 671 
 672                 if (TargetOp == AML_DEBUG_OP)
 673                 {
 674                     /* Allow store of any object to the Debug object */
 675 
 676                     break;
 677                 }
 678 
 679                 ACPI_ERROR ((AE_INFO,
 680                     "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p",
 681                     AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
 682 
 683                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
 684             }
 685             goto NextOperand;
 686 

 687         default:
 688 
 689             /* Unknown type */
 690 
 691             ACPI_ERROR ((AE_INFO,
 692                 "Internal - Unknown ARGI (required operand) type 0x%X",
 693                 ThisArgType));
 694 
 695             return_ACPI_STATUS (AE_BAD_PARAMETER);
 696         }
 697 
 698         /*
 699          * Make sure that the original object was resolved to the
 700          * required object type (Simple cases only).
 701          */
 702         Status = AcpiExCheckObjectType (TypeNeeded,
 703                         (*StackPtr)->Common.Type, *StackPtr);
 704         if (ACPI_FAILURE (Status))
 705         {
 706             return_ACPI_STATUS (Status);
 707         }
 708 
 709 NextOperand:
 710         /*
 711          * If more operands needed, decrement StackPtr to point
 712          * to next operand on stack
 713          */
 714         if (GET_CURRENT_ARG_TYPE (ArgTypes))
 715         {
 716             StackPtr--;
 717         }
 718     }
 719 
 720     ACPI_DUMP_OPERANDS (WalkState->Operands,
 721         AcpiPsGetOpcodeName (Opcode), WalkState->NumOperands);
 722 
 723     return_ACPI_STATUS (Status);
 724 }