From 33c583d0c71a12a703f849679505114e27bba011 Mon Sep 17 00:00:00 2001 From: Jung-uk Kim Date: Mon, 26 Sep 2011 21:40:21 +0000 Subject: [PATCH] Import ACPICA 20110922. --- changes.txt | 77 ++++ common/dmtable.c | 35 +- compiler/Makefile | 565 ++++++----------------------- compiler/aslcompile.c | 2 + compiler/aslcompiler.h | 11 +- compiler/asldefine.h | 20 + compiler/aslfiles.c | 6 +- compiler/aslglobal.h | 1 + compiler/asllisting.c | 10 +- compiler/aslload.c | 16 +- compiler/asllookup.c | 127 ++++--- compiler/aslmain.c | 98 ++--- compiler/aslmessages.h | 159 ++++---- compiler/asloperands.c | 8 +- compiler/aslpredef.c | 1 + compiler/aslresource.c | 43 +-- compiler/aslrestype1.c | 20 +- compiler/aslrestype1i.c | 18 +- compiler/aslrestype2.c | 4 +- compiler/aslrestype2d.c | 42 +-- compiler/aslrestype2e.c | 48 +-- compiler/aslrestype2q.c | 40 +- compiler/aslrestype2w.c | 34 +- compiler/asltree.c | 3 - compiler/asltypes.h | 8 +- compiler/aslutils.c | 63 +++- compiler/dtcompile.c | 2 +- generate/unix/Makefile.config | 50 ++- generate/unix/acpibin/Makefile | 87 ++--- generate/unix/acpiexec/Makefile | 510 ++------------------------ generate/unix/acpihelp/Makefile | 55 +-- generate/unix/acpinames/Makefile | 237 ++---------- generate/unix/acpisrc/Makefile | 81 ++--- generate/unix/acpixtract/Makefile | 33 +- generate/unix/iasl/Makefile | 470 +++--------------------- include/acapps.h | 9 + include/acconfig.h | 2 +- include/aclocal.h | 13 +- include/acpixf.h | 2 +- include/platform/acenv.h | 3 +- tools/acpibin/Makefile | 150 ++++---- tools/acpibin/abmain.c | 18 +- tools/acpiexec/Makefile | 582 +++++------------------------- tools/acpiexec/aemain.c | 45 +-- tools/acpihelp/Makefile | 104 +++--- tools/acpihelp/ahaslops.c | 4 + tools/acpihelp/ahmain.c | 14 +- tools/acpihelp/ahpredef.c | 3 +- tools/acpinames/Makefile | 309 ++++------------ tools/acpinames/anmain.c | 5 +- tools/acpisrc/Makefile | 119 +++--- tools/acpisrc/asmain.c | 35 +- tools/acpisrc/astable.c | 1 + tools/acpixtract/Makefile | 73 +++- tools/acpixtract/acpixtract.c | 324 +++++++---------- tools/acpixtract/axmain.c | 191 ++++++++++ 56 files changed, 1687 insertions(+), 3303 deletions(-) create mode 100644 tools/acpixtract/axmain.c diff --git a/changes.txt b/changes.txt index b6ddcd9690ad..82ab813229dc 100644 --- a/changes.txt +++ b/changes.txt @@ -1,3 +1,80 @@ +---------------------------------------- +22 September 2011. Summary of changes for version 20110922: + +This release is available at www.acpica.org/downloads + +0) ACPI 5.0 News: + +Support for ACPI 5.0 in ACPICA has been underway for several months and will +be released at the same time that ACPI 5.0 is officially released. + +The ACPI 5.0 specification is on track for release in the next few months. + +1) ACPICA Core Subsystem: + +Fixed a problem where the maximum sleep time for the Sleep() operator was +intended to be limited to two seconds, but was inadvertently limited to 20 +seconds instead. + +Linux and Unix makefiles: Added header file dependencies to ensure correct +generation of ACPICA core code and utilities. Also simplified the makefiles +considerably through the use of the vpath variable to specify search paths. +ACPICA BZ 924. + +2) iASL Compiler/Disassembler and Tools: + +iASL: Implemented support to check the access length for all fields created to +access named Resource Descriptor fields. For example, if a resource field is +defined to be two bits, a warning is issued if a CreateXxxxField() is used +with an incorrect bit length. This is implemented for all current resource +descriptor names. ACPICA BZ 930. + +Disassembler: Fixed a byte ordering problem with the output of 24-bit and 56- +bit integers. + +iASL: Fixed a couple of issues associated with variable-length package +objects. 1) properly handle constants like One, Ones, Zero -- do not make a +VAR_PACKAGE when these are used as a package length. 2) Allow the VAR_PACKAGE +opcode (in addition to PACKAGE) when validating object types for predefined +names. + +iASL: Emit statistics for all output files (instead of just the ASL input and +AML output). Includes listings, hex files, etc. + +iASL: Added -G option to the table compiler to allow the compilation of custom +ACPI tables. The only part of a table that is required is the standard 36-byte +ACPI header. + +AcpiXtract: Ported to the standard ACPICA environment (with ACPICA headers), +which also adds correct 64-bit support. Also, now all output filenames are +completely lower case. + +AcpiExec: Ignore any non-AML tables (tables other than DSDT or SSDT) when +loading table files. A warning is issued for any such tables. The only +exception is an FADT. This also fixes a possible fault when attempting to load +non-AML tables. ACPICA BZ 932. + +AcpiHelp: Added the AccessAs and Offset operators. Fixed a problem where a +missing table terminator could cause a fault when using the -p option. + +AcpiSrc: Fixed a possible divide-by-zero fault when generating file +statistics. + +3) 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. + + Previous Release (VC 9.0): + Non-Debug Version: 90.2K Code, 23.9K Data, 114.1K Total + Debug Version: 165.6K Code, 68.4K Data, 234.0K Total + Current Release (VC 9.0): + Non-Debug Version: 90.2K Code, 23.9K Data, 114.1K Total + Debug Version: 165.6K Code, 68.4K Data, 234.0K Total + + ---------------------------------------- 23 June 2011. Summary of changes for version 20110623: diff --git a/common/dmtable.c b/common/dmtable.c index febb7eab2930..92a956b9c15d 100644 --- a/common/dmtable.c +++ b/common/dmtable.c @@ -750,44 +750,25 @@ AcpiDmDumpTable ( AcpiOsPrintf ("%1.1X\n", (*Target >> 2) & 0x03); break; - /* Standard Data Types */ + /* Integer Data Types */ case ACPI_DMT_UINT8: - - AcpiOsPrintf ("%2.2X\n", *Target); - break; - case ACPI_DMT_UINT16: - - AcpiOsPrintf ("%4.4X\n", ACPI_GET16 (Target)); - break; - case ACPI_DMT_UINT24: - - AcpiOsPrintf ("%2.2X%2.2X%2.2X\n", - *Target, *(Target + 1), *(Target + 2)); - break; - case ACPI_DMT_UINT32: - - AcpiOsPrintf ("%8.8X\n", ACPI_GET32 (Target)); - break; - case ACPI_DMT_UINT56: - - for (Temp8 = 0; Temp8 < 7; Temp8++) + case ACPI_DMT_UINT64: + /* + * Dump bytes - high byte first, low byte last. + * Note: All ACPI tables are little-endian. + */ + for (Temp8 = (UINT8) ByteLength; Temp8 > 0; Temp8--) { - AcpiOsPrintf ("%2.2X", Target[Temp8]); + AcpiOsPrintf ("%2.2X", Target[Temp8 - 1]); } AcpiOsPrintf ("\n"); break; - case ACPI_DMT_UINT64: - - AcpiOsPrintf ("%8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (ACPI_GET64 (Target))); - break; - case ACPI_DMT_BUF7: case ACPI_DMT_BUF16: case ACPI_DMT_BUF128: diff --git a/compiler/Makefile b/compiler/Makefile index 1807635a2a40..e08941a19aed 100644 --- a/compiler/Makefile +++ b/compiler/Makefile @@ -19,50 +19,57 @@ PROG = iasl HOST = _LINUX NOMAN = YES -COMPILE = $(CC) -c $(CFLAGS) $(CWARNINGFLAGS) -o$@ $? +COMPILE = $(CC) -c $(CFLAGS) $(CWARNINGFLAGS) -o$@ $< ACPICA_COMPONENTS = -ACPICA_SRC = .. -ACPICA_COMMON = $(ACPICA_SRC)/common -ACPICA_CORE = $(ACPICA_SRC)$(ACPICA_COMPONENTS) -ACPICA_TOOLS = $(ACPICA_SRC)/tools -ACPICA_OSL = $(ACPICA_SRC)/os_specific/service_layers -ASL_COMPILER = $(ACPICA_SRC)/compiler -INSTALLDIR = /usr/bin -INSTALLPROG = cp --remove-destination $(PROG) $(INSTALLDIR) +ACPICA_SRC = .. +ACPICA_INCLUDE = $(ACPICA_SRC)/include +ACPICA_COMMON = $(ACPICA_SRC)/common +ACPICA_CORE = $(ACPICA_SRC)$(ACPICA_COMPONENTS) +ACPICA_TOOLS = $(ACPICA_SRC)/tools +ACPICA_OSL = $(ACPICA_SRC)/os_specific/service_layers +ACPICA_DEBUGGER = $(ACPICA_CORE)/debugger +ACPICA_DISASSEMBLER = $(ACPICA_CORE)/disassembler +ACPICA_DISPATCHER = $(ACPICA_CORE)/dispatcher +ACPICA_EXECUTER = $(ACPICA_CORE)/executer +ACPICA_NAMESPACE = $(ACPICA_CORE)/namespace +ACPICA_PARSER = $(ACPICA_CORE)/parser +ACPICA_TABLES = $(ACPICA_CORE)/tables +ACPICA_UTILITIES = $(ACPICA_CORE)/utilities +ASL_COMPILER = $(ACPICA_SRC)/compiler +INSTALLDIR = /usr/bin +INSTALLPROG = cp --remove-destination $(PROG) $(INSTALLDIR) -CFLAGS+= \ - -D$(HOST) \ - -D_GNU_SOURCE \ - -DACPI_ASL_COMPILER \ - -I$(ACPICA_SRC)/include \ - -I$(ASL_COMPILER) - -CWARNINGFLAGS = \ - -ansi \ - -Wall \ - -Wbad-function-cast \ - -Wdeclaration-after-statement \ - -Werror \ - -Wformat=2 \ - -Wmissing-declarations \ - -Wmissing-prototypes \ - -Wstrict-aliasing=0 \ - -Wstrict-prototypes \ - -Wswitch-default \ - -Wpointer-arith \ - -Wundef +ACPICA_HEADERS = \ + $(wildcard $(ACPICA_INCLUDE)/*.h) \ + $(wildcard $(ACPICA_INCLUDE)/platform/*.h) # -# Bison/Flex configuration +# Search paths for source files # -YACC= bison -YFLAGS+= -v -d -y +vpath %.c \ + $(ASL_COMPILER) \ + $(ACPICA_DEBUGGER) \ + $(ACPICA_DISASSEMBLER) \ + $(ACPICA_DISPATCHER) \ + $(ACPICA_EXECUTER) \ + $(ACPICA_NAMESPACE) \ + $(ACPICA_PARSER) \ + $(ACPICA_TABLES) \ + $(ACPICA_UTILITIES) \ + $(ACPICA_COMMON) \ + $(ACPICA_OSL) -LEX= flex -LFLAGS+= -i -s +HEADERS = \ + $(wildcard $(ASL_COMPILER)/*.h) \ + aslcompiler.y.h \ + dtparser.y.h -OBJS = \ +OBJECTS = \ + aslcompilerlex.o \ + aslcompilerparse.o \ + dtparserlex.o \ + dtparserparse.o \ adfile.o \ adisasm.o \ adwalk.o \ @@ -70,8 +77,6 @@ OBJS = \ aslbtypes.o \ aslcodegen.o \ aslcompile.o \ - aslcompilerlex.o \ - aslcompilerparse.o \ aslerror.o \ aslfiles.o \ aslfold.o \ @@ -104,8 +109,6 @@ OBJS = \ dtexpress.o \ dtfield.o \ dtio.o \ - dtparserlex.o \ - dtparserparse.o \ dtsubtable.o \ dttable.o \ dttemplate.o \ @@ -205,18 +208,67 @@ INTERMEDIATES = \ dtparserparse.c MISC = \ + aslcompilerparse.h \ aslcompiler.y.h \ aslcompilerparse.output \ + dtparserparse.h \ dtparser.y.h \ dtparserparse.output +CFLAGS+= \ + -D$(HOST) \ + -D_GNU_SOURCE \ + -DACPI_ASL_COMPILER \ + -I$(ACPICA_INCLUDE) \ + -I$(ASL_COMPILER) + +CWARNINGFLAGS = \ + -ansi \ + -Wall \ + -Wbad-function-cast \ + -Wdeclaration-after-statement \ + -Werror \ + -Wformat=2 \ + -Wmissing-declarations \ + -Wmissing-prototypes \ + -Wstrict-aliasing=0 \ + -Wstrict-prototypes \ + -Wswitch-default \ + -Wpointer-arith \ + -Wundef + +# +# gcc 4+ flags +# +CWARNINGFLAGS += \ + -Waddress \ + -Waggregate-return \ + -Wchar-subscripts \ + -Wempty-body \ + -Wlogical-op \ + -Wmissing-declarations \ + -Wmissing-field-initializers \ + -Wmissing-parameter-type \ + -Wnested-externs \ + -Wold-style-declaration \ + -Wold-style-definition \ + -Wredundant-decls \ + -Wtype-limits + +# +# Bison/Flex configuration +# +YACC= bison +YFLAGS+= -v -d -y + +LEX= flex +LFLAGS+= -i -s # # Root rule # -$(PROG) : $(INTERMEDIATES) $(OBJS) - $(CC) $(OBJS) $(LDFLAGS) -o $(PROG) - +$(PROG) : $(INTERMEDIATES) $(MISC) $(OBJECTS) + $(CC) $(OBJECTS) $(LDFLAGS) -o $(PROG) # # Parser and Lexer - intermediate C files @@ -224,16 +276,24 @@ $(PROG) : $(INTERMEDIATES) $(OBJS) aslcompilerlex.c : $(ASL_COMPILER)/aslcompiler.l ${LEX} ${LFLAGS} -PAslCompiler -o$@ $? -aslcompilerparse.c : $(ASL_COMPILER)/aslcompiler.y +aslcompilerparse.c aslcompilerparse.h : $(ASL_COMPILER)/aslcompiler.y ${YACC} ${YFLAGS} -pAslCompiler -o$@ $? - @mv -f aslcompilerparse.h aslcompiler.y.h dtparserlex.c : $(ASL_COMPILER)/dtparser.l ${LEX} ${LFLAGS} -PDtParser -o$@ $? -dtparserparse.c : $(ASL_COMPILER)/dtparser.y +dtparserparse.c dtparserparse.h : $(ASL_COMPILER)/dtparser.y ${YACC} ${YFLAGS} -pDtParser -o$@ $? - @mv -f dtparserparse.h dtparser.y.h + +# Rename headers produced by bison/yacc + +dtparser.y.h: dtparserparse.h + @echo Copy intermediate file: + @cp -f -v dtparserparse.h dtparser.y.h + +aslcompiler.y.h : aslcompilerparse.h + @echo Copy intermediate file: + @cp -f -v aslcompilerparse.h aslcompiler.y.h # @@ -255,418 +315,11 @@ dtparserparse.o : dtparserparse.c $(CC) -c $(CFLAGS) -Wall -Werror -Wstrict-aliasing=0 -o$@ $? -# -# Compiler source -# -aslanalyze.o : $(ASL_COMPILER)/aslanalyze.c +%.o : %.c $(HEADERS) $(ACPICA_HEADERS) $(COMPILE) -aslbtypes.o : $(ASL_COMPILER)/aslbtypes.c - $(COMPILE) - -aslcodegen.o : $(ASL_COMPILER)/aslcodegen.c - $(COMPILE) - -aslcompile.o : $(ASL_COMPILER)/aslcompile.c - $(COMPILE) - -aslerror.o : $(ASL_COMPILER)/aslerror.c - $(COMPILE) - -aslfiles.o : $(ASL_COMPILER)/aslfiles.c - $(COMPILE) - -aslfold.o : $(ASL_COMPILER)/aslfold.c - $(COMPILE) - -asllength.o : $(ASL_COMPILER)/asllength.c - $(COMPILE) - -asllisting.o : $(ASL_COMPILER)/asllisting.c - $(COMPILE) - -aslload.o : $(ASL_COMPILER)/aslload.c - $(COMPILE) - -asllookup.o : $(ASL_COMPILER)/asllookup.c - $(COMPILE) - -aslmain.o : $(ASL_COMPILER)/aslmain.c - $(COMPILE) - -aslmap.o : $(ASL_COMPILER)/aslmap.c - $(COMPILE) - -aslopcodes.o : $(ASL_COMPILER)/aslopcodes.c - $(COMPILE) - -asloperands.o : $(ASL_COMPILER)/asloperands.c - $(COMPILE) - -aslopt.o : $(ASL_COMPILER)/aslopt.c - $(COMPILE) - -aslpredef.o : $(ASL_COMPILER)/aslpredef.c - $(COMPILE) - -aslresource.o : $(ASL_COMPILER)/aslresource.c - $(COMPILE) - -aslrestype1.o : $(ASL_COMPILER)/aslrestype1.c - $(COMPILE) - -aslrestype1i.o : $(ASL_COMPILER)/aslrestype1i.c - $(COMPILE) - -aslrestype2.o : $(ASL_COMPILER)/aslrestype2.c - $(COMPILE) - -aslrestype2d.o : $(ASL_COMPILER)/aslrestype2d.c - $(COMPILE) - -aslrestype2e.o : $(ASL_COMPILER)/aslrestype2e.c - $(COMPILE) - -aslrestype2q.o : $(ASL_COMPILER)/aslrestype2q.c - $(COMPILE) - -aslrestype2w.o : $(ASL_COMPILER)/aslrestype2w.c - $(COMPILE) - -aslstartup.o : $(ASL_COMPILER)/aslstartup.c - $(COMPILE) - -aslstubs.o : $(ASL_COMPILER)/aslstubs.c - $(COMPILE) - -asltransform.o : $(ASL_COMPILER)/asltransform.c - $(COMPILE) - -asltree.o : $(ASL_COMPILER)/asltree.c - $(COMPILE) - -aslutils.o : $(ASL_COMPILER)/aslutils.c - $(COMPILE) - -asluuid.o : $(ASL_COMPILER)/asluuid.c - $(COMPILE) - -aslwalks.o : $(ASL_COMPILER)/aslwalks.c - $(COMPILE) - - -# -# Data Table Compiler -# -dtcompile.o : $(ASL_COMPILER)/dtcompile.c - $(COMPILE) - -dtexpress.o : $(ASL_COMPILER)/dtexpress.c - $(COMPILE) - -dtfield.o : $(ASL_COMPILER)/dtfield.c - $(COMPILE) - -dtio.o : $(ASL_COMPILER)/dtio.c - $(COMPILE) - -dtsubtable.o : $(ASL_COMPILER)/dtsubtable.c - $(COMPILE) - -dttable.o : $(ASL_COMPILER)/dttable.c - $(COMPILE) - -dttemplate.o : $(ASL_COMPILER)/dttemplate.c - $(COMPILE) - -dtutils.o : $(ASL_COMPILER)/dtutils.c - $(COMPILE) - - -# -# ACPICA core source - common -# -adfile.o : $(ACPICA_COMMON)/adfile.c - $(COMPILE) - -adisasm.o : $(ACPICA_COMMON)/adisasm.c - $(COMPILE) - -adwalk.o : $(ACPICA_COMMON)/adwalk.c - $(COMPILE) - -dmextern.o : $(ACPICA_COMMON)/dmextern.c - $(COMPILE) - -dmrestag.o : $(ACPICA_COMMON)/dmrestag.c - $(COMPILE) - -dmtable.o : $(ACPICA_COMMON)/dmtable.c - $(COMPILE) - -dmtbdump.o : $(ACPICA_COMMON)/dmtbdump.c - $(COMPILE) - -dmtbinfo.o : $(ACPICA_COMMON)/dmtbinfo.c - $(COMPILE) - -getopt.o : $(ACPICA_COMMON)/getopt.c - $(COMPILE) - - -# -# ACPICA core source -# -dbfileio.o : $(ACPICA_CORE)/debugger/dbfileio.c - $(COMPILE) - -dmbuffer.o : $(ACPICA_CORE)/disassembler/dmbuffer.c - $(COMPILE) - -dmnames.o : $(ACPICA_CORE)/disassembler/dmnames.c - $(COMPILE) - -dmobject.o : $(ACPICA_CORE)/disassembler/dmobject.c - $(COMPILE) - -dmopcode.o : $(ACPICA_CORE)/disassembler/dmopcode.c - $(COMPILE) - -dmresrc.o : $(ACPICA_CORE)/disassembler/dmresrc.c - $(COMPILE) - -dmresrcl.o : $(ACPICA_CORE)/disassembler/dmresrcl.c - $(COMPILE) - -dmresrcs.o : $(ACPICA_CORE)/disassembler/dmresrcs.c - $(COMPILE) - -dmutils.o : $(ACPICA_CORE)/disassembler/dmutils.c - $(COMPILE) - -dmwalk.o : $(ACPICA_CORE)/disassembler/dmwalk.c - $(COMPILE) - -dsargs.o : $(ACPICA_CORE)/dispatcher/dsargs.c - $(COMPILE) - -dscontrol.o : $(ACPICA_CORE)/dispatcher/dscontrol.c - $(COMPILE) - -dsfield.o : $(ACPICA_CORE)/dispatcher/dsfield.c - $(COMPILE) - -dsobject.o : $(ACPICA_CORE)/dispatcher/dsobject.c - $(COMPILE) - -dsopcode.o : $(ACPICA_CORE)/dispatcher/dsopcode.c - $(COMPILE) - -dsutils.o : $(ACPICA_CORE)/dispatcher/dsutils.c - $(COMPILE) - -dswexec.o : $(ACPICA_CORE)/dispatcher/dswexec.c - $(COMPILE) - -dswload.o : $(ACPICA_CORE)/dispatcher/dswload.c - $(COMPILE) - -dswload2.o : $(ACPICA_CORE)/dispatcher/dswload2.c - $(COMPILE) - -dswscope.o : $(ACPICA_CORE)/dispatcher/dswscope.c - $(COMPILE) - -dswstate.o : $(ACPICA_CORE)/dispatcher/dswstate.c - $(COMPILE) - -exconvrt.o : $(ACPICA_CORE)/executer/exconvrt.c - $(COMPILE) - -excreate.o : $(ACPICA_CORE)/executer/excreate.c - $(COMPILE) - -exdump.o : $(ACPICA_CORE)/executer/exdump.c - $(COMPILE) - -exmisc.o : $(ACPICA_CORE)/executer/exmisc.c - $(COMPILE) - -exmutex.o : $(ACPICA_CORE)/executer/exmutex.c - $(COMPILE) - -exnames.o : $(ACPICA_CORE)/executer/exnames.c - $(COMPILE) - -exoparg1.o : $(ACPICA_CORE)/executer/exoparg1.c - $(COMPILE) - -exoparg2.o : $(ACPICA_CORE)/executer/exoparg2.c - $(COMPILE) - -exoparg3.o : $(ACPICA_CORE)/executer/exoparg3.c - $(COMPILE) - -exoparg6.o : $(ACPICA_CORE)/executer/exoparg6.c - $(COMPILE) - -exprep.o : $(ACPICA_CORE)/executer/exprep.c - $(COMPILE) - -exregion.o : $(ACPICA_CORE)/executer/exregion.c - $(COMPILE) - -exresnte.o : $(ACPICA_CORE)/executer/exresnte.c - $(COMPILE) - -exresolv.o : $(ACPICA_CORE)/executer/exresolv.c - $(COMPILE) - -exresop.o : $(ACPICA_CORE)/executer/exresop.c - $(COMPILE) - -exstore.o : $(ACPICA_CORE)/executer/exstore.c - $(COMPILE) - -exstoren.o : $(ACPICA_CORE)/executer/exstoren.c - $(COMPILE) - -exstorob.o : $(ACPICA_CORE)/executer/exstorob.c - $(COMPILE) - -exsystem.o : $(ACPICA_CORE)/executer/exsystem.c - $(COMPILE) - -exutils.o : $(ACPICA_CORE)/executer/exutils.c - $(COMPILE) - -nsaccess.o : $(ACPICA_CORE)/namespace/nsaccess.c - $(COMPILE) - -nsalloc.o : $(ACPICA_CORE)/namespace/nsalloc.c - $(COMPILE) - -nsdump.o : $(ACPICA_CORE)/namespace/nsdump.c - $(COMPILE) - -nsnames.o : $(ACPICA_CORE)/namespace/nsnames.c - $(COMPILE) - -nsobject.o : $(ACPICA_CORE)/namespace/nsobject.c - $(COMPILE) - -nsparse.o : $(ACPICA_CORE)/namespace/nsparse.c - $(COMPILE) - -nssearch.o : $(ACPICA_CORE)/namespace/nssearch.c - $(COMPILE) - -nsutils.o : $(ACPICA_CORE)/namespace/nsutils.c - $(COMPILE) - -nswalk.o : $(ACPICA_CORE)/namespace/nswalk.c - $(COMPILE) - -nsxfobj.o : $(ACPICA_CORE)/namespace/nsxfobj.c - $(COMPILE) - -psargs.o : $(ACPICA_CORE)/parser/psargs.c - $(COMPILE) - -psloop.o : $(ACPICA_CORE)/parser/psloop.c - $(COMPILE) - -psopcode.o : $(ACPICA_CORE)/parser/psopcode.c - $(COMPILE) - -psparse.o : $(ACPICA_CORE)/parser/psparse.c - $(COMPILE) - -psscope.o : $(ACPICA_CORE)/parser/psscope.c - $(COMPILE) - -pstree.o : $(ACPICA_CORE)/parser/pstree.c - $(COMPILE) - -psutils.o : $(ACPICA_CORE)/parser/psutils.c - $(COMPILE) - -pswalk.o : $(ACPICA_CORE)/parser/pswalk.c - $(COMPILE) - -tbfadt.o : $(ACPICA_CORE)/tables/tbfadt.c - $(COMPILE) - -tbinstal.o : $(ACPICA_CORE)/tables/tbinstal.c - $(COMPILE) - -tbutils.o : $(ACPICA_CORE)/tables/tbutils.c - $(COMPILE) - -tbxface.o : $(ACPICA_CORE)/tables/tbxface.c - $(COMPILE) - -utalloc.o : $(ACPICA_CORE)/utilities/utalloc.c - $(COMPILE) - -utcache.o : $(ACPICA_CORE)/utilities/utcache.c - $(COMPILE) - -utcopy.o : $(ACPICA_CORE)/utilities/utcopy.c - $(COMPILE) - -utdebug.o : $(ACPICA_CORE)/utilities/utdebug.c - $(COMPILE) - -utdecode.o : $(ACPICA_CORE)/utilities/utdecode.c - $(COMPILE) - -utdelete.o : $(ACPICA_CORE)/utilities/utdelete.c - $(COMPILE) - -utglobal.o : $(ACPICA_CORE)/utilities/utglobal.c - $(COMPILE) - -utinit.o : $(ACPICA_CORE)/utilities/utinit.c - $(COMPILE) - -utlock.o : $(ACPICA_CORE)/utilities/utlock.c - $(COMPILE) - -utmath.o : $(ACPICA_CORE)/utilities/utmath.c - $(COMPILE) - -utmisc.o : $(ACPICA_CORE)/utilities/utmisc.c - $(COMPILE) - -utmutex.o : $(ACPICA_CORE)/utilities/utmutex.c - $(COMPILE) - -utobject.o : $(ACPICA_CORE)/utilities/utobject.c - $(COMPILE) - -utresrc.o : $(ACPICA_CORE)/utilities/utresrc.c - $(COMPILE) - -utstate.o : $(ACPICA_CORE)/utilities/utstate.c - $(COMPILE) - -utxferror.o : $(ACPICA_CORE)/utilities/utxferror.c - $(COMPILE) - -utxface.o : $(ACPICA_CORE)/utilities/utxface.c - $(COMPILE) - - -# -# Unix OS services layer (OSL) -# -osunixxf.o : $(ACPICA_OSL)/osunixxf.c - $(COMPILE) - - clean : - rm -f $(PROG) $(PROG).exe $(OBJS) $(INTERMEDIATES) $(MISC) + rm -f $(PROG) $(PROG).exe $(OBJECTS) $(INTERMEDIATES) $(MISC) install : $(INSTALLPROG) diff --git a/compiler/aslcompile.c b/compiler/aslcompile.c index ec1b59783cbd..bd22dd2105a0 100644 --- a/compiler/aslcompile.c +++ b/compiler/aslcompile.c @@ -472,6 +472,8 @@ CmDoCompile ( if (!RootNode) { + AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, + NULL, "- Could not resolve parse tree root node"); CmCleanupAndExit (); return -1; } diff --git a/compiler/aslcompiler.h b/compiler/aslcompiler.h index 2a397b3fe1e3..3f2dd4a64cd1 100644 --- a/compiler/aslcompiler.h +++ b/compiler/aslcompiler.h @@ -829,17 +829,12 @@ RsAllocateResourceNode ( UINT32 Size); void -RsCreateBitField ( +RsCreateResourceField ( ACPI_PARSE_OBJECT *Op, char *Name, UINT32 ByteOffset, - UINT32 BitOffset); - -void -RsCreateByteField ( - ACPI_PARSE_OBJECT *Op, - char *Name, - UINT32 ByteOffset); + UINT32 BitOffset, + UINT32 BitLength); void RsSetFlagBits ( diff --git a/compiler/asldefine.h b/compiler/asldefine.h index 04e3b6056b1f..4fae94b618cc 100644 --- a/compiler/asldefine.h +++ b/compiler/asldefine.h @@ -153,5 +153,25 @@ #define POSITIVE 0 +/* Helper macros for resource tag creation */ + +#define RsCreateMultiBitField \ + RsCreateResourceField + +#define RsCreateBitField(Op, Name, ByteOffset, BitOffset) \ + RsCreateResourceField (Op, Name, ByteOffset, BitOffset, 1) + +#define RsCreateByteField(Op, Name, ByteOffset) \ + RsCreateResourceField (Op, Name, ByteOffset, 0, 8); + +#define RsCreateWordField(Op, Name, ByteOffset) \ + RsCreateResourceField (Op, Name, ByteOffset, 0, 16); + +#define RsCreateDwordField(Op, Name, ByteOffset) \ + RsCreateResourceField (Op, Name, ByteOffset, 0, 32); + +#define RsCreateQwordField(Op, Name, ByteOffset) \ + RsCreateResourceField (Op, Name, ByteOffset, 0, 64); + #endif /* ASLDEFINE.H */ diff --git a/compiler/aslfiles.c b/compiler/aslfiles.c index 81bd823171c3..95e22302f060 100644 --- a/compiler/aslfiles.c +++ b/compiler/aslfiles.c @@ -174,14 +174,18 @@ FlGetFileSize ( { FILE *fp; UINT32 FileSize; + long Offset; fp = Gbl_Files[FileId].Handle; + Offset = ftell (fp); fseek (fp, 0, SEEK_END); FileSize = (UINT32) ftell (fp); - fseek (fp, 0, SEEK_SET); + /* Restore file pointer */ + + fseek (fp, Offset, SEEK_SET); return (FileSize); } diff --git a/compiler/aslglobal.h b/compiler/aslglobal.h index f80c89f362c7..dd1dd49dd590 100644 --- a/compiler/aslglobal.h +++ b/compiler/aslglobal.h @@ -128,6 +128,7 @@ ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_WarningLevel, ASL_WARNI ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_UseOriginalCompilerId, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_VerboseTemplates, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoTemplates, FALSE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_CompileGeneric, FALSE); #define HEX_OUTPUT_NONE 0 diff --git a/compiler/asllisting.c b/compiler/asllisting.c index 7b797d5b70d0..7f2a83f54256 100644 --- a/compiler/asllisting.c +++ b/compiler/asllisting.c @@ -850,9 +850,9 @@ LsFinishSourceListing ( FlPrintFile (FileId, "\n\nSummary of errors and warnings\n\n"); AePrintErrorLog (FileId); - FlPrintFile (FileId, "\n\n"); + FlPrintFile (FileId, "\n"); UtDisplaySummary (FileId); - FlPrintFile (FileId, "\n\n"); + FlPrintFile (FileId, "\n"); } } @@ -1309,6 +1309,7 @@ LsDoHexOutputC ( /* Get AML size, seek back to start */ AmlFileSize = FlGetFileSize (ASL_FILE_AML_OUTPUT); + FlSeekFile (ASL_FILE_AML_OUTPUT, 0); FlPrintFile (ASL_FILE_HEX_OUTPUT, " * C source code output\n"); FlPrintFile (ASL_FILE_HEX_OUTPUT, " * AML code block contains 0x%X bytes\n *\n */\n", @@ -1365,7 +1366,6 @@ LsDoHexOutputC ( } FlPrintFile (ASL_FILE_HEX_OUTPUT, "};\n"); - FlCloseFile (ASL_FILE_HEX_OUTPUT); } @@ -1397,6 +1397,7 @@ LsDoHexOutputAsl ( /* Get AML size, seek back to start */ AmlFileSize = FlGetFileSize (ASL_FILE_AML_OUTPUT); + FlSeekFile (ASL_FILE_AML_OUTPUT, 0); FlPrintFile (ASL_FILE_HEX_OUTPUT, " * ASL source code output\n"); FlPrintFile (ASL_FILE_HEX_OUTPUT, " * AML code block contains 0x%X bytes\n *\n */\n", @@ -1453,7 +1454,6 @@ LsDoHexOutputAsl ( } FlPrintFile (ASL_FILE_HEX_OUTPUT, " })\n"); - FlCloseFile (ASL_FILE_HEX_OUTPUT); } @@ -1485,6 +1485,7 @@ LsDoHexOutputAsm ( /* Get AML size, seek back to start */ AmlFileSize = FlGetFileSize (ASL_FILE_AML_OUTPUT); + FlSeekFile (ASL_FILE_AML_OUTPUT, 0); FlPrintFile (ASL_FILE_HEX_OUTPUT, "; Assembly code source output\n"); FlPrintFile (ASL_FILE_HEX_OUTPUT, "; AML code block contains 0x%X bytes\n;\n", @@ -1536,7 +1537,6 @@ LsDoHexOutputAsm ( } FlPrintFile (ASL_FILE_HEX_OUTPUT, "\n"); - FlCloseFile (ASL_FILE_HEX_OUTPUT); } diff --git a/compiler/aslload.c b/compiler/aslload.c index 6eb1c5604dda..ed5a0a3b8be2 100644 --- a/compiler/aslload.c +++ b/compiler/aslload.c @@ -290,7 +290,6 @@ LdLoadResourceElements ( InitializerOp = ASL_GET_CHILD_NODE (Op); while (InitializerOp) { - if (InitializerOp->Asl.ExternalName) { Status = AcpiNsLookup (WalkState->ScopeInfo, @@ -305,20 +304,15 @@ LdLoadResourceElements ( } /* - * Store the field offset in the namespace node so it - * can be used when the field is referenced + * Store the field offset and length in the namespace node + * so it can be used when the field is referenced */ - Node->Value = (UINT32) InitializerOp->Asl.Value.Integer; + Node->Value = InitializerOp->Asl.Value.Tag.BitOffset; + Node->Length = InitializerOp->Asl.Value.Tag.BitLength; InitializerOp->Asl.Node = Node; Node->Op = InitializerOp; - - /* Pass thru the field type (Bitfield or Bytefield) */ - - if (InitializerOp->Asl.CompileFlags & NODE_IS_BIT_OFFSET) - { - Node->Flags |= ANOBJ_IS_BIT_OFFSET; - } } + InitializerOp = ASL_GET_PEER_NODE (InitializerOp); } diff --git a/compiler/asllookup.c b/compiler/asllookup.c index dec2396030c0..bbe00cb83e51 100644 --- a/compiler/asllookup.c +++ b/compiler/asllookup.c @@ -822,7 +822,10 @@ LkNamespaceLocateBegin ( ACPI_PARSE_OBJECT *OwningOp; ACPI_PARSE_OBJECT *SpaceIdOp; UINT32 MinimumLength; - UINT32 Temp; + UINT32 Offset; + UINT32 FieldBitLength; + UINT32 TagBitLength; + UINT8 Message = 0; const ACPI_OPCODE_INFO *OpInfo; UINT32 Flags; @@ -1026,74 +1029,106 @@ LkNamespaceLocateBegin ( /* 2) Check for a reference to a resource descriptor */ if ((Node->Type == ACPI_TYPE_LOCAL_RESOURCE_FIELD) || - (Node->Type == ACPI_TYPE_LOCAL_RESOURCE)) + (Node->Type == ACPI_TYPE_LOCAL_RESOURCE)) { /* - * This was a reference to a field within a resource descriptor. Extract - * the associated field offset (either a bit or byte offset depending on - * the field type) and change the named reference into an integer for - * AML code generation + * This was a reference to a field within a resource descriptor. + * Extract the associated field offset (either a bit or byte + * offset depending on the field type) and change the named + * reference into an integer for AML code generation */ - Temp = Node->Value; - if (Node->Flags & ANOBJ_IS_BIT_OFFSET) + Offset = Node->Value; + TagBitLength = Node->Length; + + /* + * If a field is being created, generate the length (in bits) of + * the field. Note: Opcodes other than CreateXxxField and Index + * can come through here. For other opcodes, we just need to + * convert the resource tag reference to an integer offset. + */ + switch (Op->Asl.Parent->Asl.AmlOpcode) { - Op->Asl.CompileFlags |= NODE_IS_BIT_OFFSET; + case AML_CREATE_FIELD_OP: /* Variable "Length" field, in bits */ + /* + * We know the length operand is an integer constant because + * we know that it contains a reference to a resource + * descriptor tag. + */ + FieldBitLength = (UINT32) Op->Asl.Next->Asl.Value.Integer; + break; + + case AML_CREATE_BIT_FIELD_OP: + FieldBitLength = 1; + break; + + case AML_CREATE_BYTE_FIELD_OP: + case AML_INDEX_OP: + FieldBitLength = 8; + break; + + case AML_CREATE_WORD_FIELD_OP: + FieldBitLength = 16; + break; + + case AML_CREATE_DWORD_FIELD_OP: + FieldBitLength = 32; + break; + + case AML_CREATE_QWORD_FIELD_OP: + FieldBitLength = 64; + break; + + default: + FieldBitLength = 0; + break; } - /* Perform BitOffset <--> ByteOffset conversion if necessary */ + /* Check the field length against the length of the resource tag */ + + if (FieldBitLength) + { + if (TagBitLength < FieldBitLength) + { + Message = ASL_MSG_TAG_SMALLER; + } + else if (TagBitLength > FieldBitLength) + { + Message = ASL_MSG_TAG_LARGER; + } + + if (Message) + { + sprintf (MsgBuffer, "Tag: %u bit%s, Field: %u bit%s", + TagBitLength, (TagBitLength > 1) ? "s" : "", + FieldBitLength, (FieldBitLength > 1) ? "s" : ""); + + AslError (ASL_WARNING, Message, Op, MsgBuffer); + } + } + + /* Convert the BitOffset to a ByteOffset for certain opcodes */ switch (Op->Asl.Parent->Asl.AmlOpcode) { - case AML_CREATE_FIELD_OP: - - /* We allow a Byte offset to Bit Offset conversion for this op */ - - if (!(Op->Asl.CompileFlags & NODE_IS_BIT_OFFSET)) - { - /* Simply multiply byte offset times 8 to get bit offset */ - - Temp = ACPI_MUL_8 (Temp); - } - break; - - - case AML_CREATE_BIT_FIELD_OP: - - /* This op requires a Bit Offset */ - - if (!(Op->Asl.CompileFlags & NODE_IS_BIT_OFFSET)) - { - AslError (ASL_ERROR, ASL_MSG_BYTES_TO_BITS, Op, NULL); - } - break; - - case AML_CREATE_BYTE_FIELD_OP: case AML_CREATE_WORD_FIELD_OP: case AML_CREATE_DWORD_FIELD_OP: case AML_CREATE_QWORD_FIELD_OP: case AML_INDEX_OP: - /* These Ops require Byte offsets */ - - if (Op->Asl.CompileFlags & NODE_IS_BIT_OFFSET) - { - AslError (ASL_ERROR, ASL_MSG_BITS_TO_BYTES, Op, NULL); - } + Offset = ACPI_DIV_8 (Offset); break; - default: - /* Nothing to do for other opcodes */ break; } /* Now convert this node to an integer whose value is the field offset */ - Op->Asl.AmlLength = 0; - Op->Asl.ParseOpcode = PARSEOP_INTEGER; - Op->Asl.Value.Integer = (UINT64) Temp; - Op->Asl.CompileFlags |= NODE_IS_RESOURCE_FIELD; + Op->Asl.AmlLength = 0; + Op->Asl.ParseOpcode = PARSEOP_INTEGER; + Op->Asl.Value.Integer = (UINT64) Offset; + Op->Asl.CompileFlags |= NODE_IS_RESOURCE_FIELD; OpcGenerateAmlOpcode (Op); } diff --git a/compiler/aslmain.c b/compiler/aslmain.c index d2aef19c33f6..d29c24c6f791 100644 --- a/compiler/aslmain.c +++ b/compiler/aslmain.c @@ -96,7 +96,7 @@ AslDoResponseFile ( #define ASL_TOKEN_SEPARATORS " \t\n" -#define ASL_SUPPORTED_OPTIONS "@:2b:c:d^e:fgh^i^I:l^no:p:r:s:t:T:v:w:x:z" +#define ASL_SUPPORTED_OPTIONS "@:2b:c:d^e:fgh^i^I:l^no:p:r:s:t:T:G^v:w:x:z" /******************************************************************************* @@ -116,55 +116,56 @@ Options ( void) { - printf ("Global:\n"); - printf (" -@ Specify command file\n"); - printf (" -I Specify additional include directory\n"); + printf ("\nGlobal:\n"); + ACPI_OPTION ("-@ ", "Specify command file"); + ACPI_OPTION ("-I ", "Specify additional include directory"); printf ("\nGeneral Output:\n"); - printf (" -p Specify path/filename prefix for all output files\n"); - printf (" -va Disable all errors and warnings (summary only)\n"); - printf (" -vi Less verbose errors and warnings for use with IDEs\n"); - printf (" -vo Enable optimization comments\n"); - printf (" -vr Disable remarks\n"); - printf (" -vs Disable signon\n"); - printf (" -w<1|2|3> Set warning reporting level\n"); + ACPI_OPTION ("-p ", "Specify path/filename prefix for all output files"); + ACPI_OPTION ("-va", "Disable all errors and warnings (summary only)"); + ACPI_OPTION ("-vi", "Less verbose errors and warnings for use with IDEs"); + ACPI_OPTION ("-vo", "Enable optimization comments"); + ACPI_OPTION ("-vr", "Disable remarks"); + ACPI_OPTION ("-vs", "Disable signon"); + ACPI_OPTION ("-w <1|2|3>", "Set warning reporting level"); printf ("\nAML Output Files:\n"); - printf (" -s Create AML in assembler or C source file (*.asm or *.c)\n"); - printf (" -i Create assembler or C include file (*.inc or *.h)\n"); - printf (" -t Create AML in assembler, C, or ASL hex table (*.hex)\n"); + ACPI_OPTION ("-s ", "Create AML in assembler or C source file (*.asm or *.c)"); + ACPI_OPTION ("-i ", "Create assembler or C include file (*.inc or *.h)"); + ACPI_OPTION ("-t ", "Create AML in assembler, C, or ASL hex table (*.hex)"); printf ("\nAML Code Generation:\n"); - printf (" -oa Disable all optimizations (compatibility mode)\n"); - printf (" -of Disable constant folding\n"); - printf (" -oi Disable integer optimization to Zero/One/Ones\n"); - printf (" -on Disable named reference string optimization\n"); - printf (" -cr Disable Resource Descriptor error checking\n"); - printf (" -r Override table header Revision (1-255)\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 ("-cr", "Disable Resource Descriptor error checking"); + ACPI_OPTION ("-r ", "Override table header Revision (1-255)"); printf ("\nASL Listing Files:\n"); - printf (" -l Create mixed listing file (ASL source and AML) (*.lst)\n"); - printf (" -ln Create namespace file (*.nsp)\n"); - printf (" -ls Create combined source file (expanded includes) (*.src)\n"); + ACPI_OPTION ("-l", "Create mixed listing file (ASL source and AML) (*.lst)"); + ACPI_OPTION ("-ln", "Create namespace file (*.nsp)"); + ACPI_OPTION ("-ls", "Create combined source file (expanded includes) (*.src)"); printf ("\nACPI Data Tables:\n"); - printf (" -T |ALL|* Create table template file(s) for \n"); - printf (" -vt Create verbose templates (full disassembly)\n"); + ACPI_OPTION ("-G", "Compile custom table containing generic operators"); + ACPI_OPTION ("-T |ALL|*", "Create table template file(s) for "); + ACPI_OPTION ("-vt", "Create verbose templates (full disassembly)"); printf ("\nAML Disassembler:\n"); - printf (" -d [file] Disassemble or decode binary ACPI table to file (*.dsl)\n"); - printf (" -da [f1,f2] Disassemble multiple tables from single namespace\n"); - printf (" -dc [file] Disassemble AML and immediately compile it\n"); - printf (" (Obtain DSDT from current system if no input file)\n"); - printf (" -e [f1,f2] Include ACPI table(s) for external symbol resolution\n"); - printf (" -2 Emit ACPI 2.0 compatible ASL code\n"); - printf (" -g Get ACPI tables and write to files (*.dat)\n"); + ACPI_OPTION ("-d [file]", "Disassemble or decode binary ACPI table to file (*.dsl)"); + ACPI_OPTION ("-da [f1,f2]", "Disassemble multiple tables from single namespace"); + ACPI_OPTION ("-dc [file]", "Disassemble AML and immediately compile it"); + ACPI_OPTION ("", "(Obtain DSDT from current system if no input file)"); + ACPI_OPTION ("-e [f1,f2]", "Include ACPI table(s) for external symbol resolution"); + ACPI_OPTION ("-2", "Emit ACPI 2.0 compatible ASL code"); + ACPI_OPTION ("-g", "Get ACPI tables and write to files (*.dat)"); printf ("\nHelp:\n"); - printf (" -h Additional help and compiler debug options\n"); - printf (" -hc Display operators allowed in constant expressions\n"); - printf (" -hr Display ACPI reserved method names\n"); - printf (" -ht Display currently supported ACPI table names\n"); + ACPI_OPTION ("-h", "Additional help and compiler debug options"); + ACPI_OPTION ("-hc", "Display operators allowed in constant expressions"); + ACPI_OPTION ("-hr", "Display ACPI reserved method names"); + ACPI_OPTION ("-ht", "Display currently supported ACPI table names"); } @@ -185,7 +186,7 @@ HelpMessage ( void) { - printf ("AML output filename generation:\n"); + 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"); @@ -197,13 +198,13 @@ HelpMessage ( Options (); printf ("\nCompiler/Disassembler Debug Options:\n"); - printf (" -b Create compiler debug/trace file (*.txt)\n"); - printf (" Types: Parse/Tree/Both\n"); - printf (" -f Ignore errors, force creation of AML output file(s)\n"); - printf (" -n Parse only, no output generation\n"); - printf (" -ot Display compile times\n"); - printf (" -x Set debug level for trace output\n"); - printf (" -z Do not insert new compiler ID for DataTables\n"); + ACPI_OPTION ("-b", "Create compiler debug/trace file (*.txt)"); + ACPI_OPTION ("", "Types: Parse/Tree/Both"); + ACPI_OPTION ("-f", "Ignore errors, force creation of AML output file(s)"); + ACPI_OPTION ("-n", "Parse only, no output generation"); + ACPI_OPTION ("-ot", "Display compile times"); + ACPI_OPTION ("-x", "Set debug level for trace output"); + ACPI_OPTION ("-z", "Do not insert new compiler ID for DataTables"); } @@ -224,8 +225,8 @@ Usage ( void) { - printf ("%s\n", ASL_COMPLIANCE); - printf ("Usage: %s [Options] [Files]\n\n", ASL_INVOCATION_NAME); + printf ("%s\n\n", ASL_COMPLIANCE); + ACPI_USAGE_HEADER ("iasl [Options] [Files]"); Options (); } @@ -720,6 +721,11 @@ AslDoOptions ( break; + case 'G': + Gbl_CompileGeneric = TRUE; + break; + + case 'T': Gbl_DoTemplates = TRUE; Gbl_TemplateSignature = AcpiGbl_Optarg; diff --git a/compiler/aslmessages.h b/compiler/aslmessages.h index 269c0a4b3817..cc015be0bc92 100644 --- a/compiler/aslmessages.h +++ b/compiler/aslmessages.h @@ -61,17 +61,18 @@ typedef enum { ASL_MSG_RESERVED = 0, + + ASL_MSG_ALIGNMENT, ASL_MSG_ALPHANUMERIC_STRING, ASL_MSG_AML_NOT_IMPLEMENTED, ASL_MSG_ARG_COUNT_HI, ASL_MSG_ARG_COUNT_LO, ASL_MSG_ARG_INIT, ASL_MSG_BACKWARDS_OFFSET, - ASL_MSG_BITS_TO_BYTES, ASL_MSG_BUFFER_LENGTH, - ASL_MSG_BYTES_TO_BITS, ASL_MSG_CLOSE, ASL_MSG_COMPILER_INTERNAL, + ASL_MSG_COMPILER_RESERVED, ASL_MSG_CONSTANT_EVALUATION, ASL_MSG_CONSTANT_FOLDED, ASL_MSG_CORE_EXCEPTION, @@ -90,15 +91,24 @@ typedef enum ASL_MSG_FIELD_ACCESS_WIDTH, ASL_MSG_FIELD_UNIT_ACCESS_WIDTH, ASL_MSG_FIELD_UNIT_OFFSET, + ASL_MSG_GPE_NAME_CONFLICT, + ASL_MSG_HID_LENGTH, ASL_MSG_INCLUDE_FILE_OPEN, ASL_MSG_INPUT_FILE_OPEN, ASL_MSG_INTEGER_LENGTH, ASL_MSG_INTEGER_OPTIMIZATION, ASL_MSG_INTERRUPT_LIST, ASL_MSG_INTERRUPT_NUMBER, + ASL_MSG_INVALID_ACCESS_SIZE, + ASL_MSG_INVALID_ADDR_FLAGS, ASL_MSG_INVALID_CONSTANT_OP, ASL_MSG_INVALID_EISAID, ASL_MSG_INVALID_ESCAPE, + ASL_MSG_INVALID_GRAN_FIXED, + ASL_MSG_INVALID_GRANULARITY, + ASL_MSG_INVALID_LENGTH, + ASL_MSG_INVALID_LENGTH_FIXED, + ASL_MSG_INVALID_MIN_MAX, ASL_MSG_INVALID_OPERAND, ASL_MSG_INVALID_PERFORMANCE, ASL_MSG_INVALID_PRIORITY, @@ -107,28 +117,38 @@ typedef enum ASL_MSG_INVALID_TIME, ASL_MSG_INVALID_TYPE, ASL_MSG_INVALID_UUID, + ASL_MSG_ISA_ADDRESS, + ASL_MSG_LEADING_ASTERISK, ASL_MSG_LIST_LENGTH_LONG, ASL_MSG_LIST_LENGTH_SHORT, ASL_MSG_LISTING_FILE_OPEN, ASL_MSG_LISTING_FILENAME, ASL_MSG_LOCAL_INIT, + ASL_MSG_LOCAL_OUTSIDE_METHOD, ASL_MSG_LONG_LINE, ASL_MSG_MEMORY_ALLOCATION, ASL_MSG_MISSING_ENDDEPENDENT, ASL_MSG_MISSING_STARTDEPENDENT, + ASL_MSG_MULTIPLE_DEFAULT, ASL_MSG_MULTIPLE_TYPES, ASL_MSG_NAME_EXISTS, ASL_MSG_NAME_OPTIMIZATION, + ASL_MSG_NAMED_OBJECT_IN_WHILE, ASL_MSG_NESTED_COMMENT, ASL_MSG_NO_CASES, + ASL_MSG_NO_REGION, ASL_MSG_NO_RETVAL, ASL_MSG_NO_WHILE, ASL_MSG_NON_ASCII, + ASL_MSG_NON_ZERO, ASL_MSG_NOT_EXIST, ASL_MSG_NOT_FOUND, ASL_MSG_NOT_METHOD, ASL_MSG_NOT_PARAMETER, ASL_MSG_NOT_REACHABLE, + ASL_MSG_NOT_REFERENCED, + ASL_MSG_NULL_DESCRIPTOR, + ASL_MSG_NULL_STRING, ASL_MSG_OPEN, ASL_MSG_OUTPUT_FILE_OPEN, ASL_MSG_OUTPUT_FILENAME, @@ -140,6 +160,7 @@ typedef enum ASL_MSG_RESERVED_ARG_COUNT_HI, ASL_MSG_RESERVED_ARG_COUNT_LO, ASL_MSG_RESERVED_METHOD, + ASL_MSG_RESERVED_NO_RETURN_VAL, ASL_MSG_RESERVED_OPERAND_TYPE, ASL_MSG_RESERVED_RETURN_VALUE, ASL_MSG_RESERVED_USE, @@ -148,63 +169,45 @@ typedef enum ASL_MSG_RESOURCE_INDEX, ASL_MSG_RESOURCE_LIST, ASL_MSG_RESOURCE_SOURCE, + ASL_MSG_RESULT_NOT_USED, ASL_MSG_RETURN_TYPES, ASL_MSG_SCOPE_FWD_REF, ASL_MSG_SCOPE_TYPE, ASL_MSG_SEEK, + ASL_MSG_SERIALIZED, ASL_MSG_SINGLE_NAME_OPTIMIZATION, ASL_MSG_SOME_NO_RETVAL, + ASL_MSG_STRING_LENGTH, ASL_MSG_SWITCH_TYPE, ASL_MSG_SYNC_LEVEL, ASL_MSG_SYNTAX, ASL_MSG_TABLE_SIGNATURE, + ASL_MSG_TAG_LARGER, + ASL_MSG_TAG_SMALLER, + ASL_MSG_TIMEOUT, ASL_MSG_TOO_MANY_TEMPS, ASL_MSG_UNKNOWN_RESERVED_NAME, ASL_MSG_UNREACHABLE_CODE, ASL_MSG_UNSUPPORTED, + ASL_MSG_UPPER_CASE, ASL_MSG_VENDOR_LIST, ASL_MSG_WRITE, - ASL_MSG_MULTIPLE_DEFAULT, - ASL_MSG_TIMEOUT, - ASL_MSG_RESULT_NOT_USED, - ASL_MSG_NOT_REFERENCED, - ASL_MSG_NON_ZERO, - ASL_MSG_STRING_LENGTH, - ASL_MSG_SERIALIZED, - ASL_MSG_COMPILER_RESERVED, - ASL_MSG_NAMED_OBJECT_IN_WHILE, - ASL_MSG_LOCAL_OUTSIDE_METHOD, - ASL_MSG_ALIGNMENT, - ASL_MSG_ISA_ADDRESS, - ASL_MSG_INVALID_MIN_MAX, - ASL_MSG_INVALID_LENGTH, - ASL_MSG_INVALID_LENGTH_FIXED, - ASL_MSG_INVALID_GRANULARITY, - ASL_MSG_INVALID_GRAN_FIXED, - ASL_MSG_INVALID_ACCESS_SIZE, - ASL_MSG_INVALID_ADDR_FLAGS, - ASL_MSG_NULL_DESCRIPTOR, - ASL_MSG_UPPER_CASE, - ASL_MSG_HID_LENGTH, - ASL_MSG_NULL_STRING, - ASL_MSG_LEADING_ASTERISK, - ASL_MSG_RESERVED_NO_RETURN_VAL, - ASL_MSG_GPE_NAME_CONFLICT, - ASL_MSG_NO_REGION, - ASL_MSG_INVALID_FIELD_NAME, - ASL_MSG_INTEGER_SIZE, - ASL_MSG_INVALID_HEX_INTEGER, +/* These messages are used by the data table compiler only */ + ASL_MSG_BUFFER_ELEMENT, - ASL_MSG_RESERVED_VALUE, + ASL_MSG_DIVIDE_BY_ZERO, ASL_MSG_FLAG_VALUE, - ASL_MSG_ZERO_VALUE, - ASL_MSG_UNKNOWN_TABLE, - ASL_MSG_UNKNOWN_SUBTABLE, - ASL_MSG_OEM_TABLE, - ASL_MSG_UNKNOWN_LABEL, + ASL_MSG_INTEGER_SIZE, ASL_MSG_INVALID_EXPRESSION, - ASL_MSG_DIVIDE_BY_ZERO + ASL_MSG_INVALID_FIELD_NAME, + ASL_MSG_INVALID_HEX_INTEGER, + ASL_MSG_OEM_TABLE, + ASL_MSG_RESERVED_VALUE, + ASL_MSG_UNKNOWN_LABEL, + ASL_MSG_UNKNOWN_SUBTABLE, + ASL_MSG_UNKNOWN_TABLE, + ASL_MSG_ZERO_VALUE } ASL_MESSAGE_IDS; @@ -215,17 +218,17 @@ typedef enum char *AslMessages [] = { /* The zeroth message is reserved */ "", +/* ASL_MSG_ALIGNMENT */ "Must be a multiple of alignment/granularity value", /* ASL_MSG_ALPHANUMERIC_STRING */ "String must be entirely alphanumeric", /* ASL_MSG_AML_NOT_IMPLEMENTED */ "Opcode is not implemented in compiler AML code generator", /* ASL_MSG_ARG_COUNT_HI */ "Too many arguments", /* ASL_MSG_ARG_COUNT_LO */ "Too few arguments", /* ASL_MSG_ARG_INIT */ "Method argument is not initialized", /* ASL_MSG_BACKWARDS_OFFSET */ "Invalid backwards offset", -/* ASL_MSG_BITS_TO_BYTES */ "Field offset is in bits, but a byte offset is required", /* ASL_MSG_BUFFER_LENGTH */ "Effective AML buffer length is zero", -/* ASL_MSG_BYTES_TO_BITS */ "Field offset is in bytes, but a bit offset is required", /* ASL_MSG_CLOSE */ "Could not close file", /* ASL_MSG_COMPILER_INTERNAL */ "Internal compiler error", +/* ASL_MSG_COMPILER_RESERVED */ "Use of compiler reserved name", /* ASL_MSG_CONSTANT_EVALUATION */ "Could not evaluate constant expression", /* ASL_MSG_CONSTANT_FOLDED */ "Constant expression evaluated and reduced", /* ASL_MSG_CORE_EXCEPTION */ "From ACPI CA Subsystem", @@ -244,15 +247,24 @@ char *AslMessages [] = { /* ASL_MSG_FIELD_ACCESS_WIDTH */ "Access width is greater than region size", /* ASL_MSG_FIELD_UNIT_ACCESS_WIDTH */ "Access width of Field Unit extends beyond region limit", /* ASL_MSG_FIELD_UNIT_OFFSET */ "Field Unit extends beyond region limit", +/* ASL_MSG_GPE_NAME_CONFLICT */ "Name conflicts with a previous GPE method", +/* ASL_MSG_HID_LENGTH */ "_HID string must be exactly 7 or 8 characters", /* ASL_MSG_INCLUDE_FILE_OPEN */ "Could not open include file", /* ASL_MSG_INPUT_FILE_OPEN */ "Could not open input file", /* ASL_MSG_INTEGER_LENGTH */ "64-bit integer in 32-bit table, truncating", /* ASL_MSG_INTEGER_OPTIMIZATION */ "Integer optimized to single-byte AML opcode", /* ASL_MSG_INTERRUPT_LIST */ "Too many interrupts (16 max)", /* ASL_MSG_INTERRUPT_NUMBER */ "Invalid interrupt number (must be 0-15)", +/* ASL_MSG_INVALID_ACCESS_SIZE */ "Invalid AccessSize (Maximum is 4 - QWord access)", +/* ASL_MSG_INVALID_ADDR_FLAGS */ "Invalid combination of Length and Min/Max fixed flags", /* ASL_MSG_INVALID_CONSTANT_OP */ "Invalid operator in constant expression (not type 3/4/5)", /* ASL_MSG_INVALID_EISAID */ "EISAID string must be of the form \"UUUXXXX\" (3 uppercase, 4 hex digits)", /* ASL_MSG_INVALID_ESCAPE */ "Invalid or unknown escape sequence", +/* ASL_MSG_INVALID_GRAN_FIXED */ "Granularity must be zero for fixed Min/Max", +/* ASL_MSG_INVALID_GRANULARITY */ "Granularity must be zero or a power of two minus one", +/* ASL_MSG_INVALID_LENGTH */ "Length is larger than Min/Max window", +/* ASL_MSG_INVALID_LENGTH_FIXED */ "Length is not equal to fixed Min/Max window", +/* ASL_MSG_INVALID_MIN_MAX */ "Address Min is greater than Address Max", /* ASL_MSG_INVALID_OPERAND */ "Invalid operand", /* ASL_MSG_INVALID_PERFORMANCE */ "Invalid performance/robustness value", /* ASL_MSG_INVALID_PRIORITY */ "Invalid priority value", @@ -261,28 +273,38 @@ char *AslMessages [] = { /* ASL_MSG_INVALID_TIME */ "Time parameter too long (255 max)", /* ASL_MSG_INVALID_TYPE */ "Invalid type", /* ASL_MSG_INVALID_UUID */ "UUID string must be of the form \"aabbccdd-eeff-gghh-iijj-kkllmmnnoopp\"", +/* ASL_MSG_ISA_ADDRESS */ "Maximum 10-bit ISA address (0x3FF)", +/* ASL_MSG_LEADING_ASTERISK */ "Invalid leading asterisk", /* ASL_MSG_LIST_LENGTH_LONG */ "Initializer list longer than declared package length", /* ASL_MSG_LIST_LENGTH_SHORT */ "Initializer list shorter than declared package length", /* ASL_MSG_LISTING_FILE_OPEN */ "Could not open listing file", /* ASL_MSG_LISTING_FILENAME */ "Could not create listing filename", /* ASL_MSG_LOCAL_INIT */ "Method local variable is not initialized", +/* ASL_MSG_LOCAL_OUTSIDE_METHOD */ "Local or Arg used outside a control method", /* ASL_MSG_LONG_LINE */ "Splitting long input line", /* ASL_MSG_MEMORY_ALLOCATION */ "Memory allocation failure", /* ASL_MSG_MISSING_ENDDEPENDENT */ "Missing EndDependentFn() macro in dependent resource list", /* ASL_MSG_MISSING_STARTDEPENDENT */ "Missing StartDependentFn() macro in dependent resource list", +/* ASL_MSG_MULTIPLE_DEFAULT */ "More than one Default statement within Switch construct", /* ASL_MSG_MULTIPLE_TYPES */ "Multiple types", /* ASL_MSG_NAME_EXISTS */ "Name already exists in scope", /* ASL_MSG_NAME_OPTIMIZATION */ "NamePath optimized", +/* ASL_MSG_NAMED_OBJECT_IN_WHILE */ "Creating a named object in a While loop", /* ASL_MSG_NESTED_COMMENT */ "Nested comment found", /* ASL_MSG_NO_CASES */ "No Case statements under Switch", +/* ASL_MSG_NO_REGION */ "_REG has no corresponding Operation Region", /* ASL_MSG_NO_RETVAL */ "Called method returns no value", /* ASL_MSG_NO_WHILE */ "No enclosing While statement", /* ASL_MSG_NON_ASCII */ "Invalid characters found in file", +/* ASL_MSG_NON_ZERO */ "Operand evaluates to zero", /* ASL_MSG_NOT_EXIST */ "Object does not exist", /* ASL_MSG_NOT_FOUND */ "Object not found or not accessible from scope", /* ASL_MSG_NOT_METHOD */ "Not a control method, cannot invoke", /* ASL_MSG_NOT_PARAMETER */ "Not a parameter, used as local only", /* ASL_MSG_NOT_REACHABLE */ "Object is not accessible from this scope", +/* ASL_MSG_NOT_REFERENCED */ "Namespace object is not referenced", +/* ASL_MSG_NULL_DESCRIPTOR */ "Min/Max/Length/Gran are all zero, but no resource tag", +/* ASL_MSG_NULL_STRING */ "Invalid zero-length (null) string", /* ASL_MSG_OPEN */ "Could not open file", /* ASL_MSG_OUTPUT_FILE_OPEN */ "Could not open output AML file", /* ASL_MSG_OUTPUT_FILENAME */ "Could not create output filename", @@ -294,6 +316,7 @@ char *AslMessages [] = { /* ASL_MSG_RESERVED_ARG_COUNT_HI */ "Reserved method has too many arguments", /* ASL_MSG_RESERVED_ARG_COUNT_LO */ "Reserved method has too few arguments", /* ASL_MSG_RESERVED_METHOD */ "Reserved name must be a control method", +/* ASL_MSG_RESERVED_NO_RETURN_VAL */ "Reserved method should not return a value", /* ASL_MSG_RESERVED_OPERAND_TYPE */ "Invalid object type for reserved name", /* ASL_MSG_RESERVED_RETURN_VALUE */ "Reserved method must return a value", /* ASL_MSG_RESERVED_USE */ "Invalid use of reserved name", @@ -302,65 +325,45 @@ char *AslMessages [] = { /* ASL_MSG_RESOURCE_INDEX */ "Missing ResourceSourceIndex (required)", /* ASL_MSG_RESOURCE_LIST */ "Too many resource items (internal error)", /* ASL_MSG_RESOURCE_SOURCE */ "Missing ResourceSource string (required)", +/* ASL_MSG_RESULT_NOT_USED */ "Result is not used, operator has no effect", /* ASL_MSG_RETURN_TYPES */ "Not all control paths return a value", /* ASL_MSG_SCOPE_FWD_REF */ "Forward references from Scope operator not allowed", /* ASL_MSG_SCOPE_TYPE */ "Existing object has invalid type for Scope operator", /* ASL_MSG_SEEK */ "Could not seek file", +/* ASL_MSG_SERIALIZED */ "Control Method marked Serialized", /* ASL_MSG_SINGLE_NAME_OPTIMIZATION */ "NamePath optimized to NameSeg (uses run-time search path)", /* ASL_MSG_SOME_NO_RETVAL */ "Called method may not always return a value", +/* ASL_MSG_STRING_LENGTH */ "String literal too long", /* ASL_MSG_SWITCH_TYPE */ "Switch expression is not a static Integer/Buffer/String data type, defaulting to Integer", /* ASL_MSG_SYNC_LEVEL */ "SyncLevel must be in the range 0-15", /* ASL_MSG_SYNTAX */ "", /* ASL_MSG_TABLE_SIGNATURE */ "Invalid Table Signature", +/* ASL_MSG_TAG_LARGER */ "ResourceTag larger than Field", +/* ASL_MSG_TAG_SMALLER */ "ResourceTag smaller than Field", +/* ASL_MSG_TIMEOUT */ "Result is not used, possible operator timeout will be missed", /* ASL_MSG_TOO_MANY_TEMPS */ "Method requires too many temporary variables (_T_x)", /* ASL_MSG_UNKNOWN_RESERVED_NAME */ "Unknown reserved name", /* ASL_MSG_UNREACHABLE_CODE */ "Statement is unreachable", /* ASL_MSG_UNSUPPORTED */ "Unsupported feature", +/* ASL_MSG_UPPER_CASE */ "Non-hex letters must be upper case", /* ASL_MSG_VENDOR_LIST */ "Too many vendor data bytes (7 max)", /* ASL_MSG_WRITE */ "Could not write file", -/* ASL_MSG_MULTIPLE_DEFAULT */ "More than one Default statement within Switch construct", -/* ASL_MSG_TIMEOUT */ "Result is not used, possible operator timeout will be missed", -/* ASL_MSG_RESULT_NOT_USED */ "Result is not used, operator has no effect", -/* ASL_MSG_NOT_REFERENCED */ "Namespace object is not referenced", -/* ASL_MSG_NON_ZERO */ "Operand evaluates to zero", -/* ASL_MSG_STRING_LENGTH */ "String literal too long", -/* ASL_MSG_SERIALIZED */ "Control Method marked Serialized", -/* ASL_MSG_COMPILER_RESERVED */ "Use of compiler reserved name", -/* ASL_MSG_NAMED_OBJECT_IN_WHILE */ "Creating a named object in a While loop", -/* ASL_MSG_LOCAL_OUTSIDE_METHOD */ "Local or Arg used outside a control method", -/* ASL_MSG_ALIGNMENT */ "Must be a multiple of alignment/granularity value", -/* ASL_MSG_ISA_ADDRESS */ "Maximum 10-bit ISA address (0x3FF)", -/* ASL_MSG_INVALID_MIN_MAX */ "Address Min is greater than Address Max", -/* ASL_MSG_INVALID_LENGTH */ "Length is larger than Min/Max window", -/* ASL_MSG_INVALID_LENGTH_FIXED */ "Length is not equal to fixed Min/Max window", -/* ASL_MSG_INVALID_GRANULARITY */ "Granularity must be zero or a power of two minus one", -/* ASL_MSG_INVALID_GRAN_FIXED */ "Granularity must be zero for fixed Min/Max", -/* ASL_MSG_INVALID_ACCESS_SIZE */ "Invalid AccessSize (Maximum is 4 - QWord access)", -/* ASL_MSG_INVALID_ADDR_FLAGS */ "Invalid combination of Length and Min/Max fixed flags", -/* ASL_MSG_NULL_DESCRIPTOR */ "Min/Max/Length/Gran are all zero, but no resource tag", -/* ASL_MSG_UPPER_CASE */ "Non-hex letters must be upper case", -/* ASL_MSG_HID_LENGTH */ "_HID string must be exactly 7 or 8 characters", -/* ASL_MSG_NULL_STRING */ "Invalid zero-length (null) string", -/* ASL_MSG_LEADING_ASTERISK */ "Invalid leading asterisk", -/* ASL_MSG_RESERVED_NO_RETURN_VAL */ "Reserved method should not return a value", -/* ASL_MSG_GPE_NAME_CONFLICT */ "Name conflicts with a previous GPE method", -/* ASL_MSG_NO_REGION */ "_REG has no corresponding Operation Region", /* These messages are used by the data table compiler only */ -/* ASL_MSG_INVALID_FIELD_NAME */ "Invalid Field Name", -/* ASL_MSG_INTEGER_SIZE */ "Integer too large for target", -/* ASL_MSG_INVALID_HEX_INTEGER */ "Invalid hex integer constant", /* ASL_MSG_BUFFER_ELEMENT */ "Invalid element in buffer initializer list", -/* ASL_MSG_RESERVED_VALUE */ "Reserved field must be zero", +/* ASL_MSG_DIVIDE_BY_ZERO */ "Expression contains divide-by-zero", /* ASL_MSG_FLAG_VALUE */ "Flag value is too large", -/* ASL_MSG_ZERO_VALUE */ "Value must be non-zero", -/* ASL_MSG_UNKNOWN_TABLE */ "Unknown ACPI table signature", -/* ASL_MSG_UNKNOWN_SUBTABLE */ "Unknown subtable type", -/* ASL_MSG_OEM_TABLE */ "OEM table - unknown contents", -/* ASL_MSG_UNKNOWN_LABEL */ "Label is undefined", +/* ASL_MSG_INTEGER_SIZE */ "Integer too large for target", /* ASL_MSG_INVALID_EXPRESSION */ "Invalid expression", -/* ASL_MSG_DIVIDE_BY_ZERO */ "Expression contains divide-by-zero" +/* ASL_MSG_INVALID_FIELD_NAME */ "Invalid Field Name", +/* ASL_MSG_INVALID_HEX_INTEGER */ "Invalid hex integer constant", +/* ASL_MSG_OEM_TABLE */ "OEM table - unknown contents", +/* ASL_MSG_RESERVED_VALUE */ "Reserved field must be zero", +/* ASL_MSG_UNKNOWN_LABEL */ "Label is undefined", +/* ASL_MSG_UNKNOWN_SUBTABLE */ "Unknown subtable type", +/* ASL_MSG_UNKNOWN_TABLE */ "Unknown ACPI table signature", +/* ASL_MSG_ZERO_VALUE */ "Value must be non-zero" }; diff --git a/compiler/asloperands.c b/compiler/asloperands.c index c8821e6ccd66..5e729ce365c7 100644 --- a/compiler/asloperands.c +++ b/compiler/asloperands.c @@ -761,6 +761,7 @@ OpnDoPackage ( if ((PackageLengthOp->Asl.ParseOpcode == PARSEOP_INTEGER) || (PackageLengthOp->Asl.ParseOpcode == PARSEOP_QWORDCONST) || + (PackageLengthOp->Asl.ParseOpcode == PARSEOP_ZERO) || (PackageLengthOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)) { if (!PackageLength) @@ -778,8 +779,11 @@ OpnDoPackage ( * If the PackageLength is a constant <= 255, we can change the * AML opcode from VarPackage to a simple (ACPI 1.0) Package opcode. */ - if ((Op->Asl.Child->Asl.ParseOpcode == PARSEOP_INTEGER) && - (Op->Asl.Child->Asl.Value.Integer <= 255)) + if (((Op->Asl.Child->Asl.ParseOpcode == PARSEOP_INTEGER) && + (Op->Asl.Child->Asl.Value.Integer <= 255)) || + (Op->Asl.Child->Asl.ParseOpcode == PARSEOP_ONE) || + (Op->Asl.Child->Asl.ParseOpcode == PARSEOP_ONES)|| + (Op->Asl.Child->Asl.ParseOpcode == PARSEOP_ZERO)) { Op->Asl.AmlOpcode = AML_PACKAGE_OP; Op->Asl.ParseOpcode = PARSEOP_PACKAGE; diff --git a/compiler/aslpredef.c b/compiler/aslpredef.c index a83674b270c7..f1fec290bc3f 100644 --- a/compiler/aslpredef.c +++ b/compiler/aslpredef.c @@ -658,6 +658,7 @@ ApCheckObjectType ( break; case PARSEOP_PACKAGE: + case PARSEOP_VAR_PACKAGE: ReturnBtype = ACPI_RTYPE_PACKAGE; break; diff --git a/compiler/aslresource.c b/compiler/aslresource.c index 5ea36dced0c3..0954b8460d5d 100644 --- a/compiler/aslresource.c +++ b/compiler/aslresource.c @@ -437,13 +437,14 @@ RsAllocateResourceNode ( /******************************************************************************* * - * FUNCTION: RsCreateBitField + * FUNCTION: RsCreateResourceField * * PARAMETERS: Op - Resource field node * Name - Name of the field (Used only to reference * the field in the ASL, not in the AML) * ByteOffset - Offset from the field start * BitOffset - Additional bit offset + * BitLength - Number of bits in the field * * RETURN: None, sets fields within the input node * @@ -454,46 +455,20 @@ RsAllocateResourceNode ( ******************************************************************************/ void -RsCreateBitField ( +RsCreateResourceField ( ACPI_PARSE_OBJECT *Op, char *Name, UINT32 ByteOffset, - UINT32 BitOffset) + UINT32 BitOffset, + UINT32 BitLength) { - Op->Asl.ExternalName = Name; - Op->Asl.Value.Integer = ((UINT64) ByteOffset * 8) + BitOffset; - Op->Asl.CompileFlags |= (NODE_IS_RESOURCE_FIELD | NODE_IS_BIT_OFFSET); -} + Op->Asl.ExternalName = Name; + Op->Asl.CompileFlags |= NODE_IS_RESOURCE_FIELD; -/******************************************************************************* - * - * FUNCTION: RsCreateByteField - * - * PARAMETERS: Op - Resource field node - * Name - Name of the field (Used only to reference - * the field in the ASL, not in the AML) - * ByteOffset - Offset from the field start - * - * RETURN: None, sets fields within the input node - * - * DESCRIPTION: Utility function to generate a named byte field within a - * resource descriptor. Mark a node as 1) a field in a resource - * descriptor, and 2) set the value to be a BYTE offset - * - ******************************************************************************/ - -void -RsCreateByteField ( - ACPI_PARSE_OBJECT *Op, - char *Name, - UINT32 ByteOffset) -{ - - Op->Asl.ExternalName = Name; - Op->Asl.Value.Integer = ByteOffset; - Op->Asl.CompileFlags |= NODE_IS_RESOURCE_FIELD; + Op->Asl.Value.Tag.BitOffset = (ByteOffset * 8) + BitOffset; + Op->Asl.Value.Tag.BitLength = BitLength; } diff --git a/compiler/aslrestype1.c b/compiler/aslrestype1.c index 4db8b09ae300..996eee727489 100644 --- a/compiler/aslrestype1.c +++ b/compiler/aslrestype1.c @@ -179,7 +179,7 @@ RsDoMemory24Descriptor ( case 1: /* Min Address */ Descriptor->Memory24.Minimum = (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, + RsCreateWordField (InitializerOp, ACPI_RESTAG_MINADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Minimum)); MinOp = InitializerOp; break; @@ -187,7 +187,7 @@ RsDoMemory24Descriptor ( case 2: /* Max Address */ Descriptor->Memory24.Maximum = (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, + RsCreateWordField (InitializerOp, ACPI_RESTAG_MAXADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Maximum)); MaxOp = InitializerOp; break; @@ -195,14 +195,14 @@ RsDoMemory24Descriptor ( case 3: /* Alignment */ Descriptor->Memory24.Alignment = (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_ALIGNMENT, + RsCreateWordField (InitializerOp, ACPI_RESTAG_ALIGNMENT, CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Alignment)); break; case 4: /* Length */ Descriptor->Memory24.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, + RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH, CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.AddressLength)); LengthOp = InitializerOp; break; @@ -286,7 +286,7 @@ RsDoMemory32Descriptor ( case 1: /* Min Address */ Descriptor->Memory32.Minimum = (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, + RsCreateDwordField (InitializerOp, ACPI_RESTAG_MINADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Minimum)); MinOp = InitializerOp; break; @@ -294,7 +294,7 @@ RsDoMemory32Descriptor ( case 2: /* Max Address */ Descriptor->Memory32.Maximum = (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, + RsCreateDwordField (InitializerOp, ACPI_RESTAG_MAXADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Maximum)); MaxOp = InitializerOp; break; @@ -302,7 +302,7 @@ RsDoMemory32Descriptor ( case 3: /* Alignment */ Descriptor->Memory32.Alignment = (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_ALIGNMENT, + RsCreateDwordField (InitializerOp, ACPI_RESTAG_ALIGNMENT, CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Alignment)); AlignOp = InitializerOp; break; @@ -310,7 +310,7 @@ RsDoMemory32Descriptor ( case 4: /* Length */ Descriptor->Memory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, + RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH, CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.AddressLength)); LengthOp = InitializerOp; break; @@ -390,14 +390,14 @@ RsDoMemory32FixedDescriptor ( case 1: /* Address */ Descriptor->FixedMemory32.Address = (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_BASEADDRESS, + RsCreateDwordField (InitializerOp, ACPI_RESTAG_BASEADDRESS, CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.Address)); break; case 2: /* Length */ Descriptor->FixedMemory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, + RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH, CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.AddressLength)); break; diff --git a/compiler/aslrestype1i.c b/compiler/aslrestype1i.c index 80645df3cee2..2c8c79044369 100644 --- a/compiler/aslrestype1i.c +++ b/compiler/aslrestype1i.c @@ -102,8 +102,8 @@ RsDoDmaDescriptor ( case 0: /* DMA type */ RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 5, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_DMATYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 5); + RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_DMATYPE, + CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 5, 2); break; case 1: /* Bus Master */ @@ -116,8 +116,8 @@ RsDoDmaDescriptor ( case 2: /* Xfer Type (transfer width) */ RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 0, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_XFERTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 0); + RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_XFERTYPE, + CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 0, 2); break; case 3: /* Name */ @@ -223,7 +223,7 @@ RsDoFixedIoDescriptor ( Descriptor->FixedIo.Address = (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_BASEADDRESS, + RsCreateWordField (InitializerOp, ACPI_RESTAG_BASEADDRESS, CurrentByteOffset + ASL_RESDESC_OFFSET (FixedIo.Address)); AddressOp = InitializerOp; break; @@ -314,7 +314,7 @@ RsDoIoDescriptor ( Descriptor->Io.Minimum = (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, + RsCreateWordField (InitializerOp, ACPI_RESTAG_MINADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Minimum)); MinOp = InitializerOp; break; @@ -323,7 +323,7 @@ RsDoIoDescriptor ( Descriptor->Io.Maximum = (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, + RsCreateWordField (InitializerOp, ACPI_RESTAG_MAXADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Maximum)); MaxOp = InitializerOp; break; @@ -480,7 +480,7 @@ RsDoIrqDescriptor ( /* Create a named field at the start of the list */ - RsCreateByteField (InitializerOp, ACPI_RESTAG_INTERRUPT, + RsCreateWordField (InitializerOp, ACPI_RESTAG_INTERRUPT, CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.IrqMask)); } break; @@ -580,7 +580,7 @@ RsDoIrqNoFlagsDescriptor ( /* Create a named field at the start of the list */ - RsCreateByteField (InitializerOp, ACPI_RESTAG_INTERRUPT, + RsCreateWordField (InitializerOp, ACPI_RESTAG_INTERRUPT, CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.IrqMask)); } break; diff --git a/compiler/aslrestype2.c b/compiler/aslrestype2.c index b41c90972737..31119d75d5dd 100644 --- a/compiler/aslrestype2.c +++ b/compiler/aslrestype2.c @@ -120,7 +120,7 @@ RsDoGeneralRegisterDescriptor ( case 3: /* Register Address */ Descriptor->GenericReg.Address = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_ADDRESS, + RsCreateQwordField (InitializerOp, ACPI_RESTAG_ADDRESS, CurrentByteOffset + ASL_RESDESC_OFFSET (GenericReg.Address)); break; @@ -354,7 +354,7 @@ RsDoInterruptDescriptor ( /* Create a named field at the start of the list */ - RsCreateByteField (InitializerOp, ACPI_RESTAG_INTERRUPT, + RsCreateDwordField (InitializerOp, ACPI_RESTAG_INTERRUPT, CurrentByteOffset + ASL_RESDESC_OFFSET (ExtendedIrq.Interrupts[0])); } diff --git a/compiler/aslrestype2d.c b/compiler/aslrestype2d.c index b1854267d47f..e17c10b89f0a 100644 --- a/compiler/aslrestype2d.c +++ b/compiler/aslrestype2d.c @@ -144,15 +144,15 @@ RsDoDwordIoDescriptor ( case 4: /* Range Type */ RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 0, 3); - RsCreateBitField (InitializerOp, ACPI_RESTAG_RANGETYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 0); + RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_RANGETYPE, + CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 0, 2); break; case 5: /* Address Granularity */ Descriptor->Address32.Granularity = (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY, + RsCreateDwordField (InitializerOp, ACPI_RESTAG_GRANULARITY, CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity)); GranOp = InitializerOp; break; @@ -161,7 +161,7 @@ RsDoDwordIoDescriptor ( Descriptor->Address32.Minimum = (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, + RsCreateDwordField (InitializerOp, ACPI_RESTAG_MINADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum)); MinOp = InitializerOp; break; @@ -170,7 +170,7 @@ RsDoDwordIoDescriptor ( Descriptor->Address32.Maximum = (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, + RsCreateDwordField (InitializerOp, ACPI_RESTAG_MAXADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum)); MaxOp = InitializerOp; break; @@ -179,7 +179,7 @@ RsDoDwordIoDescriptor ( Descriptor->Address32.TranslationOffset = (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION, + RsCreateDwordField (InitializerOp, ACPI_RESTAG_TRANSLATION, CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset)); break; @@ -187,7 +187,7 @@ RsDoDwordIoDescriptor ( Descriptor->Address32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, + RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH, CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength)); LengthOp = InitializerOp; break; @@ -376,8 +376,8 @@ RsDoDwordMemoryDescriptor ( case 4: /* Memory Type */ RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 1, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 1); + RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_MEMTYPE, + CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 1, 2); break; case 5: /* Read/Write Type */ @@ -391,7 +391,7 @@ RsDoDwordMemoryDescriptor ( Descriptor->Address32.Granularity = (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY, + RsCreateDwordField (InitializerOp, ACPI_RESTAG_GRANULARITY, CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity)); GranOp = InitializerOp; break; @@ -400,7 +400,7 @@ RsDoDwordMemoryDescriptor ( Descriptor->Address32.Minimum = (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, + RsCreateDwordField (InitializerOp, ACPI_RESTAG_MINADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum)); MinOp = InitializerOp; break; @@ -409,7 +409,7 @@ RsDoDwordMemoryDescriptor ( Descriptor->Address32.Maximum = (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, + RsCreateDwordField (InitializerOp, ACPI_RESTAG_MAXADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum)); MaxOp = InitializerOp; break; @@ -418,7 +418,7 @@ RsDoDwordMemoryDescriptor ( Descriptor->Address32.TranslationOffset = (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION, + RsCreateDwordField (InitializerOp, ACPI_RESTAG_TRANSLATION, CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset)); break; @@ -426,7 +426,7 @@ RsDoDwordMemoryDescriptor ( Descriptor->Address32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, + RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH, CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength)); LengthOp = InitializerOp; break; @@ -488,8 +488,8 @@ RsDoDwordMemoryDescriptor ( case 14: /* Address Range */ RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMATTRIBUTES, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 3); + RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_MEMATTRIBUTES, + CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 3, 2); break; case 15: /* Type */ @@ -623,7 +623,7 @@ RsDoDwordSpaceDescriptor ( Descriptor->Address32.Granularity = (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY, + RsCreateDwordField (InitializerOp, ACPI_RESTAG_GRANULARITY, CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity)); GranOp = InitializerOp; break; @@ -632,7 +632,7 @@ RsDoDwordSpaceDescriptor ( Descriptor->Address32.Minimum = (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, + RsCreateDwordField (InitializerOp, ACPI_RESTAG_MINADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum)); MinOp = InitializerOp; break; @@ -641,7 +641,7 @@ RsDoDwordSpaceDescriptor ( Descriptor->Address32.Maximum = (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, + RsCreateDwordField (InitializerOp, ACPI_RESTAG_MAXADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum)); MaxOp = InitializerOp; break; @@ -650,7 +650,7 @@ RsDoDwordSpaceDescriptor ( Descriptor->Address32.TranslationOffset = (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION, + RsCreateDwordField (InitializerOp, ACPI_RESTAG_TRANSLATION, CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset)); break; @@ -658,7 +658,7 @@ RsDoDwordSpaceDescriptor ( Descriptor->Address32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, + RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH, CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength)); LengthOp = InitializerOp; break; diff --git a/compiler/aslrestype2e.c b/compiler/aslrestype2e.c index a426c048fb08..65d389c5011b 100644 --- a/compiler/aslrestype2e.c +++ b/compiler/aslrestype2e.c @@ -136,14 +136,14 @@ RsDoExtendedIoDescriptor ( case 4: /* Range Type */ RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 0, 3); - RsCreateBitField (InitializerOp, ACPI_RESTAG_RANGETYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 0); + RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_RANGETYPE, + CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 0, 2); break; case 5: /* Address Granularity */ Descriptor->ExtAddress64.Granularity = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY, + RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY, CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity)); GranOp = InitializerOp; break; @@ -151,7 +151,7 @@ RsDoExtendedIoDescriptor ( case 6: /* Address Min */ Descriptor->ExtAddress64.Minimum = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, + RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum)); MinOp = InitializerOp; break; @@ -159,7 +159,7 @@ RsDoExtendedIoDescriptor ( case 7: /* Address Max */ Descriptor->ExtAddress64.Maximum = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, + RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum)); MaxOp = InitializerOp; break; @@ -167,14 +167,14 @@ RsDoExtendedIoDescriptor ( case 8: /* Translation Offset */ Descriptor->ExtAddress64.TranslationOffset = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION, + RsCreateQwordField (InitializerOp, ACPI_RESTAG_TRANSLATION, CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TranslationOffset)); break; case 9: /* Address Length */ Descriptor->ExtAddress64.AddressLength = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, + RsCreateQwordField (InitializerOp, ACPI_RESTAG_LENGTH, CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.AddressLength)); LengthOp = InitializerOp; break; @@ -182,7 +182,7 @@ RsDoExtendedIoDescriptor ( case 10: /* Type-Specific Attributes */ Descriptor->ExtAddress64.TypeSpecific = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES, + RsCreateQwordField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES, CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TypeSpecific)); break; @@ -309,8 +309,8 @@ RsDoExtendedMemoryDescriptor ( case 4: /* Memory Type */ RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 1, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 1); + RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_MEMTYPE, + CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 1, 2); break; case 5: /* Read/Write Type */ @@ -323,7 +323,7 @@ RsDoExtendedMemoryDescriptor ( case 6: /* Address Granularity */ Descriptor->ExtAddress64.Granularity = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY, + RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY, CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity)); GranOp = InitializerOp; break; @@ -331,7 +331,7 @@ RsDoExtendedMemoryDescriptor ( case 7: /* Min Address */ Descriptor->ExtAddress64.Minimum = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, + RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum)); MinOp = InitializerOp; break; @@ -339,7 +339,7 @@ RsDoExtendedMemoryDescriptor ( case 8: /* Max Address */ Descriptor->ExtAddress64.Maximum = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, + RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum)); MaxOp = InitializerOp; break; @@ -347,14 +347,14 @@ RsDoExtendedMemoryDescriptor ( case 9: /* Translation Offset */ Descriptor->ExtAddress64.TranslationOffset = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION, + RsCreateQwordField (InitializerOp, ACPI_RESTAG_TRANSLATION, CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TranslationOffset)); break; case 10: /* Address Length */ Descriptor->ExtAddress64.AddressLength = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, + RsCreateQwordField (InitializerOp, ACPI_RESTAG_LENGTH, CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.AddressLength)); LengthOp = InitializerOp; break; @@ -362,7 +362,7 @@ RsDoExtendedMemoryDescriptor ( case 11: /* Type-Specific Attributes */ Descriptor->ExtAddress64.TypeSpecific = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES, + RsCreateQwordField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES, CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TypeSpecific)); break; @@ -375,8 +375,8 @@ RsDoExtendedMemoryDescriptor ( case 13: /* Address Range */ RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMATTRIBUTES, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 3); + RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_MEMATTRIBUTES, + CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 3, 2); break; case 14: /* Type */ @@ -501,7 +501,7 @@ RsDoExtendedSpaceDescriptor ( case 6: /* Address Granularity */ Descriptor->ExtAddress64.Granularity = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY, + RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY, CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity)); GranOp = InitializerOp; break; @@ -509,7 +509,7 @@ RsDoExtendedSpaceDescriptor ( case 7: /* Min Address */ Descriptor->ExtAddress64.Minimum = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, + RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum)); MinOp = InitializerOp; break; @@ -517,7 +517,7 @@ RsDoExtendedSpaceDescriptor ( case 8: /* Max Address */ Descriptor->ExtAddress64.Maximum = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, + RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum)); MaxOp = InitializerOp; break; @@ -525,14 +525,14 @@ RsDoExtendedSpaceDescriptor ( case 9: /* Translation Offset */ Descriptor->ExtAddress64.TranslationOffset = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION, + RsCreateQwordField (InitializerOp, ACPI_RESTAG_TRANSLATION, CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TranslationOffset)); break; case 10: /* Address Length */ Descriptor->ExtAddress64.AddressLength = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, + RsCreateQwordField (InitializerOp, ACPI_RESTAG_LENGTH, CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.AddressLength)); LengthOp = InitializerOp; break; @@ -540,7 +540,7 @@ RsDoExtendedSpaceDescriptor ( case 11: /* Type-Specific Attributes */ Descriptor->ExtAddress64.TypeSpecific = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES, + RsCreateQwordField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES, CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TypeSpecific)); break; diff --git a/compiler/aslrestype2q.c b/compiler/aslrestype2q.c index 8df910ca67a6..00882f79d58f 100644 --- a/compiler/aslrestype2q.c +++ b/compiler/aslrestype2q.c @@ -144,14 +144,14 @@ RsDoQwordIoDescriptor ( case 4: /* Range Type */ RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 0, 3); - RsCreateBitField (InitializerOp, ACPI_RESTAG_RANGETYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 0); + RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_RANGETYPE, + CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 0, 2); break; case 5: /* Address Granularity */ Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY, + RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY, CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity)); GranOp = InitializerOp; break; @@ -159,7 +159,7 @@ RsDoQwordIoDescriptor ( case 6: /* Address Min */ Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, + RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum)); MinOp = InitializerOp; break; @@ -167,7 +167,7 @@ RsDoQwordIoDescriptor ( case 7: /* Address Max */ Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, + RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum)); MaxOp = InitializerOp; break; @@ -182,7 +182,7 @@ RsDoQwordIoDescriptor ( case 9: /* Address Length */ Descriptor->Address64.AddressLength = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, + RsCreateQwordField (InitializerOp, ACPI_RESTAG_LENGTH, CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.AddressLength)); LengthOp = InitializerOp; break; @@ -366,8 +366,8 @@ RsDoQwordMemoryDescriptor ( case 4: /* Memory Type */ RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 1, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 1); + RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_MEMTYPE, + CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 1, 2); break; case 5: /* Read/Write Type */ @@ -380,7 +380,7 @@ RsDoQwordMemoryDescriptor ( case 6: /* Address Granularity */ Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY, + RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY, CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity)); GranOp = InitializerOp; break; @@ -388,7 +388,7 @@ RsDoQwordMemoryDescriptor ( case 7: /* Min Address */ Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, + RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum)); MinOp = InitializerOp; break; @@ -396,7 +396,7 @@ RsDoQwordMemoryDescriptor ( case 8: /* Max Address */ Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, + RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum)); MaxOp = InitializerOp; break; @@ -404,14 +404,14 @@ RsDoQwordMemoryDescriptor ( case 9: /* Translation Offset */ Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION, + RsCreateQwordField (InitializerOp, ACPI_RESTAG_TRANSLATION, CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset)); break; case 10: /* Address Length */ Descriptor->Address64.AddressLength = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, + RsCreateQwordField (InitializerOp, ACPI_RESTAG_LENGTH, CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.AddressLength)); LengthOp = InitializerOp; break; @@ -473,8 +473,8 @@ RsDoQwordMemoryDescriptor ( case 14: /* Address Range */ RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMATTRIBUTES, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 3); + RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_MEMATTRIBUTES, + CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 3, 2); break; case 15: /* Type */ @@ -607,7 +607,7 @@ RsDoQwordSpaceDescriptor ( case 6: /* Address Granularity */ Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY, + RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY, CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity)); GranOp = InitializerOp; break; @@ -615,7 +615,7 @@ RsDoQwordSpaceDescriptor ( case 7: /* Min Address */ Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, + RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum)); MinOp = InitializerOp; break; @@ -623,7 +623,7 @@ RsDoQwordSpaceDescriptor ( case 8: /* Max Address */ Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, + RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum)); MaxOp = InitializerOp; break; @@ -631,14 +631,14 @@ RsDoQwordSpaceDescriptor ( case 9: /* Translation Offset */ Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION, + RsCreateQwordField (InitializerOp, ACPI_RESTAG_TRANSLATION, CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset)); break; case 10: /* Address Length */ Descriptor->Address64.AddressLength = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, + RsCreateQwordField (InitializerOp, ACPI_RESTAG_LENGTH, CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.AddressLength)); LengthOp = InitializerOp; break; diff --git a/compiler/aslrestype2w.c b/compiler/aslrestype2w.c index 31b6b79de149..559e1ddb6f37 100644 --- a/compiler/aslrestype2w.c +++ b/compiler/aslrestype2w.c @@ -144,14 +144,14 @@ RsDoWordIoDescriptor ( case 4: /* Range Type */ RsSetFlagBits (&Descriptor->Address16.SpecificFlags, InitializerOp, 0, 3); - RsCreateBitField (InitializerOp, ACPI_RESTAG_RANGETYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.SpecificFlags), 0); + RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_RANGETYPE, + CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.SpecificFlags), 0, 2); break; case 5: /* Address Granularity */ Descriptor->Address16.Granularity = (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY, + RsCreateWordField (InitializerOp, ACPI_RESTAG_GRANULARITY, CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Granularity)); GranOp = InitializerOp; break; @@ -159,7 +159,7 @@ RsDoWordIoDescriptor ( case 6: /* Address Min */ Descriptor->Address16.Minimum = (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, + RsCreateWordField (InitializerOp, ACPI_RESTAG_MINADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum)); MinOp = InitializerOp; break; @@ -167,7 +167,7 @@ RsDoWordIoDescriptor ( case 7: /* Address Max */ Descriptor->Address16.Maximum = (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, + RsCreateWordField (InitializerOp, ACPI_RESTAG_MAXADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum)); MaxOp = InitializerOp; break; @@ -175,14 +175,14 @@ RsDoWordIoDescriptor ( case 8: /* Translation Offset */ Descriptor->Address16.TranslationOffset = (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION, + RsCreateWordField (InitializerOp, ACPI_RESTAG_TRANSLATION, CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset)); break; case 9: /* Address Length */ Descriptor->Address16.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, + RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH, CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.AddressLength)); LengthOp = InitializerOp; break; @@ -367,7 +367,7 @@ RsDoWordBusNumberDescriptor ( Descriptor->Address16.Granularity = (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY, + RsCreateWordField (InitializerOp, ACPI_RESTAG_GRANULARITY, CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Granularity)); GranOp = InitializerOp; break; @@ -376,7 +376,7 @@ RsDoWordBusNumberDescriptor ( Descriptor->Address16.Minimum = (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, + RsCreateWordField (InitializerOp, ACPI_RESTAG_MINADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum)); MinOp = InitializerOp; break; @@ -385,7 +385,7 @@ RsDoWordBusNumberDescriptor ( Descriptor->Address16.Maximum = (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, + RsCreateWordField (InitializerOp, ACPI_RESTAG_MAXADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum)); MaxOp = InitializerOp; break; @@ -394,7 +394,7 @@ RsDoWordBusNumberDescriptor ( Descriptor->Address16.TranslationOffset = (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION, + RsCreateWordField (InitializerOp, ACPI_RESTAG_TRANSLATION, CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset)); break; @@ -402,7 +402,7 @@ RsDoWordBusNumberDescriptor ( Descriptor->Address16.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, + RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH, CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.AddressLength)); LengthOp = InitializerOp; break; @@ -584,7 +584,7 @@ RsDoWordSpaceDescriptor ( Descriptor->Address16.Granularity = (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY, + RsCreateWordField (InitializerOp, ACPI_RESTAG_GRANULARITY, CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Granularity)); GranOp = InitializerOp; break; @@ -593,7 +593,7 @@ RsDoWordSpaceDescriptor ( Descriptor->Address16.Minimum = (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR, + RsCreateWordField (InitializerOp, ACPI_RESTAG_MINADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum)); MinOp = InitializerOp; break; @@ -602,7 +602,7 @@ RsDoWordSpaceDescriptor ( Descriptor->Address16.Maximum = (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR, + RsCreateWordField (InitializerOp, ACPI_RESTAG_MAXADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum)); MaxOp = InitializerOp; break; @@ -611,7 +611,7 @@ RsDoWordSpaceDescriptor ( Descriptor->Address16.TranslationOffset = (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION, + RsCreateWordField (InitializerOp, ACPI_RESTAG_TRANSLATION, CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset)); break; @@ -619,7 +619,7 @@ RsDoWordSpaceDescriptor ( Descriptor->Address16.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH, + RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH, CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.AddressLength)); LengthOp = InitializerOp; break; diff --git a/compiler/asltree.c b/compiler/asltree.c index ded426ac44c5..3874ff6e23e4 100644 --- a/compiler/asltree.c +++ b/compiler/asltree.c @@ -287,9 +287,6 @@ TrGetNodeFlagName ( case NODE_METHOD_TYPED: return ("NODE_METHOD_TYPED"); - case NODE_IS_BIT_OFFSET: - return ("NODE_IS_BIT_OFFSET"); - case NODE_COMPILE_TIME_CONST: return ("NODE_COMPILE_TIME_CONST"); diff --git a/compiler/asltypes.h b/compiler/asltypes.h index 8d9b9ed5a127..11f4afdd6a35 100644 --- a/compiler/asltypes.h +++ b/compiler/asltypes.h @@ -68,7 +68,7 @@ #define NODE_METHOD_SOME_NO_RETVAL 0x00000200 #define NODE_RESULT_NOT_USED 0x00000400 #define NODE_METHOD_TYPED 0x00000800 -#define NODE_IS_BIT_OFFSET 0x00001000 +#define NODE_UNUSED_FLAG 0x00001000 #define NODE_COMPILE_TIME_CONST 0x00002000 #define NODE_IS_TERM_ARG 0x00004000 #define NODE_WAS_ONES_OP 0x00008000 @@ -144,8 +144,10 @@ typedef struct asl_file_status } ASL_FILE_STATUS; -/* File types */ - +/* + * File types. Note: Any changes to this table must also be reflected + * in the AslFileTypeNames array. + */ typedef enum { ASL_FILE_STDOUT = 0, diff --git a/compiler/aslutils.c b/compiler/aslutils.c index 79fad1d811d3..f8309672e23c 100644 --- a/compiler/aslutils.c +++ b/compiler/aslutils.c @@ -53,11 +53,31 @@ #define _COMPONENT ACPI_COMPILER ACPI_MODULE_NAME ("aslutils") + char AslHexLookup[] = { '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' }; +/* Table below must match ASL_FILE_TYPES in asltypes.h */ + +static const char *AslFileTypeNames [ASL_NUM_FILES] = +{ + "stdout: ", + "stderr: ", + "Table Input: ", + "Binary Output:", + "Source Output:", + "Listing File: ", + "Hex Dump: ", + "Namespace: ", + "Debug File: ", + "ASM Source: ", + "C Source: ", + "ASM Include: ", + "C Include: " +}; + /* Local prototypes */ @@ -451,35 +471,40 @@ void UtDisplaySummary ( UINT32 FileId) { + UINT32 i; + if (FileId != ASL_FILE_STDOUT) { /* Compiler name and version number */ - FlPrintFile (FileId, "%s version %X%s [%s]\n", + FlPrintFile (FileId, "%s version %X%s [%s]\n\n", ASL_COMPILER_NAME, (UINT32) ACPI_CA_VERSION, ACPI_WIDTH, __DATE__); } + /* Summary of main input and output files */ + if (Gbl_FileType == ASL_INPUT_TYPE_ASCII_DATA) { FlPrintFile (FileId, - "Table Input: %s - %u lines, %u bytes, %u fields\n", + "%-14s %s - %u lines, %u bytes, %u fields\n", + "Table Input:", Gbl_Files[ASL_FILE_INPUT].Filename, Gbl_CurrentLineNumber, Gbl_InputByteCount, Gbl_InputFieldCount); if ((Gbl_ExceptionCount[ASL_ERROR] == 0) || (Gbl_IgnoreErrors)) { FlPrintFile (FileId, - "Binary Output: %s - %u bytes\n\n", + "%-14s %s - %u bytes\n", + "Binary Output:", Gbl_Files[ASL_FILE_AML_OUTPUT].Filename, Gbl_TableLength); } } else { - /* Input/Output summary */ - FlPrintFile (FileId, - "ASL Input: %s - %u lines, %u bytes, %u keywords\n", + "%-14s %s - %u lines, %u bytes, %u keywords\n", + "ASL Input:", Gbl_Files[ASL_FILE_INPUT].Filename, Gbl_CurrentLineNumber, Gbl_InputByteCount, TotalKeywords); @@ -488,16 +513,38 @@ UtDisplaySummary ( if ((Gbl_ExceptionCount[ASL_ERROR] == 0) || (Gbl_IgnoreErrors)) { FlPrintFile (FileId, - "AML Output: %s - %u bytes, %u named objects, %u executable opcodes\n\n", + "%-14s %s - %u bytes, %u named objects, %u executable opcodes\n", + "AML Output:", Gbl_Files[ASL_FILE_AML_OUTPUT].Filename, Gbl_TableLength, TotalNamedObjects, TotalExecutableOpcodes); } } + /* Display summary of any optional files */ + + for (i = ASL_FILE_SOURCE_OUTPUT; i <= ASL_MAX_FILE_TYPE; i++) + { + if (!Gbl_Files[i].Filename || !Gbl_Files[i].Handle) + { + continue; + } + + /* .SRC is a temp file unless specifically requested */ + + if ((i == ASL_FILE_SOURCE_OUTPUT) && (!Gbl_SourceOutputFlag)) + { + continue; + } + + FlPrintFile (FileId, "%14s %s - %u bytes\n", + AslFileTypeNames [i], + Gbl_Files[i].Filename, FlGetFileSize (i)); + } + /* Error summary */ FlPrintFile (FileId, - "Compilation complete. %u Errors, %u Warnings, %u Remarks", + "\nCompilation complete. %u Errors, %u Warnings, %u Remarks", Gbl_ExceptionCount[ASL_ERROR], Gbl_ExceptionCount[ASL_WARNING] + Gbl_ExceptionCount[ASL_WARNING2] + diff --git a/compiler/dtcompile.c b/compiler/dtcompile.c index 7f4a824b18cf..91c32ac2e571 100644 --- a/compiler/dtcompile.c +++ b/compiler/dtcompile.c @@ -329,7 +329,7 @@ DtCompileDataTable ( /* Validate the signature via the ACPI table list */ TableData = AcpiDmGetTableData (Signature); - if (!TableData) + if (!TableData || Gbl_CompileGeneric) { DtCompileGeneric ((void **) FieldList); goto Out; diff --git a/generate/unix/Makefile.config b/generate/unix/Makefile.config index 2eb5be23faa8..d4899c4cfaec 100644 --- a/generate/unix/Makefile.config +++ b/generate/unix/Makefile.config @@ -30,20 +30,54 @@ PROGS = acpibin acpiexec acpihelp acpinames acpisrc acpixtract iasl HOST = _CYGWIN CC = gcc -COMPILE = $(CC) -c $(CFLAGS) $(CWARNINGFLAGS) -o$@ $? +COMPILE = $(CC) -c $(CFLAGS) $(CWARNINGFLAGS) -o$@ $< # # Common defines # -ACPICA_SRC = ../../../source -ACPICA_COMMON = $(ACPICA_SRC)/common -ACPICA_CORE = $(ACPICA_SRC)/components -ACPICA_TOOLS = $(ACPICA_SRC)/tools -ACPICA_OSL = $(ACPICA_SRC)/os_specific/service_layers -ASL_COMPILER = $(ACPICA_SRC)/compiler COPYPROG = @mkdir -p ../bin; rm -f ../bin/$(PROG); cp --remove-destination $(PROG) ../bin INSTALLDIR = /usr/bin INSTALLPROG = cp --remove-destination $(PROG) $(INSTALLDIR) + +# +# Main ACPICA source directories +# +ACPICA_SRC = ../../../source +ACPICA_COMMON = $(ACPICA_SRC)/common +ACPICA_TOOLS = $(ACPICA_SRC)/tools +ACPICA_OSL = $(ACPICA_SRC)/os_specific/service_layers +ACPICA_CORE = $(ACPICA_SRC)/components +ACPICA_INCLUDE = $(ACPICA_SRC)/include +ACPICA_DEBUGGER = $(ACPICA_CORE)/debugger +ACPICA_DISASSEMBLER = $(ACPICA_CORE)/disassembler +ACPICA_DISPATCHER = $(ACPICA_CORE)/dispatcher +ACPICA_EVENTS = $(ACPICA_CORE)/events +ACPICA_EXECUTER = $(ACPICA_CORE)/executer +ACPICA_HARDWARE = $(ACPICA_CORE)/hardware +ACPICA_NAMESPACE = $(ACPICA_CORE)/namespace +ACPICA_PARSER = $(ACPICA_CORE)/parser +ACPICA_RESOURCES = $(ACPICA_CORE)/resources +ACPICA_TABLES = $(ACPICA_CORE)/tables +ACPICA_UTILITIES = $(ACPICA_CORE)/utilities + +# +# ACPICA tool and utility source directories +# +ACPIBIN = $(ACPICA_TOOLS)/acpibin +ACPIEXEC = $(ACPICA_TOOLS)/acpiexec +ACPIHELP = $(ACPICA_TOOLS)/acpihelp +ACPINAMES = $(ACPICA_TOOLS)/acpinames +ACPISRC = $(ACPICA_TOOLS)/acpisrc +ACPIXTRACT = $(ACPICA_TOOLS)/acpixtract +ASL_COMPILER = $(ACPICA_SRC)/compiler + +# +# Common ACPICA header files +# +ACPICA_HEADERS = \ + $(wildcard $(ACPICA_INCLUDE)/*.h) \ + $(wildcard $(ACPICA_INCLUDE)/platform/*.h) + # # Common compiler flags. The warning flags in addition to -Wall are not # automatically included in -Wall. @@ -51,7 +85,7 @@ INSTALLPROG = cp --remove-destination $(PROG) $(INSTALLDIR) CFLAGS += \ -D$(HOST) \ -D_GNU_SOURCE \ - -I$(ACPICA_SRC)/include + -I$(ACPICA_INCLUDE) CWARNINGFLAGS = \ -ansi \ diff --git a/generate/unix/acpibin/Makefile b/generate/unix/acpibin/Makefile index 4779cb8fe27b..57648d99faf3 100644 --- a/generate/unix/acpibin/Makefile +++ b/generate/unix/acpibin/Makefile @@ -14,13 +14,18 @@ include ../Makefile.config PROG = acpibin # -# Flags specific to acpibin +# Search paths for source files # -CFLAGS+= \ - -DACPI_BIN_APP \ - -I$(ACPICA_TOOLS)/acpibin +vpath %.c \ + $(ACPIBIN) \ + $(ACPICA_UTILITIES) \ + $(ACPICA_COMMON) \ + $(ACPICA_OSL) -OBJS = \ +HEADERS = \ + $(wildcard $(ACPIBIN)/*.h) + +OBJECTS = \ abcompare.o \ abmain.o \ utalloc.o \ @@ -38,72 +43,24 @@ OBJS = \ getopt.o # -# Root rule +# Flags specific to acpibin # -$(PROG) : $(OBJS) - $(CC) $(LDFLAGS) $(OBJS) -o $(PROG) +CFLAGS+= \ + -DACPI_BIN_APP \ + -I$(ACPIBIN) + +# +# Rules +# +$(PROG) : $(OBJECTS) + $(CC) $(LDFLAGS) $(OBJECTS) -o $(PROG) $(COPYPROG) -# -# acpibin source -# -abcompare.o : $(ACPICA_TOOLS)/acpibin/abcompare.c +%.o : %.c $(HEADERS) $(ACPICA_HEADERS) $(COMPILE) -abmain.o : $(ACPICA_TOOLS)/acpibin/abmain.c - $(COMPILE) - -# -# ACPICA core source - common -# -getopt.o : $(ACPICA_COMMON)/getopt.c - $(COMPILE) - -# -# ACPICA core source -# -utalloc.o : $(ACPICA_CORE)/utilities/utalloc.c - $(COMPILE) - -utcache.o : $(ACPICA_CORE)/utilities/utcache.c - $(COMPILE) - -utdebug.o : $(ACPICA_CORE)/utilities/utdebug.c - $(COMPILE) - -utdecode.o : $(ACPICA_CORE)/utilities/utdecode.c - $(COMPILE) - -utglobal.o : $(ACPICA_CORE)/utilities/utglobal.c - $(COMPILE) - -utlock.o : $(ACPICA_CORE)/utilities/utlock.c - $(COMPILE) - -utmath.o : $(ACPICA_CORE)/utilities/utmath.c - $(COMPILE) - -utmisc.o : $(ACPICA_CORE)/utilities/utmisc.c - $(COMPILE) - -utmutex.o : $(ACPICA_CORE)/utilities/utmutex.c - $(COMPILE) - -utstate.o : $(ACPICA_CORE)/utilities/utstate.c - $(COMPILE) - -utxferror.o : $(ACPICA_CORE)/utilities/utxferror.c - $(COMPILE) - -# -# Unix OS services layer (OSL) -# -osunixxf.o : $(ACPICA_OSL)/osunixxf.c - $(COMPILE) - - clean : - rm -f $(PROG) $(PROG).exe $(OBJS) + rm -f $(PROG) $(PROG).exe $(OBJECTS) install : $(INSTALLPROG) diff --git a/generate/unix/acpiexec/Makefile b/generate/unix/acpiexec/Makefile index 331218e4f3a2..96fe50d99cb4 100644 --- a/generate/unix/acpiexec/Makefile +++ b/generate/unix/acpiexec/Makefile @@ -16,14 +16,28 @@ include ../Makefile.config PROG = acpiexec # -# Flags specific to acpiexec utility +# Search paths for source files # -CFLAGS+= \ - -DACPI_EXEC_APP \ - -I$(ACPICA_TOOLS)/acpiexec -LDFLAGS += -lpthread -lrt +vpath %.c \ + $(ACPIEXEC) \ + $(ACPICA_DEBUGGER) \ + $(ACPICA_DISASSEMBLER) \ + $(ACPICA_DISPATCHER) \ + $(ACPICA_EVENTS) \ + $(ACPICA_EXECUTER) \ + $(ACPICA_HARDWARE) \ + $(ACPICA_NAMESPACE) \ + $(ACPICA_PARSER) \ + $(ACPICA_RESOURCES) \ + $(ACPICA_TABLES) \ + $(ACPICA_UTILITIES) \ + $(ACPICA_COMMON) \ + $(ACPICA_OSL) -OBJS = \ +HEADERS = \ + $(wildcard $(ACPIEXEC)/*.h) + +OBJECTS = \ aeexec.o \ aehandlers.o \ aemain.o \ @@ -178,483 +192,25 @@ OBJS = \ utxface.o # -# Root rule +# Flags specific to acpiexec utility # -$(PROG) : $(OBJS) - $(CC) $(LDFLAGS) $(OBJS) -o $(PROG) +CFLAGS+= \ + -DACPI_EXEC_APP \ + -I$(ACPIEXEC) +LDFLAGS += -lpthread -lrt + +# +# Rules +# +$(PROG) : $(OBJECTS) + $(CC) $(LDFLAGS) $(OBJECTS) -o $(PROG) $(COPYPROG) -# -# acpiexec source -# -aeexec.o : $(ACPICA_TOOLS)/acpiexec/aeexec.c +%.o : %.c $(HEADERS) $(ACPICA_HEADERS) $(COMPILE) -aehandlers.o : $(ACPICA_TOOLS)/acpiexec/aehandlers.c - $(COMPILE) - -aemain.o : $(ACPICA_TOOLS)/acpiexec/aemain.c - $(COMPILE) - -aetables.o : $(ACPICA_TOOLS)/acpiexec/aetables.c - $(COMPILE) - -# -# ACPICA core source - common -# -getopt.o : $(ACPICA_COMMON)/getopt.c - $(COMPILE) - -# -# ACPICA core source -# -dbcmds.o : $(ACPICA_CORE)/debugger/dbcmds.c - $(COMPILE) - -dbdisply.o : $(ACPICA_CORE)/debugger/dbdisply.c - $(COMPILE) - -dbexec.o : $(ACPICA_CORE)/debugger/dbexec.c - $(COMPILE) - -dbfileio.o : $(ACPICA_CORE)/debugger/dbfileio.c - $(COMPILE) - -dbhistry.o : $(ACPICA_CORE)/debugger/dbhistry.c - $(COMPILE) - -dbinput.o : $(ACPICA_CORE)/debugger/dbinput.c - $(COMPILE) - -dbmethod.o : $(ACPICA_CORE)/debugger/dbmethod.c - $(COMPILE) - -dbnames.o : $(ACPICA_CORE)/debugger/dbnames.c - $(COMPILE) - -dbstats.o : $(ACPICA_CORE)/debugger/dbstats.c - $(COMPILE) - -dbutils.o : $(ACPICA_CORE)/debugger/dbutils.c - $(COMPILE) - -dbxface.o : $(ACPICA_CORE)/debugger/dbxface.c - $(COMPILE) - -dmbuffer.o : $(ACPICA_CORE)/disassembler/dmbuffer.c - $(COMPILE) - -dmnames.o : $(ACPICA_CORE)/disassembler/dmnames.c - $(COMPILE) - -dmobject.o : $(ACPICA_CORE)/disassembler/dmobject.c - $(COMPILE) - -dmopcode.o : $(ACPICA_CORE)/disassembler/dmopcode.c - $(COMPILE) - -dmresrc.o : $(ACPICA_CORE)/disassembler/dmresrc.c - $(COMPILE) - -dmresrcl.o : $(ACPICA_CORE)/disassembler/dmresrcl.c - $(COMPILE) - -dmresrcs.o : $(ACPICA_CORE)/disassembler/dmresrcs.c - $(COMPILE) - -dmutils.o : $(ACPICA_CORE)/disassembler/dmutils.c - $(COMPILE) - -dmwalk.o : $(ACPICA_CORE)/disassembler/dmwalk.c - $(COMPILE) - -dsargs.o : $(ACPICA_CORE)/dispatcher/dsargs.c - $(COMPILE) - -dscontrol.o : $(ACPICA_CORE)/dispatcher/dscontrol.c - $(COMPILE) - -dsfield.o : $(ACPICA_CORE)/dispatcher/dsfield.c - $(COMPILE) - -dsinit.o : $(ACPICA_CORE)/dispatcher/dsinit.c - $(COMPILE) - -dsmethod.o : $(ACPICA_CORE)/dispatcher/dsmethod.c - $(COMPILE) - -dsmthdat.o : $(ACPICA_CORE)/dispatcher/dsmthdat.c - $(COMPILE) - -dsobject.o : $(ACPICA_CORE)/dispatcher/dsobject.c - $(COMPILE) - -dsopcode.o : $(ACPICA_CORE)/dispatcher/dsopcode.c - $(COMPILE) - -dsutils.o : $(ACPICA_CORE)/dispatcher/dsutils.c - $(COMPILE) - -dswexec.o : $(ACPICA_CORE)/dispatcher/dswexec.c - $(COMPILE) - -dswload.o : $(ACPICA_CORE)/dispatcher/dswload.c - $(COMPILE) - -dswload2.o : $(ACPICA_CORE)/dispatcher/dswload2.c - $(COMPILE) - -dswscope.o : $(ACPICA_CORE)/dispatcher/dswscope.c - $(COMPILE) - -dswstate.o : $(ACPICA_CORE)/dispatcher/dswstate.c - $(COMPILE) - -evevent.o : $(ACPICA_CORE)/events/evevent.c - $(COMPILE) - -evglock.o : $(ACPICA_CORE)/events/evglock.c - $(COMPILE) - -evgpe.o : $(ACPICA_CORE)/events/evgpe.c - $(COMPILE) - -evgpeblk.o : $(ACPICA_CORE)/events/evgpeblk.c - $(COMPILE) - -evgpeinit.o : $(ACPICA_CORE)/events/evgpeinit.c - $(COMPILE) - -evgpeutil.o : $(ACPICA_CORE)/events/evgpeutil.c - $(COMPILE) - -evmisc.o : $(ACPICA_CORE)/events/evmisc.c - $(COMPILE) - -evregion.o : $(ACPICA_CORE)/events/evregion.c - $(COMPILE) - -evrgnini.o : $(ACPICA_CORE)/events/evrgnini.c - $(COMPILE) - -evsci.o : $(ACPICA_CORE)/events/evsci.c - $(COMPILE) - -evxface.o : $(ACPICA_CORE)/events/evxface.c - $(COMPILE) - -evxfevnt.o : $(ACPICA_CORE)/events/evxfevnt.c - $(COMPILE) - -evxfgpe.o : $(ACPICA_CORE)/events/evxfgpe.c - $(COMPILE) - -evxfregn.o : $(ACPICA_CORE)/events/evxfregn.c - $(COMPILE) - -exconfig.o : $(ACPICA_CORE)/executer/exconfig.c - $(COMPILE) - -exconvrt.o : $(ACPICA_CORE)/executer/exconvrt.c - $(COMPILE) - -excreate.o : $(ACPICA_CORE)/executer/excreate.c - $(COMPILE) - -exdebug.o : $(ACPICA_CORE)/executer/exdebug.c - $(COMPILE) - -exdump.o : $(ACPICA_CORE)/executer/exdump.c - $(COMPILE) - -exfield.o : $(ACPICA_CORE)/executer/exfield.c - $(COMPILE) - -exfldio.o : $(ACPICA_CORE)/executer/exfldio.c - $(COMPILE) - -exmisc.o : $(ACPICA_CORE)/executer/exmisc.c - $(COMPILE) - -exmutex.o : $(ACPICA_CORE)/executer/exmutex.c - $(COMPILE) - -exnames.o : $(ACPICA_CORE)/executer/exnames.c - $(COMPILE) - -exoparg1.o : $(ACPICA_CORE)/executer/exoparg1.c - $(COMPILE) - -exoparg2.o : $(ACPICA_CORE)/executer/exoparg2.c - $(COMPILE) - -exoparg3.o : $(ACPICA_CORE)/executer/exoparg3.c - $(COMPILE) - -exoparg6.o : $(ACPICA_CORE)/executer/exoparg6.c - $(COMPILE) - -exprep.o : $(ACPICA_CORE)/executer/exprep.c - $(COMPILE) - -exregion.o : $(ACPICA_CORE)/executer/exregion.c - $(COMPILE) - -exresnte.o : $(ACPICA_CORE)/executer/exresnte.c - $(COMPILE) - -exresolv.o : $(ACPICA_CORE)/executer/exresolv.c - $(COMPILE) - -exresop.o : $(ACPICA_CORE)/executer/exresop.c - $(COMPILE) - -exstore.o : $(ACPICA_CORE)/executer/exstore.c - $(COMPILE) - -exstoren.o : $(ACPICA_CORE)/executer/exstoren.c - $(COMPILE) - -exstorob.o : $(ACPICA_CORE)/executer/exstorob.c - $(COMPILE) - -exsystem.o : $(ACPICA_CORE)/executer/exsystem.c - $(COMPILE) - -exutils.o : $(ACPICA_CORE)/executer/exutils.c - $(COMPILE) - -hwacpi.o : $(ACPICA_CORE)/hardware/hwacpi.c - $(COMPILE) - -hwgpe.o : $(ACPICA_CORE)/hardware/hwgpe.c - $(COMPILE) - -hwpci.o : $(ACPICA_CORE)/hardware/hwpci.c - $(COMPILE) - -hwregs.o : $(ACPICA_CORE)/hardware/hwregs.c - $(COMPILE) - -hwsleep.o : $(ACPICA_CORE)/hardware/hwsleep.c - $(COMPILE) - -hwvalid.o : $(ACPICA_CORE)/hardware/hwvalid.c - $(COMPILE) - -hwxface.o : $(ACPICA_CORE)/hardware/hwxface.c - $(COMPILE) - -nsaccess.o : $(ACPICA_CORE)/namespace/nsaccess.c - $(COMPILE) - -nsalloc.o : $(ACPICA_CORE)/namespace/nsalloc.c - $(COMPILE) - -nsdump.o : $(ACPICA_CORE)/namespace/nsdump.c - $(COMPILE) - -nsdumpdv.o : $(ACPICA_CORE)/namespace/nsdumpdv.c - $(COMPILE) - -nseval.o : $(ACPICA_CORE)/namespace/nseval.c - $(COMPILE) - -nsinit.o : $(ACPICA_CORE)/namespace/nsinit.c - $(COMPILE) - -nsload.o : $(ACPICA_CORE)/namespace/nsload.c - $(COMPILE) - -nsnames.o : $(ACPICA_CORE)/namespace/nsnames.c - $(COMPILE) - -nsobject.o : $(ACPICA_CORE)/namespace/nsobject.c - $(COMPILE) - -nsparse.o : $(ACPICA_CORE)/namespace/nsparse.c - $(COMPILE) - -nspredef.o : $(ACPICA_CORE)/namespace/nspredef.c - $(COMPILE) - -nsrepair.o : $(ACPICA_CORE)/namespace/nsrepair.c - $(COMPILE) - -nsrepair2.o : $(ACPICA_CORE)/namespace/nsrepair2.c - $(COMPILE) - -nssearch.o : $(ACPICA_CORE)/namespace/nssearch.c - $(COMPILE) - -nsutils.o : $(ACPICA_CORE)/namespace/nsutils.c - $(COMPILE) - -nswalk.o : $(ACPICA_CORE)/namespace/nswalk.c - $(COMPILE) - -nsxfeval.o : $(ACPICA_CORE)/namespace/nsxfeval.c - $(COMPILE) - -nsxfname.o : $(ACPICA_CORE)/namespace/nsxfname.c - $(COMPILE) - -nsxfobj.o : $(ACPICA_CORE)/namespace/nsxfobj.c - $(COMPILE) - -psargs.o : $(ACPICA_CORE)/parser/psargs.c - $(COMPILE) - -psloop.o : $(ACPICA_CORE)/parser/psloop.c - $(COMPILE) - -psopcode.o : $(ACPICA_CORE)/parser/psopcode.c - $(COMPILE) - -psparse.o : $(ACPICA_CORE)/parser/psparse.c - $(COMPILE) - -psscope.o : $(ACPICA_CORE)/parser/psscope.c - $(COMPILE) - -pstree.o : $(ACPICA_CORE)/parser/pstree.c - $(COMPILE) - -psutils.o : $(ACPICA_CORE)/parser/psutils.c - $(COMPILE) - -pswalk.o : $(ACPICA_CORE)/parser/pswalk.c - $(COMPILE) - -psxface.o : $(ACPICA_CORE)/parser/psxface.c - $(COMPILE) - -rsaddr.o : $(ACPICA_CORE)/resources/rsaddr.c - $(COMPILE) - -rscalc.o : $(ACPICA_CORE)/resources/rscalc.c - $(COMPILE) - -rscreate.o : $(ACPICA_CORE)/resources/rscreate.c - $(COMPILE) - -rsdump.o : $(ACPICA_CORE)/resources/rsdump.c - $(COMPILE) - -rsio.o : $(ACPICA_CORE)/resources/rsio.c - $(COMPILE) - -rsinfo.o : $(ACPICA_CORE)/resources/rsinfo.c - $(COMPILE) - -rsirq.o : $(ACPICA_CORE)/resources/rsirq.c - $(COMPILE) - -rslist.o : $(ACPICA_CORE)/resources/rslist.c - $(COMPILE) - -rsmemory.o : $(ACPICA_CORE)/resources/rsmemory.c - $(COMPILE) - -rsmisc.o : $(ACPICA_CORE)/resources/rsmisc.c - $(COMPILE) - -rsutils.o : $(ACPICA_CORE)/resources/rsutils.c - $(COMPILE) - -rsxface.o : $(ACPICA_CORE)/resources/rsxface.c - $(COMPILE) - -tbfadt.o : $(ACPICA_CORE)/tables/tbfadt.c - $(COMPILE) - -tbfind.o : $(ACPICA_CORE)/tables/tbfind.c - $(COMPILE) - -tbinstal.o : $(ACPICA_CORE)/tables/tbinstal.c - $(COMPILE) - -tbutils.o : $(ACPICA_CORE)/tables/tbutils.c - $(COMPILE) - -tbxface.o : $(ACPICA_CORE)/tables/tbxface.c - $(COMPILE) - -tbxfroot.o : $(ACPICA_CORE)/tables/tbxfroot.c - $(COMPILE) - -utalloc.o : $(ACPICA_CORE)/utilities/utalloc.c - $(COMPILE) - -utcache.o : $(ACPICA_CORE)/utilities/utcache.c - $(COMPILE) - -utcopy.o : $(ACPICA_CORE)/utilities/utcopy.c - $(COMPILE) - -utdebug.o : $(ACPICA_CORE)/utilities/utdebug.c - $(COMPILE) - -utdecode.o : $(ACPICA_CORE)/utilities/utdecode.c - $(COMPILE) - -utdelete.o : $(ACPICA_CORE)/utilities/utdelete.c - $(COMPILE) - -uteval.o : $(ACPICA_CORE)/utilities/uteval.c - $(COMPILE) - -utglobal.o : $(ACPICA_CORE)/utilities/utglobal.c - $(COMPILE) - -utids.o : $(ACPICA_CORE)/utilities/utids.c - $(COMPILE) - -utinit.o : $(ACPICA_CORE)/utilities/utinit.c - $(COMPILE) - -utlock.o : $(ACPICA_CORE)/utilities/utlock.c - $(COMPILE) - -utmath.o : $(ACPICA_CORE)/utilities/utmath.c - $(COMPILE) - -utmisc.o : $(ACPICA_CORE)/utilities/utmisc.c - $(COMPILE) - -utmutex.o : $(ACPICA_CORE)/utilities/utmutex.c - $(COMPILE) - -utobject.o : $(ACPICA_CORE)/utilities/utobject.c - $(COMPILE) - -utresrc.o : $(ACPICA_CORE)/utilities/utresrc.c - $(COMPILE) - -utstate.o : $(ACPICA_CORE)/utilities/utstate.c - $(COMPILE) - -uttrack.o : $(ACPICA_CORE)/utilities/uttrack.c - $(COMPILE) - -utosi.o : $(ACPICA_CORE)/utilities/utosi.c - $(COMPILE) - -utxferror.o : $(ACPICA_CORE)/utilities/utxferror.c - $(COMPILE) - -utxface.o : $(ACPICA_CORE)/utilities/utxface.c - $(COMPILE) - -# -# Unix OS services layer (OSL) -# -osunixxf.o : $(ACPICA_OSL)/osunixxf.c - $(COMPILE) - - clean : - rm -f $(PROG) $(PROG).exe $(OBJS) + rm -f $(PROG) $(PROG).exe $(OBJECTS) install : $(INSTALLPROG) diff --git a/generate/unix/acpihelp/Makefile b/generate/unix/acpihelp/Makefile index f6907141b386..2ce6e59d7e51 100644 --- a/generate/unix/acpihelp/Makefile +++ b/generate/unix/acpihelp/Makefile @@ -15,13 +15,16 @@ include ../Makefile.config PROG = acpihelp # -# Flags specific to acpihelp +# Search paths for source files # -CFLAGS+= \ - -DACPI_HELP_APP \ - -I$(ACPICA_TOOLS)/acpihelp +vpath %.c \ + $(ACPIHELP) \ + $(ACPICA_COMMON) -OBJS = \ +HEADERS = \ + $(wildcard $(ACPIHELP)/*.h) + +OBJECTS = \ ahamlops.o \ ahaslkey.o \ ahaslops.o \ @@ -31,42 +34,24 @@ OBJS = \ getopt.o # -# Root rule +# Flags specific to acpihelp # -$(PROG) : $(OBJS) - $(CC) $(LDFLAGS) $(OBJS) -o $(PROG) +CFLAGS+= \ + -DACPI_HELP_APP \ + -I$(ACPIHELP) + +# +# Rules +# +$(PROG) : $(OBJECTS) + $(CC) $(LDFLAGS) $(OBJECTS) -o $(PROG) $(COPYPROG) -# -# acpihelp source -# -ahamlops.o : $(ACPICA_TOOLS)/acpihelp/ahamlops.c +%.o : %.c $(HEADERS) $(ACPICA_HEADERS) $(COMPILE) -ahaslkey.o : $(ACPICA_TOOLS)/acpihelp/ahaslkey.c - $(COMPILE) - -ahaslops.o : $(ACPICA_TOOLS)/acpihelp/ahaslops.c - $(COMPILE) - -ahdecode.o : $(ACPICA_TOOLS)/acpihelp/ahdecode.c - $(COMPILE) - -ahpredef.o : $(ACPICA_TOOLS)/acpihelp/ahpredef.c - $(COMPILE) - -ahmain.o : $(ACPICA_TOOLS)/acpihelp/ahmain.c - $(COMPILE) - -# -# ACPICA core source - common -# -getopt.o : $(ACPICA_COMMON)/getopt.c - $(COMPILE) - - clean : - rm -f $(PROG) $(PROG).exe $(OBJS) + rm -f $(PROG) $(PROG).exe $(OBJECTS) install : $(INSTALLPROG) diff --git a/generate/unix/acpinames/Makefile b/generate/unix/acpinames/Makefile index 698afd25d6da..dd0757c3014f 100644 --- a/generate/unix/acpinames/Makefile +++ b/generate/unix/acpinames/Makefile @@ -16,13 +16,24 @@ include ../Makefile.config PROG = acpinames # -# Flags specific to acpinames utility +# Search paths for source files # -CFLAGS+= \ - -DACPI_NAMES_APP \ - -I$(ACPICA_TOOLS)/acpinames +vpath %.c \ + $(ACPINAMES) \ + $(ACPICA_DEBUGGER) \ + $(ACPICA_DISPATCHER) \ + $(ACPICA_EXECUTER) \ + $(ACPICA_NAMESPACE) \ + $(ACPICA_PARSER) \ + $(ACPICA_TABLES) \ + $(ACPICA_UTILITIES) \ + $(ACPICA_COMMON) \ + $(ACPICA_OSL) -OBJS = \ +HEADERS = \ + $(wildcard $(ACPINAMES)/*.h) + +OBJECTS = \ anmain.o \ anstubs.o \ antables.o \ @@ -88,216 +99,24 @@ OBJS = \ utxface.o # -# Root rule +# Flags specific to acpinames utility # -$(PROG) : $(OBJS) - $(CC) $(LDFLAGS) $(OBJS) -o $(PROG) +CFLAGS+= \ + -DACPI_NAMES_APP \ + -I$(ACPINAMES) + +# +# Rules +# +$(PROG) : $(OBJECTS) + $(CC) $(LDFLAGS) $(OBJECTS) -o $(PROG) $(COPYPROG) -# -# acpinames source -# -anmain.o : $(ACPICA_TOOLS)/acpinames/anmain.c +%.o : %.c $(HEADERS) $(ACPICA_HEADERS) $(COMPILE) -anstubs.o : $(ACPICA_TOOLS)/acpinames/anstubs.c - $(COMPILE) - -antables.o : $(ACPICA_TOOLS)/acpinames/antables.c - $(COMPILE) - -# -# ACPICA core source - common -# -getopt.o : $(ACPICA_COMMON)/getopt.c - $(COMPILE) - -# -# ACPICA core source -# -dbfileio.o : $(ACPICA_CORE)/debugger/dbfileio.c - $(COMPILE) - -dsfield.o : $(ACPICA_CORE)/dispatcher/dsfield.c - $(COMPILE) - -dsmthdat.o : $(ACPICA_CORE)/dispatcher/dsmthdat.c - $(COMPILE) - -dsobject.o : $(ACPICA_CORE)/dispatcher/dsobject.c - $(COMPILE) - -dsutils.o : $(ACPICA_CORE)/dispatcher/dsutils.c - $(COMPILE) - -dswload.o : $(ACPICA_CORE)/dispatcher/dswload.c - $(COMPILE) - -dswload2.o : $(ACPICA_CORE)/dispatcher/dswload2.c - $(COMPILE) - -dswscope.o : $(ACPICA_CORE)/dispatcher/dswscope.c - $(COMPILE) - -dswstate.o : $(ACPICA_CORE)/dispatcher/dswstate.c - $(COMPILE) - -excreate.o : $(ACPICA_CORE)/executer/excreate.c - $(COMPILE) - -exnames.o : $(ACPICA_CORE)/executer/exnames.c - $(COMPILE) - -exresnte.o : $(ACPICA_CORE)/executer/exresnte.c - $(COMPILE) - -exresolv.o : $(ACPICA_CORE)/executer/exresolv.c - $(COMPILE) - -exutils.o : $(ACPICA_CORE)/executer/exutils.c - $(COMPILE) - -nsaccess.o : $(ACPICA_CORE)/namespace/nsaccess.c - $(COMPILE) - -nsalloc.o : $(ACPICA_CORE)/namespace/nsalloc.c - $(COMPILE) - -nsdump.o : $(ACPICA_CORE)/namespace/nsdump.c - $(COMPILE) - -nsinit.o : $(ACPICA_CORE)/namespace/nsinit.c - $(COMPILE) - -nsload.o : $(ACPICA_CORE)/namespace/nsload.c - $(COMPILE) - -nsnames.o : $(ACPICA_CORE)/namespace/nsnames.c - $(COMPILE) - -nsobject.o : $(ACPICA_CORE)/namespace/nsobject.c - $(COMPILE) - -nsparse.o : $(ACPICA_CORE)/namespace/nsparse.c - $(COMPILE) - -nssearch.o : $(ACPICA_CORE)/namespace/nssearch.c - $(COMPILE) - -nsutils.o : $(ACPICA_CORE)/namespace/nsutils.c - $(COMPILE) - -nswalk.o : $(ACPICA_CORE)/namespace/nswalk.c - $(COMPILE) - -nsxfeval.o : $(ACPICA_CORE)/namespace/nsxfeval.c - $(COMPILE) - -nsxfname.o : $(ACPICA_CORE)/namespace/nsxfname.c - $(COMPILE) - -nsxfobj.o : $(ACPICA_CORE)/namespace/nsxfobj.c - $(COMPILE) - -psargs.o : $(ACPICA_CORE)/parser/psargs.c - $(COMPILE) - -psloop.o : $(ACPICA_CORE)/parser/psloop.c - $(COMPILE) - -psopcode.o : $(ACPICA_CORE)/parser/psopcode.c - $(COMPILE) - -psparse.o : $(ACPICA_CORE)/parser/psparse.c - $(COMPILE) - -psscope.o : $(ACPICA_CORE)/parser/psscope.c - $(COMPILE) - -pstree.o : $(ACPICA_CORE)/parser/pstree.c - $(COMPILE) - -psutils.o : $(ACPICA_CORE)/parser/psutils.c - $(COMPILE) - -pswalk.o : $(ACPICA_CORE)/parser/pswalk.c - $(COMPILE) - -psxface.o : $(ACPICA_CORE)/parser/psxface.c - $(COMPILE) - -tbfadt.o : $(ACPICA_CORE)/tables/tbfadt.c - $(COMPILE) - -tbfind.o : $(ACPICA_CORE)/tables/tbfind.c - $(COMPILE) - -tbinstal.o : $(ACPICA_CORE)/tables/tbinstal.c - $(COMPILE) - -tbutils.o : $(ACPICA_CORE)/tables/tbutils.c - $(COMPILE) - -tbxface.o : $(ACPICA_CORE)/tables/tbxface.c - $(COMPILE) - -tbxfroot.o : $(ACPICA_CORE)/tables/tbxfroot.c - $(COMPILE) - -utalloc.o : $(ACPICA_CORE)/utilities/utalloc.c - $(COMPILE) - -utcache.o : $(ACPICA_CORE)/utilities/utcache.c - $(COMPILE) - -utdebug.o : $(ACPICA_CORE)/utilities/utdebug.c - $(COMPILE) - -utdecode.o : $(ACPICA_CORE)/utilities/utdecode.c - $(COMPILE) - -utdelete.o : $(ACPICA_CORE)/utilities/utdelete.c - $(COMPILE) - -utglobal.o : $(ACPICA_CORE)/utilities/utglobal.c - $(COMPILE) - -utlock.o : $(ACPICA_CORE)/utilities/utlock.c - $(COMPILE) - -utmath.o : $(ACPICA_CORE)/utilities/utmath.c - $(COMPILE) - -utmisc.o : $(ACPICA_CORE)/utilities/utmisc.c - $(COMPILE) - -utmutex.o : $(ACPICA_CORE)/utilities/utmutex.c - $(COMPILE) - -utobject.o : $(ACPICA_CORE)/utilities/utobject.c - $(COMPILE) - -utstate.o : $(ACPICA_CORE)/utilities/utstate.c - $(COMPILE) - -utosi.o : $(ACPICA_CORE)/utilities/utosi.c - $(COMPILE) - -utxferror.o : $(ACPICA_CORE)/utilities/utxferror.c - $(COMPILE) - -utxface.o : $(ACPICA_CORE)/utilities/utxface.c - $(COMPILE) - -# -# Unix OS services layer (OSL) -# -osunixxf.o : $(ACPICA_OSL)/osunixxf.c - $(COMPILE) - - clean : - rm -f $(PROG) $(PROG).exe $(OBJS) + rm -f $(PROG) $(PROG).exe $(OBJECTS) install : $(INSTALLPROG) diff --git a/generate/unix/acpisrc/Makefile b/generate/unix/acpisrc/Makefile index 92325b050417..22d919723216 100644 --- a/generate/unix/acpisrc/Makefile +++ b/generate/unix/acpisrc/Makefile @@ -14,69 +14,46 @@ include ../Makefile.config PROG = acpisrc # -# Flags specific to acpisrc +# Search path for source files and individual source files +# +vpath %.c \ + $(ACPISRC) \ + $(ACPICA_COMMON) \ + $(ACPICA_OSL) + +HEADERS = \ + $(wildcard $(ACPISRC)/*.h) + +OBJECTS = \ + ascase.o \ + asconvrt.o \ + asfile.o \ + asmain.o \ + asremove.o \ + astable.o \ + asutils.o \ + osunixdir.o \ + getopt.o + +# +# Compile flags specific to acpisrc # CFLAGS+= \ -DACPI_SRC_APP \ - -I$(ACPICA_TOOLS)/acpisrc - -OBJS = \ - ascase.o \ - asconvrt.o \ - asfile.o \ - asmain.o \ - asremove.o \ - astable.o \ - asutils.o \ - getopt.o \ - osunixdir.o + -I$(ACPISRC) # -# Root rule +# Rules # -$(PROG) : $(OBJS) - $(CC) $(LDFLAGS) $(OBJS) -o $(PROG) +$(PROG) : $(OBJECTS) + $(CC) $(LDFLAGS) $(OBJECTS) -o $(PROG) $(COPYPROG) -# -# acpisrc source -# -ascase.o : $(ACPICA_TOOLS)/acpisrc/ascase.c +%.o : %.c $(HEADERS) $(ACPICA_HEADERS) $(COMPILE) -asconvrt.o : $(ACPICA_TOOLS)/acpisrc/asconvrt.c - $(COMPILE) - -asfile.o : $(ACPICA_TOOLS)/acpisrc/asfile.c - $(COMPILE) - -asmain.o : $(ACPICA_TOOLS)/acpisrc/asmain.c - $(COMPILE) - -asremove.o : $(ACPICA_TOOLS)/acpisrc/asremove.c - $(COMPILE) - -astable.o : $(ACPICA_TOOLS)/acpisrc/astable.c - $(COMPILE) - -asutils.o : $(ACPICA_TOOLS)/acpisrc/asutils.c - $(COMPILE) - -# -# ACPICA core source - common -# -getopt.o : $(ACPICA_COMMON)/getopt.c - $(COMPILE) - -# -# Unix OS services layer (OSL) -# -osunixdir.o : $(ACPICA_OSL)/osunixdir.c - $(COMPILE) - - clean : - rm -f $(PROG) $(PROG).exe $(OBJS) + rm -f $(PROG) $(PROG).exe $(OBJECTS) install : $(INSTALLPROG) diff --git a/generate/unix/acpixtract/Makefile b/generate/unix/acpixtract/Makefile index f63b45ee293e..2a734fd2c34a 100644 --- a/generate/unix/acpixtract/Makefile +++ b/generate/unix/acpixtract/Makefile @@ -13,24 +13,39 @@ include ../Makefile.config PROG = acpixtract -OBJS = \ - acpixtract.o +# +# Search paths for source files +# +vpath %.c \ + $(ACPIXTRACT) \ + $(ACPICA_COMMON) + +HEADERS = \ + $(wildcard $(ACPIXTRACT)/*.h) + +OBJECTS = \ + acpixtract.o \ + axmain.o \ + getopt.o # -# Root rule +# Flags specific to acpixtract # -$(PROG) : $(OBJS) - $(CC) $(LDFLAGS) $(OBJS) -o $(PROG) +CFLAGS+= \ + -DACPI_XTRACT_APP \ # -# acpixtract source +# Rules # -acpixtract.o : $(ACPICA_TOOLS)/acpixtract/acpixtract.c +$(PROG) : $(OBJECTS) + $(CC) $(LDFLAGS) $(OBJECTS) -o $(PROG) + $(COPYPROG) + +%.o : %.c $(HEADERS) $(ACPICA_HEADERS) $(COMPILE) - clean : - rm -f $(PROG) $(PROG).exe + rm -f $(PROG) $(PROG).exe $(OBJECTS) install : $(INSTALLPROG) diff --git a/generate/unix/iasl/Makefile b/generate/unix/iasl/Makefile index 4d20dbcae1df..e03f296aa645 100644 --- a/generate/unix/iasl/Makefile +++ b/generate/unix/iasl/Makefile @@ -14,14 +14,31 @@ include ../Makefile.config PROG = iasl # -# Flags specific to iASL compiler +# Search paths for source files # -CFLAGS+= \ - -DACPI_ASL_COMPILER \ - -I$(ASL_COMPILER) \ - -I. +vpath %.c \ + $(ASL_COMPILER) \ + $(ACPICA_DEBUGGER) \ + $(ACPICA_DISASSEMBLER) \ + $(ACPICA_DISPATCHER) \ + $(ACPICA_EXECUTER) \ + $(ACPICA_NAMESPACE) \ + $(ACPICA_PARSER) \ + $(ACPICA_TABLES) \ + $(ACPICA_UTILITIES) \ + $(ACPICA_COMMON) \ + $(ACPICA_OSL) -OBJS = \ +HEADERS = \ + $(wildcard $(ASL_COMPILER)/*.h) \ + aslcompiler.y.h \ + dtparser.y.h + +OBJECTS = \ + aslcompilerlex.o \ + aslcompilerparse.o \ + dtparserlex.o \ + dtparserparse.o \ adfile.o \ adisasm.o \ adwalk.o \ @@ -29,8 +46,6 @@ OBJS = \ aslbtypes.o \ aslcodegen.o \ aslcompile.o \ - aslcompilerlex.o \ - aslcompilerparse.o \ aslerror.o \ aslfiles.o \ aslfold.o \ @@ -63,8 +78,6 @@ OBJS = \ dtexpress.o \ dtfield.o \ dtio.o \ - dtparserlex.o \ - dtparserparse.o \ dtsubtable.o \ dttable.o \ dttemplate.o \ @@ -164,16 +177,26 @@ INTERMEDIATES = \ dtparserparse.c MISC = \ + aslcompilerparse.h \ aslcompiler.y.h \ aslcompilerparse.output \ + dtparserparse.h \ dtparser.y.h \ dtparserparse.output +# +# Flags specific to iASL compiler +# +CFLAGS+= \ + -DACPI_ASL_COMPILER \ + -I$(ASL_COMPILER) \ + -I. + # # Root rule # -$(PROG) : $(INTERMEDIATES) $(OBJS) - $(CC) $(LDFLAGS) $(OBJS) -o $(PROG) +$(PROG) : $(INTERMEDIATES) $(MISC) $(OBJECTS) + $(CC) $(LDFLAGS) $(OBJECTS) -o $(PROG) $(COPYPROG) # @@ -182,16 +205,25 @@ $(PROG) : $(INTERMEDIATES) $(OBJS) aslcompilerlex.c : $(ASL_COMPILER)/aslcompiler.l ${LEX} ${LFLAGS} -PAslCompiler -o$@ $? -aslcompilerparse.c : $(ASL_COMPILER)/aslcompiler.y +aslcompilerparse.c aslcompilerparse.h : $(ASL_COMPILER)/aslcompiler.y ${YACC} ${YFLAGS} -pAslCompiler -o$@ $? - @mv -f aslcompilerparse.h aslcompiler.y.h dtparserlex.c : $(ASL_COMPILER)/dtparser.l ${LEX} ${LFLAGS} -PDtParser -o$@ $? -dtparserparse.c : $(ASL_COMPILER)/dtparser.y +dtparserparse.c dtparserparse.h : $(ASL_COMPILER)/dtparser.y ${YACC} ${YFLAGS} -pDtParser -o$@ $? - @mv -f dtparserparse.h dtparser.y.h + +# Rename headers produced by bison/yacc + +dtparser.y.h: dtparserparse.h + @echo Copy intermediate file: + @cp -f -v dtparserparse.h dtparser.y.h + +aslcompiler.y.h : aslcompilerparse.h + @echo Copy intermediate file: + @cp -f -v aslcompilerparse.h aslcompiler.y.h + # # Parsers and Lexers - final object files @@ -211,414 +243,12 @@ dtparserlex.o : dtparserlex.c dtparserparse.o : dtparserparse.c $(CC) -c $(CFLAGS) -Wall -Werror -o$@ $? -# -# Compiler source -# -aslanalyze.o : $(ASL_COMPILER)/aslanalyze.c - $(COMPILE) - -aslbtypes.o : $(ASL_COMPILER)/aslbtypes.c - $(COMPILE) - -aslcodegen.o : $(ASL_COMPILER)/aslcodegen.c - $(COMPILE) - -aslcompile.o : $(ASL_COMPILER)/aslcompile.c - $(COMPILE) - -aslerror.o : $(ASL_COMPILER)/aslerror.c - $(COMPILE) - -aslfiles.o : $(ASL_COMPILER)/aslfiles.c - $(COMPILE) - -aslfold.o : $(ASL_COMPILER)/aslfold.c - $(COMPILE) - -asllength.o : $(ASL_COMPILER)/asllength.c - $(COMPILE) - -asllisting.o : $(ASL_COMPILER)/asllisting.c - $(COMPILE) - -aslload.o : $(ASL_COMPILER)/aslload.c - $(COMPILE) - -asllookup.o : $(ASL_COMPILER)/asllookup.c - $(COMPILE) - -aslmain.o : $(ASL_COMPILER)/aslmain.c - $(COMPILE) - -aslmap.o : $(ASL_COMPILER)/aslmap.c - $(COMPILE) - -aslopcodes.o : $(ASL_COMPILER)/aslopcodes.c - $(COMPILE) - -asloperands.o : $(ASL_COMPILER)/asloperands.c - $(COMPILE) - -aslopt.o : $(ASL_COMPILER)/aslopt.c - $(COMPILE) - -aslpredef.o : $(ASL_COMPILER)/aslpredef.c - $(COMPILE) - -aslresource.o : $(ASL_COMPILER)/aslresource.c - $(COMPILE) - -aslrestype1.o : $(ASL_COMPILER)/aslrestype1.c - $(COMPILE) - -aslrestype1i.o : $(ASL_COMPILER)/aslrestype1i.c - $(COMPILE) - -aslrestype2.o : $(ASL_COMPILER)/aslrestype2.c - $(COMPILE) - -aslrestype2d.o : $(ASL_COMPILER)/aslrestype2d.c - $(COMPILE) - -aslrestype2e.o : $(ASL_COMPILER)/aslrestype2e.c - $(COMPILE) - -aslrestype2q.o : $(ASL_COMPILER)/aslrestype2q.c - $(COMPILE) - -aslrestype2w.o : $(ASL_COMPILER)/aslrestype2w.c - $(COMPILE) - -aslstartup.o : $(ASL_COMPILER)/aslstartup.c - $(COMPILE) - -aslstubs.o : $(ASL_COMPILER)/aslstubs.c - $(COMPILE) - -asltransform.o : $(ASL_COMPILER)/asltransform.c - $(COMPILE) - -asltree.o : $(ASL_COMPILER)/asltree.c - $(COMPILE) - -aslutils.o : $(ASL_COMPILER)/aslutils.c - $(COMPILE) - -asluuid.o : $(ASL_COMPILER)/asluuid.c - $(COMPILE) - -aslwalks.o : $(ASL_COMPILER)/aslwalks.c - $(COMPILE) - -# -# Data Table Compiler -# -dtcompile.o : $(ASL_COMPILER)/dtcompile.c - $(COMPILE) - -dtexpress.o : $(ASL_COMPILER)/dtexpress.c - $(COMPILE) - -dtfield.o : $(ASL_COMPILER)/dtfield.c - $(COMPILE) - -dtio.o : $(ASL_COMPILER)/dtio.c - $(COMPILE) - -dtsubtable.o : $(ASL_COMPILER)/dtsubtable.c - $(COMPILE) - -dttable.o : $(ASL_COMPILER)/dttable.c - $(COMPILE) - -dttemplate.o : $(ASL_COMPILER)/dttemplate.c - $(COMPILE) - -dtutils.o : $(ASL_COMPILER)/dtutils.c - $(COMPILE) - -# -# ACPICA core source - common -# -adfile.o : $(ACPICA_COMMON)/adfile.c - $(COMPILE) - -adisasm.o : $(ACPICA_COMMON)/adisasm.c - $(COMPILE) - -adwalk.o : $(ACPICA_COMMON)/adwalk.c - $(COMPILE) - -dmextern.o : $(ACPICA_COMMON)/dmextern.c - $(COMPILE) - -dmrestag.o : $(ACPICA_COMMON)/dmrestag.c - $(COMPILE) - -dmtable.o : $(ACPICA_COMMON)/dmtable.c - $(COMPILE) - -dmtbdump.o : $(ACPICA_COMMON)/dmtbdump.c - $(COMPILE) - -dmtbinfo.o : $(ACPICA_COMMON)/dmtbinfo.c - $(COMPILE) - -getopt.o : $(ACPICA_COMMON)/getopt.c - $(COMPILE) - -# -# ACPICA core source -# -dbfileio.o : $(ACPICA_CORE)/debugger/dbfileio.c - $(COMPILE) - -dmbuffer.o : $(ACPICA_CORE)/disassembler/dmbuffer.c - $(COMPILE) - -dmnames.o : $(ACPICA_CORE)/disassembler/dmnames.c - $(COMPILE) - -dmobject.o : $(ACPICA_CORE)/disassembler/dmobject.c - $(COMPILE) - -dmopcode.o : $(ACPICA_CORE)/disassembler/dmopcode.c - $(COMPILE) - -dmresrc.o : $(ACPICA_CORE)/disassembler/dmresrc.c - $(COMPILE) - -dmresrcl.o : $(ACPICA_CORE)/disassembler/dmresrcl.c - $(COMPILE) - -dmresrcs.o : $(ACPICA_CORE)/disassembler/dmresrcs.c - $(COMPILE) - -dmutils.o : $(ACPICA_CORE)/disassembler/dmutils.c - $(COMPILE) - -dmwalk.o : $(ACPICA_CORE)/disassembler/dmwalk.c - $(COMPILE) - -dsargs.o : $(ACPICA_CORE)/dispatcher/dsargs.c - $(COMPILE) - -dscontrol.o : $(ACPICA_CORE)/dispatcher/dscontrol.c - $(COMPILE) - -dsfield.o : $(ACPICA_CORE)/dispatcher/dsfield.c - $(COMPILE) - -dsobject.o : $(ACPICA_CORE)/dispatcher/dsobject.c - $(COMPILE) - -dsopcode.o : $(ACPICA_CORE)/dispatcher/dsopcode.c - $(COMPILE) - -dsutils.o : $(ACPICA_CORE)/dispatcher/dsutils.c - $(COMPILE) -dswexec.o : $(ACPICA_CORE)/dispatcher/dswexec.c +%.o : %.c $(HEADERS) $(ACPICA_HEADERS) $(COMPILE) -dswload.o : $(ACPICA_CORE)/dispatcher/dswload.c - $(COMPILE) - -dswload2.o : $(ACPICA_CORE)/dispatcher/dswload2.c - $(COMPILE) - -dswscope.o : $(ACPICA_CORE)/dispatcher/dswscope.c - $(COMPILE) - -dswstate.o : $(ACPICA_CORE)/dispatcher/dswstate.c - $(COMPILE) - -exconvrt.o : $(ACPICA_CORE)/executer/exconvrt.c - $(COMPILE) - -excreate.o : $(ACPICA_CORE)/executer/excreate.c - $(COMPILE) - -exdump.o : $(ACPICA_CORE)/executer/exdump.c - $(COMPILE) - -exmisc.o : $(ACPICA_CORE)/executer/exmisc.c - $(COMPILE) - -exmutex.o : $(ACPICA_CORE)/executer/exmutex.c - $(COMPILE) - -exnames.o : $(ACPICA_CORE)/executer/exnames.c - $(COMPILE) - -exoparg1.o : $(ACPICA_CORE)/executer/exoparg1.c - $(COMPILE) - -exoparg2.o : $(ACPICA_CORE)/executer/exoparg2.c - $(COMPILE) - -exoparg3.o : $(ACPICA_CORE)/executer/exoparg3.c - $(COMPILE) - -exoparg6.o : $(ACPICA_CORE)/executer/exoparg6.c - $(COMPILE) - -exprep.o : $(ACPICA_CORE)/executer/exprep.c - $(COMPILE) - -exregion.o : $(ACPICA_CORE)/executer/exregion.c - $(COMPILE) - -exresnte.o : $(ACPICA_CORE)/executer/exresnte.c - $(COMPILE) - -exresolv.o : $(ACPICA_CORE)/executer/exresolv.c - $(COMPILE) - -exresop.o : $(ACPICA_CORE)/executer/exresop.c - $(COMPILE) - -exstore.o : $(ACPICA_CORE)/executer/exstore.c - $(COMPILE) - -exstoren.o : $(ACPICA_CORE)/executer/exstoren.c - $(COMPILE) - -exstorob.o : $(ACPICA_CORE)/executer/exstorob.c - $(COMPILE) - -exsystem.o : $(ACPICA_CORE)/executer/exsystem.c - $(COMPILE) - -exutils.o : $(ACPICA_CORE)/executer/exutils.c - $(COMPILE) - -nsaccess.o : $(ACPICA_CORE)/namespace/nsaccess.c - $(COMPILE) - -nsalloc.o : $(ACPICA_CORE)/namespace/nsalloc.c - $(COMPILE) - -nsdump.o : $(ACPICA_CORE)/namespace/nsdump.c - $(COMPILE) - -nsnames.o : $(ACPICA_CORE)/namespace/nsnames.c - $(COMPILE) - -nsobject.o : $(ACPICA_CORE)/namespace/nsobject.c - $(COMPILE) - -nsparse.o : $(ACPICA_CORE)/namespace/nsparse.c - $(COMPILE) - -nssearch.o : $(ACPICA_CORE)/namespace/nssearch.c - $(COMPILE) - -nsutils.o : $(ACPICA_CORE)/namespace/nsutils.c - $(COMPILE) - -nswalk.o : $(ACPICA_CORE)/namespace/nswalk.c - $(COMPILE) - -nsxfobj.o : $(ACPICA_CORE)/namespace/nsxfobj.c - $(COMPILE) - -psargs.o : $(ACPICA_CORE)/parser/psargs.c - $(COMPILE) - -psloop.o : $(ACPICA_CORE)/parser/psloop.c - $(COMPILE) - -psopcode.o : $(ACPICA_CORE)/parser/psopcode.c - $(COMPILE) - -psparse.o : $(ACPICA_CORE)/parser/psparse.c - $(COMPILE) - -psscope.o : $(ACPICA_CORE)/parser/psscope.c - $(COMPILE) - -pstree.o : $(ACPICA_CORE)/parser/pstree.c - $(COMPILE) - -psutils.o : $(ACPICA_CORE)/parser/psutils.c - $(COMPILE) - -pswalk.o : $(ACPICA_CORE)/parser/pswalk.c - $(COMPILE) - -tbfadt.o : $(ACPICA_CORE)/tables/tbfadt.c - $(COMPILE) - -tbinstal.o : $(ACPICA_CORE)/tables/tbinstal.c - $(COMPILE) - -tbutils.o : $(ACPICA_CORE)/tables/tbutils.c - $(COMPILE) - -tbxface.o : $(ACPICA_CORE)/tables/tbxface.c - $(COMPILE) - -utalloc.o : $(ACPICA_CORE)/utilities/utalloc.c - $(COMPILE) - -utcache.o : $(ACPICA_CORE)/utilities/utcache.c - $(COMPILE) - -utcopy.o : $(ACPICA_CORE)/utilities/utcopy.c - $(COMPILE) - -utdebug.o : $(ACPICA_CORE)/utilities/utdebug.c - $(COMPILE) - -utdecode.o : $(ACPICA_CORE)/utilities/utdecode.c - $(COMPILE) - -utdelete.o : $(ACPICA_CORE)/utilities/utdelete.c - $(COMPILE) - -utglobal.o : $(ACPICA_CORE)/utilities/utglobal.c - $(COMPILE) - -utinit.o : $(ACPICA_CORE)/utilities/utinit.c - $(COMPILE) - -utlock.o : $(ACPICA_CORE)/utilities/utlock.c - $(COMPILE) - -utmath.o : $(ACPICA_CORE)/utilities/utmath.c - $(COMPILE) - -utmisc.o : $(ACPICA_CORE)/utilities/utmisc.c - $(COMPILE) - -utmutex.o : $(ACPICA_CORE)/utilities/utmutex.c - $(COMPILE) - -utobject.o : $(ACPICA_CORE)/utilities/utobject.c - $(COMPILE) - -utresrc.o : $(ACPICA_CORE)/utilities/utresrc.c - $(COMPILE) - -utstate.o : $(ACPICA_CORE)/utilities/utstate.c - $(COMPILE) - -utxferror.o : $(ACPICA_CORE)/utilities/utxferror.c - $(COMPILE) - -utxface.o : $(ACPICA_CORE)/utilities/utxface.c - $(COMPILE) - -# -# Unix OS services layer (OSL) -# -osunixxf.o : $(ACPICA_OSL)/osunixxf.c - $(COMPILE) - - clean : - rm -f $(PROG) $(PROG).exe $(OBJS) $(INTERMEDIATES) $(MISC) + rm -f $(PROG) $(PROG).exe $(OBJECTS) $(INTERMEDIATES) $(MISC) install : $(INSTALLPROG) diff --git a/include/acapps.h b/include/acapps.h index 2d3f84186ee8..03098e42277a 100644 --- a/include/acapps.h +++ b/include/acapps.h @@ -81,6 +81,15 @@ Prefix, ACPICA_COPYRIGHT, \ Prefix +/* Macros for usage messages */ + +#define ACPI_USAGE_HEADER(Usage) \ + printf ("Usage: %s\nOptions:\n", Usage); + +#define ACPI_OPTION(Name, Description) \ + printf (" %-18s%s\n", Name, Description); + + #define FILE_SUFFIX_DISASSEMBLY "dsl" #define ACPI_TABLE_FILE_SUFFIX ".dat" diff --git a/include/acconfig.h b/include/acconfig.h index 7a2107aa7699..d484e483410e 100644 --- a/include/acconfig.h +++ b/include/acconfig.h @@ -123,7 +123,7 @@ /* Maximum sleep allowed via Sleep() operator */ -#define ACPI_MAX_SLEEP 20000 /* Two seconds */ +#define ACPI_MAX_SLEEP 2000 /* 2000 millisec == two seconds */ /****************************************************************************** diff --git a/include/aclocal.h b/include/aclocal.h index 385a88ff4ec5..436c493472fa 100644 --- a/include/aclocal.h +++ b/include/aclocal.h @@ -213,7 +213,6 @@ typedef struct acpi_namespace_node #define ANOBJ_IS_EXTERNAL 0x08 /* iASL only: This object created via External() */ #define ANOBJ_METHOD_NO_RETVAL 0x10 /* iASL only: Method has no return value */ #define ANOBJ_METHOD_SOME_NO_RETVAL 0x20 /* iASL only: Method has at least one return value */ -#define ANOBJ_IS_BIT_OFFSET 0x40 /* iASL only: Reference is a bit offset */ #define ANOBJ_IS_REFERENCED 0x80 /* iASL only: Object was referenced */ @@ -775,6 +774,17 @@ typedef struct acpi_opcode_info } ACPI_OPCODE_INFO; +/* Structure for Resource Tag information */ + +typedef struct acpi_tag_info +{ + UINT32 BitOffset; + UINT32 BitLength; + +} ACPI_TAG_INFO; + +/* Value associated with the parse object */ + typedef union acpi_parse_value { UINT64 Integer; /* Integer constant (Up to 64 bits) */ @@ -783,6 +793,7 @@ typedef union acpi_parse_value UINT8 *Buffer; /* buffer or string */ char *Name; /* NULL terminated string */ union acpi_parse_object *Arg; /* arguments and contained ops */ + ACPI_TAG_INFO Tag; /* Resource descriptor tag info */ } ACPI_PARSE_VALUE; diff --git a/include/acpixf.h b/include/acpixf.h index 8cb1753b5338..7e246bdb3754 100644 --- a/include/acpixf.h +++ b/include/acpixf.h @@ -48,7 +48,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20110623 +#define ACPI_CA_VERSION 0x20110922 #include "actypes.h" #include "actbl.h" diff --git a/include/platform/acenv.h b/include/platform/acenv.h index e59d5846195b..6efe5a051edc 100644 --- a/include/platform/acenv.h +++ b/include/platform/acenv.h @@ -101,7 +101,8 @@ * no debug output. */ #if (defined ACPI_BIN_APP) || \ - (defined ACPI_SRC_APP) + (defined ACPI_SRC_APP) || \ + (defined ACPI_XTRACT_APP) #define ACPI_APPLICATION #define ACPI_SINGLE_THREADED #endif diff --git a/tools/acpibin/Makefile b/tools/acpibin/Makefile index d1aa7d38715c..f784a20e474f 100644 --- a/tools/acpibin/Makefile +++ b/tools/acpibin/Makefile @@ -19,39 +19,37 @@ PROG = acpibin HOST = _LINUX NOMAN = YES -COMPILE = $(CC) -c $(CFLAGS) $(CWARNINGFLAGS) -o$@ $? +COMPILE = $(CC) -c $(CFLAGS) $(CWARNINGFLAGS) -o$@ $< ACPICA_COMPONENTS = -ACPICA_SRC = ../.. -ACPICA_COMMON = $(ACPICA_SRC)/common -ACPICA_CORE = $(ACPICA_SRC)$(ACPICA_COMPONENTS) -ACPICA_TOOLS = $(ACPICA_SRC)/tools -ACPICA_OSL = $(ACPICA_SRC)/os_specific/service_layers -INSTALLDIR = /usr/bin -INSTALLPROG = cp --remove-destination $(PROG) $(INSTALLDIR) +ACPICA_SRC = ../.. +ACPICA_INCLUDE = $(ACPICA_SRC)/include +ACPICA_COMMON = $(ACPICA_SRC)/common +ACPICA_CORE = $(ACPICA_SRC)$(ACPICA_COMPONENTS) +ACPICA_TOOLS = $(ACPICA_SRC)/tools +ACPICA_OSL = $(ACPICA_SRC)/os_specific/service_layers +ACPICA_UTILITIES = $(ACPICA_CORE)/utilities +ACPIBIN = $(ACPICA_TOOLS)/acpibin +INSTALLDIR = /usr/bin +INSTALLPROG = cp --remove-destination $(PROG) $(INSTALLDIR) -CFLAGS+= \ - -D$(HOST) \ - -D_GNU_SOURCE \ - -DACPI_BIN_APP \ - -I$(ACPICA_SRC)/include +ACPICA_HEADERS = \ + $(wildcard $(ACPICA_INCLUDE)/*.h) \ + $(wildcard $(ACPICA_INCLUDE)/platform/*.h) -CWARNINGFLAGS = \ - -ansi \ - -Wall \ - -Wbad-function-cast \ - -Wdeclaration-after-statement \ - -Werror \ - -Wformat=2 \ - -Wmissing-declarations \ - -Wmissing-prototypes \ - -Wstrict-aliasing=0 \ - -Wstrict-prototypes \ - -Wswitch-default \ - -Wpointer-arith \ - -Wundef +# +# Search paths for source files +# +vpath %.c \ + $(ACPIBIN) \ + $(ACPICA_UTILITIES) \ + $(ACPICA_COMMON) \ + $(ACPICA_OSL) -OBJS = \ +HEADERS = \ + $(wildcard $(ACPIBIN)/*.h) + +OBJECTS = \ abcompare.o \ abmain.o \ utalloc.o \ @@ -68,72 +66,56 @@ OBJS = \ osunixxf.o \ getopt.o -# -# Root rule -# -$(PROG) : $(OBJS) - $(CC) $(LDFLAGS) $(OBJS) -o $(PROG) +CFLAGS+= \ + -D$(HOST) \ + -D_GNU_SOURCE \ + -DACPI_BIN_APP \ + -I$(ACPICA_INCLUDE) + +CWARNINGFLAGS = \ + -ansi \ + -Wall \ + -Wbad-function-cast \ + -Wdeclaration-after-statement \ + -Werror \ + -Wformat=2 \ + -Wmissing-declarations \ + -Wmissing-prototypes \ + -Wstrict-aliasing=0 \ + -Wstrict-prototypes \ + -Wswitch-default \ + -Wpointer-arith \ + -Wundef # -# acpibin source +# gcc 4+ flags # -abcompare.o : $(ACPICA_TOOLS)/acpibin/abcompare.c - $(COMPILE) - -abmain.o : $(ACPICA_TOOLS)/acpibin/abmain.c - $(COMPILE) +CWARNINGFLAGS += \ + -Waddress \ + -Waggregate-return \ + -Wchar-subscripts \ + -Wempty-body \ + -Wlogical-op \ + -Wmissing-declarations \ + -Wmissing-field-initializers \ + -Wmissing-parameter-type \ + -Wnested-externs \ + -Wold-style-declaration \ + -Wold-style-definition \ + -Wredundant-decls \ + -Wtype-limits # -# ACPICA core source - common +# Rules # -getopt.o : $(ACPICA_COMMON)/getopt.c - $(COMPILE) +$(PROG) : $(OBJECTS) + $(CC) $(LDFLAGS) $(OBJECTS) -o $(PROG) -# -# ACPICA core source -# -utalloc.o : $(ACPICA_CORE)/utilities/utalloc.c +%.o : %.c $(HEADERS) $(ACPICA_HEADERS) $(COMPILE) -utcache.o : $(ACPICA_CORE)/utilities/utcache.c - $(COMPILE) - -utdebug.o : $(ACPICA_CORE)/utilities/utdebug.c - $(COMPILE) - -utdecode.o : $(ACPICA_CORE)/utilities/utdecode.c - $(COMPILE) - -utglobal.o : $(ACPICA_CORE)/utilities/utglobal.c - $(COMPILE) - -utlock.o : $(ACPICA_CORE)/utilities/utlock.c - $(COMPILE) - -utmath.o : $(ACPICA_CORE)/utilities/utmath.c - $(COMPILE) - -utmisc.o : $(ACPICA_CORE)/utilities/utmisc.c - $(COMPILE) - -utmutex.o : $(ACPICA_CORE)/utilities/utmutex.c - $(COMPILE) - -utstate.o : $(ACPICA_CORE)/utilities/utstate.c - $(COMPILE) - -utxferror.o : $(ACPICA_CORE)/utilities/utxferror.c - $(COMPILE) - -# -# Unix OS services layer (OSL) -# -osunixxf.o : $(ACPICA_OSL)/osunixxf.c - $(COMPILE) - - clean : - rm -f $(PROG) $(PROG) $(OBJS) + rm -f $(PROG) $(PROG).exe $(OBJECTS) install : $(INSTALLPROG) diff --git a/tools/acpibin/abmain.c b/tools/acpibin/abmain.c index 3d84cc7c7681..e955a086a2b3 100644 --- a/tools/acpibin/abmain.c +++ b/tools/acpibin/abmain.c @@ -72,18 +72,14 @@ AbDisplayUsage ( printf ("Option requires %u arguments\n\n", OptionCount); } - printf ("Usage: acpibin [options]\n\n"); - printf ("Options:\n\n"); - printf (" -c Compare two AML files\n"); - printf (" -d Dump AML binary to text file\n"); - printf (" -e Extract binary AML table from AcpiDmp file\n\n"); + ACPI_USAGE_HEADER ("acpibin [options]"); - printf (" -h Display table header for binary AML file\n"); - printf (" -s Update checksum for binary AML file\n"); - printf (" -t Terse mode\n"); - - printf ("\n"); - return; + ACPI_OPTION ("-c ", "Compare two AML files"); + ACPI_OPTION ("-d ", "Dump AML binary to text file"); + ACPI_OPTION ("-e ", "Extract binary AML table from AcpiDmp file"); + ACPI_OPTION ("-h ", "Display table header for binary AML file"); + ACPI_OPTION ("-s ", "Update checksum for binary AML file"); + ACPI_OPTION ("-t", "Terse mode"); } diff --git a/tools/acpiexec/Makefile b/tools/acpiexec/Makefile index 897a1928fb91..ba6b5340fb82 100644 --- a/tools/acpiexec/Makefile +++ b/tools/acpiexec/Makefile @@ -21,40 +21,58 @@ PROG = acpiexec HOST = _LINUX NOMAN = YES -COMPILE = $(CC) -c $(CFLAGS) $(CWARNINGFLAGS) -o$@ $? +COMPILE = $(CC) -c $(CFLAGS) $(CWARNINGFLAGS) -o$@ $< LDFLAGS += -lpthread -lrt ACPICA_COMPONENTS = -ACPICA_SRC = ../.. -ACPICA_COMMON = $(ACPICA_SRC)/common -ACPICA_CORE = $(ACPICA_SRC)$(ACPICA_COMPONENTS) -ACPICA_TOOLS = $(ACPICA_SRC)/tools -ACPICA_OSL = $(ACPICA_SRC)/os_specific/service_layers -INSTALLDIR = /usr/bin -INSTALLPROG = cp --remove-destination $(PROG) $(INSTALLDIR) +ACPICA_SRC = ../.. +ACPICA_INCLUDE = $(ACPICA_SRC)/include +ACPICA_COMMON = $(ACPICA_SRC)/common +ACPICA_CORE = $(ACPICA_SRC)$(ACPICA_COMPONENTS) +ACPICA_TOOLS = $(ACPICA_SRC)/tools +ACPICA_OSL = $(ACPICA_SRC)/os_specific/service_layers +ACPICA_DEBUGGER = $(ACPICA_CORE)/debugger +ACPICA_DISASSEMBLER = $(ACPICA_CORE)/disassembler +ACPICA_DISPATCHER = $(ACPICA_CORE)/dispatcher +ACPICA_EVENTS = $(ACPICA_CORE)/events +ACPICA_EXECUTER = $(ACPICA_CORE)/executer +ACPICA_HARDWARE = $(ACPICA_CORE)/hardware +ACPICA_NAMESPACE = $(ACPICA_CORE)/namespace +ACPICA_PARSER = $(ACPICA_CORE)/parser +ACPICA_RESOURCES = $(ACPICA_CORE)/resources +ACPICA_TABLES = $(ACPICA_CORE)/tables +ACPICA_UTILITIES = $(ACPICA_CORE)/utilities +ACPIEXEC = $(ACPICA_TOOLS)/acpiexec +INSTALLDIR = /usr/bin +INSTALLPROG = cp --remove-destination $(PROG) $(INSTALLDIR) -CFLAGS+= \ - -D$(HOST) \ - -D_GNU_SOURCE \ - -DACPI_EXEC_APP \ - -I$(ACPICA_SRC)/include +ACPICA_HEADERS = \ + $(wildcard $(ACPICA_INCLUDE)/*.h) \ + $(wildcard $(ACPICA_INCLUDE)/platform/*.h) -CWARNINGFLAGS = \ - -ansi \ - -Wall \ - -Wbad-function-cast \ - -Wdeclaration-after-statement \ - -Werror \ - -Wformat=2 \ - -Wmissing-declarations \ - -Wmissing-prototypes \ - -Wstrict-aliasing=0 \ - -Wstrict-prototypes \ - -Wswitch-default \ - -Wpointer-arith \ - -Wundef +# +# Search paths for source files +# +vpath %.c \ + $(ACPIEXEC) \ + $(ACPICA_DEBUGGER) \ + $(ACPICA_DISASSEMBLER) \ + $(ACPICA_DISPATCHER) \ + $(ACPICA_EVENTS) \ + $(ACPICA_EXECUTER) \ + $(ACPICA_HARDWARE) \ + $(ACPICA_NAMESPACE) \ + $(ACPICA_PARSER) \ + $(ACPICA_RESOURCES) \ + $(ACPICA_TABLES) \ + $(ACPICA_UTILITIES) \ + $(ACPICA_COMMON) \ + $(ACPICA_OSL) -OBJS = \ +HEADERS = \ + $(wildcard $(ACPIEXEC)/*.h) + +OBJECTS = \ aeexec.o \ aehandlers.o \ aemain.o \ @@ -208,483 +226,57 @@ OBJS = \ utxferror.o \ utxface.o -# -# Root rule -# -$(PROG) : $(OBJS) - $(CC) $(LDFLAGS) $(OBJS) -o $(PROG) +CFLAGS+= \ + -D$(HOST) \ + -D_GNU_SOURCE \ + -DACPI_EXEC_APP \ + -I$(ACPICA_INCLUDE) + +CWARNINGFLAGS = \ + -ansi \ + -Wall \ + -Wbad-function-cast \ + -Wdeclaration-after-statement \ + -Werror \ + -Wformat=2 \ + -Wmissing-declarations \ + -Wmissing-prototypes \ + -Wstrict-aliasing=0 \ + -Wstrict-prototypes \ + -Wswitch-default \ + -Wpointer-arith \ + -Wundef # -# acpiexec source +# gcc 4+ flags # -aeexec.o : $(ACPICA_TOOLS)/acpiexec/aeexec.c - $(COMPILE) - -aehandlers.o : $(ACPICA_TOOLS)/acpiexec/aehandlers.c - $(COMPILE) - -aemain.o : $(ACPICA_TOOLS)/acpiexec/aemain.c - $(COMPILE) - -aetables.o : $(ACPICA_TOOLS)/acpiexec/aetables.c - $(COMPILE) +CWARNINGFLAGS += \ + -Waddress \ + -Waggregate-return \ + -Wchar-subscripts \ + -Wempty-body \ + -Wlogical-op \ + -Wmissing-declarations \ + -Wmissing-field-initializers \ + -Wmissing-parameter-type \ + -Wnested-externs \ + -Wold-style-declaration \ + -Wold-style-definition \ + -Wredundant-decls \ + -Wtype-limits # -# ACPICA core source - common +# Rules # -getopt.o : $(ACPICA_COMMON)/getopt.c - $(COMPILE) - -# -# ACPICA core source -# -dbcmds.o : $(ACPICA_CORE)/debugger/dbcmds.c - $(COMPILE) - -dbdisply.o : $(ACPICA_CORE)/debugger/dbdisply.c - $(COMPILE) - -dbexec.o : $(ACPICA_CORE)/debugger/dbexec.c - $(COMPILE) - -dbfileio.o : $(ACPICA_CORE)/debugger/dbfileio.c - $(COMPILE) - -dbhistry.o : $(ACPICA_CORE)/debugger/dbhistry.c - $(COMPILE) - -dbinput.o : $(ACPICA_CORE)/debugger/dbinput.c - $(COMPILE) - -dbmethod.o : $(ACPICA_CORE)/debugger/dbmethod.c - $(COMPILE) - -dbnames.o : $(ACPICA_CORE)/debugger/dbnames.c - $(COMPILE) - -dbstats.o : $(ACPICA_CORE)/debugger/dbstats.c - $(COMPILE) - -dbutils.o : $(ACPICA_CORE)/debugger/dbutils.c - $(COMPILE) - -dbxface.o : $(ACPICA_CORE)/debugger/dbxface.c - $(COMPILE) - -dmbuffer.o : $(ACPICA_CORE)/disassembler/dmbuffer.c - $(COMPILE) - -dmnames.o : $(ACPICA_CORE)/disassembler/dmnames.c - $(COMPILE) - -dmobject.o : $(ACPICA_CORE)/disassembler/dmobject.c - $(COMPILE) - -dmopcode.o : $(ACPICA_CORE)/disassembler/dmopcode.c - $(COMPILE) - -dmresrc.o : $(ACPICA_CORE)/disassembler/dmresrc.c - $(COMPILE) - -dmresrcl.o : $(ACPICA_CORE)/disassembler/dmresrcl.c - $(COMPILE) - -dmresrcs.o : $(ACPICA_CORE)/disassembler/dmresrcs.c - $(COMPILE) - -dmutils.o : $(ACPICA_CORE)/disassembler/dmutils.c - $(COMPILE) - -dmwalk.o : $(ACPICA_CORE)/disassembler/dmwalk.c - $(COMPILE) - -dsargs.o : $(ACPICA_CORE)/dispatcher/dsargs.c - $(COMPILE) - -dscontrol.o : $(ACPICA_CORE)/dispatcher/dscontrol.c - $(COMPILE) - -dsfield.o : $(ACPICA_CORE)/dispatcher/dsfield.c - $(COMPILE) - -dsinit.o : $(ACPICA_CORE)/dispatcher/dsinit.c - $(COMPILE) - -dsmethod.o : $(ACPICA_CORE)/dispatcher/dsmethod.c - $(COMPILE) - -dsmthdat.o : $(ACPICA_CORE)/dispatcher/dsmthdat.c - $(COMPILE) - -dsobject.o : $(ACPICA_CORE)/dispatcher/dsobject.c - $(COMPILE) - -dsopcode.o : $(ACPICA_CORE)/dispatcher/dsopcode.c - $(COMPILE) - -dsutils.o : $(ACPICA_CORE)/dispatcher/dsutils.c - $(COMPILE) - -dswexec.o : $(ACPICA_CORE)/dispatcher/dswexec.c - $(COMPILE) - -dswload.o : $(ACPICA_CORE)/dispatcher/dswload.c - $(COMPILE) - -dswload2.o : $(ACPICA_CORE)/dispatcher/dswload2.c - $(COMPILE) - -dswscope.o : $(ACPICA_CORE)/dispatcher/dswscope.c - $(COMPILE) - -dswstate.o : $(ACPICA_CORE)/dispatcher/dswstate.c - $(COMPILE) - -evevent.o : $(ACPICA_CORE)/events/evevent.c - $(COMPILE) - -evglock.o : $(ACPICA_CORE)/events/evglock.c - $(COMPILE) - -evgpe.o : $(ACPICA_CORE)/events/evgpe.c - $(COMPILE) - -evgpeblk.o : $(ACPICA_CORE)/events/evgpeblk.c - $(COMPILE) - -evgpeinit.o : $(ACPICA_CORE)/events/evgpeinit.c - $(COMPILE) - -evgpeutil.o : $(ACPICA_CORE)/events/evgpeutil.c - $(COMPILE) - -evmisc.o : $(ACPICA_CORE)/events/evmisc.c - $(COMPILE) - -evregion.o : $(ACPICA_CORE)/events/evregion.c - $(COMPILE) - -evrgnini.o : $(ACPICA_CORE)/events/evrgnini.c - $(COMPILE) - -evsci.o : $(ACPICA_CORE)/events/evsci.c - $(COMPILE) - -evxface.o : $(ACPICA_CORE)/events/evxface.c - $(COMPILE) - -evxfevnt.o : $(ACPICA_CORE)/events/evxfevnt.c - $(COMPILE) - -evxfgpe.o : $(ACPICA_CORE)/events/evxfgpe.c - $(COMPILE) - -evxfregn.o : $(ACPICA_CORE)/events/evxfregn.c - $(COMPILE) - -exconfig.o : $(ACPICA_CORE)/executer/exconfig.c - $(COMPILE) - -exconvrt.o : $(ACPICA_CORE)/executer/exconvrt.c - $(COMPILE) - -excreate.o : $(ACPICA_CORE)/executer/excreate.c - $(COMPILE) - -exdebug.o : $(ACPICA_CORE)/executer/exdebug.c - $(COMPILE) - -exdump.o : $(ACPICA_CORE)/executer/exdump.c - $(COMPILE) - -exfield.o : $(ACPICA_CORE)/executer/exfield.c - $(COMPILE) - -exfldio.o : $(ACPICA_CORE)/executer/exfldio.c - $(COMPILE) - -exmisc.o : $(ACPICA_CORE)/executer/exmisc.c - $(COMPILE) - -exmutex.o : $(ACPICA_CORE)/executer/exmutex.c - $(COMPILE) - -exnames.o : $(ACPICA_CORE)/executer/exnames.c - $(COMPILE) - -exoparg1.o : $(ACPICA_CORE)/executer/exoparg1.c - $(COMPILE) - -exoparg2.o : $(ACPICA_CORE)/executer/exoparg2.c - $(COMPILE) - -exoparg3.o : $(ACPICA_CORE)/executer/exoparg3.c - $(COMPILE) - -exoparg6.o : $(ACPICA_CORE)/executer/exoparg6.c - $(COMPILE) - -exprep.o : $(ACPICA_CORE)/executer/exprep.c - $(COMPILE) - -exregion.o : $(ACPICA_CORE)/executer/exregion.c - $(COMPILE) - -exresnte.o : $(ACPICA_CORE)/executer/exresnte.c - $(COMPILE) - -exresolv.o : $(ACPICA_CORE)/executer/exresolv.c - $(COMPILE) - -exresop.o : $(ACPICA_CORE)/executer/exresop.c - $(COMPILE) - -exstore.o : $(ACPICA_CORE)/executer/exstore.c - $(COMPILE) - -exstoren.o : $(ACPICA_CORE)/executer/exstoren.c - $(COMPILE) - -exstorob.o : $(ACPICA_CORE)/executer/exstorob.c - $(COMPILE) - -exsystem.o : $(ACPICA_CORE)/executer/exsystem.c - $(COMPILE) - -exutils.o : $(ACPICA_CORE)/executer/exutils.c - $(COMPILE) - -hwacpi.o : $(ACPICA_CORE)/hardware/hwacpi.c - $(COMPILE) +$(PROG) : $(OBJECTS) + $(CC) $(LDFLAGS) $(OBJECTS) -o $(PROG) + $(COPYPROG) -hwgpe.o : $(ACPICA_CORE)/hardware/hwgpe.c +%.o : %.c $(HEADERS) $(ACPICA_HEADERS) $(COMPILE) -hwpci.o : $(ACPICA_CORE)/hardware/hwpci.c - $(COMPILE) - -hwregs.o : $(ACPICA_CORE)/hardware/hwregs.c - $(COMPILE) - -hwsleep.o : $(ACPICA_CORE)/hardware/hwsleep.c - $(COMPILE) - -hwvalid.o : $(ACPICA_CORE)/hardware/hwvalid.c - $(COMPILE) - -hwxface.o : $(ACPICA_CORE)/hardware/hwxface.c - $(COMPILE) - -nsaccess.o : $(ACPICA_CORE)/namespace/nsaccess.c - $(COMPILE) - -nsalloc.o : $(ACPICA_CORE)/namespace/nsalloc.c - $(COMPILE) - -nsdump.o : $(ACPICA_CORE)/namespace/nsdump.c - $(COMPILE) - -nsdumpdv.o : $(ACPICA_CORE)/namespace/nsdumpdv.c - $(COMPILE) - -nseval.o : $(ACPICA_CORE)/namespace/nseval.c - $(COMPILE) - -nsinit.o : $(ACPICA_CORE)/namespace/nsinit.c - $(COMPILE) - -nsload.o : $(ACPICA_CORE)/namespace/nsload.c - $(COMPILE) - -nsnames.o : $(ACPICA_CORE)/namespace/nsnames.c - $(COMPILE) - -nsobject.o : $(ACPICA_CORE)/namespace/nsobject.c - $(COMPILE) - -nsparse.o : $(ACPICA_CORE)/namespace/nsparse.c - $(COMPILE) - -nspredef.o : $(ACPICA_CORE)/namespace/nspredef.c - $(COMPILE) - -nsrepair.o : $(ACPICA_CORE)/namespace/nsrepair.c - $(COMPILE) - -nsrepair2.o : $(ACPICA_CORE)/namespace/nsrepair2.c - $(COMPILE) - -nssearch.o : $(ACPICA_CORE)/namespace/nssearch.c - $(COMPILE) - -nsutils.o : $(ACPICA_CORE)/namespace/nsutils.c - $(COMPILE) - -nswalk.o : $(ACPICA_CORE)/namespace/nswalk.c - $(COMPILE) - -nsxfeval.o : $(ACPICA_CORE)/namespace/nsxfeval.c - $(COMPILE) - -nsxfname.o : $(ACPICA_CORE)/namespace/nsxfname.c - $(COMPILE) - -nsxfobj.o : $(ACPICA_CORE)/namespace/nsxfobj.c - $(COMPILE) - -psargs.o : $(ACPICA_CORE)/parser/psargs.c - $(COMPILE) - -psloop.o : $(ACPICA_CORE)/parser/psloop.c - $(COMPILE) - -psopcode.o : $(ACPICA_CORE)/parser/psopcode.c - $(COMPILE) - -psparse.o : $(ACPICA_CORE)/parser/psparse.c - $(COMPILE) - -psscope.o : $(ACPICA_CORE)/parser/psscope.c - $(COMPILE) - -pstree.o : $(ACPICA_CORE)/parser/pstree.c - $(COMPILE) - -psutils.o : $(ACPICA_CORE)/parser/psutils.c - $(COMPILE) - -pswalk.o : $(ACPICA_CORE)/parser/pswalk.c - $(COMPILE) - -psxface.o : $(ACPICA_CORE)/parser/psxface.c - $(COMPILE) - -rsaddr.o : $(ACPICA_CORE)/resources/rsaddr.c - $(COMPILE) - -rscalc.o : $(ACPICA_CORE)/resources/rscalc.c - $(COMPILE) - -rscreate.o : $(ACPICA_CORE)/resources/rscreate.c - $(COMPILE) - -rsdump.o : $(ACPICA_CORE)/resources/rsdump.c - $(COMPILE) - -rsio.o : $(ACPICA_CORE)/resources/rsio.c - $(COMPILE) - -rsinfo.o : $(ACPICA_CORE)/resources/rsinfo.c - $(COMPILE) - -rsirq.o : $(ACPICA_CORE)/resources/rsirq.c - $(COMPILE) - -rslist.o : $(ACPICA_CORE)/resources/rslist.c - $(COMPILE) - -rsmemory.o : $(ACPICA_CORE)/resources/rsmemory.c - $(COMPILE) - -rsmisc.o : $(ACPICA_CORE)/resources/rsmisc.c - $(COMPILE) - -rsutils.o : $(ACPICA_CORE)/resources/rsutils.c - $(COMPILE) - -rsxface.o : $(ACPICA_CORE)/resources/rsxface.c - $(COMPILE) - -tbfadt.o : $(ACPICA_CORE)/tables/tbfadt.c - $(COMPILE) - -tbfind.o : $(ACPICA_CORE)/tables/tbfind.c - $(COMPILE) - -tbinstal.o : $(ACPICA_CORE)/tables/tbinstal.c - $(COMPILE) - -tbutils.o : $(ACPICA_CORE)/tables/tbutils.c - $(COMPILE) - -tbxface.o : $(ACPICA_CORE)/tables/tbxface.c - $(COMPILE) - -tbxfroot.o : $(ACPICA_CORE)/tables/tbxfroot.c - $(COMPILE) - -utalloc.o : $(ACPICA_CORE)/utilities/utalloc.c - $(COMPILE) - -utcache.o : $(ACPICA_CORE)/utilities/utcache.c - $(COMPILE) - -utcopy.o : $(ACPICA_CORE)/utilities/utcopy.c - $(COMPILE) - -utdebug.o : $(ACPICA_CORE)/utilities/utdebug.c - $(COMPILE) - -utdecode.o : $(ACPICA_CORE)/utilities/utdecode.c - $(COMPILE) - -utdelete.o : $(ACPICA_CORE)/utilities/utdelete.c - $(COMPILE) - -uteval.o : $(ACPICA_CORE)/utilities/uteval.c - $(COMPILE) - -utglobal.o : $(ACPICA_CORE)/utilities/utglobal.c - $(COMPILE) - -utids.o : $(ACPICA_CORE)/utilities/utids.c - $(COMPILE) - -utinit.o : $(ACPICA_CORE)/utilities/utinit.c - $(COMPILE) - -utlock.o : $(ACPICA_CORE)/utilities/utlock.c - $(COMPILE) - -utmath.o : $(ACPICA_CORE)/utilities/utmath.c - $(COMPILE) - -utmisc.o : $(ACPICA_CORE)/utilities/utmisc.c - $(COMPILE) - -utmutex.o : $(ACPICA_CORE)/utilities/utmutex.c - $(COMPILE) - -utobject.o : $(ACPICA_CORE)/utilities/utobject.c - $(COMPILE) - -utresrc.o : $(ACPICA_CORE)/utilities/utresrc.c - $(COMPILE) - -utstate.o : $(ACPICA_CORE)/utilities/utstate.c - $(COMPILE) - -uttrack.o : $(ACPICA_CORE)/utilities/uttrack.c - $(COMPILE) - -utosi.o : $(ACPICA_CORE)/utilities/utosi.c - $(COMPILE) - -utxferror.o : $(ACPICA_CORE)/utilities/utxferror.c - $(COMPILE) - -utxface.o : $(ACPICA_CORE)/utilities/utxface.c - $(COMPILE) - -# -# Unix OS services layer (OSL) -# -osunixxf.o : $(ACPICA_OSL)/osunixxf.c - $(COMPILE) - - clean : - rm -f $(PROG) $(PROG).exe $(OBJS) + rm -f $(PROG) $(PROG).exe $(OBJECTS) install : $(INSTALLPROG) diff --git a/tools/acpiexec/aemain.c b/tools/acpiexec/aemain.c index 626cfdd00939..2de367b54bfd 100644 --- a/tools/acpiexec/aemain.c +++ b/tools/acpiexec/aemain.c @@ -82,30 +82,30 @@ static char *FileList[ASL_MAX_FILES]; static void usage (void) { - printf ("Usage: acpiexec [options] AMLfile1 AMLfile2 ...\n\n"); - printf ("Where:\n"); - printf (" -? Display this message\n"); - printf (" -b Batch mode command execution\n"); - printf (" -m [Method] Batch mode method execution. Default=MAIN\n"); + ACPI_USAGE_HEADER ("acpiexec [options] AMLfile1 AMLfile2 ..."); + + ACPI_OPTION ("-?", "Display this message"); + ACPI_OPTION ("-b ", "Batch mode command execution"); + ACPI_OPTION ("-m [Method]", "Batch mode method execution. Default=MAIN"); printf ("\n"); - printf (" -da Disable method abort on error\n"); - printf (" -di Disable execution of STA/INI methods during init\n"); - printf (" -do Disable Operation Region address simulation\n"); - printf (" -dr Disable repair of method return values\n"); - printf (" -dt Disable allocation tracking (performance)\n"); + ACPI_OPTION ("-da", "Disable method abort on error"); + ACPI_OPTION ("-di", "Disable execution of STA/INI methods during init"); + ACPI_OPTION ("-do", "Disable Operation Region address simulation"); + ACPI_OPTION ("-dr", "Disable repair of method return values"); + ACPI_OPTION ("-dt", "Disable allocation tracking (performance)"); printf ("\n"); - printf (" -ef Enable display of final memory statistics\n"); - printf (" -em Enable Interpreter Serialized Mode\n"); - printf (" -es Enable Interpreter Slack Mode\n"); - printf (" -et Enable debug semaphore timeout\n"); + ACPI_OPTION ("-ef", "Enable display of final memory statistics"); + ACPI_OPTION ("-em", "Enable Interpreter Serialized Mode"); + ACPI_OPTION ("-es", "Enable Interpreter Slack Mode"); + ACPI_OPTION ("-et", "Enable debug semaphore timeout"); printf ("\n"); - printf (" -f Operation Region initialization fill value\n"); - printf (" -v Verbose initialization output\n"); - printf (" -x Debug output level\n"); + ACPI_OPTION ("-f ", "Operation Region initialization fill value"); + ACPI_OPTION ("-v", "Verbose initialization output"); + ACPI_OPTION ("-x ", "Debug output level"); } @@ -583,12 +583,13 @@ main ( *WildcardList = NULL; WildcardList++; - /* - * Ignore an FACS or RSDT, we can't use them. - */ - if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FACS) || - ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_RSDT)) + /* Ignore non-AML tables, we can't use them. Except for an FADT */ + + if (!ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FADT) && + !AcpiUtIsAmlTable (Table)) { + ACPI_WARNING ((AE_INFO,"Table %4.4s is not an AML table, ignoring", + Table->Signature)); AcpiOsFree (Table); continue; } diff --git a/tools/acpihelp/Makefile b/tools/acpihelp/Makefile index 6cf56996840a..5ae399f81f16 100644 --- a/tools/acpihelp/Makefile +++ b/tools/acpihelp/Makefile @@ -20,22 +20,48 @@ PROG = acpihelp HOST = _LINUX NOMAN = YES -COMPILE = $(CC) -c $(CFLAGS) $(CWARNINGFLAGS) -o$@ $? +COMPILE = $(CC) -c $(CFLAGS) $(CWARNINGFLAGS) -o$@ $< ACPICA_COMPONENTS = -ACPICA_SRC = ../.. -ACPICA_COMMON = $(ACPICA_SRC)/common -ACPICA_CORE = $(ACPICA_SRC)$(ACPICA_COMPONENTS) -ACPICA_TOOLS = $(ACPICA_SRC)/tools -ACPICA_OSL = $(ACPICA_SRC)/os_specific/service_layers -INSTALLDIR = /usr/bin -INSTALLPROG = cp --remove-destination $(PROG) $(INSTALLDIR) +ACPICA_SRC = ../.. +ACPICA_INCLUDE = $(ACPICA_SRC)/include +ACPICA_COMMON = $(ACPICA_SRC)/common +ACPICA_CORE = $(ACPICA_SRC)$(ACPICA_COMPONENTS) +ACPICA_TOOLS = $(ACPICA_SRC)/tools +ACPICA_OSL = $(ACPICA_SRC)/os_specific/service_layers +ACPICA_UTILITIES = $(ACPICA_CORE)/utilities +ACPIHELP = $(ACPICA_TOOLS)/acpihelp +INSTALLDIR = /usr/bin +INSTALLPROG = cp --remove-destination $(PROG) $(INSTALLDIR) + +ACPICA_HEADERS = \ + $(wildcard $(ACPICA_INCLUDE)/*.h) \ + $(wildcard $(ACPICA_INCLUDE)/platform/*.h) + +# +# Search paths for source files +# +vpath %.c \ + $(ACPIHELP) \ + $(ACPICA_COMMON) + +HEADERS = \ + $(wildcard $(ACPIHELP)/*.h) + +OBJECTS = \ + ahamlops.o \ + ahaslkey.o \ + ahaslops.o \ + ahdecode.o \ + ahpredef.o \ + ahmain.o \ + getopt.o CFLAGS+= \ -D$(HOST) \ -D_GNU_SOURCE \ -DACPI_HELP_APP \ - -I$(ACPICA_SRC)/include + -I$(ACPICA_INCLUDE) CWARNINGFLAGS = \ -ansi \ @@ -52,50 +78,36 @@ CWARNINGFLAGS = \ -Wpointer-arith \ -Wundef -OBJS = \ - ahamlops.o \ - ahaslkey.o \ - ahaslops.o \ - ahdecode.o \ - ahpredef.o \ - ahmain.o \ - getopt.o +# +# gcc 4+ flags +# +CWARNINGFLAGS += \ + -Waddress \ + -Waggregate-return \ + -Wchar-subscripts \ + -Wempty-body \ + -Wlogical-op \ + -Wmissing-declarations \ + -Wmissing-field-initializers \ + -Wmissing-parameter-type \ + -Wnested-externs \ + -Wold-style-declaration \ + -Wold-style-definition \ + -Wredundant-decls \ + -Wtype-limits # -# Root rule +# Rules # -$(PROG) : $(OBJS) - $(CC) $(LDFLAGS) $(OBJS) -o $(PROG) +$(PROG) : $(OBJECTS) + $(CC) $(LDFLAGS) $(OBJECTS) -o $(PROG) + $(COPYPROG) -# -# acpihelp source -# -ahamlops.o : $(ACPICA_TOOLS)/acpihelp/ahamlops.c - $(COMPILE) - -ahaslkey.o : $(ACPICA_TOOLS)/acpihelp/ahaslkey.c - $(COMPILE) - -ahaslops.o : $(ACPICA_TOOLS)/acpihelp/ahaslops.c - $(COMPILE) - -ahdecode.o : $(ACPICA_TOOLS)/acpihelp/ahdecode.c - $(COMPILE) - -ahpredef.o : $(ACPICA_TOOLS)/acpihelp/ahpredef.c - $(COMPILE) - -ahmain.o : $(ACPICA_TOOLS)/acpihelp/ahmain.c - $(COMPILE) - -# -# ACPICA core source - common -# -getopt.o : $(ACPICA_COMMON)/getopt.c +%.o : %.c $(HEADERS) $(ACPICA_HEADERS) $(COMPILE) clean : - rm -f $(PROG) $(PROG).exe $(OBJS) + rm -f $(PROG) $(PROG).exe $(OBJECTS) install : $(INSTALLPROG) diff --git a/tools/acpihelp/ahaslops.c b/tools/acpihelp/ahaslops.c index 44a1e80c31aa..b1ad645e466e 100644 --- a/tools/acpihelp/ahaslops.c +++ b/tools/acpihelp/ahaslops.c @@ -50,6 +50,8 @@ */ const AH_ASL_OPERATOR AslOperatorInfo[] = { + {"AccessAs", "(AccessType, AccessAttibute)", + "ChangeFieldUnitAccess"}, {"Acquire", "(SyncObject, TimeoutValue) => Boolean", "Acquire a mutex"}, {"Add", "(Addend1, Addend2, Result) => Integer", @@ -240,6 +242,8 @@ const AH_ASL_OPERATOR AslOperatorInfo[] = "Notify Object of event"}, {"ObjectType", "(Object) => Integer", "Type of object"}, + {"Offset", "(ByteOffset)", + "Change Current Field Unit Offset"}, {"One", "=> Integer", "Constant One Object (1)"}, {"Ones", "=> Integer", diff --git a/tools/acpihelp/ahmain.c b/tools/acpihelp/ahmain.c index b8b9ed33a491..1d38a883d9b4 100644 --- a/tools/acpihelp/ahmain.c +++ b/tools/acpihelp/ahmain.c @@ -64,18 +64,16 @@ AhDisplayUsage ( void) { - printf ("\n"); - printf ("Usage: acpihelp [NamePrefix | HexValue]\n\n"); - printf ("Where: -k [NamePrefix] Find/Display ASL non-operator keyword(s)\n"); - printf (" -m [NamePrefix] Find/Display AML opcode name(s)\n"); - printf (" -o [HexValue] Decode hex AML opcode\n"); - printf (" -p [NamePrefix] Find/Display ASL predefined method name(s)\n"); - printf (" -s [NamePrefix] Find/Display ASL operator name(s)\n"); + ACPI_USAGE_HEADER ("acpihelp [NamePrefix | HexValue]"); + ACPI_OPTION ("-k [NamePrefix]", "Find/Display ASL non-operator keyword(s)"); + ACPI_OPTION ("-m [NamePrefix]", "Find/Display AML opcode name(s)"); + ACPI_OPTION ("-o [HexValue]", "Decode hex AML opcode"); + ACPI_OPTION ("-p [NamePrefix]", "Find/Display ASL predefined method name(s)"); + ACPI_OPTION ("-s [NamePrefix]", "Find/Display ASL operator name(s)"); printf ("\nNamePrefix/HexValue not specified means \"Display All\"\n"); printf ("\nDefault search with NamePrefix and no options:\n"); printf (" Find ASL operator names - if NamePrefix does not start with underscore\n"); printf (" Find ASL predefined method names - if NamePrefix starts with underscore\n"); - printf ("\n"); } diff --git a/tools/acpihelp/ahpredef.c b/tools/acpihelp/ahpredef.c index 49d524f930bb..d56bea36f406 100644 --- a/tools/acpihelp/ahpredef.c +++ b/tools/acpihelp/ahpredef.c @@ -273,5 +273,6 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = {"_UPP", "User Presence Polling", "Returns the recommended user presence polling interval"}, {"_VPO", "Video Post Options", "Returns the implemented video post options"}, {"_WAK", "Wake", "Inform AML that the system has just awakened"}, - {"_Wxx", "Wake Event", "Method executed as a result of a wake event"} + {"_Wxx", "Wake Event", "Method executed as a result of a wake event"}, + {NULL, NULL, NULL} }; diff --git a/tools/acpinames/Makefile b/tools/acpinames/Makefile index d88d6c5ef9fb..9b8a051805bc 100644 --- a/tools/acpinames/Makefile +++ b/tools/acpinames/Makefile @@ -21,40 +21,49 @@ PROG = acpinames HOST = _LINUX NOMAN = YES -COMPILE = $(CC) -c $(CFLAGS) $(CWARNINGFLAGS) -o$@ $? +COMPILE = $(CC) -c $(CFLAGS) $(CWARNINGFLAGS) -o$@ $< ACPICA_COMPONENTS = -ACPICA_SRC = ../.. -ACPICA_COMMON = $(ACPICA_SRC)/common -ACPICA_CORE = $(ACPICA_SRC)$(ACPICA_COMPONENTS) -ACPICA_TOOLS = $(ACPICA_SRC)/tools -ACPICA_OSL = $(ACPICA_SRC)/os_specific/service_layers -INSTALLDIR = /usr/bin -INSTALLPROG = cp --remove-destination $(PROG) $(INSTALLDIR) +ACPICA_SRC = ../.. +ACPICA_INCLUDE = $(ACPICA_SRC)/include +ACPICA_COMMON = $(ACPICA_SRC)/common +ACPICA_CORE = $(ACPICA_SRC)$(ACPICA_COMPONENTS) +ACPICA_TOOLS = $(ACPICA_SRC)/tools +ACPICA_OSL = $(ACPICA_SRC)/os_specific/service_layers +ACPICA_DEBUGGER = $(ACPICA_CORE)/debugger +ACPICA_DISPATCHER = $(ACPICA_CORE)/dispatcher +ACPICA_EXECUTER = $(ACPICA_CORE)/executer +ACPICA_NAMESPACE = $(ACPICA_CORE)/namespace +ACPICA_PARSER = $(ACPICA_CORE)/parser +ACPICA_TABLES = $(ACPICA_CORE)/tables +ACPICA_UTILITIES = $(ACPICA_CORE)/utilities +ACPINAMES = $(ACPICA_TOOLS)/acpinames +INSTALLDIR = /usr/bin +INSTALLPROG = cp --remove-destination $(PROG) $(INSTALLDIR) -CFLAGS+= \ - -D$(HOST) \ - -D_GNU_SOURCE \ - -DACPI_NAMES_APP \ - -I$(ACPICA_SRC)/include \ - -I$(ACPICA_TOOLS)/acpinames +ACPICA_HEADERS = \ + $(wildcard $(ACPICA_INCLUDE)/*.h) \ + $(wildcard $(ACPICA_INCLUDE)/platform/*.h) -CWARNINGFLAGS = \ - -ansi \ - -Wall \ - -Wbad-function-cast \ - -Wdeclaration-after-statement \ - -Werror \ - -Wformat=2 \ - -Wmissing-declarations \ - -Wmissing-prototypes \ - -Wstrict-aliasing=0 \ - -Wstrict-prototypes \ - -Wswitch-default \ - -Wpointer-arith \ - -Wundef +# +# Search paths for source files +# +vpath %.c \ + $(ACPINAMES) \ + $(ACPICA_DEBUGGER) \ + $(ACPICA_DISPATCHER) \ + $(ACPICA_EXECUTER) \ + $(ACPICA_NAMESPACE) \ + $(ACPICA_PARSER) \ + $(ACPICA_TABLES) \ + $(ACPICA_UTILITIES) \ + $(ACPICA_COMMON) \ + $(ACPICA_OSL) -OBJS = \ +HEADERS = \ + $(wildcard $(ACPINAMES)/*.h) + +OBJECTS = \ anmain.o \ anstubs.o \ antables.o \ @@ -119,216 +128,58 @@ OBJS = \ utxferror.o \ utxface.o -# -# Root rule -# -$(PROG) : $(OBJS) - $(CC) $(LDFLAGS) $(OBJS) -o $(PROG) +CFLAGS+= \ + -D$(HOST) \ + -D_GNU_SOURCE \ + -DACPI_NAMES_APP \ + -I$(ACPICA_INCLUDE) \ + -I$(ACPINAMES) + +CWARNINGFLAGS = \ + -ansi \ + -Wall \ + -Wbad-function-cast \ + -Wdeclaration-after-statement \ + -Werror \ + -Wformat=2 \ + -Wmissing-declarations \ + -Wmissing-prototypes \ + -Wstrict-aliasing=0 \ + -Wstrict-prototypes \ + -Wswitch-default \ + -Wpointer-arith \ + -Wundef # -# acpinames source +# gcc 4+ flags # -anmain.o : $(ACPICA_TOOLS)/acpinames/anmain.c - $(COMPILE) - -anstubs.o : $(ACPICA_TOOLS)/acpinames/anstubs.c - $(COMPILE) - -antables.o : $(ACPICA_TOOLS)/acpinames/antables.c - $(COMPILE) +CWARNINGFLAGS += \ + -Waddress \ + -Waggregate-return \ + -Wchar-subscripts \ + -Wempty-body \ + -Wlogical-op \ + -Wmissing-declarations \ + -Wmissing-field-initializers \ + -Wmissing-parameter-type \ + -Wnested-externs \ + -Wold-style-declaration \ + -Wold-style-definition \ + -Wredundant-decls \ + -Wtype-limits # -# ACPICA core source - common +# Rules # -getopt.o : $(ACPICA_COMMON)/getopt.c - $(COMPILE) +$(PROG) : $(OBJECTS) + $(CC) $(LDFLAGS) $(OBJECTS) -o $(PROG) + $(COPYPROG) -# -# ACPICA core source -# -dbfileio.o : $(ACPICA_CORE)/debugger/dbfileio.c +%.o : %.c $(HEADERS) $(ACPICA_HEADERS) $(COMPILE) -dsfield.o : $(ACPICA_CORE)/dispatcher/dsfield.c - $(COMPILE) - -dsmthdat.o : $(ACPICA_CORE)/dispatcher/dsmthdat.c - $(COMPILE) - -dsobject.o : $(ACPICA_CORE)/dispatcher/dsobject.c - $(COMPILE) - -dsutils.o : $(ACPICA_CORE)/dispatcher/dsutils.c - $(COMPILE) - -dswload.o : $(ACPICA_CORE)/dispatcher/dswload.c - $(COMPILE) - -dswload2.o : $(ACPICA_CORE)/dispatcher/dswload2.c - $(COMPILE) - -dswscope.o : $(ACPICA_CORE)/dispatcher/dswscope.c - $(COMPILE) - -dswstate.o : $(ACPICA_CORE)/dispatcher/dswstate.c - $(COMPILE) - -excreate.o : $(ACPICA_CORE)/executer/excreate.c - $(COMPILE) - -exnames.o : $(ACPICA_CORE)/executer/exnames.c - $(COMPILE) - -exresnte.o : $(ACPICA_CORE)/executer/exresnte.c - $(COMPILE) - -exresolv.o : $(ACPICA_CORE)/executer/exresolv.c - $(COMPILE) - -exutils.o : $(ACPICA_CORE)/executer/exutils.c - $(COMPILE) - -nsaccess.o : $(ACPICA_CORE)/namespace/nsaccess.c - $(COMPILE) - -nsalloc.o : $(ACPICA_CORE)/namespace/nsalloc.c - $(COMPILE) - -nsdump.o : $(ACPICA_CORE)/namespace/nsdump.c - $(COMPILE) - -nsinit.o : $(ACPICA_CORE)/namespace/nsinit.c - $(COMPILE) - -nsload.o : $(ACPICA_CORE)/namespace/nsload.c - $(COMPILE) - -nsnames.o : $(ACPICA_CORE)/namespace/nsnames.c - $(COMPILE) - -nsobject.o : $(ACPICA_CORE)/namespace/nsobject.c - $(COMPILE) - -nsparse.o : $(ACPICA_CORE)/namespace/nsparse.c - $(COMPILE) - -nssearch.o : $(ACPICA_CORE)/namespace/nssearch.c - $(COMPILE) - -nsutils.o : $(ACPICA_CORE)/namespace/nsutils.c - $(COMPILE) - -nswalk.o : $(ACPICA_CORE)/namespace/nswalk.c - $(COMPILE) - -nsxfeval.o : $(ACPICA_CORE)/namespace/nsxfeval.c - $(COMPILE) - -nsxfname.o : $(ACPICA_CORE)/namespace/nsxfname.c - $(COMPILE) - -nsxfobj.o : $(ACPICA_CORE)/namespace/nsxfobj.c - $(COMPILE) - -psargs.o : $(ACPICA_CORE)/parser/psargs.c - $(COMPILE) - -psloop.o : $(ACPICA_CORE)/parser/psloop.c - $(COMPILE) - -psopcode.o : $(ACPICA_CORE)/parser/psopcode.c - $(COMPILE) - -psparse.o : $(ACPICA_CORE)/parser/psparse.c - $(COMPILE) - -psscope.o : $(ACPICA_CORE)/parser/psscope.c - $(COMPILE) - -pstree.o : $(ACPICA_CORE)/parser/pstree.c - $(COMPILE) - -psutils.o : $(ACPICA_CORE)/parser/psutils.c - $(COMPILE) - -pswalk.o : $(ACPICA_CORE)/parser/pswalk.c - $(COMPILE) - -psxface.o : $(ACPICA_CORE)/parser/psxface.c - $(COMPILE) - -tbfadt.o : $(ACPICA_CORE)/tables/tbfadt.c - $(COMPILE) - -tbfind.o : $(ACPICA_CORE)/tables/tbfind.c - $(COMPILE) - -tbinstal.o : $(ACPICA_CORE)/tables/tbinstal.c - $(COMPILE) - -tbutils.o : $(ACPICA_CORE)/tables/tbutils.c - $(COMPILE) - -tbxface.o : $(ACPICA_CORE)/tables/tbxface.c - $(COMPILE) - -tbxfroot.o : $(ACPICA_CORE)/tables/tbxfroot.c - $(COMPILE) - -utalloc.o : $(ACPICA_CORE)/utilities/utalloc.c - $(COMPILE) - -utcache.o : $(ACPICA_CORE)/utilities/utcache.c - $(COMPILE) - -utdebug.o : $(ACPICA_CORE)/utilities/utdebug.c - $(COMPILE) - -utdecode.o : $(ACPICA_CORE)/utilities/utdecode.c - $(COMPILE) - -utdelete.o : $(ACPICA_CORE)/utilities/utdelete.c - $(COMPILE) - -utglobal.o : $(ACPICA_CORE)/utilities/utglobal.c - $(COMPILE) - -utlock.o : $(ACPICA_CORE)/utilities/utlock.c - $(COMPILE) - -utmath.o : $(ACPICA_CORE)/utilities/utmath.c - $(COMPILE) - -utmisc.o : $(ACPICA_CORE)/utilities/utmisc.c - $(COMPILE) - -utmutex.o : $(ACPICA_CORE)/utilities/utmutex.c - $(COMPILE) - -utobject.o : $(ACPICA_CORE)/utilities/utobject.c - $(COMPILE) - -utstate.o : $(ACPICA_CORE)/utilities/utstate.c - $(COMPILE) - -utosi.o : $(ACPICA_CORE)/utilities/utosi.c - $(COMPILE) - -utxferror.o : $(ACPICA_CORE)/utilities/utxferror.c - $(COMPILE) - -utxface.o : $(ACPICA_CORE)/utilities/utxface.c - $(COMPILE) - -# -# Unix OS services layer (OSL) -# -osunixxf.o : $(ACPICA_OSL)/osunixxf.c - $(COMPILE) - - clean : - rm -f $(PROG) $(PROG).exe $(OBJS) + rm -f $(PROG) $(PROG).exe $(OBJECTS) install : $(INSTALLPROG) diff --git a/tools/acpinames/anmain.c b/tools/acpinames/anmain.c index 8eaf16cf0e75..d66c84f9440d 100644 --- a/tools/acpinames/anmain.c +++ b/tools/acpinames/anmain.c @@ -72,10 +72,9 @@ static void usage ( void) { - printf ("Usage: AcpiNames [options] AMLfile\n\n"); - printf ("Where:\n"); - printf (" -? Display this message\n"); + ACPI_USAGE_HEADER ("AcpiNames [options] AMLfile"); + ACPI_OPTION ("-?", "Display this message"); } diff --git a/tools/acpisrc/Makefile b/tools/acpisrc/Makefile index bd55d024db6a..f7464861ae09 100644 --- a/tools/acpisrc/Makefile +++ b/tools/acpisrc/Makefile @@ -19,23 +19,51 @@ PROG = acpisrc HOST = _LINUX NOMAN = YES -COMPILE = $(CC) -c $(CFLAGS) $(CWARNINGFLAGS) -o$@ $? +COMPILE = $(CC) -c $(CFLAGS) $(CWARNINGFLAGS) -o$@ $< ACPICA_COMPONENTS = -ACPICA_SRC = ../.. -ACPICA_COMMON = $(ACPICA_SRC)/common -ACPICA_CORE = $(ACPICA_SRC)$(ACPICA_COMPONENTS) -ACPICA_TOOLS = $(ACPICA_SRC)/tools -ACPICA_OSL = $(ACPICA_SRC)/os_specific/service_layers -INSTALLDIR = /usr/bin -INSTALLPROG = cp --remove-destination $(PROG) $(INSTALLDIR) +ACPICA_SRC = ../.. +ACPICA_INCLUDE = $(ACPICA_SRC)/include +ACPICA_COMMON = $(ACPICA_SRC)/common +ACPICA_CORE = $(ACPICA_SRC)$(ACPICA_COMPONENTS) +ACPICA_TOOLS = $(ACPICA_SRC)/tools +ACPICA_OSL = $(ACPICA_SRC)/os_specific/service_layers +ACPISRC = $(ACPICA_TOOLS)/acpisrc +INSTALLDIR = /usr/bin +INSTALLPROG = cp --remove-destination $(PROG) $(INSTALLDIR) + +ACPICA_HEADERS = \ + $(wildcard $(ACPICA_INCLUDE)/*.h) \ + $(wildcard $(ACPICA_INCLUDE)/platform/*.h) + +# +# Search path for source files and individual source files +# +vpath %.c \ + $(ACPISRC) \ + $(ACPICA_COMMON) \ + $(ACPICA_OSL) + +HEADERS = \ + $(wildcard $(ACPISRC)/*.h) + +OBJECTS = \ + ascase.o \ + asconvrt.o \ + asfile.o \ + asmain.o \ + asremove.o \ + astable.o \ + asutils.o \ + osunixdir.o \ + getopt.o CFLAGS+= \ -D$(HOST) \ -D_GNU_SOURCE \ -DACPI_SRC_APP \ - -I$(ACPICA_SRC)/include \ - -I. + -I$(ACPISRC) \ + -I$(ACPICA_INCLUDE) CWARNINGFLAGS = \ -ansi \ @@ -52,62 +80,35 @@ CWARNINGFLAGS = \ -Wpointer-arith \ -Wundef -OBJS = \ - ascase.o \ - asconvrt.o \ - asfile.o \ - asmain.o \ - asremove.o \ - astable.o \ - asutils.o \ - osunixdir.o \ - getopt.o +# +# gcc 4+ flags +# +CWARNINGFLAGS += \ + -Waddress \ + -Waggregate-return \ + -Wchar-subscripts \ + -Wempty-body \ + -Wlogical-op \ + -Wmissing-declarations \ + -Wmissing-field-initializers \ + -Wmissing-parameter-type \ + -Wnested-externs \ + -Wold-style-declaration \ + -Wold-style-definition \ + -Wredundant-decls \ + -Wtype-limits # -# Root rule +# Rules # -$(PROG) : $(OBJS) - $(CC) $(LDFLAGS) $(OBJS) -o $(PROG) +$(PROG) : $(OBJECTS) + $(CC) $(LDFLAGS) $(OBJECTS) -o $(PROG) -# -# acpisrc source -# -ascase.o : $(ACPICA_TOOLS)/acpisrc/ascase.c +%.o : %.c $(HEADERS) $(ACPICA_HEADERS) $(COMPILE) -asconvrt.o : $(ACPICA_TOOLS)/acpisrc/asconvrt.c - $(COMPILE) - -asfile.o : $(ACPICA_TOOLS)/acpisrc/asfile.c - $(COMPILE) - -asmain.o : $(ACPICA_TOOLS)/acpisrc/asmain.c - $(COMPILE) - -asremove.o : $(ACPICA_TOOLS)/acpisrc/asremove.c - $(COMPILE) - -astable.o : $(ACPICA_TOOLS)/acpisrc/astable.c - $(COMPILE) - -asutils.o : $(ACPICA_TOOLS)/acpisrc/asutils.c - $(COMPILE) - -# -# ACPICA core source - common -# -getopt.o : $(ACPICA_COMMON)/getopt.c - $(COMPILE) - -# -# Unix OS services layer (OSL) -# -osunixdir.o : $(ACPICA_OSL)/osunixdir.c - $(COMPILE) - - clean : - rm -f $(PROG) $(PROG) $(OBJS) + rm -f $(PROG) $(PROG).exe $(OBJECTS) install : $(INSTALLPROG) diff --git a/tools/acpisrc/asmain.c b/tools/acpisrc/asmain.c index 285a5b9bb550..873e503afc04 100644 --- a/tools/acpisrc/asmain.c +++ b/tools/acpisrc/asmain.c @@ -229,6 +229,12 @@ AsDisplayStats ( printf ("\nAcpiSrc statistics:\n\n"); printf ("%8u Files processed\n", Gbl_Files); + + if (!Gbl_Files) + { + return; + } + printf ("%8u Total bytes (%.1fK/file)\n", Gbl_TotalSize, ((double) Gbl_TotalSize/Gbl_Files)/1024); printf ("%8u Tabs found\n", Gbl_Tabs); @@ -243,6 +249,12 @@ AsDisplayStats ( ((float) Gbl_SourceLines / (float) Gbl_WhiteLines)); printf ("%8.1f Ratio of code to comments\n", ((float) Gbl_SourceLines / (float) (Gbl_CommentLines + Gbl_NonAnsiComments))); + + if (!Gbl_TotalLines) + { + return; + } + printf (" %u%% code, %u%% comments, %u%% whitespace, %u%% headers\n", (Gbl_SourceLines * 100) / Gbl_TotalLines, (Gbl_CommentLines * 100) / Gbl_TotalLines, @@ -265,19 +277,18 @@ AsDisplayUsage ( void) { + ACPI_USAGE_HEADER ("acpisrc [-c|l|u] [-dsvy] "); + + ACPI_OPTION ("-c", "Generate cleaned version of the source"); + ACPI_OPTION ("-h", "Insert dual-license header into all modules"); + ACPI_OPTION ("-l", "Generate Linux version of the source"); + ACPI_OPTION ("-u", "Generate Custom source translation"); + printf ("\n"); - printf ("Usage: acpisrc [-c|l|u] [-dsvy] \n\n"); - printf ("Where: -c Generate cleaned version of the source\n"); - printf (" -h Insert dual-license header into all modules\n"); - printf (" -l Generate Linux version of the source\n"); - printf (" -u Generate Custom source translation\n"); - printf ("\n"); - printf (" -d Leave debug statements in code\n"); - printf (" -s Generate source statistics only\n"); - printf (" -v Verbose mode\n"); - printf (" -y Suppress file overwrite prompts\n"); - printf ("\n"); - return; + ACPI_OPTION ("-d", "Leave debug statements in code"); + ACPI_OPTION ("-s", "Generate source statistics only"); + ACPI_OPTION ("-v", "Verbose mode"); + ACPI_OPTION ("-y", "Suppress file overwrite prompts"); } diff --git a/tools/acpisrc/astable.c b/tools/acpisrc/astable.c index a1ef455beef2..b30f83ff3ae1 100644 --- a/tools/acpisrc/astable.c +++ b/tools/acpisrc/astable.c @@ -375,6 +375,7 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { {"ACPI_TABLE_LIST", SRC_TYPE_STRUCT}, {"ACPI_TABLE_SUPPORT", SRC_TYPE_STRUCT}, {"ACPI_TABLE_TYPE", SRC_TYPE_SIMPLE}, + {"ACPI_TAG_INFO", SRC_TYPE_STRUCT}, {"ACPI_THREAD_ID", SRC_TYPE_SIMPLE}, {"ACPI_THREAD_STATE", SRC_TYPE_STRUCT}, {"ACPI_TYPED_IDENTIFIER_TABLE", SRC_TYPE_STRUCT}, diff --git a/tools/acpixtract/Makefile b/tools/acpixtract/Makefile index 8b7bcf9d6cee..4e04b636e935 100644 --- a/tools/acpixtract/Makefile +++ b/tools/acpixtract/Makefile @@ -19,21 +19,42 @@ PROG = acpixtract HOST = _LINUX NOMAN = YES -COMPILE = $(CC) -c $(CFLAGS) $(CWARNINGFLAGS) -o$@ $? +COMPILE = $(CC) -c $(CFLAGS) $(CWARNINGFLAGS) -o$@ $< ACPICA_COMPONENTS = -ACPICA_SRC = ../.. -ACPICA_COMMON = $(ACPICA_SRC)/common -ACPICA_CORE = $(ACPICA_SRC)$(ACPICA_COMPONENTS) -ACPICA_TOOLS = $(ACPICA_SRC)/tools -ACPICA_OSL = $(ACPICA_SRC)/os_specific/service_layers -INSTALLDIR = /usr/bin -INSTALLPROG = cp --remove-destination $(PROG) $(INSTALLDIR) +ACPICA_SRC = ../.. +ACPICA_INCLUDE = $(ACPICA_SRC)/include +ACPICA_COMMON = $(ACPICA_SRC)/common +ACPICA_CORE = $(ACPICA_SRC)$(ACPICA_COMPONENTS) +ACPICA_TOOLS = $(ACPICA_SRC)/tools +ACPIXTRACT = $(ACPICA_TOOLS)/acpixtract +INSTALLDIR = /usr/bin +INSTALLPROG = cp --remove-destination $(PROG) $(INSTALLDIR) + +ACPICA_HEADERS = \ + $(wildcard $(ACPICA_INCLUDE)/*.h) \ + $(wildcard $(ACPICA_INCLUDE)/platform/*.h) + +# +# Search paths for source files +# +vpath %.c \ + $(ACPIXTRACT) \ + $(ACPICA_COMMON) + +HEADERS = \ + $(wildcard $(ACPIXTRACT)/*.h) + +OBJECTS = \ + acpixtract.o \ + axmain.o \ + getopt.o CFLAGS+= \ -D$(HOST) \ -D_GNU_SOURCE \ - -I$(ACPICA_SRC)/include + -DACPI_XTRACT_APP \ + -I$(ACPICA_INCLUDE) CWARNINGFLAGS = \ -ansi \ @@ -50,24 +71,36 @@ CWARNINGFLAGS = \ -Wpointer-arith \ -Wundef -OBJS = \ - acpixtract.o +# +# gcc 4+ flags +# +CWARNINGFLAGS += \ + -Waddress \ + -Waggregate-return \ + -Wchar-subscripts \ + -Wempty-body \ + -Wlogical-op \ + -Wmissing-declarations \ + -Wmissing-field-initializers \ + -Wmissing-parameter-type \ + -Wnested-externs \ + -Wold-style-declaration \ + -Wold-style-definition \ + -Wredundant-decls \ + -Wtype-limits # -# Root rule +# Rules # -$(PROG) : $(OBJS) - $(CC) $(LDFLAGS) $(OBJS) -o $(PROG) +$(PROG) : $(OBJECTS) + $(CC) $(LDFLAGS) $(OBJECTS) -o $(PROG) + $(COPYPROG) -# -# acpixtract source -# -acpixtract.o : $(ACPICA_TOOLS)/acpixtract/acpixtract.c +%.o : %.c $(HEADERS) $(ACPICA_HEADERS) $(COMPILE) - clean : - rm -f $(PROG) $(PROG).exe $(OBJS) + rm -f $(PROG) $(PROG).exe $(OBJECTS) install : $(INSTALLPROG) diff --git a/tools/acpixtract/acpixtract.c b/tools/acpixtract/acpixtract.c index 4393595ee967..318b7e9b561f 100644 --- a/tools/acpixtract/acpixtract.c +++ b/tools/acpixtract/acpixtract.c @@ -1,4 +1,3 @@ - /****************************************************************************** * * Module Name: acpixtract - convert ascii ACPI tables to binary @@ -42,121 +41,117 @@ * POSSIBILITY OF SUCH DAMAGES. */ +#include "acpi.h" +#include "accommon.h" +#include "acapps.h" + #include #include #include #include - -/* Note: This is a 32-bit program only */ - -#define VERSION 0x20110330 -#define FIND_HEADER 0 -#define EXTRACT_DATA 1 -#define BUFFER_SIZE 256 -#define MIN_HEADER_LENGTH 6 /* strlen ("DSDT @") */ - /* Local prototypes */ static void -CheckAscii ( +AxStrlwr ( + char *String); + +static void +AxCheckAscii ( char *Name, int Count); static void -NormalizeSignature ( +AxNormalizeSignature ( char *Signature); static unsigned int -GetNextInstance ( +AxGetNextInstance ( char *InputPathname, char *Signature); -static int -ExtractTables ( - char *InputPathname, - char *Signature, - unsigned int MinimumInstances); - static size_t -GetTableHeader ( +AxGetTableHeader ( FILE *InputFile, unsigned char *OutputData); static unsigned int -CountTableInstances ( +AxCountTableInstances ( char *InputPathname, char *Signature); -static int -ListTables ( +int +AxExtractTables ( + char *InputPathname, + char *Signature, + unsigned int MinimumInstances); + +int +AxListTables ( char *InputPathname); static size_t -ConvertLine ( +AxConvertLine ( char *InputLine, unsigned char *OutputData); -static void -DisplayUsage ( - void); - -typedef struct acpi_table_header +typedef struct AxTableInfo { - char Signature[4]; - int Length; - unsigned char Revision; - unsigned char Checksum; - char OemId[6]; - char OemTableId[8]; - int OemRevision; - char AslCompilerId[4]; - int AslCompilerRevision; - -} ACPI_TABLE_HEADER; - -struct TableInfo -{ - unsigned int Signature; + UINT32 Signature; unsigned int Instances; unsigned int NextInstance; - struct TableInfo *Next; -}; + struct AxTableInfo *Next; -static struct TableInfo *ListHead = NULL; +} AX_TABLE_INFO; + +/* Extraction states */ + +#define AX_STATE_FIND_HEADER 0 +#define AX_STATE_EXTRACT_DATA 1 + +/* Miscellaneous constants */ + +#define AX_LINE_BUFFER_SIZE 256 +#define AX_MIN_TABLE_NAME_LENGTH 6 /* strlen ("DSDT @") */ + + +static AX_TABLE_INFO *AxTableListHead = NULL; static char Filename[16]; static unsigned char Data[16]; +static char LineBuffer[AX_LINE_BUFFER_SIZE]; +static char HeaderBuffer[AX_LINE_BUFFER_SIZE]; +static char InstanceBuffer[AX_LINE_BUFFER_SIZE]; -/****************************************************************************** +/******************************************************************************* * - * FUNCTION: DisplayUsage + * FUNCTION: AxStrlwr * - * DESCRIPTION: Usage message + * PARAMETERS: String - Ascii string + * + * RETURN: None + * + * DESCRIPTION: String lowercase function. * ******************************************************************************/ static void -DisplayUsage ( - void) +AxStrlwr ( + char *String) { - printf ("Usage: acpixtract [option] \n"); - printf ("\nExtract binary ACPI tables from text acpidump output\n"); - printf ("Default invocation extracts all DSDTs and SSDTs\n"); - printf ("Version %8.8X\n\n", VERSION); - printf ("Options:\n"); - printf (" -a Extract all tables, not just DSDT/SSDT\n"); - printf (" -l List table summaries, do not extract\n"); - printf (" -s Extract all tables named \n"); - printf ("\n"); + while (*String) + { + *String = (char) tolower ((int) *String); + String++; + } } /******************************************************************************* * - * FUNCTION: CheckAscii + * FUNCTION: AxCheckAscii * * PARAMETERS: Name - Ascii string, at least as long as Count * Count - Number of characters to check @@ -169,7 +164,7 @@ DisplayUsage ( ******************************************************************************/ static void -CheckAscii ( +AxCheckAscii ( char *Name, int Count) { @@ -188,7 +183,7 @@ CheckAscii ( /******************************************************************************* * - * FUNCTION: NormalizeSignature + * FUNCTION: AxNormalizeSignature * * PARAMETERS: Name - Ascii string containing an ACPI signature * @@ -199,7 +194,7 @@ CheckAscii ( ******************************************************************************/ static void -NormalizeSignature ( +AxNormalizeSignature ( char *Signature) { @@ -212,7 +207,7 @@ NormalizeSignature ( /****************************************************************************** * - * FUNCTION: ConvertLine + * FUNCTION: AxConvertLine * * PARAMETERS: InputLine - One line from the input acpidump file * OutputData - Where the converted data is returned @@ -224,7 +219,7 @@ NormalizeSignature ( ******************************************************************************/ static size_t -ConvertLine ( +AxConvertLine ( char *InputLine, unsigned char *OutputData) { @@ -270,7 +265,7 @@ ConvertLine ( /****************************************************************************** * - * FUNCTION: GetTableHeader + * FUNCTION: AxGetTableHeader * * PARAMETERS: InputFile - Handle for the input acpidump file * OutputData - Where the table header is returned @@ -282,26 +277,25 @@ ConvertLine ( ******************************************************************************/ static size_t -GetTableHeader ( +AxGetTableHeader ( FILE *InputFile, unsigned char *OutputData) { size_t BytesConverted; size_t TotalConverted = 0; - char Buffer[BUFFER_SIZE]; int i; - /* Get the full 36 byte header, requires 3 lines */ + /* Get the full 36 byte ACPI table header, requires 3 input text lines */ for (i = 0; i < 3; i++) { - if (!fgets (Buffer, BUFFER_SIZE, InputFile)) + if (!fgets (HeaderBuffer, AX_LINE_BUFFER_SIZE, InputFile)) { return (TotalConverted); } - BytesConverted = ConvertLine (Buffer, OutputData); + BytesConverted = AxConvertLine (HeaderBuffer, OutputData); TotalConverted += BytesConverted; OutputData += 16; @@ -317,7 +311,7 @@ GetTableHeader ( /****************************************************************************** * - * FUNCTION: CountTableInstances + * FUNCTION: AxCountTableInstances * * PARAMETERS: InputPathname - Filename for acpidump file * Signature - Requested signature to count @@ -330,11 +324,10 @@ GetTableHeader ( ******************************************************************************/ static unsigned int -CountTableInstances ( +AxCountTableInstances ( char *InputPathname, char *Signature) { - char Buffer[BUFFER_SIZE]; FILE *InputFile; unsigned int Instances = 0; @@ -348,18 +341,18 @@ CountTableInstances ( /* Count the number of instances of this signature */ - while (fgets (Buffer, BUFFER_SIZE, InputFile)) + while (fgets (InstanceBuffer, AX_LINE_BUFFER_SIZE, InputFile)) { /* Ignore empty lines and lines that start with a space */ - if ((Buffer[0] == ' ') || - (Buffer[0] == '\n')) + if ((InstanceBuffer[0] == ' ') || + (InstanceBuffer[0] == '\n')) { continue; } - NormalizeSignature (Buffer); - if (!strncmp (Buffer, Signature, 4)) + AxNormalizeSignature (InstanceBuffer); + if (!strncmp (InstanceBuffer, Signature, 4)) { Instances++; } @@ -372,7 +365,7 @@ CountTableInstances ( /****************************************************************************** * - * FUNCTION: GetNextInstance + * FUNCTION: AxGetNextInstance * * PARAMETERS: InputPathname - Filename for acpidump file * Signature - Requested ACPI signature @@ -388,17 +381,17 @@ CountTableInstances ( ******************************************************************************/ static unsigned int -GetNextInstance ( +AxGetNextInstance ( char *InputPathname, char *Signature) { - struct TableInfo *Info; + AX_TABLE_INFO *Info; - Info = ListHead; + Info = AxTableListHead; while (Info) { - if (*(unsigned int *) Signature == Info->Signature) + if (*(UINT32 *) Signature == Info->Signature) { break; } @@ -410,18 +403,18 @@ GetNextInstance ( { /* Signature not found, create new table info block */ - Info = malloc (sizeof (struct TableInfo)); + Info = malloc (sizeof (AX_TABLE_INFO)); if (!Info) { printf ("Could not allocate memory\n"); exit (0); } - Info->Signature = *(unsigned int *) Signature; - Info->Instances = CountTableInstances (InputPathname, Signature); + Info->Signature = *(UINT32 *) Signature; + Info->Instances = AxCountTableInstances (InputPathname, Signature); Info->NextInstance = 1; - Info->Next = ListHead; - ListHead = Info; + Info->Next = AxTableListHead; + AxTableListHead = Info; } if (Info->Instances > 1) @@ -435,7 +428,7 @@ GetNextInstance ( /****************************************************************************** * - * FUNCTION: ExtractTables + * FUNCTION: AxExtractTables * * PARAMETERS: InputPathname - Filename for acpidump file * Signature - Requested ACPI signature to extract. @@ -448,19 +441,18 @@ GetNextInstance ( * ******************************************************************************/ -static int -ExtractTables ( +int +AxExtractTables ( char *InputPathname, char *Signature, unsigned int MinimumInstances) { - char Buffer[BUFFER_SIZE]; FILE *InputFile; FILE *OutputFile = NULL; size_t BytesWritten; size_t TotalBytesWritten = 0; size_t BytesConverted; - unsigned int State = FIND_HEADER; + unsigned int State = AX_STATE_FIND_HEADER; unsigned int FoundTable = 0; unsigned int Instances = 0; unsigned int ThisInstance; @@ -481,9 +473,9 @@ ExtractTables ( { /* Are there enough instances of the table to continue? */ - NormalizeSignature (Signature); + AxNormalizeSignature (Signature); - Instances = CountTableInstances (InputPathname, Signature); + Instances = AxCountTableInstances (InputPathname, Signature); if (Instances < MinimumInstances) { printf ("Table %s was not found in %s\n", Signature, InputPathname); @@ -499,42 +491,43 @@ ExtractTables ( /* Convert all instances of the table to binary */ - while (fgets (Buffer, BUFFER_SIZE, InputFile)) + while (fgets (LineBuffer, AX_LINE_BUFFER_SIZE, InputFile)) { switch (State) { - case FIND_HEADER: + case AX_STATE_FIND_HEADER: /* Ignore lines that are too short to be header lines */ - if (strlen (Buffer) < MIN_HEADER_LENGTH) + if (strlen (LineBuffer) < AX_MIN_TABLE_NAME_LENGTH) { continue; } /* Ignore empty lines and lines that start with a space */ - if ((Buffer[0] == ' ') || - (Buffer[0] == '\n')) + if ((LineBuffer[0] == ' ') || + (LineBuffer[0] == '\n')) { continue; } /* - * Ignore lines that are not of the form @ . Examples: + * Ignore lines that are not of the form @ . + * Examples of lines that must be supported: * * DSDT @ 0x737e4000 * XSDT @ 0x737f2fff * RSD PTR @ 0xf6cd0 * SSDT @ (nil) */ - if (!strstr (Buffer, " @ ")) + if (!strstr (LineBuffer, " @ ")) { continue; } - NormalizeSignature (Buffer); - strncpy (ThisSignature, Buffer, 4); + AxNormalizeSignature (LineBuffer); + strncpy (ThisSignature, LineBuffer, 4); if (Signature) { @@ -550,7 +543,7 @@ ExtractTables ( * Get the instance number for this signature. Only the * SSDT and PSDT tables can have multiple instances. */ - ThisInstance = GetNextInstance (InputPathname, ThisSignature); + ThisInstance = AxGetNextInstance (InputPathname, ThisSignature); /* Build an output filename and create/open the output file */ @@ -563,6 +556,7 @@ ExtractTables ( sprintf (Filename, "%4.4s.dat", ThisSignature); } + AxStrlwr (Filename); OutputFile = fopen (Filename, "w+b"); if (!OutputFile) { @@ -571,21 +565,21 @@ ExtractTables ( goto CleanupAndExit; } - State = EXTRACT_DATA; + State = AX_STATE_EXTRACT_DATA; TotalBytesWritten = 0; FoundTable = 1; continue; - case EXTRACT_DATA: + case AX_STATE_EXTRACT_DATA: /* Empty line or non-data line terminates the data */ - if ((Buffer[0] == '\n') || - (Buffer[0] != ' ')) + if ((LineBuffer[0] == '\n') || + (LineBuffer[0] != ' ')) { fclose (OutputFile); OutputFile = NULL; - State = FIND_HEADER; + State = AX_STATE_FIND_HEADER; printf ("Acpi table [%4.4s] - %u bytes written to %s\n", ThisSignature, (unsigned int) TotalBytesWritten, Filename); @@ -594,7 +588,7 @@ ExtractTables ( /* Convert the ascii data (one line of text) to binary */ - BytesConverted = ConvertLine (Buffer, Data); + BytesConverted = AxConvertLine (LineBuffer, Data); /* Write the binary data */ @@ -628,7 +622,7 @@ ExtractTables ( if (OutputFile) { fclose (OutputFile); - if (State == EXTRACT_DATA) + if (State == AX_STATE_EXTRACT_DATA) { /* Received an EOF while extracting data */ @@ -644,7 +638,7 @@ ExtractTables ( /****************************************************************************** * - * FUNCTION: ListTables + * FUNCTION: AxListTables * * PARAMETERS: InputPathname - Filename for acpidump file * @@ -655,12 +649,11 @@ ExtractTables ( * ******************************************************************************/ -static int -ListTables ( +int +AxListTables ( char *InputPathname) { FILE *InputFile; - char Buffer[BUFFER_SIZE]; size_t HeaderSize; unsigned char Header[48]; int TableCount = 0; @@ -681,19 +674,19 @@ ListTables ( printf ("\nSignature Length Revision OemId OemTableId" " OemRevision CompilerId CompilerRevision\n\n"); - while (fgets (Buffer, BUFFER_SIZE, InputFile)) + while (fgets (LineBuffer, AX_LINE_BUFFER_SIZE, InputFile)) { /* Ignore empty lines and lines that start with a space */ - if ((Buffer[0] == ' ') || - (Buffer[0] == '\n')) + if ((LineBuffer[0] == ' ') || + (LineBuffer[0] == '\n')) { continue; } /* Get the 36 byte header and display the fields */ - HeaderSize = GetTableHeader (InputFile, Header); + HeaderSize = AxGetTableHeader (InputFile, Header); if (HeaderSize < 16) { continue; @@ -703,7 +696,7 @@ ListTables ( if (!strncmp (TableHeader->Signature, "RSD PTR ", 8)) { - CheckAscii ((char *) &Header[9], 6); + AxCheckAscii ((char *) &Header[9], 6); printf ("%8.4s \"%6.6s\"\n", "RSDP", &Header[9]); TableCount++; continue; @@ -711,7 +704,7 @@ ListTables ( /* Minimum size for table with standard header */ - if (HeaderSize < 36) + if (HeaderSize < sizeof (ACPI_TABLE_HEADER)) { continue; } @@ -731,9 +724,9 @@ ListTables ( /* OEM IDs and Compiler IDs */ - CheckAscii (TableHeader->OemId, 6); - CheckAscii (TableHeader->OemTableId, 8); - CheckAscii (TableHeader->AslCompilerId, 4); + AxCheckAscii (TableHeader->OemId, 6); + AxCheckAscii (TableHeader->OemTableId, 8); + AxCheckAscii (TableHeader->AslCompilerId, 4); printf (" %2.2X \"%6.6s\" \"%8.8s\" %8.8X \"%4.4s\" %8.8X\n", TableHeader->Revision, TableHeader->OemId, @@ -741,80 +734,7 @@ ListTables ( TableHeader->AslCompilerId, TableHeader->AslCompilerRevision); } - printf ("\nFound %u ACPI tables [%8.8X]\n", TableCount, VERSION); + printf ("\nFound %u ACPI tables\n", TableCount); fclose (InputFile); return (0); } - - -/****************************************************************************** - * - * FUNCTION: main - * - * DESCRIPTION: C main function - * - ******************************************************************************/ - -int -main ( - int argc, - char *argv[]) -{ - int Status; - - - if (argc < 2) - { - DisplayUsage (); - return (0); - } - - if (argv[1][0] == '-') - { - if (argc < 3) - { - DisplayUsage (); - return (0); - } - - switch (argv[1][1]) - { - case 'a': - - /* Extract all tables found */ - - return (ExtractTables (argv[2], NULL, 0)); - - case 'l': - - /* List tables only, do not extract */ - - return (ListTables (argv[2])); - - case 's': - - /* Extract only tables with this signature */ - - return (ExtractTables (argv[2], &argv[1][2], 1)); - - default: - DisplayUsage (); - return (0); - } - } - - /* - * Default output is the DSDT and all SSDTs. One DSDT is required, - * any SSDTs are optional. - */ - Status = ExtractTables (argv[1], "DSDT", 1); - if (Status) - { - return (Status); - } - - Status = ExtractTables (argv[1], "SSDT", 0); - return (Status); -} - - diff --git a/tools/acpixtract/axmain.c b/tools/acpixtract/axmain.c new file mode 100644 index 000000000000..06db150912cf --- /dev/null +++ b/tools/acpixtract/axmain.c @@ -0,0 +1,191 @@ +/****************************************************************************** + * + * Module Name: axmain - main module for acpixtract utility + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2011, 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 + + +static void +DisplayUsage ( + void); + +int +AxExtractTables ( + char *InputPathname, + char *Signature, + unsigned int MinimumInstances); + +int +AxListTables ( + char *InputPathname); + + +/* Options */ + +#define AX_EXTRACT_ALL 0 +#define AX_LIST_ALL 1 +#define AX_EXTRACT_SIGNATURE 2 +#define AX_EXTRACT_AML_TABLES 3 + +static int AxAction = AX_EXTRACT_AML_TABLES; /* DSDT & SSDTs */ + +#define AX_OPTIONAL_TABLES 0 +#define AX_REQUIRED_TABLE 1 + + +/****************************************************************************** + * + * FUNCTION: DisplayUsage + * + * DESCRIPTION: Usage message + * + ******************************************************************************/ + +static void +DisplayUsage ( + void) +{ + + ACPI_USAGE_HEADER ("acpixtract [option] "); + + ACPI_OPTION ("-a", "Extract all tables, not just DSDT/SSDT"); + ACPI_OPTION ("-l", "List table summaries, do not extract"); + ACPI_OPTION ("-s ", "Extract all tables with "); + + printf ("\nExtract binary ACPI tables from text acpidump output\n"); + printf ("Default invocation extracts the DSDT and all SSDTs\n"); +} + + +/****************************************************************************** + * + * FUNCTION: main + * + * DESCRIPTION: C main function + * + ******************************************************************************/ + +int +main ( + int argc, + char *argv[]) +{ + char *Filename; + int Status; + int j; + + + printf (ACPI_COMMON_SIGNON ("ACPI Binary Table Extraction Utility")); + + if (argc < 2) + { + DisplayUsage (); + return (0); + } + + /* Command line options */ + + while ((j = AcpiGetopt (argc, argv, "ahls:")) != EOF) switch (j) + { + case 'a': + AxAction = AX_EXTRACT_ALL; /* Extract all tables found */ + break; + + case 'l': + AxAction = AX_LIST_ALL; /* List tables only, do not extract */ + break; + + case 's': + AxAction = AX_EXTRACT_SIGNATURE; /* Extract only tables with this sig */ + break; + + case 'h': + default: + DisplayUsage (); + return (0); + } + + /* Input filename is always required */ + + Filename = argv[AcpiGbl_Optind]; + if (!Filename) + { + printf ("Missing required input filename\n"); + return (-1); + } + + /* Perform requested action */ + + switch (AxAction) + { + case AX_EXTRACT_ALL: + Status = AxExtractTables (Filename, NULL, AX_OPTIONAL_TABLES); + break; + + case AX_LIST_ALL: + Status = AxListTables (Filename); + break; + + case AX_EXTRACT_SIGNATURE: + Status = AxExtractTables (Filename, AcpiGbl_Optarg, AX_REQUIRED_TABLE); + break; + + default: + /* + * Default output is the DSDT and all SSDTs. One DSDT is required, + * any SSDTs are optional. + */ + Status = AxExtractTables (Filename, "DSDT", AX_REQUIRED_TABLE); + if (Status) + { + return (Status); + } + + Status = AxExtractTables (Filename, "SSDT", AX_OPTIONAL_TABLES); + break; + } + + return (Status); +}