Sync ACPICA with Intel's version 20151124.
authorSascha Wildner <saw@online.de>
Wed, 25 Nov 2015 19:16:38 +0000 (20:16 +0100)
committerSascha Wildner <saw@online.de>
Wed, 25 Nov 2015 19:16:38 +0000 (20:16 +0100)
* Silence warnings about non-existant _Sx methods because they are
  optional. In fact, we already had a fix for this from sephe
  (671882eba43).

* Fixed bugs in FADT handling and auto-serialization.

* Removed support for _SUB in AcpiGetObjectInfo because it caused
  errors due to not fully initialized operation regions.

* Fixed issues with terminate/quit/exit commands in the debugger.
  Also thread ID support was added to the debugger.

* Allow multiple definitions blocks in ASL/AML files for iasl,
  acpiexec and acpixtract.

* Enhanced type checking for Name() in iasl. Also indent fixes for
  -ic and -ia.

* Additional error message for attempting to open a Scope() on an
  object defined in an SSDT.

* Improved formatting.

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

285 files changed:
sys/conf/files
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/acpinames/Makefile
sys/contrib/dev/acpica/generate/unix/acpixtract/Makefile
sys/contrib/dev/acpica/generate/unix/iasl/Makefile
sys/contrib/dev/acpica/source/common/acfileio.c [new file with mode: 0644]
sys/contrib/dev/acpica/source/common/acgetline.c
sys/contrib/dev/acpica/source/common/adisasm.c
sys/contrib/dev/acpica/source/common/adwalk.c
sys/contrib/dev/acpica/source/common/ahuuids.c
sys/contrib/dev/acpica/source/common/dmextern.c
sys/contrib/dev/acpica/source/common/dmrestag.c
sys/contrib/dev/acpica/source/common/dmtable.c
sys/contrib/dev/acpica/source/common/dmtables.c [new file with mode: 0644]
sys/contrib/dev/acpica/source/common/dmtbdump.c
sys/contrib/dev/acpica/source/common/getopt.c
sys/contrib/dev/acpica/source/compiler/aslanalyze.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.l
sys/contrib/dev/acpica/source/compiler/aslerror.c
sys/contrib/dev/acpica/source/compiler/aslfileio.c
sys/contrib/dev/acpica/source/compiler/aslfiles.c
sys/contrib/dev/acpica/source/compiler/aslfold.c
sys/contrib/dev/acpica/source/compiler/aslhex.c
sys/contrib/dev/acpica/source/compiler/asllength.c
sys/contrib/dev/acpica/source/compiler/asllisting.c
sys/contrib/dev/acpica/source/compiler/asllistsup.c
sys/contrib/dev/acpica/source/compiler/aslload.c
sys/contrib/dev/acpica/source/compiler/aslmap.c
sys/contrib/dev/acpica/source/compiler/aslmapenter.c
sys/contrib/dev/acpica/source/compiler/aslmapoutput.c
sys/contrib/dev/acpica/source/compiler/aslmessages.c
sys/contrib/dev/acpica/source/compiler/aslmessages.h
sys/contrib/dev/acpica/source/compiler/aslmethod.c
sys/contrib/dev/acpica/source/compiler/aslnamesp.c
sys/contrib/dev/acpica/source/compiler/aslopcodes.c
sys/contrib/dev/acpica/source/compiler/asloperands.c
sys/contrib/dev/acpica/source/compiler/aslopt.c
sys/contrib/dev/acpica/source/compiler/asloptions.c
sys/contrib/dev/acpica/source/compiler/aslpredef.c
sys/contrib/dev/acpica/source/compiler/aslprepkg.c
sys/contrib/dev/acpica/source/compiler/aslprune.c
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/aslstubs.c
sys/contrib/dev/acpica/source/compiler/asltokens.y
sys/contrib/dev/acpica/source/compiler/asltransform.c
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/aslutils.c
sys/contrib/dev/acpica/source/compiler/asluuid.c
sys/contrib/dev/acpica/source/compiler/aslxref.c
sys/contrib/dev/acpica/source/compiler/dtcompile.c
sys/contrib/dev/acpica/source/compiler/dtcompiler.h
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/dttable.c
sys/contrib/dev/acpica/source/compiler/dttable1.c [new file with mode: 0644]
sys/contrib/dev/acpica/source/compiler/dttable2.c [new file with mode: 0644]
sys/contrib/dev/acpica/source/compiler/dttemplate.c
sys/contrib/dev/acpica/source/compiler/prexpress.c
sys/contrib/dev/acpica/source/compiler/prmacros.c
sys/contrib/dev/acpica/source/compiler/prscan.c
sys/contrib/dev/acpica/source/compiler/prutils.c
sys/contrib/dev/acpica/source/components/debugger/dbcmds.c
sys/contrib/dev/acpica/source/components/debugger/dbconvert.c
sys/contrib/dev/acpica/source/components/debugger/dbdisply.c
sys/contrib/dev/acpica/source/components/debugger/dbexec.c
sys/contrib/dev/acpica/source/components/debugger/dbfileio.c
sys/contrib/dev/acpica/source/components/debugger/dbinput.c
sys/contrib/dev/acpica/source/components/debugger/dbmethod.c
sys/contrib/dev/acpica/source/components/debugger/dbnames.c
sys/contrib/dev/acpica/source/components/debugger/dbobject.c
sys/contrib/dev/acpica/source/components/debugger/dbstats.c
sys/contrib/dev/acpica/source/components/debugger/dbtest.c
sys/contrib/dev/acpica/source/components/debugger/dbutils.c
sys/contrib/dev/acpica/source/components/debugger/dbxface.c
sys/contrib/dev/acpica/source/components/disassembler/dmbuffer.c
sys/contrib/dev/acpica/source/components/disassembler/dmcstyle.c
sys/contrib/dev/acpica/source/components/disassembler/dmdeferred.c
sys/contrib/dev/acpica/source/components/disassembler/dmnames.c
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/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/dsdebug.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/evevent.c
sys/contrib/dev/acpica/source/components/events/evglock.c
sys/contrib/dev/acpica/source/components/events/evgpe.c
sys/contrib/dev/acpica/source/components/events/evgpeblk.c
sys/contrib/dev/acpica/source/components/events/evgpeinit.c
sys/contrib/dev/acpica/source/components/events/evgpeutil.c
sys/contrib/dev/acpica/source/components/events/evhandler.c
sys/contrib/dev/acpica/source/components/events/evmisc.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/evsci.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/extrace.c [copied from sys/contrib/dev/acpica/source/components/executer/exdebug.c with 57% similarity]
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/hwesleep.c
sys/contrib/dev/acpica/source/components/hardware/hwgpe.c
sys/contrib/dev/acpica/source/components/hardware/hwregs.c
sys/contrib/dev/acpica/source/components/hardware/hwsleep.c
sys/contrib/dev/acpica/source/components/hardware/hwxface.c
sys/contrib/dev/acpica/source/components/hardware/hwxfsleep.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/nsarguments.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/nsprepkg.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/psloop.c
sys/contrib/dev/acpica/source/components/parser/psobject.c
sys/contrib/dev/acpica/source/components/parser/psparse.c
sys/contrib/dev/acpica/source/components/parser/psscope.c
sys/contrib/dev/acpica/source/components/parser/psutils.c
sys/contrib/dev/acpica/source/components/parser/pswalk.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/rslist.c
sys/contrib/dev/acpica/source/components/resources/rsmisc.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/utcache.c
sys/contrib/dev/acpica/source/components/utilities/utcopy.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/utfileio.c [deleted file]
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/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/utnonansi.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/utprint.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/utxfmutex.c
sys/contrib/dev/acpica/source/include/acapps.h
sys/contrib/dev/acpica/source/include/acdebug.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/acmacros.h
sys/contrib/dev/acpica/source/include/acpiosxf.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/acutils.h
sys/contrib/dev/acpica/source/include/platform/aclinux.h
sys/contrib/dev/acpica/source/include/platform/aclinuxex.h
sys/contrib/dev/acpica/source/os_specific/service_layers/oslibcfs.c
sys/contrib/dev/acpica/source/os_specific/service_layers/oswindir.c
sys/contrib/dev/acpica/source/os_specific/service_layers/oswinxf.c
sys/contrib/dev/acpica/source/tools/acpibin/abcompare.c
sys/contrib/dev/acpica/source/tools/acpidump/apfiles.c
sys/contrib/dev/acpica/source/tools/acpiexec/aecommon.h
sys/contrib/dev/acpica/source/tools/acpiexec/aeexec.c
sys/contrib/dev/acpica/source/tools/acpiexec/aehandlers.c
sys/contrib/dev/acpica/source/tools/acpiexec/aemain.c
sys/contrib/dev/acpica/source/tools/acpiexec/aeregion.c
sys/contrib/dev/acpica/source/tools/acpiexec/aetables.c
sys/contrib/dev/acpica/source/tools/acpihelp/ahdecode.c
sys/contrib/dev/acpica/source/tools/acpinames/acpinames.h
sys/contrib/dev/acpica/source/tools/acpinames/anmain.c
sys/contrib/dev/acpica/source/tools/acpinames/antables.c
sys/contrib/dev/acpica/source/tools/acpisrc/ascase.c
sys/contrib/dev/acpica/source/tools/acpisrc/asconvrt.c
sys/contrib/dev/acpica/source/tools/acpisrc/asfile.c
sys/contrib/dev/acpica/source/tools/acpisrc/asmain.c
sys/contrib/dev/acpica/source/tools/acpisrc/asremove.c
sys/contrib/dev/acpica/source/tools/acpisrc/astable.c
sys/contrib/dev/acpica/source/tools/acpixtract/acpixtract.c
sys/contrib/dev/acpica/source/tools/acpixtract/acpixtract.h [new file with mode: 0644]
sys/contrib/dev/acpica/source/tools/acpixtract/axmain.c
sys/contrib/dev/acpica/source/tools/acpixtract/axutils.c [new file with mode: 0644]
sys/contrib/dev/acpica/source/tools/examples/examples.c
sys/dev/acpica/Makefile
sys/dev/acpica/Osd/OsdDebug.c
sys/dev/acpica/Osd/OsdSchedule.c
usr.sbin/acpi/acpiexec/Makefile
usr.sbin/acpi/acpinames/Makefile
usr.sbin/acpi/acpixtract/Makefile
usr.sbin/acpi/acpixtract/acpixtract.8
usr.sbin/acpi/iasl/Makefile

index 5445a32..06fd1c1 100644 (file)
@@ -2312,6 +2312,7 @@ ${ACPICA_COMP_DIR}/executer/exstore.c             optional acpi
 ${ACPICA_COMP_DIR}/executer/exstoren.c         optional acpi
 ${ACPICA_COMP_DIR}/executer/exstorob.c         optional acpi
 ${ACPICA_COMP_DIR}/executer/exsystem.c         optional acpi
+${ACPICA_COMP_DIR}/executer/extrace.c          optional acpi
 ${ACPICA_COMP_DIR}/executer/exutils.c          optional acpi
 ${ACPICA_COMP_DIR}/hardware/hwacpi.c           optional acpi
 ${ACPICA_COMP_DIR}/hardware/hwesleep.c         optional acpi
index 78a19ea..f995856 100644 (file)
@@ -1,3 +1,84 @@
+----------------------------------------
+24 November 2015. Summary of changes for version 20151124:
+
+This release is available at https://acpica.org/downloads
+
+
+1) ACPICA kernel-resident subsystem:
+
+Fixed a possible regression for a previous update to FADT handling. The 
+FADT no longer has a fixed table ID, causing some issues with code that 
+was hardwired to a specific ID. Lv Zheng.
+
+Fixed a problem where the method auto-serialization could interfere with 
+the current SyncLevel. This change makes the auto-serialization support 
+transparent to the SyncLevel support and management.
+
+Removed support for the _SUB predefined name in AcpiGetObjectInfo. This 
+interface is intended for early access to the namespace during the 
+initial namespace device discovery walk. The _SUB method has been seen to 
+access operation regions in some cases, causing errors because the 
+operation regions are not fully initialized.
+
+AML Debugger: Fixed some issues with the terminate/quit/exit commands 
+that can cause faults. Lv Zheng.
+
+AML Debugger: Add thread ID support so that single-step mode only applies 
+to the AML Debugger thread. This prevents runtime errors within some 
+kernels. Lv Zheng. 
+
+Eliminated extraneous warnings from AcpiGetSleepTypeData. Since the _Sx 
+methods that are invoked by this interface are optional, removed warnings 
+emitted for the case where one or more of these methods do not exist. 
+ACPICA BZ 1208, original change by Prarit Bhargava.
+
+Made a major pass through the entire ACPICA source code base to 
+standardize formatting that has diverged a bit over time. There are no 
+functional changes, but this will of course cause quite a few code 
+differences from the previous ACPICA release.
+
+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: 102.0K Code, 28.3K Data, 130.3K Total
+    Debug Version:     199.6K Code, 81.8K Data, 281.4K Total
+  Previous Release:
+    Non-Debug Version: 101.7K Code, 27.9K Data, 129.6K Total
+    Debug Version:     199.3K Code, 81.4K Data, 280.7K Total
+
+
+2) iASL Compiler/Disassembler and Tools:
+
+iASL/acpiexec/acpixtract/disassembler: Added support to allow multiple 
+definition blocks within a single ASL file and the resulting AML file. 
+Support for this type of file was also added to the various tools that 
+use binary AML files: acpiexec, acpixtract, and the AML disassembler. The 
+example code below shows two definition blocks within the same file:
+
+    DefinitionBlock ("dsdt.aml", "DSDT", 2, "Intel", "Template", 
+0x12345678)
+    {
+    }
+    DefinitionBlock ("", "SSDT", 2, "Intel", "Template", 0xABCDEF01)
+    {
+    }
+
+iASL: Enhanced typechecking for the Name() operator. All expressions for 
+the value of the named object must be reduced/folded to a single constant 
+at compile time, as per the ACPI specification (the AML definition of 
+Name()).
+
+iASL: Fixed some code indentation issues for the -ic and -ia options (C 
+and assembly headers). Now all emitted code correctly begins in column 1.
+
+iASL: Added an error message for an attempt to open a Scope() on an 
+object defined in an SSDT. The DSDT is always loaded into the namespace 
+first, so any attempt to open a Scope on an SSDT object will fail at 
+runtime.
+
 ----------------------------------------
 30 September 2015. Summary of changes for version 20150930:
 
index 397c4d4..7d9daf3 100644 (file)
@@ -82,6 +82,7 @@ OBJECTS = \
        $(OBJDIR)/exstoren.o\
        $(OBJDIR)/exstorob.o\
        $(OBJDIR)/exsystem.o\
+       $(OBJDIR)/extrace.o\
        $(OBJDIR)/exutils.o\
        $(OBJDIR)/hwpci.o\
        $(OBJDIR)/nsaccess.o\
index 6fa25e8..384089c 100644 (file)
@@ -40,6 +40,7 @@ HEADERS = \
 
 OBJECTS = \
        $(OBJDIR)/acgetline.o\
+       $(OBJDIR)/acfileio.o\
        $(OBJDIR)/aeexec.o\
        $(OBJDIR)/aehandlers.o\
        $(OBJDIR)/aeinitfile.o\
@@ -127,6 +128,7 @@ OBJECTS = \
        $(OBJDIR)/exstoren.o\
        $(OBJDIR)/exstorob.o\
        $(OBJDIR)/exsystem.o\
+       $(OBJDIR)/extrace.o\
        $(OBJDIR)/exutils.o\
        $(OBJDIR)/getopt.o\
        $(OBJDIR)/hwacpi.o\
@@ -207,7 +209,6 @@ OBJECTS = \
        $(OBJDIR)/uterror.o\
        $(OBJDIR)/uteval.o\
        $(OBJDIR)/utexcep.o\
-       $(OBJDIR)/utfileio.o\
        $(OBJDIR)/utglobal.o\
        $(OBJDIR)/uthex.o\
        $(OBJDIR)/utids.o\
index 10e4fef..7457b1b 100644 (file)
@@ -34,6 +34,7 @@ HEADERS = \
     $(wildcard $(ACPINAMES)/*.h)
 
 OBJECTS = \
+       $(OBJDIR)/acfileio.o\
        $(OBJDIR)/anmain.o\
        $(OBJDIR)/anstubs.o\
        $(OBJDIR)/antables.o\
@@ -103,7 +104,6 @@ OBJECTS = \
        $(OBJDIR)/uterror.o\
        $(OBJDIR)/uteval.o\
        $(OBJDIR)/utexcep.o\
-       $(OBJDIR)/utfileio.o\
        $(OBJDIR)/utglobal.o\
        $(OBJDIR)/uthex.o\
        $(OBJDIR)/utids.o\
index 8bad158..58722e8 100644 (file)
@@ -29,6 +29,7 @@ HEADERS = \
 OBJECTS = \
     $(OBJDIR)/acpixtract.o\
     $(OBJDIR)/axmain.o\
+    $(OBJDIR)/axutils.o\
     $(OBJDIR)/getopt.o\
     $(OBJDIR)/oslibcfs.o\
     $(OBJDIR)/osunixxf.o\
index 14c894e..8b71edd 100644 (file)
@@ -43,6 +43,7 @@ OBJECTS = \
        $(OBJDIR)/dtparserparse.o\
        $(OBJDIR)/prparserlex.o\
        $(OBJDIR)/prparserparse.o\
+       $(OBJDIR)/acfileio.o\
        $(OBJDIR)/adfile.o\
        $(OBJDIR)/adisasm.o\
        $(OBJDIR)/adwalk.o\
@@ -113,6 +114,7 @@ OBJECTS = \
        $(OBJDIR)/dmresrcs.o\
        $(OBJDIR)/dmrestag.o\
        $(OBJDIR)/dmtable.o\
+       $(OBJDIR)/dmtables.o\
        $(OBJDIR)/dmtbdump.o\
        $(OBJDIR)/dmtbinfo.o\
        $(OBJDIR)/dmutils.o\
@@ -134,6 +136,8 @@ OBJECTS = \
        $(OBJDIR)/dtio.o\
        $(OBJDIR)/dtsubtable.o\
        $(OBJDIR)/dttable.o\
+       $(OBJDIR)/dttable1.o\
+       $(OBJDIR)/dttable2.o\
        $(OBJDIR)/dttemplate.o\
        $(OBJDIR)/dtutils.o\
        $(OBJDIR)/exconvrt.o\
@@ -189,6 +193,7 @@ OBJECTS = \
        $(OBJDIR)/tbprint.o\
        $(OBJDIR)/tbutils.o\
        $(OBJDIR)/tbxface.o\
+       $(OBJDIR)/tbxfload.o\
        $(OBJDIR)/utaddress.o\
        $(OBJDIR)/utalloc.o\
        $(OBJDIR)/utbuffer.o\
@@ -199,7 +204,6 @@ OBJECTS = \
        $(OBJDIR)/utdelete.o\
        $(OBJDIR)/uterror.o\
        $(OBJDIR)/utexcep.o\
-       $(OBJDIR)/utfileio.o\
        $(OBJDIR)/utglobal.o\
        $(OBJDIR)/uthex.o\
        $(OBJDIR)/utinit.o\
diff --git a/sys/contrib/dev/acpica/source/common/acfileio.c b/sys/contrib/dev/acpica/source/common/acfileio.c
new file mode 100644 (file)
index 0000000..b94adf8
--- /dev/null
@@ -0,0 +1,357 @@
+/******************************************************************************
+ *
+ * Module Name: acfileio - Get ACPI tables from file
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2015, 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 "actables.h"
+#include "acutils.h"
+#include <errno.h>
+
+#define _COMPONENT          ACPI_UTILITIES
+        ACPI_MODULE_NAME    ("acfileio")
+
+
+/* Local prototypes */
+
+static ACPI_STATUS
+AcpiAcGetOneTableFromFile (
+    char                    *Filename,
+    FILE                    *File,
+    UINT8                   GetOnlyAmlTables,
+    ACPI_TABLE_HEADER       **Table);
+
+static ACPI_STATUS
+AcpiAcCheckTextModeCorruption (
+    ACPI_TABLE_HEADER       *Table);
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiAcGetAllTablesFromFile
+ *
+ * PARAMETERS:  Filename            - Table filename
+ *              GetOnlyAmlTables    - TRUE if the tables must be AML tables
+ *              ReturnListHead      - Where table list is returned
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Get all ACPI tables from within a single file.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiAcGetAllTablesFromFile (
+    char                    *Filename,
+    UINT8                   GetOnlyAmlTables,
+    ACPI_NEW_TABLE_DESC     **ReturnListHead)
+{
+    ACPI_NEW_TABLE_DESC     *ListHead = NULL;
+    ACPI_NEW_TABLE_DESC     *ListTail = NULL;
+    ACPI_NEW_TABLE_DESC     *TableDesc;
+    FILE                    *File;
+    ACPI_TABLE_HEADER       *Table = NULL;
+    UINT32                  FileSize;
+    ACPI_STATUS             Status = AE_OK;
+
+
+    File = fopen (Filename, "rb");
+    if (!File)
+    {
+        perror ("Could not open input file");
+        if (errno == ENOENT)
+        {
+            return (AE_NOT_EXIST);
+        }
+
+        return (AE_ERROR);
+    }
+
+    /* Get the file size */
+
+    FileSize = CmGetFileSize (File);
+    if (FileSize == ACPI_UINT32_MAX)
+    {
+        return (AE_ERROR);
+    }
+
+    if (FileSize < 4)
+    {
+        return (AE_BAD_HEADER);
+    }
+
+    /* Read all tables within the file */
+
+    while (ACPI_SUCCESS (Status))
+    {
+        /* Get one entire ACPI table */
+
+        Status = AcpiAcGetOneTableFromFile (
+            Filename, File, GetOnlyAmlTables, &Table);
+        if (Status == AE_CTRL_TERMINATE)
+        {
+            Status = AE_OK;
+            break;
+        }
+        else if (Status == AE_TYPE)
+        {
+            continue;
+        }
+        else if (ACPI_FAILURE (Status))
+        {
+            return (Status);
+        }
+
+        /* Allocate and link a table descriptor */
+
+        TableDesc = AcpiOsAllocate (sizeof (ACPI_NEW_TABLE_DESC));
+        TableDesc->Table = Table;
+        TableDesc->Next = NULL;
+
+        /* Link at the end of the local table list */
+
+        if (!ListHead)
+        {
+            ListHead = TableDesc;
+            ListTail = TableDesc;
+        }
+        else
+        {
+            ListTail->Next = TableDesc;
+            ListTail = TableDesc;
+        }
+    }
+
+    /* Add the local table list to the end of the global list */
+
+    if (*ReturnListHead)
+    {
+        ListTail = *ReturnListHead;
+        while (ListTail->Next)
+        {
+            ListTail = ListTail->Next;
+        }
+
+        ListTail->Next = ListHead;
+    }
+    else
+    {
+        *ReturnListHead = ListHead;
+    }
+
+    fclose(File);
+    return (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiAcGetOneTableFromFile
+ *
+ * PARAMETERS:  Filename            - File where table is located
+ *              File                - Open FILE pointer to Filename
+ *              GetOnlyAmlTables    - TRUE if the tables must be AML tables.
+ *              ReturnTable         - Where a pointer to the table is returned
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Read the next ACPI table from a file. Implements support
+ *              for multiple tables within a single file. File must already
+ *              be open.
+ *
+ * Note: Loading an RSDP is not supported.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiAcGetOneTableFromFile (
+    char                    *Filename,
+    FILE                    *File,
+    UINT8                   GetOnlyAmlTables,
+    ACPI_TABLE_HEADER       **ReturnTable)
+{
+    ACPI_STATUS             Status = AE_OK;
+    ACPI_TABLE_HEADER       TableHeader;
+    ACPI_TABLE_HEADER       *Table;
+    INT32                   Count;
+    long                    Position;
+
+
+    *ReturnTable = NULL;
+
+
+    /* Get just the table header to get signature and length */
+
+    Position = ftell (File);
+    Count = fread (&TableHeader, 1, sizeof (ACPI_TABLE_HEADER), File);
+    if (Count != sizeof (ACPI_TABLE_HEADER))
+    {
+        return (AE_CTRL_TERMINATE);
+    }
+
+    if (GetOnlyAmlTables)
+    {
+        /* Table must be an AML table (DSDT/SSDT) or FADT */
+
+        if (!ACPI_COMPARE_NAME (TableHeader.Signature, ACPI_SIG_FADT) &&
+            !AcpiUtIsAmlTable (&TableHeader))
+        {
+            fprintf (stderr,
+                "    %s: [%4.4s] is not an AML table - ignoring\n",
+                Filename, TableHeader.Signature);
+
+            return (AE_TYPE);
+        }
+    }
+
+    /* Allocate a buffer for the entire table */
+
+    Table = AcpiOsAllocate ((size_t) TableHeader.Length);
+    if (!Table)
+    {
+        return (AE_NO_MEMORY);
+    }
+
+    /* Now read the entire table */
+
+    fseek (File, Position, SEEK_SET);
+
+    Count = fread (Table, 1, TableHeader.Length, File);
+    if (Count != (INT32) TableHeader.Length)
+    {
+        Status = AE_ERROR;
+        goto ErrorExit;
+    }
+
+    /* Validate the checksum (just issue a warning) */
+
+    Status = AcpiTbVerifyChecksum (Table, TableHeader.Length);
+    if (ACPI_FAILURE (Status))
+    {
+        Status = AcpiAcCheckTextModeCorruption (Table);
+        if (ACPI_FAILURE (Status))
+        {
+            goto ErrorExit;
+        }
+    }
+
+    fprintf (stderr,
+        "Loading ACPI table [%4.4s] from file %12s - Length 0x%06X (%u)\n",
+        TableHeader.Signature, Filename,
+        TableHeader.Length, TableHeader.Length);
+
+    *ReturnTable = Table;
+    return (AE_OK);
+
+
+ErrorExit:
+    AcpiOsFree (Table);
+    return (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AcpiAcCheckTextModeCorruption
+ *
+ * PARAMETERS:  Table           - Table buffer starting with table header
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Check table for text mode file corruption where all linefeed
+ *              characters (LF) have been replaced by carriage return linefeed
+ *              pairs (CR/LF).
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiAcCheckTextModeCorruption (
+    ACPI_TABLE_HEADER       *Table)
+{
+    UINT32                  i;
+    UINT32                  Pairs = 0;
+    UINT8                   *Buffer = ACPI_CAST_PTR (UINT8, Table);
+
+
+    /* Scan entire table to determine if each LF has been prefixed with a CR */
+
+    for (i = 1; i < Table->Length; i++)
+    {
+        if (Buffer[i] == 0x0A)
+        {
+            if (Buffer[i - 1] != 0x0D)
+            {
+                /* The LF does not have a preceding CR, table not corrupted */
+
+                return (AE_OK);
+            }
+            else
+            {
+                /* Found a CR/LF pair */
+
+                Pairs++;
+            }
+
+            i++;
+        }
+    }
+
+    if (!Pairs)
+    {
+        return (AE_OK);
+    }
+
+    /*
+     * Entire table scanned, each CR is part of a CR/LF pair --
+     * meaning that the table was treated as a text file somewhere.
+     *
+     * NOTE: We can't "fix" the table, because any existing CR/LF pairs in the
+     * original table are left untouched by the text conversion process --
+     * meaning that we cannot simply replace CR/LF pairs with LFs.
+     */
+    AcpiOsPrintf ("Table has been corrupted by text mode conversion\n");
+    AcpiOsPrintf ("All LFs (%u) were changed to CR/LF pairs\n", Pairs);
+    AcpiOsPrintf ("Table cannot be repaired!\n");
+
+    return (AE_BAD_VALUE);
+}
index 5daa95a..2273db4 100644 (file)
@@ -262,6 +262,7 @@ AcpiOsGetLine (
 
             ACPI_BACKUP_CURSOR (i, EndOfLine - CursorPosition + 1);
             EndOfLine--;
+
             if (CursorPosition > 0)
             {
                 CursorPosition--;
index 8afabd5..33500d6 100644 (file)
  */
 
 #include "aslcompiler.h"
-#include "acparser.h"
 #include "amlcode.h"
 #include "acdisasm.h"
 #include "acdispat.h"
 #include "acnamesp.h"
-#include "actables.h"
+#include "acparser.h"
 #include "acapps.h"
 
 #include <stdio.h>
-#include <time.h>
 
 
 #define _COMPONENT          ACPI_TOOLS
 
 /* Local prototypes */
 
-static void
-AdCreateTableHeader (
+static ACPI_STATUS
+AdDoExternalFileList (
+    char                    *Filename);
+
+static ACPI_STATUS
+AdDisassembleOneTable (
+    ACPI_TABLE_HEADER       *Table,
+    FILE                    *File,
     char                    *Filename,
-    ACPI_TABLE_HEADER       *Table);
+    char                    *DisasmFilename);
 
 static ACPI_STATUS
-AdStoreTable (
+AdReparseOneTable (
     ACPI_TABLE_HEADER       *Table,
-    UINT32                  *TableIndex);
+    FILE                    *File,
+    ACPI_OWNER_ID           OwnerId);
 
-/* Stubs for ASL compiler */
+
+ACPI_TABLE_DESC             LocalTables[1];
+ACPI_PARSE_OBJECT           *AcpiGbl_ParseOpRoot;
+
+
+/* Stubs for everything except ASL compiler */
 
 #ifndef ACPI_ASL_COMPILER
 BOOLEAN
@@ -77,7 +87,7 @@ AcpiDsIsResultUsed (
     ACPI_PARSE_OBJECT       *Op,
     ACPI_WALK_STATE         *WalkState)
 {
-    return TRUE;
+    return (TRUE);
 }
 
 ACPI_STATUS
@@ -89,52 +99,6 @@ AcpiDsMethodError (
 }
 #endif
 
-ACPI_STATUS
-AcpiNsLoadTable (
-    UINT32                  TableIndex,
-    ACPI_NAMESPACE_NODE     *Node)
-{
-    return (AE_NOT_IMPLEMENTED);
-}
-
-ACPI_STATUS
-AcpiDsRestartControlMethod (
-    ACPI_WALK_STATE         *WalkState,
-    ACPI_OPERAND_OBJECT     *ReturnDesc)
-{
-    return (AE_OK);
-}
-
-void
-AcpiDsTerminateControlMethod (
-    ACPI_OPERAND_OBJECT     *MethodDesc,
-    ACPI_WALK_STATE         *WalkState)
-{
-    return;
-}
-
-ACPI_STATUS
-AcpiDsCallControlMethod (
-    ACPI_THREAD_STATE       *Thread,
-    ACPI_WALK_STATE         *WalkState,
-    ACPI_PARSE_OBJECT       *Op)
-{
-    return (AE_OK);
-}
-
-ACPI_STATUS
-AcpiDsMethodDataInitArgs (
-    ACPI_OPERAND_OBJECT     **Params,
-    UINT32                  MaxParamCount,
-    ACPI_WALK_STATE         *WalkState)
-{
-    return (AE_OK);
-}
-
-
-static ACPI_TABLE_DESC      LocalTables[1];
-static ACPI_PARSE_OBJECT    *AcpiGbl_ParseOpRoot;
-
 
 /*******************************************************************************
  *
@@ -202,7 +166,7 @@ AdInitialize (
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Disassemble an entire ACPI table
+ * DESCRIPTION: Disassembler entry point. Disassemble an entire ACPI table.
  *
  *****************************************************************************/
 
@@ -214,14 +178,10 @@ AdAmlDisassemble (
     char                    **OutFilename)
 {
     ACPI_STATUS             Status;
-    ACPI_STATUS             GlobalStatus = AE_OK;
     char                    *DisasmFilename = NULL;
-    char                    *ExternalFilename;
-    ACPI_EXTERNAL_FILE      *ExternalFileList = AcpiGbl_ExternalFileList;
     FILE                    *File = NULL;
     ACPI_TABLE_HEADER       *Table = NULL;
-    ACPI_TABLE_HEADER       *ExternalTable;
-    ACPI_OWNER_ID           OwnerId;
+    ACPI_NEW_TABLE_DESC     *ListHead = NULL;
 
 
     /*
@@ -230,81 +190,22 @@ AdAmlDisassemble (
      */
     if (Filename)
     {
-        Status = AcpiDbGetTableFromFile (Filename, &Table, FALSE);
+        /* Get the list of all AML tables in the file */
+
+        Status = AcpiAcGetAllTablesFromFile (Filename,
+            ACPI_GET_ALL_TABLES, &ListHead);
         if (ACPI_FAILURE (Status))
         {
             return (Status);
         }
 
-        /*
-         * External filenames separated by commas
-         * Example: iasl -e file1,file2,file3 -d xxx.aml
-         */
-        while (ExternalFileList)
-        {
-            ExternalFilename = ExternalFileList->Path;
-            if (!strcmp (ExternalFilename, Filename))
-            {
-                /* Next external file */
-
-                ExternalFileList = ExternalFileList->Next;
-                continue;
-            }
-
-            Status = AcpiDbGetTableFromFile (ExternalFilename, &ExternalTable, TRUE);
-            if (ACPI_FAILURE (Status))
-            {
-                if (Status == AE_TYPE)
-                {
-                    ExternalFileList = ExternalFileList->Next;
-                    GlobalStatus = AE_TYPE;
-                    Status = AE_OK;
-                    continue;
-                }
-                return (Status);
-            }
-
-            /* Load external table for symbol resolution */
-
-            if (ExternalTable)
-            {
-                Status = AdParseTable (ExternalTable, &OwnerId, TRUE, TRUE);
-                if (ACPI_FAILURE (Status))
-                {
-                    AcpiOsPrintf ("Could not parse external ACPI tables, %s\n",
-                        AcpiFormatException (Status));
-                    return (Status);
-                }
-
-                /*
-                 * Load namespace from names created within control methods
-                 * Set owner id of nodes in external table
-                 */
-                AcpiDmFinishNamespaceLoad (AcpiGbl_ParseOpRoot,
-                    AcpiGbl_RootNode, OwnerId);
-                AcpiPsDeleteParseTree (AcpiGbl_ParseOpRoot);
-            }
-
-            /* Next external file */
-
-            ExternalFileList = ExternalFileList->Next;
-        }
-
-        if (ACPI_FAILURE (GlobalStatus))
-        {
-            return (GlobalStatus);
-        }
-
-        /* Clear external list generated by Scope in external tables */
+        /* Process any user-specified files for external objects */
 
-        if (AcpiGbl_ExternalFileList)
+        Status = AdDoExternalFileList (Filename);
+        if (ACPI_FAILURE (Status))
         {
-            AcpiDmClearExternalList ();
+            return (Status);
         }
-
-        /* Load any externals defined in the optional external ref file */
-
-        AcpiDmGetExternalsFromFile ();
     }
     else
     {
@@ -353,7 +254,8 @@ AdAmlDisassemble (
         File = fopen (DisasmFilename, "w+");
         if (!File)
         {
-            fprintf (stderr, "Could not open output file %s\n", DisasmFilename);
+            fprintf (stderr, "Could not open output file %s\n",
+                DisasmFilename);
             Status = AE_ERROR;
             goto Cleanup;
         }
@@ -363,190 +265,32 @@ AdAmlDisassemble (
 
     *OutFilename = DisasmFilename;
 
-    /* ForceAmlDisassembly means to assume the table contains valid AML */
-
-    if (!AcpiGbl_ForceAmlDisassembly && !AcpiUtIsAmlTable (Table))
-    {
-        AdDisassemblerHeader (Filename, ACPI_IS_DATA_TABLE);
-        AcpiOsPrintf (" * ACPI Data Table [%4.4s]\n *\n",
-            Table->Signature);
-        AcpiOsPrintf (" * Format: [HexOffset DecimalOffset ByteLength]  "
-            "FieldName : FieldValue\n */\n\n");
-
-        AcpiDmDumpDataTable (Table);
-        fprintf (stderr, "Acpi Data Table [%4.4s] decoded\n",
-            Table->Signature);
+    /* Disassemble all AML tables within the file */
 
-        if (File)
-        {
-            fprintf (stderr, "Formatted output:  %s - %u bytes\n",
-                DisasmFilename, CmGetFileSize (File));
-        }
-    }
-    else
+    while (ListHead)
     {
-        /* Always parse the tables, only option is what to display */
-
-        Status = AdParseTable (Table, &OwnerId, TRUE, FALSE);
+        Status = AdDisassembleOneTable (ListHead->Table,
+            File, Filename, DisasmFilename);
         if (ACPI_FAILURE (Status))
         {
-            AcpiOsPrintf ("Could not parse ACPI tables, %s\n",
-                AcpiFormatException (Status));
-            goto Cleanup;
-        }
-
-        if (AslCompilerdebug)
-        {
-            AcpiOsPrintf ("/**** Before second load\n");
-
-            if (File)
-            {
-                NsSetupNamespaceListing (File);
-                NsDisplayNamespace ();
-            }
-            AcpiOsPrintf ("*****/\n");
-        }
-
-        /* Load namespace from names created within control methods */
-
-        AcpiDmFinishNamespaceLoad (AcpiGbl_ParseOpRoot,
-            AcpiGbl_RootNode, OwnerId);
-
-        /*
-         * Cross reference the namespace here, in order to
-         * generate External() statements
-         */
-        AcpiDmCrossReferenceNamespace (AcpiGbl_ParseOpRoot,
-            AcpiGbl_RootNode, OwnerId);
-
-        if (AslCompilerdebug)
-        {
-            AcpiDmDumpTree (AcpiGbl_ParseOpRoot);
-        }
-
-        /* Find possible calls to external control methods */
-
-        AcpiDmFindOrphanMethods (AcpiGbl_ParseOpRoot);
-
-        /*
-         * If we found any external control methods, we must reparse
-         * the entire tree with the new information (namely, the
-         * number of arguments per method)
-         */
-        if (AcpiDmGetExternalMethodCount ())
-        {
-            fprintf (stderr,
-                "\nFound %u external control methods, "
-                "reparsing with new information\n",
-                AcpiDmGetExternalMethodCount ());
-
-            /* Reparse, rebuild namespace */
-
-            AcpiPsDeleteParseTree (AcpiGbl_ParseOpRoot);
-            AcpiGbl_ParseOpRoot = NULL;
-            AcpiNsDeleteNamespaceSubtree (AcpiGbl_RootNode);
-
-            AcpiGbl_RootNode                    = NULL;
-            AcpiGbl_RootNodeStruct.Name.Integer = ACPI_ROOT_NAME;
-            AcpiGbl_RootNodeStruct.DescriptorType = ACPI_DESC_TYPE_NAMED;
-            AcpiGbl_RootNodeStruct.Type         = ACPI_TYPE_DEVICE;
-            AcpiGbl_RootNodeStruct.Parent       = NULL;
-            AcpiGbl_RootNodeStruct.Child        = NULL;
-            AcpiGbl_RootNodeStruct.Peer         = NULL;
-            AcpiGbl_RootNodeStruct.Object       = NULL;
-            AcpiGbl_RootNodeStruct.Flags        = 0;
-
-            Status = AcpiNsRootInitialize ();
-
-            /* New namespace, add the external definitions first */
-
-            AcpiDmAddExternalsToNamespace ();
-
-            /* Parse the table again. No need to reload it, however */
-
-            Status = AdParseTable (Table, NULL, FALSE, FALSE);
-            if (ACPI_FAILURE (Status))
-            {
-                AcpiOsPrintf ("Could not parse ACPI tables, %s\n",
-                    AcpiFormatException (Status));
-                goto Cleanup;
-            }
-
-            /* Cross reference the namespace again */
-
-            AcpiDmFinishNamespaceLoad (AcpiGbl_ParseOpRoot,
-                AcpiGbl_RootNode, OwnerId);
-
-            AcpiDmCrossReferenceNamespace (AcpiGbl_ParseOpRoot,
-                AcpiGbl_RootNode, OwnerId);
-
-            if (AslCompilerdebug)
-            {
-                AcpiOsPrintf ("/**** After second load and resource conversion\n");
-                if (File)
-                {
-                    NsSetupNamespaceListing (File);
-                    NsDisplayNamespace ();
-                }
-                AcpiOsPrintf ("*****/\n");
-
-                AcpiDmDumpTree (AcpiGbl_ParseOpRoot);
-            }
+            break;
         }
 
-        /*
-         * Now that the namespace is finalized, we can perform namespace
-         * transforms.
-         *
-         * 1) Convert fixed-offset references to resource descriptors
-         *    to symbolic references (Note: modifies namespace)
-         */
-        AcpiDmConvertResourceIndexes (AcpiGbl_ParseOpRoot, AcpiGbl_RootNode);
-
-        /* Optional displays */
-
-        if (AcpiGbl_DmOpt_Disasm)
-        {
-            /* This is the real disassembly */
-
-            AdDisplayTables (Filename, Table);
-
-            /* Dump hex table if requested (-vt) */
-
-            AcpiDmDumpDataTable (Table);
-
-            fprintf (stderr, "Disassembly completed\n");
-            if (File)
-            {
-                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));
-            }
-        }
+        ListHead = ListHead->Next;
     }
 
 Cleanup:
 
-    if (Table && !AcpiGbl_ForceAmlDisassembly &&!AcpiUtIsAmlTable (Table))
+// check!
+#if 0
+    if (Table && !AcpiGbl_ForceAmlDisassembly && !AcpiUtIsAmlTable (Table))
     {
         ACPI_FREE (Table);
     }
+#endif
 
     if (File)
     {
-        if (AslCompilerdebug) /* Display final namespace, with transforms */
-        {
-            NsSetupNamespaceListing (File);
-            NsDisplayNamespace ();
-        }
-
         fclose (File);
         AcpiOsRedirectOutput (stdout);
     }
@@ -559,290 +303,243 @@ Cleanup:
 
 /******************************************************************************
  *
- * FUNCTION:    AdDisassemblerHeader
+ * FUNCTION:    AdDisassembleOneTable
  *
- * PARAMETERS:  Filename            - Input file for the table
- *              TableType           - Either AML or DataTable
+ * PARAMETERS:  Table               - Raw AML table
+ *              File                - Pointer for the input file
+ *              Filename            - AML input filename
+ *              DisasmFilename      - Output filename
  *
- * RETURN:      None
+ * RETURN:      Status
  *
- * DESCRIPTION: Create the disassembler header, including ACPICA signon with
- *              current time and date.
+ * DESCRIPTION: Disassemble a single ACPI table. AML or data table.
  *
  *****************************************************************************/
 
-void
-AdDisassemblerHeader (
+static ACPI_STATUS
+AdDisassembleOneTable (
+    ACPI_TABLE_HEADER       *Table,
+    FILE                    *File,
     char                    *Filename,
-    UINT8                   TableType)
+    char                    *DisasmFilename)
 {
-    time_t                  Timer;
-
-
-    time (&Timer);
+    ACPI_STATUS             Status;
+    ACPI_OWNER_ID           OwnerId;
 
-    /* Header and input table info */
 
-    AcpiOsPrintf ("/*\n");
-    AcpiOsPrintf (ACPI_COMMON_HEADER (AML_DISASSEMBLER_NAME, " * "));
+    /* ForceAmlDisassembly means to assume the table contains valid AML */
 
-    if (TableType == ACPI_IS_AML_TABLE)
+    if (!AcpiGbl_ForceAmlDisassembly && !AcpiUtIsAmlTable (Table))
     {
-        if (AcpiGbl_CstyleDisassembly)
-        {
-            AcpiOsPrintf (
-                " * Disassembling to symbolic ASL+ operators\n"
-                " *\n");
-        }
-        else
-        {
-            AcpiOsPrintf (
-                " * Disassembling to non-symbolic legacy ASL operators\n"
-                " *\n");
-        }
-    }
+        AdDisassemblerHeader (Filename, ACPI_IS_DATA_TABLE);
 
-    AcpiOsPrintf (" * Disassembly of %s, %s", Filename, ctime (&Timer));
-    AcpiOsPrintf (" *\n");
-}
+        /* This is a "Data Table" (non-AML table) */
 
+        AcpiOsPrintf (" * ACPI Data Table [%4.4s]\n *\n",
+            Table->Signature);
+        AcpiOsPrintf (" * Format: [HexOffset DecimalOffset ByteLength]  "
+            "FieldName : FieldValue\n */\n\n");
 
-/******************************************************************************
- *
- * FUNCTION:    AdCreateTableHeader
- *
- * PARAMETERS:  Filename            - Input file for the table
- *              Table               - Pointer to the raw table
- *
- * RETURN:      None
- *
- * DESCRIPTION: Create the ASL table header, including ACPICA signon with
- *              current time and date.
- *
- *****************************************************************************/
+        AcpiDmDumpDataTable (Table);
+        fprintf (stderr, "Acpi Data Table [%4.4s] decoded\n",
+            Table->Signature);
 
-static void
-AdCreateTableHeader (
-    char                    *Filename,
-    ACPI_TABLE_HEADER       *Table)
-{
-    char                    *NewFilename;
-    UINT8                   Checksum;
+        if (File)
+        {
+            fprintf (stderr, "Formatted output:  %s - %u bytes\n",
+                DisasmFilename, CmGetFileSize (File));
+        }
 
+        return (AE_OK);
+    }
 
     /*
-     * Print file header and dump original table header
+     * This is an AML table (DSDT or SSDT).
+     * Always parse the tables, only option is what to display
      */
-    AdDisassemblerHeader (Filename, ACPI_IS_AML_TABLE);
-
-    AcpiOsPrintf (" * Original Table Header:\n");
-    AcpiOsPrintf (" *     Signature        \"%4.4s\"\n",    Table->Signature);
-    AcpiOsPrintf (" *     Length           0x%8.8X (%u)\n", Table->Length, Table->Length);
-
-    /* Print and validate the revision */
+    Status = AdParseTable (Table, &OwnerId, TRUE, FALSE);
+    if (ACPI_FAILURE (Status))
+    {
+        AcpiOsPrintf ("Could not parse ACPI tables, %s\n",
+            AcpiFormatException (Status));
+        return (Status);
+    }
 
-    AcpiOsPrintf (" *     Revision         0x%2.2X",      Table->Revision);
+    /* Debug output, namespace and parse tree */
 
-    switch (Table->Revision)
+    if (AslCompilerdebug && File)
     {
-    case 0:
+        AcpiOsPrintf ("/**** Before second load\n");
 
-        AcpiOsPrintf (" **** Invalid Revision");
-        break;
+        NsSetupNamespaceListing (File);
+        NsDisplayNamespace ();
 
-    case 1:
+        AcpiOsPrintf ("*****/\n");
+    }
 
-        /* Revision of DSDT controls the ACPI integer width */
+    /* Load namespace from names created within control methods */
 
-        if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_DSDT))
-        {
-            AcpiOsPrintf (" **** 32-bit table (V1), no 64-bit math support");
-        }
-        break;
+    AcpiDmFinishNamespaceLoad (AcpiGbl_ParseOpRoot,
+        AcpiGbl_RootNode, OwnerId);
 
-    default:
+    /*
+     * Cross reference the namespace here, in order to
+     * generate External() statements
+     */
+    AcpiDmCrossReferenceNamespace (AcpiGbl_ParseOpRoot,
+        AcpiGbl_RootNode, OwnerId);
 
-        break;
+    if (AslCompilerdebug)
+    {
+        AcpiDmDumpTree (AcpiGbl_ParseOpRoot);
     }
-    AcpiOsPrintf ("\n");
 
-    /* Print and validate the table checksum */
+    /* Find possible calls to external control methods */
 
-    AcpiOsPrintf (" *     Checksum         0x%2.2X",        Table->Checksum);
+    AcpiDmFindOrphanMethods (AcpiGbl_ParseOpRoot);
 
-    Checksum = AcpiTbChecksum (ACPI_CAST_PTR (UINT8, Table), Table->Length);
-    if (Checksum)
+    /*
+     * If we found any external control methods, we must reparse
+     * the entire tree with the new information (namely, the
+     * number of arguments per method)
+     */
+    if (AcpiDmGetExternalMethodCount ())
     {
-        AcpiOsPrintf (" **** Incorrect checksum, should be 0x%2.2X",
-            (UINT8) (Table->Checksum - Checksum));
+        Status = AdReparseOneTable (Table, File, OwnerId);
+        if (ACPI_FAILURE (Status))
+        {
+            return (Status);
+        }
     }
-    AcpiOsPrintf ("\n");
 
-    AcpiOsPrintf (" *     OEM ID           \"%.6s\"\n",     Table->OemId);
-    AcpiOsPrintf (" *     OEM Table ID     \"%.8s\"\n",     Table->OemTableId);
-    AcpiOsPrintf (" *     OEM Revision     0x%8.8X (%u)\n", Table->OemRevision, Table->OemRevision);
-    AcpiOsPrintf (" *     Compiler ID      \"%.4s\"\n",     Table->AslCompilerId);
-    AcpiOsPrintf (" *     Compiler Version 0x%8.8X (%u)\n", Table->AslCompilerRevision, Table->AslCompilerRevision);
-    AcpiOsPrintf (" */\n");
+    /*
+     * Now that the namespace is finalized, we can perform namespace
+     * transforms.
+     *
+     * 1) Convert fixed-offset references to resource descriptors
+     *    to symbolic references (Note: modifies namespace)
+     */
+    AcpiDmConvertResourceIndexes (AcpiGbl_ParseOpRoot, AcpiGbl_RootNode);
 
-    /* Create AML output filename based on input filename */
+    /* Optional displays */
 
-    if (Filename)
-    {
-        NewFilename = FlGenerateFilename (Filename, "aml");
-    }
-    else
+    if (AcpiGbl_DmOpt_Disasm)
     {
-        NewFilename = UtStringCacheCalloc (9);
-        if (NewFilename)
+        /* This is the real disassembly */
+
+        AdDisplayTables (Filename, Table);
+
+        /* Dump hex table if requested (-vt) */
+
+        AcpiDmDumpDataTable (Table);
+
+        fprintf (stderr, "Disassembly completed\n");
+        if (File)
         {
-            strncat (NewFilename, Table->Signature, 4);
-            strcat (NewFilename, ".aml");
+            fprintf (stderr, "ASL Output:    %s - %u bytes\n",
+                DisasmFilename, CmGetFileSize (File));
         }
-    }
 
-    if (!NewFilename)
-    {
-        AcpiOsPrintf (" **** Could not generate AML output filename\n");
-        return;
+        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));
+        }
     }
 
-    /* Open the ASL definition block */
-
-    AcpiOsPrintf (
-        "DefinitionBlock (\"%s\", \"%4.4s\", %hu, \"%.6s\", \"%.8s\", 0x%8.8X)\n",
-        NewFilename, Table->Signature, Table->Revision,
-        Table->OemId, Table->OemTableId, Table->OemRevision);
+    return (AE_OK);
 }
 
 
 /******************************************************************************
  *
- * FUNCTION:    AdDisplayTables
+ * FUNCTION:    AdReparseOneTable
  *
- * PARAMETERS:  Filename            - Input file for the table
- *              Table               - Pointer to the raw table
+ * PARAMETERS:  Table               - Raw AML table
+ *              File                - Pointer for the input file
+ *              OwnerId             - ID for this table
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Display (disassemble) loaded tables and dump raw tables
+ * DESCRIPTION: Reparse a table that has already been loaded. Used to
+ *              integrate information about external control methods.
+ *              These methods may have been previously parsed incorrectly.
  *
  *****************************************************************************/
 
-ACPI_STATUS
-AdDisplayTables (
-    char                    *Filename,
-    ACPI_TABLE_HEADER       *Table)
+static ACPI_STATUS
+AdReparseOneTable (
+    ACPI_TABLE_HEADER       *Table,
+    FILE                    *File,
+    ACPI_OWNER_ID           OwnerId)
 {
+    ACPI_STATUS             Status;
 
 
-    if (!AcpiGbl_ParseOpRoot)
-    {
-        return (AE_NOT_EXIST);
-    }
+    fprintf (stderr,
+        "\nFound %u external control methods, "
+        "reparsing with new information\n",
+        AcpiDmGetExternalMethodCount ());
 
-    if (!AcpiGbl_DmOpt_Listing)
-    {
-        AdCreateTableHeader (Filename, Table);
-    }
+    /* Reparse, rebuild namespace */
 
-    AcpiDmDisassemble (NULL, AcpiGbl_ParseOpRoot, ACPI_UINT32_MAX);
-    MpEmitMappingInfo ();
+    AcpiPsDeleteParseTree (AcpiGbl_ParseOpRoot);
+    AcpiGbl_ParseOpRoot = NULL;
+    AcpiNsDeleteNamespaceSubtree (AcpiGbl_RootNode);
+
+    AcpiGbl_RootNode                    = NULL;
+    AcpiGbl_RootNodeStruct.Name.Integer = ACPI_ROOT_NAME;
+    AcpiGbl_RootNodeStruct.DescriptorType = ACPI_DESC_TYPE_NAMED;
+    AcpiGbl_RootNodeStruct.Type         = ACPI_TYPE_DEVICE;
+    AcpiGbl_RootNodeStruct.Parent       = NULL;
+    AcpiGbl_RootNodeStruct.Child        = NULL;
+    AcpiGbl_RootNodeStruct.Peer         = NULL;
+    AcpiGbl_RootNodeStruct.Object       = NULL;
+    AcpiGbl_RootNodeStruct.Flags        = 0;
 
-    if (AcpiGbl_DmOpt_Listing)
+    Status = AcpiNsRootInitialize ();
+    if (ACPI_FAILURE (Status))
     {
-        AcpiOsPrintf ("\n\nTable Header:\n");
-        AcpiUtDebugDumpBuffer ((UINT8 *) Table, sizeof (ACPI_TABLE_HEADER),
-            DB_BYTE_DISPLAY, ACPI_UINT32_MAX);
-
-        AcpiOsPrintf ("Table Body (Length 0x%X)\n", Table->Length);
-        AcpiUtDebugDumpBuffer (((UINT8 *) Table + sizeof (ACPI_TABLE_HEADER)),
-            Table->Length, DB_BYTE_DISPLAY, ACPI_UINT32_MAX);
+        return (Status);
     }
 
-    return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION:    AdStoreTable
- *
- * PARAMETERS:  Table               - Table header
- *              TableIndex          - Where the table index is returned
- *
- * RETURN:      Status and table index.
- *
- * DESCRIPTION: Add an ACPI table to the global table list
- *
- ******************************************************************************/
+    /* New namespace, add the external definitions first */
 
-static ACPI_STATUS
-AdStoreTable (
-    ACPI_TABLE_HEADER       *Table,
-    UINT32                  *TableIndex)
-{
-    ACPI_STATUS             Status;
-    ACPI_TABLE_DESC         *TableDesc;
+    AcpiDmAddExternalsToNamespace ();
 
+    /* Parse the table again. No need to reload it, however */
 
-    Status = AcpiTbGetNextTableDescriptor (TableIndex, &TableDesc);
+    Status = AdParseTable (Table, NULL, FALSE, FALSE);
     if (ACPI_FAILURE (Status))
     {
+        AcpiOsPrintf ("Could not parse ACPI tables, %s\n",
+            AcpiFormatException (Status));
         return (Status);
     }
 
-    /* Initialize added table */
+    /* Cross reference the namespace again */
 
-    AcpiTbInitTableDescriptor (TableDesc, ACPI_PTR_TO_PHYSADDR (Table),
-        ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL, Table);
-    Status = AcpiTbValidateTable (TableDesc);
-    return (Status);
-}
+    AcpiDmFinishNamespaceLoad (AcpiGbl_ParseOpRoot,
+        AcpiGbl_RootNode, OwnerId);
 
+    AcpiDmCrossReferenceNamespace (AcpiGbl_ParseOpRoot,
+        AcpiGbl_RootNode, OwnerId);
 
-/******************************************************************************
- *
- * FUNCTION:    AdGetLocalTables
- *
- * PARAMETERS:  None
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Get the ACPI tables from either memory or a file
- *
- *****************************************************************************/
-
-ACPI_STATUS
-AdGetLocalTables (
-    void)
-{
-    ACPI_STATUS             Status;
-    ACPI_TABLE_HEADER       TableHeader;
-    ACPI_TABLE_HEADER       *NewTable;
-    UINT32                  TableIndex;
-
+    /* Debug output - namespace and parse tree */
 
-    /* Get the DSDT via table override */
-
-    ACPI_MOVE_32_TO_32 (TableHeader.Signature, ACPI_SIG_DSDT);
-    AcpiOsTableOverride (&TableHeader, &NewTable);
-    if (!NewTable)
+    if (AslCompilerdebug)
     {
-        fprintf (stderr, "Could not obtain DSDT\n");
-        return (AE_NO_ACPI_TABLES);
-    }
-
-    AdWriteTable (NewTable, NewTable->Length,
-        ACPI_SIG_DSDT, NewTable->OemTableId);
-
-    /* Store DSDT in the Table Manager */
+        AcpiOsPrintf ("/**** After second load and resource conversion\n");
+        if (File)
+        {
+            NsSetupNamespaceListing (File);
+            NsDisplayNamespace ();
+        }
 
-    Status = AdStoreTable (NewTable, &TableIndex);
-    if (ACPI_FAILURE (Status))
-    {
-        fprintf (stderr, "Could not store DSDT\n");
-        return (AE_NO_ACPI_TABLES);
+        AcpiOsPrintf ("*****/\n");
+        AcpiDmDumpTree (AcpiGbl_ParseOpRoot);
     }
 
     return (AE_OK);
@@ -851,134 +548,108 @@ AdGetLocalTables (
 
 /******************************************************************************
  *
- * FUNCTION:    AdParseTable
+ * FUNCTION:    AdDoExternalFileList
  *
- * PARAMETERS:  Table               - Pointer to the raw table
- *              OwnerId             - Returned OwnerId of the table
- *              LoadTable           - If add table to the global table list
- *              External            - If this is an external table
+ * PARAMETERS:  Filename            - Input file for the table
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Parse the DSDT.
+ * DESCRIPTION: Process all tables found in the -e external files list
  *
  *****************************************************************************/
 
-ACPI_STATUS
-AdParseTable (
-    ACPI_TABLE_HEADER       *Table,
-    ACPI_OWNER_ID           *OwnerId,
-    BOOLEAN                 LoadTable,
-    BOOLEAN                 External)
+static ACPI_STATUS
+AdDoExternalFileList (
+    char                    *Filename)
 {
-    ACPI_STATUS             Status = AE_OK;
-    ACPI_WALK_STATE         *WalkState;
-    UINT8                   *AmlStart;
-    UINT32                  AmlLength;
-    UINT32                  TableIndex;
-
-
-    if (!Table)
-    {
-        return (AE_NOT_EXIST);
-    }
-
-    /* Pass 1:  Parse everything except control method bodies */
-
-    fprintf (stderr, "Pass 1 parse of [%4.4s]\n", (char *) Table->Signature);
-
-    AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER);
-    AmlStart = ((UINT8 *) Table + sizeof (ACPI_TABLE_HEADER));
-
-    /* Create the root object */
-
-    AcpiGbl_ParseOpRoot = AcpiPsCreateScopeOp (AmlStart);
-    if (!AcpiGbl_ParseOpRoot)
-    {
-        return (AE_NO_MEMORY);
-    }
-
-    /* Create and initialize a new walk state */
+    ACPI_EXTERNAL_FILE      *ExternalFileList;
+    char                    *ExternalFilename;
+    ACPI_NEW_TABLE_DESC     *ExternalListHead = NULL;
+    ACPI_STATUS             Status;
+    ACPI_STATUS             GlobalStatus = AE_OK;
+    ACPI_OWNER_ID           OwnerId;
 
-    WalkState = AcpiDsCreateWalkState (0,
-                        AcpiGbl_ParseOpRoot, NULL, NULL);
-    if (!WalkState)
-    {
-        return (AE_NO_MEMORY);
-    }
 
-    Status = AcpiDsInitAmlWalk (WalkState, AcpiGbl_ParseOpRoot,
-                NULL, AmlStart, AmlLength, NULL, ACPI_IMODE_LOAD_PASS1);
-    if (ACPI_FAILURE (Status))
-    {
-        return (Status);
-    }
+    /*
+     * External filenames are specified on the command line like this:
+     * Example: iasl -e file1,file2,file3 -d xxx.aml
+     */
+    ExternalFileList = AcpiGbl_ExternalFileList;
 
-    WalkState->ParseFlags &= ~ACPI_PARSE_DELETE_TREE;
-    WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE;
+    /* Process each external file */
 
-    Status = AcpiPsParseAml (WalkState);
-    if (ACPI_FAILURE (Status))
+    while (ExternalFileList)
     {
-        return (Status);
-    }
-
-    /* If LoadTable is FALSE, we are parsing the last loaded table */
+        ExternalFilename = ExternalFileList->Path;
+        if (!strcmp (ExternalFilename, Filename))
+        {
+            /* Next external file */
 
-    TableIndex = AcpiGbl_RootTableList.CurrentTableCount - 1;
+            ExternalFileList = ExternalFileList->Next;
+            continue;
+        }
 
-    /* Pass 2 */
+        AcpiOsPrintf ("External object resolution file %16s\n",
+            ExternalFilename);
 
-    if (LoadTable)
-    {
-        Status = AdStoreTable (Table, &TableIndex);
-        if (ACPI_FAILURE (Status))
-        {
-            return (Status);
-        }
-        Status = AcpiTbAllocateOwnerId (TableIndex);
+        Status = AcpiAcGetAllTablesFromFile (
+            ExternalFilename, ACPI_GET_ONLY_AML_TABLES, &ExternalListHead);
         if (ACPI_FAILURE (Status))
         {
+            if (Status == AE_TYPE)
+            {
+                ExternalFileList = ExternalFileList->Next;
+                GlobalStatus = AE_TYPE;
+                Status = AE_OK;
+                continue;
+            }
+
             return (Status);
         }
-        if (OwnerId)
+
+        /* Load external tables for symbol resolution */
+
+        while (ExternalListHead)
         {
-            Status = AcpiTbGetOwnerId (TableIndex, OwnerId);
+            Status = AdParseTable (
+                ExternalListHead->Table, &OwnerId, TRUE, TRUE);
             if (ACPI_FAILURE (Status))
             {
+                AcpiOsPrintf ("Could not parse external ACPI tables, %s\n",
+                    AcpiFormatException (Status));
                 return (Status);
             }
+
+            /*
+             * Load namespace from names created within control methods
+             * Set owner id of nodes in external table
+             */
+            AcpiDmFinishNamespaceLoad (AcpiGbl_ParseOpRoot,
+                AcpiGbl_RootNode, OwnerId);
+            AcpiPsDeleteParseTree (AcpiGbl_ParseOpRoot);
+
+            ExternalListHead = ExternalListHead->Next;
         }
-    }
 
-    fprintf (stderr, "Pass 2 parse of [%4.4s]\n", (char *) Table->Signature);
+        /* Next external file */
 
-    Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS2, TableIndex, NULL);
-    if (ACPI_FAILURE (Status))
-    {
-        return (Status);
+        ExternalFileList = ExternalFileList->Next;
     }
 
-    /* No need to parse control methods of external table */
-
-    if (External)
+    if (ACPI_FAILURE (GlobalStatus))
     {
-        return (AE_OK);
+        return (GlobalStatus);
     }
 
-    /*
-     * Pass 3: Parse control methods and link their parse trees
-     * into the main parse tree
-     */
-    fprintf (stderr,
-        "Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions)\n");
-    Status = AcpiDmParseDeferredOps (AcpiGbl_ParseOpRoot);
-    fprintf (stderr, "\n");
+    /* Clear external list generated by Scope in external tables */
 
-    /* Process Resource Templates */
+    if (AcpiGbl_ExternalFileList)
+    {
+        AcpiDmClearExternalList ();
+    }
 
-    AcpiDmFindResources (AcpiGbl_ParseOpRoot);
+    /* Load any externals defined in the optional external ref file */
 
-    fprintf (stderr, "Parsing completed\n");
+    AcpiDmGetExternalsFromFile ();
     return (AE_OK);
 }
index 2703675..4149909 100644 (file)
@@ -135,6 +135,7 @@ AcpiDmDumpTree (
     Info.Count = 0;
     Info.Level = 0;
     Info.WalkState = NULL;
+
     AcpiDmWalkParseTree (Origin, AcpiDmDumpDescending, NULL, &Info);
     AcpiOsPrintf ("*/\n\n");
 }
@@ -168,6 +169,7 @@ AcpiDmFindOrphanMethods (
     Info.Flags = 0;
     Info.Level = 0;
     Info.WalkState = NULL;
+
     AcpiDmWalkParseTree (Origin, AcpiDmFindOrphanDescending, NULL, &Info);
 }
 
@@ -211,7 +213,8 @@ AcpiDmFinishNamespaceLoad (
         return;
     }
 
-    Status = AcpiDsScopeStackPush (NamespaceRoot, NamespaceRoot->Type, WalkState);
+    Status = AcpiDsScopeStackPush (NamespaceRoot, NamespaceRoot->Type,
+        WalkState);
     if (ACPI_FAILURE (Status))
     {
         return;
@@ -220,6 +223,7 @@ AcpiDmFinishNamespaceLoad (
     Info.Flags = 0;
     Info.Level = 0;
     Info.WalkState = WalkState;
+
     AcpiDmWalkParseTree (ParseTreeRoot, AcpiDmLoadDescendingOp,
         AcpiDmCommonAscendingOp, &Info);
     ACPI_FREE (WalkState);
@@ -264,7 +268,8 @@ AcpiDmCrossReferenceNamespace (
         return;
     }
 
-    Status = AcpiDsScopeStackPush (NamespaceRoot, NamespaceRoot->Type, WalkState);
+    Status = AcpiDsScopeStackPush (NamespaceRoot, NamespaceRoot->Type,
+        WalkState);
     if (ACPI_FAILURE (Status))
     {
         return;
@@ -273,6 +278,7 @@ AcpiDmCrossReferenceNamespace (
     Info.Flags = 0;
     Info.Level = 0;
     Info.WalkState = WalkState;
+
     AcpiDmWalkParseTree (ParseTreeRoot, AcpiDmXrefDescendingOp,
         AcpiDmCommonAscendingOp, &Info);
     ACPI_FREE (WalkState);
@@ -317,7 +323,8 @@ AcpiDmConvertResourceIndexes (
         return;
     }
 
-    Status = AcpiDsScopeStackPush (NamespaceRoot, NamespaceRoot->Type, WalkState);
+    Status = AcpiDsScopeStackPush (NamespaceRoot, NamespaceRoot->Type,
+        WalkState);
     if (ACPI_FAILURE (Status))
     {
         return;
@@ -326,6 +333,7 @@ AcpiDmConvertResourceIndexes (
     Info.Flags = 0;
     Info.Level = 0;
     Info.WalkState = WalkState;
+
     AcpiDmWalkParseTree (ParseTreeRoot, AcpiDmResourceDescendingOp,
         AcpiDmCommonAscendingOp, &Info);
     ACPI_FREE (WalkState);
@@ -396,7 +404,7 @@ AcpiDmDumpDescending (
         if (Op->Common.Value.String)
         {
             AcpiNsExternalizeName (ACPI_UINT32_MAX, Op->Common.Value.String,
-                            NULL, &Path);
+                NULL, &Path);
             AcpiOsPrintf ("%s %p", Path, Op->Common.Node);
             ACPI_FREE (Path);
         }
@@ -655,6 +663,7 @@ AcpiDmLoadDescendingOp (
         {
             NextOp = NextOp->Common.Next;
         }
+
         Path = NextOp->Common.Value.String;
     }
 
@@ -666,8 +675,8 @@ AcpiDmLoadDescendingOp (
     /* Insert the name into the namespace */
 
     Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
-                ACPI_IMODE_LOAD_PASS2, ACPI_NS_DONT_OPEN_SCOPE,
-                WalkState, &Node);
+        ACPI_IMODE_LOAD_PASS2, ACPI_NS_DONT_OPEN_SCOPE,
+        WalkState, &Node);
 
     Op->Common.Node = Node;
 
@@ -708,7 +717,8 @@ Exit:
     {
         if (Op->Common.Node)
         {
-            Status = AcpiDsScopeStackPush (Op->Common.Node, ObjectType, WalkState);
+            Status = AcpiDsScopeStackPush (Op->Common.Node, ObjectType,
+                WalkState);
             if (ACPI_FAILURE (Status))
             {
                 return (Status);
@@ -825,8 +835,8 @@ AcpiDmXrefDescendingOp (
      */
     Node = NULL;
     Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY,
-                ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
-                WalkState, &Node);
+        ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
+        WalkState, &Node);
     if (ACPI_SUCCESS (Status) && (Node->Flags & ANOBJ_IS_EXTERNAL))
     {
         /* Node was created by an External() statement */
@@ -908,7 +918,8 @@ Exit:
     {
         if (Op->Common.Node)
         {
-            Status = AcpiDsScopeStackPush (Op->Common.Node, ObjectType, WalkState);
+            Status = AcpiDsScopeStackPush (Op->Common.Node, ObjectType,
+                WalkState);
             if (ACPI_FAILURE (Status))
             {
                 return (Status);
@@ -956,7 +967,8 @@ AcpiDmResourceDescendingOp (
         if (Op->Common.Node)
         {
 
-            Status = AcpiDsScopeStackPush (Op->Common.Node, ObjectType, WalkState);
+            Status = AcpiDsScopeStackPush (Op->Common.Node, ObjectType,
+                WalkState);
             if (ACPI_FAILURE (Status))
             {
                 return (Status);
index d48ea40..a264ccb 100644 (file)
@@ -48,6 +48,7 @@
 #define _COMPONENT          ACPI_UTILITIES
         ACPI_MODULE_NAME    ("ahuuids")
 
+
 /*
  * Table of "known" (ACPI-related) UUIDs
  */
index 30beba3..e09550b 100644 (file)
@@ -140,7 +140,6 @@ AcpiDmGetObjectTypeName (
     {
         Type = ACPI_TYPE_DEVICE;
     }
-
     else if (Type > ACPI_TYPE_LOCAL_INDEX_FIELD)
     {
         return ("");
@@ -410,6 +409,7 @@ AcpiDmGetExternalsFromFile (
         {
             continue;
         }
+
         if (strcmp (Token, "External"))
         {
             continue;
@@ -447,6 +447,7 @@ AcpiDmGetExternalsFromFile (
             fprintf (stderr, "Invalid argument count (%s)\n", Token);
             continue;
         }
+
         if (ArgCount > 7)
         {
             fprintf (stderr, "Invalid argument count (%u)\n", ArgCount);
@@ -465,7 +466,8 @@ AcpiDmGetExternalsFromFile (
 
     if (!ImportCount)
     {
-        fprintf (stderr, "Did not find any external methods in reference file \"%s\"\n",
+        fprintf (stderr,
+            "Did not find any external methods in reference file \"%s\"\n",
             Gbl_ExternalRefFilename);
     }
     else
@@ -815,7 +817,8 @@ AcpiDmCreateNewExternal (
                 (Value > 0))
             {
                 ACPI_ERROR ((AE_INFO,
-                    "External method arg count mismatch %s: Current %u, attempted %u",
+                    "External method arg count mismatch %s: "
+                    "Current %u, attempted %u",
                     NextExternal->Path, NextExternal->Value, Value));
             }
 
@@ -917,9 +920,9 @@ AcpiDmAddExternalsToNamespace (
         /* Add the external name (object) into the namespace */
 
         Status = AcpiNsLookup (NULL, External->InternalPath, External->Type,
-                   ACPI_IMODE_LOAD_PASS1,
-                   ACPI_NS_ERROR_IF_FOUND | ACPI_NS_EXTERNAL | ACPI_NS_DONT_OPEN_SCOPE,
-                   NULL, &Node);
+            ACPI_IMODE_LOAD_PASS1,
+            ACPI_NS_ERROR_IF_FOUND | ACPI_NS_EXTERNAL | ACPI_NS_DONT_OPEN_SCOPE,
+            NULL, &Node);
 
         if (ACPI_FAILURE (Status))
         {
index de81db5..d051660 100644 (file)
@@ -498,9 +498,9 @@ AcpiDmCheckResourceReference (
     /* Lookup the buffer in the namespace */
 
     Status = AcpiNsLookup (WalkState->ScopeInfo,
-                BufferNameOp->Common.Value.String, ACPI_TYPE_BUFFER,
-                ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState,
-                &BufferNode);
+        BufferNameOp->Common.Value.String, ACPI_TYPE_BUFFER,
+        ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState,
+        &BufferNode);
     if (ACPI_FAILURE (Status))
     {
         return;
@@ -621,8 +621,8 @@ AcpiGetTagPathname (
 
     /* Get the individual resource descriptor and validate it */
 
-    Aml = ACPI_CAST_PTR (AML_RESOURCE,
-            &Op->Named.Data[ResourceNode->Value]);
+    Aml = ACPI_CAST_PTR (
+        AML_RESOURCE, &Op->Named.Data[ResourceNode->Value]);
 
     Status = AcpiUtValidateResource (NULL, Aml, &ResourceTableIndex);
     if (ACPI_FAILURE (Status))
@@ -663,7 +663,7 @@ AcpiGetTagPathname (
     }
 
     (void) AcpiNsBuildNormalizedPath (BufferNode, Pathname,
-            RequiredSize, FALSE);
+        RequiredSize, FALSE);
 
     /*
      * Create the full path to the resource and tag by: remove the buffer name,
@@ -742,6 +742,7 @@ AcpiDmUpdateResourceName (
     {
         AcpiGbl_NextResourceId = 0;
         AcpiGbl_NextPrefix++;
+
         if (AcpiGbl_NextPrefix > ACPI_NUM_RES_PREFIX)
         {
             AcpiGbl_NextPrefix = 0;
@@ -1028,9 +1029,9 @@ AcpiDmAddResourceToNamespace (
 
     ScopeInfo.Scope.Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Context);
     Status = AcpiNsLookup (&ScopeInfo, "_TMP", ACPI_TYPE_LOCAL_RESOURCE,
-                ACPI_IMODE_LOAD_PASS2,
-                ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_PREFIX_IS_SCOPE,
-                NULL, &Node);
+        ACPI_IMODE_LOAD_PASS2,
+        ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_PREFIX_IS_SCOPE,
+        NULL, &Node);
     if (ACPI_FAILURE (Status))
     {
         return (AE_OK);
index 3f9e64d..b66734c 100644 (file)
@@ -875,6 +875,7 @@ AcpiDmDumpTable (
                 AcpiOsPrintf ("\n");
                 LastOutputBlankLine = TRUE;
             }
+
             ByteLength = sizeof (ACPI_GENERIC_ADDRESS);
             break;
 
@@ -885,6 +886,7 @@ AcpiDmDumpTable (
                 AcpiOsPrintf ("\n");
                 LastOutputBlankLine = TRUE;
             }
+
             ByteLength = sizeof (ACPI_HEST_NOTIFY);
             break;
 
@@ -894,6 +896,7 @@ AcpiDmDumpTable (
             {
                 LastOutputBlankLine = FALSE;
             }
+
             ByteLength = sizeof (ACPI_IORT_MEMORY_ACCESS);
             break;
 
@@ -1027,6 +1030,7 @@ AcpiDmDumpTable (
                     }
                 }
             }
+
             AcpiOsPrintf ("\n");
             break;
 
@@ -1050,6 +1054,7 @@ AcpiDmDumpTable (
 
             AcpiDmCheckAscii (Target, RepairedName, 4);
             AcpiOsPrintf ("\"%.4s\"    ", RepairedName);
+
             TableData = AcpiAhGetTableInfo (ACPI_CAST_PTR (char, Target));
             if (TableData)
             {
@@ -1095,6 +1100,7 @@ AcpiDmDumpTable (
                 AcpiOsPrintf (
                     "     /* Incorrect checksum, should be %2.2X */", Temp8);
             }
+
             AcpiOsPrintf ("\n");
             break;
 
diff --git a/sys/contrib/dev/acpica/source/common/dmtables.c b/sys/contrib/dev/acpica/source/common/dmtables.c
new file mode 100644 (file)
index 0000000..0313068
--- /dev/null
@@ -0,0 +1,499 @@
+/******************************************************************************
+ *
+ * Module Name: dmtables - disassembler ACPI table support
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2015, 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 "acapps.h"
+#include "acdispat.h"
+#include "acnamesp.h"
+#include "actables.h"
+#include "acparser.h"
+
+#include <stdio.h>
+#include <time.h>
+
+#define _COMPONENT          ACPI_TOOLS
+        ACPI_MODULE_NAME    ("dmtables")
+
+
+/* Local prototypes */
+
+static void
+AdCreateTableHeader (
+    char                    *Filename,
+    ACPI_TABLE_HEADER       *Table);
+
+static ACPI_STATUS
+AdStoreTable (
+    ACPI_TABLE_HEADER       *Table,
+    UINT32                  *TableIndex);
+
+
+extern ACPI_TABLE_DESC      LocalTables[1];
+extern ACPI_PARSE_OBJECT    *AcpiGbl_ParseOpRoot;
+
+
+/******************************************************************************
+ *
+ * FUNCTION:    AdDisassemblerHeader
+ *
+ * PARAMETERS:  Filename            - Input file for the table
+ *              TableType           - Either AML or DataTable
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Create the disassembler header, including ACPICA signon with
+ *              current time and date.
+ *
+ *****************************************************************************/
+
+void
+AdDisassemblerHeader (
+    char                    *Filename,
+    UINT8                   TableType)
+{
+    time_t                  Timer;
+
+
+    time (&Timer);
+
+    /* Header and input table info */
+
+    AcpiOsPrintf ("/*\n");
+    AcpiOsPrintf (ACPI_COMMON_HEADER (AML_DISASSEMBLER_NAME, " * "));
+
+    if (TableType == ACPI_IS_AML_TABLE)
+    {
+        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");
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION:    AdCreateTableHeader
+ *
+ * PARAMETERS:  Filename            - Input file for the table
+ *              Table               - Pointer to the raw table
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Create the ASL table header, including ACPICA signon with
+ *              current time and date.
+ *
+ *****************************************************************************/
+
+static void
+AdCreateTableHeader (
+    char                    *Filename,
+    ACPI_TABLE_HEADER       *Table)
+{
+    char                    *NewFilename;
+    UINT8                   Checksum;
+
+
+    /*
+     * Print file header and dump original table header
+     */
+    AdDisassemblerHeader (Filename, ACPI_IS_AML_TABLE);
+
+    AcpiOsPrintf (" * Original Table Header:\n");
+    AcpiOsPrintf (" *     Signature        \"%4.4s\"\n",    Table->Signature);
+    AcpiOsPrintf (" *     Length           0x%8.8X (%u)\n", Table->Length, Table->Length);
+
+    /* Print and validate the revision */
+
+    AcpiOsPrintf (" *     Revision         0x%2.2X",      Table->Revision);
+
+    switch (Table->Revision)
+    {
+    case 0:
+
+        AcpiOsPrintf (" **** Invalid Revision");
+        break;
+
+    case 1:
+
+        /* Revision of DSDT controls the ACPI integer width */
+
+        if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_DSDT))
+        {
+            AcpiOsPrintf (" **** 32-bit table (V1), no 64-bit math support");
+        }
+        break;
+
+    default:
+
+        break;
+    }
+    AcpiOsPrintf ("\n");
+
+    /* Print and validate the table checksum */
+
+    AcpiOsPrintf (" *     Checksum         0x%2.2X",        Table->Checksum);
+
+    Checksum = AcpiTbChecksum (ACPI_CAST_PTR (UINT8, Table), Table->Length);
+    if (Checksum)
+    {
+        AcpiOsPrintf (" **** Incorrect checksum, should be 0x%2.2X",
+            (UINT8) (Table->Checksum - Checksum));
+    }
+
+    AcpiOsPrintf ("\n");
+    AcpiOsPrintf (" *     OEM ID           \"%.6s\"\n",     Table->OemId);
+    AcpiOsPrintf (" *     OEM Table ID     \"%.8s\"\n",     Table->OemTableId);
+    AcpiOsPrintf (" *     OEM Revision     0x%8.8X (%u)\n", Table->OemRevision, Table->OemRevision);
+    AcpiOsPrintf (" *     Compiler ID      \"%.4s\"\n",     Table->AslCompilerId);
+    AcpiOsPrintf (" *     Compiler Version 0x%8.8X (%u)\n", Table->AslCompilerRevision, Table->AslCompilerRevision);
+    AcpiOsPrintf (" */\n");
+
+    /* Create AML output filename based on input filename */
+
+    if (Filename)
+    {
+        NewFilename = FlGenerateFilename (Filename, "aml");
+    }
+    else
+    {
+        NewFilename = UtStringCacheCalloc (9);
+        if (NewFilename)
+        {
+            strncat (NewFilename, Table->Signature, 4);
+            strcat (NewFilename, ".aml");
+        }
+    }
+
+    if (!NewFilename)
+    {
+        AcpiOsPrintf (" **** Could not generate AML output filename\n");
+        return;
+    }
+
+    /* Open the ASL definition block */
+
+    AcpiOsPrintf (
+        "DefinitionBlock (\"%s\", \"%4.4s\", %hu, \"%.6s\", \"%.8s\", 0x%8.8X)\n",
+        NewFilename, Table->Signature, Table->Revision,
+        Table->OemId, Table->OemTableId, Table->OemRevision);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION:    AdDisplayTables
+ *
+ * PARAMETERS:  Filename            - Input file for the table
+ *              Table               - Pointer to the raw table
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Display (disassemble) loaded tables and dump raw tables
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AdDisplayTables (
+    char                    *Filename,
+    ACPI_TABLE_HEADER       *Table)
+{
+
+
+    if (!AcpiGbl_ParseOpRoot)
+    {
+        return (AE_NOT_EXIST);
+    }
+
+    if (!AcpiGbl_DmOpt_Listing)
+    {
+        AdCreateTableHeader (Filename, Table);
+    }
+
+    AcpiDmDisassemble (NULL, AcpiGbl_ParseOpRoot, ACPI_UINT32_MAX);
+    MpEmitMappingInfo ();
+
+    if (AcpiGbl_DmOpt_Listing)
+    {
+        AcpiOsPrintf ("\n\nTable Header:\n");
+        AcpiUtDebugDumpBuffer ((UINT8 *) Table, sizeof (ACPI_TABLE_HEADER),
+            DB_BYTE_DISPLAY, ACPI_UINT32_MAX);
+
+        AcpiOsPrintf ("Table Body (Length 0x%X)\n", Table->Length);
+        AcpiUtDebugDumpBuffer (((UINT8 *) Table + sizeof (ACPI_TABLE_HEADER)),
+            Table->Length, DB_BYTE_DISPLAY, ACPI_UINT32_MAX);
+    }
+
+    return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AdStoreTable
+ *
+ * PARAMETERS:  Table               - Table header
+ *              TableIndex          - Where the table index is returned
+ *
+ * RETURN:      Status and table index.
+ *
+ * DESCRIPTION: Add an ACPI table to the global table list
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AdStoreTable (
+    ACPI_TABLE_HEADER       *Table,
+    UINT32                  *TableIndex)
+{
+    ACPI_STATUS             Status;
+    ACPI_TABLE_DESC         *TableDesc;
+
+
+    Status = AcpiTbGetNextTableDescriptor (TableIndex, &TableDesc);
+    if (ACPI_FAILURE (Status))
+    {
+        return (Status);
+    }
+
+    /* Initialize added table */
+
+    AcpiTbInitTableDescriptor (TableDesc, ACPI_PTR_TO_PHYSADDR (Table),
+        ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL, Table);
+    Status = AcpiTbValidateTable (TableDesc);
+    return (Status);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION:    AdGetLocalTables
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Get the ACPI tables from either memory or a file
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AdGetLocalTables (
+    void)
+{
+    ACPI_STATUS             Status;
+    ACPI_TABLE_HEADER       TableHeader;
+    ACPI_TABLE_HEADER       *NewTable;
+    UINT32                  TableIndex;
+
+
+    /* Get the DSDT via table override */
+
+    ACPI_MOVE_32_TO_32 (TableHeader.Signature, ACPI_SIG_DSDT);
+    AcpiOsTableOverride (&TableHeader, &NewTable);
+    if (!NewTable)
+    {
+        fprintf (stderr, "Could not obtain DSDT\n");
+        return (AE_NO_ACPI_TABLES);
+    }
+
+    AdWriteTable (NewTable, NewTable->Length,
+        ACPI_SIG_DSDT, NewTable->OemTableId);
+
+    /* Store DSDT in the Table Manager */
+
+    Status = AdStoreTable (NewTable, &TableIndex);
+    if (ACPI_FAILURE (Status))
+    {
+        fprintf (stderr, "Could not store DSDT\n");
+        return (AE_NO_ACPI_TABLES);
+    }
+
+    return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION:    AdParseTable
+ *
+ * PARAMETERS:  Table               - Pointer to the raw table
+ *              OwnerId             - Returned OwnerId of the table
+ *              LoadTable           - If add table to the global table list
+ *              External            - If this is an external table
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Parse an ACPI AML table
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AdParseTable (
+    ACPI_TABLE_HEADER       *Table,
+    ACPI_OWNER_ID           *OwnerId,
+    BOOLEAN                 LoadTable,
+    BOOLEAN                 External)
+{
+    ACPI_STATUS             Status = AE_OK;
+    ACPI_WALK_STATE         *WalkState;
+    UINT8                   *AmlStart;
+    UINT32                  AmlLength;
+    UINT32                  TableIndex;
+
+
+    if (!Table)
+    {
+        return (AE_NOT_EXIST);
+    }
+
+    /* Pass 1:  Parse everything except control method bodies */
+
+    fprintf (stderr, "Pass 1 parse of [%4.4s]\n", (char *) Table->Signature);
+
+    AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER);
+    AmlStart = ((UINT8 *) Table + sizeof (ACPI_TABLE_HEADER));
+
+    /* Create the root object */
+
+    AcpiGbl_ParseOpRoot = AcpiPsCreateScopeOp (AmlStart);
+    if (!AcpiGbl_ParseOpRoot)
+    {
+        return (AE_NO_MEMORY);
+    }
+
+    /* Create and initialize a new walk state */
+
+    WalkState = AcpiDsCreateWalkState (0, AcpiGbl_ParseOpRoot, NULL, NULL);
+    if (!WalkState)
+    {
+        return (AE_NO_MEMORY);
+    }
+
+    Status = AcpiDsInitAmlWalk (WalkState, AcpiGbl_ParseOpRoot,
+        NULL, AmlStart, AmlLength, NULL, ACPI_IMODE_LOAD_PASS1);
+    if (ACPI_FAILURE (Status))
+    {
+        return (Status);
+    }
+
+    WalkState->ParseFlags &= ~ACPI_PARSE_DELETE_TREE;
+    WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE;
+
+    Status = AcpiPsParseAml (WalkState);
+    if (ACPI_FAILURE (Status))
+    {
+        return (Status);
+    }
+
+    /* If LoadTable is FALSE, we are parsing the last loaded table */
+
+    TableIndex = AcpiGbl_RootTableList.CurrentTableCount - 1;
+
+    /* Pass 2 */
+
+    if (LoadTable)
+    {
+        Status = AdStoreTable (Table, &TableIndex);
+        if (ACPI_FAILURE (Status))
+        {
+            return (Status);
+        }
+        Status = AcpiTbAllocateOwnerId (TableIndex);
+        if (ACPI_FAILURE (Status))
+        {
+            return (Status);
+        }
+        if (OwnerId)
+        {
+            Status = AcpiTbGetOwnerId (TableIndex, OwnerId);
+            if (ACPI_FAILURE (Status))
+            {
+                return (Status);
+            }
+        }
+    }
+
+    fprintf (stderr, "Pass 2 parse of [%4.4s]\n", (char *) Table->Signature);
+
+    Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS2, TableIndex, NULL);
+    if (ACPI_FAILURE (Status))
+    {
+        return (Status);
+    }
+
+    /* No need to parse control methods of external table */
+
+    if (External)
+    {
+        return (AE_OK);
+    }
+
+    /*
+     * Pass 3: Parse control methods and link their parse trees
+     * into the main parse tree
+     */
+    fprintf (stderr,
+        "Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions)\n");
+
+    Status = AcpiDmParseDeferredOps (AcpiGbl_ParseOpRoot);
+    fprintf (stderr, "\n");
+
+    /* Process Resource Templates */
+
+    AcpiDmFindResources (AcpiGbl_ParseOpRoot);
+
+    fprintf (stderr, "Parsing completed\n");
+    return (AE_OK);
+}
index 7ec19bc..2ae3ca7 100644 (file)
@@ -178,6 +178,7 @@ AcpiDmDumpUnicode (
     {
         AcpiOsPrintf ("%c", Buffer[i]);
     }
+
     AcpiOsPrintf ("\"\n");
     return;
 
@@ -222,7 +223,7 @@ AcpiDmDumpRsdp (
     /* Validate the first checksum */
 
     Checksum = AcpiDmGenerateChecksum (Rsdp, sizeof (ACPI_RSDP_COMMON),
-                Rsdp->Checksum);
+        Rsdp->Checksum);
     if (Checksum != Rsdp->Checksum)
     {
         AcpiOsPrintf ("/* Incorrect Checksum above, should be 0x%2.2X */\n",
@@ -243,7 +244,7 @@ AcpiDmDumpRsdp (
         /* Validate the extended checksum over entire RSDP */
 
         Checksum = AcpiDmGenerateChecksum (Rsdp, sizeof (ACPI_TABLE_RSDP),
-                    Rsdp->ExtendedChecksum);
+            Rsdp->ExtendedChecksum);
         if (Checksum != Rsdp->ExtendedChecksum)
         {
             AcpiOsPrintf (
@@ -361,7 +362,8 @@ AcpiDmDumpFadt (
 
     /* Always dump the minimum FADT revision 1 fields (ACPI 1.0) */
 
-    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt1);
+    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
+        AcpiDmTableInfoFadt1);
     if (ACPI_FAILURE (Status))
     {
         return;
@@ -372,7 +374,8 @@ AcpiDmDumpFadt (
     if ((Table->Length > ACPI_FADT_V1_SIZE) &&
         (Table->Length <= ACPI_FADT_V2_SIZE))
     {
-        Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt2);
+        Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
+            AcpiDmTableInfoFadt2);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -383,7 +386,8 @@ AcpiDmDumpFadt (
 
     else if (Table->Length > ACPI_FADT_V2_SIZE)
     {
-        Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt3);
+        Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
+            AcpiDmTableInfoFadt3);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -393,7 +397,8 @@ AcpiDmDumpFadt (
 
         if (Table->Length > ACPI_FADT_V3_SIZE)
         {
-            Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt5);
+            Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
+                AcpiDmTableInfoFadt5);
             if (ACPI_FAILURE (Status))
             {
                 return;
@@ -404,7 +409,8 @@ AcpiDmDumpFadt (
 
         if (Table->Length > ACPI_FADT_V3_SIZE)
         {
-            Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt6);
+            Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
+                AcpiDmTableInfoFadt6);
             if (ACPI_FAILURE (Status))
             {
                 return;
@@ -485,7 +491,8 @@ AcpiDmValidateFadtLength (
     }
 
     AcpiOsPrintf (
-        "\n// ACPI Warning: FADT revision %X does not match length: found %X expected %X\n",
+        "\n// ACPI Warning: FADT revision %X does not match length: "
+        "found %X expected %X\n",
         Revision, Length, ExpectedLength);
 }
 
@@ -527,7 +534,7 @@ AcpiDmDumpAsf (
         /* Common subtable header */
 
         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
-                    SubTable->Header.Length, AcpiDmTableInfoAsfHdr);
+            SubTable->Header.Length, AcpiDmTableInfoAsfHdr);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -579,12 +586,13 @@ AcpiDmDumpAsf (
 
         default:
 
-            AcpiOsPrintf ("\n**** Unknown ASF subtable type 0x%X\n", SubTable->Header.Type);
+            AcpiOsPrintf ("\n**** Unknown ASF subtable type 0x%X\n",
+                SubTable->Header.Type);
             return;
         }
 
         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
-                    SubTable->Header.Length, InfoTable);
+            SubTable->Header.Length, InfoTable);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -601,7 +609,7 @@ AcpiDmDumpAsf (
             {
                 AcpiOsPrintf ("\n");
                 Status = AcpiDmDumpTable (Table->Length, DataOffset,
-                            DataTable, DataLength, DataInfoTable);
+                    DataTable, DataLength, DataInfoTable);
                 if (ACPI_FAILURE (Status))
                 {
                     return;
@@ -624,9 +632,12 @@ AcpiDmDumpAsf (
                 AcpiOsPrintf ("%2.2X ", *DataTable);
                 DataTable++;
                 DataOffset++;
+
                 if (DataOffset > Table->Length)
                 {
-                    AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure! (ASF! table)\n");
+                    AcpiOsPrintf (
+                        "**** ACPI table terminates in the middle of a "
+                        "data structure! (ASF! table)\n");
                     return;
                 }
             }
@@ -650,7 +661,8 @@ AcpiDmDumpAsf (
         }
 
         Offset += SubTable->Header.Length;
-        SubTable = ACPI_ADD_PTR (ACPI_ASF_INFO, SubTable, SubTable->Header.Length);
+        SubTable = ACPI_ADD_PTR (ACPI_ASF_INFO, SubTable,
+            SubTable->Header.Length);
     }
 }
 
@@ -693,7 +705,7 @@ AcpiDmDumpCpep (
     {
         AcpiOsPrintf ("\n");
         Status = AcpiDmDumpTable (Length, Offset, SubTable,
-                    SubTable->Header.Length, AcpiDmTableInfoCpep0);
+            SubTable->Header.Length, AcpiDmTableInfoCpep0);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -703,7 +715,7 @@ AcpiDmDumpCpep (
 
         Offset += SubTable->Header.Length;
         SubTable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, SubTable,
-                    SubTable->Header.Length);
+            SubTable->Header.Length);
     }
 }
 
@@ -747,7 +759,7 @@ AcpiDmDumpCsrt (
 
         AcpiOsPrintf ("\n");
         Status = AcpiDmDumpTable (Length, Offset, SubTable,
-                    SubTable->Length, AcpiDmTableInfoCsrt0);
+            SubTable->Length, AcpiDmTableInfoCsrt0);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -761,7 +773,7 @@ AcpiDmDumpCsrt (
 
         AcpiOsPrintf ("\n");
         Status = AcpiDmDumpTable (Length, Offset + SubOffset, SharedInfoTable,
-                    sizeof (ACPI_CSRT_SHARED_INFO), AcpiDmTableInfoCsrt1);
+            sizeof (ACPI_CSRT_SHARED_INFO), AcpiDmTableInfoCsrt1);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -779,7 +791,7 @@ AcpiDmDumpCsrt (
         {
             AcpiOsPrintf ("\n");
             Status = AcpiDmDumpTable (Length, Offset + SubOffset, SubSubTable,
-                        SubSubTable->Length, AcpiDmTableInfoCsrt2);
+                SubSubTable->Length, AcpiDmTableInfoCsrt2);
             if (ACPI_FAILURE (Status))
             {
                 return;
@@ -793,8 +805,8 @@ AcpiDmDumpCsrt (
             if (InfoLength)
             {
                 Status = AcpiDmDumpTable (Length,
-                            Offset + SubOffset + SubSubOffset, Table,
-                            InfoLength, AcpiDmTableInfoCsrt2a);
+                    Offset + SubOffset + SubSubOffset, Table,
+                    InfoLength, AcpiDmTableInfoCsrt2a);
                 if (ACPI_FAILURE (Status))
                 {
                     return;
@@ -806,14 +818,14 @@ AcpiDmDumpCsrt (
 
             SubOffset += SubSubTable->Length;
             SubSubTable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, SubSubTable,
-                        SubSubTable->Length);
+                SubSubTable->Length);
         }
 
         /* Point to next subtable */
 
         Offset += SubTable->Length;
         SubTable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, SubTable,
-                    SubTable->Length);
+            SubTable->Length);
     }
 }
 
@@ -860,7 +872,7 @@ AcpiDmDumpDbg2 (
     {
         AcpiOsPrintf ("\n");
         Status = AcpiDmDumpTable (Length, Offset, SubTable,
-                    SubTable->Length, AcpiDmTableInfoDbg2Device);
+            SubTable->Length, AcpiDmTableInfoDbg2Device);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -876,7 +888,7 @@ AcpiDmDumpDbg2 (
             Array = (UINT8 *) SubTable + ArrayOffset;
 
             Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
-                        SubTable->Length, AcpiDmTableInfoDbg2Addr);
+                SubTable->Length, AcpiDmTableInfoDbg2Addr);
             if (ACPI_FAILURE (Status))
             {
                 return;
@@ -893,7 +905,7 @@ AcpiDmDumpDbg2 (
             Array = (UINT8 *) SubTable + ArrayOffset;
 
             Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
-                        SubTable->Length, AcpiDmTableInfoDbg2Size);
+                SubTable->Length, AcpiDmTableInfoDbg2Size);
             if (ACPI_FAILURE (Status))
             {
                 return;
@@ -908,7 +920,7 @@ AcpiDmDumpDbg2 (
         Array = (UINT8 *) SubTable + ArrayOffset;
 
         Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
-                    SubTable->Length, AcpiDmTableInfoDbg2Name);
+            SubTable->Length, AcpiDmTableInfoDbg2Name);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -919,8 +931,8 @@ AcpiDmDumpDbg2 (
         if (SubTable->OemDataOffset)
         {
             Status = AcpiDmDumpTable (Length, Offset + SubTable->OemDataOffset,
-                        Table, SubTable->OemDataLength,
-                        AcpiDmTableInfoDbg2OemData);
+                Table, SubTable->OemDataLength,
+                AcpiDmTableInfoDbg2OemData);
             if (ACPI_FAILURE (Status))
             {
                 return;
@@ -931,7 +943,7 @@ AcpiDmDumpDbg2 (
 
         Offset += SubTable->Length;
         SubTable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, SubTable,
-                    SubTable->Length);
+            SubTable->Length);
     }
 }
 
@@ -981,11 +993,12 @@ AcpiDmDumpDmar (
 
         AcpiOsPrintf ("\n");
         Status = AcpiDmDumpTable (Length, Offset, SubTable,
-                    SubTable->Length, AcpiDmTableInfoDmarHdr);
+            SubTable->Length, AcpiDmTableInfoDmarHdr);
         if (ACPI_FAILURE (Status))
         {
             return;
         }
+
         AcpiOsPrintf ("\n");
 
         switch (SubTable->Type)
@@ -1022,12 +1035,13 @@ AcpiDmDumpDmar (
 
         default:
 
-            AcpiOsPrintf ("\n**** Unknown DMAR subtable type 0x%X\n\n", SubTable->Type);
+            AcpiOsPrintf ("\n**** Unknown DMAR subtable type 0x%X\n\n",
+                SubTable->Type);
             return;
         }
 
         Status = AcpiDmDumpTable (Length, Offset, SubTable,
-                    SubTable->Length, InfoTable);
+            SubTable->Length, InfoTable);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -1049,7 +1063,7 @@ AcpiDmDumpDmar (
         {
             AcpiOsPrintf ("\n");
             Status = AcpiDmDumpTable (Length, Offset + ScopeOffset, ScopeTable,
-                        ScopeTable->Length, AcpiDmTableInfoDmarScope);
+                ScopeTable->Length, AcpiDmTableInfoDmarScope);
             if (ACPI_FAILURE (Status))
             {
                 return;
@@ -1065,7 +1079,8 @@ AcpiDmDumpDmar (
 
             while (PathOffset < ScopeTable->Length)
             {
-                AcpiDmLineHeader ((PathOffset + ScopeOffset + Offset), 2, "PCI Path");
+                AcpiDmLineHeader ((PathOffset + ScopeOffset + Offset), 2,
+                    "PCI Path");
                 AcpiOsPrintf ("%2.2X,%2.2X\n", PciPath[0], PciPath[1]);
 
                 /* Point to next PCI Path entry */
@@ -1086,7 +1101,8 @@ NextSubtable:
         /* Point to next subtable */
 
         Offset += SubTable->Length;
-        SubTable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, SubTable, SubTable->Length);
+        SubTable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, SubTable,
+            SubTable->Length);
     }
 }
 
@@ -1118,7 +1134,7 @@ AcpiDmDumpDrtm (
     /* Main table */
 
     Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
-                AcpiDmTableInfoDrtm);
+        AcpiDmTableInfoDrtm);
     if (ACPI_FAILURE (Status))
     {
         return;
@@ -1133,12 +1149,13 @@ AcpiDmDumpDrtm (
     DrtmVtl = ACPI_ADD_PTR (ACPI_DRTM_VTABLE_LIST, Table, Offset);
     AcpiOsPrintf ("\n");
     Status = AcpiDmDumpTable (Table->Length, Offset,
-                DrtmVtl, ACPI_OFFSET (ACPI_DRTM_VTABLE_LIST, ValidatedTables),
-                AcpiDmTableInfoDrtm0);
+        DrtmVtl, ACPI_OFFSET (ACPI_DRTM_VTABLE_LIST, ValidatedTables),
+        AcpiDmTableInfoDrtm0);
     if (ACPI_FAILURE (Status))
     {
             return;
     }
+
     Offset += ACPI_OFFSET (ACPI_DRTM_VTABLE_LIST, ValidatedTables);
 
     /* Dump Validated table addresses */
@@ -1148,12 +1165,13 @@ AcpiDmDumpDrtm (
             (DrtmVtl->ValidatedTableCount > Count))
     {
         Status = AcpiDmDumpTable (Table->Length, Offset,
-                    ACPI_ADD_PTR (void, Table, Offset), sizeof (UINT64),
-                    AcpiDmTableInfoDrtm0a);
+            ACPI_ADD_PTR (void, Table, Offset), sizeof (UINT64),
+            AcpiDmTableInfoDrtm0a);
         if (ACPI_FAILURE (Status))
         {
             return;
         }
+
         Offset += sizeof (UINT64);
         Count++;
     }
@@ -1163,8 +1181,8 @@ AcpiDmDumpDrtm (
     DrtmRl = ACPI_ADD_PTR (ACPI_DRTM_RESOURCE_LIST, Table, Offset);
     AcpiOsPrintf ("\n");
     Status = AcpiDmDumpTable (Table->Length, Offset,
-                DrtmRl, ACPI_OFFSET (ACPI_DRTM_RESOURCE_LIST, Resources),
-                AcpiDmTableInfoDrtm1);
+        DrtmRl, ACPI_OFFSET (ACPI_DRTM_RESOURCE_LIST, Resources),
+        AcpiDmTableInfoDrtm1);
     if (ACPI_FAILURE (Status))
     {
         return;
@@ -1179,9 +1197,8 @@ AcpiDmDumpDrtm (
            (DrtmRl->ResourceCount > Count))
     {
         Status = AcpiDmDumpTable (Table->Length, Offset,
-                    ACPI_ADD_PTR (void, Table, Offset),
-                    sizeof (ACPI_DRTM_RESOURCE),
-                    AcpiDmTableInfoDrtm1a);
+            ACPI_ADD_PTR (void, Table, Offset),
+            sizeof (ACPI_DRTM_RESOURCE), AcpiDmTableInfoDrtm1a);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -1196,8 +1213,7 @@ AcpiDmDumpDrtm (
     DrtmDps = ACPI_ADD_PTR (ACPI_DRTM_DPS_ID, Table, Offset);
     AcpiOsPrintf ("\n");
     (void) AcpiDmDumpTable (Table->Length, Offset,
-                DrtmDps, sizeof (ACPI_DRTM_DPS_ID),
-                AcpiDmTableInfoDrtm2);
+        DrtmDps, sizeof (ACPI_DRTM_DPS_ID), AcpiDmTableInfoDrtm2);
 }
 
 
@@ -1239,7 +1255,7 @@ AcpiDmDumpEinj (
     {
         AcpiOsPrintf ("\n");
         Status = AcpiDmDumpTable (Length, Offset, SubTable,
-                    sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoEinj0);
+            sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoEinj0);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -1249,7 +1265,7 @@ AcpiDmDumpEinj (
 
         Offset += sizeof (ACPI_WHEA_HEADER);
         SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, SubTable,
-                        sizeof (ACPI_WHEA_HEADER));
+            sizeof (ACPI_WHEA_HEADER));
     }
 }
 
@@ -1292,7 +1308,7 @@ AcpiDmDumpErst (
     {
         AcpiOsPrintf ("\n");
         Status = AcpiDmDumpTable (Length, Offset, SubTable,
-                    sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoErst0);
+            sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoErst0);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -1302,7 +1318,7 @@ AcpiDmDumpErst (
 
         Offset += sizeof (ACPI_WHEA_HEADER);
         SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, SubTable,
-                        sizeof (ACPI_WHEA_HEADER));
+            sizeof (ACPI_WHEA_HEADER));
     }
 }
 
@@ -1342,7 +1358,7 @@ AcpiDmDumpFpdt (
 
         AcpiOsPrintf ("\n");
         Status = AcpiDmDumpTable (Length, Offset, SubTable,
-                    SubTable->Length, AcpiDmTableInfoFpdtHdr);
+            SubTable->Length, AcpiDmTableInfoFpdtHdr);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -1362,7 +1378,8 @@ AcpiDmDumpFpdt (
 
         default:
 
-            AcpiOsPrintf ("\n**** Unknown FPDT subtable type 0x%X\n\n", SubTable->Type);
+            AcpiOsPrintf ("\n**** Unknown FPDT subtable type 0x%X\n\n",
+                SubTable->Type);
 
             /* Attempt to continue */
 
@@ -1375,7 +1392,7 @@ AcpiDmDumpFpdt (
         }
 
         Status = AcpiDmDumpTable (Length, Offset, SubTable,
-                    SubTable->Length, InfoTable);
+            SubTable->Length, InfoTable);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -1385,7 +1402,8 @@ NextSubTable:
         /* Point to next subtable */
 
         Offset += SubTable->Length;
-        SubTable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, SubTable, SubTable->Length);
+        SubTable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, SubTable,
+            SubTable->Length);
     }
 }
 
@@ -1434,7 +1452,7 @@ AcpiDmDumpGtdt (
 
         AcpiOsPrintf ("\n");
         Status = AcpiDmDumpTable (Length, Offset, SubTable,
-                    SubTable->Length, AcpiDmTableInfoGtdtHdr);
+            SubTable->Length, AcpiDmTableInfoGtdtHdr);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -1447,7 +1465,7 @@ AcpiDmDumpGtdt (
 
             SubTableLength = sizeof (ACPI_GTDT_TIMER_BLOCK);
             GtCount = (ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK,
-                        SubTable))->TimerCount;
+                SubTable))->TimerCount;
 
             InfoTable = AcpiDmTableInfoGtdt0;
             break;
@@ -1463,12 +1481,13 @@ AcpiDmDumpGtdt (
 
             /* Cannot continue on unknown type - no length */
 
-            AcpiOsPrintf ("\n**** Unknown GTDT subtable type 0x%X\n", SubTable->Type);
+            AcpiOsPrintf ("\n**** Unknown GTDT subtable type 0x%X\n",
+                SubTable->Type);
             return;
         }
 
         Status = AcpiDmDumpTable (Length, Offset, SubTable,
-                    SubTable->Length, InfoTable);
+            SubTable->Length, InfoTable);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -1482,14 +1501,15 @@ AcpiDmDumpGtdt (
 
         if (GtCount)
         {
-            GtxTable = ACPI_ADD_PTR (ACPI_GTDT_TIMER_ENTRY, SubTable, SubTableLength);
+            GtxTable = ACPI_ADD_PTR (
+                ACPI_GTDT_TIMER_ENTRY, SubTable, SubTableLength);
             SubTableLength += GtCount * sizeof (ACPI_GTDT_TIMER_ENTRY);
 
             while (GtCount)
             {
                 AcpiOsPrintf ("\n");
                 Status = AcpiDmDumpTable (Length, Offset, GtxTable,
-                            sizeof (ACPI_GTDT_TIMER_ENTRY), AcpiDmTableInfoGtdt0a);
+                    sizeof (ACPI_GTDT_TIMER_ENTRY), AcpiDmTableInfoGtdt0a);
                 if (ACPI_FAILURE (Status))
                 {
                     return;
@@ -1555,7 +1575,7 @@ AcpiDmDumpHest (
             InfoTable = AcpiDmTableInfoHest0;
             SubTableLength = sizeof (ACPI_HEST_IA_MACHINE_CHECK);
             BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_MACHINE_CHECK,
-                            SubTable))->NumHardwareBanks;
+                SubTable))->NumHardwareBanks;
             break;
 
         case ACPI_HEST_TYPE_IA32_CORRECTED_CHECK:
@@ -1563,7 +1583,7 @@ AcpiDmDumpHest (
             InfoTable = AcpiDmTableInfoHest1;
             SubTableLength = sizeof (ACPI_HEST_IA_CORRECTED);
             BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_CORRECTED,
-                            SubTable))->NumHardwareBanks;
+                SubTable))->NumHardwareBanks;
             break;
 
         case ACPI_HEST_TYPE_IA32_NMI:
@@ -1600,13 +1620,14 @@ AcpiDmDumpHest (
 
             /* Cannot continue on unknown type - no length */
 
-            AcpiOsPrintf ("\n**** Unknown HEST subtable type 0x%X\n", SubTable->Type);
+            AcpiOsPrintf ("\n**** Unknown HEST subtable type 0x%X\n",
+                SubTable->Type);
             return;
         }
 
         AcpiOsPrintf ("\n");
         Status = AcpiDmDumpTable (Length, Offset, SubTable,
-                    SubTableLength, InfoTable);
+            SubTableLength, InfoTable);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -1620,18 +1641,20 @@ AcpiDmDumpHest (
 
         if (BankCount)
         {
-            BankTable = ACPI_ADD_PTR (ACPI_HEST_IA_ERROR_BANK, SubTable, SubTableLength);
+            BankTable = ACPI_ADD_PTR (ACPI_HEST_IA_ERROR_BANK, SubTable,
+                SubTableLength);
             SubTableLength += BankCount * sizeof (ACPI_HEST_IA_ERROR_BANK);
 
             while (BankCount)
             {
                 AcpiOsPrintf ("\n");
                 Status = AcpiDmDumpTable (Length, Offset, BankTable,
-                            sizeof (ACPI_HEST_IA_ERROR_BANK), AcpiDmTableInfoHestBank);
+                    sizeof (ACPI_HEST_IA_ERROR_BANK), AcpiDmTableInfoHestBank);
                 if (ACPI_FAILURE (Status))
                 {
                     return;
                 }
+
                 Offset += sizeof (ACPI_HEST_IA_ERROR_BANK);
                 BankTable++;
                 BankCount--;
@@ -1690,7 +1713,7 @@ AcpiDmDumpIort (
     if (Iort->NodeOffset > Offset)
     {
         Status = AcpiDmDumpTable (Table->Length, Offset, Table,
-                    Iort->NodeOffset - Offset, AcpiDmTableInfoIortPad);
+            Iort->NodeOffset - Offset, AcpiDmTableInfoIortPad);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -1706,7 +1729,7 @@ AcpiDmDumpIort (
         AcpiOsPrintf ("\n");
         Length = ACPI_OFFSET (ACPI_IORT_NODE, NodeData);
         Status = AcpiDmDumpTable (Table->Length, Offset,
-                    IortNode, Length, AcpiDmTableInfoIortHdr);
+            IortNode, Length, AcpiDmTableInfoIortHdr);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -1763,8 +1786,8 @@ AcpiDmDumpIort (
 
         AcpiOsPrintf ("\n");
         Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
-                    ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
-                    Length, InfoTable);
+            ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
+            Length, InfoTable);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -1785,8 +1808,8 @@ AcpiDmDumpIort (
                 for (i = 0; i < IortItsGroup->ItsCount; i++)
                 {
                     Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
-                                ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
-                                4, AcpiDmTableInfoIort0a);
+                        ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
+                        4, AcpiDmTableInfoIort0a);
                     NodeOffset += 4;
                 }
             }
@@ -1799,8 +1822,8 @@ AcpiDmDumpIort (
             if (IortNode->Length > NodeOffset)
             {
                 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
-                            Table, IortNode->Length - NodeOffset,
-                            AcpiDmTableInfoIort1a);
+                    Table, IortNode->Length - NodeOffset,
+                    AcpiDmTableInfoIort1a);
                 if (ACPI_FAILURE (Status))
                 {
                     return;
@@ -1819,8 +1842,8 @@ AcpiDmDumpIort (
                 Length = 2 * sizeof (UINT64);
                 NodeOffset = IortSmmu->GlobalInterruptOffset;
                 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
-                            ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
-                            Length, AcpiDmTableInfoIort3a);
+                    ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
+                    Length, AcpiDmTableInfoIort3a);
                 if (ACPI_FAILURE (Status))
                 {
                     return;
@@ -1830,12 +1853,13 @@ AcpiDmDumpIort (
                 for (i = 0; i < IortSmmu->ContextInterruptCount; i++)
                 {
                     Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
-                                ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
-                                8, AcpiDmTableInfoIort3b);
+                        ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
+                        8, AcpiDmTableInfoIort3b);
                     if (ACPI_FAILURE (Status))
                     {
                         return;
                     }
+
                     NodeOffset += 8;
                 }
 
@@ -1843,12 +1867,13 @@ AcpiDmDumpIort (
                 for (i = 0; i < IortSmmu->PmuInterruptCount; i++)
                 {
                     Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
-                                ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
-                                8, AcpiDmTableInfoIort3c);
+                        ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
+                        8, AcpiDmTableInfoIort3c);
                     if (ACPI_FAILURE (Status))
                     {
                         return;
                     }
+
                     NodeOffset += 8;
                 }
             }
@@ -1867,12 +1892,13 @@ AcpiDmDumpIort (
             AcpiOsPrintf ("\n");
             Length = sizeof (ACPI_IORT_ID_MAPPING);
             Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
-                        ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
-                        Length, AcpiDmTableInfoIortMap);
+                ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
+                Length, AcpiDmTableInfoIortMap);
             if (ACPI_FAILURE (Status))
             {
                 return;
             }
+
             NodeOffset += Length;
         }
 
@@ -1930,7 +1956,7 @@ AcpiDmDumpIvrs (
 
         AcpiOsPrintf ("\n");
         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
-                    SubTable->Length, AcpiDmTableInfoIvrsHdr);
+            SubTable->Length, AcpiDmTableInfoIvrsHdr);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -1969,7 +1995,7 @@ AcpiDmDumpIvrs (
 
         AcpiOsPrintf ("\n");
         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
-                    SubTable->Length, InfoTable);
+            SubTable->Length, InfoTable);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -1981,7 +2007,7 @@ AcpiDmDumpIvrs (
         {
             EntryOffset = Offset + sizeof (ACPI_IVRS_HARDWARE);
             DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, SubTable,
-                            sizeof (ACPI_IVRS_HARDWARE));
+                sizeof (ACPI_IVRS_HARDWARE));
 
             while (EntryOffset < (Offset + SubTable->Length))
             {
@@ -2046,7 +2072,7 @@ AcpiDmDumpIvrs (
                 /* Dump the Device Entry */
 
                 Status = AcpiDmDumpTable (Table->Length, EntryOffset,
-                            DeviceEntry, EntryLength, InfoTable);
+                    DeviceEntry, EntryLength, InfoTable);
                 if (ACPI_FAILURE (Status))
                 {
                     return;
@@ -2054,7 +2080,7 @@ AcpiDmDumpIvrs (
 
                 EntryOffset += EntryLength;
                 DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, DeviceEntry,
-                                EntryLength);
+                    EntryLength);
             }
         }
 
@@ -2102,7 +2128,7 @@ AcpiDmDumpLpit (
         /* Common subtable header */
 
         Status = AcpiDmDumpTable (Length, Offset, SubTable,
-                    sizeof (ACPI_LPIT_HEADER), AcpiDmTableInfoLpitHdr);
+            sizeof (ACPI_LPIT_HEADER), AcpiDmTableInfoLpitHdr);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -2120,16 +2146,18 @@ AcpiDmDumpLpit (
 
             /* Cannot continue on unknown type - no length */
 
-            AcpiOsPrintf ("\n**** Unknown LPIT subtable type 0x%X\n", SubTable->Type);
+            AcpiOsPrintf ("\n**** Unknown LPIT subtable type 0x%X\n",
+                SubTable->Type);
             return;
         }
 
         Status = AcpiDmDumpTable (Length, Offset, SubTable,
-                    SubTableLength, InfoTable);
+            SubTableLength, InfoTable);
         if (ACPI_FAILURE (Status))
         {
             return;
         }
+
         AcpiOsPrintf ("\n");
 
         /* Point to next subtable */
@@ -2181,7 +2209,7 @@ AcpiDmDumpMadt (
 
         AcpiOsPrintf ("\n");
         Status = AcpiDmDumpTable (Length, Offset, SubTable,
-                    SubTable->Length, AcpiDmTableInfoMadtHdr);
+            SubTable->Length, AcpiDmTableInfoMadtHdr);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -2271,7 +2299,8 @@ AcpiDmDumpMadt (
 
         default:
 
-            AcpiOsPrintf ("\n**** Unknown MADT subtable type 0x%X\n\n", SubTable->Type);
+            AcpiOsPrintf ("\n**** Unknown MADT subtable type 0x%X\n\n",
+                SubTable->Type);
 
             /* Attempt to continue */
 
@@ -2280,11 +2309,12 @@ AcpiDmDumpMadt (
                 AcpiOsPrintf ("Invalid zero length subtable\n");
                 return;
             }
+
             goto NextSubTable;
         }
 
         Status = AcpiDmDumpTable (Length, Offset, SubTable,
-                    SubTable->Length, InfoTable);
+            SubTable->Length, InfoTable);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -2294,7 +2324,8 @@ NextSubTable:
         /* Point to next subtable */
 
         Offset += SubTable->Length;
-        SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, SubTable, SubTable->Length);
+        SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, SubTable,
+            SubTable->Length);
     }
 }
 
@@ -2342,7 +2373,7 @@ AcpiDmDumpMcfg (
 
         AcpiOsPrintf ("\n");
         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
-                    sizeof (ACPI_MCFG_ALLOCATION), AcpiDmTableInfoMcfg0);
+            sizeof (ACPI_MCFG_ALLOCATION), AcpiDmTableInfoMcfg0);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -2352,7 +2383,7 @@ AcpiDmDumpMcfg (
 
         Offset += sizeof (ACPI_MCFG_ALLOCATION);
         SubTable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, SubTable,
-                        sizeof (ACPI_MCFG_ALLOCATION));
+            sizeof (ACPI_MCFG_ALLOCATION));
     }
 }
 
@@ -2402,7 +2433,7 @@ AcpiDmDumpMpst (
     {
         AcpiOsPrintf ("\n");
         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable0,
-                    sizeof (ACPI_MPST_POWER_NODE), AcpiDmTableInfoMpst0);
+            sizeof (ACPI_MPST_POWER_NODE), AcpiDmTableInfoMpst0);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -2423,7 +2454,7 @@ AcpiDmDumpMpst (
         {
             AcpiOsPrintf ("\n");
             Status = AcpiDmDumpTable (Table->Length, Offset, SubTable0A,
-                        sizeof (ACPI_MPST_POWER_STATE), AcpiDmTableInfoMpst0A);
+                sizeof (ACPI_MPST_POWER_STATE), AcpiDmTableInfoMpst0A);
             if (ACPI_FAILURE (Status))
             {
                 return;
@@ -2446,7 +2477,7 @@ AcpiDmDumpMpst (
         while (ComponentCount)
         {
             Status = AcpiDmDumpTable (Table->Length, Offset, SubTable0B,
-                        sizeof (ACPI_MPST_COMPONENT), AcpiDmTableInfoMpst0B);
+                sizeof (ACPI_MPST_COMPONENT), AcpiDmTableInfoMpst0B);
             if (ACPI_FAILURE (Status))
             {
                 return;
@@ -2471,7 +2502,7 @@ AcpiDmDumpMpst (
     AcpiOsPrintf ("\n");
     SubTable1 = ACPI_CAST_PTR (ACPI_MPST_DATA_HDR, SubTable0);
     Status = AcpiDmDumpTable (Table->Length, Offset, SubTable1,
-                sizeof (ACPI_MPST_DATA_HDR), AcpiDmTableInfoMpst1);
+        sizeof (ACPI_MPST_DATA_HDR), AcpiDmTableInfoMpst1);
     if (ACPI_FAILURE (Status))
     {
         return;
@@ -2482,13 +2513,14 @@ AcpiDmDumpMpst (
 
     /* Subtable: Memory Power State Characteristics structure(s) */
 
-    SubTable2 = ACPI_ADD_PTR (ACPI_MPST_POWER_DATA, SubTable1, sizeof (ACPI_MPST_DATA_HDR));
+    SubTable2 = ACPI_ADD_PTR (ACPI_MPST_POWER_DATA, SubTable1,
+        sizeof (ACPI_MPST_DATA_HDR));
 
     while ((Offset < Table->Length) && SubtableCount)
     {
         AcpiOsPrintf ("\n");
         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable2,
-                    sizeof (ACPI_MPST_POWER_DATA), AcpiDmTableInfoMpst2);
+            sizeof (ACPI_MPST_POWER_DATA), AcpiDmTableInfoMpst2);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -2539,7 +2571,7 @@ AcpiDmDumpMsct (
 
         AcpiOsPrintf ("\n");
         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
-                    sizeof (ACPI_MSCT_PROXIMITY), AcpiDmTableInfoMsct0);
+            sizeof (ACPI_MSCT_PROXIMITY), AcpiDmTableInfoMsct0);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -2548,7 +2580,8 @@ AcpiDmDumpMsct (
         /* Point to next subtable */
 
         Offset += sizeof (ACPI_MSCT_PROXIMITY);
-        SubTable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, SubTable, sizeof (ACPI_MSCT_PROXIMITY));
+        SubTable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, SubTable,
+            sizeof (ACPI_MSCT_PROXIMITY));
     }
 }
 
@@ -2591,7 +2624,7 @@ AcpiDmDumpMtmr (
 
         AcpiOsPrintf ("\n");
         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
-                    sizeof (ACPI_MTMR_ENTRY), AcpiDmTableInfoMtmr0);
+            sizeof (ACPI_MTMR_ENTRY), AcpiDmTableInfoMtmr0);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -2600,7 +2633,8 @@ AcpiDmDumpMtmr (
         /* Point to next subtable */
 
         Offset += sizeof (ACPI_MTMR_ENTRY);
-        SubTable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, SubTable, sizeof (ACPI_MTMR_ENTRY));
+        SubTable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, SubTable,
+            sizeof (ACPI_MTMR_ENTRY));
     }
 }
 
@@ -2650,7 +2684,7 @@ AcpiDmDumpNfit (
 
         AcpiOsPrintf ("\n");
         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
-                    SubTable->Length, AcpiDmTableInfoNfitHdr);
+            SubTable->Length, AcpiDmTableInfoNfitHdr);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -2703,7 +2737,8 @@ AcpiDmDumpNfit (
             break;
 
         default:
-            AcpiOsPrintf ("\n**** Unknown NFIT subtable type 0x%X\n", SubTable->Type);
+            AcpiOsPrintf ("\n**** Unknown NFIT subtable type 0x%X\n",
+                SubTable->Type);
 
             /* Attempt to continue */
 
@@ -2717,7 +2752,7 @@ AcpiDmDumpNfit (
 
         AcpiOsPrintf ("\n");
         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
-                    SubTable->Length, InfoTable);
+            SubTable->Length, InfoTable);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -2732,8 +2767,8 @@ AcpiDmDumpNfit (
             for (i = 0; i < Interleave->LineCount; i++)
             {
                 Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
-                            &Interleave->LineOffset[i],
-                            sizeof (UINT32), AcpiDmTableInfoNfit2a);
+                    &Interleave->LineOffset[i],
+                    sizeof (UINT32), AcpiDmTableInfoNfit2a);
                 if (ACPI_FAILURE (Status))
                 {
                     return;
@@ -2745,13 +2780,15 @@ AcpiDmDumpNfit (
 
         case ACPI_NFIT_TYPE_SMBIOS:
 
-            Length = SubTable->Length - sizeof (ACPI_NFIT_SMBIOS) + sizeof (UINT8);
+            Length = SubTable->Length -
+                sizeof (ACPI_NFIT_SMBIOS) + sizeof (UINT8);
+
             if (Length)
             {
                 Status = AcpiDmDumpTable (Table->Length,
-                            sizeof (ACPI_NFIT_SMBIOS) - sizeof (UINT8),
-                            SmbiosInfo,
-                            Length, AcpiDmTableInfoNfit3a);
+                    sizeof (ACPI_NFIT_SMBIOS) - sizeof (UINT8),
+                    SmbiosInfo,
+                    Length, AcpiDmTableInfoNfit3a);
                 if (ACPI_FAILURE (Status))
                 {
                     return;
@@ -2765,8 +2802,8 @@ AcpiDmDumpNfit (
             for (i = 0; i < Hint->HintCount; i++)
             {
                 Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
-                            &Hint->HintAddress[i],
-                            sizeof (UINT64), AcpiDmTableInfoNfit6a);
+                    &Hint->HintAddress[i],
+                    sizeof (UINT64), AcpiDmTableInfoNfit6a);
                 if (ACPI_FAILURE (Status))
                 {
                     return;
@@ -2830,7 +2867,7 @@ AcpiDmDumpPcct (
 
         AcpiOsPrintf ("\n");
         Status = AcpiDmDumpTable (Length, Offset, SubTable,
-                    SubTable->Header.Length, AcpiDmTableInfoPcctHdr);
+            SubTable->Header.Length, AcpiDmTableInfoPcctHdr);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -2858,7 +2895,7 @@ AcpiDmDumpPcct (
 
         AcpiOsPrintf ("\n");
         Status = AcpiDmDumpTable (Length, Offset, SubTable,
-                    SubTable->Header.Length, InfoTable);
+            SubTable->Header.Length, InfoTable);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -2868,7 +2905,7 @@ AcpiDmDumpPcct (
 
         Offset += SubTable->Header.Length;
         SubTable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, SubTable,
-                    SubTable->Header.Length);
+            SubTable->Header.Length);
     }
 }
 
@@ -2920,7 +2957,7 @@ AcpiDmDumpPmtt (
 
         AcpiOsPrintf ("\n");
         Status = AcpiDmDumpTable (Length, Offset, SubTable,
-                    SubTable->Length, AcpiDmTableInfoPmttHdr);
+            SubTable->Length, AcpiDmTableInfoPmttHdr);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -2939,7 +2976,7 @@ AcpiDmDumpPmtt (
         /* Dump the fixed-length portion of the subtable */
 
         Status = AcpiDmDumpTable (Length, Offset, SubTable,
-                    SubTable->Length, AcpiDmTableInfoPmtt0);
+            SubTable->Length, AcpiDmTableInfoPmtt0);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -2958,8 +2995,8 @@ AcpiDmDumpPmtt (
 
             AcpiOsPrintf ("\n");
             Status = AcpiDmDumpTable (Length,
-                        Offset + MemOffset, MemSubTable,
-                        MemSubTable->Length, AcpiDmTableInfoPmttHdr);
+                Offset + MemOffset, MemSubTable,
+                MemSubTable->Length, AcpiDmTableInfoPmttHdr);
             if (ACPI_FAILURE (Status))
             {
                 return;
@@ -2978,8 +3015,8 @@ AcpiDmDumpPmtt (
             /* Dump the fixed-length portion of the controller subtable */
 
             Status = AcpiDmDumpTable (Length,
-                        Offset + MemOffset, MemSubTable,
-                        MemSubTable->Length, AcpiDmTableInfoPmtt1);
+                Offset + MemOffset, MemSubTable,
+                MemSubTable->Length, AcpiDmTableInfoPmtt1);
             if (ACPI_FAILURE (Status))
             {
                 return;
@@ -2997,8 +3034,8 @@ AcpiDmDumpPmtt (
                 DomainCount)
             {
                 Status = AcpiDmDumpTable (Length,
-                            Offset + MemOffset + DomainOffset, DomainArray,
-                            sizeof (ACPI_PMTT_DOMAIN), AcpiDmTableInfoPmtt1a);
+                    Offset + MemOffset + DomainOffset, DomainArray,
+                    sizeof (ACPI_PMTT_DOMAIN), AcpiDmTableInfoPmtt1a);
                 if (ACPI_FAILURE (Status))
                 {
                     return;
@@ -3028,8 +3065,8 @@ AcpiDmDumpPmtt (
 
                 AcpiOsPrintf ("\n");
                 Status = AcpiDmDumpTable (Length,
-                            Offset + MemOffset + DimmOffset, DimmSubTable,
-                            DimmSubTable->Length, AcpiDmTableInfoPmttHdr);
+                    Offset + MemOffset + DimmOffset, DimmSubTable,
+                    DimmSubTable->Length, AcpiDmTableInfoPmttHdr);
                 if (ACPI_FAILURE (Status))
                 {
                     return;
@@ -3048,8 +3085,8 @@ AcpiDmDumpPmtt (
                 /* Dump the fixed-length DIMM subtable */
 
                 Status = AcpiDmDumpTable (Length,
-                            Offset + MemOffset + DimmOffset, DimmSubTable,
-                            DimmSubTable->Length, AcpiDmTableInfoPmtt2);
+                    Offset + MemOffset + DimmOffset, DimmSubTable,
+                    DimmSubTable->Length, AcpiDmTableInfoPmtt2);
                 if (ACPI_FAILURE (Status))
                 {
                     return;
@@ -3116,7 +3153,7 @@ AcpiDmDumpS3pt (
 
         AcpiOsPrintf ("\n");
         Status = AcpiDmDumpTable (S3ptTable->Length, Offset, SubTable,
-                    SubTable->Length, AcpiDmTableInfoS3ptHdr);
+            SubTable->Length, AcpiDmTableInfoS3ptHdr);
         if (ACPI_FAILURE (Status))
         {
             return 0;
@@ -3136,7 +3173,8 @@ AcpiDmDumpS3pt (
 
         default:
 
-            AcpiOsPrintf ("\n**** Unknown S3PT subtable type 0x%X\n", SubTable->Type);
+            AcpiOsPrintf ("\n**** Unknown S3PT subtable type 0x%X\n",
+                SubTable->Type);
 
             /* Attempt to continue */
 
@@ -3150,7 +3188,7 @@ AcpiDmDumpS3pt (
 
         AcpiOsPrintf ("\n");
         Status = AcpiDmDumpTable (S3ptTable->Length, Offset, SubTable,
-                    SubTable->Length, InfoTable);
+            SubTable->Length, InfoTable);
         if (ACPI_FAILURE (Status))
         {
             return 0;
@@ -3183,8 +3221,9 @@ void
 AcpiDmDumpSlic (
     ACPI_TABLE_HEADER       *Table)
 {
+
     (void) AcpiDmDumpTable (Table->Length, sizeof (ACPI_TABLE_HEADER), Table,
-                Table->Length - sizeof (*Table), AcpiDmTableInfoSlic);
+        Table->Length - sizeof (*Table), AcpiDmTableInfoSlic);
 }
 
 
@@ -3237,7 +3276,8 @@ AcpiDmDumpSlit (
 
             if (Offset >= Table->Length)
             {
-                AcpiOsPrintf ("\n**** Not enough room in table for all localities\n");
+                AcpiOsPrintf (
+                    "\n**** Not enough room in table for all localities\n");
                 return;
             }
 
@@ -3305,7 +3345,7 @@ AcpiDmDumpSrat (
 
         AcpiOsPrintf ("\n");
         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
-                    SubTable->Length, AcpiDmTableInfoSratHdr);
+            SubTable->Length, AcpiDmTableInfoSratHdr);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -3334,7 +3374,8 @@ AcpiDmDumpSrat (
             break;
 
         default:
-            AcpiOsPrintf ("\n**** Unknown SRAT subtable type 0x%X\n", SubTable->Type);
+            AcpiOsPrintf ("\n**** Unknown SRAT subtable type 0x%X\n",
+                SubTable->Type);
 
             /* Attempt to continue */
 
@@ -3348,7 +3389,7 @@ AcpiDmDumpSrat (
 
         AcpiOsPrintf ("\n");
         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
-                    SubTable->Length, InfoTable);
+            SubTable->Length, InfoTable);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -3358,7 +3399,8 @@ NextSubTable:
         /* Point to next subtable */
 
         Offset += SubTable->Length;
-        SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, SubTable, SubTable->Length);
+        SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, SubTable,
+            SubTable->Length);
     }
 }
 
@@ -3522,7 +3564,7 @@ AcpiDmDumpVrtc (
 
         AcpiOsPrintf ("\n");
         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
-                    sizeof (ACPI_VRTC_ENTRY), AcpiDmTableInfoVrtc0);
+            sizeof (ACPI_VRTC_ENTRY), AcpiDmTableInfoVrtc0);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -3531,7 +3573,8 @@ AcpiDmDumpVrtc (
         /* Point to next subtable */
 
         Offset += sizeof (ACPI_VRTC_ENTRY);
-        SubTable = ACPI_ADD_PTR (ACPI_VRTC_ENTRY, SubTable, sizeof (ACPI_VRTC_ENTRY));
+        SubTable = ACPI_ADD_PTR (ACPI_VRTC_ENTRY, SubTable,
+            sizeof (ACPI_VRTC_ENTRY));
     }
 }
 
@@ -3574,7 +3617,7 @@ AcpiDmDumpWdat (
 
         AcpiOsPrintf ("\n");
         Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
-                    sizeof (ACPI_WDAT_ENTRY), AcpiDmTableInfoWdat0);
+            sizeof (ACPI_WDAT_ENTRY), AcpiDmTableInfoWdat0);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -3583,10 +3626,12 @@ AcpiDmDumpWdat (
         /* Point to next subtable */
 
         Offset += sizeof (ACPI_WDAT_ENTRY);
-        SubTable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, SubTable, sizeof (ACPI_WDAT_ENTRY));
+        SubTable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, SubTable,
+            sizeof (ACPI_WDAT_ENTRY));
     }
 }
 
+
 /*******************************************************************************
  *
  * FUNCTION:    AcpiDmDumpWpbt
index df06972..e5b7217 100644 (file)
@@ -90,6 +90,7 @@ AcpiGetoptArgument (
     int                     argc,
     char                    **argv)
 {
+
     AcpiGbl_Optind--;
     CurrentCharPtr++;
 
@@ -182,7 +183,8 @@ AcpiGetopt(
         }
         else if (++AcpiGbl_Optind >= argc)
         {
-            ACPI_OPTION_ERROR ("Option requires an argument: -", CurrentChar);
+            ACPI_OPTION_ERROR (
+                "Option requires an argument: -", CurrentChar);
 
             CurrentCharPtr = 1;
             return ('?');
@@ -243,7 +245,9 @@ AcpiGetopt(
         }
         else
         {
-            ACPI_OPTION_ERROR ("Option requires a single-character suboption: -", CurrentChar);
+            ACPI_OPTION_ERROR (
+                "Option requires a single-character suboption: -",
+                CurrentChar);
 
             CurrentCharPtr = 1;
             return ('?');
index 45c4431..fd71763 100644 (file)
@@ -139,8 +139,7 @@ AnCheckId (
     Length = strlen (Op->Asl.Value.String);
     if (!Length)
     {
-        AslError (ASL_ERROR, ASL_MSG_NULL_STRING,
-            Op, NULL);
+        AslError (ASL_ERROR, ASL_MSG_NULL_STRING, Op, NULL);
         return;
     }
 
@@ -191,7 +190,7 @@ AnCheckId (
         return;
     }
 
-    /* _HID Length is valid (7 or 8), now check the prefix (first 3 or 4 chars) */
+    /* _HID Length is valid (7 or 8), now check prefix (first 3 or 4 chars) */
 
     if (Length == 7)
     {
@@ -231,8 +230,8 @@ AnCheckId (
     {
         if (!isxdigit ((int) Op->Asl.Value.String[i]))
         {
-         AslError (ASL_ERROR, ASL_MSG_HID_SUFFIX,
-            Op, &Op->Asl.Value.String[i]);
+            AslError (ASL_ERROR, ASL_MSG_HID_SUFFIX,
+                Op, &Op->Asl.Value.String[i]);
             break;
         }
     }
@@ -323,7 +322,8 @@ AnCheckMethodReturnValue (
     {
         /* Method SOMETIMES returns a value, SOMETIMES not */
 
-        AslError (ASL_WARNING, ASL_MSG_SOME_NO_RETVAL, Op, Op->Asl.ExternalName);
+        AslError (ASL_WARNING, ASL_MSG_SOME_NO_RETVAL,
+            Op, Op->Asl.ExternalName);
     }
     else if (!(ThisNodeBtype & RequiredBtypes))
     {
@@ -400,12 +400,13 @@ AnIsResultUsed (
         {
             return (TRUE);
         }
+
         return (FALSE);
 
     /* Not used if one of these is the parent */
 
     case PARSEOP_METHOD:
-    case PARSEOP_DEFINITIONBLOCK:
+    case PARSEOP_DEFINITION_BLOCK:
     case PARSEOP_ELSE:
 
         return (FALSE);
index 4b6fd4f..ed54635 100644 (file)
@@ -78,7 +78,6 @@ AnMapArgTypeToBtype (
 
     switch (ArgType)
     {
-
     /* Simple types */
 
     case ARGI_ANYTYPE:
@@ -221,7 +220,6 @@ AnMapEtypeToBtype (
     UINT32                  Etype)
 {
 
-
     if (Etype == ACPI_TYPE_ANY)
     {
         return (ACPI_BTYPE_OBJECTS_AND_REFS);
@@ -328,7 +326,6 @@ AnFormatBtype (
 
 
     *Buffer = 0;
-
     if (Btype == 0)
     {
         strcat (Buffer, "NoReturnValue");
@@ -343,6 +340,7 @@ AnFormatBtype (
             {
                 strcat (Buffer, "|");
             }
+
             First = FALSE;
             strcat (Buffer, AcpiUtGetTypeName (Type));
         }
@@ -355,6 +353,7 @@ AnFormatBtype (
         {
             strcat (Buffer, "|");
         }
+
         First = FALSE;
         strcat (Buffer, "Reference");
     }
@@ -366,6 +365,7 @@ AnFormatBtype (
         {
             strcat (Buffer, "|");
         }
+
         First = FALSE;
         strcat (Buffer, "Resource");
     }
@@ -409,7 +409,8 @@ AnGetBtype (
         if (!Node)
         {
             DbgPrint (ASL_DEBUG_OUTPUT,
-                "No attached Nsnode: [%s] at line %u name [%s], ignoring typecheck\n",
+                "No attached Nsnode: [%s] at line %u name [%s], "
+                "ignoring typecheck\n",
                 Op->Asl.ParseOpName, Op->Asl.LineNumber,
                 Op->Asl.ExternalName);
             return (ACPI_UINT32_MAX);
@@ -457,6 +458,7 @@ AnGetBtype (
     return (ThisNodeBtype);
 }
 
+
 /*******************************************************************************
  *
  * FUNCTION:    AnMapObjTypeToBtype
index dc8b7d5..cb3a4a5 100644 (file)
@@ -168,28 +168,28 @@ CgAmlWriteWalk (
     }
 
     DbgPrint (ASL_TREE_OUTPUT,
-    "%08X %04X %04X %01X     %04X  %04X %04X   %04X    "
-    "%08X %08X %08X %08X %08X %08X %04X  %02d  %02d   %02d   %02d   %02d\n",
-            /* 1  */ (UINT32) Op->Asl.Value.Integer,
-            /* 2  */ Op->Asl.ParseOpcode,
-            /* 3  */ Op->Asl.AmlOpcode,
-            /* 4  */ Op->Asl.AmlOpcodeLength,
-            /* 5  */ Op->Asl.AmlPkgLenBytes,
-            /* 6  */ Op->Asl.AmlLength,
-            /* 7  */ Op->Asl.AmlSubtreeLength,
-            /* 8  */ Op->Asl.Parent ? Op->Asl.Parent->Asl.AmlSubtreeLength : 0,
-            /* 9  */ Op,
-            /* 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,
-            /* 18 */ Op->Asl.EndLine,
-            /* 19 */ Op->Asl.LogicalLineNumber,
-            /* 20 */ Op->Asl.EndLogicalLine);
+        "%08X %04X %04X %01X     %04X  %04X %04X   %04X    "
+        "%08X %08X %08X %08X %08X %08X %04X  %02d  %02d   %02d   %02d   %02d\n",
+        /* 1  */ (UINT32) Op->Asl.Value.Integer,
+        /* 2  */ Op->Asl.ParseOpcode,
+        /* 3  */ Op->Asl.AmlOpcode,
+        /* 4  */ Op->Asl.AmlOpcodeLength,
+        /* 5  */ Op->Asl.AmlPkgLenBytes,
+        /* 6  */ Op->Asl.AmlLength,
+        /* 7  */ Op->Asl.AmlSubtreeLength,
+        /* 8  */ Op->Asl.Parent ? Op->Asl.Parent->Asl.AmlSubtreeLength : 0,
+        /* 9  */ Op,
+        /* 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,
+        /* 18 */ Op->Asl.EndLine,
+        /* 19 */ Op->Asl.LogicalLineNumber,
+        /* 20 */ Op->Asl.EndLogicalLine);
 
     /* Generate the AML for this node */
 
@@ -274,7 +274,8 @@ CgWriteAmlOpcode (
         /* These opcodes should not get here */
 
         printf ("Found a node with an unassigned AML opcode\n");
-        FlPrintFile (ASL_FILE_STDERR, "Found a node with an unassigned AML opcode\n");
+        FlPrintFile (ASL_FILE_STDERR,
+            "Found a node with an unassigned AML opcode\n");
         return;
 
     case AML_INT_RESERVEDFIELD_OP:
@@ -357,8 +358,10 @@ CgWriteAmlOpcode (
              */
             PkgLen.Len >>= 4;
 
-            /* Now we can write the remaining bytes - either 1, 2, or 3 bytes */
-
+            /*
+             * Now we can write the remaining bytes -
+             * either 1, 2, or 3 bytes
+             */
             for (i = 0; i < (UINT32) (Op->Asl.AmlPkgLenBytes - 1); i++)
             {
                 CgLocalWriteAmlData (Op, &PkgLen.LenBytes[i], 1);
@@ -467,50 +470,100 @@ CgWriteTableHeader (
 
     /* Table length. Checksum zero for now, will rewrite later */
 
-    TableHeader.Length   = Gbl_TableLength;
+    TableHeader.Length = sizeof (ACPI_TABLE_HEADER) +
+        Op->Asl.AmlSubtreeLength;
     TableHeader.Checksum = 0;
 
+    Op->Asl.FinalAmlOffset = ftell (Gbl_Files[ASL_FILE_AML_OUTPUT].Handle);
+
+    /* Write entire header and clear the table header global */
+
     CgLocalWriteAmlData (Op, &TableHeader, sizeof (ACPI_TABLE_HEADER));
+    memset (&TableHeader, 0, sizeof (ACPI_TABLE_HEADER));
 }
 
 
 /*******************************************************************************
  *
- * FUNCTION:    CgCloseTable
+ * FUNCTION:    CgUpdateHeader
  *
- * PARAMETERS:  None.
+ * PARAMETERS:  Op                  - Op for the Definition Block
  *
  * RETURN:      None.
  *
  * DESCRIPTION: Complete the ACPI table by calculating the checksum and
- *              re-writing the header.
+ *              re-writing the header for the input definition block
  *
  ******************************************************************************/
 
 static void
-CgCloseTable (
-    void)
+CgUpdateHeader (
+    ACPI_PARSE_OBJECT   *Op)
 {
     signed char         Sum;
+    UINT32              i;
+    UINT32              Length;
     UINT8               FileByte;
+    UINT8               Checksum;
 
 
-    FlSeekFile (ASL_FILE_AML_OUTPUT, 0);
-    Sum = 0;
+    /* Calculate the checksum over the entire definition block */
 
-    /* Calculate the checksum over the entire file */
+    Sum = 0;
+    Length = sizeof (ACPI_TABLE_HEADER) + Op->Asl.AmlSubtreeLength;
+    FlSeekFile (ASL_FILE_AML_OUTPUT, Op->Asl.FinalAmlOffset);
 
-    while (FlReadFile (ASL_FILE_AML_OUTPUT, &FileByte, 1) == AE_OK)
+    for (i = 0; i < Length; i++)
     {
+        if (FlReadFile (ASL_FILE_AML_OUTPUT, &FileByte, 1) != AE_OK)
+        {
+            printf ("EOF while reading checksum bytes\n");
+            return;
+        }
+
         Sum = (signed char) (Sum + FileByte);
     }
 
-    /* Re-write the table header with the checksum */
+    Checksum = (UINT8) (0 - Sum);
+
+    /* Re-write the the checksum byte */
 
-    TableHeader.Checksum = (UINT8) (0 - Sum);
+    FlSeekFile (ASL_FILE_AML_OUTPUT, Op->Asl.FinalAmlOffset +
+        ACPI_OFFSET (ACPI_TABLE_HEADER, Checksum));
 
-    FlSeekFile (ASL_FILE_AML_OUTPUT, 0);
-    CgLocalWriteAmlData (NULL, &TableHeader, sizeof (ACPI_TABLE_HEADER));
+    FlWriteFile (ASL_FILE_AML_OUTPUT, &Checksum, 1);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    CgCloseTable
+ *
+ * PARAMETERS:  None.
+ *
+ * RETURN:      None.
+ *
+ * DESCRIPTION: Complete the ACPI table by calculating the checksum and
+ *              re-writing each table header. This allows support for
+ *              multiple definition blocks in a single source file.
+ *
+ ******************************************************************************/
+
+static void
+CgCloseTable (
+    void)
+{
+    ACPI_PARSE_OBJECT   *Op;
+
+
+    /* Process all definition blocks */
+
+    Op = RootNode->Asl.Child;
+    while (Op)
+    {
+        CgUpdateHeader (Op);
+        Op = Op->Asl.Next;
+    }
 }
 
 
@@ -586,7 +639,7 @@ CgWriteNode (
 
         break;
 
-    case PARSEOP_DEFINITIONBLOCK:
+    case PARSEOP_DEFINITION_BLOCK:
 
         CgWriteTableHeader (Op);
         break;
index a45814e..a564f86 100644 (file)
@@ -130,7 +130,8 @@ CmDoCompile (
 
     if (Gbl_SyntaxError)
     {
-        fprintf (stderr, "Compiler aborting due to parser-detected syntax error(s)\n");
+        fprintf (stderr,
+            "Compiler aborting due to parser-detected syntax error(s)\n");
         LsDumpParseTree ();
         goto ErrorExit;
     }
@@ -165,7 +166,7 @@ CmDoCompile (
 
     LsDumpParseTree ();
 
-    OpcGetIntegerWidth (RootNode);
+    OpcGetIntegerWidth (RootNode->Asl.Child);
     UtEndEvent (Event);
 
     /* Pre-process parse tree for any operator transforms */
@@ -186,8 +187,8 @@ CmDoCompile (
 
     /*
      * Now that the input is parsed, we can open the AML output file.
-     * Note: by default, the name of this file comes from the table descriptor
-     * within the input file.
+     * Note: by default, the name of this file comes from the table
+     * descriptor within the input file.
      */
     Event = UtBeginEvent ("Open AML output file");
     Status = FlOpenAmlOutputFile (Gbl_OutputFilenamePrefix);
@@ -263,7 +264,8 @@ CmDoCompile (
 
     /* Namespace cross-reference */
 
-    AslGbl_NamespaceEvent = UtBeginEvent ("Cross reference parse tree and Namespace");
+    AslGbl_NamespaceEvent = UtBeginEvent (
+        "Cross reference parse tree and Namespace");
     Status = XfCrossReferenceNamespace ();
     if (ACPI_FAILURE (Status))
     {
@@ -301,7 +303,8 @@ CmDoCompile (
     /* Semantic error checking part three - operand type checking */
 
     Event = UtBeginEvent ("Analyze AML operand types");
-    DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - Operand type checking\n\n");
+    DbgPrint (ASL_DEBUG_OUTPUT,
+        "\nSemantic analysis - Operand type checking\n\n");
     if (Gbl_DoTypechecking)
     {
         TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD,
@@ -590,8 +593,8 @@ CmDumpAllEvents (
 {
     ASL_EVENT_INFO          *Event;
     UINT32                  Delta;
-    UINT32                  USec;
-    UINT32                  MSec;
+    UINT32                  MicroSeconds;
+    UINT32                  MilliSeconds;
     UINT32                  i;
 
 
@@ -611,23 +614,23 @@ CmDumpAllEvents (
 
             Delta = (UINT32) (Event->EndTime - Event->StartTime);
 
-            USec = Delta / ACPI_100NSEC_PER_USEC;
-            MSec = Delta / ACPI_100NSEC_PER_MSEC;
+            MicroSeconds = Delta / ACPI_100NSEC_PER_USEC;
+            MilliSeconds = Delta / ACPI_100NSEC_PER_MSEC;
 
             /* Round milliseconds up */
 
-            if ((USec - (MSec * ACPI_USEC_PER_MSEC)) >= 500)
+            if ((MicroSeconds - (MilliSeconds * ACPI_USEC_PER_MSEC)) >= 500)
             {
-                MSec++;
+                MilliSeconds++;
             }
 
             DbgPrint (ASL_DEBUG_OUTPUT, "%8u usec %8u msec - %s\n",
-                USec, MSec, Event->EventName);
+                MicroSeconds, MilliSeconds, Event->EventName);
 
             if (Gbl_CompileTimesFlag)
             {
                 printf ("%8u usec %8u msec - %s\n",
-                    USec, MSec, Event->EventName);
+                    MicroSeconds, MilliSeconds, Event->EventName);
             }
         }
 
index 37e99ae..b9796a6 100644 (file)
@@ -210,7 +210,7 @@ NamePathTail                [.]{NameSeg}
 "Debug"                     { count (1); return (PARSEOP_DEBUG); }
 "Decrement"                 { count (3); return (PARSEOP_DECREMENT); }
 "Default"                   { count (3); return (PARSEOP_DEFAULT); }
-"DefinitionBlock"           { count (1); return (PARSEOP_DEFINITIONBLOCK); }
+"DefinitionBlock"           { count (1); return (PARSEOP_DEFINITION_BLOCK); }
 "DeRefOf"                   { count (3); return (PARSEOP_DEREFOF); }
 "Device"                    { count (2); return (PARSEOP_DEVICE); }
 "Divide"                    { count (3); return (PARSEOP_DIVIDE); }
index 4f430d1..2c0516a 100644 (file)
@@ -267,8 +267,10 @@ AePrintException (
 
     if (!Enode->SourceLine)
     {
-        /* Use the merged header/source file if present, otherwise use input file */
-
+        /*
+         * Use the merged header/source file if present, otherwise
+         * use input file
+         */
         SourceFile = Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle;
         if (!SourceFile)
         {
@@ -314,18 +316,18 @@ AePrintException (
                     fprintf (OutputFile, " %6u: ", Enode->LineNumber);
 
                     /*
-                     * If not at EOF, get the corresponding source code line and
-                     * display it. Don't attempt this if we have a premature EOF
-                     * condition.
+                     * If not at EOF, get the corresponding source code line
+                     * and display it. Don't attempt this if we have a
+                     * premature EOF condition.
                      */
                     if (!PrematureEOF)
                     {
                         /*
-                         * Seek to the offset in the combined source file, read
-                         * the source line, and write it to the output.
+                         * Seek to the offset in the combined source file,
+                         * read the source line, and write it to the output.
                          */
-                        Actual = fseek (SourceFile, (long) Enode->LogicalByteOffset,
-                                    (int) SEEK_SET);
+                        Actual = fseek (SourceFile,
+                            (long) Enode->LogicalByteOffset, (int) SEEK_SET);
                         if (Actual)
                         {
                             fprintf (OutputFile,
@@ -880,16 +882,17 @@ AslCoreSubsystemError (
 
     if (Op)
     {
-        AslCommonError (ASL_ERROR, ASL_MSG_CORE_EXCEPTION, Op->Asl.LineNumber,
-                        Op->Asl.LogicalLineNumber,
-                        Op->Asl.LogicalByteOffset,
-                        Op->Asl.Column,
-                        Op->Asl.Filename, MsgBuffer);
+        AslCommonError (ASL_ERROR, ASL_MSG_CORE_EXCEPTION,
+            Op->Asl.LineNumber,
+            Op->Asl.LogicalLineNumber,
+            Op->Asl.LogicalByteOffset,
+            Op->Asl.Column,
+            Op->Asl.Filename, MsgBuffer);
     }
     else
     {
-        AslCommonError (ASL_ERROR, ASL_MSG_CORE_EXCEPTION, 0,
-                        0, 0, 0, NULL, MsgBuffer);
+        AslCommonError (ASL_ERROR, ASL_MSG_CORE_EXCEPTION,
+            0, 0, 0, 0, NULL, MsgBuffer);
     }
 
     if (Abort)
index 4db97a6..676eaf1 100644 (file)
@@ -70,6 +70,7 @@ FlFileError (
 
     sprintf (MsgBuffer, "\"%s\" (%s) - %s", Gbl_Files[FileId].Filename,
         Gbl_Files[FileId].Description, strerror (errno));
+
     AslCommonError (ASL_ERROR, ErrorId, 0, 0, 0, 0, NULL, MsgBuffer);
 }
 
@@ -269,7 +270,8 @@ FlPrintFile (
         AslAbort ();
     }
 
-    if ((FileId == ASL_FILE_PREPROCESSOR) && Gbl_PreprocessorOutputFlag)
+    if ((FileId == ASL_FILE_PREPROCESSOR) &&
+        Gbl_PreprocessorOutputFlag)
     {
         /*
          * Duplicate the output to the user preprocessor (.i) file,
@@ -291,7 +293,6 @@ FlPrintFile (
             AslAbort ();
         }
     }
-
 }
 
 
index 1b738cc..3ef1be0 100644 (file)
@@ -56,7 +56,6 @@ FlOpenIncludeWithPrefix (
     ACPI_PARSE_OBJECT       *Op,
     char                    *Filename);
 
-
 #ifdef ACPI_OBSOLETE_FUNCTIONS
 ACPI_STATUS
 FlParseInputPathname (
@@ -262,7 +261,8 @@ FlMergePathnames (
     /* Build the final merged pathname */
 
 ConcatenatePaths:
-    Pathname = UtStringCacheCalloc (strlen (CommonPath) + strlen (FilePathname) + 2);
+    Pathname = UtStringCacheCalloc (
+        strlen (CommonPath) + strlen (FilePathname) + 2);
     if (LastElement && *CommonPath)
     {
         strcpy (Pathname, CommonPath);
@@ -422,7 +422,8 @@ FlOpenIncludeFile (
      *
      * Construct the file pathname from the global directory name.
      */
-    IncludeFile = FlOpenIncludeWithPrefix (Gbl_DirectoryPath, Op, Op->Asl.Value.String);
+    IncludeFile = FlOpenIncludeWithPrefix (
+        Gbl_DirectoryPath, Op, Op->Asl.Value.String);
     if (IncludeFile)
     {
         return;
@@ -435,7 +436,8 @@ FlOpenIncludeFile (
     NextDir = Gbl_IncludeDirList;
     while (NextDir)
     {
-        IncludeFile = FlOpenIncludeWithPrefix (NextDir->Dir, Op, Op->Asl.Value.String);
+        IncludeFile = FlOpenIncludeWithPrefix (
+            NextDir->Dir, Op, Op->Asl.Value.String);
         if (IncludeFile)
         {
             return;
index 0b3ef8d..276b963 100644 (file)
@@ -100,7 +100,7 @@ TrInstallReducedConstant (
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Reduce an Op and its subtree to a constant if possible
+ * DESCRIPTION: Reduce an Op and its subtree to a constant if possible.
  *
  ******************************************************************************/
 
@@ -206,7 +206,8 @@ OpcAmlConstantWalk (
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Check one Op for a type 3/4/5 AML opcode
+ * DESCRIPTION: Check one Op for a reducible type 3/4/5 AML opcode.
+ *              This is performed via a downward walk of the parse subtree.
  *
  ******************************************************************************/
 
@@ -218,6 +219,8 @@ OpcAmlCheckForConstant (
 {
     ACPI_WALK_STATE         *WalkState = Context;
     ACPI_STATUS             Status = AE_OK;
+    ACPI_PARSE_OBJECT       *NextOp;
+    const ACPI_OPCODE_INFO  *OpInfo;
 
 
     WalkState->Op = Op;
@@ -227,21 +230,6 @@ OpcAmlCheckForConstant (
     DbgPrint (ASL_PARSE_OUTPUT, "[%.4d] Opcode: %12.12s ",
         Op->Asl.LogicalLineNumber, Op->Asl.ParseOpName);
 
-    /*
-     * TBD: Ignore buffer constants for now. The problem is that these
-     * constants have been transformed into RAW_DATA at this point, from
-     * the parse tree transform process which currently happens before
-     * the constant folding process. We may need to defer this transform
-     * for buffer until after the constant folding.
-     */
-    if (WalkState->Opcode == AML_BUFFER_OP)
-    {
-        DbgPrint (ASL_PARSE_OUTPUT,
-            "\nBuffer+Buffer->Buffer constant reduction is not supported yet");
-        Status = AE_TYPE;
-        goto CleanupAndExit;
-    }
-
     /*
      * These opcodes do not appear in the OpcodeInfo table, but
      * they represent constants, so abort the constant walk now.
@@ -256,11 +244,95 @@ OpcAmlCheckForConstant (
         goto CleanupAndExit;
     }
 
+    /*
+     * Search upwards for a possible Name() operator. This is done
+     * because a type 3/4/5 opcode within a Name() expression
+     * MUST be reduced to a simple constant.
+     */
+    NextOp = Op->Asl.Parent;
+    while (NextOp)
+    {
+        /* Finished if we find a Name() opcode */
+
+        if (NextOp->Asl.AmlOpcode == AML_NAME_OP)
+        {
+            break;
+        }
+
+        /*
+         * Any "deferred" opcodes contain one or more TermArg parameters,
+         * and thus are not required to be folded to constants at compile
+         * time. This affects things like Buffer() and Package() objects.
+         * We just ignore them here. However, any sub-expressions can and
+         * will still be typechecked. Note: These are called the
+         * "deferred" opcodes in the AML interpreter.
+         */
+        OpInfo = AcpiPsGetOpcodeInfo (NextOp->Common.AmlOpcode);
+        if (OpInfo->Flags & AML_DEFER)
+        {
+            NextOp = NULL;
+            break;
+        }
+
+        NextOp = NextOp->Asl.Parent;
+    }
+
     /* Type 3/4/5 opcodes have the AML_CONSTANT flag set */
 
     if (!(WalkState->OpInfo->Flags & AML_CONSTANT))
     {
-        /* Not 3/4/5 opcode, but maybe can convert to STORE */
+        /*
+         * From the ACPI specification:
+         *
+         * "The Type 3/4/5 opcodes return a value and can be used in an
+         * expression that evaluates to a constant. These opcodes may be
+         * evaluated at ASL compile-time. To ensure that these opcodes
+         * will evaluate to a constant, the following rules apply: The
+         * term cannot have a destination (target) operand, and must have
+         * either a Type3Opcode, Type4Opcode, Type5Opcode, ConstExprTerm,
+         * Integer, BufferTerm, Package, or String for all arguments."
+         */
+
+        /*
+         * The value (second) operand for the Name() operator MUST
+         * reduce to a single constant, as per the ACPI specification
+         * (the operand is a DataObject). This also implies that there
+         * can be no target operand. Name() is the only ASL operator
+         * with a "DataObject" as an operand and is thus special-
+         * cased here.
+         */
+        if (NextOp) /* Inspect a Name() operator */
+        {
+            /* Error if there is a target operand */
+
+            if (Op->Asl.CompileFlags & NODE_IS_TARGET)
+            {
+                AslError (ASL_ERROR, ASL_MSG_INVALID_TARGET, Op, NULL);
+                Status = AE_TYPE;
+            }
+
+            /* Error if expression cannot be reduced (folded) */
+
+            if (!(NextOp->Asl.CompileFlags & NODE_COULD_NOT_REDUCE))
+            {
+                /* Ensure only one error message per statement */
+
+                NextOp->Asl.CompileFlags |= NODE_COULD_NOT_REDUCE;
+                DbgPrint (ASL_PARSE_OUTPUT,
+                    "**** Could not reduce operands for NAME opcode ****\n");
+
+                AslError (ASL_ERROR, ASL_MSG_CONSTANT_REQUIRED, Op,
+                    "Constant is required for Name operator");
+                Status = AE_TYPE;
+            }
+        }
+
+        if (ACPI_FAILURE (Status))
+        {
+            goto CleanupAndExit;
+        }
+
+        /* This is not a 3/4/5 opcode, but maybe can convert to STORE */
 
         if (Op->Asl.CompileFlags & NODE_IS_TARGET)
         {
@@ -272,13 +344,36 @@ OpcAmlCheckForConstant (
         /* Expression cannot be reduced */
 
         DbgPrint (ASL_PARSE_OUTPUT,
-            "**** Not a Type 3/4/5 opcode (%s) ****",
+            "**** Not a Type 3/4/5 opcode or cannot reduce/fold (%s) ****\n",
              Op->Asl.ParseOpName);
 
         Status = AE_TYPE;
         goto CleanupAndExit;
     }
 
+    /*
+     * TBD: Ignore buffer constants for now. The problem is that these
+     * constants have been transformed into RAW_DATA at this point, from
+     * the parse tree transform process which currently happens before
+     * the constant folding process. We may need to defer this transform
+     * for buffer until after the constant folding.
+     */
+    if (WalkState->Opcode == AML_BUFFER_OP)
+    {
+        DbgPrint (ASL_PARSE_OUTPUT,
+            "\nBuffer constant reduction is not supported yet\n");
+
+        if (NextOp) /* Found a Name() operator, error */
+        {
+            AslError (ASL_ERROR, ASL_MSG_UNSUPPORTED, Op,
+                "Buffer expression cannot be reduced");
+        }
+
+        Status = AE_TYPE;
+        goto CleanupAndExit;
+    }
+
+
     /* Debug output */
 
     DbgPrint (ASL_PARSE_OUTPUT, "TYPE_345");
@@ -294,6 +389,7 @@ OpcAmlCheckForConstant (
             DbgPrint (ASL_PARSE_OUTPUT, "%-16s", " VALID TARGET");
         }
     }
+
     if (Op->Asl.CompileFlags & NODE_IS_TERM_ARG)
     {
         DbgPrint (ASL_PARSE_OUTPUT, "%-16s", " TERMARG");
index a255daa..185845c 100644 (file)
@@ -50,7 +50,6 @@
  * This module emits ASCII hex output files in either C, ASM, or ASL format
  */
 
-
 /* Local prototypes */
 
 static void
@@ -223,6 +222,7 @@ HxDoHexOutputC (
 
         FlPrintFile (ASL_FILE_HEX_OUTPUT, "  /* %8.8X", Offset);
         LsDumpAsciiInComment (ASL_FILE_HEX_OUTPUT, LineLength, FileData);
+
         FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s*/\n",
             HEX_TABLE_LINE_SIZE - LineLength + 1, " ");
 
@@ -310,6 +310,7 @@ HxDoHexOutputAsl (
 
         FlPrintFile (ASL_FILE_HEX_OUTPUT, "  /* %8.8X", Offset);
         LsDumpAsciiInComment (ASL_FILE_HEX_OUTPUT, LineLength, FileData);
+
         FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s*/\n",
             HEX_TABLE_LINE_SIZE - LineLength + 1, " ");
 
@@ -393,6 +394,7 @@ HxDoHexOutputAsm (
 
         FlPrintFile (ASL_FILE_HEX_OUTPUT, "  ; %8.8X", Offset);
         LsDumpAsciiInComment (ASL_FILE_HEX_OUTPUT, LineLength, FileData);
+
         FlPrintFile (ASL_FILE_HEX_OUTPUT, "\n");
 
         Offset += LineLength;
index 8e876c7..0399124 100644 (file)
@@ -132,10 +132,11 @@ LnPackageLengthWalk (
     if ((Op->Asl.Parent) &&
         (Op->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG))
     {
-        Op->Asl.Parent->Asl.AmlSubtreeLength += (Op->Asl.AmlLength +
-                                           Op->Asl.AmlOpcodeLength +
-                                           Op->Asl.AmlPkgLenBytes +
-                                           Op->Asl.AmlSubtreeLength);
+        Op->Asl.Parent->Asl.AmlSubtreeLength += (
+            Op->Asl.AmlLength +
+            Op->Asl.AmlOpcodeLength +
+            Op->Asl.AmlPkgLenBytes +
+            Op->Asl.AmlSubtreeLength);
     }
     return (AE_OK);
 }
@@ -229,7 +230,7 @@ CgGenerateAmlOpcodeLength (
     if (Op->Asl.CompileFlags & NODE_AML_PACKAGE)
     {
         Op->Asl.AmlPkgLenBytes = CgGetPackageLenByteCount (
-                                    Op, Op->Asl.AmlSubtreeLength);
+            Op, Op->Asl.AmlSubtreeLength);
     }
 
     /* Data opcode lengths are easy */
@@ -332,10 +333,9 @@ CgGenerateAmlLengths (
 
     switch (Op->Asl.ParseOpcode)
     {
-    case PARSEOP_DEFINITIONBLOCK:
+    case PARSEOP_DEFINITION_BLOCK:
 
-        Gbl_TableLength = sizeof (ACPI_TABLE_HEADER) +
-                            Op->Asl.AmlSubtreeLength;
+        Gbl_TableLength = sizeof (ACPI_TABLE_HEADER) + Op->Asl.AmlSubtreeLength;
         break;
 
     case PARSEOP_NAMESEG:
@@ -365,7 +365,6 @@ CgGenerateAmlLengths (
         Op->Asl.ExternalName = Op->Asl.Value.String;
         Op->Asl.Value.String = Buffer;
         Op->Asl.CompileFlags |= NODE_NAME_INTERNALIZED;
-
         Op->Asl.AmlLength = strlen (Buffer);
 
         /*
@@ -391,7 +390,7 @@ CgGenerateAmlLengths (
 
         Op->Asl.AmlOpcodeLength = 0;
         Op->Asl.AmlPkgLenBytes = CgGetPackageLenByteCount (Op,
-                                    (UINT32) Op->Asl.Value.Integer);
+            (UINT32) Op->Asl.Value.Integer);
         break;
 
     case PARSEOP_RAW_DATA:
index 3427745..91ddcac 100644 (file)
@@ -212,6 +212,12 @@ LsAmlListingWalk (
         return (AE_OK);
     }
 
+    if ((FileId == ASL_FILE_ASM_INCLUDE_OUTPUT) ||
+        (FileId == ASL_FILE_C_INCLUDE_OUTPUT))
+    {
+        return (AE_OK);
+    }
+
     /* Write the hex bytes to the listing file(s) (if requested) */
 
     for (i = 0; i < Op->Asl.FinalAmlLength; i++)
@@ -221,6 +227,7 @@ LsAmlListingWalk (
             FlFileError (ASL_FILE_AML_OUTPUT, ASL_MSG_READ);
             AslAbort ();
         }
+
         LsWriteListingHexBytes (&FileByte, 1, FileId);
     }
 
@@ -316,7 +323,7 @@ LsWriteNodeToListing (
     {
         switch (Op->Asl.ParseOpcode)
         {
-        case PARSEOP_DEFINITIONBLOCK:
+        case PARSEOP_DEFINITION_BLOCK:
         case PARSEOP_METHODCALL:
         case PARSEOP_INCLUDE:
         case PARSEOP_INCLUDE_END:
@@ -362,36 +369,46 @@ LsWriteNodeToListing (
 
     switch (Op->Asl.ParseOpcode)
     {
-    case PARSEOP_DEFINITIONBLOCK:
+    case PARSEOP_DEFINITION_BLOCK:
 
         LsWriteSourceLines (Op->Asl.EndLine, Op->Asl.EndLogicalLine, FileId);
 
         /* Use the table Signature and TableId to build a unique name */
 
-        if (FileId == ASL_FILE_ASM_SOURCE_OUTPUT)
+        switch (FileId)
         {
+        case ASL_FILE_ASM_SOURCE_OUTPUT:
+
             FlPrintFile (FileId,
                 "%s_%s_Header \\\n",
                 Gbl_TableSignature, Gbl_TableId);
-        }
-        if (FileId == ASL_FILE_C_SOURCE_OUTPUT)
-        {
+            break;
+
+        case ASL_FILE_C_SOURCE_OUTPUT:
+
             FlPrintFile (FileId,
                 "    unsigned char    %s_%s_Header [] =\n    {\n",
                 Gbl_TableSignature, Gbl_TableId);
-        }
-        if (FileId == ASL_FILE_ASM_INCLUDE_OUTPUT)
-        {
+            break;
+
+        case ASL_FILE_ASM_INCLUDE_OUTPUT:
+
             FlPrintFile (FileId,
                 "extrn %s_%s_Header : byte\n",
                 Gbl_TableSignature, Gbl_TableId);
-        }
-        if (FileId == ASL_FILE_C_INCLUDE_OUTPUT)
-        {
+            break;
+
+        case ASL_FILE_C_INCLUDE_OUTPUT:
+
             FlPrintFile (FileId,
                 "extern unsigned char    %s_%s_Header [];\n",
                 Gbl_TableSignature, Gbl_TableId);
+            break;
+
+        default:
+            break;
         }
+
         return;
 
 
@@ -540,31 +557,41 @@ LsWriteNodeToListing (
 
                         /* Create the appropriate symbol in the output file */
 
-                        if (FileId == ASL_FILE_ASM_SOURCE_OUTPUT)
+                        switch (FileId)
                         {
+                        case ASL_FILE_ASM_SOURCE_OUTPUT:
+
                             FlPrintFile (FileId,
                                 "%s_%s_%s  \\\n",
                                 Gbl_TableSignature, Gbl_TableId, &Pathname[1]);
-                        }
-                        if (FileId == ASL_FILE_C_SOURCE_OUTPUT)
-                        {
+                            break;
+
+                        case ASL_FILE_C_SOURCE_OUTPUT:
+
                             FlPrintFile (FileId,
                                 "    unsigned char    %s_%s_%s [] =\n    {\n",
                                 Gbl_TableSignature, Gbl_TableId, &Pathname[1]);
-                        }
-                        if (FileId == ASL_FILE_ASM_INCLUDE_OUTPUT)
-                        {
+                            break;
+
+                        case ASL_FILE_ASM_INCLUDE_OUTPUT:
+
                             FlPrintFile (FileId,
                                 "extrn %s_%s_%s : byte\n",
                                 Gbl_TableSignature, Gbl_TableId, &Pathname[1]);
-                        }
-                        if (FileId == ASL_FILE_C_INCLUDE_OUTPUT)
-                        {
+                            break;
+
+                        case ASL_FILE_C_INCLUDE_OUTPUT:
+
                             FlPrintFile (FileId,
                                 "extern unsigned char    %s_%s_%s [];\n",
                                 Gbl_TableSignature, Gbl_TableId, &Pathname[1]);
+                            break;
+
+                        default:
+                            break;
                         }
                     }
+
                     ACPI_FREE (Pathname);
                 }
                 break;
index 21ffb74..c073c1f 100644 (file)
@@ -88,6 +88,7 @@ LsDumpAscii (
             FlPrintFile (FileId, ".");
         }
     }
+
     FlPrintFile (FileId, "\"");
 }
 
@@ -185,7 +186,6 @@ LsCheckException (
               (LineNumber >= Gbl_NextError->LogicalLineNumber))
         {
             AePrintException (FileId, Gbl_NextError, "\n[****iasl****]\n");
-
             Gbl_NextError = Gbl_NextError->Next;
         }
 
@@ -576,6 +576,7 @@ LsFlushListingBuffer (
             {
                 FlPrintFile (FileId, ",");
             }
+
             FlPrintFile (FileId, "0%2.2Xh", Gbl_AmlBuffer[i]);
         }
 
index 0f68e0c..8da8b80 100644 (file)
@@ -196,12 +196,11 @@ LdLoadFieldElements (
         default:
 
             Status = AcpiNsLookup (WalkState->ScopeInfo,
-                        Child->Asl.Value.String,
-                        ACPI_TYPE_LOCAL_REGION_FIELD,
-                        ACPI_IMODE_LOAD_PASS1,
-                        ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
-                            ACPI_NS_ERROR_IF_FOUND,
-                        NULL, &Node);
+                Child->Asl.Value.String,
+                ACPI_TYPE_LOCAL_REGION_FIELD,
+                ACPI_IMODE_LOAD_PASS1,
+                ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
+                    ACPI_NS_ERROR_IF_FOUND, NULL, &Node);
             if (ACPI_FAILURE (Status))
             {
                 if (Status != AE_ALREADY_EXISTS)
@@ -266,9 +265,9 @@ LdLoadResourceElements (
      * This opens a scope, so later field names are guaranteed to be new/unique.
      */
     Status = AcpiNsLookup (WalkState->ScopeInfo, Op->Asl.Namepath,
-                ACPI_TYPE_LOCAL_RESOURCE, ACPI_IMODE_LOAD_PASS1,
-                ACPI_NS_NO_UPSEARCH | ACPI_NS_ERROR_IF_FOUND,
-                WalkState, &Node);
+        ACPI_TYPE_LOCAL_RESOURCE, ACPI_IMODE_LOAD_PASS1,
+        ACPI_NS_NO_UPSEARCH | ACPI_NS_ERROR_IF_FOUND,
+        WalkState, &Node);
     if (ACPI_FAILURE (Status))
     {
         if (Status == AE_ALREADY_EXISTS)
@@ -296,11 +295,11 @@ LdLoadResourceElements (
         if (InitializerOp->Asl.ExternalName)
         {
             Status = AcpiNsLookup (WalkState->ScopeInfo,
-                        InitializerOp->Asl.ExternalName,
-                        ACPI_TYPE_LOCAL_RESOURCE_FIELD,
-                        ACPI_IMODE_LOAD_PASS1,
-                        ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE,
-                        NULL, &Node);
+                InitializerOp->Asl.ExternalName,
+                ACPI_TYPE_LOCAL_RESOURCE_FIELD,
+                ACPI_IMODE_LOAD_PASS1,
+                ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE,
+                NULL, &Node);
             if (ACPI_FAILURE (Status))
             {
                 return (Status);
@@ -344,6 +343,7 @@ LdNamespace1Begin (
 {
     ACPI_WALK_STATE         *WalkState = (ACPI_WALK_STATE *) Context;
     ACPI_NAMESPACE_NODE     *Node;
+    ACPI_PARSE_OBJECT       *MethodOp;
     ACPI_STATUS             Status;
     ACPI_OBJECT_TYPE        ObjectType;
     ACPI_OBJECT_TYPE        ActualObjectType = ACPI_TYPE_ANY;
@@ -500,8 +500,8 @@ LdNamespace1Begin (
          * handle this case. Perhaps someday this case can go away.
          */
         Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY,
-                    ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
-                    WalkState, &(Node));
+            ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
+            WalkState, &(Node));
         if (ACPI_FAILURE (Status))
         {
             if (Status == AE_NOT_FOUND)
@@ -509,9 +509,9 @@ LdNamespace1Begin (
                 /* The name was not found, go ahead and create it */
 
                 Status = AcpiNsLookup (WalkState->ScopeInfo, Path,
-                            ACPI_TYPE_LOCAL_SCOPE,
-                            ACPI_IMODE_LOAD_PASS1, Flags,
-                            WalkState, &(Node));
+                    ACPI_TYPE_LOCAL_SCOPE,
+                    ACPI_IMODE_LOAD_PASS1, Flags,
+                    WalkState, &(Node));
                 if (ACPI_FAILURE (Status))
                 {
                     return_ACPI_STATUS (Status);
@@ -534,6 +534,35 @@ LdNamespace1Begin (
 
             return_ACPI_STATUS (Status);
         }
+        else /* Status AE_OK */
+        {
+            /*
+             * Do not allow references to external scopes from the DSDT.
+             * This is because the DSDT is always loaded first, and the
+             * external reference cannot be resolved -- causing a runtime
+             * error because Scope() must be resolved immediately.
+             * 10/2015.
+             */
+            if ((Node->Flags & ANOBJ_IS_EXTERNAL) &&
+                (ACPI_COMPARE_NAME (Gbl_TableSignature, "DSDT")))
+            {
+                /* However, allowed if the reference is within a method */
+
+                MethodOp = Op->Asl.Parent;
+                while (MethodOp &&
+                      (MethodOp->Asl.ParseOpcode != PARSEOP_METHOD))
+                {
+                    MethodOp = MethodOp->Asl.Parent;
+                }
+
+                if (!MethodOp)
+                {
+                    /* Not in a control method, error */
+
+                    AslError (ASL_ERROR, ASL_MSG_CROSS_TABLE_SCOPE, Op, NULL);
+                }
+            }
+        }
 
         /* We found a node with this name, now check the type */
 
@@ -569,7 +598,7 @@ LdNamespace1Begin (
 
             Node->Type = ACPI_TYPE_LOCAL_SCOPE;
             Status = AcpiDsScopeStackPush (Node, ACPI_TYPE_LOCAL_SCOPE,
-                        WalkState);
+                WalkState);
             if (ACPI_FAILURE (Status))
             {
                 return_ACPI_STATUS (Status);
@@ -591,7 +620,7 @@ LdNamespace1Begin (
              */
             Node->Type = ACPI_TYPE_LOCAL_SCOPE;
             Status = AcpiDsScopeStackPush (Node, ACPI_TYPE_LOCAL_SCOPE,
-                        WalkState);
+                WalkState);
             if (ACPI_FAILURE (Status))
             {
                 return_ACPI_STATUS (Status);
@@ -611,7 +640,7 @@ LdNamespace1Begin (
 
 
     ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Loading name: %s, (%s)\n",
-            Op->Asl.ExternalName, AcpiUtGetTypeName (ObjectType)));
+        Op->Asl.ExternalName, AcpiUtGetTypeName (ObjectType)));
 
     /* The name must not already exist */
 
@@ -624,7 +653,7 @@ LdNamespace1Begin (
      * parse tree later.
      */
     Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
-                    ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &Node);
+        ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &Node);
     if (ACPI_FAILURE (Status))
     {
         if (Status == AE_ALREADY_EXISTS)
@@ -658,6 +687,17 @@ LdNamespace1Begin (
                         return_ACPI_STATUS (Status);
                     }
                 }
+
+                Status = AE_OK;
+            }
+            else if (!(Node->Flags & ANOBJ_IS_EXTERNAL) &&
+                     (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL))
+            {
+                /*
+                 * Allow externals in same scope as the definition of the
+                 * actual object. Similar to C. Allows multiple definition
+                 * blocks that refer to each other in the same file.
+                 */
                 Status = AE_OK;
             }
             else
@@ -818,8 +858,8 @@ LdNamespace2Begin (
         /* Get the NS node associated with the target. It must exist. */
 
         Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY,
-                    ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
-                    WalkState, &TargetNode);
+            ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
+            WalkState, &TargetNode);
         if (ACPI_FAILURE (Status))
         {
             if (Status == AE_NOT_FOUND)
@@ -832,9 +872,9 @@ LdNamespace2Begin (
                  * This prevents more errors later.
                  */
                 Status = AcpiNsLookup (WalkState->ScopeInfo, Path,
-                            ACPI_TYPE_ANY,
-                            ACPI_IMODE_LOAD_PASS1, ACPI_NS_NO_UPSEARCH,
-                            WalkState, &(Node));
+                    ACPI_TYPE_ANY,
+                    ACPI_IMODE_LOAD_PASS1, ACPI_NS_NO_UPSEARCH,
+                    WalkState, &(Node));
                 return (AE_OK);
             }
 
index 5338204..a69d5c0 100644 (file)
@@ -479,6 +479,7 @@ const ASL_MAPPING_ENTRY     AslKeywordMapping [] =
 /* 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),
+/* ASLCODE  */                  OP_TABLE_ENTRY (0,                          0,                              0,                  0)
 /*! [End] no source code translation !*/
 
 };
index 8ab3e62..06a8623 100644 (file)
@@ -239,7 +239,7 @@ MpCreateGpioInfo (
     /* Sort on source DeviceName first */
 
     while (NextGpio &&
-            (strcmp (DeviceName, NextGpio->DeviceName) > 0))
+        (strcmp (DeviceName, NextGpio->DeviceName) > 0))
     {
         PrevGpio = NextGpio;
         NextGpio = NextGpio->Next;
@@ -248,8 +248,8 @@ MpCreateGpioInfo (
     /* Now sort on the PinNumber */
 
     while (NextGpio &&
-            (NextGpio->PinNumber < PinNumber) &&
-            !strcmp (DeviceName, NextGpio->DeviceName))
+        (NextGpio->PinNumber < PinNumber) &&
+        !strcmp (DeviceName, NextGpio->DeviceName))
     {
         PrevGpio = NextGpio;
         NextGpio = NextGpio->Next;
index 07ed89a..4d2e0e9 100644 (file)
@@ -453,7 +453,7 @@ MpEmitDeviceTree (
     /* Walk the namespace from the root */
 
     (void) AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
-            ACPI_UINT32_MAX, FALSE, MpEmitOneDevice, NULL, NULL, NULL);
+        ACPI_UINT32_MAX, FALSE, MpEmitOneDevice, NULL, NULL, NULL);
 }
 
 
index bd69311..244e72e 100644 (file)
@@ -238,8 +238,9 @@ const char                      *AslCompilerMsgs [] =
 /*    ASL_MSG_ILLEGAL_METHOD_REF */         "Illegal reference across two methods",
 /*    ASL_MSG_LOCAL_NOT_USED */             "Method Local is set but never used",
 /*    ASL_MSG_ARG_AS_LOCAL_NOT_USED */      "Method Argument (as a local) is set but never used",
-/*    ASL_MSG_ARG_NOT_USED */               "Method Argument is never used"
-
+/*    ASL_MSG_ARG_NOT_USED */               "Method Argument is never used",
+/*    ASL_MSG_CONSTANT_REQUIRED */          "Non-reducible expression",
+/*    ASL_MSG_CROSS_TABLE_SCOPE */          "Illegal open scope on external object from within DSDT"
 };
 
 /* Table compiler */
index d7e3dd0..440513f 100644 (file)
@@ -241,6 +241,8 @@ typedef enum
     ASL_MSG_LOCAL_NOT_USED,
     ASL_MSG_ARG_AS_LOCAL_NOT_USED,
     ASL_MSG_ARG_NOT_USED,
+    ASL_MSG_CONSTANT_REQUIRED,
+    ASL_MSG_CROSS_TABLE_SCOPE,
 
     /* These messages are used by the Data Table compiler only */
 
index 40ed971..bf3a683 100644 (file)
@@ -101,7 +101,7 @@ MtMethodAnalysisWalkBegin (
 
         /* Create and init method info */
 
-        MethodInfo       = UtLocalCalloc (sizeof (ASL_METHOD_INFO));
+        MethodInfo = UtLocalCalloc (sizeof (ASL_METHOD_INFO));
         MethodInfo->Next = WalkInfo->MethodStack;
         MethodInfo->Op = Op;
 
@@ -186,7 +186,9 @@ MtMethodAnalysisWalkBegin (
                 NextParamType = NextType->Asl.Child;
                 while (NextParamType)
                 {
-                    MethodInfo->ValidArgTypes[ActualArgs] |= AnMapObjTypeToBtype (NextParamType);
+                    MethodInfo->ValidArgTypes[ActualArgs] |=
+                        AnMapObjTypeToBtype (NextParamType);
+
                     NextParamType->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
                     NextParamType = NextParamType->Asl.Next;
                 }
@@ -195,6 +197,7 @@ MtMethodAnalysisWalkBegin (
             {
                 MethodInfo->ValidArgTypes[ActualArgs] =
                     AnMapObjTypeToBtype (NextType);
+
                 NextType->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
                 ActualArgs++;
             }
@@ -251,7 +254,8 @@ MtMethodAnalysisWalkBegin (
              * Local was used outside a control method, or there was an error
              * in the method declaration.
              */
-            AslError (ASL_REMARK, ASL_MSG_LOCAL_OUTSIDE_METHOD, Op, Op->Asl.ExternalName);
+            AslError (ASL_REMARK, ASL_MSG_LOCAL_OUTSIDE_METHOD,
+                Op, Op->Asl.ExternalName);
             return (AE_ERROR);
         }
 
@@ -294,7 +298,8 @@ MtMethodAnalysisWalkBegin (
              * Arg was used outside a control method, or there was an error
              * in the method declaration.
              */
-            AslError (ASL_REMARK, ASL_MSG_LOCAL_OUTSIDE_METHOD, Op, Op->Asl.ExternalName);
+            AslError (ASL_REMARK, ASL_MSG_LOCAL_OUTSIDE_METHOD,
+                Op, Op->Asl.ExternalName);
             return (AE_ERROR);
         }
 
@@ -317,7 +322,7 @@ MtMethodAnalysisWalkBegin (
          * The only operator that accepts an uninitialized value is ObjectType()
          */
         else if ((!MethodInfo->ArgInitialized[RegisterNumber]) &&
-                 (Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_OBJECTTYPE))
+            (Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_OBJECTTYPE))
         {
             AslError (ASL_ERROR, ASL_MSG_ARG_INIT, Op, ArgName);
         }
@@ -418,7 +423,8 @@ MtMethodAnalysisWalkBegin (
         i = ApCheckForPredefinedName (Op, Op->Asl.NameSeg);
         if (i < ACPI_VALID_RESERVED_NAME_MAX)
         {
-            AslError (ASL_ERROR, ASL_MSG_RESERVED_USE, Op, Op->Asl.ExternalName);
+            AslError (ASL_ERROR, ASL_MSG_RESERVED_USE,
+                Op, Op->Asl.ExternalName);
         }
         break;
 
@@ -495,9 +501,10 @@ MtCheckNamedObjectInMethod (
     const ACPI_OPCODE_INFO  *OpInfo;
 
 
-    /* We don't care about actual method declarations */
+    /* We don't care about actual method declarations or scopes */
 
-    if (Op->Asl.AmlOpcode == AML_METHOD_OP)
+    if ((Op->Asl.AmlOpcode == AML_METHOD_OP) ||
+        (Op->Asl.AmlOpcode == AML_SCOPE_OP))
     {
         return;
     }
@@ -677,7 +684,8 @@ MtMethodAnalysisWalkEnd (
          */
         if (Op->Asl.Next)
         {
-            AslError (ASL_WARNING, ASL_MSG_UNREACHABLE_CODE, Op->Asl.Next, NULL);
+            AslError (ASL_WARNING, ASL_MSG_UNREACHABLE_CODE,
+                Op->Asl.Next, NULL);
         }
         break;
 
index e2dea6f..4be3981 100644 (file)
@@ -124,16 +124,16 @@ NsDisplayNamespace (
     /* Walk entire namespace from the root */
 
     Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
-                ACPI_UINT32_MAX, FALSE, NsDoOneNamespaceObject, NULL,
-                NULL, NULL);
+        ACPI_UINT32_MAX, FALSE, NsDoOneNamespaceObject, NULL,
+        NULL, NULL);
 
     /* Print the full pathname for each namespace node */
 
     FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "\nNamespace pathnames\n\n");
 
     Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
-                ACPI_UINT32_MAX, FALSE, NsDoOnePathname, NULL,
-                NULL, NULL);
+        ACPI_UINT32_MAX, FALSE, NsDoOnePathname, NULL,
+        NULL, NULL);
 
     return (Status);
 }
@@ -168,8 +168,7 @@ NsDoOneNamespaceObject (
 
     FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "%5u  [%u]  %*s %4.4s - %s",
         Gbl_NumNamespaceObjects, Level, (Level * 3), " ",
-        &Node->Name,
-        AcpiUtGetTypeName (Node->Type));
+        &Node->Name, AcpiUtGetTypeName (Node->Type));
 
     Op = Node->Op;
     ObjDesc = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Node->Object);
@@ -218,11 +217,13 @@ NsDoOneNamespaceObject (
             {
                 Op = Op->Asl.Child;
             }
+
             if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG)  ||
                 (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING))
             {
                 Op = Op->Asl.Next;
             }
+
             FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
                 "       [Initial Value   0x%8.8X%8.8X]",
                 ACPI_FORMAT_UINT64 (Op->Asl.Value.Integer));
@@ -234,11 +235,13 @@ NsDoOneNamespaceObject (
             {
                 Op = Op->Asl.Child;
             }
+
             if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG)  ||
                 (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING))
             {
                 Op = Op->Asl.Next;
             }
+
             FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
                 "        [Initial Value   \"%s\"]",
                 Op->Asl.Value.String);
@@ -251,6 +254,7 @@ NsDoOneNamespaceObject (
             {
                 Op = Op->Asl.Child;
             }
+
             FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
                 "   [Offset 0x%04X   Length 0x%04X bits]",
                 Op->Asl.Parent->Asl.ExtraValue, (UINT32) Op->Asl.Value.Integer);
@@ -303,11 +307,13 @@ NsDoOneNamespaceObject (
             {
                 Op = Op->Asl.Child;
             }
+
             if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG)  ||
                 (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING))
             {
                 Op = Op->Asl.Next;
             }
+
             Op = Op->Asl.Child;
 
             if ((Op->Asl.ParseOpcode == PARSEOP_BYTECONST) ||
@@ -325,11 +331,13 @@ NsDoOneNamespaceObject (
             {
                 Op = Op->Asl.Child;
             }
+
             if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG)  ||
                 (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING))
             {
                 Op = Op->Asl.Next;
             }
+
             Op = Op->Asl.Child;
 
             if (Op && (Op->Asl.ParseOpcode == PARSEOP_INTEGER))
@@ -417,6 +425,5 @@ NsDoOnePathname (
 
     FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "%s\n", TargetPath.Pointer);
     ACPI_FREE (TargetPath.Pointer);
-
     return (AE_OK);
 }
index a7f14de..29e9d79 100644 (file)
@@ -260,7 +260,7 @@ OpcSetOptimalIntegerSize (
      */
     if (Op->Asl.Parent &&
         Op->Asl.Parent->Asl.Parent &&
-       (Op->Asl.Parent->Asl.Parent->Asl.ParseOpcode == PARSEOP_DEFINITIONBLOCK))
+       (Op->Asl.Parent->Asl.Parent->Asl.ParseOpcode == PARSEOP_DEFINITION_BLOCK))
     {
         return (0);
     }
@@ -330,11 +330,13 @@ OpcSetOptimalIntegerSize (
         Op->Asl.AmlOpcode = AML_BYTE_OP;
         return (1);
     }
+
     if (Op->Asl.Value.Integer <= ACPI_UINT16_MAX)
     {
         Op->Asl.AmlOpcode = AML_WORD_OP;
         return (2);
     }
+
     if (Op->Asl.Value.Integer <= ACPI_UINT32_MAX)
     {
         Op->Asl.AmlOpcode = AML_DWORD_OP;
@@ -398,6 +400,7 @@ OpcDoAccessAs (
     {
         AttribOp->Asl.Value.Integer = 0;
     }
+
     AttribOp->Asl.AmlOpcode = AML_RAW_DATA_BYTE;
     AttribOp->Asl.ParseOpcode = PARSEOP_RAW_DATA;
 
@@ -486,21 +489,21 @@ OpcDoConnection (
      * First Child  -> BufferLength
      * Second Child -> Descriptor Buffer (raw byte data)
      */
-    BufferOp->Asl.ParseOpcode         = PARSEOP_BUFFER;
-    BufferOp->Asl.AmlOpcode           = AML_BUFFER_OP;
-    BufferOp->Asl.CompileFlags        = NODE_AML_PACKAGE | NODE_IS_RESOURCE_DESC;
+    BufferOp->Asl.ParseOpcode = PARSEOP_BUFFER;
+    BufferOp->Asl.AmlOpcode = AML_BUFFER_OP;
+    BufferOp->Asl.CompileFlags = NODE_AML_PACKAGE | NODE_IS_RESOURCE_DESC;
     UtSetParseOpName (BufferOp);
 
-    BufferLengthOp->Asl.ParseOpcode   = PARSEOP_INTEGER;
+    BufferLengthOp->Asl.ParseOpcode = PARSEOP_INTEGER;
     BufferLengthOp->Asl.Value.Integer = Rnode->BufferLength;
     (void) OpcSetOptimalIntegerSize (BufferLengthOp);
     UtSetParseOpName (BufferLengthOp);
 
-    BufferDataOp->Asl.ParseOpcode         = PARSEOP_RAW_DATA;
-    BufferDataOp->Asl.AmlOpcode           = AML_RAW_DATA_CHAIN;
-    BufferDataOp->Asl.AmlOpcodeLength     = 0;
-    BufferDataOp->Asl.AmlLength           = Rnode->BufferLength;
-    BufferDataOp->Asl.Value.Buffer        = (UINT8 *) Rnode;
+    BufferDataOp->Asl.ParseOpcode = PARSEOP_RAW_DATA;
+    BufferDataOp->Asl.AmlOpcode = AML_RAW_DATA_CHAIN;
+    BufferDataOp->Asl.AmlOpcodeLength = 0;
+    BufferDataOp->Asl.AmlLength = Rnode->BufferLength;
+    BufferDataOp->Asl.Value.Buffer = (UINT8 *) Rnode;
     UtSetParseOpName (BufferDataOp);
 }
 
@@ -564,8 +567,8 @@ OpcDoUnicode (
      * Just set the buffer size node to be the buffer length, regardless
      * of whether it was previously an integer or a default_arg placeholder
      */
-    BufferLengthOp->Asl.ParseOpcode   = PARSEOP_INTEGER;
-    BufferLengthOp->Asl.AmlOpcode     = AML_DWORD_OP;
+    BufferLengthOp->Asl.ParseOpcode = PARSEOP_INTEGER;
+    BufferLengthOp->Asl.AmlOpcode = AML_DWORD_OP;
     BufferLengthOp->Asl.Value.Integer = Length;
     UtSetParseOpName (BufferLengthOp);
 
@@ -573,11 +576,11 @@ OpcDoUnicode (
 
     /* The Unicode string is a raw data buffer */
 
-    InitializerOp->Asl.Value.Buffer   = (UINT8 *) UnicodeString;
-    InitializerOp->Asl.AmlOpcode      = AML_RAW_DATA_BUFFER;
-    InitializerOp->Asl.AmlLength      = Length;
-    InitializerOp->Asl.ParseOpcode    = PARSEOP_RAW_DATA;
-    InitializerOp->Asl.Child          = NULL;
+    InitializerOp->Asl.Value.Buffer = (UINT8 *) UnicodeString;
+    InitializerOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER;
+    InitializerOp->Asl.AmlLength = Length;
+    InitializerOp->Asl.ParseOpcode = PARSEOP_RAW_DATA;
+    InitializerOp->Asl.Child = NULL;
     UtSetParseOpName (InitializerOp);
 }
 
@@ -1330,9 +1333,9 @@ OpcDoPld (
 
     NewOp = TrAllocateNode (PARSEOP_INTEGER);
 
-    NewOp->Asl.AmlOpcode     = AML_BYTE_OP;
+    NewOp->Asl.AmlOpcode = AML_BYTE_OP;
     NewOp->Asl.Value.Integer = 20;
-    NewOp->Asl.Parent        = Op;
+    NewOp->Asl.Parent = Op;
 
     Op->Asl.Child = NewOp;
     Op = NewOp;
@@ -1340,10 +1343,10 @@ OpcDoPld (
     /* 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;
+    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;
 }
@@ -1398,9 +1401,9 @@ OpcDoUuId (
 
     NewOp = TrAllocateNode (PARSEOP_INTEGER);
 
-    NewOp->Asl.AmlOpcode     = AML_BYTE_OP;
+    NewOp->Asl.AmlOpcode = AML_BYTE_OP;
     NewOp->Asl.Value.Integer = 16;
-    NewOp->Asl.Parent        = Op;
+    NewOp->Asl.Parent = Op;
 
     Op->Asl.Child = NewOp;
     Op = NewOp;
@@ -1408,10 +1411,10 @@ OpcDoUuId (
     /* Peer to the child is the raw buffer data */
 
     NewOp = TrAllocateNode (PARSEOP_RAW_DATA);
-    NewOp->Asl.AmlOpcode     = AML_RAW_DATA_BUFFER;
-    NewOp->Asl.AmlLength     = 16;
-    NewOp->Asl.Value.String  = ACPI_CAST_PTR (char, Buffer);
-    NewOp->Asl.Parent        = Op->Asl.Parent;
+    NewOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER;
+    NewOp->Asl.AmlLength = 16;
+    NewOp->Asl.Value.String = ACPI_CAST_PTR (char, Buffer);
+    NewOp->Asl.Parent = Op->Asl.Parent;
 
     Op->Asl.Next = NewOp;
 }
index 913ac90..cdef7fa 100644 (file)
@@ -188,14 +188,16 @@ OpnDoMethod (
         {
             AslError (ASL_ERROR, ASL_MSG_SYNC_LEVEL, Next, NULL);
         }
+
         Concurrency = (UINT8) Next->Asl.Value.Integer;
     }
 
     /* Put the bits in their proper places */
 
-    MethodFlags = (UINT8) ((NumArgs & 0x7) |
-                          ((Serialized & 0x1) << 3) |
-                          ((Concurrency & 0xF) << 4));
+    MethodFlags = (UINT8)
+        ((NumArgs & 0x7) |
+        ((Serialized & 0x1) << 3) |
+        ((Concurrency & 0xF) << 4));
 
     /* Use the last node for the combined flags byte */
 
@@ -272,9 +274,9 @@ OpnDoFieldCommon (
     /* Set the node to RAW_DATA */
 
     Next->Asl.Value.Integer = FieldFlags;
-    Next->Asl.AmlOpcode     = AML_RAW_DATA_BYTE;
-    Next->Asl.AmlLength     = 1;
-    Next->Asl.ParseOpcode   = PARSEOP_RAW_DATA;
+    Next->Asl.AmlOpcode = AML_RAW_DATA_BYTE;
+    Next->Asl.AmlLength = 1;
+    Next->Asl.ParseOpcode = PARSEOP_RAW_DATA;
 
     /* Process the FieldUnitList */
 
@@ -345,8 +347,8 @@ OpnDoFieldCommon (
 
             /* Named or reserved field entry */
 
-            PkgLengthNode     = Next->Asl.Child;
-            NewBitOffset      = (UINT32) PkgLengthNode->Asl.Value.Integer;
+            PkgLengthNode = Next->Asl.Child;
+            NewBitOffset = (UINT32) PkgLengthNode->Asl.Value.Integer;
             CurrentBitOffset += NewBitOffset;
 
             /* Save the current AccessAs value for error checking later */
@@ -601,9 +603,9 @@ OpnDoBuffer (
         {
             /* For buffers, this is a list of raw bytes */
 
-            InitializerOp->Asl.AmlOpcode      = AML_RAW_DATA_BYTE;
-            InitializerOp->Asl.AmlLength      = 1;
-            InitializerOp->Asl.ParseOpcode    = PARSEOP_RAW_DATA;
+            InitializerOp->Asl.AmlOpcode = AML_RAW_DATA_BYTE;
+            InitializerOp->Asl.AmlLength = 1;
+            InitializerOp->Asl.ParseOpcode = PARSEOP_RAW_DATA;
 
             BufferLength++;
             InitializerOp = ASL_GET_PEER_NODE (InitializerOp);
@@ -618,9 +620,9 @@ OpnDoBuffer (
          */
         BufferLength = strlen (InitializerOp->Asl.Value.String) + 1;
 
-        InitializerOp->Asl.AmlOpcode      = AML_RAW_DATA_BUFFER;
-        InitializerOp->Asl.AmlLength      = BufferLength;
-        InitializerOp->Asl.ParseOpcode    = PARSEOP_RAW_DATA;
+        InitializerOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER;
+        InitializerOp->Asl.AmlLength = BufferLength;
+        InitializerOp->Asl.ParseOpcode = PARSEOP_RAW_DATA;
         break;
 
     case PARSEOP_RAW_DATA:
@@ -636,7 +638,7 @@ OpnDoBuffer (
         AslError (ASL_ERROR, ASL_MSG_INVALID_OPERAND, InitializerOp,
             "Unknown buffer initializer opcode");
         printf ("Unknown buffer initializer opcode [%s]\n",
-                        UtGetOpName (InitializerOp->Asl.ParseOpcode));
+            UtGetOpName (InitializerOp->Asl.ParseOpcode));
         return;
     }
 
@@ -660,8 +662,8 @@ OpnDoBuffer (
      * Just set the buffer size node to be the buffer length, regardless
      * of whether it was previously an integer or a default_arg placeholder
      */
-    BufferLengthOp->Asl.ParseOpcode   = PARSEOP_INTEGER;
-    BufferLengthOp->Asl.AmlOpcode     = AML_DWORD_OP;
+    BufferLengthOp->Asl.ParseOpcode = PARSEOP_INTEGER;
+    BufferLengthOp->Asl.AmlOpcode = AML_DWORD_OP;
     BufferLengthOp->Asl.Value.Integer = BufferLength;
 
     (void) OpcSetOptimalIntegerSize (BufferLengthOp);
@@ -839,9 +841,9 @@ OpnDoLoadTable (
     Next = Next->Asl.Next;
     if (Next->Asl.ParseOpcode == PARSEOP_ZERO)
     {
-        Next->Asl.ParseOpcode    = PARSEOP_STRING_LITERAL;
-        Next->Asl.Value.String   = "\\";
-        Next->Asl.AmlLength      = 2;
+        Next->Asl.ParseOpcode = PARSEOP_STRING_LITERAL;
+        Next->Asl.Value.String = "\\";
+        Next->Asl.AmlLength = 2;
         OpcGenerateAmlOpcode (Next);
     }
 
@@ -923,6 +925,7 @@ OpnDoDefinitionBlock (
         Gbl_OutputFilenamePrefix = Filename;
         UtConvertBackslashes (Gbl_OutputFilenamePrefix);
     }
+
     Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
 
     /* Signature */
@@ -1131,7 +1134,7 @@ OpnGenerateAmlOperands (
 
     switch (Op->Asl.ParseOpcode)
     {
-    case PARSEOP_DEFINITIONBLOCK:
+    case PARSEOP_DEFINITION_BLOCK:
 
         OpnDoDefinitionBlock (Op);
         break;
index e41e22f..05af0be 100644 (file)
@@ -53,7 +53,7 @@
         ACPI_MODULE_NAME    ("aslopt")
 
 
-static UINT32 OptTotal = 0;
+static UINT32               OptTotal = 0;
 
 /* Local prototypes */
 
@@ -132,15 +132,15 @@ OptSearchToRoot (
      * name in the search path before the one we want, the nodes will
      * not match, and we cannot use this optimization.
      */
-    Path = &(((char *) TargetPath->Pointer)[TargetPath->Length -
-                                            ACPI_NAME_SIZE]),
+    Path = &(((char *) TargetPath->Pointer)[
+        TargetPath->Length - ACPI_NAME_SIZE]),
     ScopeInfo.Scope.Node = CurrentNode;
 
     /* Lookup the NameSeg using SEARCH_PARENT (search-to-root) */
 
     Status = AcpiNsLookup (&ScopeInfo, Path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
-                    ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
-                    WalkState, &(Node));
+        ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
+        WalkState, &(Node));
     if (ACPI_FAILURE (Status))
     {
         return (Status);
@@ -172,8 +172,8 @@ OptSearchToRoot (
 
     if (strncmp (*NewPath, "_T_", 3))
     {
-        AslError (ASL_OPTIMIZATION, ASL_MSG_SINGLE_NAME_OPTIMIZATION, Op,
-                *NewPath);
+        AslError (ASL_OPTIMIZATION, ASL_MSG_SINGLE_NAME_OPTIMIZATION,
+            Op, *NewPath);
     }
 
     return (AE_OK);
@@ -292,7 +292,7 @@ OptBuildShortestPath (
     /* Determine how many prefix Carats are required */
 
     NumCarats = (CurrentPath->Length / ACPI_PATH_SEGMENT_LENGTH) -
-                NumCommonSegments;
+        NumCommonSegments;
 
     /*
      * Construct a new target string
@@ -373,8 +373,8 @@ OptBuildShortestPath (
      * path that has been created.
      */
     Status = AcpiNsLookup (&ScopeInfo,  NewPath,
-                    ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
-                    ACPI_NS_DONT_OPEN_SCOPE, WalkState, &(Node));
+        ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
+        ACPI_NS_DONT_OPEN_SCOPE, WalkState, &(Node));
     if (ACPI_SUCCESS (Status))
     {
         /* Found the namepath, but make sure the node is correct */
@@ -446,7 +446,7 @@ OptOptimizeNameDeclaration (
 
 
     if (((CurrentNode == AcpiGbl_RootNode) ||
-        (Op->Common.Parent->Asl.ParseOpcode == PARSEOP_DEFINITIONBLOCK)) &&
+        (Op->Common.Parent->Asl.ParseOpcode == PARSEOP_DEFINITION_BLOCK)) &&
             (ACPI_IS_ROOT_PREFIX (AmlNameString[0])))
     {
         /*
@@ -458,7 +458,7 @@ OptOptimizeNameDeclaration (
         /* Debug output */
 
         Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, *NewPath,
-                    NULL, &NewPathExternal);
+            NULL, &NewPathExternal);
         if (ACPI_FAILURE (Status))
         {
             AslCoreSubsystemError (Op, Status, "Externalizing NamePath",
@@ -474,8 +474,8 @@ OptOptimizeNameDeclaration (
          * We know that we are at the root, so NULL is used for the scope.
          */
         Status = AcpiNsLookup (NULL, *NewPath,
-                        ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
-                        ACPI_NS_DONT_OPEN_SCOPE, WalkState, &(Node));
+            ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
+            ACPI_NS_DONT_OPEN_SCOPE, WalkState, &(Node));
         if (ACPI_SUCCESS (Status))
         {
             /* Found the namepath, but make sure the node is correct */
@@ -633,6 +633,7 @@ OptOptimizeNamePath (
         {
             NextOp = NextOp->Asl.Parent;
         }
+
         if (NextOp && NextOp->Asl.Node)
         {
             CurrentNode = NextOp->Asl.Node;
@@ -662,6 +663,7 @@ OptOptimizeNamePath (
             ASL_NO_ABORT);
         return_VOID;
     }
+
     TargetPath.Length--;    /* Subtract one for null terminator */
 
     /* CurrentPath is the path to this scope (where we are in the namespace) */
@@ -674,12 +676,13 @@ OptOptimizeNamePath (
             ASL_NO_ABORT);
         return_VOID;
     }
+
     CurrentPath.Length--;   /* Subtract one for null terminator */
 
     /* Debug output only */
 
     Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, AmlNameString,
-                NULL, &ExternalNameString);
+        NULL, &ExternalNameString);
     if (ACPI_FAILURE (Status))
     {
         AslCoreSubsystemError (Op, Status, "Externalizing NamePath",
@@ -705,7 +708,7 @@ OptOptimizeNamePath (
          * a reference.
          */
         Status = OptOptimizeNameDeclaration (Op, WalkState, CurrentNode,
-                    TargetNode, AmlNameString, &NewPath);
+            TargetNode, AmlNameString, &NewPath);
         if (ACPI_FAILURE (Status))
         {
             /*
@@ -713,8 +716,8 @@ OptOptimizeNamePath (
              *    optimize the namestring with carats (up-arrow)
              */
             Status = OptBuildShortestPath (Op, WalkState, CurrentNode,
-                            TargetNode, &CurrentPath, &TargetPath,
-                            AmlNameStringLength, 1, &NewPath);
+                TargetNode, &CurrentPath, &TargetPath,
+                AmlNameStringLength, 1, &NewPath);
         }
     }
     else
@@ -726,7 +729,7 @@ OptOptimizeNamePath (
          *    NameSeg of the NamePath
          */
         Status = OptSearchToRoot (Op, WalkState, CurrentNode,
-                        TargetNode, &TargetPath, &NewPath);
+            TargetNode, &TargetPath, &NewPath);
         if (ACPI_FAILURE (Status))
         {
             /*
@@ -734,8 +737,8 @@ OptOptimizeNamePath (
              *    optimize the namestring with carats (up-arrow)
              */
             Status = OptBuildShortestPath (Op, WalkState, CurrentNode,
-                            TargetNode, &CurrentPath, &TargetPath,
-                            AmlNameStringLength, 0, &NewPath);
+                TargetNode, &CurrentPath, &TargetPath,
+                AmlNameStringLength, 0, &NewPath);
         }
     }
 
index ef6ad8b..2473a8d 100644 (file)
@@ -331,7 +331,8 @@ AslDoOptions (
             Status = AcpiDmAddToExternalFileList (argv[AcpiGbl_Optind]);
             if (ACPI_FAILURE (Status))
             {