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/exresolv.c
          +++ new/usr/src/common/acpica/components/executer/exresolv.c
   1      -
   2    1  /******************************************************************************
   3    2   *
   4    3   * Module Name: exresolv - AML Interpreter 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 ↓ 138 lines elided ↑ open up ↑
 158  157      ACPI_OPERAND_OBJECT     *StackDesc;
 159  158      ACPI_OPERAND_OBJECT     *ObjDesc = NULL;
 160  159      UINT8                   RefType;
 161  160  
 162  161  
 163  162      ACPI_FUNCTION_TRACE (ExResolveObjectToValue);
 164  163  
 165  164  
 166  165      StackDesc = *StackPtr;
 167  166  
 168      -    /* This is an ACPI_OPERAND_OBJECT  */
      167 +    /* This is an object of type ACPI_OPERAND_OBJECT */
 169  168  
 170  169      switch (StackDesc->Common.Type)
 171  170      {
 172  171      case ACPI_TYPE_LOCAL_REFERENCE:
 173  172  
 174  173          RefType = StackDesc->Reference.Class;
 175  174  
 176  175          switch (RefType)
 177  176          {
 178  177          case ACPI_REFCLASS_LOCAL:
 179  178          case ACPI_REFCLASS_ARG:
 180      -
 181  179              /*
 182  180               * Get the local from the method's state info
 183  181               * Note: this increments the local's object reference count
 184  182               */
 185  183              Status = AcpiDsMethodDataGetValue (RefType,
 186  184                              StackDesc->Reference.Value, WalkState, &ObjDesc);
 187  185              if (ACPI_FAILURE (Status))
 188  186              {
 189  187                  return_ACPI_STATUS (Status);
 190  188              }
↓ open down ↓ 2 lines elided ↑ open up ↑
 193  191                  StackDesc->Reference.Value, ObjDesc));
 194  192  
 195  193              /*
 196  194               * Now we can delete the original Reference Object and
 197  195               * replace it with the resolved value
 198  196               */
 199  197              AcpiUtRemoveReference (StackDesc);
 200  198              *StackPtr = ObjDesc;
 201  199              break;
 202  200  
 203      -
 204  201          case ACPI_REFCLASS_INDEX:
 205  202  
 206  203              switch (StackDesc->Reference.TargetType)
 207  204              {
 208  205              case ACPI_TYPE_BUFFER_FIELD:
 209  206  
 210  207                  /* Just return - do not dereference */
 211  208                  break;
 212  209  
 213      -
 214  210              case ACPI_TYPE_PACKAGE:
 215  211  
 216  212                  /* If method call or CopyObject - do not dereference */
 217  213  
 218  214                  if ((WalkState->Opcode == AML_INT_METHODCALL_OP) ||
 219  215                      (WalkState->Opcode == AML_COPY_OP))
 220  216                  {
 221  217                      break;
 222  218                  }
 223  219  
↓ open down ↓ 17 lines elided ↑ open up ↑
 241  237                       * A NULL object descriptor means an uninitialized element of
 242  238                       * the package, can't dereference it
 243  239                       */
 244  240                      ACPI_ERROR ((AE_INFO,
 245  241                          "Attempt to dereference an Index to NULL package element Idx=%p",
 246  242                          StackDesc));
 247  243                      Status = AE_AML_UNINITIALIZED_ELEMENT;
 248  244                  }
 249  245                  break;
 250  246  
 251      -
 252  247              default:
 253  248  
 254  249                  /* Invalid reference object */
 255  250  
 256  251                  ACPI_ERROR ((AE_INFO,
 257  252                      "Unknown TargetType 0x%X in Index/Reference object %p",
 258  253                      StackDesc->Reference.TargetType, StackDesc));
 259  254                  Status = AE_AML_INTERNAL;
 260  255                  break;
 261  256              }
 262  257              break;
 263  258  
 264      -
 265  259          case ACPI_REFCLASS_REFOF:
 266  260          case ACPI_REFCLASS_DEBUG:
 267  261          case ACPI_REFCLASS_TABLE:
 268  262  
 269  263              /* Just leave the object as-is, do not dereference */
 270  264  
 271  265              break;
 272  266  
 273  267          case ACPI_REFCLASS_NAME:   /* Reference to a named object */
 274  268  
