[PATCH 1/2] ACPICA: fix IASL building issues with gcc-9 and --as-needed linker option

Colin King colin.king at canonical.com
Tue Mar 5 16:31:53 UTC 2019


From: Colin Ian King <colin.king at canonical.com>

Buglink: https://bugs.launchpad.net/bugs/1816474

The IASL component has been a bit broken for a while, it is by luck
that objects in it have not been causing linking issues because
we are not using the --as-needed option.  Fedora 30 on non-x86 targets
was hitting linker issues with missing objects. Fix this by re-syncing
just the required sources to build the IASL component.  Also clean
up the lex/yacc build rules.

Also remove the need for ACPI globals to be included into the
fwts_iasl_interface now that the linking is being performed correctly.

Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 src/acpica/source/compiler/Makefile.am        |  457 +++----
 src/acpica/source/compiler/aslhelp.c          |  336 +++++
 src/acpica/source/compiler/aslmapenter.c      |  456 +++++++
 src/acpica/source/compiler/asloptions.c       | 1127 +++++++++++++++++
 .../source/compiler/fwts_iasl_interface.c     |    2 -
 5 files changed, 2163 insertions(+), 215 deletions(-)
 create mode 100644 src/acpica/source/compiler/aslhelp.c
 create mode 100644 src/acpica/source/compiler/aslmapenter.c
 create mode 100644 src/acpica/source/compiler/asloptions.c

diff --git a/src/acpica/source/compiler/Makefile.am b/src/acpica/source/compiler/Makefile.am
index 7753c4a6..b237b47c 100644
--- a/src/acpica/source/compiler/Makefile.am
+++ b/src/acpica/source/compiler/Makefile.am
@@ -23,253 +23,284 @@
 AUTOMAKE_OPTIONS = subdir-objects
 
 AM_CPPFLAGS = -Wall -Wstrict-prototypes -fno-strict-aliasing -D_LINUX \
-		-DACPI_ASL_COMPILER $(CFLAGS) -I$(top_srcdir)/src/acpica/source/include \
-	-g
+	      -DACPI_ASL_COMPILER $(CFLAGS) -I$(top_srcdir)/src/acpica/source/include
 
-AM_YFLAGS = -v -d -y
+AM_YFLAGS = -d
 
 #
 # Case in-sensitive scanning
 #
 AM_LFLAGS = -i
 
-aslcompiler.c: $(srcdir)/aslparser.y
-	m4 -P -I$(srcdir) $^ > aslcompiler.y
-	${YACC} ${AM_YFLAGS} -baslcompiler -pAslCompiler aslcompiler.y
+ASL_PARSER = 				\
+	$(srcdir)/aslcstyle.y		\
+	$(srcdir)/aslhelpers.y		\
+	$(srcdir)/aslparser.y		\
+	$(srcdir)/aslprimaries.y	\
+	$(srcdir)/aslresources.y	\
+	$(srcdir)/aslrules.y		\
+	$(srcdir)/aslsupport.y		\
+	$(srcdir)/asltokens.y		\
+	$(srcdir)/asltypes.y
+
+ASL_LEXER =
+	$(srcdir)/aslcompiler.l		\
+	$(srcdir)/aslsupport.l		\
+	$(srcdir)/aslcompiler.y.h
+
+$(srcdir)/aslcompiler.y: $(ASL_PARSER)
+	m4 -P -I$(srcdir) $(srcdir)/aslparser.y > $@
+
+$(srcdir)/aslcompilerlex.c: $(ASL_LEXER)
+	${LEX} ${AM_LFLAGS} -PAslCompiler -o$@ $(srcdir)/aslcompiler.l
+
+.NOTPARALLEL: $(srcdir)/aslcompiler.c
+$(srcdir)/aslcompiler.c $(srcdir)/aslcompiler.y.h: $(srcdir)/aslcompiler.y
+	${YACC} ${AM_YFLAGS} -d -baslcompiler -pAslCompiler $^
 	mv aslcompiler.tab.c aslcompiler.c
 	mv aslcompiler.tab.h aslcompiler.y.h
 
-aslcompilerlex.c: $(srcdir)/aslcompiler.l
-	${LEX} ${AM_LFLAGS} -PAslCompiler -oaslcompilerlex.c $^
-
-dtparser.c: $(srcdir)/dtparser.y
-	${YACC} ${AM_YFLAGS} -bdtparser -pDtParser $^
+.NOTPARALLEL: $(srcdir)/dtparserlex.c
+$(srcdir)/dtparserlex.c $(srcdir)/dtparser.c $(srcdir)/dtparser.y.h: $(srcdir)/dtparser.l $(srcdir)/dtparser.y
+	${LEX} ${AM_LFLAGS} -PDtParser -o$(srcdir)/dtparserlex.c $<
+	${YACC} ${AM_YFLAGS} -bdtparser -pDtParser $(srcdir)/dtparser.y
 	mv dtparser.tab.c dtparser.c
 	mv dtparser.tab.h dtparser.y.h
 
-dtparserlex.c: $(srcdir)/dtparser.l
-	${LEX} ${AM_LFLAGS} -PDtParser -odtparserlex.c $^
-
-prparser.c: $(srcdir)/prparser.y
-	${YACC} ${AM_YFLAGS} -bprparser -pPrParser $^
+.NOTPARALLEL: $(srcdir)/prparserlex.c
+$(srcdir)/prparserlex.c $(srcdir)/prparser.c $(srcdir)/prparser.y.h: $(srcdir)/prparser.l $(srcdir)/prparser.y
+	${LEX} ${AM_LFLAGS} -PPrParser -o$(srcdir)/prparserlex.c $<
+	${YACC} ${AM_YFLAGS} -bprparser -pPrParser $(srcdir)/prparser.y
 	mv prparser.tab.c prparser.c
 	mv prparser.tab.h prparser.y.h
 
-prparserlex.c: $(srcdir)/prparser.l
-	${LEX} ${AM_LFLAGS} -PPrParser -oprparserlex.c $^
-
 pkglib_LTLIBRARIES = libfwtsiasl.la
 
-BUILT_SOURCES = aslcompiler.c 			\
-		aslcompilerlex.c		\
-		dtparser.c			\
-		dtparserlex.c 			\
-		prparser.c			\
-		prparserlex.c
+BUILT_SOURCES = aslcompiler.y		\
+		aslcompiler.y.h		\
+		aslcompilerlex.c	\
+		aslcompiler.c		\
+		dtparser.y.h		\
+		dtparserlex.c 		\
+		dtparser.c 		\
+		prparser.y.h		\
+		prparserlex.c		\
+		prparser.c
 
 #
 # Just export fwts specific API so we don't clash with core ACPICA library
 #
 libfwtsiasl_la_LDFLAGS = -export-symbols-regex "fwts_.*" -lpthread -version-info 1:0:0
 
-CLEANFILES = y.output y.tab.c y.tab.h aslcompiler.y.h $(BUILT_SOURCES)
+CLEANFILES = $(BUILT_SOURCES)
 
 libfwtsiasl_la_CPPFLAGS = $(AM_CPPFLAGS)
 libfwtsiasl_la_SOURCES = 			\
 	fwts_iasl_interface.c 			\
-	aslallocate.c				\
-	aslanalyze.c 				\
-	aslascii.c				\
-	aslcache.c				\
-	aslcompile.c 				\
-	aslcompilerlex.c 			\
-	aslcompiler.c 				\
-	aslcodegen.c 				\
-	asldebug.c				\
-	aslerror.c 				\
-	aslexternal.c				\
-	aslfiles.c 				\
-	aslfold.c 				\
-	asllength.c 				\
-	asllisting.c 				\
-	aslload.c 				\
-	asllookup.c 				\
-	aslmap.c 				\
-	aslmapoutput.c				\
-	aslmaputils.c				\
-	aslmessages.c				\
-	aslopcodes.c 				\
-	asloperands.c 				\
-	aslopt.c 				\
-	aslparseop.c				\
-	aslpld.c				\
-	aslpredef.c 				\
-	aslresource.c 				\
-	aslrestype1.c 				\
-	aslrestype1i.c 				\
-	aslrestype2.c 				\
-	aslrestype2d.c 				\
-	aslrestype2e.c 				\
-	aslrestype2q.c 				\
-	aslrestype2w.c 				\
-	aslstartup.c 				\
-	aslstubs.c 				\
-	asltransform.c 				\
-	asltree.c 				\
-	aslutils.c 				\
-	aslbtypes.c 				\
-	aslwalks.c 				\
-	asluuid.c 				\
-	aslmethod.c 				\
-	aslhex.c 				\
-	aslnamesp.c 				\
-	aslfileio.c 				\
-	asllistsup.c 				\
-	asloffset.c 				\
-	aslxref.c 				\
-	aslxrefout.c				\
-	aslprepkg.c 				\
-	aslprintf.c				\
-	aslprune.c				\
-	cvcompiler.c				\
-	cvdisasm.c				\
-	cvparser.c				\
-	dtfield.c 				\
-	dtio.c 					\
-	dtsubtable.c 				\
-	dttemplate.c 				\
-	dttable.c 				\
-	dttable1.c				\
-	dttable2.c				\
-	dtutils.c 				\
-	dtexpress.c 				\
-	dtcompile.c 				\
-	dtparser.c	 			\
-	dtparserlex.c 				\
-	prparser.c 				\
-	prparserlex.c 				\
-	prscan.c 				\
-	aslrestype2s.c 				\
-	prmacros.c 				\
-	prutils.c 				\
-	prexpress.c 				\
-	../components/utilities/utalloc.c 	\
-	../components/utilities/utcache.c 	\
-	../components/utilities/utcopy.c 	\
-	../components/utilities/utdebug.c 	\
-	../components/utilities/utdelete.c 	\
-	../components/utilities/utglobal.c 	\
-	../components/utilities/uthex.c		\
-	../components/utilities/utinit.c 	\
-	../components/utilities/utlock.c 	\
-	../components/utilities/utobject.c 	\
-	../components/utilities/utmisc.c 	\
-	../components/utilities/utmath.c 	\
-	../components/utilities/utmutex.c 	\
-	../components/utilities/utresrc.c 	\
-	../components/utilities/utstate.c 	\
-	../components/utilities/utxface.c 	\
-	../components/utilities/utxferror.c 	\
-	../components/utilities/utdecode.c 	\
-	../components/utilities/utpredef.c 	\
-	../components/utilities/utstring.c 	\
-	../components/utilities/utaddress.c 	\
-	../components/utilities/utownerid.c 	\
-	../components/utilities/utexcep.c 	\
-	../components/utilities/utuuid.c	\
-	../components/utilities/utxfinit.c	\
-	../components/namespace/nsaccess.c 	\
-	../components/namespace/nsalloc.c 	\
-	../components/namespace/nsdump.c 	\
-	../components/namespace/nsnames.c 	\
-	../components/namespace/nsobject.c 	\
-	../components/namespace/nsparse.c 	\
-	../components/namespace/nssearch.c 	\
-	../components/namespace/nsutils.c 	\
-	../components/namespace/nswalk.c 	\
-	../components/namespace/nsxfobj.c 	\
-	../components/parser/psargs.c 		\
-	../components/parser/psloop.c 		\
-	../components/parser/psopcode.c 	\
-	../components/parser/psparse.c 		\
-	../components/parser/psscope.c 		\
-	../components/parser/pstree.c 		\
-	../components/parser/psutils.c 		\
-	../components/parser/pswalk.c 		\
-	../components/parser/psobject.c 	\
-	../components/parser/psopinfo.c 	\
-	../components/dispatcher/dswscope.c 	\
-	../components/dispatcher/dswstate.c 	\
-	../components/dispatcher/dsfield.c 	\
-	../components/dispatcher/dsobject.c 	\
-	../components/dispatcher/dsopcode.c 	\
-	../components/dispatcher/dsutils.c 	\
-	../components/dispatcher/dswexec.c 	\
-	../components/dispatcher/dswload.c 	\
-	../components/dispatcher/dswload2.c 	\
-	../components/dispatcher/dsargs.c 	\
-	../components/dispatcher/dscontrol.c 	\
-	../components/executer/exconcat.c	\
-	../components/executer/exconvrt.c 	\
-	../components/executer/excreate.c 	\
-	../components/executer/exdump.c 	\
-	../components/executer/exmisc.c 	\
-	../components/executer/exmutex.c 	\
-	../components/executer/exnames.c 	\
-	../components/executer/exoparg1.c 	\
-	../components/executer/exoparg2.c 	\
-	../components/executer/exoparg3.c 	\
-	../components/executer/exoparg6.c 	\
-	../components/executer/exprep.c 	\
-	../components/executer/exregion.c 	\
-	../components/executer/exresnte.c 	\
-	../components/executer/exresolv.c 	\
-	../components/executer/exresop.c 	\
-	../components/executer/exstore.c 	\
-	../components/executer/exstoren.c 	\
-	../components/executer/exstorob.c 	\
-	../components/executer/exsystem.c 	\
-	../components/executer/exutils.c 	\
-	../common/adfile.c 			\
-	../common/adisasm.c 			\
-	../common/adwalk.c 			\
-	../common/ahids.c 			\
-	../common/ahpredef.c 			\
+	aslcompilerlex.c			\
+	aslcompiler.c				\
+	dtparserlex.c				\
+	dtparser.c				\
+	prparserlex.c				\
+	prparser.c				\
+	../common/adisasm.c			\
+	../common/acfileio.c			\
+	../common/adfile.c			\
+	../common/adwalk.c			\
+	../common/ahids.c			\
+	../common/ahpredef.c			\
+	../common/ahtable.c			\
+	../common/ahuuids.c			\
+	../compiler/aslallocate.c		\
+	../compiler/aslanalyze.c		\
+	../compiler/aslascii.c			\
+	../compiler/aslbtypes.c			\
+	../compiler/aslcache.c			\
+	../compiler/aslcodegen.c		\
+	../compiler/aslcompile.c		\
+	../compiler/asldebug.c			\
+	../compiler/aslerror.c			\
+	../compiler/aslexternal.c		\
+	../compiler/aslfiles.c			\
+	../compiler/aslfileio.c			\
+	../compiler/aslfold.c			\
+	../compiler/aslhelp.c			\
+	../compiler/aslhex.c			\
+	../compiler/asllength.c			\
+	../compiler/asllisting.c		\
+	../compiler/asllistsup.c		\
+	../compiler/aslload.c			\
+	../compiler/asllookup.c			\
+	../compiler/aslmain.c			\
+	../compiler/aslmap.c			\
+	../compiler/aslmapenter.c		\
+	../compiler/aslmapoutput.c		\
+	../compiler/aslmaputils.c		\
+	../compiler/aslmessages.c		\
+	../compiler/aslmethod.c			\
+	../compiler/aslnamesp.c			\
+	../compiler/asloffset.c			\
+	../compiler/aslopcodes.c		\
+	../compiler/asloperands.c		\
+	../compiler/aslopt.c			\
+	../compiler/asloptions.c		\
+	../compiler/aslparseop.c		\
+	../compiler/aslpredef.c			\
+	../compiler/aslprepkg.c			\
+	../compiler/aslprintf.c			\
+	../compiler/aslprune.c			\
+	../compiler/aslresource.c		\
+	../compiler/aslrestype1.c		\
+	../compiler/aslrestype1i.c		\
+	../compiler/aslrestype2.c		\
+	../compiler/aslrestype2d.c		\
+	../compiler/aslrestype2e.c		\
+	../compiler/aslrestype2q.c		\
+	../compiler/aslrestype2s.c		\
+	../compiler/aslrestype2w.c		\
+	../compiler/aslstartup.c		\
+	../compiler/aslstubs.c			\
+	../compiler/aslpld.c			\
+	../compiler/asltransform.c		\
+	../compiler/asltree.c			\
+	../compiler/aslutils.c			\
+	../compiler/asluuid.c			\
+	../compiler/aslwalks.c			\
+	../compiler/aslxref.c			\
+	../compiler/aslxrefout.c		\
+	../compiler/cvcompiler.c		\
+	../compiler/cvdisasm.c			\
+	../compiler/cvparser.c			\
 	../common/cmfsize.c			\
-	../common/dmextern.c 			\
-	../common/dmrestag.c 			\
+	../components/debugger/dbfileio.c	\
+	../components/disassembler/dmbuffer.c	\
+	../components/disassembler/dmcstyle.c	\
+	../components/disassembler/dmdeferred.c	\
+	../common/dmextern.c			\
+	../components/disassembler/dmnames.c	\
+	../components/disassembler/dmopcode.c	\
+	../components/disassembler/dmresrc.c	\
+	../components/disassembler/dmresrcl.c	\
+	../components/disassembler/dmresrcl2.c	\
+	../components/disassembler/dmresrcs.c	\
+	../common/dmrestag.c			\
 	../common/dmswitch.c			\
-	../common/dmtable.c 			\
+	../common/dmtable.c			\
 	../common/dmtables.c			\
-	../common/dmtbinfo.c 			\
-	../common/dmtbinfo1.c			\
-	../common/dmtbinfo2.c			\
-	../common/dmtbinfo3.c			\
-	../common/dmtbdump.c 			\
+	../common/dmtbdump.c			\
 	../common/dmtbdump1.c			\
 	../common/dmtbdump2.c			\
 	../common/dmtbdump3.c			\
+	../common/dmtbinfo.c			\
+	../common/dmtbinfo1.c			\
+	../common/dmtbinfo2.c			\
+	../common/dmtbinfo3.c			\
+	../components/disassembler/dmutils.c	\
+	../components/disassembler/dmwalk.c	\
+	../components/dispatcher/dsargs.c	\
+	../components/dispatcher/dscontrol.c	\
+	../components/dispatcher/dsfield.c	\
+	../components/dispatcher/dsobject.c	\
+	../components/dispatcher/dsopcode.c	\
+	../components/dispatcher/dspkginit.c	\
+	../components/dispatcher/dsutils.c	\
+	../components/dispatcher/dswexec.c	\
+	../components/dispatcher/dswload.c	\
+	../components/dispatcher/dswload2.c	\
+	../components/dispatcher/dswscope.c	\
+	../components/dispatcher/dswstate.c	\
+	../compiler/dtcompile.c			\
+	../compiler/dtexpress.c			\
+	../compiler/dtfield.c			\
+	../compiler/dtio.c			\
+	../compiler/dtsubtable.c		\
+	../compiler/dttable.c			\
+	../compiler/dttable1.c			\
+	../compiler/dttable2.c			\
+	../compiler/dttemplate.c		\
+	../compiler/dtutils.c			\
+	../components/executer/exconcat.c	\
+	../components/executer/exconvrt.c	\
+	../components/executer/excreate.c	\
+	../components/executer/exdump.c		\
+	../components/executer/exmisc.c		\
+	../components/executer/exmutex.c	\
+	../components/executer/exnames.c	\
+	../components/executer/exoparg1.c	\
+	../components/executer/exoparg2.c	\
+	../components/executer/exoparg3.c	\
+	../components/executer/exoparg6.c	\
+	../components/executer/exprep.c		\
+	../components/executer/exregion.c	\
+	../components/executer/exresnte.c	\
+	../components/executer/exresolv.c	\
+	../components/executer/exresop.c	\
+	../components/executer/exstore.c	\
+	../components/executer/exstoren.c	\
+	../components/executer/exstorob.c	\
+	../components/executer/exsystem.c	\
+	../components/executer/exutils.c	\
 	../common/getopt.c			\
-	../components/debugger/dbfileio.c 	\
-	../components/disassembler/dmbuffer.c 	\
-	../components/disassembler/dmcstyle.c	\
-	../components/disassembler/dmnames.c 	\
-	../components/disassembler/dmopcode.c 	\
-	../components/disassembler/dmresrc.c 	\
-	../components/disassembler/dmresrcl.c 	\
-	../components/disassembler/dmresrcs.c 	\
-	../components/disassembler/dmutils.c 	\
-	../components/disassembler/dmwalk.c 	\
-	../components/disassembler/dmdeferred.c \
-	../components/disassembler/dmresrcl2.c 	\
+	../components/namespace/nsaccess.c	\
+	../components/namespace/nsalloc.c	\
+	../components/namespace/nsdump.c	\
+	../components/namespace/nsnames.c	\
+	../components/namespace/nsobject.c	\
+	../components/namespace/nsparse.c	\
+	../components/namespace/nssearch.c	\
+	../components/namespace/nsutils.c	\
+	../components/namespace/nswalk.c	\
+	../components/namespace/nsxfobj.c	\
+	../os_specific/service_layers/osunixxf.c\
+	../compiler/prexpress.c			\
+	../compiler/prmacros.c			\
+	../compiler/prscan.c			\
+	../compiler/prutils.c			\
+	../components/parser/psargs.c		\
+	../components/parser/psloop.c		\
+	../components/parser/psobject.c		\
+	../components/parser/psopcode.c		\
+	../components/parser/psopinfo.c		\
+	../components/parser/psparse.c		\
+	../components/parser/psscope.c		\
+	../components/parser/pstree.c		\
+	../components/parser/psutils.c		\
+	../components/parser/pswalk.c		\
 	../components/tables/tbdata.c		\
-	../components/tables/tbfadt.c 		\
-	../components/tables/tbinstal.c 	\
-	../components/tables/tbutils.c 		\
-	../components/tables/tbxface.c 		\
-	../components/tables/tbxfroot.c		\
-	../components/tables/tbxfload.c		\
+	../components/tables/tbfadt.c		\
+	../components/tables/tbinstal.c		\
 	../components/tables/tbprint.c		\
-	../tools/acpiexec/aeinitfile.c		\
-	../os_specific/service_layers/osunixxf.c
-
+	../components/tables/tbutils.c		\
+	../components/tables/tbxface.c		\
+	../components/tables/tbxfload.c		\
+	../components/utilities/utaddress.c	\
+	../components/utilities/utalloc.c	\
+	../components/utilities/utascii.c	\
+	../components/utilities/utbuffer.c	\
+	../components/utilities/utcache.c	\
+	../components/utilities/utcopy.c	\
+	../components/utilities/utdebug.c	\
+	../components/utilities/utdecode.c	\
+	../components/utilities/utdelete.c	\
+	../components/utilities/uterror.c	\
+	../components/utilities/utexcep.c	\
+	../components/utilities/utglobal.c	\
+	../components/utilities/uthex.c		\
+	../components/utilities/utinit.c	\
+	../components/utilities/utlock.c	\
+	../components/utilities/utmath.c	\
+	../components/utilities/utmisc.c	\
+	../components/utilities/utmutex.c	\
+	../components/utilities/utnonansi.c	\
+	../components/utilities/utobject.c	\
+	../components/utilities/utownerid.c	\
+	../components/utilities/utpredef.c	\
+	../components/utilities/utresdecode.c	\
+	../components/utilities/utresrc.c	\
+	../components/utilities/utstate.c	\
+	../components/utilities/utstrtoul64.c	\
+	../components/utilities/utstrsuppt.c	\
+	../components/utilities/utstring.c	\
+	../components/utilities/utuuid.c	\
+	../components/utilities/utxface.c	\
+	../components/utilities/utxferror.c
diff --git a/src/acpica/source/compiler/aslhelp.c b/src/acpica/source/compiler/aslhelp.c
new file mode 100644
index 00000000..f51b07f8
--- /dev/null
+++ b/src/acpica/source/compiler/aslhelp.c
@@ -0,0 +1,336 @@
+/******************************************************************************
+ *
+ * Module Name: aslhelp - iASL help screens
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2019, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************
+ *
+ * Alternatively, you may choose to be licensed under the terms of the
+ * following license:
+ *
+ * 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.
+ *
+ * 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 MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * 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 DAMAGE.
+ *
+ * Alternatively, you may choose to be licensed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ *****************************************************************************/
+
+#include "aslcompiler.h"
+#include "acapps.h"
+
+#define _COMPONENT          ACPI_COMPILER
+        ACPI_MODULE_NAME    ("aslhelp")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    Usage
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Display option help message.
+ *              Optional items in square brackets.
+ *
+ ******************************************************************************/
+
+void
+Usage (
+    void)
+{
+    printf (ACPI_COMMON_SIGNON (ASL_COMPILER_NAME));
+    printf ("%s\n\n", ASL_COMPLIANCE);
+    ACPI_USAGE_HEADER ("iasl [Options] [Files]");
+
+    printf ("\nGeneral:\n");
+    ACPI_OPTION ("-@  <file>",      "Specify command file");
+    ACPI_OPTION ("-I  <dir>",       "Specify additional include directory");
+    ACPI_OPTION ("-p  <prefix>",    "Specify path/filename prefix for all output files");
+    ACPI_OPTION ("-v",              "Display compiler version");
+    ACPI_OPTION ("-vd",             "Display compiler build date and time");
+    ACPI_OPTION ("-vo",             "Enable optimization comments");
+    ACPI_OPTION ("-vs",             "Disable signon");
+
+    printf ("\nHelp:\n");
+    ACPI_OPTION ("-h",              "This message");
+    ACPI_OPTION ("-hc",             "Display operators allowed in constant expressions");
+    ACPI_OPTION ("-hd",             "Info for obtaining and disassembling binary ACPI tables");
+    ACPI_OPTION ("-hf",             "Display help for output filename generation");
+    ACPI_OPTION ("-hr",             "Display ACPI reserved method names");
+    ACPI_OPTION ("-ht",             "Display currently supported ACPI table names");
+
+    printf ("\nPreprocessor:\n");
+    ACPI_OPTION ("-D <symbol>",     "Define symbol for preprocessor use");
+    ACPI_OPTION ("-li",             "Create preprocessed output file (*.i)");
+    ACPI_OPTION ("-P",              "Preprocess only and create preprocessor output file (*.i)");
+    ACPI_OPTION ("-Pn",             "Disable preprocessor");
+
+    printf ("\nErrors, Warnings, and Remarks:\n");
+    ACPI_OPTION ("-va",             "Disable all errors/warnings/remarks");
+    ACPI_OPTION ("-ve",             "Report only errors (ignore warnings and remarks)");
+    ACPI_OPTION ("-vi",             "Less verbose errors and warnings for use with IDEs");
+    ACPI_OPTION ("-vr",             "Disable remarks");
+    ACPI_OPTION ("-vw <messageid>", "Ignore specific error, warning or remark");
+    ACPI_OPTION ("-vx <messageid>", "Expect a specific warning, remark, or error");
+    ACPI_OPTION ("-w <1|2|3>",      "Set warning reporting level");
+    ACPI_OPTION ("-we",             "Report warnings as errors");
+    ACPI_OPTION ("-ww <messageid>", "Report specific warning or remark as error");
+
+    printf ("\nAML Bytecode Generation (*.aml):\n");
+    ACPI_OPTION ("-oa",             "Disable all optimizations (compatibility mode)");
+    ACPI_OPTION ("-of",             "Disable constant folding");
+    ACPI_OPTION ("-oi",             "Disable integer optimization to Zero/One/Ones");
+    ACPI_OPTION ("-on",             "Disable named reference string optimization");
+    ACPI_OPTION ("-ot",             "Disable typechecking");
+    ACPI_OPTION ("-cr",             "Disable Resource Descriptor error checking");
+    ACPI_OPTION ("-in",             "Ignore NoOp operators");
+    ACPI_OPTION ("-r <revision>",   "Override table header Revision (1-255)");
+
+    printf ("\nListings:\n");
+    ACPI_OPTION ("-l",              "Create mixed listing file (ASL source and AML) (*.lst)");
+    ACPI_OPTION ("-lm",             "Create hardware summary map file (*.map)");
+    ACPI_OPTION ("-ln",             "Create namespace file (*.nsp)");
+    ACPI_OPTION ("-ls",             "Create combined source file (expanded includes) (*.src)");
+    ACPI_OPTION ("-lx",             "Create cross-reference file (*.xrf)");
+
+    printf ("\nFirmware Support - C Text Output:\n");
+    ACPI_OPTION ("-tc",             "Create hex AML table in C (*.hex)");
+    ACPI_OPTION ("-sc",             "Create named hex AML arrays in C (*.c)");
+    ACPI_OPTION ("-ic",             "Create include file in C for -sc symbols (*.h)");
+    ACPI_OPTION ("-so",             "Create namespace AML offset table in C (*.offset.h)");
+
+    printf ("\nFirmware Support - Assembler Text Output:\n");
+    ACPI_OPTION ("-ta",             "Create hex AML table in assembler (*.hex)");
+    ACPI_OPTION ("-sa",             "Create named hex AML arrays in assembler (*.asm)");
+    ACPI_OPTION ("-ia",             "Create include file in assembler for -sa symbols (*.inc)");
+
+    printf ("\nFirmware Support - ASL Text Output:\n");
+    ACPI_OPTION ("-ts",             "Create hex AML table in ASL (Buffer object) (*.hex)");
+
+    printf ("\nLegacy-ASL to ASL+ Converter:\n");
+    ACPI_OPTION ("-ca <file>",      "Convert legacy-ASL source file to new ASL+ file");
+    ACPI_OPTION ("",                "  (Original comments are passed through to ASL+ file)");
+
+    printf ("\nData Table Compiler:\n");
+    ACPI_OPTION ("-G",              "Compile custom table that contains generic operators");
+    ACPI_OPTION ("-T <sig list>|ALL",   "Create ACPI table template/example files");
+    ACPI_OPTION ("-T <count>",      "Emit DSDT and <count> SSDTs to same file");
+    ACPI_OPTION ("-vt",             "Create verbose template files (full disassembly)");
+
+    printf ("\nAML Disassembler:\n");
+    ACPI_OPTION ("-d  <f1 f2 ...>", "Disassemble or decode binary ACPI tables to file (*.dsl)");
+    ACPI_OPTION ("",                "  (Optional, file type is automatically detected)");
+    ACPI_OPTION ("-da <f1 f2 ...>", "Disassemble multiple tables from single namespace");
+    ACPI_OPTION ("-db",             "Do not translate Buffers to Resource Templates");
+    ACPI_OPTION ("-dc <f1 f2 ...>", "Disassemble AML and immediately compile it");
+    ACPI_OPTION ("",                "  (Obtain DSDT from current system if no input file)");
+    ACPI_OPTION ("-df",             "Force disassembler to assume table contains valid AML");
+    ACPI_OPTION ("-dl",             "Emit legacy ASL code only (no C-style operators)");
+    ACPI_OPTION ("-e  <f1 f2 ...>", "Include ACPI table(s) for external symbol resolution");
+    ACPI_OPTION ("-fe <file>",      "Specify external symbol declaration file");
+    ACPI_OPTION ("-in",             "Ignore NoOp opcodes");
+    ACPI_OPTION ("-l",              "Disassemble to mixed ASL and AML code");
+    ACPI_OPTION ("-vt",             "Dump binary table data in hex format within output file");
+
+    printf ("\nDebug Options:\n");
+    ACPI_OPTION ("-bc",             "Create converter debug file (*.cdb)");
+    ACPI_OPTION ("-bf",             "Create debug file (full output) (*.txt)");
+    ACPI_OPTION ("-bs",             "Create debug file (parse tree only) (*.txt)");
+    ACPI_OPTION ("-bp <depth>",     "Prune ASL parse tree");
+    ACPI_OPTION ("-bt <type>",      "Object type to be pruned from the parse tree");
+    ACPI_OPTION ("-f",              "Ignore errors, force creation of AML output file(s)");
+    ACPI_OPTION ("-m <size>",       "Set internal line buffer size (in Kbytes)");
+    ACPI_OPTION ("-n",              "Parse only, no output generation");
+    ACPI_OPTION ("-oc",             "Display compile times and statistics");
+    ACPI_OPTION ("-x <level>",      "Set debug level for trace output");
+    ACPI_OPTION ("-z",              "Do not insert new compiler ID for DataTables");
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    FilenameHelp
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Display help message for output filename generation
+ *
+ ******************************************************************************/
+
+void
+AslFilenameHelp (
+    void)
+{
+
+    printf ("\nAML output filename generation:\n");
+    printf ("  Output filenames are generated by appending an extension to a common\n");
+    printf ("  filename prefix. The filename prefix is obtained via one of the\n");
+    printf ("  following methods (in priority order):\n");
+    printf ("    1) The -p option specifies the prefix\n");
+    printf ("    2) The prefix of the AMLFileName in the ASL Definition Block\n");
+    printf ("    3) The prefix of the input filename\n");
+    printf ("\n");
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AslDisassemblyHelp
+ *
+ * PARAMETERS:  None
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Display help message for obtaining and disassembling AML/ASL
+ *              files.
+ *
+ ******************************************************************************/
+
+void
+AslDisassemblyHelp (
+    void)
+{
+
+    printf ("\nObtaining binary ACPI tables and disassembling to ASL source code.\n\n");
+    printf ("Use the following ACPICA toolchain:\n");
+    printf ("  AcpiDump: Dump all ACPI tables to a hex ascii file\n");
+    printf ("  AcpiXtract: Extract one or more binary ACPI tables from AcpiDump output\n");
+    printf ("  iASL -d <file>: Disassemble a binary ACPI table to ASL source code\n");
+    printf ("\n");
+}
diff --git a/src/acpica/source/compiler/aslmapenter.c b/src/acpica/source/compiler/aslmapenter.c
new file mode 100644
index 00000000..995ddc99
--- /dev/null
+++ b/src/acpica/source/compiler/aslmapenter.c
@@ -0,0 +1,456 @@
+/******************************************************************************
+ *
+ * Module Name: aslmapenter - Build resource descriptor/device maps
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2019, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************
+ *
+ * Alternatively, you may choose to be licensed under the terms of the
+ * following license:
+ *
+ * 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.
+ *
+ * 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 MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * 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 DAMAGE.
+ *
+ * Alternatively, you may choose to be licensed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ *****************************************************************************/
+
+#include "acpi.h"
+#include "accommon.h"
+#include "acapps.h"
+#include "aslcompiler.h"
+
+/* This module used for application-level code only */
+
+#define _COMPONENT          ACPI_COMPILER
+        ACPI_MODULE_NAME    ("aslmapenter")
+
+/* Local prototypes */
+
+static ACPI_GPIO_INFO *
+MpCreateGpioInfo (
+    UINT16                  PinNumber,
+    char                    *DeviceName);
+
+static ACPI_SERIAL_INFO *
+MpCreateSerialInfo (
+    char                    *DeviceName,
+    UINT16                  Address);
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    MpSaveGpioInfo
+ *
+ * PARAMETERS:  Resource                - GPIO resource descriptor
+ *              PinCount                - From GPIO descriptor
+ *              PinList                 - From GPIO descriptor
+ *              DeviceName              - The "ResourceSource" name
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: External Interface.
+ *              Save GPIO resource descriptor information.
+ *              Creates new GPIO info blocks, one for each pin defined by the
+ *              GPIO descriptor.
+ *
+ ******************************************************************************/
+
+void
+MpSaveGpioInfo (
+    ACPI_PARSE_OBJECT       *Op,
+    AML_RESOURCE            *Resource,
+    UINT32                  PinCount,
+    UINT16                  *PinList,
+    char                    *DeviceName)
+{
+    ACPI_GPIO_INFO          *Info;
+    UINT32                  i;
+
+
+    /* Mapfile option enabled? */
+
+    if (!AslGbl_MapfileFlag)
+    {
+        return;
+    }
+
+    /* Create an info block for each pin defined in the descriptor */
+
+    for (i = 0; i < PinCount; i++)
+    {
+        Info = MpCreateGpioInfo (PinList[i], DeviceName);
+
+        Info->Op = Op;
+        Info->DeviceName = DeviceName;
+        Info->PinCount = PinCount;
+        Info->PinIndex = i;
+        Info->PinNumber = PinList[i];
+        Info->Type = Resource->Gpio.ConnectionType;
+        Info->Direction = (UINT8) (Resource->Gpio.IntFlags & 0x0003);       /* _IOR, for IO descriptor */
+        Info->Polarity = (UINT8) ((Resource->Gpio.IntFlags >> 1) & 0x0003); /* _POL, for INT descriptor */
+    }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    MpSaveSerialInfo
+ *
+ * PARAMETERS:  Resource                - A Serial resource descriptor
+ *              DeviceName              - The "ResourceSource" name.
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: External Interface.
+ *              Save serial resource descriptor information.
+ *              Creates a new serial info block.
+ *
+ ******************************************************************************/
+
+void
+MpSaveSerialInfo (
+    ACPI_PARSE_OBJECT       *Op,
+    AML_RESOURCE            *Resource,
+    char                    *DeviceName)
+{
+    ACPI_SERIAL_INFO        *Info;
+    UINT16                  Address;
+    UINT32                  Speed;
+
+
+    /* Mapfile option enabled? */
+
+    if (!AslGbl_MapfileFlag)
+    {
+        return;
+    }
+
+    if (Resource->DescriptorType != ACPI_RESOURCE_NAME_SERIAL_BUS)
+    {
+        return;
+    }
+
+    /* Extract address and speed from the resource descriptor */
+
+    switch (Resource->CommonSerialBus.Type)
+    {
+    case AML_RESOURCE_I2C_SERIALBUSTYPE:
+
+        Address = Resource->I2cSerialBus.SlaveAddress;
+        Speed = Resource->I2cSerialBus.ConnectionSpeed;
+        break;
+
+    case AML_RESOURCE_SPI_SERIALBUSTYPE:
+
+        Address = Resource->SpiSerialBus.DeviceSelection;
+        Speed = Resource->SpiSerialBus.ConnectionSpeed;
+        break;
+
+    case AML_RESOURCE_UART_SERIALBUSTYPE:
+
+        Address = 0;
+        Speed = Resource->UartSerialBus.DefaultBaudRate;
+        break;
+
+    default:    /* Invalid bus subtype */
+        return;
+    }
+
+    Info = MpCreateSerialInfo (DeviceName, Address);
+
+    Info->Op = Op;
+    Info->DeviceName = DeviceName;
+    Info->Resource = Resource;
+    Info->Address = Address;
+    Info->Speed = Speed;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    MpCreateGpioInfo
+ *
+ * PARAMETERS:  PinNumber               - GPIO pin number
+ *              DeviceName              - The "ResourceSource" name
+ *
+ * RETURN:      New GPIO info block.
+ *
+ * DESCRIPTION: Create a new GPIO info block and place it on the global list.
+ *              The list is sorted by GPIO device names first, and pin numbers
+ *              secondarily.
+ *
+ ******************************************************************************/
+
+static ACPI_GPIO_INFO *
+MpCreateGpioInfo (
+    UINT16                  PinNumber,
+    char                    *DeviceName)
+{
+    ACPI_GPIO_INFO          *Info;
+    ACPI_GPIO_INFO          *NextGpio;
+    ACPI_GPIO_INFO          *PrevGpio;
+    char                    *Buffer;
+
+
+    /*
+     * Allocate a new info block and insert it into the global GPIO list
+     * sorted by both source device name and then the pin number. There is
+     * one block per pin.
+     */
+    Buffer = UtLocalCacheCalloc (sizeof (ACPI_GPIO_INFO));
+    Info = ACPI_CAST_PTR (ACPI_GPIO_INFO, Buffer);
+
+    NextGpio = AslGbl_GpioList;
+    PrevGpio = NULL;
+    if (!AslGbl_GpioList)
+    {
+        AslGbl_GpioList = Info;
+        Info->Next = NULL;
+        return (Info);
+    }
+
+    /* Sort on source DeviceName first */
+
+    while (NextGpio &&
+        (strcmp (DeviceName, NextGpio->DeviceName) > 0))
+    {
+        PrevGpio = NextGpio;
+        NextGpio = NextGpio->Next;
+    }
+
+    /* Now sort on the PinNumber */
+
+    while (NextGpio &&
+        (NextGpio->PinNumber < PinNumber) &&
+        !strcmp (DeviceName, NextGpio->DeviceName))
+    {
+        PrevGpio = NextGpio;
+        NextGpio = NextGpio->Next;
+    }
+
+    /* Finish the list insertion */
+
+    if (PrevGpio)
+    {
+        PrevGpio->Next = Info;
+    }
+    else
+    {
+        AslGbl_GpioList = Info;
+    }
+
+    Info->Next = NextGpio;
+    return (Info);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    MpCreateSerialInfo
+ *
+ * PARAMETERS:  DeviceName              - The "ResourceSource" name.
+ *              Address                 - Physical address for the device
+ *
+ * RETURN:      New Serial info block.
+ *
+ * DESCRIPTION: Create a new Serial info block and place it on the global list.
+ *              The list is sorted by Serial device names first, and addresses
+ *              secondarily.
+ *
+ ******************************************************************************/
+
+static ACPI_SERIAL_INFO *
+MpCreateSerialInfo (
+    char                    *DeviceName,
+    UINT16                  Address)
+{
+    ACPI_SERIAL_INFO        *Info;
+    ACPI_SERIAL_INFO        *NextSerial;
+    ACPI_SERIAL_INFO        *PrevSerial;
+    char                    *Buffer;
+
+
+    /*
+     * Allocate a new info block and insert it into the global Serial list
+     * sorted by both source device name and then the address.
+     */
+    Buffer = UtLocalCacheCalloc (sizeof (ACPI_SERIAL_INFO));
+    Info = ACPI_CAST_PTR (ACPI_SERIAL_INFO, Buffer);
+
+    NextSerial = AslGbl_SerialList;
+    PrevSerial = NULL;
+    if (!AslGbl_SerialList)
+    {
+        AslGbl_SerialList = Info;
+        Info->Next = NULL;
+        return (Info);
+    }
+
+    /* Sort on source DeviceName */
+
+    while (NextSerial &&
+        (strcmp (DeviceName, NextSerial->DeviceName) > 0))
+    {
+        PrevSerial = NextSerial;
+        NextSerial = NextSerial->Next;
+    }
+
+    /* Now sort on the Address */
+
+    while (NextSerial &&
+        (NextSerial->Address < Address) &&
+        !strcmp (DeviceName, NextSerial->DeviceName))
+    {
+        PrevSerial = NextSerial;
+        NextSerial = NextSerial->Next;
+    }
+
+    /* Finish the list insertion */
+
+    if (PrevSerial)
+    {
+        PrevSerial->Next = Info;
+    }
+    else
+    {
+        AslGbl_SerialList = Info;
+    }
+
+    Info->Next = NextSerial;
+    return (Info);
+}
diff --git a/src/acpica/source/compiler/asloptions.c b/src/acpica/source/compiler/asloptions.c
new file mode 100644
index 00000000..dc0b9079
--- /dev/null
+++ b/src/acpica/source/compiler/asloptions.c
@@ -0,0 +1,1127 @@
+/******************************************************************************
+ *
+ * Module Name: asloptions - compiler command line processing
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2019, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************
+ *
+ * Alternatively, you may choose to be licensed under the terms of the
+ * following license:
+ *
+ * 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.
+ *
+ * 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 MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * 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 DAMAGE.
+ *
+ * Alternatively, you may choose to be licensed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ *****************************************************************************/
+
+#include "aslcompiler.h"
+#include "acapps.h"
+#include "acdisasm.h"
+
+#define _COMPONENT          ACPI_COMPILER
+        ACPI_MODULE_NAME    ("asloption")
+
+
+/* Local prototypes */
+
+static int
+AslDoOptions (
+    int                     argc,
+    char                    **argv,
+    BOOLEAN                 IsResponseFile);
+
+static void
+AslMergeOptionTokens (
+    char                    *InBuffer,
+    char                    *OutBuffer);
+
+static int
+AslDoResponseFile (
+    char                    *Filename);
+
+
+#define ASL_TOKEN_SEPARATORS    " \t\n"
+#define ASL_SUPPORTED_OPTIONS   "@:a:b|c|d^D:e:f^gh^i|I:l^m:no|p:P^q^r:s|t|T+G^v^w|x:z"
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AslCommandLine
+ *
+ * PARAMETERS:  argc/argv
+ *
+ * RETURN:      Last argv index
+ *
+ * DESCRIPTION: Command line processing
+ *
+ ******************************************************************************/
+
+int
+AslCommandLine (
+    int                     argc,
+    char                    **argv)
+{
+    int                     BadCommandLine = 0;
+    ACPI_STATUS             Status;
+
+
+    /* Minimum command line contains at least the command and an input file */
+
+    if (argc < 2)
+    {
+        Usage ();
+        exit (1);
+    }
+
+    /* Process all command line options */
+
+    BadCommandLine = AslDoOptions (argc, argv, FALSE);
+
+    if (AslGbl_DoTemplates)
+    {
+        Status = DtCreateTemplates (argv);
+        if (ACPI_FAILURE (Status))
+        {
+            exit (-1);
+        }
+        exit (1);
+    }
+
+    /* Next parameter must be the input filename */
+
+    if (!argv[AcpiGbl_Optind] &&
+        !AcpiGbl_DisasmFlag)
+    {
+        printf ("Missing input filename\n");
+        BadCommandLine = TRUE;
+    }
+
+    if (AslGbl_DoSignon)
+    {
+        printf (ACPI_COMMON_SIGNON (ASL_COMPILER_NAME));
+        if (AslGbl_IgnoreErrors)
+        {
+            printf ("Ignoring all errors, forcing AML file generation\n\n");
+        }
+    }
+
+    if (BadCommandLine)
+    {
+        printf ("Use -h option for help information\n");
+        exit (1);
+    }
+
+    return (AcpiGbl_Optind);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AslDoOptions
+ *
+ * PARAMETERS:  argc/argv           - Standard argc/argv
+ *              IsResponseFile      - TRUE if executing a response file.
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Command line option processing
+ *
+ ******************************************************************************/
+
+static int
+AslDoOptions (
+    int                     argc,
+    char                    **argv,
+    BOOLEAN                 IsResponseFile)
+{
+    ACPI_STATUS             Status;
+    UINT32                  j;
+
+
+    /* Get the command line options */
+
+    while ((j = AcpiGetopt (argc, argv, ASL_SUPPORTED_OPTIONS)) != ACPI_OPT_END) switch (j)
+    {
+    case '@':   /* Begin a response file */
+
+        if (IsResponseFile)
+        {
+            printf ("Nested command files are not supported\n");
+            return (-1);
+        }
+
+        if (AslDoResponseFile (AcpiGbl_Optarg))
+        {
+            return (-1);
+        }
+        break;
+
+    case 'a':   /* Debug options */
+
+        switch (AcpiGbl_Optarg[0])
+        {
+        case 'r':
+
+            AslGbl_EnableReferenceTypechecking = TRUE;
+            break;
+
+        default:
+
+            printf ("Unknown option: -a%s\n", AcpiGbl_Optarg);
+            return (-1);
+        }
+
+        break;
+
+
+    case 'b':   /* Debug options */
+
+        switch (AcpiGbl_Optarg[0])
+        {
+
+        case 'c':
+
+            printf ("Debug ASL to ASL+ conversion\n");
+
+            AslGbl_DoAslConversion = TRUE;
+            AslGbl_FoldConstants = FALSE;
+            AslGbl_IntegerOptimizationFlag = FALSE;
+            AslGbl_ReferenceOptimizationFlag = FALSE;
+            AslGbl_OptimizeTrivialParseNodes = FALSE;
+            AcpiGbl_CaptureComments = TRUE;
+            AcpiGbl_DoDisassemblerOptimizations = FALSE;
+            AcpiGbl_DebugAslConversion = TRUE;
+            AcpiGbl_DmEmitExternalOpcodes = TRUE;
+            AslGbl_DoExternalsInPlace = TRUE;
+
+            return (0);
+
+        case 'f':
+
+            AslCompilerdebug = 1; /* same as yydebug */
+            DtParserdebug = 1;
+            PrParserdebug = 1;
+            AslGbl_DebugFlag = TRUE;
+            AslGbl_KeepPreprocessorTempFile = TRUE;
+            break;
+
+        case 'p':   /* Prune ASL parse tree */
+
+            /* Get the required argument */
+
+            if (AcpiGetoptArgument (argc, argv))
+            {
+                return (-1);
+            }
+
+            AslGbl_PruneParseTree = TRUE;
+            AslGbl_PruneDepth = (UINT8) strtoul (AcpiGbl_Optarg, NULL, 0);
+            break;
+
+        case 's':
+
+            AslGbl_DebugFlag = TRUE;
+            break;
+
+        case 't':
+
+            /* Get the required argument */
+
+            if (AcpiGetoptArgument (argc, argv))
+            {
+                return (-1);
+            }
+
+            AslGbl_PruneType = (UINT8) strtoul (AcpiGbl_Optarg, NULL, 0);
+            break;
+
+        default:
+
+            printf ("Unknown option: -b%s\n", AcpiGbl_Optarg);
+            return (-1);
+        }
+
+        break;
+
+    case 'c':
+
+        switch (AcpiGbl_Optarg[0])
+        {
+
+        case 'a':
+
+            printf ("Convert ASL to ASL+ with comments\n");
+            AslGbl_DoAslConversion = TRUE;
+            AslGbl_FoldConstants = FALSE;
+            AslGbl_IntegerOptimizationFlag = FALSE;
+            AslGbl_ReferenceOptimizationFlag = FALSE;
+            AslGbl_OptimizeTrivialParseNodes = FALSE;
+            AcpiGbl_CaptureComments = TRUE;
+            AcpiGbl_DoDisassemblerOptimizations = FALSE;
+            AcpiGbl_DmEmitExternalOpcodes = TRUE;
+            AslGbl_DoExternalsInPlace = TRUE;
+
+            return (0);
+
+        case 'r':
+
+            AslGbl_NoResourceChecking = TRUE;
+            break;
+
+        default:
+
+            printf ("Unknown option: -c%s\n", AcpiGbl_Optarg);
+            return (-1);
+        }
+        break;
+
+    case 'd':   /* Disassembler */
+
+        switch (AcpiGbl_Optarg[0])
+        {
+        case '^':
+
+            AslGbl_DoCompile = FALSE;
+            break;
+
+        case 'a':
+
+            AslGbl_DoCompile = FALSE;
+            AslGbl_DisassembleAll = TRUE;
+            break;
+
+        case 'b':   /* Do not convert buffers to resource descriptors */
+
+            AcpiGbl_NoResourceDisassembly = TRUE;
+            break;
+
+        case 'c':
+
+            break;
+
+        case 'f':
+
+            AcpiGbl_ForceAmlDisassembly = TRUE;
+            break;
+
+        case 'l':   /* Use legacy ASL code (not ASL+) for disassembly */
+
+            AslGbl_DoCompile = FALSE;
+            AcpiGbl_CstyleDisassembly = FALSE;
+            break;
+
+        default:
+
+            printf ("Unknown option: -d%s\n", AcpiGbl_Optarg);
+            return (-1);
+        }
+
+        AcpiGbl_DisasmFlag = TRUE;
+        break;
+
+    case 'D':   /* Define a symbol */
+
+        PrAddDefine (AcpiGbl_Optarg, NULL, TRUE);
+        break;
+
+    case 'e':   /* External files for disassembler */
+
+        /* Get entire list of external files */
+
+        AcpiGbl_Optind--;
+        argv[AcpiGbl_Optind] = AcpiGbl_Optarg;
+
+        while (argv[AcpiGbl_Optind] &&
+              (argv[AcpiGbl_Optind][0] != '-'))
+        {
+            Status = AcpiDmAddToExternalFileList (argv[AcpiGbl_Optind]);
+            if (ACPI_FAILURE (Status))
+            {
+                printf ("Could not add %s to external list\n",
+                    argv[AcpiGbl_Optind]);
+                return (-1);
+            }
+
+            AcpiGbl_Optind++;
+        }
+        break;
+
+    case 'f':
+
+        switch (AcpiGbl_Optarg[0])
+        {
+        case '^':   /* Ignore errors and force creation of aml file */
+
+            AslGbl_IgnoreErrors = TRUE;
+            break;
+
+        case 'e':   /* Disassembler: Get external declaration file */
+
+            if (AcpiGetoptArgument (argc, argv))
+            {
+                return (-1);
+            }
+
+            AslGbl_ExternalRefFilename = AcpiGbl_Optarg;
+            break;
+
+        default:
+
+            printf ("Unknown option: -f%s\n", AcpiGbl_Optarg);
+            return (-1);
+        }
+        break;
+
+    case 'G':
+
+        AslGbl_CompileGeneric = TRUE;
+        break;
+
+    case 'g':   /* Get all ACPI tables */
+
+        printf ("-g option is deprecated, use acpidump utility instead\n");
+        exit (1);
+
+    case 'h':
+
+        switch (AcpiGbl_Optarg[0])
+        {
+        case '^':
+
+            Usage ();
+            exit (0);
+
+        case 'c':
+
+            UtDisplayConstantOpcodes ();
+            exit (0);
+
+        case 'd':
+
+            AslDisassemblyHelp ();
+            exit (0);
+
+        case 'f':
+
+            AslFilenameHelp ();
+            exit (0);
+
+        case 'r':
+
+            /* reserved names */
+
+            ApDisplayReservedNames ();
+            exit (0);
+
+        case 't':
+
+            UtDisplaySupportedTables ();
+            exit (0);
+
+        default:
+
+            printf ("Unknown option: -h%s\n", AcpiGbl_Optarg);
+            return (-1);
+        }
+
+    case 'I':   /* Add an include file search directory */
+
+        FlAddIncludeDirectory (AcpiGbl_Optarg);
+        break;
+
+    case 'i':   /* Output AML as an include file */
+
+        switch (AcpiGbl_Optarg[0])
+        {
+        case 'a':
+
+            /* Produce assembly code include file */
+
+            AslGbl_AsmIncludeOutputFlag = TRUE;
+            break;
+
+        case 'c':
+
+            /* Produce C include file */
+
+            AslGbl_C_IncludeOutputFlag = TRUE;
+            break;
+
+        case 'n':
+
+            /* Compiler/Disassembler: Ignore the NOOP operator */
+
+            AcpiGbl_IgnoreNoopOperator = TRUE;
+            break;
+
+        default:
+
+            printf ("Unknown option: -i%s\n", AcpiGbl_Optarg);
+            return (-1);
+        }
+        break;
+
+    case 'l':   /* Listing files */
+
+        switch (AcpiGbl_Optarg[0])
+        {
+        case '^':
+
+            /* Produce listing file (Mixed source/aml) */
+
+            AslGbl_ListingFlag = TRUE;
+            AcpiGbl_DmOpt_Listing = TRUE;
+            break;
+
+        case 'i':
+
+            /* Produce preprocessor output file */
+
+            AslGbl_PreprocessorOutputFlag = TRUE;
+            break;
+
+        case 'm':
+
+            /* Produce hardware map summary file */
+
+            AslGbl_MapfileFlag = TRUE;
+            break;
+
+        case 'n':
+
+            /* Produce namespace file */
+
+            AslGbl_NsOutputFlag = TRUE;
+            break;
+
+        case 's':
+
+            /* Produce combined source file */
+
+            AslGbl_SourceOutputFlag = TRUE;
+            break;
+
+        case 'x':
+
+            /* Produce cross-reference file */
+
+            AslGbl_CrossReferenceOutput = TRUE;
+            break;
+
+        default:
+
+            printf ("Unknown option: -l%s\n", AcpiGbl_Optarg);
+            return (-1);
+        }
+        break;
+
+    case 'm':   /* Set line buffer size */
+
+        AslGbl_LineBufferSize = (UINT32) strtoul (AcpiGbl_Optarg, NULL, 0) * 1024;
+        if (AslGbl_LineBufferSize < ASL_DEFAULT_LINE_BUFFER_SIZE)
+        {
+            AslGbl_LineBufferSize = ASL_DEFAULT_LINE_BUFFER_SIZE;
+        }
+        printf ("Line Buffer Size: %u\n", AslGbl_LineBufferSize);
+        break;
+
+    case 'n':   /* Parse only */
+
+        AslGbl_ParseOnlyFlag = TRUE;
+        break;
+
+    case 'o':   /* Control compiler AML optimizations */
+
+        switch (AcpiGbl_Optarg[0])
+        {
+        case 'a':
+
+            /* Disable all optimizations */
+
+            AslGbl_FoldConstants = FALSE;
+            AslGbl_IntegerOptimizationFlag = FALSE;
+            AslGbl_ReferenceOptimizationFlag = FALSE;
+            AslGbl_OptimizeTrivialParseNodes = FALSE;
+
+            break;
+
+        case 'c':
+
+            /* Display compile time(s) */
+
+            AslGbl_CompileTimesFlag = TRUE;
+            break;
+
+        case 'd':
+
+            /* Disable disassembler code optimizations */
+
+            AcpiGbl_DoDisassemblerOptimizations = FALSE;
+            break;
+
+        case 'e':
+
+            /* Disassembler: Emit embedded external operators */
+
+            AcpiGbl_DmEmitExternalOpcodes = TRUE;
+            break;
+
+        case 'E':
+
+            /*
+             * iASL: keep External opcodes in place.
+             * No affect if Gbl_DoExternals is false.
+             */
+
+            AslGbl_DoExternalsInPlace = TRUE;
+            break;
+
+        case 'f':
+
+            /* Disable folding on "normal" expressions */
+
+            AslGbl_FoldConstants = FALSE;
+            break;
+
+        case 'i':
+
+            /* Disable integer optimization to constants */
+
+            AslGbl_IntegerOptimizationFlag = FALSE;
+            break;
+
+        case 'n':
+
+            /* Disable named reference optimization */
+
+            AslGbl_ReferenceOptimizationFlag = FALSE;
+            break;
+
+        case 't':
+
+            /* Disable heavy typechecking */
+
+            AslGbl_DoTypechecking = FALSE;
+            break;
+
+        default:
+
+            printf ("Unknown option: -c%s\n", AcpiGbl_Optarg);
+            return (-1);
+        }
+        break;
+
+    case 'P':   /* Preprocessor options */
+
+        switch (AcpiGbl_Optarg[0])
+        {
+        case '^':   /* Proprocess only, emit (.i) file */
+
+            AslGbl_PreprocessOnly = TRUE;
+            AslGbl_PreprocessorOutputFlag = TRUE;
+            break;
+
+        case 'n':   /* Disable preprocessor */
+
+            AslGbl_PreprocessFlag = FALSE;
+            break;
+
+        default:
+
+            printf ("Unknown option: -P%s\n", AcpiGbl_Optarg);
+            return (-1);
+        }
+        break;
+
+    case 'p':   /* Override default AML output filename */
+
+        AslGbl_OutputFilenamePrefix = AcpiGbl_Optarg;
+        UtConvertBackslashes (AslGbl_OutputFilenamePrefix);
+        AslGbl_UseDefaultAmlFilename = FALSE;
+        break;
+
+    case 'q':   /* ASL/ASl+ converter: compile only and leave badaml. */
+
+        printf ("Convert ASL to ASL+ with comments\n");
+        AslGbl_FoldConstants = FALSE;
+        AslGbl_IntegerOptimizationFlag = FALSE;
+        AslGbl_ReferenceOptimizationFlag = FALSE;
+        AslGbl_OptimizeTrivialParseNodes = FALSE;
+        AslGbl_DoExternalsInPlace = TRUE;
+        AcpiGbl_CaptureComments = TRUE;
+        return (0);
+
+    case 'r':   /* Override revision found in table header */
+
+        AslGbl_RevisionOverride = (UINT8) strtoul (AcpiGbl_Optarg, NULL, 0);
+        break;
+
+    case 's':   /* Create AML in a source code file */
+
+        switch (AcpiGbl_Optarg[0])
+        {
+        case 'a':
+
+            /* Produce assembly code output file */
+
+            AslGbl_AsmOutputFlag = TRUE;
+            break;
+
+        case 'c':
+
+            /* Produce C hex output file */
+
+            AslGbl_C_OutputFlag = TRUE;
+            break;
+
+        case 'o':
+
+            /* Produce AML offset table in C */
+
+            AslGbl_C_OffsetTableFlag = TRUE;
+            break;
+
+        default:
+
+            printf ("Unknown option: -s%s\n", AcpiGbl_Optarg);
+            return (-1);
+        }
+        break;
+
+    case 't':   /* Produce hex table output file */
+
+        switch (AcpiGbl_Optarg[0])
+        {
+        case 'a':
+
+            AslGbl_HexOutputFlag = HEX_OUTPUT_ASM;
+            break;
+
+        case 'c':
+
+            AslGbl_HexOutputFlag = HEX_OUTPUT_C;
+            break;
+
+        case 's':
+
+            AslGbl_HexOutputFlag = HEX_OUTPUT_ASL;
+            break;
+
+        default:
+
+            printf ("Unknown option: -t%s\n", AcpiGbl_Optarg);
+            return (-1);
+        }
+        break;
+
+    case 'T':   /* Create a ACPI table template file */
+
+        AslGbl_DoTemplates = TRUE;
+        break;
+
+    case 'v':   /* Version and verbosity settings */
+
+        switch (AcpiGbl_Optarg[0])
+        {
+        case '^':
+
+            printf (ACPI_COMMON_SIGNON (ASL_COMPILER_NAME));
+            exit (0);
+
+        case 'a':
+
+            /* Disable all error/warning/remark messages */
+
+            AslGbl_NoErrors = TRUE;
+            break;
+
+        case 'd':
+
+            printf (ACPI_COMMON_SIGNON (ASL_COMPILER_NAME));
+            printf (ACPI_COMMON_BUILD_TIME);
+            exit (0);
+
+        case 'e':
+
+            /* Disable all warning/remark messages (errors only) */
+
+            AslGbl_DisplayRemarks = FALSE;
+            AslGbl_DisplayWarnings = FALSE;
+            break;
+
+        case 'i':
+            /*
+             * Support for integrated development environment(s).
+             *
+             * 1) No compiler signon
+             * 2) Send stderr messages to stdout
+             * 3) Less verbose error messages (single line only for each)
+             * 4) Error/warning messages are formatted appropriately to
+             *    be recognized by MS Visual Studio
+             */
+            AslGbl_VerboseErrors = FALSE;
+            AslGbl_DoSignon = FALSE;
+            AslGbl_Files[ASL_FILE_STDERR].Handle = stdout;
+            break;
+
+        case 'o':
+
+            AslGbl_DisplayOptimizations = TRUE;
+            break;
+
+        case 'r':
+
+            AslGbl_DisplayRemarks = FALSE;
+            break;
+
+        case 's':
+
+            AslGbl_DoSignon = FALSE;
+            break;
+
+        case 't':
+
+            AslGbl_VerboseTemplates = TRUE;
+            break;
+
+        case 'w':
+
+            /* Get the required argument */
+
+            if (AcpiGetoptArgument (argc, argv))
+            {
+                return (-1);
+            }
+
+            Status = AslDisableException (AcpiGbl_Optarg);
+            if (ACPI_FAILURE (Status))
+            {
+                return (-1);
+            }
+            break;
+
+        case 'x':
+
+            /* Get the required argument */
+
+            if (AcpiGetoptArgument (argc, argv))
+            {
+                return (-1);
+            }
+
+            Status = AslExpectException (AcpiGbl_Optarg);
+            if (ACPI_FAILURE (Status))
+            {
+                return (-1);
+            }
+            break;
+
+        default:
+
+            printf ("Unknown option: -v%s\n", AcpiGbl_Optarg);
+            return (-1);
+        }
+        break;
+
+    case 'w': /* Set warning levels */
+
+        switch (AcpiGbl_Optarg[0])
+        {
+        case '1':
+
+            AslGbl_WarningLevel = ASL_WARNING;
+            break;
+
+        case '2':
+
+            AslGbl_WarningLevel = ASL_WARNING2;
+            break;
+
+        case '3':
+
+            AslGbl_WarningLevel = ASL_WARNING3;
+            break;
+
+        case 'e':
+
+            AslGbl_WarningsAsErrors = TRUE;
+            break;
+
+        case 'w':
+
+            /* Get the required argument */
+
+            if (AcpiGetoptArgument (argc, argv))
+            {
+                return (-1);
+            }
+
+            Status = AslElevateException (AcpiGbl_Optarg);
+            if (ACPI_FAILURE (Status))
+            {
+                return (-1);
+            }
+            break;
+
+
+        default:
+
+            printf ("Unknown option: -w%s\n", AcpiGbl_Optarg);
+            return (-1);
+        }
+        break;
+
+    case 'x':   /* Set debug print output level */
+
+        AcpiDbgLevel = strtoul (AcpiGbl_Optarg, NULL, 16);
+        break;
+
+    case 'z':
+
+        AslGbl_UseOriginalCompilerId = TRUE;
+        break;
+
+    default:
+
+        return (-1);
+    }
+
+    return (0);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AslMergeOptionTokens
+ *
+ * PARAMETERS:  InBuffer            - Input containing an option string
+ *              OutBuffer           - Merged output buffer
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Remove all whitespace from an option string.
+ *
+ ******************************************************************************/
+
+static void
+AslMergeOptionTokens (
+    char                    *InBuffer,
+    char                    *OutBuffer)
+{
+    char                    *Token;
+
+
+    *OutBuffer = 0;
+
+    Token = strtok (InBuffer, ASL_TOKEN_SEPARATORS);
+    while (Token)
+    {
+        strcat (OutBuffer, Token);
+        Token = strtok (NULL, ASL_TOKEN_SEPARATORS);
+    }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION:    AslDoResponseFile
+ *
+ * PARAMETERS:  Filename        - Name of the response file
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Open a response file and process all options within.
+ *
+ ******************************************************************************/
+
+static int
+AslDoResponseFile (
+    char                    *Filename)
+{
+    char                    *argv = AslGbl_StringBuffer2;
+    FILE                    *ResponseFile;
+    int                     OptStatus = 0;
+    int                     Opterr;
+    int                     Optind;
+
+
+    ResponseFile = fopen (Filename, "r");
+    if (!ResponseFile)
+    {
+        printf ("Could not open command file %s, %s\n",
+            Filename, strerror (errno));
+        return (-1);
+    }
+
+    /* Must save the current GetOpt globals */
+
+    Opterr = AcpiGbl_Opterr;
+    Optind = AcpiGbl_Optind;
+
+    /*
+     * Process all lines in the response file. There must be one complete
+     * option per line
+     */
+    while (fgets (AslGbl_StringBuffer, ASL_STRING_BUFFER_SIZE, ResponseFile))
+    {
+        /* Compress all tokens, allowing us to use a single argv entry */
+
+        AslMergeOptionTokens (AslGbl_StringBuffer, AslGbl_StringBuffer2);
+
+        /* Process the option */
+
+        AcpiGbl_Opterr = 0;
+        AcpiGbl_Optind = 0;
+
+        OptStatus = AslDoOptions (1, &argv, TRUE);
+        if (OptStatus)
+        {
+            printf ("Invalid option in command file %s: %s\n",
+                Filename, AslGbl_StringBuffer);
+            break;
+        }
+    }
+
+    /* Restore the GetOpt globals */
+
+    AcpiGbl_Opterr = Opterr;
+    AcpiGbl_Optind = Optind;
+
+    fclose (ResponseFile);
+    return (OptStatus);
+}
diff --git a/src/acpica/source/compiler/fwts_iasl_interface.c b/src/acpica/source/compiler/fwts_iasl_interface.c
index 2987723b..9679e272 100644
--- a/src/acpica/source/compiler/fwts_iasl_interface.c
+++ b/src/acpica/source/compiler/fwts_iasl_interface.c
@@ -17,8 +17,6 @@
  *
  */
 
-#define _DECLARE_GLOBALS
-
 #include <unistd.h>
 #include <stdbool.h>
 #include <stdint.h>
-- 
2.20.1




More information about the fwts-devel mailing list