Print this page
acpica-unix2-20130823
PANKOVs restructure

@@ -3,11 +3,11 @@
  * Module Name: dmwalk - AML disassembly tree walk
  *
  ******************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2013, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:

@@ -439,11 +439,35 @@
     {
             /*
              * This is a first-level element of a term list,
              * indent a new line
              */
+            switch (Op->Common.AmlOpcode)
+            {
+            case AML_NOOP_OP:
+                /*
+                 * Optionally just ignore this opcode. Some tables use
+                 * NoOp opcodes for "padding" out packages that the BIOS
+                 * changes dynamically. This can leave hundreds or
+                 * thousands of NoOp opcodes that if disassembled,
+                 * cannot be compiled because they are syntactically
+                 * incorrect.
+                 */
+                if (AcpiGbl_IgnoreNoopOperator)
+                {
+                    Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
+                    return (AE_OK);
+                }
+
+                /* Fallthrough */
+
+            default:
+
             AcpiDmIndent (Level);
+                break;
+            }
+
             Info->LastLevel = Level;
             Info->Count = 0;
     }
 
     /*

@@ -451,11 +475,11 @@
      * too long. When the limit is hit, start a new line at the previous
      * indent plus one. A better but more expensive mechanism would be to
      * keep track of the current column.
      */
     Info->Count++;
-    if (Info->Count /*+Info->LastLevel*/ > 10)
+    if (Info->Count /* +Info->LastLevel */ > 10)
     {
         Info->Count = 0;
         AcpiOsPrintf ("\n");
         AcpiDmIndent (Info->LastLevel + 1);
     }

@@ -462,11 +486,12 @@
 
     /* Print the opcode name */
 
     AcpiDmDisassembleOneOp (NULL, Info, Op);
 
-    if (Op->Common.DisasmOpcode == ACPI_DASM_LNOT_PREFIX)
+    if ((Op->Common.DisasmOpcode == ACPI_DASM_LNOT_PREFIX) ||
+        (Op->Common.AmlOpcode == AML_INT_CONNECTION_OP))
     {
         return (AE_OK);
     }
 
     if ((Op->Common.AmlOpcode == AML_NAME_OP) ||

@@ -530,10 +555,14 @@
             {
             case AML_METHOD_OP:
 
                 AcpiDmMethodFlags (Op);
                 AcpiOsPrintf (")");
+
+                /* Emit description comment for Method() with a predefined ACPI name */
+
+                AcpiDmPredefinedDescription (Op);
                 break;
 
 
             case AML_NAME_OP:
 

@@ -600,11 +629,12 @@
                 break;
 
 
             default:
 
-                AcpiOsPrintf ("*** Unhandled named opcode %X\n", Op->Common.AmlOpcode);
+                AcpiOsPrintf ("*** Unhandled named opcode %X\n",
+                    Op->Common.AmlOpcode);
                 break;
             }
         }
 
         else switch (Op->Common.AmlOpcode)

@@ -641,11 +671,12 @@
                  * eliminates newline in the output.
                  */
                 NextOp = NextOp->Common.Next;
 
                 Info->Flags = ACPI_PARSEOP_PARAMLIST;
-                AcpiDmWalkParseTree (NextOp, AcpiDmDescendingOp, AcpiDmAscendingOp, Info);
+                AcpiDmWalkParseTree (NextOp, AcpiDmDescendingOp,
+                    AcpiDmAscendingOp, Info);
                 Info->Flags = 0;
                 Info->Level = Level;
 
                 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
                 AcpiOsPrintf (", ");

@@ -667,11 +698,10 @@
             }
 
             AcpiDmFieldFlags (NextOp);
             break;
 
-
         case AML_BUFFER_OP:
 
             /* The next op is the size parameter */
 
             NextOp = AcpiPsGetDepthNext (NULL, Op);

@@ -688,11 +718,17 @@
                  * We have a resource list.  Don't need to output
                  * the buffer size Op.  Open up a new block
                  */
                 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
                 NextOp = NextOp->Common.Next;
-                AcpiOsPrintf (")\n");
+                AcpiOsPrintf (")");
+
+                /* Emit description comment for Name() with a predefined ACPI name */
+
+                AcpiDmPredefinedDescription (Op->Asl.Parent);
+
+                AcpiOsPrintf ("\n");
                 AcpiDmIndent (Info->Level);
                 AcpiOsPrintf ("{\n");
                 return (AE_OK);
             }
 

@@ -699,11 +735,10 @@
             /* Normal Buffer, mark size as in the parameter list */
 
             NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
             return (AE_OK);
 
-
         case AML_VAR_PACKAGE_OP:
         case AML_IF_OP:
         case AML_WHILE_OP:
 
             /* The next op is the size or predicate parameter */

@@ -713,29 +748,26 @@
             {
                 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
             }
             return (AE_OK);
 
-
         case AML_PACKAGE_OP:
 
-            /* The next op is the size or predicate parameter */
+            /* The next op is the size parameter */
 
             NextOp = AcpiPsGetDepthNext (NULL, Op);
             if (NextOp)
             {
                 NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;
             }
             return (AE_OK);
 
-
         case AML_MATCH_OP:
 
             AcpiDmMatchOp (Op);
             break;
 
-
         default:
 
             break;
         }
 

@@ -769,10 +801,11 @@
     ACPI_PARSE_OBJECT       *Op,
     UINT32                  Level,
     void                    *Context)
 {
     ACPI_OP_WALK_INFO       *Info = Context;
+    ACPI_PARSE_OBJECT       *ParentOp;
 
 
     if (Op->Common.DisasmFlags & ACPI_PARSEOP_IGNORE)
     {
         /* Ignore this op -- it was handled elsewhere */

@@ -794,10 +827,23 @@
 
         /* Completed an op that has arguments, add closing paren */
 
         AcpiOsPrintf (")");
 
+        if (Op->Common.AmlOpcode == AML_NAME_OP)
+        {
+            /* Emit description comment for Name() with a predefined ACPI name */
+
+            AcpiDmPredefinedDescription (Op);
+        }
+        else
+        {
+            /* For Create* operators, attempt to emit resource tag description */
+
+            AcpiDmFieldPredefinedDescription (Op);
+        }
+
         /* Could be a nested operator, check if comma required */
 
         if (!AcpiDmCommaIfListMember (Op))
         {
             if ((AcpiDmBlockType (Op->Common.Parent) & BLOCK_BRACE) &&

@@ -814,11 +860,10 @@
                 }
             }
         }
         break;
 
-
     case BLOCK_BRACE:
     case (BLOCK_BRACE | BLOCK_PAREN):
 
         /* Completed an op that has a term list, add closing brace */
 

@@ -854,11 +899,10 @@
                 AcpiOsPrintf ("\n");
             }
         }
         break;
 
-
     case BLOCK_NONE:
     default:
 
         /* Could be a nested operator, check if comma required */
 

@@ -908,11 +952,24 @@
          * Just completed a parameter node for something like "Buffer (param)".
          * Close the paren and open up the term list block with a brace
          */
         if (Op->Common.Next)
         {
-            AcpiOsPrintf (")\n");
+            AcpiOsPrintf (")");
+
+            /* Emit description comment for Name() with a predefined ACPI name */
+
+            ParentOp = Op->Common.Parent;
+            if (ParentOp)
+            {
+                ParentOp = ParentOp->Common.Parent;
+                if (ParentOp && ParentOp->Asl.AmlOpcode == AML_NAME_OP)
+                {
+                    AcpiDmPredefinedDescription (ParentOp);
+                }
+            }
+            AcpiOsPrintf ("\n");
             AcpiDmIndent (Level - 1);
             AcpiOsPrintf ("{\n");
         }
         else
         {