↓ open down ↓ 19 lines elided ↑ open up ↑
 294  288  
 295  289          default:
 296  290  
 297  291              ACPI_ERROR ((AE_INFO,
 298  292                  "Unknown Reference type 0x%X in %p", RefType, StackDesc));
 299  293              Status = AE_AML_INTERNAL;
 300  294              break;
 301  295          }
 302  296          break;
 303  297  
 304      -
 305  298      case ACPI_TYPE_BUFFER:
 306  299  
 307  300          Status = AcpiDsGetBufferArguments (StackDesc);
 308  301          break;
 309  302  
 310      -
 311  303      case ACPI_TYPE_PACKAGE:
 312  304  
 313  305          Status = AcpiDsGetPackageArguments (StackDesc);
 314  306          break;
 315  307  
 316      -
 317  308      case ACPI_TYPE_BUFFER_FIELD:
 318  309      case ACPI_TYPE_LOCAL_REGION_FIELD:
 319  310      case ACPI_TYPE_LOCAL_BANK_FIELD:
 320  311      case ACPI_TYPE_LOCAL_INDEX_FIELD:
 321  312  
 322  313          ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "FieldRead SourceDesc=%p Type=%X\n",
 323  314              StackDesc, StackDesc->Common.Type));
 324  315  
 325  316          Status = AcpiExReadDataFromField (WalkState, StackDesc, &ObjDesc);
 326  317  
 327  318          /* Remove a reference to the original operand, then override */
 328  319  
 329  320          AcpiUtRemoveReference (*StackPtr);
 330  321          *StackPtr = (void *) ObjDesc;
 331  322          break;
 332  323  
 333  324      default:
      325 +
 334  326          break;
 335  327      }
 336  328  
 337  329      return_ACPI_STATUS (Status);
 338  330  }
 339  331  
 340  332  
 341  333  /*******************************************************************************
 342  334   *
 343  335   * FUNCTION:    AcpiExResolveMultiple
 344  336   *
 345  337   * PARAMETERS:  WalkState           - Current state (contains AML opcode)
 346  338   *              Operand             - Starting point for resolution
 347  339   *              ReturnType          - Where the object type is returned
 348  340   *              ReturnDesc          - Where the resolved object is returned
 349  341   *
 350  342   * RETURN:      Status
 351  343   *
 352      - * DESCRIPTION: Return the base object and type.  Traverse a reference list if
      344 + * DESCRIPTION: Return the base object and type. Traverse a reference list if
 353  345   *              necessary to get to the base object.
 354  346   *
 355  347   ******************************************************************************/
 356  348  
 357  349  ACPI_STATUS
 358  350  AcpiExResolveMultiple (
 359  351      ACPI_WALK_STATE         *WalkState,
 360  352      ACPI_OPERAND_OBJECT     *Operand,
 361  353      ACPI_OBJECT_TYPE        *ReturnType,
 362  354      ACPI_OPERAND_OBJECT     **ReturnDesc)
↓ open down ↓ 5 lines elided ↑ open up ↑
 368  360  
 369  361  
 370  362      ACPI_FUNCTION_TRACE (AcpiExResolveMultiple);
 371  363  
 372  364  
 373  365      /* Operand can be either a namespace node or an operand descriptor */
 374  366  
 375  367      switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))
 376  368      {
 377  369      case ACPI_DESC_TYPE_OPERAND:
      370 +
 378  371          Type = ObjDesc->Common.Type;
 379  372          break;
 380  373  
 381  374      case ACPI_DESC_TYPE_NAMED:
      375 +
 382  376          Type = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type;
 383  377          ObjDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) ObjDesc);
 384  378  
 385  379          /* If we had an Alias node, use the attached object for type info */
 386  380  
 387  381          if (Type == ACPI_TYPE_LOCAL_ALIAS)
 388  382          {
 389  383              Type = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type;
 390  384              ObjDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) ObjDesc);
 391  385          }
↓ open down ↓ 56 lines elided ↑ open up ↑
 448  442              }
 449  443  
 450  444              /* Check for circular references */
 451  445  
 452  446              if (ObjDesc == Operand)
 453  447              {
 454  448                  return_ACPI_STATUS (AE_AML_CIRCULAR_REFERENCE);
 455  449              }
 456  450              break;
 457  451  
 458      -
 459  452          case ACPI_REFCLASS_INDEX:
 460  453  
 461  454              /* Get the type of this reference (index into another object) */
 462  455  
 463  456              Type = ObjDesc->Reference.TargetType;
 464  457              if (Type != ACPI_TYPE_PACKAGE)
 465  458              {
 466  459                  goto Exit;
 467  460              }
 468  461  
↓ open down ↓ 7 lines elided ↑ open up ↑
 476  469              ObjDesc = *(ObjDesc->Reference.Where);
 477  470              if (!ObjDesc)
 478  471              {
 479  472                  /* NULL package elements are allowed */
 480  473  
 481  474                  Type = 0; /* Uninitialized */
 482  475                  goto Exit;
 483  476              }
 484  477              break;
 485  478  
 486      -
 487  479          case ACPI_REFCLASS_TABLE:
 488  480  
 489  481              Type = ACPI_TYPE_DDB_HANDLE;
 490  482              goto Exit;
 491  483  
 492      -
 493  484          case ACPI_REFCLASS_LOCAL:
 494  485          case ACPI_REFCLASS_ARG:
 495  486  
 496  487              if (ReturnDesc)
 497  488              {
 498  489                  Status = AcpiDsMethodDataGetValue (ObjDesc->Reference.Class,
 499  490                              ObjDesc->Reference.Value, WalkState, &ObjDesc);
 500  491                  if (ACPI_FAILURE (Status))
 501  492                  {
 502  493                      return_ACPI_STATUS (Status);
↓ open down ↓ 11 lines elided ↑ open up ↑
 514  505  
 515  506                  ObjDesc = AcpiNsGetAttachedObject (Node);
 516  507                  if (!ObjDesc)
 517  508                  {
 518  509                      Type = ACPI_TYPE_ANY;
 519  510                      goto Exit;
 520  511                  }
 521  512              }
 522  513              break;
 523  514  
 524      -
 525  515          case ACPI_REFCLASS_DEBUG:
 526  516  
 527  517              /* The Debug Object is of type "DebugObject" */
 528  518  
 529  519              Type = ACPI_TYPE_DEBUG_OBJECT;
 530  520              goto Exit;
 531  521  
 532      -
 533  522          default:
 534  523  
 535  524              ACPI_ERROR ((AE_INFO,
 536  525                  "Unknown Reference Class 0x%2.2X", ObjDesc->Reference.Class));
 537  526              return_ACPI_STATUS (AE_AML_INTERNAL);
 538  527          }
 539  528      }
 540  529  
 541  530      /*
 542  531       * Now we are guaranteed to have an object that has not been created
↓ open down ↓ 15 lines elided ↑ open up ↑
 558  547          break;
 559  548  
 560  549      case ACPI_TYPE_LOCAL_SCOPE:
 561  550  
 562  551          /* Per ACPI Specification, Scope is untyped */
 563  552  
 564  553          Type = ACPI_TYPE_ANY;
 565  554          break;
 566  555  
 567  556      default:
      557 +
 568  558          /* No change to Type required */
      559 +
 569  560          break;
 570  561      }
 571  562  
 572  563      *ReturnType = Type;
 573  564      if (ReturnDesc)
 574  565      {
 575  566          *ReturnDesc = ObjDesc;
 576  567      }
 577  568      return_ACPI_STATUS (AE_OK);
 578  569  }
 579      -
 580      -
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX