Sync ACPICA with Intel's version 20141107.
authorSascha Wildner <saw@online.de>
Thu, 13 Nov 2014 20:05:10 +0000 (21:05 +0100)
committerSascha Wildner <saw@online.de>
Thu, 13 Nov 2014 20:05:10 +0000 (21:05 +0100)
* Support ASL+, which is an extension to ASL supporting C-style operators
  and expressions.

  Legacy ASL:
        If (LOr (LOr (LEqual (And (R510, 0x03FB), 0x02E0), LEqual (
            And (R520, 0x03FB), 0x02E0)), LOr (LEqual (And (R530, 0x03FB),
            0x02E0), LEqual (And (R540, 0x03FB), 0x02E0))))
        {
    ...
}

  ASL+:
        If (((R510 & 0x03FB) == 0x02E0) ||
            ((R520 & 0x03FB) == 0x02E0) ||
            ((R530 & 0x03FB) == 0x02E0) ||
            ((R540 & 0x03FB) == 0x02E0))
        {
    ...
}

* Updates of the GPIO operation region handler interface.

* Various other changes.

For a more detailed list, please see sys/contrib/dev/acpica/changes.txt.

211 files changed:
sys/contrib/dev/acpica/changes.txt
sys/contrib/dev/acpica/generate/unix/acpiexamples/Makefile
sys/contrib/dev/acpica/generate/unix/acpiexec/Makefile
sys/contrib/dev/acpica/generate/unix/iasl/Makefile
sys/contrib/dev/acpica/source/common/adisasm.c
sys/contrib/dev/acpica/source/common/ahids.c
sys/contrib/dev/acpica/source/compiler/aslbtypes.c
sys/contrib/dev/acpica/source/compiler/aslcodegen.c
sys/contrib/dev/acpica/source/compiler/aslcompile.c
sys/contrib/dev/acpica/source/compiler/aslcompiler.h
sys/contrib/dev/acpica/source/compiler/aslcompiler.l
sys/contrib/dev/acpica/source/compiler/asldefine.h
sys/contrib/dev/acpica/source/compiler/aslglobal.h
sys/contrib/dev/acpica/source/compiler/aslload.c
sys/contrib/dev/acpica/source/compiler/aslmain.c
sys/contrib/dev/acpica/source/compiler/aslmap.c
sys/contrib/dev/acpica/source/compiler/aslmapenter.c [new file with mode: 0644]
sys/contrib/dev/acpica/source/compiler/aslmapoutput.c [new file with mode: 0644]
sys/contrib/dev/acpica/source/compiler/aslmaputils.c [new file with mode: 0644]
sys/contrib/dev/acpica/source/compiler/aslopcodes.c
sys/contrib/dev/acpica/source/compiler/asloptions.c
sys/contrib/dev/acpica/source/compiler/aslparser.y
sys/contrib/dev/acpica/source/compiler/aslprintf.c [new file with mode: 0644]
sys/contrib/dev/acpica/source/compiler/aslprune.c [new file with mode: 0644]
sys/contrib/dev/acpica/source/compiler/aslresource.c
sys/contrib/dev/acpica/source/compiler/aslrestype1.c
sys/contrib/dev/acpica/source/compiler/aslrestype1i.c
sys/contrib/dev/acpica/source/compiler/aslrestype2.c
sys/contrib/dev/acpica/source/compiler/aslrestype2d.c
sys/contrib/dev/acpica/source/compiler/aslrestype2e.c
sys/contrib/dev/acpica/source/compiler/aslrestype2q.c
sys/contrib/dev/acpica/source/compiler/aslrestype2s.c
sys/contrib/dev/acpica/source/compiler/aslrestype2w.c
sys/contrib/dev/acpica/source/compiler/aslrules.y
sys/contrib/dev/acpica/source/compiler/aslsupport.y
sys/contrib/dev/acpica/source/compiler/asltokens.y
sys/contrib/dev/acpica/source/compiler/asltree.c
sys/contrib/dev/acpica/source/compiler/asltypes.h
sys/contrib/dev/acpica/source/compiler/asltypes.y
sys/contrib/dev/acpica/source/compiler/aslwalks.c
sys/contrib/dev/acpica/source/compiler/aslxref.c
sys/contrib/dev/acpica/source/compiler/dtcompile.c
sys/contrib/dev/acpica/source/compiler/dtexpress.c
sys/contrib/dev/acpica/source/compiler/dtfield.c
sys/contrib/dev/acpica/source/compiler/dtio.c
sys/contrib/dev/acpica/source/compiler/dtsubtable.c
sys/contrib/dev/acpica/source/compiler/dttable.c
sys/contrib/dev/acpica/source/compiler/dtutils.c
sys/contrib/dev/acpica/source/components/debugger/dbconvert.c
sys/contrib/dev/acpica/source/components/disassembler/dmbuffer.c
sys/contrib/dev/acpica/source/components/disassembler/dmcstyle.c [new file with mode: 0644]
sys/contrib/dev/acpica/source/components/disassembler/dmopcode.c
sys/contrib/dev/acpica/source/components/disassembler/dmresrc.c
sys/contrib/dev/acpica/source/components/disassembler/dmresrcl.c
sys/contrib/dev/acpica/source/components/disassembler/dmresrcl2.c
sys/contrib/dev/acpica/source/components/disassembler/dmresrcs.c
sys/contrib/dev/acpica/source/components/disassembler/dmutils.c
sys/contrib/dev/acpica/source/components/disassembler/dmwalk.c
sys/contrib/dev/acpica/source/components/dispatcher/dsargs.c
sys/contrib/dev/acpica/source/components/dispatcher/dscontrol.c
sys/contrib/dev/acpica/source/components/dispatcher/dsfield.c
sys/contrib/dev/acpica/source/components/dispatcher/dsinit.c
sys/contrib/dev/acpica/source/components/dispatcher/dsmethod.c
sys/contrib/dev/acpica/source/components/dispatcher/dsmthdat.c
sys/contrib/dev/acpica/source/components/dispatcher/dsobject.c
sys/contrib/dev/acpica/source/components/dispatcher/dsopcode.c
sys/contrib/dev/acpica/source/components/dispatcher/dsutils.c
sys/contrib/dev/acpica/source/components/dispatcher/dswexec.c
sys/contrib/dev/acpica/source/components/dispatcher/dswload.c
sys/contrib/dev/acpica/source/components/dispatcher/dswload2.c
sys/contrib/dev/acpica/source/components/dispatcher/dswscope.c
sys/contrib/dev/acpica/source/components/dispatcher/dswstate.c
sys/contrib/dev/acpica/source/components/events/evgpeinit.c
sys/contrib/dev/acpica/source/components/events/evhandler.c
sys/contrib/dev/acpica/source/components/events/evregion.c
sys/contrib/dev/acpica/source/components/events/evrgnini.c
sys/contrib/dev/acpica/source/components/events/evxface.c
sys/contrib/dev/acpica/source/components/events/evxfevnt.c
sys/contrib/dev/acpica/source/components/events/evxfgpe.c
sys/contrib/dev/acpica/source/components/events/evxfregn.c
sys/contrib/dev/acpica/source/components/executer/exconfig.c
sys/contrib/dev/acpica/source/components/executer/exconvrt.c
sys/contrib/dev/acpica/source/components/executer/excreate.c
sys/contrib/dev/acpica/source/components/executer/exdebug.c
sys/contrib/dev/acpica/source/components/executer/exdump.c
sys/contrib/dev/acpica/source/components/executer/exfield.c
sys/contrib/dev/acpica/source/components/executer/exfldio.c
sys/contrib/dev/acpica/source/components/executer/exmisc.c
sys/contrib/dev/acpica/source/components/executer/exmutex.c
sys/contrib/dev/acpica/source/components/executer/exnames.c
sys/contrib/dev/acpica/source/components/executer/exoparg1.c
sys/contrib/dev/acpica/source/components/executer/exoparg2.c
sys/contrib/dev/acpica/source/components/executer/exoparg3.c
sys/contrib/dev/acpica/source/components/executer/exoparg6.c
sys/contrib/dev/acpica/source/components/executer/exprep.c
sys/contrib/dev/acpica/source/components/executer/exregion.c
sys/contrib/dev/acpica/source/components/executer/exresnte.c
sys/contrib/dev/acpica/source/components/executer/exresolv.c
sys/contrib/dev/acpica/source/components/executer/exresop.c
sys/contrib/dev/acpica/source/components/executer/exstore.c
sys/contrib/dev/acpica/source/components/executer/exstoren.c
sys/contrib/dev/acpica/source/components/executer/exstorob.c
sys/contrib/dev/acpica/source/components/executer/exsystem.c
sys/contrib/dev/acpica/source/components/executer/exutils.c
sys/contrib/dev/acpica/source/components/hardware/hwacpi.c
sys/contrib/dev/acpica/source/components/hardware/hwgpe.c
sys/contrib/dev/acpica/source/components/hardware/hwpci.c
sys/contrib/dev/acpica/source/components/hardware/hwregs.c
sys/contrib/dev/acpica/source/components/hardware/hwvalid.c
sys/contrib/dev/acpica/source/components/namespace/nsaccess.c
sys/contrib/dev/acpica/source/components/namespace/nsalloc.c
sys/contrib/dev/acpica/source/components/namespace/nsconvert.c
sys/contrib/dev/acpica/source/components/namespace/nsdump.c
sys/contrib/dev/acpica/source/components/namespace/nsdumpdv.c
sys/contrib/dev/acpica/source/components/namespace/nseval.c
sys/contrib/dev/acpica/source/components/namespace/nsinit.c
sys/contrib/dev/acpica/source/components/namespace/nsload.c
sys/contrib/dev/acpica/source/components/namespace/nsnames.c
sys/contrib/dev/acpica/source/components/namespace/nsobject.c
sys/contrib/dev/acpica/source/components/namespace/nsparse.c
sys/contrib/dev/acpica/source/components/namespace/nsrepair.c
sys/contrib/dev/acpica/source/components/namespace/nsrepair2.c
sys/contrib/dev/acpica/source/components/namespace/nssearch.c
sys/contrib/dev/acpica/source/components/namespace/nsutils.c
sys/contrib/dev/acpica/source/components/namespace/nswalk.c
sys/contrib/dev/acpica/source/components/namespace/nsxfeval.c
sys/contrib/dev/acpica/source/components/namespace/nsxfname.c
sys/contrib/dev/acpica/source/components/namespace/nsxfobj.c
sys/contrib/dev/acpica/source/components/parser/psargs.c
sys/contrib/dev/acpica/source/components/parser/pstree.c
sys/contrib/dev/acpica/source/components/parser/psxface.c
sys/contrib/dev/acpica/source/components/resources/rsaddr.c
sys/contrib/dev/acpica/source/components/resources/rscalc.c
sys/contrib/dev/acpica/source/components/resources/rscreate.c
sys/contrib/dev/acpica/source/components/resources/rsdump.c
sys/contrib/dev/acpica/source/components/resources/rsdumpinfo.c
sys/contrib/dev/acpica/source/components/resources/rsinfo.c
sys/contrib/dev/acpica/source/components/resources/rsio.c
sys/contrib/dev/acpica/source/components/resources/rsirq.c
sys/contrib/dev/acpica/source/components/resources/rslist.c
sys/contrib/dev/acpica/source/components/resources/rsmemory.c
sys/contrib/dev/acpica/source/components/resources/rsmisc.c
sys/contrib/dev/acpica/source/components/resources/rsserial.c
sys/contrib/dev/acpica/source/components/resources/rsutils.c
sys/contrib/dev/acpica/source/components/resources/rsxface.c
sys/contrib/dev/acpica/source/components/tables/tbdata.c
sys/contrib/dev/acpica/source/components/tables/tbfadt.c
sys/contrib/dev/acpica/source/components/tables/tbfind.c
sys/contrib/dev/acpica/source/components/tables/tbinstal.c
sys/contrib/dev/acpica/source/components/tables/tbprint.c
sys/contrib/dev/acpica/source/components/tables/tbutils.c
sys/contrib/dev/acpica/source/components/tables/tbxface.c
sys/contrib/dev/acpica/source/components/tables/tbxfload.c
sys/contrib/dev/acpica/source/components/tables/tbxfroot.c
sys/contrib/dev/acpica/source/components/utilities/utaddress.c
sys/contrib/dev/acpica/source/components/utilities/utalloc.c
sys/contrib/dev/acpica/source/components/utilities/utbuffer.c
sys/contrib/dev/acpica/source/components/utilities/utcache.c
sys/contrib/dev/acpica/source/components/utilities/utclib.c
sys/contrib/dev/acpica/source/components/utilities/utcopy.c
sys/contrib/dev/acpica/source/components/utilities/utdebug.c
sys/contrib/dev/acpica/source/components/utilities/utdecode.c
sys/contrib/dev/acpica/source/components/utilities/utdelete.c
sys/contrib/dev/acpica/source/components/utilities/uterror.c
sys/contrib/dev/acpica/source/components/utilities/uteval.c
sys/contrib/dev/acpica/source/components/utilities/utexcep.c
sys/contrib/dev/acpica/source/components/utilities/utglobal.c
sys/contrib/dev/acpica/source/components/utilities/uthex.c
sys/contrib/dev/acpica/source/components/utilities/utids.c
sys/contrib/dev/acpica/source/components/utilities/utinit.c
sys/contrib/dev/acpica/source/components/utilities/utlock.c
sys/contrib/dev/acpica/source/components/utilities/utmath.c
sys/contrib/dev/acpica/source/components/utilities/utmisc.c
sys/contrib/dev/acpica/source/components/utilities/utmutex.c
sys/contrib/dev/acpica/source/components/utilities/utobject.c
sys/contrib/dev/acpica/source/components/utilities/utosi.c
sys/contrib/dev/acpica/source/components/utilities/utownerid.c
sys/contrib/dev/acpica/source/components/utilities/utpredef.c
sys/contrib/dev/acpica/source/components/utilities/utresrc.c
sys/contrib/dev/acpica/source/components/utilities/utstate.c
sys/contrib/dev/acpica/source/components/utilities/utstring.c
sys/contrib/dev/acpica/source/components/utilities/uttrack.c
sys/contrib/dev/acpica/source/components/utilities/utuuid.c
sys/contrib/dev/acpica/source/components/utilities/utxface.c
sys/contrib/dev/acpica/source/components/utilities/utxferror.c
sys/contrib/dev/acpica/source/components/utilities/utxfinit.c
sys/contrib/dev/acpica/source/components/utilities/utxfmutex.c
sys/contrib/dev/acpica/source/include/acbuffer.h
sys/contrib/dev/acpica/source/include/acdisasm.h
sys/contrib/dev/acpica/source/include/acglobal.h
sys/contrib/dev/acpica/source/include/aclocal.h
sys/contrib/dev/acpica/source/include/acnames.h
sys/contrib/dev/acpica/source/include/acobject.h
sys/contrib/dev/acpica/source/include/acpixf.h
sys/contrib/dev/acpica/source/include/actables.h
sys/contrib/dev/acpica/source/include/actypes.h
sys/contrib/dev/acpica/source/include/amlresrc.h
sys/contrib/dev/acpica/source/os_specific/service_layers/osunixxf.c
sys/contrib/dev/acpica/source/tools/acpidump/apdump.c
sys/contrib/dev/acpica/source/tools/acpiexec/aecommon.h
sys/contrib/dev/acpica/source/tools/acpiexec/aehandlers.c
sys/contrib/dev/acpica/source/tools/acpiexec/aeinitfile.c [new file with mode: 0644]
sys/contrib/dev/acpica/source/tools/acpiexec/aemain.c
sys/contrib/dev/acpica/source/tools/acpiexec/aeregion.c [copied from sys/contrib/dev/acpica/source/tools/acpiexec/aehandlers.c with 52% similarity]
sys/contrib/dev/acpica/source/tools/acpisrc/astable.c
sys/contrib/dev/acpica/source/tools/examples/examples.c
sys/contrib/dev/acpica/source/tools/examples/extables.c
usr.sbin/acpi/acpiexec/Makefile
usr.sbin/acpi/acpiexec/acpiexec.8
usr.sbin/acpi/iasl/Makefile
usr.sbin/acpi/iasl/iasl.8

index 89d2628..025e85c 100644 (file)
@@ -1,3 +1,249 @@
+----------------------------------------
+07 November 2014. Summary of changes for version 20141107:
+
+This release is available at https://acpica.org/downloads
+
+This release introduces and implements language extensions to ASL that 
+provide support for symbolic ("C-style") operators and expressions. These 
+language extensions are known collectively as ASL+.
+
+
+1) iASL Compiler/Disassembler and Tools:
+
+Disassembler: Fixed a problem with disassembly of the UartSerialBus 
+macro. Changed "StopBitsNone" to the correct "StopBitsZero". David E. 
+Box.
+
+Disassembler: Fixed the Unicode macro support to add escape sequences. 
+All non-printable ASCII values are emitted as escape sequences, as well 
+as the standard escapes for quote and backslash. Ensures that the 
+disassembled macro can be correctly recompiled.
+
+iASL: Added Printf/Fprintf macros for formatted output. These macros are 
+translated to existing AML Concatenate and Store operations. Printf 
+writes to the ASL Debug object. Fprintf allows the specification of an 
+ASL name as the target. Only a single format specifier is required, %o, 
+since the AML interpreter dynamically converts objects to the required 
+type. David E. Box.
+
+    (old)    Store (Concatenate (Concatenate (Concatenate (Concatenate
+                 (Concatenate (Concatenate (Concatenate ("", Arg0),
+                 ": Unexpected value for "), Arg1), ", "), Arg2),
+                 " at line "), Arg3), Debug)
+
+    (new)    Printf ("%o: Unexpected value for %o, %o at line %o",
+                 Arg0, Arg1, Arg2, Arg3)
+
+    (old)    Store (Concatenate (Concatenate (Concatenate (Concatenate
+                 ("", Arg1), ": "), Arg0), " Successful"), STR1)
+
+    (new)    Fprintf (STR1, "%o: %o Successful", Arg1, Arg0)
+
+iASL: Added debug options (-bp, -bt) to dynamically prune levels of the 
+ASL parse tree before the AML code is generated. This allows blocks of 
+ASL code to be removed in order to help locate and identify problem 
+devices and/or code. David E. Box.
+
+AcpiExec: Added support (-fi) for an optional namespace object 
+initialization file. This file specifies initial values for namespace 
+objects as necessary for debugging and testing different ASL code paths 
+that may be taken as a result of BIOS options.
+
+
+2) Overview of symbolic operator support for ASL (ASL+)
+-------------------------------------------------------
+
+As an extension to the ASL language, iASL implements support for symbolic 
+(C-style) operators for math and logical expressions. This can greatly 
+simplify ASL code as well as improve both readability and 
+maintainability. These language extensions can exist concurrently with 
+all legacy ASL code and expressions.
+
+The symbolic extensions are 100% compatible with existing AML 
+interpreters, since no new AML opcodes are created. To implement the 
+extensions, the iASL compiler transforms the symbolic expressions into 
+the legacy ASL/AML equivalents at compile time.
+
+Full symbolic expressions are supported, along with the standard C 
+precedence and associativity rules.
+
+Full disassembler support for the symbolic expressions is provided, and 
+creates an automatic migration path for existing ASL code to ASL+ code 
+via the disassembly process. By default, the disassembler now emits ASL+ 
+code with symbolic expressions. An option (-dl) is provided to force the 
+disassembler to emit legacy ASL code if desired.
+
+Below is the complete list of the currently supported symbolic operators 
+with examples. See the iASL User Guide for additional information.
+
+
+ASL+ Syntax      Legacy ASL Equivalent
+-----------      ---------------------
+
+    // Math operators
+
+Z = X + Y        Add (X, Y, Z)
+Z = X - Y        Subtract (X, Y, Z)
+Z = X * Y        Multiply (X, Y, Z)
+Z = X / Y        Divide (X, Y, , Z)
+Z = X % Y        Mod (X, Y, Z)
+Z = X << Y       ShiftLeft (X, Y, Z)
+Z = X >> Y       ShiftRight (X, Y, Z)
+Z = X & Y        And (X, Y, Z)
+Z = X | Y        Or (X, Y, Z)
+Z = X ^ Y        Xor (X, Y, Z)
+Z = ~X           Not (X, Z)
+X++              Increment (X)
+X--              Decrement (X)
+
+    // Logical operators
+
+(X == Y)         LEqual (X, Y)
+(X != Y)         LNotEqual (X, Y)
+(X < Y)          LLess (X, Y)
+(X > Y)          LGreater (X, Y)
+(X <= Y)         LLessEqual (X, Y)
+(X >= Y)         LGreaterEqual (X, Y)
+(X && Y)         LAnd (X, Y)
+(X || Y)         LOr (X, Y)
+(!X)             LNot (X)
+
+    // Assignment and compound assignment operations
+
+X = Y           Store (Y, X)
+X += Y          Add (X, Y, X)
+X -= Y          Subtract (X, Y, X)
+X *= Y          Multiply (X, Y, X)
+X /= Y          Divide (X, Y, , X)
+X %= Y          Mod (X, Y, X)
+X <<= Y         ShiftLeft (X, Y, X)
+X >>= Y         ShiftRight (X, Y, X)
+X &= Y          And (X, Y, X)
+X |= Y          Or (X, Y, X)
+X ^= Y          Xor (X, Y, X)
+
+
+3) ASL+ Examples:
+-----------------
+
+Legacy ASL:
+        If (LOr (LOr (LEqual (And (R510, 0x03FB), 0x02E0), LEqual (
+            And (R520, 0x03FB), 0x02E0)), LOr (LEqual (And (R530, 
+0x03FB), 
+            0x02E0), LEqual (And (R540, 0x03FB), 0x02E0))))
+        {
+            And (MEMB, 0xFFFFFFF0, SRMB)
+            Store (MEMB, Local2)
+            Store (PDBM, Local1)
+            And (PDBM, 0xFFFFFFFFFFFFFFF9, PDBM)
+            Store (SRMB, MEMB)
+            Or (PDBM, 0x02, PDBM)
+        }
+
+ASL+ version:
+        If (((R510 & 0x03FB) == 0x02E0) ||
+            ((R520 & 0x03FB) == 0x02E0) ||
+            ((R530 & 0x03FB) == 0x02E0) || 
+            ((R540 & 0x03FB) == 0x02E0))
+        {
+            SRMB = (MEMB & 0xFFFFFFF0)
+            Local2 = MEMB
+            Local1 = PDBM
+            PDBM &= 0xFFFFFFFFFFFFFFF9
+            MEMB = SRMB
+            PDBM |= 0x02
+        }
+
+Legacy ASL:
+        Store (0x1234, Local1)
+        Multiply (Add (Add (Local1, TEST), 0x20), Local2, Local3)
+        Multiply (Local2, Add (Add (Local1, TEST), 0x20), Local3)
+        Add (Local1, Add (TEST, Multiply (0x20, Local2)), Local3)
+        Store (Index (PKG1, 0x03), Local6)
+        Store (Add (Local3, Local2), Debug)
+        Add (Local1, 0x0F, Local2)
+        Add (Local1, Multiply (Local2, Local3), Local2)
+        Multiply (Add (Add (Local1, TEST), 0x20), ToBCD (Local1), Local3)
+
+ASL+ version:
+        Local1 = 0x1234
+        Local3 = (((Local1 + TEST) + 0x20) * Local2)
+        Local3 = (Local2 * ((Local1 + TEST) + 0x20))
+        Local3 = (Local1 + (TEST + (0x20 * Local2)))
+        Local6 = Index (PKG1, 0x03)
+        Debug = (Local3 + Local2)
+        Local2 = (Local1 + 0x0F)
+        Local2 = (Local1 + (Local2 * Local3))
+        Local3 = (((Local1 + TEST) + 0x20) * ToBCD (Local1))
+
+
+----------------------------------------
+26 September 2014. Summary of changes for version 20140926:
+
+1) ACPICA kernel-resident subsystem:
+
+Updated the GPIO operation region handler interface (GeneralPurposeIo). 
+In order to support GPIO Connection objects with multiple pins, along 
+with the related Field objects, the following changes to the interface 
+have been made: The Address is now defined to be the offset in bits of 
+the field unit from the previous invocation of a Connection. It can be 
+viewed as a "Pin Number Index" into the connection resource descriptor. 
+The BitWidth is the exact bit width of the field. It is usually one bit, 
+but not always. See the ACPICA reference guide (section 8.8.6.2.1) for 
+additional information and examples.
+
+GPE support: During ACPICA/GPE initialization, ensure that all GPEs with 
+corresponding _Lxx/_Exx methods are disabled (they may have been enabled 
+by the firmware), so that they cannot fire until they are enabled via 
+AcpiUpdateAllGpes. Rafael J. Wysocki.
+
+Added a new return flag for the Event/GPE status interfaces -- 
+AcpiGetEventStatus and AcpiGetGpeStatus. The new 
+ACPI_EVENT_FLAGS_HAS_HANDLER flag is used to indicate that the event or 
+GPE currently has a handler associated with it, and can thus actually 
+affect the system. Lv Zheng.
+
+Example Code and Data Size: These are the sizes for the OS-independent 
+acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The 
+debug version of the code includes the debug output trace mechanism and 
+has a much larger code and data size.
+
+  Current Release:
+    Non-Debug Version:  99.1K Code, 27.3K Data, 126.4K Total
+    Debug Version:     192.8K Code, 79.9K Data, 272.7K Total
+  Previous Release:
+    Non-Debug Version:  98.8K Code, 27.3K Data, 126.1K Total
+    Debug Version:     192.1K Code, 79.8K Data, 271.9K Total
+
+2) iASL Compiler/Disassembler and Tools:
+
+iASL: Fixed a memory allocation/free regression introduced in 20140828 
+that could cause the compiler to crash. This was introduced inadvertently 
+during the effort to eliminate compiler memory leaks. ACPICA BZ 1111, 
+1113.
+
+iASL: Removed two error messages that have been found to create false 
+positives, until they can be fixed and fully validated (ACPICA BZ 1112):
+1) Illegal forward reference within a method
+2) Illegal reference across two methods
+
+iASL: Implemented a new option (-lm) to create a hardware mapping file 
+that summarizes all GPIO, I2C, SPI, and UART connections. This option 
+works for both the compiler and disassembler. See the iASL compiler user 
+guide for additional information and examples (section 6.4.6).
+
+AcpiDump: Added support for the version 1 (ACPI 1.0) RSDP in addition to 
+version 2. This corrects the AE_BAD_HEADER exception seen on systems with 
+a version 1 RSDP. Lv Zheng ACPICA BZ 1097.
+
+AcpiExec: For Unix versions, don't attempt to put STDIN into raw mode 
+unless STDIN is actually a terminal. Assists with batch-mode processing. 
+ACPICA BZ 1114.
+
+Disassembler/AcpiHelp: Added another large group of recognized _HID 
+values.
+
+
 ----------------------------------------
 28 August 2014. Summary of changes for version 20140828:
 
@@ -37,8 +283,10 @@ Memory24 resource descriptor. There was a boundary condition when the
 range was equal to the (length -1) caused by the fact that these values 
 are defined in 256-byte blocks, not bytes. ACPICA BZ 1098
 
-Disassembler: Fixed a problem with the GpioInt descriptor interrupt polarity 
-flags. The flags are actually 2 bits, not 1, and the "ActiveBoth" keyword is 
+Disassembler: Fixed a problem with the GpioInt descriptor interrupt 
+polarity 
+flags. The flags are actually 2 bits, not 1, and the "ActiveBoth" keyword 
+is 
 now supported properly.
 
 ACPI 5.1: Added the GICC affinity subtable to the SRAT table. Supported 
index 4583143..b404b54 100644 (file)
@@ -162,7 +162,7 @@ OBJECTS = \
 #
 CFLAGS += \
     -DACPI_EXAMPLE_APP\
-    -I$(EXAMPLES)
+    -I$(ACPIEXAMPLES)
 
 #
 # Common Rules
index 8d7facf..02e868d 100644 (file)
@@ -42,7 +42,9 @@ OBJECTS = \
        $(OBJDIR)/acgetline.o\
        $(OBJDIR)/aeexec.o\
        $(OBJDIR)/aehandlers.o\
+       $(OBJDIR)/aeinitfile.o\
        $(OBJDIR)/aemain.o\
+       $(OBJDIR)/aeregion.o\
        $(OBJDIR)/aetables.o\
        $(OBJDIR)/ahids.o\
        $(OBJDIR)/ahuuids.o\
@@ -61,6 +63,7 @@ OBJECTS = \
        $(OBJDIR)/dbutils.o\
        $(OBJDIR)/dbxface.o\
        $(OBJDIR)/dmbuffer.o\
+       $(OBJDIR)/dmcstyle.o\
        $(OBJDIR)/dmdeferred.o\
        $(OBJDIR)/dmnames.o\
        $(OBJDIR)/dmobject.o\
index f4b6ef3..d9a4db0 100644 (file)
@@ -66,6 +66,9 @@ OBJECTS = \
        $(OBJDIR)/asllookup.o\
        $(OBJDIR)/aslmain.o\
        $(OBJDIR)/aslmap.o\
+       $(OBJDIR)/aslmapenter.o\
+       $(OBJDIR)/aslmapoutput.o\
+       $(OBJDIR)/aslmaputils.o\
        $(OBJDIR)/aslmessages.o\
        $(OBJDIR)/aslmethod.o\
        $(OBJDIR)/aslnamesp.o\
@@ -76,6 +79,8 @@ OBJECTS = \
        $(OBJDIR)/asloptions.o\
        $(OBJDIR)/aslpredef.o\
        $(OBJDIR)/aslprepkg.o\
+       $(OBJDIR)/aslprintf.o\
+       $(OBJDIR)/aslprune.o\
        $(OBJDIR)/aslresource.o\
        $(OBJDIR)/aslrestype1.o\
        $(OBJDIR)/aslrestype1i.o\
@@ -94,16 +99,9 @@ OBJECTS = \
        $(OBJDIR)/aslwalks.o\
        $(OBJDIR)/aslxref.o\
        $(OBJDIR)/cmfsize.o\
-       $(OBJDIR)/dtcompile.o\
-       $(OBJDIR)/dtexpress.o\
-       $(OBJDIR)/dtfield.o\
-       $(OBJDIR)/dtio.o\
-       $(OBJDIR)/dtsubtable.o\
-       $(OBJDIR)/dttable.o\
-       $(OBJDIR)/dttemplate.o\
-       $(OBJDIR)/dtutils.o\
        $(OBJDIR)/dbfileio.o\
        $(OBJDIR)/dmbuffer.o\
+       $(OBJDIR)/dmcstyle.o\
        $(OBJDIR)/dmdeferred.o\
        $(OBJDIR)/dmextern.o\
        $(OBJDIR)/dmnames.o\
@@ -130,6 +128,14 @@ OBJECTS = \
        $(OBJDIR)/dswload2.o\
        $(OBJDIR)/dswscope.o\
        $(OBJDIR)/dswstate.o\
+       $(OBJDIR)/dtcompile.o\
+       $(OBJDIR)/dtexpress.o\
+       $(OBJDIR)/dtfield.o\
+       $(OBJDIR)/dtio.o\
+       $(OBJDIR)/dtsubtable.o\
+       $(OBJDIR)/dttable.o\
+       $(OBJDIR)/dttemplate.o\
+       $(OBJDIR)/dtutils.o\
        $(OBJDIR)/exconvrt.o\
        $(OBJDIR)/excreate.o\
        $(OBJDIR)/exdump.o\
@@ -228,6 +234,7 @@ MISC = \
 
 ASL_PARSER = \
        $(ASL_COMPILER)/aslparser.y\
+       $(ASL_COMPILER)/aslsupport.y\
        $(ASL_COMPILER)/asltokens.y\
        $(ASL_COMPILER)/asltypes.y\
        $(ASL_COMPILER)/aslrules.y
@@ -254,7 +261,7 @@ include ../Makefile.rules
 #
 # Macro processing for iASL .y files
 #
-$(OBJDIR)/aslcompiler.y :       $(ASL_PARSER)
+$(OBJDIR)/aslcompiler.y :      $(ASL_PARSER)
        $(MACROPROC) $(MFLAGS) $(ASL_COMPILER)/aslparser.y > $(OBJDIR)/aslcompiler.y
 
 #
index 8deaee7..f585fe5 100644 (file)
@@ -128,7 +128,7 @@ AcpiDsMethodDataInitArgs (
 
 
 static ACPI_TABLE_DESC      LocalTables[1];
-static ACPI_PARSE_OBJECT    *AcpiGbl_ParseOpRoot;
+ACPI_PARSE_OBJECT    *AcpiGbl_ParseOpRoot;
 
 
 /*******************************************************************************
@@ -489,6 +489,14 @@ AdAmlDisassemble (
             fprintf (stderr, "Disassembly completed\n");
             fprintf (stderr, "ASL Output:    %s - %u bytes\n",
                 DisasmFilename, CmGetFileSize (File));
+
+            if (Gbl_MapfileFlag)
+            {
+                fprintf (stderr, "%14s %s - %u bytes\n",
+                    Gbl_Files[ASL_FILE_MAP_OUTPUT].ShortDescription,
+                    Gbl_Files[ASL_FILE_MAP_OUTPUT].Filename,
+                    FlGetFileSize (ASL_FILE_MAP_OUTPUT));
+            }
         }
     }
 
@@ -536,12 +544,26 @@ AdDisassemblerHeader (
 {
     time_t                  Timer;
 
+
     time (&Timer);
 
     /* Header and input table info */
 
     AcpiOsPrintf ("/*\n");
-    AcpiOsPrintf (ACPI_COMMON_HEADER ("AML Disassembler", " * "));
+    AcpiOsPrintf (ACPI_COMMON_HEADER (AML_DISASSEMBLER_NAME, " * "));
+
+    if (AcpiGbl_CstyleDisassembly)
+    {
+        AcpiOsPrintf (
+            " * Disassembling to symbolic ASL+ operators\n"
+            " *\n");
+    }
+    else
+    {
+        AcpiOsPrintf (
+            " * Disassembling to non-symbolic legacy ASL operators\n"
+            " *\n");
+    }
 
     AcpiOsPrintf (" * Disassembly of %s, %s", Filename, ctime (&Timer));
     AcpiOsPrintf (" *\n");
@@ -688,6 +710,7 @@ AdDisplayTables (
     }
 
     AcpiDmDisassemble (NULL, AcpiGbl_ParseOpRoot, ACPI_UINT32_MAX);
+    MpEmitMappingInfo ();
 
     if (AcpiGbl_DbOpt_verbose)
     {
index 13cd100..dc15f35 100644 (file)
@@ -54,7 +54,9 @@
 const AH_DEVICE_ID  AslDeviceIds[] =
 {
     {"10EC5640",    "Realtek I2S Audio Codec"},
+    {"80860F09",    "Intel PWM Controller"},
     {"80860F0A",    "Intel Atom UART Controller"},
+    {"80860F0E",    "Intel SPI Controller"},
     {"80860F14",    "Intel Baytrail SDIO/MMC Host Controller"},
     {"80860F28",    "Intel SST Audio DSP"},
     {"80860F41",    "Intel Baytrail I2C Host Controller"},
@@ -73,12 +75,20 @@ const AH_DEVICE_ID  AslDeviceIds[] =
     {"ACPI000D",    "Power Meter Device"},
     {"ACPI000E",    "Time and Alarm Device"},
     {"ACPI000F",    "User Presence Detection Device"},
+    {"ADMA0F28",    "Intel Audio DMA"},
+    {"AMCR0F28",    "Intel Audio Machine Driver"},
     {"ATK4001",     "Asus Radio Control Button"},
     {"ATML1000",    "Atmel Touchscreen Controller"},
+    {"AUTH2750",    "AuthenTec AES2750"},
     {"BCM2E39",     "Broadcom BT Serial Bus Driver over UART Bus Enumerator"},
+    {"BCM4752E",    "Broadcom GPS Controller"},
+    {"BMG0160",     "Bosch Gyro Sensor"},
     {"CPLM3218",    "Capella Micro CM3218x Ambient Light Sensor"},
     {"DELLABCE",    "Dell Airplane Mode Switch Driver"},
     {"DLAC3002",    "Qualcomm Atheros Bluetooth UART Transport"},
+    {"FTTH5506",    "FocalTech 5506 Touch Controller"},
+    {"HAD0F28",     "Intel HDMI Audio Driver"},
+    {"INBC0000",    "GPIO Expander"},
     {"INT0002",     "Virtual GPIO Controller"},
     {"INT0800",     "Intel 82802 Firmware Hub Device"},
     {"INT3394",     "ACPI System Fan"},
@@ -87,6 +97,7 @@ const AH_DEVICE_ID  AslDeviceIds[] =
     {"INT33A1",     "Intel Power Engine"},
     {"INT33BB",     "Intel Baytrail SD Host Controller"},
     {"INT33BD",     "Intel Baytrail Mailbox Device"},
+    {"INT33BE",     "Camera Sensor OV5693"},
     {"INT33C0",     "Intel Serial I/O SPI Host Controller"},
     {"INT33C1",     "Intel Serial I/O SPI Host Controller"},
     {"INT33C2",     "Intel Serial I/O I2C Host Controller"},
@@ -105,9 +116,12 @@ const AH_DEVICE_ID  AslDeviceIds[] =
     {"INT33D4",     "Intel GPIO Buttons"},
     {"INT33D6",     "Intel Virtual Buttons Device"},
     {"INT33F0",     "Camera Sensor MT9M114"},
+    {"INT33F4",     "XPOWER PMIC Controller"},
+    {"INT33F5",     "TI PMIC Controller"},
     {"INT33FB",     "MIPI-CSI Camera Sensor OV2722"},
     {"INT33FC",     "Intel Baytrail GPIO Controller"},
     {"INT33FD",     "Intel Baytrail Power Management IC"},
+    {"INT33FE",     "XPOWER Battery Device"},
     {"INT3400",     "Intel Dynamic Power Performance Management"},
     {"INT3401",     "Intel Extended Thermal Model CPU"},
     {"INT3403",     "DPTF Temperature Sensor"},
@@ -127,8 +141,10 @@ const AH_DEVICE_ID  AslDeviceIds[] =
     {"LNXSYSTM",    "ACPI Root Node"},
     {"LNXTHERM",    "ACPI Thermal Zone"},
     {"LNXVIDEO",    "ACPI Video Controller"},
+    {"MAX17047",    "Fuel Gauge Controller"},
     {"MSFT0101",    "TPM 2.0 Security Device"},
     {"NXP5442",     "NXP 5442 Near Field Communications Controller"},
+    {"NXP5472",     "NXP NFC"},
     {"PNP0000",     "8259-compatible Programmable Interrupt Controller"},
     {"PNP0001",     "EISA Interrupt Controller"},
     {"PNP0002",     "MCA Interrupt Controller"},
@@ -181,7 +197,13 @@ const AH_DEVICE_ID  AslDeviceIds[] =
     {"PNP0D40",     "SDA Standard Compliant SD Host Controller"},
     {"PNP0D80",     "Windows-compatible System Power Management Controller"},
     {"PNP0F03",     "Microsoft PS/2-style Mouse"},
+    {"PNP0F13",     "PS/2 Mouse"},
+    {"RTL8723",     "Realtek Wireless Controller"},
+    {"SMB0349",     "Charger"},
     {"SMO91D0",     "Sensor Hub"},
+    {"SMSC3750",    "SMSC 3750 USB MUX"},
+    {"SSPX0000",    "Intel SSP Device"},
+    {"TBQ24296",    "Charger"},
 
     {NULL, NULL}
 };
index 025a416..288678a 100644 (file)
@@ -374,6 +374,12 @@ AnGetBtype (
     UINT32                  ThisNodeBtype = 0;
 
 
+    if (!Op)
+    {
+        AcpiOsPrintf ("Null Op in AnGetBtype\n");
+        return (ACPI_UINT32_MAX);
+    }
+
     if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG)     ||
         (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING)  ||
         (Op->Asl.ParseOpcode == PARSEOP_METHODCALL))
index 8cef755..a6a866e 100644 (file)
@@ -107,6 +107,12 @@ CgGenerateAmlOutput (
 
     TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD,
         CgAmlWriteWalk, NULL, NULL);
+
+    DbgPrint (ASL_TREE_OUTPUT,
+        "%*s Value    P_Op A_Op OpLen PByts Len  SubLen PSubLen OpPtr"
+        "    Parent   Child    Next     Flags    AcTyp    Final Col L\n",
+        76, " ");
+
     CgCloseTable ();
 }
 
@@ -138,7 +144,8 @@ CgAmlWriteWalk (
         DbgPrint (ASL_TREE_OUTPUT,
             "Final parse tree used for AML output:\n");
         DbgPrint (ASL_TREE_OUTPUT,
-            "%*s Value    P_Op A_Op OpLen PByts Len  SubLen PSubLen OpPtr    Child    Parent   Flags    AcTyp    Final Col L\n",
+            "%*s Value    P_Op A_Op OpLen PByts Len  SubLen PSubLen OpPtr"
+            "    Parent   Child    Next     Flags    AcTyp    Final Col L\n",
             76, " ");
     }
 
@@ -161,7 +168,8 @@ CgAmlWriteWalk (
     }
 
     DbgPrint (ASL_TREE_OUTPUT,
-    "%08X %04X %04X %01X     %04X  %04X %04X   %04X    %08X %08X %08X %08X %08X %04X  %02d  %02d\n",
+    "%08X %04X %04X %01X     %04X  %04X %04X   %04X    "
+    "%08X %08X %08X %08X %08X %08X %04X  %02d  %02d\n",
             /* 1  */ (UINT32) Op->Asl.Value.Integer,
             /* 2  */ Op->Asl.ParseOpcode,
             /* 3  */ Op->Asl.AmlOpcode,
@@ -171,13 +179,14 @@ CgAmlWriteWalk (
             /* 7  */ Op->Asl.AmlSubtreeLength,
             /* 8  */ Op->Asl.Parent ? Op->Asl.Parent->Asl.AmlSubtreeLength : 0,
             /* 9  */ Op,
-            /* 10 */ Op->Asl.Child,
-            /* 11 */ Op->Asl.Parent,
-            /* 12 */ Op->Asl.CompileFlags,
-            /* 13 */ Op->Asl.AcpiBtype,
-            /* 14 */ Op->Asl.FinalAmlLength,
-            /* 15 */ Op->Asl.Column,
-            /* 16 */ Op->Asl.LineNumber);
+            /* 10 */ Op->Asl.Parent,
+            /* 11 */ Op->Asl.Child,
+            /* 12 */ Op->Asl.Next,
+            /* 13 */ Op->Asl.CompileFlags,
+            /* 14 */ Op->Asl.AcpiBtype,
+            /* 15 */ Op->Asl.FinalAmlLength,
+            /* 16 */ Op->Asl.Column,
+            /* 17 */ Op->Asl.LineNumber);
 
     /* Generate the AML for this node */
 
index 060380a..432ec8b 100644 (file)
@@ -147,6 +147,13 @@ CmDoCompile (
     Event = UtBeginEvent ("Flush source input");
     CmFlushSourceCode ();
 
+    /* Prune the parse tree if requested (debug purposes only) */
+
+    if (Gbl_PruneParseTree)
+    {
+        AslPruneParseTree (Gbl_PruneDepth, Gbl_PruneType);
+    }
+
     /* Optional parse tree dump, compiler debug output only */
 
     LsDumpParseTree ();
@@ -540,6 +547,10 @@ CmDoOutputFiles (
     /* Dump the namespace to the .nsp file if requested */
 
     (void) NsDisplayNamespace ();
+
+    /* Dump the device mapping file */
+
+    MpEmitMappingInfo ();
 }
 
 
index 1001f68..72d4699 100644 (file)
@@ -542,6 +542,27 @@ OptOptimizeNamePath (
     ACPI_NAMESPACE_NODE     *TargetNode);
 
 
+/*
+ * aslprintf - Printf/Fprintf macros
+ */
+void
+OpcDoPrintf (
+    ACPI_PARSE_OBJECT       *Op);
+
+void
+OpcDoFprintf (
+    ACPI_PARSE_OBJECT       *Op);
+
+
+/*
+ * aslprune - parse tree pruner
+ */
+void
+AslPruneParseTree (
+    UINT32                  PruneDepth,
+    UINT32                  Type);
+
+
 /*
  * aslcodegen - code generation
  */
@@ -683,6 +704,16 @@ ACPI_PARSE_OBJECT *
 TrCreateLeafNode (
     UINT32                  ParseOpcode);
 
+ACPI_PARSE_OBJECT *
+TrCreateAssignmentNode (
+    ACPI_PARSE_OBJECT       *Target,
+    ACPI_PARSE_OBJECT       *Source);
+
+ACPI_PARSE_OBJECT *
+TrCreateTargetOperand (
+    ACPI_PARSE_OBJECT       *OriginalOp,
+    ACPI_PARSE_OBJECT       *ParentOp);
+
 ACPI_PARSE_OBJECT *
 TrCreateValuedLeafNode (
     UINT32                  ParseOpcode,
@@ -808,6 +839,13 @@ ACPI_STATUS
 FlOpenMiscOutputFiles (
     char                    *InputFilename);
 
+/*
+ * aslhwmap - hardware map summary
+ */
+void
+MpEmitMappingInfo (
+    void);
+
 
 /*
  * asload - load namespace in prep for cross reference
@@ -1045,8 +1083,7 @@ RsCheckListForDuplicates (
 
 ASL_RESOURCE_NODE *
 RsDoOneResourceDescriptor (
-    ACPI_PARSE_OBJECT       *DescriptorTypeOp,
-    UINT32                  CurrentByteOffset,
+    ASL_RESOURCE_INFO       *Info,
     UINT8                   *State);
 
 /* Values for State above */
@@ -1070,43 +1107,35 @@ RsDoResourceTemplate (
  */
 ASL_RESOURCE_NODE *
 RsDoEndTagDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset);
+    ASL_RESOURCE_INFO       *Info);
 
 ASL_RESOURCE_NODE *
 RsDoEndDependentDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset);
+    ASL_RESOURCE_INFO       *Info);
 
 ASL_RESOURCE_NODE *
 RsDoMemory24Descriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset);
+    ASL_RESOURCE_INFO       *Info);
 
 ASL_RESOURCE_NODE *
 RsDoMemory32Descriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset);
+    ASL_RESOURCE_INFO       *Info);
 
 ASL_RESOURCE_NODE *
 RsDoMemory32FixedDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset);
+    ASL_RESOURCE_INFO       *Info);
 
 ASL_RESOURCE_NODE *
 RsDoStartDependentDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset);
+    ASL_RESOURCE_INFO       *Info);
 
 ASL_RESOURCE_NODE *
 RsDoStartDependentNoPriDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset);
+    ASL_RESOURCE_INFO       *Info);
 
 ASL_RESOURCE_NODE *
 RsDoVendorSmallDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset);
+    ASL_RESOURCE_INFO       *Info);
 
 
 /*
@@ -1114,33 +1143,27 @@ RsDoVendorSmallDescriptor (
  */
 ASL_RESOURCE_NODE *
 RsDoDmaDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset);
+    ASL_RESOURCE_INFO       *Info);
 
 ASL_RESOURCE_NODE *
 RsDoFixedDmaDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset);
+    ASL_RESOURCE_INFO       *Info);
 
 ASL_RESOURCE_NODE *
 RsDoFixedIoDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset);
+    ASL_RESOURCE_INFO       *Info);
 
 ASL_RESOURCE_NODE *
 RsDoIoDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset);
+    ASL_RESOURCE_INFO       *Info);
 
 ASL_RESOURCE_NODE *
 RsDoIrqDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset);
+    ASL_RESOURCE_INFO       *Info);
 
 ASL_RESOURCE_NODE *
 RsDoIrqNoFlagsDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset);
+    ASL_RESOURCE_INFO       *Info);
 
 
 /*
@@ -1148,61 +1171,50 @@ RsDoIrqNoFlagsDescriptor (
  */
 ASL_RESOURCE_NODE *
 RsDoInterruptDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset);
+    ASL_RESOURCE_INFO       *Info);
 
 ASL_RESOURCE_NODE *
 RsDoVendorLargeDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset);
+    ASL_RESOURCE_INFO       *Info);
 
 ASL_RESOURCE_NODE *
 RsDoGeneralRegisterDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset);
+    ASL_RESOURCE_INFO       *Info);
 
 ASL_RESOURCE_NODE *
 RsDoGpioIntDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset);
+    ASL_RESOURCE_INFO       *Info);
 
 ASL_RESOURCE_NODE *
 RsDoGpioIoDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset);
+    ASL_RESOURCE_INFO       *Info);
 
 ASL_RESOURCE_NODE *
 RsDoI2cSerialBusDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset);
+    ASL_RESOURCE_INFO       *Info);
 
 ASL_RESOURCE_NODE *
 RsDoSpiSerialBusDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset);
+    ASL_RESOURCE_INFO       *Info);
 
 ASL_RESOURCE_NODE *
 RsDoUartSerialBusDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset);
+    ASL_RESOURCE_INFO       *Info);
 
 /*
  * aslrestype2d - DWord address descriptors
  */
 ASL_RESOURCE_NODE *
 RsDoDwordIoDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset);
+    ASL_RESOURCE_INFO       *Info);
 
 ASL_RESOURCE_NODE *
 RsDoDwordMemoryDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset);
+    ASL_RESOURCE_INFO       *Info);
 
 ASL_RESOURCE_NODE *
 RsDoDwordSpaceDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset);
+    ASL_RESOURCE_INFO       *Info);
 
 
 /*
@@ -1210,18 +1222,15 @@ RsDoDwordSpaceDescriptor (
  */
 ASL_RESOURCE_NODE *
 RsDoExtendedIoDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset);
+    ASL_RESOURCE_INFO       *Info);
 
 ASL_RESOURCE_NODE *
 RsDoExtendedMemoryDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset);
+    ASL_RESOURCE_INFO       *Info);
 
 ASL_RESOURCE_NODE *
 RsDoExtendedSpaceDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset);
+    ASL_RESOURCE_INFO       *Info);
 
 
 /*
@@ -1229,18 +1238,15 @@ RsDoExtendedSpaceDescriptor (
  */
 ASL_RESOURCE_NODE *
 RsDoQwordIoDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset);
+    ASL_RESOURCE_INFO       *Info);
 
 ASL_RESOURCE_NODE *
 RsDoQwordMemoryDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset);
+    ASL_RESOURCE_INFO       *Info);
 
 ASL_RESOURCE_NODE *
 RsDoQwordSpaceDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset);
+    ASL_RESOURCE_INFO       *Info);
 
 
 /*
@@ -1248,18 +1254,16 @@ RsDoQwordSpaceDescriptor (
  */
 ASL_RESOURCE_NODE *
 RsDoWordIoDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset);
+    ASL_RESOURCE_INFO       *Info);
 
 ASL_RESOURCE_NODE *
 RsDoWordSpaceDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset);
+    ASL_RESOURCE_INFO       *Info);
 
 ASL_RESOURCE_NODE *
 RsDoWordBusNumberDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset);
+    ASL_RESOURCE_INFO       *Info);
+
 
 /*
  * Entry to data table compiler subsystem
index 523241a..c26408f 100644 (file)
@@ -117,7 +117,49 @@ NamePathTail                [.]{NameSeg}
                               else {yyterminate ();} }
 ";"                         { count (0); return(';'); }
 
-
+    /* ASL Extension: Standard C operators */
+
+"~"                         { count (3); return (PARSEOP_EXP_NOT); }
+"!"                         { count (3); return (PARSEOP_EXP_LOGICAL_NOT); }
+"*"                         { count (3); return (PARSEOP_EXP_MULTIPLY); }
+"/"                         { count (3); return (PARSEOP_EXP_DIVIDE); }
+"%"                         { count (3); return (PARSEOP_EXP_MODULO); }
+"+"                         { count (3); return (PARSEOP_EXP_ADD); }
+"-"                         { count (3); return (PARSEOP_EXP_SUBTRACT); }
+">>"                        { count (3); return (PARSEOP_EXP_SHIFT_RIGHT); }
+"<<"                        { count (3); return (PARSEOP_EXP_SHIFT_LEFT); }
+"<"                         { count (3); return (PARSEOP_EXP_LESS); }
+">"                         { count (3); return (PARSEOP_EXP_GREATER); }
+"&"                         { count (3); return (PARSEOP_EXP_AND); }
+"<="                        { count (3); return (PARSEOP_EXP_LESS_EQUAL); }
+">="                        { count (3); return (PARSEOP_EXP_GREATER_EQUAL); }
+"=="                        { count (3); return (PARSEOP_EXP_EQUAL); }
+"!="                        { count (3); return (PARSEOP_EXP_NOT_EQUAL); }
+"|"                         { count (3); return (PARSEOP_EXP_OR); }
+"&&"                        { count (3); return (PARSEOP_EXP_LOGICAL_AND); }
+"||"                        { count (3); return (PARSEOP_EXP_LOGICAL_OR); }
+"++"                        { count (3); return (PARSEOP_EXP_INCREMENT); }
+"--"                        { count (3); return (PARSEOP_EXP_DECREMENT); }
+"^ "                        { count (3); return (PARSEOP_EXP_XOR); }
+
+    /* ASL Extension: Standard C assignment operators */
+
+"="                         { count (3); return (PARSEOP_EXP_EQUALS); }
+"+="                        { count (3); return (PARSEOP_EXP_ADD_EQ); }
+"-="                        { count (3); return (PARSEOP_EXP_SUB_EQ); }
+"*="                        { count (3); return (PARSEOP_EXP_MUL_EQ); }
+"/="                        { count (3); return (PARSEOP_EXP_DIV_EQ); }
+"%="                        { count (3); return (PARSEOP_EXP_MOD_EQ); }
+"<<="                       { count (3); return (PARSEOP_EXP_SHL_EQ); }
+">>="                       { count (3); return (PARSEOP_EXP_SHR_EQ); }
+"&="                        { count (3); return (PARSEOP_EXP_AND_EQ); }
+"^="                        { count (3); return (PARSEOP_EXP_XOR_EQ); }
+"|="                        { count (3); return (PARSEOP_EXP_OR_EQ); }
+
+
+    /*
+     * Begin standard ASL grammar
+     */
 0[xX]{HexDigitChar}+ |
 {DigitChar}+                { AslCompilerlval.i = UtDoConstant ((char *) AslCompilertext);
                                 count (1); return (PARSEOP_INTEGER); }
@@ -592,6 +634,44 @@ NamePathTail                [.]{NameSeg}
 "Transfer8_16"              { count (0); return (PARSEOP_XFERTYPE_8_16); }
 "Transfer16"                { count (0); return (PARSEOP_XFERTYPE_16); }
 
+    /* ToPld macro */
+
+"ToPLD"                     { count (0); return (PARSEOP_TOPLD); }
+
+"PLD_Revision"              { count (0); return (PARSEOP_PLD_REVISION); }
+"PLD_IgnoreColor"           { count (0); return (PARSEOP_PLD_IGNORECOLOR); }
+"PLD_Red"                   { count (0); return (PARSEOP_PLD_RED); }
+"PLD_Green"                 { count (0); return (PARSEOP_PLD_GREEN); }
+"PLD_Blue"                  { count (0); return (PARSEOP_PLD_BLUE); }
+"PLD_Width"                 { count (0); return (PARSEOP_PLD_WIDTH); }
+"PLD_Height"                { count (0); return (PARSEOP_PLD_HEIGHT); }
+"PLD_UserVisible"           { count (0); return (PARSEOP_PLD_USERVISIBLE); }
+"PLD_Dock"                  { count (0); return (PARSEOP_PLD_DOCK); }
+"PLD_Lid"                   { count (0); return (PARSEOP_PLD_LID); }
+"PLD_Panel"                 { count (0); return (PARSEOP_PLD_PANEL); }
+"PLD_VerticalPosition"      { count (0); return (PARSEOP_PLD_VERTICALPOSITION); }
+"PLD_HorizontalPosition"    { count (0); return (PARSEOP_PLD_HORIZONTALPOSITION); }
+"PLD_Shape"                 { count (0); return (PARSEOP_PLD_SHAPE); }
+"PLD_GroupOrientation"      { count (0); return (PARSEOP_PLD_GROUPORIENTATION); }
+"PLD_GroupToken"            { count (0); return (PARSEOP_PLD_GROUPTOKEN); }
+"PLD_GroupPosition"         { count (0); return (PARSEOP_PLD_GROUPPOSITION); }
+"PLD_Bay"                   { count (0); return (PARSEOP_PLD_BAY); }
+"PLD_Ejectable"             { count (0); return (PARSEOP_PLD_EJECTABLE); }
+"PLD_EjectRequired"         { count (0); return (PARSEOP_PLD_EJECTREQUIRED); }
+"PLD_CabinetNumber"         { count (0); return (PARSEOP_PLD_CABINETNUMBER); }
+"PLD_CardCageNumber"        { count (0); return (PARSEOP_PLD_CARDCAGENUMBER); }
+"PLD_Reference"             { count (0); return (PARSEOP_PLD_REFERENCE); }
+"PLD_Rotation"              { count (0); return (PARSEOP_PLD_ROTATION); }
+"PLD_Order"                 { count (0); return (PARSEOP_PLD_ORDER); }
+"PLD_Reserved"              { count (0); return (PARSEOP_PLD_RESERVED); }
+"PLD_VerticalOffset"        { count (0); return (PARSEOP_PLD_VERTICALOFFSET); }
+"PLD_HorizontalOffset"      { count (0); return (PARSEOP_PLD_HORIZONTALOFFSET); }
+
+
+    /* printf debug macros */
+"printf"                    { count (0); return (PARSEOP_PRINTF); }
+"fprintf"                   { count (0); return (PARSEOP_FPRINTF); }
+
     /* Predefined compiler names */
 
 "__DATE__"                  { count (0); return (PARSEOP___DATE__); }
@@ -628,10 +708,6 @@ NamePathTail                [.]{NameSeg}
                                 DbgPrint (ASL_PARSE_OUTPUT, "NameString: %s\n", s);
                                 return (PARSEOP_NAMESTRING); }
 
-"*" |
-"/"                         { count (1);
-                                AslCompilererror ("Parse error, expecting ASL keyword or name");}
-
 .                           { count (1);
                                 sprintf (MsgBuffer,
                                     "Invalid character (0x%2.2X), expecting ASL keyword or name",
index c76b4a0..2c13196 100644 (file)
@@ -49,8 +49,8 @@
  * Compiler versions and names
  */
 #define ASL_REVISION                ACPI_CA_VERSION
-#define ASL_COMPILER_NAME           "ASL Optimizing Compiler"
-#define AML_DISASSEMBLER_NAME       "AML Disassembler"
+#define ASL_COMPILER_NAME           "ASL+ Optimizing Compiler"
+#define AML_DISASSEMBLER_NAME       "AML/ASL+ Disassembler"
 #define ASL_INVOCATION_NAME         "iasl"
 #define ASL_CREATOR_ID              "INTL"
 
 
 #define FILE_SUFFIX_PREPROCESSOR    "i"
 #define FILE_SUFFIX_AML_CODE        "aml"
+#define FILE_SUFFIX_MAP             "map"
 #define FILE_SUFFIX_LISTING         "lst"
 #define FILE_SUFFIX_HEX_DUMP        "hex"
 #define FILE_SUFFIX_DEBUG           "txt"
index e347e69..a3cbb20 100644 (file)
@@ -81,7 +81,8 @@ ASL_FILE_INFO                       Gbl_Files [ASL_NUM_FILES] =
     {NULL, NULL, "C Source:     ", "C Code Output"},
     {NULL, NULL, "ASM Include:  ", "Assembly Header Output"},
     {NULL, NULL, "C Include:    ", "C Header Output"},
-    {NULL, NULL, "Offset Table: ", "C Offset Table Output"}
+    {NULL, NULL, "Offset Table: ", "C Offset Table Output"},
+    {NULL, NULL, "Device Map:   ", "Device Map Output"}
 };
 
 #else
@@ -141,6 +142,7 @@ ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_PreprocessFlag, TRUE);
 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_DisassembleAll, FALSE);
 
 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_UseDefaultAmlFilename, TRUE);
+ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_MapfileFlag, FALSE);
 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_NsOutputFlag, FALSE);
 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_PreprocessorOutputFlag, FALSE);
 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_DebugFlag, FALSE);
@@ -171,6 +173,7 @@ ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_VerboseTemplates, FALSE
 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_DoTemplates, FALSE);
 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_CompileGeneric, FALSE);
 ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_AllExceptionsDisabled, FALSE);
+ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_PruneParseTree, FALSE);
 
 
 #define HEX_OUTPUT_NONE             0
@@ -221,6 +224,11 @@ ASL_EXTERN ASL_CACHE_INFO           ASL_INIT_GLOBAL (*Gbl_StringCacheList, NULL)
 ASL_EXTERN char                     ASL_INIT_GLOBAL (*Gbl_StringCacheNext, NULL);
 ASL_EXTERN char                     ASL_INIT_GLOBAL (*Gbl_StringCacheLast, NULL);
 
+/* Map file */
+
+ASL_EXTERN ACPI_GPIO_INFO           ASL_INIT_GLOBAL (*Gbl_GpioList, NULL);
+ASL_EXTERN ACPI_SERIAL_INFO         ASL_INIT_GLOBAL (*Gbl_SerialList, NULL);
+
 
 /* Misc */
 
@@ -244,6 +252,8 @@ ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (Gbl_NumNamespaceObjects, 0)
 ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (Gbl_ReservedMethods, 0);
 ASL_EXTERN char                     ASL_INIT_GLOBAL (*Gbl_TableSignature, "NO_SIG");
 ASL_EXTERN char                     ASL_INIT_GLOBAL (*Gbl_TableId, "NO_ID");
+ASL_EXTERN UINT8                    ASL_INIT_GLOBAL (Gbl_PruneDepth, 0);
+ASL_EXTERN UINT16                   ASL_INIT_GLOBAL (Gbl_PruneType, 0);
 
 
 /* Static structures */
index ff02d53..075781a 100644 (file)
@@ -41,8 +41,6 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-#define __ASLLOAD_C__
-
 #include "aslcompiler.h"
 #include "amlcode.h"
 #include "acdispat.h"
@@ -360,7 +358,6 @@ LdNamespace1Begin (
     ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op %p [%s]\n",
         Op, Op->Asl.ParseOpName));
 
-
     /*
      * We are only interested in opcodes that have an associated name
      * (or multiple names)
@@ -374,6 +371,34 @@ LdNamespace1Begin (
         Status = LdLoadFieldElements (Op, WalkState);
         return (Status);
 
+    case AML_INT_CONNECTION_OP:
+
+
+        if (Op->Asl.Child->Asl.AmlOpcode != AML_INT_NAMEPATH_OP)
+        {
+            break;
+        }
+        Arg = Op->Asl.Child;
+
+        Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Asl.ExternalName,
+            ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
+            WalkState, &Node);
+        if (ACPI_FAILURE (Status))
+        {
+            break;
+        }
+
+        if (Node->Type == ACPI_TYPE_BUFFER)
+        {
+            Arg->Asl.Node = Node;
+
+            Arg = Node->Op->Asl.Child;  /* Get namepath */
+            Arg = Arg->Asl.Next;        /* Get actual buffer */
+            Arg = Arg->Asl.Child;       /* Buffer length */
+            Arg = Arg->Asl.Next;        /* RAW_DATA buffer */
+        }
+        break;
+
     default:
 
         /* All other opcodes go below */
@@ -467,7 +492,6 @@ LdNamespace1Begin (
         ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode);
         break;
 
-
     case PARSEOP_SCOPE:
         /*
          * The name referenced by Scope(Name) must already exist at this point.
index 25dca94..9738fb5 100644 (file)
@@ -172,6 +172,7 @@ Usage (
 
     printf ("\nOptional Listing Files:\n");
     ACPI_OPTION ("-l",              "Create mixed listing file (ASL source and AML) (*.lst)");
+    ACPI_OPTION ("-lm",             "Create hardware summary map file (*.map)");
     ACPI_OPTION ("-ln",             "Create namespace file (*.nsp)");
     ACPI_OPTION ("-ls",             "Create combined source file (expanded includes) (*.src)");
 
@@ -186,13 +187,17 @@ Usage (
     ACPI_OPTION ("-db",             "Do not translate Buffers to Resource Templates");
     ACPI_OPTION ("-dc <f1 f2 ...>", "Disassemble AML and immediately compile it");
     ACPI_OPTION ("",                "  (Obtain DSDT from current system if no input file)");
+    ACPI_OPTION ("-dl",             "Emit legacy ASL code only (no C-style operators)");
     ACPI_OPTION ("-e  <f1 f2 ...>", "Include ACPI table(s) for external symbol resolution");
     ACPI_OPTION ("-fe <file>",      "Specify external symbol declaration file");
     ACPI_OPTION ("-in",             "Ignore NoOp opcodes");
     ACPI_OPTION ("-vt",             "Dump binary table data in hex format within output file");
 
     printf ("\nDebug Options:\n");
-    ACPI_OPTION ("-bf -bt",         "Create debug file (full or parse tree only) (*.txt)");
+    ACPI_OPTION ("-bf",             "Create debug file (full output) (*.txt)");
+    ACPI_OPTION ("-bs",             "Create debug file (parse tree only) (*.txt)");
+    ACPI_OPTION ("-bp <depth>",     "Prune ASL parse tree");
+    ACPI_OPTION ("-bt <type>",      "Object type to be pruned from the parse tree");
     ACPI_OPTION ("-f",              "Ignore errors, force creation of AML output file(s)");
     ACPI_OPTION ("-m <size>",       "Set internal line buffer size (in Kbytes)");
     ACPI_OPTION ("-n",              "Parse only, no output generation");
@@ -404,7 +409,6 @@ main (
 CleanupAndExit:
 
     UtFreeLineBuffers ();
-
     AslParserCleanup ();
 
     if (AcpiGbl_ExternalFileList)
index 84fb242..3e9f613 100644 (file)
@@ -446,7 +446,38 @@ const ASL_MAPPING_ENTRY     AslKeywordMapping [] =
 /* XFERTYPE_16 */               OP_TABLE_ENTRY (AML_BYTE_OP,                2,                              0,                  0),
 /* XOR */                       OP_TABLE_ENTRY (AML_BIT_XOR_OP,             0,                              0,                  ACPI_BTYPE_INTEGER),
 /* ZERO */                      OP_TABLE_ENTRY (AML_ZERO_OP,                0,                              0,                  ACPI_BTYPE_INTEGER),
-
+/* TOPLD */                     OP_TABLE_ENTRY (AML_DWORD_OP,               0,                              NODE_AML_PACKAGE,   ACPI_BTYPE_INTEGER),
+/* XFERSIZE_128 */              OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0),
+/* REVISION */                  OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0),
+/* IGNORECOLOR */               OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0),
+/* RED */                       OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0),
+/* GREEN */                     OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0),
+/* BLUE */                      OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0),
+/* WIDTH */                     OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0),
+/* HEIGHT */                    OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0),
+/* USERVISIBLE */               OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0),
+/* DOCK */                      OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0),
+/* LID */                       OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0),
+/* PANEL */                     OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0),
+/* VERTICALPOSITION */          OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0),
+/* HORIZONTALPOSITION */        OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0),
+/* SHAPE */                     OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0),
+/* GROUPORIENTATION */          OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0),
+/* GROUPTOKEN */                OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0),
+/* GROUPPOSITION */             OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0),
+/* BAY */                       OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0),
+/* EJECTABLE */                 OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0),
+/* EJECTREQUIRED */             OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0),
+/* CABINETNUMBER */             OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0),
+/* CARDCAGENUMBER */            OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0),
+/* REFERENCE */                 OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0),
+/* ROTATION */                  OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0),
+/* ORDER */                     OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0),
+/* RESERVED */                  OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0),
+/* VERTICALOFFSET */            OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0),
+/* HORIZONTALOFFSET */          OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0),
+/* PRINTF */                    OP_TABLE_ENTRY (AML_STORE_OP,               0,                              0,                  ACPI_BTYPE_DATA_REFERENCE),
+/* FPRINTF */                   OP_TABLE_ENTRY (AML_STORE_OP,               0,                              0,                  ACPI_BTYPE_DATA_REFERENCE),
 /*! [End] no source code translation !*/
 
 };
diff --git a/sys/contrib/dev/acpica/source/compiler/aslmapenter.c b/sys/contrib/dev/acpica/source/compiler/aslmapenter.c
new file mode 100644 (file)
index 0000000..a97c555
--- /dev/null
@@ -0,0 +1,346 @@
+/******************************************************************************
+ *
+ * Module Name: aslmapenter - Build resource descriptor/device maps
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2014, 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:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include "acpi.h"
+#include "accommon.h"
+#include "acapps.h"
+#include "aslcompiler.h"
+
+/* This module used for application-level code only */
+
+#define _COMPONENT          ACPI_COMPILER
+        ACPI_MODULE_NAME    ("aslmapenter")
+
+/* Local prototypes */
+
+static ACPI_GPIO_INFO *
+MpCreateGpioInfo (
+    UINT16                  PinNumber,
+    char                    *DeviceName);
+
+static ACPI_SERIAL_INFO *
+MpCreateSerialInfo (
+    char                    *DeviceName,
+    UINT16                  Address);
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    MpSaveGpioInfo
+ *
+ * PARAMETERS:  Resource                - GPIO resource descriptor
+ *              PinCount                - From GPIO descriptor
+ *              PinList                 - From GPIO descriptor
+ *              DeviceName              - The "ResourceSource" name
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: External Interface.
+ *              Save GPIO resource descriptor information.
+ *              Creates new GPIO info blocks, one for each pin defined by the
+ *              GPIO descriptor.
+ *
+ ******************************************************************************/
+
+void
+MpSaveGpioInfo (
+    ACPI_PARSE_OBJECT       *Op,
+    AML_RESOURCE            *Resource,
+    UINT32                  PinCount,
+    UINT16                  *PinList,
+    char                    *DeviceName)
+{
+    ACPI_GPIO_INFO          *Info;
+    UINT32                  i;
+
+
+    /* Mapfile option enabled? */
+
+    if (!Gbl_MapfileFlag)
+    {
+        return;
+    }
+
+    /* Create an info block for each pin defined in the descriptor */
+
+    for (i = 0; i < PinCount; i++)
+    {
+        Info = MpCreateGpioInfo (PinList[i], DeviceName);
+
+        Info->Op = Op;
+        Info->DeviceName = DeviceName;
+        Info->PinCount = PinCount;
+        Info->PinIndex = i;
+        Info->PinNumber = PinList[i];
+        Info->Type = Resource->Gpio.ConnectionType;
+        Info->Direction = (UINT8) (Resource->Gpio.IntFlags & 0x0003);       /* _IOR, for IO descriptor */
+        Info->Polarity = (UINT8) ((Resource->Gpio.IntFlags >> 1) & 0x0003); /* _POL, for INT descriptor */
+    }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    MpSaveSerialInfo
+ *
+ * PARAMETERS:  Resource                - A Serial resource descriptor
+ *              DeviceName              - The "ResourceSource" name.
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: External Interface.
+ *              Save serial resource descriptor information.
+ *              Creates a new serial info block.
+ *
+ ******************************************************************************/
+
+void
+MpSaveSerialInfo (
+    ACPI_PARSE_OBJECT       *Op,
+    AML_RESOURCE            *Resource,
+    char                    *DeviceName)
+{
+    ACPI_SERIAL_INFO        *Info;
+    UINT16                  Address;
+    UINT32                  Speed;
+
+
+    /* Mapfile option enabled? */
+
+    if (!Gbl_MapfileFlag)
+    {
+        return;
+    }
+
+    if (Resource->DescriptorType != ACPI_RESOURCE_NAME_SERIAL_BUS)
+    {
+        return;
+    }
+
+    /* Extract address and speed from the resource descriptor */
+
+    switch (Resource->CommonSerialBus.Type)
+    {
+    case AML_RESOURCE_I2C_SERIALBUSTYPE:
+
+        Address = Resource->I2cSerialBus.SlaveAddress;
+        Speed = Resource->I2cSerialBus.ConnectionSpeed;
+        break;
+
+    case AML_RESOURCE_SPI_SERIALBUSTYPE:
+
+        Address = Resource->SpiSerialBus.DeviceSelection;
+        Speed = Resource->SpiSerialBus.ConnectionSpeed;
+        break;
+
+    case AML_RESOURCE_UART_SERIALBUSTYPE:
+
+        Address = 0;
+        Speed = Resource->UartSerialBus.DefaultBaudRate;
+        break;
+
+    default:    /* Invalid bus subtype */
+        return;
+    }
+
+    Info = MpCreateSerialInfo (DeviceName, Address);
+
+    Info->Op = Op;
+    Info->DeviceName = DeviceName;
+    Info->Resource = Resource;
+    Info->Address = Address;
+    Info->Speed = Speed;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    MpCreateGpioInfo
+ *
+ * PARAMETERS:  PinNumber               - GPIO pin number
+ *              DeviceName              - The "ResourceSource" name
+ *
+ * RETURN:      New GPIO info block.
+ *
+ * DESCRIPTION: Create a new GPIO info block and place it on the global list.
+ *              The list is sorted by GPIO device names first, and pin numbers
+ *              secondarily.
+ *
+ ******************************************************************************/
+
+static ACPI_GPIO_INFO *
+MpCreateGpioInfo (
+    UINT16                  PinNumber,
+    char                    *DeviceName)
+{
+    ACPI_GPIO_INFO          *Info;
+    ACPI_GPIO_INFO          *NextGpio;
+    ACPI_GPIO_INFO          *PrevGpio;
+
+
+    /*
+     * Allocate a new info block and insert it into the global GPIO list
+     * sorted by both source device name and then the pin number. There is
+     * one block per pin.
+     */
+    Info = ACPI_CAST_PTR (ACPI_GPIO_INFO,
+        UtStringCacheCalloc (sizeof (ACPI_GPIO_INFO)));
+
+    NextGpio = Gbl_GpioList;
+    PrevGpio = NULL;
+    if (!Gbl_GpioList)
+    {
+        Gbl_GpioList = Info;
+        Info->Next = NULL;
+        return (Info);
+    }
+
+    /* Sort on source DeviceName first */
+
+    while (NextGpio &&
+            (ACPI_STRCMP (DeviceName, NextGpio->DeviceName) > 0))
+    {
+        PrevGpio = NextGpio;
+        NextGpio = NextGpio->Next;
+    }
+
+    /* Now sort on the PinNumber */
+
+    while (NextGpio &&
+            (NextGpio->PinNumber < PinNumber) &&
+            !ACPI_STRCMP (DeviceName, NextGpio->DeviceName))
+    {
+        PrevGpio = NextGpio;
+        NextGpio = NextGpio->Next;
+    }
+
+    /* Finish the list insertion */
+
+    if (PrevGpio)
+    {
+        PrevGpio->Next = Info;
+    }
+    else
+    {
+        Gbl_GpioList = Info;
+    }
+
+    Info->Next = NextGpio;
+    return (Info);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    MpCreateSerialInfo
+ *
+ * PARAMETERS:  DeviceName              - The "ResourceSource" name.
+ *              Address                 - Physical address for the device
+ *
+ * RETURN:      New Serial info block.
+ *
+ * DESCRIPTION: Create a new Serial info block and place it on the global list.
+ *              The list is sorted by Serial device names first, and addresses
+ *              secondarily.
+ *
+ ******************************************************************************/
+
+static ACPI_SERIAL_INFO *
+MpCreateSerialInfo (
+    char                    *DeviceName,
+    UINT16                  Address)
+{
+    ACPI_SERIAL_INFO        *Info;
+    ACPI_SERIAL_INFO        *NextSerial;
+    ACPI_SERIAL_INFO        *PrevSerial;
+
+
+    /*
+     * Allocate a new info block and insert it into the global Serial list
+     * sorted by both source device name and then the address.
+     */
+    Info = ACPI_CAST_PTR (ACPI_SERIAL_INFO,
+        UtStringCacheCalloc (sizeof (ACPI_SERIAL_INFO)));
+
+    NextSerial = Gbl_SerialList;
+    PrevSerial = NULL;
+    if (!Gbl_SerialList)
+    {
+        Gbl_SerialList = Info;
+        Info->Next = NULL;
+        return (Info);
+    }
+
+    /* Sort on source DeviceName */
+
+    while (NextSerial &&
+        (ACPI_STRCMP (DeviceName, NextSerial->DeviceName) > 0))
+    {
+        PrevSerial = NextSerial;
+        NextSerial = NextSerial->Next;
+    }
+
+    /* Now sort on the Address */
+
+    while (NextSerial &&
+        (NextSerial->Address < Address) &&
+        !ACPI_STRCMP (DeviceName, NextSerial->DeviceName))
+    {
+        PrevSerial = NextSerial;
+        NextSerial = NextSerial->Next;
+    }
+
+    /* Finish the list insertion */
+
+    if (PrevSerial)
+    {
+        PrevSerial->Next = Info;
+    }
+    else
+    {
+        Gbl_SerialList = Info;
+    }
+
+    Info->Next = NextSerial;
+    return (Info);
+}
diff --git a/sys/contrib/dev/acpica/source/compiler/aslmapoutput.c b/sys/contrib/dev/acpica/source/compiler/aslmapoutput.c
new file mode 100644 (file)
index 0000000..404c843
--- /dev/null
@@ -0,0 +1,661 @@
+/******************************************************************************
+ *
+ * Module Name: aslmapoutput - Output/emit the resource descriptor/device maps
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2014, 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:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include "acpi.h"
+#include "accommon.h"
+#include "acapps.h"
+#include "aslcompiler.h"
+#include "aslcompiler.y.h"
+#include "acinterp.h"
+#include "acparser.h"
+#include "acnamesp.h"
+#include "amlcode.h"
+
+/* This module used for application-level code only */
+
+#define _COMPONENT          ACPI_COMPILER
+        ACPI_MODULE_NAME    ("aslmapoutput")
+
+/* Local prototypes */
+
+static void
+MpEmitGpioInfo (
+    void);
+
+static void
+MpEmitSerialInfo (
+    void);
+
+static void
+MpEmitDeviceTree (
+    void);
+
+static ACPI_STATUS
+MpEmitOneDevice (
+    ACPI_HANDLE             ObjHandle,
+    UINT32                  NestingLevel,
+    void                    *Context,
+    void                    **ReturnValue);
+
+static void
+MpXrefDevices (
+    ACPI_GPIO_INFO          *Info);
+
+static ACPI_STATUS
+MpNamespaceXrefBegin (
+    ACPI_PARSE_OBJECT       *Op,
+    UINT32                  Level,
+    void                    *Context);
+
+
+/* Strings used to decode flag bits */
+
+const char                  *DirectionDecode[] =
+{
+    "Both I/O   ",
+    "InputOnly  ",
+    "OutputOnly ",
+    "Preserve   "
+};
+
+const char                  *PolarityDecode[] =
+{
+    "ActiveHigh",
+    "ActiveLow ",
+    "ActiveBoth",
+    "Reserved  "
+};
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    MpEmitMappingInfo
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: External interface.
+ *              Create and open the mapfile and emit all of the collected
+ *              hardware mapping information. Includes: GPIO information,
+ *              Serial information, and a dump of the entire ACPI device tree.
+ *
+ ******************************************************************************/
+
+void
+MpEmitMappingInfo (
+    void)
+{
+    char                    *NewFilename;
+
+
+    /* Mapfile option enabled? */
+
+    if (!Gbl_MapfileFlag)
+    {
+        return;
+    }
+
+    /* Create/Open a map file */
+
+    NewFilename = FlGenerateFilename (Gbl_OutputFilenamePrefix,
+        FILE_SUFFIX_MAP);
+    if (!NewFilename)
+    {
+        AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME,
+            0, 0, 0, 0, NULL, NULL);
+    }
+
+    /* Open the hex file, text mode (closed at compiler exit) */
+
+    FlOpenFile (ASL_FILE_MAP_OUTPUT, NewFilename, "w+t");
+    AslCompilerSignon (ASL_FILE_MAP_OUTPUT);
+    AslCompilerFileHeader (ASL_FILE_MAP_OUTPUT);
+
+    if (!Gbl_GpioList)
+    {
+        FlPrintFile (ASL_FILE_MAP_OUTPUT,
+            "\nNo GPIO devices found\n");
+    }
+
+    if (!Gbl_SerialList)
+    {
+        FlPrintFile (ASL_FILE_MAP_OUTPUT,
+            "\nNo Serial devices found (I2C/SPI/UART)\n");
+    }
+
+    if (!Gbl_GpioList && !Gbl_SerialList)
+    {
+        return;
+    }
+
+    /* Headers */
+
+    FlPrintFile (ASL_FILE_MAP_OUTPUT, "\nResource Descriptor Connectivity Map\n");
+    FlPrintFile (ASL_FILE_MAP_OUTPUT,   "------------------------------------\n");
+
+    /* Emit GPIO and Serial descriptors, then entire ACPI device tree */
+
+    MpEmitGpioInfo ();
+    MpEmitSerialInfo ();
+    MpEmitDeviceTree ();
+
+    /* Clear the lists - no need to free memory here */
+
+    Gbl_SerialList = NULL;
+    Gbl_GpioList = NULL;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    MpEmitGpioInfo
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Emit the info about all GPIO devices found during the
+ *              compile or disassembly.
+ *
+ ******************************************************************************/
+
+static void
+MpEmitGpioInfo (
+    void)
+{
+    ACPI_GPIO_INFO          *Info;
+    char                    *Type;
+    char                    *PrevDeviceName = NULL;
+    const char              *Direction;
+    const char              *Polarity;
+    char                    *ParentPathname;
+    const char              *Description;
+    char                    *HidString;
+    const AH_DEVICE_ID      *HidInfo;
+
+
+    /* Walk the GPIO descriptor list */
+
+    Info = Gbl_GpioList;
+    while (Info)
+    {
+        HidString = MpGetHidViaNamestring (Info->DeviceName);
+
+        /* Print header info for the controller itself */
+
+        if (!PrevDeviceName ||
+            ACPI_STRCMP (PrevDeviceName, Info->DeviceName))
+        {
+            FlPrintFile (ASL_FILE_MAP_OUTPUT,
+                "\n\nGPIO Controller:  %-8s  %-28s",
+                HidString, Info->DeviceName);
+
+            HidInfo = AcpiAhMatchHardwareId (HidString);
+            if (HidInfo)
+            {
+                FlPrintFile (ASL_FILE_MAP_OUTPUT, "  // %s",
+                    HidInfo->Description);
+            }
+
+            FlPrintFile (ASL_FILE_MAP_OUTPUT,
+                "\n\nPin   Type     Direction    Polarity"
+                "    Dest _HID  Destination\n");
+        }
+
+        PrevDeviceName = Info->DeviceName;
+
+        /* Setup various strings based upon the type (GpioInt or GpioIo) */
+
+        switch (Info->Type)
+        {
+        case AML_RESOURCE_GPIO_TYPE_INT:
+
+            Type = "GpioInt";
+            Direction = "-Interrupt-";
+            Polarity = PolarityDecode[Info->Polarity];
+            break;
+
+        case AML_RESOURCE_GPIO_TYPE_IO:
+
+            Type = "GpioIo ";
+            Direction = DirectionDecode[Info->Direction];
+            Polarity = "          ";
+            break;
+
+        default:
+            continue;
+        }
+
+        /* Emit the GPIO info */
+
+        FlPrintFile (ASL_FILE_MAP_OUTPUT, "%4.4X  %s  %s  %s  ",
+            Info->PinNumber, Type, Direction, Polarity);
+
+        ParentPathname = NULL;
+        HidString = MpGetConnectionInfo (Info->Op, Info->PinIndex,
+            &Info->TargetNode, &ParentPathname);
+        if (HidString)
+        {
+            /*
+             * This is a Connection() field
+             * Attempt to find all references to the field.
+             */
+            FlPrintFile (ASL_FILE_MAP_OUTPUT, "%8s   %-28s",
+                HidString, ParentPathname);
+
+            MpXrefDevices (Info);
+        }
+        else
+        {
+            /*
+             * For Devices, attempt to get the _HID description string.
+             * Failing that (many _HIDs are not recognized), attempt to
+             * get the _DDN description string.
+             */
+            HidString = MpGetParentDeviceHid (Info->Op, &Info->TargetNode,
+                &ParentPathname);
+
+            FlPrintFile (ASL_FILE_MAP_OUTPUT, "%8s   %-28s",
+                HidString, ParentPathname);
+
+            /* Get the _HID description or _DDN string */
+
+            HidInfo = AcpiAhMatchHardwareId (HidString);
+            if (HidInfo)
+            {
+                FlPrintFile (ASL_FILE_MAP_OUTPUT, "  // %s",
+                    HidInfo->Description);
+            }
+            else if ((Description = MpGetDdnValue (ParentPathname)))
+            {
+                FlPrintFile (ASL_FILE_MAP_OUTPUT, "  // %s (_DDN)",
+                    Description);
+            }
+        }
+
+        FlPrintFile (ASL_FILE_MAP_OUTPUT, "\n");
+        ACPI_FREE (ParentPathname);
+        Info = Info->Next;
+    }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    MpEmitSerialInfo
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Emit the info about all Serial devices found during the
+ *              compile or disassembly.
+ *
+ ******************************************************************************/
+
+static void
+MpEmitSerialInfo (
+    void)
+{
+    ACPI_SERIAL_INFO        *Info;
+    char                    *Type;
+    char                    *ParentPathname;
+    char                    *PrevDeviceName = NULL;
+    char                    *HidString;
+    const AH_DEVICE_ID      *HidInfo;
+    const char              *Description;
+    AML_RESOURCE            *Resource;
+
+
+    /* Walk the constructed serial descriptor list */
+
+    Info = Gbl_SerialList;
+    while (Info)
+    {
+        Resource = Info->Resource;
+        switch (Resource->CommonSerialBus.Type)
+        {
+        case AML_RESOURCE_I2C_SERIALBUSTYPE:
+            Type = "I2C ";
+            break;
+
+        case AML_RESOURCE_SPI_SERIALBUSTYPE:
+            Type = "SPI ";
+            break;
+
+        case AML_RESOURCE_UART_SERIALBUSTYPE:
+            Type = "UART";
+            break;
+
+        default:
+            Type = "UNKN";
+            break;
+        }
+
+        HidString = MpGetHidViaNamestring (Info->DeviceName);
+
+        /* Print header info for the controller itself */
+
+        if (!PrevDeviceName ||
+            ACPI_STRCMP (PrevDeviceName, Info->DeviceName))
+        {
+            FlPrintFile (ASL_FILE_MAP_OUTPUT, "\n\n%s Controller:  ",
+                Type);
+            FlPrintFile (ASL_FILE_MAP_OUTPUT, "%-8s  %-28s",
+                HidString, Info->DeviceName);
+
+            HidInfo = AcpiAhMatchHardwareId (HidString);
+            if (HidInfo)
+            {
+                FlPrintFile (ASL_FILE_MAP_OUTPUT, "  // %s",
+                    HidInfo->Description);
+            }
+
+            FlPrintFile (ASL_FILE_MAP_OUTPUT, "\n\n");
+            FlPrintFile (ASL_FILE_MAP_OUTPUT,
+                "Type  Address   Speed      Dest _HID  Destination\n");
+        }
+
+        PrevDeviceName = Info->DeviceName;
+
+        FlPrintFile (ASL_FILE_MAP_OUTPUT, "%s   %4.4X    %8.8X    ",
+            Type, Info->Address, Info->Speed);
+
+        ParentPathname = NULL;
+        HidString = MpGetConnectionInfo (Info->Op, 0, &Info->TargetNode,
+            &ParentPathname);
+        if (HidString)
+        {
+            /*
+             * This is a Connection() field
+             * Attempt to find all references to the field.
+             */
+            FlPrintFile (ASL_FILE_MAP_OUTPUT, "%8s   %-28s",
+                HidString, ParentPathname);
+        }
+        else
+        {
+            /* Normal resource template */
+
+            HidString = MpGetParentDeviceHid (Info->Op, &Info->TargetNode,
+                &ParentPathname);
+            FlPrintFile (ASL_FILE_MAP_OUTPUT, "%8s   %-28s",
+                HidString, ParentPathname);
+
+            /* Get the _HID description or _DDN string */
+
+            HidInfo = AcpiAhMatchHardwareId (HidString);
+            if (HidInfo)
+            {
+                FlPrintFile (ASL_FILE_MAP_OUTPUT, "  // %s",
+                    HidInfo->Description);
+            }
+            else if ((Description = MpGetDdnValue (ParentPathname)))
+            {
+                FlPrintFile (ASL_FILE_MAP_OUTPUT, "  // %s (_DDN)",
+                    Description);
+            }
+        }
+
+        FlPrintFile (ASL_FILE_MAP_OUTPUT, "\n");
+        ACPI_FREE (ParentPathname);
+        Info = Info->Next;
+    }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    MpEmitDeviceTree
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Emit information about all devices within the ACPI namespace.
+ *
+ ******************************************************************************/
+
+static void
+MpEmitDeviceTree (
+    void)
+{
+
+    FlPrintFile (ASL_FILE_MAP_OUTPUT, "\n\nACPI Device Tree\n");
+    FlPrintFile (ASL_FILE_MAP_OUTPUT,     "----------------\n\n");
+
+    FlPrintFile (ASL_FILE_MAP_OUTPUT, "Device Pathname                   "
+        "_HID      Description\n\n");
+
+    /* Walk the namespace from the root */
+
+    (void) AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
+            ACPI_UINT32_MAX, FALSE, MpEmitOneDevice, NULL, NULL, NULL);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    MpEmitOneDevice
+ *
+ * PARAMETERS:  ACPI_NAMESPACE_WALK callback
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Emit information about one ACPI device in the namespace. Used
+ *              during dump of all device objects within the namespace.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+MpEmitOneDevice (
+    ACPI_HANDLE             ObjHandle,
+    UINT32                  NestingLevel,
+    void                    *Context,
+    void                    **ReturnValue)
+{
+    char                    *DevicePathname;
+    char                    *DdnString;
+    char                    *HidString;
+    const AH_DEVICE_ID      *HidInfo;
+
+
+    /* Device pathname */
+
+    DevicePathname = AcpiNsGetExternalPathname (
+        ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle));
+
+    FlPrintFile (ASL_FILE_MAP_OUTPUT, "%-32s", DevicePathname);
+
+    /* _HID or _DDN */
+
+    HidString = MpGetHidValue (
+        ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle));
+    FlPrintFile (ASL_FILE_MAP_OUTPUT, "%8s", HidString);
+
+    HidInfo = AcpiAhMatchHardwareId (HidString);
+    if (HidInfo)
+    {
+        FlPrintFile (ASL_FILE_MAP_OUTPUT, "    // %s",
+            HidInfo->Description);
+    }
+    else if ((DdnString = MpGetDdnValue (DevicePathname)))
+    {
+        FlPrintFile (ASL_FILE_MAP_OUTPUT, "    // %s (_DDN)", DdnString);
+    }
+
+    FlPrintFile (ASL_FILE_MAP_OUTPUT, "\n");
+    ACPI_FREE (DevicePathname);
+    return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    MpXrefDevices
+ *
+ * PARAMETERS:  Info                    - A GPIO Info block
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Cross-reference the parse tree and find all references to the
+ *              specified GPIO device.
+ *
+ ******************************************************************************/
+
+static void
+MpXrefDevices (
+    ACPI_GPIO_INFO          *Info)
+{
+
+    /* Walk the entire parse tree */
+
+    TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD,
+        MpNamespaceXrefBegin, NULL, Info);
+
+    if (!Info->References)
+    {
+        FlPrintFile (ASL_FILE_MAP_OUTPUT, "  // **** No references in table");
+    }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    MpNamespaceXrefBegin
+ *
+ * PARAMETERS:  WALK_PARSE_TREE callback
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Walk parse tree callback used to cross-reference GPIO pins.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+MpNamespaceXrefBegin (
+    ACPI_PARSE_OBJECT       *Op,
+    UINT32                  Level,
+    void                    *Context)
+{
+    ACPI_GPIO_INFO          *Info = ACPI_CAST_PTR (ACPI_GPIO_INFO, Context);
+    const ACPI_OPCODE_INFO  *OpInfo;
+    char                    *DevicePathname;
+    ACPI_PARSE_OBJECT       *ParentOp;
+    char                    *HidString;
+
+
+    ACPI_FUNCTION_TRACE_PTR (MpNamespaceXrefBegin, Op);
+
+    /*
+     * If this node is the actual declaration of a name
+     * [such as the XXXX name in "Method (XXXX)"],
+     * we are not interested in it here. We only care about names that
+     * are references to other objects within the namespace and the
+     * parent objects of name declarations
+     */
+    if (Op->Asl.CompileFlags & NODE_IS_NAME_DECLARATION)
+    {
+        return (AE_OK);
+    }
+
+    /* We are only interested in opcodes that have an associated name */
+
+    OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode);
+
+    if ((OpInfo->Flags & AML_NAMED) ||
+        (OpInfo->Flags & AML_CREATE))
+    {
+        return (AE_OK);
+    }
+
+    if ((Op->Asl.ParseOpcode != PARSEOP_NAMESTRING) &&
+        (Op->Asl.ParseOpcode != PARSEOP_NAMESEG)    &&
+        (Op->Asl.ParseOpcode != PARSEOP_METHODCALL))
+    {
+        return (AE_OK);
+    }
+
+    if (!Op->Asl.Node)
+    {
+        return (AE_OK);
+    }
+
+    ParentOp = Op->Asl.Parent;
+    if (ParentOp->Asl.ParseOpcode == PARSEOP_FIELD)
+    {
+        return (AE_OK);
+    }
+
+    if (Op->Asl.Node == Info->TargetNode)
+    {
+        DevicePathname = AcpiNsGetExternalPathname (
+            Info->TargetNode);
+
+        while (ParentOp && (!ParentOp->Asl.Node))
+        {
+            ParentOp = ParentOp->Asl.Parent;
+        }
+
+        if (ParentOp)
+        {
+            DevicePathname = AcpiNsGetExternalPathname (
+                ParentOp->Asl.Node);
+
+            if (!Info->References)
+            {
+                FlPrintFile (ASL_FILE_MAP_OUTPUT, "  // References:");
+            }
+
+            HidString = MpGetHidViaNamestring (DevicePathname);
+
+            FlPrintFile (ASL_FILE_MAP_OUTPUT, " %s [%s]",
+                DevicePathname, HidString);
+
+            Info->References++;
+        }
+    }
+
+    return (AE_OK);
+}
diff --git a/sys/contrib/dev/acpica/source/compiler/aslmaputils.c b/sys/contrib/dev/acpica/source/compiler/aslmaputils.c
new file mode 100644 (file)
index 0000000..10a6aea
--- /dev/null
@@ -0,0 +1,402 @@
+/******************************************************************************
+ *
+ * Module Name: aslmaputils - Utilities for the resource descriptor/device maps
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2014, 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:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include "acpi.h"
+#include "accommon.h"
+#include "acapps.h"
+#include "aslcompiler.h"
+#include "aslcompiler.y.h"
+#include "acinterp.h"
+#include "acnamesp.h"
+#include "amlcode.h"
+
+/* This module used for application-level code only */
+
+#define _COMPONENT          ACPI_COMPILER
+        ACPI_MODULE_NAME    ("aslmaputils")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    MpGetHidFromParseTree
+ *
+ * PARAMETERS:  HidNode             - Node for a _HID object
+ *
+ * RETURN:      An _HID string value. Automatically converts _HID integers
+ *              to strings. Never NULL.
+ *
+ * DESCRIPTION: Extract a _HID value from the parse tree, not the namespace.
+ *              Used when a fully initialized namespace is not available.
+ *
+ ******************************************************************************/
+
+char *
+MpGetHidFromParseTree (
+    ACPI_NAMESPACE_NODE     *HidNode)
+{
+    ACPI_PARSE_OBJECT       *Op;
+    ACPI_PARSE_OBJECT       *Arg;
+    char                    *HidString;
+
+
+    Op = HidNode->Op;
+
+    switch (Op->Asl.ParseOpcode)
+    {
+    case PARSEOP_NAME:
+
+        Arg = Op->Asl.Child;  /* Get the NameSeg/NameString node */
+        Arg = Arg->Asl.Next;  /* First peer is the object to be associated with the name */
+
+        switch (Arg->Asl.ParseOpcode)
+        {
+        case PARSEOP_STRING_LITERAL:
+
+            return (Arg->Asl.Value.String);
+
+        case PARSEOP_INTEGER:
+
+            /* Convert EISAID to a string */
+
+            HidString = UtStringCacheCalloc (ACPI_EISAID_STRING_SIZE);
+            AcpiExEisaIdToString (HidString, Arg->Asl.Value.Integer);
+            return (HidString);
+
+        default:
+
+            return ("UNKNOWN");
+        }
+
+    default:
+        return ("-No HID-");
+    }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    MpGetHidValue
+ *
+ * PARAMETERS:  DeviceNode          - Node for parent device
+ *
+ * RETURN:      An _HID string value. Automatically converts _HID integers
+ *              to strings. Never NULL.
+ *
+ * DESCRIPTION: Extract _HID value from within a device scope. Does not
+ *              actually execute a method, just gets the string or integer
+ *              value for the _HID.
+ *
+ ******************************************************************************/
+
+char *
+MpGetHidValue (
+    ACPI_NAMESPACE_NODE     *DeviceNode)
+{
+    ACPI_NAMESPACE_NODE     *HidNode;
+    char                    *HidString;
+    ACPI_STATUS             Status;
+
+
+    Status = AcpiNsGetNode (DeviceNode, METHOD_NAME__HID,
+        ACPI_NS_NO_UPSEARCH, &HidNode);
+    if (ACPI_FAILURE (Status))
+    {
+        goto ErrorExit;
+    }
+
+    /* If only partial namespace, get the _HID from the parse tree */
+
+    if (!HidNode->Object)
+    {
+        return (MpGetHidFromParseTree (HidNode));
+    }
+
+    /* Handle the different _HID flavors */
+
+    switch (HidNode->Type)
+    {
+    case ACPI_TYPE_STRING:
+
+        return (HidNode->Object->String.Pointer);
+
+    case ACPI_TYPE_INTEGER:
+
+        /* Convert EISAID to a string */
+
+        HidString = UtStringCacheCalloc (ACPI_EISAID_STRING_SIZE);
+        AcpiExEisaIdToString (HidString, HidNode->Object->Integer.Value);
+        return (HidString);
+
+    case ACPI_TYPE_METHOD:
+
+        return ("-Method-");
+
+    default:
+
+        FlPrintFile (ASL_FILE_MAP_OUTPUT, "BAD HID TYPE: %u", HidNode->Type);
+        break;
+    }
+
+
+ErrorExit:
+    return ("-No HID-");
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    MpGetHidViaNamestring
+ *
+ * PARAMETERS:  DeviceName          - Namepath for parent device
+ *
+ * RETURN:      _HID string. Never NULL.
+ *
+ * DESCRIPTION: Get a _HID value via a device pathname (instead of just simply
+ *              a device node.)
+ *
+ ******************************************************************************/
+
+char *
+MpGetHidViaNamestring (
+    char                    *DeviceName)
+{
+    ACPI_NAMESPACE_NODE     *DeviceNode;
+    ACPI_STATUS             Status;
+
+
+    Status = AcpiNsGetNode (NULL, DeviceName, ACPI_NS_NO_UPSEARCH,
+        &DeviceNode);
+    if (ACPI_FAILURE (Status))
+    {
+        goto ErrorExit;
+    }
+
+    return (MpGetHidValue (DeviceNode));
+
+
+ErrorExit:
+    return ("-No HID-");
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    MpGetParentDeviceHid
+ *
+ * PARAMETERS:  Op                      - Parse Op to be examined
+ *              TargetNode              - Where the field node is returned
+ *              ParentDeviceName        - Where the node path is returned
+ *
+ * RETURN:      _HID string. Never NULL.
+ *
+ * DESCRIPTION: Find the parent Device or Scope Op, get the full pathname to
+ *              the parent, and get the _HID associated with the parent.
+ *
+ ******************************************************************************/
+
+char *
+MpGetParentDeviceHid (
+    ACPI_PARSE_OBJECT       *Op,
+    ACPI_NAMESPACE_NODE     **TargetNode,
+    char                    **ParentDeviceName)
+{
+    ACPI_NAMESPACE_NODE     *DeviceNode;
+
+
+    /* Find parent Device() or Scope() Op */
+
+    while (Op &&
+        (Op->Asl.AmlOpcode != AML_DEVICE_OP) &&
+        (Op->Asl.AmlOpcode != AML_SCOPE_OP))
+    {
+        Op = Op->Asl.Parent;
+    }
+
+    if (!Op)
+    {
+        FlPrintFile (ASL_FILE_MAP_OUTPUT, " No_Parent_Device ");
+        goto ErrorExit;
+    }
+
+    /* Get the full pathname to the device and the _HID */
+
+    DeviceNode = Op->Asl.Node;
+    if (!DeviceNode)
+    {
+        FlPrintFile (ASL_FILE_MAP_OUTPUT, " No_Device_Node ");
+        goto ErrorExit;
+    }
+
+    *ParentDeviceName = AcpiNsGetExternalPathname (DeviceNode);
+    return (MpGetHidValue (DeviceNode));
+
+
+ErrorExit:
+    return ("-No HID-");
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    MpGetDdnValue
+ *
+ * PARAMETERS:  DeviceName          - Namepath for parent device
+ *
+ * RETURN:      _DDN description string. NULL on failure.
+ *
+ * DESCRIPTION: Execute the _DDN method for the device.
+ *
+ ******************************************************************************/
+
+char *
+MpGetDdnValue (
+    char                    *DeviceName)
+{
+    ACPI_NAMESPACE_NODE     *DeviceNode;
+    ACPI_NAMESPACE_NODE     *DdnNode;
+    ACPI_STATUS             Status;
+
+
+    Status = AcpiNsGetNode (NULL, DeviceName, ACPI_NS_NO_UPSEARCH,
+        &DeviceNode);
+    if (ACPI_FAILURE (Status))
+    {
+        goto ErrorExit;
+    }
+
+    Status = AcpiNsGetNode (DeviceNode, METHOD_NAME__DDN, ACPI_NS_NO_UPSEARCH,
+        &DdnNode);
+    if (ACPI_FAILURE (Status))
+    {
+        goto ErrorExit;
+    }
+
+    if ((DdnNode->Type != ACPI_TYPE_STRING) ||
+        !DdnNode->Object)
+    {
+        goto ErrorExit;
+    }
+
+    return (DdnNode->Object->String.Pointer);
+
+
+ErrorExit:
+    return (NULL);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    MpGetConnectionInfo
+ *
+ * PARAMETERS:  Op                      - Parse Op to be examined
+ *              PinIndex                - Index into GPIO PinList
+ *              TargetNode              - Where the field node is returned
+ *              TargetName              - Where the node path is returned
+ *
+ * RETURN:      A substitute _HID string, indicating that the name is actually
+ *              a field. NULL if the Op does not refer to a Connection.
+ *
+ * DESCRIPTION: Get the Field Unit that corresponds to the PinIndex after
+ *              a Connection() invocation.
+ *
+ ******************************************************************************/
+
+char *
+MpGetConnectionInfo (
+    ACPI_PARSE_OBJECT       *Op,
+    UINT32                  PinIndex,
+    ACPI_NAMESPACE_NODE     **TargetNode,
+    char                    **TargetName)
+{
+    ACPI_PARSE_OBJECT       *NextOp;
+    UINT32                  i;
+
+
+    /*
+     * Handle Connection() here. Find the next named FieldUnit.
+     * Note: we look at the ParseOpcode for the compiler, look
+     * at the AmlOpcode for the disassembler.
+     */
+    if ((Op->Asl.AmlOpcode == AML_INT_CONNECTION_OP) ||
+        (Op->Asl.ParseOpcode == PARSEOP_CONNECTION))
+    {
+        /* Find the correct field unit definition */
+
+        NextOp = Op;
+        for (i = 0; i <= PinIndex;)
+        {
+            NextOp = NextOp->Asl.Next;
+            while (NextOp &&
+                (NextOp->Asl.ParseOpcode != PARSEOP_NAMESEG) &&
+                (NextOp->Asl.AmlOpcode != AML_INT_NAMEDFIELD_OP))
+            {
+                NextOp = NextOp->Asl.Next;
+            }
+
+            if (!NextOp)
+            {
+                return ("UNKNOWN");
+            }
+
+            /* Add length of this field to the current pin index */
+
+            if (NextOp->Asl.ParseOpcode == PARSEOP_NAMESEG)
+            {
+                i += (UINT32) NextOp->Asl.Child->Asl.Value.Integer;
+            }
+            else /* AML_INT_NAMEDFIELD_OP */
+            {
+                i += (UINT32) NextOp->Asl.Value.Integer;
+            }
+        }
+
+        /* Return the node and pathname for the field unit */
+
+        *TargetNode = NextOp->Asl.Node;
+        *TargetName = AcpiNsGetExternalPathname (*TargetNode);
+        return ("-Field-");
+    }
+
+    return (NULL);
+}
index 1ad4753..c14ff15 100644 (file)
@@ -67,10 +67,63 @@ static void
 OpcDoEisaId (
     ACPI_PARSE_OBJECT       *Op);
 
+static void
+OpcDoPld (
+    ACPI_PARSE_OBJECT       *Op);
+
 static void
 OpcDoUuId (
     ACPI_PARSE_OBJECT       *Op);
 
+static UINT8 *
+OpcEncodePldBuffer (
+    ACPI_PLD_INFO           *PldInfo);
+
+
+/* ToPld strings */
+
+static char *AslPldPanelList[] =
+{
+    "TOP",
+    "BOTTOM",
+    "LEFT",
+    "RIGHT",
+    "FRONT",
+    "BACK",
+    "UNKNOWN",
+    NULL
+};
+
+static char *AslPldVerticalPositionList[] =
+{
+    "UPPER",
+    "CENTER",
+    "LOWER",
+    NULL
+};
+
+static char *AslPldHorizontalPositionList[] =
+{
+    "LEFT",
+    "CENTER",
+    "RIGHT",
+    NULL
+};
+
+static char *AslPldShapeList[] =
+{
+    "ROUND",
+    "OVAL",
+    "SQUARE",
+    "VERTICALRECTANGLE",
+    "HORIZONTALRECTANGLE",
+    "VERTICALTRAPEZOID",
+    "HORIZONTALTRAPEZOID",
+    "UNKNOWN",
+    "CHAMFERED",
+    NULL
+};
+
 
 /*******************************************************************************
  *
@@ -402,6 +455,7 @@ OpcDoConnection (
     ACPI_PARSE_OBJECT       *BufferOp;
     ACPI_PARSE_OBJECT       *BufferLengthOp;
     ACPI_PARSE_OBJECT       *BufferDataOp;
+    ASL_RESOURCE_INFO       Info;
     UINT8                   State;
 
 
@@ -416,8 +470,10 @@ OpcDoConnection (
     BufferLengthOp = BufferOp->Asl.Child;
     BufferDataOp = BufferLengthOp->Asl.Next;
 
+    Info.DescriptorTypeOp = BufferDataOp->Asl.Next;
+    Info.CurrentByteOffset = 0;
     State = ACPI_RSTATE_NORMAL;
-    Rnode = RsDoOneResourceDescriptor (BufferDataOp->Asl.Next, 0, &State);
+    Rnode = RsDoOneResourceDescriptor (&Info, &State);
     if (!Rnode)
     {
         return; /* error */
@@ -648,11 +704,700 @@ OpcDoEisaId (
 }
 
 
+/*******************************************************************************
+ *
+ * FUNCTION:    OpcEncodePldBuffer
+ *
+ * PARAMETERS:  PldInfo             - _PLD buffer struct (Using local struct)
+ *
+ * RETURN:      Encode _PLD buffer suitable for return value from _PLD
+ *
+ * DESCRIPTION: Bit-packs a _PLD buffer struct.
+ *
+ ******************************************************************************/
+
+static UINT8 *
+OpcEncodePldBuffer (
+    ACPI_PLD_INFO           *PldInfo)
+{
+    UINT32                  *Buffer;
+    UINT32                  Dword;
+
+
+    Buffer = ACPI_ALLOCATE_ZEROED (ACPI_PLD_BUFFER_SIZE);
+    if (!Buffer)
+    {
+        return (NULL);
+    }
+
+    /* First 32 bits */
+
+    Dword = 0;
+    ACPI_PLD_SET_REVISION       (&Dword, PldInfo->Revision);
+    ACPI_PLD_SET_IGNORE_COLOR   (&Dword, PldInfo->IgnoreColor);
+    ACPI_PLD_SET_RED            (&Dword, PldInfo->Red);
+    ACPI_PLD_SET_GREEN          (&Dword, PldInfo->Green);
+    ACPI_PLD_SET_BLUE           (&Dword, PldInfo->Blue);
+    ACPI_MOVE_32_TO_32          (&Buffer[0], &Dword);
+
+    /* Second 32 bits */
+
+    Dword = 0;
+    ACPI_PLD_SET_WIDTH          (&Dword, PldInfo->Width);
+    ACPI_PLD_SET_HEIGHT         (&Dword, PldInfo->Height);
+    ACPI_MOVE_32_TO_32          (&Buffer[1], &Dword);
+
+    /* Third 32 bits */
+
+    Dword = 0;
+    ACPI_PLD_SET_USER_VISIBLE   (&Dword, PldInfo->UserVisible);
+    ACPI_PLD_SET_DOCK           (&Dword, PldInfo->Dock);
+    ACPI_PLD_SET_LID            (&Dword, PldInfo->Lid);
+    ACPI_PLD_SET_PANEL          (&Dword, PldInfo->Panel);
+    ACPI_PLD_SET_VERTICAL       (&Dword, PldInfo->VerticalPosition);
+    ACPI_PLD_SET_HORIZONTAL     (&Dword, PldInfo->HorizontalPosition);
+    ACPI_PLD_SET_SHAPE          (&Dword, PldInfo->Shape);
+    ACPI_PLD_SET_ORIENTATION    (&Dword, PldInfo->GroupOrientation);
+    ACPI_PLD_SET_TOKEN          (&Dword, PldInfo->GroupToken);
+    ACPI_PLD_SET_POSITION       (&Dword, PldInfo->GroupPosition);
+    ACPI_PLD_SET_BAY            (&Dword, PldInfo->Bay);
+    ACPI_MOVE_32_TO_32          (&Buffer[2], &Dword);
+
+    /* Fourth 32 bits */
+
+    Dword = 0;
+    ACPI_PLD_SET_EJECTABLE      (&Dword, PldInfo->Ejectable);
+    ACPI_PLD_SET_OSPM_EJECT     (&Dword, PldInfo->OspmEjectRequired);
+    ACPI_PLD_SET_CABINET        (&Dword, PldInfo->CabinetNumber);
+    ACPI_PLD_SET_CARD_CAGE      (&Dword, PldInfo->CardCageNumber);
+    ACPI_PLD_SET_REFERENCE      (&Dword, PldInfo->Reference);
+    ACPI_PLD_SET_ROTATION       (&Dword, PldInfo->Rotation);
+    ACPI_PLD_SET_ORDER          (&Dword, PldInfo->Order);
+    ACPI_MOVE_32_TO_32          (&Buffer[3], &Dword);
+
+    if (PldInfo->Revision >= 2)
+    {
+        /* Fifth 32 bits */
+
+        Dword = 0;
+        ACPI_PLD_SET_VERT_OFFSET    (&Dword, PldInfo->VerticalOffset);
+        ACPI_PLD_SET_HORIZ_OFFSET   (&Dword, PldInfo->HorizontalOffset);
+        ACPI_MOVE_32_TO_32          (&Buffer[4], &Dword);
+    }
+
+    return (ACPI_CAST_PTR (UINT8, Buffer));
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    OpcStrupr (strupr)
+ *
+ * PARAMETERS:  SrcString           - The source string to convert
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Convert string to uppercase
+ *
+ * NOTE: This is not a POSIX function, so it appears here, not in utclib.c
+ *
+ ******************************************************************************/
+
+static void
+OpcStrupr (
+    char                    *SrcString)
+{
+    char                    *String;
+
+
+    if (!SrcString)
+    {
+        return;
+    }
+
+    /* Walk entire string, uppercasing the letters */
+
+    for (String = SrcString; *String; String++)
+    {
+        *String = (char) toupper ((int) *String);
+    }
+
+    return;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    OpcFindName
+ *
+ * PARAMETERS:  List                - Array of char strings to be searched
+ *              Name                - Char string to string for
+ *              Index               - Index value to set if found
+ *
+ * RETURN:      TRUE if any names matched, FALSE otherwise
+ *
+ * DESCRIPTION: Match PLD name to value in lookup table. Sets Value to
+ *              equivalent parameter value.
+ *
+ ******************************************************************************/
+
+static BOOLEAN
+OpcFindName (
+    char                    **List,
+    char                    *Name,
+    UINT64                  *Index)
+{
+    char                     *Str;
+    UINT32                   i;
+
+
+    OpcStrupr (Name);
+
+    for (i = 0, Str = List[0]; Str; i++, Str = List[i])
+    {
+        if (!(ACPI_STRNCMP (Str, Name, ACPI_STRLEN (Name))))
+        {
+            *Index = i;
+            return (TRUE);
+        }
+    }
+
+    return (FALSE);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    OpcDoPld
+ *
+ * PARAMETERS:  Op                  - Parse node
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Convert ToPLD macro to 20-byte buffer
+ *
+ ******************************************************************************/
+
+static void
+OpcDoPld (
+    ACPI_PARSE_OBJECT       *Op)
+{
+    UINT8                   *Buffer;
+    ACPI_PARSE_OBJECT       *Node;
+    ACPI_PLD_INFO           PldInfo;
+    ACPI_PARSE_OBJECT       *NewOp;
+
+
+    if (!Op)
+    {
+        AslError(ASL_ERROR, ASL_MSG_NOT_EXIST, Op, NULL);
+        return;
+    }
+
+    if (Op->Asl.ParseOpcode != PARSEOP_TOPLD)
+    {
+        AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Op, NULL);
+        return;
+    }
+
+    Buffer = UtLocalCalloc (ACPI_PLD_BUFFER_SIZE);
+    if (!Buffer)
+    {
+        AslError(ASL_ERROR, ASL_MSG_BUFFER_ALLOCATION, Op, NULL);
+        return;
+    }
+
+    ACPI_MEMSET (&PldInfo, 0, sizeof (ACPI_PLD_INFO));
+
+    Node = Op->Asl.Child;
+    while (Node)
+    {
+        switch (Node->Asl.ParseOpcode)
+        {
+        case PARSEOP_PLD_REVISION:
+
+            if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER)
+            {
+                AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL);
+                break;
+            }
+
+            if (Node->Asl.Child->Asl.Value.Integer > 127)
+            {
+                AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
+                break;
+            }
+
+            PldInfo.Revision = (UINT8) Node->Asl.Child->Asl.Value.Integer;
+            break;
+
+        case PARSEOP_PLD_IGNORECOLOR:
+
+            if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER)
+            {
+                AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL);
+                break;
+            }
+
+            if (Node->Asl.Child->Asl.Value.Integer > 1)
+            {
+                AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
+                break;
+            }
+
+            PldInfo.IgnoreColor = (UINT8) Node->Asl.Child->Asl.Value.Integer;
+            break;
+
+        case PARSEOP_PLD_RED:
+        case PARSEOP_PLD_GREEN:
+        case PARSEOP_PLD_BLUE:
+
+            if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER)
+            {
+                AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
+                break;
+            }
+
+            if (Node->Asl.Child->Asl.Value.Integer > 255)
+            {
+                AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
+                break;
+            }
+
+            if (Node->Asl.ParseOpcode == PARSEOP_PLD_RED)
+            {
+                PldInfo.Red = (UINT8) Node->Asl.Child->Asl.Value.Integer;
+            }
+            else if (Node->Asl.ParseOpcode == PARSEOP_PLD_GREEN)
+            {
+                PldInfo.Green = (UINT8) Node->Asl.Child->Asl.Value.Integer;
+            }
+            else /* PARSEOP_PLD_BLUE */
+            {
+                PldInfo.Blue = (UINT8) Node->Asl.Child->Asl.Value.Integer;
+            }
+            break;
+
+        case PARSEOP_PLD_WIDTH:
+        case PARSEOP_PLD_HEIGHT:
+
+            if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER)
+            {
+                AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL);
+                break;
+            }
+
+            if (Node->Asl.Child->Asl.Value.Integer > 65535)
+            {
+                AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
+                break;
+            }
+
+            if (Node->Asl.ParseOpcode == PARSEOP_PLD_WIDTH)
+            {
+                PldInfo.Width = (UINT16) Node->Asl.Child->Asl.Value.Integer;
+            }
+            else /* PARSEOP_PLD_HEIGHT */
+            {
+                PldInfo.Height = (UINT16) Node->Asl.Child->Asl.Value.Integer;
+            }
+
+            break;
+
+        case PARSEOP_PLD_USERVISIBLE:
+        case PARSEOP_PLD_DOCK:
+        case PARSEOP_PLD_LID:
+
+            if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER)
+            {
+                AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL);
+                break;
+            }
+
+            if (Node->Asl.Child->Asl.Value.Integer > 1)
+            {
+                AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
+                break;
+            }
+
+            if (Node->Asl.ParseOpcode == PARSEOP_PLD_USERVISIBLE)
+            {
+                PldInfo.UserVisible = (UINT8) Node->Asl.Child->Asl.Value.Integer;
+            }
+            else if (Node->Asl.ParseOpcode == PARSEOP_PLD_DOCK)
+            {
+                PldInfo.Dock = (UINT8) Node->Asl.Child->Asl.Value.Integer;
+            }
+            else
+            {
+                PldInfo.Lid = (UINT8) Node->Asl.Child->Asl.Value.Integer;
+            }
+
+            break;
+
+        case PARSEOP_PLD_PANEL:
+
+            if (Node->Asl.Child->Asl.ParseOpcode == PARSEOP_INTEGER)
+            {
+                if (Node->Asl.Child->Asl.Value.Integer > 6)
+                {
+                    AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
+                    break;
+                }
+            }
+            else /* PARSEOP_STRING */
+            {
+                if (!OpcFindName(AslPldPanelList,
+                    Node->Asl.Child->Asl.Value.String,
+                    &Node->Asl.Child->Asl.Value.Integer))
+                {
+                    AslError(ASL_ERROR, ASL_MSG_INVALID_OPERAND, Node, NULL);
+                    break;
+                }
+            }
+
+            PldInfo.Panel = (UINT8) Node->Asl.Child->Asl.Value.Integer;
+            break;
+
+        case PARSEOP_PLD_VERTICALPOSITION:
+
+            if (Node->Asl.Child->Asl.ParseOpcode == PARSEOP_INTEGER)
+            {
+                if (Node->Asl.Child->Asl.Value.Integer > 2)
+                {
+                    AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
+                    break;
+                }
+            }
+            else /* PARSEOP_STRING */
+            {
+                if (!OpcFindName(AslPldVerticalPositionList,
+                    Node->Asl.Child->Asl.Value.String,
+                    &Node->Asl.Child->Asl.Value.Integer))
+                {
+                    AslError(ASL_ERROR, ASL_MSG_INVALID_OPERAND, Node, NULL);
+                    break;
+                }
+            }
+
+            PldInfo.VerticalPosition = (UINT8) Node->Asl.Child->Asl.Value.Integer;
+            break;
+
+        case PARSEOP_PLD_HORIZONTALPOSITION:
+
+            if (Node->Asl.Child->Asl.ParseOpcode == PARSEOP_INTEGER)
+            {
+                if (Node->Asl.Child->Asl.Value.Integer > 2)
+                {
+                    AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
+                    break;
+                }
+            }
+            else /* PARSEOP_STRING */
+            {
+                if (!OpcFindName(AslPldHorizontalPositionList,
+                    Node->Asl.Child->Asl.Value.String,
+                    &Node->Asl.Child->Asl.Value.Integer))
+                {
+                    AslError(ASL_ERROR, ASL_MSG_INVALID_OPERAND, Node, NULL);
+                    break;
+                }
+            }
+
+            PldInfo.HorizontalPosition = (UINT8) Node->Asl.Child->Asl.Value.Integer;
+            break;
+
+        case PARSEOP_PLD_SHAPE:
+
+            if (Node->Asl.Child->Asl.ParseOpcode == PARSEOP_INTEGER)
+            {
+                if (Node->Asl.Child->Asl.Value.Integer > 8)
+                {
+                    AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
+                    break;
+                }
+            }
+            else /* PARSEOP_STRING */
+            {
+                if (!OpcFindName(AslPldShapeList,
+                    Node->Asl.Child->Asl.Value.String,
+                    &Node->Asl.Child->Asl.Value.Integer))
+                {
+                    AslError(ASL_ERROR, ASL_MSG_INVALID_OPERAND, Node, NULL);
+                    break;
+                }
+            }
+
+            PldInfo.Shape = (UINT8) Node->Asl.Child->Asl.Value.Integer;
+            break;
+
+        case PARSEOP_PLD_GROUPORIENTATION:
+
+            if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER)
+            {
+                AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL);
+                break;
+            }
+
+            if (Node->Asl.Child->Asl.Value.Integer > 1)
+            {
+                AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
+                break;
+            }
+
+            PldInfo.GroupOrientation = (UINT8) Node->Asl.Child->Asl.Value.Integer;
+            break;
+
+        case PARSEOP_PLD_GROUPTOKEN:
+        case PARSEOP_PLD_GROUPPOSITION:
+
+            if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER)
+            {
+                AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL);
+                break;
+            }
+
+            if (Node->Asl.Child->Asl.Value.Integer > 255)
+            {
+                AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
+                break;
+            }
+
+
+            if (Node->Asl.ParseOpcode == PARSEOP_PLD_GROUPTOKEN)
+            {
+                PldInfo.GroupToken = (UINT8) Node->Asl.Child->Asl.Value.Integer;
+            }
+            else /* PARSEOP_PLD_GROUPPOSITION */
+            {
+                PldInfo.GroupPosition = (UINT8) Node->Asl.Child->Asl.Value.Integer;
+            }
+
+            break;
+
+        case PARSEOP_PLD_BAY:
+        case PARSEOP_PLD_EJECTABLE:
+        case PARSEOP_PLD_EJECTREQUIRED:
+
+            if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER)
+            {
+                AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL);
+                break;
+            }
+
+            if (Node->Asl.Child->Asl.Value.Integer > 1)
+            {
+                AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
+                break;
+            }
+
+            if (Node->Asl.ParseOpcode == PARSEOP_PLD_BAY)
+            {
+                PldInfo.Bay = (UINT8) Node->Asl.Child->Asl.Value.Integer;
+            }
+            else if (Node->Asl.ParseOpcode == PARSEOP_PLD_EJECTABLE)
+            {
+                PldInfo.Ejectable = (UINT8) Node->Asl.Child->Asl.Value.Integer;
+            }
+            else /* PARSEOP_PLD_EJECTREQUIRED */
+            {
+                PldInfo.OspmEjectRequired = (UINT8) Node->Asl.Child->Asl.Value.Integer;
+            }
+
+            break;
+
+        case PARSEOP_PLD_CABINETNUMBER:
+        case PARSEOP_PLD_CARDCAGENUMBER:
+
+            if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER)
+            {
+                AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL);
+                break;
+            }
+
+            if (Node->Asl.Child->Asl.Value.Integer > 255)
+            {
+                AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
+                break;
+            }
+
+            if (Node->Asl.ParseOpcode == PARSEOP_PLD_CABINETNUMBER)
+            {
+                PldInfo.CabinetNumber = (UINT8) Node->Asl.Child->Asl.Value.Integer;
+            }
+            else /* PARSEOP_PLD_CARDCAGENUMBER */
+            {
+                PldInfo.CardCageNumber = (UINT8) Node->Asl.Child->Asl.Value.Integer;
+            }
+
+            break;
+
+        case PARSEOP_PLD_REFERENCE:
+
+            if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER)
+            {
+                AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL);
+                break;
+            }
+
+            if (Node->Asl.Child->Asl.Value.Integer > 1)
+            {
+                AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
+                break;
+            }
+
+            PldInfo.Reference = (UINT8) Node->Asl.Child->Asl.Value.Integer;
+            break;
+
+        case PARSEOP_PLD_ROTATION:
+
+            if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER)
+            {
+                AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL);
+                break;
+            }
+
+            if (Node->Asl.Child->Asl.Value.Integer > 7)
+            {
+                switch (Node->Asl.Child->Asl.Value.Integer)
+                {
+                case 45:
+
+                    Node->Asl.Child->Asl.Value.Integer = 1;
+                    break;
+
+                case 90:
+
+                    Node->Asl.Child->Asl.Value.Integer = 2;
+                    break;
+
+                case 135:
+
+                    Node->Asl.Child->Asl.Value.Integer = 3;
+                    break;
+
+                case 180:
+
+                    Node->Asl.Child->Asl.Value.Integer = 4;
+                    break;
+
+                case 225:
+
+                    Node->Asl.Child->Asl.Value.Integer = 5;
+                    break;
+
+                case 270:
+
+                    Node->Asl.Child->Asl.Value.Integer = 6;
+                    break;
+
+                case 315:
+
+                    Node->Asl.Child->Asl.Value.Integer = 7;
+                    break;
+
+                default:
+
+                    AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
+                    break;
+                }
+            }
+
+            PldInfo.Rotation = (UINT8) Node->Asl.Child->Asl.Value.Integer;
+            break;
+
+        case PARSEOP_PLD_ORDER:
+
+            if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER)
+            {
+                AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL);
+                break;
+            }
+
+            if (Node->Asl.Child->Asl.Value.Integer > 31)
+            {
+                AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
+                break;
+            }
+
+            PldInfo.Order = (UINT8) Node->Asl.Child->Asl.Value.Integer;
+            break;
+
+        case PARSEOP_PLD_VERTICALOFFSET:
+        case PARSEOP_PLD_HORIZONTALOFFSET:
+
+            if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER)
+            {
+                AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL);
+                break;
+            }
+
+            if (Node->Asl.Child->Asl.Value.Integer > 65535)
+            {
+                AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
+                break;
+            }
+
+            if (Node->Asl.ParseOpcode == PARSEOP_PLD_VERTICALOFFSET)
+            {
+                PldInfo.VerticalOffset = (UINT16) Node->Asl.Child->Asl.Value.Integer;
+            }
+            else /* PARSEOP_PLD_HORIZONTALOFFSET */
+            {
+                PldInfo.HorizontalOffset = (UINT16) Node->Asl.Child->Asl.Value.Integer;
+            }
+
+            break;
+
+        default:
+
+            AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL);
+            break;
+        }
+
+        Node = Node->Asl.Next;
+    }
+
+    Buffer = OpcEncodePldBuffer(&PldInfo);
+
+    /* Change Op to a Buffer */
+
+    Op->Asl.ParseOpcode = PARSEOP_BUFFER;
+    Op->Common.AmlOpcode = AML_BUFFER_OP;
+
+    /* Disable further optimization */
+
+    Op->Asl.CompileFlags &= ~NODE_COMPILE_TIME_CONST;
+    UtSetParseOpName (Op);
+
+    /* Child node is the buffer length */
+
+    NewOp = TrAllocateNode (PARSEOP_INTEGER);
+
+    NewOp->Asl.AmlOpcode     = AML_BYTE_OP;
+    NewOp->Asl.Value.Integer = 20;
+    NewOp->Asl.Parent        = Op;
+
+    Op->Asl.Child = NewOp;
+    Op = NewOp;
+
+    /* Peer to the child is the raw buffer data */
+
+    NewOp = TrAllocateNode (PARSEOP_RAW_DATA);
+    NewOp->Asl.AmlOpcode     = AML_RAW_DATA_BUFFER;
+    NewOp->Asl.AmlLength     = 20;
+    NewOp->Asl.Value.String  = ACPI_CAST_PTR (char, Buffer);
+    NewOp->Asl.Parent        = Op->Asl.Parent;
+
+    Op->Asl.Next = NewOp;
+}
+
+
 /*******************************************************************************
  *
  * FUNCTION:    OpcDoUuId
  *
- * PARAMETERS:  Op        - Parse node
+ * PARAMETERS:  Op                  - Parse node
  *
  * RETURN:      None
  *
@@ -670,7 +1415,7 @@ OpcDoUuId (
     ACPI_PARSE_OBJECT       *NewOp;
 
 
-    InString = (char *) Op->Asl.Value.String;
+    InString = ACPI_CAST_PTR (char, Op->Asl.Value.String);
     Buffer = UtLocalCalloc (16);
 
     Status = AuValidateUuid (InString);
@@ -709,7 +1454,7 @@ OpcDoUuId (
     NewOp = TrAllocateNode (PARSEOP_RAW_DATA);
     NewOp->Asl.AmlOpcode     = AML_RAW_DATA_BUFFER;
     NewOp->Asl.AmlLength     = 16;
-    NewOp->Asl.Value.String  = (char *) Buffer;
+    NewOp->Asl.Value.String  = ACPI_CAST_PTR (char, Buffer);
     NewOp->Asl.Parent        = Op->Asl.Parent;
 
     Op->Asl.Next = NewOp;
@@ -720,7 +1465,7 @@ OpcDoUuId (
  *
  * FUNCTION:    OpcGenerateAmlOpcode
  *
- * PARAMETERS:  Op        - Parse node
+ * PARAMETERS:  Op                  - Parse node
  *
  * RETURN:      None
  *
@@ -734,7 +1479,6 @@ void
 OpcGenerateAmlOpcode (
     ACPI_PARSE_OBJECT       *Op)
 {
-
     UINT16                  Index;
 
 
@@ -780,6 +1524,21 @@ OpcGenerateAmlOpcode (
         OpcDoEisaId (Op);
         break;
 
+    case PARSEOP_PRINTF:
+
+        OpcDoPrintf (Op);
+        break;
+
+    case PARSEOP_FPRINTF:
+
+        OpcDoFprintf (Op);
+        break;
+
+    case PARSEOP_TOPLD:
+
+        OpcDoPld (Op);
+        break;
+
     case PARSEOP_TOUUID:
 
         OpcDoUuId (Op);
index 039fc7d..f5a1d86 100644 (file)
@@ -184,7 +184,7 @@ AslDoOptions (
         }
         break;
 
-    case 'b':   /* Debug output options */
+    case 'b':   /* Debug options */
 
         switch (AcpiGbl_Optarg[0])
         {
@@ -193,10 +193,37 @@ AslDoOptions (
             AslCompilerdebug = 1; /* same as yydebug */
             DtParserdebug = 1;
             PrParserdebug = 1;
+            Gbl_DebugFlag = TRUE;
+            break;
+
+        case 'p':   /* Prune ASL parse tree */
+
+            /* Get the required argument */
+
+            if (AcpiGetoptArgument (argc, argv))
+            {
+                return (-1);
+            }
+
+            Gbl_PruneParseTree = TRUE;
+            Gbl_PruneDepth = (UINT8) strtoul (AcpiGbl_Optarg, NULL, 0);
+            break;
+
+        case 's':
+
+            Gbl_DebugFlag = TRUE;
             break;
 
         case 't':
 
+            /* Get the required argument */
+
+            if (AcpiGetoptArgument (argc, argv))
+            {
+                return (-1);
+            }
+
+            Gbl_PruneType = (UINT8) strtoul (AcpiGbl_Optarg, NULL, 0);
             break;
 
         default:
@@ -205,9 +232,6 @@ AslDoOptions (
             return (-1);
         }
 
-        /* Produce debug output file */
-
-        Gbl_DebugFlag = TRUE;
         break;
 
     case 'c':
@@ -250,6 +274,12 @@ AslDoOptions (
 
             break;
 
+        case 'l':   /* Use legacy ASL code (not ASL+) for disassembly */
+
+            Gbl_DoCompile = FALSE;
+            AcpiGbl_CstyleDisassembly = FALSE;
+            break;
+
         default:
 
             printf ("Unknown option: -d%s\n", AcpiGbl_Optarg);
@@ -413,6 +443,13 @@ AslDoOptions (
             Gbl_PreprocessorOutputFlag = TRUE;
             break;
 
+        case 'm':
+
+            /* Produce hardware map summary file */
+
+            Gbl_MapfileFlag = TRUE;
+            break;
+
         case 'n':
 
             /* Produce namespace file */
@@ -523,7 +560,6 @@ AslDoOptions (
 
         Gbl_OutputFilenamePrefix = AcpiGbl_Optarg;
         UtConvertBackslashes (Gbl_OutputFilenamePrefix);
-
         Gbl_UseDefaultAmlFilename = FALSE;
         break;
 
index bf4a8a7..827d438 100644 (file)
@@ -62,7 +62,9 @@
  *      ResourceMacroList, and FieldUnitList
  */
 
-void *                      AslLocalAllocate (unsigned int Size);
+void *
+AslLocalAllocate (
+    unsigned int            Size);
 
 /* Bison/yacc configuration */
 
@@ -80,8 +82,8 @@ void *                      AslLocalAllocate (unsigned int Size);
 
 /* Define YYMALLOC/YYFREE to prevent redefinition errors  */
 
-#define YYMALLOC            malloc
-#define YYFREE              free
+#define YYMALLOC            AslLocalAllocate
+#define YYFREE              ACPI_FREE
 %}
 
 /*
@@ -97,7 +99,7 @@ void *                      AslLocalAllocate (unsigned int Size);
  * These shift/reduce conflicts are expected. There should be zero
  * reduce/reduce conflicts.
  */
-%expect 86
+%expect 89
 
 /*! [Begin] no source code translation */
 
diff --git a/sys/contrib/dev/acpica/source/compiler/aslprintf.c b/sys/contrib/dev/acpica/source/compiler/aslprintf.c
new file mode 100644 (file)
index 0000000..d85abe2
--- /dev/null
@@ -0,0 +1,380 @@
+/******************************************************************************
+ *
+ * Module Name: aslprintf - ASL Printf/Fprintf macro support
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2014, 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:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include "aslcompiler.h"
+#include "aslcompiler.y.h"
+#include "amlcode.h"
+
+#define _COMPONENT          ACPI_COMPILER
+        ACPI_MODULE_NAME    ("aslprintf")
+
+
+/* Local prototypes */
+
+static void
+OpcCreateConcatenateNode (
+    ACPI_PARSE_OBJECT       *Op,
+    ACPI_PARSE_OBJECT       *Node);
+
+static void
+OpcParsePrintf (
+    ACPI_PARSE_OBJECT       *Op,
+    ACPI_PARSE_OBJECT       *DestOp);
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    OpcDoPrintf
+ *
+ * PARAMETERS:  Op                  - printf parse node
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Convert printf macro to a Store(..., Debug) AML operation.
+ *
+ ******************************************************************************/
+
+void
+OpcDoPrintf (
+    ACPI_PARSE_OBJECT       *Op)
+{
+    ACPI_PARSE_OBJECT       *DestOp;
+
+
+    /* Store destination is the Debug op */
+
+    DestOp = TrAllocateNode (PARSEOP_DEBUG);
+    DestOp->Asl.AmlOpcode = AML_DEBUG_OP;
+    DestOp->Asl.Parent = Op;
+    DestOp->Asl.LogicalLineNumber = Op->Asl.LogicalLineNumber;
+
+    OpcParsePrintf (Op, DestOp);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    OpcDoFprintf
+ *
+ * PARAMETERS:  Op                  - fprintf parse node
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Convert fprintf macro to a Store AML operation.
+ *
+ ******************************************************************************/
+
+void
+OpcDoFprintf (
+    ACPI_PARSE_OBJECT       *Op)
+{
+    ACPI_PARSE_OBJECT       *DestOp;
+
+
+    /* Store destination is the first argument of fprintf */
+
+    DestOp = Op->Asl.Child;
+    Op->Asl.Child = DestOp->Asl.Next;
+    DestOp->Asl.Next = NULL;
+
+    OpcParsePrintf (Op, DestOp);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    OpcParsePrintf
+ *
+ * PARAMETERS:  Op                  - Printf parse node
+ *              DestOp              - Destination of Store operation
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Convert printf macro to a Store AML operation. The printf
+ *              macro parse tree is layed out as follows:
+ *
+ *              Op        - printf parse op
+ *              Op->Child - Format string
+ *              Op->Next  - Format string arguments
+ *
+ ******************************************************************************/
+
+static void
+OpcParsePrintf (
+    ACPI_PARSE_OBJECT       *Op,
+    ACPI_PARSE_OBJECT       *DestOp)
+{
+    char                    *Format;
+    char                    *StartPosition = NULL;
+    ACPI_PARSE_OBJECT       *ArgNode;
+    ACPI_PARSE_OBJECT       *NextNode;
+    UINT32                  StringLength = 0;
+    char                    *NewString;
+    BOOLEAN                 StringToProcess = FALSE;
+    ACPI_PARSE_OBJECT       *NewOp;
+
+
+    /* Get format string */
+
+    Format = ACPI_CAST_PTR (char, Op->Asl.Child->Asl.Value.String);
+    ArgNode = Op->Asl.Child->Asl.Next;
+
+    /*
+     * Detach argument list so that we can use a NULL check to distinguish
+     * the first concatenation operation we need to make
+     */
+    Op->Asl.Child = NULL;
+
+    for (; *Format; ++Format)
+    {
+        if (*Format != '%')
+        {
+            if (!StringToProcess)
+            {
+                /* Mark the beginning of a string */
+
+                StartPosition = Format;
+                StringToProcess = TRUE;
+            }
+
+            ++StringLength;
+            continue;
+        }
+
+        /* Save string, if any, to new string object and concat it */
+
+        if (StringToProcess)
+        {
+            NewString = UtStringCacheCalloc (StringLength + 1);
+            ACPI_STRNCPY (NewString, StartPosition, StringLength);
+
+            NewOp = TrAllocateNode (PARSEOP_STRING_LITERAL);
+            NewOp->Asl.Value.String = NewString;
+            NewOp->Asl.AmlOpcode = AML_STRING_OP;
+            NewOp->Asl.AcpiBtype = ACPI_BTYPE_STRING;
+            NewOp->Asl.LogicalLineNumber = Op->Asl.LogicalLineNumber;
+
+            OpcCreateConcatenateNode(Op, NewOp);
+
+            StringLength = 0;
+            StringToProcess = FALSE;
+        }
+
+        ++Format;
+
+        /*
+         * We have a format parameter and will need an argument to go
+         * with it
+         */
+        if (!ArgNode ||
+            ArgNode->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
+        {
+            AslError(ASL_ERROR, ASL_MSG_ARG_COUNT_LO, Op, NULL);
+            return;
+        }
+
+        /*
+         * We do not support sub-specifiers of printf (flags, width,
+         * precision, length). For specifiers we only support %x/%X for
+         * hex or %s for strings. Also, %o for generic "acpi object".
+         */
+        switch (*Format)
+        {
+        case 's':
+
+            if (ArgNode->Asl.ParseOpcode != PARSEOP_STRING_LITERAL)
+            {
+                AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, ArgNode,
+                    "String required");
+                return;
+            }
+
+            NextNode = ArgNode->Asl.Next;
+            ArgNode->Asl.Next = NULL;
+            OpcCreateConcatenateNode(Op, ArgNode);
+            ArgNode = NextNode;
+            continue;
+
+        case 'X':
+        case 'x':
+        case 'o':
+
+            NextNode = ArgNode->Asl.Next;
+            ArgNode->Asl.Next = NULL;
+
+            /*
+             * Append an empty string if the first argument is
+             * not a string. This will implicitly conver the 2nd
+             * concat source to a string per the ACPI specification.
+             */
+            if (!Op->Asl.Child)
+            {
+                NewOp = TrAllocateNode (PARSEOP_STRING_LITERAL);
+                NewOp->Asl.Value.String = "";
+                NewOp->Asl.AmlOpcode = AML_STRING_OP;
+                NewOp->Asl.AcpiBtype = ACPI_BTYPE_STRING;
+                NewOp->Asl.LogicalLineNumber = Op->Asl.LogicalLineNumber;
+
+                OpcCreateConcatenateNode(Op, NewOp);
+            }
+
+            OpcCreateConcatenateNode(Op, ArgNode);
+            ArgNode = NextNode;
+            break;
+
+        default:
+
+            AslError(ASL_ERROR, ASL_MSG_INVALID_OPERAND, Op,
+                "Unrecognized format specifier");
+            continue;
+        }
+    }
+
+    /* Process any remaining string */
+
+    if (StringToProcess)
+    {
+        NewString = UtStringCacheCalloc (StringLength + 1);
+        ACPI_STRNCPY (NewString, StartPosition, StringLength);
+
+        NewOp = TrAllocateNode (PARSEOP_STRING_LITERAL);
+        NewOp->Asl.Value.String = NewString;
+        NewOp->Asl.AcpiBtype = ACPI_BTYPE_STRING;
+        NewOp->Asl.AmlOpcode = AML_STRING_OP;
+        NewOp->Asl.LogicalLineNumber = Op->Asl.LogicalLineNumber;
+
+        OpcCreateConcatenateNode(Op, NewOp);
+    }
+
+    /*
+     * If we get here and there's no child node then Format
+     * was an empty string. Just make a no op.
+     */
+    if (!Op->Asl.Child)
+    {
+        Op->Asl.ParseOpcode = PARSEOP_NOOP;
+        AslError(ASL_WARNING, ASL_MSG_NULL_STRING, Op,
+            "Converted to NOOP");
+        return;
+    }
+
+     /* Check for erroneous extra arguments */
+
+    if (ArgNode &&
+        ArgNode->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
+    {
+        AslError(ASL_WARNING, ASL_MSG_ARG_COUNT_HI, ArgNode,
+            "Extra arguments ignored");
+    }
+
+    /* Change Op to a Store */
+
+    Op->Asl.ParseOpcode = PARSEOP_STORE;
+    Op->Common.AmlOpcode = AML_STORE_OP;
+    Op->Asl.CompileFlags  = 0;
+
+    /* Disable further optimization */
+
+    Op->Asl.CompileFlags &= ~NODE_COMPILE_TIME_CONST;
+    UtSetParseOpName (Op);
+
+    /* Set Store destination */
+
+    Op->Asl.Child->Asl.Next = DestOp;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    OpcCreateConcatenateNode
+ *
+ * PARAMETERS:  Op                  - Parse node
+ *              Node                - Parse node to be concatenated
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Make Node the child of Op. If child node already exists, then
+ *              concat child with Node and makes concat node the child of Op.
+ *
+ ******************************************************************************/
+
+static void
+OpcCreateConcatenateNode (
+    ACPI_PARSE_OBJECT       *Op,
+    ACPI_PARSE_OBJECT       *Node)
+{
+    ACPI_PARSE_OBJECT       *NewConcatOp;
+
+
+    if (!Op->Asl.Child)
+    {
+        Op->Asl.Child = Node;
+        Node->Asl.Parent = Op;
+        return;
+    }
+
+    NewConcatOp = TrAllocateNode (PARSEOP_CONCATENATE);
+    NewConcatOp->Asl.AmlOpcode = AML_CONCAT_OP;
+    NewConcatOp->Asl.AcpiBtype = 0x7;
+    NewConcatOp->Asl.LogicalLineNumber = Op->Asl.LogicalLineNumber;
+
+    /* First arg is child of Op*/
+
+    NewConcatOp->Asl.Child = Op->Asl.Child;
+    Op->Asl.Child->Asl.Parent = NewConcatOp;
+
+    /* Second arg is Node */
+
+    NewConcatOp->Asl.Child->Asl.Next = Node;
+    Node->Asl.Parent = NewConcatOp;
+
+    /* Third arg is Zero (not used) */
+
+    NewConcatOp->Asl.Child->Asl.Next->Asl.Next =
+        TrAllocateNode (PARSEOP_ZERO);
+    NewConcatOp->Asl.Child->Asl.Next->Asl.Next->Asl.Parent =
+        NewConcatOp;
+
+    Op->Asl.Child = NewConcatOp;
+    NewConcatOp->Asl.Parent = Op;
+}
diff --git a/sys/contrib/dev/acpica/source/compiler/aslprune.c b/sys/contrib/dev/acpica/source/compiler/aslprune.c
new file mode 100644 (file)
index 0000000..b80ee15
--- /dev/null
@@ -0,0 +1,239 @@
+/******************************************************************************
+ *
+ * Module Name: aslprune - Parse tree prune utility
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2014, 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:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions, and the following disclaimer,
+ *    without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *    substantially similar to the "NO WARRANTY" disclaimer below
+ *    ("Disclaimer") and any redistribution must be conditioned upon
+ *    including a substantially similar Disclaimer requirement for further
+ *    binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ *    of any contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include "aslcompiler.h"
+#include "aslcompiler.y.h"
+#include "acapps.h"
+
+#define _COMPONENT          ACPI_COMPILER
+        ACPI_MODULE_NAME    ("aslprune")
+
+
+/* Local prototypes */
+
+static ACPI_STATUS
+PrTreePruneWalk (
+    ACPI_PARSE_OBJECT       *Op,
+    UINT32                  Level,
+    void                    *Context);
+
+static void
+PrPrintObjectAtLevel (
+    UINT32                  Level,
+    const char              *ObjectName);
+
+
+typedef struct acpi_prune_info
+{
+    UINT32                  PruneLevel;
+    UINT16                  ParseOpcode;
+    UINT16                  Count;
+
+} ACPI_PRUNE_INFO;
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AslPruneParseTree
+ *
+ * PARAMETERS:  PruneDepth              - Number of levels to prune
+ *              Type                    - Prune type (Device, Method, etc.)
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Prune off one or more levels of the ASL parse tree
+ *
+ ******************************************************************************/
+
+void
+AslPruneParseTree (
+    UINT32                  PruneDepth,
+    UINT32                  Type)
+{
+    ACPI_PRUNE_INFO         PruneObj;
+
+
+    PruneObj.PruneLevel = PruneDepth;
+    PruneObj.Count = 0;
+
+    switch (Type)
+    {
+    case 0:
+        PruneObj.ParseOpcode = (UINT16) PARSEOP_DEVICE;
+        break;
+
+    case 1:
+        PruneObj.ParseOpcode = (UINT16) PARSEOP_METHOD;
+        break;
+
+    case 2:
+        PruneObj.ParseOpcode = (UINT16) PARSEOP_IF;
+        break;
+
+    default:
+        AcpiOsPrintf ("Unsupported type: %u\n", Type);
+        return;
+    }
+
+    AcpiOsPrintf ("Pruning parse tree, from depth %u\n",
+        PruneDepth);
+
+    AcpiOsPrintf ("\nRemoving Objects:\n");
+
+    TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD,
+        PrTreePruneWalk, NULL, ACPI_CAST_PTR (void, &PruneObj));
+
+    AcpiOsPrintf ("\n%u Total Objects Removed\n", PruneObj.Count);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    PrPrintObjectAtLevel
+ *
+ * PARAMETERS:  Level                   - Current nesting level
+ *              ObjectName              - ACPI name for the object
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Print object name with indent
+ *
+ ******************************************************************************/
+
+static void
+PrPrintObjectAtLevel (
+    UINT32                  Level,
+    const char              *ObjectName)
+{
+    UINT32                  i;
+
+
+    for (i = 0; i < Level; i++)
+    {
+        AcpiOsPrintf ("  ");
+    }
+
+    AcpiOsPrintf ("[%s] at Level [%u]\n", ObjectName, Level);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    PrTreePruneWalk
+ *
+ * PARAMETERS:  Parse tree walk callback
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Prune off one or more levels of the ASL parse tree
+ *
+ * Current objects that can be pruned are: Devices, Methods, and If/Else
+ * blocks.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+PrTreePruneWalk (
+    ACPI_PARSE_OBJECT       *Op,
+    UINT32                  Level,
+    void                    *Context)
+{
+    ACPI_PRUNE_INFO         *PruneObj = (ACPI_PRUNE_INFO *) Context;
+
+
+    /* We only care about objects below the Prune Level threshold */
+
+    if (Level <= PruneObj->PruneLevel)
+    {
+        return (AE_OK);
+    }
+
+    if ((Op->Asl.ParseOpcode != PruneObj->ParseOpcode) &&
+       !(Op->Asl.ParseOpcode == PARSEOP_ELSE &&
+             PruneObj->ParseOpcode == PARSEOP_IF))
+    {
+        return (AE_OK);
+    }
+
+    switch (Op->Asl.ParseOpcode)
+    {
+    case PARSEOP_METHOD:
+
+        AcpiOsPrintf ("Method");
+        PrPrintObjectAtLevel (Level, Op->Asl.Child->Asl.Value.Name);
+        Op->Asl.Child->Asl.Next->Asl.Next->Asl.Next->Asl.Next->Asl.Next->Asl.Next = NULL;
+        PruneObj->Count++;
+        break;
+
+    case PARSEOP_DEVICE:
+
+        AcpiOsPrintf ("Device");
+        PrPrintObjectAtLevel (Level, Op->Asl.Child->Asl.Value.Name);
+        Op->Asl.Child->Asl.Next = NULL;
+        PruneObj->Count++;
+        break;
+
+    case PARSEOP_IF:
+    case PARSEOP_ELSE:
+
+        if (Op->Asl.ParseOpcode == PARSEOP_ELSE)
+        {
+            PrPrintObjectAtLevel(Level, "Else");
+            Op->Asl.Child = NULL;
+        }
+        else
+        {
+            PrPrintObjectAtLevel(Level, "If");
+            Op->Asl.Child->Asl.Next = NULL;
+        }
+
+        PruneObj->Count++;
+        break;
+
+    default:
+
+        break;
+    }
+
+    return (AE_OK);
+}
index f123990..7b31e13 100644 (file)
@@ -645,8 +645,7 @@ RsCheckListForDuplicates (
 
 ASL_RESOURCE_NODE *
 RsDoOneResourceDescriptor (
-    ACPI_PARSE_OBJECT       *DescriptorTypeOp,
-    UINT32                  CurrentByteOffset,
+    ASL_RESOURCE_INFO       *Info,
     UINT8                   *State)
 {
     ASL_RESOURCE_NODE       *Rnode = NULL;
@@ -654,36 +653,31 @@ RsDoOneResourceDescriptor (
 
     /* Construct the resource */
 
-    switch (DescriptorTypeOp->Asl.ParseOpcode)
+    switch (Info->DescriptorTypeOp->Asl.ParseOpcode)
     {
     case PARSEOP_DMA:
 
-        Rnode = RsDoDmaDescriptor (DescriptorTypeOp,
-                    CurrentByteOffset);
+        Rnode = RsDoDmaDescriptor (Info);
         break;
 
     case PARSEOP_FIXEDDMA:
 
-        Rnode = RsDoFixedDmaDescriptor (DescriptorTypeOp,
-                    CurrentByteOffset);
+        Rnode = RsDoFixedDmaDescriptor (Info);
         break;
 
     case PARSEOP_DWORDIO:
 
-        Rnode = RsDoDwordIoDescriptor (DescriptorTypeOp,
-                    CurrentByteOffset);
+        Rnode = RsDoDwordIoDescriptor (Info);
         break;
 
     case PARSEOP_DWORDMEMORY:
 
-        Rnode = RsDoDwordMemoryDescriptor (DescriptorTypeOp,
-                    CurrentByteOffset);
+        Rnode = RsDoDwordMemoryDescriptor (Info);
         break;
 
     case PARSEOP_DWORDSPACE:
 
-        Rnode = RsDoDwordSpaceDescriptor (DescriptorTypeOp,
-                    CurrentByteOffset);
+        Rnode = RsDoDwordSpaceDescriptor (Info);
         break;
 
     case PARSEOP_ENDDEPENDENTFN:
@@ -693,13 +687,13 @@ RsDoOneResourceDescriptor (
         case ACPI_RSTATE_NORMAL:
 
             AslError (ASL_ERROR, ASL_MSG_MISSING_STARTDEPENDENT,
-                DescriptorTypeOp, NULL);
+                Info->DescriptorTypeOp, NULL);
             break;
 
         case ACPI_RSTATE_START_DEPENDENT:
 
             AslError (ASL_ERROR, ASL_MSG_DEPENDENT_NESTING,
-                DescriptorTypeOp, NULL);
+                Info->DescriptorTypeOp, NULL);
             break;
 
         case ACPI_RSTATE_DEPENDENT_LIST:
@@ -709,104 +703,87 @@ RsDoOneResourceDescriptor (
         }
 
         *State = ACPI_RSTATE_NORMAL;
-        Rnode = RsDoEndDependentDescriptor (DescriptorTypeOp,
-                    CurrentByteOffset);
+        Rnode = RsDoEndDependentDescriptor (Info);
         break;
 
     case PARSEOP_ENDTAG:
 
-        Rnode = RsDoEndTagDescriptor (DescriptorTypeOp,
-                    CurrentByteOffset);
+        Rnode = RsDoEndTagDescriptor (Info);
         break;
 
     case PARSEOP_EXTENDEDIO:
 
-        Rnode = RsDoExtendedIoDescriptor (DescriptorTypeOp,
-                    CurrentByteOffset);
+        Rnode = RsDoExtendedIoDescriptor (Info);
         break;
 
     case PARSEOP_EXTENDEDMEMORY:
 
-        Rnode = RsDoExtendedMemoryDescriptor (DescriptorTypeOp,
-                    CurrentByteOffset);
+        Rnode = RsDoExtendedMemoryDescriptor (Info);
         break;
 
     case PARSEOP_EXTENDEDSPACE:
 
-        Rnode = RsDoExtendedSpaceDescriptor (DescriptorTypeOp,
-                    CurrentByteOffset);
+        Rnode = RsDoExtendedSpaceDescriptor (Info);
         break;
 
     case PARSEOP_FIXEDIO:
 
-        Rnode = RsDoFixedIoDescriptor (DescriptorTypeOp,
-                    CurrentByteOffset);
+        Rnode = RsDoFixedIoDescriptor (Info);
         break;
 
     case PARSEOP_INTERRUPT:
 
-        Rnode = RsDoInterruptDescriptor (DescriptorTypeOp,
-                    CurrentByteOffset);
+        Rnode = RsDoInterruptDescriptor (Info);
         break;
 
     case PARSEOP_IO:
 
-        Rnode = RsDoIoDescriptor (DescriptorTypeOp,
-                    CurrentByteOffset);
+        Rnode = RsDoIoDescriptor (Info);
         break;
 
     case PARSEOP_IRQ:
 
-        Rnode = RsDoIrqDescriptor (DescriptorTypeOp,
-                    CurrentByteOffset);
+        Rnode = RsDoIrqDescriptor (Info);
         break;
 
     case PARSEOP_IRQNOFLAGS:
 
-        Rnode = RsDoIrqNoFlagsDescriptor (DescriptorTypeOp,
-                    CurrentByteOffset);
+        Rnode = RsDoIrqNoFlagsDescriptor (Info);
         break;
 
     case PARSEOP_MEMORY24:
 
-        Rnode = RsDoMemory24Descriptor (DescriptorTypeOp,
-                    CurrentByteOffset);
+        Rnode = RsDoMemory24Descriptor (Info);
         break;
 
     case PARSEOP_MEMORY32:
 
-        Rnode = RsDoMemory32Descriptor (DescriptorTypeOp,
-                    CurrentByteOffset);
+        Rnode = RsDoMemory32Descriptor (Info);
         break;
 
     case PARSEOP_MEMORY32FIXED:
 
-        Rnode = RsDoMemory32FixedDescriptor (DescriptorTypeOp,
-                    CurrentByteOffset);
+        Rnode = RsDoMemory32FixedDescriptor (Info);
         break;
 
     case PARSEOP_QWORDIO:
 
-        Rnode = RsDoQwordIoDescriptor (DescriptorTypeOp,
-                    CurrentByteOffset);
+        Rnode = RsDoQwordIoDescriptor (Info);
         break;
 
     case PARSEOP_QWORDMEMORY:
 
-        Rnode = RsDoQwordMemoryDescriptor (DescriptorTypeOp,
-                    CurrentByteOffset);
+        Rnode = RsDoQwordMemoryDescriptor (Info);
         break;
 
     case PARSEOP_QWORDSPACE:
 
-        Rnode = RsDoQwordSpaceDescriptor (DescriptorTypeOp,
-                    CurrentByteOffset);
+        Rnode = RsDoQwordSpaceDescriptor (Info);
         break;
 
     case PARSEOP_REGISTER:
 
-        Rnode = RsDoGeneralRegisterDescriptor (DescriptorTypeOp,
-                    CurrentByteOffset);
+        Rnode = RsDoGeneralRegisterDescriptor (Info);
         break;
 
     case PARSEOP_STARTDEPENDENTFN:
@@ -816,7 +793,7 @@ RsDoOneResourceDescriptor (
         case ACPI_RSTATE_START_DEPENDENT:
 
             AslError (ASL_ERROR, ASL_MSG_DEPENDENT_NESTING,
-                DescriptorTypeOp, NULL);
+                Info->DescriptorTypeOp, NULL);
             break;
 
         case ACPI_RSTATE_NORMAL:
@@ -827,8 +804,7 @@ RsDoOneResourceDescriptor (
         }
 
         *State = ACPI_RSTATE_START_DEPENDENT;
-        Rnode = RsDoStartDependentDescriptor (DescriptorTypeOp,
-                    CurrentByteOffset);
+        Rnode = RsDoStartDependentDescriptor (Info);
         *State = ACPI_RSTATE_DEPENDENT_LIST;
         break;
 
@@ -839,7 +815,7 @@ RsDoOneResourceDescriptor (
         case ACPI_RSTATE_START_DEPENDENT:
 
             AslError (ASL_ERROR, ASL_MSG_DEPENDENT_NESTING,
-                DescriptorTypeOp, NULL);
+                Info->DescriptorTypeOp, NULL);
             break;
 
         case ACPI_RSTATE_NORMAL:
@@ -850,69 +826,58 @@ RsDoOneResourceDescriptor (
         }
 
         *State = ACPI_RSTATE_START_DEPENDENT;
-        Rnode = RsDoStartDependentNoPriDescriptor (DescriptorTypeOp,
-                    CurrentByteOffset);
+        Rnode = RsDoStartDependentNoPriDescriptor (Info);
         *State = ACPI_RSTATE_DEPENDENT_LIST;
         break;
 
     case PARSEOP_VENDORLONG:
 
-        Rnode = RsDoVendorLargeDescriptor (DescriptorTypeOp,
-                    CurrentByteOffset);
+        Rnode = RsDoVendorLargeDescriptor (Info);
         break;
 
     case PARSEOP_VENDORSHORT:
 
-        Rnode = RsDoVendorSmallDescriptor (DescriptorTypeOp,
-                    CurrentByteOffset);
+        Rnode = RsDoVendorSmallDescriptor (Info);
         break;
 
     case PARSEOP_WORDBUSNUMBER:
 
-        Rnode = RsDoWordBusNumberDescriptor (DescriptorTypeOp,
-                    CurrentByteOffset);
+        Rnode = RsDoWordBusNumberDescriptor (Info);
         break;
 
     case PARSEOP_WORDIO:
 
-        Rnode = RsDoWordIoDescriptor (DescriptorTypeOp,
-                    CurrentByteOffset);
+        Rnode = RsDoWordIoDescriptor (Info);
         break;
 
     case PARSEOP_WORDSPACE:
 
-        Rnode = RsDoWordSpaceDescriptor (DescriptorTypeOp,
-                    CurrentByteOffset);
+        Rnode = RsDoWordSpaceDescriptor (Info);
         break;
 
     case PARSEOP_GPIO_INT:
 
-        Rnode = RsDoGpioIntDescriptor (DescriptorTypeOp,
-                    CurrentByteOffset);
+        Rnode = RsDoGpioIntDescriptor (Info);
         break;
 
     case PARSEOP_GPIO_IO:
 
-        Rnode = RsDoGpioIoDescriptor (DescriptorTypeOp,
-                    CurrentByteOffset);
+        Rnode = RsDoGpioIoDescriptor (Info);
         break;
 
     case PARSEOP_I2C_SERIALBUS:
 
-        Rnode = RsDoI2cSerialBusDescriptor (DescriptorTypeOp,
-                    CurrentByteOffset);
+        Rnode = RsDoI2cSerialBusDescriptor (Info);
         break;
 
     case PARSEOP_SPI_SERIALBUS:
 
-        Rnode = RsDoSpiSerialBusDescriptor (DescriptorTypeOp,
-                    CurrentByteOffset);
+        Rnode = RsDoSpiSerialBusDescriptor (Info);
         break;
 
     case PARSEOP_UART_SERIALBUS:
 
-        Rnode = RsDoUartSerialBusDescriptor (DescriptorTypeOp,
-                    CurrentByteOffset);
+        Rnode = RsDoUartSerialBusDescriptor (Info);
         break;
 
     case PARSEOP_DEFAULT_ARG:
@@ -923,7 +888,7 @@ RsDoOneResourceDescriptor (
     default:
 
         printf ("Unknown resource descriptor type [%s]\n",
-                    DescriptorTypeOp->Asl.ParseOpName);
+                    Info->DescriptorTypeOp->Asl.ParseOpName);
         break;
     }
 
@@ -932,14 +897,14 @@ RsDoOneResourceDescriptor (
      * This allows the resource to be installed in the namespace so that
      * references to the descriptor can be resolved.
      */
-    DescriptorTypeOp->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
-    DescriptorTypeOp->Asl.CompileFlags = NODE_IS_RESOURCE_DESC;
-    DescriptorTypeOp->Asl.Value.Integer = CurrentByteOffset;
+    Info->DescriptorTypeOp->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
+    Info->DescriptorTypeOp->Asl.CompileFlags = NODE_IS_RESOURCE_DESC;
+    Info->DescriptorTypeOp->Asl.Value.Integer = Info->CurrentByteOffset;
 
     if (Rnode)
     {
-        DescriptorTypeOp->Asl.FinalAmlLength = Rnode->BufferLength;
-        DescriptorTypeOp->Asl.Extra = ((AML_RESOURCE *) Rnode->Buffer)->DescriptorType;
+        Info->DescriptorTypeOp->Asl.FinalAmlLength = Rnode->BufferLength;
+        Info->DescriptorTypeOp->Asl.Extra = ((AML_RESOURCE *) Rnode->Buffer)->DescriptorType;
     }
 
     return (Rnode);
@@ -1023,6 +988,7 @@ RsDoResourceTemplate (
     ASL_RESOURCE_NODE       HeadRnode;
     ASL_RESOURCE_NODE       *PreviousRnode;
     ASL_RESOURCE_NODE       *Rnode;
+    ASL_RESOURCE_INFO       Info;
     UINT8                   State;
 
 
@@ -1055,9 +1021,22 @@ RsDoResourceTemplate (
     PreviousRnode = &HeadRnode;
     while (DescriptorTypeOp)
     {
+        /* Save information for optional mapfile */
+
+        if (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONNECTION)
+        {
+            Info.MappingOp = Op->Asl.Parent;
+        }
+        else
+        {
+            Info.MappingOp = DescriptorTypeOp;
+        }
+
+        Info.DescriptorTypeOp = DescriptorTypeOp;
+        Info.CurrentByteOffset = CurrentByteOffset;
+
         DescriptorTypeOp->Asl.CompileFlags |= NODE_IS_RESOURCE_DESC;
-        Rnode = RsDoOneResourceDescriptor (DescriptorTypeOp, CurrentByteOffset,
-                    &State);
+        Rnode = RsDoOneResourceDescriptor (&Info, &State);
 
         /*
          * Update current byte offset to indicate the number of bytes from the
index 73f3efe..3731442 100644 (file)
@@ -64,9 +64,7 @@
  *
  * FUNCTION:    RsDoEndTagDescriptor
  *
- * PARAMETERS:  Op                  - Parent resource descriptor parse node
- *              CurrentByteOffset   - Offset into the resource template AML
- *                                    buffer (to track references to the desc)
+ * PARAMETERS:  Info                - Parse Op and resource template offset
  *
  * RETURN:      Completed resource node
  *
@@ -76,8 +74,7 @@
 
 ASL_RESOURCE_NODE *
 RsDoEndTagDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset)
+    ASL_RESOURCE_INFO       *Info)
 {
     AML_RESOURCE            *Descriptor;
     ASL_RESOURCE_NODE       *Rnode;
@@ -98,9 +95,7 @@ RsDoEndTagDescriptor (
  *
  * FUNCTION:    RsDoEndDependentDescriptor
  *
- * PARAMETERS:  Op                  - Parent resource descriptor parse node
- *              CurrentByteOffset   - Offset into the resource template AML
- *                                    buffer (to track references to the desc)
+ * PARAMETERS:  Info                - Parse Op and resource template offset
  *
  * RETURN:      Completed resource node
  *
@@ -110,8 +105,7 @@ RsDoEndTagDescriptor (
 
 ASL_RESOURCE_NODE *
 RsDoEndDependentDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset)
+    ASL_RESOURCE_INFO       *Info)
 {
     AML_RESOURCE            *Descriptor;
     ASL_RESOURCE_NODE       *Rnode;
@@ -130,9 +124,7 @@ RsDoEndDependentDescriptor (
  *
  * FUNCTION:    RsDoMemory24Descriptor
  *
- * PARAMETERS:  Op                  - Parent resource descriptor parse node
- *              CurrentByteOffset   - Offset into the resource template AML
- *                                    buffer (to track references to the desc)
+ * PARAMETERS:  Info                - Parse Op and resource template offset
  *
  * RETURN:      Completed resource node
  *
@@ -142,8 +134,7 @@ RsDoEndDependentDescriptor (
 
 ASL_RESOURCE_NODE *
 RsDoMemory24Descriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset)
+    ASL_RESOURCE_INFO       *Info)
 {
     AML_RESOURCE            *Descriptor;
     ACPI_PARSE_OBJECT       *InitializerOp;
@@ -151,10 +142,12 @@ RsDoMemory24Descriptor (
     ACPI_PARSE_OBJECT       *MaxOp = NULL;
     ACPI_PARSE_OBJECT       *LengthOp = NULL;
     ASL_RESOURCE_NODE       *Rnode;
+    UINT32                  CurrentByteOffset;
     UINT32                  i;
 
 
-    InitializerOp = Op->Asl.Child;
+    InitializerOp = Info->DescriptorTypeOp->Asl.Child;
+    CurrentByteOffset = Info->CurrentByteOffset;
     Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_MEMORY24));
 
     Descriptor = Rnode->Buffer;
@@ -207,7 +200,7 @@ RsDoMemory24Descriptor (
 
         case 5: /* Name */
 
-            UtAttachNamepathToOwner (Op, InitializerOp);
+            UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
             break;
 
         default:
@@ -226,7 +219,7 @@ RsDoMemory24Descriptor (
         Descriptor->Memory24.Maximum,
         Descriptor->Memory24.AddressLength,
         Descriptor->Memory24.Alignment,
-        MinOp, MaxOp, LengthOp, NULL, Op);
+        MinOp, MaxOp, LengthOp, NULL, Info->DescriptorTypeOp);
 
     return (Rnode);
 }
@@ -236,9 +229,7 @@ RsDoMemory24Descriptor (
  *
  * FUNCTION:    RsDoMemory32Descriptor
  *
- * PARAMETERS:  Op                  - Parent resource descriptor parse node
- *              CurrentByteOffset   - Offset into the resource template AML
- *                                    buffer (to track references to the desc)
+ * PARAMETERS:  Info                - Parse Op and resource template offset
  *
  * RETURN:      Completed resource node
  *
@@ -248,8 +239,7 @@ RsDoMemory24Descriptor (
 
 ASL_RESOURCE_NODE *
 RsDoMemory32Descriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset)
+    ASL_RESOURCE_INFO       *Info)
 {
     AML_RESOURCE            *Descriptor;
     ACPI_PARSE_OBJECT       *InitializerOp;
@@ -258,10 +248,12 @@ RsDoMemory32Descriptor (
     ACPI_PARSE_OBJECT       *LengthOp = NULL;
     ACPI_PARSE_OBJECT       *AlignOp = NULL;
     ASL_RESOURCE_NODE       *Rnode;
+    UINT32                  CurrentByteOffset;
     UINT32                  i;
 
 
-    InitializerOp = Op->Asl.Child;
+    InitializerOp = Info->DescriptorTypeOp->Asl.Child;
+    CurrentByteOffset = Info->CurrentByteOffset;
     Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_MEMORY32));
 
     Descriptor = Rnode->Buffer;
@@ -315,7 +307,7 @@ RsDoMemory32Descriptor (
 
         case 5: /* Name */
 
-            UtAttachNamepathToOwner (Op, InitializerOp);
+            UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
             break;
 
         default:
@@ -334,7 +326,7 @@ RsDoMemory32Descriptor (
         Descriptor->Memory32.Maximum,
         Descriptor->Memory32.AddressLength,
         Descriptor->Memory32.Alignment,
-        MinOp, MaxOp, LengthOp, AlignOp, Op);
+        MinOp, MaxOp, LengthOp, AlignOp, Info->DescriptorTypeOp);
 
     return (Rnode);
 }
@@ -344,9 +336,7 @@ RsDoMemory32Descriptor (
  *
  * FUNCTION:    RsDoMemory32FixedDescriptor
  *
- * PARAMETERS:  Op                  - Parent resource descriptor parse node
- *              CurrentByteOffset   - Offset into the resource template AML
- *                                    buffer (to track references to the desc)
+ * PARAMETERS:  Info                - Parse Op and resource template offset
  *
  * RETURN:      Completed resource node
  *
@@ -356,16 +346,17 @@ RsDoMemory32Descriptor (
 
 ASL_RESOURCE_NODE *
 RsDoMemory32FixedDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset)
+    ASL_RESOURCE_INFO       *Info)
 {
     AML_RESOURCE            *Descriptor;
     ACPI_PARSE_OBJECT       *InitializerOp;
     ASL_RESOURCE_NODE       *Rnode;
+    UINT32                  CurrentByteOffset;
     UINT32                  i;
 
 
-    InitializerOp = Op->Asl.Child;
+    InitializerOp = Info->DescriptorTypeOp->Asl.Child;
+    CurrentByteOffset = Info->CurrentByteOffset;
     Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_FIXED_MEMORY32));
 
     Descriptor = Rnode->Buffer;
@@ -401,7 +392,7 @@ RsDoMemory32FixedDescriptor (
 
         case 3: /* Name */
 
-            UtAttachNamepathToOwner (Op, InitializerOp);
+            UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
             break;
 
         default:
@@ -421,9 +412,7 @@ RsDoMemory32FixedDescriptor (
  *
  * FUNCTION:    RsDoStartDependentDescriptor
  *
- * PARAMETERS:  Op                  - Parent resource descriptor parse node
- *              CurrentByteOffset   - Offset into the resource template AML
- *                                    buffer (to track references to the desc)
+ * PARAMETERS:  Info                - Parse Op and resource template offset
  *
  * RETURN:      Completed resource node
  *
@@ -433,19 +422,21 @@ RsDoMemory32FixedDescriptor (
 
 ASL_RESOURCE_NODE *
 RsDoStartDependentDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset)
+    ASL_RESOURCE_INFO       *Info)
 {
     AML_RESOURCE            *Descriptor;
     ACPI_PARSE_OBJECT       *InitializerOp;
     ASL_RESOURCE_NODE       *Rnode;
     ASL_RESOURCE_NODE       *PreviousRnode;
     ASL_RESOURCE_NODE       *NextRnode;
+    ASL_RESOURCE_INFO       NextInfo;
+    UINT32                  CurrentByteOffset;
     UINT32                  i;
     UINT8                   State;
 
 
-    InitializerOp = Op->Asl.Child;
+    InitializerOp = Info->DescriptorTypeOp->Asl.Child;
+    CurrentByteOffset = Info->CurrentByteOffset;
     Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_START_DEPENDENT));
 
     PreviousRnode = Rnode;
@@ -491,8 +482,10 @@ RsDoStartDependentDescriptor (
 
         default:
 
-            NextRnode = RsDoOneResourceDescriptor  (InitializerOp,
-                        CurrentByteOffset, &State);
+            NextInfo.CurrentByteOffset = CurrentByteOffset;
+            NextInfo.DescriptorTypeOp = InitializerOp;
+
+            NextRnode = RsDoOneResourceDescriptor (&NextInfo, &State);
 
             /*
              * Update current byte offset to indicate the number of bytes from the
@@ -516,9 +509,7 @@ RsDoStartDependentDescriptor (
  *
  * FUNCTION:    RsDoStartDependentNoPriDescriptor
  *
- * PARAMETERS:  Op                  - Parent resource descriptor parse node
- *              CurrentByteOffset   - Offset into the resource template AML
- *                                    buffer (to track references to the desc)
+ * PARAMETERS:  Info                - Parse Op and resource template offset
  *
  * RETURN:      Completed resource node
  *
@@ -528,18 +519,20 @@ RsDoStartDependentDescriptor (
 
 ASL_RESOURCE_NODE *
 RsDoStartDependentNoPriDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset)
+    ASL_RESOURCE_INFO       *Info)
 {
     AML_RESOURCE            *Descriptor;
     ACPI_PARSE_OBJECT       *InitializerOp;
     ASL_RESOURCE_NODE       *Rnode;
     ASL_RESOURCE_NODE       *PreviousRnode;
     ASL_RESOURCE_NODE       *NextRnode;
+    ASL_RESOURCE_INFO       NextInfo;
+    UINT32                  CurrentByteOffset;
     UINT8                   State;
 
 
-    InitializerOp = Op->Asl.Child;
+    InitializerOp = Info->DescriptorTypeOp->Asl.Child;
+    CurrentByteOffset = Info->CurrentByteOffset;
     Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_START_DEPENDENT_NOPRIO));
 
     Descriptor = Rnode->Buffer;
@@ -556,8 +549,10 @@ RsDoStartDependentNoPriDescriptor (
     State = ACPI_RSTATE_START_DEPENDENT;
     while (InitializerOp)
     {
-        NextRnode = RsDoOneResourceDescriptor  (InitializerOp,
-                        CurrentByteOffset, &State);
+        NextInfo.CurrentByteOffset = CurrentByteOffset;
+        NextInfo.DescriptorTypeOp = InitializerOp;
+
+        NextRnode = RsDoOneResourceDescriptor (&NextInfo, &State);
 
         /*
          * Update current byte offset to indicate the number of bytes from the
@@ -578,9 +573,7 @@ RsDoStartDependentNoPriDescriptor (
  *
  * FUNCTION:    RsDoVendorSmallDescriptor
  *
- * PARAMETERS:  Op                  - Parent resource descriptor parse node
- *              CurrentByteOffset   - Offset into the resource template AML
- *                                    buffer (to track references to the desc)
+ * PARAMETERS:  Info                - Parse Op and resource template offset
  *
  * RETURN:      Completed resource node
  *
@@ -590,8 +583,7 @@ RsDoStartDependentNoPriDescriptor (
 
 ASL_RESOURCE_NODE *
 RsDoVendorSmallDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset)
+    ASL_RESOURCE_INFO       *Info)
 {
     AML_RESOURCE            *Descriptor;
     ACPI_PARSE_OBJECT       *InitializerOp;
@@ -600,7 +592,7 @@ RsDoVendorSmallDescriptor (
     UINT32                  i;
 
 
-    InitializerOp = Op->Asl.Child;
+    InitializerOp = Info->DescriptorTypeOp->Asl.Child;
 
     /* Allocate worst case - 7 vendor bytes */
 
index bc16d72..ca4771e 100644 (file)
@@ -62,9 +62,7 @@
  *
  * FUNCTION:    RsDoDmaDescriptor
  *
- * PARAMETERS:  Op                  - Parent resource descriptor parse node
- *              CurrentByteOffset   - Offset into the resource template AML
- *                                    buffer (to track references to the desc)
+ * PARAMETERS:  Info                - Parse Op and resource template offset
  *
  * RETURN:      Completed resource node
  *
 
 ASL_RESOURCE_NODE *
 RsDoDmaDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset)
+    ASL_RESOURCE_INFO       *Info)
 {
     AML_RESOURCE            *Descriptor;
     ACPI_PARSE_OBJECT       *InitializerOp;
     ASL_RESOURCE_NODE       *Rnode;
+    UINT32                  CurrentByteOffset;
     UINT32                  i;
     UINT8                   DmaChannelMask = 0;
     UINT8                   DmaChannels = 0;
 
 
-    InitializerOp = Op->Asl.Child;
+    InitializerOp = Info->DescriptorTypeOp->Asl.Child;
+    CurrentByteOffset = Info->CurrentByteOffset;
     Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_DMA));
 
     Descriptor = Rnode->Buffer;
@@ -121,7 +120,7 @@ RsDoDmaDescriptor (
 
         case 3: /* Name */
 
-            UtAttachNamepathToOwner (Op, InitializerOp);
+            UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
             break;
 
         default:
@@ -183,9 +182,7 @@ RsDoDmaDescriptor (
  *
  * FUNCTION:    RsDoFixedDmaDescriptor
  *
- * PARAMETERS:  Op                  - Parent resource descriptor parse node
- *              CurrentByteOffset   - Offset into the resource template AML
- *                                    buffer (to track references to the desc)
+ * PARAMETERS:  Info                - Parse Op and resource template offset
  *
  * RETURN:      Completed resource node
  *
@@ -195,16 +192,17 @@ RsDoDmaDescriptor (
 
 ASL_RESOURCE_NODE *
 RsDoFixedDmaDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset)
+    ASL_RESOURCE_INFO       *Info)
 {
     AML_RESOURCE            *Descriptor;
     ACPI_PARSE_OBJECT       *InitializerOp;
     ASL_RESOURCE_NODE       *Rnode;
+    UINT32                  CurrentByteOffset;
     UINT32                  i;
 
 
-    InitializerOp = Op->Asl.Child;
+    InitializerOp = Info->DescriptorTypeOp->Asl.Child;
+    CurrentByteOffset = Info->CurrentByteOffset;
     Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_FIXED_DMA));
 
     Descriptor = Rnode->Buffer;
@@ -240,7 +238,7 @@ RsDoFixedDmaDescriptor (
 
         case 3: /* Descriptor Name (optional) */
 
-            UtAttachNamepathToOwner (Op, InitializerOp);
+            UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
             break;
 
         default:    /* Ignore any extra nodes */
@@ -259,9 +257,7 @@ RsDoFixedDmaDescriptor (
  *
  * FUNCTION:    RsDoFixedIoDescriptor
  *
- * PARAMETERS:  Op                  - Parent resource descriptor parse node
- *              CurrentByteOffset   - Offset into the resource template AML
- *                                    buffer (to track references to the desc)
+ * PARAMETERS:  Info                - Parse Op and resource template offset
  *
  * RETURN:      Completed resource node
  *
@@ -271,17 +267,18 @@ RsDoFixedDmaDescriptor (
 
 ASL_RESOURCE_NODE *
 RsDoFixedIoDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset)
+    ASL_RESOURCE_INFO       *Info)
 {
     AML_RESOURCE            *Descriptor;
     ACPI_PARSE_OBJECT       *InitializerOp;
     ACPI_PARSE_OBJECT       *AddressOp = NULL;
     ASL_RESOURCE_NODE       *Rnode;
+    UINT32                  CurrentByteOffset;
     UINT32                  i;
 
 
-    InitializerOp = Op->Asl.Child;
+    InitializerOp = Info->DescriptorTypeOp->Asl.Child;
+    CurrentByteOffset = Info->CurrentByteOffset;
     Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_FIXED_IO));
 
     Descriptor = Rnode->Buffer;
@@ -313,7 +310,7 @@ RsDoFixedIoDescriptor (
 
         case 2: /* Name */
 
-            UtAttachNamepathToOwner (Op, InitializerOp);
+            UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
             break;
 
         default:
@@ -340,9 +337,7 @@ RsDoFixedIoDescriptor (
  *
  * FUNCTION:    RsDoIoDescriptor
  *
- * PARAMETERS:  Op                  - Parent resource descriptor parse node
- *              CurrentByteOffset   - Offset into the resource template AML
- *                                    buffer (to track references to the desc)
+ * PARAMETERS:  Info                - Parse Op and resource template offset
  *
  * RETURN:      Completed resource node
  *
@@ -352,8 +347,7 @@ RsDoFixedIoDescriptor (
 
 ASL_RESOURCE_NODE *
 RsDoIoDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset)
+    ASL_RESOURCE_INFO       *Info)
 {
     AML_RESOURCE            *Descriptor;
     ACPI_PARSE_OBJECT       *InitializerOp;
@@ -362,10 +356,12 @@ RsDoIoDescriptor (
     ACPI_PARSE_OBJECT       *LengthOp = NULL;
     ACPI_PARSE_OBJECT       *AlignOp = NULL;
     ASL_RESOURCE_NODE       *Rnode;
+    UINT32                  CurrentByteOffset;
     UINT32                  i;
 
 
-    InitializerOp = Op->Asl.Child;
+    InitializerOp = Info->DescriptorTypeOp->Asl.Child;
+    CurrentByteOffset = Info->CurrentByteOffset;
     Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IO));
 
     Descriptor = Rnode->Buffer;
@@ -423,7 +419,7 @@ RsDoIoDescriptor (
 
         case 5: /* Name */
 
-            UtAttachNamepathToOwner (Op, InitializerOp);
+            UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
             break;
 
         default:
@@ -442,7 +438,7 @@ RsDoIoDescriptor (
         Descriptor->Io.Maximum,
         Descriptor->Io.AddressLength,
         Descriptor->Io.Alignment,
-        MinOp, MaxOp, LengthOp, AlignOp, Op);
+        MinOp, MaxOp, LengthOp, AlignOp, Info->DescriptorTypeOp);
 
     return (Rnode);
 }
@@ -452,9 +448,7 @@ RsDoIoDescriptor (
  *
  * FUNCTION:    RsDoIrqDescriptor
  *
- * PARAMETERS:  Op                  - Parent resource descriptor parse node
- *              CurrentByteOffset   - Offset into the resource template AML
- *                                    buffer (to track references to the desc)
+ * PARAMETERS:  Info                - Parse Op and resource template offset
  *
  * RETURN:      Completed resource node
  *
@@ -464,18 +458,19 @@ RsDoIoDescriptor (
 
 ASL_RESOURCE_NODE *
 RsDoIrqDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset)
+    ASL_RESOURCE_INFO       *Info)
 {
     AML_RESOURCE            *Descriptor;
     ACPI_PARSE_OBJECT       *InitializerOp;
     ASL_RESOURCE_NODE       *Rnode;
     UINT32                  Interrupts = 0;
     UINT16                  IrqMask = 0;
+    UINT32                  CurrentByteOffset;
     UINT32                  i;
 
 
-    InitializerOp = Op->Asl.Child;
+    InitializerOp = Info->DescriptorTypeOp->Asl.Child;
+    CurrentByteOffset = Info->CurrentByteOffset;
     Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IRQ));
 
     /* Length = 3 (with flag byte) */
@@ -513,7 +508,7 @@ RsDoIrqDescriptor (
 
         case 3: /* Name */
 
-            UtAttachNamepathToOwner (Op, InitializerOp);
+            UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
             break;
 
         default:
@@ -575,9 +570,7 @@ RsDoIrqDescriptor (
  *
  * FUNCTION:    RsDoIrqNoFlagsDescriptor
  *
- * PARAMETERS:  Op                  - Parent resource descriptor parse node
- *              CurrentByteOffset   - Offset into the resource template AML
- *                                    buffer (to track references to the desc)
+ * PARAMETERS:  Info                - Parse Op and resource template offset
  *
  * RETURN:      Completed resource node
  *
@@ -587,18 +580,19 @@ RsDoIrqDescriptor (
 
 ASL_RESOURCE_NODE *
 RsDoIrqNoFlagsDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset)
+    ASL_RESOURCE_INFO       *Info)
 {
     AML_RESOURCE            *Descriptor;
     ACPI_PARSE_OBJECT       *InitializerOp;
     ASL_RESOURCE_NODE       *Rnode;
     UINT16                  IrqMask = 0;
     UINT32                  Interrupts = 0;
+    UINT32                  CurrentByteOffset;
     UINT32                  i;
 
 
-    InitializerOp = Op->Asl.Child;
+    InitializerOp = Info->DescriptorTypeOp->Asl.Child;
+    CurrentByteOffset = Info->CurrentByteOffset;
     Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IRQ_NOFLAGS));
 
     Descriptor = Rnode->Buffer;
@@ -613,7 +607,7 @@ RsDoIrqNoFlagsDescriptor (
         {
         case 0: /* Name */
 
-            UtAttachNamepathToOwner (Op, InitializerOp);
+            UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
             break;
 
         default:
index 9579fe4..ed848c6 100644 (file)
@@ -60,9 +60,7 @@
  *
  * FUNCTION:    RsDoGeneralRegisterDescriptor
  *
- * PARAMETERS:  Op                  - Parent resource descriptor parse node
- *              CurrentByteOffset   - Offset into the resource template AML
- *                                    buffer (to track references to the desc)
+ * PARAMETERS:  Info                - Parse Op and resource template offset
  *
  * RETURN:      Completed resource node
  *
 
 ASL_RESOURCE_NODE *
 RsDoGeneralRegisterDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset)
+    ASL_RESOURCE_INFO       *Info)
 {
     AML_RESOURCE            *Descriptor;
     ACPI_PARSE_OBJECT       *InitializerOp;
     ASL_RESOURCE_NODE       *Rnode;
+    UINT32                  CurrentByteOffset;
     UINT32                  i;
 
 
-    InitializerOp = Op->Asl.Child;
+    InitializerOp = Info->DescriptorTypeOp->Asl.Child;
+    CurrentByteOffset = Info->CurrentByteOffset;
     Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_GENERIC_REGISTER));
 
     Descriptor = Rnode->Buffer;
@@ -137,7 +136,7 @@ RsDoGeneralRegisterDescriptor (
 
         case 5: /* ResourceTag (ACPI 3.0b) */
 
-            UtAttachNamepathToOwner (Op, InitializerOp);
+            UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
             break;
 
         default:
@@ -156,9 +155,7 @@ RsDoGeneralRegisterDescriptor (
  *
  * FUNCTION:    RsDoInterruptDescriptor
  *
- * PARAMETERS:  Op                  - Parent resource descriptor parse node
- *              CurrentByteOffset   - Offset into the resource template AML
- *                                    buffer (to track references to the desc)
+ * PARAMETERS:  Info                - Parse Op and resource template offset
  *
  * RETURN:      Completed resource node
  *
@@ -168,8 +165,7 @@ RsDoGeneralRegisterDescriptor (
 
 ASL_RESOURCE_NODE *
 RsDoInterruptDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset)
+    ASL_RESOURCE_INFO       *Info)
 {
     AML_RESOURCE            *Descriptor;
     AML_RESOURCE            *Rover = NULL;
@@ -177,13 +173,15 @@ RsDoInterruptDescriptor (
     ASL_RESOURCE_NODE       *Rnode;
     UINT16                  StringLength = 0;
     UINT32                  OptionIndex = 0;
+    UINT32                  CurrentByteOffset;
     UINT32                  i;
     BOOLEAN                 HasResSourceIndex = FALSE;
     UINT8                   ResSourceIndex = 0;
     UINT8                   *ResSourceString = NULL;
 
 
-    InitializerOp = Op->Asl.Child;
+    InitializerOp = Info->DescriptorTypeOp->Asl.Child;
+    CurrentByteOffset = Info->CurrentByteOffset;
     StringLength = RsGetStringDataLength (InitializerOp);
 
     /* Count the interrupt numbers */
@@ -210,9 +208,9 @@ RsDoInterruptDescriptor (
         OptionIndex += 4;
     }
 
-    InitializerOp = Op->Asl.Child;
+    InitializerOp = Info->DescriptorTypeOp->Asl.Child;
     Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_EXTENDED_IRQ) +
-                1 + OptionIndex + StringLength);
+        1 + OptionIndex + StringLength);
 
     Descriptor = Rnode->Buffer;
     Descriptor->ExtendedIrq.DescriptorType  = ACPI_RESOURCE_NAME_EXTENDED_IRQ;
@@ -302,7 +300,7 @@ RsDoInterruptDescriptor (
 
         case 6: /* ResourceTag */
 
-            UtAttachNamepathToOwner (Op, InitializerOp);
+            UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
             break;
 
         default:
@@ -395,9 +393,7 @@ RsDoInterruptDescriptor (
  *
  * FUNCTION:    RsDoVendorLargeDescriptor
  *
- * PARAMETERS:  Op                  - Parent resource descriptor parse node
- *              CurrentByteOffset   - Offset into the resource template AML
- *                                    buffer (to track references to the desc)
+ * PARAMETERS:  Info                - Parse Op and resource template offset
  *
  * RETURN:      Completed resource node
  *
@@ -407,8 +403,7 @@ RsDoInterruptDescriptor (
 
 ASL_RESOURCE_NODE *
 RsDoVendorLargeDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset)
+    ASL_RESOURCE_INFO       *Info)
 {
     AML_RESOURCE            *Descriptor;
     ACPI_PARSE_OBJECT       *InitializerOp;
@@ -419,7 +414,7 @@ RsDoVendorLargeDescriptor (
 
     /* Count the number of data bytes */
 
-    InitializerOp = Op->Asl.Child;
+    InitializerOp = Info->DescriptorTypeOp->Asl.Child;
     InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
 
     for (i = 0; InitializerOp; i++)
@@ -431,7 +426,7 @@ RsDoVendorLargeDescriptor (
         InitializerOp = InitializerOp->Asl.Next;
     }
 
-    InitializerOp = Op->Asl.Child;
+    InitializerOp = Info->DescriptorTypeOp->Asl.Child;
     InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
     Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_VENDOR_LARGE) + i);
 
index 297f99a..edce9c8 100644 (file)
@@ -59,9 +59,7 @@
  *
  * FUNCTION:    RsDoDwordIoDescriptor
  *
- * PARAMETERS:  Op                  - Parent resource descriptor parse node
- *              CurrentByteOffset   - Offset into the resource template AML
- *                                    buffer (to track references to the desc)
+ * PARAMETERS:  Info                - Parse Op and resource template offset
  *
  * RETURN:      Completed resource node
  *
@@ -71,8 +69,7 @@
 
 ASL_RESOURCE_NODE *
 RsDoDwordIoDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset)
+    ASL_RESOURCE_INFO       *Info)
 {
     AML_RESOURCE            *Descriptor;
     ACPI_PARSE_OBJECT       *InitializerOp;
@@ -84,12 +81,14 @@ RsDoDwordIoDescriptor (
     UINT16                  StringLength = 0;
     UINT32                  OptionIndex = 0;
     UINT8                   *OptionalFields;
+    UINT32                  CurrentByteOffset;
     UINT32                  i;
     BOOLEAN                 ResSourceIndex = FALSE;
 
 
-    InitializerOp = Op->Asl.Child;
+    InitializerOp = Info->DescriptorTypeOp->Asl.Child;
     StringLength = RsGetStringDataLength (InitializerOp);
+    CurrentByteOffset = Info->CurrentByteOffset;
 
     Rnode = RsAllocateResourceNode (
                 sizeof (AML_RESOURCE_ADDRESS32) + 1 + StringLength);
@@ -244,7 +243,7 @@ RsDoDwordIoDescriptor (
 
         case 12: /* ResourceTag */
 
-            UtAttachNamepathToOwner (Op, InitializerOp);
+            UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
             break;
 
         case 13: /* Type */
@@ -278,10 +277,10 @@ RsDoDwordIoDescriptor (
         (UINT64) Descriptor->Address32.AddressLength,
         (UINT64) Descriptor->Address32.Granularity,
         Descriptor->Address32.Flags,
-        MinOp, MaxOp, LengthOp, GranOp, Op);
+        MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
 
     Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) +
-                            OptionIndex + StringLength;
+        OptionIndex + StringLength;
     return (Rnode);
 }
 
@@ -290,9 +289,7 @@ RsDoDwordIoDescriptor (
  *
  * FUNCTION:    RsDoDwordMemoryDescriptor
  *
- * PARAMETERS:  Op                  - Parent resource descriptor parse node
- *              CurrentByteOffset   - Offset into the resource template AML
- *                                    buffer (to track references to the desc)
+ * PARAMETERS:  Info                - Parse Op and resource template offset
  *
  * RETURN:      Completed resource node
  *
@@ -302,8 +299,7 @@ RsDoDwordIoDescriptor (
 
 ASL_RESOURCE_NODE *
 RsDoDwordMemoryDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset)
+    ASL_RESOURCE_INFO       *Info)
 {
     AML_RESOURCE            *Descriptor;
     ACPI_PARSE_OBJECT       *InitializerOp;
@@ -315,12 +311,14 @@ RsDoDwordMemoryDescriptor (
     UINT8                   *OptionalFields;
     UINT16                  StringLength = 0;
     UINT32                  OptionIndex = 0;
+    UINT32                  CurrentByteOffset;
     UINT32                  i;
     BOOLEAN                 ResSourceIndex = FALSE;
 
 
-    InitializerOp = Op->Asl.Child;
+    InitializerOp = Info->DescriptorTypeOp->Asl.Child;
     StringLength = RsGetStringDataLength (InitializerOp);
+    CurrentByteOffset = Info->CurrentByteOffset;
 
     Rnode = RsAllocateResourceNode (
                 sizeof (AML_RESOURCE_ADDRESS32) + 1 + StringLength);
@@ -479,7 +477,7 @@ RsDoDwordMemoryDescriptor (
 
         case 13: /* ResourceTag */
 
-            UtAttachNamepathToOwner (Op, InitializerOp);
+            UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
             break;
 
 
@@ -514,10 +512,10 @@ RsDoDwordMemoryDescriptor (
         (UINT64) Descriptor->Address32.AddressLength,
         (UINT64) Descriptor->Address32.Granularity,
         Descriptor->Address32.Flags,
-        MinOp, MaxOp, LengthOp, GranOp, Op);
+        MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
 
     Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) +
-                            OptionIndex + StringLength;
+        OptionIndex + StringLength;
     return (Rnode);
 }
 
@@ -526,9 +524,7 @@ RsDoDwordMemoryDescriptor (
  *
  * FUNCTION:    RsDoDwordSpaceDescriptor
  *
- * PARAMETERS:  Op                  - Parent resource descriptor parse node
- *              CurrentByteOffset   - Offset into the resource template AML
- *                                    buffer (to track references to the desc)
+ * PARAMETERS:  Info                - Parse Op and resource template offset
  *
  * RETURN:      Completed resource node
  *
@@ -538,8 +534,7 @@ RsDoDwordMemoryDescriptor (
 
 ASL_RESOURCE_NODE *
 RsDoDwordSpaceDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset)
+    ASL_RESOURCE_INFO       *Info)
 {
     AML_RESOURCE            *Descriptor;
     ACPI_PARSE_OBJECT       *InitializerOp;
@@ -551,12 +546,14 @@ RsDoDwordSpaceDescriptor (
     UINT8                   *OptionalFields;
     UINT16                  StringLength = 0;
     UINT32                  OptionIndex = 0;
+    UINT32                  CurrentByteOffset;
     UINT32                  i;
     BOOLEAN                 ResSourceIndex = FALSE;
 
 
-    InitializerOp = Op->Asl.Child;
+    InitializerOp = Info->DescriptorTypeOp->Asl.Child;
     StringLength = RsGetStringDataLength (InitializerOp);
+    CurrentByteOffset = Info->CurrentByteOffset;
 
     Rnode = RsAllocateResourceNode (
                 sizeof (AML_RESOURCE_ADDRESS32) + 1 + StringLength);
@@ -711,7 +708,7 @@ RsDoDwordSpaceDescriptor (
 
         case 13: /* ResourceTag */
 
-            UtAttachNamepathToOwner (Op, InitializerOp);
+            UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
             break;
 
         default:
@@ -732,9 +729,9 @@ RsDoDwordSpaceDescriptor (
         (UINT64) Descriptor->Address32.AddressLength,
         (UINT64) Descriptor->Address32.Granularity,
         Descriptor->Address32.Flags,
-        MinOp, MaxOp, LengthOp, GranOp, Op);
+        MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
 
     Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) +
-                            OptionIndex + StringLength;
+        OptionIndex + StringLength;
     return (Rnode);
 }
index 08590cc..94fb234 100644 (file)
@@ -58,9 +58,7 @@
  *
  * FUNCTION:    RsDoExtendedIoDescriptor
  *
- * PARAMETERS:  Op                  - Parent resource descriptor parse node
- *              CurrentByteOffset   - Offset into the resource template AML
- *                                    buffer (to track references to the desc)
+ * PARAMETERS:  Info                - Parse Op and resource template offset
  *
  * RETURN:      Completed resource node
  *
@@ -70,8 +68,7 @@
 
 ASL_RESOURCE_NODE *
 RsDoExtendedIoDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset)
+    ASL_RESOURCE_INFO       *Info)
 {
     AML_RESOURCE            *Descriptor;
     ACPI_PARSE_OBJECT       *InitializerOp;
@@ -81,11 +78,13 @@ RsDoExtendedIoDescriptor (
     ACPI_PARSE_OBJECT       *GranOp = NULL;
     ASL_RESOURCE_NODE       *Rnode;
     UINT16                  StringLength = 0;
+    UINT32                  CurrentByteOffset;
     UINT32                  i;
 
 
-    InitializerOp = Op->Asl.Child;
+    InitializerOp = Info->DescriptorTypeOp->Asl.Child;
     StringLength = RsGetStringDataLength (InitializerOp);
+    CurrentByteOffset = Info->CurrentByteOffset;
 
     Rnode = RsAllocateResourceNode (
                 sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + 1 + StringLength);
@@ -186,7 +185,7 @@ RsDoExtendedIoDescriptor (
 
         case 11: /* ResourceTag */
 
-            UtAttachNamepathToOwner (Op, InitializerOp);
+            UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
             break;
 
         case 12: /* Type */
@@ -220,9 +219,10 @@ RsDoExtendedIoDescriptor (
         Descriptor->ExtAddress64.AddressLength,
         Descriptor->ExtAddress64.Granularity,
         Descriptor->ExtAddress64.Flags,
-        MinOp, MaxOp, LengthOp, GranOp, Op);
+        MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
 
-    Rnode->BufferLength = sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + StringLength;
+    Rnode->BufferLength = sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) +
+        StringLength;
     return (Rnode);
 }
 
@@ -231,9 +231,7 @@ RsDoExtendedIoDescriptor (
  *
  * FUNCTION:    RsDoExtendedMemoryDescriptor
  *
- * PARAMETERS:  Op                  - Parent resource descriptor parse node
- *              CurrentByteOffset   - Offset into the resource template AML
- *                                    buffer (to track references to the desc)
+ * PARAMETERS:  Info                - Parse Op and resource template offset
  *
  * RETURN:      Completed resource node
  *
@@ -243,8 +241,7 @@ RsDoExtendedIoDescriptor (
 
 ASL_RESOURCE_NODE *
 RsDoExtendedMemoryDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset)
+    ASL_RESOURCE_INFO       *Info)
 {
     AML_RESOURCE            *Descriptor;
     ACPI_PARSE_OBJECT       *InitializerOp;
@@ -254,11 +251,13 @@ RsDoExtendedMemoryDescriptor (
     ACPI_PARSE_OBJECT       *GranOp = NULL;
     ASL_RESOURCE_NODE       *Rnode;
     UINT16                  StringLength = 0;
+    UINT32                  CurrentByteOffset;
     UINT32                  i;
 
 
-    InitializerOp = Op->Asl.Child;
+    InitializerOp = Info->DescriptorTypeOp->Asl.Child;
     StringLength = RsGetStringDataLength (InitializerOp);
+    CurrentByteOffset = Info->CurrentByteOffset;
 
     Rnode = RsAllocateResourceNode (
                 sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + 1 + StringLength);
@@ -366,7 +365,7 @@ RsDoExtendedMemoryDescriptor (
 
         case 12: /* ResourceTag */
 
-            UtAttachNamepathToOwner (Op, InitializerOp);
+            UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
             break;
 
 
@@ -401,9 +400,10 @@ RsDoExtendedMemoryDescriptor (
         Descriptor->ExtAddress64.AddressLength,
         Descriptor->ExtAddress64.Granularity,
         Descriptor->ExtAddress64.Flags,
-        MinOp, MaxOp, LengthOp, GranOp, Op);
+        MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
 
-    Rnode->BufferLength = sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + StringLength;
+    Rnode->BufferLength = sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) +
+        StringLength;
     return (Rnode);
 }
 
@@ -412,9 +412,7 @@ RsDoExtendedMemoryDescriptor (
  *
  * FUNCTION:    RsDoExtendedSpaceDescriptor
  *
- * PARAMETERS:  Op                  - Parent resource descriptor parse node
- *              CurrentByteOffset   - Offset into the resource template AML
- *                                    buffer (to track references to the desc)
+ * PARAMETERS:  Info                - Parse Op and resource template offset
  *
  * RETURN:      Completed resource node
  *
@@ -424,8 +422,7 @@ RsDoExtendedMemoryDescriptor (
 
 ASL_RESOURCE_NODE *
 RsDoExtendedSpaceDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset)
+    ASL_RESOURCE_INFO       *Info)
 {
     AML_RESOURCE            *Descriptor;
     ACPI_PARSE_OBJECT       *InitializerOp;
@@ -435,11 +432,13 @@ RsDoExtendedSpaceDescriptor (
     ACPI_PARSE_OBJECT       *GranOp = NULL;
     ASL_RESOURCE_NODE       *Rnode;
     UINT16                  StringLength = 0;
+    UINT32                  CurrentByteOffset;
     UINT32                  i;
 
 
-    InitializerOp = Op->Asl.Child;
+    InitializerOp = Info->DescriptorTypeOp->Asl.Child;
     StringLength = RsGetStringDataLength (InitializerOp);
+    CurrentByteOffset = Info->CurrentByteOffset;
 
     Rnode = RsAllocateResourceNode (
                 sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + 1 + StringLength);
@@ -544,7 +543,7 @@ RsDoExtendedSpaceDescriptor (
 
         case 12: /* ResourceTag */
 
-            UtAttachNamepathToOwner (Op, InitializerOp);
+            UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
             break;
 
         default:
@@ -564,8 +563,9 @@ RsDoExtendedSpaceDescriptor (
         Descriptor->ExtAddress64.AddressLength,
         Descriptor->ExtAddress64.Granularity,
         Descriptor->ExtAddress64.Flags,
-        MinOp, MaxOp, LengthOp, GranOp, Op);
+        MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
 
-    Rnode->BufferLength = sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + StringLength;
+    Rnode->BufferLength = sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) +
+        StringLength;
     return (Rnode);
 }
index 0bd32e7..2e548e8 100644 (file)
@@ -59,9 +59,7 @@
  *
  * FUNCTION:    RsDoQwordIoDescriptor
  *
- * PARAMETERS:  Op                  - Parent resource descriptor parse node
- *              CurrentByteOffset   - Offset into the resource template AML
- *                                    buffer (to track references to the desc)
+ * PARAMETERS:  Info                - Parse Op and resource template offset
  *
  * RETURN:      Completed resource node
  *
@@ -71,8 +69,7 @@
 
 ASL_RESOURCE_NODE *
 RsDoQwordIoDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset)
+    ASL_RESOURCE_INFO       *Info)
 {
     AML_RESOURCE            *Descriptor;
     ACPI_PARSE_OBJECT       *InitializerOp;
@@ -84,12 +81,14 @@ RsDoQwordIoDescriptor (
     UINT8                   *OptionalFields;
     UINT16                  StringLength = 0;
     UINT32                  OptionIndex = 0;
+    UINT32                  CurrentByteOffset;
     UINT32                  i;
     BOOLEAN                 ResSourceIndex = FALSE;
 
 
-    InitializerOp = Op->Asl.Child;
+    InitializerOp = Info->DescriptorTypeOp->Asl.Child;
     StringLength = RsGetStringDataLength (InitializerOp);
+    CurrentByteOffset = Info->CurrentByteOffset;
 
     Rnode = RsAllocateResourceNode (
                 sizeof (AML_RESOURCE_ADDRESS64) + 1 + StringLength);
@@ -235,7 +234,7 @@ RsDoQwordIoDescriptor (
 
         case 12: /* ResourceTag */
 
-            UtAttachNamepathToOwner (Op, InitializerOp);
+            UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
             break;
 
         case 13: /* Type */
@@ -269,10 +268,10 @@ RsDoQwordIoDescriptor (
         Descriptor->Address64.AddressLength,
         Descriptor->Address64.Granularity,
         Descriptor->Address64.Flags,
-        MinOp, MaxOp, LengthOp, GranOp, Op);
+        MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
 
     Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) +
-                            OptionIndex + StringLength;
+        OptionIndex + StringLength;
     return (Rnode);
 }
 
@@ -281,9 +280,7 @@ RsDoQwordIoDescriptor (
  *
  * FUNCTION:    RsDoQwordMemoryDescriptor
  *
- * PARAMETERS:  Op                  - Parent resource descriptor parse node
- *              CurrentByteOffset   - Offset into the resource template AML
- *                                    buffer (to track references to the desc)
+ * PARAMETERS:  Info                - Parse Op and resource template offset
  *
  * RETURN:      Completed resource node
  *
@@ -293,8 +290,7 @@ RsDoQwordIoDescriptor (
 
 ASL_RESOURCE_NODE *
 RsDoQwordMemoryDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset)
+    ASL_RESOURCE_INFO       *Info)
 {
     AML_RESOURCE            *Descriptor;
     ACPI_PARSE_OBJECT       *InitializerOp;
@@ -306,12 +302,14 @@ RsDoQwordMemoryDescriptor (
     UINT8                   *OptionalFields;
     UINT16                  StringLength = 0;
     UINT32                  OptionIndex = 0;
+    UINT32                  CurrentByteOffset;
     UINT32                  i;
     BOOLEAN                 ResSourceIndex = FALSE;
 
 
-    InitializerOp = Op->Asl.Child;
+    InitializerOp = Info->DescriptorTypeOp->Asl.Child;
     StringLength = RsGetStringDataLength (InitializerOp);
+    CurrentByteOffset = Info->CurrentByteOffset;
 
     Rnode = RsAllocateResourceNode (
                 sizeof (AML_RESOURCE_ADDRESS64) + 1 + StringLength);
@@ -464,7 +462,7 @@ RsDoQwordMemoryDescriptor (
 
         case 13: /* ResourceTag */
 
-            UtAttachNamepathToOwner (Op, InitializerOp);
+            UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
             break;
 
 
@@ -499,10 +497,10 @@ RsDoQwordMemoryDescriptor (
         Descriptor->Address64.AddressLength,
         Descriptor->Address64.Granularity,
         Descriptor->Address64.Flags,
-        MinOp, MaxOp, LengthOp, GranOp, Op);
+        MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
 
     Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) +
-                            OptionIndex + StringLength;
+        OptionIndex + StringLength;
     return (Rnode);
 }
 
@@ -511,9 +509,7 @@ RsDoQwordMemoryDescriptor (
  *
  * FUNCTION:    RsDoQwordSpaceDescriptor
  *
- * PARAMETERS:  Op                  - Parent resource descriptor parse node
- *              CurrentByteOffset   - Offset into the resource template AML
- *                                    buffer (to track references to the desc)
+ * PARAMETERS:  Info                - Parse Op and resource template offset
  *
  * RETURN:      Completed resource node
  *
@@ -523,8 +519,7 @@ RsDoQwordMemoryDescriptor (
 
 ASL_RESOURCE_NODE *
 RsDoQwordSpaceDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset)
+    ASL_RESOURCE_INFO       *Info)
 {
     AML_RESOURCE            *Descriptor;
     ACPI_PARSE_OBJECT       *InitializerOp;
@@ -536,12 +531,14 @@ RsDoQwordSpaceDescriptor (
     UINT8                   *OptionalFields;
     UINT16                  StringLength = 0;
     UINT32                  OptionIndex = 0;
+    UINT32                  CurrentByteOffset;
     UINT32                  i;
     BOOLEAN                 ResSourceIndex = FALSE;
 
 
-    InitializerOp = Op->Asl.Child;
+    InitializerOp = Info->DescriptorTypeOp->Asl.Child;
     StringLength = RsGetStringDataLength (InitializerOp);
+    CurrentByteOffset = Info->CurrentByteOffset;
 
     Rnode = RsAllocateResourceNode (
                 sizeof (AML_RESOURCE_ADDRESS64) + 1 + StringLength);
@@ -691,7 +688,7 @@ RsDoQwordSpaceDescriptor (
 
         case 13: /* ResourceTag */
 
-            UtAttachNamepathToOwner (Op, InitializerOp);
+            UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
             break;
 
         default:
@@ -711,9 +708,9 @@ RsDoQwordSpaceDescriptor (
         Descriptor->Address64.AddressLength,
         Descriptor->Address64.Granularity,
         Descriptor->Address64.Flags,
-        MinOp, MaxOp, LengthOp, GranOp, Op);
+        MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
 
     Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) +
-                            OptionIndex + StringLength;
+        OptionIndex + StringLength;
     return (Rnode);
 }
index c607899..7e4884b 100644 (file)
@@ -267,9 +267,7 @@ RsGetVendorData (
  *
  * FUNCTION:    RsDoGpioIntDescriptor
  *
- * PARAMETERS:  Op                  - Parent resource descriptor parse node
- *              CurrentByteOffset   - Offset into the resource template AML
- *                                    buffer (to track references to the desc)
+ * PARAMETERS:  Info                - Parse Op and resource template offset
  *
  * RETURN:      Completed resource node
  *
@@ -279,8 +277,7 @@ RsGetVendorData (
 
 ASL_RESOURCE_NODE *
 RsDoGpioIntDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset)
+    ASL_RESOURCE_INFO       *Info)
 {
     AML_RESOURCE            *Descriptor;
     ACPI_PARSE_OBJECT       *InitializerOp;
@@ -288,14 +285,18 @@ RsDoGpioIntDescriptor (
     char                    *ResourceSource = NULL;
     UINT8                   *VendorData = NULL;
     UINT16                  *InterruptList = NULL;
+    UINT16                  *PinList = NULL;
     UINT16                  ResSourceLength;
     UINT16                  VendorLength;
     UINT16                  InterruptLength;
     UINT16                  DescriptorSize;
+    UINT32                  CurrentByteOffset;
+    UINT32                  PinCount = 0;
     UINT32                  i;
 
 
-    InitializerOp = Op->Asl.Child;
+    InitializerOp = Info->DescriptorTypeOp->Asl.Child;
+    CurrentByteOffset = Info->CurrentByteOffset;
 
     /*
      * Calculate lengths for fields that have variable length:
@@ -323,6 +324,7 @@ RsDoGpioIntDescriptor (
     /* Build pointers to optional areas */
 
     InterruptList = ACPI_ADD_PTR (UINT16, Descriptor, sizeof (AML_RESOURCE_GPIO));
+    PinList = InterruptList;
     ResourceSource = ACPI_ADD_PTR (char, InterruptList, InterruptLength);
     VendorData = ACPI_ADD_PTR (UINT8, ResourceSource, ResSourceLength);
 
@@ -406,7 +408,7 @@ RsDoGpioIntDescriptor (
 
         case 8: /* Resource Tag (Descriptor Name) */
 
-            UtAttachNamepathToOwner (Op, InitializerOp);
+            UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
             break;
 
         case 9: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */
@@ -437,6 +439,7 @@ RsDoGpioIntDescriptor (
              */
             *InterruptList = (UINT16) InitializerOp->Asl.Value.Integer;
             InterruptList++;
+            PinCount++;
 
             /* Case 10: First interrupt number in list */
 
@@ -465,6 +468,7 @@ RsDoGpioIntDescriptor (
         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
     }
 
+    MpSaveGpioInfo (Info->MappingOp, Descriptor, PinCount, PinList, ResourceSource);
     return (Rnode);
 }
 
@@ -473,9 +477,7 @@ RsDoGpioIntDescriptor (
  *
  * FUNCTION:    RsDoGpioIoDescriptor
  *
- * PARAMETERS:  Op                  - Parent resource descriptor parse node
- *              CurrentByteOffset   - Offset into the resource template AML
- *                                    buffer (to track references to the desc)
+ * PARAMETERS:  Info                - Parse Op and resource template offset
  *
  * RETURN:      Completed resource node
  *
@@ -485,8 +487,7 @@ RsDoGpioIntDescriptor (
 
 ASL_RESOURCE_NODE *
 RsDoGpioIoDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset)
+    ASL_RESOURCE_INFO       *Info)
 {
     AML_RESOURCE            *Descriptor;
     ACPI_PARSE_OBJECT       *InitializerOp;
@@ -494,14 +495,18 @@ RsDoGpioIoDescriptor (
     char                    *ResourceSource = NULL;
     UINT8                   *VendorData = NULL;
     UINT16                  *InterruptList = NULL;
+    UINT16                  *PinList = NULL;
     UINT16                  ResSourceLength;
     UINT16                  VendorLength;
     UINT16                  InterruptLength;
     UINT16                  DescriptorSize;
+    UINT32                  CurrentByteOffset;
+    UINT32                  PinCount = 0;
     UINT32                  i;
 
 
-    InitializerOp = Op->Asl.Child;
+    InitializerOp = Info->DescriptorTypeOp->Asl.Child;
+    CurrentByteOffset = Info->CurrentByteOffset;
 
     /*
      * Calculate lengths for fields that have variable length:
@@ -512,6 +517,7 @@ RsDoGpioIoDescriptor (
     ResSourceLength = RsGetStringDataLength (InitializerOp);
     VendorLength = RsGetBufferDataLength (InitializerOp);
     InterruptLength = RsGetInterruptDataLength (InitializerOp);
+    PinList = InterruptList;
 
     DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_GPIO) +
         ResSourceLength + VendorLength + InterruptLength;
@@ -529,6 +535,7 @@ RsDoGpioIoDescriptor (
     /* Build pointers to optional areas */
 
     InterruptList = ACPI_ADD_PTR (UINT16, Descriptor, sizeof (AML_RESOURCE_GPIO));
+    PinList = InterruptList;
     ResourceSource = ACPI_ADD_PTR (char, InterruptList, InterruptLength);
     VendorData = ACPI_ADD_PTR (UINT8, ResourceSource, ResSourceLength);
 
@@ -612,7 +619,7 @@ RsDoGpioIoDescriptor (
 
         case 8: /* Resource Tag (Descriptor Name) */
 
-            UtAttachNamepathToOwner (Op, InitializerOp);
+            UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
             break;
 
         case 9: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */
@@ -642,6 +649,7 @@ RsDoGpioIoDescriptor (
              */
             *InterruptList = (UINT16) InitializerOp->Asl.Value.Integer;
             InterruptList++;
+            PinCount++;
 
             /* Case 10: First interrupt number in list */
 
@@ -670,6 +678,7 @@ RsDoGpioIoDescriptor (
         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
     }
 
+    MpSaveGpioInfo (Info->MappingOp, Descriptor, PinCount, PinList, ResourceSource);
     return (Rnode);
 }
 
@@ -678,9 +687,7 @@ RsDoGpioIoDescriptor (
  *
  * FUNCTION:    RsDoI2cSerialBusDescriptor
  *
- * PARAMETERS:  Op                  - Parent resource descriptor parse node
- *              CurrentByteOffset   - Offset into the resource template AML
- *                                    buffer (to track references to the desc)
+ * PARAMETERS:  Info                - Parse Op and resource template offset
  *
  * RETURN:      Completed resource node
  *
@@ -690,8 +697,7 @@ RsDoGpioIoDescriptor (
 
 ASL_RESOURCE_NODE *
 RsDoI2cSerialBusDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset)
+    ASL_RESOURCE_INFO       *Info)
 {
     AML_RESOURCE            *Descriptor;
     ACPI_PARSE_OBJECT       *InitializerOp;
@@ -701,10 +707,12 @@ RsDoI2cSerialBusDescriptor (
     UINT16                  ResSourceLength;
     UINT16                  VendorLength;
     UINT16                  DescriptorSize;
+    UINT32                  CurrentByteOffset;
     UINT32                  i;
 
 
-    InitializerOp = Op->Asl.Child;
+    InitializerOp = Info->DescriptorTypeOp->Asl.Child;
+    CurrentByteOffset = Info->CurrentByteOffset;
 
     /*
      * Calculate lengths for fields that have variable length:
@@ -800,7 +808,7 @@ RsDoI2cSerialBusDescriptor (
 
         case 7: /* Resource Tag (Descriptor Name) */
 
-            UtAttachNamepathToOwner (Op, InitializerOp);
+            UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
             break;
 
         case 8: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */
@@ -817,6 +825,7 @@ RsDoI2cSerialBusDescriptor (
         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
     }
 
+    MpSaveSerialInfo (Info->MappingOp, Descriptor, ResourceSource);
     return (Rnode);
 }
 
@@ -825,9 +834,7 @@ RsDoI2cSerialBusDescriptor (
  *
  * FUNCTION:    RsDoSpiSerialBusDescriptor
  *
- * PARAMETERS:  Op                  - Parent resource descriptor parse node
- *              CurrentByteOffset   - Offset into the resource template AML
- *                                    buffer (to track references to the desc)
+ * PARAMETERS:  Info                - Parse Op and resource template offset
  *
  * RETURN:      Completed resource node
  *
@@ -837,8 +844,7 @@ RsDoI2cSerialBusDescriptor (
 
 ASL_RESOURCE_NODE *
 RsDoSpiSerialBusDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset)
+    ASL_RESOURCE_INFO       *Info)
 {
     AML_RESOURCE            *Descriptor;
     ACPI_PARSE_OBJECT       *InitializerOp;
@@ -848,10 +854,12 @@ RsDoSpiSerialBusDescriptor (
     UINT16                  ResSourceLength;
     UINT16                  VendorLength;
     UINT16                  DescriptorSize;
+    UINT32                  CurrentByteOffset;
     UINT32                  i;
 
 
-    InitializerOp = Op->Asl.Child;
+    InitializerOp = Info->DescriptorTypeOp->Asl.Child;
+    CurrentByteOffset = Info->CurrentByteOffset;
 
     /*
      * Calculate lengths for fields that have variable length:
@@ -975,7 +983,7 @@ RsDoSpiSerialBusDescriptor (
 
         case 11: /* Resource Tag (Descriptor Name) */
 
-            UtAttachNamepathToOwner (Op, InitializerOp);
+            UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
             break;
 
         case 12: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */
@@ -992,6 +1000,7 @@ RsDoSpiSerialBusDescriptor (
         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
     }
 
+    MpSaveSerialInfo (Info->MappingOp, Descriptor, ResourceSource);
     return (Rnode);
 }
 
@@ -1000,9 +1009,7 @@ RsDoSpiSerialBusDescriptor (
  *
  * FUNCTION:    RsDoUartSerialBusDescriptor
  *
- * PARAMETERS:  Op                  - Parent resource descriptor parse node
- *              CurrentByteOffset   - Offset into the resource template AML
- *                                    buffer (to track references to the desc)
+ * PARAMETERS:  Info                - Parse Op and resource template offset
  *
  * RETURN:      Completed resource node
  *
@@ -1012,8 +1019,7 @@ RsDoSpiSerialBusDescriptor (
 
 ASL_RESOURCE_NODE *
 RsDoUartSerialBusDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset)
+    ASL_RESOURCE_INFO       *Info)
 {
     AML_RESOURCE            *Descriptor;
     ACPI_PARSE_OBJECT       *InitializerOp;
@@ -1023,10 +1029,12 @@ RsDoUartSerialBusDescriptor (
     UINT16                  ResSourceLength;
     UINT16                  VendorLength;
     UINT16                  DescriptorSize;
+    UINT32                  CurrentByteOffset;
     UINT32                  i;
 
 
-    InitializerOp = Op->Asl.Child;
+    InitializerOp = Info->DescriptorTypeOp->Asl.Child;
+    CurrentByteOffset = Info->CurrentByteOffset;
 
     /*
      * Calculate lengths for fields that have variable length:
@@ -1167,7 +1175,7 @@ RsDoUartSerialBusDescriptor (
 
         case 12: /* Resource Tag (Descriptor Name) */
 
-            UtAttachNamepathToOwner (Op, InitializerOp);
+            UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
             break;
 
         case 13: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */
@@ -1184,5 +1192,6 @@ RsDoUartSerialBusDescriptor (
         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
     }
 
+    MpSaveSerialInfo (Info->MappingOp, Descriptor, ResourceSource);
     return (Rnode);
 }
index 7f58bab..33372d8 100644 (file)
@@ -59,9 +59,7 @@
  *
  * FUNCTION:    RsDoWordIoDescriptor
  *
- * PARAMETERS:  Op                  - Parent resource descriptor parse node
- *              CurrentByteOffset   - Offset into the resource template AML
- *                                    buffer (to track references to the desc)
+ * PARAMETERS:  Info                - Parse Op and resource template offset
  *
  * RETURN:      Completed resource node
  *
@@ -71,8 +69,7 @@
 
 ASL_RESOURCE_NODE *
 RsDoWordIoDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset)
+    ASL_RESOURCE_INFO       *Info)
 {
     AML_RESOURCE            *Descriptor;
     ACPI_PARSE_OBJECT       *InitializerOp;
@@ -84,12 +81,14 @@ RsDoWordIoDescriptor (
     UINT8                   *OptionalFields;
     UINT16                  StringLength = 0;
     UINT32                  OptionIndex = 0;
+    UINT32                  CurrentByteOffset;
     UINT32                  i;
     BOOLEAN                 ResSourceIndex = FALSE;
 
 
-    InitializerOp = Op->Asl.Child;
+    InitializerOp = Info->DescriptorTypeOp->Asl.Child;
     StringLength = RsGetStringDataLength (InitializerOp);
+    CurrentByteOffset = Info->CurrentByteOffset;
 
     Rnode = RsAllocateResourceNode (
                 sizeof (AML_RESOURCE_ADDRESS16) + 1 + StringLength);
@@ -235,7 +234,7 @@ RsDoWordIoDescriptor (
 
         case 12: /* ResourceTag */
 
-            UtAttachNamepathToOwner (Op, InitializerOp);
+            UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
             break;
 
         case 13: /* Type */
@@ -269,10 +268,10 @@ RsDoWordIoDescriptor (
         (UINT64) Descriptor->Address16.AddressLength,
         (UINT64) Descriptor->Address16.Granularity,
         Descriptor->Address16.Flags,
-        MinOp, MaxOp, LengthOp, GranOp, Op);
+        MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
 
     Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) +
-                            OptionIndex + StringLength;
+        OptionIndex + StringLength;
     return (Rnode);
 }
 
@@ -281,9 +280,7 @@ RsDoWordIoDescriptor (
  *
  * FUNCTION:    RsDoWordBusNumberDescriptor
  *
- * PARAMETERS:  Op                  - Parent resource descriptor parse node
- *              CurrentByteOffset   - Offset into the resource template AML
- *                                    buffer (to track references to the desc)
+ * PARAMETERS:  Info                - Parse Op and resource template offset
  *
  * RETURN:      Completed resource node
  *
@@ -293,8 +290,7 @@ RsDoWordIoDescriptor (
 
 ASL_RESOURCE_NODE *
 RsDoWordBusNumberDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset)
+    ASL_RESOURCE_INFO       *Info)
 {
     AML_RESOURCE            *Descriptor;
     ACPI_PARSE_OBJECT       *InitializerOp;
@@ -306,12 +302,14 @@ RsDoWordBusNumberDescriptor (
     UINT8                   *OptionalFields;
     UINT16                  StringLength = 0;
     UINT32                  OptionIndex = 0;
+    UINT32                  CurrentByteOffset;
     UINT32                  i;
     BOOLEAN                 ResSourceIndex = FALSE;
 
 
-    InitializerOp = Op->Asl.Child;
+    InitializerOp = Info->DescriptorTypeOp->Asl.Child;
     StringLength = RsGetStringDataLength (InitializerOp);
+    CurrentByteOffset = Info->CurrentByteOffset;
 
     Rnode = RsAllocateResourceNode (
                 sizeof (AML_RESOURCE_ADDRESS16) + 1 + StringLength);
@@ -455,7 +453,7 @@ RsDoWordBusNumberDescriptor (
 
         case 11: /* ResourceTag */
 
-            UtAttachNamepathToOwner (Op, InitializerOp);
+            UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
             break;
 
         default:
@@ -475,10 +473,10 @@ RsDoWordBusNumberDescriptor (
         (UINT64) Descriptor->Address16.AddressLength,
         (UINT64) Descriptor->Address16.Granularity,
         Descriptor->Address16.Flags,
-        MinOp, MaxOp, LengthOp, GranOp, Op);
+        MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
 
     Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) +
-                            OptionIndex + StringLength;
+        OptionIndex + StringLength;
     return (Rnode);
 }
 
@@ -487,9 +485,7 @@ RsDoWordBusNumberDescriptor (
  *
  * FUNCTION:    RsDoWordSpaceDescriptor
  *
- * PARAMETERS:  Op                  - Parent resource descriptor parse node
- *              CurrentByteOffset   - Offset into the resource template AML
- *                                    buffer (to track references to the desc)
+ * PARAMETERS:  Info                - Parse Op and resource template offset
  *
  * RETURN:      Completed resource node
  *
@@ -499,8 +495,7 @@ RsDoWordBusNumberDescriptor (
 
 ASL_RESOURCE_NODE *
 RsDoWordSpaceDescriptor (
-    ACPI_PARSE_OBJECT       *Op,
-    UINT32                  CurrentByteOffset)
+    ASL_RESOURCE_INFO       *Info)
 {
     AML_RESOURCE            *Descriptor;
     ACPI_PARSE_OBJECT       *InitializerOp;
@@ -512,12 +507,14 @@ RsDoWordSpaceDescriptor (
     UINT8                   *OptionalFields;
     UINT16                  StringLength = 0;
     UINT32                  OptionIndex = 0;
+    UINT32                  CurrentByteOffset;
     UINT32                  i;
     BOOLEAN                 ResSourceIndex = FALSE;
 
 
-    InitializerOp = Op->Asl.Child;
+    InitializerOp = Info->DescriptorTypeOp->Asl.Child;
     StringLength = RsGetStringDataLength (InitializerOp);
+    CurrentByteOffset = Info->CurrentByteOffset;
 
     Rnode = RsAllocateResourceNode (
                 sizeof (AML_RESOURCE_ADDRESS16) + 1 + StringLength);
@@ -672,7 +669,7 @@ RsDoWordSpaceDescriptor (
 
         case 13: /* ResourceTag */
 
-            UtAttachNamepathToOwner (Op, InitializerOp);
+            UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
             break;
 
         default:
@@ -692,9 +689,9 @@ RsDoWordSpaceDescriptor (
         (UINT64) Descriptor->Address16.AddressLength,
         (UINT64) Descriptor->Address16.Granularity,
         Descriptor->Address16.Flags,
-        MinOp, MaxOp, LengthOp, GranOp, Op);
+        MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
 
     Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) +
-                            OptionIndex + StringLength;
+        OptionIndex + StringLength;
     return (Rnode);
 }
index 2bc48db..7c47eb3 100644 (file)
@@ -92,6 +92,149 @@ DefinitionBlockTerm
             '{' TermList '}'        {$$ = TrLinkChildren ($<n>3,7,$4,$6,$8,$10,$12,$14,$18);}
     ;
 
+    /*
+     * ASL Extensions: C-style math/logical operators and expressions.
+     * The implementation transforms these operators into the standard
+     * AML opcodes and syntax.
+     *
+     * Supported operators and precedence rules (high-to-low)
+     *
+     * NOTE: The operator precedence and associativity rules are
+     * implemented by the tokens in asltokens.y
+     *
+     * (left-to-right):
+     *  1)      ( ) expr++ expr--
+     *
+     * (right-to-left):
+     *  2)      ! ~
+     *
+     * (left-to-right):
+     *  3)      *   /   %
+     *  4)      +   -
+     *  5)      >>  <<
+     *  6)      <   >   <=  >=
+     *  7)      ==  !=
+     *  8)      &
+     *  9)      ^
+     *  10)     |
+     *  11)     &&
+     *  12)     ||
+     *
+     * (right-to-left):
+     *  13)     = += -= *= /= %= <<= >>= &= ^= |=
+     */
+Expression
+
+    /* Unary operators */
+
+    : PARSEOP_EXP_LOGICAL_NOT           {$<n>$ = TrCreateLeafNode (PARSEOP_LNOT);}
+        TermArg                         {$$ = TrLinkChildren ($<n>2,1,$3);}
+    | PARSEOP_EXP_NOT                   {$<n>$ = TrCreateLeafNode (PARSEOP_NOT);}
+        TermArg                         {$$ = TrLinkChildren ($<n>2,2,$3,TrCreateLeafNode (PARSEOP_ZERO));}
+
+    | SuperName PARSEOP_EXP_INCREMENT   {$<n>$ = TrCreateLeafNode (PARSEOP_INCREMENT);}
+                                        {$$ = TrLinkChildren ($<n>3,1,$1);}
+    | SuperName PARSEOP_EXP_DECREMENT   {$<n>$ = TrCreateLeafNode (PARSEOP_DECREMENT);}
+                                        {$$ = TrLinkChildren ($<n>3,1,$1);}
+
+    /* Binary operators: math and logical */
+
+    | TermArg PARSEOP_EXP_ADD           {$<n>$ = TrCreateLeafNode (PARSEOP_ADD);}
+        TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateLeafNode (PARSEOP_ZERO));}
+    | TermArg PARSEOP_EXP_DIVIDE        {$<n>$ = TrCreateLeafNode (PARSEOP_DIVIDE);}
+        TermArg                         {$$ = TrLinkChildren ($<n>3,4,$1,$4,TrCreateLeafNode (PARSEOP_ZERO),
+                                            TrCreateLeafNode (PARSEOP_ZERO));}
+    | TermArg PARSEOP_EXP_MODULO        {$<n>$ = TrCreateLeafNode (PARSEOP_MOD);}
+        TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateLeafNode (PARSEOP_ZERO));}
+    | TermArg PARSEOP_EXP_MULTIPLY      {$<n>$ = TrCreateLeafNode (PARSEOP_MULTIPLY);}
+        TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateLeafNode (PARSEOP_ZERO));}
+    | TermArg PARSEOP_EXP_SHIFT_LEFT    {$<n>$ = TrCreateLeafNode (PARSEOP_SHIFTLEFT);}
+        TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateLeafNode (PARSEOP_ZERO));}
+    | TermArg PARSEOP_EXP_SHIFT_RIGHT   {$<n>$ = TrCreateLeafNode (PARSEOP_SHIFTRIGHT);}
+        TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateLeafNode (PARSEOP_ZERO));}
+    | TermArg PARSEOP_EXP_SUBTRACT      {$<n>$ = TrCreateLeafNode (PARSEOP_SUBTRACT);}
+        TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateLeafNode (PARSEOP_ZERO));}
+
+    | TermArg PARSEOP_EXP_AND           {$<n>$ = TrCreateLeafNode (PARSEOP_AND);}
+        TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateLeafNode (PARSEOP_ZERO));}
+    | TermArg PARSEOP_EXP_OR            {$<n>$ = TrCreateLeafNode (PARSEOP_OR);}
+        TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateLeafNode (PARSEOP_ZERO));}
+    | TermArg PARSEOP_EXP_XOR           {$<n>$ = TrCreateLeafNode (PARSEOP_XOR);}
+        TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateLeafNode (PARSEOP_ZERO));}
+
+    | TermArg PARSEOP_EXP_GREATER       {$<n>$ = TrCreateLeafNode (PARSEOP_LGREATER);}
+        TermArg                         {$$ = TrLinkChildren ($<n>3,2,$1,$4);}
+    | TermArg PARSEOP_EXP_GREATER_EQUAL {$<n>$ = TrCreateLeafNode (PARSEOP_LGREATEREQUAL);}
+        TermArg                         {$$ = TrLinkChildren ($<n>3,2,$1,$4);}
+    | TermArg PARSEOP_EXP_LESS          {$<n>$ = TrCreateLeafNode (PARSEOP_LLESS);}
+        TermArg                         {$$ = TrLinkChildren ($<n>3,2,$1,$4);}
+    | TermArg PARSEOP_EXP_LESS_EQUAL    {$<n>$ = TrCreateLeafNode (PARSEOP_LLESSEQUAL);}
+        TermArg                         {$$ = TrLinkChildren ($<n>3,2,$1,$4);}
+
+    | TermArg PARSEOP_EXP_EQUAL         {$<n>$ = TrCreateLeafNode (PARSEOP_LEQUAL);}
+        TermArg                         {$$ = TrLinkChildren ($<n>3,2,$1,$4);}
+    | TermArg PARSEOP_EXP_NOT_EQUAL     {$<n>$ = TrCreateLeafNode (PARSEOP_LNOTEQUAL);}
+        TermArg                         {$$ = TrLinkChildren ($<n>3,2,$1,$4);}
+
+    | TermArg PARSEOP_EXP_LOGICAL_AND   {$<n>$ = TrCreateLeafNode (PARSEOP_LAND);}
+        TermArg                         {$$ = TrLinkChildren ($<n>3,2,$1,$4);}
+    | TermArg PARSEOP_EXP_LOGICAL_OR    {$<n>$ = TrCreateLeafNode (PARSEOP_LOR);}
+        TermArg                         {$$ = TrLinkChildren ($<n>3,2,$1,$4);}
+
+      /* Parentheses */
+
+    | '(' TermArg ')'                   { $$ = $2;}
+    ;
+
+EqualsTerm
+
+    /* All assignment-type operations */
+
+    : SuperName PARSEOP_EXP_EQUALS
+        TermArg                         {$$ = TrCreateAssignmentNode ($1, $3);}
+
+    | TermArg PARSEOP_EXP_ADD_EQ        {$<n>$ = TrCreateLeafNode (PARSEOP_ADD);}
+        TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4,
+                                            TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));}
+
+    | TermArg PARSEOP_EXP_DIV_EQ        {$<n>$ = TrCreateLeafNode (PARSEOP_DIVIDE);}
+        TermArg                         {$$ = TrLinkChildren ($<n>3,4,$1,$4,TrCreateLeafNode (PARSEOP_ZERO),
+                                            TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));}
+
+    | TermArg PARSEOP_EXP_MOD_EQ        {$<n>$ = TrCreateLeafNode (PARSEOP_MOD);}
+        TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4,
+                                            TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));}
+
+    | TermArg PARSEOP_EXP_MUL_EQ        {$<n>$ = TrCreateLeafNode (PARSEOP_MULTIPLY);}
+        TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4,
+                                            TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));}
+
+    | TermArg PARSEOP_EXP_SHL_EQ        {$<n>$ = TrCreateLeafNode (PARSEOP_SHIFTLEFT);}
+        TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4,
+                                            TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));}
+
+    | TermArg PARSEOP_EXP_SHR_EQ        {$<n>$ = TrCreateLeafNode (PARSEOP_SHIFTRIGHT);}
+        TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4,
+                                            TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));}
+
+    | TermArg PARSEOP_EXP_SUB_EQ        {$<n>$ = TrCreateLeafNode (PARSEOP_SUBTRACT);}
+        TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4,
+                                            TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));}
+
+    | TermArg PARSEOP_EXP_AND_EQ        {$<n>$ = TrCreateLeafNode (PARSEOP_AND);}
+        TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4,
+                                            TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));}
+
+    | TermArg PARSEOP_EXP_OR_EQ         {$<n>$ = TrCreateLeafNode (PARSEOP_OR);}
+        TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4,
+                                            TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));}
+
+    | TermArg PARSEOP_EXP_XOR_EQ        {$<n>$ = TrCreateLeafNode (PARSEOP_XOR);}
+        TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4,
+                                            TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));}
+    ;
+
+
 /* ACPI 3.0 -- allow semicolons between terms */
 
 TermList
@@ -104,6 +247,7 @@ TermList
 
 Term
     : Object                        {}
+    | Expression                    {}
     | Type1Opcode                   {}
     | Type2Opcode                   {}
     | Type2IntegerOpcode            {}
@@ -211,7 +355,8 @@ Removed from TermArg due to reduce/reduce conflicts
 */
 
 TermArg
-    : Type2Opcode                   {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
+    : Expression                    {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
+    | Type2Opcode                   {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
     | DataObject                    {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
     | NameString                    {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
     | ArgTerm                       {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
@@ -305,6 +450,7 @@ Type2Opcode
     | RefOfTerm                     {}
     | SizeOfTerm                    {}
     | StoreTerm                     {}
+    | EqualsTerm                    {}
     | TimerTerm                     {}
     | WaitTerm                      {}
     | UserTerm                      {}
@@ -362,6 +508,8 @@ Type2BufferOpcode                   /* "Type5" Opcodes */
 
 Type2BufferOrStringOpcode
     : ConcatTerm                    {}
+    | PrintfTerm                    {}
+    | FprintfTerm                   {}
     | MidTerm                       {}
     ;
 
@@ -387,6 +535,7 @@ Type4Opcode
 Type5Opcode
     : ResourceTemplateTerm          {}
     | UnicodeTerm                   {}
+    | ToPLDTerm                     {}
     | ToUUIDTerm                    {}
     ;
 
@@ -1370,6 +1519,86 @@ ToIntegerTerm
         error ')'                   {$$ = AslDoError(); yyclearin;}
     ;
 
+PldKeyword
+    : PARSEOP_PLD_REVISION          {$$ = TrCreateLeafNode (PARSEOP_PLD_REVISION);}
+    | PARSEOP_PLD_IGNORECOLOR       {$$ = TrCreateLeafNode (PARSEOP_PLD_IGNORECOLOR);}
+    | PARSEOP_PLD_RED               {$$ = TrCreateLeafNode (PARSEOP_PLD_RED);}
+    | PARSEOP_PLD_GREEN             {$$ = TrCreateLeafNode (PARSEOP_PLD_GREEN);}
+    | PARSEOP_PLD_BLUE              {$$ = TrCreateLeafNode (PARSEOP_PLD_BLUE);}
+    | PARSEOP_PLD_WIDTH             {$$ = TrCreateLeafNode (PARSEOP_PLD_WIDTH);}
+    | PARSEOP_PLD_HEIGHT            {$$ = TrCreateLeafNode (PARSEOP_PLD_HEIGHT);}
+    | PARSEOP_PLD_USERVISIBLE       {$$ = TrCreateLeafNode (PARSEOP_PLD_USERVISIBLE);}
+    | PARSEOP_PLD_DOCK              {$$ = TrCreateLeafNode (PARSEOP_PLD_DOCK);}
+    | PARSEOP_PLD_LID               {$$ = TrCreateLeafNode (PARSEOP_PLD_LID);}
+    | PARSEOP_PLD_PANEL             {$$ = TrCreateLeafNode (PARSEOP_PLD_PANEL);}
+    | PARSEOP_PLD_VERTICALPOSITION  {$$ = TrCreateLeafNode (PARSEOP_PLD_VERTICALPOSITION);}
+    | PARSEOP_PLD_HORIZONTALPOSITION {$$ = TrCreateLeafNode (PARSEOP_PLD_HORIZONTALPOSITION);}
+    | PARSEOP_PLD_SHAPE             {$$ = TrCreateLeafNode (PARSEOP_PLD_SHAPE);}
+    | PARSEOP_PLD_GROUPORIENTATION  {$$ = TrCreateLeafNode (PARSEOP_PLD_GROUPORIENTATION);}
+    | PARSEOP_PLD_GROUPTOKEN        {$$ = TrCreateLeafNode (PARSEOP_PLD_GROUPTOKEN);}
+    | PARSEOP_PLD_GROUPPOSITION     {$$ = TrCreateLeafNode (PARSEOP_PLD_GROUPPOSITION);}
+    | PARSEOP_PLD_BAY               {$$ = TrCreateLeafNode (PARSEOP_PLD_BAY);}
+    | PARSEOP_PLD_EJECTABLE         {$$ = TrCreateLeafNode (PARSEOP_PLD_EJECTABLE);}
+    | PARSEOP_PLD_EJECTREQUIRED     {$$ = TrCreateLeafNode (PARSEOP_PLD_EJECTREQUIRED);}
+    | PARSEOP_PLD_CABINETNUMBER     {$$ = TrCreateLeafNode (PARSEOP_PLD_CABINETNUMBER);}
+    | PARSEOP_PLD_CARDCAGENUMBER    {$$ = TrCreateLeafNode (PARSEOP_PLD_CARDCAGENUMBER);}
+    | PARSEOP_PLD_REFERENCE         {$$ = TrCreateLeafNode (PARSEOP_PLD_REFERENCE);}
+    | PARSEOP_PLD_ROTATION          {$$ = TrCreateLeafNode (PARSEOP_PLD_ROTATION);}
+    | PARSEOP_PLD_ORDER             {$$ = TrCreateLeafNode (PARSEOP_PLD_ORDER);}
+    | PARSEOP_PLD_RESERVED          {$$ = TrCreateLeafNode (PARSEOP_PLD_RESERVED);}
+    | PARSEOP_PLD_VERTICALOFFSET    {$$ = TrCreateLeafNode (PARSEOP_PLD_VERTICALOFFSET);}
+    | PARSEOP_PLD_HORIZONTALOFFSET  {$$ = TrCreateLeafNode (PARSEOP_PLD_HORIZONTALOFFSET);}
+    ;
+
+PldKeywordList
+    :                               {$$ = NULL;}
+    | PldKeyword
+        PARSEOP_EXP_EQUALS Integer  {$$ = TrLinkChildren ($1,1,$3);}
+    | PldKeyword
+        PARSEOP_EXP_EQUALS String   {$$ = TrLinkChildren ($1,1,$3);}
+    | PldKeywordList ','            /* Allows a trailing comma at list end */
+    | PldKeywordList ','
+        PldKeyword
+        PARSEOP_EXP_EQUALS Integer  {$$ = TrLinkPeerNode ($1,TrLinkChildren ($3,1,$5));}
+    | PldKeywordList ','
+        PldKeyword
+        PARSEOP_EXP_EQUALS String   {$$ = TrLinkPeerNode ($1,TrLinkChildren ($3,1,$5));}
+    ;
+
+ToPLDTerm
+    : PARSEOP_TOPLD '('             {$<n>$ = TrCreateLeafNode (PARSEOP_TOPLD);}
+        PldKeywordList
+        ')'                         {$$ = TrLinkChildren ($<n>3,1,$4);}
+    | PARSEOP_TOPLD '('
+        error ')'                   {$$ = AslDoError(); yyclearin;}
+    ;
+
+PrintfArgList
+    :                               {$$ = NULL;}
+    | TermArg                       {$$ = $1;}
+    | PrintfArgList ','
+       TermArg                      {$$ = TrLinkPeerNode ($1, $3);}
+    ;
+
+PrintfTerm
+    : PARSEOP_PRINTF '('            {$<n>$ = TrCreateLeafNode (PARSEOP_PRINTF);}
+        StringData
+        PrintfArgList
+        ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);}
+    | PARSEOP_PRINTF '('
+        error ')'                   {$$ = AslDoError(); yyclearin;}
+    ;
+
+FprintfTerm
+    : PARSEOP_FPRINTF '('            {$<n>$ = TrCreateLeafNode (PARSEOP_FPRINTF);}
+        TermArg ','
+        StringData
+        PrintfArgList
+        ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$6,$7);}
+    | PARSEOP_FPRINTF '('
+        error ')'                   {$$ = AslDoError(); yyclearin;}
+    ;
+
 ToStringTerm
     : PARSEOP_TOSTRING '('          {$<n>$ = TrCreateLeafNode (PARSEOP_TOSTRING);}
         TermArg