diff options
66 files changed, 3380 insertions, 1290 deletions
diff --git a/changes.txt b/changes.txt index 58483351c0fe..cf247faf826e 100644 --- a/changes.txt +++ b/changes.txt @@ -1,6 +1,100 @@  ---------------------------------------- -17 January 2013. Summary of changes for version 20130117: +14 February 2013. Summary of changes for version 20130214: + +1) ACPICA Kernel-resident Subsystem: + +Fixed a possible regression on some hosts: Reinstated the safe return  +macros (return_ACPI_STATUS, etc.) that ensure that the argument is  +evaluated only once. Although these macros are not needed for the ACPICA  +code itself, they are often used by ACPI-related host device drivers where  +the safe feature may be necessary. + +Fixed several issues related to the ACPI 5.0 reduced hardware support  +(SOC): Now ensure that if the platform declares itself as hardware-reduced  +via the FADT, the following functions become NOOPs (and always return  +AE_OK) because ACPI is always enabled by definition on these machines: +  AcpiEnable +  AcpiDisable +  AcpiHwGetMode +  AcpiHwSetMode + +Dynamic Object Repair: Implemented additional runtime repairs for  +predefined name return values. Both of these repairs can simplify code in  +the related device drivers that invoke these methods: +1) For the _STR and _MLS names, automatically repair/convert an ASCII  +string to a Unicode buffer.  +2) For the _CRS, _PRS, and _DMA names, return a resource descriptor with a  +lone end tag descriptor in the following cases: A Return(0) was executed,  +a null buffer was returned, or no object at all was returned (non-slack  +mode only). Adds a new file, nsconvert.c +ACPICA BZ 998. Bob Moore, Lv Zheng. + +Resource Manager: Added additional code to prevent possible infinite loops  +while traversing corrupted or ill-formed resource template buffers. Check  +for zero-length resource descriptors in all code that loops through  +resource templates (the length field is used to index through the  +template). This change also hardens the external AcpiWalkResources and  +AcpiWalkResourceBuffer interfaces. + +Local Cache Manager: Enhanced the main data structure to eliminate an  +unnecessary mechanism to access the next object in the list. Actually  +provides a small performance enhancement for hosts that use the local  +ACPICA cache manager. Jung-uk Kim. + +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: +    Non-Debug Version:  94.5K Code, 25.4K Data, 119.9K Total +    Debug Version:     182.3K Code, 75.0K Data, 257.3K Total +  Current Release: +    Non-Debug Version:  95.0K Code, 25.9K Data, 120.9K Total +    Debug Version:     182.9K Code, 75.6K Data, 258.5K Total + + +2) iASL Compiler/Disassembler and Tools: + +iASL/Disassembler: Fixed several issues with the definition of the ACPI  +5.0 RASF table (RAS Feature Table). This change incorporates late changes  +that were made to the ACPI 5.0 specification. + +iASL/Disassembler: Added full support for the following new ACPI tables: +  1) The MTMR table (MID Timer Table) +  2) The VRTC table (Virtual Real Time Clock Table). +Includes header file, disassembler, table compiler, and template support  +for both tables. + +iASL: Implemented compile-time validation of package objects returned by  +predefined names. This new feature validates static package objects  +returned by the various predefined names defined to return packages. Both  +object types and package lengths are validated, for both parent packages  +and sub-packages, if any. The code is similar in structure and behavior to  +the runtime repair mechanism within the AML interpreter and uses the  +existing predefined name information table. Adds a new file, aslprepkg.c.  +ACPICA BZ 938. +iASL: Implemented auto-detection of binary ACPI tables for disassembly.  +This feature detects a binary file with a valid ACPI table header and  +invokes the disassembler automatically. Eliminates the need to  +specifically invoke the disassembler with the -d option. ACPICA BZ 862. + +iASL/Disassembler: Added several warnings for the case where there are  +unresolved control methods during the disassembly. This can potentially  +cause errors when the output file is compiled, because the disassembler  +assumes zero method arguments in these cases (it cannot determine the  +actual number of arguments without resolution/definition of the method). + +Debugger: Added support to display all resources with a single command.  +Invocation of the resources command with no arguments will now display all  +resources within the current namespace. + +AcpiHelp: Added descriptive text for each ACPICA exception code displayed  +via the -e option. + +---------------------------------------- +17 January 2013. Summary of changes for version 20130117:  1) ACPICA Kernel-resident Subsystem: diff --git a/generate/unix/Makefile.config b/generate/unix/Makefile.config index 5a42cc84184c..65242e0a9832 100644 --- a/generate/unix/Makefile.config +++ b/generate/unix/Makefile.config @@ -19,12 +19,16 @@  #  # Configuration +# +# OPT_CFLAGS can be overridden on the make command line by +#   adding OPT_CFLAGS="..." to the invocation. +#  # Notes:  #   $(BITS) must be set to either 32 or 64  #   gcc should be version 4 or greater, otherwise some of the options  #       used will not be recognized. -#   Global optimization flags (such as -O2, -Os) are not used, since -#       they cause issues on some compilers. +#   Global optimization flags (such as -O2, -Os) may cause issues on +#       some compilers.  #   The _GNU_SOURCE symbol is required for many hosts.  #  .SUFFIXES : @@ -38,7 +42,7 @@ CC =    gcc  OBJDIR =     obj$(BITS)  BINDIR =     bin$(BITS)  BITSFLAG =   -m$(BITS) -COMPILEOBJ = $(CC) -c $(CFLAGS) $(CWARNINGFLAGS) -o$@ $< +COMPILEOBJ = $(CC) -c $(CFLAGS) $(OPT_CFLAGS) -o $@ $<  LINKPROG =   $(CC) $(OBJECTS) -o $(PROG) $(LDFLAGS)  INSTALLDIR = /usr/bin  INSTALLPROG = install -D ../$(BINDIR)/$(PROG) $(DESTDIR)$(INSTALLDIR)/$(PROG) @@ -100,58 +104,65 @@ ACPICA_HEADERS = \      $(wildcard $(ACPICA_INCLUDE)/platform/*.h)  # -# Common compiler flags. The warning flags in addition to -Wall are not -# automatically included in -Wall. +# Common compiler flags  # +OPT_CFLAGS ?= \ +    -D_FORTIFY_SOURCE=2\ +    -O2\ +    $(CWARNINGFLAGS) +  CFLAGS += \ -    $(BITSFLAG) \ -    -D$(HOST) \ -    -D_GNU_SOURCE \ -    -D_FORTIFY_SOURCE=2 \ +    $(BITSFLAG)\ +    -D$(HOST)\ +    -D_GNU_SOURCE\      -I$(ACPICA_INCLUDE)  LDFLAGS += $(BITSFLAG) +# +# Common compiler warning flags. The warning flags in addition +# to -Wall are not automatically included in -Wall. +#  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 \ +    -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 +# Additional gcc 4+ warning 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 \ +    -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  # -# Extra warning flags (possible future use) +# Extra warning flags (for possible future use)  #  #CWARNINGFLAGS += \ -#	-Wcast-qual \ -#	-Wconversion -#	-Wshadow \ +#	-Wcast-qual\ +#	-Wconversion\ +#	-Wshadow\  #  # Bison/Flex configuration diff --git a/generate/unix/acpibin/Makefile b/generate/unix/acpibin/Makefile index ccc5d52c949d..1f6eb80e8b8c 100644 --- a/generate/unix/acpibin/Makefile +++ b/generate/unix/acpibin/Makefile @@ -18,38 +18,38 @@ PROG = $(OBJDIR)/acpibin  # Search paths for source files  #  vpath %.c \ -    $(ACPIBIN) \ -    $(ACPICA_UTILITIES) \ -    $(ACPICA_COMMON) \ +    $(ACPIBIN)\ +    $(ACPICA_UTILITIES)\ +    $(ACPICA_COMMON)\      $(ACPICA_OSL)  HEADERS = \      $(wildcard $(ACPIBIN)/*.h)  OBJECTS = \ -	$(OBJDIR)/abcompare.o \ -	$(OBJDIR)/abmain.o \ -	$(OBJDIR)/utalloc.o \ -	$(OBJDIR)/utcache.o \ -	$(OBJDIR)/utdebug.o \ -	$(OBJDIR)/utdecode.o \ -	$(OBJDIR)/utexcep.o \ -	$(OBJDIR)/utglobal.o \ -	$(OBJDIR)/utlock.o \ -	$(OBJDIR)/utmath.o \ -	$(OBJDIR)/utmisc.o \ -	$(OBJDIR)/utmutex.o \ -	$(OBJDIR)/utstate.o \ -	$(OBJDIR)/utstring.o \ -	$(OBJDIR)/utxferror.o \ -	$(OBJDIR)/osunixxf.o \ +	$(OBJDIR)/abcompare.o\ +	$(OBJDIR)/abmain.o\ +	$(OBJDIR)/utalloc.o\ +	$(OBJDIR)/utcache.o\ +	$(OBJDIR)/utdebug.o\ +	$(OBJDIR)/utdecode.o\ +	$(OBJDIR)/utexcep.o\ +	$(OBJDIR)/utglobal.o\ +	$(OBJDIR)/utlock.o\ +	$(OBJDIR)/utmath.o\ +	$(OBJDIR)/utmisc.o\ +	$(OBJDIR)/utmutex.o\ +	$(OBJDIR)/utstate.o\ +	$(OBJDIR)/utstring.o\ +	$(OBJDIR)/utxferror.o\ +	$(OBJDIR)/osunixxf.o\  	$(OBJDIR)/getopt.o  #  # Flags specific to acpibin  # -CFLAGS+= \ -    -DACPI_BIN_APP \ +CFLAGS += \ +    -DACPI_BIN_APP\      -I$(ACPIBIN)  # diff --git a/generate/unix/acpiexec/Makefile b/generate/unix/acpiexec/Makefile index 61b5119b03bb..5ac3da32641c 100644 --- a/generate/unix/acpiexec/Makefile +++ b/generate/unix/acpiexec/Makefile @@ -20,202 +20,204 @@ PROG = $(OBJDIR)/acpiexec  # 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) \ +    $(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)  HEADERS = \      $(wildcard $(ACPIEXEC)/*.h)  OBJECTS = \ -	$(OBJDIR)/aeexec.o \ -	$(OBJDIR)/aehandlers.o \ -	$(OBJDIR)/aemain.o \ -	$(OBJDIR)/aetables.o \ -	$(OBJDIR)/dbcmds.o \ -	$(OBJDIR)/dbconvert.o \ -	$(OBJDIR)/dbdisply.o \ -	$(OBJDIR)/dbexec.o \ -	$(OBJDIR)/dbfileio.o \ -	$(OBJDIR)/dbhistry.o \ -	$(OBJDIR)/dbinput.o \ -	$(OBJDIR)/dbmethod.o \ -	$(OBJDIR)/dbnames.o \ -	$(OBJDIR)/dbstats.o \ -	$(OBJDIR)/dbutils.o \ -	$(OBJDIR)/dbxface.o \ -	$(OBJDIR)/dmbuffer.o \ -	$(OBJDIR)/dmdeferred.o \ -	$(OBJDIR)/dmnames.o \ -	$(OBJDIR)/dmobject.o \ -	$(OBJDIR)/dmopcode.o \ -	$(OBJDIR)/dmresrc.o \ -	$(OBJDIR)/dmresrcl.o \ -	$(OBJDIR)/dmresrcl2.o \ -	$(OBJDIR)/dmresrcs.o \ -	$(OBJDIR)/dmutils.o \ -	$(OBJDIR)/dmwalk.o \ -	$(OBJDIR)/dsargs.o \ -	$(OBJDIR)/dscontrol.o \ -	$(OBJDIR)/dsfield.o \ -	$(OBJDIR)/dsinit.o \ -	$(OBJDIR)/dsmethod.o \ -	$(OBJDIR)/dsmthdat.o \ -	$(OBJDIR)/dsobject.o \ -	$(OBJDIR)/dsopcode.o \ -	$(OBJDIR)/dsutils.o \ -	$(OBJDIR)/dswexec.o \ -	$(OBJDIR)/dswload.o \ -	$(OBJDIR)/dswload2.o \ -	$(OBJDIR)/dswscope.o \ -	$(OBJDIR)/dswstate.o \ -	$(OBJDIR)/evevent.o \ -	$(OBJDIR)/evglock.o \ -	$(OBJDIR)/evgpe.o \ -	$(OBJDIR)/evgpeblk.o \ -	$(OBJDIR)/evgpeinit.o \ -	$(OBJDIR)/evgpeutil.o \ -	$(OBJDIR)/evhandler.o \ -	$(OBJDIR)/evmisc.o \ -	$(OBJDIR)/evregion.o \ -	$(OBJDIR)/evrgnini.o \ -	$(OBJDIR)/evsci.o \ -	$(OBJDIR)/evxface.o \ -	$(OBJDIR)/evxfevnt.o \ -	$(OBJDIR)/evxfgpe.o \ -	$(OBJDIR)/evxfregn.o \ -	$(OBJDIR)/exconfig.o \ -	$(OBJDIR)/exconvrt.o \ -	$(OBJDIR)/excreate.o \ -	$(OBJDIR)/exdebug.o \ -	$(OBJDIR)/exdump.o \ -	$(OBJDIR)/exfield.o \ -	$(OBJDIR)/exfldio.o \ -	$(OBJDIR)/exmisc.o \ -	$(OBJDIR)/exmutex.o \ -	$(OBJDIR)/exnames.o \ -	$(OBJDIR)/exoparg1.o \ -	$(OBJDIR)/exoparg2.o \ -	$(OBJDIR)/exoparg3.o \ -	$(OBJDIR)/exoparg6.o \ -	$(OBJDIR)/exprep.o \ -	$(OBJDIR)/exregion.o \ -	$(OBJDIR)/exresnte.o \ -	$(OBJDIR)/exresolv.o \ -	$(OBJDIR)/exresop.o \ -	$(OBJDIR)/exstore.o \ -	$(OBJDIR)/exstoren.o \ -	$(OBJDIR)/exstorob.o \ -	$(OBJDIR)/exsystem.o \ -	$(OBJDIR)/exutils.o \ -	$(OBJDIR)/getopt.o \ -	$(OBJDIR)/hwacpi.o \ -	$(OBJDIR)/hwesleep.o \ -	$(OBJDIR)/hwgpe.o \ -	$(OBJDIR)/hwpci.o \ -	$(OBJDIR)/hwregs.o \ -	$(OBJDIR)/hwsleep.o \ -	$(OBJDIR)/hwvalid.o \ -	$(OBJDIR)/hwxface.o \ -	$(OBJDIR)/hwxfsleep.o \ -	$(OBJDIR)/nsaccess.o \ -	$(OBJDIR)/nsalloc.o \ -	$(OBJDIR)/nsdump.o \ -	$(OBJDIR)/nsdumpdv.o \ -	$(OBJDIR)/nseval.o \ -	$(OBJDIR)/nsinit.o \ -	$(OBJDIR)/nsload.o \ -	$(OBJDIR)/nsnames.o \ -	$(OBJDIR)/nsobject.o \ -	$(OBJDIR)/nsparse.o \ -	$(OBJDIR)/nspredef.o \ -	$(OBJDIR)/nsprepkg.o \ -	$(OBJDIR)/nsrepair.o \ -	$(OBJDIR)/nsrepair2.o \ -	$(OBJDIR)/nssearch.o \ -	$(OBJDIR)/nsutils.o \ -	$(OBJDIR)/nswalk.o \ -	$(OBJDIR)/nsxfeval.o \ -	$(OBJDIR)/nsxfname.o \ -	$(OBJDIR)/nsxfobj.o \ -	$(OBJDIR)/osunixxf.o \ -	$(OBJDIR)/psargs.o \ -	$(OBJDIR)/psloop.o \ -	$(OBJDIR)/psobject.o \ -	$(OBJDIR)/psopcode.o \ -	$(OBJDIR)/psopinfo.o \ -	$(OBJDIR)/psparse.o \ -	$(OBJDIR)/psscope.o \ -	$(OBJDIR)/pstree.o \ -	$(OBJDIR)/psutils.o \ -	$(OBJDIR)/pswalk.o \ -	$(OBJDIR)/psxface.o \ -	$(OBJDIR)/rsaddr.o \ -	$(OBJDIR)/rscalc.o \ -	$(OBJDIR)/rscreate.o \ -	$(OBJDIR)/rsdump.o \ -	$(OBJDIR)/rsdumpinfo.o \ -	$(OBJDIR)/rsinfo.o \ -	$(OBJDIR)/rsio.o \ -	$(OBJDIR)/rsirq.o \ -	$(OBJDIR)/rslist.o \ -	$(OBJDIR)/rsmemory.o \ -	$(OBJDIR)/rsmisc.o \ -	$(OBJDIR)/rsserial.o \ -	$(OBJDIR)/rsutils.o \ -	$(OBJDIR)/rsxface.o \ -	$(OBJDIR)/tbfadt.o \ -	$(OBJDIR)/tbfind.o \ -	$(OBJDIR)/tbinstal.o \ -	$(OBJDIR)/tbutils.o \ -	$(OBJDIR)/tbxface.o \ -	$(OBJDIR)/tbxfload.o \ -	$(OBJDIR)/tbxfroot.o \ -	$(OBJDIR)/utaddress.o \ -	$(OBJDIR)/utalloc.o \ -	$(OBJDIR)/utcache.o \ -	$(OBJDIR)/utcopy.o \ -	$(OBJDIR)/utdebug.o \ -	$(OBJDIR)/utdecode.o \ -	$(OBJDIR)/utdelete.o \ -	$(OBJDIR)/uteval.o \ -	$(OBJDIR)/utexcep.o \ -	$(OBJDIR)/utglobal.o \ -	$(OBJDIR)/utids.o \ -	$(OBJDIR)/utinit.o \ -	$(OBJDIR)/utlock.o \ -	$(OBJDIR)/utmath.o \ -	$(OBJDIR)/utmisc.o \ -	$(OBJDIR)/utmutex.o \ -	$(OBJDIR)/utobject.o \ -	$(OBJDIR)/utosi.o \ -	$(OBJDIR)/utownerid.o \ -	$(OBJDIR)/utresrc.o \ -	$(OBJDIR)/utstate.o \ -	$(OBJDIR)/utstring.o \ -	$(OBJDIR)/uttrack.o \ -	$(OBJDIR)/utxface.o \ -	$(OBJDIR)/utxferror.o \ -	$(OBJDIR)/utxfinit.o \ +	$(OBJDIR)/aeexec.o\ +	$(OBJDIR)/aehandlers.o\ +	$(OBJDIR)/aemain.o\ +	$(OBJDIR)/aetables.o\ +	$(OBJDIR)/dbcmds.o\ +	$(OBJDIR)/dbconvert.o\ +	$(OBJDIR)/dbdisply.o\ +	$(OBJDIR)/dbexec.o\ +	$(OBJDIR)/dbfileio.o\ +	$(OBJDIR)/dbhistry.o\ +	$(OBJDIR)/dbinput.o\ +	$(OBJDIR)/dbmethod.o\ +	$(OBJDIR)/dbnames.o\ +	$(OBJDIR)/dbstats.o\ +	$(OBJDIR)/dbutils.o\ +	$(OBJDIR)/dbxface.o\ +	$(OBJDIR)/dmbuffer.o\ +	$(OBJDIR)/dmdeferred.o\ +	$(OBJDIR)/dmnames.o\ +	$(OBJDIR)/dmobject.o\ +	$(OBJDIR)/dmopcode.o\ +	$(OBJDIR)/dmresrc.o\ +	$(OBJDIR)/dmresrcl.o\ +	$(OBJDIR)/dmresrcl2.o\ +	$(OBJDIR)/dmresrcs.o\ +	$(OBJDIR)/dmutils.o\ +	$(OBJDIR)/dmwalk.o\ +	$(OBJDIR)/dsargs.o\ +	$(OBJDIR)/dscontrol.o\ +	$(OBJDIR)/dsfield.o\ +	$(OBJDIR)/dsinit.o\ +	$(OBJDIR)/dsmethod.o\ +	$(OBJDIR)/dsmthdat.o\ +	$(OBJDIR)/dsobject.o\ +	$(OBJDIR)/dsopcode.o\ +	$(OBJDIR)/dsutils.o\ +	$(OBJDIR)/dswexec.o\ +	$(OBJDIR)/dswload.o\ +	$(OBJDIR)/dswload2.o\ +	$(OBJDIR)/dswscope.o\ +	$(OBJDIR)/dswstate.o\ +	$(OBJDIR)/evevent.o\ +	$(OBJDIR)/evglock.o\ +	$(OBJDIR)/evgpe.o\ +	$(OBJDIR)/evgpeblk.o\ +	$(OBJDIR)/evgpeinit.o\ +	$(OBJDIR)/evgpeutil.o\ +	$(OBJDIR)/evhandler.o\ +	$(OBJDIR)/evmisc.o\ +	$(OBJDIR)/evregion.o\ +	$(OBJDIR)/evrgnini.o\ +	$(OBJDIR)/evsci.o\ +	$(OBJDIR)/evxface.o\ +	$(OBJDIR)/evxfevnt.o\ +	$(OBJDIR)/evxfgpe.o\ +	$(OBJDIR)/evxfregn.o\ +	$(OBJDIR)/exconfig.o\ +	$(OBJDIR)/exconvrt.o\ +	$(OBJDIR)/excreate.o\ +	$(OBJDIR)/exdebug.o\ +	$(OBJDIR)/exdump.o\ +	$(OBJDIR)/exfield.o\ +	$(OBJDIR)/exfldio.o\ +	$(OBJDIR)/exmisc.o\ +	$(OBJDIR)/exmutex.o\ +	$(OBJDIR)/exnames.o\ +	$(OBJDIR)/exoparg1.o\ +	$(OBJDIR)/exoparg2.o\ +	$(OBJDIR)/exoparg3.o\ +	$(OBJDIR)/exoparg6.o\ +	$(OBJDIR)/exprep.o\ +	$(OBJDIR)/exregion.o\ +	$(OBJDIR)/exresnte.o\ +	$(OBJDIR)/exresolv.o\ +	$(OBJDIR)/exresop.o\ +	$(OBJDIR)/exstore.o\ +	$(OBJDIR)/exstoren.o\ +	$(OBJDIR)/exstorob.o\ +	$(OBJDIR)/exsystem.o\ +	$(OBJDIR)/exutils.o\ +	$(OBJDIR)/getopt.o\ +	$(OBJDIR)/hwacpi.o\ +	$(OBJDIR)/hwesleep.o\ +	$(OBJDIR)/hwgpe.o\ +	$(OBJDIR)/hwpci.o\ +	$(OBJDIR)/hwregs.o\ +	$(OBJDIR)/hwsleep.o\ +	$(OBJDIR)/hwvalid.o\ +	$(OBJDIR)/hwxface.o\ +	$(OBJDIR)/hwxfsleep.o\ +	$(OBJDIR)/nsaccess.o\ +	$(OBJDIR)/nsalloc.o\ +	$(OBJDIR)/nsconvert.o\ +	$(OBJDIR)/nsdump.o\ +	$(OBJDIR)/nsdumpdv.o\ +	$(OBJDIR)/nseval.o\ +	$(OBJDIR)/nsinit.o\ +	$(OBJDIR)/nsload.o\ +	$(OBJDIR)/nsnames.o\ +	$(OBJDIR)/nsobject.o\ +	$(OBJDIR)/nsparse.o\ +	$(OBJDIR)/nspredef.o\ +	$(OBJDIR)/nsprepkg.o\ +	$(OBJDIR)/nsrepair.o\ +	$(OBJDIR)/nsrepair2.o\ +	$(OBJDIR)/nssearch.o\ +	$(OBJDIR)/nsutils.o\ +	$(OBJDIR)/nswalk.o\ +	$(OBJDIR)/nsxfeval.o\ +	$(OBJDIR)/nsxfname.o\ +	$(OBJDIR)/nsxfobj.o\ +	$(OBJDIR)/osunixxf.o\ +	$(OBJDIR)/psargs.o\ +	$(OBJDIR)/psloop.o\ +	$(OBJDIR)/psobject.o\ +	$(OBJDIR)/psopcode.o\ +	$(OBJDIR)/psopinfo.o\ +	$(OBJDIR)/psparse.o\ +	$(OBJDIR)/psscope.o\ +	$(OBJDIR)/pstree.o\ +	$(OBJDIR)/psutils.o\ +	$(OBJDIR)/pswalk.o\ +	$(OBJDIR)/psxface.o\ +	$(OBJDIR)/rsaddr.o\ +	$(OBJDIR)/rscalc.o\ +	$(OBJDIR)/rscreate.o\ +	$(OBJDIR)/rsdump.o\ +	$(OBJDIR)/rsdumpinfo.o\ +	$(OBJDIR)/rsinfo.o\ +	$(OBJDIR)/rsio.o\ +	$(OBJDIR)/rsirq.o\ +	$(OBJDIR)/rslist.o\ +	$(OBJDIR)/rsmemory.o\ +	$(OBJDIR)/rsmisc.o\ +	$(OBJDIR)/rsserial.o\ +	$(OBJDIR)/rsutils.o\ +	$(OBJDIR)/rsxface.o\ +	$(OBJDIR)/tbfadt.o\ +	$(OBJDIR)/tbfind.o\ +	$(OBJDIR)/tbinstal.o\ +	$(OBJDIR)/tbutils.o\ +	$(OBJDIR)/tbxface.o\ +	$(OBJDIR)/tbxfload.o\ +	$(OBJDIR)/tbxfroot.o\ +	$(OBJDIR)/utaddress.o\ +	$(OBJDIR)/utalloc.o\ +	$(OBJDIR)/utcache.o\ +	$(OBJDIR)/utcopy.o\ +	$(OBJDIR)/utdebug.o\ +	$(OBJDIR)/utdecode.o\ +	$(OBJDIR)/utdelete.o\ +	$(OBJDIR)/uteval.o\ +	$(OBJDIR)/utexcep.o\ +	$(OBJDIR)/utglobal.o\ +	$(OBJDIR)/utids.o\ +	$(OBJDIR)/utinit.o\ +	$(OBJDIR)/utlock.o\ +	$(OBJDIR)/utmath.o\ +	$(OBJDIR)/utmisc.o\ +	$(OBJDIR)/utmutex.o\ +	$(OBJDIR)/utobject.o\ +	$(OBJDIR)/utosi.o\ +	$(OBJDIR)/utownerid.o\ +	$(OBJDIR)/utresrc.o\ +	$(OBJDIR)/utstate.o\ +	$(OBJDIR)/utstring.o\ +	$(OBJDIR)/uttrack.o\ +	$(OBJDIR)/utxface.o\ +	$(OBJDIR)/utxferror.o\ +	$(OBJDIR)/utxfinit.o\  	$(OBJDIR)/utxfmutex.o  #  # Flags specific to acpiexec utility  # -CFLAGS+= \ -    -DACPI_EXEC_APP \ +CFLAGS += \ +    -DACPI_EXEC_APP\      -I$(ACPIEXEC) +  LDFLAGS += -lpthread -lrt  # diff --git a/generate/unix/acpihelp/Makefile b/generate/unix/acpihelp/Makefile index c44bffefb5fe..817cf98feabe 100644 --- a/generate/unix/acpihelp/Makefile +++ b/generate/unix/acpihelp/Makefile @@ -19,28 +19,28 @@ PROG = $(OBJDIR)/acpihelp  # Search paths for source files  #  vpath %.c \ -    $(ACPIHELP) \ -    $(ACPICA_COMMON) \ +    $(ACPIHELP)\ +    $(ACPICA_COMMON)\      $(ACPICA_UTILITIES)  HEADERS = \      $(wildcard $(ACPIHELP)/*.h)  OBJECTS = \ -	$(OBJDIR)/ahamlops.o \ -	$(OBJDIR)/ahaslkey.o \ -	$(OBJDIR)/ahaslops.o \ -	$(OBJDIR)/ahdecode.o \ -	$(OBJDIR)/ahpredef.o \ -	$(OBJDIR)/ahmain.o \ -	$(OBJDIR)/getopt.o \ +	$(OBJDIR)/ahamlops.o\ +	$(OBJDIR)/ahaslkey.o\ +	$(OBJDIR)/ahaslops.o\ +	$(OBJDIR)/ahdecode.o\ +	$(OBJDIR)/ahpredef.o\ +	$(OBJDIR)/ahmain.o\ +	$(OBJDIR)/getopt.o\  	$(OBJDIR)/utexcep.o  #  # Flags specific to acpihelp  # -CFLAGS+= \ -    -DACPI_HELP_APP \ +CFLAGS += \ +    -DACPI_HELP_APP\      -I$(ACPIHELP)  # diff --git a/generate/unix/acpinames/Makefile b/generate/unix/acpinames/Makefile index 6aa7666de0aa..98d95866246a 100644 --- a/generate/unix/acpinames/Makefile +++ b/generate/unix/acpinames/Makefile @@ -20,98 +20,98 @@ PROG = $(OBJDIR)/acpinames  # Search paths for source files  #  vpath %.c \ -    $(ACPINAMES) \ -    $(ACPICA_DEBUGGER) \ -    $(ACPICA_DISPATCHER) \ -    $(ACPICA_EXECUTER) \ -    $(ACPICA_NAMESPACE) \ -    $(ACPICA_PARSER) \ -    $(ACPICA_TABLES) \ -    $(ACPICA_UTILITIES) \ -    $(ACPICA_COMMON) \ +    $(ACPINAMES)\ +    $(ACPICA_DEBUGGER)\ +    $(ACPICA_DISPATCHER)\ +    $(ACPICA_EXECUTER)\ +    $(ACPICA_NAMESPACE)\ +    $(ACPICA_PARSER)\ +    $(ACPICA_TABLES)\ +    $(ACPICA_UTILITIES)\ +    $(ACPICA_COMMON)\      $(ACPICA_OSL)  HEADERS = \      $(wildcard $(ACPINAMES)/*.h)  OBJECTS = \ -	$(OBJDIR)/anmain.o \ -	$(OBJDIR)/anstubs.o \ -	$(OBJDIR)/antables.o \ -	$(OBJDIR)/dbfileio.o \ -	$(OBJDIR)/dsfield.o \ -	$(OBJDIR)/dsmthdat.o \ -	$(OBJDIR)/dsobject.o \ -	$(OBJDIR)/dsutils.o \ -	$(OBJDIR)/dswload.o \ -	$(OBJDIR)/dswload2.o \ -	$(OBJDIR)/dswscope.o \ -	$(OBJDIR)/dswstate.o \ -	$(OBJDIR)/excreate.o \ -	$(OBJDIR)/exnames.o \ -	$(OBJDIR)/exresnte.o \ -	$(OBJDIR)/exresolv.o \ -	$(OBJDIR)/exutils.o \ -	$(OBJDIR)/getopt.o \ -	$(OBJDIR)/nsaccess.o \ -	$(OBJDIR)/nsalloc.o \ -	$(OBJDIR)/nsdump.o \ -	$(OBJDIR)/nsinit.o \ -	$(OBJDIR)/nsload.o \ -	$(OBJDIR)/nsnames.o \ -	$(OBJDIR)/nsobject.o \ -	$(OBJDIR)/nsparse.o \ -	$(OBJDIR)/nssearch.o \ -	$(OBJDIR)/nsutils.o \ -	$(OBJDIR)/nswalk.o \ -	$(OBJDIR)/nsxfeval.o \ -	$(OBJDIR)/nsxfname.o \ -	$(OBJDIR)/nsxfobj.o \ -	$(OBJDIR)/osunixxf.o \ -	$(OBJDIR)/psargs.o \ -	$(OBJDIR)/psloop.o \ -	$(OBJDIR)/psobject.o \ -	$(OBJDIR)/psopcode.o \ -	$(OBJDIR)/psopinfo.o \ -	$(OBJDIR)/psparse.o \ -	$(OBJDIR)/psscope.o \ -	$(OBJDIR)/pstree.o \ -	$(OBJDIR)/psutils.o \ -	$(OBJDIR)/pswalk.o \ -	$(OBJDIR)/psxface.o \ -	$(OBJDIR)/tbfadt.o \ -	$(OBJDIR)/tbfind.o \ -	$(OBJDIR)/tbinstal.o \ -	$(OBJDIR)/tbutils.o \ -	$(OBJDIR)/tbxface.o \ -	$(OBJDIR)/tbxfload.o \ -	$(OBJDIR)/tbxfroot.o \ -	$(OBJDIR)/utaddress.o \ -	$(OBJDIR)/utalloc.o \ -	$(OBJDIR)/utcache.o \ -	$(OBJDIR)/utdebug.o \ -	$(OBJDIR)/utdecode.o \ -	$(OBJDIR)/utdelete.o \ -	$(OBJDIR)/utexcep.o \ -	$(OBJDIR)/utglobal.o \ -	$(OBJDIR)/utlock.o \ -	$(OBJDIR)/utmath.o \ -	$(OBJDIR)/utmisc.o \ -	$(OBJDIR)/utmutex.o \ -	$(OBJDIR)/utobject.o \ -	$(OBJDIR)/utosi.o \ -	$(OBJDIR)/utownerid.o \ -	$(OBJDIR)/utstate.o \ -	$(OBJDIR)/utstring.o \ -	$(OBJDIR)/utxface.o \ -	$(OBJDIR)/utxferror.o \ +	$(OBJDIR)/anmain.o\ +	$(OBJDIR)/anstubs.o\ +	$(OBJDIR)/antables.o\ +	$(OBJDIR)/dbfileio.o\ +	$(OBJDIR)/dsfield.o\ +	$(OBJDIR)/dsmthdat.o\ +	$(OBJDIR)/dsobject.o\ +	$(OBJDIR)/dsutils.o\ +	$(OBJDIR)/dswload.o\ +	$(OBJDIR)/dswload2.o\ +	$(OBJDIR)/dswscope.o\ +	$(OBJDIR)/dswstate.o\ +	$(OBJDIR)/excreate.o\ +	$(OBJDIR)/exnames.o\ +	$(OBJDIR)/exresnte.o\ +	$(OBJDIR)/exresolv.o\ +	$(OBJDIR)/exutils.o\ +	$(OBJDIR)/getopt.o\ +	$(OBJDIR)/nsaccess.o\ +	$(OBJDIR)/nsalloc.o\ +	$(OBJDIR)/nsdump.o\ +	$(OBJDIR)/nsinit.o\ +	$(OBJDIR)/nsload.o\ +	$(OBJDIR)/nsnames.o\ +	$(OBJDIR)/nsobject.o\ +	$(OBJDIR)/nsparse.o\ +	$(OBJDIR)/nssearch.o\ +	$(OBJDIR)/nsutils.o\ +	$(OBJDIR)/nswalk.o\ +	$(OBJDIR)/nsxfeval.o\ +	$(OBJDIR)/nsxfname.o\ +	$(OBJDIR)/nsxfobj.o\ +	$(OBJDIR)/osunixxf.o\ +	$(OBJDIR)/psargs.o\ +	$(OBJDIR)/psloop.o\ +	$(OBJDIR)/psobject.o\ +	$(OBJDIR)/psopcode.o\ +	$(OBJDIR)/psopinfo.o\ +	$(OBJDIR)/psparse.o\ +	$(OBJDIR)/psscope.o\ +	$(OBJDIR)/pstree.o\ +	$(OBJDIR)/psutils.o\ +	$(OBJDIR)/pswalk.o\ +	$(OBJDIR)/psxface.o\ +	$(OBJDIR)/tbfadt.o\ +	$(OBJDIR)/tbfind.o\ +	$(OBJDIR)/tbinstal.o\ +	$(OBJDIR)/tbutils.o\ +	$(OBJDIR)/tbxface.o\ +	$(OBJDIR)/tbxfload.o\ +	$(OBJDIR)/tbxfroot.o\ +	$(OBJDIR)/utaddress.o\ +	$(OBJDIR)/utalloc.o\ +	$(OBJDIR)/utcache.o\ +	$(OBJDIR)/utdebug.o\ +	$(OBJDIR)/utdecode.o\ +	$(OBJDIR)/utdelete.o\ +	$(OBJDIR)/utexcep.o\ +	$(OBJDIR)/utglobal.o\ +	$(OBJDIR)/utlock.o\ +	$(OBJDIR)/utmath.o\ +	$(OBJDIR)/utmisc.o\ +	$(OBJDIR)/utmutex.o\ +	$(OBJDIR)/utobject.o\ +	$(OBJDIR)/utosi.o\ +	$(OBJDIR)/utownerid.o\ +	$(OBJDIR)/utstate.o\ +	$(OBJDIR)/utstring.o\ +	$(OBJDIR)/utxface.o\ +	$(OBJDIR)/utxferror.o\  	$(OBJDIR)/utxfinit.o  #  # Flags specific to acpinames utility  # -CFLAGS+= \ -    -DACPI_NAMES_APP \ +CFLAGS += \ +    -DACPI_NAMES_APP\      -I$(ACPINAMES)  # diff --git a/generate/unix/acpisrc/Makefile b/generate/unix/acpisrc/Makefile index 9c9c578c419d..bf878179a7f2 100644 --- a/generate/unix/acpisrc/Makefile +++ b/generate/unix/acpisrc/Makefile @@ -18,29 +18,29 @@ PROG = $(OBJDIR)/acpisrc  # Search path for source files and individual source files  #  vpath %.c \ -    $(ACPISRC) \ -    $(ACPICA_COMMON) \ +    $(ACPISRC)\ +    $(ACPICA_COMMON)\      $(ACPICA_OSL)  HEADERS = \      $(wildcard $(ACPISRC)/*.h)  OBJECTS = \ -    $(OBJDIR)/ascase.o \ -    $(OBJDIR)/asconvrt.o \ -    $(OBJDIR)/asfile.o \ -    $(OBJDIR)/asmain.o \ -    $(OBJDIR)/asremove.o \ -    $(OBJDIR)/astable.o \ -    $(OBJDIR)/asutils.o \ -    $(OBJDIR)/osunixdir.o \ +    $(OBJDIR)/ascase.o\ +    $(OBJDIR)/asconvrt.o\ +    $(OBJDIR)/asfile.o\ +    $(OBJDIR)/asmain.o\ +    $(OBJDIR)/asremove.o\ +    $(OBJDIR)/astable.o\ +    $(OBJDIR)/asutils.o\ +    $(OBJDIR)/osunixdir.o\      $(OBJDIR)/getopt.o  #  # Compile flags specific to acpisrc  # -CFLAGS+= \ -    -DACPI_SRC_APP \ +CFLAGS += \ +    -DACPI_SRC_APP\      -I$(ACPISRC)  # diff --git a/generate/unix/acpixtract/Makefile b/generate/unix/acpixtract/Makefile index 183aa0d94b5f..1e5b1013d43e 100644 --- a/generate/unix/acpixtract/Makefile +++ b/generate/unix/acpixtract/Makefile @@ -18,22 +18,22 @@ PROG = $(OBJDIR)/acpixtract  # Search paths for source files  #  vpath %.c \ -    $(ACPIXTRACT) \ +    $(ACPIXTRACT)\      $(ACPICA_COMMON)  HEADERS = \      $(wildcard $(ACPIXTRACT)/*.h)  OBJECTS = \ -    $(OBJDIR)/acpixtract.o \ -    $(OBJDIR)/axmain.o \ +    $(OBJDIR)/acpixtract.o\ +    $(OBJDIR)/axmain.o\      $(OBJDIR)/getopt.o  #  # Flags specific to acpixtract  # -CFLAGS+= \ -    -DACPI_XTRACT_APP \ +CFLAGS += \ +    -DACPI_XTRACT_APP  #  # Common Rules diff --git a/generate/unix/iasl/Makefile b/generate/unix/iasl/Makefile index 6ebe16bba006..0f66301b11b7 100644 --- a/generate/unix/iasl/Makefile +++ b/generate/unix/iasl/Makefile @@ -18,206 +18,207 @@ PROG = $(OBJDIR)/iasl  # Search paths for source files  #  vpath %.c \ -    $(ASL_COMPILER) \ -    $(ACPICA_DEBUGGER) \ -    $(ACPICA_DISASSEMBLER) \ -    $(ACPICA_DISPATCHER) \ -    $(ACPICA_EXECUTER) \ -    $(ACPICA_NAMESPACE) \ -    $(ACPICA_PARSER) \ -    $(ACPICA_TABLES) \ -    $(ACPICA_UTILITIES) \ -    $(ACPICA_COMMON) \ +    $(ASL_COMPILER)\ +    $(ACPICA_DEBUGGER)\ +    $(ACPICA_DISASSEMBLER)\ +    $(ACPICA_DISPATCHER)\ +    $(ACPICA_EXECUTER)\ +    $(ACPICA_NAMESPACE)\ +    $(ACPICA_PARSER)\ +    $(ACPICA_TABLES)\ +    $(ACPICA_UTILITIES)\ +    $(ACPICA_COMMON)\      $(ACPICA_OSL)  HEADERS = \ -    $(wildcard $(ASL_COMPILER)/*.h) \ -    $(OBJDIR)/aslcompiler.y.h \ -    $(OBJDIR)/dtparser.y.h \ +    $(wildcard $(ASL_COMPILER)/*.h)\ +    $(OBJDIR)/aslcompiler.y.h\ +    $(OBJDIR)/dtparser.y.h\      $(OBJDIR)/prparser.y.h  OBJECTS = \ -	$(OBJDIR)/aslcompilerlex.o \ -	$(OBJDIR)/aslcompilerparse.o \ -	$(OBJDIR)/dtparserlex.o \ -	$(OBJDIR)/dtparserparse.o \ -	$(OBJDIR)/prparserlex.o \ -	$(OBJDIR)/prparserparse.o \ -	$(OBJDIR)/adfile.o \ -	$(OBJDIR)/adisasm.o \ -	$(OBJDIR)/adwalk.o \ -	$(OBJDIR)/ahpredef.o \ -	$(OBJDIR)/aslanalyze.o \ -	$(OBJDIR)/aslbtypes.o \ -	$(OBJDIR)/aslcodegen.o \ -	$(OBJDIR)/aslcompile.o \ -	$(OBJDIR)/aslerror.o \ -	$(OBJDIR)/aslfiles.o \ -	$(OBJDIR)/aslfileio.o \ -	$(OBJDIR)/aslfold.o \ -	$(OBJDIR)/aslhex.o \ -	$(OBJDIR)/asllength.o \ -	$(OBJDIR)/asllisting.o \ -	$(OBJDIR)/aslload.o \ -	$(OBJDIR)/asllookup.o \ -	$(OBJDIR)/aslmain.o \ -	$(OBJDIR)/aslmap.o \ -	$(OBJDIR)/aslmethod.o \ -	$(OBJDIR)/aslnamesp.o \ -	$(OBJDIR)/aslopcodes.o \ -	$(OBJDIR)/asloperands.o \ -	$(OBJDIR)/aslopt.o \ -	$(OBJDIR)/aslpredef.o \ -	$(OBJDIR)/aslresource.o \ -	$(OBJDIR)/aslrestype1.o \ -	$(OBJDIR)/aslrestype1i.o \ -	$(OBJDIR)/aslrestype2.o \ -	$(OBJDIR)/aslrestype2d.o \ -	$(OBJDIR)/aslrestype2e.o \ -	$(OBJDIR)/aslrestype2q.o \ -	$(OBJDIR)/aslrestype2s.o \ -	$(OBJDIR)/aslrestype2w.o \ -	$(OBJDIR)/aslstartup.o \ -	$(OBJDIR)/aslstubs.o \ -	$(OBJDIR)/asltransform.o \ -	$(OBJDIR)/asltree.o \ -	$(OBJDIR)/aslutils.o \ -	$(OBJDIR)/asluuid.o \ -	$(OBJDIR)/aslwalks.o \ -	$(OBJDIR)/aslxref.o \ -	$(OBJDIR)/dtcompile.o \ -	$(OBJDIR)/dtexpress.o \ -	$(OBJDIR)/dtfield.o \ -	$(OBJDIR)/dtio.o \ -	$(OBJDIR)/dtsubtable.o \ -	$(OBJDIR)/dttable.o \ -	$(OBJDIR)/dttemplate.o \ -	$(OBJDIR)/dtutils.o \ -	$(OBJDIR)/dbfileio.o \ -	$(OBJDIR)/dmbuffer.o \ -	$(OBJDIR)/dmdeferred.o \ -	$(OBJDIR)/dmextern.o \ -	$(OBJDIR)/dmnames.o \ -	$(OBJDIR)/dmobject.o \ -	$(OBJDIR)/dmopcode.o \ -	$(OBJDIR)/dmresrc.o \ -	$(OBJDIR)/dmresrcl.o \ -	$(OBJDIR)/dmresrcl2.o \ -	$(OBJDIR)/dmresrcs.o \ -	$(OBJDIR)/dmrestag.o \ -	$(OBJDIR)/dmtable.o \ -	$(OBJDIR)/dmtbdump.o \ -	$(OBJDIR)/dmtbinfo.o \ -	$(OBJDIR)/dmutils.o \ -	$(OBJDIR)/dmwalk.o \ -	$(OBJDIR)/dsargs.o \ -	$(OBJDIR)/dscontrol.o \ -	$(OBJDIR)/dsfield.o \ -	$(OBJDIR)/dsobject.o \ -	$(OBJDIR)/dsopcode.o \ -	$(OBJDIR)/dsutils.o \ -	$(OBJDIR)/dswexec.o \ -	$(OBJDIR)/dswload.o \ -	$(OBJDIR)/dswload2.o \ -	$(OBJDIR)/dswscope.o \ -	$(OBJDIR)/dswstate.o \ -	$(OBJDIR)/exconvrt.o \ -	$(OBJDIR)/excreate.o \ -	$(OBJDIR)/exdump.o \ -	$(OBJDIR)/exmisc.o \ -	$(OBJDIR)/exmutex.o \ -	$(OBJDIR)/exnames.o \ -	$(OBJDIR)/exoparg1.o \ -	$(OBJDIR)/exoparg2.o \ -	$(OBJDIR)/exoparg3.o \ -	$(OBJDIR)/exoparg6.o \ -	$(OBJDIR)/exprep.o \ -	$(OBJDIR)/exregion.o \ -	$(OBJDIR)/exresnte.o \ -	$(OBJDIR)/exresolv.o \ -	$(OBJDIR)/exresop.o \ -	$(OBJDIR)/exstore.o \ -	$(OBJDIR)/exstoren.o \ -	$(OBJDIR)/exstorob.o \ -	$(OBJDIR)/exsystem.o \ -	$(OBJDIR)/exutils.o \ -	$(OBJDIR)/getopt.o \ -	$(OBJDIR)/nsaccess.o \ -	$(OBJDIR)/nsalloc.o \ -	$(OBJDIR)/nsdump.o \ -	$(OBJDIR)/nsnames.o \ -	$(OBJDIR)/nsobject.o \ -	$(OBJDIR)/nsparse.o \ -	$(OBJDIR)/nssearch.o \ -	$(OBJDIR)/nsutils.o \ -	$(OBJDIR)/nswalk.o \ -	$(OBJDIR)/nsxfobj.o \ -	$(OBJDIR)/osunixxf.o \ -	$(OBJDIR)/prexpress.o \ -	$(OBJDIR)/prmacros.o \ -	$(OBJDIR)/prscan.o \ -	$(OBJDIR)/prutils.o \ -	$(OBJDIR)/psargs.o \ -	$(OBJDIR)/psloop.o \ -	$(OBJDIR)/psobject.o \ -	$(OBJDIR)/psopcode.o \ -	$(OBJDIR)/psopinfo.o \ -	$(OBJDIR)/psparse.o \ -	$(OBJDIR)/psscope.o \ -	$(OBJDIR)/pstree.o \ -	$(OBJDIR)/psutils.o \ -	$(OBJDIR)/pswalk.o \ -	$(OBJDIR)/tbfadt.o \ -	$(OBJDIR)/tbinstal.o \ -	$(OBJDIR)/tbutils.o \ -	$(OBJDIR)/tbxface.o \ -	$(OBJDIR)/utaddress.o \ -	$(OBJDIR)/utalloc.o \ -	$(OBJDIR)/utcache.o \ -	$(OBJDIR)/utcopy.o \ -	$(OBJDIR)/utdebug.o \ -	$(OBJDIR)/utdecode.o \ -	$(OBJDIR)/utdelete.o \ -	$(OBJDIR)/utexcep.o \ -	$(OBJDIR)/utglobal.o \ -	$(OBJDIR)/utinit.o \ -	$(OBJDIR)/utlock.o \ -	$(OBJDIR)/utmath.o \ -	$(OBJDIR)/utmisc.o \ -	$(OBJDIR)/utmutex.o \ -	$(OBJDIR)/utobject.o \ -	$(OBJDIR)/utownerid.o \ -	$(OBJDIR)/utresrc.o \ -	$(OBJDIR)/utstate.o \ -	$(OBJDIR)/utstring.o \ -	$(OBJDIR)/utxface.o \ +	$(OBJDIR)/aslcompilerlex.o\ +	$(OBJDIR)/aslcompilerparse.o\ +	$(OBJDIR)/dtparserlex.o\ +	$(OBJDIR)/dtparserparse.o\ +	$(OBJDIR)/prparserlex.o\ +	$(OBJDIR)/prparserparse.o\ +	$(OBJDIR)/adfile.o\ +	$(OBJDIR)/adisasm.o\ +	$(OBJDIR)/adwalk.o\ +	$(OBJDIR)/ahpredef.o\ +	$(OBJDIR)/aslanalyze.o\ +	$(OBJDIR)/aslbtypes.o\ +	$(OBJDIR)/aslcodegen.o\ +	$(OBJDIR)/aslcompile.o\ +	$(OBJDIR)/aslerror.o\ +	$(OBJDIR)/aslfiles.o\ +	$(OBJDIR)/aslfileio.o\ +	$(OBJDIR)/aslfold.o\ +	$(OBJDIR)/aslhex.o\ +	$(OBJDIR)/asllength.o\ +	$(OBJDIR)/asllisting.o\ +	$(OBJDIR)/aslload.o\ +	$(OBJDIR)/asllookup.o\ +	$(OBJDIR)/aslmain.o\ +	$(OBJDIR)/aslmap.o\ +	$(OBJDIR)/aslmethod.o\ +	$(OBJDIR)/aslnamesp.o\ +	$(OBJDIR)/aslopcodes.o\ +	$(OBJDIR)/asloperands.o\ +	$(OBJDIR)/aslopt.o\ +	$(OBJDIR)/aslpredef.o\ +	$(OBJDIR)/aslprepkg.o\ +	$(OBJDIR)/aslresource.o\ +	$(OBJDIR)/aslrestype1.o\ +	$(OBJDIR)/aslrestype1i.o\ +	$(OBJDIR)/aslrestype2.o\ +	$(OBJDIR)/aslrestype2d.o\ +	$(OBJDIR)/aslrestype2e.o\ +	$(OBJDIR)/aslrestype2q.o\ +	$(OBJDIR)/aslrestype2s.o\ +	$(OBJDIR)/aslrestype2w.o\ +	$(OBJDIR)/aslstartup.o\ +	$(OBJDIR)/aslstubs.o\ +	$(OBJDIR)/asltransform.o\ +	$(OBJDIR)/asltree.o\ +	$(OBJDIR)/aslutils.o\ +	$(OBJDIR)/asluuid.o\ +	$(OBJDIR)/aslwalks.o\ +	$(OBJDIR)/aslxref.o\ +	$(OBJDIR)/dtcompile.o\ +	$(OBJDIR)/dtexpress.o\ +	$(OBJDIR)/dtfield.o\ +	$(OBJDIR)/dtio.o\ +	$(OBJDIR)/dtsubtable.o\ +	$(OBJDIR)/dttable.o\ +	$(OBJDIR)/dttemplate.o\ +	$(OBJDIR)/dtutils.o\ +	$(OBJDIR)/dbfileio.o\ +	$(OBJDIR)/dmbuffer.o\ +	$(OBJDIR)/dmdeferred.o\ +	$(OBJDIR)/dmextern.o\ +	$(OBJDIR)/dmnames.o\ +	$(OBJDIR)/dmobject.o\ +	$(OBJDIR)/dmopcode.o\ +	$(OBJDIR)/dmresrc.o\ +	$(OBJDIR)/dmresrcl.o\ +	$(OBJDIR)/dmresrcl2.o\ +	$(OBJDIR)/dmresrcs.o\ +	$(OBJDIR)/dmrestag.o\ +	$(OBJDIR)/dmtable.o\ +	$(OBJDIR)/dmtbdump.o\ +	$(OBJDIR)/dmtbinfo.o\ +	$(OBJDIR)/dmutils.o\ +	$(OBJDIR)/dmwalk.o\ +	$(OBJDIR)/dsargs.o\ +	$(OBJDIR)/dscontrol.o\ +	$(OBJDIR)/dsfield.o\ +	$(OBJDIR)/dsobject.o\ +	$(OBJDIR)/dsopcode.o\ +	$(OBJDIR)/dsutils.o\ +	$(OBJDIR)/dswexec.o\ +	$(OBJDIR)/dswload.o\ +	$(OBJDIR)/dswload2.o\ +	$(OBJDIR)/dswscope.o\ +	$(OBJDIR)/dswstate.o\ +	$(OBJDIR)/exconvrt.o\ +	$(OBJDIR)/excreate.o\ +	$(OBJDIR)/exdump.o\ +	$(OBJDIR)/exmisc.o\ +	$(OBJDIR)/exmutex.o\ +	$(OBJDIR)/exnames.o\ +	$(OBJDIR)/exoparg1.o\ +	$(OBJDIR)/exoparg2.o\ +	$(OBJDIR)/exoparg3.o\ +	$(OBJDIR)/exoparg6.o\ +	$(OBJDIR)/exprep.o\ +	$(OBJDIR)/exregion.o\ +	$(OBJDIR)/exresnte.o\ +	$(OBJDIR)/exresolv.o\ +	$(OBJDIR)/exresop.o\ +	$(OBJDIR)/exstore.o\ +	$(OBJDIR)/exstoren.o\ +	$(OBJDIR)/exstorob.o\ +	$(OBJDIR)/exsystem.o\ +	$(OBJDIR)/exutils.o\ +	$(OBJDIR)/getopt.o\ +	$(OBJDIR)/nsaccess.o\ +	$(OBJDIR)/nsalloc.o\ +	$(OBJDIR)/nsdump.o\ +	$(OBJDIR)/nsnames.o\ +	$(OBJDIR)/nsobject.o\ +	$(OBJDIR)/nsparse.o\ +	$(OBJDIR)/nssearch.o\ +	$(OBJDIR)/nsutils.o\ +	$(OBJDIR)/nswalk.o\ +	$(OBJDIR)/nsxfobj.o\ +	$(OBJDIR)/osunixxf.o\ +	$(OBJDIR)/prexpress.o\ +	$(OBJDIR)/prmacros.o\ +	$(OBJDIR)/prscan.o\ +	$(OBJDIR)/prutils.o\ +	$(OBJDIR)/psargs.o\ +	$(OBJDIR)/psloop.o\ +	$(OBJDIR)/psobject.o\ +	$(OBJDIR)/psopcode.o\ +	$(OBJDIR)/psopinfo.o\ +	$(OBJDIR)/psparse.o\ +	$(OBJDIR)/psscope.o\ +	$(OBJDIR)/pstree.o\ +	$(OBJDIR)/psutils.o\ +	$(OBJDIR)/pswalk.o\ +	$(OBJDIR)/tbfadt.o\ +	$(OBJDIR)/tbinstal.o\ +	$(OBJDIR)/tbutils.o\ +	$(OBJDIR)/tbxface.o\ +	$(OBJDIR)/utaddress.o\ +	$(OBJDIR)/utalloc.o\ +	$(OBJDIR)/utcache.o\ +	$(OBJDIR)/utcopy.o\ +	$(OBJDIR)/utdebug.o\ +	$(OBJDIR)/utdecode.o\ +	$(OBJDIR)/utdelete.o\ +	$(OBJDIR)/utexcep.o\ +	$(OBJDIR)/utglobal.o\ +	$(OBJDIR)/utinit.o\ +	$(OBJDIR)/utlock.o\ +	$(OBJDIR)/utmath.o\ +	$(OBJDIR)/utmisc.o\ +	$(OBJDIR)/utmutex.o\ +	$(OBJDIR)/utobject.o\ +	$(OBJDIR)/utownerid.o\ +	$(OBJDIR)/utresrc.o\ +	$(OBJDIR)/utstate.o\ +	$(OBJDIR)/utstring.o\ +	$(OBJDIR)/utxface.o\  	$(OBJDIR)/utxferror.o  INTERMEDIATES = \ -	$(OBJDIR)/aslcompilerlex.c \ -	$(OBJDIR)/aslcompilerparse.c \ -	$(OBJDIR)/dtparserlex.c \ -	$(OBJDIR)/dtparserparse.c \ -	$(OBJDIR)/prparserlex.c \ +	$(OBJDIR)/aslcompilerlex.c\ +	$(OBJDIR)/aslcompilerparse.c\ +	$(OBJDIR)/dtparserlex.c\ +	$(OBJDIR)/dtparserparse.c\ +	$(OBJDIR)/prparserlex.c\  	$(OBJDIR)/prparserparse.c  MISC = \ -	$(OBJDIR)/aslcompilerparse.h \ -	$(OBJDIR)/aslcompiler.y.h \ -	$(OBJDIR)/aslcompilerparse.output \ -	$(OBJDIR)/dtparserparse.h \ -	$(OBJDIR)/dtparser.y.h \ -	$(OBJDIR)/dtparserparse.output \ -	$(OBJDIR)/prparserparse.h \ -	$(OBJDIR)/prparser.y.h \ +	$(OBJDIR)/aslcompilerparse.h\ +	$(OBJDIR)/aslcompiler.y.h\ +	$(OBJDIR)/aslcompilerparse.output\ +	$(OBJDIR)/dtparserparse.h\ +	$(OBJDIR)/dtparser.y.h\ +	$(OBJDIR)/dtparserparse.output\ +	$(OBJDIR)/prparserparse.h\ +	$(OBJDIR)/prparser.y.h\  	$(OBJDIR)/prparserparse.output  #  # Flags specific to iASL compiler  # -CFLAGS+= \ -    -DACPI_ASL_COMPILER \ -    -I$(ASL_COMPILER) \ +CFLAGS += \ +    -DACPI_ASL_COMPILER\ +    -I$(ASL_COMPILER)\      -I$(OBJDIR)  # diff --git a/source/common/adisasm.c b/source/common/adisasm.c index c5fcf81ab721..511366faac24 100644 --- a/source/common/adisasm.c +++ b/source/common/adisasm.c @@ -372,7 +372,7 @@ AdAmlDisassemble (      }      /* -     * Output:  ASL code. Redirect to a file if requested +     * Output: ASL code. Redirect to a file if requested       */      if (OutToFile)      { @@ -540,11 +540,6 @@ Cleanup:          ACPI_FREE (Table);      } -    if (DisasmFilename) -    { -        ACPI_FREE (DisasmFilename); -    } -      if (OutToFile && File)      {          if (AslCompilerdebug) /* Display final namespace, with transforms */ @@ -667,7 +662,7 @@ AdCreateTableHeader (      AcpiOsPrintf (" *     OEM Revision     0x%8.8X (%u)\n", Table->OemRevision, Table->OemRevision);      AcpiOsPrintf (" *     Compiler ID      \"%.4s\"\n",     Table->AslCompilerId);      AcpiOsPrintf (" *     Compiler Version 0x%8.8X (%u)\n", Table->AslCompilerRevision, Table->AslCompilerRevision); -    AcpiOsPrintf (" */\n\n"); +    AcpiOsPrintf (" */\n");      /* Create AML output filename based on input filename */ diff --git a/source/common/adwalk.c b/source/common/adwalk.c index d1c6d74fd93b..0a3a8485fe7b 100644 --- a/source/common/adwalk.c +++ b/source/common/adwalk.c @@ -837,7 +837,7 @@ AcpiDmXrefDescendingOp (              }          } -        AcpiDmAddToExternalList (Op, Path, (UINT8) ObjectType2, ParamCount); +        AcpiDmAddToExternalList (Op, Path, (UINT8) ObjectType2, ParamCount | 0x80);          Op->Common.Node = Node;      }      else diff --git a/source/common/dmextern.c b/source/common/dmextern.c index 501a9ee3d9ca..7825ab11acb5 100644 --- a/source/common/dmextern.c +++ b/source/common/dmextern.c @@ -46,6 +46,7 @@  #include "amlcode.h"  #include "acnamesp.h"  #include "acdisasm.h" +#include <stdio.h>  /* @@ -373,6 +374,7 @@ AcpiDmAddToExternalList (      ACPI_EXTERNAL_LIST      *NextExternal;      ACPI_EXTERNAL_LIST      *PrevExternal = NULL;      ACPI_STATUS             Status; +    BOOLEAN                 Resolved = FALSE;      if (!Path) @@ -380,6 +382,15 @@ AcpiDmAddToExternalList (          return;      } +    if (Type == ACPI_TYPE_METHOD) +    { +        if (Value & 0x80) +        { +            Resolved = TRUE; +        } +        Value &= 0x07; +    } +      /*       * We don't want External() statements to contain a leading '\'.       * This prevents duplicate external statements of the form: @@ -464,6 +475,7 @@ AcpiDmAddToExternalList (      NewExternal->Path = ExternalPath;      NewExternal->Type = Type;      NewExternal->Value = Value; +    NewExternal->Resolved = Resolved;      NewExternal->Length = (UINT16) ACPI_STRLEN (ExternalPath);      /* Was the external path with parent prefix normalized to a fullpath? */ @@ -684,6 +696,29 @@ AcpiDmEmitExternals (      }      /* +     * Determine the number of control methods in the external list, and +     * also how many of those externals were resolved via the namespace. +     */ +    NextExternal = AcpiGbl_ExternalList; +    while (NextExternal) +    { +        if (NextExternal->Type == ACPI_TYPE_METHOD) +        { +            AcpiGbl_NumExternalMethods++; +            if (NextExternal->Resolved) +            { +                AcpiGbl_ResolvedExternalMethods++; +            } +        } + +        NextExternal = NextExternal->Next; +    } + +    /* Check if any control methods were unresolved */ + +    AcpiDmUnresolvedWarning (1); + +    /*       * Walk the list of externals (unresolved references)       * found during the AML parsing       */ @@ -695,8 +730,17 @@ AcpiDmEmitExternals (          if (AcpiGbl_ExternalList->Type == ACPI_TYPE_METHOD)          { -            AcpiOsPrintf (")    // %u Arguments\n", -                AcpiGbl_ExternalList->Value); +            if (AcpiGbl_ExternalList->Resolved) +            { +                AcpiOsPrintf (")    // %u Arguments\n", +                    AcpiGbl_ExternalList->Value); +            } +            else +            { +                AcpiOsPrintf (")    // Warning: unresolved Method, " +                    "assuming %u arguments (may be incorrect, see warning above)\n", +                    AcpiGbl_ExternalList->Value); +            }          }          else          { @@ -718,3 +762,173 @@ AcpiDmEmitExternals (      AcpiOsPrintf ("\n");  } + + +/******************************************************************************* + * + * FUNCTION:    AcpiDmUnresolvedWarning + * + * PARAMETERS:  Type                - Where to output the warning. + *                                    0 means write to stderr + *                                    1 means write to AcpiOsPrintf + * + * RETURN:      None + * + * DESCRIPTION: Issue warning message if there are unresolved external control + *              methods within the disassembly. + * + ******************************************************************************/ + +#if 0 +Summary of the external control method problem: + +When the -e option is used with disassembly, the various SSDTs are simply +loaded into a global namespace for the disassembler to use in order to +resolve control method references (invocations). + +The disassembler tracks any such references, and will emit an External() +statement for these types of methods, with the proper number of arguments . + +Without the SSDTs, the AML does not contain enough information to properly +disassemble the control method invocation -- because the disassembler does +not know how many arguments to parse. + +An example: Assume we have two control methods. ABCD has one argument, and +EFGH has zero arguments. Further, we have two additional control methods +that invoke ABCD and EFGH, named T1 and T2: + +    Method (ABCD, 1) +    { +    } +    Method (EFGH, 0) +    { +    } +    Method (T1) +    { +        ABCD (Add (2, 7, Local0)) +    } +    Method (T2) +    { +        EFGH () +        Add (2, 7, Local0) +    } + +Here is the AML code that is generated for T1 and T2: + +     185:      Method (T1) + +0000034C:  14 10 54 31 5F 5F 00 ...    "..T1__." + +     186:      { +     187:          ABCD (Add (2, 7, Local0)) + +00000353:  41 42 43 44 ............    "ABCD" +00000357:  72 0A 02 0A 07 60 ......    "r....`" + +     188:      } + +     190:      Method (T2) + +0000035D:  14 10 54 32 5F 5F 00 ...    "..T2__." + +     191:      { +     192:          EFGH () + +00000364:  45 46 47 48 ............    "EFGH" + +     193:          Add (2, 7, Local0) + +00000368:  72 0A 02 0A 07 60 ......    "r....`" +     194:      } + +Note that the AML code for T1 and T2 is essentially identical. When +disassembling this code, the methods ABCD and EFGH must be known to the +disassembler, otherwise it does not know how to handle the method invocations. + +In other words, if ABCD and EFGH are actually external control methods +appearing in an SSDT, the disassembler does not know what to do unless +the owning SSDT has been loaded via the -e option. +#endif + +void +AcpiDmUnresolvedWarning ( +    UINT8                   Type) +{ + +    if (!AcpiGbl_NumExternalMethods) +    { +        return; +    } + +    if (Type) +    { +        if (!AcpiGbl_ExternalFileList) +        { +            /* The -e option was not specified */ + +           AcpiOsPrintf ("    /*\n" +                "     * iASL Warning: There were %u external control methods found during\n" +                "     * disassembly, but additional ACPI tables to resolve these externals\n" +                "     * were not specified. This resulting disassembler output file may not\n" +                "     * compile because the disassembler did not know how many arguments\n" +                "     * to assign to these methods. To specify the tables needed to resolve\n" +                "     * external control method references, use the one of the following\n" +                "     * example iASL invocations:\n" +                "     *     iasl -e <ssdt1.aml,ssdt2.aml...> -d <dsdt.aml>\n" +                "     *     iasl -e <dsdt.aml,ssdt2.aml...> -d <ssdt1.aml>\n" +                "     */\n", +                AcpiGbl_NumExternalMethods); +        } +        else if (AcpiGbl_NumExternalMethods != AcpiGbl_ResolvedExternalMethods) +        { +            /* The -e option was specified, but there are still some unresolved externals */ + +            AcpiOsPrintf ("    /*\n" +                "     * iASL Warning: There were %u external control methods found during\n" +                "     * disassembly, but only %u %s resolved (%u unresolved). Additional\n" +                "     * ACPI tables are required to properly disassemble the code. This\n" +                "     * resulting disassembler output file may not compile because the\n" +                "     * disassembler did not know how many arguments to assign to the\n" +                "     * unresolved methods.\n" +                "     */\n", +                AcpiGbl_NumExternalMethods, AcpiGbl_ResolvedExternalMethods, +                (AcpiGbl_ResolvedExternalMethods > 1 ? "were" : "was"), +                (AcpiGbl_NumExternalMethods - AcpiGbl_ResolvedExternalMethods)); +        } +    } +    else +    { +        if (!AcpiGbl_ExternalFileList) +        { +            /* The -e option was not specified */ + +            fprintf (stderr, "\n" +                "iASL Warning: There were %u external control methods found during\n" +                "disassembly, but additional ACPI tables to resolve these externals\n" +                "were not specified. The resulting disassembler output file may not\n" +                "compile because the disassembler did not know how many arguments\n" +                "to assign to these methods. To specify the tables needed to resolve\n" +                "external control method references, use the one of the following\n" +                "example iASL invocations:\n" +                "    iasl -e <ssdt1.aml,ssdt2.aml...> -d <dsdt.aml>\n" +                "    iasl -e <dsdt.aml,ssdt2.aml...> -d <ssdt1.aml>\n", +                AcpiGbl_NumExternalMethods); +        } +        else if (AcpiGbl_NumExternalMethods != AcpiGbl_ResolvedExternalMethods) +        { +            /* The -e option was specified, but there are still some unresolved externals */ + +            fprintf (stderr, "\n" +                "iASL Warning: There were %u external control methods found during\n" +                "disassembly, but only %u %s resolved (%u unresolved). Additional\n" +                "ACPI tables are required to properly disassemble the code. The\n" +                "resulting disassembler output file may not compile because the\n" +                "disassembler did not know how many arguments to assign to the\n" +                "unresolved methods.\n", +                AcpiGbl_NumExternalMethods, AcpiGbl_ResolvedExternalMethods, +                (AcpiGbl_ResolvedExternalMethods > 1 ? "were" : "was"), +                (AcpiGbl_NumExternalMethods - AcpiGbl_ResolvedExternalMethods)); +        } +    } + +} diff --git a/source/common/dmtable.c b/source/common/dmtable.c index cde16643d217..0c1c39b99ea6 100644 --- a/source/common/dmtable.c +++ b/source/common/dmtable.c @@ -299,6 +299,7 @@ ACPI_DMTABLE_DATA    AcpiDmTableData[] =      {ACPI_SIG_MCHI, AcpiDmTableInfoMchi,    NULL,           NULL,           TemplateMchi,   "Management Controller Host Interface table"},      {ACPI_SIG_MPST, AcpiDmTableInfoMpst,    AcpiDmDumpMpst, DtCompileMpst,  TemplateMpst,   "Memory Power State Table"},      {ACPI_SIG_MSCT, NULL,                   AcpiDmDumpMsct, DtCompileMsct,  TemplateMsct,   "Maximum System Characteristics Table"}, +    {ACPI_SIG_MTMR, NULL,                   AcpiDmDumpMtmr, DtCompileMtmr,  TemplateMtmr,   "MID Timer Table"},      {ACPI_SIG_PCCT, NULL,                   AcpiDmDumpPcct, NULL,           NULL,           "Platform Communications Channel Table"},      {ACPI_SIG_PMTT, NULL,                   AcpiDmDumpPmtt, DtCompilePmtt,  TemplatePmtt,   "Platform Memory Topology Table"},      {ACPI_SIG_RSDT, NULL,                   AcpiDmDumpRsdt, DtCompileRsdt,  TemplateRsdt,   "Root System Description Table"}, @@ -312,6 +313,7 @@ ACPI_DMTABLE_DATA    AcpiDmTableData[] =      {ACPI_SIG_TCPA, AcpiDmTableInfoTcpa,    NULL,           NULL,           TemplateTcpa,   "Trusted Computing Platform Alliance table"},      {ACPI_SIG_TPM2, AcpiDmTableInfoTpm2,    NULL,           NULL,           TemplateTpm2,   "Trusted Platform Module hardware interface table"},      {ACPI_SIG_UEFI, AcpiDmTableInfoUefi,    NULL,           DtCompileUefi,  TemplateUefi,   "UEFI Boot Optimization Table"}, +    {ACPI_SIG_VRTC, AcpiDmTableInfoVrtc,    AcpiDmDumpVrtc, DtCompileVrtc,  TemplateVrtc,   "Virtual Real-Time Clock Table"},      {ACPI_SIG_WAET, AcpiDmTableInfoWaet,    NULL,           NULL,           TemplateWaet,   "Windows ACPI Emulated Devices Table"},      {ACPI_SIG_WDAT, NULL,                   AcpiDmDumpWdat, DtCompileWdat,  TemplateWdat,   "Watchdog Action Table"},      {ACPI_SIG_WDDT, AcpiDmTableInfoWddt,    NULL,           NULL,           TemplateWddt,   "Watchdog Description Table"}, @@ -475,6 +477,8 @@ AcpiDmDumpDataTable (              {                  AcpiOsPrintf ("\n**** Unknown ACPI table type [%4.4s]\n\n",                      Table->Signature); +                fprintf (stderr, "Unknown ACPI table signature [%4.4s], decoding header only\n", +                    Table->Signature);              }          }          else if (TableData->TableHandler) diff --git a/source/common/dmtbdump.c b/source/common/dmtbdump.c index c5a5cef67c12..b5e052e7de3e 100644 --- a/source/common/dmtbdump.c +++ b/source/common/dmtbdump.c @@ -1796,6 +1796,58 @@ AcpiDmDumpMsct (  /*******************************************************************************   * + * FUNCTION:    AcpiDmDumpMtmr + * + * PARAMETERS:  Table               - A MTMR table + * + * RETURN:      None + * + * DESCRIPTION: Format the contents of a MTMR + * + ******************************************************************************/ + +void +AcpiDmDumpMtmr ( +    ACPI_TABLE_HEADER       *Table) +{ +    ACPI_STATUS             Status; +    UINT32                  Offset = sizeof (ACPI_TABLE_MTMR); +    ACPI_MTMR_ENTRY         *SubTable; + + +    /* Main table */ + +    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMtmr); +    if (ACPI_FAILURE (Status)) +    { +        return; +    } + +    /* Sub-tables */ + +    SubTable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, Table, Offset); +    while (Offset < Table->Length) +    { +        /* Common sub-table header */ + +        AcpiOsPrintf ("\n"); +        Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, +                    sizeof (ACPI_MTMR_ENTRY), AcpiDmTableInfoMtmr0); +        if (ACPI_FAILURE (Status)) +        { +            return; +        } + +        /* Point to next sub-table */ + +        Offset += sizeof (ACPI_MTMR_ENTRY); +        SubTable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, SubTable, sizeof (ACPI_MTMR_ENTRY)); +    } +} + + +/******************************************************************************* + *   * FUNCTION:    AcpiDmDumpPcct   *   * PARAMETERS:  Table               - A PCCT table @@ -2378,6 +2430,58 @@ NextSubTable:  /*******************************************************************************   * + * FUNCTION:    AcpiDmDumpVrtc + * + * PARAMETERS:  Table               - A VRTC table + * + * RETURN:      None + * + * DESCRIPTION: Format the contents of a VRTC + * + ******************************************************************************/ + +void +AcpiDmDumpVrtc ( +    ACPI_TABLE_HEADER       *Table) +{ +    ACPI_STATUS             Status; +    UINT32                  Offset = sizeof (ACPI_TABLE_VRTC); +    ACPI_VRTC_ENTRY         *SubTable; + + +    /* Main table */ + +    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoVrtc); +    if (ACPI_FAILURE (Status)) +    { +        return; +    } + +    /* Sub-tables */ + +    SubTable = ACPI_ADD_PTR (ACPI_VRTC_ENTRY, Table, Offset); +    while (Offset < Table->Length) +    { +        /* Common sub-table header */ + +        AcpiOsPrintf ("\n"); +        Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, +                    sizeof (ACPI_VRTC_ENTRY), AcpiDmTableInfoVrtc0); +        if (ACPI_FAILURE (Status)) +        { +            return; +        } + +        /* Point to next sub-table */ + +        Offset += sizeof (ACPI_VRTC_ENTRY); +        SubTable = ACPI_ADD_PTR (ACPI_VRTC_ENTRY, SubTable, sizeof (ACPI_VRTC_ENTRY)); +    } +} + + +/******************************************************************************* + *   * FUNCTION:    AcpiDmDumpWdat   *   * PARAMETERS:  Table               - A WDAT table diff --git a/source/common/dmtbinfo.c b/source/common/dmtbinfo.c index 5b8321d61651..033f7ef8e779 100644 --- a/source/common/dmtbinfo.c +++ b/source/common/dmtbinfo.c @@ -179,6 +179,7 @@  #define ACPI_MPST1_OFFSET(f)            (UINT16) ACPI_OFFSET (ACPI_MPST_DATA_HDR,f)  #define ACPI_MPST2_OFFSET(f)            (UINT16) ACPI_OFFSET (ACPI_MPST_POWER_DATA,f)  #define ACPI_MSCT0_OFFSET(f)            (UINT16) ACPI_OFFSET (ACPI_MSCT_PROXIMITY,f) +#define ACPI_MTMR0_OFFSET(f)            (UINT16) ACPI_OFFSET (ACPI_MTMR_ENTRY,f)  #define ACPI_PCCT0_OFFSET(f)            (UINT16) ACPI_OFFSET (ACPI_PCCT_SUBSPACE,f)  #define ACPI_PMTT0_OFFSET(f)            (UINT16) ACPI_OFFSET (ACPI_PMTT_SOCKET,f)  #define ACPI_PMTT1_OFFSET(f)            (UINT16) ACPI_OFFSET (ACPI_PMTT_CONTROLLER,f) @@ -195,6 +196,7 @@  #define ACPI_SRAT0_OFFSET(f)            (UINT16) ACPI_OFFSET (ACPI_SRAT_CPU_AFFINITY,f)  #define ACPI_SRAT1_OFFSET(f)            (UINT16) ACPI_OFFSET (ACPI_SRAT_MEM_AFFINITY,f)  #define ACPI_SRAT2_OFFSET(f)            (UINT16) ACPI_OFFSET (ACPI_SRAT_X2APIC_CPU_AFFINITY,f) +#define ACPI_VRTC0_OFFSET(f)            (UINT16) ACPI_OFFSET (ACPI_VRTC_ENTRY,f)  #define ACPI_WDAT0_OFFSET(f)            (UINT16) ACPI_OFFSET (ACPI_WDAT_ENTRY,f)  /* @@ -1644,6 +1646,28 @@ ACPI_DMTABLE_INFO           AcpiDmTableInfoMsct0[] =  /*******************************************************************************   * + * MTMR - MID Timer Table + * + ******************************************************************************/ + +ACPI_DMTABLE_INFO           AcpiDmTableInfoMtmr[] = +{ +    ACPI_DMT_TERMINATOR +}; + +/* MTMR Subtables - MTMR Entry */ + +ACPI_DMTABLE_INFO           AcpiDmTableInfoMtmr0[] = +{ +    {ACPI_DMT_GAS,      ACPI_MTMR0_OFFSET (PhysicalAddress),        "PhysicalAddress", 0}, +    {ACPI_DMT_UINT32,   ACPI_MTMR0_OFFSET (Frequency),              "Frequency", 0}, +    {ACPI_DMT_UINT32,   ACPI_MTMR0_OFFSET (Irq),                    "IRQ", 0}, +    ACPI_DMT_TERMINATOR +}; + + +/******************************************************************************* + *   * PCCT - Platform Communications Channel Table (ACPI 5.0)   *   ******************************************************************************/ @@ -2035,6 +2059,27 @@ ACPI_DMTABLE_INFO           AcpiDmTableInfoUefi[] =  /*******************************************************************************   * + * VRTC - Virtual Real Time Clock Table + * + ******************************************************************************/ + +ACPI_DMTABLE_INFO           AcpiDmTableInfoVrtc[] = +{ +    ACPI_DMT_TERMINATOR +}; + +/* VRTC Subtables - VRTC Entry */ + +ACPI_DMTABLE_INFO           AcpiDmTableInfoVrtc0[] = +{ +    {ACPI_DMT_GAS,      ACPI_VRTC0_OFFSET (PhysicalAddress),        "PhysicalAddress", 0}, +    {ACPI_DMT_UINT32,   ACPI_VRTC0_OFFSET (Irq),                    "IRQ", 0}, +    ACPI_DMT_TERMINATOR +}; + + +/******************************************************************************* + *   * WAET - Windows ACPI Emulated devices Table   *   ******************************************************************************/ diff --git a/source/compiler/aslcompile.c b/source/compiler/aslcompile.c index af7e1b8c03be..c7528704f92a 100644 --- a/source/compiler/aslcompile.c +++ b/source/compiler/aslcompile.c @@ -42,6 +42,7 @@   */  #include "aslcompiler.h" +#include "dtcompiler.h"  #include <stdio.h>  #include <time.h> @@ -343,6 +344,89 @@ FlConsumeNewComment (  /*******************************************************************************   * + * FUNCTION:    FlCheckForAcpiTable + * + * PARAMETERS:  Handle              - Open input file + * + * RETURN:      Status + * + * DESCRIPTION: Determine if a file seems to be a binary ACPI table, via the + *              following checks on what would be the table header: + *              0) File must be at least as long as an ACPI_TABLE_HEADER + *              1) The header length field must match the file size + *              2) Signature, OemId, OemTableId, AslCompilerId must be ASCII + * + ******************************************************************************/ + +ACPI_STATUS +FlCheckForAcpiTable ( +    FILE                    *Handle) +{ +    ACPI_TABLE_HEADER       Table; +    UINT32                  FileSize; +    size_t                  Actual; +    UINT32                  i; + + +    /* Read a potential table header */ + +    Actual = fread (&Table, 1, sizeof (ACPI_TABLE_HEADER), Handle); +    fseek (Handle, 0, SEEK_SET); + +    if (Actual < sizeof (ACPI_TABLE_HEADER)) +    { +        return (AE_ERROR); +    } + +    /* Header length field must match the file size */ + +    FileSize = DtGetFileSize (Handle); +    if (Table.Length != FileSize) +    { +        return (AE_ERROR); +    } + +    /* +     * These fields must be ASCII: +     * Signature, OemId, OemTableId, AslCompilerId. +     * We allow a NULL terminator in OemId and OemTableId. +     */ +    for (i = 0; i < ACPI_NAME_SIZE; i++) +    { +        if (!ACPI_IS_ASCII ((UINT8) Table.Signature[i])) +        { +            return (AE_ERROR); +        } + +        if (!ACPI_IS_ASCII ((UINT8) Table.AslCompilerId[i])) +        { +            return (AE_ERROR); +        } +    } + +    for (i = 0; (i < ACPI_OEM_ID_SIZE) && (Table.OemId[i]); i++) +    { +        if (!ACPI_IS_ASCII ((UINT8) Table.OemId[i])) +        { +            return (AE_ERROR); +        } +    } + +    for (i = 0; (i < ACPI_OEM_TABLE_ID_SIZE) && (Table.OemTableId[i]); i++) +    { +        if (!ACPI_IS_ASCII ((UINT8) Table.OemTableId[i])) +        { +            return (AE_ERROR); +        } +    } + +    printf ("Binary file appears to be a valid ACPI table, disassembling\n"); +    return (AE_OK); +} + + +/******************************************************************************* + *   * FUNCTION:    FlCheckForAscii   *   * PARAMETERS:  Handle              - Open input file diff --git a/source/compiler/aslcompiler.h b/source/compiler/aslcompiler.h index 3ee60318a66c..4f899fc5dad2 100644 --- a/source/compiler/aslcompiler.h +++ b/source/compiler/aslcompiler.h @@ -160,6 +160,10 @@ CmCleanupAndExit (      void);  ACPI_STATUS +FlCheckForAcpiTable ( +    FILE                    *Handle); + +ACPI_STATUS  FlCheckForAscii (      FILE                    *Handle,      char                    *Filename, @@ -509,12 +513,28 @@ ApCheckForPredefinedObject (      ACPI_PARSE_OBJECT       *Op,      char                    *Name); +ACPI_STATUS +ApCheckObjectType ( +    const char              *PredefinedName, +    ACPI_PARSE_OBJECT       *Op, +    UINT32                  ExpectedBtypes, +    UINT32                  PackageIndex); +  void  ApDisplayReservedNames (      void);  /* + * aslprepkg - ACPI predefined names support for packages + */ +void +ApCheckPackage ( +    ACPI_PARSE_OBJECT           *ParentOp, +    const ACPI_PREDEFINED_INFO  *Predefined); + + +/*   * asltransform - parse tree transformations   */  ACPI_STATUS diff --git a/source/compiler/asldefine.h b/source/compiler/asldefine.h index 7c8bd66e5c58..75c8fad0e197 100644 --- a/source/compiler/asldefine.h +++ b/source/compiler/asldefine.h @@ -125,8 +125,9 @@  /* Types for input files */  #define ASL_INPUT_TYPE_BINARY       0 -#define ASL_INPUT_TYPE_ASCII_ASL    1 -#define ASL_INPUT_TYPE_ASCII_DATA   2 +#define ASL_INPUT_TYPE_ACPI_TABLE   1 +#define ASL_INPUT_TYPE_ASCII_ASL    2 +#define ASL_INPUT_TYPE_ASCII_DATA   3  /* Misc */ diff --git a/source/compiler/aslfiles.c b/source/compiler/aslfiles.c index e54f6fe943a8..5676df15af82 100644 --- a/source/compiler/aslfiles.c +++ b/source/compiler/aslfiles.c @@ -513,6 +513,13 @@ FlOpenMiscOutputFiles (      char                    *Filename; +    /* All done for disassembler */ + +    if (Gbl_FileType == ASL_INPUT_TYPE_ACPI_TABLE) +    { +        return (AE_OK); +    } +      /* Create/Open a hex output file if asked */      if (Gbl_HexOutputFlag) diff --git a/source/compiler/aslmain.c b/source/compiler/aslmain.c index 261f81fffa03..71a7cec0b306 100644 --- a/source/compiler/aslmain.c +++ b/source/compiler/aslmain.c @@ -111,7 +111,8 @@ AslDoResponseFile (   *   * RETURN:      None   * - * DESCRIPTION: Display option help message + * DESCRIPTION: Display option help message. + *              Optional items in square brackets.   *   ******************************************************************************/ @@ -132,7 +133,7 @@ Options (      ACPI_OPTION ("-P",              "Preprocess only and create preprocessor output file (*.i)");      ACPI_OPTION ("-Pn",             "Disable preprocessor"); -    printf ("\nGeneral Output:\n"); +    printf ("\nGeneral Processing:\n");      ACPI_OPTION ("-p <prefix>",     "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"); @@ -142,12 +143,7 @@ Options (      ACPI_OPTION ("-w1 -w2 -w3",     "Set warning reporting level");      ACPI_OPTION ("-we",             "Report warnings as errors"); -    printf ("\nAML and Data Output Files:\n"); -    ACPI_OPTION ("-sa -sc",         "Create assembler or C source file (*.asm or *.c)"); -    ACPI_OPTION ("-ia -ic",         "Create assembler or C include file (*.inc or *.h)"); -    ACPI_OPTION ("-ta -tc -ts",     "Create assembler, C, or ASL hex table (*.hex)"); - -    printf ("\nAML Code Generation:\n"); +    printf ("\nAML Code Generation (*.aml):\n");      ACPI_OPTION ("-oa",             "Disable all optimizations (compatibility mode)");      ACPI_OPTION ("-of",             "Disable constant folding");      ACPI_OPTION ("-oi",             "Disable integer optimization to Zero/One/Ones"); @@ -156,22 +152,28 @@ Options (      ACPI_OPTION ("-in",             "Ignore NoOp operators");      ACPI_OPTION ("-r <revision>",   "Override table header Revision (1-255)"); -    printf ("\nASL Listing Files:\n"); +    printf ("\nOptional Source Code Output Files:\n"); +    ACPI_OPTION ("-sc -sa",         "Create source file in C or assembler (*.c or *.asm)"); +    ACPI_OPTION ("-ic -ia",         "Create include file in C or assembler (*.h or *.inc)"); +    ACPI_OPTION ("-tc -ta -ts",     "Create hex AML table in C, assembler, or ASL (*.hex)"); + +    printf ("\nOptional Listing Files:\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"); -    ACPI_OPTION ("-G",              "Compile custom table containing generic operators"); -    ACPI_OPTION ("-vt",             "Create verbose templates (full disassembly)"); +    printf ("\nData Table Compiler:\n"); +    ACPI_OPTION ("-G",              "Compile custom table that contains generic operators"); +    ACPI_OPTION ("-vt",             "Create verbose template files (full disassembly)");      printf ("\nAML Disassembler:\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 ("-d  <f1,f2>",     "Disassemble or decode binary ACPI tables to file (*.dsl)"); +    ACPI_OPTION ("",                "  (Optional, file type is automatically detected)"); +    ACPI_OPTION ("-da <f1,f2>",     "Disassemble multiple tables from single namespace");      ACPI_OPTION ("-db",             "Do not translate Buffers to Resource Templates"); -    ACPI_OPTION ("-dc [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 ("-dc <f1,f2>",     "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 ("-g",              "Get ACPI tables and write to files (*.dat)");      ACPI_OPTION ("-in",             "Ignore NoOp opcodes");      ACPI_OPTION ("-vt",             "Dump binary table data in hex format within output file"); @@ -186,6 +188,7 @@ Options (      printf ("\nDebug Options:\n");      ACPI_OPTION ("-bf -bt",         "Create debug file (full or parse tree only) (*.txt)");      ACPI_OPTION ("-f",              "Ignore errors, force creation of AML output file(s)"); +    ACPI_OPTION ("-m <size>",       "Set internal line buffer size (in Kbytes)");      ACPI_OPTION ("-n",              "Parse only, no output generation");      ACPI_OPTION ("-ot",             "Display compile times and statistics");      ACPI_OPTION ("-x <level>",      "Set debug level for trace output"); diff --git a/source/compiler/aslmessages.h b/source/compiler/aslmessages.h index be7a3f952695..102148dffb99 100644 --- a/source/compiler/aslmessages.h +++ b/source/compiler/aslmessages.h @@ -166,6 +166,7 @@ typedef enum      ASL_MSG_RESERVED_METHOD,      ASL_MSG_RESERVED_NO_RETURN_VAL,      ASL_MSG_RESERVED_OPERAND_TYPE, +    ASL_MSG_RESERVED_PACKAGE_LENGTH,      ASL_MSG_RESERVED_RETURN_VALUE,      ASL_MSG_RESERVED_USE,      ASL_MSG_RESERVED_WORD, @@ -343,6 +344,7 @@ char                        *AslMessages [] = {  /*    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_PACKAGE_LENGTH */    "Invalid package length for reserved name",  /*    ASL_MSG_RESERVED_RETURN_VALUE */      "Reserved method must return a value",  /*    ASL_MSG_RESERVED_USE */               "Invalid use of reserved name",  /*    ASL_MSG_RESERVED_WORD */              "Use of reserved name", diff --git a/source/compiler/aslpredef.c b/source/compiler/aslpredef.c index 8704bb6ab2e0..ca877a8ada50 100644 --- a/source/compiler/aslpredef.c +++ b/source/compiler/aslpredef.c @@ -46,6 +46,7 @@  #include "aslcompiler.h"  #include "aslcompiler.y.h"  #include "acpredef.h" +#include "acnamesp.h"  #define _COMPONENT          ACPI_COMPILER @@ -65,12 +66,6 @@ ApCheckForSpecialName (      char                    *Name);  static void -ApCheckObjectType ( -    const char              *PredefinedName, -    ACPI_PARSE_OBJECT       *Op, -    UINT32                  ExpectedBtypes); - -static void  ApGetExpectedTypes (      char                    *Buffer,      UINT32                  ExpectedBtypes); @@ -386,7 +381,15 @@ ApCheckPredefinedReturnValue (              ApCheckObjectType (PredefinedNames[Index].Info.Name,                  ReturnValueOp, -                PredefinedNames[Index].Info.ExpectedBtypes); +                PredefinedNames[Index].Info.ExpectedBtypes, +                ACPI_NOT_PACKAGE_ELEMENT); + +            /* For packages, check the individual package elements */ + +            if (ReturnValueOp->Asl.ParseOpcode == PARSEOP_PACKAGE) +            { +                ApCheckPackage (ReturnValueOp, &PredefinedNames[Index]); +            }              break;          default: @@ -428,6 +431,7 @@ ApCheckForPredefinedObject (      char                    *Name)  {      UINT32                  Index; +    ACPI_PARSE_OBJECT       *ObjectOp;      /* @@ -456,39 +460,50 @@ ApCheckForPredefinedObject (              "with zero arguments");          return; -    default: /* A standard predefined ACPI name */ - -        /* -         * If this predefined name requires input arguments, then -         * it must be implemented as a control method -         */ -        if (PredefinedNames[Index].Info.ParamCount > 0) -        { -            AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op, -                "with arguments"); -            return; -        } +    default: +        break; +    } -        /* -         * If no return value is expected from this predefined name, then -         * it follows that it must be implemented as a control method -         * (with zero args, because the args > 0 case was handled above) -         * Examples are: _DIS, _INI, _IRC, _OFF, _ON, _PSx -         */ -        if (!PredefinedNames[Index].Info.ExpectedBtypes) -        { -            AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op, -                "with zero arguments"); -            return; -        } +    /* A standard predefined ACPI name */ -        /* Typecheck the actual object, it is the next argument */ +    /* +     * If this predefined name requires input arguments, then +     * it must be implemented as a control method +     */ +    if (PredefinedNames[Index].Info.ParamCount > 0) +    { +        AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op, +            "with arguments"); +        return; +    } -        ApCheckObjectType (PredefinedNames[Index].Info.Name, -            Op->Asl.Child->Asl.Next, -            PredefinedNames[Index].Info.ExpectedBtypes); +    /* +     * If no return value is expected from this predefined name, then +     * it follows that it must be implemented as a control method +     * (with zero args, because the args > 0 case was handled above) +     * Examples are: _DIS, _INI, _IRC, _OFF, _ON, _PSx +     */ +    if (!PredefinedNames[Index].Info.ExpectedBtypes) +    { +        AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op, +            "with zero arguments");          return;      } + +    /* Typecheck the actual object, it is the next argument */ + +    ObjectOp = Op->Asl.Child->Asl.Next; +    ApCheckObjectType (PredefinedNames[Index].Info.Name, +        Op->Asl.Child->Asl.Next, +        PredefinedNames[Index].Info.ExpectedBtypes, +        ACPI_NOT_PACKAGE_ELEMENT); + +    /* For packages, check the individual package elements */ + +    if (ObjectOp->Asl.ParseOpcode == PARSEOP_PACKAGE) +    { +        ApCheckPackage (ObjectOp, &PredefinedNames[Index]); +    }  } @@ -646,6 +661,9 @@ ApCheckForSpecialName (   * PARAMETERS:  PredefinedName  - Name of the predefined object we are checking   *              Op              - Current parse node   *              ExpectedBtypes  - Bitmap of expected return type(s) + *              PackageIndex    - Index of object within parent package (if + *                                applicable - ACPI_NOT_PACKAGE_ELEMENT + *                                otherwise)   *   * RETURN:      None   * @@ -655,14 +673,23 @@ ApCheckForSpecialName (   *   ******************************************************************************/ -static void +ACPI_STATUS  ApCheckObjectType (      const char              *PredefinedName,      ACPI_PARSE_OBJECT       *Op, -    UINT32                  ExpectedBtypes) +    UINT32                  ExpectedBtypes, +    UINT32                  PackageIndex)  {      UINT32                  ReturnBtype; +    char                    *TypeName; + + +    if (!Op) +    { +        return (AE_TYPE); +    } +    /* Map the parse opcode to a bitmapped return type (RTYPE) */      switch (Op->Asl.ParseOpcode)      { @@ -671,24 +698,35 @@ ApCheckObjectType (      case PARSEOP_ONES:      case PARSEOP_INTEGER:          ReturnBtype = ACPI_RTYPE_INTEGER; -        break; - -    case PARSEOP_BUFFER: -        ReturnBtype = ACPI_RTYPE_BUFFER; +        TypeName = "Integer";          break;      case PARSEOP_STRING_LITERAL:          ReturnBtype = ACPI_RTYPE_STRING; +        TypeName = "String"; +        break; + +    case PARSEOP_BUFFER: +        ReturnBtype = ACPI_RTYPE_BUFFER; +        TypeName = "Buffer";          break;      case PARSEOP_PACKAGE:      case PARSEOP_VAR_PACKAGE:          ReturnBtype = ACPI_RTYPE_PACKAGE; +        TypeName = "Package"; +        break; + +    case PARSEOP_NAMESEG: +    case PARSEOP_NAMESTRING: +        ReturnBtype = ACPI_RTYPE_REFERENCE; +        TypeName = "Reference";          break;      default:          /* Not one of the supported object types */ +        TypeName = UtGetOpName (Op->Asl.ParseOpcode);          goto TypeErrorExit;      } @@ -696,7 +734,7 @@ ApCheckObjectType (      if (ReturnBtype & ExpectedBtypes)      { -        return; +        return (AE_OK);      } @@ -706,11 +744,19 @@ TypeErrorExit:      ApGetExpectedTypes (StringBuffer, ExpectedBtypes); -    sprintf (MsgBuffer, "%s: found %s, requires %s", -        PredefinedName, UtGetOpName (Op->Asl.ParseOpcode), StringBuffer); +    if (PackageIndex == ACPI_NOT_PACKAGE_ELEMENT) +    { +        sprintf (MsgBuffer, "%s: found %s, %s required", +            PredefinedName, TypeName, StringBuffer); +    } +    else +    { +        sprintf (MsgBuffer, "%s: found %s at index %u, %s required", +            PredefinedName, TypeName, PackageIndex, StringBuffer); +    } -    AslError (ASL_ERROR, ASL_MSG_RESERVED_OPERAND_TYPE, Op, -        MsgBuffer); +    AslError (ASL_ERROR, ASL_MSG_RESERVED_OPERAND_TYPE, Op, MsgBuffer); +    return (AE_TYPE);  } diff --git a/source/compiler/aslprepkg.c b/source/compiler/aslprepkg.c new file mode 100644 index 000000000000..e8434d529256 --- /dev/null +++ b/source/compiler/aslprepkg.c @@ -0,0 +1,661 @@ +/****************************************************************************** + * + * Module Name: aslprepkg - support for ACPI predefined name package objects + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2013, Intel Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *    notice, this list of conditions, and the following disclaimer, + *    without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + *    substantially similar to the "NO WARRANTY" disclaimer below + *    ("Disclaimer") and any redistribution must be conditioned upon + *    including a substantially similar Disclaimer requirement for further + *    binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + *    of any contributors may be used to endorse or promote products derived + *    from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + +#include "aslcompiler.h" +#include "aslcompiler.y.h" +#include "acpredef.h" + + +#define _COMPONENT          ACPI_COMPILER +        ACPI_MODULE_NAME    ("aslprepkg") + + +/* Local prototypes */ + +static void +ApCheckPackageElements ( +    const char              *PredefinedName, +    ACPI_PARSE_OBJECT       *Op, +    UINT8                   Type1, +    UINT32                  Count1, +    UINT8                   Type2, +    UINT32                  Count2); + +static void +ApCheckPackageList ( +    const char                  *PredefinedName, +    ACPI_PARSE_OBJECT           *ParentOp, +    const ACPI_PREDEFINED_INFO  *Package, +    UINT32                      StartIndex, +    UINT32                      Count); + +static void +ApPackageTooSmall ( +    const char                  *PredefinedName, +    ACPI_PARSE_OBJECT           *Op, +    UINT32                      Count, +    UINT32                      ExpectedCount); + +static void +ApZeroLengthPackage ( +    const char                  *PredefinedName, +    ACPI_PARSE_OBJECT           *Op); + +static void +ApPackageTooLarge ( +    const char                  *PredefinedName, +    ACPI_PARSE_OBJECT           *Op, +    UINT32                      Count, +    UINT32                      ExpectedCount); + + +/******************************************************************************* + * + * FUNCTION:    ApCheckPackage + * + * PARAMETERS:  ParentOp        - Parser op for the package + *              Predefined      - Pointer to package-specific info for method + * + * RETURN:      None + * + * DESCRIPTION: Top-level validation for predefined name return package + *              objects. + * + ******************************************************************************/ + +void +ApCheckPackage ( +    ACPI_PARSE_OBJECT           *ParentOp, +    const ACPI_PREDEFINED_INFO  *Predefined) +{ +    ACPI_PARSE_OBJECT           *Op; +    const ACPI_PREDEFINED_INFO  *Package; +    ACPI_STATUS                 Status; +    UINT32                      ExpectedCount; +    UINT32                      Count; +    UINT32                      i; + + +    /* The package info for this name is in the next table entry */ + +    Package = Predefined + 1; + +    /* First child is the package length */ + +    Op = ParentOp->Asl.Child; +    Count = (UINT32) Op->Asl.Value.Integer; + +    /* +     * Most packages must have at least one element. The only exception +     * is the variable-length package (ACPI_PTYPE1_VAR). +     */ +    if (!Count) +    { +        if (Package->RetInfo.Type != ACPI_PTYPE1_VAR) +        { +            ApZeroLengthPackage (Predefined->Info.Name, ParentOp); +        } +        return; +    } + +    /* Get the first element of the package */ + +    Op = Op->Asl.Next; + +    /* Decode the package type */ + +    switch (Package->RetInfo.Type) +    { +    case ACPI_PTYPE1_FIXED: +        /* +         * The package count is fixed and there are no sub-packages +         * +         * If package is too small, exit. +         * If package is larger than expected, issue warning but continue +         */ +        ExpectedCount = Package->RetInfo.Count1 + Package->RetInfo.Count2; +        if (Count < ExpectedCount) +        { +            goto PackageTooSmall; +        } +        else if (Count > ExpectedCount) +        { +            ApPackageTooLarge (Predefined->Info.Name, ParentOp, +                Count, ExpectedCount); +        } + +        /* Validate all elements of the package */ + +        ApCheckPackageElements (Predefined->Info.Name, Op, +            Package->RetInfo.ObjectType1, Package->RetInfo.Count1, +            Package->RetInfo.ObjectType2, Package->RetInfo.Count2); +        break; + +    case ACPI_PTYPE1_VAR: +        /* +         * The package count is variable, there are no sub-packages, and all +         * elements must be of the same type +         */ +        for (i = 0; i < Count; i++) +        { +            ApCheckObjectType (Predefined->Info.Name, Op, +                Package->RetInfo.ObjectType1, i); +            Op = Op->Asl.Next; +        } +        break; + +    case ACPI_PTYPE1_OPTION: +        /* +         * The package count is variable, there are no sub-packages. There are +         * a fixed number of required elements, and a variable number of +         * optional elements. +         * +         * Check if package is at least as large as the minimum required +         */ +        ExpectedCount = Package->RetInfo3.Count; +        if (Count < ExpectedCount) +        { +            goto PackageTooSmall; +        } + +        /* Variable number of sub-objects */ + +        for (i = 0; i < Count; i++) +        { +            if (i < Package->RetInfo3.Count) +            { +                /* These are the required package elements (0, 1, or 2) */ + +                ApCheckObjectType (Predefined->Info.Name, Op, +                    Package->RetInfo3.ObjectType[i], i); +            } +            else +            { +                /* These are the optional package elements */ + +                ApCheckObjectType (Predefined->Info.Name, Op, +                    Package->RetInfo3.TailObjectType, i); +            } +            Op = Op->Asl.Next; +        } +        break; + +    case ACPI_PTYPE2_REV_FIXED: + +        /* First element is the (Integer) revision */ + +        ApCheckObjectType (Predefined->Info.Name, Op, +            ACPI_RTYPE_INTEGER, 0); + +        Op = Op->Asl.Next; +        Count--; + +        /* Examine the sub-packages */ + +        ApCheckPackageList (Predefined->Info.Name, Op, +            Package, 1, Count); +        break; + +    case ACPI_PTYPE2_PKG_COUNT: + +        /* First element is the (Integer) count of sub-packages to follow */ + +        Status = ApCheckObjectType (Predefined->Info.Name, Op, +            ACPI_RTYPE_INTEGER, 0); + +        /* We must have an integer count from above (otherwise, use Count) */ + +        if (ACPI_SUCCESS (Status)) +        { +            /* +             * Count cannot be larger than the parent package length, but allow it +             * to be smaller. The >= accounts for the Integer above. +             */ +            ExpectedCount = (UINT32) Op->Asl.Value.Integer; +            if (ExpectedCount >= Count) +            { +                goto PackageTooSmall; +            } + +            Count = ExpectedCount; +        } + +        Op = Op->Asl.Next; + +        /* Examine the sub-packages */ + +        ApCheckPackageList (Predefined->Info.Name, Op, +            Package, 1, Count); +        break; + +    case ACPI_PTYPE2: +    case ACPI_PTYPE2_FIXED: +    case ACPI_PTYPE2_MIN: +    case ACPI_PTYPE2_COUNT: +    case ACPI_PTYPE2_FIX_VAR: +        /* +         * These types all return a single Package that consists of a +         * variable number of sub-Packages. +         */ + +        /* Examine the sub-packages */ + +        ApCheckPackageList (Predefined->Info.Name, Op, +            Package, 0, Count); +        break; + +    default: +        return; +    } + +    return; + +PackageTooSmall: +    ApPackageTooSmall (Predefined->Info.Name, ParentOp, +        Count, ExpectedCount); +} + + +/******************************************************************************* + * + * FUNCTION:    ApCheckPackageElements + * + * PARAMETERS:  PredefinedName  - Pointer to validation data structure + *              Op              - Parser op for the package + *              Type1           - Object type for first group + *              Count1          - Count for first group + *              Type2           - Object type for second group + *              Count2          - Count for second group + * + * RETURN:      None + * + * DESCRIPTION: Validate all elements of a package. Works with packages that + *              are defined to contain up to two groups of different object + *              types. + * + ******************************************************************************/ + +static void +ApCheckPackageElements ( +    const char              *PredefinedName, +    ACPI_PARSE_OBJECT       *Op, +    UINT8                   Type1, +    UINT32                  Count1, +    UINT8                   Type2, +    UINT32                  Count2) +{ +    UINT32                  i; + + +    /* +     * Up to two groups of package elements are supported by the data +     * structure. All elements in each group must be of the same type. +     * The second group can have a count of zero. +     * +     * Aborts check upon a NULL package element, as this means (at compile +     * time) that the remainder of the package elements are also NULL +     * (This is the only way to create NULL package elements.) +     */ +    for (i = 0; (i < Count1) && Op; i++) +    { +        ApCheckObjectType (PredefinedName, Op, Type1, i); +        Op = Op->Asl.Next; +    } + +    for (i = 0; (i < Count2) && Op; i++) +    { +        ApCheckObjectType (PredefinedName, Op, Type2, (i + Count1)); +        Op = Op->Asl.Next; +    } +} + + +/******************************************************************************* + * + * FUNCTION:    ApCheckPackageList + * + * PARAMETERS:  PredefinedName      - Name of the predefined object + *              ParentOp            - Parser op of the parent package + *              Package             - Package info for this predefined name + *              StartIndex          - Index in parent package where list begins + *              ParentCount         - Element count of parent package + * + * RETURN:      None + * + * DESCRIPTION: Validate the individual package elements for a predefined name. + *              Handles the cases where the predefined name is defined as a + *              Package of Packages (subpackages). These are the types: + * + *              ACPI_PTYPE2 + *              ACPI_PTYPE2_FIXED + *              ACPI_PTYPE2_MIN + *              ACPI_PTYPE2_COUNT + *              ACPI_PTYPE2_FIX_VAR + * + ******************************************************************************/ + +static void +ApCheckPackageList ( +    const char                  *PredefinedName, +    ACPI_PARSE_OBJECT           *ParentOp, +    const ACPI_PREDEFINED_INFO  *Package, +    UINT32                      StartIndex, +    UINT32                      ParentCount) +{ +    ACPI_PARSE_OBJECT           *SubPackageOp = ParentOp; +    ACPI_PARSE_OBJECT           *Op; +    ACPI_STATUS                 Status; +    UINT32                      Count; +    UINT32                      ExpectedCount; +    UINT32                      i; +    UINT32                      j; + + +    /* +     * Validate each subpackage in the parent Package +     * +     * Note: We ignore NULL package elements on the assumption that +     * they will be initialized by the BIOS or other ASL code. +     */ +    for (i = 0; (i < ParentCount) && SubPackageOp; i++) +    { +        /* Each object in the list must be of type Package */ + +        Status = ApCheckObjectType (PredefinedName, SubPackageOp, +            ACPI_RTYPE_PACKAGE, i + StartIndex); +        if (ACPI_FAILURE (Status)) +        { +            goto NextSubpackage; +        } + +        /* Examine the different types of expected subpackages */ + +        Op = SubPackageOp->Asl.Child; + +        /* First child is the package length */ + +        Count = (UINT32) Op->Asl.Value.Integer; +        Op = Op->Asl.Next; + +        /* The subpackage must have at least one element */ + +        if (!Count) +        { +            ApZeroLengthPackage (PredefinedName, SubPackageOp); +            goto NextSubpackage; +        } + +        /* +         * Decode the package type. +         * PTYPE2 indicates that a "package of packages" is expected for +         * this name. The various flavors of PTYPE2 indicate the number +         * and format of the subpackages. +         */ +        switch (Package->RetInfo.Type) +        { +        case ACPI_PTYPE2: +        case ACPI_PTYPE2_PKG_COUNT: +        case ACPI_PTYPE2_REV_FIXED: + +            /* Each subpackage has a fixed number of elements */ + +            ExpectedCount = Package->RetInfo.Count1 + Package->RetInfo.Count2; +            if (Count < ExpectedCount) +            { +                ApPackageTooSmall (PredefinedName, SubPackageOp, +                    Count, ExpectedCount); +                break; +            } + +            ApCheckPackageElements (PredefinedName, Op, +                Package->RetInfo.ObjectType1, Package->RetInfo.Count1, +                Package->RetInfo.ObjectType2, Package->RetInfo.Count2); +            break; + +        case ACPI_PTYPE2_FIX_VAR: +            /* +             * Each subpackage has a fixed number of elements and an +             * optional element +             */ +            ExpectedCount = Package->RetInfo.Count1 + Package->RetInfo.Count2; +            if (Count < ExpectedCount) +            { +                ApPackageTooSmall (PredefinedName, SubPackageOp, +                    Count, ExpectedCount); +                break; +            } + +            ApCheckPackageElements (PredefinedName, Op, +                Package->RetInfo.ObjectType1, Package->RetInfo.Count1, +                Package->RetInfo.ObjectType2, +                Count - Package->RetInfo.Count1); +            break; + +        case ACPI_PTYPE2_FIXED: + +            /* Each sub-package has a fixed length */ + +            ExpectedCount = Package->RetInfo2.Count; +            if (Count < ExpectedCount) +            { +                ApPackageTooSmall (PredefinedName, SubPackageOp, +                    Count, ExpectedCount); +                break; +            } + +            /* Check each object/type combination */ + +            for (j = 0; j < ExpectedCount; j++) +            { +                ApCheckObjectType (PredefinedName, Op, +                    Package->RetInfo2.ObjectType[j], j); + +                Op = Op->Asl.Next; +            } +            break; + +        case ACPI_PTYPE2_MIN: + +            /* Each sub-package has a variable but minimum length */ + +            ExpectedCount = Package->RetInfo.Count1; +            if (Count < ExpectedCount) +            { +                ApPackageTooSmall (PredefinedName, SubPackageOp, +                    Count, ExpectedCount); +                break; +            } + +            /* Check the type of each sub-package element */ + +            ApCheckPackageElements (PredefinedName, Op, +                Package->RetInfo.ObjectType1, Count, 0, 0); +            break; + +        case ACPI_PTYPE2_COUNT: +            /* +             * First element is the (Integer) count of elements, including +             * the count field (the ACPI name is NumElements) +             */ +            Status = ApCheckObjectType (PredefinedName, Op, +                ACPI_RTYPE_INTEGER, 0); + +            /* We must have an integer count from above (otherwise, use Count) */ + +            if (ACPI_SUCCESS (Status)) +            { +                /* +                 * Make sure package is large enough for the Count and is +                 * is as large as the minimum size +                 */ +                ExpectedCount = (UINT32) Op->Asl.Value.Integer; + +                if (Count < ExpectedCount) +                { +                    ApPackageTooSmall (PredefinedName, SubPackageOp, +                        Count, ExpectedCount); +                    break; +                } +                else if (Count > ExpectedCount) +                { +                    ApPackageTooLarge (PredefinedName, SubPackageOp, +                        Count, ExpectedCount); +                } + +                /* Some names of this type have a minimum length */ + +                if (Count < Package->RetInfo.Count1) +                { +                    ExpectedCount = Package->RetInfo.Count1; +                    ApPackageTooSmall (PredefinedName, SubPackageOp, +                        Count, ExpectedCount); +                    break; +                } + +                Count = ExpectedCount; +            } + +            /* Check the type of each sub-package element */ + +            Op = Op->Asl.Next; +            ApCheckPackageElements (PredefinedName, Op, +                Package->RetInfo.ObjectType1, (Count - 1), 0, 0); +            break; + +        default: +            break; +        } + +NextSubpackage: +        SubPackageOp = SubPackageOp->Asl.Next; +    } +} + + +/******************************************************************************* + * + * FUNCTION:    ApPackageTooSmall + * + * PARAMETERS:  PredefinedName      - Name of the predefined object + *              Op                  - Current parser op + *              Count               - Actual package element count + *              ExpectedCount       - Expected package element count + * + * RETURN:      None + * + * DESCRIPTION: Issue error message for a package that is smaller than + *              required. + * + ******************************************************************************/ + +static void +ApPackageTooSmall ( +    const char                  *PredefinedName, +    ACPI_PARSE_OBJECT           *Op, +    UINT32                      Count, +    UINT32                      ExpectedCount) +{ + +    sprintf (MsgBuffer, "%s: length %u, required minimum is %u", +        PredefinedName, Count, ExpectedCount); + +    AslError (ASL_ERROR, ASL_MSG_RESERVED_PACKAGE_LENGTH, Op, MsgBuffer); +} + + +/******************************************************************************* + * + * FUNCTION:    ApZeroLengthPackage + * + * PARAMETERS:  PredefinedName      - Name of the predefined object + *              Op                  - Current parser op + * + * RETURN:      None + * + * DESCRIPTION: Issue error message for a zero-length package (a package that + *              is required to have a non-zero length). Variable length + *              packages seem to be allowed to have zero length, however. + *              Even if not allowed, BIOS code does it. + * + ******************************************************************************/ + +static void +ApZeroLengthPackage ( +    const char                  *PredefinedName, +    ACPI_PARSE_OBJECT           *Op) +{ + +    sprintf (MsgBuffer, "%s: length is zero", PredefinedName); + +    AslError (ASL_ERROR, ASL_MSG_RESERVED_PACKAGE_LENGTH, Op, MsgBuffer); +} + + +/******************************************************************************* + * + * FUNCTION:    ApPackageTooLarge + * + * PARAMETERS:  PredefinedName      - Name of the predefined object + *              Op                  - Current parser op + *              Count               - Actual package element count + *              ExpectedCount       - Expected package element count + * + * RETURN:      None + * + * DESCRIPTION: Issue a remark for a package that is larger than expected. + * + ******************************************************************************/ + +static void +ApPackageTooLarge ( +    const char                  *PredefinedName, +    ACPI_PARSE_OBJECT           *Op, +    UINT32                      Count, +    UINT32                      ExpectedCount) +{ + +    sprintf (MsgBuffer, "%s: length is %u, only %u required", +        PredefinedName, Count, ExpectedCount); + +    AslError (ASL_REMARK, ASL_MSG_RESERVED_PACKAGE_LENGTH, Op, MsgBuffer); +} diff --git a/source/compiler/aslstartup.c b/source/compiler/aslstartup.c index c8c64490e45c..ad9a2bb932d8 100644 --- a/source/compiler/aslstartup.c +++ b/source/compiler/aslstartup.c @@ -44,6 +44,7 @@  #include "aslcompiler.h"  #include "actables.h" +#include "acdisasm.h"  #include "acapps.h"  #define _COMPONENT          ACPI_COMPILER @@ -66,6 +67,10 @@ static UINT8  AslDetectSourceFileType (      ASL_FILE_INFO           *Info); +static ACPI_STATUS +AslDoDisassembly ( +    void); +  /*******************************************************************************   * @@ -224,6 +229,15 @@ AslDetectSourceFileType (      ACPI_STATUS             Status; +    /* Check for a valid binary ACPI table */ + +    Status = FlCheckForAcpiTable (Info->Handle); +    if (ACPI_SUCCESS (Status)) +    { +        Type = ASL_INPUT_TYPE_ACPI_TABLE; +        goto Cleanup; +    } +      /* Check for 100% ASCII source file (comments are ignored) */      Status = FlCheckForAscii (Info->Handle, Info->Filename, TRUE); @@ -279,6 +293,86 @@ Cleanup:  /*******************************************************************************   * + * FUNCTION:    AslDoDisassembly + * + * PARAMETERS:  None + * + * RETURN:      Status + * + * DESCRIPTION: Initiate AML file disassembly. Uses ACPICA subsystem to build + *              namespace. + * + ******************************************************************************/ + +static ACPI_STATUS +AslDoDisassembly ( +    void) +{ +    ACPI_STATUS             Status; + + +    /* ACPICA subsystem initialization */ + +    Status = AdInitialize (); +    if (ACPI_FAILURE (Status)) +    { +        return (Status); +    } + +    Status = AcpiAllocateRootTable (4); +    if (ACPI_FAILURE (Status)) +    { +        AcpiOsPrintf ("Could not initialize ACPI Table Manager, %s\n", +            AcpiFormatException (Status)); +        return (Status); +    } + +    /* This is where the disassembly happens */ + +    AcpiGbl_DbOpt_disasm = TRUE; +    Status = AdAmlDisassemble (AslToFile, +        Gbl_Files[ASL_FILE_INPUT].Filename, Gbl_OutputFilenamePrefix, +        &Gbl_Files[ASL_FILE_INPUT].Filename, Gbl_GetAllTables); +    if (ACPI_FAILURE (Status)) +    { +        return (Status); +    } + +    /* Check if any control methods were unresolved */ + +    AcpiDmUnresolvedWarning (0); + +#if 0 +    /* TBD: Handle additional output files for disassembler */ + +    Status = FlOpenMiscOutputFiles (Gbl_OutputFilenamePrefix); +    NsDisplayNamespace (); +#endif + +    /* Shutdown compiler and ACPICA subsystem */ + +    AeClearErrorLog (); +    (void) AcpiTerminate (); + +    /* +     * Gbl_Files[ASL_FILE_INPUT].Filename was replaced with the +     * .DSL disassembly file, which can now be compiled if requested +     */ +    if (Gbl_DoCompile) +    { +        AcpiOsPrintf ("\nCompiling \"%s\"\n", +            Gbl_Files[ASL_FILE_INPUT].Filename); +        return (AE_CTRL_CONTINUE); +    } + +    ACPI_FREE (Gbl_Files[ASL_FILE_INPUT].Filename); +    Gbl_Files[ASL_FILE_INPUT].Filename = NULL; +    return (AE_OK); +} + + +/******************************************************************************* + *   * FUNCTION:    AslDoOneFile   *   * PARAMETERS:  Filename        - Name of the file @@ -308,61 +402,11 @@ AslDoOneFile (       */      if (Gbl_DisasmFlag || Gbl_GetAllTables)      { -        /* ACPICA subsystem initialization */ - -        Status = AdInitialize (); -        if (ACPI_FAILURE (Status)) -        { -            return (Status); -        } - -        Status = AcpiAllocateRootTable (4); -        if (ACPI_FAILURE (Status)) -        { -            AcpiOsPrintf ("Could not initialize ACPI Table Manager, %s\n", -                AcpiFormatException (Status)); -            return (Status); -        } - -        /* This is where the disassembly happens */ - -        AcpiGbl_DbOpt_disasm = TRUE; -        Status = AdAmlDisassemble (AslToFile, -                    Gbl_Files[ASL_FILE_INPUT].Filename, -                    Gbl_OutputFilenamePrefix, -                    &Gbl_Files[ASL_FILE_INPUT].Filename, -                    Gbl_GetAllTables); -        if (ACPI_FAILURE (Status)) +        Status = AslDoDisassembly (); +        if (Status != AE_CTRL_CONTINUE)          {              return (Status);          } - -#if 0 -        /* TBD: Handle additional output files for disassembler */ - -        Status = FlOpenMiscOutputFiles (Gbl_OutputFilenamePrefix); -        NsDisplayNamespace (); -#endif - -        /* Shutdown compiler and ACPICA subsystem */ - -        AeClearErrorLog (); -        (void) AcpiTerminate (); - -        /* -         * Gbl_Files[ASL_FILE_INPUT].Filename was replaced with the -         * .DSL disassembly file, which can now be compiled if requested -         */ -        if (Gbl_DoCompile) -        { -            AcpiOsPrintf ("\nCompiling \"%s\"\n", -                Gbl_Files[ASL_FILE_INPUT].Filename); -        } -        else -        { -            Gbl_Files[ASL_FILE_INPUT].Filename = NULL; -            return (AE_OK); -        }      }      /* @@ -469,6 +513,21 @@ AslDoOneFile (          PrTerminatePreprocessor ();          return (AE_OK); +    /* +     * Binary ACPI table was auto-detected, disassemble it +     */ +    case ASL_INPUT_TYPE_ACPI_TABLE: + +        /* We have what appears to be an ACPI table, disassemble it */ + +        FlCloseFile (ASL_FILE_INPUT); +        Gbl_DoCompile = FALSE; +        Gbl_DisasmFlag = TRUE; +        Status = AslDoDisassembly (); +        return (Status); + +    /* Unknown binary table */ +      case ASL_INPUT_TYPE_BINARY:          AePrintErrorLog (ASL_FILE_STDERR); diff --git a/source/compiler/aslsupport.l b/source/compiler/aslsupport.l index 90af04932b57..52389eefa577 100644 --- a/source/compiler/aslsupport.l +++ b/source/compiler/aslsupport.l @@ -403,6 +403,9 @@ count (          TotalKeywords++;          TotalExecutableOpcodes++;          break; + +    default: +        break;      }      for (i = 0; (yytext[i] != 0) && (yytext[i] != EOF); i++) @@ -570,7 +573,6 @@ AslDoStringLiteral (          AslInsertLineBuffer (StringChar);  DoCharacter: -          switch (State)          {          case ASL_NORMAL_CHAR: @@ -590,6 +592,9 @@ DoCharacter:                  /* String terminator */                  goto CompletedString; + +            default: +                break;              }              break; @@ -748,6 +753,9 @@ DoCharacter:              ConvertBuffer[i] = StringChar;              i++;              continue; + +        default: +            break;          }          /* Save the finished character */ diff --git a/source/compiler/dtcompiler.h b/source/compiler/dtcompiler.h index f557ca3063c0..f83ef7707d4a 100644 --- a/source/compiler/dtcompiler.h +++ b/source/compiler/dtcompiler.h @@ -444,6 +444,10 @@ DtCompileMsct (      void                    **PFieldList);  ACPI_STATUS +DtCompileMtmr ( +    void                    **PFieldList); + +ACPI_STATUS  DtCompilePmtt (      void                    **PFieldList); @@ -472,6 +476,10 @@ DtCompileUefi (      void                    **PFieldList);  ACPI_STATUS +DtCompileVrtc ( +    void                    **PFieldList); + +ACPI_STATUS  DtCompileWdat (      void                    **PFieldList); @@ -511,6 +519,7 @@ extern const unsigned char  TemplateMcfg[];  extern const unsigned char  TemplateMchi[];  extern const unsigned char  TemplateMpst[];  extern const unsigned char  TemplateMsct[]; +extern const unsigned char  TemplateMtmr[];  extern const unsigned char  TemplatePmtt[];  extern const unsigned char  TemplateRsdt[];  extern const unsigned char  TemplateS3pt[]; @@ -523,6 +532,7 @@ extern const unsigned char  TemplateSrat[];  extern const unsigned char  TemplateTcpa[];  extern const unsigned char  TemplateTpm2[];  extern const unsigned char  TemplateUefi[]; +extern const unsigned char  TemplateVrtc[];  extern const unsigned char  TemplateWaet[];  extern const unsigned char  TemplateWdat[];  extern const unsigned char  TemplateWddt[]; diff --git a/source/compiler/dttable.c b/source/compiler/dttable.c index 922159f1ffd2..b3ce5de21020 100644 --- a/source/compiler/dttable.c +++ b/source/compiler/dttable.c @@ -1412,6 +1412,31 @@ DtCompileMsct (  /******************************************************************************   * + * FUNCTION:    DtCompileMtmr + * + * PARAMETERS:  List                - Current field list pointer + * + * RETURN:      Status + * + * DESCRIPTION: Compile MTMR. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileMtmr ( +    void                    **List) +{ +    ACPI_STATUS             Status; + + +    Status = DtCompileTwoSubtables (List, +                 AcpiDmTableInfoMtmr, AcpiDmTableInfoMtmr0); +    return (Status); +} + + +/****************************************************************************** + *   * FUNCTION:    DtCompilePmtt   *   * PARAMETERS:  List                - Current field list pointer @@ -1974,6 +1999,31 @@ DtCompileUefi (  /******************************************************************************   * + * FUNCTION:    DtCompileVrtc + * + * PARAMETERS:  List                - Current field list pointer + * + * RETURN:      Status + * + * DESCRIPTION: Compile VRTC. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileVrtc ( +    void                    **List) +{ +    ACPI_STATUS             Status; + + +    Status = DtCompileTwoSubtables (List, +                 AcpiDmTableInfoVrtc, AcpiDmTableInfoVrtc0); +    return (Status); +} + + +/****************************************************************************** + *   * FUNCTION:    DtCompileWdat   *   * PARAMETERS:  List                - Current field list pointer diff --git a/source/compiler/dttemplate.h b/source/compiler/dttemplate.h index 07d1f91eea37..d3fadf504ef9 100644 --- a/source/compiler/dttemplate.h +++ b/source/compiler/dttemplate.h @@ -632,6 +632,20 @@ const unsigned char TemplateMsct[] =      0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00   /* 00000088    "........" */  }; +const unsigned char TemplateMtmr[] = +{ +    0x4D,0x54,0x4D,0x52,0x4C,0x00,0x00,0x00,  /* 00000000    "MTMRL..." */ +    0x01,0xB0,0x49,0x4E,0x54,0x45,0x4C,0x20,  /* 00000008    "..INTEL " */ +    0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45,  /* 00000010    "TEMPLATE" */ +    0x03,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C,  /* 00000018    "....INTL" */ +    0x17,0x01,0x13,0x20,0x00,0x20,0x00,0x03,  /* 00000020    "... . .." */ +    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000028    "........" */ +    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000030    "........" */ +    0x00,0x20,0x00,0x03,0x00,0x00,0x00,0x00,  /* 00000038    ". ......" */ +    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000040    "........" */ +    0x00,0x00,0x00,0x00                       /* 00000048    "...."     */ +}; +  const unsigned char TemplatePmtt[] =  {      0x50,0x4D,0x54,0x54,0xB4,0x00,0x00,0x00,  /* 00000000    "PMTT...." */ @@ -893,6 +907,19 @@ const unsigned char TemplateUefi[] =      0x0C,0x0D,0x0E,0x0F,0x00,0x00             /* 00000030    "......"   */  }; +const unsigned char TemplateVrtc[] = +{ +    0x56,0x52,0x54,0x43,0x44,0x00,0x00,0x00,  /* 00000000    "VRTCD..." */ +    0x01,0xEF,0x49,0x4E,0x54,0x45,0x4C,0x20,  /* 00000008    "..INTEL " */ +    0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45,  /* 00000010    "TEMPLATE" */ +    0x03,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C,  /* 00000018    "....INTL" */ +    0x17,0x01,0x13,0x20,0x00,0x08,0x00,0x00,  /* 00000020    "... ...." */ +    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000028    "........" */ +    0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,  /* 00000030    "........" */ +    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000038    "........" */ +    0x00,0x00,0x00,0x00                       /* 00000040    "...."     */ +}; +  const unsigned char TemplateWaet[] =  {      0x57,0x41,0x45,0x54,0x28,0x00,0x00,0x00,  /* 00000000    "WAET(..." */ diff --git a/source/components/debugger/dbcmds.c b/source/components/debugger/dbcmds.c index 5755772a629f..3a1afa2ce74f 100644 --- a/source/components/debugger/dbcmds.c +++ b/source/components/debugger/dbcmds.c @@ -1024,6 +1024,8 @@ GetCrs:          /* Execute _SRS with the resource list */ +        AcpiOsPrintf ("Evaluating _SRS\n"); +          Status = AcpiSetCurrentResources (Node, &ReturnBuffer);          if (ACPI_FAILURE (Status))          { @@ -1114,8 +1116,8 @@ Cleanup:   * FUNCTION:    AcpiDbDisplayResources   *   * PARAMETERS:  ObjectArg           - String object name or object pointer. - *                                    "*" means "display resources for all - *                                    devices" + *                                    NULL or "*" means "display resources for + *                                    all devices"   *   * RETURN:      None   * @@ -1135,7 +1137,7 @@ AcpiDbDisplayResources (      /* Asterisk means "display resources for all devices" */ -    if (!ACPI_STRCMP (ObjectArg, "*")) +    if (!ObjectArg || (!ACPI_STRCMP (ObjectArg, "*")))      {          (void) AcpiWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,                      ACPI_UINT32_MAX, AcpiDbDeviceResources, NULL, NULL, NULL); diff --git a/source/components/debugger/dbinput.c b/source/components/debugger/dbinput.c index b7ee073345a9..d89187226286 100644 --- a/source/components/debugger/dbinput.c +++ b/source/components/debugger/dbinput.c @@ -207,7 +207,7 @@ static const ACPI_DB_COMMAND_INFO   AcpiGbl_DbCommands[] =      {"PREFIX",       0},      {"QUIT",         0},      {"REFERENCES",   1}, -    {"RESOURCES",    1}, +    {"RESOURCES",    0},      {"RESULTS",      0},      {"SET",          3},      {"SLEEP",        0}, @@ -272,7 +272,7 @@ static const ACPI_DB_COMMAND_HELP   AcpiGbl_DbCommandHelp[] =      {1, "  Predefined",                        "Check all predefined names\n"},      {1, "  Prefix [<NamePath>]",               "Set or Get current execution prefix\n"},      {1, "  References <Addr>",                 "Find all references to object at addr\n"}, -    {1, "  Resources <DeviceName | *>",        "Display Device resources (* = all devices)\n"}, +    {1, "  Resources [DeviceName]",            "Display Device resources (no arg = all devices)\n"},      {1, "  Set N <NamedObject> <Value>",       "Set value for named integer\n"},      {1, "  Sleep [SleepState]",                "Simulate sleep/wake sequence(s) (0-5)\n"},      {1, "  Template <Object>",                 "Format/dump a Buffer/ResourceTemplate\n"}, diff --git a/source/components/disassembler/dmresrc.c b/source/components/disassembler/dmresrc.c index 29f2eb74c3ab..5041e889ee7f 100644 --- a/source/components/disassembler/dmresrc.c +++ b/source/components/disassembler/dmresrc.c @@ -416,7 +416,7 @@ AcpiDmIsResourceTemplate (      /* Walk the byte list, abort on any invalid descriptor type or length */      Status = AcpiUtWalkAmlResources (WalkState, Aml, Length, -        NULL, (void **) &EndAml); +        NULL, ACPI_CAST_INDIRECT_PTR (void, &EndAml));      if (ACPI_FAILURE (Status))      {          return (AE_TYPE); diff --git a/source/components/dispatcher/dsutils.c b/source/components/dispatcher/dsutils.c index 41a66859c820..a7cc232d641b 100644 --- a/source/components/dispatcher/dsutils.c +++ b/source/components/dispatcher/dsutils.c @@ -201,7 +201,7 @@ AcpiDsIsResultUsed (      if (!Op)      {          ACPI_ERROR ((AE_INFO, "Null Op")); -        return_VALUE (TRUE); +        return_UINT8 (TRUE);      }      /* @@ -231,7 +231,7 @@ AcpiDsIsResultUsed (          ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,              "At Method level, result of [%s] not used\n",              AcpiPsGetOpcodeName (Op->Common.AmlOpcode))); -        return_VALUE (FALSE); +        return_UINT8 (FALSE);      }      /* Get info on the parent. The RootOp is AML_SCOPE */ @@ -241,7 +241,7 @@ AcpiDsIsResultUsed (      {          ACPI_ERROR ((AE_INFO,              "Unknown parent opcode Op=%p", Op)); -        return_VALUE (FALSE); +        return_UINT8 (FALSE);      }      /* @@ -331,7 +331,7 @@ ResultUsed:          AcpiPsGetOpcodeName (Op->Common.AmlOpcode),          AcpiPsGetOpcodeName (Op->Common.Parent->Common.AmlOpcode), Op)); -    return_VALUE (TRUE); +    return_UINT8 (TRUE);  ResultNotUsed: @@ -340,7 +340,7 @@ ResultNotUsed:          AcpiPsGetOpcodeName (Op->Common.AmlOpcode),          AcpiPsGetOpcodeName (Op->Common.Parent->Common.AmlOpcode), Op)); -    return_VALUE (FALSE); +    return_UINT8 (FALSE);  } diff --git a/source/components/events/evevent.c b/source/components/events/evevent.c index ae505dd1479c..fd0b5fba9e96 100644 --- a/source/components/events/evevent.c +++ b/source/components/events/evevent.c @@ -291,6 +291,8 @@ AcpiEvFixedEventDetect (   *   * DESCRIPTION: Clears the status bit for the requested event, calls the   *              handler that previously registered for the event. + *              NOTE: If there is no handler for the event, the event is + *              disabled to prevent futher interrupts.   *   ******************************************************************************/ @@ -309,18 +311,18 @@ AcpiEvFixedEventDispatch (              ACPI_CLEAR_STATUS);      /* -     * Make sure we've got a handler. If not, report an error. The event is -     * disabled to prevent further interrupts. +     * Make sure that a handler exists. If not, report an error +     * and disable the event to prevent further interrupts.       */ -    if (NULL == AcpiGbl_FixedEventHandlers[Event].Handler) +    if (!AcpiGbl_FixedEventHandlers[Event].Handler)      {          (void) AcpiWriteBitRegister (                  AcpiGbl_FixedEventInfo[Event].EnableRegisterId,                  ACPI_DISABLE_EVENT);          ACPI_ERROR ((AE_INFO, -            "No installed handler for fixed event [0x%08X]", -            Event)); +            "No installed handler for fixed event - %s (%u), disabling", +            AcpiUtGetEventName (Event), Event));          return (ACPI_INTERRUPT_NOT_HANDLED);      } diff --git a/source/components/events/evgpe.c b/source/components/events/evgpe.c index 9c6c41692cbb..b6388a371dc8 100644 --- a/source/components/events/evgpe.c +++ b/source/components/events/evgpe.c @@ -770,7 +770,7 @@ AcpiEvGpeDispatch (          {              ACPI_EXCEPTION ((AE_INFO, Status,                  "Unable to clear GPE%02X", GpeNumber)); -            return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); +            return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED);          }      } @@ -788,7 +788,7 @@ AcpiEvGpeDispatch (      {          ACPI_EXCEPTION ((AE_INFO, Status,              "Unable to disable GPE%02X", GpeNumber)); -        return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); +        return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED);      }      /* @@ -846,7 +846,7 @@ AcpiEvGpeDispatch (          break;      } -    return_VALUE (ACPI_INTERRUPT_HANDLED); +    return_UINT32 (ACPI_INTERRUPT_HANDLED);  }  #endif /* !ACPI_REDUCED_HARDWARE */ diff --git a/source/components/events/evsci.c b/source/components/events/evsci.c index 343526884990..eca143f8d122 100644 --- a/source/components/events/evsci.c +++ b/source/components/events/evsci.c @@ -101,7 +101,7 @@ AcpiEvSciXruptHandler (      InterruptHandled |= AcpiEvGpeDetect (GpeXruptList);      AcpiSciCount++; -    return_VALUE (InterruptHandled); +    return_UINT32 (InterruptHandled);  } @@ -137,7 +137,7 @@ AcpiEvGpeXruptHandler (      InterruptHandled |= AcpiEvGpeDetect (GpeXruptList); -    return_VALUE (InterruptHandled); +    return_UINT32 (InterruptHandled);  } diff --git a/source/components/events/evxface.c b/source/components/events/evxface.c index 7c9b3e8052d9..99ea6cc7ae01 100644 --- a/source/components/events/evxface.c +++ b/source/components/events/evxface.c @@ -534,9 +534,9 @@ AcpiInstallFixedEventHandler (          return_ACPI_STATUS (Status);      } -    /* Don't allow two handlers. */ +    /* Do not allow multiple handlers */ -    if (NULL != AcpiGbl_FixedEventHandlers[Event].Handler) +    if (AcpiGbl_FixedEventHandlers[Event].Handler)      {          Status = AE_ALREADY_EXISTS;          goto Cleanup; @@ -550,7 +550,9 @@ AcpiInstallFixedEventHandler (      Status = AcpiEnableEvent (Event, 0);      if (ACPI_FAILURE (Status))      { -        ACPI_WARNING ((AE_INFO, "Could not enable fixed event 0x%X", Event)); +        ACPI_WARNING ((AE_INFO, +            "Could not enable fixed event - %s (%u)", +            AcpiUtGetEventName (Event), Event));          /* Remove the handler */ @@ -560,7 +562,8 @@ AcpiInstallFixedEventHandler (      else      {          ACPI_DEBUG_PRINT ((ACPI_DB_INFO, -            "Enabled fixed event %X, Handler=%p\n", Event, Handler)); +            "Enabled fixed event %s (%X), Handler=%p\n", +            AcpiUtGetEventName (Event), Event, Handler));      } @@ -621,11 +624,14 @@ AcpiRemoveFixedEventHandler (      if (ACPI_FAILURE (Status))      {          ACPI_WARNING ((AE_INFO, -            "Could not write to fixed event enable register 0x%X", Event)); +            "Could not disable fixed event - %s (%u)", +            AcpiUtGetEventName (Event), Event));      }      else      { -        ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Disabled fixed event %X\n", Event)); +        ACPI_DEBUG_PRINT ((ACPI_DB_INFO, +            "Disabled fixed event - %s (%X)\n", +            AcpiUtGetEventName (Event), Event));      }      (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); diff --git a/source/components/events/evxfevnt.c b/source/components/events/evxfevnt.c index 1b3d1da567e4..ae3378e2c00f 100644 --- a/source/components/events/evxfevnt.c +++ b/source/components/events/evxfevnt.c @@ -82,6 +82,13 @@ AcpiEnable (          return_ACPI_STATUS (AE_NO_ACPI_TABLES);      } +    /* If the Hardware Reduced flag is set, machine is always in acpi mode */ + +    if (AcpiGbl_ReducedHardware) +    { +        return_ACPI_STATUS (AE_OK); +    } +      /* Check current mode */      if (AcpiHwGetMode() == ACPI_SYS_MODE_ACPI) @@ -131,6 +138,13 @@ AcpiDisable (      ACPI_FUNCTION_TRACE (AcpiDisable); +    /* If the Hardware Reduced flag is set, machine is always in acpi mode */ + +    if (AcpiGbl_ReducedHardware) +    { +        return_ACPI_STATUS (AE_OK); +    } +      if (AcpiHwGetMode() == ACPI_SYS_MODE_LEGACY)      {          ACPI_DEBUG_PRINT ((ACPI_DB_INIT, diff --git a/source/components/executer/exprep.c b/source/components/executer/exprep.c index 2ccf4a1fdc74..90687a5839a8 100644 --- a/source/components/executer/exprep.c +++ b/source/components/executer/exprep.c @@ -292,7 +292,7 @@ AcpiExDecodeFieldAccess (          ACPI_ERROR ((AE_INFO,              "Unknown field access type 0x%X",              Access)); -        return_VALUE (0); +        return_UINT32 (0);      }      if (ObjDesc->Common.Type == ACPI_TYPE_BUFFER_FIELD) @@ -306,7 +306,7 @@ AcpiExDecodeFieldAccess (      }      *ReturnByteAlignment = ByteAlignment; -    return_VALUE (BitLength); +    return_UINT32 (BitLength);  } diff --git a/source/components/executer/exutils.c b/source/components/executer/exutils.c index f31f2925594a..c8f1b6ef12d7 100644 --- a/source/components/executer/exutils.c +++ b/source/components/executer/exutils.c @@ -391,7 +391,7 @@ AcpiExDigitsNeeded (      if (Value == 0)      { -        return_VALUE (1); +        return_UINT32 (1);      }      CurrentValue = Value; @@ -405,7 +405,7 @@ AcpiExDigitsNeeded (          NumDigits++;      } -    return_VALUE (NumDigits); +    return_UINT32 (NumDigits);  } diff --git a/source/components/hardware/hwacpi.c b/source/components/hardware/hwacpi.c index d63c36480299..d4d5b55a5237 100644 --- a/source/components/hardware/hwacpi.c +++ b/source/components/hardware/hwacpi.c @@ -75,6 +75,14 @@ AcpiHwSetMode (      ACPI_FUNCTION_TRACE (HwSetMode); + +    /* If the Hardware Reduced flag is set, machine is always in acpi mode */ + +    if (AcpiGbl_ReducedHardware) +    { +        return_ACPI_STATUS (AE_OK); +    } +      /*       * ACPI 2.0 clarified that if SMI_CMD in FADT is zero,       * system does not support mode transition. @@ -180,28 +188,35 @@ AcpiHwGetMode (      ACPI_FUNCTION_TRACE (HwGetMode); +    /* If the Hardware Reduced flag is set, machine is always in acpi mode */ + +    if (AcpiGbl_ReducedHardware) +    { +        return_UINT32 (ACPI_SYS_MODE_ACPI); +    } +      /*       * ACPI 2.0 clarified that if SMI_CMD in FADT is zero,       * system does not support mode transition.       */      if (!AcpiGbl_FADT.SmiCommand)      { -        return_VALUE (ACPI_SYS_MODE_ACPI); +        return_UINT32 (ACPI_SYS_MODE_ACPI);      }      Status = AcpiReadBitRegister (ACPI_BITREG_SCI_ENABLE, &Value);      if (ACPI_FAILURE (Status))      { -        return_VALUE (ACPI_SYS_MODE_LEGACY); +        return_UINT32 (ACPI_SYS_MODE_LEGACY);      }      if (Value)      { -        return_VALUE (ACPI_SYS_MODE_ACPI); +        return_UINT32 (ACPI_SYS_MODE_ACPI);      }      else      { -        return_VALUE (ACPI_SYS_MODE_LEGACY); +        return_UINT32 (ACPI_SYS_MODE_LEGACY);      }  } diff --git a/source/components/namespace/nsconvert.c b/source/components/namespace/nsconvert.c new file mode 100644 index 000000000000..e3ff375f2536 --- /dev/null +++ b/source/components/namespace/nsconvert.c @@ -0,0 +1,481 @@ +/****************************************************************************** + * + * Module Name: nsconvert - Object conversions for objects returned by + *                          predefined methods + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2013, Intel Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 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. + */ + +#define __NSCONVERT_C__ + +#include "acpi.h" +#include "accommon.h" +#include "acnamesp.h" +#include "acinterp.h" +#include "acpredef.h" +#include "amlresrc.h" + +#define _COMPONENT          ACPI_NAMESPACE +        ACPI_MODULE_NAME    ("nsconvert") + + +/******************************************************************************* + * + * FUNCTION:    AcpiNsConvertToInteger + * + * PARAMETERS:  OriginalObject      - Object to be converted + *              ReturnObject        - Where the new converted object is returned + * + * RETURN:      Status. AE_OK if conversion was successful. + * + * DESCRIPTION: Attempt to convert a String/Buffer object to an Integer. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiNsConvertToInteger ( +    ACPI_OPERAND_OBJECT     *OriginalObject, +    ACPI_OPERAND_OBJECT     **ReturnObject) +{ +    ACPI_OPERAND_OBJECT     *NewObject; +    ACPI_STATUS             Status; +    UINT64                  Value = 0; +    UINT32                  i; + + +    switch (OriginalObject->Common.Type) +    { +    case ACPI_TYPE_STRING: + +        /* String-to-Integer conversion */ + +        Status = AcpiUtStrtoul64 (OriginalObject->String.Pointer, +                    ACPI_ANY_BASE, &Value); +        if (ACPI_FAILURE (Status)) +        { +            return (Status); +        } +        break; + +    case ACPI_TYPE_BUFFER: + +        /* Buffer-to-Integer conversion. Max buffer size is 64 bits. */ + +        if (OriginalObject->Buffer.Length > 8) +        { +            return (AE_AML_OPERAND_TYPE); +        } + +        /* Extract each buffer byte to create the integer */ + +        for (i = 0; i < OriginalObject->Buffer.Length; i++) +        { +            Value |= ((UINT64) OriginalObject->Buffer.Pointer[i] << (i * 8)); +        } +        break; + +    default: +        return (AE_AML_OPERAND_TYPE); +    } + +    NewObject = AcpiUtCreateIntegerObject (Value); +    if (!NewObject) +    { +        return (AE_NO_MEMORY); +    } + +    *ReturnObject = NewObject; +    return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION:    AcpiNsConvertToString + * + * PARAMETERS:  OriginalObject      - Object to be converted + *              ReturnObject        - Where the new converted object is returned + * + * RETURN:      Status. AE_OK if conversion was successful. + * + * DESCRIPTION: Attempt to convert a Integer/Buffer object to a String. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiNsConvertToString ( +    ACPI_OPERAND_OBJECT     *OriginalObject, +    ACPI_OPERAND_OBJECT     **ReturnObject) +{ +    ACPI_OPERAND_OBJECT     *NewObject; +    ACPI_SIZE               Length; +    ACPI_STATUS             Status; + + +    switch (OriginalObject->Common.Type) +    { +    case ACPI_TYPE_INTEGER: +        /* +         * Integer-to-String conversion. Commonly, convert +         * an integer of value 0 to a NULL string. The last element of +         * _BIF and _BIX packages occasionally need this fix. +         */ +        if (OriginalObject->Integer.Value == 0) +        { +            /* Allocate a new NULL string object */ + +            NewObject = AcpiUtCreateStringObject (0); +            if (!NewObject) +            { +                return (AE_NO_MEMORY); +            } +        } +        else +        { +            Status = AcpiExConvertToString (OriginalObject, &NewObject, +                        ACPI_IMPLICIT_CONVERT_HEX); +            if (ACPI_FAILURE (Status)) +            { +                return (Status); +            } +        } +        break; + +    case ACPI_TYPE_BUFFER: +        /* +         * Buffer-to-String conversion. Use a ToString +         * conversion, no transform performed on the buffer data. The best +         * example of this is the _BIF method, where the string data from +         * the battery is often (incorrectly) returned as buffer object(s). +         */ +        Length = 0; +        while ((Length < OriginalObject->Buffer.Length) && +                (OriginalObject->Buffer.Pointer[Length])) +        { +            Length++; +        } + +        /* Allocate a new string object */ + +        NewObject = AcpiUtCreateStringObject (Length); +        if (!NewObject) +        { +            return (AE_NO_MEMORY); +        } + +        /* +         * Copy the raw buffer data with no transform. String is already NULL +         * terminated at Length+1. +         */ +        ACPI_MEMCPY (NewObject->String.Pointer, +            OriginalObject->Buffer.Pointer, Length); +        break; + +    default: +        return (AE_AML_OPERAND_TYPE); +    } + +    *ReturnObject = NewObject; +    return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION:    AcpiNsConvertToBuffer + * + * PARAMETERS:  OriginalObject      - Object to be converted + *              ReturnObject        - Where the new converted object is returned + * + * RETURN:      Status. AE_OK if conversion was successful. + * + * DESCRIPTION: Attempt to convert a Integer/String/Package object to a Buffer. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiNsConvertToBuffer ( +    ACPI_OPERAND_OBJECT     *OriginalObject, +    ACPI_OPERAND_OBJECT     **ReturnObject) +{ +    ACPI_OPERAND_OBJECT     *NewObject; +    ACPI_STATUS             Status; +    ACPI_OPERAND_OBJECT     **Elements; +    UINT32                  *DwordBuffer; +    UINT32                  Count; +    UINT32                  i; + + +    switch (OriginalObject->Common.Type) +    { +    case ACPI_TYPE_INTEGER: +        /* +         * Integer-to-Buffer conversion. +         * Convert the Integer to a packed-byte buffer. _MAT and other +         * objects need this sometimes, if a read has been performed on a +         * Field object that is less than or equal to the global integer +         * size (32 or 64 bits). +         */ +        Status = AcpiExConvertToBuffer (OriginalObject, &NewObject); +        if (ACPI_FAILURE (Status)) +        { +            return (Status); +        } +        break; + +    case ACPI_TYPE_STRING: + +        /* String-to-Buffer conversion. Simple data copy */ + +        NewObject = AcpiUtCreateBufferObject (OriginalObject->String.Length); +        if (!NewObject) +        { +            return (AE_NO_MEMORY); +        } + +        ACPI_MEMCPY (NewObject->Buffer.Pointer, +            OriginalObject->String.Pointer, OriginalObject->String.Length); +        break; + +    case ACPI_TYPE_PACKAGE: +        /* +         * This case is often seen for predefined names that must return a +         * Buffer object with multiple DWORD integers within. For example, +         * _FDE and _GTM. The Package can be converted to a Buffer. +         */ + +        /* All elements of the Package must be integers */ + +        Elements = OriginalObject->Package.Elements; +        Count = OriginalObject->Package.Count; + +        for (i = 0; i < Count; i++) +        { +            if ((!*Elements) || +                ((*Elements)->Common.Type != ACPI_TYPE_INTEGER)) +            { +                return (AE_AML_OPERAND_TYPE); +            } +            Elements++; +        } + +        /* Create the new buffer object to replace the Package */ + +        NewObject = AcpiUtCreateBufferObject (ACPI_MUL_4 (Count)); +        if (!NewObject) +        { +            return (AE_NO_MEMORY); +        } + +        /* Copy the package elements (integers) to the buffer as DWORDs */ + +        Elements = OriginalObject->Package.Elements; +        DwordBuffer = ACPI_CAST_PTR (UINT32, NewObject->Buffer.Pointer); + +        for (i = 0; i < Count; i++) +        { +            *DwordBuffer = (UINT32) (*Elements)->Integer.Value; +            DwordBuffer++; +            Elements++; +        } +        break; + +    default: +        return (AE_AML_OPERAND_TYPE); +    } + +    *ReturnObject = NewObject; +    return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION:    AcpiNsConvertToUnicode + * + * PARAMETERS:  OriginalObject      - ASCII String Object to be converted + *              ReturnObject        - Where the new converted object is returned + * + * RETURN:      Status. AE_OK if conversion was successful. + * + * DESCRIPTION: Attempt to convert a String object to a Unicode string Buffer. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiNsConvertToUnicode ( +    ACPI_OPERAND_OBJECT     *OriginalObject, +    ACPI_OPERAND_OBJECT     **ReturnObject) +{ +    ACPI_OPERAND_OBJECT     *NewObject; +    char                    *AsciiString; +    UINT16                  *UnicodeBuffer; +    UINT32                  UnicodeLength; +    UINT32                  i; + + +    if (!OriginalObject) +    { +        return (AE_OK); +    } + +    /* If a Buffer was returned, it must be at least two bytes long */ + +    if (OriginalObject->Common.Type == ACPI_TYPE_BUFFER) +    { +        if (OriginalObject->Buffer.Length < 2) +        { +            return (AE_AML_OPERAND_VALUE); +        } + +        *ReturnObject = NULL; +        return (AE_OK); +    } + +    /* +     * The original object is an ASCII string. Convert this string to +     * a unicode buffer. +     */ +    AsciiString = OriginalObject->String.Pointer; +    UnicodeLength = (OriginalObject->String.Length * 2) + 2; + +    /* Create a new buffer object for the Unicode data */ + +    NewObject = AcpiUtCreateBufferObject (UnicodeLength); +    if (!NewObject) +    { +        return (AE_NO_MEMORY); +    } + +    UnicodeBuffer = ACPI_CAST_PTR (UINT16, NewObject->Buffer.Pointer); + +    /* Convert ASCII to Unicode */ + +    for (i = 0; i < OriginalObject->String.Length; i++) +    { +        UnicodeBuffer[i] = (UINT16) AsciiString[i]; +    } + +    *ReturnObject = NewObject; +    return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION:    AcpiNsConvertToResource + * + * PARAMETERS:  OriginalObject      - Object to be converted + *              ReturnObject        - Where the new converted object is returned + * + * RETURN:      Status. AE_OK if conversion was successful + * + * DESCRIPTION: Attempt to convert a Integer object to a ResourceTemplate + *              Buffer. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiNsConvertToResource ( +    ACPI_OPERAND_OBJECT     *OriginalObject, +    ACPI_OPERAND_OBJECT     **ReturnObject) +{ +    ACPI_OPERAND_OBJECT     *NewObject; +    UINT8                   *Buffer; + + +    /* +     * We can fix the following cases for an expected resource template: +     * 1. No return value (interpreter slack mode is disabled) +     * 2. A "Return (Zero)" statement +     * 3. A "Return empty buffer" statement +     * +     * We will return a buffer containing a single EndTag +     * resource descriptor. +     */ +    if (OriginalObject) +    { +        switch (OriginalObject->Common.Type) +        { +        case ACPI_TYPE_INTEGER: + +            /* We can only repair an Integer==0 */ + +            if (OriginalObject->Integer.Value) +            { +                return (AE_AML_OPERAND_TYPE); +            } +            break; + +        case ACPI_TYPE_BUFFER: + +            if (OriginalObject->Buffer.Length) +            { +                /* Additional checks can be added in the future */ + +                *ReturnObject = NULL; +                return (AE_OK); +            } +            break; + +        case ACPI_TYPE_STRING: +        default: + +            return (AE_AML_OPERAND_TYPE); +        } +    } + +    /* Create the new buffer object for the resource descriptor */ + +    NewObject = AcpiUtCreateBufferObject (2); +    if (!NewObject) +    { +        return (AE_NO_MEMORY); +    } + +    Buffer = ACPI_CAST_PTR (UINT8, NewObject->Buffer.Pointer); + +    /* Initialize the Buffer with a single EndTag descriptor */ + +    Buffer[0] = (ACPI_RESOURCE_NAME_END_TAG | ASL_RDESC_END_TAG_SIZE); +    Buffer[1] = 0x00; + +    *ReturnObject = NewObject; +    return (AE_OK); +} diff --git a/source/components/namespace/nspredef.c b/source/components/namespace/nspredef.c index b588bb638fd8..f12bc155ac06 100644 --- a/source/components/namespace/nspredef.c +++ b/source/components/namespace/nspredef.c @@ -87,6 +87,11 @@ AcpiNsGetExpectedTypes (      char                        *Buffer,      UINT32                      ExpectedBtypes); +static UINT32 +AcpiNsGetBitmappedType ( +    ACPI_OPERAND_OBJECT         *ReturnObject); + +  /*   * Names for the types that can be returned by the predefined objects.   * Used for warning messages. Must be in the same order as the ACPI_RTYPEs @@ -124,7 +129,6 @@ AcpiNsCheckPredefinedNames (      ACPI_STATUS                 ReturnStatus,      ACPI_OPERAND_OBJECT         **ReturnObjectPtr)  { -    ACPI_OPERAND_OBJECT         *ReturnObject = *ReturnObjectPtr;      ACPI_STATUS                 Status = AE_OK;      const ACPI_PREDEFINED_INFO  *Predefined;      char                        *Pathname; @@ -167,26 +171,6 @@ AcpiNsCheckPredefinedNames (      }      /* -     * If there is no return value, check if we require a return value for -     * this predefined name. Either one return value is expected, or none, -     * for both methods and other objects. -     * -     * Exit now if there is no return object. Warning if one was expected. -     */ -    if (!ReturnObject) -    { -        if ((Predefined->Info.ExpectedBtypes) && -            (!(Predefined->Info.ExpectedBtypes & ACPI_RTYPE_NONE))) -        { -            ACPI_WARN_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS, -                "Missing expected return value")); - -            Status = AE_AML_NO_RETURN_VALUE; -        } -        goto Cleanup; -    } - -    /*       * Return value validation and possible repair.       *       * 1) Don't perform return value validation/repair if this feature @@ -447,30 +431,13 @@ AcpiNsCheckObjectType (  {      ACPI_OPERAND_OBJECT         *ReturnObject = *ReturnObjectPtr;      ACPI_STATUS                 Status = AE_OK; -    UINT32                      ReturnBtype;      char                        TypeBuffer[48]; /* Room for 5 types */ -    /* -     * If we get a NULL ReturnObject here, it is a NULL package element. -     * Since all extraneous NULL package elements were removed earlier by a -     * call to AcpiNsRemoveNullElements, this is an unexpected NULL element. -     * We will attempt to repair it. -     */ -    if (!ReturnObject) -    { -        Status = AcpiNsRepairNullElement (Data, ExpectedBtypes, -                    PackageIndex, ReturnObjectPtr); -        if (ACPI_SUCCESS (Status)) -        { -            return (AE_OK); /* Repair was successful */ -        } -        goto TypeErrorExit; -    } -      /* A Namespace node should not get here, but make sure */ -    if (ACPI_GET_DESCRIPTOR_TYPE (ReturnObject) == ACPI_DESC_TYPE_NAMED) +    if (ReturnObject && +        ACPI_GET_DESCRIPTOR_TYPE (ReturnObject) == ACPI_DESC_TYPE_NAMED)      {          ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags,              "Invalid return type - Found a Namespace node [%4.4s] type %s", @@ -487,56 +454,26 @@ AcpiNsCheckObjectType (       * from all of the predefined names (including elements of returned       * packages)       */ -    switch (ReturnObject->Common.Type) +    Data->ReturnBtype = AcpiNsGetBitmappedType (ReturnObject); +    if (Data->ReturnBtype == ACPI_RTYPE_ANY)      { -    case ACPI_TYPE_INTEGER: -        ReturnBtype = ACPI_RTYPE_INTEGER; -        break; - -    case ACPI_TYPE_BUFFER: -        ReturnBtype = ACPI_RTYPE_BUFFER; -        break; - -    case ACPI_TYPE_STRING: -        ReturnBtype = ACPI_RTYPE_STRING; -        break; - -    case ACPI_TYPE_PACKAGE: -        ReturnBtype = ACPI_RTYPE_PACKAGE; -        break; - -    case ACPI_TYPE_LOCAL_REFERENCE: -        ReturnBtype = ACPI_RTYPE_REFERENCE; -        break; - -    default:          /* Not one of the supported objects, must be incorrect */ -          goto TypeErrorExit;      } -    /* Is the object one of the expected types? */ +    /* For reference objects, check that the reference type is correct */ -    if (ReturnBtype & ExpectedBtypes) +    if ((Data->ReturnBtype & ExpectedBtypes) == ACPI_RTYPE_REFERENCE)      { -        /* For reference objects, check that the reference type is correct */ - -        if (ReturnObject->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) -        { -            Status = AcpiNsCheckReference (Data, ReturnObject); -        } - +        Status = AcpiNsCheckReference (Data, ReturnObject);          return (Status);      } -    /* Type mismatch -- attempt repair of the returned object */ +    /* Attempt simple repair of the returned object if necessary */ -    Status = AcpiNsRepairObject (Data, ExpectedBtypes, +    Status = AcpiNsSimpleRepair (Data, ExpectedBtypes,                  PackageIndex, ReturnObjectPtr); -    if (ACPI_SUCCESS (Status)) -    { -        return (AE_OK); /* Repair was successful */ -    } +    return (Status);  TypeErrorExit: @@ -606,6 +543,67 @@ AcpiNsCheckReference (  /*******************************************************************************   * + * FUNCTION:    AcpiNsGetBitmappedType + * + * PARAMETERS:  ReturnObject    - Object returned from method/obj evaluation + * + * RETURN:      Object return type. ACPI_RTYPE_ANY indicates that the object + *              type is not supported. ACPI_RTYPE_NONE indicates that no + *              object was returned (ReturnObject is NULL). + * + * DESCRIPTION: Convert object type into a bitmapped object return type. + * + ******************************************************************************/ + +static UINT32 +AcpiNsGetBitmappedType ( +    ACPI_OPERAND_OBJECT         *ReturnObject) +{ +    UINT32                      ReturnBtype; + + +    if (!ReturnObject) +    { +        return (ACPI_RTYPE_NONE); +    } + +    /* Map ACPI_OBJECT_TYPE to internal bitmapped type */ + +    switch (ReturnObject->Common.Type) +    { +    case ACPI_TYPE_INTEGER: +        ReturnBtype = ACPI_RTYPE_INTEGER; +        break; + +    case ACPI_TYPE_BUFFER: +        ReturnBtype = ACPI_RTYPE_BUFFER; +        break; + +    case ACPI_TYPE_STRING: +        ReturnBtype = ACPI_RTYPE_STRING; +        break; + +    case ACPI_TYPE_PACKAGE: +        ReturnBtype = ACPI_RTYPE_PACKAGE; +        break; + +    case ACPI_TYPE_LOCAL_REFERENCE: +        ReturnBtype = ACPI_RTYPE_REFERENCE; +        break; + +    default: +        /* Not one of the supported objects, must be incorrect */ + +        ReturnBtype = ACPI_RTYPE_ANY; +        break; +    } + +    return (ReturnBtype); +} + + +/******************************************************************************* + *   * FUNCTION:    AcpiNsGetExpectedTypes   *   * PARAMETERS:  Buffer          - Pointer to where the string is returned diff --git a/source/components/namespace/nsprepkg.c b/source/components/namespace/nsprepkg.c index 9b10a4076f57..d18205c83fd7 100644 --- a/source/components/namespace/nsprepkg.c +++ b/source/components/namespace/nsprepkg.c @@ -122,10 +122,17 @@ AcpiNsCheckPackage (      Elements = ReturnObject->Package.Elements;      Count = ReturnObject->Package.Count; -    /* The package must have at least one element, else invalid */ - +    /* +     * Most packages must have at least one element. The only exception +     * is the variable-length package (ACPI_PTYPE1_VAR). +     */      if (!Count)      { +        if (Package->RetInfo.Type == ACPI_PTYPE1_VAR) +        { +            return (AE_OK); +        } +          ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags,              "Return Package has no elements (empty)")); diff --git a/source/components/namespace/nsrepair.c b/source/components/namespace/nsrepair.c index 7b170d0b8264..e06502811d33 100644 --- a/source/components/namespace/nsrepair.c +++ b/source/components/namespace/nsrepair.c @@ -48,6 +48,7 @@  #include "acnamesp.h"  #include "acinterp.h"  #include "acpredef.h" +#include "amlresrc.h"  #define _COMPONENT          ACPI_NAMESPACE          ACPI_MODULE_NAME    ("nsrepair") @@ -74,6 +75,11 @@   * Buffer  -> String   * Buffer  -> Package of Integers   * Package -> Package of one Package + * + * Additional conversions that are available: + *  Convert a null return or zero return value to an EndTag descriptor + *  Convert an ASCII string to a Unicode buffer + *   * An incorrect standalone object is wrapped with required outer package   *   * Additional possible repairs: @@ -84,25 +90,46 @@  /* Local prototypes */ -static ACPI_STATUS -AcpiNsConvertToInteger ( -    ACPI_OPERAND_OBJECT     *OriginalObject, -    ACPI_OPERAND_OBJECT     **ReturnObject); +static const ACPI_SIMPLE_REPAIR_INFO * +AcpiNsMatchSimpleRepair ( +    ACPI_NAMESPACE_NODE     *Node, +    UINT32                  ReturnBtype, +    UINT32                  PackageIndex); -static ACPI_STATUS -AcpiNsConvertToString ( -    ACPI_OPERAND_OBJECT     *OriginalObject, -    ACPI_OPERAND_OBJECT     **ReturnObject); -static ACPI_STATUS -AcpiNsConvertToBuffer ( -    ACPI_OPERAND_OBJECT     *OriginalObject, -    ACPI_OPERAND_OBJECT     **ReturnObject); +/* + * Special but simple repairs for some names. + * + * 2nd argument: Unexpected types that can be repaired + */ +static const ACPI_SIMPLE_REPAIR_INFO    AcpiObjectRepairInfo[] = +{ +    /* Resource descriptor conversions */ + +    { "_CRS", ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER | ACPI_RTYPE_NONE, +                ACPI_NOT_PACKAGE_ELEMENT, +                AcpiNsConvertToResource }, +    { "_DMA", ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER | ACPI_RTYPE_NONE, +                ACPI_NOT_PACKAGE_ELEMENT, +                AcpiNsConvertToResource }, +    { "_PRS", ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER | ACPI_RTYPE_NONE, +                ACPI_NOT_PACKAGE_ELEMENT, +                AcpiNsConvertToResource }, + +    /* Unicode conversions */ + +    { "_MLS", ACPI_RTYPE_STRING, 1, +                AcpiNsConvertToUnicode }, +    { "_STR", ACPI_RTYPE_STRING | ACPI_RTYPE_BUFFER, +                ACPI_NOT_PACKAGE_ELEMENT, +                AcpiNsConvertToUnicode }, +    { {0,0,0,0}, 0, 0, NULL } /* Table terminator */ +};  /*******************************************************************************   * - * FUNCTION:    AcpiNsRepairObject + * FUNCTION:    AcpiNsSimpleRepair   *   * PARAMETERS:  Data                - Pointer to validation data structure   *              ExpectedBtypes      - Object types expected @@ -120,19 +147,58 @@ AcpiNsConvertToBuffer (   ******************************************************************************/  ACPI_STATUS -AcpiNsRepairObject ( +AcpiNsSimpleRepair (      ACPI_PREDEFINED_DATA    *Data,      UINT32                  ExpectedBtypes,      UINT32                  PackageIndex,      ACPI_OPERAND_OBJECT     **ReturnObjectPtr)  {      ACPI_OPERAND_OBJECT     *ReturnObject = *ReturnObjectPtr; -    ACPI_OPERAND_OBJECT     *NewObject; +    ACPI_OPERAND_OBJECT     *NewObject = NULL;      ACPI_STATUS             Status; +    const ACPI_SIMPLE_REPAIR_INFO   *Predefined; + + +    ACPI_FUNCTION_NAME (NsSimpleRepair); -    ACPI_FUNCTION_NAME (NsRepairObject); +    /* +     * Special repairs for certain names that are in the repair table. +     * Check if this name is in the list of repairable names. +     */ +    Predefined = AcpiNsMatchSimpleRepair (Data->Node, +        Data->ReturnBtype, PackageIndex); +    if (Predefined) +    { +        if (!ReturnObject) +        { +            ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, +                ACPI_WARN_ALWAYS, "Missing expected return value")); +        } + +        Status = Predefined->ObjectConverter (ReturnObject, &NewObject); +        if (ACPI_FAILURE (Status)) +        { +            /* A fatal error occurred during a conversion */ + +            ACPI_EXCEPTION ((AE_INFO, Status, +                "During return object analysis")); +            return (Status); +        } +        if (NewObject) +        { +            goto ObjectRepaired; +        } +    } +    /* +     * Do not perform simple object repair unless the return type is not +     * expected. +     */ +    if (Data->ReturnBtype & ExpectedBtypes) +    { +        return (AE_OK); +    }      /*       * At this point, we know that the type of the returned object was not @@ -140,6 +206,25 @@ AcpiNsRepairObject (       * repair the object by converting it to one of the expected object       * types for this predefined name.       */ + +    /* +     * If there is no return value, check if we require a return value for +     * this predefined name. Either one return value is expected, or none, +     * for both methods and other objects. +     * +     * Exit now if there is no return object. Warning if one was expected. +     */ +    if (!ReturnObject) +    { +        if (ExpectedBtypes && (!(ExpectedBtypes & ACPI_RTYPE_NONE))) +        { +            ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, +                ACPI_WARN_ALWAYS, "Missing expected return value")); + +            return (AE_AML_NO_RETURN_VALUE); +        } +    } +      if (ExpectedBtypes & ACPI_RTYPE_INTEGER)      {          Status = AcpiNsConvertToInteger (ReturnObject, &NewObject); @@ -240,273 +325,52 @@ ObjectRepaired:  } -/******************************************************************************* - * - * FUNCTION:    AcpiNsConvertToInteger - * - * PARAMETERS:  OriginalObject      - Object to be converted - *              ReturnObject        - Where the new converted object is returned - * - * RETURN:      Status. AE_OK if conversion was successful. - * - * DESCRIPTION: Attempt to convert a String/Buffer object to an Integer. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiNsConvertToInteger ( -    ACPI_OPERAND_OBJECT     *OriginalObject, -    ACPI_OPERAND_OBJECT     **ReturnObject) -{ -    ACPI_OPERAND_OBJECT     *NewObject; -    ACPI_STATUS             Status; -    UINT64                  Value = 0; -    UINT32                  i; - - -    switch (OriginalObject->Common.Type) -    { -    case ACPI_TYPE_STRING: - -        /* String-to-Integer conversion */ - -        Status = AcpiUtStrtoul64 (OriginalObject->String.Pointer, -                    ACPI_ANY_BASE, &Value); -        if (ACPI_FAILURE (Status)) -        { -            return (Status); -        } -        break; - -    case ACPI_TYPE_BUFFER: - -        /* Buffer-to-Integer conversion. Max buffer size is 64 bits. */ - -        if (OriginalObject->Buffer.Length > 8) -        { -            return (AE_AML_OPERAND_TYPE); -        } - -        /* Extract each buffer byte to create the integer */ - -        for (i = 0; i < OriginalObject->Buffer.Length; i++) -        { -            Value |= ((UINT64) OriginalObject->Buffer.Pointer[i] << (i * 8)); -        } -        break; - -    default: -        return (AE_AML_OPERAND_TYPE); -    } - -    NewObject = AcpiUtCreateIntegerObject (Value); -    if (!NewObject) -    { -        return (AE_NO_MEMORY); -    } - -    *ReturnObject = NewObject; -    return (AE_OK); -} - - -/******************************************************************************* +/******************************************************************************   * - * FUNCTION:    AcpiNsConvertToString + * FUNCTION:    AcpiNsMatchSimpleRepair   * - * PARAMETERS:  OriginalObject      - Object to be converted - *              ReturnObject        - Where the new converted object is returned + * PARAMETERS:  Node                - Namespace node for the method/object + *              ReturnBtype         - Object type that was returned + *              PackageIndex        - Index of object within parent package (if + *                                    applicable - ACPI_NOT_PACKAGE_ELEMENT + *                                    otherwise)   * - * RETURN:      Status. AE_OK if conversion was successful. + * RETURN:      Pointer to entry in repair table. NULL indicates not found.   * - * DESCRIPTION: Attempt to convert a Integer/Buffer object to a String. + * DESCRIPTION: Check an object name against the repairable object list.   * - ******************************************************************************/ + *****************************************************************************/ -static ACPI_STATUS -AcpiNsConvertToString ( -    ACPI_OPERAND_OBJECT     *OriginalObject, -    ACPI_OPERAND_OBJECT     **ReturnObject) +static const ACPI_SIMPLE_REPAIR_INFO * +AcpiNsMatchSimpleRepair ( +    ACPI_NAMESPACE_NODE     *Node, +    UINT32                  ReturnBtype, +    UINT32                  PackageIndex)  { -    ACPI_OPERAND_OBJECT     *NewObject; -    ACPI_SIZE               Length; -    ACPI_STATUS             Status; - - -    switch (OriginalObject->Common.Type) -    { -    case ACPI_TYPE_INTEGER: -        /* -         * Integer-to-String conversion. Commonly, convert -         * an integer of value 0 to a NULL string. The last element of -         * _BIF and _BIX packages occasionally need this fix. -         */ -        if (OriginalObject->Integer.Value == 0) -        { -            /* Allocate a new NULL string object */ - -            NewObject = AcpiUtCreateStringObject (0); -            if (!NewObject) -            { -                return (AE_NO_MEMORY); -            } -        } -        else -        { -            Status = AcpiExConvertToString (OriginalObject, &NewObject, -                        ACPI_IMPLICIT_CONVERT_HEX); -            if (ACPI_FAILURE (Status)) -            { -                return (Status); -            } -        } -        break; - -    case ACPI_TYPE_BUFFER: -        /* -         * Buffer-to-String conversion. Use a ToString -         * conversion, no transform performed on the buffer data. The best -         * example of this is the _BIF method, where the string data from -         * the battery is often (incorrectly) returned as buffer object(s). -         */ -        Length = 0; -        while ((Length < OriginalObject->Buffer.Length) && -                (OriginalObject->Buffer.Pointer[Length])) -        { -            Length++; -        } - -        /* Allocate a new string object */ - -        NewObject = AcpiUtCreateStringObject (Length); -        if (!NewObject) -        { -            return (AE_NO_MEMORY); -        } - -        /* -         * Copy the raw buffer data with no transform. String is already NULL -         * terminated at Length+1. -         */ -        ACPI_MEMCPY (NewObject->String.Pointer, -            OriginalObject->Buffer.Pointer, Length); -        break; - -    default: -        return (AE_AML_OPERAND_TYPE); -    } - -    *ReturnObject = NewObject; -    return (AE_OK); -} - +    const ACPI_SIMPLE_REPAIR_INFO   *ThisName; -/******************************************************************************* - * - * FUNCTION:    AcpiNsConvertToBuffer - * - * PARAMETERS:  OriginalObject      - Object to be converted - *              ReturnObject        - Where the new converted object is returned - * - * RETURN:      Status. AE_OK if conversion was successful. - * - * DESCRIPTION: Attempt to convert a Integer/String/Package object to a Buffer. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiNsConvertToBuffer ( -    ACPI_OPERAND_OBJECT     *OriginalObject, -    ACPI_OPERAND_OBJECT     **ReturnObject) -{ -    ACPI_OPERAND_OBJECT     *NewObject; -    ACPI_STATUS             Status; -    ACPI_OPERAND_OBJECT     **Elements; -    UINT32                  *DwordBuffer; -    UINT32                  Count; -    UINT32                  i; +    /* Search info table for a repairable predefined method/object name */ -    switch (OriginalObject->Common.Type) +    ThisName = AcpiObjectRepairInfo; +    while (ThisName->ObjectConverter)      { -    case ACPI_TYPE_INTEGER: -        /* -         * Integer-to-Buffer conversion. -         * Convert the Integer to a packed-byte buffer. _MAT and other -         * objects need this sometimes, if a read has been performed on a -         * Field object that is less than or equal to the global integer -         * size (32 or 64 bits). -         */ -        Status = AcpiExConvertToBuffer (OriginalObject, &NewObject); -        if (ACPI_FAILURE (Status)) -        { -            return (Status); -        } -        break; - -    case ACPI_TYPE_STRING: - -        /* String-to-Buffer conversion. Simple data copy */ - -        NewObject = AcpiUtCreateBufferObject (OriginalObject->String.Length); -        if (!NewObject) +        if (ACPI_COMPARE_NAME (Node->Name.Ascii, ThisName->Name))          { -            return (AE_NO_MEMORY); -        } - -        ACPI_MEMCPY (NewObject->Buffer.Pointer, -            OriginalObject->String.Pointer, OriginalObject->String.Length); -        break; - -    case ACPI_TYPE_PACKAGE: -        /* -         * This case is often seen for predefined names that must return a -         * Buffer object with multiple DWORD integers within. For example, -         * _FDE and _GTM. The Package can be converted to a Buffer. -         */ - -        /* All elements of the Package must be integers */ - -        Elements = OriginalObject->Package.Elements; -        Count = OriginalObject->Package.Count; +            /* Check if we can actually repair this name/type combination */ -        for (i = 0; i < Count; i++) -        { -            if ((!*Elements) || -                ((*Elements)->Common.Type != ACPI_TYPE_INTEGER)) +            if ((ReturnBtype & ThisName->UnexpectedBtypes) && +                (PackageIndex == ThisName->PackageIndex))              { -                return (AE_AML_OPERAND_TYPE); +                return (ThisName);              } -            Elements++; -        } - -        /* Create the new buffer object to replace the Package */ -        NewObject = AcpiUtCreateBufferObject (ACPI_MUL_4 (Count)); -        if (!NewObject) -        { -            return (AE_NO_MEMORY); -        } - -        /* Copy the package elements (integers) to the buffer as DWORDs */ - -        Elements = OriginalObject->Package.Elements; -        DwordBuffer = ACPI_CAST_PTR (UINT32, NewObject->Buffer.Pointer); - -        for (i = 0; i < Count; i++) -        { -            *DwordBuffer = (UINT32) (*Elements)->Integer.Value; -            DwordBuffer++; -            Elements++; +            return (NULL);          } -        break; - -    default: -        return (AE_AML_OPERAND_TYPE); +        ThisName++;      } -    *ReturnObject = NewObject; -    return (AE_OK); +    return (NULL); /* Name was not found in the repair table */  } diff --git a/source/components/namespace/nsrepair2.c b/source/components/namespace/nsrepair2.c index 5650e338746e..b81c0dd0d52e 100644 --- a/source/components/namespace/nsrepair2.c +++ b/source/components/namespace/nsrepair2.c @@ -72,7 +72,7 @@ typedef struct acpi_repair_info  /* Local prototypes */  static const ACPI_REPAIR_INFO * -AcpiNsMatchRepairableName ( +AcpiNsMatchComplexRepair (      ACPI_NAMESPACE_NODE     *Node);  static ACPI_STATUS @@ -197,7 +197,7 @@ AcpiNsComplexRepairs (      /* Check if this name is in the list of repairable names */ -    Predefined = AcpiNsMatchRepairableName (Node); +    Predefined = AcpiNsMatchComplexRepair (Node);      if (!Predefined)      {          return (ValidateStatus); @@ -210,7 +210,7 @@ AcpiNsComplexRepairs (  /******************************************************************************   * - * FUNCTION:    AcpiNsMatchRepairableName + * FUNCTION:    AcpiNsMatchComplexRepair   *   * PARAMETERS:  Node                - Namespace node for the method/object   * @@ -221,7 +221,7 @@ AcpiNsComplexRepairs (   *****************************************************************************/  static const ACPI_REPAIR_INFO * -AcpiNsMatchRepairableName ( +AcpiNsMatchComplexRepair (      ACPI_NAMESPACE_NODE     *Node)  {      const ACPI_REPAIR_INFO  *ThisName; diff --git a/source/components/namespace/nsutils.c b/source/components/namespace/nsutils.c index 7002200e3188..16a6bdb96444 100644 --- a/source/components/namespace/nsutils.c +++ b/source/components/namespace/nsutils.c @@ -128,10 +128,10 @@ AcpiNsGetType (      if (!Node)      {          ACPI_WARNING ((AE_INFO, "Null Node parameter")); -        return_VALUE (ACPI_TYPE_ANY); +        return_UINT8 (ACPI_TYPE_ANY);      } -    return_VALUE (Node->Type); +    return_UINT8 (Node->Type);  } @@ -160,10 +160,10 @@ AcpiNsLocal (          /* Type code out of range  */          ACPI_WARNING ((AE_INFO, "Invalid Object Type 0x%X", Type)); -        return_VALUE (ACPI_NS_NORMAL); +        return_UINT32 (ACPI_NS_NORMAL);      } -    return_VALUE (AcpiGbl_NsProperties[Type] & ACPI_NS_LOCAL); +    return_UINT32 (AcpiGbl_NsProperties[Type] & ACPI_NS_LOCAL);  } diff --git a/source/components/parser/psargs.c b/source/components/parser/psargs.c index a548c2944faf..2bf7be799ca5 100644 --- a/source/components/parser/psargs.c +++ b/source/components/parser/psargs.c @@ -118,7 +118,7 @@ AcpiPsGetNextPackageLength (      /* Byte 0 is a special case, either bits [0:3] or [0:5] are used */      PackageLength |= (Aml[0] & ByteZeroMask); -    return_VALUE (PackageLength); +    return_UINT32 (PackageLength);  } diff --git a/source/components/resources/rscalc.c b/source/components/resources/rscalc.c index 6136fc671b00..5c373ec9cde1 100644 --- a/source/components/resources/rscalc.c +++ b/source/components/resources/rscalc.c @@ -230,6 +230,13 @@ AcpiRsGetAmlLength (              return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);          } +        /* Sanity check the length. It must not be zero, or we loop forever */ + +        if (!Resource->Length) +        { +            return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH); +        } +          /* Get the base size of the (external stream) resource descriptor */          TotalSize = AcpiGbl_AmlResourceSizes [Resource->Type]; diff --git a/source/components/resources/rsdump.c b/source/components/resources/rsdump.c index 0d2636e02af7..063be020659e 100644 --- a/source/components/resources/rsdump.c +++ b/source/components/resources/rsdump.c @@ -438,6 +438,15 @@ AcpiRsDumpResourceList (              return;          } +        /* Sanity check the length. It must not be zero, or we loop forever */ + +        if (!ResourceList->Length) +        { +            AcpiOsPrintf ( +                "Invalid zero length descriptor in resource list\n"); +            return; +        } +          /* Dump the resource descriptor */          if (Type == ACPI_RESOURCE_TYPE_SERIAL_BUS) diff --git a/source/components/resources/rslist.c b/source/components/resources/rslist.c index a9fd8759727e..80d6f78d2c71 100644 --- a/source/components/resources/rslist.c +++ b/source/components/resources/rslist.c @@ -199,6 +199,15 @@ AcpiRsConvertResourcesToAml (              return_ACPI_STATUS (AE_BAD_DATA);          } +        /* Sanity check the length. It must not be zero, or we loop forever */ + +        if (!Resource->Length) +        { +            ACPI_ERROR ((AE_INFO, +                "Invalid zero length descriptor in resource list\n")); +            return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH); +        } +          /* Perform the conversion */          if (Resource->Type == ACPI_RESOURCE_TYPE_SERIAL_BUS) diff --git a/source/components/resources/rsxface.c b/source/components/resources/rsxface.c index b107ddde5dd7..36edc81cc594 100644 --- a/source/components/resources/rsxface.c +++ b/source/components/resources/rsxface.c @@ -630,7 +630,7 @@ AcpiWalkResourceBuffer (      while (Resource < ResourceEnd)      { -        /* Sanity check the resource */ +        /* Sanity check the resource type */          if (Resource->Type > ACPI_RESOURCE_TYPE_MAX)          { @@ -638,6 +638,13 @@ AcpiWalkResourceBuffer (              break;          } +        /* Sanity check the length. It must not be zero, or we loop forever */ + +        if (!Resource->Length) +        { +            return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH); +        } +          /* Invoke the user function, abort on any error returned */          Status = UserFunction (Resource, Context); diff --git a/source/components/utilities/utaddress.c b/source/components/utilities/utaddress.c index 5606cbe1316e..7eae5a5025e2 100644 --- a/source/components/utilities/utaddress.c +++ b/source/components/utilities/utaddress.c @@ -237,7 +237,7 @@ AcpiUtCheckAddressRange (      if ((SpaceId != ACPI_ADR_SPACE_SYSTEM_MEMORY) &&          (SpaceId != ACPI_ADR_SPACE_SYSTEM_IO))      { -        return_VALUE (0); +        return_UINT32 (0);      }      RangeInfo = AcpiGbl_AddressRangeList[SpaceId]; @@ -278,7 +278,7 @@ AcpiUtCheckAddressRange (          RangeInfo = RangeInfo->Next;      } -    return_VALUE (OverlapCount); +    return_UINT32 (OverlapCount);  } diff --git a/source/components/utilities/utexcep.c b/source/components/utilities/utexcep.c index a3eac017f48e..1aead78b6c96 100644 --- a/source/components/utilities/utexcep.c +++ b/source/components/utilities/utexcep.c @@ -71,7 +71,7 @@ const char *  AcpiFormatException (      ACPI_STATUS             Status)  { -    const char              *Exception = NULL; +    const ACPI_EXCEPTION_INFO   *Exception;      ACPI_FUNCTION_ENTRY (); @@ -85,10 +85,10 @@ AcpiFormatException (          ACPI_ERROR ((AE_INFO,              "Unknown exception code: 0x%8.8X", Status)); -        Exception = "UNKNOWN_STATUS_CODE"; +        return ("UNKNOWN_STATUS_CODE");      } -    return (ACPI_CAST_PTR (const char, Exception)); +    return (Exception->Name);  }  ACPI_EXPORT_SYMBOL (AcpiFormatException) @@ -108,12 +108,12 @@ ACPI_EXPORT_SYMBOL (AcpiFormatException)   *   ******************************************************************************/ -const char * +const ACPI_EXCEPTION_INFO *  AcpiUtValidateException (      ACPI_STATUS             Status)  { -    UINT32                  SubStatus; -    const char              *Exception = NULL; +    UINT32                      SubStatus; +    const ACPI_EXCEPTION_INFO   *Exception = NULL;      ACPI_FUNCTION_ENTRY (); @@ -130,7 +130,7 @@ AcpiUtValidateException (          if (SubStatus <= AE_CODE_ENV_MAX)          { -            Exception = AcpiGbl_ExceptionNames_Env [SubStatus]; +            Exception = &AcpiGbl_ExceptionNames_Env [SubStatus];          }          break; @@ -138,7 +138,7 @@ AcpiUtValidateException (          if (SubStatus <= AE_CODE_PGM_MAX)          { -            Exception = AcpiGbl_ExceptionNames_Pgm [SubStatus]; +            Exception = &AcpiGbl_ExceptionNames_Pgm [SubStatus];          }          break; @@ -146,7 +146,7 @@ AcpiUtValidateException (          if (SubStatus <= AE_CODE_TBL_MAX)          { -            Exception = AcpiGbl_ExceptionNames_Tbl [SubStatus]; +            Exception = &AcpiGbl_ExceptionNames_Tbl [SubStatus];          }          break; @@ -154,7 +154,7 @@ AcpiUtValidateException (          if (SubStatus <= AE_CODE_AML_MAX)          { -            Exception = AcpiGbl_ExceptionNames_Aml [SubStatus]; +            Exception = &AcpiGbl_ExceptionNames_Aml [SubStatus];          }          break; @@ -162,7 +162,7 @@ AcpiUtValidateException (          if (SubStatus <= AE_CODE_CTRL_MAX)          { -            Exception = AcpiGbl_ExceptionNames_Ctrl [SubStatus]; +            Exception = &AcpiGbl_ExceptionNames_Ctrl [SubStatus];          }          break; @@ -170,5 +170,10 @@ AcpiUtValidateException (          break;      } -    return (ACPI_CAST_PTR (const char, Exception)); +    if (!Exception || !Exception->Name) +    { +        return (NULL); +    } + +    return (Exception);  } diff --git a/source/components/utilities/utglobal.c b/source/components/utilities/utglobal.c index 2c2dd26f616c..83b05266ad5f 100644 --- a/source/components/utilities/utglobal.c +++ b/source/components/utilities/utglobal.c @@ -343,6 +343,8 @@ AcpiUtInitGlobals (  #ifdef ACPI_DISASSEMBLER      AcpiGbl_ExternalList                = NULL; +    AcpiGbl_NumExternalMethods          = 0; +    AcpiGbl_ResolvedExternalMethods     = 0;  #endif  #ifdef ACPI_DEBUG_OUTPUT diff --git a/source/include/acdisasm.h b/source/include/acdisasm.h index 43ab2c076715..5abf24ecde15 100644 --- a/source/include/acdisasm.h +++ b/source/include/acdisasm.h @@ -314,6 +314,8 @@ extern ACPI_DMTABLE_INFO        AcpiDmTableInfoMpst1[];  extern ACPI_DMTABLE_INFO        AcpiDmTableInfoMpst2[];  extern ACPI_DMTABLE_INFO        AcpiDmTableInfoMsct[];  extern ACPI_DMTABLE_INFO        AcpiDmTableInfoMsct0[]; +extern ACPI_DMTABLE_INFO        AcpiDmTableInfoMtmr[]; +extern ACPI_DMTABLE_INFO        AcpiDmTableInfoMtmr0[];  extern ACPI_DMTABLE_INFO        AcpiDmTableInfoPmtt[];  extern ACPI_DMTABLE_INFO        AcpiDmTableInfoPmtt0[];  extern ACPI_DMTABLE_INFO        AcpiDmTableInfoPmtt1[]; @@ -343,6 +345,8 @@ extern ACPI_DMTABLE_INFO        AcpiDmTableInfoSrat2[];  extern ACPI_DMTABLE_INFO        AcpiDmTableInfoTcpa[];  extern ACPI_DMTABLE_INFO        AcpiDmTableInfoTpm2[];  extern ACPI_DMTABLE_INFO        AcpiDmTableInfoUefi[]; +extern ACPI_DMTABLE_INFO        AcpiDmTableInfoVrtc[]; +extern ACPI_DMTABLE_INFO        AcpiDmTableInfoVrtc0[];  extern ACPI_DMTABLE_INFO        AcpiDmTableInfoWaet[];  extern ACPI_DMTABLE_INFO        AcpiDmTableInfoWdat[];  extern ACPI_DMTABLE_INFO        AcpiDmTableInfoWdat0[]; @@ -457,6 +461,10 @@ AcpiDmDumpMsct (      ACPI_TABLE_HEADER       *Table);  void +AcpiDmDumpMtmr ( +    ACPI_TABLE_HEADER       *Table); + +void  AcpiDmDumpPcct (      ACPI_TABLE_HEADER       *Table); @@ -489,6 +497,10 @@ AcpiDmDumpSrat (      ACPI_TABLE_HEADER       *Table);  void +AcpiDmDumpVrtc ( +    ACPI_TABLE_HEADER       *Table); + +void  AcpiDmDumpWdat (      ACPI_TABLE_HEADER       *Table); @@ -677,6 +689,10 @@ void  AcpiDmEmitExternals (      void); +void +AcpiDmUnresolvedWarning ( +    UINT8                   Type); +  /*   * dmresrc diff --git a/source/include/acexcep.h b/source/include/acexcep.h index 110ef18ede81..9961acc23569 100644 --- a/source/include/acexcep.h +++ b/source/include/acexcep.h @@ -45,55 +45,88 @@  #define __ACEXCEP_H__ +/* This module contains all possible exception codes for ACPI_STATUS */ +  /* - * Exceptions returned by external ACPI interfaces + * Exception code classes   */ -#define AE_CODE_ENVIRONMENTAL           0x0000 -#define AE_CODE_PROGRAMMER              0x1000 -#define AE_CODE_ACPI_TABLES             0x2000 -#define AE_CODE_AML                     0x3000 -#define AE_CODE_CONTROL                 0x4000 +#define AE_CODE_ENVIRONMENTAL           0x0000 /* General ACPICA environment */ +#define AE_CODE_PROGRAMMER              0x1000 /* External ACPICA interface caller */ +#define AE_CODE_ACPI_TABLES             0x2000 /* ACPI tables */ +#define AE_CODE_AML                     0x3000 /* From executing AML code */ +#define AE_CODE_CONTROL                 0x4000 /* Internal control codes */ +  #define AE_CODE_MAX                     0x4000  #define AE_CODE_MASK                    0xF000 +/* + * Macros to insert the exception code classes + */ +#define EXCEP_ENV(code)                 ((ACPI_STATUS) (code | AE_CODE_ENVIRONMENTAL)) +#define EXCEP_PGM(code)                 ((ACPI_STATUS) (code | AE_CODE_PROGRAMMER)) +#define EXCEP_TBL(code)                 ((ACPI_STATUS) (code | AE_CODE_ACPI_TABLES)) +#define EXCEP_AML(code)                 ((ACPI_STATUS) (code | AE_CODE_AML)) +#define EXCEP_CTL(code)                 ((ACPI_STATUS) (code | AE_CODE_CONTROL)) + +/* + * Exception info table. The "Description" field is used only by the + * ACPICA help application (acpihelp). + */ +typedef struct acpi_exception_info +{ +    char                *Name; + +#ifdef ACPI_HELP_APP +    char                *Description; +#endif +} ACPI_EXCEPTION_INFO; + +#ifdef ACPI_HELP_APP +#define EXCEP_TXT(Name,Description)     {Name, Description} +#else +#define EXCEP_TXT(Name,Description)     {Name} +#endif + +/* + * Success is always zero, failure is non-zero + */  #define ACPI_SUCCESS(a)                 (!(a))  #define ACPI_FAILURE(a)                 (a) -  #define AE_OK                           (ACPI_STATUS) 0x0000  /*   * Environmental exceptions   */ -#define AE_ERROR                        (ACPI_STATUS) (0x0001 | AE_CODE_ENVIRONMENTAL) -#define AE_NO_ACPI_TABLES               (ACPI_STATUS) (0x0002 | AE_CODE_ENVIRONMENTAL) -#define AE_NO_NAMESPACE                 (ACPI_STATUS) (0x0003 | AE_CODE_ENVIRONMENTAL) -#define AE_NO_MEMORY                    (ACPI_STATUS) (0x0004 | AE_CODE_ENVIRONMENTAL) -#define AE_NOT_FOUND                    (ACPI_STATUS) (0x0005 | AE_CODE_ENVIRONMENTAL) -#define AE_NOT_EXIST                    (ACPI_STATUS) (0x0006 | AE_CODE_ENVIRONMENTAL) -#define AE_ALREADY_EXISTS               (ACPI_STATUS) (0x0007 | AE_CODE_ENVIRONMENTAL) -#define AE_TYPE                         (ACPI_STATUS) (0x0008 | AE_CODE_ENVIRONMENTAL) -#define AE_NULL_OBJECT                  (ACPI_STATUS) (0x0009 | AE_CODE_ENVIRONMENTAL) -#define AE_NULL_ENTRY                   (ACPI_STATUS) (0x000A | AE_CODE_ENVIRONMENTAL) -#define AE_BUFFER_OVERFLOW              (ACPI_STATUS) (0x000B | AE_CODE_ENVIRONMENTAL) -#define AE_STACK_OVERFLOW               (ACPI_STATUS) (0x000C | AE_CODE_ENVIRONMENTAL) -#define AE_STACK_UNDERFLOW              (ACPI_STATUS) (0x000D | AE_CODE_ENVIRONMENTAL) -#define AE_NOT_IMPLEMENTED              (ACPI_STATUS) (0x000E | AE_CODE_ENVIRONMENTAL) -#define AE_SUPPORT                      (ACPI_STATUS) (0x000F | AE_CODE_ENVIRONMENTAL) -#define AE_LIMIT                        (ACPI_STATUS) (0x0010 | AE_CODE_ENVIRONMENTAL) -#define AE_TIME                         (ACPI_STATUS) (0x0011 | AE_CODE_ENVIRONMENTAL) -#define AE_ACQUIRE_DEADLOCK             (ACPI_STATUS) (0x0012 | AE_CODE_ENVIRONMENTAL) -#define AE_RELEASE_DEADLOCK             (ACPI_STATUS) (0x0013 | AE_CODE_ENVIRONMENTAL) -#define AE_NOT_ACQUIRED                 (ACPI_STATUS) (0x0014 | AE_CODE_ENVIRONMENTAL) -#define AE_ALREADY_ACQUIRED             (ACPI_STATUS) (0x0015 | AE_CODE_ENVIRONMENTAL) -#define AE_NO_HARDWARE_RESPONSE         (ACPI_STATUS) (0x0016 | AE_CODE_ENVIRONMENTAL) -#define AE_NO_GLOBAL_LOCK               (ACPI_STATUS) (0x0017 | AE_CODE_ENVIRONMENTAL) -#define AE_ABORT_METHOD                 (ACPI_STATUS) (0x0018 | AE_CODE_ENVIRONMENTAL) -#define AE_SAME_HANDLER                 (ACPI_STATUS) (0x0019 | AE_CODE_ENVIRONMENTAL) -#define AE_NO_HANDLER                   (ACPI_STATUS) (0x001A | AE_CODE_ENVIRONMENTAL) -#define AE_OWNER_ID_LIMIT               (ACPI_STATUS) (0x001B | AE_CODE_ENVIRONMENTAL) -#define AE_NOT_CONFIGURED               (ACPI_STATUS) (0x001C | AE_CODE_ENVIRONMENTAL) +#define AE_ERROR                        EXCEP_ENV (0x0001) +#define AE_NO_ACPI_TABLES               EXCEP_ENV (0x0002) +#define AE_NO_NAMESPACE                 EXCEP_ENV (0x0003) +#define AE_NO_MEMORY                    EXCEP_ENV (0x0004) +#define AE_NOT_FOUND                    EXCEP_ENV (0x0005) +#define AE_NOT_EXIST                    EXCEP_ENV (0x0006) +#define AE_ALREADY_EXISTS               EXCEP_ENV (0x0007) +#define AE_TYPE                         EXCEP_ENV (0x0008) +#define AE_NULL_OBJECT                  EXCEP_ENV (0x0009) +#define AE_NULL_ENTRY                   EXCEP_ENV (0x000A) +#define AE_BUFFER_OVERFLOW              EXCEP_ENV (0x000B) +#define AE_STACK_OVERFLOW               EXCEP_ENV (0x000C) +#define AE_STACK_UNDERFLOW              EXCEP_ENV (0x000D) +#define AE_NOT_IMPLEMENTED              EXCEP_ENV (0x000E) +#define AE_SUPPORT                      EXCEP_ENV (0x000F) +#define AE_LIMIT                        EXCEP_ENV (0x0010) +#define AE_TIME                         EXCEP_ENV (0x0011) +#define AE_ACQUIRE_DEADLOCK             EXCEP_ENV (0x0012) +#define AE_RELEASE_DEADLOCK             EXCEP_ENV (0x0013) +#define AE_NOT_ACQUIRED                 EXCEP_ENV (0x0014) +#define AE_ALREADY_ACQUIRED             EXCEP_ENV (0x0015) +#define AE_NO_HARDWARE_RESPONSE         EXCEP_ENV (0x0016) +#define AE_NO_GLOBAL_LOCK               EXCEP_ENV (0x0017) +#define AE_ABORT_METHOD                 EXCEP_ENV (0x0018) +#define AE_SAME_HANDLER                 EXCEP_ENV (0x0019) +#define AE_NO_HANDLER                   EXCEP_ENV (0x001A) +#define AE_OWNER_ID_LIMIT               EXCEP_ENV (0x001B) +#define AE_NOT_CONFIGURED               EXCEP_ENV (0x001C)  #define AE_CODE_ENV_MAX                 0x001C @@ -101,15 +134,15 @@  /*   * Programmer exceptions   */ -#define AE_BAD_PARAMETER                (ACPI_STATUS) (0x0001 | AE_CODE_PROGRAMMER) -#define AE_BAD_CHARACTER                (ACPI_STATUS) (0x0002 | AE_CODE_PROGRAMMER) -#define AE_BAD_PATHNAME                 (ACPI_STATUS) (0x0003 | AE_CODE_PROGRAMMER) -#define AE_BAD_DATA                     (ACPI_STATUS) (0x0004 | AE_CODE_PROGRAMMER) -#define AE_BAD_HEX_CONSTANT             (ACPI_STATUS) (0x0005 | AE_CODE_PROGRAMMER) -#define AE_BAD_OCTAL_CONSTANT           (ACPI_STATUS) (0x0006 | AE_CODE_PROGRAMMER) -#define AE_BAD_DECIMAL_CONSTANT         (ACPI_STATUS) (0x0007 | AE_CODE_PROGRAMMER) -#define AE_MISSING_ARGUMENTS            (ACPI_STATUS) (0x0008 | AE_CODE_PROGRAMMER) -#define AE_BAD_ADDRESS                  (ACPI_STATUS) (0x0009 | AE_CODE_PROGRAMMER) +#define AE_BAD_PARAMETER                EXCEP_PGM (0x0001) +#define AE_BAD_CHARACTER                EXCEP_PGM (0x0002) +#define AE_BAD_PATHNAME                 EXCEP_PGM (0x0003) +#define AE_BAD_DATA                     EXCEP_PGM (0x0004) +#define AE_BAD_HEX_CONSTANT             EXCEP_PGM (0x0005) +#define AE_BAD_OCTAL_CONSTANT           EXCEP_PGM (0x0006) +#define AE_BAD_DECIMAL_CONSTANT         EXCEP_PGM (0x0007) +#define AE_MISSING_ARGUMENTS            EXCEP_PGM (0x0008) +#define AE_BAD_ADDRESS                  EXCEP_PGM (0x0009)  #define AE_CODE_PGM_MAX                 0x0009 @@ -117,11 +150,11 @@  /*   * Acpi table exceptions   */ -#define AE_BAD_SIGNATURE                (ACPI_STATUS) (0x0001 | AE_CODE_ACPI_TABLES) -#define AE_BAD_HEADER                   (ACPI_STATUS) (0x0002 | AE_CODE_ACPI_TABLES) -#define AE_BAD_CHECKSUM                 (ACPI_STATUS) (0x0003 | AE_CODE_ACPI_TABLES) -#define AE_BAD_VALUE                    (ACPI_STATUS) (0x0004 | AE_CODE_ACPI_TABLES) -#define AE_INVALID_TABLE_LENGTH         (ACPI_STATUS) (0x0005 | AE_CODE_ACPI_TABLES) +#define AE_BAD_SIGNATURE                EXCEP_TBL (0x0001) +#define AE_BAD_HEADER                   EXCEP_TBL (0x0002) +#define AE_BAD_CHECKSUM                 EXCEP_TBL (0x0003) +#define AE_BAD_VALUE                    EXCEP_TBL (0x0004) +#define AE_INVALID_TABLE_LENGTH         EXCEP_TBL (0x0005)  #define AE_CODE_TBL_MAX                 0x0005 @@ -130,39 +163,39 @@   * AML exceptions. These are caused by problems with   * the actual AML byte stream   */ -#define AE_AML_BAD_OPCODE               (ACPI_STATUS) (0x0001 | AE_CODE_AML) -#define AE_AML_NO_OPERAND               (ACPI_STATUS) (0x0002 | AE_CODE_AML) -#define AE_AML_OPERAND_TYPE             (ACPI_STATUS) (0x0003 | AE_CODE_AML) -#define AE_AML_OPERAND_VALUE            (ACPI_STATUS) (0x0004 | AE_CODE_AML) -#define AE_AML_UNINITIALIZED_LOCAL      (ACPI_STATUS) (0x0005 | AE_CODE_AML) -#define AE_AML_UNINITIALIZED_ARG        (ACPI_STATUS) (0x0006 | AE_CODE_AML) -#define AE_AML_UNINITIALIZED_ELEMENT    (ACPI_STATUS) (0x0007 | AE_CODE_AML) -#define AE_AML_NUMERIC_OVERFLOW         (ACPI_STATUS) (0x0008 | AE_CODE_AML) -#define AE_AML_REGION_LIMIT             (ACPI_STATUS) (0x0009 | AE_CODE_AML) -#define AE_AML_BUFFER_LIMIT             (ACPI_STATUS) (0x000A | AE_CODE_AML) -#define AE_AML_PACKAGE_LIMIT            (ACPI_STATUS) (0x000B | AE_CODE_AML) -#define AE_AML_DIVIDE_BY_ZERO           (ACPI_STATUS) (0x000C | AE_CODE_AML) -#define AE_AML_BAD_NAME                 (ACPI_STATUS) (0x000D | AE_CODE_AML) -#define AE_AML_NAME_NOT_FOUND           (ACPI_STATUS) (0x000E | AE_CODE_AML) -#define AE_AML_INTERNAL                 (ACPI_STATUS) (0x000F | AE_CODE_AML) -#define AE_AML_INVALID_SPACE_ID         (ACPI_STATUS) (0x0010 | AE_CODE_AML) -#define AE_AML_STRING_LIMIT             (ACPI_STATUS) (0x0011 | AE_CODE_AML) -#define AE_AML_NO_RETURN_VALUE          (ACPI_STATUS) (0x0012 | AE_CODE_AML) -#define AE_AML_METHOD_LIMIT             (ACPI_STATUS) (0x0013 | AE_CODE_AML) -#define AE_AML_NOT_OWNER                (ACPI_STATUS) (0x0014 | AE_CODE_AML) -#define AE_AML_MUTEX_ORDER              (ACPI_STATUS) (0x0015 | AE_CODE_AML) -#define AE_AML_MUTEX_NOT_ACQUIRED       (ACPI_STATUS) (0x0016 | AE_CODE_AML) -#define AE_AML_INVALID_RESOURCE_TYPE    (ACPI_STATUS) (0x0017 | AE_CODE_AML) -#define AE_AML_INVALID_INDEX            (ACPI_STATUS) (0x0018 | AE_CODE_AML) -#define AE_AML_REGISTER_LIMIT           (ACPI_STATUS) (0x0019 | AE_CODE_AML) -#define AE_AML_NO_WHILE                 (ACPI_STATUS) (0x001A | AE_CODE_AML) -#define AE_AML_ALIGNMENT                (ACPI_STATUS) (0x001B | AE_CODE_AML) -#define AE_AML_NO_RESOURCE_END_TAG      (ACPI_STATUS) (0x001C | AE_CODE_AML) -#define AE_AML_BAD_RESOURCE_VALUE       (ACPI_STATUS) (0x001D | AE_CODE_AML) -#define AE_AML_CIRCULAR_REFERENCE       (ACPI_STATUS) (0x001E | AE_CODE_AML) -#define AE_AML_BAD_RESOURCE_LENGTH      (ACPI_STATUS) (0x001F | AE_CODE_AML) -#define AE_AML_ILLEGAL_ADDRESS          (ACPI_STATUS) (0x0020 | AE_CODE_AML) -#define AE_AML_INFINITE_LOOP            (ACPI_STATUS) (0x0021 | AE_CODE_AML) +#define AE_AML_BAD_OPCODE               EXCEP_AML (0x0001) +#define AE_AML_NO_OPERAND               EXCEP_AML (0x0002) +#define AE_AML_OPERAND_TYPE             EXCEP_AML (0x0003) +#define AE_AML_OPERAND_VALUE            EXCEP_AML (0x0004) +#define AE_AML_UNINITIALIZED_LOCAL      EXCEP_AML (0x0005) +#define AE_AML_UNINITIALIZED_ARG        EXCEP_AML (0x0006) +#define AE_AML_UNINITIALIZED_ELEMENT    EXCEP_AML (0x0007) +#define AE_AML_NUMERIC_OVERFLOW         EXCEP_AML (0x0008) +#define AE_AML_REGION_LIMIT             EXCEP_AML (0x0009) +#define AE_AML_BUFFER_LIMIT             EXCEP_AML (0x000A) +#define AE_AML_PACKAGE_LIMIT            EXCEP_AML (0x000B) +#define AE_AML_DIVIDE_BY_ZERO           EXCEP_AML (0x000C) +#define AE_AML_BAD_NAME                 EXCEP_AML (0x000D) +#define AE_AML_NAME_NOT_FOUND           EXCEP_AML (0x000E) +#define AE_AML_INTERNAL                 EXCEP_AML (0x000F) +#define AE_AML_INVALID_SPACE_ID         EXCEP_AML (0x0010) +#define AE_AML_STRING_LIMIT             EXCEP_AML (0x0011) +#define AE_AML_NO_RETURN_VALUE          EXCEP_AML (0x0012) +#define AE_AML_METHOD_LIMIT             EXCEP_AML (0x0013) +#define AE_AML_NOT_OWNER                EXCEP_AML (0x0014) +#define AE_AML_MUTEX_ORDER              EXCEP_AML (0x0015) +#define AE_AML_MUTEX_NOT_ACQUIRED       EXCEP_AML (0x0016) +#define AE_AML_INVALID_RESOURCE_TYPE    EXCEP_AML (0x0017) +#define AE_AML_INVALID_INDEX            EXCEP_AML (0x0018) +#define AE_AML_REGISTER_LIMIT           EXCEP_AML (0x0019) +#define AE_AML_NO_WHILE                 EXCEP_AML (0x001A) +#define AE_AML_ALIGNMENT                EXCEP_AML (0x001B) +#define AE_AML_NO_RESOURCE_END_TAG      EXCEP_AML (0x001C) +#define AE_AML_BAD_RESOURCE_VALUE       EXCEP_AML (0x001D) +#define AE_AML_CIRCULAR_REFERENCE       EXCEP_AML (0x001E) +#define AE_AML_BAD_RESOURCE_LENGTH      EXCEP_AML (0x001F) +#define AE_AML_ILLEGAL_ADDRESS          EXCEP_AML (0x0020) +#define AE_AML_INFINITE_LOOP            EXCEP_AML (0x0021)  #define AE_CODE_AML_MAX                 0x0021 @@ -170,19 +203,19 @@  /*   * Internal exceptions used for control   */ -#define AE_CTRL_RETURN_VALUE            (ACPI_STATUS) (0x0001 | AE_CODE_CONTROL) -#define AE_CTRL_PENDING                 (ACPI_STATUS) (0x0002 | AE_CODE_CONTROL) -#define AE_CTRL_TERMINATE               (ACPI_STATUS) (0x0003 | AE_CODE_CONTROL) -#define AE_CTRL_TRUE                    (ACPI_STATUS) (0x0004 | AE_CODE_CONTROL) -#define AE_CTRL_FALSE                   (ACPI_STATUS) (0x0005 | AE_CODE_CONTROL) -#define AE_CTRL_DEPTH                   (ACPI_STATUS) (0x0006 | AE_CODE_CONTROL) -#define AE_CTRL_END                     (ACPI_STATUS) (0x0007 | AE_CODE_CONTROL) -#define AE_CTRL_TRANSFER                (ACPI_STATUS) (0x0008 | AE_CODE_CONTROL) -#define AE_CTRL_BREAK                   (ACPI_STATUS) (0x0009 | AE_CODE_CONTROL) -#define AE_CTRL_CONTINUE                (ACPI_STATUS) (0x000A | AE_CODE_CONTROL) -#define AE_CTRL_SKIP                    (ACPI_STATUS) (0x000B | AE_CODE_CONTROL) -#define AE_CTRL_PARSE_CONTINUE          (ACPI_STATUS) (0x000C | AE_CODE_CONTROL) -#define AE_CTRL_PARSE_PENDING           (ACPI_STATUS) (0x000D | AE_CODE_CONTROL) +#define AE_CTRL_RETURN_VALUE            EXCEP_CTL (0x0001) +#define AE_CTRL_PENDING                 EXCEP_CTL (0x0002) +#define AE_CTRL_TERMINATE               EXCEP_CTL (0x0003) +#define AE_CTRL_TRUE                    EXCEP_CTL (0x0004) +#define AE_CTRL_FALSE                   EXCEP_CTL (0x0005) +#define AE_CTRL_DEPTH                   EXCEP_CTL (0x0006) +#define AE_CTRL_END                     EXCEP_CTL (0x0007) +#define AE_CTRL_TRANSFER                EXCEP_CTL (0x0008) +#define AE_CTRL_BREAK                   EXCEP_CTL (0x0009) +#define AE_CTRL_CONTINUE                EXCEP_CTL (0x000A) +#define AE_CTRL_SKIP                    EXCEP_CTL (0x000B) +#define AE_CTRL_PARSE_CONTINUE          EXCEP_CTL (0x000C) +#define AE_CTRL_PARSE_PENDING           EXCEP_CTL (0x000D)  #define AE_CODE_CTRL_MAX                0x000D @@ -195,117 +228,117 @@   * String versions of the exception codes above   * These strings must match the corresponding defines exactly   */ -char const   *AcpiGbl_ExceptionNames_Env[] = +static const ACPI_EXCEPTION_INFO    AcpiGbl_ExceptionNames_Env[] =  { -    "AE_OK", -    "AE_ERROR", -    "AE_NO_ACPI_TABLES", -    "AE_NO_NAMESPACE", -    "AE_NO_MEMORY", -    "AE_NOT_FOUND", -    "AE_NOT_EXIST", -    "AE_ALREADY_EXISTS", -    "AE_TYPE", -    "AE_NULL_OBJECT", -    "AE_NULL_ENTRY", -    "AE_BUFFER_OVERFLOW", -    "AE_STACK_OVERFLOW", -    "AE_STACK_UNDERFLOW", -    "AE_NOT_IMPLEMENTED", -    "AE_SUPPORT", -    "AE_LIMIT", -    "AE_TIME", -    "AE_ACQUIRE_DEADLOCK", -    "AE_RELEASE_DEADLOCK", -    "AE_NOT_ACQUIRED", -    "AE_ALREADY_ACQUIRED", -    "AE_NO_HARDWARE_RESPONSE", -    "AE_NO_GLOBAL_LOCK", -    "AE_ABORT_METHOD", -    "AE_SAME_HANDLER", -    "AE_NO_HANDLER", -    "AE_OWNER_ID_LIMIT", -    "AE_NOT_CONFIGURED" +    EXCEP_TXT ("AE_OK",                         "No error"), +    EXCEP_TXT ("AE_ERROR",                      "Unspecified error"), +    EXCEP_TXT ("AE_NO_ACPI_TABLES",             "ACPI tables could not be found"), +    EXCEP_TXT ("AE_NO_NAMESPACE",               "A namespace has not been loaded"), +    EXCEP_TXT ("AE_NO_MEMORY",                  "Insufficient dynamic memory"), +    EXCEP_TXT ("AE_NOT_FOUND",                  "The name was not found in the namespace"), +    EXCEP_TXT ("AE_NOT_EXIST",                  "A required entity does not exist"), +    EXCEP_TXT ("AE_ALREADY_EXISTS",             "An entity already exists"), +    EXCEP_TXT ("AE_TYPE",                       "The object type is incorrect"), +    EXCEP_TXT ("AE_NULL_OBJECT",                "A required object was missing"), +    EXCEP_TXT ("AE_NULL_ENTRY",                 "The requested object does not exist"), +    EXCEP_TXT ("AE_BUFFER_OVERFLOW",            "The buffer provided is too small"), +    EXCEP_TXT ("AE_STACK_OVERFLOW",             "An internal stack overflowed"), +    EXCEP_TXT ("AE_STACK_UNDERFLOW",            "An internal stack underflowed"), +    EXCEP_TXT ("AE_NOT_IMPLEMENTED",            "The feature is not implemented"), +    EXCEP_TXT ("AE_SUPPORT",                    "The feature is not supported"), +    EXCEP_TXT ("AE_LIMIT",                      "A predefined limit was exceeded"), +    EXCEP_TXT ("AE_TIME",                       "A time limit or timeout expired"), +    EXCEP_TXT ("AE_ACQUIRE_DEADLOCK",           "Internal error, attempt was made to acquire a mutex in improper order"), +    EXCEP_TXT ("AE_RELEASE_DEADLOCK",           "Internal error, attempt was made to release a mutex in improper order"), +    EXCEP_TXT ("AE_NOT_ACQUIRED",               "An attempt to release a mutex or Global Lock without a previous acquire"), +    EXCEP_TXT ("AE_ALREADY_ACQUIRED",           "Internal error, attempt was made to acquire a mutex twice"), +    EXCEP_TXT ("AE_NO_HARDWARE_RESPONSE",       "Hardware did not respond after an I/O operation"), +    EXCEP_TXT ("AE_NO_GLOBAL_LOCK",             "There is no FACS Global Lock"), +    EXCEP_TXT ("AE_ABORT_METHOD",               "A control method was aborted"), +    EXCEP_TXT ("AE_SAME_HANDLER",               "Attempt was made to install the same handler that is already installed"), +    EXCEP_TXT ("AE_NO_HANDLER",                 "A handler for the operation is not installed"), +    EXCEP_TXT ("AE_OWNER_ID_LIMIT",             "There are no more Owner IDs available for ACPI tables or control methods"), +    EXCEP_TXT ("AE_NOT_CONFIGURED",             "The interface is not part of the current subsystem configuration")  }; -char const   *AcpiGbl_ExceptionNames_Pgm[] = +static const ACPI_EXCEPTION_INFO    AcpiGbl_ExceptionNames_Pgm[] =  { -    NULL, -    "AE_BAD_PARAMETER", -    "AE_BAD_CHARACTER", -    "AE_BAD_PATHNAME", -    "AE_BAD_DATA", -    "AE_BAD_HEX_CONSTANT", -    "AE_BAD_OCTAL_CONSTANT", -    "AE_BAD_DECIMAL_CONSTANT", -    "AE_MISSING_ARGUMENTS", -    "AE_BAD_ADDRESS" +    EXCEP_TXT (NULL, NULL), +    EXCEP_TXT ("AE_BAD_PARAMETER",              "A parameter is out of range or invalid"), +    EXCEP_TXT ("AE_BAD_CHARACTER",              "An invalid character was found in a name"), +    EXCEP_TXT ("AE_BAD_PATHNAME",               "An invalid character was found in a pathname"), +    EXCEP_TXT ("AE_BAD_DATA",                   "A package or buffer contained incorrect data"), +    EXCEP_TXT ("AE_BAD_HEX_CONSTANT",           "Invalid character in a Hex constant"), +    EXCEP_TXT ("AE_BAD_OCTAL_CONSTANT",         "Invalid character in an Octal constant"), +    EXCEP_TXT ("AE_BAD_DECIMAL_CONSTANT",       "Invalid character in a Decimal constant"), +    EXCEP_TXT ("AE_MISSING_ARGUMENTS",          "Too few arguments were passed to a control method"), +    EXCEP_TXT ("AE_BAD_ADDRESS",                "An illegal null I/O address")  }; -char const   *AcpiGbl_ExceptionNames_Tbl[] = +static const ACPI_EXCEPTION_INFO    AcpiGbl_ExceptionNames_Tbl[] =  { -    NULL, -    "AE_BAD_SIGNATURE", -    "AE_BAD_HEADER", -    "AE_BAD_CHECKSUM", -    "AE_BAD_VALUE", -    "AE_INVALID_TABLE_LENGTH" +    EXCEP_TXT (NULL, NULL), +    EXCEP_TXT ("AE_BAD_SIGNATURE",              "An ACPI table has an invalid signature"), +    EXCEP_TXT ("AE_BAD_HEADER",                 "Invalid field in an ACPI table header"), +    EXCEP_TXT ("AE_BAD_CHECKSUM",               "An ACPI table checksum is not correct"), +    EXCEP_TXT ("AE_BAD_VALUE",                  "An invalid value was found in a table"), +    EXCEP_TXT ("AE_INVALID_TABLE_LENGTH",       "The FADT or FACS has improper length")  }; -char const   *AcpiGbl_ExceptionNames_Aml[] = +static const ACPI_EXCEPTION_INFO    AcpiGbl_ExceptionNames_Aml[] =  { -    NULL, -    "AE_AML_BAD_OPCODE", -    "AE_AML_NO_OPERAND", -    "AE_AML_OPERAND_TYPE", -    "AE_AML_OPERAND_VALUE", -    "AE_AML_UNINITIALIZED_LOCAL", -    "AE_AML_UNINITIALIZED_ARG", -    "AE_AML_UNINITIALIZED_ELEMENT", -    "AE_AML_NUMERIC_OVERFLOW", -    "AE_AML_REGION_LIMIT", -    "AE_AML_BUFFER_LIMIT", -    "AE_AML_PACKAGE_LIMIT", -    "AE_AML_DIVIDE_BY_ZERO", -    "AE_AML_BAD_NAME", -    "AE_AML_NAME_NOT_FOUND", -    "AE_AML_INTERNAL", -    "AE_AML_INVALID_SPACE_ID", -    "AE_AML_STRING_LIMIT", -    "AE_AML_NO_RETURN_VALUE", -    "AE_AML_METHOD_LIMIT", -    "AE_AML_NOT_OWNER", -    "AE_AML_MUTEX_ORDER", -    "AE_AML_MUTEX_NOT_ACQUIRED", -    "AE_AML_INVALID_RESOURCE_TYPE", -    "AE_AML_INVALID_INDEX", -    "AE_AML_REGISTER_LIMIT", -    "AE_AML_NO_WHILE", -    "AE_AML_ALIGNMENT", -    "AE_AML_NO_RESOURCE_END_TAG", -    "AE_AML_BAD_RESOURCE_VALUE", -    "AE_AML_CIRCULAR_REFERENCE", -    "AE_AML_BAD_RESOURCE_LENGTH", -    "AE_AML_ILLEGAL_ADDRESS", -    "AE_AML_INFINITE_LOOP" +    EXCEP_TXT (NULL, NULL), +    EXCEP_TXT ("AE_AML_BAD_OPCODE",             "Invalid AML opcode encountered"), +    EXCEP_TXT ("AE_AML_NO_OPERAND",             "A required operand is missing"), +    EXCEP_TXT ("AE_AML_OPERAND_TYPE",           "An operand of an incorrect type was encountered"), +    EXCEP_TXT ("AE_AML_OPERAND_VALUE",          "The operand had an inappropriate or invalid value"), +    EXCEP_TXT ("AE_AML_UNINITIALIZED_LOCAL",    "Method tried to use an uninitialized local variable"), +    EXCEP_TXT ("AE_AML_UNINITIALIZED_ARG",      "Method tried to use an uninitialized argument"), +    EXCEP_TXT ("AE_AML_UNINITIALIZED_ELEMENT",  "Method tried to use an empty package element"), +    EXCEP_TXT ("AE_AML_NUMERIC_OVERFLOW",       "Overflow during BCD conversion or other"), +    EXCEP_TXT ("AE_AML_REGION_LIMIT",           "Tried to access beyond the end of an Operation Region"), +    EXCEP_TXT ("AE_AML_BUFFER_LIMIT",           "Tried to access beyond the end of a buffer"), +    EXCEP_TXT ("AE_AML_PACKAGE_LIMIT",          "Tried to access beyond the end of a package"), +    EXCEP_TXT ("AE_AML_DIVIDE_BY_ZERO",         "During execution of AML Divide operator"), +    EXCEP_TXT ("AE_AML_BAD_NAME",               "An ACPI name contains invalid character(s)"), +    EXCEP_TXT ("AE_AML_NAME_NOT_FOUND",         "Could not resolve a named reference"), +    EXCEP_TXT ("AE_AML_INTERNAL",               "An internal error within the interprete"), +    EXCEP_TXT ("AE_AML_INVALID_SPACE_ID",       "An Operation Region SpaceID is invalid"), +    EXCEP_TXT ("AE_AML_STRING_LIMIT",           "String is longer than 200 characters"), +    EXCEP_TXT ("AE_AML_NO_RETURN_VALUE",        "A method did not return a required value"), +    EXCEP_TXT ("AE_AML_METHOD_LIMIT",           "A control method reached the maximum reentrancy limit of 255"), +    EXCEP_TXT ("AE_AML_NOT_OWNER",              "A thread tried to release a mutex that it does not own"), +    EXCEP_TXT ("AE_AML_MUTEX_ORDER",            "Mutex SyncLevel release mismatch"), +    EXCEP_TXT ("AE_AML_MUTEX_NOT_ACQUIRED",     "Attempt to release a mutex that was not previously acquired"), +    EXCEP_TXT ("AE_AML_INVALID_RESOURCE_TYPE",  "Invalid resource type in resource list"), +    EXCEP_TXT ("AE_AML_INVALID_INDEX",          "Invalid Argx or Localx (x too large)"), +    EXCEP_TXT ("AE_AML_REGISTER_LIMIT",         "Bank value or Index value beyond range of register"), +    EXCEP_TXT ("AE_AML_NO_WHILE",               "Break or Continue without a While"), +    EXCEP_TXT ("AE_AML_ALIGNMENT",              "Non-aligned memory transfer on platform that does not support this"), +    EXCEP_TXT ("AE_AML_NO_RESOURCE_END_TAG",    "No End Tag in a resource list"), +    EXCEP_TXT ("AE_AML_BAD_RESOURCE_VALUE",     "Invalid value of a resource element"), +    EXCEP_TXT ("AE_AML_CIRCULAR_REFERENCE",     "Two references refer to each other"), +    EXCEP_TXT ("AE_AML_BAD_RESOURCE_LENGTH",    "The length of a Resource Descriptor in the AML is incorrect"), +    EXCEP_TXT ("AE_AML_ILLEGAL_ADDRESS",        "A memory, I/O, or PCI configuration address is invalid"), +    EXCEP_TXT ("AE_AML_INFINITE_LOOP",          "An apparent infinite AML While loop, method was aborted")  }; -char const   *AcpiGbl_ExceptionNames_Ctrl[] = +static const ACPI_EXCEPTION_INFO    AcpiGbl_ExceptionNames_Ctrl[] =  { -    NULL, -    "AE_CTRL_RETURN_VALUE", -    "AE_CTRL_PENDING", -    "AE_CTRL_TERMINATE", -    "AE_CTRL_TRUE", -    "AE_CTRL_FALSE", -    "AE_CTRL_DEPTH", -    "AE_CTRL_END", -    "AE_CTRL_TRANSFER", -    "AE_CTRL_BREAK", -    "AE_CTRL_CONTINUE", -    "AE_CTRL_SKIP", -    "AE_CTRL_PARSE_CONTINUE", -    "AE_CTRL_PARSE_PENDING" +    EXCEP_TXT (NULL, NULL), +    EXCEP_TXT ("AE_CTRL_RETURN_VALUE",          "A Method returned a value"), +    EXCEP_TXT ("AE_CTRL_PENDING",               "Method is calling another method"), +    EXCEP_TXT ("AE_CTRL_TERMINATE",             "Terminate the executing method"), +    EXCEP_TXT ("AE_CTRL_TRUE",                  "An If or While predicate result"), +    EXCEP_TXT ("AE_CTRL_FALSE",                 "An If or While predicate result"), +    EXCEP_TXT ("AE_CTRL_DEPTH",                 "Maximum search depth has been reached"), +    EXCEP_TXT ("AE_CTRL_END",                   "An If or While predicate is false"), +    EXCEP_TXT ("AE_CTRL_TRANSFER",              "Transfer control to called method"), +    EXCEP_TXT ("AE_CTRL_BREAK",                 "A Break has been executed"), +    EXCEP_TXT ("AE_CTRL_CONTINUE",              "A Continue has been executed"), +    EXCEP_TXT ("AE_CTRL_SKIP",                  "Not currently used"), +    EXCEP_TXT ("AE_CTRL_PARSE_CONTINUE",        "Used to skip over bad opcodes"), +    EXCEP_TXT ("AE_CTRL_PARSE_PENDING",         "Used to implement AML While loops")  };  #endif /* EXCEPTION_TABLE */ diff --git a/source/include/acglobal.h b/source/include/acglobal.h index c528974711f0..987fc6126efa 100644 --- a/source/include/acglobal.h +++ b/source/include/acglobal.h @@ -420,10 +420,12 @@ ACPI_EXTERN UINT8                       AcpiGbl_DbOutputFlags;  #ifdef ACPI_DISASSEMBLER -BOOLEAN     ACPI_INIT_GLOBAL (AcpiGbl_IgnoreNoopOperator, FALSE); +ACPI_EXTERN BOOLEAN                     ACPI_INIT_GLOBAL (AcpiGbl_IgnoreNoopOperator, FALSE);  ACPI_EXTERN BOOLEAN                     AcpiGbl_DbOpt_disasm;  ACPI_EXTERN BOOLEAN                     AcpiGbl_DbOpt_verbose; +ACPI_EXTERN BOOLEAN                     AcpiGbl_NumExternalMethods; +ACPI_EXTERN UINT32                      AcpiGbl_ResolvedExternalMethods;  ACPI_EXTERN ACPI_EXTERNAL_LIST         *AcpiGbl_ExternalList;  ACPI_EXTERN ACPI_EXTERNAL_FILE         *AcpiGbl_ExternalFileList;  #endif diff --git a/source/include/aclocal.h b/source/include/aclocal.h index 798c4cb38254..ab03935a9c4e 100644 --- a/source/include/aclocal.h +++ b/source/include/aclocal.h @@ -417,6 +417,7 @@ typedef struct acpi_predefined_data      union acpi_operand_object   *ParentPackage;      ACPI_NAMESPACE_NODE         *Node;      UINT32                      Flags; +    UINT32                      ReturnBtype;      UINT8                       NodeFlags;  } ACPI_PREDEFINED_DATA; @@ -427,6 +428,22 @@ typedef struct acpi_predefined_data  #define ACPI_OBJECT_WRAPPED     2 +/* Return object auto-repair info */ + +typedef ACPI_STATUS (*ACPI_OBJECT_CONVERTER) ( +    union acpi_operand_object   *OriginalObject, +    union acpi_operand_object   **ConvertedObject); + +typedef struct acpi_simple_repair_info +{ +    char                        Name[ACPI_NAME_SIZE]; +    UINT32                      UnexpectedBtypes; +    UINT32                      PackageIndex; +    ACPI_OBJECT_CONVERTER       ObjectConverter; + +} ACPI_SIMPLE_REPAIR_INFO; + +  /*   * Bitmapped return value types   * Note: the actual data types must be contiguous, a loop in nspredef.c @@ -1217,6 +1234,7 @@ typedef struct acpi_external_list      UINT16                      Length;      UINT8                       Type;      UINT8                       Flags; +    BOOLEAN                     Resolved;  } ACPI_EXTERNAL_LIST; diff --git a/source/include/acnamesp.h b/source/include/acnamesp.h index 7a92143328fb..4009c2d14438 100644 --- a/source/include/acnamesp.h +++ b/source/include/acnamesp.h @@ -204,6 +204,35 @@ AcpiNsCompareNames (  /* + * nsconvert - Dynamic object conversion routines + */ +ACPI_STATUS +AcpiNsConvertToInteger ( +    ACPI_OPERAND_OBJECT     *OriginalObject, +    ACPI_OPERAND_OBJECT     **ReturnObject); + +ACPI_STATUS +AcpiNsConvertToString ( +    ACPI_OPERAND_OBJECT     *OriginalObject, +    ACPI_OPERAND_OBJECT     **ReturnObject); + +ACPI_STATUS +AcpiNsConvertToBuffer ( +    ACPI_OPERAND_OBJECT     *OriginalObject, +    ACPI_OPERAND_OBJECT     **ReturnObject); + +ACPI_STATUS +AcpiNsConvertToUnicode ( +    ACPI_OPERAND_OBJECT     *OriginalObject, +    ACPI_OPERAND_OBJECT     **ReturnObject); + +ACPI_STATUS +AcpiNsConvertToResource ( +    ACPI_OPERAND_OBJECT     *OriginalObject, +    ACPI_OPERAND_OBJECT     **ReturnObject); + + +/*   * nsdump - Namespace dump/print utilities   */  void @@ -377,7 +406,7 @@ AcpiNsGetAttachedData (   * predefined methods/objects   */  ACPI_STATUS -AcpiNsRepairObject ( +AcpiNsSimpleRepair (      ACPI_PREDEFINED_DATA    *Data,      UINT32                  ExpectedBtypes,      UINT32                  PackageIndex, diff --git a/source/include/acoutput.h b/source/include/acoutput.h index 4b5ca9c78e24..371ce7fc8fbf 100644 --- a/source/include/acoutput.h +++ b/source/include/acoutput.h @@ -409,6 +409,11 @@  #define return_VALUE(Value) \      ACPI_TRACE_EXIT (AcpiUtValueExit, UINT64, Value) +#define return_UINT32(Value) \ +    ACPI_TRACE_EXIT (AcpiUtValueExit, UINT32, Value) + +#define return_UINT8(Value) \ +    ACPI_TRACE_EXIT (AcpiUtValueExit, UINT8, Value)  /* Conditional execution */ @@ -457,8 +462,10 @@  #define return_VOID                     return  #define return_ACPI_STATUS(s)           return(s) -#define return_VALUE(s)                 return(s)  #define return_PTR(s)                   return(s) +#define return_VALUE(s)                 return(s) +#define return_UINT8(s)                 return(s) +#define return_UINT32(s)                return(s)  #endif /* ACPI_DEBUG_OUTPUT */ diff --git a/source/include/acpixf.h b/source/include/acpixf.h index 76f9afbc47b6..a547bcc8bb1f 100644 --- a/source/include/acpixf.h +++ b/source/include/acpixf.h @@ -47,7 +47,7 @@  /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION                 0x20130117 +#define ACPI_CA_VERSION                 0x20130214  #include "acconfig.h"  #include "actypes.h" diff --git a/source/include/actbl2.h b/source/include/actbl2.h index 49b9578b682f..327a8105e6cb 100644 --- a/source/include/actbl2.h +++ b/source/include/actbl2.h @@ -74,11 +74,13 @@  #define ACPI_SIG_IVRS           "IVRS"      /* I/O Virtualization Reporting Structure */  #define ACPI_SIG_MCFG           "MCFG"      /* PCI Memory Mapped Configuration table */  #define ACPI_SIG_MCHI           "MCHI"      /* Management Controller Host Interface table */ +#define ACPI_SIG_MTMR           "MTMR"      /* MID Timer table */  #define ACPI_SIG_SLIC           "SLIC"      /* Software Licensing Description Table */  #define ACPI_SIG_SPCR           "SPCR"      /* Serial Port Console Redirection table */  #define ACPI_SIG_SPMI           "SPMI"      /* Server Platform Management Interface table */  #define ACPI_SIG_TCPA           "TCPA"      /* Trusted Computing Platform Alliance table */  #define ACPI_SIG_UEFI           "UEFI"      /* Uefi Boot Optimization Table */ +#define ACPI_SIG_VRTC           "VRTC"      /* Virtual Real Time Clock Table */  #define ACPI_SIG_WAET           "WAET"      /* Windows ACPI Emulated devices Table */  #define ACPI_SIG_WDAT           "WDAT"      /* Watchdog Action Table */  #define ACPI_SIG_WDDT           "WDDT"      /* Watchdog Timer Description Table */ @@ -983,6 +985,34 @@ typedef struct acpi_table_mchi  /*******************************************************************************   * + * MTMR - MID Timer Table + *        Version 1 + * + * Conforms to "Simple Firmware Interface Specification", + * Draft 0.8.2, Oct 19, 2010 + * NOTE: The ACPI MTMR is equivalent to the SFI MTMR table. + * + ******************************************************************************/ + +typedef struct acpi_table_mtmr +{ +    ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */ + +} ACPI_TABLE_MTMR; + +/* MTMR entry */ + +typedef struct acpi_mtmr_entry +{ +    ACPI_GENERIC_ADDRESS    PhysicalAddress; +    UINT32                  Frequency; +    UINT32                  Irq; + +} ACPI_MTMR_ENTRY; + + +/******************************************************************************* + *   * SLIC - Software Licensing Description Table   *        Version 1   * @@ -1182,6 +1212,33 @@ typedef struct acpi_table_uefi  /*******************************************************************************   * + * VRTC - Virtual Real Time Clock Table + *        Version 1 + * + * Conforms to "Simple Firmware Interface Specification", + * Draft 0.8.2, Oct 19, 2010 + * NOTE: The ACPI VRTC is equivalent to The SFI MRTC table. + * + ******************************************************************************/ + +typedef struct acpi_table_vrtc +{ +    ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */ + +} ACPI_TABLE_VRTC; + +/* VRTC entry */ + +typedef struct acpi_vrtc_entry +{ +    ACPI_GENERIC_ADDRESS    PhysicalAddress; +    UINT32                  Irq; + +} ACPI_VRTC_ENTRY; + + +/******************************************************************************* + *   * WAET - Windows ACPI Emulated devices Table   *        Version 1   * diff --git a/source/include/actbl3.h b/source/include/actbl3.h index 46c3c6d70f13..acf2e13560d0 100644 --- a/source/include/actbl3.h +++ b/source/include/actbl3.h @@ -195,7 +195,7 @@ typedef struct acpi_fpdt_header  enum AcpiFpdtType  {      ACPI_FPDT_TYPE_BOOT                 = 0, -    ACPI_FPDT_TYPE_S3PERF               = 1, +    ACPI_FPDT_TYPE_S3PERF               = 1  }; @@ -257,7 +257,7 @@ typedef struct acpi_s3pt_header  enum AcpiS3ptType  {      ACPI_S3PT_TYPE_RESUME               = 0, -    ACPI_S3PT_TYPE_SUSPEND              = 1, +    ACPI_S3PT_TYPE_SUSPEND              = 1  };  typedef struct acpi_s3pt_resume @@ -599,28 +599,67 @@ typedef struct acpi_rasf_shared_memory      UINT32                  Signature;      UINT16                  Command;      UINT16                  Status; -    UINT64                  RequestedAddress; -    UINT64                  RequestedLength; -    UINT64                  ActualAddress; -    UINT64                  ActualLength; -    UINT16                  Flags; -    UINT8                   Speed; +    UINT16                  Version; +    UINT8                   Capabilities[16]; +    UINT8                   SetCapabilities[16]; +    UINT16                  NumParameterBlocks; +    UINT32                  SetCapabilitiesStatus;  } ACPI_RASF_SHARED_MEMORY; +/* RASF Parameter Block Structure Header */ + +typedef struct acpi_rasf_parameter_block +{ +    UINT16                  Type; +    UINT16                  Version; +    UINT16                  Length; + +} ACPI_RASF_PARAMETER_BLOCK; + +/* RASF Parameter Block Structure for PATROL_SCRUB */ + +typedef struct acpi_rasf_patrol_scrub_parameter +{ +    ACPI_RASF_PARAMETER_BLOCK   Header; +    UINT16                      PatrolScrubCommand; +    UINT64                      RequestedAddressRange[2]; +    UINT64                      ActualAddressRange[2]; +    UINT16                      Flags; +    UINT8                       RequestedSpeed; + +} ACPI_RASF_PATROL_SCRUB_PARAMETER; +  /* Masks for Flags and Speed fields above */  #define ACPI_RASF_SCRUBBER_RUNNING      1  #define ACPI_RASF_SPEED                 (7<<1) +#define ACPI_RASF_SPEED_SLOW            (0<<1) +#define ACPI_RASF_SPEED_MEDIUM          (4<<1) +#define ACPI_RASF_SPEED_FAST            (7<<1)  /* Channel Commands */  enum AcpiRasfCommands  { -    ACPI_RASF_GET_RAS_CAPABILITIES      = 1, -    ACPI_RASF_GET_PATROL_PARAMETERS     = 2, -    ACPI_RASF_START_PATROL_SCRUBBER     = 3, -    ACPI_RASF_STOP_PATROL_SCRUBBER      = 4 +    ACPI_RASF_EXECUTE_RASF_COMMAND      = 1 +}; + +/* Platform RAS Capabilities */ + +enum AcpiRasfCapabiliities +{ +    ACPI_HW_PATROL_SCRUB_SUPPORTED      = 0, +    ACPI_SW_PATROL_SCRUB_EXPOSED        = 1 +}; + +/* Patrol Scrub Commands */ + +enum AcpiRasfPatrolScrubCommands +{ +    ACPI_RASF_GET_PATROL_PARAMETERS     = 1, +    ACPI_RASF_START_PATROL_SCRUBBER     = 2, +    ACPI_RASF_STOP_PATROL_SCRUBBER      = 3  };  /* Channel Command flags */ diff --git a/source/include/acutils.h b/source/include/acutils.h index e75e248931c2..165a1587e71b 100644 --- a/source/include/acutils.h +++ b/source/include/acutils.h @@ -706,10 +706,11 @@ AcpiUtShortDivide (      UINT64                  *OutQuotient,      UINT32                  *OutRemainder); +  /*   * utmisc   */ -const char * +const ACPI_EXCEPTION_INFO *  AcpiUtValidateException (      ACPI_STATUS             Status); diff --git a/source/tools/acpihelp/ahdecode.c b/source/tools/acpihelp/ahdecode.c index 74d42df10039..633b0db0a412 100644 --- a/source/tools/acpihelp/ahdecode.c +++ b/source/tools/acpihelp/ahdecode.c @@ -85,6 +85,9 @@ static const AH_DEVICE_ID  AhDeviceIds[] =  #define AH_DISPLAY_EXCEPTION(Status, Name) \      printf ("%.4X: %s\n", Status, Name) +#define AH_DISPLAY_EXCEPTION_TEXT(Status, Exception) \ +    printf ("%.4X: %-28s (%s)\n", Status, Exception->Name, Exception->Description) +  #define BUFFER_LENGTH           128  #define LINE_BUFFER_LENGTH      512 @@ -878,9 +881,9 @@ void  AhDecodeException (      char                    *HexString)  { -    const char              *ExceptionName; -    UINT32                  Status; -    UINT32                  i; +    const ACPI_EXCEPTION_INFO   *ExceptionInfo; +    UINT32                      Status; +    UINT32                      i;      /* @@ -889,8 +892,8 @@ AhDecodeException (       */      if (!HexString)      { -        printf ("All defined ACPI exception codes:\n\n"); -        AH_DISPLAY_EXCEPTION (0, "AE_OK"); +        printf ("All defined ACPICA exception codes:\n\n"); +        AH_DISPLAY_EXCEPTION (0, "AE_OK                        (No error occurred)");          /* Display codes in each block of exception types */ @@ -899,14 +902,14 @@ AhDecodeException (              Status = i;              do              { -                ExceptionName = AcpiUtValidateException ((ACPI_STATUS) Status); -                if (ExceptionName) +                ExceptionInfo = AcpiUtValidateException ((ACPI_STATUS) Status); +                if (ExceptionInfo)                  { -                    AH_DISPLAY_EXCEPTION (Status, ExceptionName); +                    AH_DISPLAY_EXCEPTION_TEXT (Status, ExceptionInfo);                  }                  Status++; -            } while (ExceptionName); +            } while (ExceptionInfo);          }          return;      } @@ -916,7 +919,7 @@ AhDecodeException (      Status = ACPI_STRTOUL (HexString, NULL, 16);      if (!Status)      { -        printf ("%s: Invalid hexadecimal exception code\n", HexString); +        printf ("%s: Invalid hexadecimal exception code value\n", HexString);          return;      } @@ -926,12 +929,12 @@ AhDecodeException (          return;      } -    ExceptionName = AcpiUtValidateException ((ACPI_STATUS) Status); -    if (!ExceptionName) +    ExceptionInfo = AcpiUtValidateException ((ACPI_STATUS) Status); +    if (!ExceptionInfo)      {          AH_DISPLAY_EXCEPTION (Status, "Unknown exception code");          return;      } -    AH_DISPLAY_EXCEPTION (Status, ExceptionName); +    AH_DISPLAY_EXCEPTION_TEXT (Status, ExceptionInfo);  } diff --git a/source/tools/acpisrc/astable.c b/source/tools/acpisrc/astable.c index e655818464fe..1bd757534f0c 100644 --- a/source/tools/acpisrc/astable.c +++ b/source/tools/acpisrc/astable.c @@ -215,6 +215,7 @@ ACPI_TYPED_IDENTIFIER_TABLE           AcpiIdentifiers[] = {      {"ACPI_EVENT_STATUS",                   SRC_TYPE_SIMPLE},      {"ACPI_EVENT_TYPE",                     SRC_TYPE_SIMPLE},      {"ACPI_EXCEPTION_HANDLER",              SRC_TYPE_SIMPLE}, +    {"ACPI_EXCEPTION_INFO",                 SRC_TYPE_STRUCT},      {"ACPI_EXDUMP_INFO",                    SRC_TYPE_STRUCT},      {"ACPI_EXECUTE_OP",                     SRC_TYPE_SIMPLE},      {"ACPI_EXECUTE_TYPE",                   SRC_TYPE_SIMPLE}, @@ -259,6 +260,7 @@ ACPI_TYPED_IDENTIFIER_TABLE           AcpiIdentifiers[] = {      {"ACPI_MEM_SPACE_CONTEXT",              SRC_TYPE_STRUCT},      {"ACPI_MEMORY_ATTRIBUTE",               SRC_TYPE_STRUCT},      {"ACPI_MEMORY_LIST",                    SRC_TYPE_STRUCT}, +    {"ACPI_MTMR_ENTRY",                     SRC_TYPE_STRUCT},      {"ACPI_MUTEX",                          SRC_TYPE_SIMPLE},      {"ACPI_MUTEX_HANDLE",                   SRC_TYPE_SIMPLE},      {"ACPI_MUTEX_INFO",                     SRC_TYPE_STRUCT}, @@ -337,6 +339,9 @@ ACPI_TYPED_IDENTIFIER_TABLE           AcpiIdentifiers[] = {      {"ACPI_PREDEFINED_INFO",                SRC_TYPE_UNION},      {"ACPI_PREDEFINED_NAMES",               SRC_TYPE_STRUCT},      {"ACPI_PSCOPE_STATE",                   SRC_TYPE_STRUCT}, +    {"ACPI_RASF_PARAMETER_BLOCK",           SRC_TYPE_STRUCT}, +    {"ACPI_RASF_PATROL_SCRUB_PARAMETER",    SRC_TYPE_STRUCT}, +    {"ACPI_RASF_SHARED_MEMORY",             SRC_TYPE_STRUCT},      {"ACPI_REPAIR_FUNCTION",                SRC_TYPE_SIMPLE},      {"ACPI_REPAIR_INFO",                    SRC_TYPE_STRUCT},      {"ACPI_RESOURCE",                       SRC_TYPE_STRUCT}, @@ -380,6 +385,7 @@ ACPI_TYPED_IDENTIFIER_TABLE           AcpiIdentifiers[] = {      {"ACPI_SCOPE_STATE",                    SRC_TYPE_STRUCT},      {"ACPI_SEMAPHORE",                      SRC_TYPE_SIMPLE},      {"ACPI_SIGNAL_FATAL_INFO",              SRC_TYPE_STRUCT}, +    {"ACPI_SIMPLE_REPAIR_INFO",             SRC_TYPE_STRUCT},      {"ACPI_SIZE",                           SRC_TYPE_SIMPLE},      {"ACPI_SLEEP_FUNCTION",                 SRC_TYPE_SIMPLE},      {"ACPI_SLEEP_FUNCTIONS",                SRC_TYPE_STRUCT}, @@ -395,8 +401,10 @@ ACPI_TYPED_IDENTIFIER_TABLE           AcpiIdentifiers[] = {      {"ACPI_TABLE_HEADER",                   SRC_TYPE_STRUCT},      {"ACPI_TABLE_INFO",                     SRC_TYPE_STRUCT},      {"ACPI_TABLE_LIST",                     SRC_TYPE_STRUCT}, +    {"ACPI_TABLE_MTMR",                     SRC_TYPE_STRUCT},      {"ACPI_TABLE_SUPPORT",                  SRC_TYPE_STRUCT},      {"ACPI_TABLE_TYPE",                     SRC_TYPE_SIMPLE}, +    {"ACPI_TABLE_VRTC",                     SRC_TYPE_STRUCT},      {"ACPI_TAG_INFO",                       SRC_TYPE_STRUCT},      {"ACPI_THREAD_ID",                      SRC_TYPE_SIMPLE},      {"ACPI_THREAD_STATE",                   SRC_TYPE_STRUCT}, @@ -406,6 +414,7 @@ ACPI_TYPED_IDENTIFIER_TABLE           AcpiIdentifiers[] = {      {"ACPI_UUID",                           SRC_TYPE_STRUCT},      {"ACPI_VENDOR_UUID",                    SRC_TYPE_STRUCT},      {"ACPI_VENDOR_WALK_INFO",               SRC_TYPE_STRUCT}, +    {"ACPI_VRTC_ENTRY",                     SRC_TYPE_STRUCT},      {"ACPI_WALK_AML_CALLBACK",              SRC_TYPE_SIMPLE},      {"ACPI_WALK_CALLBACK",                  SRC_TYPE_SIMPLE},      {"ACPI_WALK_RESOURCE_CALLBACK",         SRC_TYPE_SIMPLE},  | 
