Print this page
update to acpica-unix2-20140114
acpica-unix2-20130823
PANKOVs restructure

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/intel/io/acpica/executer/exresop.c
          +++ new/usr/src/common/acpica/components/executer/exresop.c
   1      -
   2    1  /******************************************************************************
   3    2   *
   4    3   * Module Name: exresop - AML Interpreter operand/object resolution
   5    4   *
   6    5   *****************************************************************************/
   7    6  
   8    7  /*
   9      - * Copyright (C) 2000 - 2011, Intel Corp.
        8 + * Copyright (C) 2000 - 2014, Intel Corp.
  10    9   * All rights reserved.
  11   10   *
  12   11   * Redistribution and use in source and binary forms, with or without
  13   12   * modification, are permitted provided that the following conditions
  14   13   * are met:
  15   14   * 1. Redistributions of source code must retain the above copyright
  16   15   *    notice, this list of conditions, and the following disclaimer,
  17   16   *    without modification.
  18   17   * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  19   18   *    substantially similar to the "NO WARRANTY" disclaimer below
↓ open down ↓ 71 lines elided ↑ open up ↑
  91   90      {
  92   91          /* All types OK, so we don't perform any typechecks */
  93   92  
  94   93          return (AE_OK);
  95   94      }
  96   95  
  97   96      if (TypeNeeded == ACPI_TYPE_LOCAL_REFERENCE)
  98   97      {
  99   98          /*
 100   99           * Allow the AML "Constant" opcodes (Zero, One, etc.) to be reference
 101      -         * objects and thus allow them to be targets.  (As per the ACPI
      100 +         * objects and thus allow them to be targets. (As per the ACPI
 102  101           * specification, a store to a constant is a noop.)
 103  102           */
 104  103          if ((ThisType == ACPI_TYPE_INTEGER) &&
 105  104              (((ACPI_OPERAND_OBJECT *) Object)->Common.Flags & AOPOBJ_AML_CONSTANT))
 106  105          {
 107  106              return (AE_OK);
 108  107          }
 109  108      }
 110  109  
 111  110      if (TypeNeeded != ThisType)
↓ open down ↓ 106 lines elided ↑ open up ↑
 218  217               * thus, the attached object is always the aliased namespace node
 219  218               */
 220  219              if (ObjectType == ACPI_TYPE_LOCAL_ALIAS)
 221  220              {
 222  221                  ObjDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) ObjDesc);
 223  222                  *StackPtr = ObjDesc;
 224  223                  ObjectType = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type;
 225  224              }
 226  225              break;
 227  226  
 228      -
 229  227          case ACPI_DESC_TYPE_OPERAND:
 230  228  
 231  229              /* ACPI internal object */
 232  230  
 233  231              ObjectType = ObjDesc->Common.Type;
 234  232  
 235  233              /* Check for bad ACPI_OBJECT_TYPE */
 236  234  
 237  235              if (!AcpiUtValidObjectType (ObjectType))
 238  236              {
↓ open down ↓ 32 lines elided ↑ open up ↑
 271  269  
 272  270                      ACPI_ERROR ((AE_INFO,
 273  271                          "Unknown Reference Class 0x%2.2X in %p",
 274  272                          ObjDesc->Reference.Class, ObjDesc));
 275  273  
 276  274                      return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
 277  275                  }
 278  276              }
 279  277              break;
 280  278  
 281      -
 282  279          default:
 283  280  
 284  281              /* Invalid descriptor */
 285  282  
 286  283              ACPI_ERROR ((AE_INFO, "Invalid descriptor %p [%s]",
 287  284                  ObjDesc, AcpiUtGetDescriptorName (ObjDesc)));
 288  285  
 289  286              return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
 290  287          }
 291  288  
↓ open down ↓ 26 lines elided ↑ open up ↑
 318  315               */
 319  316              /*lint -fallthrough */
 320  317  
 321  318          case ARGI_REFERENCE:            /* References: */
 322  319          case ARGI_INTEGER_REF:
 323  320          case ARGI_OBJECT_REF:
 324  321          case ARGI_DEVICE_REF:
 325  322          case ARGI_TARGETREF:     /* Allows implicit conversion rules before store */
 326  323          case ARGI_FIXED_TARGET:  /* No implicit conversion before store to target */
 327  324          case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion  */
 328      -
 329  325              /*
 330  326               * Need an operand of type ACPI_TYPE_LOCAL_REFERENCE
 331  327               * A Namespace Node is OK as-is
 332  328               */
 333  329              if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED)
 334  330              {
 335  331                  goto NextOperand;
 336  332              }
 337  333  
 338  334              Status = AcpiExCheckObjectType (ACPI_TYPE_LOCAL_REFERENCE,
 339  335                              ObjectType, ObjDesc);
 340  336              if (ACPI_FAILURE (Status))
 341  337              {
 342  338                  return_ACPI_STATUS (Status);
 343  339              }
 344  340              goto NextOperand;
 345  341  
 346      -
 347  342          case ARGI_DATAREFOBJ:  /* Store operator only */
 348      -
 349  343              /*
 350  344               * We don't want to resolve IndexOp reference objects during
 351  345               * a store because this would be an implicit DeRefOf operation.
 352  346               * Instead, we just want to store the reference object.
 353  347               * -- All others must be resolved below.
 354  348               */
 355  349              if ((Opcode == AML_STORE_OP) &&
 356  350                  ((*StackPtr)->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
 357  351                  ((*StackPtr)->Reference.Class == ACPI_REFCLASS_INDEX))
 358  352              {
 359  353                  goto NextOperand;
 360  354              }
 361  355              break;
 362  356  
 363  357          default:
      358 +
 364  359              /* All cases covered above */
      360 +
 365  361              break;
 366  362          }
 367  363  
 368  364          /*
 369  365           * Resolve this object to a value
 370  366           */
 371  367          Status = AcpiExResolveToValue (StackPtr, WalkState);
 372  368          if (ACPI_FAILURE (Status))
 373  369          {
 374  370              return_ACPI_STATUS (Status);
↓ open down ↓ 72 lines elided ↑ open up ↑
 447  443  
 448  444                  return_ACPI_STATUS (Status);
 449  445              }
 450  446  
 451  447              if (ObjDesc != *StackPtr)
 452  448              {
 453  449                  AcpiUtRemoveReference (ObjDesc);
 454  450              }
 455  451              goto NextOperand;
 456  452  
 457      -
 458  453          case ARGI_BUFFER:
 459      -
 460  454              /*
 461  455               * Need an operand of type ACPI_TYPE_BUFFER,
 462  456               * But we can implicitly convert from a STRING or INTEGER
 463  457               * Aka - "Implicit Source Operand Conversion"
 464  458               */
 465  459              Status = AcpiExConvertToBuffer (ObjDesc, StackPtr);
 466  460              if (ACPI_FAILURE (Status))
 467  461              {
 468  462                  if (Status == AE_TYPE)
 469  463                  {
↓ open down ↓ 6 lines elided ↑ open up ↑
 476  470  
 477  471                  return_ACPI_STATUS (Status);
 478  472              }
 479  473  
 480  474              if (ObjDesc != *StackPtr)
 481  475              {
 482  476                  AcpiUtRemoveReference (ObjDesc);
 483  477              }
 484  478              goto NextOperand;
 485  479  
 486      -
 487  480          case ARGI_STRING:
 488      -
 489  481              /*
 490  482               * Need an operand of type ACPI_TYPE_STRING,
 491  483               * But we can implicitly convert from a BUFFER or INTEGER
 492  484               * Aka - "Implicit Source Operand Conversion"
 493  485               */
 494  486              Status = AcpiExConvertToString (ObjDesc, StackPtr,
 495  487                          ACPI_IMPLICIT_CONVERT_HEX);
 496  488              if (ACPI_FAILURE (Status))
 497  489              {
 498  490                  if (Status == AE_TYPE)
↓ open down ↓ 7 lines elided ↑ open up ↑
 506  498  
 507  499                  return_ACPI_STATUS (Status);
 508  500              }
 509  501  
 510  502              if (ObjDesc != *StackPtr)
 511  503              {
 512  504                  AcpiUtRemoveReference (ObjDesc);
 513  505              }
 514  506              goto NextOperand;
 515  507  
 516      -
 517  508          case ARGI_COMPUTEDATA:
 518  509  
 519  510              /* Need an operand of type INTEGER, STRING or BUFFER */
 520  511  
 521  512              switch (ObjDesc->Common.Type)
 522  513              {
 523  514              case ACPI_TYPE_INTEGER:
 524  515              case ACPI_TYPE_STRING:
 525  516              case ACPI_TYPE_BUFFER:
 526  517  
↓ open down ↓ 2 lines elided ↑ open up ↑
 529  520  
 530  521              default:
 531  522                  ACPI_ERROR ((AE_INFO,
 532  523                      "Needed [Integer/String/Buffer], found [%s] %p",
 533  524                      AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
 534  525  
 535  526                  return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
 536  527              }
 537  528              goto NextOperand;
 538  529  
 539      -
 540  530          case ARGI_BUFFER_OR_STRING:
 541  531  
 542  532              /* Need an operand of type STRING or BUFFER */
 543  533  
 544  534              switch (ObjDesc->Common.Type)
 545  535              {
 546  536              case ACPI_TYPE_STRING:
 547  537              case ACPI_TYPE_BUFFER:
 548  538  
 549  539                  /* Valid operand */
↓ open down ↓ 17 lines elided ↑ open up ↑
 567  557  
 568  558              default:
 569  559                  ACPI_ERROR ((AE_INFO,
 570  560                      "Needed [Integer/String/Buffer], found [%s] %p",
 571  561                      AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
 572  562  
 573  563                  return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
 574  564              }
 575  565              goto NextOperand;
 576  566  
 577      -
 578  567          case ARGI_DATAOBJECT:
 579  568              /*
 580  569               * ARGI_DATAOBJECT is only used by the SizeOf operator.
 581  570               * Need a buffer, string, package, or RefOf reference.
 582  571               *
 583  572               * The only reference allowed here is a direct reference to
 584  573               * a namespace node.
 585  574               */
 586  575              switch (ObjDesc->Common.Type)
 587  576              {
 588  577              case ACPI_TYPE_PACKAGE:
 589  578              case ACPI_TYPE_STRING:
 590  579              case ACPI_TYPE_BUFFER:
 591  580              case ACPI_TYPE_LOCAL_REFERENCE:
 592  581  
 593  582                  /* Valid operand */
 594  583                  break;
 595  584  
 596  585              default:
      586 +
 597  587                  ACPI_ERROR ((AE_INFO,
 598  588                      "Needed [Buffer/String/Package/Reference], found [%s] %p",
 599  589                      AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
 600  590  
 601  591                  return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
 602  592              }
 603  593              goto NextOperand;
 604  594  
 605      -
 606  595          case ARGI_COMPLEXOBJ:
 607  596  
 608  597              /* Need a buffer or package or (ACPI 2.0) String */
 609  598  
 610  599              switch (ObjDesc->Common.Type)
 611  600              {
 612  601              case ACPI_TYPE_PACKAGE:
 613  602              case ACPI_TYPE_STRING:
 614  603              case ACPI_TYPE_BUFFER:
 615  604  
 616  605                  /* Valid operand */
 617  606                  break;
 618  607  
 619  608              default:
      609 +
 620  610                  ACPI_ERROR ((AE_INFO,
 621  611                      "Needed [Buffer/String/Package], found [%s] %p",
 622  612                      AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
 623  613  
 624  614                  return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
 625  615              }
 626  616              goto NextOperand;
 627  617  
 628      -
 629  618          case ARGI_REGION_OR_BUFFER: /* Used by Load() only */
 630  619  
 631  620              /* Need an operand of type REGION or a BUFFER (which could be a resolved region field) */
 632  621  
 633  622              switch (ObjDesc->Common.Type)
 634  623              {
 635  624              case ACPI_TYPE_BUFFER:
 636  625              case ACPI_TYPE_REGION:
 637  626  
 638  627                  /* Valid operand */
 639  628                  break;
 640  629  
 641  630              default:
      631 +
 642  632                  ACPI_ERROR ((AE_INFO,
 643  633                      "Needed [Region/Buffer], found [%s] %p",
 644  634                      AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
 645  635  
 646  636                  return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
 647  637              }
 648  638              goto NextOperand;
 649  639  
 650      -
 651  640          case ARGI_DATAREFOBJ:
 652  641  
 653  642              /* Used by the Store() operator only */
 654  643  
 655  644              switch (ObjDesc->Common.Type)
 656  645              {
 657  646              case ACPI_TYPE_INTEGER:
 658  647              case ACPI_TYPE_PACKAGE:
 659  648              case ACPI_TYPE_STRING:
 660  649              case ACPI_TYPE_BUFFER:
↓ open down ↓ 6 lines elided ↑ open up ↑
 667  656  
 668  657                  /* Valid operand */
 669  658                  break;
 670  659  
 671  660              default:
 672  661  
 673  662                  if (AcpiGbl_EnableInterpreterSlack)
 674  663                  {
 675  664                      /*
 676  665                       * Enable original behavior of Store(), allowing any and all
 677      -                     * objects as the source operand.  The ACPI spec does not
      666 +                     * objects as the source operand. The ACPI spec does not
 678  667                       * allow this, however.
 679  668                       */
 680  669                      break;
 681  670                  }
 682  671  
 683  672                  if (TargetOp == AML_DEBUG_OP)
 684  673                  {
 685  674                      /* Allow store of any object to the Debug object */
 686  675  
 687  676                      break;
 688  677                  }
 689  678  
 690  679                  ACPI_ERROR ((AE_INFO,
 691  680                      "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p",
 692  681                      AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
 693  682  
 694  683                  return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
 695  684              }
 696  685              goto NextOperand;
 697  686  
 698      -
 699  687          default:
 700  688  
 701  689              /* Unknown type */
 702  690  
 703  691              ACPI_ERROR ((AE_INFO,
 704  692                  "Internal - Unknown ARGI (required operand) type 0x%X",
 705  693                  ThisArgType));
 706  694  
 707  695              return_ACPI_STATUS (AE_BAD_PARAMETER);
 708  696          }
↓ open down ↓ 18 lines elided ↑ open up ↑
 727  715          {
 728  716              StackPtr--;
 729  717          }
 730  718      }
 731  719  
 732  720      ACPI_DUMP_OPERANDS (WalkState->Operands,
 733  721          AcpiPsGetOpcodeName (Opcode), WalkState->NumOperands);
 734  722  
 735  723      return_ACPI_STATUS (Status);
 736  724  }
 737      -
 738      -
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX