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/dispatcher/dsobject.c
          +++ new/usr/src/common/acpica/components/dispatcher/dsobject.c
   1    1  /******************************************************************************
   2    2   *
   3    3   * Module Name: dsobject - Dispatcher object management routines
   4    4   *
   5    5   *****************************************************************************/
   6    6  
   7    7  /*
   8      - * Copyright (C) 2000 - 2011, Intel Corp.
        8 + * Copyright (C) 2000 - 2014, Intel Corp.
   9    9   * All rights reserved.
  10   10   *
  11   11   * Redistribution and use in source and binary forms, with or without
  12   12   * modification, are permitted provided that the following conditions
  13   13   * are met:
  14   14   * 1. Redistributions of source code must retain the above copyright
  15   15   *    notice, this list of conditions, and the following disclaimer,
  16   16   *    without modification.
  17   17   * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  18   18   *    substantially similar to the "NO WARRANTY" disclaimer below
↓ open down ↓ 270 lines elided ↑ open up ↑
 289  289          ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER);
 290  290          *ObjDescPtr = ObjDesc;
 291  291          if (!ObjDesc)
 292  292          {
 293  293              return_ACPI_STATUS (AE_NO_MEMORY);
 294  294          }
 295  295      }
 296  296  
 297  297      /*
 298  298       * Second arg is the buffer data (optional) ByteList can be either
 299      -     * individual bytes or a string initializer.  In either case, a
      299 +     * individual bytes or a string initializer. In either case, a
 300  300       * ByteList appears in the AML.
 301  301       */
 302  302      Arg = Op->Common.Value.Arg;         /* skip first arg */
 303  303  
 304  304      ByteList = Arg->Named.Next;
 305  305      if (ByteList)
 306  306      {
 307  307          if (ByteList->Common.AmlOpcode != AML_INT_BYTELIST_OP)
 308  308          {
 309  309              ACPI_ERROR ((AE_INFO,
↓ open down ↓ 224 lines elided ↑ open up ↑
 534  534                  Arg->Common.Node = NULL;
 535  535              }
 536  536  
 537  537              /* Find out how many elements there really are */
 538  538  
 539  539              i++;
 540  540              Arg = Arg->Common.Next;
 541  541          }
 542  542  
 543  543          ACPI_INFO ((AE_INFO,
 544      -            "Actual Package length (%u) is larger than NumElements field (%u), truncated\n",
      544 +            "Actual Package length (%u) is larger than NumElements field (%u), truncated",
 545  545              i, ElementCount));
 546  546      }
 547  547      else if (i < ElementCount)
 548  548      {
 549  549          /*
 550  550           * Arg list (elements) was exhausted, but we did not reach NumElements count.
 551  551           * Note: this is not an error, the package is padded out with NULLs.
 552  552           */
 553  553          ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
 554  554              "Package List length (%u) smaller than NumElements count (%u), padded with null elements\n",
↓ open down ↓ 28 lines elided ↑ open up ↑
 583  583  {
 584  584      ACPI_STATUS             Status;
 585  585      ACPI_OPERAND_OBJECT     *ObjDesc;
 586  586  
 587  587  
 588  588      ACPI_FUNCTION_TRACE_PTR (DsCreateNode, Op);
 589  589  
 590  590  
 591  591      /*
 592  592       * Because of the execution pass through the non-control-method
 593      -     * parts of the table, we can arrive here twice.  Only init
      593 +     * parts of the table, we can arrive here twice. Only init
 594  594       * the named object node the first time through
 595  595       */
 596  596      if (AcpiNsGetAttachedObject (Node))
 597  597      {
 598  598          return_ACPI_STATUS (AE_OK);
 599  599      }
 600  600  
 601  601      if (!Op->Common.Value.Arg)
 602  602      {
 603  603          /* No arguments, there is nothing to do */
↓ open down ↓ 32 lines elided ↑ open up ↑
 636  636   * FUNCTION:    AcpiDsInitObjectFromOp
 637  637   *
 638  638   * PARAMETERS:  WalkState       - Current walk state
 639  639   *              Op              - Parser op used to init the internal object
 640  640   *              Opcode          - AML opcode associated with the object
 641  641   *              RetObjDesc      - Namespace object to be initialized
 642  642   *
 643  643   * RETURN:      Status
 644  644   *
 645  645   * DESCRIPTION: Initialize a namespace object from a parser Op and its
 646      - *              associated arguments.  The namespace object is a more compact
      646 + *              associated arguments. The namespace object is a more compact
 647  647   *              representation of the Op and its arguments.
 648  648   *
 649  649   ******************************************************************************/
 650  650  
 651  651  ACPI_STATUS
 652  652  AcpiDsInitObjectFromOp (
 653  653      ACPI_WALK_STATE         *WalkState,
 654  654      ACPI_PARSE_OBJECT       *Op,
 655  655      UINT16                  Opcode,
 656  656      ACPI_OPERAND_OBJECT     **RetObjDesc)
↓ open down ↓ 13 lines elided ↑ open up ↑
 670  670          /* Unknown opcode */
 671  671  
 672  672          return_ACPI_STATUS (AE_TYPE);
 673  673      }
 674  674  
 675  675      /* Perform per-object initialization */
 676  676  
 677  677      switch (ObjDesc->Common.Type)
 678  678      {
 679  679      case ACPI_TYPE_BUFFER:
 680      -
 681  680          /*
 682  681           * Defer evaluation of Buffer TermArg operand
 683  682           */
 684  683          ObjDesc->Buffer.Node      = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE,
 685  684                                          WalkState->Operands[0]);
 686  685          ObjDesc->Buffer.AmlStart  = Op->Named.Data;
 687  686          ObjDesc->Buffer.AmlLength = Op->Named.Length;
 688  687          break;
 689  688  
 690      -
 691  689      case ACPI_TYPE_PACKAGE:
 692      -
 693  690          /*
 694  691           * Defer evaluation of Package TermArg operand
 695  692           */
 696  693          ObjDesc->Package.Node      = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE,
 697  694                                          WalkState->Operands[0]);
 698  695          ObjDesc->Package.AmlStart  = Op->Named.Data;
 699  696          ObjDesc->Package.AmlLength = Op->Named.Length;
 700  697          break;
 701  698  
 702      -
 703  699      case ACPI_TYPE_INTEGER:
 704  700  
 705  701          switch (OpInfo->Type)
 706  702          {
 707  703          case AML_TYPE_CONSTANT:
 708  704              /*
 709  705               * Resolve AML Constants here - AND ONLY HERE!
 710  706               * All constants are integers.
 711  707               * We mark the integer with a flag that indicates that it started
 712  708               * life as a constant -- so that stores to constants will perform
↓ open down ↓ 14 lines elided ↑ open up ↑
 727  723                  ObjDesc->Integer.Value = 1;
 728  724                  break;
 729  725  
 730  726              case AML_ONES_OP:
 731  727  
 732  728                  ObjDesc->Integer.Value = ACPI_UINT64_MAX;
 733  729  
 734  730                  /* Truncate value if we are executing from a 32-bit ACPI table */
 735  731  
 736  732  #ifndef ACPI_NO_METHOD_EXECUTION
 737      -                AcpiExTruncateFor32bitTable (ObjDesc);
      733 +                (void) AcpiExTruncateFor32bitTable (ObjDesc);
 738  734  #endif
 739  735                  break;
 740  736  
 741  737              case AML_REVISION_OP:
 742  738  
 743  739                  ObjDesc->Integer.Value = ACPI_CA_VERSION;
 744  740                  break;
 745  741  
 746  742              default:
 747  743  
 748  744                  ACPI_ERROR ((AE_INFO,
 749  745                      "Unknown constant opcode 0x%X", Opcode));
 750  746                  Status = AE_AML_OPERAND_TYPE;
 751  747                  break;
 752  748              }
 753  749              break;
 754  750  
 755      -
 756  751          case AML_TYPE_LITERAL:
 757  752  
 758  753              ObjDesc->Integer.Value = Op->Common.Value.Integer;
      754 +
 759  755  #ifndef ACPI_NO_METHOD_EXECUTION
 760      -            AcpiExTruncateFor32bitTable (ObjDesc);
      756 +            if (AcpiExTruncateFor32bitTable (ObjDesc))
      757 +            {
      758 +                /* Warn if we found a 64-bit constant in a 32-bit table */
      759 +
      760 +                ACPI_WARNING ((AE_INFO,
      761 +                    "Truncated 64-bit constant found in 32-bit table: %8.8X%8.8X => %8.8X",
      762 +                    ACPI_FORMAT_UINT64 (Op->Common.Value.Integer),
      763 +                    (UINT32) ObjDesc->Integer.Value));
      764 +            }
 761  765  #endif
 762  766              break;
 763  767  
 764      -
 765  768          default:
      769 +
 766  770              ACPI_ERROR ((AE_INFO, "Unknown Integer type 0x%X",
 767  771                  OpInfo->Type));
 768  772              Status = AE_AML_OPERAND_TYPE;
 769  773              break;
 770  774          }
 771  775          break;
 772  776  
 773      -
 774  777      case ACPI_TYPE_STRING:
 775  778  
 776  779          ObjDesc->String.Pointer = Op->Common.Value.String;
 777  780          ObjDesc->String.Length = (UINT32) ACPI_STRLEN (Op->Common.Value.String);
 778  781  
 779  782          /*
 780  783           * The string is contained in the ACPI table, don't ever try
 781  784           * to delete it
 782  785           */
 783  786          ObjDesc->Common.Flags |= AOPOBJ_STATIC_POINTER;
 784  787          break;
 785  788  
 786      -
 787  789      case ACPI_TYPE_METHOD:
 788  790          break;
 789  791  
 790      -
 791  792      case ACPI_TYPE_LOCAL_REFERENCE:
 792  793  
 793  794          switch (OpInfo->Type)
 794  795          {
 795  796          case AML_TYPE_LOCAL_VARIABLE:
 796  797  
 797  798              /* Local ID (0-7) is (AML opcode - base AML_LOCAL_OP) */
 798  799  
 799  800              ObjDesc->Reference.Value = ((UINT32) Opcode) - AML_LOCAL_OP;
 800  801              ObjDesc->Reference.Class = ACPI_REFCLASS_LOCAL;
 801  802  
 802  803  #ifndef ACPI_NO_METHOD_EXECUTION
 803  804              Status = AcpiDsMethodDataGetNode (ACPI_REFCLASS_LOCAL,
 804  805                          ObjDesc->Reference.Value, WalkState,
 805  806                          ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE,
 806  807                              &ObjDesc->Reference.Object));
 807  808  #endif
 808  809              break;
 809  810  
 810      -
 811  811          case AML_TYPE_METHOD_ARGUMENT:
 812  812  
 813  813              /* Arg ID (0-6) is (AML opcode - base AML_ARG_OP) */
 814  814  
 815  815              ObjDesc->Reference.Value = ((UINT32) Opcode) - AML_ARG_OP;
 816  816              ObjDesc->Reference.Class = ACPI_REFCLASS_ARG;
 817  817  
 818  818  #ifndef ACPI_NO_METHOD_EXECUTION
 819  819              Status = AcpiDsMethodDataGetNode (ACPI_REFCLASS_ARG,
 820  820                          ObjDesc->Reference.Value, WalkState,
↓ open down ↓ 23 lines elided ↑ open up ↑
 844  844              default:
 845  845  
 846  846                  ACPI_ERROR ((AE_INFO,
 847  847                      "Unimplemented reference type for AML opcode: 0x%4.4X", Opcode));
 848  848                  return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
 849  849              }
 850  850              break;
 851  851          }
 852  852          break;
 853  853  
 854      -
 855  854      default:
 856  855  
 857  856          ACPI_ERROR ((AE_INFO, "Unimplemented data type: 0x%X",
 858  857              ObjDesc->Common.Type));
 859  858  
 860  859          Status = AE_AML_OPERAND_TYPE;
 861  860          break;
 862  861      }
 863  862  
 864  863      return_ACPI_STATUS (Status);
 865  864  }
 866      -
 867      -
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX