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/namespace/nsinit.c
          +++ new/usr/src/common/acpica/components/namespace/nsinit.c
   1    1  /******************************************************************************
   2    2   *
   3    3   * Module Name: nsinit - namespace initialization
   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 ↓ 78 lines elided ↑ open up ↑
  97   97      ACPI_STATUS             Status;
  98   98      ACPI_INIT_WALK_INFO     Info;
  99   99  
 100  100  
 101  101      ACPI_FUNCTION_TRACE (NsInitializeObjects);
 102  102  
 103  103  
 104  104      ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
 105  105          "**** Starting initialization of namespace objects ****\n"));
 106  106      ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
 107      -        "Completing Region/Field/Buffer/Package initialization:"));
      107 +        "Completing Region/Field/Buffer/Package initialization:\n"));
 108  108  
 109  109      /* Set all init info to zero */
 110  110  
 111  111      ACPI_MEMSET (&Info, 0, sizeof (ACPI_INIT_WALK_INFO));
 112  112  
 113  113      /* Walk entire namespace from the supplied root */
 114  114  
 115  115      Status = AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
 116  116                  ACPI_UINT32_MAX, AcpiNsInitOneObject, NULL,
 117  117                  &Info, NULL);
 118  118      if (ACPI_FAILURE (Status))
 119  119      {
 120  120          ACPI_EXCEPTION ((AE_INFO, Status, "During WalkNamespace"));
 121  121      }
 122  122  
 123  123      ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
 124      -        "\nInitialized %u/%u Regions %u/%u Fields %u/%u "
      124 +        "    Initialized %u/%u Regions %u/%u Fields %u/%u "
 125  125          "Buffers %u/%u Packages (%u nodes)\n",
 126  126          Info.OpRegionInit,  Info.OpRegionCount,
 127  127          Info.FieldInit,     Info.FieldCount,
 128  128          Info.BufferInit,    Info.BufferCount,
 129  129          Info.PackageInit,   Info.PackageCount, Info.ObjectCount));
 130  130  
 131  131      ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
 132  132          "%u Control Methods found\n", Info.MethodCount));
 133  133      ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
 134  134          "%u Op Regions found\n", Info.OpRegionCount));
↓ open down ↓ 30 lines elided ↑ open up ↑
 165  165  
 166  166  
 167  167      /* Init counters */
 168  168  
 169  169      Info.DeviceCount = 0;
 170  170      Info.Num_STA = 0;
 171  171      Info.Num_INI = 0;
 172  172  
 173  173      ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
 174  174          "Initializing Device/Processor/Thermal objects "
 175      -        "by executing _INI methods:"));
      175 +        "and executing _INI/_STA methods:\n"));
 176  176  
 177  177      /* Tree analysis: find all subtrees that contain _INI methods */
 178  178  
 179  179      Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
 180  180                  ACPI_UINT32_MAX, FALSE, AcpiNsFindIniMethods, NULL, &Info, NULL);
 181  181      if (ACPI_FAILURE (Status))
 182  182      {
 183  183          goto ErrorExit;
 184  184      }
 185  185  
↓ open down ↓ 5 lines elided ↑ open up ↑
 191  191          Status = AE_NO_MEMORY;
 192  192          goto ErrorExit;
 193  193      }
 194  194  
 195  195      /*
 196  196       * Execute the "global" _INI method that may appear at the root. This
 197  197       * support is provided for Windows compatibility (Vista+) and is not
 198  198       * part of the ACPI specification.
 199  199       */
 200  200      Info.EvaluateInfo->PrefixNode = AcpiGbl_RootNode;
 201      -    Info.EvaluateInfo->Pathname = METHOD_NAME__INI;
      201 +    Info.EvaluateInfo->RelativePathname = METHOD_NAME__INI;
 202  202      Info.EvaluateInfo->Parameters = NULL;
 203  203      Info.EvaluateInfo->Flags = ACPI_IGNORE_RETURN_VALUE;
 204  204  
 205  205      Status = AcpiNsEvaluate (Info.EvaluateInfo);
 206  206      if (ACPI_SUCCESS (Status))
 207  207      {
 208  208          Info.Num_INI++;
 209  209      }
 210  210  
 211  211      /* Walk namespace to execute all _INIs on present devices */
↓ open down ↓ 11 lines elided ↑ open up ↑
 223  223          AcpiGbl_TruncateIoAddresses = TRUE;
 224  224      }
 225  225  
 226  226      ACPI_FREE (Info.EvaluateInfo);
 227  227      if (ACPI_FAILURE (Status))
 228  228      {
 229  229          goto ErrorExit;
 230  230      }
 231  231  
 232  232      ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
 233      -        "\nExecuted %u _INI methods requiring %u _STA executions "
      233 +        "    Executed %u _INI methods requiring %u _STA executions "
 234  234          "(examined %u objects)\n",
 235  235          Info.Num_INI, Info.Num_STA, Info.DeviceCount));
 236  236  
 237  237      return_ACPI_STATUS (Status);
 238  238  
 239  239  
 240  240  ErrorExit:
 241  241      ACPI_EXCEPTION ((AE_INFO, Status, "During device initialization"));
 242  242      return_ACPI_STATUS (Status);
 243  243  }
↓ open down ↓ 3 lines elided ↑ open up ↑
 247  247   *
 248  248   * FUNCTION:    AcpiNsInitOneObject
 249  249   *
 250  250   * PARAMETERS:  ObjHandle       - Node
 251  251   *              Level           - Current nesting level
 252  252   *              Context         - Points to a init info struct
 253  253   *              ReturnValue     - Not used
 254  254   *
 255  255   * RETURN:      Status
 256  256   *
 257      - * DESCRIPTION: Callback from AcpiWalkNamespace.  Invoked for every object
      257 + * DESCRIPTION: Callback from AcpiWalkNamespace. Invoked for every object
 258  258   *              within the  namespace.
 259  259   *
 260  260   *              Currently, the only objects that require initialization are:
 261  261   *              1) Methods
 262  262   *              2) Op Regions
 263  263   *
 264  264   ******************************************************************************/
 265  265  
 266  266  static ACPI_STATUS
 267  267  AcpiNsInitOneObject (
↓ open down ↓ 21 lines elided ↑ open up ↑
 289  289      if (!ObjDesc)
 290  290      {
 291  291          return (AE_OK);
 292  292      }
 293  293  
 294  294      /* Increment counters for object types we are looking for */
 295  295  
 296  296      switch (Type)
 297  297      {
 298  298      case ACPI_TYPE_REGION:
      299 +
 299  300          Info->OpRegionCount++;
 300  301          break;
 301  302  
 302  303      case ACPI_TYPE_BUFFER_FIELD:
      304 +
 303  305          Info->FieldCount++;
 304  306          break;
 305  307  
 306  308      case ACPI_TYPE_LOCAL_BANK_FIELD:
      309 +
 307  310          Info->FieldCount++;
 308  311          break;
 309  312  
 310  313      case ACPI_TYPE_BUFFER:
      314 +
 311  315          Info->BufferCount++;
 312  316          break;
 313  317  
 314  318      case ACPI_TYPE_PACKAGE:
      319 +
 315  320          Info->PackageCount++;
 316  321          break;
 317  322  
 318  323      default:
 319  324  
 320  325          /* No init required, just exit now */
      326 +
 321  327          return (AE_OK);
 322  328      }
 323  329  
 324  330      /* If the object is already initialized, nothing else to do */
 325  331  
 326  332      if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
 327  333      {
 328  334          return (AE_OK);
 329  335      }
 330  336  
↓ open down ↓ 31 lines elided ↑ open up ↑
 362  368          Status = AcpiDsGetBufferArguments (ObjDesc);
 363  369          break;
 364  370  
 365  371      case ACPI_TYPE_PACKAGE:
 366  372  
 367  373          Info->PackageInit++;
 368  374          Status = AcpiDsGetPackageArguments (ObjDesc);
 369  375          break;
 370  376  
 371  377      default:
      378 +
 372  379          /* No other types can get here */
      380 +
 373  381          break;
 374  382      }
 375  383  
 376  384      if (ACPI_FAILURE (Status))
 377  385      {
 378  386          ACPI_EXCEPTION ((AE_INFO, Status,
 379  387              "Could not execute arguments for [%4.4s] (%s)",
 380  388              AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Type)));
 381  389      }
 382  390  
 383  391      /*
 384      -     * Print a dot for each object unless we are going to print the entire
 385      -     * pathname
 386      -     */
 387      -    if (!(AcpiDbgLevel & ACPI_LV_INIT_NAMES))
 388      -    {
 389      -        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "."));
 390      -    }
 391      -
 392      -    /*
 393  392       * We ignore errors from above, and always return OK, since we don't want
 394  393       * to abort the walk on any single error.
 395  394       */
 396  395      AcpiExExitInterpreter ();
 397  396      return (AE_OK);
 398  397  }
 399  398  
 400  399  
 401  400  /*******************************************************************************
 402  401   *
↓ open down ↓ 55 lines elided ↑ open up ↑
 458  457          /* Mark parent and bubble up the INI present flag to the root */
 459  458  
 460  459          while (ParentNode)
 461  460          {
 462  461              ParentNode->Flags |= ANOBJ_SUBTREE_HAS_INI;
 463  462              ParentNode = ParentNode->Parent;
 464  463          }
 465  464          break;
 466  465  
 467  466      default:
      467 +
 468  468          break;
 469  469      }
 470  470  
 471  471      return (AE_OK);
 472  472  }
 473  473  
 474  474  
 475  475  /*******************************************************************************
 476  476   *
 477  477   * FUNCTION:    AcpiNsInitOneDevice
↓ open down ↓ 133 lines elided ↑ open up ↑
 611  611      /*
 612  612       * The device is present or is assumed present if no _STA exists.
 613  613       * Run the _INI if it exists (not required to exist)
 614  614       *
 615  615       * Note: We know there is an _INI within this subtree, but it may not be
 616  616       * under this particular device, it may be lower in the branch.
 617  617       */
 618  618      ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (
 619  619          ACPI_TYPE_METHOD, DeviceNode, METHOD_NAME__INI));
 620  620  
      621 +    ACPI_MEMSET (Info, 0, sizeof (ACPI_EVALUATE_INFO));
 621  622      Info->PrefixNode = DeviceNode;
 622      -    Info->Pathname = METHOD_NAME__INI;
      623 +    Info->RelativePathname = METHOD_NAME__INI;
 623  624      Info->Parameters = NULL;
 624  625      Info->Flags = ACPI_IGNORE_RETURN_VALUE;
 625  626  
 626  627      Status = AcpiNsEvaluate (Info);
 627  628      if (ACPI_SUCCESS (Status))
 628  629      {
 629  630          WalkInfo->Num_INI++;
 630      -
 631      -        if ((AcpiDbgLevel <= ACPI_LV_ALL_EXCEPTIONS) &&
 632      -            (!(AcpiDbgLevel & ACPI_LV_INFO)))
 633      -        {
 634      -            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "."));
 635      -        }
 636  631      }
 637  632  
 638  633  #ifdef ACPI_DEBUG_OUTPUT
 639  634      else if (Status != AE_NOT_FOUND)
 640  635      {
 641  636          /* Ignore error and move on to next device */
 642  637  
 643      -        char *ScopeName = AcpiNsGetExternalPathname (Info->ResolvedNode);
      638 +        char *ScopeName = AcpiNsGetExternalPathname (Info->Node);
 644  639  
 645  640          ACPI_EXCEPTION ((AE_INFO, Status, "during %s._INI execution",
 646  641              ScopeName));
 647  642          ACPI_FREE (ScopeName);
 648  643      }
 649  644  #endif
 650  645  
 651  646      /* Ignore errors from above */
 652  647  
 653  648      Status = AE_OK;
↓ open down ↓ 12 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX