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/nswalk.c
          +++ new/usr/src/common/acpica/components/namespace/nswalk.c
   1    1  /******************************************************************************
   2    2   *
   3    3   * Module Name: nswalk - Functions for walking the ACPI namespace
   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 ↓ 39 lines elided ↑ open up ↑
  58   58   * FUNCTION:    AcpiNsGetNextNode
  59   59   *
  60   60   * PARAMETERS:  ParentNode          - Parent node whose children we are
  61   61   *                                    getting
  62   62   *              ChildNode           - Previous child that was found.
  63   63   *                                    The NEXT child will be returned
  64   64   *
  65   65   * RETURN:      ACPI_NAMESPACE_NODE - Pointer to the NEXT child or NULL if
  66   66   *                                    none is found.
  67   67   *
  68      - * DESCRIPTION: Return the next peer node within the namespace.  If Handle
  69      - *              is valid, Scope is ignored.  Otherwise, the first node
       68 + * DESCRIPTION: Return the next peer node within the namespace. If Handle
       69 + *              is valid, Scope is ignored. Otherwise, the first node
  70   70   *              within Scope is returned.
  71   71   *
  72   72   ******************************************************************************/
  73   73  
  74   74  ACPI_NAMESPACE_NODE *
  75   75  AcpiNsGetNextNode (
  76   76      ACPI_NAMESPACE_NODE     *ParentNode,
  77   77      ACPI_NAMESPACE_NODE     *ChildNode)
  78   78  {
  79   79      ACPI_FUNCTION_ENTRY ();
↓ open down ↓ 18 lines elided ↑ open up ↑
  98   98   *
  99   99   * PARAMETERS:  Type                - Type of node to be searched for
 100  100   *              ParentNode          - Parent node whose children we are
 101  101   *                                    getting
 102  102   *              ChildNode           - Previous child that was found.
 103  103   *                                    The NEXT child will be returned
 104  104   *
 105  105   * RETURN:      ACPI_NAMESPACE_NODE - Pointer to the NEXT child or NULL if
 106  106   *                                    none is found.
 107  107   *
 108      - * DESCRIPTION: Return the next peer node within the namespace.  If Handle
 109      - *              is valid, Scope is ignored.  Otherwise, the first node
      108 + * DESCRIPTION: Return the next peer node within the namespace. If Handle
      109 + *              is valid, Scope is ignored. Otherwise, the first node
 110  110   *              within Scope is returned.
 111  111   *
 112  112   ******************************************************************************/
 113  113  
 114  114  ACPI_NAMESPACE_NODE *
 115  115  AcpiNsGetNextNodeTyped (
 116  116      ACPI_OBJECT_TYPE        Type,
 117  117      ACPI_NAMESPACE_NODE     *ParentNode,
 118  118      ACPI_NAMESPACE_NODE     *ChildNode)
 119  119  {
↓ open down ↓ 38 lines elided ↑ open up ↑
 158  158  
 159  159  /*******************************************************************************
 160  160   *
 161  161   * FUNCTION:    AcpiNsWalkNamespace
 162  162   *
 163  163   * PARAMETERS:  Type                - ACPI_OBJECT_TYPE to search for
 164  164   *              StartNode           - Handle in namespace where search begins
 165  165   *              MaxDepth            - Depth to which search is to reach
 166  166   *              Flags               - Whether to unlock the NS before invoking
 167  167   *                                    the callback routine
 168      - *              PreOrderVisit       - Called during tree pre-order visit
      168 + *              DescendingCallback  - Called during tree descent
 169  169   *                                    when an object of "Type" is found
 170      - *              PostOrderVisit      - Called during tree post-order visit
      170 + *              AscendingCallback   - Called during tree ascent
 171  171   *                                    when an object of "Type" is found
 172  172   *              Context             - Passed to user function(s) above
 173  173   *              ReturnValue         - from the UserFunction if terminated
 174  174   *                                    early. Otherwise, returns NULL.
 175  175   * RETURNS:     Status
 176  176   *
 177  177   * DESCRIPTION: Performs a modified depth-first walk of the namespace tree,
 178  178   *              starting (and ending) at the node specified by StartHandle.
 179  179   *              The callback function is called whenever a node that matches
 180  180   *              the type parameter is found. If the callback function returns
↓ open down ↓ 7 lines elided ↑ open up ↑
 188  188   *              a compare function, etc.
 189  189   *
 190  190   ******************************************************************************/
 191  191  
 192  192  ACPI_STATUS
 193  193  AcpiNsWalkNamespace (
 194  194      ACPI_OBJECT_TYPE        Type,
 195  195      ACPI_HANDLE             StartNode,
 196  196      UINT32                  MaxDepth,
 197  197      UINT32                  Flags,
 198      -    ACPI_WALK_CALLBACK      PreOrderVisit,
 199      -    ACPI_WALK_CALLBACK      PostOrderVisit,
      198 +    ACPI_WALK_CALLBACK      DescendingCallback,
      199 +    ACPI_WALK_CALLBACK      AscendingCallback,
 200  200      void                    *Context,
 201  201      void                    **ReturnValue)
 202  202  {
 203  203      ACPI_STATUS             Status;
 204  204      ACPI_STATUS             MutexStatus;
 205  205      ACPI_NAMESPACE_NODE     *ChildNode;
 206  206      ACPI_NAMESPACE_NODE     *ParentNode;
 207  207      ACPI_OBJECT_TYPE        ChildType;
 208  208      UINT32                  Level;
 209  209      BOOLEAN                 NodePreviouslyVisited = FALSE;
↓ open down ↓ 57 lines elided ↑ open up ↑
 267  267              if (Flags & ACPI_NS_WALK_UNLOCK)
 268  268              {
 269  269                  MutexStatus = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
 270  270                  if (ACPI_FAILURE (MutexStatus))
 271  271                  {
 272  272                      return_ACPI_STATUS (MutexStatus);
 273  273                  }
 274  274              }
 275  275  
 276  276              /*
 277      -             * Invoke the user function, either pre-order or post-order
      277 +             * Invoke the user function, either descending, ascending,
 278  278               * or both.
 279  279               */
 280  280              if (!NodePreviouslyVisited)
 281  281              {
 282      -                if (PreOrderVisit)
      282 +                if (DescendingCallback)
 283  283                  {
 284      -                    Status = PreOrderVisit (ChildNode, Level,
      284 +                    Status = DescendingCallback (ChildNode, Level,
 285  285                                  Context, ReturnValue);
 286  286                  }
 287  287              }
 288  288              else
 289  289              {
 290      -                if (PostOrderVisit)
      290 +                if (AscendingCallback)
 291  291                  {
 292      -                    Status = PostOrderVisit (ChildNode, Level,
      292 +                    Status = AscendingCallback (ChildNode, Level,
 293  293                                  Context, ReturnValue);
 294  294                  }
 295  295              }
 296  296  
 297  297              if (Flags & ACPI_NS_WALK_UNLOCK)
 298  298              {
 299  299                  MutexStatus = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
 300  300                  if (ACPI_FAILURE (MutexStatus))
 301  301                  {
 302  302                      return_ACPI_STATUS (MutexStatus);
↓ open down ↓ 17 lines elided ↑ open up ↑
 320  320              default:
 321  321  
 322  322                  /* All others are valid exceptions */
 323  323  
 324  324                  return_ACPI_STATUS (Status);
 325  325              }
 326  326          }
 327  327  
 328  328          /*
 329  329           * Depth first search: Attempt to go down another level in the
 330      -         * namespace if we are allowed to.  Don't go any further if we have
      330 +         * namespace if we are allowed to. Don't go any further if we have
 331  331           * reached the caller specified maximum depth or if the user
 332  332           * function has specified that the maximum depth has been reached.
 333  333           */
 334  334          if (!NodePreviouslyVisited &&
 335  335              (Level < MaxDepth) &&
 336  336              (Status != AE_CTRL_DEPTH))
 337  337          {
 338  338              if (ChildNode->Child)
 339  339              {
 340  340                  /* There is at least one child of this node, visit it */
↓ open down ↓ 34 lines elided ↑ open up ↑
 375  375              ParentNode = ParentNode->Parent;
 376  376  
 377  377              NodePreviouslyVisited = TRUE;
 378  378          }
 379  379      }
 380  380  
 381  381      /* Complete walk, not terminated by user function */
 382  382  
 383  383      return_ACPI_STATUS (AE_OK);
 384  384  }
 385      -
 386      -
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX