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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/intel/io/acpica/dispatcher/dswload.c
          +++ new/usr/src/common/acpica/components/dispatcher/dswload.c
   1    1  /******************************************************************************
   2    2   *
   3    3   * Module Name: dswload - Dispatcher first pass namespace load callbacks
   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 ↓ 55 lines elided ↑ open up ↑
  74   74  
  75   75  ACPI_STATUS
  76   76  AcpiDsInitCallbacks (
  77   77      ACPI_WALK_STATE         *WalkState,
  78   78      UINT32                  PassNumber)
  79   79  {
  80   80  
  81   81      switch (PassNumber)
  82   82      {
  83   83      case 1:
       84 +
  84   85          WalkState->ParseFlags         = ACPI_PARSE_LOAD_PASS1 |
  85   86                                          ACPI_PARSE_DELETE_TREE;
  86   87          WalkState->DescendingCallback = AcpiDsLoad1BeginOp;
  87   88          WalkState->AscendingCallback  = AcpiDsLoad1EndOp;
  88   89          break;
  89   90  
  90   91      case 2:
       92 +
  91   93          WalkState->ParseFlags         = ACPI_PARSE_LOAD_PASS1 |
  92   94                                          ACPI_PARSE_DELETE_TREE;
  93   95          WalkState->DescendingCallback = AcpiDsLoad2BeginOp;
  94   96          WalkState->AscendingCallback  = AcpiDsLoad2EndOp;
  95   97          break;
  96   98  
  97   99      case 3:
      100 +
  98  101  #ifndef ACPI_NO_METHOD_EXECUTION
  99  102          WalkState->ParseFlags        |= ACPI_PARSE_EXECUTE  |
 100  103                                          ACPI_PARSE_DELETE_TREE;
 101  104          WalkState->DescendingCallback = AcpiDsExecBeginOp;
 102  105          WalkState->AscendingCallback  = AcpiDsExecEndOp;
 103  106  #endif
 104  107          break;
 105  108  
 106  109      default:
      110 +
 107  111          return (AE_BAD_PARAMETER);
 108  112      }
 109  113  
 110  114      return (AE_OK);
 111  115  }
 112  116  
 113  117  
 114  118  /*******************************************************************************
 115  119   *
 116  120   * FUNCTION:    AcpiDsLoad1BeginOp
↓ open down ↓ 50 lines elided ↑ open up ↑
 167  171      /* Map the raw opcode into an internal object type */
 168  172  
 169  173      ObjectType = WalkState->OpInfo->ObjectType;
 170  174  
 171  175      ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
 172  176          "State=%p Op=%p [%s]\n", WalkState, Op, AcpiUtGetTypeName (ObjectType)));
 173  177  
 174  178      switch (WalkState->Opcode)
 175  179      {
 176  180      case AML_SCOPE_OP:
 177      -
 178  181          /*
 179  182           * The target name of the Scope() operator must exist at this point so
 180  183           * that we can actually open the scope to enter new names underneath it.
 181  184           * Allow search-to-root for single namesegs.
 182  185           */
 183  186          Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
 184  187                          ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &(Node));
 185  188  #ifdef ACPI_ASL_COMPILER
 186  189          if (Status == AE_NOT_FOUND)
 187  190          {
 188  191              /*
 189  192               * Table disassembly:
 190  193               * Target of Scope() not found. Generate an External for it, and
 191  194               * insert the name into the namespace.
 192  195               */
 193      -            AcpiDmAddToExternalList (Op, Path, ACPI_TYPE_DEVICE, 0);
      196 +            AcpiDmAddOpToExternalList (Op, Path, ACPI_TYPE_DEVICE, 0, 0);
 194  197              Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
 195  198                         ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT,
 196  199                         WalkState, &Node);
 197  200          }
 198  201  #endif
 199  202          if (ACPI_FAILURE (Status))
 200  203          {
 201  204              ACPI_ERROR_NAMESPACE (Path, Status);
 202  205              return_ACPI_STATUS (Status);
 203  206          }
↓ open down ↓ 10 lines elided ↑ open up ↑
 214  217          case ACPI_TYPE_POWER:
 215  218          case ACPI_TYPE_PROCESSOR:
 216  219          case ACPI_TYPE_THERMAL:
 217  220  
 218  221              /* These are acceptable types */
 219  222              break;
 220  223  
 221  224          case ACPI_TYPE_INTEGER:
 222  225          case ACPI_TYPE_STRING:
 223  226          case ACPI_TYPE_BUFFER:
 224      -
 225  227              /*
 226  228               * These types we will allow, but we will change the type.
 227  229               * This enables some existing code of the form:
 228  230               *
 229  231               *  Name (DEB, 0)
 230  232               *  Scope (DEB) { ... }
 231  233               *
 232  234               * Note: silently change the type here. On the second pass,
 233  235               * we will report a warning
 234  236               */
 235  237              ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
 236  238                  "Type override - [%4.4s] had invalid type (%s) "
 237  239                  "for Scope operator, changed to type ANY\n",
 238  240                  AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type)));
 239  241  
 240  242              Node->Type = ACPI_TYPE_ANY;
 241  243              WalkState->ScopeInfo->Common.Value = ACPI_TYPE_ANY;
 242  244              break;
 243  245  
      246 +        case ACPI_TYPE_METHOD:
      247 +            /*
      248 +             * Allow scope change to root during execution of module-level
      249 +             * code. Root is typed METHOD during this time.
      250 +             */
      251 +            if ((Node == AcpiGbl_RootNode) &&
      252 +                (WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL))
      253 +            {
      254 +                break;
      255 +            }
      256 +
      257 +            /*lint -fallthrough */
      258 +
 244  259          default:
 245  260  
 246  261              /* All other types are an error */
 247  262  
 248  263              ACPI_ERROR ((AE_INFO,
 249  264                  "Invalid type (%s) for target of "
 250  265                  "Scope operator [%4.4s] (Cannot override)",
 251  266                  AcpiUtGetTypeName (Node->Type), AcpiUtGetNodeName (Node)));
 252  267  
 253  268              return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
 254  269          }
 255  270          break;
 256  271  
 257      -
 258  272      default:
 259  273          /*
 260  274           * For all other named opcodes, we will enter the name into
 261  275           * the namespace.
 262  276           *
 263  277           * Setup the search flags.
 264  278           * Since we are entering a name into the namespace, we do not want to
 265  279           * enable the search-to-root upsearch.
 266  280           *
 267  281           * There are only two conditions where it is acceptable that the name
↓ open down ↓ 284 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX