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/exdebug.c
          +++ new/usr/src/common/acpica/components/executer/exdebug.c
   1    1  /******************************************************************************
   2    2   *
   3    3   * Module Name: exdebug - Support for stores to the AML Debug Object
   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
  19   19   *    ("Disclaimer") and any redistribution must be conditioned upon
  20   20   *    including a substantially similar Disclaimer requirement for further
  21   21   *    binary redistribution.
  22   22   * 3. Neither the names of the above-listed copyright holders nor the names
  23   23   *    of any contributors may be used to endorse or promote products derived
  24   24   *    from this software without specific prior written permission.
  25   25   *
  26   26   * Alternatively, this software may be distributed under the terms of the
  27   27   * GNU General Public License ("GPL") version 2 as published by the Free
  28   28   * Software Foundation.
  29   29   *
  30   30   * NO WARRANTY
  31   31   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  32   32   * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  33   33   * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
  34   34   * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  35   35   * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  36   36   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  37   37   * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  38   38   * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  39   39   * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  40   40   * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  41   41   * POSSIBILITY OF SUCH DAMAGES.
  42   42   */
  43   43  
  44   44  #define __EXDEBUG_C__
  45   45  
  46   46  #include "acpi.h"
  47   47  #include "accommon.h"
  48   48  #include "acinterp.h"
  49   49  
  50   50  
  51   51  #define _COMPONENT          ACPI_EXECUTER
  52   52          ACPI_MODULE_NAME    ("exdebug")
  53   53  
  54   54  
  55   55  #ifndef ACPI_NO_ERROR_MESSAGES
  56   56  /*******************************************************************************
  57   57   *
  58   58   * FUNCTION:    AcpiExDoDebugObject
  59   59   *
  60   60   * PARAMETERS:  SourceDesc          - Object to be output to "Debug Object"
  61   61   *              Level               - Indentation level (used for packages)
  62   62   *              Index               - Current package element, zero if not pkg
  63   63   *
  64   64   * RETURN:      None
  65   65   *
  66   66   * DESCRIPTION: Handles stores to the AML Debug Object. For example:
  67   67   *              Store(INT1, Debug)
  68   68   *
  69   69   * This function is not compiled if ACPI_NO_ERROR_MESSAGES is set.
  70   70   *
  71   71   * This function is only enabled if AcpiGbl_EnableAmlDebugObject is set, or
  72   72   * if ACPI_LV_DEBUG_OBJECT is set in the AcpiDbgLevel. Thus, in the normal
  73   73   * operational case, stores to the debug object are ignored but can be easily
  74   74   * enabled if necessary.
  75   75   *
  76   76   ******************************************************************************/
  77   77  
  78   78  void
  79   79  AcpiExDoDebugObject (
  80   80      ACPI_OPERAND_OBJECT     *SourceDesc,
  81   81      UINT32                  Level,
  82   82      UINT32                  Index)
  83   83  {
  84   84      UINT32                  i;
  85   85  
  86   86  
  87   87      ACPI_FUNCTION_TRACE_PTR (ExDoDebugObject, SourceDesc);
  88   88  
  89   89  
  90   90      /* Output must be enabled via the DebugObject global or the DbgLevel */
  91   91  
  92   92      if (!AcpiGbl_EnableAmlDebugObject &&
  93   93          !(AcpiDbgLevel & ACPI_LV_DEBUG_OBJECT))
  94   94      {
  95   95          return_VOID;
  96   96      }
  97   97  
  98   98      /*
  99   99       * Print line header as long as we are not in the middle of an
 100  100       * object display
 101  101       */
 102  102      if (!((Level > 0) && Index == 0))
 103  103      {
 104  104          AcpiOsPrintf ("[ACPI Debug] %*s", Level, " ");
 105  105      }
 106  106  
 107  107      /* Display the index for package output only */
 108  108  
 109  109      if (Index > 0)
 110  110      {
 111  111         AcpiOsPrintf ("(%.2u) ", Index-1);
 112  112      }
 113  113  
 114  114      if (!SourceDesc)
 115  115      {
 116  116          AcpiOsPrintf ("[Null Object]\n");
 117  117          return_VOID;
 118  118      }
 119  119  
 120  120      if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc) == ACPI_DESC_TYPE_OPERAND)
 121  121      {
 122  122          AcpiOsPrintf ("%s ", AcpiUtGetObjectTypeName (SourceDesc));
 123  123  
 124  124          if (!AcpiUtValidInternalObject (SourceDesc))
 125  125          {
 126  126             AcpiOsPrintf ("%p, Invalid Internal Object!\n", SourceDesc);
 127  127             return_VOID;
 128  128          }
 129  129      }
 130  130      else if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc) == ACPI_DESC_TYPE_NAMED)
 131  131      {
 132  132          AcpiOsPrintf ("%s: %p\n",
 133  133              AcpiUtGetTypeName (((ACPI_NAMESPACE_NODE *) SourceDesc)->Type),
 134  134              SourceDesc);
 135  135          return_VOID;
 136  136      }
 137  137      else
 138  138      {
 139  139          return_VOID;
 140  140      }
 141  141  
 142  142      /* SourceDesc is of type ACPI_DESC_TYPE_OPERAND */
 143  143  
 144  144      switch (SourceDesc->Common.Type)
 145  145      {
 146  146      case ACPI_TYPE_INTEGER:
 147  147  
 148  148          /* Output correct integer width */
 149  149  
 150  150          if (AcpiGbl_IntegerByteWidth == 4)
 151  151          {
 152  152              AcpiOsPrintf ("0x%8.8X\n",
 153  153                  (UINT32) SourceDesc->Integer.Value);
 154  154          }
  
    | ↓ open down ↓ | 136 lines elided | ↑ open up ↑ | 
 155  155          else
 156  156          {
 157  157              AcpiOsPrintf ("0x%8.8X%8.8X\n",
 158  158                  ACPI_FORMAT_UINT64 (SourceDesc->Integer.Value));
 159  159          }
 160  160          break;
 161  161  
 162  162      case ACPI_TYPE_BUFFER:
 163  163  
 164  164          AcpiOsPrintf ("[0x%.2X]\n", (UINT32) SourceDesc->Buffer.Length);
 165      -        AcpiUtDumpBuffer2 (SourceDesc->Buffer.Pointer,
      165 +        AcpiUtDumpBuffer (SourceDesc->Buffer.Pointer,
 166  166              (SourceDesc->Buffer.Length < 256) ?
 167      -                SourceDesc->Buffer.Length : 256, DB_BYTE_DISPLAY);
      167 +                SourceDesc->Buffer.Length : 256, DB_BYTE_DISPLAY, 0);
 168  168          break;
 169  169  
 170  170      case ACPI_TYPE_STRING:
 171  171  
 172  172          AcpiOsPrintf ("[0x%.2X] \"%s\"\n",
 173  173              SourceDesc->String.Length, SourceDesc->String.Pointer);
 174  174          break;
 175  175  
 176  176      case ACPI_TYPE_PACKAGE:
 177  177  
 178  178          AcpiOsPrintf ("[Contains 0x%.2X Elements]\n",
 179  179              SourceDesc->Package.Count);
 180  180  
 181  181          /* Output the entire contents of the package */
 182  182  
 183  183          for (i = 0; i < SourceDesc->Package.Count; i++)
 184  184          {
 185  185              AcpiExDoDebugObject (SourceDesc->Package.Elements[i],
 186  186                  Level+4, i+1);
 187  187          }
 188  188          break;
 189  189  
 190  190      case ACPI_TYPE_LOCAL_REFERENCE:
 191  191  
 192  192          AcpiOsPrintf ("[%s] ", AcpiUtGetReferenceName (SourceDesc));
 193  193  
 194  194          /* Decode the reference */
 195  195  
 196  196          switch (SourceDesc->Reference.Class)
 197  197          {
  
    | ↓ open down ↓ | 20 lines elided | ↑ open up ↑ | 
 198  198          case ACPI_REFCLASS_INDEX:
 199  199  
 200  200              AcpiOsPrintf ("0x%X\n", SourceDesc->Reference.Value);
 201  201              break;
 202  202  
 203  203          case ACPI_REFCLASS_TABLE:
 204  204  
 205  205              /* Case for DdbHandle */
 206  206  
 207  207              AcpiOsPrintf ("Table Index 0x%X\n", SourceDesc->Reference.Value);
 208      -            return;
      208 +            return_VOID;
 209  209  
 210  210          default:
      211 +
 211  212              break;
 212  213          }
 213  214  
 214  215          AcpiOsPrintf ("  ");
 215  216  
 216  217          /* Check for valid node first, then valid object */
 217  218  
 218  219          if (SourceDesc->Reference.Node)
 219  220          {
 220  221              if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc->Reference.Node) !=
 221  222                      ACPI_DESC_TYPE_NAMED)
 222  223              {
 223  224                  AcpiOsPrintf (" %p - Not a valid namespace node\n",
 224  225                      SourceDesc->Reference.Node);
 225  226              }
 226  227              else
 227  228              {
 228  229                  AcpiOsPrintf ("Node %p [%4.4s] ", SourceDesc->Reference.Node,
 229  230                      (SourceDesc->Reference.Node)->Name.Ascii);
 230  231  
 231  232                  switch ((SourceDesc->Reference.Node)->Type)
 232  233                  {
 233  234                  /* These types have no attached object */
  
    | ↓ open down ↓ | 13 lines elided | ↑ open up ↑ | 
 234  235  
 235  236                  case ACPI_TYPE_DEVICE:
 236  237                      AcpiOsPrintf ("Device\n");
 237  238                      break;
 238  239  
 239  240                  case ACPI_TYPE_THERMAL:
 240  241                      AcpiOsPrintf ("Thermal Zone\n");
 241  242                      break;
 242  243  
 243  244                  default:
      245 +
 244  246                      AcpiExDoDebugObject ((SourceDesc->Reference.Node)->Object,
 245  247                          Level+4, 0);
 246  248                      break;
 247  249                  }
 248  250              }
 249  251          }
 250  252          else if (SourceDesc->Reference.Object)
 251  253          {
 252  254              if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc->Reference.Object) ==
 253  255                      ACPI_DESC_TYPE_NAMED)
 254  256              {
 255  257                  AcpiExDoDebugObject (((ACPI_NAMESPACE_NODE *)
 256  258                      SourceDesc->Reference.Object)->Object,
 257  259                      Level+4, 0);
 258  260              }
 259  261              else
 260  262              {
 261  263                  AcpiExDoDebugObject (SourceDesc->Reference.Object,
 262  264                      Level+4, 0);
 263  265              }
 264  266          }
 265  267          break;
 266  268  
  
    | ↓ open down ↓ | 13 lines elided | ↑ open up ↑ | 
 267  269      default:
 268  270  
 269  271          AcpiOsPrintf ("%p\n", SourceDesc);
 270  272          break;
 271  273      }
 272  274  
 273  275      ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, "\n"));
 274  276      return_VOID;
 275  277  }
 276  278  #endif
 277      -
 278      -
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX