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/excreate.c
          +++ new/usr/src/common/acpica/components/executer/excreate.c
   1    1  /******************************************************************************
   2    2   *
   3    3   * Module Name: excreate - Named object creation
   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 ↓ 63 lines elided ↑ open up ↑
  82   82      /* Get the source/alias operands (both namespace nodes) */
  83   83  
  84   84      AliasNode =  (ACPI_NAMESPACE_NODE *) WalkState->Operands[0];
  85   85      TargetNode = (ACPI_NAMESPACE_NODE *) WalkState->Operands[1];
  86   86  
  87   87      if ((TargetNode->Type == ACPI_TYPE_LOCAL_ALIAS)  ||
  88   88          (TargetNode->Type == ACPI_TYPE_LOCAL_METHOD_ALIAS))
  89   89      {
  90   90          /*
  91   91           * Dereference an existing alias so that we don't create a chain
  92      -         * of aliases.  With this code, we guarantee that an alias is
       92 +         * of aliases. With this code, we guarantee that an alias is
  93   93           * always exactly one level of indirection away from the
  94   94           * actual aliased name.
  95   95           */
  96   96          TargetNode = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, TargetNode->Object);
  97   97      }
  98   98  
  99   99      /*
 100  100       * For objects that can never change (i.e., the NS node will
 101  101       * permanently point to the same object), we can simply attach
 102      -     * the object to the new NS node.  For other objects (such as
      102 +     * the object to the new NS node. For other objects (such as
 103  103       * Integers, buffers, etc.), we have to point the Alias node
 104  104       * to the original Node.
 105  105       */
 106  106      switch (TargetNode->Type)
 107  107      {
 108  108  
 109  109      /* For these types, the sub-object can change dynamically via a Store */
 110  110  
 111  111      case ACPI_TYPE_INTEGER:
 112  112      case ACPI_TYPE_STRING:
 113  113      case ACPI_TYPE_BUFFER:
 114  114      case ACPI_TYPE_PACKAGE:
 115  115      case ACPI_TYPE_BUFFER_FIELD:
 116      -
 117  116      /*
 118  117       * These types open a new scope, so we need the NS node in order to access
 119  118       * any children.
 120  119       */
 121  120      case ACPI_TYPE_DEVICE:
 122  121      case ACPI_TYPE_POWER:
 123  122      case ACPI_TYPE_PROCESSOR:
 124  123      case ACPI_TYPE_THERMAL:
 125  124      case ACPI_TYPE_LOCAL_SCOPE:
 126      -
 127  125          /*
 128  126           * The new alias has the type ALIAS and points to the original
 129  127           * NS node, not the object itself.
 130  128           */
 131  129          AliasNode->Type = ACPI_TYPE_LOCAL_ALIAS;
 132  130          AliasNode->Object = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, TargetNode);
 133  131          break;
 134  132  
 135  133      case ACPI_TYPE_METHOD:
 136      -
 137  134          /*
 138  135           * Control method aliases need to be differentiated
 139  136           */
 140  137          AliasNode->Type = ACPI_TYPE_LOCAL_METHOD_ALIAS;
 141  138          AliasNode->Object = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, TargetNode);
 142  139          break;
 143  140  
 144  141      default:
 145  142  
 146  143          /* Attach the original source object to the new Alias Node */
 147  144  
 148  145          /*
 149  146           * The new alias assumes the type of the target, and it points
 150      -         * to the same object.  The reference count of the object has an
      147 +         * to the same object. The reference count of the object has an
 151  148           * additional reference to prevent deletion out from under either the
 152  149           * target node or the alias Node
 153  150           */
 154  151          Status = AcpiNsAttachObject (AliasNode,
 155  152                      AcpiNsGetAttachedObject (TargetNode), TargetNode->Type);
 156  153          break;
 157  154      }
 158  155  
 159  156      /* Since both operands are Nodes, we don't need to delete them */
 160  157  
↓ open down ↓ 116 lines elided ↑ open up ↑
 277  274      return_ACPI_STATUS (Status);
 278  275  }
 279  276  
 280  277  
 281  278  /*******************************************************************************
 282  279   *
 283  280   * FUNCTION:    AcpiExCreateRegion
 284  281   *
 285  282   * PARAMETERS:  AmlStart            - Pointer to the region declaration AML
 286  283   *              AmlLength           - Max length of the declaration AML
 287      - *              RegionSpace         - SpaceID for the region
      284 + *              SpaceId             - Address space ID for the region
 288  285   *              WalkState           - Current state
 289  286   *
 290  287   * RETURN:      Status
 291  288   *
 292  289   * DESCRIPTION: Create a new operation region object
 293  290   *
 294  291   ******************************************************************************/
 295  292  
 296  293  ACPI_STATUS
 297  294  AcpiExCreateRegion (
 298  295      UINT8                   *AmlStart,
 299  296      UINT32                  AmlLength,
 300      -    UINT8                   RegionSpace,
      297 +    UINT8                   SpaceId,
 301  298      ACPI_WALK_STATE         *WalkState)
 302  299  {
 303  300      ACPI_STATUS             Status;
 304  301      ACPI_OPERAND_OBJECT     *ObjDesc;
 305  302      ACPI_NAMESPACE_NODE     *Node;
 306  303      ACPI_OPERAND_OBJECT     *RegionObj2;
 307  304  
 308  305  
 309  306      ACPI_FUNCTION_TRACE (ExCreateRegion);
 310  307  
↓ open down ↓ 8 lines elided ↑ open up ↑
 319  316       */
 320  317      if (AcpiNsGetAttachedObject (Node))
 321  318      {
 322  319          return_ACPI_STATUS (AE_OK);
 323  320      }
 324  321  
 325  322      /*
 326  323       * Space ID must be one of the predefined IDs, or in the user-defined
 327  324       * range
 328  325       */
 329      -    if ((RegionSpace >= ACPI_NUM_PREDEFINED_REGIONS) &&
 330      -        (RegionSpace < ACPI_USER_REGION_BEGIN) &&
 331      -        (RegionSpace != ACPI_ADR_SPACE_DATA_TABLE))
      326 +    if (!AcpiIsValidSpaceId (SpaceId))
 332  327      {
 333      -        ACPI_ERROR ((AE_INFO, "Invalid AddressSpace type 0x%X", RegionSpace));
 334      -        return_ACPI_STATUS (AE_AML_INVALID_SPACE_ID);
      328 +        /*
      329 +         * Print an error message, but continue. We don't want to abort
      330 +         * a table load for this exception. Instead, if the region is
      331 +         * actually used at runtime, abort the executing method.
      332 +         */
      333 +        ACPI_ERROR ((AE_INFO, "Invalid/unknown Address Space ID: 0x%2.2X", SpaceId));
 335  334      }
 336  335  
 337  336      ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Region Type - %s (0x%X)\n",
 338      -        AcpiUtGetRegionName (RegionSpace), RegionSpace));
      337 +        AcpiUtGetRegionName (SpaceId), SpaceId));
 339  338  
 340  339      /* Create the region descriptor */
 341  340  
 342  341      ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_REGION);
 343  342      if (!ObjDesc)
 344  343      {
 345  344          Status = AE_NO_MEMORY;
 346  345          goto Cleanup;
 347  346      }
 348  347  
 349  348      /*
 350  349       * Remember location in AML stream of address & length
 351  350       * operands since they need to be evaluated at run time.
 352  351       */
 353  352      RegionObj2 = ObjDesc->Common.NextObject;
 354  353      RegionObj2->Extra.AmlStart = AmlStart;
 355  354      RegionObj2->Extra.AmlLength = AmlLength;
      355 +    if (WalkState->ScopeInfo)
      356 +    {
      357 +        RegionObj2->Extra.ScopeNode = WalkState->ScopeInfo->Scope.Node;
      358 +    }
      359 +    else
      360 +    {
      361 +        RegionObj2->Extra.ScopeNode = Node;
      362 +    }
 356  363  
 357  364      /* Init the region from the operands */
 358  365  
 359      -    ObjDesc->Region.SpaceId = RegionSpace;
      366 +    ObjDesc->Region.SpaceId = SpaceId;
 360  367      ObjDesc->Region.Address = 0;
 361  368      ObjDesc->Region.Length = 0;
 362  369      ObjDesc->Region.Node = Node;
 363  370  
 364  371      /* Install the new region object in the parent Node */
 365  372  
 366  373      Status = AcpiNsAttachObject (Node, ObjDesc, ACPI_TYPE_REGION);
 367  374  
 368  375  
 369  376  Cleanup:
↓ open down ↓ 183 lines elided ↑ open up ↑
 553  560      /* Remove local reference to the object */
 554  561  
 555  562      AcpiUtRemoveReference (ObjDesc);
 556  563  
 557  564  Exit:
 558  565      /* Remove a reference to the operand */
 559  566  
 560  567      AcpiUtRemoveReference (Operand[1]);
 561  568      return_ACPI_STATUS (Status);
 562  569  }
 563      -
 564      -
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX