Print this page
acpica-unix2-20130823
PANKOVs restructure
   1 /*******************************************************************************
   2  *
   3  * Module Name: dmutils - AML disassembler utilities
   4  *
   5  ******************************************************************************/
   6 
   7 /*
   8  * Copyright (C) 2000 - 2011, Intel Corp.
   9  * All rights reserved.
  10  *
  11  * Redistribution and use in source and binary forms, with or without
  12  * modification, are permitted provided that the following conditions
  13  * are met:
  14  * 1. Redistributions of source code must retain the above copyright
  15  *    notice, this list of conditions, and the following disclaimer,
  16  *    without modification.
  17  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  18  *    substantially similar to the "NO WARRANTY" disclaimer below
  19  *    ("Disclaimer") and any redistribution must be conditioned upon
  20  *    including a substantially similar Disclaimer requirement for further
  21  *    binary redistribution.
  22  * 3. Neither the names of the above-listed copyright holders nor the names
  23  *    of any contributors may be used to endorse or promote products derived
  24  *    from this software without specific prior written permission.
  25  *
  26  * Alternatively, this software may be distributed under the terms of the
  27  * GNU General Public License ("GPL") version 2 as published by the Free
  28  * Software Foundation.


 118     "IO",
 119     "BusNumber",
 120     "UnknownResourceType"
 121 };
 122 
 123 const char                      *AcpiGbl_IrqDecode[] =
 124 {
 125     "IRQNoFlags",
 126     "IRQ"
 127 };
 128 
 129 
 130 /*******************************************************************************
 131  *
 132  * FUNCTION:    AcpiDmDecodeAttribute
 133  *
 134  * PARAMETERS:  Attribute       - Attribute field of AccessAs keyword
 135  *
 136  * RETURN:      None
 137  *
 138  * DESCRIPTION: Decode the AccessAs attribute byte.  (Mostly SMBus stuff)

 139  *
 140  ******************************************************************************/
 141 
 142 void
 143 AcpiDmDecodeAttribute (
 144     UINT8                   Attribute)
 145 {
 146 
 147     switch (Attribute)
 148     {
 149     case AML_FIELD_ATTRIB_SMB_QUICK:
 150 
 151         AcpiOsPrintf ("SMBQuick");
 152         break;
 153 
 154     case AML_FIELD_ATTRIB_SMB_SEND_RCV:
 155 
 156         AcpiOsPrintf ("SMBSendReceive");
 157         break;
 158 
 159     case AML_FIELD_ATTRIB_SMB_BYTE:
 160 
 161         AcpiOsPrintf ("SMBByte");
 162         break;
 163 
 164     case AML_FIELD_ATTRIB_SMB_WORD:
 165 
 166         AcpiOsPrintf ("SMBWord");
 167         break;
 168 
 169     case AML_FIELD_ATTRIB_SMB_WORD_CALL:
 170 
 171         AcpiOsPrintf ("SMBProcessCall");
 172         break;
 173 
 174     case AML_FIELD_ATTRIB_SMB_BLOCK:
 175 
 176         AcpiOsPrintf ("SMBBlock");
 177         break;
 178 
 179     case AML_FIELD_ATTRIB_SMB_BLOCK_CALL:
 180 
 181         AcpiOsPrintf ("SMBBlockProcessCall");
 182         break;
 183 















 184     default:
 185 
 186         AcpiOsPrintf ("0x%.2X", Attribute);


 187         break;
 188     }
 189 }
 190 
 191 
 192 /*******************************************************************************
 193  *
 194  * FUNCTION:    AcpiDmIndent
 195  *
 196  * PARAMETERS:  Level               - Current source code indentation level
 197  *
 198  * RETURN:      None
 199  *
 200  * DESCRIPTION: Indent 4 spaces per indentation level.
 201  *
 202  ******************************************************************************/
 203 
 204 void
 205 AcpiDmIndent (
 206     UINT32                  Level)


 217 
 218 /*******************************************************************************
 219  *
 220  * FUNCTION:    AcpiDmCommaIfListMember
 221  *
 222  * PARAMETERS:  Op              - Current operator/operand
 223  *
 224  * RETURN:      TRUE if a comma was inserted
 225  *
 226  * DESCRIPTION: Insert a comma if this Op is a member of an argument list.
 227  *
 228  ******************************************************************************/
 229 
 230 BOOLEAN
 231 AcpiDmCommaIfListMember (
 232     ACPI_PARSE_OBJECT       *Op)
 233 {
 234 
 235     if (!Op->Common.Next)
 236     {
 237         return FALSE;
 238     }
 239 
 240     if (AcpiDmListType (Op->Common.Parent) & BLOCK_COMMA_LIST)
 241     {
 242         /* Check for a NULL target operand */
 243 
 244         if ((Op->Common.Next->Common.AmlOpcode == AML_INT_NAMEPATH_OP) &&
 245             (!Op->Common.Next->Common.Value.String))
 246         {
 247             /*
 248              * 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,
 251              * we need a comma to prepare for the next target.
 252              */
 253             if (!Op->Common.Next->Common.Next)
 254             {
 255                 return FALSE;
 256             }
 257         }
 258 
 259         if ((Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST) &&
 260             (!(Op->Common.Next->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)))
 261         {
 262             return FALSE;
 263         }
 264 
 265         AcpiOsPrintf (", ");
 266         return (TRUE);
 267     }
 268 
 269     else if ((Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST) &&
 270              (Op->Common.Next->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST))
 271     {
 272         AcpiOsPrintf (", ");
 273         return (TRUE);
 274     }
 275 
 276     return (FALSE);
 277 }
 278 
 279 
 280 /*******************************************************************************
 281  *
 282  * FUNCTION:    AcpiDmCommaIfFieldMember


   1 /*******************************************************************************
   2  *
   3  * Module Name: dmutils - AML disassembler utilities
   4  *
   5  ******************************************************************************/
   6 
   7 /*
   8  * Copyright (C) 2000 - 2013, Intel Corp.
   9  * All rights reserved.
  10  *
  11  * Redistribution and use in source and binary forms, with or without
  12  * modification, are permitted provided that the following conditions
  13  * are met:
  14  * 1. Redistributions of source code must retain the above copyright
  15  *    notice, this list of conditions, and the following disclaimer,
  16  *    without modification.
  17  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  18  *    substantially similar to the "NO WARRANTY" disclaimer below
  19  *    ("Disclaimer") and any redistribution must be conditioned upon
  20  *    including a substantially similar Disclaimer requirement for further
  21  *    binary redistribution.
  22  * 3. Neither the names of the above-listed copyright holders nor the names
  23  *    of any contributors may be used to endorse or promote products derived
  24  *    from this software without specific prior written permission.
  25  *
  26  * Alternatively, this software may be distributed under the terms of the
  27  * GNU General Public License ("GPL") version 2 as published by the Free
  28  * Software Foundation.


 118     "IO",
 119     "BusNumber",
 120     "UnknownResourceType"
 121 };
 122 
 123 const char                      *AcpiGbl_IrqDecode[] =
 124 {
 125     "IRQNoFlags",
 126     "IRQ"
 127 };
 128 
 129 
 130 /*******************************************************************************
 131  *
 132  * FUNCTION:    AcpiDmDecodeAttribute
 133  *
 134  * PARAMETERS:  Attribute       - Attribute field of AccessAs keyword
 135  *
 136  * RETURN:      None
 137  *
 138  * DESCRIPTION: Decode the AccessAs attribute byte. (Mostly SMBus and
 139  *              GenericSerialBus stuff.)
 140  *
 141  ******************************************************************************/
 142 
 143 void
 144 AcpiDmDecodeAttribute (
 145     UINT8                   Attribute)
 146 {
 147 
 148     switch (Attribute)
 149     {
 150     case AML_FIELD_ATTRIB_QUICK:
 151 
 152         AcpiOsPrintf ("AttribQuick");
 153         break;
 154 
 155     case AML_FIELD_ATTRIB_SEND_RCV:
 156 
 157         AcpiOsPrintf ("AttribSendReceive");
 158         break;
 159 
 160     case AML_FIELD_ATTRIB_BYTE:
 161 
 162         AcpiOsPrintf ("AttribByte");
 163         break;
 164 
 165     case AML_FIELD_ATTRIB_WORD:
 166 
 167         AcpiOsPrintf ("AttribWord");
 168         break;
 169 
 170     case AML_FIELD_ATTRIB_BLOCK:
 171 
 172         AcpiOsPrintf ("AttribBlock");
 173         break;
 174 
 175     case AML_FIELD_ATTRIB_MULTIBYTE:
 176 
 177         AcpiOsPrintf ("AttribBytes");
 178         break;
 179 
 180     case AML_FIELD_ATTRIB_WORD_CALL:
 181 
 182         AcpiOsPrintf ("AttribProcessCall");
 183         break;
 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 
 200     default:
 201 
 202         /* A ByteConst is allowed by the grammar */
 203 
 204         AcpiOsPrintf ("0x%2.2X", Attribute);
 205         break;
 206     }
 207 }
 208 
 209 
 210 /*******************************************************************************
 211  *
 212  * FUNCTION:    AcpiDmIndent
 213  *
 214  * PARAMETERS:  Level               - Current source code indentation level
 215  *
 216  * RETURN:      None
 217  *
 218  * DESCRIPTION: Indent 4 spaces per indentation level.
 219  *
 220  ******************************************************************************/
 221 
 222 void
 223 AcpiDmIndent (
 224     UINT32                  Level)


 235 
 236 /*******************************************************************************
 237  *
 238  * FUNCTION:    AcpiDmCommaIfListMember
 239  *
 240  * PARAMETERS:  Op              - Current operator/operand
 241  *
 242  * RETURN:      TRUE if a comma was inserted
 243  *
 244  * DESCRIPTION: Insert a comma if this Op is a member of an argument list.
 245  *
 246  ******************************************************************************/
 247 
 248 BOOLEAN
 249 AcpiDmCommaIfListMember (
 250     ACPI_PARSE_OBJECT       *Op)
 251 {
 252 
 253     if (!Op->Common.Next)
 254     {
 255         return (FALSE);
 256     }
 257 
 258     if (AcpiDmListType (Op->Common.Parent) & BLOCK_COMMA_LIST)
 259     {
 260         /* Check for a NULL target operand */
 261 
 262         if ((Op->Common.Next->Common.AmlOpcode == AML_INT_NAMEPATH_OP) &&
 263             (!Op->Common.Next->Common.Value.String))
 264         {
 265             /*
 266              * To handle the Divide() case where there are two optional
 267              * targets, look ahead one more op. If null, this null target
 268              * is the one and only target -- no comma needed. Otherwise,
 269              * we need a comma to prepare for the next target.
 270              */
 271             if (!Op->Common.Next->Common.Next)
 272             {
 273                 return (FALSE);
 274             }
 275         }
 276 
 277         if ((Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST) &&
 278             (!(Op->Common.Next->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)))
 279         {
 280             return (FALSE);
 281         }
 282 
 283         AcpiOsPrintf (", ");
 284         return (TRUE);
 285     }
 286 
 287     else if ((Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST) &&
 288              (Op->Common.Next->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST))
 289     {
 290         AcpiOsPrintf (", ");
 291         return (TRUE);
 292     }
 293 
 294     return (FALSE);
 295 }
 296 
 297 
 298 /*******************************************************************************
 299  *
 300  * FUNCTION:    AcpiDmCommaIfFieldMember