diff options
author | avg <avg@FreeBSD.org> | 2010-02-06 12:03:25 +0000 |
---|---|---|
committer | avg <avg@FreeBSD.org> | 2010-02-06 12:03:25 +0000 |
commit | 63ac3cf8c47ea847e5eb490a164494f9a7eedbb7 (patch) | |
tree | 71a64a5216b56e1938f817ea99f7b632c71bf008 | |
parent | 8d357f4e1116deb3422aab2a8391ef3132ddb1f2 (diff) | |
download | FreeBSD-src-63ac3cf8c47ea847e5eb490a164494f9a7eedbb7.zip FreeBSD-src-63ac3cf8c47ea847e5eb490a164494f9a7eedbb7.tar.gz |
MFC r197104,197105,197106,197107,197688,198237,199337,199338,200553,200554,
202771,202773: bring acpica version to 20100121
MFC details:
r197104 | jkim | 2009-09-12 01:48:53 +0300 (Sat, 12 Sep 2009) | 4 lines
MFV: r196804
Import ACPICA 20090903
r197105 | jkim | 2009-09-12 01:49:34 +0300 (Sat, 12 Sep 2009) | 2 lines
Catch up with ACPICA 20090903.
r197106 | jkim | 2009-09-12 01:50:15 +0300 (Sat, 12 Sep 2009) | 2 lines
Catch up with ACPICA 20090903.
r197107 | jkim | 2009-09-12 01:56:08 +0300 (Sat, 12 Sep 2009) | 2 lines
Canonify include paths for newly added files.
r197688 | jkim | 2009-10-01 23:56:15 +0300 (Thu, 01 Oct 2009) | 4 lines
Compile ACPI debugger and disassembler for kernel modules
unconditionally.
These files will generate almost empty object files without
ACPI_DEBUG/DDB
options. As a result, size of acpi.ko will increase slightly.
r198237 | jkim | 2009-10-19 19:12:58 +0300 (Mon, 19 Oct 2009) | 2 lines
Merge ACPICA 20091013.
r199337 | jkim | 2009-11-16 23:47:12 +0200 (Mon, 16 Nov 2009) | 2 lines
Merge ACPICA 20091112.
r199338 | jkim | 2009-11-16 23:53:56 +0200 (Mon, 16 Nov 2009) | 2 lines
Add a forgotten module Makefile change from the previous commit.
r200553 | jkim | 2009-12-15 00:24:04 +0200 (Tue, 15 Dec 2009) | 2 lines
Merge ACPICA 20091214.
r200554 | jkim | 2009-12-15 00:28:32 +0200 (Tue, 15 Dec 2009) | 3 lines
Remove _FDE quirk handling as these quirks are automatically repaired
by ACPICA layer since ACPICA 20091214.
r202771 | jkim | 2010-01-21 23:14:28 +0200 (Thu, 21 Jan 2010) | 2 lines
Merge ACPICA 20100121.
r202773 | jkim | 2010-01-21 23:31:39 +0200 (Thu, 21 Jan 2010) | 2 lines
Fix a new header inclusion.
Discussed with: jkim, jhb
No objections from: acpi@
235 files changed, 9625 insertions, 3964 deletions
diff --git a/sys/conf/files b/sys/conf/files index 77a1b34..d14c1ee 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -171,105 +171,108 @@ contrib/dev/acpica/dispatcher/dswexec.c optional acpi contrib/dev/acpica/dispatcher/dswload.c optional acpi contrib/dev/acpica/dispatcher/dswscope.c optional acpi contrib/dev/acpica/dispatcher/dswstate.c optional acpi -contrib/dev/acpica/events/evevent.c optional acpi -contrib/dev/acpica/events/evgpe.c optional acpi -contrib/dev/acpica/events/evgpeblk.c optional acpi -contrib/dev/acpica/events/evmisc.c optional acpi -contrib/dev/acpica/events/evregion.c optional acpi -contrib/dev/acpica/events/evrgnini.c optional acpi -contrib/dev/acpica/events/evsci.c optional acpi -contrib/dev/acpica/events/evxface.c optional acpi -contrib/dev/acpica/events/evxfevnt.c optional acpi -contrib/dev/acpica/events/evxfregn.c optional acpi -contrib/dev/acpica/executer/exconfig.c optional acpi -contrib/dev/acpica/executer/exconvrt.c optional acpi -contrib/dev/acpica/executer/excreate.c optional acpi -contrib/dev/acpica/executer/exdump.c optional acpi -contrib/dev/acpica/executer/exfield.c optional acpi -contrib/dev/acpica/executer/exfldio.c optional acpi -contrib/dev/acpica/executer/exmisc.c optional acpi -contrib/dev/acpica/executer/exmutex.c optional acpi -contrib/dev/acpica/executer/exnames.c optional acpi -contrib/dev/acpica/executer/exoparg1.c optional acpi -contrib/dev/acpica/executer/exoparg2.c optional acpi -contrib/dev/acpica/executer/exoparg3.c optional acpi -contrib/dev/acpica/executer/exoparg6.c optional acpi -contrib/dev/acpica/executer/exprep.c optional acpi -contrib/dev/acpica/executer/exregion.c optional acpi -contrib/dev/acpica/executer/exresnte.c optional acpi -contrib/dev/acpica/executer/exresolv.c optional acpi -contrib/dev/acpica/executer/exresop.c optional acpi -contrib/dev/acpica/executer/exstore.c optional acpi -contrib/dev/acpica/executer/exstoren.c optional acpi -contrib/dev/acpica/executer/exstorob.c optional acpi -contrib/dev/acpica/executer/exsystem.c optional acpi -contrib/dev/acpica/executer/exutils.c optional acpi -contrib/dev/acpica/hardware/hwacpi.c optional acpi -contrib/dev/acpica/hardware/hwgpe.c optional acpi -contrib/dev/acpica/hardware/hwregs.c optional acpi -contrib/dev/acpica/hardware/hwsleep.c optional acpi -contrib/dev/acpica/hardware/hwtimer.c optional acpi -contrib/dev/acpica/hardware/hwvalid.c optional acpi -contrib/dev/acpica/hardware/hwxface.c optional acpi -contrib/dev/acpica/namespace/nsaccess.c optional acpi -contrib/dev/acpica/namespace/nsalloc.c optional acpi -contrib/dev/acpica/namespace/nsdump.c optional acpi -contrib/dev/acpica/namespace/nseval.c optional acpi -contrib/dev/acpica/namespace/nsinit.c optional acpi -contrib/dev/acpica/namespace/nsload.c optional acpi -contrib/dev/acpica/namespace/nsnames.c optional acpi -contrib/dev/acpica/namespace/nsobject.c optional acpi -contrib/dev/acpica/namespace/nsparse.c optional acpi -contrib/dev/acpica/namespace/nspredef.c optional acpi -contrib/dev/acpica/namespace/nssearch.c optional acpi -contrib/dev/acpica/namespace/nsutils.c optional acpi -contrib/dev/acpica/namespace/nswalk.c optional acpi -contrib/dev/acpica/namespace/nsxfeval.c optional acpi -contrib/dev/acpica/namespace/nsxfname.c optional acpi -contrib/dev/acpica/namespace/nsxfobj.c optional acpi -contrib/dev/acpica/parser/psargs.c optional acpi -contrib/dev/acpica/parser/psloop.c optional acpi -contrib/dev/acpica/parser/psopcode.c optional acpi -contrib/dev/acpica/parser/psparse.c optional acpi -contrib/dev/acpica/parser/psscope.c optional acpi -contrib/dev/acpica/parser/pstree.c optional acpi -contrib/dev/acpica/parser/psutils.c optional acpi -contrib/dev/acpica/parser/pswalk.c optional acpi -contrib/dev/acpica/parser/psxface.c optional acpi -contrib/dev/acpica/resources/rsaddr.c optional acpi -contrib/dev/acpica/resources/rscalc.c optional acpi -contrib/dev/acpica/resources/rscreate.c optional acpi -contrib/dev/acpica/resources/rsdump.c optional acpi -contrib/dev/acpica/resources/rsinfo.c optional acpi -contrib/dev/acpica/resources/rsio.c optional acpi -contrib/dev/acpica/resources/rsirq.c optional acpi -contrib/dev/acpica/resources/rslist.c optional acpi -contrib/dev/acpica/resources/rsmemory.c optional acpi -contrib/dev/acpica/resources/rsmisc.c optional acpi -contrib/dev/acpica/resources/rsutils.c optional acpi -contrib/dev/acpica/resources/rsxface.c optional acpi -contrib/dev/acpica/tables/tbfadt.c optional acpi -contrib/dev/acpica/tables/tbfind.c optional acpi -contrib/dev/acpica/tables/tbinstal.c optional acpi -contrib/dev/acpica/tables/tbutils.c optional acpi -contrib/dev/acpica/tables/tbxface.c optional acpi -contrib/dev/acpica/tables/tbxfroot.c optional acpi -contrib/dev/acpica/utilities/utalloc.c optional acpi -contrib/dev/acpica/utilities/utcache.c optional acpi -contrib/dev/acpica/utilities/utcopy.c optional acpi -contrib/dev/acpica/utilities/utdebug.c optional acpi -contrib/dev/acpica/utilities/utdelete.c optional acpi -contrib/dev/acpica/utilities/uteval.c optional acpi -contrib/dev/acpica/utilities/utglobal.c optional acpi -contrib/dev/acpica/utilities/utinit.c optional acpi -contrib/dev/acpica/utilities/utlock.c optional acpi -contrib/dev/acpica/utilities/utmath.c optional acpi -contrib/dev/acpica/utilities/utmisc.c optional acpi -contrib/dev/acpica/utilities/utmutex.c optional acpi -contrib/dev/acpica/utilities/utobject.c optional acpi -contrib/dev/acpica/utilities/utresrc.c optional acpi -contrib/dev/acpica/utilities/utstate.c optional acpi -contrib/dev/acpica/utilities/utxface.c optional acpi +contrib/dev/acpica/events/evevent.c optional acpi +contrib/dev/acpica/events/evgpe.c optional acpi +contrib/dev/acpica/events/evgpeblk.c optional acpi +contrib/dev/acpica/events/evmisc.c optional acpi +contrib/dev/acpica/events/evregion.c optional acpi +contrib/dev/acpica/events/evrgnini.c optional acpi +contrib/dev/acpica/events/evsci.c optional acpi +contrib/dev/acpica/events/evxface.c optional acpi +contrib/dev/acpica/events/evxfevnt.c optional acpi +contrib/dev/acpica/events/evxfregn.c optional acpi +contrib/dev/acpica/executer/exconfig.c optional acpi +contrib/dev/acpica/executer/exconvrt.c optional acpi +contrib/dev/acpica/executer/excreate.c optional acpi +contrib/dev/acpica/executer/exdump.c optional acpi +contrib/dev/acpica/executer/exfield.c optional acpi +contrib/dev/acpica/executer/exfldio.c optional acpi +contrib/dev/acpica/executer/exmisc.c optional acpi +contrib/dev/acpica/executer/exmutex.c optional acpi +contrib/dev/acpica/executer/exnames.c optional acpi +contrib/dev/acpica/executer/exoparg1.c optional acpi +contrib/dev/acpica/executer/exoparg2.c optional acpi +contrib/dev/acpica/executer/exoparg3.c optional acpi +contrib/dev/acpica/executer/exoparg6.c optional acpi +contrib/dev/acpica/executer/exprep.c optional acpi +contrib/dev/acpica/executer/exregion.c optional acpi +contrib/dev/acpica/executer/exresnte.c optional acpi +contrib/dev/acpica/executer/exresolv.c optional acpi +contrib/dev/acpica/executer/exresop.c optional acpi +contrib/dev/acpica/executer/exstore.c optional acpi +contrib/dev/acpica/executer/exstoren.c optional acpi +contrib/dev/acpica/executer/exstorob.c optional acpi +contrib/dev/acpica/executer/exsystem.c optional acpi +contrib/dev/acpica/executer/exutils.c optional acpi +contrib/dev/acpica/hardware/hwacpi.c optional acpi +contrib/dev/acpica/hardware/hwgpe.c optional acpi +contrib/dev/acpica/hardware/hwregs.c optional acpi +contrib/dev/acpica/hardware/hwsleep.c optional acpi +contrib/dev/acpica/hardware/hwtimer.c optional acpi +contrib/dev/acpica/hardware/hwvalid.c optional acpi +contrib/dev/acpica/hardware/hwxface.c optional acpi +contrib/dev/acpica/namespace/nsaccess.c optional acpi +contrib/dev/acpica/namespace/nsalloc.c optional acpi +contrib/dev/acpica/namespace/nsdump.c optional acpi +contrib/dev/acpica/namespace/nseval.c optional acpi +contrib/dev/acpica/namespace/nsinit.c optional acpi +contrib/dev/acpica/namespace/nsload.c optional acpi +contrib/dev/acpica/namespace/nsnames.c optional acpi +contrib/dev/acpica/namespace/nsobject.c optional acpi +contrib/dev/acpica/namespace/nsparse.c optional acpi +contrib/dev/acpica/namespace/nspredef.c optional acpi +contrib/dev/acpica/namespace/nsrepair.c optional acpi +contrib/dev/acpica/namespace/nsrepair2.c optional acpi +contrib/dev/acpica/namespace/nssearch.c optional acpi +contrib/dev/acpica/namespace/nsutils.c optional acpi +contrib/dev/acpica/namespace/nswalk.c optional acpi +contrib/dev/acpica/namespace/nsxfeval.c optional acpi +contrib/dev/acpica/namespace/nsxfname.c optional acpi +contrib/dev/acpica/namespace/nsxfobj.c optional acpi +contrib/dev/acpica/parser/psargs.c optional acpi +contrib/dev/acpica/parser/psloop.c optional acpi +contrib/dev/acpica/parser/psopcode.c optional acpi +contrib/dev/acpica/parser/psparse.c optional acpi +contrib/dev/acpica/parser/psscope.c optional acpi +contrib/dev/acpica/parser/pstree.c optional acpi +contrib/dev/acpica/parser/psutils.c optional acpi +contrib/dev/acpica/parser/pswalk.c optional acpi +contrib/dev/acpica/parser/psxface.c optional acpi +contrib/dev/acpica/resources/rsaddr.c optional acpi +contrib/dev/acpica/resources/rscalc.c optional acpi +contrib/dev/acpica/resources/rscreate.c optional acpi +contrib/dev/acpica/resources/rsdump.c optional acpi +contrib/dev/acpica/resources/rsinfo.c optional acpi +contrib/dev/acpica/resources/rsio.c optional acpi +contrib/dev/acpica/resources/rsirq.c optional acpi +contrib/dev/acpica/resources/rslist.c optional acpi +contrib/dev/acpica/resources/rsmemory.c optional acpi +contrib/dev/acpica/resources/rsmisc.c optional acpi +contrib/dev/acpica/resources/rsutils.c optional acpi +contrib/dev/acpica/resources/rsxface.c optional acpi +contrib/dev/acpica/tables/tbfadt.c optional acpi +contrib/dev/acpica/tables/tbfind.c optional acpi +contrib/dev/acpica/tables/tbinstal.c optional acpi +contrib/dev/acpica/tables/tbutils.c optional acpi +contrib/dev/acpica/tables/tbxface.c optional acpi +contrib/dev/acpica/tables/tbxfroot.c optional acpi +contrib/dev/acpica/utilities/utalloc.c optional acpi +contrib/dev/acpica/utilities/utcache.c optional acpi +contrib/dev/acpica/utilities/utcopy.c optional acpi +contrib/dev/acpica/utilities/utdebug.c optional acpi +contrib/dev/acpica/utilities/utdelete.c optional acpi +contrib/dev/acpica/utilities/uteval.c optional acpi +contrib/dev/acpica/utilities/utglobal.c optional acpi +contrib/dev/acpica/utilities/utids.c optional acpi +contrib/dev/acpica/utilities/utinit.c optional acpi +contrib/dev/acpica/utilities/utlock.c optional acpi +contrib/dev/acpica/utilities/utmath.c optional acpi +contrib/dev/acpica/utilities/utmisc.c optional acpi +contrib/dev/acpica/utilities/utmutex.c optional acpi +contrib/dev/acpica/utilities/utobject.c optional acpi +contrib/dev/acpica/utilities/utresrc.c optional acpi +contrib/dev/acpica/utilities/utstate.c optional acpi +contrib/dev/acpica/utilities/utxface.c optional acpi contrib/ipfilter/netinet/fil.c optional ipfilter inet \ compile-with "${NORMAL_C} -I$S/contrib/ipfilter" contrib/ipfilter/netinet/ip_auth.c optional ipfilter inet \ diff --git a/sys/contrib/dev/acpica/acpica_prep.sh b/sys/contrib/dev/acpica/acpica_prep.sh index b07f153..3a17041 100755 --- a/sys/contrib/dev/acpica/acpica_prep.sh +++ b/sys/contrib/dev/acpica/acpica_prep.sh @@ -21,7 +21,7 @@ fulldirs="common compiler debugger disassembler dispatcher events \ # files to remove stripdirs="acpisrc acpixtract examples generate os_specific" stripfiles="Makefile README acintel.h aclinux.h acmsvc.h acnetbsd.h \ - acos2.h accygwin.h acefi.h actbl2.h acwin.h acwin64.h aeexec.c \ + acos2.h accygwin.h acefi.h acwin.h acwin64.h aeexec.c \ aehandlers.c aemain.c aetables.c osunixdir.c readme.txt \ utclib.c" @@ -31,8 +31,8 @@ src_headers="acapps.h accommon.h acconfig.h acdebug.h acdisasm.h \ aclocal.h acmacros.h acnames.h acnamesp.h acobject.h acopcode.h \ acoutput.h acparser.h acpi.h acpiosxf.h acpixf.h acpredef.h \ acresrc.h acrestyp.h acstruct.h actables.h actbl.h actbl1.h \ - actypes.h acutils.h amlcode.h amlresrc.h platform/acenv.h \ - platform/acfreebsd.h platform/acgcc.h" + actbl2.h actypes.h acutils.h amlcode.h amlresrc.h \ + platform/acenv.h platform/acfreebsd.h platform/acgcc.h" comp_headers="aslcompiler.h asldefine.h aslglobal.h asltypes.h" platform_headers="acfreebsd.h acgcc.h" diff --git a/sys/contrib/dev/acpica/changes.txt b/sys/contrib/dev/acpica/changes.txt index 89f6232..60620ce 100644 --- a/sys/contrib/dev/acpica/changes.txt +++ b/sys/contrib/dev/acpica/changes.txt @@ -1,7 +1,467 @@ ---------------------------------------- -21 May 2009. Summary of changes for version 20090521: +21 January 2010. Summary of changes for version 20100121: + +1) ACPI CA Core Subsystem: + +Added the 2010 copyright to all module headers and signons. This affects +virtually every file in the ACPICA core subsystem, the iASL compiler, the +tools/utilities, and the test suites. + +Implemented a change to the AcpiGetDevices interface to eliminate unnecessary +invocations of the _STA method. In the case where a specific _HID is +requested, do not run _STA until a _HID match is found. This eliminates +potentially dozens of _STA calls during a search for a particular device/HID, +which in turn can improve boot times. ACPICA BZ 828. Lin Ming. + +Implemented an additional repair for predefined method return values. Attempt +to repair unexpected NULL elements within returned Package objects. Create an +Integer of value zero, a NULL String, or a zero-length Buffer as appropriate. +ACPICA BZ 818. Lin Ming, Bob Moore. + +Removed the obsolete ACPI_INTEGER data type. This type was introduced as the +code was migrated from ACPI 1.0 (with 32-bit AML integers) to ACPI 2.0 (with +64-bit AML integers). It is now obsolete and this change removes it from the +ACPICA code base, replaced by UINT64. The original typedef has been retained +for now for compatibility with existing device driver code. ACPICA BZ 824. + +Removed the unused UINT32_STRUCT type, and the obsolete Integer64 field in +the parse tree object. + +Added additional warning options for the gcc-4 generation. Updated the source +accordingly. This includes some code restructuring to eliminate unreachable +code, elimination of some gotos, elimination of unused return values, some +additional casting, and removal of redundant declarations. + +Example Code and Data Size: These are the sizes for the OS-independent +acpica.lib produced by the Microsoft Visual C++ 6.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: 87.0K Code, 18.0K Data, 105.0K Total + Debug Version: 163.4K Code, 50.8K Data, 214.2K Total + Current Release: + Non-Debug Version: 87.1K Code, 18.0K Data, 105.1K Total + Debug Version: 163.5K Code, 50.9K Data, 214.4K Total + +2) iASL Compiler/Disassembler and Tools: + +No functional changes for this release. + +---------------------------------------- +14 December 2009. Summary of changes for version 20091214: + +1) ACPI CA Core Subsystem: + +Enhanced automatic data type conversions for predefined name repairs. This +change expands the automatic repairs/conversions for predefined name return +values to make Integers, Strings, and Buffers fully interchangeable. Also, a +Buffer can be converted to a Package of Integers if necessary. The nsrepair.c +module was completely restructured. Lin Ming, Bob Moore. + +Implemented automatic removal of null package elements during predefined name +repairs. This change will automatically remove embedded and trailing NULL +package elements from returned package objects that are defined to contain a +variable number of sub-packages. The driver is then presented with a package +with no null elements to deal with. ACPICA BZ 819. + +Implemented a repair for the predefined _FDE and _GTM names. The expected +return value for both names is a Buffer of 5 DWORDs. This repair fixes two +possible problems (both seen in the field), where a package of integers is +returned, or a buffer of BYTEs is returned. With assistance from Jung-uk Kim. + +Implemented additional module-level code support. This change will properly +execute module-level code that is not at the root of the namespace (under a +Device object, etc.). Now executes the code within the current scope instead +of the root. ACPICA BZ 762. Lin Ming. + +Fixed possible mutex acquisition errors when running _REG methods. Fixes a +problem where mutex errors can occur when running a _REG method that is in +the same scope as a method-defined operation region or an operation region +under a module-level IF block. This type of code is rare, so the problem has +not been seen before. ACPICA BZ 826. Lin Ming, Bob Moore. + +Fixed a possible memory leak during module-level code execution. An object +could be leaked for each block of executed module-level code if the +interpreter slack mode is enabled This change deletes any implicitly returned +object from the module-level code block. Lin Ming. + +Removed messages for successful predefined repair(s). The repair mechanism +was considered too wordy. Now, messages are only unconditionally emitted if +the return object cannot be repaired. Existing messages for successful +repairs were converted to ACPI_DEBUG_PRINT messages for now. ACPICA BZ 827. + +Example Code and Data Size: These are the sizes for the OS-independent +acpica.lib produced by the Microsoft Visual C++ 6.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: 86.6K Code, 18.2K Data, 104.8K Total + Debug Version: 162.7K Code, 50.8K Data, 213.5K Total + Current Release: + Non-Debug Version: 87.0K Code, 18.0K Data, 105.0K Total + Debug Version: 163.4K Code, 50.8K Data, 214.2K Total + +2) iASL Compiler/Disassembler and Tools: + +iASL: Fixed a regression introduced in 20091112 where intermediate .SRC files +were no longer automatically removed at the termination of the compile. + +acpiexec: Implemented the -f option to specify default region fill value. +This option specifies the value used to initialize buffers that simulate +operation regions. Default value is zero. Useful for debugging problems that +depend on a specific initial value for a region or field. + +---------------------------------------- +12 November 2009. Summary of changes for version 20091112: + +1) ACPI CA Core Subsystem: + +Implemented a post-order callback to AcpiWalkNamespace. The existing +interface only has a pre-order callback. This change adds an additional +parameter for a post-order callback which will be more useful for bus scans. +ACPICA BZ 779. Lin Ming. Updated the ACPICA Programmer Reference. + +Modified the behavior of the operation region memory mapping cache for +SystemMemory. Ensure that the memory mappings created for operation regions +do not cross 4K page boundaries. Crossing a page boundary while mapping +regions can cause kernel warnings on some hosts if the pages have different +attributes. Such regions are probably BIOS bugs, and this is the workaround. +Linux BZ 14445. Lin Ming. + +Implemented an automatic repair for predefined methods that must return +sorted lists. This change will repair (by sorting) packages returned by _ALR, +_PSS, and _TSS. Drivers can now assume that the packages are correctly sorted +and do not contain NULL package elements. Adds one new file, +namespace/nsrepair2.c. ACPICA BZ 784. Lin Ming, Bob Moore. + +Fixed a possible fault during predefined name validation if a return Package +object contains NULL elements. Also adds a warning if a NULL element is +followed by any non-null elements. ACPICA BZ 813, 814. Future enhancement may +include repair or removal of all such NULL elements where possible. + +Implemented additional module-level executable AML code support. This change +will execute module-level code that is not at the root of the namespace +(under a Device object, etc.) at table load time. Module-level executable AML +code has been illegal since ACPI 2.0. ACPICA BZ 762. Lin Ming. + +Implemented a new internal function to create Integer objects. This function +simplifies miscellaneous object creation code. ACPICA BZ 823. + +Reduced the severity of predefined repair messages, Warning to Info. Since +the object was successfully repaired, a warning is too severe. Reduced to an +info message for now. These messages may eventually be changed to debug-only. +ACPICA BZ 812. + +Example Code and Data Size: These are the sizes for the OS-independent +acpica.lib produced by the Microsoft Visual C++ 6.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: 85.8K Code, 18.0K Data, 103.8K Total + Debug Version: 161.8K Code, 50.6K Data, 212.4K Total + Current Release: + Non-Debug Version: 86.6K Code, 18.2K Data, 104.8K Total + Debug Version: 162.7K Code, 50.8K Data, 213.5K Total + +2) iASL Compiler/Disassembler and Tools: + +iASL: Implemented Switch() with While(1) so that Break works correctly. This +change correctly implements the Switch operator with a surrounding While(1) +so that the Break operator works as expected. ACPICA BZ 461. Lin Ming. + +iASL: Added a message if a package initializer list is shorter than package +length. Adds a new remark for a Package() declaration if an initializer list +exists, but is shorter than the declared length of the package. Although +technically legal, this is probably a coding error and it is seen in the +field. ACPICA BZ 815. Lin Ming, Bob Moore. + +iASL: Fixed a problem where the compiler could fault after the maximum number +of errors was reached (200). + +acpixtract: Fixed a possible warning for pointer cast if the compiler warning +level set very high. + +---------------------------------------- +13 October 2009. Summary of changes for version 20091013: + +1) ACPI CA Core Subsystem: + +Fixed a problem where an Operation Region _REG method could be executed more +than once. If a custom address space handler is installed by the host before +the "initialize operation regions" phase of the ACPICA initialization, any +_REG methods for that address space could be executed twice. This change +fixes the problem. ACPICA BZ 427. Lin Ming. + +Fixed a possible memory leak for the Scope() ASL operator. When the exact +invocation of "Scope(\)" is executed (change scope to root), one internal +operand object was leaked. Lin Ming. + +Implemented a run-time repair for the _MAT predefined method. If the _MAT +return value is defined as a Field object in the AML, and the field +size is less than or equal to the default width of an integer (32 or 64),_MAT +can incorrectly return an Integer instead of a Buffer. ACPICA now +automatically repairs this problem. ACPICA BZ 810. + +Implemented a run-time repair for the _BIF and _BIX predefined methods. The +"OEM Information" field is often incorrectly returned as an Integer with +value zero if the field is not supported by the platform. This is due to an +ambiguity in the ACPI specification. The field should always be a string. +ACPICA now automatically repairs this problem by returning a NULL string +within the returned Package. ACPICA BZ 807. + +Example Code and Data Size: These are the sizes for the OS-independent +acpica.lib produced by the Microsoft Visual C++ 6.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: 85.6K Code, 18.0K Data, 103.6K Total + Debug Version: 161.7K Code, 50.9K Data, 212.6K Total + Current Release: + Non-Debug Version: 85.8K Code, 18.0K Data, 103.8K Total + Debug Version: 161.8K Code, 50.6K Data, 212.4K Total + +2) iASL Compiler/Disassembler and Tools: -This release is available at www.acpica.org/downloads +Disassembler: Fixed a problem where references to external symbols that +contained one or more parent-prefixes (carats) were not handled correctly, +possibly causing a fault. ACPICA BZ 806. Lin Ming. + +Disassembler: Restructured the code so that all functions that handle +external symbols are in a single module. One new file is added, +common/dmextern.c. + +AML Debugger: Added a max count argument for the Batch command (which +executes multiple predefined methods within the namespace.) + +iASL: Updated the compiler documentation (User Reference.) Available at +http://www.acpica.org/documentation/. ACPICA BZ 750. + +AcpiXtract: Updated for Lint and other formatting changes. Close all open +files. + +---------------------------------------- +03 September 2009. Summary of changes for version 20090903: + +1) ACPI CA Core Subsystem: + +For Windows Vista compatibility, added the automatic execution of an _INI +method located at the namespace root (\_INI). This method is executed at +table load time. This support is in addition to the automatic execution of +\_SB._INI. Lin Ming. + +Fixed a possible memory leak in the interpreter for AML package objects if +the package initializer list is longer than the defined size of the package. +This apparently can only happen if the BIOS changes the package size on the +fly (seen in a _PSS object), as ASL compilers do not allow this. The +interpreter will truncate the package to the defined size (and issue an error +message), but previously could leave the extra objects undeleted if they were +pre-created during the argument processing (such is the case if the package +consists of a number of sub-packages as in the _PSS.) ACPICA BZ 805. + +Fixed a problem seen when a Buffer or String is stored to itself via ASL. +This has been reported in the field. Previously, ACPICA would zero out the +buffer/string. Now, the operation is treated as a noop. Provides Windows +compatibility. ACPICA BZ 803. Lin Ming. + +Removed an extraneous error message for ASL constructs of the form +Store(LocalX,LocalX) when LocalX is uninitialized. These curious statements +are seen in many BIOSs and are once again treated as NOOPs and no error is +emitted when they are encountered. ACPICA BZ 785. + +Fixed an extraneous warning message if a _DSM reserved method returns a +Package object. _DSM can return any type of object, so validation on the +return type cannot be performed. ACPICA BZ 802. + +Example Code and Data Size: These are the sizes for the OS-independent +acpica.lib produced by the Microsoft Visual C++ 6.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: 85.5K Code, 18.0K Data, 103.5K Total + Debug Version: 161.6K Code, 50.9K Data, 212.5K Total + Current Release: + Non-Debug Version: 85.6K Code, 18.0K Data, 103.6K Total + Debug Version: 161.7K Code, 50.9K Data, 212.6K Total + +2) iASL Compiler/Disassembler and Tools: + +iASL: Fixed a problem with the use of the Alias operator and Resource +Templates. The correct alias is now constructed and no error is emitted. +ACPICA BZ 738. + +iASL: Implemented the -I option to specify additional search directories for +include files. Allows multiple additional search paths for include files. +Directories are searched in the order specified on the command line (after +the local directory is searched.) ACPICA BZ 800. + +iASL: Fixed a problem where the full pathname for include files was not +emitted for warnings/errors. This caused the IDE support to not work +properly. ACPICA BZ 765. + +iASL: Implemented the -@ option to specify a Windows-style response file +containing additional command line options. ACPICA BZ 801. + +AcpiExec: Added support to load multiple AML files simultaneously (such as a +DSDT and multiple SSDTs). Also added support for wildcards within the AML +pathname. These features allow all machine tables to be easily loaded and +debugged together. ACPICA BZ 804. + +Disassembler: Added missing support for disassembly of HEST table Error Bank +subtables. + +---------------------------------------- +30 July 2009. Summary of changes for version 20090730: + +The ACPI 4.0 implementation for ACPICA is complete with this release. + +1) ACPI CA Core Subsystem: + +ACPI 4.0: Added header file support for all new and changed ACPI tables. +Completely new tables are: IBFT, IVRS, MSCT, and WAET. Tables that are new +for ACPI 4.0, but have previously been supported in ACPICA are: CPEP, BERT, +EINJ, ERST, and HEST. Other newly supported tables are: UEFI and WDAT. There +have been some ACPI 4.0 changes to other existing tables. Split the large +actbl1.h header into the existing actbl2.h header. ACPICA BZ 774. + +ACPI 4.0: Implemented predefined name validation for all new names. There are +31 new names in ACPI 4.0. The predefined validation module was split into two +files. The new file is namespace/nsrepair.c. ACPICA BZ 770. + +Implemented support for so-called "module-level executable code". This is +executable AML code that exists outside of any control method and is intended +to be executed at table load time. Although illegal since ACPI 2.0, this type +of code still exists and is apparently still being created. Blocks of this +code are now detected and executed as intended. Currently, the code blocks +must exist under either an If, Else, or While construct; these are the +typical cases seen in the field. ACPICA BZ 762. Lin Ming. + +Implemented an automatic dynamic repair for predefined names that return +nested Package objects. This applies to predefined names that are defined to +return a variable-length Package of sub-packages. If the number of sub- +packages is one, BIOS code is occasionally seen that creates a simple single +package with no sub-packages. This code attempts to fix the problem by +wrapping a new package object around the existing package. These methods can +be repaired: _ALR, _CSD, _HPX, _MLS, _PRT, _PSS, _TRT, and _TSS. ACPICA BZ +790. + +Fixed a regression introduced in 20090625 for the AcpiGetDevices interface. +The _HID/_CID matching was broken and no longer matched IDs correctly. ACPICA +BZ 793. + +Fixed a problem with AcpiReset where the reset would silently fail if the +register was one of the protected I/O ports. AcpiReset now bypasses the port +validation mechanism. This may eventually be driven into the AcpiRead/Write +interfaces. + +Fixed a regression related to the recent update of the AcpiRead/Write +interfaces. A sleep/suspend could fail if the optional PM2 Control register +does not exist during an attempt to write the Bus Master Arbitration bit. +(However, some hosts already delete the code that writes this bit, and the +code may in fact be obsolete at this date.) ACPICA BZ 799. + +Fixed a problem where AcpiTerminate could fault if inadvertently called twice +in succession. ACPICA BZ 795. + +Example Code and Data Size: These are the sizes for the OS-independent +acpica.lib produced by the Microsoft Visual C++ 6.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: 84.7K Code, 17.8K Data, 102.5K Total + Debug Version: 160.5K Code, 50.6K Data, 211.1K Total + Current Release: + Non-Debug Version: 85.5K Code, 18.0K Data, 103.5K Total + Debug Version: 161.6K Code, 50.9K Data, 212.5K Total + +2) iASL Compiler/Disassembler and Tools: + +ACPI 4.0: Implemented disassembler support for all new ACPI tables and +changes to existing tables. ACPICA BZ 775. + +---------------------------------------- +25 June 2009. Summary of changes for version 20090625: + +The ACPI 4.0 Specification was released on June 16 and is available at +www.acpi.info. ACPICA implementation of ACPI 4.0 is underway and will +continue for the next few releases. + +1) ACPI CA Core Subsystem: + +ACPI 4.0: Implemented interpreter support for the IPMI operation region +address space. Includes support for bi-directional data buffers and an IPMI +address space handler (to be installed by an IPMI device driver.) ACPICA BZ +773. Lin Ming. + +ACPI 4.0: Added changes for existing ACPI tables - FACS and SRAT. Includes +support in both the header files and the disassembler. + +Completed a major update for the AcpiGetObjectInfo external interface. +Changes include: + - Support for variable, unlimited length HID, UID, and CID strings. + - Support Processor objects the same as Devices (HID,UID,CID,ADR,STA, etc.) + - Call the _SxW power methods on behalf of a device object. + - Determine if a device is a PCI root bridge. + - Change the ACPI_BUFFER parameter to ACPI_DEVICE_INFO. +These changes will require an update to all callers of this interface. See +the updated ACPICA Programmer Reference for details. One new source file has +been added - utilities/utids.c. ACPICA BZ 368, 780. + +Updated the AcpiRead and AcpiWrite external interfaces to support 64-bit +transfers. The Value parameter has been extended from 32 bits to 64 bits in +order to support new ACPI 4.0 tables. These changes will require an update to +all callers of these interfaces. See the ACPICA Programmer Reference for +details. ACPICA BZ 768. + +Fixed several problems with AcpiAttachData. The handler was not invoked when +the host node was deleted. The data sub-object was not automatically deleted +when the host node was deleted. The interface to the handler had an unused +parameter, this was removed. ACPICA BZ 778. + +Enhanced the function that dumps ACPI table headers. All non-printable +characters in the string fields are now replaced with '?' (Signature, OemId, +OemTableId, and CompilerId.) ACPI tables with non-printable characters in +these fields are occasionally seen in the field. ACPICA BZ 788. + +Fixed a problem with predefined method repair code where the code that +attempts to repair/convert an object of incorrect type is only executed on +the first time the predefined method is called. The mechanism that disables +warnings on subsequent calls was interfering with the repair mechanism. +ACPICA BZ 781. + +Fixed a possible memory leak in the predefined validation/repair code when a +buffer is automatically converted to an expected string object. + +Removed obsolete 16-bit files from the distribution and from the current git +tree head. ACPICA BZ 776. + +Example Code and Data Size: These are the sizes for the OS-independent +acpica.lib produced by the Microsoft Visual C++ 6.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: 83.4K Code, 17.5K Data, 100.9K Total + Debug Version: 158.9K Code, 50.0K Data, 208.9K Total + Current Release: + Non-Debug Version: 84.7K Code, 17.8K Data, 102.5K Total + Debug Version: 160.5K Code, 50.6K Data, 211.1K Total + +2) iASL Compiler/Disassembler and Tools: + +ACPI 4.0: iASL and Disassembler - implemented support for the new IPMI +operation region keyword. ACPICA BZ 771, 772. Lin Ming. + +ACPI 4.0: iASL - implemented compile-time validation support for all new +predefined names and control methods (31 total). ACPICA BZ 769. + +---------------------------------------- +21 May 2009. Summary of changes for version 20090521: 1) ACPI CA Core Subsystem: @@ -74,8 +534,6 @@ after an invalid sub-table ID. ---------------------------------------- 22 April 2009. Summary of changes for version 20090422: -This release is available at www.acpica.org/downloads - 1) ACPI CA Core Subsystem: Fixed a compatibility issue with the recently released I/O port protection @@ -623,9 +1081,6 @@ header. 29 July 2008. Summary of changes for version 20080729: -This release is available at http://acpica.org/downloads -Direct git access via http://www.acpica.org/repos/acpica.git - 1) ACPI CA Core Subsystem: Fix a possible deadlock in the GPE dispatch. Remove call to @@ -715,9 +1170,6 @@ completion message. Previously, no message was displayed in this case. ---------------------------------------- 01 July 2008. Summary of changes for version 20080701: -This release is available at http://acpica.org/downloads -Direct git access via http://www.acpica.org/repos/acpica.git - 0) Git source tree / acpica.org Fixed a problem where a git-clone from http would not transfer the entire diff --git a/sys/contrib/dev/acpica/common/adfile.c b/sys/contrib/dev/acpica/common/adfile.c index ad5e544..d72f369 100644 --- a/sys/contrib/dev/acpica/common/adfile.c +++ b/sys/contrib/dev/acpica/common/adfile.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -119,7 +119,6 @@ #include <contrib/dev/acpica/include/acapps.h> #include <stdio.h> -#include <string.h> #define _COMPONENT ACPI_TOOLS @@ -135,12 +134,13 @@ AdWriteBuffer ( char FilenameBuf[20]; + /****************************************************************************** * * FUNCTION: AfGenerateFilename * - * PARAMETERS: Prefix - prefix string - * TableId - The table ID + * PARAMETERS: Prefix - prefix string + * TableId - The table ID * * RETURN: Pointer to the completed string * @@ -180,9 +180,9 @@ AdGenerateFilename ( * * FUNCTION: AfWriteBuffer * - * PARAMETERS: Filename - name of file - * Buffer - data to write - * Length - length of data + * PARAMETERS: Filename - name of file + * Buffer - data to write + * Length - length of data * * RETURN: Actual number of bytes written * @@ -217,10 +217,10 @@ AdWriteBuffer ( * * FUNCTION: AfWriteTable * - * PARAMETERS: Table - pointer to the ACPI table - * Length - length of the table - * TableName - the table signature - * OemTableID - from the table header + * PARAMETERS: Table - pointer to the ACPI table + * Length - length of the table + * TableName - the table signature + * OemTableID - from the table header * * RETURN: None * @@ -272,7 +272,7 @@ FlGenerateFilename ( * Copy the original filename to a new buffer. Leave room for the worst case * where we append the suffix, an added dot and the null terminator. */ - NewFilename = ACPI_ALLOCATE_ZEROED ( + NewFilename = ACPI_ALLOCATE_ZEROED ((ACPI_SIZE) strlen (InputFilename) + strlen (Suffix) + 2); strcpy (NewFilename, InputFilename); @@ -314,7 +314,7 @@ FlStrdup ( char *NewString; - NewString = ACPI_ALLOCATE (strlen (String) + 1); + NewString = ACPI_ALLOCATE ((ACPI_SIZE) strlen (String) + 1); if (!NewString) { return (NULL); diff --git a/sys/contrib/dev/acpica/common/adisasm.c b/sys/contrib/dev/acpica/common/adisasm.c index 873f42a..fe5ae35 100644 --- a/sys/contrib/dev/acpica/common/adisasm.c +++ b/sys/contrib/dev/acpica/common/adisasm.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -132,14 +132,18 @@ #define _COMPONENT ACPI_TOOLS ACPI_MODULE_NAME ("adisasm") -extern int AslCompilerdebug; + +extern int AslCompilerdebug; +extern char *Gbl_ExternalFilename; + ACPI_STATUS LsDisplayNamespace ( void); void -LsSetupNsList (void * Handle); +LsSetupNsList ( + void *Handle); /* Local prototypes */ @@ -153,14 +157,6 @@ void AdDisassemblerHeader ( char *Filename); -void -AdAddExternalsToNamespace ( - void); - -UINT32 -AdMethodExternalCount ( - void); - ACPI_STATUS AdDeferredParse ( ACPI_PARSE_OBJECT *Op, @@ -171,8 +167,6 @@ ACPI_STATUS AdParseDeferredOps ( ACPI_PARSE_OBJECT *Root); -ACPI_PARSE_OBJECT *AcpiGbl_ParseOpRoot; - /* Stubs for ASL compiler */ @@ -192,7 +186,6 @@ AcpiDsMethodError ( { return (Status); } - #endif ACPI_STATUS @@ -238,18 +231,19 @@ AcpiDsMethodDataInitArgs ( } -ACPI_TABLE_DESC LocalTables[1]; +static ACPI_TABLE_DESC LocalTables[1]; +static ACPI_PARSE_OBJECT *AcpiGbl_ParseOpRoot; /******************************************************************************* * * FUNCTION: AdInitialize * - * PARAMETERS: None. + * PARAMETERS: None * * RETURN: Status * - * DESCRIPTION: CA initialization + * DESCRIPTION: ACPICA and local initialization * ******************************************************************************/ @@ -296,89 +290,15 @@ AdInitialize ( } -/******************************************************************************* - * - * FUNCTION: AdAddExternalsToNamespace - * - * PARAMETERS: - * - * RETURN: None - * - * DESCRIPTION: - * - ******************************************************************************/ - -void -AdAddExternalsToNamespace ( - void) -{ - ACPI_STATUS Status; - ACPI_NAMESPACE_NODE *Node; - ACPI_EXTERNAL_LIST *External = AcpiGbl_ExternalList; - ACPI_OPERAND_OBJECT *MethodDesc; - - - while (External) - { - Status = AcpiNsLookup (NULL, External->InternalPath, External->Type, - ACPI_IMODE_LOAD_PASS1, ACPI_NS_EXTERNAL | ACPI_NS_DONT_OPEN_SCOPE, - NULL, &Node); - - if (External->Type == ACPI_TYPE_METHOD) - { - MethodDesc = AcpiUtCreateInternalObject (ACPI_TYPE_METHOD); - MethodDesc->Method.ParamCount = (UINT8) External->Value; - Node->Object = MethodDesc; - } - - External = External->Next; - } -} - - -/******************************************************************************* - * - * FUNCTION: AdMethodExternalCount - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Return the number of externals that have been generated - * - ******************************************************************************/ - -UINT32 -AdMethodExternalCount ( - void) -{ - ACPI_EXTERNAL_LIST *External = AcpiGbl_ExternalList; - UINT32 Count = 0; - - - while (External) - { - if (External->Type == ACPI_TYPE_METHOD) - { - Count++; - } - - External = External->Next; - } - - return (Count); -} - - /****************************************************************************** * * FUNCTION: AdAmlDisassemble * - * PARAMETERS: Filename - AML input filename - * OutToFile - TRUE if output should go to a file - * Prefix - Path prefix for output - * OutFilename - where the filename is returned - * GetAllTables - TRUE if all tables are desired + * PARAMETERS: Filename - AML input filename + * OutToFile - TRUE if output should go to a file + * Prefix - Path prefix for output + * OutFilename - where the filename is returned + * GetAllTables - TRUE if all tables are desired * * RETURN: Status * @@ -386,8 +306,6 @@ AdMethodExternalCount ( * *****************************************************************************/ -extern char *Gbl_ExternalFilename; - ACPI_STATUS AdAmlDisassemble ( BOOLEAN OutToFile, @@ -403,12 +321,11 @@ AdAmlDisassemble ( ACPI_TABLE_HEADER *Table = NULL; ACPI_TABLE_HEADER *ExternalTable; ACPI_OWNER_ID OwnerId; - ACPI_EXTERNAL_LIST *NextExternal; /* - * Input: AML Code from either a file, - * or via GetTables (memory or registry) + * Input: AML code from either a file or via GetTables (memory or + * registry) */ if (Filename) { @@ -462,13 +379,7 @@ AdAmlDisassemble ( /* Clear external list generated by Scope in external tables */ - while (AcpiGbl_ExternalList) - { - NextExternal = AcpiGbl_ExternalList->Next; - ACPI_FREE (AcpiGbl_ExternalList->Path); - ACPI_FREE (AcpiGbl_ExternalList); - AcpiGbl_ExternalList = NextExternal; - } + AcpiDmClearExternalList (); } } else @@ -501,8 +412,7 @@ AdAmlDisassemble ( } /* - * Output: ASL code. - * Redirect to a file if requested + * Output: ASL code. Redirect to a file if requested */ if (OutToFile) { @@ -589,11 +499,11 @@ AdAmlDisassemble ( * tree with the new information (namely, the number of arguments per * method) */ - if (AdMethodExternalCount ()) + if (AcpiDmGetExternalMethodCount ()) { fprintf (stderr, "\nFound %d external control methods, reparsing with new information\n", - AdMethodExternalCount()); + AcpiDmGetExternalMethodCount ()); /* * Reparse, rebuild namespace. no need to xref namespace @@ -611,7 +521,7 @@ AdAmlDisassemble ( AcpiGbl_RootNodeStruct.Flags = ANOBJ_END_OF_PEER_LIST; Status = AcpiNsRootInitialize (); - AdAddExternalsToNamespace (); + AcpiDmAddExternalsToNamespace (); /* Parse table. No need to reload it, however (FALSE) */ @@ -855,9 +765,9 @@ AdDisplayTables ( * * FUNCTION: AdDeferredParse * - * PARAMETERS: Op - Root Op of the deferred opcode - * Aml - Pointer to the raw AML - * AmlLength - Length of the AML + * PARAMETERS: Op - Root Op of the deferred opcode + * Aml - Pointer to the raw AML + * AmlLength - Length of the AML * * RETURN: Status * @@ -981,7 +891,7 @@ AdDeferredParse ( * * FUNCTION: AdParseDeferredOps * - * PARAMETERS: Root - Root of the parse tree + * PARAMETERS: Root - Root of the parse tree * * RETURN: Status * @@ -1055,8 +965,8 @@ AdParseDeferredOps ( * * FUNCTION: AdGetLocalTables * - * PARAMETERS: Filename - Not used - * GetAllTables - TRUE if all tables are desired + * PARAMETERS: Filename - Not used + * GetAllTables - TRUE if all tables are desired * * RETURN: Status * @@ -1138,6 +1048,11 @@ AdGetLocalTables ( Status = AcpiTbStoreTable (0, NewTable, NewTable->Length, 0, &TableIndex); + if (ACPI_FAILURE (Status)) + { + fprintf (stderr, "Could not store DSDT\n"); + return AE_NO_ACPI_TABLES; + } } else { @@ -1169,10 +1084,10 @@ AdGetLocalTables ( * * FUNCTION: AdParseTable * - * PARAMETERS: Table - Pointer to the raw table - * OwnerId - Returned OwnerId of the table - * LoadTable - If add table to the global table list - * External - If this is an external table + * PARAMETERS: Table - Pointer to the raw table + * OwnerId - Returned OwnerId of the table + * LoadTable - If add table to the global table list + * External - If this is an external table * * RETURN: Status * diff --git a/sys/contrib/dev/acpica/common/adwalk.c b/sys/contrib/dev/acpica/common/adwalk.c index a260cc5..6bb4be5 100644 --- a/sys/contrib/dev/acpica/common/adwalk.c +++ b/sys/contrib/dev/acpica/common/adwalk.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -118,7 +118,6 @@ #include <contrib/dev/acpica/include/accommon.h> #include <contrib/dev/acpica/include/acparser.h> #include <contrib/dev/acpica/include/amlcode.h> -#include <contrib/dev/acpica/include/acdebug.h> #include <contrib/dev/acpica/include/acdisasm.h> #include <contrib/dev/acpica/include/acdispat.h> #include <contrib/dev/acpica/include/acnamesp.h> @@ -184,7 +183,7 @@ AcpiDmResourceDescendingOp ( * * FUNCTION: AcpiDmDumpTree * - * PARAMETERS: Origin - Starting object + * PARAMETERS: Origin - Starting object * * RETURN: None * @@ -218,7 +217,7 @@ AcpiDmDumpTree ( * * FUNCTION: AcpiDmFindOrphanMethods * - * PARAMETERS: Origin - Starting object + * PARAMETERS: Origin - Starting object * * RETURN: None * @@ -426,7 +425,6 @@ AcpiDmDumpDescending ( void *Context) { ACPI_OP_WALK_INFO *Info = Context; - const ACPI_OPCODE_INFO *OpInfo; char *Path; @@ -435,11 +433,9 @@ AcpiDmDumpDescending ( return (AE_OK); } - OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - Info->Count++; - /* Most of the information (count, level, name) here */ + Info->Count++; AcpiOsPrintf ("% 5d [%2.2d] ", Info->Count, Level); AcpiDmIndent (Level); AcpiOsPrintf ("%-28s", AcpiPsGetOpcodeName (Op->Common.AmlOpcode)); @@ -472,7 +468,7 @@ AcpiDmDumpDescending ( case AML_METHOD_OP: case AML_DEVICE_OP: case AML_INT_NAMEDFIELD_OP: - AcpiOsPrintf ("%4.4s", &Op->Named.Name); + AcpiOsPrintf ("%4.4s", ACPI_CAST_PTR (char, &Op->Named.Name)); break; default: @@ -536,7 +532,7 @@ AcpiDmFindOrphanDescending ( { /* This NamePath has no args, assume it is an integer */ - AcpiDmAddToExternalList (ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, 0); + AcpiDmAddToExternalList (ChildOp, ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, 0); return (AE_OK); } @@ -547,11 +543,11 @@ AcpiDmFindOrphanDescending ( { /* One Arg means this is just a Store(Name,Target) */ - AcpiDmAddToExternalList (ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, 0); + AcpiDmAddToExternalList (ChildOp, ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, 0); return (AE_OK); } - AcpiDmAddToExternalList (ChildOp->Common.Value.String, ACPI_TYPE_METHOD, ArgCount); + AcpiDmAddToExternalList (ChildOp, ChildOp->Common.Value.String, ACPI_TYPE_METHOD, ArgCount); } break; #endif @@ -567,7 +563,7 @@ AcpiDmFindOrphanDescending ( { /* This NamePath has no args, assume it is an integer */ - AcpiDmAddToExternalList (ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, 0); + AcpiDmAddToExternalList (ChildOp, ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, 0); return (AE_OK); } @@ -576,11 +572,11 @@ AcpiDmFindOrphanDescending ( { /* One Arg means this is just a Store(Name,Target) */ - AcpiDmAddToExternalList (ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, 0); + AcpiDmAddToExternalList (ChildOp, ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, 0); return (AE_OK); } - AcpiDmAddToExternalList (ChildOp->Common.Value.String, ACPI_TYPE_METHOD, ArgCount); + AcpiDmAddToExternalList (ChildOp, ChildOp->Common.Value.String, ACPI_TYPE_METHOD, ArgCount); } break; @@ -611,7 +607,7 @@ AcpiDmFindOrphanDescending ( /* And namepath is the first argument */ (ParentOp->Common.Value.Arg == Op)) { - AcpiDmAddToExternalList (Op->Common.Value.String, ACPI_TYPE_INTEGER, 0); + AcpiDmAddToExternalList (Op, Op->Common.Value.String, ACPI_TYPE_INTEGER, 0); break; } } @@ -621,7 +617,7 @@ AcpiDmFindOrphanDescending ( * operator) - it *must* be a method invocation, nothing else is * grammatically possible. */ - AcpiDmAddToExternalList (Op->Common.Value.String, ACPI_TYPE_METHOD, ArgCount); + AcpiDmAddToExternalList (Op, Op->Common.Value.String, ACPI_TYPE_METHOD, ArgCount); } break; @@ -858,7 +854,7 @@ AcpiDmXrefDescendingOp ( { if (Status == AE_NOT_FOUND) { - AcpiDmAddToExternalList (Path, (UINT8) ObjectType, 0); + AcpiDmAddToExternalList (Op, Path, (UINT8) ObjectType, 0); /* * We could install this into the namespace, but we catch duplicate @@ -888,12 +884,12 @@ AcpiDmXrefDescendingOp ( if (ObjectType2 == ACPI_TYPE_METHOD) { - AcpiDmAddToExternalList (Path, ACPI_TYPE_METHOD, + AcpiDmAddToExternalList (Op, Path, ACPI_TYPE_METHOD, Object->Method.ParamCount); } else { - AcpiDmAddToExternalList (Path, (UINT8) ObjectType2, 0); + AcpiDmAddToExternalList (Op, Path, (UINT8) ObjectType2, 0); } Op->Common.Node = Node; diff --git a/sys/contrib/dev/acpica/common/dmextern.c b/sys/contrib/dev/acpica/common/dmextern.c new file mode 100644 index 0000000..943a3c2 --- /dev/null +++ b/sys/contrib/dev/acpica/common/dmextern.c @@ -0,0 +1,646 @@ +/****************************************************************************** + * + * Module Name: dmextern - Support for External() ASL statements + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#include <contrib/dev/acpica/include/acpi.h> +#include <contrib/dev/acpica/include/accommon.h> +#include <contrib/dev/acpica/include/amlcode.h> +#include <contrib/dev/acpica/include/acnamesp.h> +#include <contrib/dev/acpica/include/acdisasm.h> + + +/* + * This module is used for application-level code (iASL disassembler) only. + * + * It contains the code to create and emit any necessary External() ASL + * statements for the module being disassembled. + */ +#define _COMPONENT ACPI_CA_DISASSEMBLER + ACPI_MODULE_NAME ("dmextern") + + +/* + * This table maps ACPI_OBJECT_TYPEs to the corresponding ASL + * ObjectTypeKeyword. Used to generate typed external declarations + */ +static const char *AcpiGbl_DmTypeNames[] = +{ + /* 00 */ "", /* Type ANY */ + /* 01 */ ", IntObj", + /* 02 */ ", StrObj", + /* 03 */ ", BuffObj", + /* 04 */ ", PkgObj", + /* 05 */ ", FieldUnitObj", + /* 06 */ ", DeviceObj", + /* 07 */ ", EventObj", + /* 08 */ ", MethodObj", + /* 09 */ ", MutexObj", + /* 10 */ ", OpRegionObj", + /* 11 */ ", PowerResObj", + /* 12 */ ", ProcessorObj", + /* 13 */ ", ThermalZoneObj", + /* 14 */ ", BuffFieldObj", + /* 15 */ ", DDBHandleObj", + /* 16 */ "", /* Debug object */ + /* 17 */ ", FieldUnitObj", + /* 18 */ ", FieldUnitObj", + /* 19 */ ", FieldUnitObj" +}; + + +/* Local prototypes */ + +static const char * +AcpiDmGetObjectTypeName ( + ACPI_OBJECT_TYPE Type); + +static char * +AcpiDmNormalizeParentPrefix ( + ACPI_PARSE_OBJECT *Op, + char *Path); + + +/******************************************************************************* + * + * FUNCTION: AcpiDmGetObjectTypeName + * + * PARAMETERS: Type - An ACPI_OBJECT_TYPE + * + * RETURN: Pointer to a string + * + * DESCRIPTION: Map an object type to the ASL object type string. + * + ******************************************************************************/ + +static const char * +AcpiDmGetObjectTypeName ( + ACPI_OBJECT_TYPE Type) +{ + + if (Type == ACPI_TYPE_LOCAL_SCOPE) + { + Type = ACPI_TYPE_DEVICE; + } + + else if (Type > ACPI_TYPE_LOCAL_INDEX_FIELD) + { + return (""); + } + + return (AcpiGbl_DmTypeNames[Type]); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmNormalizeParentPrefix + * + * PARAMETERS: Op - Parse op + * Path - Path with parent prefix + * + * RETURN: The full pathname to the object (from the namespace root) + * + * DESCRIPTION: Returns the full pathname of a path with parent prefix + * The caller must free the fullpath returned. + * + ******************************************************************************/ + +static char * +AcpiDmNormalizeParentPrefix ( + ACPI_PARSE_OBJECT *Op, + char *Path) +{ + ACPI_NAMESPACE_NODE *Node; + char *Fullpath; + char *ParentPath; + ACPI_SIZE Length; + + + /* Search upwards in the parse tree until we reach a namespace node */ + + while (Op) + { + if (Op->Common.Node) + { + break; + } + + Op = Op->Common.Parent; + } + + if (!Op) + { + return (NULL); + } + + /* + * Find the actual parent node for the reference: + * Remove all carat prefixes from the input path. + * There may be multiple parent prefixes (For example, ^^^M000) + */ + Node = Op->Common.Node; + while (Node && (*Path == (UINT8) AML_PARENT_PREFIX)) + { + Node = AcpiNsGetParentNode (Node); + Path++; + } + + if (!Node) + { + return (NULL); + } + + /* Get the full pathname for the parent node */ + + ParentPath = AcpiNsGetExternalPathname (Node); + if (!ParentPath) + { + return (NULL); + } + + Length = (ACPI_STRLEN (ParentPath) + ACPI_STRLEN (Path) + 1); + Fullpath = ACPI_ALLOCATE_ZEROED (Length); + if (!Fullpath) + { + goto Cleanup; + } + + /* + * Concatenate parent fullpath and path. For example, + * parent fullpath "\_SB_", Path "^INIT", Fullpath "\_SB_.INIT" + * + * Copy the parent path + */ + ACPI_STRCAT (Fullpath, ParentPath); + + /* Add dot separator (don't need dot if parent fullpath is a single "\") */ + + if (ParentPath[1]) + { + ACPI_STRCAT (Fullpath, "."); + } + + /* Copy child path (carat parent prefix(es) were skipped above) */ + + ACPI_STRCAT (Fullpath, Path); + +Cleanup: + ACPI_FREE (ParentPath); + return (Fullpath); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmAddToExternalList + * + * PARAMETERS: Op - Current parser Op + * Path - Internal (AML) path to the object + * Type - ACPI object type to be added + * Value - Arg count if adding a Method object + * + * RETURN: None + * + * DESCRIPTION: Insert a new name into the global list of Externals which + * will in turn be later emitted as an External() declaration + * in the disassembled output. + * + ******************************************************************************/ + +void +AcpiDmAddToExternalList ( + ACPI_PARSE_OBJECT *Op, + char *Path, + UINT8 Type, + UINT32 Value) +{ + char *ExternalPath; + char *Fullpath = NULL; + ACPI_EXTERNAL_LIST *NewExternal; + ACPI_EXTERNAL_LIST *NextExternal; + ACPI_EXTERNAL_LIST *PrevExternal = NULL; + ACPI_STATUS Status; + + + if (!Path) + { + return; + } + + /* Externalize the ACPI path */ + + Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, Path, + NULL, &ExternalPath); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Get the full pathname from root if "Path" has a parent prefix */ + + if (*Path == (UINT8) AML_PARENT_PREFIX) + { + Fullpath = AcpiDmNormalizeParentPrefix (Op, ExternalPath); + if (Fullpath) + { + /* Set new external path */ + + ACPI_FREE (ExternalPath); + ExternalPath = Fullpath; + } + } + + /* Check all existing externals to ensure no duplicates */ + + NextExternal = AcpiGbl_ExternalList; + while (NextExternal) + { + if (!ACPI_STRCMP (ExternalPath, NextExternal->Path)) + { + /* Duplicate method, check that the Value (ArgCount) is the same */ + + if ((NextExternal->Type == ACPI_TYPE_METHOD) && + (NextExternal->Value != Value)) + { + ACPI_ERROR ((AE_INFO, + "Argument count mismatch for method %s %d %d", + NextExternal->Path, NextExternal->Value, Value)); + } + + /* Allow upgrade of type from ANY */ + + else if (NextExternal->Type == ACPI_TYPE_ANY) + { + NextExternal->Type = Type; + NextExternal->Value = Value; + } + + ACPI_FREE (ExternalPath); + return; + } + + NextExternal = NextExternal->Next; + } + + /* Allocate and init a new External() descriptor */ + + NewExternal = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EXTERNAL_LIST)); + if (!NewExternal) + { + ACPI_FREE (ExternalPath); + return; + } + + NewExternal->Path = ExternalPath; + NewExternal->Type = Type; + NewExternal->Value = Value; + NewExternal->Length = (UINT16) ACPI_STRLEN (ExternalPath); + + /* Was the external path with parent prefix normalized to a fullpath? */ + + if (Fullpath == ExternalPath) + { + /* Get new internal path */ + + Status = AcpiNsInternalizeName (ExternalPath, &Path); + if (ACPI_FAILURE (Status)) + { + ACPI_FREE (ExternalPath); + ACPI_FREE (NewExternal); + return; + } + + /* Set flag to indicate External->InternalPath need to be freed */ + + NewExternal->Flags |= ACPI_IPATH_ALLOCATED; + } + + NewExternal->InternalPath = Path; + + /* Link the new descriptor into the global list, ordered by string length */ + + NextExternal = AcpiGbl_ExternalList; + while (NextExternal) + { + if (NewExternal->Length <= NextExternal->Length) + { + if (PrevExternal) + { + PrevExternal->Next = NewExternal; + } + else + { + AcpiGbl_ExternalList = NewExternal; + } + + NewExternal->Next = NextExternal; + return; + } + + PrevExternal = NextExternal; + NextExternal = NextExternal->Next; + } + + if (PrevExternal) + { + PrevExternal->Next = NewExternal; + } + else + { + AcpiGbl_ExternalList = NewExternal; + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmAddExternalsToNamespace + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Add all externals to the namespace. Allows externals to be + * "resolved". + * + ******************************************************************************/ + +void +AcpiDmAddExternalsToNamespace ( + void) +{ + ACPI_STATUS Status; + ACPI_NAMESPACE_NODE *Node; + ACPI_OPERAND_OBJECT *MethodDesc; + ACPI_EXTERNAL_LIST *External = AcpiGbl_ExternalList; + + + while (External) + { + /* Add the external name (object) into the namespace */ + + Status = AcpiNsLookup (NULL, External->InternalPath, External->Type, + ACPI_IMODE_LOAD_PASS1, + ACPI_NS_EXTERNAL | ACPI_NS_DONT_OPEN_SCOPE, + NULL, &Node); + + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, Status, + "while adding external to namespace [%s]", + External->Path)); + } + else if (External->Type == ACPI_TYPE_METHOD) + { + /* For methods, we need to save the argument count */ + + MethodDesc = AcpiUtCreateInternalObject (ACPI_TYPE_METHOD); + MethodDesc->Method.ParamCount = (UINT8) External->Value; + Node->Object = MethodDesc; + } + + External = External->Next; + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmGetExternalMethodCount + * + * PARAMETERS: None + * + * RETURN: The number of control method externals in the external list + * + * DESCRIPTION: Return the number of method externals that have been generated. + * If any control method externals have been found, we must + * re-parse the entire definition block with the new information + * (number of arguments for the methods.) This is limitation of + * AML, we don't know the number of arguments from the control + * method invocation itself. + * + ******************************************************************************/ + +UINT32 +AcpiDmGetExternalMethodCount ( + void) +{ + ACPI_EXTERNAL_LIST *External = AcpiGbl_ExternalList; + UINT32 Count = 0; + + + while (External) + { + if (External->Type == ACPI_TYPE_METHOD) + { + Count++; + } + + External = External->Next; + } + + return (Count); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmClearExternalList + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Free the entire External info list + * + ******************************************************************************/ + +void +AcpiDmClearExternalList ( + void) +{ + ACPI_EXTERNAL_LIST *NextExternal; + + + while (AcpiGbl_ExternalList) + { + NextExternal = AcpiGbl_ExternalList->Next; + ACPI_FREE (AcpiGbl_ExternalList->Path); + ACPI_FREE (AcpiGbl_ExternalList); + AcpiGbl_ExternalList = NextExternal; + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmEmitExternals + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Emit an External() ASL statement for each of the externals in + * the global external info list. + * + ******************************************************************************/ + +void +AcpiDmEmitExternals ( + void) +{ + ACPI_EXTERNAL_LIST *NextExternal; + + + if (!AcpiGbl_ExternalList) + { + return; + } + + /* + * Walk the list of externals (unresolved references) + * found during the AML parsing + */ + while (AcpiGbl_ExternalList) + { + AcpiOsPrintf (" External (%s%s", + AcpiGbl_ExternalList->Path, + AcpiDmGetObjectTypeName (AcpiGbl_ExternalList->Type)); + + if (AcpiGbl_ExternalList->Type == ACPI_TYPE_METHOD) + { + AcpiOsPrintf (") // %d Arguments\n", + AcpiGbl_ExternalList->Value); + } + else + { + AcpiOsPrintf (")\n"); + } + + /* Free this external info block and move on to next external */ + + NextExternal = AcpiGbl_ExternalList->Next; + if (AcpiGbl_ExternalList->Flags & ACPI_IPATH_ALLOCATED) + { + ACPI_FREE (AcpiGbl_ExternalList->InternalPath); + } + + ACPI_FREE (AcpiGbl_ExternalList->Path); + ACPI_FREE (AcpiGbl_ExternalList); + AcpiGbl_ExternalList = NextExternal; + } + + AcpiOsPrintf ("\n"); +} + diff --git a/sys/contrib/dev/acpica/common/dmrestag.c b/sys/contrib/dev/acpica/common/dmrestag.c index 59a11be..4abbf53 100644 --- a/sys/contrib/dev/acpica/common/dmrestag.c +++ b/sys/contrib/dev/acpica/common/dmrestag.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -387,7 +387,7 @@ static ACPI_RESOURCE_TAG *AcpiGbl_ResourceTags [] = static UINT32 AcpiGbl_NextResourceId = 0; static UINT8 AcpiGbl_NextPrefix = 0; -static UINT8 AcpiGbl_Prefix[ACPI_NUM_RES_PREFIX] = +static char AcpiGbl_Prefix[ACPI_NUM_RES_PREFIX] = {'Y','Z','J','K','X'}; diff --git a/sys/contrib/dev/acpica/common/dmtable.c b/sys/contrib/dev/acpica/common/dmtable.c index d0b26f2..7085891 100644 --- a/sys/contrib/dev/acpica/common/dmtable.c +++ b/sys/contrib/dev/acpica/common/dmtable.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -132,6 +132,7 @@ AcpiDmGetTableData ( static void AcpiDmCheckAscii ( UINT8 *Target, + char *RepairedName, UINT32 Count); UINT8 @@ -156,17 +157,18 @@ static const char *AcpiDmDmarSubnames[] = "Hardware Unit Definition", "Reserved Memory Region", "Root Port ATS Capability", + "Remapping Hardware Static Affinity", "Unknown SubTable Type" /* Reserved */ }; static const char *AcpiDmHestSubnames[] = { - "XPF Machine Check Exception", - "XPF Corrected Machine Check", - "NOT USED???", - "XPF Non-Maskable Interrupt", - "IPF Corrected Machine Check", - "IPF Corrected Platform Error", + "IA-32 Machine Check Exception", + "IA-32 Corrected Machine Check", + "IA-32 Non-Maskable Interrupt", + "Unknown SubTable Type", /* 3 - Reserved */ + "Unknown SubTable Type", /* 4 - Reserved */ + "Unknown SubTable Type", /* 5 - Reserved */ "PCI Express Root Port AER", "PCI Express AER (AER Endpoint)", "PCI Express/PCI-X Bridge AER", @@ -208,6 +210,13 @@ static const char *AcpiDmSratSubnames[] = "Unknown SubTable Type" /* Reserved */ }; +static const char *AcpiDmIvrsSubnames[] = +{ + "Hardware Definition Block", + "Memory Definition Block", + "Unknown SubTable Type" /* Reserved */ +}; + #define ACPI_FADT_PM_RESERVED 8 @@ -224,11 +233,12 @@ static const char *AcpiDmFadtProfiles[] = "Unknown Profile Type" }; - /******************************************************************************* * * ACPI Table Data, indexed by signature. * + * Each entry contains: Signature, Table Info, Handler, Description + * * Simple tables have only a TableInfo structure, complex tables have a handler. * This table must be NULL terminated. RSDP and FACS are special-cased * elsewhere. @@ -249,8 +259,10 @@ static ACPI_DMTABLE_DATA AcpiDmTableData[] = {ACPI_SIG_FADT, NULL, AcpiDmDumpFadt, "Fixed ACPI Description Table"}, {ACPI_SIG_HEST, NULL, AcpiDmDumpHest, "Hardware Error Source Table"}, {ACPI_SIG_HPET, AcpiDmTableInfoHpet, NULL, "High Precision Event Timer table"}, + {ACPI_SIG_IVRS, NULL, AcpiDmDumpIvrs, "I/O Virtualization Reporting Structure"}, {ACPI_SIG_MADT, NULL, AcpiDmDumpMadt, "Multiple APIC Description Table"}, {ACPI_SIG_MCFG, NULL, AcpiDmDumpMcfg, "Memory Mapped Configuration table"}, + {ACPI_SIG_MSCT, NULL, AcpiDmDumpMsct, "Maximum System Characteristics Table"}, {ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, "Root System Description Table"}, {ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, "Smart Battery Specification Table"}, {ACPI_SIG_SLIC, AcpiDmTableInfoSlic, NULL, "Software Licensing Description Table"}, @@ -259,6 +271,9 @@ static ACPI_DMTABLE_DATA AcpiDmTableData[] = {ACPI_SIG_SPMI, AcpiDmTableInfoSpmi, NULL, "Server Platform Management Interface table"}, {ACPI_SIG_SRAT, NULL, AcpiDmDumpSrat, "System Resource Affinity Table"}, {ACPI_SIG_TCPA, AcpiDmTableInfoTcpa, NULL, "Trusted Computing Platform Alliance table"}, + {ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, "UEFI Boot Optimization Table"}, + {ACPI_SIG_WAET, AcpiDmTableInfoWaet, NULL, "Windows ACPI Emulated Devices Table"}, + {ACPI_SIG_WDAT, NULL, AcpiDmDumpWdat, "Watchdog Action Table"}, {ACPI_SIG_WDRT, AcpiDmTableInfoWdrt, NULL, "Watchdog Resource Table"}, {ACPI_SIG_XSDT, NULL, AcpiDmDumpXsdt, "Extended System Description Table"}, {NULL, NULL, NULL, NULL} @@ -511,7 +526,9 @@ AcpiDmDumpTable ( UINT8 Temp8; UINT16 Temp16; ACPI_DMTABLE_DATA *TableData; + const char *Name; BOOLEAN LastOutputBlankLine = FALSE; + char RepairedName[8]; if (!Info) @@ -547,6 +564,7 @@ AcpiDmDumpTable ( case ACPI_DMT_UINT8: case ACPI_DMT_CHKSUM: case ACPI_DMT_SPACEID: + case ACPI_DMT_IVRS: case ACPI_DMT_MADT: case ACPI_DMT_SRAT: case ACPI_DMT_ASF: @@ -577,6 +595,9 @@ AcpiDmDumpTable ( case ACPI_DMT_NAME8: ByteLength = 8; break; + case ACPI_DMT_BUF16: + ByteLength = 16; + break; case ACPI_DMT_STRING: ByteLength = ACPI_STRLEN (ACPI_CAST_PTR (char, Target)) + 1; break; @@ -677,17 +698,28 @@ AcpiDmDumpTable ( ACPI_FORMAT_UINT64 (ACPI_GET64 (Target))); break; + case ACPI_DMT_BUF16: + + /* Buffer of length 16 */ + + for (Temp8 = 0; Temp8 < 16; Temp8++) + { + AcpiOsPrintf ("%2.2X,", Target[Temp8]); + } + AcpiOsPrintf ("\n"); + break; + case ACPI_DMT_STRING: - AcpiOsPrintf ("%s\n", ACPI_CAST_PTR (char, Target)); + AcpiOsPrintf ("\"%s\"\n", ACPI_CAST_PTR (char, Target)); break; /* Fixed length ASCII name fields */ case ACPI_DMT_SIG: - AcpiDmCheckAscii (Target, 4); - AcpiOsPrintf ("\"%4.4s\" ", Target); + AcpiDmCheckAscii (Target, RepairedName, 4); + AcpiOsPrintf ("\"%.4s\" ", RepairedName); TableData = AcpiDmGetTableData (ACPI_CAST_PTR (char, Target)); if (TableData) { @@ -698,20 +730,20 @@ AcpiDmDumpTable ( case ACPI_DMT_NAME4: - AcpiDmCheckAscii (Target, 4); - AcpiOsPrintf ("\"%4.4s\"\n", Target); + AcpiDmCheckAscii (Target, RepairedName, 4); + AcpiOsPrintf ("\"%.4s\"\n", RepairedName); break; case ACPI_DMT_NAME6: - AcpiDmCheckAscii (Target, 6); - AcpiOsPrintf ("\"%6.6s\"\n", Target); + AcpiDmCheckAscii (Target, RepairedName, 6); + AcpiOsPrintf ("\"%.6s\"\n", RepairedName); break; case ACPI_DMT_NAME8: - AcpiDmCheckAscii (Target, 8); - AcpiOsPrintf ("\"%8.8s\"\n", Target); + AcpiDmCheckAscii (Target, RepairedName, 8); + AcpiOsPrintf ("\"%.8s\"\n", RepairedName); break; /* Special Data Types */ @@ -742,8 +774,8 @@ AcpiDmDumpTable ( /* Generic Address Structure */ AcpiOsPrintf ("<Generic Address Structure>\n"); - AcpiDmDumpTable (ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length, - CurrentOffset, Target, sizeof (ACPI_GENERIC_ADDRESS), AcpiDmTableInfoGas); + AcpiDmDumpTable (TableLength, CurrentOffset, Target, + sizeof (ACPI_GENERIC_ADDRESS), AcpiDmTableInfoGas); AcpiOsPrintf ("\n"); LastOutputBlankLine = TRUE; break; @@ -790,8 +822,8 @@ AcpiDmDumpTable ( case ACPI_DMT_HESTNTFY: AcpiOsPrintf ("<Hardware Error Notification Structure>\n"); - AcpiDmDumpTable (ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length, - CurrentOffset, Target, sizeof (ACPI_HEST_NOTIFY), AcpiDmTableInfoHestNotify); + AcpiDmDumpTable (TableLength, CurrentOffset, Target, + sizeof (ACPI_HEST_NOTIFY), AcpiDmTableInfoHestNotify); AcpiOsPrintf ("\n"); LastOutputBlankLine = TRUE; break; @@ -849,6 +881,31 @@ AcpiDmDumpTable ( AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmFadtProfiles[Temp8]); break; + case ACPI_DMT_IVRS: + + /* IVRS subtable types */ + + Temp8 = *Target; + switch (Temp8) + { + case ACPI_IVRS_TYPE_HARDWARE: + Name = AcpiDmIvrsSubnames[0]; + break; + + case ACPI_IVRS_TYPE_MEMORY1: + case ACPI_IVRS_TYPE_MEMORY2: + case ACPI_IVRS_TYPE_MEMORY3: + Name = AcpiDmIvrsSubnames[1]; + break; + + default: + Name = AcpiDmIvrsSubnames[2]; + break; + } + + AcpiOsPrintf ("%2.2X <%s>\n", *Target, Name); + break; + case ACPI_DMT_EXIT: return (AE_OK); @@ -888,6 +945,7 @@ AcpiDmDumpTable ( static void AcpiDmCheckAscii ( UINT8 *Name, + char *RepairedName, UINT32 Count) { UINT32 i; @@ -895,9 +953,15 @@ AcpiDmCheckAscii ( for (i = 0; i < Count; i++) { - if (!Name[i] || !isprint (Name[i])) + RepairedName[i] = (char) Name[i]; + + if (!Name[i]) + { + return; + } + if (!isprint (Name[i])) { - Name[i] = ' '; + RepairedName[i] = ' '; } } } diff --git a/sys/contrib/dev/acpica/common/dmtbdump.c b/sys/contrib/dev/acpica/common/dmtbdump.c index 1f9f3cc..2c9725d 100644 --- a/sys/contrib/dev/acpica/common/dmtbdump.c +++ b/sys/contrib/dev/acpica/common/dmtbdump.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -306,6 +306,7 @@ AcpiDmDumpAsf ( UINT32 DataLength = 0; UINT32 DataOffset = 0; UINT32 i; + UINT8 Type; /* No main table, only sub-tables */ @@ -322,7 +323,11 @@ AcpiDmDumpAsf ( return; } - switch (SubTable->Header.Type & 0x7F) /* Mask off top bit */ + /* The actual type is the lower 7 bits of Type */ + + Type = (UINT8) (SubTable->Header.Type & 0x7F); + + switch (Type) { case ACPI_ASF_TYPE_INFO: InfoTable = AcpiDmTableInfoAsf0; @@ -332,8 +337,8 @@ AcpiDmDumpAsf ( InfoTable = AcpiDmTableInfoAsf1; DataInfoTable = AcpiDmTableInfoAsf1a; DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_ALERT)); - DataCount = ((ACPI_ASF_ALERT *) SubTable)->Alerts; - DataLength = ((ACPI_ASF_ALERT *) SubTable)->DataLength; + DataCount = ACPI_CAST_PTR (ACPI_ASF_ALERT, SubTable)->Alerts; + DataLength = ACPI_CAST_PTR (ACPI_ASF_ALERT, SubTable)->DataLength; DataOffset = Offset + sizeof (ACPI_ASF_ALERT); break; @@ -341,8 +346,8 @@ AcpiDmDumpAsf ( InfoTable = AcpiDmTableInfoAsf2; DataInfoTable = AcpiDmTableInfoAsf2a; DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_REMOTE)); - DataCount = ((ACPI_ASF_REMOTE *) SubTable)->Controls; - DataLength = ((ACPI_ASF_REMOTE *) SubTable)->DataLength; + DataCount = ACPI_CAST_PTR (ACPI_ASF_REMOTE, SubTable)->Controls; + DataLength = ACPI_CAST_PTR (ACPI_ASF_REMOTE, SubTable)->DataLength; DataOffset = Offset + sizeof (ACPI_ASF_REMOTE); break; @@ -353,7 +358,7 @@ AcpiDmDumpAsf ( case ACPI_ASF_TYPE_ADDRESS: InfoTable = AcpiDmTableInfoAsf4; DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_ADDRESS)); - DataLength = ((ACPI_ASF_ADDRESS *) SubTable)->Devices; + DataLength = ACPI_CAST_PTR (ACPI_ASF_ADDRESS, SubTable)->Devices; DataOffset = Offset + sizeof (ACPI_ASF_ADDRESS); break; @@ -371,7 +376,7 @@ AcpiDmDumpAsf ( /* Dump variable-length extra data */ - switch (SubTable->Header.Type & 0x7F) /* Mask off top bit */ + switch (Type) { case ACPI_ASF_TYPE_ALERT: case ACPI_ASF_TYPE_CONTROL: @@ -471,7 +476,7 @@ AcpiDmDumpCpep ( { AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTable->Length, AcpiDmTableInfoCpep0); + SubTable->Header.Length, AcpiDmTableInfoCpep0); if (ACPI_FAILURE (Status)) { return; @@ -479,8 +484,9 @@ AcpiDmDumpCpep ( /* Point to next sub-table */ - Offset += SubTable->Length; - SubTable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, SubTable, SubTable->Length); + Offset += SubTable->Header.Length; + SubTable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, SubTable, + SubTable->Header.Length); } } @@ -550,6 +556,10 @@ AcpiDmDumpDmar ( InfoTable = AcpiDmTableInfoDmar2; ScopeOffset = sizeof (ACPI_DMAR_ATSR); break; + case ACPI_DMAR_HARDWARE_AFFINITY: + InfoTable = AcpiDmTableInfoDmar3; + ScopeOffset = sizeof (ACPI_DMAR_RHSA); + break; default: AcpiOsPrintf ("\n**** Unknown DMAR sub-table type %X\n\n", SubTable->Type); return; @@ -737,6 +747,8 @@ AcpiDmDumpHest ( UINT32 Offset = sizeof (ACPI_TABLE_HEST); ACPI_DMTABLE_INFO *InfoTable; UINT32 SubTableLength; + UINT32 BankCount; + ACPI_HEST_IA_ERROR_BANK *BankTable; /* Main table */ @@ -752,31 +764,26 @@ AcpiDmDumpHest ( SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, Table, Offset); while (Offset < Table->Length) { + BankCount = 0; switch (SubTable->Type) { - case ACPI_HEST_TYPE_XPF_MACHINE_CHECK: + case ACPI_HEST_TYPE_IA32_CHECK: InfoTable = AcpiDmTableInfoHest0; - SubTableLength = sizeof (ACPI_HEST_XPF_MACHINE_CHECK); + SubTableLength = sizeof (ACPI_HEST_IA_MACHINE_CHECK); + BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_MACHINE_CHECK, + SubTable))->NumHardwareBanks; break; - case ACPI_HEST_TYPE_XPF_CORRECTED_MACHINE_CHECK: + case ACPI_HEST_TYPE_IA32_CORRECTED_CHECK: InfoTable = AcpiDmTableInfoHest1; - SubTableLength = sizeof (ACPI_HEST_XPF_CORRECTED); - break; - - case ACPI_HEST_TYPE_XPF_NON_MASKABLE_INTERRUPT: - InfoTable = AcpiDmTableInfoHest3; - SubTableLength = sizeof (ACPI_HEST_XPF_NMI); + SubTableLength = sizeof (ACPI_HEST_IA_CORRECTED); + BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_CORRECTED, + SubTable))->NumHardwareBanks; break; - case ACPI_HEST_TYPE_IPF_CORRECTED_MACHINE_CHECK: - InfoTable = AcpiDmTableInfoHest4; - SubTableLength = sizeof (ACPI_HEST_IPF_CORRECTED); - break; - - case ACPI_HEST_TYPE_IPF_CORRECTED_PLATFORM_ERROR: - InfoTable = AcpiDmTableInfoHest5; - SubTableLength = sizeof (ACPI_HEST_IPF_CORRECTED_PLATFORM); + case ACPI_HEST_TYPE_IA32_NMI: + InfoTable = AcpiDmTableInfoHest2; + SubTableLength = sizeof (ACPI_HEST_IA_NMI); break; case ACPI_HEST_TYPE_AER_ROOT_PORT: @@ -794,7 +801,7 @@ AcpiDmDumpHest ( SubTableLength = sizeof (ACPI_HEST_AER_BRIDGE); break; - case ACPI_HEST_TYPE_GENERIC_HARDWARE_ERROR_SOURCE: + case ACPI_HEST_TYPE_GENERIC_ERROR: InfoTable = AcpiDmTableInfoHest9; SubTableLength = sizeof (ACPI_HEST_GENERIC); break; @@ -814,9 +821,34 @@ AcpiDmDumpHest ( return; } - /* Point to next sub-table (each subtable is of fixed length) */ + /* Point to end of current subtable (each subtable above is of fixed length) */ Offset += SubTableLength; + + /* If there are any (fixed-length) Error Banks from above, dump them now */ + + if (BankCount) + { + BankTable = ACPI_ADD_PTR (ACPI_HEST_IA_ERROR_BANK, SubTable, SubTableLength); + SubTableLength += BankCount * sizeof (ACPI_HEST_IA_ERROR_BANK); + + while (BankCount) + { + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Length, Offset, BankTable, + sizeof (ACPI_HEST_IA_ERROR_BANK), AcpiDmTableInfoHestBank); + if (ACPI_FAILURE (Status)) + { + return; + } + Offset += sizeof (ACPI_HEST_IA_ERROR_BANK); + BankTable++; + BankCount--; + } + } + + /* Point to next sub-table */ + SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, SubTable, SubTableLength); } } @@ -824,6 +856,179 @@ AcpiDmDumpHest ( /******************************************************************************* * + * FUNCTION: AcpiDmDumpIvrs + * + * PARAMETERS: Table - A IVRS table + * + * RETURN: None + * + * DESCRIPTION: Format the contents of a IVRS + * + ******************************************************************************/ + +static UINT8 EntrySizes[] = {4,8,16,32}; + +void +AcpiDmDumpIvrs ( + ACPI_TABLE_HEADER *Table) +{ + ACPI_STATUS Status; + UINT32 Offset = sizeof (ACPI_TABLE_IVRS); + UINT32 EntryOffset; + UINT32 EntryLength; + UINT32 EntryType; + ACPI_IVRS_DE_HEADER *DeviceEntry; + ACPI_IVRS_HEADER *SubTable; + ACPI_DMTABLE_INFO *InfoTable; + + + /* Main table */ + + Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIvrs); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Sub-tables */ + + SubTable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Table, Offset); + while (Offset < Table->Length) + { + /* Common sub-table header */ + + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, + SubTable->Length, AcpiDmTableInfoIvrsHdr); + if (ACPI_FAILURE (Status)) + { + return; + } + + switch (SubTable->Type) + { + case ACPI_IVRS_TYPE_HARDWARE: + InfoTable = AcpiDmTableInfoIvrs0; + break; + case ACPI_IVRS_TYPE_MEMORY1: + case ACPI_IVRS_TYPE_MEMORY2: + case ACPI_IVRS_TYPE_MEMORY3: + InfoTable = AcpiDmTableInfoIvrs1; + break; + default: + AcpiOsPrintf ("\n**** Unknown IVRS sub-table type %X\n", + SubTable->Type); + + /* Attempt to continue */ + + if (!SubTable->Length) + { + AcpiOsPrintf ("Invalid zero length subtable\n"); + return; + } + goto NextSubTable; + } + + /* Dump the subtable */ + + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, + SubTable->Length, InfoTable); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* The hardware subtable can contain multiple device entries */ + + if (SubTable->Type == ACPI_IVRS_TYPE_HARDWARE) + { + EntryOffset = Offset + sizeof (ACPI_IVRS_HARDWARE); + DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, SubTable, + sizeof (ACPI_IVRS_HARDWARE)); + + while (EntryOffset < (Offset + SubTable->Length)) + { + AcpiOsPrintf ("\n"); + /* + * Upper 2 bits of Type encode the length of the device entry + * + * 00 = 4 byte + * 01 = 8 byte + * 10 = 16 byte - currently no entries defined + * 11 = 32 byte - currently no entries defined + */ + EntryType = DeviceEntry->Type; + EntryLength = EntrySizes [EntryType >> 6]; + + switch (EntryType) + { + /* 4-byte device entries */ + + case ACPI_IVRS_TYPE_PAD4: + case ACPI_IVRS_TYPE_ALL: + case ACPI_IVRS_TYPE_SELECT: + case ACPI_IVRS_TYPE_START: + case ACPI_IVRS_TYPE_END: + + InfoTable = AcpiDmTableInfoIvrs4; + break; + + /* 8-byte entries, type A */ + + case ACPI_IVRS_TYPE_ALIAS_SELECT: + case ACPI_IVRS_TYPE_ALIAS_START: + + InfoTable = AcpiDmTableInfoIvrs8a; + break; + + /* 8-byte entries, type B */ + + case ACPI_IVRS_TYPE_PAD8: + case ACPI_IVRS_TYPE_EXT_SELECT: + case ACPI_IVRS_TYPE_EXT_START: + + InfoTable = AcpiDmTableInfoIvrs8b; + break; + + /* 8-byte entries, type C */ + + case ACPI_IVRS_TYPE_SPECIAL: + + InfoTable = AcpiDmTableInfoIvrs8c; + break; + + default: + InfoTable = AcpiDmTableInfoIvrs4; + AcpiOsPrintf ( + "\n**** Unknown IVRS device entry type/length: " + "%.2X/%X at offset %.4X: (header below)\n", + EntryType, EntryLength, EntryOffset); + break; + } + + /* Dump the Device Entry */ + + Status = AcpiDmDumpTable (Table->Length, EntryOffset, + DeviceEntry, EntryLength, InfoTable); + + EntryOffset += EntryLength; + DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, DeviceEntry, + EntryLength); + } + } + +NextSubTable: + /* Point to next sub-table */ + + Offset += SubTable->Length; + SubTable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, SubTable, SubTable->Length); + } +} + + +/******************************************************************************* + * * FUNCTION: AcpiDmDumpMadt * * PARAMETERS: Table - A MADT table @@ -993,6 +1198,58 @@ AcpiDmDumpMcfg ( /******************************************************************************* * + * FUNCTION: AcpiDmDumpMsct + * + * PARAMETERS: Table - A MSCT table + * + * RETURN: None + * + * DESCRIPTION: Format the contents of a MSCT + * + ******************************************************************************/ + +void +AcpiDmDumpMsct ( + ACPI_TABLE_HEADER *Table) +{ + ACPI_STATUS Status; + UINT32 Offset = sizeof (ACPI_TABLE_MSCT); + ACPI_MSCT_PROXIMITY *SubTable; + + + /* Main table */ + + Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMsct); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Sub-tables */ + + SubTable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Table, Offset); + while (Offset < Table->Length) + { + /* Common sub-table header */ + + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, + sizeof (ACPI_MSCT_PROXIMITY), AcpiDmTableInfoMsct0); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Point to next sub-table */ + + Offset += sizeof (ACPI_MSCT_PROXIMITY); + SubTable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, SubTable, sizeof (ACPI_MSCT_PROXIMITY)); + } +} + + +/******************************************************************************* + * * FUNCTION: AcpiDmDumpSlit * * PARAMETERS: Table - An SLIT @@ -1149,3 +1406,54 @@ NextSubTable: } } + +/******************************************************************************* + * + * FUNCTION: AcpiDmDumpWdat + * + * PARAMETERS: Table - A WDAT table + * + * RETURN: None + * + * DESCRIPTION: Format the contents of a WDAT + * + ******************************************************************************/ + +void +AcpiDmDumpWdat ( + ACPI_TABLE_HEADER *Table) +{ + ACPI_STATUS Status; + UINT32 Offset = sizeof (ACPI_TABLE_WDAT); + ACPI_WDAT_ENTRY *SubTable; + + + /* Main table */ + + Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoWdat); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Sub-tables */ + + SubTable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, Table, Offset); + while (Offset < Table->Length) + { + /* Common sub-table header */ + + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, + sizeof (ACPI_WDAT_ENTRY), AcpiDmTableInfoWdat0); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Point to next sub-table */ + + Offset += sizeof (ACPI_WDAT_ENTRY); + SubTable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, SubTable, sizeof (ACPI_WDAT_ENTRY)); + } +} diff --git a/sys/contrib/dev/acpica/common/dmtbinfo.c b/sys/contrib/dev/acpica/common/dmtbinfo.c index 796c897..6d3b500 100644 --- a/sys/contrib/dev/acpica/common/dmtbinfo.c +++ b/sys/contrib/dev/acpica/common/dmtbinfo.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -139,14 +139,19 @@ #define ACPI_ERST_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_ERST,f) #define ACPI_HEST_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_HEST,f) #define ACPI_HPET_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_HPET,f) +#define ACPI_IVRS_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_IVRS,f) #define ACPI_MADT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_MADT,f) #define ACPI_MCFG_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_MCFG,f) +#define ACPI_MSCT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_MSCT,f) #define ACPI_SBST_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SBST,f) #define ACPI_SLIT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SLIT,f) #define ACPI_SPCR_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SPCR,f) #define ACPI_SPMI_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SPMI,f) #define ACPI_SRAT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SRAT,f) #define ACPI_TCPA_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_TCPA,f) +#define ACPI_UEFI_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_UEFI,f) +#define ACPI_WAET_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_WAET,f) +#define ACPI_WDAT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_WDAT,f) #define ACPI_WDRT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_WDRT,f) /* Subtables */ @@ -163,17 +168,24 @@ #define ACPI_DMAR0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_DMAR_HARDWARE_UNIT,f) #define ACPI_DMAR1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_DMAR_RESERVED_MEMORY,f) #define ACPI_DMAR2_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_DMAR_ATSR,f) +#define ACPI_DMAR3_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_DMAR_RHSA,f) #define ACPI_EINJ0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_WHEA_HEADER,f) -#define ACPI_HEST0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_XPF_MACHINE_CHECK,f) -#define ACPI_HEST1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_XPF_CORRECTED,f) -#define ACPI_HEST3_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_XPF_NMI,f) -#define ACPI_HEST4_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_IPF_CORRECTED,f) -#define ACPI_HEST5_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_IPF_CORRECTED_PLATFORM,f) +#define ACPI_HEST0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_IA_MACHINE_CHECK,f) +#define ACPI_HEST1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_IA_CORRECTED,f) +#define ACPI_HEST2_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_IA_NMI,f) #define ACPI_HEST6_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_AER_ROOT,f) #define ACPI_HEST7_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_AER,f) #define ACPI_HEST8_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_AER_BRIDGE,f) #define ACPI_HEST9_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_GENERIC,f) #define ACPI_HESTN_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_NOTIFY,f) +#define ACPI_HESTB_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_IA_ERROR_BANK,f) +#define ACPI_IVRSH_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_IVRS_HEADER,f) +#define ACPI_IVRS0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_IVRS_HARDWARE,f) +#define ACPI_IVRS1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_IVRS_MEMORY,f) +#define ACPI_IVRSD_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_IVRS_DE_HEADER,f) +#define ACPI_IVRS8A_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_IVRS_DEVICE8A,f) +#define ACPI_IVRS8B_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_IVRS_DEVICE8B,f) +#define ACPI_IVRS8C_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_IVRS_DEVICE8C,f) #define ACPI_MADT0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_LOCAL_APIC,f) #define ACPI_MADT1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_IO_APIC,f) #define ACPI_MADT2_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_INTERRUPT_OVERRIDE,f) @@ -187,10 +199,12 @@ #define ACPI_MADT10_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_LOCAL_X2APIC_NMI,f) #define ACPI_MADTH_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SUBTABLE_HEADER,f) #define ACPI_MCFG0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MCFG_ALLOCATION,f) +#define ACPI_MSCT0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MSCT_PROXIMITY,f) #define ACPI_SRATH_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SUBTABLE_HEADER,f) #define ACPI_SRAT0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SRAT_CPU_AFFINITY,f) #define ACPI_SRAT1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SRAT_MEM_AFFINITY,f) #define ACPI_SRAT2_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SRAT_X2APIC_CPU_AFFINITY,f) +#define ACPI_WDAT0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_WDAT_ENTRY,f) /* * Simplify access to flag fields by breaking them up into bytes @@ -299,12 +313,16 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoFacs[] = {ACPI_DMT_NAME4, ACPI_FACS_OFFSET (Signature[0]), "Signature"}, {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (Length), "Length"}, {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (HardwareSignature), "Hardware Signature"}, - {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (FirmwareWakingVector), "Firmware Waking Vector(32)"}, + {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (FirmwareWakingVector), "32 Firmware Waking Vector"}, {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (GlobalLock), "Global Lock"}, {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (Flags), "Flags (decoded below)"}, {ACPI_DMT_FLAG0, ACPI_FACS_FLAG_OFFSET (Flags,0), "S4BIOS Support Present"}, - {ACPI_DMT_UINT64, ACPI_FACS_OFFSET (XFirmwareWakingVector), "Firmware Waking Vector(64)"}, + {ACPI_DMT_FLAG1, ACPI_FACS_FLAG_OFFSET (Flags,0), "64-bit Wake Supported (V2)"}, + {ACPI_DMT_UINT64, ACPI_FACS_OFFSET (XFirmwareWakingVector), "64 Firmware Waking Vector"}, {ACPI_DMT_UINT8, ACPI_FACS_OFFSET (Version), "Version"}, + {ACPI_DMT_UINT24, ACPI_FACS_OFFSET (Reserved[0]), "Reserved"}, + {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (OspmFlags), "OspmFlags (decoded below)"}, + {ACPI_DMT_FLAG0, ACPI_FACS_FLAG_OFFSET (OspmFlags,0), "64-bit Wake Env Required (V2)"}, {ACPI_DMT_EXIT, 0, NULL} }; @@ -454,9 +472,9 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoAsfHdr[] = ACPI_DMTABLE_INFO AcpiDmTableInfoAsf0[] = { {ACPI_DMT_UINT8, ACPI_ASF0_OFFSET (MinResetValue), "Minimum Reset Value"}, - {ACPI_DMT_UINT8, ACPI_ASF0_OFFSET (MinResetValue), "Minimum Polling Interval"}, + {ACPI_DMT_UINT8, ACPI_ASF0_OFFSET (MinPollInterval), "Minimum Polling Interval"}, {ACPI_DMT_UINT16, ACPI_ASF0_OFFSET (SystemId), "System ID"}, - {ACPI_DMT_UINT32, ACPI_ASF0_OFFSET (SystemId), "Manufacturer ID"}, + {ACPI_DMT_UINT32, ACPI_ASF0_OFFSET (MfgId), "Manufacturer ID"}, {ACPI_DMT_UINT8, ACPI_ASF0_OFFSET (Flags), "Flags"}, {ACPI_DMT_UINT24, ACPI_ASF0_OFFSET (Reserved2[0]), "Reserved"}, {ACPI_DMT_EXIT, 0, NULL} @@ -579,8 +597,8 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoCpep[] = ACPI_DMTABLE_INFO AcpiDmTableInfoCpep0[] = { - {ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Type), "Subtable Type"}, - {ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Length), "Length"}, + {ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Header.Type), "Subtable Type"}, + {ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Header.Length), "Length"}, {ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Id), "Processor ID"}, {ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Eid), "Processor EID"}, {ACPI_DMT_UINT32, ACPI_CPEP0_OFFSET (Interval), "Polling Interval"}, @@ -671,6 +689,16 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoDmar2[] = {ACPI_DMT_EXIT, 0, NULL} }; +/* 3: Remapping Hardware Static Affinity Structure */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoDmar3[] = +{ + {ACPI_DMT_UINT32, ACPI_DMAR3_OFFSET (Reserved), "Reserved"}, + {ACPI_DMT_UINT64, ACPI_DMAR3_OFFSET (BaseAddress), "Base Address"}, + {ACPI_DMT_UINT32, ACPI_DMAR3_OFFSET (ProximityDomain), "Proximity Domain"}, + {ACPI_DMT_EXIT, 0, NULL} +}; + /******************************************************************************* * @@ -698,7 +726,8 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoEcdt[] = ACPI_DMTABLE_INFO AcpiDmTableInfoEinj[] = { {ACPI_DMT_UINT32, ACPI_EINJ_OFFSET (HeaderLength), "Injection Header Length"}, - {ACPI_DMT_UINT32, ACPI_EINJ_OFFSET (Reserved), "Reserved"}, + {ACPI_DMT_UINT8, ACPI_EINJ_OFFSET (Flags), "Flags"}, + {ACPI_DMT_UINT24, ACPI_EINJ_OFFSET (Reserved[0]), "Reserved"}, {ACPI_DMT_UINT32, ACPI_EINJ_OFFSET (Entries), "Injection Entry Count"}, {ACPI_DMT_EXIT, 0, NULL} }; @@ -743,97 +772,84 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoHest[] = {ACPI_DMT_EXIT, 0, NULL} }; +/* Common HEST structures for subtables */ + +#define ACPI_DM_HEST_HEADER \ + {ACPI_DMT_HEST, ACPI_HEST0_OFFSET (Header.Type), "Subtable Type"}, \ + {ACPI_DMT_UINT16, ACPI_HEST0_OFFSET (Header.SourceId), "Source Id"} + +#define ACPI_DM_HEST_AER \ + {ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.Reserved1), "Reserved"}, \ + {ACPI_DMT_UINT8, ACPI_HEST6_OFFSET (Aer.Flags), "Flags"}, \ + {ACPI_DMT_UINT8, ACPI_HEST6_OFFSET (Aer.Enabled), "Enabled"}, \ + {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.RecordsToPreallocate), "Records To Preallocate"}, \ + {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.MaxSectionsPerRecord), "Max Sections Per Record"}, \ + {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.Bus), "Bus"}, \ + {ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.Device), "Device"}, \ + {ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.Function), "Function"}, \ + {ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.DeviceControl), "DeviceControl"}, \ + {ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.Reserved2), "Reserved"}, \ + {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.UncorrectableMask), "Uncorrectable Mask"}, \ + {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.UncorrectableSeverity), "Uncorrectable Severity"}, \ + {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.CorrectableMask), "Correctable Mask"}, \ + {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.AdvancedCapabilities), "Advanced Capabilities"} + + /* HEST Subtables */ -/* 0: XPF Machine Check Exception */ +/* 0: IA32 Machine Check Exception */ ACPI_DMTABLE_INFO AcpiDmTableInfoHest0[] = { - {ACPI_DMT_HEST, ACPI_HEST0_OFFSET (Header.Type), "Subtable Type"}, - {ACPI_DMT_UINT16, ACPI_HEST0_OFFSET (SourceId), "Source Id"}, - {ACPI_DMT_UINT16, ACPI_HEST0_OFFSET (ConfigWriteEnable), "Configuration Write Enable"}, + ACPI_DM_HEST_HEADER, + {ACPI_DMT_UINT16, ACPI_HEST0_OFFSET (Reserved1), "Reserved"}, {ACPI_DMT_UINT8, ACPI_HEST0_OFFSET (Flags), "Flags"}, - {ACPI_DMT_UINT8, ACPI_HEST0_OFFSET (Reserved1), "Reserved"}, - {ACPI_DMT_UINT32, ACPI_HEST0_OFFSET (RecordsToPreAllocate), "Records To Preallocate"}, + {ACPI_DMT_UINT8, ACPI_HEST0_OFFSET (Enabled), "Enabled"}, + {ACPI_DMT_UINT32, ACPI_HEST0_OFFSET (RecordsToPreallocate), "Records To Preallocate"}, {ACPI_DMT_UINT32, ACPI_HEST0_OFFSET (MaxSectionsPerRecord), "Max Sections Per Record"}, {ACPI_DMT_UINT64, ACPI_HEST0_OFFSET (GlobalCapabilityData), "Global Capability Data"}, {ACPI_DMT_UINT64, ACPI_HEST0_OFFSET (GlobalControlData), "Global Control Data"}, {ACPI_DMT_UINT8, ACPI_HEST0_OFFSET (NumHardwareBanks), "Num Hardware Banks"}, - {ACPI_DMT_UINT56, ACPI_HEST0_OFFSET (Reserved2), "Reserved"}, + {ACPI_DMT_UINT56, ACPI_HEST0_OFFSET (Reserved3[0]), "Reserved"}, {ACPI_DMT_EXIT, 0, NULL} }; -/* 1: XPF Corrected Machine Check */ +/* 1: IA32 Corrected Machine Check */ ACPI_DMTABLE_INFO AcpiDmTableInfoHest1[] = { - {ACPI_DMT_HEST, ACPI_HEST1_OFFSET (Header.Type), "Subtable Type"}, - {ACPI_DMT_UINT16, ACPI_HEST1_OFFSET (SourceId), "Source Id"}, - {ACPI_DMT_UINT16, ACPI_HEST1_OFFSET (ConfigWriteEnable), "Configuration Write Enable"}, + ACPI_DM_HEST_HEADER, + {ACPI_DMT_UINT16, ACPI_HEST1_OFFSET (Reserved1), "Reserved"}, {ACPI_DMT_UINT8, ACPI_HEST1_OFFSET (Flags), "Flags"}, {ACPI_DMT_UINT8, ACPI_HEST1_OFFSET (Enabled), "Enabled"}, - {ACPI_DMT_UINT32, ACPI_HEST1_OFFSET (RecordsToPreAllocate), "Records To Preallocate"}, + {ACPI_DMT_UINT32, ACPI_HEST1_OFFSET (RecordsToPreallocate), "Records To Preallocate"}, {ACPI_DMT_UINT32, ACPI_HEST1_OFFSET (MaxSectionsPerRecord), "Max Sections Per Record"}, {ACPI_DMT_HESTNTFY, ACPI_HEST1_OFFSET (Notify), "Notify"}, {ACPI_DMT_UINT8, ACPI_HEST1_OFFSET (NumHardwareBanks), "Num Hardware Banks"}, - {ACPI_DMT_UINT24, ACPI_HEST1_OFFSET (Reserved), "Reserved"}, - {ACPI_DMT_EXIT, 0, NULL} -}; - -/* 3: XPF Non-Maskable Interrupt */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoHest3[] = -{ - {ACPI_DMT_HEST, ACPI_HEST3_OFFSET (Header.Type), "Subtable Type"}, - {ACPI_DMT_UINT16, ACPI_HEST3_OFFSET (SourceId), "Source Id"}, - {ACPI_DMT_UINT32, ACPI_HEST3_OFFSET (Reserved), "Reserved"}, - {ACPI_DMT_UINT32, ACPI_HEST3_OFFSET (RecordsToPreAllocate), "Records To Preallocate"}, - {ACPI_DMT_UINT32, ACPI_HEST3_OFFSET (MaxSectionsPerRecord), "Max Sections Per Record"}, - {ACPI_DMT_UINT32, ACPI_HEST3_OFFSET (MaxRawDataLength), "Max Raw Data Length"}, + {ACPI_DMT_UINT24, ACPI_HEST1_OFFSET (Reserved2[0]), "Reserved"}, {ACPI_DMT_EXIT, 0, NULL} }; -/* 4: IPF Corrected Machine Check */ +/* 2: IA32 Non-Maskable Interrupt */ -ACPI_DMTABLE_INFO AcpiDmTableInfoHest4[] = +ACPI_DMTABLE_INFO AcpiDmTableInfoHest2[] = { - {ACPI_DMT_HEST, ACPI_HEST4_OFFSET (Header.Type), "Subtable Type"}, - {ACPI_DMT_UINT8, ACPI_HEST4_OFFSET (Enabled), "Enabled"}, - {ACPI_DMT_UINT8, ACPI_HEST4_OFFSET (Reserved), "Reserved"}, + ACPI_DM_HEST_HEADER, + {ACPI_DMT_UINT32, ACPI_HEST2_OFFSET (Reserved), "Reserved"}, + {ACPI_DMT_UINT32, ACPI_HEST2_OFFSET (RecordsToPreallocate), "Records To Preallocate"}, + {ACPI_DMT_UINT32, ACPI_HEST2_OFFSET (MaxSectionsPerRecord), "Max Sections Per Record"}, + {ACPI_DMT_UINT32, ACPI_HEST2_OFFSET (MaxRawDataLength), "Max Raw Data Length"}, {ACPI_DMT_EXIT, 0, NULL} }; -/* 5: IPF Corrected Platform Error */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoHest5[] = -{ - {ACPI_DMT_HEST, ACPI_HEST5_OFFSET (Header.Type), "Subtable Type"}, - {ACPI_DMT_UINT8, ACPI_HEST5_OFFSET (Enabled), "Enabled"}, - {ACPI_DMT_UINT8, ACPI_HEST5_OFFSET (Reserved), "Reserved"}, - {ACPI_DMT_EXIT, 0, NULL} -}; /* 6: PCI Express Root Port AER */ ACPI_DMTABLE_INFO AcpiDmTableInfoHest6[] = { - {ACPI_DMT_HEST, ACPI_HEST6_OFFSET (Header.Type), "Subtable Type"}, - {ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.SourceId), "Source Id"}, - {ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.ConfigWriteEnable), "Configuration Write Enable"}, - {ACPI_DMT_UINT8, ACPI_HEST6_OFFSET (Aer.Flags), "Flags"}, - {ACPI_DMT_UINT8, ACPI_HEST6_OFFSET (Aer.Enabled), "Enabled"}, - {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.RecordsToPreAllocate), "Records To Preallocate"}, - {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.MaxSectionsPerRecord), "Max Sections Per Record"}, - {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.Bus), "Bus"}, - {ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.Device), "Device"}, - {ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.Function), "Function"}, - {ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.DeviceControl), "DeviceControl"}, - {ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.Reserved), "Reserved"}, - {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.UncorrectableErrorMask), "Uncorrectable Error Mask"}, - {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.UncorrectableErrorSeverity), "Uncorrectable Error Severity"}, - {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.CorrectableErrorMask), "Correctable Error Mask"}, - {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.AdvancedErrorCapabilities), "Advanced Error Capabilities"}, - {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (RootErrorCommand), "Root Error Command"}, + ACPI_DM_HEST_HEADER, + ACPI_DM_HEST_AER, + {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (RootErrorCommand), "Root Error Command"}, {ACPI_DMT_EXIT, 0, NULL} }; @@ -841,22 +857,8 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoHest6[] = ACPI_DMTABLE_INFO AcpiDmTableInfoHest7[] = { - {ACPI_DMT_HEST, ACPI_HEST6_OFFSET (Header.Type), "Subtable Type"}, - {ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.SourceId), "Source Id"}, - {ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.ConfigWriteEnable), "Configuration Write Enable"}, - {ACPI_DMT_UINT8, ACPI_HEST6_OFFSET (Aer.Flags), "Flags"}, - {ACPI_DMT_UINT8, ACPI_HEST6_OFFSET (Aer.Enabled), "Enabled"}, - {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.RecordsToPreAllocate), "Records To Preallocate"}, - {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.MaxSectionsPerRecord), "Max Sections Per Record"}, - {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.Bus), "Bus"}, - {ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.Device), "Device"}, - {ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.Function), "Function"}, - {ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.DeviceControl), "DeviceControl"}, - {ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.Reserved), "Reserved"}, - {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.UncorrectableErrorMask), "Uncorrectable Error Mask"}, - {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.UncorrectableErrorSeverity), "Uncorrectable Error Severity"}, - {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.CorrectableErrorMask), "Correctable Error Mask"}, - {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.AdvancedErrorCapabilities), "Advanced Error Capabilities"}, + ACPI_DM_HEST_HEADER, + ACPI_DM_HEST_AER, {ACPI_DMT_EXIT, 0, NULL} }; @@ -864,25 +866,11 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoHest7[] = ACPI_DMTABLE_INFO AcpiDmTableInfoHest8[] = { - {ACPI_DMT_HEST, ACPI_HEST6_OFFSET (Header.Type), "Subtable Type"}, - {ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.SourceId), "Source Id"}, - {ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.ConfigWriteEnable), "Configuration Write Enable"}, - {ACPI_DMT_UINT8, ACPI_HEST6_OFFSET (Aer.Flags), "Flags"}, - {ACPI_DMT_UINT8, ACPI_HEST6_OFFSET (Aer.Enabled), "Enabled"}, - {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.RecordsToPreAllocate), "Records To Preallocate"}, - {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.MaxSectionsPerRecord), "Max Sections Per Record"}, - {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.Bus), "Bus"}, - {ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.Device), "Device"}, - {ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.Function), "Function"}, - {ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.DeviceControl), "DeviceControl"}, - {ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.Reserved), "Reserved"}, - {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.UncorrectableErrorMask), "Uncorrectable Error Mask"}, - {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.UncorrectableErrorSeverity), "Uncorrectable Error Severity"}, - {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.CorrectableErrorMask), "Correctable Error Mask"}, - {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.AdvancedErrorCapabilities), "Advanced Error Capabilities"}, - {ACPI_DMT_UINT32, ACPI_HEST8_OFFSET (SecondaryUncorrectableErrorMask), "2nd Uncorrectable Err Mask"}, - {ACPI_DMT_UINT32, ACPI_HEST8_OFFSET (SecondaryUncorrectableErrorSeverity), "2nd Uncorrectable Err Severity"}, - {ACPI_DMT_UINT32, ACPI_HEST8_OFFSET (SecondaryAdvancedCapabilities), "2nd Advanced Capabilities"}, + ACPI_DM_HEST_HEADER, + ACPI_DM_HEST_AER, + {ACPI_DMT_UINT32, ACPI_HEST8_OFFSET (UncorrectableMask2), "2nd Uncorrectable Mask"}, + {ACPI_DMT_UINT32, ACPI_HEST8_OFFSET (UncorrectableSeverity2), "2nd Uncorrectable Severity"}, + {ACPI_DMT_UINT32, ACPI_HEST8_OFFSET (AdvancedCapabilities2), "2nd Advanced Capabilities"}, {ACPI_DMT_EXIT, 0, NULL} }; @@ -890,21 +878,20 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoHest8[] = ACPI_DMTABLE_INFO AcpiDmTableInfoHest9[] = { - {ACPI_DMT_HEST, ACPI_HEST9_OFFSET (Header.Type), "Subtable Type"}, - {ACPI_DMT_UINT16, ACPI_HEST9_OFFSET (SourceId), "Source Id"}, + ACPI_DM_HEST_HEADER, {ACPI_DMT_UINT16, ACPI_HEST9_OFFSET (RelatedSourceId), "Related Source Id"}, - {ACPI_DMT_UINT8, ACPI_HEST9_OFFSET (ConfigWriteEnable), "Configuration Write Enable"}, + {ACPI_DMT_UINT8, ACPI_HEST9_OFFSET (Reserved), "Reserved"}, {ACPI_DMT_UINT8, ACPI_HEST9_OFFSET (Enabled), "Enabled"}, - {ACPI_DMT_UINT32, ACPI_HEST9_OFFSET (RecordsToPreAllocate), "Records To Preallocate"}, + {ACPI_DMT_UINT32, ACPI_HEST9_OFFSET (RecordsToPreallocate), "Records To Preallocate"}, {ACPI_DMT_UINT32, ACPI_HEST9_OFFSET (MaxSectionsPerRecord), "Max Sections Per Record"}, {ACPI_DMT_UINT32, ACPI_HEST9_OFFSET (MaxRawDataLength), "Max Raw Data Length"}, {ACPI_DMT_GAS, ACPI_HEST9_OFFSET (ErrorStatusAddress), "Error Status Address"}, {ACPI_DMT_HESTNTFY, ACPI_HEST9_OFFSET (Notify), "Notify"}, - {ACPI_DMT_UINT32, ACPI_HEST9_OFFSET (ErrorStatusBlockLength), "Error Status Block Length"}, + {ACPI_DMT_UINT32, ACPI_HEST9_OFFSET (ErrorBlockLength), "Error Status Block Length"}, {ACPI_DMT_EXIT, 0, NULL} }; -ACPI_DMTABLE_INFO AcpiDmTableInfoHestNotify[10] = +ACPI_DMTABLE_INFO AcpiDmTableInfoHestNotify[] = { {ACPI_DMT_HESTNTYP, ACPI_HESTN_OFFSET (Type), "Notify Type"}, {ACPI_DMT_UINT8, ACPI_HESTN_OFFSET (Length), "Notify Length"}, @@ -919,6 +906,25 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoHestNotify[10] = }; +/* + * IA32 Error Bank(s) - Follows the ACPI_HEST_IA_MACHINE_CHECK and + * ACPI_HEST_IA_CORRECTED structures. + */ +ACPI_DMTABLE_INFO AcpiDmTableInfoHestBank[] = +{ + {ACPI_DMT_UINT8, ACPI_HESTB_OFFSET (BankNumber), "Bank Number"}, + {ACPI_DMT_UINT8, ACPI_HESTB_OFFSET (ClearStatusOnInit), "Clear Status On Init"}, + {ACPI_DMT_UINT8, ACPI_HESTB_OFFSET (StatusFormat), "Status Format"}, + {ACPI_DMT_UINT8, ACPI_HESTB_OFFSET (Reserved), "Reserved"}, + {ACPI_DMT_UINT32, ACPI_HESTB_OFFSET (ControlRegister), "Control Register"}, + {ACPI_DMT_UINT64, ACPI_HESTB_OFFSET (ControlData), "Control Data"}, + {ACPI_DMT_UINT32, ACPI_HESTB_OFFSET (StatusRegister), "Status Register"}, + {ACPI_DMT_UINT32, ACPI_HESTB_OFFSET (AddressRegister), "Address Register"}, + {ACPI_DMT_UINT32, ACPI_HESTB_OFFSET (MiscRegister), "Misc Register"}, + {ACPI_DMT_EXIT, 0, NULL} +}; + + /******************************************************************************* * * HPET - High Precision Event Timer table @@ -932,9 +938,104 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoHpet[] = {ACPI_DMT_UINT8, ACPI_HPET_OFFSET (Sequence), "Sequence Number"}, {ACPI_DMT_UINT16, ACPI_HPET_OFFSET (MinimumTick), "Minimum Clock Ticks"}, {ACPI_DMT_UINT8, ACPI_HPET_OFFSET (Flags), "Flags (decoded below)"}, - {ACPI_DMT_FLAG0, ACPI_HPET_FLAG_OFFSET (Flags,0), "Page Protect"}, - {ACPI_DMT_FLAG1, ACPI_HPET_FLAG_OFFSET (Flags,0), "4K Page Protect"}, - {ACPI_DMT_FLAG2, ACPI_HPET_FLAG_OFFSET (Flags,0), "64K Page Protect"}, + {ACPI_DMT_FLAG0, ACPI_HPET_FLAG_OFFSET (Flags,0), "4K Page Protect"}, + {ACPI_DMT_FLAG1, ACPI_HPET_FLAG_OFFSET (Flags,0), "64K Page Protect"}, + {ACPI_DMT_EXIT, 0, NULL} +}; + + +/******************************************************************************* + * + * IVRS - I/O Virtualization Reporting Structure + * + ******************************************************************************/ + +ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs[] = +{ + {ACPI_DMT_UINT32, ACPI_IVRS_OFFSET (Info), "Virtualization Info"}, + {ACPI_DMT_UINT64, ACPI_IVRS_OFFSET (Reserved), "Reserved"}, + {ACPI_DMT_EXIT, 0, NULL} +}; + +/* Common Subtable header (one per Subtable) */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoIvrsHdr[] = +{ + {ACPI_DMT_IVRS, ACPI_IVRSH_OFFSET (Type), "Subtable Type"}, + {ACPI_DMT_UINT8, ACPI_IVRSH_OFFSET (Flags), "Flags"}, + {ACPI_DMT_UINT16, ACPI_IVRSH_OFFSET (Length), "Length"}, + {ACPI_DMT_UINT16, ACPI_IVRSH_OFFSET (DeviceId), "DeviceId"}, + {ACPI_DMT_EXIT, 0, NULL} +}; + +/* IVRS subtables */ + +/* 0x10: I/O Virtualization Hardware Definition (IVHD) Block */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs0[] = +{ + {ACPI_DMT_UINT16, ACPI_IVRS0_OFFSET (CapabilityOffset), "Capability Offset"}, + {ACPI_DMT_UINT64, ACPI_IVRS0_OFFSET (BaseAddress), "Base Address"}, + {ACPI_DMT_UINT16, ACPI_IVRS0_OFFSET (PciSegmentGroup), "PCI Segment Group"}, + {ACPI_DMT_UINT16, ACPI_IVRS0_OFFSET (Info), "Virtualization Info"}, + {ACPI_DMT_UINT32, ACPI_IVRS0_OFFSET (Reserved), "Reserved"}, + {ACPI_DMT_EXIT, 0, NULL} +}; + +/* 0x20, 0x21, 0x22: I/O Virtualization Memory Definition (IVMD) Block */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs1[] = +{ + {ACPI_DMT_UINT16, ACPI_IVRS1_OFFSET (AuxData), "Auxiliary Data"}, + {ACPI_DMT_UINT64, ACPI_IVRS1_OFFSET (Reserved), "Reserved"}, + {ACPI_DMT_UINT64, ACPI_IVRS1_OFFSET (StartAddress), "Start Address"}, + {ACPI_DMT_UINT64, ACPI_IVRS1_OFFSET (MemoryLength), "Memory Length"}, + {ACPI_DMT_EXIT, 0, NULL} +}; + +/* Device entry header for IVHD block */ + +#define ACPI_DMT_IVRS_DE_HEADER \ + {ACPI_DMT_UINT8, ACPI_IVRSD_OFFSET (Type), "Entry Type"}, \ + {ACPI_DMT_UINT16, ACPI_IVRSD_OFFSET (Id), "Device ID"}, \ + {ACPI_DMT_UINT8, ACPI_IVRSD_OFFSET (DataSetting), "Data Setting"} + +/* 4-byte device entry */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs4[] = +{ + ACPI_DMT_IVRS_DE_HEADER, + {ACPI_DMT_EXIT, 0, NULL} +}; + +/* 8-byte device entry */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs8a[] = +{ + ACPI_DMT_IVRS_DE_HEADER, + {ACPI_DMT_UINT8, ACPI_IVRS8A_OFFSET (Reserved1), "Reserved"}, + {ACPI_DMT_UINT16, ACPI_IVRS8A_OFFSET (UsedId), "Source Used Device ID"}, + {ACPI_DMT_UINT8, ACPI_IVRS8A_OFFSET (Reserved2), "Reserved"}, + {ACPI_DMT_EXIT, 0, NULL} +}; + +/* 8-byte device entry */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs8b[] = +{ + ACPI_DMT_IVRS_DE_HEADER, + {ACPI_DMT_UINT32, ACPI_IVRS8B_OFFSET (ExtendedData), "Extended Data"}, + {ACPI_DMT_EXIT, 0, NULL} +}; + +/* 8-byte device entry */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs8c[] = +{ + ACPI_DMT_IVRS_DE_HEADER, + {ACPI_DMT_UINT8, ACPI_IVRS8C_OFFSET (Handle), "Handle"}, + {ACPI_DMT_UINT16, ACPI_IVRS8C_OFFSET (UsedId), "Source Used Device ID"}, + {ACPI_DMT_UINT8, ACPI_IVRS8C_OFFSET (Variety), "Variety"}, {ACPI_DMT_EXIT, 0, NULL} }; @@ -1074,7 +1175,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt8[] = {ACPI_DMT_EXIT, 0, NULL} }; -/* 9: Processor Local X2_APIC (07/2008) */ +/* 9: Processor Local X2_APIC (ACPI 4.0) */ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt9[] = { @@ -1086,7 +1187,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt9[] = {ACPI_DMT_EXIT, 0, NULL} }; -/* 10: Local X2_APIC NMI (07/2008) */ +/* 10: Local X2_APIC NMI (ACPI 4.0) */ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt10[] = { @@ -1125,6 +1226,35 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoMcfg0[] = /******************************************************************************* * + * MSCT - Maximum System Characteristics Table (ACPI 4.0) + * + ******************************************************************************/ + +ACPI_DMTABLE_INFO AcpiDmTableInfoMsct[] = +{ + {ACPI_DMT_UINT32, ACPI_MSCT_OFFSET (ProximityOffset), "Proximity Offset"}, + {ACPI_DMT_UINT32, ACPI_MSCT_OFFSET (MaxProximityDomains), "Max Proximity Domains"}, + {ACPI_DMT_UINT32, ACPI_MSCT_OFFSET (MaxClockDomains), "Max Clock Domains"}, + {ACPI_DMT_UINT64, ACPI_MSCT_OFFSET (MaxAddress), "Max Physical Address"}, + {ACPI_DMT_EXIT, 0, NULL} +}; + +/* Subtable - Maximum Proximity Domain Information. Version 1 */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoMsct0[] = +{ + {ACPI_DMT_UINT8, ACPI_MSCT0_OFFSET (Revision), "Revision"}, + {ACPI_DMT_UINT8, ACPI_MSCT0_OFFSET (Length), "Length"}, + {ACPI_DMT_UINT32, ACPI_MSCT0_OFFSET (RangeStart), "Domain Range Start"}, + {ACPI_DMT_UINT32, ACPI_MSCT0_OFFSET (RangeEnd), "Domain Range End"}, + {ACPI_DMT_UINT32, ACPI_MSCT0_OFFSET (ProcessorCapacity), "Processor Capacity"}, + {ACPI_DMT_UINT64, ACPI_MSCT0_OFFSET (MemoryCapacity), "Memory Capacity"}, + {ACPI_DMT_EXIT, 0, NULL} +}; + + +/******************************************************************************* + * * SBST - Smart Battery Specification Table * ******************************************************************************/ @@ -1203,8 +1333,8 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoSpcr[] = ACPI_DMTABLE_INFO AcpiDmTableInfoSpmi[] = { - {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (Reserved), "Reserved"}, {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (InterfaceType), "Interface Type"}, + {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (Reserved), "Reserved"}, {ACPI_DMT_UINT16, ACPI_SPMI_OFFSET (SpecRevision), "IPMI Spec Version"}, {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (InterruptType), "Interrupt Type"}, {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (GpeNumber), "GPE Number"}, @@ -1216,6 +1346,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoSpmi[] = {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (PciBus), "PCI Bus"}, {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (PciDevice), "PCI Device"}, {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (PciFunction), "PCI Function"}, + {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (Reserved2), "Reserved"}, {ACPI_DMT_EXIT, 0, NULL} }; @@ -1275,7 +1406,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoSrat1[] = {ACPI_DMT_EXIT, 0, NULL} }; -/* 2: Processor Local X2_APIC Affinity (07/2008) */ +/* 2: Processor Local X2_APIC Affinity (ACPI 4.0) */ ACPI_DMTABLE_INFO AcpiDmTableInfoSrat2[] = { @@ -1284,6 +1415,8 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoSrat2[] = {ACPI_DMT_UINT32, ACPI_SRAT2_OFFSET (ApicId), "Apic ID"}, {ACPI_DMT_UINT32, ACPI_SRAT2_OFFSET (Flags), "Flags (decoded below)"}, {ACPI_DMT_FLAG0, ACPI_SRAT2_FLAG_OFFSET (Flags,0), "Enabled"}, + {ACPI_DMT_UINT32, ACPI_SRAT2_OFFSET (ClockDomain), "Clock Domain"}, + {ACPI_DMT_UINT32, ACPI_SRAT2_OFFSET (Reserved2), "Reserved"}, {ACPI_DMT_EXIT, 0, NULL} }; @@ -1305,25 +1438,90 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoTcpa[] = /******************************************************************************* * + * UEFI - UEFI Boot optimization Table + * + ******************************************************************************/ + +ACPI_DMTABLE_INFO AcpiDmTableInfoUefi[] = +{ + {ACPI_DMT_BUF16, ACPI_UEFI_OFFSET (Identifier[0]), "UUID Identifier"}, + {ACPI_DMT_UINT16, ACPI_UEFI_OFFSET (DataOffset), "Data Offset"}, + {ACPI_DMT_EXIT, 0, NULL} +}; + + +/******************************************************************************* + * + * WAET - Windows ACPI Emulated devices Table + * + ******************************************************************************/ + +ACPI_DMTABLE_INFO AcpiDmTableInfoWaet[] = +{ + {ACPI_DMT_UINT32, ACPI_WAET_OFFSET (Flags), "Flags (decoded below)"}, + {ACPI_DMT_FLAG0, ACPI_WAET_OFFSET (Flags), "RTC needs no INT ack"}, + {ACPI_DMT_FLAG1, ACPI_WAET_OFFSET (Flags), "PM timer, one read only"}, + {ACPI_DMT_EXIT, 0, NULL} +}; + + +/******************************************************************************* + * + * WDAT - Watchdog Action Table + * + ******************************************************************************/ + +ACPI_DMTABLE_INFO AcpiDmTableInfoWdat[] = +{ + {ACPI_DMT_UINT32, ACPI_WDAT_OFFSET (HeaderLength), "Header Length"}, + {ACPI_DMT_UINT8, ACPI_WDAT_OFFSET (PciSegment), "PCI Segment"}, + {ACPI_DMT_UINT8, ACPI_WDAT_OFFSET (PciBus), "PCI Bus"}, + {ACPI_DMT_UINT8, ACPI_WDAT_OFFSET (PciDevice), "PCI Device"}, + {ACPI_DMT_UINT8, ACPI_WDAT_OFFSET (PciFunction), "PCI Function"}, + {ACPI_DMT_UINT24, ACPI_WDAT_OFFSET (Reserved[0]), "Reserved"}, + {ACPI_DMT_UINT32, ACPI_WDAT_OFFSET (TimerPeriod), "Timer Period"}, + {ACPI_DMT_UINT32, ACPI_WDAT_OFFSET (MaxCount), "Max Count"}, + {ACPI_DMT_UINT32, ACPI_WDAT_OFFSET (MinCount), "Min Count"}, + {ACPI_DMT_UINT8, ACPI_WDAT_OFFSET (Flags), "Flags (decoded below)"}, + {ACPI_DMT_FLAG0, ACPI_WDAT_OFFSET (Flags), "Enabled"}, + {ACPI_DMT_FLAG7, ACPI_WDAT_OFFSET (Flags), "Stopped When Asleep"}, + {ACPI_DMT_UINT24, ACPI_WDAT_OFFSET (Reserved2[0]), "Reserved"}, + {ACPI_DMT_UINT32, ACPI_WDAT_OFFSET (Entries), "Watchdog Entry Count"}, + {ACPI_DMT_EXIT, 0, NULL} +}; + +/* WDAT Subtables - Watchdog Instruction Entries */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoWdat0[] = +{ + {ACPI_DMT_UINT8, ACPI_WDAT0_OFFSET (Action), "Watchdog Action"}, + {ACPI_DMT_UINT8, ACPI_WDAT0_OFFSET (Instruction), "Instruction"}, + {ACPI_DMT_UINT16, ACPI_WDAT0_OFFSET (Reserved), "Reserved"}, + {ACPI_DMT_GAS, ACPI_WDAT0_OFFSET (RegisterRegion), "Register Region"}, + {ACPI_DMT_UINT32, ACPI_WDAT0_OFFSET (Value), "Value"}, + {ACPI_DMT_UINT32, ACPI_WDAT0_OFFSET (Mask), "Register Mask"}, + {ACPI_DMT_EXIT, 0, NULL} +}; + + +/******************************************************************************* + * * WDRT - Watchdog Resource Table * ******************************************************************************/ ACPI_DMTABLE_INFO AcpiDmTableInfoWdrt[] = { - {ACPI_DMT_UINT32, ACPI_WDRT_OFFSET (HeaderLength), "Header Length"}, - {ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (PciSegment), "PCI Segment"}, + {ACPI_DMT_GAS, ACPI_WDRT_OFFSET (ControlRegister), "Control Register"}, + {ACPI_DMT_GAS, ACPI_WDRT_OFFSET (CountRegister), "Count Register"}, + {ACPI_DMT_UINT16, ACPI_WDRT_OFFSET (PciDeviceId), "PCI Device ID"}, + {ACPI_DMT_UINT16, ACPI_WDRT_OFFSET (PciVendorId), "PCI Vendor ID"}, {ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (PciBus), "PCI Bus"}, {ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (PciDevice), "PCI Device"}, {ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (PciFunction), "PCI Function"}, - {ACPI_DMT_UINT32, ACPI_WDRT_OFFSET (TimerPeriod), "Timer Period"}, - {ACPI_DMT_UINT32, ACPI_WDRT_OFFSET (MaxCount), "Max Count"}, - {ACPI_DMT_UINT32, ACPI_WDRT_OFFSET (MinCount), "Min Count"}, - {ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (Flags), "Flags (decoded below)"}, - {ACPI_DMT_FLAG0, ACPI_WDRT_OFFSET (Flags), "Enabled"}, - {ACPI_DMT_FLAG7, ACPI_WDRT_OFFSET (Flags), "Stopped When Asleep"}, - {ACPI_DMT_UINT24, ACPI_WDRT_OFFSET (Reserved[0]), "Reserved"}, - {ACPI_DMT_UINT32, ACPI_WDRT_OFFSET (Entries), "Watchdog Entries"}, + {ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (PciSegment), "PCI Segment"}, + {ACPI_DMT_UINT16, ACPI_WDRT_OFFSET (MaxCount), "Max Count"}, + {ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (Units), "Counter Units"}, {ACPI_DMT_EXIT, 0, NULL} }; diff --git a/sys/contrib/dev/acpica/common/getopt.c b/sys/contrib/dev/acpica/common/getopt.c index 56c7332..b4a5b9e 100644 --- a/sys/contrib/dev/acpica/common/getopt.c +++ b/sys/contrib/dev/acpica/common/getopt.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -195,9 +195,9 @@ AcpiGetopt( if (*++OptsPtr == ':') { - if (argv[AcpiGbl_Optind][CurrentCharPtr+1] != '\0') + if (argv[AcpiGbl_Optind][(int) (CurrentCharPtr+1)] != '\0') { - AcpiGbl_Optarg = &argv[AcpiGbl_Optind++][CurrentCharPtr+1]; + AcpiGbl_Optarg = &argv[AcpiGbl_Optind++][(int) (CurrentCharPtr+1)]; } else if (++AcpiGbl_Optind >= argc) { @@ -218,9 +218,9 @@ AcpiGetopt( else if (*OptsPtr == '^') { - if (argv[AcpiGbl_Optind][CurrentCharPtr+1] != '\0') + if (argv[AcpiGbl_Optind][(int) (CurrentCharPtr+1)] != '\0') { - AcpiGbl_Optarg = &argv[AcpiGbl_Optind][CurrentCharPtr+1]; + AcpiGbl_Optarg = &argv[AcpiGbl_Optind][(int) (CurrentCharPtr+1)]; } else { diff --git a/sys/contrib/dev/acpica/compiler/aslanalyze.c b/sys/contrib/dev/acpica/compiler/aslanalyze.c index 65052d5..46a6db0 100644 --- a/sys/contrib/dev/acpica/compiler/aslanalyze.c +++ b/sys/contrib/dev/acpica/compiler/aslanalyze.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -667,8 +667,8 @@ AnCheckForReservedName ( { /* The next two characters must be hex digits */ - if ((isxdigit (Name[2])) && - (isxdigit (Name[3]))) + if ((isxdigit ((int) Name[2])) && + (isxdigit ((int) Name[3]))) { return (ACPI_EVENT_RESERVED_NAME); } @@ -1236,7 +1236,7 @@ AnMethodAnalysisWalkBegin ( */ for (i = 0; Next->Asl.Value.String[i]; i++) { - if (!isalnum (Next->Asl.Value.String[i])) + if (!isalnum ((int) Next->Asl.Value.String[i])) { AslError (ASL_ERROR, ASL_MSG_ALPHANUMERIC_STRING, Next, Next->Asl.Value.String); @@ -2157,7 +2157,7 @@ AnOtherSemanticAnalysisWalkBegin ( */ if (((ArgNode->Asl.ParseOpcode == PARSEOP_WORDCONST) || (ArgNode->Asl.ParseOpcode == PARSEOP_INTEGER)) && - (ArgNode->Asl.Value.Integer >= (ACPI_INTEGER) ACPI_WAIT_FOREVER)) + (ArgNode->Asl.Value.Integer >= (UINT64) ACPI_WAIT_FOREVER)) { break; } diff --git a/sys/contrib/dev/acpica/compiler/aslcodegen.c b/sys/contrib/dev/acpica/compiler/aslcodegen.c index 6e0c764..6821a69 100644 --- a/sys/contrib/dev/acpica/compiler/aslcodegen.c +++ b/sys/contrib/dev/acpica/compiler/aslcodegen.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/compiler/aslcompile.c b/sys/contrib/dev/acpica/compiler/aslcompile.c index dda3ce3..443273c 100644 --- a/sys/contrib/dev/acpica/compiler/aslcompile.c +++ b/sys/contrib/dev/acpica/compiler/aslcompile.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -895,19 +895,19 @@ CmCleanupAndExit ( 10) / Gbl_NsLookupCount); } - /* Close all open files */ - for (i = 2; i < ASL_MAX_FILE_TYPE; i++) + if (Gbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT) { - FlCloseFile (i); + printf ("\nMaximum error count (%d) exceeded\n", ASL_MAX_ERROR_COUNT); } - /* - * TBD: SourceOutput should be .TMP, then rename if we want to keep it? - */ - if (!Gbl_SourceOutputFlag) + UtDisplaySummary (ASL_FILE_STDOUT); + + /* Close all open files */ + + for (i = 2; i < ASL_MAX_FILE_TYPE; i++) { - remove (Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename); + FlCloseFile (i); } /* Delete AML file if there are errors */ @@ -917,12 +917,19 @@ CmCleanupAndExit ( remove (Gbl_Files[ASL_FILE_AML_OUTPUT].Filename); } - if (Gbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT) + /* + * Delete intermediate ("combined") source file (if -ls flag not set) + * + * TBD: SourceOutput should be .TMP, then rename if we want to keep it? + */ + if (!Gbl_SourceOutputFlag) { - printf ("\nMaximum error count (%d) exceeded\n", ASL_MAX_ERROR_COUNT); + if (remove (Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename)) + { + printf ("Could not remove SRC file, %s\n", + Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename); + } } - - UtDisplaySummary (ASL_FILE_STDOUT); } diff --git a/sys/contrib/dev/acpica/compiler/aslcompiler.h b/sys/contrib/dev/acpica/compiler/aslcompiler.h index a698f5f..16b5f72 100644 --- a/sys/contrib/dev/acpica/compiler/aslcompiler.h +++ b/sys/contrib/dev/acpica/compiler/aslcompiler.h @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -511,7 +511,7 @@ TrCreateLeafNode ( ACPI_PARSE_OBJECT * TrCreateValuedLeafNode ( UINT32 ParseOpcode, - ACPI_INTEGER Value); + UINT64 Value); ACPI_PARSE_OBJECT * TrLinkChildren ( @@ -556,6 +556,10 @@ AslAbort ( void); void +FlAddIncludeDirectory ( + char *Dir); + +void FlOpenIncludeFile ( ACPI_PARSE_OBJECT *Op); @@ -714,7 +718,7 @@ UtCheckIntegerRange ( UINT32 LowValue, UINT32 HighValue); -ACPI_INTEGER +UINT64 UtDoConstant ( char *String); diff --git a/sys/contrib/dev/acpica/compiler/aslcompiler.l b/sys/contrib/dev/acpica/compiler/aslcompiler.l index aff60d6..bf9077f 100644 --- a/sys/contrib/dev/acpica/compiler/aslcompiler.l +++ b/sys/contrib/dev/acpica/compiler/aslcompiler.l @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -386,6 +386,7 @@ NamePathTail [.]{NameSeg} "SMBus" { count (0); return (PARSEOP_REGIONSPACE_SMBUS); } "SystemCMOS" { count (0); return (PARSEOP_REGIONSPACE_CMOS); } "PciBarTarget" { count (0); return (PARSEOP_REGIONSPACE_PCIBAR); } +"IPMI" { count (0); return (PARSEOP_REGIONSPACE_IPMI); } "FFixedHW" { count (0); return (PARSEOP_ADDRESSSPACE_FFIXEDHW); } diff --git a/sys/contrib/dev/acpica/compiler/aslcompiler.y b/sys/contrib/dev/acpica/compiler/aslcompiler.y index 2122cf1..d5120de 100644 --- a/sys/contrib/dev/acpica/compiler/aslcompiler.y +++ b/sys/contrib/dev/acpica/compiler/aslcompiler.y @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -400,6 +400,7 @@ AslLocalAllocate (unsigned int Size); %token <i> PARSEOP_REGIONSPACE_CMOS %token <i> PARSEOP_REGIONSPACE_EC %token <i> PARSEOP_REGIONSPACE_IO +%token <i> PARSEOP_REGIONSPACE_IPMI %token <i> PARSEOP_REGIONSPACE_MEM %token <i> PARSEOP_REGIONSPACE_PCI %token <i> PARSEOP_REGIONSPACE_PCIBAR @@ -2175,6 +2176,7 @@ RegionSpaceKeyword | PARSEOP_REGIONSPACE_SMBUS {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_SMBUS);} | PARSEOP_REGIONSPACE_CMOS {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_CMOS);} | PARSEOP_REGIONSPACE_PCIBAR {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_PCIBAR);} + | PARSEOP_REGIONSPACE_IPMI {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_IPMI);} ; AddressSpaceKeyword @@ -2386,7 +2388,7 @@ QWordConstExpr ConstExprTerm : PARSEOP_ZERO {$$ = TrCreateValuedLeafNode (PARSEOP_ZERO, 0);} | PARSEOP_ONE {$$ = TrCreateValuedLeafNode (PARSEOP_ONE, 1);} - | PARSEOP_ONES {$$ = TrCreateValuedLeafNode (PARSEOP_ONES, ACPI_INTEGER_MAX);} + | PARSEOP_ONES {$$ = TrCreateValuedLeafNode (PARSEOP_ONES, ACPI_UINT64_MAX);} ; /* OptionalCount must appear before ByteList or an incorrect reduction will result */ diff --git a/sys/contrib/dev/acpica/compiler/asldefine.h b/sys/contrib/dev/acpica/compiler/asldefine.h index c66040b..75345a5 100644 --- a/sys/contrib/dev/acpica/compiler/asldefine.h +++ b/sys/contrib/dev/acpica/compiler/asldefine.h @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -127,8 +127,8 @@ #define IntelAcpiCA "Intel ACPI Component Architecture" #define CompilerId "ASL Optimizing Compiler" #define DisassemblerId "AML Disassembler" -#define CompilerCopyright "Copyright (C) 2000 - 2009 Intel Corporation" -#define CompilerCompliance "Supports ACPI Specification Revision 3.0a" +#define CompilerCopyright "Copyright (c) 2000 - 2010 Intel Corporation" +#define CompilerCompliance "Supports ACPI Specification Revision 4.0" #define CompilerName "iasl" #define CompilerCreatorId "INTL" diff --git a/sys/contrib/dev/acpica/compiler/aslerror.c b/sys/contrib/dev/acpica/compiler/aslerror.c index 2591dfe..1fa78a5 100644 --- a/sys/contrib/dev/acpica/compiler/aslerror.c +++ b/sys/contrib/dev/acpica/compiler/aslerror.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -169,13 +169,7 @@ AeAddToErrorLog ( ASL_ERROR_MSG *Prev; - if (!Gbl_ErrorLog) - { - Gbl_ErrorLog = Enode; - return; - } - - /* List is sorted according to line number */ + /* If Gbl_ErrorLog is null, this is the first error node */ if (!Gbl_ErrorLog) { @@ -183,8 +177,10 @@ AeAddToErrorLog ( return; } - /* Walk error list until we find a line number greater than ours */ - + /* + * Walk error list until we find a line number greater than ours. + * List is sorted according to line number. + */ Prev = NULL; Next = Gbl_ErrorLog; @@ -535,6 +531,7 @@ AslCommonError ( Gbl_NextError = Gbl_ErrorLog; CmDoOutputFiles (); CmCleanupAndExit (); + exit(1); } return; diff --git a/sys/contrib/dev/acpica/compiler/aslfiles.c b/sys/contrib/dev/acpica/compiler/aslfiles.c index 5f262fe..f2e2dca 100644 --- a/sys/contrib/dev/acpica/compiler/aslfiles.c +++ b/sys/contrib/dev/acpica/compiler/aslfiles.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -128,10 +128,11 @@ FlOpenFile ( char *Filename, char *Mode); -static FILE * -FlOpenLocalFile ( - char *LocalName, - char *Mode); +FILE * +FlOpenIncludeWithPrefix ( + char *PrefixDir, + char *Filename); + #ifdef ACPI_OBSOLETE_FUNCTIONS ACPI_STATUS @@ -172,45 +173,6 @@ AslAbort ( /******************************************************************************* * - * FUNCTION: FlOpenLocalFile - * - * PARAMETERS: LocalName - Single filename (not a pathname) - * Mode - Open mode for fopen - * - * RETURN: File descriptor - * - * DESCRIPTION: Build a complete pathname for the input filename and open - * the file. - * - ******************************************************************************/ - -static FILE * -FlOpenLocalFile ( - char *LocalName, - char *Mode) -{ - - StringBuffer[0] = 0; - - /* Check for an absolute pathname */ - - if ((LocalName[0] != '/') && /* Forward slash */ - (LocalName[0] != '\\') && /* backslash (Win) */ - (LocalName[1] != ':')) /* Device name (Win) */ - { - /* The include file path is relative, prepend the directory path */ - - strcat (StringBuffer, Gbl_DirectoryPath); - } - strcat (StringBuffer, LocalName); - - DbgPrint (ASL_PARSE_OUTPUT, "FlOpenLocalFile: %s\n", StringBuffer); - return (fopen (StringBuffer, (const char *) Mode)); -} - - -/******************************************************************************* - * * FUNCTION: FlFileError * * PARAMETERS: FileId - Index into file info array @@ -481,6 +443,122 @@ FlSetLineNumber ( /******************************************************************************* * + * FUNCTION: FlAddIncludeDirectory + * + * PARAMETERS: Dir - Directory pathname string + * + * RETURN: None + * + * DESCRIPTION: Add a directory the list of include prefix directories. + * + ******************************************************************************/ + +void +FlAddIncludeDirectory ( + char *Dir) +{ + ASL_INCLUDE_DIR *NewDir; + ASL_INCLUDE_DIR *NextDir; + ASL_INCLUDE_DIR *PrevDir = NULL; + UINT32 NeedsSeparator = 0; + size_t DirLength; + + + DirLength = strlen (Dir); + if (!DirLength) + { + return; + } + + /* Make sure that the pathname ends with a path separator */ + + if ((Dir[DirLength-1] != '/') && + (Dir[DirLength-1] != '\\')) + { + NeedsSeparator = 1; + } + + NewDir = ACPI_ALLOCATE_ZEROED (sizeof (ASL_INCLUDE_DIR)); + NewDir->Dir = ACPI_ALLOCATE (DirLength + 1 + NeedsSeparator); + strcpy (NewDir->Dir, Dir); + if (NeedsSeparator) + { + strcat (NewDir->Dir, "/"); + } + + /* + * Preserve command line ordering of -I options by adding new elements + * at the end of the list + */ + NextDir = Gbl_IncludeDirList; + while (NextDir) + { + PrevDir = NextDir; + NextDir = NextDir->Next; + } + + if (PrevDir) + { + PrevDir->Next = NewDir; + } + else + { + Gbl_IncludeDirList = NewDir; + } +} + + +/******************************************************************************* + * + * FUNCTION: FlOpenIncludeWithPrefix + * + * PARAMETERS: PrefixDir - Prefix directory pathname. Can be a zero + * length string. + * Filename - The include filename from the source ASL. + * + * RETURN: Valid file descriptor if successful. Null otherwise. + * + * DESCRIPTION: Open an include file and push it on the input file stack. + * + ******************************************************************************/ + +FILE * +FlOpenIncludeWithPrefix ( + char *PrefixDir, + char *Filename) +{ + FILE *IncludeFile; + char *Pathname; + + + /* Build the full pathname to the file */ + + Pathname = ACPI_ALLOCATE (strlen (PrefixDir) + strlen (Filename) + 1); + + strcpy (Pathname, PrefixDir); + strcat (Pathname, Filename); + + DbgPrint (ASL_PARSE_OUTPUT, "\nAttempt to open include file: path %s\n\n", + Pathname); + + /* Attempt to open the file, push if successful */ + + IncludeFile = fopen (Pathname, "r"); + if (IncludeFile) + { + /* Push the include file on the open input file stack */ + + AslPushInputFileStack (IncludeFile, Pathname); + return (IncludeFile); + } + + ACPI_FREE (Pathname); + return (NULL); +} + + +/******************************************************************************* + * * FUNCTION: FlOpenIncludeFile * * PARAMETERS: Op - Parse node for the INCLUDE ASL statement @@ -495,7 +573,8 @@ void FlOpenIncludeFile ( ACPI_PARSE_OBJECT *Op) { - FILE *IncFile; + FILE *IncludeFile; + ASL_INCLUDE_DIR *NextDir; /* Op must be valid */ @@ -518,21 +597,58 @@ FlOpenIncludeFile ( FlPrintFile (ASL_FILE_SOURCE_OUTPUT, "\n"); Gbl_CurrentLineOffset++; - /* Prepend the directory pathname and open the include file */ - DbgPrint (ASL_PARSE_OUTPUT, "\nOpen include file: path %s\n\n", - Op->Asl.Value.String); - IncFile = FlOpenLocalFile (Op->Asl.Value.String, "r"); - if (!IncFile) + /* Attempt to open the include file */ + + /* If the file specifies an absolute path, just open it */ + + if ((Op->Asl.Value.String[0] == '/') || + (Op->Asl.Value.String[0] == '\\') || + (Op->Asl.Value.String[1] == ':')) { - sprintf (MsgBuffer, "%s (%s)", Op->Asl.Value.String, strerror (errno)); - AslError (ASL_ERROR, ASL_MSG_INCLUDE_FILE_OPEN, Op, MsgBuffer); + IncludeFile = FlOpenIncludeWithPrefix ("", Op->Asl.Value.String); + if (!IncludeFile) + { + goto ErrorExit; + } return; } - /* Push the include file on the open input file stack */ + /* + * The include filename is not an absolute path. + * + * First, search for the file within the "local" directory -- meaning + * the same directory that contains the source file. + * + * Construct the file pathname from the global directory name. + */ + IncludeFile = FlOpenIncludeWithPrefix (Gbl_DirectoryPath, Op->Asl.Value.String); + if (IncludeFile) + { + return; + } + + /* + * Second, search for the file within the (possibly multiple) directories + * specified by the -I option on the command line. + */ + NextDir = Gbl_IncludeDirList; + while (NextDir) + { + IncludeFile = FlOpenIncludeWithPrefix (NextDir->Dir, Op->Asl.Value.String); + if (IncludeFile) + { + return; + } + + NextDir = NextDir->Next; + } + + /* We could not open the include file after trying very hard */ - AslPushInputFileStack (IncFile, Op->Asl.Value.String); +ErrorExit: + sprintf (MsgBuffer, "%s, %s", Op->Asl.Value.String, strerror (errno)); + AslError (ASL_ERROR, ASL_MSG_INCLUDE_FILE_OPEN, Op, MsgBuffer); } diff --git a/sys/contrib/dev/acpica/compiler/aslfold.c b/sys/contrib/dev/acpica/compiler/aslfold.c index d250c33..9b5efa8 100644 --- a/sys/contrib/dev/acpica/compiler/aslfold.c +++ b/sys/contrib/dev/acpica/compiler/aslfold.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/compiler/aslglobal.h b/sys/contrib/dev/acpica/compiler/aslglobal.h index 4cb9121..69fcf84 100644 --- a/sys/contrib/dev/acpica/compiler/aslglobal.h +++ b/sys/contrib/dev/acpica/compiler/aslglobal.h @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -148,7 +148,7 @@ extern char HexLookup[]; #define ASL_LINE_BUFFER_SIZE 512 #define ASL_MSG_BUFFER_SIZE 4096 #define HEX_TABLE_LINE_SIZE 8 -#define HEX_LISTING_LINE_SIZE 16 +#define HEX_LISTING_LINE_SIZE 8 /* Source code buffers and pointers for error reporting */ @@ -165,7 +165,6 @@ ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_LineBufPtr, Gbl_Curren ASL_EXTERN ASL_ERROR_MSG ASL_INIT_GLOBAL (*Gbl_ErrorLog,NULL); ASL_EXTERN ASL_ERROR_MSG ASL_INIT_GLOBAL (*Gbl_NextError,NULL); -extern UINT32 Gbl_ExceptionCount[]; /* Option flags */ @@ -212,6 +211,7 @@ ASL_EXTERN char *Gbl_DirectoryPath; ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_ExternalFilename, NULL); ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_IncludeFilename, NULL); ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_OutputFilenamePrefix, NULL); +ASL_EXTERN ASL_INCLUDE_DIR ASL_INIT_GLOBAL (*Gbl_IncludeDirList, NULL); ASL_EXTERN char *Gbl_CurrentInputFilename; ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_HasIncludeFiles, FALSE); @@ -277,5 +277,12 @@ ASL_EXTERN char MsgBuffer[ASL_MSG_BUFFER_SIZE]; ASL_EXTERN char StringBuffer[ASL_MSG_BUFFER_SIZE]; ASL_EXTERN char StringBuffer2[ASL_MSG_BUFFER_SIZE]; + +#ifdef _DECLARE_GLOBALS +UINT32 Gbl_ExceptionCount[ASL_NUM_REPORT_LEVELS] = {0,0,0,0,0,0}; +#else +extern UINT32 Gbl_ExceptionCount[ASL_NUM_REPORT_LEVELS]; +#endif + #endif /* __ASLGLOBAL_H */ diff --git a/sys/contrib/dev/acpica/compiler/asllength.c b/sys/contrib/dev/acpica/compiler/asllength.c index 75361dc..d17bab9 100644 --- a/sys/contrib/dev/acpica/compiler/asllength.c +++ b/sys/contrib/dev/acpica/compiler/asllength.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/compiler/asllisting.c b/sys/contrib/dev/acpica/compiler/asllisting.c index ff1e2baf..ebac9ca 100644 --- a/sys/contrib/dev/acpica/compiler/asllisting.c +++ b/sys/contrib/dev/acpica/compiler/asllisting.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/compiler/aslload.c b/sys/contrib/dev/acpica/compiler/aslload.c index 25bb4fc..980b69b 100644 --- a/sys/contrib/dev/acpica/compiler/aslload.c +++ b/sys/contrib/dev/acpica/compiler/aslload.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -353,6 +353,7 @@ LdLoadResourceElements ( Node->Value = (UINT32) Op->Asl.Value.Integer; Node->Op = Op; + Op->Asl.Node = Node; /* * Now enter the predefined fields, for easy lookup when referenced @@ -533,7 +534,7 @@ LdNamespace1Begin ( if (Op->Asl.CompileFlags == NODE_IS_RESOURCE_DESC) { Status = LdLoadResourceElements (Op, WalkState); - goto Exit; + return_ACPI_STATUS (Status); } ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode); @@ -574,8 +575,10 @@ LdNamespace1Begin ( goto FinishNode; } - AslCoreSubsystemError (Op, Status, "Failure from lookup\n", FALSE); - goto Exit; + AslCoreSubsystemError (Op, Status, + "Failure from namespace lookup", FALSE); + + return_ACPI_STATUS (Status); } /* We found a node with this name, now check the type */ @@ -710,15 +713,14 @@ LdNamespace1Begin ( AslError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Op, Op->Asl.ExternalName); - Status = AE_OK; - goto Exit; + return_ACPI_STATUS (AE_OK); } } else { AslCoreSubsystemError (Op, Status, - "Failure from lookup %s\n", FALSE); - goto Exit; + "Failure from namespace lookup", FALSE); + return_ACPI_STATUS (Status); } } @@ -756,8 +758,7 @@ FinishNode: Node->Value = (UINT32) Op->Asl.Extra; } -Exit: - return (Status); + return_ACPI_STATUS (Status); } @@ -884,7 +885,8 @@ LdNamespace2Begin ( return (AE_OK); } - AslCoreSubsystemError (Op, Status, "Failure from lookup\n", FALSE); + AslCoreSubsystemError (Op, Status, + "Failure from namespace lookup", FALSE); return (AE_OK); } diff --git a/sys/contrib/dev/acpica/compiler/asllookup.c b/sys/contrib/dev/acpica/compiler/asllookup.c index 3aa1e8c..1f9fb4c 100644 --- a/sys/contrib/dev/acpica/compiler/asllookup.c +++ b/sys/contrib/dev/acpica/compiler/asllookup.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -526,7 +526,7 @@ LsDisplayNamespace ( /* Walk entire namespace from the root */ Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, FALSE, LsDoOneNamespaceObject, + ACPI_UINT32_MAX, FALSE, LsDoOneNamespaceObject, NULL, NULL, NULL); /* Print the full pathname for each namespace node */ @@ -534,7 +534,7 @@ LsDisplayNamespace ( FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "\nNamespace pathnames\n\n"); Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, FALSE, LsDoOnePathname, + ACPI_UINT32_MAX, FALSE, LsDoOnePathname, NULL, NULL, NULL); return (Status); @@ -598,7 +598,7 @@ LkObjectExists ( /* Walk entire namespace from the supplied root */ Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, FALSE, LsCompareOneNamespaceObject, + ACPI_UINT32_MAX, FALSE, LsCompareOneNamespaceObject, NULL, Name, NULL); if (Status == AE_CTRL_TRUE) { @@ -753,7 +753,7 @@ LkFindUnreferencedObjects ( /* Walk entire namespace from the supplied root */ (void) AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, FALSE, LkIsObjectUsed, + ACPI_UINT32_MAX, FALSE, LkIsObjectUsed, NULL, NULL, NULL); } @@ -1337,6 +1337,7 @@ LkNamespaceLocateBegin ( break; case REGION_SMBUS: + case REGION_IPMI: if ((UINT8) Op->Asl.Parent->Asl.Value.Integer != AML_FIELD_ACCESS_BUFFER) { diff --git a/sys/contrib/dev/acpica/compiler/aslmain.c b/sys/contrib/dev/acpica/compiler/aslmain.c index c635bcd..9b9e956 100644 --- a/sys/contrib/dev/acpica/compiler/aslmain.c +++ b/sys/contrib/dev/acpica/compiler/aslmain.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -150,6 +150,25 @@ AslCommandLine ( int argc, char **argv); +static int +AslDoOptions ( + int argc, + char **argv, + BOOLEAN IsResponseFile); + +static void +AslMergeOptionTokens ( + char *InBuffer, + char *OutBuffer); + +static int +AslDoResponseFile ( + char *Filename); + + +#define ASL_TOKEN_SEPARATORS " \t\n" +#define ASL_SUPPORTED_OPTIONS "@:2b:cd^e:fgh^i^I:l^o:p:r:s:t:v:w:x:" + /******************************************************************************* * @@ -168,8 +187,12 @@ Options ( void) { - printf ("General Output:\n"); - printf (" -p <prefix> Specify path/filename prefix for all output files\n"); + printf ("Global:\n"); + printf (" -@<file> Specify command file\n"); + printf (" -I<dir> Specify additional include directory\n"); + + printf ("\nGeneral Output:\n"); + printf (" -p<prefix> Specify path/filename prefix for all output files\n"); printf (" -va Disable all errors and warnings (summary only)\n"); printf (" -vi Less verbose errors and warnings for use with IDEs\n"); printf (" -vo Enable optimization comments\n"); @@ -310,39 +333,149 @@ AslInitialize ( /******************************************************************************* * - * FUNCTION: AslCommandLine + * FUNCTION: AslMergeOptionTokens * - * PARAMETERS: argc/argv + * PARAMETERS: InBuffer - Input containing an option string + * OutBuffer - Merged output buffer * * RETURN: None * - * DESCRIPTION: Command line processing + * DESCRIPTION: Remove all whitespace from an option string. + * + ******************************************************************************/ + +static void +AslMergeOptionTokens ( + char *InBuffer, + char *OutBuffer) +{ + char *Token; + + + *OutBuffer = 0; + + Token = strtok (InBuffer, ASL_TOKEN_SEPARATORS); + while (Token) + { + strcat (OutBuffer, Token); + Token = strtok (NULL, ASL_TOKEN_SEPARATORS); + } +} + + +/******************************************************************************* + * + * FUNCTION: AslDoResponseFile + * + * PARAMETERS: Filename - Name of the response file + * + * RETURN: Status + * + * DESCRIPTION: Open a response file and process all options within. * ******************************************************************************/ static int -AslCommandLine ( - int argc, - char **argv) +AslDoResponseFile ( + char *Filename) { - BOOLEAN BadCommandLine = FALSE; - int j; + char *argv = StringBuffer2; + FILE *ResponseFile; + int OptStatus = 0; + int Opterr; + int Optind; - /* Minimum command line contains at least one option or an input file */ + ResponseFile = fopen (Filename, "r"); + if (!ResponseFile) + { + printf ("Could not open command file %s, %s\n", + Filename, strerror (errno)); + return -1; + } - if (argc < 2) + /* Must save the current GetOpt globals */ + + Opterr = AcpiGbl_Opterr; + Optind = AcpiGbl_Optind; + + /* + * Process all lines in the response file. There must be one complete + * option per line + */ + while (fgets (StringBuffer, ASL_MSG_BUFFER_SIZE, ResponseFile)) { - AslCompilerSignon (ASL_FILE_STDOUT); - Usage (); - exit (1); + /* Compress all tokens, allowing us to use a single argv entry */ + + AslMergeOptionTokens (StringBuffer, StringBuffer2); + + /* Process the option */ + + AcpiGbl_Opterr = 0; + AcpiGbl_Optind = 0; + + OptStatus = AslDoOptions (1, &argv, TRUE); + if (OptStatus) + { + printf ("Invalid option in command file %s: %s\n", + Filename, StringBuffer); + break; + } } + /* Restore the GetOpt globals */ + + AcpiGbl_Opterr = Opterr; + AcpiGbl_Optind = Optind; + + fclose (ResponseFile); + return (OptStatus); +} + + +/******************************************************************************* + * + * FUNCTION: AslDoOptions + * + * PARAMETERS: argc/argv - Standard argc/argv + * IsResponseFile - TRUE if executing a response file. + * + * RETURN: Status + * + * DESCRIPTION: Command line option processing + * + ******************************************************************************/ + +static int +AslDoOptions ( + int argc, + char **argv, + BOOLEAN IsResponseFile) +{ + int j; + + /* Get the command line options */ - while ((j = AcpiGetopt (argc, argv, "2b:cd^e:fgh^i^l^o:p:r:s:t:v:w:x:")) != EOF) switch (j) + while ((j = AcpiGetopt (argc, argv, ASL_SUPPORTED_OPTIONS)) != EOF) switch (j) { + case '@': /* Begin a response file */ + + if (IsResponseFile) + { + printf ("Nested command files are not supported\n"); + return -1; + } + + if (AslDoResponseFile (AcpiGbl_Optarg)) + { + return -1; + } + break; + + case '2': + Gbl_Acpi2 = TRUE; break; @@ -364,8 +497,7 @@ AslCommandLine ( default: printf ("Unknown option: -b%s\n", AcpiGbl_Optarg); - BadCommandLine = TRUE; - break; + return (-1); } /* Produce debug output file */ @@ -394,8 +526,7 @@ AslCommandLine ( default: printf ("Unknown option: -d%s\n", AcpiGbl_Optarg); - BadCommandLine = TRUE; - break; + return (-1); } Gbl_DisasmFlag = TRUE; @@ -444,12 +575,17 @@ AslCommandLine ( default: printf ("Unknown option: -h%s\n", AcpiGbl_Optarg); - BadCommandLine = TRUE; - break; + return (-1); } break; + case 'I': /* Add an include file search directory */ + + FlAddIncludeDirectory (AcpiGbl_Optarg); + break; + + case 'i': switch (AcpiGbl_Optarg[0]) @@ -470,8 +606,7 @@ AslCommandLine ( default: printf ("Unknown option: -s%s\n", AcpiGbl_Optarg); - BadCommandLine = TRUE; - break; + return (-1); } break; @@ -500,8 +635,7 @@ AslCommandLine ( default: printf ("Unknown option: -l%s\n", AcpiGbl_Optarg); - BadCommandLine = TRUE; - break; + return (-1); } break; @@ -549,8 +683,7 @@ AslCommandLine ( default: printf ("Unknown option: -c%s\n", AcpiGbl_Optarg); - BadCommandLine = TRUE; - break; + return (-1); } break; @@ -589,8 +722,7 @@ AslCommandLine ( default: printf ("Unknown option: -s%s\n", AcpiGbl_Optarg); - BadCommandLine = TRUE; - break; + return (-1); } break; @@ -611,8 +743,7 @@ AslCommandLine ( default: printf ("Unknown option: -t%s\n", AcpiGbl_Optarg); - BadCommandLine = TRUE; - break; + return (-1); } break; @@ -647,8 +778,7 @@ AslCommandLine ( default: printf ("Unknown option: -v%s\n", AcpiGbl_Optarg); - BadCommandLine = TRUE; - break; + return (-1); } break; @@ -671,8 +801,7 @@ AslCommandLine ( default: printf ("Unknown option: -w%s\n", AcpiGbl_Optarg); - BadCommandLine = TRUE; - break; + return (-1); } break; @@ -685,10 +814,46 @@ AslCommandLine ( default: - BadCommandLine = TRUE; - break; + return (-1); + } + + return (0); +} + + +/******************************************************************************* + * + * FUNCTION: AslCommandLine + * + * PARAMETERS: argc/argv + * + * RETURN: Last argv index + * + * DESCRIPTION: Command line processing + * + ******************************************************************************/ + +static int +AslCommandLine ( + int argc, + char **argv) +{ + int BadCommandLine = 0; + + + /* Minimum command line contains at least the command and an input file */ + + if (argc < 2) + { + AslCompilerSignon (ASL_FILE_STDOUT); + Usage (); + exit (1); } + /* Process all command line options */ + + BadCommandLine = AslDoOptions (argc, argv, FALSE); + /* Next parameter must be the input filename */ if (!argv[AcpiGbl_Optind] && diff --git a/sys/contrib/dev/acpica/compiler/aslmap.c b/sys/contrib/dev/acpica/compiler/aslmap.c index 55d0bb9..be43b22 100644 --- a/sys/contrib/dev/acpica/compiler/aslmap.c +++ b/sys/contrib/dev/acpica/compiler/aslmap.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -232,7 +232,8 @@ MpDisplayReservedNames ( * * Name - The ACPI reserved name * Args - Number of arguments to the method - * Flags - Whether this method must return a value or not + * Flags - Whether this method must return a value or not. Or if the + * name is a resource descriptor label. * ******************************************************************************/ @@ -264,24 +265,30 @@ const ASL_RESERVED_INFO ReservedMethods[] = { {"_ALP", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ {"_ALR", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ {"_ALT", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ + {"_ART", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ {"_ASI", 0, ASL_RSVD_RESOURCE_NAME}, {"_ASZ", 0, ASL_RSVD_RESOURCE_NAME}, {"_BAS", 0, ASL_RSVD_RESOURCE_NAME}, {"_BBN", 0, ASL_RSVD_RETURN_VALUE}, {"_BCL", 0, ASL_RSVD_RETURN_VALUE}, {"_BCM", 1, 0}, + {"_BCT", 1, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ {"_BDN", 0, ASL_RSVD_RETURN_VALUE}, {"_BFS", 1, 0}, {"_BIF", 0, ASL_RSVD_RETURN_VALUE}, + {"_BIX", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ {"_BLT", 3, 0}, /* Acpi 3.0 */ {"_BM_", 0, ASL_RSVD_RESOURCE_NAME}, + {"_BMA", 1, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ {"_BMC", 1, 0}, /* Acpi 3.0 */ {"_BMD", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ + {"_BMS", 1, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ {"_BQC", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ {"_BST", 0, ASL_RSVD_RETURN_VALUE}, {"_BTM", 1, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ {"_BTP", 1, 0}, {"_CBA", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ + {"_CDM", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ {"_CID", 0, ASL_RSVD_RETURN_VALUE}, {"_CRS", 0, ASL_RSVD_RETURN_VALUE}, {"_CRT", 0, ASL_RSVD_RETURN_VALUE}, @@ -300,6 +307,7 @@ const ASL_RESERVED_INFO ReservedMethods[] = { {"_DSM", 4, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ {"_DSS", 1, 0}, {"_DSW", 3, 0}, /* Acpi 3.0 */ + {"_DTI", 1, 0}, /* Acpi 4.0 */ {"_EC_", 0, ASL_RSVD_RETURN_VALUE}, {"_EDL", 0, ASL_RSVD_RETURN_VALUE}, {"_EJ0", 1, 0}, @@ -312,7 +320,13 @@ const ASL_RESERVED_INFO ReservedMethods[] = { {"_FDE", 0, ASL_RSVD_RETURN_VALUE}, {"_FDI", 0, ASL_RSVD_RETURN_VALUE}, {"_FDM", 1, 0}, + {"_FIF", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ {"_FIX", 0, ASL_RSVD_RETURN_VALUE}, + {"_FPS", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ + {"_FSL", 1, 0}, /* Acpi 4.0 */ + {"_FST", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ + {"_GAI", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ + {"_GHL", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ {"_GL_", 0, ASL_RSVD_RETURN_VALUE}, {"_GLK", 0, ASL_RSVD_RETURN_VALUE}, {"_GPD", 0, ASL_RSVD_RETURN_VALUE}, @@ -338,28 +352,39 @@ const ASL_RESERVED_INFO ReservedMethods[] = { {"_MAF", 0, ASL_RSVD_RESOURCE_NAME}, {"_MAT", 0, ASL_RSVD_RETURN_VALUE}, {"_MAX", 0, ASL_RSVD_RESOURCE_NAME}, + {"_MBM", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ {"_MEM", 0, ASL_RSVD_RESOURCE_NAME}, {"_MIF", 0, ASL_RSVD_RESOURCE_NAME}, {"_MIN", 0, ASL_RSVD_RESOURCE_NAME}, {"_MLS", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ {"_MSG", 1, 0}, + {"_MSM", 4, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ {"_MTP", 0, ASL_RSVD_RESOURCE_NAME}, + {"_NTT", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ {"_OFF", 0, 0}, {"_ON_", 0, 0}, {"_OS_", 0, ASL_RSVD_RETURN_VALUE}, {"_OSC", 4, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ {"_OSI", 1, ASL_RSVD_RETURN_VALUE}, {"_OST", 3, 0}, /* Acpi 3.0 */ + {"_PAI", 1, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ {"_PCL", 0, ASL_RSVD_RETURN_VALUE}, {"_PCT", 0, ASL_RSVD_RETURN_VALUE}, {"_PDC", 1, 0}, + {"_PDL", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ {"_PIC", 1, 0}, + {"_PIF", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ {"_PLD", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ + {"_PMC", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ + {"_PMD", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ + {"_PMM", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ {"_PPC", 0, ASL_RSVD_RETURN_VALUE}, {"_PPE", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ {"_PR0", 0, ASL_RSVD_RETURN_VALUE}, {"_PR1", 0, ASL_RSVD_RETURN_VALUE}, {"_PR2", 0, ASL_RSVD_RETURN_VALUE}, + {"_PR3", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ + {"_PRL", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ {"_PRS", 0, ASL_RSVD_RETURN_VALUE}, {"_PRT", 0, ASL_RSVD_RETURN_VALUE}, {"_PRW", 0, ASL_RSVD_RETURN_VALUE}, @@ -375,7 +400,9 @@ const ASL_RESERVED_INFO ReservedMethods[] = { {"_PSV", 0, ASL_RSVD_RETURN_VALUE}, {"_PSW", 1, 0}, {"_PTC", 0, ASL_RSVD_RETURN_VALUE}, + {"_PTP", 2, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ {"_PTS", 1, 0}, + {"_PUR", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ {"_PXM", 0, ASL_RSVD_RETURN_VALUE}, {"_RBO", 0, ASL_RSVD_RESOURCE_NAME}, {"_RBW", 0, ASL_RSVD_RESOURCE_NAME}, @@ -407,6 +434,7 @@ const ASL_RESERVED_INFO ReservedMethods[] = { {"_SCP", 0x13, 0}, /* Acpi 1.0 - one arg; Acpi 3.0 - three args */ {"_SDD", 1, 0}, /* Acpi 3.0 */ {"_SEG", 0, ASL_RSVD_RETURN_VALUE}, + {"_SHL", 1, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ {"_SHR", 0, ASL_RSVD_RESOURCE_NAME}, {"_SI_", 0, ASL_RSVD_SCOPE}, {"_SIZ", 0, ASL_RSVD_RESOURCE_NAME}, @@ -417,12 +445,16 @@ const ASL_RESERVED_INFO ReservedMethods[] = { {"_SST", 1, 0}, {"_STA", 0, ASL_RSVD_RETURN_VALUE}, {"_STM", 3, 0}, + {"_STP", 2, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ {"_STR", 0, ASL_RSVD_RETURN_VALUE}, + {"_STV", 2, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ {"_SUN", 0, ASL_RSVD_RETURN_VALUE}, {"_SWS", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ {"_TC1", 0, ASL_RSVD_RETURN_VALUE}, {"_TC2", 0, ASL_RSVD_RETURN_VALUE}, {"_TDL", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0b */ + {"_TIP", 1, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ + {"_TIV", 1, ASL_RSVD_RETURN_VALUE}, /* Acpi 4.0 */ {"_TMP", 0, ASL_RSVD_RETURN_VALUE}, {"_TPC", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ {"_TPT", 1, 0}, /* Acpi 3.0 */ @@ -681,6 +713,7 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] = /* REGIONSPACE_CMOS */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_CMOS, 0, 0), /* REGIONSPACE_EC */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_EC, 0, 0), /* REGIONSPACE_IO */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_IO, 0, 0), +/* REGIONSPACE_IPMI */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_IPMI, 0, 0), /* REGIONSPACE_MEM */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_MEMORY, 0, 0), /* REGIONSPACE_PCI */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_PCI_CONFIG, 0, 0), /* REGIONSPACE_PCIBAR */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_PCI_BAR, 0, 0), diff --git a/sys/contrib/dev/acpica/compiler/aslopcodes.c b/sys/contrib/dev/acpica/compiler/aslopcodes.c index ba5b41c..b1a5692 100644 --- a/sys/contrib/dev/acpica/compiler/aslopcodes.c +++ b/sys/contrib/dev/acpica/compiler/aslopcodes.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -328,7 +328,7 @@ OpcSetOptimalIntegerSize ( } break; - case ACPI_INTEGER_MAX: + case ACPI_UINT64_MAX: /* Check for table integer width (32 or 64) */ @@ -568,7 +568,7 @@ OpcDoEisaId ( if (i < 3) { - if (!isupper (InString[i])) + if (!isupper ((int) InString[i])) { Status = AE_BAD_PARAMETER; } @@ -576,7 +576,7 @@ OpcDoEisaId ( /* Last 4 characters must be hex digits */ - else if (!isxdigit (InString[i])) + else if (!isxdigit ((int) InString[i])) { Status = AE_BAD_PARAMETER; } @@ -666,7 +666,7 @@ OpcDoUuId ( } else { - if (!isxdigit (InString[i])) + if (!isxdigit ((int) InString[i])) { Status = AE_BAD_PARAMETER; } diff --git a/sys/contrib/dev/acpica/compiler/asloperands.c b/sys/contrib/dev/acpica/compiler/asloperands.c index 4e6d3b1..772c89d 100644 --- a/sys/contrib/dev/acpica/compiler/asloperands.c +++ b/sys/contrib/dev/acpica/compiler/asloperands.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -604,7 +604,7 @@ OpnDoRegion ( } else { - Op->Asl.Value.Integer = ACPI_INTEGER_MAX; + Op->Asl.Value.Integer = ACPI_UINT64_MAX; } } @@ -788,20 +788,30 @@ OpnDoPackage ( if ((PackageLengthOp->Asl.ParseOpcode == PARSEOP_INTEGER) || (PackageLengthOp->Asl.ParseOpcode == PARSEOP_QWORDCONST)) { - if (PackageLengthOp->Asl.Value.Integer >= PackageLength) + if (PackageLengthOp->Asl.Value.Integer > PackageLength) { - /* Allow package to be longer than the initializer list */ + /* + * Allow package length to be longer than the initializer + * list -- but if the length of initializer list is nonzero, + * issue a message since this is probably a coding error, + * even though technically legal. + */ + if (PackageLength > 0) + { + AslError (ASL_REMARK, ASL_MSG_LIST_LENGTH_SHORT, + PackageLengthOp, NULL); + } PackageLength = (UINT32) PackageLengthOp->Asl.Value.Integer; } - else + else if (PackageLengthOp->Asl.Value.Integer < PackageLength) { /* - * Initializer list is longer than the package length. This - * is an error as per the ACPI spec. + * The package length is smaller than the length of the + * initializer list. This is an error as per the ACPI spec. */ - AslError (ASL_ERROR, ASL_MSG_LIST_LENGTH, - PackageLengthOp->Asl.Next, NULL); + AslError (ASL_ERROR, ASL_MSG_LIST_LENGTH_LONG, + PackageLengthOp, NULL); } } @@ -997,7 +1007,7 @@ OpnDoDefinitionBlock ( for (i = 0; i < 4; i++) { - if (!isalnum (Gbl_TableSignature[i])) + if (!isalnum ((int) Gbl_TableSignature[i])) { AslError (ASL_ERROR, ASL_MSG_TABLE_SIGNATURE, Child, "Contains non-alphanumeric characters"); diff --git a/sys/contrib/dev/acpica/compiler/aslopt.c b/sys/contrib/dev/acpica/compiler/aslopt.c index 53ae3ce..89c7baa 100644 --- a/sys/contrib/dev/acpica/compiler/aslopt.c +++ b/sys/contrib/dev/acpica/compiler/aslopt.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/compiler/aslresource.c b/sys/contrib/dev/acpica/compiler/aslresource.c index 59b75c2..3242ba7 100644 --- a/sys/contrib/dev/acpica/compiler/aslresource.c +++ b/sys/contrib/dev/acpica/compiler/aslresource.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -184,7 +184,7 @@ RsCreateBitField ( { Op->Asl.ExternalName = Name; - Op->Asl.Value.Integer = ((ACPI_INTEGER) ByteOffset * 8) + BitOffset; + Op->Asl.Value.Integer = ((UINT64) ByteOffset * 8) + BitOffset; Op->Asl.CompileFlags |= (NODE_IS_RESOURCE_FIELD | NODE_IS_BIT_OFFSET); } diff --git a/sys/contrib/dev/acpica/compiler/aslrestype1.c b/sys/contrib/dev/acpica/compiler/aslrestype1.c index 0de4d6f..036abdf 100644 --- a/sys/contrib/dev/acpica/compiler/aslrestype1.c +++ b/sys/contrib/dev/acpica/compiler/aslrestype1.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/compiler/aslrestype2.c b/sys/contrib/dev/acpica/compiler/aslrestype2.c index 672c31a..48be853 100644 --- a/sys/contrib/dev/acpica/compiler/aslrestype2.c +++ b/sys/contrib/dev/acpica/compiler/aslrestype2.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/compiler/aslstartup.c b/sys/contrib/dev/acpica/compiler/aslstartup.c index 45ec82b..bbaa608 100644 --- a/sys/contrib/dev/acpica/compiler/aslstartup.c +++ b/sys/contrib/dev/acpica/compiler/aslstartup.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/compiler/aslstubs.c b/sys/contrib/dev/acpica/compiler/aslstubs.c index 227b1cf..ebc0a7d 100644 --- a/sys/contrib/dev/acpica/compiler/aslstubs.c +++ b/sys/contrib/dev/acpica/compiler/aslstubs.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -119,6 +119,7 @@ #include <contrib/dev/acpica/include/actables.h> #include <contrib/dev/acpica/include/acevents.h> #include <contrib/dev/acpica/include/acinterp.h> +#include <contrib/dev/acpica/include/acnamesp.h> #define _COMPONENT ACPI_COMPILER ACPI_MODULE_NAME ("aslstubs") @@ -136,6 +137,12 @@ AeLocalGetRootPointer ( return 0; } +void +AcpiNsExecModuleCodeList ( + void) +{ +} + ACPI_STATUS AcpiHwReadPort ( ACPI_IO_ADDRESS Address, diff --git a/sys/contrib/dev/acpica/compiler/asltransform.c b/sys/contrib/dev/acpica/compiler/asltransform.c index ca0d4b8..f03f1fe 100644 --- a/sys/contrib/dev/acpica/compiler/asltransform.c +++ b/sys/contrib/dev/acpica/compiler/asltransform.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -468,6 +468,8 @@ TrDoSwitch ( ACPI_PARSE_OBJECT *NewOp; ACPI_PARSE_OBJECT *NewOp2; ACPI_PARSE_OBJECT *MethodOp; + ACPI_PARSE_OBJECT *StoreOp; + ACPI_PARSE_OBJECT *BreakOp; char *PredicateValueName; UINT16 Index; UINT32 Btype; @@ -552,7 +554,7 @@ TrDoSwitch ( NewOp = NewOp2; NewOp2 = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, - (ACPI_INTEGER) ACPI_TO_INTEGER (PredicateValueName)); + (UINT64) ACPI_TO_INTEGER (PredicateValueName)); NewOp->Asl.Next = NewOp2; TrAmlInitLineNumbers (NewOp2, Predicate); @@ -610,7 +612,7 @@ TrDoSwitch ( * CaseOp->Child->Peer is the beginning of the case block */ NewOp = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, - (ACPI_INTEGER) ACPI_TO_INTEGER (PredicateValueName)); + (UINT64) ACPI_TO_INTEGER (PredicateValueName)); NewOp->Asl.Next = Predicate; TrAmlInitLineNumbers (NewOp, Predicate); @@ -638,11 +640,7 @@ TrDoSwitch ( */ if (CurrentParentNode == StartNode) { - Conditional->Asl.Parent = CurrentParentNode->Asl.Parent; - - /* Link IF into the peer list */ - - TrAmlInsertPeer (CurrentParentNode, Conditional); + Conditional->Asl.Next = NULL; } else { @@ -695,6 +693,7 @@ TrDoSwitch ( { return; } + TrAmlInitNode (DefaultOp, PARSEOP_ELSE); DefaultOp->Asl.Parent = Conditional->Asl.Parent; @@ -762,7 +761,7 @@ TrDoSwitch ( /* Create the NameSeg child for the Name node */ NewOp2 = TrCreateValuedLeafNode (PARSEOP_NAMESEG, - (ACPI_INTEGER) ACPI_TO_INTEGER (PredicateValueName)); + (UINT64) ACPI_TO_INTEGER (PredicateValueName)); NewOp2->Asl.CompileFlags |= NODE_IS_NAME_DECLARATION; NewOp->Asl.Child = NewOp2; @@ -772,22 +771,22 @@ TrDoSwitch ( { case ACPI_BTYPE_INTEGER: NewOp2->Asl.Next = TrCreateValuedLeafNode (PARSEOP_ZERO, - (ACPI_INTEGER) 0); + (UINT64) 0); break; case ACPI_BTYPE_STRING: NewOp2->Asl.Next = TrCreateValuedLeafNode (PARSEOP_STRING_LITERAL, - (ACPI_INTEGER) ACPI_TO_INTEGER ("")); + (UINT64) ACPI_TO_INTEGER ("")); break; case ACPI_BTYPE_BUFFER: (void) TrLinkPeerNode (NewOp2, TrCreateValuedLeafNode (PARSEOP_BUFFER, - (ACPI_INTEGER) 0)); + (UINT64) 0)); Next = NewOp2->Asl.Next; (void) TrLinkChildren (Next, 1, TrCreateValuedLeafNode (PARSEOP_ZERO, - (ACPI_INTEGER) 1)); + (UINT64) 1)); (void) TrLinkPeerNode (Next->Asl.Child, - TrCreateValuedLeafNode (PARSEOP_DEFAULT_ARG, (ACPI_INTEGER) 0)); + TrCreateValuedLeafNode (PARSEOP_DEFAULT_ARG, (UINT64) 0)); TrAmlSetSubtreeParent (Next->Asl.Child, Next); break; @@ -799,22 +798,44 @@ TrDoSwitch ( TrAmlSetSubtreeParent (NewOp2, NewOp); /* - * Transform the Switch() into a Store() node which will be used to save the + * Transform the Switch() into a While(One)-Break node. + * And create a Store() node which will be used to save the * Switch() value. The store is of the form: Store (Value, _T_x) * where _T_x is the temp variable. */ - TrAmlInitNode (StartNode, PARSEOP_STORE); - StartNode->Asl.Child = NULL; + TrAmlInitNode (StartNode, PARSEOP_WHILE); + NewOp = TrCreateLeafNode (PARSEOP_ONE); + NewOp->Asl.Next = Predicate->Asl.Next; + NewOp->Asl.Parent = StartNode; + StartNode->Asl.Child = NewOp; + + /* Create a Store() node */ + + StoreOp = TrCreateLeafNode (PARSEOP_STORE); + StoreOp->Asl.Parent = StartNode; + TrAmlInsertPeer (NewOp, StoreOp); /* Complete the Store subtree */ - StartNode->Asl.Child = Predicate; - Predicate->Asl.Parent = StartNode; + StoreOp->Asl.Child = Predicate; + Predicate->Asl.Parent = StoreOp; NewOp = TrCreateValuedLeafNode (PARSEOP_NAMESEG, - (ACPI_INTEGER) ACPI_TO_INTEGER (PredicateValueName)); - NewOp->Asl.Parent = StartNode; + (UINT64) ACPI_TO_INTEGER (PredicateValueName)); + NewOp->Asl.Parent = StoreOp; Predicate->Asl.Next = NewOp; + + /* Create a Break() node and insert it into the end of While() */ + + Conditional = StartNode->Asl.Child; + while (Conditional->Asl.Next) + { + Conditional = Conditional->Asl.Next; + } + + BreakOp = TrCreateLeafNode (PARSEOP_BREAK); + BreakOp->Asl.Parent = StartNode; + TrAmlInsertPeer (Conditional, BreakOp); } diff --git a/sys/contrib/dev/acpica/compiler/asltree.c b/sys/contrib/dev/acpica/compiler/asltree.c index 7e161a7..438a235 100644 --- a/sys/contrib/dev/acpica/compiler/asltree.c +++ b/sys/contrib/dev/acpica/compiler/asltree.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -490,7 +490,7 @@ TrCreateLeafNode ( ACPI_PARSE_OBJECT * TrCreateValuedLeafNode ( UINT32 ParseOpcode, - ACPI_INTEGER Value) + UINT64 Value) { ACPI_PARSE_OBJECT *Op; diff --git a/sys/contrib/dev/acpica/compiler/asltypes.h b/sys/contrib/dev/acpica/compiler/asltypes.h index 6b3c424..9e1d426 100644 --- a/sys/contrib/dev/acpica/compiler/asltypes.h +++ b/sys/contrib/dev/acpica/compiler/asltypes.h @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -255,6 +255,14 @@ typedef enum #define ASL_NUM_FILES (ASL_MAX_FILE_TYPE + 1) +typedef struct asl_include_dir +{ + char *Dir; + struct asl_include_dir *Next; + +} ASL_INCLUDE_DIR; + + /* An entry in the exception list, one for each error/warning */ typedef struct asl_error_msg @@ -361,7 +369,8 @@ typedef enum ASL_MSG_INVALID_TIME, ASL_MSG_INVALID_TYPE, ASL_MSG_INVALID_UUID, - ASL_MSG_LIST_LENGTH, + ASL_MSG_LIST_LENGTH_LONG, + ASL_MSG_LIST_LENGTH_SHORT, ASL_MSG_LISTING_FILE_OPEN, ASL_MSG_LISTING_FILENAME, ASL_MSG_LOCAL_INIT, @@ -480,7 +489,8 @@ char *AslMessages [] = { /* ASL_MSG_INVALID_TIME */ "Time parameter too long (255 max)", /* ASL_MSG_INVALID_TYPE */ "Invalid type", /* ASL_MSG_INVALID_UUID */ "UUID string must be of the form \"aabbccdd-eeff-gghh-iijj-kkllmmnnoopp\"", -/* ASL_MSG_LIST_LENGTH */ "Initializer list too long", +/* ASL_MSG_LIST_LENGTH_LONG */ "Initializer list longer than declared package length", +/* ASL_MSG_LIST_LENGTH_SHORT */ "Initializer list shorter than declared package length", /* ASL_MSG_LISTING_FILE_OPEN */ "Could not open listing file", /* ASL_MSG_LISTING_FILENAME */ "Could not create listing filename", /* ASL_MSG_LOCAL_INIT */ "Method local variable is not initialized", @@ -561,11 +571,6 @@ char *AslErrorLevel [ASL_NUM_REPORT_LEVELS] = { #define ASL_ERROR_LEVEL_LENGTH 8 /* Length of strings above */ -/* Exception counters */ - -UINT32 Gbl_ExceptionCount[ASL_NUM_REPORT_LEVELS] = {0,0,0,0,0,0}; - -#endif - +#endif /* ASL_EXCEPTIONS */ #endif /* __ASLTYPES_H */ diff --git a/sys/contrib/dev/acpica/compiler/aslutils.c b/sys/contrib/dev/acpica/compiler/aslutils.c index a226a3d..bc315cc 100644 --- a/sys/contrib/dev/acpica/compiler/aslutils.c +++ b/sys/contrib/dev/acpica/compiler/aslutils.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -142,7 +142,7 @@ static ACPI_STATUS UtStrtoul64 ( char *String, UINT32 Base, - ACPI_INTEGER *RetInteger); + UINT64 *RetInteger); static void UtPadNameWithUnderscores ( @@ -846,12 +846,12 @@ UtAttachNamepathToOwner ( * ******************************************************************************/ -ACPI_INTEGER +UINT64 UtDoConstant ( char *String) { ACPI_STATUS Status; - ACPI_INTEGER Converted; + UINT64 Converted; char ErrBuf[64]; @@ -888,11 +888,11 @@ static ACPI_STATUS UtStrtoul64 ( char *String, UINT32 Base, - ACPI_INTEGER *RetInteger) + UINT64 *RetInteger) { UINT32 Index; UINT32 Sign; - ACPI_INTEGER ReturnValue = 0; + UINT64 ReturnValue = 0; ACPI_STATUS Status = AE_OK; @@ -916,7 +916,7 @@ UtStrtoul64 ( /* Skip over any white space in the buffer: */ - while (isspace (*String) || *String == '\t') + while (isspace ((int) *String) || *String == '\t') { ++String; } @@ -948,7 +948,7 @@ UtStrtoul64 ( { if (*String == '0') { - if (tolower (*(++String)) == 'x') + if (tolower ((int) *(++String)) == 'x') { Base = 16; ++String; @@ -975,7 +975,7 @@ UtStrtoul64 ( if (Base == 16 && *String == '0' && - tolower (*(++String)) == 'x') + tolower ((int) *(++String)) == 'x') { String++; } @@ -984,14 +984,14 @@ UtStrtoul64 ( while (*String) { - if (isdigit (*String)) + if (isdigit ((int) *String)) { Index = ((UINT8) *String) - '0'; } else { - Index = (UINT8) toupper (*String); - if (isupper ((char) Index)) + Index = (UINT8) toupper ((int) *String); + if (isupper ((int) Index)) { Index = Index - 'A' + 10; } @@ -1008,8 +1008,8 @@ UtStrtoul64 ( /* Check to see if value is out of range: */ - if (ReturnValue > ((ACPI_INTEGER_MAX - (ACPI_INTEGER) Index) / - (ACPI_INTEGER) Base)) + if (ReturnValue > ((ACPI_UINT64_MAX - (UINT64) Index) / + (UINT64) Base)) { goto ErrorExit; } diff --git a/sys/contrib/dev/acpica/debugger/dbcmds.c b/sys/contrib/dev/acpica/debugger/dbcmds.c index 0ea12a2..0c704e7 100644 --- a/sys/contrib/dev/acpica/debugger/dbcmds.c +++ b/sys/contrib/dev/acpica/debugger/dbcmds.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -130,6 +130,7 @@ #define _COMPONENT ACPI_CA_DEBUGGER ACPI_MODULE_NAME ("dbcmds") + /* Local prototypes */ static ACPI_STATUS @@ -382,7 +383,7 @@ AcpiDbFindReferences ( /* Search all nodes in namespace */ (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, - AcpiDbWalkForReferences, (void *) ObjDesc, NULL); + AcpiDbWalkForReferences, NULL, (void *) ObjDesc, NULL); } @@ -474,7 +475,7 @@ AcpiDbCheckPredefinedNames ( /* Search all nodes in namespace */ (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, - AcpiDbWalkForPredefinedNames, (void *) &Count, NULL); + AcpiDbWalkForPredefinedNames, NULL, (void *) &Count, NULL); AcpiOsPrintf ("Found %d predefined names in the namespace\n", Count); } @@ -500,17 +501,16 @@ AcpiDbWalkForExecute ( void *Context, void **ReturnValue) { - ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; - UINT32 *Count = (UINT32 *) Context; - const ACPI_PREDEFINED_INFO *Predefined; - ACPI_BUFFER ReturnObj; - ACPI_STATUS Status; - char *Pathname; - ACPI_BUFFER Buffer; + ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; + ACPI_EXECUTE_WALK *Info = (ACPI_EXECUTE_WALK *) Context; + ACPI_BUFFER ReturnObj; + ACPI_STATUS Status; + char *Pathname; UINT32 i; ACPI_DEVICE_INFO *ObjInfo; ACPI_OBJECT_LIST ParamObjects; ACPI_OBJECT Params[ACPI_METHOD_NUM_ARGS]; + const ACPI_PREDEFINED_INFO *Predefined; Predefined = AcpiNsCheckForPredefinedName (Node); @@ -532,8 +532,7 @@ AcpiDbWalkForExecute ( /* Get the object info for number of method parameters */ - Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - Status = AcpiGetObjectInfo (ObjHandle, &Buffer); + Status = AcpiGetObjectInfo (ObjHandle, &ObjInfo); if (ACPI_FAILURE (Status)) { return (Status); @@ -542,10 +541,8 @@ AcpiDbWalkForExecute ( ParamObjects.Pointer = NULL; ParamObjects.Count = 0; - ObjInfo = Buffer.Pointer; if (ObjInfo->Type == ACPI_TYPE_METHOD) { - /* Setup default parameters */ for (i = 0; i < ObjInfo->ParamCount; i++) @@ -558,12 +555,10 @@ AcpiDbWalkForExecute ( ParamObjects.Count = ObjInfo->ParamCount; } - ACPI_FREE (Buffer.Pointer); - + ACPI_FREE (ObjInfo); ReturnObj.Pointer = NULL; ReturnObj.Length = ACPI_ALLOCATE_BUFFER; - /* Do the actual method execution */ AcpiGbl_MethodExecuting = TRUE; @@ -572,11 +567,21 @@ AcpiDbWalkForExecute ( AcpiOsPrintf ("%-32s returned %s\n", Pathname, AcpiFormatException (Status)); AcpiGbl_MethodExecuting = FALSE; - ACPI_FREE (Pathname); - (*Count)++; - return (AE_OK); + /* Ignore status from method execution */ + + Status = AE_OK; + + /* Update count, check if we have executed enough methods */ + + Info->Count++; + if (Info->Count >= Info->MaxCount) + { + Status = AE_CTRL_TERMINATE; + } + + return (Status); } @@ -584,27 +589,37 @@ AcpiDbWalkForExecute ( * * FUNCTION: AcpiDbBatchExecute * - * PARAMETERS: None + * PARAMETERS: CountArg - Max number of methods to execute * * RETURN: None * - * DESCRIPTION: Namespace batch execution. + * DESCRIPTION: Namespace batch execution. Execute predefined names in the + * namespace, up to the max count, if specified. * ******************************************************************************/ void AcpiDbBatchExecute ( - void) + char *CountArg) { - UINT32 Count = 0; + ACPI_EXECUTE_WALK Info; + + + Info.Count = 0; + Info.MaxCount = ACPI_UINT32_MAX; + + if (CountArg) + { + Info.MaxCount = ACPI_STRTOUL (CountArg, NULL, 0); + } /* Search all nodes in namespace */ (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, - AcpiDbWalkForExecute, (void *) &Count, NULL); + AcpiDbWalkForExecute, NULL, (void *) &Info, NULL); - AcpiOsPrintf ("Executed %d predefined names in the namespace\n", Count); + AcpiOsPrintf ("Executed %d predefined names in the namespace\n", Info.Count); } @@ -1150,15 +1165,13 @@ AcpiDbSetMethodData ( /* Create and initialize the new object */ - ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); + ObjDesc = AcpiUtCreateIntegerObject ((UINT64) Value); if (!ObjDesc) { AcpiOsPrintf ("Could not create an internal object\n"); return; } - ObjDesc->Integer.Value = Value; - /* Store the new object into the target */ switch (Type) @@ -1310,7 +1323,7 @@ AcpiDbDisplayObjects ( /* Walk the namespace from the root */ (void) AcpiWalkNamespace (Type, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, - AcpiDbWalkForSpecificObjects, (void *) &Info, NULL); + AcpiDbWalkForSpecificObjects, NULL, (void *) &Info, NULL); AcpiOsPrintf ( "\nFound %u objects of type [%s] in the current ACPI Namespace\n", @@ -1426,7 +1439,7 @@ AcpiDbFindNameInNamespace ( /* Walk the namespace from the root */ (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, - AcpiDbWalkAndMatchName, AcpiName, NULL); + AcpiDbWalkAndMatchName, NULL, AcpiName, NULL); AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); return (AE_OK); @@ -1927,7 +1940,7 @@ AcpiDbCheckIntegrity ( /* Search all nodes in namespace */ (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, - AcpiDbIntegrityWalk, (void *) &Info, NULL); + AcpiDbIntegrityWalk, NULL, (void *) &Info, NULL); AcpiOsPrintf ("Verified %d namespace nodes with %d Objects\n", Info.Nodes, Info.Objects); @@ -1997,12 +2010,17 @@ AcpiDbBusWalk ( ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; ACPI_STATUS Status; ACPI_BUFFER Buffer; - ACPI_INTEGER ADR; - ACPI_DEVICE_ID Id; - ACPI_COMPATIBLE_ID_LIST *Cid; ACPI_NAMESPACE_NODE *TempNode; + ACPI_DEVICE_INFO *Info; + UINT32 i; + if ((Node->Type != ACPI_TYPE_DEVICE) && + (Node->Type != ACPI_TYPE_PROCESSOR)) + { + return (AE_OK); + } + /* Exit if there is no _PRT under this device */ Status = AcpiGetHandle (Node, METHOD_NAME__PRT, @@ -2022,57 +2040,70 @@ AcpiDbBusWalk ( return (AE_OK); } + Status = AcpiGetObjectInfo (ObjHandle, &Info); + if (ACPI_FAILURE (Status)) + { + return (AE_OK); + } + /* Display the full path */ - AcpiOsPrintf ("%-32s", (char *) Buffer.Pointer); + AcpiOsPrintf ("%-32s Type %X", (char *) Buffer.Pointer, Node->Type); ACPI_FREE (Buffer.Pointer); + if (Info->Flags & ACPI_PCI_ROOT_BRIDGE) + { + AcpiOsPrintf (" - Is PCI Root Bridge"); + } + AcpiOsPrintf ("\n"); + /* _PRT info */ - AcpiOsPrintf ("_PRT=%p", TempNode); + AcpiOsPrintf ("_PRT: %p\n", TempNode); - /* Get the _ADR value */ + /* Dump _ADR, _HID, _UID, _CID */ - Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR, Node, &ADR); - if (ACPI_FAILURE (Status)) + if (Info->Valid & ACPI_VALID_ADR) { - AcpiOsPrintf (" No _ADR "); + AcpiOsPrintf ("_ADR: %8.8X%8.8X\n", ACPI_FORMAT_UINT64 (Info->Address)); } else { - AcpiOsPrintf (" _ADR=%8.8X", (UINT32) ADR); + AcpiOsPrintf ("_ADR: <Not Present>\n"); } - /* Get the _HID if present */ - - Status = AcpiUtExecute_HID (Node, &Id); - if (ACPI_SUCCESS (Status)) + if (Info->Valid & ACPI_VALID_HID) { - AcpiOsPrintf (" _HID=%s", Id.Value); + AcpiOsPrintf ("_HID: %s\n", Info->HardwareId.String); } else { - AcpiOsPrintf (" "); + AcpiOsPrintf ("_HID: <Not Present>\n"); } - /* Get the _UID if present */ - - Status = AcpiUtExecute_UID (Node, &Id); - if (ACPI_SUCCESS (Status)) + if (Info->Valid & ACPI_VALID_UID) { - AcpiOsPrintf (" _UID=%s", Id.Value); + AcpiOsPrintf ("_UID: %s\n", Info->UniqueId.String); + } + else + { + AcpiOsPrintf ("_UID: <Not Present>\n"); } - /* Get the _CID if present */ - - Status = AcpiUtExecute_CID (Node, &Cid); - if (ACPI_SUCCESS (Status)) + if (Info->Valid & ACPI_VALID_CID) { - AcpiOsPrintf (" _CID=%s", Cid->Id[0].Value); - ACPI_FREE (Cid); + for (i = 0; i < Info->CompatibleIdList.Count; i++) + { + AcpiOsPrintf ("_CID: %s\n", + Info->CompatibleIdList.Ids[i].String); + } + } + else + { + AcpiOsPrintf ("_CID: <Not Present>\n"); } - AcpiOsPrintf ("\n"); + ACPI_FREE (Info); return (AE_OK); } @@ -2095,8 +2126,8 @@ AcpiDbGetBusInfo ( { /* Search all nodes in namespace */ - (void) AcpiWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, - AcpiDbBusWalk, NULL, NULL); + (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, + AcpiDbBusWalk, NULL, NULL, NULL); } #endif /* ACPI_DEBUGGER */ diff --git a/sys/contrib/dev/acpica/debugger/dbdisply.c b/sys/contrib/dev/acpica/debugger/dbdisply.c index 13ae528..179f6f6 100644 --- a/sys/contrib/dev/acpica/debugger/dbdisply.c +++ b/sys/contrib/dev/acpica/debugger/dbdisply.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -682,42 +682,52 @@ AcpiDbDisplayObjectType ( char *ObjectArg) { ACPI_HANDLE Handle; - ACPI_BUFFER Buffer; ACPI_DEVICE_INFO *Info; ACPI_STATUS Status; UINT32 i; Handle = ACPI_TO_POINTER (ACPI_STRTOUL (ObjectArg, NULL, 16)); - Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - Status = AcpiGetObjectInfo (Handle, &Buffer); - if (ACPI_SUCCESS (Status)) + Status = AcpiGetObjectInfo (Handle, &Info); + if (ACPI_FAILURE (Status)) { - Info = Buffer.Pointer; - AcpiOsPrintf ( - "S1D-%2.2X S2D-%2.2X S3D-%2.2X S4D-%2.2X HID: %s, ADR: %8.8X%8.8X, Status %8.8X\n", - Info->HighestDstates[0], Info->HighestDstates[1], - Info->HighestDstates[2], Info->HighestDstates[3], - Info->HardwareId.Value, - ACPI_FORMAT_UINT64 (Info->Address), - Info->CurrentStatus); - - if (Info->Valid & ACPI_VALID_CID) - { - for (i = 0; i < Info->CompatibilityId.Count; i++) - { - AcpiOsPrintf ("CID #%d: %s\n", i, - Info->CompatibilityId.Id[i].Value); - } - } + AcpiOsPrintf ("Could not get object info, %s\n", + AcpiFormatException (Status)); + return; + } + + AcpiOsPrintf ("ADR: %8.8X%8.8X, STA: %8.8X, Flags: %X\n", + ACPI_FORMAT_UINT64 (Info->Address), + Info->CurrentStatus, Info->Flags); + + AcpiOsPrintf ("S1D-%2.2X S2D-%2.2X S3D-%2.2X S4D-%2.2X\n", + Info->HighestDstates[0], Info->HighestDstates[1], + Info->HighestDstates[2], Info->HighestDstates[3]); - ACPI_FREE (Info); + AcpiOsPrintf ("S0W-%2.2X S1W-%2.2X S2W-%2.2X S3W-%2.2X S4W-%2.2X\n", + Info->LowestDstates[0], Info->LowestDstates[1], + Info->LowestDstates[2], Info->LowestDstates[3], + Info->LowestDstates[4]); + + if (Info->Valid & ACPI_VALID_HID) + { + AcpiOsPrintf ("HID: %s\n", Info->HardwareId.String); } - else + if (Info->Valid & ACPI_VALID_UID) + { + AcpiOsPrintf ("UID: %s\n", Info->UniqueId.String); + } + if (Info->Valid & ACPI_VALID_CID) { - AcpiOsPrintf ("%s\n", AcpiFormatException (Status)); + for (i = 0; i < Info->CompatibleIdList.Count; i++) + { + AcpiOsPrintf ("CID %d: %s\n", i, + Info->CompatibleIdList.Ids[i].String); + } } + + ACPI_FREE (Info); } diff --git a/sys/contrib/dev/acpica/debugger/dbexec.c b/sys/contrib/dev/acpica/debugger/dbexec.c index 0c0e6ca..d940384 100644 --- a/sys/contrib/dev/acpica/debugger/dbexec.c +++ b/sys/contrib/dev/acpica/debugger/dbexec.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -176,7 +176,6 @@ AcpiDbExecuteMethod ( ACPI_OBJECT_LIST ParamObjects; ACPI_OBJECT Params[ACPI_METHOD_NUM_ARGS]; ACPI_HANDLE Handle; - ACPI_BUFFER Buffer; UINT32 i; ACPI_DEVICE_INFO *ObjInfo; @@ -196,8 +195,7 @@ AcpiDbExecuteMethod ( /* Get the object info for number of method parameters */ - Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - Status = AcpiGetObjectInfo (Handle, &Buffer); + Status = AcpiGetObjectInfo (Handle, &ObjInfo); if (ACPI_FAILURE (Status)) { return (Status); @@ -206,7 +204,6 @@ AcpiDbExecuteMethod ( ParamObjects.Pointer = NULL; ParamObjects.Count = 0; - ObjInfo = Buffer.Pointer; if (ObjInfo->Type == ACPI_TYPE_METHOD) { /* Are there arguments to the method? */ @@ -246,7 +243,7 @@ AcpiDbExecuteMethod ( default: Params[i].Type = ACPI_TYPE_INTEGER; - Params[i].Integer.Value = i * (ACPI_INTEGER) 0x1000; + Params[i].Integer.Value = i * (UINT64) 0x1000; break; } } @@ -256,7 +253,7 @@ AcpiDbExecuteMethod ( } } - ACPI_FREE (Buffer.Pointer); + ACPI_FREE (ObjInfo); /* Prepare for a return object of arbitrary size */ @@ -456,7 +453,7 @@ AcpiDbExecute ( if (*Name == '*') { (void) AcpiWalkNamespace (ACPI_TYPE_METHOD, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, AcpiDbExecutionWalk, NULL, NULL); + ACPI_UINT32_MAX, AcpiDbExecutionWalk, NULL, NULL, NULL); return; } else @@ -487,7 +484,7 @@ AcpiDbExecute ( * Allow any handlers in separate threads to complete. * (Such as Notify handlers invoked from AML executed above). */ - AcpiOsSleep ((ACPI_INTEGER) 10); + AcpiOsSleep ((UINT64) 10); #ifdef ACPI_DEBUG_OUTPUT diff --git a/sys/contrib/dev/acpica/debugger/dbfileio.c b/sys/contrib/dev/acpica/debugger/dbfileio.c index 47cf825..ab38a6a 100644 --- a/sys/contrib/dev/acpica/debugger/dbfileio.c +++ b/sys/contrib/dev/acpica/debugger/dbfileio.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -150,9 +150,6 @@ AcpiDbCheckTextModeCorruption ( UINT32 TableLength, UINT32 FileLength); -static ACPI_STATUS -AeLocalLoadTable ( - ACPI_TABLE_HEADER *TablePtr); #endif /******************************************************************************* @@ -424,7 +421,7 @@ AcpiDbReadTable ( { /* Now validate the checksum */ - Status = AcpiTbChecksum ((void *) *Table, + Status = AcpiTbVerifyChecksum ((void *) *Table, ACPI_CAST_PTR (ACPI_TABLE_HEADER, *Table)->Length); if (Status == AE_BAD_CHECKSUM) diff --git a/sys/contrib/dev/acpica/debugger/dbhistry.c b/sys/contrib/dev/acpica/debugger/dbhistry.c index 23aec92..4439405 100644 --- a/sys/contrib/dev/acpica/debugger/dbhistry.c +++ b/sys/contrib/dev/acpica/debugger/dbhistry.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/debugger/dbinput.c b/sys/contrib/dev/acpica/debugger/dbinput.c index 358600e..67510fa 100644 --- a/sys/contrib/dev/acpica/debugger/dbinput.c +++ b/sys/contrib/dev/acpica/debugger/dbinput.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -644,7 +644,7 @@ AcpiDbCommandDispatch ( break; case CMD_BATCH: - AcpiDbBatchExecute (); + AcpiDbBatchExecute (AcpiGbl_DbArgs[1]); break; case CMD_BREAKPOINT: diff --git a/sys/contrib/dev/acpica/debugger/dbstats.c b/sys/contrib/dev/acpica/debugger/dbstats.c index 688d5b3..da5f6c0 100644 --- a/sys/contrib/dev/acpica/debugger/dbstats.c +++ b/sys/contrib/dev/acpica/debugger/dbstats.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -446,7 +446,7 @@ AcpiDbCountNamespaceObjects ( } (void) AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, FALSE, AcpiDbClassifyOneObject, NULL, NULL); + ACPI_UINT32_MAX, FALSE, AcpiDbClassifyOneObject, NULL, NULL, NULL); } diff --git a/sys/contrib/dev/acpica/debugger/dbutils.c b/sys/contrib/dev/acpica/debugger/dbutils.c index f394876..ab66d42 100644 --- a/sys/contrib/dev/acpica/debugger/dbutils.c +++ b/sys/contrib/dev/acpica/debugger/dbutils.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -275,6 +275,10 @@ AcpiDbDumpExternalObject ( AcpiOsPrintf ("[Buffer] Length %.2X = ", ObjDesc->Buffer.Length); if (ObjDesc->Buffer.Length) { + if (ObjDesc->Buffer.Length > 16) + { + AcpiOsPrintf ("\n"); + } AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, ObjDesc->Buffer.Pointer), ObjDesc->Buffer.Length, DB_DWORD_DISPLAY, _COMPONENT); } diff --git a/sys/contrib/dev/acpica/debugger/dbxface.c b/sys/contrib/dev/acpica/debugger/dbxface.c index 71ef171..b0162c2 100644 --- a/sys/contrib/dev/acpica/debugger/dbxface.c +++ b/sys/contrib/dev/acpica/debugger/dbxface.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/disassembler/dmbuffer.c b/sys/contrib/dev/acpica/disassembler/dmbuffer.c index 02a8465..a408355 100644 --- a/sys/contrib/dev/acpica/disassembler/dmbuffer.c +++ b/sys/contrib/dev/acpica/disassembler/dmbuffer.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/disassembler/dmnames.c b/sys/contrib/dev/acpica/disassembler/dmnames.c index c095d81..f210fe0 100644 --- a/sys/contrib/dev/acpica/disassembler/dmnames.c +++ b/sys/contrib/dev/acpica/disassembler/dmnames.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/disassembler/dmobject.c b/sys/contrib/dev/acpica/disassembler/dmobject.c index affae38..1bfeadd 100644 --- a/sys/contrib/dev/acpica/disassembler/dmobject.c +++ b/sys/contrib/dev/acpica/disassembler/dmobject.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/disassembler/dmopcode.c b/sys/contrib/dev/acpica/disassembler/dmopcode.c index d1781a1..57dfa95 100644 --- a/sys/contrib/dev/acpica/disassembler/dmopcode.c +++ b/sys/contrib/dev/acpica/disassembler/dmopcode.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -473,8 +473,8 @@ AcpiDmDisassembleOneOp ( case AML_QWORD_OP: - AcpiOsPrintf ("0x%8.8X%8.8X", Op->Common.Value.Integer64.Hi, - Op->Common.Value.Integer64.Lo); + AcpiOsPrintf ("0x%8.8X%8.8X", + ACPI_FORMAT_UINT64 (Op->Common.Value.Integer)); break; diff --git a/sys/contrib/dev/acpica/disassembler/dmresrc.c b/sys/contrib/dev/acpica/disassembler/dmresrc.c index 4293c00..ed3b1c1 100644 --- a/sys/contrib/dev/acpica/disassembler/dmresrc.c +++ b/sys/contrib/dev/acpica/disassembler/dmresrc.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/disassembler/dmresrcl.c b/sys/contrib/dev/acpica/disassembler/dmresrcl.c index 9b07e54..132263b 100644 --- a/sys/contrib/dev/acpica/disassembler/dmresrcl.c +++ b/sys/contrib/dev/acpica/disassembler/dmresrcl.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/disassembler/dmresrcs.c b/sys/contrib/dev/acpica/disassembler/dmresrcs.c index 8ac9974..798d113 100644 --- a/sys/contrib/dev/acpica/disassembler/dmresrcs.c +++ b/sys/contrib/dev/acpica/disassembler/dmresrcs.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/disassembler/dmutils.c b/sys/contrib/dev/acpica/disassembler/dmutils.c index 912c928..7bd0f45 100644 --- a/sys/contrib/dev/acpica/disassembler/dmutils.c +++ b/sys/contrib/dev/acpica/disassembler/dmutils.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -129,9 +129,6 @@ ACPI_MODULE_NAME ("dmutils") -ACPI_EXTERNAL_LIST *AcpiGbl_ExternalList = NULL; - - /* Data used in keeping track of fields */ #if 0 const char *AcpiGbl_FENames[] = @@ -202,121 +199,6 @@ const char *AcpiGbl_IrqDecode[] = }; -#ifdef ACPI_ASL_COMPILER -/******************************************************************************* - * - * FUNCTION: AcpiDmAddToExternalList - * - * PARAMETERS: Path - Internal (AML) path to the object - * - * RETURN: None - * - * DESCRIPTION: Insert a new path into the list of Externals which will in - * turn be emitted as an External() declaration in the disassembled - * output. - * - ******************************************************************************/ - -void -AcpiDmAddToExternalList ( - char *Path, - UINT8 Type, - UINT32 Value) -{ - char *ExternalPath; - ACPI_EXTERNAL_LIST *NewExternal; - ACPI_EXTERNAL_LIST *NextExternal; - ACPI_EXTERNAL_LIST *PrevExternal = NULL; - ACPI_STATUS Status; - - - if (!Path) - { - return; - } - - /* Externalize the ACPI path */ - - Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, Path, - NULL, &ExternalPath); - if (ACPI_FAILURE (Status)) - { - return; - } - - /* Ensure that we don't have duplicate externals */ - - NextExternal = AcpiGbl_ExternalList; - while (NextExternal) - { - /* Allow upgrade of type from ANY */ - - if (!ACPI_STRCMP (ExternalPath, NextExternal->Path)) - { - /* Duplicate method, check that the Value (ArgCount) is the same */ - - if ((NextExternal->Type == ACPI_TYPE_METHOD) && - (NextExternal->Value != Value)) - { - ACPI_ERROR ((AE_INFO, "Argument count mismatch for method %s %d %d", - NextExternal->Path, NextExternal->Value, Value)); - } - if (NextExternal->Type == ACPI_TYPE_ANY) - { - NextExternal->Type = Type; - NextExternal->Value = Value; - } - ACPI_FREE (ExternalPath); - return; - } - NextExternal = NextExternal->Next; - } - - /* Allocate and init a new External() descriptor */ - - NewExternal = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EXTERNAL_LIST)); - NewExternal->InternalPath = Path; - NewExternal->Path = ExternalPath; - NewExternal->Type = Type; - NewExternal->Value = Value; - NewExternal->Length = (UINT16) ACPI_STRLEN (ExternalPath); - - /* Link the new descriptor into the global list, ordered by string length */ - - NextExternal = AcpiGbl_ExternalList; - while (NextExternal) - { - if (NewExternal->Length <= NextExternal->Length) - { - if (PrevExternal) - { - PrevExternal->Next = NewExternal; - } - else - { - AcpiGbl_ExternalList = NewExternal; - } - - NewExternal->Next = NextExternal; - return; - } - - PrevExternal = NextExternal; - NextExternal = NextExternal->Next; - } - - if (PrevExternal) - { - PrevExternal->Next = NewExternal; - } - else - { - AcpiGbl_ExternalList = NewExternal; - } -} -#endif - - /******************************************************************************* * * FUNCTION: AcpiDmDecodeAttribute diff --git a/sys/contrib/dev/acpica/disassembler/dmwalk.c b/sys/contrib/dev/acpica/disassembler/dmwalk.c index 78745b1..bd89ddc 100644 --- a/sys/contrib/dev/acpica/disassembler/dmwalk.c +++ b/sys/contrib/dev/acpica/disassembler/dmwalk.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -130,6 +130,17 @@ #define DB_FULL_OP_INFO "[%4.4s] @%5.5X #%4.4X: " +/* Stub for non-compiler code */ + +#ifndef ACPI_ASL_COMPILER +void +AcpiDmEmitExternals ( + void) +{ + return; +} +#endif + /* Local prototypes */ static ACPI_STATUS @@ -148,69 +159,6 @@ static UINT32 AcpiDmBlockType ( ACPI_PARSE_OBJECT *Op); -static const char * -AcpiDmGetObjectTypeName ( - ACPI_OBJECT_TYPE Type); - -/* - * This table maps ACPI_OBJECT_TYPEs to the corresponding ASL - * ObjectTypeKeyword. Used to generate typed external declarations - */ -static const char *AcpiGbl_DmTypeNames[] = -{ - /* 00 */ "", /* Type ANY */ - /* 01 */ ", IntObj", - /* 02 */ ", StrObj", - /* 03 */ ", BuffObj", - /* 04 */ ", PkgObj", - /* 05 */ ", FieldUnitObj", - /* 06 */ ", DeviceObj", - /* 07 */ ", EventObj", - /* 08 */ ", MethodObj", - /* 09 */ ", MutexObj", - /* 10 */ ", OpRegionObj", - /* 11 */ ", PowerResObj", - /* 12 */ ", ProcessorObj", - /* 13 */ ", ThermalZoneObj", - /* 14 */ ", BuffFieldObj", - /* 15 */ ", DDBHandleObj", - /* 16 */ "", /* Debug object */ - /* 17 */ ", FieldUnitObj", - /* 18 */ ", FieldUnitObj", - /* 19 */ ", FieldUnitObj" -}; - - -/******************************************************************************* - * - * FUNCTION: AcpiDmGetObjectTypeName - * - * PARAMETERS: Type - An ACPI_OBJECT_TYPE - * - * RETURN: Pointer to a string - * - * DESCRIPTION: Map an object type to the ASL object type string. - * - ******************************************************************************/ - -static const char * -AcpiDmGetObjectTypeName ( - ACPI_OBJECT_TYPE Type) -{ - - if (Type == ACPI_TYPE_LOCAL_SCOPE) - { - Type = ACPI_TYPE_DEVICE; - } - - else if (Type > ACPI_TYPE_LOCAL_INDEX_FIELD) - { - return (""); - } - - return (AcpiGbl_DmTypeNames[Type]); -} - /******************************************************************************* * @@ -522,7 +470,6 @@ AcpiDmDescendingOp ( const ACPI_OPCODE_INFO *OpInfo; UINT32 Name; ACPI_PARSE_OBJECT *NextOp; - ACPI_EXTERNAL_LIST *NextExternal; if (Op->Common.DisasmFlags & ACPI_PARSEOP_IGNORE) @@ -554,35 +501,7 @@ AcpiDmDescendingOp ( /* Emit all External() declarations here */ - if (AcpiGbl_ExternalList) - { - /* - * Walk the list of externals (unresolved references) - * found during parsing - */ - while (AcpiGbl_ExternalList) - { - AcpiOsPrintf (" External (%s%s", - AcpiGbl_ExternalList->Path, - AcpiDmGetObjectTypeName (AcpiGbl_ExternalList->Type)); - - if (AcpiGbl_ExternalList->Type == ACPI_TYPE_METHOD) - { - AcpiOsPrintf (") // %d Arguments\n", AcpiGbl_ExternalList->Value); - } - else - { - AcpiOsPrintf (")\n"); - } - - NextExternal = AcpiGbl_ExternalList->Next; - ACPI_FREE (AcpiGbl_ExternalList->Path); - ACPI_FREE (AcpiGbl_ExternalList); - AcpiGbl_ExternalList = NextExternal; - } - AcpiOsPrintf ("\n"); - } - + AcpiDmEmitExternals (); return (AE_OK); } } diff --git a/sys/contrib/dev/acpica/dispatcher/dsfield.c b/sys/contrib/dev/acpica/dispatcher/dsfield.c index 17d538a..e33d6a8 100644 --- a/sys/contrib/dev/acpica/dispatcher/dsfield.c +++ b/sys/contrib/dev/acpica/dispatcher/dsfield.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -211,9 +211,12 @@ AcpiDsCreateBufferField ( Flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_ERROR_IF_FOUND; - /* Mark node temporary if we are executing a method */ - - if (WalkState->MethodNode) + /* + * Mark node temporary if we are executing a normal control + * method. (Don't mark if this is a module-level code method) + */ + if (WalkState->MethodNode && + !(WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL)) { Flags |= ACPI_NS_TEMPORARY; } @@ -311,7 +314,7 @@ AcpiDsGetFieldNames ( ACPI_PARSE_OBJECT *Arg) { ACPI_STATUS Status; - ACPI_INTEGER Position; + UINT64 Position; ACPI_FUNCTION_TRACE_PTR (DsGetFieldNames, Info); @@ -335,8 +338,8 @@ AcpiDsGetFieldNames ( { case AML_INT_RESERVEDFIELD_OP: - Position = (ACPI_INTEGER) Info->FieldBitPosition - + (ACPI_INTEGER) Arg->Common.Value.Size; + Position = (UINT64) Info->FieldBitPosition + + (UINT64) Arg->Common.Value.Size; if (Position > ACPI_UINT32_MAX) { @@ -403,8 +406,8 @@ AcpiDsGetFieldNames ( /* Keep track of bit position for the next field */ - Position = (ACPI_INTEGER) Info->FieldBitPosition - + (ACPI_INTEGER) Arg->Common.Value.Size; + Position = (UINT64) Info->FieldBitPosition + + (UINT64) Arg->Common.Value.Size; if (Position > ACPI_UINT32_MAX) { @@ -566,9 +569,12 @@ AcpiDsInitFieldObjects ( Flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_ERROR_IF_FOUND; - /* Mark node(s) temporary if we are executing a method */ - - if (WalkState->MethodNode) + /* + * Mark node(s) temporary if we are executing a normal control + * method. (Don't mark if this is a module-level code method) + */ + if (WalkState->MethodNode && + !(WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL)) { Flags |= ACPI_NS_TEMPORARY; } diff --git a/sys/contrib/dev/acpica/dispatcher/dsinit.c b/sys/contrib/dev/acpica/dispatcher/dsinit.c index 54293b6..79249e4 100644 --- a/sys/contrib/dev/acpica/dispatcher/dsinit.c +++ b/sys/contrib/dev/acpica/dispatcher/dsinit.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -283,7 +283,7 @@ AcpiDsInitializeObjects ( * the namespace reader lock. */ Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, StartNode, ACPI_UINT32_MAX, - ACPI_NS_WALK_UNLOCK, AcpiDsInitOneObject, &Info, NULL); + ACPI_NS_WALK_UNLOCK, AcpiDsInitOneObject, NULL, &Info, NULL); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "During WalkNamespace")); diff --git a/sys/contrib/dev/acpica/dispatcher/dsmethod.c b/sys/contrib/dev/acpica/dispatcher/dsmethod.c index 41b5fcb..e54bb60 100644 --- a/sys/contrib/dev/acpica/dispatcher/dsmethod.c +++ b/sys/contrib/dev/acpica/dispatcher/dsmethod.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -519,7 +519,7 @@ AcpiDsCallControlMethod ( if (ObjDesc->Method.MethodFlags & AML_METHOD_INTERNAL_ONLY) { - Status = ObjDesc->Method.Implementation (NextWalkState); + Status = ObjDesc->Method.Extra.Implementation (NextWalkState); if (Status == AE_OK) { Status = AE_CTRL_TERMINATE; @@ -693,10 +693,15 @@ AcpiDsTerminateControlMethod ( } /* - * Delete any namespace objects created anywhere within - * the namespace by the execution of this method + * Delete any namespace objects created anywhere within the + * namespace by the execution of this method. Unless this method + * is a module-level executable code method, in which case we + * want make the objects permanent. */ - AcpiNsDeleteNamespaceByOwner (MethodDesc->Method.OwnerId); + if (!(MethodDesc->Method.Flags & AOPOBJ_MODULE_LEVEL)) + { + AcpiNsDeleteNamespaceByOwner (MethodDesc->Method.OwnerId); + } } /* Decrement the thread count on the method */ @@ -745,7 +750,10 @@ AcpiDsTerminateControlMethod ( /* No more threads, we can free the OwnerId */ - AcpiUtReleaseOwnerId (&MethodDesc->Method.OwnerId); + if (!(MethodDesc->Method.Flags & AOPOBJ_MODULE_LEVEL)) + { + AcpiUtReleaseOwnerId (&MethodDesc->Method.OwnerId); + } } return_VOID; diff --git a/sys/contrib/dev/acpica/dispatcher/dsmthdat.c b/sys/contrib/dev/acpica/dispatcher/dsmthdat.c index 8b936cc..8d2342f 100644 --- a/sys/contrib/dev/acpica/dispatcher/dsmthdat.c +++ b/sys/contrib/dev/acpica/dispatcher/dsmthdat.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -524,13 +524,12 @@ AcpiDsMethodDataGetValue ( if (AcpiGbl_EnableInterpreterSlack) { - Object = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); + Object = AcpiUtCreateIntegerObject ((UINT64) 0); if (!Object) { return_ACPI_STATUS (AE_NO_MEMORY); } - Object->Integer.Value = 0; Node->Object = Object; } @@ -548,9 +547,10 @@ AcpiDsMethodDataGetValue ( case ACPI_REFCLASS_LOCAL: - ACPI_ERROR ((AE_INFO, - "Uninitialized Local[%d] at node %p", Index, Node)); - + /* + * No error message for this case, will be trapped again later to + * detect and ignore cases of Store(LocalX,LocalX) + */ return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL); default: diff --git a/sys/contrib/dev/acpica/dispatcher/dsobject.c b/sys/contrib/dev/acpica/dispatcher/dsobject.c index 576e799..3e1c45e 100644 --- a/sys/contrib/dev/acpica/dispatcher/dsobject.c +++ b/sys/contrib/dev/acpica/dispatcher/dsobject.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -570,23 +570,36 @@ AcpiDsBuildInternalPackageObj ( { /* * NumElements was exhausted, but there are remaining elements in the - * PackageList. + * PackageList. Truncate the package to NumElements. * * Note: technically, this is an error, from ACPI spec: "It is an error * for NumElements to be less than the number of elements in the - * PackageList". However, for now, we just print an error message and - * no exception is returned. + * PackageList". However, we just print a message and + * no exception is returned. This provides Windows compatibility. Some + * BIOSs will alter the NumElements on the fly, creating this type + * of ill-formed package object. */ while (Arg) { + /* + * We must delete any package elements that were created earlier + * and are not going to be used because of the package truncation. + */ + if (Arg->Common.Node) + { + AcpiUtRemoveReference ( + ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Arg->Common.Node)); + Arg->Common.Node = NULL; + } + /* Find out how many elements there really are */ i++; Arg = Arg->Common.Next; } - ACPI_ERROR ((AE_INFO, - "Package List length (%X) larger than NumElements count (%X), truncated\n", + ACPI_INFO ((AE_INFO, + "Actual Package length (0x%X) is larger than NumElements field (0x%X), truncated\n", i, ElementCount)); } else if (i < ElementCount) @@ -596,7 +609,7 @@ AcpiDsBuildInternalPackageObj ( * Note: this is not an error, the package is padded out with NULLs. */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Package List length (%X) smaller than NumElements count (%X), padded with null elements\n", + "Package List length (0x%X) smaller than NumElements count (0x%X), padded with null elements\n", i, ElementCount)); } @@ -774,7 +787,7 @@ AcpiDsInitObjectFromOp ( case AML_ONES_OP: - ObjDesc->Integer.Value = ACPI_INTEGER_MAX; + ObjDesc->Integer.Value = ACPI_UINT64_MAX; /* Truncate value if we are executing from a 32-bit ACPI table */ diff --git a/sys/contrib/dev/acpica/dispatcher/dsopcode.c b/sys/contrib/dev/acpica/dispatcher/dsopcode.c index f62c581..b1c6dc3 100644 --- a/sys/contrib/dev/acpica/dispatcher/dsopcode.c +++ b/sys/contrib/dev/acpica/dispatcher/dsopcode.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/dispatcher/dsutils.c b/sys/contrib/dev/acpica/dispatcher/dsutils.c index 98f799e..3710da0 100644 --- a/sys/contrib/dev/acpica/dispatcher/dsutils.c +++ b/sys/contrib/dev/acpica/dispatcher/dsutils.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/dispatcher/dswexec.c b/sys/contrib/dev/acpica/dispatcher/dswexec.c index 187b1b8..cad6f51 100644 --- a/sys/contrib/dev/acpica/dispatcher/dswexec.c +++ b/sys/contrib/dev/acpica/dispatcher/dswexec.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/dispatcher/dswload.c b/sys/contrib/dev/acpica/dispatcher/dswload.c index 2e8088a..7ae0931 100644 --- a/sys/contrib/dev/acpica/dispatcher/dswload.c +++ b/sys/contrib/dev/acpica/dispatcher/dswload.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -263,7 +263,7 @@ AcpiDsLoad1BeginOp ( * Target of Scope() not found. Generate an External for it, and * insert the name into the namespace. */ - AcpiDmAddToExternalList (Path, ACPI_TYPE_DEVICE, 0); + AcpiDmAddToExternalList (Op, Path, ACPI_TYPE_DEVICE, 0); Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT, WalkState, &Node); @@ -296,18 +296,19 @@ AcpiDsLoad1BeginOp ( case ACPI_TYPE_BUFFER: /* - * These types we will allow, but we will change the type. This - * enables some existing code of the form: + * These types we will allow, but we will change the type. + * This enables some existing code of the form: * * Name (DEB, 0) * Scope (DEB) { ... } * - * Note: silently change the type here. On the second pass, we will report - * a warning + * Note: silently change the type here. On the second pass, + * we will report a warning */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n", - Path, AcpiUtGetTypeName (Node->Type))); + "Type override - [%4.4s] had invalid type (%s) " + "for Scope operator, changed to type ANY\n", + AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type))); Node->Type = ACPI_TYPE_ANY; WalkState->ScopeInfo->Common.Value = ACPI_TYPE_ANY; @@ -318,8 +319,9 @@ AcpiDsLoad1BeginOp ( /* All other types are an error */ ACPI_ERROR ((AE_INFO, - "Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)", - AcpiUtGetTypeName (Node->Type), Path)); + "Invalid type (%s) for target of " + "Scope operator [%4.4s] (Cannot override)", + AcpiUtGetTypeName (Node->Type), AcpiUtGetNodeName (Node))); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } @@ -672,20 +674,6 @@ AcpiDsLoad2BeginOp ( (WalkState->Opcode != AML_INT_NAMEPATH_OP)) || (!(WalkState->OpInfo->Flags & AML_NAMED))) { -#ifdef ACPI_ENABLE_MODULE_LEVEL_CODE - if ((WalkState->OpInfo->Class == AML_CLASS_EXECUTE) || - (WalkState->OpInfo->Class == AML_CLASS_CONTROL)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Begin/EXEC: %s (fl %8.8X)\n", WalkState->OpInfo->Name, - WalkState->OpInfo->Flags)); - - /* Executing a type1 or type2 opcode outside of a method */ - - Status = AcpiDsExecBeginOp (WalkState, OutOp); - return_ACPI_STATUS (Status); - } -#endif return_ACPI_STATUS (AE_OK); } @@ -746,29 +734,45 @@ AcpiDsLoad2BeginOp ( break; case AML_SCOPE_OP: - /* - * The Path is an object reference to an existing object. - * Don't enter the name into the namespace, but look it up - * for use later. - */ - Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType, - ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, - WalkState, &(Node)); - if (ACPI_FAILURE (Status)) + + /* Special case for Scope(\) -> refers to the Root node */ + + if (Op && (Op->Named.Node == AcpiGbl_RootNode)) { -#ifdef ACPI_ASL_COMPILER - if (Status == AE_NOT_FOUND) + Node = Op->Named.Node; + + Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState); + if (ACPI_FAILURE (Status)) { - Status = AE_OK; + return_ACPI_STATUS (Status); } - else + } + else + { + /* + * The Path is an object reference to an existing object. + * Don't enter the name into the namespace, but look it up + * for use later. + */ + Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType, + ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, + WalkState, &(Node)); + if (ACPI_FAILURE (Status)) { - ACPI_ERROR_NAMESPACE (BufferPtr, Status); - } +#ifdef ACPI_ASL_COMPILER + if (Status == AE_NOT_FOUND) + { + Status = AE_OK; + } + else + { + ACPI_ERROR_NAMESPACE (BufferPtr, Status); + } #else - ACPI_ERROR_NAMESPACE (BufferPtr, Status); + ACPI_ERROR_NAMESPACE (BufferPtr, Status); #endif - return_ACPI_STATUS (Status); + return_ACPI_STATUS (Status); + } } /* @@ -792,15 +796,16 @@ AcpiDsLoad2BeginOp ( case ACPI_TYPE_BUFFER: /* - * These types we will allow, but we will change the type. This - * enables some existing code of the form: + * These types we will allow, but we will change the type. + * This enables some existing code of the form: * * Name (DEB, 0) * Scope (DEB) { ... } */ ACPI_WARNING ((AE_INFO, - "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)", - BufferPtr, AcpiUtGetTypeName (Node->Type))); + "Type override - [%4.4s] had invalid type (%s) " + "for Scope operator, changed to type ANY\n", + AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type))); Node->Type = ACPI_TYPE_ANY; WalkState->ScopeInfo->Common.Value = ACPI_TYPE_ANY; @@ -811,8 +816,9 @@ AcpiDsLoad2BeginOp ( /* All other types are an error */ ACPI_ERROR ((AE_INFO, - "Invalid type (%s) for target of Scope operator [%4.4s]", - AcpiUtGetTypeName (Node->Type), BufferPtr)); + "Invalid type (%s) for target of " + "Scope operator [%4.4s] (Cannot override)", + AcpiUtGetTypeName (Node->Type), AcpiUtGetNodeName (Node))); return (AE_AML_OPERAND_TYPE); } @@ -862,7 +868,12 @@ AcpiDsLoad2BeginOp ( { /* Execution mode, node cannot already exist, node is temporary */ - Flags |= (ACPI_NS_ERROR_IF_FOUND | ACPI_NS_TEMPORARY); + Flags |= ACPI_NS_ERROR_IF_FOUND; + + if (!(WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL)) + { + Flags |= ACPI_NS_TEMPORARY; + } } /* Add new entry or lookup existing entry */ @@ -952,24 +963,6 @@ AcpiDsLoad2EndOp ( if (!(WalkState->OpInfo->Flags & AML_NSOBJECT)) { -#ifndef ACPI_NO_METHOD_EXECUTION -#ifdef ACPI_ENABLE_MODULE_LEVEL_CODE - /* No namespace object. Executable opcode? */ - - if ((WalkState->OpInfo->Class == AML_CLASS_EXECUTE) || - (WalkState->OpInfo->Class == AML_CLASS_CONTROL)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "End/EXEC: %s (fl %8.8X)\n", WalkState->OpInfo->Name, - WalkState->OpInfo->Flags)); - - /* Executing a type1 or type2 opcode outside of a method */ - - Status = AcpiDsExecEndOp (WalkState); - return_ACPI_STATUS (Status); - } -#endif -#endif return_ACPI_STATUS (AE_OK); } @@ -1165,33 +1158,40 @@ AcpiDsLoad2EndOp ( } /* - * If we are executing a method, initialize the region + * The OpRegion is not fully parsed at this time. The only valid + * argument is the SpaceId. (We must save the address of the + * AML of the address and length operands) + * + * If we have a valid region, initialize it. The namespace is + * unlocked at this point. + * + * Need to unlock interpreter if it is locked (if we are running + * a control method), in order to allow _REG methods to be run + * during AcpiEvInitializeRegion. */ if (WalkState->MethodNode) { + /* + * Executing a method: initialize the region and unlock + * the interpreter + */ Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length, RegionSpace, WalkState); if (ACPI_FAILURE (Status)) { return (Status); } - } - /* - * The OpRegion is not fully parsed at this time. Only valid - * argument is the SpaceId. (We must save the address of the - * AML of the address and length operands) - */ + AcpiExExitInterpreter (); + } - /* - * If we have a valid region, initialize it - * Namespace is NOT locked at this point. - * - * TBD: need to unlock interpreter if it is locked, in order - * to allow _REG methods to be run. - */ Status = AcpiEvInitializeRegion (AcpiNsGetAttachedObject (Node), FALSE); + if (WalkState->MethodNode) + { + AcpiExEnterInterpreter (); + } + if (ACPI_FAILURE (Status)) { /* diff --git a/sys/contrib/dev/acpica/dispatcher/dswscope.c b/sys/contrib/dev/acpica/dispatcher/dswscope.c index f7c1a35..7a36e50 100644 --- a/sys/contrib/dev/acpica/dispatcher/dswscope.c +++ b/sys/contrib/dev/acpica/dispatcher/dswscope.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/dispatcher/dswstate.c b/sys/contrib/dev/acpica/dispatcher/dswstate.c index 73a0ef6..19bb45b 100644 --- a/sys/contrib/dev/acpica/dispatcher/dswstate.c +++ b/sys/contrib/dev/acpica/dispatcher/dswstate.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/events/evevent.c b/sys/contrib/dev/acpica/events/evevent.c index 165959a..2c41639 100644 --- a/sys/contrib/dev/acpica/events/evevent.c +++ b/sys/contrib/dev/acpica/events/evevent.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/events/evgpe.c b/sys/contrib/dev/acpica/events/evgpe.c index 200fb4e..4835568 100644 --- a/sys/contrib/dev/acpica/events/evgpe.c +++ b/sys/contrib/dev/acpica/events/evgpe.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -543,7 +543,7 @@ AcpiEvGpeDetect ( /* Read the Status Register */ - Status = AcpiRead (&StatusReg, &GpeRegisterInfo->StatusAddress); + Status = AcpiHwRead (&StatusReg, &GpeRegisterInfo->StatusAddress); if (ACPI_FAILURE (Status)) { goto UnlockAndExit; @@ -551,7 +551,7 @@ AcpiEvGpeDetect ( /* Read the Enable Register */ - Status = AcpiRead (&EnableReg, &GpeRegisterInfo->EnableAddress); + Status = AcpiHwRead (&EnableReg, &GpeRegisterInfo->EnableAddress); if (ACPI_FAILURE (Status)) { goto UnlockAndExit; diff --git a/sys/contrib/dev/acpica/events/evgpeblk.c b/sys/contrib/dev/acpica/events/evgpeblk.c index 6ff403b..fe55162 100644 --- a/sys/contrib/dev/acpica/events/evgpeblk.c +++ b/sys/contrib/dev/acpica/events/evgpeblk.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -995,7 +995,7 @@ AcpiEvCreateGpeInfoBlocks ( /* Disable all GPEs within this register */ - Status = AcpiWrite (0x00, &ThisRegister->EnableAddress); + Status = AcpiHwWrite (0x00, &ThisRegister->EnableAddress); if (ACPI_FAILURE (Status)) { goto ErrorExit; @@ -1003,7 +1003,7 @@ AcpiEvCreateGpeInfoBlocks ( /* Clear any pending GPE events within this register */ - Status = AcpiWrite (0xFF, &ThisRegister->StatusAddress); + Status = AcpiHwWrite (0xFF, &ThisRegister->StatusAddress); if (ACPI_FAILURE (Status)) { goto ErrorExit; @@ -1110,7 +1110,7 @@ AcpiEvCreateGpeBlock ( Status = AcpiNsWalkNamespace (ACPI_TYPE_METHOD, GpeDevice, ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, - AcpiEvSaveMethodInfo, GpeBlock, NULL); + AcpiEvSaveMethodInfo, NULL, GpeBlock, NULL); /* Return the new block */ @@ -1192,7 +1192,7 @@ AcpiEvInitializeGpeBlock ( Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, - AcpiEvMatchPrwAndGpe, &GpeInfo, NULL); + AcpiEvMatchPrwAndGpe, NULL, &GpeInfo, NULL); } /* diff --git a/sys/contrib/dev/acpica/events/evmisc.c b/sys/contrib/dev/acpica/events/evmisc.c index b138fa0..1ee7f9d 100644 --- a/sys/contrib/dev/acpica/events/evmisc.c +++ b/sys/contrib/dev/acpica/events/evmisc.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/events/evregion.c b/sys/contrib/dev/acpica/events/evregion.c index a5ffca2..467a846 100644 --- a/sys/contrib/dev/acpica/events/evregion.c +++ b/sys/contrib/dev/acpica/events/evregion.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -128,6 +128,11 @@ /* Local prototypes */ +static BOOLEAN +AcpiEvHasDefaultHandler ( + ACPI_NAMESPACE_NODE *Node, + ACPI_ADR_SPACE_TYPE SpaceId); + static ACPI_STATUS AcpiEvRegRun ( ACPI_HANDLE ObjHandle, @@ -233,6 +238,57 @@ UnlockAndExit: /******************************************************************************* * + * FUNCTION: AcpiEvHasDefaultHandler + * + * PARAMETERS: Node - Namespace node for the device + * SpaceId - The address space ID + * + * RETURN: TRUE if default handler is installed, FALSE otherwise + * + * DESCRIPTION: Check if the default handler is installed for the requested + * space ID. + * + ******************************************************************************/ + +static BOOLEAN +AcpiEvHasDefaultHandler ( + ACPI_NAMESPACE_NODE *Node, + ACPI_ADR_SPACE_TYPE SpaceId) +{ + ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_OPERAND_OBJECT *HandlerObj; + + + /* Must have an existing internal object */ + + ObjDesc = AcpiNsGetAttachedObject (Node); + if (ObjDesc) + { + HandlerObj = ObjDesc->Device.Handler; + + /* Walk the linked list of handlers for this object */ + + while (HandlerObj) + { + if (HandlerObj->AddressSpace.SpaceId == SpaceId) + { + if (HandlerObj->AddressSpace.HandlerFlags & + ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) + { + return (TRUE); + } + } + + HandlerObj = HandlerObj->AddressSpace.Next; + } + } + + return (FALSE); +} + + +/******************************************************************************* + * * FUNCTION: AcpiEvInitializeOpRegions * * PARAMETERS: None @@ -266,11 +322,16 @@ AcpiEvInitializeOpRegions ( for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++) { /* - * TBD: Make sure handler is the DEFAULT handler, otherwise - * _REG will have already been run. + * Make sure the installed handler is the DEFAULT handler. If not the + * default, the _REG methods will have already been run (when the + * handler was installed) */ - Status = AcpiEvExecuteRegMethods (AcpiGbl_RootNode, - AcpiGbl_DefaultAddressSpaces[i]); + if (AcpiEvHasDefaultHandler (AcpiGbl_RootNode, + AcpiGbl_DefaultAddressSpaces[i])) + { + Status = AcpiEvExecuteRegMethods (AcpiGbl_RootNode, + AcpiGbl_DefaultAddressSpaces[i]); + } } (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); @@ -339,25 +400,21 @@ AcpiEvExecuteRegMethod ( * connection status 1 for connecting the handler, 0 for disconnecting * the handler (Passed as a parameter) */ - Args[0] = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); + Args[0] = AcpiUtCreateIntegerObject ((UINT64) RegionObj->Region.SpaceId); if (!Args[0]) { Status = AE_NO_MEMORY; goto Cleanup1; } - Args[1] = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); + Args[1] = AcpiUtCreateIntegerObject ((UINT64) Function); if (!Args[1]) { Status = AE_NO_MEMORY; goto Cleanup2; } - /* Setup the parameter objects */ - - Args[0]->Integer.Value = RegionObj->Region.SpaceId; - Args[1]->Integer.Value = Function; - Args[2] = NULL; + Args[2] = NULL; /* Terminate list */ /* Execute the method, no return value */ @@ -385,7 +442,7 @@ Cleanup1: * RegionOffset - Where in the region to read or write * BitWidth - Field width in bits (8, 16, 32, or 64) * Value - Pointer to in or out value, must be - * full 64-bit ACPI_INTEGER + * a full 64-bit integer * * RETURN: Status * @@ -400,7 +457,7 @@ AcpiEvAddressSpaceDispatch ( UINT32 Function, UINT32 RegionOffset, UINT32 BitWidth, - ACPI_INTEGER *Value) + UINT64 *Value) { ACPI_STATUS Status; ACPI_ADR_SPACE_HANDLER Handler; @@ -788,7 +845,7 @@ AcpiEvInstallHandler ( /* Convert and validate the device handle */ - Node = AcpiNsMapHandleToNode (ObjHandle); + Node = AcpiNsValidateHandle (ObjHandle); if (!Node) { return (AE_BAD_PARAMETER); @@ -1112,7 +1169,7 @@ AcpiEvInstallSpaceHandler ( * of the branch */ Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, Node, ACPI_UINT32_MAX, - ACPI_NS_WALK_UNLOCK, AcpiEvInstallHandler, + ACPI_NS_WALK_UNLOCK, AcpiEvInstallHandler, NULL, HandlerObj, NULL); UnlockAndExit: @@ -1152,7 +1209,7 @@ AcpiEvExecuteRegMethods ( * regions of this Space ID before we can run any _REG methods) */ Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, Node, ACPI_UINT32_MAX, - ACPI_NS_WALK_UNLOCK, AcpiEvRegRun, + ACPI_NS_WALK_UNLOCK, AcpiEvRegRun, NULL, &SpaceId, NULL); return_ACPI_STATUS (Status); @@ -1186,7 +1243,7 @@ AcpiEvRegRun ( /* Convert and validate the device handle */ - Node = AcpiNsMapHandleToNode (ObjHandle); + Node = AcpiNsValidateHandle (ObjHandle); if (!Node) { return (AE_BAD_PARAMETER); diff --git a/sys/contrib/dev/acpica/events/evrgnini.c b/sys/contrib/dev/acpica/events/evrgnini.c index 82c96e4..e2b0bcf 100644 --- a/sys/contrib/dev/acpica/events/evrgnini.c +++ b/sys/contrib/dev/acpica/events/evrgnini.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -127,10 +127,6 @@ /* Local prototypes */ static BOOLEAN -AcpiEvMatchPciRootBridge ( - char *Id); - -static BOOLEAN AcpiEvIsPciRootBridge ( ACPI_NAMESPACE_NODE *Node); @@ -264,7 +260,7 @@ AcpiEvPciConfigRegionSetup ( void **RegionContext) { ACPI_STATUS Status = AE_OK; - ACPI_INTEGER PciValue; + UINT64 PciValue; ACPI_PCI_ID *PciId = *RegionContext; ACPI_OPERAND_OBJECT *HandlerObj; ACPI_NAMESPACE_NODE *ParentNode; @@ -444,42 +440,6 @@ AcpiEvPciConfigRegionSetup ( /******************************************************************************* * - * FUNCTION: AcpiEvMatchPciRootBridge - * - * PARAMETERS: Id - The HID/CID in string format - * - * RETURN: TRUE if the Id is a match for a PCI/PCI-Express Root Bridge - * - * DESCRIPTION: Determine if the input ID is a PCI Root Bridge ID. - * - ******************************************************************************/ - -static BOOLEAN -AcpiEvMatchPciRootBridge ( - char *Id) -{ - - /* - * Check if this is a PCI root. - * ACPI 3.0+: check for a PCI Express root also. - */ - if (!(ACPI_STRNCMP (Id, - PCI_ROOT_HID_STRING, - sizeof (PCI_ROOT_HID_STRING))) || - - !(ACPI_STRNCMP (Id, - PCI_EXPRESS_ROOT_HID_STRING, - sizeof (PCI_EXPRESS_ROOT_HID_STRING)))) - { - return (TRUE); - } - - return (FALSE); -} - - -/******************************************************************************* - * * FUNCTION: AcpiEvIsPciRootBridge * * PARAMETERS: Node - Device node being examined @@ -496,9 +456,10 @@ AcpiEvIsPciRootBridge ( ACPI_NAMESPACE_NODE *Node) { ACPI_STATUS Status; - ACPI_DEVICE_ID Hid; - ACPI_COMPATIBLE_ID_LIST *Cid; + ACPI_DEVICE_ID *Hid; + ACPI_DEVICE_ID_LIST *Cid; UINT32 i; + BOOLEAN Match; /* Get the _HID and check for a PCI Root Bridge */ @@ -509,7 +470,10 @@ AcpiEvIsPciRootBridge ( return (FALSE); } - if (AcpiEvMatchPciRootBridge (Hid.Value)) + Match = AcpiUtIsPciRootBridge (Hid->String); + ACPI_FREE (Hid); + + if (Match) { return (TRUE); } @@ -526,7 +490,7 @@ AcpiEvIsPciRootBridge ( for (i = 0; i < Cid->Count; i++) { - if (AcpiEvMatchPciRootBridge (Cid->Id[i].Value)) + if (AcpiUtIsPciRootBridge (Cid->Ids[i].String)) { ACPI_FREE (Cid); return (TRUE); @@ -752,6 +716,20 @@ AcpiEvInitializeRegion ( HandlerObj = ObjDesc->ThermalZone.Handler; break; + case ACPI_TYPE_METHOD: + /* + * If we are executing module level code, the original + * Node's object was replaced by this Method object and we + * saved the handler in the method object. + * + * See AcpiNsExecModuleCode + */ + if (ObjDesc->Method.Flags & AOPOBJ_MODULE_LEVEL) + { + HandlerObj = ObjDesc->Method.Extra.Handler; + } + break; + default: /* Ignore other objects */ break; diff --git a/sys/contrib/dev/acpica/events/evsci.c b/sys/contrib/dev/acpica/events/evsci.c index 49639ef..c358a48 100644 --- a/sys/contrib/dev/acpica/events/evsci.c +++ b/sys/contrib/dev/acpica/events/evsci.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/events/evxface.c b/sys/contrib/dev/acpica/events/evxface.c index 5ecf4a7..abffad6 100644 --- a/sys/contrib/dev/acpica/events/evxface.c +++ b/sys/contrib/dev/acpica/events/evxface.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -368,7 +368,7 @@ AcpiInstallNotifyHandler ( /* Convert and validate the device handle */ - Node = AcpiNsMapHandleToNode (Device); + Node = AcpiNsValidateHandle (Device); if (!Node) { Status = AE_BAD_PARAMETER; @@ -555,7 +555,7 @@ AcpiRemoveNotifyHandler ( /* Convert and validate the device handle */ - Node = AcpiNsMapHandleToNode (Device); + Node = AcpiNsValidateHandle (Device); if (!Node) { Status = AE_BAD_PARAMETER; diff --git a/sys/contrib/dev/acpica/events/evxfevnt.c b/sys/contrib/dev/acpica/events/evxfevnt.c index a583dac..92b6d4d 100644 --- a/sys/contrib/dev/acpica/events/evxfevnt.c +++ b/sys/contrib/dev/acpica/events/evxfevnt.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -805,7 +805,7 @@ AcpiInstallGpeBlock ( return (Status); } - Node = AcpiNsMapHandleToNode (GpeDevice); + Node = AcpiNsValidateHandle (GpeDevice); if (!Node) { Status = AE_BAD_PARAMETER; @@ -905,7 +905,7 @@ AcpiRemoveGpeBlock ( return (Status); } - Node = AcpiNsMapHandleToNode (GpeDevice); + Node = AcpiNsValidateHandle (GpeDevice); if (!Node) { Status = AE_BAD_PARAMETER; diff --git a/sys/contrib/dev/acpica/events/evxfregn.c b/sys/contrib/dev/acpica/events/evxfregn.c index 8ec1402..d06c6f7 100644 --- a/sys/contrib/dev/acpica/events/evxfregn.c +++ b/sys/contrib/dev/acpica/events/evxfregn.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -171,7 +171,7 @@ AcpiInstallAddressSpaceHandler ( /* Convert and validate the device handle */ - Node = AcpiNsMapHandleToNode (Device); + Node = AcpiNsValidateHandle (Device); if (!Node) { Status = AE_BAD_PARAMETER; @@ -244,7 +244,7 @@ AcpiRemoveAddressSpaceHandler ( /* Convert and validate the device handle */ - Node = AcpiNsMapHandleToNode (Device); + Node = AcpiNsValidateHandle (Device); if (!Node || ((Node->Type != ACPI_TYPE_DEVICE) && (Node->Type != ACPI_TYPE_PROCESSOR) && diff --git a/sys/contrib/dev/acpica/executer/exconfig.c b/sys/contrib/dev/acpica/executer/exconfig.c index a591c4a..95b78ed 100644 --- a/sys/contrib/dev/acpica/executer/exconfig.c +++ b/sys/contrib/dev/acpica/executer/exconfig.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -196,8 +196,15 @@ AcpiExAddTable ( { AcpiUtRemoveReference (ObjDesc); *DdbHandle = NULL; + return_ACPI_STATUS (Status); } + /* Execute any module-level code that was found in the table */ + + AcpiExExitInterpreter (); + AcpiNsExecModuleCodeList (); + AcpiExEnterInterpreter (); + return_ACPI_STATUS (Status); } @@ -256,15 +263,13 @@ AcpiExLoadTableOp ( /* Table not found, return an Integer=0 and AE_OK */ - DdbHandle = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); + DdbHandle = AcpiUtCreateIntegerObject ((UINT64) 0); if (!DdbHandle) { return_ACPI_STATUS (AE_NO_MEMORY); } - DdbHandle->Integer.Value = 0; *ReturnDesc = DdbHandle; - return_ACPI_STATUS (AE_OK); } @@ -382,7 +387,7 @@ AcpiExRegionRead ( UINT8 *Buffer) { ACPI_STATUS Status; - ACPI_INTEGER Value; + UINT64 Value; UINT32 RegionOffset = 0; UINT32 i; @@ -605,7 +610,10 @@ AcpiExLoadOp ( Status = AcpiTbAddTable (&TableDesc, &TableIndex); if (ACPI_FAILURE (Status)) { - goto Cleanup; + /* Delete allocated table buffer */ + + AcpiTbDeleteTable (&TableDesc); + return_ACPI_STATUS (Status); } /* @@ -648,13 +656,6 @@ AcpiExLoadOp ( AcpiGbl_TableHandlerContext); } -Cleanup: - if (ACPI_FAILURE (Status)) - { - /* Delete allocated table buffer */ - - AcpiTbDeleteTable (&TableDesc); - } return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/executer/exconvrt.c b/sys/contrib/dev/acpica/executer/exconvrt.c index b691576..a67122c 100644 --- a/sys/contrib/dev/acpica/executer/exconvrt.c +++ b/sys/contrib/dev/acpica/executer/exconvrt.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -129,7 +129,7 @@ static UINT32 AcpiExConvertToAscii ( - ACPI_INTEGER Integer, + UINT64 Integer, UINT16 Base, UINT8 *String, UINT8 MaxLength); @@ -158,7 +158,7 @@ AcpiExConvertToInteger ( { ACPI_OPERAND_OBJECT *ReturnDesc; UINT8 *Pointer; - ACPI_INTEGER Result; + UINT64 Result; UINT32 i; UINT32 Count; ACPI_STATUS Status; @@ -247,7 +247,7 @@ AcpiExConvertToInteger ( * Little endian is used, meaning that the first byte of the buffer * is the LSB of the integer */ - Result |= (((ACPI_INTEGER) Pointer[i]) << (i * 8)); + Result |= (((UINT64) Pointer[i]) << (i * 8)); } break; @@ -260,7 +260,7 @@ AcpiExConvertToInteger ( /* Create a new integer */ - ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); + ReturnDesc = AcpiUtCreateIntegerObject (Result); if (!ReturnDesc) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -271,7 +271,6 @@ AcpiExConvertToInteger ( /* Save the Result */ - ReturnDesc->Integer.Value = Result; AcpiExTruncateFor32bitTable (ReturnDesc); *ResultDesc = ReturnDesc; return_ACPI_STATUS (AE_OK); @@ -390,12 +389,12 @@ AcpiExConvertToBuffer ( static UINT32 AcpiExConvertToAscii ( - ACPI_INTEGER Integer, + UINT64 Integer, UINT16 Base, UINT8 *String, UINT8 DataWidth) { - ACPI_INTEGER Digit; + UINT64 Digit; UINT32 i; UINT32 j; UINT32 k = 0; @@ -660,7 +659,7 @@ AcpiExConvertToString ( for (i = 0; i < ObjDesc->Buffer.Length; i++) { NewBuf += AcpiExConvertToAscii ( - (ACPI_INTEGER) ObjDesc->Buffer.Pointer[i], Base, + (UINT64) ObjDesc->Buffer.Pointer[i], Base, NewBuf, 1); *NewBuf++ = Separator; /* each separated by a comma or space */ } diff --git a/sys/contrib/dev/acpica/executer/excreate.c b/sys/contrib/dev/acpica/executer/excreate.c index 1466fdb..f6c2700 100644 --- a/sys/contrib/dev/acpica/executer/excreate.c +++ b/sys/contrib/dev/acpica/executer/excreate.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/executer/exdump.c b/sys/contrib/dev/acpica/executer/exdump.c index 655a499..870eb07 100644 --- a/sys/contrib/dev/acpica/executer/exdump.c +++ b/sys/contrib/dev/acpica/executer/exdump.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/executer/exfield.c b/sys/contrib/dev/acpica/executer/exfield.c index 62e6519..0e06eef 100644 --- a/sys/contrib/dev/acpica/executer/exfield.c +++ b/sys/contrib/dev/acpica/executer/exfield.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -151,6 +151,7 @@ AcpiExReadDataFromField ( ACPI_OPERAND_OBJECT *BufferDesc; ACPI_SIZE Length; void *Buffer; + UINT32 Function; ACPI_FUNCTION_TRACE_PTR (ExReadDataFromField, ObjDesc); @@ -183,13 +184,27 @@ AcpiExReadDataFromField ( } } else if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REGION_FIELD) && - (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS)) + (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS || + ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_IPMI)) { /* - * This is an SMBus read. We must create a buffer to hold the data - * and directly access the region handler. + * This is an SMBus or IPMI read. We must create a buffer to hold + * the data and then directly access the region handler. + * + * Note: Smbus protocol value is passed in upper 16-bits of Function */ - BufferDesc = AcpiUtCreateBufferObject (ACPI_SMBUS_BUFFER_SIZE); + if (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS) + { + Length = ACPI_SMBUS_BUFFER_SIZE; + Function = ACPI_READ | (ObjDesc->Field.Attribute << 16); + } + else /* IPMI */ + { + Length = ACPI_IPMI_BUFFER_SIZE; + Function = ACPI_READ; + } + + BufferDesc = AcpiUtCreateBufferObject (Length); if (!BufferDesc) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -199,13 +214,11 @@ AcpiExReadDataFromField ( AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags); - /* - * Perform the read. - * Note: Smbus protocol value is passed in upper 16-bits of Function - */ + /* Call the region handler for the read */ + Status = AcpiExAccessRegion (ObjDesc, 0, - ACPI_CAST_PTR (ACPI_INTEGER, BufferDesc->Buffer.Pointer), - ACPI_READ | (ObjDesc->Field.Attribute << 16)); + ACPI_CAST_PTR (UINT64, BufferDesc->Buffer.Pointer), + Function); AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); goto Exit; } @@ -213,7 +226,7 @@ AcpiExReadDataFromField ( /* * Allocate a buffer for the contents of the field. * - * If the field is larger than the size of an ACPI_INTEGER, create + * If the field is larger than the current integer width, create * a BUFFER to hold it. Otherwise, use an INTEGER. This allows * the use of arithmetic operators on the returned value if the * field size is equal or smaller than an Integer. @@ -236,14 +249,13 @@ AcpiExReadDataFromField ( { /* Field will fit within an Integer (normal case) */ - BufferDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); + BufferDesc = AcpiUtCreateIntegerObject ((UINT64) 0); if (!BufferDesc) { return_ACPI_STATUS (AE_NO_MEMORY); } Length = AcpiGbl_IntegerByteWidth; - BufferDesc->Integer.Value = 0; Buffer = &BufferDesc->Integer.Value; } @@ -304,6 +316,7 @@ AcpiExWriteDataToField ( UINT32 Length; void *Buffer; ACPI_OPERAND_OBJECT *BufferDesc; + UINT32 Function; ACPI_FUNCTION_TRACE_PTR (ExWriteDataToField, ObjDesc); @@ -332,40 +345,59 @@ AcpiExWriteDataToField ( } } else if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REGION_FIELD) && - (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS)) + (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS || + ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_IPMI)) { /* - * This is an SMBus write. We will bypass the entire field mechanism - * and handoff the buffer directly to the handler. + * This is an SMBus or IPMI write. We will bypass the entire field + * mechanism and handoff the buffer directly to the handler. For + * these address spaces, the buffer is bi-directional; on a write, + * return data is returned in the same buffer. + * + * Source must be a buffer of sufficient size: + * ACPI_SMBUS_BUFFER_SIZE or ACPI_IPMI_BUFFER_SIZE. * - * Source must be a buffer of sufficient size (ACPI_SMBUS_BUFFER_SIZE). + * Note: SMBus protocol type is passed in upper 16-bits of Function */ if (SourceDesc->Common.Type != ACPI_TYPE_BUFFER) { - ACPI_ERROR ((AE_INFO, "SMBus write requires Buffer, found type %s", + ACPI_ERROR ((AE_INFO, + "SMBus or IPMI write requires Buffer, found type %s", AcpiUtGetObjectTypeName (SourceDesc))); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } - if (SourceDesc->Buffer.Length < ACPI_SMBUS_BUFFER_SIZE) + if (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS) + { + Length = ACPI_SMBUS_BUFFER_SIZE; + Function = ACPI_WRITE | (ObjDesc->Field.Attribute << 16); + } + else /* IPMI */ + { + Length = ACPI_IPMI_BUFFER_SIZE; + Function = ACPI_WRITE; + } + + if (SourceDesc->Buffer.Length < Length) { ACPI_ERROR ((AE_INFO, - "SMBus write requires Buffer of length %X, found length %X", - ACPI_SMBUS_BUFFER_SIZE, SourceDesc->Buffer.Length)); + "SMBus or IPMI write requires Buffer of length %X, found length %X", + Length, SourceDesc->Buffer.Length)); return_ACPI_STATUS (AE_AML_BUFFER_LIMIT); } - BufferDesc = AcpiUtCreateBufferObject (ACPI_SMBUS_BUFFER_SIZE); + /* Create the bi-directional buffer */ + + BufferDesc = AcpiUtCreateBufferObject (Length); if (!BufferDesc) { return_ACPI_STATUS (AE_NO_MEMORY); } Buffer = BufferDesc->Buffer.Pointer; - ACPI_MEMCPY (Buffer, SourceDesc->Buffer.Pointer, - ACPI_SMBUS_BUFFER_SIZE); + ACPI_MEMCPY (Buffer, SourceDesc->Buffer.Pointer, Length); /* Lock entire transaction if requested */ @@ -374,11 +406,9 @@ AcpiExWriteDataToField ( /* * Perform the write (returns status and perhaps data in the * same buffer) - * Note: SMBus protocol type is passed in upper 16-bits of Function. */ Status = AcpiExAccessRegion (ObjDesc, 0, - (ACPI_INTEGER *) Buffer, - ACPI_WRITE | (ObjDesc->Field.Attribute << 16)); + (UINT64 *) Buffer, Function); AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); *ResultDesc = BufferDesc; diff --git a/sys/contrib/dev/acpica/executer/exfldio.c b/sys/contrib/dev/acpica/executer/exfldio.c index f59dd62..8fbc992 100644 --- a/sys/contrib/dev/acpica/executer/exfldio.c +++ b/sys/contrib/dev/acpica/executer/exfldio.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -133,13 +133,13 @@ static ACPI_STATUS AcpiExFieldDatumIo ( ACPI_OPERAND_OBJECT *ObjDesc, UINT32 FieldDatumByteOffset, - ACPI_INTEGER *Value, + UINT64 *Value, UINT32 ReadWrite); static BOOLEAN AcpiExRegisterOverflow ( ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_INTEGER Value); + UINT64 Value); static ACPI_STATUS AcpiExSetupRegion ( @@ -202,12 +202,13 @@ AcpiExSetupRegion ( } /* - * Exit now for SMBus address space, it has a non-linear address space + * Exit now for SMBus or IPMI address space, it has a non-linear address space * and the request cannot be directly validated */ - if (RgnDesc->Region.SpaceId == ACPI_ADR_SPACE_SMBUS) + if (RgnDesc->Region.SpaceId == ACPI_ADR_SPACE_SMBUS || + RgnDesc->Region.SpaceId == ACPI_ADR_SPACE_IPMI) { - /* SMBus has a non-linear address space */ + /* SMBus or IPMI has a non-linear address space */ return_ACPI_STATUS (AE_OK); } @@ -295,7 +296,7 @@ AcpiExSetupRegion ( * FieldDatumByteOffset - Byte offset of this datum within the * parent field * Value - Where to store value (must at least - * the size of ACPI_INTEGER) + * 64 bits) * Function - Read or Write flag plus other region- * dependent flags * @@ -309,7 +310,7 @@ ACPI_STATUS AcpiExAccessRegion ( ACPI_OPERAND_OBJECT *ObjDesc, UINT32 FieldDatumByteOffset, - ACPI_INTEGER *Value, + UINT64 *Value, UINT32 Function) { ACPI_STATUS Status; @@ -407,7 +408,7 @@ AcpiExAccessRegion ( static BOOLEAN AcpiExRegisterOverflow ( ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_INTEGER Value) + UINT64 Value) { if (ObjDesc->CommonField.BitLength >= ACPI_INTEGER_BIT_SIZE) @@ -419,7 +420,7 @@ AcpiExRegisterOverflow ( return (FALSE); } - if (Value >= ((ACPI_INTEGER) 1 << ObjDesc->CommonField.BitLength)) + if (Value >= ((UINT64) 1 << ObjDesc->CommonField.BitLength)) { /* * The Value is larger than the maximum value that can fit into @@ -456,11 +457,11 @@ static ACPI_STATUS AcpiExFieldDatumIo ( ACPI_OPERAND_OBJECT *ObjDesc, UINT32 FieldDatumByteOffset, - ACPI_INTEGER *Value, + UINT64 *Value, UINT32 ReadWrite) { ACPI_STATUS Status; - ACPI_INTEGER LocalValue; + UINT64 LocalValue; ACPI_FUNCTION_TRACE_U32 (ExFieldDatumIo, FieldDatumByteOffset); @@ -542,7 +543,7 @@ AcpiExFieldDatumIo ( * the register */ if (AcpiExRegisterOverflow (ObjDesc->BankField.BankObj, - (ACPI_INTEGER) ObjDesc->BankField.Value)) + (UINT64) ObjDesc->BankField.Value)) { return_ACPI_STATUS (AE_AML_REGISTER_LIMIT); } @@ -585,7 +586,7 @@ AcpiExFieldDatumIo ( * the register */ if (AcpiExRegisterOverflow (ObjDesc->IndexField.IndexObj, - (ACPI_INTEGER) ObjDesc->IndexField.Value)) + (UINT64) ObjDesc->IndexField.Value)) { return_ACPI_STATUS (AE_AML_REGISTER_LIMIT); } @@ -614,7 +615,7 @@ AcpiExFieldDatumIo ( "Read from Data Register\n")); Status = AcpiExExtractFromField (ObjDesc->IndexField.DataObj, - Value, sizeof (ACPI_INTEGER)); + Value, sizeof (UINT64)); } else { @@ -625,7 +626,7 @@ AcpiExFieldDatumIo ( ACPI_FORMAT_UINT64 (*Value))); Status = AcpiExInsertIntoField (ObjDesc->IndexField.DataObj, - Value, sizeof (ACPI_INTEGER)); + Value, sizeof (UINT64)); } break; @@ -678,13 +679,13 @@ AcpiExFieldDatumIo ( ACPI_STATUS AcpiExWriteWithUpdateRule ( ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_INTEGER Mask, - ACPI_INTEGER FieldValue, + UINT64 Mask, + UINT64 FieldValue, UINT32 FieldDatumByteOffset) { ACPI_STATUS Status = AE_OK; - ACPI_INTEGER MergedValue; - ACPI_INTEGER CurrentValue; + UINT64 MergedValue; + UINT64 CurrentValue; ACPI_FUNCTION_TRACE_U32 (ExWriteWithUpdateRule, Mask); @@ -696,7 +697,7 @@ AcpiExWriteWithUpdateRule ( /* If the mask is all ones, we don't need to worry about the update rule */ - if (Mask != ACPI_INTEGER_MAX) + if (Mask != ACPI_UINT64_MAX) { /* Decode the update rule */ @@ -786,8 +787,8 @@ AcpiExExtractFromField ( UINT32 BufferLength) { ACPI_STATUS Status; - ACPI_INTEGER RawDatum; - ACPI_INTEGER MergedDatum; + UINT64 RawDatum; + UINT64 MergedDatum; UINT32 FieldOffset = 0; UINT32 BufferOffset = 0; UINT32 BufferTailBits; @@ -916,10 +917,10 @@ AcpiExInsertIntoField ( UINT32 BufferLength) { ACPI_STATUS Status; - ACPI_INTEGER Mask; - ACPI_INTEGER WidthMask; - ACPI_INTEGER MergedDatum; - ACPI_INTEGER RawDatum = 0; + UINT64 Mask; + UINT64 WidthMask; + UINT64 MergedDatum; + UINT64 RawDatum = 0; UINT32 FieldOffset = 0; UINT32 BufferOffset = 0; UINT32 BufferTailBits; @@ -971,7 +972,7 @@ AcpiExInsertIntoField ( */ if (ObjDesc->CommonField.AccessBitWidth == ACPI_INTEGER_BIT_SIZE) { - WidthMask = ACPI_INTEGER_MAX; + WidthMask = ACPI_UINT64_MAX; } else { diff --git a/sys/contrib/dev/acpica/executer/exmisc.c b/sys/contrib/dev/acpica/executer/exmisc.c index 18699ee..a639afb 100644 --- a/sys/contrib/dev/acpica/executer/exmisc.c +++ b/sys/contrib/dev/acpica/executer/exmisc.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -508,11 +508,11 @@ Cleanup: * ******************************************************************************/ -ACPI_INTEGER +UINT64 AcpiExDoMathOp ( UINT16 Opcode, - ACPI_INTEGER Integer0, - ACPI_INTEGER Integer1) + UINT64 Integer0, + UINT64 Integer1) { ACPI_FUNCTION_ENTRY (); @@ -615,8 +615,8 @@ AcpiExDoMathOp ( ACPI_STATUS AcpiExDoLogicalNumericOp ( UINT16 Opcode, - ACPI_INTEGER Integer0, - ACPI_INTEGER Integer1, + UINT64 Integer0, + UINT64 Integer1, BOOLEAN *LogicalResult) { ACPI_STATUS Status = AE_OK; @@ -690,8 +690,8 @@ AcpiExDoLogicalOp ( BOOLEAN *LogicalResult) { ACPI_OPERAND_OBJECT *LocalOperand1 = Operand1; - ACPI_INTEGER Integer0; - ACPI_INTEGER Integer1; + UINT64 Integer0; + UINT64 Integer1; UINT32 Length0; UINT32 Length1; ACPI_STATUS Status = AE_OK; diff --git a/sys/contrib/dev/acpica/executer/exmutex.c b/sys/contrib/dev/acpica/executer/exmutex.c index 286fceb..0bd66b3 100644 --- a/sys/contrib/dev/acpica/executer/exmutex.c +++ b/sys/contrib/dev/acpica/executer/exmutex.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -490,6 +490,15 @@ AcpiExReleaseMutex ( return_ACPI_STATUS (AE_AML_MUTEX_NOT_ACQUIRED); } + /* Must have a valid thread ID */ + + if (!WalkState->Thread) + { + ACPI_ERROR ((AE_INFO, "Cannot release Mutex [%4.4s], null thread info", + AcpiUtGetNodeName (ObjDesc->Mutex.Node))); + return_ACPI_STATUS (AE_AML_INTERNAL); + } + /* * The Mutex is owned, but this thread must be the owner. * Special case for Global Lock, any thread can release @@ -505,15 +514,6 @@ AcpiExReleaseMutex ( return_ACPI_STATUS (AE_AML_NOT_OWNER); } - /* Must have a valid thread ID */ - - if (!WalkState->Thread) - { - ACPI_ERROR ((AE_INFO, "Cannot release Mutex [%4.4s], null thread info", - AcpiUtGetNodeName (ObjDesc->Mutex.Node))); - return_ACPI_STATUS (AE_AML_INTERNAL); - } - /* * The sync level of the mutex must be equal to the current sync level. In * other words, the current level means that at least one mutex at that diff --git a/sys/contrib/dev/acpica/executer/exnames.c b/sys/contrib/dev/acpica/executer/exnames.c index d83ca59..7134c62 100644 --- a/sys/contrib/dev/acpica/executer/exnames.c +++ b/sys/contrib/dev/acpica/executer/exnames.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/executer/exoparg1.c b/sys/contrib/dev/acpica/executer/exoparg1.c index dd4767f..dff76c6 100644 --- a/sys/contrib/dev/acpica/executer/exoparg1.c +++ b/sys/contrib/dev/acpica/executer/exoparg1.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -183,13 +183,12 @@ AcpiExOpcode_0A_0T_1R ( /* Create a return object of type Integer */ - ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); + ReturnDesc = AcpiUtCreateIntegerObject (AcpiOsGetTimer ()); if (!ReturnDesc) { Status = AE_NO_MEMORY; goto Cleanup; } - ReturnDesc->Integer.Value = AcpiOsGetTimer (); break; default: /* Unknown opcode */ @@ -369,8 +368,8 @@ AcpiExOpcode_1A_1T_1R ( ACPI_OPERAND_OBJECT *ReturnDesc2 = NULL; UINT32 Temp32; UINT32 i; - ACPI_INTEGER PowerOfTen; - ACPI_INTEGER Digit; + UINT64 PowerOfTen; + UINT64 Digit; ACPI_FUNCTION_TRACE_STR (ExOpcode_1A_1T_1R, @@ -478,7 +477,7 @@ AcpiExOpcode_1A_1T_1R ( /* Sum the digit into the result with the current power of 10 */ ReturnDesc->Integer.Value += - (((ACPI_INTEGER) Temp32) * PowerOfTen); + (((UINT64) Temp32) * PowerOfTen); /* Shift to next BCD digit */ @@ -507,7 +506,7 @@ AcpiExOpcode_1A_1T_1R ( * remainder from above */ ReturnDesc->Integer.Value |= - (((ACPI_INTEGER) Temp32) << ACPI_MUL_4 (i)); + (((UINT64) Temp32) << ACPI_MUL_4 (i)); } /* Overflow if there is any data left in Digit */ @@ -554,7 +553,7 @@ AcpiExOpcode_1A_1T_1R ( /* The object exists in the namespace, return TRUE */ - ReturnDesc->Integer.Value = ACPI_INTEGER_MAX; + ReturnDesc->Integer.Value = ACPI_UINT64_MAX; goto Cleanup; @@ -720,7 +719,7 @@ AcpiExOpcode_1A_0T_1R ( ACPI_OPERAND_OBJECT *ReturnDesc = NULL; ACPI_STATUS Status = AE_OK; UINT32 Type; - ACPI_INTEGER Value; + UINT64 Value; ACPI_FUNCTION_TRACE_STR (ExOpcode_1A_0T_1R, @@ -733,7 +732,7 @@ AcpiExOpcode_1A_0T_1R ( { case AML_LNOT_OP: /* LNot (Operand) */ - ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); + ReturnDesc = AcpiUtCreateIntegerObject ((UINT64) 0); if (!ReturnDesc) { Status = AE_NO_MEMORY; @@ -746,7 +745,7 @@ AcpiExOpcode_1A_0T_1R ( */ if (!Operand[0]->Integer.Value) { - ReturnDesc->Integer.Value = ACPI_INTEGER_MAX; + ReturnDesc->Integer.Value = ACPI_UINT64_MAX; } break; @@ -838,14 +837,12 @@ AcpiExOpcode_1A_0T_1R ( /* Allocate a descriptor to hold the type. */ - ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); + ReturnDesc = AcpiUtCreateIntegerObject ((UINT64) Type); if (!ReturnDesc) { Status = AE_NO_MEMORY; goto Cleanup; } - - ReturnDesc->Integer.Value = Type; break; @@ -917,14 +914,12 @@ AcpiExOpcode_1A_0T_1R ( * Now that we have the size of the object, create a result * object to hold the value */ - ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); + ReturnDesc = AcpiUtCreateIntegerObject (Value); if (!ReturnDesc) { Status = AE_NO_MEMORY; goto Cleanup; } - - ReturnDesc->Integer.Value = Value; break; @@ -1089,21 +1084,18 @@ AcpiExOpcode_1A_0T_1R ( * NOTE: index into a buffer is NOT a pointer to a * sub-buffer of the main buffer, it is only a pointer to a * single element (byte) of the buffer! + * + * Since we are returning the value of the buffer at the + * indexed location, we don't need to add an additional + * reference to the buffer itself. */ - ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); + ReturnDesc = AcpiUtCreateIntegerObject ((UINT64) + TempDesc->Buffer.Pointer[Operand[0]->Reference.Value]); if (!ReturnDesc) { Status = AE_NO_MEMORY; goto Cleanup; } - - /* - * Since we are returning the value of the buffer at the - * indexed location, we don't need to add an additional - * reference to the buffer itself. - */ - ReturnDesc->Integer.Value = - TempDesc->Buffer.Pointer[Operand[0]->Reference.Value]; break; diff --git a/sys/contrib/dev/acpica/executer/exoparg2.c b/sys/contrib/dev/acpica/executer/exoparg2.c index 899388b..b6e8478 100644 --- a/sys/contrib/dev/acpica/executer/exoparg2.c +++ b/sys/contrib/dev/acpica/executer/exoparg2.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -383,7 +383,7 @@ AcpiExOpcode_2A_1T_1R ( { ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; ACPI_OPERAND_OBJECT *ReturnDesc = NULL; - ACPI_INTEGER Index; + UINT64 Index; ACPI_STATUS Status = AE_OK; ACPI_SIZE Length; @@ -716,7 +716,7 @@ StoreLogicalResult: */ if (LogicalResult) { - ReturnDesc->Integer.Value = ACPI_INTEGER_MAX; + ReturnDesc->Integer.Value = ACPI_UINT64_MAX; } Cleanup: diff --git a/sys/contrib/dev/acpica/executer/exoparg3.c b/sys/contrib/dev/acpica/executer/exoparg3.c index 75ffcf6..c94a26d 100644 --- a/sys/contrib/dev/acpica/executer/exoparg3.c +++ b/sys/contrib/dev/acpica/executer/exoparg3.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -239,7 +239,7 @@ AcpiExOpcode_3A_1T_1R ( ACPI_OPERAND_OBJECT *ReturnDesc = NULL; char *Buffer = NULL; ACPI_STATUS Status = AE_OK; - ACPI_INTEGER Index; + UINT64 Index; ACPI_SIZE Length; diff --git a/sys/contrib/dev/acpica/executer/exoparg6.c b/sys/contrib/dev/acpica/executer/exoparg6.c index 5284ea6..d13e9f6 100644 --- a/sys/contrib/dev/acpica/executer/exoparg6.c +++ b/sys/contrib/dev/acpica/executer/exoparg6.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -305,7 +305,7 @@ AcpiExOpcode_6A_0T_1R ( ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; ACPI_OPERAND_OBJECT *ReturnDesc = NULL; ACPI_STATUS Status = AE_OK; - ACPI_INTEGER Index; + UINT64 Index; ACPI_OPERAND_OBJECT *ThisElement; @@ -344,8 +344,9 @@ AcpiExOpcode_6A_0T_1R ( } /* Create an integer for the return value */ + /* Default return value is ACPI_UINT64_MAX if no match found */ - ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); + ReturnDesc = AcpiUtCreateIntegerObject (ACPI_UINT64_MAX); if (!ReturnDesc) { Status = AE_NO_MEMORY; @@ -353,10 +354,6 @@ AcpiExOpcode_6A_0T_1R ( } - /* Default return value if no match found */ - - ReturnDesc->Integer.Value = ACPI_INTEGER_MAX; - /* * Examine each element until a match is found. Both match conditions * must be satisfied for a match to occur. Within the loop, @@ -365,7 +362,7 @@ AcpiExOpcode_6A_0T_1R ( * * Upon finding a match, the loop will terminate via "break" at * the bottom. If it terminates "normally", MatchValue will be - * ACPI_INTEGER_MAX (Ones) (its initial value) indicating that no + * ACPI_UINT64_MAX (Ones) (its initial value) indicating that no * match was found. */ for ( ; Index < Operand[0]->Package.Count; Index++) diff --git a/sys/contrib/dev/acpica/executer/exprep.c b/sys/contrib/dev/acpica/executer/exprep.c index 067d1bb..b60e09c 100644 --- a/sys/contrib/dev/acpica/executer/exprep.c +++ b/sys/contrib/dev/acpica/executer/exprep.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/executer/exregion.c b/sys/contrib/dev/acpica/executer/exregion.c index 73447dd..3969c58 100644 --- a/sys/contrib/dev/acpica/executer/exregion.c +++ b/sys/contrib/dev/acpica/executer/exregion.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -149,7 +149,7 @@ AcpiExSystemMemorySpaceHandler ( UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, - ACPI_INTEGER *Value, + UINT64 *Value, void *HandlerContext, void *RegionContext) { @@ -157,7 +157,8 @@ AcpiExSystemMemorySpaceHandler ( void *LogicalAddrPtr = NULL; ACPI_MEM_SPACE_CONTEXT *MemInfo = RegionContext; UINT32 Length; - ACPI_SIZE WindowSize; + ACPI_SIZE MapLength; + ACPI_SIZE PageBoundaryMapLength; #ifdef ACPI_MISALIGNMENT_NOT_SUPPORTED UINT32 Remainder; #endif @@ -197,7 +198,7 @@ AcpiExSystemMemorySpaceHandler ( * Hardware does not support non-aligned data transfers, we must verify * the request. */ - (void) AcpiUtShortDivide ((ACPI_INTEGER) Address, Length, NULL, &Remainder); + (void) AcpiUtShortDivide ((UINT64) Address, Length, NULL, &Remainder); if (Remainder != 0) { return_ACPI_STATUS (AE_AML_ALIGNMENT); @@ -210,8 +211,8 @@ AcpiExSystemMemorySpaceHandler ( * 2) Address beyond the current mapping? */ if ((Address < MemInfo->MappedPhysicalAddress) || - (((ACPI_INTEGER) Address + Length) > - ((ACPI_INTEGER) + (((UINT64) Address + Length) > + ((UINT64) MemInfo->MappedPhysicalAddress + MemInfo->MappedLength))) { /* @@ -227,26 +228,45 @@ AcpiExSystemMemorySpaceHandler ( } /* - * Don't attempt to map memory beyond the end of the region, and - * constrain the maximum mapping size to something reasonable. + * October 2009: Attempt to map from the requested address to the + * end of the region. However, we will never map more than one + * page, nor will we cross a page boundary. */ - WindowSize = (ACPI_SIZE) + MapLength = (ACPI_SIZE) ((MemInfo->Address + MemInfo->Length) - Address); - if (WindowSize > ACPI_SYSMEM_REGION_WINDOW_SIZE) + /* + * If mapping the entire remaining portion of the region will cross + * a page boundary, just map up to the page boundary, do not cross. + * On some systems, crossing a page boundary while mapping regions + * can cause warnings if the pages have different attributes + * due to resource management. + * + * This has the added benefit of constraining a single mapping to + * one page, which is similar to the original code that used a 4k + * maximum window. + */ + PageBoundaryMapLength = + ACPI_ROUND_UP (Address, ACPI_DEFAULT_PAGE_SIZE) - Address; + if (PageBoundaryMapLength == 0) + { + PageBoundaryMapLength = ACPI_DEFAULT_PAGE_SIZE; + } + + if (MapLength > PageBoundaryMapLength) { - WindowSize = ACPI_SYSMEM_REGION_WINDOW_SIZE; + MapLength = PageBoundaryMapLength; } /* Create a new mapping starting at the address given */ MemInfo->MappedLogicalAddress = AcpiOsMapMemory ( - (ACPI_PHYSICAL_ADDRESS) Address, WindowSize); + (ACPI_PHYSICAL_ADDRESS) Address, MapLength); if (!MemInfo->MappedLogicalAddress) { ACPI_ERROR ((AE_INFO, "Could not map memory at %8.8X%8.8X, size %X", - ACPI_FORMAT_NATIVE_UINT (Address), (UINT32) WindowSize)); + ACPI_FORMAT_NATIVE_UINT (Address), (UINT32) MapLength)); MemInfo->MappedLength = 0; return_ACPI_STATUS (AE_NO_MEMORY); } @@ -254,7 +274,7 @@ AcpiExSystemMemorySpaceHandler ( /* Save the physical address and mapping size */ MemInfo->MappedPhysicalAddress = Address; - MemInfo->MappedLength = WindowSize; + MemInfo->MappedLength = MapLength; } /* @@ -262,7 +282,7 @@ AcpiExSystemMemorySpaceHandler ( * access */ LogicalAddrPtr = MemInfo->MappedLogicalAddress + - ((ACPI_INTEGER) Address - (ACPI_INTEGER) MemInfo->MappedPhysicalAddress); + ((UINT64) Address - (UINT64) MemInfo->MappedPhysicalAddress); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "System-Memory (width %d) R/W %d Address=%8.8X%8.8X\n", @@ -284,19 +304,19 @@ AcpiExSystemMemorySpaceHandler ( switch (BitWidth) { case 8: - *Value = (ACPI_INTEGER) ACPI_GET8 (LogicalAddrPtr); + *Value = (UINT64) ACPI_GET8 (LogicalAddrPtr); break; case 16: - *Value = (ACPI_INTEGER) ACPI_GET16 (LogicalAddrPtr); + *Value = (UINT64) ACPI_GET16 (LogicalAddrPtr); break; case 32: - *Value = (ACPI_INTEGER) ACPI_GET32 (LogicalAddrPtr); + *Value = (UINT64) ACPI_GET32 (LogicalAddrPtr); break; case 64: - *Value = (ACPI_INTEGER) ACPI_GET64 (LogicalAddrPtr); + *Value = (UINT64) ACPI_GET64 (LogicalAddrPtr); break; default: @@ -363,7 +383,7 @@ AcpiExSystemIoSpaceHandler ( UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, - ACPI_INTEGER *Value, + UINT64 *Value, void *HandlerContext, void *RegionContext) { @@ -427,7 +447,7 @@ AcpiExPciConfigSpaceHandler ( UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, - ACPI_INTEGER *Value, + UINT64 *Value, void *HandlerContext, void *RegionContext) { @@ -507,7 +527,7 @@ AcpiExCmosSpaceHandler ( UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, - ACPI_INTEGER *Value, + UINT64 *Value, void *HandlerContext, void *RegionContext) { @@ -544,7 +564,7 @@ AcpiExPciBarSpaceHandler ( UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, - ACPI_INTEGER *Value, + UINT64 *Value, void *HandlerContext, void *RegionContext) { @@ -581,7 +601,7 @@ AcpiExDataTableSpaceHandler ( UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, - ACPI_INTEGER *Value, + UINT64 *Value, void *HandlerContext, void *RegionContext) { diff --git a/sys/contrib/dev/acpica/executer/exresnte.c b/sys/contrib/dev/acpica/executer/exresnte.c index 1265d1a..9a45afd 100644 --- a/sys/contrib/dev/acpica/executer/exresnte.c +++ b/sys/contrib/dev/acpica/executer/exresnte.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/executer/exresolv.c b/sys/contrib/dev/acpica/executer/exresolv.c index df8c802..e587bd1 100644 --- a/sys/contrib/dev/acpica/executer/exresolv.c +++ b/sys/contrib/dev/acpica/executer/exresolv.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/executer/exresop.c b/sys/contrib/dev/acpica/executer/exresop.c index 72ca085..22dd558 100644 --- a/sys/contrib/dev/acpica/executer/exresop.c +++ b/sys/contrib/dev/acpica/executer/exresop.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/executer/exstore.c b/sys/contrib/dev/acpica/executer/exstore.c index a4fd02d..ff9b940 100644 --- a/sys/contrib/dev/acpica/executer/exstore.c +++ b/sys/contrib/dev/acpica/executer/exstore.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/executer/exstoren.c b/sys/contrib/dev/acpica/executer/exstoren.c index c70c0ac..4df2a40 100644 --- a/sys/contrib/dev/acpica/executer/exstoren.c +++ b/sys/contrib/dev/acpica/executer/exstoren.c @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/executer/exstorob.c b/sys/contrib/dev/acpica/executer/exstorob.c index 38e29b9..3c67aa6 100644 --- a/sys/contrib/dev/acpica/executer/exstorob.c +++ b/sys/contrib/dev/acpica/executer/exstorob.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -150,6 +150,13 @@ AcpiExStoreBufferToBuffer ( ACPI_FUNCTION_TRACE_PTR (ExStoreBufferToBuffer, SourceDesc); + /* If Source and Target are the same, just return */ + + if (SourceDesc == TargetDesc) + { + return_ACPI_STATUS (AE_OK); + } + /* We know that SourceDesc is a buffer by now */ Buffer = ACPI_CAST_PTR (UINT8, SourceDesc->Buffer.Pointer); @@ -248,6 +255,13 @@ AcpiExStoreStringToString ( ACPI_FUNCTION_TRACE_PTR (ExStoreStringToString, SourceDesc); + /* If Source and Target are the same, just return */ + + if (SourceDesc == TargetDesc) + { + return_ACPI_STATUS (AE_OK); + } + /* We know that SourceDesc is a string by now */ Buffer = ACPI_CAST_PTR (UINT8, SourceDesc->String.Pointer); diff --git a/sys/contrib/dev/acpica/executer/exsystem.c b/sys/contrib/dev/acpica/executer/exsystem.c index 8ef0d0d..c9f746a 100644 --- a/sys/contrib/dev/acpica/executer/exsystem.c +++ b/sys/contrib/dev/acpica/executer/exsystem.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -293,7 +293,7 @@ AcpiExSystemDoStall ( ACPI_STATUS AcpiExSystemDoSuspend ( - ACPI_INTEGER HowLong) + UINT64 HowLong) { ACPI_FUNCTION_ENTRY (); diff --git a/sys/contrib/dev/acpica/executer/exutils.c b/sys/contrib/dev/acpica/executer/exutils.c index 22328f8..d90d6ea 100644 --- a/sys/contrib/dev/acpica/executer/exutils.c +++ b/sys/contrib/dev/acpica/executer/exutils.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -144,7 +144,7 @@ static UINT32 AcpiExDigitsNeeded ( - ACPI_INTEGER Value, + UINT64 Value, UINT32 Base); @@ -334,7 +334,7 @@ AcpiExTruncateFor32bitTable ( * We are running a method that exists in a 32-bit ACPI table. * Truncate the value to 32 bits by zeroing out the upper 32-bit field */ - ObjDesc->Integer.Value &= (ACPI_INTEGER) ACPI_UINT32_MAX; + ObjDesc->Integer.Value &= (UINT64) ACPI_UINT32_MAX; } } @@ -446,17 +446,17 @@ AcpiExReleaseGlobalLock ( static UINT32 AcpiExDigitsNeeded ( - ACPI_INTEGER Value, + UINT64 Value, UINT32 Base) { UINT32 NumDigits; - ACPI_INTEGER CurrentValue; + UINT64 CurrentValue; ACPI_FUNCTION_TRACE (ExDigitsNeeded); - /* ACPI_INTEGER is unsigned, so we don't worry about a '-' prefix */ + /* UINT64 is unsigned, so we don't worry about a '-' prefix */ if (Value == 0) { @@ -482,59 +482,76 @@ AcpiExDigitsNeeded ( * * FUNCTION: AcpiExEisaIdToString * - * PARAMETERS: NumericId - EISA ID to be converted + * PARAMETERS: CompressedId - EISAID to be converted * OutString - Where to put the converted string (8 bytes) * * RETURN: None * - * DESCRIPTION: Convert a numeric EISA ID to string representation + * DESCRIPTION: Convert a numeric EISAID to string representation. Return + * buffer must be large enough to hold the string. The string + * returned is always exactly of length ACPI_EISAID_STRING_SIZE + * (includes null terminator). The EISAID is always 32 bits. * ******************************************************************************/ void AcpiExEisaIdToString ( - UINT32 NumericId, - char *OutString) + char *OutString, + UINT64 CompressedId) { - UINT32 EisaId; + UINT32 SwappedId; ACPI_FUNCTION_ENTRY (); + /* The EISAID should be a 32-bit integer */ + + if (CompressedId > ACPI_UINT32_MAX) + { + ACPI_WARNING ((AE_INFO, + "Expected EISAID is larger than 32 bits: 0x%8.8X%8.8X, truncating", + ACPI_FORMAT_UINT64 (CompressedId))); + } + /* Swap ID to big-endian to get contiguous bits */ - EisaId = AcpiUtDwordByteSwap (NumericId); + SwappedId = AcpiUtDwordByteSwap ((UINT32) CompressedId); + + /* First 3 bytes are uppercase letters. Next 4 bytes are hexadecimal */ - OutString[0] = (char) ('@' + (((unsigned long) EisaId >> 26) & 0x1f)); - OutString[1] = (char) ('@' + ((EisaId >> 21) & 0x1f)); - OutString[2] = (char) ('@' + ((EisaId >> 16) & 0x1f)); - OutString[3] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) EisaId, 12); - OutString[4] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) EisaId, 8); - OutString[5] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) EisaId, 4); - OutString[6] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) EisaId, 0); + OutString[0] = (char) (0x40 + (((unsigned long) SwappedId >> 26) & 0x1F)); + OutString[1] = (char) (0x40 + ((SwappedId >> 21) & 0x1F)); + OutString[2] = (char) (0x40 + ((SwappedId >> 16) & 0x1F)); + OutString[3] = AcpiUtHexToAsciiChar ((UINT64) SwappedId, 12); + OutString[4] = AcpiUtHexToAsciiChar ((UINT64) SwappedId, 8); + OutString[5] = AcpiUtHexToAsciiChar ((UINT64) SwappedId, 4); + OutString[6] = AcpiUtHexToAsciiChar ((UINT64) SwappedId, 0); OutString[7] = 0; } /******************************************************************************* * - * FUNCTION: AcpiExUnsignedIntegerToString + * FUNCTION: AcpiExIntegerToString * - * PARAMETERS: Value - Value to be converted - * OutString - Where to put the converted string (8 bytes) + * PARAMETERS: OutString - Where to put the converted string. At least + * 21 bytes are needed to hold the largest + * possible 64-bit integer. + * Value - Value to be converted * * RETURN: None, string * - * DESCRIPTION: Convert a number to string representation. Assumes string - * buffer is large enough to hold the string. + * DESCRIPTION: Convert a 64-bit integer to decimal string representation. + * Assumes string buffer is large enough to hold the string. The + * largest string is (ACPI_MAX64_DECIMAL_DIGITS + 1). * ******************************************************************************/ void -AcpiExUnsignedIntegerToString ( - ACPI_INTEGER Value, - char *OutString) +AcpiExIntegerToString ( + char *OutString, + UINT64 Value) { UINT32 Count; UINT32 DigitsNeeded; diff --git a/sys/contrib/dev/acpica/hardware/hwacpi.c b/sys/contrib/dev/acpica/hardware/hwacpi.c index 2f30774..9d7b898 100644 --- a/sys/contrib/dev/acpica/hardware/hwacpi.c +++ b/sys/contrib/dev/acpica/hardware/hwacpi.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/hardware/hwgpe.c b/sys/contrib/dev/acpica/hardware/hwgpe.c index 9b53da8..5b02856 100644 --- a/sys/contrib/dev/acpica/hardware/hwgpe.c +++ b/sys/contrib/dev/acpica/hardware/hwgpe.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -161,7 +161,7 @@ AcpiHwLowDisableGpe ( /* Get current value of the enable register that contains this GPE */ - Status = AcpiRead (&EnableMask, &GpeRegisterInfo->EnableAddress); + Status = AcpiHwRead (&EnableMask, &GpeRegisterInfo->EnableAddress); if (ACPI_FAILURE (Status)) { return (Status); @@ -175,7 +175,7 @@ AcpiHwLowDisableGpe ( /* Write the updated enable mask */ - Status = AcpiWrite (EnableMask, &GpeRegisterInfo->EnableAddress); + Status = AcpiHwWrite (EnableMask, &GpeRegisterInfo->EnableAddress); return (Status); } @@ -215,7 +215,7 @@ AcpiHwWriteGpeEnableReg ( /* Write the entire GPE (runtime) enable register */ - Status = AcpiWrite (GpeRegisterInfo->EnableForRun, + Status = AcpiHwWrite (GpeRegisterInfo->EnableForRun, &GpeRegisterInfo->EnableAddress); return (Status); @@ -252,7 +252,7 @@ AcpiHwClearGpe ( * Write a one to the appropriate bit in the status register to * clear this GPE. */ - Status = AcpiWrite (RegisterBit, + Status = AcpiHwWrite (RegisterBit, &GpeEventInfo->RegisterInfo->StatusAddress); return (Status); @@ -317,10 +317,10 @@ AcpiHwGetGpeStatus ( /* GPE currently active (status bit == 1)? */ - Status = AcpiRead (&InByte, &GpeRegisterInfo->StatusAddress); + Status = AcpiHwRead (&InByte, &GpeRegisterInfo->StatusAddress); if (ACPI_FAILURE (Status)) { - goto UnlockAndExit; + return (Status); } if (RegisterBit & InByte) @@ -331,10 +331,7 @@ AcpiHwGetGpeStatus ( /* Set return value */ (*EventStatus) = LocalEventStatus; - - -UnlockAndExit: - return (Status); + return (AE_OK); } @@ -367,7 +364,7 @@ AcpiHwDisableGpeBlock ( { /* Disable all GPEs in this register */ - Status = AcpiWrite (0x00, &GpeBlock->RegisterInfo[i].EnableAddress); + Status = AcpiHwWrite (0x00, &GpeBlock->RegisterInfo[i].EnableAddress); if (ACPI_FAILURE (Status)) { return (Status); @@ -407,7 +404,7 @@ AcpiHwClearGpeBlock ( { /* Clear status on all GPEs in this register */ - Status = AcpiWrite (0xFF, &GpeBlock->RegisterInfo[i].StatusAddress); + Status = AcpiHwWrite (0xFF, &GpeBlock->RegisterInfo[i].StatusAddress); if (ACPI_FAILURE (Status)) { return (Status); @@ -455,7 +452,7 @@ AcpiHwEnableRuntimeGpeBlock ( /* Enable all "runtime" GPEs in this register */ - Status = AcpiWrite (GpeBlock->RegisterInfo[i].EnableForRun, + Status = AcpiHwWrite (GpeBlock->RegisterInfo[i].EnableForRun, &GpeBlock->RegisterInfo[i].EnableAddress); if (ACPI_FAILURE (Status)) { @@ -502,7 +499,7 @@ AcpiHwEnableWakeupGpeBlock ( /* Enable all "wake" GPEs in this register */ - Status = AcpiWrite (GpeBlock->RegisterInfo[i].EnableForWake, + Status = AcpiHwWrite (GpeBlock->RegisterInfo[i].EnableForWake, &GpeBlock->RegisterInfo[i].EnableAddress); if (ACPI_FAILURE (Status)) { diff --git a/sys/contrib/dev/acpica/hardware/hwregs.c b/sys/contrib/dev/acpica/hardware/hwregs.c index bf56498..26ee462 100644 --- a/sys/contrib/dev/acpica/hardware/hwregs.c +++ b/sys/contrib/dev/acpica/hardware/hwregs.c @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -140,6 +140,209 @@ AcpiHwWriteMultiple ( ACPI_GENERIC_ADDRESS *RegisterB); +/****************************************************************************** + * + * FUNCTION: AcpiHwValidateRegister + * + * PARAMETERS: Reg - GAS register structure + * MaxBitWidth - Max BitWidth supported (32 or 64) + * Address - Pointer to where the gas->address + * is returned + * + * RETURN: Status + * + * DESCRIPTION: Validate the contents of a GAS register. Checks the GAS + * pointer, Address, SpaceId, BitWidth, and BitOffset. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiHwValidateRegister ( + ACPI_GENERIC_ADDRESS *Reg, + UINT8 MaxBitWidth, + UINT64 *Address) +{ + + /* Must have a valid pointer to a GAS structure */ + + if (!Reg) + { + return (AE_BAD_PARAMETER); + } + + /* + * Copy the target address. This handles possible alignment issues. + * Address must not be null. A null address also indicates an optional + * ACPI register that is not supported, so no error message. + */ + ACPI_MOVE_64_TO_64 (Address, &Reg->Address); + if (!(*Address)) + { + return (AE_BAD_ADDRESS); + } + + /* Validate the SpaceID */ + + if ((Reg->SpaceId != ACPI_ADR_SPACE_SYSTEM_MEMORY) && + (Reg->SpaceId != ACPI_ADR_SPACE_SYSTEM_IO)) + { + ACPI_ERROR ((AE_INFO, + "Unsupported address space: 0x%X", Reg->SpaceId)); + return (AE_SUPPORT); + } + + /* Validate the BitWidth */ + + if ((Reg->BitWidth != 8) && + (Reg->BitWidth != 16) && + (Reg->BitWidth != 32) && + (Reg->BitWidth != MaxBitWidth)) + { + ACPI_ERROR ((AE_INFO, + "Unsupported register bit width: 0x%X", Reg->BitWidth)); + return (AE_SUPPORT); + } + + /* Validate the BitOffset. Just a warning for now. */ + + if (Reg->BitOffset != 0) + { + ACPI_WARNING ((AE_INFO, + "Unsupported register bit offset: 0x%X", Reg->BitOffset)); + } + + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiHwRead + * + * PARAMETERS: Value - Where the value is returned + * Reg - GAS register structure + * + * RETURN: Status + * + * DESCRIPTION: Read from either memory or IO space. This is a 32-bit max + * version of AcpiRead, used internally since the overhead of + * 64-bit values is not needed. + * + * LIMITATIONS: <These limitations also apply to AcpiHwWrite> + * BitWidth must be exactly 8, 16, or 32. + * SpaceID must be SystemMemory or SystemIO. + * BitOffset and AccessWidth are currently ignored, as there has + * not been a need to implement these. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiHwRead ( + UINT32 *Value, + ACPI_GENERIC_ADDRESS *Reg) +{ + UINT64 Address; + ACPI_STATUS Status; + + + ACPI_FUNCTION_NAME (HwRead); + + + /* Validate contents of the GAS register */ + + Status = AcpiHwValidateRegister (Reg, 32, &Address); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* Initialize entire 32-bit return value to zero */ + + *Value = 0; + + /* + * Two address spaces supported: Memory or IO. PCI_Config is + * not supported here because the GAS structure is insufficient + */ + if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY) + { + Status = AcpiOsReadMemory ((ACPI_PHYSICAL_ADDRESS) + Address, Value, Reg->BitWidth); + } + else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */ + { + Status = AcpiHwReadPort ((ACPI_IO_ADDRESS) + Address, Value, Reg->BitWidth); + } + + ACPI_DEBUG_PRINT ((ACPI_DB_IO, + "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n", + *Value, Reg->BitWidth, ACPI_FORMAT_UINT64 (Address), + AcpiUtGetRegionName (Reg->SpaceId))); + + return (Status); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiHwWrite + * + * PARAMETERS: Value - Value to be written + * Reg - GAS register structure + * + * RETURN: Status + * + * DESCRIPTION: Write to either memory or IO space. This is a 32-bit max + * version of AcpiWrite, used internally since the overhead of + * 64-bit values is not needed. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiHwWrite ( + UINT32 Value, + ACPI_GENERIC_ADDRESS *Reg) +{ + UINT64 Address; + ACPI_STATUS Status; + + + ACPI_FUNCTION_NAME (HwWrite); + + + /* Validate contents of the GAS register */ + + Status = AcpiHwValidateRegister (Reg, 32, &Address); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* + * Two address spaces supported: Memory or IO. PCI_Config is + * not supported here because the GAS structure is insufficient + */ + if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY) + { + Status = AcpiOsWriteMemory ((ACPI_PHYSICAL_ADDRESS) + Address, Value, Reg->BitWidth); + } + else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */ + { + Status = AcpiHwWritePort ((ACPI_IO_ADDRESS) + Address, Value, Reg->BitWidth); + } + + ACPI_DEBUG_PRINT ((ACPI_DB_IO, + "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n", + Value, Reg->BitWidth, ACPI_FORMAT_UINT64 (Address), + AcpiUtGetRegionName (Reg->SpaceId))); + + return (Status); +} + + /******************************************************************************* * * FUNCTION: AcpiHwClearAcpiStatus @@ -245,7 +448,7 @@ AcpiHwWritePm1Control ( ACPI_FUNCTION_TRACE (HwWritePm1Control); - Status = AcpiWrite (Pm1aControl, &AcpiGbl_FADT.XPm1aControlBlock); + Status = AcpiHwWrite (Pm1aControl, &AcpiGbl_FADT.XPm1aControlBlock); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -253,7 +456,7 @@ AcpiHwWritePm1Control ( if (AcpiGbl_FADT.XPm1bControlBlock.Address) { - Status = AcpiWrite (Pm1bControl, &AcpiGbl_FADT.XPm1bControlBlock); + Status = AcpiHwWrite (Pm1bControl, &AcpiGbl_FADT.XPm1bControlBlock); } return_ACPI_STATUS (Status); } @@ -319,13 +522,13 @@ AcpiHwRegisterRead ( case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */ - Status = AcpiRead (&Value, &AcpiGbl_FADT.XPm2ControlBlock); + Status = AcpiHwRead (&Value, &AcpiGbl_FADT.XPm2ControlBlock); break; case ACPI_REGISTER_PM_TIMER: /* 32-bit access */ - Status = AcpiRead (&Value, &AcpiGbl_FADT.XPmTimerBlock); + Status = AcpiHwRead (&Value, &AcpiGbl_FADT.XPmTimerBlock); break; @@ -450,7 +653,7 @@ AcpiHwRegisterWrite ( * For control registers, all reserved bits must be preserved, * as per the ACPI spec. */ - Status = AcpiRead (&ReadValue, &AcpiGbl_FADT.XPm2ControlBlock); + Status = AcpiHwRead (&ReadValue, &AcpiGbl_FADT.XPm2ControlBlock); if (ACPI_FAILURE (Status)) { goto Exit; @@ -460,13 +663,13 @@ AcpiHwRegisterWrite ( ACPI_INSERT_BITS (Value, ACPI_PM2_CONTROL_PRESERVED_BITS, ReadValue); - Status = AcpiWrite (Value, &AcpiGbl_FADT.XPm2ControlBlock); + Status = AcpiHwWrite (Value, &AcpiGbl_FADT.XPm2ControlBlock); break; case ACPI_REGISTER_PM_TIMER: /* 32-bit access */ - Status = AcpiWrite (Value, &AcpiGbl_FADT.XPmTimerBlock); + Status = AcpiHwWrite (Value, &AcpiGbl_FADT.XPmTimerBlock); break; @@ -517,7 +720,7 @@ AcpiHwReadMultiple ( /* The first register is always required */ - Status = AcpiRead (&ValueA, RegisterA); + Status = AcpiHwRead (&ValueA, RegisterA); if (ACPI_FAILURE (Status)) { return (Status); @@ -527,7 +730,7 @@ AcpiHwReadMultiple ( if (RegisterB->Address) { - Status = AcpiRead (&ValueB, RegisterB); + Status = AcpiHwRead (&ValueB, RegisterB); if (ACPI_FAILURE (Status)) { return (Status); @@ -574,7 +777,7 @@ AcpiHwWriteMultiple ( /* The first register is always required */ - Status = AcpiWrite (Value, RegisterA); + Status = AcpiHwWrite (Value, RegisterA); if (ACPI_FAILURE (Status)) { return (Status); @@ -594,7 +797,7 @@ AcpiHwWriteMultiple ( */ if (RegisterB->Address) { - Status = AcpiWrite (Value, RegisterB); + Status = AcpiHwWrite (Value, RegisterB); } return (Status); diff --git a/sys/contrib/dev/acpica/hardware/hwsleep.c b/sys/contrib/dev/acpica/hardware/hwsleep.c index f13b749..7026c69 100644 --- a/sys/contrib/dev/acpica/hardware/hwsleep.c +++ b/sys/contrib/dev/acpica/hardware/hwsleep.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -346,10 +346,13 @@ AcpiEnterSleepState ( if (SleepState != ACPI_STATE_S5) { - /* Disable BM arbitration */ - + /* + * Disable BM arbitration. This feature is contained within an + * optional register (PM2 Control), so ignore a BAD_ADDRESS + * exception. + */ Status = AcpiWriteBitRegister (ACPI_BITREG_ARB_DISABLE, 1); - if (ACPI_FAILURE (Status)) + if (ACPI_FAILURE (Status) && (Status != AE_BAD_ADDRESS)) { return_ACPI_STATUS (Status); } @@ -694,10 +697,13 @@ AcpiLeaveSleepState ( AcpiGbl_FixedEventInfo[ACPI_EVENT_POWER_BUTTON].StatusRegisterId, ACPI_CLEAR_STATUS); - /* Enable BM arbitration */ - + /* + * Enable BM arbitration. This feature is contained within an + * optional register (PM2 Control), so ignore a BAD_ADDRESS + * exception. + */ Status = AcpiWriteBitRegister (ACPI_BITREG_ARB_DISABLE, 0); - if (ACPI_FAILURE (Status)) + if (ACPI_FAILURE (Status) && (Status != AE_BAD_ADDRESS)) { return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/hardware/hwtimer.c b/sys/contrib/dev/acpica/hardware/hwtimer.c index 96aa088..b9b6031 100644 --- a/sys/contrib/dev/acpica/hardware/hwtimer.c +++ b/sys/contrib/dev/acpica/hardware/hwtimer.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -187,7 +187,7 @@ AcpiGetTimer ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - Status = AcpiRead (Ticks, &AcpiGbl_FADT.XPmTimerBlock); + Status = AcpiHwRead (Ticks, &AcpiGbl_FADT.XPmTimerBlock); return_ACPI_STATUS (Status); } @@ -232,7 +232,7 @@ AcpiGetTimerDuration ( { ACPI_STATUS Status; UINT32 DeltaTicks; - ACPI_INTEGER Quotient; + UINT64 Quotient; ACPI_FUNCTION_TRACE (AcpiGetTimerDuration); diff --git a/sys/contrib/dev/acpica/hardware/hwvalid.c b/sys/contrib/dev/acpica/hardware/hwvalid.c index 395c995..8c369b1 100644 --- a/sys/contrib/dev/acpica/hardware/hwvalid.c +++ b/sys/contrib/dev/acpica/hardware/hwvalid.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/hardware/hwxface.c b/sys/contrib/dev/acpica/hardware/hwxface.c index c877316..e7815cc 100644 --- a/sys/contrib/dev/acpica/hardware/hwxface.c +++ b/sys/contrib/dev/acpica/hardware/hwxface.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -157,9 +157,23 @@ AcpiReset ( return_ACPI_STATUS (AE_NOT_EXIST); } - /* Write the reset value to the reset register */ + if (ResetReg->SpaceId == ACPI_ADR_SPACE_SYSTEM_IO) + { + /* + * For I/O space, write directly to the OSL. This bypasses the port + * validation mechanism, which may block a valid write to the reset + * register. + */ + Status = AcpiOsWritePort ((ACPI_IO_ADDRESS) ResetReg->Address, + AcpiGbl_FADT.ResetValue, ResetReg->BitWidth); + } + else + { + /* Write the reset value to the reset register */ + + Status = AcpiHwWrite (AcpiGbl_FADT.ResetValue, ResetReg); + } - Status = AcpiWrite (AcpiGbl_FADT.ResetValue, ResetReg); return_ACPI_STATUS (Status); } @@ -177,13 +191,20 @@ ACPI_EXPORT_SYMBOL (AcpiReset) * * DESCRIPTION: Read from either memory or IO space. * + * LIMITATIONS: <These limitations also apply to AcpiWrite> + * BitWidth must be exactly 8, 16, 32, or 64. + * SpaceID must be SystemMemory or SystemIO. + * BitOffset and AccessWidth are currently ignored, as there has + * not been a need to implement these. + * ******************************************************************************/ ACPI_STATUS AcpiRead ( - UINT32 *Value, + UINT64 *ReturnValue, ACPI_GENERIC_ADDRESS *Reg) { + UINT32 Value; UINT32 Width; UINT64 Address; ACPI_STATUS Status; @@ -192,63 +213,85 @@ AcpiRead ( ACPI_FUNCTION_NAME (AcpiRead); - /* - * Must have a valid pointer to a GAS structure, and a non-zero address - * within. - */ - if (!Reg) + if (!ReturnValue) { return (AE_BAD_PARAMETER); } - /* Get a local copy of the address. Handles possible alignment issues */ + /* Validate contents of the GAS register. Allow 64-bit transfers */ - ACPI_MOVE_64_TO_64 (&Address, &Reg->Address); - if (!Address) + Status = AcpiHwValidateRegister (Reg, 64, &Address); + if (ACPI_FAILURE (Status)) { - return (AE_BAD_ADDRESS); + return (Status); } - /* Supported widths are 8/16/32 */ - Width = Reg->BitWidth; - if ((Width != 8) && (Width != 16) && (Width != 32)) + if (Width == 64) { - return (AE_SUPPORT); + Width = 32; /* Break into two 32-bit transfers */ } - /* Initialize entire 32-bit return value to zero */ + /* Initialize entire 64-bit return value to zero */ - *Value = 0; + *ReturnValue = 0; + Value = 0; /* * Two address spaces supported: Memory or IO. PCI_Config is * not supported here because the GAS structure is insufficient */ - switch (Reg->SpaceId) + if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY) { - case ACPI_ADR_SPACE_SYSTEM_MEMORY: - - Status = AcpiOsReadMemory ( - (ACPI_PHYSICAL_ADDRESS) Address, Value, Width); - break; - - - case ACPI_ADR_SPACE_SYSTEM_IO: - - Status = AcpiHwReadPort ((ACPI_IO_ADDRESS) Address, Value, Width); - break; + Status = AcpiOsReadMemory ((ACPI_PHYSICAL_ADDRESS) + Address, &Value, Width); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + *ReturnValue = Value; + if (Reg->BitWidth == 64) + { + /* Read the top 32 bits */ + + Status = AcpiOsReadMemory ((ACPI_PHYSICAL_ADDRESS) + (Address + 4), &Value, 32); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + *ReturnValue |= ((UINT64) Value << 32); + } + } + else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */ + { + Status = AcpiHwReadPort ((ACPI_IO_ADDRESS) + Address, &Value, Width); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + *ReturnValue = Value; - default: - ACPI_ERROR ((AE_INFO, - "Unsupported address space: %X", Reg->SpaceId)); - return (AE_BAD_PARAMETER); + if (Reg->BitWidth == 64) + { + /* Read the top 32 bits */ + + Status = AcpiHwReadPort ((ACPI_IO_ADDRESS) + (Address + 4), &Value, 32); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + *ReturnValue |= ((UINT64) Value << 32); + } } ACPI_DEBUG_PRINT ((ACPI_DB_IO, - "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n", - *Value, Width, ACPI_FORMAT_UINT64 (Address), + "Read: %8.8X%8.8X width %2d from %8.8X%8.8X (%s)\n", + ACPI_FORMAT_UINT64 (*ReturnValue), Reg->BitWidth, + ACPI_FORMAT_UINT64 (Address), AcpiUtGetRegionName (Reg->SpaceId))); return (Status); @@ -261,7 +304,7 @@ ACPI_EXPORT_SYMBOL (AcpiRead) * * FUNCTION: AcpiWrite * - * PARAMETERS: Value - To be written + * PARAMETERS: Value - Value to be written * Reg - GAS register structure * * RETURN: Status @@ -272,7 +315,7 @@ ACPI_EXPORT_SYMBOL (AcpiRead) ACPI_STATUS AcpiWrite ( - UINT32 Value, + UINT64 Value, ACPI_GENERIC_ADDRESS *Reg) { UINT32 Width; @@ -283,60 +326,67 @@ AcpiWrite ( ACPI_FUNCTION_NAME (AcpiWrite); - /* - * Must have a valid pointer to a GAS structure, and a non-zero address - * within. - */ - if (!Reg) - { - return (AE_BAD_PARAMETER); - } - - /* Get a local copy of the address. Handles possible alignment issues */ + /* Validate contents of the GAS register. Allow 64-bit transfers */ - ACPI_MOVE_64_TO_64 (&Address, &Reg->Address); - if (!Address) + Status = AcpiHwValidateRegister (Reg, 64, &Address); + if (ACPI_FAILURE (Status)) { - return (AE_BAD_ADDRESS); + return (Status); } - /* Supported widths are 8/16/32 */ - Width = Reg->BitWidth; - if ((Width != 8) && (Width != 16) && (Width != 32)) + if (Width == 64) { - return (AE_SUPPORT); + Width = 32; /* Break into two 32-bit transfers */ } /* - * Two address spaces supported: Memory or IO. - * PCI_Config is not supported here because the GAS struct is insufficient + * Two address spaces supported: Memory or IO. PCI_Config is + * not supported here because the GAS structure is insufficient */ - switch (Reg->SpaceId) + if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY) { - case ACPI_ADR_SPACE_SYSTEM_MEMORY: - - Status = AcpiOsWriteMemory ( - (ACPI_PHYSICAL_ADDRESS) Address, Value, Width); - break; - - - case ACPI_ADR_SPACE_SYSTEM_IO: - - Status = AcpiHwWritePort ( - (ACPI_IO_ADDRESS) Address, Value, Width); - break; + Status = AcpiOsWriteMemory ((ACPI_PHYSICAL_ADDRESS) + Address, ACPI_LODWORD (Value), Width); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + if (Reg->BitWidth == 64) + { + Status = AcpiOsWriteMemory ((ACPI_PHYSICAL_ADDRESS) + (Address + 4), ACPI_HIDWORD (Value), 32); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + } + } + else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */ + { + Status = AcpiHwWritePort ((ACPI_IO_ADDRESS) + Address, ACPI_LODWORD (Value), Width); + if (ACPI_FAILURE (Status)) + { + return (Status); + } - default: - ACPI_ERROR ((AE_INFO, - "Unsupported address space: %X", Reg->SpaceId)); - return (AE_BAD_PARAMETER); + if (Reg->BitWidth == 64) + { + Status = AcpiHwWritePort ((ACPI_IO_ADDRESS) + (Address + 4), ACPI_HIDWORD (Value), 32); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + } } ACPI_DEBUG_PRINT ((ACPI_DB_IO, - "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n", - Value, Width, ACPI_FORMAT_UINT64 (Address), + "Wrote: %8.8X%8.8X width %2d to %8.8X%8.8X (%s)\n", + ACPI_FORMAT_UINT64 (Value), Reg->BitWidth, + ACPI_FORMAT_UINT64 (Address), AcpiUtGetRegionName (Reg->SpaceId))); return (Status); diff --git a/sys/contrib/dev/acpica/include/acapps.h b/sys/contrib/dev/acpica/include/acapps.h index e1f31b7..418e20f 100644 --- a/sys/contrib/dev/acpica/include/acapps.h +++ b/sys/contrib/dev/acpica/include/acapps.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -124,21 +124,21 @@ #define FILE_SUFFIX_DISASSEMBLY "dsl" #define ACPI_TABLE_FILE_SUFFIX ".dat" -extern UINT8 *DsdtPtr; -extern UINT32 AcpiDsdtLength; -extern UINT8 *AmlStart; -extern UINT32 AmlLength; - - -extern int AcpiGbl_Optind; -extern char *AcpiGbl_Optarg; +/* + * getopt + */ int AcpiGetopt( int argc, char **argv, char *opts); +extern int AcpiGbl_Optind; +extern int AcpiGbl_Opterr; +extern char *AcpiGbl_Optarg; + + /* * adisasm */ @@ -151,7 +151,8 @@ AdAmlDisassemble ( BOOLEAN GetAllTables); void -AdPrintStatistics (void); +AdPrintStatistics ( + void); ACPI_STATUS AdFindDsdt( @@ -159,7 +160,8 @@ AdFindDsdt( UINT32 *DsdtLength); void -AdDumpTables (void); +AdDumpTables ( + void); ACPI_STATUS AdGetLocalTables ( @@ -179,7 +181,9 @@ AdDisplayTables ( ACPI_TABLE_HEADER *Table); ACPI_STATUS -AdDisplayStatistics (void); +AdDisplayStatistics ( + void); + /* * adwalk @@ -209,6 +213,7 @@ AcpiDmConvertResourceIndexes ( ACPI_PARSE_OBJECT *ParseTreeRoot, ACPI_NAMESPACE_NODE *NamespaceRoot); + /* * adfile */ @@ -228,11 +233,6 @@ FlSplitInputPathname ( char **OutFilename); char * -FlGenerateFilename ( - char *InputFilename, - char *Suffix); - -char * AdGenerateFilename ( char *Prefix, char *TableId); diff --git a/sys/contrib/dev/acpica/include/accommon.h b/sys/contrib/dev/acpica/include/accommon.h index 98331d6..5853e6f 100644 --- a/sys/contrib/dev/acpica/include/accommon.h +++ b/sys/contrib/dev/acpica/include/accommon.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/include/acconfig.h b/sys/contrib/dev/acpica/include/acconfig.h index 7b458cc..9417b44 100644 --- a/sys/contrib/dev/acpica/include/acconfig.h +++ b/sys/contrib/dev/acpica/include/acconfig.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -177,9 +177,9 @@ #define ACPI_MAX_REFERENCE_COUNT 0x800 -/* Size of cached memory mapping for system memory operation region */ +/* Default page size for use in mapping memory for operation regions */ -#define ACPI_SYSMEM_REGION_WINDOW_SIZE 4096 +#define ACPI_DEFAULT_PAGE_SIZE 4096 /* Must be power of 2 */ /* OwnerId tracking. 8 entries allows for 255 OwnerIds */ @@ -236,7 +236,7 @@ /* Operation regions */ -#define ACPI_NUM_PREDEFINED_REGIONS 8 +#define ACPI_NUM_PREDEFINED_REGIONS 9 #define ACPI_USER_REGION_BEGIN 0x80 /* Maximum SpaceIds for Operation Regions */ @@ -252,9 +252,15 @@ #define ACPI_RSDP_CHECKSUM_LENGTH 20 #define ACPI_RSDP_XCHECKSUM_LENGTH 36 -/* SMBus bidirectional buffer size */ +/* SMBus and IPMI bidirectional buffer size */ #define ACPI_SMBUS_BUFFER_SIZE 34 +#define ACPI_IPMI_BUFFER_SIZE 66 + +/* _SxD and _SxW control methods */ + +#define ACPI_NUM_SxD_METHODS 4 +#define ACPI_NUM_SxW_METHODS 5 /****************************************************************************** diff --git a/sys/contrib/dev/acpica/include/acdebug.h b/sys/contrib/dev/acpica/include/acdebug.h index 7e72094..2be2fd4 100644 --- a/sys/contrib/dev/acpica/include/acdebug.h +++ b/sys/contrib/dev/acpica/include/acdebug.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -126,13 +126,19 @@ typedef struct CommandInfo } COMMAND_INFO; - typedef struct ArgumentInfo { char *Name; /* Argument Name */ } ARGUMENT_INFO; +typedef struct acpi_execute_walk +{ + UINT32 Count; + UINT32 MaxCount; + +} ACPI_EXECUTE_WALK; + #define PARAM_LIST(pl) pl #define DBTEST_OUTPUT_LEVEL(lvl) if (AcpiGbl_DbOpt_verbose) @@ -265,7 +271,7 @@ AcpiDbCheckPredefinedNames ( void AcpiDbBatchExecute ( - void); + char *CountArg); /* * dbdisply - debug display commands @@ -313,6 +319,7 @@ AcpiDbDisplayArgumentObject ( ACPI_OPERAND_OBJECT *ObjDesc, ACPI_WALK_STATE *WalkState); + /* * dbexec - debugger control method execution */ diff --git a/sys/contrib/dev/acpica/include/acdisasm.h b/sys/contrib/dev/acpica/include/acdisasm.h index ccc15f2..6c61f84 100644 --- a/sys/contrib/dev/acpica/include/acdisasm.h +++ b/sys/contrib/dev/acpica/include/acdisasm.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -125,18 +125,6 @@ #define BLOCK_COMMA_LIST 4 #define ACPI_DEFAULT_RESNAME *(UINT32 *) "__RD" -typedef struct acpi_external_list -{ - char *Path; - char *InternalPath; - struct acpi_external_list *Next; - UINT32 Value; - UINT16 Length; - UINT8 Type; - -} ACPI_EXTERNAL_LIST; - -extern ACPI_EXTERNAL_LIST *AcpiGbl_ExternalList; typedef const struct acpi_dmtable_info { @@ -183,6 +171,9 @@ typedef const struct acpi_dmtable_info #define ACPI_DMT_EXIT 30 #define ACPI_DMT_SIG 31 #define ACPI_DMT_FADTPM 32 +#define ACPI_DMT_BUF16 33 +#define ACPI_DMT_IVRS 34 + typedef void (*ACPI_DMTABLE_HANDLER) ( @@ -250,6 +241,7 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmarScope[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar1[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar2[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar3[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoEcdt[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoEinj[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoEinj0[]; @@ -263,15 +255,22 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoHeader[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest1[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest3[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest4[]; -extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest5[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest2[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest6[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest7[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest8[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest9[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoHestNotify[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoHestBank[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoHpet[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs0[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs1[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs4[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs8a[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs8b[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs8c[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoIvrsHdr[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt1[]; @@ -287,6 +286,8 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt10[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadtHdr[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMcfg[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMcfg0[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoMsct[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoMsct0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoRsdp1[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoRsdp2[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoSbst[]; @@ -300,6 +301,10 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoSrat0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoSrat1[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoSrat2[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoTcpa[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoUefi[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoWaet[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoWdat[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoWdat0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoWdrt[]; @@ -364,6 +369,10 @@ AcpiDmDumpHest ( ACPI_TABLE_HEADER *Table); void +AcpiDmDumpIvrs ( + ACPI_TABLE_HEADER *Table); + +void AcpiDmDumpMcfg ( ACPI_TABLE_HEADER *Table); @@ -371,6 +380,10 @@ void AcpiDmDumpMadt ( ACPI_TABLE_HEADER *Table); +void +AcpiDmDumpMsct ( + ACPI_TABLE_HEADER *Table); + UINT32 AcpiDmDumpRsdp ( ACPI_TABLE_HEADER *Table); @@ -388,6 +401,10 @@ AcpiDmDumpSrat ( ACPI_TABLE_HEADER *Table); void +AcpiDmDumpWdat ( + ACPI_TABLE_HEADER *Table); + +void AcpiDmDumpXsdt ( ACPI_TABLE_HEADER *Table); @@ -446,14 +463,6 @@ void AcpiDmMatchOp ( ACPI_PARSE_OBJECT *Op); -BOOLEAN -AcpiDmCommaIfListMember ( - ACPI_PARSE_OBJECT *Op); - -void -AcpiDmCommaIfFieldMember ( - ACPI_PARSE_OBJECT *Op); - /* * dmnames @@ -527,6 +536,33 @@ AcpiDmIsStringBuffer ( /* + * dmextern + */ +void +AcpiDmAddToExternalList ( + ACPI_PARSE_OBJECT *Op, + char *Path, + UINT8 Type, + UINT32 Value); + +void +AcpiDmAddExternalsToNamespace ( + void); + +UINT32 +AcpiDmGetExternalMethodCount ( + void); + +void +AcpiDmClearExternalList ( + void); + +void +AcpiDmEmitExternals ( + void); + + +/* * dmresrc */ void @@ -561,18 +597,10 @@ AcpiDmIsResourceTemplate ( ACPI_PARSE_OBJECT *Op); void -AcpiDmIndent ( - UINT32 Level); - -void AcpiDmBitList ( UINT16 Mask); void -AcpiDmDecodeAttribute ( - UINT8 Attribute); - -void AcpiDmDescriptorName ( void); @@ -698,10 +726,21 @@ AcpiDmVendorSmallDescriptor ( * dmutils */ void -AcpiDmAddToExternalList ( - char *Path, - UINT8 Type, - UINT32 Value); +AcpiDmDecodeAttribute ( + UINT8 Attribute); + +void +AcpiDmIndent ( + UINT32 Level); + +BOOLEAN +AcpiDmCommaIfListMember ( + ACPI_PARSE_OBJECT *Op); + +void +AcpiDmCommaIfFieldMember ( + ACPI_PARSE_OBJECT *Op); + /* * dmrestag diff --git a/sys/contrib/dev/acpica/include/acdispat.h b/sys/contrib/dev/acpica/include/acdispat.h index 2aa8623..d7af800 100644 --- a/sys/contrib/dev/acpica/include/acdispat.h +++ b/sys/contrib/dev/acpica/include/acdispat.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/include/acevents.h b/sys/contrib/dev/acpica/include/acevents.h index 0cd5e2e..567ac1e 100644 --- a/sys/contrib/dev/acpica/include/acevents.h +++ b/sys/contrib/dev/acpica/include/acevents.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -265,7 +265,7 @@ AcpiEvAddressSpaceDispatch ( UINT32 Function, UINT32 RegionOffset, UINT32 BitWidth, - ACPI_INTEGER *Value); + UINT64 *Value); ACPI_STATUS AcpiEvAttachRegion ( diff --git a/sys/contrib/dev/acpica/include/acexcep.h b/sys/contrib/dev/acpica/include/acexcep.h index dfe2e2e..89fe5c6 100644 --- a/sys/contrib/dev/acpica/include/acexcep.h +++ b/sys/contrib/dev/acpica/include/acexcep.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/include/acglobal.h b/sys/contrib/dev/acpica/include/acglobal.h index 42b7b15..4469ee3 100644 --- a/sys/contrib/dev/acpica/include/acglobal.h +++ b/sys/contrib/dev/acpica/include/acglobal.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -324,7 +324,8 @@ extern char const *AcpiGbl_ExceptionNames_Ctrl[]; extern BOOLEAN AcpiGbl_Shutdown; extern UINT32 AcpiGbl_StartupFlags; extern const char *AcpiGbl_SleepStateNames[ACPI_S_STATE_COUNT]; -extern const char *AcpiGbl_HighestDstateNames[4]; +extern const char *AcpiGbl_LowestDstateNames[ACPI_NUM_SxW_METHODS]; +extern const char *AcpiGbl_HighestDstateNames[ACPI_NUM_SxD_METHODS]; extern const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[AML_NUM_OPCODES]; extern const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS]; #endif @@ -355,6 +356,8 @@ ACPI_EXTERN BOOLEAN AcpiGbl_DisplayFinalMemStats; ACPI_EXTERN ACPI_NAMESPACE_NODE AcpiGbl_RootNodeStruct; ACPI_EXTERN ACPI_NAMESPACE_NODE *AcpiGbl_RootNode; ACPI_EXTERN ACPI_NAMESPACE_NODE *AcpiGbl_FadtGpeDevice; +ACPI_EXTERN ACPI_OPERAND_OBJECT *AcpiGbl_ModuleCodeList; + extern const UINT8 AcpiGbl_NsProperties [ACPI_NUM_NS_TYPES]; extern const ACPI_PREDEFINED_NAMES AcpiGbl_PreDefinedNames [NUM_PREDEFINED_NAMES]; @@ -443,6 +446,7 @@ ACPI_EXTERN UINT8 AcpiGbl_DbOutputFlags; ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_disasm; ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_verbose; +ACPI_EXTERN ACPI_EXTERNAL_LIST *AcpiGbl_ExternalList; #endif diff --git a/sys/contrib/dev/acpica/include/achware.h b/sys/contrib/dev/acpica/include/achware.h index 05da01b..be0b4df 100644 --- a/sys/contrib/dev/acpica/include/achware.h +++ b/sys/contrib/dev/acpica/include/achware.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -141,6 +141,22 @@ AcpiHwGetMode ( /* * hwregs - ACPI Register I/O */ +ACPI_STATUS +AcpiHwValidateRegister ( + ACPI_GENERIC_ADDRESS *Reg, + UINT8 MaxBitWidth, + UINT64 *Address); + +ACPI_STATUS +AcpiHwRead ( + UINT32 *Value, + ACPI_GENERIC_ADDRESS *Reg); + +ACPI_STATUS +AcpiHwWrite ( + UINT32 Value, + ACPI_GENERIC_ADDRESS *Reg); + ACPI_BIT_REGISTER_INFO * AcpiHwGetBitRegisterInfo ( UINT32 RegisterId); diff --git a/sys/contrib/dev/acpica/include/acinterp.h b/sys/contrib/dev/acpica/include/acinterp.h index b0f4b92..de7dbf8 100644 --- a/sys/contrib/dev/acpica/include/acinterp.h +++ b/sys/contrib/dev/acpica/include/acinterp.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -214,13 +214,13 @@ AcpiExCommonBufferSetup ( ACPI_STATUS AcpiExWriteWithUpdateRule ( ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_INTEGER Mask, - ACPI_INTEGER FieldValue, + UINT64 Mask, + UINT64 FieldValue, UINT32 FieldDatumByteOffset); void AcpiExGetBufferDatum( - ACPI_INTEGER *Datum, + UINT64 *Datum, void *Buffer, UINT32 BufferLength, UINT32 ByteGranularity, @@ -228,7 +228,7 @@ AcpiExGetBufferDatum( void AcpiExSetBufferDatum ( - ACPI_INTEGER MergedDatum, + UINT64 MergedDatum, void *Buffer, UINT32 BufferLength, UINT32 ByteGranularity, @@ -266,7 +266,7 @@ ACPI_STATUS AcpiExAccessRegion ( ACPI_OPERAND_OBJECT *ObjDesc, UINT32 FieldDatumByteOffset, - ACPI_INTEGER *Value, + UINT64 *Value, UINT32 ReadWrite); @@ -296,8 +296,8 @@ AcpiExDoConcatenate ( ACPI_STATUS AcpiExDoLogicalNumericOp ( UINT16 Opcode, - ACPI_INTEGER Integer0, - ACPI_INTEGER Integer1, + UINT64 Integer0, + UINT64 Integer1, BOOLEAN *LogicalResult); ACPI_STATUS @@ -307,11 +307,11 @@ AcpiExDoLogicalOp ( ACPI_OPERAND_OBJECT *Operand1, BOOLEAN *LogicalResult); -ACPI_INTEGER +UINT64 AcpiExDoMathOp ( UINT16 Opcode, - ACPI_INTEGER Operand0, - ACPI_INTEGER Operand1); + UINT64 Operand0, + UINT64 Operand1); ACPI_STATUS AcpiExCreateMutex ( @@ -425,7 +425,7 @@ AcpiExSystemDoNotifyOp ( ACPI_STATUS AcpiExSystemDoSuspend( - ACPI_INTEGER Time); + UINT64 Time); ACPI_STATUS AcpiExSystemDoStall ( @@ -696,13 +696,13 @@ AcpiExReleaseGlobalLock ( void AcpiExEisaIdToString ( - UINT32 NumericId, - char *OutString); + char *Dest, + UINT64 CompressedId); void -AcpiExUnsignedIntegerToString ( - ACPI_INTEGER Value, - char *OutString); +AcpiExIntegerToString ( + char *Dest, + UINT64 Value); /* @@ -713,7 +713,7 @@ AcpiExSystemMemorySpaceHandler ( UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, - ACPI_INTEGER *Value, + UINT64 *Value, void *HandlerContext, void *RegionContext); @@ -722,7 +722,7 @@ AcpiExSystemIoSpaceHandler ( UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, - ACPI_INTEGER *Value, + UINT64 *Value, void *HandlerContext, void *RegionContext); @@ -731,7 +731,7 @@ AcpiExPciConfigSpaceHandler ( UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, - ACPI_INTEGER *Value, + UINT64 *Value, void *HandlerContext, void *RegionContext); @@ -740,7 +740,7 @@ AcpiExCmosSpaceHandler ( UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, - ACPI_INTEGER *Value, + UINT64 *Value, void *HandlerContext, void *RegionContext); @@ -749,7 +749,7 @@ AcpiExPciBarSpaceHandler ( UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, - ACPI_INTEGER *Value, + UINT64 *Value, void *HandlerContext, void *RegionContext); @@ -758,7 +758,7 @@ AcpiExEmbeddedControllerSpaceHandler ( UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, - ACPI_INTEGER *Value, + UINT64 *Value, void *HandlerContext, void *RegionContext); @@ -767,7 +767,7 @@ AcpiExSmBusSpaceHandler ( UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, - ACPI_INTEGER *Value, + UINT64 *Value, void *HandlerContext, void *RegionContext); @@ -777,7 +777,7 @@ AcpiExDataTableSpaceHandler ( UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, - ACPI_INTEGER *Value, + UINT64 *Value, void *HandlerContext, void *RegionContext); diff --git a/sys/contrib/dev/acpica/include/aclocal.h b/sys/contrib/dev/acpica/include/aclocal.h index 99955c3..0aeacff 100644 --- a/sys/contrib/dev/acpica/include/aclocal.h +++ b/sys/contrib/dev/acpica/include/aclocal.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -493,6 +493,24 @@ typedef union acpi_predefined_info } ACPI_PREDEFINED_INFO; + +/* Data block used during object validation */ + +typedef struct acpi_predefined_data +{ + char *Pathname; + const ACPI_PREDEFINED_INFO *Predefined; + union acpi_operand_object *ParentPackage; + UINT32 Flags; + UINT8 NodeFlags; + +} ACPI_PREDEFINED_DATA; + +/* Defines for Flags field above */ + +#define ACPI_OBJECT_REPAIRED 1 + + /* * Bitmapped return value types * Note: the actual data types must be contiguous, a loop in nspredef.c @@ -835,8 +853,7 @@ typedef struct acpi_opcode_info typedef union acpi_parse_value { - ACPI_INTEGER Integer; /* Integer constant (Up to 64 bits) */ - UINT64_STRUCT Integer64; /* Structure overlay for 2 32-bit Dwords */ + UINT64 Integer; /* Integer constant (Up to 64 bits) */ UINT32 Size; /* bytelist or field size */ char *String; /* NULL terminated string */ UINT8 *Buffer; /* buffer or string */ @@ -1110,6 +1127,9 @@ typedef struct acpi_bit_register_info #define ACPI_OSI_WIN_XP_SP2 0x05 #define ACPI_OSI_WINSRV_2003_SP1 0x06 #define ACPI_OSI_WIN_VISTA 0x07 +#define ACPI_OSI_WINSRV_2008 0x08 +#define ACPI_OSI_WIN_VISTA_SP1 0x09 +#define ACPI_OSI_WIN_7 0x0A #define ACPI_ALWAYS_ILLEGAL 0x00 @@ -1198,6 +1218,29 @@ typedef struct acpi_port_info /***************************************************************************** * + * Disassembler + * + ****************************************************************************/ + +typedef struct acpi_external_list +{ + char *Path; + char *InternalPath; + struct acpi_external_list *Next; + UINT32 Value; + UINT16 Length; + UINT8 Type; + UINT8 Flags; + +} ACPI_EXTERNAL_LIST; + +/* Values for Flags field above */ + +#define ACPI_IPATH_ALLOCATED 0x01 + + +/***************************************************************************** + * * Debugger * ****************************************************************************/ diff --git a/sys/contrib/dev/acpica/include/acmacros.h b/sys/contrib/dev/acpica/include/acmacros.h index b9c323e..e9a6f42 100644 --- a/sys/contrib/dev/acpica/include/acmacros.h +++ b/sys/contrib/dev/acpica/include/acmacros.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -335,8 +335,8 @@ * MASK_BITS_ABOVE creates a mask starting AT the position and above * MASK_BITS_BELOW creates a mask starting one bit BELOW the position */ -#define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_INTEGER_MAX) << ((UINT32) (position)))) -#define ACPI_MASK_BITS_BELOW(position) ((ACPI_INTEGER_MAX) << ((UINT32) (position))) +#define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_UINT64_MAX) << ((UINT32) (position)))) +#define ACPI_MASK_BITS_BELOW(position) ((ACPI_UINT64_MAX) << ((UINT32) (position))) /* Bitfields within ACPI registers */ @@ -402,6 +402,8 @@ */ #define ACPI_ERROR_NAMESPACE(s, e) AcpiNsReportError (AE_INFO, s, e); #define ACPI_ERROR_METHOD(s, n, p, e) AcpiNsReportMethodError (AE_INFO, s, n, p, e); +#define ACPI_WARN_PREDEFINED(plist) AcpiUtPredefinedWarning plist +#define ACPI_INFO_PREDEFINED(plist) AcpiUtPredefinedInfo plist #else @@ -409,6 +411,8 @@ #define ACPI_ERROR_NAMESPACE(s, e) #define ACPI_ERROR_METHOD(s, n, p, e) +#define ACPI_WARN_PREDEFINED(plist) +#define ACPI_INFO_PREDEFINED(plist) #endif /* ACPI_NO_ERROR_MESSAGES */ @@ -469,16 +473,16 @@ AcpiUtPtrExit (ACPI_DEBUG_PARAMETERS, (UINT8 *) _s); \ return (_s); }) #define return_VALUE(s) ACPI_DO_WHILE0 ({ \ - register ACPI_INTEGER _s = (s); \ + register UINT64 _s = (s); \ AcpiUtValueExit (ACPI_DEBUG_PARAMETERS, _s); \ return (_s); }) #define return_UINT8(s) ACPI_DO_WHILE0 ({ \ register UINT8 _s = (UINT8) (s); \ - AcpiUtValueExit (ACPI_DEBUG_PARAMETERS, (ACPI_INTEGER) _s); \ + AcpiUtValueExit (ACPI_DEBUG_PARAMETERS, (UINT64) _s); \ return (_s); }) #define return_UINT32(s) ACPI_DO_WHILE0 ({ \ register UINT32 _s = (UINT32) (s); \ - AcpiUtValueExit (ACPI_DEBUG_PARAMETERS, (ACPI_INTEGER) _s); \ + AcpiUtValueExit (ACPI_DEBUG_PARAMETERS, (UINT64) _s); \ return (_s); }) #else /* Use original less-safe macros */ @@ -489,7 +493,7 @@ AcpiUtPtrExit (ACPI_DEBUG_PARAMETERS, (UINT8 *) (s)); \ return((s)); }) #define return_VALUE(s) ACPI_DO_WHILE0 ({ \ - AcpiUtValueExit (ACPI_DEBUG_PARAMETERS, (ACPI_INTEGER) (s)); \ + AcpiUtValueExit (ACPI_DEBUG_PARAMETERS, (UINT64) (s)); \ return((s)); }) #define return_UINT8(s) return_VALUE(s) #define return_UINT32(s) return_VALUE(s) diff --git a/sys/contrib/dev/acpica/include/acnames.h b/sys/contrib/dev/acpica/include/acnames.h index eb9944a..12dd89c 100644 --- a/sys/contrib/dev/acpica/include/acnames.h +++ b/sys/contrib/dev/acpica/include/acnames.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/include/acnamesp.h b/sys/contrib/dev/acpica/include/acnamesp.h index 3f9a6ce..9ddd12e 100644 --- a/sys/contrib/dev/acpica/include/acnamesp.h +++ b/sys/contrib/dev/acpica/include/acnamesp.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -146,6 +146,14 @@ #define ACPI_NS_WALK_UNLOCK 0x01 #define ACPI_NS_WALK_TEMP_NODES 0x02 +/* Object is not a package element */ + +#define ACPI_NOT_PACKAGE_ELEMENT ACPI_UINT32_MAX + +/* Always emit warning message, not dependent on node flags */ + +#define ACPI_WARN_ALWAYS 0 + /* * nsinit - Namespace initialization @@ -181,7 +189,8 @@ AcpiNsWalkNamespace ( ACPI_HANDLE StartObject, UINT32 MaxDepth, UINT32 Flags, - ACPI_WALK_CALLBACK UserFunction, + ACPI_WALK_CALLBACK PreOrderVisit, + ACPI_WALK_CALLBACK PostOrderVisit, void *Context, void **ReturnValue); @@ -241,6 +250,10 @@ AcpiNsDeleteNode ( ACPI_NAMESPACE_NODE *Node); void +AcpiNsRemoveNode ( + ACPI_NAMESPACE_NODE *Node); + +void AcpiNsDeleteNamespaceSubtree ( ACPI_NAMESPACE_NODE *ParentHandle); @@ -310,6 +323,10 @@ ACPI_STATUS AcpiNsEvaluate ( ACPI_EVALUATE_INFO *Info); +void +AcpiNsExecModuleCodeList ( + void); + /* * nspredef - Support for predefined/reserved names @@ -412,6 +429,48 @@ AcpiNsGetAttachedData ( /* + * nsrepair - General return object repair for all + * predefined methods/objects + */ +ACPI_STATUS +AcpiNsRepairObject ( + ACPI_PREDEFINED_DATA *Data, + UINT32 ExpectedBtypes, + UINT32 PackageIndex, + ACPI_OPERAND_OBJECT **ReturnObjectPtr); + +ACPI_STATUS +AcpiNsRepairPackageList ( + ACPI_PREDEFINED_DATA *Data, + ACPI_OPERAND_OBJECT **ObjDescPtr); + +ACPI_STATUS +AcpiNsRepairNullElement ( + ACPI_PREDEFINED_DATA *Data, + UINT32 ExpectedBtypes, + UINT32 PackageIndex, + ACPI_OPERAND_OBJECT **ReturnObjectPtr); + +void +AcpiNsRemoveNullElements ( + ACPI_PREDEFINED_DATA *Data, + UINT8 PackageType, + ACPI_OPERAND_OBJECT *ObjDesc); + + +/* + * nsrepair2 - Return object repair for specific + * predefined methods/objects + */ +ACPI_STATUS +AcpiNsComplexRepairs ( + ACPI_PREDEFINED_DATA *Data, + ACPI_NAMESPACE_NODE *Node, + ACPI_STATUS ValidateStatus, + ACPI_OPERAND_OBJECT **ReturnObjectPtr); + + +/* * nssearch - Namespace searching and entry */ ACPI_STATUS @@ -496,13 +555,9 @@ AcpiNsExternalizeName ( char **ConvertedName); ACPI_NAMESPACE_NODE * -AcpiNsMapHandleToNode ( +AcpiNsValidateHandle ( ACPI_HANDLE Handle); -ACPI_HANDLE -AcpiNsConvertEntryToHandle( - ACPI_NAMESPACE_NODE *Node); - void AcpiNsTerminate ( void); diff --git a/sys/contrib/dev/acpica/include/acobject.h b/sys/contrib/dev/acpica/include/acobject.h index 5941859..f86f839 100644 --- a/sys/contrib/dev/acpica/include/acobject.h +++ b/sys/contrib/dev/acpica/include/acobject.h @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -170,6 +170,7 @@ #define AOPOBJ_OBJECT_INITIALIZED 0x08 #define AOPOBJ_SETUP_COMPLETE 0x10 #define AOPOBJ_SINGLE_DATUM 0x20 +#define AOPOBJ_MODULE_LEVEL 0x40 /****************************************************************************** @@ -189,7 +190,7 @@ typedef struct acpi_object_integer { ACPI_OBJECT_COMMON_HEADER UINT8 Fill[3]; /* Prevent warning on some compilers */ - ACPI_INTEGER Value; + UINT64 Value; } ACPI_OBJECT_INTEGER; @@ -287,7 +288,12 @@ typedef struct acpi_object_method UINT8 SyncLevel; union acpi_operand_object *Mutex; UINT8 *AmlStart; - ACPI_INTERNAL_METHOD Implementation; + union + { + ACPI_INTERNAL_METHOD Implementation; + union acpi_operand_object *Handler; + } Extra; + UINT32 AmlLength; UINT8 ThreadCount; ACPI_OWNER_ID OwnerId; diff --git a/sys/contrib/dev/acpica/include/acopcode.h b/sys/contrib/dev/acpica/include/acopcode.h index bb309c7..94d585d 100644 --- a/sys/contrib/dev/acpica/include/acopcode.h +++ b/sys/contrib/dev/acpica/include/acopcode.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/include/acoutput.h b/sys/contrib/dev/acpica/include/acoutput.h index 2b796b5..8018fed 100644 --- a/sys/contrib/dev/acpica/include/acoutput.h +++ b/sys/contrib/dev/acpica/include/acoutput.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -158,7 +158,8 @@ #define ACPI_LV_INIT 0x00000001 #define ACPI_LV_DEBUG_OBJECT 0x00000002 #define ACPI_LV_INFO 0x00000004 -#define ACPI_LV_ALL_EXCEPTIONS 0x00000007 +#define ACPI_LV_REPAIR 0x00000008 +#define ACPI_LV_ALL_EXCEPTIONS 0x0000000F /* Trace verbosity level 1 [Standard Trace Level] */ @@ -217,6 +218,7 @@ #define ACPI_DB_INIT ACPI_DEBUG_LEVEL (ACPI_LV_INIT) #define ACPI_DB_DEBUG_OBJECT ACPI_DEBUG_LEVEL (ACPI_LV_DEBUG_OBJECT) #define ACPI_DB_INFO ACPI_DEBUG_LEVEL (ACPI_LV_INFO) +#define ACPI_DB_REPAIR ACPI_DEBUG_LEVEL (ACPI_LV_REPAIR) #define ACPI_DB_ALL_EXCEPTIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALL_EXCEPTIONS) /* Trace level -- also used in the global "DebugLevel" */ @@ -248,8 +250,8 @@ /* Defaults for DebugLevel, debug and normal */ -#define ACPI_DEBUG_DEFAULT (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT) -#define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT) +#define ACPI_DEBUG_DEFAULT (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT | ACPI_LV_REPAIR) +#define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_DEBUG_OBJECT | ACPI_LV_REPAIR) #define ACPI_DEBUG_ALL (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL) diff --git a/sys/contrib/dev/acpica/include/acparser.h b/sys/contrib/dev/acpica/include/acparser.h index b65177b..35fe006 100644 --- a/sys/contrib/dev/acpica/include/acparser.h +++ b/sys/contrib/dev/acpica/include/acparser.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -137,6 +137,7 @@ #define ACPI_PARSE_DEFERRED_OP 0x0100 #define ACPI_PARSE_DISASSEMBLE 0x0200 +#define ACPI_PARSE_MODULE_LEVEL 0x0400 /****************************************************************************** * diff --git a/sys/contrib/dev/acpica/include/acpi.h b/sys/contrib/dev/acpica/include/acpi.h index 0d82345..d462294 100644 --- a/sys/contrib/dev/acpica/include/acpi.h +++ b/sys/contrib/dev/acpica/include/acpi.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/include/acpiosxf.h b/sys/contrib/dev/acpica/include/acpiosxf.h index b10d12b..13570b4 100644 --- a/sys/contrib/dev/acpica/include/acpiosxf.h +++ b/sys/contrib/dev/acpica/include/acpiosxf.h @@ -12,7 +12,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -346,7 +346,7 @@ AcpiOsWaitEventsComplete ( void AcpiOsSleep ( - ACPI_INTEGER Milliseconds); + UINT64 Milliseconds); void AcpiOsStall ( @@ -401,7 +401,7 @@ ACPI_STATUS AcpiOsWritePciConfiguration ( ACPI_PCI_ID *PciId, UINT32 Reg, - ACPI_INTEGER Value, + UINT64 Value, UINT32 Width); diff --git a/sys/contrib/dev/acpica/include/acpixf.h b/sys/contrib/dev/acpica/include/acpixf.h index 466fb27..7111984 100644 --- a/sys/contrib/dev/acpica/include/acpixf.h +++ b/sys/contrib/dev/acpica/include/acpixf.h @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -120,7 +120,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20090521 +#define ACPI_CA_VERSION 0x20100121 #include <contrib/dev/acpica/include/actypes.h> #include <contrib/dev/acpica/include/actbl.h> @@ -267,7 +267,8 @@ AcpiWalkNamespace ( ACPI_OBJECT_TYPE Type, ACPI_HANDLE StartObject, UINT32 MaxDepth, - ACPI_WALK_CALLBACK UserFunction, + ACPI_WALK_CALLBACK PreOrderVisit, + ACPI_WALK_CALLBACK PostOrderVisit, void *Context, void **ReturnValue); @@ -336,7 +337,7 @@ AcpiEvaluateObjectTyped ( ACPI_STATUS AcpiGetObjectInfo ( ACPI_HANDLE Handle, - ACPI_BUFFER *ReturnBuffer); + ACPI_DEVICE_INFO **ReturnBuffer); ACPI_STATUS AcpiInstallMethod ( @@ -573,12 +574,12 @@ AcpiReset ( ACPI_STATUS AcpiRead ( - UINT32 *Value, + UINT64 *Value, ACPI_GENERIC_ADDRESS *Reg); ACPI_STATUS AcpiWrite ( - UINT32 Value, + UINT64 Value, ACPI_GENERIC_ADDRESS *Reg); ACPI_STATUS diff --git a/sys/contrib/dev/acpica/include/acpredef.h b/sys/contrib/dev/acpica/include/acpredef.h index 9e5a524..9b881fb 100644 --- a/sys/contrib/dev/acpica/include/acpredef.h +++ b/sys/contrib/dev/acpica/include/acpredef.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -136,8 +136,8 @@ * (Used for _PRW) * * - * 2) PTYPE2 packages contain a Variable-length number of sub-packages. Each of the - * different types describe the contents of each of the sub-packages. + * 2) PTYPE2 packages contain a Variable-length number of sub-packages. Each + * of the different types describe the contents of each of the sub-packages. * * ACPI_PTYPE2: Each subpackage contains 1 or 2 object types: * object type @@ -157,12 +157,15 @@ * count * (Used for _CST) * - * ACPI_PTYPE2_Fixed-length: Each subpackage is of Fixed-length length + * ACPI_PTYPE2_FIXED: Each subpackage is of Fixed-length * (Used for _PRT) * * ACPI_PTYPE2_MIN: Each subpackage has a Variable-length but minimum length * (Used for _HPX) * + * ACPI_PTYPE2_REV_FIXED: Revision at start, each subpackage is Fixed-length + * (Used for _ART, _FPS) + * *****************************************************************************/ enum AcpiReturnPackageTypes @@ -174,10 +177,12 @@ enum AcpiReturnPackageTypes ACPI_PTYPE2_COUNT = 5, ACPI_PTYPE2_PKG_COUNT = 6, ACPI_PTYPE2_FIXED = 7, - ACPI_PTYPE2_MIN = 8 + ACPI_PTYPE2_MIN = 8, + ACPI_PTYPE2_REV_FIXED = 9 }; +#ifdef ACPI_CREATE_PREDEFINED_TABLE /* * Predefined method/object information table. * @@ -188,7 +193,7 @@ enum AcpiReturnPackageTypes * AcpiEvaluateObject: * _Lxx and _Exx GPE methods * _Qxx EC methods - * _T_x compiler temporary Variable-lengths + * _T_x compiler temporary variables * * 2) Predefined names that never actually exist within the AML code: * Predefined resource descriptor field names @@ -263,21 +268,30 @@ static const ACPI_PREDEFINED_INFO PredefinedNames[] = {{{ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 2,0}, 0,0}}, {{"_ALT", 0, ACPI_RTYPE_INTEGER}}, + {{"_ART", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (1 Int(rev), n Pkg (2 Ref/11 Int) */ + {{{ACPI_PTYPE2_REV_FIXED,ACPI_RTYPE_REFERENCE, 2, ACPI_RTYPE_INTEGER}, 11,0}}, + {{"_BBN", 0, ACPI_RTYPE_INTEGER}}, {{"_BCL", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Ints) */ {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0,0}, 0,0}}, {{"_BCM", 1, 0}}, + {{"_BCT", 1, ACPI_RTYPE_INTEGER}}, {{"_BDN", 0, ACPI_RTYPE_INTEGER}}, {{"_BFS", 1, 0}}, {{"_BIF", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (9 Int),(4 Str) */ {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 9, ACPI_RTYPE_STRING}, 4,0}}, + {{"_BIX", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (16 Int),(4 Str) */ + {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 16, ACPI_RTYPE_STRING}, 4,0}}, + {{"_BLT", 3, 0}}, + {{"_BMA", 1, ACPI_RTYPE_INTEGER}}, {{"_BMC", 1, 0}}, {{"_BMD", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (5 Int) */ {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 5,0}, 0,0}}, + {{"_BMS", 1, ACPI_RTYPE_INTEGER}}, {{"_BQC", 0, ACPI_RTYPE_INTEGER}}, {{"_BST", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (4 Int) */ {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4,0}, 0,0}}, @@ -285,6 +299,7 @@ static const ACPI_PREDEFINED_INFO PredefinedNames[] = {{"_BTM", 1, ACPI_RTYPE_INTEGER}}, {{"_BTP", 1, 0}}, {{"_CBA", 0, ACPI_RTYPE_INTEGER}}, /* See PCI firmware spec 3.0 */ + {{"_CDM", 0, ACPI_RTYPE_INTEGER}}, {{"_CID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_PACKAGE}}, /* Variable-length (Ints/Strs) */ {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING, 0,0}, 0,0}}, @@ -310,6 +325,7 @@ static const ACPI_PREDEFINED_INFO PredefinedNames[] = {{"_DSM", 4, ACPI_RTYPE_ALL}}, /* Must return a type, but it can be of any type */ {{"_DSS", 1, 0}}, {{"_DSW", 3, 0}}, + {{"_DTI", 1, 0}}, {{"_EC_", 0, ACPI_RTYPE_INTEGER}}, {{"_EDL", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs)*/ {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, @@ -325,9 +341,22 @@ static const ACPI_PREDEFINED_INFO PredefinedNames[] = {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 16,0}, 0,0}}, {{"_FDM", 1, 0}}, + {{"_FIF", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (4 Int) */ + {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4,0}, 0,0}}, + {{"_FIX", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Ints) */ {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0,0}, 0,0}}, + {{"_FPS", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (1 Int(rev), n Pkg (5 Int) */ + {{{ACPI_PTYPE2_REV_FIXED,ACPI_RTYPE_INTEGER, 5, 0}, 0,0}}, + + {{"_FSL", 1, 0}}, + {{"_FST", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (3 Int) */ + {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 3,0}, 0,0}}, + + + {{"_GAI", 0, ACPI_RTYPE_INTEGER}}, + {{"_GHL", 0, ACPI_RTYPE_INTEGER}}, {{"_GLK", 0, ACPI_RTYPE_INTEGER}}, {{"_GPD", 0, ACPI_RTYPE_INTEGER}}, {{"_GPE", 0, ACPI_RTYPE_INTEGER}}, /* _GPE method, not _GPE scope */ @@ -355,15 +384,21 @@ static const ACPI_PREDEFINED_INFO PredefinedNames[] = {{"_LCK", 1, 0}}, {{"_LID", 0, ACPI_RTYPE_INTEGER}}, {{"_MAT", 0, ACPI_RTYPE_BUFFER}}, + {{"_MBM", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (8 Int) */ + {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 8,0}, 0,0}}, + {{"_MLS", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (2 Str) */ {{{ACPI_PTYPE2, ACPI_RTYPE_STRING, 2,0}, 0,0}}, {{"_MSG", 1, 0}}, + {{"_MSM", 4, ACPI_RTYPE_INTEGER}}, + {{"_NTT", 0, ACPI_RTYPE_INTEGER}}, {{"_OFF", 0, 0}}, {{"_ON_", 0, 0}}, {{"_OS_", 0, ACPI_RTYPE_STRING}}, {{"_OSC", 4, ACPI_RTYPE_BUFFER}}, {{"_OST", 3, 0}}, + {{"_PAI", 1, ACPI_RTYPE_INTEGER}}, {{"_PCL", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, @@ -371,10 +406,21 @@ static const ACPI_PREDEFINED_INFO PredefinedNames[] = {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_BUFFER, 2,0}, 0,0}}, {{"_PDC", 1, 0}}, + {{"_PDL", 0, ACPI_RTYPE_INTEGER}}, {{"_PIC", 1, 0}}, + {{"_PIF", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (3 Int),(3 Str) */ + {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 3, ACPI_RTYPE_STRING}, 3,0}}, + {{"_PLD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Bufs) */ {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_BUFFER, 0,0}, 0,0}}, + {{"_PMC", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (11 Int),(3 Str) */ + {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 11, ACPI_RTYPE_STRING}, 3,0}}, + + {{"_PMD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, + + {{"_PMM", 0, ACPI_RTYPE_INTEGER}}, {{"_PPC", 0, ACPI_RTYPE_INTEGER}}, {{"_PPE", 0, ACPI_RTYPE_INTEGER}}, /* See dig64 spec */ {{"_PR0", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ @@ -386,17 +432,26 @@ static const ACPI_PREDEFINED_INFO PredefinedNames[] = {{"_PR2", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, + {{"_PR3", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, + + {{"_PRL", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, + {{"_PRS", 0, ACPI_RTYPE_BUFFER}}, /* - * For _PRT, many BIOSs reverse the 2nd and 3rd Package elements. This bug is so prevalent that there - * is code in the ACPICA Resource Manager to detect this and switch them back. For now, do not allow - * and issue a warning. To allow this and eliminate the warning, add the ACPI_RTYPE_REFERENCE - * type to the 2nd element (index 1) in the statement below. + * For _PRT, many BIOSs reverse the 3rd and 4th Package elements (Source + * and SourceIndex). This bug is so prevalent that there is code in the + * ACPICA Resource Manager to detect this and switch them back. For now, + * do not allow and issue a warning. To allow this and eliminate the + * warning, add the ACPI_RTYPE_REFERENCE type to the 4th element (index 3) + * in the statement below. */ {{"_PRT", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (4): Int,Int,Int/Ref,Int */ {{{ACPI_PTYPE2_FIXED, 4, ACPI_RTYPE_INTEGER,ACPI_RTYPE_INTEGER}, - ACPI_RTYPE_INTEGER | ACPI_RTYPE_REFERENCE,ACPI_RTYPE_INTEGER}}, + ACPI_RTYPE_INTEGER | ACPI_RTYPE_REFERENCE, + ACPI_RTYPE_INTEGER}}, {{"_PRW", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each: Pkg/Int,Int,[Variable-length Refs] (Pkg is Ref/Int) */ {{{ACPI_PTYPE1_OPTION, 2, ACPI_RTYPE_INTEGER | ACPI_RTYPE_PACKAGE, @@ -422,7 +477,11 @@ static const ACPI_PREDEFINED_INFO PredefinedNames[] = {{"_PTC", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (2 Buf) */ {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_BUFFER, 2,0}, 0,0}}, + {{"_PTP", 2, ACPI_RTYPE_INTEGER}}, {{"_PTS", 1, 0}}, + {{"_PUR", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (2 Int) */ + {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 2,0}, 0,0}}, + {{"_PXM", 0, ACPI_RTYPE_INTEGER}}, {{"_REG", 2, 0}}, {{"_REV", 0, ACPI_RTYPE_INTEGER}}, @@ -468,6 +527,7 @@ static const ACPI_PREDEFINED_INFO PredefinedNames[] = /* Note: the 3-arg definition may be removed for ACPI 4.0 */ {{"_SDD", 1, 0}}, {{"_SEG", 0, ACPI_RTYPE_INTEGER}}, + {{"_SHL", 1, ACPI_RTYPE_INTEGER}}, {{"_SLI", 0, ACPI_RTYPE_BUFFER}}, {{"_SPD", 1, ACPI_RTYPE_INTEGER}}, {{"_SRS", 1, 0}}, @@ -475,11 +535,15 @@ static const ACPI_PREDEFINED_INFO PredefinedNames[] = {{"_SST", 1, 0}}, {{"_STA", 0, ACPI_RTYPE_INTEGER}}, {{"_STM", 3, 0}}, + {{"_STP", 2, ACPI_RTYPE_INTEGER}}, {{"_STR", 0, ACPI_RTYPE_BUFFER}}, + {{"_STV", 2, ACPI_RTYPE_INTEGER}}, {{"_SUN", 0, ACPI_RTYPE_INTEGER}}, {{"_SWS", 0, ACPI_RTYPE_INTEGER}}, {{"_TC1", 0, ACPI_RTYPE_INTEGER}}, {{"_TC2", 0, ACPI_RTYPE_INTEGER}}, + {{"_TIP", 1, ACPI_RTYPE_INTEGER}}, + {{"_TIV", 1, ACPI_RTYPE_INTEGER}}, {{"_TMP", 0, ACPI_RTYPE_INTEGER}}, {{"_TPC", 0, ACPI_RTYPE_INTEGER}}, {{"_TPT", 1, 0}}, @@ -530,5 +594,5 @@ static const ACPI_PREDEFINED_INFO PredefinedNames[] = _PRT - currently ignore reversed entries. Attempt to fix here? Think about possibly fixing package elements like _BIF, etc. #endif - +#endif #endif diff --git a/sys/contrib/dev/acpica/include/acresrc.h b/sys/contrib/dev/acpica/include/acresrc.h index 9e3698a..ed59261 100644 --- a/sys/contrib/dev/acpica/include/acresrc.h +++ b/sys/contrib/dev/acpica/include/acresrc.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/include/acrestyp.h b/sys/contrib/dev/acpica/include/acrestyp.h index 7eb7600..0a85d29 100644 --- a/sys/contrib/dev/acpica/include/acrestyp.h +++ b/sys/contrib/dev/acpica/include/acrestyp.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -534,7 +534,7 @@ typedef struct acpi_pci_routing_table { UINT32 Length; UINT32 Pin; - ACPI_INTEGER Address; /* here for 64-bit alignment */ + UINT64 Address; /* here for 64-bit alignment */ UINT32 SourceIndex; char Source[4]; /* pad to 64 bits so sizeof() works in all cases */ diff --git a/sys/contrib/dev/acpica/include/acstruct.h b/sys/contrib/dev/acpica/include/acstruct.h index 45c85fe..d4696b8 100644 --- a/sys/contrib/dev/acpica/include/acstruct.h +++ b/sys/contrib/dev/acpica/include/acstruct.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/include/actables.h b/sys/contrib/dev/acpica/include/actables.h index e4428e6..54fdaae 100644 --- a/sys/contrib/dev/acpica/include/actables.h +++ b/sys/contrib/dev/acpica/include/actables.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/include/actbl.h b/sys/contrib/dev/acpica/include/actbl.h index ce1f071..05775a8 100644 --- a/sys/contrib/dev/acpica/include/actbl.h +++ b/sys/contrib/dev/acpica/include/actbl.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -116,9 +116,25 @@ #ifndef __ACTBL_H__ #define __ACTBL_H__ + +/******************************************************************************* + * + * Fundamental ACPI tables + * + * This file contains definitions for the ACPI tables that are directly consumed + * by ACPICA. All other tables are consumed by the OS-dependent ACPI-related + * device drivers and other OS support code. + * + * The RSDP and FACS do not use the common ACPI table header. All other ACPI + * tables use the header. + * + ******************************************************************************/ + + /* - * Values for description table header signatures. Useful because they make - * it more difficult to inadvertently type in the wrong signature. + * Values for description table header signatures for tables defined in this + * file. Useful because they make it more difficult to inadvertently type in + * the wrong signature. */ #define ACPI_SIG_DSDT "DSDT" /* Differentiated System Description Table */ #define ACPI_SIG_FADT "FACP" /* Fixed ACPI Description Table */ @@ -137,23 +153,17 @@ */ #pragma pack(1) - /* - * These are the ACPI tables that are directly consumed by the subsystem. - * - * The RSDP and FACS do not use the common ACPI table header. All other ACPI - * tables use the header. - * * Note about bitfields: The UINT8 type is used for bitfields in ACPI tables. * This is the only type that is even remotely portable. Anything else is not * portable, so do not use any other bitfield types. */ + /******************************************************************************* * - * ACPI Table Header. This common header is used by all tables except the - * RSDP and FACS. The define is used for direct inclusion of header into - * other ACPI tables + * Master ACPI Table Header. This common header is used by all ACPI tables + * except the RSDP and FACS. * ******************************************************************************/ @@ -172,13 +182,16 @@ typedef struct acpi_table_header } ACPI_TABLE_HEADER; -/* +/******************************************************************************* + * * GAS - Generic Address Structure (ACPI 2.0+) * * Note: Since this structure is used in the ACPI tables, it is byte aligned. - * If misalignment is not supported, access to the Address field must be - * performed with care. - */ + * If misaliged access is not supported by the hardware, accesses to the + * 64-bit Address field must be performed with care. + * + ******************************************************************************/ + typedef struct acpi_generic_address { UINT8 SpaceId; /* Address space where struct or register exists */ @@ -193,6 +206,7 @@ typedef struct acpi_generic_address /******************************************************************************* * * RSDP - Root System Description Pointer (Signature is "RSD PTR ") + * Version 2 * ******************************************************************************/ @@ -216,6 +230,7 @@ typedef struct acpi_table_rsdp /******************************************************************************* * * RSDT/XSDT - Root System Description Tables + * Version 1 (both) * ******************************************************************************/ @@ -250,23 +265,31 @@ typedef struct acpi_table_facs UINT32 Flags; UINT64 XFirmwareWakingVector; /* 64-bit version of the Firmware Waking Vector (ACPI 2.0+) */ UINT8 Version; /* Version of this table (ACPI 2.0+) */ - UINT8 Reserved[31]; /* Reserved, must be zero */ + UINT8 Reserved[3]; /* Reserved, must be zero */ + UINT32 OspmFlags; /* Flags to be set by OSPM (ACPI 4.0) */ + UINT8 Reserved1[24]; /* Reserved, must be zero */ } ACPI_TABLE_FACS; -/* Flag macros */ +/* Masks for GlobalLock flag field above */ -#define ACPI_FACS_S4_BIOS_PRESENT (1) /* 00: S4BIOS support is present */ +#define ACPI_GLOCK_PENDING (1) /* 00: Pending global lock ownership */ +#define ACPI_GLOCK_OWNED (1<<1) /* 01: Global lock is owned */ -/* Global lock flags */ +/* Masks for Flags field above */ -#define ACPI_GLOCK_PENDING 0x01 /* 00: Pending global lock ownership */ -#define ACPI_GLOCK_OWNED 0x02 /* 01: Global lock is owned */ +#define ACPI_FACS_S4_BIOS_PRESENT (1) /* 00: S4BIOS support is present */ +#define ACPI_FACS_64BIT_WAKE (1<<1) /* 01: 64-bit wake vector supported (ACPI 4.0) */ + +/* Masks for OspmFlags field above */ + +#define ACPI_FACS_64BIT_ENVIRONMENT (1) /* 00: 64-bit wake environment is required (ACPI 4.0) */ /******************************************************************************* * * FADT - Fixed ACPI Description Table (Signature "FACP") + * Version 4 * ******************************************************************************/ @@ -330,7 +353,7 @@ typedef struct acpi_table_fadt } ACPI_TABLE_FADT; -/* FADT Boot Architecture Flags (BootFlags) */ +/* Masks for FADT Boot Architecture Flags (BootFlags) */ #define ACPI_FADT_LEGACY_DEVICES (1) /* 00: [V2] System has LPC or ISA bus devices */ #define ACPI_FADT_8042 (1<<1) /* 01: [V3] System has an 8042 controller on port 60/64 */ @@ -338,7 +361,7 @@ typedef struct acpi_table_fadt #define ACPI_FADT_NO_MSI (1<<3) /* 03: [V4] Message Signaled Interrupts (MSI) must not be enabled */ #define ACPI_FADT_NO_ASPM (1<<4) /* 04: [V4] PCIe ASPM control must not be enabled */ -/* FADT flags */ +/* Masks for FADT flags */ #define ACPI_FADT_WBINVD (1) /* 00: [V1] The wbinvd instruction works properly */ #define ACPI_FADT_WBINVD_FLUSH (1<<1) /* 01: [V1] wbinvd flushes but does not invalidate caches */ @@ -362,7 +385,7 @@ typedef struct acpi_table_fadt #define ACPI_FADT_APIC_PHYSICAL (1<<19) /* 19: [V4] All local xAPICs must use physical dest mode (ACPI 3.0) */ -/* FADT Prefered Power Management Profiles */ +/* Values for PreferredProfile (Prefered Power Management Profiles) */ enum AcpiPreferedPmProfiles { @@ -381,6 +404,9 @@ enum AcpiPreferedPmProfiles #pragma pack() +/* + * Internal table-related structures + */ typedef union acpi_name_union { UINT32 Integer; @@ -388,9 +414,9 @@ typedef union acpi_name_union } ACPI_NAME_UNION; -/* - * Internal ACPI Table Descriptor. One per ACPI table - */ + +/* Internal ACPI Table Descriptor. One per ACPI table. */ + typedef struct acpi_table_desc { ACPI_PHYSICAL_ADDRESS Address; @@ -402,7 +428,7 @@ typedef struct acpi_table_desc } ACPI_TABLE_DESC; -/* Flags for above */ +/* Masks for Flags field above */ #define ACPI_TABLE_ORIGIN_UNKNOWN (0) #define ACPI_TABLE_ORIGIN_MAPPED (1) @@ -416,6 +442,7 @@ typedef struct acpi_table_desc * Get the remaining ACPI tables */ #include <contrib/dev/acpica/include/actbl1.h> +#include <contrib/dev/acpica/include/actbl2.h> /* Macros used to generate offsets to specific table fields */ diff --git a/sys/contrib/dev/acpica/include/actbl1.h b/sys/contrib/dev/acpica/include/actbl1.h index dc5519b..ac11a3f 100644 --- a/sys/contrib/dev/acpica/include/actbl1.h +++ b/sys/contrib/dev/acpica/include/actbl1.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -119,42 +119,32 @@ /******************************************************************************* * - * Additional ACPI Tables + * Additional ACPI Tables (1) * * These tables are not consumed directly by the ACPICA subsystem, but are * included here to support device drivers and the AML disassembler. * + * The tables in this file are fully defined within the ACPI specification. + * ******************************************************************************/ /* - * Values for description table header signatures. Useful because they make - * it more difficult to inadvertently type in the wrong signature. + * Values for description table header signatures for tables defined in this + * file. Useful because they make it more difficult to inadvertently type in + * the wrong signature. */ -#define ACPI_SIG_ASF "ASF!" /* Alert Standard Format table */ #define ACPI_SIG_BERT "BERT" /* Boot Error Record Table */ -#define ACPI_SIG_BOOT "BOOT" /* Simple Boot Flag Table */ #define ACPI_SIG_CPEP "CPEP" /* Corrected Platform Error Polling table */ -#define ACPI_SIG_DBGP "DBGP" /* Debug Port table */ -#define ACPI_SIG_DMAR "DMAR" /* DMA Remapping table */ #define ACPI_SIG_ECDT "ECDT" /* Embedded Controller Boot Resources Table */ #define ACPI_SIG_EINJ "EINJ" /* Error Injection table */ #define ACPI_SIG_ERST "ERST" /* Error Record Serialization Table */ #define ACPI_SIG_HEST "HEST" /* Hardware Error Source Table */ -#define ACPI_SIG_HPET "HPET" /* High Precision Event Timer table */ -#define ACPI_SIG_IBFT "IBFT" /* iSCSI Boot Firmware Table */ #define ACPI_SIG_MADT "APIC" /* Multiple APIC Description Table */ -#define ACPI_SIG_MCFG "MCFG" /* PCI Memory Mapped Configuration table */ +#define ACPI_SIG_MSCT "MSCT" /* Maximum System Characteristics Table */ #define ACPI_SIG_SBST "SBST" /* Smart Battery Specification Table */ -#define ACPI_SIG_SLIC "SLIC" /* Software Licensing Description Table */ #define ACPI_SIG_SLIT "SLIT" /* System Locality Distance Information Table */ -#define ACPI_SIG_SPCR "SPCR" /* Serial Port Console Redirection table */ -#define ACPI_SIG_SPMI "SPMI" /* Server Platform Management Interface table */ #define ACPI_SIG_SRAT "SRAT" /* System Resource Affinity Table */ -#define ACPI_SIG_TCPA "TCPA" /* Trusted Computing Platform Alliance table */ -#define ACPI_SIG_UEFI "UEFI" /* Uefi Boot Optimization Table */ -#define ACPI_SIG_WDAT "WDAT" /* Watchdog Action Table */ -#define ACPI_SIG_WDRT "WDRT" /* Watchdog Resource Table */ /* @@ -170,7 +160,13 @@ */ -/* Common Subtable header (used in MADT, SRAT, etc.) */ +/******************************************************************************* + * + * Common subtable headers + * + ******************************************************************************/ + +/* Generic subtable header (used in MADT, SRAT, etc.) */ typedef struct acpi_subtable_header { @@ -180,7 +176,7 @@ typedef struct acpi_subtable_header } ACPI_SUBTABLE_HEADER; -/* Common Subtable header for WHEA tables (EINJ, ERST, WDAT) */ +/* Subtable header for WHEA tables (EINJ, ERST, WDAT) */ typedef struct acpi_whea_header { @@ -197,138 +193,8 @@ typedef struct acpi_whea_header /******************************************************************************* * - * ASF - Alert Standard Format table (Signature "ASF!") - * - * Conforms to the Alert Standard Format Specification V2.0, 23 April 2003 - * - ******************************************************************************/ - -typedef struct acpi_table_asf -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - -} ACPI_TABLE_ASF; - - -/* ASF subtable header */ - -typedef struct acpi_asf_header -{ - UINT8 Type; - UINT8 Reserved; - UINT16 Length; - -} ACPI_ASF_HEADER; - - -/* Values for Type field above */ - -enum AcpiAsfType -{ - ACPI_ASF_TYPE_INFO = 0, - ACPI_ASF_TYPE_ALERT = 1, - ACPI_ASF_TYPE_CONTROL = 2, - ACPI_ASF_TYPE_BOOT = 3, - ACPI_ASF_TYPE_ADDRESS = 4, - ACPI_ASF_TYPE_RESERVED = 5 -}; - -/* - * ASF subtables - */ - -/* 0: ASF Information */ - -typedef struct acpi_asf_info -{ - ACPI_ASF_HEADER Header; - UINT8 MinResetValue; - UINT8 MinPollInterval; - UINT16 SystemId; - UINT32 MfgId; - UINT8 Flags; - UINT8 Reserved2[3]; - -} ACPI_ASF_INFO; - -/* 1: ASF Alerts */ - -typedef struct acpi_asf_alert -{ - ACPI_ASF_HEADER Header; - UINT8 AssertMask; - UINT8 DeassertMask; - UINT8 Alerts; - UINT8 DataLength; - -} ACPI_ASF_ALERT; - -typedef struct acpi_asf_alert_data -{ - UINT8 Address; - UINT8 Command; - UINT8 Mask; - UINT8 Value; - UINT8 SensorType; - UINT8 Type; - UINT8 Offset; - UINT8 SourceType; - UINT8 Severity; - UINT8 SensorNumber; - UINT8 Entity; - UINT8 Instance; - -} ACPI_ASF_ALERT_DATA; - -/* 2: ASF Remote Control */ - -typedef struct acpi_asf_remote -{ - ACPI_ASF_HEADER Header; - UINT8 Controls; - UINT8 DataLength; - UINT16 Reserved2; - -} ACPI_ASF_REMOTE; - -typedef struct acpi_asf_control_data -{ - UINT8 Function; - UINT8 Address; - UINT8 Command; - UINT8 Value; - -} ACPI_ASF_CONTROL_DATA; - -/* 3: ASF RMCP Boot Options */ - -typedef struct acpi_asf_rmcp -{ - ACPI_ASF_HEADER Header; - UINT8 Capabilities[7]; - UINT8 CompletionCode; - UINT32 EnterpriseId; - UINT8 Command; - UINT16 Parameter; - UINT16 BootOptions; - UINT16 OemParameters; - -} ACPI_ASF_RMCP; - -/* 4: ASF Address */ - -typedef struct acpi_asf_address -{ - ACPI_ASF_HEADER Header; - UINT8 EpromAddress; - UINT8 Devices; - -} ACPI_ASF_ADDRESS; - - -/******************************************************************************* - * - * BERT - Boot Error Record Table + * BERT - Boot Error Record Table (ACPI 4.0) + * Version 1 * ******************************************************************************/ @@ -341,44 +207,47 @@ typedef struct acpi_table_bert } ACPI_TABLE_BERT; -/* Boot Error Region */ +/* Boot Error Region (not a subtable, pointed to by Address field above) */ typedef struct acpi_bert_region { - UINT32 BlockStatus; - UINT32 RawDataOffset; - UINT32 RawDataLength; - UINT32 DataLength; - UINT32 ErrorSeverity; + UINT32 BlockStatus; /* Type of error information */ + UINT32 RawDataOffset; /* Offset to raw error data */ + UINT32 RawDataLength; /* Length of raw error data */ + UINT32 DataLength; /* Length of generic error data */ + UINT32 ErrorSeverity; /* Severity code */ } ACPI_BERT_REGION; -/* BlockStatus Flags */ +/* Values for BlockStatus flags above */ #define ACPI_BERT_UNCORRECTABLE (1) -#define ACPI_BERT_CORRECTABLE (2) -#define ACPI_BERT_MULTIPLE_UNCORRECTABLE (4) -#define ACPI_BERT_MULTIPLE_CORRECTABLE (8) - +#define ACPI_BERT_CORRECTABLE (1<<1) +#define ACPI_BERT_MULTIPLE_UNCORRECTABLE (1<<2) +#define ACPI_BERT_MULTIPLE_CORRECTABLE (1<<3) +#define ACPI_BERT_ERROR_ENTRY_COUNT (0xFF<<4) /* 8 bits, error count */ -/******************************************************************************* - * - * BOOT - Simple Boot Flag Table - * - ******************************************************************************/ +/* Values for ErrorSeverity above */ -typedef struct acpi_table_boot +enum AcpiBertErrorSeverity { - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT8 CmosIndex; /* Index in CMOS RAM for the boot register */ - UINT8 Reserved[3]; + ACPI_BERT_ERROR_CORRECTABLE = 0, + ACPI_BERT_ERROR_FATAL = 1, + ACPI_BERT_ERROR_CORRECTED = 2, + ACPI_BERT_ERROR_NONE = 3, + ACPI_BERT_ERROR_RESERVED = 4 /* 4 and greater are reserved */ +}; -} ACPI_TABLE_BOOT; +/* + * Note: The generic error data that follows the ErrorSeverity field above + * uses the ACPI_HEST_GENERIC_DATA defined under the HEST table below + */ /******************************************************************************* * - * CPEP - Corrected Platform Error Polling table + * CPEP - Corrected Platform Error Polling table (ACPI 4.0) + * Version 1 * ******************************************************************************/ @@ -394,8 +263,7 @@ typedef struct acpi_table_cpep typedef struct acpi_cpep_polling { - UINT8 Type; - UINT8 Length; + ACPI_SUBTABLE_HEADER Header; UINT8 Id; /* Processor ID */ UINT8 Eid; /* Processor EID */ UINT32 Interval; /* Polling interval (msec) */ @@ -405,143 +273,8 @@ typedef struct acpi_cpep_polling /******************************************************************************* * - * DBGP - Debug Port table - * - ******************************************************************************/ - -typedef struct acpi_table_dbgp -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT8 Type; /* 0=full 16550, 1=subset of 16550 */ - UINT8 Reserved[3]; - ACPI_GENERIC_ADDRESS DebugPort; - -} ACPI_TABLE_DBGP; - - -/******************************************************************************* - * - * DMAR - DMA Remapping table - * From "Intel Virtualization Technology for Directed I/O", Sept. 2007 - * - ******************************************************************************/ - -typedef struct acpi_table_dmar -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT8 Width; /* Host Address Width */ - UINT8 Flags; - UINT8 Reserved[10]; - -} ACPI_TABLE_DMAR; - -/* Flags */ - -#define ACPI_DMAR_INTR_REMAP (1) - -/* DMAR subtable header */ - -typedef struct acpi_dmar_header -{ - UINT16 Type; - UINT16 Length; - -} ACPI_DMAR_HEADER; - -/* Values for subtable type in ACPI_DMAR_HEADER */ - -enum AcpiDmarType -{ - ACPI_DMAR_TYPE_HARDWARE_UNIT = 0, - ACPI_DMAR_TYPE_RESERVED_MEMORY = 1, - ACPI_DMAR_TYPE_ATSR = 2, - ACPI_DMAR_TYPE_RESERVED = 3 /* 3 and greater are reserved */ -}; - -typedef struct acpi_dmar_device_scope -{ - UINT8 EntryType; - UINT8 Length; - UINT16 Reserved; - UINT8 EnumerationId; - UINT8 Bus; - -} ACPI_DMAR_DEVICE_SCOPE; - -/* Values for EntryType in ACPI_DMAR_DEVICE_SCOPE */ - -enum AcpiDmarScopeType -{ - ACPI_DMAR_SCOPE_TYPE_NOT_USED = 0, - ACPI_DMAR_SCOPE_TYPE_ENDPOINT = 1, - ACPI_DMAR_SCOPE_TYPE_BRIDGE = 2, - ACPI_DMAR_SCOPE_TYPE_IOAPIC = 3, - ACPI_DMAR_SCOPE_TYPE_HPET = 4, - ACPI_DMAR_SCOPE_TYPE_RESERVED = 5 /* 5 and greater are reserved */ -}; - -typedef struct acpi_dmar_pci_path -{ - UINT8 Device; - UINT8 Function; - -} ACPI_DMAR_PCI_PATH; - -/* - * DMAR Sub-tables, correspond to Type in ACPI_DMAR_HEADER - */ - -/* 0: Hardware Unit Definition */ - -typedef struct acpi_dmar_hardware_unit -{ - ACPI_DMAR_HEADER Header; - UINT8 Flags; - UINT8 Reserved; - UINT16 Segment; - UINT64 Address; /* Register Base Address */ - -} ACPI_DMAR_HARDWARE_UNIT; - -/* Flags */ - -#define ACPI_DMAR_INCLUDE_ALL (1) - -/* 1: Reserved Memory Defininition */ - -typedef struct acpi_dmar_reserved_memory -{ - ACPI_DMAR_HEADER Header; - UINT16 Reserved; - UINT16 Segment; - UINT64 BaseAddress; /* 4K aligned base address */ - UINT64 EndAddress; /* 4K aligned limit address */ - -} ACPI_DMAR_RESERVED_MEMORY; - -/* Flags */ - -#define ACPI_DMAR_ALLOW_ALL (1) - -/* 2: Root Port ATS Capability Reporting Structure */ - -typedef struct acpi_dmar_atsr -{ - ACPI_DMAR_HEADER Header; - UINT8 Flags; - UINT8 Reserved; - UINT16 Segment; - -} ACPI_DMAR_ATSR; - -/* Flags */ - -#define ACPI_DMAR_ALL_PORTS (1) - - -/******************************************************************************* - * * ECDT - Embedded Controller Boot Resources Table + * Version 1 * ******************************************************************************/ @@ -559,7 +292,8 @@ typedef struct acpi_table_ecdt /******************************************************************************* * - * EINJ - Error Injection Table + * EINJ - Error Injection Table (ACPI 4.0) + * Version 1 * ******************************************************************************/ @@ -567,11 +301,13 @@ typedef struct acpi_table_einj { ACPI_TABLE_HEADER Header; /* Common ACPI table header */ UINT32 HeaderLength; - UINT32 Reserved; + UINT8 Flags; + UINT8 Reserved[3]; UINT32 Entries; } ACPI_TABLE_EINJ; + /* EINJ Injection Instruction Entries (actions) */ typedef struct acpi_einj_entry @@ -580,6 +316,10 @@ typedef struct acpi_einj_entry } ACPI_EINJ_ENTRY; +/* Masks for Flags field above */ + +#define ACPI_EINJ_PRESERVE (1) + /* Values for Action field above */ enum AcpiEinjActions @@ -608,6 +348,7 @@ enum AcpiEinjInstructions ACPI_EINJ_INSTRUCTION_RESERVED = 5 /* 5 and greater are reserved */ }; + /* EINJ Trigger Error Action Table */ typedef struct acpi_einj_trigger @@ -619,10 +360,37 @@ typedef struct acpi_einj_trigger } ACPI_EINJ_TRIGGER; +/* Command status return values */ + +enum AcpiEinjCommandStatus +{ + ACPI_EINJ_SUCCESS = 0, + ACPI_EINJ_FAILURE = 1, + ACPI_EINJ_INVALID_ACCESS = 2, + ACPI_EINJ_STATUS_RESERVED = 3 /* 3 and greater are reserved */ +}; + + +/* Error types returned from ACPI_EINJ_GET_ERROR_TYPE (bitfield) */ + +#define ACPI_EINJ_PROCESSOR_CORRECTABLE (1) +#define ACPI_EINJ_PROCESSOR_UNCORRECTABLE (1<<1) +#define ACPI_EINJ_PROCESSOR_FATAL (1<<2) +#define ACPI_EINJ_MEMORY_CORRECTABLE (1<<3) +#define ACPI_EINJ_MEMORY_UNCORRECTABLE (1<<4) +#define ACPI_EINJ_MEMORY_FATAL (1<<5) +#define ACPI_EINJ_PCIX_CORRECTABLE (1<<6) +#define ACPI_EINJ_PCIX_UNCORRECTABLE (1<<7) +#define ACPI_EINJ_PCIX_FATAL (1<<8) +#define ACPI_EINJ_PLATFORM_CORRECTABLE (1<<9) +#define ACPI_EINJ_PLATFORM_UNCORRECTABLE (1<<10) +#define ACPI_EINJ_PLATFORM_FATAL (1<<11) + /******************************************************************************* * - * ERST - Error Record Serialization Table + * ERST - Error Record Serialization Table (ACPI 4.0) + * Version 1 * ******************************************************************************/ @@ -635,6 +403,7 @@ typedef struct acpi_table_erst } ACPI_TABLE_ERST; + /* ERST Serialization Entries (actions) */ typedef struct acpi_erst_entry @@ -643,20 +412,24 @@ typedef struct acpi_erst_entry } ACPI_ERST_ENTRY; +/* Masks for Flags field above */ + +#define ACPI_ERST_PRESERVE (1) + /* Values for Action field above */ enum AcpiErstActions { - ACPI_ERST_BEGIN_WRITE_OPERATION = 0, - ACPI_ERST_BEGIN_READ_OPERATION = 1, - ACPI_ERST_BETGIN_CLEAR_OPERATION= 2, - ACPI_ERST_END_OPERATION = 3, + ACPI_ERST_BEGIN_WRITE = 0, + ACPI_ERST_BEGIN_READ = 1, + ACPI_ERST_BEGIN_CLEAR = 2, + ACPI_ERST_END = 3, ACPI_ERST_SET_RECORD_OFFSET = 4, ACPI_ERST_EXECUTE_OPERATION = 5, ACPI_ERST_CHECK_BUSY_STATUS = 6, ACPI_ERST_GET_COMMAND_STATUS = 7, - ACPI_ERST_GET_RECORD_IDENTIFIER = 8, - ACPI_ERST_SET_RECORD_IDENTIFIER = 9, + ACPI_ERST_GET_RECORD_ID = 8, + ACPI_ERST_SET_RECORD_ID = 9, ACPI_ERST_GET_RECORD_COUNT = 10, ACPI_ERST_BEGIN_DUMMY_WRIITE = 11, ACPI_ERST_NOT_USED = 12, @@ -692,10 +465,34 @@ enum AcpiErstInstructions ACPI_ERST_INSTRUCTION_RESERVED = 19 /* 19 and greater are reserved */ }; +/* Command status return values */ + +enum AcpiErstCommandStatus +{ + ACPI_ERST_SUCESS = 0, + ACPI_ERST_NO_SPACE = 1, + ACPI_ERST_NOT_AVAILABLE = 2, + ACPI_ERST_FAILURE = 3, + ACPI_ERST_RECORD_EMPTY = 4, + ACPI_ERST_NOT_FOUND = 5, + ACPI_ERST_STATUS_RESERVED = 6 /* 6 and greater are reserved */ +}; + + +/* Error Record Serialization Information */ + +typedef struct acpi_erst_info +{ + UINT16 Signature; /* Should be "ER" */ + UINT8 Data[48]; + +} ACPI_ERST_INFO; + /******************************************************************************* * - * HEST - Hardware Error Source Table + * HEST - Hardware Error Source Table (ACPI 4.0) + * Version 1 * ******************************************************************************/ @@ -712,6 +509,7 @@ typedef struct acpi_table_hest typedef struct acpi_hest_header { UINT16 Type; + UINT16 SourceId; } ACPI_HEST_HEADER; @@ -720,92 +518,69 @@ typedef struct acpi_hest_header enum AcpiHestTypes { - ACPI_HEST_TYPE_XPF_MACHINE_CHECK = 0, - ACPI_HEST_TYPE_XPF_CORRECTED_MACHINE_CHECK = 1, - ACPI_HEST_TYPE_XPF_UNUSED = 2, - ACPI_HEST_TYPE_XPF_NON_MASKABLE_INTERRUPT = 3, - ACPI_HEST_TYPE_IPF_CORRECTED_MACHINE_CHECK = 4, - ACPI_HEST_TYPE_IPF_CORRECTED_PLATFORM_ERROR = 5, - ACPI_HEST_TYPE_AER_ROOT_PORT = 6, - ACPI_HEST_TYPE_AER_ENDPOINT = 7, - ACPI_HEST_TYPE_AER_BRIDGE = 8, - ACPI_HEST_TYPE_GENERIC_HARDWARE_ERROR_SOURCE = 9, - ACPI_HEST_TYPE_RESERVED = 10 /* 10 and greater are reserved */ + ACPI_HEST_TYPE_IA32_CHECK = 0, + ACPI_HEST_TYPE_IA32_CORRECTED_CHECK = 1, + ACPI_HEST_TYPE_IA32_NMI = 2, + ACPI_HEST_TYPE_NOT_USED3 = 3, + ACPI_HEST_TYPE_NOT_USED4 = 4, + ACPI_HEST_TYPE_NOT_USED5 = 5, + ACPI_HEST_TYPE_AER_ROOT_PORT = 6, + ACPI_HEST_TYPE_AER_ENDPOINT = 7, + ACPI_HEST_TYPE_AER_BRIDGE = 8, + ACPI_HEST_TYPE_GENERIC_ERROR = 9, + ACPI_HEST_TYPE_RESERVED = 10 /* 10 and greater are reserved */ }; /* - * HEST Sub-subtables + * HEST substructures contained in subtables */ -/* XPF Machine Check Error Bank */ - -typedef struct acpi_hest_xpf_error_bank +/* + * IA32 Error Bank(s) - Follows the ACPI_HEST_IA_MACHINE_CHECK and + * ACPI_HEST_IA_CORRECTED structures. + */ +typedef struct acpi_hest_ia_error_bank { UINT8 BankNumber; UINT8 ClearStatusOnInit; UINT8 StatusFormat; - UINT8 ConfigWriteEnable; + UINT8 Reserved; UINT32 ControlRegister; - UINT64 ControlInitData; + UINT64 ControlData; UINT32 StatusRegister; UINT32 AddressRegister; UINT32 MiscRegister; -} ACPI_HEST_XPF_ERROR_BANK; - - -/* Generic Error Status */ - -typedef struct acpi_hest_generic_status -{ - UINT32 BlockStatus; - UINT32 RawDataOffset; - UINT32 RawDataLength; - UINT32 DataLength; - UINT32 ErrorSeverity; - -} ACPI_HEST_GENERIC_STATUS; - - -/* Generic Error Data */ - -typedef struct acpi_hest_generic_data -{ - UINT8 SectionType[16]; - UINT32 ErrorSeverity; - UINT16 Revision; - UINT8 ValidationBits; - UINT8 Flags; - UINT32 ErrorDataLength; - UINT8 FruId[16]; - UINT8 FruText[20]; - -} ACPI_HEST_GENERIC_DATA; +} ACPI_HEST_IA_ERROR_BANK; -/* Common HEST structure for PCI/AER types below (6,7,8) */ +/* Common HEST sub-structure for PCI/AER structures below (6,7,8) */ typedef struct acpi_hest_aer_common { - UINT16 SourceId; - UINT16 ConfigWriteEnable; + UINT16 Reserved1; UINT8 Flags; UINT8 Enabled; - UINT32 RecordsToPreAllocate; + UINT32 RecordsToPreallocate; UINT32 MaxSectionsPerRecord; UINT32 Bus; UINT16 Device; UINT16 Function; UINT16 DeviceControl; - UINT16 Reserved; - UINT32 UncorrectableErrorMask; - UINT32 UncorrectableErrorSeverity; - UINT32 CorrectableErrorMask; - UINT32 AdvancedErrorCapabilities; + UINT16 Reserved2; + UINT32 UncorrectableMask; + UINT32 UncorrectableSeverity; + UINT32 CorrectableMask; + UINT32 AdvancedCapabilities; } ACPI_HEST_AER_COMMON; +/* Masks for HEST Flags fields */ + +#define ACPI_HEST_FIRMWARE_FIRST (1) +#define ACPI_HEST_GLOBAL (1<<1) + /* Hardware Error Notification */ @@ -835,87 +610,69 @@ enum AcpiHestNotifyTypes ACPI_HEST_NOTIFY_RESERVED = 5 /* 5 and greater are reserved */ }; +/* Values for ConfigWriteEnable bitfield above */ + +#define ACPI_HEST_TYPE (1) +#define ACPI_HEST_POLL_INTERVAL (1<<1) +#define ACPI_HEST_POLL_THRESHOLD_VALUE (1<<2) +#define ACPI_HEST_POLL_THRESHOLD_WINDOW (1<<3) +#define ACPI_HEST_ERR_THRESHOLD_VALUE (1<<4) +#define ACPI_HEST_ERR_THRESHOLD_WINDOW (1<<5) + /* * HEST subtables - * - * From WHEA Design Document, 16 May 2007. - * Note: There is no subtable type 2 in this version of the document, - * and there are two different subtable type 3s. */ - /* 0: XPF Machine Check Exception */ +/* 0: IA32 Machine Check Exception */ -typedef struct acpi_hest_xpf_machine_check +typedef struct acpi_hest_ia_machine_check { ACPI_HEST_HEADER Header; - UINT16 SourceId; - UINT16 ConfigWriteEnable; + UINT16 Reserved1; UINT8 Flags; - UINT8 Reserved1; - UINT32 RecordsToPreAllocate; + UINT8 Enabled; + UINT32 RecordsToPreallocate; UINT32 MaxSectionsPerRecord; UINT64 GlobalCapabilityData; UINT64 GlobalControlData; UINT8 NumHardwareBanks; - UINT8 Reserved2[7]; + UINT8 Reserved3[7]; -} ACPI_HEST_XPF_MACHINE_CHECK; +} ACPI_HEST_IA_MACHINE_CHECK; -/* 1: XPF Corrected Machine Check */ +/* 1: IA32 Corrected Machine Check */ -typedef struct acpi_table_hest_xpf_corrected +typedef struct acpi_hest_ia_corrected { ACPI_HEST_HEADER Header; - UINT16 SourceId; - UINT16 ConfigWriteEnable; + UINT16 Reserved1; UINT8 Flags; UINT8 Enabled; - UINT32 RecordsToPreAllocate; + UINT32 RecordsToPreallocate; UINT32 MaxSectionsPerRecord; ACPI_HEST_NOTIFY Notify; UINT8 NumHardwareBanks; - UINT8 Reserved[3]; + UINT8 Reserved2[3]; -} ACPI_HEST_XPF_CORRECTED; +} ACPI_HEST_IA_CORRECTED; -/* 3: XPF Non-Maskable Interrupt */ +/* 2: IA32 Non-Maskable Interrupt */ -typedef struct acpi_hest_xpf_nmi +typedef struct acpi_hest_ia_nmi { ACPI_HEST_HEADER Header; - UINT16 SourceId; UINT32 Reserved; - UINT32 RecordsToPreAllocate; + UINT32 RecordsToPreallocate; UINT32 MaxSectionsPerRecord; UINT32 MaxRawDataLength; -} ACPI_HEST_XPF_NMI; +} ACPI_HEST_IA_NMI; -/* 4: IPF Corrected Machine Check */ - -typedef struct acpi_hest_ipf_corrected -{ - ACPI_HEST_HEADER Header; - UINT8 Enabled; - UINT8 Reserved; - -} ACPI_HEST_IPF_CORRECTED; - - -/* 5: IPF Corrected Platform Error */ - -typedef struct acpi_hest_ipf_corrected_platform -{ - ACPI_HEST_HEADER Header; - UINT8 Enabled; - UINT8 Reserved; - -} ACPI_HEST_IPF_CORRECTED_PLATFORM; - +/* 3,4,5: Not used */ /* 6: PCI Express Root Port AER */ @@ -944,9 +701,9 @@ typedef struct acpi_hest_aer_bridge { ACPI_HEST_HEADER Header; ACPI_HEST_AER_COMMON Aer; - UINT32 SecondaryUncorrectableErrorMask; - UINT32 SecondaryUncorrectableErrorSeverity; - UINT32 SecondaryAdvancedCapabilities; + UINT32 UncorrectableMask2; + UINT32 UncorrectableSeverity2; + UINT32 AdvancedCapabilities2; } ACPI_HEST_AER_BRIDGE; @@ -956,156 +713,60 @@ typedef struct acpi_hest_aer_bridge typedef struct acpi_hest_generic { ACPI_HEST_HEADER Header; - UINT16 SourceId; UINT16 RelatedSourceId; - UINT8 ConfigWriteEnable; + UINT8 Reserved; UINT8 Enabled; - UINT32 RecordsToPreAllocate; + UINT32 RecordsToPreallocate; UINT32 MaxSectionsPerRecord; UINT32 MaxRawDataLength; ACPI_GENERIC_ADDRESS ErrorStatusAddress; ACPI_HEST_NOTIFY Notify; - UINT32 ErrorStatusBlockLength; + UINT32 ErrorBlockLength; } ACPI_HEST_GENERIC; -/******************************************************************************* - * - * HPET - High Precision Event Timer table - * - ******************************************************************************/ +/* Generic Error Status block */ -typedef struct acpi_table_hpet +typedef struct acpi_hest_generic_status { - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT32 Id; /* Hardware ID of event timer block */ - ACPI_GENERIC_ADDRESS Address; /* Address of event timer block */ - UINT8 Sequence; /* HPET sequence number */ - UINT16 MinimumTick; /* Main counter min tick, periodic mode */ - UINT8 Flags; - -} ACPI_TABLE_HPET; - -/*! Flags */ - -#define ACPI_HPET_PAGE_PROTECT (1) /* 00: No page protection */ -#define ACPI_HPET_PAGE_PROTECT_4 (1<<1) /* 01: 4KB page protected */ -#define ACPI_HPET_PAGE_PROTECT_64 (1<<2) /* 02: 64KB page protected */ - -/*! [End] no source code translation !*/ - + UINT32 BlockStatus; + UINT32 RawDataOffset; + UINT32 RawDataLength; + UINT32 DataLength; + UINT32 ErrorSeverity; -/******************************************************************************* - * - * IBFT - Boot Firmware Table - * - ******************************************************************************/ +} ACPI_HEST_GENERIC_STATUS; -typedef struct acpi_table_ibft -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT8 Reserved[12]; +/* Values for BlockStatus flags above */ -} ACPI_TABLE_IBFT; +#define ACPI_HEST_UNCORRECTABLE (1) +#define ACPI_HEST_CORRECTABLE (1<<1) +#define ACPI_HEST_MULTIPLE_UNCORRECTABLE (1<<2) +#define ACPI_HEST_MULTIPLE_CORRECTABLE (1<<3) +#define ACPI_HEST_ERROR_ENTRY_COUNT (0xFF<<4) /* 8 bits, error count */ -/* IBFT common subtable header */ +/* Generic Error Data entry */ -typedef struct acpi_ibft_header +typedef struct acpi_hest_generic_data { - UINT8 Type; - UINT8 Version; - UINT16 Length; - UINT8 Index; + UINT8 SectionType[16]; + UINT32 ErrorSeverity; + UINT16 Revision; + UINT8 ValidationBits; UINT8 Flags; + UINT32 ErrorDataLength; + UINT8 FruId[16]; + UINT8 FruText[20]; -} ACPI_IBFT_HEADER; - - -/* Values for Type field above */ - -enum AcpiIbftType -{ - ACPI_IBFT_TYPE_NOT_USED = 0, - ACPI_IBFT_TYPE_CONTROL = 1, - ACPI_IBFT_TYPE_INITIATOR = 2, - ACPI_IBFT_TYPE_NIC = 3, - ACPI_IBFT_TYPE_TARGET = 4, - ACPI_IBFT_TYPE_EXTENSIONS = 5, - ACPI_IBFT_TYPE_RESERVED = 6 /* 6 and greater are reserved */ -}; - - -/* IBFT subtables */ - -typedef struct acpi_ibft_control -{ - ACPI_IBFT_HEADER Header; - UINT16 Extensions; - UINT16 InitiatorOffset; - UINT16 Nic0Offset; - UINT16 Target0Offset; - UINT16 Nic1Offset; - UINT16 Target1Offset; - -} ACPI_IBFT_CONTROL; - -typedef struct acpi_ibft_initiator -{ - ACPI_IBFT_HEADER Header; - UINT8 SnsServer[16]; - UINT8 SlpServer[16]; - UINT8 PrimaryServer[16]; - UINT8 SecondaryServer[16]; - UINT16 NameLength; - UINT16 NameOffset; - -} ACPI_IBFT_INITIATOR; - -typedef struct acpi_ibft_nic -{ - ACPI_IBFT_HEADER Header; - UINT8 IpAddress[16]; - UINT8 SubnetMaskPrefix; - UINT8 Origin; - UINT8 Gateway[16]; - UINT8 PrimaryDns[16]; - UINT8 SecondaryDns[16]; - UINT8 Dhcp[16]; - UINT16 Vlan; - UINT8 MacAddress[6]; - UINT16 PciAddress; - UINT16 NameLength; - UINT16 NameOffset; - -} ACPI_IBFT_NIC; - -typedef struct acpi_ibft_target -{ - ACPI_IBFT_HEADER Header; - UINT8 TargetIpAddress[16]; - UINT16 TargetIpSocket; - UINT8 TargetBootLun[8]; - UINT8 ChapType; - UINT8 NicAssociation; - UINT16 TargetNameLength; - UINT16 TargetNameOffset; - UINT16 ChapNameLength; - UINT16 ChapNameOffset; - UINT16 ChapSecretLength; - UINT16 ChapSecretOffset; - UINT16 ReverseChapNameLength; - UINT16 ReverseChapNameOffset; - UINT16 ReverseChapSecretLength; - UINT16 ReverseChapSecretOffset; - -} ACPI_IBFT_TARGET; +} ACPI_HEST_GENERIC_DATA; /******************************************************************************* * * MADT - Multiple APIC Description Table + * Version 3 * ******************************************************************************/ @@ -1117,9 +778,9 @@ typedef struct acpi_table_madt } ACPI_TABLE_MADT; -/* Flags */ +/* Masks for Flags field above */ -#define ACPI_MADT_PCAT_COMPAT (1) /* 00: System also has dual 8259s */ +#define ACPI_MADT_PCAT_COMPAT (1) /* 00: System also has dual 8259s */ /* Values for PCATCompat flag */ @@ -1127,7 +788,7 @@ typedef struct acpi_table_madt #define ACPI_MADT_MULTIPLE_APIC 1 -/* Values for subtable type in ACPI_SUBTABLE_HEADER */ +/* Values for MADT subtable type in ACPI_SUBTABLE_HEADER */ enum AcpiMadtType { @@ -1161,6 +822,7 @@ typedef struct acpi_madt_local_apic } ACPI_MADT_LOCAL_APIC; + /* 1: IO APIC */ typedef struct acpi_madt_io_apic @@ -1173,6 +835,7 @@ typedef struct acpi_madt_io_apic } ACPI_MADT_IO_APIC; + /* 2: Interrupt Override */ typedef struct acpi_madt_interrupt_override @@ -1185,6 +848,7 @@ typedef struct acpi_madt_interrupt_override } ACPI_MADT_INTERRUPT_OVERRIDE; + /* 3: NMI Source */ typedef struct acpi_madt_nmi_source @@ -1195,6 +859,7 @@ typedef struct acpi_madt_nmi_source } ACPI_MADT_NMI_SOURCE; + /* 4: Local APIC NMI */ typedef struct acpi_madt_local_apic_nmi @@ -1206,6 +871,7 @@ typedef struct acpi_madt_local_apic_nmi } ACPI_MADT_LOCAL_APIC_NMI; + /* 5: Address Override */ typedef struct acpi_madt_local_apic_override @@ -1216,6 +882,7 @@ typedef struct acpi_madt_local_apic_override } ACPI_MADT_LOCAL_APIC_OVERRIDE; + /* 6: I/O Sapic */ typedef struct acpi_madt_io_sapic @@ -1228,6 +895,7 @@ typedef struct acpi_madt_io_sapic } ACPI_MADT_IO_SAPIC; + /* 7: Local Sapic */ typedef struct acpi_madt_local_sapic @@ -1243,6 +911,7 @@ typedef struct acpi_madt_local_sapic } ACPI_MADT_LOCAL_SAPIC; + /* 8: Platform Interrupt Source */ typedef struct acpi_madt_interrupt_source @@ -1258,11 +927,12 @@ typedef struct acpi_madt_interrupt_source } ACPI_MADT_INTERRUPT_SOURCE; -/* Flags field above */ +/* Masks for Flags field above */ #define ACPI_MADT_CPEI_OVERRIDE (1) -/* 9: Processor Local X2APIC (07/2008) */ + +/* 9: Processor Local X2APIC (ACPI 4.0) */ typedef struct acpi_madt_local_x2apic { @@ -1274,7 +944,8 @@ typedef struct acpi_madt_local_x2apic } ACPI_MADT_LOCAL_X2APIC; -/* 10: Local X2APIC NMI (07/2008) */ + +/* 10: Local X2APIC NMI (ACPI 4.0) */ typedef struct acpi_madt_local_x2apic_nmi { @@ -1315,34 +986,40 @@ typedef struct acpi_madt_local_x2apic_nmi /******************************************************************************* * - * MCFG - PCI Memory Mapped Configuration table and sub-table + * MSCT - Maximum System Characteristics Table (ACPI 4.0) + * Version 1 * ******************************************************************************/ -typedef struct acpi_table_mcfg +typedef struct acpi_table_msct { ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT8 Reserved[8]; + UINT32 ProximityOffset; /* Location of proximity info struct(s) */ + UINT32 MaxProximityDomains;/* Max number of proximity domains */ + UINT32 MaxClockDomains; /* Max number of clock domains */ + UINT64 MaxAddress; /* Max physical address in system */ -} ACPI_TABLE_MCFG; +} ACPI_TABLE_MSCT; -/* Subtable */ +/* Subtable - Maximum Proximity Domain Information. Version 1 */ -typedef struct acpi_mcfg_allocation +typedef struct acpi_msct_proximity { - UINT64 Address; /* Base address, processor-relative */ - UINT16 PciSegment; /* PCI segment group number */ - UINT8 StartBusNumber; /* Starting PCI Bus number */ - UINT8 EndBusNumber; /* Final PCI Bus number */ - UINT32 Reserved; + UINT8 Revision; + UINT8 Length; + UINT32 RangeStart; /* Start of domain range */ + UINT32 RangeEnd; /* End of domain range */ + UINT32 ProcessorCapacity; + UINT64 MemoryCapacity; /* In bytes */ -} ACPI_MCFG_ALLOCATION; +} ACPI_MSCT_PROXIMITY; /******************************************************************************* * * SBST - Smart Battery Specification Table + * Version 1 * ******************************************************************************/ @@ -1359,6 +1036,7 @@ typedef struct acpi_table_sbst /******************************************************************************* * * SLIT - System Locality Distance Information Table + * Version 1 * ******************************************************************************/ @@ -1373,66 +1051,8 @@ typedef struct acpi_table_slit /******************************************************************************* * - * SPCR - Serial Port Console Redirection table - * - ******************************************************************************/ - -typedef struct acpi_table_spcr -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT8 InterfaceType; /* 0=full 16550, 1=subset of 16550 */ - UINT8 Reserved[3]; - ACPI_GENERIC_ADDRESS SerialPort; - UINT8 InterruptType; - UINT8 PcInterrupt; - UINT32 Interrupt; - UINT8 BaudRate; - UINT8 Parity; - UINT8 StopBits; - UINT8 FlowControl; - UINT8 TerminalType; - UINT8 Reserved1; - UINT16 PciDeviceId; - UINT16 PciVendorId; - UINT8 PciBus; - UINT8 PciDevice; - UINT8 PciFunction; - UINT32 PciFlags; - UINT8 PciSegment; - UINT32 Reserved2; - -} ACPI_TABLE_SPCR; - - -/******************************************************************************* - * - * SPMI - Server Platform Management Interface table - * - ******************************************************************************/ - -typedef struct acpi_table_spmi -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT8 Reserved; - UINT8 InterfaceType; - UINT16 SpecRevision; /* Version of IPMI */ - UINT8 InterruptType; - UINT8 GpeNumber; /* GPE assigned */ - UINT8 Reserved1; - UINT8 PciDeviceFlag; - UINT32 Interrupt; - ACPI_GENERIC_ADDRESS IpmiRegister; - UINT8 PciSegment; - UINT8 PciBus; - UINT8 PciDevice; - UINT8 PciFunction; - -} ACPI_TABLE_SPMI; - - -/******************************************************************************* - * * SRAT - System Resource Affinity Table + * Version 3 * ******************************************************************************/ @@ -1472,6 +1092,11 @@ typedef struct acpi_srat_cpu_affinity } ACPI_SRAT_CPU_AFFINITY; +/* Flags */ + +#define ACPI_SRAT_CPU_USE_AFFINITY (1) /* 00: Use affinity structure */ + + /* 1: Memory Affinity */ typedef struct acpi_srat_mem_affinity @@ -1493,7 +1118,8 @@ typedef struct acpi_srat_mem_affinity #define ACPI_SRAT_MEM_HOT_PLUGGABLE (1<<1) /* 01: Memory region is hot pluggable */ #define ACPI_SRAT_MEM_NON_VOLATILE (1<<2) /* 02: Memory region is non-volatile */ -/* 2: Processor Local X2_APIC Affinity (07/2008) */ + +/* 2: Processor Local X2_APIC Affinity (ACPI 4.0) */ typedef struct acpi_srat_x2apic_cpu_affinity { @@ -1502,6 +1128,8 @@ typedef struct acpi_srat_x2apic_cpu_affinity UINT32 ProximityDomain; UINT32 ApicId; UINT32 Flags; + UINT32 ClockDomain; + UINT32 Reserved2; } ACPI_SRAT_X2APIC_CPU_AFFINITY; @@ -1510,132 +1138,6 @@ typedef struct acpi_srat_x2apic_cpu_affinity #define ACPI_SRAT_CPU_ENABLED (1) /* 00: Use affinity structure */ -/******************************************************************************* - * - * TCPA - Trusted Computing Platform Alliance table - * - ******************************************************************************/ - -typedef struct acpi_table_tcpa -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT16 Reserved; - UINT32 MaxLogLength; /* Maximum length for the event log area */ - UINT64 LogAddress; /* Address of the event log area */ - -} ACPI_TABLE_TCPA; - - -/******************************************************************************* - * - * UEFI - UEFI Boot optimization Table - * - ******************************************************************************/ - -typedef struct acpi_table_uefi -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT8 Identifier[16]; /* UUID identifier */ - UINT16 DataOffset; /* Offset of remaining data in table */ - UINT8 Data; - -} ACPI_TABLE_UEFI; - - -/******************************************************************************* - * - * WDAT - Watchdog Action Table - * - ******************************************************************************/ - -typedef struct acpi_table_wdat -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT32 HeaderLength; /* Watchdog Header Length */ - UINT16 PciSegment; /* PCI Segment number */ - UINT8 PciBus; /* PCI Bus number */ - UINT8 PciDevice; /* PCI Device number */ - UINT8 PciFunction; /* PCI Function number */ - UINT8 Reserved[3]; - UINT32 TimerPeriod; /* Period of one timer count (msec) */ - UINT32 MaxCount; /* Maximum counter value supported */ - UINT32 MinCount; /* Minimum counter value */ - UINT8 Flags; - UINT8 Reserved2[3]; - UINT32 Entries; /* Number of watchdog entries that follow */ - -} ACPI_TABLE_WDAT; - -/* WDAT Instruction Entries (actions) */ - -typedef struct acpi_wdat_entry -{ - ACPI_WHEA_HEADER WheaHeader; /* Common header for WHEA tables */ - -} ACPI_WDAT_ENTRY; - -/* Values for Action field above */ - -enum AcpiWdatActions -{ - ACPI_WDAT_RESET = 1, - ACPI_WDAT_GET_CURRENT_COUNTDOWN = 4, - ACPI_WDAT_GET_COUNTDOWN = 5, - ACPI_WDAT_SET_COUNTDOWN = 6, - ACPI_WDAT_GET_RUNNING_STATE = 8, - ACPI_WDAT_SET_RUNNING_STATE = 9, - ACPI_WDAT_GET_STOPPED_STATE = 10, - ACPI_WDAT_SET_STOPPED_STATE = 11, - ACPI_WDAT_GET_REBOOT = 16, - ACPI_WDAT_SET_REBOOT = 17, - ACPI_WDAT_GET_SHUTDOWN = 18, - ACPI_WDAT_SET_SHUTDOWN = 19, - ACPI_WDAT_GET_STATUS = 32, - ACPI_WDAT_SET_STATUS = 33, - ACPI_WDAT_ACTION_RESERVED = 34 /* 34 and greater are reserved */ -}; - -/* Values for Instruction field above */ - -enum AcpiWdatInstructions -{ - ACPI_WDAT_READ_VALUE = 0, - ACPI_WDAT_READ_COUNTDOWN = 1, - ACPI_WDAT_WRITE_VALUE = 2, - ACPI_WDAT_WRITE_COUNTDOWN = 3, - ACPI_WDAT_INSTRUCTION_RESERVED = 4, /* 4 and greater are reserved */ - ACPI_WDAT_PRESERVE_REGISTER = 0x80 /* Except for this value */ -}; - - -/******************************************************************************* - * - * WDRT - Watchdog Resource Table - * - ******************************************************************************/ - -typedef struct acpi_table_wdrt -{ - ACPI_TABLE_HEADER Header; /* Common ACPI table header */ - UINT32 HeaderLength; /* Watchdog Header Length */ - UINT8 PciSegment; /* PCI Segment number */ - UINT8 PciBus; /* PCI Bus number */ - UINT8 PciDevice; /* PCI Device number */ - UINT8 PciFunction; /* PCI Function number */ - UINT32 TimerPeriod; /* Period of one timer count (msec) */ - UINT32 MaxCount; /* Maximum counter value supported */ - UINT32 MinCount; /* Minimum counter value */ - UINT8 Flags; - UINT8 Reserved[3]; - UINT32 Entries; /* Number of watchdog entries that follow */ - -} ACPI_TABLE_WDRT; - -/* Flags */ - -#define ACPI_WDRT_TIMER_ENABLED (1) /* 00: Timer enabled */ - - /* Reset to default packing */ #pragma pack() diff --git a/sys/contrib/dev/acpica/include/actbl2.h b/sys/contrib/dev/acpica/include/actbl2.h new file mode 100644 index 0000000..c96715d --- /dev/null +++ b/sys/contrib/dev/acpica/include/actbl2.h @@ -0,0 +1,1124 @@ +/****************************************************************************** + * + * Name: actbl2.h - ACPI Specification Revision 2.0 Tables + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#ifndef __ACTBL2_H__ +#define __ACTBL2_H__ + + +/******************************************************************************* + * + * Additional ACPI Tables (2) + * + * These tables are not consumed directly by the ACPICA subsystem, but are + * included here to support device drivers and the AML disassembler. + * + * The tables in this file are defined by third-party specifications, and are + * not defined directly by the ACPI specification itself. + * + ******************************************************************************/ + + +/* + * Values for description table header signatures for tables defined in this + * file. Useful because they make it more difficult to inadvertently type in + * the wrong signature. + */ +#define ACPI_SIG_ASF "ASF!" /* Alert Standard Format table */ +#define ACPI_SIG_BOOT "BOOT" /* Simple Boot Flag Table */ +#define ACPI_SIG_DBGP "DBGP" /* Debug Port table */ +#define ACPI_SIG_DMAR "DMAR" /* DMA Remapping table */ +#define ACPI_SIG_HPET "HPET" /* High Precision Event Timer table */ +#define ACPI_SIG_IBFT "IBFT" /* iSCSI Boot Firmware Table */ +#define ACPI_SIG_IVRS "IVRS" /* I/O Virtualization Reporting Structure */ +#define ACPI_SIG_MCFG "MCFG" /* PCI Memory Mapped Configuration 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_WAET "WAET" /* Windows ACPI Emulated devices Table */ +#define ACPI_SIG_WDAT "WDAT" /* Watchdog Action Table */ +#define ACPI_SIG_WDRT "WDRT" /* Watchdog Resource Table */ + + +/* + * All tables must be byte-packed to match the ACPI specification, since + * the tables are provided by the system BIOS. + */ +#pragma pack(1) + +/* + * Note about bitfields: The UINT8 type is used for bitfields in ACPI tables. + * This is the only type that is even remotely portable. Anything else is not + * portable, so do not use any other bitfield types. + */ + + +/******************************************************************************* + * + * ASF - Alert Standard Format table (Signature "ASF!") + * Revision 0x10 + * + * Conforms to the Alert Standard Format Specification V2.0, 23 April 2003 + * + ******************************************************************************/ + +typedef struct acpi_table_asf +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + +} ACPI_TABLE_ASF; + + +/* ASF subtable header */ + +typedef struct acpi_asf_header +{ + UINT8 Type; + UINT8 Reserved; + UINT16 Length; + +} ACPI_ASF_HEADER; + + +/* Values for Type field above */ + +enum AcpiAsfType +{ + ACPI_ASF_TYPE_INFO = 0, + ACPI_ASF_TYPE_ALERT = 1, + ACPI_ASF_TYPE_CONTROL = 2, + ACPI_ASF_TYPE_BOOT = 3, + ACPI_ASF_TYPE_ADDRESS = 4, + ACPI_ASF_TYPE_RESERVED = 5 +}; + +/* + * ASF subtables + */ + +/* 0: ASF Information */ + +typedef struct acpi_asf_info +{ + ACPI_ASF_HEADER Header; + UINT8 MinResetValue; + UINT8 MinPollInterval; + UINT16 SystemId; + UINT32 MfgId; + UINT8 Flags; + UINT8 Reserved2[3]; + +} ACPI_ASF_INFO; + +/* Masks for Flags field above */ + +#define ACPI_ASF_SMBUS_PROTOCOLS (1) + + +/* 1: ASF Alerts */ + +typedef struct acpi_asf_alert +{ + ACPI_ASF_HEADER Header; + UINT8 AssertMask; + UINT8 DeassertMask; + UINT8 Alerts; + UINT8 DataLength; + +} ACPI_ASF_ALERT; + +typedef struct acpi_asf_alert_data +{ + UINT8 Address; + UINT8 Command; + UINT8 Mask; + UINT8 Value; + UINT8 SensorType; + UINT8 Type; + UINT8 Offset; + UINT8 SourceType; + UINT8 Severity; + UINT8 SensorNumber; + UINT8 Entity; + UINT8 Instance; + +} ACPI_ASF_ALERT_DATA; + + +/* 2: ASF Remote Control */ + +typedef struct acpi_asf_remote +{ + ACPI_ASF_HEADER Header; + UINT8 Controls; + UINT8 DataLength; + UINT16 Reserved2; + +} ACPI_ASF_REMOTE; + +typedef struct acpi_asf_control_data +{ + UINT8 Function; + UINT8 Address; + UINT8 Command; + UINT8 Value; + +} ACPI_ASF_CONTROL_DATA; + + +/* 3: ASF RMCP Boot Options */ + +typedef struct acpi_asf_rmcp +{ + ACPI_ASF_HEADER Header; + UINT8 Capabilities[7]; + UINT8 CompletionCode; + UINT32 EnterpriseId; + UINT8 Command; + UINT16 Parameter; + UINT16 BootOptions; + UINT16 OemParameters; + +} ACPI_ASF_RMCP; + + +/* 4: ASF Address */ + +typedef struct acpi_asf_address +{ + ACPI_ASF_HEADER Header; + UINT8 EpromAddress; + UINT8 Devices; + +} ACPI_ASF_ADDRESS; + + +/******************************************************************************* + * + * BOOT - Simple Boot Flag Table + * Version 1 + * + * Conforms to the "Simple Boot Flag Specification", Version 2.1 + * + ******************************************************************************/ + +typedef struct acpi_table_boot +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT8 CmosIndex; /* Index in CMOS RAM for the boot register */ + UINT8 Reserved[3]; + +} ACPI_TABLE_BOOT; + + +/******************************************************************************* + * + * DBGP - Debug Port table + * Version 1 + * + * Conforms to the "Debug Port Specification", Version 1.00, 2/9/2000 + * + ******************************************************************************/ + +typedef struct acpi_table_dbgp +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT8 Type; /* 0=full 16550, 1=subset of 16550 */ + UINT8 Reserved[3]; + ACPI_GENERIC_ADDRESS DebugPort; + +} ACPI_TABLE_DBGP; + + +/******************************************************************************* + * + * DMAR - DMA Remapping table + * Version 1 + * + * Conforms to "Intel Virtualization Technology for Directed I/O", + * Version 1.2, Sept. 2008 + * + ******************************************************************************/ + +typedef struct acpi_table_dmar +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT8 Width; /* Host Address Width */ + UINT8 Flags; + UINT8 Reserved[10]; + +} ACPI_TABLE_DMAR; + +/* Masks for Flags field above */ + +#define ACPI_DMAR_INTR_REMAP (1) + + +/* DMAR subtable header */ + +typedef struct acpi_dmar_header +{ + UINT16 Type; + UINT16 Length; + +} ACPI_DMAR_HEADER; + +/* Values for subtable type in ACPI_DMAR_HEADER */ + +enum AcpiDmarType +{ + ACPI_DMAR_TYPE_HARDWARE_UNIT = 0, + ACPI_DMAR_TYPE_RESERVED_MEMORY = 1, + ACPI_DMAR_TYPE_ATSR = 2, + ACPI_DMAR_HARDWARE_AFFINITY = 3, + ACPI_DMAR_TYPE_RESERVED = 4 /* 4 and greater are reserved */ +}; + + +/* DMAR Device Scope structure */ + +typedef struct acpi_dmar_device_scope +{ + UINT8 EntryType; + UINT8 Length; + UINT16 Reserved; + UINT8 EnumerationId; + UINT8 Bus; + +} ACPI_DMAR_DEVICE_SCOPE; + +/* Values for EntryType in ACPI_DMAR_DEVICE_SCOPE */ + +enum AcpiDmarScopeType +{ + ACPI_DMAR_SCOPE_TYPE_NOT_USED = 0, + ACPI_DMAR_SCOPE_TYPE_ENDPOINT = 1, + ACPI_DMAR_SCOPE_TYPE_BRIDGE = 2, + ACPI_DMAR_SCOPE_TYPE_IOAPIC = 3, + ACPI_DMAR_SCOPE_TYPE_HPET = 4, + ACPI_DMAR_SCOPE_TYPE_RESERVED = 5 /* 5 and greater are reserved */ +}; + +typedef struct acpi_dmar_pci_path +{ + UINT8 Device; + UINT8 Function; + +} ACPI_DMAR_PCI_PATH; + + +/* + * DMAR Sub-tables, correspond to Type in ACPI_DMAR_HEADER + */ + +/* 0: Hardware Unit Definition */ + +typedef struct acpi_dmar_hardware_unit +{ + ACPI_DMAR_HEADER Header; + UINT8 Flags; + UINT8 Reserved; + UINT16 Segment; + UINT64 Address; /* Register Base Address */ + +} ACPI_DMAR_HARDWARE_UNIT; + +/* Masks for Flags field above */ + +#define ACPI_DMAR_INCLUDE_ALL (1) + + +/* 1: Reserved Memory Defininition */ + +typedef struct acpi_dmar_reserved_memory +{ + ACPI_DMAR_HEADER Header; + UINT16 Reserved; + UINT16 Segment; + UINT64 BaseAddress; /* 4K aligned base address */ + UINT64 EndAddress; /* 4K aligned limit address */ + +} ACPI_DMAR_RESERVED_MEMORY; + +/* Masks for Flags field above */ + +#define ACPI_DMAR_ALLOW_ALL (1) + + +/* 2: Root Port ATS Capability Reporting Structure */ + +typedef struct acpi_dmar_atsr +{ + ACPI_DMAR_HEADER Header; + UINT8 Flags; + UINT8 Reserved; + UINT16 Segment; + +} ACPI_DMAR_ATSR; + +/* Masks for Flags field above */ + +#define ACPI_DMAR_ALL_PORTS (1) + + +/* 3: Remapping Hardware Static Affinity Structure */ + +typedef struct acpi_dmar_rhsa +{ + ACPI_DMAR_HEADER Header; + UINT32 Reserved; + UINT64 BaseAddress; + UINT32 ProximityDomain; + +} ACPI_DMAR_RHSA; + + +/******************************************************************************* + * + * HPET - High Precision Event Timer table + * Version 1 + * + * Conforms to "IA-PC HPET (High Precision Event Timers) Specification", + * Version 1.0a, October 2004 + * + ******************************************************************************/ + +typedef struct acpi_table_hpet +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT32 Id; /* Hardware ID of event timer block */ + ACPI_GENERIC_ADDRESS Address; /* Address of event timer block */ + UINT8 Sequence; /* HPET sequence number */ + UINT16 MinimumTick; /* Main counter min tick, periodic mode */ + UINT8 Flags; + +} ACPI_TABLE_HPET; + +/* Masks for Flags field above */ + +#define ACPI_HPET_PAGE_PROTECT_MASK (3) + +/* Values for Page Protect flags */ + +enum AcpiHpetPageProtect +{ + ACPI_HPET_NO_PAGE_PROTECT = 0, + ACPI_HPET_PAGE_PROTECT4 = 1, + ACPI_HPET_PAGE_PROTECT64 = 2 +}; + + +/******************************************************************************* + * + * IBFT - Boot Firmware Table + * Version 1 + * + * Conforms to "iSCSI Boot Firmware Table (iBFT) as Defined in ACPI 3.0b + * Specification", Version 1.01, March 1, 2007 + * + * Note: It appears that this table is not intended to appear in the RSDT/XSDT. + * Therefore, it is not currently supported by the disassembler. + * + ******************************************************************************/ + +typedef struct acpi_table_ibft +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT8 Reserved[12]; + +} ACPI_TABLE_IBFT; + + +/* IBFT common subtable header */ + +typedef struct acpi_ibft_header +{ + UINT8 Type; + UINT8 Version; + UINT16 Length; + UINT8 Index; + UINT8 Flags; + +} ACPI_IBFT_HEADER; + +/* Values for Type field above */ + +enum AcpiIbftType +{ + ACPI_IBFT_TYPE_NOT_USED = 0, + ACPI_IBFT_TYPE_CONTROL = 1, + ACPI_IBFT_TYPE_INITIATOR = 2, + ACPI_IBFT_TYPE_NIC = 3, + ACPI_IBFT_TYPE_TARGET = 4, + ACPI_IBFT_TYPE_EXTENSIONS = 5, + ACPI_IBFT_TYPE_RESERVED = 6 /* 6 and greater are reserved */ +}; + + +/* IBFT subtables */ + +typedef struct acpi_ibft_control +{ + ACPI_IBFT_HEADER Header; + UINT16 Extensions; + UINT16 InitiatorOffset; + UINT16 Nic0Offset; + UINT16 Target0Offset; + UINT16 Nic1Offset; + UINT16 Target1Offset; + +} ACPI_IBFT_CONTROL; + +typedef struct acpi_ibft_initiator +{ + ACPI_IBFT_HEADER Header; + UINT8 SnsServer[16]; + UINT8 SlpServer[16]; + UINT8 PrimaryServer[16]; + UINT8 SecondaryServer[16]; + UINT16 NameLength; + UINT16 NameOffset; + +} ACPI_IBFT_INITIATOR; + +typedef struct acpi_ibft_nic +{ + ACPI_IBFT_HEADER Header; + UINT8 IpAddress[16]; + UINT8 SubnetMaskPrefix; + UINT8 Origin; + UINT8 Gateway[16]; + UINT8 PrimaryDns[16]; + UINT8 SecondaryDns[16]; + UINT8 Dhcp[16]; + UINT16 Vlan; + UINT8 MacAddress[6]; + UINT16 PciAddress; + UINT16 NameLength; + UINT16 NameOffset; + +} ACPI_IBFT_NIC; + +typedef struct acpi_ibft_target +{ + ACPI_IBFT_HEADER Header; + UINT8 TargetIpAddress[16]; + UINT16 TargetIpSocket; + UINT8 TargetBootLun[8]; + UINT8 ChapType; + UINT8 NicAssociation; + UINT16 TargetNameLength; + UINT16 TargetNameOffset; + UINT16 ChapNameLength; + UINT16 ChapNameOffset; + UINT16 ChapSecretLength; + UINT16 ChapSecretOffset; + UINT16 ReverseChapNameLength; + UINT16 ReverseChapNameOffset; + UINT16 ReverseChapSecretLength; + UINT16 ReverseChapSecretOffset; + +} ACPI_IBFT_TARGET; + + +/******************************************************************************* + * + * IVRS - I/O Virtualization Reporting Structure + * Version 1 + * + * Conforms to "AMD I/O Virtualization Technology (IOMMU) Specification", + * Revision 1.26, February 2009. + * + ******************************************************************************/ + +typedef struct acpi_table_ivrs +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT32 Info; /* Common virtualization info */ + UINT64 Reserved; + +} ACPI_TABLE_IVRS; + +/* Values for Info field above */ + +#define ACPI_IVRS_PHYSICAL_SIZE 0x00007F00 /* 7 bits, physical address size */ +#define ACPI_IVRS_VIRTUAL_SIZE 0x003F8000 /* 7 bits, virtual address size */ +#define ACPI_IVRS_ATS_RESERVED 0x00400000 /* ATS address translation range reserved */ + + +/* IVRS subtable header */ + +typedef struct acpi_ivrs_header +{ + UINT8 Type; /* Subtable type */ + UINT8 Flags; + UINT16 Length; /* Subtable length */ + UINT16 DeviceId; /* ID of IOMMU */ + +} ACPI_IVRS_HEADER; + +/* Values for subtable Type above */ + +enum AcpiIvrsType +{ + ACPI_IVRS_TYPE_HARDWARE = 0x10, + ACPI_IVRS_TYPE_MEMORY1 = 0x20, + ACPI_IVRS_TYPE_MEMORY2 = 0x21, + ACPI_IVRS_TYPE_MEMORY3 = 0x22 +}; + +/* Masks for Flags field above for IVHD subtable */ + +#define ACPI_IVHD_TT_ENABLE (1) +#define ACPI_IVHD_PASS_PW (1<<1) +#define ACPI_IVHD_RES_PASS_PW (1<<2) +#define ACPI_IVHD_ISOC (1<<3) +#define ACPI_IVHD_IOTLB (1<<4) + +/* Masks for Flags field above for IVMD subtable */ + +#define ACPI_IVMD_UNITY (1) +#define ACPI_IVMD_READ (1<<1) +#define ACPI_IVMD_WRITE (1<<2) +#define ACPI_IVMD_EXCLUSION_RANGE (1<<3) + + +/* + * IVRS subtables, correspond to Type in ACPI_IVRS_HEADER + */ + +/* 0x10: I/O Virtualization Hardware Definition Block (IVHD) */ + +typedef struct acpi_ivrs_hardware +{ + ACPI_IVRS_HEADER Header; + UINT16 CapabilityOffset; /* Offset for IOMMU control fields */ + UINT64 BaseAddress; /* IOMMU control registers */ + UINT16 PciSegmentGroup; + UINT16 Info; /* MSI number and unit ID */ + UINT32 Reserved; + +} ACPI_IVRS_HARDWARE; + +/* Masks for Info field above */ + +#define ACPI_IVHD_MSI_NUMBER_MASK 0x001F /* 5 bits, MSI message number */ +#define ACPI_IVHD_UNIT_ID_MASK 0x1F00 /* 5 bits, UnitID */ + + +/* + * Device Entries for IVHD subtable, appear after ACPI_IVRS_HARDWARE structure. + * Upper two bits of the Type field are the (encoded) length of the structure. + * Currently, only 4 and 8 byte entries are defined. 16 and 32 byte entries + * are reserved for future use but not defined. + */ +typedef struct acpi_ivrs_de_header +{ + UINT8 Type; + UINT16 Id; + UINT8 DataSetting; + +} ACPI_IVRS_DE_HEADER; + +/* Length of device entry is in the top two bits of Type field above */ + +#define ACPI_IVHD_ENTRY_LENGTH 0xC0 + +/* Values for device entry Type field above */ + +enum AcpiIvrsDeviceEntryType +{ + /* 4-byte device entries, all use ACPI_IVRS_DEVICE4 */ + + ACPI_IVRS_TYPE_PAD4 = 0, + ACPI_IVRS_TYPE_ALL = 1, + ACPI_IVRS_TYPE_SELECT = 2, + ACPI_IVRS_TYPE_START = 3, + ACPI_IVRS_TYPE_END = 4, + + /* 8-byte device entries */ + + ACPI_IVRS_TYPE_PAD8 = 64, + ACPI_IVRS_TYPE_NOT_USED = 65, + ACPI_IVRS_TYPE_ALIAS_SELECT = 66, /* Uses ACPI_IVRS_DEVICE8A */ + ACPI_IVRS_TYPE_ALIAS_START = 67, /* Uses ACPI_IVRS_DEVICE8A */ + ACPI_IVRS_TYPE_EXT_SELECT = 70, /* Uses ACPI_IVRS_DEVICE8B */ + ACPI_IVRS_TYPE_EXT_START = 71, /* Uses ACPI_IVRS_DEVICE8B */ + ACPI_IVRS_TYPE_SPECIAL = 72 /* Uses ACPI_IVRS_DEVICE8C */ +}; + +/* Values for Data field above */ + +#define ACPI_IVHD_INIT_PASS (1) +#define ACPI_IVHD_EINT_PASS (1<<1) +#define ACPI_IVHD_NMI_PASS (1<<2) +#define ACPI_IVHD_SYSTEM_MGMT (3<<4) +#define ACPI_IVHD_LINT0_PASS (1<<6) +#define ACPI_IVHD_LINT1_PASS (1<<7) + + +/* Types 0-4: 4-byte device entry */ + +typedef struct acpi_ivrs_device4 +{ + ACPI_IVRS_DE_HEADER Header; + +} ACPI_IVRS_DEVICE4; + +/* Types 66-67: 8-byte device entry */ + +typedef struct acpi_ivrs_device8a +{ + ACPI_IVRS_DE_HEADER Header; + UINT8 Reserved1; + UINT16 UsedId; + UINT8 Reserved2; + +} ACPI_IVRS_DEVICE8A; + +/* Types 70-71: 8-byte device entry */ + +typedef struct acpi_ivrs_device8b +{ + ACPI_IVRS_DE_HEADER Header; + UINT32 ExtendedData; + +} ACPI_IVRS_DEVICE8B; + +/* Values for ExtendedData above */ + +#define ACPI_IVHD_ATS_DISABLED (1<<31) + +/* Type 72: 8-byte device entry */ + +typedef struct acpi_ivrs_device8c +{ + ACPI_IVRS_DE_HEADER Header; + UINT8 Handle; + UINT16 UsedId; + UINT8 Variety; + +} ACPI_IVRS_DEVICE8C; + +/* Values for Variety field above */ + +#define ACPI_IVHD_IOAPIC 1 +#define ACPI_IVHD_HPET 2 + + +/* 0x20, 0x21, 0x22: I/O Virtualization Memory Definition Block (IVMD) */ + +typedef struct acpi_ivrs_memory +{ + ACPI_IVRS_HEADER Header; + UINT16 AuxData; + UINT64 Reserved; + UINT64 StartAddress; + UINT64 MemoryLength; + +} ACPI_IVRS_MEMORY; + + +/******************************************************************************* + * + * MCFG - PCI Memory Mapped Configuration table and sub-table + * Version 1 + * + * Conforms to "PCI Firmware Specification", Revision 3.0, June 20, 2005 + * + ******************************************************************************/ + +typedef struct acpi_table_mcfg +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT8 Reserved[8]; + +} ACPI_TABLE_MCFG; + + +/* Subtable */ + +typedef struct acpi_mcfg_allocation +{ + UINT64 Address; /* Base address, processor-relative */ + UINT16 PciSegment; /* PCI segment group number */ + UINT8 StartBusNumber; /* Starting PCI Bus number */ + UINT8 EndBusNumber; /* Final PCI Bus number */ + UINT32 Reserved; + +} ACPI_MCFG_ALLOCATION; + + +/******************************************************************************* + * + * SPCR - Serial Port Console Redirection table + * Version 1 + * + * Conforms to "Serial Port Console Redirection Table", + * Version 1.00, January 11, 2002 + * + ******************************************************************************/ + +typedef struct acpi_table_spcr +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT8 InterfaceType; /* 0=full 16550, 1=subset of 16550 */ + UINT8 Reserved[3]; + ACPI_GENERIC_ADDRESS SerialPort; + UINT8 InterruptType; + UINT8 PcInterrupt; + UINT32 Interrupt; + UINT8 BaudRate; + UINT8 Parity; + UINT8 StopBits; + UINT8 FlowControl; + UINT8 TerminalType; + UINT8 Reserved1; + UINT16 PciDeviceId; + UINT16 PciVendorId; + UINT8 PciBus; + UINT8 PciDevice; + UINT8 PciFunction; + UINT32 PciFlags; + UINT8 PciSegment; + UINT32 Reserved2; + +} ACPI_TABLE_SPCR; + +/* Masks for PciFlags field above */ + +#define ACPI_SPCR_DO_NOT_DISABLE (1) + + +/******************************************************************************* + * + * SPMI - Server Platform Management Interface table + * Version 5 + * + * Conforms to "Intelligent Platform Management Interface Specification + * Second Generation v2.0", Document Revision 1.0, February 12, 2004 with + * June 12, 2009 markup. + * + ******************************************************************************/ + +typedef struct acpi_table_spmi +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT8 InterfaceType; + UINT8 Reserved; /* Must be 1 */ + UINT16 SpecRevision; /* Version of IPMI */ + UINT8 InterruptType; + UINT8 GpeNumber; /* GPE assigned */ + UINT8 Reserved1; + UINT8 PciDeviceFlag; + UINT32 Interrupt; + ACPI_GENERIC_ADDRESS IpmiRegister; + UINT8 PciSegment; + UINT8 PciBus; + UINT8 PciDevice; + UINT8 PciFunction; + UINT8 Reserved2; + +} ACPI_TABLE_SPMI; + +/* Values for InterfaceType above */ + +enum AcpiSpmiInterfaceTypes +{ + ACPI_SPMI_NOT_USED = 0, + ACPI_SPMI_KEYBOARD = 1, + ACPI_SPMI_SMI = 2, + ACPI_SPMI_BLOCK_TRANSFER = 3, + ACPI_SPMI_SMBUS = 4, + ACPI_SPMI_RESERVED = 5 /* 5 and above are reserved */ +}; + + +/******************************************************************************* + * + * TCPA - Trusted Computing Platform Alliance table + * Version 1 + * + * Conforms to "TCG PC Specific Implementation Specification", + * Version 1.1, August 18, 2003 + * + ******************************************************************************/ + +typedef struct acpi_table_tcpa +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT16 Reserved; + UINT32 MaxLogLength; /* Maximum length for the event log area */ + UINT64 LogAddress; /* Address of the event log area */ + +} ACPI_TABLE_TCPA; + + +/******************************************************************************* + * + * UEFI - UEFI Boot optimization Table + * Version 1 + * + * Conforms to "Unified Extensible Firmware Interface Specification", + * Version 2.3, May 8, 2009 + * + ******************************************************************************/ + +typedef struct acpi_table_uefi +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT8 Identifier[16]; /* UUID identifier */ + UINT16 DataOffset; /* Offset of remaining data in table */ + +} ACPI_TABLE_UEFI; + + +/******************************************************************************* + * + * WAET - Windows ACPI Emulated devices Table + * Version 1 + * + * Conforms to "Windows ACPI Emulated Devices Table", version 1.0, April 6, 2009 + * + ******************************************************************************/ + +typedef struct acpi_table_waet +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT32 Flags; + +} ACPI_TABLE_WAET; + +/* Masks for Flags field above */ + +#define ACPI_WAET_RTC_NO_ACK (1) /* RTC requires no int acknowledge */ +#define ACPI_WAET_TIMER_ONE_READ (1<<1) /* PM timer requires only one read */ + + +/******************************************************************************* + * + * WDAT - Watchdog Action Table + * Version 1 + * + * Conforms to "Hardware Watchdog Timers Design Specification", + * Copyright 2006 Microsoft Corporation. + * + ******************************************************************************/ + +typedef struct acpi_table_wdat +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT32 HeaderLength; /* Watchdog Header Length */ + UINT16 PciSegment; /* PCI Segment number */ + UINT8 PciBus; /* PCI Bus number */ + UINT8 PciDevice; /* PCI Device number */ + UINT8 PciFunction; /* PCI Function number */ + UINT8 Reserved[3]; + UINT32 TimerPeriod; /* Period of one timer count (msec) */ + UINT32 MaxCount; /* Maximum counter value supported */ + UINT32 MinCount; /* Minimum counter value */ + UINT8 Flags; + UINT8 Reserved2[3]; + UINT32 Entries; /* Number of watchdog entries that follow */ + +} ACPI_TABLE_WDAT; + +/* Masks for Flags field above */ + +#define ACPI_WDAT_ENABLED (1) +#define ACPI_WDAT_STOPPED 0x80 + + +/* WDAT Instruction Entries (actions) */ + +typedef struct acpi_wdat_entry +{ + UINT8 Action; + UINT8 Instruction; + UINT16 Reserved; + ACPI_GENERIC_ADDRESS RegisterRegion; + UINT32 Value; /* Value used with Read/Write register */ + UINT32 Mask; /* Bitmask required for this register instruction */ + +} ACPI_WDAT_ENTRY; + +/* Values for Action field above */ + +enum AcpiWdatActions +{ + ACPI_WDAT_RESET = 1, + ACPI_WDAT_GET_CURRENT_COUNTDOWN = 4, + ACPI_WDAT_GET_COUNTDOWN = 5, + ACPI_WDAT_SET_COUNTDOWN = 6, + ACPI_WDAT_GET_RUNNING_STATE = 8, + ACPI_WDAT_SET_RUNNING_STATE = 9, + ACPI_WDAT_GET_STOPPED_STATE = 10, + ACPI_WDAT_SET_STOPPED_STATE = 11, + ACPI_WDAT_GET_REBOOT = 16, + ACPI_WDAT_SET_REBOOT = 17, + ACPI_WDAT_GET_SHUTDOWN = 18, + ACPI_WDAT_SET_SHUTDOWN = 19, + ACPI_WDAT_GET_STATUS = 32, + ACPI_WDAT_SET_STATUS = 33, + ACPI_WDAT_ACTION_RESERVED = 34 /* 34 and greater are reserved */ +}; + +/* Values for Instruction field above */ + +enum AcpiWdatInstructions +{ + ACPI_WDAT_READ_VALUE = 0, + ACPI_WDAT_READ_COUNTDOWN = 1, + ACPI_WDAT_WRITE_VALUE = 2, + ACPI_WDAT_WRITE_COUNTDOWN = 3, + ACPI_WDAT_INSTRUCTION_RESERVED = 4, /* 4 and greater are reserved */ + ACPI_WDAT_PRESERVE_REGISTER = 0x80 /* Except for this value */ +}; + + +/******************************************************************************* + * + * WDRT - Watchdog Resource Table + * Version 1 + * + * Conforms to "Watchdog Timer Hardware Requirements for Windows Server 2003", + * Version 1.01, August 28, 2006 + * + ******************************************************************************/ + +typedef struct acpi_table_wdrt +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + ACPI_GENERIC_ADDRESS ControlRegister; + ACPI_GENERIC_ADDRESS CountRegister; + UINT16 PciDeviceId; + UINT16 PciVendorId; + UINT8 PciBus; /* PCI Bus number */ + UINT8 PciDevice; /* PCI Device number */ + UINT8 PciFunction; /* PCI Function number */ + UINT8 PciSegment; /* PCI Segment number */ + UINT16 MaxCount; /* Maximum counter value supported */ + UINT8 Units; + +} ACPI_TABLE_WDRT; + + +/* Reset to default packing */ + +#pragma pack() + +#endif /* __ACTBL2_H__ */ + diff --git a/sys/contrib/dev/acpica/include/actypes.h b/sys/contrib/dev/acpica/include/actypes.h index 8f970d9..8d0d06a 100644 --- a/sys/contrib/dev/acpica/include/actypes.h +++ b/sys/contrib/dev/acpica/include/actypes.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -415,7 +415,7 @@ typedef UINT32 ACPI_PHYSICAL_ADDRESS; /* PM Timer ticks per second (HZ) */ -#define PM_TIMER_FREQUENCY 3579545 +#define PM_TIMER_FREQUENCY 3579545 /******************************************************************************* @@ -470,22 +470,7 @@ typedef union uint64_overlay } UINT64_OVERLAY; -typedef struct uint32_struct -{ - UINT32 Lo; - UINT32 Hi; -} UINT32_STRUCT; - - -/* - * Acpi integer width. In ACPI version 1, integers are 32 bits. In ACPI - * version 2, integers are 64 bits. Note that this pertains to the ACPI integer - * type only, not other integers used in the implementation of the ACPI CA - * subsystem. - */ -typedef UINT64 ACPI_INTEGER; -#define ACPI_INTEGER_MAX ACPI_UINT64_MAX #define ACPI_INTEGER_BIT_SIZE 64 #define ACPI_MAX_DECIMAL_DIGITS 20 /* 2^64 = 18,446,744,073,709,551,616 */ #define ACPI_MAX64_DECIMAL_DIGITS 20 @@ -500,6 +485,19 @@ typedef UINT64 ACPI_INTEGER; #define ACPI_WAIT_FOREVER 0xFFFF /* UINT16, as per ACPI spec */ #define ACPI_DO_NOT_WAIT 0 +/* + * Obsolete: Acpi integer width. In ACPI version 1 (1996), integers are 32 bits. + * In ACPI version 2 (2000) and later, integers are 64 bits. Note that this + * pertains to the ACPI integer type only, not to other integers used in the + * implementation of the ACPICA subsystem. + * + * 01/2010: This type is obsolete and has been removed from the entire ACPICA + * code base. It remains here for compatibility with device drivers that use + * the type. However, it will be removed in the future. + */ +typedef UINT64 ACPI_INTEGER; +#define ACPI_INTEGER_MAX ACPI_UINT64_MAX + /******************************************************************************* * @@ -816,7 +814,8 @@ typedef UINT8 ACPI_ADR_SPACE_TYPE; #define ACPI_ADR_SPACE_SMBUS (ACPI_ADR_SPACE_TYPE) 4 #define ACPI_ADR_SPACE_CMOS (ACPI_ADR_SPACE_TYPE) 5 #define ACPI_ADR_SPACE_PCI_BAR_TARGET (ACPI_ADR_SPACE_TYPE) 6 -#define ACPI_ADR_SPACE_DATA_TABLE (ACPI_ADR_SPACE_TYPE) 7 +#define ACPI_ADR_SPACE_IPMI (ACPI_ADR_SPACE_TYPE) 7 +#define ACPI_ADR_SPACE_DATA_TABLE (ACPI_ADR_SPACE_TYPE) 8 #define ACPI_ADR_SPACE_FIXED_HARDWARE (ACPI_ADR_SPACE_TYPE) 127 @@ -889,7 +888,7 @@ typedef union acpi_object struct { ACPI_OBJECT_TYPE Type; /* ACPI_TYPE_INTEGER */ - ACPI_INTEGER Value; /* The actual number */ + UINT64 Value; /* The actual number */ } Integer; struct @@ -1056,7 +1055,6 @@ void (*ACPI_NOTIFY_HANDLER) ( typedef void (*ACPI_OBJECT_HANDLER) ( ACPI_HANDLE Object, - UINT32 Function, void *Data); typedef @@ -1094,7 +1092,7 @@ ACPI_STATUS (*ACPI_ADR_SPACE_HANDLER) ( UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, - ACPI_INTEGER *Value, + UINT64 *Value, void *HandlerContext, void *RegionContext); @@ -1123,46 +1121,67 @@ ACPI_STATUS (*ACPI_WALK_CALLBACK) ( #define ACPI_INTERRUPT_NOT_HANDLED 0x00 #define ACPI_INTERRUPT_HANDLED 0x01 +/* Length of 32-bit EISAID values when converted back to a string */ + +#define ACPI_EISAID_STRING_SIZE 8 /* Includes null terminator */ -/* Length of _HID, _UID, _CID, and UUID values */ +/* Length of UUID (string) values */ -#define ACPI_DEVICE_ID_LENGTH 0x09 -#define ACPI_MAX_CID_LENGTH 48 #define ACPI_UUID_LENGTH 16 -/* Common string version of device HIDs and UIDs */ + +/* Structures used for device/processor HID, UID, CID */ typedef struct acpi_device_id { - char Value[ACPI_DEVICE_ID_LENGTH]; + UINT32 Length; /* Length of string + null */ + char *String; } ACPI_DEVICE_ID; -/* Common string version of device CIDs */ - -typedef struct acpi_compatible_id +typedef struct acpi_device_id_list { - char Value[ACPI_MAX_CID_LENGTH]; + UINT32 Count; /* Number of IDs in Ids array */ + UINT32 ListSize; /* Size of list, including ID strings */ + ACPI_DEVICE_ID Ids[1]; /* ID array */ -} ACPI_COMPATIBLE_ID; +} ACPI_DEVICE_ID_LIST; -typedef struct acpi_compatible_id_list +/* + * Structure returned from AcpiGetObjectInfo. + * Optimized for both 32- and 64-bit builds + */ +typedef struct acpi_device_info { - UINT32 Count; - UINT32 Size; - ACPI_COMPATIBLE_ID Id[1]; + UINT32 InfoSize; /* Size of info, including ID strings */ + UINT32 Name; /* ACPI object Name */ + ACPI_OBJECT_TYPE Type; /* ACPI object Type */ + UINT8 ParamCount; /* If a method, required parameter count */ + UINT8 Valid; /* Indicates which optional fields are valid */ + UINT8 Flags; /* Miscellaneous info */ + UINT8 HighestDstates[4]; /* _SxD values: 0xFF indicates not valid */ + UINT8 LowestDstates[5]; /* _SxW values: 0xFF indicates not valid */ + UINT32 CurrentStatus; /* _STA value */ + UINT64 Address; /* _ADR value */ + ACPI_DEVICE_ID HardwareId; /* _HID value */ + ACPI_DEVICE_ID UniqueId; /* _UID value */ + ACPI_DEVICE_ID_LIST CompatibleIdList; /* _CID list <must be last> */ -} ACPI_COMPATIBLE_ID_LIST; +} ACPI_DEVICE_INFO; + +/* Values for Flags field above (AcpiGetObjectInfo) */ +#define ACPI_PCI_ROOT_BRIDGE 0x01 -/* Structure and flags for AcpiGetObjectInfo */ +/* Flags for Valid field above (AcpiGetObjectInfo) */ -#define ACPI_VALID_STA 0x0001 -#define ACPI_VALID_ADR 0x0002 -#define ACPI_VALID_HID 0x0004 -#define ACPI_VALID_UID 0x0008 -#define ACPI_VALID_CID 0x0010 -#define ACPI_VALID_SXDS 0x0020 +#define ACPI_VALID_STA 0x01 +#define ACPI_VALID_ADR 0x02 +#define ACPI_VALID_HID 0x04 +#define ACPI_VALID_UID 0x08 +#define ACPI_VALID_CID 0x10 +#define ACPI_VALID_SXDS 0x20 +#define ACPI_VALID_SXWS 0x40 /* Flags for _STA method */ @@ -1174,36 +1193,6 @@ typedef struct acpi_compatible_id_list #define ACPI_STA_BATTERY_PRESENT 0x10 -#define ACPI_COMMON_OBJ_INFO \ - ACPI_OBJECT_TYPE Type; /* ACPI object type */ \ - ACPI_NAME Name /* ACPI object Name */ - - -typedef struct acpi_obj_info_header -{ - ACPI_COMMON_OBJ_INFO; - -} ACPI_OBJ_INFO_HEADER; - - -/* Structure returned from Get Object Info */ - -typedef struct acpi_device_info -{ - ACPI_COMMON_OBJ_INFO; - - UINT32 ParamCount; /* If a method, required parameter count */ - UINT32 Valid; /* Indicates which fields below are valid */ - UINT32 CurrentStatus; /* _STA value */ - ACPI_INTEGER Address; /* _ADR value if any */ - ACPI_DEVICE_ID HardwareId; /* _HID value if any */ - ACPI_DEVICE_ID UniqueId; /* _UID value if any */ - UINT8 HighestDstates[4]; /* _SxD values: 0xFF indicates not valid */ - ACPI_COMPATIBLE_ID_LIST CompatibilityId; /* List of _CIDs if any */ - -} ACPI_DEVICE_INFO; - - /* Context structs for address space handlers */ typedef struct acpi_pci_id @@ -1215,7 +1204,6 @@ typedef struct acpi_pci_id } ACPI_PCI_ID; - typedef struct acpi_mem_space_context { UINT32 Length; diff --git a/sys/contrib/dev/acpica/include/acutils.h b/sys/contrib/dev/acpica/include/acutils.h index 5573754..ae406c3 100644 --- a/sys/contrib/dev/acpica/include/acutils.h +++ b/sys/contrib/dev/acpica/include/acutils.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -235,7 +235,7 @@ AcpiUtGetEventName ( char AcpiUtHexToAsciiChar ( - ACPI_INTEGER Integer, + UINT64 Integer, UINT32 Position); BOOLEAN @@ -470,7 +470,7 @@ AcpiUtValueExit ( const char *FunctionName, const char *ModuleName, UINT32 ComponentId, - ACPI_INTEGER Value); + UINT64 Value); void AcpiUtPtrExit ( @@ -550,32 +550,39 @@ ACPI_STATUS AcpiUtEvaluateNumericObject ( char *ObjectName, ACPI_NAMESPACE_NODE *DeviceNode, - ACPI_INTEGER *Address); + UINT64 *Value); ACPI_STATUS -AcpiUtExecute_HID ( +AcpiUtExecute_STA ( ACPI_NAMESPACE_NODE *DeviceNode, - ACPI_DEVICE_ID *Hid); + UINT32 *StatusFlags); ACPI_STATUS -AcpiUtExecute_CID ( +AcpiUtExecutePowerMethods ( ACPI_NAMESPACE_NODE *DeviceNode, - ACPI_COMPATIBLE_ID_LIST **ReturnCidList); + const char **MethodNames, + UINT8 MethodCount, + UINT8 *OutValues); + +/* + * utids - device ID support + */ ACPI_STATUS -AcpiUtExecute_STA ( +AcpiUtExecute_HID ( ACPI_NAMESPACE_NODE *DeviceNode, - UINT32 *StatusFlags); + ACPI_DEVICE_ID **ReturnId); ACPI_STATUS AcpiUtExecute_UID ( ACPI_NAMESPACE_NODE *DeviceNode, - ACPI_DEVICE_ID *Uid); + ACPI_DEVICE_ID **ReturnId); ACPI_STATUS -AcpiUtExecute_Sxds ( +AcpiUtExecute_CID ( ACPI_NAMESPACE_NODE *DeviceNode, - UINT8 *Highest); + ACPI_DEVICE_ID_LIST **ReturnCidList); + /* * utlock - reader/writer locks @@ -637,6 +644,10 @@ AcpiUtCreatePackageObject ( UINT32 Count); ACPI_OPERAND_OBJECT * +AcpiUtCreateIntegerObject ( + UINT64 Value); + +ACPI_OPERAND_OBJECT * AcpiUtCreateBufferObject ( ACPI_SIZE BufferSize); @@ -709,16 +720,16 @@ AcpiUtDeleteGenericState ( */ ACPI_STATUS AcpiUtDivide ( - ACPI_INTEGER InDividend, - ACPI_INTEGER InDivisor, - ACPI_INTEGER *OutQuotient, - ACPI_INTEGER *OutRemainder); + UINT64 InDividend, + UINT64 InDivisor, + UINT64 *OutQuotient, + UINT64 *OutRemainder); ACPI_STATUS AcpiUtShortDivide ( - ACPI_INTEGER InDividend, + UINT64 InDividend, UINT32 Divisor, - ACPI_INTEGER *OutQuotient, + UINT64 *OutQuotient, UINT32 *OutRemainder); /* @@ -729,6 +740,10 @@ AcpiUtValidateException ( ACPI_STATUS Status); BOOLEAN +AcpiUtIsPciRootBridge ( + char *Id); + +BOOLEAN AcpiUtIsAmlTable ( ACPI_TABLE_HEADER *Table); @@ -773,7 +788,25 @@ ACPI_STATUS AcpiUtStrtoul64 ( char *String, UINT32 Base, - ACPI_INTEGER *RetInteger); + UINT64 *RetInteger); + +void ACPI_INTERNAL_VAR_XFACE +AcpiUtPredefinedWarning ( + const char *ModuleName, + UINT32 LineNumber, + char *Pathname, + UINT8 NodeFlags, + const char *Format, + ...); + +void ACPI_INTERNAL_VAR_XFACE +AcpiUtPredefinedInfo ( + const char *ModuleName, + UINT32 LineNumber, + char *Pathname, + UINT8 NodeFlags, + const char *Format, + ...); /* Values for Base above (16=Hex, 10=Decimal) */ diff --git a/sys/contrib/dev/acpica/include/amlcode.h b/sys/contrib/dev/acpica/include/amlcode.h index 7694acc..d6fc7d0 100644 --- a/sys/contrib/dev/acpica/include/amlcode.h +++ b/sys/contrib/dev/acpica/include/amlcode.h @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -485,6 +485,7 @@ typedef enum REGION_SMBUS, REGION_CMOS, REGION_PCI_BAR, + REGION_IPMI, REGION_DATA_TABLE, /* Internal use only */ REGION_FIXED_HW = 0x7F diff --git a/sys/contrib/dev/acpica/include/amlresrc.h b/sys/contrib/dev/acpica/include/amlresrc.h index 689564c..9084e44 100644 --- a/sys/contrib/dev/acpica/include/amlresrc.h +++ b/sys/contrib/dev/acpica/include/amlresrc.h @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/include/platform/acenv.h b/sys/contrib/dev/acpica/include/platform/acenv.h index 7756fb7..b9ef33f 100644 --- a/sys/contrib/dev/acpica/include/platform/acenv.h +++ b/sys/contrib/dev/acpica/include/platform/acenv.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -262,11 +262,11 @@ /* Global Lock acquire/release */ #ifndef ACPI_ACQUIRE_GLOBAL_LOCK -#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) Acq = 1 +#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acquired) Acquired = 1 #endif #ifndef ACPI_RELEASE_GLOBAL_LOCK -#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) Acq = 0 +#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Pending) Pending = 0 #endif /* Flush CPU cache - used when going to sleep. Wbinvd or similar. */ @@ -424,8 +424,8 @@ typedef char *va_list; #define ACPI_MEMCMP(s1,s2,n) AcpiUtMemcmp((const char *)(s1), (const char *)(s2), (ACPI_SIZE)(n)) #define ACPI_MEMCPY(d,s,n) (void) AcpiUtMemcpy ((d), (s), (ACPI_SIZE)(n)) #define ACPI_MEMSET(d,v,n) (void) AcpiUtMemset ((d), (v), (ACPI_SIZE)(n)) -#define ACPI_TOUPPER AcpiUtToUpper -#define ACPI_TOLOWER AcpiUtToLower +#define ACPI_TOUPPER(c) AcpiUtToUpper ((int) (c)) +#define ACPI_TOLOWER(c) AcpiUtToLower ((int) (c)) #endif /* ACPI_USE_SYSTEM_CLIBRARY */ diff --git a/sys/contrib/dev/acpica/include/platform/acfreebsd.h b/sys/contrib/dev/acpica/include/platform/acfreebsd.h index 8fea3cf..20ec3a2 100644 --- a/sys/contrib/dev/acpica/include/platform/acfreebsd.h +++ b/sys/contrib/dev/acpica/include/platform/acfreebsd.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/include/platform/acgcc.h b/sys/contrib/dev/acpica/include/platform/acgcc.h index 4499422..d0098b1 100644 --- a/sys/contrib/dev/acpica/include/platform/acgcc.h +++ b/sys/contrib/dev/acpica/include/platform/acgcc.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/namespace/nsaccess.c b/sys/contrib/dev/acpica/namespace/nsaccess.c index b7bc11c..e360e28 100644 --- a/sys/contrib/dev/acpica/namespace/nsaccess.c +++ b/sys/contrib/dev/acpica/namespace/nsaccess.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -251,7 +251,7 @@ AcpiNsRootInitialize ( /* Mark this as a very SPECIAL method */ ObjDesc->Method.MethodFlags = AML_METHOD_INTERNAL_ONLY; - ObjDesc->Method.Implementation = AcpiUtOsiImplementation; + ObjDesc->Method.Extra.Implementation = AcpiUtOsiImplementation; #endif break; diff --git a/sys/contrib/dev/acpica/namespace/nsalloc.c b/sys/contrib/dev/acpica/namespace/nsalloc.c index be8e1ff..222977a 100644 --- a/sys/contrib/dev/acpica/namespace/nsalloc.c +++ b/sys/contrib/dev/acpica/namespace/nsalloc.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -181,7 +181,10 @@ AcpiNsCreateNode ( * * RETURN: None * - * DESCRIPTION: Delete a namespace node + * DESCRIPTION: Delete a namespace node. All node deletions must come through + * here. Detaches any attached objects, including any attached + * data. If a handler is associated with attached data, it is + * invoked before the node is deleted. * ******************************************************************************/ @@ -189,12 +192,67 @@ void AcpiNsDeleteNode ( ACPI_NAMESPACE_NODE *Node) { + ACPI_OPERAND_OBJECT *ObjDesc; + + + ACPI_FUNCTION_NAME (NsDeleteNode); + + + /* Detach an object if there is one */ + + AcpiNsDetachObject (Node); + + /* + * Delete an attached data object if present (an object that was created + * and attached via AcpiAttachData). Note: After any normal object is + * detached above, the only possible remaining object is a data object. + */ + ObjDesc = Node->Object; + if (ObjDesc && + (ObjDesc->Common.Type == ACPI_TYPE_LOCAL_DATA)) + { + /* Invoke the attached data deletion handler if present */ + + if (ObjDesc->Data.Handler) + { + ObjDesc->Data.Handler (Node, ObjDesc->Data.Pointer); + } + + AcpiUtRemoveReference (ObjDesc); + } + + /* Now we can delete the node */ + + (void) AcpiOsReleaseObject (AcpiGbl_NamespaceCache, Node); + + ACPI_MEM_TRACKING (AcpiGbl_NsNodeList->TotalFreed++); + ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Node %p, Remaining %X\n", + Node, AcpiGbl_CurrentNodeCount)); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiNsRemoveNode + * + * PARAMETERS: Node - Node to be removed/deleted + * + * RETURN: None + * + * DESCRIPTION: Remove (unlink) and delete a namespace node + * + ******************************************************************************/ + +void +AcpiNsRemoveNode ( + ACPI_NAMESPACE_NODE *Node) +{ ACPI_NAMESPACE_NODE *ParentNode; ACPI_NAMESPACE_NODE *PrevNode; ACPI_NAMESPACE_NODE *NextNode; - ACPI_FUNCTION_TRACE_PTR (NsDeleteNode, Node); + ACPI_FUNCTION_TRACE_PTR (NsRemoveNode, Node); ParentNode = AcpiNsGetParentNode (Node); @@ -237,12 +295,9 @@ AcpiNsDeleteNode ( } } - ACPI_MEM_TRACKING (AcpiGbl_NsNodeList->TotalFreed++); - - /* Detach an object if there is one, then delete the node */ + /* Delete the node and any attached objects */ - AcpiNsDetachObject (Node); - (void) AcpiOsReleaseObject (AcpiGbl_NamespaceCache, Node); + AcpiNsDeleteNode (Node); return_VOID; } @@ -385,23 +440,11 @@ AcpiNsDeleteChildren ( ParentNode, ChildNode)); } - /* Now we can free this child object */ - - ACPI_MEM_TRACKING (AcpiGbl_NsNodeList->TotalFreed++); - - ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Object %p, Remaining %X\n", - ChildNode, AcpiGbl_CurrentNodeCount)); - - /* Detach an object if there is one, then free the child node */ - - AcpiNsDetachObject (ChildNode); - - /* Now we can delete the node */ - - (void) AcpiOsReleaseObject (AcpiGbl_NamespaceCache, ChildNode); - - /* And move on to the next child in the list */ - + /* + * Delete this child node and move on to the next child in the list. + * No need to unlink the node since we are deleting the entire branch. + */ + AcpiNsDeleteNode (ChildNode); ChildNode = NextNode; } while (!(Flags & ANOBJ_END_OF_PEER_LIST)); @@ -561,7 +604,7 @@ AcpiNsDeleteNamespaceByOwner ( if (DeletionNode) { AcpiNsDeleteChildren (DeletionNode); - AcpiNsDeleteNode (DeletionNode); + AcpiNsRemoveNode (DeletionNode); DeletionNode = NULL; } diff --git a/sys/contrib/dev/acpica/namespace/nsdump.c b/sys/contrib/dev/acpica/namespace/nsdump.c index 78b083f..a1ae96e 100644 --- a/sys/contrib/dev/acpica/namespace/nsdump.c +++ b/sys/contrib/dev/acpica/namespace/nsdump.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -286,7 +286,7 @@ AcpiNsDumpOneObject ( return (AE_OK); } - ThisNode = AcpiNsMapHandleToNode (ObjHandle); + ThisNode = AcpiNsValidateHandle (ObjHandle); if (!ThisNode) { ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Invalid object handle %p\n", @@ -736,7 +736,7 @@ AcpiNsDumpObjects ( (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth, ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES, - AcpiNsDumpOneObject, (void *) &Info, NULL); + AcpiNsDumpOneObject, NULL, (void *) &Info, NULL); } diff --git a/sys/contrib/dev/acpica/namespace/nsdumpdv.c b/sys/contrib/dev/acpica/namespace/nsdumpdv.c index ade6656..5dc6128 100644 --- a/sys/contrib/dev/acpica/namespace/nsdumpdv.c +++ b/sys/contrib/dev/acpica/namespace/nsdumpdv.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -225,7 +225,7 @@ AcpiNsDumpRootDevices ( Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, SysBusHandle, ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, - AcpiNsDumpOneDevice, NULL, NULL); + AcpiNsDumpOneDevice, NULL, NULL, NULL); } #endif diff --git a/sys/contrib/dev/acpica/namespace/nseval.c b/sys/contrib/dev/acpica/namespace/nseval.c index a1fe087..3d4926c 100644 --- a/sys/contrib/dev/acpica/namespace/nseval.c +++ b/sys/contrib/dev/acpica/namespace/nseval.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -126,6 +126,13 @@ #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME ("nseval") +/* Local prototypes */ + +static void +AcpiNsExecModuleCode ( + ACPI_OPERAND_OBJECT *MethodObj, + ACPI_EVALUATE_INFO *Info); + /******************************************************************************* * @@ -360,3 +367,192 @@ AcpiNsEvaluate ( return_ACPI_STATUS (Status); } + +/******************************************************************************* + * + * FUNCTION: AcpiNsExecModuleCodeList + * + * PARAMETERS: None + * + * RETURN: None. Exceptions during method execution are ignored, since + * we cannot abort a table load. + * + * DESCRIPTION: Execute all elements of the global module-level code list. + * Each element is executed as a single control method. + * + ******************************************************************************/ + +void +AcpiNsExecModuleCodeList ( + void) +{ + ACPI_OPERAND_OBJECT *Prev; + ACPI_OPERAND_OBJECT *Next; + ACPI_EVALUATE_INFO *Info; + UINT32 MethodCount = 0; + + + ACPI_FUNCTION_TRACE (NsExecModuleCodeList); + + + /* Exit now if the list is empty */ + + Next = AcpiGbl_ModuleCodeList; + if (!Next) + { + return_VOID; + } + + /* Allocate the evaluation information block */ + + Info = ACPI_ALLOCATE (sizeof (ACPI_EVALUATE_INFO)); + if (!Info) + { + return_VOID; + } + + /* Walk the list, executing each "method" */ + + while (Next) + { + Prev = Next; + Next = Next->Method.Mutex; + + /* Clear the link field and execute the method */ + + Prev->Method.Mutex = NULL; + AcpiNsExecModuleCode (Prev, Info); + MethodCount++; + + /* Delete the (temporary) method object */ + + AcpiUtRemoveReference (Prev); + } + + ACPI_INFO ((AE_INFO, + "Executed %u blocks of module-level executable AML code", + MethodCount)); + + ACPI_FREE (Info); + AcpiGbl_ModuleCodeList = NULL; + return_VOID; +} + + +/******************************************************************************* + * + * FUNCTION: AcpiNsExecModuleCode + * + * PARAMETERS: MethodObj - Object container for the module-level code + * Info - Info block for method evaluation + * + * RETURN: None. Exceptions during method execution are ignored, since + * we cannot abort a table load. + * + * DESCRIPTION: Execute a control method containing a block of module-level + * executable AML code. The control method is temporarily + * installed to the root node, then evaluated. + * + ******************************************************************************/ + +static void +AcpiNsExecModuleCode ( + ACPI_OPERAND_OBJECT *MethodObj, + ACPI_EVALUATE_INFO *Info) +{ + ACPI_OPERAND_OBJECT *ParentObj; + ACPI_NAMESPACE_NODE *ParentNode; + ACPI_OBJECT_TYPE Type; + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (NsExecModuleCode); + + + /* + * Get the parent node. We cheat by using the NextObject field + * of the method object descriptor. + */ + ParentNode = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, + MethodObj->Method.NextObject); + Type = AcpiNsGetType (ParentNode); + + /* + * Get the region handler and save it in the method object. We may need + * this if an operation region declaration causes a _REG method to be run. + * + * We can't do this in AcpiPsLinkModuleCode because + * AcpiGbl_RootNode->Object is NULL at PASS1. + */ + if ((Type == ACPI_TYPE_DEVICE) && ParentNode->Object) + { + MethodObj->Method.Extra.Handler = + ParentNode->Object->Device.Handler; + } + + /* Must clear NextObject (AcpiNsAttachObject needs the field) */ + + MethodObj->Method.NextObject = NULL; + + /* Initialize the evaluation information block */ + + ACPI_MEMSET (Info, 0, sizeof (ACPI_EVALUATE_INFO)); + Info->PrefixNode = ParentNode; + + /* + * Get the currently attached parent object. Add a reference, because the + * ref count will be decreased when the method object is installed to + * the parent node. + */ + ParentObj = AcpiNsGetAttachedObject (ParentNode); + if (ParentObj) + { + AcpiUtAddReference (ParentObj); + } + + /* Install the method (module-level code) in the parent node */ + + Status = AcpiNsAttachObject (ParentNode, MethodObj, + ACPI_TYPE_METHOD); + if (ACPI_FAILURE (Status)) + { + goto Exit; + } + + /* Execute the parent node as a control method */ + + Status = AcpiNsEvaluate (Info); + + ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "Executed module-level code at %p\n", + MethodObj->Method.AmlStart)); + + /* Delete a possible implicit return value (in slack mode) */ + + if (Info->ReturnObject) + { + AcpiUtRemoveReference (Info->ReturnObject); + } + + /* Detach the temporary method object */ + + AcpiNsDetachObject (ParentNode); + + /* Restore the original parent object */ + + if (ParentObj) + { + Status = AcpiNsAttachObject (ParentNode, ParentObj, Type); + } + else + { + ParentNode->Type = (UINT8) Type; + } + +Exit: + if (ParentObj) + { + AcpiUtRemoveReference (ParentObj); + } + return_VOID; +} + diff --git a/sys/contrib/dev/acpica/namespace/nsinit.c b/sys/contrib/dev/acpica/namespace/nsinit.c index 3869fc9..5dfb23e 100644 --- a/sys/contrib/dev/acpica/namespace/nsinit.c +++ b/sys/contrib/dev/acpica/namespace/nsinit.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -185,7 +185,7 @@ AcpiNsInitializeObjects ( /* Walk entire namespace from the supplied root */ Status = AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, AcpiNsInitOneObject, + ACPI_UINT32_MAX, AcpiNsInitOneObject, NULL, &Info, NULL); if (ACPI_FAILURE (Status)) { @@ -249,7 +249,7 @@ AcpiNsInitializeDevices ( /* Tree analysis: find all subtrees that contain _INI methods */ Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, FALSE, AcpiNsFindIniMethods, &Info, NULL); + ACPI_UINT32_MAX, FALSE, AcpiNsFindIniMethods, NULL, &Info, NULL); if (ACPI_FAILURE (Status)) { goto ErrorExit; @@ -264,10 +264,26 @@ AcpiNsInitializeDevices ( goto ErrorExit; } + /* + * Execute the "global" _INI method that may appear at the root. This + * support is provided for Windows compatibility (Vista+) and is not + * part of the ACPI specification. + */ + Info.EvaluateInfo->PrefixNode = AcpiGbl_RootNode; + Info.EvaluateInfo->Pathname = METHOD_NAME__INI; + Info.EvaluateInfo->Parameters = NULL; + Info.EvaluateInfo->Flags = ACPI_IGNORE_RETURN_VALUE; + + Status = AcpiNsEvaluate (Info.EvaluateInfo); + if (ACPI_SUCCESS (Status)) + { + Info.Num_INI++; + } + /* Walk namespace to execute all _INIs on present devices */ Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, FALSE, AcpiNsInitOneDevice, &Info, NULL); + ACPI_UINT32_MAX, FALSE, AcpiNsInitOneDevice, NULL, &Info, NULL); ACPI_FREE (Info.EvaluateInfo); if (ACPI_FAILURE (Status)) diff --git a/sys/contrib/dev/acpica/namespace/nsload.c b/sys/contrib/dev/acpica/namespace/nsload.c index 2a5e36a..7d67c5b 100644 --- a/sys/contrib/dev/acpica/namespace/nsload.c +++ b/sys/contrib/dev/acpica/namespace/nsload.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -376,8 +376,7 @@ AcpiNsDeleteSubtree ( /* Now delete the starting object, and we are done */ - AcpiNsDeleteNode (ChildHandle); - + AcpiNsRemoveNode (ChildHandle); return_ACPI_STATUS (AE_OK); } diff --git a/sys/contrib/dev/acpica/namespace/nsnames.c b/sys/contrib/dev/acpica/namespace/nsnames.c index c299d7e..c23e6de 100644 --- a/sys/contrib/dev/acpica/namespace/nsnames.c +++ b/sys/contrib/dev/acpica/namespace/nsnames.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -337,7 +337,7 @@ AcpiNsHandleToPathname ( ACPI_FUNCTION_TRACE_PTR (NsHandleToPathname, TargetHandle); - Node = AcpiNsMapHandleToNode (TargetHandle); + Node = AcpiNsValidateHandle (TargetHandle); if (!Node) { return_ACPI_STATUS (AE_BAD_PARAMETER); diff --git a/sys/contrib/dev/acpica/namespace/nsobject.c b/sys/contrib/dev/acpica/namespace/nsobject.c index cb84825..ca7f7a4 100644 --- a/sys/contrib/dev/acpica/namespace/nsobject.c +++ b/sys/contrib/dev/acpica/namespace/nsobject.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/namespace/nsparse.c b/sys/contrib/dev/acpica/namespace/nsparse.c index efa0188..8c71b80 100644 --- a/sys/contrib/dev/acpica/namespace/nsparse.c +++ b/sys/contrib/dev/acpica/namespace/nsparse.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/namespace/nspredef.c b/sys/contrib/dev/acpica/namespace/nspredef.c index 30a6609..48cf8fe 100644 --- a/sys/contrib/dev/acpica/namespace/nspredef.c +++ b/sys/contrib/dev/acpica/namespace/nspredef.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -113,7 +113,7 @@ * *****************************************************************************/ -#define __NSPREDEF_C__ +#define ACPI_CREATE_PREDEFINED_TABLE #include <contrib/dev/acpica/include/acpi.h> #include <contrib/dev/acpica/include/accommon.h> @@ -146,17 +146,24 @@ * ******************************************************************************/ + /* Local prototypes */ static ACPI_STATUS AcpiNsCheckPackage ( - char *Pathname, - ACPI_OPERAND_OBJECT **ReturnObjectPtr, - const ACPI_PREDEFINED_INFO *Predefined); + ACPI_PREDEFINED_DATA *Data, + ACPI_OPERAND_OBJECT **ReturnObjectPtr); + +static ACPI_STATUS +AcpiNsCheckPackageList ( + ACPI_PREDEFINED_DATA *Data, + const ACPI_PREDEFINED_INFO *Package, + ACPI_OPERAND_OBJECT **Elements, + UINT32 Count); static ACPI_STATUS AcpiNsCheckPackageElements ( - char *Pathname, + ACPI_PREDEFINED_DATA *Data, ACPI_OPERAND_OBJECT **Elements, UINT8 Type1, UINT32 Count1, @@ -166,21 +173,20 @@ AcpiNsCheckPackageElements ( static ACPI_STATUS AcpiNsCheckObjectType ( - char *Pathname, + ACPI_PREDEFINED_DATA *Data, ACPI_OPERAND_OBJECT **ReturnObjectPtr, UINT32 ExpectedBtypes, UINT32 PackageIndex); static ACPI_STATUS AcpiNsCheckReference ( - char *Pathname, + ACPI_PREDEFINED_DATA *Data, ACPI_OPERAND_OBJECT *ReturnObject); -static ACPI_STATUS -AcpiNsRepairObject ( - UINT32 ExpectedBtypes, - UINT32 PackageIndex, - ACPI_OPERAND_OBJECT **ReturnObjectPtr); +static void +AcpiNsGetExpectedTypes ( + char *Buffer, + UINT32 ExpectedBtypes); /* * Names for the types that can be returned by the predefined objects. @@ -195,14 +201,14 @@ static const char *AcpiRtypeNames[] = "/Reference", }; -#define ACPI_NOT_PACKAGE ACPI_UINT32_MAX - /******************************************************************************* * * FUNCTION: AcpiNsCheckPredefinedNames * * PARAMETERS: Node - Namespace node for the method/object + * UserParamCount - Number of parameters actually passed + * ReturnStatus - Status from the object evaluation * ReturnObjectPtr - Pointer to the object returned from the * evaluation of a method or object * @@ -223,13 +229,14 @@ AcpiNsCheckPredefinedNames ( ACPI_STATUS Status = AE_OK; const ACPI_PREDEFINED_INFO *Predefined; char *Pathname; + ACPI_PREDEFINED_DATA *Data; /* Match the name for this method/object against the predefined list */ Predefined = AcpiNsCheckForPredefinedName (Node); - /* Get the full pathname to the object, for use in error messages */ + /* Get the full pathname to the object, for use in warning messages */ Pathname = AcpiNsGetExternalPathname (Node); if (!Pathname) @@ -248,30 +255,18 @@ AcpiNsCheckPredefinedNames ( if (!Predefined) { - goto Exit; - } - - /* If the method failed, we cannot validate the return object */ - - if ((ReturnStatus != AE_OK) && (ReturnStatus != AE_CTRL_RETURN_VALUE)) - { - goto Exit; + goto Cleanup; } /* - * Only validate the return value on the first successful evaluation of - * the method. This ensures that any warnings will only be emitted during - * the very first evaluation of the method/object. + * If the method failed or did not actually return an object, we cannot + * validate the return object */ - if (Node->Flags & ANOBJ_EVALUATED) + if ((ReturnStatus != AE_OK) && (ReturnStatus != AE_CTRL_RETURN_VALUE)) { - goto Exit; + goto Cleanup; } - /* Mark the node as having been successfully evaluated */ - - Node->Flags |= ANOBJ_EVALUATED; - /* * 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, @@ -284,45 +279,87 @@ AcpiNsCheckPredefinedNames ( if ((Predefined->Info.ExpectedBtypes) && (!(Predefined->Info.ExpectedBtypes & ACPI_RTYPE_NONE))) { - ACPI_ERROR ((AE_INFO, - "%s: Missing expected return value", Pathname)); + ACPI_WARN_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS, + "Missing expected return value")); Status = AE_AML_NO_RETURN_VALUE; } - goto Exit; + goto Cleanup; } /* - * We have a return value, but if one wasn't expected, just exit, this is - * not a problem + * 1) We have a return value, but if one wasn't expected, just exit, this is + * not a problem. For example, if the "Implicit Return" feature is + * enabled, methods will always return a value. * - * For example, if the "Implicit Return" feature is enabled, methods will - * always return a value + * 2) If the return value can be of any type, then we cannot perform any + * validation, exit. */ - if (!Predefined->Info.ExpectedBtypes) + if ((!Predefined->Info.ExpectedBtypes) || + (Predefined->Info.ExpectedBtypes == ACPI_RTYPE_ALL)) { - goto Exit; + goto Cleanup; + } + + /* Create the parameter data block for object validation */ + + Data = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_PREDEFINED_DATA)); + if (!Data) + { + goto Cleanup; } + Data->Predefined = Predefined; + Data->NodeFlags = Node->Flags; + Data->Pathname = Pathname; /* - * Check that the type of the return object is what is expected for - * this predefined name + * Check that the type of the main return object is what is expected + * for this predefined name */ - Status = AcpiNsCheckObjectType (Pathname, ReturnObjectPtr, - Predefined->Info.ExpectedBtypes, ACPI_NOT_PACKAGE); + Status = AcpiNsCheckObjectType (Data, ReturnObjectPtr, + Predefined->Info.ExpectedBtypes, ACPI_NOT_PACKAGE_ELEMENT); if (ACPI_FAILURE (Status)) { goto Exit; } - /* For returned Package objects, check the type of all sub-objects */ - - if (ReturnObject->Common.Type == ACPI_TYPE_PACKAGE) + /* + * For returned Package objects, check the type of all sub-objects. + * Note: Package may have been newly created by call above. + */ + if ((*ReturnObjectPtr)->Common.Type == ACPI_TYPE_PACKAGE) { - Status = AcpiNsCheckPackage (Pathname, ReturnObjectPtr, Predefined); + Data->ParentPackage = *ReturnObjectPtr; + Status = AcpiNsCheckPackage (Data, ReturnObjectPtr); + if (ACPI_FAILURE (Status)) + { + goto Exit; + } } + /* + * The return object was OK, or it was successfully repaired above. + * Now make some additional checks such as verifying that package + * objects are sorted correctly (if required) or buffer objects have + * the correct data width (bytes vs. dwords). These repairs are + * performed on a per-name basis, i.e., the code is specific to + * particular predefined names. + */ + Status = AcpiNsComplexRepairs (Data, Node, Status, ReturnObjectPtr); + Exit: + /* + * If the object validation failed or if we successfully repaired one + * or more objects, mark the parent node to suppress further warning + * messages during the next evaluation of the same method/object. + */ + if (ACPI_FAILURE (Status) || (Data->Flags & ACPI_OBJECT_REPAIRED)) + { + Node->Flags |= ANOBJ_EVALUATED; + } + ACPI_FREE (Data); + +Cleanup: ACPI_FREE (Pathname); return (Status); } @@ -365,11 +402,11 @@ AcpiNsCheckParameterCount ( ParamCount = Node->Object->Method.ParamCount; } - /* Argument count check for non-predefined methods/objects */ - if (!Predefined) { /* + * Check the parameter count for non-predefined methods/objects. + * * Warning if too few or too many arguments have been passed by the * caller. An incorrect number of arguments may not cause the method * to fail. However, the method will fail if there are too few @@ -377,58 +414,49 @@ AcpiNsCheckParameterCount ( */ if (UserParamCount < ParamCount) { - ACPI_WARNING ((AE_INFO, - "%s: Insufficient arguments - needs %d, found %d", - Pathname, ParamCount, UserParamCount)); + ACPI_WARN_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS, + "Insufficient arguments - needs %u, found %u", + ParamCount, UserParamCount)); } else if (UserParamCount > ParamCount) { - ACPI_WARNING ((AE_INFO, - "%s: Excess arguments - needs %d, found %d", - Pathname, ParamCount, UserParamCount)); + ACPI_WARN_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS, + "Excess arguments - needs %u, found %u", + ParamCount, UserParamCount)); } return; } - /* Allow two different legal argument counts (_SCP, etc.) */ - + /* + * Validate the user-supplied parameter count. + * Allow two different legal argument counts (_SCP, etc.) + */ RequiredParamsCurrent = Predefined->Info.ParamCount & 0x0F; RequiredParamsOld = Predefined->Info.ParamCount >> 4; if (UserParamCount != ACPI_UINT32_MAX) { - /* Validate the user-supplied parameter count */ - if ((UserParamCount != RequiredParamsCurrent) && (UserParamCount != RequiredParamsOld)) { - ACPI_WARNING ((AE_INFO, - "%s: Parameter count mismatch - " - "caller passed %d, ACPI requires %d", - Pathname, UserParamCount, RequiredParamsCurrent)); + ACPI_WARN_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS, + "Parameter count mismatch - " + "caller passed %u, ACPI requires %u", + UserParamCount, RequiredParamsCurrent)); } } /* - * Only validate the argument count on the first successful evaluation of - * the method. This ensures that any warnings will only be emitted during - * the very first evaluation of the method/object. - */ - if (Node->Flags & ANOBJ_EVALUATED) - { - return; - } - - /* * Check that the ASL-defined parameter count is what is expected for - * this predefined name. + * this predefined name (parameter count as defined by the ACPI + * specification) */ if ((ParamCount != RequiredParamsCurrent) && (ParamCount != RequiredParamsOld)) { - ACPI_WARNING ((AE_INFO, - "%s: Parameter count mismatch - ASL declared %d, ACPI requires %d", - Pathname, ParamCount, RequiredParamsCurrent)); + ACPI_WARN_PREDEFINED ((AE_INFO, Pathname, Node->Flags, + "Parameter count mismatch - ASL declared %u, ACPI requires %u", + ParamCount, RequiredParamsCurrent)); } } @@ -466,8 +494,6 @@ AcpiNsCheckForPredefinedName ( { if (ACPI_COMPARE_NAME (Node->Name.Ascii, ThisName->Info.Name)) { - /* Return pointer to this table entry */ - return (ThisName); } @@ -483,7 +509,7 @@ AcpiNsCheckForPredefinedName ( ThisName++; } - return (NULL); + return (NULL); /* Not found */ } @@ -491,10 +517,9 @@ AcpiNsCheckForPredefinedName ( * * FUNCTION: AcpiNsCheckPackage * - * PARAMETERS: Pathname - Full pathname to the node (for error msgs) + * PARAMETERS: Data - Pointer to validation data structure * ReturnObjectPtr - Pointer to the object returned from the * evaluation of a method or object - * Predefined - Pointer to entry in predefined name table * * RETURN: Status * @@ -505,20 +530,16 @@ AcpiNsCheckForPredefinedName ( static ACPI_STATUS AcpiNsCheckPackage ( - char *Pathname, - ACPI_OPERAND_OBJECT **ReturnObjectPtr, - const ACPI_PREDEFINED_INFO *Predefined) + ACPI_PREDEFINED_DATA *Data, + ACPI_OPERAND_OBJECT **ReturnObjectPtr) { ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr; const ACPI_PREDEFINED_INFO *Package; - ACPI_OPERAND_OBJECT *SubPackage; ACPI_OPERAND_OBJECT **Elements; - ACPI_OPERAND_OBJECT **SubElements; - ACPI_STATUS Status; + ACPI_STATUS Status = AE_OK; UINT32 ExpectedCount; UINT32 Count; UINT32 i; - UINT32 j; ACPI_FUNCTION_NAME (NsCheckPackage); @@ -526,11 +547,17 @@ AcpiNsCheckPackage ( /* The package info for this name is in the next table entry */ - Package = Predefined + 1; + Package = Data->Predefined + 1; ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s Validating return Package of Type %X, Count %X\n", - Pathname, Package->RetInfo.Type, ReturnObject->Package.Count)); + Data->Pathname, Package->RetInfo.Type, ReturnObject->Package.Count)); + + /* + * For variable-length Packages, we can safely remove all embedded + * and trailing NULL package elements + */ + AcpiNsRemoveNullElements (Data, Package->RetInfo.Type, ReturnObject); /* Extract package count and elements array */ @@ -541,8 +568,8 @@ AcpiNsCheckPackage ( if (!Count) { - ACPI_WARNING ((AE_INFO, - "%s: Return Package has no elements (empty)", Pathname)); + ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags, + "Return Package has no elements (empty)")); return (AE_AML_OPERAND_VALUE); } @@ -570,20 +597,17 @@ AcpiNsCheckPackage ( } else if (Count > ExpectedCount) { - ACPI_WARNING ((AE_INFO, + ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR, "%s: Return Package is larger than needed - " - "found %u, expected %u", Pathname, Count, ExpectedCount)); + "found %u, expected %u\n", + Data->Pathname, Count, ExpectedCount)); } /* Validate all elements of the returned package */ - Status = AcpiNsCheckPackageElements (Pathname, Elements, + Status = AcpiNsCheckPackageElements (Data, Elements, Package->RetInfo.ObjectType1, Package->RetInfo.Count1, Package->RetInfo.ObjectType2, Package->RetInfo.Count2, 0); - if (ACPI_FAILURE (Status)) - { - return (Status); - } break; @@ -595,7 +619,7 @@ AcpiNsCheckPackage ( */ for (i = 0; i < Count; i++) { - Status = AcpiNsCheckObjectType (Pathname, Elements, + Status = AcpiNsCheckObjectType (Data, Elements, Package->RetInfo.ObjectType1, i); if (ACPI_FAILURE (Status)) { @@ -629,7 +653,7 @@ AcpiNsCheckPackage ( { /* These are the required package elements (0, 1, or 2) */ - Status = AcpiNsCheckObjectType (Pathname, Elements, + Status = AcpiNsCheckObjectType (Data, Elements, Package->RetInfo3.ObjectType[i], i); if (ACPI_FAILURE (Status)) { @@ -640,7 +664,7 @@ AcpiNsCheckPackage ( { /* These are the optional package elements */ - Status = AcpiNsCheckObjectType (Pathname, Elements, + Status = AcpiNsCheckObjectType (Data, Elements, Package->RetInfo3.TailObjectType, i); if (ACPI_FAILURE (Status)) { @@ -652,11 +676,31 @@ AcpiNsCheckPackage ( break; + case ACPI_PTYPE2_REV_FIXED: + + /* First element is the (Integer) revision */ + + Status = AcpiNsCheckObjectType (Data, Elements, + ACPI_RTYPE_INTEGER, 0); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + Elements++; + Count--; + + /* Examine the sub-packages */ + + Status = AcpiNsCheckPackageList (Data, Package, Elements, Count); + break; + + case ACPI_PTYPE2_PKG_COUNT: /* First element is the (Integer) count of sub-packages to follow */ - Status = AcpiNsCheckObjectType (Pathname, Elements, + Status = AcpiNsCheckObjectType (Data, Elements, ACPI_RTYPE_INTEGER, 0); if (ACPI_FAILURE (Status)) { @@ -676,9 +720,10 @@ AcpiNsCheckPackage ( Count = ExpectedCount; Elements++; - /* Now we can walk the sub-packages */ + /* Examine the sub-packages */ - /*lint -fallthrough */ + Status = AcpiNsCheckPackageList (Data, Package, Elements, Count); + break; case ACPI_PTYPE2: @@ -687,147 +732,249 @@ AcpiNsCheckPackage ( case ACPI_PTYPE2_COUNT: /* - * These types all return a single package that consists of a variable - * number of sub-packages + * These types all return a single Package that consists of a + * variable number of sub-Packages. + * + * First, ensure that the first element is a sub-Package. If not, + * the BIOS may have incorrectly returned the object as a single + * package instead of a Package of Packages (a common error if + * there is only one entry). We may be able to repair this by + * wrapping the returned Package with a new outer Package. */ - for (i = 0; i < Count; i++) + if (*Elements && ((*Elements)->Common.Type != ACPI_TYPE_PACKAGE)) { - SubPackage = *Elements; - SubElements = SubPackage->Package.Elements; + /* Create the new outer package and populate it */ - /* Each sub-object must be of type Package */ - - Status = AcpiNsCheckObjectType (Pathname, &SubPackage, - ACPI_RTYPE_PACKAGE, i); + Status = AcpiNsRepairPackageList (Data, ReturnObjectPtr); if (ACPI_FAILURE (Status)) { return (Status); } - /* Examine the different types of sub-packages */ + /* Update locals to point to the new package (of 1 element) */ - switch (Package->RetInfo.Type) - { - case ACPI_PTYPE2: - case ACPI_PTYPE2_PKG_COUNT: + ReturnObject = *ReturnObjectPtr; + Elements = ReturnObject->Package.Elements; + Count = 1; + } - /* Each subpackage has a fixed number of elements */ + /* Examine the sub-packages */ - ExpectedCount = - Package->RetInfo.Count1 + Package->RetInfo.Count2; - if (SubPackage->Package.Count != ExpectedCount) - { - Count = SubPackage->Package.Count; - goto PackageTooSmall; - } + Status = AcpiNsCheckPackageList (Data, Package, Elements, Count); + break; - Status = AcpiNsCheckPackageElements (Pathname, SubElements, - Package->RetInfo.ObjectType1, - Package->RetInfo.Count1, - Package->RetInfo.ObjectType2, - Package->RetInfo.Count2, 0); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - break; - case ACPI_PTYPE2_FIXED: + default: - /* Each sub-package has a fixed length */ + /* Should not get here if predefined info table is correct */ - ExpectedCount = Package->RetInfo2.Count; - if (SubPackage->Package.Count < ExpectedCount) - { - Count = SubPackage->Package.Count; - goto PackageTooSmall; - } + ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags, + "Invalid internal return type in table entry: %X", + Package->RetInfo.Type)); - /* Check the type of each sub-package element */ + return (AE_AML_INTERNAL); + } - for (j = 0; j < ExpectedCount; j++) - { - Status = AcpiNsCheckObjectType (Pathname, &SubElements[j], - Package->RetInfo2.ObjectType[j], j); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } - break; + return (Status); - case ACPI_PTYPE2_MIN: - /* Each sub-package has a variable but minimum length */ +PackageTooSmall: - ExpectedCount = Package->RetInfo.Count1; - if (SubPackage->Package.Count < ExpectedCount) - { - Count = SubPackage->Package.Count; - goto PackageTooSmall; - } + /* Error exit for the case with an incorrect package count */ - /* Check the type of each sub-package element */ + ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags, + "Return Package is too small - found %u elements, expected %u", + Count, ExpectedCount)); - Status = AcpiNsCheckPackageElements (Pathname, SubElements, - Package->RetInfo.ObjectType1, - SubPackage->Package.Count, 0, 0, 0); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - break; + return (AE_AML_OPERAND_VALUE); +} - case ACPI_PTYPE2_COUNT: - /* First element is the (Integer) count of elements to follow */ +/******************************************************************************* + * + * FUNCTION: AcpiNsCheckPackageList + * + * PARAMETERS: Data - Pointer to validation data structure + * Package - Pointer to package-specific info for method + * Elements - Element list of parent package. All elements + * of this list should be of type Package. + * Count - Count of subpackages + * + * RETURN: Status + * + * DESCRIPTION: Examine a list of subpackages + * + ******************************************************************************/ - Status = AcpiNsCheckObjectType (Pathname, SubElements, - ACPI_RTYPE_INTEGER, 0); - if (ACPI_FAILURE (Status)) - { - return (Status); - } +static ACPI_STATUS +AcpiNsCheckPackageList ( + ACPI_PREDEFINED_DATA *Data, + const ACPI_PREDEFINED_INFO *Package, + ACPI_OPERAND_OBJECT **Elements, + UINT32 Count) +{ + ACPI_OPERAND_OBJECT *SubPackage; + ACPI_OPERAND_OBJECT **SubElements; + ACPI_STATUS Status; + UINT32 ExpectedCount; + UINT32 i; + UINT32 j; - /* Make sure package is large enough for the Count */ - ExpectedCount = (UINT32) (*SubElements)->Integer.Value; - if (SubPackage->Package.Count < ExpectedCount) - { - Count = SubPackage->Package.Count; - goto PackageTooSmall; - } + /* + * Validate each sub-Package in the parent Package + * + * NOTE: assumes list of sub-packages contains no NULL elements. + * Any NULL elements should have been removed by earlier call + * to AcpiNsRemoveNullElements. + */ + for (i = 0; i < Count; i++) + { + SubPackage = *Elements; + SubElements = SubPackage->Package.Elements; + Data->ParentPackage = SubPackage; + + /* Each sub-object must be of type Package */ + + Status = AcpiNsCheckObjectType (Data, &SubPackage, + ACPI_RTYPE_PACKAGE, i); + if (ACPI_FAILURE (Status)) + { + return (Status); + } - /* Check the type of each sub-package element */ + /* Examine the different types of expected sub-packages */ - Status = AcpiNsCheckPackageElements (Pathname, - (SubElements + 1), - Package->RetInfo.ObjectType1, - (ExpectedCount - 1), 0, 0, 1); + Data->ParentPackage = SubPackage; + 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 (SubPackage->Package.Count < ExpectedCount) + { + goto PackageTooSmall; + } + + Status = AcpiNsCheckPackageElements (Data, SubElements, + Package->RetInfo.ObjectType1, + Package->RetInfo.Count1, + Package->RetInfo.ObjectType2, + Package->RetInfo.Count2, 0); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + break; + + + case ACPI_PTYPE2_FIXED: + + /* Each sub-package has a fixed length */ + + ExpectedCount = Package->RetInfo2.Count; + if (SubPackage->Package.Count < ExpectedCount) + { + goto PackageTooSmall; + } + + /* Check the type of each sub-package element */ + + for (j = 0; j < ExpectedCount; j++) + { + Status = AcpiNsCheckObjectType (Data, &SubElements[j], + Package->RetInfo2.ObjectType[j], j); if (ACPI_FAILURE (Status)) { return (Status); } - break; + } + break; + + + case ACPI_PTYPE2_MIN: - default: - break; + /* Each sub-package has a variable but minimum length */ + + ExpectedCount = Package->RetInfo.Count1; + if (SubPackage->Package.Count < ExpectedCount) + { + goto PackageTooSmall; } - Elements++; - } - break; + /* Check the type of each sub-package element */ + Status = AcpiNsCheckPackageElements (Data, SubElements, + Package->RetInfo.ObjectType1, + SubPackage->Package.Count, 0, 0, 0); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + break; - default: - /* Should not get here if predefined info table is correct */ + case ACPI_PTYPE2_COUNT: + + /* + * First element is the (Integer) count of elements, including + * the count field (the ACPI name is NumElements) + */ + Status = AcpiNsCheckObjectType (Data, SubElements, + ACPI_RTYPE_INTEGER, 0); + if (ACPI_FAILURE (Status)) + { + return (Status); + } - ACPI_WARNING ((AE_INFO, - "%s: Invalid internal return type in table entry: %X", - Pathname, Package->RetInfo.Type)); + /* + * Make sure package is large enough for the Count and is + * is as large as the minimum size + */ + ExpectedCount = (UINT32) (*SubElements)->Integer.Value; + if (SubPackage->Package.Count < ExpectedCount) + { + goto PackageTooSmall; + } + if (SubPackage->Package.Count < Package->RetInfo.Count1) + { + ExpectedCount = Package->RetInfo.Count1; + goto PackageTooSmall; + } + if (ExpectedCount == 0) + { + /* + * Either the NumEntries element was originally zero or it was + * a NULL element and repaired to an Integer of value zero. + * In either case, repair it by setting NumEntries to be the + * actual size of the subpackage. + */ + ExpectedCount = SubPackage->Package.Count; + (*SubElements)->Integer.Value = ExpectedCount; + } - return (AE_AML_INTERNAL); + /* Check the type of each sub-package element */ + + Status = AcpiNsCheckPackageElements (Data, (SubElements + 1), + Package->RetInfo.ObjectType1, + (ExpectedCount - 1), 0, 0, 1); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + break; + + + default: /* Should not get here, type was validated by caller */ + + return (AE_AML_INTERNAL); + } + + Elements++; } return (AE_OK); @@ -835,10 +982,11 @@ AcpiNsCheckPackage ( PackageTooSmall: - /* Error exit for the case with an incorrect package count */ + /* The sub-package count was smaller than required */ - ACPI_WARNING ((AE_INFO, "%s: Return Package is too small - " - "found %u, expected %u", Pathname, Count, ExpectedCount)); + ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags, + "Return Sub-Package[%u] is too small - found %u elements, expected %u", + i, SubPackage->Package.Count, ExpectedCount)); return (AE_AML_OPERAND_VALUE); } @@ -848,7 +996,7 @@ PackageTooSmall: * * FUNCTION: AcpiNsCheckPackageElements * - * PARAMETERS: Pathname - Full pathname to the node (for error msgs) + * PARAMETERS: Data - Pointer to validation data structure * Elements - Pointer to the package elements array * Type1 - Object type for first group * Count1 - Count for first group @@ -865,7 +1013,7 @@ PackageTooSmall: static ACPI_STATUS AcpiNsCheckPackageElements ( - char *Pathname, + ACPI_PREDEFINED_DATA *Data, ACPI_OPERAND_OBJECT **Elements, UINT8 Type1, UINT32 Count1, @@ -885,7 +1033,7 @@ AcpiNsCheckPackageElements ( */ for (i = 0; i < Count1; i++) { - Status = AcpiNsCheckObjectType (Pathname, ThisElement, + Status = AcpiNsCheckObjectType (Data, ThisElement, Type1, i + StartIndex); if (ACPI_FAILURE (Status)) { @@ -896,7 +1044,7 @@ AcpiNsCheckPackageElements ( for (i = 0; i < Count2; i++) { - Status = AcpiNsCheckObjectType (Pathname, ThisElement, + Status = AcpiNsCheckObjectType (Data, ThisElement, Type2, (i + Count1 + StartIndex)); if (ACPI_FAILURE (Status)) { @@ -913,12 +1061,13 @@ AcpiNsCheckPackageElements ( * * FUNCTION: AcpiNsCheckObjectType * - * PARAMETERS: Pathname - Full pathname to the node (for error msgs) + * PARAMETERS: Data - Pointer to validation data structure * ReturnObjectPtr - Pointer to the object returned from the * evaluation of a method or object * ExpectedBtypes - Bitmap of expected return type(s) * PackageIndex - Index of object within parent package (if - * applicable - ACPI_NOT_PACKAGE otherwise) + * applicable - ACPI_NOT_PACKAGE_ELEMENT + * otherwise) * * RETURN: Status * @@ -929,7 +1078,7 @@ AcpiNsCheckPackageElements ( static ACPI_STATUS AcpiNsCheckObjectType ( - char *Pathname, + ACPI_PREDEFINED_DATA *Data, ACPI_OPERAND_OBJECT **ReturnObjectPtr, UINT32 ExpectedBtypes, UINT32 PackageIndex) @@ -938,17 +1087,22 @@ AcpiNsCheckObjectType ( ACPI_STATUS Status = AE_OK; UINT32 ReturnBtype; char TypeBuffer[48]; /* Room for 5 types */ - UINT32 ThisRtype; - UINT32 i; - UINT32 j; /* - * If we get a NULL ReturnObject here, it is a NULL package element, - * and this is always an error. + * 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; } @@ -956,9 +1110,9 @@ AcpiNsCheckObjectType ( if (ACPI_GET_DESCRIPTOR_TYPE (ReturnObject) == ACPI_DESC_TYPE_NAMED) { - ACPI_WARNING ((AE_INFO, - "%s: Invalid return type - Found a Namespace node [%4.4s] type %s", - Pathname, ReturnObject->Node.Name.Ascii, + ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags, + "Invalid return type - Found a Namespace node [%4.4s] type %s", + ReturnObject->Node.Name.Ascii, AcpiUtGetTypeName (ReturnObject->Node.Type))); return (AE_AML_OPERAND_TYPE); } @@ -1001,60 +1155,45 @@ AcpiNsCheckObjectType ( /* Is the object one of the expected types? */ - if (!(ReturnBtype & ExpectedBtypes)) + if (ReturnBtype & ExpectedBtypes) { - /* Type mismatch -- attempt repair of the returned object */ + /* For reference objects, check that the reference type is correct */ - Status = AcpiNsRepairObject (ExpectedBtypes, PackageIndex, - ReturnObjectPtr); - if (ACPI_SUCCESS (Status)) + if (ReturnObject->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) { - return (Status); + Status = AcpiNsCheckReference (Data, ReturnObject); } - goto TypeErrorExit; + + return (Status); } - /* For reference objects, check that the reference type is correct */ + /* Type mismatch -- attempt repair of the returned object */ - if (ReturnObject->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) + Status = AcpiNsRepairObject (Data, ExpectedBtypes, + PackageIndex, ReturnObjectPtr); + if (ACPI_SUCCESS (Status)) { - Status = AcpiNsCheckReference (Pathname, ReturnObject); + return (AE_OK); /* Repair was successful */ } - return (Status); - TypeErrorExit: /* Create a string with all expected types for this predefined object */ - j = 1; - TypeBuffer[0] = 0; - ThisRtype = ACPI_RTYPE_INTEGER; + AcpiNsGetExpectedTypes (TypeBuffer, ExpectedBtypes); - for (i = 0; i < ACPI_NUM_RTYPES; i++) + if (PackageIndex == ACPI_NOT_PACKAGE_ELEMENT) { - /* If one of the expected types, concatenate the name of this type */ - - if (ExpectedBtypes & ThisRtype) - { - ACPI_STRCAT (TypeBuffer, &AcpiRtypeNames[i][j]); - j = 0; /* Use name separator from now on */ - } - ThisRtype <<= 1; /* Next Rtype */ - } - - if (PackageIndex == ACPI_NOT_PACKAGE) - { - ACPI_WARNING ((AE_INFO, - "%s: Return type mismatch - found %s, expected %s", - Pathname, AcpiUtGetObjectTypeName (ReturnObject), TypeBuffer)); + ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags, + "Return type mismatch - found %s, expected %s", + AcpiUtGetObjectTypeName (ReturnObject), TypeBuffer)); } else { - ACPI_WARNING ((AE_INFO, - "%s: Return Package type mismatch at index %u - " - "found %s, expected %s", Pathname, PackageIndex, + ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags, + "Return Package type mismatch at index %u - " + "found %s, expected %s", PackageIndex, AcpiUtGetObjectTypeName (ReturnObject), TypeBuffer)); } @@ -1066,7 +1205,7 @@ TypeErrorExit: * * FUNCTION: AcpiNsCheckReference * - * PARAMETERS: Pathname - Full pathname to the node (for error msgs) + * PARAMETERS: Data - Pointer to validation data structure * ReturnObject - Object returned from the evaluation of a * method or object * @@ -1080,7 +1219,7 @@ TypeErrorExit: static ACPI_STATUS AcpiNsCheckReference ( - char *Pathname, + ACPI_PREDEFINED_DATA *Data, ACPI_OPERAND_OBJECT *ReturnObject) { @@ -1094,10 +1233,9 @@ AcpiNsCheckReference ( return (AE_OK); } - ACPI_WARNING ((AE_INFO, - "%s: Return type mismatch - " - "unexpected reference object type [%s] %2.2X", - Pathname, AcpiUtGetReferenceName (ReturnObject), + ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags, + "Return type mismatch - unexpected reference object type [%s] %2.2X", + AcpiUtGetReferenceName (ReturnObject), ReturnObject->Reference.Class)); return (AE_AML_OPERAND_TYPE); @@ -1106,91 +1244,41 @@ AcpiNsCheckReference ( /******************************************************************************* * - * FUNCTION: AcpiNsRepairObject + * FUNCTION: AcpiNsGetExpectedTypes * - * PARAMETERS: Pathname - Full pathname to the node (for error msgs) - * PackageIndex - Used to determine if target is in a package - * ReturnObjectPtr - Pointer to the object returned from the - * evaluation of a method or object + * PARAMETERS: Buffer - Pointer to where the string is returned + * ExpectedBtypes - Bitmap of expected return type(s) * - * RETURN: Status. AE_OK if repair was successful. + * RETURN: Buffer is populated with type names. * - * DESCRIPTION: Attempt to repair/convert a return object of a type that was - * not expected. + * DESCRIPTION: Translate the expected types bitmap into a string of ascii + * names of expected types, for use in warning messages. * ******************************************************************************/ -static ACPI_STATUS -AcpiNsRepairObject ( - UINT32 ExpectedBtypes, - UINT32 PackageIndex, - ACPI_OPERAND_OBJECT **ReturnObjectPtr) +static void +AcpiNsGetExpectedTypes ( + char *Buffer, + UINT32 ExpectedBtypes) { - ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr; - ACPI_OPERAND_OBJECT *NewObject; - ACPI_SIZE Length; - - - switch (ReturnObject->Common.Type) - { - case ACPI_TYPE_BUFFER: - - if (!(ExpectedBtypes & ACPI_RTYPE_STRING)) - { - return (AE_AML_OPERAND_TYPE); - } - - /* - * Have a Buffer, expected a String, convert. 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 < ReturnObject->Buffer.Length) && - (ReturnObject->Buffer.Pointer[Length])) - { - Length++; - } - - /* Allocate a new string object */ - - NewObject = AcpiUtCreateStringObject (Length); - if (!NewObject) - { - return (AE_NO_MEMORY); - } + UINT32 ThisRtype; + UINT32 i; + UINT32 j; - /* - * Copy the raw buffer data with no transform. String is already NULL - * terminated at Length+1. - */ - ACPI_MEMCPY (NewObject->String.Pointer, - ReturnObject->Buffer.Pointer, Length); - /* Install the new return object */ + j = 1; + Buffer[0] = 0; + ThisRtype = ACPI_RTYPE_INTEGER; - AcpiUtRemoveReference (ReturnObject); - *ReturnObjectPtr = NewObject; + for (i = 0; i < ACPI_NUM_RTYPES; i++) + { + /* If one of the expected types, concatenate the name of this type */ - /* - * If the object is a package element, we need to: - * 1. Decrement the reference count of the orignal object, it was - * incremented when building the package - * 2. Increment the reference count of the new object, it will be - * decremented when releasing the package - */ - if (PackageIndex != ACPI_NOT_PACKAGE) + if (ExpectedBtypes & ThisRtype) { - AcpiUtRemoveReference (ReturnObject); - AcpiUtAddReference (NewObject); + ACPI_STRCAT (Buffer, &AcpiRtypeNames[i][j]); + j = 0; /* Use name separator from now on */ } - return (AE_OK); - - default: - break; + ThisRtype <<= 1; /* Next Rtype */ } - - return (AE_AML_OPERAND_TYPE); } - diff --git a/sys/contrib/dev/acpica/namespace/nsrepair.c b/sys/contrib/dev/acpica/namespace/nsrepair.c new file mode 100644 index 0000000..b2191a7 --- /dev/null +++ b/sys/contrib/dev/acpica/namespace/nsrepair.c @@ -0,0 +1,876 @@ +/****************************************************************************** + * + * Module Name: nsrepair - Repair for objects returned by predefined methods + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#define __NSREPAIR_C__ + +#include <contrib/dev/acpica/include/acpi.h> +#include <contrib/dev/acpica/include/accommon.h> +#include <contrib/dev/acpica/include/acnamesp.h> +#include <contrib/dev/acpica/include/acinterp.h> +#include <contrib/dev/acpica/include/acpredef.h> + +#define _COMPONENT ACPI_NAMESPACE + ACPI_MODULE_NAME ("nsrepair") + + +/******************************************************************************* + * + * This module attempts to repair or convert objects returned by the + * predefined methods to an object type that is expected, as per the ACPI + * specification. The need for this code is dictated by the many machines that + * return incorrect types for the standard predefined methods. Performing these + * conversions here, in one place, eliminates the need for individual ACPI + * device drivers to do the same. Note: Most of these conversions are different + * than the internal object conversion routines used for implicit object + * conversion. + * + * The following conversions can be performed as necessary: + * + * Integer -> String + * Integer -> Buffer + * String -> Integer + * String -> Buffer + * Buffer -> Integer + * Buffer -> String + * Buffer -> Package of Integers + * Package -> Package of one Package + * + * Additional possible repairs: + * + * Optional/unnecessary NULL package elements removed + * Required package elements that are NULL replaced by Integer/String/Buffer + * Incorrect standalone package wrapped with required outer package + * + ******************************************************************************/ + + +/* Local prototypes */ + +static ACPI_STATUS +AcpiNsConvertToInteger ( + ACPI_OPERAND_OBJECT *OriginalObject, + ACPI_OPERAND_OBJECT **ReturnObject); + +static ACPI_STATUS +AcpiNsConvertToString ( + ACPI_OPERAND_OBJECT *OriginalObject, + ACPI_OPERAND_OBJECT **ReturnObject); + +static ACPI_STATUS +AcpiNsConvertToBuffer ( + ACPI_OPERAND_OBJECT *OriginalObject, + ACPI_OPERAND_OBJECT **ReturnObject); + +static ACPI_STATUS +AcpiNsConvertToPackage ( + ACPI_OPERAND_OBJECT *OriginalObject, + ACPI_OPERAND_OBJECT **ReturnObject); + + +/******************************************************************************* + * + * FUNCTION: AcpiNsRepairObject + * + * PARAMETERS: Data - Pointer to validation data structure + * ExpectedBtypes - Object types expected + * PackageIndex - Index of object within parent package (if + * applicable - ACPI_NOT_PACKAGE_ELEMENT + * otherwise) + * ReturnObjectPtr - Pointer to the object returned from the + * evaluation of a method or object + * + * RETURN: Status. AE_OK if repair was successful. + * + * DESCRIPTION: Attempt to repair/convert a return object of a type that was + * not expected. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiNsRepairObject ( + ACPI_PREDEFINED_DATA *Data, + UINT32 ExpectedBtypes, + UINT32 PackageIndex, + ACPI_OPERAND_OBJECT **ReturnObjectPtr) +{ + ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr; + ACPI_OPERAND_OBJECT *NewObject; + ACPI_STATUS Status; + + + ACPI_FUNCTION_NAME (NsRepairObject); + + + /* + * At this point, we know that the type of the returned object was not + * one of the expected types for this predefined name. Attempt to + * repair the object by converting it to one of the expected object + * types for this predefined name. + */ + if (ExpectedBtypes & ACPI_RTYPE_INTEGER) + { + Status = AcpiNsConvertToInteger (ReturnObject, &NewObject); + if (ACPI_SUCCESS (Status)) + { + goto ObjectRepaired; + } + } + if (ExpectedBtypes & ACPI_RTYPE_STRING) + { + Status = AcpiNsConvertToString (ReturnObject, &NewObject); + if (ACPI_SUCCESS (Status)) + { + goto ObjectRepaired; + } + } + if (ExpectedBtypes & ACPI_RTYPE_BUFFER) + { + Status = AcpiNsConvertToBuffer (ReturnObject, &NewObject); + if (ACPI_SUCCESS (Status)) + { + goto ObjectRepaired; + } + } + if (ExpectedBtypes & ACPI_RTYPE_PACKAGE) + { + Status = AcpiNsConvertToPackage (ReturnObject, &NewObject); + if (ACPI_SUCCESS (Status)) + { + goto ObjectRepaired; + } + } + + /* We cannot repair this object */ + + return (AE_AML_OPERAND_TYPE); + + +ObjectRepaired: + + /* Object was successfully repaired */ + + /* + * If the original object is a package element, we need to: + * 1. Set the reference count of the new object to match the + * reference count of the old object. + * 2. Decrement the reference count of the original object. + */ + if (PackageIndex != ACPI_NOT_PACKAGE_ELEMENT) + { + NewObject->Common.ReferenceCount = + ReturnObject->Common.ReferenceCount; + + if (ReturnObject->Common.ReferenceCount > 1) + { + ReturnObject->Common.ReferenceCount--; + } + + ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR, + "%s: Converted %s to expected %s at index %u\n", + Data->Pathname, AcpiUtGetObjectTypeName (ReturnObject), + AcpiUtGetObjectTypeName (NewObject), PackageIndex)); + } + else + { + ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR, + "%s: Converted %s to expected %s\n", + Data->Pathname, AcpiUtGetObjectTypeName (ReturnObject), + AcpiUtGetObjectTypeName (NewObject))); + } + + /* Delete old object, install the new return object */ + + AcpiUtRemoveReference (ReturnObject); + *ReturnObjectPtr = NewObject; + Data->Flags |= ACPI_OBJECT_REPAIRED; + return (AE_OK); +} + + +/******************************************************************************* + * + * 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 + * + * 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. + * + ******************************************************************************/ + +static 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. + * + ******************************************************************************/ + +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; + + + 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: AcpiNsConvertToPackage + * + * 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 Buffer object to a Package. Each byte of + * the buffer is converted to a single integer package element. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiNsConvertToPackage ( + ACPI_OPERAND_OBJECT *OriginalObject, + ACPI_OPERAND_OBJECT **ReturnObject) +{ + ACPI_OPERAND_OBJECT *NewObject; + ACPI_OPERAND_OBJECT **Elements; + UINT32 Length; + UINT8 *Buffer; + + + switch (OriginalObject->Common.Type) + { + case ACPI_TYPE_BUFFER: + + /* Buffer-to-Package conversion */ + + Length = OriginalObject->Buffer.Length; + NewObject = AcpiUtCreatePackageObject (Length); + if (!NewObject) + { + return (AE_NO_MEMORY); + } + + /* Convert each buffer byte to an integer package element */ + + Elements = NewObject->Package.Elements; + Buffer = OriginalObject->Buffer.Pointer; + + while (Length--) + { + *Elements = AcpiUtCreateIntegerObject ((UINT64) *Buffer); + if (!*Elements) + { + AcpiUtRemoveReference (NewObject); + return (AE_NO_MEMORY); + } + Elements++; + Buffer++; + } + break; + + default: + return (AE_AML_OPERAND_TYPE); + } + + *ReturnObject = NewObject; + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiNsRepairNullElement + * + * PARAMETERS: Data - Pointer to validation data structure + * ExpectedBtypes - Object types expected + * PackageIndex - Index of object within parent package (if + * applicable - ACPI_NOT_PACKAGE_ELEMENT + * otherwise) + * ReturnObjectPtr - Pointer to the object returned from the + * evaluation of a method or object + * + * RETURN: Status. AE_OK if repair was successful. + * + * DESCRIPTION: Attempt to repair a NULL element of a returned Package object. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiNsRepairNullElement ( + ACPI_PREDEFINED_DATA *Data, + UINT32 ExpectedBtypes, + UINT32 PackageIndex, + ACPI_OPERAND_OBJECT **ReturnObjectPtr) +{ + ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr; + ACPI_OPERAND_OBJECT *NewObject; + + + ACPI_FUNCTION_NAME (NsRepairNullElement); + + + /* No repair needed if return object is non-NULL */ + + if (ReturnObject) + { + return (AE_OK); + } + + /* + * Attempt to repair a NULL element of a Package object. This applies to + * predefined names that return a fixed-length package and each element + * is required. It does not apply to variable-length packages where NULL + * elements are allowed, especially at the end of the package. + */ + if (ExpectedBtypes & ACPI_RTYPE_INTEGER) + { + /* Need an Integer - create a zero-value integer */ + + NewObject = AcpiUtCreateIntegerObject (0); + } + else if (ExpectedBtypes & ACPI_RTYPE_STRING) + { + /* Need a String - create a NULL string */ + + NewObject = AcpiUtCreateStringObject (0); + } + else if (ExpectedBtypes & ACPI_RTYPE_BUFFER) + { + /* Need a Buffer - create a zero-length buffer */ + + NewObject = AcpiUtCreateBufferObject (0); + } + else + { + /* Error for all other expected types */ + + return (AE_AML_OPERAND_TYPE); + } + + if (!NewObject) + { + return (AE_NO_MEMORY); + } + + /* Set the reference count according to the parent Package object */ + + NewObject->Common.ReferenceCount = Data->ParentPackage->Common.ReferenceCount; + + ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR, + "%s: Converted NULL package element to expected %s at index %u\n", + Data->Pathname, AcpiUtGetObjectTypeName (NewObject), PackageIndex)); + + *ReturnObjectPtr = NewObject; + Data->Flags |= ACPI_OBJECT_REPAIRED; + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiNsRemoveNullElements + * + * PARAMETERS: Data - Pointer to validation data structure + * PackageType - An AcpiReturnPackageTypes value + * ObjDesc - A Package object + * + * RETURN: None. + * + * DESCRIPTION: Remove all NULL package elements from packages that contain + * a variable number of sub-packages. For these types of + * packages, NULL elements can be safely removed. + * + *****************************************************************************/ + +void +AcpiNsRemoveNullElements ( + ACPI_PREDEFINED_DATA *Data, + UINT8 PackageType, + ACPI_OPERAND_OBJECT *ObjDesc) +{ + ACPI_OPERAND_OBJECT **Source; + ACPI_OPERAND_OBJECT **Dest; + UINT32 Count; + UINT32 NewCount; + UINT32 i; + + + ACPI_FUNCTION_NAME (NsRemoveNullElements); + + + /* + * PTYPE1 packages contain no subpackages. + * PTYPE2 packages contain a variable number of sub-packages. We can + * safely remove all NULL elements from the PTYPE2 packages. + */ + switch (PackageType) + { + case ACPI_PTYPE1_FIXED: + case ACPI_PTYPE1_VAR: + case ACPI_PTYPE1_OPTION: + return; + + case ACPI_PTYPE2: + case ACPI_PTYPE2_COUNT: + case ACPI_PTYPE2_PKG_COUNT: + case ACPI_PTYPE2_FIXED: + case ACPI_PTYPE2_MIN: + case ACPI_PTYPE2_REV_FIXED: + break; + + default: + return; + } + + Count = ObjDesc->Package.Count; + NewCount = Count; + + Source = ObjDesc->Package.Elements; + Dest = Source; + + /* Examine all elements of the package object, remove nulls */ + + for (i = 0; i < Count; i++) + { + if (!*Source) + { + NewCount--; + } + else + { + *Dest = *Source; + Dest++; + } + Source++; + } + + /* Update parent package if any null elements were removed */ + + if (NewCount < Count) + { + ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR, + "%s: Found and removed %u NULL elements\n", + Data->Pathname, (Count - NewCount))); + + /* NULL terminate list and update the package count */ + + *Dest = NULL; + ObjDesc->Package.Count = NewCount; + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiNsRepairPackageList + * + * PARAMETERS: Data - Pointer to validation data structure + * ObjDescPtr - Pointer to the object to repair. The new + * package object is returned here, + * overwriting the old object. + * + * RETURN: Status, new object in *ObjDescPtr + * + * DESCRIPTION: Repair a common problem with objects that are defined to return + * a variable-length Package of Packages. If the variable-length + * is one, some BIOS code mistakenly simply declares a single + * Package instead of a Package with one sub-Package. This + * function attempts to repair this error by wrapping a Package + * object around the original Package, creating the correct + * Package with one sub-Package. + * + * Names that can be repaired in this manner include: + * _ALR, _CSD, _HPX, _MLS, _PRT, _PSS, _TRT, TSS + * + ******************************************************************************/ + +ACPI_STATUS +AcpiNsRepairPackageList ( + ACPI_PREDEFINED_DATA *Data, + ACPI_OPERAND_OBJECT **ObjDescPtr) +{ + ACPI_OPERAND_OBJECT *PkgObjDesc; + + + ACPI_FUNCTION_NAME (NsRepairPackageList); + + + /* + * Create the new outer package and populate it. The new package will + * have a single element, the lone subpackage. + */ + PkgObjDesc = AcpiUtCreatePackageObject (1); + if (!PkgObjDesc) + { + return (AE_NO_MEMORY); + } + + PkgObjDesc->Package.Elements[0] = *ObjDescPtr; + + /* Return the new object in the object pointer */ + + *ObjDescPtr = PkgObjDesc; + Data->Flags |= ACPI_OBJECT_REPAIRED; + + ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR, + "%s: Repaired incorrectly formed Package\n", Data->Pathname)); + + return (AE_OK); +} diff --git a/sys/contrib/dev/acpica/namespace/nsrepair2.c b/sys/contrib/dev/acpica/namespace/nsrepair2.c new file mode 100644 index 0000000..25fc47c --- /dev/null +++ b/sys/contrib/dev/acpica/namespace/nsrepair2.c @@ -0,0 +1,696 @@ +/****************************************************************************** + * + * Module Name: nsrepair2 - Repair for objects returned by specific + * predefined methods + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#define __NSREPAIR2_C__ + +#include <contrib/dev/acpica/include/acpi.h> +#include <contrib/dev/acpica/include/accommon.h> +#include <contrib/dev/acpica/include/acnamesp.h> + +#define _COMPONENT ACPI_NAMESPACE + ACPI_MODULE_NAME ("nsrepair2") + + +/* + * Information structure and handler for ACPI predefined names that can + * be repaired on a per-name basis. + */ +typedef +ACPI_STATUS (*ACPI_REPAIR_FUNCTION) ( + ACPI_PREDEFINED_DATA *Data, + ACPI_OPERAND_OBJECT **ReturnObjectPtr); + +typedef struct acpi_repair_info +{ + char Name[ACPI_NAME_SIZE]; + ACPI_REPAIR_FUNCTION RepairFunction; + +} ACPI_REPAIR_INFO; + + +/* Local prototypes */ + +static const ACPI_REPAIR_INFO * +AcpiNsMatchRepairableName ( + ACPI_NAMESPACE_NODE *Node); + +static ACPI_STATUS +AcpiNsRepair_ALR ( + ACPI_PREDEFINED_DATA *Data, + ACPI_OPERAND_OBJECT **ReturnObjectPtr); + +static ACPI_STATUS +AcpiNsRepair_FDE ( + ACPI_PREDEFINED_DATA *Data, + ACPI_OPERAND_OBJECT **ReturnObjectPtr); + +static ACPI_STATUS +AcpiNsRepair_PSS ( + ACPI_PREDEFINED_DATA *Data, + ACPI_OPERAND_OBJECT **ReturnObjectPtr); + +static ACPI_STATUS +AcpiNsRepair_TSS ( + ACPI_PREDEFINED_DATA *Data, + ACPI_OPERAND_OBJECT **ReturnObjectPtr); + +static ACPI_STATUS +AcpiNsCheckSortedList ( + ACPI_PREDEFINED_DATA *Data, + ACPI_OPERAND_OBJECT *ReturnObject, + UINT32 ExpectedCount, + UINT32 SortIndex, + UINT8 SortDirection, + char *SortKeyName); + +static void +AcpiNsSortList ( + ACPI_OPERAND_OBJECT **Elements, + UINT32 Count, + UINT32 Index, + UINT8 SortDirection); + +/* Values for SortDirection above */ + +#define ACPI_SORT_ASCENDING 0 +#define ACPI_SORT_DESCENDING 1 + + +/* + * This table contains the names of the predefined methods for which we can + * perform more complex repairs. + * + * As necessary: + * + * _ALR: Sort the list ascending by AmbientIlluminance + * _FDE: Convert Buffer of BYTEs to a Buffer of DWORDs + * _GTM: Convert Buffer of BYTEs to a Buffer of DWORDs + * _PSS: Sort the list descending by Power + * _TSS: Sort the list descending by Power + */ +static const ACPI_REPAIR_INFO AcpiNsRepairableNames[] = +{ + {"_ALR", AcpiNsRepair_ALR}, + {"_FDE", AcpiNsRepair_FDE}, + {"_GTM", AcpiNsRepair_FDE}, /* _GTM has same repair as _FDE */ + {"_PSS", AcpiNsRepair_PSS}, + {"_TSS", AcpiNsRepair_TSS}, + {{0,0,0,0}, NULL} /* Table terminator */ +}; + + +#define ACPI_FDE_FIELD_COUNT 5 +#define ACPI_FDE_BYTE_BUFFER_SIZE 5 +#define ACPI_FDE_DWORD_BUFFER_SIZE (ACPI_FDE_FIELD_COUNT * sizeof (UINT32)) + + +/****************************************************************************** + * + * FUNCTION: AcpiNsComplexRepairs + * + * PARAMETERS: Data - Pointer to validation data structure + * Node - Namespace node for the method/object + * ValidateStatus - Original status of earlier validation + * ReturnObjectPtr - Pointer to the object returned from the + * evaluation of a method or object + * + * RETURN: Status. AE_OK if repair was successful. If name is not + * matched, ValidateStatus is returned. + * + * DESCRIPTION: Attempt to repair/convert a return object of a type that was + * not expected. + * + *****************************************************************************/ + +ACPI_STATUS +AcpiNsComplexRepairs ( + ACPI_PREDEFINED_DATA *Data, + ACPI_NAMESPACE_NODE *Node, + ACPI_STATUS ValidateStatus, + ACPI_OPERAND_OBJECT **ReturnObjectPtr) +{ + const ACPI_REPAIR_INFO *Predefined; + ACPI_STATUS Status; + + + /* Check if this name is in the list of repairable names */ + + Predefined = AcpiNsMatchRepairableName (Node); + if (!Predefined) + { + return (ValidateStatus); + } + + Status = Predefined->RepairFunction (Data, ReturnObjectPtr); + return (Status); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiNsMatchRepairableName + * + * PARAMETERS: Node - Namespace node for the method/object + * + * RETURN: Pointer to entry in repair table. NULL indicates not found. + * + * DESCRIPTION: Check an object name against the repairable object list. + * + *****************************************************************************/ + +static const ACPI_REPAIR_INFO * +AcpiNsMatchRepairableName ( + ACPI_NAMESPACE_NODE *Node) +{ + const ACPI_REPAIR_INFO *ThisName; + + + /* Search info table for a repairable predefined method/object name */ + + ThisName = AcpiNsRepairableNames; + while (ThisName->RepairFunction) + { + if (ACPI_COMPARE_NAME (Node->Name.Ascii, ThisName->Name)) + { + return (ThisName); + } + ThisName++; + } + + return (NULL); /* Not found */ +} + + +/****************************************************************************** + * + * FUNCTION: AcpiNsRepair_ALR + * + * PARAMETERS: Data - Pointer to validation data structure + * ReturnObjectPtr - Pointer to the object returned from the + * evaluation of a method or object + * + * RETURN: Status. AE_OK if object is OK or was repaired successfully + * + * DESCRIPTION: Repair for the _ALR object. If necessary, sort the object list + * ascending by the ambient illuminance values. + * + *****************************************************************************/ + +static ACPI_STATUS +AcpiNsRepair_ALR ( + ACPI_PREDEFINED_DATA *Data, + ACPI_OPERAND_OBJECT **ReturnObjectPtr) +{ + ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr; + ACPI_STATUS Status; + + + Status = AcpiNsCheckSortedList (Data, ReturnObject, 2, 1, + ACPI_SORT_ASCENDING, "AmbientIlluminance"); + + return (Status); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiNsRepair_FDE + * + * PARAMETERS: Data - Pointer to validation data structure + * ReturnObjectPtr - Pointer to the object returned from the + * evaluation of a method or object + * + * RETURN: Status. AE_OK if object is OK or was repaired successfully + * + * DESCRIPTION: Repair for the _FDE and _GTM objects. The expected return + * value is a Buffer of 5 DWORDs. This function repairs a common + * problem where the return value is a Buffer of BYTEs, not + * DWORDs. + * + *****************************************************************************/ + +static ACPI_STATUS +AcpiNsRepair_FDE ( + ACPI_PREDEFINED_DATA *Data, + ACPI_OPERAND_OBJECT **ReturnObjectPtr) +{ + ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr; + ACPI_OPERAND_OBJECT *BufferObject; + UINT8 *ByteBuffer; + UINT32 *DwordBuffer; + UINT32 i; + + + ACPI_FUNCTION_NAME (NsRepair_FDE); + + + switch (ReturnObject->Common.Type) + { + case ACPI_TYPE_BUFFER: + + /* This is the expected type. Length should be (at least) 5 DWORDs */ + + if (ReturnObject->Buffer.Length >= ACPI_FDE_DWORD_BUFFER_SIZE) + { + return (AE_OK); + } + + /* We can only repair if we have exactly 5 BYTEs */ + + if (ReturnObject->Buffer.Length != ACPI_FDE_BYTE_BUFFER_SIZE) + { + ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags, + "Incorrect return buffer length %u, expected %u", + ReturnObject->Buffer.Length, ACPI_FDE_DWORD_BUFFER_SIZE)); + + return (AE_AML_OPERAND_TYPE); + } + + /* Create the new (larger) buffer object */ + + BufferObject = AcpiUtCreateBufferObject (ACPI_FDE_DWORD_BUFFER_SIZE); + if (!BufferObject) + { + return (AE_NO_MEMORY); + } + + /* Expand each byte to a DWORD */ + + ByteBuffer = ReturnObject->Buffer.Pointer; + DwordBuffer = ACPI_CAST_PTR (UINT32, BufferObject->Buffer.Pointer); + + for (i = 0; i < ACPI_FDE_FIELD_COUNT; i++) + { + *DwordBuffer = (UINT32) *ByteBuffer; + DwordBuffer++; + ByteBuffer++; + } + + ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR, + "%s Expanded Byte Buffer to expected DWord Buffer\n", + Data->Pathname)); + break; + + default: + return (AE_AML_OPERAND_TYPE); + } + + /* Delete the original return object, return the new buffer object */ + + AcpiUtRemoveReference (ReturnObject); + *ReturnObjectPtr = BufferObject; + + Data->Flags |= ACPI_OBJECT_REPAIRED; + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiNsRepair_TSS + * + * PARAMETERS: Data - Pointer to validation data structure + * ReturnObjectPtr - Pointer to the object returned from the + * evaluation of a method or object + * + * RETURN: Status. AE_OK if object is OK or was repaired successfully + * + * DESCRIPTION: Repair for the _TSS object. If necessary, sort the object list + * descending by the power dissipation values. + * + *****************************************************************************/ + +static ACPI_STATUS +AcpiNsRepair_TSS ( + ACPI_PREDEFINED_DATA *Data, + ACPI_OPERAND_OBJECT **ReturnObjectPtr) +{ + ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr; + ACPI_STATUS Status; + + + Status = AcpiNsCheckSortedList (Data, ReturnObject, 5, 1, + ACPI_SORT_DESCENDING, "PowerDissipation"); + + return (Status); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiNsRepair_PSS + * + * PARAMETERS: Data - Pointer to validation data structure + * ReturnObjectPtr - Pointer to the object returned from the + * evaluation of a method or object + * + * RETURN: Status. AE_OK if object is OK or was repaired successfully + * + * DESCRIPTION: Repair for the _PSS object. If necessary, sort the object list + * by the CPU frequencies. Check that the power dissipation values + * are all proportional to CPU frequency (i.e., sorting by + * frequency should be the same as sorting by power.) + * + *****************************************************************************/ + +static ACPI_STATUS +AcpiNsRepair_PSS ( + ACPI_PREDEFINED_DATA *Data, + ACPI_OPERAND_OBJECT **ReturnObjectPtr) +{ + ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr; + ACPI_OPERAND_OBJECT **OuterElements; + UINT32 OuterElementCount; + ACPI_OPERAND_OBJECT **Elements; + ACPI_OPERAND_OBJECT *ObjDesc; + UINT32 PreviousValue; + ACPI_STATUS Status; + UINT32 i; + + + /* + * Entries (sub-packages) in the _PSS Package must be sorted by power + * dissipation, in descending order. If it appears that the list is + * incorrectly sorted, sort it. We sort by CpuFrequency, since this + * should be proportional to the power. + */ + Status =AcpiNsCheckSortedList (Data, ReturnObject, 6, 0, + ACPI_SORT_DESCENDING, "CpuFrequency"); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* + * We now know the list is correctly sorted by CPU frequency. Check if + * the power dissipation values are proportional. + */ + PreviousValue = ACPI_UINT32_MAX; + OuterElements = ReturnObject->Package.Elements; + OuterElementCount = ReturnObject->Package.Count; + + for (i = 0; i < OuterElementCount; i++) + { + Elements = (*OuterElements)->Package.Elements; + ObjDesc = Elements[1]; /* Index1 = PowerDissipation */ + + if ((UINT32) ObjDesc->Integer.Value > PreviousValue) + { + ACPI_WARN_PREDEFINED ((AE_INFO, Data->Pathname, Data->NodeFlags, + "SubPackage[%u,%u] - suspicious power dissipation values", + i-1, i)); + } + + PreviousValue = (UINT32) ObjDesc->Integer.Value; + OuterElements++; + } + + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiNsCheckSortedList + * + * PARAMETERS: Data - Pointer to validation data structure + * ReturnObject - Pointer to the top-level returned object + * ExpectedCount - Minimum length of each sub-package + * SortIndex - Sub-package entry to sort on + * SortDirection - Ascending or descending + * SortKeyName - Name of the SortIndex field + * + * RETURN: Status. AE_OK if the list is valid and is sorted correctly or + * has been repaired by sorting the list. + * + * DESCRIPTION: Check if the package list is valid and sorted correctly by the + * SortIndex. If not, then sort the list. + * + *****************************************************************************/ + +static ACPI_STATUS +AcpiNsCheckSortedList ( + ACPI_PREDEFINED_DATA *Data, + ACPI_OPERAND_OBJECT *ReturnObject, + UINT32 ExpectedCount, + UINT32 SortIndex, + UINT8 SortDirection, + char *SortKeyName) +{ + UINT32 OuterElementCount; + ACPI_OPERAND_OBJECT **OuterElements; + ACPI_OPERAND_OBJECT **Elements; + ACPI_OPERAND_OBJECT *ObjDesc; + UINT32 i; + UINT32 PreviousValue; + + + ACPI_FUNCTION_NAME (NsCheckSortedList); + + + /* The top-level object must be a package */ + + if (ReturnObject->Common.Type != ACPI_TYPE_PACKAGE) + { + return (AE_AML_OPERAND_TYPE); + } + + /* + * NOTE: assumes list of sub-packages contains no NULL elements. + * Any NULL elements should have been removed by earlier call + * to AcpiNsRemoveNullElements. + */ + OuterElements = ReturnObject->Package.Elements; + OuterElementCount = ReturnObject->Package.Count; + if (!OuterElementCount) + { + return (AE_AML_PACKAGE_LIMIT); + } + + PreviousValue = 0; + if (SortDirection == ACPI_SORT_DESCENDING) + { + PreviousValue = ACPI_UINT32_MAX; + } + + /* Examine each subpackage */ + + for (i = 0; i < OuterElementCount; i++) + { + /* Each element of the top-level package must also be a package */ + + if ((*OuterElements)->Common.Type != ACPI_TYPE_PACKAGE) + { + return (AE_AML_OPERAND_TYPE); + } + + /* Each sub-package must have the minimum length */ + + if ((*OuterElements)->Package.Count < ExpectedCount) + { + return (AE_AML_PACKAGE_LIMIT); + } + + Elements = (*OuterElements)->Package.Elements; + ObjDesc = Elements[SortIndex]; + + if (ObjDesc->Common.Type != ACPI_TYPE_INTEGER) + { + return (AE_AML_OPERAND_TYPE); + } + + /* + * The list must be sorted in the specified order. If we detect a + * discrepancy, sort the entire list. + */ + if (((SortDirection == ACPI_SORT_ASCENDING) && + (ObjDesc->Integer.Value < PreviousValue)) || + ((SortDirection == ACPI_SORT_DESCENDING) && + (ObjDesc->Integer.Value > PreviousValue))) + { + AcpiNsSortList (ReturnObject->Package.Elements, + OuterElementCount, SortIndex, SortDirection); + + Data->Flags |= ACPI_OBJECT_REPAIRED; + + ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR, + "%s: Repaired unsorted list - now sorted by %s\n", + Data->Pathname, SortKeyName)); + return (AE_OK); + } + + PreviousValue = (UINT32) ObjDesc->Integer.Value; + OuterElements++; + } + + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiNsSortList + * + * PARAMETERS: Elements - Package object element list + * Count - Element count for above + * Index - Sort by which package element + * SortDirection - Ascending or Descending sort + * + * RETURN: None + * + * DESCRIPTION: Sort the objects that are in a package element list. + * + * NOTE: Assumes that all NULL elements have been removed from the package, + * and that all elements have been verified to be of type Integer. + * + *****************************************************************************/ + +static void +AcpiNsSortList ( + ACPI_OPERAND_OBJECT **Elements, + UINT32 Count, + UINT32 Index, + UINT8 SortDirection) +{ + ACPI_OPERAND_OBJECT *ObjDesc1; + ACPI_OPERAND_OBJECT *ObjDesc2; + ACPI_OPERAND_OBJECT *TempObj; + UINT32 i; + UINT32 j; + + + /* Simple bubble sort */ + + for (i = 1; i < Count; i++) + { + for (j = (Count - 1); j >= i; j--) + { + ObjDesc1 = Elements[j-1]->Package.Elements[Index]; + ObjDesc2 = Elements[j]->Package.Elements[Index]; + + if (((SortDirection == ACPI_SORT_ASCENDING) && + (ObjDesc1->Integer.Value > ObjDesc2->Integer.Value)) || + + ((SortDirection == ACPI_SORT_DESCENDING) && + (ObjDesc1->Integer.Value < ObjDesc2->Integer.Value))) + { + TempObj = Elements[j-1]; + Elements[j-1] = Elements[j]; + Elements[j] = TempObj; + } + } + } +} diff --git a/sys/contrib/dev/acpica/namespace/nssearch.c b/sys/contrib/dev/acpica/namespace/nssearch.c index 0386388..b583fab 100644 --- a/sys/contrib/dev/acpica/namespace/nssearch.c +++ b/sys/contrib/dev/acpica/namespace/nssearch.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/namespace/nsutils.c b/sys/contrib/dev/acpica/namespace/nsutils.c index 666c790..cc42f68 100644 --- a/sys/contrib/dev/acpica/namespace/nsutils.c +++ b/sys/contrib/dev/acpica/namespace/nsutils.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -857,25 +857,26 @@ AcpiNsExternalizeName ( /******************************************************************************* * - * FUNCTION: AcpiNsMapHandleToNode + * FUNCTION: AcpiNsValidateHandle * - * PARAMETERS: Handle - Handle to be converted to an Node + * PARAMETERS: Handle - Handle to be validated and typecast to a + * namespace node. * - * RETURN: A Name table entry pointer + * RETURN: A pointer to a namespace node * - * DESCRIPTION: Convert a namespace handle to a real Node + * DESCRIPTION: Convert a namespace handle to a namespace node. Handles special + * cases for the root node. * - * Note: Real integer handles would allow for more verification + * NOTE: Real integer handles would allow for more verification * and keep all pointers within this subsystem - however this introduces - * more (and perhaps unnecessary) overhead. - * - * The current implemenation is basically a placeholder until such time comes - * that it is needed. + * more overhead and has not been necessary to this point. Drivers + * holding handles are typically notified before a node becomes invalid + * due to a table unload. * ******************************************************************************/ ACPI_NAMESPACE_NODE * -AcpiNsMapHandleToNode ( +AcpiNsValidateHandle ( ACPI_HANDLE Handle) { @@ -902,48 +903,6 @@ AcpiNsMapHandleToNode ( /******************************************************************************* * - * FUNCTION: AcpiNsConvertEntryToHandle - * - * PARAMETERS: Node - Node to be converted to a Handle - * - * RETURN: A user handle - * - * DESCRIPTION: Convert a real Node to a namespace handle - * - ******************************************************************************/ - -ACPI_HANDLE -AcpiNsConvertEntryToHandle ( - ACPI_NAMESPACE_NODE *Node) -{ - - - /* - * Simple implementation for now; - */ - return ((ACPI_HANDLE) Node); - - -/* Example future implementation --------------------- - - if (!Node) - { - return (NULL); - } - - if (Node == AcpiGbl_RootNode) - { - return (ACPI_ROOT_OBJECT); - } - - - return ((ACPI_HANDLE) Node); -------------------------------------------------------*/ -} - - -/******************************************************************************* - * * FUNCTION: AcpiNsTerminate * * PARAMETERS: none diff --git a/sys/contrib/dev/acpica/namespace/nswalk.c b/sys/contrib/dev/acpica/namespace/nswalk.c index fcfa5e1..f5eb8ff 100644 --- a/sys/contrib/dev/acpica/namespace/nswalk.c +++ b/sys/contrib/dev/acpica/namespace/nswalk.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -247,24 +247,27 @@ AcpiNsGetNextNodeTyped ( * MaxDepth - Depth to which search is to reach * Flags - Whether to unlock the NS before invoking * the callback routine - * UserFunction - Called when an object of "Type" is found - * Context - Passed to user function - * ReturnValue - from the UserFunction if terminated early. - * Otherwise, returns NULL. + * PreOrderVisit - Called during tree pre-order visit + * when an object of "Type" is found + * PostOrderVisit - Called during tree post-order visit + * when an object of "Type" is found + * Context - Passed to user function(s) above + * ReturnValue - from the UserFunction if terminated + * early. Otherwise, returns NULL. * RETURNS: Status * * DESCRIPTION: Performs a modified depth-first walk of the namespace tree, * starting (and ending) at the node specified by StartHandle. - * The UserFunction is called whenever a node that matches - * the type parameter is found. If the user function returns + * The callback function is called whenever a node that matches + * the type parameter is found. If the callback function returns * a non-zero value, the search is terminated immediately and * this value is returned to the caller. * * The point of this procedure is to provide a generic namespace * walk routine that can be called from multiple places to - * provide multiple services; the User Function can be tailored - * to each task, whether it is a print function, a compare - * function, etc. + * provide multiple services; the callback function(s) can be + * tailored to each task, whether it is a print function, + * a compare function, etc. * ******************************************************************************/ @@ -274,7 +277,8 @@ AcpiNsWalkNamespace ( ACPI_HANDLE StartNode, UINT32 MaxDepth, UINT32 Flags, - ACPI_WALK_CALLBACK UserFunction, + ACPI_WALK_CALLBACK PreOrderVisit, + ACPI_WALK_CALLBACK PostOrderVisit, void *Context, void **ReturnValue) { @@ -284,6 +288,7 @@ AcpiNsWalkNamespace ( ACPI_NAMESPACE_NODE *ParentNode; ACPI_OBJECT_TYPE ChildType; UINT32 Level; + BOOLEAN NodePreviouslyVisited = FALSE; ACPI_FUNCTION_TRACE (NsWalkNamespace); @@ -299,7 +304,7 @@ AcpiNsWalkNamespace ( /* Null child means "get first node" */ ParentNode = StartNode; - ChildNode = NULL; + ChildNode = AcpiNsGetNextNode (ParentNode, NULL); ChildType = ACPI_TYPE_ANY; Level = 1; @@ -308,103 +313,139 @@ AcpiNsWalkNamespace ( * started. When Level is zero, the loop is done because we have * bubbled up to (and passed) the original parent handle (StartEntry) */ - while (Level > 0) + while (Level > 0 && ChildNode) { - /* Get the next node in this scope. Null if not found */ - Status = AE_OK; - ChildNode = AcpiNsGetNextNode (ParentNode, ChildNode); - if (ChildNode) + + /* Found next child, get the type if we are not searching for ANY */ + + if (Type != ACPI_TYPE_ANY) + { + ChildType = ChildNode->Type; + } + + /* + * Ignore all temporary namespace nodes (created during control + * method execution) unless told otherwise. These temporary nodes + * can cause a race condition because they can be deleted during + * the execution of the user function (if the namespace is + * unlocked before invocation of the user function.) Only the + * debugger namespace dump will examine the temporary nodes. + */ + if ((ChildNode->Flags & ANOBJ_TEMPORARY) && + !(Flags & ACPI_NS_WALK_TEMP_NODES)) { - /* Found next child, get the type if we are not searching for ANY */ + Status = AE_CTRL_DEPTH; + } - if (Type != ACPI_TYPE_ANY) + /* Type must match requested type */ + + else if (ChildType == Type) + { + /* + * Found a matching node, invoke the user callback function. + * Unlock the namespace if flag is set. + */ + if (Flags & ACPI_NS_WALK_UNLOCK) { - ChildType = ChildNode->Type; + MutexStatus = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (MutexStatus)) + { + return_ACPI_STATUS (MutexStatus); + } } /* - * Ignore all temporary namespace nodes (created during control - * method execution) unless told otherwise. These temporary nodes - * can cause a race condition because they can be deleted during - * the execution of the user function (if the namespace is - * unlocked before invocation of the user function.) Only the - * debugger namespace dump will examine the temporary nodes. + * Invoke the user function, either pre-order or post-order + * or both. */ - if ((ChildNode->Flags & ANOBJ_TEMPORARY) && - !(Flags & ACPI_NS_WALK_TEMP_NODES)) + if (!NodePreviouslyVisited) { - Status = AE_CTRL_DEPTH; + if (PreOrderVisit) + { + Status = PreOrderVisit (ChildNode, Level, + Context, ReturnValue); + } } - - /* Type must match requested type */ - - else if (ChildType == Type) + else { - /* - * Found a matching node, invoke the user callback function. - * Unlock the namespace if flag is set. - */ - if (Flags & ACPI_NS_WALK_UNLOCK) + if (PostOrderVisit) { - MutexStatus = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (MutexStatus)) - { - return_ACPI_STATUS (MutexStatus); - } + Status = PostOrderVisit (ChildNode, Level, + Context, ReturnValue); } + } - Status = UserFunction (ChildNode, Level, Context, ReturnValue); - - if (Flags & ACPI_NS_WALK_UNLOCK) + if (Flags & ACPI_NS_WALK_UNLOCK) + { + MutexStatus = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (MutexStatus)) { - MutexStatus = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE (MutexStatus)) - { - return_ACPI_STATUS (MutexStatus); - } + return_ACPI_STATUS (MutexStatus); } + } - switch (Status) - { - case AE_OK: - case AE_CTRL_DEPTH: + switch (Status) + { + case AE_OK: + case AE_CTRL_DEPTH: - /* Just keep going */ - break; + /* Just keep going */ + break; - case AE_CTRL_TERMINATE: + case AE_CTRL_TERMINATE: - /* Exit now, with OK status */ + /* Exit now, with OK status */ - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS (AE_OK); - default: + default: - /* All others are valid exceptions */ + /* All others are valid exceptions */ - return_ACPI_STATUS (Status); - } + return_ACPI_STATUS (Status); } + } - /* - * Depth first search: Attempt to go down another level in the - * namespace if we are allowed to. Don't go any further if we have - * reached the caller specified maximum depth or if the user - * function has specified that the maximum depth has been reached. - */ - if ((Level < MaxDepth) && (Status != AE_CTRL_DEPTH)) + /* + * Depth first search: Attempt to go down another level in the + * namespace if we are allowed to. Don't go any further if we have + * reached the caller specified maximum depth or if the user + * function has specified that the maximum depth has been reached. + */ + if (!NodePreviouslyVisited && + (Level < MaxDepth) && + (Status != AE_CTRL_DEPTH)) + { + if (ChildNode->Child) { - if (ChildNode->Child) - { - /* There is at least one child of this node, visit it */ + /* There is at least one child of this node, visit it */ - Level++; - ParentNode = ChildNode; - ChildNode = NULL; - } + Level++; + ParentNode = ChildNode; + ChildNode = AcpiNsGetNextNode (ParentNode, NULL); + continue; } } + + /* No more children, re-visit this node */ + + if (!NodePreviouslyVisited) + { + NodePreviouslyVisited = TRUE; + continue; + } + + /* No more children, visit peers */ + + ChildNode = AcpiNsGetNextNode (ParentNode, ChildNode); + if (ChildNode) + { + NodePreviouslyVisited = FALSE; + } + + /* No peers, re-visit parent */ + else { /* @@ -414,6 +455,8 @@ AcpiNsWalkNamespace ( Level--; ChildNode = ParentNode; ParentNode = AcpiNsGetParentNode (ParentNode); + + NodePreviouslyVisited = TRUE; } } diff --git a/sys/contrib/dev/acpica/namespace/nsxfeval.c b/sys/contrib/dev/acpica/namespace/nsxfeval.c index 8eedd2a..8f8ee66 100644 --- a/sys/contrib/dev/acpica/namespace/nsxfeval.c +++ b/sys/contrib/dev/acpica/namespace/nsxfeval.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -281,7 +281,7 @@ AcpiEvaluateObject ( /* Convert and validate the device handle */ - Info->PrefixNode = AcpiNsMapHandleToNode (Handle); + Info->PrefixNode = AcpiNsValidateHandle (Handle); if (!Info->PrefixNode) { Status = AE_BAD_PARAMETER; @@ -544,8 +544,11 @@ AcpiNsResolveReferences ( * PARAMETERS: Type - ACPI_OBJECT_TYPE to search for * StartObject - Handle in namespace where search begins * MaxDepth - Depth to which search is to reach - * UserFunction - Called when an object of "Type" is found - * Context - Passed to user function + * PreOrderVisit - Called during tree pre-order visit + * when an object of "Type" is found + * PostOrderVisit - Called during tree post-order visit + * when an object of "Type" is found + * Context - Passed to user function(s) above * ReturnValue - Location where return value of * UserFunction is put if terminated early * @@ -554,16 +557,16 @@ AcpiNsResolveReferences ( * * DESCRIPTION: Performs a modified depth-first walk of the namespace tree, * starting (and ending) at the object specified by StartHandle. - * The UserFunction is called whenever an object that matches - * the type parameter is found. If the user function returns + * The callback function is called whenever an object that matches + * the type parameter is found. If the callback function returns * a non-zero value, the search is terminated immediately and this * value is returned to the caller. * * The point of this procedure is to provide a generic namespace * walk routine that can be called from multiple places to - * provide multiple services; the User Function can be tailored - * to each task, whether it is a print function, a compare - * function, etc. + * provide multiple services; the callback function(s) can be + * tailored to each task, whether it is a print function, + * a compare function, etc. * ******************************************************************************/ @@ -572,7 +575,8 @@ AcpiWalkNamespace ( ACPI_OBJECT_TYPE Type, ACPI_HANDLE StartObject, UINT32 MaxDepth, - ACPI_WALK_CALLBACK UserFunction, + ACPI_WALK_CALLBACK PreOrderVisit, + ACPI_WALK_CALLBACK PostOrderVisit, void *Context, void **ReturnValue) { @@ -586,7 +590,7 @@ AcpiWalkNamespace ( if ((Type > ACPI_TYPE_LOCAL_MAX) || (!MaxDepth) || - (!UserFunction)) + (!PreOrderVisit && !PostOrderVisit)) { return_ACPI_STATUS (AE_BAD_PARAMETER); } @@ -621,7 +625,8 @@ AcpiWalkNamespace ( } Status = AcpiNsWalkNamespace (Type, StartObject, MaxDepth, - ACPI_NS_WALK_UNLOCK, UserFunction, Context, ReturnValue); + ACPI_NS_WALK_UNLOCK, PreOrderVisit, + PostOrderVisit, Context, ReturnValue); (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); @@ -658,10 +663,11 @@ AcpiNsGetDeviceCallback ( ACPI_STATUS Status; ACPI_NAMESPACE_NODE *Node; UINT32 Flags; - ACPI_DEVICE_ID Hid; - ACPI_COMPATIBLE_ID_LIST *Cid; + ACPI_DEVICE_ID *Hid; + ACPI_DEVICE_ID_LIST *Cid; UINT32 i; BOOLEAN Found; + int NoMatch; Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); @@ -670,7 +676,7 @@ AcpiNsGetDeviceCallback ( return (Status); } - Node = AcpiNsMapHandleToNode (ObjHandle); + Node = AcpiNsValidateHandle (ObjHandle); Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (Status)) { @@ -682,27 +688,20 @@ AcpiNsGetDeviceCallback ( return (AE_BAD_PARAMETER); } - /* Run _STA to determine if device is present */ - - Status = AcpiUtExecute_STA (Node, &Flags); - if (ACPI_FAILURE (Status)) - { - return (AE_CTRL_DEPTH); - } - - if (!(Flags & ACPI_STA_DEVICE_PRESENT) && - !(Flags & ACPI_STA_DEVICE_FUNCTIONING)) - { - /* - * Don't examine the children of the device only when the - * device is neither present nor functional. See ACPI spec, - * description of _STA for more information. - */ - return (AE_CTRL_DEPTH); - } - - /* Filter based on device HID & CID */ - + /* + * First, filter based on the device HID and CID. + * + * 01/2010: For this case where a specific HID is requested, we don't + * want to run _STA until we have an actual HID match. Thus, we will + * not unnecessarily execute _STA on devices for which the caller + * doesn't care about. Previously, _STA was executed unconditionally + * on all devices found here. + * + * A side-effect of this change is that now we will continue to search + * for a matching HID even under device trees where the parent device + * would have returned a _STA that indicates it is not present or + * not functioning (thus aborting the search on that branch). + */ if (Info->Hid != NULL) { Status = AcpiUtExecute_HID (Node, &Hid); @@ -715,7 +714,10 @@ AcpiNsGetDeviceCallback ( return (AE_CTRL_DEPTH); } - if (ACPI_STRNCMP (Hid.Value, Info->Hid, sizeof (Hid.Value)) != 0) + NoMatch = ACPI_STRCMP (Hid->String, Info->Hid); + ACPI_FREE (Hid); + + if (NoMatch) { /* * HID does not match, attempt match within the @@ -736,8 +738,7 @@ AcpiNsGetDeviceCallback ( Found = FALSE; for (i = 0; i < Cid->Count; i++) { - if (ACPI_STRNCMP (Cid->Id[i].Value, Info->Hid, - sizeof (ACPI_COMPATIBLE_ID)) == 0) + if (ACPI_STRCMP (Cid->Ids[i].String, Info->Hid) == 0) { /* Found a matching CID */ @@ -754,6 +755,25 @@ AcpiNsGetDeviceCallback ( } } + /* Run _STA to determine if device is present */ + + Status = AcpiUtExecute_STA (Node, &Flags); + if (ACPI_FAILURE (Status)) + { + return (AE_CTRL_DEPTH); + } + + if (!(Flags & ACPI_STA_DEVICE_PRESENT) && + !(Flags & ACPI_STA_DEVICE_FUNCTIONING)) + { + /* + * Don't examine the children of the device only when the + * device is neither present nor functional. See ACPI spec, + * description of _STA for more information. + */ + return (AE_CTRL_DEPTH); + } + /* We have a valid device, invoke the user function */ Status = Info->UserFunction (ObjHandle, NestingLevel, Info->Context, @@ -830,7 +850,7 @@ AcpiGetDevices ( Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, - AcpiNsGetDeviceCallback, &Info, ReturnValue); + AcpiNsGetDeviceCallback, NULL, &Info, ReturnValue); (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); return_ACPI_STATUS (Status); @@ -880,7 +900,7 @@ AcpiAttachData ( /* Convert and validate the handle */ - Node = AcpiNsMapHandleToNode (ObjHandle); + Node = AcpiNsValidateHandle (ObjHandle); if (!Node) { Status = AE_BAD_PARAMETER; @@ -935,7 +955,7 @@ AcpiDetachData ( /* Convert and validate the handle */ - Node = AcpiNsMapHandleToNode (ObjHandle); + Node = AcpiNsValidateHandle (ObjHandle); if (!Node) { Status = AE_BAD_PARAMETER; @@ -993,7 +1013,7 @@ AcpiGetData ( /* Convert and validate the handle */ - Node = AcpiNsMapHandleToNode (ObjHandle); + Node = AcpiNsValidateHandle (ObjHandle); if (!Node) { Status = AE_BAD_PARAMETER; diff --git a/sys/contrib/dev/acpica/namespace/nsxfname.c b/sys/contrib/dev/acpica/namespace/nsxfname.c index a2cd482..81344e1 100644 --- a/sys/contrib/dev/acpica/namespace/nsxfname.c +++ b/sys/contrib/dev/acpica/namespace/nsxfname.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -126,6 +126,14 @@ #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME ("nsxfname") +/* Local prototypes */ + +static char * +AcpiNsCopyDeviceId ( + ACPI_DEVICE_ID *Dest, + ACPI_DEVICE_ID *Source, + char *StringArea); + /****************************************************************************** * @@ -170,7 +178,7 @@ AcpiGetHandle ( if (Parent) { - PrefixNode = AcpiNsMapHandleToNode (Parent); + PrefixNode = AcpiNsValidateHandle (Parent); if (!PrefixNode) { return (AE_BAD_PARAMETER); @@ -192,7 +200,7 @@ AcpiGetHandle ( if (!ACPI_STRCMP (Pathname, ACPI_NS_ROOT_PATH)) { - *RetHandle = AcpiNsConvertEntryToHandle (AcpiGbl_RootNode); + *RetHandle = ACPI_CAST_PTR (ACPI_HANDLE, AcpiGbl_RootNode); return (AE_OK); } } @@ -208,7 +216,7 @@ AcpiGetHandle ( Status = AcpiNsGetNode (PrefixNode, Pathname, ACPI_NS_NO_UPSEARCH, &Node); if (ACPI_SUCCESS (Status)) { - *RetHandle = AcpiNsConvertEntryToHandle (Node); + *RetHandle = ACPI_CAST_PTR (ACPI_HANDLE, Node); } return (Status); @@ -274,7 +282,7 @@ AcpiGetName ( return (Status); } - Node = AcpiNsMapHandleToNode (Handle); + Node = AcpiNsValidateHandle (Handle); if (!Node) { Status = AE_BAD_PARAMETER; @@ -308,10 +316,42 @@ ACPI_EXPORT_SYMBOL (AcpiGetName) /****************************************************************************** * + * FUNCTION: AcpiNsCopyDeviceId + * + * PARAMETERS: Dest - Pointer to the destination DEVICE_ID + * Source - Pointer to the source DEVICE_ID + * StringArea - Pointer to where to copy the dest string + * + * RETURN: Pointer to the next string area + * + * DESCRIPTION: Copy a single DEVICE_ID, including the string data. + * + ******************************************************************************/ + +static char * +AcpiNsCopyDeviceId ( + ACPI_DEVICE_ID *Dest, + ACPI_DEVICE_ID *Source, + char *StringArea) +{ + /* Create the destination DEVICE_ID */ + + Dest->String = StringArea; + Dest->Length = Source->Length; + + /* Copy actual string and return a pointer to the next string area */ + + ACPI_MEMCPY (StringArea, Source->String, Source->Length); + return (StringArea + Source->Length); +} + + +/****************************************************************************** + * * FUNCTION: AcpiGetObjectInfo * - * PARAMETERS: Handle - Object Handle - * Buffer - Where the info is returned + * PARAMETERS: Handle - Object Handle + * ReturnBuffer - Where the info is returned * * RETURN: Status * @@ -319,100 +359,98 @@ ACPI_EXPORT_SYMBOL (AcpiGetName) * namespace node and possibly by running several standard * control methods (Such as in the case of a device.) * + * For Device and Processor objects, run the Device _HID, _UID, _CID, _STA, + * _ADR, _SxW, and _SxD methods. + * + * Note: Allocates the return buffer, must be freed by the caller. + * ******************************************************************************/ ACPI_STATUS AcpiGetObjectInfo ( ACPI_HANDLE Handle, - ACPI_BUFFER *Buffer) + ACPI_DEVICE_INFO **ReturnBuffer) { - ACPI_STATUS Status; ACPI_NAMESPACE_NODE *Node; ACPI_DEVICE_INFO *Info; - ACPI_DEVICE_INFO *ReturnInfo; - ACPI_COMPATIBLE_ID_LIST *CidList = NULL; - ACPI_SIZE Size; + ACPI_DEVICE_ID_LIST *CidList = NULL; + ACPI_DEVICE_ID *Hid = NULL; + ACPI_DEVICE_ID *Uid = NULL; + char *NextIdString; + ACPI_OBJECT_TYPE Type; + ACPI_NAME Name; + UINT8 ParamCount= 0; + UINT8 Valid = 0; + UINT32 InfoSize; + UINT32 i; + ACPI_STATUS Status; /* Parameter validation */ - if (!Handle || !Buffer) + if (!Handle || !ReturnBuffer) { return (AE_BAD_PARAMETER); } - Status = AcpiUtValidateBuffer (Buffer); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_DEVICE_INFO)); - if (!Info) - { - return (AE_NO_MEMORY); - } - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (Status)) { goto Cleanup; } - Node = AcpiNsMapHandleToNode (Handle); + Node = AcpiNsValidateHandle (Handle); if (!Node) { (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); - Status = AE_BAD_PARAMETER; - goto Cleanup; + return (AE_BAD_PARAMETER); } - /* Init return structure */ - - Size = sizeof (ACPI_DEVICE_INFO); + /* Get the namespace node data while the namespace is locked */ - Info->Type = Node->Type; - Info->Name = Node->Name.Integer; - Info->Valid = 0; + InfoSize = sizeof (ACPI_DEVICE_INFO); + Type = Node->Type; + Name = Node->Name.Integer; if (Node->Type == ACPI_TYPE_METHOD) { - Info->ParamCount = Node->Object->Method.ParamCount; + ParamCount = Node->Object->Method.ParamCount; } Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (Status)) { - goto Cleanup; + return (Status); } - /* If not a device, we are all done */ - - if (Info->Type == ACPI_TYPE_DEVICE) + if ((Type == ACPI_TYPE_DEVICE) || + (Type == ACPI_TYPE_PROCESSOR)) { /* - * Get extra info for ACPI Devices objects only: - * Run the Device _HID, _UID, _CID, _STA, _ADR and _SxD methods. + * Get extra info for ACPI Device/Processor objects only: + * Run the Device _HID, _UID, and _CID methods. * * Note: none of these methods are required, so they may or may - * not be present for this device. The Info->Valid bitfield is used - * to indicate which methods were found and ran successfully. + * not be present for this device. The Info->Valid bitfield is used + * to indicate which methods were found and run successfully. */ /* Execute the Device._HID method */ - Status = AcpiUtExecute_HID (Node, &Info->HardwareId); + Status = AcpiUtExecute_HID (Node, &Hid); if (ACPI_SUCCESS (Status)) { - Info->Valid |= ACPI_VALID_HID; + InfoSize += Hid->Length; + Valid |= ACPI_VALID_HID; } /* Execute the Device._UID method */ - Status = AcpiUtExecute_UID (Node, &Info->UniqueId); + Status = AcpiUtExecute_UID (Node, &Uid); if (ACPI_SUCCESS (Status)) { - Info->Valid |= ACPI_VALID_UID; + InfoSize += Uid->Length; + Valid |= ACPI_VALID_UID; } /* Execute the Device._CID method */ @@ -420,57 +458,151 @@ AcpiGetObjectInfo ( Status = AcpiUtExecute_CID (Node, &CidList); if (ACPI_SUCCESS (Status)) { - Size += CidList->Size; - Info->Valid |= ACPI_VALID_CID; + /* Add size of CID strings and CID pointer array */ + + InfoSize += (CidList->ListSize - sizeof (ACPI_DEVICE_ID_LIST)); + Valid |= ACPI_VALID_CID; } + } + + /* + * Now that we have the variable-length data, we can allocate the + * return buffer + */ + Info = ACPI_ALLOCATE_ZEROED (InfoSize); + if (!Info) + { + Status = AE_NO_MEMORY; + goto Cleanup; + } + + /* Get the fixed-length data */ + + if ((Type == ACPI_TYPE_DEVICE) || + (Type == ACPI_TYPE_PROCESSOR)) + { + /* + * Get extra info for ACPI Device/Processor objects only: + * Run the _STA, _ADR and, SxW, and _SxD methods. + * + * Note: none of these methods are required, so they may or may + * not be present for this device. The Info->Valid bitfield is used + * to indicate which methods were found and run successfully. + */ /* Execute the Device._STA method */ Status = AcpiUtExecute_STA (Node, &Info->CurrentStatus); if (ACPI_SUCCESS (Status)) { - Info->Valid |= ACPI_VALID_STA; + Valid |= ACPI_VALID_STA; } /* Execute the Device._ADR method */ Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR, Node, - &Info->Address); + &Info->Address); if (ACPI_SUCCESS (Status)) { - Info->Valid |= ACPI_VALID_ADR; + Valid |= ACPI_VALID_ADR; + } + + /* Execute the Device._SxW methods */ + + Status = AcpiUtExecutePowerMethods (Node, + AcpiGbl_LowestDstateNames, ACPI_NUM_SxW_METHODS, + Info->LowestDstates); + if (ACPI_SUCCESS (Status)) + { + Valid |= ACPI_VALID_SXWS; } /* Execute the Device._SxD methods */ - Status = AcpiUtExecute_Sxds (Node, Info->HighestDstates); + Status = AcpiUtExecutePowerMethods (Node, + AcpiGbl_HighestDstateNames, ACPI_NUM_SxD_METHODS, + Info->HighestDstates); if (ACPI_SUCCESS (Status)) { - Info->Valid |= ACPI_VALID_SXDS; + Valid |= ACPI_VALID_SXDS; } } - /* Validate/Allocate/Clear caller buffer */ - - Status = AcpiUtInitializeBuffer (Buffer, Size); - if (ACPI_FAILURE (Status)) + /* + * Create a pointer to the string area of the return buffer. + * Point to the end of the base ACPI_DEVICE_INFO structure. + */ + NextIdString = ACPI_CAST_PTR (char, Info->CompatibleIdList.Ids); + if (CidList) { - goto Cleanup; + /* Point past the CID DEVICE_ID array */ + + NextIdString += ((ACPI_SIZE) CidList->Count * sizeof (ACPI_DEVICE_ID)); } - /* Populate the return buffer */ + /* + * Copy the HID, UID, and CIDs to the return buffer. The variable-length + * strings are copied to the reserved area at the end of the buffer. + * + * For HID and CID, check if the ID is a PCI Root Bridge. + */ + if (Hid) + { + NextIdString = AcpiNsCopyDeviceId (&Info->HardwareId, + Hid, NextIdString); + + if (AcpiUtIsPciRootBridge (Hid->String)) + { + Info->Flags |= ACPI_PCI_ROOT_BRIDGE; + } + } - ReturnInfo = Buffer->Pointer; - ACPI_MEMCPY (ReturnInfo, Info, sizeof (ACPI_DEVICE_INFO)); + if (Uid) + { + NextIdString = AcpiNsCopyDeviceId (&Info->UniqueId, + Uid, NextIdString); + } if (CidList) { - ACPI_MEMCPY (&ReturnInfo->CompatibilityId, CidList, CidList->Size); + Info->CompatibleIdList.Count = CidList->Count; + Info->CompatibleIdList.ListSize = CidList->ListSize; + + /* Copy each CID */ + + for (i = 0; i < CidList->Count; i++) + { + NextIdString = AcpiNsCopyDeviceId (&Info->CompatibleIdList.Ids[i], + &CidList->Ids[i], NextIdString); + + if (AcpiUtIsPciRootBridge (CidList->Ids[i].String)) + { + Info->Flags |= ACPI_PCI_ROOT_BRIDGE; + } + } } + /* Copy the fixed-length data */ + + Info->InfoSize = InfoSize; + Info->Type = Type; + Info->Name = Name; + Info->ParamCount = ParamCount; + Info->Valid = Valid; + + *ReturnBuffer = Info; + Status = AE_OK; + Cleanup: - ACPI_FREE (Info); + if (Hid) + { + ACPI_FREE (Hid); + } + if (Uid) + { + ACPI_FREE (Uid); + } if (CidList) { ACPI_FREE (CidList); diff --git a/sys/contrib/dev/acpica/namespace/nsxfobj.c b/sys/contrib/dev/acpica/namespace/nsxfobj.c index 26859ef..b43917b 100644 --- a/sys/contrib/dev/acpica/namespace/nsxfobj.c +++ b/sys/contrib/dev/acpica/namespace/nsxfobj.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -172,7 +172,7 @@ AcpiGetType ( /* Convert and validate the handle */ - Node = AcpiNsMapHandleToNode (Handle); + Node = AcpiNsValidateHandle (Handle); if (!Node) { (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); @@ -233,7 +233,7 @@ AcpiGetParent ( /* Convert and validate the handle */ - Node = AcpiNsMapHandleToNode (Handle); + Node = AcpiNsValidateHandle (Handle); if (!Node) { Status = AE_BAD_PARAMETER; @@ -243,7 +243,7 @@ AcpiGetParent ( /* Get the parent entry */ ParentNode = AcpiNsGetParentNode (Node); - *RetHandle = AcpiNsConvertEntryToHandle (ParentNode); + *RetHandle = ACPI_CAST_PTR (ACPI_HANDLE, ParentNode); /* Return exception if parent is null */ @@ -312,7 +312,7 @@ AcpiGetNextObject ( { /* Start search at the beginning of the specified scope */ - ParentNode = AcpiNsMapHandleToNode (Parent); + ParentNode = AcpiNsValidateHandle (Parent); if (!ParentNode) { Status = AE_BAD_PARAMETER; @@ -324,7 +324,7 @@ AcpiGetNextObject ( /* Non-null handle, ignore the parent */ /* Convert and validate the handle */ - ChildNode = AcpiNsMapHandleToNode (Child); + ChildNode = AcpiNsValidateHandle (Child); if (!ChildNode) { Status = AE_BAD_PARAMETER; @@ -343,7 +343,7 @@ AcpiGetNextObject ( if (RetHandle) { - *RetHandle = AcpiNsConvertEntryToHandle (Node); + *RetHandle = ACPI_CAST_PTR (ACPI_HANDLE, Node); } diff --git a/sys/contrib/dev/acpica/osunixxf.c b/sys/contrib/dev/acpica/osunixxf.c index 727916e..a0e38e4 100644 --- a/sys/contrib/dev/acpica/osunixxf.c +++ b/sys/contrib/dev/acpica/osunixxf.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -871,7 +871,7 @@ AcpiOsStall ( void AcpiOsSleep ( - ACPI_INTEGER milliseconds) + UINT64 milliseconds) { sleep (milliseconds / 1000); /* Sleep for whole seconds */ @@ -976,7 +976,7 @@ ACPI_STATUS AcpiOsWritePciConfiguration ( ACPI_PCI_ID *PciId, UINT32 Register, - ACPI_INTEGER Value, + UINT64 Value, UINT32 Width) { diff --git a/sys/contrib/dev/acpica/parser/psargs.c b/sys/contrib/dev/acpica/parser/psargs.c index c36982c..275993d 100644 --- a/sys/contrib/dev/acpica/parser/psargs.c +++ b/sys/contrib/dev/acpica/parser/psargs.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -514,7 +514,7 @@ AcpiPsGetNextSimpleArg ( /* Get 1 byte from the AML stream */ Opcode = AML_BYTE_OP; - Arg->Common.Value.Integer = (ACPI_INTEGER) *Aml; + Arg->Common.Value.Integer = (UINT64) *Aml; Length = 1; break; diff --git a/sys/contrib/dev/acpica/parser/psloop.c b/sys/contrib/dev/acpica/parser/psloop.c index 09cbafe..73bfdf8 100644 --- a/sys/contrib/dev/acpica/parser/psloop.c +++ b/sys/contrib/dev/acpica/parser/psloop.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -171,6 +171,13 @@ AcpiPsCompleteFinalOp ( ACPI_PARSE_OBJECT *Op, ACPI_STATUS Status); +static void +AcpiPsLinkModuleCode ( + ACPI_PARSE_OBJECT *ParentOp, + UINT8 *AmlStart, + UINT32 AmlLength, + ACPI_OWNER_ID OwnerId); + /******************************************************************************* * @@ -502,6 +509,7 @@ AcpiPsGetArguments ( { ACPI_STATUS Status = AE_OK; ACPI_PARSE_OBJECT *Arg = NULL; + const ACPI_OPCODE_INFO *OpInfo; ACPI_FUNCTION_TRACE_PTR (PsGetArguments, WalkState); @@ -558,13 +566,11 @@ AcpiPsGetArguments ( } - /* Special processing for certain opcodes */ - - /* TBD (remove): Temporary mechanism to disable this code if needed */ - -#ifdef ACPI_ENABLE_MODULE_LEVEL_CODE - - if ((WalkState->PassNumber <= ACPI_IMODE_LOAD_PASS1) && + /* + * Handle executable code at "module-level". This refers to + * executable opcodes that appear outside of any control method. + */ + if ((WalkState->PassNumber <= ACPI_IMODE_LOAD_PASS2) && ((WalkState->ParseFlags & ACPI_PARSE_DISASSEMBLE) == 0)) { /* @@ -580,6 +586,19 @@ AcpiPsGetArguments ( case AML_ELSE_OP: case AML_WHILE_OP: + /* + * Currently supported module-level opcodes are: + * IF/ELSE/WHILE. These appear to be the most common, + * and easiest to support since they open an AML + * package. + */ + if (WalkState->PassNumber == ACPI_IMODE_LOAD_PASS1) + { + AcpiPsLinkModuleCode (Op->Common.Parent, AmlOpStart, + (UINT32) (WalkState->ParserState.PkgEnd - AmlOpStart), + WalkState->OwnerId); + } + ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Pass1: Skipping an If/Else/While body\n")); @@ -590,10 +609,33 @@ AcpiPsGetArguments ( break; default: + /* + * Check for an unsupported executable opcode at module + * level. We must be in PASS1, the parent must be a SCOPE, + * The opcode class must be EXECUTE, and the opcode must + * not be an argument to another opcode. + */ + if ((WalkState->PassNumber == ACPI_IMODE_LOAD_PASS1) && + (Op->Common.Parent->Common.AmlOpcode == AML_SCOPE_OP)) + { + OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); + if ((OpInfo->Class == AML_CLASS_EXECUTE) && + (!Arg)) + { + ACPI_WARNING ((AE_INFO, + "Detected an unsupported executable opcode " + "at module-level: [0x%.4X] at table offset 0x%.4X", + Op->Common.AmlOpcode, + (UINT32) (ACPI_PTR_DIFF (AmlOpStart, + WalkState->ParserState.AmlStart) + + sizeof (ACPI_TABLE_HEADER)))); + } + } break; } } -#endif + + /* Special processing for certain opcodes */ switch (Op->Common.AmlOpcode) { @@ -661,6 +703,97 @@ AcpiPsGetArguments ( /******************************************************************************* * + * FUNCTION: AcpiPsLinkModuleCode + * + * PARAMETERS: ParentOp - Parent parser op + * AmlStart - Pointer to the AML + * AmlLength - Length of executable AML + * OwnerId - OwnerId of module level code + * + * RETURN: None. + * + * DESCRIPTION: Wrap the module-level code with a method object and link the + * object to the global list. Note, the mutex field of the method + * object is used to link multiple module-level code objects. + * + ******************************************************************************/ + +static void +AcpiPsLinkModuleCode ( + ACPI_PARSE_OBJECT *ParentOp, + UINT8 *AmlStart, + UINT32 AmlLength, + ACPI_OWNER_ID OwnerId) +{ + ACPI_OPERAND_OBJECT *Prev; + ACPI_OPERAND_OBJECT *Next; + ACPI_OPERAND_OBJECT *MethodObj; + ACPI_NAMESPACE_NODE *ParentNode; + + + /* Get the tail of the list */ + + Prev = Next = AcpiGbl_ModuleCodeList; + while (Next) + { + Prev = Next; + Next = Next->Method.Mutex; + } + + /* + * Insert the module level code into the list. Merge it if it is + * adjacent to the previous element. + */ + if (!Prev || + ((Prev->Method.AmlStart + Prev->Method.AmlLength) != AmlStart)) + { + /* Create, initialize, and link a new temporary method object */ + + MethodObj = AcpiUtCreateInternalObject (ACPI_TYPE_METHOD); + if (!MethodObj) + { + return; + } + + if (ParentOp->Common.Node) + { + ParentNode = ParentOp->Common.Node; + } + else + { + ParentNode = AcpiGbl_RootNode; + } + + MethodObj->Method.AmlStart = AmlStart; + MethodObj->Method.AmlLength = AmlLength; + MethodObj->Method.OwnerId = OwnerId; + MethodObj->Method.Flags |= AOPOBJ_MODULE_LEVEL; + + /* + * Save the parent node in NextObject. This is cheating, but we + * don't want to expand the method object. + */ + MethodObj->Method.NextObject = + ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, ParentNode); + + if (!Prev) + { + AcpiGbl_ModuleCodeList = MethodObj; + } + else + { + Prev->Method.Mutex = MethodObj; + } + } + else + { + Prev->Method.AmlLength += AmlLength; + } +} + + +/******************************************************************************* + * * FUNCTION: AcpiPsCompleteOp * * PARAMETERS: WalkState - Current state diff --git a/sys/contrib/dev/acpica/parser/psopcode.c b/sys/contrib/dev/acpica/parser/psopcode.c index 9ce095f..6b65d79 100644 --- a/sys/contrib/dev/acpica/parser/psopcode.c +++ b/sys/contrib/dev/acpica/parser/psopcode.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/parser/psparse.c b/sys/contrib/dev/acpica/parser/psparse.c index eda132b..22783c2 100644 --- a/sys/contrib/dev/acpica/parser/psparse.c +++ b/sys/contrib/dev/acpica/parser/psparse.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -705,13 +705,11 @@ AcpiPsParseAml ( !PreviousWalkState->ImplicitReturnObj) { PreviousWalkState->ImplicitReturnObj = - AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); + AcpiUtCreateIntegerObject ((UINT64) 0); if (!PreviousWalkState->ImplicitReturnObj) { return_ACPI_STATUS (AE_NO_MEMORY); } - - PreviousWalkState->ImplicitReturnObj->Integer.Value = 0; } /* Restart the calling control method */ diff --git a/sys/contrib/dev/acpica/parser/psscope.c b/sys/contrib/dev/acpica/parser/psscope.c index ce50c4a..bf72f45 100644 --- a/sys/contrib/dev/acpica/parser/psscope.c +++ b/sys/contrib/dev/acpica/parser/psscope.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/parser/pstree.c b/sys/contrib/dev/acpica/parser/pstree.c index d29b561..f4ffe4b 100644 --- a/sys/contrib/dev/acpica/parser/pstree.c +++ b/sys/contrib/dev/acpica/parser/pstree.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/parser/psutils.c b/sys/contrib/dev/acpica/parser/psutils.c index c67ef36..c34d015 100644 --- a/sys/contrib/dev/acpica/parser/psutils.c +++ b/sys/contrib/dev/acpica/parser/psutils.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/parser/pswalk.c b/sys/contrib/dev/acpica/parser/pswalk.c index f5f3e90..321d96e 100644 --- a/sys/contrib/dev/acpica/parser/pswalk.c +++ b/sys/contrib/dev/acpica/parser/pswalk.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/parser/psxface.c b/sys/contrib/dev/acpica/parser/psxface.c index 5e9a491..e9fc45d 100644 --- a/sys/contrib/dev/acpica/parser/psxface.c +++ b/sys/contrib/dev/acpica/parser/psxface.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -394,11 +394,16 @@ AcpiPsExecuteMethod ( goto Cleanup; } + if (Info->ObjDesc->Method.Flags & AOPOBJ_MODULE_LEVEL) + { + WalkState->ParseFlags |= ACPI_PARSE_MODULE_LEVEL; + } + /* Invoke an internal method if necessary */ if (Info->ObjDesc->Method.MethodFlags & AML_METHOD_INTERNAL_ONLY) { - Status = Info->ObjDesc->Method.Implementation (WalkState); + Status = Info->ObjDesc->Method.Extra.Implementation (WalkState); Info->ReturnObject = WalkState->ReturnDesc; /* Cleanup states */ @@ -417,15 +422,13 @@ AcpiPsExecuteMethod ( if (AcpiGbl_EnableInterpreterSlack) { WalkState->ImplicitReturnObj = - AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); + AcpiUtCreateIntegerObject ((UINT64) 0); if (!WalkState->ImplicitReturnObj) { Status = AE_NO_MEMORY; AcpiDsDeleteWalkState (WalkState); goto Cleanup; } - - WalkState->ImplicitReturnObj->Integer.Value = 0; } /* Parse the AML */ diff --git a/sys/contrib/dev/acpica/resources/rsaddr.c b/sys/contrib/dev/acpica/resources/rsaddr.c index f3ce107..7ce78a5 100644 --- a/sys/contrib/dev/acpica/resources/rsaddr.c +++ b/sys/contrib/dev/acpica/resources/rsaddr.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/resources/rscalc.c b/sys/contrib/dev/acpica/resources/rscalc.c index 8ef95f8..d3aca94 100644 --- a/sys/contrib/dev/acpica/resources/rscalc.c +++ b/sys/contrib/dev/acpica/resources/rscalc.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/resources/rscreate.c b/sys/contrib/dev/acpica/resources/rscreate.c index d63c7c4..8e460d2 100644 --- a/sys/contrib/dev/acpica/resources/rscreate.c +++ b/sys/contrib/dev/acpica/resources/rscreate.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -270,7 +270,7 @@ AcpiRsCreatePciRoutingTable ( /* * Loop through the ACPI_INTERNAL_OBJECTS - Each object should be a - * package that in turn contains an ACPI_INTEGER Address, a UINT8 Pin, + * package that in turn contains an UINT64 Address, a UINT8 Pin, * a Name, and a UINT8 SourceIndex. */ TopObjectList = PackageObject->Package.Elements; diff --git a/sys/contrib/dev/acpica/resources/rsdump.c b/sys/contrib/dev/acpica/resources/rsdump.c index e9d54d6..d73a071 100644 --- a/sys/contrib/dev/acpica/resources/rsdump.c +++ b/sys/contrib/dev/acpica/resources/rsdump.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/resources/rsinfo.c b/sys/contrib/dev/acpica/resources/rsinfo.c index e52c6fd..f1bb441 100644 --- a/sys/contrib/dev/acpica/resources/rsinfo.c +++ b/sys/contrib/dev/acpica/resources/rsinfo.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/resources/rsio.c b/sys/contrib/dev/acpica/resources/rsio.c index 9806f60..946b4d4 100644 --- a/sys/contrib/dev/acpica/resources/rsio.c +++ b/sys/contrib/dev/acpica/resources/rsio.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/resources/rsirq.c b/sys/contrib/dev/acpica/resources/rsirq.c index 54e0422..c409dc1 100644 --- a/sys/contrib/dev/acpica/resources/rsirq.c +++ b/sys/contrib/dev/acpica/resources/rsirq.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/resources/rslist.c b/sys/contrib/dev/acpica/resources/rslist.c index 44c2f02..1b73cf2 100644 --- a/sys/contrib/dev/acpica/resources/rslist.c +++ b/sys/contrib/dev/acpica/resources/rslist.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/resources/rsmemory.c b/sys/contrib/dev/acpica/resources/rsmemory.c index c20fe56..b7c64a2 100644 --- a/sys/contrib/dev/acpica/resources/rsmemory.c +++ b/sys/contrib/dev/acpica/resources/rsmemory.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/resources/rsmisc.c b/sys/contrib/dev/acpica/resources/rsmisc.c index 7ad344f..37c1a05 100644 --- a/sys/contrib/dev/acpica/resources/rsmisc.c +++ b/sys/contrib/dev/acpica/resources/rsmisc.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/resources/rsutils.c b/sys/contrib/dev/acpica/resources/rsutils.c index fabea69..b0cd538 100644 --- a/sys/contrib/dev/acpica/resources/rsutils.c +++ b/sys/contrib/dev/acpica/resources/rsutils.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/resources/rsxface.c b/sys/contrib/dev/acpica/resources/rsxface.c index b72d58b..3e6399c 100644 --- a/sys/contrib/dev/acpica/resources/rsxface.c +++ b/sys/contrib/dev/acpica/resources/rsxface.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -191,7 +191,7 @@ AcpiRsValidateParameters ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - Node = AcpiNsMapHandleToNode (DeviceHandle); + Node = AcpiNsValidateHandle (DeviceHandle); if (!Node) { return_ACPI_STATUS (AE_BAD_PARAMETER); diff --git a/sys/contrib/dev/acpica/tables/tbfadt.c b/sys/contrib/dev/acpica/tables/tbfadt.c index e6e4679..7f2ae36 100644 --- a/sys/contrib/dev/acpica/tables/tbfadt.c +++ b/sys/contrib/dev/acpica/tables/tbfadt.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/tables/tbfind.c b/sys/contrib/dev/acpica/tables/tbfind.c index a3a862d..d6cee63 100644 --- a/sys/contrib/dev/acpica/tables/tbfind.c +++ b/sys/contrib/dev/acpica/tables/tbfind.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/tables/tbinstal.c b/sys/contrib/dev/acpica/tables/tbinstal.c index d03b294..be55612 100644 --- a/sys/contrib/dev/acpica/tables/tbinstal.c +++ b/sys/contrib/dev/acpica/tables/tbinstal.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/tables/tbutils.c b/sys/contrib/dev/acpica/tables/tbutils.c index 28cd8dc..25b0652 100644 --- a/sys/contrib/dev/acpica/tables/tbutils.c +++ b/sys/contrib/dev/acpica/tables/tbutils.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -124,6 +124,16 @@ /* Local prototypes */ +static void +AcpiTbFixString ( + char *String, + ACPI_SIZE Length); + +static void +AcpiTbCleanupTableHeader ( + ACPI_TABLE_HEADER *OutHeader, + ACPI_TABLE_HEADER *Header); + static ACPI_PHYSICAL_ADDRESS AcpiTbGetRootTableEntry ( UINT8 *TableEntry, @@ -185,6 +195,67 @@ AcpiTbTablesLoaded ( /******************************************************************************* * + * FUNCTION: AcpiTbFixString + * + * PARAMETERS: String - String to be repaired + * Length - Maximum length + * + * RETURN: None + * + * DESCRIPTION: Replace every non-printable or non-ascii byte in the string + * with a question mark '?'. + * + ******************************************************************************/ + +static void +AcpiTbFixString ( + char *String, + ACPI_SIZE Length) +{ + + while (Length && *String) + { + if (!ACPI_IS_PRINT (*String)) + { + *String = '?'; + } + String++; + Length--; + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiTbCleanupTableHeader + * + * PARAMETERS: OutHeader - Where the cleaned header is returned + * Header - Input ACPI table header + * + * RETURN: Returns the cleaned header in OutHeader + * + * DESCRIPTION: Copy the table header and ensure that all "string" fields in + * the header consist of printable characters. + * + ******************************************************************************/ + +static void +AcpiTbCleanupTableHeader ( + ACPI_TABLE_HEADER *OutHeader, + ACPI_TABLE_HEADER *Header) +{ + + ACPI_MEMCPY (OutHeader, Header, sizeof (ACPI_TABLE_HEADER)); + + AcpiTbFixString (OutHeader->Signature, ACPI_NAME_SIZE); + AcpiTbFixString (OutHeader->OemId, ACPI_OEM_ID_SIZE); + AcpiTbFixString (OutHeader->OemTableId, ACPI_OEM_TABLE_ID_SIZE); + AcpiTbFixString (OutHeader->AslCompilerId, ACPI_NAME_SIZE); +} + + +/******************************************************************************* + * * FUNCTION: AcpiTbPrintTableHeader * * PARAMETERS: Address - Table physical address @@ -201,6 +272,8 @@ AcpiTbPrintTableHeader ( ACPI_PHYSICAL_ADDRESS Address, ACPI_TABLE_HEADER *Header) { + ACPI_TABLE_HEADER LocalHeader; + /* * The reason that the Address is cast to a void pointer is so that we @@ -218,23 +291,29 @@ AcpiTbPrintTableHeader ( { /* RSDP has no common fields */ + ACPI_MEMCPY (LocalHeader.OemId, + ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->OemId, ACPI_OEM_ID_SIZE); + AcpiTbFixString (LocalHeader.OemId, ACPI_OEM_ID_SIZE); + ACPI_INFO ((AE_INFO, "RSDP %p %05X (v%.2d %6.6s)", ACPI_CAST_PTR (void, Address), (ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->Revision > 0) ? ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->Length : 20, ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->Revision, - ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->OemId)); + LocalHeader.OemId)); } else { /* Standard ACPI table with full common header */ + AcpiTbCleanupTableHeader (&LocalHeader, Header); + ACPI_INFO ((AE_INFO, "%4.4s %p %05X (v%.2d %6.6s %8.8s %08X %4.4s %08X)", - Header->Signature, ACPI_CAST_PTR (void, Address), - Header->Length, Header->Revision, Header->OemId, - Header->OemTableId, Header->OemRevision, Header->AslCompilerId, - Header->AslCompilerRevision)); + LocalHeader.Signature, ACPI_CAST_PTR (void, Address), + LocalHeader.Length, LocalHeader.Revision, LocalHeader.OemId, + LocalHeader.OemTableId, LocalHeader.OemRevision, + LocalHeader.AslCompilerId, LocalHeader.AslCompilerRevision)); } } diff --git a/sys/contrib/dev/acpica/tables/tbxface.c b/sys/contrib/dev/acpica/tables/tbxface.c index e6e9a29..26f9472 100644 --- a/sys/contrib/dev/acpica/tables/tbxface.c +++ b/sys/contrib/dev/acpica/tables/tbxface.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/tables/tbxfroot.c b/sys/contrib/dev/acpica/tables/tbxfroot.c index c0d2b75..021e2b6 100644 --- a/sys/contrib/dev/acpica/tables/tbxfroot.c +++ b/sys/contrib/dev/acpica/tables/tbxfroot.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/tools/acpiexec/aecommon.h b/sys/contrib/dev/acpica/tools/acpiexec/aecommon.h index 21d9cbd..0ceddea 100644 --- a/sys/contrib/dev/acpica/tools/acpiexec/aecommon.h +++ b/sys/contrib/dev/acpica/tools/acpiexec/aecommon.h @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -135,8 +135,17 @@ #include <contrib/dev/acpica/include/acinterp.h> #include <contrib/dev/acpica/include/acapps.h> -extern FILE *AcpiGbl_DebugFile; -extern BOOLEAN AcpiGbl_IgnoreErrors; +extern FILE *AcpiGbl_DebugFile; +extern BOOLEAN AcpiGbl_IgnoreErrors; +extern UINT8 AcpiGbl_RegionFillValue; + + +typedef struct ae_table_desc +{ + ACPI_TABLE_HEADER *Table; + struct ae_table_desc *Next; + +} AE_TABLE_DESC; /* * Debug Regions @@ -170,7 +179,8 @@ AeCtrlCHandler ( ACPI_STATUS AeBuildLocalTables ( - ACPI_TABLE_HEADER *UserTable); + UINT32 TableCount, + AE_TABLE_DESC *TableList); ACPI_STATUS AeInstallTables ( @@ -222,7 +232,7 @@ AeRegionHandler ( UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, - ACPI_INTEGER *Value, + UINT64 *Value, void *HandlerContext, void *RegionContext); diff --git a/sys/contrib/dev/acpica/utilities/utalloc.c b/sys/contrib/dev/acpica/utilities/utalloc.c index aff2e1c..8c6ed0b 100644 --- a/sys/contrib/dev/acpica/utilities/utalloc.c +++ b/sys/contrib/dev/acpica/utilities/utalloc.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/utilities/utcache.c b/sys/contrib/dev/acpica/utilities/utcache.c index 42bef0c..cb487a1 100644 --- a/sys/contrib/dev/acpica/utilities/utcache.c +++ b/sys/contrib/dev/acpica/utilities/utcache.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/utilities/utcopy.c b/sys/contrib/dev/acpica/utilities/utcopy.c index 8d919ab..b16e14c 100644 --- a/sys/contrib/dev/acpica/utilities/utcopy.c +++ b/sys/contrib/dev/acpica/utilities/utcopy.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -422,11 +422,11 @@ AcpiUtCopyIelementToEelement ( * RETURN: Status * * DESCRIPTION: This function is called to place a package object in a user - * buffer. A package object by definition contains other objects. + * buffer. A package object by definition contains other objects. * * The buffer is assumed to have sufficient space for the object. - * The caller must have verified the buffer length needed using the - * AcpiUtGetObjectSize function before calling this function. + * The caller must have verified the buffer length needed using + * the AcpiUtGetObjectSize function before calling this function. * ******************************************************************************/ @@ -485,12 +485,12 @@ AcpiUtCopyIpackageToEpackage ( * FUNCTION: AcpiUtCopyIobjectToEobject * * PARAMETERS: InternalObject - The internal object to be converted - * BufferPtr - Where the object is returned + * RetBuffer - Where the object is returned * * RETURN: Status * - * DESCRIPTION: This function is called to build an API object to be returned to - * the caller. + * DESCRIPTION: This function is called to build an API object to be returned + * to the caller. * ******************************************************************************/ @@ -742,7 +742,7 @@ AcpiUtCopyEpackageToIpackage ( * PARAMETERS: ExternalObject - The external object to be converted * InternalObject - Where the internal object is returned * - * RETURN: Status - the status of the call + * RETURN: Status * * DESCRIPTION: Converts an external object to an internal object. * @@ -784,7 +784,7 @@ AcpiUtCopyEobjectToIobject ( * * RETURN: Status * - * DESCRIPTION: Simple copy of one internal object to another. Reference count + * DESCRIPTION: Simple copy of one internal object to another. Reference count * of the destination object is preserved. * ******************************************************************************/ @@ -1034,10 +1034,11 @@ ErrorExit: * * FUNCTION: AcpiUtCopyIpackageToIpackage * - * PARAMETERS: *SourceObj - Pointer to the source package object - * *DestObj - Where the internal object is returned + * PARAMETERS: SourceObj - Pointer to the source package object + * DestObj - Where the internal object is returned + * WalkState - Current Walk state descriptor * - * RETURN: Status - the status of the call + * RETURN: Status * * DESCRIPTION: This function is called to copy an internal package object * into another internal package object. @@ -1093,9 +1094,9 @@ AcpiUtCopyIpackageToIpackage ( * * FUNCTION: AcpiUtCopyIobjectToIobject * - * PARAMETERS: WalkState - Current walk state - * SourceDesc - The internal object to be copied + * PARAMETERS: SourceDesc - The internal object to be copied * DestDesc - Where the copied object is returned + * WalkState - Current walk state * * RETURN: Status * diff --git a/sys/contrib/dev/acpica/utilities/utdebug.c b/sys/contrib/dev/acpica/utilities/utdebug.c index 9dacaab..99670b5 100644 --- a/sys/contrib/dev/acpica/utilities/utdebug.c +++ b/sys/contrib/dev/acpica/utilities/utdebug.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -598,7 +598,7 @@ AcpiUtValueExit ( const char *FunctionName, const char *ModuleName, UINT32 ComponentId, - ACPI_INTEGER Value) + UINT64 Value) { AcpiDebugPrint (ACPI_LV_FUNCTIONS, diff --git a/sys/contrib/dev/acpica/utilities/utdelete.c b/sys/contrib/dev/acpica/utilities/utdelete.c index 1b975a2..bd6490d 100644 --- a/sys/contrib/dev/acpica/utilities/utdelete.c +++ b/sys/contrib/dev/acpica/utilities/utdelete.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/utilities/uteval.c b/sys/contrib/dev/acpica/utilities/uteval.c index 9241afa..be1e45e 100644 --- a/sys/contrib/dev/acpica/utilities/uteval.c +++ b/sys/contrib/dev/acpica/utilities/uteval.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -118,32 +118,18 @@ #include <contrib/dev/acpica/include/acpi.h> #include <contrib/dev/acpica/include/accommon.h> #include <contrib/dev/acpica/include/acnamesp.h> -#include <contrib/dev/acpica/include/acinterp.h> #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("uteval") -/* Local prototypes */ - -static void -AcpiUtCopyIdString ( - char *Destination, - char *Source, - ACPI_SIZE MaxLength); - -static ACPI_STATUS -AcpiUtTranslateOneCid ( - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_COMPATIBLE_ID *OneCid); - /* * Strings supported by the _OSI predefined (internal) method. * * March 2009: Removed "Linux" as this host no longer wants to respond true * for this string. Basically, the only safe OS strings are windows-related - * and in many or most cases represent the only test path within the + * and in many or most cases represent the only test path within the * BIOS-provided ASL code. * * The second element of each entry is used to track the newest version of @@ -160,6 +146,9 @@ static const ACPI_INTERFACE_INFO AcpiInterfacesSupported[] = {"Windows 2001 SP2", ACPI_OSI_WIN_XP_SP2}, /* Windows XP SP2 */ {"Windows 2001.1 SP1", ACPI_OSI_WINSRV_2003_SP1}, /* Windows Server 2003 SP1 - Added 03/2006 */ {"Windows 2006", ACPI_OSI_WIN_VISTA}, /* Windows Vista - Added 03/2006 */ + {"Windows 2006.1", ACPI_OSI_WINSRV_2008}, /* Windows Server 2008 - Added 09/2009 */ + {"Windows 2006 SP1", ACPI_OSI_WIN_VISTA_SP1}, /* Windows Vista SP1 - Added 09/2009 */ + {"Windows 2009", ACPI_OSI_WIN_7}, /* Windows 7 and Server 2008 R2 - Added 09/2009 */ /* Feature Group Strings */ @@ -280,7 +269,7 @@ Exit: * RETURN: Status * * DESCRIPTION: Evaluates a namespace object and verifies the type of the - * return object. Common code that simplifies accessing objects + * return object. Common code that simplifies accessing objects * that have required return objects of fixed types. * * NOTE: Internal function, no parameter validation @@ -376,7 +365,7 @@ AcpiUtEvaluateObject ( (!ExpectedReturnBtypes)) { /* - * We received a return object, but one was not expected. This can + * We received a return object, but one was not expected. This can * happen frequently if the "implicit return" feature is enabled. * Just delete the return object and return AE_OK. */ @@ -419,12 +408,12 @@ Cleanup: * * PARAMETERS: ObjectName - Object name to be evaluated * DeviceNode - Node for the device - * Address - Where the value is returned + * Value - Where the value is returned * * RETURN: Status * * DESCRIPTION: Evaluates a numeric namespace object for a selected device - * and stores result in *Address. + * and stores result in *Value. * * NOTE: Internal function, no parameter validation * @@ -434,7 +423,7 @@ ACPI_STATUS AcpiUtEvaluateNumericObject ( char *ObjectName, ACPI_NAMESPACE_NODE *DeviceNode, - ACPI_INTEGER *Address) + UINT64 *Value) { ACPI_OPERAND_OBJECT *ObjDesc; ACPI_STATUS Status; @@ -452,326 +441,7 @@ AcpiUtEvaluateNumericObject ( /* Get the returned Integer */ - *Address = ObjDesc->Integer.Value; - - /* On exit, we must delete the return object */ - - AcpiUtRemoveReference (ObjDesc); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtCopyIdString - * - * PARAMETERS: Destination - Where to copy the string - * Source - Source string - * MaxLength - Length of the destination buffer - * - * RETURN: None - * - * DESCRIPTION: Copies an ID string for the _HID, _CID, and _UID methods. - * Performs removal of a leading asterisk if present -- workaround - * for a known issue on a bunch of machines. - * - ******************************************************************************/ - -static void -AcpiUtCopyIdString ( - char *Destination, - char *Source, - ACPI_SIZE MaxLength) -{ - - /* - * Workaround for ID strings that have a leading asterisk. This construct - * is not allowed by the ACPI specification (ID strings must be - * alphanumeric), but enough existing machines have this embedded in their - * ID strings that the following code is useful. - */ - if (*Source == '*') - { - Source++; - } - - /* Do the actual copy */ - - ACPI_STRNCPY (Destination, Source, MaxLength); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtExecute_HID - * - * PARAMETERS: DeviceNode - Node for the device - * Hid - Where the HID is returned - * - * RETURN: Status - * - * DESCRIPTION: Executes the _HID control method that returns the hardware - * ID of the device. - * - * NOTE: Internal function, no parameter validation - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtExecute_HID ( - ACPI_NAMESPACE_NODE *DeviceNode, - ACPI_DEVICE_ID *Hid) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (UtExecute_HID); - - - Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__HID, - ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, &ObjDesc); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - if (ObjDesc->Common.Type == ACPI_TYPE_INTEGER) - { - /* Convert the Numeric HID to string */ - - AcpiExEisaIdToString ((UINT32) ObjDesc->Integer.Value, Hid->Value); - } - else - { - /* Copy the String HID from the returned object */ - - AcpiUtCopyIdString (Hid->Value, ObjDesc->String.Pointer, - sizeof (Hid->Value)); - } - - /* On exit, we must delete the return object */ - - AcpiUtRemoveReference (ObjDesc); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtTranslateOneCid - * - * PARAMETERS: ObjDesc - _CID object, must be integer or string - * OneCid - Where the CID string is returned - * - * RETURN: Status - * - * DESCRIPTION: Return a numeric or string _CID value as a string. - * (Compatible ID) - * - * NOTE: Assumes a maximum _CID string length of - * ACPI_MAX_CID_LENGTH. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiUtTranslateOneCid ( - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_COMPATIBLE_ID *OneCid) -{ - - - switch (ObjDesc->Common.Type) - { - case ACPI_TYPE_INTEGER: - - /* Convert the Numeric CID to string */ - - AcpiExEisaIdToString ((UINT32) ObjDesc->Integer.Value, OneCid->Value); - return (AE_OK); - - case ACPI_TYPE_STRING: - - if (ObjDesc->String.Length > ACPI_MAX_CID_LENGTH) - { - return (AE_AML_STRING_LIMIT); - } - - /* Copy the String CID from the returned object */ - - AcpiUtCopyIdString (OneCid->Value, ObjDesc->String.Pointer, - ACPI_MAX_CID_LENGTH); - return (AE_OK); - - default: - - return (AE_TYPE); - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtExecute_CID - * - * PARAMETERS: DeviceNode - Node for the device - * ReturnCidList - Where the CID list is returned - * - * RETURN: Status - * - * DESCRIPTION: Executes the _CID control method that returns one or more - * compatible hardware IDs for the device. - * - * NOTE: Internal function, no parameter validation - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtExecute_CID ( - ACPI_NAMESPACE_NODE *DeviceNode, - ACPI_COMPATIBLE_ID_LIST **ReturnCidList) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_STATUS Status; - UINT32 Count; - UINT32 Size; - ACPI_COMPATIBLE_ID_LIST *CidList; - UINT32 i; - - - ACPI_FUNCTION_TRACE (UtExecute_CID); - - - /* Evaluate the _CID method for this device */ - - Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__CID, - ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_PACKAGE, - &ObjDesc); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Get the number of _CIDs returned */ - - Count = 1; - if (ObjDesc->Common.Type == ACPI_TYPE_PACKAGE) - { - Count = ObjDesc->Package.Count; - } - - /* Allocate a worst-case buffer for the _CIDs */ - - Size = (((Count - 1) * sizeof (ACPI_COMPATIBLE_ID)) + - sizeof (ACPI_COMPATIBLE_ID_LIST)); - - CidList = ACPI_ALLOCATE_ZEROED ((ACPI_SIZE) Size); - if (!CidList) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* Init CID list */ - - CidList->Count = Count; - CidList->Size = Size; - - /* - * A _CID can return either a single compatible ID or a package of - * compatible IDs. Each compatible ID can be one of the following: - * 1) Integer (32 bit compressed EISA ID) or - * 2) String (PCI ID format, e.g. "PCI\VEN_vvvv&DEV_dddd&SUBSYS_ssssssss") - */ - - /* The _CID object can be either a single CID or a package (list) of CIDs */ - - if (ObjDesc->Common.Type == ACPI_TYPE_PACKAGE) - { - /* Translate each package element */ - - for (i = 0; i < Count; i++) - { - Status = AcpiUtTranslateOneCid (ObjDesc->Package.Elements[i], - &CidList->Id[i]); - if (ACPI_FAILURE (Status)) - { - break; - } - } - } - else - { - /* Only one CID, translate to a string */ - - Status = AcpiUtTranslateOneCid (ObjDesc, CidList->Id); - } - - /* Cleanup on error */ - - if (ACPI_FAILURE (Status)) - { - ACPI_FREE (CidList); - } - else - { - *ReturnCidList = CidList; - } - - /* On exit, we must delete the _CID return object */ - - AcpiUtRemoveReference (ObjDesc); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtExecute_UID - * - * PARAMETERS: DeviceNode - Node for the device - * Uid - Where the UID is returned - * - * RETURN: Status - * - * DESCRIPTION: Executes the _UID control method that returns the hardware - * ID of the device. - * - * NOTE: Internal function, no parameter validation - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtExecute_UID ( - ACPI_NAMESPACE_NODE *DeviceNode, - ACPI_DEVICE_ID *Uid) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (UtExecute_UID); - - - Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__UID, - ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, &ObjDesc); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - if (ObjDesc->Common.Type == ACPI_TYPE_INTEGER) - { - /* Convert the Numeric UID to string */ - - AcpiExUnsignedIntegerToString (ObjDesc->Integer.Value, Uid->Value); - } - else - { - /* Copy the String UID from the returned object */ - - AcpiUtCopyIdString (Uid->Value, ObjDesc->String.Pointer, - sizeof (Uid->Value)); - } + *Value = ObjDesc->Integer.Value; /* On exit, we must delete the return object */ @@ -838,63 +508,68 @@ AcpiUtExecute_STA ( /******************************************************************************* * - * FUNCTION: AcpiUtExecute_Sxds + * FUNCTION: AcpiUtExecutePowerMethods * * PARAMETERS: DeviceNode - Node for the device - * Flags - Where the status flags are returned + * MethodNames - Array of power method names + * MethodCount - Number of methods to execute + * OutValues - Where the power method values are returned * - * RETURN: Status + * RETURN: Status, OutValues * - * DESCRIPTION: Executes _STA for selected device and stores results in - * *Flags. + * DESCRIPTION: Executes the specified power methods for the device and returns + * the result(s). * * NOTE: Internal function, no parameter validation * ******************************************************************************/ ACPI_STATUS -AcpiUtExecute_Sxds ( +AcpiUtExecutePowerMethods ( ACPI_NAMESPACE_NODE *DeviceNode, - UINT8 *Highest) + const char **MethodNames, + UINT8 MethodCount, + UINT8 *OutValues) { ACPI_OPERAND_OBJECT *ObjDesc; ACPI_STATUS Status; + ACPI_STATUS FinalStatus = AE_NOT_FOUND; UINT32 i; - ACPI_FUNCTION_TRACE (UtExecute_Sxds); + ACPI_FUNCTION_TRACE (UtExecutePowerMethods); - for (i = 0; i < 4; i++) + for (i = 0; i < MethodCount; i++) { - Highest[i] = 0xFF; + /* + * Execute the power method (_SxD or _SxW). The only allowable + * return type is an Integer. + */ Status = AcpiUtEvaluateObject (DeviceNode, - ACPI_CAST_PTR (char, AcpiGbl_HighestDstateNames[i]), + ACPI_CAST_PTR (char, MethodNames[i]), ACPI_BTYPE_INTEGER, &ObjDesc); - if (ACPI_FAILURE (Status)) + if (ACPI_SUCCESS (Status)) { - if (Status != AE_NOT_FOUND) - { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "%s on Device %4.4s, %s\n", - ACPI_CAST_PTR (char, AcpiGbl_HighestDstateNames[i]), - AcpiUtGetNodeName (DeviceNode), - AcpiFormatException (Status))); - - return_ACPI_STATUS (Status); - } - } - else - { - /* Extract the Dstate value */ - - Highest[i] = (UINT8) ObjDesc->Integer.Value; + OutValues[i] = (UINT8) ObjDesc->Integer.Value; /* Delete the return object */ AcpiUtRemoveReference (ObjDesc); + FinalStatus = AE_OK; /* At least one value is valid */ + continue; } + + OutValues[i] = ACPI_UINT8_MAX; + if (Status == AE_NOT_FOUND) + { + continue; /* Ignore if not found */ + } + + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Failed %s on Device %4.4s, %s\n", + ACPI_CAST_PTR (char, MethodNames[i]), + AcpiUtGetNodeName (DeviceNode), AcpiFormatException (Status))); } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS (FinalStatus); } diff --git a/sys/contrib/dev/acpica/utilities/utglobal.c b/sys/contrib/dev/acpica/utilities/utglobal.c index b7c6657..df32fc0 100644 --- a/sys/contrib/dev/acpica/utilities/utglobal.c +++ b/sys/contrib/dev/acpica/utilities/utglobal.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -172,7 +172,16 @@ const char *AcpiGbl_SleepStateNames[ACPI_S_STATE_COUNT] = "\\_S5_" }; -const char *AcpiGbl_HighestDstateNames[4] = +const char *AcpiGbl_LowestDstateNames[ACPI_NUM_SxW_METHODS] = +{ + "_S0W", + "_S1W", + "_S2W", + "_S3W", + "_S4W" +}; + +const char *AcpiGbl_HighestDstateNames[ACPI_NUM_SxD_METHODS] = { "_S1D", "_S2D", @@ -322,7 +331,7 @@ static const char AcpiGbl_HexToAscii[] = char AcpiUtHexToAsciiChar ( - ACPI_INTEGER Integer, + UINT64 Integer, UINT32 Position) { @@ -398,6 +407,7 @@ const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] = "SMBus", "SystemCMOS", "PCIBARTarget", + "IPMI", "DataTable" }; @@ -928,6 +938,7 @@ AcpiUtInitGlobals ( /* Namespace */ + AcpiGbl_ModuleCodeList = NULL; AcpiGbl_RootNode = NULL; AcpiGbl_RootNodeStruct.Name.Integer = ACPI_ROOT_NAME; AcpiGbl_RootNodeStruct.DescriptorType = ACPI_DESC_TYPE_NAMED; @@ -938,6 +949,10 @@ AcpiUtInitGlobals ( AcpiGbl_RootNodeStruct.Flags = ANOBJ_END_OF_PEER_LIST; +#ifdef ACPI_DISASSEMBLER + AcpiGbl_ExternalList = NULL; +#endif + #ifdef ACPI_DEBUG_OUTPUT AcpiGbl_LowestStackPointer = ACPI_CAST_PTR (ACPI_SIZE, ACPI_SIZE_MAX); #endif diff --git a/sys/contrib/dev/acpica/utilities/utids.c b/sys/contrib/dev/acpica/utilities/utids.c new file mode 100644 index 0000000..6e5f833 --- /dev/null +++ b/sys/contrib/dev/acpica/utilities/utids.c @@ -0,0 +1,497 @@ +/****************************************************************************** + * + * Module Name: utids - support for device IDs - HID, UID, CID + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#define __UTIDS_C__ + +#include <contrib/dev/acpica/include/acpi.h> +#include <contrib/dev/acpica/include/accommon.h> +#include <contrib/dev/acpica/include/acinterp.h> + + +#define _COMPONENT ACPI_UTILITIES + ACPI_MODULE_NAME ("utids") + +/* Local prototypes */ + +static void +AcpiUtCopyIdString ( + char *Destination, + char *Source); + + +/******************************************************************************* + * + * FUNCTION: AcpiUtCopyIdString + * + * PARAMETERS: Destination - Where to copy the string + * Source - Source string + * + * RETURN: None + * + * DESCRIPTION: Copies an ID string for the _HID, _CID, and _UID methods. + * Performs removal of a leading asterisk if present -- workaround + * for a known issue on a bunch of machines. + * + ******************************************************************************/ + +static void +AcpiUtCopyIdString ( + char *Destination, + char *Source) +{ + + /* + * Workaround for ID strings that have a leading asterisk. This construct + * is not allowed by the ACPI specification (ID strings must be + * alphanumeric), but enough existing machines have this embedded in their + * ID strings that the following code is useful. + */ + if (*Source == '*') + { + Source++; + } + + /* Do the actual copy */ + + ACPI_STRCPY (Destination, Source); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtExecute_HID + * + * PARAMETERS: DeviceNode - Node for the device + * ReturnId - Where the string HID is returned + * + * RETURN: Status + * + * DESCRIPTION: Executes the _HID control method that returns the hardware + * ID of the device. The HID is either an 32-bit encoded EISAID + * Integer or a String. A string is always returned. An EISAID + * is converted to a string. + * + * NOTE: Internal function, no parameter validation + * + ******************************************************************************/ + +ACPI_STATUS +AcpiUtExecute_HID ( + ACPI_NAMESPACE_NODE *DeviceNode, + ACPI_DEVICE_ID **ReturnId) +{ + ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_DEVICE_ID *Hid; + UINT32 Length; + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (UtExecute_HID); + + + Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__HID, + ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, &ObjDesc); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* Get the size of the String to be returned, includes null terminator */ + + if (ObjDesc->Common.Type == ACPI_TYPE_INTEGER) + { + Length = ACPI_EISAID_STRING_SIZE; + } + else + { + Length = ObjDesc->String.Length + 1; + } + + /* Allocate a buffer for the HID */ + + Hid = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_DEVICE_ID) + (ACPI_SIZE) Length); + if (!Hid) + { + Status = AE_NO_MEMORY; + goto Cleanup; + } + + /* Area for the string starts after DEVICE_ID struct */ + + Hid->String = ACPI_ADD_PTR (char, Hid, sizeof (ACPI_DEVICE_ID)); + + /* Convert EISAID to a string or simply copy existing string */ + + if (ObjDesc->Common.Type == ACPI_TYPE_INTEGER) + { + AcpiExEisaIdToString (Hid->String, ObjDesc->Integer.Value); + } + else + { + AcpiUtCopyIdString (Hid->String, ObjDesc->String.Pointer); + } + + Hid->Length = Length; + *ReturnId = Hid; + + +Cleanup: + + /* On exit, we must delete the return object */ + + AcpiUtRemoveReference (ObjDesc); + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtExecute_UID + * + * PARAMETERS: DeviceNode - Node for the device + * ReturnId - Where the string UID is returned + * + * RETURN: Status + * + * DESCRIPTION: Executes the _UID control method that returns the unique + * ID of the device. The UID is either a 64-bit Integer (NOT an + * EISAID) or a string. Always returns a string. A 64-bit integer + * is converted to a decimal string. + * + * NOTE: Internal function, no parameter validation + * + ******************************************************************************/ + +ACPI_STATUS +AcpiUtExecute_UID ( + ACPI_NAMESPACE_NODE *DeviceNode, + ACPI_DEVICE_ID **ReturnId) +{ + ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_DEVICE_ID *Uid; + UINT32 Length; + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (UtExecute_UID); + + + Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__UID, + ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, &ObjDesc); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* Get the size of the String to be returned, includes null terminator */ + + if (ObjDesc->Common.Type == ACPI_TYPE_INTEGER) + { + Length = ACPI_MAX64_DECIMAL_DIGITS + 1; + } + else + { + Length = ObjDesc->String.Length + 1; + } + + /* Allocate a buffer for the UID */ + + Uid = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_DEVICE_ID) + (ACPI_SIZE) Length); + if (!Uid) + { + Status = AE_NO_MEMORY; + goto Cleanup; + } + + /* Area for the string starts after DEVICE_ID struct */ + + Uid->String = ACPI_ADD_PTR (char, Uid, sizeof (ACPI_DEVICE_ID)); + + /* Convert an Integer to string, or just copy an existing string */ + + if (ObjDesc->Common.Type == ACPI_TYPE_INTEGER) + { + AcpiExIntegerToString (Uid->String, ObjDesc->Integer.Value); + } + else + { + AcpiUtCopyIdString (Uid->String, ObjDesc->String.Pointer); + } + + Uid->Length = Length; + *ReturnId = Uid; + + +Cleanup: + + /* On exit, we must delete the return object */ + + AcpiUtRemoveReference (ObjDesc); + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtExecute_CID + * + * PARAMETERS: DeviceNode - Node for the device + * ReturnCidList - Where the CID list is returned + * + * RETURN: Status, list of CID strings + * + * DESCRIPTION: Executes the _CID control method that returns one or more + * compatible hardware IDs for the device. + * + * NOTE: Internal function, no parameter validation + * + * A _CID method can return either a single compatible ID or a package of + * compatible IDs. Each compatible ID can be one of the following: + * 1) Integer (32 bit compressed EISA ID) or + * 2) String (PCI ID format, e.g. "PCI\VEN_vvvv&DEV_dddd&SUBSYS_ssssssss") + * + * The Integer CIDs are converted to string format by this function. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiUtExecute_CID ( + ACPI_NAMESPACE_NODE *DeviceNode, + ACPI_DEVICE_ID_LIST **ReturnCidList) +{ + ACPI_OPERAND_OBJECT **CidObjects; + ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_DEVICE_ID_LIST *CidList; + char *NextIdString; + UINT32 StringAreaSize; + UINT32 Length; + UINT32 CidListSize; + ACPI_STATUS Status; + UINT32 Count; + UINT32 i; + + + ACPI_FUNCTION_TRACE (UtExecute_CID); + + + /* Evaluate the _CID method for this device */ + + Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__CID, + ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_PACKAGE, + &ObjDesc); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* + * Get the count and size of the returned _CIDs. _CID can return either + * a Package of Integers/Strings or a single Integer or String. + * Note: This section also validates that all CID elements are of the + * correct type (Integer or String). + */ + if (ObjDesc->Common.Type == ACPI_TYPE_PACKAGE) + { + Count = ObjDesc->Package.Count; + CidObjects = ObjDesc->Package.Elements; + } + else /* Single Integer or String CID */ + { + Count = 1; + CidObjects = &ObjDesc; + } + + StringAreaSize = 0; + for (i = 0; i < Count; i++) + { + /* String lengths include null terminator */ + + switch (CidObjects[i]->Common.Type) + { + case ACPI_TYPE_INTEGER: + StringAreaSize += ACPI_EISAID_STRING_SIZE; + break; + + case ACPI_TYPE_STRING: + StringAreaSize += CidObjects[i]->String.Length + 1; + break; + + default: + Status = AE_TYPE; + goto Cleanup; + } + } + + /* + * Now that we know the length of the CIDs, allocate return buffer: + * 1) Size of the base structure + + * 2) Size of the CID DEVICE_ID array + + * 3) Size of the actual CID strings + */ + CidListSize = sizeof (ACPI_DEVICE_ID_LIST) + + ((Count - 1) * sizeof (ACPI_DEVICE_ID)) + + StringAreaSize; + + CidList = ACPI_ALLOCATE_ZEROED (CidListSize); + if (!CidList) + { + Status = AE_NO_MEMORY; + goto Cleanup; + } + + /* Area for CID strings starts after the CID DEVICE_ID array */ + + NextIdString = ACPI_CAST_PTR (char, CidList->Ids) + + ((ACPI_SIZE) Count * sizeof (ACPI_DEVICE_ID)); + + /* Copy/convert the CIDs to the return buffer */ + + for (i = 0; i < Count; i++) + { + if (CidObjects[i]->Common.Type == ACPI_TYPE_INTEGER) + { + /* Convert the Integer (EISAID) CID to a string */ + + AcpiExEisaIdToString (NextIdString, CidObjects[i]->Integer.Value); + Length = ACPI_EISAID_STRING_SIZE; + } + else /* ACPI_TYPE_STRING */ + { + /* Copy the String CID from the returned object */ + + AcpiUtCopyIdString (NextIdString, CidObjects[i]->String.Pointer); + Length = CidObjects[i]->String.Length + 1; + } + + CidList->Ids[i].String = NextIdString; + CidList->Ids[i].Length = Length; + NextIdString += Length; + } + + /* Finish the CID list */ + + CidList->Count = Count; + CidList->ListSize = CidListSize; + *ReturnCidList = CidList; + + +Cleanup: + + /* On exit, we must delete the _CID return object */ + + AcpiUtRemoveReference (ObjDesc); + return_ACPI_STATUS (Status); +} + diff --git a/sys/contrib/dev/acpica/utilities/utinit.c b/sys/contrib/dev/acpica/utilities/utinit.c index 4ab8bd9..fe8e3dc 100644 --- a/sys/contrib/dev/acpica/utilities/utinit.c +++ b/sys/contrib/dev/acpica/utilities/utinit.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -184,12 +184,12 @@ AcpiUtTerminate ( * * FUNCTION: AcpiUtSubsystemShutdown * - * PARAMETERS: none + * PARAMETERS: None * - * RETURN: none + * RETURN: None * - * DESCRIPTION: Shutdown the various subsystems. Don't delete the mutex - * objects here -- because the AML debugger may be still running. + * DESCRIPTION: Shutdown the various components. Do not delete the mutex + * objects here, because the AML debugger may be still running. * ******************************************************************************/ @@ -197,24 +197,8 @@ void AcpiUtSubsystemShutdown ( void) { - ACPI_FUNCTION_TRACE (UtSubsystemShutdown); - /* Just exit if subsystem is already shutdown */ - - if (AcpiGbl_Shutdown) - { - ACPI_ERROR ((AE_INFO, - "ACPI Subsystem is already terminated")); - return_VOID; - } - - /* Subsystem appears active, go ahead and shut it down */ - - AcpiGbl_Shutdown = TRUE; - AcpiGbl_StartupFlags = 0; - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Shutting down ACPI Subsystem\n")); #ifndef ACPI_ASL_COMPILER diff --git a/sys/contrib/dev/acpica/utilities/utlock.c b/sys/contrib/dev/acpica/utilities/utlock.c index cbe1cb9..9d4423f 100644 --- a/sys/contrib/dev/acpica/utilities/utlock.c +++ b/sys/contrib/dev/acpica/utilities/utlock.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/utilities/utmath.c b/sys/contrib/dev/acpica/utilities/utmath.c index ec9449b..f6d5f7c 100644 --- a/sys/contrib/dev/acpica/utilities/utmath.c +++ b/sys/contrib/dev/acpica/utilities/utmath.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -149,9 +149,9 @@ ACPI_STATUS AcpiUtShortDivide ( - ACPI_INTEGER Dividend, + UINT64 Dividend, UINT32 Divisor, - ACPI_INTEGER *OutQuotient, + UINT64 *OutQuotient, UINT32 *OutRemainder) { UINT64_OVERLAY DividendOvl; @@ -213,10 +213,10 @@ AcpiUtShortDivide ( ACPI_STATUS AcpiUtDivide ( - ACPI_INTEGER InDividend, - ACPI_INTEGER InDivisor, - ACPI_INTEGER *OutQuotient, - ACPI_INTEGER *OutRemainder) + UINT64 InDividend, + UINT64 InDivisor, + UINT64 *OutQuotient, + UINT64 *OutRemainder) { UINT64_OVERLAY Dividend; UINT64_OVERLAY Divisor; @@ -293,8 +293,8 @@ AcpiUtDivide ( * The 64-bit remainder must be generated. */ Partial1 = Quotient.Part.Lo * Divisor.Part.Hi; - Partial2.Full = (ACPI_INTEGER) Quotient.Part.Lo * Divisor.Part.Lo; - Partial3.Full = (ACPI_INTEGER) Partial2.Part.Hi + Partial1; + Partial2.Full = (UINT64) Quotient.Part.Lo * Divisor.Part.Lo; + Partial3.Full = (UINT64) Partial2.Part.Hi + Partial1; Remainder.Part.Hi = Partial3.Part.Lo; Remainder.Part.Lo = Partial2.Part.Lo; @@ -362,9 +362,9 @@ AcpiUtDivide ( ACPI_STATUS AcpiUtShortDivide ( - ACPI_INTEGER InDividend, + UINT64 InDividend, UINT32 Divisor, - ACPI_INTEGER *OutQuotient, + UINT64 *OutQuotient, UINT32 *OutRemainder) { @@ -395,10 +395,10 @@ AcpiUtShortDivide ( ACPI_STATUS AcpiUtDivide ( - ACPI_INTEGER InDividend, - ACPI_INTEGER InDivisor, - ACPI_INTEGER *OutQuotient, - ACPI_INTEGER *OutRemainder) + UINT64 InDividend, + UINT64 InDivisor, + UINT64 *OutQuotient, + UINT64 *OutRemainder) { ACPI_FUNCTION_TRACE (UtDivide); diff --git a/sys/contrib/dev/acpica/utilities/utmisc.c b/sys/contrib/dev/acpica/utilities/utmisc.c index 6652e01..3bef62c 100644 --- a/sys/contrib/dev/acpica/utilities/utmisc.c +++ b/sys/contrib/dev/acpica/utilities/utmisc.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -124,6 +124,12 @@ #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("utmisc") +/* + * Common suffix for messages + */ +#define ACPI_COMMON_MSG_SUFFIX \ + AcpiOsPrintf (" (%8.8X/%s-%u)\n", ACPI_CA_VERSION, ModuleName, LineNumber) + /******************************************************************************* * @@ -207,6 +213,40 @@ AcpiUtValidateException ( /******************************************************************************* * + * FUNCTION: AcpiUtIsPciRootBridge + * + * PARAMETERS: Id - The HID/CID in string format + * + * RETURN: TRUE if the Id is a match for a PCI/PCI-Express Root Bridge + * + * DESCRIPTION: Determine if the input ID is a PCI Root Bridge ID. + * + ******************************************************************************/ + +BOOLEAN +AcpiUtIsPciRootBridge ( + char *Id) +{ + + /* + * Check if this is a PCI root bridge. + * ACPI 3.0+: check for a PCI Express root also. + */ + if (!(ACPI_STRCMP (Id, + PCI_ROOT_HID_STRING)) || + + !(ACPI_STRCMP (Id, + PCI_EXPRESS_ROOT_HID_STRING))) + { + return (TRUE); + } + + return (FALSE); +} + + +/******************************************************************************* + * * FUNCTION: AcpiUtIsAmlTable * * PARAMETERS: Table - An ACPI table @@ -889,12 +929,12 @@ ACPI_STATUS AcpiUtStrtoul64 ( char *String, UINT32 Base, - ACPI_INTEGER *RetInteger) + UINT64 *RetInteger) { UINT32 ThisDigit = 0; - ACPI_INTEGER ReturnValue = 0; - ACPI_INTEGER Quotient; - ACPI_INTEGER Dividend; + UINT64 ReturnValue = 0; + UINT64 Quotient; + UINT64 Dividend; UINT32 ToIntegerOp = (Base == ACPI_ANY_BASE); UINT32 Mode32 = (AcpiGbl_IntegerByteWidth == 4); UINT8 ValidDigits = 0; @@ -1031,7 +1071,7 @@ AcpiUtStrtoul64 ( /* Divide the digit into the correct position */ - (void) AcpiUtShortDivide ((Dividend - (ACPI_INTEGER) ThisDigit), + (void) AcpiUtShortDivide ((Dividend - (UINT64) ThisDigit), Base, &Quotient, NULL); if (ReturnValue > Quotient) @@ -1283,7 +1323,7 @@ AcpiError ( va_start (args, Format); AcpiOsVprintf (Format, args); - AcpiOsPrintf (" %8.8X %s-%u\n", ACPI_CA_VERSION, ModuleName, LineNumber); + ACPI_COMMON_MSG_SUFFIX; va_end (args); } @@ -1302,7 +1342,7 @@ AcpiException ( va_start (args, Format); AcpiOsVprintf (Format, args); - AcpiOsPrintf (" %8.8X %s-%u\n", ACPI_CA_VERSION, ModuleName, LineNumber); + ACPI_COMMON_MSG_SUFFIX; va_end (args); } @@ -1320,7 +1360,7 @@ AcpiWarning ( va_start (args, Format); AcpiOsVprintf (Format, args); - AcpiOsPrintf (" %8.8X %s-%u\n", ACPI_CA_VERSION, ModuleName, LineNumber); + ACPI_COMMON_MSG_SUFFIX; va_end (args); } @@ -1353,3 +1393,98 @@ ACPI_EXPORT_SYMBOL (AcpiWarning) ACPI_EXPORT_SYMBOL (AcpiInfo) +/******************************************************************************* + * + * FUNCTION: AcpiUtPredefinedWarning + * + * PARAMETERS: ModuleName - Caller's module name (for error output) + * LineNumber - Caller's line number (for error output) + * Pathname - Full pathname to the node + * NodeFlags - From Namespace node for the method/object + * Format - Printf format string + additional args + * + * RETURN: None + * + * DESCRIPTION: Warnings for the predefined validation module. Messages are + * only emitted the first time a problem with a particular + * method/object is detected. This prevents a flood of error + * messages for methods that are repeatedly evaluated. + * + ******************************************************************************/ + +void ACPI_INTERNAL_VAR_XFACE +AcpiUtPredefinedWarning ( + const char *ModuleName, + UINT32 LineNumber, + char *Pathname, + UINT8 NodeFlags, + const char *Format, + ...) +{ + va_list args; + + + /* + * Warning messages for this method/object will be disabled after the + * first time a validation fails or an object is successfully repaired. + */ + if (NodeFlags & ANOBJ_EVALUATED) + { + return; + } + + AcpiOsPrintf ("ACPI Warning for %s: ", Pathname); + + va_start (args, Format); + AcpiOsVprintf (Format, args); + ACPI_COMMON_MSG_SUFFIX; + va_end (args); +} + +/******************************************************************************* + * + * FUNCTION: AcpiUtPredefinedInfo + * + * PARAMETERS: ModuleName - Caller's module name (for error output) + * LineNumber - Caller's line number (for error output) + * Pathname - Full pathname to the node + * NodeFlags - From Namespace node for the method/object + * Format - Printf format string + additional args + * + * RETURN: None + * + * DESCRIPTION: Info messages for the predefined validation module. Messages + * are only emitted the first time a problem with a particular + * method/object is detected. This prevents a flood of + * messages for methods that are repeatedly evaluated. + * + ******************************************************************************/ + +void ACPI_INTERNAL_VAR_XFACE +AcpiUtPredefinedInfo ( + const char *ModuleName, + UINT32 LineNumber, + char *Pathname, + UINT8 NodeFlags, + const char *Format, + ...) +{ + va_list args; + + + /* + * Warning messages for this method/object will be disabled after the + * first time a validation fails or an object is successfully repaired. + */ + if (NodeFlags & ANOBJ_EVALUATED) + { + return; + } + + AcpiOsPrintf ("ACPI Info for %s: ", Pathname); + + va_start (args, Format); + AcpiOsVprintf (Format, args); + ACPI_COMMON_MSG_SUFFIX; + va_end (args); +} diff --git a/sys/contrib/dev/acpica/utilities/utmutex.c b/sys/contrib/dev/acpica/utilities/utmutex.c index e9bb4a8..d0d47d4 100644 --- a/sys/contrib/dev/acpica/utilities/utmutex.c +++ b/sys/contrib/dev/acpica/utilities/utmutex.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -128,7 +128,7 @@ static ACPI_STATUS AcpiUtCreateMutex ( ACPI_MUTEX_HANDLE MutexId); -static ACPI_STATUS +static void AcpiUtDeleteMutex ( ACPI_MUTEX_HANDLE MutexId); @@ -216,7 +216,7 @@ AcpiUtMutexTerminate ( for (i = 0; i < ACPI_NUM_MUTEX; i++) { - (void) AcpiUtDeleteMutex (i); + AcpiUtDeleteMutex (i); } /* Delete the spinlocks */ @@ -253,11 +253,6 @@ AcpiUtCreateMutex ( ACPI_FUNCTION_TRACE_U32 (UtCreateMutex, MutexId); - if (MutexId > ACPI_MAX_MUTEX) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - if (!AcpiGbl_MutexInfo[MutexId].Mutex) { Status = AcpiOsCreateMutex (&AcpiGbl_MutexInfo[MutexId].Mutex); @@ -281,7 +276,7 @@ AcpiUtCreateMutex ( * ******************************************************************************/ -static ACPI_STATUS +static void AcpiUtDeleteMutex ( ACPI_MUTEX_HANDLE MutexId) { @@ -289,17 +284,10 @@ AcpiUtDeleteMutex ( ACPI_FUNCTION_TRACE_U32 (UtDeleteMutex, MutexId); - if (MutexId > ACPI_MAX_MUTEX) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - AcpiOsDeleteMutex (AcpiGbl_MutexInfo[MutexId].Mutex); AcpiGbl_MutexInfo[MutexId].Mutex = NULL; AcpiGbl_MutexInfo[MutexId].ThreadId = ACPI_MUTEX_NOT_ACQUIRED; - - return_ACPI_STATUS (AE_OK); } diff --git a/sys/contrib/dev/acpica/utilities/utobject.c b/sys/contrib/dev/acpica/utilities/utobject.c index 3c96d78..f3ec792 100644 --- a/sys/contrib/dev/acpica/utilities/utobject.c +++ b/sys/contrib/dev/acpica/utilities/utobject.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -281,6 +281,41 @@ AcpiUtCreatePackageObject ( /******************************************************************************* * + * FUNCTION: AcpiUtCreateIntegerObject + * + * PARAMETERS: InitialValue - Initial value for the integer + * + * RETURN: Pointer to a new Integer object, null on failure + * + * DESCRIPTION: Create an initialized integer object + * + ******************************************************************************/ + +ACPI_OPERAND_OBJECT * +AcpiUtCreateIntegerObject ( + UINT64 InitialValue) +{ + ACPI_OPERAND_OBJECT *IntegerDesc; + + + ACPI_FUNCTION_TRACE (UtCreateIntegerObject); + + + /* Create and initialize a new integer object */ + + IntegerDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); + if (!IntegerDesc) + { + return_PTR (NULL); + } + + IntegerDesc->Integer.Value = InitialValue; + return_PTR (IntegerDesc); +} + + +/******************************************************************************* + * * FUNCTION: AcpiUtCreateBufferObject * * PARAMETERS: BufferSize - Size of buffer to be created diff --git a/sys/contrib/dev/acpica/utilities/utresrc.c b/sys/contrib/dev/acpica/utilities/utresrc.c index 541b970..e07cee4 100644 --- a/sys/contrib/dev/acpica/utilities/utresrc.c +++ b/sys/contrib/dev/acpica/utilities/utresrc.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/utilities/utstate.c b/sys/contrib/dev/acpica/utilities/utstate.c index fd18dda..39afcda 100644 --- a/sys/contrib/dev/acpica/utilities/utstate.c +++ b/sys/contrib/dev/acpica/utilities/utstate.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/utilities/uttrack.c b/sys/contrib/dev/acpica/utilities/uttrack.c index f399d97..5c48544 100644 --- a/sys/contrib/dev/acpica/utilities/uttrack.c +++ b/sys/contrib/dev/acpica/utilities/uttrack.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/utilities/utxface.c b/sys/contrib/dev/acpica/utilities/utxface.c index df3ded7..d000b0c 100644 --- a/sys/contrib/dev/acpica/utilities/utxface.c +++ b/sys/contrib/dev/acpica/utilities/utxface.c @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. * All rights reserved. * * 2. License @@ -360,6 +360,16 @@ AcpiInitializeObjects ( } /* + * Execute any module-level code that was detected during the table load + * phase. Although illegal since ACPI 2.0, there are many machines that + * contain this type of code. Each block of detected executable AML code + * outside of any control method is wrapped with a temporary control + * method object and placed on a global list. The methods on this list + * are executed below. + */ + AcpiNsExecModuleCodeList (); + + /* * Initialize the objects that remain uninitialized. This runs the * executable AML that may be part of the declaration of these objects: * OperationRegions, BufferFields, Buffers, and Packages. @@ -437,7 +447,7 @@ ACPI_EXPORT_SYMBOL (AcpiInitializeObjects) * * RETURN: Status * - * DESCRIPTION: Shutdown the ACPI subsystem. Release all resources. + * DESCRIPTION: Shutdown the ACPICA subsystem and release all resources. * ******************************************************************************/ @@ -451,15 +461,28 @@ AcpiTerminate ( ACPI_FUNCTION_TRACE (AcpiTerminate); + /* Just exit if subsystem is already shutdown */ + + if (AcpiGbl_Shutdown) + { + ACPI_ERROR ((AE_INFO, "ACPI Subsystem is already terminated")); + return_ACPI_STATUS (AE_OK); + } + + /* Subsystem appears active, go ahead and shut it down */ + + AcpiGbl_Shutdown = TRUE; + AcpiGbl_StartupFlags = 0; + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Shutting down ACPI Subsystem\n")); + /* Terminate the AML Debugger if present */ - ACPI_DEBUGGER_EXEC(AcpiGbl_DbTerminateThreads = TRUE); + ACPI_DEBUGGER_EXEC (AcpiGbl_DbTerminateThreads = TRUE); /* Shutdown and free all resources */ AcpiUtSubsystemShutdown (); - /* Free the mutex objects */ AcpiUtMutexTerminate (); @@ -480,8 +503,8 @@ AcpiTerminate ( ACPI_EXPORT_SYMBOL (AcpiTerminate) -#ifndef ACPI_ASL_COMPILER +#ifndef ACPI_ASL_COMPILER /******************************************************************************* * * FUNCTION: AcpiSubsystemStatus diff --git a/sys/dev/acpi_support/acpi_ibm.c b/sys/dev/acpi_support/acpi_ibm.c index 2289982..2b6ac5d 100644 --- a/sys/dev/acpi_support/acpi_ibm.c +++ b/sys/dev/acpi_support/acpi_ibm.c @@ -526,7 +526,7 @@ out: static int acpi_ibm_sysctl_get(struct acpi_ibm_softc *sc, int method) { - ACPI_INTEGER val_ec; + UINT64 val_ec; int val = 0, key; ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); @@ -657,7 +657,7 @@ static int acpi_ibm_sysctl_set(struct acpi_ibm_softc *sc, int method, int arg) { int val, step; - ACPI_INTEGER val_ec; + UINT64 val_ec; ACPI_OBJECT Arg; ACPI_OBJECT_LIST Args; ACPI_STATUS status; diff --git a/sys/dev/acpi_support/acpi_panasonic.c b/sys/dev/acpi_support/acpi_panasonic.c index 595ca08..ad8b239 100644 --- a/sys/dev/acpi_support/acpi_panasonic.c +++ b/sys/dev/acpi_support/acpi_panasonic.c @@ -82,9 +82,9 @@ static int acpi_panasonic_attach(device_t dev); static int acpi_panasonic_detach(device_t dev); static int acpi_panasonic_shutdown(device_t dev); static int acpi_panasonic_sysctl(SYSCTL_HANDLER_ARGS); -static ACPI_INTEGER acpi_panasonic_sinf(ACPI_HANDLE h, ACPI_INTEGER index); -static void acpi_panasonic_sset(ACPI_HANDLE h, ACPI_INTEGER index, - ACPI_INTEGER val); +static UINT64 acpi_panasonic_sinf(ACPI_HANDLE h, UINT64 index); +static void acpi_panasonic_sset(ACPI_HANDLE h, UINT64 index, + UINT64 val); static int acpi_panasonic_hkey_event(struct acpi_panasonic_softc *sc, ACPI_HANDLE h, UINT32 *arg); static void acpi_panasonic_hkey_action(struct acpi_panasonic_softc *sc, @@ -265,12 +265,12 @@ out: return (error); } -static ACPI_INTEGER -acpi_panasonic_sinf(ACPI_HANDLE h, ACPI_INTEGER index) +static UINT64 +acpi_panasonic_sinf(ACPI_HANDLE h, UINT64 index) { ACPI_BUFFER buf; ACPI_OBJECT *res; - ACPI_INTEGER ret; + UINT64 ret; ACPI_SERIAL_ASSERT(panasonic); ret = -1; @@ -286,7 +286,7 @@ acpi_panasonic_sinf(ACPI_HANDLE h, ACPI_INTEGER index) } static void -acpi_panasonic_sset(ACPI_HANDLE h, ACPI_INTEGER index, ACPI_INTEGER val) +acpi_panasonic_sset(ACPI_HANDLE h, UINT64 index, UINT64 val) { ACPI_OBJECT_LIST args; ACPI_OBJECT obj[2]; @@ -394,7 +394,7 @@ acpi_panasonic_hkey_event(struct acpi_panasonic_softc *sc, ACPI_HANDLE h, { ACPI_BUFFER buf; ACPI_OBJECT *res; - ACPI_INTEGER val; + UINT64 val; int status; ACPI_SERIAL_ASSERT(panasonic); diff --git a/sys/dev/acpi_support/acpi_wmi.c b/sys/dev/acpi_support/acpi_wmi.c index 07c2d71..9da790c 100644 --- a/sys/dev/acpi_support/acpi_wmi.c +++ b/sys/dev/acpi_support/acpi_wmi.c @@ -141,7 +141,7 @@ static void acpi_wmi_notify_handler(ACPI_HANDLE h, UINT32 notify, void *context); static ACPI_STATUS acpi_wmi_ec_handler(UINT32 function, ACPI_PHYSICAL_ADDRESS address, UINT32 width, - ACPI_INTEGER *value, void *context, + UINT64 *value, void *context, void *region_context); /* helpers */ static ACPI_STATUS acpi_wmi_read_wdg_blocks(ACPI_HANDLE h); @@ -646,12 +646,12 @@ acpi_wmi_notify_handler(ACPI_HANDLE h, UINT32 notify, void *context) */ static ACPI_STATUS acpi_wmi_ec_handler(UINT32 function, ACPI_PHYSICAL_ADDRESS address, - UINT32 width, ACPI_INTEGER *value, void *context, + UINT32 width, UINT64 *value, void *context, void *region_context) { struct acpi_wmi_softc *sc; int i; - ACPI_INTEGER ec_data; + UINT64 ec_data; UINT8 ec_addr; ACPI_STATUS status; @@ -672,7 +672,7 @@ acpi_wmi_ec_handler(UINT32 function, ACPI_PHYSICAL_ADDRESS address, case ACPI_READ: status = ACPI_EC_READ(sc->ec_dev, ec_addr, &ec_data, 1); if (ACPI_SUCCESS(status)) - *value |= ((ACPI_INTEGER)ec_data) << i; + *value |= ((UINT64)ec_data) << i; break; case ACPI_WRITE: ec_data = (UINT8)((*value) >> i); diff --git a/sys/dev/acpica/Osd/OsdHardware.c b/sys/dev/acpica/Osd/OsdHardware.c index cf3cdd7..822bf78 100644 --- a/sys/dev/acpica/Osd/OsdHardware.c +++ b/sys/dev/acpica/Osd/OsdHardware.c @@ -145,7 +145,7 @@ AcpiOsReadPciConfiguration(ACPI_PCI_ID *PciId, UINT32 Register, void *Value, ACPI_STATUS AcpiOsWritePciConfiguration (ACPI_PCI_ID *PciId, UINT32 Register, - ACPI_INTEGER Value, UINT32 Width) + UINT64 Value, UINT32 Width) { u_int32_t byte_width = Width / 8; diff --git a/sys/dev/acpica/Osd/OsdSchedule.c b/sys/dev/acpica/Osd/OsdSchedule.c index b8153a3..70717d5 100644 --- a/sys/dev/acpica/Osd/OsdSchedule.c +++ b/sys/dev/acpica/Osd/OsdSchedule.c @@ -215,7 +215,7 @@ AcpiOsExecute(ACPI_EXECUTE_TYPE Type, ACPI_OSD_EXEC_CALLBACK Function, } void -AcpiOsSleep(ACPI_INTEGER Milliseconds) +AcpiOsSleep(UINT64 Milliseconds) { int timo; diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index 0ba8f9f..8de8d90 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -864,24 +864,20 @@ static int acpi_child_pnpinfo_str_method(device_t cbdev, device_t child, char *buf, size_t buflen) { - ACPI_BUFFER adbuf = {ACPI_ALLOCATE_BUFFER, NULL}; - ACPI_DEVICE_INFO *adinfo; struct acpi_device *dinfo = device_get_ivars(child); - char *end; - int error; + ACPI_DEVICE_INFO *adinfo; - error = AcpiGetObjectInfo(dinfo->ad_handle, &adbuf); - adinfo = (ACPI_DEVICE_INFO *) adbuf.Pointer; - if (error) + if (ACPI_FAILURE(AcpiGetObjectInfo(dinfo->ad_handle, &adinfo))) { snprintf(buf, buflen, "unknown"); - else - snprintf(buf, buflen, "_HID=%s _UID=%lu", - (adinfo->Valid & ACPI_VALID_HID) ? - adinfo->HardwareId.Value : "none", - (adinfo->Valid & ACPI_VALID_UID) ? - strtoul(adinfo->UniqueId.Value, &end, 10) : 0); - if (adinfo) - AcpiOsFree(adinfo); + return (0); + } + + snprintf(buf, buflen, "_HID=%s _UID=%lu", + (adinfo->Valid & ACPI_VALID_HID) ? + adinfo->HardwareId.String : "none", + (adinfo->Valid & ACPI_VALID_UID) ? + strtoul(adinfo->UniqueId.String, NULL, 10) : 0UL); + AcpiOsFree(adinfo); return (0); } @@ -1315,31 +1311,21 @@ static uint32_t acpi_isa_get_logicalid(device_t dev) { ACPI_DEVICE_INFO *devinfo; - ACPI_BUFFER buf; ACPI_HANDLE h; - ACPI_STATUS error; - u_int32_t pnpid; + uint32_t pnpid; ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); - pnpid = 0; - buf.Pointer = NULL; - buf.Length = ACPI_ALLOCATE_BUFFER; - /* Fetch and validate the HID. */ - if ((h = acpi_get_handle(dev)) == NULL) - goto out; - error = AcpiGetObjectInfo(h, &buf); - if (ACPI_FAILURE(error)) - goto out; - devinfo = (ACPI_DEVICE_INFO *)buf.Pointer; + if ((h = acpi_get_handle(dev)) == NULL || + ACPI_FAILURE(AcpiGetObjectInfo(h, &devinfo))) + return_VALUE (0); - if ((devinfo->Valid & ACPI_VALID_HID) != 0) - pnpid = PNP_EISAID(devinfo->HardwareId.Value); + pnpid = (devinfo->Valid & ACPI_VALID_HID) != 0 && + devinfo->HardwareId.Length >= ACPI_EISAID_STRING_SIZE ? + PNP_EISAID(devinfo->HardwareId.String) : 0; + AcpiOsFree(devinfo); -out: - if (buf.Pointer != NULL) - AcpiOsFree(buf.Pointer); return_VALUE (pnpid); } @@ -1347,41 +1333,36 @@ static int acpi_isa_get_compatid(device_t dev, uint32_t *cids, int count) { ACPI_DEVICE_INFO *devinfo; - ACPI_BUFFER buf; + ACPI_DEVICE_ID *ids; ACPI_HANDLE h; - ACPI_STATUS error; uint32_t *pnpid; - int valid, i; + int i, valid; ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); pnpid = cids; - valid = 0; - buf.Pointer = NULL; - buf.Length = ACPI_ALLOCATE_BUFFER; /* Fetch and validate the CID */ - if ((h = acpi_get_handle(dev)) == NULL) - goto out; - error = AcpiGetObjectInfo(h, &buf); - if (ACPI_FAILURE(error)) - goto out; - devinfo = (ACPI_DEVICE_INFO *)buf.Pointer; - if ((devinfo->Valid & ACPI_VALID_CID) == 0) - goto out; - - if (devinfo->CompatibilityId.Count < count) - count = devinfo->CompatibilityId.Count; - for (i = 0; i < count; i++) { - if (strncmp(devinfo->CompatibilityId.Id[i].Value, "PNP", 3) != 0) - continue; - *pnpid++ = PNP_EISAID(devinfo->CompatibilityId.Id[i].Value); - valid++; - } + if ((h = acpi_get_handle(dev)) == NULL || + ACPI_FAILURE(AcpiGetObjectInfo(h, &devinfo))) + return_VALUE (0); + + if ((devinfo->Valid & ACPI_VALID_CID) == 0) { + AcpiOsFree(devinfo); + return_VALUE (0); + } + + if (devinfo->CompatibleIdList.Count < count) + count = devinfo->CompatibleIdList.Count; + ids = devinfo->CompatibleIdList.Ids; + for (i = 0, valid = 0; i < count; i++) + if (ids[i].Length >= ACPI_EISAID_STRING_SIZE && + strncmp(ids[i].String, "PNP", 3) == 0) { + *pnpid++ = PNP_EISAID(ids[i].String); + valid++; + } + AcpiOsFree(devinfo); -out: - if (buf.Pointer != NULL) - AcpiOsFree(buf.Pointer); return_VALUE (valid); } @@ -1389,10 +1370,14 @@ static char * acpi_device_id_probe(device_t bus, device_t dev, char **ids) { ACPI_HANDLE h; + ACPI_OBJECT_TYPE t; int i; h = acpi_get_handle(dev); - if (ids == NULL || h == NULL || acpi_get_type(dev) != ACPI_TYPE_DEVICE) + if (ids == NULL || h == NULL) + return (NULL); + t = acpi_get_type(dev); + if (t != ACPI_TYPE_DEVICE && t != ACPI_TYPE_PROCESSOR) return (NULL); /* Try to match one of the array of IDs with a HID or CID. */ @@ -1538,7 +1523,7 @@ acpi_device_scan_children(device_t bus, device_t dev, int max_depth, ctx.arg = arg; ctx.parent = h; return (AcpiWalkNamespace(ACPI_TYPE_ANY, h, max_depth, - acpi_device_scan_cb, &ctx, NULL)); + acpi_device_scan_cb, NULL, &ctx, NULL)); } /* @@ -1664,7 +1649,7 @@ acpi_probe_children(device_t bus) */ ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "namespace scan\n")); AcpiWalkNamespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, 100, acpi_probe_child, - bus, NULL); + NULL, bus, NULL); /* Pre-allocate resources for our rman from any sysresource devices. */ acpi_sysres_alloc(bus); @@ -1821,7 +1806,7 @@ acpi_probe_child(ACPI_HANDLE handle, UINT32 level, void *context, void **status) * placeholder object handler so we can store a device_t in an ACPI_HANDLE. */ void -acpi_fake_objhandler(ACPI_HANDLE h, UINT32 fn, void *data) +acpi_fake_objhandler(ACPI_HANDLE h, void *data) { } @@ -1910,30 +1895,18 @@ acpi_DeviceIsPresent(device_t dev) { ACPI_DEVICE_INFO *devinfo; ACPI_HANDLE h; - ACPI_BUFFER buf; - ACPI_STATUS error; - int ret; + BOOLEAN present; - ret = FALSE; - if ((h = acpi_get_handle(dev)) == NULL) + if ((h = acpi_get_handle(dev)) == NULL || + ACPI_FAILURE(AcpiGetObjectInfo(h, &devinfo))) return (FALSE); - buf.Pointer = NULL; - buf.Length = ACPI_ALLOCATE_BUFFER; - error = AcpiGetObjectInfo(h, &buf); - if (ACPI_FAILURE(error)) - return (FALSE); - devinfo = (ACPI_DEVICE_INFO *)buf.Pointer; /* If no _STA method, must be present */ - if ((devinfo->Valid & ACPI_VALID_STA) == 0) - ret = TRUE; - - /* Return true for 'present' and 'functioning' */ - if (ACPI_DEVICE_PRESENT(devinfo->CurrentStatus)) - ret = TRUE; + present = (devinfo->Valid & ACPI_VALID_STA) == 0 || + ACPI_DEVICE_PRESENT(devinfo->CurrentStatus) ? TRUE : FALSE; - AcpiOsFree(buf.Pointer); - return (ret); + AcpiOsFree(devinfo); + return (present); } /* @@ -1944,30 +1917,18 @@ acpi_BatteryIsPresent(device_t dev) { ACPI_DEVICE_INFO *devinfo; ACPI_HANDLE h; - ACPI_BUFFER buf; - ACPI_STATUS error; - int ret; + BOOLEAN present; - ret = FALSE; - if ((h = acpi_get_handle(dev)) == NULL) + if ((h = acpi_get_handle(dev)) == NULL || + ACPI_FAILURE(AcpiGetObjectInfo(h, &devinfo))) return (FALSE); - buf.Pointer = NULL; - buf.Length = ACPI_ALLOCATE_BUFFER; - error = AcpiGetObjectInfo(h, &buf); - if (ACPI_FAILURE(error)) - return (FALSE); - devinfo = (ACPI_DEVICE_INFO *)buf.Pointer; /* If no _STA method, must be present */ - if ((devinfo->Valid & ACPI_VALID_STA) == 0) - ret = TRUE; - - /* Return true for 'present', 'battery present', and 'functioning' */ - if (ACPI_BATTERY_PRESENT(devinfo->CurrentStatus)) - ret = TRUE; + present = (devinfo->Valid & ACPI_VALID_STA) == 0 || + ACPI_BATTERY_PRESENT(devinfo->CurrentStatus) ? TRUE : FALSE; - AcpiOsFree(buf.Pointer); - return (ret); + AcpiOsFree(devinfo); + return (present); } /* @@ -1977,33 +1938,26 @@ static BOOLEAN acpi_MatchHid(ACPI_HANDLE h, const char *hid) { ACPI_DEVICE_INFO *devinfo; - ACPI_BUFFER buf; - ACPI_STATUS error; - int ret, i; + BOOLEAN ret; + int i; - ret = FALSE; - if (hid == NULL || h == NULL) - return (ret); - buf.Pointer = NULL; - buf.Length = ACPI_ALLOCATE_BUFFER; - error = AcpiGetObjectInfo(h, &buf); - if (ACPI_FAILURE(error)) - return (ret); - devinfo = (ACPI_DEVICE_INFO *)buf.Pointer; + if (hid == NULL || h == NULL || + ACPI_FAILURE(AcpiGetObjectInfo(h, &devinfo))) + return (FALSE); + ret = FALSE; if ((devinfo->Valid & ACPI_VALID_HID) != 0 && - strcmp(hid, devinfo->HardwareId.Value) == 0) + strcmp(hid, devinfo->HardwareId.String) == 0) ret = TRUE; - else if ((devinfo->Valid & ACPI_VALID_CID) != 0) { - for (i = 0; i < devinfo->CompatibilityId.Count; i++) { - if (strcmp(hid, devinfo->CompatibilityId.Id[i].Value) == 0) { + else if ((devinfo->Valid & ACPI_VALID_CID) != 0) + for (i = 0; i < devinfo->CompatibleIdList.Count; i++) { + if (strcmp(hid, devinfo->CompatibleIdList.Ids[i].String) == 0) { ret = TRUE; break; } } - } - AcpiOsFree(buf.Pointer); + AcpiOsFree(devinfo); return (ret); } @@ -2825,7 +2779,7 @@ acpi_wake_prep_walk(int sstate) if (ACPI_SUCCESS(AcpiGetHandle(ACPI_ROOT_OBJECT, "\\_SB_", &sb_handle))) AcpiWalkNamespace(ACPI_TYPE_DEVICE, sb_handle, 100, - acpi_wake_prep, &sstate, NULL); + acpi_wake_prep, NULL, &sstate, NULL); return (0); } diff --git a/sys/dev/acpica/acpi_cpu.c b/sys/dev/acpica/acpi_cpu.c index 3c4fd71..c16dcb1 100644 --- a/sys/dev/acpica/acpi_cpu.c +++ b/sys/dev/acpica/acpi_cpu.c @@ -940,7 +940,7 @@ acpi_cpu_idle() * get the time very close to the CPU start/stop clock logic, this * is the only reliable time source. */ - AcpiRead(&start_time, &AcpiGbl_FADT.XPmTimerBlock); + AcpiHwRead(&start_time, &AcpiGbl_FADT.XPmTimerBlock); CPU_GET_REG(cx_next->p_lvlx, 1); /* @@ -949,8 +949,8 @@ acpi_cpu_idle() * the processor has stopped. Doing it again provides enough * margin that we are certain to have a correct value. */ - AcpiRead(&end_time, &AcpiGbl_FADT.XPmTimerBlock); - AcpiRead(&end_time, &AcpiGbl_FADT.XPmTimerBlock); + AcpiHwRead(&end_time, &AcpiGbl_FADT.XPmTimerBlock); + AcpiHwRead(&end_time, &AcpiGbl_FADT.XPmTimerBlock); /* Enable bus master arbitration and disable bus master wakeup. */ if (cx_next->type == ACPI_STATE_C3 && diff --git a/sys/dev/acpica/acpi_dock.c b/sys/dev/acpica/acpi_dock.c index b7d2e3e..2e77b93 100644 --- a/sys/dev/acpica/acpi_dock.c +++ b/sys/dev/acpica/acpi_dock.c @@ -224,7 +224,7 @@ acpi_dock_insert_child(ACPI_HANDLE handle, UINT32 level, void *context, ACPI_INIT_WALK_INFO Info; AcpiNsWalkNamespace(ACPI_TYPE_ANY, handle, - 100, TRUE, AcpiNsInitOneDevice, &Info, NULL); + 100, TRUE, AcpiNsInitOneDevice, NULL, &Info, NULL); #endif dev = acpi_get_device(handle); @@ -249,7 +249,7 @@ acpi_dock_insert_children(device_t dev) status = AcpiGetHandle(ACPI_ROOT_OBJECT, "\\_SB_", &sb_handle); if (ACPI_SUCCESS(status)) { AcpiWalkNamespace(ACPI_TYPE_DEVICE, sb_handle, - 100, acpi_dock_insert_child, dev, NULL); + 100, acpi_dock_insert_child, NULL, dev, NULL); } } @@ -319,7 +319,7 @@ acpi_dock_eject_children(device_t dev) status = AcpiGetHandle(ACPI_ROOT_OBJECT, "\\_SB_", &sb_handle); if (ACPI_SUCCESS(status)) { AcpiWalkNamespace(ACPI_TYPE_DEVICE, sb_handle, - 100, acpi_dock_eject_child, &dev, NULL); + 100, acpi_dock_eject_child, NULL, &dev, NULL); } } diff --git a/sys/dev/acpica/acpi_ec.c b/sys/dev/acpica/acpi_ec.c index 9348a2a..d4ef019 100644 --- a/sys/dev/acpica/acpi_ec.c +++ b/sys/dev/acpica/acpi_ec.c @@ -223,7 +223,7 @@ static ACPI_STATUS EcSpaceSetup(ACPI_HANDLE Region, UINT32 Function, void *Context, void **return_Context); static ACPI_STATUS EcSpaceHandler(UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, - UINT32 width, ACPI_INTEGER *Value, + UINT32 width, UINT64 *Value, void *Context, void *RegionContext); static ACPI_STATUS EcWaitEvent(struct acpi_ec_softc *sc, EC_EVENT Event, u_int gen_count); @@ -238,9 +238,9 @@ static int acpi_ec_suspend(device_t dev); static int acpi_ec_resume(device_t dev); static int acpi_ec_shutdown(device_t dev); static int acpi_ec_read_method(device_t dev, u_int addr, - ACPI_INTEGER *val, int width); + UINT64 *val, int width); static int acpi_ec_write_method(device_t dev, u_int addr, - ACPI_INTEGER val, int width); + UINT64 val, int width); static device_method_t acpi_ec_methods[] = { /* Device interface */ @@ -581,7 +581,7 @@ acpi_ec_shutdown(device_t dev) /* Methods to allow other devices (e.g., smbat) to read/write EC space. */ static int -acpi_ec_read_method(device_t dev, u_int addr, ACPI_INTEGER *val, int width) +acpi_ec_read_method(device_t dev, u_int addr, UINT64 *val, int width) { struct acpi_ec_softc *sc; ACPI_STATUS status; @@ -594,7 +594,7 @@ acpi_ec_read_method(device_t dev, u_int addr, ACPI_INTEGER *val, int width) } static int -acpi_ec_write_method(device_t dev, u_int addr, ACPI_INTEGER val, int width) +acpi_ec_write_method(device_t dev, u_int addr, UINT64 val, int width) { struct acpi_ec_softc *sc; ACPI_STATUS status; @@ -724,7 +724,7 @@ EcSpaceSetup(ACPI_HANDLE Region, UINT32 Function, void *Context, static ACPI_STATUS EcSpaceHandler(UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 width, - ACPI_INTEGER *Value, void *Context, void *RegionContext) + UINT64 *Value, void *Context, void *RegionContext) { struct acpi_ec_softc *sc = (struct acpi_ec_softc *)Context; ACPI_STATUS Status; @@ -765,7 +765,7 @@ EcSpaceHandler(UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 width, case ACPI_READ: Status = EcRead(sc, EcAddr, &EcData); if (ACPI_SUCCESS(Status)) - *Value |= ((ACPI_INTEGER)EcData) << i; + *Value |= ((UINT64)EcData) << i; break; case ACPI_WRITE: EcData = (UINT8)((*Value) >> i); diff --git a/sys/dev/acpica/acpi_if.m b/sys/dev/acpica/acpi_if.m index 4d90109..36fad85 100644 --- a/sys/dev/acpica/acpi_if.m +++ b/sys/dev/acpica/acpi_if.m @@ -177,13 +177,13 @@ STATICMETHOD int get_features { # # device_t dev: EC device # u_int addr: Address to read from in EC space -# ACPI_INTEGER *val: Location to store read value +# UINT64 *val: Location to store read value # int width: Size of area to read in bytes # METHOD int ec_read { device_t dev; u_int addr; - ACPI_INTEGER *val; + UINT64 *val; int width; }; @@ -192,13 +192,13 @@ METHOD int ec_read { # # device_t dev: EC device # u_int addr: Address to write to in EC space -# ACPI_INTEGER val: Value to write +# UINT64 val: Value to write # int width: Size of value to write in bytes # METHOD int ec_write { device_t dev; u_int addr; - ACPI_INTEGER val; + UINT64 val; int width; }; diff --git a/sys/dev/acpica/acpi_package.c b/sys/dev/acpica/acpi_package.c index 55eaf93..e38fea5 100644 --- a/sys/dev/acpica/acpi_package.c +++ b/sys/dev/acpica/acpi_package.c @@ -45,7 +45,7 @@ __FBSDID("$FreeBSD$"); */ int -acpi_PkgInt(ACPI_OBJECT *res, int idx, ACPI_INTEGER *dst) +acpi_PkgInt(ACPI_OBJECT *res, int idx, UINT64 *dst) { ACPI_OBJECT *obj; @@ -60,7 +60,7 @@ acpi_PkgInt(ACPI_OBJECT *res, int idx, ACPI_INTEGER *dst) int acpi_PkgInt32(ACPI_OBJECT *res, int idx, uint32_t *dst) { - ACPI_INTEGER tmp; + UINT64 tmp; int error; error = acpi_PkgInt(res, idx, &tmp); diff --git a/sys/dev/acpica/acpi_pci.c b/sys/dev/acpica/acpi_pci.c index 7c1bd86..9cf064e 100644 --- a/sys/dev/acpica/acpi_pci.c +++ b/sys/dev/acpica/acpi_pci.c @@ -314,7 +314,7 @@ acpi_pci_attach(device_t dev) */ pci_add_children(dev, domain, busno, sizeof(struct acpi_pci_devinfo)); AcpiWalkNamespace(ACPI_TYPE_DEVICE, acpi_get_handle(dev), 1, - acpi_pci_save_handle, dev, NULL); + acpi_pci_save_handle, NULL, dev, NULL); return (bus_generic_attach(dev)); } diff --git a/sys/dev/acpica/acpi_pcib_acpi.c b/sys/dev/acpica/acpi_pcib_acpi.c index 4714125..b20fc74 100644 --- a/sys/dev/acpica/acpi_pcib_acpi.c +++ b/sys/dev/acpica/acpi_pcib_acpi.c @@ -131,14 +131,18 @@ MODULE_DEPEND(acpi_pcib, acpi, 1, 1, 1); static int acpi_pcib_acpi_probe(device_t dev) { - static char *pcib_ids[] = { "PNP0A03", "PNP0A08", NULL }; + ACPI_DEVICE_INFO *devinfo; + ACPI_HANDLE h; + int root; - if (acpi_disabled("pcib") || - ACPI_ID_PROBE(device_get_parent(dev), dev, pcib_ids) == NULL) + if (acpi_disabled("pcib") || (h = acpi_get_handle(dev)) == NULL || + ACPI_FAILURE(AcpiGetObjectInfo(h, &devinfo))) return (ENXIO); - - if (pci_cfgregopen() == 0) + root = (devinfo->Flags & ACPI_PCI_ROOT_BRIDGE) != 0; + AcpiOsFree(devinfo); + if (!root || pci_cfgregopen() == 0) return (ENXIO); + device_set_desc(dev, "ACPI Host-PCI bridge"); return (0); } diff --git a/sys/dev/acpica/acpi_powerres.c b/sys/dev/acpica/acpi_powerres.c index 0988871..9c43c88 100644 --- a/sys/dev/acpica/acpi_powerres.c +++ b/sys/dev/acpica/acpi_powerres.c @@ -88,8 +88,8 @@ struct acpi_powerresource { TAILQ_ENTRY(acpi_powerresource) ap_link; TAILQ_HEAD(,acpi_powerreference) ap_references; ACPI_HANDLE ap_resource; - ACPI_INTEGER ap_systemlevel; - ACPI_INTEGER ap_order; + UINT64 ap_systemlevel; + UINT64 ap_order; int ap_state; }; diff --git a/sys/dev/acpica/acpi_smbat.c b/sys/dev/acpica/acpi_smbat.c index 145e240..02a461e 100644 --- a/sys/dev/acpica/acpi_smbat.c +++ b/sys/dev/acpica/acpi_smbat.c @@ -190,7 +190,7 @@ acpi_smbus_read_2(struct acpi_smbat_softc *sc, uint8_t addr, uint8_t cmd, uint16_t *ptr) { int error, to; - ACPI_INTEGER val; + UINT64 val; ACPI_SERIAL_ASSERT(smbat); @@ -257,7 +257,7 @@ static int acpi_smbus_read_multi_1(struct acpi_smbat_softc *sc, uint8_t addr, uint8_t cmd, uint8_t *ptr, uint16_t len) { - ACPI_INTEGER val; + UINT64 val; uint8_t to; int error; diff --git a/sys/dev/acpica/acpi_video.c b/sys/dev/acpica/acpi_video.c index 048a45c..c253abc 100644 --- a/sys/dev/acpica/acpi_video.c +++ b/sys/dev/acpica/acpi_video.c @@ -840,7 +840,7 @@ vid_enum_outputs(ACPI_HANDLE handle, argset.dod_pkg = res; argset.count = 0; status = AcpiWalkNamespace(ACPI_TYPE_DEVICE, handle, 1, - vid_enum_outputs_subr, &argset, NULL); + vid_enum_outputs_subr, NULL, &argset, NULL); if (ACPI_FAILURE(status)) printf("failed walking down %s - %s\n", acpi_name(handle), AcpiFormatException(status)); diff --git a/sys/dev/acpica/acpivar.h b/sys/dev/acpica/acpivar.h index 9141656..5c827f2 100644 --- a/sys/dev/acpica/acpivar.h +++ b/sys/dev/acpica/acpivar.h @@ -254,7 +254,7 @@ __ACPI_BUS_ACCESSOR(acpi, magic, ACPI, MAGIC, uintptr_t) __ACPI_BUS_ACCESSOR(acpi, private, ACPI, PRIVATE, void *) __ACPI_BUS_ACCESSOR(acpi, flags, ACPI, FLAGS, int) -void acpi_fake_objhandler(ACPI_HANDLE h, UINT32 fn, void *data); +void acpi_fake_objhandler(ACPI_HANDLE h, void *data); static __inline device_t acpi_get_device(ACPI_HANDLE handle) { @@ -447,7 +447,7 @@ int acpi_acad_get_acline(int *); #define ACPI_PKG_VALID(pkg, size) \ ((pkg) != NULL && (pkg)->Type == ACPI_TYPE_PACKAGE && \ (pkg)->Package.Count >= (size)) -int acpi_PkgInt(ACPI_OBJECT *res, int idx, ACPI_INTEGER *dst); +int acpi_PkgInt(ACPI_OBJECT *res, int idx, UINT64 *dst); int acpi_PkgInt32(ACPI_OBJECT *res, int idx, uint32_t *dst); int acpi_PkgStr(ACPI_OBJECT *res, int idx, void *dst, size_t size); int acpi_PkgGas(device_t dev, ACPI_OBJECT *res, int idx, int *type, diff --git a/sys/dev/fdc/fdc_acpi.c b/sys/dev/fdc/fdc_acpi.c index 79fa66b..97ec9cb 100644 --- a/sys/dev/fdc/fdc_acpi.c +++ b/sys/dev/fdc/fdc_acpi.c @@ -97,9 +97,7 @@ fdc_acpi_attach(device_t dev) struct fdc_data *sc; ACPI_BUFFER buf; device_t bus; - int error, fde_count, i; - ACPI_OBJECT *obj, *pkg; - uint32_t fde[ACPI_FDC_MAXDEVS]; + int error; /* Get our softc and use the same accessor as ISA. */ sc = device_get_softc(dev); @@ -128,63 +126,12 @@ fdc_acpi_attach(device_t dev) */ bus = device_get_parent(dev); if (ACPI_FAILURE(ACPI_EVALUATE_OBJECT(bus, dev, "_FDE", NULL, &buf))) { - error = ENXIO; - goto out_hintsprobe; - } - - /* Parse the output of _FDE in various ways. */ - obj = pkg = (ACPI_OBJECT *)buf.Pointer; - switch (obj->Type) { - case ACPI_TYPE_BUFFER: - /* - * The spec says _FDE should be a buffer of five 32-bit - * integers. In violation of the spec, some systems use - * five bytes instead. - */ - switch (obj->Buffer.Length) { - case ACPI_FDC_FDE_LEN: - bcopy(obj->Buffer.Pointer, fde, ACPI_FDC_FDE_LEN); - break; - case ACPI_FDC_MAXDEVS: - for (i = 0; i < ACPI_FDC_MAXDEVS; i++) - fde[i] = ((uint8_t *)obj->Buffer.Pointer)[i]; - break; - default: - device_printf(dev, "_FDE wrong length: %d\n", - obj->Buffer.Length); - error = ENXIO; - goto out_hintsprobe; - } - break; - case ACPI_TYPE_PACKAGE: - /* - * In violation of the spec, systems including the ASUS - * K8V return a package of five integers instead of a - * buffer of five 32-bit integers. - */ - fde_count = min(ACPI_FDC_MAXDEVS, pkg->Package.Count); - for (i = 0; i < fde_count; i++) { - obj = &pkg->Package.Elements[i]; - if (obj->Type == ACPI_TYPE_INTEGER) - fde[i] = (uint32_t)obj->Integer.Value; - } - break; - default: - device_printf(dev, "invalid _FDE type %d\n", obj->Type); - error = ENXIO; - goto out_hintsprobe; + error = fdc_hints_probe(dev); + goto out; } /* Add fd child devices as specified. */ - error = fdc_acpi_probe_children(bus, dev, fde); - -out_hintsprobe: - /* - * If there was a problem with the _FDE drive enumeration, fall - * back to the hints-based probe. - */ - if (error) - error = fdc_hints_probe(dev); + error = fdc_acpi_probe_children(bus, dev, buf.Pointer); out: if (buf.Pointer) diff --git a/sys/modules/acpi/acpi/Makefile b/sys/modules/acpi/acpi/Makefile index b1c4fbc..992c59c 100644 --- a/sys/modules/acpi/acpi/Makefile +++ b/sys/modules/acpi/acpi/Makefile @@ -27,6 +27,10 @@ KMOD= acpi # ACPI CA sources +SRCS+= dbcmds.c dbdisply.c dbexec.c dbfileio.c dbhistry.c dbinput.c dbstats.c +SRCS+= dbutils.c dbxface.c +SRCS+= dmbuffer.c dmnames.c dmopcode.c dmobject.c dmresrc.c dmresrcl.c +SRCS+= dmresrcs.c dmutils.c dmwalk.c SRCS+= dsfield.c dsinit.c dsmethod.c dsmthdat.c dsobject.c dsopcode.c SRCS+= dsutils.c dswexec.c dswload.c dswscope.c dswstate.c SRCS+= evevent.c evgpe.c evgpeblk.c evmisc.c evregion.c evrgnini.c evsci.c @@ -37,16 +41,16 @@ SRCS+= exprep.c exregion.c exresnte.c exresolv.c exresop.c exstore.c SRCS+= exstoren.c exstorob.c exsystem.c exutils.c SRCS+= hwacpi.c hwgpe.c hwregs.c hwsleep.c hwtimer.c hwvalid.c hwxface.c SRCS+= nsaccess.c nsalloc.c nsdump.c nseval.c nsinit.c nsload.c nsnames.c -SRCS+= nsobject.c nsparse.c nspredef.c nssearch.c nsutils.c nswalk.c -SRCS+= nsxfeval.c nsxfname.c nsxfobj.c +SRCS+= nsobject.c nsparse.c nspredef.c nsrepair.c nsrepair2.c nssearch.c +SRCS+= nsutils.c nswalk.c nsxfeval.c nsxfname.c nsxfobj.c SRCS+= psargs.c psloop.c psopcode.c psparse.c psscope.c pstree.c psutils.c SRCS+= pswalk.c psxface.c SRCS+= rsaddr.c rscalc.c rscreate.c rsdump.c rsinfo.c rsio.c rsirq.c rslist.c SRCS+= rsmemory.c rsmisc.c rsutils.c rsxface.c SRCS+= tbfadt.c tbfind.c tbinstal.c tbutils.c tbxface.c tbxfroot.c SRCS+= utalloc.c utcache.c utcopy.c utdebug.c utdelete.c uteval.c utglobal.c -SRCS+= utinit.c utlock.c utmath.c utmisc.c utmutex.c utobject.c utresrc.c -SRCS+= utstate.c utxface.c +SRCS+= utids.c utinit.c utlock.c utmath.c utmisc.c utmutex.c utobject.c +SRCS+= utresrc.c utstate.c utxface.c # OSPM layer and core hardware drivers SRCS+= acpi.c acpi_button.c acpi_isab.c acpi_package.c acpi_pci.c acpi_pcib.c @@ -69,12 +73,6 @@ SRCS+= cpufreq_if.h device_if.h isa_if.h pci_if.h pcib_if.h # This obviously needs a better and more structural fix. SRCS+= opt_kstack_pages.h opt_nfs.h opt_apic.h opt_compat.h opt_hwpmc_hooks.h -# Debugging support -DBSRC= dbcmds.c dbdisply.c dbexec.c dbfileio.c dbhistry.c dbinput.c dbstats.c -DBSRC+= dbutils.c dbxface.c -DBSRC+= dmbuffer.c dmnames.c dmopcode.c dmobject.c dmresrc.c dmresrcl.c -DBSRC+= dmresrcs.c dmutils.c dmwalk.c - .if !defined(KERNBUILDDIR) .if KTR CFLAGS+=-DKTR @@ -87,7 +85,6 @@ CFLAGS+=-DACPI_MAX_THREADS=${ACPI_MAX_THREADS} .endif .if ACPI_DEBUG CFLAGS+=-DACPI_DEBUG -SRCS+= ${DBSRC} opt_ddb.h: Makefile echo "#define DDB 1" > ${.TARGET} .else @@ -98,10 +95,12 @@ opt_ddb.h: Makefile # Machine-specific code such as sleep/wakeup SRCS+= acpi_machdep.c acpi_wakecode.h acpi_wakeup.c -.if ${MACHINE} == "i386" -SRCS+= madt.c assym.s +SRCS+= assym.s madt.c +CLEANFILES+= acpi_wakecode.bin acpi_wakecode.h acpi_wakecode.o +.if ${MACHINE_ARCH} == "amd64" +SRCS+= opt_global.h +CLEANFILES+= acpi_wakedata.h .endif -CLEANFILES+= acpi_wakecode.h acpi_wakecode.o acpi_wakecode.bin ${DBSRC:.c=.o} acpi_wakecode.h: acpi_wakecode.S assym.s ${MAKE} -f ${.CURDIR}/../../../${MACHINE_ARCH}/acpica/Makefile \ diff --git a/usr.sbin/acpi/acpidb/Makefile b/usr.sbin/acpi/acpidb/Makefile index 1694867..5981f38 100644 --- a/usr.sbin/acpi/acpidb/Makefile +++ b/usr.sbin/acpi/acpidb/Makefile @@ -38,8 +38,8 @@ SRCS+= psargs.c psloop.c psopcode.c psparse.c psscope.c \ # namespace SRCS+= nsaccess.c nsalloc.c nsdump.c nseval.c nsinit.c \ nsload.c nsnames.c nsobject.c nsparse.c nspredef.c \ - nssearch.c nsutils.c nswalk.c nsxfeval.c nsxfname.c \ - nsxfobj.c + nsrepair.c nsrepair2.c nssearch.c nsutils.c nswalk.c \ + nsxfeval.c nsxfname.c nsxfobj.c # resources SRCS+= rsaddr.c rscalc.c rscreate.c rsdump.c rsinfo.c \ @@ -52,9 +52,9 @@ SRCS+= tbfadt.c tbfind.c tbinstal.c tbutils.c tbxface.c \ # utilities SRCS+= utalloc.c utcache.c utcopy.c utdebug.c utdelete.c \ - uteval.c utglobal.c utinit.c utlock.c utmath.c utmisc.c \ - utmutex.c utobject.c utresrc.c utstate.c uttrack.c \ - utxface.c + uteval.c utglobal.c utids.c utinit.c utlock.c utmath.c \ + utmisc.c utmutex.c utobject.c utresrc.c utstate.c \ + uttrack.c utxface.c MAN= acpidb.8 WARNS?= 2 diff --git a/usr.sbin/acpi/acpidb/acpidb.c b/usr.sbin/acpi/acpidb/acpidb.c index 53d9db1..325dfae 100644 --- a/usr.sbin/acpi/acpidb/acpidb.c +++ b/usr.sbin/acpi/acpidb/acpidb.c @@ -81,7 +81,7 @@ static int aml_simulate_regcontent_read(int regtype, static int aml_simulate_regcontent_write(int regtype, ACPI_PHYSICAL_ADDRESS addr, UINT8 *valuep); -static ACPI_INTEGER aml_simulate_prompt(char *msg, ACPI_INTEGER def_val); +static UINT64 aml_simulate_prompt(char *msg, UINT64 def_val); static void aml_simulation_regload(const char *dumpfile); static void aml_simulation_regdump(const char *dumpfile); @@ -161,11 +161,11 @@ aml_simulate_regcontent_write(int regtype, ACPI_PHYSICAL_ADDRESS addr, UINT8 *va return (aml_simulate_regcontent_add(regtype, addr, *valuep)); } -static ACPI_INTEGER -aml_simulate_prompt(char *msg, ACPI_INTEGER def_val) +static UINT64 +aml_simulate_prompt(char *msg, UINT64 def_val) { char buf[16], *ep; - ACPI_INTEGER val; + UINT64 val; val = def_val; printf("DEBUG"); @@ -271,12 +271,12 @@ aml_vm_space_handler( UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, - ACPI_INTEGER *Value, + UINT64 *Value, int Prompt) { int state; UINT8 val; - ACPI_INTEGER value, i; + UINT64 value, i; char msg[256]; static const char *space_names[] = { "SYSTEM_MEMORY", "SYSTEM_IO", "PCI_CONFIG", @@ -336,7 +336,7 @@ aml_vm_space_handler_##name ( \ UINT32 Function, \ ACPI_PHYSICAL_ADDRESS Address, \ UINT32 BitWidth, \ - ACPI_INTEGER *Value) \ + UINT64 *Value) \ { \ return (aml_vm_space_handler(id, Function, Address, \ BitWidth, Value, aml_debug_prompt)); \ diff --git a/usr.sbin/acpi/iasl/Makefile b/usr.sbin/acpi/iasl/Makefile index 551bfc6..ff6ebd7 100644 --- a/usr.sbin/acpi/iasl/Makefile +++ b/usr.sbin/acpi/iasl/Makefile @@ -5,7 +5,8 @@ SRCS= adfile.c adisasm.c adwalk.c SRCS+= osunixxf.c # common -SRCS+= dmrestag.c dmtable.c dmtbdump.c dmtbinfo.c getopt.c +SRCS+= dmextern.c dmrestag.c dmtable.c dmtbdump.c dmtbinfo.c \ + getopt.c # compiler SRCS+= aslanalyze.c aslcodegen.c aslcompile.c aslcompiler.y.h \ |