Print this page
    
acpica-unix2-20130823
PANKOVs restructure
    
      
        | Split | Close | 
      | Expand all | 
      | Collapse all | 
    
    
          --- old/usr/src/uts/intel/io/acpica/disassembler/dmutils.c
          +++ new/usr/src/common/acpica/components/disassembler/dmutils.c
   1    1  /*******************************************************************************
   2    2   *
   3    3   * Module Name: dmutils - AML disassembler utilities
   4    4   *
   5    5   ******************************************************************************/
   6    6  
   7    7  /*
   8      - * Copyright (C) 2000 - 2011, Intel Corp.
        8 + * Copyright (C) 2000 - 2013, 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  
  45   45  #include "acpi.h"
  46   46  #include "accommon.h"
  47   47  #include "amlcode.h"
  48   48  #include "acdisasm.h"
  49   49  
  50   50  #ifdef ACPI_ASL_COMPILER
  51   51  #include <acnamesp.h>
  52   52  #endif
  53   53  
  54   54  #ifdef ACPI_DISASSEMBLER
  55   55  
  56   56  #define _COMPONENT          ACPI_CA_DEBUGGER
  57   57          ACPI_MODULE_NAME    ("dmutils")
  58   58  
  59   59  
  60   60  /* Data used in keeping track of fields */
  61   61  #if 0
  62   62  const char                      *AcpiGbl_FENames[] =
  63   63  {
  64   64      "skip",
  65   65      "?access?"
  66   66  };              /* FE = Field Element */
  67   67  #endif
  68   68  
  69   69  /* Operators for Match() */
  70   70  
  71   71  const char                      *AcpiGbl_MatchOps[] =
  72   72  {
  73   73      "MTR",
  74   74      "MEQ",
  75   75      "MLE",
  76   76      "MLT",
  77   77      "MGE",
  78   78      "MGT"
  79   79  };
  80   80  
  81   81  /* Access type decoding */
  82   82  
  83   83  const char                      *AcpiGbl_AccessTypes[] =
  84   84  {
  85   85      "AnyAcc",
  86   86      "ByteAcc",
  87   87      "WordAcc",
  88   88      "DWordAcc",
  89   89      "QWordAcc",
  90   90      "BufferAcc",
  91   91      "InvalidAccType",
  92   92      "InvalidAccType"
  93   93  };
  94   94  
  95   95  /* Lock rule decoding */
  96   96  
  97   97  const char                      *AcpiGbl_LockRule[] =
  98   98  {
  99   99      "NoLock",
 100  100      "Lock"
 101  101  };
 102  102  
 103  103  /* Update rule decoding */
 104  104  
 105  105  const char                      *AcpiGbl_UpdateRules[] =
 106  106  {
 107  107      "Preserve",
 108  108      "WriteAsOnes",
 109  109      "WriteAsZeros",
 110  110      "InvalidUpdateRule"
 111  111  };
 112  112  
 113  113  /* Strings used to decode resource descriptors */
 114  114  
 115  115  const char                      *AcpiGbl_WordDecode[] =
 116  116  {
 117  117      "Memory",
 118  118      "IO",
 119  119      "BusNumber",
 120  120      "UnknownResourceType"
 121  121  };
 122  122  
 123  123  const char                      *AcpiGbl_IrqDecode[] =
 124  124  {
 125  125      "IRQNoFlags",
 126  126      "IRQ"
 127  127  };
  
    | ↓ open down ↓ | 109 lines elided | ↑ open up ↑ | 
 128  128  
 129  129  
 130  130  /*******************************************************************************
 131  131   *
 132  132   * FUNCTION:    AcpiDmDecodeAttribute
 133  133   *
 134  134   * PARAMETERS:  Attribute       - Attribute field of AccessAs keyword
 135  135   *
 136  136   * RETURN:      None
 137  137   *
 138      - * DESCRIPTION: Decode the AccessAs attribute byte.  (Mostly SMBus stuff)
      138 + * DESCRIPTION: Decode the AccessAs attribute byte. (Mostly SMBus and
      139 + *              GenericSerialBus stuff.)
 139  140   *
 140  141   ******************************************************************************/
 141  142  
 142  143  void
 143  144  AcpiDmDecodeAttribute (
 144  145      UINT8                   Attribute)
 145  146  {
 146  147  
 147  148      switch (Attribute)
 148  149      {
 149      -    case AML_FIELD_ATTRIB_SMB_QUICK:
      150 +    case AML_FIELD_ATTRIB_QUICK:
 150  151  
 151      -        AcpiOsPrintf ("SMBQuick");
      152 +        AcpiOsPrintf ("AttribQuick");
 152  153          break;
 153  154  
 154      -    case AML_FIELD_ATTRIB_SMB_SEND_RCV:
      155 +    case AML_FIELD_ATTRIB_SEND_RCV:
 155  156  
 156      -        AcpiOsPrintf ("SMBSendReceive");
      157 +        AcpiOsPrintf ("AttribSendReceive");
 157  158          break;
 158  159  
 159      -    case AML_FIELD_ATTRIB_SMB_BYTE:
      160 +    case AML_FIELD_ATTRIB_BYTE:
 160  161  
 161      -        AcpiOsPrintf ("SMBByte");
      162 +        AcpiOsPrintf ("AttribByte");
 162  163          break;
 163  164  
 164      -    case AML_FIELD_ATTRIB_SMB_WORD:
      165 +    case AML_FIELD_ATTRIB_WORD:
 165  166  
 166      -        AcpiOsPrintf ("SMBWord");
      167 +        AcpiOsPrintf ("AttribWord");
 167  168          break;
 168  169  
 169      -    case AML_FIELD_ATTRIB_SMB_WORD_CALL:
      170 +    case AML_FIELD_ATTRIB_BLOCK:
 170  171  
 171      -        AcpiOsPrintf ("SMBProcessCall");
      172 +        AcpiOsPrintf ("AttribBlock");
 172  173          break;
 173  174  
 174      -    case AML_FIELD_ATTRIB_SMB_BLOCK:
      175 +    case AML_FIELD_ATTRIB_MULTIBYTE:
 175  176  
 176      -        AcpiOsPrintf ("SMBBlock");
      177 +        AcpiOsPrintf ("AttribBytes");
 177  178          break;
 178  179  
 179      -    case AML_FIELD_ATTRIB_SMB_BLOCK_CALL:
      180 +    case AML_FIELD_ATTRIB_WORD_CALL:
 180  181  
 181      -        AcpiOsPrintf ("SMBBlockProcessCall");
      182 +        AcpiOsPrintf ("AttribProcessCall");
 182  183          break;
 183  184  
      185 +    case AML_FIELD_ATTRIB_BLOCK_CALL:
      186 +
      187 +        AcpiOsPrintf ("AttribBlockProcessCall");
      188 +        break;
      189 +
      190 +    case AML_FIELD_ATTRIB_RAW_BYTES:
      191 +
      192 +        AcpiOsPrintf ("AttribRawBytes");
      193 +        break;
      194 +
      195 +    case AML_FIELD_ATTRIB_RAW_PROCESS:
      196 +
      197 +        AcpiOsPrintf ("AttribRawProcessBytes");
      198 +        break;
      199 +
 184  200      default:
 185  201  
 186      -        AcpiOsPrintf ("0x%.2X", Attribute);
      202 +        /* A ByteConst is allowed by the grammar */
      203 +
      204 +        AcpiOsPrintf ("0x%2.2X", Attribute);
 187  205          break;
 188  206      }
 189  207  }
 190  208  
 191  209  
 192  210  /*******************************************************************************
 193  211   *
 194  212   * FUNCTION:    AcpiDmIndent
 195  213   *
 196  214   * PARAMETERS:  Level               - Current source code indentation level
 197  215   *
 198  216   * RETURN:      None
 199  217   *
 200  218   * DESCRIPTION: Indent 4 spaces per indentation level.
 201  219   *
 202  220   ******************************************************************************/
 203  221  
 204  222  void
 205  223  AcpiDmIndent (
 206  224      UINT32                  Level)
 207  225  {
 208  226  
 209  227      if (!Level)
 210  228      {
 211  229          return;
 212  230      }
 213  231  
 214  232      AcpiOsPrintf ("%*.s", ACPI_MUL_4 (Level), " ");
 215  233  }
 216  234  
 217  235  
 218  236  /*******************************************************************************
 219  237   *
 220  238   * FUNCTION:    AcpiDmCommaIfListMember
 221  239   *
 222  240   * PARAMETERS:  Op              - Current operator/operand
 223  241   *
 224  242   * RETURN:      TRUE if a comma was inserted
 225  243   *
 226  244   * DESCRIPTION: Insert a comma if this Op is a member of an argument list.
  
    | ↓ open down ↓ | 30 lines elided | ↑ open up ↑ | 
 227  245   *
 228  246   ******************************************************************************/
 229  247  
 230  248  BOOLEAN
 231  249  AcpiDmCommaIfListMember (
 232  250      ACPI_PARSE_OBJECT       *Op)
 233  251  {
 234  252  
 235  253      if (!Op->Common.Next)
 236  254      {
 237      -        return FALSE;
      255 +        return (FALSE);
 238  256      }
 239  257  
 240  258      if (AcpiDmListType (Op->Common.Parent) & BLOCK_COMMA_LIST)
 241  259      {
 242  260          /* Check for a NULL target operand */
 243  261  
 244  262          if ((Op->Common.Next->Common.AmlOpcode == AML_INT_NAMEPATH_OP) &&
 245  263              (!Op->Common.Next->Common.Value.String))
 246  264          {
 247  265              /*
 248  266               * To handle the Divide() case where there are two optional
 249      -             * targets, look ahead one more op.  If null, this null target
 250      -             * is the one and only target -- no comma needed.  Otherwise,
      267 +             * targets, look ahead one more op. If null, this null target
      268 +             * is the one and only target -- no comma needed. Otherwise,
 251  269               * we need a comma to prepare for the next target.
 252  270               */
 253  271              if (!Op->Common.Next->Common.Next)
 254  272              {
 255      -                return FALSE;
      273 +                return (FALSE);
 256  274              }
 257  275          }
 258  276  
 259  277          if ((Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST) &&
 260  278              (!(Op->Common.Next->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)))
 261  279          {
 262      -            return FALSE;
      280 +            return (FALSE);
 263  281          }
 264  282  
 265  283          AcpiOsPrintf (", ");
 266  284          return (TRUE);
 267  285      }
 268  286  
 269  287      else if ((Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST) &&
 270  288               (Op->Common.Next->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST))
 271  289      {
 272  290          AcpiOsPrintf (", ");
 273  291          return (TRUE);
 274  292      }
 275  293  
 276  294      return (FALSE);
 277  295  }
 278  296  
 279  297  
 280  298  /*******************************************************************************
 281  299   *
 282  300   * FUNCTION:    AcpiDmCommaIfFieldMember
 283  301   *
 284  302   * PARAMETERS:  Op              - Current operator/operand
 285  303   *
 286  304   * RETURN:      None
 287  305   *
 288  306   * DESCRIPTION: Insert a comma if this Op is a member of a Field argument list.
 289  307   *
 290  308   ******************************************************************************/
 291  309  
 292  310  void
 293  311  AcpiDmCommaIfFieldMember (
 294  312      ACPI_PARSE_OBJECT       *Op)
 295  313  {
 296  314  
 297  315      if (Op->Common.Next)
 298  316      {
 299  317          AcpiOsPrintf (", ");
 300  318      }
 301  319  }
 302  320  
 303  321  #endif
  
    | ↓ open down ↓ | 31 lines elided | ↑ open up ↑ | 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX