diff options
author | Jung-uk Kim <jkim@FreeBSD.org> | 2009-06-02 18:53:21 +0000 |
---|---|---|
committer | Jung-uk Kim <jkim@FreeBSD.org> | 2009-06-02 18:53:21 +0000 |
commit | a9f12690a1c5018ef2676597bbcdfb5a7f692b80 (patch) | |
tree | d651e323e75f9dcbfdcc972e9cb96f08c49ff0da /sys/contrib/dev | |
parent | 64345f0b57aa146d4e9246f4a4ec43388a65bbaa (diff) | |
parent | e83ee77d7b009e11006d75946be388f7b99f9990 (diff) |
MFV: ACPICA 20090521
Notes
Notes:
svn path=/projects/acpica_20090521/; revision=193335
Diffstat (limited to 'sys/contrib/dev')
-rw-r--r-- | sys/contrib/dev/acpica/CHANGES.txt | 8448 | ||||
-rwxr-xr-x | sys/contrib/dev/acpica/acpica_prep.sh | 54 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/changes.txt | 9235 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/common/adfile.c | 33 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/common/adisasm.c | 262 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/common/adwalk.c | 107 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/common/dmrestag.c | 27 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/common/dmtable.c | 215 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/common/dmtbdump.c | 471 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/common/dmtbinfo.c | 466 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/common/getopt.c | 6 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/compiler/aslanalyze.c | 88 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/compiler/aslcodegen.c | 43 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/compiler/aslcompile.c | 27 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/compiler/aslcompiler.h | 30 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/compiler/aslcompiler.l | 8 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/compiler/aslcompiler.y | 274 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/compiler/asldefine.h | 5 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/compiler/aslerror.c | 36 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/compiler/aslfiles.c | 22 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/compiler/aslfold.c | 13 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/compiler/aslglobal.h | 9 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/compiler/asllength.c | 7 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/compiler/asllisting.c | 17 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/compiler/aslload.c | 188 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/compiler/asllookup.c | 117 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/compiler/aslmain.c | 162 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/compiler/aslmap.c | 15 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/compiler/aslopcodes.c | 11 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/compiler/asloperands.c | 24 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/compiler/aslopt.c | 23 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/compiler/aslresource.c | 7 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/compiler/aslrestype1.c | 5 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/compiler/aslrestype2.c | 30 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/compiler/aslstartup.c | 446 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/compiler/aslstubs.c | 44 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/compiler/asltransform.c | 34 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/compiler/asltree.c | 6 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/compiler/asltypes.h | 19 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/compiler/aslutils.c | 25 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/debugger/dbcmds.c (renamed from sys/contrib/dev/acpica/dbcmds.c) | 334 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/debugger/dbdisply.c (renamed from sys/contrib/dev/acpica/dbdisply.c) | 24 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/debugger/dbexec.c (renamed from sys/contrib/dev/acpica/dbexec.c) | 142 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/debugger/dbfileio.c (renamed from sys/contrib/dev/acpica/dbfileio.c) | 27 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/debugger/dbhistry.c (renamed from sys/contrib/dev/acpica/dbhistry.c) | 12 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/debugger/dbinput.c (renamed from sys/contrib/dev/acpica/dbinput.c) | 26 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/debugger/dbstats.c (renamed from sys/contrib/dev/acpica/dbstats.c) | 30 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/debugger/dbutils.c (renamed from sys/contrib/dev/acpica/dbutils.c) | 17 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/debugger/dbxface.c (renamed from sys/contrib/dev/acpica/dbxface.c) | 16 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/disassembler/dmbuffer.c (renamed from sys/contrib/dev/acpica/dmbuffer.c) | 129 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/disassembler/dmnames.c (renamed from sys/contrib/dev/acpica/dmnames.c) | 24 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/disassembler/dmobject.c (renamed from sys/contrib/dev/acpica/dmobject.c) | 102 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/disassembler/dmopcode.c (renamed from sys/contrib/dev/acpica/dmopcode.c) | 19 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/disassembler/dmresrc.c (renamed from sys/contrib/dev/acpica/dmresrc.c) | 18 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/disassembler/dmresrcl.c (renamed from sys/contrib/dev/acpica/dmresrcl.c) | 14 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/disassembler/dmresrcs.c (renamed from sys/contrib/dev/acpica/dmresrcs.c) | 8 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/disassembler/dmutils.c (renamed from sys/contrib/dev/acpica/dmutils.c) | 12 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/disassembler/dmwalk.c (renamed from sys/contrib/dev/acpica/dmwalk.c) | 104 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/dispatcher/dsfield.c (renamed from sys/contrib/dev/acpica/dsfield.c) | 196 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/dispatcher/dsinit.c (renamed from sys/contrib/dev/acpica/dsinit.c) | 29 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/dispatcher/dsmethod.c (renamed from sys/contrib/dev/acpica/dsmethod.c) | 64 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/dispatcher/dsmthdat.c (renamed from sys/contrib/dev/acpica/dsmthdat.c) | 98 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/dispatcher/dsobject.c (renamed from sys/contrib/dev/acpica/dsobject.c) | 197 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/dispatcher/dsopcode.c (renamed from sys/contrib/dev/acpica/dsopcode.c) | 381 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/dispatcher/dsutils.c (renamed from sys/contrib/dev/acpica/dsutils.c) | 33 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/dispatcher/dswexec.c (renamed from sys/contrib/dev/acpica/dswexec.c) | 64 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/dispatcher/dswload.c (renamed from sys/contrib/dev/acpica/dswload.c) | 56 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/dispatcher/dswscope.c (renamed from sys/contrib/dev/acpica/dswscope.c) | 8 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/dispatcher/dswstate.c (renamed from sys/contrib/dev/acpica/dswstate.c) | 40 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/events/evevent.c (renamed from sys/contrib/dev/acpica/evevent.c) | 55 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/events/evgpe.c (renamed from sys/contrib/dev/acpica/evgpe.c) | 175 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/events/evgpeblk.c (renamed from sys/contrib/dev/acpica/evgpeblk.c) | 146 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/events/evmisc.c (renamed from sys/contrib/dev/acpica/evmisc.c) | 139 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/events/evregion.c (renamed from sys/contrib/dev/acpica/evregion.c) | 175 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/events/evrgnini.c (renamed from sys/contrib/dev/acpica/evrgnini.c) | 70 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/events/evsci.c (renamed from sys/contrib/dev/acpica/evsci.c) | 19 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/events/evxface.c (renamed from sys/contrib/dev/acpica/evxface.c) | 22 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/events/evxfevnt.c (renamed from sys/contrib/dev/acpica/evxfevnt.c) | 232 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/events/evxfregn.c (renamed from sys/contrib/dev/acpica/evxfregn.c) | 13 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/executer/exconfig.c (renamed from sys/contrib/dev/acpica/exconfig.c) | 319 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/executer/exconvrt.c (renamed from sys/contrib/dev/acpica/exconvrt.c) | 66 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/executer/excreate.c (renamed from sys/contrib/dev/acpica/excreate.c) | 145 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/executer/exdump.c (renamed from sys/contrib/dev/acpica/exdump.c) | 235 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/executer/exfield.c (renamed from sys/contrib/dev/acpica/exfield.c) | 71 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/executer/exfldio.c (renamed from sys/contrib/dev/acpica/exfldio.c) | 102 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/executer/exmisc.c (renamed from sys/contrib/dev/acpica/exmisc.c) | 48 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/executer/exmutex.c (renamed from sys/contrib/dev/acpica/exmutex.c) | 51 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/executer/exnames.c (renamed from sys/contrib/dev/acpica/exnames.c) | 10 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/executer/exoparg1.c (renamed from sys/contrib/dev/acpica/exoparg1.c) | 73 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/executer/exoparg2.c (renamed from sys/contrib/dev/acpica/exoparg2.c) | 20 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/executer/exoparg3.c (renamed from sys/contrib/dev/acpica/exoparg3.c) | 16 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/executer/exoparg6.c (renamed from sys/contrib/dev/acpica/exoparg6.c) | 12 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/executer/exprep.c (renamed from sys/contrib/dev/acpica/exprep.c) | 25 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/executer/exregion.c (renamed from sys/contrib/dev/acpica/exregion.c) | 21 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/executer/exresnte.c (renamed from sys/contrib/dev/acpica/exresnte.c) | 39 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/executer/exresolv.c (renamed from sys/contrib/dev/acpica/exresolv.c) | 115 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/executer/exresop.c (renamed from sys/contrib/dev/acpica/exresop.c) | 82 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/executer/exstore.c (renamed from sys/contrib/dev/acpica/exstore.c) | 186 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/executer/exstoren.c (renamed from sys/contrib/dev/acpica/exstoren.c) | 27 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/executer/exstorob.c (renamed from sys/contrib/dev/acpica/exstorob.c) | 8 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/executer/exsystem.c (renamed from sys/contrib/dev/acpica/exsystem.c) | 9 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/executer/exutils.c (renamed from sys/contrib/dev/acpica/exutils.c) | 13 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/hardware/hwacpi.c (renamed from sys/contrib/dev/acpica/hwacpi.c) | 15 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/hardware/hwgpe.c (renamed from sys/contrib/dev/acpica/hwgpe.c) | 106 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/hardware/hwregs.c | 602 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/hardware/hwsleep.c (renamed from sys/contrib/dev/acpica/hwsleep.c) | 277 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/hardware/hwtimer.c (renamed from sys/contrib/dev/acpica/hwtimer.c) | 8 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/hardware/hwvalid.c | 424 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/hardware/hwxface.c | 660 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/hwregs.c | 1001 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/include/acapps.h (renamed from sys/contrib/dev/acpica/acapps.h) | 13 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/include/accommon.h | 136 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/include/acconfig.h (renamed from sys/contrib/dev/acpica/acconfig.h) | 33 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/include/acdebug.h (renamed from sys/contrib/dev/acpica/acdebug.h) | 17 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/include/acdisasm.h (renamed from sys/contrib/dev/acpica/acdisasm.h) | 66 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/include/acdispat.h (renamed from sys/contrib/dev/acpica/acdispat.h) | 25 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/include/acevents.h (renamed from sys/contrib/dev/acpica/acevents.h) | 11 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/include/acexcep.h (renamed from sys/contrib/dev/acpica/acexcep.h) | 146 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/include/acglobal.h (renamed from sys/contrib/dev/acpica/acglobal.h) | 70 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/include/achware.h (renamed from sys/contrib/dev/acpica/achware.h) | 56 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/include/acinterp.h (renamed from sys/contrib/dev/acpica/acinterp.h) | 15 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/include/aclocal.h (renamed from sys/contrib/dev/acpica/aclocal.h) | 271 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/include/acmacros.h (renamed from sys/contrib/dev/acpica/acmacros.h) | 435 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/include/acnames.h (renamed from sys/contrib/dev/acpica/acnames.h) | 3 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/include/acnamesp.h (renamed from sys/contrib/dev/acpica/acnamesp.h) | 60 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/include/acobject.h (renamed from sys/contrib/dev/acpica/acobject.h) | 45 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/include/acopcode.h (renamed from sys/contrib/dev/acpica/acopcode.h) | 7 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/include/acoutput.h (renamed from sys/contrib/dev/acpica/acoutput.h) | 142 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/include/acparser.h (renamed from sys/contrib/dev/acpica/acparser.h) | 3 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/include/acpi.h | 138 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/include/acpiosxf.h (renamed from sys/contrib/dev/acpica/acpiosxf.h) | 27 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/include/acpixf.h (renamed from sys/contrib/dev/acpica/acpixf.h) | 194 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/include/acpredef.h | 534 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/include/acresrc.h (renamed from sys/contrib/dev/acpica/acresrc.h) | 6 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/include/acrestyp.h | 544 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/include/acstruct.h (renamed from sys/contrib/dev/acpica/acstruct.h) | 13 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/include/actables.h (renamed from sys/contrib/dev/acpica/actables.h) | 38 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/include/actbl.h (renamed from sys/contrib/dev/acpica/actbl.h) | 103 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/include/actbl1.h (renamed from sys/contrib/dev/acpica/actbl1.h) | 784 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/include/actbl2.h (renamed from sys/contrib/dev/acpica/actbl2.h) | 3 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/include/actypes.h (renamed from sys/contrib/dev/acpica/actypes.h) | 787 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/include/acutils.h (renamed from sys/contrib/dev/acpica/acutils.h) | 138 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/include/amlcode.h (renamed from sys/contrib/dev/acpica/amlcode.h) | 5 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/include/amlresrc.h (renamed from sys/contrib/dev/acpica/amlresrc.h) | 3 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/include/platform/accygwin.h | 163 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/include/platform/acefi.h (renamed from sys/contrib/dev/acpica/acefi.h) | 3 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/include/platform/acenv.h (renamed from sys/contrib/dev/acpica/acenv.h) | 320 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/include/platform/acfreebsd.h (renamed from sys/contrib/dev/acpica/acfreebsd.h) | 79 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/include/platform/acgcc.h (renamed from sys/contrib/dev/acpica/acgcc.h) | 4 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/include/platform/acintel.h | 168 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/include/platform/aclinux.h | 233 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/include/platform/acmsvc.h (renamed from sys/contrib/dev/acpica/acpi.h) | 90 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/include/platform/acnetbsd.h | 188 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/include/platform/acos2.h | 172 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/include/platform/acwin.h | 220 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/include/platform/acwin64.h | 155 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/namespace/nsaccess.c (renamed from sys/contrib/dev/acpica/nsaccess.c) | 152 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/namespace/nsalloc.c (renamed from sys/contrib/dev/acpica/nsalloc.c) | 41 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/namespace/nsdump.c (renamed from sys/contrib/dev/acpica/nsdump.c) | 82 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/namespace/nsdumpdv.c (renamed from sys/contrib/dev/acpica/nsdumpdv.c) | 7 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/namespace/nseval.c (renamed from sys/contrib/dev/acpica/nseval.c) | 62 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/namespace/nsinit.c (renamed from sys/contrib/dev/acpica/nsinit.c) | 42 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/namespace/nsload.c (renamed from sys/contrib/dev/acpica/nsload.c) | 22 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/namespace/nsnames.c (renamed from sys/contrib/dev/acpica/nsnames.c) | 62 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/namespace/nsobject.c (renamed from sys/contrib/dev/acpica/nsobject.c) | 38 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/namespace/nsparse.c (renamed from sys/contrib/dev/acpica/nsparse.c) | 48 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/namespace/nspredef.c | 1196 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/namespace/nssearch.c (renamed from sys/contrib/dev/acpica/nssearch.c) | 55 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/namespace/nsutils.c (renamed from sys/contrib/dev/acpica/nsutils.c) | 97 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/namespace/nswalk.c (renamed from sys/contrib/dev/acpica/nswalk.c) | 83 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/namespace/nsxfeval.c (renamed from sys/contrib/dev/acpica/nsxfeval.c) | 167 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/namespace/nsxfname.c (renamed from sys/contrib/dev/acpica/nsxfname.c) | 178 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/namespace/nsxfobj.c (renamed from sys/contrib/dev/acpica/nsxfobj.c) | 17 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/osunixxf.c | 390 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/parser/psargs.c (renamed from sys/contrib/dev/acpica/psargs.c) | 72 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/parser/psloop.c (renamed from sys/contrib/dev/acpica/psloop.c) | 38 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/parser/psopcode.c (renamed from sys/contrib/dev/acpica/psopcode.c) | 18 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/parser/psparse.c (renamed from sys/contrib/dev/acpica/psparse.c) | 80 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/parser/psscope.c (renamed from sys/contrib/dev/acpica/psscope.c) | 8 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/parser/pstree.c (renamed from sys/contrib/dev/acpica/pstree.c) | 10 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/parser/psutils.c (renamed from sys/contrib/dev/acpica/psutils.c) | 10 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/parser/pswalk.c (renamed from sys/contrib/dev/acpica/pswalk.c) | 8 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/parser/psxface.c (renamed from sys/contrib/dev/acpica/psxface.c) | 52 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/resources/rsaddr.c (renamed from sys/contrib/dev/acpica/rsaddr.c) | 8 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/resources/rscalc.c (renamed from sys/contrib/dev/acpica/rscalc.c) | 54 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/resources/rscreate.c (renamed from sys/contrib/dev/acpica/rscreate.c) | 75 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/resources/rsdump.c (renamed from sys/contrib/dev/acpica/rsdump.c) | 14 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/resources/rsinfo.c (renamed from sys/contrib/dev/acpica/rsinfo.c) | 8 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/resources/rsio.c (renamed from sys/contrib/dev/acpica/rsio.c) | 47 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/resources/rsirq.c (renamed from sys/contrib/dev/acpica/rsirq.c) | 51 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/resources/rslist.c (renamed from sys/contrib/dev/acpica/rslist.c) | 8 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/resources/rsmemory.c (renamed from sys/contrib/dev/acpica/rsmemory.c) | 8 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/resources/rsmisc.c (renamed from sys/contrib/dev/acpica/rsmisc.c) | 22 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/resources/rsutils.c (renamed from sys/contrib/dev/acpica/rsutils.c) | 21 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/resources/rsxface.c (renamed from sys/contrib/dev/acpica/rsxface.c) | 14 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/tables/tbfadt.c (renamed from sys/contrib/dev/acpica/tbfadt.c) | 474 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/tables/tbfind.c (renamed from sys/contrib/dev/acpica/tbfind.c) | 32 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/tables/tbinstal.c (renamed from sys/contrib/dev/acpica/tbinstal.c) | 201 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/tables/tbutils.c (renamed from sys/contrib/dev/acpica/tbutils.c) | 156 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/tables/tbxface.c (renamed from sys/contrib/dev/acpica/tbxface.c) | 232 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/tables/tbxfroot.c (renamed from sys/contrib/dev/acpica/tbxfroot.c) | 17 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/tools/acpiexec/Makefile | 146 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/tools/acpiexec/aecommon.h (renamed from sys/contrib/dev/acpica/aecommon.h) | 63 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/tools/acpiexec/aeexec.c | 589 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/tools/acpiexec/aehandlers.c | 909 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/tools/acpiexec/aemain.c | 435 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/tools/acpiexec/aetables.c | 505 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/tools/acpiexec/osunixdir.c | 306 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/tools/acpisrc/Makefile | 17 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/tools/acpisrc/acpisrc.h | 475 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/tools/acpisrc/ascase.c | 646 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/tools/acpisrc/asconvrt.c | 1523 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/tools/acpisrc/asfile.c | 886 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/tools/acpisrc/asmain.c | 512 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/tools/acpisrc/asremove.c | 688 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/tools/acpisrc/astable.c | 824 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/tools/acpisrc/asutils.c | 306 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/tools/acpisrc/osunixdir.c | 306 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/tools/acpixtract/Makefile | 16 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/tools/acpixtract/acpixtract.c | 788 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/tools/examples/examples.c | 506 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/utilities/utalloc.c (renamed from sys/contrib/dev/acpica/utalloc.c) | 80 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/utilities/utcache.c (renamed from sys/contrib/dev/acpica/utcache.c) | 14 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/utilities/utclib.c (renamed from sys/contrib/dev/acpica/utclib.c) | 8 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/utilities/utcopy.c (renamed from sys/contrib/dev/acpica/utcopy.c) | 252 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/utilities/utdebug.c (renamed from sys/contrib/dev/acpica/utdebug.c) | 113 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/utilities/utdelete.c (renamed from sys/contrib/dev/acpica/utdelete.c) | 85 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/utilities/uteval.c (renamed from sys/contrib/dev/acpica/uteval.c) | 94 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/utilities/utglobal.c (renamed from sys/contrib/dev/acpica/utglobal.c) | 170 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/utilities/utinit.c (renamed from sys/contrib/dev/acpica/utinit.c) | 15 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/utilities/utlock.c | 277 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/utilities/utmath.c (renamed from sys/contrib/dev/acpica/utmath.c) | 8 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/utilities/utmisc.c (renamed from sys/contrib/dev/acpica/utmisc.c) | 139 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/utilities/utmutex.c (renamed from sys/contrib/dev/acpica/utmutex.c) | 63 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/utilities/utobject.c (renamed from sys/contrib/dev/acpica/utobject.c) | 128 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/utilities/utresrc.c (renamed from sys/contrib/dev/acpica/utresrc.c) | 8 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/utilities/utstate.c (renamed from sys/contrib/dev/acpica/utstate.c) | 8 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/utilities/uttrack.c (renamed from sys/contrib/dev/acpica/uttrack.c) | 22 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/utilities/utxface.c (renamed from sys/contrib/dev/acpica/utxface.c) | 129 |
239 files changed, 37027 insertions, 15290 deletions
diff --git a/sys/contrib/dev/acpica/CHANGES.txt b/sys/contrib/dev/acpica/CHANGES.txt deleted file mode 100644 index f26ed47d97f9..000000000000 --- a/sys/contrib/dev/acpica/CHANGES.txt +++ /dev/null @@ -1,8448 +0,0 @@ ----------------------------------------- -20 March 2007. Summary of changes for version 20070320: - -1) ACPI CA Core Subsystem: - -Implemented a change to the order of interpretation and -evaluation of AML operand objects within the AML interpreter. The -interpreter now evaluates operands in the order that they appear -in the AML stream (and the corresponding ASL code), instead of in -the reverse order (after the entire operand list has been -parsed). The previous behavior caused several subtle -incompatibilities with the Microsoft AML interpreter as well as -being somewhat non-intuitive. BZ 7871, local BZ 263. Valery -Podrezov. - -Implemented a change to the ACPI Global Lock support. All -interfaces to the global lock now allow the same thread to -acquire the lock multiple times. This affects the -AcpiAcquireGlobalLock external interface to the global lock as -well as the internal use of the global lock to support AML fields --- a control method that is holding the global lock can now -simultaneously access AML fields that require global lock -protection. Previously, in both cases, this would have resulted -in an AE_ALREADY_ACQUIRED exception. The change to -AcpiAcquireGlobalLock is of special interest to drivers for the -Embedded Controller. There is no change to the behavior of the -AML Acquire operator, as this can already be used to acquire a -mutex multiple times by the same thread. BZ 8066. With assistance -from Alexey Starikovskiy. - -Fixed a problem where invalid objects could be referenced in the -AML Interpreter after error conditions. During operand -evaluation, ensure that the internal "Return Object" field is -cleared on error and only valid pointers are stored there. Caused -occasional access to deleted objects that resulted in "large -reference count" warning messages. Valery Podrezov. - -Fixed a problem where an AE_STACK_OVERFLOW internal exception -could occur on deeply nested control method invocations. BZ 7873, -local BZ 487. Valery Podrezov. - -Fixed an internal problem with the handling of result objects on -the interpreter result stack. BZ 7872. Valery Podrezov. - -Removed obsolete code that handled the case where AML_NAME_OP is -the target of a reference (Reference.Opcode). This code was no -longer necessary. BZ 7874. Valery Podrezov. - -Removed obsolete ACPI_NO_INTEGER64_SUPPORT from two header files. -This was a remnant from the previously discontinued 16-bit -support. - -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: 78.0K Code, 17.1K Data, 95.1K Total - Debug Version: 155.8K Code, 63.3K Data, 219.1K Total - Current Release: - Non-Debug Version: 78.0K Code, 17.1K Data, 95.1K Total - Debug Version: 155.9K Code, 63.1K Data, 219.0K Total - ----------------------------------------- -26 January 2007. Summary of changes for version 20070126: - -1) ACPI CA Core Subsystem: - -Added the 2007 copyright to all module headers and signons. This -affects virtually every file in the ACPICA core subsystem, the -iASL compiler, and the utilities. - -Implemented a fix for an incorrect parameter passed to -AcpiTbDeleteTable during a table load. A bad pointer was passed -in the case where the DSDT is overridden, causing a fault in this -case. - -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: 78.0K Code, 17.1K Data, 95.1K Total - Debug Version: 155.8K Code, 63.3K Data, 219.1K Total - Current Release: - Non-Debug Version: 78.0K Code, 17.1K Data, 95.1K Total - Debug Version: 155.8K Code, 63.3K Data, 219.1K Total - ----------------------------------------- -15 December 2006. Summary of changes for version 20061215: - -1) ACPI CA Core Subsystem: - -Support for 16-bit ACPICA has been completely removed since it is -no longer necessary and it clutters the code. All 16-bit macros, -types, and conditional compiles have been removed, cleaning up -and simplifying the code across the entire subsystem. DOS support -is no longer needed since the bootable Linux firmware kit is now -available. - -The handler for the Global Lock is now removed during -AcpiTerminate to enable a clean subsystem restart, via the -implementation of the AcpiEvRemoveGlobalLockHandler function. -(With assistance from Joel Bretz, HP) - -Implemented enhancements to the multithreading support within the -debugger to enable improved multithreading debugging and -evaluation of the subsystem. (Valery Podrezov) - -Debugger: Enhanced the Statistics/Memory command to emit the -total (maximum) memory used during the execution, as well as the -maximum memory consumed by each of the various object types. -(Valery Podrezov) - -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: 77.9K Code, 17.0K Data, 94.9K Total - Debug Version: 155.2K Code, 63.1K Data, 218.3K Total - Current Release: - Non-Debug Version: 78.0K Code, 17.1K Data, 95.1K Total - Debug Version: 155.8K Code, 63.3K Data, 219.1K Total - - -2) iASL Compiler/Disassembler and Tools: - -AcpiExec: Implemented a new option (-m) to display full memory -use statistics upon subsystem/program termination. (Valery -Podrezov) - ----------------------------------------- -09 November 2006. Summary of changes for version 20061109: - -1) ACPI CA Core Subsystem: - -Optimized the Load ASL operator in the case where the source -operand is an operation region. Simply map the operation region -memory, instead of performing a bytewise read. (Region must be of -type SystemMemory, see below.) - -Fixed the Load ASL operator for the case where the source operand -is a region field. A buffer object is also allowed as the source -operand. BZ 480 - -Fixed a problem where the Load ASL operator allowed the source -operand to be an operation region of any type. It is now -restricted to regions of type SystemMemory, as per the ACPI -specification. BZ 481 - -Additional cleanup and optimizations for the new Table Manager -code. - -AcpiEnable will now fail if all of the required ACPI tables are -not loaded (FADT, FACS, DSDT). BZ 477 - -Added #pragma pack(8/4) to acobject.h to ensure that the -structures in this header are always compiled as aligned. The -ACPI_OPERAND_OBJECT has been manually optimized to be aligned and -will not work if it is byte-packed. - -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: 78.1K Code, 17.1K Data, 95.2K Total - Debug Version: 155.4K Code, 63.1K Data, 218.5K Total - Current Release: - Non-Debug Version: 77.9K Code, 17.0K Data, 94.9K Total - Debug Version: 155.2K Code, 63.1K Data, 218.3K Total - - -2) iASL Compiler/Disassembler and Tools: - -Fixed a problem where the presence of the _OSI predefined control -method within complex expressions could cause an internal -compiler error. - -AcpiExec: Implemented full region support for multiple address -spaces. SpaceId is now part of the REGION object. BZ 429 - ----------------------------------------- -11 October 2006. Summary of changes for version 20061011: - -1) ACPI CA Core Subsystem: - -Completed an AML interpreter performance enhancement for control -method execution. Previously a 2-pass parse/execution, control -methods are now completely parsed and executed in a single pass. -This improves overall interpreter performance by ~25%, reduces -code size, and reduces CPU stack use. (Valery Podrezov + -interpreter changes in version 20051202 that eliminated namespace -loading during the pass one parse.) - -Implemented _CID support for PCI Root Bridge detection. If the -_HID does not match the predefined PCI Root Bridge IDs, the _CID -list (if present) is now obtained and also checked for an ID -match. - -Implemented additional support for the PCI _ADR execution: -upsearch until a device scope is found before executing _ADR. -This allows PCI_Config operation regions to be declared locally -within control methods underneath PCI device objects. - -Fixed a problem with a possible race condition between threads -executing AcpiWalkNamespace and the AML interpreter. This -condition was removed by modifying AcpiWalkNamespace to (by -default) ignore all temporary namespace entries created during -any concurrent control method execution. An additional namespace -race condition is known to exist between AcpiWalkNamespace and -the Load/Unload ASL operators and is still under investigation. - -Restructured the AML ParseLoop function, breaking it into several -subfunctions in order to reduce CPU stack use and improve -maintainability. (Mikhail Kouzmich) - -AcpiGetHandle: Fix for parameter validation to detect invalid -combinations of prefix handle and pathname. BZ 478 - -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: 77.9K Code, 17.1K Data, 95.0K Total - Debug Version: 154.6K Code, 63.0K Data, 217.6K Total - Current Release: - Non-Debug Version: 78.1K Code, 17.1K Data, 95.2K Total - Debug Version: 155.4K Code, 63.1K Data, 218.5K Total - -2) iASL Compiler/Disassembler and Tools: - -Ported the -g option (get local ACPI tables) to the new ACPICA -Table Manager to restore original behavior. - ----------------------------------------- -27 September 2006. Summary of changes for version 20060927: - -1) ACPI CA Core Subsystem: - -Removed the "Flags" parameter from AcpiGetRegister and -AcpiSetRegister. These functions now use a spinlock for mutual -exclusion and the interrupt level indication flag is not needed. - -Fixed a problem with the Global Lock where the lock could appear -to be obtained before it is actually obtained. The global lock -semaphore was inadvertently created with one unit instead of zero -units. (BZ 464) Fiodor Suietov. - -Fixed a possible memory leak and fault in -AcpiExResolveObjectToValue during a read from a buffer or region -field. (BZ 458) Fiodor Suietov. - -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: 77.9K Code, 17.1K Data, 95.0K Total - Debug Version: 154.7K Code, 63.0K Data, 217.7K Total - Current Release: - Non-Debug Version: 77.9K Code, 17.1K Data, 95.0K Total - Debug Version: 154.6K Code, 63.0K Data, 217.6K Total - - -2) iASL Compiler/Disassembler and Tools: - -Fixed a compilation problem with the pre-defined Resource -Descriptor field names where an "object does not exist" error -could be incorrectly generated if the parent ResourceTemplate -pathname places the template within a different namespace scope -than the current scope. (BZ 7212) - -Fixed a problem where the compiler could hang after syntax errors -detected in an ElseIf construct. (BZ 453) - -Fixed a problem with the AmlFilename parameter to the -DefinitionBlock() operator. An incorrect output filename was -produced when this parameter was a null string (""). Now, the -original input filename is used as the AML output filename, with -an ".aml" extension. - -Implemented a generic batch command mode for the AcpiExec utility -(execute any AML debugger command) (Valery Podrezov). - ----------------------------------------- -12 September 2006. Summary of changes for version 20060912: - -1) ACPI CA Core Subsystem: - -Enhanced the implementation of the "serialized mode" of the -interpreter (enabled via the AcpiGbl_AllMethodsSerialized flag.) -When this mode is specified, instead of creating a serialization -semaphore per control method, the interpreter lock is simply no -longer released before a blocking operation during control method -execution. This effectively makes the AML Interpreter single- -threaded. The overhead of a semaphore per-method is eliminated. - -Fixed a regression where an error was no longer emitted if a -control method attempts to create 2 objects of the same name. -This once again returns AE_ALREADY_EXISTS. When this exception -occurs, it invokes the mechanism that will dynamically serialize -the control method to possible prevent future errors. (BZ 440) - -Integrated a fix for a problem with PCI Express HID detection in -the PCI Config Space setup procedure. (BZ 7145) - -Moved all FADT-related functions to a new file, tbfadt.c. -Eliminated the AcpiHwInitialize function - the FADT registers are -now validated when the table is loaded. - -Added two new warnings during FADT verification - 1) if the FADT -is larger than the largest known FADT version, and 2) if there is -a mismatch between a 32-bit block address and the 64-bit X -counterpart (when both are non-zero.) - -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: 77.9K Code, 16.7K Data, 94.6K Total - Debug Version: 154.9K Code, 62.6K Data, 217.5K Total - Current Release: - Non-Debug Version: 77.9K Code, 17.1K Data, 95.0K Total - Debug Version: 154.7K Code, 63.0K Data, 217.7K Total - - -2) iASL Compiler/Disassembler and Tools: - -Fixed a problem with the implementation of the Switch() operator -where the temporary variable was declared too close to the actual -Switch, instead of at method level. This could cause a problem if -the Switch() operator is within a while loop, causing an error on -the second iteration. (BZ 460) - -Disassembler - fix for error emitted for unknown type for target -of scope operator. Now, ignore it and continue. - -Disassembly of an FADT now verifies the input FADT and reports -any errors found. Fix for proper disassembly of full-sized (ACPI -2.0) FADTs. - -Disassembly of raw data buffers with byte initialization data now -prefixes each output line with the current buffer offset. - -Disassembly of ASF! table now includes all variable-length data -fields at the end of some of the subtables. - -The disassembler now emits a comment if a buffer appears to be a -ResourceTemplate, but cannot be disassembled as such because the -EndTag does not appear at the very end of the buffer. - -AcpiExec - Added the "-t" command line option to enable the -serialized mode of the AML interpreter. - ----------------------------------------- -31 August 2006. Summary of changes for version 20060831: - -1) ACPI CA Core Subsystem: - -Miscellaneous fixes for the Table Manager: -- Correctly initialize internal common FADT for all 64-bit "X" -fields -- Fixed a couple table mapping issues during table load -- Fixed a couple alignment issues for IA64 -- Initialize input array to zero in AcpiInitializeTables -- Additional parameter validation for AcpiGetTable, -AcpiGetTableHeader, AcpiGetTableByIndex - -Change for GPE support: when a "wake" GPE is received, all wake -GPEs are now immediately disabled to prevent the waking GPE from -firing again and to prevent other wake GPEs from interrupting the -wake process. - -Added the AcpiGpeCount global that tracks the number of processed -GPEs, to be used for debugging systems with a large number of -ACPI interrupts. - -Implemented support for the "DMAR" ACPI table (DMA Redirection -Table) in both the ACPICA headers and the disassembler. - -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: 77.8K Code, 16.5K Data, 94.3K Total - Debug Version: 154.6K Code, 62.3K Data, 216.9K Total - Current Release: - Non-Debug Version: 77.9K Code, 16.7K Data, 94.6K Total - Debug Version: 154.9K Code, 62.6K Data, 217.5K Total - - -2) iASL Compiler/Disassembler and Tools: - -Disassembler support for the DMAR ACPI table. - ----------------------------------------- -23 August 2006. Summary of changes for version 20060823: - -1) ACPI CA Core Subsystem: - -The Table Manager component has been completely redesigned and -reimplemented. The new design is much simpler, and reduces the -overall code and data size of the kernel-resident ACPICA by -approximately 5%. Also, it is now possible to obtain the ACPI -tables very early during kernel initialization, even before -dynamic memory management is initialized. (Alexey Starikovskiy, -Fiodor Suietov, Bob Moore) - -Obsolete ACPICA interfaces: - -- AcpiGetFirmwareTable: Use AcpiGetTable instead (works at early -kernel init time). -- AcpiLoadTable: Not needed. -- AcpiUnloadTable: Not needed. - -New ACPICA interfaces: - -- AcpiInitializeTables: Must be called before the table manager -can be used. -- AcpiReallocateRootTable: Used to transfer the root table to -dynamically allocated memory after it becomes available. -- AcpiGetTableByIndex: Allows the host to easily enumerate all -ACPI tables in the RSDT/XSDT. - -Other ACPICA changes: - -- AcpiGetTableHeader returns the actual mapped table header, not -a copy. Use AcpiOsUnmapMemory to free this mapping. -- AcpiGetTable returns the actual mapped table. The mapping is -managed internally and must not be deleted by the caller. Use of -this interface causes no additional dynamic memory allocation. -- AcpiFindRootPointer: Support for physical addressing has been -eliminated, it appeared to be unused. -- The interface to AcpiOsMapMemory has changed to be consistent -with the other allocation interfaces. -- The interface to AcpiOsGetRootPointer has changed to eliminate -unnecessary parameters. -- ACPI_PHYSICAL_ADDRESS is now 32 bits on 32-bit platforms, 64 -bits on 64-bit platforms. Was previously 64 bits on all -platforms. -- The interface to the ACPI Global Lock acquire/release macros -have changed slightly since ACPICA no longer keeps a local copy -of the FACS with a constructed pointer to the actual global lock. - -Porting to the new table manager: - -- AcpiInitializeTables: Must be called once, and can be called -anytime during the OS initialization process. It allows the host -to specify an area of memory to be used to store the internal -version of the RSDT/XSDT (root table). This allows the host to -access ACPI tables before memory management is initialized and -running. -- AcpiReallocateRootTable: Can be called after memory management -is running to copy the root table to a dynamically allocated -array, freeing up the scratch memory specified in the call to -AcpiInitializeTables. -- AcpiSubsystemInitialize: This existing interface is independent -of the Table Manager, and does not have to be called before the -Table Manager can be used, it only must be called before the rest -of ACPICA can be used. -- ACPI Tables: Some changes have been made to the names and -structure of the actbl.h and actbl1.h header files and may -require changes to existing code. For example, bitfields have -been completely removed because of their lack of portability -across C compilers. -- Update interfaces to the Global Lock acquire/release macros if -local versions are used. (see acwin.h) - -Obsolete files: tbconvrt.c, tbget.c, tbgetall.c, tbrsdt.c - -New files: tbfind.c - -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: 80.7K Code, 17.9K Data, 98.6K Total - Debug Version: 161.0K Code, 65.1K Data, 226.1K Total - Current Release: - Non-Debug Version: 77.8K Code, 16.5K Data, 94.3K Total - Debug Version: 154.6K Code, 62.3K Data, 216.9K Total - - -2) iASL Compiler/Disassembler and Tools: - -No changes for this release. - ----------------------------------------- -21 July 2006. Summary of changes for version 20060721: - -1) ACPI CA Core Subsystem: - -The full source code for the ASL test suite used to validate the -iASL compiler and the ACPICA core subsystem is being released -with the ACPICA source for the first time. The source is -contained in a separate package and consists of over 1100 files -that exercise all ASL/AML operators. The package should appear on -the Intel/ACPI web site shortly. (Valery Podrezov, Fiodor -Suietov) - -Completed a new design and implementation for support of the ACPI -Global Lock. On the OS side, the global lock is now treated as a -standard AML mutex. Previously, multiple OS threads could -"acquire" the global lock simultaneously. However, this could -cause the BIOS to be starved out of the lock - especially in -cases such as the Embedded Controller driver where there is a -tight coupling between the OS and the BIOS. - -Implemented an optimization for the ACPI Global Lock interrupt -mechanism. The Global Lock interrupt handler no longer queues the -execution of a separate thread to signal the global lock -semaphore. Instead, the semaphore is signaled directly from the -interrupt handler. - -Implemented support within the AML interpreter for package -objects that contain a larger AML length (package list length) -than the package element count. In this case, the length of the -package is truncated to match the package element count. Some -BIOS code apparently modifies the package length on the fly, and -this change supports this behavior. Provides compatibility with -the MS AML interpreter. (With assistance from Fiodor Suietov) - -Implemented a temporary fix for the BankValue parameter of a Bank -Field to support all constant values, now including the Zero and -One opcodes. Evaluation of this parameter must eventually be -converted to a full TermArg evaluation. A not-implemented error -is now returned (temporarily) for non-constant values for this -parameter. - -Fixed problem reports (Fiodor Suietov) integrated: -- Fix for premature object deletion after CopyObject on Operation -Region (BZ 350) - -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: 80.7K Code, 18.0K Data, 98.7K Total - Debug Version: 160.9K Code, 65.1K Data, 226.0K Total - Current Release: - Non-Debug Version: 80.7K Code, 17.9K Data, 98.6K Total - Debug Version: 161.0K Code, 65.1K Data, 226.1K Total - - -2) iASL Compiler/Disassembler and Tools: - -No changes for this release. - ----------------------------------------- -07 July 2006. Summary of changes for version 20060707: - -1) ACPI CA Core Subsystem: - -Added the ACPI_PACKED_POINTERS_NOT_SUPPORTED macro to support C -compilers that do not allow the initialization of address -pointers within packed structures - even though the hardware -itself may support misaligned transfers. Some of the debug data -structures are packed by default to minimize size. - -Added an error message for the case where AcpiOsGetThreadId() -returns zero. A non-zero value is required by the core ACPICA -code to ensure the proper operation of AML mutexes and recursive -control methods. - -The DSDT is now the only ACPI table that determines whether the -AML interpreter is in 32-bit or 64-bit mode. Not really a -functional change, but the hooks for per-table 32/64 switching -have been removed from the code. A clarification to the ACPI -specification is forthcoming in ACPI 3.0B. - -Fixed a possible leak of an OwnerID in the error path of -AcpiTbInitTableDescriptor (tbinstal.c), and migrated all table -OwnerID deletion to a single place in AcpiTbUninstallTable to -correct possible leaks when using the AcpiTbDeleteTablesByType -interface (with assistance from Lance Ortiz.) - -Fixed a problem with Serialized control methods where the -semaphore associated with the method could be over-signaled after -multiple method invocations. - -Fixed two issues with the locking of the internal namespace data -structure. Both the Unload() operator and AcpiUnloadTable -interface now lock the namespace during the namespace deletion -associated with the table unload (with assistance from Linn -Crosetto.) - -Fixed problem reports (Valery Podrezov) integrated: -- Eliminate unnecessary memory allocation for CreateXxxxField (BZ -5426) - -Fixed problem reports (Fiodor Suietov) integrated: -- Incomplete cleanup branches in AcpiTbGetTableRsdt (BZ 369) -- On Address Space handler deletion, needless deactivation call -(BZ 374) -- AcpiRemoveAddressSpaceHandler: validate Device handle parameter -(BZ 375) -- Possible memory leak, Notify sub-objects of Processor, Power, -ThermalZone (BZ 376) -- AcpiRemoveAddressSpaceHandler: validate Handler parameter (BZ -378) -- Minimum Length of RSDT should be validated (BZ 379) -- AcpiRemoveNotifyHandler: return AE_NOT_EXIST if Processor Obj -has no Handler (BZ (380) -- AcpiUnloadTable: return AE_NOT_EXIST if no table of specified -type loaded (BZ 381) - -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: 80.5K Code, 17.8K Data, 98.3K Total - Debug Version: 160.8K Code, 64.8K Data, 225.6K Total - Current Release: - Non-Debug Version: 80.7K Code, 17.9K Data, 98.6K Total - Debug Version: 161.0K Code, 65.1K Data, 226.1K Total - - -2) iASL Compiler/Disassembler and Tools: - -Fixed problem reports: -Compiler segfault when ASL contains a long (>1024) String -declaration (BZ 436) - ----------------------------------------- -23 June 2006. Summary of changes for version 20060623: - -1) ACPI CA Core Subsystem: - -Implemented a new ACPI_SPINLOCK type for the OSL lock interfaces. -This allows the type to be customized to the host OS for improved -efficiency (since a spinlock is usually a very small object.) - -Implemented support for "ignored" bits in the ACPI registers. -According to the ACPI specification, these bits should be -preserved when writing the registers via a read/modify/write -cycle. There are 3 bits preserved in this manner: PM1_CONTROL[0] -(SCI_EN), PM1_CONTROL[9], and PM1_STATUS[11]. - -Implemented the initial deployment of new OSL mutex interfaces. -Since some host operating systems have separate mutex and -semaphore objects, this feature was requested. The base code now -uses mutexes (and the new mutex interfaces) wherever a binary -semaphore was used previously. However, for the current release, -the mutex interfaces are defined as macros to map them to the -existing semaphore interfaces. Therefore, no OSL changes are -required at this time. (See acpiosxf.h) - -Fixed several problems with the support for the control method -SyncLevel parameter. The SyncLevel now works according to the -ACPI specification and in concert with the Mutex SyncLevel -parameter, since the current SyncLevel is a property of the -executing thread. Mutual exclusion for control methods is now -implemented with a mutex instead of a semaphore. - -Fixed three instances of the use of the C shift operator in the -bitfield support code (exfldio.c) to avoid the use of a shift -value larger than the target data width. The behavior of C -compilers is undefined in this case and can cause unpredictable -results, and therefore the case must be detected and avoided. -(Fiodor Suietov) - -Added an info message whenever an SSDT or OEM table is loaded -dynamically via the Load() or LoadTable() ASL operators. This -should improve debugging capability since it will show exactly -what tables have been loaded (beyond the tables present in the -RSDT/XSDT.) - -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: 80.0K Code, 17.6K Data, 97.6K Total - Debug Version: 160.2K Code, 64.7K Data, 224.9K Total - Current Release: - Non-Debug Version: 80.5K Code, 17.8K Data, 98.3K Total - Debug Version: 160.8K Code, 64.8K Data, 225.6K Total - - -2) iASL Compiler/Disassembler and Tools: - -No changes for this release. - ----------------------------------------- -08 June 2006. Summary of changes for version 20060608: - -1) ACPI CA Core Subsystem: - -Converted the locking mutex used for the ACPI hardware to a -spinlock. This change should eliminate all problems caused by -attempting to acquire a semaphore at interrupt level, and it -means that all ACPICA external interfaces that directly access -the ACPI hardware can be safely called from interrupt level. OSL -code that implements the semaphore interfaces should be able to -eliminate any workarounds for being called at interrupt level. - -Fixed a regression introduced in 20060526 where the ACPI device -initialization could be prematurely aborted with an AE_NOT_FOUND -if a device did not have an optional _INI method. - -Fixed an IndexField issue where a write to the Data Register -should be limited in size to the AccessSize (width) of the -IndexField itself. (BZ 433, Fiodor Suietov) - -Fixed problem reports (Valery Podrezov) integrated: -- Allow store of ThermalZone objects to Debug object (BZ -5369/5370) - -Fixed problem reports (Fiodor Suietov) integrated: -- AcpiGetTableHeader doesn't handle multiple instances correctly -(BZ 364) - -Removed four global mutexes that were obsolete and were no longer -being used. - -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: 80.0K Code, 17.7K Data, 97.7K Total - Debug Version: 160.3K Code, 64.9K Data, 225.2K Total - Current Release: - Non-Debug Version: 80.0K Code, 17.6K Data, 97.6K Total - Debug Version: 160.2K Code, 64.7K Data, 224.9K Total - - -2) iASL Compiler/Disassembler and Tools: - -Fixed a fault when using -g option (get tables from registry) on -Windows machines. - -Fixed problem reports integrated: -- Generate error if CreateField NumBits parameter is zero. (BZ -405) -- Fault if Offset/Length in Field unit is very large (BZ 432, -Fiodor Suietov) -- Global table revision override (-r) is ignored (BZ 413) - ----------------------------------------- -26 May 2006. Summary of changes for version 20060526: - -1) ACPI CA Core Subsystem: - -Restructured, flattened, and simplified the internal interfaces -for namespace object evaluation - resulting in smaller code, less -CPU stack use, and fewer interfaces. (With assistance from -Mikhail Kouzmich) - -Fixed a problem with the CopyObject operator where the first -parameter was not typed correctly for the parser, interpreter, -compiler, and disassembler. Caused various errors and unexpected -behavior. - -Fixed a problem where a ShiftLeft or ShiftRight of more than 64 -bits produced incorrect results with some C compilers. Since the -behavior of C compilers when the shift value is larger than the -datatype width is apparently not well defined, the interpreter -now detects this condition and simply returns zero as expected in -all such cases. (BZ 395) - -Fixed problem reports (Valery Podrezov) integrated: -- Update String-to-Integer conversion to match ACPI 3.0A spec (BZ -5329) -- Allow interpreter to handle nested method declarations (BZ -5361) - -Fixed problem reports (Fiodor Suietov) integrated: -- AcpiTerminate doesn't free debug memory allocation list objects -(BZ 355) -- After Core Subsystem shutdown, AcpiSubsystemStatus returns -AE_OK (BZ 356) -- AcpiOsUnmapMemory for RSDP can be invoked inconsistently (BZ -357) -- Resource Manager should return AE_TYPE for non-device objects -(BZ 358) -- Incomplete cleanup branch in AcpiNsEvaluateRelative (BZ 359) -- Use AcpiOsFree instead of ACPI_FREE in AcpiRsSetSrsMethodData -(BZ 360) -- Incomplete cleanup branch in AcpiPsParseAml (BZ 361) -- Incomplete cleanup branch in AcpiDsDeleteWalkState (BZ 362) -- AcpiGetTableHeader returns AE_NO_ACPI_TABLES until DSDT is -loaded (BZ 365) -- Status of the Global Initialization Handler call not used (BZ -366) -- Incorrect object parameter to Global Initialization Handler (BZ -367) - -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: 79.8K Code, 17.7K Data, 97.5K Total - Debug Version: 160.5K Code, 65.1K Data, 225.6K Total - Current Release: - Non-Debug Version: 80.0K Code, 17.7K Data, 97.7K Total - Debug Version: 160.3K Code, 64.9K Data, 225.2K Total - - -2) iASL Compiler/Disassembler and Tools: - -Modified the parser to allow the names IO, DMA, and IRQ to be -used as namespace identifiers with no collision with existing -resource descriptor macro names. This provides compatibility with -other ASL compilers and is most useful for -disassembly/recompilation of existing tables without parse -errors. (With assistance from Thomas Renninger) - -Disassembler: fixed an incorrect disassembly problem with the -DataTableRegion and CopyObject operators. Fixed a possible fault -during disassembly of some Alias operators. - ----------------------------------------- -12 May 2006. Summary of changes for version 20060512: - -1) ACPI CA Core Subsystem: - -Replaced the AcpiOsQueueForExecution interface with a new -interface named AcpiOsExecute. The major difference is that the -new interface does not have a Priority parameter, this appeared -to be useless and has been replaced by a Type parameter. The Type -tells the host what type of execution is being requested, such as -global lock handler, notify handler, GPE handler, etc. This -allows the host to queue and execute the request as appropriate -for the request type, possibly using different work queues and -different priorities for the various request types. This enables -fixes for multithreading deadlock problems such as BZ #5534, and -will require changes to all existing OS interface layers. (Alexey -Starikovskiy and Bob Moore) - -Fixed a possible memory leak associated with the support for the -so-called "implicit return" ACPI extension. Reported by FreeBSD, -BZ #6514. (Fiodor Suietov) - -Fixed a problem with the Load() operator where a table load from -an operation region could overwrite an internal table buffer by -up to 7 bytes and cause alignment faults on IPF systems. (With -assistance from Luming Yu) - -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: 79.7K Code, 17.7K Data, 97.4K Total - Debug Version: 160.1K Code, 65.2K Data, 225.3K Total - Current Release: - Non-Debug Version: 79.8K Code, 17.7K Data, 97.5K Total - Debug Version: 160.5K Code, 65.1K Data, 225.6K Total - - - -2) iASL Compiler/Disassembler and Tools: - -Disassembler: Implemented support to cross reference the internal -namespace and automatically generate ASL External() statements -for symbols not defined within the current table being -disassembled. This will simplify the disassembly and -recompilation of interdependent tables such as SSDTs since these -statements will no longer have to be added manually. - -Disassembler: Implemented experimental support to automatically -detect invocations of external control methods and generate -appropriate External() statements. This is problematic because -the AML cannot be correctly parsed until the number of arguments -for each control method is known. Currently, standalone method -invocations and invocations as the source operand of a Store() -statement are supported. - -Disassembler: Implemented support for the ASL pseudo-operators -LNotEqual, LLessEqual, and LGreaterEqual. Previously disassembled -as LNot(LEqual()), LNot(LGreater()), and LNot(LLess()), this -makes the disassembled ASL code more readable and likely closer -to the original ASL source. - ----------------------------------------- -21 April 2006. Summary of changes for version 20060421: - -1) ACPI CA Core Subsystem: - -Removed a device initialization optimization introduced in -20051216 where the _STA method was not run unless an _INI was -also present for the same device. This optimization could cause -problems because it could allow _INI methods to be run within a -not-present device subtree. (If a not-present device had no _INI, -_STA would not be run, the not-present status would not be -discovered, and the children of the device would be incorrectly -traversed.) - -Implemented a new _STA optimization where namespace subtrees that -do not contain _INI are identified and ignored during device -initialization. Selectively running _STA can significantly -improve boot time on large machines (with assistance from Len -Brown.) - -Implemented support for the device initialization case where the -returned _STA flags indicate a device not-present but -functioning. In this case, _INI is not run, but the device -children are examined for presence, as per the ACPI -specification. - -Implemented an additional change to the IndexField support in -order to conform to MS behavior. The value written to the Index -Register is not simply a byte offset, it is a byte offset in -units of the access width of the parent Index Field. (Fiodor -Suietov) - -Defined and deployed a new OSL interface, AcpiOsValidateAddress. -This interface is called during the creation of all AML operation -regions, and allows the host OS to exert control over what -addresses it will allow the AML code to access. Operation Regions -whose addresses are disallowed will cause a runtime exception -when they are actually accessed (will not affect or abort table -loading.) See oswinxf or osunixxf for an example implementation. - -Defined and deployed a new OSL interface, -AcpiOsValidateInterface. This interface allows the host OS to -match the various "optional" interface/behavior strings for the -_OSI predefined control method as appropriate (with assistance -from Bjorn Helgaas.) See oswinxf or osunixxf for an example -implementation. - -Restructured and corrected various problems in the exception -handling code paths within DsCallControlMethod and -DsTerminateControlMethod in dsmethod (with assistance from -Takayoshi Kochi.) - -Modified the Linux source converter to ignore quoted string -literals while converting identifiers from mixed to lower case. -This will correct problems with the disassembler and other areas -where such strings must not be modified. - -The ACPI_FUNCTION_* macros no longer require quotes around the -function name. This allows the Linux source converter to convert -the names, now that the converter ignores quoted strings. - -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: 81.1K Code, 17.7K Data, 98.8K Total - Debug Version: 158.9K Code, 64.9K Data, 223.8K Total - Current Release: - Non-Debug Version: 79.7K Code, 17.7K Data, 97.4K Total - Debug Version: 160.1K Code, 65.2K Data, 225.3K Total - - -2) iASL Compiler/Disassembler and Tools: - -Implemented 3 new warnings for iASL, and implemented multiple -warning levels (w2 flag). - -1) Ignored timeouts: If the TimeoutValue parameter to Wait or -Acquire is not WAIT_FOREVER (0xFFFF) and the code does not -examine the return value to check for the possible timeout, a -warning is issued. - -2) Useless operators: If an ASL operator does not specify an -optional target operand and it also does not use the function -return value from the operator, a warning is issued since the -operator effectively does nothing. - -3) Unreferenced objects: If a namespace object is created, but -never referenced, a warning is issued. This is a warning level 2 -since there are cases where this is ok, such as when a secondary -table is loaded that uses the unreferenced objects. Even so, care -is taken to only flag objects that don't look like they will ever -be used. For example, the reserved methods (starting with an -underscore) are usually not referenced because it is expected -that the OS will invoke them. - ----------------------------------------- -31 March 2006. Summary of changes for version 20060331: - -1) ACPI CA Core Subsystem: - -Implemented header file support for the following additional ACPI -tables: ASF!, BOOT, CPEP, DBGP, MCFG, SPCR, SPMI, TCPA, and WDRT. -With this support, all current and known ACPI tables are now -defined in the ACPICA headers and are available for use by device -drivers and other software. - -Implemented support to allow tables that contain ACPI names with -invalid characters to be loaded. Previously, this would cause the -table load to fail, but since there are several known cases of -such tables on existing machines, this change was made to enable -ACPI support for them. Also, this matches the behavior of the -Microsoft ACPI implementation. - -Fixed a couple regressions introduced during the memory -optimization in the 20060317 release. The namespace node -definition required additional reorganization and an internal -datatype that had been changed to 8-bit was restored to 32-bit. -(Valery Podrezov) - -Fixed a problem where a null pointer passed to -AcpiUtDeleteGenericState could be passed through to -AcpiOsReleaseObject which is unexpected. Such null pointers are -now trapped and ignored, matching the behavior of the previous -implementation before the deployment of AcpiOsReleaseObject. -(Valery Podrezov, Fiodor Suietov) - -Fixed a memory mapping leak during the deletion of a SystemMemory -operation region where a cached memory mapping was not deleted. -This became a noticeable problem for operation regions that are -defined within frequently used control methods. (Dana Meyers) - -Reorganized the ACPI table header files into two main files: one -for the ACPI tables consumed by the ACPICA core, and another for -the miscellaneous ACPI tables that are consumed by the drivers -and other software. The various FADT definitions were merged into -one common section and three different tables (ACPI 1.0, 1.0+, -and 2.0) - -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: 80.9K Code, 17.7K Data, 98.6K Total - Debug Version: 158.7K Code, 64.8K Data, 223.5K Total - Current Release: - Non-Debug Version: 81.1K Code, 17.7K Data, 98.8K Total - Debug Version: 158.9K Code, 64.9K Data, 223.8K Total - - -2) iASL Compiler/Disassembler and Tools: - -Disassembler: Implemented support to decode and format all non- -AML ACPI tables (tables other than DSDTs and SSDTs.) This -includes the new tables added to the ACPICA headers, therefore -all current and known ACPI tables are supported. - -Disassembler: The change to allow ACPI names with invalid -characters also enables the disassembly of such tables. Invalid -characters within names are changed to '*' to make the name -printable; the iASL compiler will still generate an error for -such names, however, since this is an invalid ACPI character. - -Implemented an option for AcpiXtract (-a) to extract all tables -found in the input file. The default invocation extracts only the -DSDTs and SSDTs. - -Fixed a couple of gcc generation issues for iASL and AcpiExec and -added a makefile for the AcpiXtract utility. - ----------------------------------------- -17 March 2006. Summary of changes for version 20060317: - -1) ACPI CA Core Subsystem: - -Implemented the use of a cache object for all internal namespace -nodes. Since there are about 1000 static nodes in a typical -system, this will decrease memory use for cache implementations -that minimize per-allocation overhead (such as a slab allocator.) - -Removed the reference count mechanism for internal namespace -nodes, since it was deemed unnecessary. This reduces the size of -each namespace node by about 5%-10% on all platforms. Nodes are -now 20 bytes for the 32-bit case, and 32 bytes for the 64-bit -case. - -Optimized several internal data structures to reduce object size -on 64-bit platforms by packing data within the 64-bit alignment. -This includes the frequently used ACPI_OPERAND_OBJECT, of which -there can be ~1000 static instances corresponding to the -namespace objects. - -Added two new strings for the predefined _OSI method: "Windows -2001.1 SP1" and "Windows 2006". - -Split the allocation tracking mechanism out to a separate file, -from utalloc.c to uttrack.c. This mechanism appears to be only -useful for application-level code. Kernels may wish to not -include uttrack.c in distributions. - -Removed all remnants of the obsolete ACPI_REPORT_* macros and the -associated code. (These macros have been replaced by the -ACPI_ERROR and ACPI_WARNING macros.) - -Code and Data Size: These are the sizes for the acpica.lib -produced by the Microsoft Visual C++ 6.0 32-bit compiler. The -values do not include any ACPI driver or OSPM code. The debug -version of the code includes the debug output trace mechanism and -has a much larger code and data size. Note that these values will -vary depending on the efficiency of the compiler and the compiler -options used during generation. - - Previous Release: - Non-Debug Version: 81.1K Code, 17.8K Data, 98.9K Total - Debug Version: 161.6K Code, 65.7K Data, 227.3K Total - Current Release: - Non-Debug Version: 80.9K Code, 17.7K Data, 98.6K Total - Debug Version: 158.7K Code, 64.8K Data, 223.5K Total - - -2) iASL Compiler/Disassembler and Tools: - -Implemented an ANSI C version of the acpixtract utility. This -version will automatically extract the DSDT and all SSDTs from -the input acpidump text file and dump the binary output to -separate files. It can also display a summary of the input file -including the headers for each table found and will extract any -single ACPI table, with any signature. (See -source/tools/acpixtract) - ----------------------------------------- -10 March 2006. Summary of changes for version 20060310: - -1) ACPI CA Core Subsystem: - -Tagged all external interfaces to the subsystem with the new -ACPI_EXPORT_SYMBOL macro. This macro can be defined as necessary -to assist kernel integration. For Linux, the macro resolves to -the EXPORT_SYMBOL macro. The default definition is NULL. - -Added the ACPI_THREAD_ID type for the return value from -AcpiOsGetThreadId. This allows the host to define this as -necessary to simplify kernel integration. The default definition -is ACPI_NATIVE_UINT. - -Fixed two interpreter problems related to error processing, the -deletion of objects, and placing invalid pointers onto the -internal operator result stack. BZ 6028, 6151 (Valery Podrezov) - -Increased the reference count threshold where a warning is -emitted for large reference counts in order to eliminate -unnecessary warnings on systems with large namespaces (especially -64-bit.) Increased the value from 0x400 to 0x800. - -Due to universal disagreement as to the meaning of the 'c' in the -calloc() function, the ACPI_MEM_CALLOCATE macro has been renamed -to ACPI_ALLOCATE_ZEROED so that the purpose of the interface is -'clear'. ACPI_MEM_ALLOCATE and ACPI_MEM_FREE are renamed to -ACPI_ALLOCATE and ACPI_FREE. - -Code and Data Size: These are the sizes for the acpica.lib -produced by the Microsoft Visual C++ 6.0 32-bit compiler. The -values do not include any ACPI driver or OSPM code. The debug -version of the code includes the debug output trace mechanism and -has a much larger code and data size. Note that these values will -vary depending on the efficiency of the compiler and the compiler -options used during generation. - - Previous Release: - Non-Debug Version: 81.0K Code, 17.8K Data, 98.8K Total - Debug Version: 161.4K Code, 65.7K Data, 227.1K Total - Current Release: - Non-Debug Version: 81.1K Code, 17.8K Data, 98.9K Total - Debug Version: 161.6K Code, 65.7K Data, 227.3K Total - - -2) iASL Compiler/Disassembler: - -Disassembler: implemented support for symbolic resource -descriptor references. If a CreateXxxxField operator references a -fixed offset within a resource descriptor, a name is assigned to -the descriptor and the offset is translated to the appropriate -resource tag and pathname. The addition of this support brings -the disassembled code very close to the original ASL source code -and helps eliminate run-time errors when the disassembled code is -modified (and recompiled) in such a way as to invalidate the -original fixed offsets. - -Implemented support for a Descriptor Name as the last parameter -to the ASL Register() macro. This parameter was inadvertently -left out of the ACPI specification, and will be added for ACPI -3.0b. - -Fixed a problem where the use of the "_OSI" string (versus the -full path "\_OSI") caused an internal compiler error. ("No back -ptr to op") - -Fixed a problem with the error message that occurs when an -invalid string is used for a _HID object (such as one with an -embedded asterisk: "*PNP010A".) The correct message is now -displayed. - ----------------------------------------- -17 February 2006. Summary of changes for version 20060217: - -1) ACPI CA Core Subsystem: - -Implemented a change to the IndexField support to match the -behavior of the Microsoft AML interpreter. The value written to -the Index register is now a byte offset, no longer an index based -upon the width of the Data register. This should fix IndexField -problems seen on some machines where the Data register is not -exactly one byte wide. The ACPI specification will be clarified -on this point. - -Fixed a problem where several resource descriptor types could -overrun the internal descriptor buffer due to size -miscalculation: VendorShort, VendorLong, and Interrupt. This was -noticed on IA64 machines, but could affect all platforms. - -Fixed a problem where individual resource descriptors were -misaligned within the internal buffer, causing alignment faults -on IA64 platforms. - -Code and Data Size: These are the sizes for the acpica.lib -produced by the Microsoft Visual C++ 6.0 32-bit compiler. The -values do not include any ACPI driver or OSPM code. The debug -version of the code includes the debug output trace mechanism and -has a much larger code and data size. Note that these values will -vary depending on the efficiency of the compiler and the compiler -options used during generation. - - Previous Release: - Non-Debug Version: 81.1K Code, 17.8K Data, 98.9K Total - Debug Version: 161.3K Code, 65.6K Data, 226.9K Total - Current Release: - Non-Debug Version: 81.0K Code, 17.8K Data, 98.8K Total - Debug Version: 161.4K Code, 65.7K Data, 227.1K Total - - -2) iASL Compiler/Disassembler: - -Implemented support for new reserved names: _WDG and _WED are -Microsoft extensions for Windows Instrumentation Management, _TDL -is a new ACPI-defined method (Throttling Depth Limit.) - -Fixed a problem where a zero-length VendorShort or VendorLong -resource descriptor was incorrectly emitted as a descriptor of -length one. - ----------------------------------------- -10 February 2006. Summary of changes for version 20060210: - -1) ACPI CA Core Subsystem: - -Removed a couple of extraneous ACPI_ERROR messages that appeared -during normal execution. These became apparent after the -conversion from ACPI_DEBUG_PRINT. - -Fixed a problem where the CreateField operator could hang if the -BitIndex or NumBits parameter referred to a named object. (Valery -Podrezov, BZ 5359) - -Fixed a problem where a DeRefOf operation on a buffer object -incorrectly failed with an exception. This also fixes a couple of -related RefOf and DeRefOf issues. (Valery Podrezov, BZ -5360/5392/5387) - -Fixed a problem where the AE_BUFFER_LIMIT exception was returned -instead of AE_STRING_LIMIT on an out-of-bounds Index() operation. -(Valery Podrezov, BZ 5480) - -Implemented a memory cleanup at the end of the execution of each -iteration of an AML While() loop, preventing the accumulation of -outstanding objects. (Valery Podrezov, BZ 5427) - -Eliminated a chunk of duplicate code in the object resolution -code. (Valery Podrezov, BZ 5336) - -Fixed several warnings during the 64-bit code generation. - -The AcpiSrc source code conversion tool now inserts one line of -whitespace after an if() statement that is followed immediately -by a comment, improving readability of the Linux code. - -Code and Data Size: The current and previous library sizes for -the core subsystem are shown below. These are the code and data -sizes for the acpica.lib produced by the Microsoft Visual C++ 6.0 -32-bit compiler. These values do not include any ACPI driver or -OSPM code. The debug version of the code includes the debug -output trace mechanism and has a much larger code and data size. -Note that these values will vary depending on the efficiency of -the compiler and the compiler options used during generation. - - Previous Release: - Non-Debug Version: 81.0K Code, 17.9K Data, 98.9K Total - Debug Version: 161.3K Code, 65.7K Data, 227.0K Total - Current Release: - Non-Debug Version: 81.1K Code, 17.8K Data, 98.9K Total - Debug Version: 161.3K Code, 65.6K Data, 226.9K Total - - -2) iASL Compiler/Disassembler: - -Fixed a problem with the disassembly of a BankField operator with -a complex expression for the BankValue parameter. - ----------------------------------------- -27 January 2006. Summary of changes for version 20060127: - -1) ACPI CA Core Subsystem: - -Implemented support in the Resource Manager to allow unresolved -namestring references within resource package objects for the -_PRT method. This support is in addition to the previously -implemented unresolved reference support within the AML parser. -If the interpreter slack mode is enabled, these unresolved -references will be passed through to the caller as a NULL package -entry. - -Implemented and deployed new macros and functions for error and -warning messages across the subsystem. These macros are simpler -and generate less code than their predecessors. The new macros -ACPI_ERROR, ACPI_EXCEPTION, ACPI_WARNING, and ACPI_INFO replace -the ACPI_REPORT_* macros. The older macros remain defined to -allow ACPI drivers time to migrate to the new macros. - -Implemented the ACPI_CPU_FLAGS type to simplify host OS -integration of the Acquire/Release Lock OSL interfaces. - -Fixed a problem where Alias ASL operators are sometimes not -correctly resolved, in both the interpreter and the iASL -compiler. - -Fixed several problems with the implementation of the -ConcatenateResTemplate ASL operator. As per the ACPI -specification, zero length buffers are now treated as a single -EndTag. One-length buffers always cause a fatal exception. Non- -zero length buffers that do not end with a full 2-byte EndTag -cause a fatal exception. - -Fixed a possible structure overwrite in the AcpiGetObjectInfo -external interface. (With assistance from Thomas Renninger) - -Code and Data Size: The current and previous library sizes for -the core subsystem are shown below. These are the code and data -sizes for the acpica.lib produced by the Microsoft Visual C++ 6.0 -32-bit compiler. These values do not include any ACPI driver or -OSPM code. The debug version of the code includes the debug -output trace mechanism and has a much larger code and data size. -Note that these values will vary depending on the efficiency of -the compiler and the compiler options used during generation. - - Previous Release: - Non-Debug Version: 83.1K Code, 18.4K Data, 101.5K Total - Debug Version: 163.2K Code, 66.2K Data, 229.4K Total - Current Release: - Non-Debug Version: 81.0K Code, 17.9K Data, 98.9K Total - Debug Version: 161.3K Code, 65.7K Data, 227.0K Total - - -2) iASL Compiler/Disassembler: - -Fixed an internal error that was generated for any forward -references to ASL Alias objects. - ----------------------------------------- -13 January 2006. Summary of changes for version 20060113: - -1) ACPI CA Core Subsystem: - -Added 2006 copyright to all module headers and signons. This -affects virtually every file in the ACPICA core subsystem, iASL -compiler, and the utilities. - -Enhanced the ACPICA error reporting in order to simplify user -migration to the non-debug version of ACPICA. Replaced all -instances of the ACPI_DEBUG_PRINT macro invoked at the -ACPI_DB_ERROR and ACPI_DB_WARN debug levels with the -ACPI_REPORT_ERROR and ACPI_REPORT_WARNING macros, respectively. -This preserves all error and warning messages in the non-debug -version of the ACPICA code (this has been referred to as the -"debug lite" option.) Over 200 cases were converted to create a -total of over 380 error/warning messages across the ACPICA code. -This increases the code and data size of the default non-debug -version of the code somewhat (about 13K), but all error/warning -reporting may be disabled if desired (and code eliminated) by -specifying the ACPI_NO_ERROR_MESSAGES compile-time configuration -option. The size of the debug version of ACPICA remains about the -same. - -Fixed a memory leak within the AML Debugger "Set" command. One -object was not properly deleted for every successful invocation -of the command. - -Code and Data Size: The current and previous library sizes for -the core subsystem are shown below. These are the code and data -sizes for the acpica.lib produced by the Microsoft Visual C++ 6.0 -32-bit compiler. These values do not include any ACPI driver or -OSPM code. The debug version of the code includes the debug -output trace mechanism and has a much larger code and data size. -Note that these values will vary depending on the efficiency of -the compiler and the compiler options used during generation. - - Previous Release: - Non-Debug Version: 76.6K Code, 12.3K Data, 88.9K Total - Debug Version: 163.7K Code, 67.5K Data, 231.2K Total - Current Release: - Non-Debug Version: 83.1K Code, 18.4K Data, 101.5K Total - Debug Version: 163.2K Code, 66.2K Data, 229.4K Total - - -2) iASL Compiler/Disassembler: - -The compiler now officially supports the ACPI 3.0a specification -that was released on December 30, 2005. (Specification is -available at www.acpi.info) - ----------------------------------------- -16 December 2005. Summary of changes for version 20051216: - -1) ACPI CA Core Subsystem: - -Implemented optional support to allow unresolved names within ASL -Package objects. A null object is inserted in the package when a -named reference cannot be located in the current namespace. -Enabled via the interpreter slack flag, this should eliminate -AE_NOT_FOUND exceptions seen on machines that contain such code. - -Implemented an optimization to the initialization sequence that -can improve boot time. During ACPI device initialization, the -_STA method is now run if and only if the _INI method exists. The -_STA method is used to determine if the device is present; An -_INI can only be run if _STA returns present, but it is a waste -of time to run the _STA method if the _INI does not exist. -(Prototype and assistance from Dong Wei) - -Implemented use of the C99 uintptr_t for the pointer casting -macros if it is available in the current compiler. Otherwise, the -default (void *) cast is used as before. - -Fixed some possible memory leaks found within the execution path -of the Break, Continue, If, and CreateField operators. (Valery -Podrezov) - -Fixed a problem introduced in the 20051202 release where an -exception is generated during method execution if a control -method attempts to declare another method. - -Moved resource descriptor string constants that are used by both -the AML disassembler and AML debugger to the common utilities -directory so that these components are independent. - -Implemented support in the AcpiExec utility (-e switch) to -globally ignore exceptions during control method execution -(method is not aborted.) - -Added the rsinfo.c source file to the AcpiExec makefile for -Linux/Unix generation. - -Code and Data Size: The current and previous library sizes for -the core subsystem are shown below. These are the code and data -sizes for the acpica.lib produced by the Microsoft Visual C++ 6.0 -32-bit compiler. These values do not include any ACPI driver or -OSPM code. The debug version of the code includes the debug -output trace mechanism and has a much larger code and data size. -Note that these values will vary depending on the efficiency of -the compiler and the compiler options used during generation. - - Previous Release: - Non-Debug Version: 76.3K Code, 12.3K Data, 88.6K Total - Debug Version: 163.2K Code, 67.4K Data, 230.6K Total - Current Release: - Non-Debug Version: 76.6K Code, 12.3K Data, 88.9K Total - Debug Version: 163.7K Code, 67.5K Data, 231.2K Total - - -2) iASL Compiler/Disassembler: - -Fixed a problem where a CPU stack overflow fault could occur if a -recursive method call was made from within a Return statement. - ----------------------------------------- -02 December 2005. Summary of changes for version 20051202: - -1) ACPI CA Core Subsystem: - -Modified the parsing of control methods to no longer create -namespace objects during the first pass of the parse. Objects are -now created only during the execute phase, at the moment the -namespace creation operator is encountered in the AML (Name, -OperationRegion, CreateByteField, etc.) This should eliminate -ALREADY_EXISTS exceptions seen on some machines where reentrant -control methods are protected by an AML mutex. The mutex will now -correctly block multiple threads from attempting to create the -same object more than once. - -Increased the number of available Owner Ids for namespace object -tracking from 32 to 255. This should eliminate the OWNER_ID_LIMIT -exceptions seen on some machines with a large number of ACPI -tables (either static or dynamic). - -Fixed a problem with the AcpiExec utility where a fault could -occur when the -b switch (batch mode) is used. - -Enhanced the namespace dump routine to output the owner ID for -each namespace object. - -Code and Data Size: The current and previous library sizes for -the core subsystem are shown below. These are the code and data -sizes for the acpica.lib produced by the Microsoft Visual C++ 6.0 -32-bit compiler. These values do not include any ACPI driver or -OSPM code. The debug version of the code includes the debug -output trace mechanism and has a much larger code and data size. -Note that these values will vary depending on the efficiency of -the compiler and the compiler options used during generation. - - Previous Release: - Non-Debug Version: 76.3K Code, 12.3K Data, 88.6K Total - Debug Version: 163.0K Code, 67.4K Data, 230.4K Total - Current Release: - Non-Debug Version: 76.3K Code, 12.3K Data, 88.6K Total - Debug Version: 163.2K Code, 67.4K Data, 230.6K Total - - -2) iASL Compiler/Disassembler: - -Fixed a parse error during compilation of certain Switch/Case -constructs. To simplify the parse, the grammar now allows for -multiple Default statements and this error is now detected and -flagged during the analysis phase. - -Disassembler: The disassembly now includes the contents of the -original table header within a comment at the start of the file. -This includes the name and version of the original ASL compiler. - ----------------------------------------- -17 November 2005. Summary of changes for version 20051117: - -1) ACPI CA Core Subsystem: - -Fixed a problem in the AML parser where the method thread count -could be decremented below zero if any errors occurred during the -method parse phase. This should eliminate AE_AML_METHOD_LIMIT -exceptions seen on some machines. This also fixed a related -regression with the mechanism that detects and corrects methods -that cannot properly handle reentrancy (related to the deployment -of the new OwnerId mechanism.) - -Eliminated the pre-parsing of control methods (to detect errors) -during table load. Related to the problem above, this was causing -unwind issues if any errors occurred during the parse, and it -seemed to be overkill. A table load should not be aborted if -there are problems with any single control method, thus rendering -this feature rather pointless. - -Fixed a problem with the new table-driven resource manager where -an internal buffer overflow could occur for small resource -templates. - -Implemented a new external interface, AcpiGetVendorResource. This -interface will find and return a vendor-defined resource -descriptor within a _CRS or _PRS method via an ACPI 3.0 UUID -match. With assistance from Bjorn Helgaas. - -Removed the length limit (200) on string objects as per the -upcoming ACPI 3.0A specification. This affects the following -areas of the interpreter: 1) any implicit conversion of a Buffer -to a String, 2) a String object result of the ASL Concatentate -operator, 3) the String object result of the ASL ToString -operator. - -Fixed a problem in the Windows OS interface layer (OSL) where a -WAIT_FOREVER on a semaphore object would incorrectly timeout. -This allows the multithreading features of the AcpiExec utility -to work properly under Windows. - -Updated the Linux makefiles for the iASL compiler and AcpiExec to -include the recently added file named "utresrc.c". - -Code and Data Size: The current and previous library sizes for -the core subsystem are shown below. These are the code and data -sizes for the acpica.lib produced by the Microsoft Visual C++ 6.0 -32-bit compiler. These values do not include any ACPI driver or -OSPM code. The debug version of the code includes the debug -output trace mechanism and has a much larger code and data size. -Note that these values will vary depending on the efficiency of -the compiler and the compiler options used during generation. - - Previous Release: - Non-Debug Version: 76.2K Code, 12.3K Data, 88.5K Total - Debug Version: 163.0K Code, 67.4K Data, 230.4K Total - Current Release: - Non-Debug Version: 76.3K Code, 12.3K Data, 88.6K Total - Debug Version: 163.0K Code, 67.4K Data, 230.4K Total - - -2) iASL Compiler/Disassembler: - -Removed the limit (200) on string objects as per the upcoming -ACPI 3.0A specification. For the iASL compiler, this means that -string literals within the source ASL can be of any length. - -Enhanced the listing output to dump the AML code for resource -descriptors immediately after the ASL code for each descriptor, -instead of in a block at the end of the entire resource template. - -Enhanced the compiler debug output to dump the entire original -parse tree constructed during the parse phase, before any -transforms are applied to the tree. The transformed tree is -dumped also. - ----------------------------------------- -02 November 2005. Summary of changes for version 20051102: - -1) ACPI CA Core Subsystem: - -Modified the subsystem initialization sequence to improve GPE -support. The GPE initialization has been split into two parts in -order to defer execution of the _PRW methods (Power Resources for -Wake) until after the hardware is fully initialized and the SCI -handler is installed. This allows the _PRW methods to access -fields protected by the Global Lock. This will fix systems where -a NO_GLOBAL_LOCK exception has been seen during initialization. - -Converted the ACPI internal object disassemble and display code -within the AML debugger to fully table-driven operation, reducing -code size and increasing maintainability. - -Fixed a regression with the ConcatenateResTemplate() ASL operator -introduced in the 20051021 release. - -Implemented support for "local" internal ACPI object types within -the debugger "Object" command and the AcpiWalkNamespace external -interfaces. These local types include RegionFields, BankFields, -IndexFields, Alias, and reference objects. - -Moved common AML resource handling code into a new file, -"utresrc.c". This code is shared by both the Resource Manager and -the AML Debugger. - -Code and Data Size: The current and previous library sizes for -the core subsystem are shown below. These are the code and data -sizes for the acpica.lib produced by the Microsoft Visual C++ 6.0 -32-bit compiler. These values do not include any ACPI driver or -OSPM code. The debug version of the code includes the debug -output trace mechanism and has a much larger code and data size. -Note that these values will vary depending on the efficiency of -the compiler and the compiler options used during generation. - - Previous Release: - Non-Debug Version: 76.1K Code, 12.2K Data, 88.3K Total - Debug Version: 163.5K Code, 67.0K Data, 230.5K Total - Current Release: - Non-Debug Version: 76.2K Code, 12.3K Data, 88.5K Total - Debug Version: 163.0K Code, 67.4K Data, 230.4K Total - - -2) iASL Compiler/Disassembler: - -Fixed a problem with very large initializer lists (more than 4000 -elements) for both Buffer and Package objects where the parse -stack could overflow. - -Enhanced the pre-compile source code scan for non-ASCII -characters to ignore characters within comment fields. The scan -is now always performed and is no longer optional, detecting -invalid characters within a source file immediately rather than -during the parse phase or later. - -Enhanced the ASL grammar definition to force early reductions on -all list-style grammar elements so that the overall parse stack -usage is greatly reduced. This should improve performance and -reduce the possibility of parse stack overflow. - -Eliminated all reduce/reduce conflicts in the iASL parser -generation. Also, with the addition of a %expected statement, the -compiler generates from source with no warnings. - -Fixed a possible segment fault in the disassembler if the input -filename does not contain a "dot" extension (Thomas Renninger). - ----------------------------------------- -21 October 2005. Summary of changes for version 20051021: - -1) ACPI CA Core Subsystem: - -Implemented support for the EM64T and other x86-64 processors. -This essentially entails recognizing that these processors -support non-aligned memory transfers. Previously, all 64-bit -processors were assumed to lack hardware support for non-aligned -transfers. - -Completed conversion of the Resource Manager to nearly full table- -driven operation. Specifically, the resource conversion code -(convert AML to internal format and the reverse) and the debug -code to dump internal resource descriptors are fully table- -driven, reducing code and data size and improving -maintainability. - -The OSL interfaces for Acquire and Release Lock now use a 64-bit -flag word on 64-bit processors instead of a fixed 32-bit word. -(With assistance from Alexey Starikovskiy) - -Implemented support within the resource conversion code for the -Type-Specific byte within the various ACPI 3.0 *WordSpace macros. - -Fixed some issues within the resource conversion code for the -type-specific flags for both Memory and I/O address resource -descriptors. For Memory, implemented support for the MTP and TTP -flags. For I/O, split the TRS and TTP flags into two separate -fields. - -Code and Data Size: The current and previous library sizes for -the core subsystem are shown below. These are the code and data -sizes for the acpica.lib produced by the Microsoft Visual C++ 6.0 -32-bit compiler. These values do not include any ACPI driver or -OSPM code. The debug version of the code includes the debug -output trace mechanism and has a much larger code and data size. -Note that these values will vary depending on the efficiency of -the compiler and the compiler options used during generation. - - Previous Release: - Non-Debug Version: 77.1K Code, 12.1K Data, 89.2K Total - Debug Version: 168.0K Code, 68.3K Data, 236.3K Total - Current Release: - Non-Debug Version: 76.1K Code, 12.2K Data, 88.3K Total - Debug Version: 163.5K Code, 67.0K Data, 230.5K Total - - - -2) iASL Compiler/Disassembler: - -Relaxed a compiler restriction that disallowed a ResourceIndex -byte if the corresponding ResourceSource string was not also -present in a resource descriptor declaration. This restriction -caused problems with existing AML/ASL code that includes the -Index byte without the string. When such AML was disassembled, it -could not be compiled without modification. Further, the modified -code created a resource template with a different size than the -original, breaking code that used fixed offsets into the resource -template buffer. - -Removed a recent feature of the disassembler to ignore a lone -ResourceIndex byte. This byte is now emitted if present so that -the exact AML can be reproduced when the disassembled code is -recompiled. - -Improved comments and text alignment for the resource descriptor -code emitted by the disassembler. - -Implemented disassembler support for the ACPI 3.0 AccessSize -field within a Register() resource descriptor. - ----------------------------------------- -30 September 2005. Summary of changes for version 20050930: - -1) ACPI CA Core Subsystem: - -Completed a major overhaul of the Resource Manager code - -specifically, optimizations in the area of the AML/internal -resource conversion code. The code has been optimized to simplify -and eliminate duplicated code, CPU stack use has been decreased -by optimizing function parameters and local variables, and naming -conventions across the manager have been standardized for clarity -and ease of maintenance (this includes function, parameter, -variable, and struct/typedef names.) The update may force changes -in some driver code, depending on how resources are handled by -the host OS. - -All Resource Manager dispatch and information tables have been -moved to a single location for clarity and ease of maintenance. -One new file was created, named "rsinfo.c". - -The ACPI return macros (return_ACPI_STATUS, etc.) have been -modified to guarantee that the argument is not evaluated twice, -making them less prone to macro side-effects. However, since -there exists the possibility of additional stack use if a -particular compiler cannot optimize them (such as in the debug -generation case), the original macros are optionally available. -Note that some invocations of the return_VALUE macro may now -cause size mismatch warnings; the return_UINT8 and return_UINT32 -macros are provided to eliminate these. (From Randy Dunlap) - -Implemented a new mechanism to enable debug tracing for -individual control methods. A new external interface, -AcpiDebugTrace, is provided to enable this mechanism. The intent -is to allow the host OS to easily enable and disable tracing for -problematic control methods. This interface can be easily exposed -to a user or debugger interface if desired. See the file -psxface.c for details. - -AcpiUtCallocate will now return a valid pointer if a length of -zero is specified - a length of one is used and a warning is -issued. This matches the behavior of AcpiUtAllocate. - -Code and Data Size: The current and previous library sizes for -the core subsystem are shown below. These are the code and data -sizes for the acpica.lib produced by the Microsoft Visual C++ 6.0 -32-bit compiler. These values do not include any ACPI driver or -OSPM code. The debug version of the code includes the debug -output trace mechanism and has a much larger code and data size. -Note that these values will vary depending on the efficiency of -the compiler and the compiler options used during generation. - - Previous Release: - Non-Debug Version: 77.5K Code, 12.0K Data, 89.5K Total - Debug Version: 168.1K Code, 68.4K Data, 236.5K Total - Current Release: - Non-Debug Version: 77.1K Code, 12.1K Data, 89.2K Total - Debug Version: 168.0K Code, 68.3K Data, 236.3K Total - - -2) iASL Compiler/Disassembler: - -A remark is issued if the effective compile-time length of a -package or buffer is zero. Previously, this was a warning. - ----------------------------------------- -16 September 2005. Summary of changes for version 20050916: - -1) ACPI CA Core Subsystem: - -Fixed a problem within the Resource Manager where support for the -Generic Register descriptor was not fully implemented. This -descriptor is now fully recognized, parsed, disassembled, and -displayed. - -Completely restructured the Resource Manager code to utilize -table-driven dispatch and lookup, eliminating many of the large -switch() statements. This reduces overall subsystem code size and -code complexity. Affects the resource parsing and construction, -disassembly, and debug dump output. - -Cleaned up and restructured the debug dump output for all -resource descriptors. Improved readability of the output and -reduced code size. - -Fixed a problem where changes to internal data structures caused -the optional ACPI_MUTEX_DEBUG code to fail compilation if -specified. - -Code and Data Size: The current and previous library sizes for -the core subsystem are shown below. These are the code and data -sizes for the acpica.lib produced by the Microsoft Visual C++ 6.0 -32-bit compiler. These values do not include any ACPI driver or -OSPM code. The debug version of the code includes the debug -output trace mechanism and has a much larger code and data size. -Note that these values will vary depending on the efficiency of -the compiler and the compiler options used during generation. - - Previous Release: - Non-Debug Version: 78.4K Code, 11.8K Data, 90.2K Total - Debug Version: 169.6K Code, 69.9K Data, 239.5K Total - Current Release: - Non-Debug Version: 77.5K Code, 12.0K Data, 89.5K Total - Debug Version: 168.1K Code, 68.4K Data, 236.5K Total - - -2) iASL Compiler/Disassembler: - -Updated the disassembler to automatically insert an -EndDependentFn() macro into the ASL stream if this macro is -missing in the original AML code, simplifying compilation of the -resulting ASL module. - -Fixed a problem in the disassembler where a disassembled -ResourceSource string (within a large resource descriptor) was -not surrounded by quotes and not followed by a comma, causing -errors when the resulting ASL module was compiled. Also, escape -sequences within a ResourceSource string are now handled -correctly (especially "\\") - ----------------------------------------- -02 September 2005. Summary of changes for version 20050902: - -1) ACPI CA Core Subsystem: - -Fixed a problem with the internal Owner ID allocation and -deallocation mechanisms for control method execution and -recursive method invocation. This should eliminate the -OWNER_ID_LIMIT exceptions and "Invalid OwnerId" messages seen on -some systems. Recursive method invocation depth is currently -limited to 255. (Alexey Starikovskiy) - -Completely eliminated all vestiges of support for the "module- -level executable code" until this support is fully implemented -and debugged. This should eliminate the NO_RETURN_VALUE -exceptions seen during table load on some systems that invoke -this support. - -Fixed a problem within the resource manager code where the -transaction flags for a 64-bit address descriptor were handled -incorrectly in the type-specific flag byte. - -Consolidated duplicate code within the address descriptor -resource manager code, reducing overall subsystem code size. - -Fixed a fault when using the AML debugger "disassemble" command -to disassemble individual control methods. - -Removed references to the "release_current" directory within the -Unix release package. - -Code and Data Size: The current and previous core subsystem -library sizes are shown below. These are the code and data sizes -for the acpica.lib produced by the Microsoft Visual C++ 6.0 -compiler. These values do not include any ACPI driver or OSPM -code. The debug version of the code includes the debug output -trace mechanism and has a much larger code and data size. Note -that these values will vary depending on the efficiency of the -compiler and the compiler options used during generation. - - Previous Release: - Non-Debug Version: 78.6K Code, 11.7K Data, 90.3K Total - Debug Version: 170.0K Code, 69.9K Data, 239.9K Total - Current Release: - Non-Debug Version: 78.4K Code, 11.8K Data, 90.2K Total - Debug Version: 169.6K Code, 69.9K Data, 239.5K Total - - -2) iASL Compiler/Disassembler: - -Implemented an error check for illegal duplicate values in the -interrupt and dma lists for the following ASL macros: Dma(), -Irq(), IrqNoFlags(), and Interrupt(). - -Implemented error checking for the Irq() and IrqNoFlags() macros -to detect too many values in the interrupt list (16 max) and -invalid values in the list (range 0 - 15) - -The maximum length string literal within an ASL file is now -restricted to 200 characters as per the ACPI specification. - -Fixed a fault when using the -ln option (generate namespace -listing). - -Implemented an error check to determine if a DescriptorName -within a resource descriptor has already been used within the -current scope. - ----------------------------------------- -15 August 2005. Summary of changes for version 20050815: - -1) ACPI CA Core Subsystem: - -Implemented a full bytewise compare to determine if a table load -request is attempting to load a duplicate table. The compare is -performed if the table signatures and table lengths match. This -will allow different tables with the same OEM Table ID and -revision to be loaded - probably against the ACPI specification, -but discovered in the field nonetheless. - -Added the changes.txt logfile to each of the zipped release -packages. - -Code and Data Size: Current and previous core subsystem library -sizes are shown below. These are the code and data sizes for the -acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and -these values do not include any ACPI driver or OSPM code. The -debug version of the code includes the debug output trace -mechanism and has a much larger code and data size. Note that -these values will vary depending on the efficiency of the -compiler and the compiler options used during generation. - - Previous Release: - Non-Debug Version: 78.6K Code, 11.7K Data, 90.3K Total - Debug Version: 167.0K Code, 69.9K Data, 236.9K Total - Current Release: - Non-Debug Version: 78.6K Code, 11.7K Data, 90.3K Total - Debug Version: 170.0K Code, 69.9K Data, 239.9K Total - - -2) iASL Compiler/Disassembler: - -Fixed a problem where incorrect AML code could be generated for -Package objects if optimization is disabled (via the -oa switch). - -Fixed a problem with where incorrect AML code is generated for -variable-length packages when the package length is not specified -and the number of initializer values is greater than 255. - - ----------------------------------------- -29 July 2005. Summary of changes for version 20050729: - -1) ACPI CA Core Subsystem: - -Implemented support to ignore an attempt to install/load a -particular ACPI table more than once. Apparently there exists -BIOS code that repeatedly attempts to load the same SSDT upon -certain events. With assistance from Venkatesh Pallipadi. - -Restructured the main interface to the AML parser in order to -correctly handle all exceptional conditions. This will prevent -leakage of the OwnerId resource and should eliminate the -AE_OWNER_ID_LIMIT exceptions seen on some machines. With -assistance from Alexey Starikovskiy. - -Support for "module level code" has been disabled in this version -due to a number of issues that have appeared on various machines. -The support can be enabled by defining -ACPI_ENABLE_MODULE_LEVEL_CODE during subsystem compilation. When -the issues are fully resolved, the code will be enabled by -default again. - -Modified the internal functions for debug print support to define -the FunctionName parameter as a (const char *) for compatibility -with compiler built-in macros such as __FUNCTION__, etc. - -Linted the entire ACPICA source tree for both 32-bit and 64-bit. - -Implemented support to display an object count summary for the -AML Debugger commands Object and Methods. - -Code and Data Size: Current and previous core subsystem library -sizes are shown below. These are the code and data sizes for the -acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and -these values do not include any ACPI driver or OSPM code. The -debug version of the code includes the debug output trace -mechanism and has a much larger code and data size. Note that -these values will vary depending on the efficiency of the -compiler and the compiler options used during generation. - - Previous Release: - Non-Debug Version: 78.6K Code, 11.6K Data, 90.2K Total - Debug Version: 170.0K Code, 69.7K Data, 239.7K Total - Current Release: - Non-Debug Version: 78.6K Code, 11.7K Data, 90.3K Total - Debug Version: 167.0K Code, 69.9K Data, 236.9K Total - - -2) iASL Compiler/Disassembler: - -Fixed a regression that appeared in the 20050708 version of the -compiler where an error message was inadvertently emitted for -invocations of the _OSI reserved control method. - ----------------------------------------- -08 July 2005. Summary of changes for version 20050708: - -1) ACPI CA Core Subsystem: - -The use of the CPU stack in the debug version of the subsystem -has been considerably reduced. Previously, a debug structure was -declared in every function that used the debug macros. This -structure has been removed in favor of declaring the individual -elements as parameters to the debug functions. This reduces the -cumulative stack use during nested execution of ACPI function -calls at the cost of a small increase in the code size of the -debug version of the subsystem. With assistance from Alexey -Starikovskiy and Len Brown. - -Added the ACPI_GET_FUNCTION_NAME macro to enable the compiler- -dependent headers to define a macro that will return the current -function name at runtime (such as __FUNCTION__ or _func_, etc.) -The function name is used by the debug trace output. If -ACPI_GET_FUNCTION_NAME is not defined in the compiler-dependent -header, the function name is saved on the CPU stack (one pointer -per function.) This mechanism is used because apparently there -exists no standard ANSI-C defined macro that that returns the -function name. - -Redesigned and reimplemented the "Owner ID" mechanism used to -track namespace objects created/deleted by ACPI tables and -control method execution. A bitmap is now used to allocate and -free the IDs, thus solving the wraparound problem present in the -previous implementation. The size of the namespace node -descriptor was reduced by 2 bytes as a result (Alexey -Starikovskiy). - -Removed the UINT32_BIT and UINT16_BIT types that were used for -the bitfield flag definitions within the headers for the -predefined ACPI tables. These have been replaced by UINT8_BIT in -order to increase the code portability of the subsystem. If the -use of UINT8 remains a problem, we may be forced to eliminate -bitfields entirely because of a lack of portability. - -Enhanced the performance of the AcpiUtUpdateObjectReference -procedure. This is a frequently used function and this -improvement increases the performance of the entire subsystem -(Alexey Starikovskiy). - -Fixed several possible memory leaks and the inverse - premature -object deletion (Alexey Starikovskiy). - -Code and Data Size: Current and previous core subsystem library -sizes are shown below. These are the code and data sizes for the -acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and -these values do not include any ACPI driver or OSPM code. The -debug version of the code includes the debug output trace -mechanism and has a much larger code and data size. Note that -these values will vary depending on the efficiency of the -compiler and the compiler options used during generation. - - Previous Release: - Non-Debug Version: 78.6K Code, 11.5K Data, 90.1K Total - Debug Version: 165.2K Code, 69.6K Data, 234.8K Total - Current Release: - Non-Debug Version: 78.6K Code, 11.6K Data, 90.2K Total - Debug Version: 170.0K Code, 69.7K Data, 239.7K Total - ----------------------------------------- -24 June 2005. Summary of changes for version 20050624: - -1) ACPI CA Core Subsystem: - -Modified the new OSL cache interfaces to use ACPI_CACHE_T as the -type for the host-defined cache object. This allows the OSL -implementation to define and type this object in any manner -desired, simplifying the OSL implementation. For example, -ACPI_CACHE_T is defined as kmem_cache_t for Linux, and should be -defined in the OS-specific header file for other operating -systems as required. - -Changed the interface to AcpiOsAcquireObject to directly return -the requested object as the function return (instead of -ACPI_STATUS.) This change was made for performance reasons, since -this is the purpose of the interface in the first place. -AcpiOsAcquireObject is now similar to the AcpiOsAllocate -interface. - -Implemented a new AML debugger command named Businfo. This -command displays information about all devices that have an -associate _PRT object. The _ADR, _HID, _UID, and _CID are -displayed for these devices. - -Modified the initialization sequence in AcpiInitializeSubsystem -to call the OSL interface AcpiOslInitialize first, before any -local initialization. This change was required because the global -initialization now calls OSL interfaces. - -Enhanced the Dump command to display the entire contents of -Package objects (including all sub-objects and their values.) - -Restructured the code base to split some files because of size -and/or because the code logically belonged in a separate file. -New files are listed below. All makefiles and project files -included in the ACPI CA release have been updated. - utilities/utcache.c /* Local cache interfaces */ - utilities/utmutex.c /* Local mutex support */ - utilities/utstate.c /* State object support */ - interpreter/parser/psloop.c /* Main AML parse loop */ - -Code and Data Size: Current and previous core subsystem library -sizes are shown below. These are the code and data sizes for the -acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and -these values do not include any ACPI driver or OSPM code. The -debug version of the code includes the debug output trace -mechanism and has a much larger code and data size. Note that -these values will vary depending on the efficiency of the -compiler and the compiler options used during generation. - - Previous Release: - Non-Debug Version: 78.3K Code, 11.6K Data, 89.9K Total - Debug Version: 164.0K Code, 69.1K Data, 233.1K Total - Current Release: - Non-Debug Version: 78.6K Code, 11.5K Data, 90.1K Total - Debug Version: 165.2K Code, 69.6K Data, 234.8K Total - - -2) iASL Compiler/Disassembler: - -Fixed a regression introduced in version 20050513 where the use -of a Package object within a Case() statement caused a compile -time exception. The original behavior has been restored (a -Match() operator is emitted.) - ----------------------------------------- -17 June 2005. Summary of changes for version 20050617: - -1) ACPI CA Core Subsystem: - -Moved the object cache operations into the OS interface layer -(OSL) to allow the host OS to handle these operations if desired -(for example, the Linux OSL will invoke the slab allocator). This -support is optional; the compile time define ACPI_USE_LOCAL_CACHE -may be used to utilize the original cache code in the ACPI CA -core. The new OSL interfaces are shown below. See utalloc.c for -an example implementation, and acpiosxf.h for the exact interface -definitions. With assistance from Alexey Starikovskiy. - AcpiOsCreateCache - AcpiOsDeleteCache - AcpiOsPurgeCache - AcpiOsAcquireObject - AcpiOsReleaseObject - -Modified the interfaces to AcpiOsAcquireLock and -AcpiOsReleaseLock to return and restore a flags parameter. This -fits better with many OS lock models. Note: the current execution -state (interrupt handler or not) is no longer passed to these -interfaces. If necessary, the OSL must determine this state by -itself, a simple and fast operation. With assistance from Alexey -Starikovskiy. - -Fixed a problem in the ACPI table handling where a valid XSDT was -assumed present if the revision of the RSDP was 2 or greater. -According to the ACPI specification, the XSDT is optional in all -cases, and the table manager therefore now checks for both an -RSDP >=2 and a valid XSDT pointer. Otherwise, the RSDT pointer is -used. Some ACPI 2.0 compliant BIOSs contain only the RSDT. - -Fixed an interpreter problem with the Mid() operator in the case -of an input string where the resulting output string is of zero -length. It now correctly returns a valid, null terminated string -object instead of a string object with a null pointer. - -Fixed a problem with the control method argument handling to -allow a store to an Arg object that already contains an object of -type Device. The Device object is now correctly overwritten. -Previously, an error was returned. - - -Enhanced the debugger Find command to emit object values in -addition to the found object pathnames. The output format is the -same as the dump namespace command. - -Enhanced the debugger Set command. It now has the ability to set -the value of any Named integer object in the namespace -(Previously, only method locals and args could be set.) - -Code and Data Size: Current and previous core subsystem library -sizes are shown below. These are the code and data sizes for the -acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and -these values do not include any ACPI driver or OSPM code. The -debug version of the code includes the debug output trace -mechanism and has a much larger code and data size. Note that -these values will vary depending on the efficiency of the -compiler and the compiler options used during generation. - - Previous Release: - Non-Debug Version: 78.1K Code, 11.6K Data, 89.7K Total - Debug Version: 164.0K Code, 69.3K Data, 233.3K Total - Current Release: - Non-Debug Version: 78.3K Code, 11.6K Data, 89.9K Total - Debug Version: 164.0K Code, 69.1K Data, 233.1K Total - - -2) iASL Compiler/Disassembler: - -Fixed a regression in the disassembler where if/else/while -constructs were output incorrectly. This problem was introduced -in the previous release (20050526). This problem also affected -the single-step disassembly in the debugger. - -Fixed a problem where compiling the reserved _OSI method would -randomly (but rarely) produce compile errors. - -Enhanced the disassembler to emit compilable code in the face of -incorrect AML resource descriptors. If the optional -ResourceSourceIndex is present, but the ResourceSource is not, do -not emit the ResourceSourceIndex in the disassembly. Otherwise, -the resulting code cannot be compiled without errors. - ----------------------------------------- -26 May 2005. Summary of changes for version 20050526: - -1) ACPI CA Core Subsystem: - -Implemented support to execute Type 1 and Type 2 AML opcodes -appearing at the module level (not within a control method.) -These opcodes are executed exactly once at the time the table is -loaded. This type of code was legal up until the release of ACPI -2.0B (2002) and is now supported within ACPI CA in order to -provide backwards compatibility with earlier BIOS -implementations. This eliminates the "Encountered executable code -at module level" warning that was previously generated upon -detection of such code. - -Fixed a problem in the interpreter where an AE_NOT_FOUND -exception could inadvertently be generated during the lookup of -namespace objects in the second pass parse of ACPI tables and -control methods. It appears that this problem could occur during -the resolution of forward references to namespace objects. - -Added the ACPI_MUTEX_DEBUG #ifdef to the AcpiUtReleaseMutex -function, corresponding to the same #ifdef in the -AcpiUtAcquireMutex function. This allows the deadlock detection -debug code to be compiled out in the normal case, improving mutex -performance (and overall subsystem performance) considerably. - -Implemented a handful of miscellaneous fixes for possible memory -leaks on error conditions and error handling control paths. These -fixes were suggested by FreeBSD and the Coverity Prevent source -code analysis tool. - -Added a check for a null RSDT pointer in AcpiGetFirmwareTable -(tbxfroot.c) to prevent a fault in this error case. - -Code and Data Size: Current and previous core subsystem library -sizes are shown below. These are the code and data sizes for the -acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and -these values do not include any ACPI driver or OSPM code. The -debug version of the code includes the debug output trace -mechanism and has a much larger code and data size. Note that -these values will vary depending on the efficiency of the -compiler and the compiler options used during generation. - - Previous Release: - Non-Debug Version: 78.2K Code, 11.6K Data, 89.8K Total - Debug Version: 163.7K Code, 69.3K Data, 233.0K Total - Current Release: - Non-Debug Version: 78.1K Code, 11.6K Data, 89.7K Total - Debug Version: 164.0K Code, 69.3K Data, 233.3K Total - - -2) iASL Compiler/Disassembler: - -Implemented support to allow Type 1 and Type 2 ASL operators to -appear at the module level (not within a control method.) These -operators will be executed once at the time the table is loaded. -This type of code was legal up until the release of ACPI 2.0B -(2002) and is now supported by the iASL compiler in order to -provide backwards compatibility with earlier BIOS ASL code. - -The ACPI integer width (specified via the table revision ID or -the -r override, 32 or 64 bits) is now used internally during -compile-time constant folding to ensure that constants are -truncated to 32 bits if necessary. Previously, the revision ID -value was only emitted in the AML table header. - -An error message is now generated for the Mutex and Method -operators if the SyncLevel parameter is outside the legal range -of 0 through 15. - -Fixed a problem with the Method operator ParameterTypes list -handling (ACPI 3.0). Previously, more than 2 types or 2 arguments -generated a syntax error. The actual underlying implementation -of method argument typechecking is still under development, -however. - ----------------------------------------- -13 May 2005. Summary of changes for version 20050513: - -1) ACPI CA Core Subsystem: - -Implemented support for PCI Express root bridges -- added support -for device PNP0A08 in the root bridge search within -AcpiEvPciConfigRegionSetup. - -The interpreter now automatically truncates incoming 64-bit -constants to 32 bits if currently executing out of a 32-bit ACPI -table (Revision < 2). This also affects the iASL compiler -constant folding. (Note: as per below, the iASL compiler no -longer allows 64-bit constants within 32-bit tables.) - -Fixed a problem where string and buffer objects with "static" -pointers (pointers to initialization data within an ACPI table) -were not handled consistently. The internal object copy operation -now always copies the data to a newly allocated buffer, -regardless of whether the source object is static or not. - -Fixed a problem with the FromBCD operator where an implicit -result conversion was improperly performed while storing the -result to the target operand. Since this is an "explicit -conversion" operator, the implicit conversion should never be -performed on the output. - -Fixed a problem with the CopyObject operator where a copy to an -existing named object did not always completely overwrite the -existing object stored at name. Specifically, a buffer-to-buffer -copy did not delete the existing buffer. - -Replaced "InterruptLevel" with "InterruptNumber" in all GPE -interfaces and structs for consistency. - -Code and Data Size: Current and previous core subsystem library -sizes are shown below. These are the code and data sizes for the -acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and -these values do not include any ACPI driver or OSPM code. The -debug version of the code includes the debug output trace -mechanism and has a much larger code and data size. Note that -these values will vary depending on the efficiency of the -compiler and the compiler options used during generation. - - Previous Release: - Non-Debug Version: 78.2K Code, 11.6K Data, 89.8K Total - Debug Version: 163.7K Code, 69.3K Data, 233.0K Total - Current Release: (Same sizes) - Non-Debug Version: 78.2K Code, 11.6K Data, 89.8K Total - Debug Version: 163.7K Code, 69.3K Data, 233.0K Total - - -2) iASL Compiler/Disassembler: - -The compiler now emits a warning if an attempt is made to -generate a 64-bit integer constant from within a 32-bit ACPI -table (Revision < 2). The integer is truncated to 32 bits. - -Fixed a problem with large package objects: if the static length -of the package is greater than 255, the "variable length package" -opcode is emitted. Previously, this caused an error. This -requires an update to the ACPI spec, since it currently -(incorrectly) states that packages larger than 255 elements are -not allowed. - -The disassembler now correctly handles variable length packages -and packages larger than 255 elements. - ----------------------------------------- -08 April 2005. Summary of changes for version 20050408: - -1) ACPI CA Core Subsystem: - -Fixed three cases in the interpreter where an "index" argument to -an ASL function was still (internally) 32 bits instead of the -required 64 bits. This was the Index argument to the Index, Mid, -and Match operators. - -The "strupr" function is now permanently local (AcpiUtStrupr), -since this is not a POSIX-defined function and not present in -most kernel-level C libraries. All references to the C library -strupr function have been removed from the headers. - -Completed the deployment of static functions/prototypes. All -prototypes with the static attribute have been moved from the -headers to the owning C file. - -Implemented an extract option (-e) for the AcpiBin utility (AML -binary utility). This option allows the utility to extract -individual ACPI tables from the output of AcpiDmp. It provides -the same functionality of the acpixtract.pl perl script without -the worry of setting the correct perl options. AcpiBin runs on -Windows and has not yet been generated/validated in the -Linux/Unix environment (but should be soon). - -Updated and fixed the table dump option for AcpiBin (-d). This -option converts a single ACPI table to a hex/ascii file, similar -to the output of AcpiDmp. - -Code and Data Size: Current and previous core subsystem library -sizes are shown below. These are the code and data sizes for the -acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and -these values do not include any ACPI driver or OSPM code. The -debug version of the code includes the debug output trace -mechanism and has a much larger code and data size. Note that -these values will vary depending on the efficiency of the -compiler and the compiler options used during generation. - - Previous Release: - Non-Debug Version: 78.0K Code, 11.6K Data, 89.6K Total - Debug Version: 163.5K Code, 69.3K Data, 232.8K Total - Current Release: - Non-Debug Version: 78.2K Code, 11.6K Data, 89.8K Total - Debug Version: 163.7K Code, 69.3K Data, 233.0K Total - - -2) iASL Compiler/Disassembler: - -Disassembler fix: Added a check to ensure that the table length -found in the ACPI table header within the input file is not -longer than the actual input file size. This indicates some kind -of file or table corruption. - ----------------------------------------- -29 March 2005. Summary of changes for version 20050329: - -1) ACPI CA Core Subsystem: - -An error is now generated if an attempt is made to create a -Buffer Field of length zero (A CreateField with a length operand -of zero.) - -The interpreter now issues a warning whenever executable code at -the module level is detected during ACPI table load. This will -give some idea of the prevalence of this type of code. - -Implemented support for references to named objects (other than -control methods) within package objects. - -Enhanced package object output for the debug object. Package -objects are now completely dumped, showing all elements. - -Enhanced miscellaneous object output for the debug object. Any -object can now be written to the debug object (for example, a -device object can be written, and the type of the object will be -displayed.) - -The "static" qualifier has been added to all local functions -across both the core subsystem and the iASL compiler. - -The number of "long" lines (> 80 chars) within the source has -been significantly reduced, by about 1/3. - -Cleaned up all header files to ensure that all CA/iASL functions -are prototyped (even static functions) and the formatting is -consistent. - -Two new header files have been added, acopcode.h and acnames.h. - -Removed several obsolete functions that were no longer used. - -Code and Data Size: Current and previous core subsystem library -sizes are shown below. These are the code and data sizes for the -acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and -these values do not include any ACPI driver or OSPM code. The -debug version of the code includes the debug output trace -mechanism and has a much larger code and data size. Note that -these values will vary depending on the efficiency of the -compiler and the compiler options used during generation. - - Previous Release: - Non-Debug Version: 78.3K Code, 11.5K Data, 89.8K Total - Debug Version: 165.4K Code, 69.7K Data, 236.1K Total - Current Release: - Non-Debug Version: 78.0K Code, 11.6K Data, 89.6K Total - Debug Version: 163.5K Code, 69.3K Data, 232.8K Total - - - -2) iASL Compiler/Disassembler: - -Fixed a problem with the resource descriptor generation/support. -For the ResourceSourceIndex and the ResourceSource fields, both -must be present, or both must be not present - can't have one -without the other. - -The compiler now returns non-zero from the main procedure if any -errors have occurred during the compilation. - - ----------------------------------------- -09 March 2005. Summary of changes for version 20050309: - -1) ACPI CA Core Subsystem: - -The string-to-buffer implicit conversion code has been modified -again after a change to the ACPI specification. In order to -match the behavior of the other major ACPI implementation, the -target buffer is no longer truncated if the source string is -smaller than an existing target buffer. This change requires an -update to the ACPI spec, and should eliminate the recent -AE_AML_BUFFER_LIMIT issues. - -The "implicit return" support was rewritten to a new algorithm -that solves the general case. Rather than attempt to determine -when a method is about to exit, the result of every ASL operator -is saved momentarily until the very next ASL operator is -executed. Therefore, no matter how the method exits, there will -always be a saved implicit return value. This feature is only -enabled with the AcpiGbl_EnableInterpreterSlack flag, and should -eliminate AE_AML_NO_RETURN_VALUE errors when enabled. - -Implemented implicit conversion support for the predicate -(operand) of the If, Else, and While operators. String and Buffer -arguments are automatically converted to Integers. - -Changed the string-to-integer conversion behavior to match the -new ACPI errata: "If no integer object exists, a new integer is -created. The ASCII string is interpreted as a hexadecimal -constant. Each string character is interpreted as a hexadecimal -value (`0'-`9', `A'-`F', `a', `f'), starting with the first -character as the most significant digit, and ending with the -first non-hexadecimal character or end-of-string." This means -that the first non-hex character terminates the conversion and -this is the code that was changed. - -Fixed a problem where the ObjectType operator would fail (fault) -when used on an Index of a Package which pointed to a null -package element. The operator now properly returns zero -(Uninitialized) in this case. - -Fixed a problem where the While operator used excessive memory by -not properly popping the result stack during execution. There was -no memory leak after execution, however. (Code provided by Valery -Podrezov.) - -Fixed a problem where references to control methods within -Package objects caused the method to be invoked, instead of -producing a reference object pointing to the method. - -Restructured and simplified the pswalk.c module -(AcpiPsDeleteParseTree) to improve performance and reduce code -size. (Code provided by Alexey Starikovskiy.) - -Code and Data Size: Current and previous core subsystem library -sizes are shown below. These are the code and data sizes for the -acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and -these values do not include any ACPI driver or OSPM code. The -debug version of the code includes the debug output trace -mechanism and has a much larger code and data size. Note that -these values will vary depending on the efficiency of the -compiler and the compiler options used during generation. - - Previous Release: - Non-Debug Version: 78.3K Code, 11.5K Data, 89.8K Total - Debug Version: 165.4K Code, 69.6K Data, 236.0K Total - Current Release: - Non-Debug Version: 78.3K Code, 11.5K Data, 89.8K Total - Debug Version: 165.4K Code, 69.7K Data, 236.1K Total - - -2) iASL Compiler/Disassembler: - -Fixed a problem with the Return operator with no arguments. Since -the AML grammar for the byte encoding requires an operand for the -Return opcode, the compiler now emits a Return(Zero) for this -case. An ACPI specification update has been written for this -case. - -For tables other than the DSDT, namepath optimization is -automatically disabled. This is because SSDTs can be loaded -anywhere in the namespace, the compiler has no knowledge of -where, and thus cannot optimize namepaths. - -Added "ProcessorObj" to the ObjectTypeKeyword list. This object -type was inadvertently omitted from the ACPI specification, and -will require an update to the spec. - -The source file scan for ASCII characters is now optional (-a). -This change was made because some vendors place non-ascii -characters within comments. However, the scan is simply a brute- -force byte compare to ensure all characters in the file are in -the range 0x00 to 0x7F. - -Fixed a problem with the CondRefOf operator where the compiler -was inappropriately checking for the existence of the target. -Since the point of the operator is to check for the existence of -the target at run-time, the compiler no longer checks for the -target existence. - -Fixed a problem where errors generated from the internal AML -interpreter during constant folding were not handled properly, -causing a fault. - -Fixed a problem with overly aggressive range checking for the -Stall operator. The valid range (max 255) is now only checked if -the operand is of type Integer. All other operand types cannot be -statically checked. - -Fixed a problem where control method references within the RefOf, -DeRefOf, and ObjectType operators were not treated properly. They -are now treated as actual references, not method invocations. - -Fixed and enhanced the "list namespace" option (-ln). This option -was broken a number of releases ago. - -Improved error handling for the Field, IndexField, and BankField -operators. The compiler now cleanly reports and recovers from -errors in the field component (FieldUnit) list. - -Fixed a disassembler problem where the optional -ResourceDescriptor fields TRS and TTP were not always handled -correctly. - -Disassembler - Comments in output now use "//" instead of "/*" - ----------------------------------------- -28 February 2005. Summary of changes for version 20050228: - -1) ACPI CA Core Subsystem: - -Fixed a problem where the result of an Index() operator (an -object reference) must increment the reference count on the -target object for the life of the object reference. - -Implemented AML Interpreter and Debugger support for the new ACPI -3.0 Extended Address (IO, Memory, Space), QwordSpace, DwordSpace, -and WordSpace resource descriptors. - -Implemented support in the _OSI method for the ACPI 3.0 "Extended -Address Space Descriptor" string, indicating interpreter support -for the descriptors above. - -Implemented header support for the new ACPI 3.0 FADT flag bits. - -Implemented header support for the new ACPI 3.0 PCI Express bits -for the PM1 status/enable registers. - -Updated header support for the MADT processor local Apic struct -and MADT platform interrupt source struct for new ACPI 3.0 -fields. - -Implemented header support for the SRAT and SLIT ACPI tables. - -Implemented the -s switch in AcpiExec to enable the -"InterpreterSlack" flag at runtime. - -Code and Data Size: Current and previous core subsystem library -sizes are shown below. These are the code and data sizes for the -acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and -these values do not include any ACPI driver or OSPM code. The -debug version of the code includes the debug output trace -mechanism and has a much larger code and data size. Note that -these values will vary depending on the efficiency of the -compiler and the compiler options used during generation. - - Previous Release: - Non-Debug Version: 78.2K Code, 11.5K Data, 89.7K Total - Debug Version: 164.9K Code, 69.2K Data, 234.1K Total - Current Release: - Non-Debug Version: 78.3K Code, 11.5K Data, 89.8K Total - Debug Version: 165.4K Code, 69.6K Data, 236.0K Total - - -2) iASL Compiler/Disassembler: - -Fixed a problem with the internal 64-bit String-to-integer -conversion with strings less than two characters long. - -Fixed a problem with constant folding where the result of the -Index() operator can not be considered a constant. This means -that Index() cannot be a type3 opcode and this will require an -update to the ACPI specification. - -Disassembler: Implemented support for the TTP, MTP, and TRS -resource descriptor fields. These fields were inadvertently -ignored and not output in the disassembly of the resource -descriptor. - - - ---------------------------------------- -11 February 2005. Summary of changes for version 20050211: - -1) ACPI CA Core Subsystem: - -Implemented ACPI 3.0 support for implicit conversion within the -Match() operator. MatchObjects can now be of type integer, -buffer, or string instead of just type integer. Package elements -are implicitly converted to the type of the MatchObject. This -change aligns the behavior of Match() with the behavior of the -other logical operators (LLess(), etc.) It also requires an -errata change to the ACPI specification as this support was -intended for ACPI 3.0, but was inadvertently omitted. - -Fixed a problem with the internal implicit "to buffer" -conversion. Strings that are converted to buffers will cause -buffer truncation if the string is smaller than the target -buffer. Integers that are converted to buffers will not cause -buffer truncation, only zero extension (both as per the ACPI -spec.) The problem was introduced when code was added to truncate -the buffer, but this should not be performed in all cases, only -the string case. - -Fixed a problem with the Buffer and Package operators where the -interpreter would get confused if two such operators were used as -operands to an ASL operator (such as -LLess(Buffer(1){0},Buffer(1){1}). The internal result stack was -not being popped after the execution of these operators, -resulting in an AE_NO_RETURN_VALUE exception. - -Fixed a problem with constructs of the form -Store(Index(...),...). The reference object returned from Index -was inadvertently resolved to an actual value. This problem was -introduced in version 20050114 when the behavior of Store() was -modified to restrict the object types that can be used as the -source operand (to match the ACPI specification.) - -Reduced excessive stack use within the AcpiGetObjectInfo -procedure. - -Added a fix to aclinux.h to allow generation of AcpiExec on -Linux. - -Updated the AcpiSrc utility to add the FADT_DESCRIPTOR_REV2_MINUS -struct. - -Code and Data Size: Current and previous core subsystem library -sizes are shown below. These are the code and data sizes for the -acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and -these values do not include any ACPI driver or OSPM code. The -debug version of the code includes the debug output trace -mechanism and has a much larger code and data size. Note that -these values will vary depending on the efficiency of the -compiler and the compiler options used during generation. - - Previous Release: - Non-Debug Version: 78.1K Code, 11.5K Data, 89.6K Total - Debug Version: 164.8K Code, 69.2K Data, 234.0K Total - Current Release: - Non-Debug Version: 78.2K Code, 11.5K Data, 89.7K Total - Debug Version: 164.9K Code, 69.2K Data, 234.1K Total - - -2) iASL Compiler/Disassembler: - -Fixed a code generation problem in the constant folding -optimization code where incorrect code was generated if a -constant was reduced to a buffer object (i.e., a reduced type 5 -opcode.) - -Fixed a typechecking problem for the ToBuffer operator. Caused by -an incorrect return type in the internal opcode information -table. - ----------------------------------------- -25 January 2005. Summary of changes for version 20050125: - -1) ACPI CA Core Subsystem: - -Fixed a recently introduced problem with the Global Lock where -the underlying semaphore was not created. This problem was -introduced in version 20050114, and caused an AE_AML_NO_OPERAND -exception during an Acquire() operation on _GL. - -The local object cache is now optional, and is disabled by -default. Both AcpiExec and the iASL compiler enable the cache -because they run in user mode and this enhances their -performance. #define ACPI_ENABLE_OBJECT_CACHE to enable the local -cache. - -Fixed an issue in the internal function AcpiUtEvaluateObject -concerning the optional "implicit return" support where an error -was returned if no return object was expected, but one was -implicitly returned. AE_OK is now returned in this case and the -implicitly returned object is deleted. AcpiUtEvaluateObject is -only occasionally used, and only to execute reserved methods such -as _STA and _INI where the return type is known up front. - -Fixed a few issues with the internal convert-to-integer code. It -now returns an error if an attempt is made to convert a null -string, a string of only blanks/tabs, or a zero-length buffer. -This affects both implicit conversion and explicit conversion via -the ToInteger() operator. - -The internal debug code in AcpiUtAcquireMutex has been commented -out. It is not needed for normal operation and should increase -the performance of the entire subsystem. The code remains in case -it is needed for debug purposes again. - -The AcpiExec source and makefile are included in the Unix/Linux -package for the first time. - -Code and Data Size: Current and previous core subsystem library -sizes are shown below. These are the code and data sizes for the -acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and -these values do not include any ACPI driver or OSPM code. The -debug version of the code includes the debug output trace -mechanism and has a much larger code and data size. Note that -these values will vary depending on the efficiency of the -compiler and the compiler options used during generation. - - Previous Release: - Non-Debug Version: 78.4K Code, 11.5K Data, 89.9K Total - Debug Version: 165.4K Code, 69.4K Data, 234.8K Total - Current Release: - Non-Debug Version: 78.1K Code, 11.5K Data, 89.6K Total - Debug Version: 164.8K Code, 69.2K Data, 234.0K Total - -2) iASL Compiler/Disassembler: - -Switch/Case support: A warning is now issued if the type of the -Switch value cannot be determined at compile time. For example, -Switch(Arg0) will generate the warning, and the type is assumed -to be an integer. As per the ACPI spec, use a construct such as -Switch(ToInteger(Arg0)) to eliminate the warning. - -Switch/Case support: Implemented support for buffer and string -objects as the switch value. This is an ACPI 3.0 feature, now -that LEqual supports buffers and strings. - -Switch/Case support: The emitted code for the LEqual() -comparisons now uses the switch value as the first operand, not -the second. The case value is now the second operand, and this -allows the case value to be implicitly converted to the type of -the switch value, not the other way around. - -Switch/Case support: Temporary variables are now emitted -immediately within the control method, not at the global level. -This means that there are now 36 temps available per-method, not -36 temps per-module as was the case with the earlier -implementation (_T_0 through _T_9 and _T_A through _T_Z.) - ----------------------------------------- -14 January 2005. Summary of changes for version 20050114: - -Added 2005 copyright to all module headers. This affects every -module in the core subsystem, iASL compiler, and the utilities. - -1) ACPI CA Core Subsystem: - -Fixed an issue with the String-to-Buffer conversion code where -the string null terminator was not included in the buffer after -conversion, but there is existing ASL that assumes the string -null terminator is included. This is the root of the -ACPI_AML_BUFFER_LIMIT regression. This problem was introduced in -the previous version when the code was updated to correctly set -the converted buffer size as per the ACPI specification. The ACPI -spec is ambiguous and will be updated to specify that the null -terminator must be included in the converted buffer. This also -affects the ToBuffer() ASL operator. - -Fixed a problem with the Mid() ASL/AML operator where it did not -work correctly on Buffer objects. Newly created sub-buffers were -not being marked as initialized. - - -Fixed a problem in AcpiTbFindTable where incorrect string -compares were performed on the OemId and OemTableId table header -fields. These fields are not null terminated, so strncmp is now -used instead of strcmp. - -Implemented a restriction on the Store() ASL/AML operator to -align the behavior with the ACPI specification. Previously, any -object could be used as the source operand. Now, the only -objects that may be used are Integers, Buffers, Strings, -Packages, Object References, and DDB Handles. If necessary, the -original behavior can be restored by enabling the -EnableInterpreterSlack flag. - -Enhanced the optional "implicit return" support to allow an -implicit return value from methods that are invoked externally -via the AcpiEvaluateObject interface. This enables implicit -returns from the _STA and _INI methods, for example. - -Changed the Revision() ASL/AML operator to return the current -version of the AML interpreter, in the YYYYMMDD format. -Previously, it incorrectly returned the supported ACPI version -(This is the function of the _REV method). - -Updated the _REV predefined method to return the currently -supported version of ACPI, now 3. - -Implemented batch mode option for the AcpiExec utility (-b). - -Code and Data Size: Current and previous core subsystem library -sizes are shown below. These are the code and data sizes for the -acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and -these values do not include any ACPI driver or OSPM code. The -debug version of the code includes the debug output trace -mechanism and has a much larger code and data size. Note that -these values will vary depending on the efficiency of the -compiler and the compiler options used during generation. - - Previous Release: - Non-Debug Version: 78.3K Code, 11.5K Data, 89.8K Total - Debug Version: 165.3K Code, 69.4K Data, 234.7K Total - Current Release: - Non-Debug Version: 78.4K Code, 11.5K Data, 89.9K Total - Debug Version: 165.4K Code, 69.4K Data, 234.8K Total - ----------------------------------------- -10 December 2004. Summary of changes for version 20041210: - -ACPI 3.0 support is nearing completion in both the iASL compiler -and the ACPI CA core subsystem. - -1) ACPI CA Core Subsystem: - -Fixed a problem in the ToDecimalString operator where the -resulting string length was incorrectly calculated. The length is -now calculated exactly, eliminating incorrect AE_STRING_LIMIT -exceptions. - -Fixed a problem in the ToHexString operator to allow a maximum -200 character string to be produced. - -Fixed a problem in the internal string-to-buffer and buffer-to- -buffer copy routine where the length of the resulting buffer was -not truncated to the new size (if the target buffer already -existed). - -Code and Data Size: Current and previous core subsystem library -sizes are shown below. These are the code and data sizes for the -acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and -these values do not include any ACPI driver or OSPM code. The -debug version of the code includes the debug output trace -mechanism and has a much larger code and data size. Note that -these values will vary depending on the efficiency of the -compiler and the compiler options used during generation. - - Previous Release: - Non-Debug Version: 78.3K Code, 11.5K Data, 89.8K Total - Debug Version: 164.7K Code, 68.5K Data, 233.2K Total - Current Release: - Non-Debug Version: 78.3K Code, 11.5K Data, 89.8K Total - Debug Version: 165.3K Code, 69.4K Data, 234.7K Total - - -2) iASL Compiler/Disassembler: - -Implemented the new ACPI 3.0 resource template macros - -DWordSpace, ExtendedIO, ExtendedMemory, ExtendedSpace, -QWordSpace, and WordSpace. Includes support in the disassembler. - -Implemented support for the new (ACPI 3.0) parameter to the -Register macro, AccessSize. - -Fixed a problem where the _HE resource name for the Interrupt -macro was referencing bit 0 instead of bit 1. - -Implemented check for maximum 255 interrupts in the Interrupt -macro. - -Fixed a problem with the predefined resource descriptor names -where incorrect AML code was generated if the offset within the -resource buffer was 0 or 1. The optimizer shortened the AML code -to a single byte opcode but did not update the surrounding -package lengths. - -Changes to the Dma macro: All channels within the channel list -must be in the range 0-7. Maximum 8 channels can be specified. -BusMaster operand is optional (default is BusMaster). - -Implemented check for maximum 7 data bytes for the VendorShort -macro. - -The ReadWrite parameter is now optional for the Memory32 and -similar macros. - ----------------------------------------- -03 December 2004. Summary of changes for version 20041203: - -1) ACPI CA Core Subsystem: - -The low-level field insertion/extraction code (exfldio) has been -completely rewritten to eliminate unnecessary complexity, bugs, -and boundary conditions. - -Fixed a problem in the ToInteger, ToBuffer, ToHexString, and -ToDecimalString operators where the input operand could be -inadvertently deleted if no conversion was necessary (e.g., if -the input to ToInteger was an Integer object.) - -Fixed a problem with the ToDecimalString and ToHexString where an -incorrect exception code was returned if the resulting string -would be > 200 chars. AE_STRING_LIMIT is now returned. - -Fixed a problem with the Concatenate operator where AE_OK was -always returned, even if the operation failed. - -Fixed a problem in oswinxf (used by AcpiExec and iASL) to allow > -128 semaphores to be allocated. - -Code and Data Size: Current and previous core subsystem library -sizes are shown below. These are the code and data sizes for the -acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and -these values do not include any ACPI driver or OSPM code. The -debug version of the code includes the debug output trace -mechanism and has a much larger code and data size. Note that -these values will vary depending on the efficiency of the -compiler and the compiler options used during generation. - - Previous Release: - Non-Debug Version: 78.5K Code, 11.5K Data, 90.0K Total - Debug Version: 165.2K Code, 68.6K Data, 233.8K Total - Current Release: - Non-Debug Version: 78.3K Code, 11.5K Data, 89.8K Total - Debug Version: 164.7K Code, 68.5K Data, 233.2K Total - - -2) iASL Compiler/Disassembler: - -Fixed typechecking for the ObjectType and SizeOf operators. -Problem was recently introduced in 20041119. - -Fixed a problem with the ToUUID macro where the upper nybble of -each buffer byte was inadvertently set to zero. - ----------------------------------------- -19 November 2004. Summary of changes for version 20041119: - -1) ACPI CA Core Subsystem: - -Fixed a problem in the internal ConvertToInteger routine where -new integers were not truncated to 32 bits for 32-bit ACPI -tables. This routine converts buffers and strings to integers. - -Implemented support to store a value to an Index() on a String -object. This is an ACPI 2.0 feature that had not yet been -implemented. - -Implemented new behavior for storing objects to individual -package elements (via the Index() operator). The previous -behavior was to invoke the implicit conversion rules if an object -was already present at the index. The new behavior is to simply -delete any existing object and directly store the new object. -Although the ACPI specification seems unclear on this subject, -other ACPI implementations behave in this manner. (This is the -root of the AE_BAD_HEX_CONSTANT issue.) - -Modified the RSDP memory scan mechanism to support the extended -checksum for ACPI 2.0 (and above) RSDPs. Note that the search -continues until a valid RSDP signature is found with a valid -checksum. - -Code and Data Size: Current and previous core subsystem library -sizes are shown below. These are the code and data sizes for the -acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and -these values do not include any ACPI driver or OSPM code. The -debug version of the code includes the debug output trace -mechanism and has a much larger code and data size. Note that -these values will vary depending on the efficiency of the -compiler and the compiler options used during generation. - - Previous Release: - Non-Debug Version: 78.5K Code, 11.5K Data, 90.0K Total - Debug Version: 165.2K Code, 68.6K Data, 233.8K Total - Current Release: - Non-Debug Version: 78.5K Code, 11.5K Data, 90.0K Total - Debug Version: 165.2K Code, 68.6K Data, 233.8K Total - - -2) iASL Compiler/Disassembler: - -Fixed a missing semicolon in the aslcompiler.y file. - ----------------------------------------- -05 November 2004. Summary of changes for version 20041105: - -1) ACPI CA Core Subsystem: - -Implemented support for FADT revision 2. This was an interim -table (between ACPI 1.0 and ACPI 2.0) that adds support for the -FADT reset register. - -Implemented optional support to allow uninitialized LocalX and -ArgX variables in a control method. The variables are -initialized to an Integer object with a value of zero. This -support is enabled by setting the AcpiGbl_EnableInterpreterSlack -flag to TRUE. - -Implemented support for Integer objects for the SizeOf operator. -Either 4 or 8 is returned, depending on the current integer size -(32-bit or 64-bit, depending on the parent table revision). - -Fixed a problem in the implementation of the SizeOf and -ObjectType operators where the operand was resolved to a value -too early, causing incorrect return values for some objects. - -Fixed some possible memory leaks during exceptional conditions. - -Code and Data Size: Current and previous core subsystem library -sizes are shown below. These are the code and data sizes for the -acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and -these values do not include any ACPI driver or OSPM code. The -debug version of the code includes the debug output trace -mechanism and has a much larger code and data size. Note that -these values will vary depending on the efficiency of the -compiler and the compiler options used during generation. - - Previous Release: - Non-Debug Version: 78.0K Code, 11.5K Data, 89.5K Total - Debug Version: 164.8K Code, 68.6K Data, 233.4K Total - Current Release: - Non-Debug Version: 78.5K Code, 11.5K Data, 90.0K Total - Debug Version: 165.2K Code, 68.6K Data, 233.8K Total - - -2) iASL Compiler/Disassembler: - -Implemented support for all ACPI 3.0 reserved names and methods. - -Implemented all ACPI 3.0 grammar elements in the front-end, -including support for semicolons. - -Implemented the ACPI 3.0 Function() and ToUUID() macros - -Fixed a problem in the disassembler where a Scope() operator -would not be emitted properly if the target of the scope was in -another table. - ----------------------------------------- -15 October 2004. Summary of changes for version 20041015: - -Note: ACPI CA is currently undergoing an in-depth and complete -formal evaluation to test/verify the following areas. Other -suggestions are welcome. This will result in an increase in the -frequency of releases and the number of bug fixes in the next few -months. - - Functional tests for all ASL/AML operators - - All implicit/explicit type conversions - - Bit fields and operation regions - - 64-bit math support and 32-bit-only "truncated" math support - - Exceptional conditions, both compiler and interpreter - - Dynamic object deletion and memory leaks - - ACPI 3.0 support when implemented - - External interfaces to the ACPI subsystem - - -1) ACPI CA Core Subsystem: - -Fixed two alignment issues on 64-bit platforms - within debug -statements in AcpiEvGpeDetect and AcpiEvCreateGpeBlock. Removed -references to the Address field within the non-aligned ACPI -generic address structure. - -Fixed a problem in the Increment and Decrement operators where -incorrect operand resolution could result in the inadvertent -modification of the original integer when the integer is passed -into another method as an argument and the arg is then -incremented/decremented. - -Fixed a problem in the FromBCD operator where the upper 32-bits -of a 64-bit BCD number were truncated during conversion. - -Fixed a problem in the ToDecimal operator where the length of the -resulting string could be set incorrectly too long if the input -operand was a Buffer object. - -Fixed a problem in the Logical operators (LLess, etc.) where a -NULL byte (0) within a buffer would prematurely terminate a -compare between buffer objects. - -Added a check for string overflow (>200 characters as per the -ACPI specification) during the Concatenate operator with two -string operands. - -Code and Data Size: Current and previous core subsystem library -sizes are shown below. These are the code and data sizes for the -acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and -these values do not include any ACPI driver or OSPM code. The -debug version of the code includes the debug output trace -mechanism and has a much larger code and data size. Note that -these values will vary depending on the efficiency of the -compiler and the compiler options used during generation. - - Previous Release: - Non-Debug Version: 77.8K Code, 11.5K Data, 89.3K Total - Debug Version: 164.6K Code, 68.5K Data, 233.1K Total - Current Release: - Non-Debug Version: 78.0K Code, 11.5K Data, 89.5K Total - Debug Version: 164.8K Code, 68.6K Data, 233.4K Total - - - -2) iASL Compiler/Disassembler: - -Allow the use of the ObjectType operator on uninitialized Locals -and Args (returns 0 as per the ACPI specification). - -Fixed a problem where the compiler would fault if there was a -syntax error in the FieldName of all of the various -CreateXXXField operators. - -Disallow the use of lower case letters within the EISAID macro, -as per the ACPI specification. All EISAID strings must be of the -form "UUUNNNN" Where U is an uppercase letter and N is a hex -digit. - - ----------------------------------------- -06 October 2004. Summary of changes for version 20041006: - -1) ACPI CA Core Subsystem: - -Implemented support for the ACPI 3.0 Timer operator. This ASL -function implements a 64-bit timer with 100 nanosecond -granularity. - -Defined a new OSL interface, AcpiOsGetTimer. This interface is -used to implement the ACPI 3.0 Timer operator. This allows the -host OS to implement the timer with the best clock available. -Also, it keeps the core subsystem out of the clock handling -business, since the host OS (usually) performs this function. - -Fixed an alignment issue on 64-bit platforms. The -HwLowLevelRead(Write) functions use a 64-bit address which is -part of the packed ACPI Generic Address Structure. Since the -structure is non-aligned, the alignment macros are now used to -extract the address to a local variable before use. - -Fixed a problem where the ToInteger operator assumed all input -strings were hexadecimal. The operator now handles both decimal -strings and hex strings (prefixed with "0x"). - -Fixed a problem where the string length in the string object -created as a result of the internal ConvertToString procedure -could be incorrect. This potentially affected all implicit -conversions and also the ToDecimalString and ToHexString -operators. - -Fixed two problems in the ToString operator. If the length -parameter was zero, an incorrect string object was created and -the value of the input length parameter was inadvertently changed -from zero to Ones. - -Fixed a problem where the optional ResourceSource string in the -ExtendedIRQ resource macro was ignored. - -Simplified the interfaces to the internal division functions, -reducing code size and complexity. - -Code and Data Size: Current and previous core subsystem library -sizes are shown below. These are the code and data sizes for the -acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and -these values do not include any ACPI driver or OSPM code. The -debug version of the code includes the debug output trace -mechanism and has a much larger code and data size. Note that -these values will vary depending on the efficiency of the -compiler and the compiler options used during generation. - - Previous Release: - Non-Debug Version: 77.9K Code, 11.4K Data, 89.3K Total - Debug Version: 164.5K Code, 68.3K Data, 232.8K Total - Current Release: - Non-Debug Version: 77.8K Code, 11.5K Data, 89.3K Total - Debug Version: 164.6K Code, 68.5K Data, 233.1K Total - - -2) iASL Compiler/Disassembler: - -Implemented support for the ACPI 3.0 Timer operator. - -Fixed a problem where the Default() operator was inadvertently -ignored in a Switch/Case block. This was a problem in the -translation of the Switch statement to If...Else pairs. - -Added support to allow a standalone Return operator, with no -parentheses (or operands). - -Fixed a problem with code generation for the ElseIf operator -where the translated Else...If parse tree was improperly -constructed leading to the loss of some code. - ----------------------------------------- -22 September 2004. Summary of changes for version 20040922: - -1) ACPI CA Core Subsystem: - -Fixed a problem with the implementation of the LNot() operator -where "Ones" was not returned for the TRUE case. Changed the code -to return Ones instead of (!Arg) which was usually 1. This change -affects iASL constant folding for this operator also. - -Fixed a problem in AcpiUtInitializeBuffer where an existing -buffer was not initialized properly -- Now zero the entire buffer -in this case where the buffer already exists. - -Changed the interface to AcpiOsSleep from (UINT32 Seconds, UINT32 -Milliseconds) to simply (ACPI_INTEGER Milliseconds). This -simplifies all related code considerably. This will require -changes/updates to all OS interface layers (OSLs.) - -Implemented a new external interface, -AcpiInstallExceptionHandler, to allow a system exception handler -to be installed. This handler is invoked upon any run-time -exception that occurs during control method execution. - -Added support for the DSDT in AcpiTbFindTable. This allows the -DataTableRegion() operator to access the local copy of the DSDT. - -Code and Data Size: Current and previous core subsystem library -sizes are shown below. These are the code and data sizes for the -acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and -these values do not include any ACPI driver or OSPM code. The -debug version of the code includes the debug output trace -mechanism and has a much larger code and data size. Note that -these values will vary depending on the efficiency of the -compiler and the compiler options used during generation. - - Previous Release: - Non-Debug Version: 77.8K Code, 11.4K Data, 89.2K Total - Debug Version: 164.2K Code, 68.2K Data, 232.4K Total - Current Release: - Non-Debug Version: 77.9K Code, 11.4K Data, 89.3K Total - Debug Version: 164.5K Code, 68.3K Data, 232.8K Total - - -2) iASL Compiler/Disassembler: - -Fixed a problem with constant folding and the LNot operator. LNot -was returning 1 in the TRUE case, not Ones as per the ACPI -specification. This could result in the generation of an -incorrect folded/reduced constant. - -End-Of-File is now allowed within a "//"-style comment. A parse -error no longer occurs if such a comment is at the very end of -the input ASL source file. - -Implemented the "-r" option to override the Revision in the table -header. The initial use of this option will be to simplify the -evaluation of the AML interpreter by allowing a single ASL source -module to be compiled for either 32-bit or 64-bit integers. - - ----------------------------------------- -27 August 2004. Summary of changes for version 20040827: - -1) ACPI CA Core Subsystem: - -- Implemented support for implicit object conversion in the non- -numeric logical operators (LEqual, LGreater, LGreaterEqual, -LLess, LLessEqual, and LNotEqual.) Any combination of -Integers/Strings/Buffers may now be used; the second operand is -implicitly converted on the fly to match the type of the first -operand. For example: - - LEqual (Source1, Source2) - -Source1 and Source2 must each evaluate to an integer, a string, -or a buffer. The data type of Source1 dictates the required type -of Source2. Source2 is implicitly converted if necessary to match -the type of Source1. - -- Updated and corrected the behavior of the string conversion -support. The rules concerning conversion of buffers to strings -(according to the ACPI specification) are as follows: - -ToDecimalString - explicit byte-wise conversion of buffer to -string of decimal values (0-255) separated by commas. ToHexString -- explicit byte-wise conversion of buffer to string of hex values -(0-FF) separated by commas. ToString - explicit byte-wise -conversion of buffer to string. Byte-by-byte copy with no -transform except NULL terminated. Any other implicit buffer-to- -string conversion - byte-wise conversion of buffer to string of -hex values (0-FF) separated by spaces. - -- Fixed typo in definition of AcpiGbl_EnableInterpreterSlack. - -- Fixed a problem in AcpiNsGetPathnameLength where the returned -length was one byte too short in the case of a node in the root -scope. This could cause a fault during debug output. - -- Code and Data Size: Current and previous core subsystem library -sizes are shown below. These are the code and data sizes for the -acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and -these values do not include any ACPI driver or OSPM code. The -debug version of the code includes the debug output trace -mechanism and has a much larger code and data size. Note that -these values will vary depending on the efficiency of the -compiler and the compiler options used during generation. - - Previous Release: - Non-Debug Version: 77.9K Code, 11.5K Data, 89.4K Total - Debug Version: 164.1K Code, 68.3K Data, 232.4K Total - Current Release: - Non-Debug Version: 77.8K Code, 11.4K Data, 89.2K Total - Debug Version: 164.2K Code, 68.2K Data, 232.4K Total - - -2) iASL Compiler/Disassembler: - -- Fixed a Linux generation error. - - ----------------------------------------- -16 August 2004. Summary of changes for version 20040816: - -1) ACPI CA Core Subsystem: - -Designed and implemented support within the AML interpreter for -the so-called "implicit return". This support returns the result -of the last ASL operation within a control method, in the absence -of an explicit Return() operator. A few machines depend on this -behavior, even though it is not explicitly supported by the ASL -language. It is optional support that can be enabled at runtime -via the AcpiGbl_EnableInterpreterSlack flag. - -Removed support for the PCI_Config address space from the -internal low level hardware interfaces (AcpiHwLowLevelRead and -AcpiHwLowLevelWrite). This support was not used internally, and -would not work correctly anyway because the PCI bus number and -segment number were not supported. There are separate interfaces -for PCI configuration space access because of the unique -interface. - -Code and Data Size: Current and previous core subsystem library -sizes are shown below. These are the code and data sizes for the -acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and -these values do not include any ACPI driver or OSPM code. The -debug version of the code includes the debug output trace -mechanism and has a much larger code and data size. Note that -these values will vary depending on the efficiency of the -compiler and the compiler options used during generation. - - Previous Release: - Non-Debug Version: 78.0K Code, 11.5K Data, 89.5K Total - Debug Version: 164.1K Code, 68.2K Data, 232.3K Total - Current Release: - Non-Debug Version: 77.9K Code, 11.5K Data, 89.4K Total - Debug Version: 164.1K Code, 68.3K Data, 232.4K Total - - -2) iASL Compiler/Disassembler: - -Fixed a problem where constants in ASL expressions at the root -level (not within a control method) could be inadvertently -truncated during code generation. This problem was introduced in -the 20040715 release. - - ----------------------------------------- -15 July 2004. Summary of changes for version 20040715: - -1) ACPI CA Core Subsystem: - -Restructured the internal HW GPE interfaces to pass/track the -current state of interrupts (enabled/disabled) in order to avoid -possible deadlock and increase flexibility of the interfaces. - -Implemented a "lexicographical compare" for String and Buffer -objects within the logical operators -- LGreater, LLess, -LGreaterEqual, and LLessEqual -- as per further clarification to -the ACPI specification. Behavior is similar to C library -"strcmp". - -Completed a major reduction in CPU stack use for the -AcpiGetFirmwareTable external function. In the 32-bit non-debug -case, the stack use has been reduced from 168 bytes to 32 bytes. - -Deployed a new run-time configuration flag, -AcpiGbl_EnableInterpreterSlack, whose purpose is to allow the AML -interpreter to forgive certain bad AML constructs. Default -setting is FALSE. - -Implemented the first use of AcpiGbl_EnableInterpreterSlack in -the Field IO support code. If enabled, it allows field access to -go beyond the end of a region definition if the field is within -the region length rounded up to the next access width boundary (a -common coding error.) - -Renamed OSD_HANDLER to ACPI_OSD_HANDLER, and -OSD_EXECUTION_CALLBACK to ACPI_OSD_EXEC_CALLBACK for consistency -with other ACPI symbols. Also, these symbols are lowercased by -the latest version of the AcpiSrc tool. - -The prototypes for the PCI interfaces in acpiosxf.h have been -updated to rename "Register" to simply "Reg" to prevent certain -compilers from complaining. - -Code and Data Size: Current and previous core subsystem library -sizes are shown below. These are the code and data sizes for the -acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and -these values do not include any ACPI driver or OSPM code. The -debug version of the code includes the debug output trace -mechanism and has a much larger code and data size. Note that -these values will vary depending on the efficiency of the -compiler and the compiler options used during generation. - - Previous Release: - Non-Debug Version: 77.8K Code, 11.5K Data, 89.3K Total - Debug Version: 163.8K Code, 68.2K Data, 232.0K Total - Current Release: - Non-Debug Version: 78.0K Code, 11.5K Data, 89.5K Total - Debug Version: 164.1K Code, 68.2K Data, 232.3K Total - - -2) iASL Compiler/Disassembler: - -Implemented full support for Package objects within the Case() -operator. Note: The Break() operator is currently not supported -within Case blocks (TermLists) as there is some question about -backward compatibility with ACPI 1.0 interpreters. - - -Fixed a problem where complex terms were not supported properly -within the Switch() operator. - -Eliminated extraneous warning for compiler-emitted reserved names -of the form "_T_x". (Used in Switch/Case operators.) - -Eliminated optimization messages for "_T_x" objects and small -constants within the DefinitionBlock operator. - - ----------------------------------------- -15 June 2004. Summary of changes for version 20040615: - -1) ACPI CA Core Subsystem: - -Implemented support for Buffer and String objects (as per ACPI -2.0) for the following ASL operators: LEqual, LGreater, LLess, -LGreaterEqual, and LLessEqual. - -All directory names in the entire source package are lower case, -as they were in earlier releases. - -Implemented "Disassemble" command in the AML debugger that will -disassemble a single control method. - -Code and Data Size: Current and previous core subsystem library -sizes are shown below. These are the code and data sizes for the -acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and -these values do not include any ACPI driver or OSPM code. The -debug version of the code includes the debug output trace -mechanism and has a much larger code and data size. Note that -these values will vary depending on the efficiency of the -compiler and the compiler options used during generation. - - Previous Release: - Non-Debug Version: 77.7K Code, 11.5K Data, 89.2K Total - Debug Version: 163.3K Code, 67.2K Data, 230.5K Total - - Current Release: - Non-Debug Version: 77.8K Code, 11.5K Data, 89.3K Total - Debug Version: 163.8K Code, 68.2K Data, 232.0K Total - - -2) iASL Compiler/Disassembler: - -Implemented support for Buffer and String objects (as per ACPI -2.0) for the following ASL operators: LEqual, LGreater, LLess, -LGreaterEqual, and LLessEqual. - -All directory names in the entire source package are lower case, -as they were in earlier releases. - -Fixed a fault when using the -g or -d<nofilename> options if the -FADT was not found. - -Fixed an issue with the Windows version of the compiler where -later versions of Windows place the FADT in the registry under -the name "FADT" and not "FACP" as earlier versions did. This -applies when using the -g or -d<nofilename> options. The -compiler now looks for both strings as necessary. - -Fixed a problem with compiler namepath optimization where a -namepath within the Scope() operator could not be optimized if -the namepath was a subpath of the current scope path. - ----------------------------------------- -27 May 2004. Summary of changes for version 20040527: - -1) ACPI CA Core Subsystem: - -Completed a new design and implementation for EBDA (Extended BIOS -Data Area) support in the RSDP scan code. The original code -improperly scanned for the EBDA by simply scanning from memory -location 0 to 0x400. The correct method is to first obtain the -EBDA pointer from within the BIOS data area, then scan 1K of -memory starting at the EBDA pointer. There appear to be few if -any machines that place the RSDP in the EBDA, however. - -Integrated a fix for a possible fault during evaluation of -BufferField arguments. Obsolete code that was causing the -problem was removed. - -Found and fixed a problem in the Field Support Code where data -could be corrupted on a bit field read that starts on an aligned -boundary but does not end on an aligned boundary. Merged the -read/write "datum length" calculation code into a common -procedure. - -Rolled in a couple of changes to the FreeBSD-specific header. - - -Code and Data Size: Current and previous core subsystem library -sizes are shown below. These are the code and data sizes for the -acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and -these values do not include any ACPI driver or OSPM code. The -debug version of the code includes the debug output trace -mechanism and has a much larger code and data size. Note that -these values will vary depending on the efficiency of the -compiler and the compiler options used during generation. - - Previous Release: - Non-Debug Version: 77.6K Code, 11.5K Data, 89.1K Total - Debug Version: 163.2K Code, 67.2K Data, 230.4K Total - Current Release: - Non-Debug Version: 77.7K Code, 11.5K Data, 89.2K Total - Debug Version: 163.3K Code, 67.2K Data, 230.5K Total - - -2) iASL Compiler/Disassembler: - -Fixed a generation warning produced by some overly-verbose -compilers for a 64-bit constant. - ----------------------------------------- -14 May 2004. Summary of changes for version 20040514: - -1) ACPI CA Core Subsystem: - -Fixed a problem where hardware GPE enable bits sometimes not set -properly during and after GPE method execution. Result of 04/27 -changes. - -Removed extra "clear all GPEs" when sleeping/waking. - -Removed AcpiHwEnableGpe and AcpiHwDisableGpe, replaced by the -single AcpiHwWriteGpeEnableReg. Changed a couple of calls to the -functions above to the new AcpiEv* calls as appropriate. - -ACPI_OS_NAME was removed from the OS-specific headers. The -default name is now "Microsoft Windows NT" for maximum -compatibility. However this can be changed by modifying the -acconfig.h file. - -Allow a single invocation of AcpiInstallNotifyHandler for a -handler that traps both types of notifies (System, Device). Use -ACPI_ALL_NOTIFY flag. - -Run _INI methods on ThermalZone objects. This is against the -ACPI specification, but there is apparently ASL code in the field -that has these _INI methods, and apparently "other" AML -interpreters execute them. - -Performed a full 16/32/64 bit lint that resulted in some small -changes. - -Added a sleep simulation command to the AML debugger to test -sleep code. - -Code and Data Size: Current and previous core subsystem library -sizes are shown below. These are the code and data sizes for the -acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and -these values do not include any ACPI driver or OSPM code. The -debug version of the code includes the debug output trace -mechanism and has a much larger code and data size. Note that -these values will vary depending on the efficiency of the -compiler and the compiler options used during generation. - - Previous Release: - Non-Debug Version: 77.6K Code, 11.5K Data, 89.1K Total - Debug Version: 162.9K Code, 67.0K Data, 229.9K Total - Current Release: - Non-Debug Version: 77.6K Code, 11.5K Data, 89.1K Total - Debug Version: 163.2K Code, 67.2K Data, 230.4K Total - ----------------------------------------- -27 April 2004. Summary of changes for version 20040427: - -1) ACPI CA Core Subsystem: - -Completed a major overhaul of the GPE handling within ACPI CA. -There are now three types of GPEs: wake-only, runtime-only, and -combination wake/run. The only GPEs allowed to be combination -wake/run are for button-style devices such as a control-method -power button, control-method sleep button, or a notebook lid -switch. GPEs that have an _Lxx or _Exx method and are not -referenced by any _PRW methods are marked for "runtime" and -hardware enabled. Any GPE that is referenced by a _PRW method is -marked for "wake" (and disabled at runtime). However, at sleep -time, only those GPEs that have been specifically enabled for -wake via the AcpiEnableGpe interface will actually be hardware -enabled. - -A new external interface has been added, AcpiSetGpeType(), that -is meant to be used by device drivers to force a GPE to a -particular type. It will be especially useful for the drivers -for the button devices mentioned above. - -Completed restructuring of the ACPI CA initialization sequence so -that default operation region handlers are installed before GPEs -are initialized and the _PRW methods are executed. This will -prevent errors when the _PRW methods attempt to access system -memory or I/O space. - -GPE enable/disable no longer reads the GPE enable register. We -now keep the enable info for runtime and wake separate and in the -GPE_EVENT_INFO. We thus no longer depend on the hardware to -maintain these bits. - -Always clear the wake status and fixed/GPE status bits before -sleep, even for state S5. - -Improved the AML debugger output for displaying the GPE blocks -and their current status. - -Added new strings for the _OSI method, of the form "Windows 2001 -SPx" where x = 0,1,2,3,4. - -Fixed a problem where the physical address was incorrectly -calculated when the Load() operator was used to directly load -from an Operation Region (vs. loading from a Field object.) Also -added check for minimum table length for this case. - -Fix for multiple mutex acquisition. Restore original thread -SyncLevel on mutex release. - -Added ACPI_VALID_SXDS flag to the AcpiGetObjectInfo interface for -consistency with the other fields returned. - -Shrunk the ACPI_GPE_EVENT_INFO structure by 40%. There is one -such structure for each GPE in the system, so the size of this -structure is important. - -CPU stack requirement reduction: Cleaned up the method execution -and object evaluation paths so that now a parameter structure is -passed, instead of copying the various method parameters over and -over again. - -In evregion.c: Correctly exit and reenter the interpreter region -if and only if dispatching an operation region request to a user- -installed handler. Do not exit/reenter when dispatching to a -default handler (e.g., default system memory or I/O handlers) - - -Notes for updating drivers for the new GPE support. The -following changes must be made to ACPI-related device drivers -that are attached to one or more GPEs: (This information will be -added to the ACPI CA Programmer Reference.) - -1) AcpiInstallGpeHandler no longer automatically enables the GPE, -you must explicitly call AcpiEnableGpe. -2) There is a new interface called AcpiSetGpeType. This should be -called before enabling the GPE. Also, this interface will -automatically disable the GPE if it is currently enabled. -3) AcpiEnableGpe no longer supports a GPE type flag. - -Specific drivers that must be changed: -1) EC driver: - AcpiInstallGpeHandler (NULL, GpeNum, ACPI_GPE_EDGE_TRIGGERED, -AeGpeHandler, NULL); - AcpiSetGpeType (NULL, GpeNum, ACPI_GPE_TYPE_RUNTIME); - AcpiEnableGpe (NULL, GpeNum, ACPI_NOT_ISR); - -2) Button Drivers (Power, Lid, Sleep): -Run _PRW method under parent device -If _PRW exists: /* This is a control-method button */ - Extract GPE number and possibly GpeDevice - AcpiSetGpeType (GpeDevice, GpeNum, ACPI_GPE_TYPE_WAKE_RUN); - AcpiEnableGpe (GpeDevice, GpeNum, ACPI_NOT_ISR); - -For all other devices that have _PRWs, we automatically set the -GPE type to ACPI_GPE_TYPE_WAKE, but the GPE is NOT automatically -(wake) enabled. This must be done on a selective basis, usually -requiring some kind of user app to allow the user to pick the -wake devices. - - -Code and Data Size: Current and previous core subsystem library -sizes are shown below. These are the code and data sizes for the -acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and -these values do not include any ACPI driver or OSPM code. The -debug version of the code includes the debug output trace -mechanism and has a much larger code and data size. Note that -these values will vary depending on the efficiency of the -compiler and the compiler options used during generation. - - Previous Release: - Non-Debug Version: 77.0K Code, 11.4K Data, 88.4K Total - Debug Version: 161.0K Code, 66.3K Data, 227.3K Total - Current Release: - - Non-Debug Version: 77.6K Code, 11.5K Data, 89.1K Total - Debug Version: 162.9K Code, 67.0K Data, 229.9K Total - - - ----------------------------------------- -02 April 2004. Summary of changes for version 20040402: - -1) ACPI CA Core Subsystem: - -Fixed an interpreter problem where an indirect store through an -ArgX parameter was incorrectly applying the "implicit conversion -rules" during the store. From the ACPI specification: "If the -target is a method local or argument (LocalX or ArgX), no -conversion is performed and the result is stored directly to the -target". The new behavior is to disable implicit conversion -during ALL stores to an ArgX. - -Changed the behavior of the _PRW method scan to ignore any and -all errors returned by a given _PRW. This prevents the scan from -aborting from the failure of any single _PRW. - -Moved the runtime configuration parameters from the global init -procedure to static variables in acglobal.h. This will allow the -host to override the default values easily. - -Code and Data Size: Current and previous core subsystem library -sizes are shown below. These are the code and data sizes for the -acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and -these values do not include any ACPI driver or OSPM code. The -debug version of the code includes the debug output trace -mechanism and has a much larger code and data size. Note that -these values will vary depending on the efficiency of the -compiler and the compiler options used during generation. - - Previous Release: - Non-Debug Version: 76.9K Code, 11.4K Data, 88.3K Total - Debug Version: 160.8K Code, 66.1K Data, 226.9K Total - Current Release: - Non-Debug Version: 77.0K Code, 11.4K Data, 88.4K Total - Debug Version: 161.0K Code, 66.3K Data, 227.3K Total - - -2) iASL Compiler/Disassembler: - -iASL now fully disassembles SSDTs. However, External() -statements are not generated automatically for unresolved symbols -at this time. This is a planned feature for future -implementation. - -Fixed a scoping problem in the disassembler that occurs when the -type of the target of a Scope() operator is overridden. This -problem caused an incorrectly nested internal namespace to be -constructed. - -Any warnings or errors that are emitted during disassembly are -now commented out automatically so that the resulting file can be -recompiled without any hand editing. - ----------------------------------------- -26 March 2004. Summary of changes for version 20040326: - -1) ACPI CA Core Subsystem: - -Implemented support for "wake" GPEs via interaction between GPEs -and the _PRW methods. Every GPE that is pointed to by one or -more _PRWs is identified as a WAKE GPE and by default will no -longer be enabled at runtime. Previously, we were blindly -enabling all GPEs with a corresponding _Lxx or _Exx method - but -most of these turn out to be WAKE GPEs anyway. We believe this -has been the cause of thousands of "spurious" GPEs on some -systems. - -This new GPE behavior is can be reverted to the original behavior -(enable ALL GPEs at runtime) via a runtime flag. - -Fixed a problem where aliased control methods could not access -objects properly. The proper scope within the namespace was not -initialized (transferred to the target of the aliased method) -before executing the target method. - -Fixed a potential race condition on internal object deletion on -the return object in AcpiEvaluateObject. - -Integrated a fix for resource descriptors where both _MEM and -_MTP were being extracted instead of just _MEM. (i.e. bitmask -was incorrectly too wide, 0x0F instead of 0x03.) - -Added a special case for ACPI_ROOT_OBJECT in AcpiUtGetNodeName, -preventing a fault in some cases. - -Updated Notify() values for debug statements in evmisc.c - -Return proper status from AcpiUtMutexInitialize, not just simply -AE_OK. - -Code and Data Size: Current and previous core subsystem library -sizes are shown below. These are the code and data sizes for the -acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and -these values do not include any ACPI driver or OSPM code. The -debug version of the code includes the debug output trace -mechanism and has a much larger code and data size. Note that -these values will vary depending on the efficiency of the -compiler and the compiler options used during generation. - - Previous Release: - - Non-Debug Version: 76.5K Code, 11.3K Data, 87.8K Total - Debug Version: 160.3K Code, 66.0K Data, 226.3K Total - Current Release: - Non-Debug Version: 76.9K Code, 11.4K Data, 88.3K Total - Debug Version: 160.8K Code, 66.1K Data, 226.9K Total - ----------------------------------------- -11 March 2004. Summary of changes for version 20040311: - -1) ACPI CA Core Subsystem: - -Fixed a problem where errors occurring during the parse phase of -control method execution did not abort cleanly. For example, -objects created and installed in the namespace were not deleted. -This caused all subsequent invocations of the method to return -the AE_ALREADY_EXISTS exception. - -Implemented a mechanism to force a control method to "Serialized" -execution if the method attempts to create namespace objects. -(The root of the AE_ALREADY_EXISTS problem.) - -Implemented support for the predefined _OSI "internal" control -method. Initial supported strings are "Linux", "Windows 2000", -"Windows 2001", and "Windows 2001.1", and can be easily upgraded -for new strings as necessary. This feature will allow "other" -operating systems to execute the fully tested, "Windows" code -path through the ASL code - -Global Lock Support: Now allows multiple acquires and releases -with any internal thread. Removed concept of "owning thread" for -this special mutex. - -Fixed two functions that were inappropriately declaring large -objects on the CPU stack: PsParseLoop, NsEvaluateRelative. -Reduces the stack usage during method execution considerably. - -Fixed a problem in the ACPI 2.0 FACS descriptor (actbl2.h) where -the S4Bios_f field was incorrectly defined as UINT32 instead of -UINT32_BIT. - -Fixed a problem where AcpiEvGpeDetect would fault if there were -no GPEs defined on the machine. - -Implemented two runtime options: One to force all control method -execution to "Serialized" to mimic Windows behavior, another to -disable _OSI support if it causes problems on a given machine. - -Code and Data Size: Current and previous core subsystem library -sizes are shown below. These are the code and data sizes for the -acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and -these values do not include any ACPI driver or OSPM code. The -debug version of the code includes the debug output trace -mechanism and has a much larger code and data size. Note that -these values will vary depending on the efficiency of the -compiler and the compiler options used during generation. - - Previous Release: - Non-Debug Version: 74.8K Code, 10.1K Data, 84.9K Total - Debug Version: 158.7K Code, 65.1K Data, 223.8K Total - Current Release: - Non-Debug Version: 76.5K Code, 11.3K Data, 87.8K Total - Debug Version: 160.3K Code, 66.0K Data, 226.3K Total - -2) iASL Compiler/Disassembler: - -Fixed an array size problem for FreeBSD that would cause the -compiler to fault. - ----------------------------------------- -20 February 2004. Summary of changes for version 20040220: - - -1) ACPI CA Core Subsystem: - -Implemented execution of _SxD methods for Device objects in the -GetObjectInfo interface. - -Fixed calls to _SST method to pass the correct arguments. - -Added a call to _SST on wake to restore to "working" state. - -Check for End-Of-Buffer failure case in the WalkResources -interface. - -Integrated fix for 64-bit alignment issue in acglobal.h by moving -two structures to the beginning of the file. - -After wake, clear GPE status register(s) before enabling GPEs. - -After wake, clear/enable power button. (Perhaps we should -clear/enable all fixed events upon wake.) - -Fixed a couple of possible memory leaks in the Namespace manager. - -Integrated latest acnetbsd.h file. - ----------------------------------------- -11 February 2004. Summary of changes for version 20040211: - - -1) ACPI CA Core Subsystem: - -Completed investigation and implementation of the call-by- -reference mechanism for control method arguments. - -Fixed a problem where a store of an object into an indexed -package could fail if the store occurs within a different method -than the method that created the package. - -Fixed a problem where the ToDecimal operator could return -incorrect results. - -Fixed a problem where the CopyObject operator could fail on some -of the more obscure objects (e.g., Reference objects.) - -Improved the output of the Debug object to display buffer, -package, and index objects. - -Fixed a problem where constructs of the form "RefOf (ArgX)" did -not return the expected result. - -Added permanent ACPI_REPORT_ERROR macros for all instances of the -ACPI_AML_INTERNAL exception. - -Integrated latest version of acfreebsd.h - ----------------------------------------- -16 January 2004. Summary of changes for version 20040116: - -The purpose of this release is primarily to update the copyright -years in each module, thus causing a huge number of diffs. There -are a few small functional changes, however. - -1) ACPI CA Core Subsystem: - -Improved error messages when there is a problem finding one or -more of the required base ACPI tables - -Reintroduced the definition of APIC_HEADER in actbl.h - -Changed definition of MADT_ADDRESS_OVERRIDE to 64 bits (actbl.h) - -Removed extraneous reference to NewObj in dsmthdat.c - -2) iASL compiler - -Fixed a problem introduced in December that disabled the correct -disassembly of Resource Templates - - ----------------------------------------- -03 December 2003. Summary of changes for version 20031203: - -1) ACPI CA Core Subsystem: - -Changed the initialization of Operation Regions during subsystem -init to perform two entire walks of the ACPI namespace; The first -to initialize the regions themselves, the second to execute the -_REG methods. This fixed some interdependencies across _REG -methods found on some machines. - -Fixed a problem where a Store(Local0, Local1) could simply update -the object reference count, and not create a new copy of the -object if the Local1 is uninitialized. - -Implemented support for the _SST reserved method during sleep -transitions. - -Implemented support to clear the SLP_TYP and SLP_EN bits when -waking up, this is apparently required by some machines. - -When sleeping, clear the wake status only if SleepState is not -S5. - -Fixed a problem in AcpiRsExtendedIrqResource() where an incorrect -pointer arithmetic advanced a string pointer too far. - -Fixed a problem in AcpiTbGetTablePtr() where a garbage pointer -could be returned if the requested table has not been loaded. - -Within the support for IRQ resources, restructured the handling -of -the active and edge/level bits. - -Fixed a few problems in AcpiPsxExecute() where memory could be -leaked under certain error conditions. - -Improved error messages for the cases where the ACPI mode could -not be entered. - -Code and Data Size: Current and previous core subsystem library -sizes are shown below. These are the code and data sizes for the -acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and -these values do not include any ACPI driver or OSPM code. The -debug version of the code includes the debug output trace -mechanism and has a much larger code and data size. Note that -these values will vary depending on the efficiency of the -compiler -and the compiler options used during generation. - - Previous Release (20031029): - Non-Debug Version: 74.4K Code, 10.1K Data, 84.5K Total - Debug Version: 158.3K Code, 65.0K Data, 223.3K Total - Current Release: - Non-Debug Version: 74.8K Code, 10.1K Data, 84.9K Total - Debug Version: 158.7K Code, 65.1K Data, 223.8K Total - -2) iASL Compiler/Disassembler: - -Implemented a fix for the iASL disassembler where a bad index was -generated. This was most noticeable on 64-bit platforms - - ----------------------------------------- -29 October 2003. Summary of changes for version 20031029: - -1) ACPI CA Core Subsystem: - - -Fixed a problem where a level-triggered GPE with an associated -_Lxx control method was incorrectly cleared twice. - -Fixed a problem with the Field support code where an access can -occur beyond the end-of-region if the field is non-aligned but -extends to the very end of the parent region (resulted in an -AE_AML_REGION_LIMIT exception.) - -Fixed a problem with ACPI Fixed Events where an RT Clock handler -would not get invoked on an RTC event. The RTC event bitmasks -for -the PM1 registers were not being initialized properly. - -Implemented support for executing _STA and _INI methods for -Processor objects. Although this is currently not part of the -ACPI specification, there is existing ASL code that depends on -the -init-time execution of these methods. - -Implemented and deployed a GetDescriptorName function to decode -the various types of internal descriptors. Guards against null -descriptors during debug output also. - -Implemented and deployed a GetNodeName function to extract the 4- -character namespace node name. This function simplifies the -debug -and error output, as well as guarding against null pointers -during -output. - -Implemented and deployed the ACPI_FORMAT_UINT64 helper macro to -simplify the debug and error output of 64-bit integers. This -macro replaces the HIDWORD and LODWORD macros for dumping these -integers. - -Updated the implementation of the Stall() operator to only call -AcpiOsStall(), and also return an error if the operand is larger -than 255. This preserves the required behavior of not -relinquishing the processor, as would happen if AcpiOsSleep() was -called for "long stalls". - -Constructs of the form "Store(LocalX,LocalX)" where LocalX is not -initialized are now treated as NOOPs. - -Cleaned up a handful of warnings during 64-bit generation. - -Fixed a reported error where and incorrect GPE number was passed -to the GPE dispatch handler. This value is only used for error -output, however. Used this opportunity to clean up and -streamline -the GPE dispatch code. - -Code and Data Size: Current and previous core subsystem library -sizes are shown below. These are the code and data sizes for the -acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and -these values do not include any ACPI driver or OSPM code. The - -debug version of the code includes the debug output trace -mechanism and has a much larger code and data size. Note that -these values will vary depending on the efficiency of the -compiler -and the compiler options used during generation. - - Previous Release (20031002): - Non-Debug Version: 74.1K Code, 9.7K Data, 83.8K Total - Debug Version: 157.9K Code, 64.8K Data, 222.7K Total - Current Release: - Non-Debug Version: 74.4K Code, 10.1K Data, 84.5K Total - Debug Version: 158.3K Code, 65.0K Data, 223.3K Total - - -2) iASL Compiler/Disassembler: - -Updated the iASL compiler to return an error if the operand to -the -Stall() operator is larger than 255. - - ----------------------------------------- -02 October 2003. Summary of changes for version 20031002: - - -1) ACPI CA Core Subsystem: - -Fixed a problem with Index Fields where the index was not -incremented for fields that require multiple writes to the -index/data registers (Fields that are wider than the data -register.) - -Fixed a problem with all Field objects where a write could go -beyond the end-of-field if the field was larger than the access -granularity and therefore required multiple writes to complete -the -request. An extra write beyond the end of the field could happen -inadvertently. - -Fixed a problem with Index Fields where a BUFFER_OVERFLOW error -would incorrectly be returned if the width of the Data Register -was larger than the specified field access width. - -Completed fixes for LoadTable() and Unload() and verified their -operation. Implemented full support for the "DdbHandle" object -throughout the ACPI CA subsystem. - -Implemented full support for the MADT and ECDT tables in the ACPI -CA header files. Even though these tables are not directly -consumed by ACPI CA, the header definitions are useful for ACPI -device drivers. - -Integrated resource descriptor fixes posted to the Linux ACPI -list. This included checks for minimum descriptor length, and -support for trailing NULL strings within descriptors that have -optional string elements. - -Code and Data Size: Current and previous core subsystem library -sizes are shown below. These are the code and data sizes for the -acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and -these values do not include any ACPI driver or OSPM code. The -debug version of the code includes the debug output trace -mechanism and has a much larger code and data size. Note that -these values will vary depending on the efficiency of the -compiler -and the compiler options used during generation. - - Previous Release (20030918): - Non-Debug Version: 73.9K Code, 9.7K Data, 83.6K Total - Debug Version: 157.3K Code, 64.5K Data, 221.8K Total - Current Release: - Non-Debug Version: 74.1K Code, 9.7K Data, 83.8K Total - Debug Version: 157.9K Code, 64.8K Data, 222.7K Total - - -2) iASL Compiler: - -Implemented detection of non-ASCII characters within the input -source ASL file. This catches attempts to compile binary (AML) -files early in the compile, with an informative error message. - -Fixed a problem where the disassembler would fault if the output -filename could not be generated or if the output file could not -be -opened. - ----------------------------------------- -18 September 2003. Summary of changes for version 20030918: - - -1) ACPI CA Core Subsystem: - -Found and fixed a longstanding problem with the late execution of -the various deferred AML opcodes (such as Operation Regions, -Buffer Fields, Buffers, and Packages). If the name string -specified for the name of the new object placed the object in a -scope other than the current scope, the initialization/execution -of the opcode failed. The solution to this problem was to -implement a mechanism where the late execution of such opcodes -does not attempt to lookup/create the name a second time in an -incorrect scope. This fixes the "region size computed -incorrectly" problem. - -Fixed a call to AcpiHwRegisterWrite in hwregs.c that was causing -a -Global Lock AE_BAD_PARAMETER error. - -Fixed several 64-bit issues with prototypes, casting and data -types. - -Removed duplicate prototype from acdisasm.h - -Fixed an issue involving EC Operation Region Detach (Shaohua Li) - -Code and Data Size: Current and previous core subsystem library -sizes are shown below. These are the code and data sizes for the -acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and -these values do not include any ACPI driver or OSPM code. The -debug version of the code includes the debug output trace -mechanism and has a much larger code and data size. Note that -these values will vary depending on the efficiency of the -compiler -and the compiler options used during generation. - - Previous Release: - - Non-Debug Version: 73.7K Code, 9.7K Data, 83.4K Total - Debug Version: 156.9K Code, 64.2K Data, 221.1K Total - Current Release: - Non-Debug Version: 73.9K Code, 9.7K Data, 83.6K Total - Debug Version: 157.3K Code, 64.5K Data, 221.8K Total - - -2) Linux: - -Fixed the AcpiOsSleep implementation in osunixxf.c to pass the -correct sleep time in seconds. - ----------------------------------------- -14 July 2003. Summary of changes for version 20030619: - -1) ACPI CA Core Subsystem: - -Parse SSDTs in order discovered, as opposed to reverse order -(Hrvoje Habjanic) - -Fixes from FreeBSD and NetBSD. (Frank van der Linden, Thomas -Klausner, - Nate Lawson) - - -2) Linux: - -Dynamically allocate SDT list (suggested by Andi Kleen) - -proc function return value cleanups (Andi Kleen) - -Correctly handle NMI watchdog during long stalls (Andrew Morton) - -Make it so acpismp=force works (reported by Andrew Morton) - - ----------------------------------------- -19 June 2003. Summary of changes for version 20030619: - -1) ACPI CA Core Subsystem: - -Fix To/FromBCD, eliminating the need for an arch-specific -#define. - -Do not acquire a semaphore in the S5 shutdown path. - -Fix ex_digits_needed for 0. (Takayoshi Kochi) - -Fix sleep/stall code reversal. (Andi Kleen) - -Revert a change having to do with control method calling -semantics. - -2) Linux: - -acpiphp update (Takayoshi Kochi) - -Export acpi_disabled for sonypi (Stelian Pop) - -Mention acpismp=force in config help - -Re-add acpitable.c and acpismp=force. This improves backwards - -compatibility and also cleans up the code to a significant -degree. - -Add ASUS Value-add driver (Karol Kozimor and Julien Lerouge) - ----------------------------------------- -22 May 2003. Summary of changes for version 20030522: - -1) ACPI CA Core Subsystem: - -Found and fixed a reported problem where an AE_NOT_FOUND error -occurred occasionally during _BST evaluation. This turned out to -be an Owner ID allocation issue where a called method did not get -a new ID assigned to it. Eventually, (after 64k calls), the -Owner -ID UINT16 would wraparound so that the ID would be the same as -the -caller's and the called method would delete the caller's -namespace. - -Implemented extended error reporting for control methods that are -aborted due to a run-time exception. Output includes the exact -AML instruction that caused the method abort, a dump of the -method -locals and arguments at the time of the abort, and a trace of all -nested control method calls. - -Modified the interpreter to allow the creation of buffers of zero -length from the AML code. Implemented new code to ensure that no -attempt is made to actually allocate a memory buffer (of length -zero) - instead, a simple buffer object with a NULL buffer -pointer -and length zero is created. A warning is no longer issued when -the AML attempts to create a zero-length buffer. - -Implemented a workaround for the "leading asterisk issue" in -_HIDs, _UIDs, and _CIDs in the AML interpreter. One leading -asterisk is automatically removed if present in any HID, UID, or -CID strings. The iASL compiler will still flag this asterisk as -an error, however. - -Implemented full support for _CID methods that return a package -of -multiple CIDs (Compatible IDs). The AcpiGetObjectInfo() -interface -now additionally returns a device _CID list if present. This -required a change to the external interface in order to pass an -ACPI_BUFFER object as a parameter since the _CID list is of -variable length. - -Fixed a problem with the new AE_SAME_HANDLER exception where -handler initialization code did not know about this exception. - -Code and Data Size: Current and previous core subsystem library -sizes are shown below. These are the code and data sizes for the -acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and -these values do not include any ACPI driver or OSPM code. The -debug version of the code includes the debug output trace -mechanism and has a much larger code and data size. Note that -these values will vary depending on the efficiency of the -compiler -and the compiler options used during generation. - - Previous Release (20030509): - Non-Debug Version: 73.4K Code, 9.7K Data, 83.1K Total - Debug Version: 156.1K Code, 63.9K Data, 220.0K Total - Current Release: - Non-Debug Version: 73.7K Code, 9.7K Data, 83.4K Total - Debug Version: 156.9K Code, 64.2K Data, 221.1K Total - - -2) Linux: - -Fixed a bug in which we would reinitialize the ACPI interrupt -after it was already working, thus disabling all ACPI and the -IRQs -for any other device sharing the interrupt. (Thanks to Stian -Jordet) - -Toshiba driver update (John Belmonte) - -Return only 0 or 1 for our interrupt handler status (Andrew -Morton) - - -3) iASL Compiler: - -Fixed a reported problem where multiple (nested) ElseIf() -statements were not handled correctly by the compiler, resulting -in incorrect warnings and incorrect AML code. This was a problem -in both the ASL parser and the code generator. - - -4) Documentation: - -Added changes to existing interfaces, new exception codes, and -new -text concerning reference count object management versus garbage -collection. - ----------------------------------------- -09 May 2003. Summary of changes for version 20030509. - - -1) ACPI CA Core Subsystem: - -Changed the subsystem initialization sequence to hold off -installation of address space handlers until the hardware has -been -initialized and the system has entered ACPI mode. This is -because -the installation of space handlers can cause _REG methods to be -run. Previously, the _REG methods could potentially be run -before -ACPI mode was enabled. - -Fixed some memory leak issues related to address space handler -and -notify handler installation. There were some problems with the -reference count mechanism caused by the fact that the handler -objects are shared across several namespace objects. - -Fixed a reported problem where reference counts within the -namespace were not properly updated when named objects created by -method execution were deleted. - -Fixed a reported problem where multiple SSDTs caused a deletion -issue during subsystem termination. Restructured the table data -structures to simplify the linked lists and the related code. - -Fixed a problem where the table ID associated with secondary -tables (SSDTs) was not being propagated into the namespace -objects -created by those tables. This would only present a problem for -tables that are unloaded at run-time, however. - -Updated AcpiOsReadable and AcpiOsWritable to use the ACPI_SIZE -type as the length parameter (instead of UINT32). - -Solved a long-standing problem where an ALREADY_EXISTS error -appears on various systems. This problem could happen when there -are multiple PCI_Config operation regions under a single PCI root -bus. This doesn't happen very frequently, but there are some -systems that do this in the ASL. - -Fixed a reported problem where the internal DeleteNode function -was incorrectly handling the case where a namespace node was the -first in the parent's child list, and had additional peers (not -the only child, but first in the list of children.) - -Code and Data Size: Current core subsystem library sizes are -shown -below. These are the code and data sizes for the acpica.lib -produced by the Microsoft Visual C++ 6.0 compiler, and these -values do not include any ACPI driver or OSPM code. The debug -version of the code includes the debug output trace mechanism and -has a much larger code and data size. Note that these values -will -vary depending on the efficiency of the compiler and the compiler -options used during generation. - - Previous Release - Non-Debug Version: 73.7K Code, 9.5K Data, 83.2K Total - Debug Version: 156.1K Code, 63.6K Data, 219.7K Total - Current Release: - Non-Debug Version: 73.4K Code, 9.7K Data, 83.1K Total - Debug Version: 156.1K Code, 63.9K Data, 220.0K Total - - -2) Linux: - -Allow ":" in OS override string (Ducrot Bruno) - -Kobject fix (Greg KH) - - -3 iASL Compiler/Disassembler: - -Fixed a problem in the generation of the C source code files (AML -is emitted in C source statements for BIOS inclusion) where the -Ascii dump that appears within a C comment at the end of each -line -could cause a compile time error if the AML sequence happens to -have an open comment or close comment sequence embedded. - - ----------------------------------------- -24 April 2003. Summary of changes for version 20030424. - - -1) ACPI CA Core Subsystem: - -Support for big-endian systems has been implemented. Most of the -support has been invisibly added behind big-endian versions of -the -ACPI_MOVE_* macros. - -Fixed a problem in AcpiHwDisableGpeBlock() and -AcpiHwClearGpeBlock() where an incorrect offset was passed to the -low level hardware write routine. The offset parameter was -actually eliminated from the low level read/write routines -because -they had become obsolete. - -Fixed a problem where a handler object was deleted twice during -the removal of a fixed event handler. - - -2) Linux: - -A fix for SMP systems with link devices was contributed by - -Compaq's Dan Zink. - -(2.5) Return whether we handled the interrupt in our IRQ handler. -(Linux ISRs no longer return void, so we can propagate the -handler -return value from the ACPI CA core back to the OS.) - - - -3) Documentation: - -The ACPI CA Programmer Reference has been updated to reflect new -interfaces and changes to existing interfaces. - ----------------------------------------- -28 March 2003. Summary of changes for version 20030328. - -1) ACPI CA Core Subsystem: - -The GPE Block Device support has been completed. New interfaces -are AcpiInstallGpeBlock and AcpiRemoveGpeBlock. The Event -interfaces (enable, disable, clear, getstatus) have been split -into separate interfaces for Fixed Events and General Purpose -Events (GPEs) in order to support GPE Block Devices properly. - -Fixed a problem where the error message "Failed to acquire -semaphore" would appear during operations on the embedded -controller (EC). - -Code and Data Size: Current core subsystem library sizes are -shown -below. These are the code and data sizes for the acpica.lib -produced by the Microsoft Visual C++ 6.0 compiler, and these -values do not include any ACPI driver or OSPM code. The debug -version of the code includes the debug output trace mechanism and -has a much larger code and data size. Note that these values -will -vary depending on the efficiency of the compiler and the compiler -options used during generation. - - Previous Release - Non-Debug Version: 72.3K Code, 9.5K Data, 81.8K Total - Debug Version: 154.0K Code, 63.4K Data, 217.4K Total - Current Release: - Non-Debug Version: 73.7K Code, 9.5K Data, 83.2K Total - Debug Version: 156.1K Code, 63.6K Data, 219.7K Total - - ----------------------------------------- -28 February 2003. Summary of changes for version 20030228. - - -1) ACPI CA Core Subsystem: - -The GPE handling and dispatch code has been completely overhauled -in preparation for support of GPE Block Devices (ID ACPI0006). -This affects internal data structures and code only; there should -be no differences visible externally. One new file has been -added, evgpeblk.c - -The FADT fields GPE0_BLK_LEN and GPE1_BLK_LEN are now the only -fields that are used to determine the GPE block lengths. The -REGISTER_BIT_WIDTH field of the X_GPEx_BLK extended address -structures are ignored. This is per the ACPI specification but -it -isn't very clear. The full 256 Block 0/1 GPEs are now supported -(the use of REGISTER_BIT_WIDTH limited the number of GPEs to -128). - -In the SCI interrupt handler, removed the read of the PM1_CONTROL -register to look at the SCI_EN bit. On some machines, this read -causes an SMI event and greatly slows down SCI events. (This may -in fact be the cause of slow battery status response on some -systems.) - -Fixed a problem where a store of a NULL string to a package -object -could cause the premature deletion of the object. This was seen -during execution of the battery _BIF method on some systems, -resulting in no battery data being returned. - -Added AcpiWalkResources interface to simplify parsing of resource -lists. - -Code and Data Size: Current core subsystem library sizes are -shown -below. These are the code and data sizes for the acpica.lib -produced by the Microsoft Visual C++ 6.0 compiler, and these -values do not include any ACPI driver or OSPM code. The debug -version of the code includes the debug output trace mechanism and -has a much larger code and data size. Note that these values -will -vary depending on the efficiency of the compiler and the compiler -options used during generation. - - Previous Release - Non-Debug Version: 72.0K Code, 9.5K Data, 81.5K Total - Debug Version: 153.0K Code, 62.9K Data, 215.9K Total - Current Release: - Non-Debug Version: 72.3K Code, 9.5K Data, 81.8K Total - Debug Version: 154.0K Code, 63.4K Data, 217.4K Total - - -2) Linux - -S3 fixes (Ole Rohne) - -Update ACPI PHP driver with to use new acpi_walk_resource API -(Bjorn Helgaas) - -Add S4BIOS support (Pavel Machek) - -Map in entire table before performing checksum (John Stultz) - -Expand the mem= cmdline to allow the specification of reserved -and -ACPI DATA blocks (Pavel Machek) - -Never use ACPI on VISWS - -Fix derive_pci_id (Ducrot Bruno, Alvaro Lopez) - -Revert a change that allowed P_BLK lengths to be 4 or 5. This is -causing us to think that some systems support C2 when they really -don't. - -Do not count processor objects for non-present CPUs (Thanks to -Dominik Brodowski) - - -3) iASL Compiler: - -Fixed a problem where ASL include files could not be found and -opened. - -Added support for the _PDC reserved name. - - ----------------------------------------- -22 January 2003. Summary of changes for version 20030122. - - -1) ACPI CA Core Subsystem: - -Added a check for constructs of the form: Store (Local0, Local0) -where Local0 is not initialized. Apparently, some BIOS -programmers believe that this is a NOOP. Since this store -doesn't -do anything anyway, the new prototype behavior will ignore this -error. This is a case where we can relax the strict checking in -the interpreter in the name of compatibility. - - -2) Linux - -The AcpiSrc Source Conversion Utility has been released with the -Linux package for the first time. This is the utility that is -used to convert the ACPI CA base source code to the Linux -version. - -(Both) Handle P_BLK lengths shorter than 6 more gracefully - -(Both) Move more headers to include/acpi, and delete an unused -header. - -(Both) Move drivers/acpi/include directory to include/acpi - -(Both) Boot functions don't use cmdline, so don't pass it around - -(Both) Remove include of unused header (Adrian Bunk) - -(Both) acpiphp.h includes both linux/acpi.h and acpi_bus.h. Since -the -former now also includes the latter, acpiphp.h only needs the -one, -now. - -(2.5) Make it possible to select method of bios restoring after -S3 -resume. [=> no more ugly ifdefs] (Pavel Machek) - -(2.5) Make proc write interfaces work (Pavel Machek) - -(2.5) Properly init/clean up in cpufreq/acpi (Dominik Brodowski) - -(2.5) Break out ACPI Perf code into its own module, under cpufreq -(Dominik Brodowski) - -(2.4) S4BIOS support (Ducrot Bruno) - -(2.4) Fix acpiphp_glue.c for latest ACPI struct changes (Sergio -Visinoni) - - -3) iASL Compiler: - -Added support to disassemble SSDT and PSDTs. - -Implemented support to obtain SSDTs from the Windows registry if -available. - - ----------------------------------------- -09 January 2003. Summary of changes for version 20030109. - -1) ACPI CA Core Subsystem: - -Changed the behavior of the internal Buffer-to-String conversion -function. The current ACPI specification states that the -contents -of the buffer are "converted to a string of two-character -hexadecimal numbers, each separated by a space". Unfortunately, -this definition is not backwards compatible with existing ACPI -1.0 -implementations (although the behavior was not defined in the -ACPI -1.0 specification). The new behavior simply copies data from the -buffer to the string until a null character is found or the end -of -the buffer is reached. The new String object is always null -terminated. This problem was seen during the generation of _BIF -battery data where incorrect strings were returned for battery -type, etc. This will also require an errata to the ACPI -specification. - -Renamed all instances of NATIVE_UINT and NATIVE_INT to -ACPI_NATIVE_UINT and ACPI_NATIVE_INT, respectively. - -Copyright in all module headers (both Linux and non-Linux) has be -updated to 2003. - -Code and Data Size: Current core subsystem library sizes are -shown -below. These are the code and data sizes for the acpica.lib -produced by the Microsoft Visual C++ 6.0 compiler, and these -values do not include any ACPI driver or OSPM code. The debug -version of the code includes the debug output trace mechanism and -has a much larger code and data size. Note that these values -will -vary depending on the efficiency of the compiler and the compiler -options used during generation. - - Previous Release - Non-Debug Version: 72.0K Code, 9.5K Data, 81.5K Total - Debug Version: 153.0K Code, 62.9K Data, 215.9K Total - Current Release: - Non-Debug Version: 72.0K Code, 9.5K Data, 81.5K Total - Debug Version: 153.0K Code, 62.9K Data, 215.9K Total - - -2) Linux - -Fixed an oops on module insertion/removal (Matthew Tippett) - -(2.4) Fix to handle dynamic size of mp_irqs (Joerg Prante) - -(2.5) Replace pr_debug (Randy Dunlap) - -(2.5) Remove usage of CPUFREQ_ALL_CPUS (Dominik Brodowski) - -(Both) Eliminate spawning of thread from timer callback, in favor -of schedule_work() - -(Both) Show Lid status in /proc (Zdenek OGAR Skalak) - -(Both) Added define for Fixed Function HW region (Matthew Wilcox) - -(Both) Add missing statics to button.c (Pavel Machek) - -Several changes have been made to the source code translation -utility that generates the Linux Code in order to make the code -more "Linux-like": - -All typedefs on structs and unions have been removed in keeping -with the Linux coding style. - -Removed the non-Linux SourceSafe module revision number from each -module header. - -Completed major overhaul of symbols to be lowercased for linux. -Doubled the number of symbols that are lowercased. - -Fixed a problem where identifiers within procedure headers and -within quotes were not fully lower cased (they were left with a -starting capital.) - -Some C macros whose only purpose is to allow the generation of 16- -bit code are now completely removed in the Linux code, increasing -readability and maintainability. - ----------------------------------------- - -12 December 2002. Summary of changes for version 20021212. - - -1) ACPI CA Core Subsystem: - -Fixed a problem where the creation of a zero-length AML Buffer -would cause a fault. - -Fixed a problem where a Buffer object that pointed to a static -AML -buffer (in an ACPI table) could inadvertently be deleted, causing -memory corruption. - -Fixed a problem where a user buffer (passed in to the external -ACPI CA interfaces) could be overwritten if the buffer was too -small to complete the operation, causing memory corruption. - -Fixed a problem in the Buffer-to-String conversion code where a -string of length one was always returned, regardless of the size -of the input Buffer object. - -Removed the NATIVE_CHAR data type across the entire source due to -lack of need and lack of consistent use. - -Code and Data Size: Current core subsystem library sizes are -shown -below. These are the code and data sizes for the acpica.lib -produced by the Microsoft Visual C++ 6.0 compiler, and these -values do not include any ACPI driver or OSPM code. The debug -version of the code includes the debug output trace mechanism and -has a much larger code and data size. Note that these values -will -vary depending on the efficiency of the compiler and the compiler -options used during generation. - - Previous Release - Non-Debug Version: 72.1K Code, 9.5K Data, 81.6K Total - Debug Version: 152.7K Code, 62.7K Data, 215.4K Total - Current Release: - Non-Debug Version: 72.0K Code, 9.5K Data, 81.5K Total - Debug Version: 153.0K Code, 62.9K Data, 215.9K Total - - ----------------------------------------- -05 December 2002. Summary of changes for version 20021205. - -1) ACPI CA Core Subsystem: - -Fixed a problem where a store to a String or Buffer object could -cause corruption of the DSDT if the object type being stored was -the same as the target object type and the length of the object -being stored was equal to or smaller than the original (existing) -target object. This was seen to cause corruption of battery _BIF -buffers if the _BIF method modified the buffer on the fly. - -Fixed a problem where an internal error was generated if a -control -method invocation was used in an OperationRegion, Buffer, or -Package declaration. This was caused by the deferred parsing of -the control method and thus the deferred creation of the internal -method object. The solution to this problem was to create the -internal method object at the moment the method is encountered in -the first pass - so that subsequent references to the method will -able to obtain the required parameter count and thus properly -parse the method invocation. This problem presented itself as an -AE_AML_INTERNAL during the pass 1 parse phase during table load. - -Fixed a problem where the internal String object copy routine did -not always allocate sufficient memory for the target String -object -and caused memory corruption. This problem was seen to cause -"Allocation already present in list!" errors as memory allocation -became corrupted. - -Implemented a new function for the evaluation of namespace -objects -that allows the specification of the allowable return object -types. This simplifies a lot of code that checks for a return -object of one or more specific objects returned from the -evaluation (such as _STA, etc.) This may become and external -function if it would be useful to ACPI-related drivers. - -Completed another round of prefixing #defines with "ACPI_" for -clarity. - -Completed additional code restructuring to allow more modular -linking for iASL compiler and AcpiExec. Several files were split -creating new files. New files: nsparse.c dsinit.c evgpe.c - -Implemented an abort mechanism to terminate an executing control -method via the AML debugger. This feature is useful for -debugging -control methods that depend (wait) for specific hardware -responses. - -Code and Data Size: Current core subsystem library sizes are -shown -below. These are the code and data sizes for the acpica.lib -produced by the Microsoft Visual C++ 6.0 compiler, and these -values do not include any ACPI driver or OSPM code. The debug -version of the code includes the debug output trace mechanism and -has a much larger code and data size. Note that these values -will -vary depending on the efficiency of the compiler and the compiler -options used during generation. - - Previous Release - Non-Debug Version: 71.4K Code, 9.0K Data, 80.4K Total - Debug Version: 152.9K Code, 63.3K Data, 216.2K Total - Current Release: - Non-Debug Version: 72.1K Code, 9.5K Data, 81.6K Total - Debug Version: 152.7K Code, 62.7K Data, 215.4K Total - - -2) iASL Compiler/Disassembler - -Fixed a compiler code generation problem for "Interrupt" Resource -Descriptors. If specified in the ASL, the optional "Resource -Source Index" and "Resource Source" fields were not inserted into -the correct location within the AML resource descriptor, creating -an invalid descriptor. - -Fixed a disassembler problem for "Interrupt" resource -descriptors. -The optional "Resource Source Index" and "Resource Source" fields -were ignored. - - ----------------------------------------- -22 November 2002. Summary of changes for version 20021122. - - -1) ACPI CA Core Subsystem: - -Fixed a reported problem where an object stored to a Method Local -or Arg was not copied to a new object during the store - the -object pointer was simply copied to the Local/Arg. This caused -all subsequent operations on the Local/Arg to also affect the -original source of the store operation. - -Fixed a problem where a store operation to a Method Local or Arg -was not completed properly if the Local/Arg contained a reference -(from RefOf) to a named field. The general-purpose store-to- -namespace-node code is now used so that this case is handled -automatically. - -Fixed a problem where the internal object copy routine would -cause -a protection fault if the object being copied was a Package and -contained either 1) a NULL package element or 2) a nested sub- -package. - -Fixed a problem with the GPE initialization that resulted from an -ambiguity in the ACPI specification. One section of the -specification states that both the address and length of the GPE -block must be zero if the block is not supported. Another -section -implies that only the address need be zero if the block is not -supported. The code has been changed so that both the address -and -the length must be non-zero to indicate a valid GPE block (i.e., -if either the address or the length is zero, the GPE block is -invalid.) - -Code and Data Size: Current core subsystem library sizes are -shown -below. These are the code and data sizes for the acpica.lib -produced by the Microsoft Visual C++ 6.0 compiler, and these -values do not include any ACPI driver or OSPM code. The debug -version of the code includes the debug output trace mechanism and -has a much larger code and data size. Note that these values -will -vary depending on the efficiency of the compiler and the compiler -options used during generation. - - Previous Release - Non-Debug Version: 71.3K Code, 9.0K Data, 80.3K Total - Debug Version: 152.7K Code, 63.2K Data, 215.5K Total - Current Release: - Non-Debug Version: 71.4K Code, 9.0K Data, 80.4K Total - Debug Version: 152.9K Code, 63.3K Data, 216.2K Total - - -2) Linux - -Cleaned up EC driver. Exported an external EC read/write -interface. By going through this, other drivers (most notably -sonypi) will be able to serialize access to the EC. - - -3) iASL Compiler/Disassembler - -Implemented support to optionally generate include files for both -ASM and C (the -i switch). This simplifies BIOS development by -automatically creating include files that contain external -declarations for the symbols that are created within the - -(optionally generated) ASM and C AML source files. - - ----------------------------------------- -15 November 2002. Summary of changes for version 20021115. - -1) ACPI CA Core Subsystem: - -Fixed a memory leak problem where an error during resolution of - -method arguments during a method invocation from another method -failed to cleanup properly by deleting all successfully resolved -argument objects. - -Fixed a problem where the target of the Index() operator was not -correctly constructed if the source object was a package. This -problem has not been detected because the use of a target operand -with Index() is very rare. - -Fixed a problem with the Index() operator where an attempt was -made to delete the operand objects twice. - -Fixed a problem where an attempt was made to delete an operand -twice during execution of the CondRefOf() operator if the target -did not exist. - -Implemented the first of perhaps several internal create object -functions that create and initialize a specific object type. -This -consolidates duplicated code wherever the object is created, thus -shrinking the size of the subsystem. - -Implemented improved debug/error messages for errors that occur -during nested method invocations. All executing method pathnames -are displayed (with the error) as the call stack is unwound - -thus -simplifying debug. - -Fixed a problem introduced in the 10/02 release that caused -premature deletion of a buffer object if a buffer was used as an -ASL operand where an integer operand is required (Thus causing an -implicit object conversion from Buffer to Integer.) The change -in -the 10/02 release was attempting to fix a memory leak (albeit -incorrectly.) - -Code and Data Size: Current core subsystem library sizes are -shown -below. These are the code and data sizes for the acpica.lib -produced by the Microsoft Visual C++ 6.0 compiler, and these -values do not include any ACPI driver or OSPM code. The debug -version of the code includes the debug output trace mechanism and -has a much larger code and data size. Note that these values -will -vary depending on the efficiency of the compiler and the compiler -options used during generation. - - Previous Release - Non-Debug Version: 71.9K Code, 9.1K Data, 81.0K Total - Debug Version: 153.1K Code, 63.3K Data, 216.4K Total - Current Release: - Non-Debug Version: 71.3K Code, 9.0K Data, 80.3K Total - Debug Version: 152.7K Code, 63.2K Data, 215.5K Total - - -2) Linux - -Changed the implementation of the ACPI semaphores to use down() -instead of down_interruptable(). It is important that the -execution of ACPI control methods not be interrupted by signals. -Methods must run to completion, or the system may be left in an -unknown/unstable state. - -Fixed a compilation error when CONFIG_SOFTWARE_SUSPEND is not -set. -(Shawn Starr) - - -3) iASL Compiler/Disassembler - - -Changed the default location of output files. All output files -are now placed in the current directory by default instead of in -the directory of the source file. This change may affect some -existing makefiles, but it brings the behavior of the compiler in -line with other similar tools. The location of the output files -can be overridden with the -p command line switch. - - ----------------------------------------- -11 November 2002. Summary of changes for version 20021111. - - -0) ACPI Specification 2.0B is released and is now available at: -http://www.acpi.info/index.html - - -1) ACPI CA Core Subsystem: - -Implemented support for the ACPI 2.0 SMBus Operation Regions. -This includes the early detection and handoff of the request to -the SMBus region handler (avoiding all of the complex field -support code), and support for the bidirectional return packet -from an SMBus write operation. This paves the way for the -development of SMBus drivers in each host operating system. - -Fixed a problem where the semaphore WAIT_FOREVER constant was -defined as 32 bits, but must be 16 bits according to the ACPI -specification. This had the side effect of causing ASL -Mutex/Event timeouts even though the ASL code requested a wait -forever. Changed all internal references to the ACPI timeout -parameter to 16 bits to prevent future problems. Changed the -name -of WAIT_FOREVER to ACPI_WAIT_FOREVER. - -Code and Data Size: Current core subsystem library sizes are -shown -below. These are the code and data sizes for the acpica.lib -produced by the Microsoft Visual C++ 6.0 compiler, and these -values do not include any ACPI driver or OSPM code. The debug -version of the code includes the debug output trace mechanism and -has a much larger code and data size. Note that these values -will -vary depending on the efficiency of the compiler and the compiler -options used during generation. - - Previous Release - Non-Debug Version: 71.4K Code, 9.0K Data, 80.4K Total - Debug Version: 152.3K Code, 63.0K Data, 215.3K Total - Current Release: - Non-Debug Version: 71.9K Code, 9.1K Data, 81.0K Total - Debug Version: 153.1K Code, 63.3K Data, 216.4K Total - - -2) Linux - -Module loading/unloading fixes (John Cagle) - - -3) iASL Compiler/Disassembler - -Added support for the SMBBlockProcessCall keyword (ACPI 2.0) - -Implemented support for the disassembly of all SMBus protocol -keywords (SMBQuick, SMBWord, etc.) - ----------------------------------------- -01 November 2002. Summary of changes for version 20021101. - - -1) ACPI CA Core Subsystem: - -Fixed a problem where platforms that have a GPE1 block but no -GPE0 -block were not handled correctly. This resulted in a "GPE -overlap" error message. GPE0 is no longer required. - -Removed code added in the previous release that inserted nodes -into the namespace in alphabetical order. This caused some side- -effects on various machines. The root cause of the problem is -still under investigation since in theory, the internal ordering -of the namespace nodes should not matter. - - -Enhanced error reporting for the case where a named object is not -found during control method execution. The full ACPI namepath -(name reference) of the object that was not found is displayed in -this case. - -Note: as a result of the overhaul of the namespace object types -in -the previous release, the namespace nodes for the predefined -scopes (_TZ, _PR, etc.) are now of the type ACPI_TYPE_LOCAL_SCOPE -instead of ACPI_TYPE_ANY. This simplifies the namespace -management code but may affect code that walks the namespace tree -looking for specific object types. - -Code and Data Size: Current core subsystem library sizes are -shown -below. These are the code and data sizes for the acpica.lib -produced by the Microsoft Visual C++ 6.0 compiler, and these -values do not include any ACPI driver or OSPM code. The debug -version of the code includes the debug output trace mechanism and -has a much larger code and data size. Note that these values -will -vary depending on the efficiency of the compiler and the compiler -options used during generation. - - Previous Release - Non-Debug Version: 70.7K Code, 8.6K Data, 79.3K Total - Debug Version: 151.7K Code, 62.4K Data, 214.1K Total - Current Release: - Non-Debug Version: 71.4K Code, 9.0K Data, 80.4K Total - Debug Version: 152.3K Code, 63.0K Data, 215.3K Total - - -2) Linux - -Fixed a problem introduced in the previous release where the -Processor and Thermal objects were not recognized and installed -in -/proc. This was related to the scope type change described -above. - - -3) iASL Compiler/Disassembler - -Implemented the -g option to get all of the required ACPI tables -from the registry and save them to files (Windows version of the -compiler only.) The required tables are the FADT, FACS, and -DSDT. - -Added ACPI table checksum validation during table disassembly in -order to catch corrupted tables. - - ----------------------------------------- -22 October 2002. Summary of changes for version 20021022. - -1) ACPI CA Core Subsystem: - -Implemented a restriction on the Scope operator that the target -must already exist in the namespace at the time the operator is -encountered (during table load or method execution). In other -words, forward references are not allowed and Scope() cannot -create a new object. This changes the previous behavior where the -interpreter would create the name if not found. This new -behavior -correctly enables the search-to-root algorithm during namespace -lookup of the target name. Because of this upsearch, this fixes -the known Compaq _SB_.OKEC problem and makes both the AML -interpreter and iASL compiler compatible with other ACPI -implementations. - -Completed a major overhaul of the internal ACPI object types for -the ACPI Namespace and the associated operand objects. Many of -these types had become obsolete with the introduction of the two- -pass namespace load. This cleanup simplifies the code and makes -the entire namespace load mechanism much clearer and easier to -understand. - -Improved debug output for tracking scope opening/closing to help -diagnose scoping issues. The old scope name as well as the new -scope name are displayed. Also improved error messages for -problems with ASL Mutex objects and error messages for GPE -problems. - -Cleaned up the namespace dump code, removed obsolete code. - -All string output (for all namespace/object dumps) now uses the -common ACPI string output procedure which handles escapes -properly -and does not emit non-printable characters. - -Fixed some issues with constants in the 64-bit version of the -local C library (utclib.c) - - -2) Linux - -EC Driver: No longer attempts to acquire the Global Lock at -interrupt level. - - -3) iASL Compiler/Disassembler - -Implemented ACPI 2.0B grammar change that disallows all Type 1 -and -2 opcodes outside of a control method. This means that the -"executable" operators (versus the "namespace" operators) cannot -be used at the table level; they can only be used within a -control -method. - -Implemented the restriction on the Scope() operator where the -target must already exist in the namespace at the time the -operator is encountered (during ASL compilation). In other words, -forward references are not allowed and Scope() cannot create a -new -object. This makes the iASL compiler compatible with other ACPI -implementations and makes the Scope() implementation adhere to -the -ACPI specification. - -Fixed a problem where namepath optimization for the Alias -operator -was optimizing the wrong path (of the two namepaths.) This -caused -a "Missing alias link" error message. - -Fixed a problem where an "unknown reserved name" warning could be -incorrectly generated for names like "_SB" when the trailing -underscore is not used in the original ASL. - -Fixed a problem where the reserved name check did not handle -NamePaths with multiple NameSegs correctly. The first nameseg of -the NamePath was examined instead of the last NameSeg. - - ----------------------------------------- - -02 October 2002. Summary of changes for this release. - - -1) ACPI CA Core Subsystem version 20021002: - -Fixed a problem where a store/copy of a string to an existing -string did not always set the string length properly in the -String -object. - -Fixed a reported problem with the ToString operator where the -behavior was identical to the ToHexString operator instead of -just -simply converting a raw buffer to a string data type. - -Fixed a problem where CopyObject and the other "explicit" -conversion operators were not updating the internal namespace -node -type as part of the store operation. - -Fixed a memory leak during implicit source operand conversion -where the original object was not deleted if it was converted to -a -new object of a different type. - -Enhanced error messages for all problems associated with -namespace -lookups. Common procedure generates and prints the lookup name -as -well as the formatted status. - -Completed implementation of a new design for the Alias support -within the namespace. The existing design did not handle the -case -where a new object was assigned to one of the two names due to -the -use of an explicit conversion operator, resulting in the two -names -pointing to two different objects. The new design simply points -the Alias name to the original name node - not to the object. -This results in a level of indirection that must be handled in -the -name resolution mechanism. - -Code and Data Size: Current core subsystem library sizes are -shown -below. These are the code and data sizes for the acpica.lib -produced by the Microsoft Visual C++ 6.0 compiler, and these -values do not include any ACPI driver or OSPM code. The debug -version of the code includes the debug output trace mechanism and -has a larger code and data size. Note that these values will -vary -depending on the efficiency of the compiler and the compiler -options used during generation. - - Previous Release - Non-Debug Version: 69.6K Code, 8.3K Data, 77.9K Total - Debug Version: 150.0K Code, 61.7K Data, 211.7K Total - Current Release: - Non-Debug Version: 70.7K Code, 8.6K Data, 79.3K Total - Debug Version: 151.7K Code, 62.4K Data, 214.1K Total - - -2) Linux - -Initialize thermal driver's timer before it is used. (Knut -Neumann) - -Allow handling negative celsius values. (Kochi Takayoshi) - -Fix thermal management and make trip points. R/W (Pavel Machek) - -Fix /proc/acpi/sleep. (P. Christeas) - -IA64 fixes. (David Mosberger) - -Fix reversed logic in blacklist code. (Sergio Monteiro Basto) - -Replace ACPI_DEBUG define with ACPI_DEBUG_OUTPUT. (Dominik -Brodowski) - - -3) iASL Compiler/Disassembler - -Clarified some warning/error messages. - - ----------------------------------------- -18 September 2002. Summary of changes for this release. - - -1) ACPI CA Core Subsystem version 20020918: - -Fixed a reported problem with reference chaining (via the Index() -and RefOf() operators) in the ObjectType() and SizeOf() -operators. -The definition of these operators includes the dereferencing of -all chained references to return information on the base object. - -Fixed a problem with stores to indexed package elements - the -existing code would not complete the store if an "implicit -conversion" was not performed. In other words, if the existing -object (package element) was to be replaced completely, the code -didn't handle this case. - -Relaxed typechecking on the ASL "Scope" operator to allow the -target name to refer to an object of type Integer, String, or -Buffer, in addition to the scoping object types (Device, -predefined Scopes, Processor, PowerResource, and ThermalZone.) -This allows existing AML code that has workarounds for a bug in -Windows to function properly. A warning is issued, however. -This -affects both the AML interpreter and the iASL compiler. Below is -an example of this type of ASL code: - - Name(DEB,0x00) - Scope(DEB) - { - -Fixed some reported problems with 64-bit integer support in the -local implementation of C library functions (clib.c) - - -2) Linux - -Use ACPI fix map region instead of IOAPIC region, since it is -undefined in non-SMP. - -Ensure that the SCI has the proper polarity and trigger, even on -systems that do not have an interrupt override entry in the MADT. - -2.5 big driver reorganization (Pat Mochel) - -Use early table mapping code from acpitable.c (Andi Kleen) - -New blacklist entries (Andi Kleen) - -Blacklist improvements. Split blacklist code out into a separate -file. Move checking the blacklist to very early. Previously, we -would use ACPI tables, and then halfway through init, check the -blacklist -- too late. Now, it's early enough to completely fall- -back to non-ACPI. - - -3) iASL Compiler/Disassembler version 20020918: - -Fixed a problem where the typechecking code didn't know that an -alias could point to a method. In other words, aliases were not -being dereferenced during typechecking. - - ----------------------------------------- -29 August 2002. Summary of changes for this release. - -1) ACPI CA Core Subsystem Version 20020829: - -If the target of a Scope() operator already exists, it must be an -object type that actually opens a scope -- such as a Device, -Method, Scope, etc. This is a fatal runtime error. Similar -error -check has been added to the iASL compiler also. - -Tightened up the namespace load to disallow multiple names in the -same scope. This previously was allowed if both objects were of -the same type. (i.e., a lookup was the same as entering a new -name). - - -2) Linux - -Ensure that the ACPI interrupt has the proper trigger and -polarity. - -local_irq_disable is extraneous. (Matthew Wilcox) - -Make "acpi=off" actually do what it says, and not use the ACPI -interpreter *or* the tables. - -Added arch-neutral support for parsing SLIT and SRAT tables -(Kochi -Takayoshi) - - -3) iASL Compiler/Disassembler Version 20020829: - -Implemented namepath optimization for name declarations. For -example, a declaration like "Method (\_SB_.ABCD)" would get -optimized to "Method (ABCD)" if the declaration is within the -\_SB_ scope. This optimization is in addition to the named -reference path optimization first released in the previous -version. This would seem to complete all possible optimizations -for namepaths within the ASL/AML. - -If the target of a Scope() operator already exists, it must be an -object type that actually opens a scope -- such as a Device, -Method, Scope, etc. - -Implemented a check and warning for unreachable code in the same -block below a Return() statement. - -Fixed a problem where the listing file was not generated if the -compiler aborted if the maximum error count was exceeded (200). - -Fixed a problem where the typechecking of method return values -was -broken. This includes the check for a return value when the -method is invoked as a TermArg (a return value is expected.) - -Fixed a reported problem where EOF conditions during a quoted -string or comment caused a fault. - - ----------------------------------------- -15 August 2002. Summary of changes for this release. - -1) ACPI CA Core Subsystem Version 20020815: - -Fixed a reported problem where a Store to a method argument that -contains a reference did not perform the indirect store -correctly. -This problem was created during the conversion to the new -reference object model - the indirect store to a method argument -code was not updated to reflect the new model. - -Reworked the ACPI mode change code to better conform to ACPI 2.0, -handle corner cases, and improve code legibility (Kochi -Takayoshi) - -Fixed a problem with the pathname parsing for the carat (^) -prefix. The heavy use of the carat operator by the new namepath -optimization in the iASL compiler uncovered a problem with the -AML -interpreter handling of this prefix. In the case where one or -more carats precede a single nameseg, the nameseg was treated as -standalone and the search rule (to root) was inadvertently -applied. This could cause both the iASL compiler and the -interpreter to find the wrong object or to miss the error that -should occur if the object does not exist at that exact pathname. - -Found and fixed the problem where the HP Pavilion DSDT would not -load. This was a relatively minor tweak to the table loading -code -(a problem caused by the unexpected encounter with a method -invocation not within a control method), but it does not solve -the -overall issue of the execution of AML code at the table level. -This investigation is still ongoing. - -Code and Data Size: Current core subsystem library sizes are -shown -below. These are the code and data sizes for the acpica.lib -produced by the Microsoft Visual C++ 6.0 compiler, and these -values do not include any ACPI driver or OSPM code. The debug -version of the code includes the debug output trace mechanism and -has a larger code and data size. Note that these values will -vary -depending on the efficiency of the compiler and the compiler -options used during generation. - - Previous Release - Non-Debug Version: 69.1K Code, 8.2K Data, 77.3K Total - Debug Version: 149.4K Code, 61.6K Data, 211.0K Total - Current Release: - Non-Debug Version: 69.6K Code, 8.3K Data, 77.9K Total - Debug Version: 150.0K Code, 61.7K Data, 211.7K Total - - -2) Linux - -Remove redundant slab.h include (Brad Hards) - -Fix several bugs in thermal.c (Herbert Nachtnebel) - -Make CONFIG_ACPI_BOOT work properly (Pavel Machek) - -Change acpi_system_suspend to use updated irq functions (Pavel -Machek) - -Export acpi_get_firmware_table (Matthew Wilcox) - -Use proper root proc entry for ACPI (Kochi Takayoshi) - -Fix early-boot table parsing (Bjorn Helgaas) - - -3) iASL Compiler/Disassembler - -Reworked the compiler options to make them more consistent and to -use two-letter options where appropriate. We were running out of -sensible letters. This may break some makefiles, so check the -current options list by invoking the compiler with no parameters. - -Completed the design and implementation of the ASL namepath -optimization option for the compiler. This option optimizes all -references to named objects to the shortest possible path. The -first attempt tries to utilize a single nameseg (4 characters) -and -the "search-to-root" algorithm used by the interpreter. If that -cannot be used (because either the name is not in the search path -or there is a conflict with another object with the same name), -the pathname is optimized using the carat prefix (usually a -shorter string than specifying the entire path from the root.) - -Implemented support to obtain the DSDT from the Windows registry -(when the disassembly option is specified with no input file). -Added this code as the implementation for AcpiOsTableOverride in -the Windows OSL. Migrated the 16-bit code (used in the AcpiDump -utility) to scan memory for the DSDT to the AcpiOsTableOverride -function in the DOS OSL to make the disassembler truly OS -independent. - -Implemented a new option to disassemble and compile in one step. -When used without an input filename, this option will grab the -DSDT from the local machine, disassemble it, and compile it in -one -step. - -Added a warning message for invalid escapes (a backslash followed -by any character other than the allowable escapes). This catches -the quoted string error "\_SB_" (which should be "\\_SB_" ). - -Also, there are numerous instances in the ACPI specification -where -this error occurs. - -Added a compiler option to disable all optimizations. This is -basically the "compatibility mode" because by using this option, -the AML code will come out exactly the same as other ASL -compilers. - -Added error messages for incorrectly ordered dependent resource -functions. This includes: missing EndDependentFn macro at end of -dependent resource list, nested dependent function macros (both -start and end), and missing StartDependentFn macro. These are -common errors that should be caught at compile time. - -Implemented _OSI support for the disassembler and compiler. _OSI -must be included in the namespace for proper disassembly (because -the disassembler must know the number of arguments.) - -Added an "optimization" message type that is optional (off by -default). This message is used for all optimizations - including -constant folding, integer optimization, and namepath -optimization. - ----------------------------------------- -25 July 2002. Summary of changes for this release. - - -1) ACPI CA Core Subsystem Version 20020725: - -The AML Disassembler has been enhanced to produce compilable ASL -code and has been integrated into the iASL compiler (see below) -as -well as the single-step disassembly for the AML debugger and the -disassembler for the AcpiDump utility. All ACPI 2.0A opcodes, -resource templates and macros are fully supported. The -disassembler has been tested on over 30 different AML files, -producing identical AML when the resulting disassembled ASL file -is recompiled with the same ASL compiler. - -Modified the Resource Manager to allow zero interrupts and zero -dma channels during the GetCurrentResources call. This was -causing problems on some platforms. - -Added the AcpiOsRedirectOutput interface to the OSL to simplify -output redirection for the AcpiOsPrintf and AcpiOsVprintf -interfaces. - -Code and Data Size: Current core subsystem library sizes are -shown -below. These are the code and data sizes for the acpica.lib -produced by the Microsoft Visual C++ 6.0 compiler, and these -values do not include any ACPI driver or OSPM code. The debug -version of the code includes the debug output trace mechanism and -has a larger code and data size. Note that these values will -vary -depending on the efficiency of the compiler and the compiler -options used during generation. - - Previous Release - Non-Debug Version: 68.7K Code, 7.4K Data, 76.1K Total - Debug Version: 142.9K Code, 58.7K Data, 201.6K Total - Current Release: - Non-Debug Version: 69.1K Code, 8.2K Data, 77.3K Total - Debug Version: 149.4K Code, 61.6K Data, 211.0K Total - - -2) Linux - -Fixed a panic in the EC driver (Dominik Brodowski) - -Implemented checksum of the R/XSDT itself during Linux table scan -(Richard Schaal) - - -3) iASL compiler - -The AML disassembler is integrated into the compiler. The "-d" -option invokes the disassembler to completely disassemble an -input AML file, producing as output a text ASL file with the -extension ".dsl" (to avoid name collisions with existing .asl -source files.) A future enhancement will allow the disassembler -to obtain the BIOS DSDT from the registry under Windows. - -Fixed a problem with the VendorShort and VendorLong resource -descriptors where an invalid AML sequence was created. - -Implemented a fix for BufferData term in the ASL parser. It was -inadvertently defined twice, allowing invalid syntax to pass and -causing reduction conflicts. - -Fixed a problem where the Ones opcode could get converted to a -value of zero if "Ones" was used where a byte, word or dword -value -was expected. The 64-bit value is now truncated to the correct -size with the correct value. - - - ----------------------------------------- -02 July 2002. Summary of changes for this release. - - -1) ACPI CA Core Subsystem Version 20020702: - -The Table Manager code has been restructured to add several new -features. Tables that are not required by the core subsystem -(other than the FADT, DSDT, FACS, PSDTs, etc.) are no longer -validated in any way and are returned from AcpiGetFirmwareTable -if -requested. The AcpiOsTableOverride interface is now called for -each table that is loaded by the subsystem in order to allow the -host to override any table it chooses. Previously, only the DSDT -could be overridden. Added one new files, tbrsdt.c and -tbgetall.c. - -Fixed a problem with the conversion of internal package objects -to -external objects (when a package is returned from a control -method.) The return buffer length was set to zero instead of the -proper length of the package object. - -Fixed a reported problem with the use of the RefOf and DeRefOf -operators when passing reference arguments to control methods. A -new type of Reference object is used internally for references -produced by the RefOf operator. - -Added additional error messages in the Resource Manager to -explain -AE_BAD_DATA errors when they occur during resource parsing. - -Split the AcpiEnableSubsystem into two primitives to enable a -finer granularity initialization sequence. These two calls -should -be called in this order: AcpiEnableSubsystem (flags), -AcpiInitializeObjects (flags). The flags parameter remains the -same. - - -2) Linux - -Updated the ACPI utilities module to understand the new style of -fully resolved package objects that are now returned from the -core -subsystem. This eliminates errors of the form: - - ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.PPB_._PRT] - acpi_utils-0430 [145] acpi_evaluate_reference: - Invalid element in package (not a device reference) - -The method evaluation utility uses the new buffer allocation -scheme instead of calling AcpiEvaluate Object twice. - -Added support for ECDT. This allows the use of the Embedded - -Controller before the namespace has been fully initialized, which -is necessary for ACPI 2.0 support, and for some laptops to -initialize properly. (Laptops using ECDT are still rare, so only -limited testing was performed of the added functionality.) - -Fixed memory leaks in the EC driver. - -Eliminated a brittle code structure in acpi_bus_init(). - -Eliminated the acpi_evaluate() helper function in utils.c. It is -no longer needed since acpi_evaluate_object can optionally -allocate memory for the return object. - -Implemented fix for keyboard hang when getting battery readings -on -some systems (Stephen White) - -PCI IRQ routing update (Dominik Brodowski) - -Fix an ifdef to allow compilation on UP with LAPIC but no IOAPIC -support - ----------------------------------------- -11 June 2002. Summary of changes for this release. - - -1) ACPI CA Core Subsystem Version 20020611: - -Fixed a reported problem where constants such as Zero and One -appearing within _PRT packages were not handled correctly within -the resource manager code. Originally reported against the ASL -compiler because the code generator now optimizes integers to -their minimal AML representation (i.e. AML constants if -possible.) -The _PRT code now handles all AML constant opcodes correctly -(Zero, One, Ones, Revision). - -Fixed a problem with the Concatenate operator in the AML -interpreter where a buffer result object was incorrectly marked -as -not fully evaluated, causing a run-time error of AE_AML_INTERNAL. - -All package sub-objects are now fully resolved before they are -returned from the external ACPI interfaces. This means that name -strings are resolved to object handles, and constant operators -(Zero, One, Ones, Revision) are resolved to Integers. - -Implemented immediate resolution of the AML Constant opcodes -(Zero, One, Ones, Revision) to Integer objects upon detection -within the AML stream. This has simplified and reduced the -generated code size of the subsystem by eliminating about 10 -switch statements for these constants (which previously were -contained in Reference objects.) The complicating issues are -that -the Zero opcode is used as a "placeholder" for unspecified -optional target operands and stores to constants are defined to -be -no-ops. - -Code and Data Size: Current core subsystem library sizes are -shown -below. These are the code and data sizes for the acpica.lib -produced by the Microsoft Visual C++ 6.0 compiler, and these -values do not include any ACPI driver or OSPM code. The debug -version of the code includes the debug output trace mechanism and -has a larger code and data size. Note that these values will -vary -depending on the efficiency of the compiler and the compiler -options used during generation. - - Previous Release - Non-Debug Version: 69.3K Code, 7.4K Data, 76.7K Total - Debug Version: 143.8K Code, 58.8K Data, 202.6K Total - Current Release: - Non-Debug Version: 68.7K Code, 7.4K Data, 76.1K Total - Debug Version: 142.9K Code, 58.7K Data, 201.6K Total - - -2) Linux - - -Added preliminary support for obtaining _TRA data for PCI root -bridges (Bjorn Helgaas). - - -3) iASL Compiler Version X2046: - -Fixed a problem where the "_DDN" reserved name was defined to be -a -control method with one argument. There are no arguments, and -_DDN does not have to be a control method. - -Fixed a problem with the Linux version of the compiler where the -source lines printed with error messages were the wrong lines. -This turned out to be the "LF versus CR/LF" difference between -Windows and Unix. This appears to be the longstanding issue -concerning listing output and error messages. - -Fixed a problem with the Linux version of compiler where opcode -names within error messages were wrong. This was caused by a -slight difference in the output of the Flex tool on Linux versus -Windows. - -Fixed a problem with the Linux compiler where the hex output -files -contained some garbage data caused by an internal buffer overrun. - - ----------------------------------------- -17 May 2002. Summary of changes for this release. - - -1) ACPI CA Core Subsystem Version 20020517: - -Implemented a workaround to an BIOS bug discovered on the HP -OmniBook where the FADT revision number and the table size are -inconsistent (ACPI 2.0 revision vs. ACPI 1.0 table size). The -new -behavior is to fallback to using only the ACPI 1.0 fields of the -FADT if the table is too small to be a ACPI 2.0 table as claimed -by the revision number. Although this is a BIOS bug, this is a -case where the workaround is simple enough and with no side -effects, so it seemed prudent to add it. A warning message is -issued, however. - -Implemented minimum size checks for the fixed-length ACPI tables -- -- the FADT and FACS, as well as consistency checks between the -revision number and the table size. - -Fixed a reported problem in the table override support where the -new table pointer was incorrectly treated as a physical address -instead of a logical address. - -Eliminated the use of the AE_AML_ERROR exception and replaced it -with more descriptive codes. - -Fixed a problem where an exception would occur if an ASL Field -was -defined with no named Field Units underneath it (used by some -index fields). - -Code and Data Size: Current core subsystem library sizes are -shown -below. These are the code and data sizes for the acpica.lib -produced by the Microsoft Visual C++ 6.0 compiler, and these -values do not include any ACPI driver or OSPM code. The debug -version of the code includes the debug output trace mechanism and -has a larger code and data size. Note that these values will -vary -depending on the efficiency of the compiler and the compiler -options used during generation. - - Previous Release - Non-Debug Version: 68.8K Code, 7.1K Data, 75.9K Total - Debug Version: 142.9K Code, 58.4K Data, 201.3K Total - Current Release: - Non-Debug Version: 69.3K Code, 7.4K Data, 76.7K Total - Debug Version: 143.8K Code, 58.8K Data, 202.6K Total - - - -2) Linux - -Much work done on ACPI init (MADT and PCI IRQ routing support). -(Paul D. and Dominik Brodowski) - -Fix PCI IRQ-related panic on boot (Sam Revitch) - -Set BM_ARB_DIS when entering a sleep state (Ducrot Bruno) - -Fix "MHz" typo (Dominik Brodowski) - -Fix RTC year 2000 issue (Dominik Brodowski) - -Preclude multiple button proc entries (Eric Brunet) - -Moved arch-specific code out of include/platform/aclinux.h - -3) iASL Compiler Version X2044: - -Implemented error checking for the string used in the EISAID -macro -(Usually used in the definition of the _HID object.) The code -now -strictly enforces the PnP format - exactly 7 characters, 3 -uppercase letters and 4 hex digits. - -If a raw string is used in the definition of the _HID object -(instead of the EISAID macro), the string must contain all -alphanumeric characters (e.g., "*PNP0011" is not allowed because -of the asterisk.) - -Implemented checking for invalid use of ACPI reserved names for -most of the name creation operators (Name, Device, Event, Mutex, -OperationRegion, PowerResource, Processor, and ThermalZone.) -Previously, this check was only performed for control methods. - -Implemented an additional check on the Name operator to emit an -error if a reserved name that must be implemented in ASL as a -control method is used. We know that a reserved name must be a -method if it is defined with input arguments. - -The warning emitted when a namespace object reference is not -found -during the cross reference phase has been changed into an error. -The "External" directive should be used for names defined in -other -modules. - - -4) Tools and Utilities - -The 16-bit tools (adump16 and aexec16) have been regenerated and -tested. - -Fixed a problem with the output of both acpidump and adump16 -where -the indentation of closing parentheses and brackets was not - -aligned properly with the parent block. - - ----------------------------------------- -03 May 2002. Summary of changes for this release. - - -1) ACPI CA Core Subsystem Version 20020503: - -Added support a new OSL interface that allows the host operating - -system software to override the DSDT found in the firmware - -AcpiOsTableOverride. With this interface, the OSL can examine -the -version of the firmware DSDT and replace it with a different one -if desired. - -Added new external interfaces for accessing ACPI registers from -device drivers and other system software - AcpiGetRegister and -AcpiSetRegister. This was simply an externalization of the -existing AcpiHwBitRegister interfaces. - -Fixed a regression introduced in the previous build where the -ASL/AML CreateField operator always returned an error, -"destination must be a NS Node". - -Extended the maximum time (before failure) to successfully enable -ACPI mode to 3 seconds. - -Code and Data Size: Current core subsystem library sizes are -shown -below. These are the code and data sizes for the acpica.lib -produced by the Microsoft Visual C++ 6.0 compiler, and these -values do not include any ACPI driver or OSPM code. The debug -version of the code includes the debug output trace mechanism and -has a larger code and data size. Note that these values will -vary -depending on the efficiency of the compiler and the compiler -options used during generation. - - Previous Release - Non-Debug Version: 68.5K Code, 7.0K Data, 75.5K Total - Debug Version: 142.4K Code, 58.3K Data, 200.7K Total - Current Release: - Non-Debug Version: 68.8K Code, 7.1K Data, 75.9K Total - Debug Version: 142.9K Code, 58.4K Data, 201.3K Total - - -2) Linux - -Enhanced ACPI init code for SMP. We are now fully MPS and $PIR- -free. While 3 out of 4 of our in-house systems work fine, the -last -one still hangs when testing the LAPIC timer. - -Renamed many files in 2.5 kernel release to omit "acpi_" from the -name. - -Added warning on boot for Presario 711FR. - -Sleep improvements (Pavel Machek) - -ACPI can now be built without CONFIG_PCI enabled. - -IA64: Fixed memory map functions (JI Lee) - - -3) iASL Compiler Version X2043: - -Added support to allow the compiler to be integrated into the MS -VC++ development environment for one-button compilation of single -files or entire projects -- with error-to-source-line mapping. - -Implemented support for compile-time constant folding for the -Type3, Type4, and Type5 opcodes first defined in the ACPI 2.0 -specification. This allows the ASL writer to use expressions -instead of Integer/Buffer/String constants in terms that must -evaluate to constants at compile time and will also simplify the -emitted AML in any such sub-expressions that can be folded -(evaluated at compile-time.) This increases the size of the -compiler significantly because a portion of the ACPI CA AML -interpreter is included within the compiler in order to pre- -evaluate constant expressions. - - -Fixed a problem with the "Unicode" ASL macro that caused the -compiler to fault. (This macro is used in conjunction with the -_STR reserved name.) - -Implemented an AML opcode optimization to use the Zero, One, and -Ones opcodes where possible to further reduce the size of integer -constants and thus reduce the overall size of the generated AML -code. - -Implemented error checking for new reserved terms for ACPI -version -2.0A. - -Implemented the -qr option to display the current list of ACPI -reserved names known to the compiler. - -Implemented the -qc option to display the current list of ASL -operators that are allowed within constant expressions and can -therefore be folded at compile time if the operands are -constants. - - -4) Documentation - -Updated the Programmer's Reference for new interfaces, data -types, -and memory allocation model options. - -Updated the iASL Compiler User Reference to apply new format and -add information about new features and options. - ----------------------------------------- -19 April 2002. Summary of changes for this release. - -1) ACPI CA Core Subsystem Version 20020419: - -The source code base for the Core Subsystem has been completely -cleaned with PC-lint (FlexLint) for both 32-bit and 64-bit -versions. The Lint option files used are included in the -/acpi/generate/lint directory. - -Implemented enhanced status/error checking across the entire -Hardware manager subsystem. Any hardware errors (reported from -the OSL) are now bubbled up and will abort a running control -method. - - -Fixed a problem where the per-ACPI-table integer width (32 or 64) -was stored only with control method nodes, causing a fault when -non-control method code was executed during table loading. The -solution implemented uses a global variable to indicate table -width across the entire ACPI subsystem. Therefore, ACPI CA does -not support mixed integer widths across different ACPI tables -(DSDT, SSDT). - -Fixed a problem where NULL extended fields (X fields) in an ACPI -2.0 ACPI FADT caused the table load to fail. Although the -existing ACPI specification is a bit fuzzy on this topic, the new -behavior is to fall back on a ACPI 1.0 field if the corresponding -ACPI 2.0 X field is zero (even though the table revision -indicates -a full ACPI 2.0 table.) The ACPI specification will be updated -to -clarify this issue. - -Fixed a problem with the SystemMemory operation region handler -where memory was always accessed byte-wise even if the AML- -specified access width was larger than a byte. This caused -problems on systems with memory-mapped I/O. Memory is now -accessed with the width specified. On systems that do not -support -non-aligned transfers, a check is made to guarantee proper -address -alignment before proceeding in order to avoid an AML-caused -alignment fault within the kernel. - - -Fixed a problem with the ExtendedIrq resource where only one byte -of the 4-byte Irq field was extracted. - -Fixed the AcpiExDigitsNeeded() procedure to support _UID. This -function was out of date and required a rewrite. - -Code and Data Size: Current core subsystem library sizes are -shown -below. These are the code and data sizes for the acpica.lib -produced by the Microsoft Visual C++ 6.0 compiler, and these -values do not include any ACPI driver or OSPM code. The debug -version of the code includes the debug output trace mechanism and -has a larger code and data size. Note that these values will -vary -depending on the efficiency of the compiler and the compiler -options used during generation. - - Previous Release - Non-Debug Version: 66.6K Code, 6.5K Data, 73.1K Total - Debug Version: 139.8K Code, 57.4K Data, 197.2K Total - Current Release: - Non-Debug Version: 68.5K Code, 7.0K Data, 75.5K Total - Debug Version: 142.4K Code, 58.3K Data, 200.7K Total - - -2) Linux - -PCI IRQ routing fixes (Dominik Brodowski) - - -3) iASL Compiler Version X2042: - -Implemented an additional compile-time error check for a field -unit whose size + minimum access width would cause a run-time -access beyond the end-of-region. Previously, only the field size -itself was checked. - -The Core subsystem and iASL compiler now share a common parse -object in preparation for compile-time evaluation of the type -3/4/5 ASL operators. - - ----------------------------------------- -Summary of changes for this release: 03_29_02 - -1) ACPI CA Core Subsystem Version 20020329: - -Implemented support for late evaluation of TermArg operands to -Buffer and Package objects. This allows complex expressions to -be -used in the declarations of these object types. - -Fixed an ACPI 1.0 compatibility issue when reading Fields. In -ACPI -1.0, if the field was larger than 32 bits, it was returned as a -buffer - otherwise it was returned as an integer. In ACPI 2.0, -the field is returned as a buffer only if the field is larger -than -64 bits. The TableRevision is now considered when making this -conversion to avoid incompatibility with existing ASL code. - -Implemented logical addressing for AcpiOsGetRootPointer. This -allows an RSDP with either a logical or physical address. With -this support, the host OS can now override all ACPI tables with -one logical RSDP. Includes implementation of "typed" pointer -support to allow a common data type for both physical and logical -pointers internally. This required a change to the -AcpiOsGetRootPointer interface. - -Implemented the use of ACPI 2.0 Generic Address Structures for -all -GPE, Fixed Event, and PM Timer I/O. This allows the use of -memory -mapped I/O for these ACPI features. - -Initialization now ignores not only non-required tables (All -tables other than the FADT, FACS, DSDT, and SSDTs), but also does -not validate the table headers of unrecognized tables. - -Fixed a problem where a notify handler could only be -installed/removed on an object of type Device. All "notify" - -objects are now supported -- Devices, Processor, Power, and -Thermal. - -Removed most verbosity from the ACPI_DB_INFO debug level. Only -critical information is returned when this debug level is -enabled. - -Code and Data Size: Current core subsystem library sizes are -shown -below. These are the code and data sizes for the acpica.lib -produced by the Microsoft Visual C++ 6.0 compiler, and these -values do not include any ACPI driver or OSPM code. The debug -version of the code includes the debug output trace mechanism and -has a larger code and data size. Note that these values will -vary -depending on the efficiency of the compiler and the compiler -options used during generation. - - Previous Release - Non-Debug Version: 65.4K Code, 6.2K Data, 71.6K Total - Debug Version: 138.0K Code, 56.6K Data, 194.6K Total - Current Release: - Non-Debug Version: 66.6K Code, 6.5K Data, 73.1K Total - Debug Version: 139.8K Code, 57.4K Data, 197.2K Total - - -2) Linux: - -The processor driver (acpi_processor.c) now fully supports ACPI -2.0-based processor performance control (e.g. Intel(R) -SpeedStep(TM) technology) Note that older laptops that only have -the Intel "applet" interface are not supported through this. The -'limit' and 'performance' interface (/proc) are fully functional. -[Note that basic policy for controlling performance state -transitions will be included in the next version of ospmd.] The -idle handler was modified to more aggressively use C2, and PIIX4 -errata handling underwent a complete overhaul (big thanks to -Dominik Brodowski). - -Added support for ACPI-PCI device binding (acpi_pci_root.c). _ADR- -based devices in the ACPI namespace are now dynamically bound -(associated) with their PCI counterparts (e.g. PCI1->01:00.0). -This allows, among other things, ACPI to resolve bus numbers for -subordinate PCI bridges. - -Enhanced PCI IRQ routing to get the proper bus number for _PRT -entries defined underneath PCI bridges. - -Added IBM 600E to bad bios list due to invalid _ADR value for -PIIX4 PCI-ISA bridge, resulting in improper PCI IRQ routing. - -In the process of adding full MADT support (e.g. IOAPIC) for IA32 -(acpi.c, mpparse.c) -- stay tuned. - -Added back visual differentiation between fixed-feature and -control-method buttons in dmesg. Buttons are also subtyped (e.g. -button/power/PWRF) to simplify button identification. - -We no longer use -Wno-unused when compiling debug. Please ignore -any "_THIS_MODULE defined but not used" messages. - -Can now shut down the system using "magic sysrq" key. - - -3) iASL Compiler version 2041: - -Fixed a problem where conversion errors for hex/octal/decimal -constants were not reported. - -Implemented a fix for the General Register template Address -field. -This field was 8 bits when it should be 64. - -Fixed a problem where errors/warnings were no longer being -emitted -within the listing output file. - -Implemented the ACPI 2.0A restriction on ACPI Table Signatures to -exactly 4 characters, alphanumeric only. - - - - ----------------------------------------- -Summary of changes for this release: 03_08_02 - - -1) ACPI CA Core Subsystem Version 20020308: - -Fixed a problem with AML Fields where the use of the "AccessAny" -keyword could cause an interpreter error due to attempting to -read -or write beyond the end of the parent Operation Region. - -Fixed a problem in the SystemMemory Operation Region handler -where -an attempt was made to map memory beyond the end of the region. -This was the root cause of the "AE_ERROR" and "AE_NO_MEMORY" -errors on some Linux systems. - -Fixed a problem where the interpreter/namespace "search to root" -algorithm was not functioning for some object types. Relaxed the -internal restriction on the search to allow upsearches for all -external object types as well as most internal types. - - -2) Linux: - -We now use safe_halt() macro versus individual calls to sti | -hlt. - -Writing to the processor limit interface should now work. "echo -1" -will increase the limit, 2 will decrease, and 0 will reset to the - -default. - - -3) ASL compiler: - -Fixed segfault on Linux version. - - ----------------------------------------- -Summary of changes for this release: 02_25_02 - -1) ACPI CA Core Subsystem: - - -Fixed a problem where the GPE bit masks were not initialized -properly, causing erratic GPE behavior. - -Implemented limited support for multiple calling conventions. -The -code can be generated with either the VPL (variable parameter -list, or "C") convention, or the FPL (fixed parameter list, or -"Pascal") convention. The core subsystem is about 3.4% smaller -when generated with FPL. - - -2) Linux - -Re-add some /proc/acpi/event functionality that was lost during -the rewrite - -Resolved issue with /proc events for fixed-feature buttons -showing -up as the system device. - -Fixed checks on C2/C3 latencies to be inclusive of maximum -values. - -Replaced AE_ERRORs in acpi_osl.c with more specific error codes. - -Changed ACPI PRT option from "pci=noacpi-routing" to "pci=noacpi" - -Fixed limit interface & usage to fix bugs with passive cooling -hysterisis. - -Restructured PRT support. - - ----------------------------------------- -Summary of changes for this label: 02_14_02 - - -1) ACPI CA Core Subsystem: - -Implemented support in AcpiLoadTable to allow loading of FACS and -FADT tables. - -Suport for the now-obsolete interim 0.71 64-bit ACPI tables has -been removed. All 64-bit platforms should be migrated to the -ACPI -2.0 tables. The actbl71.h header has been removed from the -source -tree. - -All C macros defined within the subsystem have been prefixed with -"ACPI_" to avoid collision with other system include files. - -Removed the return value for the two AcpiOsPrint interfaces, -since -it is never used and causes lint warnings for ignoring the return -value. - -Added error checking to all internal mutex acquire and release -calls. Although a failure from one of these interfaces is -probably a fatal system error, these checks will cause the -immediate abort of the currently executing method or interface. - -Fixed a problem where the AcpiSetCurrentResources interface could -fault. This was a side effect of the deployment of the new -memory -allocation model. - -Fixed a couple of problems with the Global Lock support -introduced -in the last major build. The "common" (1.0/2.0) internal FACS -was -being overwritten with the FACS signature and clobbering the -Global Lock pointer. Also, the actual firmware FACS was being -unmapped after construction of the "common" FACS, preventing -access to the actual Global Lock field within it. The "common" -internal FACS is no longer installed as an actual ACPI table; it -is used simply as a global. - -Code and Data Size: Current core subsystem library sizes are -shown -below. These are the code and data sizes for the acpica.lib -produced by the Microsoft Visual C++ 6.0 compiler, and these -values do not include any ACPI driver or OSPM code. The debug -version of the code includes the debug output trace mechanism and -has a larger code and data size. Note that these values will -vary -depending on the efficiency of the compiler and the compiler -options used during generation. - - Previous Release (02_07_01) - Non-Debug Version: 65.2K Code, 6.2K Data, 71.4K Total - Debug Version: 136.9K Code, 56.4K Data, 193.3K Total - Current Release: - Non-Debug Version: 65.4K Code, 6.2K Data, 71.6K Total - Debug Version: 138.0K Code, 56.6K Data, 194.6K Total - - -2) Linux - -Updated Linux-specific code for core macro and OSL interface -changes described above. - -Improved /proc/acpi/event. It now can be opened only once and has -proper poll functionality. - -Fixed and restructured power management (acpi_bus). - -Only create /proc "view by type" when devices of that class -exist. - -Fixed "charging/discharging" bug (and others) in acpi_battery. - -Improved thermal zone code. - - -3) ASL Compiler, version X2039: - - -Implemented the new compiler restriction on ASL String hex/octal -escapes to non-null, ASCII values. An error results if an -invalid -value is used. (This will require an ACPI 2.0 specification -change.) - -AML object labels that are output to the optional C and ASM -source -are now prefixed with both the ACPI table signature and table ID -to help guarantee uniqueness within a large BIOS project. - - ----------------------------------------- -Summary of changes for this label: 02_01_02 - -1) ACPI CA Core Subsystem: - -ACPI 2.0 support is complete in the entire Core Subsystem and the -ASL compiler. All new ACPI 2.0 operators are implemented and all -other changes for ACPI 2.0 support are complete. With -simultaneous code and data optimizations throughout the -subsystem, -ACPI 2.0 support has been implemented with almost no additional -cost in terms of code and data size. - -Implemented a new mechanism for allocation of return buffers. If -the buffer length is set to ACPI_ALLOCATE_BUFFER, the buffer will -be allocated on behalf of the caller. Consolidated all return -buffer validation and allocation to a common procedure. Return -buffers will be allocated via the primary OSL allocation -interface -since it appears that a separate pool is not needed by most -users. -If a separate pool is required for these buffers, the caller can -still use the original mechanism and pre-allocate the buffer(s). - -Implemented support for string operands within the DerefOf -operator. - -Restructured the Hardware and Event managers to be table driven, -simplifying the source code and reducing the amount of generated -code. - -Split the common read/write low-level ACPI register bitfield -procedure into a separate read and write, simplifying the code -considerably. - -Obsoleted the AcpiOsCallocate OSL interface. This interface was -used only a handful of times and didn't have enough critical mass -for a separate interface. Replaced with a common calloc -procedure -in the core. - -Fixed a reported problem with the GPE number mapping mechanism -that allows GPE1 numbers to be non-contiguous with GPE0. -Reorganized the GPE information and shrunk a large array that was -originally large enough to hold info for all possible GPEs (256) -to simply large enough to hold all GPEs up to the largest GPE -number on the machine. - -Fixed a reported problem with resource structure alignment on 64- -bit platforms. - -Changed the AcpiEnableEvent and AcpiDisableEvent external -interfaces to not require any flags for the common case of -enabling/disabling a GPE. - -Implemented support to allow a "Notify" on a Processor object. - -Most TBDs in comments within the source code have been resolved -and eliminated. - - -Fixed a problem in the interpreter where a standalone parent -prefix (^) was not handled correctly in the interpreter and -debugger. - -Removed obsolete and unnecessary GPE save/restore code. - -Implemented Field support in the ASL Load operator. This allows -a -table to be loaded from a named field, in addition to loading a -table directly from an Operation Region. - -Implemented timeout and handle support in the external Global -Lock -interfaces. - -Fixed a problem in the AcpiDump utility where pathnames were no -longer being generated correctly during the dump of named -objects. - -Modified the AML debugger to give a full display of if/while -predicates instead of just one AML opcode at a time. (The -predicate can have several nested ASL statements.) The old -method -was confusing during single stepping. - -Code and Data Size: Current core subsystem library sizes are -shown -below. These are the code and data sizes for the acpica.lib -produced by the Microsoft Visual C++ 6.0 compiler, and these -values do not include any ACPI driver or OSPM code. The debug -version of the code includes the debug output trace mechanism and -has a larger code and data size. Note that these values will -vary -depending on the efficiency of the compiler and the compiler -options used during generation. - - Previous Release (12_18_01) - Non-Debug Version: 66.1K Code, 5.5K Data, 71.6K Total - Debug Version: 138.3K Code, 55.9K Data, 194.2K Total - Current Release: - Non-Debug Version: 65.2K Code, 6.2K Data, 71.4K Total - Debug Version: 136.9K Code, 56.4K Data, 193.3K Total - -2) Linux - - Implemented fix for PIIX reverse throttling errata (Processor -driver) - -Added new Limit interface (Processor and Thermal drivers) - -New thermal policy (Thermal driver) - -Many updates to /proc - -Battery "low" event support (Battery driver) - -Supports ACPI PCI IRQ routing (PCI Link and PCI root drivers) - -IA32 - IA64 initialization unification, no longer experimental - -Menuconfig options redesigned - -3) ASL Compiler, version X2037: - -Implemented several new output features to simplify integration -of -AML code into firmware: 1) Output the AML in C source code with -labels for each named ASL object. The original ASL source -code -is interleaved as C comments. 2) Output the AML in ASM source -code -with labels and interleaved ASL source. 3) Output the AML in -raw hex table form, in either C or ASM. - -Implemented support for optional string parameters to the -LoadTable operator. - -Completed support for embedded escape sequences within string -literals. The compiler now supports all single character escapes -as well as the Octal and Hex escapes. Note: the insertion of a -null byte into a string literal (via the hex/octal escape) causes -the string to be immediately terminated. A warning is issued. - -Fixed a problem where incorrect AML was generated for the case -where an ASL namepath consists of a single parent prefix ( - -) with no trailing name segments. - -The compiler has been successfully generated with a 64-bit C -compiler. - - - - ----------------------------------------- -Summary of changes for this label: 12_18_01 - -1) Linux - -Enhanced blacklist with reason and severity fields. Any table's -signature may now be used to identify a blacklisted system. - -Call _PIC control method to inform the firmware which interrupt -model the OS is using. Turn on any disabled link devices. - -Cleaned up busmgr /proc error handling (Andreas Dilger) - - 2) ACPI CA Core Subsystem: - -Implemented ACPI 2.0 semantics for the "Break" operator (Exit -from -while loop) - -Completed implementation of the ACPI 2.0 "Continue", -"ConcatenateResTemplate", "DataTableRegion", and "LoadTable" -operators. All new ACPI 2.0 operators are now implemented in -both -the ASL compiler and the AML interpreter. The only remaining -ACPI -2.0 task is support for the String data type in the DerefOf -operator. Fixed a problem with AcquireMutex where the status -code -was lost if the caller had to actually wait for the mutex. - -Increased the maximum ASL Field size from 64K bits to 4G bits. - -Completed implementation of the external Global Lock interfaces - -- -AcpiAcquireGlobalLock and AcpiReleaseGlobalLock. The Timeout and -Handler parameters were added. - -Completed another pass at removing warnings and issues when -compiling with 64-bit compilers. The code now compiles cleanly -with the Intel 64-bit C/C++ compiler. Most notably, the pointer -add and subtract (diff) macros have changed considerably. - - -Created and deployed a new ACPI_SIZE type that is 64-bits wide on -64-bit platforms, 32-bits on all others. This type is used -wherever memory allocation and/or the C sizeof() operator is -used, -and affects the OSL memory allocation interfaces AcpiOsAllocate -and AcpiOsCallocate. - -Implemented sticky user breakpoints in the AML debugger. - -Code and Data Size: Current core subsystem library sizes are -shown -below. These are the code and data sizes for the acpica.lib -produced by the Microsoft Visual C++ 6.0 compiler, and these -values do not include any ACPI driver or OSPM code. The debug -version of the code includes the debug output trace mechanism and -has a larger code and data size. Note that these values will vary -depending on the efficiency of the compiler and the compiler -options used during generation. - - Previous Release (12_05_01) - Non-Debug Version: 64.7K Code, 5.3K Data, 70.0K Total - Debug Version: 136.2K Code, 55.6K Data, 191.8K Total - Current Release: - Non-Debug Version: 66.1K Code, 5.5K Data, 71.6K Total - Debug Version: 138.3K Code, 55.9K Data, 194.2K Total - - 3) ASL Compiler, version X2034: - -Now checks for (and generates an error if detected) the use of a -Break or Continue statement without an enclosing While statement. - - -Successfully generated the compiler with the Intel 64-bit C -compiler. - - ---------------------------------------- -Summary of changes for this label: 12_05_01 - - 1) ACPI CA Core Subsystem: - -The ACPI 2.0 CopyObject operator is fully implemented. This -operator creates a new copy of an object (and is also used to -bypass the "implicit conversion" mechanism of the Store -operator.) - -The ACPI 2.0 semantics for the SizeOf operator are fully -implemented. The change is that performing a SizeOf on a -reference object causes an automatic dereference of the object to -tha actual value before the size is evaluated. This behavior was -undefined in ACPI 1.0. - -The ACPI 2.0 semantics for the Extended IRQ resource descriptor -have been implemented. The interrupt polarity and mode are now -independently set. - -Fixed a problem where ASL Constants (Zero, One, Ones, Revision) -appearing in Package objects were not properly converted to -integers when the internal Package was converted to an external -object (via the AcpiEvaluateObject interface.) - -Fixed a problem with the namespace object deletion mechanism for -objects created by control methods. There were two parts to this -problem: 1) Objects created during the initialization phase -method -parse were not being deleted, and 2) The object owner ID -mechanism -to track objects was broken. - -Fixed a problem where the use of the ASL Scope operator within a -control method would result in an invalid opcode exception. - -Fixed a problem introduced in the previous label where the buffer -length required for the _PRT structure was not being returned -correctly. - -Code and Data Size: Current core subsystem library sizes are -shown -below. These are the code and data sizes for the acpica.lib -produced by the Microsoft Visual C++ 6.0 compiler, and these -values do not include any ACPI driver or OSPM code. The debug -version of the code includes the debug output trace mechanism and -has a larger code and data size. Note that these values will -vary -depending on the efficiency of the compiler and the compiler -options used during generation. - - Previous Release (11_20_01) - Non-Debug Version: 64.1K Code, 5.3K Data, 69.4K Total - Debug Version: 135.1K Code, 55.4K Data, 190.5K Total - - Current Release: - Non-Debug Version: 64.7K Code, 5.3K Data, 70.0K Total - Debug Version: 136.2K Code, 55.6K Data, 191.8K Total - - 2) Linux: - -Updated all files to apply cleanly against 2.4.16. - -Added basic PCI Interrupt Routing Table (PRT) support for IA32 -(acpi_pci.c), and unified the PRT code for IA32 and IA64. This -version supports both static and dyanmic PRT entries, but dynamic -entries are treated as if they were static (not yet -reconfigurable). Architecture- specific code to use this data is -absent on IA32 but should be available shortly. - -Changed the initialization sequence to start the ACPI interpreter -(acpi_init) prior to initialization of the PCI driver (pci_init) -in init/main.c. This ordering is required to support PRT and -facilitate other (future) enhancement. A side effect is that the -ACPI bus driver and certain device drivers can no longer be -loaded -as modules. - -Modified the 'make menuconfig' options to allow PCI Interrupt -Routing support to be included without the ACPI Bus and other -device drivers. - - 3) ASL Compiler, version X2033: - -Fixed some issues with the use of the new CopyObject and -DataTableRegion operators. Both are fully functional. - - ---------------------------------------- -Summary of changes for this label: 11_20_01 - - 20 November 2001. Summary of changes for this release. - - 1) ACPI CA Core Subsystem: - -Updated Index support to match ACPI 2.0 semantics. Storing a -Integer, String, or Buffer to an Index of a Buffer will store -only -the least-significant byte of the source to the Indexed buffer -byte. Multiple writes are not performed. - -Fixed a problem where the access type used in an AccessAs ASL -operator was not recorded correctly into the field object. - -Fixed a problem where ASL Event objects were created in a -signalled state. Events are now created in an unsignalled state. - -The internal object cache is now purged after table loading and -initialization to reduce the use of dynamic kernel memory -- on -the assumption that object use is greatest during the parse phase -of the entire table (versus the run-time use of individual -control -methods.) - -ACPI 2.0 variable-length packages are now fully operational. - -Code and Data Size: Code and Data optimizations have permitted -new -feature development with an actual reduction in the library size. -Current core subsystem library sizes are shown below. These are -the code and data sizes for the acpica.lib produced by the -Microsoft Visual C++ 6.0 compiler, and these values do not -include -any ACPI driver or OSPM code. The debug version of the code -includes the debug output trace mechanism and has a larger code -and data size. Note that these values will vary depending on the -efficiency of the compiler and the compiler options used during -generation. - - Previous Release (11_09_01): - Non-Debug Version: 63.7K Code, 5.2K Data, 68.9K Total - Debug Version: 134.5K Code, 55.4K Data, 189.9K Total - - Current Release: - Non-Debug Version: 64.1K Code, 5.3K Data, 69.4K Total - Debug Version: 135.1K Code, 55.4K Data, 190.5K Total - - 2) Linux: - -Enhanced the ACPI boot-time initialization code to allow the use -of Local APIC tables for processor enumeration on IA-32, and to -pave the way for a fully MPS-free boot (on SMP systems) in the -near future. This functionality replaces -arch/i386/kernel/acpitables.c, which was introduced in an earlier -2.4.15-preX release. To enable this feature you must add -"acpi_boot=on" to the kernel command line -- see the help entry -for CONFIG_ACPI_BOOT for more information. An IA-64 release is -in -the works... - -Restructured the configuration options to allow boot-time table -parsing support without inclusion of the ACPI Interpreter (and -other) code. - -NOTE: This release does not include fixes for the reported -events, -power-down, and thermal passive cooling issues (coming soon). - - 3) ASL Compiler: - -Added additional typechecking for Fields within restricted access -Operation Regions. All fields within EC and CMOS regions must be -declared with ByteAcc. All fields withing SMBus regions must be -declared with the BufferAcc access type. - -Fixed a problem where the listing file output of control methods -no longer interleaved the actual AML code with the ASL source -code. - - - - ----------------------------------------- -Summary of changes for this label: 11_09_01 - -1) ACPI CA Core Subsystem: - -Implemented ACPI 2.0-defined support for writes to fields with a -Buffer, String, or Integer source operand that is smaller than -the -target field. In these cases, the source operand is zero-extended -to fill the target field. - -Fixed a problem where a Field starting bit offset (within the -parent operation region) was calculated incorrectly if the - -alignment of the field differed from the access width. This -affected CreateWordField, CreateDwordField, CreateQwordField, and -possibly other fields that use the "AccessAny" keyword. - -Fixed a problem introduced in the 11_02_01 release where indirect -stores through method arguments did not operate correctly. - -2) Linux: - -Implemented boot-time ACPI table parsing support -(CONFIG_ACPI_BOOT) for IA32 and IA64 UP/SMP systems. This code -facilitates the use of ACPI tables (e.g. MADT, SRAT) rather than -legacy BIOS interfaces (e.g. MPS) for the configuration of system -processors, memory, and interrupts during setup_arch(). Note -that -this patch does not include the required architecture-specific -changes required to apply this information -- subsequent patches -will be posted for both IA32 and IA64 to achieve this. - -Added low-level sleep support for IA32 platforms, courtesy of Pat -Mochel. This allows IA32 systems to transition to/from various -sleeping states (e.g. S1, S3), although the lack of a centralized -driver model and power-manageable drivers will prevent its -(successful) use on most systems. - -Revamped the ACPI 'menuconfig' layout: created new "ACPI Support" -submenu, unified IA32 and IA64 options, added new "Boot using -ACPI -tables" option, etc. - -Increased the default timeout for the EC driver from 1ms to 10ms -(1000 cycles of 10us) to try to address AE_TIME errors during EC -transactions. - - ---------------------------------------- -Summary of changes for this label: 11_02_01 - -1) ACPI CA Core Subsystem: - -ACPI 2.0 Support: Implemented ACPI 2.0 64-bit Field access -(QWordAcc keyword). All ACPI 2.0 64-bit support is now -implemented. - -OSL Interfaces: Several of the OSL (AcpiOs*) interfaces required -changes to support ACPI 2.0 Qword field access. Read/Write -PciConfiguration(), Read/Write Memory(), and Read/Write Port() -now -accept an ACPI_INTEGER (64 bits) as the value parameter. Also, -the value parameter for the address space handler interface is -now -an ACPI_INTEGER. OSL implementations of these interfaces must -now -handle the case where the Width parameter is 64. - -Index Fields: Fixed a problem where unaligned bit assembly and -disassembly for IndexFields was not supported correctly. - -Index and Bank Fields: Nested Index and Bank Fields are now -supported. During field access, a check is performed to ensure -that the value written to an Index or Bank register is not out of -the range of the register. The Index (or Bank) register is -written before each access to the field data. Future support will -include allowing individual IndexFields to be wider than the -DataRegister width. - -Fields: Fixed a problem where the AML interpreter was incorrectly -attempting to write beyond the end of a Field/OpRegion. This was -a boundary case that occurred when a DWORD field was written to a -BYTE access OpRegion, forcing multiple writes and causing the -interpreter to write one datum too many. - -Fields: Fixed a problem with Field/OpRegion access where the -starting bit address of a field was incorrectly calculated if the -current access type was wider than a byte (WordAcc, DwordAcc, or -QwordAcc). - -Fields: Fixed a problem where forward references to individual -FieldUnits (individual Field names within a Field definition) -were -not resolved during the AML table load. - -Fields: Fixed a problem where forward references from a Field -definition to the parent Operation Region definition were not -resolved during the AML table load. - -Fields: Duplicate FieldUnit names within a scope are now detected -during AML table load. - -Acpi Interfaces: Fixed a problem where the AcpiGetName() -interface -returned an incorrect name for the root node. - -Code and Data Size: Code and Data optimizations have permitted -new -feature development with an actual reduction in the library size. -Current core subsystem library sizes are shown below. These are -the code and data sizes for the acpica.lib produced by the -Microsoft Visual C++ 6.0 compiler, and these values do not -include -any ACPI driver or OSPM code. The debug version of the code -includes the debug output trace mechanism and has a larger code -and data size. Note that these values will vary depending on the -efficiency of the compiler and the compiler options used during -generation. - - Previous Release (10_18_01): - Non-Debug Version: 63.9K Code, 5.1K Data, 69.0K Total - Debug Version: 136.7K Code, 57.4K Data, 194.2K Total - - Current Release: - Non-Debug Version: 63.7K Code, 5.2K Data, 68.9K Total - Debug Version: 134.5K Code, 55.4K Data, 189.9K Total - - 2) Linux: - -Improved /proc processor output (Pavel Machek) Re-added -MODULE_LICENSE("GPL") to all modules. - - 3) ASL Compiler version X2030: - -Duplicate FieldUnit names within a scope are now detected and -flagged as errors. - - 4) Documentation: - -Programmer Reference updated to reflect OSL and address space -handler interface changes described above. - ----------------------------------------- -Summary of changes for this label: 10_18_01 - -ACPI CA Core Subsystem: - -Fixed a problem with the internal object reference count -mechanism -that occasionally caused premature object deletion. This resolves -all of the outstanding problem reports where an object is deleted -in the middle of an interpreter evaluation. Although this -problem -only showed up in rather obscure cases, the solution to the -problem involved an adjustment of all reference counts involving -objects attached to namespace nodes. - -Fixed a problem with Field support in the interpreter where -writing to an aligned field whose length is an exact multiple (2 -or greater) of the field access granularity would cause an -attempt -to write beyond the end of the field. - -The top level AML opcode execution functions within the -interpreter have been renamed with a more meaningful and -consistent naming convention. The modules exmonad.c and -exdyadic.c were eliminated. New modules are exoparg1.c, -exoparg2.c, exoparg3.c, and exoparg6.c. - -Support for the ACPI 2.0 "Mid" ASL operator has been implemented. - -Fixed a problem where the AML debugger was causing some internal -objects to not be deleted during subsystem termination. - -Fixed a problem with the external AcpiEvaluateObject interface -where the subsystem would fault if the named object to be -evaluated refered to a constant such as Zero, Ones, etc. - -Fixed a problem with IndexFields and BankFields where the -subsystem would fault if the index, data, or bank registers were -not defined in the same scope as the field itself. - -Added printf format string checking for compilers that support -this feature. Corrected more than 50 instances of issues with -format specifiers within invocations of ACPI_DEBUG_PRINT -throughout the core subsystem code. - -The ASL "Revision" operator now returns the ACPI support level -implemented in the core - the value "2" since the ACPI 2.0 -support -is more than 50% implemented. - -Enhanced the output of the AML debugger "dump namespace" command -to output in a more human-readable form. - -Current core subsystem library code sizes are shown below. These - -are the code and data sizes for the acpica.lib produced by the -Microsoft Visual C++ 6.0 compiler, and these values do not -include -any ACPI driver or OSPM code. The debug version of the code -includes the full debug trace mechanism -- leading to a much - -larger code and data size. Note that these values will vary -depending on the efficiency of the compiler and the compiler -options used during generation. - - Previous Label (09_20_01): - Non-Debug Version: 65K Code, 5K Data, 70K Total - Debug Version: 138K Code, 58K Data, 196K Total - - This Label: - - Non-Debug Version: 63.9K Code, 5.1K Data, 69.0K Total - Debug Version: 136.7K Code, 57.4K Data, 194.2K Total - -Linux: - -Implemented a "Bad BIOS Blacklist" to track machines that have -known ASL/AML problems. - -Enhanced the /proc interface for the thermal zone driver and -added -support for _HOT (the critical suspend trip point). The 'info' -file now includes threshold/policy information, and allows -setting -of _SCP (cooling preference) and _TZP (polling frequency) values -to the 'info' file. Examples: "echo tzp=5 > info" sets the -polling -frequency to 5 seconds, and "echo scp=1 > info" sets the cooling -preference to the passive/quiet mode (if supported by the ASL). - -Implemented a workaround for a gcc bug that resuted in an OOPs -when loading the control method battery driver. - - ---------------------------------------- -Summary of changes for this label: 09_20_01 - - ACPI CA Core Subsystem: - -The AcpiEnableEvent and AcpiDisableEvent interfaces have been -modified to allow individual GPE levels to be flagged as wake- -enabled (i.e., these GPEs are to remain enabled when the platform -sleeps.) - -The AcpiEnterSleepState and AcpiLeaveSleepState interfaces now -support wake-enabled GPEs. This means that upon entering the -sleep state, all GPEs that are not wake-enabled are disabled. -When leaving the sleep state, these GPEs are reenabled. - -A local double-precision divide/modulo module has been added to -enhance portability to OS kernels where a 64-bit math library is -not available. The new module is "utmath.c". - -Several optimizations have been made to reduce the use of CPU -stack. Originally over 2K, the maximum stack usage is now below -2K at 1860 bytes (1.82k) - -Fixed a problem with the AcpiGetFirmwareTable interface where the -root table pointer was not mapped into a logical address -properly. - -Fixed a problem where a NULL pointer was being dereferenced in -the -interpreter code for the ASL Notify operator. - -Fixed a problem where the use of the ASL Revision operator -returned an error. This operator now returns the current version -of the ACPI CA core subsystem. - -Fixed a problem where objects passed as control method parameters -to AcpiEvaluateObject were always deleted at method termination. -However, these objects may end up being stored into the namespace -by the called method. The object reference count mechanism was -applied to these objects instead of a force delete. - -Fixed a problem where static strings or buffers (contained in the -AML code) that are declared as package elements within the ASL -code could cause a fault because the interpreter would attempt to -delete them. These objects are now marked with the "static -object" flag to prevent any attempt to delete them. - -Implemented an interpreter optimization to use operands directly -from the state object instead of extracting the operands to local -variables. This reduces stack use and code size, and improves -performance. - -The module exxface.c was eliminated as it was an unnecessary -extra -layer of code. - -Current core subsystem library code sizes are shown below. These -are the code and data sizes for the acpica.lib produced by the -Microsoft Visual C++ 6.0 compiler, and these values do not -include -any ACPI driver or OSPM code. The debug version of the code -includes the full debug trace mechanism -- leading to a much -larger code and data size. Note that these values will vary -depending on the efficiency of the compiler and the compiler -options used during generation. - - Non-Debug Version: 65K Code, 5K Data, 70K Total -(Previously 69K) Debug Version: 138K Code, 58K Data, 196K -Total (Previously 195K) - -Linux: - -Support for ACPI 2.0 64-bit integers has been added. All ACPI -Integer objects are now 64 bits wide - -All Acpi data types and structures are now in lower case. Only -Acpi macros are upper case for differentiation. - - Documentation: - -Changes to the external interfaces as described above. - - ---------------------------------------- -Summary of changes for this label: 08_31_01 - - ACPI CA Core Subsystem: - -A bug with interpreter implementation of the ASL Divide operator -was found and fixed. The implicit function return value (not the -explicit store operands) was returning the remainder instead of -the quotient. This was a longstanding bug and it fixes several -known outstanding issues on various platforms. - -The ACPI_DEBUG_PRINT and function trace entry/exit macros have -been further optimized for size. There are 700 invocations of -the -DEBUG_PRINT macro alone, so each optimization reduces the size of -the debug version of the subsystem significantly. - -A stack trace mechanism has been implemented. The maximum stack -usage is about 2K on 32-bit platforms. The debugger command -"stat -stack" will display the current maximum stack usage. - -All public symbols and global variables within the subsystem are -now prefixed with the string "Acpi". This keeps all of the -symbols grouped together in a kernel map, and avoids conflicts -with other kernel subsystems. - -Most of the internal fixed lookup tables have been moved into the -code segment via the const operator. - -Several enhancements have been made to the interpreter to both -reduce the code size and improve performance. - -Current core subsystem library code sizes are shown below. These -are the code and data sizes for the acpica.lib produced by the -Microsoft Visual C++ 6.0 compiler, and these values do not -include -any ACPI driver or OSPM code. The debug version of the code -includes the full debug trace mechanism which contains over 700 -invocations of the DEBUG_PRINT macro, 500 function entry macro -invocations, and over 900 function exit macro invocations -- -leading to a much larger code and data size. Note that these -values will vary depending on the efficiency of the compiler and -the compiler options used during generation. - - Non-Debug Version: 64K Code, 5K Data, 69K Total -Debug Version: 137K Code, 58K Data, 195K Total - - Linux: - -Implemented wbinvd() macro, pending a kernel-wide definition. - -Fixed /proc/acpi/event to handle poll() and short reads. - - ASL Compiler, version X2026: - -Fixed a problem introduced in the previous label where the AML - -code emitted for package objects produced packages with zero -length. - - ---------------------------------------- -Summary of changes for this label: 08_16_01 - -ACPI CA Core Subsystem: - -The following ACPI 2.0 ASL operators have been implemented in the -AML interpreter (These are already supported by the Intel ASL -compiler): ToDecimalString, ToHexString, ToString, ToInteger, -and -ToBuffer. Support for 64-bit AML constants is implemented in the -AML parser, debugger, and disassembler. - -The internal memory tracking mechanism (leak detection code) has -been upgraded to reduce the memory overhead (a separate tracking -block is no longer allocated for each memory allocation), and now -supports all of the internal object caches. - -The data structures and code for the internal object caches have -been coelesced and optimized so that there is a single cache and -memory list data structure and a single group of functions that -implement generic cache management. This has reduced the code -size in both the debug and release versions of the subsystem. - -The DEBUG_PRINT macro(s) have been optimized for size and -replaced -by ACPI_DEBUG_PRINT. The syntax for this macro is slightly -different, because it generates a single call to an internal -function. This results in a savings of about 90 bytes per -invocation, resulting in an overall code and data savings of -about -16% in the debug version of the subsystem. - - Linux: - -Fixed C3 disk corruption problems and re-enabled C3 on supporting -machines. - -Integrated low-level sleep code by Patrick Mochel. - -Further tweaked source code Linuxization. - -Other minor fixes. - - ASL Compiler: - -Support for ACPI 2.0 variable length packages is fixed/completed. - -Fixed a problem where the optional length parameter for the ACPI -2.0 ToString operator. - -Fixed multiple extraneous error messages when a syntax error is -detected within the declaration line of a control method. - - ---------------------------------------- -Summary of changes for this label: 07_17_01 - -ACPI CA Core Subsystem: - -Added a new interface named AcpiGetFirmwareTable to obtain any -ACPI table via the ACPI signature. The interface can be called -at -any time during kernel initialization, even before the kernel -virtual memory manager is initialized and paging is enabled. -This -allows kernel subsystems to obtain ACPI tables very early, even -before the ACPI CA subsystem is initialized. - -Fixed a problem where Fields defined with the AnyAcc attribute -could be resolved to the incorrect address under the following -conditions: 1) the field width is larger than 8 bits and 2) the -parent operation region is not defined on a DWORD boundary. - -Fixed a problem where the interpreter is not being locked during -namespace initialization (during execution of the _INI control -methods), causing an error when an attempt is made to release it -later. - -ACPI 2.0 support in the AML Interpreter has begun and will be -ongoing throughout the rest of this year. In this label, The Mod -operator is implemented. - -Added a new data type to contain full PCI addresses named -ACPI_PCI_ID. This structure contains the PCI Segment, Bus, -Device, -and Function values. - - Linux: - -Enhanced the Linux version of the source code to change most -capitalized ACPI type names to lowercase. For example, all -instances of ACPI_STATUS are changed to acpi_status. This will -result in a large diff, but the change is strictly cosmetic and -aligns the CA code closer to the Linux coding standard. - -OSL Interfaces: - -The interfaces to the PCI configuration space have been changed -to -add the PCI Segment number and to split the single 32-bit -combined -DeviceFunction field into two 16-bit fields. This was -accomplished by moving the four values that define an address in -PCI configuration space (segment, bus, device, and function) to -the new ACPI_PCI_ID structure. - -The changes to the PCI configuration space interfaces led to a -reexamination of the complete set of address space access -interfaces for PCI, I/O, and Memory. The previously existing 18 -interfaces have proven difficult to maintain (any small change -must be propagated across at least 6 interfaces) and do not -easily -allow for future expansion to 64 bits if necessary. Also, on -some -systems, it would not be appropriate to demultiplex the access -width (8, 16, 32,or 64) before calling the OSL if the -corresponding native OS interfaces contain a similar access width -parameter. For these reasons, the 18 address space interfaces -have been replaced by these 6 new ones: - -AcpiOsReadPciConfiguration -AcpiOsWritePciConfiguration -AcpiOsReadMemory -AcpiOsWriteMemory -AcpiOsReadPort -AcpiOsWritePort - -Added a new interface named AcpiOsGetRootPointer to allow the OSL -to perform the platform and/or OS-specific actions necessary to -obtain the ACPI RSDP table pointer. On IA-32 platforms, this -interface will simply call down to the CA core to perform the low- -memory search for the table. On IA-64, the RSDP is obtained from -EFI. Migrating this interface to the OSL allows the CA core to - -remain OS and platform independent. - -Added a new interface named AcpiOsSignal to provide a generic -"function code and pointer" interface for various miscellaneous -signals and notifications that must be made to the host OS. The -first such signals are intended to support the ASL Fatal and -Breakpoint operators. In the latter case, the AcpiOsBreakpoint -interface has been obsoleted. - -The definition of the AcpiFormatException interface has been -changed to simplify its use. The caller no longer must supply a -buffer to the call; A pointer to a const string is now returned -directly. This allows the call to be easily used in printf -statements, etc. since the caller does not have to manage a local -buffer. - - - ASL Compiler, Version X2025: - -The ACPI 2.0 Switch/Case/Default operators have been implemented -and are fully functional. They will work with all ACPI 1.0 -interpreters, since the operators are simply translated to -If/Else -pairs. - -The ACPI 2.0 ElseIf operator is implemented and will also work -with 1.0 interpreters, for the same reason. - -Implemented support for ACPI 2.0 variable-length packages. These -packages have a separate opcode, and their size is determined by -the interpreter at run-time. - -Documentation The ACPI CA Programmer Reference has been updated -to -reflect the new interfaces and changes to existing interfaces. - - ------------------------------------------ -Summary of changes for this label: 06_15_01 - - ACPI CA Core Subsystem: - -Fixed a problem where a DWORD-accessed field within a Buffer -object would get its byte address inadvertently rounded down to -the nearest DWORD. Buffers are always Byte-accessible. - - ASL Compiler, version X2024: - -Fixed a problem where the Switch() operator would either fault or -hang the compiler. Note however, that the AML code for this ACPI -2.0 operator is not yet implemented. - -Compiler uses the new AcpiOsGetTimer interface to obtain compile -timings. - -Implementation of the CreateField operator automatically converts -a reference to a named field within a resource descriptor from a -byte offset to a bit offset if required. - -Added some missing named fields from the resource descriptor -support. These are the names that are automatically created by -the -compiler to reference fields within a descriptor. They are only -valid at compile time and are not passed through to the AML -interpreter. - -Resource descriptor named fields are now typed as Integers and -subject to compile-time typechecking when used in expressions. - - ------------------------------------------ -Summary of changes for this label: 05_18_01 - - ACPI CA Core Subsystem: - -Fixed a couple of problems in the Field support code where bits -from adjacent fields could be returned along with the proper -field -bits. Restructured the field support code to improve performance, -readability and maintainability. - -New DEBUG_PRINTP macro automatically inserts the procedure name -into the output, saving hundreds of copies of procedure name -strings within the source, shrinking the memory footprint of the -debug version of the core subsystem. - - Source Code Structure: - -The source code directory tree was restructured to reflect the -current organization of the component architecture. Some files -and directories have been moved and/or renamed. - - Linux: - -Fixed leaking kacpidpc processes. - -Fixed queueing event data even when /proc/acpi/event is not -opened. - - ASL Compiler, version X2020: - -Memory allocation performance enhancement - over 24X compile time -improvement on large ASL files. Parse nodes and namestring -buffers are now allocated from a large internal compiler buffer. - -The temporary .SRC file is deleted unless the "-s" option is -specified - -The "-d" debug output option now sends all output to the .DBG -file -instead of the console. - -"External" second parameter is now optional - -"ElseIf" syntax now properly allows the predicate - -Last operand to "Load" now recognized as a Target operand - -Debug object can now be used anywhere as a normal object. - -ResourceTemplate now returns an object of type BUFFER - -EISAID now returns an object of type INTEGER - -"Index" now works with a STRING operand - -"LoadTable" now accepts optional parameters - -"ToString" length parameter is now optional - -"Interrupt (ResourceType," parse error fixed. - -"Register" with a user-defined region space parse error fixed - -Escaped backslash at the end of a string ("\\") scan/parse error -fixed - -"Revision" is now an object of type INTEGER. - - - ------------------------------------------- -Summary of changes for this label: 05_02_01 - -Linux: - -/proc/acpi/event now blocks properly. - -Removed /proc/sys/acpi. You can still dump your DSDT from -/proc/acpi/dsdt. - - ACPI CA Core Subsystem: - -Fixed a problem introduced in the previous label where some of -the -"small" resource descriptor types were not recognized. - -Improved error messages for the case where an ASL Field is -outside -the range of the parent operation region. - - ASL Compiler, version X2018: - - -Added error detection for ASL Fields that extend beyond the -length -of the parent operation region (only if the length of the region -is known at compile time.) This includes fields that have a -minimum access width that is smaller than the parent region, and -individual field units that are partially or entirely beyond the -extent of the parent. - - - ------------------------------------------- -Summary of changes for this label: 04_27_01 - - ACPI CA Core Subsystem: - -Fixed a problem where the namespace mutex could be released at -the -wrong time during execution of AcpiRemoveAddressSpaceHandler. - -Added optional thread ID output for debug traces, to simplify -debugging of multiple threads. Added context switch notification -when the debug code realizes that a different thread is now -executing ACPI code. - -Some additional external data types have been prefixed with the -string "ACPI_" for consistency. This may effect existing code. -The data types affected are the external callback typedefs - -e.g., - -WALK_CALLBACK becomes ACPI_WALK_CALLBACK. - - Linux: - -Fixed an issue with the OSL semaphore implementation where a -thread was waking up with an error from receiving a SIGCHLD -signal. - -Linux version of ACPI CA now uses the system C library for string -manipulation routines instead of a local implementation. - -Cleaned up comments and removed TBDs. - - ASL Compiler, version X2017: - -Enhanced error detection and reporting for all file I/O -operations. - - Documentation: - -Programmer Reference updated to version 1.06. - - - ------------------------------------------- -Summary of changes for this label: 04_13_01 - - ACPI CA Core Subsystem: - -Restructured support for BufferFields and RegionFields. -BankFields support is now fully operational. All known 32-bit -limitations on field sizes have been removed. Both BufferFields -and (Operation) RegionFields are now supported by the same field -management code. - -Resource support now supports QWORD address and IO resources. The -16/32/64 bit address structures and the Extended IRQ structure -have been changed to properly handle Source Resource strings. - -A ThreadId of -1 is now used to indicate a "mutex not acquired" -condition internally and must never be returned by -AcpiOsThreadId. -This reserved value was changed from 0 since Unix systems allow a -thread ID of 0. - -Linux: - -Driver code reorganized to enhance portability - -Added a kernel configuration option to control ACPI_DEBUG - -Fixed the EC driver to honor _GLK. - -ASL Compiler, version X2016: - -Fixed support for the "FixedHw" keyword. Previously, the FixedHw -address space was set to 0, not 0x7f as it should be. - - ------------------------------------------ -Summary of changes for this label: 03_13_01 - - ACPI CA Core Subsystem: - -During ACPI initialization, the _SB_._INI method is now run if -present. - -Notify handler fix - notifies are deferred until the parent -method -completes execution. This fixes the "mutex already acquired" -issue seen occasionally. - -Part of the "implicit conversion" rules in ACPI 2.0 have been -found to cause compatibility problems with existing ASL/AML. The -convert "result-to-target-type" implementation has been removed -for stores to method Args and Locals. Source operand conversion -is still fully implemented. Possible changes to ACPI 2.0 -specification pending. - -Fix to AcpiRsCalculatePciRoutingTableLength to return correct -length. - -Fix for compiler warnings for 64-bit compiles. - - Linux: - -/proc output aligned for easier parsing. - -Release-version compile problem fixed. - -New kernel configuration options documented in Configure.help. - -IBM 600E - Fixed Sleep button may generate "Invalid <NULL> -context" message. - - OSPM: - -Power resource driver integrated with bus manager. - -Fixed kernel fault during active cooling for thermal zones. - -Source Code: - -The source code tree has been restructured. - - - ------------------------------------------- -Summary of changes for this label: 03_02_01 - - Linux OS Services Layer (OSL): - -Major revision of all Linux-specific code. - -Modularized all ACPI-specific drivers. - -Added new thermal zone and power resource drivers. - -Revamped /proc interface (new functionality is under /proc/acpi). - -New kernel configuration options. - - Linux known issues: - -New kernel configuration options not documented in Configure.help -yet. - - -Module dependencies not currently implemented. If used, they -should be loaded in this order: busmgr, power, ec, system, -processor, battery, ac_adapter, button, thermal. - -Modules will not load if CONFIG_MODVERSION is set. - -IBM 600E - entering S5 may reboot instead of shutting down. - -IBM 600E - Sleep button may generate "Invalid <NULL> context" -message. - -Some systems may fail with "execution mutex already acquired" -message. - - ACPI CA Core Subsystem: - -Added a new OSL Interface, AcpiOsGetThreadId. This was required -for the deadlock detection code. Defined to return a non-zero, -32- -bit thread ID for the currently executing thread. May be a non- -zero constant integer on single-thread systems. - -Implemented deadlock detection for internal subsystem mutexes. -We -may add conditional compilation for this code (debug only) later. - -ASL/AML Mutex object semantics are now fully supported. This -includes multiple acquires/releases by owner and support for the - -Mutex SyncLevel parameter. - -A new "Force Release" mechanism automatically frees all ASL -Mutexes that have been acquired but not released when a thread -exits the interpreter. This forces conformance to the ACPI spec -("All mutexes must be released when an invocation exits") and -prevents deadlocked ASL threads. This mechanism can be expanded -(later) to monitor other resource acquisitions if OEM ASL code -continues to misbehave (which it will). - -Several new ACPI exception codes have been added for the Mutex -support. - -Recursive method calls are now allowed and supported (the ACPI -spec does in fact allow recursive method calls.) The number of -recursive calls is subject to the restrictions imposed by the -SERIALIZED method keyword and SyncLevel (ACPI 2.0) method -parameter. - -Implemented support for the SyncLevel parameter for control -methods (ACPI 2.0 feature) - -Fixed a deadlock problem when multiple threads attempted to use -the interpreter. - -Fixed a problem where the string length of a String package -element was not always set in a package returned from -AcpiEvaluateObject. - -Fixed a problem where the length of a String package element was -not always included in the length of the overall package returned -from AcpiEvaluateObject. - -Added external interfaces (Acpi*) to the ACPI debug memory -manager. This manager keeps a list of all outstanding -allocations, and can therefore detect memory leaks and attempts -to -free memory blocks more than once. Useful for code such as the -power manager, etc. May not be appropriate for device drivers. -Performance with the debug code enabled is slow. - -The ACPI Global Lock is now an optional hardware element. - - ASL Compiler Version X2015: - -Integrated changes to allow the compiler to be generated on -multiple platforms. - -Linux makefile added to generate the compiler on Linux - - Source Code: - -All platform-specific headers have been moved to their own -subdirectory, Include/Platform. - -New source file added, Interpreter/ammutex.c - -New header file, Include/acstruct.h - - Documentation: - -The programmer reference has been updated for the following new -interfaces: AcpiOsGetThreadId AcpiAllocate AcpiCallocate AcpiFree - - ------------------------------------------ -Summary of changes for this label: 02_08_01 - -Core ACPI CA Subsystem: Fixed a problem where an error was -incorrectly returned if the return resource buffer was larger -than -the actual data (in the resource interfaces). - -References to named objects within packages are resolved to the - -full pathname string before packages are returned directly (via -the AcpiEvaluateObject interface) or indirectly via the resource -interfaces. - -Linux OS Services Layer (OSL): - -Improved /proc battery interface. - - -Added C-state debugging output and other miscellaneous fixes. - -ASL Compiler Version X2014: - -All defined method arguments can now be used as local variables, -including the ones that are not actually passed in as parameters. -The compiler tracks initialization of the arguments and issues an -exception if they are used without prior assignment (just like -locals). - -The -o option now specifies a filename prefix that is used for -all -output files, including the AML output file. Otherwise, the -default behavior is as follows: 1) the AML goes to the file -specified in the DSDT. 2) all other output files use the input -source filename as the base. - - ------------------------------------------ -Summary of changes for this label: 01_25_01 - -Core ACPI CA Subsystem: Restructured the implementation of object -store support within the interpreter. This includes support for -the Store operator as well as any ASL operators that include a -target operand. - -Partially implemented support for Implicit Result-to-Target -conversion. This is when a result object is converted on the fly -to the type of an existing target object. Completion of this -support is pending further analysis of the ACPI specification -concerning this matter. - -CPU-specific code has been removed from the subsystem (hardware -directory). - -New Power Management Timer functions added - -Linux OS Services Layer (OSL): Moved system state transition code -to the core, fixed it, and modified Linux OSL accordingly. - -Fixed C2 and C3 latency calculations. - - -We no longer use the compilation date for the version message on -initialization, but retrieve the version from -AcpiGetSystemInfo(). - -Incorporated for fix Sony VAIO machines. - -Documentation: The Programmer Reference has been updated and -reformatted. - - -ASL Compiler: Version X2013: Fixed a problem where the line -numbering and error reporting could get out of sync in the -presence of multiple include files. - - ------------------------------------------ -Summary of changes for this label: 01_15_01 - -Core ACPI CA Subsystem: - -Implemented support for type conversions in the execution of the -ASL Concatenate operator (The second operand is converted to -match the type of the first operand before concatenation.) - -Support for implicit source operand conversion is partially -implemented. The ASL source operand types Integer, Buffer, and -String are freely interchangeable for most ASL operators and are -converted by the interpreter on the fly as required. Implicit -Target operand conversion (where the result is converted to the -target type before storing) is not yet implemented. - -Support for 32-bit and 64-bit BCD integers is implemented. - -Problem fixed where a field read on an aligned field could cause -a -read past the end of the field. - -New exception, AE_AML_NO_RETURN_VALUE, is returned when a method -does not return a value, but the caller expects one. (The ASL -compiler flags this as a warning.) - -ASL Compiler: - -Version X2011: -1. Static typechecking of all operands is implemented. This -prevents the use of invalid objects (such as using a Package -where -an Integer is required) at compile time instead of at interpreter -run-time. -2. The ASL source line is printed with ALL errors and warnings. -3. Bug fix for source EOF without final linefeed. -4. Debug option is split into a parse trace and a namespace -trace. -5. Namespace output option (-n) includes initial values for -integers and strings. -6. Parse-only option added for quick syntax checking. -7. Compiler checks for duplicate ACPI name declarations - -Version X2012: -1. Relaxed typechecking to allow interchangeability between -strings, integers, and buffers. These types are now converted by -the interpreter at runtime. -2. Compiler reports time taken by each internal subsystem in the -debug output file. - - - ------------------------------------------ -Summary of changes for this label: 12_14_00 - -ASL Compiler: - -This is the first official release of the compiler. Since the -compiler requires elements of the Core Subsystem, this label -synchronizes everything. - ------------------------------------------- -Summary of changes for this label: 12_08_00 - - -Fixed a problem where named references within the ASL definition -of both OperationRegions and CreateXXXFields did not work -properly. The symptom was an AE_AML_OPERAND_TYPE during -initialization of the region/field. This is similar (but not -related internally) to the problem that was fixed in the last -label. - -Implemented both 32-bit and 64-bit support for the BCD ASL -functions ToBCD and FromBCD. - -Updated all legal headers to include "2000" in the copyright -years. - - ------------------------------------------ -Summary of changes for this label: 12_01_00 - -Fixed a problem where method invocations within the ASL -definition -of both OperationRegions and CreateXXXFields did not work -properly. The symptom was an AE_AML_OPERAND_TYPE during -initialization of the region/field: - - nsinit-0209: AE_AML_OPERAND_TYPE while getting region arguments -[DEBG] ammonad-0284: Exec_monadic2_r/Not: bad operand(s) -(0x3005) - -Fixed a problem where operators with more than one nested -subexpression would fail. The symptoms were varied, by mostly -AE_AML_OPERAND_TYPE errors. This was actually a rather serious -problem that has gone unnoticed until now. - - Subtract (Add (1,2), Multiply (3,4)) - -Fixed a problem where AcpiGetHandle didn't quite get fixed in the -previous build (The prefix part of a relative path was handled -incorrectly). - -Fixed a problem where Operation Region initialization failed if -the operation region name was a "namepath" instead of a simple -"nameseg". Symptom was an AE_NO_OPERAND error. - -Fixed a problem where an assignment to a local variable via the -indirect RefOf mechanism only worked for the first such -assignment. Subsequent assignments were ignored. - - ------------------------------------------ -Summary of changes for this label: 11_15_00 - -ACPI 2.0 table support with backwards support for ACPI 1.0 and -the -0.71 extensions. Note: although we can read ACPI 2.0 BIOS -tables, -the AML interpreter does NOT have support for the new 2.0 ASL -grammar terms at this time. - -All ACPI hardware access is via the GAS structures in the ACPI -2.0 -FADT. - -All physical memory addresses across all platforms are now 64 -bits -wide. Logical address width remains dependent on the platform -(i.e., "void *"). - -AcpiOsMapMemory interface changed to a 64-bit physical address. - -The AML interpreter integer size is now 64 bits, as per the ACPI -2.0 specification. - -For backwards compatibility with ACPI 1.0, ACPI tables with a -revision number less than 2 use 32-bit integers only. - -Fixed a problem where the evaluation of OpRegion operands did not -always resolve them to numbers properly. - ------------------------------------------- -Summary of changes for this label: 10_20_00 - -Fix for CBN_._STA issue. This fix will allow correct access to -CBN_ OpRegions when the _STA returns 0x8. - -Support to convert ACPI constants (Ones, Zeros, One) to actual -values before a package object is returned - -Fix for method call as predicate to if/while construct causing -incorrect if/while behavior - -Fix for Else block package lengths sometimes calculated wrong (if -block > 63 bytes) - -Fix for Processor object length field, was always zero - -Table load abort if FACP sanity check fails - -Fix for problem with Scope(name) if name already exists - -Warning emitted if a named object referenced cannot be found -(resolved) during method execution. - - - - - ------------------------------------------- -Summary of changes for this label: 9_29_00 - -New table initialization interfaces: AcpiInitializeSubsystem no -longer has any parameters AcpiFindRootPointer - Find the RSDP (if -necessary) AcpiLoadTables (RSDP) - load all tables found at RSDP- ->RSDT Obsolete Interfaces AcpiLoadFirmwareTables - replaced by -AcpiLoadTables - -Note: These interface changes require changes to all existing -OSDs - -The PCI_Config default address space handler is always installed -at the root namespace object. - -------------------------------------------- -Summary of changes for this label: 09_15_00 - -The new initialization architecture is implemented. New -interfaces are: AcpiInitializeSubsystem (replaces AcpiInitialize) -AcpiEnableSubsystem Obsolete Interfaces: AcpiLoadNamespace - -(Namespace is automatically loaded when a table is loaded) - -The ACPI_OPERAND_OBJECT has been optimized to shrink its size -from -52 bytes to 32 bytes. There is usually one of these for every -namespace object, so the memory savings is significant. - -Implemented just-in-time evaluation of the CreateField operators. - -Bug fixes for IA-64 support have been integrated. - -Additional code review comments have been implemented - -The so-called "third pass parse" has been replaced by a final -walk -through the namespace to initialize all operation regions -(address -spaces) and fields that have not yet been initialized during the -execution of the various _INI and REG methods. - -New file - namespace/nsinit.c - -------------------------------------------- -Summary of changes for this label: 09_01_00 - -Namespace manager data structures have been reworked to change -the -primary object from a table to a single object. This has -resulted in dynamic memory savings of 3X within the namespace -and -2X overall in the ACPI CA subsystem. - -Fixed problem where the call to AcpiEvFindPciRootBuses was -inadvertently left commented out. - -Reduced the warning count when generating the source with the GCC -compiler. - -Revision numbers added to each module header showing the -SourceSafe version of the file. Please refer to this version -number when giving us feedback or comments on individual modules. - -The main object types within the subsystem have been renamed to -clarify their purpose: - -ACPI_INTERNAL_OBJECT -> ACPI_OPERAND_OBJECT -ACPI_GENERIC_OP -> ACPI_PARSE_OBJECT -ACPI_NAME_TABLE_ENTRY -> ACPI_NAMESPACE_NODE - -NOTE: no changes to the initialization sequence are included in -this label. - -------------------------------------------- -Summary of changes for this label: 08_23_00 - -Fixed problem where TerminateControlMethod was being called -multiple times per method - -Fixed debugger problem where single stepping caused a semaphore -to -be oversignalled - -Improved performance through additional parse object caching - -added ACPI_EXTENDED_OP type - -------------------------------------------- -Summary of changes for this label: 08_10_00 - -Parser/Interpreter integration: Eliminated the creation of -complete parse trees for ACPI tables and control methods. -Instead, parse subtrees are created and then deleted as soon as -they are processed (Either entered into the namespace or -executed -by the interpreter). This reduces the use of dynamic kernel -memory significantly. (about 10X) - -Exception codes broken into classes and renumbered. Be sure to -recompile all code that includes acexcep.h. Hopefully we won't -have to renumber the codes again now that they are split into -classes (environment, programmer, AML code, ACPI table, and -internal). - -Fixed some additional alignment issues in the Resource Manager -subcomponent - -Implemented semaphore tracking in the AcpiExec utility, and fixed -several places where mutexes/semaphores were being unlocked -without a corresponding lock operation. There are no known -semaphore or mutex "leaks" at this time. - -Fixed the case where an ASL Return operator is used to return an -unnamed package. - -------------------------------------------- -Summary of changes for this label: 07_28_00 - -Fixed a problem with the way addresses were calculated in -AcpiAmlReadFieldData() and AcpiAmlWriteFieldData(). This problem -manifested itself when a Field was created with WordAccess or -DwordAccess, but the field unit defined within the Field was -less - -than a Word or Dword. - -Fixed a problem in AmlDumpOperands() module's loop to pull -operands off of the operand stack to display information. The -problem manifested itself as a TLB error on 64-bit systems when -accessing an operand stack with two or more operands. - -Fixed a problem with the PCI configuration space handlers where -context was getting confused between accesses. This required a -change to the generic address space handler and address space -setup definitions. Handlers now get both a global handler -context -(this is the one passed in by the user when executing -AcpiInstallAddressSpaceHandler() and a specific region context -that is unique to each region (For example, the _ADR, _SEG and -_BBN values associated with a specific region). The generic -function definitions have changed to the following: - -typedef ACPI_STATUS (*ADDRESS_SPACE_HANDLER) ( UINT32 Function, -UINT32 Address, UINT32 BitWidth, UINT32 *Value, void -*HandlerContext, // This used to be void *Context void -*RegionContext); // This is an additional parameter - -typedef ACPI_STATUS (*ADDRESS_SPACE_SETUP) ( ACPI_HANDLE -RegionHandle, UINT32 Function, void *HandlerContext, void -**RegionContext); // This used to be **ReturnContext - -------------------------------------------- -Summary of changes for this label: 07_21_00 - -Major file consolidation and rename. All files within the -interpreter have been renamed as well as most header files. -This -was done to prevent collisions with existing files in the host -OSs -- filenames such as "config.h" and "global.h" seem to be -quite common. The VC project files have been updated. All -makefiles will require modification. - -The parser/interpreter integration continues in Phase 5 with the -implementation of a complete 2-pass parse (the AML is parsed -twice) for each table; This avoids the construction of a huge -parse tree and therefore reduces the amount of dynamic memory -required by the subsystem. Greater use of the parse object cache -means that performance is unaffected. - -Many comments from the two code reviews have been rolled in. - -The 64-bit alignment support is complete. - -------------------------------------------- -Summary of changes for this label: 06_30_00 - -With a nod and a tip of the hat to the technology of yesteryear, -we've added support in the source code for 80 column output -devices. The code is now mostly constrained to 80 columns or -less to support environments and editors that 1) cannot display -or print more than 80 characters on a single line, and 2) cannot -disable line wrapping. - -A major restructuring of the namespace data structure has been -completed. The result is 1) cleaner and more -understandable/maintainable code, and 2) a significant reduction -in the dynamic memory requirement for each named ACPI object -(almost half). - -------------------------------------------- -Summary of changes for this label: 06_23_00 - -Linux support has been added. In order to obtain approval to get -the ACPI CA subsystem into the Linux kernel, we've had to make -quite a few changes to the base subsystem that will affect all -users (all the changes are generic and OS- independent). The -effects of these global changes have been somewhat far reaching. -Files have been merged and/or renamed and interfaces have been -renamed. The major changes are described below. - -Osd* interfaces renamed to AcpiOs* to eliminate namespace -pollution/confusion within our target kernels. All OSD -interfaces must be modified to match the new naming convention. - -Files merged across the subsystem. A number of the smaller -source -and header files have been merged to reduce the file count and -increase the density of the existing files. There are too many -to list here. In general, makefiles that call out individual -files will require rebuilding. - -Interpreter files renamed. All interpreter files now have the -prefix am* instead of ie* and is*. - -Header files renamed: The acapi.h file is now acpixf.h. The -acpiosd.h file is now acpiosxf.h. We are removing references to -the acronym "API" since it is somewhat windowsy. The new name is -"external interface" or xface or xf in the filenames.j - - -All manifest constants have been forced to upper case (some were -mixed case.) Also, the string "ACPI_" has been prepended to -many -(not all) of the constants, typedefs, and structs. - -The globals "DebugLevel" and "DebugLayer" have been renamed -"AcpiDbgLevel" and "AcpiDbgLayer" respectively. - -All other globals within the subsystem are now prefixed with -"AcpiGbl_" Internal procedures within the subsystem are now -prefixed with "Acpi" (with only a few exceptions). The original -two-letter abbreviation for the subcomponent remains after -"Acpi" -- for example, CmCallocate became AcpiCmCallocate. - -Added a source code translation/conversion utility. Used to -generate the Linux source code, it can be modified to generate -other types of source as well. Can also be used to cleanup -existing source by removing extraneous spaces and blank lines. -Found in tools/acpisrc/* - -OsdUnMapMemory was renamed to OsdUnmapMemory and then -AcpiOsUnmapMemory. (UnMap became Unmap). - -A "MaxUnits" parameter has been added to AcpiOsCreateSemaphore. -When set to one, this indicates that the caller wants to use the - -semaphore as a mutex, not a counting semaphore. ACPI CA uses -both types. However, implementers of this call may want to use -different OS primitives depending on the type of semaphore -requested. For example, some operating systems provide separate - -"mutex" and "semaphore" interfaces - where the mutex interface -is -much faster because it doesn't have all the overhead of a full -semaphore implementation. - -Fixed a deadlock problem where a method that accesses the PCI -address space can block forever if it is the first access to the -space. - -------------------------------------------- -Summary of changes for this label: 06_02_00 - -Support for environments that cannot handle unaligned data -accesses (e.g. firmware and OS environments devoid of alignment -handler technology namely SAL/EFI and the IA-64 Linux kernel) -has -been added (via configurable macros) in these three areas: - -Transfer of data from the raw AML byte stream is done via byte -moves instead of word/dword/qword moves. - External objects -are -aligned within the user buffer, including package elements (sub- -objects). - Conversion of name strings to UINT32 Acpi Names is -now -done byte-wise. - -The Store operator was modified to mimic Microsoft's -implementation when storing to a Buffer Field. - -Added a check of the BM_STS bit before entering C3. - -The methods subdirectory has been obsoleted and removed. A new -file, cmeval.c subsumes the functionality. - -A 16-bit (DOS) version of AcpiExec has been developed. The -makefile is under the acpiexec directory. diff --git a/sys/contrib/dev/acpica/acpica_prep.sh b/sys/contrib/dev/acpica/acpica_prep.sh index 353975e413e1..89691501a082 100755 --- a/sys/contrib/dev/acpica/acpica_prep.sh +++ b/sys/contrib/dev/acpica/acpica_prep.sh @@ -10,33 +10,34 @@ if [ ! $# -eq 1 ]; then fi src=$1 -wrk=./_acpi_ca_unpack -dst=./acpi_ca_destination +wrk=`realpath ./_acpi_ca_unpack` +dst=`realpath ./acpi_ca_destination` # files that should keep their full directory path -fulldirs="common compiler" +fulldirs="common compiler debugger disassembler dispatcher events \ + executer hardware include namespace parser resources tables \ + tools utilities" + # files to remove -stripdirs="generate acpisrc" -stripfiles="16bit.h Makefile README a16find.c a16utils.asm a16utils.obj \ - acdos16.h acintel.h aclinux.h acmsvc.h acnetbsd.h acpixtract.c \ - acwin.h acwin64.h aeexec.c aemain.c osdosxf.c osunixdir.c \ - oswindir.c oswinxf.c readme.txt" +stripdirs="acpisrc generate os_specific" +stripfiles="Makefile README acintel.h aclinux.h acmsvc.h acnetbsd.h \ + acos2.h acpixtract.c accygwin.h acefi.h acwin.h acwin64.h \ + aeexec.c aehandlers.c aemain.c aetables.c examples.c \ + osunixdir.c oswindir.c oswintbl.c oswinxf.c readme.txt utclib.c" + # include files to canonify -src_headers="acapps.h acconfig.h acdebug.h acdisasm.h acdispat.h \ - acenv.h acevents.h acexcep.h acfreebsd.h acgcc.h acglobal.h \ - achware.h acinterp.h aclocal.h acmacros.h acnames.h acnamesp.h \ - acobject.h acopcode.h acoutput.h acparser.h acpi.h acpiosxf.h \ - acpixf.h acresrc.h acstruct.h actables.h actbl.h actbl1.h \ - actbl2.h actypes.h acutils.h aecommon.h amlcode.h amlresrc.h" +src_headers="acapps.h accommon.h acconfig.h acdebug.h acdisasm.h \ + acdispat.h acevents.h acexcep.h acglobal.h achware.h acinterp.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" comp_headers="aslcompiler.h asldefine.h aslglobal.h asltypes.h" - -# files to update paths in -src_update_files="acpi.h acpiosxf.h" # pre-clean echo pre-clean -rm -rf ${wrk} -rm -rf ${dst} +rm -rf ${wrk} ${dst} mkdir -p ${wrk} mkdir -p ${dst} @@ -53,27 +54,18 @@ for i in ${stripfiles}; do find ${wrk} -name ${i} -type f -delete done +# copy files echo copying full dirs for i in ${fulldirs}; do find ${wrk} -name ${i} -type d | xargs -J % mv % ${dst} done - -# move files to destination -echo copying flat dirs +echo copying remaining files find ${wrk} -type f | xargs -J % mv % ${dst} -mv ${dst}/changes.txt ${dst}/CHANGES.txt - -# update src/headers for appropriate paths -echo updating paths -for i in ${src_update_files}; do - i=${dst}/$i - sed -e 's/platform\///' $i > $i.new && mv $i.new $i -done # canonify include paths for H in ${src_headers}; do find ${dst} -name "*.[chy]" -type f | \ - xargs sed -i "" -e "s|[\"<]$H[\">]|\<contrib/dev/acpica/$H\>|g" + xargs sed -i "" -e "s|[\"<]$H[\">]|\<contrib/dev/acpica/include/$H\>|g" done for H in ${comp_headers}; do find ${dst}/compiler -name "*.[chly]" -type f | \ diff --git a/sys/contrib/dev/acpica/changes.txt b/sys/contrib/dev/acpica/changes.txt new file mode 100644 index 000000000000..89f62326145a --- /dev/null +++ b/sys/contrib/dev/acpica/changes.txt @@ -0,0 +1,9235 @@ +---------------------------------------- +21 May 2009. Summary of changes for version 20090521: + +This release is available at www.acpica.org/downloads + +1) ACPI CA Core Subsystem: + +Disabled the preservation of the SCI enable bit in the PM1 control register. +The SCI enable bit (bit 0, SCI_EN) is defined by the ACPI specification to be +a "preserved" bit - "OSPM always preserves this bit position", section +4.7.3.2.1. However, some machines fail if this bit is in fact preserved +because the bit needs to be explicitly set by the OS as a workaround. No +machines fail if the bit is not preserved. Therefore, ACPICA no longer +attempts to preserve this bit. + +Fixed a problem in AcpiRsGetPciRoutingTableLength where an invalid or +incorrectly formed _PRT package could cause a fault. Added validation to +ensure that each package element is actually a sub-package. + +Implemented a new interface to install or override a single control method, +AcpiInstallMethod. This interface is useful when debugging in order to repair +an existing method or to install a missing method without having to override +the entire ACPI table. See the ACPICA Programmer Reference for use and +examples. Lin Ming, Bob Moore. + +Fixed several reference count issues with the DdbHandle object that is +created from a Load or LoadTable operator. Prevent premature deletion of the +object. Also, mark the object as invalid once the table has been unloaded. +This is needed because the handle itself may not be deleted after the table +unload, depending on whether it has been stored in a named object by the +caller. Lin Ming. + +Fixed a problem with Mutex Sync Levels. Fixed a problem where if multiple +mutexes of the same sync level are acquired but then not released in strict +opposite order, the internally maintained Current Sync Level becomes confused +and can cause subsequent execution errors. ACPICA BZ 471. + +Changed the allowable release order for ASL mutex objects. The ACPI 4.0 +specification has been changed to make the SyncLevel for mutex objects more +useful. When releasing a mutex, the SyncLevel of the mutex must now be the +same as the current sync level. This makes more sense than the previous rule +(SyncLevel less than or equal). This change updates the code to match the +specification. + +Fixed a problem with the local version of the AcpiOsPurgeCache function. The +(local) cache must be locked during all cache object deletions. Andrew +Baumann. + +Updated the Load operator to use operation region interfaces. This replaces +direct memory mapping with region access calls. Now, all region accesses go +through the installed region handler as they should. + +Simplified and optimized the NsGetNextNode function. Reduced parameter count +and reduced code for this frequently used function. + +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: 82.8K Code, 17.5K Data, 100.3K Total + Debug Version: 158.0K Code, 49.9K Data, 207.9K Total + Current Release: + Non-Debug Version: 83.4K Code, 17.5K Data, 100.9K Total + Debug Version: 158.9K Code, 50.0K Data, 208.9K Total + +2) iASL Compiler/Disassembler and Tools: + +Disassembler: Fixed some issues with DMAR, HEST, MADT tables. Some problems +with sub-table disassembly and handling invalid sub-tables. Attempt recovery +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 +mechanism. For windows compatibility, 1) On a port protection violation, +simply ignore the request and do not return an exception (allow the control +method to continue execution.) 2) If only part of the request overlaps a +protected port, read/write the individual ports that are not protected. Linux +BZ 13036. Lin Ming + +Enhanced the execution of the ASL/AML BreakPoint operator so that it actually +breaks into the AML debugger if the debugger is present. This matches the +ACPI-defined behavior. + +Fixed several possible warnings related to the use of the configurable +ACPI_THREAD_ID. This type can now be configured as either an integer or a +pointer with no warnings. Also fixes several warnings in printf-like +statements for the 64-bit build when the type is configured as a pointer. +ACPICA BZ 766, 767. + +Fixed a number of possible warnings when compiling with gcc 4+ (depending on +warning options.) Examples include printf formats, aliasing, unused globals, +missing prototypes, missing switch default statements, use of non-ANSI +library functions, use of non-ANSI constructs. See generate/unix/Makefile for +a list of warning options used with gcc 3 and 4. ACPICA BZ 735. + +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: 82.6K Code, 17.6K Data, 100.2K Total + Debug Version: 157.7K Code, 49.9K Data, 207.6K Total + Current Release: + Non-Debug Version: 82.8K Code, 17.5K Data, 100.3K Total + Debug Version: 158.0K Code, 49.9K Data, 207.9K Total + +2) iASL Compiler/Disassembler and Tools: + +iASL: Fixed a generation warning from Bison 2.3 and fixed several warnings on +the 64-bit build. + +iASL: Fixed a problem where the Unix/Linux versions of the compiler could not +correctly digest Windows/DOS formatted files (with CR/LF). + +iASL: Added a new option for "quiet mode" (-va) that produces only the +compilation summary, not individual errors and warnings. Useful for large +batch compilations. + +AcpiExec: Implemented a new option (-z) to enable a forced semaphore/mutex +timeout that can be used to detect hang conditions during execution of AML +code (includes both internal semaphores and AML-defined mutexes and events.) + +Added new makefiles for the generation of acpica in a generic unix-like +environment. These makefiles are intended to generate the acpica tools and +utilities from the original acpica git source tree structure. + +Test Suites: Updated and cleaned up the documentation files. Updated the +copyrights to 2009, affecting all source files. Use the new version of iASL +with quiet mode. Increased the number of available semaphores in the Windows +OSL, allowing the aslts to execute fully on Windows. For the Unix OSL, added +an alternate implementation of the semaphore timeout to allow aslts to +execute fully on Cygwin. + +---------------------------------------- +20 March 2009. Summary of changes for version 20090320: + +1) ACPI CA Core Subsystem: + +Fixed a possible race condition between AcpiWalkNamespace and dynamic table +unloads. Added a reader/writer locking mechanism to allow multiple concurrent +namespace walks (readers), but block a dynamic table unload until it can gain +exclusive write access to the namespace. This fixes a problem where a table +unload could (possibly catastrophically) delete the portion of the namespace +that is currently being examined by a walk. Adds a new file, utlock.c, that +implements the reader/writer lock mechanism. ACPICA BZ 749. + +Fixed a regression introduced in version 20090220 where a change to the FADT +handling could cause the ACPICA subsystem to access non-existent I/O ports. + +Modified the handling of FADT register and table (FACS/DSDT) addresses. The +FADT can contain both 32-bit and 64-bit versions of these addresses. +Previously, the 64-bit versions were favored, meaning that if both 32 and 64 +versions were valid, but not equal, the 64-bit version was used. This was +found to cause some machines to fail. Now, in this case, the 32-bit version +is used instead. This now matches the Windows behavior. + +Implemented a new mechanism to protect certain I/O ports. Provides Microsoft +compatibility and protects the standard PC I/O ports from access via AML +code. Adds a new file, hwvalid.c + +Fixed a possible extraneous warning message from the FADT support. The +message warns of a 32/64 length mismatch between the legacy and GAS +definitions for a register. + +Removed the obsolete AcpiOsValidateAddress OSL interface. This interface is +made obsolete by the port protection mechanism above. It was previously used +to validate the entire address range of an operation region, which could be +incorrect if the range included illegal ports, but fields within the +operation region did not actually access those ports. Validation is now +performed on a per-field basis instead of the entire region. + +Modified the handling of the PM1 Status Register ignored bit (bit 11.) +Ignored bits must be "preserved" according to the ACPI spec. Usually, this +means a read/modify/write when writing to the register. However, for status +registers, writing a one means clear the event. Writing a zero means preserve +the event (do not clear.) This behavior is clarified in the ACPI 4.0 spec, +and the ACPICA code now simply always writes a zero to the ignored bit. + +Modified the handling of ignored bits for the PM1 A/B Control Registers. As +per the ACPI specification, for the control registers, preserve +(read/modify/write) all bits that are defined as either reserved or ignored. + +Updated the handling of write-only bits in the PM1 A/B Control Registers. +When reading the register, zero the write-only bits as per the ACPI spec. +ACPICA BZ 443. Lin Ming. + +Removed "Linux" from the list of supported _OSI strings. Linux no longer +wants to reply true to this request. The Windows strings are the only paths +through the AML that are tested and known to work properly. + + Previous Release: + Non-Debug Version: 82.0K Code, 17.5K Data, 99.5K Total + Debug Version: 156.9K Code, 49.8K Data, 206.7K Total + Current Release: + Non-Debug Version: 82.6K Code, 17.6K Data, 100.2K Total + Debug Version: 157.7K Code, 49.9K Data, 207.6K Total + +2) iASL Compiler/Disassembler and Tools: + +Acpiexec: Split the large aeexec.c file into two new files, aehandlers.c and +aetables.c + +---------------------------------------- +20 February 2009. Summary of changes for version 20090220: + +1) ACPI CA Core Subsystem: + +Optimized the ACPI register locking. Removed locking for reads from the ACPI +bit registers in PM1 Status, Enable, Control, and PM2 Control. The lock is +not required when reading the single-bit registers. The +AcpiGetRegisterUnlocked function is no longer needed and has been removed. +This will improve performance for reads on these registers. ACPICA BZ 760. + +Fixed the parameter validation for AcpiRead/Write. Now return +AE_BAD_PARAMETER if the input register pointer is null, and AE_BAD_ADDRESS if +the register has an address of zero. Previously, these cases simply returned +AE_OK. For optional registers such as PM1B status/enable/control, the caller +should check for a valid register address before calling. ACPICA BZ 748. + +Renamed the external ACPI bit register access functions. Renamed +AcpiGetRegister and AcpiSetRegister to clarify the purpose of these +functions. The new names are AcpiReadBitRegister and AcpiWriteBitRegister. +Also, restructured the code for these functions by simplifying the code path +and condensing duplicate code to reduce code size. + +Added new functions to transparently handle the possibly split PM1 A/B +registers. AcpiHwReadMultiple and AcpiHwWriteMultiple. These two functions +now handle the split registers for PM1 Status, Enable, and Control. ACPICA BZ +746. + +Added a function to handle the PM1 control registers, AcpiHwWritePm1Control. +This function writes both of the PM1 control registers (A/B). These registers +are different than the PM1 A/B status and enable registers in that different +values can be written to the A/B registers. Most notably, the SLP_TYP bits +can be different, as per the values returned from the _Sx predefined methods. + +Removed an extra register write within AcpiHwClearAcpiStatus. This function +was writing an optional PM1B status register twice. The existing call to the +low-level AcpiHwRegisterWrite automatically handles a possibly split PM1 A/B +register. ACPICA BZ 751. + +Split out the PM1 Status registers from the FADT. Added new globals for these +registers (A/B), similar to the way the PM1 Enable registers are handled. +Instead of overloading the FADT Event Register blocks. This makes the code +clearer and less prone to error. + +Fixed the warning message for when the platform contains too many ACPI tables +for the default size of the global root table data structure. The calculation +for the truncation value was incorrect. + +Removed the ACPI_GET_OBJECT_TYPE macro. Removed all instances of this +obsolete macro, since it is now a simple reference to ->common.type. There +were about 150 invocations of the macro across 41 files. ACPICA BZ 755. + +Removed the redundant ACPI_BITREG_SLEEP_TYPE_B. This type is the same as +TYPE_A. Removed this and all related instances. Renamed SLEEP_TYPE_A to +simply SLEEP_TYPE. ACPICA BZ 754. + +Conditionally compile the AcpiSetFirmwareWakingVector64 function. This +function is only needed on 64-bit host operating systems and is thus not +included for 32-bit hosts. + +Debug output: print the input and result for invocations of the _OSI reserved +control method via the ACPI_LV_INFO debug level. Also, reduced some of the +verbosity of this debug level. Len Brown. + +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: 82.3K Code, 17.5K Data, 99.8K Total + Debug Version: 157.3K Code, 49.8K Data, 207.1K Total + Current Release: + Non-Debug Version: 82.0K Code, 17.5K Data, 99.5K Total + Debug Version: 156.9K Code, 49.8K Data, 206.7K Total + +2) iASL Compiler/Disassembler and Tools: + +Disassembler: Decode the FADT PM_Profile field. Emit ascii names for the +various legal performance profiles. + +---------------------------------------- +23 January 2009. Summary of changes for version 20090123: + +1) ACPI CA Core Subsystem: + +Added the 2009 copyright to all module headers and signons. This affects +virtually every file in the ACPICA core subsystem, the iASL compiler, and +the tools/utilities. + +Implemented a change to allow the host to override any ACPI table, including +dynamically loaded tables. Previously, only the DSDT could be replaced by the +host. With this change, the AcpiOsTableOverride interface is called for each +table found in the RSDT/XSDT during ACPICA initialization, and also whenever +a table is dynamically loaded via the AML Load operator. + +Updated FADT flag definitions, especially the Boot Architecture flags. + +Debugger: For the Find command, automatically pad the input ACPI name with +underscores if the name is shorter than 4 characters. This enables a match +with the actual namespace entry which is itself padded with underscores. + +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: 82.3K Code, 17.4K Data, 99.7K Total + Debug Version: 157.1K Code, 49.7K Data, 206.8K Total + Current Release: + Non-Debug Version: 82.3K Code, 17.5K Data, 99.8K Total + Debug Version: 157.3K Code, 49.8K Data, 207.1K Total + +2) iASL Compiler/Disassembler and Tools: + +Fix build error under Bison-2.4. + +Dissasembler: Enhanced FADT support. Added decoding of the Boot Architecture +flags. Now decode all flags, regardless of the FADT version. Flag output +includes the FADT version which first defined each flag. + +The iASL -g option now dumps the RSDT to a file (in addition to the FADT and +DSDT). Windows only. + +---------------------------------------- +04 December 2008. Summary of changes for version 20081204: + +1) ACPI CA Core Subsystem: + +The ACPICA Programmer Reference has been completely updated and revamped for +this release. This includes updates to the external interfaces, OSL +interfaces, the overview sections, and the debugger reference. + +Several new ACPICA interfaces have been implemented and documented in the +programmer reference: +AcpiReset - Writes the reset value to the FADT-defined reset register. +AcpiDisableAllGpes - Disable all available GPEs. +AcpiEnableAllRuntimeGpes - Enable all available runtime GPEs. +AcpiGetGpeDevice - Get the GPE block device associated with a GPE. +AcpiGbl_CurrentGpeCount - Tracks the current number of available GPEs. +AcpiRead - Low-level read ACPI register (was HwLowLevelRead.) +AcpiWrite - Low-level write ACPI register (was HwLowLevelWrite.) + +Most of the public ACPI hardware-related interfaces have been moved to a new +file, components/hardware/hwxface.c + +Enhanced the FADT parsing and low-level ACPI register access: The ACPI +register lengths within the FADT are now used, and the low level ACPI +register access no longer hardcodes the ACPI register lengths. Given that +there may be some risk in actually trusting the FADT register lengths, a run- +time option was added to fall back to the default hardcoded lengths if the +FADT proves to contain incorrect values - UseDefaultRegisterWidths. This +option is set to true for now, and a warning is issued if a suspicious FADT +register length is overridden with the default value. + +Fixed a reference count issue in NsRepairObject. This problem was introduced +in version 20081031 as part of a fix to repair Buffer objects within +Packages. Lin Ming. + +Added semaphore support to the Linux/Unix application OS-services layer +(OSL). ACPICA BZ 448. Lin Ming. + +Added the ACPI_MUTEX_TYPE configuration option to select whether mutexes will +be implemented in the OSL, or will binary semaphores be used instead. + +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: 81.7K Code, 17.3K Data, 99.0K Total + Debug Version: 156.4K Code, 49.4K Data, 205.8K Total + Current Release: + Non-Debug Version: 82.3K Code, 17.4K Data, 99.7K Total + Debug Version: 157.1K Code, 49.7K Data, 206.8K Total + +2) iASL Compiler/Disassembler and Tools: + +iASL: Completed the '-e' option to include additional ACPI tables in order to +aid with disassembly and External statement generation. ACPICA BZ 742. Lin +Ming. + +iASL: Removed the "named object in while loop" error. The compiler cannot +determine how many times a loop will execute. ACPICA BZ 730. + +Disassembler: Implemented support for FADT revision 2 (MS extension). ACPICA +BZ 743. + +Disassembler: Updates for several ACPI data tables (HEST, EINJ, and MCFG). + +---------------------------------------- +31 October 2008. Summary of changes for version 20081031: + +1) ACPI CA Core Subsystem: + +Restructured the ACPICA header files into public/private. acpi.h now includes +only the "public" acpica headers. All other acpica headers are "private" and +should not be included by acpica users. One new file, accommon.h is used to +include the commonly used private headers for acpica code generation. Future +plans include moving all private headers to a new subdirectory. + +Implemented an automatic Buffer->String return value conversion for +predefined ACPI methods. For these methods (such as _BIF), added automatic +conversion for return objects that are required to be a String, but a Buffer +was found instead. This can happen when reading string battery data from an +operation region, because it used to be difficult to convert the data from +buffer to string from within the ASL. Ensures that the host OS is provided +with a valid null-terminated string. Linux BZ 11822. + +Updated the FACS waking vector interfaces. Split AcpiSetFirmwareWakingVector +into two: one for the 32-bit vector, another for the 64-bit vector. This is +required because the host OS must setup the wake much differently for each +vector (real vs. protected mode, etc.) and the interface itself should not be +deciding which vector to use. Also, eliminated the GetFirmwareWakingVector +interface, as it served no purpose (only the firmware reads the vector, OS +only writes the vector.) ACPICA BZ 731. + +Implemented a mechanism to escape infinite AML While() loops. Added a loop +counter to force exit from AML While loops if the count becomes too large. +This can occur in poorly written AML when the hardware does not respond +within a while loop and the loop does not implement a timeout. The maximum +loop count is configurable. A new exception code is returned when a loop is +broken, AE_AML_INFINITE_LOOP. Alexey Starikovskiy, Bob Moore. + +Optimized the execution of AML While loops. Previously, a control state +object was allocated and freed for each execution of the loop. The +optimization is to simply reuse the control state for each iteration. This +speeds up the raw loop execution time by about 5%. + +Enhanced the implicit return mechanism. For Windows compatibility, return an +implicit integer of value zero for methods that contain no executable code. +Such methods are seen in the field as stubs (presumably), and can cause +drivers to fail if they expect a return value. Lin Ming. + +Allow multiple backslashes as root prefixes in namepaths. In a fully +qualified namepath, allow multiple backslash prefixes. This can happen (and +is seen in the field) because of the use of a double-backslash in strings +(since backslash is the escape character) causing confusion. ACPICA BZ 739 +Lin Ming. + +Emit a warning if two different FACS or DSDT tables are discovered in the +FADT. Checks if there are two valid but different addresses for the FACS and +DSDT within the FADT (mismatch between the 32-bit and 64-bit fields.) + +Consolidated the method argument count validation code. Merged the code that +validates control method argument counts into the predefined validation +module. Eliminates possible multiple warnings for incorrect argument counts. + +Implemented ACPICA example code. Includes code for ACPICA initialization, +handler installation, and calling a control method. Available at +source/tools/examples. + +Added a global pointer for FACS table to simplify internal FACS access. Use +the global pointer instead of using AcpiGetTableByIndex for each FACS access. +This simplifies the code for the Global Lock and the Firmware Waking +Vector(s). + +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: 81.2K Code, 17.0K Data, 98.2K Total + Debug Version: 155.8K Code, 49.1K Data, 204.9K Total + Current Release: + Non-Debug Version: 81.7K Code, 17.3K Data, 99.0K Total + Debug Version: 156.4K Code, 49.4K Data, 205.8K Total + +2) iASL Compiler/Disassembler and Tools: + +iASL: Improved disassembly of external method calls. Added the -e option to +allow the inclusion of additional ACPI tables to help with the disassembly of +method invocations and the generation of external declarations during the +disassembly. Certain external method invocations cannot be disassembled +properly without the actual declaration of the method. Use the -e option to +include the table where the external method(s) are actually declared. Most +useful for disassembling SSDTs that make method calls back to the master +DSDT. Lin Ming. Example: To disassemble an SSDT with calls to DSDT: iasl -d +-e dsdt.aml ssdt1.aml + +iASL: Fix to allow references to aliases within ASL namepaths. Fixes a +problem where the use of an alias within a namepath would result in a not +found error or cause the compiler to fault. Also now allows forward +references from the Alias operator itself. ACPICA BZ 738. + +---------------------------------------- +26 September 2008. Summary of changes for version 20080926: + +1) ACPI CA Core Subsystem: + +Designed and implemented a mechanism to validate predefined ACPI methods and +objects. This code validates the predefined ACPI objects (objects whose names +start with underscore) that appear in the namespace, at the time they are +evaluated. The argument count and the type of the returned object are +validated against the ACPI specification. The purpose of this validation is +to detect problems with the BIOS-implemented predefined ACPI objects before +the results are returned to the ACPI-related drivers. Future enhancements may +include actual repair of incorrect return objects where possible. Two new +files are nspredef.c and acpredef.h. + +Fixed a fault in the AML parser if a memory allocation fails during the Op +completion routine AcpiPsCompleteThisOp. Lin Ming. ACPICA BZ 492. + +Fixed an issue with implicit return compatibility. This change improves the +implicit return mechanism to be more compatible with the MS interpreter. Lin +Ming, ACPICA BZ 349. + +Implemented support for zero-length buffer-to-string conversions. Allow zero +length strings during interpreter buffer-to-string conversions. For example, +during the ToDecimalString and ToHexString operators, as well as implicit +conversions. Fiodor Suietov, ACPICA BZ 585. + +Fixed two possible memory leaks in the error exit paths of +AcpiUtUpdateObjectReference and AcpiUtWalkPackageTree. These functions are +similar in that they use a stack of state objects in order to eliminate +recursion. The stack must be fully unwound and deallocated if an error +occurs. Lin Ming. ACPICA BZ 383. + +Removed the unused ACPI_BITREG_WAKE_ENABLE definition and entry in the global +ACPI register table. This bit does not exist and is unused. Lin Ming, Bob +Moore ACPICA BZ 442. + +Removed the obsolete version number in module headers. Removed the +"$Revision" number that appeared in each module header. This version number +was useful under SourceSafe and CVS, but has no meaning under git. It is not +only incorrect, it could also be misleading. + +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: 79.7K Code, 16.4K Data, 96.1K Total + Debug Version: 153.7K Code, 48.2K Data, 201.9K Total + Current Release: + Non-Debug Version: 81.2K Code, 17.0K Data, 98.2K Total + Debug Version: 155.8K Code, 49.1K Data, 204.9K Total + +---------------------------------------- +29 August 2008. Summary of changes for version 20080829: + +1) ACPI CA Core Subsystem: + +Completed a major cleanup of the internal ACPI_OPERAND_OBJECT of type +Reference. Changes include the elimination of cheating on the Object field +for the DdbHandle subtype, addition of a reference class field to +differentiate the various reference types (instead of an AML opcode), and the +cleanup of debug output for this object. Lin Ming, Bob Moore. BZ 723 + +Reduce an error to a warning for an incorrect method argument count. +Previously aborted with an error if too few arguments were passed to a +control method via the external ACPICA interface. Now issue a warning instead +and continue. Handles the case where the method inadvertently declares too +many arguments, but does not actually use the extra ones. Applies mainly to +the predefined methods. Lin Ming. Linux BZ 11032. + +Disallow the evaluation of named object types with no intrinsic value. Return +AE_TYPE for objects that have no value and therefore evaluation is undefined: +Device, Event, Mutex, Region, Thermal, and Scope. Previously, evaluation of +these types were allowed, but an exception would be generated at some point +during the evaluation. Now, the error is generated up front. + +Fixed a possible memory leak in the AcpiNsGetExternalPathname function +(nsnames.c). Fixes a leak in the error exit path. + +Removed the obsolete debug levels ACPI_DB_WARN and ACPI_DB_ERROR. These debug +levels were made obsolete by the ACPI_WARNING, ACPI_ERROR, and ACPI_EXCEPTION +interfaces. Also added ACPI_DB_EVENTS to correspond with the existing +ACPI_LV_EVENTS. + +Removed obsolete and/or unused exception codes from the acexcep.h header. +There is the possibility that certain device drivers may be affected if they +use any of these exceptions. + +The ACPICA documentation has been added to the public git source tree, under +acpica/documents. Included are the ACPICA programmer reference, the iASL +compiler reference, and the changes.txt release logfile. + +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: 79.7K Code, 16.4K Data, 96.1K Total + Debug Version: 153.9K Code, 48.4K Data, 202.3K Total + Current Release: + Non-Debug Version: 79.7K Code, 16.4K Data, 96.1K Total + Debug Version: 153.7K Code, 48.2K Data, 201.9K Total + +2) iASL Compiler/Disassembler and Tools: + +Allow multiple argument counts for the predefined _SCP method. ACPI 3.0 +defines _SCP with 3 arguments. Previous versions defined it with only 1 +argument. iASL now allows both definitions. + +iASL/disassembler: avoid infinite loop on bad ACPI tables. Check for zero- +length subtables when disassembling ACPI tables. Also fixed a couple of +errors where a full 16-bit table type field was not extracted from the input +properly. + +acpisrc: Improve comment counting mechanism for generating source code +statistics. Count first and last lines of multi-line comments as whitespace, +not comment lines. Handle Linux legal header in addition to standard acpica +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 +AcpiHwDisableAllGpes during wake in AcpiEvGpeDispatch. This call will attempt +to acquire the GPE lock but can deadlock since the GPE lock is already held +at dispatch time. This code was introduced in version 20060831 as a response +to Linux BZ 6881 and has since been removed from Linux. + +Add a function to dereference returned reference objects. Examines the return +object from a call to AcpiEvaluateObject. Any Index or RefOf references are +automatically dereferenced in an attempt to return something useful (these +reference types cannot be converted into an external ACPI_OBJECT.) Provides +MS compatibility. Lin Ming, Bob Moore. Linux BZ 11105 + +x2APIC support: changes for MADT and SRAT ACPI tables. There are 2 new +subtables for the MADT and one new subtable for the SRAT. Includes +disassembler and AcpiSrc support. Data from the Intel 64 Architecture x2APIC +Specification, June 2008. + +Additional error checking for pathname utilities. Add error check after all +calls to AcpiNsGetPathnameLength. Add status return from +AcpiNsBuildExternalPath and check after all calls. Add parameter validation +to AcpiUtInitializeBuffer. Reported by and initial patch by Ingo Molnar. + +Return status from the global init function AcpiUtGlobalInitialize. This is +used by both the kernel subsystem and the utilities such as iASL compiler. +The function could possibly fail when the caches are initialized. Yang Yi. + +Add a function to decode reference object types to strings. Created for +improved error messages. + +Improve object conversion error messages. Better error messages during object +conversion from internal to the external ACPI_OBJECT. Used for external calls +to AcpiEvaluateObject. + +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: 79.6K Code, 16.2K Data, 95.8K Total + Debug Version: 153.5K Code, 48.2K Data, 201.7K Total + Current Release: + Non-Debug Version: 79.7K Code, 16.4K Data, 96.1K Total + Debug Version: 153.9K Code, 48.4K Data, 202.3K Total + +2) iASL Compiler/Disassembler and Tools: + +Debugger: fix a possible hang when evaluating non-methods. Fixes a problem +introduced in version 20080701. If the object being evaluated (via execute +command) is not a method, the debugger can hang while trying to obtain non- +existent parameters. + +iASL: relax error for using reserved "_T_x" identifiers. These names can +appear in a disassembled ASL file if they were emitted by the original +compiler. Instead of issuing an error or warning and forcing the user to +manually change these names, issue a remark instead. + +iASL: error if named object created in while loop. Emit an error if any named +object is created within a While loop. If allowed, this code will generate a +run-time error on the second iteration of the loop when an attempt is made to +create the same named object twice. ACPICA bugzilla 730. + +iASL: Support absolute pathnames for include files. Add support for absolute +pathnames within the Include operator. previously, only relative pathnames +were supported. + +iASL: Enforce minimum 1 interrupt in interrupt macro and Resource Descriptor. +The ACPI spec requires one interrupt minimum. BZ 423 + +iASL: Handle a missing ResourceSource arg, with a present SourceIndex. +Handles the case for the Interrupt Resource Descriptor where +the ResourceSource argument is omitted but ResourceSourceIndex +is present. Now leave room for the Index. BZ 426 + +iASL: Prevent error message if CondRefOf target does not exist. Fixes cases +where an error message is emitted if the target does not exist. BZ 516 + +iASL: Fix broken -g option (get Windows ACPI tables). Fixes the -g option +(get ACPI tables on Windows). This was apparently broken in version 20070919. + +AcpiXtract: Handle EOF while extracting data. Correctly handle the case where +the EOF happens immediately after the last table in the input file. Print +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 +source tree. + +1) ACPI CA Core Subsystem: + +Implemented a "careful" GPE disable in AcpiEvDisableGpe, only modify one +enable bit. Now performs a read-change-write of the enable register instead +of simply writing out the cached enable mask. This will prevent inadvertent +enabling of GPEs if a rogue GPE is received during initialization (before GPE +handlers are installed.) + +Implemented a copy for dynamically loaded tables. Previously, dynamically +loaded tables were simply mapped - but on some machines this memory is +corrupted after suspend. Now copy the table to a local buffer. For the +OpRegion case, added checksum verify. Use the table length from the table +header, not the region length. For the Buffer case, use the table length +also. Dennis Noordsij, Bob Moore. BZ 10734 + +Fixed a problem where the same ACPI table could not be dynamically loaded and +unloaded more than once. Without this change, a table cannot be loaded again +once it has been loaded/unloaded one time. The current mechanism does not +unregister a table upon an unload. During a load, if the same table is found, +this no longer returns an exception. BZ 722 + +Fixed a problem where the wrong descriptor length was calculated for the +EndTag descriptor in 64-bit mode. The "minimal" descriptors such as EndTag +are calculated as 12 bytes long, but the actual length in the internal +descriptor is 16 because of the round-up to 8 on the 64-bit build. Reported +by Linn Crosetto. BZ 728 + +Fixed a possible memory leak in the Unload operator. The DdbHandle returned +by Load() did not have its reference count decremented during unload, leading +to a memory leak. Lin Ming. BZ 727 + +Fixed a possible memory leak when deleting thermal/processor objects. Any +associated notify handlers (and objects) were not being deleted. Fiodor +Suietov. BZ 506 + +Fixed the ordering of the ASCII names in the global mutex table to match the +actual mutex IDs. Used by AcpiUtGetMutexName, a function used for debug only. +Vegard Nossum. BZ 726 + +Enhanced the AcpiGetObjectInfo interface to return the number of required +arguments if the object is a control method. Added this call to the debugger +so the proper number of default arguments are passed to a method. This +prevents a warning when executing methods from AcpiExec. + +Added a check for an invalid handle in AcpiGetObjectInfo. Return +AE_BAD_PARAMETER if input handle is invalid. BZ 474 + +Fixed an extraneous warning from exconfig.c on the 64-bit build. + +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: 79.3K Code, 16.2K Data, 95.5K Total + Debug Version: 153.0K Code, 48.2K Data, 201.2K Total + Current Release: + Non-Debug Version: 79.6K Code, 16.2K Data, 95.8K Total + Debug Version: 153.5K Code, 48.2K Data, 201.7K Total + +2) iASL Compiler/Disassembler and Tools: + +iASL: Added two missing ACPI reserved names. Added _MTP and _ASZ, both +resource descriptor names. + +iASL: Detect invalid ASCII characters in input (windows version). Removed the +"-CF" flag from the flex compile, enables correct detection of non-ASCII +characters in the input. BZ 441 + +iASL: Eliminate warning when result of LoadTable is not used. Eliminate the +"result of operation not used" warning when the DDB handle returned from +LoadTable is not used. The warning is not needed. BZ 590 + +AcpiExec: Add support for dynamic table load/unload. Now calls _CFG method to +pass address of table to the AML. Added option to disable OpRegion simulation +to allow creation of an OpRegion with a real address that was passed to _CFG. +All of this allows testing of the Load and Unload operators from AcpiExec. + +Debugger: update tables command for unloaded tables. Handle unloaded tables +and use the standard table header output routine. + +---------------------------------------- +09 June 2008. Summary of changes for version 20080609: + +1) ACPI CA Core Subsystem: + +Implemented a workaround for reversed _PRT entries. A significant number of +BIOSs erroneously reverse the _PRT SourceName and the SourceIndex. This +change dynamically detects and repairs this problem. Provides compatibility +with MS ACPI. BZ 6859 + +Simplified the internal ACPI hardware interfaces to eliminate the locking +flag parameter from Register Read/Write. Added a new external interface, +AcpiGetRegisterUnlocked. + +Fixed a problem where the invocation of a GPE control method could hang. This +was a regression introduced in 20080514. The new method argument count +validation mechanism can enter an infinite loop when a GPE method is +dispatched. Problem fixed by removing the obsolete code that passed GPE block +information to the notify handler via the control method parameter pointer. + +Fixed a problem where the _SST execution status was incorrectly returned to +the caller of AcpiEnterSleepStatePrep. This was a regression introduced in +20080514. _SST is optional and a NOT_FOUND exception should never be +returned. BZ 716 + +Fixed a problem where a deleted object could be accessed from within the AML +parser. This was a regression introduced in version 20080123 as a fix for the +Unload operator. Lin Ming. BZ 10669 + +Cleaned up the debug operand dump mechanism. Eliminated unnecessary operands +and eliminated the use of a negative index in a loop. Operands are now +displayed in the correct order, not backwards. This also fixes a regression +introduced in 20080514 on 64-bit systems where the elimination of +ACPI_NATIVE_UINT caused the negative index to go large and positive. BZ 715 + +Fixed a possible memory leak in EvPciConfigRegionSetup where the error exit +path did not delete a locally allocated structure. + +Updated definitions for the DMAR and SRAT tables to synchronize with the +current specifications. Includes disassembler support. + +Fixed a problem in the mutex debug code (in utmutex.c) where an incorrect +loop termination value was used. Loop terminated on iteration early, missing +one mutex. Linn Crosetto + +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: 79.5K Code, 16.2K Data, 95.7K Total + Debug Version: 153.3K Code, 48.3K Data, 201.6K Total + Current Release: + Non-Debug Version: 79.3K Code, 16.2K Data, 95.5K Total + Debug Version: 153.0K Code, 48.2K Data, 201.2K Total + +2) iASL Compiler/Disassembler and Tools: + +Disassembler: Implemented support for EisaId() within _CID objects. Now +disassemble integer _CID objects back to EisaId invocations, including +multiple integers within _CID packages. Includes single-step support for +debugger also. + +Disassembler: Added support for DMAR and SRAT table definition changes. + +---------------------------------------- +14 May 2008. Summary of changes for version 20080514: + +1) ACPI CA Core Subsystem: + +Fixed a problem where GPEs were enabled too early during the ACPICA +initialization. This could lead to "handler not installed" errors on some +machines. Moved GPE enable until after _REG/_STA/_INI methods are run. This +ensures that all operation regions and devices throughout the namespace have +been initialized before GPEs are enabled. Alexey Starikovskiy, BZ 9916. + +Implemented a change to the enter sleep code. Moved execution of the _GTS +method to just before setting sleep enable bit. The execution was moved from +AcpiEnterSleepStatePrep to AcpiEnterSleepState. _GTS is now executed +immediately before the SLP_EN bit is set, as per the ACPI specification. +Luming Yu, BZ 1653. + +Implemented a fix to disable unknown GPEs (2nd version). Now always disable +the GPE, even if ACPICA thinks that that it is already disabled. It is +possible that the AML or some other code has enabled the GPE unbeknownst to +the ACPICA code. + +Fixed a problem with the Field operator where zero-length fields would return +an AE_AML_NO_OPERAND exception during table load. Fix enables zero-length ASL +field declarations in Field(), BankField(), and IndexField(). BZ 10606. + +Implemented a fix for the Load operator, now load the table at the namespace +root. This reverts a change introduced in version 20071019. The table is now +loaded at the namespace root even though this goes against the ACPI +specification. This provides compatibility with other ACPI implementations. +The ACPI specification will be updated to reflect this in ACPI 4.0. Lin Ming. + +Fixed a problem where ACPICA would not Load() tables with unusual signatures. +Now ignore ACPI table signature for Load() operator. Only "SSDT" is +acceptable to the ACPI spec, but tables are seen with OEMx and null sigs. +Therefore, signature validation is worthless. Apparently MS ACPI accepts such +signatures, ACPICA must be compatible. BZ 10454. + +Fixed a possible negative array index in AcpiUtValidateException. Added NULL +fields to the exception string arrays to eliminate a -1 subtraction on the +SubStatus field. + +Updated the debug tracking macros to reduce overall code and data size. +Changed ACPI_MODULE_NAME and ACPI_FUNCTION_NAME to use arrays of strings +instead of pointers to static strings. Jan Beulich and Bob Moore. + +Implemented argument count checking in control method invocation via +AcpiEvaluateObject. Now emit an error if too few arguments, warning if too +many. This applies only to extern programmatic control method execution, not +method-to-method calls within the AML. Lin Ming. + +Eliminated the ACPI_NATIVE_UINT type across all ACPICA code. This type is no +longer needed, especially with the removal of 16-bit support. It was replaced +mostly with UINT32, but also ACPI_SIZE where a type that changes 32/64 bit on +32/64-bit platforms is required. + +Added the C const qualifier for appropriate string constants -- mostly +MODULE_NAME and printf format strings. Jan Beulich. + +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: 80.0K Code, 17.4K Data, 97.4K Total + Debug Version: 159.4K Code, 64.4K Data, 223.8K Total + Current Release: + Non-Debug Version: 79.5K Code, 16.2K Data, 95.7K Total + Debug Version: 153.3K Code, 48.3K Data, 201.6K Total + +2) iASL Compiler/Disassembler and Tools: + +Implemented ACPI table revision ID validation in the disassembler. Zero is +always invalid. For DSDTs, the ID controls the interpreter integer width. 1 +means 32-bit and this is unusual. 2 or greater is 64-bit. + +---------------------------------------- +21 March 2008. Summary of changes for version 20080321: + +1) ACPI CA Core Subsystem: + +Implemented an additional change to the GPE support in order to suppress +spurious or stray GPEs. The AcpiEvDisableGpe function will now permanently +disable incoming GPEs that are neither enabled nor disabled -- meaning that +the GPE is unknown to the system. This should prevent future interrupt floods +from that GPE. BZ 6217 (Zhang Rui) + +Fixed a problem where NULL package elements were not returned to the +AcpiEvaluateObject interface correctly. The element was simply ignored +instead of returning a NULL ACPI_OBJECT package element, potentially causing +a buffer overflow and/or confusing the caller who expected a fixed number of +elements. BZ 10132 (Lin Ming, Bob Moore) + +Fixed a problem with the CreateField, CreateXXXField (Bit, Byte, Word, Dword, +Qword), Field, BankField, and IndexField operators when invoked from inside +an executing control method. In this case, these operators created namespace +nodes that were incorrectly left marked as permanent nodes instead of +temporary nodes. This could cause a problem if there is race condition +between an exiting control method and a running namespace walk. (Reported by +Linn Crosetto) + +Fixed a problem where the CreateField and CreateXXXField operators would +incorrectly allow duplicate names (the name of the field) with no exception +generated. + +Implemented several changes for Notify handling. Added support for new Notify +values (ACPI 2.0+) and improved the Notify debug output. Notify on +PowerResource objects is no longer allowed, as per the ACPI specification. +(Bob Moore, Zhang Rui) + +All Reference Objects returned via the AcpiEvaluateObject interface are now +marked as type "REFERENCE" instead of "ANY". The type ANY is now reserved for +NULL objects - either NULL package elements or unresolved named references. + +Fixed a problem where an extraneous debug message was produced for package +objects (when debugging enabled). The message "Package List length larger +than NumElements count" is now produced in the correct case, and is now an +error message rather than a debug message. Added a debug message for the +opposite case, where NumElements is larger than the Package List (the package +will be padded out with NULL elements as per the ACPI spec.) + +Implemented several improvements for the output of the ASL "Debug" object to +clarify and keep all data for a given object on one output line. + +Fixed two size calculation issues with the variable-length Start Dependent +resource descriptor. + +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: 79.7K Code, 17.3K Data, 97.0K Total + Debug Version: 158.9K Code, 64.0K Data, 222.9K Total + Current Release: + Non-Debug Version: 80.0K Code, 17.4K Data, 97.4K Total + Debug Version: 159.4K Code, 64.4K Data, 223.8K Total + +2) iASL Compiler/Disassembler and Tools: + +Fixed a problem with the use of the Switch operator where execution of the +containing method by multiple concurrent threads could cause an +AE_ALREADY_EXISTS exception. This is caused by the fact that there is no +actual Switch opcode, it must be simulated with local named temporary +variables and if/else pairs. The solution chosen was to mark any method that +uses Switch as Serialized, thus preventing multiple thread entries. BZ 469. + +---------------------------------------- +13 February 2008. Summary of changes for version 20080213: + +1) ACPI CA Core Subsystem: + +Implemented another MS compatibility design change for GPE/Notify handling. +GPEs are now cleared/enabled asynchronously to allow all pending notifies to +complete first. It is expected that the OSL will queue the enable request +behind all pending notify requests (may require changes to the local host OSL +in AcpiOsExecute). Alexey Starikovskiy. + +Fixed a problem where buffer and package objects passed as arguments to a +control method via the external AcpiEvaluateObject interface could cause an +AE_AML_INTERNAL exception depending on the order and type of operators +executed by the target control method. + +Fixed a problem where resource descriptor size optimization could cause a +problem when a _CRS resource template is passed to a _SRS method. The _SRS +resource template must use the same descriptors (with the same size) as +returned from _CRS. This change affects the following resource descriptors: +IRQ / IRQNoFlags and StartDependendentFn / StartDependentFnNoPri. (BZ 9487) + +Fixed a problem where a CopyObject to RegionField, BankField, and IndexField +objects did not perform an implicit conversion as it should. These types must +retain their initial type permanently as per the ACPI specification. However, +a CopyObject to all other object types should not perform an implicit +conversion, as per the ACPI specification. (Lin Ming, Bob Moore) BZ 388 + +Fixed a problem with the AcpiGetDevices interface where the mechanism to +match device CIDs did not examine the entire list of available CIDs, but +instead aborted on the first non-matching CID. Andrew Patterson. + +Fixed a regression introduced in version 20071114. The ACPI_HIDWORD macro was +inadvertently changed to return a 16-bit value instead of a 32-bit value, +truncating the upper dword of a 64-bit value. This macro is only used to +display debug output, so no incorrect calculations were made. Also, +reimplemented the macro so that a 64-bit shift is not performed by +inefficient compilers. + +Added missing va_end statements that should correspond with each va_start +statement. + +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: 79.5K Code, 17.2K Data, 96.7K Total + Debug Version: 159.0K Code, 63.8K Data, 222.8K Total + Current Release: + Non-Debug Version: 79.7K Code, 17.3K Data, 97.0K Total + Debug Version: 158.9K Code, 64.0K Data, 222.9K Total + +2) iASL Compiler/Disassembler and Tools: + +Implemented full disassembler support for the following new ACPI tables: +BERT, EINJ, and ERST. Implemented partial disassembler support for the +complicated HEST table. These tables support the Windows Hardware Error +Architecture (WHEA). + +---------------------------------------- +23 January 2008. Summary of changes for version 20080123: + +1) ACPI CA Core Subsystem: + +Added the 2008 copyright to all module headers and signons. This affects +virtually every file in the ACPICA core subsystem, the iASL compiler, and +the tools/utilities. + +Fixed a problem with the SizeOf operator when used with Package and Buffer +objects. These objects have deferred execution for some arguments, and the +execution is now completed before the SizeOf is executed. This problem caused +unexpected AE_PACKAGE_LIMIT errors on some systems (Lin Ming, Bob Moore) BZ +9558 + +Implemented an enhancement to the interpreter "slack mode". In the absence of +an explicit return or an implicitly returned object from the last executed +opcode, a control method will now implicitly return an integer of value 0 for +Microsoft compatibility. (Lin Ming) BZ 392 + +Fixed a problem with the Load operator where an exception was not returned in +the case where the table is already loaded. (Lin Ming) BZ 463 + +Implemented support for the use of DDBHandles as an Indexed Reference, as per +the ACPI spec. (Lin Ming) BZ 486 + +Implemented support for UserTerm (Method invocation) for the Unload operator +as per the ACPI spec. (Lin Ming) BZ 580 + +Fixed a problem with the LoadTable operator where the OemId and OemTableId +input strings could cause unexpected failures if they were shorter than the +maximum lengths allowed. (Lin Ming, Bob Moore) BZ 576 + +Implemented support for UserTerm (Method invocation) for the Unload operator +as per the ACPI spec. (Lin Ming) BZ 580 + +Implemented header file support for new ACPI tables - BERT, ERST, EINJ, HEST, +IBFT, UEFI, WDAT. Disassembler support is forthcoming. + +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: 79.3K Code, 17.2K Data, 96.5K Total + Debug Version: 158.6K Code, 63.8K Data, 222.4K Total + Current Release: + Non-Debug Version: 79.5K Code, 17.2K Data, 96.7K Total + Debug Version: 159.0K Code, 63.8K Data, 222.8K Total + +2) iASL Compiler/Disassembler and Tools: + +Implemented support in the disassembler for checksum validation on incoming +binary DSDTs and SSDTs. If incorrect, a message is displayed within the table +header dump at the start of the disassembly. + +Implemented additional debugging information in the namespace listing file +created during compilation. In addition to the namespace hierarchy, the full +pathname to each namespace object is displayed. + +Fixed a problem with the disassembler where invalid ACPI tables could cause +faults or infinite loops. + +Fixed an unexpected parse error when using the optional "parameter types" +list in a control method declaration. (Lin Ming) BZ 397 + +Fixed a problem where two External declarations with the same name did not +cause an error (Lin Ming) BZ 509 + +Implemented support for full TermArgs (adding Argx, Localx and method +invocation) for the ParameterData parameter to the LoadTable operator. (Lin +Ming) BZ 583,587 + +---------------------------------------- +19 December 2007. Summary of changes for version 20071219: + +1) ACPI CA Core Subsystem: + +Implemented full support for deferred execution for the TermArg string +arguments for DataTableRegion. This enables forward references and full +operand resolution for the three string arguments. Similar to OperationRegion +deferred argument execution.) Lin Ming. BZ 430 + +Implemented full argument resolution support for the BankValue argument to +BankField. Previously, only constants were supported, now any TermArg may be +used. Lin Ming BZ 387, 393 + +Fixed a problem with AcpiGetDevices where the search of a branch of the +device tree could be terminated prematurely. In accordance with the ACPI +specification, the search down the current branch is terminated if a device +is both not present and not functional (instead of just not present.) Yakui +Zhao. + +Fixed a problem where "unknown" GPEs could be allowed to fire repeatedly if +the underlying AML code changed the GPE enable registers. Now, any unknown +incoming GPE (no _Lxx/_Exx method and not the EC GPE) is immediately disabled +instead of simply ignored. Rui Zhang. + +Fixed a problem with Index Fields where the Index register was incorrectly +limited to a maximum of 32 bits. Now any size may be used. + +Fixed a couple memory leaks associated with "implicit return" objects when +the AML Interpreter slack mode is enabled. Lin Ming BZ 349 + +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: 79.0K Code, 17.2K Data, 96.2K Total + Debug Version: 157.9K Code, 63.6K Data, 221.5K Total + Current Release: + Non-Debug Version: 79.3K Code, 17.2K Data, 96.5K Total + Debug Version: 158.6K Code, 63.8K Data, 222.4K Total + +---------------------------------------- +14 November 2007. Summary of changes for version 20071114: + +1) ACPI CA Core Subsystem: + +Implemented event counters for each of the Fixed Events, the ACPI SCI +(interrupt) itself, and control methods executed. Named +AcpiFixedEventCount[], AcpiSciCount, and AcpiMethodCount respectively. These +should be useful for debugging and statistics. + +Implemented a new external interface, AcpiGetStatistics, to retrieve the +contents of the various event counters. Returns the current values for +AcpiSciCount, AcpiGpeCount, the AcpiFixedEventCount array, and +AcpiMethodCount. The interface can be expanded in the future if new counters +are added. Device drivers should use this interface rather than access the +counters directly. + +Fixed a problem with the FromBCD and ToBCD operators. With some compilers, +the ShortDivide function worked incorrectly, causing problems with the BCD +functions with large input values. A truncation from 64-bit to 32-bit +inadvertently occurred. Internal BZ 435. Lin Ming + +Fixed a problem with Index references passed as method arguments. References +passed as arguments to control methods were dereferenced immediately (before +control was passed to the called method). The references are now correctly +passed directly to the called method. BZ 5389. Lin Ming + +Fixed a problem with CopyObject used in conjunction with the Index operator. +The reference was incorrectly dereferenced before the copy. The reference is +now correctly copied. BZ 5391. Lin Ming + +Fixed a problem with Control Method references within Package objects. These +references are now correctly generated. This completes the package +construction overhaul that began in version 20071019. + +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: 78.8K Code, 17.2K Data, 96.0K Total + Debug Version: 157.2K Code, 63.4K Data, 220.6K Total + Current Release: + Non-Debug Version: 79.0K Code, 17.2K Data, 96.2K Total + Debug Version: 157.9K Code, 63.6K Data, 221.5K Total + + +2) iASL Compiler/Disassembler and Tools: + +The AcpiExec utility now installs handlers for all of the predefined +Operation Region types. New types supported are: PCI_Config, CMOS, and +PCIBARTarget. + +Fixed a problem with the 64-bit version of AcpiExec where the extended (64- +bit) address fields for the DSDT and FACS within the FADT were not being +used, causing truncation of the upper 32-bits of these addresses. Lin Ming +and Bob Moore + +---------------------------------------- +19 October 2007. Summary of changes for version 20071019: + +1) ACPI CA Core Subsystem: + +Fixed a problem with the Alias operator when the target of the alias is a +named ASL operator that opens a new scope -- Scope, Device, PowerResource, +Processor, and ThermalZone. In these cases, any children of the original +operator could not be accessed via the alias, potentially causing unexpected +AE_NOT_FOUND exceptions. (BZ 9067) + +Fixed a problem with the Package operator where all named references were +created as object references and left otherwise unresolved. According to the +ACPI specification, a Package can only contain Data Objects or references to +control methods. The implication is that named references to Data Objects +(Integer, Buffer, String, Package, BufferField, Field) should be resolved +immediately upon package creation. This is the approach taken with this +change. References to all other named objects (Methods, Devices, Scopes, +etc.) are all now properly created as reference objects. (BZ 5328) + +Reverted a change to Notify handling that was introduced in version +20070508. This version changed the Notify handling from asynchronous to +fully synchronous (Device driver Notify handling with respect to the Notify +ASL operator). It was found that this change caused more problems than it +solved and was removed by most users. + +Fixed a problem with the Increment and Decrement operators where the type of +the target object could be unexpectedly and incorrectly changed. (BZ 353) +Lin Ming. + +Fixed a problem with the Load and LoadTable operators where the table +location within the namespace was ignored. Instead, the table was always +loaded into the root or current scope. Lin Ming. + +Fixed a problem with the Load operator when loading a table from a buffer +object. The input buffer was prematurely zeroed and/or deleted. (BZ 577) + +Fixed a problem with the Debug object where a store of a DdbHandle reference +object to the Debug object could cause a fault. + +Added a table checksum verification for the Load operator, in the case where +the load is from a buffer. (BZ 578). + +Implemented additional parameter validation for the LoadTable operator. The +length of the input strings SignatureString, OemIdString, and OemTableId are +now checked for maximum lengths. (BZ 582) Lin Ming. + +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: 78.5K Code, 17.1K Data, 95.6K Total + Debug Version: 156.7K Code, 63.2K Data, 219.9K Total + Current Release: + Non-Debug Version: 78.8K Code, 17.2K Data, 96.0K Total + Debug Version: 157.2K Code, 63.4K Data, 220.6K Total + + +2) iASL Compiler/Disassembler: + +Fixed a problem where if a single file was specified and the file did not +exist, no error message was emitted. (Introduced with wildcard support in +version 20070917.) + +---------------------------------------- +19 September 2007. Summary of changes for version 20070919: + +1) ACPI CA Core Subsystem: + +Designed and implemented new external interfaces to install and remove +handlers for ACPI table-related events. Current events that are defined are +LOAD and UNLOAD. These interfaces allow the host to track ACPI tables as +they are dynamically loaded and unloaded. See AcpiInstallTableHandler and +AcpiRemoveTableHandler. (Lin Ming and Bob Moore) + +Fixed a problem where the use of the AcpiGbl_AllMethodsSerialized flag +(acpi_serialized option on Linux) could cause some systems to hang during +initialization. (Bob Moore) BZ 8171 + +Fixed a problem where objects of certain types (Device, ThermalZone, +Processor, PowerResource) can be not found if they are declared and +referenced from within the same control method (Lin Ming) BZ 341 + +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: 78.3K Code, 17.0K Data, 95.3K Total + Debug Version: 156.3K Code, 63.1K Data, 219.4K Total + Current Release: + Non-Debug Version: 78.5K Code, 17.1K Data, 95.6K Total + Debug Version: 156.7K Code, 63.2K Data, 219.9K Total + + +2) iASL Compiler/Disassembler: + +Implemented support to allow multiple files to be compiled/disassembled in a +single invocation. This includes command line wildcard support for both the +Windows and Unix versions of the compiler. This feature simplifies the +disassembly and compilation of multiple ACPI tables in a single directory. + +---------------------------------------- +08 May 2007. Summary of changes for version 20070508: + +1) ACPI CA Core Subsystem: + +Implemented a Microsoft compatibility design change for the handling of the +Notify AML operator. Previously, notify handlers were dispatched and +executed completely asynchronously in a deferred thread. The new design +still executes the notify handlers in a different thread, but the original +thread that executed the Notify() now waits at a synchronization point for +the notify handler to complete. Some machines depend on a synchronous Notify +operator in order to operate correctly. + +Implemented support to allow Package objects to be passed as method +arguments to the external AcpiEvaluateObject interface. Previously, this +would return the AE_NOT_IMPLEMENTED exception. This feature had not been +implemented since there were no reserved control methods that required it +until recently. + +Fixed a problem with the internal FADT conversion where ACPI 1.0 FADTs that +contained invalid non-zero values in reserved fields could cause later +failures because these fields have meaning in later revisions of the FADT. +For incoming ACPI 1.0 FADTs, these fields are now always zeroed. (The fields +are: Preferred_PM_Profile, PSTATE_CNT, CST_CNT, and IAPC_BOOT_FLAGS.) + +Fixed a problem where the Global Lock handle was not properly updated if a +thread that acquired the Global Lock via executing AML code then attempted +to acquire the lock via the AcpiAcquireGlobalLock interface. Reported by Joe +Liu. + +Fixed a problem in AcpiEvDeleteGpeXrupt where the global interrupt list +could be corrupted if the interrupt being removed was at the head of the +list. Reported by Linn Crosetto. + +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: 78.0K Code, 17.1K Data, 95.1K Total + Debug Version: 155.9K Code, 63.1K Data, 219.0K Total + Current Release: + Non-Debug Version: 78.3K Code, 17.0K Data, 95.3K Total + Debug Version: 156.3K Code, 63.1K Data, 219.4K Total + +---------------------------------------- +20 March 2007. Summary of changes for version 20070320: + +1) ACPI CA Core Subsystem: + +Implemented a change to the order of interpretation and evaluation of AML +operand objects within the AML interpreter. The interpreter now evaluates +operands in the order that they appear in the AML stream (and the +corresponding ASL code), instead of in the reverse order (after the entire +operand list has been parsed). The previous behavior caused several subtle +incompatibilities with the Microsoft AML interpreter as well as being +somewhat non-intuitive. BZ 7871, local BZ 263. Valery Podrezov. + +Implemented a change to the ACPI Global Lock support. All interfaces to the +global lock now allow the same thread to acquire the lock multiple times. +This affects the AcpiAcquireGlobalLock external interface to the global lock +as well as the internal use of the global lock to support AML fields -- a +control method that is holding the global lock can now simultaneously access +AML fields that require global lock protection. Previously, in both cases, +this would have resulted in an AE_ALREADY_ACQUIRED exception. The change to +AcpiAcquireGlobalLock is of special interest to drivers for the Embedded +Controller. There is no change to the behavior of the AML Acquire operator, +as this can already be used to acquire a mutex multiple times by the same +thread. BZ 8066. With assistance from Alexey Starikovskiy. + +Fixed a problem where invalid objects could be referenced in the AML +Interpreter after error conditions. During operand evaluation, ensure that +the internal "Return Object" field is cleared on error and only valid +pointers are stored there. Caused occasional access to deleted objects that +resulted in "large reference count" warning messages. Valery Podrezov. + +Fixed a problem where an AE_STACK_OVERFLOW internal exception could occur on +deeply nested control method invocations. BZ 7873, local BZ 487. Valery +Podrezov. + +Fixed an internal problem with the handling of result objects on the +interpreter result stack. BZ 7872. Valery Podrezov. + +Removed obsolete code that handled the case where AML_NAME_OP is the target +of a reference (Reference.Opcode). This code was no longer necessary. BZ +7874. Valery Podrezov. + +Removed obsolete ACPI_NO_INTEGER64_SUPPORT from two header files. This was a +remnant from the previously discontinued 16-bit support. + +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: 78.0K Code, 17.1K Data, 95.1K Total + Debug Version: 155.8K Code, 63.3K Data, 219.1K Total + Current Release: + Non-Debug Version: 78.0K Code, 17.1K Data, 95.1K Total + Debug Version: 155.9K Code, 63.1K Data, 219.0K Total + +---------------------------------------- +26 January 2007. Summary of changes for version 20070126: + +1) ACPI CA Core Subsystem: + +Added the 2007 copyright to all module headers and signons. This affects +virtually every file in the ACPICA core subsystem, the iASL compiler, and +the utilities. + +Implemented a fix for an incorrect parameter passed to AcpiTbDeleteTable +during a table load. A bad pointer was passed in the case where the DSDT is +overridden, causing a fault in this case. + +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: 78.0K Code, 17.1K Data, 95.1K Total + Debug Version: 155.8K Code, 63.3K Data, 219.1K Total + Current Release: + Non-Debug Version: 78.0K Code, 17.1K Data, 95.1K Total + Debug Version: 155.8K Code, 63.3K Data, 219.1K Total + +---------------------------------------- +15 December 2006. Summary of changes for version 20061215: + +1) ACPI CA Core Subsystem: + +Support for 16-bit ACPICA has been completely removed since it is no longer +necessary and it clutters the code. All 16-bit macros, types, and +conditional compiles have been removed, cleaning up and simplifying the code +across the entire subsystem. DOS support is no longer needed since the +bootable Linux firmware kit is now available. + +The handler for the Global Lock is now removed during AcpiTerminate to +enable a clean subsystem restart, via the implementation of the +AcpiEvRemoveGlobalLockHandler function. (With assistance from Joel Bretz, +HP) + +Implemented enhancements to the multithreading support within the debugger +to enable improved multithreading debugging and evaluation of the subsystem. +(Valery Podrezov) + +Debugger: Enhanced the Statistics/Memory command to emit the total (maximum) +memory used during the execution, as well as the maximum memory consumed by +each of the various object types. (Valery Podrezov) + +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: 77.9K Code, 17.0K Data, 94.9K Total + Debug Version: 155.2K Code, 63.1K Data, 218.3K Total + Current Release: + Non-Debug Version: 78.0K Code, 17.1K Data, 95.1K Total + Debug Version: 155.8K Code, 63.3K Data, 219.1K Total + + +2) iASL Compiler/Disassembler and Tools: + +AcpiExec: Implemented a new option (-m) to display full memory use +statistics upon subsystem/program termination. (Valery Podrezov) + +---------------------------------------- +09 November 2006. Summary of changes for version 20061109: + +1) ACPI CA Core Subsystem: + +Optimized the Load ASL operator in the case where the source operand is an +operation region. Simply map the operation region memory, instead of +performing a bytewise read. (Region must be of type SystemMemory, see +below.) + +Fixed the Load ASL operator for the case where the source operand is a +region field. A buffer object is also allowed as the source operand. BZ 480 + +Fixed a problem where the Load ASL operator allowed the source operand to be +an operation region of any type. It is now restricted to regions of type +SystemMemory, as per the ACPI specification. BZ 481 + +Additional cleanup and optimizations for the new Table Manager code. + +AcpiEnable will now fail if all of the required ACPI tables are not loaded +(FADT, FACS, DSDT). BZ 477 + +Added #pragma pack(8/4) to acobject.h to ensure that the structures in this +header are always compiled as aligned. The ACPI_OPERAND_OBJECT has been +manually optimized to be aligned and will not work if it is byte-packed. + +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: 78.1K Code, 17.1K Data, 95.2K Total + Debug Version: 155.4K Code, 63.1K Data, 218.5K Total + Current Release: + Non-Debug Version: 77.9K Code, 17.0K Data, 94.9K Total + Debug Version: 155.2K Code, 63.1K Data, 218.3K Total + + +2) iASL Compiler/Disassembler and Tools: + +Fixed a problem where the presence of the _OSI predefined control method +within complex expressions could cause an internal compiler error. + +AcpiExec: Implemented full region support for multiple address spaces. +SpaceId is now part of the REGION object. BZ 429 + +---------------------------------------- +11 October 2006. Summary of changes for version 20061011: + +1) ACPI CA Core Subsystem: + +Completed an AML interpreter performance enhancement for control method +execution. Previously a 2-pass parse/execution, control methods are now +completely parsed and executed in a single pass. This improves overall +interpreter performance by ~25%, reduces code size, and reduces CPU stack +use. (Valery Podrezov + interpreter changes in version 20051202 that +eliminated namespace loading during the pass one parse.) + +Implemented _CID support for PCI Root Bridge detection. If the _HID does not +match the predefined PCI Root Bridge IDs, the _CID list (if present) is now +obtained and also checked for an ID match. + +Implemented additional support for the PCI _ADR execution: upsearch until a +device scope is found before executing _ADR. This allows PCI_Config +operation regions to be declared locally within control methods underneath +PCI device objects. + +Fixed a problem with a possible race condition between threads executing +AcpiWalkNamespace and the AML interpreter. This condition was removed by +modifying AcpiWalkNamespace to (by default) ignore all temporary namespace +entries created during any concurrent control method execution. An +additional namespace race condition is known to exist between +AcpiWalkNamespace and the Load/Unload ASL operators and is still under +investigation. + +Restructured the AML ParseLoop function, breaking it into several +subfunctions in order to reduce CPU stack use and improve maintainability. +(Mikhail Kouzmich) + +AcpiGetHandle: Fix for parameter validation to detect invalid combinations +of prefix handle and pathname. BZ 478 + +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: 77.9K Code, 17.1K Data, 95.0K Total + Debug Version: 154.6K Code, 63.0K Data, 217.6K Total + Current Release: + Non-Debug Version: 78.1K Code, 17.1K Data, 95.2K Total + Debug Version: 155.4K Code, 63.1K Data, 218.5K Total + +2) iASL Compiler/Disassembler and Tools: + +Ported the -g option (get local ACPI tables) to the new ACPICA Table Manager +to restore original behavior. + +---------------------------------------- +27 September 2006. Summary of changes for version 20060927: + +1) ACPI CA Core Subsystem: + +Removed the "Flags" parameter from AcpiGetRegister and AcpiSetRegister. +These functions now use a spinlock for mutual exclusion and the interrupt +level indication flag is not needed. + +Fixed a problem with the Global Lock where the lock could appear to be +obtained before it is actually obtained. The global lock semaphore was +inadvertently created with one unit instead of zero units. (BZ 464) Fiodor +Suietov. + +Fixed a possible memory leak and fault in AcpiExResolveObjectToValue during +a read from a buffer or region field. (BZ 458) Fiodor Suietov. + +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: 77.9K Code, 17.1K Data, 95.0K Total + Debug Version: 154.7K Code, 63.0K Data, 217.7K Total + Current Release: + Non-Debug Version: 77.9K Code, 17.1K Data, 95.0K Total + Debug Version: 154.6K Code, 63.0K Data, 217.6K Total + + +2) iASL Compiler/Disassembler and Tools: + +Fixed a compilation problem with the pre-defined Resource Descriptor field +names where an "object does not exist" error could be incorrectly generated +if the parent ResourceTemplate pathname places the template within a +different namespace scope than the current scope. (BZ 7212) + +Fixed a problem where the compiler could hang after syntax errors detected +in an ElseIf construct. (BZ 453) + +Fixed a problem with the AmlFilename parameter to the DefinitionBlock() +operator. An incorrect output filename was produced when this parameter was +a null string (""). Now, the original input filename is used as the AML +output filename, with an ".aml" extension. + +Implemented a generic batch command mode for the AcpiExec utility (execute +any AML debugger command) (Valery Podrezov). + +---------------------------------------- +12 September 2006. Summary of changes for version 20060912: + +1) ACPI CA Core Subsystem: + +Enhanced the implementation of the "serialized mode" of the interpreter +(enabled via the AcpiGbl_AllMethodsSerialized flag.) When this mode is +specified, instead of creating a serialization semaphore per control method, +the interpreter lock is simply no longer released before a blocking +operation during control method execution. This effectively makes the AML +Interpreter single-threaded. The overhead of a semaphore per-method is +eliminated. + +Fixed a regression where an error was no longer emitted if a control method +attempts to create 2 objects of the same name. This once again returns +AE_ALREADY_EXISTS. When this exception occurs, it invokes the mechanism that +will dynamically serialize the control method to possible prevent future +errors. (BZ 440) + +Integrated a fix for a problem with PCI Express HID detection in the PCI +Config Space setup procedure. (BZ 7145) + +Moved all FADT-related functions to a new file, tbfadt.c. Eliminated the +AcpiHwInitialize function - the FADT registers are now validated when the +table is loaded. + +Added two new warnings during FADT verification - 1) if the FADT is larger +than the largest known FADT version, and 2) if there is a mismatch between a +32-bit block address and the 64-bit X counterpart (when both are non-zero.) + +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: 77.9K Code, 16.7K Data, 94.6K Total + Debug Version: 154.9K Code, 62.6K Data, 217.5K Total + Current Release: + Non-Debug Version: 77.9K Code, 17.1K Data, 95.0K Total + Debug Version: 154.7K Code, 63.0K Data, 217.7K Total + + +2) iASL Compiler/Disassembler and Tools: + +Fixed a problem with the implementation of the Switch() operator where the +temporary variable was declared too close to the actual Switch, instead of +at method level. This could cause a problem if the Switch() operator is +within a while loop, causing an error on the second iteration. (BZ 460) + +Disassembler - fix for error emitted for unknown type for target of scope +operator. Now, ignore it and continue. + +Disassembly of an FADT now verifies the input FADT and reports any errors +found. Fix for proper disassembly of full-sized (ACPI 2.0) FADTs. + +Disassembly of raw data buffers with byte initialization data now prefixes +each output line with the current buffer offset. + +Disassembly of ASF! table now includes all variable-length data fields at +the end of some of the subtables. + +The disassembler now emits a comment if a buffer appears to be a +ResourceTemplate, but cannot be disassembled as such because the EndTag does +not appear at the very end of the buffer. + +AcpiExec - Added the "-t" command line option to enable the serialized mode +of the AML interpreter. + +---------------------------------------- +31 August 2006. Summary of changes for version 20060831: + +1) ACPI CA Core Subsystem: + +Miscellaneous fixes for the Table Manager: +- Correctly initialize internal common FADT for all 64-bit "X" fields +- Fixed a couple table mapping issues during table load +- Fixed a couple alignment issues for IA64 +- Initialize input array to zero in AcpiInitializeTables +- Additional parameter validation for AcpiGetTable, AcpiGetTableHeader, +AcpiGetTableByIndex + +Change for GPE support: when a "wake" GPE is received, all wake GPEs are now +immediately disabled to prevent the waking GPE from firing again and to +prevent other wake GPEs from interrupting the wake process. + +Added the AcpiGpeCount global that tracks the number of processed GPEs, to +be used for debugging systems with a large number of ACPI interrupts. + +Implemented support for the "DMAR" ACPI table (DMA Redirection Table) in +both the ACPICA headers and the disassembler. + +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: 77.8K Code, 16.5K Data, 94.3K Total + Debug Version: 154.6K Code, 62.3K Data, 216.9K Total + Current Release: + Non-Debug Version: 77.9K Code, 16.7K Data, 94.6K Total + Debug Version: 154.9K Code, 62.6K Data, 217.5K Total + + +2) iASL Compiler/Disassembler and Tools: + +Disassembler support for the DMAR ACPI table. + +---------------------------------------- +23 August 2006. Summary of changes for version 20060823: + +1) ACPI CA Core Subsystem: + +The Table Manager component has been completely redesigned and +reimplemented. The new design is much simpler, and reduces the overall code +and data size of the kernel-resident ACPICA by approximately 5%. Also, it is +now possible to obtain the ACPI tables very early during kernel +initialization, even before dynamic memory management is initialized. +(Alexey Starikovskiy, Fiodor Suietov, Bob Moore) + +Obsolete ACPICA interfaces: + +- AcpiGetFirmwareTable: Use AcpiGetTable instead (works at early kernel init +time). +- AcpiLoadTable: Not needed. +- AcpiUnloadTable: Not needed. + +New ACPICA interfaces: + +- AcpiInitializeTables: Must be called before the table manager can be used. +- AcpiReallocateRootTable: Used to transfer the root table to dynamically +allocated memory after it becomes available. +- AcpiGetTableByIndex: Allows the host to easily enumerate all ACPI tables +in the RSDT/XSDT. + +Other ACPICA changes: + +- AcpiGetTableHeader returns the actual mapped table header, not a copy. Use +AcpiOsUnmapMemory to free this mapping. +- AcpiGetTable returns the actual mapped table. The mapping is managed +internally and must not be deleted by the caller. Use of this interface +causes no additional dynamic memory allocation. +- AcpiFindRootPointer: Support for physical addressing has been eliminated, +it appeared to be unused. +- The interface to AcpiOsMapMemory has changed to be consistent with the +other allocation interfaces. +- The interface to AcpiOsGetRootPointer has changed to eliminate unnecessary +parameters. +- ACPI_PHYSICAL_ADDRESS is now 32 bits on 32-bit platforms, 64 bits on 64- +bit platforms. Was previously 64 bits on all platforms. +- The interface to the ACPI Global Lock acquire/release macros have changed +slightly since ACPICA no longer keeps a local copy of the FACS with a +constructed pointer to the actual global lock. + +Porting to the new table manager: + +- AcpiInitializeTables: Must be called once, and can be called anytime +during the OS initialization process. It allows the host to specify an area +of memory to be used to store the internal version of the RSDT/XSDT (root +table). This allows the host to access ACPI tables before memory management +is initialized and running. +- AcpiReallocateRootTable: Can be called after memory management is running +to copy the root table to a dynamically allocated array, freeing up the +scratch memory specified in the call to AcpiInitializeTables. +- AcpiSubsystemInitialize: This existing interface is independent of the +Table Manager, and does not have to be called before the Table Manager can +be used, it only must be called before the rest of ACPICA can be used. +- ACPI Tables: Some changes have been made to the names and structure of the +actbl.h and actbl1.h header files and may require changes to existing code. +For example, bitfields have been completely removed because of their lack of +portability across C compilers. +- Update interfaces to the Global Lock acquire/release macros if local +versions are used. (see acwin.h) + +Obsolete files: tbconvrt.c, tbget.c, tbgetall.c, tbrsdt.c + +New files: tbfind.c + +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: 80.7K Code, 17.9K Data, 98.6K Total + Debug Version: 161.0K Code, 65.1K Data, 226.1K Total + Current Release: + Non-Debug Version: 77.8K Code, 16.5K Data, 94.3K Total + Debug Version: 154.6K Code, 62.3K Data, 216.9K Total + + +2) iASL Compiler/Disassembler and Tools: + +No changes for this release. + +---------------------------------------- +21 July 2006. Summary of changes for version 20060721: + +1) ACPI CA Core Subsystem: + +The full source code for the ASL test suite used to validate the iASL +compiler and the ACPICA core subsystem is being released with the ACPICA +source for the first time. The source is contained in a separate package and +consists of over 1100 files that exercise all ASL/AML operators. The package +should appear on the Intel/ACPI web site shortly. (Valery Podrezov, Fiodor +Suietov) + +Completed a new design and implementation for support of the ACPI Global +Lock. On the OS side, the global lock is now treated as a standard AML +mutex. Previously, multiple OS threads could "acquire" the global lock +simultaneously. However, this could cause the BIOS to be starved out of the +lock - especially in cases such as the Embedded Controller driver where +there is a tight coupling between the OS and the BIOS. + +Implemented an optimization for the ACPI Global Lock interrupt mechanism. +The Global Lock interrupt handler no longer queues the execution of a +separate thread to signal the global lock semaphore. Instead, the semaphore +is signaled directly from the interrupt handler. + +Implemented support within the AML interpreter for package objects that +contain a larger AML length (package list length) than the package element +count. In this case, the length of the package is truncated to match the +package element count. Some BIOS code apparently modifies the package length +on the fly, and this change supports this behavior. Provides compatibility +with the MS AML interpreter. (With assistance from Fiodor Suietov) + +Implemented a temporary fix for the BankValue parameter of a Bank Field to +support all constant values, now including the Zero and One opcodes. +Evaluation of this parameter must eventually be converted to a full TermArg +evaluation. A not-implemented error is now returned (temporarily) for non- +constant values for this parameter. + +Fixed problem reports (Fiodor Suietov) integrated: +- Fix for premature object deletion after CopyObject on Operation Region (BZ +350) + +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: 80.7K Code, 18.0K Data, 98.7K Total + Debug Version: 160.9K Code, 65.1K Data, 226.0K Total + Current Release: + Non-Debug Version: 80.7K Code, 17.9K Data, 98.6K Total + Debug Version: 161.0K Code, 65.1K Data, 226.1K Total + + +2) iASL Compiler/Disassembler and Tools: + +No changes for this release. + +---------------------------------------- +07 July 2006. Summary of changes for version 20060707: + +1) ACPI CA Core Subsystem: + +Added the ACPI_PACKED_POINTERS_NOT_SUPPORTED macro to support C compilers +that do not allow the initialization of address pointers within packed +structures - even though the hardware itself may support misaligned +transfers. Some of the debug data structures are packed by default to +minimize size. + +Added an error message for the case where AcpiOsGetThreadId() returns zero. +A non-zero value is required by the core ACPICA code to ensure the proper +operation of AML mutexes and recursive control methods. + +The DSDT is now the only ACPI table that determines whether the AML +interpreter is in 32-bit or 64-bit mode. Not really a functional change, but +the hooks for per-table 32/64 switching have been removed from the code. A +clarification to the ACPI specification is forthcoming in ACPI 3.0B. + +Fixed a possible leak of an OwnerID in the error path of +AcpiTbInitTableDescriptor (tbinstal.c), and migrated all table OwnerID +deletion to a single place in AcpiTbUninstallTable to correct possible leaks +when using the AcpiTbDeleteTablesByType interface (with assistance from +Lance Ortiz.) + +Fixed a problem with Serialized control methods where the semaphore +associated with the method could be over-signaled after multiple method +invocations. + +Fixed two issues with the locking of the internal namespace data structure. +Both the Unload() operator and AcpiUnloadTable interface now lock the +namespace during the namespace deletion associated with the table unload +(with assistance from Linn Crosetto.) + +Fixed problem reports (Valery Podrezov) integrated: +- Eliminate unnecessary memory allocation for CreateXxxxField (BZ 5426) + +Fixed problem reports (Fiodor Suietov) integrated: +- Incomplete cleanup branches in AcpiTbGetTableRsdt (BZ 369) +- On Address Space handler deletion, needless deactivation call (BZ 374) +- AcpiRemoveAddressSpaceHandler: validate Device handle parameter (BZ 375) +- Possible memory leak, Notify sub-objects of Processor, Power, ThermalZone +(BZ 376) +- AcpiRemoveAddressSpaceHandler: validate Handler parameter (BZ 378) +- Minimum Length of RSDT should be validated (BZ 379) +- AcpiRemoveNotifyHandler: return AE_NOT_EXIST if Processor Obj has no +Handler (BZ (380) +- AcpiUnloadTable: return AE_NOT_EXIST if no table of specified type loaded +(BZ 381) + +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: 80.5K Code, 17.8K Data, 98.3K Total + Debug Version: 160.8K Code, 64.8K Data, 225.6K Total + Current Release: + Non-Debug Version: 80.7K Code, 17.9K Data, 98.6K Total + Debug Version: 161.0K Code, 65.1K Data, 226.1K Total + + +2) iASL Compiler/Disassembler and Tools: + +Fixed problem reports: +Compiler segfault when ASL contains a long (>1024) String declaration (BZ +436) + +---------------------------------------- +23 June 2006. Summary of changes for version 20060623: + +1) ACPI CA Core Subsystem: + +Implemented a new ACPI_SPINLOCK type for the OSL lock interfaces. This +allows the type to be customized to the host OS for improved efficiency +(since a spinlock is usually a very small object.) + +Implemented support for "ignored" bits in the ACPI registers. According to +the ACPI specification, these bits should be preserved when writing the +registers via a read/modify/write cycle. There are 3 bits preserved in this +manner: PM1_CONTROL[0] (SCI_EN), PM1_CONTROL[9], and PM1_STATUS[11]. + +Implemented the initial deployment of new OSL mutex interfaces. Since some +host operating systems have separate mutex and semaphore objects, this +feature was requested. The base code now uses mutexes (and the new mutex +interfaces) wherever a binary semaphore was used previously. However, for +the current release, the mutex interfaces are defined as macros to map them +to the existing semaphore interfaces. Therefore, no OSL changes are required +at this time. (See acpiosxf.h) + +Fixed several problems with the support for the control method SyncLevel +parameter. The SyncLevel now works according to the ACPI specification and +in concert with the Mutex SyncLevel parameter, since the current SyncLevel +is a property of the executing thread. Mutual exclusion for control methods +is now implemented with a mutex instead of a semaphore. + +Fixed three instances of the use of the C shift operator in the bitfield +support code (exfldio.c) to avoid the use of a shift value larger than the +target data width. The behavior of C compilers is undefined in this case and +can cause unpredictable results, and therefore the case must be detected and +avoided. (Fiodor Suietov) + +Added an info message whenever an SSDT or OEM table is loaded dynamically +via the Load() or LoadTable() ASL operators. This should improve debugging +capability since it will show exactly what tables have been loaded (beyond +the tables present in the RSDT/XSDT.) + +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: 80.0K Code, 17.6K Data, 97.6K Total + Debug Version: 160.2K Code, 64.7K Data, 224.9K Total + Current Release: + Non-Debug Version: 80.5K Code, 17.8K Data, 98.3K Total + Debug Version: 160.8K Code, 64.8K Data, 225.6K Total + + +2) iASL Compiler/Disassembler and Tools: + +No changes for this release. + +---------------------------------------- +08 June 2006. Summary of changes for version 20060608: + +1) ACPI CA Core Subsystem: + +Converted the locking mutex used for the ACPI hardware to a spinlock. This +change should eliminate all problems caused by attempting to acquire a +semaphore at interrupt level, and it means that all ACPICA external +interfaces that directly access the ACPI hardware can be safely called from +interrupt level. OSL code that implements the semaphore interfaces should be +able to eliminate any workarounds for being called at interrupt level. + +Fixed a regression introduced in 20060526 where the ACPI device +initialization could be prematurely aborted with an AE_NOT_FOUND if a device +did not have an optional _INI method. + +Fixed an IndexField issue where a write to the Data Register should be +limited in size to the AccessSize (width) of the IndexField itself. (BZ 433, +Fiodor Suietov) + +Fixed problem reports (Valery Podrezov) integrated: +- Allow store of ThermalZone objects to Debug object (BZ 5369/5370) + +Fixed problem reports (Fiodor Suietov) integrated: +- AcpiGetTableHeader doesn't handle multiple instances correctly (BZ 364) + +Removed four global mutexes that were obsolete and were no longer being +used. + +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: 80.0K Code, 17.7K Data, 97.7K Total + Debug Version: 160.3K Code, 64.9K Data, 225.2K Total + Current Release: + Non-Debug Version: 80.0K Code, 17.6K Data, 97.6K Total + Debug Version: 160.2K Code, 64.7K Data, 224.9K Total + + +2) iASL Compiler/Disassembler and Tools: + +Fixed a fault when using -g option (get tables from registry) on Windows +machines. + +Fixed problem reports integrated: +- Generate error if CreateField NumBits parameter is zero. (BZ 405) +- Fault if Offset/Length in Field unit is very large (BZ 432, Fiodor +Suietov) +- Global table revision override (-r) is ignored (BZ 413) + +---------------------------------------- +26 May 2006. Summary of changes for version 20060526: + +1) ACPI CA Core Subsystem: + +Restructured, flattened, and simplified the internal interfaces for +namespace object evaluation - resulting in smaller code, less CPU stack use, +and fewer interfaces. (With assistance from Mikhail Kouzmich) + +Fixed a problem with the CopyObject operator where the first parameter was +not typed correctly for the parser, interpreter, compiler, and disassembler. +Caused various errors and unexpected behavior. + +Fixed a problem where a ShiftLeft or ShiftRight of more than 64 bits +produced incorrect results with some C compilers. Since the behavior of C +compilers when the shift value is larger than the datatype width is +apparently not well defined, the interpreter now detects this condition and +simply returns zero as expected in all such cases. (BZ 395) + +Fixed problem reports (Valery Podrezov) integrated: +- Update String-to-Integer conversion to match ACPI 3.0A spec (BZ 5329) +- Allow interpreter to handle nested method declarations (BZ 5361) + +Fixed problem reports (Fiodor Suietov) integrated: +- AcpiTerminate doesn't free debug memory allocation list objects (BZ 355) +- After Core Subsystem shutdown, AcpiSubsystemStatus returns AE_OK (BZ 356) +- AcpiOsUnmapMemory for RSDP can be invoked inconsistently (BZ 357) +- Resource Manager should return AE_TYPE for non-device objects (BZ 358) +- Incomplete cleanup branch in AcpiNsEvaluateRelative (BZ 359) +- Use AcpiOsFree instead of ACPI_FREE in AcpiRsSetSrsMethodData (BZ 360) +- Incomplete cleanup branch in AcpiPsParseAml (BZ 361) +- Incomplete cleanup branch in AcpiDsDeleteWalkState (BZ 362) +- AcpiGetTableHeader returns AE_NO_ACPI_TABLES until DSDT is loaded (BZ 365) +- Status of the Global Initialization Handler call not used (BZ 366) +- Incorrect object parameter to Global Initialization Handler (BZ 367) + +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: 79.8K Code, 17.7K Data, 97.5K Total + Debug Version: 160.5K Code, 65.1K Data, 225.6K Total + Current Release: + Non-Debug Version: 80.0K Code, 17.7K Data, 97.7K Total + Debug Version: 160.3K Code, 64.9K Data, 225.2K Total + + +2) iASL Compiler/Disassembler and Tools: + +Modified the parser to allow the names IO, DMA, and IRQ to be used as +namespace identifiers with no collision with existing resource descriptor +macro names. This provides compatibility with other ASL compilers and is +most useful for disassembly/recompilation of existing tables without parse +errors. (With assistance from Thomas Renninger) + +Disassembler: fixed an incorrect disassembly problem with the +DataTableRegion and CopyObject operators. Fixed a possible fault during +disassembly of some Alias operators. + +---------------------------------------- +12 May 2006. Summary of changes for version 20060512: + +1) ACPI CA Core Subsystem: + +Replaced the AcpiOsQueueForExecution interface with a new interface named +AcpiOsExecute. The major difference is that the new interface does not have +a Priority parameter, this appeared to be useless and has been replaced by a +Type parameter. The Type tells the host what type of execution is being +requested, such as global lock handler, notify handler, GPE handler, etc. +This allows the host to queue and execute the request as appropriate for the +request type, possibly using different work queues and different priorities +for the various request types. This enables fixes for multithreading +deadlock problems such as BZ #5534, and will require changes to all existing +OS interface layers. (Alexey Starikovskiy and Bob Moore) + +Fixed a possible memory leak associated with the support for the so-called +"implicit return" ACPI extension. Reported by FreeBSD, BZ #6514. (Fiodor +Suietov) + +Fixed a problem with the Load() operator where a table load from an +operation region could overwrite an internal table buffer by up to 7 bytes +and cause alignment faults on IPF systems. (With assistance from Luming Yu) + +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: 79.7K Code, 17.7K Data, 97.4K Total + Debug Version: 160.1K Code, 65.2K Data, 225.3K Total + Current Release: + Non-Debug Version: 79.8K Code, 17.7K Data, 97.5K Total + Debug Version: 160.5K Code, 65.1K Data, 225.6K Total + + + +2) iASL Compiler/Disassembler and Tools: + +Disassembler: Implemented support to cross reference the internal namespace +and automatically generate ASL External() statements for symbols not defined +within the current table being disassembled. This will simplify the +disassembly and recompilation of interdependent tables such as SSDTs since +these statements will no longer have to be added manually. + +Disassembler: Implemented experimental support to automatically detect +invocations of external control methods and generate appropriate External() +statements. This is problematic because the AML cannot be correctly parsed +until the number of arguments for each control method is known. Currently, +standalone method invocations and invocations as the source operand of a +Store() statement are supported. + +Disassembler: Implemented support for the ASL pseudo-operators LNotEqual, +LLessEqual, and LGreaterEqual. Previously disassembled as LNot(LEqual()), +LNot(LGreater()), and LNot(LLess()), this makes the disassembled ASL code +more readable and likely closer to the original ASL source. + +---------------------------------------- +21 April 2006. Summary of changes for version 20060421: + +1) ACPI CA Core Subsystem: + +Removed a device initialization optimization introduced in 20051216 where +the _STA method was not run unless an _INI was also present for the same +device. This optimization could cause problems because it could allow _INI +methods to be run within a not-present device subtree. (If a not-present +device had no _INI, _STA would not be run, the not-present status would not +be discovered, and the children of the device would be incorrectly +traversed.) + +Implemented a new _STA optimization where namespace subtrees that do not +contain _INI are identified and ignored during device initialization. +Selectively running _STA can significantly improve boot time on large +machines (with assistance from Len Brown.) + +Implemented support for the device initialization case where the returned +_STA flags indicate a device not-present but functioning. In this case, _INI +is not run, but the device children are examined for presence, as per the +ACPI specification. + +Implemented an additional change to the IndexField support in order to +conform to MS behavior. The value written to the Index Register is not +simply a byte offset, it is a byte offset in units of the access width of +the parent Index Field. (Fiodor Suietov) + +Defined and deployed a new OSL interface, AcpiOsValidateAddress. This +interface is called during the creation of all AML operation regions, and +allows the host OS to exert control over what addresses it will allow the +AML code to access. Operation Regions whose addresses are disallowed will +cause a runtime exception when they are actually accessed (will not affect +or abort table loading.) See oswinxf or osunixxf for an example +implementation. + +Defined and deployed a new OSL interface, AcpiOsValidateInterface. This +interface allows the host OS to match the various "optional" +interface/behavior strings for the _OSI predefined control method as +appropriate (with assistance from Bjorn Helgaas.) See oswinxf or osunixxf +for an example implementation. + +Restructured and corrected various problems in the exception handling code +paths within DsCallControlMethod and DsTerminateControlMethod in dsmethod +(with assistance from Takayoshi Kochi.) + +Modified the Linux source converter to ignore quoted string literals while +converting identifiers from mixed to lower case. This will correct problems +with the disassembler and other areas where such strings must not be +modified. + +The ACPI_FUNCTION_* macros no longer require quotes around the function +name. This allows the Linux source converter to convert the names, now that +the converter ignores quoted strings. + +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: 81.1K Code, 17.7K Data, 98.8K Total + Debug Version: 158.9K Code, 64.9K Data, 223.8K Total + Current Release: + Non-Debug Version: 79.7K Code, 17.7K Data, 97.4K Total + Debug Version: 160.1K Code, 65.2K Data, 225.3K Total + + +2) iASL Compiler/Disassembler and Tools: + +Implemented 3 new warnings for iASL, and implemented multiple warning levels +(w2 flag). + +1) Ignored timeouts: If the TimeoutValue parameter to Wait or Acquire is not +WAIT_FOREVER (0xFFFF) and the code does not examine the return value to +check for the possible timeout, a warning is issued. + +2) Useless operators: If an ASL operator does not specify an optional target +operand and it also does not use the function return value from the +operator, a warning is issued since the operator effectively does nothing. + +3) Unreferenced objects: If a namespace object is created, but never +referenced, a warning is issued. This is a warning level 2 since there are +cases where this is ok, such as when a secondary table is loaded that uses +the unreferenced objects. Even so, care is taken to only flag objects that +don't look like they will ever be used. For example, the reserved methods +(starting with an underscore) are usually not referenced because it is +expected that the OS will invoke them. + +---------------------------------------- +31 March 2006. Summary of changes for version 20060331: + +1) ACPI CA Core Subsystem: + +Implemented header file support for the following additional ACPI tables: +ASF!, BOOT, CPEP, DBGP, MCFG, SPCR, SPMI, TCPA, and WDRT. With this support, +all current and known ACPI tables are now defined in the ACPICA headers and +are available for use by device drivers and other software. + +Implemented support to allow tables that contain ACPI names with invalid +characters to be loaded. Previously, this would cause the table load to +fail, but since there are several known cases of such tables on existing +machines, this change was made to enable ACPI support for them. Also, this +matches the behavior of the Microsoft ACPI implementation. + +Fixed a couple regressions introduced during the memory optimization in the +20060317 release. The namespace node definition required additional +reorganization and an internal datatype that had been changed to 8-bit was +restored to 32-bit. (Valery Podrezov) + +Fixed a problem where a null pointer passed to AcpiUtDeleteGenericState +could be passed through to AcpiOsReleaseObject which is unexpected. Such +null pointers are now trapped and ignored, matching the behavior of the +previous implementation before the deployment of AcpiOsReleaseObject. +(Valery Podrezov, Fiodor Suietov) + +Fixed a memory mapping leak during the deletion of a SystemMemory operation +region where a cached memory mapping was not deleted. This became a +noticeable problem for operation regions that are defined within frequently +used control methods. (Dana Meyers) + +Reorganized the ACPI table header files into two main files: one for the +ACPI tables consumed by the ACPICA core, and another for the miscellaneous +ACPI tables that are consumed by the drivers and other software. The various +FADT definitions were merged into one common section and three different +tables (ACPI 1.0, 1.0+, and 2.0) + +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: 80.9K Code, 17.7K Data, 98.6K Total + Debug Version: 158.7K Code, 64.8K Data, 223.5K Total + Current Release: + Non-Debug Version: 81.1K Code, 17.7K Data, 98.8K Total + Debug Version: 158.9K Code, 64.9K Data, 223.8K Total + + +2) iASL Compiler/Disassembler and Tools: + +Disassembler: Implemented support to decode and format all non-AML ACPI +tables (tables other than DSDTs and SSDTs.) This includes the new tables +added to the ACPICA headers, therefore all current and known ACPI tables are +supported. + +Disassembler: The change to allow ACPI names with invalid characters also +enables the disassembly of such tables. Invalid characters within names are +changed to '*' to make the name printable; the iASL compiler will still +generate an error for such names, however, since this is an invalid ACPI +character. + +Implemented an option for AcpiXtract (-a) to extract all tables found in the +input file. The default invocation extracts only the DSDTs and SSDTs. + +Fixed a couple of gcc generation issues for iASL and AcpiExec and added a +makefile for the AcpiXtract utility. + +---------------------------------------- +17 March 2006. Summary of changes for version 20060317: + +1) ACPI CA Core Subsystem: + +Implemented the use of a cache object for all internal namespace nodes. +Since there are about 1000 static nodes in a typical system, this will +decrease memory use for cache implementations that minimize per-allocation +overhead (such as a slab allocator.) + +Removed the reference count mechanism for internal namespace nodes, since it +was deemed unnecessary. This reduces the size of each namespace node by +about 5%-10% on all platforms. Nodes are now 20 bytes for the 32-bit case, +and 32 bytes for the 64-bit case. + +Optimized several internal data structures to reduce object size on 64-bit +platforms by packing data within the 64-bit alignment. This includes the +frequently used ACPI_OPERAND_OBJECT, of which there can be ~1000 static +instances corresponding to the namespace objects. + +Added two new strings for the predefined _OSI method: "Windows 2001.1 SP1" +and "Windows 2006". + +Split the allocation tracking mechanism out to a separate file, from +utalloc.c to uttrack.c. This mechanism appears to be only useful for +application-level code. Kernels may wish to not include uttrack.c in +distributions. + +Removed all remnants of the obsolete ACPI_REPORT_* macros and the associated +code. (These macros have been replaced by the ACPI_ERROR and ACPI_WARNING +macros.) + +Code and Data Size: These are the sizes for the acpica.lib produced by the +Microsoft Visual C++ 6.0 32-bit compiler. The values do not include any ACPI +driver or OSPM code. The debug version of the code includes the debug output +trace mechanism and has a much larger code and data size. Note that these +values will vary depending on the efficiency of the compiler and the +compiler options used during generation. + + Previous Release: + Non-Debug Version: 81.1K Code, 17.8K Data, 98.9K Total + Debug Version: 161.6K Code, 65.7K Data, 227.3K Total + Current Release: + Non-Debug Version: 80.9K Code, 17.7K Data, 98.6K Total + Debug Version: 158.7K Code, 64.8K Data, 223.5K Total + + +2) iASL Compiler/Disassembler and Tools: + +Implemented an ANSI C version of the acpixtract utility. This version will +automatically extract the DSDT and all SSDTs from the input acpidump text +file and dump the binary output to separate files. It can also display a +summary of the input file including the headers for each table found and +will extract any single ACPI table, with any signature. (See +source/tools/acpixtract) + +---------------------------------------- +10 March 2006. Summary of changes for version 20060310: + +1) ACPI CA Core Subsystem: + +Tagged all external interfaces to the subsystem with the new +ACPI_EXPORT_SYMBOL macro. This macro can be defined as necessary to assist +kernel integration. For Linux, the macro resolves to the EXPORT_SYMBOL +macro. The default definition is NULL. + +Added the ACPI_THREAD_ID type for the return value from AcpiOsGetThreadId. +This allows the host to define this as necessary to simplify kernel +integration. The default definition is ACPI_NATIVE_UINT. + +Fixed two interpreter problems related to error processing, the deletion of +objects, and placing invalid pointers onto the internal operator result +stack. BZ 6028, 6151 (Valery Podrezov) + +Increased the reference count threshold where a warning is emitted for large +reference counts in order to eliminate unnecessary warnings on systems with +large namespaces (especially 64-bit.) Increased the value from 0x400 to +0x800. + +Due to universal disagreement as to the meaning of the 'c' in the calloc() +function, the ACPI_MEM_CALLOCATE macro has been renamed to +ACPI_ALLOCATE_ZEROED so that the purpose of the interface is 'clear'. +ACPI_MEM_ALLOCATE and ACPI_MEM_FREE are renamed to ACPI_ALLOCATE and +ACPI_FREE. + +Code and Data Size: These are the sizes for the acpica.lib produced by the +Microsoft Visual C++ 6.0 32-bit compiler. The values do not include any ACPI +driver or OSPM code. The debug version of the code includes the debug output +trace mechanism and has a much larger code and data size. Note that these +values will vary depending on the efficiency of the compiler and the +compiler options used during generation. + + Previous Release: + Non-Debug Version: 81.0K Code, 17.8K Data, 98.8K Total + Debug Version: 161.4K Code, 65.7K Data, 227.1K Total + Current Release: + Non-Debug Version: 81.1K Code, 17.8K Data, 98.9K Total + Debug Version: 161.6K Code, 65.7K Data, 227.3K Total + + +2) iASL Compiler/Disassembler: + +Disassembler: implemented support for symbolic resource descriptor +references. If a CreateXxxxField operator references a fixed offset within a +resource descriptor, a name is assigned to the descriptor and the offset is +translated to the appropriate resource tag and pathname. The addition of +this support brings the disassembled code very close to the original ASL +source code and helps eliminate run-time errors when the disassembled code +is modified (and recompiled) in such a way as to invalidate the original +fixed offsets. + +Implemented support for a Descriptor Name as the last parameter to the ASL +Register() macro. This parameter was inadvertently left out of the ACPI +specification, and will be added for ACPI 3.0b. + +Fixed a problem where the use of the "_OSI" string (versus the full path +"\_OSI") caused an internal compiler error. ("No back ptr to op") + +Fixed a problem with the error message that occurs when an invalid string is +used for a _HID object (such as one with an embedded asterisk: "*PNP010A".) +The correct message is now displayed. + +---------------------------------------- +17 February 2006. Summary of changes for version 20060217: + +1) ACPI CA Core Subsystem: + +Implemented a change to the IndexField support to match the behavior of the +Microsoft AML interpreter. The value written to the Index register is now a +byte offset, no longer an index based upon the width of the Data register. +This should fix IndexField problems seen on some machines where the Data +register is not exactly one byte wide. The ACPI specification will be +clarified on this point. + +Fixed a problem where several resource descriptor types could overrun the +internal descriptor buffer due to size miscalculation: VendorShort, +VendorLong, and Interrupt. This was noticed on IA64 machines, but could +affect all platforms. + +Fixed a problem where individual resource descriptors were misaligned within +the internal buffer, causing alignment faults on IA64 platforms. + +Code and Data Size: These are the sizes for the acpica.lib produced by the +Microsoft Visual C++ 6.0 32-bit compiler. The values do not include any ACPI +driver or OSPM code. The debug version of the code includes the debug output +trace mechanism and has a much larger code and data size. Note that these +values will vary depending on the efficiency of the compiler and the +compiler options used during generation. + + Previous Release: + Non-Debug Version: 81.1K Code, 17.8K Data, 98.9K Total + Debug Version: 161.3K Code, 65.6K Data, 226.9K Total + Current Release: + Non-Debug Version: 81.0K Code, 17.8K Data, 98.8K Total + Debug Version: 161.4K Code, 65.7K Data, 227.1K Total + + +2) iASL Compiler/Disassembler: + +Implemented support for new reserved names: _WDG and _WED are Microsoft +extensions for Windows Instrumentation Management, _TDL is a new ACPI- +defined method (Throttling Depth Limit.) + +Fixed a problem where a zero-length VendorShort or VendorLong resource +descriptor was incorrectly emitted as a descriptor of length one. + +---------------------------------------- +10 February 2006. Summary of changes for version 20060210: + +1) ACPI CA Core Subsystem: + +Removed a couple of extraneous ACPI_ERROR messages that appeared during +normal execution. These became apparent after the conversion from +ACPI_DEBUG_PRINT. + +Fixed a problem where the CreateField operator could hang if the BitIndex or +NumBits parameter referred to a named object. (Valery Podrezov, BZ 5359) + +Fixed a problem where a DeRefOf operation on a buffer object incorrectly +failed with an exception. This also fixes a couple of related RefOf and +DeRefOf issues. (Valery Podrezov, BZ 5360/5392/5387) + +Fixed a problem where the AE_BUFFER_LIMIT exception was returned instead of +AE_STRING_LIMIT on an out-of-bounds Index() operation. (Valery Podrezov, BZ +5480) + +Implemented a memory cleanup at the end of the execution of each iteration +of an AML While() loop, preventing the accumulation of outstanding objects. +(Valery Podrezov, BZ 5427) + +Eliminated a chunk of duplicate code in the object resolution code. (Valery +Podrezov, BZ 5336) + +Fixed several warnings during the 64-bit code generation. + +The AcpiSrc source code conversion tool now inserts one line of whitespace +after an if() statement that is followed immediately by a comment, improving +readability of the Linux code. + +Code and Data Size: The current and previous library sizes for the core +subsystem are shown below. These are the code and data sizes for the +acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. These +values do not include any ACPI driver or OSPM code. The debug version of the +code includes the debug output trace mechanism and has a much larger code +and data size. Note that these values will vary depending on the efficiency +of the compiler and the compiler options used during generation. + + Previous Release: + Non-Debug Version: 81.0K Code, 17.9K Data, 98.9K Total + Debug Version: 161.3K Code, 65.7K Data, 227.0K Total + Current Release: + Non-Debug Version: 81.1K Code, 17.8K Data, 98.9K Total + Debug Version: 161.3K Code, 65.6K Data, 226.9K Total + + +2) iASL Compiler/Disassembler: + +Fixed a problem with the disassembly of a BankField operator with a complex +expression for the BankValue parameter. + +---------------------------------------- +27 January 2006. Summary of changes for version 20060127: + +1) ACPI CA Core Subsystem: + +Implemented support in the Resource Manager to allow unresolved namestring +references within resource package objects for the _PRT method. This support +is in addition to the previously implemented unresolved reference support +within the AML parser. If the interpreter slack mode is enabled, these +unresolved references will be passed through to the caller as a NULL package +entry. + +Implemented and deployed new macros and functions for error and warning +messages across the subsystem. These macros are simpler and generate less +code than their predecessors. The new macros ACPI_ERROR, ACPI_EXCEPTION, +ACPI_WARNING, and ACPI_INFO replace the ACPI_REPORT_* macros. The older +macros remain defined to allow ACPI drivers time to migrate to the new +macros. + +Implemented the ACPI_CPU_FLAGS type to simplify host OS integration of the +Acquire/Release Lock OSL interfaces. + +Fixed a problem where Alias ASL operators are sometimes not correctly +resolved, in both the interpreter and the iASL compiler. + +Fixed several problems with the implementation of the ConcatenateResTemplate +ASL operator. As per the ACPI specification, zero length buffers are now +treated as a single EndTag. One-length buffers always cause a fatal +exception. Non-zero length buffers that do not end with a full 2-byte EndTag +cause a fatal exception. + +Fixed a possible structure overwrite in the AcpiGetObjectInfo external +interface. (With assistance from Thomas Renninger) + +Code and Data Size: The current and previous library sizes for the core +subsystem are shown below. These are the code and data sizes for the +acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. These +values do not include any ACPI driver or OSPM code. The debug version of the +code includes the debug output trace mechanism and has a much larger code +and data size. Note that these values will vary depending on the efficiency +of the compiler and the compiler options used during generation. + + Previous Release: + Non-Debug Version: 83.1K Code, 18.4K Data, 101.5K Total + Debug Version: 163.2K Code, 66.2K Data, 229.4K Total + Current Release: + Non-Debug Version: 81.0K Code, 17.9K Data, 98.9K Total + Debug Version: 161.3K Code, 65.7K Data, 227.0K Total + + +2) iASL Compiler/Disassembler: + +Fixed an internal error that was generated for any forward references to ASL +Alias objects. + +---------------------------------------- +13 January 2006. Summary of changes for version 20060113: + +1) ACPI CA Core Subsystem: + +Added 2006 copyright to all module headers and signons. This affects +virtually every file in the ACPICA core subsystem, iASL compiler, and the +utilities. + +Enhanced the ACPICA error reporting in order to simplify user migration to +the non-debug version of ACPICA. Replaced all instances of the +ACPI_DEBUG_PRINT macro invoked at the ACPI_DB_ERROR and ACPI_DB_WARN debug +levels with the ACPI_REPORT_ERROR and ACPI_REPORT_WARNING macros, +respectively. This preserves all error and warning messages in the non-debug +version of the ACPICA code (this has been referred to as the "debug lite" +option.) Over 200 cases were converted to create a total of over 380 +error/warning messages across the ACPICA code. This increases the code and +data size of the default non-debug version of the code somewhat (about 13K), +but all error/warning reporting may be disabled if desired (and code +eliminated) by specifying the ACPI_NO_ERROR_MESSAGES compile-time +configuration option. The size of the debug version of ACPICA remains about +the same. + +Fixed a memory leak within the AML Debugger "Set" command. One object was +not properly deleted for every successful invocation of the command. + +Code and Data Size: The current and previous library sizes for the core +subsystem are shown below. These are the code and data sizes for the +acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. These +values do not include any ACPI driver or OSPM code. The debug version of the +code includes the debug output trace mechanism and has a much larger code +and data size. Note that these values will vary depending on the efficiency +of the compiler and the compiler options used during generation. + + Previous Release: + Non-Debug Version: 76.6K Code, 12.3K Data, 88.9K Total + Debug Version: 163.7K Code, 67.5K Data, 231.2K Total + Current Release: + Non-Debug Version: 83.1K Code, 18.4K Data, 101.5K Total + Debug Version: 163.2K Code, 66.2K Data, 229.4K Total + + +2) iASL Compiler/Disassembler: + +The compiler now officially supports the ACPI 3.0a specification that was +released on December 30, 2005. (Specification is available at www.acpi.info) + +---------------------------------------- +16 December 2005. Summary of changes for version 20051216: + +1) ACPI CA Core Subsystem: + +Implemented optional support to allow unresolved names within ASL Package +objects. A null object is inserted in the package when a named reference +cannot be located in the current namespace. Enabled via the interpreter +slack flag, this should eliminate AE_NOT_FOUND exceptions seen on machines +that contain such code. + +Implemented an optimization to the initialization sequence that can improve +boot time. During ACPI device initialization, the _STA method is now run if +and only if the _INI method exists. The _STA method is used to determine if +the device is present; An _INI can only be run if _STA returns present, but +it is a waste of time to run the _STA method if the _INI does not exist. +(Prototype and assistance from Dong Wei) + +Implemented use of the C99 uintptr_t for the pointer casting macros if it is +available in the current compiler. Otherwise, the default (void *) cast is +used as before. + +Fixed some possible memory leaks found within the execution path of the +Break, Continue, If, and CreateField operators. (Valery Podrezov) + +Fixed a problem introduced in the 20051202 release where an exception is +generated during method execution if a control method attempts to declare +another method. + +Moved resource descriptor string constants that are used by both the AML +disassembler and AML debugger to the common utilities directory so that +these components are independent. + +Implemented support in the AcpiExec utility (-e switch) to globally ignore +exceptions during control method execution (method is not aborted.) + +Added the rsinfo.c source file to the AcpiExec makefile for Linux/Unix +generation. + +Code and Data Size: The current and previous library sizes for the core +subsystem are shown below. These are the code and data sizes for the +acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. These +values do not include any ACPI driver or OSPM code. The debug version of the +code includes the debug output trace mechanism and has a much larger code +and data size. Note that these values will vary depending on the efficiency +of the compiler and the compiler options used during generation. + + Previous Release: + Non-Debug Version: 76.3K Code, 12.3K Data, 88.6K Total + Debug Version: 163.2K Code, 67.4K Data, 230.6K Total + Current Release: + Non-Debug Version: 76.6K Code, 12.3K Data, 88.9K Total + Debug Version: 163.7K Code, 67.5K Data, 231.2K Total + + +2) iASL Compiler/Disassembler: + +Fixed a problem where a CPU stack overflow fault could occur if a recursive +method call was made from within a Return statement. + +---------------------------------------- +02 December 2005. Summary of changes for version 20051202: + +1) ACPI CA Core Subsystem: + +Modified the parsing of control methods to no longer create namespace +objects during the first pass of the parse. Objects are now created only +during the execute phase, at the moment the namespace creation operator is +encountered in the AML (Name, OperationRegion, CreateByteField, etc.) This +should eliminate ALREADY_EXISTS exceptions seen on some machines where +reentrant control methods are protected by an AML mutex. The mutex will now +correctly block multiple threads from attempting to create the same object +more than once. + +Increased the number of available Owner Ids for namespace object tracking +from 32 to 255. This should eliminate the OWNER_ID_LIMIT exceptions seen on +some machines with a large number of ACPI tables (either static or dynamic). + +Fixed a problem with the AcpiExec utility where a fault could occur when the +-b switch (batch mode) is used. + +Enhanced the namespace dump routine to output the owner ID for each +namespace object. + +Code and Data Size: The current and previous library sizes for the core +subsystem are shown below. These are the code and data sizes for the +acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. These +values do not include any ACPI driver or OSPM code. The debug version of the +code includes the debug output trace mechanism and has a much larger code +and data size. Note that these values will vary depending on the efficiency +of the compiler and the compiler options used during generation. + + Previous Release: + Non-Debug Version: 76.3K Code, 12.3K Data, 88.6K Total + Debug Version: 163.0K Code, 67.4K Data, 230.4K Total + Current Release: + Non-Debug Version: 76.3K Code, 12.3K Data, 88.6K Total + Debug Version: 163.2K Code, 67.4K Data, 230.6K Total + + +2) iASL Compiler/Disassembler: + +Fixed a parse error during compilation of certain Switch/Case constructs. To +simplify the parse, the grammar now allows for multiple Default statements +and this error is now detected and flagged during the analysis phase. + +Disassembler: The disassembly now includes the contents of the original +table header within a comment at the start of the file. This includes the +name and version of the original ASL compiler. + +---------------------------------------- +17 November 2005. Summary of changes for version 20051117: + +1) ACPI CA Core Subsystem: + +Fixed a problem in the AML parser where the method thread count could be +decremented below zero if any errors occurred during the method parse phase. +This should eliminate AE_AML_METHOD_LIMIT exceptions seen on some machines. +This also fixed a related regression with the mechanism that detects and +corrects methods that cannot properly handle reentrancy (related to the +deployment of the new OwnerId mechanism.) + +Eliminated the pre-parsing of control methods (to detect errors) during +table load. Related to the problem above, this was causing unwind issues if +any errors occurred during the parse, and it seemed to be overkill. A table +load should not be aborted if there are problems with any single control +method, thus rendering this feature rather pointless. + +Fixed a problem with the new table-driven resource manager where an internal +buffer overflow could occur for small resource templates. + +Implemented a new external interface, AcpiGetVendorResource. This interface +will find and return a vendor-defined resource descriptor within a _CRS or +_PRS method via an ACPI 3.0 UUID match. With assistance from Bjorn Helgaas. + +Removed the length limit (200) on string objects as per the upcoming ACPI +3.0A specification. This affects the following areas of the interpreter: 1) +any implicit conversion of a Buffer to a String, 2) a String object result +of the ASL Concatentate operator, 3) the String object result of the ASL +ToString operator. + +Fixed a problem in the Windows OS interface layer (OSL) where a WAIT_FOREVER +on a semaphore object would incorrectly timeout. This allows the +multithreading features of the AcpiExec utility to work properly under +Windows. + +Updated the Linux makefiles for the iASL compiler and AcpiExec to include +the recently added file named "utresrc.c". + +Code and Data Size: The current and previous library sizes for the core +subsystem are shown below. These are the code and data sizes for the +acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. These +values do not include any ACPI driver or OSPM code. The debug version of the +code includes the debug output trace mechanism and has a much larger code +and data size. Note that these values will vary depending on the efficiency +of the compiler and the compiler options used during generation. + + Previous Release: + Non-Debug Version: 76.2K Code, 12.3K Data, 88.5K Total + Debug Version: 163.0K Code, 67.4K Data, 230.4K Total + Current Release: + Non-Debug Version: 76.3K Code, 12.3K Data, 88.6K Total + Debug Version: 163.0K Code, 67.4K Data, 230.4K Total + + +2) iASL Compiler/Disassembler: + +Removed the limit (200) on string objects as per the upcoming ACPI 3.0A +specification. For the iASL compiler, this means that string literals within +the source ASL can be of any length. + +Enhanced the listing output to dump the AML code for resource descriptors +immediately after the ASL code for each descriptor, instead of in a block at +the end of the entire resource template. + +Enhanced the compiler debug output to dump the entire original parse tree +constructed during the parse phase, before any transforms are applied to the +tree. The transformed tree is dumped also. + +---------------------------------------- +02 November 2005. Summary of changes for version 20051102: + +1) ACPI CA Core Subsystem: + +Modified the subsystem initialization sequence to improve GPE support. The +GPE initialization has been split into two parts in order to defer execution +of the _PRW methods (Power Resources for Wake) until after the hardware is +fully initialized and the SCI handler is installed. This allows the _PRW +methods to access fields protected by the Global Lock. This will fix systems +where a NO_GLOBAL_LOCK exception has been seen during initialization. + +Converted the ACPI internal object disassemble and display code within the +AML debugger to fully table-driven operation, reducing code size and +increasing maintainability. + +Fixed a regression with the ConcatenateResTemplate() ASL operator introduced +in the 20051021 release. + +Implemented support for "local" internal ACPI object types within the +debugger "Object" command and the AcpiWalkNamespace external interfaces. +These local types include RegionFields, BankFields, IndexFields, Alias, and +reference objects. + +Moved common AML resource handling code into a new file, "utresrc.c". This +code is shared by both the Resource Manager and the AML Debugger. + +Code and Data Size: The current and previous library sizes for the core +subsystem are shown below. These are the code and data sizes for the +acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. These +values do not include any ACPI driver or OSPM code. The debug version of the +code includes the debug output trace mechanism and has a much larger code +and data size. Note that these values will vary depending on the efficiency +of the compiler and the compiler options used during generation. + + Previous Release: + Non-Debug Version: 76.1K Code, 12.2K Data, 88.3K Total + Debug Version: 163.5K Code, 67.0K Data, 230.5K Total + Current Release: + Non-Debug Version: 76.2K Code, 12.3K Data, 88.5K Total + Debug Version: 163.0K Code, 67.4K Data, 230.4K Total + + +2) iASL Compiler/Disassembler: + +Fixed a problem with very large initializer lists (more than 4000 elements) +for both Buffer and Package objects where the parse stack could overflow. + +Enhanced the pre-compile source code scan for non-ASCII characters to ignore +characters within comment fields. The scan is now always performed and is no +longer optional, detecting invalid characters within a source file +immediately rather than during the parse phase or later. + +Enhanced the ASL grammar definition to force early reductions on all list- +style grammar elements so that the overall parse stack usage is greatly +reduced. This should improve performance and reduce the possibility of parse +stack overflow. + +Eliminated all reduce/reduce conflicts in the iASL parser generation. Also, +with the addition of a %expected statement, the compiler generates from +source with no warnings. + +Fixed a possible segment fault in the disassembler if the input filename +does not contain a "dot" extension (Thomas Renninger). + +---------------------------------------- +21 October 2005. Summary of changes for version 20051021: + +1) ACPI CA Core Subsystem: + +Implemented support for the EM64T and other x86-64 processors. This +essentially entails recognizing that these processors support non-aligned +memory transfers. Previously, all 64-bit processors were assumed to lack +hardware support for non-aligned transfers. + +Completed conversion of the Resource Manager to nearly full table-driven +operation. Specifically, the resource conversion code (convert AML to +internal format and the reverse) and the debug code to dump internal +resource descriptors are fully table-driven, reducing code and data size and +improving maintainability. + +The OSL interfaces for Acquire and Release Lock now use a 64-bit flag word +on 64-bit processors instead of a fixed 32-bit word. (With assistance from +Alexey Starikovskiy) + +Implemented support within the resource conversion code for the Type- +Specific byte within the various ACPI 3.0 *WordSpace macros. + +Fixed some issues within the resource conversion code for the type-specific +flags for both Memory and I/O address resource descriptors. For Memory, +implemented support for the MTP and TTP flags. For I/O, split the TRS and +TTP flags into two separate fields. + +Code and Data Size: The current and previous library sizes for the core +subsystem are shown below. These are the code and data sizes for the +acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. These +values do not include any ACPI driver or OSPM code. The debug version of the +code includes the debug output trace mechanism and has a much larger code +and data size. Note that these values will vary depending on the efficiency +of the compiler and the compiler options used during generation. + + Previous Release: + Non-Debug Version: 77.1K Code, 12.1K Data, 89.2K Total + Debug Version: 168.0K Code, 68.3K Data, 236.3K Total + Current Release: + Non-Debug Version: 76.1K Code, 12.2K Data, 88.3K Total + Debug Version: 163.5K Code, 67.0K Data, 230.5K Total + + + +2) iASL Compiler/Disassembler: + +Relaxed a compiler restriction that disallowed a ResourceIndex byte if the +corresponding ResourceSource string was not also present in a resource +descriptor declaration. This restriction caused problems with existing +AML/ASL code that includes the Index byte without the string. When such AML +was disassembled, it could not be compiled without modification. Further, +the modified code created a resource template with a different size than the +original, breaking code that used fixed offsets into the resource template +buffer. + +Removed a recent feature of the disassembler to ignore a lone ResourceIndex +byte. This byte is now emitted if present so that the exact AML can be +reproduced when the disassembled code is recompiled. + +Improved comments and text alignment for the resource descriptor code +emitted by the disassembler. + +Implemented disassembler support for the ACPI 3.0 AccessSize field within a +Register() resource descriptor. + +---------------------------------------- +30 September 2005. Summary of changes for version 20050930: + +1) ACPI CA Core Subsystem: + +Completed a major overhaul of the Resource Manager code - specifically, +optimizations in the area of the AML/internal resource conversion code. The +code has been optimized to simplify and eliminate duplicated code, CPU stack +use has been decreased by optimizing function parameters and local +variables, and naming conventions across the manager have been standardized +for clarity and ease of maintenance (this includes function, parameter, +variable, and struct/typedef names.) The update may force changes in some +driver code, depending on how resources are handled by the host OS. + +All Resource Manager dispatch and information tables have been moved to a +single location for clarity and ease of maintenance. One new file was +created, named "rsinfo.c". + +The ACPI return macros (return_ACPI_STATUS, etc.) have been modified to +guarantee that the argument is not evaluated twice, making them less prone +to macro side-effects. However, since there exists the possibility of +additional stack use if a particular compiler cannot optimize them (such as +in the debug generation case), the original macros are optionally available. +Note that some invocations of the return_VALUE macro may now cause size +mismatch warnings; the return_UINT8 and return_UINT32 macros are provided to +eliminate these. (From Randy Dunlap) + +Implemented a new mechanism to enable debug tracing for individual control +methods. A new external interface, AcpiDebugTrace, is provided to enable +this mechanism. The intent is to allow the host OS to easily enable and +disable tracing for problematic control methods. This interface can be +easily exposed to a user or debugger interface if desired. See the file +psxface.c for details. + +AcpiUtCallocate will now return a valid pointer if a length of zero is +specified - a length of one is used and a warning is issued. This matches +the behavior of AcpiUtAllocate. + +Code and Data Size: The current and previous library sizes for the core +subsystem are shown below. These are the code and data sizes for the +acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. These +values do not include any ACPI driver or OSPM code. The debug version of the +code includes the debug output trace mechanism and has a much larger code +and data size. Note that these values will vary depending on the efficiency +of the compiler and the compiler options used during generation. + + Previous Release: + Non-Debug Version: 77.5K Code, 12.0K Data, 89.5K Total + Debug Version: 168.1K Code, 68.4K Data, 236.5K Total + Current Release: + Non-Debug Version: 77.1K Code, 12.1K Data, 89.2K Total + Debug Version: 168.0K Code, 68.3K Data, 236.3K Total + + +2) iASL Compiler/Disassembler: + +A remark is issued if the effective compile-time length of a package or +buffer is zero. Previously, this was a warning. + +---------------------------------------- +16 September 2005. Summary of changes for version 20050916: + +1) ACPI CA Core Subsystem: + +Fixed a problem within the Resource Manager where support for the Generic +Register descriptor was not fully implemented. This descriptor is now fully +recognized, parsed, disassembled, and displayed. + +Completely restructured the Resource Manager code to utilize table-driven +dispatch and lookup, eliminating many of the large switch() statements. This +reduces overall subsystem code size and code complexity. Affects the +resource parsing and construction, disassembly, and debug dump output. + +Cleaned up and restructured the debug dump output for all resource +descriptors. Improved readability of the output and reduced code size. + +Fixed a problem where changes to internal data structures caused the +optional ACPI_MUTEX_DEBUG code to fail compilation if specified. + +Code and Data Size: The current and previous library sizes for the core +subsystem are shown below. These are the code and data sizes for the +acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. These +values do not include any ACPI driver or OSPM code. The debug version of the +code includes the debug output trace mechanism and has a much larger code +and data size. Note that these values will vary depending on the efficiency +of the compiler and the compiler options used during generation. + + Previous Release: + Non-Debug Version: 78.4K Code, 11.8K Data, 90.2K Total + Debug Version: 169.6K Code, 69.9K Data, 239.5K Total + Current Release: + Non-Debug Version: 77.5K Code, 12.0K Data, 89.5K Total + Debug Version: 168.1K Code, 68.4K Data, 236.5K Total + + +2) iASL Compiler/Disassembler: + +Updated the disassembler to automatically insert an EndDependentFn() macro +into the ASL stream if this macro is missing in the original AML code, +simplifying compilation of the resulting ASL module. + +Fixed a problem in the disassembler where a disassembled ResourceSource +string (within a large resource descriptor) was not surrounded by quotes and +not followed by a comma, causing errors when the resulting ASL module was +compiled. Also, escape sequences within a ResourceSource string are now +handled correctly (especially "\\") + +---------------------------------------- +02 September 2005. Summary of changes for version 20050902: + +1) ACPI CA Core Subsystem: + +Fixed a problem with the internal Owner ID allocation and deallocation +mechanisms for control method execution and recursive method invocation. +This should eliminate the OWNER_ID_LIMIT exceptions and "Invalid OwnerId" +messages seen on some systems. Recursive method invocation depth is +currently limited to 255. (Alexey Starikovskiy) + +Completely eliminated all vestiges of support for the "module-level +executable code" until this support is fully implemented and debugged. This +should eliminate the NO_RETURN_VALUE exceptions seen during table load on +some systems that invoke this support. + +Fixed a problem within the resource manager code where the transaction flags +for a 64-bit address descriptor were handled incorrectly in the type- +specific flag byte. + +Consolidated duplicate code within the address descriptor resource manager +code, reducing overall subsystem code size. + +Fixed a fault when using the AML debugger "disassemble" command to +disassemble individual control methods. + +Removed references to the "release_current" directory within the Unix +release package. + +Code and Data Size: The current and previous core subsystem library sizes +are shown below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler. These values do not +include any ACPI driver or OSPM code. The debug version of the code includes +the debug output trace mechanism and has a much larger code and data size. +Note that these values will vary depending on the efficiency of the compiler +and the compiler options used during generation. + + Previous Release: + Non-Debug Version: 78.6K Code, 11.7K Data, 90.3K Total + Debug Version: 170.0K Code, 69.9K Data, 239.9K Total + Current Release: + Non-Debug Version: 78.4K Code, 11.8K Data, 90.2K Total + Debug Version: 169.6K Code, 69.9K Data, 239.5K Total + + +2) iASL Compiler/Disassembler: + +Implemented an error check for illegal duplicate values in the interrupt and +dma lists for the following ASL macros: Dma(), Irq(), IrqNoFlags(), and +Interrupt(). + +Implemented error checking for the Irq() and IrqNoFlags() macros to detect +too many values in the interrupt list (16 max) and invalid values in the +list (range 0 - 15) + +The maximum length string literal within an ASL file is now restricted to +200 characters as per the ACPI specification. + +Fixed a fault when using the -ln option (generate namespace listing). + +Implemented an error check to determine if a DescriptorName within a +resource descriptor has already been used within the current scope. + +---------------------------------------- +15 August 2005. Summary of changes for version 20050815: + +1) ACPI CA Core Subsystem: + +Implemented a full bytewise compare to determine if a table load request is +attempting to load a duplicate table. The compare is performed if the table +signatures and table lengths match. This will allow different tables with +the same OEM Table ID and revision to be loaded - probably against the ACPI +specification, but discovered in the field nonetheless. + +Added the changes.txt logfile to each of the zipped release packages. + +Code and Data Size: Current and previous core subsystem library sizes are +shown below. These are the code and data sizes for the acpica.lib produced +by the Microsoft Visual C++ 6.0 compiler, and these values do not include +any ACPI driver or OSPM code. The debug version of the code includes the +debug output trace mechanism and has a much larger code and data size. Note +that these values will vary depending on the efficiency of the compiler and +the compiler options used during generation. + + Previous Release: + Non-Debug Version: 78.6K Code, 11.7K Data, 90.3K Total + Debug Version: 167.0K Code, 69.9K Data, 236.9K Total + Current Release: + Non-Debug Version: 78.6K Code, 11.7K Data, 90.3K Total + Debug Version: 170.0K Code, 69.9K Data, 239.9K Total + + +2) iASL Compiler/Disassembler: + +Fixed a problem where incorrect AML code could be generated for Package +objects if optimization is disabled (via the -oa switch). + +Fixed a problem with where incorrect AML code is generated for variable- +length packages when the package length is not specified and the number of +initializer values is greater than 255. + + +---------------------------------------- +29 July 2005. Summary of changes for version 20050729: + +1) ACPI CA Core Subsystem: + +Implemented support to ignore an attempt to install/load a particular ACPI +table more than once. Apparently there exists BIOS code that repeatedly +attempts to load the same SSDT upon certain events. With assistance from +Venkatesh Pallipadi. + +Restructured the main interface to the AML parser in order to correctly +handle all exceptional conditions. This will prevent leakage of the OwnerId +resource and should eliminate the AE_OWNER_ID_LIMIT exceptions seen on some +machines. With assistance from Alexey Starikovskiy. + +Support for "module level code" has been disabled in this version due to a +number of issues that have appeared on various machines. The support can be +enabled by defining ACPI_ENABLE_MODULE_LEVEL_CODE during subsystem +compilation. When the issues are fully resolved, the code will be enabled by +default again. + +Modified the internal functions for debug print support to define the +FunctionName parameter as a (const char *) for compatibility with compiler +built-in macros such as __FUNCTION__, etc. + +Linted the entire ACPICA source tree for both 32-bit and 64-bit. + +Implemented support to display an object count summary for the AML Debugger +commands Object and Methods. + +Code and Data Size: Current and previous core subsystem library sizes are +shown below. These are the code and data sizes for the acpica.lib produced +by the Microsoft Visual C++ 6.0 compiler, and these values do not include +any ACPI driver or OSPM code. The debug version of the code includes the +debug output trace mechanism and has a much larger code and data size. Note +that these values will vary depending on the efficiency of the compiler and +the compiler options used during generation. + + Previous Release: + Non-Debug Version: 78.6K Code, 11.6K Data, 90.2K Total + Debug Version: 170.0K Code, 69.7K Data, 239.7K Total + Current Release: + Non-Debug Version: 78.6K Code, 11.7K Data, 90.3K Total + Debug Version: 167.0K Code, 69.9K Data, 236.9K Total + + +2) iASL Compiler/Disassembler: + +Fixed a regression that appeared in the 20050708 version of the compiler +where an error message was inadvertently emitted for invocations of the _OSI +reserved control method. + +---------------------------------------- +08 July 2005. Summary of changes for version 20050708: + +1) ACPI CA Core Subsystem: + +The use of the CPU stack in the debug version of the subsystem has been +considerably reduced. Previously, a debug structure was declared in every +function that used the debug macros. This structure has been removed in +favor of declaring the individual elements as parameters to the debug +functions. This reduces the cumulative stack use during nested execution of +ACPI function calls at the cost of a small increase in the code size of the +debug version of the subsystem. With assistance from Alexey Starikovskiy and +Len Brown. + +Added the ACPI_GET_FUNCTION_NAME macro to enable the compiler-dependent +headers to define a macro that will return the current function name at +runtime (such as __FUNCTION__ or _func_, etc.) The function name is used by +the debug trace output. If ACPI_GET_FUNCTION_NAME is not defined in the +compiler-dependent header, the function name is saved on the CPU stack (one +pointer per function.) This mechanism is used because apparently there +exists no standard ANSI-C defined macro that that returns the function name. + +Redesigned and reimplemented the "Owner ID" mechanism used to track +namespace objects created/deleted by ACPI tables and control method +execution. A bitmap is now used to allocate and free the IDs, thus solving +the wraparound problem present in the previous implementation. The size of +the namespace node descriptor was reduced by 2 bytes as a result (Alexey +Starikovskiy). + +Removed the UINT32_BIT and UINT16_BIT types that were used for the bitfield +flag definitions within the headers for the predefined ACPI tables. These +have been replaced by UINT8_BIT in order to increase the code portability of +the subsystem. If the use of UINT8 remains a problem, we may be forced to +eliminate bitfields entirely because of a lack of portability. + +Enhanced the performance of the AcpiUtUpdateObjectReference procedure. This +is a frequently used function and this improvement increases the performance +of the entire subsystem (Alexey Starikovskiy). + +Fixed several possible memory leaks and the inverse - premature object +deletion (Alexey Starikovskiy). + +Code and Data Size: Current and previous core subsystem library sizes are +shown below. These are the code and data sizes for the acpica.lib produced +by the Microsoft Visual C++ 6.0 compiler, and these values do not include +any ACPI driver or OSPM code. The debug version of the code includes the +debug output trace mechanism and has a much larger code and data size. Note +that these values will vary depending on the efficiency of the compiler and +the compiler options used during generation. + + Previous Release: + Non-Debug Version: 78.6K Code, 11.5K Data, 90.1K Total + Debug Version: 165.2K Code, 69.6K Data, 234.8K Total + Current Release: + Non-Debug Version: 78.6K Code, 11.6K Data, 90.2K Total + Debug Version: 170.0K Code, 69.7K Data, 239.7K Total + +---------------------------------------- +24 June 2005. Summary of changes for version 20050624: + +1) ACPI CA Core Subsystem: + +Modified the new OSL cache interfaces to use ACPI_CACHE_T as the type for +the host-defined cache object. This allows the OSL implementation to define +and type this object in any manner desired, simplifying the OSL +implementation. For example, ACPI_CACHE_T is defined as kmem_cache_t for +Linux, and should be defined in the OS-specific header file for other +operating systems as required. + +Changed the interface to AcpiOsAcquireObject to directly return the +requested object as the function return (instead of ACPI_STATUS.) This +change was made for performance reasons, since this is the purpose of the +interface in the first place. AcpiOsAcquireObject is now similar to the +AcpiOsAllocate interface. + +Implemented a new AML debugger command named Businfo. This command displays +information about all devices that have an associate _PRT object. The _ADR, +_HID, _UID, and _CID are displayed for these devices. + +Modified the initialization sequence in AcpiInitializeSubsystem to call the +OSL interface AcpiOslInitialize first, before any local initialization. This +change was required because the global initialization now calls OSL +interfaces. + +Enhanced the Dump command to display the entire contents of Package objects +(including all sub-objects and their values.) + +Restructured the code base to split some files because of size and/or +because the code logically belonged in a separate file. New files are listed +below. All makefiles and project files included in the ACPI CA release have +been updated. + utilities/utcache.c /* Local cache interfaces */ + utilities/utmutex.c /* Local mutex support */ + utilities/utstate.c /* State object support */ + interpreter/parser/psloop.c /* Main AML parse loop */ + +Code and Data Size: Current and previous core subsystem library sizes are +shown below. These are the code and data sizes for the acpica.lib produced +by the Microsoft Visual C++ 6.0 compiler, and these values do not include +any ACPI driver or OSPM code. The debug version of the code includes the +debug output trace mechanism and has a much larger code and data size. Note +that these values will vary depending on the efficiency of the compiler and +the compiler options used during generation. + + Previous Release: + Non-Debug Version: 78.3K Code, 11.6K Data, 89.9K Total + Debug Version: 164.0K Code, 69.1K Data, 233.1K Total + Current Release: + Non-Debug Version: 78.6K Code, 11.5K Data, 90.1K Total + Debug Version: 165.2K Code, 69.6K Data, 234.8K Total + + +2) iASL Compiler/Disassembler: + +Fixed a regression introduced in version 20050513 where the use of a Package +object within a Case() statement caused a compile time exception. The +original behavior has been restored (a Match() operator is emitted.) + +---------------------------------------- +17 June 2005. Summary of changes for version 20050617: + +1) ACPI CA Core Subsystem: + +Moved the object cache operations into the OS interface layer (OSL) to allow +the host OS to handle these operations if desired (for example, the Linux +OSL will invoke the slab allocator). This support is optional; the compile +time define ACPI_USE_LOCAL_CACHE may be used to utilize the original cache +code in the ACPI CA core. The new OSL interfaces are shown below. See +utalloc.c for an example implementation, and acpiosxf.h for the exact +interface definitions. With assistance from Alexey Starikovskiy. + AcpiOsCreateCache + AcpiOsDeleteCache + AcpiOsPurgeCache + AcpiOsAcquireObject + AcpiOsReleaseObject + +Modified the interfaces to AcpiOsAcquireLock and AcpiOsReleaseLock to return +and restore a flags parameter. This fits better with many OS lock models. +Note: the current execution state (interrupt handler or not) is no longer +passed to these interfaces. If necessary, the OSL must determine this state +by itself, a simple and fast operation. With assistance from Alexey +Starikovskiy. + +Fixed a problem in the ACPI table handling where a valid XSDT was assumed +present if the revision of the RSDP was 2 or greater. According to the ACPI +specification, the XSDT is optional in all cases, and the table manager +therefore now checks for both an RSDP >=2 and a valid XSDT pointer. +Otherwise, the RSDT pointer is used. Some ACPI 2.0 compliant BIOSs contain +only the RSDT. + +Fixed an interpreter problem with the Mid() operator in the case of an input +string where the resulting output string is of zero length. It now correctly +returns a valid, null terminated string object instead of a string object +with a null pointer. + +Fixed a problem with the control method argument handling to allow a store +to an Arg object that already contains an object of type Device. The Device +object is now correctly overwritten. Previously, an error was returned. + + +Enhanced the debugger Find command to emit object values in addition to the +found object pathnames. The output format is the same as the dump namespace +command. + +Enhanced the debugger Set command. It now has the ability to set the value +of any Named integer object in the namespace (Previously, only method locals +and args could be set.) + +Code and Data Size: Current and previous core subsystem library sizes are +shown below. These are the code and data sizes for the acpica.lib produced +by the Microsoft Visual C++ 6.0 compiler, and these values do not include +any ACPI driver or OSPM code. The debug version of the code includes the +debug output trace mechanism and has a much larger code and data size. Note +that these values will vary depending on the efficiency of the compiler and +the compiler options used during generation. + + Previous Release: + Non-Debug Version: 78.1K Code, 11.6K Data, 89.7K Total + Debug Version: 164.0K Code, 69.3K Data, 233.3K Total + Current Release: + Non-Debug Version: 78.3K Code, 11.6K Data, 89.9K Total + Debug Version: 164.0K Code, 69.1K Data, 233.1K Total + + +2) iASL Compiler/Disassembler: + +Fixed a regression in the disassembler where if/else/while constructs were +output incorrectly. This problem was introduced in the previous release +(20050526). This problem also affected the single-step disassembly in the +debugger. + +Fixed a problem where compiling the reserved _OSI method would randomly (but +rarely) produce compile errors. + +Enhanced the disassembler to emit compilable code in the face of incorrect +AML resource descriptors. If the optional ResourceSourceIndex is present, +but the ResourceSource is not, do not emit the ResourceSourceIndex in the +disassembly. Otherwise, the resulting code cannot be compiled without +errors. + +---------------------------------------- +26 May 2005. Summary of changes for version 20050526: + +1) ACPI CA Core Subsystem: + +Implemented support to execute Type 1 and Type 2 AML opcodes appearing at +the module level (not within a control method.) These opcodes are executed +exactly once at the time the table is loaded. This type of code was legal up +until the release of ACPI 2.0B (2002) and is now supported within ACPI CA in +order to provide backwards compatibility with earlier BIOS implementations. +This eliminates the "Encountered executable code at module level" warning +that was previously generated upon detection of such code. + +Fixed a problem in the interpreter where an AE_NOT_FOUND exception could +inadvertently be generated during the lookup of namespace objects in the +second pass parse of ACPI tables and control methods. It appears that this +problem could occur during the resolution of forward references to namespace +objects. + +Added the ACPI_MUTEX_DEBUG #ifdef to the AcpiUtReleaseMutex function, +corresponding to the same #ifdef in the AcpiUtAcquireMutex function. This +allows the deadlock detection debug code to be compiled out in the normal +case, improving mutex performance (and overall subsystem performance) +considerably. + +Implemented a handful of miscellaneous fixes for possible memory leaks on +error conditions and error handling control paths. These fixes were +suggested by FreeBSD and the Coverity Prevent source code analysis tool. + +Added a check for a null RSDT pointer in AcpiGetFirmwareTable (tbxfroot.c) +to prevent a fault in this error case. + +Code and Data Size: Current and previous core subsystem library sizes are +shown below. These are the code and data sizes for the acpica.lib produced +by the Microsoft Visual C++ 6.0 compiler, and these values do not include +any ACPI driver or OSPM code. The debug version of the code includes the +debug output trace mechanism and has a much larger code and data size. Note +that these values will vary depending on the efficiency of the compiler and +the compiler options used during generation. + + Previous Release: + Non-Debug Version: 78.2K Code, 11.6K Data, 89.8K Total + Debug Version: 163.7K Code, 69.3K Data, 233.0K Total + Current Release: + Non-Debug Version: 78.1K Code, 11.6K Data, 89.7K Total + Debug Version: 164.0K Code, 69.3K Data, 233.3K Total + + +2) iASL Compiler/Disassembler: + +Implemented support to allow Type 1 and Type 2 ASL operators to appear at +the module level (not within a control method.) These operators will be +executed once at the time the table is loaded. This type of code was legal +up until the release of ACPI 2.0B (2002) and is now supported by the iASL +compiler in order to provide backwards compatibility with earlier BIOS ASL +code. + +The ACPI integer width (specified via the table revision ID or the -r +override, 32 or 64 bits) is now used internally during compile-time constant +folding to ensure that constants are truncated to 32 bits if necessary. +Previously, the revision ID value was only emitted in the AML table header. + +An error message is now generated for the Mutex and Method operators if the +SyncLevel parameter is outside the legal range of 0 through 15. + +Fixed a problem with the Method operator ParameterTypes list handling (ACPI +3.0). Previously, more than 2 types or 2 arguments generated a syntax error. +The actual underlying implementation of method argument typechecking is +still under development, however. + +---------------------------------------- +13 May 2005. Summary of changes for version 20050513: + +1) ACPI CA Core Subsystem: + +Implemented support for PCI Express root bridges -- added support for device +PNP0A08 in the root bridge search within AcpiEvPciConfigRegionSetup. + +The interpreter now automatically truncates incoming 64-bit constants to 32 +bits if currently executing out of a 32-bit ACPI table (Revision < 2). This +also affects the iASL compiler constant folding. (Note: as per below, the +iASL compiler no longer allows 64-bit constants within 32-bit tables.) + +Fixed a problem where string and buffer objects with "static" pointers +(pointers to initialization data within an ACPI table) were not handled +consistently. The internal object copy operation now always copies the data +to a newly allocated buffer, regardless of whether the source object is +static or not. + +Fixed a problem with the FromBCD operator where an implicit result +conversion was improperly performed while storing the result to the target +operand. Since this is an "explicit conversion" operator, the implicit +conversion should never be performed on the output. + +Fixed a problem with the CopyObject operator where a copy to an existing +named object did not always completely overwrite the existing object stored +at name. Specifically, a buffer-to-buffer copy did not delete the existing +buffer. + +Replaced "InterruptLevel" with "InterruptNumber" in all GPE interfaces and +structs for consistency. + +Code and Data Size: Current and previous core subsystem library sizes are +shown below. These are the code and data sizes for the acpica.lib produced +by the Microsoft Visual C++ 6.0 compiler, and these values do not include +any ACPI driver or OSPM code. The debug version of the code includes the +debug output trace mechanism and has a much larger code and data size. Note +that these values will vary depending on the efficiency of the compiler and +the compiler options used during generation. + + Previous Release: + Non-Debug Version: 78.2K Code, 11.6K Data, 89.8K Total + Debug Version: 163.7K Code, 69.3K Data, 233.0K Total + Current Release: (Same sizes) + Non-Debug Version: 78.2K Code, 11.6K Data, 89.8K Total + Debug Version: 163.7K Code, 69.3K Data, 233.0K Total + + +2) iASL Compiler/Disassembler: + +The compiler now emits a warning if an attempt is made to generate a 64-bit +integer constant from within a 32-bit ACPI table (Revision < 2). The integer +is truncated to 32 bits. + +Fixed a problem with large package objects: if the static length of the +package is greater than 255, the "variable length package" opcode is +emitted. Previously, this caused an error. This requires an update to the +ACPI spec, since it currently (incorrectly) states that packages larger than +255 elements are not allowed. + +The disassembler now correctly handles variable length packages and packages +larger than 255 elements. + +---------------------------------------- +08 April 2005. Summary of changes for version 20050408: + +1) ACPI CA Core Subsystem: + +Fixed three cases in the interpreter where an "index" argument to an ASL +function was still (internally) 32 bits instead of the required 64 bits. +This was the Index argument to the Index, Mid, and Match operators. + +The "strupr" function is now permanently local (AcpiUtStrupr), since this is +not a POSIX-defined function and not present in most kernel-level C +libraries. All references to the C library strupr function have been removed +from the headers. + +Completed the deployment of static functions/prototypes. All prototypes with +the static attribute have been moved from the headers to the owning C file. + +Implemented an extract option (-e) for the AcpiBin utility (AML binary +utility). This option allows the utility to extract individual ACPI tables +from the output of AcpiDmp. It provides the same functionality of the +acpixtract.pl perl script without the worry of setting the correct perl +options. AcpiBin runs on Windows and has not yet been generated/validated in +the Linux/Unix environment (but should be soon). + +Updated and fixed the table dump option for AcpiBin (-d). This option +converts a single ACPI table to a hex/ascii file, similar to the output of +AcpiDmp. + +Code and Data Size: Current and previous core subsystem library sizes are +shown below. These are the code and data sizes for the acpica.lib produced +by the Microsoft Visual C++ 6.0 compiler, and these values do not include +any ACPI driver or OSPM code. The debug version of the code includes the +debug output trace mechanism and has a much larger code and data size. Note +that these values will vary depending on the efficiency of the compiler and +the compiler options used during generation. + + Previous Release: + Non-Debug Version: 78.0K Code, 11.6K Data, 89.6K Total + Debug Version: 163.5K Code, 69.3K Data, 232.8K Total + Current Release: + Non-Debug Version: 78.2K Code, 11.6K Data, 89.8K Total + Debug Version: 163.7K Code, 69.3K Data, 233.0K Total + + +2) iASL Compiler/Disassembler: + +Disassembler fix: Added a check to ensure that the table length found in the +ACPI table header within the input file is not longer than the actual input +file size. This indicates some kind of file or table corruption. + +---------------------------------------- +29 March 2005. Summary of changes for version 20050329: + +1) ACPI CA Core Subsystem: + +An error is now generated if an attempt is made to create a Buffer Field of +length zero (A CreateField with a length operand of zero.) + +The interpreter now issues a warning whenever executable code at the module +level is detected during ACPI table load. This will give some idea of the +prevalence of this type of code. + +Implemented support for references to named objects (other than control +methods) within package objects. + +Enhanced package object output for the debug object. Package objects are now +completely dumped, showing all elements. + +Enhanced miscellaneous object output for the debug object. Any object can +now be written to the debug object (for example, a device object can be +written, and the type of the object will be displayed.) + +The "static" qualifier has been added to all local functions across both the +core subsystem and the iASL compiler. + +The number of "long" lines (> 80 chars) within the source has been +significantly reduced, by about 1/3. + +Cleaned up all header files to ensure that all CA/iASL functions are +prototyped (even static functions) and the formatting is consistent. + +Two new header files have been added, acopcode.h and acnames.h. + +Removed several obsolete functions that were no longer used. + +Code and Data Size: Current and previous core subsystem library sizes are +shown below. These are the code and data sizes for the acpica.lib produced +by the Microsoft Visual C++ 6.0 compiler, and these values do not include +any ACPI driver or OSPM code. The debug version of the code includes the +debug output trace mechanism and has a much larger code and data size. Note +that these values will vary depending on the efficiency of the compiler and +the compiler options used during generation. + + Previous Release: + Non-Debug Version: 78.3K Code, 11.5K Data, 89.8K Total + Debug Version: 165.4K Code, 69.7K Data, 236.1K Total + Current Release: + Non-Debug Version: 78.0K Code, 11.6K Data, 89.6K Total + Debug Version: 163.5K Code, 69.3K Data, 232.8K Total + + + +2) iASL Compiler/Disassembler: + +Fixed a problem with the resource descriptor generation/support. For the +ResourceSourceIndex and the ResourceSource fields, both must be present, or +both must be not present - can't have one without the other. + +The compiler now returns non-zero from the main procedure if any errors have +occurred during the compilation. + + +---------------------------------------- +09 March 2005. Summary of changes for version 20050309: + +1) ACPI CA Core Subsystem: + +The string-to-buffer implicit conversion code has been modified again after +a change to the ACPI specification. In order to match the behavior of the +other major ACPI implementation, the target buffer is no longer truncated if +the source string is smaller than an existing target buffer. This change +requires an update to the ACPI spec, and should eliminate the recent +AE_AML_BUFFER_LIMIT issues. + +The "implicit return" support was rewritten to a new algorithm that solves +the general case. Rather than attempt to determine when a method is about to +exit, the result of every ASL operator is saved momentarily until the very +next ASL operator is executed. Therefore, no matter how the method exits, +there will always be a saved implicit return value. This feature is only +enabled with the AcpiGbl_EnableInterpreterSlack flag, and should eliminate +AE_AML_NO_RETURN_VALUE errors when enabled. + +Implemented implicit conversion support for the predicate (operand) of the +If, Else, and While operators. String and Buffer arguments are automatically +converted to Integers. + +Changed the string-to-integer conversion behavior to match the new ACPI +errata: "If no integer object exists, a new integer is created. The ASCII +string is interpreted as a hexadecimal constant. Each string character is +interpreted as a hexadecimal value ('0'-'9', 'A'-'F', 'a', 'f'), starting +with the first character as the most significant digit, and ending with the +first non-hexadecimal character or end-of-string." This means that the first +non-hex character terminates the conversion and this is the code that was +changed. + +Fixed a problem where the ObjectType operator would fail (fault) when used +on an Index of a Package which pointed to a null package element. The +operator now properly returns zero (Uninitialized) in this case. + +Fixed a problem where the While operator used excessive memory by not +properly popping the result stack during execution. There was no memory leak +after execution, however. (Code provided by Valery Podrezov.) + +Fixed a problem where references to control methods within Package objects +caused the method to be invoked, instead of producing a reference object +pointing to the method. + +Restructured and simplified the pswalk.c module (AcpiPsDeleteParseTree) to +improve performance and reduce code size. (Code provided by Alexey +Starikovskiy.) + +Code and Data Size: Current and previous core subsystem library sizes are +shown below. These are the code and data sizes for the acpica.lib produced +by the Microsoft Visual C++ 6.0 compiler, and these values do not include +any ACPI driver or OSPM code. The debug version of the code includes the +debug output trace mechanism and has a much larger code and data size. Note +that these values will vary depending on the efficiency of the compiler and +the compiler options used during generation. + + Previous Release: + Non-Debug Version: 78.3K Code, 11.5K Data, 89.8K Total + Debug Version: 165.4K Code, 69.6K Data, 236.0K Total + Current Release: + Non-Debug Version: 78.3K Code, 11.5K Data, 89.8K Total + Debug Version: 165.4K Code, 69.7K Data, 236.1K Total + + +2) iASL Compiler/Disassembler: + +Fixed a problem with the Return operator with no arguments. Since the AML +grammar for the byte encoding requires an operand for the Return opcode, the +compiler now emits a Return(Zero) for this case. An ACPI specification +update has been written for this case. + +For tables other than the DSDT, namepath optimization is automatically +disabled. This is because SSDTs can be loaded anywhere in the namespace, the +compiler has no knowledge of where, and thus cannot optimize namepaths. + +Added "ProcessorObj" to the ObjectTypeKeyword list. This object type was +inadvertently omitted from the ACPI specification, and will require an +update to the spec. + +The source file scan for ASCII characters is now optional (-a). This change +was made because some vendors place non-ascii characters within comments. +However, the scan is simply a brute-force byte compare to ensure all +characters in the file are in the range 0x00 to 0x7F. + +Fixed a problem with the CondRefOf operator where the compiler was +inappropriately checking for the existence of the target. Since the point of +the operator is to check for the existence of the target at run-time, the +compiler no longer checks for the target existence. + +Fixed a problem where errors generated from the internal AML interpreter +during constant folding were not handled properly, causing a fault. + +Fixed a problem with overly aggressive range checking for the Stall +operator. The valid range (max 255) is now only checked if the operand is of +type Integer. All other operand types cannot be statically checked. + +Fixed a problem where control method references within the RefOf, DeRefOf, +and ObjectType operators were not treated properly. They are now treated as +actual references, not method invocations. + +Fixed and enhanced the "list namespace" option (-ln). This option was broken +a number of releases ago. + +Improved error handling for the Field, IndexField, and BankField operators. +The compiler now cleanly reports and recovers from errors in the field +component (FieldUnit) list. + +Fixed a disassembler problem where the optional ResourceDescriptor fields +TRS and TTP were not always handled correctly. + +Disassembler - Comments in output now use "//" instead of "/*" + +---------------------------------------- +28 February 2005. Summary of changes for version 20050228: + +1) ACPI CA Core Subsystem: + +Fixed a problem where the result of an Index() operator (an object +reference) must increment the reference count on the target object for the +life of the object reference. + +Implemented AML Interpreter and Debugger support for the new ACPI 3.0 +Extended Address (IO, Memory, Space), QwordSpace, DwordSpace, and WordSpace +resource descriptors. + +Implemented support in the _OSI method for the ACPI 3.0 "Extended Address +Space Descriptor" string, indicating interpreter support for the descriptors +above. + +Implemented header support for the new ACPI 3.0 FADT flag bits. + +Implemented header support for the new ACPI 3.0 PCI Express bits for the PM1 +status/enable registers. + +Updated header support for the MADT processor local Apic struct and MADT +platform interrupt source struct for new ACPI 3.0 fields. + +Implemented header support for the SRAT and SLIT ACPI tables. + +Implemented the -s switch in AcpiExec to enable the "InterpreterSlack" flag +at runtime. + +Code and Data Size: Current and previous core subsystem library sizes are +shown below. These are the code and data sizes for the acpica.lib produced +by the Microsoft Visual C++ 6.0 compiler, and these values do not include +any ACPI driver or OSPM code. The debug version of the code includes the +debug output trace mechanism and has a much larger code and data size. Note +that these values will vary depending on the efficiency of the compiler and +the compiler options used during generation. + + Previous Release: + Non-Debug Version: 78.2K Code, 11.5K Data, 89.7K Total + Debug Version: 164.9K Code, 69.2K Data, 234.1K Total + Current Release: + Non-Debug Version: 78.3K Code, 11.5K Data, 89.8K Total + Debug Version: 165.4K Code, 69.6K Data, 236.0K Total + + +2) iASL Compiler/Disassembler: + +Fixed a problem with the internal 64-bit String-to-integer conversion with +strings less than two characters long. + +Fixed a problem with constant folding where the result of the Index() +operator can not be considered a constant. This means that Index() cannot be +a type3 opcode and this will require an update to the ACPI specification. + +Disassembler: Implemented support for the TTP, MTP, and TRS resource +descriptor fields. These fields were inadvertently ignored and not output in +the disassembly of the resource descriptor. + + + ---------------------------------------- +11 February 2005. Summary of changes for version 20050211: + +1) ACPI CA Core Subsystem: + +Implemented ACPI 3.0 support for implicit conversion within the Match() +operator. MatchObjects can now be of type integer, buffer, or string instead +of just type integer. Package elements are implicitly converted to the type +of the MatchObject. This change aligns the behavior of Match() with the +behavior of the other logical operators (LLess(), etc.) It also requires an +errata change to the ACPI specification as this support was intended for +ACPI 3.0, but was inadvertently omitted. + +Fixed a problem with the internal implicit "to buffer" conversion. Strings +that are converted to buffers will cause buffer truncation if the string is +smaller than the target buffer. Integers that are converted to buffers will +not cause buffer truncation, only zero extension (both as per the ACPI +spec.) The problem was introduced when code was added to truncate the +buffer, but this should not be performed in all cases, only the string case. + +Fixed a problem with the Buffer and Package operators where the interpreter +would get confused if two such operators were used as operands to an ASL +operator (such as LLess(Buffer(1){0},Buffer(1){1}). The internal result +stack was not being popped after the execution of these operators, resulting +in an AE_NO_RETURN_VALUE exception. + +Fixed a problem with constructs of the form Store(Index(...),...). The +reference object returned from Index was inadvertently resolved to an actual +value. This problem was introduced in version 20050114 when the behavior of +Store() was modified to restrict the object types that can be used as the +source operand (to match the ACPI specification.) + +Reduced excessive stack use within the AcpiGetObjectInfo procedure. + +Added a fix to aclinux.h to allow generation of AcpiExec on Linux. + +Updated the AcpiSrc utility to add the FADT_DESCRIPTOR_REV2_MINUS struct. + +Code and Data Size: Current and previous core subsystem library sizes are +shown below. These are the code and data sizes for the acpica.lib produced +by the Microsoft Visual C++ 6.0 compiler, and these values do not include +any ACPI driver or OSPM code. The debug version of the code includes the +debug output trace mechanism and has a much larger code and data size. Note +that these values will vary depending on the efficiency of the compiler and +the compiler options used during generation. + + Previous Release: + Non-Debug Version: 78.1K Code, 11.5K Data, 89.6K Total + Debug Version: 164.8K Code, 69.2K Data, 234.0K Total + Current Release: + Non-Debug Version: 78.2K Code, 11.5K Data, 89.7K Total + Debug Version: 164.9K Code, 69.2K Data, 234.1K Total + + +2) iASL Compiler/Disassembler: + +Fixed a code generation problem in the constant folding optimization code +where incorrect code was generated if a constant was reduced to a buffer +object (i.e., a reduced type 5 opcode.) + +Fixed a typechecking problem for the ToBuffer operator. Caused by an +incorrect return type in the internal opcode information table. + +---------------------------------------- +25 January 2005. Summary of changes for version 20050125: + +1) ACPI CA Core Subsystem: + +Fixed a recently introduced problem with the Global Lock where the +underlying semaphore was not created. This problem was introduced in +version 20050114, and caused an AE_AML_NO_OPERAND exception during an +Acquire() operation on _GL. + +The local object cache is now optional, and is disabled by default. Both +AcpiExec and the iASL compiler enable the cache because they run in user +mode and this enhances their performance. #define ACPI_ENABLE_OBJECT_CACHE +to enable the local cache. + +Fixed an issue in the internal function AcpiUtEvaluateObject concerning the +optional "implicit return" support where an error was returned if no return +object was expected, but one was implicitly returned. AE_OK is now returned +in this case and the implicitly returned object is deleted. +AcpiUtEvaluateObject is only occasionally used, and only to execute reserved +methods such as _STA and _INI where the return type is known up front. + +Fixed a few issues with the internal convert-to-integer code. It now returns +an error if an attempt is made to convert a null string, a string of only +blanks/tabs, or a zero-length buffer. This affects both implicit conversion +and explicit conversion via the ToInteger() operator. + +The internal debug code in AcpiUtAcquireMutex has been commented out. It is +not needed for normal operation and should increase the performance of the +entire subsystem. The code remains in case it is needed for debug purposes +again. + +The AcpiExec source and makefile are included in the Unix/Linux package for +the first time. + +Code and Data Size: Current and previous core subsystem library sizes are +shown below. These are the code and data sizes for the acpica.lib produced +by the Microsoft Visual C++ 6.0 compiler, and these values do not include +any ACPI driver or OSPM code. The debug version of the code includes the +debug output trace mechanism and has a much larger code and data size. Note +that these values will vary depending on the efficiency of the compiler and +the compiler options used during generation. + + Previous Release: + Non-Debug Version: 78.4K Code, 11.5K Data, 89.9K Total + Debug Version: 165.4K Code, 69.4K Data, 234.8K Total + Current Release: + Non-Debug Version: 78.1K Code, 11.5K Data, 89.6K Total + Debug Version: 164.8K Code, 69.2K Data, 234.0K Total + +2) iASL Compiler/Disassembler: + +Switch/Case support: A warning is now issued if the type of the Switch value +cannot be determined at compile time. For example, Switch(Arg0) will +generate the warning, and the type is assumed to be an integer. As per the +ACPI spec, use a construct such as Switch(ToInteger(Arg0)) to eliminate the +warning. + +Switch/Case support: Implemented support for buffer and string objects as +the switch value. This is an ACPI 3.0 feature, now that LEqual supports +buffers and strings. + +Switch/Case support: The emitted code for the LEqual() comparisons now uses +the switch value as the first operand, not the second. The case value is now +the second operand, and this allows the case value to be implicitly +converted to the type of the switch value, not the other way around. + +Switch/Case support: Temporary variables are now emitted immediately within +the control method, not at the global level. This means that there are now +36 temps available per-method, not 36 temps per-module as was the case with +the earlier implementation (_T_0 through _T_9 and _T_A through _T_Z.) + +---------------------------------------- +14 January 2005. Summary of changes for version 20050114: + +Added 2005 copyright to all module headers. This affects every module in +the core subsystem, iASL compiler, and the utilities. + +1) ACPI CA Core Subsystem: + +Fixed an issue with the String-to-Buffer conversion code where the string +null terminator was not included in the buffer after conversion, but there +is existing ASL that assumes the string null terminator is included. This is +the root of the ACPI_AML_BUFFER_LIMIT regression. This problem was +introduced in the previous version when the code was updated to correctly +set the converted buffer size as per the ACPI specification. The ACPI spec +is ambiguous and will be updated to specify that the null terminator must be +included in the converted buffer. This also affects the ToBuffer() ASL +operator. + +Fixed a problem with the Mid() ASL/AML operator where it did not work +correctly on Buffer objects. Newly created sub-buffers were not being marked +as initialized. + + +Fixed a problem in AcpiTbFindTable where incorrect string compares were +performed on the OemId and OemTableId table header fields. These fields are +not null terminated, so strncmp is now used instead of strcmp. + +Implemented a restriction on the Store() ASL/AML operator to align the +behavior with the ACPI specification. Previously, any object could be used +as the source operand. Now, the only objects that may be used are Integers, +Buffers, Strings, Packages, Object References, and DDB Handles. If +necessary, the original behavior can be restored by enabling the +EnableInterpreterSlack flag. + +Enhanced the optional "implicit return" support to allow an implicit return +value from methods that are invoked externally via the AcpiEvaluateObject +interface. This enables implicit returns from the _STA and _INI methods, +for example. + +Changed the Revision() ASL/AML operator to return the current version of the +AML interpreter, in the YYYYMMDD format. Previously, it incorrectly returned +the supported ACPI version (This is the function of the _REV method). + +Updated the _REV predefined method to return the currently supported version +of ACPI, now 3. + +Implemented batch mode option for the AcpiExec utility (-b). + +Code and Data Size: Current and previous core subsystem library sizes are +shown below. These are the code and data sizes for the acpica.lib produced +by the Microsoft Visual C++ 6.0 compiler, and these values do not include +any ACPI driver or OSPM code. The debug version of the code includes the +debug output trace mechanism and has a much larger code and data size. Note +that these values will vary depending on the efficiency of the compiler and +the compiler options used during generation. + + Previous Release: + Non-Debug Version: 78.3K Code, 11.5K Data, 89.8K Total + Debug Version: 165.3K Code, 69.4K Data, 234.7K Total + Current Release: + Non-Debug Version: 78.4K Code, 11.5K Data, 89.9K Total + Debug Version: 165.4K Code, 69.4K Data, 234.8K Total + +---------------------------------------- +10 December 2004. Summary of changes for version 20041210: + +ACPI 3.0 support is nearing completion in both the iASL compiler and the +ACPI CA core subsystem. + +1) ACPI CA Core Subsystem: + +Fixed a problem in the ToDecimalString operator where the resulting string +length was incorrectly calculated. The length is now calculated exactly, +eliminating incorrect AE_STRING_LIMIT exceptions. + +Fixed a problem in the ToHexString operator to allow a maximum 200 character +string to be produced. + +Fixed a problem in the internal string-to-buffer and buffer-to-buffer copy +routine where the length of the resulting buffer was not truncated to the +new size (if the target buffer already existed). + +Code and Data Size: Current and previous core subsystem library sizes are +shown below. These are the code and data sizes for the acpica.lib produced +by the Microsoft Visual C++ 6.0 compiler, and these values do not include +any ACPI driver or OSPM code. The debug version of the code includes the +debug output trace mechanism and has a much larger code and data size. Note +that these values will vary depending on the efficiency of the compiler and +the compiler options used during generation. + + Previous Release: + Non-Debug Version: 78.3K Code, 11.5K Data, 89.8K Total + Debug Version: 164.7K Code, 68.5K Data, 233.2K Total + Current Release: + Non-Debug Version: 78.3K Code, 11.5K Data, 89.8K Total + Debug Version: 165.3K Code, 69.4K Data, 234.7K Total + + +2) iASL Compiler/Disassembler: + +Implemented the new ACPI 3.0 resource template macros - DWordSpace, +ExtendedIO, ExtendedMemory, ExtendedSpace, QWordSpace, and WordSpace. +Includes support in the disassembler. + +Implemented support for the new (ACPI 3.0) parameter to the Register macro, +AccessSize. + +Fixed a problem where the _HE resource name for the Interrupt macro was +referencing bit 0 instead of bit 1. + +Implemented check for maximum 255 interrupts in the Interrupt macro. + +Fixed a problem with the predefined resource descriptor names where +incorrect AML code was generated if the offset within the resource buffer +was 0 or 1. The optimizer shortened the AML code to a single byte opcode +but did not update the surrounding package lengths. + +Changes to the Dma macro: All channels within the channel list must be in +the range 0-7. Maximum 8 channels can be specified. BusMaster operand is +optional (default is BusMaster). + +Implemented check for maximum 7 data bytes for the VendorShort macro. + +The ReadWrite parameter is now optional for the Memory32 and similar macros. + +---------------------------------------- +03 December 2004. Summary of changes for version 20041203: + +1) ACPI CA Core Subsystem: + +The low-level field insertion/extraction code (exfldio) has been completely +rewritten to eliminate unnecessary complexity, bugs, and boundary +conditions. + +Fixed a problem in the ToInteger, ToBuffer, ToHexString, and ToDecimalString +operators where the input operand could be inadvertently deleted if no +conversion was necessary (e.g., if the input to ToInteger was an Integer +object.) + +Fixed a problem with the ToDecimalString and ToHexString where an incorrect +exception code was returned if the resulting string would be > 200 chars. +AE_STRING_LIMIT is now returned. + +Fixed a problem with the Concatenate operator where AE_OK was always +returned, even if the operation failed. + +Fixed a problem in oswinxf (used by AcpiExec and iASL) to allow > 128 +semaphores to be allocated. + +Code and Data Size: Current and previous core subsystem library sizes are +shown below. These are the code and data sizes for the acpica.lib produced +by the Microsoft Visual C++ 6.0 compiler, and these values do not include +any ACPI driver or OSPM code. The debug version of the code includes the +debug output trace mechanism and has a much larger code and data size. Note +that these values will vary depending on the efficiency of the compiler and +the compiler options used during generation. + + Previous Release: + Non-Debug Version: 78.5K Code, 11.5K Data, 90.0K Total + Debug Version: 165.2K Code, 68.6K Data, 233.8K Total + Current Release: + Non-Debug Version: 78.3K Code, 11.5K Data, 89.8K Total + Debug Version: 164.7K Code, 68.5K Data, 233.2K Total + + +2) iASL Compiler/Disassembler: + +Fixed typechecking for the ObjectType and SizeOf operators. Problem was +recently introduced in 20041119. + +Fixed a problem with the ToUUID macro where the upper nybble of each buffer +byte was inadvertently set to zero. + +---------------------------------------- +19 November 2004. Summary of changes for version 20041119: + +1) ACPI CA Core Subsystem: + +Fixed a problem in the internal ConvertToInteger routine where new integers +were not truncated to 32 bits for 32-bit ACPI tables. This routine converts +buffers and strings to integers. + +Implemented support to store a value to an Index() on a String object. This +is an ACPI 2.0 feature that had not yet been implemented. + +Implemented new behavior for storing objects to individual package elements +(via the Index() operator). The previous behavior was to invoke the implicit +conversion rules if an object was already present at the index. The new +behavior is to simply delete any existing object and directly store the new +object. Although the ACPI specification seems unclear on this subject, other +ACPI implementations behave in this manner. (This is the root of the +AE_BAD_HEX_CONSTANT issue.) + +Modified the RSDP memory scan mechanism to support the extended checksum for +ACPI 2.0 (and above) RSDPs. Note that the search continues until a valid +RSDP signature is found with a valid checksum. + +Code and Data Size: Current and previous core subsystem library sizes are +shown below. These are the code and data sizes for the acpica.lib produced +by the Microsoft Visual C++ 6.0 compiler, and these values do not include +any ACPI driver or OSPM code. The debug version of the code includes the +debug output trace mechanism and has a much larger code and data size. Note +that these values will vary depending on the efficiency of the compiler and +the compiler options used during generation. + + Previous Release: + Non-Debug Version: 78.5K Code, 11.5K Data, 90.0K Total + Debug Version: 165.2K Code, 68.6K Data, 233.8K Total + Current Release: + Non-Debug Version: 78.5K Code, 11.5K Data, 90.0K Total + Debug Version: 165.2K Code, 68.6K Data, 233.8K Total + + +2) iASL Compiler/Disassembler: + +Fixed a missing semicolon in the aslcompiler.y file. + +---------------------------------------- +05 November 2004. Summary of changes for version 20041105: + +1) ACPI CA Core Subsystem: + +Implemented support for FADT revision 2. This was an interim table (between +ACPI 1.0 and ACPI 2.0) that adds support for the FADT reset register. + +Implemented optional support to allow uninitialized LocalX and ArgX +variables in a control method. The variables are initialized to an Integer +object with a value of zero. This support is enabled by setting the +AcpiGbl_EnableInterpreterSlack flag to TRUE. + +Implemented support for Integer objects for the SizeOf operator. Either 4 +or 8 is returned, depending on the current integer size (32-bit or 64-bit, +depending on the parent table revision). + +Fixed a problem in the implementation of the SizeOf and ObjectType operators +where the operand was resolved to a value too early, causing incorrect +return values for some objects. + +Fixed some possible memory leaks during exceptional conditions. + +Code and Data Size: Current and previous core subsystem library sizes are +shown below. These are the code and data sizes for the acpica.lib produced +by the Microsoft Visual C++ 6.0 compiler, and these values do not include +any ACPI driver or OSPM code. The debug version of the code includes the +debug output trace mechanism and has a much larger code and data size. Note +that these values will vary depending on the efficiency of the compiler and +the compiler options used during generation. + + Previous Release: + Non-Debug Version: 78.0K Code, 11.5K Data, 89.5K Total + Debug Version: 164.8K Code, 68.6K Data, 233.4K Total + Current Release: + Non-Debug Version: 78.5K Code, 11.5K Data, 90.0K Total + Debug Version: 165.2K Code, 68.6K Data, 233.8K Total + + +2) iASL Compiler/Disassembler: + +Implemented support for all ACPI 3.0 reserved names and methods. + +Implemented all ACPI 3.0 grammar elements in the front-end, including +support for semicolons. + +Implemented the ACPI 3.0 Function() and ToUUID() macros + +Fixed a problem in the disassembler where a Scope() operator would not be +emitted properly if the target of the scope was in another table. + +---------------------------------------- +15 October 2004. Summary of changes for version 20041015: + +Note: ACPI CA is currently undergoing an in-depth and complete formal +evaluation to test/verify the following areas. Other suggestions are +welcome. This will result in an increase in the frequency of releases and +the number of bug fixes in the next few months. + - Functional tests for all ASL/AML operators + - All implicit/explicit type conversions + - Bit fields and operation regions + - 64-bit math support and 32-bit-only "truncated" math support + - Exceptional conditions, both compiler and interpreter + - Dynamic object deletion and memory leaks + - ACPI 3.0 support when implemented + - External interfaces to the ACPI subsystem + + +1) ACPI CA Core Subsystem: + +Fixed two alignment issues on 64-bit platforms - within debug statements in +AcpiEvGpeDetect and AcpiEvCreateGpeBlock. Removed references to the Address +field within the non-aligned ACPI generic address structure. + +Fixed a problem in the Increment and Decrement operators where incorrect +operand resolution could result in the inadvertent modification of the +original integer when the integer is passed into another method as an +argument and the arg is then incremented/decremented. + +Fixed a problem in the FromBCD operator where the upper 32-bits of a 64-bit +BCD number were truncated during conversion. + +Fixed a problem in the ToDecimal operator where the length of the resulting +string could be set incorrectly too long if the input operand was a Buffer +object. + +Fixed a problem in the Logical operators (LLess, etc.) where a NULL byte (0) +within a buffer would prematurely terminate a compare between buffer +objects. + +Added a check for string overflow (>200 characters as per the ACPI +specification) during the Concatenate operator with two string operands. + +Code and Data Size: Current and previous core subsystem library sizes are +shown below. These are the code and data sizes for the acpica.lib produced +by the Microsoft Visual C++ 6.0 compiler, and these values do not include +any ACPI driver or OSPM code. The debug version of the code includes the +debug output trace mechanism and has a much larger code and data size. Note +that these values will vary depending on the efficiency of the compiler and +the compiler options used during generation. + + Previous Release: + Non-Debug Version: 77.8K Code, 11.5K Data, 89.3K Total + Debug Version: 164.6K Code, 68.5K Data, 233.1K Total + Current Release: + Non-Debug Version: 78.0K Code, 11.5K Data, 89.5K Total + Debug Version: 164.8K Code, 68.6K Data, 233.4K Total + + + +2) iASL Compiler/Disassembler: + +Allow the use of the ObjectType operator on uninitialized Locals and Args +(returns 0 as per the ACPI specification). + +Fixed a problem where the compiler would fault if there was a syntax error +in the FieldName of all of the various CreateXXXField operators. + +Disallow the use of lower case letters within the EISAID macro, as per the +ACPI specification. All EISAID strings must be of the form "UUUNNNN" Where +U is an uppercase letter and N is a hex digit. + + +---------------------------------------- +06 October 2004. Summary of changes for version 20041006: + +1) ACPI CA Core Subsystem: + +Implemented support for the ACPI 3.0 Timer operator. This ASL function +implements a 64-bit timer with 100 nanosecond granularity. + +Defined a new OSL interface, AcpiOsGetTimer. This interface is used to +implement the ACPI 3.0 Timer operator. This allows the host OS to implement +the timer with the best clock available. Also, it keeps the core subsystem +out of the clock handling business, since the host OS (usually) performs +this function. + +Fixed an alignment issue on 64-bit platforms. The HwLowLevelRead(Write) +functions use a 64-bit address which is part of the packed ACPI Generic +Address Structure. Since the structure is non-aligned, the alignment macros +are now used to extract the address to a local variable before use. + +Fixed a problem where the ToInteger operator assumed all input strings were +hexadecimal. The operator now handles both decimal strings and hex strings +(prefixed with "0x"). + +Fixed a problem where the string length in the string object created as a +result of the internal ConvertToString procedure could be incorrect. This +potentially affected all implicit conversions and also the ToDecimalString +and ToHexString operators. + +Fixed two problems in the ToString operator. If the length parameter was +zero, an incorrect string object was created and the value of the input +length parameter was inadvertently changed from zero to Ones. + +Fixed a problem where the optional ResourceSource string in the ExtendedIRQ +resource macro was ignored. + +Simplified the interfaces to the internal division functions, reducing code +size and complexity. + +Code and Data Size: Current and previous core subsystem library sizes are +shown below. These are the code and data sizes for the acpica.lib produced +by the Microsoft Visual C++ 6.0 compiler, and these values do not include +any ACPI driver or OSPM code. The debug version of the code includes the +debug output trace mechanism and has a much larger code and data size. Note +that these values will vary depending on the efficiency of the compiler and +the compiler options used during generation. + + Previous Release: + Non-Debug Version: 77.9K Code, 11.4K Data, 89.3K Total + Debug Version: 164.5K Code, 68.3K Data, 232.8K Total + Current Release: + Non-Debug Version: 77.8K Code, 11.5K Data, 89.3K Total + Debug Version: 164.6K Code, 68.5K Data, 233.1K Total + + +2) iASL Compiler/Disassembler: + +Implemented support for the ACPI 3.0 Timer operator. + +Fixed a problem where the Default() operator was inadvertently ignored in a +Switch/Case block. This was a problem in the translation of the Switch +statement to If...Else pairs. + +Added support to allow a standalone Return operator, with no parentheses (or +operands). + +Fixed a problem with code generation for the ElseIf operator where the +translated Else...If parse tree was improperly constructed leading to the +loss of some code. + +---------------------------------------- +22 September 2004. Summary of changes for version 20040922: + +1) ACPI CA Core Subsystem: + +Fixed a problem with the implementation of the LNot() operator where "Ones" +was not returned for the TRUE case. Changed the code to return Ones instead +of (!Arg) which was usually 1. This change affects iASL constant folding for +this operator also. + +Fixed a problem in AcpiUtInitializeBuffer where an existing buffer was not +initialized properly -- Now zero the entire buffer in this case where the +buffer already exists. + +Changed the interface to AcpiOsSleep from (UINT32 Seconds, UINT32 +Milliseconds) to simply (ACPI_INTEGER Milliseconds). This simplifies all +related code considerably. This will require changes/updates to all OS +interface layers (OSLs.) + +Implemented a new external interface, AcpiInstallExceptionHandler, to allow +a system exception handler to be installed. This handler is invoked upon any +run-time exception that occurs during control method execution. + +Added support for the DSDT in AcpiTbFindTable. This allows the +DataTableRegion() operator to access the local copy of the DSDT. + +Code and Data Size: Current and previous core subsystem library sizes are +shown below. These are the code and data sizes for the acpica.lib produced +by the Microsoft Visual C++ 6.0 compiler, and these values do not include +any ACPI driver or OSPM code. The debug version of the code includes the +debug output trace mechanism and has a much larger code and data size. Note +that these values will vary depending on the efficiency of the compiler and +the compiler options used during generation. + + Previous Release: + Non-Debug Version: 77.8K Code, 11.4K Data, 89.2K Total + Debug Version: 164.2K Code, 68.2K Data, 232.4K Total + Current Release: + Non-Debug Version: 77.9K Code, 11.4K Data, 89.3K Total + Debug Version: 164.5K Code, 68.3K Data, 232.8K Total + + +2) iASL Compiler/Disassembler: + +Fixed a problem with constant folding and the LNot operator. LNot was +returning 1 in the TRUE case, not Ones as per the ACPI specification. This +could result in the generation of an incorrect folded/reduced constant. + +End-Of-File is now allowed within a "//"-style comment. A parse error no +longer occurs if such a comment is at the very end of the input ASL source +file. + +Implemented the "-r" option to override the Revision in the table header. +The initial use of this option will be to simplify the evaluation of the AML +interpreter by allowing a single ASL source module to be compiled for either +32-bit or 64-bit integers. + + +---------------------------------------- +27 August 2004. Summary of changes for version 20040827: + +1) ACPI CA Core Subsystem: + +- Implemented support for implicit object conversion in the non-numeric +logical operators (LEqual, LGreater, LGreaterEqual, LLess, LLessEqual, and +LNotEqual.) Any combination of Integers/Strings/Buffers may now be used; +the second operand is implicitly converted on the fly to match the type of +the first operand. For example: + + LEqual (Source1, Source2) + +Source1 and Source2 must each evaluate to an integer, a string, or a buffer. +The data type of Source1 dictates the required type of Source2. Source2 is +implicitly converted if necessary to match the type of Source1. + +- Updated and corrected the behavior of the string conversion support. The +rules concerning conversion of buffers to strings (according to the ACPI +specification) are as follows: + +ToDecimalString - explicit byte-wise conversion of buffer to string of +decimal values (0-255) separated by commas. ToHexString - explicit byte-wise +conversion of buffer to string of hex values (0-FF) separated by commas. +ToString - explicit byte-wise conversion of buffer to string. Byte-by-byte +copy with no transform except NULL terminated. Any other implicit buffer-to- +string conversion - byte-wise conversion of buffer to string of hex values +(0-FF) separated by spaces. + +- Fixed typo in definition of AcpiGbl_EnableInterpreterSlack. + +- Fixed a problem in AcpiNsGetPathnameLength where the returned length was +one byte too short in the case of a node in the root scope. This could +cause a fault during debug output. + +- Code and Data Size: Current and previous core subsystem library sizes are +shown below. These are the code and data sizes for the acpica.lib produced +by the Microsoft Visual C++ 6.0 compiler, and these values do not include +any ACPI driver or OSPM code. The debug version of the code includes the +debug output trace mechanism and has a much larger code and data size. Note +that these values will vary depending on the efficiency of the compiler and +the compiler options used during generation. + + Previous Release: + Non-Debug Version: 77.9K Code, 11.5K Data, 89.4K Total + Debug Version: 164.1K Code, 68.3K Data, 232.4K Total + Current Release: + Non-Debug Version: 77.8K Code, 11.4K Data, 89.2K Total + Debug Version: 164.2K Code, 68.2K Data, 232.4K Total + + +2) iASL Compiler/Disassembler: + +- Fixed a Linux generation error. + + +---------------------------------------- +16 August 2004. Summary of changes for version 20040816: + +1) ACPI CA Core Subsystem: + +Designed and implemented support within the AML interpreter for the so- +called "implicit return". This support returns the result of the last ASL +operation within a control method, in the absence of an explicit Return() +operator. A few machines depend on this behavior, even though it is not +explicitly supported by the ASL language. It is optional support that can +be enabled at runtime via the AcpiGbl_EnableInterpreterSlack flag. + +Removed support for the PCI_Config address space from the internal low level +hardware interfaces (AcpiHwLowLevelRead and AcpiHwLowLevelWrite). This +support was not used internally, and would not work correctly anyway because +the PCI bus number and segment number were not supported. There are +separate interfaces for PCI configuration space access because of the unique +interface. + +Code and Data Size: Current and previous core subsystem library sizes are +shown below. These are the code and data sizes for the acpica.lib produced +by the Microsoft Visual C++ 6.0 compiler, and these values do not include +any ACPI driver or OSPM code. The debug version of the code includes the +debug output trace mechanism and has a much larger code and data size. Note +that these values will vary depending on the efficiency of the compiler and +the compiler options used during generation. + + Previous Release: + Non-Debug Version: 78.0K Code, 11.5K Data, 89.5K Total + Debug Version: 164.1K Code, 68.2K Data, 232.3K Total + Current Release: + Non-Debug Version: 77.9K Code, 11.5K Data, 89.4K Total + Debug Version: 164.1K Code, 68.3K Data, 232.4K Total + + +2) iASL Compiler/Disassembler: + +Fixed a problem where constants in ASL expressions at the root level (not +within a control method) could be inadvertently truncated during code +generation. This problem was introduced in the 20040715 release. + + +---------------------------------------- +15 July 2004. Summary of changes for version 20040715: + +1) ACPI CA Core Subsystem: + +Restructured the internal HW GPE interfaces to pass/track the current state +of interrupts (enabled/disabled) in order to avoid possible deadlock and +increase flexibility of the interfaces. + +Implemented a "lexicographical compare" for String and Buffer objects within +the logical operators -- LGreater, LLess, LGreaterEqual, and LLessEqual -- +as per further clarification to the ACPI specification. Behavior is similar +to C library "strcmp". + +Completed a major reduction in CPU stack use for the AcpiGetFirmwareTable +external function. In the 32-bit non-debug case, the stack use has been +reduced from 168 bytes to 32 bytes. + +Deployed a new run-time configuration flag, AcpiGbl_EnableInterpreterSlack, +whose purpose is to allow the AML interpreter to forgive certain bad AML +constructs. Default setting is FALSE. + +Implemented the first use of AcpiGbl_EnableInterpreterSlack in the Field IO +support code. If enabled, it allows field access to go beyond the end of a +region definition if the field is within the region length rounded up to the +next access width boundary (a common coding error.) + +Renamed OSD_HANDLER to ACPI_OSD_HANDLER, and OSD_EXECUTION_CALLBACK to +ACPI_OSD_EXEC_CALLBACK for consistency with other ACPI symbols. Also, these +symbols are lowercased by the latest version of the AcpiSrc tool. + +The prototypes for the PCI interfaces in acpiosxf.h have been updated to +rename "Register" to simply "Reg" to prevent certain compilers from +complaining. + +Code and Data Size: Current and previous core subsystem library sizes are +shown below. These are the code and data sizes for the acpica.lib produced +by the Microsoft Visual C++ 6.0 compiler, and these values do not include +any ACPI driver or OSPM code. The debug version of the code includes the +debug output trace mechanism and has a much larger code and data size. Note +that these values will vary depending on the efficiency of the compiler and +the compiler options used during generation. + + Previous Release: + Non-Debug Version: 77.8K Code, 11.5K Data, 89.3K Total + Debug Version: 163.8K Code, 68.2K Data, 232.0K Total + Current Release: + Non-Debug Version: 78.0K Code, 11.5K Data, 89.5K Total + Debug Version: 164.1K Code, 68.2K Data, 232.3K Total + + +2) iASL Compiler/Disassembler: + +Implemented full support for Package objects within the Case() operator. +Note: The Break() operator is currently not supported within Case blocks +(TermLists) as there is some question about backward compatibility with ACPI +1.0 interpreters. + + +Fixed a problem where complex terms were not supported properly within the +Switch() operator. + +Eliminated extraneous warning for compiler-emitted reserved names of the +form "_T_x". (Used in Switch/Case operators.) + +Eliminated optimization messages for "_T_x" objects and small constants +within the DefinitionBlock operator. + + +---------------------------------------- +15 June 2004. Summary of changes for version 20040615: + +1) ACPI CA Core Subsystem: + +Implemented support for Buffer and String objects (as per ACPI 2.0) for the +following ASL operators: LEqual, LGreater, LLess, LGreaterEqual, and +LLessEqual. + +All directory names in the entire source package are lower case, as they +were in earlier releases. + +Implemented "Disassemble" command in the AML debugger that will disassemble +a single control method. + +Code and Data Size: Current and previous core subsystem library sizes are +shown below. These are the code and data sizes for the acpica.lib produced +by the Microsoft Visual C++ 6.0 compiler, and these values do not include +any ACPI driver or OSPM code. The debug version of the code includes the +debug output trace mechanism and has a much larger code and data size. Note +that these values will vary depending on the efficiency of the compiler and +the compiler options used during generation. + + Previous Release: + Non-Debug Version: 77.7K Code, 11.5K Data, 89.2K Total + Debug Version: 163.3K Code, 67.2K Data, 230.5K Total + + Current Release: + Non-Debug Version: 77.8K Code, 11.5K Data, 89.3K Total + Debug Version: 163.8K Code, 68.2K Data, 232.0K Total + + +2) iASL Compiler/Disassembler: + +Implemented support for Buffer and String objects (as per ACPI 2.0) for the +following ASL operators: LEqual, LGreater, LLess, LGreaterEqual, and +LLessEqual. + +All directory names in the entire source package are lower case, as they +were in earlier releases. + +Fixed a fault when using the -g or -d<nofilename> options if the FADT was +not found. + +Fixed an issue with the Windows version of the compiler where later versions +of Windows place the FADT in the registry under the name "FADT" and not +"FACP" as earlier versions did. This applies when using the -g or - +d<nofilename> options. The compiler now looks for both strings as +necessary. + +Fixed a problem with compiler namepath optimization where a namepath within +the Scope() operator could not be optimized if the namepath was a subpath of +the current scope path. + +---------------------------------------- +27 May 2004. Summary of changes for version 20040527: + +1) ACPI CA Core Subsystem: + +Completed a new design and implementation for EBDA (Extended BIOS Data Area) +support in the RSDP scan code. The original code improperly scanned for the +EBDA by simply scanning from memory location 0 to 0x400. The correct method +is to first obtain the EBDA pointer from within the BIOS data area, then +scan 1K of memory starting at the EBDA pointer. There appear to be few if +any machines that place the RSDP in the EBDA, however. + +Integrated a fix for a possible fault during evaluation of BufferField +arguments. Obsolete code that was causing the problem was removed. + +Found and fixed a problem in the Field Support Code where data could be +corrupted on a bit field read that starts on an aligned boundary but does +not end on an aligned boundary. Merged the read/write "datum length" +calculation code into a common procedure. + +Rolled in a couple of changes to the FreeBSD-specific header. + + +Code and Data Size: Current and previous core subsystem library sizes are +shown below. These are the code and data sizes for the acpica.lib produced +by the Microsoft Visual C++ 6.0 compiler, and these values do not include +any ACPI driver or OSPM code. The debug version of the code includes the +debug output trace mechanism and has a much larger code and data size. Note +that these values will vary depending on the efficiency of the compiler and +the compiler options used during generation. + + Previous Release: + Non-Debug Version: 77.6K Code, 11.5K Data, 89.1K Total + Debug Version: 163.2K Code, 67.2K Data, 230.4K Total + Current Release: + Non-Debug Version: 77.7K Code, 11.5K Data, 89.2K Total + Debug Version: 163.3K Code, 67.2K Data, 230.5K Total + + +2) iASL Compiler/Disassembler: + +Fixed a generation warning produced by some overly-verbose compilers for a +64-bit constant. + +---------------------------------------- +14 May 2004. Summary of changes for version 20040514: + +1) ACPI CA Core Subsystem: + +Fixed a problem where hardware GPE enable bits sometimes not set properly +during and after GPE method execution. Result of 04/27 changes. + +Removed extra "clear all GPEs" when sleeping/waking. + +Removed AcpiHwEnableGpe and AcpiHwDisableGpe, replaced by the single +AcpiHwWriteGpeEnableReg. Changed a couple of calls to the functions above to +the new AcpiEv* calls as appropriate. + +ACPI_OS_NAME was removed from the OS-specific headers. The default name is +now "Microsoft Windows NT" for maximum compatibility. However this can be +changed by modifying the acconfig.h file. + +Allow a single invocation of AcpiInstallNotifyHandler for a handler that +traps both types of notifies (System, Device). Use ACPI_ALL_NOTIFY flag. + +Run _INI methods on ThermalZone objects. This is against the ACPI +specification, but there is apparently ASL code in the field that has these +_INI methods, and apparently "other" AML interpreters execute them. + +Performed a full 16/32/64 bit lint that resulted in some small changes. + +Added a sleep simulation command to the AML debugger to test sleep code. + +Code and Data Size: Current and previous core subsystem library sizes are +shown below. These are the code and data sizes for the acpica.lib produced +by the Microsoft Visual C++ 6.0 compiler, and these values do not include +any ACPI driver or OSPM code. The debug version of the code includes the +debug output trace mechanism and has a much larger code and data size. Note +that these values will vary depending on the efficiency of the compiler and +the compiler options used during generation. + + Previous Release: + Non-Debug Version: 77.6K Code, 11.5K Data, 89.1K Total + Debug Version: 162.9K Code, 67.0K Data, 229.9K Total + Current Release: + Non-Debug Version: 77.6K Code, 11.5K Data, 89.1K Total + Debug Version: 163.2K Code, 67.2K Data, 230.4K Total + +---------------------------------------- +27 April 2004. Summary of changes for version 20040427: + +1) ACPI CA Core Subsystem: + +Completed a major overhaul of the GPE handling within ACPI CA. There are +now three types of GPEs: wake-only, runtime-only, and combination wake/run. +The only GPEs allowed to be combination wake/run are for button-style +devices such as a control-method power button, control-method sleep button, +or a notebook lid switch. GPEs that have an _Lxx or _Exx method and are not +referenced by any _PRW methods are marked for "runtime" and hardware +enabled. Any GPE that is referenced by a _PRW method is marked for "wake" +(and disabled at runtime). However, at sleep time, only those GPEs that +have been specifically enabled for wake via the AcpiEnableGpe interface will +actually be hardware enabled. + +A new external interface has been added, AcpiSetGpeType(), that is meant to +be used by device drivers to force a GPE to a particular type. It will be +especially useful for the drivers for the button devices mentioned above. + +Completed restructuring of the ACPI CA initialization sequence so that +default operation region handlers are installed before GPEs are initialized +and the _PRW methods are executed. This will prevent errors when the _PRW +methods attempt to access system memory or I/O space. + +GPE enable/disable no longer reads the GPE enable register. We now keep the +enable info for runtime and wake separate and in the GPE_EVENT_INFO. We +thus no longer depend on the hardware to maintain these bits. + +Always clear the wake status and fixed/GPE status bits before sleep, even +for state S5. + +Improved the AML debugger output for displaying the GPE blocks and their +current status. + +Added new strings for the _OSI method, of the form "Windows 2001 SPx" where +x = 0,1,2,3,4. + +Fixed a problem where the physical address was incorrectly calculated when +the Load() operator was used to directly load from an Operation Region (vs. +loading from a Field object.) Also added check for minimum table length for +this case. + +Fix for multiple mutex acquisition. Restore original thread SyncLevel on +mutex release. + +Added ACPI_VALID_SXDS flag to the AcpiGetObjectInfo interface for +consistency with the other fields returned. + +Shrunk the ACPI_GPE_EVENT_INFO structure by 40%. There is one such +structure for each GPE in the system, so the size of this structure is +important. + +CPU stack requirement reduction: Cleaned up the method execution and object +evaluation paths so that now a parameter structure is passed, instead of +copying the various method parameters over and over again. + +In evregion.c: Correctly exit and reenter the interpreter region if and +only if dispatching an operation region request to a user-installed handler. +Do not exit/reenter when dispatching to a default handler (e.g., default +system memory or I/O handlers) + + +Notes for updating drivers for the new GPE support. The following changes +must be made to ACPI-related device drivers that are attached to one or more +GPEs: (This information will be added to the ACPI CA Programmer Reference.) + +1) AcpiInstallGpeHandler no longer automatically enables the GPE, you must +explicitly call AcpiEnableGpe. +2) There is a new interface called AcpiSetGpeType. This should be called +before enabling the GPE. Also, this interface will automatically disable +the GPE if it is currently enabled. +3) AcpiEnableGpe no longer supports a GPE type flag. + +Specific drivers that must be changed: +1) EC driver: + AcpiInstallGpeHandler (NULL, GpeNum, ACPI_GPE_EDGE_TRIGGERED, +AeGpeHandler, NULL); + AcpiSetGpeType (NULL, GpeNum, ACPI_GPE_TYPE_RUNTIME); + AcpiEnableGpe (NULL, GpeNum, ACPI_NOT_ISR); + +2) Button Drivers (Power, Lid, Sleep): +Run _PRW method under parent device +If _PRW exists: /* This is a control-method button */ + Extract GPE number and possibly GpeDevice + AcpiSetGpeType (GpeDevice, GpeNum, ACPI_GPE_TYPE_WAKE_RUN); + AcpiEnableGpe (GpeDevice, GpeNum, ACPI_NOT_ISR); + +For all other devices that have _PRWs, we automatically set the GPE type to +ACPI_GPE_TYPE_WAKE, but the GPE is NOT automatically (wake) enabled. This +must be done on a selective basis, usually requiring some kind of user app +to allow the user to pick the wake devices. + + +Code and Data Size: Current and previous core subsystem library sizes are +shown below. These are the code and data sizes for the acpica.lib produced +by the Microsoft Visual C++ 6.0 compiler, and these values do not include +any ACPI driver or OSPM code. The debug version of the code includes the +debug output trace mechanism and has a much larger code and data size. Note +that these values will vary depending on the efficiency of the compiler and +the compiler options used during generation. + + Previous Release: + Non-Debug Version: 77.0K Code, 11.4K Data, 88.4K Total + Debug Version: 161.0K Code, 66.3K Data, 227.3K Total + Current Release: + + Non-Debug Version: 77.6K Code, 11.5K Data, 89.1K Total + Debug Version: 162.9K Code, 67.0K Data, 229.9K Total + + + +---------------------------------------- +02 April 2004. Summary of changes for version 20040402: + +1) ACPI CA Core Subsystem: + +Fixed an interpreter problem where an indirect store through an ArgX +parameter was incorrectly applying the "implicit conversion rules" during +the store. From the ACPI specification: "If the target is a method local or +argument (LocalX or ArgX), no conversion is performed and the result is +stored directly to the target". The new behavior is to disable implicit +conversion during ALL stores to an ArgX. + +Changed the behavior of the _PRW method scan to ignore any and all errors +returned by a given _PRW. This prevents the scan from aborting from the +failure of any single _PRW. + +Moved the runtime configuration parameters from the global init procedure to +static variables in acglobal.h. This will allow the host to override the +default values easily. + +Code and Data Size: Current and previous core subsystem library sizes are +shown below. These are the code and data sizes for the acpica.lib produced +by the Microsoft Visual C++ 6.0 compiler, and these values do not include +any ACPI driver or OSPM code. The debug version of the code includes the +debug output trace mechanism and has a much larger code and data size. Note +that these values will vary depending on the efficiency of the compiler and +the compiler options used during generation. + + Previous Release: + Non-Debug Version: 76.9K Code, 11.4K Data, 88.3K Total + Debug Version: 160.8K Code, 66.1K Data, 226.9K Total + Current Release: + Non-Debug Version: 77.0K Code, 11.4K Data, 88.4K Total + Debug Version: 161.0K Code, 66.3K Data, 227.3K Total + + +2) iASL Compiler/Disassembler: + +iASL now fully disassembles SSDTs. However, External() statements are not +generated automatically for unresolved symbols at this time. This is a +planned feature for future implementation. + +Fixed a scoping problem in the disassembler that occurs when the type of the +target of a Scope() operator is overridden. This problem caused an +incorrectly nested internal namespace to be constructed. + +Any warnings or errors that are emitted during disassembly are now commented +out automatically so that the resulting file can be recompiled without any +hand editing. + +---------------------------------------- +26 March 2004. Summary of changes for version 20040326: + +1) ACPI CA Core Subsystem: + +Implemented support for "wake" GPEs via interaction between GPEs and the +_PRW methods. Every GPE that is pointed to by one or more _PRWs is +identified as a WAKE GPE and by default will no longer be enabled at +runtime. Previously, we were blindly enabling all GPEs with a corresponding +_Lxx or _Exx method - but most of these turn out to be WAKE GPEs anyway. We +believe this has been the cause of thousands of "spurious" GPEs on some +systems. + +This new GPE behavior is can be reverted to the original behavior (enable +ALL GPEs at runtime) via a runtime flag. + +Fixed a problem where aliased control methods could not access objects +properly. The proper scope within the namespace was not initialized +(transferred to the target of the aliased method) before executing the +target method. + +Fixed a potential race condition on internal object deletion on the return +object in AcpiEvaluateObject. + +Integrated a fix for resource descriptors where both _MEM and _MTP were +being extracted instead of just _MEM. (i.e. bitmask was incorrectly too +wide, 0x0F instead of 0x03.) + +Added a special case for ACPI_ROOT_OBJECT in AcpiUtGetNodeName, preventing a +fault in some cases. + +Updated Notify() values for debug statements in evmisc.c + +Return proper status from AcpiUtMutexInitialize, not just simply AE_OK. + +Code and Data Size: Current and previous core subsystem library sizes are +shown below. These are the code and data sizes for the acpica.lib produced +by the Microsoft Visual C++ 6.0 compiler, and these values do not include +any ACPI driver or OSPM code. The debug version of the code includes the +debug output trace mechanism and has a much larger code and data size. Note +that these values will vary depending on the efficiency of the compiler and +the compiler options used during generation. + + Previous Release: + + Non-Debug Version: 76.5K Code, 11.3K Data, 87.8K Total + Debug Version: 160.3K Code, 66.0K Data, 226.3K Total + Current Release: + Non-Debug Version: 76.9K Code, 11.4K Data, 88.3K Total + Debug Version: 160.8K Code, 66.1K Data, 226.9K Total + +---------------------------------------- +11 March 2004. Summary of changes for version 20040311: + +1) ACPI CA Core Subsystem: + +Fixed a problem where errors occurring during the parse phase of control +method execution did not abort cleanly. For example, objects created and +installed in the namespace were not deleted. This caused all subsequent +invocations of the method to return the AE_ALREADY_EXISTS exception. + +Implemented a mechanism to force a control method to "Serialized" execution +if the method attempts to create namespace objects. (The root of the +AE_ALREADY_EXISTS problem.) + +Implemented support for the predefined _OSI "internal" control method. +Initial supported strings are "Linux", "Windows 2000", "Windows 2001", and +"Windows 2001.1", and can be easily upgraded for new strings as necessary. +This feature will allow "other" operating systems to execute the fully +tested, "Windows" code path through the ASL code + +Global Lock Support: Now allows multiple acquires and releases with any +internal thread. Removed concept of "owning thread" for this special mutex. + +Fixed two functions that were inappropriately declaring large objects on the +CPU stack: PsParseLoop, NsEvaluateRelative. Reduces the stack usage during +method execution considerably. + +Fixed a problem in the ACPI 2.0 FACS descriptor (actbl2.h) where the +S4Bios_f field was incorrectly defined as UINT32 instead of UINT32_BIT. + +Fixed a problem where AcpiEvGpeDetect would fault if there were no GPEs +defined on the machine. + +Implemented two runtime options: One to force all control method execution +to "Serialized" to mimic Windows behavior, another to disable _OSI support +if it causes problems on a given machine. + +Code and Data Size: Current and previous core subsystem library sizes are +shown below. These are the code and data sizes for the acpica.lib produced +by the Microsoft Visual C++ 6.0 compiler, and these values do not include +any ACPI driver or OSPM code. The debug version of the code includes the +debug output trace mechanism and has a much larger code and data size. Note +that these values will vary depending on the efficiency of the compiler and +the compiler options used during generation. + + Previous Release: + Non-Debug Version: 74.8K Code, 10.1K Data, 84.9K Total + Debug Version: 158.7K Code, 65.1K Data, 223.8K Total + Current Release: + Non-Debug Version: 76.5K Code, 11.3K Data, 87.8K Total + Debug Version: 160.3K Code, 66.0K Data, 226.3K Total + +2) iASL Compiler/Disassembler: + +Fixed an array size problem for FreeBSD that would cause the compiler to +fault. + +---------------------------------------- +20 February 2004. Summary of changes for version 20040220: + + +1) ACPI CA Core Subsystem: + +Implemented execution of _SxD methods for Device objects in the +GetObjectInfo interface. + +Fixed calls to _SST method to pass the correct arguments. + +Added a call to _SST on wake to restore to "working" state. + +Check for End-Of-Buffer failure case in the WalkResources interface. + +Integrated fix for 64-bit alignment issue in acglobal.h by moving two +structures to the beginning of the file. + +After wake, clear GPE status register(s) before enabling GPEs. + +After wake, clear/enable power button. (Perhaps we should clear/enable all +fixed events upon wake.) + +Fixed a couple of possible memory leaks in the Namespace manager. + +Integrated latest acnetbsd.h file. + +---------------------------------------- +11 February 2004. Summary of changes for version 20040211: + + +1) ACPI CA Core Subsystem: + +Completed investigation and implementation of the call-by-reference +mechanism for control method arguments. + +Fixed a problem where a store of an object into an indexed package could +fail if the store occurs within a different method than the method that +created the package. + +Fixed a problem where the ToDecimal operator could return incorrect results. + +Fixed a problem where the CopyObject operator could fail on some of the more +obscure objects (e.g., Reference objects.) + +Improved the output of the Debug object to display buffer, package, and +index objects. + +Fixed a problem where constructs of the form "RefOf (ArgX)" did not return +the expected result. + +Added permanent ACPI_REPORT_ERROR macros for all instances of the +ACPI_AML_INTERNAL exception. + +Integrated latest version of acfreebsd.h + +---------------------------------------- +16 January 2004. Summary of changes for version 20040116: + +The purpose of this release is primarily to update the copyright years in +each module, thus causing a huge number of diffs. There are a few small +functional changes, however. + +1) ACPI CA Core Subsystem: + +Improved error messages when there is a problem finding one or more of the +required base ACPI tables + +Reintroduced the definition of APIC_HEADER in actbl.h + +Changed definition of MADT_ADDRESS_OVERRIDE to 64 bits (actbl.h) + +Removed extraneous reference to NewObj in dsmthdat.c + +2) iASL compiler + +Fixed a problem introduced in December that disabled the correct disassembly +of Resource Templates + + +---------------------------------------- +03 December 2003. Summary of changes for version 20031203: + +1) ACPI CA Core Subsystem: + +Changed the initialization of Operation Regions during subsystem +init to perform two entire walks of the ACPI namespace; The first +to initialize the regions themselves, the second to execute the +_REG methods. This fixed some interdependencies across _REG +methods found on some machines. + +Fixed a problem where a Store(Local0, Local1) could simply update +the object reference count, and not create a new copy of the +object if the Local1 is uninitialized. + +Implemented support for the _SST reserved method during sleep +transitions. + +Implemented support to clear the SLP_TYP and SLP_EN bits when +waking up, this is apparently required by some machines. + +When sleeping, clear the wake status only if SleepState is not S5. + +Fixed a problem in AcpiRsExtendedIrqResource() where an incorrect +pointer arithmetic advanced a string pointer too far. + +Fixed a problem in AcpiTbGetTablePtr() where a garbage pointer +could be returned if the requested table has not been loaded. + +Within the support for IRQ resources, restructured the handling of +the active and edge/level bits. + +Fixed a few problems in AcpiPsxExecute() where memory could be +leaked under certain error conditions. + +Improved error messages for the cases where the ACPI mode could +not be entered. + +Code and Data Size: Current and previous core subsystem library +sizes are shown below. These are the code and data sizes for the +acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and +these values do not include any ACPI driver or OSPM code. The +debug version of the code includes the debug output trace +mechanism and has a much larger code and data size. Note that +these values will vary depending on the efficiency of the compiler +and the compiler options used during generation. + + Previous Release (20031029): + Non-Debug Version: 74.4K Code, 10.1K Data, 84.5K Total + Debug Version: 158.3K Code, 65.0K Data, 223.3K Total + Current Release: + Non-Debug Version: 74.8K Code, 10.1K Data, 84.9K Total + Debug Version: 158.7K Code, 65.1K Data, 223.8K Total + +2) iASL Compiler/Disassembler: + +Implemented a fix for the iASL disassembler where a bad index was +generated. This was most noticeable on 64-bit platforms + + +---------------------------------------- +29 October 2003. Summary of changes for version 20031029: + +1) ACPI CA Core Subsystem: + + +Fixed a problem where a level-triggered GPE with an associated +_Lxx control method was incorrectly cleared twice. + +Fixed a problem with the Field support code where an access can +occur beyond the end-of-region if the field is non-aligned but +extends to the very end of the parent region (resulted in an +AE_AML_REGION_LIMIT exception.) + +Fixed a problem with ACPI Fixed Events where an RT Clock handler +would not get invoked on an RTC event. The RTC event bitmasks for +the PM1 registers were not being initialized properly. + +Implemented support for executing _STA and _INI methods for +Processor objects. Although this is currently not part of the +ACPI specification, there is existing ASL code that depends on the +init-time execution of these methods. + +Implemented and deployed a GetDescriptorName function to decode +the various types of internal descriptors. Guards against null +descriptors during debug output also. + +Implemented and deployed a GetNodeName function to extract the 4- +character namespace node name. This function simplifies the debug +and error output, as well as guarding against null pointers during +output. + +Implemented and deployed the ACPI_FORMAT_UINT64 helper macro to +simplify the debug and error output of 64-bit integers. This +macro replaces the HIDWORD and LODWORD macros for dumping these +integers. + +Updated the implementation of the Stall() operator to only call +AcpiOsStall(), and also return an error if the operand is larger +than 255. This preserves the required behavior of not +relinquishing the processor, as would happen if AcpiOsSleep() was +called for "long stalls". + +Constructs of the form "Store(LocalX,LocalX)" where LocalX is not +initialized are now treated as NOOPs. + +Cleaned up a handful of warnings during 64-bit generation. + +Fixed a reported error where and incorrect GPE number was passed +to the GPE dispatch handler. This value is only used for error +output, however. Used this opportunity to clean up and streamline +the GPE dispatch code. + +Code and Data Size: Current and previous core subsystem library +sizes are shown below. These are the code and data sizes for the +acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and +these values do not include any ACPI driver or OSPM code. The + +debug version of the code includes the debug output trace +mechanism and has a much larger code and data size. Note that +these values will vary depending on the efficiency of the compiler +and the compiler options used during generation. + + Previous Release (20031002): + Non-Debug Version: 74.1K Code, 9.7K Data, 83.8K Total + Debug Version: 157.9K Code, 64.8K Data, 222.7K Total + Current Release: + Non-Debug Version: 74.4K Code, 10.1K Data, 84.5K Total + Debug Version: 158.3K Code, 65.0K Data, 223.3K Total + + +2) iASL Compiler/Disassembler: + +Updated the iASL compiler to return an error if the operand to the +Stall() operator is larger than 255. + + +---------------------------------------- +02 October 2003. Summary of changes for version 20031002: + + +1) ACPI CA Core Subsystem: + +Fixed a problem with Index Fields where the index was not +incremented for fields that require multiple writes to the +index/data registers (Fields that are wider than the data +register.) + +Fixed a problem with all Field objects where a write could go +beyond the end-of-field if the field was larger than the access +granularity and therefore required multiple writes to complete the +request. An extra write beyond the end of the field could happen +inadvertently. + +Fixed a problem with Index Fields where a BUFFER_OVERFLOW error +would incorrectly be returned if the width of the Data Register +was larger than the specified field access width. + +Completed fixes for LoadTable() and Unload() and verified their +operation. Implemented full support for the "DdbHandle" object +throughout the ACPI CA subsystem. + +Implemented full support for the MADT and ECDT tables in the ACPI +CA header files. Even though these tables are not directly +consumed by ACPI CA, the header definitions are useful for ACPI +device drivers. + +Integrated resource descriptor fixes posted to the Linux ACPI +list. This included checks for minimum descriptor length, and +support for trailing NULL strings within descriptors that have +optional string elements. + +Code and Data Size: Current and previous core subsystem library +sizes are shown below. These are the code and data sizes for the +acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and +these values do not include any ACPI driver or OSPM code. The +debug version of the code includes the debug output trace +mechanism and has a much larger code and data size. Note that +these values will vary depending on the efficiency of the compiler +and the compiler options used during generation. + + Previous Release (20030918): + Non-Debug Version: 73.9K Code, 9.7K Data, 83.6K Total + Debug Version: 157.3K Code, 64.5K Data, 221.8K Total + Current Release: + Non-Debug Version: 74.1K Code, 9.7K Data, 83.8K Total + Debug Version: 157.9K Code, 64.8K Data, 222.7K Total + + +2) iASL Compiler: + +Implemented detection of non-ASCII characters within the input +source ASL file. This catches attempts to compile binary (AML) +files early in the compile, with an informative error message. + +Fixed a problem where the disassembler would fault if the output +filename could not be generated or if the output file could not be +opened. + +---------------------------------------- +18 September 2003. Summary of changes for version 20030918: + + +1) ACPI CA Core Subsystem: + +Found and fixed a longstanding problem with the late execution of +the various deferred AML opcodes (such as Operation Regions, +Buffer Fields, Buffers, and Packages). If the name string +specified for the name of the new object placed the object in a +scope other than the current scope, the initialization/execution +of the opcode failed. The solution to this problem was to +implement a mechanism where the late execution of such opcodes +does not attempt to lookup/create the name a second time in an +incorrect scope. This fixes the "region size computed +incorrectly" problem. + +Fixed a call to AcpiHwRegisterWrite in hwregs.c that was causing a +Global Lock AE_BAD_PARAMETER error. + +Fixed several 64-bit issues with prototypes, casting and data +types. + +Removed duplicate prototype from acdisasm.h + +Fixed an issue involving EC Operation Region Detach (Shaohua Li) + +Code and Data Size: Current and previous core subsystem library +sizes are shown below. These are the code and data sizes for the +acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and +these values do not include any ACPI driver or OSPM code. The +debug version of the code includes the debug output trace +mechanism and has a much larger code and data size. Note that +these values will vary depending on the efficiency of the compiler +and the compiler options used during generation. + + Previous Release: + + Non-Debug Version: 73.7K Code, 9.7K Data, 83.4K Total + Debug Version: 156.9K Code, 64.2K Data, 221.1K Total + Current Release: + Non-Debug Version: 73.9K Code, 9.7K Data, 83.6K Total + Debug Version: 157.3K Code, 64.5K Data, 221.8K Total + + +2) Linux: + +Fixed the AcpiOsSleep implementation in osunixxf.c to pass the +correct sleep time in seconds. + +---------------------------------------- +14 July 2003. Summary of changes for version 20030619: + +1) ACPI CA Core Subsystem: + +Parse SSDTs in order discovered, as opposed to reverse order +(Hrvoje Habjanic) + +Fixes from FreeBSD and NetBSD. (Frank van der Linden, Thomas +Klausner, + Nate Lawson) + + +2) Linux: + +Dynamically allocate SDT list (suggested by Andi Kleen) + +proc function return value cleanups (Andi Kleen) + +Correctly handle NMI watchdog during long stalls (Andrew Morton) + +Make it so acpismp=force works (reported by Andrew Morton) + + +---------------------------------------- +19 June 2003. Summary of changes for version 20030619: + +1) ACPI CA Core Subsystem: + +Fix To/FromBCD, eliminating the need for an arch-specific #define. + +Do not acquire a semaphore in the S5 shutdown path. + +Fix ex_digits_needed for 0. (Takayoshi Kochi) + +Fix sleep/stall code reversal. (Andi Kleen) + +Revert a change having to do with control method calling +semantics. + +2) Linux: + +acpiphp update (Takayoshi Kochi) + +Export acpi_disabled for sonypi (Stelian Pop) + +Mention acpismp=force in config help + +Re-add acpitable.c and acpismp=force. This improves backwards + +compatibility and also cleans up the code to a significant degree. + +Add ASUS Value-add driver (Karol Kozimor and Julien Lerouge) + +---------------------------------------- +22 May 2003. Summary of changes for version 20030522: + +1) ACPI CA Core Subsystem: + +Found and fixed a reported problem where an AE_NOT_FOUND error +occurred occasionally during _BST evaluation. This turned out to +be an Owner ID allocation issue where a called method did not get +a new ID assigned to it. Eventually, (after 64k calls), the Owner +ID UINT16 would wraparound so that the ID would be the same as the +caller's and the called method would delete the caller's +namespace. + +Implemented extended error reporting for control methods that are +aborted due to a run-time exception. Output includes the exact +AML instruction that caused the method abort, a dump of the method +locals and arguments at the time of the abort, and a trace of all +nested control method calls. + +Modified the interpreter to allow the creation of buffers of zero +length from the AML code. Implemented new code to ensure that no +attempt is made to actually allocate a memory buffer (of length +zero) - instead, a simple buffer object with a NULL buffer pointer +and length zero is created. A warning is no longer issued when +the AML attempts to create a zero-length buffer. + +Implemented a workaround for the "leading asterisk issue" in +_HIDs, _UIDs, and _CIDs in the AML interpreter. One leading +asterisk is automatically removed if present in any HID, UID, or +CID strings. The iASL compiler will still flag this asterisk as +an error, however. + +Implemented full support for _CID methods that return a package of +multiple CIDs (Compatible IDs). The AcpiGetObjectInfo() interface +now additionally returns a device _CID list if present. This +required a change to the external interface in order to pass an +ACPI_BUFFER object as a parameter since the _CID list is of +variable length. + +Fixed a problem with the new AE_SAME_HANDLER exception where +handler initialization code did not know about this exception. + +Code and Data Size: Current and previous core subsystem library +sizes are shown below. These are the code and data sizes for the +acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and +these values do not include any ACPI driver or OSPM code. The +debug version of the code includes the debug output trace +mechanism and has a much larger code and data size. Note that +these values will vary depending on the efficiency of the compiler +and the compiler options used during generation. + + Previous Release (20030509): + Non-Debug Version: 73.4K Code, 9.7K Data, 83.1K Total + Debug Version: 156.1K Code, 63.9K Data, 220.0K Total + Current Release: + Non-Debug Version: 73.7K Code, 9.7K Data, 83.4K Total + Debug Version: 156.9K Code, 64.2K Data, 221.1K Total + + +2) Linux: + +Fixed a bug in which we would reinitialize the ACPI interrupt +after it was already working, thus disabling all ACPI and the IRQs +for any other device sharing the interrupt. (Thanks to Stian +Jordet) + +Toshiba driver update (John Belmonte) + +Return only 0 or 1 for our interrupt handler status (Andrew +Morton) + + +3) iASL Compiler: + +Fixed a reported problem where multiple (nested) ElseIf() +statements were not handled correctly by the compiler, resulting +in incorrect warnings and incorrect AML code. This was a problem +in both the ASL parser and the code generator. + + +4) Documentation: + +Added changes to existing interfaces, new exception codes, and new +text concerning reference count object management versus garbage +collection. + +---------------------------------------- +09 May 2003. Summary of changes for version 20030509. + + +1) ACPI CA Core Subsystem: + +Changed the subsystem initialization sequence to hold off +installation of address space handlers until the hardware has been +initialized and the system has entered ACPI mode. This is because +the installation of space handlers can cause _REG methods to be +run. Previously, the _REG methods could potentially be run before +ACPI mode was enabled. + +Fixed some memory leak issues related to address space handler and +notify handler installation. There were some problems with the +reference count mechanism caused by the fact that the handler +objects are shared across several namespace objects. + +Fixed a reported problem where reference counts within the +namespace were not properly updated when named objects created by +method execution were deleted. + +Fixed a reported problem where multiple SSDTs caused a deletion +issue during subsystem termination. Restructured the table data +structures to simplify the linked lists and the related code. + +Fixed a problem where the table ID associated with secondary +tables (SSDTs) was not being propagated into the namespace objects +created by those tables. This would only present a problem for +tables that are unloaded at run-time, however. + +Updated AcpiOsReadable and AcpiOsWritable to use the ACPI_SIZE +type as the length parameter (instead of UINT32). + +Solved a long-standing problem where an ALREADY_EXISTS error +appears on various systems. This problem could happen when there +are multiple PCI_Config operation regions under a single PCI root +bus. This doesn't happen very frequently, but there are some +systems that do this in the ASL. + +Fixed a reported problem where the internal DeleteNode function +was incorrectly handling the case where a namespace node was the +first in the parent's child list, and had additional peers (not +the only child, but first in the list of children.) + +Code and Data Size: Current core subsystem library sizes are shown +below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these +values do not include any ACPI driver or OSPM code. The debug +version of the code includes the debug output trace mechanism and +has a much larger code and data size. Note that these values will +vary depending on the efficiency of the compiler and the compiler +options used during generation. + + Previous Release + Non-Debug Version: 73.7K Code, 9.5K Data, 83.2K Total + Debug Version: 156.1K Code, 63.6K Data, 219.7K Total + Current Release: + Non-Debug Version: 73.4K Code, 9.7K Data, 83.1K Total + Debug Version: 156.1K Code, 63.9K Data, 220.0K Total + + +2) Linux: + +Allow ":" in OS override string (Ducrot Bruno) + +Kobject fix (Greg KH) + + +3 iASL Compiler/Disassembler: + +Fixed a problem in the generation of the C source code files (AML +is emitted in C source statements for BIOS inclusion) where the +Ascii dump that appears within a C comment at the end of each line +could cause a compile time error if the AML sequence happens to +have an open comment or close comment sequence embedded. + + +---------------------------------------- +24 April 2003. Summary of changes for version 20030424. + + +1) ACPI CA Core Subsystem: + +Support for big-endian systems has been implemented. Most of the +support has been invisibly added behind big-endian versions of the +ACPI_MOVE_* macros. + +Fixed a problem in AcpiHwDisableGpeBlock() and +AcpiHwClearGpeBlock() where an incorrect offset was passed to the +low level hardware write routine. The offset parameter was +actually eliminated from the low level read/write routines because +they had become obsolete. + +Fixed a problem where a handler object was deleted twice during +the removal of a fixed event handler. + + +2) Linux: + +A fix for SMP systems with link devices was contributed by + +Compaq's Dan Zink. + +(2.5) Return whether we handled the interrupt in our IRQ handler. +(Linux ISRs no longer return void, so we can propagate the handler +return value from the ACPI CA core back to the OS.) + + + +3) Documentation: + +The ACPI CA Programmer Reference has been updated to reflect new +interfaces and changes to existing interfaces. + +---------------------------------------- +28 March 2003. Summary of changes for version 20030328. + +1) ACPI CA Core Subsystem: + +The GPE Block Device support has been completed. New interfaces +are AcpiInstallGpeBlock and AcpiRemoveGpeBlock. The Event +interfaces (enable, disable, clear, getstatus) have been split +into separate interfaces for Fixed Events and General Purpose +Events (GPEs) in order to support GPE Block Devices properly. + +Fixed a problem where the error message "Failed to acquire +semaphore" would appear during operations on the embedded +controller (EC). + +Code and Data Size: Current core subsystem library sizes are shown +below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these +values do not include any ACPI driver or OSPM code. The debug +version of the code includes the debug output trace mechanism and +has a much larger code and data size. Note that these values will +vary depending on the efficiency of the compiler and the compiler +options used during generation. + + Previous Release + Non-Debug Version: 72.3K Code, 9.5K Data, 81.8K Total + Debug Version: 154.0K Code, 63.4K Data, 217.4K Total + Current Release: + Non-Debug Version: 73.7K Code, 9.5K Data, 83.2K Total + Debug Version: 156.1K Code, 63.6K Data, 219.7K Total + + +---------------------------------------- +28 February 2003. Summary of changes for version 20030228. + + +1) ACPI CA Core Subsystem: + +The GPE handling and dispatch code has been completely overhauled +in preparation for support of GPE Block Devices (ID ACPI0006). +This affects internal data structures and code only; there should +be no differences visible externally. One new file has been +added, evgpeblk.c + +The FADT fields GPE0_BLK_LEN and GPE1_BLK_LEN are now the only +fields that are used to determine the GPE block lengths. The +REGISTER_BIT_WIDTH field of the X_GPEx_BLK extended address +structures are ignored. This is per the ACPI specification but it +isn't very clear. The full 256 Block 0/1 GPEs are now supported +(the use of REGISTER_BIT_WIDTH limited the number of GPEs to 128). + +In the SCI interrupt handler, removed the read of the PM1_CONTROL +register to look at the SCI_EN bit. On some machines, this read +causes an SMI event and greatly slows down SCI events. (This may +in fact be the cause of slow battery status response on some +systems.) + +Fixed a problem where a store of a NULL string to a package object +could cause the premature deletion of the object. This was seen +during execution of the battery _BIF method on some systems, +resulting in no battery data being returned. + +Added AcpiWalkResources interface to simplify parsing of resource +lists. + +Code and Data Size: Current core subsystem library sizes are shown +below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these +values do not include any ACPI driver or OSPM code. The debug +version of the code includes the debug output trace mechanism and +has a much larger code and data size. Note that these values will +vary depending on the efficiency of the compiler and the compiler +options used during generation. + + Previous Release + Non-Debug Version: 72.0K Code, 9.5K Data, 81.5K Total + Debug Version: 153.0K Code, 62.9K Data, 215.9K Total + Current Release: + Non-Debug Version: 72.3K Code, 9.5K Data, 81.8K Total + Debug Version: 154.0K Code, 63.4K Data, 217.4K Total + + +2) Linux + +S3 fixes (Ole Rohne) + +Update ACPI PHP driver with to use new acpi_walk_resource API +(Bjorn Helgaas) + +Add S4BIOS support (Pavel Machek) + +Map in entire table before performing checksum (John Stultz) + +Expand the mem= cmdline to allow the specification of reserved and +ACPI DATA blocks (Pavel Machek) + +Never use ACPI on VISWS + +Fix derive_pci_id (Ducrot Bruno, Alvaro Lopez) + +Revert a change that allowed P_BLK lengths to be 4 or 5. This is +causing us to think that some systems support C2 when they really +don't. + +Do not count processor objects for non-present CPUs (Thanks to +Dominik Brodowski) + + +3) iASL Compiler: + +Fixed a problem where ASL include files could not be found and +opened. + +Added support for the _PDC reserved name. + + +---------------------------------------- +22 January 2003. Summary of changes for version 20030122. + + +1) ACPI CA Core Subsystem: + +Added a check for constructs of the form: Store (Local0, Local0) +where Local0 is not initialized. Apparently, some BIOS +programmers believe that this is a NOOP. Since this store doesn't +do anything anyway, the new prototype behavior will ignore this +error. This is a case where we can relax the strict checking in +the interpreter in the name of compatibility. + + +2) Linux + +The AcpiSrc Source Conversion Utility has been released with the +Linux package for the first time. This is the utility that is +used to convert the ACPI CA base source code to the Linux version. + +(Both) Handle P_BLK lengths shorter than 6 more gracefully + +(Both) Move more headers to include/acpi, and delete an unused +header. + +(Both) Move drivers/acpi/include directory to include/acpi + +(Both) Boot functions don't use cmdline, so don't pass it around + +(Both) Remove include of unused header (Adrian Bunk) + +(Both) acpiphp.h includes both linux/acpi.h and acpi_bus.h. Since +the +former now also includes the latter, acpiphp.h only needs the one, +now. + +(2.5) Make it possible to select method of bios restoring after S3 +resume. [=> no more ugly ifdefs] (Pavel Machek) + +(2.5) Make proc write interfaces work (Pavel Machek) + +(2.5) Properly init/clean up in cpufreq/acpi (Dominik Brodowski) + +(2.5) Break out ACPI Perf code into its own module, under cpufreq +(Dominik Brodowski) + +(2.4) S4BIOS support (Ducrot Bruno) + +(2.4) Fix acpiphp_glue.c for latest ACPI struct changes (Sergio +Visinoni) + + +3) iASL Compiler: + +Added support to disassemble SSDT and PSDTs. + +Implemented support to obtain SSDTs from the Windows registry if +available. + + +---------------------------------------- +09 January 2003. Summary of changes for version 20030109. + +1) ACPI CA Core Subsystem: + +Changed the behavior of the internal Buffer-to-String conversion +function. The current ACPI specification states that the contents +of the buffer are "converted to a string of two-character +hexadecimal numbers, each separated by a space". Unfortunately, +this definition is not backwards compatible with existing ACPI 1.0 +implementations (although the behavior was not defined in the ACPI +1.0 specification). The new behavior simply copies data from the +buffer to the string until a null character is found or the end of +the buffer is reached. The new String object is always null +terminated. This problem was seen during the generation of _BIF +battery data where incorrect strings were returned for battery +type, etc. This will also require an errata to the ACPI +specification. + +Renamed all instances of NATIVE_UINT and NATIVE_INT to +ACPI_NATIVE_UINT and ACPI_NATIVE_INT, respectively. + +Copyright in all module headers (both Linux and non-Linux) has be +updated to 2003. + +Code and Data Size: Current core subsystem library sizes are shown +below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these +values do not include any ACPI driver or OSPM code. The debug +version of the code includes the debug output trace mechanism and +has a much larger code and data size. Note that these values will +vary depending on the efficiency of the compiler and the compiler +options used during generation. + + Previous Release + Non-Debug Version: 72.0K Code, 9.5K Data, 81.5K Total + Debug Version: 153.0K Code, 62.9K Data, 215.9K Total + Current Release: + Non-Debug Version: 72.0K Code, 9.5K Data, 81.5K Total + Debug Version: 153.0K Code, 62.9K Data, 215.9K Total + + +2) Linux + +Fixed an oops on module insertion/removal (Matthew Tippett) + +(2.4) Fix to handle dynamic size of mp_irqs (Joerg Prante) + +(2.5) Replace pr_debug (Randy Dunlap) + +(2.5) Remove usage of CPUFREQ_ALL_CPUS (Dominik Brodowski) + +(Both) Eliminate spawning of thread from timer callback, in favor +of schedule_work() + +(Both) Show Lid status in /proc (Zdenek OGAR Skalak) + +(Both) Added define for Fixed Function HW region (Matthew Wilcox) + +(Both) Add missing statics to button.c (Pavel Machek) + +Several changes have been made to the source code translation +utility that generates the Linux Code in order to make the code +more "Linux-like": + +All typedefs on structs and unions have been removed in keeping +with the Linux coding style. + +Removed the non-Linux SourceSafe module revision number from each +module header. + +Completed major overhaul of symbols to be lowercased for linux. +Doubled the number of symbols that are lowercased. + +Fixed a problem where identifiers within procedure headers and +within quotes were not fully lower cased (they were left with a +starting capital.) + +Some C macros whose only purpose is to allow the generation of 16- +bit code are now completely removed in the Linux code, increasing +readability and maintainability. + +---------------------------------------- + +12 December 2002. Summary of changes for version 20021212. + + +1) ACPI CA Core Subsystem: + +Fixed a problem where the creation of a zero-length AML Buffer +would cause a fault. + +Fixed a problem where a Buffer object that pointed to a static AML +buffer (in an ACPI table) could inadvertently be deleted, causing +memory corruption. + +Fixed a problem where a user buffer (passed in to the external +ACPI CA interfaces) could be overwritten if the buffer was too +small to complete the operation, causing memory corruption. + +Fixed a problem in the Buffer-to-String conversion code where a +string of length one was always returned, regardless of the size +of the input Buffer object. + +Removed the NATIVE_CHAR data type across the entire source due to +lack of need and lack of consistent use. + +Code and Data Size: Current core subsystem library sizes are shown +below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these +values do not include any ACPI driver or OSPM code. The debug +version of the code includes the debug output trace mechanism and +has a much larger code and data size. Note that these values will +vary depending on the efficiency of the compiler and the compiler +options used during generation. + + Previous Release + Non-Debug Version: 72.1K Code, 9.5K Data, 81.6K Total + Debug Version: 152.7K Code, 62.7K Data, 215.4K Total + Current Release: + Non-Debug Version: 72.0K Code, 9.5K Data, 81.5K Total + Debug Version: 153.0K Code, 62.9K Data, 215.9K Total + + +---------------------------------------- +05 December 2002. Summary of changes for version 20021205. + +1) ACPI CA Core Subsystem: + +Fixed a problem where a store to a String or Buffer object could +cause corruption of the DSDT if the object type being stored was +the same as the target object type and the length of the object +being stored was equal to or smaller than the original (existing) +target object. This was seen to cause corruption of battery _BIF +buffers if the _BIF method modified the buffer on the fly. + +Fixed a problem where an internal error was generated if a control +method invocation was used in an OperationRegion, Buffer, or +Package declaration. This was caused by the deferred parsing of +the control method and thus the deferred creation of the internal +method object. The solution to this problem was to create the +internal method object at the moment the method is encountered in +the first pass - so that subsequent references to the method will +able to obtain the required parameter count and thus properly +parse the method invocation. This problem presented itself as an +AE_AML_INTERNAL during the pass 1 parse phase during table load. + +Fixed a problem where the internal String object copy routine did +not always allocate sufficient memory for the target String object +and caused memory corruption. This problem was seen to cause +"Allocation already present in list!" errors as memory allocation +became corrupted. + +Implemented a new function for the evaluation of namespace objects +that allows the specification of the allowable return object +types. This simplifies a lot of code that checks for a return +object of one or more specific objects returned from the +evaluation (such as _STA, etc.) This may become and external +function if it would be useful to ACPI-related drivers. + +Completed another round of prefixing #defines with "ACPI_" for +clarity. + +Completed additional code restructuring to allow more modular +linking for iASL compiler and AcpiExec. Several files were split +creating new files. New files: nsparse.c dsinit.c evgpe.c + +Implemented an abort mechanism to terminate an executing control +method via the AML debugger. This feature is useful for debugging +control methods that depend (wait) for specific hardware +responses. + +Code and Data Size: Current core subsystem library sizes are shown +below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these +values do not include any ACPI driver or OSPM code. The debug +version of the code includes the debug output trace mechanism and +has a much larger code and data size. Note that these values will +vary depending on the efficiency of the compiler and the compiler +options used during generation. + + Previous Release + Non-Debug Version: 71.4K Code, 9.0K Data, 80.4K Total + Debug Version: 152.9K Code, 63.3K Data, 216.2K Total + Current Release: + Non-Debug Version: 72.1K Code, 9.5K Data, 81.6K Total + Debug Version: 152.7K Code, 62.7K Data, 215.4K Total + + +2) iASL Compiler/Disassembler + +Fixed a compiler code generation problem for "Interrupt" Resource +Descriptors. If specified in the ASL, the optional "Resource +Source Index" and "Resource Source" fields were not inserted into +the correct location within the AML resource descriptor, creating +an invalid descriptor. + +Fixed a disassembler problem for "Interrupt" resource descriptors. +The optional "Resource Source Index" and "Resource Source" fields +were ignored. + + +---------------------------------------- +22 November 2002. Summary of changes for version 20021122. + + +1) ACPI CA Core Subsystem: + +Fixed a reported problem where an object stored to a Method Local +or Arg was not copied to a new object during the store - the +object pointer was simply copied to the Local/Arg. This caused +all subsequent operations on the Local/Arg to also affect the +original source of the store operation. + +Fixed a problem where a store operation to a Method Local or Arg +was not completed properly if the Local/Arg contained a reference +(from RefOf) to a named field. The general-purpose store-to- +namespace-node code is now used so that this case is handled +automatically. + +Fixed a problem where the internal object copy routine would cause +a protection fault if the object being copied was a Package and +contained either 1) a NULL package element or 2) a nested sub- +package. + +Fixed a problem with the GPE initialization that resulted from an +ambiguity in the ACPI specification. One section of the +specification states that both the address and length of the GPE +block must be zero if the block is not supported. Another section +implies that only the address need be zero if the block is not +supported. The code has been changed so that both the address and +the length must be non-zero to indicate a valid GPE block (i.e., +if either the address or the length is zero, the GPE block is +invalid.) + +Code and Data Size: Current core subsystem library sizes are shown +below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these +values do not include any ACPI driver or OSPM code. The debug +version of the code includes the debug output trace mechanism and +has a much larger code and data size. Note that these values will +vary depending on the efficiency of the compiler and the compiler +options used during generation. + + Previous Release + Non-Debug Version: 71.3K Code, 9.0K Data, 80.3K Total + Debug Version: 152.7K Code, 63.2K Data, 215.5K Total + Current Release: + Non-Debug Version: 71.4K Code, 9.0K Data, 80.4K Total + Debug Version: 152.9K Code, 63.3K Data, 216.2K Total + + +2) Linux + +Cleaned up EC driver. Exported an external EC read/write +interface. By going through this, other drivers (most notably +sonypi) will be able to serialize access to the EC. + + +3) iASL Compiler/Disassembler + +Implemented support to optionally generate include files for both +ASM and C (the -i switch). This simplifies BIOS development by +automatically creating include files that contain external +declarations for the symbols that are created within the + +(optionally generated) ASM and C AML source files. + + +---------------------------------------- +15 November 2002. Summary of changes for version 20021115. + +1) ACPI CA Core Subsystem: + +Fixed a memory leak problem where an error during resolution of + +method arguments during a method invocation from another method +failed to cleanup properly by deleting all successfully resolved +argument objects. + +Fixed a problem where the target of the Index() operator was not +correctly constructed if the source object was a package. This +problem has not been detected because the use of a target operand +with Index() is very rare. + +Fixed a problem with the Index() operator where an attempt was +made to delete the operand objects twice. + +Fixed a problem where an attempt was made to delete an operand +twice during execution of the CondRefOf() operator if the target +did not exist. + +Implemented the first of perhaps several internal create object +functions that create and initialize a specific object type. This +consolidates duplicated code wherever the object is created, thus +shrinking the size of the subsystem. + +Implemented improved debug/error messages for errors that occur +during nested method invocations. All executing method pathnames +are displayed (with the error) as the call stack is unwound - thus +simplifying debug. + +Fixed a problem introduced in the 10/02 release that caused +premature deletion of a buffer object if a buffer was used as an +ASL operand where an integer operand is required (Thus causing an +implicit object conversion from Buffer to Integer.) The change in +the 10/02 release was attempting to fix a memory leak (albeit +incorrectly.) + +Code and Data Size: Current core subsystem library sizes are shown +below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these +values do not include any ACPI driver or OSPM code. The debug +version of the code includes the debug output trace mechanism and +has a much larger code and data size. Note that these values will +vary depending on the efficiency of the compiler and the compiler +options used during generation. + + Previous Release + Non-Debug Version: 71.9K Code, 9.1K Data, 81.0K Total + Debug Version: 153.1K Code, 63.3K Data, 216.4K Total + Current Release: + Non-Debug Version: 71.3K Code, 9.0K Data, 80.3K Total + Debug Version: 152.7K Code, 63.2K Data, 215.5K Total + + +2) Linux + +Changed the implementation of the ACPI semaphores to use down() +instead of down_interruptable(). It is important that the +execution of ACPI control methods not be interrupted by signals. +Methods must run to completion, or the system may be left in an +unknown/unstable state. + +Fixed a compilation error when CONFIG_SOFTWARE_SUSPEND is not set. +(Shawn Starr) + + +3) iASL Compiler/Disassembler + + +Changed the default location of output files. All output files +are now placed in the current directory by default instead of in +the directory of the source file. This change may affect some +existing makefiles, but it brings the behavior of the compiler in +line with other similar tools. The location of the output files +can be overridden with the -p command line switch. + + +---------------------------------------- +11 November 2002. Summary of changes for version 20021111. + + +0) ACPI Specification 2.0B is released and is now available at: +http://www.acpi.info/index.html + + +1) ACPI CA Core Subsystem: + +Implemented support for the ACPI 2.0 SMBus Operation Regions. +This includes the early detection and handoff of the request to +the SMBus region handler (avoiding all of the complex field +support code), and support for the bidirectional return packet +from an SMBus write operation. This paves the way for the +development of SMBus drivers in each host operating system. + +Fixed a problem where the semaphore WAIT_FOREVER constant was +defined as 32 bits, but must be 16 bits according to the ACPI +specification. This had the side effect of causing ASL +Mutex/Event timeouts even though the ASL code requested a wait +forever. Changed all internal references to the ACPI timeout +parameter to 16 bits to prevent future problems. Changed the name +of WAIT_FOREVER to ACPI_WAIT_FOREVER. + +Code and Data Size: Current core subsystem library sizes are shown +below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these +values do not include any ACPI driver or OSPM code. The debug +version of the code includes the debug output trace mechanism and +has a much larger code and data size. Note that these values will +vary depending on the efficiency of the compiler and the compiler +options used during generation. + + Previous Release + Non-Debug Version: 71.4K Code, 9.0K Data, 80.4K Total + Debug Version: 152.3K Code, 63.0K Data, 215.3K Total + Current Release: + Non-Debug Version: 71.9K Code, 9.1K Data, 81.0K Total + Debug Version: 153.1K Code, 63.3K Data, 216.4K Total + + +2) Linux + +Module loading/unloading fixes (John Cagle) + + +3) iASL Compiler/Disassembler + +Added support for the SMBBlockProcessCall keyword (ACPI 2.0) + +Implemented support for the disassembly of all SMBus protocol +keywords (SMBQuick, SMBWord, etc.) + +---------------------------------------- +01 November 2002. Summary of changes for version 20021101. + + +1) ACPI CA Core Subsystem: + +Fixed a problem where platforms that have a GPE1 block but no GPE0 +block were not handled correctly. This resulted in a "GPE +overlap" error message. GPE0 is no longer required. + +Removed code added in the previous release that inserted nodes +into the namespace in alphabetical order. This caused some side- +effects on various machines. The root cause of the problem is +still under investigation since in theory, the internal ordering +of the namespace nodes should not matter. + + +Enhanced error reporting for the case where a named object is not +found during control method execution. The full ACPI namepath +(name reference) of the object that was not found is displayed in +this case. + +Note: as a result of the overhaul of the namespace object types in +the previous release, the namespace nodes for the predefined +scopes (_TZ, _PR, etc.) are now of the type ACPI_TYPE_LOCAL_SCOPE +instead of ACPI_TYPE_ANY. This simplifies the namespace +management code but may affect code that walks the namespace tree +looking for specific object types. + +Code and Data Size: Current core subsystem library sizes are shown +below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these +values do not include any ACPI driver or OSPM code. The debug +version of the code includes the debug output trace mechanism and +has a much larger code and data size. Note that these values will +vary depending on the efficiency of the compiler and the compiler +options used during generation. + + Previous Release + Non-Debug Version: 70.7K Code, 8.6K Data, 79.3K Total + Debug Version: 151.7K Code, 62.4K Data, 214.1K Total + Current Release: + Non-Debug Version: 71.4K Code, 9.0K Data, 80.4K Total + Debug Version: 152.3K Code, 63.0K Data, 215.3K Total + + +2) Linux + +Fixed a problem introduced in the previous release where the +Processor and Thermal objects were not recognized and installed in +/proc. This was related to the scope type change described above. + + +3) iASL Compiler/Disassembler + +Implemented the -g option to get all of the required ACPI tables +from the registry and save them to files (Windows version of the +compiler only.) The required tables are the FADT, FACS, and DSDT. + +Added ACPI table checksum validation during table disassembly in +order to catch corrupted tables. + + +---------------------------------------- +22 October 2002. Summary of changes for version 20021022. + +1) ACPI CA Core Subsystem: + +Implemented a restriction on the Scope operator that the target +must already exist in the namespace at the time the operator is +encountered (during table load or method execution). In other +words, forward references are not allowed and Scope() cannot +create a new object. This changes the previous behavior where the +interpreter would create the name if not found. This new behavior +correctly enables the search-to-root algorithm during namespace +lookup of the target name. Because of this upsearch, this fixes +the known Compaq _SB_.OKEC problem and makes both the AML +interpreter and iASL compiler compatible with other ACPI +implementations. + +Completed a major overhaul of the internal ACPI object types for +the ACPI Namespace and the associated operand objects. Many of +these types had become obsolete with the introduction of the two- +pass namespace load. This cleanup simplifies the code and makes +the entire namespace load mechanism much clearer and easier to +understand. + +Improved debug output for tracking scope opening/closing to help +diagnose scoping issues. The old scope name as well as the new +scope name are displayed. Also improved error messages for +problems with ASL Mutex objects and error messages for GPE +problems. + +Cleaned up the namespace dump code, removed obsolete code. + +All string output (for all namespace/object dumps) now uses the +common ACPI string output procedure which handles escapes properly +and does not emit non-printable characters. + +Fixed some issues with constants in the 64-bit version of the +local C library (utclib.c) + + +2) Linux + +EC Driver: No longer attempts to acquire the Global Lock at +interrupt level. + + +3) iASL Compiler/Disassembler + +Implemented ACPI 2.0B grammar change that disallows all Type 1 and +2 opcodes outside of a control method. This means that the +"executable" operators (versus the "namespace" operators) cannot +be used at the table level; they can only be used within a control +method. + +Implemented the restriction on the Scope() operator where the +target must already exist in the namespace at the time the +operator is encountered (during ASL compilation). In other words, +forward references are not allowed and Scope() cannot create a new +object. This makes the iASL compiler compatible with other ACPI +implementations and makes the Scope() implementation adhere to the +ACPI specification. + +Fixed a problem where namepath optimization for the Alias operator +was optimizing the wrong path (of the two namepaths.) This caused +a "Missing alias link" error message. + +Fixed a problem where an "unknown reserved name" warning could be +incorrectly generated for names like "_SB" when the trailing +underscore is not used in the original ASL. + +Fixed a problem where the reserved name check did not handle +NamePaths with multiple NameSegs correctly. The first nameseg of +the NamePath was examined instead of the last NameSeg. + + +---------------------------------------- + +02 October 2002. Summary of changes for this release. + + +1) ACPI CA Core Subsystem version 20021002: + +Fixed a problem where a store/copy of a string to an existing +string did not always set the string length properly in the String +object. + +Fixed a reported problem with the ToString operator where the +behavior was identical to the ToHexString operator instead of just +simply converting a raw buffer to a string data type. + +Fixed a problem where CopyObject and the other "explicit" +conversion operators were not updating the internal namespace node +type as part of the store operation. + +Fixed a memory leak during implicit source operand conversion +where the original object was not deleted if it was converted to a +new object of a different type. + +Enhanced error messages for all problems associated with namespace +lookups. Common procedure generates and prints the lookup name as +well as the formatted status. + +Completed implementation of a new design for the Alias support +within the namespace. The existing design did not handle the case +where a new object was assigned to one of the two names due to the +use of an explicit conversion operator, resulting in the two names +pointing to two different objects. The new design simply points +the Alias name to the original name node - not to the object. +This results in a level of indirection that must be handled in the +name resolution mechanism. + +Code and Data Size: Current core subsystem library sizes are shown +below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these +values do not include any ACPI driver or OSPM code. The debug +version of the code includes the debug output trace mechanism and +has a larger code and data size. Note that these values will vary +depending on the efficiency of the compiler and the compiler +options used during generation. + + Previous Release + Non-Debug Version: 69.6K Code, 8.3K Data, 77.9K Total + Debug Version: 150.0K Code, 61.7K Data, 211.7K Total + Current Release: + Non-Debug Version: 70.7K Code, 8.6K Data, 79.3K Total + Debug Version: 151.7K Code, 62.4K Data, 214.1K Total + + +2) Linux + +Initialize thermal driver's timer before it is used. (Knut +Neumann) + +Allow handling negative celsius values. (Kochi Takayoshi) + +Fix thermal management and make trip points. R/W (Pavel Machek) + +Fix /proc/acpi/sleep. (P. Christeas) + +IA64 fixes. (David Mosberger) + +Fix reversed logic in blacklist code. (Sergio Monteiro Basto) + +Replace ACPI_DEBUG define with ACPI_DEBUG_OUTPUT. (Dominik +Brodowski) + + +3) iASL Compiler/Disassembler + +Clarified some warning/error messages. + + +---------------------------------------- +18 September 2002. Summary of changes for this release. + + +1) ACPI CA Core Subsystem version 20020918: + +Fixed a reported problem with reference chaining (via the Index() +and RefOf() operators) in the ObjectType() and SizeOf() operators. +The definition of these operators includes the dereferencing of +all chained references to return information on the base object. + +Fixed a problem with stores to indexed package elements - the +existing code would not complete the store if an "implicit +conversion" was not performed. In other words, if the existing +object (package element) was to be replaced completely, the code +didn't handle this case. + +Relaxed typechecking on the ASL "Scope" operator to allow the +target name to refer to an object of type Integer, String, or +Buffer, in addition to the scoping object types (Device, +predefined Scopes, Processor, PowerResource, and ThermalZone.) +This allows existing AML code that has workarounds for a bug in +Windows to function properly. A warning is issued, however. This +affects both the AML interpreter and the iASL compiler. Below is +an example of this type of ASL code: + + Name(DEB,0x00) + Scope(DEB) + { + +Fixed some reported problems with 64-bit integer support in the +local implementation of C library functions (clib.c) + + +2) Linux + +Use ACPI fix map region instead of IOAPIC region, since it is +undefined in non-SMP. + +Ensure that the SCI has the proper polarity and trigger, even on +systems that do not have an interrupt override entry in the MADT. + +2.5 big driver reorganization (Pat Mochel) + +Use early table mapping code from acpitable.c (Andi Kleen) + +New blacklist entries (Andi Kleen) + +Blacklist improvements. Split blacklist code out into a separate +file. Move checking the blacklist to very early. Previously, we +would use ACPI tables, and then halfway through init, check the +blacklist -- too late. Now, it's early enough to completely fall- +back to non-ACPI. + + +3) iASL Compiler/Disassembler version 20020918: + +Fixed a problem where the typechecking code didn't know that an +alias could point to a method. In other words, aliases were not +being dereferenced during typechecking. + + +---------------------------------------- +29 August 2002. Summary of changes for this release. + +1) ACPI CA Core Subsystem Version 20020829: + +If the target of a Scope() operator already exists, it must be an +object type that actually opens a scope -- such as a Device, +Method, Scope, etc. This is a fatal runtime error. Similar error +check has been added to the iASL compiler also. + +Tightened up the namespace load to disallow multiple names in the +same scope. This previously was allowed if both objects were of +the same type. (i.e., a lookup was the same as entering a new +name). + + +2) Linux + +Ensure that the ACPI interrupt has the proper trigger and +polarity. + +local_irq_disable is extraneous. (Matthew Wilcox) + +Make "acpi=off" actually do what it says, and not use the ACPI +interpreter *or* the tables. + +Added arch-neutral support for parsing SLIT and SRAT tables (Kochi +Takayoshi) + + +3) iASL Compiler/Disassembler Version 20020829: + +Implemented namepath optimization for name declarations. For +example, a declaration like "Method (\_SB_.ABCD)" would get +optimized to "Method (ABCD)" if the declaration is within the +\_SB_ scope. This optimization is in addition to the named +reference path optimization first released in the previous +version. This would seem to complete all possible optimizations +for namepaths within the ASL/AML. + +If the target of a Scope() operator already exists, it must be an +object type that actually opens a scope -- such as a Device, +Method, Scope, etc. + +Implemented a check and warning for unreachable code in the same +block below a Return() statement. + +Fixed a problem where the listing file was not generated if the +compiler aborted if the maximum error count was exceeded (200). + +Fixed a problem where the typechecking of method return values was +broken. This includes the check for a return value when the +method is invoked as a TermArg (a return value is expected.) + +Fixed a reported problem where EOF conditions during a quoted +string or comment caused a fault. + + +---------------------------------------- +15 August 2002. Summary of changes for this release. + +1) ACPI CA Core Subsystem Version 20020815: + +Fixed a reported problem where a Store to a method argument that +contains a reference did not perform the indirect store correctly. +This problem was created during the conversion to the new +reference object model - the indirect store to a method argument +code was not updated to reflect the new model. + +Reworked the ACPI mode change code to better conform to ACPI 2.0, +handle corner cases, and improve code legibility (Kochi Takayoshi) + +Fixed a problem with the pathname parsing for the carat (^) +prefix. The heavy use of the carat operator by the new namepath +optimization in the iASL compiler uncovered a problem with the AML +interpreter handling of this prefix. In the case where one or +more carats precede a single nameseg, the nameseg was treated as +standalone and the search rule (to root) was inadvertently +applied. This could cause both the iASL compiler and the +interpreter to find the wrong object or to miss the error that +should occur if the object does not exist at that exact pathname. + +Found and fixed the problem where the HP Pavilion DSDT would not +load. This was a relatively minor tweak to the table loading code +(a problem caused by the unexpected encounter with a method +invocation not within a control method), but it does not solve the +overall issue of the execution of AML code at the table level. +This investigation is still ongoing. + +Code and Data Size: Current core subsystem library sizes are shown +below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these +values do not include any ACPI driver or OSPM code. The debug +version of the code includes the debug output trace mechanism and +has a larger code and data size. Note that these values will vary +depending on the efficiency of the compiler and the compiler +options used during generation. + + Previous Release + Non-Debug Version: 69.1K Code, 8.2K Data, 77.3K Total + Debug Version: 149.4K Code, 61.6K Data, 211.0K Total + Current Release: + Non-Debug Version: 69.6K Code, 8.3K Data, 77.9K Total + Debug Version: 150.0K Code, 61.7K Data, 211.7K Total + + +2) Linux + +Remove redundant slab.h include (Brad Hards) + +Fix several bugs in thermal.c (Herbert Nachtnebel) + +Make CONFIG_ACPI_BOOT work properly (Pavel Machek) + +Change acpi_system_suspend to use updated irq functions (Pavel +Machek) + +Export acpi_get_firmware_table (Matthew Wilcox) + +Use proper root proc entry for ACPI (Kochi Takayoshi) + +Fix early-boot table parsing (Bjorn Helgaas) + + +3) iASL Compiler/Disassembler + +Reworked the compiler options to make them more consistent and to +use two-letter options where appropriate. We were running out of +sensible letters. This may break some makefiles, so check the +current options list by invoking the compiler with no parameters. + +Completed the design and implementation of the ASL namepath +optimization option for the compiler. This option optimizes all +references to named objects to the shortest possible path. The +first attempt tries to utilize a single nameseg (4 characters) and +the "search-to-root" algorithm used by the interpreter. If that +cannot be used (because either the name is not in the search path +or there is a conflict with another object with the same name), +the pathname is optimized using the carat prefix (usually a +shorter string than specifying the entire path from the root.) + +Implemented support to obtain the DSDT from the Windows registry +(when the disassembly option is specified with no input file). +Added this code as the implementation for AcpiOsTableOverride in +the Windows OSL. Migrated the 16-bit code (used in the AcpiDump +utility) to scan memory for the DSDT to the AcpiOsTableOverride +function in the DOS OSL to make the disassembler truly OS +independent. + +Implemented a new option to disassemble and compile in one step. +When used without an input filename, this option will grab the +DSDT from the local machine, disassemble it, and compile it in one +step. + +Added a warning message for invalid escapes (a backslash followed +by any character other than the allowable escapes). This catches +the quoted string error "\_SB_" (which should be "\\_SB_" ). + +Also, there are numerous instances in the ACPI specification where +this error occurs. + +Added a compiler option to disable all optimizations. This is +basically the "compatibility mode" because by using this option, +the AML code will come out exactly the same as other ASL +compilers. + +Added error messages for incorrectly ordered dependent resource +functions. This includes: missing EndDependentFn macro at end of +dependent resource list, nested dependent function macros (both +start and end), and missing StartDependentFn macro. These are +common errors that should be caught at compile time. + +Implemented _OSI support for the disassembler and compiler. _OSI +must be included in the namespace for proper disassembly (because +the disassembler must know the number of arguments.) + +Added an "optimization" message type that is optional (off by +default). This message is used for all optimizations - including +constant folding, integer optimization, and namepath optimization. + +---------------------------------------- +25 July 2002. Summary of changes for this release. + + +1) ACPI CA Core Subsystem Version 20020725: + +The AML Disassembler has been enhanced to produce compilable ASL +code and has been integrated into the iASL compiler (see below) as +well as the single-step disassembly for the AML debugger and the +disassembler for the AcpiDump utility. All ACPI 2.0A opcodes, +resource templates and macros are fully supported. The +disassembler has been tested on over 30 different AML files, +producing identical AML when the resulting disassembled ASL file +is recompiled with the same ASL compiler. + +Modified the Resource Manager to allow zero interrupts and zero +dma channels during the GetCurrentResources call. This was +causing problems on some platforms. + +Added the AcpiOsRedirectOutput interface to the OSL to simplify +output redirection for the AcpiOsPrintf and AcpiOsVprintf +interfaces. + +Code and Data Size: Current core subsystem library sizes are shown +below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these +values do not include any ACPI driver or OSPM code. The debug +version of the code includes the debug output trace mechanism and +has a larger code and data size. Note that these values will vary +depending on the efficiency of the compiler and the compiler +options used during generation. + + Previous Release + Non-Debug Version: 68.7K Code, 7.4K Data, 76.1K Total + Debug Version: 142.9K Code, 58.7K Data, 201.6K Total + Current Release: + Non-Debug Version: 69.1K Code, 8.2K Data, 77.3K Total + Debug Version: 149.4K Code, 61.6K Data, 211.0K Total + + +2) Linux + +Fixed a panic in the EC driver (Dominik Brodowski) + +Implemented checksum of the R/XSDT itself during Linux table scan +(Richard Schaal) + + +3) iASL compiler + +The AML disassembler is integrated into the compiler. The "-d" +option invokes the disassembler to completely disassemble an +input AML file, producing as output a text ASL file with the +extension ".dsl" (to avoid name collisions with existing .asl +source files.) A future enhancement will allow the disassembler +to obtain the BIOS DSDT from the registry under Windows. + +Fixed a problem with the VendorShort and VendorLong resource +descriptors where an invalid AML sequence was created. + +Implemented a fix for BufferData term in the ASL parser. It was +inadvertently defined twice, allowing invalid syntax to pass and +causing reduction conflicts. + +Fixed a problem where the Ones opcode could get converted to a +value of zero if "Ones" was used where a byte, word or dword value +was expected. The 64-bit value is now truncated to the correct +size with the correct value. + + + +---------------------------------------- +02 July 2002. Summary of changes for this release. + + +1) ACPI CA Core Subsystem Version 20020702: + +The Table Manager code has been restructured to add several new +features. Tables that are not required by the core subsystem +(other than the FADT, DSDT, FACS, PSDTs, etc.) are no longer +validated in any way and are returned from AcpiGetFirmwareTable if +requested. The AcpiOsTableOverride interface is now called for +each table that is loaded by the subsystem in order to allow the +host to override any table it chooses. Previously, only the DSDT +could be overridden. Added one new files, tbrsdt.c and +tbgetall.c. + +Fixed a problem with the conversion of internal package objects to +external objects (when a package is returned from a control +method.) The return buffer length was set to zero instead of the +proper length of the package object. + +Fixed a reported problem with the use of the RefOf and DeRefOf +operators when passing reference arguments to control methods. A +new type of Reference object is used internally for references +produced by the RefOf operator. + +Added additional error messages in the Resource Manager to explain +AE_BAD_DATA errors when they occur during resource parsing. + +Split the AcpiEnableSubsystem into two primitives to enable a +finer granularity initialization sequence. These two calls should +be called in this order: AcpiEnableSubsystem (flags), +AcpiInitializeObjects (flags). The flags parameter remains the +same. + + +2) Linux + +Updated the ACPI utilities module to understand the new style of +fully resolved package objects that are now returned from the core +subsystem. This eliminates errors of the form: + + ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.PPB_._PRT] + acpi_utils-0430 [145] acpi_evaluate_reference: + Invalid element in package (not a device reference) + +The method evaluation utility uses the new buffer allocation +scheme instead of calling AcpiEvaluate Object twice. + +Added support for ECDT. This allows the use of the Embedded + +Controller before the namespace has been fully initialized, which +is necessary for ACPI 2.0 support, and for some laptops to +initialize properly. (Laptops using ECDT are still rare, so only +limited testing was performed of the added functionality.) + +Fixed memory leaks in the EC driver. + +Eliminated a brittle code structure in acpi_bus_init(). + +Eliminated the acpi_evaluate() helper function in utils.c. It is +no longer needed since acpi_evaluate_object can optionally +allocate memory for the return object. + +Implemented fix for keyboard hang when getting battery readings on +some systems (Stephen White) + +PCI IRQ routing update (Dominik Brodowski) + +Fix an ifdef to allow compilation on UP with LAPIC but no IOAPIC +support + +---------------------------------------- +11 June 2002. Summary of changes for this release. + + +1) ACPI CA Core Subsystem Version 20020611: + +Fixed a reported problem where constants such as Zero and One +appearing within _PRT packages were not handled correctly within +the resource manager code. Originally reported against the ASL +compiler because the code generator now optimizes integers to +their minimal AML representation (i.e. AML constants if possible.) +The _PRT code now handles all AML constant opcodes correctly +(Zero, One, Ones, Revision). + +Fixed a problem with the Concatenate operator in the AML +interpreter where a buffer result object was incorrectly marked as +not fully evaluated, causing a run-time error of AE_AML_INTERNAL. + +All package sub-objects are now fully resolved before they are +returned from the external ACPI interfaces. This means that name +strings are resolved to object handles, and constant operators +(Zero, One, Ones, Revision) are resolved to Integers. + +Implemented immediate resolution of the AML Constant opcodes +(Zero, One, Ones, Revision) to Integer objects upon detection +within the AML stream. This has simplified and reduced the +generated code size of the subsystem by eliminating about 10 +switch statements for these constants (which previously were +contained in Reference objects.) The complicating issues are that +the Zero opcode is used as a "placeholder" for unspecified +optional target operands and stores to constants are defined to be +no-ops. + +Code and Data Size: Current core subsystem library sizes are shown +below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these +values do not include any ACPI driver or OSPM code. The debug +version of the code includes the debug output trace mechanism and +has a larger code and data size. Note that these values will vary +depending on the efficiency of the compiler and the compiler +options used during generation. + + Previous Release + Non-Debug Version: 69.3K Code, 7.4K Data, 76.7K Total + Debug Version: 143.8K Code, 58.8K Data, 202.6K Total + Current Release: + Non-Debug Version: 68.7K Code, 7.4K Data, 76.1K Total + Debug Version: 142.9K Code, 58.7K Data, 201.6K Total + + +2) Linux + + +Added preliminary support for obtaining _TRA data for PCI root +bridges (Bjorn Helgaas). + + +3) iASL Compiler Version X2046: + +Fixed a problem where the "_DDN" reserved name was defined to be a +control method with one argument. There are no arguments, and +_DDN does not have to be a control method. + +Fixed a problem with the Linux version of the compiler where the +source lines printed with error messages were the wrong lines. +This turned out to be the "LF versus CR/LF" difference between +Windows and Unix. This appears to be the longstanding issue +concerning listing output and error messages. + +Fixed a problem with the Linux version of compiler where opcode +names within error messages were wrong. This was caused by a +slight difference in the output of the Flex tool on Linux versus +Windows. + +Fixed a problem with the Linux compiler where the hex output files +contained some garbage data caused by an internal buffer overrun. + + +---------------------------------------- +17 May 2002. Summary of changes for this release. + + +1) ACPI CA Core Subsystem Version 20020517: + +Implemented a workaround to an BIOS bug discovered on the HP +OmniBook where the FADT revision number and the table size are +inconsistent (ACPI 2.0 revision vs. ACPI 1.0 table size). The new +behavior is to fallback to using only the ACPI 1.0 fields of the +FADT if the table is too small to be a ACPI 2.0 table as claimed +by the revision number. Although this is a BIOS bug, this is a +case where the workaround is simple enough and with no side +effects, so it seemed prudent to add it. A warning message is +issued, however. + +Implemented minimum size checks for the fixed-length ACPI tables - +- the FADT and FACS, as well as consistency checks between the +revision number and the table size. + +Fixed a reported problem in the table override support where the +new table pointer was incorrectly treated as a physical address +instead of a logical address. + +Eliminated the use of the AE_AML_ERROR exception and replaced it +with more descriptive codes. + +Fixed a problem where an exception would occur if an ASL Field was +defined with no named Field Units underneath it (used by some +index fields). + +Code and Data Size: Current core subsystem library sizes are shown +below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these +values do not include any ACPI driver or OSPM code. The debug +version of the code includes the debug output trace mechanism and +has a larger code and data size. Note that these values will vary +depending on the efficiency of the compiler and the compiler +options used during generation. + + Previous Release + Non-Debug Version: 68.8K Code, 7.1K Data, 75.9K Total + Debug Version: 142.9K Code, 58.4K Data, 201.3K Total + Current Release: + Non-Debug Version: 69.3K Code, 7.4K Data, 76.7K Total + Debug Version: 143.8K Code, 58.8K Data, 202.6K Total + + + +2) Linux + +Much work done on ACPI init (MADT and PCI IRQ routing support). +(Paul D. and Dominik Brodowski) + +Fix PCI IRQ-related panic on boot (Sam Revitch) + +Set BM_ARB_DIS when entering a sleep state (Ducrot Bruno) + +Fix "MHz" typo (Dominik Brodowski) + +Fix RTC year 2000 issue (Dominik Brodowski) + +Preclude multiple button proc entries (Eric Brunet) + +Moved arch-specific code out of include/platform/aclinux.h + +3) iASL Compiler Version X2044: + +Implemented error checking for the string used in the EISAID macro +(Usually used in the definition of the _HID object.) The code now +strictly enforces the PnP format - exactly 7 characters, 3 +uppercase letters and 4 hex digits. + +If a raw string is used in the definition of the _HID object +(instead of the EISAID macro), the string must contain all +alphanumeric characters (e.g., "*PNP0011" is not allowed because +of the asterisk.) + +Implemented checking for invalid use of ACPI reserved names for +most of the name creation operators (Name, Device, Event, Mutex, +OperationRegion, PowerResource, Processor, and ThermalZone.) +Previously, this check was only performed for control methods. + +Implemented an additional check on the Name operator to emit an +error if a reserved name that must be implemented in ASL as a +control method is used. We know that a reserved name must be a +method if it is defined with input arguments. + +The warning emitted when a namespace object reference is not found +during the cross reference phase has been changed into an error. +The "External" directive should be used for names defined in other +modules. + + +4) Tools and Utilities + +The 16-bit tools (adump16 and aexec16) have been regenerated and +tested. + +Fixed a problem with the output of both acpidump and adump16 where +the indentation of closing parentheses and brackets was not + +aligned properly with the parent block. + + +---------------------------------------- +03 May 2002. Summary of changes for this release. + + +1) ACPI CA Core Subsystem Version 20020503: + +Added support a new OSL interface that allows the host operating + +system software to override the DSDT found in the firmware - +AcpiOsTableOverride. With this interface, the OSL can examine the +version of the firmware DSDT and replace it with a different one +if desired. + +Added new external interfaces for accessing ACPI registers from +device drivers and other system software - AcpiGetRegister and +AcpiSetRegister. This was simply an externalization of the +existing AcpiHwBitRegister interfaces. + +Fixed a regression introduced in the previous build where the +ASL/AML CreateField operator always returned an error, +"destination must be a NS Node". + +Extended the maximum time (before failure) to successfully enable +ACPI mode to 3 seconds. + +Code and Data Size: Current core subsystem library sizes are shown +below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these +values do not include any ACPI driver or OSPM code. The debug +version of the code includes the debug output trace mechanism and +has a larger code and data size. Note that these values will vary +depending on the efficiency of the compiler and the compiler +options used during generation. + + Previous Release + Non-Debug Version: 68.5K Code, 7.0K Data, 75.5K Total + Debug Version: 142.4K Code, 58.3K Data, 200.7K Total + Current Release: + Non-Debug Version: 68.8K Code, 7.1K Data, 75.9K Total + Debug Version: 142.9K Code, 58.4K Data, 201.3K Total + + +2) Linux + +Enhanced ACPI init code for SMP. We are now fully MPS and $PIR- +free. While 3 out of 4 of our in-house systems work fine, the last +one still hangs when testing the LAPIC timer. + +Renamed many files in 2.5 kernel release to omit "acpi_" from the +name. + +Added warning on boot for Presario 711FR. + +Sleep improvements (Pavel Machek) + +ACPI can now be built without CONFIG_PCI enabled. + +IA64: Fixed memory map functions (JI Lee) + + +3) iASL Compiler Version X2043: + +Added support to allow the compiler to be integrated into the MS +VC++ development environment for one-button compilation of single +files or entire projects -- with error-to-source-line mapping. + +Implemented support for compile-time constant folding for the +Type3, Type4, and Type5 opcodes first defined in the ACPI 2.0 +specification. This allows the ASL writer to use expressions +instead of Integer/Buffer/String constants in terms that must +evaluate to constants at compile time and will also simplify the +emitted AML in any such sub-expressions that can be folded +(evaluated at compile-time.) This increases the size of the +compiler significantly because a portion of the ACPI CA AML +interpreter is included within the compiler in order to pre- +evaluate constant expressions. + + +Fixed a problem with the "Unicode" ASL macro that caused the +compiler to fault. (This macro is used in conjunction with the +_STR reserved name.) + +Implemented an AML opcode optimization to use the Zero, One, and +Ones opcodes where possible to further reduce the size of integer +constants and thus reduce the overall size of the generated AML +code. + +Implemented error checking for new reserved terms for ACPI version +2.0A. + +Implemented the -qr option to display the current list of ACPI +reserved names known to the compiler. + +Implemented the -qc option to display the current list of ASL +operators that are allowed within constant expressions and can +therefore be folded at compile time if the operands are constants. + + +4) Documentation + +Updated the Programmer's Reference for new interfaces, data types, +and memory allocation model options. + +Updated the iASL Compiler User Reference to apply new format and +add information about new features and options. + +---------------------------------------- +19 April 2002. Summary of changes for this release. + +1) ACPI CA Core Subsystem Version 20020419: + +The source code base for the Core Subsystem has been completely +cleaned with PC-lint (FlexLint) for both 32-bit and 64-bit +versions. The Lint option files used are included in the +/acpi/generate/lint directory. + +Implemented enhanced status/error checking across the entire +Hardware manager subsystem. Any hardware errors (reported from +the OSL) are now bubbled up and will abort a running control +method. + + +Fixed a problem where the per-ACPI-table integer width (32 or 64) +was stored only with control method nodes, causing a fault when +non-control method code was executed during table loading. The +solution implemented uses a global variable to indicate table +width across the entire ACPI subsystem. Therefore, ACPI CA does +not support mixed integer widths across different ACPI tables +(DSDT, SSDT). + +Fixed a problem where NULL extended fields (X fields) in an ACPI +2.0 ACPI FADT caused the table load to fail. Although the +existing ACPI specification is a bit fuzzy on this topic, the new +behavior is to fall back on a ACPI 1.0 field if the corresponding +ACPI 2.0 X field is zero (even though the table revision indicates +a full ACPI 2.0 table.) The ACPI specification will be updated to +clarify this issue. + +Fixed a problem with the SystemMemory operation region handler +where memory was always accessed byte-wise even if the AML- +specified access width was larger than a byte. This caused +problems on systems with memory-mapped I/O. Memory is now +accessed with the width specified. On systems that do not support +non-aligned transfers, a check is made to guarantee proper address +alignment before proceeding in order to avoid an AML-caused +alignment fault within the kernel. + + +Fixed a problem with the ExtendedIrq resource where only one byte +of the 4-byte Irq field was extracted. + +Fixed the AcpiExDigitsNeeded() procedure to support _UID. This +function was out of date and required a rewrite. + +Code and Data Size: Current core subsystem library sizes are shown +below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these +values do not include any ACPI driver or OSPM code. The debug +version of the code includes the debug output trace mechanism and +has a larger code and data size. Note that these values will vary +depending on the efficiency of the compiler and the compiler +options used during generation. + + Previous Release + Non-Debug Version: 66.6K Code, 6.5K Data, 73.1K Total + Debug Version: 139.8K Code, 57.4K Data, 197.2K Total + Current Release: + Non-Debug Version: 68.5K Code, 7.0K Data, 75.5K Total + Debug Version: 142.4K Code, 58.3K Data, 200.7K Total + + +2) Linux + +PCI IRQ routing fixes (Dominik Brodowski) + + +3) iASL Compiler Version X2042: + +Implemented an additional compile-time error check for a field +unit whose size + minimum access width would cause a run-time +access beyond the end-of-region. Previously, only the field size +itself was checked. + +The Core subsystem and iASL compiler now share a common parse +object in preparation for compile-time evaluation of the type +3/4/5 ASL operators. + + +---------------------------------------- +Summary of changes for this release: 03_29_02 + +1) ACPI CA Core Subsystem Version 20020329: + +Implemented support for late evaluation of TermArg operands to +Buffer and Package objects. This allows complex expressions to be +used in the declarations of these object types. + +Fixed an ACPI 1.0 compatibility issue when reading Fields. In ACPI +1.0, if the field was larger than 32 bits, it was returned as a +buffer - otherwise it was returned as an integer. In ACPI 2.0, +the field is returned as a buffer only if the field is larger than +64 bits. The TableRevision is now considered when making this +conversion to avoid incompatibility with existing ASL code. + +Implemented logical addressing for AcpiOsGetRootPointer. This +allows an RSDP with either a logical or physical address. With +this support, the host OS can now override all ACPI tables with +one logical RSDP. Includes implementation of "typed" pointer +support to allow a common data type for both physical and logical +pointers internally. This required a change to the +AcpiOsGetRootPointer interface. + +Implemented the use of ACPI 2.0 Generic Address Structures for all +GPE, Fixed Event, and PM Timer I/O. This allows the use of memory +mapped I/O for these ACPI features. + +Initialization now ignores not only non-required tables (All +tables other than the FADT, FACS, DSDT, and SSDTs), but also does +not validate the table headers of unrecognized tables. + +Fixed a problem where a notify handler could only be +installed/removed on an object of type Device. All "notify" + +objects are now supported -- Devices, Processor, Power, and +Thermal. + +Removed most verbosity from the ACPI_DB_INFO debug level. Only +critical information is returned when this debug level is enabled. + +Code and Data Size: Current core subsystem library sizes are shown +below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these +values do not include any ACPI driver or OSPM code. The debug +version of the code includes the debug output trace mechanism and +has a larger code and data size. Note that these values will vary +depending on the efficiency of the compiler and the compiler +options used during generation. + + Previous Release + Non-Debug Version: 65.4K Code, 6.2K Data, 71.6K Total + Debug Version: 138.0K Code, 56.6K Data, 194.6K Total + Current Release: + Non-Debug Version: 66.6K Code, 6.5K Data, 73.1K Total + Debug Version: 139.8K Code, 57.4K Data, 197.2K Total + + +2) Linux: + +The processor driver (acpi_processor.c) now fully supports ACPI +2.0-based processor performance control (e.g. Intel(R) +SpeedStep(TM) technology) Note that older laptops that only have +the Intel "applet" interface are not supported through this. The +'limit' and 'performance' interface (/proc) are fully functional. +[Note that basic policy for controlling performance state +transitions will be included in the next version of ospmd.] The +idle handler was modified to more aggressively use C2, and PIIX4 +errata handling underwent a complete overhaul (big thanks to +Dominik Brodowski). + +Added support for ACPI-PCI device binding (acpi_pci_root.c). _ADR- +based devices in the ACPI namespace are now dynamically bound +(associated) with their PCI counterparts (e.g. PCI1->01:00.0). +This allows, among other things, ACPI to resolve bus numbers for +subordinate PCI bridges. + +Enhanced PCI IRQ routing to get the proper bus number for _PRT +entries defined underneath PCI bridges. + +Added IBM 600E to bad bios list due to invalid _ADR value for +PIIX4 PCI-ISA bridge, resulting in improper PCI IRQ routing. + +In the process of adding full MADT support (e.g. IOAPIC) for IA32 +(acpi.c, mpparse.c) -- stay tuned. + +Added back visual differentiation between fixed-feature and +control-method buttons in dmesg. Buttons are also subtyped (e.g. +button/power/PWRF) to simplify button identification. + +We no longer use -Wno-unused when compiling debug. Please ignore +any "_THIS_MODULE defined but not used" messages. + +Can now shut down the system using "magic sysrq" key. + + +3) iASL Compiler version 2041: + +Fixed a problem where conversion errors for hex/octal/decimal +constants were not reported. + +Implemented a fix for the General Register template Address field. +This field was 8 bits when it should be 64. + +Fixed a problem where errors/warnings were no longer being emitted +within the listing output file. + +Implemented the ACPI 2.0A restriction on ACPI Table Signatures to +exactly 4 characters, alphanumeric only. + + + + +---------------------------------------- +Summary of changes for this release: 03_08_02 + + +1) ACPI CA Core Subsystem Version 20020308: + +Fixed a problem with AML Fields where the use of the "AccessAny" +keyword could cause an interpreter error due to attempting to read +or write beyond the end of the parent Operation Region. + +Fixed a problem in the SystemMemory Operation Region handler where +an attempt was made to map memory beyond the end of the region. +This was the root cause of the "AE_ERROR" and "AE_NO_MEMORY" +errors on some Linux systems. + +Fixed a problem where the interpreter/namespace "search to root" +algorithm was not functioning for some object types. Relaxed the +internal restriction on the search to allow upsearches for all +external object types as well as most internal types. + + +2) Linux: + +We now use safe_halt() macro versus individual calls to sti | hlt. + +Writing to the processor limit interface should now work. "echo 1" +will increase the limit, 2 will decrease, and 0 will reset to the + +default. + + +3) ASL compiler: + +Fixed segfault on Linux version. + + +---------------------------------------- +Summary of changes for this release: 02_25_02 + +1) ACPI CA Core Subsystem: + + +Fixed a problem where the GPE bit masks were not initialized +properly, causing erratic GPE behavior. + +Implemented limited support for multiple calling conventions. The +code can be generated with either the VPL (variable parameter +list, or "C") convention, or the FPL (fixed parameter list, or +"Pascal") convention. The core subsystem is about 3.4% smaller +when generated with FPL. + + +2) Linux + +Re-add some /proc/acpi/event functionality that was lost during +the rewrite + +Resolved issue with /proc events for fixed-feature buttons showing +up as the system device. + +Fixed checks on C2/C3 latencies to be inclusive of maximum values. + +Replaced AE_ERRORs in acpi_osl.c with more specific error codes. + +Changed ACPI PRT option from "pci=noacpi-routing" to "pci=noacpi" + +Fixed limit interface & usage to fix bugs with passive cooling +hysterisis. + +Restructured PRT support. + + +---------------------------------------- +Summary of changes for this label: 02_14_02 + + +1) ACPI CA Core Subsystem: + +Implemented support in AcpiLoadTable to allow loading of FACS and +FADT tables. + +Suport for the now-obsolete interim 0.71 64-bit ACPI tables has +been removed. All 64-bit platforms should be migrated to the ACPI +2.0 tables. The actbl71.h header has been removed from the source +tree. + +All C macros defined within the subsystem have been prefixed with +"ACPI_" to avoid collision with other system include files. + +Removed the return value for the two AcpiOsPrint interfaces, since +it is never used and causes lint warnings for ignoring the return +value. + +Added error checking to all internal mutex acquire and release +calls. Although a failure from one of these interfaces is +probably a fatal system error, these checks will cause the +immediate abort of the currently executing method or interface. + +Fixed a problem where the AcpiSetCurrentResources interface could +fault. This was a side effect of the deployment of the new memory +allocation model. + +Fixed a couple of problems with the Global Lock support introduced +in the last major build. The "common" (1.0/2.0) internal FACS was +being overwritten with the FACS signature and clobbering the +Global Lock pointer. Also, the actual firmware FACS was being +unmapped after construction of the "common" FACS, preventing +access to the actual Global Lock field within it. The "common" +internal FACS is no longer installed as an actual ACPI table; it +is used simply as a global. + +Code and Data Size: Current core subsystem library sizes are shown +below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these +values do not include any ACPI driver or OSPM code. The debug +version of the code includes the debug output trace mechanism and +has a larger code and data size. Note that these values will vary +depending on the efficiency of the compiler and the compiler +options used during generation. + + Previous Release (02_07_01) + Non-Debug Version: 65.2K Code, 6.2K Data, 71.4K Total + Debug Version: 136.9K Code, 56.4K Data, 193.3K Total + Current Release: + Non-Debug Version: 65.4K Code, 6.2K Data, 71.6K Total + Debug Version: 138.0K Code, 56.6K Data, 194.6K Total + + +2) Linux + +Updated Linux-specific code for core macro and OSL interface +changes described above. + +Improved /proc/acpi/event. It now can be opened only once and has +proper poll functionality. + +Fixed and restructured power management (acpi_bus). + +Only create /proc "view by type" when devices of that class exist. + +Fixed "charging/discharging" bug (and others) in acpi_battery. + +Improved thermal zone code. + + +3) ASL Compiler, version X2039: + + +Implemented the new compiler restriction on ASL String hex/octal +escapes to non-null, ASCII values. An error results if an invalid +value is used. (This will require an ACPI 2.0 specification +change.) + +AML object labels that are output to the optional C and ASM source +are now prefixed with both the ACPI table signature and table ID +to help guarantee uniqueness within a large BIOS project. + + +---------------------------------------- +Summary of changes for this label: 02_01_02 + +1) ACPI CA Core Subsystem: + +ACPI 2.0 support is complete in the entire Core Subsystem and the +ASL compiler. All new ACPI 2.0 operators are implemented and all +other changes for ACPI 2.0 support are complete. With +simultaneous code and data optimizations throughout the subsystem, +ACPI 2.0 support has been implemented with almost no additional +cost in terms of code and data size. + +Implemented a new mechanism for allocation of return buffers. If +the buffer length is set to ACPI_ALLOCATE_BUFFER, the buffer will +be allocated on behalf of the caller. Consolidated all return +buffer validation and allocation to a common procedure. Return +buffers will be allocated via the primary OSL allocation interface +since it appears that a separate pool is not needed by most users. +If a separate pool is required for these buffers, the caller can +still use the original mechanism and pre-allocate the buffer(s). + +Implemented support for string operands within the DerefOf +operator. + +Restructured the Hardware and Event managers to be table driven, +simplifying the source code and reducing the amount of generated +code. + +Split the common read/write low-level ACPI register bitfield +procedure into a separate read and write, simplifying the code +considerably. + +Obsoleted the AcpiOsCallocate OSL interface. This interface was +used only a handful of times and didn't have enough critical mass +for a separate interface. Replaced with a common calloc procedure +in the core. + +Fixed a reported problem with the GPE number mapping mechanism +that allows GPE1 numbers to be non-contiguous with GPE0. +Reorganized the GPE information and shrunk a large array that was +originally large enough to hold info for all possible GPEs (256) +to simply large enough to hold all GPEs up to the largest GPE +number on the machine. + +Fixed a reported problem with resource structure alignment on 64- +bit platforms. + +Changed the AcpiEnableEvent and AcpiDisableEvent external +interfaces to not require any flags for the common case of +enabling/disabling a GPE. + +Implemented support to allow a "Notify" on a Processor object. + +Most TBDs in comments within the source code have been resolved +and eliminated. + + +Fixed a problem in the interpreter where a standalone parent +prefix (^) was not handled correctly in the interpreter and +debugger. + +Removed obsolete and unnecessary GPE save/restore code. + +Implemented Field support in the ASL Load operator. This allows a +table to be loaded from a named field, in addition to loading a +table directly from an Operation Region. + +Implemented timeout and handle support in the external Global Lock +interfaces. + +Fixed a problem in the AcpiDump utility where pathnames were no +longer being generated correctly during the dump of named objects. + +Modified the AML debugger to give a full display of if/while +predicates instead of just one AML opcode at a time. (The +predicate can have several nested ASL statements.) The old method +was confusing during single stepping. + +Code and Data Size: Current core subsystem library sizes are shown +below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these +values do not include any ACPI driver or OSPM code. The debug +version of the code includes the debug output trace mechanism and +has a larger code and data size. Note that these values will vary +depending on the efficiency of the compiler and the compiler +options used during generation. + + Previous Release (12_18_01) + Non-Debug Version: 66.1K Code, 5.5K Data, 71.6K Total + Debug Version: 138.3K Code, 55.9K Data, 194.2K Total + Current Release: + Non-Debug Version: 65.2K Code, 6.2K Data, 71.4K Total + Debug Version: 136.9K Code, 56.4K Data, 193.3K Total + +2) Linux + + Implemented fix for PIIX reverse throttling errata (Processor +driver) + +Added new Limit interface (Processor and Thermal drivers) + +New thermal policy (Thermal driver) + +Many updates to /proc + +Battery "low" event support (Battery driver) + +Supports ACPI PCI IRQ routing (PCI Link and PCI root drivers) + +IA32 - IA64 initialization unification, no longer experimental + +Menuconfig options redesigned + +3) ASL Compiler, version X2037: + +Implemented several new output features to simplify integration of +AML code into firmware: 1) Output the AML in C source code with +labels for each named ASL object. The original ASL source code +is interleaved as C comments. 2) Output the AML in ASM source code +with labels and interleaved ASL source. 3) Output the AML in +raw hex table form, in either C or ASM. + +Implemented support for optional string parameters to the +LoadTable operator. + +Completed support for embedded escape sequences within string +literals. The compiler now supports all single character escapes +as well as the Octal and Hex escapes. Note: the insertion of a +null byte into a string literal (via the hex/octal escape) causes +the string to be immediately terminated. A warning is issued. + +Fixed a problem where incorrect AML was generated for the case +where an ASL namepath consists of a single parent prefix ( + +) with no trailing name segments. + +The compiler has been successfully generated with a 64-bit C +compiler. + + + + +---------------------------------------- +Summary of changes for this label: 12_18_01 + +1) Linux + +Enhanced blacklist with reason and severity fields. Any table's +signature may now be used to identify a blacklisted system. + +Call _PIC control method to inform the firmware which interrupt +model the OS is using. Turn on any disabled link devices. + +Cleaned up busmgr /proc error handling (Andreas Dilger) + + 2) ACPI CA Core Subsystem: + +Implemented ACPI 2.0 semantics for the "Break" operator (Exit from +while loop) + +Completed implementation of the ACPI 2.0 "Continue", +"ConcatenateResTemplate", "DataTableRegion", and "LoadTable" +operators. All new ACPI 2.0 operators are now implemented in both +the ASL compiler and the AML interpreter. The only remaining ACPI +2.0 task is support for the String data type in the DerefOf +operator. Fixed a problem with AcquireMutex where the status code +was lost if the caller had to actually wait for the mutex. + +Increased the maximum ASL Field size from 64K bits to 4G bits. + +Completed implementation of the external Global Lock interfaces -- +AcpiAcquireGlobalLock and AcpiReleaseGlobalLock. The Timeout and +Handler parameters were added. + +Completed another pass at removing warnings and issues when +compiling with 64-bit compilers. The code now compiles cleanly +with the Intel 64-bit C/C++ compiler. Most notably, the pointer +add and subtract (diff) macros have changed considerably. + + +Created and deployed a new ACPI_SIZE type that is 64-bits wide on +64-bit platforms, 32-bits on all others. This type is used +wherever memory allocation and/or the C sizeof() operator is used, +and affects the OSL memory allocation interfaces AcpiOsAllocate +and AcpiOsCallocate. + +Implemented sticky user breakpoints in the AML debugger. + +Code and Data Size: Current core subsystem library sizes are shown +below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these +values do not include any ACPI driver or OSPM code. The debug +version of the code includes the debug output trace mechanism and +has a larger code and data size. Note that these values will vary +depending on the efficiency of the compiler and the compiler +options used during generation. + + Previous Release (12_05_01) + Non-Debug Version: 64.7K Code, 5.3K Data, 70.0K Total + Debug Version: 136.2K Code, 55.6K Data, 191.8K Total + Current Release: + Non-Debug Version: 66.1K Code, 5.5K Data, 71.6K Total + Debug Version: 138.3K Code, 55.9K Data, 194.2K Total + + 3) ASL Compiler, version X2034: + +Now checks for (and generates an error if detected) the use of a +Break or Continue statement without an enclosing While statement. + + +Successfully generated the compiler with the Intel 64-bit C +compiler. + + ---------------------------------------- +Summary of changes for this label: 12_05_01 + + 1) ACPI CA Core Subsystem: + +The ACPI 2.0 CopyObject operator is fully implemented. This +operator creates a new copy of an object (and is also used to +bypass the "implicit conversion" mechanism of the Store operator.) + +The ACPI 2.0 semantics for the SizeOf operator are fully +implemented. The change is that performing a SizeOf on a +reference object causes an automatic dereference of the object to +tha actual value before the size is evaluated. This behavior was +undefined in ACPI 1.0. + +The ACPI 2.0 semantics for the Extended IRQ resource descriptor +have been implemented. The interrupt polarity and mode are now +independently set. + +Fixed a problem where ASL Constants (Zero, One, Ones, Revision) +appearing in Package objects were not properly converted to +integers when the internal Package was converted to an external +object (via the AcpiEvaluateObject interface.) + +Fixed a problem with the namespace object deletion mechanism for +objects created by control methods. There were two parts to this +problem: 1) Objects created during the initialization phase method +parse were not being deleted, and 2) The object owner ID mechanism +to track objects was broken. + +Fixed a problem where the use of the ASL Scope operator within a +control method would result in an invalid opcode exception. + +Fixed a problem introduced in the previous label where the buffer +length required for the _PRT structure was not being returned +correctly. + +Code and Data Size: Current core subsystem library sizes are shown +below. These are the code and data sizes for the acpica.lib +produced by the Microsoft Visual C++ 6.0 compiler, and these +values do not include any ACPI driver or OSPM code. The debug +version of the code includes the debug output trace mechanism and +has a larger code and data size. Note that these values will vary +depending on the efficiency of the compiler and the compiler +options used during generation. + + Previous Release (11_20_01) + Non-Debug Version: 64.1K Code, 5.3K Data, 69.4K Total + Debug Version: 135.1K Code, 55.4K Data, 190.5K Total + + Current Release: + Non-Debug Version: 64.7K Code, 5.3K Data, 70.0K Total + Debug Version: 136.2K Code, 55.6K Data, 191.8K Total + + 2) Linux: + +Updated all files to apply cleanly against 2.4.16. + +Added basic PCI Interrupt Routing Table (PRT) support for IA32 +(acpi_pci.c), and unified the PRT code for IA32 and IA64. This +version supports both static and dyanmic PRT entries, but dynamic +entries are treated as if they were static (not yet +reconfigurable). Architecture- specific code to use this data is +absent on IA32 but should be available shortly. + +Changed the initialization sequence to start the ACPI interpreter +(acpi_init) prior to initialization of the PCI driver (pci_init) +in init/main.c. This ordering is required to support PRT and +facilitate other (future) enhancement. A side effect is that the +ACPI bus driver and certain device drivers can no longer be loaded +as modules. + +Modified the 'make menuconfig' options to allow PCI Interrupt +Routing support to be included without the ACPI Bus and other +device drivers. + + 3) ASL Compiler, version X2033: + +Fixed some issues with the use of the new CopyObject and +DataTableRegion operators. Both are fully functional. + + ---------------------------------------- +Summary of changes for this label: 11_20_01 + + 20 November 2001. Summary of changes for this release. + + 1) ACPI CA Core Subsystem: + +Updated Index support to match ACPI 2.0 semantics. Storing a +Integer, String, or Buffer to an Index of a Buffer will store only +the least-significant byte of the source to the Indexed buffer +byte. Multiple writes are not performed. + +Fixed a problem where the access type used in an AccessAs ASL +operator was not recorded correctly into the field object. + +Fixed a problem where ASL Event objects were created in a +signalled state. Events are now created in an unsignalled state. + +The internal object cache is now purged after table loading and +initialization to reduce the use of dynamic kernel memory -- on +the assumption that object use is greatest during the parse phase +of the entire table (versus the run-time use of individual control +methods.) + +ACPI 2.0 variable-length packages are now fully operational. + +Code and Data Size: Code and Data optimizations have permitted new +feature development with an actual reduction in the library size. +Current core subsystem library sizes are shown below. These are +the code and data sizes for the acpica.lib produced by the +Microsoft Visual C++ 6.0 compiler, and these values do not include +any ACPI driver or OSPM code. The debug version of the code +includes the debug output trace mechanism and has a larger code +and data size. Note that these values will vary depending on the +efficiency of the compiler and the compiler options used during +generation. + + Previous Release (11_09_01): + Non-Debug Version: 63.7K Code, 5.2K Data, 68.9K Total + Debug Version: 134.5K Code, 55.4K Data, 189.9K Total + + Current Release: + Non-Debug Version: 64.1K Code, 5.3K Data, 69.4K Total + Debug Version: 135.1K Code, 55.4K Data, 190.5K Total + + 2) Linux: + +Enhanced the ACPI boot-time initialization code to allow the use +of Local APIC tables for processor enumeration on IA-32, and to +pave the way for a fully MPS-free boot (on SMP systems) in the +near future. This functionality replaces +arch/i386/kernel/acpitables.c, which was introduced in an earlier +2.4.15-preX release. To enable this feature you must add +"acpi_boot=on" to the kernel command line -- see the help entry +for CONFIG_ACPI_BOOT for more information. An IA-64 release is in +the works... + +Restructured the configuration options to allow boot-time table +parsing support without inclusion of the ACPI Interpreter (and +other) code. + +NOTE: This release does not include fixes for the reported events, +power-down, and thermal passive cooling issues (coming soon). + + 3) ASL Compiler: + +Added additional typechecking for Fields within restricted access +Operation Regions. All fields within EC and CMOS regions must be +declared with ByteAcc. All fields withing SMBus regions must be +declared with the BufferAcc access type. + +Fixed a problem where the listing file output of control methods +no longer interleaved the actual AML code with the ASL source +code. + + + + +---------------------------------------- +Summary of changes for this label: 11_09_01 + +1) ACPI CA Core Subsystem: + +Implemented ACPI 2.0-defined support for writes to fields with a +Buffer, String, or Integer source operand that is smaller than the +target field. In these cases, the source operand is zero-extended +to fill the target field. + +Fixed a problem where a Field starting bit offset (within the +parent operation region) was calculated incorrectly if the + +alignment of the field differed from the access width. This +affected CreateWordField, CreateDwordField, CreateQwordField, and +possibly other fields that use the "AccessAny" keyword. + +Fixed a problem introduced in the 11_02_01 release where indirect +stores through method arguments did not operate correctly. + +2) Linux: + +Implemented boot-time ACPI table parsing support +(CONFIG_ACPI_BOOT) for IA32 and IA64 UP/SMP systems. This code +facilitates the use of ACPI tables (e.g. MADT, SRAT) rather than +legacy BIOS interfaces (e.g. MPS) for the configuration of system +processors, memory, and interrupts during setup_arch(). Note that +this patch does not include the required architecture-specific +changes required to apply this information -- subsequent patches +will be posted for both IA32 and IA64 to achieve this. + +Added low-level sleep support for IA32 platforms, courtesy of Pat +Mochel. This allows IA32 systems to transition to/from various +sleeping states (e.g. S1, S3), although the lack of a centralized +driver model and power-manageable drivers will prevent its +(successful) use on most systems. + +Revamped the ACPI 'menuconfig' layout: created new "ACPI Support" +submenu, unified IA32 and IA64 options, added new "Boot using ACPI +tables" option, etc. + +Increased the default timeout for the EC driver from 1ms to 10ms +(1000 cycles of 10us) to try to address AE_TIME errors during EC +transactions. + + ---------------------------------------- +Summary of changes for this label: 11_02_01 + +1) ACPI CA Core Subsystem: + +ACPI 2.0 Support: Implemented ACPI 2.0 64-bit Field access +(QWordAcc keyword). All ACPI 2.0 64-bit support is now +implemented. + +OSL Interfaces: Several of the OSL (AcpiOs*) interfaces required +changes to support ACPI 2.0 Qword field access. Read/Write +PciConfiguration(), Read/Write Memory(), and Read/Write Port() now +accept an ACPI_INTEGER (64 bits) as the value parameter. Also, +the value parameter for the address space handler interface is now +an ACPI_INTEGER. OSL implementations of these interfaces must now +handle the case where the Width parameter is 64. + +Index Fields: Fixed a problem where unaligned bit assembly and +disassembly for IndexFields was not supported correctly. + +Index and Bank Fields: Nested Index and Bank Fields are now +supported. During field access, a check is performed to ensure +that the value written to an Index or Bank register is not out of +the range of the register. The Index (or Bank) register is +written before each access to the field data. Future support will +include allowing individual IndexFields to be wider than the +DataRegister width. + +Fields: Fixed a problem where the AML interpreter was incorrectly +attempting to write beyond the end of a Field/OpRegion. This was +a boundary case that occurred when a DWORD field was written to a +BYTE access OpRegion, forcing multiple writes and causing the +interpreter to write one datum too many. + +Fields: Fixed a problem with Field/OpRegion access where the +starting bit address of a field was incorrectly calculated if the +current access type was wider than a byte (WordAcc, DwordAcc, or +QwordAcc). + +Fields: Fixed a problem where forward references to individual +FieldUnits (individual Field names within a Field definition) were +not resolved during the AML table load. + +Fields: Fixed a problem where forward references from a Field +definition to the parent Operation Region definition were not +resolved during the AML table load. + +Fields: Duplicate FieldUnit names within a scope are now detected +during AML table load. + +Acpi Interfaces: Fixed a problem where the AcpiGetName() interface +returned an incorrect name for the root node. + +Code and Data Size: Code and Data optimizations have permitted new +feature development with an actual reduction in the library size. +Current core subsystem library sizes are shown below. These are +the code and data sizes for the acpica.lib produced by the +Microsoft Visual C++ 6.0 compiler, and these values do not include +any ACPI driver or OSPM code. The debug version of the code +includes the debug output trace mechanism and has a larger code +and data size. Note that these values will vary depending on the +efficiency of the compiler and the compiler options used during +generation. + + Previous Release (10_18_01): + Non-Debug Version: 63.9K Code, 5.1K Data, 69.0K Total + Debug Version: 136.7K Code, 57.4K Data, 194.2K Total + + Current Release: + Non-Debug Version: 63.7K Code, 5.2K Data, 68.9K Total + Debug Version: 134.5K Code, 55.4K Data, 189.9K Total + + 2) Linux: + +Improved /proc processor output (Pavel Machek) Re-added +MODULE_LICENSE("GPL") to all modules. + + 3) ASL Compiler version X2030: + +Duplicate FieldUnit names within a scope are now detected and +flagged as errors. + + 4) Documentation: + +Programmer Reference updated to reflect OSL and address space +handler interface changes described above. + +---------------------------------------- +Summary of changes for this label: 10_18_01 + +ACPI CA Core Subsystem: + +Fixed a problem with the internal object reference count mechanism +that occasionally caused premature object deletion. This resolves +all of the outstanding problem reports where an object is deleted +in the middle of an interpreter evaluation. Although this problem +only showed up in rather obscure cases, the solution to the +problem involved an adjustment of all reference counts involving +objects attached to namespace nodes. + +Fixed a problem with Field support in the interpreter where +writing to an aligned field whose length is an exact multiple (2 +or greater) of the field access granularity would cause an attempt +to write beyond the end of the field. + +The top level AML opcode execution functions within the +interpreter have been renamed with a more meaningful and +consistent naming convention. The modules exmonad.c and +exdyadic.c were eliminated. New modules are exoparg1.c, +exoparg2.c, exoparg3.c, and exoparg6.c. + +Support for the ACPI 2.0 "Mid" ASL operator has been implemented. + +Fixed a problem where the AML debugger was causing some internal +objects to not be deleted during subsystem termination. + +Fixed a problem with the external AcpiEvaluateObject interface +where the subsystem would fault if the named object to be +evaluated refered to a constant such as Zero, Ones, etc. + +Fixed a problem with IndexFields and BankFields where the +subsystem would fault if the index, data, or bank registers were +not defined in the same scope as the field itself. + +Added printf format string checking for compilers that support +this feature. Corrected more than 50 instances of issues with +format specifiers within invocations of ACPI_DEBUG_PRINT +throughout the core subsystem code. + +The ASL "Revision" operator now returns the ACPI support level +implemented in the core - the value "2" since the ACPI 2.0 support +is more than 50% implemented. + +Enhanced the output of the AML debugger "dump namespace" command +to output in a more human-readable form. + +Current core subsystem library code sizes are shown below. These + +are the code and data sizes for the acpica.lib produced by the +Microsoft Visual C++ 6.0 compiler, and these values do not include +any ACPI driver or OSPM code. The debug version of the code +includes the full debug trace mechanism -- leading to a much + +larger code and data size. Note that these values will vary +depending on the efficiency of the compiler and the compiler +options used during generation. + + Previous Label (09_20_01): + Non-Debug Version: 65K Code, 5K Data, 70K Total + Debug Version: 138K Code, 58K Data, 196K Total + + This Label: + + Non-Debug Version: 63.9K Code, 5.1K Data, 69.0K Total + Debug Version: 136.7K Code, 57.4K Data, 194.2K Total + +Linux: + +Implemented a "Bad BIOS Blacklist" to track machines that have +known ASL/AML problems. + +Enhanced the /proc interface for the thermal zone driver and added +support for _HOT (the critical suspend trip point). The 'info' +file now includes threshold/policy information, and allows setting +of _SCP (cooling preference) and _TZP (polling frequency) values +to the 'info' file. Examples: "echo tzp=5 > info" sets the polling +frequency to 5 seconds, and "echo scp=1 > info" sets the cooling +preference to the passive/quiet mode (if supported by the ASL). + +Implemented a workaround for a gcc bug that resuted in an OOPs +when loading the control method battery driver. + + ---------------------------------------- +Summary of changes for this label: 09_20_01 + + ACPI CA Core Subsystem: + +The AcpiEnableEvent and AcpiDisableEvent interfaces have been +modified to allow individual GPE levels to be flagged as wake- +enabled (i.e., these GPEs are to remain enabled when the platform +sleeps.) + +The AcpiEnterSleepState and AcpiLeaveSleepState interfaces now +support wake-enabled GPEs. This means that upon entering the +sleep state, all GPEs that are not wake-enabled are disabled. +When leaving the sleep state, these GPEs are reenabled. + +A local double-precision divide/modulo module has been added to +enhance portability to OS kernels where a 64-bit math library is +not available. The new module is "utmath.c". + +Several optimizations have been made to reduce the use of CPU +stack. Originally over 2K, the maximum stack usage is now below +2K at 1860 bytes (1.82k) + +Fixed a problem with the AcpiGetFirmwareTable interface where the +root table pointer was not mapped into a logical address properly. + +Fixed a problem where a NULL pointer was being dereferenced in the +interpreter code for the ASL Notify operator. + +Fixed a problem where the use of the ASL Revision operator +returned an error. This operator now returns the current version +of the ACPI CA core subsystem. + +Fixed a problem where objects passed as control method parameters +to AcpiEvaluateObject were always deleted at method termination. +However, these objects may end up being stored into the namespace +by the called method. The object reference count mechanism was +applied to these objects instead of a force delete. + +Fixed a problem where static strings or buffers (contained in the +AML code) that are declared as package elements within the ASL +code could cause a fault because the interpreter would attempt to +delete them. These objects are now marked with the "static +object" flag to prevent any attempt to delete them. + +Implemented an interpreter optimization to use operands directly +from the state object instead of extracting the operands to local +variables. This reduces stack use and code size, and improves +performance. + +The module exxface.c was eliminated as it was an unnecessary extra +layer of code. + +Current core subsystem library code sizes are shown below. These +are the code and data sizes for the acpica.lib produced by the +Microsoft Visual C++ 6.0 compiler, and these values do not include +any ACPI driver or OSPM code. The debug version of the code +includes the full debug trace mechanism -- leading to a much +larger code and data size. Note that these values will vary +depending on the efficiency of the compiler and the compiler +options used during generation. + + Non-Debug Version: 65K Code, 5K Data, 70K Total +(Previously 69K) Debug Version: 138K Code, 58K Data, 196K +Total (Previously 195K) + +Linux: + +Support for ACPI 2.0 64-bit integers has been added. All ACPI +Integer objects are now 64 bits wide + +All Acpi data types and structures are now in lower case. Only +Acpi macros are upper case for differentiation. + + Documentation: + +Changes to the external interfaces as described above. + + ---------------------------------------- +Summary of changes for this label: 08_31_01 + + ACPI CA Core Subsystem: + +A bug with interpreter implementation of the ASL Divide operator +was found and fixed. The implicit function return value (not the +explicit store operands) was returning the remainder instead of +the quotient. This was a longstanding bug and it fixes several +known outstanding issues on various platforms. + +The ACPI_DEBUG_PRINT and function trace entry/exit macros have +been further optimized for size. There are 700 invocations of the +DEBUG_PRINT macro alone, so each optimization reduces the size of +the debug version of the subsystem significantly. + +A stack trace mechanism has been implemented. The maximum stack +usage is about 2K on 32-bit platforms. The debugger command "stat +stack" will display the current maximum stack usage. + +All public symbols and global variables within the subsystem are +now prefixed with the string "Acpi". This keeps all of the +symbols grouped together in a kernel map, and avoids conflicts +with other kernel subsystems. + +Most of the internal fixed lookup tables have been moved into the +code segment via the const operator. + +Several enhancements have been made to the interpreter to both +reduce the code size and improve performance. + +Current core subsystem library code sizes are shown below. These +are the code and data sizes for the acpica.lib produced by the +Microsoft Visual C++ 6.0 compiler, and these values do not include +any ACPI driver or OSPM code. The debug version of the code +includes the full debug trace mechanism which contains over 700 +invocations of the DEBUG_PRINT macro, 500 function entry macro +invocations, and over 900 function exit macro invocations -- +leading to a much larger code and data size. Note that these +values will vary depending on the efficiency of the compiler and +the compiler options used during generation. + + Non-Debug Version: 64K Code, 5K Data, 69K Total +Debug Version: 137K Code, 58K Data, 195K Total + + Linux: + +Implemented wbinvd() macro, pending a kernel-wide definition. + +Fixed /proc/acpi/event to handle poll() and short reads. + + ASL Compiler, version X2026: + +Fixed a problem introduced in the previous label where the AML + +code emitted for package objects produced packages with zero +length. + + ---------------------------------------- +Summary of changes for this label: 08_16_01 + +ACPI CA Core Subsystem: + +The following ACPI 2.0 ASL operators have been implemented in the +AML interpreter (These are already supported by the Intel ASL +compiler): ToDecimalString, ToHexString, ToString, ToInteger, and +ToBuffer. Support for 64-bit AML constants is implemented in the +AML parser, debugger, and disassembler. + +The internal memory tracking mechanism (leak detection code) has +been upgraded to reduce the memory overhead (a separate tracking +block is no longer allocated for each memory allocation), and now +supports all of the internal object caches. + +The data structures and code for the internal object caches have +been coelesced and optimized so that there is a single cache and +memory list data structure and a single group of functions that +implement generic cache management. This has reduced the code +size in both the debug and release versions of the subsystem. + +The DEBUG_PRINT macro(s) have been optimized for size and replaced +by ACPI_DEBUG_PRINT. The syntax for this macro is slightly +different, because it generates a single call to an internal +function. This results in a savings of about 90 bytes per +invocation, resulting in an overall code and data savings of about +16% in the debug version of the subsystem. + + Linux: + +Fixed C3 disk corruption problems and re-enabled C3 on supporting +machines. + +Integrated low-level sleep code by Patrick Mochel. + +Further tweaked source code Linuxization. + +Other minor fixes. + + ASL Compiler: + +Support for ACPI 2.0 variable length packages is fixed/completed. + +Fixed a problem where the optional length parameter for the ACPI +2.0 ToString operator. + +Fixed multiple extraneous error messages when a syntax error is +detected within the declaration line of a control method. + + ---------------------------------------- +Summary of changes for this label: 07_17_01 + +ACPI CA Core Subsystem: + +Added a new interface named AcpiGetFirmwareTable to obtain any +ACPI table via the ACPI signature. The interface can be called at +any time during kernel initialization, even before the kernel +virtual memory manager is initialized and paging is enabled. This +allows kernel subsystems to obtain ACPI tables very early, even +before the ACPI CA subsystem is initialized. + +Fixed a problem where Fields defined with the AnyAcc attribute +could be resolved to the incorrect address under the following +conditions: 1) the field width is larger than 8 bits and 2) the +parent operation region is not defined on a DWORD boundary. + +Fixed a problem where the interpreter is not being locked during +namespace initialization (during execution of the _INI control +methods), causing an error when an attempt is made to release it +later. + +ACPI 2.0 support in the AML Interpreter has begun and will be +ongoing throughout the rest of this year. In this label, The Mod +operator is implemented. + +Added a new data type to contain full PCI addresses named +ACPI_PCI_ID. This structure contains the PCI Segment, Bus, Device, +and Function values. + + Linux: + +Enhanced the Linux version of the source code to change most +capitalized ACPI type names to lowercase. For example, all +instances of ACPI_STATUS are changed to acpi_status. This will +result in a large diff, but the change is strictly cosmetic and +aligns the CA code closer to the Linux coding standard. + +OSL Interfaces: + +The interfaces to the PCI configuration space have been changed to +add the PCI Segment number and to split the single 32-bit combined +DeviceFunction field into two 16-bit fields. This was +accomplished by moving the four values that define an address in +PCI configuration space (segment, bus, device, and function) to +the new ACPI_PCI_ID structure. + +The changes to the PCI configuration space interfaces led to a +reexamination of the complete set of address space access +interfaces for PCI, I/O, and Memory. The previously existing 18 +interfaces have proven difficult to maintain (any small change +must be propagated across at least 6 interfaces) and do not easily +allow for future expansion to 64 bits if necessary. Also, on some +systems, it would not be appropriate to demultiplex the access +width (8, 16, 32,or 64) before calling the OSL if the +corresponding native OS interfaces contain a similar access width +parameter. For these reasons, the 18 address space interfaces +have been replaced by these 6 new ones: + +AcpiOsReadPciConfiguration +AcpiOsWritePciConfiguration +AcpiOsReadMemory +AcpiOsWriteMemory +AcpiOsReadPort +AcpiOsWritePort + +Added a new interface named AcpiOsGetRootPointer to allow the OSL +to perform the platform and/or OS-specific actions necessary to +obtain the ACPI RSDP table pointer. On IA-32 platforms, this +interface will simply call down to the CA core to perform the low- +memory search for the table. On IA-64, the RSDP is obtained from +EFI. Migrating this interface to the OSL allows the CA core to + +remain OS and platform independent. + +Added a new interface named AcpiOsSignal to provide a generic +"function code and pointer" interface for various miscellaneous +signals and notifications that must be made to the host OS. The +first such signals are intended to support the ASL Fatal and +Breakpoint operators. In the latter case, the AcpiOsBreakpoint +interface has been obsoleted. + +The definition of the AcpiFormatException interface has been +changed to simplify its use. The caller no longer must supply a +buffer to the call; A pointer to a const string is now returned +directly. This allows the call to be easily used in printf +statements, etc. since the caller does not have to manage a local +buffer. + + + ASL Compiler, Version X2025: + +The ACPI 2.0 Switch/Case/Default operators have been implemented +and are fully functional. They will work with all ACPI 1.0 +interpreters, since the operators are simply translated to If/Else +pairs. + +The ACPI 2.0 ElseIf operator is implemented and will also work +with 1.0 interpreters, for the same reason. + +Implemented support for ACPI 2.0 variable-length packages. These +packages have a separate opcode, and their size is determined by +the interpreter at run-time. + +Documentation The ACPI CA Programmer Reference has been updated to +reflect the new interfaces and changes to existing interfaces. + + ------------------------------------------ +Summary of changes for this label: 06_15_01 + + ACPI CA Core Subsystem: + +Fixed a problem where a DWORD-accessed field within a Buffer +object would get its byte address inadvertently rounded down to +the nearest DWORD. Buffers are always Byte-accessible. + + ASL Compiler, version X2024: + +Fixed a problem where the Switch() operator would either fault or +hang the compiler. Note however, that the AML code for this ACPI +2.0 operator is not yet implemented. + +Compiler uses the new AcpiOsGetTimer interface to obtain compile +timings. + +Implementation of the CreateField operator automatically converts +a reference to a named field within a resource descriptor from a +byte offset to a bit offset if required. + +Added some missing named fields from the resource descriptor +support. These are the names that are automatically created by the +compiler to reference fields within a descriptor. They are only +valid at compile time and are not passed through to the AML +interpreter. + +Resource descriptor named fields are now typed as Integers and +subject to compile-time typechecking when used in expressions. + + ------------------------------------------ +Summary of changes for this label: 05_18_01 + + ACPI CA Core Subsystem: + +Fixed a couple of problems in the Field support code where bits +from adjacent fields could be returned along with the proper field +bits. Restructured the field support code to improve performance, +readability and maintainability. + +New DEBUG_PRINTP macro automatically inserts the procedure name +into the output, saving hundreds of copies of procedure name +strings within the source, shrinking the memory footprint of the +debug version of the core subsystem. + + Source Code Structure: + +The source code directory tree was restructured to reflect the +current organization of the component architecture. Some files +and directories have been moved and/or renamed. + + Linux: + +Fixed leaking kacpidpc processes. + +Fixed queueing event data even when /proc/acpi/event is not +opened. + + ASL Compiler, version X2020: + +Memory allocation performance enhancement - over 24X compile time +improvement on large ASL files. Parse nodes and namestring +buffers are now allocated from a large internal compiler buffer. + +The temporary .SRC file is deleted unless the "-s" option is +specified + +The "-d" debug output option now sends all output to the .DBG file +instead of the console. + +"External" second parameter is now optional + +"ElseIf" syntax now properly allows the predicate + +Last operand to "Load" now recognized as a Target operand + +Debug object can now be used anywhere as a normal object. + +ResourceTemplate now returns an object of type BUFFER + +EISAID now returns an object of type INTEGER + +"Index" now works with a STRING operand + +"LoadTable" now accepts optional parameters + +"ToString" length parameter is now optional + +"Interrupt (ResourceType," parse error fixed. + +"Register" with a user-defined region space parse error fixed + +Escaped backslash at the end of a string ("\\") scan/parse error +fixed + +"Revision" is now an object of type INTEGER. + + + +------------------------------------------ +Summary of changes for this label: 05_02_01 + +Linux: + +/proc/acpi/event now blocks properly. + +Removed /proc/sys/acpi. You can still dump your DSDT from +/proc/acpi/dsdt. + + ACPI CA Core Subsystem: + +Fixed a problem introduced in the previous label where some of the +"small" resource descriptor types were not recognized. + +Improved error messages for the case where an ASL Field is outside +the range of the parent operation region. + + ASL Compiler, version X2018: + + +Added error detection for ASL Fields that extend beyond the length +of the parent operation region (only if the length of the region +is known at compile time.) This includes fields that have a +minimum access width that is smaller than the parent region, and +individual field units that are partially or entirely beyond the +extent of the parent. + + + +------------------------------------------ +Summary of changes for this label: 04_27_01 + + ACPI CA Core Subsystem: + +Fixed a problem where the namespace mutex could be released at the +wrong time during execution of AcpiRemoveAddressSpaceHandler. + +Added optional thread ID output for debug traces, to simplify +debugging of multiple threads. Added context switch notification +when the debug code realizes that a different thread is now +executing ACPI code. + +Some additional external data types have been prefixed with the +string "ACPI_" for consistency. This may effect existing code. +The data types affected are the external callback typedefs - e.g., + +WALK_CALLBACK becomes ACPI_WALK_CALLBACK. + + Linux: + +Fixed an issue with the OSL semaphore implementation where a +thread was waking up with an error from receiving a SIGCHLD +signal. + +Linux version of ACPI CA now uses the system C library for string +manipulation routines instead of a local implementation. + +Cleaned up comments and removed TBDs. + + ASL Compiler, version X2017: + +Enhanced error detection and reporting for all file I/O +operations. + + Documentation: + +Programmer Reference updated to version 1.06. + + + +------------------------------------------ +Summary of changes for this label: 04_13_01 + + ACPI CA Core Subsystem: + +Restructured support for BufferFields and RegionFields. +BankFields support is now fully operational. All known 32-bit +limitations on field sizes have been removed. Both BufferFields +and (Operation) RegionFields are now supported by the same field +management code. + +Resource support now supports QWORD address and IO resources. The +16/32/64 bit address structures and the Extended IRQ structure +have been changed to properly handle Source Resource strings. + +A ThreadId of -1 is now used to indicate a "mutex not acquired" +condition internally and must never be returned by AcpiOsThreadId. +This reserved value was changed from 0 since Unix systems allow a +thread ID of 0. + +Linux: + +Driver code reorganized to enhance portability + +Added a kernel configuration option to control ACPI_DEBUG + +Fixed the EC driver to honor _GLK. + +ASL Compiler, version X2016: + +Fixed support for the "FixedHw" keyword. Previously, the FixedHw +address space was set to 0, not 0x7f as it should be. + + ------------------------------------------ +Summary of changes for this label: 03_13_01 + + ACPI CA Core Subsystem: + +During ACPI initialization, the _SB_._INI method is now run if +present. + +Notify handler fix - notifies are deferred until the parent method +completes execution. This fixes the "mutex already acquired" +issue seen occasionally. + +Part of the "implicit conversion" rules in ACPI 2.0 have been +found to cause compatibility problems with existing ASL/AML. The +convert "result-to-target-type" implementation has been removed +for stores to method Args and Locals. Source operand conversion +is still fully implemented. Possible changes to ACPI 2.0 +specification pending. + +Fix to AcpiRsCalculatePciRoutingTableLength to return correct +length. + +Fix for compiler warnings for 64-bit compiles. + + Linux: + +/proc output aligned for easier parsing. + +Release-version compile problem fixed. + +New kernel configuration options documented in Configure.help. + +IBM 600E - Fixed Sleep button may generate "Invalid <NULL> +context" message. + + OSPM: + +Power resource driver integrated with bus manager. + +Fixed kernel fault during active cooling for thermal zones. + +Source Code: + +The source code tree has been restructured. + + + +------------------------------------------ +Summary of changes for this label: 03_02_01 + + Linux OS Services Layer (OSL): + +Major revision of all Linux-specific code. + +Modularized all ACPI-specific drivers. + +Added new thermal zone and power resource drivers. + +Revamped /proc interface (new functionality is under /proc/acpi). + +New kernel configuration options. + + Linux known issues: + +New kernel configuration options not documented in Configure.help +yet. + + +Module dependencies not currently implemented. If used, they +should be loaded in this order: busmgr, power, ec, system, +processor, battery, ac_adapter, button, thermal. + +Modules will not load if CONFIG_MODVERSION is set. + +IBM 600E - entering S5 may reboot instead of shutting down. + +IBM 600E - Sleep button may generate "Invalid <NULL> context" +message. + +Some systems may fail with "execution mutex already acquired" +message. + + ACPI CA Core Subsystem: + +Added a new OSL Interface, AcpiOsGetThreadId. This was required +for the deadlock detection code. Defined to return a non-zero, 32- +bit thread ID for the currently executing thread. May be a non- +zero constant integer on single-thread systems. + +Implemented deadlock detection for internal subsystem mutexes. We +may add conditional compilation for this code (debug only) later. + +ASL/AML Mutex object semantics are now fully supported. This +includes multiple acquires/releases by owner and support for the + +Mutex SyncLevel parameter. + +A new "Force Release" mechanism automatically frees all ASL +Mutexes that have been acquired but not released when a thread +exits the interpreter. This forces conformance to the ACPI spec +("All mutexes must be released when an invocation exits") and +prevents deadlocked ASL threads. This mechanism can be expanded +(later) to monitor other resource acquisitions if OEM ASL code +continues to misbehave (which it will). + +Several new ACPI exception codes have been added for the Mutex +support. + +Recursive method calls are now allowed and supported (the ACPI +spec does in fact allow recursive method calls.) The number of +recursive calls is subject to the restrictions imposed by the +SERIALIZED method keyword and SyncLevel (ACPI 2.0) method +parameter. + +Implemented support for the SyncLevel parameter for control +methods (ACPI 2.0 feature) + +Fixed a deadlock problem when multiple threads attempted to use +the interpreter. + +Fixed a problem where the string length of a String package +element was not always set in a package returned from +AcpiEvaluateObject. + +Fixed a problem where the length of a String package element was +not always included in the length of the overall package returned +from AcpiEvaluateObject. + +Added external interfaces (Acpi*) to the ACPI debug memory +manager. This manager keeps a list of all outstanding +allocations, and can therefore detect memory leaks and attempts to +free memory blocks more than once. Useful for code such as the +power manager, etc. May not be appropriate for device drivers. +Performance with the debug code enabled is slow. + +The ACPI Global Lock is now an optional hardware element. + + ASL Compiler Version X2015: + +Integrated changes to allow the compiler to be generated on +multiple platforms. + +Linux makefile added to generate the compiler on Linux + + Source Code: + +All platform-specific headers have been moved to their own +subdirectory, Include/Platform. + +New source file added, Interpreter/ammutex.c + +New header file, Include/acstruct.h + + Documentation: + +The programmer reference has been updated for the following new +interfaces: AcpiOsGetThreadId AcpiAllocate AcpiCallocate AcpiFree + + ------------------------------------------ +Summary of changes for this label: 02_08_01 + +Core ACPI CA Subsystem: Fixed a problem where an error was +incorrectly returned if the return resource buffer was larger than +the actual data (in the resource interfaces). + +References to named objects within packages are resolved to the + +full pathname string before packages are returned directly (via +the AcpiEvaluateObject interface) or indirectly via the resource +interfaces. + +Linux OS Services Layer (OSL): + +Improved /proc battery interface. + + +Added C-state debugging output and other miscellaneous fixes. + +ASL Compiler Version X2014: + +All defined method arguments can now be used as local variables, +including the ones that are not actually passed in as parameters. +The compiler tracks initialization of the arguments and issues an +exception if they are used without prior assignment (just like +locals). + +The -o option now specifies a filename prefix that is used for all +output files, including the AML output file. Otherwise, the +default behavior is as follows: 1) the AML goes to the file +specified in the DSDT. 2) all other output files use the input +source filename as the base. + + ------------------------------------------ +Summary of changes for this label: 01_25_01 + +Core ACPI CA Subsystem: Restructured the implementation of object +store support within the interpreter. This includes support for +the Store operator as well as any ASL operators that include a +target operand. + +Partially implemented support for Implicit Result-to-Target +conversion. This is when a result object is converted on the fly +to the type of an existing target object. Completion of this +support is pending further analysis of the ACPI specification +concerning this matter. + +CPU-specific code has been removed from the subsystem (hardware +directory). + +New Power Management Timer functions added + +Linux OS Services Layer (OSL): Moved system state transition code +to the core, fixed it, and modified Linux OSL accordingly. + +Fixed C2 and C3 latency calculations. + + +We no longer use the compilation date for the version message on +initialization, but retrieve the version from AcpiGetSystemInfo(). + +Incorporated for fix Sony VAIO machines. + +Documentation: The Programmer Reference has been updated and +reformatted. + + +ASL Compiler: Version X2013: Fixed a problem where the line +numbering and error reporting could get out of sync in the +presence of multiple include files. + + ------------------------------------------ +Summary of changes for this label: 01_15_01 + +Core ACPI CA Subsystem: + +Implemented support for type conversions in the execution of the +ASL Concatenate operator (The second operand is converted to +match the type of the first operand before concatenation.) + +Support for implicit source operand conversion is partially +implemented. The ASL source operand types Integer, Buffer, and +String are freely interchangeable for most ASL operators and are +converted by the interpreter on the fly as required. Implicit +Target operand conversion (where the result is converted to the +target type before storing) is not yet implemented. + +Support for 32-bit and 64-bit BCD integers is implemented. + +Problem fixed where a field read on an aligned field could cause a +read past the end of the field. + +New exception, AE_AML_NO_RETURN_VALUE, is returned when a method +does not return a value, but the caller expects one. (The ASL +compiler flags this as a warning.) + +ASL Compiler: + +Version X2011: +1. Static typechecking of all operands is implemented. This +prevents the use of invalid objects (such as using a Package where +an Integer is required) at compile time instead of at interpreter +run-time. +2. The ASL source line is printed with ALL errors and warnings. +3. Bug fix for source EOF without final linefeed. +4. Debug option is split into a parse trace and a namespace trace. +5. Namespace output option (-n) includes initial values for +integers and strings. +6. Parse-only option added for quick syntax checking. +7. Compiler checks for duplicate ACPI name declarations + +Version X2012: +1. Relaxed typechecking to allow interchangeability between +strings, integers, and buffers. These types are now converted by +the interpreter at runtime. +2. Compiler reports time taken by each internal subsystem in the +debug output file. + + + ------------------------------------------ +Summary of changes for this label: 12_14_00 + +ASL Compiler: + +This is the first official release of the compiler. Since the +compiler requires elements of the Core Subsystem, this label +synchronizes everything. + +------------------------------------------ +Summary of changes for this label: 12_08_00 + + +Fixed a problem where named references within the ASL definition +of both OperationRegions and CreateXXXFields did not work +properly. The symptom was an AE_AML_OPERAND_TYPE during +initialization of the region/field. This is similar (but not +related internally) to the problem that was fixed in the last +label. + +Implemented both 32-bit and 64-bit support for the BCD ASL +functions ToBCD and FromBCD. + +Updated all legal headers to include "2000" in the copyright +years. + + ------------------------------------------ +Summary of changes for this label: 12_01_00 + +Fixed a problem where method invocations within the ASL definition +of both OperationRegions and CreateXXXFields did not work +properly. The symptom was an AE_AML_OPERAND_TYPE during +initialization of the region/field: + + nsinit-0209: AE_AML_OPERAND_TYPE while getting region arguments +[DEBG] ammonad-0284: Exec_monadic2_r/Not: bad operand(s) +(0x3005) + +Fixed a problem where operators with more than one nested +subexpression would fail. The symptoms were varied, by mostly +AE_AML_OPERAND_TYPE errors. This was actually a rather serious +problem that has gone unnoticed until now. + + Subtract (Add (1,2), Multiply (3,4)) + +Fixed a problem where AcpiGetHandle didn't quite get fixed in the +previous build (The prefix part of a relative path was handled +incorrectly). + +Fixed a problem where Operation Region initialization failed if +the operation region name was a "namepath" instead of a simple +"nameseg". Symptom was an AE_NO_OPERAND error. + +Fixed a problem where an assignment to a local variable via the +indirect RefOf mechanism only worked for the first such +assignment. Subsequent assignments were ignored. + + ------------------------------------------ +Summary of changes for this label: 11_15_00 + +ACPI 2.0 table support with backwards support for ACPI 1.0 and the +0.71 extensions. Note: although we can read ACPI 2.0 BIOS tables, +the AML interpreter does NOT have support for the new 2.0 ASL +grammar terms at this time. + +All ACPI hardware access is via the GAS structures in the ACPI 2.0 +FADT. + +All physical memory addresses across all platforms are now 64 bits +wide. Logical address width remains dependent on the platform +(i.e., "void *"). + +AcpiOsMapMemory interface changed to a 64-bit physical address. + +The AML interpreter integer size is now 64 bits, as per the ACPI +2.0 specification. + +For backwards compatibility with ACPI 1.0, ACPI tables with a +revision number less than 2 use 32-bit integers only. + +Fixed a problem where the evaluation of OpRegion operands did not +always resolve them to numbers properly. + +------------------------------------------ +Summary of changes for this label: 10_20_00 + +Fix for CBN_._STA issue. This fix will allow correct access to +CBN_ OpRegions when the _STA returns 0x8. + +Support to convert ACPI constants (Ones, Zeros, One) to actual +values before a package object is returned + +Fix for method call as predicate to if/while construct causing +incorrect if/while behavior + +Fix for Else block package lengths sometimes calculated wrong (if +block > 63 bytes) + +Fix for Processor object length field, was always zero + +Table load abort if FACP sanity check fails + +Fix for problem with Scope(name) if name already exists + +Warning emitted if a named object referenced cannot be found +(resolved) during method execution. + + + + + +------------------------------------------ +Summary of changes for this label: 9_29_00 + +New table initialization interfaces: AcpiInitializeSubsystem no +longer has any parameters AcpiFindRootPointer - Find the RSDP (if +necessary) AcpiLoadTables (RSDP) - load all tables found at RSDP- +>RSDT Obsolete Interfaces AcpiLoadFirmwareTables - replaced by +AcpiLoadTables + +Note: These interface changes require changes to all existing OSDs + +The PCI_Config default address space handler is always installed +at the root namespace object. + +------------------------------------------- +Summary of changes for this label: 09_15_00 + +The new initialization architecture is implemented. New +interfaces are: AcpiInitializeSubsystem (replaces AcpiInitialize) +AcpiEnableSubsystem Obsolete Interfaces: AcpiLoadNamespace + +(Namespace is automatically loaded when a table is loaded) + +The ACPI_OPERAND_OBJECT has been optimized to shrink its size from +52 bytes to 32 bytes. There is usually one of these for every +namespace object, so the memory savings is significant. + +Implemented just-in-time evaluation of the CreateField operators. + +Bug fixes for IA-64 support have been integrated. + +Additional code review comments have been implemented + +The so-called "third pass parse" has been replaced by a final walk +through the namespace to initialize all operation regions (address +spaces) and fields that have not yet been initialized during the +execution of the various _INI and REG methods. + +New file - namespace/nsinit.c + +------------------------------------------- +Summary of changes for this label: 09_01_00 + +Namespace manager data structures have been reworked to change the +primary object from a table to a single object. This has +resulted in dynamic memory savings of 3X within the namespace and +2X overall in the ACPI CA subsystem. + +Fixed problem where the call to AcpiEvFindPciRootBuses was +inadvertently left commented out. + +Reduced the warning count when generating the source with the GCC +compiler. + +Revision numbers added to each module header showing the +SourceSafe version of the file. Please refer to this version +number when giving us feedback or comments on individual modules. + +The main object types within the subsystem have been renamed to +clarify their purpose: + +ACPI_INTERNAL_OBJECT -> ACPI_OPERAND_OBJECT +ACPI_GENERIC_OP -> ACPI_PARSE_OBJECT +ACPI_NAME_TABLE_ENTRY -> ACPI_NAMESPACE_NODE + +NOTE: no changes to the initialization sequence are included in +this label. + +------------------------------------------- +Summary of changes for this label: 08_23_00 + +Fixed problem where TerminateControlMethod was being called +multiple times per method + +Fixed debugger problem where single stepping caused a semaphore to +be oversignalled + +Improved performance through additional parse object caching - +added ACPI_EXTENDED_OP type + +------------------------------------------- +Summary of changes for this label: 08_10_00 + +Parser/Interpreter integration: Eliminated the creation of +complete parse trees for ACPI tables and control methods. +Instead, parse subtrees are created and then deleted as soon as +they are processed (Either entered into the namespace or executed +by the interpreter). This reduces the use of dynamic kernel +memory significantly. (about 10X) + +Exception codes broken into classes and renumbered. Be sure to +recompile all code that includes acexcep.h. Hopefully we won't +have to renumber the codes again now that they are split into +classes (environment, programmer, AML code, ACPI table, and +internal). + +Fixed some additional alignment issues in the Resource Manager +subcomponent + +Implemented semaphore tracking in the AcpiExec utility, and fixed +several places where mutexes/semaphores were being unlocked +without a corresponding lock operation. There are no known +semaphore or mutex "leaks" at this time. + +Fixed the case where an ASL Return operator is used to return an +unnamed package. + +------------------------------------------- +Summary of changes for this label: 07_28_00 + +Fixed a problem with the way addresses were calculated in +AcpiAmlReadFieldData() and AcpiAmlWriteFieldData(). This problem +manifested itself when a Field was created with WordAccess or +DwordAccess, but the field unit defined within the Field was less + +than a Word or Dword. + +Fixed a problem in AmlDumpOperands() module's loop to pull +operands off of the operand stack to display information. The +problem manifested itself as a TLB error on 64-bit systems when +accessing an operand stack with two or more operands. + +Fixed a problem with the PCI configuration space handlers where +context was getting confused between accesses. This required a +change to the generic address space handler and address space +setup definitions. Handlers now get both a global handler context +(this is the one passed in by the user when executing +AcpiInstallAddressSpaceHandler() and a specific region context +that is unique to each region (For example, the _ADR, _SEG and +_BBN values associated with a specific region). The generic +function definitions have changed to the following: + +typedef ACPI_STATUS (*ADDRESS_SPACE_HANDLER) ( UINT32 Function, +UINT32 Address, UINT32 BitWidth, UINT32 *Value, void +*HandlerContext, // This used to be void *Context void +*RegionContext); // This is an additional parameter + +typedef ACPI_STATUS (*ADDRESS_SPACE_SETUP) ( ACPI_HANDLE +RegionHandle, UINT32 Function, void *HandlerContext, void +**RegionContext); // This used to be **ReturnContext + +------------------------------------------- +Summary of changes for this label: 07_21_00 + +Major file consolidation and rename. All files within the +interpreter have been renamed as well as most header files. This +was done to prevent collisions with existing files in the host +OSs -- filenames such as "config.h" and "global.h" seem to be +quite common. The VC project files have been updated. All +makefiles will require modification. + +The parser/interpreter integration continues in Phase 5 with the +implementation of a complete 2-pass parse (the AML is parsed +twice) for each table; This avoids the construction of a huge +parse tree and therefore reduces the amount of dynamic memory +required by the subsystem. Greater use of the parse object cache +means that performance is unaffected. + +Many comments from the two code reviews have been rolled in. + +The 64-bit alignment support is complete. + +------------------------------------------- +Summary of changes for this label: 06_30_00 + +With a nod and a tip of the hat to the technology of yesteryear, +we've added support in the source code for 80 column output +devices. The code is now mostly constrained to 80 columns or +less to support environments and editors that 1) cannot display +or print more than 80 characters on a single line, and 2) cannot +disable line wrapping. + +A major restructuring of the namespace data structure has been +completed. The result is 1) cleaner and more +understandable/maintainable code, and 2) a significant reduction +in the dynamic memory requirement for each named ACPI object +(almost half). + +------------------------------------------- +Summary of changes for this label: 06_23_00 + +Linux support has been added. In order to obtain approval to get +the ACPI CA subsystem into the Linux kernel, we've had to make +quite a few changes to the base subsystem that will affect all +users (all the changes are generic and OS- independent). The +effects of these global changes have been somewhat far reaching. +Files have been merged and/or renamed and interfaces have been +renamed. The major changes are described below. + +Osd* interfaces renamed to AcpiOs* to eliminate namespace +pollution/confusion within our target kernels. All OSD +interfaces must be modified to match the new naming convention. + +Files merged across the subsystem. A number of the smaller source +and header files have been merged to reduce the file count and +increase the density of the existing files. There are too many +to list here. In general, makefiles that call out individual +files will require rebuilding. + +Interpreter files renamed. All interpreter files now have the +prefix am* instead of ie* and is*. + +Header files renamed: The acapi.h file is now acpixf.h. The +acpiosd.h file is now acpiosxf.h. We are removing references to +the acronym "API" since it is somewhat windowsy. The new name is +"external interface" or xface or xf in the filenames.j + + +All manifest constants have been forced to upper case (some were +mixed case.) Also, the string "ACPI_" has been prepended to many +(not all) of the constants, typedefs, and structs. + +The globals "DebugLevel" and "DebugLayer" have been renamed +"AcpiDbgLevel" and "AcpiDbgLayer" respectively. + +All other globals within the subsystem are now prefixed with +"AcpiGbl_" Internal procedures within the subsystem are now +prefixed with "Acpi" (with only a few exceptions). The original +two-letter abbreviation for the subcomponent remains after "Acpi" +- for example, CmCallocate became AcpiCmCallocate. + +Added a source code translation/conversion utility. Used to +generate the Linux source code, it can be modified to generate +other types of source as well. Can also be used to cleanup +existing source by removing extraneous spaces and blank lines. +Found in tools/acpisrc/* + +OsdUnMapMemory was renamed to OsdUnmapMemory and then +AcpiOsUnmapMemory. (UnMap became Unmap). + +A "MaxUnits" parameter has been added to AcpiOsCreateSemaphore. +When set to one, this indicates that the caller wants to use the + +semaphore as a mutex, not a counting semaphore. ACPI CA uses +both types. However, implementers of this call may want to use +different OS primitives depending on the type of semaphore +requested. For example, some operating systems provide separate + +"mutex" and "semaphore" interfaces - where the mutex interface is +much faster because it doesn't have all the overhead of a full +semaphore implementation. + +Fixed a deadlock problem where a method that accesses the PCI +address space can block forever if it is the first access to the +space. + +------------------------------------------- +Summary of changes for this label: 06_02_00 + +Support for environments that cannot handle unaligned data +accesses (e.g. firmware and OS environments devoid of alignment +handler technology namely SAL/EFI and the IA-64 Linux kernel) has +been added (via configurable macros) in these three areas: - +Transfer of data from the raw AML byte stream is done via byte +moves instead of word/dword/qword moves. - External objects are +aligned within the user buffer, including package elements (sub- +objects). - Conversion of name strings to UINT32 Acpi Names is now +done byte-wise. + +The Store operator was modified to mimic Microsoft's +implementation when storing to a Buffer Field. + +Added a check of the BM_STS bit before entering C3. + +The methods subdirectory has been obsoleted and removed. A new +file, cmeval.c subsumes the functionality. + +A 16-bit (DOS) version of AcpiExec has been developed. The +makefile is under the acpiexec directory. diff --git a/sys/contrib/dev/acpica/common/adfile.c b/sys/contrib/dev/acpica/common/adfile.c index 732b2bb51e6b..1de4b248f8db 100644 --- a/sys/contrib/dev/acpica/common/adfile.c +++ b/sys/contrib/dev/acpica/common/adfile.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: adfile - Application-level disassembler file support routines - * $Revision: 1.3 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -115,8 +114,9 @@ *****************************************************************************/ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acapps.h> +#include "acpi.h" +#include "accommon.h" +#include "acapps.h" #include <stdio.h> #include <string.h> @@ -125,6 +125,13 @@ #define _COMPONENT ACPI_TOOLS ACPI_MODULE_NAME ("adfile") +/* Local prototypes */ + +INT32 +AdWriteBuffer ( + char *Filename, + char *Buffer, + UINT32 Length); char FilenameBuf[20]; @@ -146,8 +153,8 @@ AdGenerateFilename ( char *Prefix, char *TableId) { - ACPI_NATIVE_UINT i; - ACPI_NATIVE_UINT j; + UINT32 i; + UINT32 j; for (i = 0; Prefix[i]; i++) @@ -183,14 +190,14 @@ AdGenerateFilename ( * ******************************************************************************/ -ACPI_NATIVE_INT +INT32 AdWriteBuffer ( - char *Filename, - char *Buffer, - UINT32 Length) + char *Filename, + char *Buffer, + UINT32 Length) { - FILE *fp; - ACPI_SIZE Actual; + FILE *fp; + ACPI_SIZE Actual; fp = fopen (Filename, "wb"); @@ -202,7 +209,7 @@ AdWriteBuffer ( Actual = fwrite (Buffer, (size_t) Length, 1, fp); fclose (fp); - return ((ACPI_NATIVE_INT) Actual); + return ((INT32) Actual); } diff --git a/sys/contrib/dev/acpica/common/adisasm.c b/sys/contrib/dev/acpica/common/adisasm.c index 843a9a8a23f0..8aaa3b4bb531 100644 --- a/sys/contrib/dev/acpica/common/adisasm.c +++ b/sys/contrib/dev/acpica/common/adisasm.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: adisasm - Application-level disassembler routines - * $Revision: 1.104 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -115,15 +114,16 @@ *****************************************************************************/ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acparser.h> -#include <contrib/dev/acpica/amlcode.h> -#include <contrib/dev/acpica/acdebug.h> -#include <contrib/dev/acpica/acdisasm.h> -#include <contrib/dev/acpica/acdispat.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/actables.h> -#include <contrib/dev/acpica/acapps.h> +#include "acpi.h" +#include "accommon.h" +#include "acparser.h" +#include "amlcode.h" +#include "acdebug.h" +#include "acdisasm.h" +#include "acdispat.h" +#include "acnamesp.h" +#include "actables.h" +#include "acapps.h" #include <stdio.h> #include <time.h> @@ -153,7 +153,25 @@ void AdDisassemblerHeader ( char *Filename); -ACPI_PARSE_OBJECT *AcpiGbl_ParseOpRoot; +void +AdAddExternalsToNamespace ( + void); + +UINT32 +AdMethodExternalCount ( + void); + +ACPI_STATUS +AdDeferredParse ( + ACPI_PARSE_OBJECT *Op, + UINT8 *Aml, + UINT32 AmlLength); + +ACPI_STATUS +AdParseDeferredOps ( + ACPI_PARSE_OBJECT *Root); + +ACPI_PARSE_OBJECT *AcpiGbl_ParseOpRoot; /* Stubs for ASL compiler */ @@ -179,7 +197,7 @@ AcpiDsMethodError ( ACPI_STATUS AcpiNsLoadTable ( - ACPI_NATIVE_UINT TableIndex, + UINT32 TableIndex, ACPI_NAMESPACE_NODE *Node) { return (AE_NOT_IMPLEMENTED); @@ -245,18 +263,27 @@ AdInitialize ( /* ACPI CA subsystem initialization */ Status = AcpiOsInitialize (); - AcpiUtInitGlobals (); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + Status = AcpiUtInitGlobals (); + if (ACPI_FAILURE (Status)) + { + return (Status); + } Status = AcpiUtMutexInitialize (); if (ACPI_FAILURE (Status)) { - return Status; + return (Status); } Status = AcpiNsRootInitialize (); if (ACPI_FAILURE (Status)) { - return Status; + return (Status); } /* Setup the Table Manager (cheat - there is no RSDT) */ @@ -265,7 +292,7 @@ AdInitialize ( AcpiGbl_RootTableList.Count = 0; AcpiGbl_RootTableList.Tables = LocalTables; - return Status; + return (Status); } @@ -275,7 +302,7 @@ AdInitialize ( * * PARAMETERS: * - * RETURN: Status + * RETURN: None * * DESCRIPTION: * @@ -371,14 +398,17 @@ AdAmlDisassemble ( { ACPI_STATUS Status; char *DisasmFilename = NULL; + char *ExternalFilename; FILE *File = NULL; - ACPI_TABLE_HEADER *Table; + 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) { @@ -388,12 +418,56 @@ AdAmlDisassemble ( return Status; } + /* + * External filenames separated by commas + * Example: iasl -e file1,file2,file3 -d xxx.aml + */ if (Gbl_ExternalFilename) { - Status = AcpiDbGetTableFromFile (Gbl_ExternalFilename, &ExternalTable); - if (ACPI_FAILURE (Status)) + ExternalFilename = strtok (Gbl_ExternalFilename, ","); + + while (ExternalFilename) { - return Status; + Status = AcpiDbGetTableFromFile (ExternalFilename, &ExternalTable); + if (ACPI_FAILURE (Status)) + { + return Status; + } + + /* Load external table for symbol resolution */ + + if (ExternalTable) + { + Status = AdParseTable (ExternalTable, &OwnerId, TRUE, TRUE); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("Could not parse external ACPI tables, %s\n", + AcpiFormatException (Status)); + return Status; + } + + /* + * Load namespace from names created within control methods + * Set owner id of nodes in external table + */ + AcpiDmFinishNamespaceLoad (AcpiGbl_ParseOpRoot, + AcpiGbl_RootNode, OwnerId); + AcpiPsDeleteParseTree (AcpiGbl_ParseOpRoot); + } + + /* Next external file name */ + + ExternalFilename = strtok (NULL, ","); + } + + /* 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; } } } @@ -470,7 +544,7 @@ AdAmlDisassemble ( { /* Always parse the tables, only option is what to display */ - Status = AdParseTable (Table); + Status = AdParseTable (Table, &OwnerId, TRUE, FALSE); if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("Could not parse ACPI tables, %s\n", @@ -490,12 +564,12 @@ AdAmlDisassemble ( /* * Load namespace from names created within control methods */ - AcpiDmFinishNamespaceLoad (AcpiGbl_ParseOpRoot, AcpiGbl_RootNode); + AcpiDmFinishNamespaceLoad (AcpiGbl_ParseOpRoot, AcpiGbl_RootNode, OwnerId); /* * Cross reference the namespace here, in order to generate External() statements */ - AcpiDmCrossReferenceNamespace (AcpiGbl_ParseOpRoot, AcpiGbl_RootNode); + AcpiDmCrossReferenceNamespace (AcpiGbl_ParseOpRoot, AcpiGbl_RootNode, OwnerId); if (AslCompilerdebug) { @@ -510,14 +584,6 @@ AdAmlDisassemble ( AcpiDmConvertResourceIndexes (AcpiGbl_ParseOpRoot, AcpiGbl_RootNode); - if (AslCompilerdebug) - { - AcpiOsPrintf ("/**** After second load and resource conversion\n"); - LsSetupNsList (File); - LsDisplayNamespace (); - AcpiOsPrintf ("*****/\n"); - } - /* * If we found any external control methods, we must reparse the entire * tree with the new information (namely, the number of arguments per @@ -547,7 +613,9 @@ AdAmlDisassemble ( Status = AcpiNsRootInitialize (); AdAddExternalsToNamespace (); - Status = AdParseTable (Table); + /* Parse table. No need to reload it, however (FALSE) */ + + Status = AdParseTable (Table, NULL, FALSE, FALSE); if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("Could not parse ACPI tables, %s\n", @@ -557,6 +625,11 @@ AdAmlDisassemble ( if (AslCompilerdebug) { + AcpiOsPrintf ("/**** After second load and resource conversion\n"); + LsSetupNsList (File); + LsDisplayNamespace (); + AcpiOsPrintf ("*****/\n"); + AcpiDmDumpTree (AcpiGbl_ParseOpRoot); } } @@ -573,6 +646,17 @@ AdAmlDisassemble ( } Cleanup: + + if (Table && !AcpiUtIsAmlTable (Table)) + { + ACPI_FREE (Table); + } + + if (DisasmFilename) + { + ACPI_FREE (DisasmFilename); + } + if (OutToFile && File) { @@ -585,7 +669,8 @@ Cleanup: } AcpiPsDeleteParseTree (AcpiGbl_ParseOpRoot); - return Status; + AcpiGbl_ParseOpRoot = NULL; + return (Status); } @@ -640,19 +725,59 @@ AdCreateTableHeader ( ACPI_TABLE_HEADER *Table) { char *NewFilename; + UINT8 Checksum; + /* + * Print file header and dump original table header + */ AdDisassemblerHeader (Filename); AcpiOsPrintf (" *\n * Original Table Header:\n"); AcpiOsPrintf (" * Signature \"%4.4s\"\n", Table->Signature); AcpiOsPrintf (" * Length 0x%8.8X (%u)\n", Table->Length, Table->Length); - AcpiOsPrintf (" * Revision 0x%2.2X\n", Table->Revision); + + /* Print and validate the revision */ + + AcpiOsPrintf (" * Revision 0x%2.2X", Table->Revision); + + switch (Table->Revision) + { + case 0: + AcpiOsPrintf (" **** Invalid Revision"); + break; + + case 1: + /* Revision of DSDT controls the ACPI integer width */ + + if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_DSDT)) + { + AcpiOsPrintf (" **** ACPI 1.0, no 64-bit math support"); + } + break; + + default: + break; + } + AcpiOsPrintf ("\n"); + + /* Print and validate the table checksum */ + + AcpiOsPrintf (" * Checksum 0x%2.2X", Table->Checksum); + + Checksum = AcpiTbChecksum (ACPI_CAST_PTR (UINT8, Table), Table->Length); + if (Checksum) + { + AcpiOsPrintf (" **** Incorrect checksum, should be 0x%2.2X", + (UINT8) (Table->Checksum - Checksum)); + } + AcpiOsPrintf ("\n"); + AcpiOsPrintf (" * OEM ID \"%.6s\"\n", Table->OemId); AcpiOsPrintf (" * OEM Table ID \"%.8s\"\n", Table->OemTableId); AcpiOsPrintf (" * OEM Revision 0x%8.8X (%u)\n", Table->OemRevision, Table->OemRevision); - AcpiOsPrintf (" * Creator ID \"%.4s\"\n", Table->AslCompilerId); - AcpiOsPrintf (" * Creator Revision 0x%8.8X (%u)\n", Table->AslCompilerRevision, Table->AslCompilerRevision); + AcpiOsPrintf (" * Compiler ID \"%.4s\"\n", Table->AslCompilerId); + AcpiOsPrintf (" * Compiler Version 0x%8.8X (%u)\n", Table->AslCompilerRevision, Table->AslCompilerRevision); AcpiOsPrintf (" */\n"); /* Create AML output filename based on input filename */ @@ -674,6 +799,8 @@ AdCreateTableHeader ( "DefinitionBlock (\"%s\", \"%4.4s\", %hd, \"%.6s\", \"%.8s\", 0x%8.8X)\n", NewFilename, Table->Signature, Table->Revision, Table->OemId, Table->OemTableId, Table->OemRevision); + + ACPI_FREE (NewFilename); } @@ -904,6 +1031,7 @@ AdParseDeferredOps ( case AML_CREATE_BYTE_FIELD_OP: case AML_CREATE_BIT_FIELD_OP: case AML_CREATE_FIELD_OP: + case AML_BANK_FIELD_OP: /* Nothing to do in these cases */ @@ -946,7 +1074,7 @@ AdGetLocalTables ( ACPI_TABLE_HEADER *NewTable; UINT32 NumTables; UINT32 PointerSize; - ACPI_NATIVE_UINT TableIndex; + UINT32 TableIndex; if (GetAllTables) @@ -958,6 +1086,11 @@ AdGetLocalTables ( fprintf (stderr, "Could not obtain RSDT\n"); return AE_NO_ACPI_TABLES; } + else + { + AdWriteTable (NewTable, NewTable->Length, + ACPI_SIG_RSDT, NewTable->OemTableId); + } if (ACPI_COMPARE_NAME (NewTable->Signature, ACPI_SIG_RSDT)) { @@ -1037,6 +1170,9 @@ 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 * * RETURN: Status * @@ -1046,13 +1182,16 @@ AdGetLocalTables ( ACPI_STATUS AdParseTable ( - ACPI_TABLE_HEADER *Table) + ACPI_TABLE_HEADER *Table, + ACPI_OWNER_ID *OwnerId, + BOOLEAN LoadTable, + BOOLEAN External) { ACPI_STATUS Status = AE_OK; ACPI_WALK_STATE *WalkState; UINT8 *AmlStart; UINT32 AmlLength; - ACPI_NATIVE_UINT TableIndex; + UINT32 TableIndex; if (!Table) @@ -1100,23 +1239,50 @@ AdParseTable ( return Status; } + /* If LoadTable is FALSE, we are parsing the last loaded table */ + + TableIndex = AcpiGbl_RootTableList.Count - 1; + /* Pass 2 */ - Status = AcpiTbStoreTable ((ACPI_NATIVE_UINT) Table, Table, - Table->Length, ACPI_TABLE_ORIGIN_ALLOCATED, &TableIndex); - if (ACPI_FAILURE (Status)) + if (LoadTable) { - return Status; + Status = AcpiTbStoreTable ((ACPI_PHYSICAL_ADDRESS) Table, Table, + Table->Length, ACPI_TABLE_ORIGIN_ALLOCATED, &TableIndex); + if (ACPI_FAILURE (Status)) + { + return Status; + } + Status = AcpiTbAllocateOwnerId (TableIndex); + if (ACPI_FAILURE (Status)) + { + return Status; + } + if (OwnerId) + { + Status = AcpiTbGetOwnerId (TableIndex, OwnerId); + if (ACPI_FAILURE (Status)) + { + return Status; + } + } } fprintf (stderr, "Pass 2 parse of [%4.4s]\n", (char *) Table->Signature); - Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS2, 0); + Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS2, TableIndex, NULL); if (ACPI_FAILURE (Status)) { return (Status); } + /* No need to parse control methods of external table */ + + if (External) + { + return AE_OK; + } + /* Pass 3: Parse control methods and link their parse trees into the main parse tree */ Status = AdParseDeferredOps (AcpiGbl_ParseOpRoot); diff --git a/sys/contrib/dev/acpica/common/adwalk.c b/sys/contrib/dev/acpica/common/adwalk.c index 108561cbf82d..67d9b1138946 100644 --- a/sys/contrib/dev/acpica/common/adwalk.c +++ b/sys/contrib/dev/acpica/common/adwalk.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: adwalk - Application-level disassembler parse tree walk routines - * $Revision: 1.6 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -115,14 +114,15 @@ *****************************************************************************/ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acparser.h> -#include <contrib/dev/acpica/amlcode.h> -#include <contrib/dev/acpica/acdebug.h> -#include <contrib/dev/acpica/acdisasm.h> -#include <contrib/dev/acpica/acdispat.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/acapps.h> +#include "acpi.h" +#include "accommon.h" +#include "acparser.h" +#include "amlcode.h" +#include "acdebug.h" +#include "acdisasm.h" +#include "acdispat.h" +#include "acnamesp.h" +#include "acapps.h" #define _COMPONENT ACPI_TOOLS @@ -252,6 +252,7 @@ AcpiDmFindOrphanMethods ( * * PARAMETERS: ParseTreeRoot - Root of the parse tree * NamespaceRoot - Root of the internal namespace + * OwnerId - OwnerId of the table to be disassembled * * RETURN: None * @@ -263,7 +264,8 @@ AcpiDmFindOrphanMethods ( void AcpiDmFinishNamespaceLoad ( ACPI_PARSE_OBJECT *ParseTreeRoot, - ACPI_NAMESPACE_NODE *NamespaceRoot) + ACPI_NAMESPACE_NODE *NamespaceRoot, + ACPI_OWNER_ID OwnerId) { ACPI_STATUS Status; ACPI_OP_WALK_INFO Info; @@ -277,7 +279,7 @@ AcpiDmFinishNamespaceLoad ( /* Create and initialize a new walk state */ - WalkState = AcpiDsCreateWalkState (0, ParseTreeRoot, NULL, NULL); + WalkState = AcpiDsCreateWalkState (OwnerId, ParseTreeRoot, NULL, NULL); if (!WalkState) { return; @@ -304,6 +306,7 @@ AcpiDmFinishNamespaceLoad ( * * PARAMETERS: ParseTreeRoot - Root of the parse tree * NamespaceRoot - Root of the internal namespace + * OwnerId - OwnerId of the table to be disassembled * * RETURN: None * @@ -314,7 +317,8 @@ AcpiDmFinishNamespaceLoad ( void AcpiDmCrossReferenceNamespace ( ACPI_PARSE_OBJECT *ParseTreeRoot, - ACPI_NAMESPACE_NODE *NamespaceRoot) + ACPI_NAMESPACE_NODE *NamespaceRoot, + ACPI_OWNER_ID OwnerId) { ACPI_STATUS Status; ACPI_OP_WALK_INFO Info; @@ -328,7 +332,7 @@ AcpiDmCrossReferenceNamespace ( /* Create and initialize a new walk state */ - WalkState = AcpiDsCreateWalkState (0, ParseTreeRoot, NULL, NULL); + WalkState = AcpiDsCreateWalkState (OwnerId, ParseTreeRoot, NULL, NULL); if (!WalkState) { return; @@ -470,6 +474,9 @@ AcpiDmDumpDescending ( case AML_INT_NAMEDFIELD_OP: AcpiOsPrintf ("%4.4s", &Op->Named.Name); break; + + default: + break; } AcpiOsPrintf ("\n"); @@ -618,6 +625,9 @@ AcpiDmFindOrphanDescending ( } break; + + default: + break; } return (AE_OK); @@ -650,6 +660,9 @@ AcpiDmLoadDescendingOp ( char *Path = NULL; ACPI_PARSE_OBJECT *NextOp; ACPI_NAMESPACE_NODE *Node; + char FieldPath[5]; + BOOLEAN PreDefined = FALSE; + UINT8 PreDefineIndex = 0; WalkState = Info->WalkState; @@ -672,6 +685,13 @@ AcpiDmLoadDescendingOp ( /* For all named operators, get the new name */ Path = (char *) Op->Named.Path; + + if (!Path && Op->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP) + { + *ACPI_CAST_PTR (UINT32, &FieldPath[0]) = Op->Named.Name; + FieldPath[4] = 0; + Path = FieldPath; + } } else if (OpInfo->Flags & AML_CREATE) { @@ -699,6 +719,36 @@ AcpiDmLoadDescendingOp ( Op->Common.Node = Node; + if (ACPI_SUCCESS (Status)) + { + /* Check if it's a predefined node */ + + while (AcpiGbl_PreDefinedNames[PreDefineIndex].Name) + { + if (!ACPI_STRNCMP (Node->Name.Ascii, + AcpiGbl_PreDefinedNames[PreDefineIndex].Name, 4)) + { + PreDefined = TRUE; + break; + } + + PreDefineIndex++; + } + + /* + * Set node owner id if it satisfies all the following conditions: + * 1) Not a predefined node, _SB_ etc + * 2) Not the root node + * 3) Not a node created by Scope + */ + + if (!PreDefined && Node != AcpiGbl_RootNode && + Op->Common.AmlOpcode != AML_SCOPE_OP) + { + Node->OwnerId = WalkState->OwnerId; + } + } + Exit: @@ -740,10 +790,12 @@ AcpiDmXrefDescendingOp ( const ACPI_OPCODE_INFO *OpInfo; ACPI_WALK_STATE *WalkState; ACPI_OBJECT_TYPE ObjectType; + ACPI_OBJECT_TYPE ObjectType2; ACPI_STATUS Status; char *Path = NULL; ACPI_PARSE_OBJECT *NextOp; ACPI_NAMESPACE_NODE *Node; + ACPI_OPERAND_OBJECT *Object; WalkState = Info->WalkState; @@ -819,6 +871,33 @@ AcpiDmXrefDescendingOp ( #endif } } + + /* + * Found the node in external table, add it to external list + * Node->OwnerId == 0 indicates built-in ACPI Names, _OS_ etc + */ + else if (Node->OwnerId && WalkState->OwnerId != Node->OwnerId) + { + ObjectType2 = ObjectType; + + Object = AcpiNsGetAttachedObject (Node); + if (Object) + { + ObjectType2 = Object->Common.Type; + } + + if (ObjectType2 == ACPI_TYPE_METHOD) + { + AcpiDmAddToExternalList (Path, ACPI_TYPE_METHOD, + Object->Method.ParamCount); + } + else + { + AcpiDmAddToExternalList (Path, (UINT8) ObjectType2, 0); + } + + Op->Common.Node = Node; + } else { Op->Common.Node = Node; diff --git a/sys/contrib/dev/acpica/common/dmrestag.c b/sys/contrib/dev/acpica/common/dmrestag.c index ed8b36b7df2b..b46198815292 100644 --- a/sys/contrib/dev/acpica/common/dmrestag.c +++ b/sys/contrib/dev/acpica/common/dmrestag.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: dmrestag - Add tags to resource descriptors (Application-level) - * $Revision: 1.11 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -115,11 +114,12 @@ *****************************************************************************/ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acparser.h> -#include <contrib/dev/acpica/acdisasm.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/amlcode.h> +#include "acpi.h" +#include "accommon.h" +#include "acparser.h" +#include "acdisasm.h" +#include "acnamesp.h" +#include "amlcode.h" /* This module used for application-level code only */ @@ -636,13 +636,22 @@ AcpiGetTagPathname ( /* Get the full pathname to the parent buffer */ RequiredSize = AcpiNsGetPathnameLength (BufferNode); + if (!RequiredSize) + { + return (NULL); + } + Pathname = ACPI_ALLOCATE_ZEROED (RequiredSize + ACPI_PATH_SEGMENT_LENGTH); if (!Pathname) { return (NULL); } - AcpiNsBuildExternalPath (BufferNode, RequiredSize, Pathname); + Status = AcpiNsBuildExternalPath (BufferNode, RequiredSize, Pathname); + if (ACPI_FAILURE (Status)) + { + return (NULL); + } /* * Create the full path to the resource and tag by: remove the buffer name, @@ -720,7 +729,7 @@ AcpiDmUpdateResourceName ( /* Change the resource descriptor name */ - ResourceNode->Name.Integer = *(UINT32 *) Name; + ResourceNode->Name.Integer = *ACPI_CAST_PTR (UINT32, &Name[0]); } diff --git a/sys/contrib/dev/acpica/common/dmtable.c b/sys/contrib/dev/acpica/common/dmtable.c index ce4b5f91f60f..73a033891eef 100644 --- a/sys/contrib/dev/acpica/common/dmtable.c +++ b/sys/contrib/dev/acpica/common/dmtable.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: dmtable - Support for ACPI tables that contain no AML code - * $Revision: 1.12 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -114,9 +113,10 @@ * *****************************************************************************/ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acdisasm.h> -#include <contrib/dev/acpica/actables.h> +#include "acpi.h" +#include "accommon.h" +#include "acdisasm.h" +#include "actables.h" /* This module used for application-level code only */ @@ -134,16 +134,56 @@ AcpiDmCheckAscii ( UINT8 *Target, UINT32 Count); +UINT8 +AcpiTbGenerateChecksum ( + ACPI_TABLE_HEADER *Table); + /* These tables map a subtable type to a description string */ +static const char *AcpiDmAsfSubnames[] = +{ + "ASF Information", + "ASF Alerts", + "ASF Remote Control", + "ASF RMCP Boot Options", + "ASF Address", + "Unknown SubTable Type" /* Reserved */ +}; + static const char *AcpiDmDmarSubnames[] = { "Hardware Unit Definition", "Reserved Memory Region", + "Root Port ATS Capability", + "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", + "PCI Express Root Port AER", + "PCI Express AER (AER Endpoint)", + "PCI Express/PCI-X Bridge AER", + "Generic Hardware Error Source", "Unknown SubTable Type" /* Reserved */ }; +static const char *AcpiDmHestNotifySubnames[] = +{ + "Polled", + "External Interrupt", + "Local Interrupt", + "SCI", + "NMI", + "Unknown Notify Type" /* Reserved */ +}; + static const char *AcpiDmMadtSubnames[] = { "Processor Local APIC", /* ACPI_MADT_TYPE_LOCAL_APIC */ @@ -155,6 +195,8 @@ static const char *AcpiDmMadtSubnames[] = "I/O SAPIC", /* ACPI_MADT_TYPE_IO_SAPIC */ "Local SAPIC", /* ACPI_MADT_TYPE_LOCAL_SAPIC */ "Platform Interrupt Sources", /* ACPI_MADT_TYPE_INTERRUPT_SOURCE */ + "Processor Local x2APIC", /* ACPI_MADT_TYPE_LOCAL_X2APIC */ + "Local x2APIC NMI", /* ACPI_MADT_TYPE_LOCAL_X2APIC_NMI */ "Unknown SubTable Type" /* Reserved */ }; @@ -162,10 +204,27 @@ static const char *AcpiDmSratSubnames[] = { "Processor Local APIC/SAPIC Affinity", "Memory Affinity", + "Processor Local x2APIC Affinity", "Unknown SubTable Type" /* Reserved */ }; +#define ACPI_FADT_PM_RESERVED 8 + +static const char *AcpiDmFadtProfiles[] = +{ + "Unspecified", + "Desktop", + "Mobile", + "Workstation", + "Enterprise Server", + "SOHO Server", + "Appliance PC", + "Performance Server", + "Unknown Profile Type" +}; + + /******************************************************************************* * * ACPI Table Data, indexed by signature. @@ -180,16 +239,21 @@ static ACPI_DMTABLE_DATA AcpiDmTableData[] = { {ACPI_SIG_ASF, NULL, AcpiDmDumpAsf, "Alert Standard Format table"}, {ACPI_SIG_BOOT, AcpiDmTableInfoBoot, NULL, "Simple Boot Flag Table"}, + {ACPI_SIG_BERT, AcpiDmTableInfoBert, NULL, "Boot Error Record Table"}, {ACPI_SIG_CPEP, NULL, AcpiDmDumpCpep, "Corrected Platform Error Polling table"}, {ACPI_SIG_DBGP, AcpiDmTableInfoDbgp, NULL, "Debug Port table"}, {ACPI_SIG_DMAR, NULL, AcpiDmDumpDmar, "DMA Remapping table"}, {ACPI_SIG_ECDT, AcpiDmTableInfoEcdt, NULL, "Embedded Controller Boot Resources Table"}, + {ACPI_SIG_EINJ, NULL, AcpiDmDumpEinj, "Error Injection table"}, + {ACPI_SIG_ERST, NULL, AcpiDmDumpErst, "Error Record Serialization Table"}, {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_MADT, NULL, AcpiDmDumpMadt, "Multiple APIC Description Table"}, {ACPI_SIG_MCFG, NULL, AcpiDmDumpMcfg, "Memory Mapped Configuration 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"}, {ACPI_SIG_SLIT, NULL, AcpiDmDumpSlit, "System Locality Information Table"}, {ACPI_SIG_SPCR, AcpiDmTableInfoSpcr, NULL, "Serial Port Console Redirection table"}, {ACPI_SIG_SPMI, AcpiDmTableInfoSpmi, NULL, "Server Platform Management Interface table"}, @@ -284,6 +348,7 @@ void AcpiDmDumpDataTable ( ACPI_TABLE_HEADER *Table) { + ACPI_STATUS Status; ACPI_DMTABLE_DATA *TableData; UINT32 Length; @@ -314,7 +379,11 @@ AcpiDmDumpDataTable ( * All other tables must use the common ACPI table header, dump it now */ Length = Table->Length; - AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHeader); + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHeader); + if (ACPI_FAILURE (Status)) + { + return; + } AcpiOsPrintf ("\n"); /* Match signature and dispatch appropriately */ @@ -380,12 +449,12 @@ AcpiDmLineHeader ( if (ByteLength) { - AcpiOsPrintf ("[%3.3Xh %3.3d% 3d] %28s : ", + AcpiOsPrintf ("[%3.3Xh %4.4d% 3d] %28s : ", Offset, Offset, ByteLength, Name); } else { - AcpiOsPrintf ("%42s : ", + AcpiOsPrintf ("%43s : ", Name); } } @@ -400,12 +469,12 @@ AcpiDmLineHeader2 ( if (ByteLength) { - AcpiOsPrintf ("[%3.3Xh %3.3d% 3d] %24s % 3d : ", + AcpiOsPrintf ("[%3.3Xh %4.4d% 3d] %24s % 3d : ", Offset, Offset, ByteLength, Name, Value); } else { - AcpiOsPrintf ("[%3.3Xh %3.3d ] %24s % 3d : ", + AcpiOsPrintf ("[%3.3Xh %4.4d ] %24s % 3d : ", Offset, Offset, Name, Value); } } @@ -419,7 +488,7 @@ AcpiDmLineHeader2 ( * TableOffset - Starting offset within the table for this * sub-descriptor (0 if main table) * Table - The ACPI table - * SubtableLength - Lenghth of this sub-descriptor + * SubtableLength - Length of this sub-descriptor * Info - Info table for this ACPI table * * RETURN: None @@ -428,7 +497,7 @@ AcpiDmLineHeader2 ( * ******************************************************************************/ -void +ACPI_STATUS AcpiDmDumpTable ( UINT32 TableLength, UINT32 TableOffset, @@ -442,12 +511,13 @@ AcpiDmDumpTable ( UINT8 Temp8; UINT16 Temp16; ACPI_DMTABLE_DATA *TableData; + BOOLEAN LastOutputBlankLine = FALSE; if (!Info) { AcpiOsPrintf ("Display not implemented\n"); - return; + return (AE_NOT_IMPLEMENTED); } /* Walk entire Info table; Null name terminates */ @@ -466,7 +536,8 @@ AcpiDmDumpTable ( if ((CurrentOffset >= TableLength) || (SubtableLength && (Info->Offset >= SubtableLength))) { - return; + AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure!\n"); + return (AE_BAD_DATA); } /* Generate the byte length for this field */ @@ -478,10 +549,14 @@ AcpiDmDumpTable ( case ACPI_DMT_SPACEID: case ACPI_DMT_MADT: case ACPI_DMT_SRAT: + case ACPI_DMT_ASF: + case ACPI_DMT_HESTNTYP: + case ACPI_DMT_FADTPM: ByteLength = 1; break; case ACPI_DMT_UINT16: case ACPI_DMT_DMAR: + case ACPI_DMT_HEST: ByteLength = 2; break; case ACPI_DMT_UINT24: @@ -506,14 +581,32 @@ AcpiDmDumpTable ( ByteLength = ACPI_STRLEN (ACPI_CAST_PTR (char, Target)) + 1; break; case ACPI_DMT_GAS: - AcpiOsPrintf ("\n"); + if (!LastOutputBlankLine) + { + AcpiOsPrintf ("\n"); + LastOutputBlankLine = TRUE; + } ByteLength = sizeof (ACPI_GENERIC_ADDRESS); break; + case ACPI_DMT_HESTNTFY: + if (!LastOutputBlankLine) + { + AcpiOsPrintf ("\n"); + LastOutputBlankLine = TRUE; + } + ByteLength = sizeof (ACPI_HEST_NOTIFY); + break; default: ByteLength = 0; break; } + if (CurrentOffset + ByteLength > TableLength) + { + AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure!\n"); + return (AE_BAD_DATA); + } + /* Start a new line and decode the opcode */ AcpiDmLineHeader (CurrentOffset, ByteLength, Info->Name); @@ -571,9 +664,11 @@ AcpiDmDumpTable ( case ACPI_DMT_UINT56: - AcpiOsPrintf ("%6.6X%8.8X\n", - ACPI_HIDWORD (ACPI_GET64 (Target)) & 0x00FFFFFF, - ACPI_LODWORD (ACPI_GET64 (Target))); + for (Temp8 = 0; Temp8 < 7; Temp8++) + { + AcpiOsPrintf ("%2.2X", Target[Temp8]); + } + AcpiOsPrintf ("\n"); break; case ACPI_DMT_UINT64: @@ -648,22 +743,73 @@ AcpiDmDumpTable ( AcpiOsPrintf ("<Generic Address Structure>\n"); AcpiDmDumpTable (ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length, - CurrentOffset, Target, 0, AcpiDmTableInfoGas); + CurrentOffset, Target, sizeof (ACPI_GENERIC_ADDRESS), AcpiDmTableInfoGas); + AcpiOsPrintf ("\n"); + LastOutputBlankLine = TRUE; + break; + + case ACPI_DMT_ASF: + + /* ASF subtable types */ + + Temp16 = (UINT16) ((*Target) & 0x7F); /* Top bit can be zero or one */ + if (Temp16 > ACPI_ASF_TYPE_RESERVED) + { + Temp16 = ACPI_ASF_TYPE_RESERVED; + } + + AcpiOsPrintf ("%2.2X <%s>\n", *Target, AcpiDmAsfSubnames[Temp16]); break; case ACPI_DMT_DMAR: /* DMAR subtable types */ - Temp16 = *Target; + Temp16 = ACPI_GET16 (Target); if (Temp16 > ACPI_DMAR_TYPE_RESERVED) { Temp16 = ACPI_DMAR_TYPE_RESERVED; } - AcpiOsPrintf ("%4.4X <%s>\n", *Target, AcpiDmDmarSubnames[Temp16]); + AcpiOsPrintf ("%4.4X <%s>\n", ACPI_GET16 (Target), AcpiDmDmarSubnames[Temp16]); + break; + + case ACPI_DMT_HEST: + + /* HEST subtable types */ + + Temp16 = ACPI_GET16 (Target); + if (Temp16 > ACPI_HEST_TYPE_RESERVED) + { + Temp16 = ACPI_HEST_TYPE_RESERVED; + } + + AcpiOsPrintf ("%4.4X (%s)\n", ACPI_GET16 (Target), AcpiDmHestSubnames[Temp16]); + break; + + 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); + AcpiOsPrintf ("\n"); + LastOutputBlankLine = TRUE; + break; + + case ACPI_DMT_HESTNTYP: + + /* HEST Notify types */ + + Temp8 = *Target; + if (Temp8 > ACPI_HEST_NOTIFY_RESERVED) + { + Temp8 = ACPI_HEST_NOTIFY_RESERVED; + } + + AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmHestNotifySubnames[Temp8]); break; + case ACPI_DMT_MADT: /* MADT subtable types */ @@ -690,15 +836,38 @@ AcpiDmDumpTable ( AcpiOsPrintf ("%2.2X <%s>\n", *Target, AcpiDmSratSubnames[Temp8]); break; + case ACPI_DMT_FADTPM: + + /* FADT Preferred PM Profile names */ + + Temp8 = *Target; + if (Temp8 > ACPI_FADT_PM_RESERVED) + { + Temp8 = ACPI_FADT_PM_RESERVED; + } + + AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmFadtProfiles[Temp8]); + break; + case ACPI_DMT_EXIT: - return; + return (AE_OK); default: ACPI_ERROR ((AE_INFO, "**** Invalid table opcode [%X] ****\n", Info->Opcode)); - return; + return (AE_SUPPORT); } } + + if (TableOffset && !SubtableLength) + { + /* If this table is not the main table, subtable must have valid length */ + + AcpiOsPrintf ("Invalid zero length subtable\n"); + return (AE_BAD_DATA); + } + + return (AE_OK); } diff --git a/sys/contrib/dev/acpica/common/dmtbdump.c b/sys/contrib/dev/acpica/common/dmtbdump.c index 03ca3239117c..a0b0d965c324 100644 --- a/sys/contrib/dev/acpica/common/dmtbdump.c +++ b/sys/contrib/dev/acpica/common/dmtbdump.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: dmtbdump - Dump ACPI data tables that contain no AML code - * $Revision: 1.15 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -114,9 +113,10 @@ * *****************************************************************************/ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acdisasm.h> -#include <contrib/dev/acpica/actables.h> +#include "acpi.h" +#include "accommon.h" +#include "acdisasm.h" +#include "actables.h" /* This module used for application-level code only */ @@ -260,13 +260,20 @@ AcpiDmDumpFadt ( AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt1); - /* Check for ACPI 2.0+ extended data (cannot depend on Revision field) */ + /* Check for ACPI 1.0B MS extensions (FADT revision 2) */ - if (Table->Length >= sizeof (ACPI_TABLE_FADT)) + if (Table->Revision == 2) { AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt2); } + /* Check for ACPI 2.0+ extended data (FADT revision 3+) */ + + else if (Table->Length >= sizeof (ACPI_TABLE_FADT)) + { + AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt3); + } + /* Validate various fields in the FADT, including length */ AcpiTbCreateLocalFadt (Table, Table->Length); @@ -289,15 +296,16 @@ void AcpiDmDumpAsf ( ACPI_TABLE_HEADER *Table) { + ACPI_STATUS Status; UINT32 Offset = sizeof (ACPI_TABLE_HEADER); ACPI_ASF_INFO *SubTable; ACPI_DMTABLE_INFO *InfoTable; ACPI_DMTABLE_INFO *DataInfoTable = NULL; UINT8 *DataTable = NULL; - ACPI_NATIVE_UINT DataCount = 0; - ACPI_NATIVE_UINT DataLength = 0; - ACPI_NATIVE_UINT DataOffset = 0; - ACPI_NATIVE_UINT i; + UINT32 DataCount = 0; + UINT32 DataLength = 0; + UINT32 DataOffset = 0; + UINT32 i; /* No main table, only sub-tables */ @@ -307,7 +315,12 @@ AcpiDmDumpAsf ( { /* Common sub-table header */ - AcpiDmDumpTable (Table->Length, Offset, SubTable, 0, AcpiDmTableInfoAsfHdr); + Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, + SubTable->Header.Length, AcpiDmTableInfoAsfHdr); + if (ACPI_FAILURE (Status)) + { + return; + } switch (SubTable->Header.Type & 0x7F) /* Mask off top bit */ { @@ -349,8 +362,12 @@ AcpiDmDumpAsf ( return; } - AcpiDmDumpTable (Table->Length, Offset, SubTable, SubTable->Header.Length, InfoTable); - + Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, + SubTable->Header.Length, InfoTable); + if (ACPI_FAILURE (Status)) + { + return; + } /* Dump variable-length extra data */ @@ -362,7 +379,12 @@ AcpiDmDumpAsf ( for (i = 0; i < DataCount; i++) { AcpiOsPrintf ("\n"); - AcpiDmDumpTable (Table->Length, DataOffset, DataTable, DataLength, DataInfoTable); + Status = AcpiDmDumpTable (Table->Length, DataOffset, + DataTable, DataLength, DataInfoTable); + if (ACPI_FAILURE (Status)) + { + return; + } DataTable = ACPI_ADD_PTR (UINT8, DataTable, DataLength); DataOffset += DataLength; @@ -381,16 +403,30 @@ AcpiDmDumpAsf ( AcpiOsPrintf ("%2.2X ", *DataTable); DataTable++; DataOffset++; + if (DataOffset > Table->Length) + { + AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure!\n"); + return; + } } AcpiOsPrintf ("\n"); break; + + default: + break; } AcpiOsPrintf ("\n"); /* Point to next sub-table */ + if (!SubTable->Header.Length) + { + AcpiOsPrintf ("Invalid zero subtable header length\n"); + return; + } + Offset += SubTable->Header.Length; SubTable = ACPI_ADD_PTR (ACPI_ASF_INFO, SubTable, SubTable->Header.Length); } @@ -414,6 +450,7 @@ void AcpiDmDumpCpep ( ACPI_TABLE_HEADER *Table) { + ACPI_STATUS Status; ACPI_CPEP_POLLING *SubTable; UINT32 Length = Table->Length; UINT32 Offset = sizeof (ACPI_TABLE_CPEP); @@ -421,7 +458,11 @@ AcpiDmDumpCpep ( /* Main table */ - AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoCpep); + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoCpep); + if (ACPI_FAILURE (Status)) + { + return; + } /* Sub-tables */ @@ -429,7 +470,12 @@ AcpiDmDumpCpep ( while (Offset < Table->Length) { AcpiOsPrintf ("\n"); - AcpiDmDumpTable (Length, Offset, SubTable, SubTable->Length, AcpiDmTableInfoCpep0); + Status = AcpiDmDumpTable (Length, Offset, SubTable, + SubTable->Length, AcpiDmTableInfoCpep0); + if (ACPI_FAILURE (Status)) + { + return; + } /* Point to next sub-table */ @@ -456,6 +502,7 @@ void AcpiDmDumpDmar ( ACPI_TABLE_HEADER *Table) { + ACPI_STATUS Status; ACPI_DMAR_HEADER *SubTable; UINT32 Length = Table->Length; UINT32 Offset = sizeof (ACPI_TABLE_DMAR); @@ -468,7 +515,11 @@ AcpiDmDumpDmar ( /* Main table */ - AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDmar); + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDmar); + if (ACPI_FAILURE (Status)) + { + return; + } /* Sub-tables */ @@ -478,7 +529,12 @@ AcpiDmDumpDmar ( /* Common sub-table header */ AcpiOsPrintf ("\n"); - AcpiDmDumpTable (Length, Offset, SubTable, 0, AcpiDmTableInfoDmarHdr); + Status = AcpiDmDumpTable (Length, Offset, SubTable, + SubTable->Length, AcpiDmTableInfoDmarHdr); + if (ACPI_FAILURE (Status)) + { + return; + } switch (SubTable->Type) { @@ -490,52 +546,58 @@ AcpiDmDumpDmar ( InfoTable = AcpiDmTableInfoDmar1; ScopeOffset = sizeof (ACPI_DMAR_RESERVED_MEMORY); break; + case ACPI_DMAR_TYPE_ATSR: + InfoTable = AcpiDmTableInfoDmar2; + ScopeOffset = sizeof (ACPI_DMAR_ATSR); + break; default: AcpiOsPrintf ("\n**** Unknown DMAR sub-table type %X\n\n", SubTable->Type); return; } - AcpiDmDumpTable (Length, Offset, SubTable, SubTable->Length, InfoTable); - - /* - * Currently, a common flag indicates whether there are any - * device scope entries present at the end of the subtable. - */ - if ((SubTable->Flags & ACPI_DMAR_INCLUDE_ALL) == 0) + Status = AcpiDmDumpTable (Length, Offset, SubTable, + SubTable->Length, InfoTable); + if (ACPI_FAILURE (Status)) { - /* Dump the device scope entries */ + return; + } - ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE, SubTable, ScopeOffset); - while (ScopeOffset < SubTable->Length) + /* Dump the device scope entries (if any) */ + + ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE, SubTable, ScopeOffset); + while (ScopeOffset < SubTable->Length) + { + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Length, Offset + ScopeOffset, ScopeTable, + ScopeTable->Length, AcpiDmTableInfoDmarScope); + if (ACPI_FAILURE (Status)) { - AcpiOsPrintf ("\n"); - AcpiDmDumpTable (Length, Offset + ScopeOffset, ScopeTable, - ScopeTable->Length, AcpiDmTableInfoDmarScope); + return; + } - /* Dump the PCI Path entries for this device scope */ + /* Dump the PCI Path entries for this device scope */ - PathOffset = sizeof (ACPI_DMAR_DEVICE_SCOPE); /* Path entries start at this offset */ + PathOffset = sizeof (ACPI_DMAR_DEVICE_SCOPE); /* Path entries start at this offset */ - PciPath = ACPI_ADD_PTR (UINT8, ScopeTable, - sizeof (ACPI_DMAR_DEVICE_SCOPE)); + PciPath = ACPI_ADD_PTR (UINT8, ScopeTable, + sizeof (ACPI_DMAR_DEVICE_SCOPE)); - while (PathOffset < ScopeTable->Length) - { - AcpiDmLineHeader ((PathOffset + ScopeOffset + Offset), 2, "PCI Path"); - AcpiOsPrintf ("[%2.2X, %2.2X]\n", PciPath[0], PciPath[1]); + while (PathOffset < ScopeTable->Length) + { + AcpiDmLineHeader ((PathOffset + ScopeOffset + Offset), 2, "PCI Path"); + AcpiOsPrintf ("[%2.2X, %2.2X]\n", PciPath[0], PciPath[1]); - /* Point to next PCI Path entry */ + /* Point to next PCI Path entry */ - PathOffset += 2; - PciPath += 2; - } + PathOffset += 2; + PciPath += 2; + } - /* Point to next device scope entry */ + /* Point to next device scope entry */ - ScopeOffset += ScopeTable->Length; - ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE, - ScopeTable, ScopeTable->Length); - } + ScopeOffset += ScopeTable->Length; + ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE, + ScopeTable, ScopeTable->Length); } /* Point to next sub-table */ @@ -548,6 +610,220 @@ AcpiDmDumpDmar ( /******************************************************************************* * + * FUNCTION: AcpiDmDumpEinj + * + * PARAMETERS: Table - A EINJ table + * + * RETURN: None + * + * DESCRIPTION: Format the contents of a EINJ. This table type consists + * of an open-ended number of subtables. + * + ******************************************************************************/ + +void +AcpiDmDumpEinj ( + ACPI_TABLE_HEADER *Table) +{ + ACPI_STATUS Status; + ACPI_WHEA_HEADER *SubTable; + UINT32 Length = Table->Length; + UINT32 Offset = sizeof (ACPI_TABLE_EINJ); + + + /* Main table */ + + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoEinj); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Sub-tables */ + + SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset); + while (Offset < Table->Length) + { + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Length, Offset, SubTable, + sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoEinj0); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Point to next sub-table (each subtable is of fixed length) */ + + Offset += sizeof (ACPI_WHEA_HEADER); + SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, SubTable, + sizeof (ACPI_WHEA_HEADER)); + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmDumpErst + * + * PARAMETERS: Table - A ERST table + * + * RETURN: None + * + * DESCRIPTION: Format the contents of a ERST. This table type consists + * of an open-ended number of subtables. + * + ******************************************************************************/ + +void +AcpiDmDumpErst ( + ACPI_TABLE_HEADER *Table) +{ + ACPI_STATUS Status; + ACPI_WHEA_HEADER *SubTable; + UINT32 Length = Table->Length; + UINT32 Offset = sizeof (ACPI_TABLE_ERST); + + + /* Main table */ + + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoErst); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Sub-tables */ + + SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset); + while (Offset < Table->Length) + { + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Length, Offset, SubTable, + sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoEinj0); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Point to next sub-table (each subtable is of fixed length) */ + + Offset += sizeof (ACPI_WHEA_HEADER); + SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, SubTable, + sizeof (ACPI_WHEA_HEADER)); + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmDumpHest + * + * PARAMETERS: Table - A HEST table + * + * RETURN: None + * + * DESCRIPTION: Format the contents of a HEST. This table type consists + * of an open-ended number of subtables. + * + ******************************************************************************/ + +void +AcpiDmDumpHest ( + ACPI_TABLE_HEADER *Table) +{ + ACPI_STATUS Status; + ACPI_HEST_HEADER *SubTable; + UINT32 Length = Table->Length; + UINT32 Offset = sizeof (ACPI_TABLE_HEST); + ACPI_DMTABLE_INFO *InfoTable; + UINT32 SubTableLength; + + + /* Main table */ + + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHest); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Sub-tables */ + + SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, Table, Offset); + while (Offset < Table->Length) + { + switch (SubTable->Type) + { + case ACPI_HEST_TYPE_XPF_MACHINE_CHECK: + InfoTable = AcpiDmTableInfoHest0; + SubTableLength = sizeof (ACPI_HEST_XPF_MACHINE_CHECK); + break; + + case ACPI_HEST_TYPE_XPF_CORRECTED_MACHINE_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); + 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); + break; + + case ACPI_HEST_TYPE_AER_ROOT_PORT: + InfoTable = AcpiDmTableInfoHest6; + SubTableLength = sizeof (ACPI_HEST_AER_ROOT); + break; + + case ACPI_HEST_TYPE_AER_ENDPOINT: + InfoTable = AcpiDmTableInfoHest7; + SubTableLength = sizeof (ACPI_HEST_AER); + break; + + case ACPI_HEST_TYPE_AER_BRIDGE: + InfoTable = AcpiDmTableInfoHest8; + SubTableLength = sizeof (ACPI_HEST_AER_BRIDGE); + break; + + case ACPI_HEST_TYPE_GENERIC_HARDWARE_ERROR_SOURCE: + InfoTable = AcpiDmTableInfoHest9; + SubTableLength = sizeof (ACPI_HEST_GENERIC); + break; + + default: + /* Cannot continue on unknown type - no length */ + + AcpiOsPrintf ("\n**** Unknown HEST sub-table type %X\n", SubTable->Type); + return; + } + + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Length, Offset, SubTable, + SubTableLength, InfoTable); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Point to next sub-table (each subtable is of fixed length) */ + + Offset += SubTableLength; + SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, SubTable, SubTableLength); + } +} + + +/******************************************************************************* + * * FUNCTION: AcpiDmDumpMadt * * PARAMETERS: Table - A MADT table @@ -563,6 +839,7 @@ void AcpiDmDumpMadt ( ACPI_TABLE_HEADER *Table) { + ACPI_STATUS Status; ACPI_SUBTABLE_HEADER *SubTable; UINT32 Length = Table->Length; UINT32 Offset = sizeof (ACPI_TABLE_MADT); @@ -571,7 +848,11 @@ AcpiDmDumpMadt ( /* Main table */ - AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMadt); + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMadt); + if (ACPI_FAILURE (Status)) + { + return; + } /* Sub-tables */ @@ -581,7 +862,12 @@ AcpiDmDumpMadt ( /* Common sub-table header */ AcpiOsPrintf ("\n"); - AcpiDmDumpTable (Length, Offset, SubTable, 0, AcpiDmTableInfoMadtHdr); + Status = AcpiDmDumpTable (Length, Offset, SubTable, + SubTable->Length, AcpiDmTableInfoMadtHdr); + if (ACPI_FAILURE (Status)) + { + return; + } switch (SubTable->Type) { @@ -612,13 +898,33 @@ AcpiDmDumpMadt ( case ACPI_MADT_TYPE_INTERRUPT_SOURCE: InfoTable = AcpiDmTableInfoMadt8; break; + case ACPI_MADT_TYPE_LOCAL_X2APIC: + InfoTable = AcpiDmTableInfoMadt9; + break; + case ACPI_MADT_TYPE_LOCAL_X2APIC_NMI: + InfoTable = AcpiDmTableInfoMadt10; + break; default: AcpiOsPrintf ("\n**** Unknown MADT sub-table type %X\n\n", SubTable->Type); - return; + + /* Attempt to continue */ + + if (!SubTable->Length) + { + AcpiOsPrintf ("Invalid zero length subtable\n"); + return; + } + goto NextSubTable; } - AcpiDmDumpTable (Length, Offset, SubTable, SubTable->Length, InfoTable); + Status = AcpiDmDumpTable (Length, Offset, SubTable, + SubTable->Length, InfoTable); + if (ACPI_FAILURE (Status)) + { + return; + } +NextSubTable: /* Point to next sub-table */ Offset += SubTable->Length; @@ -643,13 +949,18 @@ void AcpiDmDumpMcfg ( ACPI_TABLE_HEADER *Table) { + ACPI_STATUS Status; UINT32 Offset = sizeof (ACPI_TABLE_MCFG); ACPI_MCFG_ALLOCATION *SubTable; /* Main table */ - AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMcfg); + Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMcfg); + if (ACPI_FAILURE (Status)) + { + return; + } /* Sub-tables */ @@ -664,7 +975,12 @@ AcpiDmDumpMcfg ( } AcpiOsPrintf ("\n"); - AcpiDmDumpTable (Table->Length, Offset, SubTable, 0, AcpiDmTableInfoMcfg0); + Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, + sizeof (ACPI_MCFG_ALLOCATION), AcpiDmTableInfoMcfg0); + if (ACPI_FAILURE (Status)) + { + return; + } /* Point to next sub-table (each subtable is of fixed length) */ @@ -691,6 +1007,7 @@ void AcpiDmDumpSlit ( ACPI_TABLE_HEADER *Table) { + ACPI_STATUS Status; UINT32 Offset; UINT8 *Row; UINT32 Localities; @@ -700,7 +1017,11 @@ AcpiDmDumpSlit ( /* Main table */ - AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSlit); + Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSlit); + if (ACPI_FAILURE (Status)) + { + return; + } /* Display the Locality NxN Matrix */ @@ -759,6 +1080,7 @@ void AcpiDmDumpSrat ( ACPI_TABLE_HEADER *Table) { + ACPI_STATUS Status; UINT32 Offset = sizeof (ACPI_TABLE_SRAT); ACPI_SUBTABLE_HEADER *SubTable; ACPI_DMTABLE_INFO *InfoTable; @@ -766,13 +1088,27 @@ AcpiDmDumpSrat ( /* Main table */ - AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSrat); + Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSrat); + if (ACPI_FAILURE (Status)) + { + return; + } /* Sub-tables */ SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset); while (Offset < Table->Length) { + /* Common sub-table header */ + + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, + SubTable->Length, AcpiDmTableInfoSratHdr); + if (ACPI_FAILURE (Status)) + { + return; + } + switch (SubTable->Type) { case ACPI_SRAT_TYPE_CPU_AFFINITY: @@ -781,14 +1117,31 @@ AcpiDmDumpSrat ( case ACPI_SRAT_TYPE_MEMORY_AFFINITY: InfoTable = AcpiDmTableInfoSrat1; break; + case ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY: + InfoTable = AcpiDmTableInfoSrat2; + break; default: AcpiOsPrintf ("\n**** Unknown SRAT sub-table type %X\n", SubTable->Type); - return; + + /* Attempt to continue */ + + if (!SubTable->Length) + { + AcpiOsPrintf ("Invalid zero length subtable\n"); + return; + } + goto NextSubTable; } AcpiOsPrintf ("\n"); - AcpiDmDumpTable (Table->Length, Offset, SubTable, SubTable->Length, InfoTable); + Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, + SubTable->Length, InfoTable); + if (ACPI_FAILURE (Status)) + { + return; + } +NextSubTable: /* Point to next sub-table */ Offset += SubTable->Length; diff --git a/sys/contrib/dev/acpica/common/dmtbinfo.c b/sys/contrib/dev/acpica/common/dmtbinfo.c index 5454005d83ee..3574a2a71131 100644 --- a/sys/contrib/dev/acpica/common/dmtbinfo.c +++ b/sys/contrib/dev/acpica/common/dmtbinfo.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: dmtbinfo - Table info for non-AML tables - * $Revision: 1.13 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -114,8 +113,9 @@ * *****************************************************************************/ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acdisasm.h> +#include "acpi.h" +#include "accommon.h" +#include "acdisasm.h" /* This module used for application-level code only */ @@ -130,10 +130,14 @@ #define ACPI_HDR_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_HEADER,f) #define ACPI_RSDP_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_RSDP,f) #define ACPI_BOOT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_BOOT,f) +#define ACPI_BERT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_BERT,f) #define ACPI_CPEP_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_CPEP,f) #define ACPI_DBGP_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_DBGP,f) #define ACPI_DMAR_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_DMAR,f) #define ACPI_ECDT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_ECDT,f) +#define ACPI_EINJ_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_EINJ,f) +#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_MADT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_MADT,f) #define ACPI_MCFG_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_MCFG,f) @@ -145,7 +149,7 @@ #define ACPI_TCPA_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_TCPA,f) #define ACPI_WDRT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_WDRT,f) -/* Sub-tables */ +/* Subtables */ #define ACPI_ASF0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_INFO,f) #define ACPI_ASF1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_ALERT,f) @@ -158,6 +162,18 @@ #define ACPI_DMARS_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_DMAR_DEVICE_SCOPE,f) #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_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_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_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) @@ -167,10 +183,14 @@ #define ACPI_MADT6_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_IO_SAPIC,f) #define ACPI_MADT7_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_LOCAL_SAPIC,f) #define ACPI_MADT8_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_INTERRUPT_SOURCE,f) +#define ACPI_MADT9_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_LOCAL_X2APIC,f) +#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_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) /* * Simplify access to flag fields by breaking them up into bytes @@ -184,6 +204,7 @@ #define ACPI_HPET_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_HPET,f,o) #define ACPI_SRAT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_SRAT_CPU_AFFINITY,f,o) #define ACPI_SRAT1_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_SRAT_MEM_AFFINITY,f,o) +#define ACPI_SRAT2_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_SRAT_X2APIC_CPU_AFFINITY,f,o) #define ACPI_MADT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_MADT,f,o) #define ACPI_MADT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_LOCAL_APIC,f,o) #define ACPI_MADT2_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_INTERRUPT_OVERRIDE,f,o) @@ -191,6 +212,8 @@ #define ACPI_MADT4_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_LOCAL_APIC_NMI,f,o) #define ACPI_MADT7_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_LOCAL_SAPIC,f,o) #define ACPI_MADT8_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_INTERRUPT_SOURCE,f,o) +#define ACPI_MADT9_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_LOCAL_X2APIC,f,o) +#define ACPI_MADT10_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_LOCAL_X2APIC_NMI,f,o) /* @@ -292,12 +315,14 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoFacs[] = * ******************************************************************************/ +/* ACPI 1.0 FADT (Version 1) */ + ACPI_DMTABLE_INFO AcpiDmTableInfoFadt1[] = { {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Facs), "FACS Address"}, {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Dsdt), "DSDT Address"}, {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Model), "Model"}, - {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (PreferredProfile), "PM Profile"}, + {ACPI_DMT_FADTPM, ACPI_FADT_OFFSET (PreferredProfile), "PM Profile"}, {ACPI_DMT_UINT16, ACPI_FADT_OFFSET (SciInterrupt), "SCI Interrupt"}, {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (SmiCommand), "SMI Command Port"}, {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (AcpiEnable), "ACPI Enable Value"}, @@ -329,46 +354,64 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoFadt1[] = {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (DayAlarm), "RTC Day Alarm Index"}, {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (MonthAlarm), "RTC Month Alarm Index"}, {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Century), "RTC Century Index"}, - {ACPI_DMT_UINT16, ACPI_FADT_OFFSET (BootFlags), "Boot Architecture Flags"}, + {ACPI_DMT_UINT16, ACPI_FADT_OFFSET (BootFlags), "Boot Flags (decoded below)"}, + + /* Boot Architecture Flags byte 0 */ + + {ACPI_DMT_FLAG0, ACPI_FADT_FLAG_OFFSET (BootFlags,0), "Legacy Devices Supported (V2)"}, + {ACPI_DMT_FLAG1, ACPI_FADT_FLAG_OFFSET (BootFlags,0), "8042 Present on ports 60/64 (V2)"}, + {ACPI_DMT_FLAG2, ACPI_FADT_FLAG_OFFSET (BootFlags,0), "VGA Not Present (V4)"}, + {ACPI_DMT_FLAG3, ACPI_FADT_FLAG_OFFSET (BootFlags,0), "MSI Not Supported (V4)"}, + {ACPI_DMT_FLAG4, ACPI_FADT_FLAG_OFFSET (BootFlags,0), "PCIe ASPM Not Supported (V4)"}, + {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Reserved), "Reserved"}, {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Flags), "Flags (decoded below)"}, /* Flags byte 0 */ - {ACPI_DMT_FLAG0, ACPI_FADT_FLAG_OFFSET (Flags,0), "WBINVD is operational"}, - {ACPI_DMT_FLAG1, ACPI_FADT_FLAG_OFFSET (Flags,0), "WBINVD does not invalidate"}, - {ACPI_DMT_FLAG2, ACPI_FADT_FLAG_OFFSET (Flags,0), "All CPUs support C1"}, - {ACPI_DMT_FLAG3, ACPI_FADT_FLAG_OFFSET (Flags,0), "C2 works on MP system"}, - {ACPI_DMT_FLAG4, ACPI_FADT_FLAG_OFFSET (Flags,0), "Power button is generic"}, - {ACPI_DMT_FLAG5, ACPI_FADT_FLAG_OFFSET (Flags,0), "Sleep button is generic"}, - {ACPI_DMT_FLAG6, ACPI_FADT_FLAG_OFFSET (Flags,0), "RTC wakeup not fixed"}, - {ACPI_DMT_FLAG7, ACPI_FADT_FLAG_OFFSET (Flags,0), "RTC wakeup/S4 not possible"}, + {ACPI_DMT_FLAG0, ACPI_FADT_FLAG_OFFSET (Flags,0), "WBINVD instruction is operational (V1)"}, + {ACPI_DMT_FLAG1, ACPI_FADT_FLAG_OFFSET (Flags,0), "WBINVD flushes all caches (V1)"}, + {ACPI_DMT_FLAG2, ACPI_FADT_FLAG_OFFSET (Flags,0), "All CPUs support C1 (V1)"}, + {ACPI_DMT_FLAG3, ACPI_FADT_FLAG_OFFSET (Flags,0), "C2 works on MP system (V1)"}, + {ACPI_DMT_FLAG4, ACPI_FADT_FLAG_OFFSET (Flags,0), "Control Method Power Button (V1)"}, + {ACPI_DMT_FLAG5, ACPI_FADT_FLAG_OFFSET (Flags,0), "Control Method Sleep Button (V1)"}, + {ACPI_DMT_FLAG6, ACPI_FADT_FLAG_OFFSET (Flags,0), "RTC wake not in fixed reg space (V1)"}, + {ACPI_DMT_FLAG7, ACPI_FADT_FLAG_OFFSET (Flags,0), "RTC can wake system from S4 (V1)"}, /* Flags byte 1 */ - {ACPI_DMT_FLAG0, ACPI_FADT_FLAG_OFFSET (Flags,1), "32-bit PM Timer"}, - {ACPI_DMT_FLAG1, ACPI_FADT_FLAG_OFFSET (Flags,1), "Docking Supported"}, + {ACPI_DMT_FLAG0, ACPI_FADT_FLAG_OFFSET (Flags,1), "32-bit PM Timer (V1)"}, + {ACPI_DMT_FLAG1, ACPI_FADT_FLAG_OFFSET (Flags,1), "Docking Supported (V1)"}, + {ACPI_DMT_FLAG2, ACPI_FADT_FLAG_OFFSET (Flags,1), "Reset Register Supported (V2)"}, + {ACPI_DMT_FLAG3, ACPI_FADT_FLAG_OFFSET (Flags,1), "Sealed Case (V3)"}, + {ACPI_DMT_FLAG4, ACPI_FADT_FLAG_OFFSET (Flags,1), "Headless - No Video (V3)"}, + {ACPI_DMT_FLAG5, ACPI_FADT_FLAG_OFFSET (Flags,1), "Use native instr after SLP_TYPx (V3)"}, + {ACPI_DMT_FLAG6, ACPI_FADT_FLAG_OFFSET (Flags,1), "PCIEXP_WAK Bits Supported (V4)"}, + {ACPI_DMT_FLAG7, ACPI_FADT_FLAG_OFFSET (Flags,1), "Use Platform Timer (V4)"}, + + /* Flags byte 2 */ + + {ACPI_DMT_FLAG0, ACPI_FADT_FLAG_OFFSET (Flags,2), "RTC_STS valid on S4 wake (V4)"}, + {ACPI_DMT_FLAG1, ACPI_FADT_FLAG_OFFSET (Flags,2), "Remote Power-on capable (V4)"}, + {ACPI_DMT_FLAG2, ACPI_FADT_FLAG_OFFSET (Flags,2), "Use APIC Cluster Model (V4)"}, + {ACPI_DMT_FLAG3, ACPI_FADT_FLAG_OFFSET (Flags,2), "Use APIC Physical Destination Mode (V4)"}, {ACPI_DMT_EXIT, 0, NULL} }; -/* ACPI 2.0+ Extensions */ +/* ACPI 1.0 MS Extensions (FADT version 2) */ ACPI_DMTABLE_INFO AcpiDmTableInfoFadt2[] = { - {ACPI_DMT_FLAG2, ACPI_FADT_FLAG_OFFSET (Flags,1), "Reset Register Supported"}, - {ACPI_DMT_FLAG3, ACPI_FADT_FLAG_OFFSET (Flags,1), "Sealed Case"}, - {ACPI_DMT_FLAG4, ACPI_FADT_FLAG_OFFSET (Flags,1), "Headless - No Video"}, - {ACPI_DMT_FLAG5, ACPI_FADT_FLAG_OFFSET (Flags,1), "Native instr after SLP_TYP"}, - {ACPI_DMT_FLAG6, ACPI_FADT_FLAG_OFFSET (Flags,1), "PCIEXP_WAK Supported"}, - {ACPI_DMT_FLAG7, ACPI_FADT_FLAG_OFFSET (Flags,1), "Use Platform Timer"}, - - /* Flags byte 2 */ + {ACPI_DMT_GAS, ACPI_FADT_OFFSET (ResetRegister), "Reset Register"}, + {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (ResetValue), "Value to cause reset"}, + {ACPI_DMT_UINT24, ACPI_FADT_OFFSET (Reserved4[0]), "Reserved"}, + {ACPI_DMT_EXIT, 0, NULL} +}; - {ACPI_DMT_FLAG0, ACPI_FADT_FLAG_OFFSET (Flags,2), "RTC_STS valid after S4"}, - {ACPI_DMT_FLAG1, ACPI_FADT_FLAG_OFFSET (Flags,2), "Remote Power-on capable"}, - {ACPI_DMT_FLAG2, ACPI_FADT_FLAG_OFFSET (Flags,2), "APIC Cluster Model"}, - {ACPI_DMT_FLAG3, ACPI_FADT_FLAG_OFFSET (Flags,2), "APIC Physical Dest Mode"}, +/* ACPI 2.0+ Extensions (FADT version 3+) */ +ACPI_DMTABLE_INFO AcpiDmTableInfoFadt3[] = +{ {ACPI_DMT_GAS, ACPI_FADT_OFFSET (ResetRegister), "Reset Register"}, {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (ResetValue), "Value to cause reset"}, {ACPI_DMT_UINT24, ACPI_FADT_OFFSET (Reserved4[0]), "Reserved"}, @@ -396,11 +439,11 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoFadt2[] = * ******************************************************************************/ -/* Common sub-table header (one per sub-table) */ +/* Common Subtable header (one per Subtable) */ ACPI_DMTABLE_INFO AcpiDmTableInfoAsfHdr[] = { - {ACPI_DMT_UINT8, ACPI_ASF0_OFFSET (Header.Type), "Sub-Table Type"}, + {ACPI_DMT_ASF, ACPI_ASF0_OFFSET (Header.Type), "Subtable Type"}, {ACPI_DMT_UINT8, ACPI_ASF0_OFFSET (Header.Reserved), "Reserved"}, {ACPI_DMT_UINT16, ACPI_ASF0_OFFSET (Header.Length), "Length"}, {ACPI_DMT_EXIT, 0, NULL} @@ -496,6 +539,20 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoAsf4[] = /******************************************************************************* * + * BERT - Boot Error Record table + * + ******************************************************************************/ + +ACPI_DMTABLE_INFO AcpiDmTableInfoBert[] = +{ + {ACPI_DMT_UINT32, ACPI_BERT_OFFSET (RegionLength), "Boot Error Region Length"}, + {ACPI_DMT_UINT64, ACPI_BERT_OFFSET (Address), "Boot Error Region Address"}, + {ACPI_DMT_EXIT, 0, NULL} +}; + + +/******************************************************************************* + * * BOOT - Simple Boot Flag Table * ******************************************************************************/ @@ -522,7 +579,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoCpep[] = ACPI_DMTABLE_INFO AcpiDmTableInfoCpep0[] = { - {ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Type), "Sub-Table Type"}, + {ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Type), "Subtable Type"}, {ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Length), "Length"}, {ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Id), "Processor ID"}, {ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Eid), "Processor EID"}, @@ -555,17 +612,16 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoDbgp[] = ACPI_DMTABLE_INFO AcpiDmTableInfoDmar[] = { {ACPI_DMT_UINT8, ACPI_DMAR_OFFSET (Width), "Host Address Width"}, + {ACPI_DMT_UINT8, ACPI_DMAR_OFFSET (Flags), "Flags"}, {ACPI_DMT_EXIT, 0, NULL} }; -/* Common sub-table header (one per sub-table) */ +/* Common Subtable header (one per Subtable) */ ACPI_DMTABLE_INFO AcpiDmTableInfoDmarHdr[] = { - {ACPI_DMT_DMAR, ACPI_DMAR0_OFFSET (Header.Type), "Sub-Table Type"}, + {ACPI_DMT_DMAR, ACPI_DMAR0_OFFSET (Header.Type), "Subtable Type"}, {ACPI_DMT_UINT16, ACPI_DMAR0_OFFSET (Header.Length), "Length"}, - {ACPI_DMT_UINT8, ACPI_DMAR0_OFFSET (Header.Flags), "Flags"}, - {ACPI_DMT_UINT24, ACPI_DMAR0_OFFSET (Header.Reserved[0]), "Reserved"}, {ACPI_DMT_EXIT, 0, NULL} }; @@ -575,30 +631,46 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoDmarScope[] = { {ACPI_DMT_UINT8, ACPI_DMARS_OFFSET (EntryType), "Device Scope Entry Type"}, {ACPI_DMT_UINT8, ACPI_DMARS_OFFSET (Length), "Entry Length"}, - {ACPI_DMT_UINT8, ACPI_DMARS_OFFSET (Segment), "PCI Segment Number"}, + {ACPI_DMT_UINT16, ACPI_DMARS_OFFSET (Reserved), "Reserved"}, + {ACPI_DMT_UINT8, ACPI_DMARS_OFFSET (EnumerationId), "Enumeration ID"}, {ACPI_DMT_UINT8, ACPI_DMARS_OFFSET (Bus), "PCI Bus Number"}, {ACPI_DMT_EXIT, 0, NULL} }; -/* DMAR sub-tables */ +/* DMAR Subtables */ /* 0: Hardware Unit Definition */ ACPI_DMTABLE_INFO AcpiDmTableInfoDmar0[] = { + {ACPI_DMT_UINT8, ACPI_DMAR0_OFFSET (Flags), "Flags"}, + {ACPI_DMT_UINT8, ACPI_DMAR0_OFFSET (Reserved), "Reserved"}, + {ACPI_DMT_UINT16, ACPI_DMAR0_OFFSET (Segment), "PCI Segment Number"}, {ACPI_DMT_UINT64, ACPI_DMAR0_OFFSET (Address), "Register Base Address"}, {ACPI_DMT_EXIT, 0, NULL} }; -/* 1: Reserved Memory Defininition */ +/* 1: Reserved Memory Definition */ ACPI_DMTABLE_INFO AcpiDmTableInfoDmar1[] = { - {ACPI_DMT_UINT64, ACPI_DMAR1_OFFSET (Address), "Base Address"}, + {ACPI_DMT_UINT16, ACPI_DMAR1_OFFSET (Reserved), "Reserved"}, + {ACPI_DMT_UINT16, ACPI_DMAR1_OFFSET (Segment), "PCI Segment Number"}, + {ACPI_DMT_UINT64, ACPI_DMAR1_OFFSET (BaseAddress), "Base Address"}, {ACPI_DMT_UINT64, ACPI_DMAR1_OFFSET (EndAddress), "End Address (limit)"}, {ACPI_DMT_EXIT, 0, NULL} }; +/* 2: Root Port ATS Capability Definition */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoDmar2[] = +{ + {ACPI_DMT_UINT8, ACPI_DMAR2_OFFSET (Flags), "Flags"}, + {ACPI_DMT_UINT8, ACPI_DMAR2_OFFSET (Reserved), "Reserved"}, + {ACPI_DMT_UINT16, ACPI_DMAR2_OFFSET (Segment), "PCI Segment Number"}, + {ACPI_DMT_EXIT, 0, NULL} +}; + /******************************************************************************* * @@ -619,6 +691,236 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoEcdt[] = /******************************************************************************* * + * EINJ - Error Injection table + * + ******************************************************************************/ + +ACPI_DMTABLE_INFO AcpiDmTableInfoEinj[] = +{ + {ACPI_DMT_UINT32, ACPI_EINJ_OFFSET (HeaderLength), "Injection Header Length"}, + {ACPI_DMT_UINT32, ACPI_EINJ_OFFSET (Reserved), "Reserved"}, + {ACPI_DMT_UINT32, ACPI_EINJ_OFFSET (Entries), "Injection Entry Count"}, + {ACPI_DMT_EXIT, 0, NULL} +}; + +ACPI_DMTABLE_INFO AcpiDmTableInfoEinj0[] = +{ + {ACPI_DMT_UINT8, ACPI_EINJ0_OFFSET (Action), "Action"}, + {ACPI_DMT_UINT8, ACPI_EINJ0_OFFSET (Instruction), "Instruction"}, + {ACPI_DMT_UINT8, ACPI_EINJ0_OFFSET (Flags), "Flags"}, + {ACPI_DMT_UINT8, ACPI_EINJ0_OFFSET (Reserved), "Reserved"}, + {ACPI_DMT_GAS, ACPI_EINJ0_OFFSET (RegisterRegion), "Register Region"}, + {ACPI_DMT_UINT64, ACPI_EINJ0_OFFSET (Value), "Value"}, + {ACPI_DMT_UINT64, ACPI_EINJ0_OFFSET (Mask), "Mask"}, + {ACPI_DMT_EXIT, 0, NULL} +}; + + +/******************************************************************************* + * + * ERST - Error Record Serialization table + * + ******************************************************************************/ + +ACPI_DMTABLE_INFO AcpiDmTableInfoErst[] = +{ + {ACPI_DMT_UINT32, ACPI_ERST_OFFSET (HeaderLength), "Serialization Header Length"}, + {ACPI_DMT_UINT32, ACPI_ERST_OFFSET (Reserved), "Reserved"}, + {ACPI_DMT_UINT32, ACPI_ERST_OFFSET (Entries), "Instruction Entry Count"}, + {ACPI_DMT_EXIT, 0, NULL} +}; + + +/******************************************************************************* + * + * HEST - Hardware Error Source table + * + ******************************************************************************/ + +ACPI_DMTABLE_INFO AcpiDmTableInfoHest[] = +{ + {ACPI_DMT_UINT32, ACPI_HEST_OFFSET (ErrorSourceCount), "Error Source Count"}, + {ACPI_DMT_EXIT, 0, NULL} +}; + +/* HEST Subtables */ + +/* 0: XPF 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_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_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_EXIT, 0, NULL} +}; + +/* 1: XPF 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_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 (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_EXIT, 0, NULL} +}; + +/* 4: IPF Corrected Machine Check */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoHest4[] = +{ + {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_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_DMT_EXIT, 0, NULL} +}; + +/* 7: PCI Express AER (AER Endpoint) */ + +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_DMT_EXIT, 0, NULL} +}; + +/* 8: PCI Express/PCI-X Bridge AER */ + +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_DMT_EXIT, 0, NULL} +}; + +/* 9: Generic Hardware Error Source */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoHest9[] = +{ + {ACPI_DMT_HEST, ACPI_HEST9_OFFSET (Header.Type), "Subtable Type"}, + {ACPI_DMT_UINT16, ACPI_HEST9_OFFSET (SourceId), "Source Id"}, + {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 (Enabled), "Enabled"}, + {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_EXIT, 0, NULL} +}; + +ACPI_DMTABLE_INFO AcpiDmTableInfoHestNotify[10] = +{ + {ACPI_DMT_HESTNTYP, ACPI_HESTN_OFFSET (Type), "Notify Type"}, + {ACPI_DMT_UINT8, ACPI_HESTN_OFFSET (Length), "Notify Length"}, + {ACPI_DMT_UINT16, ACPI_HESTN_OFFSET (ConfigWriteEnable), "Configuration Write Enable"}, + {ACPI_DMT_UINT32, ACPI_HESTN_OFFSET (PollInterval), "PollInterval"}, + {ACPI_DMT_UINT32, ACPI_HESTN_OFFSET (Vector), "Vector"}, + {ACPI_DMT_UINT32, ACPI_HESTN_OFFSET (PollingThresholdValue), "Polling Threshold Value"}, + {ACPI_DMT_UINT32, ACPI_HESTN_OFFSET (PollingThresholdWindow), "Polling Threshold Window"}, + {ACPI_DMT_UINT32, ACPI_HESTN_OFFSET (ErrorThresholdValue), "Error Threshold Value"}, + {ACPI_DMT_UINT32, ACPI_HESTN_OFFSET (ErrorThresholdWindow), "Error Threshold Window"}, + {ACPI_DMT_EXIT, 0, NULL} +}; + + +/******************************************************************************* + * * HPET - High Precision Event Timer table * ******************************************************************************/ @@ -651,16 +953,16 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt[] = {ACPI_DMT_EXIT, 0, NULL} }; -/* Common sub-table header (one per sub-table) */ +/* Common Subtable header (one per Subtable) */ ACPI_DMTABLE_INFO AcpiDmTableInfoMadtHdr[] = { - {ACPI_DMT_MADT, ACPI_MADTH_OFFSET (Type), "Sub-Table Type"}, + {ACPI_DMT_MADT, ACPI_MADTH_OFFSET (Type), "Subtable Type"}, {ACPI_DMT_UINT8, ACPI_MADTH_OFFSET (Length), "Length"}, {ACPI_DMT_EXIT, 0, NULL} }; -/* MADT sub-tables */ +/* MADT Subtables */ /* 0: processor APIC */ @@ -772,10 +1074,35 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt8[] = {ACPI_DMT_EXIT, 0, NULL} }; +/* 9: Processor Local X2_APIC (07/2008) */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoMadt9[] = +{ + {ACPI_DMT_UINT16, ACPI_MADT9_OFFSET (Reserved), "Reserved"}, + {ACPI_DMT_UINT32, ACPI_MADT9_OFFSET (LocalApicId), "Processor x2Apic ID"}, + {ACPI_DMT_UINT32, ACPI_MADT9_OFFSET (LapicFlags), "Flags (decoded below)"}, + {ACPI_DMT_FLAG0, ACPI_MADT9_FLAG_OFFSET (LapicFlags,0), "Processor Enabled"}, + {ACPI_DMT_UINT32, ACPI_MADT9_OFFSET (Uid), "Processor UID"}, + {ACPI_DMT_EXIT, 0, NULL} +}; + +/* 10: Local X2_APIC NMI (07/2008) */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoMadt10[] = +{ + {ACPI_DMT_UINT16, ACPI_MADT10_OFFSET (IntiFlags), "Flags (decoded below)"}, + {ACPI_DMT_FLAGS0, ACPI_MADT10_FLAG_OFFSET (IntiFlags,0), "Polarity"}, + {ACPI_DMT_FLAGS2, ACPI_MADT10_FLAG_OFFSET (IntiFlags,0), "Trigger Mode"}, + {ACPI_DMT_UINT32, ACPI_MADT10_OFFSET (Uid), "Processor UID"}, + {ACPI_DMT_UINT8, ACPI_MADT10_OFFSET (Lint), "Interrupt Input LINT"}, + {ACPI_DMT_UINT24, ACPI_MADT10_OFFSET (Reserved[0]), "Reserved"}, + {ACPI_DMT_EXIT, 0, NULL} +}; + /******************************************************************************* * - * MCFG - PCI Memory Mapped Configuration table and sub-table + * MCFG - PCI Memory Mapped Configuration table and Subtable * ******************************************************************************/ @@ -813,6 +1140,18 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoSbst[] = /******************************************************************************* * + * SLIC - Software Licensing Description Table. NOT FULLY IMPLEMENTED + * + ******************************************************************************/ + +ACPI_DMTABLE_INFO AcpiDmTableInfoSlic[] = +{ + {ACPI_DMT_EXIT, 0, NULL} +}; + + +/******************************************************************************* + * * SLIT - System Locality Information Table * ******************************************************************************/ @@ -883,7 +1222,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoSpmi[] = /******************************************************************************* * - * SRAT - System Resource Affinity Table and sub-tables + * SRAT - System Resource Affinity Table and Subtables * ******************************************************************************/ @@ -894,10 +1233,21 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoSrat[] = {ACPI_DMT_EXIT, 0, NULL} }; +/* Common Subtable header (one per Subtable) */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoSratHdr[] = +{ + {ACPI_DMT_SRAT, ACPI_SRATH_OFFSET (Type), "Subtable Type"}, + {ACPI_DMT_UINT8, ACPI_SRATH_OFFSET (Length), "Length"}, + {ACPI_DMT_EXIT, 0, NULL} +}; + +/* SRAT Subtables */ + +/* 0: Processor Local APIC/SAPIC Affinity */ + ACPI_DMTABLE_INFO AcpiDmTableInfoSrat0[] = { - {ACPI_DMT_SRAT, ACPI_SRAT0_OFFSET (Header.Type), "Sub-Table Type"}, - {ACPI_DMT_UINT8, ACPI_SRAT0_OFFSET (Header.Length), "Length"}, {ACPI_DMT_UINT8, ACPI_SRAT0_OFFSET (ProximityDomainLo), "Proximity Domain Low(8)"}, {ACPI_DMT_UINT8, ACPI_SRAT0_OFFSET (ApicId), "Apic ID"}, {ACPI_DMT_UINT32, ACPI_SRAT0_OFFSET (Flags), "Flags (decoded below)"}, @@ -908,20 +1258,32 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoSrat0[] = {ACPI_DMT_EXIT, 0, NULL} }; +/* 1: Memory Affinity */ + ACPI_DMTABLE_INFO AcpiDmTableInfoSrat1[] = { - {ACPI_DMT_SRAT, ACPI_SRAT1_OFFSET (Header.Type), "Sub-Table Type"}, - {ACPI_DMT_UINT8, ACPI_SRAT1_OFFSET (Header.Length), "Length"}, {ACPI_DMT_UINT32, ACPI_SRAT1_OFFSET (ProximityDomain), "Proximity Domain"}, {ACPI_DMT_UINT16, ACPI_SRAT1_OFFSET (Reserved), "Reserved"}, {ACPI_DMT_UINT64, ACPI_SRAT1_OFFSET (BaseAddress), "Base Address"}, {ACPI_DMT_UINT64, ACPI_SRAT1_OFFSET (Length), "Address Length"}, - {ACPI_DMT_UINT32, ACPI_SRAT1_OFFSET (MemoryType), "Memory Type"}, + {ACPI_DMT_UINT32, ACPI_SRAT1_OFFSET (Reserved1), "Reserved"}, {ACPI_DMT_UINT32, ACPI_SRAT1_OFFSET (Flags), "Flags (decoded below)"}, {ACPI_DMT_FLAG0, ACPI_SRAT1_FLAG_OFFSET (Flags,0), "Enabled"}, {ACPI_DMT_FLAG1, ACPI_SRAT1_FLAG_OFFSET (Flags,0), "Hot Pluggable"}, {ACPI_DMT_FLAG2, ACPI_SRAT1_FLAG_OFFSET (Flags,0), "Non-Volatile"}, - {ACPI_DMT_UINT64, ACPI_SRAT1_OFFSET (Reserved1), "Reserved"}, + {ACPI_DMT_UINT64, ACPI_SRAT1_OFFSET (Reserved2), "Reserved"}, + {ACPI_DMT_EXIT, 0, NULL} +}; + +/* 2: Processor Local X2_APIC Affinity (07/2008) */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoSrat2[] = +{ + {ACPI_DMT_UINT16, ACPI_SRAT2_OFFSET (Reserved), "Reserved"}, + {ACPI_DMT_UINT32, ACPI_SRAT2_OFFSET (ProximityDomain), "Proximity Domain"}, + {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_EXIT, 0, NULL} }; diff --git a/sys/contrib/dev/acpica/common/getopt.c b/sys/contrib/dev/acpica/common/getopt.c index 2c6157596f51..54cff3ec2db4 100644 --- a/sys/contrib/dev/acpica/common/getopt.c +++ b/sys/contrib/dev/acpica/common/getopt.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: getopt - * $Revision: 1.10 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -118,6 +117,9 @@ #include <stdio.h> #include <string.h> +#include "acpi.h" +#include "accommon.h" +#include "acapps.h" #define ERR(szz,czz) if(AcpiGbl_Opterr){fprintf(stderr,"%s%s%c\n",argv[0],szz,czz);} diff --git a/sys/contrib/dev/acpica/compiler/aslanalyze.c b/sys/contrib/dev/acpica/compiler/aslanalyze.c index 93f2f0bdbe73..d44adda8ff00 100644 --- a/sys/contrib/dev/acpica/compiler/aslanalyze.c +++ b/sys/contrib/dev/acpica/compiler/aslanalyze.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: aslanalyze.c - check for semantic errors - * $Revision: 1.115 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,12 +115,10 @@ *****************************************************************************/ -#include <contrib/dev/acpica/compiler/aslcompiler.h> +#include "aslcompiler.h" #include "aslcompiler.y.h" -#include <contrib/dev/acpica/acparser.h> -#include <contrib/dev/acpica/amlcode.h> - -#include <ctype.h> +#include "acparser.h" +#include "amlcode.h" #define _COMPONENT ACPI_COMPILER ACPI_MODULE_NAME ("aslanalyze") @@ -179,6 +176,10 @@ static UINT32 AnGetInternalMethodReturnType ( ACPI_PARSE_OBJECT *Op); +BOOLEAN +AnIsResultUsed ( + ACPI_PARSE_OBJECT *Op); + /******************************************************************************* * @@ -272,7 +273,11 @@ AnMapArgTypeToBtype ( return (ACPI_BTYPE_MUTEX); case ARGI_DDBHANDLE: - return (ACPI_BTYPE_DDB_HANDLE); + /* + * DDBHandleObject := SuperName + * ACPI_BTYPE_REFERENCE: Index reference as parameter of Load/Unload + */ + return (ACPI_BTYPE_DDB_HANDLE | ACPI_BTYPE_REFERENCE); /* Interchangeable types */ /* @@ -682,7 +687,15 @@ AnCheckForReservedName ( return (ACPI_NOT_RESERVED_NAME); } - AslError (ASL_ERROR, ASL_MSG_RESERVED_WORD, Op, Op->Asl.ExternalName); + /* + * Was not actually emitted by the compiler. This is a special case, + * however. If the ASL code being compiled was the result of a + * dissasembly, it may possibly contain valid compiler-emitted names + * of the form "_T_x". We don't want to issue an error or even a + * warning and force the user to manually change the names. So, we + * will issue a remark instead. + */ + AslError (ASL_REMARK, ASL_MSG_COMPILER_RESERVED, Op, Op->Asl.ExternalName); return (ACPI_COMPILER_RESERVED_NAME); } @@ -718,6 +731,8 @@ AnCheckForReservedMethod ( ASL_METHOD_INFO *MethodInfo) { UINT32 Index; + UINT32 RequiredArgsCurrent; + UINT32 RequiredArgsOld; /* Check for a match against the reserved name list */ @@ -754,15 +769,23 @@ AnCheckForReservedMethod ( Gbl_ReservedMethods++; - /* Matched a reserved method name */ + /* + * Matched a reserved method name + * + * Validate the ASL-defined argument count. Allow two different legal + * arg counts. + */ + RequiredArgsCurrent = ReservedMethods[Index].NumArguments & 0x0F; + RequiredArgsOld = ReservedMethods[Index].NumArguments >> 4; - if (MethodInfo->NumArguments != ReservedMethods[Index].NumArguments) + if ((MethodInfo->NumArguments != RequiredArgsCurrent) && + (MethodInfo->NumArguments != RequiredArgsOld)) { sprintf (MsgBuffer, "%s requires %d", ReservedMethods[Index].Name, - ReservedMethods[Index].NumArguments); + RequiredArgsCurrent); - if (MethodInfo->NumArguments > ReservedMethods[Index].NumArguments) + if (MethodInfo->NumArguments > RequiredArgsCurrent) { AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_HI, Op, MsgBuffer); @@ -956,9 +979,9 @@ AnMethodAnalysisWalkBegin ( MethodInfo->ValidArgTypes[ActualArgs] = AnMapObjTypeToBtype (NextType); NextType->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; + ActualArgs++; } - ActualArgs++; NextType = NextType->Asl.Next; } @@ -1010,10 +1033,10 @@ AnMethodAnalysisWalkBegin ( if (!MethodInfo) { /* - * Probably was an error in the method declaration, - * no additional error here + * Local was used outside a control method, or there was an error + * in the method declaration. */ - ACPI_WARNING ((AE_INFO, "%p, No parent method", Op)); + AslError (ASL_REMARK, ASL_MSG_LOCAL_OUTSIDE_METHOD, Op, Op->Asl.ExternalName); return (AE_ERROR); } @@ -1054,10 +1077,10 @@ AnMethodAnalysisWalkBegin ( if (!MethodInfo) { /* - * Probably was an error in the method declaration, - * no additional error here + * Arg was used outside a control method, or there was an error + * in the method declaration. */ - ACPI_WARNING ((AE_INFO, "%p, No parent method", Op)); + AslError (ASL_REMARK, ASL_MSG_LOCAL_OUTSIDE_METHOD, Op, Op->Asl.ExternalName); return (AE_ERROR); } @@ -1705,6 +1728,30 @@ AnOperandTypecheckWalkEnd ( RuntimeArgTypes = OpInfo->RuntimeArgs; OpcodeClass = OpInfo->Class; +#ifdef ASL_ERROR_NAMED_OBJECT_IN_WHILE + /* + * Update 11/2008: In practice, we can't perform this check. A simple + * analysis is not sufficient. Also, it can cause errors when compiling + * disassembled code because of the way Switch operators are implemented + * (a While(One) loop with a named temp variable created within.) + */ + + /* + * If we are creating a named object, check if we are within a while loop + * by checking if the parent is a WHILE op. This is a simple analysis, but + * probably sufficient for many cases. + * + * Allow Scope(), Buffer(), and Package(). + */ + if (((OpcodeClass == AML_CLASS_NAMED_OBJECT) && (Op->Asl.AmlOpcode != AML_SCOPE_OP)) || + ((OpcodeClass == AML_CLASS_CREATE) && (OpInfo->Flags & AML_NSNODE))) + { + if (Op->Asl.Parent->Asl.AmlOpcode == AML_WHILE_OP) + { + AslError (ASL_ERROR, ASL_MSG_NAMED_OBJECT_IN_WHILE, Op, NULL); + } + } +#endif /* * Special case for control opcodes IF/RETURN/WHILE since they @@ -2074,6 +2121,7 @@ AnOtherSemanticAnalysisWalkBegin ( { case PARSEOP_ACQUIRE: case PARSEOP_WAIT: + case PARSEOP_LOADTABLE: break; default: diff --git a/sys/contrib/dev/acpica/compiler/aslcodegen.c b/sys/contrib/dev/acpica/compiler/aslcodegen.c index 25ee7290ed89..af3f292e3f23 100644 --- a/sys/contrib/dev/acpica/compiler/aslcodegen.c +++ b/sys/contrib/dev/acpica/compiler/aslcodegen.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: aslcodegen - AML code generation - * $Revision: 1.62 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,9 +115,9 @@ *****************************************************************************/ -#include <contrib/dev/acpica/compiler/aslcompiler.h> +#include "aslcompiler.h" #include "aslcompiler.y.h" -#include <contrib/dev/acpica/amlcode.h> +#include "amlcode.h" #define _COMPONENT ACPI_COMPILER ACPI_MODULE_NAME ("aslcodegen") @@ -235,24 +234,24 @@ CgAmlWriteWalk ( DbgPrint (ASL_TREE_OUTPUT, " "); } - DbgPrint (ASL_TREE_OUTPUT, - "%08X %04X %04X %01X %04X %04X %04X %04X %08X %08X %08X %08X %08X %04X %02d %02d\n", - /* 1 */ (UINT32) Op->Asl.Value.Integer, - /* 2 */ Op->Asl.ParseOpcode, - /* 3 */ Op->Asl.AmlOpcode, - /* 4 */ Op->Asl.AmlOpcodeLength, - /* 5 */ Op->Asl.AmlPkgLenBytes, - /* 6 */ Op->Asl.AmlLength, - /* 7 */ Op->Asl.AmlSubtreeLength, - /* 8 */ Op->Asl.Parent ? Op->Asl.Parent->Asl.AmlSubtreeLength : 0, - /* 9 */ Op, - /* 10 */ Op->Asl.Child, - /* 11 */ Op->Asl.Parent, - /* 12 */ Op->Asl.CompileFlags, - /* 13 */ Op->Asl.AcpiBtype, - /* 14 */ Op->Asl.FinalAmlLength, - /* 15 */ Op->Asl.Column, - /* 16 */ Op->Asl.LineNumber); + DbgPrint (ASL_TREE_OUTPUT, + "%08X %04X %04X %01X %04X %04X %04X %04X %08X %08X %08X %08X %08X %04X %02d %02d\n", + /* 1 */ (UINT32) Op->Asl.Value.Integer, + /* 2 */ Op->Asl.ParseOpcode, + /* 3 */ Op->Asl.AmlOpcode, + /* 4 */ Op->Asl.AmlOpcodeLength, + /* 5 */ Op->Asl.AmlPkgLenBytes, + /* 6 */ Op->Asl.AmlLength, + /* 7 */ Op->Asl.AmlSubtreeLength, + /* 8 */ Op->Asl.Parent ? Op->Asl.Parent->Asl.AmlSubtreeLength : 0, + /* 9 */ Op, + /* 10 */ Op->Asl.Child, + /* 11 */ Op->Asl.Parent, + /* 12 */ Op->Asl.CompileFlags, + /* 13 */ Op->Asl.AcpiBtype, + /* 14 */ Op->Asl.FinalAmlLength, + /* 15 */ Op->Asl.Column, + /* 16 */ Op->Asl.LineNumber); /* Generate the AML for this node */ diff --git a/sys/contrib/dev/acpica/compiler/aslcompile.c b/sys/contrib/dev/acpica/compiler/aslcompile.c index eba35527d2c4..07de1fe63c9b 100644 --- a/sys/contrib/dev/acpica/compiler/aslcompile.c +++ b/sys/contrib/dev/acpica/compiler/aslcompile.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: aslcompile - top level compile module - * $Revision: 1.97 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,7 +116,7 @@ #include <stdio.h> #include <time.h> -#include <contrib/dev/acpica/compiler/aslcompiler.h> +#include "aslcompiler.h" #define _COMPONENT ACPI_COMPILER ACPI_MODULE_NAME ("aslcompile") @@ -132,6 +131,16 @@ static ACPI_STATUS FlCheckForAscii ( ASL_FILE_INFO *FileInfo); +void +FlConsumeAnsiComment ( + ASL_FILE_INFO *FileInfo, + ASL_FILE_STATUS *Status); + +void +FlConsumeNewComment ( + ASL_FILE_INFO *FileInfo, + ASL_FILE_STATUS *Status); + /******************************************************************************* * @@ -466,7 +475,7 @@ FlCheckForAscii ( /* Check for an ASCII character */ - if (!isascii (Byte)) + if (!ACPI_IS_ASCII (Byte)) { if (BadBytes < 10) { @@ -914,16 +923,6 @@ CmCleanupAndExit ( } UtDisplaySummary (ASL_FILE_STDOUT); - - /* - * Return non-zero exit code if there have been errors, unless the - * global ignore error flag has been set - */ - if ((Gbl_ExceptionCount[ASL_ERROR] > 0) && (!Gbl_IgnoreErrors)) - { - exit (1); - } - exit (0); } diff --git a/sys/contrib/dev/acpica/compiler/aslcompiler.h b/sys/contrib/dev/acpica/compiler/aslcompiler.h index 64776655ea6b..54162a7c5e7d 100644 --- a/sys/contrib/dev/acpica/compiler/aslcompiler.h +++ b/sys/contrib/dev/acpica/compiler/aslcompiler.h @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: aslcompiler.h - common include file for iASL - * $Revision: 1.148 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -139,15 +138,16 @@ #include <ctype.h> -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/amlresrc.h> -#include <contrib/dev/acpica/acdebug.h> +#include "acpi.h" +#include "accommon.h" +#include "amlresrc.h" +#include "acdebug.h" /* Compiler headers */ -#include <contrib/dev/acpica/compiler/asldefine.h> -#include <contrib/dev/acpica/compiler/asltypes.h> -#include <contrib/dev/acpica/compiler/aslglobal.h> +#include "asldefine.h" +#include "asltypes.h" +#include "aslglobal.h" /******************************************************************************* @@ -188,6 +188,16 @@ AslPushInputFileStack ( FILE *InputFile, char *Filename); +/* + * aslstartup - called from main + */ +ACPI_STATUS +AslDoOnePathname ( + char *Pathname); + +ACPI_STATUS +AslDoOneFile ( + char *Filename); /* * aslcompile - compile mainline @@ -307,6 +317,10 @@ void AePrintErrorLog ( UINT32 FileId); +void +AeClearErrorLog ( + void); + ACPI_PHYSICAL_ADDRESS AeLocalGetRootPointer ( void); diff --git a/sys/contrib/dev/acpica/compiler/aslcompiler.l b/sys/contrib/dev/acpica/compiler/aslcompiler.l index 78be4eae638c..3a52348c49f6 100644 --- a/sys/contrib/dev/acpica/compiler/aslcompiler.l +++ b/sys/contrib/dev/acpica/compiler/aslcompiler.l @@ -3,7 +3,6 @@ /****************************************************************************** * * Module Name: aslcompiler.l - Flex input file - * $Revision: 1.79 $ * *****************************************************************************/ @@ -11,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -119,7 +118,7 @@ #include <stdlib.h> #include <string.h> -#include <contrib/dev/acpica/compiler/aslcompiler.h> +#include "aslcompiler.h" #include "aslcompiler.y.h" YYSTYPE AslCompilerlval; @@ -169,7 +168,8 @@ NamePathTail [.]{NameSeg} %% [ ] { count (0); } -[\n] { count (0); } +[\n] { count (0); } /* Handle files with both LF and CR/LF */ +[\r] { count (0); } /* termination on both Unix and Windows */ [ \t] { count (0); } diff --git a/sys/contrib/dev/acpica/compiler/aslcompiler.y b/sys/contrib/dev/acpica/compiler/aslcompiler.y index 0b33d38a3f9f..053574f21b4a 100644 --- a/sys/contrib/dev/acpica/compiler/aslcompiler.y +++ b/sys/contrib/dev/acpica/compiler/aslcompiler.y @@ -3,7 +3,6 @@ /****************************************************************************** * * Module Name: aslcompiler.y - Bison input file (ASL grammar and actions) - * $Revision: 1.105 $ * *****************************************************************************/ @@ -11,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -124,11 +123,12 @@ */ #define YYINITDEPTH 600 -#include <contrib/dev/acpica/compiler/aslcompiler.h> +#include "aslcompiler.h" #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <contrib/dev/acpica/acpi.h> +#include "acpi.h" +#include "accommon.h" #define _COMPONENT ACPI_COMPILER ACPI_MODULE_NAME ("aslparse") @@ -188,10 +188,10 @@ AslLocalAllocate (unsigned int Size); /*! [Begin] no source code translation */ /* - * These shift/reduce conflicts are expected. There should be zer0 + * These shift/reduce conflicts are expected. There should be zero * reduce/reduce conflicts. */ -%expect 64 +%expect 60 /* @@ -794,7 +794,7 @@ ASLCode ; DefinitionBlockTerm - : PARSEOP_DEFINITIONBLOCK '(' {$$ = TrCreateLeafNode (PARSEOP_DEFINITIONBLOCK);} + : PARSEOP_DEFINITIONBLOCK '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DEFINITIONBLOCK);} String ',' String ',' ByteConst ',' @@ -1111,8 +1111,8 @@ Type6Opcode ; IncludeTerm - : PARSEOP_INCLUDE '(' {$$ = TrCreateLeafNode (PARSEOP_INCLUDE);} - String ')' {$$ = TrLinkChildren ($<n>3,1,$4);FlOpenIncludeFile ($4);} + : PARSEOP_INCLUDE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_INCLUDE);} + String ')' {TrLinkChildren ($<n>3,1,$4);FlOpenIncludeFile ($4);} TermList IncludeEndTerm {$$ = TrLinkPeerNodes (3,$<n>3,$7,$8);} ; @@ -1147,7 +1147,7 @@ ExternalTerm BankFieldTerm - : PARSEOP_BANKFIELD '(' {$$ = TrCreateLeafNode (PARSEOP_BANKFIELD);} + : PARSEOP_BANKFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_BANKFIELD);} NameString NameStringItem TermArgItem @@ -1198,7 +1198,7 @@ AccessAsTerm ; CreateBitFieldTerm - : PARSEOP_CREATEBITFIELD '(' {$$ = TrCreateLeafNode (PARSEOP_CREATEBITFIELD);} + : PARSEOP_CREATEBITFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEBITFIELD);} TermArg TermArgItem NameStringItem @@ -1208,7 +1208,7 @@ CreateBitFieldTerm ; CreateByteFieldTerm - : PARSEOP_CREATEBYTEFIELD '(' {$$ = TrCreateLeafNode (PARSEOP_CREATEBYTEFIELD);} + : PARSEOP_CREATEBYTEFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEBYTEFIELD);} TermArg TermArgItem NameStringItem @@ -1218,7 +1218,7 @@ CreateByteFieldTerm ; CreateDWordFieldTerm - : PARSEOP_CREATEDWORDFIELD '(' {$$ = TrCreateLeafNode (PARSEOP_CREATEDWORDFIELD);} + : PARSEOP_CREATEDWORDFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEDWORDFIELD);} TermArg TermArgItem NameStringItem @@ -1228,7 +1228,7 @@ CreateDWordFieldTerm ; CreateFieldTerm - : PARSEOP_CREATEFIELD '(' {$$ = TrCreateLeafNode (PARSEOP_CREATEFIELD);} + : PARSEOP_CREATEFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEFIELD);} TermArg TermArgItem TermArgItem @@ -1239,7 +1239,7 @@ CreateFieldTerm ; CreateQWordFieldTerm - : PARSEOP_CREATEQWORDFIELD '(' {$$ = TrCreateLeafNode (PARSEOP_CREATEQWORDFIELD);} + : PARSEOP_CREATEQWORDFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEQWORDFIELD);} TermArg TermArgItem NameStringItem @@ -1249,7 +1249,7 @@ CreateQWordFieldTerm ; CreateWordFieldTerm - : PARSEOP_CREATEWORDFIELD '(' {$$ = TrCreateLeafNode (PARSEOP_CREATEWORDFIELD);} + : PARSEOP_CREATEWORDFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CREATEWORDFIELD);} TermArg TermArgItem NameStringItem @@ -1259,7 +1259,7 @@ CreateWordFieldTerm ; DataRegionTerm - : PARSEOP_DATATABLEREGION '(' {$$ = TrCreateLeafNode (PARSEOP_DATATABLEREGION);} + : PARSEOP_DATATABLEREGION '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DATATABLEREGION);} NameString TermArgItem TermArgItem @@ -1270,7 +1270,7 @@ DataRegionTerm ; DeviceTerm - : PARSEOP_DEVICE '(' {$$ = TrCreateLeafNode (PARSEOP_DEVICE);} + : PARSEOP_DEVICE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DEVICE);} NameString ')' '{' ObjectList '}' {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$7);} @@ -1279,7 +1279,7 @@ DeviceTerm ; EventTerm - : PARSEOP_EVENT '(' {$$ = TrCreateLeafNode (PARSEOP_EVENT);} + : PARSEOP_EVENT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_EVENT);} NameString ')' {$$ = TrLinkChildren ($<n>3,1,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION));} | PARSEOP_EVENT '(' @@ -1287,7 +1287,7 @@ EventTerm ; FieldTerm - : PARSEOP_FIELD '(' {$$ = TrCreateLeafNode (PARSEOP_FIELD);} + : PARSEOP_FIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FIELD);} NameString ',' AccessTypeKeyword ',' LockRuleKeyword @@ -1299,7 +1299,7 @@ FieldTerm ; FunctionTerm - : PARSEOP_FUNCTION '(' {$$ = TrCreateLeafNode (PARSEOP_METHOD);} + : PARSEOP_FUNCTION '(' {$<n>$ = TrCreateLeafNode (PARSEOP_METHOD);} NameString OptionalParameterTypePackage OptionalParameterTypesPackage @@ -1313,7 +1313,7 @@ FunctionTerm ; IndexFieldTerm - : PARSEOP_INDEXFIELD '(' {$$ = TrCreateLeafNode (PARSEOP_INDEXFIELD);} + : PARSEOP_INDEXFIELD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_INDEXFIELD);} NameString NameStringItem ',' AccessTypeKeyword @@ -1326,9 +1326,9 @@ IndexFieldTerm ; MethodTerm - : PARSEOP_METHOD '(' {$$ = TrCreateLeafNode (PARSEOP_METHOD);} + : PARSEOP_METHOD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_METHOD);} NameString - OptionalByteConstExpr {$$ = UtCheckIntegerRange ($5, 0, 7);} + OptionalByteConstExpr {UtCheckIntegerRange ($5, 0, 7);} OptionalSerializeRuleKeyword OptionalByteConstExpr OptionalParameterTypePackage @@ -1340,7 +1340,7 @@ MethodTerm ; MutexTerm - : PARSEOP_MUTEX '(' {$$ = TrCreateLeafNode (PARSEOP_MUTEX);} + : PARSEOP_MUTEX '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MUTEX);} NameString ',' ByteConstExpr ')' {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6);} @@ -1349,7 +1349,7 @@ MutexTerm ; OpRegionTerm - : PARSEOP_OPERATIONREGION '(' {$$ = TrCreateLeafNode (PARSEOP_OPERATIONREGION);} + : PARSEOP_OPERATIONREGION '(' {$<n>$ = TrCreateLeafNode (PARSEOP_OPERATIONREGION);} NameString ',' OpRegionSpaceIdTerm TermArgItem @@ -1365,7 +1365,7 @@ OpRegionSpaceIdTerm ; PowerResTerm - : PARSEOP_POWERRESOURCE '(' {$$ = TrCreateLeafNode (PARSEOP_POWERRESOURCE);} + : PARSEOP_POWERRESOURCE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_POWERRESOURCE);} NameString ',' ByteConstExpr ',' WordConstExpr @@ -1376,7 +1376,7 @@ PowerResTerm ; ProcessorTerm - : PARSEOP_PROCESSOR '(' {$$ = TrCreateLeafNode (PARSEOP_PROCESSOR);} + : PARSEOP_PROCESSOR '(' {$<n>$ = TrCreateLeafNode (PARSEOP_PROCESSOR);} NameString ',' ByteConstExpr OptionalDWordConstExpr @@ -1388,7 +1388,7 @@ ProcessorTerm ; ThermalZoneTerm - : PARSEOP_THERMALZONE '(' {$$ = TrCreateLeafNode (PARSEOP_THERMALZONE);} + : PARSEOP_THERMALZONE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_THERMALZONE);} NameString ')' '{' ObjectList '}' {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$7);} @@ -1401,7 +1401,7 @@ ThermalZoneTerm AliasTerm - : PARSEOP_ALIAS '(' {$$ = TrCreateLeafNode (PARSEOP_ALIAS);} + : PARSEOP_ALIAS '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ALIAS);} NameString NameStringItem ')' {$$ = TrLinkChildren ($<n>3,2,$4,TrSetNodeFlags ($5, NODE_IS_NAME_DECLARATION));} @@ -1410,7 +1410,7 @@ AliasTerm ; NameTerm - : PARSEOP_NAME '(' {$$ = TrCreateLeafNode (PARSEOP_NAME);} + : PARSEOP_NAME '(' {$<n>$ = TrCreateLeafNode (PARSEOP_NAME);} NameString ',' DataObject ')' {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$6);} @@ -1419,7 +1419,7 @@ NameTerm ; ScopeTerm - : PARSEOP_SCOPE '(' {$$ = TrCreateLeafNode (PARSEOP_SCOPE);} + : PARSEOP_SCOPE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SCOPE);} NameString ')' '{' ObjectList '}' {$$ = TrLinkChildren ($<n>3,2,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),$7);} @@ -1444,7 +1444,7 @@ ContinueTerm ; FatalTerm - : PARSEOP_FATAL '(' {$$ = TrCreateLeafNode (PARSEOP_FATAL);} + : PARSEOP_FATAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FATAL);} ByteConstExpr ',' DWordConstExpr TermArgItem @@ -1458,7 +1458,7 @@ IfElseTerm ; IfTerm - : PARSEOP_IF '(' {$$ = TrCreateLeafNode (PARSEOP_IF);} + : PARSEOP_IF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_IF);} TermArg ')' '{' TermList '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);} @@ -1469,7 +1469,7 @@ IfTerm ElseTerm : {$$ = NULL;} - | PARSEOP_ELSE '{' {$$ = TrCreateLeafNode (PARSEOP_ELSE);} + | PARSEOP_ELSE '{' {$<n>$ = TrCreateLeafNode (PARSEOP_ELSE);} TermList '}' {$$ = TrLinkChildren ($<n>3,1,$4);} | PARSEOP_ELSE '{' @@ -1478,11 +1478,11 @@ ElseTerm | PARSEOP_ELSE error {$$ = AslDoError(); yyclearin;} - | PARSEOP_ELSEIF '(' {$$ = TrCreateLeafNode (PARSEOP_ELSE);} - TermArg {$$ = TrCreateLeafNode (PARSEOP_IF);} + | PARSEOP_ELSEIF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ELSE);} + TermArg {$<n>$ = TrCreateLeafNode (PARSEOP_IF);} ')' '{' - TermList '}' {$$ = TrLinkChildren ($<n>5,2,$4,$8);} - ElseTerm {$$ = TrLinkPeerNode ($<n>5,$11);} + TermList '}' {TrLinkChildren ($<n>5,2,$4,$8);} + ElseTerm {TrLinkPeerNode ($<n>5,$11);} {$$ = TrLinkChildren ($<n>3,1,$<n>5);} | PARSEOP_ELSEIF '(' @@ -1493,7 +1493,7 @@ ElseTerm ; LoadTerm - : PARSEOP_LOAD '(' {$$ = TrCreateLeafNode (PARSEOP_LOAD);} + : PARSEOP_LOAD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LOAD);} NameString RequiredTarget ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} @@ -1506,7 +1506,7 @@ NoOpTerm ; NotifyTerm - : PARSEOP_NOTIFY '(' {$$ = TrCreateLeafNode (PARSEOP_NOTIFY);} + : PARSEOP_NOTIFY '(' {$<n>$ = TrCreateLeafNode (PARSEOP_NOTIFY);} SuperName TermArgItem ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} @@ -1515,7 +1515,7 @@ NotifyTerm ; ReleaseTerm - : PARSEOP_RELEASE '(' {$$ = TrCreateLeafNode (PARSEOP_RELEASE);} + : PARSEOP_RELEASE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_RELEASE);} SuperName ')' {$$ = TrLinkChildren ($<n>3,1,$4);} | PARSEOP_RELEASE '(' @@ -1523,7 +1523,7 @@ ReleaseTerm ; ResetTerm - : PARSEOP_RESET '(' {$$ = TrCreateLeafNode (PARSEOP_RESET);} + : PARSEOP_RESET '(' {$<n>$ = TrCreateLeafNode (PARSEOP_RESET);} SuperName ')' {$$ = TrLinkChildren ($<n>3,1,$4);} | PARSEOP_RESET '(' @@ -1531,7 +1531,7 @@ ResetTerm ; ReturnTerm - : PARSEOP_RETURN '(' {$$ = TrCreateLeafNode (PARSEOP_RETURN);} + : PARSEOP_RETURN '(' {$<n>$ = TrCreateLeafNode (PARSEOP_RETURN);} OptionalReturnArg ')' {$$ = TrLinkChildren ($<n>3,1,$4);} | PARSEOP_RETURN {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_RETURN),1,TrCreateLeafNode (PARSEOP_ZERO));} @@ -1540,7 +1540,7 @@ ReturnTerm ; SignalTerm - : PARSEOP_SIGNAL '(' {$$ = TrCreateLeafNode (PARSEOP_SIGNAL);} + : PARSEOP_SIGNAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SIGNAL);} SuperName ')' {$$ = TrLinkChildren ($<n>3,1,$4);} | PARSEOP_SIGNAL '(' @@ -1548,7 +1548,7 @@ SignalTerm ; SleepTerm - : PARSEOP_SLEEP '(' {$$ = TrCreateLeafNode (PARSEOP_SLEEP);} + : PARSEOP_SLEEP '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SLEEP);} TermArg ')' {$$ = TrLinkChildren ($<n>3,1,$4);} | PARSEOP_SLEEP '(' @@ -1556,7 +1556,7 @@ SleepTerm ; StallTerm - : PARSEOP_STALL '(' {$$ = TrCreateLeafNode (PARSEOP_STALL);} + : PARSEOP_STALL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_STALL);} TermArg ')' {$$ = TrLinkChildren ($<n>3,1,$4);} | PARSEOP_STALL '(' @@ -1564,7 +1564,7 @@ StallTerm ; SwitchTerm - : PARSEOP_SWITCH '(' {$$ = TrCreateLeafNode (PARSEOP_SWITCH);} + : PARSEOP_SWITCH '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SWITCH);} TermArg ')' '{' CaseDefaultTermList '}' @@ -1607,7 +1607,7 @@ CaseTermList */ CaseTerm - : PARSEOP_CASE '(' {$$ = TrCreateLeafNode (PARSEOP_CASE);} + : PARSEOP_CASE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CASE);} DataObject ')' '{' TermList '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);} @@ -1616,14 +1616,14 @@ CaseTerm ; DefaultTerm - : PARSEOP_DEFAULT '{' {$$ = TrCreateLeafNode (PARSEOP_DEFAULT);} + : PARSEOP_DEFAULT '{' {$<n>$ = TrCreateLeafNode (PARSEOP_DEFAULT);} TermList '}' {$$ = TrLinkChildren ($<n>3,1,$4);} | PARSEOP_DEFAULT '{' error '}' {$$ = AslDoError(); yyclearin;} ; UnloadTerm - : PARSEOP_UNLOAD '(' {$$ = TrCreateLeafNode (PARSEOP_UNLOAD);} + : PARSEOP_UNLOAD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_UNLOAD);} SuperName ')' {$$ = TrLinkChildren ($<n>3,1,$4);} | PARSEOP_UNLOAD '(' @@ -1631,7 +1631,7 @@ UnloadTerm ; WhileTerm - : PARSEOP_WHILE '(' {$$ = TrCreateLeafNode (PARSEOP_WHILE);} + : PARSEOP_WHILE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_WHILE);} TermArg ')' '{' TermList '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);} @@ -1643,7 +1643,7 @@ WhileTerm /******* Type 2 opcodes *******************************************************/ AcquireTerm - : PARSEOP_ACQUIRE '(' {$$ = TrCreateLeafNode (PARSEOP_ACQUIRE);} + : PARSEOP_ACQUIRE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ACQUIRE);} SuperName ',' WordConstExpr ')' {$$ = TrLinkChildren ($<n>3,2,$4,$6);} @@ -1652,7 +1652,7 @@ AcquireTerm ; AddTerm - : PARSEOP_ADD '(' {$$ = TrCreateLeafNode (PARSEOP_ADD);} + : PARSEOP_ADD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_ADD);} TermArg TermArgItem Target @@ -1662,7 +1662,7 @@ AddTerm ; AndTerm - : PARSEOP_AND '(' {$$ = TrCreateLeafNode (PARSEOP_AND);} + : PARSEOP_AND '(' {$<n>$ = TrCreateLeafNode (PARSEOP_AND);} TermArg TermArgItem Target @@ -1672,7 +1672,7 @@ AndTerm ; ConcatTerm - : PARSEOP_CONCATENATE '(' {$$ = TrCreateLeafNode (PARSEOP_CONCATENATE);} + : PARSEOP_CONCATENATE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CONCATENATE);} TermArg TermArgItem Target @@ -1682,7 +1682,7 @@ ConcatTerm ; ConcatResTerm - : PARSEOP_CONCATENATERESTEMPLATE '(' {$$ = TrCreateLeafNode (PARSEOP_CONCATENATERESTEMPLATE);} + : PARSEOP_CONCATENATERESTEMPLATE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CONCATENATERESTEMPLATE);} TermArg TermArgItem Target @@ -1692,7 +1692,7 @@ ConcatResTerm ; CondRefOfTerm - : PARSEOP_CONDREFOF '(' {$$ = TrCreateLeafNode (PARSEOP_CONDREFOF);} + : PARSEOP_CONDREFOF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_CONDREFOF);} SuperName Target ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} @@ -1701,7 +1701,7 @@ CondRefOfTerm ; CopyObjectTerm - : PARSEOP_COPYOBJECT '(' {$$ = TrCreateLeafNode (PARSEOP_COPYOBJECT);} + : PARSEOP_COPYOBJECT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_COPYOBJECT);} TermArg ',' SimpleTarget ')' {$$ = TrLinkChildren ($<n>3,2,$4,TrSetNodeFlags ($6, NODE_IS_TARGET));} @@ -1710,7 +1710,7 @@ CopyObjectTerm ; DecTerm - : PARSEOP_DECREMENT '(' {$$ = TrCreateLeafNode (PARSEOP_DECREMENT);} + : PARSEOP_DECREMENT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DECREMENT);} SuperName ')' {$$ = TrLinkChildren ($<n>3,1,$4);} | PARSEOP_DECREMENT '(' @@ -1718,7 +1718,7 @@ DecTerm ; DerefOfTerm - : PARSEOP_DEREFOF '(' {$$ = TrCreateLeafNode (PARSEOP_DEREFOF);} + : PARSEOP_DEREFOF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DEREFOF);} TermArg ')' {$$ = TrLinkChildren ($<n>3,1,$4);} | PARSEOP_DEREFOF '(' @@ -1726,7 +1726,7 @@ DerefOfTerm ; DivideTerm - : PARSEOP_DIVIDE '(' {$$ = TrCreateLeafNode (PARSEOP_DIVIDE);} + : PARSEOP_DIVIDE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DIVIDE);} TermArg TermArgItem Target @@ -1737,7 +1737,7 @@ DivideTerm ; FindSetLeftBitTerm - : PARSEOP_FINDSETLEFTBIT '(' {$$ = TrCreateLeafNode (PARSEOP_FINDSETLEFTBIT);} + : PARSEOP_FINDSETLEFTBIT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FINDSETLEFTBIT);} TermArg Target ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} @@ -1746,7 +1746,7 @@ FindSetLeftBitTerm ; FindSetRightBitTerm - : PARSEOP_FINDSETRIGHTBIT '(' {$$ = TrCreateLeafNode (PARSEOP_FINDSETRIGHTBIT);} + : PARSEOP_FINDSETRIGHTBIT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FINDSETRIGHTBIT);} TermArg Target ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} @@ -1755,7 +1755,7 @@ FindSetRightBitTerm ; FromBCDTerm - : PARSEOP_FROMBCD '(' {$$ = TrCreateLeafNode (PARSEOP_FROMBCD);} + : PARSEOP_FROMBCD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FROMBCD);} TermArg Target ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} @@ -1764,7 +1764,7 @@ FromBCDTerm ; IncTerm - : PARSEOP_INCREMENT '(' {$$ = TrCreateLeafNode (PARSEOP_INCREMENT);} + : PARSEOP_INCREMENT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_INCREMENT);} SuperName ')' {$$ = TrLinkChildren ($<n>3,1,$4);} | PARSEOP_INCREMENT '(' @@ -1772,7 +1772,7 @@ IncTerm ; IndexTerm - : PARSEOP_INDEX '(' {$$ = TrCreateLeafNode (PARSEOP_INDEX);} + : PARSEOP_INDEX '(' {$<n>$ = TrCreateLeafNode (PARSEOP_INDEX);} TermArg TermArgItem Target @@ -1782,7 +1782,7 @@ IndexTerm ; LAndTerm - : PARSEOP_LAND '(' {$$ = TrCreateLeafNode (PARSEOP_LAND);} + : PARSEOP_LAND '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LAND);} TermArg TermArgItem ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} @@ -1791,7 +1791,7 @@ LAndTerm ; LEqualTerm - : PARSEOP_LEQUAL '(' {$$ = TrCreateLeafNode (PARSEOP_LEQUAL);} + : PARSEOP_LEQUAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LEQUAL);} TermArg TermArgItem ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} @@ -1800,7 +1800,7 @@ LEqualTerm ; LGreaterTerm - : PARSEOP_LGREATER '(' {$$ = TrCreateLeafNode (PARSEOP_LGREATER);} + : PARSEOP_LGREATER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LGREATER);} TermArg TermArgItem ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} @@ -1809,7 +1809,7 @@ LGreaterTerm ; LGreaterEqualTerm - : PARSEOP_LGREATEREQUAL '(' {$$ = TrCreateLeafNode (PARSEOP_LLESS);} + : PARSEOP_LGREATEREQUAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LLESS);} TermArg TermArgItem ')' {$$ = TrCreateNode (PARSEOP_LNOT, 1, TrLinkChildren ($<n>3,2,$4,$5));} @@ -1818,7 +1818,7 @@ LGreaterEqualTerm ; LLessTerm - : PARSEOP_LLESS '(' {$$ = TrCreateLeafNode (PARSEOP_LLESS);} + : PARSEOP_LLESS '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LLESS);} TermArg TermArgItem ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} @@ -1827,7 +1827,7 @@ LLessTerm ; LLessEqualTerm - : PARSEOP_LLESSEQUAL '(' {$$ = TrCreateLeafNode (PARSEOP_LGREATER);} + : PARSEOP_LLESSEQUAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LGREATER);} TermArg TermArgItem ')' {$$ = TrCreateNode (PARSEOP_LNOT, 1, TrLinkChildren ($<n>3,2,$4,$5));} @@ -1836,7 +1836,7 @@ LLessEqualTerm ; LNotTerm - : PARSEOP_LNOT '(' {$$ = TrCreateLeafNode (PARSEOP_LNOT);} + : PARSEOP_LNOT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LNOT);} TermArg ')' {$$ = TrLinkChildren ($<n>3,1,$4);} | PARSEOP_LNOT '(' @@ -1844,7 +1844,7 @@ LNotTerm ; LNotEqualTerm - : PARSEOP_LNOTEQUAL '(' {$$ = TrCreateLeafNode (PARSEOP_LEQUAL);} + : PARSEOP_LNOTEQUAL '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LEQUAL);} TermArg TermArgItem ')' {$$ = TrCreateNode (PARSEOP_LNOT, 1, TrLinkChildren ($<n>3,2,$4,$5));} @@ -1853,7 +1853,7 @@ LNotEqualTerm ; LoadTableTerm - : PARSEOP_LOADTABLE '(' {$$ = TrCreateLeafNode (PARSEOP_LOADTABLE);} + : PARSEOP_LOADTABLE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LOADTABLE);} TermArg TermArgItem TermArgItem @@ -1866,7 +1866,7 @@ LoadTableTerm ; LOrTerm - : PARSEOP_LOR '(' {$$ = TrCreateLeafNode (PARSEOP_LOR);} + : PARSEOP_LOR '(' {$<n>$ = TrCreateLeafNode (PARSEOP_LOR);} TermArg TermArgItem ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} @@ -1875,7 +1875,7 @@ LOrTerm ; MatchTerm - : PARSEOP_MATCH '(' {$$ = TrCreateLeafNode (PARSEOP_MATCH);} + : PARSEOP_MATCH '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MATCH);} TermArg ',' MatchOpKeyword TermArgItem @@ -1888,7 +1888,7 @@ MatchTerm ; MidTerm - : PARSEOP_MID '(' {$$ = TrCreateLeafNode (PARSEOP_MID);} + : PARSEOP_MID '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MID);} TermArg TermArgItem TermArgItem @@ -1899,7 +1899,7 @@ MidTerm ; ModTerm - : PARSEOP_MOD '(' {$$ = TrCreateLeafNode (PARSEOP_MOD);} + : PARSEOP_MOD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MOD);} TermArg TermArgItem Target @@ -1909,7 +1909,7 @@ ModTerm ; MultiplyTerm - : PARSEOP_MULTIPLY '(' {$$ = TrCreateLeafNode (PARSEOP_MULTIPLY);} + : PARSEOP_MULTIPLY '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MULTIPLY);} TermArg TermArgItem Target @@ -1919,7 +1919,7 @@ MultiplyTerm ; NAndTerm - : PARSEOP_NAND '(' {$$ = TrCreateLeafNode (PARSEOP_NAND);} + : PARSEOP_NAND '(' {$<n>$ = TrCreateLeafNode (PARSEOP_NAND);} TermArg TermArgItem Target @@ -1929,7 +1929,7 @@ NAndTerm ; NOrTerm - : PARSEOP_NOR '(' {$$ = TrCreateLeafNode (PARSEOP_NOR);} + : PARSEOP_NOR '(' {$<n>$ = TrCreateLeafNode (PARSEOP_NOR);} TermArg TermArgItem Target @@ -1939,7 +1939,7 @@ NOrTerm ; NotTerm - : PARSEOP_NOT '(' {$$ = TrCreateLeafNode (PARSEOP_NOT);} + : PARSEOP_NOT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_NOT);} TermArg Target ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} @@ -1948,7 +1948,7 @@ NotTerm ; ObjectTypeTerm - : PARSEOP_OBJECTTYPE '(' {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE);} + : PARSEOP_OBJECTTYPE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE);} SuperName ')' {$$ = TrLinkChildren ($<n>3,1,$4);} | PARSEOP_OBJECTTYPE '(' @@ -1956,7 +1956,7 @@ ObjectTypeTerm ; OrTerm - : PARSEOP_OR '(' {$$ = TrCreateLeafNode (PARSEOP_OR);} + : PARSEOP_OR '(' {$<n>$ = TrCreateLeafNode (PARSEOP_OR);} TermArg TermArgItem Target @@ -1970,7 +1970,7 @@ OrTerm * we've taken a pointer to it. (hard to tell if a local becomes initialized this way.) */ RefOfTerm - : PARSEOP_REFOF '(' {$$ = TrCreateLeafNode (PARSEOP_REFOF);} + : PARSEOP_REFOF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_REFOF);} SuperName ')' {$$ = TrLinkChildren ($<n>3,1,TrSetNodeFlags ($4, NODE_IS_TARGET));} | PARSEOP_REFOF '(' @@ -1978,7 +1978,7 @@ RefOfTerm ; ShiftLeftTerm - : PARSEOP_SHIFTLEFT '(' {$$ = TrCreateLeafNode (PARSEOP_SHIFTLEFT);} + : PARSEOP_SHIFTLEFT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SHIFTLEFT);} TermArg TermArgItem Target @@ -1988,7 +1988,7 @@ ShiftLeftTerm ; ShiftRightTerm - : PARSEOP_SHIFTRIGHT '(' {$$ = TrCreateLeafNode (PARSEOP_SHIFTRIGHT);} + : PARSEOP_SHIFTRIGHT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SHIFTRIGHT);} TermArg TermArgItem Target @@ -1998,7 +1998,7 @@ ShiftRightTerm ; SizeOfTerm - : PARSEOP_SIZEOF '(' {$$ = TrCreateLeafNode (PARSEOP_SIZEOF);} + : PARSEOP_SIZEOF '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SIZEOF);} SuperName ')' {$$ = TrLinkChildren ($<n>3,1,$4);} | PARSEOP_SIZEOF '(' @@ -2006,7 +2006,7 @@ SizeOfTerm ; StoreTerm - : PARSEOP_STORE '(' {$$ = TrCreateLeafNode (PARSEOP_STORE);} + : PARSEOP_STORE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_STORE);} TermArg ',' SuperName ')' {$$ = TrLinkChildren ($<n>3,2,$4,TrSetNodeFlags ($6, NODE_IS_TARGET));} @@ -2015,7 +2015,7 @@ StoreTerm ; SubtractTerm - : PARSEOP_SUBTRACT '(' {$$ = TrCreateLeafNode (PARSEOP_SUBTRACT);} + : PARSEOP_SUBTRACT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_SUBTRACT);} TermArg TermArgItem Target @@ -2025,7 +2025,7 @@ SubtractTerm ; TimerTerm - : PARSEOP_TIMER '(' {$$ = TrCreateLeafNode (PARSEOP_TIMER);} + : PARSEOP_TIMER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TIMER);} ')' {$$ = TrLinkChildren ($<n>3,0);} | PARSEOP_TIMER {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_TIMER),0);} | PARSEOP_TIMER '(' @@ -2033,7 +2033,7 @@ TimerTerm ; ToBCDTerm - : PARSEOP_TOBCD '(' {$$ = TrCreateLeafNode (PARSEOP_TOBCD);} + : PARSEOP_TOBCD '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TOBCD);} TermArg Target ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} @@ -2042,7 +2042,7 @@ ToBCDTerm ; ToBufferTerm - : PARSEOP_TOBUFFER '(' {$$ = TrCreateLeafNode (PARSEOP_TOBUFFER);} + : PARSEOP_TOBUFFER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TOBUFFER);} TermArg Target ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} @@ -2051,7 +2051,7 @@ ToBufferTerm ; ToDecimalStringTerm - : PARSEOP_TODECIMALSTRING '(' {$$ = TrCreateLeafNode (PARSEOP_TODECIMALSTRING);} + : PARSEOP_TODECIMALSTRING '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TODECIMALSTRING);} TermArg Target ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} @@ -2060,7 +2060,7 @@ ToDecimalStringTerm ; ToHexStringTerm - : PARSEOP_TOHEXSTRING '(' {$$ = TrCreateLeafNode (PARSEOP_TOHEXSTRING);} + : PARSEOP_TOHEXSTRING '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TOHEXSTRING);} TermArg Target ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} @@ -2069,7 +2069,7 @@ ToHexStringTerm ; ToIntegerTerm - : PARSEOP_TOINTEGER '(' {$$ = TrCreateLeafNode (PARSEOP_TOINTEGER);} + : PARSEOP_TOINTEGER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TOINTEGER);} TermArg Target ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} @@ -2078,7 +2078,7 @@ ToIntegerTerm ; ToStringTerm - : PARSEOP_TOSTRING '(' {$$ = TrCreateLeafNode (PARSEOP_TOSTRING);} + : PARSEOP_TOSTRING '(' {$<n>$ = TrCreateLeafNode (PARSEOP_TOSTRING);} TermArg OptionalCount Target @@ -2095,7 +2095,7 @@ ToUUIDTerm ; WaitTerm - : PARSEOP_WAIT '(' {$$ = TrCreateLeafNode (PARSEOP_WAIT);} + : PARSEOP_WAIT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_WAIT);} SuperName TermArgItem ')' {$$ = TrLinkChildren ($<n>3,2,$4,$5);} @@ -2104,7 +2104,7 @@ WaitTerm ; XOrTerm - : PARSEOP_XOR '(' {$$ = TrCreateLeafNode (PARSEOP_XOR);} + : PARSEOP_XOR '(' {$<n>$ = TrCreateLeafNode (PARSEOP_XOR);} TermArg TermArgItem Target @@ -2399,7 +2399,7 @@ OptionalCount BufferTerm - : PARSEOP_BUFFER '(' {$$ = TrCreateLeafNode (PARSEOP_BUFFER);} + : PARSEOP_BUFFER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_BUFFER);} OptionalTermArg ')' '{' BufferTermData '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);} @@ -2429,7 +2429,7 @@ DWordList ; PackageTerm - : PARSEOP_PACKAGE '(' {$$ = TrCreateLeafNode (PARSEOP_VAR_PACKAGE);} + : PARSEOP_PACKAGE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_VAR_PACKAGE);} VarPackageLengthTerm ')' '{' PackageList '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);} @@ -2481,7 +2481,7 @@ ResourceTemplateTerm ; UnicodeTerm - : PARSEOP_UNICODE '(' {$$ = TrCreateLeafNode (PARSEOP_UNICODE);} + : PARSEOP_UNICODE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_UNICODE);} StringData ')' {$$ = TrLinkChildren ($<n>3,2,0,$4);} | PARSEOP_UNICODE '(' @@ -2525,7 +2525,7 @@ ResourceMacroTerm ; DMATerm - : PARSEOP_DMA '(' {$$ = TrCreateLeafNode (PARSEOP_DMA);} + : PARSEOP_DMA '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DMA);} DMATypeKeyword OptionalBusMasterKeyword ',' XferTypeKeyword @@ -2537,7 +2537,7 @@ DMATerm ; DWordIOTerm - : PARSEOP_DWORDIO '(' {$$ = TrCreateLeafNode (PARSEOP_DWORDIO);} + : PARSEOP_DWORDIO '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DWORDIO);} OptionalResourceType_First OptionalMinType OptionalMaxType @@ -2559,7 +2559,7 @@ DWordIOTerm ; DWordMemoryTerm - : PARSEOP_DWORDMEMORY '(' {$$ = TrCreateLeafNode (PARSEOP_DWORDMEMORY);} + : PARSEOP_DWORDMEMORY '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DWORDMEMORY);} OptionalResourceType_First OptionalDecodeType OptionalMinType @@ -2582,8 +2582,8 @@ DWordMemoryTerm ; DWordSpaceTerm - : PARSEOP_DWORDSPACE '(' {$$ = TrCreateLeafNode (PARSEOP_DWORDSPACE);} - ByteConstExpr {$$ = UtCheckIntegerRange ($4, 0xC0, 0xFF);} + : PARSEOP_DWORDSPACE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_DWORDSPACE);} + ByteConstExpr {UtCheckIntegerRange ($4, 0xC0, 0xFF);} OptionalResourceType OptionalDecodeType OptionalMinType @@ -2611,7 +2611,7 @@ EndDependentFnTerm ; ExtendedIOTerm - : PARSEOP_EXTENDEDIO '(' {$$ = TrCreateLeafNode (PARSEOP_EXTENDEDIO);} + : PARSEOP_EXTENDEDIO '(' {$<n>$ = TrCreateLeafNode (PARSEOP_EXTENDEDIO);} OptionalResourceType_First OptionalMinType OptionalMaxType @@ -2632,7 +2632,7 @@ ExtendedIOTerm ; ExtendedMemoryTerm - : PARSEOP_EXTENDEDMEMORY '(' {$$ = TrCreateLeafNode (PARSEOP_EXTENDEDMEMORY);} + : PARSEOP_EXTENDEDMEMORY '(' {$<n>$ = TrCreateLeafNode (PARSEOP_EXTENDEDMEMORY);} OptionalResourceType_First OptionalDecodeType OptionalMinType @@ -2654,8 +2654,8 @@ ExtendedMemoryTerm ; ExtendedSpaceTerm - : PARSEOP_EXTENDEDSPACE '(' {$$ = TrCreateLeafNode (PARSEOP_EXTENDEDSPACE);} - ByteConstExpr {$$ = UtCheckIntegerRange ($4, 0xC0, 0xFF);} + : PARSEOP_EXTENDEDSPACE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_EXTENDEDSPACE);} + ByteConstExpr {UtCheckIntegerRange ($4, 0xC0, 0xFF);} OptionalResourceType OptionalDecodeType OptionalMinType @@ -2674,7 +2674,7 @@ ExtendedSpaceTerm ; FixedIOTerm - : PARSEOP_FIXEDIO '(' {$$ = TrCreateLeafNode (PARSEOP_FIXEDIO);} + : PARSEOP_FIXEDIO '(' {$<n>$ = TrCreateLeafNode (PARSEOP_FIXEDIO);} WordConstExpr ',' ByteConstExpr OptionalNameString_Last @@ -2684,7 +2684,7 @@ FixedIOTerm ; InterruptTerm - : PARSEOP_INTERRUPT '(' {$$ = TrCreateLeafNode (PARSEOP_INTERRUPT);} + : PARSEOP_INTERRUPT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_INTERRUPT);} OptionalResourceType_First ',' InterruptTypeKeyword ',' InterruptLevel @@ -2699,7 +2699,7 @@ InterruptTerm ; IOTerm - : PARSEOP_IO '(' {$$ = TrCreateLeafNode (PARSEOP_IO);} + : PARSEOP_IO '(' {$<n>$ = TrCreateLeafNode (PARSEOP_IO);} IODecodeKeyword ',' WordConstExpr ',' WordConstExpr @@ -2712,7 +2712,7 @@ IOTerm ; IRQNoFlagsTerm - : PARSEOP_IRQNOFLAGS '(' {$$ = TrCreateLeafNode (PARSEOP_IRQNOFLAGS);} + : PARSEOP_IRQNOFLAGS '(' {$<n>$ = TrCreateLeafNode (PARSEOP_IRQNOFLAGS);} OptionalNameString_First ')' '{' ByteList '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);} @@ -2721,7 +2721,7 @@ IRQNoFlagsTerm ; IRQTerm - : PARSEOP_IRQ '(' {$$ = TrCreateLeafNode (PARSEOP_IRQ);} + : PARSEOP_IRQ '(' {$<n>$ = TrCreateLeafNode (PARSEOP_IRQ);} InterruptTypeKeyword ',' InterruptLevel OptionalShareType @@ -2733,7 +2733,7 @@ IRQTerm ; Memory24Term - : PARSEOP_MEMORY24 '(' {$$ = TrCreateLeafNode (PARSEOP_MEMORY24);} + : PARSEOP_MEMORY24 '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MEMORY24);} OptionalReadWriteKeyword ',' WordConstExpr ',' WordConstExpr @@ -2746,7 +2746,7 @@ Memory24Term ; Memory32FixedTerm - : PARSEOP_MEMORY32FIXED '(' {$$ = TrCreateLeafNode (PARSEOP_MEMORY32FIXED);} + : PARSEOP_MEMORY32FIXED '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MEMORY32FIXED);} OptionalReadWriteKeyword ',' DWordConstExpr ',' DWordConstExpr @@ -2757,7 +2757,7 @@ Memory32FixedTerm ; Memory32Term - : PARSEOP_MEMORY32 '(' {$$ = TrCreateLeafNode (PARSEOP_MEMORY32);} + : PARSEOP_MEMORY32 '(' {$<n>$ = TrCreateLeafNode (PARSEOP_MEMORY32);} OptionalReadWriteKeyword ',' DWordConstExpr ',' DWordConstExpr @@ -2770,7 +2770,7 @@ Memory32Term ; QWordIOTerm - : PARSEOP_QWORDIO '(' {$$ = TrCreateLeafNode (PARSEOP_QWORDIO);} + : PARSEOP_QWORDIO '(' {$<n>$ = TrCreateLeafNode (PARSEOP_QWORDIO);} OptionalResourceType_First OptionalMinType OptionalMaxType @@ -2792,7 +2792,7 @@ QWordIOTerm ; QWordMemoryTerm - : PARSEOP_QWORDMEMORY '(' {$$ = TrCreateLeafNode (PARSEOP_QWORDMEMORY);} + : PARSEOP_QWORDMEMORY '(' {$<n>$ = TrCreateLeafNode (PARSEOP_QWORDMEMORY);} OptionalResourceType_First OptionalDecodeType OptionalMinType @@ -2815,8 +2815,8 @@ QWordMemoryTerm ; QWordSpaceTerm - : PARSEOP_QWORDSPACE '(' {$$ = TrCreateLeafNode (PARSEOP_QWORDSPACE);} - ByteConstExpr {$$ = UtCheckIntegerRange ($4, 0xC0, 0xFF);} + : PARSEOP_QWORDSPACE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_QWORDSPACE);} + ByteConstExpr {UtCheckIntegerRange ($4, 0xC0, 0xFF);} OptionalResourceType OptionalDecodeType OptionalMinType @@ -2836,7 +2836,7 @@ QWordSpaceTerm ; RegisterTerm - : PARSEOP_REGISTER '(' {$$ = TrCreateLeafNode (PARSEOP_REGISTER);} + : PARSEOP_REGISTER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_REGISTER);} AddressSpaceKeyword ',' ByteConstExpr ',' ByteConstExpr @@ -2849,7 +2849,7 @@ RegisterTerm ; StartDependentFnTerm - : PARSEOP_STARTDEPENDENTFN '(' {$$ = TrCreateLeafNode (PARSEOP_STARTDEPENDENTFN);} + : PARSEOP_STARTDEPENDENTFN '(' {$<n>$ = TrCreateLeafNode (PARSEOP_STARTDEPENDENTFN);} ByteConstExpr ',' ByteConstExpr ')' '{' @@ -2859,7 +2859,7 @@ StartDependentFnTerm ; StartDependentFnNoPriTerm - : PARSEOP_STARTDEPENDENTFN_NOPRI '(' {$$ = TrCreateLeafNode (PARSEOP_STARTDEPENDENTFN_NOPRI);} + : PARSEOP_STARTDEPENDENTFN_NOPRI '(' {$<n>$ = TrCreateLeafNode (PARSEOP_STARTDEPENDENTFN_NOPRI);} ')' '{' ResourceMacroList '}' {$$ = TrLinkChildren ($<n>3,1,$6);} | PARSEOP_STARTDEPENDENTFN_NOPRI '(' @@ -2867,7 +2867,7 @@ StartDependentFnNoPriTerm ; VendorLongTerm - : PARSEOP_VENDORLONG '(' {$$ = TrCreateLeafNode (PARSEOP_VENDORLONG);} + : PARSEOP_VENDORLONG '(' {$<n>$ = TrCreateLeafNode (PARSEOP_VENDORLONG);} OptionalNameString_First ')' '{' ByteList '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);} @@ -2876,7 +2876,7 @@ VendorLongTerm ; VendorShortTerm - : PARSEOP_VENDORSHORT '(' {$$ = TrCreateLeafNode (PARSEOP_VENDORSHORT);} + : PARSEOP_VENDORSHORT '(' {$<n>$ = TrCreateLeafNode (PARSEOP_VENDORSHORT);} OptionalNameString_First ')' '{' ByteList '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);} @@ -2885,7 +2885,7 @@ VendorShortTerm ; WordBusNumberTerm - : PARSEOP_WORDBUSNUMBER '(' {$$ = TrCreateLeafNode (PARSEOP_WORDBUSNUMBER);} + : PARSEOP_WORDBUSNUMBER '(' {$<n>$ = TrCreateLeafNode (PARSEOP_WORDBUSNUMBER);} OptionalResourceType_First OptionalMinType OptionalMaxType @@ -2904,7 +2904,7 @@ WordBusNumberTerm ; WordIOTerm - : PARSEOP_WORDIO '(' {$$ = TrCreateLeafNode (PARSEOP_WORDIO);} + : PARSEOP_WORDIO '(' {$<n>$ = TrCreateLeafNode (PARSEOP_WORDIO);} OptionalResourceType_First OptionalMinType OptionalMaxType @@ -2926,8 +2926,8 @@ WordIOTerm ; WordSpaceTerm - : PARSEOP_WORDSPACE '(' {$$ = TrCreateLeafNode (PARSEOP_WORDSPACE);} - ByteConstExpr {$$ = UtCheckIntegerRange ($4, 0xC0, 0xFF);} + : PARSEOP_WORDSPACE '(' {$<n>$ = TrCreateLeafNode (PARSEOP_WORDSPACE);} + ByteConstExpr {UtCheckIntegerRange ($4, 0xC0, 0xFF);} OptionalResourceType OptionalDecodeType OptionalMinType @@ -3070,8 +3070,7 @@ OptionalRangeType OptionalReference : {$$ = TrCreateLeafNode (PARSEOP_ZERO);} /* Placeholder is a ZeroOp object */ | ',' {$$ = TrCreateLeafNode (PARSEOP_ZERO);} /* Placeholder is a ZeroOp object */ - | ',' DataObject {$$ = $2;} - | ',' NameString {$$ = $2;} + | ',' TermArg {$$ = $2;} ; OptionalResourceType_First @@ -3080,8 +3079,7 @@ OptionalResourceType_First ; OptionalResourceType - : {$$ = NULL;} - | ',' {$$ = NULL;} + : ',' {$$ = NULL;} | ',' ResourceTypeKeyword {$$ = $2;} ; diff --git a/sys/contrib/dev/acpica/compiler/asldefine.h b/sys/contrib/dev/acpica/compiler/asldefine.h index 29f3568bf752..c66040bbe4b3 100644 --- a/sys/contrib/dev/acpica/compiler/asldefine.h +++ b/sys/contrib/dev/acpica/compiler/asldefine.h @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: asldefine.h - Common defines for the iASL compiler - * $Revision: 1.7 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -128,7 +127,7 @@ #define IntelAcpiCA "Intel ACPI Component Architecture" #define CompilerId "ASL Optimizing Compiler" #define DisassemblerId "AML Disassembler" -#define CompilerCopyright "Copyright (C) 2000 - 2007 Intel Corporation" +#define CompilerCopyright "Copyright (C) 2000 - 2009 Intel Corporation" #define CompilerCompliance "Supports ACPI Specification Revision 3.0a" #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 760015893ada..87300b1529c8 100644 --- a/sys/contrib/dev/acpica/compiler/aslerror.c +++ b/sys/contrib/dev/acpica/compiler/aslerror.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: aslerror - Error handling and statistics - * $Revision: 1.92 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,7 +115,7 @@ *****************************************************************************/ #define ASL_EXCEPTIONS -#include <contrib/dev/acpica/compiler/aslcompiler.h> +#include "aslcompiler.h" #define _COMPONENT ACPI_COMPILER ACPI_MODULE_NAME ("aslerror") @@ -128,6 +127,26 @@ AeAddToErrorLog ( ASL_ERROR_MSG *Enode); +void +AeClearErrorLog ( + void) +{ + ASL_ERROR_MSG *Enode = Gbl_ErrorLog; + ASL_ERROR_MSG *Next; + + /* Walk the error node list */ + + while (Enode) + { + Next = Enode->Next; + ACPI_FREE (Enode); + Enode = Next; + } + + Gbl_ErrorLog = NULL; +} + + /******************************************************************************* * * FUNCTION: AeAddToErrorLog @@ -228,6 +247,11 @@ AePrintException ( FILE *SourceFile; + if (Gbl_NoErrors) + { + return; + } + /* * Only listing files have a header, and remarks/optimizations * are always output @@ -288,7 +312,8 @@ AePrintException ( if (Actual) { fprintf (OutputFile, - "[*** iASL: Seek error on source code temp file ***]"); + "[*** iASL: Seek error on source code temp file %s ***]", + Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename); } else { @@ -296,7 +321,8 @@ AePrintException ( if (!RActual) { fprintf (OutputFile, - "[*** iASL: Read error on source code temp file ***]"); + "[*** iASL: Read error on source code temp file %s ***]", + Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename); } else while (RActual && SourceByte && (SourceByte != '\n')) diff --git a/sys/contrib/dev/acpica/compiler/aslfiles.c b/sys/contrib/dev/acpica/compiler/aslfiles.c index 9eace4391f09..cb38e900b0c9 100644 --- a/sys/contrib/dev/acpica/compiler/aslfiles.c +++ b/sys/contrib/dev/acpica/compiler/aslfiles.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: aslfiles - file I/O suppoert - * $Revision: 1.54 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -115,8 +114,8 @@ * *****************************************************************************/ -#include <contrib/dev/acpica/compiler/aslcompiler.h> -#include <contrib/dev/acpica/acapps.h> +#include "aslcompiler.h" +#include "acapps.h" #define _COMPONENT ACPI_COMPILER ACPI_MODULE_NAME ("aslfiles") @@ -191,7 +190,18 @@ FlOpenLocalFile ( char *Mode) { - strcpy (StringBuffer, Gbl_DirectoryPath); + 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); @@ -369,6 +379,8 @@ FlPrintFile ( va_start (Args, Format); Actual = vfprintf (Gbl_Files[FileId].Handle, Format, Args); + va_end (Args); + if (Actual == -1) { FlFileError (FileId, ASL_MSG_WRITE); diff --git a/sys/contrib/dev/acpica/compiler/aslfold.c b/sys/contrib/dev/acpica/compiler/aslfold.c index d744021741dd..4bb305ef1c50 100644 --- a/sys/contrib/dev/acpica/compiler/aslfold.c +++ b/sys/contrib/dev/acpica/compiler/aslfold.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: aslfold - Constant folding - * $Revision: 1.20 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,12 +115,12 @@ *****************************************************************************/ -#include <contrib/dev/acpica/compiler/aslcompiler.h> +#include "aslcompiler.h" #include "aslcompiler.y.h" -#include <contrib/dev/acpica/amlcode.h> +#include "amlcode.h" -#include <contrib/dev/acpica/acdispat.h> -#include <contrib/dev/acpica/acparser.h> +#include "acdispat.h" +#include "acparser.h" #define _COMPONENT ACPI_COMPILER ACPI_MODULE_NAME ("aslfold") @@ -481,7 +480,7 @@ OpcAmlConstantWalk ( * Because we know we executed type 3/4/5 opcodes above, we know that * the result must be either an Integer, String, or Buffer. */ - switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) + switch (ObjDesc->Common.Type) { case ACPI_TYPE_INTEGER: diff --git a/sys/contrib/dev/acpica/compiler/aslglobal.h b/sys/contrib/dev/acpica/compiler/aslglobal.h index 07e8a46bd137..4cb91216fbb8 100644 --- a/sys/contrib/dev/acpica/compiler/aslglobal.h +++ b/sys/contrib/dev/acpica/compiler/aslglobal.h @@ -3,7 +3,6 @@ /****************************************************************************** * * Module Name: aslglobal.h - Global variable definitions - * $Revision: 1.56 $ * *****************************************************************************/ @@ -11,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -144,7 +143,7 @@ extern FILE *AslCompilerin; extern int AslCompilerdebug; extern const ASL_MAPPING_ENTRY AslKeywordMapping[]; extern char *AslCompilertext; -extern char hex[]; +extern char HexLookup[]; #define ASL_LINE_BUFFER_SIZE 512 #define ASL_MSG_BUFFER_SIZE 4096 @@ -171,6 +170,9 @@ extern UINT32 Gbl_ExceptionCount[]; /* Option flags */ +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoCompile, TRUE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoSignon, TRUE); + ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_Acpi2, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_UseDefaultAmlFilename, TRUE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NsOutputFlag, FALSE); @@ -186,6 +188,7 @@ ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_ParseOnlyFlag, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_CompileTimesFlag, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_FoldConstants, TRUE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_VerboseErrors, TRUE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NoErrors, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisasmFlag, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_GetAllTables, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_IntegerOptimizationFlag, TRUE); diff --git a/sys/contrib/dev/acpica/compiler/asllength.c b/sys/contrib/dev/acpica/compiler/asllength.c index 056aaeb55da7..bd222e68f4b1 100644 --- a/sys/contrib/dev/acpica/compiler/asllength.c +++ b/sys/contrib/dev/acpica/compiler/asllength.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: asllength - Tree walk to determine package and opcode lengths - * $Revision: 1.37 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,9 +115,9 @@ *****************************************************************************/ -#include <contrib/dev/acpica/compiler/aslcompiler.h> +#include "aslcompiler.h" #include "aslcompiler.y.h" -#include <contrib/dev/acpica/amlcode.h> +#include "amlcode.h" #define _COMPONENT ACPI_COMPILER diff --git a/sys/contrib/dev/acpica/compiler/asllisting.c b/sys/contrib/dev/acpica/compiler/asllisting.c index 31f70b89ac51..f229d5fb7819 100644 --- a/sys/contrib/dev/acpica/compiler/asllisting.c +++ b/sys/contrib/dev/acpica/compiler/asllisting.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: asllisting - Listing file generation - * $Revision: 1.63 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,11 +115,11 @@ *****************************************************************************/ -#include <contrib/dev/acpica/compiler/aslcompiler.h> +#include "aslcompiler.h" #include "aslcompiler.y.h" -#include <contrib/dev/acpica/amlcode.h> -#include <contrib/dev/acpica/acparser.h> -#include <contrib/dev/acpica/acnamesp.h> +#include "amlcode.h" +#include "acparser.h" +#include "acnamesp.h" #define _COMPONENT ACPI_COMPILER ACPI_MODULE_NAME ("aslisting") @@ -199,6 +198,12 @@ static void LsDoHexOutputAsm ( void); +ACPI_STATUS +LsTreeWriteWalk ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level, + void *Context); + /******************************************************************************* * diff --git a/sys/contrib/dev/acpica/compiler/aslload.c b/sys/contrib/dev/acpica/compiler/aslload.c index ebbc487571f2..e61e0622e475 100644 --- a/sys/contrib/dev/acpica/compiler/aslload.c +++ b/sys/contrib/dev/acpica/compiler/aslload.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: dswload - Dispatcher namespace load callbacks - * $Revision: 1.77 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,10 +115,10 @@ #define __ASLLOAD_C__ -#include <contrib/dev/acpica/compiler/aslcompiler.h> -#include <contrib/dev/acpica/amlcode.h> -#include <contrib/dev/acpica/acdispat.h> -#include <contrib/dev/acpica/acnamesp.h> +#include "aslcompiler.h" +#include "amlcode.h" +#include "acdispat.h" +#include "acnamesp.h" #include "aslcompiler.y.h" @@ -145,7 +144,13 @@ LdNamespace1Begin ( void *Context); static ACPI_STATUS -LdNamespace1End ( +LdNamespace2Begin ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level, + void *Context); + +static ACPI_STATUS +LdCommonNamespaceEnd ( ACPI_PARSE_OBJECT *Op, UINT32 Level, void *Context); @@ -160,7 +165,7 @@ LdNamespace1End ( * RETURN: Status * * DESCRIPTION: Perform a walk of the parse tree that in turn loads all of the - * named ASL/AML objects into the namespace. The namespace is + * named ASL/AML objects into the namespace. The namespace is * constructed in order to resolve named references and references * to named fields within resource templates/descriptors. * @@ -183,10 +188,15 @@ LdLoadNamespace ( return AE_NO_MEMORY; } - /* Perform the walk of the parse tree */ + /* Walk the entire parse tree, first pass */ TrWalkParseTree (RootOp, ASL_WALK_VISIT_TWICE, LdNamespace1Begin, - LdNamespace1End, WalkState); + LdCommonNamespaceEnd, WalkState); + + /* Second pass to handle forward references */ + + TrWalkParseTree (RootOp, ASL_WALK_VISIT_TWICE, LdNamespace2Begin, + LdCommonNamespaceEnd, WalkState); /* Dump the namespace if debug is enabled */ @@ -304,7 +314,7 @@ LdLoadFieldElements ( * DESCRIPTION: Enter the named elements of the resource descriptor (children * of the parent) into the namespace. * - * NOTE: In the real AML namespace, these named elements never exist. But + * NOTE: In the real AML namespace, these named elements never exist. But * we simply use the namespace here as a symbol table so we can look * them up as they are referenced. * @@ -395,7 +405,7 @@ LdLoadResourceElements ( * * RETURN: Status * - * DESCRIPTION: Descending callback used during the parse tree walk. If this + * DESCRIPTION: Descending callback used during the parse tree walk. If this * is a named AML opcode, enter into the namespace * ******************************************************************************/ @@ -536,7 +546,7 @@ LdNamespace1Begin ( * The name referenced by Scope(Name) must already exist at this point. * In other words, forward references for Scope() are not supported. * The only real reason for this is that the MS interpreter cannot - * handle this case. Perhaps someday this case can go away. + * handle this case. Perhaps someday this case can go away. */ Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, @@ -621,7 +631,7 @@ LdNamespace1Begin ( /* * However, switch the type to be an actual scope so * that compilation can continue without generating a whole - * cascade of additional errors. Open the new scope. + * cascade of additional errors. Open the new scope. */ Node->Type = ACPI_TYPE_LOCAL_SCOPE; Status = AcpiDsScopeStackPush (Node, ACPI_TYPE_LOCAL_SCOPE, @@ -652,8 +662,8 @@ LdNamespace1Begin ( Flags |= ACPI_NS_ERROR_IF_FOUND; /* - * Enter the named type into the internal namespace. We enter the name - * as we go downward in the parse tree. Any necessary subobjects that + * Enter the named type into the internal namespace. We enter the name + * as we go downward in the parse tree. Any necessary subobjects that * involve arguments to the opcode must be created as we go back up the * parse tree later. */ @@ -672,7 +682,8 @@ LdNamespace1Begin ( Node->Type = (UINT8) ObjectType; Status = AE_OK; } - else if (Node->Flags & ANOBJ_IS_EXTERNAL) + else if ((Node->Flags & ANOBJ_IS_EXTERNAL) && + (Op->Asl.ParseOpcode != PARSEOP_EXTERNAL)) { /* * Allow one create on an object or segment that was @@ -752,7 +763,143 @@ Exit: /******************************************************************************* * - * FUNCTION: LdNamespace1End + * FUNCTION: LdNamespace2Begin + * + * PARAMETERS: ASL_WALK_CALLBACK + * + * RETURN: Status + * + * DESCRIPTION: Descending callback used during the pass 2 parse tree walk. + * Second pass resolves some forward references. + * + * Notes: + * Currently only needs to handle the Alias operator. + * Could be used to allow forward references from the Scope() operator, but + * the MS interpreter does not allow this, so this compiler does not either. + * + ******************************************************************************/ + +static ACPI_STATUS +LdNamespace2Begin ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level, + void *Context) +{ + ACPI_WALK_STATE *WalkState = (ACPI_WALK_STATE *) Context; + ACPI_STATUS Status; + ACPI_NAMESPACE_NODE *Node; + ACPI_OBJECT_TYPE ObjectType; + BOOLEAN ForceNewScope = FALSE; + ACPI_PARSE_OBJECT *Arg; + char *Path; + ACPI_NAMESPACE_NODE *TargetNode; + + + ACPI_FUNCTION_NAME (LdNamespace2Begin); + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op %p [%s]\n", + Op, Op->Asl.ParseOpName)); + + + /* Ignore Ops with no namespace node */ + + Node = Op->Asl.Node; + if (!Node) + { + return (AE_OK); + } + + /* Get the type to determine if we should push the scope */ + + if ((Op->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) && + (Op->Asl.CompileFlags == NODE_IS_RESOURCE_DESC)) + { + ObjectType = ACPI_TYPE_LOCAL_RESOURCE; + } + else + { + ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode); + } + + /* Push scope for Resource Templates */ + + if (Op->Asl.ParseOpcode == PARSEOP_NAME) + { + if (Op->Asl.CompileFlags & NODE_IS_RESOURCE_DESC) + { + ForceNewScope = TRUE; + } + } + + /* Push the scope stack */ + + if (ForceNewScope || AcpiNsOpensScope (ObjectType)) + { + Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + } + + if (Op->Asl.ParseOpcode == PARSEOP_ALIAS) + { + /* Complete the alias node by getting and saving the target node */ + + /* First child is the alias target */ + + Arg = Op->Asl.Child; + + /* Get the target pathname */ + + Path = Arg->Asl.Namepath; + if (!Path) + { + Status = UtInternalizeName (Arg->Asl.ExternalName, &Path); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + } + + /* Get the NS node associated with the target. It must exist. */ + + Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY, + ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, + WalkState, &TargetNode); + if (ACPI_FAILURE (Status)) + { + if (Status == AE_NOT_FOUND) + { + AslError (ASL_ERROR, ASL_MSG_NOT_FOUND, Op, + Op->Asl.ExternalName); + + /* + * The name was not found, go ahead and create it. + * This prevents more errors later. + */ + Status = AcpiNsLookup (WalkState->ScopeInfo, Path, + ACPI_TYPE_ANY, + ACPI_IMODE_LOAD_PASS1, ACPI_NS_NO_UPSEARCH, + WalkState, &(Node)); + return (AE_OK); + } + + AslCoreSubsystemError (Op, Status, "Failure from lookup\n", FALSE); + return (AE_OK); + } + + /* Save the target node within the alias node */ + + Node->Object = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, TargetNode); + } + + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: LdCommonNamespaceEnd * * PARAMETERS: ASL_WALK_CALLBACK * @@ -764,7 +911,7 @@ Exit: ******************************************************************************/ static ACPI_STATUS -LdNamespace1End ( +LdCommonNamespaceEnd ( ACPI_PARSE_OBJECT *Op, UINT32 Level, void *Context) @@ -774,7 +921,7 @@ LdNamespace1End ( BOOLEAN ForceNewScope = FALSE; - ACPI_FUNCTION_NAME (LdNamespace1End); + ACPI_FUNCTION_NAME (LdCommonNamespaceEnd); /* We are only interested in opcodes that have an associated name */ @@ -812,7 +959,6 @@ LdNamespace1End ( if (ForceNewScope || AcpiNsOpensScope (ObjectType)) { - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s): Popping scope for Op [%s] %p\n", AcpiUtGetTypeName (ObjectType), Op->Asl.ParseOpName, Op)); diff --git a/sys/contrib/dev/acpica/compiler/asllookup.c b/sys/contrib/dev/acpica/compiler/asllookup.c index a970f12eead1..06113f07845d 100644 --- a/sys/contrib/dev/acpica/compiler/asllookup.c +++ b/sys/contrib/dev/acpica/compiler/asllookup.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: asllookup- Namespace lookup - * $Revision: 1.103 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -115,13 +114,13 @@ *****************************************************************************/ -#include <contrib/dev/acpica/compiler/aslcompiler.h> +#include "aslcompiler.h" #include "aslcompiler.y.h" -#include <contrib/dev/acpica/acparser.h> -#include <contrib/dev/acpica/amlcode.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/acdispat.h> +#include "acparser.h" +#include "amlcode.h" +#include "acnamesp.h" +#include "acdispat.h" #define _COMPONENT ACPI_COMPILER @@ -174,6 +173,21 @@ LkIsObjectUsed ( void *Context, void **ReturnValue); +static ACPI_STATUS +LsDoOnePathname ( + ACPI_HANDLE ObjHandle, + UINT32 Level, + void *Context, + void **ReturnValue); + +void +LsSetupNsList ( + void *Handle); + +ACPI_PARSE_OBJECT * +LkGetNameOp ( + ACPI_PARSE_OBJECT *Op); + /******************************************************************************* * @@ -416,8 +430,21 @@ LsDoOneNamespaceObject ( } +/******************************************************************************* + * + * FUNCTION: LsSetupNsList + * + * PARAMETERS: Handle - local file handle + * + * RETURN: None + * + * DESCRIPTION: Set the namespace output file to the input handle + * + ******************************************************************************/ + void -LsSetupNsList (void * Handle) +LsSetupNsList ( + void *Handle) { Gbl_NsOutputFlag = TRUE; @@ -427,6 +454,44 @@ LsSetupNsList (void * Handle) /******************************************************************************* * + * FUNCTION: LsDoOnePathname + * + * PARAMETERS: ACPI_WALK_CALLBACK + * + * RETURN: Status + * + * DESCRIPTION: Print the full pathname for a namespace node. + * + ******************************************************************************/ + +static ACPI_STATUS +LsDoOnePathname ( + ACPI_HANDLE ObjHandle, + UINT32 Level, + void *Context, + void **ReturnValue) +{ + ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; + ACPI_STATUS Status; + ACPI_BUFFER TargetPath; + + + TargetPath.Length = ACPI_ALLOCATE_LOCAL_BUFFER; + Status = AcpiNsHandleToPathname (Node, &TargetPath); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "%s\n", TargetPath.Pointer); + ACPI_FREE (TargetPath.Pointer); + + return (AE_OK); +} + + +/******************************************************************************* + * * FUNCTION: LsDisplayNamespace * * PARAMETERS: None @@ -463,6 +528,15 @@ LsDisplayNamespace ( Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, FALSE, LsDoOneNamespaceObject, NULL, NULL); + + /* Print the full pathname for each namespace node */ + + FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "\nNamespace pathnames\n\n"); + + Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, + ACPI_UINT32_MAX, FALSE, LsDoOnePathname, + NULL, NULL); + return (Status); } @@ -857,6 +931,17 @@ LkNamespaceLocateBegin ( } /* + * One special case: CondRefOf operator - we don't care if the name exists + * or not at this point, just ignore it, the point of the operator is to + * determine if the name exists at runtime. + */ + if ((Op->Asl.Parent) && + (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONDREFOF)) + { + return (AE_OK); + } + + /* * We must enable the "search-to-root" for single NameSegs, but * we have to be very careful about opening up scopes */ @@ -944,14 +1029,6 @@ LkNamespaceLocateBegin ( { /* The name doesn't exist, period */ - if ((Op->Asl.Parent) && - (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONDREFOF)) - { - /* Ignore not found if parent is CondRefOf */ - - return (AE_OK); - } - AslError (ASL_ERROR, ASL_MSG_NOT_EXIST, Op, Op->Asl.ExternalName); } @@ -964,14 +1041,6 @@ LkNamespaceLocateBegin ( { /* Gave full path, the object does not exist */ - if ((Op->Asl.Parent) && - (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONDREFOF)) - { - /* Ignore not found if parent is CondRefOf */ - - return (AE_OK); - } - AslError (ASL_ERROR, ASL_MSG_NOT_EXIST, Op, Op->Asl.ExternalName); } diff --git a/sys/contrib/dev/acpica/compiler/aslmain.c b/sys/contrib/dev/acpica/compiler/aslmain.c index 6fe94b453cbe..d00695524377 100644 --- a/sys/contrib/dev/acpica/compiler/aslmain.c +++ b/sys/contrib/dev/acpica/compiler/aslmain.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: aslmain - compiler main and utilities - * $Revision: 1.96 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -118,10 +117,8 @@ #define _DECLARE_GLOBALS -#include <contrib/dev/acpica/compiler/aslcompiler.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/actables.h> -#include <contrib/dev/acpica/acapps.h> +#include "aslcompiler.h" +#include "acapps.h" #ifdef _DEBUG #include <crtdbg.h> @@ -130,15 +127,6 @@ #define _COMPONENT ACPI_COMPILER ACPI_MODULE_NAME ("aslmain") -BOOLEAN AslToFile = TRUE; -BOOLEAN DoCompile = TRUE; -BOOLEAN DoSignon = TRUE; - -char hex[] = -{ - '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' -}; - /* Local prototypes */ static void @@ -157,14 +145,11 @@ static void AslInitialize ( void); -static void +static int AslCommandLine ( int argc, char **argv); -#ifdef _DEBUG -#include <crtdbg.h> -#endif /******************************************************************************* * @@ -184,7 +169,8 @@ Options ( { printf ("General Output:\n"); - printf (" -p <prefix> Specify filename prefix for all output files (including .aml)\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"); printf (" -vr Disable remarks\n"); @@ -212,7 +198,7 @@ Options ( printf (" -d [file] Disassemble or decode binary ACPI table to file (*.dsl)\n"); printf (" -dc [file] Disassemble AML and immediately compile it\n"); printf (" (Obtain DSDT from current system if no input file)\n"); - printf (" -e [file] Include ACPI table for external symbol resolution\n"); + printf (" -e [f1,f2] Include ACPI table(s) for external symbol resolution\n"); printf (" -2 Emit ACPI 2.0 compatible ASL code\n"); printf (" -g Get ACPI tables and write to files (*.dat)\n"); @@ -278,7 +264,7 @@ Usage ( void) { - printf ("Usage: %s [Options] [InputFile]\n\n", CompilerName); + printf ("Usage: %s [Options] [Files]\n\n", CompilerName); Options (); } @@ -334,13 +320,13 @@ AslInitialize ( * ******************************************************************************/ -static void +static int AslCommandLine ( int argc, char **argv) { BOOLEAN BadCommandLine = FALSE; - ACPI_NATIVE_INT j; + int j; /* Minimum command line contains at least one option or an input file */ @@ -400,7 +386,7 @@ AslCommandLine ( switch (AcpiGbl_Optarg[0]) { case '^': - DoCompile = FALSE; + Gbl_DoCompile = FALSE; break; case 'c': @@ -434,7 +420,7 @@ AslCommandLine ( /* Get all ACPI tables */ Gbl_GetAllTables = TRUE; - DoCompile = FALSE; + Gbl_DoCompile = FALSE; break; @@ -635,6 +621,12 @@ AslCommandLine ( switch (AcpiGbl_Optarg[0]) { + case 'a': + /* Disable All error/warning messages */ + + Gbl_NoErrors = TRUE; + break; + case 'i': /* Less verbose error messages */ @@ -650,7 +642,7 @@ AslCommandLine ( break; case 's': - DoSignon = FALSE; + Gbl_DoSignon = FALSE; break; default: @@ -699,9 +691,7 @@ AslCommandLine ( /* Next parameter must be the input filename */ - Gbl_Files[ASL_FILE_INPUT].Filename = argv[AcpiGbl_Optind]; - - if (!Gbl_Files[ASL_FILE_INPUT].Filename && + if (!argv[AcpiGbl_Optind] && !Gbl_DisasmFlag && !Gbl_GetAllTables) { @@ -709,7 +699,7 @@ AslCommandLine ( BadCommandLine = TRUE; } - if (DoSignon) + if (Gbl_DoSignon) { AslCompilerSignon (ASL_FILE_STDOUT); } @@ -723,11 +713,7 @@ AslCommandLine ( exit (1); } - if ((AcpiGbl_Optind + 1) < argc) - { - printf ("Warning: extra arguments (%d) after input filename are ignored\n\n", - argc - AcpiGbl_Optind - 1); - } + return (AcpiGbl_Optind); } @@ -739,8 +725,8 @@ AslCommandLine ( * * RETURN: Program termination code * - * DESCRIPTION: C main routine for the Asl Compiler. Handle command line - * options and begin the compile. + * DESCRIPTION: C main routine for the Asl Compiler. Handle command line + * options and begin the compile for each file on the command line * ******************************************************************************/ @@ -750,7 +736,7 @@ main ( char **argv) { ACPI_STATUS Status; - char *Prefix; + int Index; #ifdef _DEBUG @@ -761,105 +747,31 @@ main ( /* Init and command line */ AslInitialize (); - AslCommandLine (argc, argv); - - /* - * If -p not specified, we will use the input filename as the - * output filename prefix - */ - Status = FlSplitInputPathname (Gbl_Files[ASL_FILE_INPUT].Filename, - &Gbl_DirectoryPath, &Prefix); - if (ACPI_FAILURE (Status)) - { - return -1; - } + Index = AslCommandLine (argc, argv); - if (Gbl_UseDefaultAmlFilename) - { - Gbl_OutputFilenamePrefix = Prefix; - } - - /* AML Disassembly (Optional) */ + /* Options that have no additional parameters or pathnames */ - if (Gbl_DisasmFlag || Gbl_GetAllTables) + if (Gbl_GetAllTables) { - /* ACPI CA subsystem initialization */ - - Status = AdInitialize (); + Status = AslDoOneFile (NULL); if (ACPI_FAILURE (Status)) { - return -1; - } - - Status = AcpiAllocateRootTable (4); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not initialize ACPI Table Manager, %s\n", - AcpiFormatException (Status)); - return -1; - } - - /* This is where the disassembly happens */ - - AcpiGbl_DbOpt_disasm = TRUE; - Status = AdAmlDisassemble (AslToFile, - Gbl_Files[ASL_FILE_INPUT].Filename, - Gbl_OutputFilenamePrefix, - &Gbl_Files[ASL_FILE_INPUT].Filename, - Gbl_GetAllTables); - if (ACPI_FAILURE (Status)) - { - return -1; - } - - /* - * Gbl_Files[ASL_FILE_INPUT].Filename was replaced with the - * .DSL disassembly file, which can now be compiled if requested - */ - if (DoCompile) - { - AcpiOsPrintf ("\nCompiling \"%s\"\n", - Gbl_Files[ASL_FILE_INPUT].Filename); + return (-1); } + return (0); } - /* - * ASL Compilation (Optional) - */ - if (DoCompile) - { - /* - * If -p not specified, we will use the input filename as the - * output filename prefix - */ - Status = FlSplitInputPathname (Gbl_Files[ASL_FILE_INPUT].Filename, - &Gbl_DirectoryPath, &Prefix); - if (ACPI_FAILURE (Status)) - { - return -1; - } - - if (Gbl_UseDefaultAmlFilename) - { - Gbl_OutputFilenamePrefix = Prefix; - } + /* Process each pathname/filename in the list, with possible wildcards */ - /* ACPI CA subsystem initialization (Must be re-initialized) */ - - Status = AcpiOsInitialize (); - AcpiUtInitGlobals (); - Status = AcpiUtMutexInitialize (); + while (argv[Index]) + { + Status = AslDoOnePathname (argv[Index]); if (ACPI_FAILURE (Status)) { - return -1; + return (-1); } - Status = AcpiNsRootInitialize (); - if (ACPI_FAILURE (Status)) - { - return -1; - } - Status = CmDoCompile (); + Index++; } return (0); diff --git a/sys/contrib/dev/acpica/compiler/aslmap.c b/sys/contrib/dev/acpica/compiler/aslmap.c index 5384d0bfbdb1..f96e78c14126 100644 --- a/sys/contrib/dev/acpica/compiler/aslmap.c +++ b/sys/contrib/dev/acpica/compiler/aslmap.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: aslmap - parser to AML opcode mapping table - * $Revision: 1.87 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,9 +115,9 @@ *****************************************************************************/ -#include <contrib/dev/acpica/compiler/aslcompiler.h> -#include <contrib/dev/acpica/amlcode.h> -#include <contrib/dev/acpica/acparser.h> +#include "aslcompiler.h" +#include "amlcode.h" +#include "acparser.h" #define _COMPONENT ACPI_COMPILER @@ -205,7 +204,7 @@ MpDisplayReservedNames ( else { printf ("Method with %d arguments, ", - ReservedMethods[i].NumArguments); + ReservedMethods[i].NumArguments & 0x0F); if (ReservedMethods[i].Flags & ASL_RSVD_RETURN_VALUE) { @@ -266,6 +265,7 @@ const ASL_RESERVED_INFO ReservedMethods[] = { {"_ALR", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ {"_ALT", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.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}, @@ -343,6 +343,7 @@ const ASL_RESERVED_INFO ReservedMethods[] = { {"_MIN", 0, ASL_RSVD_RESOURCE_NAME}, {"_MLS", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ {"_MSG", 1, 0}, + {"_MTP", 0, ASL_RSVD_RESOURCE_NAME}, {"_OFF", 0, 0}, {"_ON_", 0, 0}, {"_OS_", 0, ASL_RSVD_RETURN_VALUE}, @@ -403,7 +404,7 @@ const ASL_RESERVED_INFO ReservedMethods[] = { {"_S4W", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */ {"_SB_", 0, ASL_RSVD_SCOPE}, {"_SBS", 0, ASL_RSVD_RETURN_VALUE}, - {"_SCP", 1, 0}, + {"_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}, {"_SHR", 0, ASL_RSVD_RESOURCE_NAME}, diff --git a/sys/contrib/dev/acpica/compiler/aslopcodes.c b/sys/contrib/dev/acpica/compiler/aslopcodes.c index ae91dc8c1b85..e38626642794 100644 --- a/sys/contrib/dev/acpica/compiler/aslopcodes.c +++ b/sys/contrib/dev/acpica/compiler/aslopcodes.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: aslopcode - AML opcode generation - * $Revision: 1.74 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,9 +115,9 @@ *****************************************************************************/ -#include <contrib/dev/acpica/compiler/aslcompiler.h> +#include "aslcompiler.h" #include "aslcompiler.y.h" -#include <contrib/dev/acpica/amlcode.h> +#include "amlcode.h" #define _COMPONENT ACPI_COMPILER ACPI_MODULE_NAME ("aslopcodes") @@ -546,7 +545,7 @@ OpcDoEisaId ( UINT32 BigEndianId; char *InString; ACPI_STATUS Status = AE_OK; - ACPI_NATIVE_UINT i; + UINT32 i; InString = (char *) Op->Asl.Value.String; @@ -642,7 +641,7 @@ OpcDoUuId ( char *InString; char *Buffer; ACPI_STATUS Status = AE_OK; - ACPI_NATIVE_UINT i; + UINT32 i; ACPI_PARSE_OBJECT *NewOp; diff --git a/sys/contrib/dev/acpica/compiler/asloperands.c b/sys/contrib/dev/acpica/compiler/asloperands.c index 8f4500e1d75a..c354855dd61f 100644 --- a/sys/contrib/dev/acpica/compiler/asloperands.c +++ b/sys/contrib/dev/acpica/compiler/asloperands.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: asloperands - AML operand processing - * $Revision: 1.61 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,9 +115,9 @@ *****************************************************************************/ -#include <contrib/dev/acpica/compiler/aslcompiler.h> +#include "aslcompiler.h" #include "aslcompiler.y.h" -#include <contrib/dev/acpica/amlcode.h> +#include "amlcode.h" #define _COMPONENT ACPI_COMPILER ACPI_MODULE_NAME ("asloperands") @@ -948,7 +947,8 @@ OpnDoDefinitionBlock ( { ACPI_PARSE_OBJECT *Child; ACPI_SIZE Length; - ACPI_NATIVE_UINT i; + UINT32 i; + char *Filename; /* @@ -966,7 +966,19 @@ OpnDoDefinitionBlock ( *Child->Asl.Value.Buffer && (Gbl_UseDefaultAmlFilename)) { - Gbl_OutputFilenamePrefix = (char *) Child->Asl.Value.Buffer; + /* + * We will use the AML filename that is embedded in the source file + * for the output filename. + */ + Filename = ACPI_ALLOCATE (strlen (Gbl_DirectoryPath) + + strlen ((char *) Child->Asl.Value.Buffer) + 1); + + /* Prepend the current directory path */ + + strcpy (Filename, Gbl_DirectoryPath); + strcat (Filename, (char *) Child->Asl.Value.Buffer); + + Gbl_OutputFilenamePrefix = Filename; } Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; diff --git a/sys/contrib/dev/acpica/compiler/aslopt.c b/sys/contrib/dev/acpica/compiler/aslopt.c index 2ea9aeadbcb5..3013f4cbd240 100644 --- a/sys/contrib/dev/acpica/compiler/aslopt.c +++ b/sys/contrib/dev/acpica/compiler/aslopt.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: aslopt- Compiler optimizations - * $Revision: 1.26 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -115,12 +114,12 @@ *****************************************************************************/ -#include <contrib/dev/acpica/compiler/aslcompiler.h> +#include "aslcompiler.h" #include "aslcompiler.y.h" -#include <contrib/dev/acpica/acparser.h> -#include <contrib/dev/acpica/amlcode.h> -#include <contrib/dev/acpica/acnamesp.h> +#include "acparser.h" +#include "amlcode.h" +#include "acnamesp.h" #define _COMPONENT ACPI_COMPILER @@ -288,9 +287,9 @@ OptBuildShortestPath ( { UINT32 NumCommonSegments; UINT32 MaxCommonSegments; - ACPI_NATIVE_UINT Index; + UINT32 Index; UINT32 NumCarats; - ACPI_NATIVE_UINT i; + UINT32 i; char *NewPath; char *NewPathExternal; ACPI_NAMESPACE_NODE *Node; @@ -437,7 +436,7 @@ OptBuildShortestPath ( { ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " NOT SHORTER (New %u old %u)", - ACPI_STRLEN (NewPath), AmlNameStringLength)); + (UINT32) ACPI_STRLEN (NewPath), (UINT32) AmlNameStringLength)); ACPI_FREE (NewPathExternal); return (AE_NOT_FOUND); } @@ -753,8 +752,8 @@ OptOptimizeNamePath ( ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, "%37s (%2u) ==> %-32s(%2u) %-32s", - (char *) CurrentPath.Pointer, CurrentPath.Length, - (char *) TargetPath.Pointer, TargetPath.Length, ExternalNameString)); + (char *) CurrentPath.Pointer, (UINT32) CurrentPath.Length, + (char *) TargetPath.Pointer, (UINT32) TargetPath.Length, ExternalNameString)); ACPI_FREE (ExternalNameString); @@ -812,7 +811,7 @@ OptOptimizeNamePath ( OptTotal += HowMuchShorter; ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " REDUCED %2u (%u)", - HowMuchShorter, OptTotal)); + (UINT32) HowMuchShorter, OptTotal)); if (Flags & AML_NAMED) { diff --git a/sys/contrib/dev/acpica/compiler/aslresource.c b/sys/contrib/dev/acpica/compiler/aslresource.c index c33637eb73f6..ceebd9c1e8d3 100644 --- a/sys/contrib/dev/acpica/compiler/aslresource.c +++ b/sys/contrib/dev/acpica/compiler/aslresource.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: aslresource - Resource templates and descriptors - * $Revision: 1.43 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,9 +115,9 @@ *****************************************************************************/ -#include <contrib/dev/acpica/compiler/aslcompiler.h> +#include "aslcompiler.h" #include "aslcompiler.y.h" -#include <contrib/dev/acpica/amlcode.h> +#include "amlcode.h" #define _COMPONENT ACPI_COMPILER diff --git a/sys/contrib/dev/acpica/compiler/aslrestype1.c b/sys/contrib/dev/acpica/compiler/aslrestype1.c index e3174369cc46..edc84054039e 100644 --- a/sys/contrib/dev/acpica/compiler/aslrestype1.c +++ b/sys/contrib/dev/acpica/compiler/aslrestype1.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: aslrestype1 - Short (type1) resource templates and descriptors - * $Revision: 1.40 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,7 +115,7 @@ *****************************************************************************/ -#include <contrib/dev/acpica/compiler/aslcompiler.h> +#include "aslcompiler.h" #include "aslcompiler.y.h" #define _COMPONENT ACPI_COMPILER diff --git a/sys/contrib/dev/acpica/compiler/aslrestype2.c b/sys/contrib/dev/acpica/compiler/aslrestype2.c index c42e4a99b602..7074a5576eca 100644 --- a/sys/contrib/dev/acpica/compiler/aslrestype2.c +++ b/sys/contrib/dev/acpica/compiler/aslrestype2.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: aslrestype2 - Long (type2) resource templates and descriptors - * $Revision: 1.51 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,7 +115,7 @@ *****************************************************************************/ -#include <contrib/dev/acpica/compiler/aslcompiler.h> +#include "aslcompiler.h" #include "aslcompiler.y.h" #define _COMPONENT ACPI_COMPILER @@ -2488,20 +2487,25 @@ RsDoInterruptDescriptor ( InitializerOp = Op->Asl.Child; StringLength = RsGetStringDataLength (InitializerOp); - if (StringLength) - { - /* Make room for the ResourceSourceIndex */ - - OptionIndex++; - } /* Count the interrupt numbers */ for (i = 0; InitializerOp; i++) { InitializerOp = ASL_GET_PEER_NODE (InitializerOp); + if (i <= 6) { + if (i == 3 && + InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) + { + /* + * ResourceSourceIndex was specified, always make room for + * it, even if the ResourceSource was omitted. + */ + OptionIndex++; + } + continue; } @@ -2636,6 +2640,14 @@ RsDoInterruptDescriptor ( if (i == 7) { + if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) + { + /* Must be at least one interrupt */ + + AslError (ASL_ERROR, ASL_MSG_EX_INTERRUPT_LIST_MIN, + InitializerOp, NULL); + } + /* Check now for duplicates in list */ RsCheckListForDuplicates (InitializerOp); diff --git a/sys/contrib/dev/acpica/compiler/aslstartup.c b/sys/contrib/dev/acpica/compiler/aslstartup.c new file mode 100644 index 000000000000..87e102bd9ee0 --- /dev/null +++ b/sys/contrib/dev/acpica/compiler/aslstartup.c @@ -0,0 +1,446 @@ + +/****************************************************************************** + * + * Module Name: aslstartup - Compiler startup routines, called from main + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2009, 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 "aslcompiler.h" +#include "actables.h" +#include "acapps.h" + +#define _COMPONENT ACPI_COMPILER + ACPI_MODULE_NAME ("aslstartup") + + +#define ASL_MAX_FILES 256 +char *FileList[ASL_MAX_FILES]; +int FileCount; +BOOLEAN AslToFile = TRUE; + + +/* Local prototypes */ + +static void +AslInitializeGlobals ( + void); + +static char ** +AsDoWildcard ( + char *DirectoryPathname, + char *FileSpecifier); + + +/******************************************************************************* + * + * FUNCTION: AslInitializeGlobals + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Re-initialize globals needed to restart the compiler. This + * allows multiple files to be disassembled and/or compiled. + * + ******************************************************************************/ + +static void +AslInitializeGlobals ( + void) +{ + UINT32 i; + + + /* Init compiler globals */ + + Gbl_CurrentColumn = 0; + Gbl_CurrentLineNumber = 1; + Gbl_LogicalLineNumber = 1; + Gbl_CurrentLineOffset = 0; + Gbl_LineBufPtr = Gbl_CurrentLineBuffer; + + Gbl_ErrorLog = NULL; + Gbl_NextError = NULL; + + AslGbl_NextEvent = 0; + for (i = 0; i < ASL_NUM_REPORT_LEVELS; i++) + { + Gbl_ExceptionCount[i] = 0; + } + + Gbl_Files[ASL_FILE_AML_OUTPUT].Filename = NULL; +} + + +/****************************************************************************** + * + * FUNCTION: AsDoWildcard + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Process files via wildcards. This function is for the Windows + * case only. + * + ******************************************************************************/ + +static char ** +AsDoWildcard ( + char *DirectoryPathname, + char *FileSpecifier) +{ +#ifdef WIN32 + void *DirInfo; + char *Filename; + + + FileCount = 0; + + /* Open parent directory */ + + DirInfo = AcpiOsOpenDirectory (DirectoryPathname, FileSpecifier, REQUEST_FILE_ONLY); + if (!DirInfo) + { + /* Either the directory of file does not exist */ + + Gbl_Files[ASL_FILE_INPUT].Filename = FileSpecifier; + FlFileError (ASL_FILE_INPUT, ASL_MSG_OPEN); + AslAbort (); + } + + /* Process each file that matches the wildcard specification */ + + while ((Filename = AcpiOsGetNextFilename (DirInfo))) + { + /* Add the filename to the file list */ + + FileList[FileCount] = AcpiOsAllocate (strlen (Filename) + 1); + strcpy (FileList[FileCount], Filename); + FileCount++; + + if (FileCount >= ASL_MAX_FILES) + { + printf ("Max files reached\n"); + FileList[0] = NULL; + return (FileList); + } + } + + /* Cleanup */ + + AcpiOsCloseDirectory (DirInfo); + FileList[FileCount] = NULL; + return (FileList); + +#else + /* + * Linux/Unix cases - Wildcards are expanded by the shell automatically. + * Just return the filename in a null terminated list + */ + FileList[0] = AcpiOsAllocate (strlen (FileSpecifier) + 1); + strcpy (FileList[0], FileSpecifier); + FileList[1] = NULL; + + return (FileList); +#endif +} + + +/******************************************************************************* + * + * FUNCTION: AslDoOneFile + * + * PARAMETERS: Filename - Name of the file + * + * RETURN: Status + * + * DESCRIPTION: Process a single file - either disassemble, compile, or both + * + ******************************************************************************/ + +ACPI_STATUS +AslDoOneFile ( + char *Filename) +{ + ACPI_STATUS Status; + + + Gbl_Files[ASL_FILE_INPUT].Filename = Filename; + + /* Re-initialize "some" compiler globals */ + + AslInitializeGlobals (); + + /* + * AML Disassembly (Optional) + */ + if (Gbl_DisasmFlag || Gbl_GetAllTables) + { + /* ACPI CA subsystem initialization */ + + Status = AdInitialize (); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + Status = AcpiAllocateRootTable (4); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("Could not initialize ACPI Table Manager, %s\n", + AcpiFormatException (Status)); + return (Status); + } + + /* This is where the disassembly happens */ + + AcpiGbl_DbOpt_disasm = TRUE; + Status = AdAmlDisassemble (AslToFile, + Gbl_Files[ASL_FILE_INPUT].Filename, + Gbl_OutputFilenamePrefix, + &Gbl_Files[ASL_FILE_INPUT].Filename, + Gbl_GetAllTables); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* Shutdown compiler and ACPICA subsystem */ + + AeClearErrorLog (); + AcpiTerminate (); + + /* + * Gbl_Files[ASL_FILE_INPUT].Filename was replaced with the + * .DSL disassembly file, which can now be compiled if requested + */ + if (Gbl_DoCompile) + { + AcpiOsPrintf ("\nCompiling \"%s\"\n", + Gbl_Files[ASL_FILE_INPUT].Filename); + } + } + + /* + * ASL Compilation (Optional) + */ + if (Gbl_DoCompile) + { + /* + * If -p not specified, we will use the input filename as the + * output filename prefix + */ + if (Gbl_UseDefaultAmlFilename) + { + Gbl_OutputFilenamePrefix = Gbl_Files[ASL_FILE_INPUT].Filename; + } + + /* ACPI CA subsystem initialization (Must be re-initialized) */ + + Status = AdInitialize (); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + Status = CmDoCompile (); + AcpiTerminate (); + + /* + * Return non-zero exit code if there have been errors, unless the + * global ignore error flag has been set + */ + if ((Gbl_ExceptionCount[ASL_ERROR] > 0) && (!Gbl_IgnoreErrors)) + { + return (AE_ERROR); + } + + AeClearErrorLog (); + } + + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: AslDoOnePathname + * + * PARAMETERS: Pathname - Full pathname, possibly with wildcards + * + * RETURN: Status + * + * DESCRIPTION: Process one pathname, possible terminated with a wildcard + * specification. If a wildcard, it is expanded and the multiple + * files are processed. + * + ******************************************************************************/ + +ACPI_STATUS +AslDoOnePathname ( + char *Pathname) +{ + ACPI_STATUS Status; + char **FileList; + char *Filename; + char *FullPathname; + + + /* Split incoming path into a directory/filename combo */ + + Status = FlSplitInputPathname (Pathname, &Gbl_DirectoryPath, &Filename); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* Expand possible wildcard into a file list (Windows/DOS only) */ + + FileList = AsDoWildcard (Gbl_DirectoryPath, Filename); + while (*FileList) + { + FullPathname = ACPI_ALLOCATE ( + strlen (Gbl_DirectoryPath) + strlen (*FileList) + 1); + + /* Construct a full path to the file */ + + strcpy (FullPathname, Gbl_DirectoryPath); + strcat (FullPathname, *FileList); + + /* + * If -p not specified, we will use the input filename as the + * output filename prefix + */ + if (Gbl_UseDefaultAmlFilename) + { + Gbl_OutputFilenamePrefix = FullPathname; + } + + Status = AslDoOneFile (FullPathname); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ACPI_FREE (FullPathname); + ACPI_FREE (*FileList); + *FileList = NULL; + FileList++; + } + + ACPI_FREE (Gbl_DirectoryPath); + ACPI_FREE (Filename); + return (AE_OK); +} + diff --git a/sys/contrib/dev/acpica/compiler/aslstubs.c b/sys/contrib/dev/acpica/compiler/aslstubs.c index eb6b12a44219..cb822e57ebe6 100644 --- a/sys/contrib/dev/acpica/compiler/aslstubs.c +++ b/sys/contrib/dev/acpica/compiler/aslstubs.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: aslstubs - Stubs used to link to Aml interpreter - * $Revision: 1.20 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -115,10 +114,11 @@ * *****************************************************************************/ -#include <stdio.h> -#include <contrib/dev/acpica/compiler/aslcompiler.h> -#include <contrib/dev/acpica/acdispat.h> -#include <contrib/dev/acpica/actables.h> +#include "aslcompiler.h" +#include "acdispat.h" +#include "actables.h" +#include "acevents.h" +#include "acinterp.h" #define _COMPONENT ACPI_COMPILER ACPI_MODULE_NAME ("aslstubs") @@ -137,6 +137,24 @@ AeLocalGetRootPointer ( } ACPI_STATUS +AcpiHwReadPort ( + ACPI_IO_ADDRESS Address, + UINT32 *Value, + UINT32 Width) +{ + return (AE_OK); +} + +ACPI_STATUS +AcpiHwWritePort ( + ACPI_IO_ADDRESS Address, + UINT32 Value, + UINT32 Width) +{ + return (AE_OK); +} + +ACPI_STATUS AcpiDsMethodError ( ACPI_STATUS Status, ACPI_WALK_STATE *WalkState) @@ -146,7 +164,7 @@ AcpiDsMethodError ( ACPI_STATUS AcpiDsMethodDataGetValue ( - UINT16 Opcode, + UINT8 Type, UINT32 Index, ACPI_WALK_STATE *WalkState, ACPI_OPERAND_OBJECT **DestDesc) @@ -156,7 +174,7 @@ AcpiDsMethodDataGetValue ( ACPI_STATUS AcpiDsMethodDataGetNode ( - UINT16 Opcode, + UINT8 Type, UINT32 Index, ACPI_WALK_STATE *WalkState, ACPI_NAMESPACE_NODE **Node) @@ -166,7 +184,7 @@ AcpiDsMethodDataGetNode ( ACPI_STATUS AcpiDsStoreObjectToLocal ( - UINT16 Opcode, + UINT8 Type, UINT32 Index, ACPI_OPERAND_OBJECT *SrcDesc, ACPI_WALK_STATE *WalkState) @@ -197,14 +215,14 @@ AcpiEvIsNotifyObject ( } ACPI_STATUS -AcpiEvAcquireGlobalLock( - UINT32 Timeout) +AcpiEvAcquireGlobalLock ( + UINT16 Timeout) { return (AE_OK); } ACPI_STATUS -AcpiEvReleaseGlobalLock( +AcpiEvReleaseGlobalLock ( void) { return (AE_OK); @@ -273,7 +291,7 @@ AcpiTbFindTable ( char *Signature, char *OemId, char *OemTableId, - ACPI_NATIVE_UINT *TableIndex) + UINT32 *TableIndex) { return (AE_SUPPORT); } diff --git a/sys/contrib/dev/acpica/compiler/asltransform.c b/sys/contrib/dev/acpica/compiler/asltransform.c index b76a26675426..eb4546818c35 100644 --- a/sys/contrib/dev/acpica/compiler/asltransform.c +++ b/sys/contrib/dev/acpica/compiler/asltransform.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: asltransform - Parse tree transforms - * $Revision: 1.42 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,7 +115,7 @@ *****************************************************************************/ -#include <contrib/dev/acpica/compiler/aslcompiler.h> +#include "aslcompiler.h" #include "aslcompiler.y.h" #define _COMPONENT ACPI_COMPILER @@ -468,6 +467,7 @@ TrDoSwitch ( ACPI_PARSE_OBJECT *Peer; ACPI_PARSE_OBJECT *NewOp; ACPI_PARSE_OBJECT *NewOp2; + ACPI_PARSE_OBJECT *MethodOp; char *PredicateValueName; UINT16 Index; UINT32 Btype; @@ -729,18 +729,32 @@ TrDoSwitch ( { Next = Next->Asl.Parent; } + MethodOp = Next; NewOp->Asl.CompileFlags |= NODE_COMPILER_EMITTED; NewOp->Asl.Parent = Next; /* Insert name after the method name and arguments */ - Next = Next->Asl.Child; - Next = Next->Asl.Next; - Next = Next->Asl.Next; - Next = Next->Asl.Next; - Next = Next->Asl.Next; - Next = Next->Asl.Next; + Next = Next->Asl.Child; /* Name */ + Next = Next->Asl.Next; /* NumArgs */ + Next = Next->Asl.Next; /* SerializeRule */ + + /* + * If method is not Serialized, we must make is so, because of the way + * that Switch() must be implemented -- we cannot allow multiple threads + * to execute this method concurrently since we need to create local + * temporary name(s). + */ + if (Next->Asl.ParseOpcode != PARSEOP_SERIALIZERULE_SERIAL) + { + AslError (ASL_REMARK, ASL_MSG_SERIALIZED, MethodOp, "Due to use of Switch operator"); + Next->Asl.ParseOpcode = PARSEOP_SERIALIZERULE_SERIAL; + } + + Next = Next->Asl.Next; /* SyncLevel */ + Next = Next->Asl.Next; /* ReturnType */ + Next = Next->Asl.Next; /* ParameterTypes */ TrAmlInsertPeer (Next, NewOp); TrAmlInitLineNumbers (NewOp, Next); @@ -763,7 +777,7 @@ TrDoSwitch ( case ACPI_BTYPE_STRING: NewOp2->Asl.Next = TrCreateValuedLeafNode (PARSEOP_STRING_LITERAL, - (ACPI_INTEGER) ""); + (ACPI_INTEGER) ACPI_TO_INTEGER ("")); break; case ACPI_BTYPE_BUFFER: diff --git a/sys/contrib/dev/acpica/compiler/asltree.c b/sys/contrib/dev/acpica/compiler/asltree.c index db9893dd1cfe..30f59ee46d85 100644 --- a/sys/contrib/dev/acpica/compiler/asltree.c +++ b/sys/contrib/dev/acpica/compiler/asltree.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: asltree - parse tree management - * $Revision: 1.63 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,7 +115,7 @@ *****************************************************************************/ -#include <contrib/dev/acpica/compiler/aslcompiler.h> +#include "aslcompiler.h" #include "aslcompiler.y.h" #define _COMPONENT ACPI_COMPILER @@ -914,6 +913,7 @@ TrLinkPeerNodes ( This->Asl.Next = Next; This = Next; } + va_end (ap); DbgPrint (ASL_PARSE_OUTPUT,"\n\n"); return (Start); diff --git a/sys/contrib/dev/acpica/compiler/asltypes.h b/sys/contrib/dev/acpica/compiler/asltypes.h index 51beeb233ace..6b3c4243bb00 100644 --- a/sys/contrib/dev/acpica/compiler/asltypes.h +++ b/sys/contrib/dev/acpica/compiler/asltypes.h @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: asltypes.h - compiler data types and struct definitions - * $Revision: 1.89 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -340,6 +339,7 @@ typedef enum ASL_MSG_EARLY_EOF, ASL_MSG_ENCODING_LENGTH, ASL_MSG_EX_INTERRUPT_LIST, + ASL_MSG_EX_INTERRUPT_LIST_MIN, ASL_MSG_EX_INTERRUPT_NUMBER, ASL_MSG_FIELD_ACCESS_WIDTH, ASL_MSG_FIELD_UNIT_ACCESS_WIDTH, @@ -422,7 +422,11 @@ typedef enum ASL_MSG_RESULT_NOT_USED, ASL_MSG_NOT_REFERENCED, ASL_MSG_NON_ZERO, - ASL_MSG_STRING_LENGTH + ASL_MSG_STRING_LENGTH, + ASL_MSG_SERIALIZED, + ASL_MSG_COMPILER_RESERVED, + ASL_MSG_NAMED_OBJECT_IN_WHILE, + ASL_MSG_LOCAL_OUTSIDE_METHOD } ASL_MESSAGE_IDS; @@ -454,6 +458,7 @@ char *AslMessages [] = { /* ASL_MSG_EARLY_EOF */ "Premature end-of-file reached", /* ASL_MSG_ENCODING_LENGTH */ "Package length too long to encode", /* ASL_MSG_EX_INTERRUPT_LIST */ "Too many interrupts (255 max)", +/* ASL_MSG_EX_INTERRUPT_LIST_MIN */ "Too few interrupts (1 minimum required)", /* ASL_MSG_EX_INTERRUPT_NUMBER */ "Invalid interrupt number (must be 32 bits)", /* ASL_MSG_FIELD_ACCESS_WIDTH */ "Access width is greater than region size", /* ASL_MSG_FIELD_UNIT_ACCESS_WIDTH */ "Access width of Field Unit extends beyond region limit", @@ -510,7 +515,7 @@ char *AslMessages [] = { /* ASL_MSG_RESERVED_OPERAND_TYPE */ "Invalid operand type for reserved name, must be", /* ASL_MSG_RESERVED_RETURN_VALUE */ "Reserved method must return a value", /* ASL_MSG_RESERVED_USE */ "Invalid use of reserved name", -/* ASL_MSG_RESERVED_WORD */ "Use of reserved word", +/* ASL_MSG_RESERVED_WORD */ "Use of reserved name", /* ASL_MSG_RESOURCE_FIELD */ "Resource field name cannot be used as a target", /* ASL_MSG_RESOURCE_INDEX */ "Missing ResourceSourceIndex (required)", /* ASL_MSG_RESOURCE_LIST */ "Too many resource items (internal error)", @@ -536,7 +541,11 @@ char *AslMessages [] = { /* ASL_MSG_RESULT_NOT_USED */ "Result is not used, operator has no effect", /* ASL_MSG_NOT_REFERENCED */ "Namespace object is not referenced", /* ASL_MSG_NON_ZERO */ "Operand evaluates to zero", -/* ASL_MSG_STRING_LENGTH */ "String literal too long" +/* ASL_MSG_STRING_LENGTH */ "String literal too long", +/* ASL_MSG_SERIALIZED */ "Control Method marked Serialized", +/* ASL_MSG_COMPILER_RESERVED */ "Use of compiler reserved name", +/* ASL_MSG_NAMED_OBJECT_IN_WHILE */ "Creating a named object in a While loop", +/* ASL_MSG_LOCAL_OUTSIDE_METHOD */ "Local or Arg used outside a control method" }; diff --git a/sys/contrib/dev/acpica/compiler/aslutils.c b/sys/contrib/dev/acpica/compiler/aslutils.c index 5acf1fc6a49a..ecba7c32cf9b 100644 --- a/sys/contrib/dev/acpica/compiler/aslutils.c +++ b/sys/contrib/dev/acpica/compiler/aslutils.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: aslutils -- compiler utilities - * $Revision: 1.72 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,10 +115,10 @@ *****************************************************************************/ -#include <contrib/dev/acpica/compiler/aslcompiler.h> +#include "aslcompiler.h" #include "aslcompiler.y.h" -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/amlcode.h> +#include "acnamesp.h" +#include "amlcode.h" #define _COMPONENT ACPI_COMPILER ACPI_MODULE_NAME ("aslutils") @@ -131,6 +130,12 @@ static const char * const *yytname = &AslCompilername[254]; extern const char * const yytname[]; #endif +char HexLookup[] = +{ + '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' +}; + + /* Local prototypes */ static ACPI_STATUS @@ -333,8 +338,8 @@ UtConvertByteToHex ( Buffer[0] = '0'; Buffer[1] = 'x'; - Buffer[2] = (UINT8) hex[(RawByte >> 4) & 0xF]; - Buffer[3] = (UINT8) hex[RawByte & 0xF]; + Buffer[2] = (UINT8) HexLookup[(RawByte >> 4) & 0xF]; + Buffer[3] = (UINT8) HexLookup[RawByte & 0xF]; } @@ -359,8 +364,8 @@ UtConvertByteToAsmHex ( { Buffer[0] = '0'; - Buffer[1] = (UINT8) hex[(RawByte >> 4) & 0xF]; - Buffer[2] = (UINT8) hex[RawByte & 0xF]; + Buffer[1] = (UINT8) HexLookup[(RawByte >> 4) & 0xF]; + Buffer[2] = (UINT8) HexLookup[RawByte & 0xF]; Buffer[3] = 'h'; } @@ -530,7 +535,7 @@ UtDisplaySummary ( if ((Gbl_ExceptionCount[ASL_ERROR] == 0) || (Gbl_IgnoreErrors)) { FlPrintFile (FileId, - "AML Output: %s - %d bytes %d named objects %d executable opcodes\n\n", + "AML Output: %s - %d bytes, %d named objects, %d executable opcodes\n\n", Gbl_Files[ASL_FILE_AML_OUTPUT].Filename, Gbl_TableLength, TotalNamedObjects, TotalExecutableOpcodes); } diff --git a/sys/contrib/dev/acpica/dbcmds.c b/sys/contrib/dev/acpica/debugger/dbcmds.c index 70120ff7e9a8..9acf002b1866 100644 --- a/sys/contrib/dev/acpica/dbcmds.c +++ b/sys/contrib/dev/acpica/debugger/dbcmds.c @@ -1,7 +1,6 @@ /******************************************************************************* * * Module Name: dbcmds - debug commands and output routines - * $Revision: 1.150 $ * ******************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -115,17 +114,16 @@ *****************************************************************************/ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acdispat.h> -#include <contrib/dev/acpica/amlcode.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/acevents.h> -#include <contrib/dev/acpica/acdebug.h> -#include <contrib/dev/acpica/acresrc.h> -#include <contrib/dev/acpica/acdisasm.h> - - -#include <contrib/dev/acpica/acparser.h> +#include "acpi.h" +#include "accommon.h" +#include "acdispat.h" +#include "acnamesp.h" +#include "acevents.h" +#include "acdebug.h" +#include "acresrc.h" +#include "acdisasm.h" +#include "actables.h" +#include "acparser.h" #ifdef ACPI_DEBUGGER @@ -390,6 +388,228 @@ AcpiDbFindReferences ( /******************************************************************************* * + * FUNCTION: AcpiDbWalkForPredefinedNames + * + * PARAMETERS: Callback from WalkNamespace + * + * RETURN: Status + * + * DESCRIPTION: Detect and display predefined ACPI names (names that start with + * an underscore) + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiDbWalkForPredefinedNames ( + ACPI_HANDLE ObjHandle, + UINT32 NestingLevel, + void *Context, + void **ReturnValue) +{ + ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; + UINT32 *Count = (UINT32 *) Context; + const ACPI_PREDEFINED_INFO *Predefined; + const ACPI_PREDEFINED_INFO *Package = NULL; + char *Pathname; + + + Predefined = AcpiNsCheckForPredefinedName (Node); + if (!Predefined) + { + return (AE_OK); + } + + Pathname = AcpiNsGetExternalPathname (Node); + if (!Pathname) + { + return (AE_OK); + } + + /* If method returns a package, the info is in the next table entry */ + + if (Predefined->Info.ExpectedBtypes & ACPI_BTYPE_PACKAGE) + { + Package = Predefined + 1; + } + + AcpiOsPrintf ("%-32s arg %X ret %2.2X", Pathname, + Predefined->Info.ParamCount, Predefined->Info.ExpectedBtypes); + + if (Package) + { + AcpiOsPrintf (" PkgType %2.2X ObjType %2.2X Count %2.2X", + Package->RetInfo.Type, Package->RetInfo.ObjectType1, + Package->RetInfo.Count1); + } + + AcpiOsPrintf("\n"); + + AcpiNsCheckParameterCount (Pathname, Node, ACPI_UINT32_MAX, Predefined); + ACPI_FREE (Pathname); + (*Count)++; + + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDbCheckPredefinedNames + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Validate all predefined names in the namespace + * + ******************************************************************************/ + +void +AcpiDbCheckPredefinedNames ( + void) +{ + UINT32 Count = 0; + + + /* Search all nodes in namespace */ + + (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, + AcpiDbWalkForPredefinedNames, (void *) &Count, NULL); + + AcpiOsPrintf ("Found %d predefined names in the namespace\n", Count); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDbWalkForExecute + * + * PARAMETERS: Callback from WalkNamespace + * + * RETURN: Status + * + * DESCRIPTION: Batch execution module. Currently only executes predefined + * ACPI names. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiDbWalkForExecute ( + ACPI_HANDLE ObjHandle, + UINT32 NestingLevel, + 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; + UINT32 i; + ACPI_DEVICE_INFO *ObjInfo; + ACPI_OBJECT_LIST ParamObjects; + ACPI_OBJECT Params[ACPI_METHOD_NUM_ARGS]; + + + Predefined = AcpiNsCheckForPredefinedName (Node); + if (!Predefined) + { + return (AE_OK); + } + + if (Node->Type == ACPI_TYPE_LOCAL_SCOPE) + { + return (AE_OK); + } + + Pathname = AcpiNsGetExternalPathname (Node); + if (!Pathname) + { + return (AE_OK); + } + + /* Get the object info for number of method parameters */ + + Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; + Status = AcpiGetObjectInfo (ObjHandle, &Buffer); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + 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++) + { + Params[i].Type = ACPI_TYPE_INTEGER; + Params[i].Integer.Value = 1; + } + + ParamObjects.Pointer = Params; + ParamObjects.Count = ObjInfo->ParamCount; + } + + ACPI_FREE (Buffer.Pointer); + + ReturnObj.Pointer = NULL; + ReturnObj.Length = ACPI_ALLOCATE_BUFFER; + + + /* Do the actual method execution */ + + AcpiGbl_MethodExecuting = TRUE; + + Status = AcpiEvaluateObject (Node, NULL, &ParamObjects, &ReturnObj); + + AcpiOsPrintf ("%-32s returned %s\n", Pathname, AcpiFormatException (Status)); + AcpiGbl_MethodExecuting = FALSE; + + ACPI_FREE (Pathname); + (*Count)++; + + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDbBatchExecute + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Namespace batch execution. + * + ******************************************************************************/ + +void +AcpiDbBatchExecute ( + void) +{ + UINT32 Count = 0; + + + /* Search all nodes in namespace */ + + (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, + AcpiDbWalkForExecute, (void *) &Count, NULL); + + AcpiOsPrintf ("Executed %d predefined names in the namespace\n", Count); +} + + +/******************************************************************************* + * * FUNCTION: AcpiDbDisplayLocks * * PARAMETERS: None @@ -433,28 +653,39 @@ void AcpiDbDisplayTableInfo ( char *TableArg) { - ACPI_NATIVE_UINT i; + UINT32 i; ACPI_TABLE_DESC *TableDesc; + ACPI_STATUS Status; - /* - * Walk the root table list - */ + /* Walk the entire root table list */ + for (i = 0; i < AcpiGbl_RootTableList.Count; i++) { TableDesc = &AcpiGbl_RootTableList.Tables[i]; - AcpiOsPrintf ( "%4.4s at %p length %.5X", - TableDesc->Signature.Ascii, TableDesc->Pointer, - (UINT32) TableDesc->Length); + AcpiOsPrintf ("%d ", i); + + /* Make sure that the table is mapped */ + + Status = AcpiTbVerifyTable (TableDesc); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Dump the table header */ - if (TableDesc->Pointer && (i != ACPI_TABLE_INDEX_FACS)) + if (TableDesc->Pointer) { - AcpiOsPrintf (" OemId=\"%6s\" OemTableId=\"%8s\" OemRevision=%8.8X", - TableDesc->Pointer->OemId, - TableDesc->Pointer->OemTableId, - TableDesc->Pointer->OemRevision); + AcpiTbPrintTableHeader (TableDesc->Address, TableDesc->Pointer); + } + else + { + /* If the pointer is null, the table has been unloaded */ + + ACPI_INFO ((AE_INFO, "%4.4s - Table has been unloaded", + TableDesc->Signature.Ascii)); } - AcpiOsPrintf ("\n"); } } @@ -942,7 +1173,7 @@ AcpiDbSetMethodData ( goto Cleanup; } - Status = AcpiDsStoreObjectToLocal (AML_ARG_OP, Index, ObjDesc, + Status = AcpiDsStoreObjectToLocal (ACPI_REFCLASS_ARG, Index, ObjDesc, WalkState); if (ACPI_FAILURE (Status)) { @@ -965,7 +1196,7 @@ AcpiDbSetMethodData ( goto Cleanup; } - Status = AcpiDsStoreObjectToLocal (AML_LOCAL_OP, Index, ObjDesc, + Status = AcpiDsStoreObjectToLocal (ACPI_REFCLASS_LOCAL, Index, ObjDesc, WalkState); if (ACPI_FAILURE (Status)) { @@ -1172,6 +1403,9 @@ ACPI_STATUS AcpiDbFindNameInNamespace ( char *NameArg) { + char AcpiName[5] = "____"; + char *AcpiNamePtr = AcpiName; + if (ACPI_STRLEN (NameArg) > 4) { @@ -1179,11 +1413,20 @@ AcpiDbFindNameInNamespace ( return (AE_OK); } - /* Walk the namespace from the root */ + /* Pad out name with underscores as necessary to create a 4-char name */ AcpiUtStrupr (NameArg); + while (*NameArg) + { + *AcpiNamePtr = *NameArg; + AcpiNamePtr++; + NameArg++; + } + + /* Walk the namespace from the root */ + (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, - AcpiDbWalkAndMatchName, NameArg, NULL); + AcpiDbWalkAndMatchName, AcpiName, NULL); AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); return (AE_OK); @@ -1415,8 +1658,8 @@ AcpiDmTestResourceConversion ( OriginalAml = ReturnObj.Pointer; AcpiDmCompareAmlResources ( - OriginalAml->Buffer.Pointer, OriginalAml->Buffer.Length, - NewAml.Pointer, NewAml.Length); + OriginalAml->Buffer.Pointer, (ACPI_RSDESC_SIZE) OriginalAml->Buffer.Length, + NewAml.Pointer, (ACPI_RSDESC_SIZE) NewAml.Length); /* Cleanup and exit */ @@ -1607,24 +1850,45 @@ AcpiDbIntegrityWalk ( ACPI_INTEGRITY_INFO *Info = (ACPI_INTEGRITY_INFO *) Context; ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; ACPI_OPERAND_OBJECT *Object; + BOOLEAN Alias = TRUE; Info->Nodes++; - if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED) + + /* Verify the NS node, and dereference aliases */ + + while (Alias) { - AcpiOsPrintf ("Invalid Descriptor Type for Node %p [%s]\n", - Node, AcpiUtGetDescriptorName (Node)); + if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED) + { + AcpiOsPrintf ("Invalid Descriptor Type for Node %p [%s] - is %2.2X should be %2.2X\n", + Node, AcpiUtGetDescriptorName (Node), ACPI_GET_DESCRIPTOR_TYPE (Node), + ACPI_DESC_TYPE_NAMED); + return (AE_OK); + } + + if ((Node->Type == ACPI_TYPE_LOCAL_ALIAS) || + (Node->Type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) + { + Node = (ACPI_NAMESPACE_NODE *) Node->Object; + } + else + { + Alias = FALSE; + } } if (Node->Type > ACPI_TYPE_LOCAL_MAX) { AcpiOsPrintf ("Invalid Object Type for Node %p, Type = %X\n", Node, Node->Type); + return (AE_OK); } if (!AcpiUtValidAcpiName (Node->Name.Integer)) { AcpiOsPrintf ("Invalid AcpiName for Node %p\n", Node); + return (AE_OK); } Object = AcpiNsGetAttachedObject (Node); diff --git a/sys/contrib/dev/acpica/dbdisply.c b/sys/contrib/dev/acpica/debugger/dbdisply.c index 40133a1e7073..28b0f8f8aef3 100644 --- a/sys/contrib/dev/acpica/dbdisply.c +++ b/sys/contrib/dev/acpica/debugger/dbdisply.c @@ -1,7 +1,6 @@ /******************************************************************************* * * Module Name: dbdisply - debug display commands - * $Revision: 1.120 $ * ******************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -115,14 +114,15 @@ *****************************************************************************/ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/amlcode.h> -#include <contrib/dev/acpica/acdispat.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/acparser.h> -#include <contrib/dev/acpica/acinterp.h> -#include <contrib/dev/acpica/acdebug.h> -#include <contrib/dev/acpica/acdisasm.h> +#include "acpi.h" +#include "accommon.h" +#include "amlcode.h" +#include "acdispat.h" +#include "acnamesp.h" +#include "acparser.h" +#include "acinterp.h" +#include "acdebug.h" +#include "acdisasm.h" #ifdef ACPI_DEBUGGER @@ -685,7 +685,7 @@ AcpiDbDisplayObjectType ( ACPI_BUFFER Buffer; ACPI_DEVICE_INFO *Info; ACPI_STATUS Status; - ACPI_NATIVE_UINT i; + UINT32 i; Handle = ACPI_TO_POINTER (ACPI_STRTOUL (ObjectArg, NULL, 16)); @@ -707,7 +707,7 @@ AcpiDbDisplayObjectType ( { for (i = 0; i < Info->CompatibilityId.Count; i++) { - AcpiOsPrintf ("CID #%d: %s\n", (UINT32) i, + AcpiOsPrintf ("CID #%d: %s\n", i, Info->CompatibilityId.Id[i].Value); } } diff --git a/sys/contrib/dev/acpica/dbexec.c b/sys/contrib/dev/acpica/debugger/dbexec.c index 10e73f6a91fd..eb39b3749eb4 100644 --- a/sys/contrib/dev/acpica/dbexec.c +++ b/sys/contrib/dev/acpica/debugger/dbexec.c @@ -1,7 +1,6 @@ /******************************************************************************* * * Module Name: dbexec - debugger control method execution - * $Revision: 1.81 $ * ******************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -115,9 +114,10 @@ *****************************************************************************/ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acdebug.h> -#include <contrib/dev/acpica/acnamesp.h> +#include "acpi.h" +#include "accommon.h" +#include "acdebug.h" +#include "acnamesp.h" #ifdef ACPI_DEBUGGER @@ -175,7 +175,10 @@ AcpiDbExecuteMethod ( ACPI_STATUS Status; ACPI_OBJECT_LIST ParamObjects; ACPI_OBJECT Params[ACPI_METHOD_NUM_ARGS]; + ACPI_HANDLE Handle; + ACPI_BUFFER Buffer; UINT32 i; + ACPI_DEVICE_INFO *ObjInfo; if (AcpiGbl_DbOutputToFile && !AcpiDbgLevel) @@ -183,34 +186,78 @@ AcpiDbExecuteMethod ( AcpiOsPrintf ("Warning: debug output is not enabled!\n"); } - /* Are there arguments to the method? */ + /* Get the NS node, determines existence also */ - if (Info->Args && Info->Args[0]) + Status = AcpiGetHandle (NULL, Info->Pathname, &Handle); + if (ACPI_FAILURE (Status)) { - for (i = 0; Info->Args[i] && i < ACPI_METHOD_NUM_ARGS; i++) - { - Params[i].Type = ACPI_TYPE_INTEGER; - Params[i].Integer.Value = ACPI_STRTOUL (Info->Args[i], NULL, 16); - } + return (Status); + } + + /* Get the object info for number of method parameters */ - ParamObjects.Pointer = Params; - ParamObjects.Count = i; + Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; + Status = AcpiGetObjectInfo (Handle, &Buffer); + if (ACPI_FAILURE (Status)) + { + return (Status); } - else + + ParamObjects.Pointer = NULL; + ParamObjects.Count = 0; + + ObjInfo = Buffer.Pointer; + if (ObjInfo->Type == ACPI_TYPE_METHOD) { - /* Setup default parameters */ + /* Are there arguments to the method? */ + + if (Info->Args && Info->Args[0]) + { + for (i = 0; Info->Args[i] && i < ACPI_METHOD_NUM_ARGS; i++) + { + Params[i].Type = ACPI_TYPE_INTEGER; + Params[i].Integer.Value = ACPI_STRTOUL (Info->Args[i], NULL, 16); + } + + ParamObjects.Pointer = Params; + ParamObjects.Count = i; + } + else + { + /* Setup default parameters */ + + for (i = 0; i < ObjInfo->ParamCount; i++) + { + switch (i) + { + case 0: - Params[0].Type = ACPI_TYPE_INTEGER; - Params[0].Integer.Value = 0x01020304; + Params[0].Type = ACPI_TYPE_INTEGER; + Params[0].Integer.Value = 0x01020304; + break; - Params[1].Type = ACPI_TYPE_STRING; - Params[1].String.Length = 12; - Params[1].String.Pointer = "AML Debugger"; + case 1: - ParamObjects.Pointer = Params; - ParamObjects.Count = 2; + Params[1].Type = ACPI_TYPE_STRING; + Params[1].String.Length = 12; + Params[1].String.Pointer = "AML Debugger"; + break; + + default: + + Params[i].Type = ACPI_TYPE_INTEGER; + Params[i].Integer.Value = i * (ACPI_INTEGER) 0x1000; + break; + } + } + + ParamObjects.Pointer = Params; + ParamObjects.Count = ObjInfo->ParamCount; + } } + ACPI_FREE (Buffer.Pointer); + /* Prepare for a return object of arbitrary size */ ReturnObj->Pointer = AcpiGbl_DbBuffer; @@ -504,25 +551,47 @@ AcpiDbMethodThread ( { ACPI_STATUS Status; ACPI_DB_METHOD_INFO *Info = Context; + ACPI_DB_METHOD_INFO LocalInfo; UINT32 i; UINT8 Allow; ACPI_BUFFER ReturnObj; + /* + * AcpiGbl_DbMethodInfo.Arguments will be passed as method arguments. + * Prevent AcpiGbl_DbMethodInfo from being modified by multiple threads + * concurrently. + * + * Note: The arguments we are passing are used by the ASL test suite + * (aslts). Do not change them without updating the tests. + */ + (void) AcpiOsWaitSemaphore (Info->InfoGate, 1, ACPI_WAIT_FOREVER); + if (Info->InitArgs) { AcpiDbUInt32ToHexString (Info->NumCreated, Info->IndexOfThreadStr); - AcpiDbUInt32ToHexString (AcpiOsGetThreadId (), Info->IdOfThreadStr); + AcpiDbUInt32ToHexString (ACPI_TO_INTEGER (AcpiOsGetThreadId ()), + Info->IdOfThreadStr); } if (Info->Threads && (Info->NumCreated < Info->NumThreads)) { - Info->Threads[Info->NumCreated++] = AcpiOsGetThreadId(); + Info->Threads[Info->NumCreated++] = + ACPI_TO_INTEGER (AcpiOsGetThreadId()); } + LocalInfo = *Info; + LocalInfo.Args = LocalInfo.Arguments; + LocalInfo.Arguments[0] = LocalInfo.NumThreadsStr; + LocalInfo.Arguments[1] = LocalInfo.IdOfThreadStr; + LocalInfo.Arguments[2] = LocalInfo.IndexOfThreadStr; + LocalInfo.Arguments[3] = NULL; + + (void) AcpiOsSignalSemaphore (Info->InfoGate, 1); + for (i = 0; i < Info->NumLoops; i++) { - Status = AcpiDbExecuteMethod (Info, &ReturnObj); + Status = AcpiDbExecuteMethod (&LocalInfo, &ReturnObj); if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("%s During execution of %s at iteration %X\n", @@ -551,7 +620,7 @@ AcpiDbMethodThread ( /* Signal our completion */ Allow = 0; - AcpiOsWaitSemaphore (Info->ThreadCompleteGate, 1, ACPI_WAIT_FOREVER); + (void) AcpiOsWaitSemaphore (Info->ThreadCompleteGate, 1, ACPI_WAIT_FOREVER); Info->NumCompleted++; if (Info->NumCompleted == Info->NumThreads) @@ -560,7 +629,7 @@ AcpiDbMethodThread ( Allow = 1; } - AcpiOsSignalSemaphore (Info->ThreadCompleteGate, 1); + (void) AcpiOsSignalSemaphore (Info->ThreadCompleteGate, 1); if (Allow) { @@ -601,6 +670,8 @@ AcpiDbCreateExecutionThreads ( UINT32 Size; ACPI_MUTEX MainThreadGate; ACPI_MUTEX ThreadCompleteGate; + ACPI_MUTEX InfoGate; + /* Get the arguments */ @@ -639,6 +710,16 @@ AcpiDbCreateExecutionThreads ( return; } + Status = AcpiOsCreateSemaphore (1, 1, &InfoGate); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("Could not create semaphore for synchronization of AcpiGbl_DbMethodInfo, %s\n", + AcpiFormatException (Status)); + (void) AcpiOsDeleteSemaphore (ThreadCompleteGate); + (void) AcpiOsDeleteSemaphore (MainThreadGate); + return; + } + ACPI_MEMSET (&AcpiGbl_DbMethodInfo, 0, sizeof (ACPI_DB_METHOD_INFO)); /* Array to store IDs of threads */ @@ -651,6 +732,7 @@ AcpiDbCreateExecutionThreads ( AcpiOsPrintf ("No memory for thread IDs array\n"); (void) AcpiOsDeleteSemaphore (MainThreadGate); (void) AcpiOsDeleteSemaphore (ThreadCompleteGate); + (void) AcpiOsDeleteSemaphore (InfoGate); return; } ACPI_MEMSET (AcpiGbl_DbMethodInfo.Threads, 0, Size); @@ -662,6 +744,7 @@ AcpiDbCreateExecutionThreads ( AcpiGbl_DbMethodInfo.NumLoops = NumLoops; AcpiGbl_DbMethodInfo.MainThreadGate = MainThreadGate; AcpiGbl_DbMethodInfo.ThreadCompleteGate = ThreadCompleteGate; + AcpiGbl_DbMethodInfo.InfoGate = InfoGate; /* Init arguments to be passed to method */ @@ -692,7 +775,7 @@ AcpiDbCreateExecutionThreads ( /* Wait for all threads to complete */ - AcpiOsWaitSemaphore (MainThreadGate, 1, ACPI_WAIT_FOREVER); + (void) AcpiOsWaitSemaphore (MainThreadGate, 1, ACPI_WAIT_FOREVER); AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT); AcpiOsPrintf ("All threads (%X) have completed\n", NumThreads); @@ -702,6 +785,7 @@ AcpiDbCreateExecutionThreads ( (void) AcpiOsDeleteSemaphore (MainThreadGate); (void) AcpiOsDeleteSemaphore (ThreadCompleteGate); + (void) AcpiOsDeleteSemaphore (InfoGate); AcpiOsFree (AcpiGbl_DbMethodInfo.Threads); AcpiGbl_DbMethodInfo.Threads = NULL; diff --git a/sys/contrib/dev/acpica/dbfileio.c b/sys/contrib/dev/acpica/debugger/dbfileio.c index dc97d7526323..d52a72caa6a5 100644 --- a/sys/contrib/dev/acpica/dbfileio.c +++ b/sys/contrib/dev/acpica/debugger/dbfileio.c @@ -1,8 +1,7 @@ /******************************************************************************* * - * Module Name: dbfileio - Debugger file I/O commands. These can't usually + * Module Name: dbfileio - Debugger file I/O commands. These can't usually * be used when running the debugger in Ring 0 (Kernel mode) - * $Revision: 1.94 $ * ******************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,11 +115,13 @@ *****************************************************************************/ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acdebug.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/actables.h> -#include <contrib/dev/acpica/acdisasm.h> +#include "acpi.h" +#include "accommon.h" +#include "acdebug.h" + +#ifdef ACPI_APPLICATION +#include "actables.h" +#endif #if (defined ACPI_DEBUGGER || defined ACPI_DISASSEMBLER) @@ -128,7 +129,7 @@ ACPI_MODULE_NAME ("dbfileio") /* - * NOTE: this is here for lack of a better place. It is used in all + * NOTE: this is here for lack of a better place. It is used in all * flavors of the debugger, need LCD file */ #ifdef ACPI_APPLICATION @@ -263,7 +264,7 @@ AcpiDbCheckTextModeCorruption ( { if (Table[i - 1] != 0x0D) { - /* The LF does not have a preceeding CR, table not corrupted */ + /* The LF does not have a preceding CR, table not corrupted */ return (AE_OK); } @@ -355,7 +356,7 @@ AcpiDbReadTable ( } else { - /* Read the table header */ + /* Read the table header */ if (fread (&TableHeader, 1, sizeof (TableHeader), fp) != sizeof (ACPI_TABLE_HEADER)) @@ -462,8 +463,8 @@ AcpiDbReadTable ( * RETURN: Status * * DESCRIPTION: This function is called to load a table from the caller's - * buffer. The buffer must contain an entire ACPI Table including - * a valid header. The header fields will be verified, and if it + * buffer. The buffer must contain an entire ACPI Table including + * a valid header. The header fields will be verified, and if it * is determined that the table is invalid, the call will fail. * ******************************************************************************/ diff --git a/sys/contrib/dev/acpica/dbhistry.c b/sys/contrib/dev/acpica/debugger/dbhistry.c index f766f4f23ac7..e8e8a76bf104 100644 --- a/sys/contrib/dev/acpica/dbhistry.c +++ b/sys/contrib/dev/acpica/debugger/dbhistry.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: dbhistry - debugger HISTORY command - * $Revision: 1.34 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -115,8 +114,9 @@ *****************************************************************************/ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acdebug.h> +#include "acpi.h" +#include "accommon.h" +#include "acdebug.h" #ifdef ACPI_DEBUGGER @@ -210,7 +210,7 @@ void AcpiDbDisplayHistory ( void) { - ACPI_NATIVE_UINT i; + UINT32 i; UINT16 HistoryIndex; @@ -249,7 +249,7 @@ char * AcpiDbGetFromHistory ( char *CommandNumArg) { - ACPI_NATIVE_UINT i; + UINT32 i; UINT16 HistoryIndex; UINT32 CmdNum; diff --git a/sys/contrib/dev/acpica/dbinput.c b/sys/contrib/dev/acpica/debugger/dbinput.c index a7257ade7507..a64d547fdc81 100644 --- a/sys/contrib/dev/acpica/dbinput.c +++ b/sys/contrib/dev/acpica/debugger/dbinput.c @@ -1,7 +1,6 @@ /******************************************************************************* * * Module Name: dbinput - user front-end to the AML debugger - * $Revision: 1.114 $ * ******************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -115,8 +114,9 @@ *****************************************************************************/ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acdebug.h> +#include "acpi.h" +#include "accommon.h" +#include "acdebug.h" #ifdef ACPI_DEBUGGER @@ -160,6 +160,7 @@ enum AcpiExDebuggerCommands CMD_ALLOCATIONS, CMD_ARGS, CMD_ARGUMENTS, + CMD_BATCH, CMD_BREAKPOINT, CMD_BUSINFO, CMD_CALL, @@ -194,6 +195,7 @@ enum AcpiExDebuggerCommands CMD_OBJECT, CMD_OPEN, CMD_OWNER, + CMD_PREDEFINED, CMD_PREFIX, CMD_QUIT, CMD_REFERENCES, @@ -214,6 +216,9 @@ enum AcpiExDebuggerCommands #define CMD_FIRST_VALID 2 + +/* Second parameter is the required argument count */ + static const COMMAND_INFO AcpiGbl_DbCommands[] = { {"<NOT FOUND>", 0}, @@ -221,6 +226,7 @@ static const COMMAND_INFO AcpiGbl_DbCommands[] = {"ALLOCATIONS", 0}, {"ARGS", 0}, {"ARGUMENTS", 0}, + {"BATCH", 0}, {"BREAKPOINT", 1}, {"BUSINFO", 0}, {"CALL", 0}, @@ -255,6 +261,7 @@ static const COMMAND_INFO AcpiGbl_DbCommands[] = {"OBJECT", 1}, {"OPEN", 1}, {"OWNER", 1}, + {"PREDEFINED", 0}, {"PREFIX", 0}, {"QUIT", 0}, {"REFERENCES", 1}, @@ -360,6 +367,7 @@ AcpiDbDisplayHelp ( AcpiOsPrintf ("Notify <Object> <Value> Send a notification on Object\n"); AcpiOsPrintf ("Objects <ObjectType> Display all objects of the given type\n"); AcpiOsPrintf ("Owner <OwnerId> [Depth] Display loaded namespace by object owner\n"); + AcpiOsPrintf ("Predefined Check all predefined names\n"); AcpiOsPrintf ("Prefix [<NamePath>] Set or Get current execution prefix\n"); AcpiOsPrintf ("References <Addr> Find all references to object at addr\n"); AcpiOsPrintf ("Resources <Device> Get and display Device resources\n"); @@ -635,6 +643,10 @@ AcpiDbCommandDispatch ( AcpiDbDisplayArguments (); break; + case CMD_BATCH: + AcpiDbBatchExecute (); + break; + case CMD_BREAKPOINT: AcpiDbSetMethodBreakpoint (AcpiGbl_DbArgs[1], WalkState, Op); break; @@ -812,6 +824,10 @@ AcpiDbCommandDispatch ( AcpiDbDumpNamespaceByOwner (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); break; + case CMD_PREDEFINED: + AcpiDbCheckPredefinedNames (); + break; + case CMD_PREFIX: AcpiDbSetScope (AcpiGbl_DbArgs[1]); break; @@ -866,7 +882,7 @@ AcpiDbCommandDispatch ( break; case CMD_TRACE: - AcpiDebugTrace (AcpiGbl_DbArgs[1],0,0,1); + (void) AcpiDebugTrace (AcpiGbl_DbArgs[1],0,0,1); break; case CMD_TREE: diff --git a/sys/contrib/dev/acpica/dbstats.c b/sys/contrib/dev/acpica/debugger/dbstats.c index d7b2cc05c73a..f2f2f78f6a69 100644 --- a/sys/contrib/dev/acpica/dbstats.c +++ b/sys/contrib/dev/acpica/debugger/dbstats.c @@ -1,7 +1,6 @@ /******************************************************************************* * * Module Name: dbstats - Generation and display of ACPI table statistics - * $Revision: 1.87 $ * ******************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -115,9 +114,10 @@ *****************************************************************************/ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acdebug.h> -#include <contrib/dev/acpica/acnamesp.h> +#include "acpi.h" +#include "accommon.h" +#include "acdebug.h" +#include "acnamesp.h" #ifdef ACPI_DEBUGGER @@ -173,7 +173,6 @@ static ARGUMENT_INFO AcpiDbStatTypes [] = #if defined ACPI_DBG_TRACK_ALLOCATIONS || defined ACPI_USE_LOCAL_CACHE - /******************************************************************************* * * FUNCTION: AcpiDbListInfo @@ -277,18 +276,18 @@ AcpiDbEnumerateObject ( AcpiGbl_NumObjects++; - if (ACPI_GET_OBJECT_TYPE (ObjDesc) > ACPI_TYPE_NS_NODE_MAX) + if (ObjDesc->Common.Type > ACPI_TYPE_NS_NODE_MAX) { AcpiGbl_ObjTypeCountMisc++; } else { - AcpiGbl_ObjTypeCount [ACPI_GET_OBJECT_TYPE (ObjDesc)]++; + AcpiGbl_ObjTypeCount [ObjDesc->Common.Type]++; } /* Count the sub-objects */ - switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) + switch (ObjDesc->Common.Type) { case ACPI_TYPE_PACKAGE: @@ -531,7 +530,7 @@ AcpiDbDisplayStatistics ( #endif #ifdef ACPI_USE_LOCAL_CACHE - AcpiOsPrintf ("\n----Cache Statistics (all in hex)----------\n"); + AcpiOsPrintf ("\n----Cache Statistics (all in hex)---------\n"); AcpiDbListInfo (AcpiGbl_OperandCache); AcpiDbListInfo (AcpiGbl_PsNodeCache); AcpiDbListInfo (AcpiGbl_PsNodeExtCache); @@ -593,6 +592,7 @@ AcpiDbDisplayStatistics ( AcpiOsPrintf ("ParseObjectAsl %3d\n", sizeof (ACPI_PARSE_OBJ_ASL)); AcpiOsPrintf ("OperandObject %3d\n", sizeof (ACPI_OPERAND_OBJECT)); AcpiOsPrintf ("NamespaceNode %3d\n", sizeof (ACPI_NAMESPACE_NODE)); + AcpiOsPrintf ("AcpiObject %3d\n", sizeof (ACPI_OBJECT)); break; @@ -600,13 +600,13 @@ AcpiDbDisplayStatistics ( case CMD_STAT_STACK: #if defined(ACPI_DEBUG_OUTPUT) - Temp = (UINT32) (AcpiGbl_EntryStackPointer - AcpiGbl_LowestStackPointer); + Temp = (UINT32) ACPI_PTR_DIFF (AcpiGbl_EntryStackPointer, AcpiGbl_LowestStackPointer); AcpiOsPrintf ("\nSubsystem Stack Usage:\n\n"); - AcpiOsPrintf ("Entry Stack Pointer %X\n", AcpiGbl_EntryStackPointer); - AcpiOsPrintf ("Lowest Stack Pointer %X\n", AcpiGbl_LowestStackPointer); - AcpiOsPrintf ("Stack Use %X (%d)\n", Temp, Temp); - AcpiOsPrintf ("Deepest Procedure Nesting %d\n", AcpiGbl_DeepestNesting); + AcpiOsPrintf ("Entry Stack Pointer %p\n", AcpiGbl_EntryStackPointer); + AcpiOsPrintf ("Lowest Stack Pointer %p\n", AcpiGbl_LowestStackPointer); + AcpiOsPrintf ("Stack Use %X (%u)\n", Temp, Temp); + AcpiOsPrintf ("Deepest Procedure Nesting %u\n", AcpiGbl_DeepestNesting); #endif break; diff --git a/sys/contrib/dev/acpica/dbutils.c b/sys/contrib/dev/acpica/debugger/dbutils.c index dd1e67be9606..b49726369b8b 100644 --- a/sys/contrib/dev/acpica/dbutils.c +++ b/sys/contrib/dev/acpica/debugger/dbutils.c @@ -1,7 +1,6 @@ /******************************************************************************* * * Module Name: dbutils - AML debugger utilities - * $Revision: 1.83 $ * ******************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -115,10 +114,11 @@ *****************************************************************************/ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/acdebug.h> -#include <contrib/dev/acpica/acdisasm.h> +#include "acpi.h" +#include "accommon.h" +#include "acnamesp.h" +#include "acdebug.h" +#include "acdisasm.h" #ifdef ACPI_DEBUGGER @@ -248,8 +248,7 @@ AcpiDbDumpExternalObject ( { case ACPI_TYPE_ANY: - AcpiOsPrintf ("[Object Reference] = %p", ObjDesc->Reference.Handle); - AcpiDmDisplayInternalObject (ObjDesc->Reference.Handle, NULL); + AcpiOsPrintf ("[Null Object] (Type=0)\n"); break; @@ -300,7 +299,7 @@ AcpiDbDumpExternalObject ( case ACPI_TYPE_LOCAL_REFERENCE: - AcpiOsPrintf ("[Object Reference] = %p", ObjDesc->Reference.Handle); + AcpiOsPrintf ("[Object Reference] = "); AcpiDmDisplayInternalObject (ObjDesc->Reference.Handle, NULL); break; diff --git a/sys/contrib/dev/acpica/dbxface.c b/sys/contrib/dev/acpica/debugger/dbxface.c index db2786b77656..fe468e91fbfb 100644 --- a/sys/contrib/dev/acpica/dbxface.c +++ b/sys/contrib/dev/acpica/debugger/dbxface.c @@ -1,7 +1,6 @@ /******************************************************************************* * * Module Name: dbxface - AML Debugger external interfaces - * $Revision: 1.78 $ * ******************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -115,10 +114,11 @@ *****************************************************************************/ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/amlcode.h> -#include <contrib/dev/acpica/acdebug.h> -#include <contrib/dev/acpica/acdisasm.h> +#include "acpi.h" +#include "accommon.h" +#include "amlcode.h" +#include "acdebug.h" +#include "acdisasm.h" #ifdef ACPI_DEBUGGER @@ -569,10 +569,6 @@ AcpiDbTerminate ( void) { - if (AcpiGbl_DbTablePtr) - { - AcpiOsFree (AcpiGbl_DbTablePtr); - } if (AcpiGbl_DbBuffer) { AcpiOsFree (AcpiGbl_DbBuffer); diff --git a/sys/contrib/dev/acpica/dmbuffer.c b/sys/contrib/dev/acpica/disassembler/dmbuffer.c index 5540220d345e..5a4d1742f3e4 100644 --- a/sys/contrib/dev/acpica/dmbuffer.c +++ b/sys/contrib/dev/acpica/disassembler/dmbuffer.c @@ -1,7 +1,6 @@ /******************************************************************************* * * Module Name: dmbuffer - AML disassembler, buffer and string support - * $Revision: 1.25 $ * ******************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -115,10 +114,11 @@ *****************************************************************************/ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acdisasm.h> -#include <contrib/dev/acpica/acparser.h> -#include <contrib/dev/acpica/amlcode.h> +#include "acpi.h" +#include "accommon.h" +#include "acdisasm.h" +#include "acparser.h" +#include "amlcode.h" #ifdef ACPI_DISASSEMBLER @@ -132,6 +132,10 @@ static void AcpiDmUnicode ( ACPI_PARSE_OBJECT *Op); +static void +AcpiDmIsEisaIdElement ( + ACPI_PARSE_OBJECT *Op); + /******************************************************************************* * @@ -282,7 +286,7 @@ AcpiDmIsUnicodeBuffer ( UINT32 WordCount; ACPI_PARSE_OBJECT *SizeOp; ACPI_PARSE_OBJECT *NextOp; - ACPI_NATIVE_UINT i; + UINT32 i; /* Buffer size is the buffer argument */ @@ -320,7 +324,7 @@ AcpiDmIsUnicodeBuffer ( for (i = 0; i < (ByteCount - 2); i += 2) { if ((!ACPI_IS_PRINT (ByteData[i])) || - (ByteData[i + 1] != 0)) + (ByteData[(ACPI_SIZE) i + 1] != 0)) { return (FALSE); } @@ -441,54 +445,37 @@ AcpiDmUnicode ( /******************************************************************************* * - * FUNCTION: AcpiDmIsEisaId + * FUNCTION: AcpiDmIsEisaIdElement * * PARAMETERS: Op - Op to be examined * * RETURN: None * - * DESCRIPTION: Determine if an Op can be converted to an EisaId. + * DESCRIPTION: Determine if an Op (argument to _HID or _CID) can be converted + * to an EISA ID. * ******************************************************************************/ -void -AcpiDmIsEisaId ( +static void +AcpiDmIsEisaIdElement ( ACPI_PARSE_OBJECT *Op) { - UINT32 Name; UINT32 BigEndianId; - ACPI_PARSE_OBJECT *NextOp; - ACPI_NATIVE_UINT i; UINT32 Prefix[3]; + UINT32 i; - /* Get the NameSegment */ - - Name = AcpiPsGetName (Op); - if (!Name) - { - return; - } - - /* We are looking for _HID */ - - if (!ACPI_COMPARE_NAME (&Name, METHOD_NAME__HID)) - { - return; - } - /* The parameter must be either a word or a dword */ - NextOp = AcpiPsGetDepthNext (NULL, Op); - if ((NextOp->Common.AmlOpcode != AML_DWORD_OP) && - (NextOp->Common.AmlOpcode != AML_WORD_OP)) + if ((Op->Common.AmlOpcode != AML_DWORD_OP) && + (Op->Common.AmlOpcode != AML_WORD_OP)) { return; } /* Swap from little-endian to big-endian to simplify conversion */ - BigEndianId = AcpiUtDwordByteSwap ((UINT32) NextOp->Common.Value.Integer); + BigEndianId = AcpiUtDwordByteSwap ((UINT32) Op->Common.Value.Integer); /* Create the 3 leading ASCII letters */ @@ -509,7 +496,79 @@ AcpiDmIsEisaId ( /* OK - mark this node as convertable to an EISA ID */ - NextOp->Common.DisasmOpcode = ACPI_DASM_EISAID; + Op->Common.DisasmOpcode = ACPI_DASM_EISAID; +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmIsEisaId + * + * PARAMETERS: Op - Op to be examined + * + * RETURN: None + * + * DESCRIPTION: Determine if a Name() Op can be converted to an EisaId. + * + ******************************************************************************/ + +void +AcpiDmIsEisaId ( + ACPI_PARSE_OBJECT *Op) +{ + UINT32 Name; + ACPI_PARSE_OBJECT *NextOp; + + + /* Get the NameSegment */ + + Name = AcpiPsGetName (Op); + if (!Name) + { + return; + } + + NextOp = AcpiPsGetDepthNext (NULL, Op); + if (!NextOp) + { + return; + } + + /* Check for _HID - has one argument */ + + if (ACPI_COMPARE_NAME (&Name, METHOD_NAME__HID)) + { + AcpiDmIsEisaIdElement (NextOp); + return; + } + + /* Exit if not _CID */ + + if (!ACPI_COMPARE_NAME (&Name, METHOD_NAME__CID)) + { + return; + } + + /* _CID can contain a single argument or a package */ + + if (NextOp->Common.AmlOpcode != AML_PACKAGE_OP) + { + AcpiDmIsEisaIdElement (NextOp); + return; + } + + /* _CID with Package: get the package length */ + + NextOp = AcpiPsGetDepthNext (NULL, NextOp); + + /* Don't need to use the length, just walk the peer list */ + + NextOp = NextOp->Common.Next; + while (NextOp) + { + AcpiDmIsEisaIdElement (NextOp); + NextOp = NextOp->Common.Next; + } } diff --git a/sys/contrib/dev/acpica/dmnames.c b/sys/contrib/dev/acpica/disassembler/dmnames.c index 693646216906..b09d3d35f503 100644 --- a/sys/contrib/dev/acpica/dmnames.c +++ b/sys/contrib/dev/acpica/disassembler/dmnames.c @@ -1,7 +1,6 @@ /******************************************************************************* * * Module Name: dmnames - AML disassembler, names, namestrings, pathnames - * $Revision: 1.17 $ * ******************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -115,11 +114,12 @@ *****************************************************************************/ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acparser.h> -#include <contrib/dev/acpica/amlcode.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/acdisasm.h> +#include "acpi.h" +#include "accommon.h" +#include "acparser.h" +#include "amlcode.h" +#include "acnamesp.h" +#include "acdisasm.h" #ifdef ACPI_DISASSEMBLER @@ -150,16 +150,20 @@ AcpiDmDisplayPath ( UINT32 AcpiDmDumpName ( - char *Name) + UINT32 Name) { UINT32 i; UINT32 Length; char NewName[4]; + /* Copy name locally in case the original name is not writeable */ + + *ACPI_CAST_PTR (UINT32, &NewName[0]) = Name; + /* Ensure that the name is printable, even if we have to fix it */ - *(UINT32 *) NewName = AcpiUtRepairName (Name); + AcpiUtRepairName (NewName); /* Remove all trailing underscores from the name */ @@ -327,7 +331,7 @@ AcpiDmNamestring ( { /* Append Name segment */ - AcpiDmDumpName ((char *) Name); + AcpiDmDumpName (*ACPI_CAST_PTR (UINT32, Name)); SegCount--; if (SegCount) diff --git a/sys/contrib/dev/acpica/dmobject.c b/sys/contrib/dev/acpica/disassembler/dmobject.c index 7b7d3c3fcbdd..0f569922addb 100644 --- a/sys/contrib/dev/acpica/dmobject.c +++ b/sys/contrib/dev/acpica/disassembler/dmobject.c @@ -1,7 +1,6 @@ /******************************************************************************* * * Module Name: dmobject - ACPI object decode and display - * $Revision: 1.22 $ * ******************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -115,11 +114,10 @@ *****************************************************************************/ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/amlcode.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/acdisasm.h> -#include <contrib/dev/acpica/acparser.h> +#include "acpi.h" +#include "accommon.h" +#include "acnamesp.h" +#include "acdisasm.h" #ifdef ACPI_DISASSEMBLER @@ -280,7 +278,7 @@ AcpiDmDecodeInternalObject ( AcpiOsPrintf (" %s", AcpiUtGetObjectTypeName (ObjDesc)); - switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) + switch (ObjDesc->Common.Type) { case ACPI_TYPE_INTEGER: @@ -352,7 +350,22 @@ AcpiDmDecodeNode ( AcpiOsPrintf (" [Method Local]"); } - AcpiDmDecodeInternalObject (AcpiNsGetAttachedObject (Node)); + switch (Node->Type) + { + /* These types have no attached object */ + + case ACPI_TYPE_DEVICE: + AcpiOsPrintf (" Device"); + break; + + case ACPI_TYPE_THERMAL: + AcpiOsPrintf (" Thermal Zone"); + break; + + default: + AcpiDmDecodeInternalObject (AcpiNsGetAttachedObject (Node)); + break; + } } @@ -403,7 +416,7 @@ AcpiDmDisplayInternalObject ( case ACPI_DESC_TYPE_OPERAND: - Type = ACPI_GET_OBJECT_TYPE (ObjDesc); + Type = ObjDesc->Common.Type; if (Type > ACPI_TYPE_LOCAL_MAX) { AcpiOsPrintf (" Type %X [Invalid Type]", (UINT32) Type); @@ -412,50 +425,48 @@ AcpiDmDisplayInternalObject ( /* Decode the ACPI object type */ - switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) + switch (ObjDesc->Common.Type) { case ACPI_TYPE_LOCAL_REFERENCE: - switch (ObjDesc->Reference.Opcode) + AcpiOsPrintf ("[%s] ", AcpiUtGetReferenceName (ObjDesc)); + + /* Decode the refererence */ + + switch (ObjDesc->Reference.Class) { - case AML_LOCAL_OP: + case ACPI_REFCLASS_LOCAL: - AcpiOsPrintf ("[Local%d] ", ObjDesc->Reference.Offset); + AcpiOsPrintf ("%X ", ObjDesc->Reference.Value); if (WalkState) { - ObjDesc = WalkState->LocalVariables[ - ObjDesc->Reference.Offset].Object; + ObjDesc = WalkState->LocalVariables + [ObjDesc->Reference.Value].Object; AcpiOsPrintf ("%p", ObjDesc); AcpiDmDecodeInternalObject (ObjDesc); } break; - case AML_ARG_OP: + case ACPI_REFCLASS_ARG: - AcpiOsPrintf ("[Arg%d] ", ObjDesc->Reference.Offset); + AcpiOsPrintf ("%X ", ObjDesc->Reference.Value); if (WalkState) { - ObjDesc = WalkState->Arguments[ - ObjDesc->Reference.Offset].Object; + ObjDesc = WalkState->Arguments + [ObjDesc->Reference.Value].Object; AcpiOsPrintf ("%p", ObjDesc); AcpiDmDecodeInternalObject (ObjDesc); } break; - case AML_DEBUG_OP: - - AcpiOsPrintf ("[Debug] "); - break; - - - case AML_INDEX_OP: + case ACPI_REFCLASS_INDEX: - AcpiOsPrintf ("[Index] "); switch (ObjDesc->Reference.TargetType) { case ACPI_TYPE_BUFFER_FIELD: + AcpiOsPrintf ("%p", ObjDesc->Reference.Object); AcpiDmDecodeInternalObject (ObjDesc->Reference.Object); break; @@ -465,7 +476,7 @@ AcpiDmDisplayInternalObject ( AcpiOsPrintf ("%p", ObjDesc->Reference.Where); if (!ObjDesc->Reference.Where) { - AcpiOsPrintf (" Uninitialized WHERE ptr"); + AcpiOsPrintf (" Uninitialized WHERE pointer"); } else { @@ -475,25 +486,18 @@ AcpiDmDisplayInternalObject ( break; default: + AcpiOsPrintf ("Unknown index target type"); break; } break; - case AML_LOAD_OP: - - AcpiOsPrintf ("[DdbHandle] "); - break; - - - case AML_REF_OF_OP: - - AcpiOsPrintf ("[RefOf] "); + case ACPI_REFCLASS_REFOF: if (!ObjDesc->Reference.Object) { - AcpiOsPrintf ("Uninitialized reference subobject ptr"); + AcpiOsPrintf ("Uninitialized reference subobject pointer"); break; } @@ -514,20 +518,28 @@ AcpiDmDisplayInternalObject ( } break; - case AML_INT_NAMEPATH_OP: + + case ACPI_REFCLASS_NAME: AcpiDmDecodeNode (ObjDesc->Reference.Node); break; - default: - AcpiOsPrintf ("Unknown Reference opcode %X (%s)\n", - ObjDesc->Reference.Opcode, - AcpiPsGetOpcodeName (ObjDesc->Reference.Opcode)); + case ACPI_REFCLASS_DEBUG: + case ACPI_REFCLASS_TABLE: + + AcpiOsPrintf ("\n"); + break; + + + default: /* Unknown reference class */ + + AcpiOsPrintf ("%2.2X\n", ObjDesc->Reference.Class); break; } break; + default: AcpiOsPrintf ("<Obj> "); @@ -540,7 +552,7 @@ AcpiDmDisplayInternalObject ( default: AcpiOsPrintf ("<Not a valid ACPI Object Descriptor> [%s]", - AcpiUtGetDescriptorName (ObjDesc)); + AcpiUtGetDescriptorName (ObjDesc)); break; } diff --git a/sys/contrib/dev/acpica/dmopcode.c b/sys/contrib/dev/acpica/disassembler/dmopcode.c index bdb9eefe72b2..931ef6c0db89 100644 --- a/sys/contrib/dev/acpica/dmopcode.c +++ b/sys/contrib/dev/acpica/disassembler/dmopcode.c @@ -1,7 +1,6 @@ /******************************************************************************* * * Module Name: dmopcode - AML disassembler, specific AML opcodes - * $Revision: 1.101 $ * ******************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -114,10 +113,11 @@ * *****************************************************************************/ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acparser.h> -#include <contrib/dev/acpica/amlcode.h> -#include <contrib/dev/acpica/acdisasm.h> +#include "acpi.h" +#include "accommon.h" +#include "acparser.h" +#include "amlcode.h" +#include "acdisasm.h" #ifdef ACPI_DISASSEMBLER @@ -202,8 +202,6 @@ AcpiDmFieldFlags ( UINT32 Flags; - /* The next peer Op (not child op) contains the flags */ - Op = Op->Common.Next; Flags = (UINT8) Op->Common.Value.Integer; @@ -406,6 +404,9 @@ AcpiDmDisassembleOneOp ( case AML_LLESS_OP: AcpiOsPrintf ("LGreaterEqual"); break; + + default: + break; } Op->Common.DisasmOpcode = 0; Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; @@ -548,7 +549,7 @@ AcpiDmDisassembleOneOp ( case AML_INT_NAMEDFIELD_OP: - Length = AcpiDmDumpName ((char *) &Op->Named.Name); + Length = AcpiDmDumpName (Op->Named.Name); AcpiOsPrintf (",%*.s %d", (int) (5 - Length), " ", (UINT32) Op->Common.Value.Integer); AcpiDmCommaIfFieldMember (Op); diff --git a/sys/contrib/dev/acpica/dmresrc.c b/sys/contrib/dev/acpica/disassembler/dmresrc.c index 60b78969abca..f0fc4b1bd614 100644 --- a/sys/contrib/dev/acpica/dmresrc.c +++ b/sys/contrib/dev/acpica/disassembler/dmresrc.c @@ -1,7 +1,6 @@ /******************************************************************************* * * Module Name: dmresrc.c - Resource Descriptor disassembly - * $Revision: 1.35 $ * ******************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -115,9 +114,10 @@ *****************************************************************************/ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/amlcode.h> -#include <contrib/dev/acpica/acdisasm.h> +#include "acpi.h" +#include "accommon.h" +#include "amlcode.h" +#include "acdisasm.h" #ifdef ACPI_DISASSEMBLER @@ -133,7 +133,7 @@ void (*ACPI_RESOURCE_HANDLER) ( UINT32 Length, UINT32 Level); -static ACPI_RESOURCE_HANDLER AcpiGbl_DumpResourceDispatch [] = +static ACPI_RESOURCE_HANDLER AcpiGbl_DmResourceDispatch [] = { /* Small descriptors */ @@ -325,7 +325,7 @@ AcpiDmResourceTemplate ( UINT32 ByteCount) { ACPI_STATUS Status; - ACPI_NATIVE_UINT CurrentByteOffset; + UINT32 CurrentByteOffset; UINT8 ResourceType; UINT32 ResourceLength; void *Aml; @@ -343,7 +343,7 @@ AcpiDmResourceTemplate ( Node = Node->Child; } - for (CurrentByteOffset = 0; CurrentByteOffset < ByteCount; ) + for (CurrentByteOffset = 0; CurrentByteOffset < ByteCount;) { Aml = &ByteData[CurrentByteOffset]; @@ -423,7 +423,7 @@ AcpiDmResourceTemplate ( Node = Node->Peer; } - AcpiGbl_DumpResourceDispatch [ResourceIndex] ( + AcpiGbl_DmResourceDispatch [ResourceIndex] ( Aml, ResourceLength, Level); /* Descriptor post-processing */ diff --git a/sys/contrib/dev/acpica/dmresrcl.c b/sys/contrib/dev/acpica/disassembler/dmresrcl.c index 1cc375d7c506..b1b86db2f321 100644 --- a/sys/contrib/dev/acpica/dmresrcl.c +++ b/sys/contrib/dev/acpica/disassembler/dmresrcl.c @@ -1,7 +1,6 @@ /******************************************************************************* * * Module Name: dmresrcl.c - "Large" Resource Descriptor disassembly - * $Revision: 1.37 $ * ******************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -115,8 +114,9 @@ *****************************************************************************/ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acdisasm.h> +#include "acpi.h" +#include "accommon.h" +#include "acdisasm.h" #ifdef ACPI_DISASSEMBLER @@ -215,7 +215,7 @@ AcpiDmMemoryFields ( UINT8 Type, UINT32 Level) { - ACPI_NATIVE_UINT i; + UINT32 i; for (i = 0; i < 4; i++) @@ -261,7 +261,7 @@ AcpiDmAddressFields ( UINT8 Type, UINT32 Level) { - ACPI_NATIVE_UINT i; + UINT32 i; AcpiOsPrintf ("\n"); @@ -1026,7 +1026,7 @@ AcpiDmInterruptDescriptor ( */ AcpiDmResourceSource (Resource, sizeof (AML_RESOURCE_EXTENDED_IRQ) + - (Resource->ExtendedIrq.InterruptCount - 1) * sizeof (UINT32), + ((UINT32) Resource->ExtendedIrq.InterruptCount - 1) * sizeof (UINT32), Resource->ExtendedIrq.ResourceLength); /* Insert a descriptor name */ diff --git a/sys/contrib/dev/acpica/dmresrcs.c b/sys/contrib/dev/acpica/disassembler/dmresrcs.c index b7df965dc273..50898527fbce 100644 --- a/sys/contrib/dev/acpica/dmresrcs.c +++ b/sys/contrib/dev/acpica/disassembler/dmresrcs.c @@ -1,7 +1,6 @@ /******************************************************************************* * * Module Name: dmresrcs.c - "Small" Resource Descriptor disassembly - * $Revision: 1.16 $ * ******************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -115,8 +114,9 @@ *****************************************************************************/ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acdisasm.h> +#include "acpi.h" +#include "accommon.h" +#include "acdisasm.h" #ifdef ACPI_DISASSEMBLER diff --git a/sys/contrib/dev/acpica/dmutils.c b/sys/contrib/dev/acpica/disassembler/dmutils.c index e6340a2d27d0..75794b9f705f 100644 --- a/sys/contrib/dev/acpica/dmutils.c +++ b/sys/contrib/dev/acpica/disassembler/dmutils.c @@ -1,7 +1,6 @@ /******************************************************************************* * * Module Name: dmutils - AML disassembler utilities - * $Revision: 1.25 $ * ******************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -115,12 +114,13 @@ *****************************************************************************/ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/amlcode.h> -#include <contrib/dev/acpica/acdisasm.h> +#include "acpi.h" +#include "accommon.h" +#include "amlcode.h" +#include "acdisasm.h" #ifdef ACPI_ASL_COMPILER -#include <contrib/dev/acpica/acnamesp.h> +#include <acnamesp.h> #endif #ifdef ACPI_DISASSEMBLER diff --git a/sys/contrib/dev/acpica/dmwalk.c b/sys/contrib/dev/acpica/disassembler/dmwalk.c index 12c74f4a24cf..156e2dd5b11c 100644 --- a/sys/contrib/dev/acpica/dmwalk.c +++ b/sys/contrib/dev/acpica/disassembler/dmwalk.c @@ -1,7 +1,6 @@ /******************************************************************************* * * Module Name: dmwalk - AML disassembly tree walk - * $Revision: 1.33 $ * ******************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -115,11 +114,12 @@ *****************************************************************************/ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acparser.h> -#include <contrib/dev/acpica/amlcode.h> -#include <contrib/dev/acpica/acdisasm.h> -#include <contrib/dev/acpica/acdebug.h> +#include "acpi.h" +#include "accommon.h" +#include "acparser.h" +#include "amlcode.h" +#include "acdisasm.h" +#include "acdebug.h" #ifdef ACPI_DISASSEMBLER @@ -148,6 +148,69 @@ 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]); +} + /******************************************************************************* * @@ -499,28 +562,9 @@ AcpiDmDescendingOp ( */ while (AcpiGbl_ExternalList) { - AcpiOsPrintf (" External (%s", - AcpiGbl_ExternalList->Path); - - /* TBD: should be a lookup table */ - - switch (AcpiGbl_ExternalList->Type) - { - case ACPI_TYPE_DEVICE: - AcpiOsPrintf (", DeviceObj"); - break; - - case ACPI_TYPE_METHOD: - AcpiOsPrintf (", MethodObj"); - break; - - case ACPI_TYPE_INTEGER: - AcpiOsPrintf (", IntObj"); - break; - - default: - break; - } + AcpiOsPrintf (" External (%s%s", + AcpiGbl_ExternalList->Path, + AcpiDmGetObjectTypeName (AcpiGbl_ExternalList->Type)); if (AcpiGbl_ExternalList->Type == ACPI_TYPE_METHOD) { @@ -622,7 +666,7 @@ AcpiDmDescendingOp ( } else { - AcpiDmDumpName ((char *) &Name); + AcpiDmDumpName (Name); } if (Op->Common.AmlOpcode != AML_INT_NAMEDFIELD_OP) diff --git a/sys/contrib/dev/acpica/dsfield.c b/sys/contrib/dev/acpica/dispatcher/dsfield.c index a13fe1d7bb5e..2d8e58689b80 100644 --- a/sys/contrib/dev/acpica/dsfield.c +++ b/sys/contrib/dev/acpica/dispatcher/dsfield.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: dsfield - Dispatcher field routines - * $Revision: 1.84 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,12 +115,13 @@ #define __DSFIELD_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/amlcode.h> -#include <contrib/dev/acpica/acdispat.h> -#include <contrib/dev/acpica/acinterp.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/acparser.h> +#include "acpi.h" +#include "accommon.h" +#include "amlcode.h" +#include "acdispat.h" +#include "acinterp.h" +#include "acnamesp.h" +#include "acparser.h" #define _COMPONENT ACPI_DISPATCHER @@ -171,15 +171,18 @@ AcpiDsCreateBufferField ( ACPI_FUNCTION_TRACE (DsCreateBufferField); - /* Get the NameString argument */ - + /* + * Get the NameString argument (name of the new BufferField) + */ if (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP) { + /* For CreateField, name is the 4th argument */ + Arg = AcpiPsGetArg (Op, 3); } else { - /* Create Bit/Byte/Word/Dword field */ + /* For all other CreateXXXField operators, name is the 3rd argument */ Arg = AcpiPsGetArg (Op, 2); } @@ -196,27 +199,30 @@ AcpiDsCreateBufferField ( } else { - /* - * During the load phase, we want to enter the name of the field into - * the namespace. During the execute phase (when we evaluate the size - * operand), we want to lookup the name - */ - if (WalkState->ParseFlags & ACPI_PARSE_EXECUTE) + /* Execute flag should always be set when this function is entered */ + + if (!(WalkState->ParseFlags & ACPI_PARSE_EXECUTE)) { - Flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE; + return_ACPI_STATUS (AE_AML_INTERNAL); } - else + + /* Creating new namespace node, should not already exist */ + + 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) { - Flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | - ACPI_NS_ERROR_IF_FOUND; + Flags |= ACPI_NS_TEMPORARY; } - /* - * Enter the NameString into the namespace - */ + /* Enter the NameString into the namespace */ + Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, - ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS1, - Flags, WalkState, &(Node)); + ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS1, + Flags, WalkState, &Node); if (ACPI_FAILURE (Status)) { ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status); @@ -227,13 +233,13 @@ AcpiDsCreateBufferField ( /* * We could put the returned object (Node) on the object stack for later, * but for now, we will put it in the "op" object that the parser uses, - * so we can get it again at the end of this scope + * so we can get it again at the end of this scope. */ Op->Common.Node = Node; /* * If there is no object attached to the node, this node was just created - * and we need to create the field object. Otherwise, this was a lookup + * and we need to create the field object. Otherwise, this was a lookup * of an existing node and we don't want to create the field object again. */ ObjDesc = AcpiNsGetAttachedObject (Node); @@ -257,9 +263,8 @@ AcpiDsCreateBufferField ( } /* - * Remember location in AML stream of the field unit - * opcode and operands -- since the buffer and index - * operands must be evaluated. + * Remember location in AML stream of the field unit opcode and operands -- + * since the buffer and index operands must be evaluated. */ SecondDesc = ObjDesc->Common.NextObject; SecondDesc->Extra.AmlStart = Op->Named.Data; @@ -364,34 +369,35 @@ AcpiDsGetFieldNames ( case AML_INT_NAMEDFIELD_OP: - /* Lookup the name */ + /* Lookup the name, it should already exist */ Status = AcpiNsLookup (WalkState->ScopeInfo, - (char *) &Arg->Named.Name, - Info->FieldType, ACPI_IMODE_EXECUTE, - ACPI_NS_DONT_OPEN_SCOPE, - WalkState, &Info->FieldNode); + (char *) &Arg->Named.Name, Info->FieldType, + ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE, + WalkState, &Info->FieldNode); if (ACPI_FAILURE (Status)) { ACPI_ERROR_NAMESPACE ((char *) &Arg->Named.Name, Status); - if (Status != AE_ALREADY_EXISTS) - { - return_ACPI_STATUS (Status); - } - - /* Already exists, ignore error */ + return_ACPI_STATUS (Status); } else { Arg->Common.Node = Info->FieldNode; Info->FieldBitLength = Arg->Common.Value.Size; - /* Create and initialize an object for the new Field Node */ - - Status = AcpiExPrepFieldValue (Info); - if (ACPI_FAILURE (Status)) + /* + * If there is no object attached to the node, this node was + * just created and we need to create the field object. + * Otherwise, this was a lookup of an existing node and we + * don't want to create the field object again. + */ + if (!AcpiNsGetAttachedObject (Info->FieldNode)) { - return_ACPI_STATUS (Status); + Status = AcpiExPrepFieldValue (Info); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } } } @@ -415,8 +421,7 @@ AcpiDsGetFieldNames ( default: ACPI_ERROR ((AE_INFO, - "Invalid opcode in field list: %X", - Arg->Common.AmlOpcode)); + "Invalid opcode in field list: %X", Arg->Common.AmlOpcode)); return_ACPI_STATUS (AE_AML_BAD_OPCODE); } @@ -511,11 +516,30 @@ AcpiDsInitFieldObjects ( ACPI_PARSE_OBJECT *Arg = NULL; ACPI_NAMESPACE_NODE *Node; UINT8 Type = 0; + UINT32 Flags; ACPI_FUNCTION_TRACE_PTR (DsInitFieldObjects, Op); + /* Execute flag should always be set when this function is entered */ + + if (!(WalkState->ParseFlags & ACPI_PARSE_EXECUTE)) + { + if (WalkState->ParseFlags & ACPI_PARSE_DEFERRED_OP) + { + /* BankField Op is deferred, just return OK */ + + return_ACPI_STATUS (AE_OK); + } + + return_ACPI_STATUS (AE_AML_INTERNAL); + } + + /* + * Get the FieldList argument for this opcode. This is the start of the + * list of field elements. + */ switch (WalkState->Opcode) { case AML_FIELD_OP: @@ -537,21 +561,33 @@ AcpiDsInitFieldObjects ( return_ACPI_STATUS (AE_BAD_PARAMETER); } + /* Creating new namespace node(s), should not already exist */ + + 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) + { + Flags |= ACPI_NS_TEMPORARY; + } + /* * Walk the list of entries in the FieldList + * Note: FieldList can be of zero length. In this case, Arg will be NULL. */ while (Arg) { - /* Ignore OFFSET and ACCESSAS terms here */ - + /* + * Ignore OFFSET and ACCESSAS terms here; we are only interested in the + * field names in order to enter them into the namespace. + */ if (Arg->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP) { Status = AcpiNsLookup (WalkState->ScopeInfo, - (char *) &Arg->Named.Name, - Type, ACPI_IMODE_LOAD_PASS1, - ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | - ACPI_NS_ERROR_IF_FOUND, - WalkState, &Node); + (char *) &Arg->Named.Name, Type, ACPI_IMODE_LOAD_PASS1, + Flags, WalkState, &Node); if (ACPI_FAILURE (Status)) { ACPI_ERROR_NAMESPACE ((char *) &Arg->Named.Name, Status); @@ -568,7 +604,7 @@ AcpiDsInitFieldObjects ( Arg->Common.Node = Node; } - /* Move to next field in the list */ + /* Get the next field element in the list */ Arg = Arg->Common.Next; } @@ -583,7 +619,7 @@ AcpiDsInitFieldObjects ( * * PARAMETERS: Op - Op containing the Field definition and args * RegionNode - Object for the containing Operation Region - * ` WalkState - Current method state + * WalkState - Current method state * * RETURN: Status * @@ -632,36 +668,13 @@ AcpiDsCreateBankField ( return_ACPI_STATUS (Status); } - /* Third arg is the BankValue */ - - /* TBD: This arg is a TermArg, not a constant, and must be evaluated */ - + /* + * Third arg is the BankValue + * This arg is a TermArg, not a constant + * It will be evaluated later, by AcpiDsEvalBankFieldOperands + */ Arg = Arg->Common.Next; - /* Currently, only the following constants are supported */ - - switch (Arg->Common.AmlOpcode) - { - case AML_ZERO_OP: - Info.BankValue = 0; - break; - - case AML_ONE_OP: - Info.BankValue = 1; - break; - - case AML_BYTE_OP: - case AML_WORD_OP: - case AML_DWORD_OP: - case AML_QWORD_OP: - Info.BankValue = (UINT32) Arg->Common.Value.Integer; - break; - - default: - Info.BankValue = 0; - ACPI_ERROR ((AE_INFO, "Non-constant BankValue for BankField is not implemented")); - } - /* Fourth arg is the field flags */ Arg = Arg->Common.Next; @@ -672,8 +685,17 @@ AcpiDsCreateBankField ( Info.FieldType = ACPI_TYPE_LOCAL_BANK_FIELD; Info.RegionNode = RegionNode; - Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next); + /* + * Use Info.DataRegisterNode to store BankField Op + * It's safe because DataRegisterNode will never be used when create bank field + * We store AmlStart and AmlLength in the BankField Op for late evaluation + * Used in AcpiExPrepFieldValue(Info) + * + * TBD: Or, should we add a field in ACPI_CREATE_FIELD_INFO, like "void *ParentOp"? + */ + Info.DataRegisterNode = (ACPI_NAMESPACE_NODE*) Op; + Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next); return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/dsinit.c b/sys/contrib/dev/acpica/dispatcher/dsinit.c index 32335e515ef4..af29476410ff 100644 --- a/sys/contrib/dev/acpica/dsinit.c +++ b/sys/contrib/dev/acpica/dispatcher/dsinit.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: dsinit - Object initialization namespace walk - * $Revision: 1.28 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,10 +115,11 @@ #define __DSINIT_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acdispat.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/actables.h> +#include "acpi.h" +#include "accommon.h" +#include "acdispat.h" +#include "acnamesp.h" +#include "actables.h" #define _COMPONENT ACPI_DISPATCHER ACPI_MODULE_NAME ("dsinit") @@ -241,7 +241,7 @@ AcpiDsInitOneObject ( ACPI_STATUS AcpiDsInitializeObjects ( - ACPI_NATIVE_UINT TableIndex, + UINT32 TableIndex, ACPI_NAMESPACE_NODE *StartNode) { ACPI_STATUS Status; @@ -272,12 +272,23 @@ AcpiDsInitializeObjects ( /* Walk entire namespace from the supplied root */ - Status = AcpiWalkNamespace (ACPI_TYPE_ANY, StartNode, ACPI_UINT32_MAX, - AcpiDsInitOneObject, &Info, NULL); + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* + * We don't use AcpiWalkNamespace since we do not want to acquire + * the namespace reader lock. + */ + Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, StartNode, ACPI_UINT32_MAX, + ACPI_NS_WALK_UNLOCK, AcpiDsInitOneObject, &Info, NULL); if (ACPI_FAILURE (Status)) { ACPI_EXCEPTION ((AE_INFO, Status, "During WalkNamespace")); } + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); Status = AcpiGetTableByIndex (TableIndex, &Table); if (ACPI_FAILURE (Status)) diff --git a/sys/contrib/dev/acpica/dsmethod.c b/sys/contrib/dev/acpica/dispatcher/dsmethod.c index 514f3a145c09..d4127fd769e3 100644 --- a/sys/contrib/dev/acpica/dsmethod.c +++ b/sys/contrib/dev/acpica/dispatcher/dsmethod.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: dsmethod - Parser/Interpreter interface - control method parsing - * $Revision: 1.136 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,13 +115,13 @@ #define __DSMETHOD_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acparser.h> -#include <contrib/dev/acpica/amlcode.h> -#include <contrib/dev/acpica/acdispat.h> -#include <contrib/dev/acpica/acinterp.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/acdisasm.h> +#include "acpi.h" +#include "accommon.h" +#include "amlcode.h" +#include "acdispat.h" +#include "acinterp.h" +#include "acnamesp.h" +#include "acdisasm.h" #define _COMPONENT ACPI_DISPATCHER @@ -183,9 +182,11 @@ AcpiDsMethodError ( WalkState->MethodNode ? WalkState->MethodNode->Name.Integer : 0, WalkState->Opcode, WalkState->AmlOffset, NULL); - (void) AcpiExEnterInterpreter (); + AcpiExEnterInterpreter (); } + AcpiDsClearImplicitReturn (WalkState); + #ifdef ACPI_DISASSEMBLER if (ACPI_FAILURE (Status)) { @@ -384,6 +385,7 @@ AcpiDsBeginMethodExecution ( * reentered one more time (even if it is the same thread) */ ObjDesc->Method.ThreadCount++; + AcpiMethodCount++; return_ACPI_STATUS (Status); @@ -484,7 +486,6 @@ AcpiDsCallControlMethod ( } Info->Parameters = &ThisWalkState->Operands[0]; - Info->ParameterType = ACPI_PARAM_ARGS; Status = AcpiDsInitAmlWalk (NextWalkState, NULL, MethodNode, ObjDesc->Method.AmlStart, ObjDesc->Method.AmlLength, @@ -519,6 +520,10 @@ AcpiDsCallControlMethod ( if (ObjDesc->Method.MethodFlags & AML_METHOD_INTERNAL_ONLY) { Status = ObjDesc->Method.Implementation (NextWalkState); + if (Status == AE_OK) + { + Status = AE_CTRL_TERMINATE; + } } return_ACPI_STATUS (Status); @@ -651,8 +656,6 @@ AcpiDsTerminateControlMethod ( ACPI_OPERAND_OBJECT *MethodDesc, ACPI_WALK_STATE *WalkState) { - ACPI_STATUS Status; - ACPI_FUNCTION_TRACE_PTR (DsTerminateControlMethod, WalkState); @@ -669,29 +672,26 @@ AcpiDsTerminateControlMethod ( /* Delete all arguments and locals */ AcpiDsMethodDataDeleteAll (WalkState); - } - - /* - * If method is serialized, release the mutex and restore the - * current sync level for this thread - */ - if (MethodDesc->Method.Mutex) - { - /* Acquisition Depth handles recursive calls */ - MethodDesc->Method.Mutex->Mutex.AcquisitionDepth--; - if (!MethodDesc->Method.Mutex->Mutex.AcquisitionDepth) + /* + * If method is serialized, release the mutex and restore the + * current sync level for this thread + */ + if (MethodDesc->Method.Mutex) { - WalkState->Thread->CurrentSyncLevel = - MethodDesc->Method.Mutex->Mutex.OriginalSyncLevel; + /* Acquisition Depth handles recursive calls */ + + MethodDesc->Method.Mutex->Mutex.AcquisitionDepth--; + if (!MethodDesc->Method.Mutex->Mutex.AcquisitionDepth) + { + WalkState->Thread->CurrentSyncLevel = + MethodDesc->Method.Mutex->Mutex.OriginalSyncLevel; - AcpiOsReleaseMutex (MethodDesc->Method.Mutex->Mutex.OsMutex); - MethodDesc->Method.Mutex->Mutex.ThreadId = 0; + AcpiOsReleaseMutex (MethodDesc->Method.Mutex->Mutex.OsMutex); + MethodDesc->Method.Mutex->Mutex.ThreadId = 0; + } } - } - if (WalkState) - { /* * Delete any namespace objects created anywhere within * the namespace by the execution of this method @@ -740,7 +740,7 @@ AcpiDsTerminateControlMethod ( if ((MethodDesc->Method.MethodFlags & AML_METHOD_SERIALIZED) && (!MethodDesc->Method.Mutex)) { - Status = AcpiDsCreateMethodMutex (MethodDesc); + (void) AcpiDsCreateMethodMutex (MethodDesc); } /* No more threads, we can free the OwnerId */ diff --git a/sys/contrib/dev/acpica/dsmthdat.c b/sys/contrib/dev/acpica/dispatcher/dsmthdat.c index 10c1a9bba7fe..809ef1f0e80d 100644 --- a/sys/contrib/dev/acpica/dsmthdat.c +++ b/sys/contrib/dev/acpica/dispatcher/dsmthdat.c @@ -1,7 +1,6 @@ /******************************************************************************* * * Module Name: dsmthdat - control method arguments and local variables - * $Revision: 1.92 $ * ******************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,11 +115,11 @@ #define __DSMTHDAT_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acdispat.h> -#include <contrib/dev/acpica/amlcode.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/acinterp.h> +#include "acpi.h" +#include "accommon.h" +#include "acdispat.h" +#include "acnamesp.h" +#include "acinterp.h" #define _COMPONENT ACPI_DISPATCHER @@ -130,13 +129,13 @@ static void AcpiDsMethodDataDeleteValue ( - UINT16 Opcode, + UINT8 Type, UINT32 Index, ACPI_WALK_STATE *WalkState); static ACPI_STATUS AcpiDsMethodDataSetValue ( - UINT16 Opcode, + UINT8 Type, UINT32 Index, ACPI_OPERAND_OBJECT *Object, ACPI_WALK_STATE *WalkState); @@ -313,7 +312,7 @@ AcpiDsMethodDataInitArgs ( * Store the argument in the method/walk descriptor. * Do not copy the arg in order to implement call by reference */ - Status = AcpiDsMethodDataSetValue (AML_ARG_OP, Index, + Status = AcpiDsMethodDataSetValue (ACPI_REFCLASS_ARG, Index, Params[Index], WalkState); if (ACPI_FAILURE (Status)) { @@ -332,7 +331,8 @@ AcpiDsMethodDataInitArgs ( * * FUNCTION: AcpiDsMethodDataGetNode * - * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP + * PARAMETERS: Type - Either ACPI_REFCLASS_LOCAL or + * ACPI_REFCLASS_ARG * Index - Which Local or Arg whose type to get * WalkState - Current walk state object * Node - Where the node is returned. @@ -345,7 +345,7 @@ AcpiDsMethodDataInitArgs ( ACPI_STATUS AcpiDsMethodDataGetNode ( - UINT16 Opcode, + UINT8 Type, UINT32 Index, ACPI_WALK_STATE *WalkState, ACPI_NAMESPACE_NODE **Node) @@ -356,9 +356,9 @@ AcpiDsMethodDataGetNode ( /* * Method Locals and Arguments are supported */ - switch (Opcode) + switch (Type) { - case AML_LOCAL_OP: + case ACPI_REFCLASS_LOCAL: if (Index > ACPI_METHOD_MAX_LOCAL) { @@ -373,7 +373,7 @@ AcpiDsMethodDataGetNode ( *Node = &WalkState->LocalVariables[Index]; break; - case AML_ARG_OP: + case ACPI_REFCLASS_ARG: if (Index > ACPI_METHOD_MAX_ARG) { @@ -389,8 +389,8 @@ AcpiDsMethodDataGetNode ( break; default: - ACPI_ERROR ((AE_INFO, "Opcode %d is invalid", Opcode)); - return_ACPI_STATUS (AE_AML_BAD_OPCODE); + ACPI_ERROR ((AE_INFO, "Type %d is invalid", Type)); + return_ACPI_STATUS (AE_TYPE); } return_ACPI_STATUS (AE_OK); @@ -401,7 +401,8 @@ AcpiDsMethodDataGetNode ( * * FUNCTION: AcpiDsMethodDataSetValue * - * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP + * PARAMETERS: Type - Either ACPI_REFCLASS_LOCAL or + * ACPI_REFCLASS_ARG * Index - Which Local or Arg to get * Object - Object to be inserted into the stack entry * WalkState - Current walk state object @@ -415,7 +416,7 @@ AcpiDsMethodDataGetNode ( static ACPI_STATUS AcpiDsMethodDataSetValue ( - UINT16 Opcode, + UINT8 Type, UINT32 Index, ACPI_OPERAND_OBJECT *Object, ACPI_WALK_STATE *WalkState) @@ -428,13 +429,13 @@ AcpiDsMethodDataSetValue ( ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "NewObj %p Opcode %X, Refs=%d [%s]\n", Object, - Opcode, Object->Common.ReferenceCount, + "NewObj %p Type %2.2X, Refs=%d [%s]\n", Object, + Type, Object->Common.ReferenceCount, AcpiUtGetTypeName (Object->Common.Type))); /* Get the namespace node for the arg/local */ - Status = AcpiDsMethodDataGetNode (Opcode, Index, WalkState, &Node); + Status = AcpiDsMethodDataGetNode (Type, Index, WalkState, &Node); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -459,7 +460,8 @@ AcpiDsMethodDataSetValue ( * * FUNCTION: AcpiDsMethodDataGetValue * - * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP + * PARAMETERS: Type - Either ACPI_REFCLASS_LOCAL or + * ACPI_REFCLASS_ARG * Index - Which localVar or argument to get * WalkState - Current walk state object * DestDesc - Where Arg or Local value is returned @@ -473,7 +475,7 @@ AcpiDsMethodDataSetValue ( ACPI_STATUS AcpiDsMethodDataGetValue ( - UINT16 Opcode, + UINT8 Type, UINT32 Index, ACPI_WALK_STATE *WalkState, ACPI_OPERAND_OBJECT **DestDesc) @@ -496,7 +498,7 @@ AcpiDsMethodDataGetValue ( /* Get the namespace node for the arg/local */ - Status = AcpiDsMethodDataGetNode (Opcode, Index, WalkState, &Node); + Status = AcpiDsMethodDataGetNode (Type, Index, WalkState, &Node); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -534,9 +536,9 @@ AcpiDsMethodDataGetValue ( /* Otherwise, return the error */ - else switch (Opcode) + else switch (Type) { - case AML_ARG_OP: + case ACPI_REFCLASS_ARG: ACPI_ERROR ((AE_INFO, "Uninitialized Arg[%d] at node %p", @@ -544,16 +546,16 @@ AcpiDsMethodDataGetValue ( return_ACPI_STATUS (AE_AML_UNINITIALIZED_ARG); - case AML_LOCAL_OP: + case ACPI_REFCLASS_LOCAL: ACPI_ERROR ((AE_INFO, - "Uninitialized Local[%d] at node %p", - Index, Node)); + "Uninitialized Local[%d] at node %p", Index, Node)); return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL); default: - ACPI_ERROR ((AE_INFO, "Not a Arg/Local opcode: %X", Opcode)); + + ACPI_ERROR ((AE_INFO, "Not a Arg/Local opcode: %X", Type)); return_ACPI_STATUS (AE_AML_INTERNAL); } } @@ -573,7 +575,8 @@ AcpiDsMethodDataGetValue ( * * FUNCTION: AcpiDsMethodDataDeleteValue * - * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP + * PARAMETERS: Type - Either ACPI_REFCLASS_LOCAL or + * ACPI_REFCLASS_ARG * Index - Which localVar or argument to delete * WalkState - Current walk state object * @@ -586,7 +589,7 @@ AcpiDsMethodDataGetValue ( static void AcpiDsMethodDataDeleteValue ( - UINT16 Opcode, + UINT8 Type, UINT32 Index, ACPI_WALK_STATE *WalkState) { @@ -600,7 +603,7 @@ AcpiDsMethodDataDeleteValue ( /* Get the namespace node for the arg/local */ - Status = AcpiDsMethodDataGetNode (Opcode, Index, WalkState, &Node); + Status = AcpiDsMethodDataGetNode (Type, Index, WalkState, &Node); if (ACPI_FAILURE (Status)) { return_VOID; @@ -636,7 +639,8 @@ AcpiDsMethodDataDeleteValue ( * * FUNCTION: AcpiDsStoreObjectToLocal * - * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP + * PARAMETERS: Type - Either ACPI_REFCLASS_LOCAL or + * ACPI_REFCLASS_ARG * Index - Which Local or Arg to set * ObjDesc - Value to be stored * WalkState - Current walk state @@ -651,7 +655,7 @@ AcpiDsMethodDataDeleteValue ( ACPI_STATUS AcpiDsStoreObjectToLocal ( - UINT16 Opcode, + UINT8 Type, UINT32 Index, ACPI_OPERAND_OBJECT *ObjDesc, ACPI_WALK_STATE *WalkState) @@ -663,8 +667,8 @@ AcpiDsStoreObjectToLocal ( ACPI_FUNCTION_TRACE (DsStoreObjectToLocal); - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode=%X Index=%d Obj=%p\n", - Opcode, Index, ObjDesc)); + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Type=%2.2X Index=%d Obj=%p\n", + Type, Index, ObjDesc)); /* Parameter validation */ @@ -675,7 +679,7 @@ AcpiDsStoreObjectToLocal ( /* Get the namespace node for the arg/local */ - Status = AcpiDsMethodDataGetNode (Opcode, Index, WalkState, &Node); + Status = AcpiDsMethodDataGetNode (Type, Index, WalkState, &Node); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -730,7 +734,7 @@ AcpiDsStoreObjectToLocal ( * * Weird, but true. */ - if (Opcode == AML_ARG_OP) + if (Type == ACPI_REFCLASS_ARG) { /* * If we have a valid reference object that came from RefOf(), @@ -738,7 +742,7 @@ AcpiDsStoreObjectToLocal ( */ if ((ACPI_GET_DESCRIPTOR_TYPE (CurrentObjDesc) == ACPI_DESC_TYPE_OPERAND) && (CurrentObjDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) && - (CurrentObjDesc->Reference.Opcode == AML_REF_OF_OP)) + (CurrentObjDesc->Reference.Class == ACPI_REFCLASS_REFOF)) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Arg (%p) is an ObjRef(Node), storing in node %p\n", @@ -763,11 +767,9 @@ AcpiDsStoreObjectToLocal ( } } - /* - * Delete the existing object - * before storing the new one - */ - AcpiDsMethodDataDeleteValue (Opcode, Index, WalkState); + /* Delete the existing object before storing the new one */ + + AcpiDsMethodDataDeleteValue (Type, Index, WalkState); } /* @@ -775,7 +777,7 @@ AcpiDsStoreObjectToLocal ( * the descriptor for the Arg or Local. * (increments the object reference count by one) */ - Status = AcpiDsMethodDataSetValue (Opcode, Index, NewObjDesc, WalkState); + Status = AcpiDsMethodDataSetValue (Type, Index, NewObjDesc, WalkState); /* Remove local reference if we copied the object above */ @@ -837,7 +839,7 @@ AcpiDsMethodDataGetType ( /* Get the object type */ - return_VALUE (ACPI_GET_OBJECT_TYPE (Object)); + return_VALUE (Object->Type); } #endif diff --git a/sys/contrib/dev/acpica/dsobject.c b/sys/contrib/dev/acpica/dispatcher/dsobject.c index a0582992aed7..647adb2b62bd 100644 --- a/sys/contrib/dev/acpica/dsobject.c +++ b/sys/contrib/dev/acpica/dispatcher/dsobject.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: dsobject - Dispatcher object management routines - * $Revision: 1.135 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,12 +115,13 @@ #define __DSOBJECT_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acparser.h> -#include <contrib/dev/acpica/amlcode.h> -#include <contrib/dev/acpica/acdispat.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/acinterp.h> +#include "acpi.h" +#include "accommon.h" +#include "acparser.h" +#include "amlcode.h" +#include "acdispat.h" +#include "acnamesp.h" +#include "acinterp.h" #define _COMPONENT ACPI_DISPATCHER ACPI_MODULE_NAME ("dsobject") @@ -211,6 +211,72 @@ AcpiDsBuildInternalObject ( return_ACPI_STATUS (Status); } } + + /* Special object resolution for elements of a package */ + + if ((Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) || + (Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP)) + { + /* + * Attempt to resolve the node to a value before we insert it into + * the package. If this is a reference to a common data type, + * resolve it immediately. According to the ACPI spec, package + * elements can only be "data objects" or method references. + * Attempt to resolve to an Integer, Buffer, String or Package. + * If cannot, return the named reference (for things like Devices, + * Methods, etc.) Buffer Fields and Fields will resolve to simple + * objects (int/buf/str/pkg). + * + * NOTE: References to things like Devices, Methods, Mutexes, etc. + * will remain as named references. This behavior is not described + * in the ACPI spec, but it appears to be an oversight. + */ + ObjDesc = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Op->Common.Node); + + Status = AcpiExResolveNodeToValue ( + ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, &ObjDesc), + WalkState); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + switch (Op->Common.Node->Type) + { + /* + * For these types, we need the actual node, not the subobject. + * However, the subobject did not get an extra reference count above. + * + * TBD: should ExResolveNodeToValue be changed to fix this? + */ + case ACPI_TYPE_DEVICE: + case ACPI_TYPE_THERMAL: + + AcpiUtAddReference (Op->Common.Node->Object); + + /*lint -fallthrough */ + /* + * For these types, we need the actual node, not the subobject. + * The subobject got an extra reference count in ExResolveNodeToValue. + */ + case ACPI_TYPE_MUTEX: + case ACPI_TYPE_METHOD: + case ACPI_TYPE_POWER: + case ACPI_TYPE_PROCESSOR: + case ACPI_TYPE_EVENT: + case ACPI_TYPE_REGION: + + /* We will create a reference object for these types below */ + break; + + default: + /* + * All other types - the node was resolved to an actual + * object, we are done. + */ + goto Exit; + } + } } /* Create and init a new internal ACPI object */ @@ -230,8 +296,9 @@ AcpiDsBuildInternalObject ( return_ACPI_STATUS (Status); } +Exit: *ObjDescPtr = ObjDesc; - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS (Status); } @@ -392,7 +459,7 @@ AcpiDsBuildInternalPackageObj ( ACPI_PARSE_OBJECT *Parent; ACPI_OPERAND_OBJECT *ObjDesc = NULL; ACPI_STATUS Status = AE_OK; - ACPI_NATIVE_UINT i; + UINT32 i; UINT16 Index; UINT16 ReferenceCount; @@ -454,10 +521,23 @@ AcpiDsBuildInternalPackageObj ( { if (Arg->Common.AmlOpcode == AML_INT_RETURN_VALUE_OP) { - /* This package element is already built, just get it */ + if (Arg->Common.Node->Type == ACPI_TYPE_METHOD) + { + /* + * A method reference "looks" to the parser to be a method + * invocation, so we special case it here + */ + Arg->Common.AmlOpcode = AML_INT_NAMEPATH_OP; + Status = AcpiDsBuildInternalObject (WalkState, Arg, + &ObjDesc->Package.Elements[i]); + } + else + { + /* This package element is already built, just get it */ - ObjDesc->Package.Elements[i] = - ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Arg->Common.Node); + ObjDesc->Package.Elements[i] = + ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Arg->Common.Node); + } } else { @@ -484,11 +564,40 @@ AcpiDsBuildInternalPackageObj ( Arg = Arg->Common.Next; } - if (!Arg) + /* Check for match between NumElements and actual length of PackageList */ + + if (Arg) + { + /* + * NumElements was exhausted, but there are remaining elements in the + * PackageList. + * + * 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. + */ + while (Arg) + { + /* 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", + i, ElementCount)); + } + else if (i < ElementCount) { + /* + * Arg list (elements) was exhausted, but we did not reach NumElements count. + * Note: this is not an error, the package is padded out with NULLs. + */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Package List length larger than NumElements count (%X), truncated\n", - ElementCount)); + "Package List length (%X) smaller than NumElements count (%X), padded with null elements\n", + i, ElementCount)); } ObjDesc->Package.Flags |= AOPOBJ_DATA_VALID; @@ -552,7 +661,7 @@ AcpiDsCreateNode ( /* Re-type the object according to its argument */ - Node->Type = ACPI_GET_OBJECT_TYPE (ObjDesc); + Node->Type = ObjDesc->Common.Type; /* Attach obj to node */ @@ -610,7 +719,7 @@ AcpiDsInitObjectFromOp ( /* Perform per-object initialization */ - switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) + switch (ObjDesc->Common.Type) { case ACPI_TYPE_BUFFER: @@ -730,45 +839,59 @@ AcpiDsInitObjectFromOp ( { case AML_TYPE_LOCAL_VARIABLE: - /* Split the opcode into a base opcode + offset */ + /* Local ID (0-7) is (AML opcode - base AML_LOCAL_OP) */ - ObjDesc->Reference.Opcode = AML_LOCAL_OP; - ObjDesc->Reference.Offset = Opcode - AML_LOCAL_OP; + ObjDesc->Reference.Value = ((UINT32) Opcode) - AML_LOCAL_OP; + ObjDesc->Reference.Class = ACPI_REFCLASS_LOCAL; #ifndef ACPI_NO_METHOD_EXECUTION - Status = AcpiDsMethodDataGetNode (AML_LOCAL_OP, - ObjDesc->Reference.Offset, - WalkState, - (ACPI_NAMESPACE_NODE **) &ObjDesc->Reference.Object); + Status = AcpiDsMethodDataGetNode (ACPI_REFCLASS_LOCAL, + ObjDesc->Reference.Value, WalkState, + ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, + &ObjDesc->Reference.Object)); #endif break; case AML_TYPE_METHOD_ARGUMENT: - /* Split the opcode into a base opcode + offset */ + /* Arg ID (0-6) is (AML opcode - base AML_ARG_OP) */ - ObjDesc->Reference.Opcode = AML_ARG_OP; - ObjDesc->Reference.Offset = Opcode - AML_ARG_OP; + ObjDesc->Reference.Value = ((UINT32) Opcode) - AML_ARG_OP; + ObjDesc->Reference.Class = ACPI_REFCLASS_ARG; #ifndef ACPI_NO_METHOD_EXECUTION - Status = AcpiDsMethodDataGetNode (AML_ARG_OP, - ObjDesc->Reference.Offset, - WalkState, - (ACPI_NAMESPACE_NODE **) &ObjDesc->Reference.Object); + Status = AcpiDsMethodDataGetNode (ACPI_REFCLASS_ARG, + ObjDesc->Reference.Value, WalkState, + ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, + &ObjDesc->Reference.Object)); #endif break; - default: /* Other literals, etc.. */ + default: /* Object name or Debug object */ - if (Op->Common.AmlOpcode == AML_INT_NAMEPATH_OP) + switch (Op->Common.AmlOpcode) { + case AML_INT_NAMEPATH_OP: + /* Node was saved in Op */ ObjDesc->Reference.Node = Op->Common.Node; - } + ObjDesc->Reference.Object = Op->Common.Node->Object; + ObjDesc->Reference.Class = ACPI_REFCLASS_NAME; + break; + + case AML_DEBUG_OP: - ObjDesc->Reference.Opcode = Opcode; + ObjDesc->Reference.Class = ACPI_REFCLASS_DEBUG; + break; + + default: + + ACPI_ERROR ((AE_INFO, + "Unimplemented reference type for AML opcode: %4.4X", Opcode)); + return_ACPI_STATUS (AE_AML_OPERAND_TYPE); + } break; } break; @@ -777,7 +900,7 @@ AcpiDsInitObjectFromOp ( default: ACPI_ERROR ((AE_INFO, "Unimplemented data type: %X", - ACPI_GET_OBJECT_TYPE (ObjDesc))); + ObjDesc->Common.Type)); Status = AE_AML_OPERAND_TYPE; break; diff --git a/sys/contrib/dev/acpica/dsopcode.c b/sys/contrib/dev/acpica/dispatcher/dsopcode.c index 7760ac6d51ee..3edbacc1d956 100644 --- a/sys/contrib/dev/acpica/dsopcode.c +++ b/sys/contrib/dev/acpica/dispatcher/dsopcode.c @@ -2,7 +2,6 @@ * * Module Name: dsopcode - Dispatcher Op Region support and handling of * "control" opcodes - * $Revision: 1.111 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,13 +116,15 @@ #define __DSOPCODE_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acparser.h> -#include <contrib/dev/acpica/amlcode.h> -#include <contrib/dev/acpica/acdispat.h> -#include <contrib/dev/acpica/acinterp.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/acevents.h> +#include "acpi.h" +#include "accommon.h" +#include "acparser.h" +#include "amlcode.h" +#include "acdispat.h" +#include "acinterp.h" +#include "acnamesp.h" +#include "acevents.h" +#include "actables.h" #define _COMPONENT ACPI_DISPATCHER ACPI_MODULE_NAME ("dsopcode") @@ -314,6 +315,53 @@ AcpiDsGetBufferFieldArguments ( /******************************************************************************* * + * FUNCTION: AcpiDsGetBankFieldArguments + * + * PARAMETERS: ObjDesc - A valid BankField object + * + * RETURN: Status. + * + * DESCRIPTION: Get BankField BankValue. This implements the late + * evaluation of these field attributes. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiDsGetBankFieldArguments ( + ACPI_OPERAND_OBJECT *ObjDesc) +{ + ACPI_OPERAND_OBJECT *ExtraDesc; + ACPI_NAMESPACE_NODE *Node; + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE_PTR (DsGetBankFieldArguments, ObjDesc); + + + if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) + { + return_ACPI_STATUS (AE_OK); + } + + /* Get the AML pointer (method object) and BankField node */ + + ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc); + Node = ObjDesc->BankField.Node; + + ACPI_DEBUG_EXEC(AcpiUtDisplayInitPathname (ACPI_TYPE_LOCAL_BANK_FIELD, Node, NULL)); + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] BankField Arg Init\n", + AcpiUtGetNodeName (Node))); + + /* Execute the AML code for the TermArg arguments */ + + Status = AcpiDsExecuteArguments (Node, AcpiNsGetParentNode (Node), + ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart); + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * * FUNCTION: AcpiDsGetBufferArguments * * PARAMETERS: ObjDesc - A valid Buffer object @@ -459,28 +507,6 @@ AcpiDsGetRegionArguments ( Status = AcpiDsExecuteArguments (Node, AcpiNsGetParentNode (Node), ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Validate the region address/length via the host OS */ - - Status = AcpiOsValidateAddress (ObjDesc->Region.SpaceId, - ObjDesc->Region.Address, (ACPI_SIZE) ObjDesc->Region.Length); - if (ACPI_FAILURE (Status)) - { - /* - * Invalid address/length. We will emit an error message and mark - * the region as invalid, so that it will cause an additional error if - * it is ever used. Then return AE_OK. - */ - ACPI_EXCEPTION ((AE_INFO, Status, - "During address validation of OpRegion [%4.4s]", Node->Name.Ascii)); - ObjDesc->Common.Flags |= AOPOBJ_INVALID; - Status = AE_OK; - } - return_ACPI_STATUS (Status); } @@ -552,7 +578,7 @@ AcpiDsInitBufferField ( /* Host object must be a Buffer */ - if (ACPI_GET_OBJECT_TYPE (BufferDesc) != ACPI_TYPE_BUFFER) + if (BufferDesc->Common.Type != ACPI_TYPE_BUFFER) { ACPI_ERROR ((AE_INFO, "Target of Create Field is not a Buffer object - %s", @@ -778,11 +804,6 @@ AcpiDsEvalBufferFieldOperands ( Status = AcpiExResolveOperands (Op->Common.AmlOpcode, ACPI_WALK_OPERANDS, WalkState); - - ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, - AcpiPsGetOpcodeName (Op->Common.AmlOpcode), - WalkState->NumOperands, "after AcpiExResolveOperands"); - if (ACPI_FAILURE (Status)) { ACPI_ERROR ((AE_INFO, "(%s) bad operand(s) (%X)", @@ -874,10 +895,6 @@ AcpiDsEvalRegionOperands ( return_ACPI_STATUS (Status); } - ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, - AcpiPsGetOpcodeName (Op->Common.AmlOpcode), - 1, "after AcpiExResolveOperands"); - ObjDesc = AcpiNsGetAttachedObject (Node); if (!ObjDesc) { @@ -905,7 +922,113 @@ AcpiDsEvalRegionOperands ( ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n", ObjDesc, - ACPI_FORMAT_UINT64 (ObjDesc->Region.Address), + ACPI_FORMAT_NATIVE_UINT (ObjDesc->Region.Address), + ObjDesc->Region.Length)); + + /* Now the address and length are valid for this opregion */ + + ObjDesc->Region.Flags |= AOPOBJ_DATA_VALID; + + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDsEvalTableRegionOperands + * + * PARAMETERS: WalkState - Current walk + * Op - A valid region Op object + * + * RETURN: Status + * + * DESCRIPTION: Get region address and length + * Called from AcpiDsExecEndOp during DataTableRegion parse tree walk + * + ******************************************************************************/ + +ACPI_STATUS +AcpiDsEvalTableRegionOperands ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op) +{ + ACPI_STATUS Status; + ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_OPERAND_OBJECT **Operand; + ACPI_NAMESPACE_NODE *Node; + ACPI_PARSE_OBJECT *NextOp; + UINT32 TableIndex; + ACPI_TABLE_HEADER *Table; + + + ACPI_FUNCTION_TRACE_PTR (DsEvalTableRegionOperands, Op); + + + /* + * This is where we evaluate the SignatureString and OemIDString + * and OemTableIDString of the DataTableRegion declaration + */ + Node = Op->Common.Node; + + /* NextOp points to SignatureString op */ + + NextOp = Op->Common.Value.Arg; + + /* + * Evaluate/create the SignatureString and OemIDString + * and OemTableIDString operands + */ + Status = AcpiDsCreateOperands (WalkState, NextOp); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* + * Resolve the SignatureString and OemIDString + * and OemTableIDString operands + */ + Status = AcpiExResolveOperands (Op->Common.AmlOpcode, + ACPI_WALK_OPERANDS, WalkState); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + Operand = &WalkState->Operands[0]; + + /* Find the ACPI table */ + + Status = AcpiTbFindTable (Operand[0]->String.Pointer, + Operand[1]->String.Pointer, Operand[2]->String.Pointer, + &TableIndex); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + AcpiUtRemoveReference (Operand[0]); + AcpiUtRemoveReference (Operand[1]); + AcpiUtRemoveReference (Operand[2]); + + Status = AcpiGetTableByIndex (TableIndex, &Table); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + ObjDesc = AcpiNsGetAttachedObject (Node); + if (!ObjDesc) + { + return_ACPI_STATUS (AE_NOT_EXIST); + } + + ObjDesc->Region.Address = (ACPI_PHYSICAL_ADDRESS) ACPI_TO_INTEGER (Table); + ObjDesc->Region.Length = Table->Length; + + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n", + ObjDesc, + ACPI_FORMAT_NATIVE_UINT (ObjDesc->Region.Address), ObjDesc->Region.Length)); /* Now the address and length are valid for this opregion */ @@ -1024,6 +1147,111 @@ AcpiDsEvalDataObjectOperands ( /******************************************************************************* * + * FUNCTION: AcpiDsEvalBankFieldOperands + * + * PARAMETERS: WalkState - Current walk + * Op - A valid BankField Op object + * + * RETURN: Status + * + * DESCRIPTION: Get BankField BankValue + * Called from AcpiDsExecEndOp during BankField parse tree walk + * + ******************************************************************************/ + +ACPI_STATUS +AcpiDsEvalBankFieldOperands ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op) +{ + ACPI_STATUS Status; + ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_OPERAND_OBJECT *OperandDesc; + ACPI_NAMESPACE_NODE *Node; + ACPI_PARSE_OBJECT *NextOp; + ACPI_PARSE_OBJECT *Arg; + + + ACPI_FUNCTION_TRACE_PTR (DsEvalBankFieldOperands, Op); + + + /* + * This is where we evaluate the BankValue field of the + * BankField declaration + */ + + /* NextOp points to the op that holds the Region */ + + NextOp = Op->Common.Value.Arg; + + /* NextOp points to the op that holds the Bank Register */ + + NextOp = NextOp->Common.Next; + + /* NextOp points to the op that holds the Bank Value */ + + NextOp = NextOp->Common.Next; + + /* + * Set proper index into operand stack for AcpiDsObjStackPush + * invoked inside AcpiDsCreateOperand. + * + * We use WalkState->Operands[0] to store the evaluated BankValue + */ + WalkState->OperandIndex = 0; + + Status = AcpiDsCreateOperand (WalkState, NextOp, 0); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + Status = AcpiExResolveToValue (&WalkState->Operands[0], WalkState); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, + AcpiPsGetOpcodeName (Op->Common.AmlOpcode), 1); + /* + * Get the BankValue operand and save it + * (at Top of stack) + */ + OperandDesc = WalkState->Operands[0]; + + /* Arg points to the start Bank Field */ + + Arg = AcpiPsGetArg (Op, 4); + while (Arg) + { + /* Ignore OFFSET and ACCESSAS terms here */ + + if (Arg->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP) + { + Node = Arg->Common.Node; + + ObjDesc = AcpiNsGetAttachedObject (Node); + if (!ObjDesc) + { + return_ACPI_STATUS (AE_NOT_EXIST); + } + + ObjDesc->BankField.Value = (UINT32) OperandDesc->Integer.Value; + } + + /* Move to next field in the list */ + + Arg = Arg->Common.Next; + } + + AcpiUtRemoveReference (OperandDesc); + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * * FUNCTION: AcpiDsExecBeginControlOp * * PARAMETERS: WalkList - The list that owns the walk stack @@ -1053,10 +1281,29 @@ AcpiDsExecBeginControlOp ( switch (Op->Common.AmlOpcode) { - case AML_IF_OP: case AML_WHILE_OP: /* + * If this is an additional iteration of a while loop, continue. + * There is no need to allocate a new control state. + */ + if (WalkState->ControlState) + { + if (WalkState->ControlState->Control.AmlPredicateStart == + (WalkState->ParserState.Aml - 1)) + { + /* Reset the state to start-of-loop */ + + WalkState->ControlState->Common.State = ACPI_CONTROL_CONDITIONAL_EXECUTING; + break; + } + } + + /*lint -fallthrough */ + + case AML_IF_OP: + + /* * IF/WHILE: Create a new control state to manage these * constructs. We need to manage these as a stack, in order * to handle nesting. @@ -1162,21 +1409,41 @@ AcpiDsExecEndControlOp ( ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", Op)); - if (WalkState->ControlState->Common.Value) + ControlState = WalkState->ControlState; + if (ControlState->Common.Value) { - /* Predicate was true, go back and evaluate it again! */ + /* Predicate was true, the body of the loop was just executed */ + /* + * This loop counter mechanism allows the interpreter to escape + * possibly infinite loops. This can occur in poorly written AML + * when the hardware does not respond within a while loop and the + * loop does not implement a timeout. + */ + ControlState->Control.LoopCount++; + if (ControlState->Control.LoopCount > ACPI_MAX_LOOP_ITERATIONS) + { + Status = AE_AML_INFINITE_LOOP; + break; + } + + /* + * Go back and evaluate the predicate and maybe execute the loop + * another time + */ Status = AE_CTRL_PENDING; + WalkState->AmlLastWhile = ControlState->Control.AmlPredicateStart; + break; } + /* Predicate was false, terminate this while loop */ + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[WHILE_OP] termination! Op=%p\n",Op)); /* Pop this control state and free it */ ControlState = AcpiUtPopGenericState (&WalkState->ControlState); - - WalkState->AmlLastWhile = ControlState->Control.AmlPredicateStart; AcpiUtDeleteGenericState (ControlState); break; @@ -1239,8 +1506,8 @@ AcpiDsExecEndControlOp ( * Allow references created by the Index operator to return unchanged. */ if ((ACPI_GET_DESCRIPTOR_TYPE (WalkState->Results->Results.ObjDesc[0]) == ACPI_DESC_TYPE_OPERAND) && - (ACPI_GET_OBJECT_TYPE (WalkState->Results->Results.ObjDesc [0]) == ACPI_TYPE_LOCAL_REFERENCE) && - ((WalkState->Results->Results.ObjDesc [0])->Reference.Opcode != AML_INDEX_OP)) + ((WalkState->Results->Results.ObjDesc [0])->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) && + ((WalkState->Results->Results.ObjDesc [0])->Reference.Class != ACPI_REFCLASS_INDEX)) { Status = AcpiExResolveToValue (&WalkState->Results->Results.ObjDesc [0], WalkState); if (ACPI_FAILURE (Status)) @@ -1284,12 +1551,20 @@ AcpiDsExecEndControlOp ( case AML_BREAK_POINT_OP: - /* Call up to the OS service layer to handle this */ - - Status = AcpiOsSignal (ACPI_SIGNAL_BREAKPOINT, "Executed AML Breakpoint opcode"); + /* + * Set the single-step flag. This will cause the debugger (if present) + * to break to the console within the AML debugger at the start of the + * next AML instruction. + */ + ACPI_DEBUGGER_EXEC ( + AcpiGbl_CmSingleStep = TRUE); + ACPI_DEBUGGER_EXEC ( + AcpiOsPrintf ("**break** Executed AML BreakPoint opcode\n")); - /* If and when it returns, all done. */ + /* Call to the OSL in case OS wants a piece of the action */ + Status = AcpiOsSignal (ACPI_SIGNAL_BREAKPOINT, + "Executed AML Breakpoint opcode"); break; diff --git a/sys/contrib/dev/acpica/dsutils.c b/sys/contrib/dev/acpica/dispatcher/dsutils.c index eb75947b1485..6c211ace8c60 100644 --- a/sys/contrib/dev/acpica/dsutils.c +++ b/sys/contrib/dev/acpica/dispatcher/dsutils.c @@ -1,7 +1,6 @@ /******************************************************************************* * * Module Name: dsutils - Dispatcher utilities - * $Revision: 1.124 $ * ******************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,13 +115,14 @@ #define __DSUTILS_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acparser.h> -#include <contrib/dev/acpica/amlcode.h> -#include <contrib/dev/acpica/acdispat.h> -#include <contrib/dev/acpica/acinterp.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/acdebug.h> +#include "acpi.h" +#include "accommon.h" +#include "acparser.h" +#include "amlcode.h" +#include "acdispat.h" +#include "acinterp.h" +#include "acnamesp.h" +#include "acdebug.h" #define _COMPONENT ACPI_DISPATCHER ACPI_MODULE_NAME ("dsutils") @@ -374,7 +374,8 @@ AcpiDsIsResultUsed ( (Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) || (Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP) || (Op->Common.Parent->Common.AmlOpcode == AML_BUFFER_OP) || - (Op->Common.Parent->Common.AmlOpcode == AML_INT_EVAL_SUBTREE_OP)) + (Op->Common.Parent->Common.AmlOpcode == AML_INT_EVAL_SUBTREE_OP) || + (Op->Common.Parent->Common.AmlOpcode == AML_BANK_FIELD_OP)) { /* * These opcodes allow TermArg(s) as operands and therefore @@ -826,10 +827,9 @@ AcpiDsCreateOperands ( ACPI_STATUS Status = AE_OK; ACPI_PARSE_OBJECT *Arg; ACPI_PARSE_OBJECT *Arguments[ACPI_OBJ_NUM_OPERANDS]; - UINT8 ArgCount = 0; - UINT8 Count = 0; - UINT8 Index = WalkState->NumOperands; - UINT8 i; + UINT32 ArgCount = 0; + UINT32 Index = WalkState->NumOperands; + UINT32 i; ACPI_FUNCTION_TRACE_PTR (DsCreateOperands, FirstArg); @@ -865,7 +865,7 @@ AcpiDsCreateOperands ( /* Force the filling of the operand stack in inverse order */ - WalkState->OperandIndex = Index; + WalkState->OperandIndex = (UINT8) Index; Status = AcpiDsCreateOperand (WalkState, Arg, Index); if (ACPI_FAILURE (Status)) @@ -873,7 +873,6 @@ AcpiDsCreateOperands ( goto Cleanup; } - Count++; Index--; ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Arg #%d (%p) done, Arg1=%p\n", @@ -954,7 +953,7 @@ AcpiDsEvaluateNamePath ( goto PushResult; } - Type = ACPI_GET_OBJECT_TYPE (*Operand); + Type = (*Operand)->Common.Type; Status = AcpiExResolveToValue (Operand, WalkState); if (ACPI_FAILURE (Status)) diff --git a/sys/contrib/dev/acpica/dswexec.c b/sys/contrib/dev/acpica/dispatcher/dswexec.c index 0eef999e1b6f..9485c62bb1c0 100644 --- a/sys/contrib/dev/acpica/dswexec.c +++ b/sys/contrib/dev/acpica/dispatcher/dswexec.c @@ -2,7 +2,6 @@ * * Module Name: dswexec - Dispatcher method execution callbacks; * dispatch to interpreter. - * $Revision: 1.134 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,13 +116,14 @@ #define __DSWEXEC_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acparser.h> -#include <contrib/dev/acpica/amlcode.h> -#include <contrib/dev/acpica/acdispat.h> -#include <contrib/dev/acpica/acinterp.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/acdebug.h> +#include "acpi.h" +#include "accommon.h" +#include "acparser.h" +#include "amlcode.h" +#include "acdispat.h" +#include "acinterp.h" +#include "acnamesp.h" +#include "acdebug.h" #define _COMPONENT ACPI_DISPATCHER @@ -224,11 +224,11 @@ AcpiDsGetPredicateValue ( goto Cleanup; } - if (ACPI_GET_OBJECT_TYPE (LocalObjDesc) != ACPI_TYPE_INTEGER) + if (LocalObjDesc->Common.Type != ACPI_TYPE_INTEGER) { ACPI_ERROR ((AE_INFO, "Bad predicate (not an integer) ObjDesc=%p State=%p Type=%X", - ObjDesc, WalkState, ACPI_GET_OBJECT_TYPE (ObjDesc))); + ObjDesc, WalkState, ObjDesc->Common.Type)); Status = AE_AML_OPERAND_TYPE; goto Cleanup; @@ -256,6 +256,10 @@ AcpiDsGetPredicateValue ( Status = AE_CTRL_FALSE; } + /* Predicate can be used for an implicit return value */ + + (void) AcpiDsDoImplicitReturn (LocalObjDesc, WalkState, TRUE); + Cleanup: @@ -515,12 +519,6 @@ AcpiDsExecEndOp ( Status = AcpiExResolveOperands (WalkState->Opcode, &(WalkState->Operands [WalkState->NumOperands -1]), WalkState); - if (ACPI_SUCCESS (Status)) - { - ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, - AcpiPsGetOpcodeName (WalkState->Opcode), - WalkState->NumOperands, "after ExResolveOperands"); - } } if (ACPI_SUCCESS (Status)) @@ -542,10 +540,10 @@ AcpiDsExecEndOp ( (WalkState->Opcode == AML_STORE_OP) && (WalkState->Operands[0]->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) && (WalkState->Operands[1]->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) && - (WalkState->Operands[0]->Reference.Opcode == - WalkState->Operands[1]->Reference.Opcode) && - (WalkState->Operands[0]->Reference.Offset == - WalkState->Operands[1]->Reference.Offset)) + (WalkState->Operands[0]->Reference.Class == + WalkState->Operands[1]->Reference.Class) && + (WalkState->Operands[0]->Reference.Value == + WalkState->Operands[1]->Reference.Value)) { Status = AE_OK; } @@ -600,7 +598,7 @@ AcpiDsExecEndOp ( ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Method Reference in a Package, Op=%p\n", Op)); - Op->Common.Node = (ACPI_NAMESPACE_NODE *) Op->Asl.Value.Arg->Asl.Node->Object; + Op->Common.Node = (ACPI_NAMESPACE_NODE *) Op->Asl.Value.Arg->Asl.Node; AcpiUtAddReference (Op->Asl.Value.Arg->Asl.Node->Object); return_ACPI_STATUS (AE_OK); } @@ -742,6 +740,28 @@ AcpiDsExecEndOp ( break; } } + else if (Op->Common.AmlOpcode == AML_DATA_REGION_OP) + { + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "Executing DataTableRegion Strings Op=%p\n", Op)); + + Status = AcpiDsEvalTableRegionOperands (WalkState, Op); + if (ACPI_FAILURE (Status)) + { + break; + } + } + else if (Op->Common.AmlOpcode == AML_BANK_FIELD_OP) + { + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "Executing BankField Op=%p\n", Op)); + + Status = AcpiDsEvalBankFieldOperands (WalkState, Op); + if (ACPI_FAILURE (Status)) + { + break; + } + } break; diff --git a/sys/contrib/dev/acpica/dswload.c b/sys/contrib/dev/acpica/dispatcher/dswload.c index 7a65942ea2e4..d5a642ce707b 100644 --- a/sys/contrib/dev/acpica/dswload.c +++ b/sys/contrib/dev/acpica/dispatcher/dswload.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: dswload - Dispatcher namespace load callbacks - * $Revision: 1.117 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,16 +115,17 @@ #define __DSWLOAD_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acparser.h> -#include <contrib/dev/acpica/amlcode.h> -#include <contrib/dev/acpica/acdispat.h> -#include <contrib/dev/acpica/acinterp.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/acevents.h> +#include "acpi.h" +#include "accommon.h" +#include "acparser.h" +#include "amlcode.h" +#include "acdispat.h" +#include "acinterp.h" +#include "acnamesp.h" +#include "acevents.h" #ifdef ACPI_ASL_COMPILER -#include <contrib/dev/acpica/acdisasm.h> +#include "acdisasm.h" #endif #define _COMPONENT ACPI_DISPATCHER @@ -534,6 +534,15 @@ AcpiDsLoad1EndOp ( return_ACPI_STATUS (Status); } } + else if (Op->Common.AmlOpcode == AML_DATA_REGION_OP) + { + Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length, + REGION_DATA_TABLE, WalkState); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + } } #endif @@ -860,6 +869,13 @@ AcpiDsLoad2BeginOp ( Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType, ACPI_IMODE_LOAD_PASS2, Flags, WalkState, &Node); + + if (ACPI_SUCCESS (Status) && (Flags & ACPI_NS_TEMPORARY)) + { + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, + "***New Node [%4.4s] %p is temporary\n", + AcpiUtGetNodeName (Node), Node)); + } break; } @@ -922,6 +938,7 @@ AcpiDsLoad2EndOp ( ACPI_NAMESPACE_NODE *NewNode; #ifndef ACPI_NO_METHOD_EXECUTION UINT32 i; + UINT8 RegionSpace; #endif @@ -1105,10 +1122,6 @@ AcpiDsLoad2EndOp ( Status = AcpiExCreateEvent (WalkState); break; - case AML_DATA_REGION_OP: - - Status = AcpiExCreateTableRegion (WalkState); - break; case AML_ALIAS_OP: @@ -1139,6 +1152,17 @@ AcpiDsLoad2EndOp ( { #ifndef ACPI_NO_METHOD_EXECUTION case AML_REGION_OP: + case AML_DATA_REGION_OP: + + if (Op->Common.AmlOpcode == AML_REGION_OP) + { + RegionSpace = (ACPI_ADR_SPACE_TYPE) + ((Op->Common.Value.Arg)->Common.Value.Integer); + } + else + { + RegionSpace = REGION_DATA_TABLE; + } /* * If we are executing a method, initialize the region @@ -1146,9 +1170,7 @@ AcpiDsLoad2EndOp ( if (WalkState->MethodNode) { Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length, - (ACPI_ADR_SPACE_TYPE) - ((Op->Common.Value.Arg)->Common.Value.Integer), - WalkState); + RegionSpace, WalkState); if (ACPI_FAILURE (Status)) { return (Status); diff --git a/sys/contrib/dev/acpica/dswscope.c b/sys/contrib/dev/acpica/dispatcher/dswscope.c index fc55f131eba2..023f9ef6662e 100644 --- a/sys/contrib/dev/acpica/dswscope.c +++ b/sys/contrib/dev/acpica/dispatcher/dswscope.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: dswscope - Scope stack manipulation - * $Revision: 1.69 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,8 +115,9 @@ #define __DSWSCOPE_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acdispat.h> +#include "acpi.h" +#include "accommon.h" +#include "acdispat.h" #define _COMPONENT ACPI_DISPATCHER diff --git a/sys/contrib/dev/acpica/dswstate.c b/sys/contrib/dev/acpica/dispatcher/dswstate.c index f6f7bd2bdd6e..f0962bf53f1f 100644 --- a/sys/contrib/dev/acpica/dswstate.c +++ b/sys/contrib/dev/acpica/dispatcher/dswstate.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: dswstate - Dispatcher parse tree walk management routines - * $Revision: 1.101 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,10 +116,11 @@ #define __DSWSTATE_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acparser.h> -#include <contrib/dev/acpica/acdispat.h> -#include <contrib/dev/acpica/acnamesp.h> +#include "acpi.h" +#include "accommon.h" +#include "acparser.h" +#include "acdispat.h" +#include "acnamesp.h" #define _COMPONENT ACPI_DISPATCHER ACPI_MODULE_NAME ("dswstate") @@ -154,7 +154,7 @@ AcpiDsResultPop ( ACPI_OPERAND_OBJECT **Object, ACPI_WALK_STATE *WalkState) { - ACPI_NATIVE_UINT Index; + UINT32 Index; ACPI_GENERIC_STATE *State; ACPI_STATUS Status; @@ -189,7 +189,7 @@ AcpiDsResultPop ( /* Return object of the top element and clean that top element result stack */ WalkState->ResultCount--; - Index = WalkState->ResultCount % ACPI_RESULTS_FRAME_OBJ_NUM; + Index = (UINT32) WalkState->ResultCount % ACPI_RESULTS_FRAME_OBJ_NUM; *Object = State->Results.ObjDesc [Index]; if (!*Object) @@ -212,7 +212,7 @@ AcpiDsResultPop ( ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] Index=%X State=%p Num=%X\n", *Object, AcpiUtGetObjectTypeName (*Object), - (UINT32) Index, WalkState, WalkState->ResultCount)); + Index, WalkState, WalkState->ResultCount)); return (AE_OK); } @@ -238,7 +238,7 @@ AcpiDsResultPush ( { ACPI_GENERIC_STATE *State; ACPI_STATUS Status; - ACPI_NATIVE_UINT Index; + UINT32 Index; ACPI_FUNCTION_NAME (DsResultPush); @@ -284,7 +284,7 @@ AcpiDsResultPush ( /* Assign the address of object to the top free element of result stack */ - Index = WalkState->ResultCount % ACPI_RESULTS_FRAME_OBJ_NUM; + Index = (UINT32) WalkState->ResultCount % ACPI_RESULTS_FRAME_OBJ_NUM; State->Results.ObjDesc [Index] = Object; WalkState->ResultCount++; @@ -320,7 +320,7 @@ AcpiDsResultStackPush ( /* Check for stack overflow */ - if ((WalkState->ResultSize + ACPI_RESULTS_FRAME_OBJ_NUM) > + if (((UINT32) WalkState->ResultSize + ACPI_RESULTS_FRAME_OBJ_NUM) > ACPI_RESULTS_OBJ_NUM_MAX) { ACPI_ERROR ((AE_INFO, "Result stack overflow: State=%p Num=%X", @@ -517,7 +517,7 @@ AcpiDsObjStackPopAndDelete ( UINT32 PopCount, ACPI_WALK_STATE *WalkState) { - UINT32 i; + INT32 i; ACPI_OPERAND_OBJECT *ObjDesc; @@ -529,7 +529,7 @@ AcpiDsObjStackPopAndDelete ( return; } - for (i = (PopCount - 1); i >= 0; i--) + for (i = (INT32) PopCount - 1; i >= 0; i--) { if (WalkState->NumOperands == 0) { @@ -763,16 +763,8 @@ AcpiDsInitAmlWalk ( if (Info) { - if (Info->ParameterType == ACPI_PARAM_GPE) - { - WalkState->GpeEventInfo = - ACPI_CAST_PTR (ACPI_GPE_EVENT_INFO, Info->Parameters); - } - else - { - WalkState->Params = Info->Parameters; - WalkState->CallerReturnDesc = &Info->ReturnObject; - } + WalkState->Params = Info->Parameters; + WalkState->CallerReturnDesc = &Info->ReturnObject; } Status = AcpiPsInitScope (&WalkState->ParserState, Op); diff --git a/sys/contrib/dev/acpica/evevent.c b/sys/contrib/dev/acpica/events/evevent.c index 0e15049f33fe..16f40271fcf1 100644 --- a/sys/contrib/dev/acpica/evevent.c +++ b/sys/contrib/dev/acpica/events/evevent.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: evevent - Fixed Event handling and dispatch - * $Revision: 1.125 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -114,8 +113,9 @@ * *****************************************************************************/ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acevents.h> +#include "acpi.h" +#include "accommon.h" +#include "acevents.h" #define _COMPONENT ACPI_EVENTS ACPI_MODULE_NAME ("evevent") @@ -155,8 +155,8 @@ AcpiEvInitializeEvents ( /* * Initialize the Fixed and General Purpose Events. This is done prior to - * enabling SCIs to prevent interrupts from occurring before the handlers are - * installed. + * enabling SCIs to prevent interrupts from occurring before the handlers + * are installed. */ Status = AcpiEvFixedEventInitialize (); if (ACPI_FAILURE (Status)) @@ -281,7 +281,7 @@ AcpiEvInstallXruptHandlers ( * * RETURN: Status * - * DESCRIPTION: Install the fixed event handlers and enable the fixed events. + * DESCRIPTION: Install the fixed event handlers and disable all fixed events. * ******************************************************************************/ @@ -289,25 +289,26 @@ static ACPI_STATUS AcpiEvFixedEventInitialize ( void) { - ACPI_NATIVE_UINT i; + UINT32 i; ACPI_STATUS Status; /* - * Initialize the structure that keeps track of fixed event handlers - * and enable the fixed events. + * Initialize the structure that keeps track of fixed event handlers and + * enable the fixed events. */ for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { AcpiGbl_FixedEventHandlers[i].Handler = NULL; AcpiGbl_FixedEventHandlers[i].Context = NULL; - /* Enable the fixed event */ + /* Disable the fixed event */ if (AcpiGbl_FixedEventInfo[i].EnableRegisterId != 0xFF) { - Status = AcpiSetRegister ( - AcpiGbl_FixedEventInfo[i].EnableRegisterId, 0); + Status = AcpiWriteBitRegister ( + AcpiGbl_FixedEventInfo[i].EnableRegisterId, + ACPI_DISABLE_EVENT); if (ACPI_FAILURE (Status)) { return (Status); @@ -338,7 +339,7 @@ AcpiEvFixedEventDetect ( UINT32 IntStatus = ACPI_INTERRUPT_NOT_HANDLED; UINT32 FixedStatus; UINT32 FixedEnable; - ACPI_NATIVE_UINT i; + UINT32 i; ACPI_FUNCTION_NAME (EvFixedEventDetect); @@ -346,12 +347,10 @@ AcpiEvFixedEventDetect ( /* * Read the fixed feature status and enable registers, as all the cases - * depend on their values. Ignore errors here. + * depend on their values. Ignore errors here. */ - (void) AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS, - &FixedStatus); - (void) AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_ENABLE, - &FixedEnable); + (void) AcpiHwRegisterRead (ACPI_REGISTER_PM1_STATUS, &FixedStatus); + (void) AcpiHwRegisterRead (ACPI_REGISTER_PM1_ENABLE, &FixedEnable); ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS, "Fixed Event Block: Enable %08X Status %08X\n", @@ -369,7 +368,8 @@ AcpiEvFixedEventDetect ( { /* Found an active (signalled) event */ - IntStatus |= AcpiEvFixedEventDispatch ((UINT32) i); + AcpiFixedEventCount[i]++; + IntStatus |= AcpiEvFixedEventDispatch (i); } } @@ -395,21 +395,24 @@ AcpiEvFixedEventDispatch ( UINT32 Event) { - ACPI_FUNCTION_ENTRY (); /* Clear the status bit */ - (void) AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].StatusRegisterId, 1); + (void) AcpiWriteBitRegister ( + AcpiGbl_FixedEventInfo[Event].StatusRegisterId, + ACPI_CLEAR_STATUS); /* - * Make sure we've got a handler. If not, report an error. - * The event is disabled to prevent further interrupts. + * Make sure we've got a handler. If not, report an error. The event is + * disabled to prevent further interrupts. */ if (NULL == AcpiGbl_FixedEventHandlers[Event].Handler) { - (void) AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId, 0); + (void) AcpiWriteBitRegister ( + AcpiGbl_FixedEventInfo[Event].EnableRegisterId, + ACPI_DISABLE_EVENT); ACPI_ERROR ((AE_INFO, "No installed handler for fixed event [%08X]", @@ -421,7 +424,7 @@ AcpiEvFixedEventDispatch ( /* Invoke the Fixed Event handler */ return ((AcpiGbl_FixedEventHandlers[Event].Handler)( - AcpiGbl_FixedEventHandlers[Event].Context)); + AcpiGbl_FixedEventHandlers[Event].Context)); } diff --git a/sys/contrib/dev/acpica/evgpe.c b/sys/contrib/dev/acpica/events/evgpe.c index d18a1d7dd96b..95cb9fa7ea8c 100644 --- a/sys/contrib/dev/acpica/evgpe.c +++ b/sys/contrib/dev/acpica/events/evgpe.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: evgpe - General Purpose Event handling and dispatch - * $Revision: 1.68 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -114,21 +113,22 @@ * *****************************************************************************/ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acevents.h> -#include <contrib/dev/acpica/acnamesp.h> +#include "acpi.h" +#include "accommon.h" +#include "acevents.h" +#include "acnamesp.h" #define _COMPONENT ACPI_EVENTS ACPI_MODULE_NAME ("evgpe") /* Local prototypes */ -static void -AcpiEvAsynchEnableGpe ( +static void ACPI_SYSTEM_XFACE +AcpiEvAsynchExecuteGpeMethod ( void *Context); static void ACPI_SYSTEM_XFACE -AcpiEvAsynchExecuteGpeMethod ( +AcpiEvAsynchEnableGpe ( void *Context); @@ -173,10 +173,10 @@ AcpiEvSetGpeType ( Status = AcpiEvDisableGpe (GpeEventInfo); - /* Type was validated above */ + /* Clear the type bits and insert the new Type */ - GpeEventInfo->Flags &= ~ACPI_GPE_TYPE_MASK; /* Clear type bits */ - GpeEventInfo->Flags |= Type; /* Insert type */ + GpeEventInfo->Flags &= ~ACPI_GPE_TYPE_MASK; + GpeEventInfo->Flags |= Type; return_ACPI_STATUS (Status); } @@ -212,10 +212,11 @@ AcpiEvUpdateGpeEnableMasks ( { return_ACPI_STATUS (AE_NOT_EXIST); } + RegisterBit = (UINT8) (1 << (GpeEventInfo->GpeNumber - GpeRegisterInfo->BaseGpeNumber)); - /* 1) Disable case. Simply clear all enable bits */ + /* 1) Disable case. Simply clear all enable bits */ if (Type == ACPI_GPE_DISABLE) { @@ -224,7 +225,7 @@ AcpiEvUpdateGpeEnableMasks ( return_ACPI_STATUS (AE_OK); } - /* 2) Enable case. Set/Clear the appropriate enable bits */ + /* 2) Enable case. Set/Clear the appropriate enable bits */ switch (GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK) { @@ -349,10 +350,11 @@ AcpiEvDisableGpe ( ACPI_FUNCTION_TRACE (EvDisableGpe); - if (!(GpeEventInfo->Flags & ACPI_GPE_ENABLE_MASK)) - { - return_ACPI_STATUS (AE_OK); - } + /* + * Note: Always disable the GPE, even if we think that that it is already + * disabled. It is possible that the AML or some other code has enabled + * the GPE behind our back. + */ /* Make sure HW enable masks are updated */ @@ -362,15 +364,17 @@ AcpiEvDisableGpe ( return_ACPI_STATUS (Status); } - /* Mark wake-disabled or HW disable, or both */ + /* Clear the appropriate enabled flags for this GPE */ switch (GpeEventInfo->Flags & ACPI_GPE_TYPE_MASK) { case ACPI_GPE_TYPE_WAKE: + ACPI_CLEAR_BIT (GpeEventInfo->Flags, ACPI_GPE_WAKE_ENABLED); break; case ACPI_GPE_TYPE_WAKE_RUN: + ACPI_CLEAR_BIT (GpeEventInfo->Flags, ACPI_GPE_WAKE_ENABLED); /*lint -fallthrough */ @@ -380,14 +384,22 @@ AcpiEvDisableGpe ( /* Disable the requested runtime GPE */ ACPI_CLEAR_BIT (GpeEventInfo->Flags, ACPI_GPE_RUN_ENABLED); - Status = AcpiHwWriteGpeEnableReg (GpeEventInfo); break; default: - return_ACPI_STATUS (AE_BAD_PARAMETER); + break; } - return_ACPI_STATUS (AE_OK); + /* + * Always H/W disable this GPE, even if we don't know the GPE type. + * Simply clear the enable bit for this particular GPE, but do not + * write out the current GPE enable mask since this may inadvertently + * enable GPEs too early. An example is a rogue GPE that has arrived + * during ACPICA initialization - possibly because AML or other code + * has enabled the GPE. + */ + Status = AcpiHwLowDisableGpe (GpeEventInfo); + return_ACPI_STATUS (Status); } @@ -395,10 +407,10 @@ AcpiEvDisableGpe ( * * FUNCTION: AcpiEvGetGpeEventInfo * - * PARAMETERS: GpeDevice - Device node. NULL for GPE0/GPE1 + * PARAMETERS: GpeDevice - Device node. NULL for GPE0/GPE1 * GpeNumber - Raw GPE number * - * RETURN: A GPE EventInfo struct. NULL if not a valid GPE + * RETURN: A GPE EventInfo struct. NULL if not a valid GPE * * DESCRIPTION: Returns the EventInfo struct associated with this GPE. * Validates the GpeBlock and the GpeNumber @@ -415,7 +427,7 @@ AcpiEvGetGpeEventInfo ( { ACPI_OPERAND_OBJECT *ObjDesc; ACPI_GPE_BLOCK_INFO *GpeBlock; - ACPI_NATIVE_UINT i; + UINT32 i; ACPI_FUNCTION_ENTRY (); @@ -477,7 +489,7 @@ AcpiEvGetGpeEventInfo ( * * RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED * - * DESCRIPTION: Detect if any GP events have occurred. This function is + * DESCRIPTION: Detect if any GP events have occurred. This function is * executed at interrupt level. * ******************************************************************************/ @@ -494,8 +506,8 @@ AcpiEvGpeDetect ( UINT32 StatusReg; UINT32 EnableReg; ACPI_CPU_FLAGS Flags; - ACPI_NATIVE_UINT i; - ACPI_NATIVE_UINT j; + UINT32 i; + UINT32 j; ACPI_FUNCTION_NAME (EvGpeDetect); @@ -509,8 +521,8 @@ AcpiEvGpeDetect ( /* * We need to obtain the GPE lock for both the data structs and registers - * Note: Not necessary to obtain the hardware lock, since the GPE registers - * are owned by the GpeLock. + * Note: Not necessary to obtain the hardware lock, since the GPE + * registers are owned by the GpeLock. */ Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); @@ -520,9 +532,8 @@ AcpiEvGpeDetect ( while (GpeBlock) { /* - * Read all of the 8-bit GPE status and enable registers - * in this GPE block, saving all of them. - * Find all currently active GP events. + * Read all of the 8-bit GPE status and enable registers in this GPE + * block, saving all of them. Find all currently active GP events. */ for (i = 0; i < GpeBlock->RegisterCount; i++) { @@ -532,8 +543,7 @@ AcpiEvGpeDetect ( /* Read the Status Register */ - Status = AcpiHwLowLevelRead (ACPI_GPE_REGISTER_WIDTH, &StatusReg, - &GpeRegisterInfo->StatusAddress); + Status = AcpiRead (&StatusReg, &GpeRegisterInfo->StatusAddress); if (ACPI_FAILURE (Status)) { goto UnlockAndExit; @@ -541,8 +551,7 @@ AcpiEvGpeDetect ( /* Read the Enable Register */ - Status = AcpiHwLowLevelRead (ACPI_GPE_REGISTER_WIDTH, &EnableReg, - &GpeRegisterInfo->EnableAddress); + Status = AcpiRead (&EnableReg, &GpeRegisterInfo->EnableAddress); if (ACPI_FAILURE (Status)) { goto UnlockAndExit; @@ -575,8 +584,9 @@ AcpiEvGpeDetect ( * or method. */ IntStatus |= AcpiEvGpeDispatch ( - &GpeBlock->EventInfo[(i * ACPI_GPE_REGISTER_WIDTH) + j], - (UINT32) j + GpeRegisterInfo->BaseGpeNumber); + &GpeBlock->EventInfo[((ACPI_SIZE) i * + ACPI_GPE_REGISTER_WIDTH) + j], + j + GpeRegisterInfo->BaseGpeNumber); } } } @@ -611,15 +621,25 @@ static void ACPI_SYSTEM_XFACE AcpiEvAsynchExecuteGpeMethod ( void *Context) { - ACPI_GPE_EVENT_INFO *GpeEventInfo = (void *) Context; + ACPI_GPE_EVENT_INFO *GpeEventInfo = Context; ACPI_STATUS Status; - ACPI_GPE_EVENT_INFO LocalGpeEventInfo; + ACPI_GPE_EVENT_INFO *LocalGpeEventInfo; ACPI_EVALUATE_INFO *Info; ACPI_FUNCTION_TRACE (EvAsynchExecuteGpeMethod); + /* Allocate a local GPE block */ + + LocalGpeEventInfo = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_GPE_EVENT_INFO)); + if (!LocalGpeEventInfo) + { + ACPI_EXCEPTION ((AE_INFO, AE_NO_MEMORY, + "while handling a GPE")); + return_VOID; + } + Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); if (ACPI_FAILURE (Status)) { @@ -639,10 +659,10 @@ AcpiEvAsynchExecuteGpeMethod ( (void) AcpiEvEnableGpe (GpeEventInfo, FALSE); /* - * Take a snapshot of the GPE info for this level - we copy the - * info to prevent a race condition with RemoveHandler/RemoveBlock. + * Take a snapshot of the GPE info for this level - we copy the info to + * prevent a race condition with RemoveHandler/RemoveBlock. */ - ACPI_MEMCPY (&LocalGpeEventInfo, GpeEventInfo, + ACPI_MEMCPY (LocalGpeEventInfo, GpeEventInfo, sizeof (ACPI_GPE_EVENT_INFO)); Status = AcpiUtReleaseMutex (ACPI_MTX_EVENTS); @@ -652,10 +672,10 @@ AcpiEvAsynchExecuteGpeMethod ( } /* - * Must check for control method type dispatch one more - * time to avoid race with EvGpeInstallHandler + * Must check for control method type dispatch one more time to avoid a + * race with EvGpeInstallHandler */ - if ((LocalGpeEventInfo.Flags & ACPI_GPE_DISPATCH_MASK) == + if ((LocalGpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_METHOD) { /* Allocate the evaluation information block */ @@ -671,9 +691,7 @@ AcpiEvAsynchExecuteGpeMethod ( * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the _Lxx/_Exx * control method that corresponds to this GPE */ - Info->PrefixNode = LocalGpeEventInfo.Dispatch.MethodNode; - Info->Parameters = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT *, GpeEventInfo); - Info->ParameterType = ACPI_PARAM_GPE; + Info->PrefixNode = LocalGpeEventInfo->Dispatch.MethodNode; Info->Flags = ACPI_IGNORE_RETURN_VALUE; Status = AcpiNsEvaluate (Info); @@ -684,40 +702,64 @@ AcpiEvAsynchExecuteGpeMethod ( { ACPI_EXCEPTION ((AE_INFO, Status, "while evaluating GPE method [%4.4s]", - AcpiUtGetNodeName (LocalGpeEventInfo.Dispatch.MethodNode))); + AcpiUtGetNodeName (LocalGpeEventInfo->Dispatch.MethodNode))); } } /* Defer enabling of GPE until all notify handlers are done */ - AcpiOsExecute(OSL_NOTIFY_HANDLER, AcpiEvAsynchEnableGpe, GpeEventInfo); + + Status = AcpiOsExecute (OSL_NOTIFY_HANDLER, + AcpiEvAsynchEnableGpe, LocalGpeEventInfo); + if (ACPI_FAILURE (Status)) + { + ACPI_FREE (LocalGpeEventInfo); + } return_VOID; } -static void + +/******************************************************************************* + * + * FUNCTION: AcpiEvAsynchEnableGpe + * + * PARAMETERS: Context (GpeEventInfo) - Info for this GPE + * + * RETURN: None + * + * DESCRIPTION: Asynchronous clear/enable for GPE. This allows the GPE to + * complete (i.e., finish execution of Notify) + * + ******************************************************************************/ + +static void ACPI_SYSTEM_XFACE AcpiEvAsynchEnableGpe ( void *Context) { - ACPI_GPE_EVENT_INFO *GpeEventInfo = (void *) Context; + ACPI_GPE_EVENT_INFO *GpeEventInfo = Context; ACPI_STATUS Status; + if ((GpeEventInfo->Flags & ACPI_GPE_XRUPT_TYPE_MASK) == ACPI_GPE_LEVEL_TRIGGERED) { /* - * GPE is level-triggered, we clear the GPE status bit after - * handling the event. + * GPE is level-triggered, we clear the GPE status bit after handling + * the event. */ Status = AcpiHwClearGpe (GpeEventInfo); if (ACPI_FAILURE (Status)) { - return_VOID; + goto Exit; } } /* Enable this GPE */ (void) AcpiHwWriteGpeEnableReg (GpeEventInfo); - return_VOID; + +Exit: + ACPI_FREE (GpeEventInfo); + return; } @@ -751,7 +793,7 @@ AcpiEvGpeDispatch ( AcpiGpeCount++; /* - * If edge-triggered, clear the GPE status bit now. Note that + * If edge-triggered, clear the GPE status bit now. Note that * level-triggered events are cleared after the GPE is serviced. */ if ((GpeEventInfo->Flags & ACPI_GPE_XRUPT_TYPE_MASK) == @@ -766,18 +808,6 @@ AcpiEvGpeDispatch ( } } - if (!AcpiGbl_SystemAwakeAndRunning) - { - /* - * We just woke up because of a wake GPE. Disable any further GPEs - * until we are fully up and running (Only wake GPEs should be enabled - * at this time, but we just brute-force disable them all.) - * 1) We must disable this particular wake GPE so it won't fire again - * 2) We want to disable all wake GPEs, since we are now awake - */ - (void) AcpiHwDisableAllGpes (); - } - /* * Dispatch the GPE to either an installed handler, or the control method * associated with this GPE (_Lxx or _Exx). If a handler exists, we invoke @@ -791,7 +821,8 @@ AcpiEvGpeDispatch ( /* * Invoke the installed handler (at interrupt level) - * Ignore return status for now. TBD: leave GPE disabled on error? + * Ignore return status for now. + * TBD: leave GPE disabled on error? */ (void) GpeEventInfo->Dispatch.Handler->Address ( GpeEventInfo->Dispatch.Handler->Context); @@ -848,7 +879,7 @@ AcpiEvGpeDispatch ( GpeNumber)); /* - * Disable the GPE. The GPE will remain disabled until the ACPI + * Disable the GPE. The GPE will remain disabled until the ACPICA * Core Subsystem is restarted, or a handler is installed. */ Status = AcpiEvDisableGpe (GpeEventInfo); diff --git a/sys/contrib/dev/acpica/evgpeblk.c b/sys/contrib/dev/acpica/events/evgpeblk.c index 5e1bdb72197a..418d0d50644a 100644 --- a/sys/contrib/dev/acpica/evgpeblk.c +++ b/sys/contrib/dev/acpica/events/evgpeblk.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: evgpeblk - GPE block creation and initialization. - * $Revision: 1.60 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -114,9 +113,10 @@ * *****************************************************************************/ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acevents.h> -#include <contrib/dev/acpica/acnamesp.h> +#include "acpi.h" +#include "accommon.h" +#include "acevents.h" +#include "acnamesp.h" #define _COMPONENT ACPI_EVENTS ACPI_MODULE_NAME ("evgpeblk") @@ -194,7 +194,8 @@ AcpiEvValidGpeEvent ( while (GpeBlock) { if ((&GpeBlock->EventInfo[0] <= GpeEventInfo) && - (&GpeBlock->EventInfo[((ACPI_SIZE) GpeBlock->RegisterCount) * 8] > GpeEventInfo)) + (&GpeBlock->EventInfo[((ACPI_SIZE) + GpeBlock->RegisterCount) * 8] > GpeEventInfo)) { return (TRUE); } @@ -214,6 +215,7 @@ AcpiEvValidGpeEvent ( * FUNCTION: AcpiEvWalkGpeList * * PARAMETERS: GpeWalkCallback - Routine called for each GPE block + * Context - Value passed to callback * * RETURN: Status * @@ -223,7 +225,8 @@ AcpiEvValidGpeEvent ( ACPI_STATUS AcpiEvWalkGpeList ( - ACPI_GPE_CALLBACK GpeWalkCallback) + ACPI_GPE_CALLBACK GpeWalkCallback, + void *Context) { ACPI_GPE_BLOCK_INFO *GpeBlock; ACPI_GPE_XRUPT_INFO *GpeXruptInfo; @@ -248,9 +251,13 @@ AcpiEvWalkGpeList ( { /* One callback per GPE block */ - Status = GpeWalkCallback (GpeXruptInfo, GpeBlock); + Status = GpeWalkCallback (GpeXruptInfo, GpeBlock, Context); if (ACPI_FAILURE (Status)) { + if (Status == AE_CTRL_END) /* Callback abort */ + { + Status = AE_OK; + } goto UnlockAndExit; } @@ -283,11 +290,12 @@ UnlockAndExit: ACPI_STATUS AcpiEvDeleteGpeHandlers ( ACPI_GPE_XRUPT_INFO *GpeXruptInfo, - ACPI_GPE_BLOCK_INFO *GpeBlock) + ACPI_GPE_BLOCK_INFO *GpeBlock, + void *Context) { ACPI_GPE_EVENT_INFO *GpeEventInfo; - ACPI_NATIVE_UINT i; - ACPI_NATIVE_UINT j; + UINT32 i; + UINT32 j; ACPI_FUNCTION_TRACE (EvDeleteGpeHandlers); @@ -301,7 +309,8 @@ AcpiEvDeleteGpeHandlers ( for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { - GpeEventInfo = &GpeBlock->EventInfo[(i * ACPI_GPE_REGISTER_WIDTH) + j]; + GpeEventInfo = &GpeBlock->EventInfo[((ACPI_SIZE) i * + ACPI_GPE_REGISTER_WIDTH) + j]; if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_HANDLER) @@ -387,7 +396,8 @@ AcpiEvSaveMethodInfo ( /* Unknown method type, just ignore it! */ ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, - "Ignoring unknown GPE method type: %s (name not of form _Lxx or _Exx)", + "Ignoring unknown GPE method type: %s " + "(name not of form _Lxx or _Exx)", Name)); return_ACPI_STATUS (AE_OK); } @@ -400,7 +410,8 @@ AcpiEvSaveMethodInfo ( /* Conversion failed; invalid method, just ignore it */ ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, - "Could not extract GPE number from name: %s (name is not of form _Lxx or _Exx)", + "Could not extract GPE number from name: %s " + "(name is not of form _Lxx or _Exx)", Name)); return_ACPI_STATUS (AE_OK); } @@ -408,20 +419,21 @@ AcpiEvSaveMethodInfo ( /* Ensure that we have a valid GPE number for this GPE block */ if ((GpeNumber < GpeBlock->BlockBaseNumber) || - (GpeNumber >= (GpeBlock->BlockBaseNumber + (GpeBlock->RegisterCount * 8)))) + (GpeNumber >= (GpeBlock->BlockBaseNumber + + (GpeBlock->RegisterCount * 8)))) { /* - * Not valid for this GPE block, just ignore it - * However, it may be valid for a different GPE block, since GPE0 and GPE1 - * methods both appear under \_GPE. + * Not valid for this GPE block, just ignore it. However, it may be + * valid for a different GPE block, since GPE0 and GPE1 methods both + * appear under \_GPE. */ return_ACPI_STATUS (AE_OK); } /* - * Now we can add this information to the GpeEventInfo block - * for use during dispatch of this GPE. Default type is RUNTIME, although - * this may change when the _PRW methods are executed later. + * Now we can add this information to the GpeEventInfo block for use + * during dispatch of this GPE. Default type is RUNTIME, although this may + * change when the _PRW methods are executed later. */ GpeEventInfo = &GpeBlock->EventInfo[GpeNumber - GpeBlock->BlockBaseNumber]; @@ -501,12 +513,12 @@ AcpiEvMatchPrwAndGpe ( GpeBlock = GpeInfo->GpeBlock; /* - * The _PRW object must return a package, we are only interested - * in the first element + * The _PRW object must return a package, we are only interested in the + * first element */ ObjDesc = PkgDesc->Package.Elements[0]; - if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER) + if (ObjDesc->Common.Type == ACPI_TYPE_INTEGER) { /* Use FADT-defined GPE device (from definition of _PRW) */ @@ -516,13 +528,15 @@ AcpiEvMatchPrwAndGpe ( GpeNumber = (UINT32) ObjDesc->Integer.Value; } - else if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_PACKAGE) + else if (ObjDesc->Common.Type == ACPI_TYPE_PACKAGE) { /* Package contains a GPE reference and GPE number within a GPE block */ if ((ObjDesc->Package.Count < 2) || - (ACPI_GET_OBJECT_TYPE (ObjDesc->Package.Elements[0]) != ACPI_TYPE_LOCAL_REFERENCE) || - (ACPI_GET_OBJECT_TYPE (ObjDesc->Package.Elements[1]) != ACPI_TYPE_INTEGER)) + ((ObjDesc->Package.Elements[0])->Common.Type != + ACPI_TYPE_LOCAL_REFERENCE) || + ((ObjDesc->Package.Elements[1])->Common.Type != + ACPI_TYPE_INTEGER)) { goto Cleanup; } @@ -542,16 +556,18 @@ AcpiEvMatchPrwAndGpe ( /* * Is this GPE within this block? * - * TRUE iff these conditions are true: + * TRUE if and only if these conditions are true: * 1) The GPE devices match. * 2) The GPE index(number) is within the range of the Gpe Block * associated with the GPE device. */ if ((GpeDevice == TargetGpeDevice) && (GpeNumber >= GpeBlock->BlockBaseNumber) && - (GpeNumber < GpeBlock->BlockBaseNumber + (GpeBlock->RegisterCount * 8))) + (GpeNumber < GpeBlock->BlockBaseNumber + + (GpeBlock->RegisterCount * 8))) { - GpeEventInfo = &GpeBlock->EventInfo[GpeNumber - GpeBlock->BlockBaseNumber]; + GpeEventInfo = &GpeBlock->EventInfo[GpeNumber - + GpeBlock->BlockBaseNumber]; /* Mark GPE for WAKE-ONLY but WAKE_DISABLED */ @@ -562,6 +578,7 @@ AcpiEvMatchPrwAndGpe ( { goto Cleanup; } + Status = AcpiEvUpdateGpeEnableMasks (GpeEventInfo, ACPI_GPE_DISABLE); } @@ -580,9 +597,9 @@ Cleanup: * RETURN: A GPE interrupt block * * DESCRIPTION: Get or Create a GPE interrupt block. There is one interrupt - * block per unique interrupt level used for GPEs. - * Should be called only when the GPE lists are semaphore locked - * and not subject to change. + * block per unique interrupt level used for GPEs. Should be + * called only when the GPE lists are semaphore locked and not + * subject to change. * ******************************************************************************/ @@ -709,6 +726,12 @@ AcpiEvDeleteGpeXrupt ( { GpeXrupt->Previous->Next = GpeXrupt->Next; } + else + { + /* No previous, update list head */ + + AcpiGbl_GpeXruptListHead = GpeXrupt->Next; + } if (GpeXrupt->Next) { @@ -727,8 +750,9 @@ AcpiEvDeleteGpeXrupt ( * * FUNCTION: AcpiEvInstallGpeBlock * - * PARAMETERS: GpeBlock - New GPE block - * InterruptNumber - Xrupt to be associated with this GPE block + * PARAMETERS: GpeBlock - New GPE block + * InterruptNumber - Xrupt to be associated with this + * GPE block * * RETURN: Status * @@ -796,7 +820,7 @@ UnlockAndExit: * * FUNCTION: AcpiEvDeleteGpeBlock * - * PARAMETERS: GpeBlock - Existing GPE block + * PARAMETERS: GpeBlock - Existing GPE block * * RETURN: Status * @@ -823,7 +847,7 @@ AcpiEvDeleteGpeBlock ( /* Disable all GPEs in this block */ - Status = AcpiHwDisableGpeBlock (GpeBlock->XruptBlock, GpeBlock); + Status = AcpiHwDisableGpeBlock (GpeBlock->XruptBlock, GpeBlock, NULL); if (!GpeBlock->Previous && !GpeBlock->Next) { @@ -856,6 +880,8 @@ AcpiEvDeleteGpeBlock ( AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); } + AcpiCurrentGpeCount -= GpeBlock->RegisterCount * ACPI_GPE_REGISTER_WIDTH; + /* Free the GpeBlock */ ACPI_FREE (GpeBlock->RegisterInfo); @@ -888,8 +914,8 @@ AcpiEvCreateGpeInfoBlocks ( ACPI_GPE_EVENT_INFO *GpeEventInfo = NULL; ACPI_GPE_EVENT_INFO *ThisEvent; ACPI_GPE_REGISTER_INFO *ThisRegister; - ACPI_NATIVE_UINT i; - ACPI_NATIVE_UINT j; + UINT32 i; + UINT32 j; ACPI_STATUS Status; @@ -931,9 +957,9 @@ AcpiEvCreateGpeInfoBlocks ( /* * Initialize the GPE Register and Event structures. A goal of these - * tables is to hide the fact that there are two separate GPE register sets - * in a given GPE hardware block, the status registers occupy the first half, - * and the enable registers occupy the second half. + * tables is to hide the fact that there are two separate GPE register + * sets in a given GPE hardware block, the status registers occupy the + * first half, and the enable registers occupy the second half. */ ThisRegister = GpeRegisterInfo; ThisEvent = GpeEventInfo; @@ -955,8 +981,8 @@ AcpiEvCreateGpeInfoBlocks ( ThisRegister->EnableAddress.SpaceId = GpeBlock->BlockAddress.SpaceId; ThisRegister->StatusAddress.BitWidth = ACPI_GPE_REGISTER_WIDTH; ThisRegister->EnableAddress.BitWidth = ACPI_GPE_REGISTER_WIDTH; - ThisRegister->StatusAddress.BitOffset = ACPI_GPE_REGISTER_WIDTH; - ThisRegister->EnableAddress.BitOffset = ACPI_GPE_REGISTER_WIDTH; + ThisRegister->StatusAddress.BitOffset = 0; + ThisRegister->EnableAddress.BitOffset = 0; /* Init the EventInfo for each GPE within this register */ @@ -969,8 +995,7 @@ AcpiEvCreateGpeInfoBlocks ( /* Disable all GPEs within this register */ - Status = AcpiHwLowLevelWrite (ACPI_GPE_REGISTER_WIDTH, 0x00, - &ThisRegister->EnableAddress); + Status = AcpiWrite (0x00, &ThisRegister->EnableAddress); if (ACPI_FAILURE (Status)) { goto ErrorExit; @@ -978,8 +1003,7 @@ AcpiEvCreateGpeInfoBlocks ( /* Clear any pending GPE events within this register */ - Status = AcpiHwLowLevelWrite (ACPI_GPE_REGISTER_WIDTH, 0xFF, - &ThisRegister->StatusAddress); + Status = AcpiWrite (0xFF, &ThisRegister->StatusAddress); if (ACPI_FAILURE (Status)) { goto ErrorExit; @@ -1104,6 +1128,9 @@ AcpiEvCreateGpeBlock ( GpeBlock->RegisterCount, InterruptNumber)); + /* Update global count of currently available GPEs */ + + AcpiCurrentGpeCount += RegisterCount * ACPI_GPE_REGISTER_WIDTH; return_ACPI_STATUS (AE_OK); } @@ -1134,8 +1161,8 @@ AcpiEvInitializeGpeBlock ( ACPI_GPE_WALK_INFO GpeInfo; UINT32 WakeGpeCount; UINT32 GpeEnabledCount; - ACPI_NATIVE_UINT i; - ACPI_NATIVE_UINT j; + UINT32 i; + UINT32 j; ACPI_FUNCTION_TRACE (EvInitializeGpeBlock); @@ -1173,8 +1200,8 @@ AcpiEvInitializeGpeBlock ( * 1) are "runtime" or "run/wake" GPEs, and * 2) have a corresponding _Lxx or _Exx method * - * Any other GPEs within this block must be enabled via the AcpiEnableGpe() - * external interface. + * Any other GPEs within this block must be enabled via the + * AcpiEnableGpe() external interface. */ WakeGpeCount = 0; GpeEnabledCount = 0; @@ -1185,9 +1212,11 @@ AcpiEvInitializeGpeBlock ( { /* Get the info block for this particular GPE */ - GpeEventInfo = &GpeBlock->EventInfo[(i * ACPI_GPE_REGISTER_WIDTH) + j]; + GpeEventInfo = &GpeBlock->EventInfo[((ACPI_SIZE) i * + ACPI_GPE_REGISTER_WIDTH) + j]; - if (((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_METHOD) && + if (((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == + ACPI_GPE_DISPATCH_METHOD) && (GpeEventInfo->Flags & ACPI_GPE_TYPE_RUNTIME)) { GpeEnabledCount++; @@ -1206,7 +1235,7 @@ AcpiEvInitializeGpeBlock ( /* Enable all valid runtime GPEs found above */ - Status = AcpiHwEnableRuntimeGpeBlock (NULL, GpeBlock); + Status = AcpiHwEnableRuntimeGpeBlock (NULL, GpeBlock, NULL); if (ACPI_FAILURE (Status)) { ACPI_ERROR ((AE_INFO, "Could not enable GPEs in GpeBlock %p", @@ -1251,8 +1280,8 @@ AcpiEvGpeInitialize ( /* * Initialize the GPE Block(s) defined in the FADT * - * Why the GPE register block lengths are divided by 2: From the ACPI Spec, - * section "General-Purpose Event Registers", we have: + * Why the GPE register block lengths are divided by 2: From the ACPI + * Spec, section "General-Purpose Event Registers", we have: * * "Each register block contains two registers of equal length * GPEx_STS and GPEx_EN (where x is 0 or 1). The length of the @@ -1308,7 +1337,8 @@ AcpiEvGpeInitialize ( (GpeNumberMax >= AcpiGbl_FADT.Gpe1Base)) { ACPI_ERROR ((AE_INFO, - "GPE0 block (GPE 0 to %d) overlaps the GPE1 block (GPE %d to %d) - Ignoring GPE1", + "GPE0 block (GPE 0 to %d) overlaps the GPE1 block " + "(GPE %d to %d) - Ignoring GPE1", GpeNumberMax, AcpiGbl_FADT.Gpe1Base, AcpiGbl_FADT.Gpe1Base + ((RegisterCount1 * ACPI_GPE_REGISTER_WIDTH) - 1))); diff --git a/sys/contrib/dev/acpica/evmisc.c b/sys/contrib/dev/acpica/events/evmisc.c index 7000543f114b..1e7f9e1cb56d 100644 --- a/sys/contrib/dev/acpica/evmisc.c +++ b/sys/contrib/dev/acpica/events/evmisc.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: evmisc - Miscellaneous event manager support functions - * $Revision: 1.103 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -114,35 +113,16 @@ * *****************************************************************************/ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acevents.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/acinterp.h> +#include "acpi.h" +#include "accommon.h" +#include "acevents.h" +#include "acnamesp.h" +#include "acinterp.h" #define _COMPONENT ACPI_EVENTS ACPI_MODULE_NAME ("evmisc") -/* Names for Notify() values, used for debug output */ - -#ifdef ACPI_DEBUG_OUTPUT -static const char *AcpiNotifyValueNames[] = -{ - "Bus Check", - "Device Check", - "Device Wake", - "Eject Request", - "Device Check Light", - "Frequency Mismatch", - "Bus Mode Mismatch", - "Power Fault" -}; -#endif - -/* Pointer to FACS needed for the Global Lock */ - -static ACPI_TABLE_FACS *Facs = NULL; - /* Local prototypes */ static void ACPI_SYSTEM_XFACE @@ -180,7 +160,6 @@ AcpiEvIsNotifyObject ( { case ACPI_TYPE_DEVICE: case ACPI_TYPE_PROCESSOR: - case ACPI_TYPE_POWER: case ACPI_TYPE_THERMAL: /* * These are the ONLY objects that can receive ACPI notifications @@ -229,19 +208,9 @@ AcpiEvQueueNotifyRequest ( * initiate soft-off or sleep operation? */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Dispatching Notify(%X) on node %p\n", NotifyValue, Node)); - - if (NotifyValue <= 7) - { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Notify value: %s\n", - AcpiNotifyValueNames[NotifyValue])); - } - else - { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Notify value: 0x%2.2X **Device Specific**\n", - NotifyValue)); - } + "Dispatching Notify on [%4.4s] Node %p Value 0x%2.2X (%s)\n", + AcpiUtGetNodeName (Node), Node, NotifyValue, + AcpiUtGetNotifyName (NotifyValue))); /* Get the notify object attached to the NS Node */ @@ -252,10 +221,11 @@ AcpiEvQueueNotifyRequest ( switch (Node->Type) { + /* Notify allowed only on these types */ + case ACPI_TYPE_DEVICE: case ACPI_TYPE_THERMAL: case ACPI_TYPE_PROCESSOR: - case ACPI_TYPE_POWER: if (NotifyValue <= ACPI_MAX_SYS_NOTIFY) { @@ -268,15 +238,24 @@ AcpiEvQueueNotifyRequest ( break; default: + /* All other types are not supported */ + return (AE_TYPE); } } - /* If there is any handler to run, schedule the dispatcher */ - - if ((AcpiGbl_SystemNotify.Handler && (NotifyValue <= ACPI_MAX_SYS_NOTIFY)) || - (AcpiGbl_DeviceNotify.Handler && (NotifyValue > ACPI_MAX_SYS_NOTIFY)) || + /* + * If there is any handler to run, schedule the dispatcher. + * Check for: + * 1) Global system notify handler + * 2) Global device notify handler + * 3) Per-device notify handler + */ + if ((AcpiGbl_SystemNotify.Handler && + (NotifyValue <= ACPI_MAX_SYS_NOTIFY)) || + (AcpiGbl_DeviceNotify.Handler && + (NotifyValue > ACPI_MAX_SYS_NOTIFY)) || HandlerObj) { NotifyInfo = AcpiUtCreateGenericState (); @@ -285,6 +264,14 @@ AcpiEvQueueNotifyRequest ( return (AE_NO_MEMORY); } + if (!HandlerObj) + { + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, + "Executing system notify handler for Notify (%4.4s, %X) " + "node %p\n", + AcpiUtGetNodeName (Node), NotifyValue, Node)); + } + NotifyInfo->Common.DescriptorType = ACPI_DESC_TYPE_STATE_NOTIFY; NotifyInfo->Notify.Node = Node; NotifyInfo->Notify.Value = (UINT16) NotifyValue; @@ -297,15 +284,12 @@ AcpiEvQueueNotifyRequest ( AcpiUtDeleteGenericState (NotifyInfo); } } - - if (!HandlerObj) + else { - /* - * There is no per-device notify handler for this device. - * This may or may not be a problem. - */ + /* There is no notify handler (per-device or system) for this device */ + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "No notify handler for Notify(%4.4s, %X) node %p\n", + "No notify handler for Notify (%4.4s, %X) node %p\n", AcpiUtGetNodeName (Node), NotifyValue, Node)); } @@ -340,9 +324,8 @@ AcpiEvNotifyDispatch ( /* - * We will invoke a global notify handler if installed. - * This is done _before_ we invoke the per-device handler attached - * to the device. + * We will invoke a global notify handler if installed. This is done + * _before_ we invoke the per-device handler attached to the device. */ if (NotifyInfo->Notify.Value <= ACPI_MAX_SYS_NOTIFY) { @@ -421,7 +404,7 @@ AcpiEvGlobalLockHandler ( * If we don't get it now, it will be marked pending and we will * take another interrupt when it becomes free. */ - ACPI_ACQUIRE_GLOBAL_LOCK (Facs, Acquired); + ACPI_ACQUIRE_GLOBAL_LOCK (AcpiGbl_FACS, Acquired); if (Acquired) { /* Got the lock, now wake the thread waiting for it */ @@ -463,23 +446,16 @@ AcpiEvInitGlobalLockHandler ( ACPI_FUNCTION_TRACE (EvInitGlobalLockHandler); - Status = AcpiGetTableByIndex (ACPI_TABLE_INDEX_FACS, - ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &Facs)); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } + /* Attempt installation of the global lock handler */ - AcpiGbl_GlobalLockPresent = TRUE; Status = AcpiInstallFixedEventHandler (ACPI_EVENT_GLOBAL, AcpiEvGlobalLockHandler, NULL); /* - * If the global lock does not exist on this platform, the attempt - * to enable GBL_STATUS will fail (the GBL_ENABLE bit will not stick) - * Map to AE_OK, but mark global lock as not present. - * Any attempt to actually use the global lock will be flagged - * with an error. + * If the global lock does not exist on this platform, the attempt to + * enable GBL_STATUS will fail (the GBL_ENABLE bit will not stick). + * Map to AE_OK, but mark global lock as not present. Any attempt to + * actually use the global lock will be flagged with an error. */ if (Status == AE_NO_HARDWARE_RESPONSE) { @@ -487,9 +463,10 @@ AcpiEvInitGlobalLockHandler ( "No response from Global Lock hardware, disabling lock")); AcpiGbl_GlobalLockPresent = FALSE; - Status = AE_OK; + return_ACPI_STATUS (AE_OK); } + AcpiGbl_GlobalLockPresent = TRUE; return_ACPI_STATUS (Status); } @@ -582,8 +559,8 @@ AcpiEvAcquireGlobalLock ( } /* - * Make sure that a global lock actually exists. If not, just treat - * the lock as a standard mutex. + * Make sure that a global lock actually exists. If not, just treat the + * lock as a standard mutex. */ if (!AcpiGbl_GlobalLockPresent) { @@ -593,7 +570,7 @@ AcpiEvAcquireGlobalLock ( /* Attempt to acquire the actual hardware lock */ - ACPI_ACQUIRE_GLOBAL_LOCK (Facs, Acquired); + ACPI_ACQUIRE_GLOBAL_LOCK (AcpiGbl_FACS, Acquired); if (Acquired) { /* We got the lock */ @@ -657,7 +634,7 @@ AcpiEvReleaseGlobalLock ( { /* Allow any thread to release the lock */ - ACPI_RELEASE_GLOBAL_LOCK (Facs, Pending); + ACPI_RELEASE_GLOBAL_LOCK (AcpiGbl_FACS, Pending); /* * If the pending bit was set, we must write GBL_RLS to the control @@ -665,8 +642,8 @@ AcpiEvReleaseGlobalLock ( */ if (Pending) { - Status = AcpiSetRegister ( - ACPI_BITREG_GLOBAL_LOCK_RELEASE, 1); + Status = AcpiWriteBitRegister ( + ACPI_BITREG_GLOBAL_LOCK_RELEASE, ACPI_ENABLE_EVENT); } ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Released hardware Global Lock\n")); @@ -697,7 +674,7 @@ void AcpiEvTerminate ( void) { - ACPI_NATIVE_UINT i; + UINT32 i; ACPI_STATUS Status; @@ -707,15 +684,15 @@ AcpiEvTerminate ( if (AcpiGbl_EventsInitialized) { /* - * Disable all event-related functionality. - * In all cases, on error, print a message but obviously we don't abort. + * Disable all event-related functionality. In all cases, on error, + * print a message but obviously we don't abort. */ /* Disable all fixed events */ for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { - Status = AcpiDisableEvent ((UINT32) i, 0); + Status = AcpiDisableEvent (i, 0); if (ACPI_FAILURE (Status)) { ACPI_ERROR ((AE_INFO, @@ -725,7 +702,7 @@ AcpiEvTerminate ( /* Disable all GPEs in all GPE blocks */ - Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock); + Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock, NULL); /* Remove SCI handler */ @@ -746,7 +723,7 @@ AcpiEvTerminate ( /* Deallocate all handler objects installed within GPE info structs */ - Status = AcpiEvWalkGpeList (AcpiEvDeleteGpeHandlers); + Status = AcpiEvWalkGpeList (AcpiEvDeleteGpeHandlers, NULL); /* Return to original mode if necessary */ diff --git a/sys/contrib/dev/acpica/evregion.c b/sys/contrib/dev/acpica/events/evregion.c index f7071b10c2a2..32d7b642f996 100644 --- a/sys/contrib/dev/acpica/evregion.c +++ b/sys/contrib/dev/acpica/events/evregion.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: evregion - ACPI AddressSpace (OpRegion) handler dispatch - * $Revision: 1.168 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,23 +116,15 @@ #define __EVREGION_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acevents.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/acinterp.h> +#include "acpi.h" +#include "accommon.h" +#include "acevents.h" +#include "acnamesp.h" +#include "acinterp.h" #define _COMPONENT ACPI_EVENTS ACPI_MODULE_NAME ("evregion") -#define ACPI_NUM_DEFAULT_SPACES 4 - -static UINT8 AcpiGbl_DefaultAddressSpaces[ACPI_NUM_DEFAULT_SPACES] = -{ - ACPI_ADR_SPACE_SYSTEM_MEMORY, - ACPI_ADR_SPACE_SYSTEM_IO, - ACPI_ADR_SPACE_PCI_CONFIG, - ACPI_ADR_SPACE_DATA_TABLE -}; /* Local prototypes */ @@ -151,6 +142,18 @@ AcpiEvInstallHandler ( void *Context, void **ReturnValue); +/* These are the address spaces that will get default handlers */ + +#define ACPI_NUM_DEFAULT_SPACES 4 + +static UINT8 AcpiGbl_DefaultAddressSpaces[ACPI_NUM_DEFAULT_SPACES] = +{ + ACPI_ADR_SPACE_SYSTEM_MEMORY, + ACPI_ADR_SPACE_SYSTEM_IO, + ACPI_ADR_SPACE_PCI_CONFIG, + ACPI_ADR_SPACE_DATA_TABLE +}; + /******************************************************************************* * @@ -169,7 +172,7 @@ AcpiEvInstallRegionHandlers ( void) { ACPI_STATUS Status; - ACPI_NATIVE_UINT i; + UINT32 i; ACPI_FUNCTION_TRACE (EvInstallRegionHandlers); @@ -182,18 +185,19 @@ AcpiEvInstallRegionHandlers ( } /* - * All address spaces (PCI Config, EC, SMBus) are scope dependent - * and registration must occur for a specific device. + * All address spaces (PCI Config, EC, SMBus) are scope dependent and + * registration must occur for a specific device. * - * In the case of the system memory and IO address spaces there is currently - * no device associated with the address space. For these we use the root. + * In the case of the system memory and IO address spaces there is + * currently no device associated with the address space. For these we + * use the root. * - * We install the default PCI config space handler at the root so - * that this space is immediately available even though the we have - * not enumerated all the PCI Root Buses yet. This is to conform - * to the ACPI specification which states that the PCI config - * space must be always available -- even though we are nowhere - * near ready to find the PCI root buses at this point. + * We install the default PCI config space handler at the root so that + * this space is immediately available even though the we have not + * enumerated all the PCI Root Buses yet. This is to conform to the ACPI + * specification which states that the PCI config space must be always + * available -- even though we are nowhere near ready to find the PCI root + * buses at this point. * * NOTE: We ignore AE_ALREADY_EXISTS because this means that a handler * has already been installed (via AcpiInstallAddressSpaceHandler). @@ -245,7 +249,7 @@ AcpiEvInitializeOpRegions ( void) { ACPI_STATUS Status; - ACPI_NATIVE_UINT i; + UINT32 i; ACPI_FUNCTION_TRACE (EvInitializeOpRegions); @@ -257,12 +261,12 @@ AcpiEvInitializeOpRegions ( return_ACPI_STATUS (Status); } - /* - * Run the _REG methods for OpRegions in each default address space - */ + /* Run the _REG methods for OpRegions in each default address space */ + for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++) { - /* TBD: Make sure handler is the DEFAULT handler, otherwise + /* + * TBD: Make sure handler is the DEFAULT handler, otherwise * _REG will have already been run. */ Status = AcpiEvExecuteRegMethods (AcpiGbl_RootNode, @@ -323,7 +327,6 @@ AcpiEvExecuteRegMethod ( Info->PrefixNode = RegionObj2->Extra.Method_REG; Info->Pathname = NULL; Info->Parameters = Args; - Info->ParameterType = ACPI_PARAM_ARGS; Info->Flags = ACPI_IGNORE_RETURN_VALUE; /* @@ -379,7 +382,7 @@ Cleanup1: * * PARAMETERS: RegionObj - Internal region object * Function - Read or Write operation - * Address - Where in the space to read or write + * 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 @@ -395,7 +398,7 @@ ACPI_STATUS AcpiEvAddressSpaceDispatch ( ACPI_OPERAND_OBJECT *RegionObj, UINT32 Function, - ACPI_PHYSICAL_ADDRESS Address, + UINT32 RegionOffset, UINT32 BitWidth, ACPI_INTEGER *Value) { @@ -430,14 +433,13 @@ AcpiEvAddressSpaceDispatch ( } /* - * It may be the case that the region has never been initialized + * It may be the case that the region has never been initialized. * Some types of regions require special init code */ if (!(RegionObj->Region.Flags & AOPOBJ_SETUP_COMPLETE)) { - /* - * This region has not been initialized yet, do it - */ + /* This region has not been initialized yet, do it */ + RegionSetup = HandlerDesc->AddressSpace.Setup; if (!RegionSetup) { @@ -450,18 +452,18 @@ AcpiEvAddressSpaceDispatch ( } /* - * We must exit the interpreter because the region - * setup will potentially execute control methods - * (e.g., _REG method for this region) + * We must exit the interpreter because the region setup will + * potentially execute control methods (for example, the _REG method + * for this region) */ - AcpiExRelinquishInterpreter (); + AcpiExExitInterpreter (); Status = RegionSetup (RegionObj, ACPI_REGION_ACTIVATE, HandlerDesc->AddressSpace.Context, &RegionContext); /* Re-enter the interpreter */ - AcpiExReacquireInterpreter (); + AcpiExEnterInterpreter (); /* Check for failure of the Region Setup */ @@ -473,9 +475,8 @@ AcpiEvAddressSpaceDispatch ( return_ACPI_STATUS (Status); } - /* - * Region initialization may have been completed by RegionSetup - */ + /* Region initialization may have been completed by RegionSetup */ + if (!(RegionObj->Region.Flags & AOPOBJ_SETUP_COMPLETE)) { RegionObj->Region.Flags |= AOPOBJ_SETUP_COMPLETE; @@ -504,7 +505,7 @@ AcpiEvAddressSpaceDispatch ( ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, "Handler %p (@%p) Address %8.8X%8.8X [%s]\n", &RegionObj->Region.Handler->AddressSpace, Handler, - ACPI_FORMAT_UINT64 (Address), + ACPI_FORMAT_NATIVE_UINT (RegionObj->Region.Address + RegionOffset), AcpiUtGetRegionName (RegionObj->Region.SpaceId))); if (!(HandlerDesc->AddressSpace.HandlerFlags & @@ -515,12 +516,13 @@ AcpiEvAddressSpaceDispatch ( * exit the interpreter because the handler *might* block -- we don't * know what it will do, so we can't hold the lock on the intepreter. */ - AcpiExRelinquishInterpreter(); + AcpiExExitInterpreter(); } /* Call the handler */ - Status = Handler (Function, Address, BitWidth, Value, + Status = Handler (Function, + (RegionObj->Region.Address + RegionOffset), BitWidth, Value, HandlerDesc->AddressSpace.Context, RegionObj2->Extra.RegionContext); if (ACPI_FAILURE (Status)) @@ -536,7 +538,7 @@ AcpiEvAddressSpaceDispatch ( * We just returned from a non-default handler, we must re-enter the * interpreter */ - AcpiExReacquireInterpreter (); + AcpiExEnterInterpreter (); } return_ACPI_STATUS (Status); @@ -609,7 +611,7 @@ AcpiEvDetachRegion( /* This is it, remove it from the handler's list */ *LastObjPtr = ObjDesc->Region.Next; - ObjDesc->Region.Next = NULL; /* Must clear field */ + ObjDesc->Region.Next = NULL; /* Must clear field */ if (AcpiNsIsLocked) { @@ -639,8 +641,8 @@ AcpiEvDetachRegion( } /* - * If the region has been activated, call the setup handler - * with the deactivate notification + * If the region has been activated, call the setup handler with + * the deactivate notification */ if (RegionObj->Region.Flags & AOPOBJ_SETUP_COMPLETE) { @@ -793,8 +795,8 @@ AcpiEvInstallHandler ( } /* - * We only care about regions.and objects - * that are allowed to have address space handlers + * We only care about regions and objects that are allowed to have + * address space handlers */ if ((Node->Type != ACPI_TYPE_DEVICE) && (Node->Type != ACPI_TYPE_REGION) && @@ -815,7 +817,7 @@ AcpiEvInstallHandler ( /* Devices are handled different than regions */ - if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_DEVICE) + if (ObjDesc->Common.Type == ACPI_TYPE_DEVICE) { /* Check if this Device already has a handler for this address space */ @@ -824,19 +826,21 @@ AcpiEvInstallHandler ( { /* Found a handler, is it for the same address space? */ - if (NextHandlerObj->AddressSpace.SpaceId == HandlerObj->AddressSpace.SpaceId) + if (NextHandlerObj->AddressSpace.SpaceId == + HandlerObj->AddressSpace.SpaceId) { ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, - "Found handler for region [%s] in device %p(%p) handler %p\n", + "Found handler for region [%s] in device %p(%p) " + "handler %p\n", AcpiUtGetRegionName (HandlerObj->AddressSpace.SpaceId), ObjDesc, NextHandlerObj, HandlerObj)); /* * Since the object we found it on was a device, then it * means that someone has already installed a handler for - * the branch of the namespace from this device on. Just + * the branch of the namespace from this device on. Just * bail out telling the walk routine to not traverse this - * branch. This preserves the scoping rule for handlers. + * branch. This preserves the scoping rule for handlers. */ return (AE_CTRL_DEPTH); } @@ -847,9 +851,8 @@ AcpiEvInstallHandler ( } /* - * As long as the device didn't have a handler for this - * space we don't care about it. We just ignore it and - * proceed. + * As long as the device didn't have a handler for this space we + * don't care about it. We just ignore it and proceed. */ return (AE_OK); } @@ -858,16 +861,13 @@ AcpiEvInstallHandler ( if (ObjDesc->Region.SpaceId != HandlerObj->AddressSpace.SpaceId) { - /* - * This region is for a different address space - * -- just ignore it - */ + /* This region is for a different address space, just ignore it */ + return (AE_OK); } /* - * Now we have a region and it is for the handler's address - * space type. + * Now we have a region and it is for the handler's address space type. * * First disconnect region for any previous handler (if any) */ @@ -916,9 +916,8 @@ AcpiEvInstallSpaceHandler ( /* - * This registration is valid for only the types below - * and the root. This is where the default handlers - * get placed. + * This registration is valid for only the types below and the root. This + * is where the default handlers get placed. */ if ((Node->Type != ACPI_TYPE_DEVICE) && (Node->Type != ACPI_TYPE_PROCESSOR) && @@ -984,8 +983,8 @@ AcpiEvInstallSpaceHandler ( if (ObjDesc) { /* - * The attached device object already exists. - * Make sure the handler is not already installed. + * The attached device object already exists. Make sure the handler + * is not already installed. */ HandlerObj = ObjDesc->Device.Handler; @@ -1001,8 +1000,8 @@ AcpiEvInstallSpaceHandler ( { /* * It is (relatively) OK to attempt to install the SAME - * handler twice. This can easily happen - * with PCI_Config space. + * handler twice. This can easily happen with the + * PCI_Config space. */ Status = AE_SAME_HANDLER; goto UnlockAndExit; @@ -1070,9 +1069,8 @@ AcpiEvInstallSpaceHandler ( /* * Install the handler * - * At this point there is no existing handler. - * Just allocate the object for the handler and link it - * into the list. + * At this point there is no existing handler. Just allocate the object + * for the handler and link it into the list. */ HandlerObj = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_ADDRESS_HANDLER); if (!HandlerObj) @@ -1148,11 +1146,10 @@ AcpiEvExecuteRegMethods ( /* - * Run all _REG methods for all Operation Regions for this - * space ID. This is a separate walk in order to handle any - * interdependencies between regions and _REG methods. (i.e. handlers - * must be installed for all regions of this Space ID before we - * can run any _REG methods) + * Run all _REG methods for all Operation Regions for this space ID. This + * is a separate walk in order to handle any interdependencies between + * regions and _REG methods. (i.e. handlers must be installed for all + * 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, @@ -1196,8 +1193,8 @@ AcpiEvRegRun ( } /* - * We only care about regions.and objects - * that are allowed to have address space handlers + * We only care about regions.and objects that are allowed to have address + * space handlers */ if ((Node->Type != ACPI_TYPE_REGION) && (Node != AcpiGbl_RootNode)) @@ -1219,10 +1216,8 @@ AcpiEvRegRun ( if (ObjDesc->Region.SpaceId != SpaceId) { - /* - * This region is for a different address space - * -- just ignore it - */ + /* This region is for a different address space, just ignore it */ + return (AE_OK); } diff --git a/sys/contrib/dev/acpica/evrgnini.c b/sys/contrib/dev/acpica/events/evrgnini.c index 615c3979401c..187aebe58fe3 100644 --- a/sys/contrib/dev/acpica/evrgnini.c +++ b/sys/contrib/dev/acpica/events/evrgnini.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: evrgnini- ACPI AddressSpace (OpRegion) init - * $Revision: 1.88 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,9 +116,10 @@ #define __EVRGNINI_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acevents.h> -#include <contrib/dev/acpica/acnamesp.h> +#include "acpi.h" +#include "accommon.h" +#include "acevents.h" +#include "acnamesp.h" #define _COMPONENT ACPI_EVENTS ACPI_MODULE_NAME ("evrgnini") @@ -335,16 +335,17 @@ AcpiEvPciConfigRegionSetup ( if (Status == AE_SAME_HANDLER) { /* - * It is OK if the handler is already installed on the root - * bridge. Still need to return a context object for the - * new PCI_Config operation region, however. + * It is OK if the handler is already installed on the + * root bridge. Still need to return a context object + * for the new PCI_Config operation region, however. */ Status = AE_OK; } else { ACPI_EXCEPTION ((AE_INFO, Status, - "Could not install PciConfig handler for Root Bridge %4.4s", + "Could not install PciConfig handler " + "for Root Bridge %4.4s", AcpiUtGetNodeName (PciRootNode))); } } @@ -379,8 +380,8 @@ AcpiEvPciConfigRegionSetup ( } /* - * For PCI_Config space access, we need the segment, bus, - * device and function numbers. Acquire them here. + * For PCI_Config space access, we need the segment, bus, device and + * function numbers. Acquire them here. * * Find the parent device object. (This allows the operation region to be * within a subscope under the device, such as a control method.) @@ -393,18 +394,20 @@ AcpiEvPciConfigRegionSetup ( if (!PciDeviceNode) { + ACPI_FREE (PciId); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } /* - * Get the PCI device and function numbers from the _ADR object - * contained in the parent's scope. + * Get the PCI device and function numbers from the _ADR object contained + * in the parent's scope. */ - Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR, PciDeviceNode, &PciValue); + Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR, + PciDeviceNode, &PciValue); /* - * The default is zero, and since the allocation above zeroed - * the data, just do nothing on failure. + * The default is zero, and since the allocation above zeroed the data, + * just do nothing on failure. */ if (ACPI_SUCCESS (Status)) { @@ -414,7 +417,8 @@ AcpiEvPciConfigRegionSetup ( /* The PCI segment number comes from the _SEG method */ - Status = AcpiUtEvaluateNumericObject (METHOD_NAME__SEG, PciRootNode, &PciValue); + Status = AcpiUtEvaluateNumericObject (METHOD_NAME__SEG, + PciRootNode, &PciValue); if (ACPI_SUCCESS (Status)) { PciId->Segment = ACPI_LOWORD (PciValue); @@ -422,7 +426,8 @@ AcpiEvPciConfigRegionSetup ( /* The PCI bus number comes from the _BBN method */ - Status = AcpiUtEvaluateNumericObject (METHOD_NAME__BBN, PciRootNode, &PciValue); + Status = AcpiUtEvaluateNumericObject (METHOD_NAME__BBN, + PciRootNode, &PciValue); if (ACPI_SUCCESS (Status)) { PciId->Bus = ACPI_LOWORD (PciValue); @@ -493,12 +498,11 @@ AcpiEvIsPciRootBridge ( ACPI_STATUS Status; ACPI_DEVICE_ID Hid; ACPI_COMPATIBLE_ID_LIST *Cid; - ACPI_NATIVE_UINT i; + UINT32 i; - /* - * Get the _HID and check for a PCI Root Bridge - */ + /* Get the _HID and check for a PCI Root Bridge */ + Status = AcpiUtExecute_HID (Node, &Hid); if (ACPI_FAILURE (Status)) { @@ -510,10 +514,8 @@ AcpiEvIsPciRootBridge ( return (TRUE); } - /* - * The _HID did not match. - * Get the _CID and check for a PCI Root Bridge - */ + /* The _HID did not match. Get the _CID and check for a PCI Root Bridge */ + Status = AcpiUtExecute_CID (Node, &Cid); if (ACPI_FAILURE (Status)) { @@ -651,9 +653,9 @@ AcpiEvDefaultRegionSetup ( * Get the appropriate address space handler for a newly * created region. * - * This also performs address space specific initialization. For + * This also performs address space specific initialization. For * example, PCI regions must have an _ADR object that contains - * a PCI address in the scope of the definition. This address is + * a PCI address in the scope of the definition. This address is * required to perform an access to PCI config space. * * MUTEX: Interpreter should be unlocked, because we may run the _REG @@ -713,7 +715,7 @@ AcpiEvInitializeRegion ( { /* * The _REG method is optional and there can be only one per region - * definition. This will be executed when the handler is attached + * definition. This will be executed when the handler is attached * or removed */ RegionObj2->Extra.Method_REG = MethodNode; @@ -771,8 +773,8 @@ AcpiEvInitializeRegion ( AcpiNsLocked); /* - * Tell all users that this region is usable by running the _REG - * method + * Tell all users that this region is usable by + * running the _REG method */ if (AcpiNsLocked) { @@ -803,10 +805,8 @@ AcpiEvInitializeRegion ( } } - /* - * This node does not have the handler we need; - * Pop up one level - */ + /* This node does not have the handler we need; Pop up one level */ + Node = AcpiNsGetParentNode (Node); } diff --git a/sys/contrib/dev/acpica/evsci.c b/sys/contrib/dev/acpica/events/evsci.c index ab81cbb615ac..cde433ce3ee5 100644 --- a/sys/contrib/dev/acpica/evsci.c +++ b/sys/contrib/dev/acpica/events/evsci.c @@ -2,7 +2,6 @@ * * Module Name: evsci - System Control Interrupt configuration and * legacy to ACPI mode state transition functions - * $Revision: 1.102 $ * ******************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,8 +115,9 @@ * *****************************************************************************/ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acevents.h> +#include "acpi.h" +#include "accommon.h" +#include "acevents.h" #define _COMPONENT ACPI_EVENTS @@ -171,6 +171,7 @@ AcpiEvSciXruptHandler ( */ InterruptHandled |= AcpiEvGpeDetect (GpeXruptList); + AcpiSciCount++; return_UINT32 (InterruptHandled); } @@ -203,10 +204,8 @@ AcpiEvGpeXruptHandler ( * if this interrupt handler is installed, ACPI is enabled. */ - /* - * GPEs: - * Check for and dispatch any GPEs that have occurred - */ + /* GPEs: Check for and dispatch any GPEs that have occurred */ + InterruptHandled |= AcpiEvGpeDetect (GpeXruptList); return_UINT32 (InterruptHandled); @@ -250,11 +249,11 @@ AcpiEvInstallSciHandler ( * RETURN: E_OK if handler uninstalled OK, E_ERROR if handler was not * installed to begin with * - * DESCRIPTION: Remove the SCI interrupt handler. No further SCIs will be + * DESCRIPTION: Remove the SCI interrupt handler. No further SCIs will be * taken. * * Note: It doesn't seem important to disable all events or set the event - * enable registers to their original values. The OS should disable + * enable registers to their original values. The OS should disable * the SCI interrupt level when the handler is removed, so no more * events will come in. * diff --git a/sys/contrib/dev/acpica/evxface.c b/sys/contrib/dev/acpica/events/evxface.c index 15fbc9c65047..f816abad3a51 100644 --- a/sys/contrib/dev/acpica/evxface.c +++ b/sys/contrib/dev/acpica/events/evxface.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: evxface - External interfaces for ACPI events - * $Revision: 1.165 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,10 +116,11 @@ #define __EVXFACE_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/acevents.h> -#include <contrib/dev/acpica/acinterp.h> +#include "acpi.h" +#include "accommon.h" +#include "acnamesp.h" +#include "acevents.h" +#include "acinterp.h" #define _COMPONENT ACPI_EVENTS ACPI_MODULE_NAME ("evxface") @@ -378,7 +378,7 @@ AcpiInstallNotifyHandler ( /* * Root Object: * Registering a notify handler on the root object indicates that the - * caller wishes to receive notifications for all objects. Note that + * caller wishes to receive notifications for all objects. Note that * only one <external> global handler can be regsitered (per notify type). */ if (Device == ACPI_ROOT_OBJECT) @@ -727,7 +727,8 @@ AcpiInstallGpeHandler ( /* Make sure that there isn't a handler there already */ - if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_HANDLER) + if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == + ACPI_GPE_DISPATCH_HANDLER) { Status = AE_ALREADY_EXISTS; goto UnlockAndExit; @@ -761,7 +762,7 @@ AcpiInstallGpeHandler ( /* Setup up dispatch flags to indicate handler (vs. method) */ - GpeEventInfo->Flags &= ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK); /* Clear bits */ + GpeEventInfo->Flags &= ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK); GpeEventInfo->Flags |= (UINT8) (Type | ACPI_GPE_DISPATCH_HANDLER); AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); @@ -829,7 +830,8 @@ AcpiRemoveGpeHandler ( /* Make sure that a handler is indeed installed */ - if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) != ACPI_GPE_DISPATCH_HANDLER) + if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) != + ACPI_GPE_DISPATCH_HANDLER) { Status = AE_NOT_EXIST; goto UnlockAndExit; diff --git a/sys/contrib/dev/acpica/evxfevnt.c b/sys/contrib/dev/acpica/events/evxfevnt.c index e90bded5c7ac..bc24f18c51e2 100644 --- a/sys/contrib/dev/acpica/evxfevnt.c +++ b/sys/contrib/dev/acpica/events/evxfevnt.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: evxfevnt - External Interfaces, ACPI event disable/enable - * $Revision: 1.93 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,14 +116,23 @@ #define __EVXFEVNT_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acevents.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/actables.h> +#include "acpi.h" +#include "accommon.h" +#include "acevents.h" +#include "acnamesp.h" +#include "actables.h" #define _COMPONENT ACPI_EVENTS ACPI_MODULE_NAME ("evxfevnt") +/* Local prototypes */ + +static ACPI_STATUS +AcpiEvGetGpeDevice ( + ACPI_GPE_XRUPT_INFO *GpeXruptInfo, + ACPI_GPE_BLOCK_INFO *GpeBlock, + void *Context); + /******************************************************************************* * @@ -264,10 +272,12 @@ AcpiEnableEvent ( } /* - * Enable the requested fixed event (by writing a one to the - * enable register bit) + * Enable the requested fixed event (by writing a one to the enable + * register bit) */ - Status = AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId, 1); + Status = AcpiWriteBitRegister ( + AcpiGbl_FixedEventInfo[Event].EnableRegisterId, + ACPI_ENABLE_EVENT); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -275,8 +285,8 @@ AcpiEnableEvent ( /* Make sure that the hardware responded */ - Status = AcpiGetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId, - &Value); + Status = AcpiReadBitRegister ( + AcpiGbl_FixedEventInfo[Event].EnableRegisterId, &Value); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -504,17 +514,19 @@ AcpiDisableEvent ( } /* - * Disable the requested fixed event (by writing a zero to the - * enable register bit) + * Disable the requested fixed event (by writing a zero to the enable + * register bit) */ - Status = AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId, 0); + Status = AcpiWriteBitRegister ( + AcpiGbl_FixedEventInfo[Event].EnableRegisterId, + ACPI_DISABLE_EVENT); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } - Status = AcpiGetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId, - &Value); + Status = AcpiReadBitRegister ( + AcpiGbl_FixedEventInfo[Event].EnableRegisterId, &Value); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -563,10 +575,12 @@ AcpiClearEvent ( } /* - * Clear the requested fixed event (By writing a one to the - * status register bit) + * Clear the requested fixed event (By writing a one to the status + * register bit) */ - Status = AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].StatusRegisterId, 1); + Status = AcpiWriteBitRegister ( + AcpiGbl_FixedEventInfo[Event].StatusRegisterId, + ACPI_CLEAR_STATUS); return_ACPI_STATUS (Status); } @@ -673,8 +687,8 @@ AcpiGetEventStatus ( /* Get the status of the requested fixed event */ - Status = AcpiGetRegister (AcpiGbl_FixedEventInfo[Event].StatusRegisterId, - EventStatus); + Status = AcpiReadBitRegister ( + AcpiGbl_FixedEventInfo[Event].StatusRegisterId, EventStatus); return_ACPI_STATUS (Status); } @@ -803,7 +817,7 @@ AcpiInstallGpeBlock ( * is always zero */ Status = AcpiEvCreateGpeBlock (Node, GpeBlockAddress, RegisterCount, - 0, InterruptNumber, &GpeBlock); + 0, InterruptNumber, &GpeBlock); if (ACPI_FAILURE (Status)) { goto UnlockAndExit; @@ -922,3 +936,177 @@ UnlockAndExit: ACPI_EXPORT_SYMBOL (AcpiRemoveGpeBlock) + +/******************************************************************************* + * + * FUNCTION: AcpiGetGpeDevice + * + * PARAMETERS: Index - System GPE index (0-CurrentGpeCount) + * GpeDevice - Where the parent GPE Device is returned + * + * RETURN: Status + * + * DESCRIPTION: Obtain the GPE device associated with the input index. A NULL + * gpe device indicates that the gpe number is contained in one of + * the FADT-defined gpe blocks. Otherwise, the GPE block device. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiGetGpeDevice ( + UINT32 Index, + ACPI_HANDLE *GpeDevice) +{ + ACPI_GPE_DEVICE_INFO Info; + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (AcpiGetGpeDevice); + + + if (!GpeDevice) + { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + + if (Index >= AcpiCurrentGpeCount) + { + return_ACPI_STATUS (AE_NOT_EXIST); + } + + /* Setup and walk the GPE list */ + + Info.Index = Index; + Info.Status = AE_NOT_EXIST; + Info.GpeDevice = NULL; + Info.NextBlockBaseIndex = 0; + + Status = AcpiEvWalkGpeList (AcpiEvGetGpeDevice, &Info); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + *GpeDevice = ACPI_CAST_PTR (ACPI_HANDLE, Info.GpeDevice); + return_ACPI_STATUS (Info.Status); +} + +ACPI_EXPORT_SYMBOL (AcpiGetGpeDevice) + + +/******************************************************************************* + * + * FUNCTION: AcpiEvGetGpeDevice + * + * PARAMETERS: GPE_WALK_CALLBACK + * + * RETURN: Status + * + * DESCRIPTION: Matches the input GPE index (0-CurrentGpeCount) with a GPE + * block device. NULL if the GPE is one of the FADT-defined GPEs. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiEvGetGpeDevice ( + ACPI_GPE_XRUPT_INFO *GpeXruptInfo, + ACPI_GPE_BLOCK_INFO *GpeBlock, + void *Context) +{ + ACPI_GPE_DEVICE_INFO *Info = Context; + + + /* Increment Index by the number of GPEs in this block */ + + Info->NextBlockBaseIndex += + (GpeBlock->RegisterCount * ACPI_GPE_REGISTER_WIDTH); + + if (Info->Index < Info->NextBlockBaseIndex) + { + /* + * The GPE index is within this block, get the node. Leave the node + * NULL for the FADT-defined GPEs + */ + if ((GpeBlock->Node)->Type == ACPI_TYPE_DEVICE) + { + Info->GpeDevice = GpeBlock->Node; + } + + Info->Status = AE_OK; + return (AE_CTRL_END); + } + + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiDisableAllGpes + * + * PARAMETERS: None + * + * RETURN: Status + * + * DESCRIPTION: Disable and clear all GPEs in all GPE blocks + * + ******************************************************************************/ + +ACPI_STATUS +AcpiDisableAllGpes ( + void) +{ + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (AcpiDisableAllGpes); + + + Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + Status = AcpiHwDisableAllGpes (); + (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); + + return_ACPI_STATUS (Status); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiEnableAllRuntimeGpes + * + * PARAMETERS: None + * + * RETURN: Status + * + * DESCRIPTION: Enable all "runtime" GPEs, in all GPE blocks + * + ******************************************************************************/ + +ACPI_STATUS +AcpiEnableAllRuntimeGpes ( + void) +{ + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (AcpiEnableAllRuntimeGpes); + + + Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + Status = AcpiHwEnableAllRuntimeGpes (); + (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); + + return_ACPI_STATUS (Status); +} + + diff --git a/sys/contrib/dev/acpica/evxfregn.c b/sys/contrib/dev/acpica/events/evxfregn.c index 7058683fae10..d4f499130a4c 100644 --- a/sys/contrib/dev/acpica/evxfregn.c +++ b/sys/contrib/dev/acpica/events/evxfregn.c @@ -2,7 +2,6 @@ * * Module Name: evxfregn - External Interfaces, ACPI Operation Regions and * Address Spaces. - * $Revision: 1.70 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,9 +116,10 @@ #define __EVXFREGN_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/acevents.h> +#include "acpi.h" +#include "accommon.h" +#include "acnamesp.h" +#include "acevents.h" #define _COMPONENT ACPI_EVENTS ACPI_MODULE_NAME ("evxfregn") @@ -285,7 +285,8 @@ AcpiRemoveAddressSpaceHandler ( /* Matched SpaceId, first dereference this in the Regions */ ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, - "Removing address handler %p(%p) for region %s on Device %p(%p)\n", + "Removing address handler %p(%p) for region %s " + "on Device %p(%p)\n", HandlerObj, Handler, AcpiUtGetRegionName (SpaceId), Node, ObjDesc)); diff --git a/sys/contrib/dev/acpica/exconfig.c b/sys/contrib/dev/acpica/executer/exconfig.c index 60d8b36e049f..5b48bef4b4d7 100644 --- a/sys/contrib/dev/acpica/exconfig.c +++ b/sys/contrib/dev/acpica/executer/exconfig.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: exconfig - Namespace reconfiguration (Load/Unload opcodes) - * $Revision: 1.103 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,13 +116,13 @@ #define __EXCONFIG_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acinterp.h> -#include <contrib/dev/acpica/amlcode.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/acevents.h> -#include <contrib/dev/acpica/actables.h> -#include <contrib/dev/acpica/acdispat.h> +#include "acpi.h" +#include "accommon.h" +#include "acinterp.h" +#include "acnamesp.h" +#include "actables.h" +#include "acdispat.h" +#include "acevents.h" #define _COMPONENT ACPI_EXECUTER @@ -133,10 +132,16 @@ static ACPI_STATUS AcpiExAddTable ( - ACPI_NATIVE_UINT TableIndex, + UINT32 TableIndex, ACPI_NAMESPACE_NODE *ParentNode, ACPI_OPERAND_OBJECT **DdbHandle); +static ACPI_STATUS +AcpiExRegionRead ( + ACPI_OPERAND_OBJECT *ObjDesc, + UINT32 Length, + UINT8 *Buffer); + /******************************************************************************* * @@ -155,7 +160,7 @@ AcpiExAddTable ( static ACPI_STATUS AcpiExAddTable ( - ACPI_NATIVE_UINT TableIndex, + UINT32 TableIndex, ACPI_NAMESPACE_NODE *ParentNode, ACPI_OPERAND_OBJECT **DdbHandle) { @@ -176,12 +181,13 @@ AcpiExAddTable ( /* Init the table handle */ - ObjDesc->Reference.Opcode = AML_LOAD_OP; + ObjDesc->Common.Flags |= AOPOBJ_DATA_VALID; + ObjDesc->Reference.Class = ACPI_REFCLASS_TABLE; *DdbHandle = ObjDesc; /* Install the new table into the local data structures */ - ObjDesc->Reference.Object = ACPI_CAST_PTR (void, TableIndex); + ObjDesc->Reference.Value = TableIndex; /* Add the table to the namespace */ @@ -216,17 +222,26 @@ AcpiExLoadTableOp ( { ACPI_STATUS Status; ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; - ACPI_NATIVE_UINT TableIndex; ACPI_NAMESPACE_NODE *ParentNode; ACPI_NAMESPACE_NODE *StartNode; ACPI_NAMESPACE_NODE *ParameterNode = NULL; ACPI_OPERAND_OBJECT *DdbHandle; ACPI_TABLE_HEADER *Table; + UINT32 TableIndex; ACPI_FUNCTION_TRACE (ExLoadTableOp); + /* Validate lengths for the SignatureString, OEMIDString, OEMTableID */ + + if ((Operand[0]->String.Length > ACPI_NAME_SIZE) || + (Operand[1]->String.Length > ACPI_OEM_ID_SIZE) || + (Operand[2]->String.Length > ACPI_OEM_TABLE_ID_SIZE)) + { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + /* Find the ACPI table in the RSDT/XSDT */ Status = AcpiTbFindTable (Operand[0]->String.Pointer, @@ -318,6 +333,8 @@ AcpiExLoadTableOp ( if (ACPI_FAILURE (Status)) { (void) AcpiExUnloadTable (DdbHandle); + + AcpiUtRemoveReference (DdbHandle); return_ACPI_STATUS (Status); } } @@ -326,10 +343,18 @@ AcpiExLoadTableOp ( if (ACPI_SUCCESS (Status)) { ACPI_INFO ((AE_INFO, - "Dynamic OEM Table Load - [%4.4s] OemId [%6.6s] OemTableId [%8.8s]", + "Dynamic OEM Table Load - [%.4s] OemId [%.6s] OemTableId [%.8s]", Table->Signature, Table->OemId, Table->OemTableId)); } + /* Invoke table handler if present */ + + if (AcpiGbl_TableHandler) + { + (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_LOAD, Table, + AcpiGbl_TableHandlerContext); + } + *ReturnDesc = DdbHandle; return_ACPI_STATUS (Status); } @@ -337,6 +362,53 @@ AcpiExLoadTableOp ( /******************************************************************************* * + * FUNCTION: AcpiExRegionRead + * + * PARAMETERS: ObjDesc - Region descriptor + * Length - Number of bytes to read + * Buffer - Pointer to where to put the data + * + * RETURN: Status + * + * DESCRIPTION: Read data from an operation region. The read starts from the + * beginning of the region. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiExRegionRead ( + ACPI_OPERAND_OBJECT *ObjDesc, + UINT32 Length, + UINT8 *Buffer) +{ + ACPI_STATUS Status; + ACPI_INTEGER Value; + UINT32 RegionOffset = 0; + UINT32 i; + + + /* Bytewise reads */ + + for (i = 0; i < Length; i++) + { + Status = AcpiEvAddressSpaceDispatch (ObjDesc, ACPI_READ, + RegionOffset, 8, &Value); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + *Buffer = (UINT8) Value; + Buffer++; + RegionOffset++; + } + + return (AE_OK); +} + + +/******************************************************************************* + * * FUNCTION: AcpiExLoadOp * * PARAMETERS: ObjDesc - Region or Buffer/Field where the table will be @@ -363,23 +435,27 @@ AcpiExLoadOp ( ACPI_WALK_STATE *WalkState) { ACPI_OPERAND_OBJECT *DdbHandle; + ACPI_TABLE_HEADER *Table; ACPI_TABLE_DESC TableDesc; - ACPI_NATIVE_UINT TableIndex; + UINT32 TableIndex; ACPI_STATUS Status; + UINT32 Length; ACPI_FUNCTION_TRACE (ExLoadOp); ACPI_MEMSET (&TableDesc, 0, sizeof (ACPI_TABLE_DESC)); - TableDesc.Flags = ACPI_TABLE_ORIGIN_ALLOCATED; /* Source Object can be either an OpRegion or a Buffer/Field */ - switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) + switch (ObjDesc->Common.Type) { case ACPI_TYPE_REGION: + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "Load table from Region %p\n", ObjDesc)); + /* Region must be SystemMemory (from ACPI spec) */ if (ObjDesc->Region.SpaceId != ACPI_ADR_SPACE_SYSTEM_MEMORY) @@ -387,9 +463,6 @@ AcpiExLoadOp ( return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Load from Region %p %s\n", - ObjDesc, AcpiUtGetObjectTypeName (ObjDesc))); - /* * If the Region Address and Length have not been previously evaluated, * evaluate them now and save the results. @@ -403,39 +476,145 @@ AcpiExLoadOp ( } } + /* Get the table header first so we can get the table length */ + + Table = ACPI_ALLOCATE (sizeof (ACPI_TABLE_HEADER)); + if (!Table) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + + Status = AcpiExRegionRead (ObjDesc, sizeof (ACPI_TABLE_HEADER), + ACPI_CAST_PTR (UINT8, Table)); + Length = Table->Length; + ACPI_FREE (Table); + + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* Must have at least an ACPI table header */ + + if (Length < sizeof (ACPI_TABLE_HEADER)) + { + return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH); + } + + /* + * The original implementation simply mapped the table, with no copy. + * However, the memory region is not guaranteed to remain stable and + * we must copy the table to a local buffer. For example, the memory + * region is corrupted after suspend on some machines. Dynamically + * loaded tables are usually small, so this overhead is minimal. + * + * The latest implementation (5/2009) does not use a mapping at all. + * We use the low-level operation region interface to read the table + * instead of the obvious optimization of using a direct mapping. + * This maintains a consistent use of operation regions across the + * entire subsystem. This is important if additional processing must + * be performed in the (possibly user-installed) operation region + * handler. For example, AcpiExec and ASLTS depend on this. + */ + + /* Allocate a buffer for the table */ + + TableDesc.Pointer = ACPI_ALLOCATE (Length); + if (!TableDesc.Pointer) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + + /* Read the entire table */ + + Status = AcpiExRegionRead (ObjDesc, Length, + ACPI_CAST_PTR (UINT8, TableDesc.Pointer)); + if (ACPI_FAILURE (Status)) + { + ACPI_FREE (TableDesc.Pointer); + return_ACPI_STATUS (Status); + } + TableDesc.Address = ObjDesc->Region.Address; - TableDesc.Length = ObjDesc->Region.Length; - TableDesc.Flags = ACPI_TABLE_ORIGIN_MAPPED; break; + case ACPI_TYPE_BUFFER: /* Buffer or resolved RegionField */ - /* Simply extract the buffer from the buffer object */ + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "Load table from Buffer or Field %p\n", ObjDesc)); + + /* Must have at least an ACPI table header */ - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Load from Buffer or Field %p %s\n", - ObjDesc, AcpiUtGetObjectTypeName (ObjDesc))); + if (ObjDesc->Buffer.Length < sizeof (ACPI_TABLE_HEADER)) + { + return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH); + } + + /* Get the actual table length from the table header */ + + Table = ACPI_CAST_PTR (ACPI_TABLE_HEADER, ObjDesc->Buffer.Pointer); + Length = Table->Length; + + /* Table cannot extend beyond the buffer */ + + if (Length > ObjDesc->Buffer.Length) + { + return_ACPI_STATUS (AE_AML_BUFFER_LIMIT); + } + if (Length < sizeof (ACPI_TABLE_HEADER)) + { + return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH); + } - TableDesc.Pointer = ACPI_CAST_PTR (ACPI_TABLE_HEADER, - ObjDesc->Buffer.Pointer); - TableDesc.Length = TableDesc.Pointer->Length; - TableDesc.Flags = ACPI_TABLE_ORIGIN_ALLOCATED; + /* + * Copy the table from the buffer because the buffer could be modified + * or even deleted in the future + */ + TableDesc.Pointer = ACPI_ALLOCATE (Length); + if (!TableDesc.Pointer) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } - ObjDesc->Buffer.Pointer = NULL; + ACPI_MEMCPY (TableDesc.Pointer, Table, Length); + TableDesc.Address = ACPI_TO_INTEGER (TableDesc.Pointer); break; + default: return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } - /* - * Install the new table into the local data structures - */ + /* Validate table checksum (will not get validated in TbAddTable) */ + + Status = AcpiTbVerifyChecksum (TableDesc.Pointer, Length); + if (ACPI_FAILURE (Status)) + { + ACPI_FREE (TableDesc.Pointer); + return_ACPI_STATUS (Status); + } + + /* Complete the table descriptor */ + + TableDesc.Length = Length; + TableDesc.Flags = ACPI_TABLE_ORIGIN_ALLOCATED; + + /* Install the new table into the local data structures */ + Status = AcpiTbAddTable (&TableDesc, &TableIndex); if (ACPI_FAILURE (Status)) { goto Cleanup; } + /* + * Add the table to the namespace. + * + * Note: Load the table objects relative to the root of the namespace. + * This appears to go against the ACPI specification, but we do it for + * compatibility with other ACPI implementations. + */ Status = AcpiExAddTable (TableIndex, AcpiGbl_RootNode, &DdbHandle); if (ACPI_FAILURE (Status)) { @@ -453,12 +632,27 @@ AcpiExLoadOp ( /* TablePtr was deallocated above */ + AcpiUtRemoveReference (DdbHandle); return_ACPI_STATUS (Status); } + /* Remove the reference by added by AcpiExStore above */ + + AcpiUtRemoveReference (DdbHandle); + + /* Invoke table handler if present */ + + if (AcpiGbl_TableHandler) + { + (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_LOAD, TableDesc.Pointer, + AcpiGbl_TableHandlerContext); + } + Cleanup: if (ACPI_FAILURE (Status)) { + /* Delete allocated table buffer */ + AcpiTbDeleteTable (&TableDesc); } return_ACPI_STATUS (Status); @@ -483,7 +677,8 @@ AcpiExUnloadTable ( { ACPI_STATUS Status = AE_OK; ACPI_OPERAND_OBJECT *TableDesc = DdbHandle; - ACPI_NATIVE_UINT TableIndex; + UINT32 TableIndex; + ACPI_TABLE_HEADER *Table; ACPI_FUNCTION_TRACE (ExUnloadTable); @@ -491,33 +686,61 @@ AcpiExUnloadTable ( /* * Validate the handle - * Although the handle is partially validated in AcpiExReconfiguration(), + * Although the handle is partially validated in AcpiExReconfiguration() * when it calls AcpiExResolveOperands(), the handle is more completely * validated here. + * + * Handle must be a valid operand object of type reference. Also, the + * DdbHandle must still be marked valid (table has not been previously + * unloaded) */ if ((!DdbHandle) || (ACPI_GET_DESCRIPTOR_TYPE (DdbHandle) != ACPI_DESC_TYPE_OPERAND) || - (ACPI_GET_OBJECT_TYPE (DdbHandle) != ACPI_TYPE_LOCAL_REFERENCE)) + (DdbHandle->Common.Type != ACPI_TYPE_LOCAL_REFERENCE) || + (!(DdbHandle->Common.Flags & AOPOBJ_DATA_VALID))) { return_ACPI_STATUS (AE_BAD_PARAMETER); } /* Get the table index from the DdbHandle */ - TableIndex = (ACPI_NATIVE_UINT) TableDesc->Reference.Object; + TableIndex = TableDesc->Reference.Value; - /* - * Delete the entire namespace under this table Node - * (Offset contains the TableId) - */ - AcpiTbDeleteNamespaceByOwner (TableIndex); - AcpiTbReleaseOwnerId (TableIndex); + /* Ensure the table is still loaded */ - AcpiTbSetTableLoadedFlag (TableIndex, FALSE); + if (!AcpiTbIsTableLoaded (TableIndex)) + { + return_ACPI_STATUS (AE_NOT_EXIST); + } - /* Delete the table descriptor (DdbHandle) */ + /* Invoke table handler if present */ - AcpiUtRemoveReference (TableDesc); - return_ACPI_STATUS (Status); + if (AcpiGbl_TableHandler) + { + Status = AcpiGetTableByIndex (TableIndex, &Table); + if (ACPI_SUCCESS (Status)) + { + (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_UNLOAD, Table, + AcpiGbl_TableHandlerContext); + } + } + + /* Delete the portion of the namespace owned by this table */ + + Status = AcpiTbDeleteNamespaceByOwner (TableIndex); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + (void) AcpiTbReleaseOwnerId (TableIndex); + AcpiTbSetTableLoadedFlag (TableIndex, FALSE); + + /* + * Invalidate the handle. We do this because the handle may be stored + * in a named object and may not be actually deleted until much later. + */ + DdbHandle->Common.Flags &= ~AOPOBJ_DATA_VALID; + return_ACPI_STATUS (AE_OK); } diff --git a/sys/contrib/dev/acpica/exconvrt.c b/sys/contrib/dev/acpica/executer/exconvrt.c index 17c86c28b7f5..e7d853032989 100644 --- a/sys/contrib/dev/acpica/exconvrt.c +++ b/sys/contrib/dev/acpica/executer/exconvrt.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: exconvrt - Object conversion routines - * $Revision: 1.74 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,9 +116,10 @@ #define __EXCONVRT_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acinterp.h> -#include <contrib/dev/acpica/amlcode.h> +#include "acpi.h" +#include "accommon.h" +#include "acinterp.h" +#include "amlcode.h" #define _COMPONENT ACPI_EXECUTER @@ -139,7 +139,7 @@ AcpiExConvertToAscii ( * * FUNCTION: AcpiExConvertToInteger * - * PARAMETERS: ObjDesc - Object to be converted. Must be an + * PARAMETERS: ObjDesc - Object to be converted. Must be an * Integer, Buffer, or String * ResultDesc - Where the new Integer object is returned * Flags - Used for string conversion @@ -167,7 +167,7 @@ AcpiExConvertToInteger ( ACPI_FUNCTION_TRACE_PTR (ExConvertToInteger, ObjDesc); - switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) + switch (ObjDesc->Common.Type) { case ACPI_TYPE_INTEGER: @@ -190,7 +190,7 @@ AcpiExConvertToInteger ( } /* - * Convert the buffer/string to an integer. Note that both buffers and + * Convert the buffer/string to an integer. Note that both buffers and * strings are treated as raw data - we don't convert ascii to hex for * strings. * @@ -202,13 +202,13 @@ AcpiExConvertToInteger ( /* String conversion is different than Buffer conversion */ - switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) + switch (ObjDesc->Common.Type) { case ACPI_TYPE_STRING: /* * Convert string to an integer - for most cases, the string must be - * hexadecimal as per the ACPI specification. The only exception (as + * hexadecimal as per the ACPI specification. The only exception (as * of ACPI 3.0) is that the ToInteger() operator allows both decimal * and hexadecimal strings (hex prefixed with "0x"). */ @@ -253,6 +253,7 @@ AcpiExConvertToInteger ( default: + /* No other types can get here */ break; } @@ -281,7 +282,7 @@ AcpiExConvertToInteger ( * * FUNCTION: AcpiExConvertToBuffer * - * PARAMETERS: ObjDesc - Object to be converted. Must be an + * PARAMETERS: ObjDesc - Object to be converted. Must be an * Integer, Buffer, or String * ResultDesc - Where the new buffer object is returned * @@ -303,7 +304,7 @@ AcpiExConvertToBuffer ( ACPI_FUNCTION_TRACE_PTR (ExConvertToBuffer, ObjDesc); - switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) + switch (ObjDesc->Common.Type) { case ACPI_TYPE_BUFFER: @@ -395,11 +396,11 @@ AcpiExConvertToAscii ( UINT8 DataWidth) { ACPI_INTEGER Digit; - ACPI_NATIVE_UINT i; - ACPI_NATIVE_UINT j; - ACPI_NATIVE_UINT k = 0; - ACPI_NATIVE_UINT HexLength; - ACPI_NATIVE_UINT DecimalLength; + UINT32 i; + UINT32 j; + UINT32 k = 0; + UINT32 HexLength; + UINT32 DecimalLength; UINT32 Remainder; BOOLEAN SupressZeros; @@ -461,7 +462,7 @@ AcpiExConvertToAscii ( /* HexLength: 2 ascii hex chars per data byte */ - HexLength = (ACPI_NATIVE_UINT) ACPI_MUL_2 (DataWidth); + HexLength = ACPI_MUL_2 (DataWidth); for (i = 0, j = (HexLength-1); i < HexLength; i++, j--) { /* Get one hex digit, most significant digits first */ @@ -476,7 +477,7 @@ AcpiExConvertToAscii ( } /* - * Since leading zeros are supressed, we must check for the case where + * Since leading zeros are suppressed, we must check for the case where * the integer equals 0 * * Finally, null terminate the string and return the length @@ -496,7 +497,7 @@ AcpiExConvertToAscii ( * * FUNCTION: AcpiExConvertToString * - * PARAMETERS: ObjDesc - Object to be converted. Must be an + * PARAMETERS: ObjDesc - Object to be converted. Must be an * Integer, Buffer, or String * ResultDesc - Where the string object is returned * Type - String flags (base and conversion type) @@ -524,7 +525,7 @@ AcpiExConvertToString ( ACPI_FUNCTION_TRACE_PTR (ExConvertToString, ObjDesc); - switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) + switch (ObjDesc->Common.Type) { case ACPI_TYPE_STRING: @@ -592,7 +593,7 @@ AcpiExConvertToString ( Base = 10; /* - * Calculate the final string length. Individual string values + * Calculate the final string length. Individual string values * are variable length (include separator for each) */ for (i = 0; i < ObjDesc->Buffer.Length; i++) @@ -637,8 +638,14 @@ AcpiExConvertToString ( /* * Create a new string object and string buffer * (-1 because of extra separator included in StringLength from above) + * Allow creation of zero-length strings from zero-length buffers. */ - ReturnDesc = AcpiUtCreateStringObject ((ACPI_SIZE) (StringLength - 1)); + if (StringLength) + { + StringLength--; + } + + ReturnDesc = AcpiUtCreateStringObject ((ACPI_SIZE) StringLength); if (!ReturnDesc) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -662,7 +669,10 @@ AcpiExConvertToString ( * Null terminate the string * (overwrites final comma/space from above) */ - NewBuf--; + if (ObjDesc->Buffer.Length) + { + NewBuf--; + } *NewBuf = 0; break; @@ -728,7 +738,7 @@ AcpiExConvertToTargetType ( default: /* No conversion allowed for these types */ - if (DestinationType != ACPI_GET_OBJECT_TYPE (SourceDesc)) + if (DestinationType != SourceDesc->Common.Type) { ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Explicit operator, will store (%s) over existing type (%s)\n", @@ -749,7 +759,7 @@ AcpiExConvertToTargetType ( case ACPI_TYPE_LOCAL_BANK_FIELD: case ACPI_TYPE_LOCAL_INDEX_FIELD: /* - * These types require an Integer operand. We can convert + * These types require an Integer operand. We can convert * a Buffer or a String to an Integer if necessary. */ Status = AcpiExConvertToInteger (SourceDesc, ResultDesc, @@ -759,7 +769,7 @@ AcpiExConvertToTargetType ( case ACPI_TYPE_STRING: /* - * The operand must be a String. We can convert an + * The operand must be a String. We can convert an * Integer or Buffer if necessary */ Status = AcpiExConvertToString (SourceDesc, ResultDesc, @@ -769,7 +779,7 @@ AcpiExConvertToTargetType ( case ACPI_TYPE_BUFFER: /* - * The operand must be a Buffer. We can convert an + * The operand must be a Buffer. We can convert an * Integer or String if necessary */ Status = AcpiExConvertToBuffer (SourceDesc, ResultDesc); diff --git a/sys/contrib/dev/acpica/excreate.c b/sys/contrib/dev/acpica/executer/excreate.c index d237dab403bb..e5463187a865 100644 --- a/sys/contrib/dev/acpica/excreate.c +++ b/sys/contrib/dev/acpica/executer/excreate.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: excreate - Named object creation - * $Revision: 1.114 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,12 +116,11 @@ #define __EXCREATE_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acinterp.h> -#include <contrib/dev/acpica/amlcode.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/acevents.h> -#include <contrib/dev/acpica/actables.h> +#include "acpi.h" +#include "accommon.h" +#include "acinterp.h" +#include "amlcode.h" +#include "acnamesp.h" #define _COMPONENT ACPI_EXECUTER @@ -180,16 +178,28 @@ AcpiExCreateAlias ( */ switch (TargetNode->Type) { + + /* For these types, the sub-object can change dynamically via a Store */ + case ACPI_TYPE_INTEGER: case ACPI_TYPE_STRING: case ACPI_TYPE_BUFFER: case ACPI_TYPE_PACKAGE: case ACPI_TYPE_BUFFER_FIELD: + /* + * These types open a new scope, so we need the NS node in order to access + * any children. + */ + case ACPI_TYPE_DEVICE: + case ACPI_TYPE_POWER: + case ACPI_TYPE_PROCESSOR: + case ACPI_TYPE_THERMAL: + case ACPI_TYPE_LOCAL_SCOPE: + /* * The new alias has the type ALIAS and points to the original - * NS node, not the object itself. This is because for these - * types, the object can change dynamically via a Store. + * NS node, not the object itself. */ AliasNode->Type = ACPI_TYPE_LOCAL_ALIAS; AliasNode->Object = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, TargetNode); @@ -198,9 +208,7 @@ AcpiExCreateAlias ( case ACPI_TYPE_METHOD: /* - * The new alias has the type ALIAS and points to the original - * NS node, not the object itself. This is because for these - * types, the object can change dynamically via a Store. + * Control method aliases need to be differentiated */ AliasNode->Type = ACPI_TYPE_LOCAL_METHOD_ALIAS; AliasNode->Object = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, TargetNode); @@ -441,115 +449,6 @@ Cleanup: /******************************************************************************* * - * FUNCTION: AcpiExCreateTableRegion - * - * PARAMETERS: WalkState - Current state - * - * RETURN: Status - * - * DESCRIPTION: Create a new DataTableRegion object - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExCreateTableRegion ( - ACPI_WALK_STATE *WalkState) -{ - ACPI_STATUS Status; - ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_NAMESPACE_NODE *Node; - ACPI_OPERAND_OBJECT *RegionObj2; - ACPI_NATIVE_UINT TableIndex; - ACPI_TABLE_HEADER *Table; - - - ACPI_FUNCTION_TRACE (ExCreateTableRegion); - - - /* Get the Node from the object stack */ - - Node = WalkState->Op->Common.Node; - - /* - * If the region object is already attached to this node, - * just return - */ - if (AcpiNsGetAttachedObject (Node)) - { - return_ACPI_STATUS (AE_OK); - } - - /* Find the ACPI table */ - - Status = AcpiTbFindTable (Operand[1]->String.Pointer, - Operand[2]->String.Pointer, Operand[3]->String.Pointer, - &TableIndex); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Create the region descriptor */ - - ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_REGION); - if (!ObjDesc) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - RegionObj2 = ObjDesc->Common.NextObject; - RegionObj2->Extra.RegionContext = NULL; - - Status = AcpiGetTableByIndex (TableIndex, &Table); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Init the region from the operands */ - - ObjDesc->Region.SpaceId = REGION_DATA_TABLE; - ObjDesc->Region.Address = (ACPI_PHYSICAL_ADDRESS) ACPI_TO_INTEGER (Table); - ObjDesc->Region.Length = Table->Length; - ObjDesc->Region.Node = Node; - ObjDesc->Region.Flags = AOPOBJ_DATA_VALID; - - /* Install the new region object in the parent Node */ - - Status = AcpiNsAttachObject (Node, ObjDesc, ACPI_TYPE_REGION); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - - Status = AcpiEvInitializeRegion (ObjDesc, FALSE); - if (ACPI_FAILURE (Status)) - { - if (Status == AE_NOT_EXIST) - { - Status = AE_OK; - } - else - { - goto Cleanup; - } - } - - ObjDesc->Region.Flags |= AOPOBJ_SETUP_COMPLETE; - - -Cleanup: - - /* Remove local reference to the object */ - - AcpiUtRemoveReference (ObjDesc); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * * FUNCTION: AcpiExCreateProcessor * * PARAMETERS: WalkState - Current state @@ -715,7 +614,7 @@ AcpiExCreateMethod ( * ACPI 2.0: SyncLevel = SyncLevel in method declaration */ ObjDesc->Method.SyncLevel = (UINT8) - ((MethodFlags & AML_METHOD_SYNCH_LEVEL) >> 4); + ((MethodFlags & AML_METHOD_SYNC_LEVEL) >> 4); } /* Attach the new object to the method Node */ diff --git a/sys/contrib/dev/acpica/exdump.c b/sys/contrib/dev/acpica/executer/exdump.c index c7d26ae91064..5de5a6f6e403 100644 --- a/sys/contrib/dev/acpica/exdump.c +++ b/sys/contrib/dev/acpica/executer/exdump.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: exdump - Interpreter debug output routines - * $Revision: 1.202 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,11 +115,12 @@ #define __EXDUMP_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acinterp.h> -#include <contrib/dev/acpica/amlcode.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/acparser.h> +#include "acpi.h" +#include "accommon.h" +#include "acinterp.h" +#include "amlcode.h" +#include "acnamesp.h" + #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME ("exdump") @@ -213,10 +213,11 @@ static ACPI_EXDUMP_INFO AcpiExDumpEvent[2] = {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Event.OsSemaphore), "OsSemaphore"} }; -static ACPI_EXDUMP_INFO AcpiExDumpMethod[8] = +static ACPI_EXDUMP_INFO AcpiExDumpMethod[9] = { {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpMethod), NULL}, - {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.ParamCount), "ParamCount"}, + {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.MethodFlags), "Method Flags"}, + {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.ParamCount), "Parameter Count"}, {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.SyncLevel), "Sync Level"}, {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Method.Mutex), "Mutex"}, {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.OwnerId), "Owner Id"}, @@ -305,12 +306,12 @@ static ACPI_EXDUMP_INFO AcpiExDumpIndexField[5] = {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (IndexField.DataObj), "Data Object"} }; - -static ACPI_EXDUMP_INFO AcpiExDumpReference[7] = +static ACPI_EXDUMP_INFO AcpiExDumpReference[8] = { {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpReference), NULL}, + {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Reference.Class), "Class"}, {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Reference.TargetType), "Target Type"}, - {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Reference.Offset), "Offset"}, + {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Reference.Value), "Value"}, {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Reference.Object), "Object Desc"}, {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Reference.Node), "Node"}, {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Reference.Where), "Where"}, @@ -345,7 +346,6 @@ static ACPI_EXDUMP_INFO AcpiExDumpCommon[4] = {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Common.Flags), "Flags"} }; - static ACPI_EXDUMP_INFO AcpiExDumpFieldCommon[7] = { {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpFieldCommon), NULL}, @@ -449,6 +449,7 @@ AcpiExDumpObject ( break; case ACPI_EXD_TYPE: + AcpiExOutString ("Type", AcpiUtGetObjectTypeName (ObjDesc)); break; @@ -470,7 +471,7 @@ AcpiExDumpObject ( case ACPI_EXD_UINT64: AcpiOsPrintf ("%20s : %8.8X%8.8X\n", "Value", - ACPI_FORMAT_UINT64 (ACPI_GET64 (Target))); + ACPI_FORMAT_UINT64 (ACPI_GET64 (Target))); break; case ACPI_EXD_POINTER: @@ -505,13 +506,15 @@ AcpiExDumpObject ( case ACPI_EXD_REFERENCE: - AcpiExOutString ("Opcode", - (AcpiPsGetOpcodeInfo (ObjDesc->Reference.Opcode))->Name); + AcpiExOutString ("Class Name", + ACPI_CAST_PTR (char, AcpiUtGetReferenceName (ObjDesc))); AcpiExDumpReferenceObj (ObjDesc); break; default: - AcpiOsPrintf ("**** Invalid table opcode [%X] ****\n", Info->Opcode); + + AcpiOsPrintf ("**** Invalid table opcode [%X] ****\n", + Info->Opcode); return; } @@ -589,108 +592,79 @@ AcpiExDumpOperand ( /* Decode object type */ - switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) + switch (ObjDesc->Common.Type) { case ACPI_TYPE_LOCAL_REFERENCE: - switch (ObjDesc->Reference.Opcode) + AcpiOsPrintf ("Reference: [%s] ", AcpiUtGetReferenceName (ObjDesc)); + + switch (ObjDesc->Reference.Class) { - case AML_DEBUG_OP: + case ACPI_REFCLASS_DEBUG: - AcpiOsPrintf ("Reference: Debug\n"); + AcpiOsPrintf ("\n"); break; - case AML_INDEX_OP: + case ACPI_REFCLASS_INDEX: - AcpiOsPrintf ("Reference: Index %p\n", - ObjDesc->Reference.Object); + AcpiOsPrintf ("%p\n", ObjDesc->Reference.Object); break; - case AML_REF_OF_OP: + case ACPI_REFCLASS_TABLE: - AcpiOsPrintf ("Reference: (RefOf) %p\n", - ObjDesc->Reference.Object); + AcpiOsPrintf ("Table Index %X\n", ObjDesc->Reference.Value); break; - case AML_ARG_OP: - - AcpiOsPrintf ("Reference: Arg%d", - ObjDesc->Reference.Offset); - - if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER) - { - /* Value is an Integer */ - - AcpiOsPrintf (" value is [%8.8X%8.8x]", - ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); - } + case ACPI_REFCLASS_REFOF: - AcpiOsPrintf ("\n"); + AcpiOsPrintf ("%p [%s]\n", ObjDesc->Reference.Object, + AcpiUtGetTypeName (((ACPI_OPERAND_OBJECT *) + ObjDesc->Reference.Object)->Common.Type)); break; - case AML_LOCAL_OP: - - AcpiOsPrintf ("Reference: Local%d", - ObjDesc->Reference.Offset); - - if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER) - { - - /* Value is an Integer */ + case ACPI_REFCLASS_NAME: - AcpiOsPrintf (" value is [%8.8X%8.8x]", - ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); - } - - AcpiOsPrintf ("\n"); + AcpiOsPrintf ("- [%4.4s]\n", ObjDesc->Reference.Node->Name.Ascii); break; - case AML_INT_NAMEPATH_OP: + case ACPI_REFCLASS_ARG: + case ACPI_REFCLASS_LOCAL: - AcpiOsPrintf ("Reference.Node->Name %X\n", - ObjDesc->Reference.Node->Name.Integer); + AcpiOsPrintf ("%X\n", ObjDesc->Reference.Value); break; - default: + default: /* Unknown reference class */ - /* Unknown opcode */ - - AcpiOsPrintf ("Unknown Reference opcode=%X\n", - ObjDesc->Reference.Opcode); + AcpiOsPrintf ("%2.2X\n", ObjDesc->Reference.Class); break; - } break; case ACPI_TYPE_BUFFER: - AcpiOsPrintf ("Buffer len %X @ %p\n", + AcpiOsPrintf ("Buffer length %.2X @ %p\n", ObjDesc->Buffer.Length, ObjDesc->Buffer.Pointer); - Length = ObjDesc->Buffer.Length; - if (Length > 64) - { - Length = 64; - } - /* Debug only -- dump the buffer contents */ if (ObjDesc->Buffer.Pointer) { - AcpiOsPrintf ("Buffer Contents: "); - - for (Index = 0; Index < Length; Index++) + Length = ObjDesc->Buffer.Length; + if (Length > 128) { - AcpiOsPrintf (" %02x", ObjDesc->Buffer.Pointer[Index]); + Length = 128; } - AcpiOsPrintf ("\n"); + + AcpiOsPrintf ("Buffer Contents: (displaying length 0x%.2X)\n", + Length); + ACPI_DUMP_BUFFER (ObjDesc->Buffer.Pointer, Length); } break; @@ -740,7 +714,7 @@ AcpiExDumpOperand ( else { AcpiOsPrintf (" base %8.8X%8.8X Length %X\n", - ACPI_FORMAT_UINT64 (ObjDesc->Region.Address), + ACPI_FORMAT_NATIVE_UINT (ObjDesc->Region.Address), ObjDesc->Region.Length); } break; @@ -765,8 +739,8 @@ AcpiExDumpOperand ( case ACPI_TYPE_LOCAL_REGION_FIELD: - AcpiOsPrintf ( - "RegionField: Bits=%X AccWidth=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n", + AcpiOsPrintf ("RegionField: Bits=%X AccWidth=%X Lock=%X Update=%X at " + "byte=%X bit=%X of below:\n", ObjDesc->Field.BitLength, ObjDesc->Field.AccessByteWidth, ObjDesc->Field.FieldFlags & AML_FIELD_LOCK_RULE_MASK, @@ -786,8 +760,7 @@ AcpiExDumpOperand ( case ACPI_TYPE_BUFFER_FIELD: - AcpiOsPrintf ( - "BufferField: %X bits at byte %X bit %X of\n", + AcpiOsPrintf ("BufferField: %X bits at byte %X bit %X of\n", ObjDesc->BufferField.BitLength, ObjDesc->BufferField.BaseByteOffset, ObjDesc->BufferField.StartFieldBitOffset); @@ -796,7 +769,7 @@ AcpiExDumpOperand ( { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*NULL*\n")); } - else if (ACPI_GET_OBJECT_TYPE (ObjDesc->BufferField.BufferObj) != + else if ((ObjDesc->BufferField.BufferObj)->Common.Type != ACPI_TYPE_BUFFER) { AcpiOsPrintf ("*not a Buffer*\n"); @@ -856,7 +829,7 @@ AcpiExDumpOperand ( default: /* Unknown Type */ - AcpiOsPrintf ("Unknown Type %X\n", ACPI_GET_OBJECT_TYPE (ObjDesc)); + AcpiOsPrintf ("Unknown Type %X\n", ObjDesc->Common.Type); break; } @@ -868,63 +841,48 @@ AcpiExDumpOperand ( * * FUNCTION: AcpiExDumpOperands * - * PARAMETERS: Operands - Operand list - * InterpreterMode - Load or Exec - * Ident - Identification - * NumLevels - # of stack entries to dump above line - * Note - Output notation - * ModuleName - Caller's module name - * LineNumber - Caller's invocation line number + * PARAMETERS: Operands - A list of Operand objects + * OpcodeName - AML opcode name + * NumOperands - Operand count for this opcode * - * DESCRIPTION: Dump the object stack + * DESCRIPTION: Dump the operands associated with the opcode * ******************************************************************************/ void AcpiExDumpOperands ( ACPI_OPERAND_OBJECT **Operands, - ACPI_INTERPRETER_MODE InterpreterMode, - char *Ident, - UINT32 NumLevels, - char *Note, - char *ModuleName, - UINT32 LineNumber) + const char *OpcodeName, + UINT32 NumOperands) { - ACPI_NATIVE_UINT i; - - ACPI_FUNCTION_NAME (ExDumpOperands); - if (!Ident) + if (!OpcodeName) { - Ident = "?"; - } - - if (!Note) - { - Note = "?"; + OpcodeName = "UNKNOWN"; } ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "************* Operand Stack Contents (Opcode [%s], %d Operands)\n", - Ident, NumLevels)); + "**** Start operand dump for opcode [%s], %d operands\n", + OpcodeName, NumOperands)); - if (NumLevels == 0) + if (NumOperands == 0) { - NumLevels = 1; + NumOperands = 1; } - /* Dump the operand stack starting at the top */ + /* Dump the individual operands */ - for (i = 0; NumLevels > 0; i--, NumLevels--) + while (NumOperands) { - AcpiExDumpOperand (Operands[i], 0); + AcpiExDumpOperand (*Operands, 0); + Operands++; + NumOperands--; } ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "************* Operand Stack dump from %s(%d), %s\n", - ModuleName, LineNumber, Note)); + "**** End operand dump for [%s]\n", OpcodeName)); return; } @@ -987,10 +945,10 @@ AcpiExDumpNamespaceNode ( } } - AcpiOsPrintf ("%20s : %4.4s\n", "Name", AcpiUtGetNodeName (Node)); - AcpiExOutString ("Type", AcpiUtGetTypeName (Node->Type)); - AcpiExOutPointer ("Attached Object", AcpiNsGetAttachedObject (Node)); - AcpiExOutPointer ("Parent", AcpiNsGetParentNode (Node)); + AcpiOsPrintf ("%20s : %4.4s\n", "Name", AcpiUtGetNodeName (Node)); + AcpiExOutString ("Type", AcpiUtGetTypeName (Node->Type)); + AcpiExOutPointer ("Attached Object", AcpiNsGetAttachedObject (Node)); + AcpiExOutPointer ("Parent", AcpiNsGetParentNode (Node)); AcpiExDumpObject (ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Node), AcpiExDumpNode); @@ -1017,14 +975,14 @@ AcpiExDumpReferenceObj ( RetBuf.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - if (ObjDesc->Reference.Opcode == AML_INT_NAMEPATH_OP) + if (ObjDesc->Reference.Class == ACPI_REFCLASS_NAME) { - AcpiOsPrintf ("Named Object %p ", ObjDesc->Reference.Node); + AcpiOsPrintf (" %p ", ObjDesc->Reference.Node); Status = AcpiNsHandleToPathname (ObjDesc->Reference.Node, &RetBuf); if (ACPI_FAILURE (Status)) { - AcpiOsPrintf ("Could not convert name to pathname\n"); + AcpiOsPrintf (" Could not convert name to pathname\n"); } else { @@ -1034,7 +992,24 @@ AcpiExDumpReferenceObj ( } else if (ObjDesc->Reference.Object) { - AcpiOsPrintf ("\nReferenced Object: %p\n", ObjDesc->Reference.Object); + if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND) + { + AcpiOsPrintf (" Target: %p", ObjDesc->Reference.Object); + if (ObjDesc->Reference.Class == ACPI_REFCLASS_TABLE) + { + AcpiOsPrintf (" Table Index: %X\n", ObjDesc->Reference.Value); + } + else + { + AcpiOsPrintf (" Target: %p [%s]\n", ObjDesc->Reference.Object, + AcpiUtGetTypeName (((ACPI_OPERAND_OBJECT *) + ObjDesc->Reference.Object)->Common.Type)); + } + } + else + { + AcpiOsPrintf (" Target: %p\n", ObjDesc->Reference.Object); + } } } @@ -1084,12 +1059,12 @@ AcpiExDumpPackageObj ( /* Packages may only contain a few object types */ - switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) + switch (ObjDesc->Common.Type) { case ACPI_TYPE_INTEGER: AcpiOsPrintf ("[Integer] = %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); + ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); break; @@ -1110,7 +1085,7 @@ AcpiExDumpPackageObj ( if (ObjDesc->Buffer.Length) { AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, ObjDesc->Buffer.Pointer), - ObjDesc->Buffer.Length, DB_DWORD_DISPLAY, _COMPONENT); + ObjDesc->Buffer.Length, DB_DWORD_DISPLAY, _COMPONENT); } else { @@ -1122,7 +1097,7 @@ AcpiExDumpPackageObj ( case ACPI_TYPE_PACKAGE: AcpiOsPrintf ("[Package] Contains %d Elements:\n", - ObjDesc->Package.Count); + ObjDesc->Package.Count); for (i = 0; i < ObjDesc->Package.Count; i++) { @@ -1133,14 +1108,16 @@ AcpiExDumpPackageObj ( case ACPI_TYPE_LOCAL_REFERENCE: - AcpiOsPrintf ("[Object Reference] "); + AcpiOsPrintf ("[Object Reference] Type [%s] %2.2X", + AcpiUtGetReferenceName (ObjDesc), + ObjDesc->Reference.Class); AcpiExDumpReferenceObj (ObjDesc); break; default: - AcpiOsPrintf ("[Unknown Type] %X\n", ACPI_GET_OBJECT_TYPE (ObjDesc)); + AcpiOsPrintf ("[Unknown Type] %X\n", ObjDesc->Common.Type); break; } } diff --git a/sys/contrib/dev/acpica/exfield.c b/sys/contrib/dev/acpica/executer/exfield.c index c4cbf23adc55..0065bb51840f 100644 --- a/sys/contrib/dev/acpica/exfield.c +++ b/sys/contrib/dev/acpica/executer/exfield.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: exfield - ACPI AML (p-code) execution - field manipulation - * $Revision: 1.131 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,9 +116,10 @@ #define __EXFIELD_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acdispat.h> -#include <contrib/dev/acpica/acinterp.h> +#include "acpi.h" +#include "accommon.h" +#include "acdispat.h" +#include "acinterp.h" #define _COMPONENT ACPI_EXECUTER @@ -167,7 +167,7 @@ AcpiExReadDataFromField ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_BUFFER_FIELD) + if (ObjDesc->Common.Type == ACPI_TYPE_BUFFER_FIELD) { /* * If the BufferField arguments have not been previously evaluated, @@ -182,7 +182,7 @@ AcpiExReadDataFromField ( } } } - else if ((ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_LOCAL_REGION_FIELD) && + else if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REGION_FIELD) && (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS)) { /* @@ -249,7 +249,7 @@ AcpiExReadDataFromField ( ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "FieldRead [TO]: Obj %p, Type %X, Buf %p, ByteLen %X\n", - ObjDesc, ACPI_GET_OBJECT_TYPE (ObjDesc), Buffer, (UINT32) Length)); + ObjDesc, ObjDesc->Common.Type, Buffer, (UINT32) Length)); ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "FieldRead [FROM]: BitLen %X, BitOff %X, ByteOff %X\n", ObjDesc->CommonField.BitLength, @@ -302,9 +302,7 @@ AcpiExWriteDataToField ( { ACPI_STATUS Status; UINT32 Length; - UINT32 RequiredLength; void *Buffer; - void *NewBuffer; ACPI_OPERAND_OBJECT *BufferDesc; @@ -318,7 +316,7 @@ AcpiExWriteDataToField ( return_ACPI_STATUS (AE_AML_NO_OPERAND); } - if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_BUFFER_FIELD) + if (ObjDesc->Common.Type == ACPI_TYPE_BUFFER_FIELD) { /* * If the BufferField arguments have not been previously evaluated, @@ -333,7 +331,7 @@ AcpiExWriteDataToField ( } } } - else if ((ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_LOCAL_REGION_FIELD) && + else if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REGION_FIELD) && (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS)) { /* @@ -342,7 +340,7 @@ AcpiExWriteDataToField ( * * Source must be a buffer of sufficient size (ACPI_SMBUS_BUFFER_SIZE). */ - if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_BUFFER) + if (SourceDesc->Common.Type != ACPI_TYPE_BUFFER) { ACPI_ERROR ((AE_INFO, "SMBus write requires Buffer, found type %s", AcpiUtGetObjectTypeName (SourceDesc))); @@ -389,7 +387,7 @@ AcpiExWriteDataToField ( /* Get a pointer to the data to be written */ - switch (ACPI_GET_OBJECT_TYPE (SourceDesc)) + switch (SourceDesc->Common.Type) { case ACPI_TYPE_INTEGER: Buffer = &SourceDesc->Integer.Value; @@ -410,45 +408,15 @@ AcpiExWriteDataToField ( return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } - /* - * We must have a buffer that is at least as long as the field - * we are writing to. This is because individual fields are - * indivisible and partial writes are not supported -- as per - * the ACPI specification. - */ - NewBuffer = NULL; - RequiredLength = ACPI_ROUND_BITS_UP_TO_BYTES ( - ObjDesc->CommonField.BitLength); - - if (Length < RequiredLength) - { - /* We need to create a new buffer */ - - NewBuffer = ACPI_ALLOCATE_ZEROED (RequiredLength); - if (!NewBuffer) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* - * Copy the original data to the new buffer, starting - * at Byte zero. All unused (upper) bytes of the - * buffer will be 0. - */ - ACPI_MEMCPY ((char *) NewBuffer, (char *) Buffer, Length); - Buffer = NewBuffer; - Length = RequiredLength; - } - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "FieldWrite [FROM]: Obj %p (%s:%X), Buf %p, ByteLen %X\n", - SourceDesc, AcpiUtGetTypeName (ACPI_GET_OBJECT_TYPE (SourceDesc)), - ACPI_GET_OBJECT_TYPE (SourceDesc), Buffer, Length)); + SourceDesc, AcpiUtGetTypeName (SourceDesc->Common.Type), + SourceDesc->Common.Type, Buffer, Length)); ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "FieldWrite [TO]: Obj %p (%s:%X), BitLen %X, BitOff %X, ByteOff %X\n", - ObjDesc, AcpiUtGetTypeName (ACPI_GET_OBJECT_TYPE (ObjDesc)), - ACPI_GET_OBJECT_TYPE (ObjDesc), + ObjDesc, AcpiUtGetTypeName (ObjDesc->Common.Type), + ObjDesc->Common.Type, ObjDesc->CommonField.BitLength, ObjDesc->CommonField.StartFieldBitOffset, ObjDesc->CommonField.BaseByteOffset)); @@ -462,13 +430,6 @@ AcpiExWriteDataToField ( Status = AcpiExInsertIntoField (ObjDesc, Buffer, Length); AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); - /* Free temporary buffer if we used one */ - - if (NewBuffer) - { - ACPI_FREE (NewBuffer); - } - return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/exfldio.c b/sys/contrib/dev/acpica/executer/exfldio.c index 1a8631bfafb9..cfb02213aa9c 100644 --- a/sys/contrib/dev/acpica/exfldio.c +++ b/sys/contrib/dev/acpica/executer/exfldio.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: exfldio - Aml Field I/O - * $Revision: 1.128 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,11 +116,12 @@ #define __EXFLDIO_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acinterp.h> -#include <contrib/dev/acpica/amlcode.h> -#include <contrib/dev/acpica/acevents.h> -#include <contrib/dev/acpica/acdispat.h> +#include "acpi.h" +#include "accommon.h" +#include "acinterp.h" +#include "amlcode.h" +#include "acevents.h" +#include "acdispat.h" #define _COMPONENT ACPI_EXECUTER @@ -179,10 +179,10 @@ AcpiExSetupRegion ( /* We must have a valid region */ - if (ACPI_GET_OBJECT_TYPE (RgnDesc) != ACPI_TYPE_REGION) + if (RgnDesc->Common.Type != ACPI_TYPE_REGION) { ACPI_ERROR ((AE_INFO, "Needed Region, found type %X (%s)", - ACPI_GET_OBJECT_TYPE (RgnDesc), + RgnDesc->Common.Type, AcpiUtGetObjectTypeName (RgnDesc))); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); @@ -201,13 +201,6 @@ AcpiExSetupRegion ( } } - /* Exit if Address/Length have been disallowed by the host OS */ - - if (RgnDesc->Common.Flags & AOPOBJ_INVALID) - { - return_ACPI_STATUS (AE_AML_ILLEGAL_ADDRESS); - } - /* * Exit now for SMBus address space, it has a non-linear address space * and the request cannot be directly validated @@ -248,13 +241,13 @@ AcpiExSetupRegion ( /* * Slack mode only: We will go ahead and allow access to this * field if it is within the region length rounded up to the next - * access width boundary. + * access width boundary. ACPI_SIZE cast for 64-bit compile. */ if (ACPI_ROUND_UP (RgnDesc->Region.Length, ObjDesc->CommonField.AccessByteWidth) >= - (ObjDesc->CommonField.BaseByteOffset + - (ACPI_NATIVE_UINT) ObjDesc->CommonField.AccessByteWidth + - FieldDatumByteOffset)) + ((ACPI_SIZE) ObjDesc->CommonField.BaseByteOffset + + ObjDesc->CommonField.AccessByteWidth + + FieldDatumByteOffset)) { return_ACPI_STATUS (AE_OK); } @@ -321,7 +314,7 @@ AcpiExAccessRegion ( { ACPI_STATUS Status; ACPI_OPERAND_OBJECT *RgnDesc; - ACPI_PHYSICAL_ADDRESS Address; + UINT32 RegionOffset; ACPI_FUNCTION_TRACE (ExAccessRegion); @@ -345,9 +338,9 @@ AcpiExAccessRegion ( * 3) The current offset into the field */ RgnDesc = ObjDesc->CommonField.RegionObj; - Address = RgnDesc->Region.Address + - ObjDesc->CommonField.BaseByteOffset + - FieldDatumByteOffset; + RegionOffset = + ObjDesc->CommonField.BaseByteOffset + + FieldDatumByteOffset; if ((Function & ACPI_IO_MASK) == ACPI_READ) { @@ -365,12 +358,11 @@ AcpiExAccessRegion ( ObjDesc->CommonField.AccessByteWidth, ObjDesc->CommonField.BaseByteOffset, FieldDatumByteOffset, - (void *) Address)); + ACPI_CAST_PTR (void, (RgnDesc->Region.Address + RegionOffset)))); /* Invoke the appropriate AddressSpace/OpRegion handler */ - Status = AcpiEvAddressSpaceDispatch (RgnDesc, Function, - Address, + Status = AcpiEvAddressSpaceDispatch (RgnDesc, Function, RegionOffset, ACPI_MUL_8 (ObjDesc->CommonField.AccessByteWidth), Value); if (ACPI_FAILURE (Status)) @@ -499,7 +491,7 @@ AcpiExFieldDatumIo ( * IndexField - Write to an Index Register, then read/write from/to a * Data Register */ - switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) + switch (ObjDesc->Common.Type) { case ACPI_TYPE_BUFFER_FIELD: /* @@ -614,13 +606,13 @@ AcpiExFieldDatumIo ( return_ACPI_STATUS (Status); } - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "I/O to Data Register: ValuePtr %p\n", Value)); - if (ReadWrite == ACPI_READ) { /* Read the datum from the DataRegister */ + ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, + "Read from Data Register\n")); + Status = AcpiExExtractFromField (ObjDesc->IndexField.DataObj, Value, sizeof (ACPI_INTEGER)); } @@ -628,6 +620,10 @@ AcpiExFieldDatumIo ( { /* Write the datum to the DataRegister */ + ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, + "Write to Data Register: Value %8.8X%8.8X\n", + ACPI_FORMAT_UINT64 (*Value))); + Status = AcpiExInsertIntoField (ObjDesc->IndexField.DataObj, Value, sizeof (ACPI_INTEGER)); } @@ -637,7 +633,7 @@ AcpiExFieldDatumIo ( default: ACPI_ERROR ((AE_INFO, "Wrong object type in field I/O %X", - ACPI_GET_OBJECT_TYPE (ObjDesc))); + ObjDesc->Common.Type)); Status = AE_AML_INTERNAL; break; } @@ -930,6 +926,8 @@ AcpiExInsertIntoField ( UINT32 DatumCount; UINT32 FieldDatumCount; UINT32 i; + UINT32 RequiredLength; + void *NewBuffer; ACPI_FUNCTION_TRACE (ExInsertIntoField); @@ -937,14 +935,33 @@ AcpiExInsertIntoField ( /* Validate input buffer */ - if (BufferLength < - ACPI_ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength)) + NewBuffer = NULL; + RequiredLength = ACPI_ROUND_BITS_UP_TO_BYTES ( + ObjDesc->CommonField.BitLength); + /* + * We must have a buffer that is at least as long as the field + * we are writing to. This is because individual fields are + * indivisible and partial writes are not supported -- as per + * the ACPI specification. + */ + if (BufferLength < RequiredLength) { - ACPI_ERROR ((AE_INFO, - "Field size %X (bits) is too large for buffer (%X)", - ObjDesc->CommonField.BitLength, BufferLength)); + /* We need to create a new buffer */ - return_ACPI_STATUS (AE_BUFFER_OVERFLOW); + NewBuffer = ACPI_ALLOCATE_ZEROED (RequiredLength); + if (!NewBuffer) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + + /* + * Copy the original data to the new buffer, starting + * at Byte zero. All unused (upper) bytes of the + * buffer will be 0. + */ + ACPI_MEMCPY ((char *) NewBuffer, (char *) Buffer, BufferLength); + Buffer = NewBuffer; + BufferLength = RequiredLength; } /* @@ -992,7 +1009,7 @@ AcpiExInsertIntoField ( MergedDatum, FieldOffset); if (ACPI_FAILURE (Status)) { - return_ACPI_STATUS (Status); + goto Exit; } FieldOffset += ObjDesc->CommonField.AccessByteWidth; @@ -1050,6 +1067,13 @@ AcpiExInsertIntoField ( Status = AcpiExWriteWithUpdateRule (ObjDesc, Mask, MergedDatum, FieldOffset); +Exit: + /* Free temporary buffer if we used one */ + + if (NewBuffer) + { + ACPI_FREE (NewBuffer); + } return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/exmisc.c b/sys/contrib/dev/acpica/executer/exmisc.c index 11dd35af5965..41e4a9752ecb 100644 --- a/sys/contrib/dev/acpica/exmisc.c +++ b/sys/contrib/dev/acpica/executer/exmisc.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: exmisc - ACPI AML (p-code) execution - specific opcodes - * $Revision: 1.144 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -118,10 +117,11 @@ #define __EXMISC_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acinterp.h> -#include <contrib/dev/acpica/amlcode.h> -#include <contrib/dev/acpica/amlresrc.h> +#include "acpi.h" +#include "accommon.h" +#include "acinterp.h" +#include "amlcode.h" +#include "amlresrc.h" #define _COMPONENT ACPI_EXECUTER @@ -162,7 +162,7 @@ AcpiExGetObjectReference ( { case ACPI_DESC_TYPE_OPERAND: - if (ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_LOCAL_REFERENCE) + if (ObjDesc->Common.Type != ACPI_TYPE_LOCAL_REFERENCE) { return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } @@ -170,11 +170,11 @@ AcpiExGetObjectReference ( /* * Must be a reference to a Local or Arg */ - switch (ObjDesc->Reference.Opcode) + switch (ObjDesc->Reference.Class) { - case AML_LOCAL_OP: - case AML_ARG_OP: - case AML_DEBUG_OP: + case ACPI_REFCLASS_LOCAL: + case ACPI_REFCLASS_ARG: + case ACPI_REFCLASS_DEBUG: /* The referenced object is the pseudo-node for the local/arg */ @@ -183,8 +183,8 @@ AcpiExGetObjectReference ( default: - ACPI_ERROR ((AE_INFO, "Unknown Reference opcode %X", - ObjDesc->Reference.Opcode)); + ACPI_ERROR ((AE_INFO, "Unknown Reference Class %2.2X", + ObjDesc->Reference.Class)); return_ACPI_STATUS (AE_AML_INTERNAL); } break; @@ -215,7 +215,7 @@ AcpiExGetObjectReference ( return_ACPI_STATUS (AE_NO_MEMORY); } - ReferenceObj->Reference.Opcode = AML_REF_OF_OP; + ReferenceObj->Reference.Class = ACPI_REFCLASS_REFOF; ReferenceObj->Reference.Object = ReferencedObj; *ReturnDesc = ReferenceObj; @@ -357,7 +357,7 @@ AcpiExDoConcatenate ( * guaranteed to be either Integer/String/Buffer by the operand * resolution mechanism. */ - switch (ACPI_GET_OBJECT_TYPE (Operand0)) + switch (Operand0->Common.Type) { case ACPI_TYPE_INTEGER: Status = AcpiExConvertToInteger (Operand1, &LocalOperand1, 16); @@ -374,7 +374,7 @@ AcpiExDoConcatenate ( default: ACPI_ERROR ((AE_INFO, "Invalid object type: %X", - ACPI_GET_OBJECT_TYPE (Operand0))); + Operand0->Common.Type)); Status = AE_AML_INTERNAL; } @@ -396,7 +396,7 @@ AcpiExDoConcatenate ( * 2) Two Strings concatenated to produce a new String * 3) Two Buffers concatenated to produce a new Buffer */ - switch (ACPI_GET_OBJECT_TYPE (Operand0)) + switch (Operand0->Common.Type) { case ACPI_TYPE_INTEGER: @@ -429,8 +429,8 @@ AcpiExDoConcatenate ( /* Result of two Strings is a String */ - ReturnDesc = AcpiUtCreateStringObject ((ACPI_SIZE) - (Operand0->String.Length + + ReturnDesc = AcpiUtCreateStringObject ( + ((ACPI_SIZE) Operand0->String.Length + LocalOperand1->String.Length)); if (!ReturnDesc) { @@ -451,8 +451,8 @@ AcpiExDoConcatenate ( /* Result of two Buffers is a Buffer */ - ReturnDesc = AcpiUtCreateBufferObject ((ACPI_SIZE) - (Operand0->Buffer.Length + + ReturnDesc = AcpiUtCreateBufferObject ( + ((ACPI_SIZE) Operand0->Buffer.Length + LocalOperand1->Buffer.Length)); if (!ReturnDesc) { @@ -476,7 +476,7 @@ AcpiExDoConcatenate ( /* Invalid object type, should not happen here */ ACPI_ERROR ((AE_INFO, "Invalid object type: %X", - ACPI_GET_OBJECT_TYPE (Operand0))); + Operand0->Common.Type)); Status =AE_AML_INTERNAL; goto Cleanup; } @@ -709,7 +709,7 @@ AcpiExDoLogicalOp ( * guaranteed to be either Integer/String/Buffer by the operand * resolution mechanism. */ - switch (ACPI_GET_OBJECT_TYPE (Operand0)) + switch (Operand0->Common.Type) { case ACPI_TYPE_INTEGER: Status = AcpiExConvertToInteger (Operand1, &LocalOperand1, 16); @@ -737,7 +737,7 @@ AcpiExDoLogicalOp ( /* * Two cases: 1) Both Integers, 2) Both Strings or Buffers */ - if (ACPI_GET_OBJECT_TYPE (Operand0) == ACPI_TYPE_INTEGER) + if (Operand0->Common.Type == ACPI_TYPE_INTEGER) { /* * 1) Both operands are of type integer diff --git a/sys/contrib/dev/acpica/exmutex.c b/sys/contrib/dev/acpica/executer/exmutex.c index e1925ece057f..db5ab9e77a33 100644 --- a/sys/contrib/dev/acpica/exmutex.c +++ b/sys/contrib/dev/acpica/executer/exmutex.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: exmutex - ASL Mutex Acquire/Release functions - * $Revision: 1.40 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,9 +116,10 @@ #define __EXMUTEX_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acinterp.h> -#include <contrib/dev/acpica/acevents.h> +#include "acpi.h" +#include "accommon.h" +#include "acinterp.h" +#include "acevents.h" #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME ("exmutex") @@ -166,6 +166,15 @@ AcpiExUnlinkMutex ( if (ObjDesc->Mutex.Prev) { (ObjDesc->Mutex.Prev)->Mutex.Next = ObjDesc->Mutex.Next; + + /* + * Migrate the previous sync level associated with this mutex to the + * previous mutex on the list so that it may be preserved. This handles + * the case where several mutexes have been acquired at the same level, + * but are not released in opposite order. + */ + (ObjDesc->Mutex.Prev)->Mutex.OriginalSyncLevel = + ObjDesc->Mutex.OriginalSyncLevel; } else { @@ -461,6 +470,7 @@ AcpiExReleaseMutex ( ACPI_WALK_STATE *WalkState) { ACPI_STATUS Status = AE_OK; + UINT8 PreviousSyncLevel; ACPI_FUNCTION_TRACE (ExReleaseMutex); @@ -488,10 +498,10 @@ AcpiExReleaseMutex ( (ObjDesc != AcpiGbl_GlobalLockMutex)) { ACPI_ERROR ((AE_INFO, - "Thread %X cannot release Mutex [%4.4s] acquired by thread %X", - WalkState->Thread->ThreadId, + "Thread %p cannot release Mutex [%4.4s] acquired by thread %p", + ACPI_CAST_PTR (void, WalkState->Thread->ThreadId), AcpiUtGetNodeName (ObjDesc->Mutex.Node), - ObjDesc->Mutex.OwnerThread->ThreadId)); + ACPI_CAST_PTR (void, ObjDesc->Mutex.OwnerThread->ThreadId))); return_ACPI_STATUS (AE_AML_NOT_OWNER); } @@ -505,10 +515,13 @@ AcpiExReleaseMutex ( } /* - * The sync level of the mutex must be less than or equal to the current - * sync level + * 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 + * level is currently being held. Attempting to release a mutex of a + * different level can only mean that the mutex ordering rule is being + * violated. This behavior is clarified in ACPI 4.0 specification. */ - if (ObjDesc->Mutex.SyncLevel > WalkState->Thread->CurrentSyncLevel) + if (ObjDesc->Mutex.SyncLevel != WalkState->Thread->CurrentSyncLevel) { ACPI_ERROR ((AE_INFO, "Cannot release Mutex [%4.4s], SyncLevel mismatch: mutex %d current %d", @@ -517,13 +530,25 @@ AcpiExReleaseMutex ( return_ACPI_STATUS (AE_AML_MUTEX_ORDER); } + /* + * Get the previous SyncLevel from the head of the acquired mutex list. + * This handles the case where several mutexes at the same level have been + * acquired, but are not released in reverse order. + */ + PreviousSyncLevel = + WalkState->Thread->AcquiredMutexList->Mutex.OriginalSyncLevel; + Status = AcpiExReleaseMutexObject (ObjDesc); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } if (ObjDesc->Mutex.AcquisitionDepth == 0) { - /* Restore the original SyncLevel */ + /* Restore the previous SyncLevel */ - WalkState->Thread->CurrentSyncLevel = ObjDesc->Mutex.OriginalSyncLevel; + WalkState->Thread->CurrentSyncLevel = PreviousSyncLevel; } return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/exnames.c b/sys/contrib/dev/acpica/executer/exnames.c index 1304adb37631..89fa2d4874d6 100644 --- a/sys/contrib/dev/acpica/exnames.c +++ b/sys/contrib/dev/acpica/executer/exnames.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: exnames - interpreter/scanner name load/execute - * $Revision: 1.111 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,9 +116,10 @@ #define __EXNAMES_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acinterp.h> -#include <contrib/dev/acpica/amlcode.h> +#include "acpi.h" +#include "accommon.h" +#include "acinterp.h" +#include "amlcode.h" #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME ("exnames") diff --git a/sys/contrib/dev/acpica/exoparg1.c b/sys/contrib/dev/acpica/executer/exoparg1.c index 51f34afdabb5..70085693ba49 100644 --- a/sys/contrib/dev/acpica/exoparg1.c +++ b/sys/contrib/dev/acpica/executer/exoparg1.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: exoparg1 - AML execution - opcodes with 1 argument - * $Revision: 1.184 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,12 +116,13 @@ #define __EXOPARG1_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acparser.h> -#include <contrib/dev/acpica/acdispat.h> -#include <contrib/dev/acpica/acinterp.h> -#include <contrib/dev/acpica/amlcode.h> -#include <contrib/dev/acpica/acnamesp.h> +#include "acpi.h" +#include "accommon.h" +#include "acparser.h" +#include "acdispat.h" +#include "acinterp.h" +#include "amlcode.h" +#include "acnamesp.h" #define _COMPONENT ACPI_EXECUTER @@ -880,26 +880,39 @@ AcpiExOpcode_1A_0T_1R ( Value = AcpiGbl_IntegerByteWidth; break; - case ACPI_TYPE_BUFFER: - Value = TempDesc->Buffer.Length; - break; - case ACPI_TYPE_STRING: Value = TempDesc->String.Length; break; + case ACPI_TYPE_BUFFER: + + /* Buffer arguments may not be evaluated at this point */ + + Status = AcpiDsGetBufferArguments (TempDesc); + Value = TempDesc->Buffer.Length; + break; + case ACPI_TYPE_PACKAGE: + + /* Package arguments may not be evaluated at this point */ + + Status = AcpiDsGetPackageArguments (TempDesc); Value = TempDesc->Package.Count; break; default: ACPI_ERROR ((AE_INFO, - "Operand is not Buf/Int/Str/Pkg - found type %s", + "Operand must be Buffer/Integer/String/Package - found type %s", AcpiUtGetTypeName (Type))); Status = AE_AML_OPERAND_TYPE; goto Cleanup; } + if (ACPI_FAILURE (Status)) + { + goto Cleanup; + } + /* * Now that we have the size of the object, create a result * object to hold the value @@ -934,8 +947,8 @@ AcpiExOpcode_1A_0T_1R ( TempDesc = AcpiNsGetAttachedObject ( (ACPI_NAMESPACE_NODE *) Operand[0]); if (TempDesc && - ((ACPI_GET_OBJECT_TYPE (TempDesc) == ACPI_TYPE_STRING) || - (ACPI_GET_OBJECT_TYPE (TempDesc) == ACPI_TYPE_LOCAL_REFERENCE))) + ((TempDesc->Common.Type == ACPI_TYPE_STRING) || + (TempDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE))) { Operand[0] = TempDesc; AcpiUtAddReference (TempDesc); @@ -948,7 +961,7 @@ AcpiExOpcode_1A_0T_1R ( } else { - switch (ACPI_GET_OBJECT_TYPE (Operand[0])) + switch ((Operand[0])->Common.Type) { case ACPI_TYPE_LOCAL_REFERENCE: /* @@ -956,16 +969,16 @@ AcpiExOpcode_1A_0T_1R ( * * Must resolve/dereference the local/arg reference first */ - switch (Operand[0]->Reference.Opcode) + switch (Operand[0]->Reference.Class) { - case AML_LOCAL_OP: - case AML_ARG_OP: + case ACPI_REFCLASS_LOCAL: + case ACPI_REFCLASS_ARG: /* Set Operand[0] to the value of the local/arg */ Status = AcpiDsMethodDataGetValue ( - Operand[0]->Reference.Opcode, - Operand[0]->Reference.Offset, + Operand[0]->Reference.Class, + Operand[0]->Reference.Value, WalkState, &TempDesc); if (ACPI_FAILURE (Status)) { @@ -980,7 +993,7 @@ AcpiExOpcode_1A_0T_1R ( Operand[0] = TempDesc; break; - case AML_REF_OF_OP: + case ACPI_REFCLASS_REFOF: /* Get the object to which the reference refers */ @@ -1007,7 +1020,7 @@ AcpiExOpcode_1A_0T_1R ( if (ACPI_GET_DESCRIPTOR_TYPE (Operand[0]) != ACPI_DESC_TYPE_NAMED) { - if (ACPI_GET_OBJECT_TYPE (Operand[0]) == ACPI_TYPE_STRING) + if ((Operand[0])->Common.Type == ACPI_TYPE_STRING) { /* * This is a DerefOf (String). The string is a reference @@ -1055,9 +1068,9 @@ AcpiExOpcode_1A_0T_1R ( * This must be a reference object produced by either the * Index() or RefOf() operator */ - switch (Operand[0]->Reference.Opcode) + switch (Operand[0]->Reference.Class) { - case AML_INDEX_OP: + case ACPI_REFCLASS_INDEX: /* * The target type for the Index operator must be @@ -1090,7 +1103,7 @@ AcpiExOpcode_1A_0T_1R ( * reference to the buffer itself. */ ReturnDesc->Integer.Value = - TempDesc->Buffer.Pointer[Operand[0]->Reference.Offset]; + TempDesc->Buffer.Pointer[Operand[0]->Reference.Value]; break; @@ -1111,7 +1124,7 @@ AcpiExOpcode_1A_0T_1R ( default: ACPI_ERROR ((AE_INFO, - "Unknown Index TargetType %X in obj %p", + "Unknown Index TargetType %X in reference object %p", Operand[0]->Reference.TargetType, Operand[0])); Status = AE_AML_OPERAND_TYPE; goto Cleanup; @@ -1119,7 +1132,7 @@ AcpiExOpcode_1A_0T_1R ( break; - case AML_REF_OF_OP: + case ACPI_REFCLASS_REFOF: ReturnDesc = Operand[0]->Reference.Object; @@ -1138,8 +1151,8 @@ AcpiExOpcode_1A_0T_1R ( default: ACPI_ERROR ((AE_INFO, - "Unknown opcode in reference(%p) - %X", - Operand[0], Operand[0]->Reference.Opcode)); + "Unknown class in reference(%p) - %2.2X", + Operand[0], Operand[0]->Reference.Class)); Status = AE_TYPE; goto Cleanup; diff --git a/sys/contrib/dev/acpica/exoparg2.c b/sys/contrib/dev/acpica/executer/exoparg2.c index f7f05e44fbe2..7c42652cc4cb 100644 --- a/sys/contrib/dev/acpica/exoparg2.c +++ b/sys/contrib/dev/acpica/executer/exoparg2.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: exoparg2 - AML execution - opcodes with 2 arguments - * $Revision: 1.143 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,11 +116,12 @@ #define __EXOPARG2_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acparser.h> -#include <contrib/dev/acpica/acinterp.h> -#include <contrib/dev/acpica/acevents.h> -#include <contrib/dev/acpica/amlcode.h> +#include "acpi.h" +#include "accommon.h" +#include "acparser.h" +#include "acinterp.h" +#include "acevents.h" +#include "amlcode.h" #define _COMPONENT ACPI_EXECUTER @@ -504,14 +504,14 @@ AcpiExOpcode_2A_1T_1R ( /* Initialize the Index reference object */ Index = Operand[1]->Integer.Value; - ReturnDesc->Reference.Offset = (UINT32) Index; - ReturnDesc->Reference.Opcode = AML_INDEX_OP; + ReturnDesc->Reference.Value = (UINT32) Index; + ReturnDesc->Reference.Class = ACPI_REFCLASS_INDEX; /* * At this point, the Source operand is a String, Buffer, or Package. * Verify that the index is within range. */ - switch (ACPI_GET_OBJECT_TYPE (Operand[0])) + switch ((Operand[0])->Common.Type) { case ACPI_TYPE_STRING: diff --git a/sys/contrib/dev/acpica/exoparg3.c b/sys/contrib/dev/acpica/executer/exoparg3.c index 926e22a61d0a..591d6aceb121 100644 --- a/sys/contrib/dev/acpica/exoparg3.c +++ b/sys/contrib/dev/acpica/executer/exoparg3.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: exoparg3 - AML execution - opcodes with 3 arguments - * $Revision: 1.35 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -118,10 +117,11 @@ #define __EXOPARG3_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acinterp.h> -#include <contrib/dev/acpica/acparser.h> -#include <contrib/dev/acpica/amlcode.h> +#include "acpi.h" +#include "accommon.h" +#include "acinterp.h" +#include "acparser.h" +#include "amlcode.h" #define _COMPONENT ACPI_EXECUTER @@ -256,7 +256,7 @@ AcpiExOpcode_3A_1T_1R ( * either a String or a Buffer, so just use its type. */ ReturnDesc = AcpiUtCreateInternalObject ( - ACPI_GET_OBJECT_TYPE (Operand[0])); + (Operand[0])->Common.Type); if (!ReturnDesc) { Status = AE_NO_MEMORY; @@ -287,7 +287,7 @@ AcpiExOpcode_3A_1T_1R ( /* Strings always have a sub-pointer, not so for buffers */ - switch (ACPI_GET_OBJECT_TYPE (Operand[0])) + switch ((Operand[0])->Common.Type) { case ACPI_TYPE_STRING: diff --git a/sys/contrib/dev/acpica/exoparg6.c b/sys/contrib/dev/acpica/executer/exoparg6.c index e144bcf63fae..96c16a33bd08 100644 --- a/sys/contrib/dev/acpica/exoparg6.c +++ b/sys/contrib/dev/acpica/executer/exoparg6.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: exoparg6 - AML execution - opcodes with 6 arguments - * $Revision: 1.29 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -118,10 +117,11 @@ #define __EXOPARG6_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acinterp.h> -#include <contrib/dev/acpica/acparser.h> -#include <contrib/dev/acpica/amlcode.h> +#include "acpi.h" +#include "accommon.h" +#include "acinterp.h" +#include "acparser.h" +#include "amlcode.h" #define _COMPONENT ACPI_EXECUTER diff --git a/sys/contrib/dev/acpica/exprep.c b/sys/contrib/dev/acpica/executer/exprep.c index b67db318d070..c915361e810d 100644 --- a/sys/contrib/dev/acpica/exprep.c +++ b/sys/contrib/dev/acpica/executer/exprep.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: exprep - ACPI AML (p-code) execution - field prep utilities - * $Revision: 1.142 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,10 +116,11 @@ #define __EXPREP_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acinterp.h> -#include <contrib/dev/acpica/amlcode.h> -#include <contrib/dev/acpica/acnamesp.h> +#include "acpi.h" +#include "accommon.h" +#include "acinterp.h" +#include "amlcode.h" +#include "acnamesp.h" #define _COMPONENT ACPI_EXECUTER @@ -367,7 +367,7 @@ AcpiExDecodeFieldAccess ( return_UINT32 (0); } - if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_BUFFER_FIELD) + if (ObjDesc->Common.Type == ACPI_TYPE_BUFFER_FIELD) { /* * BufferField access can be on any byte boundary, so the @@ -511,6 +511,7 @@ AcpiExPrepFieldValue ( ACPI_CREATE_FIELD_INFO *Info) { ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_OPERAND_OBJECT *SecondDesc = NULL; UINT32 Type; ACPI_STATUS Status; @@ -597,6 +598,16 @@ AcpiExPrepFieldValue ( ObjDesc->Field.AccessByteWidth, ObjDesc->BankField.RegionObj, ObjDesc->BankField.BankObj)); + + /* + * Remember location in AML stream of the field unit + * opcode and operands -- since the BankValue + * operands must be evaluated. + */ + SecondDesc = ObjDesc->Common.NextObject; + SecondDesc->Extra.AmlStart = ACPI_CAST_PTR (ACPI_PARSE_OBJECT, Info->DataRegisterNode)->Named.Data; + SecondDesc->Extra.AmlLength = ACPI_CAST_PTR (ACPI_PARSE_OBJECT, Info->DataRegisterNode)->Named.Length; + break; diff --git a/sys/contrib/dev/acpica/exregion.c b/sys/contrib/dev/acpica/executer/exregion.c index 184ef7d1e188..958dc4e06705 100644 --- a/sys/contrib/dev/acpica/exregion.c +++ b/sys/contrib/dev/acpica/executer/exregion.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: exregion - ACPI default OpRegion (address space) handlers - * $Revision: 1.101 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -118,8 +117,9 @@ #define __EXREGION_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acinterp.h> +#include "acpi.h" +#include "accommon.h" +#include "acinterp.h" #define _COMPONENT ACPI_EXECUTER @@ -240,12 +240,13 @@ AcpiExSystemMemorySpaceHandler ( /* Create a new mapping starting at the address given */ - MemInfo->MappedLogicalAddress = AcpiOsMapMemory ((ACPI_NATIVE_UINT) Address, WindowSize); + MemInfo->MappedLogicalAddress = AcpiOsMapMemory ( + (ACPI_PHYSICAL_ADDRESS) Address, WindowSize); if (!MemInfo->MappedLogicalAddress) { ACPI_ERROR ((AE_INFO, "Could not map memory at %8.8X%8.8X, size %X", - ACPI_FORMAT_UINT64 (Address), (UINT32) WindowSize)); + ACPI_FORMAT_NATIVE_UINT (Address), (UINT32) WindowSize)); MemInfo->MappedLength = 0; return_ACPI_STATUS (AE_NO_MEMORY); } @@ -265,7 +266,7 @@ AcpiExSystemMemorySpaceHandler ( ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "System-Memory (width %d) R/W %d Address=%8.8X%8.8X\n", - BitWidth, Function, ACPI_FORMAT_UINT64 (Address))); + BitWidth, Function, ACPI_FORMAT_NATIVE_UINT (Address))); /* * Perform the memory read or write @@ -375,7 +376,7 @@ AcpiExSystemIoSpaceHandler ( ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "System-IO (width %d) R/W %d Address=%8.8X%8.8X\n", - BitWidth, Function, ACPI_FORMAT_UINT64 (Address))); + BitWidth, Function, ACPI_FORMAT_NATIVE_UINT (Address))); /* Decode the function parameter */ @@ -383,14 +384,14 @@ AcpiExSystemIoSpaceHandler ( { case ACPI_READ: - Status = AcpiOsReadPort ((ACPI_IO_ADDRESS) Address, + Status = AcpiHwReadPort ((ACPI_IO_ADDRESS) Address, &Value32, BitWidth); *Value = Value32; break; case ACPI_WRITE: - Status = AcpiOsWritePort ((ACPI_IO_ADDRESS) Address, + Status = AcpiHwWritePort ((ACPI_IO_ADDRESS) Address, (UINT32) *Value, BitWidth); break; diff --git a/sys/contrib/dev/acpica/exresnte.c b/sys/contrib/dev/acpica/executer/exresnte.c index f5f2e14fa9d6..5481bc899a85 100644 --- a/sys/contrib/dev/acpica/exresnte.c +++ b/sys/contrib/dev/acpica/executer/exresnte.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: exresnte - AML Interpreter object resolution - * $Revision: 1.75 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,12 +116,11 @@ #define __EXRESNTE_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acdispat.h> -#include <contrib/dev/acpica/acinterp.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/acparser.h> -#include <contrib/dev/acpica/amlcode.h> +#include "acpi.h" +#include "accommon.h" +#include "acdispat.h" +#include "acinterp.h" +#include "acnamesp.h" #define _COMPONENT ACPI_EXECUTER @@ -197,9 +195,11 @@ AcpiExResolveNodeToValue ( * Several object types require no further processing: * 1) Device/Thermal objects don't have a "real" subobject, return the Node * 2) Method locals and arguments have a pseudo-Node + * 3) 10/2007: Added method type to assist with Package construction. */ if ((EntryType == ACPI_TYPE_DEVICE) || (EntryType == ACPI_TYPE_THERMAL) || + (EntryType == ACPI_TYPE_METHOD) || (Node->Flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL))) { return_ACPI_STATUS (AE_OK); @@ -220,7 +220,7 @@ AcpiExResolveNodeToValue ( { case ACPI_TYPE_PACKAGE: - if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_PACKAGE) + if (SourceDesc->Common.Type != ACPI_TYPE_PACKAGE) { ACPI_ERROR ((AE_INFO, "Object not a Package, type %s", AcpiUtGetObjectTypeName (SourceDesc))); @@ -240,7 +240,7 @@ AcpiExResolveNodeToValue ( case ACPI_TYPE_BUFFER: - if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_BUFFER) + if (SourceDesc->Common.Type != ACPI_TYPE_BUFFER) { ACPI_ERROR ((AE_INFO, "Object not a Buffer, type %s", AcpiUtGetObjectTypeName (SourceDesc))); @@ -260,7 +260,7 @@ AcpiExResolveNodeToValue ( case ACPI_TYPE_STRING: - if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_STRING) + if (SourceDesc->Common.Type != ACPI_TYPE_STRING) { ACPI_ERROR ((AE_INFO, "Object not a String, type %s", AcpiUtGetObjectTypeName (SourceDesc))); @@ -276,7 +276,7 @@ AcpiExResolveNodeToValue ( case ACPI_TYPE_INTEGER: - if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_INTEGER) + if (SourceDesc->Common.Type != ACPI_TYPE_INTEGER) { ACPI_ERROR ((AE_INFO, "Object not a Integer, type %s", AcpiUtGetObjectTypeName (SourceDesc))); @@ -305,7 +305,6 @@ AcpiExResolveNodeToValue ( /* For these objects, just return the object attached to the Node */ case ACPI_TYPE_MUTEX: - case ACPI_TYPE_METHOD: case ACPI_TYPE_POWER: case ACPI_TYPE_PROCESSOR: case ACPI_TYPE_EVENT: @@ -329,15 +328,14 @@ AcpiExResolveNodeToValue ( case ACPI_TYPE_LOCAL_REFERENCE: - switch (SourceDesc->Reference.Opcode) + switch (SourceDesc->Reference.Class) { - case AML_LOAD_OP: + case ACPI_REFCLASS_TABLE: /* This is a DdbHandle */ + case ACPI_REFCLASS_REFOF: + case ACPI_REFCLASS_INDEX: - /* This is a DdbHandle */ /* Return an additional reference to the object */ - case AML_REF_OF_OP: - ObjDesc = SourceDesc; AcpiUtAddReference (ObjDesc); break; @@ -346,9 +344,8 @@ AcpiExResolveNodeToValue ( /* No named references are allowed here */ ACPI_ERROR ((AE_INFO, - "Unsupported Reference opcode %X (%s)", - SourceDesc->Reference.Opcode, - AcpiPsGetOpcodeName (SourceDesc->Reference.Opcode))); + "Unsupported Reference type %X", + SourceDesc->Reference.Class)); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } diff --git a/sys/contrib/dev/acpica/exresolv.c b/sys/contrib/dev/acpica/executer/exresolv.c index b15e86b0ca23..a3c8ab9b5cee 100644 --- a/sys/contrib/dev/acpica/exresolv.c +++ b/sys/contrib/dev/acpica/executer/exresolv.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: exresolv - AML Interpreter object resolution - * $Revision: 1.142 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,12 +116,12 @@ #define __EXRESOLV_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/amlcode.h> -#include <contrib/dev/acpica/acdispat.h> -#include <contrib/dev/acpica/acinterp.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/acparser.h> +#include "acpi.h" +#include "accommon.h" +#include "amlcode.h" +#include "acdispat.h" +#include "acinterp.h" +#include "acnamesp.h" #define _COMPONENT ACPI_EXECUTER @@ -230,7 +229,7 @@ AcpiExResolveObjectToValue ( ACPI_STATUS Status = AE_OK; ACPI_OPERAND_OBJECT *StackDesc; ACPI_OPERAND_OBJECT *ObjDesc = NULL; - UINT16 Opcode; + UINT8 RefType; ACPI_FUNCTION_TRACE (ExResolveObjectToValue); @@ -240,30 +239,30 @@ AcpiExResolveObjectToValue ( /* This is an ACPI_OPERAND_OBJECT */ - switch (ACPI_GET_OBJECT_TYPE (StackDesc)) + switch (StackDesc->Common.Type) { case ACPI_TYPE_LOCAL_REFERENCE: - Opcode = StackDesc->Reference.Opcode; + RefType = StackDesc->Reference.Class; - switch (Opcode) + switch (RefType) { - case AML_LOCAL_OP: - case AML_ARG_OP: + case ACPI_REFCLASS_LOCAL: + case ACPI_REFCLASS_ARG: /* * Get the local from the method's state info * Note: this increments the local's object reference count */ - Status = AcpiDsMethodDataGetValue (Opcode, - StackDesc->Reference.Offset, WalkState, &ObjDesc); + Status = AcpiDsMethodDataGetValue (RefType, + StackDesc->Reference.Value, WalkState, &ObjDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Arg/Local %X] ValueObj is %p\n", - StackDesc->Reference.Offset, ObjDesc)); + StackDesc->Reference.Value, ObjDesc)); /* * Now we can delete the original Reference Object and @@ -274,23 +273,33 @@ AcpiExResolveObjectToValue ( break; - case AML_INDEX_OP: + case ACPI_REFCLASS_INDEX: switch (StackDesc->Reference.TargetType) { case ACPI_TYPE_BUFFER_FIELD: - /* Just return - leave the Reference on the stack */ + /* Just return - do not dereference */ break; case ACPI_TYPE_PACKAGE: + /* If method call or CopyObject - do not dereference */ + + if ((WalkState->Opcode == AML_INT_METHODCALL_OP) || + (WalkState->Opcode == AML_COPY_OP)) + { + break; + } + + /* Otherwise, dereference the PackageIndex to a package element */ + ObjDesc = *StackDesc->Reference.Where; if (ObjDesc) { /* - * Valid obj descriptor, copy pointer to return value + * Valid object descriptor, copy pointer to return value * (i.e., dereference the package index) * Delete the ref object, increment the returned object */ @@ -301,11 +310,11 @@ AcpiExResolveObjectToValue ( else { /* - * A NULL object descriptor means an unitialized element of + * A NULL object descriptor means an uninitialized element of * the package, can't dereference it */ ACPI_ERROR ((AE_INFO, - "Attempt to deref an Index to NULL pkg element Idx=%p", + "Attempt to dereference an Index to NULL package element Idx=%p", StackDesc)); Status = AE_AML_UNINITIALIZED_ELEMENT; } @@ -317,7 +326,7 @@ AcpiExResolveObjectToValue ( /* Invalid reference object */ ACPI_ERROR ((AE_INFO, - "Unknown TargetType %X in Index/Reference obj %p", + "Unknown TargetType %X in Index/Reference object %p", StackDesc->Reference.TargetType, StackDesc)); Status = AE_AML_INTERNAL; break; @@ -325,15 +334,15 @@ AcpiExResolveObjectToValue ( break; - case AML_REF_OF_OP: - case AML_DEBUG_OP: - case AML_LOAD_OP: + case ACPI_REFCLASS_REFOF: + case ACPI_REFCLASS_DEBUG: + case ACPI_REFCLASS_TABLE: - /* Just leave the object as-is */ + /* Just leave the object as-is, do not dereference */ break; - case AML_INT_NAMEPATH_OP: /* Reference to a named object */ + case ACPI_REFCLASS_NAME: /* Reference to a named object */ /* Dereference the name */ @@ -358,8 +367,7 @@ AcpiExResolveObjectToValue ( default: ACPI_ERROR ((AE_INFO, - "Unknown Reference opcode %X (%s) in %p", - Opcode, AcpiPsGetOpcodeName (Opcode), StackDesc)); + "Unknown Reference type %X in %p", RefType, StackDesc)); Status = AE_AML_INTERNAL; break; } @@ -384,7 +392,7 @@ AcpiExResolveObjectToValue ( case ACPI_TYPE_LOCAL_INDEX_FIELD: ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "FieldRead SourceDesc=%p Type=%X\n", - StackDesc, ACPI_GET_OBJECT_TYPE (StackDesc))); + StackDesc, StackDesc->Common.Type)); Status = AcpiExReadDataFromField (WalkState, StackDesc, &ObjDesc); @@ -467,21 +475,21 @@ AcpiExResolveMultiple ( } /* - * For reference objects created via the RefOf or Index operators, - * we need to get to the base object (as per the ACPI specification - * of the ObjectType and SizeOf operators). This means traversing - * the list of possibly many nested references. + * For reference objects created via the RefOf, Index, or Load/LoadTable + * operators, we need to get to the base object (as per the ACPI + * specification of the ObjectType and SizeOf operators). This means + * traversing the list of possibly many nested references. */ - while (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_LOCAL_REFERENCE) + while (ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) { - switch (ObjDesc->Reference.Opcode) + switch (ObjDesc->Reference.Class) { - case AML_REF_OF_OP: - case AML_INT_NAMEPATH_OP: + case ACPI_REFCLASS_REFOF: + case ACPI_REFCLASS_NAME: /* Dereference the reference pointer */ - if (ObjDesc->Reference.Opcode == AML_REF_OF_OP) + if (ObjDesc->Reference.Class == ACPI_REFCLASS_REFOF) { Node = ObjDesc->Reference.Object; } @@ -520,7 +528,7 @@ AcpiExResolveMultiple ( break; - case AML_INDEX_OP: + case ACPI_REFCLASS_INDEX: /* Get the type of this reference (index into another object) */ @@ -548,13 +556,19 @@ AcpiExResolveMultiple ( break; - case AML_LOCAL_OP: - case AML_ARG_OP: + case ACPI_REFCLASS_TABLE: + + Type = ACPI_TYPE_DDB_HANDLE; + goto Exit; + + + case ACPI_REFCLASS_LOCAL: + case ACPI_REFCLASS_ARG: if (ReturnDesc) { - Status = AcpiDsMethodDataGetValue (ObjDesc->Reference.Opcode, - ObjDesc->Reference.Offset, WalkState, &ObjDesc); + Status = AcpiDsMethodDataGetValue (ObjDesc->Reference.Class, + ObjDesc->Reference.Value, WalkState, &ObjDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -563,8 +577,8 @@ AcpiExResolveMultiple ( } else { - Status = AcpiDsMethodDataGetNode (ObjDesc->Reference.Opcode, - ObjDesc->Reference.Offset, WalkState, &Node); + Status = AcpiDsMethodDataGetNode (ObjDesc->Reference.Class, + ObjDesc->Reference.Value, WalkState, &Node); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -580,7 +594,7 @@ AcpiExResolveMultiple ( break; - case AML_DEBUG_OP: + case ACPI_REFCLASS_DEBUG: /* The Debug Object is of type "DebugObject" */ @@ -591,8 +605,7 @@ AcpiExResolveMultiple ( default: ACPI_ERROR ((AE_INFO, - "Unknown Reference subtype %X", - ObjDesc->Reference.Opcode)); + "Unknown Reference Class %2.2X", ObjDesc->Reference.Class)); return_ACPI_STATUS (AE_AML_INTERNAL); } } @@ -601,7 +614,7 @@ AcpiExResolveMultiple ( * Now we are guaranteed to have an object that has not been created * via the RefOf or Index operators. */ - Type = ACPI_GET_OBJECT_TYPE (ObjDesc); + Type = ObjDesc->Common.Type; Exit: diff --git a/sys/contrib/dev/acpica/exresop.c b/sys/contrib/dev/acpica/executer/exresop.c index 5bbce151b9ed..ecc63f61357d 100644 --- a/sys/contrib/dev/acpica/exresop.c +++ b/sys/contrib/dev/acpica/executer/exresop.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: exresop - AML Interpreter operand/object resolution - * $Revision: 1.95 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,11 +116,12 @@ #define __EXRESOP_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/amlcode.h> -#include <contrib/dev/acpica/acparser.h> -#include <contrib/dev/acpica/acinterp.h> -#include <contrib/dev/acpica/acnamesp.h> +#include "acpi.h" +#include "accommon.h" +#include "amlcode.h" +#include "acparser.h" +#include "acinterp.h" +#include "acnamesp.h" #define _COMPONENT ACPI_EXECUTER @@ -302,52 +302,48 @@ AcpiExResolveOperands ( /* ACPI internal object */ - ObjectType = ACPI_GET_OBJECT_TYPE (ObjDesc); + ObjectType = ObjDesc->Common.Type; /* Check for bad ACPI_OBJECT_TYPE */ if (!AcpiUtValidObjectType (ObjectType)) { ACPI_ERROR ((AE_INFO, - "Bad operand object type [%X]", - ObjectType)); + "Bad operand object type [%X]", ObjectType)); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } if (ObjectType == (UINT8) ACPI_TYPE_LOCAL_REFERENCE) { - /* Decode the Reference */ + /* Validate the Reference */ - OpInfo = AcpiPsGetOpcodeInfo (Opcode); - if (OpInfo->Class == AML_CLASS_UNKNOWN) + switch (ObjDesc->Reference.Class) { - return_ACPI_STATUS (AE_AML_BAD_OPCODE); - } + case ACPI_REFCLASS_DEBUG: - switch (ObjDesc->Reference.Opcode) - { - case AML_DEBUG_OP: TargetOp = AML_DEBUG_OP; /*lint -fallthrough */ - case AML_INDEX_OP: - case AML_REF_OF_OP: - case AML_ARG_OP: - case AML_LOCAL_OP: - case AML_LOAD_OP: /* DdbHandle from LOAD_OP or LOAD_TABLE_OP */ - case AML_INT_NAMEPATH_OP: /* Reference to a named object */ - - ACPI_DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Operand is a Reference, RefOpcode [%s]\n", - (AcpiPsGetOpcodeInfo (ObjDesc->Reference.Opcode))->Name))); + case ACPI_REFCLASS_ARG: + case ACPI_REFCLASS_LOCAL: + case ACPI_REFCLASS_INDEX: + case ACPI_REFCLASS_REFOF: + case ACPI_REFCLASS_TABLE: /* DdbHandle from LOAD_OP or LOAD_TABLE_OP */ + case ACPI_REFCLASS_NAME: /* Reference to a named object */ + + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "Operand is a Reference, Class [%s] %2.2X\n", + AcpiUtGetReferenceName (ObjDesc), + ObjDesc->Reference.Class)); break; default: + ACPI_ERROR ((AE_INFO, - "Operand is a Reference, Unknown Reference Opcode: %X", - ObjDesc->Reference.Opcode)); + "Unknown Reference Class %2.2X in %p", + ObjDesc->Reference.Class, ObjDesc)); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } @@ -359,8 +355,7 @@ AcpiExResolveOperands ( /* Invalid descriptor */ - ACPI_ERROR ((AE_INFO, - "Invalid descriptor %p [%s]", + ACPI_ERROR ((AE_INFO, "Invalid descriptor %p [%s]", ObjDesc, AcpiUtGetDescriptorName (ObjDesc))); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); @@ -380,7 +375,7 @@ AcpiExResolveOperands ( case ARGI_REF_OR_STRING: /* Can be a String or Reference */ if ((ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND) && - (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_STRING)) + (ObjDesc->Common.Type == ACPI_TYPE_STRING)) { /* * String found - the string references a named object and @@ -430,8 +425,8 @@ AcpiExResolveOperands ( * -- All others must be resolved below. */ if ((Opcode == AML_STORE_OP) && - (ACPI_GET_OBJECT_TYPE (*StackPtr) == ACPI_TYPE_LOCAL_REFERENCE) && - ((*StackPtr)->Reference.Opcode == AML_INDEX_OP)) + ((*StackPtr)->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) && + ((*StackPtr)->Reference.Class == ACPI_REFCLASS_INDEX)) { goto NextOperand; } @@ -595,7 +590,7 @@ AcpiExResolveOperands ( /* Need an operand of type INTEGER, STRING or BUFFER */ - switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) + switch (ObjDesc->Common.Type) { case ACPI_TYPE_INTEGER: case ACPI_TYPE_STRING: @@ -618,7 +613,7 @@ AcpiExResolveOperands ( /* Need an operand of type STRING or BUFFER */ - switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) + switch (ObjDesc->Common.Type) { case ACPI_TYPE_STRING: case ACPI_TYPE_BUFFER: @@ -660,7 +655,7 @@ AcpiExResolveOperands ( * The only reference allowed here is a direct reference to * a namespace node. */ - switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) + switch (ObjDesc->Common.Type) { case ACPI_TYPE_PACKAGE: case ACPI_TYPE_STRING: @@ -684,7 +679,7 @@ AcpiExResolveOperands ( /* Need a buffer or package or (ACPI 2.0) String */ - switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) + switch (ObjDesc->Common.Type) { case ACPI_TYPE_PACKAGE: case ACPI_TYPE_STRING: @@ -707,7 +702,7 @@ AcpiExResolveOperands ( /* Need an operand of type REGION or a BUFFER (which could be a resolved region field) */ - switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) + switch (ObjDesc->Common.Type) { case ACPI_TYPE_BUFFER: case ACPI_TYPE_REGION: @@ -729,7 +724,7 @@ AcpiExResolveOperands ( /* Used by the Store() operator only */ - switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) + switch (ObjDesc->Common.Type) { case ACPI_TYPE_INTEGER: case ACPI_TYPE_PACKAGE: @@ -789,7 +784,7 @@ AcpiExResolveOperands ( * required object type (Simple cases only). */ Status = AcpiExCheckObjectType (TypeNeeded, - ACPI_GET_OBJECT_TYPE (*StackPtr), *StackPtr); + (*StackPtr)->Common.Type, *StackPtr); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -806,6 +801,9 @@ NextOperand: } } + ACPI_DUMP_OPERANDS (WalkState->Operands, + AcpiPsGetOpcodeName (Opcode), WalkState->NumOperands); + return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/exstore.c b/sys/contrib/dev/acpica/executer/exstore.c index c4eb8915e73b..8ec8a23cffd7 100644 --- a/sys/contrib/dev/acpica/exstore.c +++ b/sys/contrib/dev/acpica/executer/exstore.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: exstore - AML Interpreter object store support - * $Revision: 1.203 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,12 +116,12 @@ #define __EXSTORE_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acdispat.h> -#include <contrib/dev/acpica/acinterp.h> -#include <contrib/dev/acpica/amlcode.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/acparser.h> +#include "acpi.h" +#include "accommon.h" +#include "acdispat.h" +#include "acinterp.h" +#include "amlcode.h" +#include "acnamesp.h" #define _COMPONENT ACPI_EXECUTER @@ -169,8 +168,13 @@ AcpiExDoDebugObject ( ACPI_FUNCTION_TRACE_PTR (ExDoDebugObject, SourceDesc); - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s", - Level, " ")); + /* Print line header as long as we are not in the middle of an object display */ + + if (!((Level > 0) && Index == 0)) + { + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s", + Level, " ")); + } /* Display index for package output only */ @@ -182,13 +186,13 @@ AcpiExDoDebugObject ( if (!SourceDesc) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "<Null Object>\n")); + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[Null Object]\n")); return_VOID; } if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc) == ACPI_DESC_TYPE_OPERAND) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%s: ", + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%s ", AcpiUtGetObjectTypeName (SourceDesc))); if (!AcpiUtValidInternalObject (SourceDesc)) @@ -210,7 +214,9 @@ AcpiExDoDebugObject ( return_VOID; } - switch (ACPI_GET_OBJECT_TYPE (SourceDesc)) + /* SourceDesc is of type ACPI_DESC_TYPE_OPERAND */ + + switch (SourceDesc->Common.Type) { case ACPI_TYPE_INTEGER: @@ -244,7 +250,7 @@ AcpiExDoDebugObject ( case ACPI_TYPE_PACKAGE: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X Elements]\n", + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[Contains 0x%.2X Elements]\n", SourceDesc->Package.Count)); /* Output the entire contents of the package */ @@ -258,20 +264,69 @@ AcpiExDoDebugObject ( case ACPI_TYPE_LOCAL_REFERENCE: - if (SourceDesc->Reference.Opcode == AML_INDEX_OP) - { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[%s, 0x%X]\n", - AcpiPsGetOpcodeName (SourceDesc->Reference.Opcode), - SourceDesc->Reference.Offset)); - } - else + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[%s] ", + AcpiUtGetReferenceName (SourceDesc))); + + /* Decode the reference */ + + switch (SourceDesc->Reference.Class) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[%s]\n", - AcpiPsGetOpcodeName (SourceDesc->Reference.Opcode))); + case ACPI_REFCLASS_INDEX: + + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%X\n", + SourceDesc->Reference.Value)); + break; + + case ACPI_REFCLASS_TABLE: + + /* Case for DdbHandle */ + + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Table Index 0x%X\n", + SourceDesc->Reference.Value)); + return; + + default: + break; } + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, " ")); - if (SourceDesc->Reference.Object) + /* Check for valid node first, then valid object */ + + if (SourceDesc->Reference.Node) + { + if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc->Reference.Node) != + ACPI_DESC_TYPE_NAMED) + { + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, + " %p - Not a valid namespace node\n", + SourceDesc->Reference.Node)); + } + else + { + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Node %p [%4.4s] ", + SourceDesc->Reference.Node, (SourceDesc->Reference.Node)->Name.Ascii)); + + switch ((SourceDesc->Reference.Node)->Type) + { + /* These types have no attached object */ + + case ACPI_TYPE_DEVICE: + AcpiOsPrintf ("Device\n"); + break; + + case ACPI_TYPE_THERMAL: + AcpiOsPrintf ("Thermal Zone\n"); + break; + + default: + AcpiExDoDebugObject ((SourceDesc->Reference.Node)->Object, + Level+4, 0); + break; + } + } + } + else if (SourceDesc->Reference.Object) { if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc->Reference.Object) == ACPI_DESC_TYPE_NAMED) @@ -285,17 +340,12 @@ AcpiExDoDebugObject ( AcpiExDoDebugObject (SourceDesc->Reference.Object, Level+4, 0); } } - else if (SourceDesc->Reference.Node) - { - AcpiExDoDebugObject ((SourceDesc->Reference.Node)->Object, - Level+4, 0); - } break; default: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%p %s\n", - SourceDesc, AcpiUtGetObjectTypeName (SourceDesc))); + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%p\n", + SourceDesc)); break; } @@ -362,7 +412,7 @@ AcpiExStore ( /* Destination object must be a Reference or a Constant object */ - switch (ACPI_GET_OBJECT_TYPE (DestDesc)) + switch (DestDesc->Common.Type) { case ACPI_TYPE_LOCAL_REFERENCE: break; @@ -386,25 +436,20 @@ AcpiExStore ( "Target is not a Reference or Constant object - %s [%p]", AcpiUtGetObjectTypeName (DestDesc), DestDesc)); - ACPI_DUMP_STACK_ENTRY (SourceDesc); - ACPI_DUMP_STACK_ENTRY (DestDesc); - ACPI_DUMP_OPERANDS (&DestDesc, ACPI_IMODE_EXECUTE, "ExStore", - 2, "Target is not a Reference or Constant object"); - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } /* - * Examine the Reference opcode. These cases are handled: + * Examine the Reference class. These cases are handled: * * 1) Store to Name (Change the object associated with a name) * 2) Store to an indexed area of a Buffer or Package * 3) Store to a Method Local or Arg * 4) Store to the debug object */ - switch (RefDesc->Reference.Opcode) + switch (RefDesc->Reference.Class) { - case AML_REF_OF_OP: + case ACPI_REFCLASS_REFOF: /* Storing an object into a Name "container" */ @@ -414,7 +459,7 @@ AcpiExStore ( break; - case AML_INDEX_OP: + case ACPI_REFCLASS_INDEX: /* Storing to an Index (pointer into a packager or buffer) */ @@ -422,17 +467,17 @@ AcpiExStore ( break; - case AML_LOCAL_OP: - case AML_ARG_OP: + case ACPI_REFCLASS_LOCAL: + case ACPI_REFCLASS_ARG: /* Store to a method local/arg */ - Status = AcpiDsStoreObjectToLocal (RefDesc->Reference.Opcode, - RefDesc->Reference.Offset, SourceDesc, WalkState); + Status = AcpiDsStoreObjectToLocal (RefDesc->Reference.Class, + RefDesc->Reference.Value, SourceDesc, WalkState); break; - case AML_DEBUG_OP: + case ACPI_REFCLASS_DEBUG: /* * Storing to the Debug object causes the value stored to be @@ -448,9 +493,9 @@ AcpiExStore ( default: - ACPI_ERROR ((AE_INFO, "Unknown Reference opcode %X", - RefDesc->Reference.Opcode)); - ACPI_DUMP_ENTRY (RefDesc, ACPI_LV_ERROR); + ACPI_ERROR ((AE_INFO, "Unknown Reference Class %2.2X", + RefDesc->Reference.Class)); + ACPI_DUMP_ENTRY (RefDesc, ACPI_LV_INFO); Status = AE_AML_INTERNAL; break; @@ -508,10 +553,23 @@ AcpiExStoreObjectToIndex ( */ ObjDesc = *(IndexDesc->Reference.Where); - Status = AcpiUtCopyIobjectToIobject (SourceDesc, &NewDesc, WalkState); - if (ACPI_FAILURE (Status)) + if (SourceDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE && + SourceDesc->Reference.Class == ACPI_REFCLASS_TABLE) { - return_ACPI_STATUS (Status); + /* This is a DDBHandle, just add a reference to it */ + + AcpiUtAddReference (SourceDesc); + NewDesc = SourceDesc; + } + else + { + /* Normal object, copy it */ + + Status = AcpiUtCopyIobjectToIobject (SourceDesc, &NewDesc, WalkState); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } } if (ObjDesc) @@ -559,8 +617,8 @@ AcpiExStoreObjectToIndex ( * by the INDEX_OP code. */ ObjDesc = IndexDesc->Reference.Object; - if ((ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_BUFFER) && - (ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_STRING)) + if ((ObjDesc->Common.Type != ACPI_TYPE_BUFFER) && + (ObjDesc->Common.Type != ACPI_TYPE_STRING)) { return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } @@ -569,7 +627,7 @@ AcpiExStoreObjectToIndex ( * The assignment of the individual elements will be slightly * different for each source type. */ - switch (ACPI_GET_OBJECT_TYPE (SourceDesc)) + switch (SourceDesc->Common.Type) { case ACPI_TYPE_INTEGER: @@ -598,7 +656,7 @@ AcpiExStoreObjectToIndex ( /* Store the source value into the target buffer byte */ - ObjDesc->Buffer.Pointer[IndexDesc->Reference.Offset] = Value; + ObjDesc->Buffer.Pointer[IndexDesc->Reference.Value] = Value; break; @@ -676,10 +734,18 @@ AcpiExStoreObjectToNode ( /* If no implicit conversion, drop into the default case below */ - if ((!ImplicitConversion) || (WalkState->Opcode == AML_COPY_OP)) + if ((!ImplicitConversion) || + ((WalkState->Opcode == AML_COPY_OP) && + (TargetType != ACPI_TYPE_LOCAL_REGION_FIELD) && + (TargetType != ACPI_TYPE_LOCAL_BANK_FIELD) && + (TargetType != ACPI_TYPE_LOCAL_INDEX_FIELD))) { - /* Force execution of default (no implicit conversion) */ - + /* + * Force execution of default (no implicit conversion). Note: + * CopyObject does not perform an implicit conversion, as per the ACPI + * spec -- except in case of region/bank/index fields -- because these + * objects must retain their original type permanently. + */ TargetType = ACPI_TYPE_ANY; } @@ -746,7 +812,7 @@ AcpiExStoreObjectToNode ( /* No conversions for all other types. Just attach the source object */ Status = AcpiNsAttachObject (Node, SourceDesc, - ACPI_GET_OBJECT_TYPE (SourceDesc)); + SourceDesc->Common.Type); break; } diff --git a/sys/contrib/dev/acpica/exstoren.c b/sys/contrib/dev/acpica/executer/exstoren.c index 1f87ab2a2ab1..0810560d39c0 100644 --- a/sys/contrib/dev/acpica/exstoren.c +++ b/sys/contrib/dev/acpica/executer/exstoren.c @@ -3,7 +3,6 @@ * * Module Name: exstoren - AML Interpreter object store support, * Store to Node (namespace object) - * $Revision: 1.71 $ * *****************************************************************************/ @@ -11,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -118,9 +117,10 @@ #define __EXSTOREN_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acinterp.h> -#include <contrib/dev/acpica/amlcode.h> +#include "acpi.h" +#include "accommon.h" +#include "acinterp.h" +#include "amlcode.h" #define _COMPONENT ACPI_EXECUTER @@ -177,7 +177,7 @@ AcpiExResolveObject ( * are all essentially the same. This case handles the * "interchangeable" types Integer, String, and Buffer. */ - if (ACPI_GET_OBJECT_TYPE (SourceDesc) == ACPI_TYPE_LOCAL_REFERENCE) + if (SourceDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) { /* Resolve a reference object first */ @@ -197,10 +197,11 @@ AcpiExResolveObject ( /* Must have a Integer, Buffer, or String */ - if ((ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_INTEGER) && - (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_BUFFER) && - (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_STRING) && - !((ACPI_GET_OBJECT_TYPE (SourceDesc) == ACPI_TYPE_LOCAL_REFERENCE) && (SourceDesc->Reference.Opcode == AML_LOAD_OP))) + if ((SourceDesc->Common.Type != ACPI_TYPE_INTEGER) && + (SourceDesc->Common.Type != ACPI_TYPE_BUFFER) && + (SourceDesc->Common.Type != ACPI_TYPE_STRING) && + !((SourceDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) && + (SourceDesc->Reference.Class== ACPI_REFCLASS_TABLE))) { /* Conversion successful but still not a valid type */ @@ -300,7 +301,7 @@ AcpiExStoreObjectToObject ( return_ACPI_STATUS (Status); } - if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_GET_OBJECT_TYPE (DestDesc)) + if (SourceDesc->Common.Type != DestDesc->Common.Type) { /* * The source type does not match the type of the destination. @@ -311,7 +312,7 @@ AcpiExStoreObjectToObject ( * Otherwise, ActualSrcDesc is a temporary object to hold the * converted object. */ - Status = AcpiExConvertToTargetType (ACPI_GET_OBJECT_TYPE (DestDesc), + Status = AcpiExConvertToTargetType (DestDesc->Common.Type, SourceDesc, &ActualSrcDesc, WalkState); if (ACPI_FAILURE (Status)) { @@ -333,7 +334,7 @@ AcpiExStoreObjectToObject ( * We now have two objects of identical types, and we can perform a * copy of the *value* of the source object. */ - switch (ACPI_GET_OBJECT_TYPE (DestDesc)) + switch (DestDesc->Common.Type) { case ACPI_TYPE_INTEGER: diff --git a/sys/contrib/dev/acpica/exstorob.c b/sys/contrib/dev/acpica/executer/exstorob.c index 02daa39759af..a1ad8d0aedc6 100644 --- a/sys/contrib/dev/acpica/exstorob.c +++ b/sys/contrib/dev/acpica/executer/exstorob.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: exstorob - AML Interpreter object store support, store to object - * $Revision: 1.62 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,8 +116,9 @@ #define __EXSTOROB_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acinterp.h> +#include "acpi.h" +#include "accommon.h" +#include "acinterp.h" #define _COMPONENT ACPI_EXECUTER diff --git a/sys/contrib/dev/acpica/exsystem.c b/sys/contrib/dev/acpica/executer/exsystem.c index 81c92be8a7a5..19674606a601 100644 --- a/sys/contrib/dev/acpica/exsystem.c +++ b/sys/contrib/dev/acpica/executer/exsystem.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: exsystem - Interface to OS services - * $Revision: 1.93 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,9 +116,9 @@ #define __EXSYSTEM_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acinterp.h> -#include <contrib/dev/acpica/acevents.h> +#include "acpi.h" +#include "accommon.h" +#include "acinterp.h" #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME ("exsystem") diff --git a/sys/contrib/dev/acpica/exutils.c b/sys/contrib/dev/acpica/executer/exutils.c index 2ce75bbb85d8..45b35a0c2571 100644 --- a/sys/contrib/dev/acpica/exutils.c +++ b/sys/contrib/dev/acpica/executer/exutils.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: exutils - interpreter/scanner utilities - * $Revision: 1.129 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -133,10 +132,10 @@ #define DEFINE_AML_GLOBALS -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acinterp.h> -#include <contrib/dev/acpica/amlcode.h> -#include <contrib/dev/acpica/acevents.h> +#include "acpi.h" +#include "accommon.h" +#include "acinterp.h" +#include "amlcode.h" #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME ("exutils") @@ -324,7 +323,7 @@ AcpiExTruncateFor32bitTable ( */ if ((!ObjDesc) || (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND) || - (ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_INTEGER)) + (ObjDesc->Common.Type != ACPI_TYPE_INTEGER)) { return; } diff --git a/sys/contrib/dev/acpica/hwacpi.c b/sys/contrib/dev/acpica/hardware/hwacpi.c index 3c9bce90aac7..6b6d90ee02e7 100644 --- a/sys/contrib/dev/acpica/hwacpi.c +++ b/sys/contrib/dev/acpica/hardware/hwacpi.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: hwacpi - ACPI Hardware Initialization/Mode Interface - * $Revision: 1.78 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,7 +116,8 @@ #define __HWACPI_C__ -#include <contrib/dev/acpica/acpi.h> +#include "acpi.h" +#include "accommon.h" #define _COMPONENT ACPI_HARDWARE @@ -167,7 +167,8 @@ AcpiHwSetMode ( if (!AcpiGbl_FADT.AcpiEnable && !AcpiGbl_FADT.AcpiDisable) { ACPI_ERROR ((AE_INFO, - "No ACPI mode transition supported in this system (enable/disable both zero)")); + "No ACPI mode transition supported in this system " + "(enable/disable both zero)")); return_ACPI_STATUS (AE_OK); } @@ -177,7 +178,7 @@ AcpiHwSetMode ( /* BIOS should have disabled ALL fixed and GP events */ - Status = AcpiOsWritePort (AcpiGbl_FADT.SmiCommand, + Status = AcpiHwWritePort (AcpiGbl_FADT.SmiCommand, (UINT32) AcpiGbl_FADT.AcpiEnable, 8); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Attempting to enable ACPI mode\n")); break; @@ -188,7 +189,7 @@ AcpiHwSetMode ( * BIOS should clear all fixed status bits and restore fixed event * enable bits to default */ - Status = AcpiOsWritePort (AcpiGbl_FADT.SmiCommand, + Status = AcpiHwWritePort (AcpiGbl_FADT.SmiCommand, (UINT32) AcpiGbl_FADT.AcpiDisable, 8); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Attempting to enable Legacy (non-ACPI) mode\n")); @@ -260,7 +261,7 @@ AcpiHwGetMode ( return_UINT32 (ACPI_SYS_MODE_ACPI); } - Status = AcpiGetRegister (ACPI_BITREG_SCI_ENABLE, &Value); + Status = AcpiReadBitRegister (ACPI_BITREG_SCI_ENABLE, &Value); if (ACPI_FAILURE (Status)) { return_UINT32 (ACPI_SYS_MODE_LEGACY); diff --git a/sys/contrib/dev/acpica/hwgpe.c b/sys/contrib/dev/acpica/hardware/hwgpe.c index d7498e5552ce..b7bb0b47f5d3 100644 --- a/sys/contrib/dev/acpica/hwgpe.c +++ b/sys/contrib/dev/acpica/hardware/hwgpe.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: hwgpe - Low level GPE enable/disable/clear functions - * $Revision: 1.75 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -115,8 +114,9 @@ * *****************************************************************************/ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acevents.h> +#include "acpi.h" +#include "accommon.h" +#include "acevents.h" #define _COMPONENT ACPI_HARDWARE ACPI_MODULE_NAME ("hwgpe") @@ -126,7 +126,58 @@ static ACPI_STATUS AcpiHwEnableWakeupGpeBlock ( ACPI_GPE_XRUPT_INFO *GpeXruptInfo, - ACPI_GPE_BLOCK_INFO *GpeBlock); + ACPI_GPE_BLOCK_INFO *GpeBlock, + void *Context); + + +/****************************************************************************** + * + * FUNCTION: AcpiHwLowDisableGpe + * + * PARAMETERS: GpeEventInfo - Info block for the GPE to be disabled + * + * RETURN: Status + * + * DESCRIPTION: Disable a single GPE in the enable register. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiHwLowDisableGpe ( + ACPI_GPE_EVENT_INFO *GpeEventInfo) +{ + ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; + ACPI_STATUS Status; + UINT32 EnableMask; + + + /* Get the info block for the entire GPE register */ + + GpeRegisterInfo = GpeEventInfo->RegisterInfo; + if (!GpeRegisterInfo) + { + return (AE_NOT_EXIST); + } + + /* Get current value of the enable register that contains this GPE */ + + Status = AcpiRead (&EnableMask, &GpeRegisterInfo->EnableAddress); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* Clear just the bit that corresponds to this GPE */ + + ACPI_CLEAR_BIT (EnableMask, ((UINT32) 1 << + (GpeEventInfo->GpeNumber - GpeRegisterInfo->BaseGpeNumber))); + + + /* Write the updated enable mask */ + + Status = AcpiWrite (EnableMask, &GpeRegisterInfo->EnableAddress); + return (Status); +} /****************************************************************************** @@ -164,7 +215,7 @@ AcpiHwWriteGpeEnableReg ( /* Write the entire GPE (runtime) enable register */ - Status = AcpiHwLowLevelWrite (8, GpeRegisterInfo->EnableForRun, + Status = AcpiWrite (GpeRegisterInfo->EnableForRun, &GpeRegisterInfo->EnableAddress); return (Status); @@ -194,14 +245,14 @@ AcpiHwClearGpe ( ACPI_FUNCTION_ENTRY (); - RegisterBit = (UINT8) - (1 << (GpeEventInfo->GpeNumber - GpeEventInfo->RegisterInfo->BaseGpeNumber)); + RegisterBit = (UINT8) (1 << + (GpeEventInfo->GpeNumber - GpeEventInfo->RegisterInfo->BaseGpeNumber)); /* * Write a one to the appropriate bit in the status register to * clear this GPE. */ - Status = AcpiHwLowLevelWrite (8, RegisterBit, + Status = AcpiWrite (RegisterBit, &GpeEventInfo->RegisterInfo->StatusAddress); return (Status); @@ -247,8 +298,8 @@ AcpiHwGetGpeStatus ( /* Get the register bitmask for this GPE */ - RegisterBit = (UINT8) - (1 << (GpeEventInfo->GpeNumber - GpeEventInfo->RegisterInfo->BaseGpeNumber)); + RegisterBit = (UINT8) (1 << + (GpeEventInfo->GpeNumber - GpeEventInfo->RegisterInfo->BaseGpeNumber)); /* GPE currently enabled? (enabled for runtime?) */ @@ -266,7 +317,7 @@ AcpiHwGetGpeStatus ( /* GPE currently active (status bit == 1)? */ - Status = AcpiHwLowLevelRead (8, &InByte, &GpeRegisterInfo->StatusAddress); + Status = AcpiRead (&InByte, &GpeRegisterInfo->StatusAddress); if (ACPI_FAILURE (Status)) { goto UnlockAndExit; @@ -303,7 +354,8 @@ UnlockAndExit: ACPI_STATUS AcpiHwDisableGpeBlock ( ACPI_GPE_XRUPT_INFO *GpeXruptInfo, - ACPI_GPE_BLOCK_INFO *GpeBlock) + ACPI_GPE_BLOCK_INFO *GpeBlock, + void *Context) { UINT32 i; ACPI_STATUS Status; @@ -315,8 +367,7 @@ AcpiHwDisableGpeBlock ( { /* Disable all GPEs in this register */ - Status = AcpiHwLowLevelWrite (8, 0x00, - &GpeBlock->RegisterInfo[i].EnableAddress); + Status = AcpiWrite (0x00, &GpeBlock->RegisterInfo[i].EnableAddress); if (ACPI_FAILURE (Status)) { return (Status); @@ -343,7 +394,8 @@ AcpiHwDisableGpeBlock ( ACPI_STATUS AcpiHwClearGpeBlock ( ACPI_GPE_XRUPT_INFO *GpeXruptInfo, - ACPI_GPE_BLOCK_INFO *GpeBlock) + ACPI_GPE_BLOCK_INFO *GpeBlock, + void *Context) { UINT32 i; ACPI_STATUS Status; @@ -355,8 +407,7 @@ AcpiHwClearGpeBlock ( { /* Clear status on all GPEs in this register */ - Status = AcpiHwLowLevelWrite (8, 0xFF, - &GpeBlock->RegisterInfo[i].StatusAddress); + Status = AcpiWrite (0xFF, &GpeBlock->RegisterInfo[i].StatusAddress); if (ACPI_FAILURE (Status)) { return (Status); @@ -384,7 +435,8 @@ AcpiHwClearGpeBlock ( ACPI_STATUS AcpiHwEnableRuntimeGpeBlock ( ACPI_GPE_XRUPT_INFO *GpeXruptInfo, - ACPI_GPE_BLOCK_INFO *GpeBlock) + ACPI_GPE_BLOCK_INFO *GpeBlock, + void *Context) { UINT32 i; ACPI_STATUS Status; @@ -403,7 +455,7 @@ AcpiHwEnableRuntimeGpeBlock ( /* Enable all "runtime" GPEs in this register */ - Status = AcpiHwLowLevelWrite (8, GpeBlock->RegisterInfo[i].EnableForRun, + Status = AcpiWrite (GpeBlock->RegisterInfo[i].EnableForRun, &GpeBlock->RegisterInfo[i].EnableAddress); if (ACPI_FAILURE (Status)) { @@ -432,7 +484,8 @@ AcpiHwEnableRuntimeGpeBlock ( static ACPI_STATUS AcpiHwEnableWakeupGpeBlock ( ACPI_GPE_XRUPT_INFO *GpeXruptInfo, - ACPI_GPE_BLOCK_INFO *GpeBlock) + ACPI_GPE_BLOCK_INFO *GpeBlock, + void *Context) { UINT32 i; ACPI_STATUS Status; @@ -449,8 +502,7 @@ AcpiHwEnableWakeupGpeBlock ( /* Enable all "wake" GPEs in this register */ - Status = AcpiHwLowLevelWrite (8, - GpeBlock->RegisterInfo[i].EnableForWake, + Status = AcpiWrite (GpeBlock->RegisterInfo[i].EnableForWake, &GpeBlock->RegisterInfo[i].EnableAddress); if (ACPI_FAILURE (Status)) { @@ -484,8 +536,8 @@ AcpiHwDisableAllGpes ( ACPI_FUNCTION_TRACE (HwDisableAllGpes); - Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock); - Status = AcpiEvWalkGpeList (AcpiHwClearGpeBlock); + Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock, NULL); + Status = AcpiEvWalkGpeList (AcpiHwClearGpeBlock, NULL); return_ACPI_STATUS (Status); } @@ -512,7 +564,7 @@ AcpiHwEnableAllRuntimeGpes ( ACPI_FUNCTION_TRACE (HwEnableAllRuntimeGpes); - Status = AcpiEvWalkGpeList (AcpiHwEnableRuntimeGpeBlock); + Status = AcpiEvWalkGpeList (AcpiHwEnableRuntimeGpeBlock, NULL); return_ACPI_STATUS (Status); } @@ -539,7 +591,7 @@ AcpiHwEnableAllWakeupGpes ( ACPI_FUNCTION_TRACE (HwEnableAllWakeupGpes); - Status = AcpiEvWalkGpeList (AcpiHwEnableWakeupGpeBlock); + Status = AcpiEvWalkGpeList (AcpiHwEnableWakeupGpeBlock, NULL); return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/hardware/hwregs.c b/sys/contrib/dev/acpica/hardware/hwregs.c new file mode 100644 index 000000000000..cfb83f22e642 --- /dev/null +++ b/sys/contrib/dev/acpica/hardware/hwregs.c @@ -0,0 +1,602 @@ + +/******************************************************************************* + * + * Module Name: hwregs - Read/write access functions for the various ACPI + * control and status registers. + * + ******************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2009, 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 __HWREGS_C__ + +#include "acpi.h" +#include "accommon.h" +#include "acevents.h" + +#define _COMPONENT ACPI_HARDWARE + ACPI_MODULE_NAME ("hwregs") + + +/* Local Prototypes */ + +static ACPI_STATUS +AcpiHwReadMultiple ( + UINT32 *Value, + ACPI_GENERIC_ADDRESS *RegisterA, + ACPI_GENERIC_ADDRESS *RegisterB); + +static ACPI_STATUS +AcpiHwWriteMultiple ( + UINT32 Value, + ACPI_GENERIC_ADDRESS *RegisterA, + ACPI_GENERIC_ADDRESS *RegisterB); + + +/******************************************************************************* + * + * FUNCTION: AcpiHwClearAcpiStatus + * + * PARAMETERS: None + * + * RETURN: Status + * + * DESCRIPTION: Clears all fixed and general purpose status bits + * + ******************************************************************************/ + +ACPI_STATUS +AcpiHwClearAcpiStatus ( + void) +{ + ACPI_STATUS Status; + ACPI_CPU_FLAGS LockFlags = 0; + + + ACPI_FUNCTION_TRACE (HwClearAcpiStatus); + + + ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %04X to %8.8X%8.8X\n", + ACPI_BITMASK_ALL_FIXED_STATUS, + ACPI_FORMAT_UINT64 (AcpiGbl_XPm1aStatus.Address))); + + LockFlags = AcpiOsAcquireLock (AcpiGbl_HardwareLock); + + /* Clear the fixed events in PM1 A/B */ + + Status = AcpiHwRegisterWrite (ACPI_REGISTER_PM1_STATUS, + ACPI_BITMASK_ALL_FIXED_STATUS); + if (ACPI_FAILURE (Status)) + { + goto UnlockAndExit; + } + + /* Clear the GPE Bits in all GPE registers in all GPE blocks */ + + Status = AcpiEvWalkGpeList (AcpiHwClearGpeBlock, NULL); + +UnlockAndExit: + AcpiOsReleaseLock (AcpiGbl_HardwareLock, LockFlags); + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiHwGetRegisterBitMask + * + * PARAMETERS: RegisterId - Index of ACPI Register to access + * + * RETURN: The bitmask to be used when accessing the register + * + * DESCRIPTION: Map RegisterId into a register bitmask. + * + ******************************************************************************/ + +ACPI_BIT_REGISTER_INFO * +AcpiHwGetBitRegisterInfo ( + UINT32 RegisterId) +{ + ACPI_FUNCTION_ENTRY (); + + + if (RegisterId > ACPI_BITREG_MAX) + { + ACPI_ERROR ((AE_INFO, "Invalid BitRegister ID: %X", RegisterId)); + return (NULL); + } + + return (&AcpiGbl_BitRegisterInfo[RegisterId]); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiHwWritePm1Control + * + * PARAMETERS: Pm1aControl - Value to be written to PM1A control + * Pm1bControl - Value to be written to PM1B control + * + * RETURN: Status + * + * DESCRIPTION: Write the PM1 A/B control registers. These registers are + * different than than the PM1 A/B status and enable registers + * in that different values can be written to the A/B registers. + * Most notably, the SLP_TYP bits can be different, as per the + * values returned from the _Sx predefined methods. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiHwWritePm1Control ( + UINT32 Pm1aControl, + UINT32 Pm1bControl) +{ + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (HwWritePm1Control); + + + Status = AcpiWrite (Pm1aControl, &AcpiGbl_FADT.XPm1aControlBlock); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + if (AcpiGbl_FADT.XPm1bControlBlock.Address) + { + Status = AcpiWrite (Pm1bControl, &AcpiGbl_FADT.XPm1bControlBlock); + } + return_ACPI_STATUS (Status); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiHwRegisterRead + * + * PARAMETERS: RegisterId - ACPI Register ID + * ReturnValue - Where the register value is returned + * + * RETURN: Status and the value read. + * + * DESCRIPTION: Read from the specified ACPI register + * + ******************************************************************************/ + +ACPI_STATUS +AcpiHwRegisterRead ( + UINT32 RegisterId, + UINT32 *ReturnValue) +{ + UINT32 Value = 0; + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (HwRegisterRead); + + + switch (RegisterId) + { + case ACPI_REGISTER_PM1_STATUS: /* PM1 A/B: 16-bit access each */ + + Status = AcpiHwReadMultiple (&Value, + &AcpiGbl_XPm1aStatus, + &AcpiGbl_XPm1bStatus); + break; + + + case ACPI_REGISTER_PM1_ENABLE: /* PM1 A/B: 16-bit access each */ + + Status = AcpiHwReadMultiple (&Value, + &AcpiGbl_XPm1aEnable, + &AcpiGbl_XPm1bEnable); + break; + + + case ACPI_REGISTER_PM1_CONTROL: /* PM1 A/B: 16-bit access each */ + + Status = AcpiHwReadMultiple (&Value, + &AcpiGbl_FADT.XPm1aControlBlock, + &AcpiGbl_FADT.XPm1bControlBlock); + + /* + * Zero the write-only bits. From the ACPI specification, "Hardware + * Write-Only Bits": "Upon reads to registers with write-only bits, + * software masks out all write-only bits." + */ + Value &= ~ACPI_PM1_CONTROL_WRITEONLY_BITS; + break; + + + case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */ + + Status = AcpiRead (&Value, &AcpiGbl_FADT.XPm2ControlBlock); + break; + + + case ACPI_REGISTER_PM_TIMER: /* 32-bit access */ + + Status = AcpiRead (&Value, &AcpiGbl_FADT.XPmTimerBlock); + break; + + + case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */ + + Status = AcpiHwReadPort (AcpiGbl_FADT.SmiCommand, &Value, 8); + break; + + + default: + ACPI_ERROR ((AE_INFO, "Unknown Register ID: %X", + RegisterId)); + Status = AE_BAD_PARAMETER; + break; + } + + if (ACPI_SUCCESS (Status)) + { + *ReturnValue = Value; + } + + return_ACPI_STATUS (Status); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiHwRegisterWrite + * + * PARAMETERS: RegisterId - ACPI Register ID + * Value - The value to write + * + * RETURN: Status + * + * DESCRIPTION: Write to the specified ACPI register + * + * NOTE: In accordance with the ACPI specification, this function automatically + * preserves the value of the following bits, meaning that these bits cannot be + * changed via this interface: + * + * PM1_CONTROL[0] = SCI_EN + * PM1_CONTROL[9] + * PM1_STATUS[11] + * + * ACPI References: + * 1) Hardware Ignored Bits: When software writes to a register with ignored + * bit fields, it preserves the ignored bit fields + * 2) SCI_EN: OSPM always preserves this bit position + * + ******************************************************************************/ + +ACPI_STATUS +AcpiHwRegisterWrite ( + UINT32 RegisterId, + UINT32 Value) +{ + ACPI_STATUS Status; + UINT32 ReadValue; + + + ACPI_FUNCTION_TRACE (HwRegisterWrite); + + + switch (RegisterId) + { + case ACPI_REGISTER_PM1_STATUS: /* PM1 A/B: 16-bit access each */ + /* + * Handle the "ignored" bit in PM1 Status. According to the ACPI + * specification, ignored bits are to be preserved when writing. + * Normally, this would mean a read/modify/write sequence. However, + * preserving a bit in the status register is different. Writing a + * one clears the status, and writing a zero preserves the status. + * Therefore, we must always write zero to the ignored bit. + * + * This behavior is clarified in the ACPI 4.0 specification. + */ + Value &= ~ACPI_PM1_STATUS_PRESERVED_BITS; + + Status = AcpiHwWriteMultiple (Value, + &AcpiGbl_XPm1aStatus, + &AcpiGbl_XPm1bStatus); + break; + + + case ACPI_REGISTER_PM1_ENABLE: /* PM1 A/B: 16-bit access each */ + + Status = AcpiHwWriteMultiple (Value, + &AcpiGbl_XPm1aEnable, + &AcpiGbl_XPm1bEnable); + break; + + + case ACPI_REGISTER_PM1_CONTROL: /* PM1 A/B: 16-bit access each */ + + /* + * Perform a read first to preserve certain bits (per ACPI spec) + * Note: This includes SCI_EN, we never want to change this bit + */ + Status = AcpiHwReadMultiple (&ReadValue, + &AcpiGbl_FADT.XPm1aControlBlock, + &AcpiGbl_FADT.XPm1bControlBlock); + if (ACPI_FAILURE (Status)) + { + goto Exit; + } + + /* Insert the bits to be preserved */ + + ACPI_INSERT_BITS (Value, ACPI_PM1_CONTROL_PRESERVED_BITS, ReadValue); + + /* Now we can write the data */ + + Status = AcpiHwWriteMultiple (Value, + &AcpiGbl_FADT.XPm1aControlBlock, + &AcpiGbl_FADT.XPm1bControlBlock); + break; + + + case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */ + + /* + * For control registers, all reserved bits must be preserved, + * as per the ACPI spec. + */ + Status = AcpiRead (&ReadValue, &AcpiGbl_FADT.XPm2ControlBlock); + if (ACPI_FAILURE (Status)) + { + goto Exit; + } + + /* Insert the bits to be preserved */ + + ACPI_INSERT_BITS (Value, ACPI_PM2_CONTROL_PRESERVED_BITS, ReadValue); + + Status = AcpiWrite (Value, &AcpiGbl_FADT.XPm2ControlBlock); + break; + + + case ACPI_REGISTER_PM_TIMER: /* 32-bit access */ + + Status = AcpiWrite (Value, &AcpiGbl_FADT.XPmTimerBlock); + break; + + + case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */ + + /* SMI_CMD is currently always in IO space */ + + Status = AcpiHwWritePort (AcpiGbl_FADT.SmiCommand, Value, 8); + break; + + + default: + ACPI_ERROR ((AE_INFO, "Unknown Register ID: %X", + RegisterId)); + Status = AE_BAD_PARAMETER; + break; + } + +Exit: + return_ACPI_STATUS (Status); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiHwReadMultiple + * + * PARAMETERS: Value - Where the register value is returned + * RegisterA - First ACPI register (required) + * RegisterB - Second ACPI register (optional) + * + * RETURN: Status + * + * DESCRIPTION: Read from the specified two-part ACPI register (such as PM1 A/B) + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiHwReadMultiple ( + UINT32 *Value, + ACPI_GENERIC_ADDRESS *RegisterA, + ACPI_GENERIC_ADDRESS *RegisterB) +{ + UINT32 ValueA = 0; + UINT32 ValueB = 0; + ACPI_STATUS Status; + + + /* The first register is always required */ + + Status = AcpiRead (&ValueA, RegisterA); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* Second register is optional */ + + if (RegisterB->Address) + { + Status = AcpiRead (&ValueB, RegisterB); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + } + + /* + * OR the two return values together. No shifting or masking is necessary, + * because of how the PM1 registers are defined in the ACPI specification: + * + * "Although the bits can be split between the two register blocks (each + * register block has a unique pointer within the FADT), the bit positions + * are maintained. The register block with unimplemented bits (that is, + * those implemented in the other register block) always returns zeros, + * and writes have no side effects" + */ + *Value = (ValueA | ValueB); + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiHwWriteMultiple + * + * PARAMETERS: Value - The value to write + * RegisterA - First ACPI register (required) + * RegisterB - Second ACPI register (optional) + * + * RETURN: Status + * + * DESCRIPTION: Write to the specified two-part ACPI register (such as PM1 A/B) + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiHwWriteMultiple ( + UINT32 Value, + ACPI_GENERIC_ADDRESS *RegisterA, + ACPI_GENERIC_ADDRESS *RegisterB) +{ + ACPI_STATUS Status; + + + /* The first register is always required */ + + Status = AcpiWrite (Value, RegisterA); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* + * Second register is optional + * + * No bit shifting or clearing is necessary, because of how the PM1 + * registers are defined in the ACPI specification: + * + * "Although the bits can be split between the two register blocks (each + * register block has a unique pointer within the FADT), the bit positions + * are maintained. The register block with unimplemented bits (that is, + * those implemented in the other register block) always returns zeros, + * and writes have no side effects" + */ + if (RegisterB->Address) + { + Status = AcpiWrite (Value, RegisterB); + } + + return (Status); +} + diff --git a/sys/contrib/dev/acpica/hwsleep.c b/sys/contrib/dev/acpica/hardware/hwsleep.c index 8369dc70d2bd..63d4aa381cf3 100644 --- a/sys/contrib/dev/acpica/hwsleep.c +++ b/sys/contrib/dev/acpica/hardware/hwsleep.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Name: hwsleep.c - ACPI Hardware Sleep/Wake Interface - * $Revision: 1.87 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -115,8 +114,8 @@ * *****************************************************************************/ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/actables.h> +#include "acpi.h" +#include "accommon.h" #define _COMPONENT ACPI_HARDWARE ACPI_MODULE_NAME ("hwsleep") @@ -126,50 +125,31 @@ * * FUNCTION: AcpiSetFirmwareWakingVector * - * PARAMETERS: PhysicalAddress - Physical address of ACPI real mode + * PARAMETERS: PhysicalAddress - 32-bit physical address of ACPI real mode * entry point. * * RETURN: Status * - * DESCRIPTION: Access function for the FirmwareWakingVector field in FACS + * DESCRIPTION: Sets the 32-bit FirmwareWakingVector field of the FACS * ******************************************************************************/ ACPI_STATUS AcpiSetFirmwareWakingVector ( - ACPI_PHYSICAL_ADDRESS PhysicalAddress) + UINT32 PhysicalAddress) { - ACPI_TABLE_FACS *Facs; - ACPI_STATUS Status; - - ACPI_FUNCTION_TRACE (AcpiSetFirmwareWakingVector); - /* Get the FACS */ - Status = AcpiGetTableByIndex (ACPI_TABLE_INDEX_FACS, - ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &Facs)); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } + /* Set the 32-bit vector */ - /* Set the vector */ + AcpiGbl_FACS->FirmwareWakingVector = PhysicalAddress; - if ((Facs->Length < 32) || - (!(Facs->XFirmwareWakingVector))) - { - /* - * ACPI 1.0 FACS or short table or optional X_ field is zero - */ - Facs->FirmwareWakingVector = (UINT32) PhysicalAddress; - } - else + /* Clear the 64-bit vector if it exists */ + + if ((AcpiGbl_FACS->Length > 32) && (AcpiGbl_FACS->Version >= 1)) { - /* - * ACPI 2.0 FACS with valid X_ field - */ - Facs->XFirmwareWakingVector = PhysicalAddress; + AcpiGbl_FACS->XFirmwareWakingVector = 0; } return_ACPI_STATUS (AE_OK); @@ -178,69 +158,45 @@ AcpiSetFirmwareWakingVector ( ACPI_EXPORT_SYMBOL (AcpiSetFirmwareWakingVector) +#if ACPI_MACHINE_WIDTH == 64 /******************************************************************************* * - * FUNCTION: AcpiGetFirmwareWakingVector + * FUNCTION: AcpiSetFirmwareWakingVector64 * - * PARAMETERS: *PhysicalAddress - Where the contents of - * the FirmwareWakingVector field of - * the FACS will be returned. + * PARAMETERS: PhysicalAddress - 64-bit physical address of ACPI protected + * mode entry point. * - * RETURN: Status, vector + * RETURN: Status * - * DESCRIPTION: Access function for the FirmwareWakingVector field in FACS + * DESCRIPTION: Sets the 64-bit X_FirmwareWakingVector field of the FACS, if + * it exists in the table. This function is intended for use with + * 64-bit host operating systems. * ******************************************************************************/ ACPI_STATUS -AcpiGetFirmwareWakingVector ( - ACPI_PHYSICAL_ADDRESS *PhysicalAddress) +AcpiSetFirmwareWakingVector64 ( + UINT64 PhysicalAddress) { - ACPI_TABLE_FACS *Facs; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (AcpiGetFirmwareWakingVector); - + ACPI_FUNCTION_TRACE (AcpiSetFirmwareWakingVector64); - if (!PhysicalAddress) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - /* Get the FACS */ + /* Determine if the 64-bit vector actually exists */ - Status = AcpiGetTableByIndex (ACPI_TABLE_INDEX_FACS, - ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &Facs)); - if (ACPI_FAILURE (Status)) + if ((AcpiGbl_FACS->Length <= 32) || (AcpiGbl_FACS->Version < 1)) { - return_ACPI_STATUS (Status); + return_ACPI_STATUS (AE_NOT_EXIST); } - /* Get the vector */ - - if ((Facs->Length < 32) || - (!(Facs->XFirmwareWakingVector))) - { - /* - * ACPI 1.0 FACS or short table or optional X_ field is zero - */ - *PhysicalAddress = - (ACPI_PHYSICAL_ADDRESS) Facs->FirmwareWakingVector; - } - else - { - /* - * ACPI 2.0 FACS with valid X_ field - */ - *PhysicalAddress = (ACPI_PHYSICAL_ADDRESS) Facs->XFirmwareWakingVector; - } + /* Clear 32-bit vector, set the 64-bit X_ vector */ + AcpiGbl_FACS->FirmwareWakingVector = 0; + AcpiGbl_FACS->XFirmwareWakingVector = PhysicalAddress; return_ACPI_STATUS (AE_OK); } -ACPI_EXPORT_SYMBOL (AcpiGetFirmwareWakingVector) - +ACPI_EXPORT_SYMBOL (AcpiSetFirmwareWakingVector64) +#endif /******************************************************************************* * @@ -259,19 +215,18 @@ ACPI_EXPORT_SYMBOL (AcpiGetFirmwareWakingVector) ACPI_STATUS AcpiEnterSleepStatePrep ( - UINT8 SleepState) + UINT8 SleepState) { - ACPI_STATUS Status; - ACPI_OBJECT_LIST ArgList; - ACPI_OBJECT Arg; + ACPI_STATUS Status; + ACPI_OBJECT_LIST ArgList; + ACPI_OBJECT Arg; ACPI_FUNCTION_TRACE (AcpiEnterSleepStatePrep); - /* - * _PSW methods could be run here to enable wake-on keyboard, LAN, etc. - */ + /* _PSW methods could be run here to enable wake-on keyboard, LAN, etc. */ + Status = AcpiGetSleepTypeData (SleepState, &AcpiGbl_SleepTypeA, &AcpiGbl_SleepTypeB); if (ACPI_FAILURE (Status)) @@ -279,29 +234,20 @@ AcpiEnterSleepStatePrep ( return_ACPI_STATUS (Status); } - /* Setup parameter object */ + /* Execute the _PTS method (Prepare To Sleep) */ ArgList.Count = 1; ArgList.Pointer = &Arg; - Arg.Type = ACPI_TYPE_INTEGER; Arg.Integer.Value = SleepState; - /* Run the _PTS and _GTS methods */ - Status = AcpiEvaluateObject (NULL, METHOD_NAME__PTS, &ArgList, NULL); if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND) { return_ACPI_STATUS (Status); } - Status = AcpiEvaluateObject (NULL, METHOD_NAME__GTS, &ArgList, NULL); - if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND) - { - return_ACPI_STATUS (Status); - } - - /* Setup the argument to _SST */ + /* Setup the argument to the _SST method (System STatus) */ switch (SleepState) { @@ -324,8 +270,10 @@ AcpiEnterSleepStatePrep ( break; } - /* Set the system indicators to show the desired sleep state. */ - + /* + * Set the system indicators to show the desired sleep state. + * _SST is an optional method (return no error if not found) + */ Status = AcpiEvaluateObject (NULL, METHOD_NAME__SST, &ArgList, NULL); if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND) { @@ -346,7 +294,7 @@ ACPI_EXPORT_SYMBOL (AcpiEnterSleepStatePrep) * * RETURN: Status * - * DESCRIPTION: Enter a system sleep state (see ACPI 2.0 spec p 231) + * DESCRIPTION: Enter a system sleep state * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED * ******************************************************************************/ @@ -355,11 +303,13 @@ ACPI_STATUS AcpiEnterSleepState ( UINT8 SleepState) { - UINT32 PM1AControl; - UINT32 PM1BControl; + UINT32 Pm1aControl; + UINT32 Pm1bControl; ACPI_BIT_REGISTER_INFO *SleepTypeRegInfo; ACPI_BIT_REGISTER_INFO *SleepEnableRegInfo; UINT32 InValue; + ACPI_OBJECT_LIST ArgList; + ACPI_OBJECT Arg; UINT32 Retry; ACPI_STATUS Status; @@ -375,12 +325,12 @@ AcpiEnterSleepState ( return_ACPI_STATUS (AE_AML_OPERAND_VALUE); } - SleepTypeRegInfo = AcpiHwGetBitRegisterInfo (ACPI_BITREG_SLEEP_TYPE_A); + SleepTypeRegInfo = AcpiHwGetBitRegisterInfo (ACPI_BITREG_SLEEP_TYPE); SleepEnableRegInfo = AcpiHwGetBitRegisterInfo (ACPI_BITREG_SLEEP_ENABLE); /* Clear wake status */ - Status = AcpiSetRegister (ACPI_BITREG_WAKE_STATUS, 1); + Status = AcpiWriteBitRegister (ACPI_BITREG_WAKE_STATUS, ACPI_CLEAR_STATUS); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -398,7 +348,7 @@ AcpiEnterSleepState ( { /* Disable BM arbitration */ - Status = AcpiSetRegister (ACPI_BITREG_ARB_DISABLE, 1); + Status = AcpiWriteBitRegister (ACPI_BITREG_ARB_DISABLE, 1); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -422,10 +372,23 @@ AcpiEnterSleepState ( return_ACPI_STATUS (Status); } + /* Execute the _GTS method (Going To Sleep) */ + + ArgList.Count = 1; + ArgList.Pointer = &Arg; + Arg.Type = ACPI_TYPE_INTEGER; + Arg.Integer.Value = SleepState; + + Status = AcpiEvaluateObject (NULL, METHOD_NAME__GTS, &ArgList, NULL); + if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND) + { + return_ACPI_STATUS (Status); + } + /* Get current value of PM1A control */ - Status = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, - ACPI_REGISTER_PM1_CONTROL, &PM1AControl); + Status = AcpiHwRegisterRead (ACPI_REGISTER_PM1_CONTROL, + &Pm1aControl); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -433,56 +396,42 @@ AcpiEnterSleepState ( ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "Entering sleep state [S%d]\n", SleepState)); - /* Clear SLP_EN and SLP_TYP fields */ + /* Clear the SLP_EN and SLP_TYP fields */ - PM1AControl &= ~(SleepTypeRegInfo->AccessBitMask | + Pm1aControl &= ~(SleepTypeRegInfo->AccessBitMask | SleepEnableRegInfo->AccessBitMask); - PM1BControl = PM1AControl; + Pm1bControl = Pm1aControl; - /* Insert SLP_TYP bits */ + /* Insert the SLP_TYP bits */ - PM1AControl |= (AcpiGbl_SleepTypeA << SleepTypeRegInfo->BitPosition); - PM1BControl |= (AcpiGbl_SleepTypeB << SleepTypeRegInfo->BitPosition); + Pm1aControl |= (AcpiGbl_SleepTypeA << SleepTypeRegInfo->BitPosition); + Pm1bControl |= (AcpiGbl_SleepTypeB << SleepTypeRegInfo->BitPosition); /* * We split the writes of SLP_TYP and SLP_EN to workaround * poorly implemented hardware. */ - /* Write #1: fill in SLP_TYP data */ + /* Write #1: write the SLP_TYP data to the PM1 Control registers */ - Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, - ACPI_REGISTER_PM1A_CONTROL, PM1AControl); + Status = AcpiHwWritePm1Control (Pm1aControl, Pm1bControl); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } - Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, - ACPI_REGISTER_PM1B_CONTROL, PM1BControl); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } + /* Insert the sleep enable (SLP_EN) bit */ - /* Insert SLP_ENABLE bit */ + Pm1aControl |= SleepEnableRegInfo->AccessBitMask; + Pm1bControl |= SleepEnableRegInfo->AccessBitMask; - PM1AControl |= SleepEnableRegInfo->AccessBitMask; - PM1BControl |= SleepEnableRegInfo->AccessBitMask; - - /* Write #2: SLP_TYP + SLP_EN */ + /* Flush caches, as per ACPI specification */ ACPI_FLUSH_CPU_CACHE (); - Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, - ACPI_REGISTER_PM1A_CONTROL, PM1AControl); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } + /* Write #2: Write both SLP_TYP + SLP_EN */ - Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, - ACPI_REGISTER_PM1B_CONTROL, PM1BControl); + Status = AcpiHwWritePm1Control (Pm1aControl, Pm1bControl); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -497,14 +446,13 @@ AcpiEnterSleepState ( * Wait ten seconds, then try again. This is to get S4/S5 to work on * all machines. * - * We wait so long to allow chipsets that poll this reg very slowly to - * still read the right value. Ideally, this block would go + * We wait so long to allow chipsets that poll this reg very slowly + * to still read the right value. Ideally, this block would go * away entirely. */ AcpiOsStall (10000000); - Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, - ACPI_REGISTER_PM1_CONTROL, + Status = AcpiHwRegisterWrite (ACPI_REGISTER_PM1_CONTROL, SleepEnableRegInfo->AccessBitMask); if (ACPI_FAILURE (Status)) { @@ -517,7 +465,7 @@ AcpiEnterSleepState ( Retry = 1000; do { - Status = AcpiGetRegister (ACPI_BITREG_WAKE_STATUS, &InValue); + Status = AcpiReadBitRegister (ACPI_BITREG_WAKE_STATUS, &InValue); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -566,7 +514,9 @@ AcpiEnterSleepStateS4bios ( ACPI_FUNCTION_TRACE (AcpiEnterSleepStateS4bios); - Status = AcpiSetRegister (ACPI_BITREG_WAKE_STATUS, 1); + /* Clear the wake status bit (PM1) */ + + Status = AcpiWriteBitRegister (ACPI_BITREG_WAKE_STATUS, ACPI_CLEAR_STATUS); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -597,12 +547,12 @@ AcpiEnterSleepStateS4bios ( ACPI_FLUSH_CPU_CACHE (); - Status = AcpiOsWritePort (AcpiGbl_FADT.SmiCommand, + Status = AcpiHwWritePort (AcpiGbl_FADT.SmiCommand, (UINT32) AcpiGbl_FADT.S4BiosRequest, 8); do { AcpiOsStall(1000); - Status = AcpiGetRegister (ACPI_BITREG_WAKE_STATUS, &InValue); + Status = AcpiReadBitRegister (ACPI_BITREG_WAKE_STATUS, &InValue); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -637,8 +587,8 @@ AcpiLeaveSleepState ( ACPI_STATUS Status; ACPI_BIT_REGISTER_INFO *SleepTypeRegInfo; ACPI_BIT_REGISTER_INFO *SleepEnableRegInfo; - UINT32 PM1AControl; - UINT32 PM1BControl; + UINT32 Pm1aControl; + UINT32 Pm1bControl; ACPI_FUNCTION_TRACE (AcpiLeaveSleepState); @@ -653,32 +603,33 @@ AcpiLeaveSleepState ( &AcpiGbl_SleepTypeA, &AcpiGbl_SleepTypeB); if (ACPI_SUCCESS (Status)) { - SleepTypeRegInfo = AcpiHwGetBitRegisterInfo (ACPI_BITREG_SLEEP_TYPE_A); - SleepEnableRegInfo = AcpiHwGetBitRegisterInfo (ACPI_BITREG_SLEEP_ENABLE); + SleepTypeRegInfo = + AcpiHwGetBitRegisterInfo (ACPI_BITREG_SLEEP_TYPE); + SleepEnableRegInfo = + AcpiHwGetBitRegisterInfo (ACPI_BITREG_SLEEP_ENABLE); /* Get current value of PM1A control */ - Status = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, - ACPI_REGISTER_PM1_CONTROL, &PM1AControl); + Status = AcpiHwRegisterRead (ACPI_REGISTER_PM1_CONTROL, + &Pm1aControl); if (ACPI_SUCCESS (Status)) { - /* Clear SLP_EN and SLP_TYP fields */ + /* Clear the SLP_EN and SLP_TYP fields */ - PM1AControl &= ~(SleepTypeRegInfo->AccessBitMask | - SleepEnableRegInfo->AccessBitMask); - PM1BControl = PM1AControl; + Pm1aControl &= ~(SleepTypeRegInfo->AccessBitMask | + SleepEnableRegInfo->AccessBitMask); + Pm1bControl = Pm1aControl; - /* Insert SLP_TYP bits */ + /* Insert the SLP_TYP bits */ - PM1AControl |= (AcpiGbl_SleepTypeA << SleepTypeRegInfo->BitPosition); - PM1BControl |= (AcpiGbl_SleepTypeB << SleepTypeRegInfo->BitPosition); + Pm1aControl |= (AcpiGbl_SleepTypeA << + SleepTypeRegInfo->BitPosition); + Pm1bControl |= (AcpiGbl_SleepTypeB << + SleepTypeRegInfo->BitPosition); - /* Just ignore any errors */ + /* Write the control registers and ignore any errors */ - (void) AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, - ACPI_REGISTER_PM1A_CONTROL, PM1AControl); - (void) AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, - ACPI_REGISTER_PM1B_CONTROL, PM1BControl); + (void) AcpiHwWritePm1Control (Pm1aControl, Pm1bControl); } } @@ -735,15 +686,17 @@ AcpiLeaveSleepState ( /* Enable power button */ - (void) AcpiSetRegister( - AcpiGbl_FixedEventInfo[ACPI_EVENT_POWER_BUTTON].EnableRegisterId, 1); + (void) AcpiWriteBitRegister( + AcpiGbl_FixedEventInfo[ACPI_EVENT_POWER_BUTTON].EnableRegisterId, + ACPI_ENABLE_EVENT); - (void) AcpiSetRegister( - AcpiGbl_FixedEventInfo[ACPI_EVENT_POWER_BUTTON].StatusRegisterId, 1); + (void) AcpiWriteBitRegister( + AcpiGbl_FixedEventInfo[ACPI_EVENT_POWER_BUTTON].StatusRegisterId, + ACPI_CLEAR_STATUS); /* Enable BM arbitration */ - Status = AcpiSetRegister (ACPI_BITREG_ARB_DISABLE, 0); + Status = AcpiWriteBitRegister (ACPI_BITREG_ARB_DISABLE, 0); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); diff --git a/sys/contrib/dev/acpica/hwtimer.c b/sys/contrib/dev/acpica/hardware/hwtimer.c index 78114e5096da..ad9934cdaaf9 100644 --- a/sys/contrib/dev/acpica/hwtimer.c +++ b/sys/contrib/dev/acpica/hardware/hwtimer.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Name: hwtimer.c - ACPI Power Management Timer Interface - * $Revision: 1.37 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -115,7 +114,8 @@ * *****************************************************************************/ -#include <contrib/dev/acpica/acpi.h> +#include "acpi.h" +#include "accommon.h" #define _COMPONENT ACPI_HARDWARE ACPI_MODULE_NAME ("hwtimer") @@ -187,7 +187,7 @@ AcpiGetTimer ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - Status = AcpiHwLowLevelRead (32, Ticks, &AcpiGbl_FADT.XPmTimerBlock); + Status = AcpiRead (Ticks, &AcpiGbl_FADT.XPmTimerBlock); return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/hardware/hwvalid.c b/sys/contrib/dev/acpica/hardware/hwvalid.c new file mode 100644 index 000000000000..650b695b2cc5 --- /dev/null +++ b/sys/contrib/dev/acpica/hardware/hwvalid.c @@ -0,0 +1,424 @@ + +/****************************************************************************** + * + * Module Name: hwvalid - I/O request validation + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2009, 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 __HWVALID_C__ + +#include "acpi.h" +#include "accommon.h" + +#define _COMPONENT ACPI_HARDWARE + ACPI_MODULE_NAME ("hwvalid") + +/* Local prototypes */ + +static ACPI_STATUS +AcpiHwValidateIoRequest ( + ACPI_IO_ADDRESS Address, + UINT32 BitWidth); + + +/* + * Protected I/O ports. Some ports are always illegal, and some are + * conditionally illegal. This table must remain ordered by port address. + * + * The table is used to implement the Microsoft port access rules that + * first appeared in Windows XP. Some ports are always illegal, and some + * ports are only illegal if the BIOS calls _OSI with a WinXP string or + * later (meaning that the BIOS itelf is post-XP.) + * + * This provides ACPICA with the desired port protections and + * Microsoft compatibility. + * + * Description of port entries: + * DMA: DMA controller + * PIC0: Programmable Interrupt Controller (8259A) + * PIT1: System Timer 1 + * PIT2: System Timer 2 failsafe + * RTC: Real-time clock + * CMOS: Extended CMOS + * DMA1: DMA 1 page registers + * DMA1L: DMA 1 Ch 0 low page + * DMA2: DMA 2 page registers + * DMA2L: DMA 2 low page refresh + * ARBC: Arbitration control + * SETUP: Reserved system board setup + * POS: POS channel select + * PIC1: Cascaded PIC + * IDMA: ISA DMA + * ELCR: PIC edge/level registers + * PCI: PCI configuration space + */ +static const ACPI_PORT_INFO AcpiProtectedPorts[] = +{ + {"DMA", 0x0000, 0x000F, ACPI_OSI_WIN_XP}, + {"PIC0", 0x0020, 0x0021, ACPI_ALWAYS_ILLEGAL}, + {"PIT1", 0x0040, 0x0043, ACPI_OSI_WIN_XP}, + {"PIT2", 0x0048, 0x004B, ACPI_OSI_WIN_XP}, + {"RTC", 0x0070, 0x0071, ACPI_OSI_WIN_XP}, + {"CMOS", 0x0074, 0x0076, ACPI_OSI_WIN_XP}, + {"DMA1", 0x0081, 0x0083, ACPI_OSI_WIN_XP}, + {"DMA1L", 0x0087, 0x0087, ACPI_OSI_WIN_XP}, + {"DMA2", 0x0089, 0x008B, ACPI_OSI_WIN_XP}, + {"DMA2L", 0x008F, 0x008F, ACPI_OSI_WIN_XP}, + {"ARBC", 0x0090, 0x0091, ACPI_OSI_WIN_XP}, + {"SETUP", 0x0093, 0x0094, ACPI_OSI_WIN_XP}, + {"POS", 0x0096, 0x0097, ACPI_OSI_WIN_XP}, + {"PIC1", 0x00A0, 0x00A1, ACPI_ALWAYS_ILLEGAL}, + {"IDMA", 0x00C0, 0x00DF, ACPI_OSI_WIN_XP}, + {"ELCR", 0x04D0, 0x04D1, ACPI_ALWAYS_ILLEGAL}, + {"PCI", 0x0CF8, 0x0CFF, ACPI_OSI_WIN_XP} +}; + +#define ACPI_PORT_INFO_ENTRIES ACPI_ARRAY_LENGTH (AcpiProtectedPorts) + + +/****************************************************************************** + * + * FUNCTION: AcpiHwValidateIoRequest + * + * PARAMETERS: Address Address of I/O port/register + * BitWidth Number of bits (8,16,32) + * + * RETURN: Status + * + * DESCRIPTION: Validates an I/O request (address/length). Certain ports are + * always illegal and some ports are only illegal depending on + * the requests the BIOS AML code makes to the predefined + * _OSI method. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiHwValidateIoRequest ( + ACPI_IO_ADDRESS Address, + UINT32 BitWidth) +{ + UINT32 i; + UINT32 ByteWidth; + ACPI_IO_ADDRESS LastAddress; + const ACPI_PORT_INFO *PortInfo; + + + ACPI_FUNCTION_TRACE (HwValidateIoRequest); + + + /* Supported widths are 8/16/32 */ + + if ((BitWidth != 8) && + (BitWidth != 16) && + (BitWidth != 32)) + { + return (AE_BAD_PARAMETER); + } + + PortInfo = AcpiProtectedPorts; + ByteWidth = ACPI_DIV_8 (BitWidth); + LastAddress = Address + ByteWidth - 1; + + ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Address %p LastAddress %p Length %X", + ACPI_CAST_PTR (void, Address), ACPI_CAST_PTR (void, LastAddress), + ByteWidth)); + + /* Maximum 16-bit address in I/O space */ + + if (LastAddress > ACPI_UINT16_MAX) + { + ACPI_ERROR ((AE_INFO, + "Illegal I/O port address/length above 64K: 0x%p/%X", + ACPI_CAST_PTR (void, Address), ByteWidth)); + return_ACPI_STATUS (AE_LIMIT); + } + + /* Exit if requested address is not within the protected port table */ + + if (Address > AcpiProtectedPorts[ACPI_PORT_INFO_ENTRIES - 1].End) + { + return_ACPI_STATUS (AE_OK); + } + + /* Check request against the list of protected I/O ports */ + + for (i = 0; i < ACPI_PORT_INFO_ENTRIES; i++, PortInfo++) + { + /* + * Check if the requested address range will write to a reserved + * port. Four cases to consider: + * + * 1) Address range is contained completely in the port address range + * 2) Address range overlaps port range at the port range start + * 3) Address range overlaps port range at the port range end + * 4) Address range completely encompasses the port range + */ + if ((Address <= PortInfo->End) && (LastAddress >= PortInfo->Start)) + { + /* Port illegality may depend on the _OSI calls made by the BIOS */ + + if (AcpiGbl_OsiData >= PortInfo->OsiDependency) + { + ACPI_DEBUG_PRINT ((ACPI_DB_IO, + "Denied AML access to port 0x%p/%X (%s 0x%.4X-0x%.4X)", + ACPI_CAST_PTR (void, Address), ByteWidth, PortInfo->Name, + PortInfo->Start, PortInfo->End)); + + return_ACPI_STATUS (AE_AML_ILLEGAL_ADDRESS); + } + } + + /* Finished if address range ends before the end of this port */ + + if (LastAddress <= PortInfo->End) + { + break; + } + } + + return_ACPI_STATUS (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiHwReadPort + * + * PARAMETERS: Address Address of I/O port/register to read + * Value Where value is placed + * Width Number of bits + * + * RETURN: Status and value read from port + * + * DESCRIPTION: Read data from an I/O port or register. This is a front-end + * to AcpiOsReadPort that performs validation on both the port + * address and the length. + * + *****************************************************************************/ + +ACPI_STATUS +AcpiHwReadPort ( + ACPI_IO_ADDRESS Address, + UINT32 *Value, + UINT32 Width) +{ + ACPI_STATUS Status; + UINT32 OneByte; + UINT32 i; + + + /* Validate the entire request and perform the I/O */ + + Status = AcpiHwValidateIoRequest (Address, Width); + if (ACPI_SUCCESS (Status)) + { + Status = AcpiOsReadPort (Address, Value, Width); + return (Status); + } + + if (Status != AE_AML_ILLEGAL_ADDRESS) + { + return (Status); + } + + /* + * There has been a protection violation within the request. Fall + * back to byte granularity port I/O and ignore the failing bytes. + * This provides Windows compatibility. + */ + for (i = 0, *Value = 0; i < Width; i += 8) + { + /* Validate and read one byte */ + + if (AcpiHwValidateIoRequest (Address, 8) == AE_OK) + { + Status = AcpiOsReadPort (Address, &OneByte, 8); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + *Value |= (OneByte << i); + } + + Address++; + } + + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiHwWritePort + * + * PARAMETERS: Address Address of I/O port/register to write + * Value Value to write + * Width Number of bits + * + * RETURN: Status + * + * DESCRIPTION: Write data to an I/O port or register. This is a front-end + * to AcpiOsWritePort that performs validation on both the port + * address and the length. + * + *****************************************************************************/ + +ACPI_STATUS +AcpiHwWritePort ( + ACPI_IO_ADDRESS Address, + UINT32 Value, + UINT32 Width) +{ + ACPI_STATUS Status; + UINT32 i; + + + /* Validate the entire request and perform the I/O */ + + Status = AcpiHwValidateIoRequest (Address, Width); + if (ACPI_SUCCESS (Status)) + { + Status = AcpiOsWritePort (Address, Value, Width); + return (Status); + } + + if (Status != AE_AML_ILLEGAL_ADDRESS) + { + return (Status); + } + + /* + * There has been a protection violation within the request. Fall + * back to byte granularity port I/O and ignore the failing bytes. + * This provides Windows compatibility. + */ + for (i = 0; i < Width; i += 8) + { + /* Validate and write one byte */ + + if (AcpiHwValidateIoRequest (Address, 8) == AE_OK) + { + Status = AcpiOsWritePort (Address, (Value >> i) & 0xFF, 8); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + } + + Address++; + } + + return (AE_OK); +} + + diff --git a/sys/contrib/dev/acpica/hardware/hwxface.c b/sys/contrib/dev/acpica/hardware/hwxface.c new file mode 100644 index 000000000000..63641d38935a --- /dev/null +++ b/sys/contrib/dev/acpica/hardware/hwxface.c @@ -0,0 +1,660 @@ + +/****************************************************************************** + * + * Module Name: hwxface - Public ACPICA hardware interfaces + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2009, 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 "acpi.h" +#include "accommon.h" +#include "acnamesp.h" + +#define _COMPONENT ACPI_HARDWARE + ACPI_MODULE_NAME ("hwxface") + + +/****************************************************************************** + * + * FUNCTION: AcpiReset + * + * PARAMETERS: None + * + * RETURN: Status + * + * DESCRIPTION: Set reset register in memory or IO space. Note: Does not + * support reset register in PCI config space, this must be + * handled separately. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiReset ( + void) +{ + ACPI_GENERIC_ADDRESS *ResetReg; + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (AcpiReset); + + + ResetReg = &AcpiGbl_FADT.ResetRegister; + + /* Check if the reset register is supported */ + + if (!(AcpiGbl_FADT.Flags & ACPI_FADT_RESET_REGISTER) || + !ResetReg->Address) + { + return_ACPI_STATUS (AE_NOT_EXIST); + } + + /* Write the reset value to the reset register */ + + Status = AcpiWrite (AcpiGbl_FADT.ResetValue, ResetReg); + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiReset) + + +/****************************************************************************** + * + * FUNCTION: AcpiRead + * + * PARAMETERS: Value - Where the value is returned + * Reg - GAS register structure + * + * RETURN: Status + * + * DESCRIPTION: Read from either memory or IO space. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiRead ( + UINT32 *Value, + ACPI_GENERIC_ADDRESS *Reg) +{ + UINT32 Width; + UINT64 Address; + ACPI_STATUS Status; + + + ACPI_FUNCTION_NAME (AcpiRead); + + + /* + * 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 */ + + ACPI_MOVE_64_TO_64 (&Address, &Reg->Address); + if (!Address) + { + return (AE_BAD_ADDRESS); + } + + /* Supported widths are 8/16/32 */ + + Width = Reg->BitWidth; + if ((Width != 8) && (Width != 16) && (Width != 32)) + { + return (AE_SUPPORT); + } + + /* 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 + */ + switch (Reg->SpaceId) + { + 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; + + + default: + ACPI_ERROR ((AE_INFO, + "Unsupported address space: %X", Reg->SpaceId)); + return (AE_BAD_PARAMETER); + } + + ACPI_DEBUG_PRINT ((ACPI_DB_IO, + "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n", + *Value, Width, ACPI_FORMAT_UINT64 (Address), + AcpiUtGetRegionName (Reg->SpaceId))); + + return (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiRead) + + +/****************************************************************************** + * + * FUNCTION: AcpiWrite + * + * PARAMETERS: Value - To be written + * Reg - GAS register structure + * + * RETURN: Status + * + * DESCRIPTION: Write to either memory or IO space. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiWrite ( + UINT32 Value, + ACPI_GENERIC_ADDRESS *Reg) +{ + UINT32 Width; + UINT64 Address; + ACPI_STATUS Status; + + + 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 */ + + ACPI_MOVE_64_TO_64 (&Address, &Reg->Address); + if (!Address) + { + return (AE_BAD_ADDRESS); + } + + /* Supported widths are 8/16/32 */ + + Width = Reg->BitWidth; + if ((Width != 8) && (Width != 16) && (Width != 32)) + { + return (AE_SUPPORT); + } + + /* + * Two address spaces supported: Memory or IO. + * PCI_Config is not supported here because the GAS struct is insufficient + */ + switch (Reg->SpaceId) + { + 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; + + + default: + ACPI_ERROR ((AE_INFO, + "Unsupported address space: %X", Reg->SpaceId)); + return (AE_BAD_PARAMETER); + } + + ACPI_DEBUG_PRINT ((ACPI_DB_IO, + "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n", + Value, Width, ACPI_FORMAT_UINT64 (Address), + AcpiUtGetRegionName (Reg->SpaceId))); + + return (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiWrite) + + +/******************************************************************************* + * + * FUNCTION: AcpiReadBitRegister + * + * PARAMETERS: RegisterId - ID of ACPI Bit Register to access + * ReturnValue - Value that was read from the register, + * normalized to bit position zero. + * + * RETURN: Status and the value read from the specified Register. Value + * returned is normalized to bit0 (is shifted all the way right) + * + * DESCRIPTION: ACPI BitRegister read function. Does not acquire the HW lock. + * + * SUPPORTS: Bit fields in PM1 Status, PM1 Enable, PM1 Control, and + * PM2 Control. + * + * Note: The hardware lock is not required when reading the ACPI bit registers + * since almost all of them are single bit and it does not matter that + * the parent hardware register can be split across two physical + * registers. The only multi-bit field is SLP_TYP in the PM1 control + * register, but this field does not cross an 8-bit boundary (nor does + * it make much sense to actually read this field.) + * + ******************************************************************************/ + +ACPI_STATUS +AcpiReadBitRegister ( + UINT32 RegisterId, + UINT32 *ReturnValue) +{ + ACPI_BIT_REGISTER_INFO *BitRegInfo; + UINT32 RegisterValue; + UINT32 Value; + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE_U32 (AcpiReadBitRegister, RegisterId); + + + /* Get the info structure corresponding to the requested ACPI Register */ + + BitRegInfo = AcpiHwGetBitRegisterInfo (RegisterId); + if (!BitRegInfo) + { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + + /* Read the entire parent register */ + + Status = AcpiHwRegisterRead (BitRegInfo->ParentRegister, + &RegisterValue); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* Normalize the value that was read, mask off other bits */ + + Value = ((RegisterValue & BitRegInfo->AccessBitMask) + >> BitRegInfo->BitPosition); + + ACPI_DEBUG_PRINT ((ACPI_DB_IO, + "BitReg %X, ParentReg %X, Actual %8.8X, ReturnValue %8.8X\n", + RegisterId, BitRegInfo->ParentRegister, RegisterValue, Value)); + + *ReturnValue = Value; + return_ACPI_STATUS (AE_OK); +} + +ACPI_EXPORT_SYMBOL (AcpiReadBitRegister) + + +/******************************************************************************* + * + * FUNCTION: AcpiWriteBitRegister + * + * PARAMETERS: RegisterId - ID of ACPI Bit Register to access + * Value - Value to write to the register, in bit + * position zero. The bit is automaticallly + * shifted to the correct position. + * + * RETURN: Status + * + * DESCRIPTION: ACPI Bit Register write function. Acquires the hardware lock + * since most operations require a read/modify/write sequence. + * + * SUPPORTS: Bit fields in PM1 Status, PM1 Enable, PM1 Control, and + * PM2 Control. + * + * Note that at this level, the fact that there may be actually two + * hardware registers (A and B - and B may not exist) is abstracted. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiWriteBitRegister ( + UINT32 RegisterId, + UINT32 Value) +{ + ACPI_BIT_REGISTER_INFO *BitRegInfo; + ACPI_CPU_FLAGS LockFlags; + UINT32 RegisterValue; + ACPI_STATUS Status = AE_OK; + + + ACPI_FUNCTION_TRACE_U32 (AcpiWriteBitRegister, RegisterId); + + + /* Get the info structure corresponding to the requested ACPI Register */ + + BitRegInfo = AcpiHwGetBitRegisterInfo (RegisterId); + if (!BitRegInfo) + { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + + LockFlags = AcpiOsAcquireLock (AcpiGbl_HardwareLock); + + /* + * At this point, we know that the parent register is one of the + * following: PM1 Status, PM1 Enable, PM1 Control, or PM2 Control + */ + if (BitRegInfo->ParentRegister != ACPI_REGISTER_PM1_STATUS) + { + /* + * 1) Case for PM1 Enable, PM1 Control, and PM2 Control + * + * Perform a register read to preserve the bits that we are not + * interested in + */ + Status = AcpiHwRegisterRead (BitRegInfo->ParentRegister, + &RegisterValue); + if (ACPI_FAILURE (Status)) + { + goto UnlockAndExit; + } + + /* + * Insert the input bit into the value that was just read + * and write the register + */ + ACPI_REGISTER_INSERT_VALUE (RegisterValue, BitRegInfo->BitPosition, + BitRegInfo->AccessBitMask, Value); + + Status = AcpiHwRegisterWrite (BitRegInfo->ParentRegister, + RegisterValue); + } + else + { + /* + * 2) Case for PM1 Status + * + * The Status register is different from the rest. Clear an event + * by writing 1, writing 0 has no effect. So, the only relevant + * information is the single bit we're interested in, all others + * should be written as 0 so they will be left unchanged. + */ + RegisterValue = ACPI_REGISTER_PREPARE_BITS (Value, + BitRegInfo->BitPosition, BitRegInfo->AccessBitMask); + + /* No need to write the register if value is all zeros */ + + if (RegisterValue) + { + Status = AcpiHwRegisterWrite (ACPI_REGISTER_PM1_STATUS, + RegisterValue); + } + } + + ACPI_DEBUG_PRINT ((ACPI_DB_IO, + "BitReg %X, ParentReg %X, Value %8.8X, Actual %8.8X\n", + RegisterId, BitRegInfo->ParentRegister, Value, RegisterValue)); + + +UnlockAndExit: + + AcpiOsReleaseLock (AcpiGbl_HardwareLock, LockFlags); + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiWriteBitRegister) + + +/******************************************************************************* + * + * FUNCTION: AcpiGetSleepTypeData + * + * PARAMETERS: SleepState - Numeric sleep state + * *SleepTypeA - Where SLP_TYPa is returned + * *SleepTypeB - Where SLP_TYPb is returned + * + * RETURN: Status - ACPI status + * + * DESCRIPTION: Obtain the SLP_TYPa and SLP_TYPb values for the requested sleep + * state. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiGetSleepTypeData ( + UINT8 SleepState, + UINT8 *SleepTypeA, + UINT8 *SleepTypeB) +{ + ACPI_STATUS Status = AE_OK; + ACPI_EVALUATE_INFO *Info; + + + ACPI_FUNCTION_TRACE (AcpiGetSleepTypeData); + + + /* Validate parameters */ + + if ((SleepState > ACPI_S_STATES_MAX) || + !SleepTypeA || + !SleepTypeB) + { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + + /* Allocate the evaluation information block */ + + Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO)); + if (!Info) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + + Info->Pathname = ACPI_CAST_PTR (char, AcpiGbl_SleepStateNames[SleepState]); + + /* Evaluate the namespace object containing the values for this state */ + + Status = AcpiNsEvaluate (Info); + if (ACPI_FAILURE (Status)) + { + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "%s while evaluating SleepState [%s]\n", + AcpiFormatException (Status), Info->Pathname)); + + goto Cleanup; + } + + /* Must have a return object */ + + if (!Info->ReturnObject) + { + ACPI_ERROR ((AE_INFO, "No Sleep State object returned from [%s]", + Info->Pathname)); + Status = AE_NOT_EXIST; + } + + /* It must be of type Package */ + + else if (Info->ReturnObject->Common.Type != ACPI_TYPE_PACKAGE) + { + ACPI_ERROR ((AE_INFO, "Sleep State return object is not a Package")); + Status = AE_AML_OPERAND_TYPE; + } + + /* + * The package must have at least two elements. NOTE (March 2005): This + * goes against the current ACPI spec which defines this object as a + * package with one encoded DWORD element. However, existing practice + * by BIOS vendors seems to be to have 2 or more elements, at least + * one per sleep type (A/B). + */ + else if (Info->ReturnObject->Package.Count < 2) + { + ACPI_ERROR ((AE_INFO, + "Sleep State return package does not have at least two elements")); + Status = AE_AML_NO_OPERAND; + } + + /* The first two elements must both be of type Integer */ + + else if (((Info->ReturnObject->Package.Elements[0])->Common.Type + != ACPI_TYPE_INTEGER) || + ((Info->ReturnObject->Package.Elements[1])->Common.Type + != ACPI_TYPE_INTEGER)) + { + ACPI_ERROR ((AE_INFO, + "Sleep State return package elements are not both Integers " + "(%s, %s)", + AcpiUtGetObjectTypeName (Info->ReturnObject->Package.Elements[0]), + AcpiUtGetObjectTypeName (Info->ReturnObject->Package.Elements[1]))); + Status = AE_AML_OPERAND_TYPE; + } + else + { + /* Valid _Sx_ package size, type, and value */ + + *SleepTypeA = (UINT8) + (Info->ReturnObject->Package.Elements[0])->Integer.Value; + *SleepTypeB = (UINT8) + (Info->ReturnObject->Package.Elements[1])->Integer.Value; + } + + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, Status, + "While evaluating SleepState [%s], bad Sleep object %p type %s", + Info->Pathname, Info->ReturnObject, + AcpiUtGetObjectTypeName (Info->ReturnObject))); + } + + AcpiUtRemoveReference (Info->ReturnObject); + +Cleanup: + ACPI_FREE (Info); + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiGetSleepTypeData) diff --git a/sys/contrib/dev/acpica/hwregs.c b/sys/contrib/dev/acpica/hwregs.c deleted file mode 100644 index 36cc47bc0cf5..000000000000 --- a/sys/contrib/dev/acpica/hwregs.c +++ /dev/null @@ -1,1001 +0,0 @@ - -/******************************************************************************* - * - * Module Name: hwregs - Read/write access functions for the various ACPI - * control and status registers. - * $Revision: 1.187 $ - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2007, 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 __HWREGS_C__ - -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/acevents.h> - -#define _COMPONENT ACPI_HARDWARE - ACPI_MODULE_NAME ("hwregs") - - -/******************************************************************************* - * - * FUNCTION: AcpiHwClearAcpiStatus - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Clears all fixed and general purpose status bits - * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED - * - ******************************************************************************/ - -ACPI_STATUS -AcpiHwClearAcpiStatus ( - void) -{ - ACPI_STATUS Status; - ACPI_CPU_FLAGS LockFlags = 0; - - - ACPI_FUNCTION_TRACE (HwClearAcpiStatus); - - - ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %04X to %04X\n", - ACPI_BITMASK_ALL_FIXED_STATUS, - (UINT16) AcpiGbl_FADT.XPm1aEventBlock.Address)); - - LockFlags = AcpiOsAcquireLock (AcpiGbl_HardwareLock); - - Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, - ACPI_REGISTER_PM1_STATUS, - ACPI_BITMASK_ALL_FIXED_STATUS); - if (ACPI_FAILURE (Status)) - { - goto UnlockAndExit; - } - - /* Clear the fixed events */ - - if (AcpiGbl_FADT.XPm1bEventBlock.Address) - { - Status = AcpiHwLowLevelWrite (16, ACPI_BITMASK_ALL_FIXED_STATUS, - &AcpiGbl_FADT.XPm1bEventBlock); - if (ACPI_FAILURE (Status)) - { - goto UnlockAndExit; - } - } - - /* Clear the GPE Bits in all GPE registers in all GPE blocks */ - - Status = AcpiEvWalkGpeList (AcpiHwClearGpeBlock); - -UnlockAndExit: - AcpiOsReleaseLock (AcpiGbl_HardwareLock, LockFlags); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiGetSleepTypeData - * - * PARAMETERS: SleepState - Numeric sleep state - * *SleepTypeA - Where SLP_TYPa is returned - * *SleepTypeB - Where SLP_TYPb is returned - * - * RETURN: Status - ACPI status - * - * DESCRIPTION: Obtain the SLP_TYPa and SLP_TYPb values for the requested sleep - * state. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiGetSleepTypeData ( - UINT8 SleepState, - UINT8 *SleepTypeA, - UINT8 *SleepTypeB) -{ - ACPI_STATUS Status = AE_OK; - ACPI_EVALUATE_INFO *Info; - - - ACPI_FUNCTION_TRACE (AcpiGetSleepTypeData); - - - /* Validate parameters */ - - if ((SleepState > ACPI_S_STATES_MAX) || - !SleepTypeA || !SleepTypeB) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - /* Allocate the evaluation information block */ - - Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO)); - if (!Info) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - Info->Pathname = ACPI_CAST_PTR (char, AcpiGbl_SleepStateNames[SleepState]); - - /* Evaluate the namespace object containing the values for this state */ - - Status = AcpiNsEvaluate (Info); - if (ACPI_FAILURE (Status)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "%s while evaluating SleepState [%s]\n", - AcpiFormatException (Status), Info->Pathname)); - - goto Cleanup; - } - - /* Must have a return object */ - - if (!Info->ReturnObject) - { - ACPI_ERROR ((AE_INFO, "No Sleep State object returned from [%s]", - Info->Pathname)); - Status = AE_NOT_EXIST; - } - - /* It must be of type Package */ - - else if (ACPI_GET_OBJECT_TYPE (Info->ReturnObject) != ACPI_TYPE_PACKAGE) - { - ACPI_ERROR ((AE_INFO, "Sleep State return object is not a Package")); - Status = AE_AML_OPERAND_TYPE; - } - - /* - * The package must have at least two elements. NOTE (March 2005): This - * goes against the current ACPI spec which defines this object as a - * package with one encoded DWORD element. However, existing practice - * by BIOS vendors seems to be to have 2 or more elements, at least - * one per sleep type (A/B). - */ - else if (Info->ReturnObject->Package.Count < 2) - { - ACPI_ERROR ((AE_INFO, - "Sleep State return package does not have at least two elements")); - Status = AE_AML_NO_OPERAND; - } - - /* The first two elements must both be of type Integer */ - - else if ((ACPI_GET_OBJECT_TYPE (Info->ReturnObject->Package.Elements[0]) - != ACPI_TYPE_INTEGER) || - (ACPI_GET_OBJECT_TYPE (Info->ReturnObject->Package.Elements[1]) - != ACPI_TYPE_INTEGER)) - { - ACPI_ERROR ((AE_INFO, - "Sleep State return package elements are not both Integers (%s, %s)", - AcpiUtGetObjectTypeName (Info->ReturnObject->Package.Elements[0]), - AcpiUtGetObjectTypeName (Info->ReturnObject->Package.Elements[1]))); - Status = AE_AML_OPERAND_TYPE; - } - else - { - /* Valid _Sx_ package size, type, and value */ - - *SleepTypeA = (UINT8) - (Info->ReturnObject->Package.Elements[0])->Integer.Value; - *SleepTypeB = (UINT8) - (Info->ReturnObject->Package.Elements[1])->Integer.Value; - } - - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "While evaluating SleepState [%s], bad Sleep object %p type %s", - Info->Pathname, Info->ReturnObject, - AcpiUtGetObjectTypeName (Info->ReturnObject))); - } - - AcpiUtRemoveReference (Info->ReturnObject); - -Cleanup: - ACPI_FREE (Info); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiGetSleepTypeData) - - -/******************************************************************************* - * - * FUNCTION: AcpiHwGetRegisterBitMask - * - * PARAMETERS: RegisterId - Index of ACPI Register to access - * - * RETURN: The bitmask to be used when accessing the register - * - * DESCRIPTION: Map RegisterId into a register bitmask. - * - ******************************************************************************/ - -ACPI_BIT_REGISTER_INFO * -AcpiHwGetBitRegisterInfo ( - UINT32 RegisterId) -{ - ACPI_FUNCTION_ENTRY (); - - - if (RegisterId > ACPI_BITREG_MAX) - { - ACPI_ERROR ((AE_INFO, "Invalid BitRegister ID: %X", RegisterId)); - return (NULL); - } - - return (&AcpiGbl_BitRegisterInfo[RegisterId]); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiGetRegister - * - * PARAMETERS: RegisterId - ID of ACPI BitRegister to access - * ReturnValue - Value that was read from the register - * - * RETURN: Status and the value read from specified Register. Value - * returned is normalized to bit0 (is shifted all the way right) - * - * DESCRIPTION: ACPI BitRegister read function. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiGetRegister ( - UINT32 RegisterId, - UINT32 *ReturnValue) -{ - UINT32 RegisterValue = 0; - ACPI_BIT_REGISTER_INFO *BitRegInfo; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE (AcpiGetRegister); - - - /* Get the info structure corresponding to the requested ACPI Register */ - - BitRegInfo = AcpiHwGetBitRegisterInfo (RegisterId); - if (!BitRegInfo) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - /* Read from the register */ - - Status = AcpiHwRegisterRead (ACPI_MTX_LOCK, - BitRegInfo->ParentRegister, &RegisterValue); - - if (ACPI_SUCCESS (Status)) - { - /* Normalize the value that was read */ - - RegisterValue = ((RegisterValue & BitRegInfo->AccessBitMask) - >> BitRegInfo->BitPosition); - - *ReturnValue = RegisterValue; - - ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Read value %8.8X register %X\n", - RegisterValue, BitRegInfo->ParentRegister)); - } - - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiGetRegister) - - -/******************************************************************************* - * - * FUNCTION: AcpiSetRegister - * - * PARAMETERS: RegisterId - ID of ACPI BitRegister to access - * Value - (only used on write) value to write to the - * Register, NOT pre-normalized to the bit pos - * - * RETURN: Status - * - * DESCRIPTION: ACPI Bit Register write function. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiSetRegister ( - UINT32 RegisterId, - UINT32 Value) -{ - UINT32 RegisterValue = 0; - ACPI_BIT_REGISTER_INFO *BitRegInfo; - ACPI_STATUS Status; - ACPI_CPU_FLAGS LockFlags; - - - ACPI_FUNCTION_TRACE_U32 (AcpiSetRegister, RegisterId); - - - /* Get the info structure corresponding to the requested ACPI Register */ - - BitRegInfo = AcpiHwGetBitRegisterInfo (RegisterId); - if (!BitRegInfo) - { - ACPI_ERROR ((AE_INFO, "Bad ACPI HW RegisterId: %X", RegisterId)); - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - LockFlags = AcpiOsAcquireLock (AcpiGbl_HardwareLock); - - /* Always do a register read first so we can insert the new bits */ - - Status = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, - BitRegInfo->ParentRegister, &RegisterValue); - if (ACPI_FAILURE (Status)) - { - goto UnlockAndExit; - } - - /* - * Decode the Register ID - * Register ID = [Register block ID] | [bit ID] - * - * Check bit ID to fine locate Register offset. - * Check Mask to determine Register offset, and then read-write. - */ - switch (BitRegInfo->ParentRegister) - { - case ACPI_REGISTER_PM1_STATUS: - - /* - * Status Registers are different from the rest. Clear by - * writing 1, and writing 0 has no effect. So, the only relevant - * information is the single bit we're interested in, all others should - * be written as 0 so they will be left unchanged. - */ - Value = ACPI_REGISTER_PREPARE_BITS (Value, - BitRegInfo->BitPosition, BitRegInfo->AccessBitMask); - if (Value) - { - Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, - ACPI_REGISTER_PM1_STATUS, (UINT16) Value); - RegisterValue = 0; - } - break; - - - case ACPI_REGISTER_PM1_ENABLE: - - ACPI_REGISTER_INSERT_VALUE (RegisterValue, BitRegInfo->BitPosition, - BitRegInfo->AccessBitMask, Value); - - Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, - ACPI_REGISTER_PM1_ENABLE, (UINT16) RegisterValue); - break; - - - case ACPI_REGISTER_PM1_CONTROL: - - /* - * Write the PM1 Control register. - * Note that at this level, the fact that there are actually TWO - * registers (A and B - and B may not exist) is abstracted. - */ - ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM1 control: Read %X\n", - RegisterValue)); - - ACPI_REGISTER_INSERT_VALUE (RegisterValue, BitRegInfo->BitPosition, - BitRegInfo->AccessBitMask, Value); - - Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, - ACPI_REGISTER_PM1_CONTROL, (UINT16) RegisterValue); - break; - - - case ACPI_REGISTER_PM2_CONTROL: - - Status = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, - ACPI_REGISTER_PM2_CONTROL, &RegisterValue); - if (ACPI_FAILURE (Status)) - { - goto UnlockAndExit; - } - - ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM2 control: Read %X from %8.8X%8.8X\n", - RegisterValue, - ACPI_FORMAT_UINT64 (AcpiGbl_FADT.XPm2ControlBlock.Address))); - - ACPI_REGISTER_INSERT_VALUE (RegisterValue, BitRegInfo->BitPosition, - BitRegInfo->AccessBitMask, Value); - - ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %4.4X to %8.8X%8.8X\n", - RegisterValue, - ACPI_FORMAT_UINT64 (AcpiGbl_FADT.XPm2ControlBlock.Address))); - - Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, - ACPI_REGISTER_PM2_CONTROL, (UINT8) (RegisterValue)); - break; - - - default: - break; - } - - -UnlockAndExit: - - AcpiOsReleaseLock (AcpiGbl_HardwareLock, LockFlags); - - /* Normalize the value that was read */ - - ACPI_DEBUG_EXEC (RegisterValue = - ((RegisterValue & BitRegInfo->AccessBitMask) >> - BitRegInfo->BitPosition)); - - ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Set bits: %8.8X actual %8.8X register %X\n", - Value, RegisterValue, BitRegInfo->ParentRegister)); - return_ACPI_STATUS (Status); -} - -ACPI_EXPORT_SYMBOL (AcpiSetRegister) - - -/****************************************************************************** - * - * FUNCTION: AcpiHwRegisterRead - * - * PARAMETERS: UseLock - Lock hardware? True/False - * RegisterId - ACPI Register ID - * ReturnValue - Where the register value is returned - * - * RETURN: Status and the value read. - * - * DESCRIPTION: Read from the specified ACPI register - * - ******************************************************************************/ - -ACPI_STATUS -AcpiHwRegisterRead ( - BOOLEAN UseLock, - UINT32 RegisterId, - UINT32 *ReturnValue) -{ - UINT32 Value1 = 0; - UINT32 Value2 = 0; - ACPI_STATUS Status; - ACPI_CPU_FLAGS LockFlags = 0; - - - ACPI_FUNCTION_TRACE (HwRegisterRead); - - - if (ACPI_MTX_LOCK == UseLock) - { - LockFlags = AcpiOsAcquireLock (AcpiGbl_HardwareLock); - } - - switch (RegisterId) - { - case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */ - - Status = AcpiHwLowLevelRead (16, &Value1, &AcpiGbl_FADT.XPm1aEventBlock); - if (ACPI_FAILURE (Status)) - { - goto UnlockAndExit; - } - - /* PM1B is optional */ - - Status = AcpiHwLowLevelRead (16, &Value2, &AcpiGbl_FADT.XPm1bEventBlock); - Value1 |= Value2; - break; - - - case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access */ - - Status = AcpiHwLowLevelRead (16, &Value1, &AcpiGbl_XPm1aEnable); - if (ACPI_FAILURE (Status)) - { - goto UnlockAndExit; - } - - /* PM1B is optional */ - - Status = AcpiHwLowLevelRead (16, &Value2, &AcpiGbl_XPm1bEnable); - Value1 |= Value2; - break; - - - case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */ - - Status = AcpiHwLowLevelRead (16, &Value1, &AcpiGbl_FADT.XPm1aControlBlock); - if (ACPI_FAILURE (Status)) - { - goto UnlockAndExit; - } - - Status = AcpiHwLowLevelRead (16, &Value2, &AcpiGbl_FADT.XPm1bControlBlock); - Value1 |= Value2; - break; - - - case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */ - - Status = AcpiHwLowLevelRead (8, &Value1, &AcpiGbl_FADT.XPm2ControlBlock); - break; - - - case ACPI_REGISTER_PM_TIMER: /* 32-bit access */ - - Status = AcpiHwLowLevelRead (32, &Value1, &AcpiGbl_FADT.XPmTimerBlock); - break; - - case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */ - - Status = AcpiOsReadPort (AcpiGbl_FADT.SmiCommand, &Value1, 8); - break; - - default: - ACPI_ERROR ((AE_INFO, "Unknown Register ID: %X", - RegisterId)); - Status = AE_BAD_PARAMETER; - break; - } - -UnlockAndExit: - if (ACPI_MTX_LOCK == UseLock) - { - AcpiOsReleaseLock (AcpiGbl_HardwareLock, LockFlags); - } - - if (ACPI_SUCCESS (Status)) - { - *ReturnValue = Value1; - } - - return_ACPI_STATUS (Status); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiHwRegisterWrite - * - * PARAMETERS: UseLock - Lock hardware? True/False - * RegisterId - ACPI Register ID - * Value - The value to write - * - * RETURN: Status - * - * DESCRIPTION: Write to the specified ACPI register - * - * NOTE: In accordance with the ACPI specification, this function automatically - * preserves the value of the following bits, meaning that these bits cannot be - * changed via this interface: - * - * PM1_CONTROL[0] = SCI_EN - * PM1_CONTROL[9] - * PM1_STATUS[11] - * - * ACPI References: - * 1) Hardware Ignored Bits: When software writes to a register with ignored - * bit fields, it preserves the ignored bit fields - * 2) SCI_EN: OSPM always preserves this bit position - * - ******************************************************************************/ - -ACPI_STATUS -AcpiHwRegisterWrite ( - BOOLEAN UseLock, - UINT32 RegisterId, - UINT32 Value) -{ - ACPI_STATUS Status; - ACPI_CPU_FLAGS LockFlags = 0; - UINT32 ReadValue; - - - ACPI_FUNCTION_TRACE (HwRegisterWrite); - - - if (ACPI_MTX_LOCK == UseLock) - { - LockFlags = AcpiOsAcquireLock (AcpiGbl_HardwareLock); - } - - switch (RegisterId) - { - case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */ - - /* Perform a read first to preserve certain bits (per ACPI spec) */ - - Status = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, - ACPI_REGISTER_PM1_STATUS, &ReadValue); - if (ACPI_FAILURE (Status)) - { - goto UnlockAndExit; - } - - /* Insert the bits to be preserved */ - - ACPI_INSERT_BITS (Value, ACPI_PM1_STATUS_PRESERVED_BITS, ReadValue); - - /* Now we can write the data */ - - Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT.XPm1aEventBlock); - if (ACPI_FAILURE (Status)) - { - goto UnlockAndExit; - } - - /* PM1B is optional */ - - Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT.XPm1bEventBlock); - break; - - - case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access */ - - Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_XPm1aEnable); - if (ACPI_FAILURE (Status)) - { - goto UnlockAndExit; - } - - /* PM1B is optional */ - - Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_XPm1bEnable); - break; - - - case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */ - - /* - * Perform a read first to preserve certain bits (per ACPI spec) - * - * Note: This includes SCI_EN, we never want to change this bit - */ - Status = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, - ACPI_REGISTER_PM1_CONTROL, &ReadValue); - if (ACPI_FAILURE (Status)) - { - goto UnlockAndExit; - } - - /* Insert the bits to be preserved */ - - ACPI_INSERT_BITS (Value, ACPI_PM1_CONTROL_PRESERVED_BITS, ReadValue); - - /* Now we can write the data */ - - Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT.XPm1aControlBlock); - if (ACPI_FAILURE (Status)) - { - goto UnlockAndExit; - } - - Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT.XPm1bControlBlock); - break; - - - case ACPI_REGISTER_PM1A_CONTROL: /* 16-bit access */ - - Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT.XPm1aControlBlock); - break; - - - case ACPI_REGISTER_PM1B_CONTROL: /* 16-bit access */ - - Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT.XPm1bControlBlock); - break; - - - case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */ - - Status = AcpiHwLowLevelWrite (8, Value, &AcpiGbl_FADT.XPm2ControlBlock); - break; - - - case ACPI_REGISTER_PM_TIMER: /* 32-bit access */ - - Status = AcpiHwLowLevelWrite (32, Value, &AcpiGbl_FADT.XPmTimerBlock); - break; - - - case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */ - - /* SMI_CMD is currently always in IO space */ - - Status = AcpiOsWritePort (AcpiGbl_FADT.SmiCommand, Value, 8); - break; - - - default: - Status = AE_BAD_PARAMETER; - break; - } - -UnlockAndExit: - if (ACPI_MTX_LOCK == UseLock) - { - AcpiOsReleaseLock (AcpiGbl_HardwareLock, LockFlags); - } - - return_ACPI_STATUS (Status); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiHwLowLevelRead - * - * PARAMETERS: Width - 8, 16, or 32 - * Value - Where the value is returned - * Reg - GAS register structure - * - * RETURN: Status - * - * DESCRIPTION: Read from either memory or IO space. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiHwLowLevelRead ( - UINT32 Width, - UINT32 *Value, - ACPI_GENERIC_ADDRESS *Reg) -{ - UINT64 Address; - ACPI_STATUS Status; - - - ACPI_FUNCTION_NAME (HwLowLevelRead); - - - /* - * Must have a valid pointer to a GAS structure, and - * a non-zero address within. However, don't return an error - * because the PM1A/B code must not fail if B isn't present. - */ - if (!Reg) - { - return (AE_OK); - } - - /* Get a local copy of the address. Handles possible alignment issues */ - - ACPI_MOVE_64_TO_64 (&Address, &Reg->Address); - if (!Address) - { - return (AE_OK); - } - *Value = 0; - - /* - * Two address spaces supported: Memory or IO. - * PCI_Config is not supported here because the GAS struct is insufficient - */ - switch (Reg->SpaceId) - { - case ACPI_ADR_SPACE_SYSTEM_MEMORY: - - Status = AcpiOsReadMemory ( - (ACPI_PHYSICAL_ADDRESS) Address, Value, Width); - break; - - - case ACPI_ADR_SPACE_SYSTEM_IO: - - Status = AcpiOsReadPort ((ACPI_IO_ADDRESS) Address, Value, Width); - break; - - - default: - ACPI_ERROR ((AE_INFO, - "Unsupported address space: %X", Reg->SpaceId)); - return (AE_BAD_PARAMETER); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_IO, - "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n", - *Value, Width, ACPI_FORMAT_UINT64 (Address), - AcpiUtGetRegionName (Reg->SpaceId))); - - return (Status); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiHwLowLevelWrite - * - * PARAMETERS: Width - 8, 16, or 32 - * Value - To be written - * Reg - GAS register structure - * - * RETURN: Status - * - * DESCRIPTION: Write to either memory or IO space. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiHwLowLevelWrite ( - UINT32 Width, - UINT32 Value, - ACPI_GENERIC_ADDRESS *Reg) -{ - UINT64 Address; - ACPI_STATUS Status; - - - ACPI_FUNCTION_NAME (HwLowLevelWrite); - - - /* - * Must have a valid pointer to a GAS structure, and - * a non-zero address within. However, don't return an error - * because the PM1A/B code must not fail if B isn't present. - */ - if (!Reg) - { - return (AE_OK); - } - - /* Get a local copy of the address. Handles possible alignment issues */ - - ACPI_MOVE_64_TO_64 (&Address, &Reg->Address); - if (!Address) - { - return (AE_OK); - } - - /* - * Two address spaces supported: Memory or IO. - * PCI_Config is not supported here because the GAS struct is insufficient - */ - switch (Reg->SpaceId) - { - case ACPI_ADR_SPACE_SYSTEM_MEMORY: - - Status = AcpiOsWriteMemory ( - (ACPI_PHYSICAL_ADDRESS) Address, Value, Width); - break; - - - case ACPI_ADR_SPACE_SYSTEM_IO: - - Status = AcpiOsWritePort ( - (ACPI_IO_ADDRESS) Address, Value, Width); - break; - - - default: - ACPI_ERROR ((AE_INFO, - "Unsupported address space: %X", Reg->SpaceId)); - return (AE_BAD_PARAMETER); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_IO, - "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n", - Value, Width, ACPI_FORMAT_UINT64 (Address), - AcpiUtGetRegionName (Reg->SpaceId))); - - return (Status); -} diff --git a/sys/contrib/dev/acpica/acapps.h b/sys/contrib/dev/acpica/include/acapps.h index e2d20b2b5aa2..e1f31b791b7d 100644 --- a/sys/contrib/dev/acpica/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 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -168,7 +168,10 @@ AdGetLocalTables ( ACPI_STATUS AdParseTable ( - ACPI_TABLE_HEADER *Table); + ACPI_TABLE_HEADER *Table, + ACPI_OWNER_ID *OwnerId, + BOOLEAN LoadTable, + BOOLEAN External); ACPI_STATUS AdDisplayTables ( @@ -184,7 +187,8 @@ AdDisplayStatistics (void); void AcpiDmCrossReferenceNamespace ( ACPI_PARSE_OBJECT *ParseTreeRoot, - ACPI_NAMESPACE_NODE *NamespaceRoot); + ACPI_NAMESPACE_NODE *NamespaceRoot, + ACPI_OWNER_ID OwnerId); void AcpiDmDumpTree ( @@ -197,7 +201,8 @@ AcpiDmFindOrphanMethods ( void AcpiDmFinishNamespaceLoad ( ACPI_PARSE_OBJECT *ParseTreeRoot, - ACPI_NAMESPACE_NODE *NamespaceRoot); + ACPI_NAMESPACE_NODE *NamespaceRoot, + ACPI_OWNER_ID OwnerId); void AcpiDmConvertResourceIndexes ( diff --git a/sys/contrib/dev/acpica/include/accommon.h b/sys/contrib/dev/acpica/include/accommon.h new file mode 100644 index 000000000000..690d3cdba955 --- /dev/null +++ b/sys/contrib/dev/acpica/include/accommon.h @@ -0,0 +1,136 @@ +/****************************************************************************** + * + * Name: accommon.h - Common include files for generation of ACPICA source + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2009, 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 __ACCOMMON_H__ +#define __ACCOMMON_H__ + +/* + * Common set of includes for all ACPICA source files. + * We put them here because we don't want to duplicate them + * in the the source code again and again. + * + * Note: The order of these include files is important. + */ +#include "acconfig.h" /* Global configuration constants */ +#include "acmacros.h" /* C macros */ +#include "aclocal.h" /* Internal data types */ +#include "acobject.h" /* ACPI internal object */ +#include "acstruct.h" /* Common structures */ +#include "acglobal.h" /* All global variables */ +#include "achware.h" /* Hardware defines and interfaces */ +#include "acutils.h" /* Utility interfaces */ + + +#endif /* __ACCOMMON_H__ */ diff --git a/sys/contrib/dev/acpica/acconfig.h b/sys/contrib/dev/acpica/include/acconfig.h index c3c15a8cb851..7b458cc457fd 100644 --- a/sys/contrib/dev/acpica/acconfig.h +++ b/sys/contrib/dev/acpica/include/acconfig.h @@ -1,7 +1,6 @@ /****************************************************************************** * * Name: acconfig.h - Global configuration constants - * $Revision: 1.234 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -135,10 +134,6 @@ * */ -/* Current ACPICA subsystem version in YYYYMMDD format */ - -#define ACPI_CA_VERSION 0x20070320 - /* * OS name, used for the _OS object. The _OS object is essentially obsolete, * but there is a large base of ASL/AML code in existing machines that check @@ -194,6 +189,10 @@ #define ACPI_ROOT_TABLE_SIZE_INCREMENT 4 +/* Maximum number of While() loop iterations before forced abort */ + +#define ACPI_MAX_LOOP_ITERATIONS 0xFFFF + /****************************************************************************** * @@ -201,11 +200,6 @@ * *****************************************************************************/ -/* Number of distinct GPE register blocks and register width */ - -#define ACPI_MAX_GPE_BLOCKS 2 -#define ACPI_GPE_REGISTER_WIDTH 8 - /* Method info (in WALK_STATE), containing local variables and argumetns */ #define ACPI_METHOD_NUM_LOCALS 8 @@ -214,12 +208,6 @@ #define ACPI_METHOD_NUM_ARGS 7 #define ACPI_METHOD_MAX_ARG 6 -/* Length of _HID, _UID, _CID, and UUID values */ - -#define ACPI_DEVICE_ID_LENGTH 0x09 -#define ACPI_MAX_CID_LENGTH 48 -#define ACPI_UUID_LENGTH 16 - /* * Operand Stack (in WALK_STATE), Must be large enough to contain METHOD_MAX_ARG */ @@ -237,17 +225,6 @@ */ #define ACPI_RESULTS_OBJ_NUM_MAX 255 -/* Names within the namespace are 4 bytes long */ - -#define ACPI_NAME_SIZE 4 -#define ACPI_PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 char for separator */ -#define ACPI_PATH_SEPARATOR '.' - -/* Sizes for ACPI table headers */ - -#define ACPI_OEM_ID_SIZE 6 -#define ACPI_OEM_TABLE_ID_SIZE 8 - /* Constants used in searching for the RSDP in low memory */ #define ACPI_EBDA_PTR_LOCATION 0x0000040E /* Physical Address */ diff --git a/sys/contrib/dev/acpica/acdebug.h b/sys/contrib/dev/acpica/include/acdebug.h index cdf566e78b50..6a9d51fe473a 100644 --- a/sys/contrib/dev/acpica/acdebug.h +++ b/sys/contrib/dev/acpica/include/acdebug.h @@ -1,7 +1,6 @@ /****************************************************************************** * * Name: acdebug.h - ACPI/AML debugger - * $Revision: 1.84 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -260,6 +259,13 @@ AcpiDbGenerateGpe ( char *GpeArg, char *BlockArg); +void +AcpiDbCheckPredefinedNames ( + void); + +void +AcpiDbBatchExecute ( + void); /* * dbdisply - debug display commands @@ -307,6 +313,13 @@ AcpiDbDisplayArgumentObject ( ACPI_OPERAND_OBJECT *ObjDesc, ACPI_WALK_STATE *WalkState); +void +AcpiDbCheckPredefinedNames ( + void); + +void +AcpiDbBatchExecute ( + void); /* * dbexec - debugger control method execution diff --git a/sys/contrib/dev/acpica/acdisasm.h b/sys/contrib/dev/acpica/include/acdisasm.h index 4371de78ca32..1d82efca483a 100644 --- a/sys/contrib/dev/acpica/acdisasm.h +++ b/sys/contrib/dev/acpica/include/acdisasm.h @@ -1,7 +1,6 @@ /****************************************************************************** * * Name: acdisasm.h - AML disassembler - * $Revision: 1.39 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,7 +116,7 @@ #ifndef __ACDISASM_H__ #define __ACDISASM_H__ -#include <contrib/dev/acpica/amlresrc.h> +#include "amlresrc.h" #define BLOCK_NONE 0 @@ -174,21 +173,26 @@ typedef const struct acpi_dmtable_info #define ACPI_DMT_CHKSUM 20 #define ACPI_DMT_SPACEID 21 #define ACPI_DMT_GAS 22 -#define ACPI_DMT_DMAR 23 -#define ACPI_DMT_MADT 24 -#define ACPI_DMT_SRAT 25 -#define ACPI_DMT_EXIT 26 -#define ACPI_DMT_SIG 27 +#define ACPI_DMT_ASF 23 +#define ACPI_DMT_DMAR 24 +#define ACPI_DMT_HEST 25 +#define ACPI_DMT_HESTNTFY 26 +#define ACPI_DMT_HESTNTYP 27 +#define ACPI_DMT_MADT 28 +#define ACPI_DMT_SRAT 29 +#define ACPI_DMT_EXIT 30 +#define ACPI_DMT_SIG 31 +#define ACPI_DMT_FADTPM 32 typedef -void (*ACPI_TABLE_HANDLER) ( +void (*ACPI_DMTABLE_HANDLER) ( ACPI_TABLE_HEADER *Table); typedef struct acpi_dmtable_data { char *Signature; - ACPI_DMTABLE_INFO *TableInfo; - ACPI_TABLE_HANDLER TableHandler; + ACPI_DMTABLE_INFO *TableInfo; + ACPI_DMTABLE_HANDLER TableHandler; char *Name; } ACPI_DMTABLE_DATA; @@ -236,6 +240,7 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoAsf3[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoAsf4[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoAsfHdr[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoBoot[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoBert[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoCpep[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoCpep0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoDbgp[]; @@ -244,12 +249,28 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmarHdr[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmarScope[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar1[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar2[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoEcdt[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoEinj[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoEinj0[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoErst[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoFacs[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoFadt1[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoFadt2[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoFadt3[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoGas[]; 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 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 AcpiDmTableInfoHpet[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt0[]; @@ -261,18 +282,23 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt5[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt6[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt7[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt8[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt9[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt10[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadtHdr[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMcfg[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMcfg0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoRsdp1[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoRsdp2[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoSbst[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoSlic[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoSlit[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoSpcr[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoSpmi[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoSrat[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoSratHdr[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoSrat0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoSrat1[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoSrat2[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoTcpa[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoWdrt[]; @@ -284,7 +310,7 @@ void AcpiDmDumpDataTable ( ACPI_TABLE_HEADER *Table); -void +ACPI_STATUS AcpiDmDumpTable ( UINT32 TableLength, UINT32 TableOffset, @@ -322,11 +348,19 @@ AcpiDmDumpDmar ( ACPI_TABLE_HEADER *Table); void +AcpiDmDumpEinj ( + ACPI_TABLE_HEADER *Table); + +void +AcpiDmDumpErst ( + ACPI_TABLE_HEADER *Table); + +void AcpiDmDumpFadt ( ACPI_TABLE_HEADER *Table); void -AcpiDmDumpSrat ( +AcpiDmDumpHest ( ACPI_TABLE_HEADER *Table); void @@ -350,6 +384,10 @@ AcpiDmDumpSlit ( ACPI_TABLE_HEADER *Table); void +AcpiDmDumpSrat ( + ACPI_TABLE_HEADER *Table); + +void AcpiDmDumpXsdt ( ACPI_TABLE_HEADER *Table); @@ -422,7 +460,7 @@ AcpiDmCommaIfFieldMember ( */ UINT32 AcpiDmDumpName ( - char *Name); + UINT32 Name); ACPI_STATUS AcpiPsDisplayObjectPathname ( diff --git a/sys/contrib/dev/acpica/acdispat.h b/sys/contrib/dev/acpica/include/acdispat.h index 056acd99d4da..2aa86232b2f0 100644 --- a/sys/contrib/dev/acpica/acdispat.h +++ b/sys/contrib/dev/acpica/include/acdispat.h @@ -1,7 +1,6 @@ /****************************************************************************** * * Name: acdispat.h - dispatcher (parser to interpreter interface) - * $Revision: 1.76 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -131,6 +130,10 @@ AcpiDsGetBufferFieldArguments ( ACPI_OPERAND_OBJECT *ObjDesc); ACPI_STATUS +AcpiDsGetBankFieldArguments ( + ACPI_OPERAND_OBJECT *ObjDesc); + +ACPI_STATUS AcpiDsGetRegionArguments ( ACPI_OPERAND_OBJECT *RgnDesc); @@ -153,12 +156,22 @@ AcpiDsEvalRegionOperands ( ACPI_PARSE_OBJECT *Op); ACPI_STATUS +AcpiDsEvalTableRegionOperands ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op); + +ACPI_STATUS AcpiDsEvalDataObjectOperands ( ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op, ACPI_OPERAND_OBJECT *ObjDesc); ACPI_STATUS +AcpiDsEvalBankFieldOperands ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op); + +ACPI_STATUS AcpiDsInitializeRegion ( ACPI_HANDLE ObjHandle); @@ -259,7 +272,7 @@ AcpiDsInitCallbacks ( */ ACPI_STATUS AcpiDsStoreObjectToLocal ( - UINT16 Opcode, + UINT8 Type, UINT32 Index, ACPI_OPERAND_OBJECT *SrcDesc, ACPI_WALK_STATE *WalkState); @@ -281,7 +294,7 @@ AcpiDsIsMethodValue ( ACPI_STATUS AcpiDsMethodDataGetValue ( - UINT16 Opcode, + UINT8 Type, UINT32 Index, ACPI_WALK_STATE *WalkState, ACPI_OPERAND_OBJECT **DestDesc); @@ -294,7 +307,7 @@ AcpiDsMethodDataInitArgs ( ACPI_STATUS AcpiDsMethodDataGetNode ( - UINT16 Opcode, + UINT8 Type, UINT32 Index, ACPI_WALK_STATE *WalkState, ACPI_NAMESPACE_NODE **Node); @@ -343,7 +356,7 @@ AcpiDsMethodError ( */ ACPI_STATUS AcpiDsInitializeObjects ( - ACPI_NATIVE_UINT TableIndex, + UINT32 TableIndex, ACPI_NAMESPACE_NODE *StartNode); diff --git a/sys/contrib/dev/acpica/acevents.h b/sys/contrib/dev/acpica/include/acevents.h index 8f74cb76064f..0cd5e2e28696 100644 --- a/sys/contrib/dev/acpica/acevents.h +++ b/sys/contrib/dev/acpica/include/acevents.h @@ -1,7 +1,6 @@ /****************************************************************************** * * Name: acevents.h - Event subcomponent prototypes and defines - * $Revision: 1.107 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -199,12 +198,14 @@ AcpiEvValidGpeEvent ( ACPI_STATUS AcpiEvWalkGpeList ( - ACPI_GPE_CALLBACK GpeWalkCallback); + ACPI_GPE_CALLBACK GpeWalkCallback, + void *Context); ACPI_STATUS AcpiEvDeleteGpeHandlers ( ACPI_GPE_XRUPT_INFO *GpeXruptInfo, - ACPI_GPE_BLOCK_INFO *GpeBlock); + ACPI_GPE_BLOCK_INFO *GpeBlock, + void *Context); ACPI_STATUS AcpiEvCreateGpeBlock ( @@ -262,7 +263,7 @@ ACPI_STATUS AcpiEvAddressSpaceDispatch ( ACPI_OPERAND_OBJECT *RegionObj, UINT32 Function, - ACPI_PHYSICAL_ADDRESS Address, + UINT32 RegionOffset, UINT32 BitWidth, ACPI_INTEGER *Value); diff --git a/sys/contrib/dev/acpica/acexcep.h b/sys/contrib/dev/acpica/include/acexcep.h index ccc153798c51..dfe2e2ee7342 100644 --- a/sys/contrib/dev/acpica/acexcep.h +++ b/sys/contrib/dev/acpica/include/acexcep.h @@ -1,7 +1,6 @@ /****************************************************************************** * * Name: acexcep.h - Exception codes returned by the ACPI subsystem - * $Revision: 1.79 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -152,25 +151,21 @@ #define AE_STACK_OVERFLOW (ACPI_STATUS) (0x000C | AE_CODE_ENVIRONMENTAL) #define AE_STACK_UNDERFLOW (ACPI_STATUS) (0x000D | AE_CODE_ENVIRONMENTAL) #define AE_NOT_IMPLEMENTED (ACPI_STATUS) (0x000E | AE_CODE_ENVIRONMENTAL) -#define AE_VERSION_MISMATCH (ACPI_STATUS) (0x000F | AE_CODE_ENVIRONMENTAL) -#define AE_SUPPORT (ACPI_STATUS) (0x0010 | AE_CODE_ENVIRONMENTAL) -#define AE_SHARE (ACPI_STATUS) (0x0011 | AE_CODE_ENVIRONMENTAL) -#define AE_LIMIT (ACPI_STATUS) (0x0012 | AE_CODE_ENVIRONMENTAL) -#define AE_TIME (ACPI_STATUS) (0x0013 | AE_CODE_ENVIRONMENTAL) -#define AE_UNKNOWN_STATUS (ACPI_STATUS) (0x0014 | AE_CODE_ENVIRONMENTAL) -#define AE_ACQUIRE_DEADLOCK (ACPI_STATUS) (0x0015 | AE_CODE_ENVIRONMENTAL) -#define AE_RELEASE_DEADLOCK (ACPI_STATUS) (0x0016 | AE_CODE_ENVIRONMENTAL) -#define AE_NOT_ACQUIRED (ACPI_STATUS) (0x0017 | AE_CODE_ENVIRONMENTAL) -#define AE_ALREADY_ACQUIRED (ACPI_STATUS) (0x0018 | AE_CODE_ENVIRONMENTAL) -#define AE_NO_HARDWARE_RESPONSE (ACPI_STATUS) (0x0019 | AE_CODE_ENVIRONMENTAL) -#define AE_NO_GLOBAL_LOCK (ACPI_STATUS) (0x001A | AE_CODE_ENVIRONMENTAL) -#define AE_LOGICAL_ADDRESS (ACPI_STATUS) (0x001B | AE_CODE_ENVIRONMENTAL) -#define AE_ABORT_METHOD (ACPI_STATUS) (0x001C | AE_CODE_ENVIRONMENTAL) -#define AE_SAME_HANDLER (ACPI_STATUS) (0x001D | AE_CODE_ENVIRONMENTAL) -#define AE_WAKE_ONLY_GPE (ACPI_STATUS) (0x001E | AE_CODE_ENVIRONMENTAL) -#define AE_OWNER_ID_LIMIT (ACPI_STATUS) (0x001F | AE_CODE_ENVIRONMENTAL) - -#define AE_CODE_ENV_MAX 0x001F +#define AE_SUPPORT (ACPI_STATUS) (0x000F | AE_CODE_ENVIRONMENTAL) +#define AE_LIMIT (ACPI_STATUS) (0x0010 | AE_CODE_ENVIRONMENTAL) +#define AE_TIME (ACPI_STATUS) (0x0011 | AE_CODE_ENVIRONMENTAL) +#define AE_ACQUIRE_DEADLOCK (ACPI_STATUS) (0x0012 | AE_CODE_ENVIRONMENTAL) +#define AE_RELEASE_DEADLOCK (ACPI_STATUS) (0x0013 | AE_CODE_ENVIRONMENTAL) +#define AE_NOT_ACQUIRED (ACPI_STATUS) (0x0014 | AE_CODE_ENVIRONMENTAL) +#define AE_ALREADY_ACQUIRED (ACPI_STATUS) (0x0015 | AE_CODE_ENVIRONMENTAL) +#define AE_NO_HARDWARE_RESPONSE (ACPI_STATUS) (0x0016 | AE_CODE_ENVIRONMENTAL) +#define AE_NO_GLOBAL_LOCK (ACPI_STATUS) (0x0017 | AE_CODE_ENVIRONMENTAL) +#define AE_ABORT_METHOD (ACPI_STATUS) (0x0018 | AE_CODE_ENVIRONMENTAL) +#define AE_SAME_HANDLER (ACPI_STATUS) (0x0019 | AE_CODE_ENVIRONMENTAL) +#define AE_WAKE_ONLY_GPE (ACPI_STATUS) (0x001A | AE_CODE_ENVIRONMENTAL) +#define AE_OWNER_ID_LIMIT (ACPI_STATUS) (0x001B | AE_CODE_ENVIRONMENTAL) + +#define AE_CODE_ENV_MAX 0x001B /* @@ -180,11 +175,11 @@ #define AE_BAD_CHARACTER (ACPI_STATUS) (0x0002 | AE_CODE_PROGRAMMER) #define AE_BAD_PATHNAME (ACPI_STATUS) (0x0003 | AE_CODE_PROGRAMMER) #define AE_BAD_DATA (ACPI_STATUS) (0x0004 | AE_CODE_PROGRAMMER) -#define AE_BAD_ADDRESS (ACPI_STATUS) (0x0005 | AE_CODE_PROGRAMMER) -#define AE_ALIGNMENT (ACPI_STATUS) (0x0006 | AE_CODE_PROGRAMMER) -#define AE_BAD_HEX_CONSTANT (ACPI_STATUS) (0x0007 | AE_CODE_PROGRAMMER) -#define AE_BAD_OCTAL_CONSTANT (ACPI_STATUS) (0x0008 | AE_CODE_PROGRAMMER) -#define AE_BAD_DECIMAL_CONSTANT (ACPI_STATUS) (0x0009 | AE_CODE_PROGRAMMER) +#define AE_BAD_HEX_CONSTANT (ACPI_STATUS) (0x0005 | AE_CODE_PROGRAMMER) +#define AE_BAD_OCTAL_CONSTANT (ACPI_STATUS) (0x0006 | AE_CODE_PROGRAMMER) +#define AE_BAD_DECIMAL_CONSTANT (ACPI_STATUS) (0x0007 | AE_CODE_PROGRAMMER) +#define AE_MISSING_ARGUMENTS (ACPI_STATUS) (0x0008 | AE_CODE_PROGRAMMER) +#define AE_BAD_ADDRESS (ACPI_STATUS) (0x0009 | AE_CODE_PROGRAMMER) #define AE_CODE_PGM_MAX 0x0009 @@ -196,52 +191,50 @@ #define AE_BAD_HEADER (ACPI_STATUS) (0x0002 | AE_CODE_ACPI_TABLES) #define AE_BAD_CHECKSUM (ACPI_STATUS) (0x0003 | AE_CODE_ACPI_TABLES) #define AE_BAD_VALUE (ACPI_STATUS) (0x0004 | AE_CODE_ACPI_TABLES) -#define AE_TABLE_NOT_SUPPORTED (ACPI_STATUS) (0x0005 | AE_CODE_ACPI_TABLES) -#define AE_INVALID_TABLE_LENGTH (ACPI_STATUS) (0x0006 | AE_CODE_ACPI_TABLES) +#define AE_INVALID_TABLE_LENGTH (ACPI_STATUS) (0x0005 | AE_CODE_ACPI_TABLES) -#define AE_CODE_TBL_MAX 0x0006 +#define AE_CODE_TBL_MAX 0x0005 /* * AML exceptions. These are caused by problems with * the actual AML byte stream */ -#define AE_AML_ERROR (ACPI_STATUS) (0x0001 | AE_CODE_AML) -#define AE_AML_PARSE (ACPI_STATUS) (0x0002 | AE_CODE_AML) -#define AE_AML_BAD_OPCODE (ACPI_STATUS) (0x0003 | AE_CODE_AML) -#define AE_AML_NO_OPERAND (ACPI_STATUS) (0x0004 | AE_CODE_AML) -#define AE_AML_OPERAND_TYPE (ACPI_STATUS) (0x0005 | AE_CODE_AML) -#define AE_AML_OPERAND_VALUE (ACPI_STATUS) (0x0006 | AE_CODE_AML) -#define AE_AML_UNINITIALIZED_LOCAL (ACPI_STATUS) (0x0007 | AE_CODE_AML) -#define AE_AML_UNINITIALIZED_ARG (ACPI_STATUS) (0x0008 | AE_CODE_AML) -#define AE_AML_UNINITIALIZED_ELEMENT (ACPI_STATUS) (0x0009 | AE_CODE_AML) -#define AE_AML_NUMERIC_OVERFLOW (ACPI_STATUS) (0x000A | AE_CODE_AML) -#define AE_AML_REGION_LIMIT (ACPI_STATUS) (0x000B | AE_CODE_AML) -#define AE_AML_BUFFER_LIMIT (ACPI_STATUS) (0x000C | AE_CODE_AML) -#define AE_AML_PACKAGE_LIMIT (ACPI_STATUS) (0x000D | AE_CODE_AML) -#define AE_AML_DIVIDE_BY_ZERO (ACPI_STATUS) (0x000E | AE_CODE_AML) -#define AE_AML_BAD_NAME (ACPI_STATUS) (0x000F | AE_CODE_AML) -#define AE_AML_NAME_NOT_FOUND (ACPI_STATUS) (0x0010 | AE_CODE_AML) -#define AE_AML_INTERNAL (ACPI_STATUS) (0x0011 | AE_CODE_AML) -#define AE_AML_INVALID_SPACE_ID (ACPI_STATUS) (0x0012 | AE_CODE_AML) -#define AE_AML_STRING_LIMIT (ACPI_STATUS) (0x0013 | AE_CODE_AML) -#define AE_AML_NO_RETURN_VALUE (ACPI_STATUS) (0x0014 | AE_CODE_AML) -#define AE_AML_METHOD_LIMIT (ACPI_STATUS) (0x0015 | AE_CODE_AML) -#define AE_AML_NOT_OWNER (ACPI_STATUS) (0x0016 | AE_CODE_AML) -#define AE_AML_MUTEX_ORDER (ACPI_STATUS) (0x0017 | AE_CODE_AML) -#define AE_AML_MUTEX_NOT_ACQUIRED (ACPI_STATUS) (0x0018 | AE_CODE_AML) -#define AE_AML_INVALID_RESOURCE_TYPE (ACPI_STATUS) (0x0019 | AE_CODE_AML) -#define AE_AML_INVALID_INDEX (ACPI_STATUS) (0x001A | AE_CODE_AML) -#define AE_AML_REGISTER_LIMIT (ACPI_STATUS) (0x001B | AE_CODE_AML) -#define AE_AML_NO_WHILE (ACPI_STATUS) (0x001C | AE_CODE_AML) -#define AE_AML_ALIGNMENT (ACPI_STATUS) (0x001D | AE_CODE_AML) -#define AE_AML_NO_RESOURCE_END_TAG (ACPI_STATUS) (0x001E | AE_CODE_AML) -#define AE_AML_BAD_RESOURCE_VALUE (ACPI_STATUS) (0x001F | AE_CODE_AML) -#define AE_AML_CIRCULAR_REFERENCE (ACPI_STATUS) (0x0020 | AE_CODE_AML) -#define AE_AML_BAD_RESOURCE_LENGTH (ACPI_STATUS) (0x0021 | AE_CODE_AML) -#define AE_AML_ILLEGAL_ADDRESS (ACPI_STATUS) (0x0022 | AE_CODE_AML) - -#define AE_CODE_AML_MAX 0x0022 +#define AE_AML_BAD_OPCODE (ACPI_STATUS) (0x0001 | AE_CODE_AML) +#define AE_AML_NO_OPERAND (ACPI_STATUS) (0x0002 | AE_CODE_AML) +#define AE_AML_OPERAND_TYPE (ACPI_STATUS) (0x0003 | AE_CODE_AML) +#define AE_AML_OPERAND_VALUE (ACPI_STATUS) (0x0004 | AE_CODE_AML) +#define AE_AML_UNINITIALIZED_LOCAL (ACPI_STATUS) (0x0005 | AE_CODE_AML) +#define AE_AML_UNINITIALIZED_ARG (ACPI_STATUS) (0x0006 | AE_CODE_AML) +#define AE_AML_UNINITIALIZED_ELEMENT (ACPI_STATUS) (0x0007 | AE_CODE_AML) +#define AE_AML_NUMERIC_OVERFLOW (ACPI_STATUS) (0x0008 | AE_CODE_AML) +#define AE_AML_REGION_LIMIT (ACPI_STATUS) (0x0009 | AE_CODE_AML) +#define AE_AML_BUFFER_LIMIT (ACPI_STATUS) (0x000A | AE_CODE_AML) +#define AE_AML_PACKAGE_LIMIT (ACPI_STATUS) (0x000B | AE_CODE_AML) +#define AE_AML_DIVIDE_BY_ZERO (ACPI_STATUS) (0x000C | AE_CODE_AML) +#define AE_AML_BAD_NAME (ACPI_STATUS) (0x000D | AE_CODE_AML) +#define AE_AML_NAME_NOT_FOUND (ACPI_STATUS) (0x000E | AE_CODE_AML) +#define AE_AML_INTERNAL (ACPI_STATUS) (0x000F | AE_CODE_AML) +#define AE_AML_INVALID_SPACE_ID (ACPI_STATUS) (0x0010 | AE_CODE_AML) +#define AE_AML_STRING_LIMIT (ACPI_STATUS) (0x0011 | AE_CODE_AML) +#define AE_AML_NO_RETURN_VALUE (ACPI_STATUS) (0x0012 | AE_CODE_AML) +#define AE_AML_METHOD_LIMIT (ACPI_STATUS) (0x0013 | AE_CODE_AML) +#define AE_AML_NOT_OWNER (ACPI_STATUS) (0x0014 | AE_CODE_AML) +#define AE_AML_MUTEX_ORDER (ACPI_STATUS) (0x0015 | AE_CODE_AML) +#define AE_AML_MUTEX_NOT_ACQUIRED (ACPI_STATUS) (0x0016 | AE_CODE_AML) +#define AE_AML_INVALID_RESOURCE_TYPE (ACPI_STATUS) (0x0017 | AE_CODE_AML) +#define AE_AML_INVALID_INDEX (ACPI_STATUS) (0x0018 | AE_CODE_AML) +#define AE_AML_REGISTER_LIMIT (ACPI_STATUS) (0x0019 | AE_CODE_AML) +#define AE_AML_NO_WHILE (ACPI_STATUS) (0x001A | AE_CODE_AML) +#define AE_AML_ALIGNMENT (ACPI_STATUS) (0x001B | AE_CODE_AML) +#define AE_AML_NO_RESOURCE_END_TAG (ACPI_STATUS) (0x001C | AE_CODE_AML) +#define AE_AML_BAD_RESOURCE_VALUE (ACPI_STATUS) (0x001D | AE_CODE_AML) +#define AE_AML_CIRCULAR_REFERENCE (ACPI_STATUS) (0x001E | AE_CODE_AML) +#define AE_AML_BAD_RESOURCE_LENGTH (ACPI_STATUS) (0x001F | AE_CODE_AML) +#define AE_AML_ILLEGAL_ADDRESS (ACPI_STATUS) (0x0020 | AE_CODE_AML) +#define AE_AML_INFINITE_LOOP (ACPI_STATUS) (0x0021 | AE_CODE_AML) + +#define AE_CODE_AML_MAX 0x0021 /* @@ -264,8 +257,9 @@ #define AE_CODE_CTRL_MAX 0x000D -#ifdef DEFINE_ACPI_GLOBALS +/* Exception strings for AcpiFormatException */ +#ifdef DEFINE_ACPI_GLOBALS /* * String versions of the exception codes above @@ -288,19 +282,15 @@ char const *AcpiGbl_ExceptionNames_Env[] = "AE_STACK_OVERFLOW", "AE_STACK_UNDERFLOW", "AE_NOT_IMPLEMENTED", - "AE_VERSION_MISMATCH", "AE_SUPPORT", - "AE_SHARE", "AE_LIMIT", "AE_TIME", - "AE_UNKNOWN_STATUS", "AE_ACQUIRE_DEADLOCK", "AE_RELEASE_DEADLOCK", "AE_NOT_ACQUIRED", "AE_ALREADY_ACQUIRED", "AE_NO_HARDWARE_RESPONSE", "AE_NO_GLOBAL_LOCK", - "AE_LOGICAL_ADDRESS", "AE_ABORT_METHOD", "AE_SAME_HANDLER", "AE_WAKE_ONLY_GPE", @@ -309,31 +299,31 @@ char const *AcpiGbl_ExceptionNames_Env[] = char const *AcpiGbl_ExceptionNames_Pgm[] = { + NULL, "AE_BAD_PARAMETER", "AE_BAD_CHARACTER", "AE_BAD_PATHNAME", "AE_BAD_DATA", - "AE_BAD_ADDRESS", - "AE_ALIGNMENT", "AE_BAD_HEX_CONSTANT", "AE_BAD_OCTAL_CONSTANT", - "AE_BAD_DECIMAL_CONSTANT" + "AE_BAD_DECIMAL_CONSTANT", + "AE_MISSING_ARGUMENTS", + "AE_BAD_ADDRESS" }; char const *AcpiGbl_ExceptionNames_Tbl[] = { + NULL, "AE_BAD_SIGNATURE", "AE_BAD_HEADER", "AE_BAD_CHECKSUM", "AE_BAD_VALUE", - "AE_TABLE_NOT_SUPPORTED", "AE_INVALID_TABLE_LENGTH" }; char const *AcpiGbl_ExceptionNames_Aml[] = { - "AE_AML_ERROR", - "AE_AML_PARSE", + NULL, "AE_AML_BAD_OPCODE", "AE_AML_NO_OPERAND", "AE_AML_OPERAND_TYPE", @@ -365,11 +355,13 @@ char const *AcpiGbl_ExceptionNames_Aml[] = "AE_AML_BAD_RESOURCE_VALUE", "AE_AML_CIRCULAR_REFERENCE", "AE_AML_BAD_RESOURCE_LENGTH", - "AE_AML_ILLEGAL_ADDRESS" + "AE_AML_ILLEGAL_ADDRESS", + "AE_AML_INFINITE_LOOP" }; char const *AcpiGbl_ExceptionNames_Ctrl[] = { + NULL, "AE_CTRL_RETURN_VALUE", "AE_CTRL_PENDING", "AE_CTRL_TERMINATE", diff --git a/sys/contrib/dev/acpica/acglobal.h b/sys/contrib/dev/acpica/include/acglobal.h index 1e137339f630..42b7b158c4b3 100644 --- a/sys/contrib/dev/acpica/acglobal.h +++ b/sys/contrib/dev/acpica/include/acglobal.h @@ -1,7 +1,6 @@ /****************************************************************************** * * Name: acglobal.h - Declarations for global variables - * $Revision: 1.194 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -133,6 +132,10 @@ #endif +#ifdef DEFINE_ACPI_GLOBALS + +/* Public globals, available from outside ACPICA subsystem */ + /***************************************************************************** * * Runtime configuration (static defaults that can be overriden at runtime) @@ -153,7 +156,7 @@ * 5) Allow unresolved references (invalid target name) in package objects * 6) Enable warning messages for behavior that is not ACPI spec compliant */ -ACPI_EXTERN UINT8 ACPI_INIT_GLOBAL (AcpiGbl_EnableInterpreterSlack, FALSE); +UINT8 ACPI_INIT_GLOBAL (AcpiGbl_EnableInterpreterSlack, FALSE); /* * Automatically serialize ALL control methods? Default is FALSE, meaning @@ -161,22 +164,37 @@ ACPI_EXTERN UINT8 ACPI_INIT_GLOBAL (AcpiGbl_EnableInterpreterSlack, FALSE) * Only change this if the ASL code is poorly written and cannot handle * reentrancy even though methods are marked "NotSerialized". */ -ACPI_EXTERN UINT8 ACPI_INIT_GLOBAL (AcpiGbl_AllMethodsSerialized, FALSE); +UINT8 ACPI_INIT_GLOBAL (AcpiGbl_AllMethodsSerialized, FALSE); /* * Create the predefined _OSI method in the namespace? Default is TRUE * because ACPI CA is fully compatible with other ACPI implementations. * Changing this will revert ACPI CA (and machine ASL) to pre-OSI behavior. */ -ACPI_EXTERN UINT8 ACPI_INIT_GLOBAL (AcpiGbl_CreateOsiMethod, TRUE); +UINT8 ACPI_INIT_GLOBAL (AcpiGbl_CreateOsiMethod, TRUE); /* * Disable wakeup GPEs during runtime? Default is TRUE because WAKE and * RUNTIME GPEs should never be shared, and WAKE GPEs should typically only * be enabled just before going to sleep. */ -ACPI_EXTERN UINT8 ACPI_INIT_GLOBAL (AcpiGbl_LeaveWakeGpesDisabled, TRUE); +UINT8 ACPI_INIT_GLOBAL (AcpiGbl_LeaveWakeGpesDisabled, TRUE); + +/* + * Optionally use default values for the ACPI register widths. Set this to + * TRUE to use the defaults, if an FADT contains incorrect widths/lengths. + */ +UINT8 ACPI_INIT_GLOBAL (AcpiGbl_UseDefaultRegisterWidths, TRUE); + + +/* AcpiGbl_FADT is a local copy of the FADT, converted to a common format. */ +ACPI_TABLE_FADT AcpiGbl_FADT; +UINT32 AcpiCurrentGpeCount; +UINT32 AcpiGbl_TraceFlags; +ACPI_NAME AcpiGbl_TraceMethodName; + +#endif /***************************************************************************** * @@ -188,14 +206,16 @@ ACPI_EXTERN UINT8 ACPI_INIT_GLOBAL (AcpiGbl_LeaveWakeGpesDisabled, TRUE); * AcpiGbl_RootTableList is the master list of ACPI tables found in the * RSDT/XSDT. * - * AcpiGbl_FADT is a local copy of the FADT, converted to a common format. */ ACPI_EXTERN ACPI_INTERNAL_RSDT AcpiGbl_RootTableList; -ACPI_EXTERN ACPI_TABLE_FADT AcpiGbl_FADT; +ACPI_EXTERN ACPI_TABLE_FACS *AcpiGbl_FACS; -/* These addresses are calculated from FADT address values */ +/* These addresses are calculated from the FADT Event Block addresses */ +ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1aStatus; ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1aEnable; + +ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1bStatus; ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1bEnable; /* @@ -238,6 +258,10 @@ ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockPresent; ACPI_EXTERN ACPI_SPINLOCK AcpiGbl_GpeLock; /* For GPE data structs and registers */ ACPI_EXTERN ACPI_SPINLOCK AcpiGbl_HardwareLock; /* For ACPI H/W except GPE registers */ +/* Reader/Writer lock is used for namespace walk and dynamic table unload */ + +ACPI_EXTERN ACPI_RW_LOCK AcpiGbl_NamespaceRwLock; + /***************************************************************************** * @@ -259,8 +283,11 @@ ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER AcpiGbl_DeviceNotify; ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER AcpiGbl_SystemNotify; ACPI_EXTERN ACPI_EXCEPTION_HANDLER AcpiGbl_ExceptionHandler; ACPI_EXTERN ACPI_INIT_HANDLER AcpiGbl_InitHandler; +ACPI_EXTERN ACPI_TABLE_HANDLER AcpiGbl_TableHandler; +ACPI_EXTERN void *AcpiGbl_TableHandlerContext; ACPI_EXTERN ACPI_WALK_STATE *AcpiGbl_BreakpointWalk; + /* Owner ID support */ ACPI_EXTERN UINT32 AcpiGbl_OwnerIdMask[ACPI_NUM_OWNERID_MASKS]; @@ -279,6 +306,7 @@ ACPI_EXTERN BOOLEAN AcpiGbl_StepToNextCall; ACPI_EXTERN BOOLEAN AcpiGbl_AcpiHardwarePresent; ACPI_EXTERN BOOLEAN AcpiGbl_EventsInitialized; ACPI_EXTERN BOOLEAN AcpiGbl_SystemAwakeAndRunning; +ACPI_EXTERN UINT8 AcpiGbl_OsiData; #ifndef DEFINE_ACPI_GLOBALS @@ -318,8 +346,6 @@ ACPI_EXTERN BOOLEAN AcpiGbl_DisplayFinalMemStats; * ****************************************************************************/ -#define NUM_NS_TYPES ACPI_TYPE_INVALID+1 - #if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY) #define NUM_PREDEFINED_NAMES 10 #else @@ -330,15 +356,15 @@ ACPI_EXTERN ACPI_NAMESPACE_NODE AcpiGbl_RootNodeStruct; ACPI_EXTERN ACPI_NAMESPACE_NODE *AcpiGbl_RootNode; ACPI_EXTERN ACPI_NAMESPACE_NODE *AcpiGbl_FadtGpeDevice; -extern const UINT8 AcpiGbl_NsProperties[NUM_NS_TYPES]; +extern const UINT8 AcpiGbl_NsProperties [ACPI_NUM_NS_TYPES]; extern const ACPI_PREDEFINED_NAMES AcpiGbl_PreDefinedNames [NUM_PREDEFINED_NAMES]; #ifdef ACPI_DEBUG_OUTPUT ACPI_EXTERN UINT32 AcpiGbl_CurrentNodeCount; ACPI_EXTERN UINT32 AcpiGbl_CurrentNodeSize; ACPI_EXTERN UINT32 AcpiGbl_MaxConcurrentNodeCount; -ACPI_EXTERN ACPI_SIZE AcpiGbl_EntryStackPointer; -ACPI_EXTERN ACPI_SIZE AcpiGbl_LowestStackPointer; +ACPI_EXTERN ACPI_SIZE *AcpiGbl_EntryStackPointer; +ACPI_EXTERN ACPI_SIZE *AcpiGbl_LowestStackPointer; ACPI_EXTERN UINT32 AcpiGbl_DeepestNesting; #endif @@ -386,27 +412,23 @@ ACPI_EXTERN ACPI_GPE_BLOCK_INFO *AcpiGbl_GpeFadtBlocks[ACPI_MAX_GPE_BLOCK * ****************************************************************************/ -/* Runtime configuration of debug print levels */ - -extern UINT32 AcpiDbgLevel; -extern UINT32 AcpiDbgLayer; - /* Procedure nesting level for debug output */ extern UINT32 AcpiGbl_NestingLevel; /* Event counters */ +ACPI_EXTERN UINT32 AcpiMethodCount; ACPI_EXTERN UINT32 AcpiGpeCount; +ACPI_EXTERN UINT32 AcpiSciCount; +ACPI_EXTERN UINT32 AcpiFixedEventCount[ACPI_NUM_FIXED_EVENTS]; /* Support for dynamic control method tracing mechanism */ ACPI_EXTERN UINT32 AcpiGbl_OriginalDbgLevel; ACPI_EXTERN UINT32 AcpiGbl_OriginalDbgLayer; -ACPI_EXTERN ACPI_NAME AcpiGbl_TraceMethodName; ACPI_EXTERN UINT32 AcpiGbl_TraceDbgLevel; ACPI_EXTERN UINT32 AcpiGbl_TraceDbgLayer; -ACPI_EXTERN UINT32 AcpiGbl_TraceFlags; /***************************************************************************** @@ -430,13 +452,10 @@ extern BOOLEAN AcpiGbl_MethodExecuting; extern BOOLEAN AcpiGbl_AbortMethod; extern BOOLEAN AcpiGbl_DbTerminateThreads; -ACPI_EXTERN int optind; -ACPI_EXTERN char *optarg; - ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_tables; ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_stats; ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_ini_methods; - +ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_NoRegionSupport; ACPI_EXTERN char *AcpiGbl_DbArgs[ACPI_DEBUGGER_MAX_ARGS]; ACPI_EXTERN char AcpiGbl_DbLineBuf[80]; @@ -448,7 +467,6 @@ ACPI_EXTERN char *AcpiGbl_DbBuffer; ACPI_EXTERN char *AcpiGbl_DbFilename; ACPI_EXTERN UINT32 AcpiGbl_DbDebugLevel; ACPI_EXTERN UINT32 AcpiGbl_DbConsoleDebugLevel; -ACPI_EXTERN ACPI_TABLE_HEADER *AcpiGbl_DbTablePtr; ACPI_EXTERN ACPI_NAMESPACE_NODE *AcpiGbl_DbScopeNode; /* diff --git a/sys/contrib/dev/acpica/achware.h b/sys/contrib/dev/acpica/include/achware.h index e132ec6e4611..05da01b44db2 100644 --- a/sys/contrib/dev/acpica/achware.h +++ b/sys/contrib/dev/acpica/include/achware.h @@ -1,7 +1,6 @@ /****************************************************************************** * * Name: achware.h -- hardware specific interfaces - * $Revision: 1.83 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -118,11 +117,7 @@ #define __ACHWARE_H__ -/* PM Timer ticks per second (HZ) */ - -#define PM_TIMER_FREQUENCY 3579545 - -/* Values for the _SST reserved method */ +/* Values for the _SST predefined method */ #define ACPI_SST_INDICATOR_OFF 0 #define ACPI_SST_WORKING 1 @@ -131,9 +126,6 @@ #define ACPI_SST_SLEEP_CONTEXT 4 -/* Prototypes */ - - /* * hwacpi - high level functions */ @@ -154,45 +146,57 @@ AcpiHwGetBitRegisterInfo ( UINT32 RegisterId); ACPI_STATUS +AcpiHwWritePm1Control ( + UINT32 Pm1aControl, + UINT32 Pm1bControl); + +ACPI_STATUS AcpiHwRegisterRead ( - BOOLEAN UseLock, UINT32 RegisterId, UINT32 *ReturnValue); ACPI_STATUS AcpiHwRegisterWrite ( - BOOLEAN UseLock, UINT32 RegisterId, UINT32 Value); ACPI_STATUS -AcpiHwLowLevelRead ( - UINT32 Width, - UINT32 *Value, - ACPI_GENERIC_ADDRESS *Reg); +AcpiHwClearAcpiStatus ( + void); + +/* + * hwvalid - Port I/O with validation + */ ACPI_STATUS -AcpiHwLowLevelWrite ( - UINT32 Width, - UINT32 Value, - ACPI_GENERIC_ADDRESS *Reg); +AcpiHwReadPort ( + ACPI_IO_ADDRESS Address, + UINT32 *Value, + UINT32 Width); ACPI_STATUS -AcpiHwClearAcpiStatus ( - void); +AcpiHwWritePort ( + ACPI_IO_ADDRESS Address, + UINT32 Value, + UINT32 Width); /* * hwgpe - GPE support */ ACPI_STATUS +AcpiHwLowDisableGpe ( + ACPI_GPE_EVENT_INFO *GpeEventInfo); + +ACPI_STATUS AcpiHwWriteGpeEnableReg ( ACPI_GPE_EVENT_INFO *GpeEventInfo); ACPI_STATUS AcpiHwDisableGpeBlock ( ACPI_GPE_XRUPT_INFO *GpeXruptInfo, - ACPI_GPE_BLOCK_INFO *GpeBlock); + ACPI_GPE_BLOCK_INFO *GpeBlock, + void *Context); ACPI_STATUS AcpiHwClearGpe ( @@ -201,7 +205,8 @@ AcpiHwClearGpe ( ACPI_STATUS AcpiHwClearGpeBlock ( ACPI_GPE_XRUPT_INFO *GpeXruptInfo, - ACPI_GPE_BLOCK_INFO *GpeBlock); + ACPI_GPE_BLOCK_INFO *GpeBlock, + void *Context); ACPI_STATUS AcpiHwGetGpeStatus ( @@ -223,7 +228,8 @@ AcpiHwEnableAllWakeupGpes ( ACPI_STATUS AcpiHwEnableRuntimeGpeBlock ( ACPI_GPE_XRUPT_INFO *GpeXruptInfo, - ACPI_GPE_BLOCK_INFO *GpeBlock); + ACPI_GPE_BLOCK_INFO *GpeBlock, + void *Context); /* diff --git a/sys/contrib/dev/acpica/acinterp.h b/sys/contrib/dev/acpica/include/acinterp.h index 367266c53a84..b0f4b921854b 100644 --- a/sys/contrib/dev/acpica/acinterp.h +++ b/sys/contrib/dev/acpica/include/acinterp.h @@ -1,7 +1,6 @@ /****************************************************************************** * * Name: acinterp.h - Interpreter subcomponent prototypes and defines - * $Revision: 1.171 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -334,10 +333,6 @@ AcpiExCreateRegion ( ACPI_WALK_STATE *WalkState); ACPI_STATUS -AcpiExCreateTableRegion ( - ACPI_WALK_STATE *WalkState); - -ACPI_STATUS AcpiExCreateEvent ( ACPI_WALK_STATE *WalkState); @@ -568,12 +563,8 @@ AcpiExDumpOperand ( void AcpiExDumpOperands ( ACPI_OPERAND_OBJECT **Operands, - ACPI_INTERPRETER_MODE InterpreterMode, - char *Ident, - UINT32 NumLevels, - char *Note, - char *ModuleName, - UINT32 LineNumber); + const char *OpcodeName, + UINT32 NumOpcodes); void AcpiExDumpObjectDescriptor ( diff --git a/sys/contrib/dev/acpica/aclocal.h b/sys/contrib/dev/acpica/include/aclocal.h index ba1145ebe8ae..99955c31bf1a 100644 --- a/sys/contrib/dev/acpica/aclocal.h +++ b/sys/contrib/dev/acpica/include/aclocal.h @@ -1,7 +1,6 @@ /****************************************************************************** * * Name: aclocal.h - Internal data types used across the ACPI subsystem - * $Revision: 1.247 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,10 +116,9 @@ #ifndef __ACLOCAL_H__ #define __ACLOCAL_H__ + /* acpisrc:StructDefs -- for acpisrc conversion */ -#define ACPI_WAIT_FOREVER 0xFFFF /* UINT16, as per ACPI spec */ -#define ACPI_DO_NOT_WAIT 0 #define ACPI_SERIALIZED 0xFF typedef UINT32 ACPI_MUTEX_HANDLE; @@ -175,8 +173,8 @@ union acpi_parse_object; static char *AcpiGbl_MutexNames[ACPI_NUM_MUTEX] = { "ACPI_MTX_Interpreter", - "ACPI_MTX_Tables", "ACPI_MTX_Namespace", + "ACPI_MTX_Tables", "ACPI_MTX_Events", "ACPI_MTX_Caches", "ACPI_MTX_Memory", @@ -187,6 +185,16 @@ static char *AcpiGbl_MutexNames[ACPI_NUM_MUTEX] = #endif #endif +/* Lock structure for reader/writer interfaces */ + +typedef struct acpi_rw_lock +{ + ACPI_MUTEX WriterMutex; + ACPI_MUTEX ReaderMutex; + UINT32 NumReaders; + +} ACPI_RW_LOCK; + /* * Predefined handles for spinlocks used within the subsystem. @@ -199,14 +207,9 @@ static char *AcpiGbl_MutexNames[ACPI_NUM_MUTEX] = #define ACPI_NUM_LOCK ACPI_MAX_LOCK+1 -/* Owner IDs are used to track namespace nodes for selective deletion */ - -typedef UINT8 ACPI_OWNER_ID; -#define ACPI_OWNER_ID_MAX 0xFF - /* This Thread ID means that the mutex is not in use (unlocked) */ -#define ACPI_MUTEX_NOT_ACQUIRED (UINT32) -1 +#define ACPI_MUTEX_NOT_ACQUIRED (ACPI_THREAD_ID) -1 /* Table for the global mutexes */ @@ -252,13 +255,6 @@ typedef enum } ACPI_INTERPRETER_MODE; -typedef union acpi_name_union -{ - UINT32 Integer; - char Ascii[4]; - -} ACPI_NAME_UNION; - /* * The Namespace Node describes a named object that appears in the AML. @@ -301,6 +297,8 @@ typedef struct acpi_namespace_node #define ANOBJ_METHOD_ARG 0x04 /* Node is a method argument */ #define ANOBJ_METHOD_LOCAL 0x08 /* Node is a method local */ #define ANOBJ_SUBTREE_HAS_INI 0x10 /* Used to optimize device initialization */ +#define ANOBJ_EVALUATED 0x20 /* Set on first evaluation of node */ +#define ANOBJ_ALLOCATED_BUFFER 0x40 /* Method AML buffer is dynamic (InstallMethod) */ #define ANOBJ_IS_EXTERNAL 0x08 /* iASL only: This object created via External() */ #define ANOBJ_METHOD_NO_RETVAL 0x10 /* iASL only: Method has no return value */ @@ -308,27 +306,6 @@ typedef struct acpi_namespace_node #define ANOBJ_IS_BIT_OFFSET 0x40 /* iASL only: Reference is a bit offset */ #define ANOBJ_IS_REFERENCED 0x80 /* iASL only: Object was referenced */ -/* - * ACPI Table Descriptor. One per ACPI table - */ -typedef struct acpi_table_desc -{ - ACPI_PHYSICAL_ADDRESS Address; - ACPI_TABLE_HEADER *Pointer; - UINT32 Length; /* Length fixed at 32 bits */ - ACPI_NAME_UNION Signature; - ACPI_OWNER_ID OwnerId; - UINT8 Flags; - -} ACPI_TABLE_DESC; - -/* Flags for above */ - -#define ACPI_TABLE_ORIGIN_UNKNOWN (0) -#define ACPI_TABLE_ORIGIN_MAPPED (1) -#define ACPI_TABLE_ORIGIN_ALLOCATED (2) -#define ACPI_TABLE_ORIGIN_MASK (3) -#define ACPI_TABLE_IS_LOADED (4) /* One internal RSDT for table management */ @@ -370,18 +347,6 @@ typedef struct acpi_ns_search_data } ACPI_NS_SEARCH_DATA; -/* - * Predefined Namespace items - */ -typedef struct acpi_predefined_names -{ - char *Name; - UINT8 Type; - char *Val; - -} ACPI_PREDEFINED_NAMES; - - /* Object types used during package copies */ #define ACPI_COPY_TYPE_SIMPLE 0 @@ -392,8 +357,8 @@ typedef struct acpi_predefined_names typedef struct acpi_namestring_info { - char *ExternalName; - char *NextExternalChar; + const char *ExternalName; + const char *NextExternalChar; char *InternalName; UINT32 Length; UINT32 NumSegments; @@ -458,6 +423,93 @@ ACPI_STATUS (*ACPI_INTERNAL_METHOD) ( #define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF +/* + * Information structure for ACPI predefined names. + * Each entry in the table contains the following items: + * + * Name - The ACPI reserved name + * ParamCount - Number of arguments to the method + * ExpectedReturnBtypes - Allowed type(s) for the return value + */ +typedef struct acpi_name_info +{ + char Name[ACPI_NAME_SIZE]; + UINT8 ParamCount; + UINT8 ExpectedBtypes; + +} ACPI_NAME_INFO; + +/* + * Secondary information structures for ACPI predefined objects that return + * package objects. This structure appears as the next entry in the table + * after the NAME_INFO structure above. + * + * The reason for this is to minimize the size of the predefined name table. + */ + +/* + * Used for ACPI_PTYPE1_FIXED, ACPI_PTYPE1_VAR, ACPI_PTYPE2, + * ACPI_PTYPE2_MIN, ACPI_PTYPE2_PKG_COUNT, ACPI_PTYPE2_COUNT + */ +typedef struct acpi_package_info +{ + UINT8 Type; + UINT8 ObjectType1; + UINT8 Count1; + UINT8 ObjectType2; + UINT8 Count2; + UINT8 Reserved; + +} ACPI_PACKAGE_INFO; + +/* Used for ACPI_PTYPE2_FIXED */ + +typedef struct acpi_package_info2 +{ + UINT8 Type; + UINT8 Count; + UINT8 ObjectType[4]; + +} ACPI_PACKAGE_INFO2; + +/* Used for ACPI_PTYPE1_OPTION */ + +typedef struct acpi_package_info3 +{ + UINT8 Type; + UINT8 Count; + UINT8 ObjectType[2]; + UINT8 TailObjectType; + UINT8 Reserved; + +} ACPI_PACKAGE_INFO3; + +typedef union acpi_predefined_info +{ + ACPI_NAME_INFO Info; + ACPI_PACKAGE_INFO RetInfo; + ACPI_PACKAGE_INFO2 RetInfo2; + ACPI_PACKAGE_INFO3 RetInfo3; + +} ACPI_PREDEFINED_INFO; + +/* + * Bitmapped return value types + * Note: the actual data types must be contiguous, a loop in nspredef.c + * depends on this. + */ +#define ACPI_RTYPE_ANY 0x00 +#define ACPI_RTYPE_NONE 0x01 +#define ACPI_RTYPE_INTEGER 0x02 +#define ACPI_RTYPE_STRING 0x04 +#define ACPI_RTYPE_BUFFER 0x08 +#define ACPI_RTYPE_PACKAGE 0x10 +#define ACPI_RTYPE_REFERENCE 0x20 +#define ACPI_RTYPE_ALL 0x3F + +#define ACPI_NUM_RTYPES 5 /* Number of actual object types */ + + /***************************************************************************** * * Event typedefs and structs @@ -535,7 +587,6 @@ typedef struct acpi_gpe_xrupt_info } ACPI_GPE_XRUPT_INFO; - typedef struct acpi_gpe_walk_info { ACPI_NAMESPACE_NODE *GpeDevice; @@ -543,10 +594,19 @@ typedef struct acpi_gpe_walk_info } ACPI_GPE_WALK_INFO; +typedef struct acpi_gpe_device_info +{ + UINT32 Index; + UINT32 NextBlockBaseIndex; + ACPI_STATUS Status; + ACPI_NAMESPACE_NODE *GpeDevice; + +} ACPI_GPE_DEVICE_INFO; typedef ACPI_STATUS (*ACPI_GPE_CALLBACK) ( ACPI_GPE_XRUPT_INFO *GpeXruptInfo, - ACPI_GPE_BLOCK_INFO *GpeBlock); + ACPI_GPE_BLOCK_INFO *GpeBlock, + void *Context); /* Information about each particular fixed event */ @@ -644,6 +704,7 @@ typedef struct acpi_control_state union acpi_parse_object *PredicateOp; UINT8 *AmlPredicateStart; /* Start of if/while predicate */ UINT8 *PackageEnd; /* End of if/while block */ + UINT32 LoopCount; /* While() loop counter */ } ACPI_CONTROL_STATE; @@ -784,6 +845,13 @@ typedef union acpi_parse_value } ACPI_PARSE_VALUE; + +#ifdef ACPI_DISASSEMBLER +#define ACPI_DISASM_ONLY_MEMBERS(a) a; +#else +#define ACPI_DISASM_ONLY_MEMBERS(a) +#endif + #define ACPI_PARSE_COMMON \ union acpi_parse_object *Parent; /* Parent op */\ UINT8 DescriptorType; /* To differentiate various internal objs */\ @@ -921,9 +989,6 @@ typedef struct acpi_parse_state * ****************************************************************************/ -#define PCI_ROOT_HID_STRING "PNP0A03" -#define PCI_EXPRESS_ROOT_HID_STRING "PNP0A08" - typedef struct acpi_bit_register_info { UINT8 ParentRegister; @@ -938,8 +1003,27 @@ typedef struct acpi_bit_register_info * must be preserved. */ #define ACPI_PM1_STATUS_PRESERVED_BITS 0x0800 /* Bit 11 */ -#define ACPI_PM1_CONTROL_PRESERVED_BITS 0x0201 /* Bit 9, Bit 0 (SCI_EN) */ +/* Write-only bits must be zeroed by software */ + +#define ACPI_PM1_CONTROL_WRITEONLY_BITS 0x2004 /* Bits 13, 2 */ + +/* For control registers, both ignored and reserved bits must be preserved */ + +/* + * For PM1 control, the SCI enable bit (bit 0, SCI_EN) is defined by the + * ACPI specification to be a "preserved" bit - "OSPM always preserves this + * bit position", section 4.7.3.2.1. However, on some machines the OS must + * write a one to this bit after resume for the machine to work properly. + * To enable this, we no longer attempt to preserve this bit. No machines + * are known to fail if the bit is not preserved. (May 2009) + */ +#define ACPI_PM1_CONTROL_IGNORED_BITS 0x0200 /* Bit 9 */ +#define ACPI_PM1_CONTROL_RESERVED_BITS 0xC1F8 /* Bits 14-15, 3-8 */ +#define ACPI_PM1_CONTROL_PRESERVED_BITS \ + (ACPI_PM1_CONTROL_IGNORED_BITS | ACPI_PM1_CONTROL_RESERVED_BITS) + +#define ACPI_PM2_CONTROL_PRESERVED_BITS 0xFFFFFFFE /* All except bit 0 */ /* * Register IDs @@ -948,12 +1032,10 @@ typedef struct acpi_bit_register_info #define ACPI_REGISTER_PM1_STATUS 0x01 #define ACPI_REGISTER_PM1_ENABLE 0x02 #define ACPI_REGISTER_PM1_CONTROL 0x03 -#define ACPI_REGISTER_PM1A_CONTROL 0x04 -#define ACPI_REGISTER_PM1B_CONTROL 0x05 -#define ACPI_REGISTER_PM2_CONTROL 0x06 -#define ACPI_REGISTER_PM_TIMER 0x07 -#define ACPI_REGISTER_PROCESSOR_BLOCK 0x08 -#define ACPI_REGISTER_SMI_COMMAND_BLOCK 0x09 +#define ACPI_REGISTER_PM2_CONTROL 0x04 +#define ACPI_REGISTER_PM_TIMER 0x05 +#define ACPI_REGISTER_PROCESSOR_BLOCK 0x06 +#define ACPI_REGISTER_SMI_COMMAND_BLOCK 0x07 /* Masks used to access the BitRegisters */ @@ -986,7 +1068,7 @@ typedef struct acpi_bit_register_info #define ACPI_BITMASK_SCI_ENABLE 0x0001 #define ACPI_BITMASK_BUS_MASTER_RLD 0x0002 #define ACPI_BITMASK_GLOBAL_LOCK_RELEASE 0x0004 -#define ACPI_BITMASK_SLEEP_TYPE_X 0x1C00 +#define ACPI_BITMASK_SLEEP_TYPE 0x1C00 #define ACPI_BITMASK_SLEEP_ENABLE 0x2000 #define ACPI_BITMASK_ARB_DISABLE 0x0001 @@ -1013,12 +1095,41 @@ typedef struct acpi_bit_register_info #define ACPI_BITPOSITION_SCI_ENABLE 0x00 #define ACPI_BITPOSITION_BUS_MASTER_RLD 0x01 #define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE 0x02 -#define ACPI_BITPOSITION_SLEEP_TYPE_X 0x0A +#define ACPI_BITPOSITION_SLEEP_TYPE 0x0A #define ACPI_BITPOSITION_SLEEP_ENABLE 0x0D #define ACPI_BITPOSITION_ARB_DISABLE 0x00 +/* Structs and definitions for _OSI support and I/O port validation */ + +#define ACPI_OSI_WIN_2000 0x01 +#define ACPI_OSI_WIN_XP 0x02 +#define ACPI_OSI_WIN_XP_SP1 0x03 +#define ACPI_OSI_WINSRV_2003 0x04 +#define ACPI_OSI_WIN_XP_SP2 0x05 +#define ACPI_OSI_WINSRV_2003_SP1 0x06 +#define ACPI_OSI_WIN_VISTA 0x07 + +#define ACPI_ALWAYS_ILLEGAL 0x00 + +typedef struct acpi_interface_info +{ + char *Name; + UINT8 Value; + +} ACPI_INTERFACE_INFO; + +typedef struct acpi_port_info +{ + char *Name; + UINT16 Start; + UINT16 End; + UINT8 OsiDependency; + +} ACPI_PORT_INFO; + + /***************************************************************************** * * Resource descriptors @@ -1095,6 +1206,7 @@ typedef struct acpi_db_method_info { ACPI_HANDLE MainThreadGate; ACPI_HANDLE ThreadCompleteGate; + ACPI_HANDLE InfoGate; UINT32 *Threads; UINT32 NumThreads; UINT32 NumCreated; @@ -1174,29 +1286,4 @@ typedef struct acpi_debug_mem_block #define ACPI_NUM_MEM_LISTS 2 -typedef struct acpi_memory_list -{ - char *ListName; - void *ListHead; - UINT16 ObjectSize; - UINT16 MaxDepth; - UINT16 CurrentDepth; - UINT16 LinkOffset; - -#ifdef ACPI_DBG_TRACK_ALLOCATIONS - - /* Statistics for debug memory tracking only */ - - UINT32 TotalAllocated; - UINT32 TotalFreed; - UINT32 MaxOccupied; - UINT32 TotalSize; - UINT32 CurrentTotalSize; - UINT32 Requests; - UINT32 Hits; -#endif - -} ACPI_MEMORY_LIST; - - #endif /* __ACLOCAL_H__ */ diff --git a/sys/contrib/dev/acpica/acmacros.h b/sys/contrib/dev/acpica/include/acmacros.h index 6583ba6f494f..b9c323ebd7de 100644 --- a/sys/contrib/dev/acpica/acmacros.h +++ b/sys/contrib/dev/acpica/include/acmacros.h @@ -1,7 +1,6 @@ /****************************************************************************** * * Name: acmacros.h - C macros for the entire subsystem. - * $Revision: 1.195 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -119,40 +118,7 @@ /* - * Data manipulation macros - */ -#define ACPI_LOWORD(l) ((UINT16)(UINT32)(l)) -#define ACPI_HIWORD(l) ((UINT16)((((UINT32)(l)) >> 16) & 0xFFFF)) -#define ACPI_LOBYTE(l) ((UINT8)(UINT16)(l)) -#define ACPI_HIBYTE(l) ((UINT8)((((UINT16)(l)) >> 8) & 0xFF)) - -#define ACPI_SET_BIT(target,bit) ((target) |= (bit)) -#define ACPI_CLEAR_BIT(target,bit) ((target) &= ~(bit)) -#define ACPI_MIN(a,b) (((a)<(b))?(a):(b)) -#define ACPI_MAX(a,b) (((a)>(b))?(a):(b)) - -/* Size calculation */ - -#define ACPI_ARRAY_LENGTH(x) (sizeof(x) / sizeof((x)[0])) - - -/* - * Full 64-bit integer must be available on both 32-bit and 64-bit platforms - */ -#define ACPI_LODWORD(l) ((UINT32)(UINT64)(l)) -#define ACPI_HIDWORD(l) ((UINT32)(((*(UINT64_STRUCT *)(void *)(&l))).Hi)) - - -/* - * printf() format helpers - */ - -/* Split 64-bit integer into two 32-bit values. Use with %8.8X%8.8X */ - -#define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i),ACPI_LODWORD(i) - -/* - * Extract data using a pointer. Any more than a byte and we + * Extract data using a pointer. Any more than a byte and we * get into potential aligment issues -- see the STORE macros below. * Use with care. */ @@ -166,27 +132,20 @@ #define ACPI_SET64(ptr) *ACPI_CAST_PTR (UINT64, ptr) /* - * Pointer manipulation + * printf() format helpers */ -#define ACPI_CAST_PTR(t, p) ((t *) (ACPI_UINTPTR_T) (p)) -#define ACPI_CAST_INDIRECT_PTR(t, p) ((t **) (ACPI_UINTPTR_T) (p)) -#define ACPI_ADD_PTR(t,a,b) ACPI_CAST_PTR (t, (ACPI_CAST_PTR (UINT8,(a)) + (ACPI_NATIVE_UINT)(b))) -#define ACPI_PTR_DIFF(a,b) (ACPI_NATIVE_UINT) (ACPI_CAST_PTR (UINT8,(a)) - ACPI_CAST_PTR (UINT8,(b))) -/* Pointer/Integer type conversions */ +/* Split 64-bit integer into two 32-bit values. Use with %8.8X%8.8X */ -#define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void,(void *) NULL,(ACPI_NATIVE_UINT) i) -#define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p,(void *) NULL) -#define ACPI_OFFSET(d,f) (ACPI_SIZE) ACPI_PTR_DIFF (&(((d *)0)->f),(void *) NULL) -#define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i) -#define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i) +#define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i), ACPI_LODWORD(i) -#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED -#define ACPI_COMPARE_NAME(a,b) (*ACPI_CAST_PTR (UINT32,(a)) == *ACPI_CAST_PTR (UINT32,(b))) +#if ACPI_MACHINE_WIDTH == 64 +#define ACPI_FORMAT_NATIVE_UINT(i) ACPI_FORMAT_UINT64(i) #else -#define ACPI_COMPARE_NAME(a,b) (!ACPI_STRNCMP (ACPI_CAST_PTR (char,(a)), ACPI_CAST_PTR (char,(b)), ACPI_NAME_SIZE)) +#define ACPI_FORMAT_NATIVE_UINT(i) 0, (i) #endif + /* * Macros for moving data around to/from buffers that are possibly unaligned. * If the hardware supports the transfer of unaligned data, just do the store. @@ -197,37 +156,33 @@ * Macros for big-endian machines */ -/* This macro sets a buffer index, starting from the end of the buffer */ - -#define ACPI_BUFFER_INDEX(BufLen,BufOffset,ByteGran) ((BufLen) - (((BufOffset)+1) * (ByteGran))) - /* These macros reverse the bytes during the move, converting little-endian to big endian */ /* Big Endian <== Little Endian */ /* Hi...Lo Lo...Hi */ /* 16-bit source, 16/32/64 destination */ -#define ACPI_MOVE_16_TO_16(d,s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[1];\ +#define ACPI_MOVE_16_TO_16(d, s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[1];\ (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[0];} -#define ACPI_MOVE_16_TO_32(d,s) {(*(UINT32 *)(void *)(d))=0;\ +#define ACPI_MOVE_16_TO_32(d, s) {(*(UINT32 *)(void *)(d))=0;\ ((UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[1];\ ((UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[0];} -#define ACPI_MOVE_16_TO_64(d,s) {(*(UINT64 *)(void *)(d))=0;\ +#define ACPI_MOVE_16_TO_64(d, s) {(*(UINT64 *)(void *)(d))=0;\ ((UINT8 *)(void *)(d))[6] = ((UINT8 *)(void *)(s))[1];\ ((UINT8 *)(void *)(d))[7] = ((UINT8 *)(void *)(s))[0];} /* 32-bit source, 16/32/64 destination */ -#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ +#define ACPI_MOVE_32_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */ -#define ACPI_MOVE_32_TO_32(d,s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[3];\ +#define ACPI_MOVE_32_TO_32(d, s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[3];\ (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[2];\ (( UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[1];\ (( UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[0];} -#define ACPI_MOVE_32_TO_64(d,s) {(*(UINT64 *)(void *)(d))=0;\ +#define ACPI_MOVE_32_TO_64(d, s) {(*(UINT64 *)(void *)(d))=0;\ ((UINT8 *)(void *)(d))[4] = ((UINT8 *)(void *)(s))[3];\ ((UINT8 *)(void *)(d))[5] = ((UINT8 *)(void *)(s))[2];\ ((UINT8 *)(void *)(d))[6] = ((UINT8 *)(void *)(s))[1];\ @@ -235,11 +190,11 @@ /* 64-bit source, 16/32/64 destination */ -#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ +#define ACPI_MOVE_64_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */ -#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ +#define ACPI_MOVE_64_TO_32(d, s) ACPI_MOVE_32_TO_32(d, s) /* Truncate to 32 */ -#define ACPI_MOVE_64_TO_64(d,s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[7];\ +#define ACPI_MOVE_64_TO_64(d, s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[7];\ (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[6];\ (( UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[5];\ (( UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[4];\ @@ -252,63 +207,59 @@ * Macros for little-endian machines */ -/* This macro sets a buffer index, starting from the beginning of the buffer */ - -#define ACPI_BUFFER_INDEX(BufLen,BufOffset,ByteGran) (BufOffset) - #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED /* The hardware supports unaligned transfers, just do the little-endian move */ /* 16-bit source, 16/32/64 destination */ -#define ACPI_MOVE_16_TO_16(d,s) *(UINT16 *)(void *)(d) = *(UINT16 *)(void *)(s) -#define ACPI_MOVE_16_TO_32(d,s) *(UINT32 *)(void *)(d) = *(UINT16 *)(void *)(s) -#define ACPI_MOVE_16_TO_64(d,s) *(UINT64 *)(void *)(d) = *(UINT16 *)(void *)(s) +#define ACPI_MOVE_16_TO_16(d, s) *(UINT16 *)(void *)(d) = *(UINT16 *)(void *)(s) +#define ACPI_MOVE_16_TO_32(d, s) *(UINT32 *)(void *)(d) = *(UINT16 *)(void *)(s) +#define ACPI_MOVE_16_TO_64(d, s) *(UINT64 *)(void *)(d) = *(UINT16 *)(void *)(s) /* 32-bit source, 16/32/64 destination */ -#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ -#define ACPI_MOVE_32_TO_32(d,s) *(UINT32 *)(void *)(d) = *(UINT32 *)(void *)(s) -#define ACPI_MOVE_32_TO_64(d,s) *(UINT64 *)(void *)(d) = *(UINT32 *)(void *)(s) +#define ACPI_MOVE_32_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */ +#define ACPI_MOVE_32_TO_32(d, s) *(UINT32 *)(void *)(d) = *(UINT32 *)(void *)(s) +#define ACPI_MOVE_32_TO_64(d, s) *(UINT64 *)(void *)(d) = *(UINT32 *)(void *)(s) /* 64-bit source, 16/32/64 destination */ -#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ -#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ -#define ACPI_MOVE_64_TO_64(d,s) *(UINT64 *)(void *)(d) = *(UINT64 *)(void *)(s) +#define ACPI_MOVE_64_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */ +#define ACPI_MOVE_64_TO_32(d, s) ACPI_MOVE_32_TO_32(d, s) /* Truncate to 32 */ +#define ACPI_MOVE_64_TO_64(d, s) *(UINT64 *)(void *)(d) = *(UINT64 *)(void *)(s) #else /* - * The hardware does not support unaligned transfers. We must move the - * data one byte at a time. These macros work whether the source or - * the destination (or both) is/are unaligned. (Little-endian move) + * The hardware does not support unaligned transfers. We must move the + * data one byte at a time. These macros work whether the source or + * the destination (or both) is/are unaligned. (Little-endian move) */ /* 16-bit source, 16/32/64 destination */ -#define ACPI_MOVE_16_TO_16(d,s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];\ +#define ACPI_MOVE_16_TO_16(d, s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];\ (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[1];} -#define ACPI_MOVE_16_TO_32(d,s) {(*(UINT32 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d,s);} -#define ACPI_MOVE_16_TO_64(d,s) {(*(UINT64 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d,s);} +#define ACPI_MOVE_16_TO_32(d, s) {(*(UINT32 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d, s);} +#define ACPI_MOVE_16_TO_64(d, s) {(*(UINT64 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d, s);} /* 32-bit source, 16/32/64 destination */ -#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ +#define ACPI_MOVE_32_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */ -#define ACPI_MOVE_32_TO_32(d,s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];\ +#define ACPI_MOVE_32_TO_32(d, s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];\ (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[1];\ (( UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[2];\ (( UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[3];} -#define ACPI_MOVE_32_TO_64(d,s) {(*(UINT64 *)(void *)(d)) = 0; ACPI_MOVE_32_TO_32(d,s);} +#define ACPI_MOVE_32_TO_64(d, s) {(*(UINT64 *)(void *)(d)) = 0; ACPI_MOVE_32_TO_32(d, s);} /* 64-bit source, 16/32/64 destination */ -#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ -#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */ -#define ACPI_MOVE_64_TO_64(d,s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];\ +#define ACPI_MOVE_64_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */ +#define ACPI_MOVE_64_TO_32(d, s) ACPI_MOVE_32_TO_32(d, s) /* Truncate to 32 */ +#define ACPI_MOVE_64_TO_64(d, s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];\ (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[1];\ (( UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[2];\ (( UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[3];\ @@ -319,65 +270,53 @@ #endif #endif -/* Macros based on machine integer width */ - -#if ACPI_MACHINE_WIDTH == 32 -#define ACPI_MOVE_SIZE_TO_16(d,s) ACPI_MOVE_32_TO_16(d,s) - -#elif ACPI_MACHINE_WIDTH == 64 -#define ACPI_MOVE_SIZE_TO_16(d,s) ACPI_MOVE_64_TO_16(d,s) - -#else -#error unknown ACPI_MACHINE_WIDTH -#endif - /* * Fast power-of-two math macros for non-optimized compilers */ -#define _ACPI_DIV(value,PowerOf2) ((UINT32) ((value) >> (PowerOf2))) -#define _ACPI_MUL(value,PowerOf2) ((UINT32) ((value) << (PowerOf2))) -#define _ACPI_MOD(value,Divisor) ((UINT32) ((value) & ((Divisor) -1))) +#define _ACPI_DIV(value, PowerOf2) ((UINT32) ((value) >> (PowerOf2))) +#define _ACPI_MUL(value, PowerOf2) ((UINT32) ((value) << (PowerOf2))) +#define _ACPI_MOD(value, Divisor) ((UINT32) ((value) & ((Divisor) -1))) -#define ACPI_DIV_2(a) _ACPI_DIV(a,1) -#define ACPI_MUL_2(a) _ACPI_MUL(a,1) -#define ACPI_MOD_2(a) _ACPI_MOD(a,2) +#define ACPI_DIV_2(a) _ACPI_DIV(a, 1) +#define ACPI_MUL_2(a) _ACPI_MUL(a, 1) +#define ACPI_MOD_2(a) _ACPI_MOD(a, 2) -#define ACPI_DIV_4(a) _ACPI_DIV(a,2) -#define ACPI_MUL_4(a) _ACPI_MUL(a,2) -#define ACPI_MOD_4(a) _ACPI_MOD(a,4) +#define ACPI_DIV_4(a) _ACPI_DIV(a, 2) +#define ACPI_MUL_4(a) _ACPI_MUL(a, 2) +#define ACPI_MOD_4(a) _ACPI_MOD(a, 4) -#define ACPI_DIV_8(a) _ACPI_DIV(a,3) -#define ACPI_MUL_8(a) _ACPI_MUL(a,3) -#define ACPI_MOD_8(a) _ACPI_MOD(a,8) +#define ACPI_DIV_8(a) _ACPI_DIV(a, 3) +#define ACPI_MUL_8(a) _ACPI_MUL(a, 3) +#define ACPI_MOD_8(a) _ACPI_MOD(a, 8) -#define ACPI_DIV_16(a) _ACPI_DIV(a,4) -#define ACPI_MUL_16(a) _ACPI_MUL(a,4) -#define ACPI_MOD_16(a) _ACPI_MOD(a,16) +#define ACPI_DIV_16(a) _ACPI_DIV(a, 4) +#define ACPI_MUL_16(a) _ACPI_MUL(a, 4) +#define ACPI_MOD_16(a) _ACPI_MOD(a, 16) -#define ACPI_DIV_32(a) _ACPI_DIV(a,5) -#define ACPI_MUL_32(a) _ACPI_MUL(a,5) -#define ACPI_MOD_32(a) _ACPI_MOD(a,32) +#define ACPI_DIV_32(a) _ACPI_DIV(a, 5) +#define ACPI_MUL_32(a) _ACPI_MUL(a, 5) +#define ACPI_MOD_32(a) _ACPI_MOD(a, 32) /* * Rounding macros (Power of two boundaries only) */ -#define ACPI_ROUND_DOWN(value,boundary) (((ACPI_NATIVE_UINT)(value)) & \ - (~(((ACPI_NATIVE_UINT) boundary)-1))) +#define ACPI_ROUND_DOWN(value, boundary) (((ACPI_SIZE)(value)) & \ + (~(((ACPI_SIZE) boundary)-1))) -#define ACPI_ROUND_UP(value,boundary) ((((ACPI_NATIVE_UINT)(value)) + \ - (((ACPI_NATIVE_UINT) boundary)-1)) & \ - (~(((ACPI_NATIVE_UINT) boundary)-1))) +#define ACPI_ROUND_UP(value, boundary) ((((ACPI_SIZE)(value)) + \ + (((ACPI_SIZE) boundary)-1)) & \ + (~(((ACPI_SIZE) boundary)-1))) -/* Note: sizeof(ACPI_NATIVE_UINT) evaluates to either 2, 4, or 8 */ +/* Note: sizeof(ACPI_SIZE) evaluates to either 4 or 8 (32- vs 64-bit mode) */ -#define ACPI_ROUND_DOWN_TO_32BIT(a) ACPI_ROUND_DOWN(a,4) -#define ACPI_ROUND_DOWN_TO_64BIT(a) ACPI_ROUND_DOWN(a,8) -#define ACPI_ROUND_DOWN_TO_NATIVE_WORD(a) ACPI_ROUND_DOWN(a,sizeof(ACPI_NATIVE_UINT)) +#define ACPI_ROUND_DOWN_TO_32BIT(a) ACPI_ROUND_DOWN(a, 4) +#define ACPI_ROUND_DOWN_TO_64BIT(a) ACPI_ROUND_DOWN(a, 8) +#define ACPI_ROUND_DOWN_TO_NATIVE_WORD(a) ACPI_ROUND_DOWN(a, sizeof(ACPI_SIZE)) -#define ACPI_ROUND_UP_TO_32BIT(a) ACPI_ROUND_UP(a,4) -#define ACPI_ROUND_UP_TO_64BIT(a) ACPI_ROUND_UP(a,8) -#define ACPI_ROUND_UP_TO_NATIVE_WORD(a) ACPI_ROUND_UP(a,sizeof(ACPI_NATIVE_UINT)) +#define ACPI_ROUND_UP_TO_32BIT(a) ACPI_ROUND_UP(a, 4) +#define ACPI_ROUND_UP_TO_64BIT(a) ACPI_ROUND_UP(a, 8) +#define ACPI_ROUND_UP_TO_NATIVE_WORD(a) ACPI_ROUND_UP(a, sizeof(ACPI_SIZE)) #define ACPI_ROUND_BITS_UP_TO_BYTES(a) ACPI_DIV_8((a) + 7) #define ACPI_ROUND_BITS_DOWN_TO_BYTES(a) ACPI_DIV_8((a)) @@ -386,9 +325,9 @@ /* Generic (non-power-of-two) rounding */ -#define ACPI_ROUND_UP_TO(value,boundary) (((value) + ((boundary)-1)) / (boundary)) +#define ACPI_ROUND_UP_TO(value, boundary) (((value) + ((boundary)-1)) / (boundary)) -#define ACPI_IS_MISALIGNED(value) (((ACPI_NATIVE_UINT)value) & (sizeof(ACPI_NATIVE_UINT)-1)) +#define ACPI_IS_MISALIGNED(value) (((ACPI_SIZE) value) & (sizeof(ACPI_SIZE)-1)) /* * Bitmask creation @@ -399,9 +338,6 @@ #define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_INTEGER_MAX) << ((UINT32) (position)))) #define ACPI_MASK_BITS_BELOW(position) ((ACPI_INTEGER_MAX) << ((UINT32) (position))) -#define ACPI_IS_OCTAL_DIGIT(d) (((char)(d) >= '0') && ((char)(d) <= '7')) - - /* Bitfields within ACPI registers */ #define ACPI_REGISTER_PREPARE_BITS(Val, Pos, Mask) ((Val << Pos) & Mask) @@ -409,46 +345,25 @@ #define ACPI_INSERT_BITS(Target, Mask, Source) Target = ((Target & (~(Mask))) | (Source & Mask)) -/* Generate a UUID */ - -#define ACPI_INIT_UUID(a,b,c,d0,d1,d2,d3,d4,d5,d6,d7) \ - (a) & 0xFF, ((a) >> 8) & 0xFF, ((a) >> 16) & 0xFF, ((a) >> 24) & 0xFF, \ - (b) & 0xFF, ((b) >> 8) & 0xFF, \ - (c) & 0xFF, ((c) >> 8) & 0xFF, \ - (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) - /* - * An ACPI_NAMESPACE_NODE * can appear in some contexts, - * where a pointer to an ACPI_OPERAND_OBJECT can also - * appear. This macro is used to distinguish them. + * An ACPI_NAMESPACE_NODE can appear in some contexts + * where a pointer to an ACPI_OPERAND_OBJECT can also + * appear. This macro is used to distinguish them. * * The "Descriptor" field is the first field in both structures. */ #define ACPI_GET_DESCRIPTOR_TYPE(d) (((ACPI_DESCRIPTOR *)(void *)(d))->Common.DescriptorType) -#define ACPI_SET_DESCRIPTOR_TYPE(d,t) (((ACPI_DESCRIPTOR *)(void *)(d))->Common.DescriptorType = t) - - -/* Macro to test the object type */ - -#define ACPI_GET_OBJECT_TYPE(d) (((ACPI_OPERAND_OBJECT *)(void *)(d))->Common.Type) - -/* Macro to check the table flags for SINGLE or MULTIPLE tables are allowed */ - -#define ACPI_IS_SINGLE_TABLE(x) (((x) & 0x01) == ACPI_TABLE_SINGLE ? 1 : 0) +#define ACPI_SET_DESCRIPTOR_TYPE(d, t) (((ACPI_DESCRIPTOR *)(void *)(d))->Common.DescriptorType = t) /* * Macros for the master AML opcode table */ -#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT) -#define ACPI_OP(Name,PArgs,IArgs,ObjType,Class,Type,Flags) {Name,(UINT32)(PArgs),(UINT32)(IArgs),(UINT32)(Flags),ObjType,Class,Type} +#if defined (ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT) +#define ACPI_OP(Name, PArgs, IArgs, ObjType, Class, Type, Flags) \ + {Name, (UINT32)(PArgs), (UINT32)(IArgs), (UINT32)(Flags), ObjType, Class, Type} #else -#define ACPI_OP(Name,PArgs,IArgs,ObjType,Class,Type,Flags) {(UINT32)(PArgs),(UINT32)(IArgs),(UINT32)(Flags),ObjType,Class,Type} -#endif - -#ifdef ACPI_DISASSEMBLER -#define ACPI_DISASM_ONLY_MEMBERS(a) a; -#else -#define ACPI_DISASM_ONLY_MEMBERS(a) +#define ACPI_OP(Name, PArgs, IArgs, ObjType, Class, Type, Flags) \ + {(UINT32)(PArgs), (UINT32)(IArgs), (UINT32)(Flags), ObjType, Class, Type} #endif #define ARG_TYPE_WIDTH 5 @@ -460,116 +375,64 @@ #define ARG_6(x) ((UINT32)(x) << (5 * ARG_TYPE_WIDTH)) #define ARGI_LIST1(a) (ARG_1(a)) -#define ARGI_LIST2(a,b) (ARG_1(b)|ARG_2(a)) -#define ARGI_LIST3(a,b,c) (ARG_1(c)|ARG_2(b)|ARG_3(a)) -#define ARGI_LIST4(a,b,c,d) (ARG_1(d)|ARG_2(c)|ARG_3(b)|ARG_4(a)) -#define ARGI_LIST5(a,b,c,d,e) (ARG_1(e)|ARG_2(d)|ARG_3(c)|ARG_4(b)|ARG_5(a)) -#define ARGI_LIST6(a,b,c,d,e,f) (ARG_1(f)|ARG_2(e)|ARG_3(d)|ARG_4(c)|ARG_5(b)|ARG_6(a)) +#define ARGI_LIST2(a, b) (ARG_1(b)|ARG_2(a)) +#define ARGI_LIST3(a, b, c) (ARG_1(c)|ARG_2(b)|ARG_3(a)) +#define ARGI_LIST4(a, b, c, d) (ARG_1(d)|ARG_2(c)|ARG_3(b)|ARG_4(a)) +#define ARGI_LIST5(a, b, c, d, e) (ARG_1(e)|ARG_2(d)|ARG_3(c)|ARG_4(b)|ARG_5(a)) +#define ARGI_LIST6(a, b, c, d, e, f) (ARG_1(f)|ARG_2(e)|ARG_3(d)|ARG_4(c)|ARG_5(b)|ARG_6(a)) #define ARGP_LIST1(a) (ARG_1(a)) -#define ARGP_LIST2(a,b) (ARG_1(a)|ARG_2(b)) -#define ARGP_LIST3(a,b,c) (ARG_1(a)|ARG_2(b)|ARG_3(c)) -#define ARGP_LIST4(a,b,c,d) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)) -#define ARGP_LIST5(a,b,c,d,e) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e)) -#define ARGP_LIST6(a,b,c,d,e,f) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e)|ARG_6(f)) +#define ARGP_LIST2(a, b) (ARG_1(a)|ARG_2(b)) +#define ARGP_LIST3(a, b, c) (ARG_1(a)|ARG_2(b)|ARG_3(c)) +#define ARGP_LIST4(a, b, c, d) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)) +#define ARGP_LIST5(a, b, c, d, e) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e)) +#define ARGP_LIST6(a, b, c, d, e, f) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e)|ARG_6(f)) #define GET_CURRENT_ARG_TYPE(List) (List & ((UINT32) 0x1F)) #define INCREMENT_ARG_LIST(List) (List >>= ((UINT32) ARG_TYPE_WIDTH)) - -#if defined (ACPI_DEBUG_OUTPUT) || !defined (ACPI_NO_ERROR_MESSAGES) -/* - * Module name is include in both debug and non-debug versions primarily for - * error messages. The __FILE__ macro is not very useful for this, because it - * often includes the entire pathname to the module - */ -#define ACPI_MODULE_NAME(Name) static char ACPI_UNUSED_VAR *_AcpiModuleName = Name; -#else -#define ACPI_MODULE_NAME(Name) -#endif - /* * Ascii error messages can be configured out */ #ifndef ACPI_NO_ERROR_MESSAGES -#define AE_INFO _AcpiModuleName, __LINE__ - /* * Error reporting. Callers module and line number are inserted by AE_INFO, * the plist contains a set of parens to allow variable-length lists. * These macros are used for both the debug and non-debug versions of the code. */ -#define ACPI_INFO(plist) AcpiUtInfo plist -#define ACPI_WARNING(plist) AcpiUtWarning plist -#define ACPI_EXCEPTION(plist) AcpiUtException plist -#define ACPI_ERROR(plist) AcpiUtError plist -#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_ERROR_NAMESPACE(s, e) AcpiNsReportError (AE_INFO, s, e); +#define ACPI_ERROR_METHOD(s, n, p, e) AcpiNsReportMethodError (AE_INFO, s, n, p, e); #else /* No error messages */ -#define ACPI_INFO(plist) -#define ACPI_WARNING(plist) -#define ACPI_EXCEPTION(plist) -#define ACPI_ERROR(plist) -#define ACPI_ERROR_NAMESPACE(s,e) -#define ACPI_ERROR_METHOD(s,n,p,e) -#endif +#define ACPI_ERROR_NAMESPACE(s, e) +#define ACPI_ERROR_METHOD(s, n, p, e) + +#endif /* ACPI_NO_ERROR_MESSAGES */ /* * Debug macros that are conditionally compiled */ #ifdef ACPI_DEBUG_OUTPUT - -/* - * Common parameters used for debug output functions: - * line number, function name, module(file) name, component ID - */ -#define ACPI_DEBUG_PARAMETERS __LINE__, ACPI_GET_FUNCTION_NAME, _AcpiModuleName, _COMPONENT - /* * Function entry tracing */ - -/* - * If ACPI_GET_FUNCTION_NAME was not defined in the compiler-dependent header, - * define it now. This is the case where there the compiler does not support - * a __FUNCTION__ macro or equivalent. We save the function name on the - * local stack. - */ -#ifndef ACPI_GET_FUNCTION_NAME -#define ACPI_GET_FUNCTION_NAME _AcpiFunctionName -/* - * The Name parameter should be the procedure name as a quoted string. - * This is declared as a local string ("MyFunctionName") so that it can - * be also used by the function exit macros below. - * Note: (const char) is used to be compatible with the debug interfaces - * and macros such as __FUNCTION__. - */ -#define ACPI_FUNCTION_NAME(Name) const char *_AcpiFunctionName = #Name; - -#else -/* Compiler supports __FUNCTION__ (or equivalent) -- Ignore this macro */ - -#define ACPI_FUNCTION_NAME(Name) -#endif - #define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \ AcpiUtTrace(ACPI_DEBUG_PARAMETERS) -#define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a) \ - AcpiUtTracePtr(ACPI_DEBUG_PARAMETERS,(void *)b) -#define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a) \ - AcpiUtTraceU32(ACPI_DEBUG_PARAMETERS,(UINT32)b) -#define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a) \ - AcpiUtTraceStr(ACPI_DEBUG_PARAMETERS,(char *)b) +#define ACPI_FUNCTION_TRACE_PTR(a, b) ACPI_FUNCTION_NAME(a) \ + AcpiUtTracePtr(ACPI_DEBUG_PARAMETERS, (void *)b) +#define ACPI_FUNCTION_TRACE_U32(a, b) ACPI_FUNCTION_NAME(a) \ + AcpiUtTraceU32(ACPI_DEBUG_PARAMETERS, (UINT32)b) +#define ACPI_FUNCTION_TRACE_STR(a, b) ACPI_FUNCTION_NAME(a) \ + AcpiUtTraceStr(ACPI_DEBUG_PARAMETERS, (char *)b) #define ACPI_FUNCTION_ENTRY() AcpiUtTrackStackPtr() /* * Function exit tracing. - * WARNING: These macros include a return statement. This is usually considered + * WARNING: These macros include a return statement. This is usually considered * bad form, but having a separate exit macro is very ugly and difficult to maintain. * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros * so that "_AcpiFunctionName" is defined. @@ -637,33 +500,17 @@ /* Conditional execution */ #define ACPI_DEBUG_EXEC(a) a -#define ACPI_NORMAL_EXEC(a) - -#define ACPI_DEBUG_DEFINE(a) a; #define ACPI_DEBUG_ONLY_MEMBERS(a) a; #define _VERBOSE_STRUCTURES -/* Stack and buffer dumping */ - -#define ACPI_DUMP_STACK_ENTRY(a) AcpiExDumpOperand((a),0) -#define ACPI_DUMP_OPERANDS(a,b,c,d,e) AcpiExDumpOperands(a,b,c,d,e,_AcpiModuleName,__LINE__) - - -#define ACPI_DUMP_ENTRY(a,b) AcpiNsDumpEntry (a,b) -#define ACPI_DUMP_PATHNAME(a,b,c,d) AcpiNsDumpPathname(a,b,c,d) -#define ACPI_DUMP_RESOURCE_LIST(a) AcpiRsDumpResourceList(a) -#define ACPI_DUMP_BUFFER(a,b) AcpiUtDumpBuffer((UINT8 *)a,b,DB_BYTE_DISPLAY,_COMPONENT) - -/* - * Master debug print macros - * Print iff: - * 1) Debug print for the current component is enabled - * 2) Debug error level or trace level for the print statement is enabled - */ -#define ACPI_DEBUG_PRINT(plist) AcpiUtDebugPrint plist -#define ACPI_DEBUG_PRINT_RAW(plist) AcpiUtDebugPrintRaw plist +/* Various object display routines for debug */ +#define ACPI_DUMP_STACK_ENTRY(a) AcpiExDumpOperand((a), 0) +#define ACPI_DUMP_OPERANDS(a, b ,c) AcpiExDumpOperands(a, b, c) +#define ACPI_DUMP_ENTRY(a, b) AcpiNsDumpEntry (a, b) +#define ACPI_DUMP_PATHNAME(a, b, c, d) AcpiNsDumpPathname(a, b, c, d) +#define ACPI_DUMP_BUFFER(a, b) AcpiUtDumpBuffer((UINT8 *) a, b, DB_BYTE_DISPLAY, _COMPONENT) #else /* @@ -671,26 +518,21 @@ * leaving no executable debug code! */ #define ACPI_DEBUG_EXEC(a) -#define ACPI_NORMAL_EXEC(a) a; - -#define ACPI_DEBUG_DEFINE(a) #define ACPI_DEBUG_ONLY_MEMBERS(a) -#define ACPI_FUNCTION_NAME(a) #define ACPI_FUNCTION_TRACE(a) -#define ACPI_FUNCTION_TRACE_PTR(a,b) -#define ACPI_FUNCTION_TRACE_U32(a,b) -#define ACPI_FUNCTION_TRACE_STR(a,b) +#define ACPI_FUNCTION_TRACE_PTR(a, b) +#define ACPI_FUNCTION_TRACE_U32(a, b) +#define ACPI_FUNCTION_TRACE_STR(a, b) #define ACPI_FUNCTION_EXIT #define ACPI_FUNCTION_STATUS_EXIT(s) #define ACPI_FUNCTION_VALUE_EXIT(s) #define ACPI_FUNCTION_ENTRY() #define ACPI_DUMP_STACK_ENTRY(a) -#define ACPI_DUMP_OPERANDS(a,b,c,d,e) -#define ACPI_DUMP_ENTRY(a,b) -#define ACPI_DUMP_TABLES(a,b) -#define ACPI_DUMP_PATHNAME(a,b,c,d) -#define ACPI_DUMP_RESOURCE_LIST(a) -#define ACPI_DUMP_BUFFER(a,b) +#define ACPI_DUMP_OPERANDS(a, b, c) +#define ACPI_DUMP_ENTRY(a, b) +#define ACPI_DUMP_TABLES(a, b) +#define ACPI_DUMP_PATHNAME(a, b, c, d) +#define ACPI_DUMP_BUFFER(a, b) #define ACPI_DEBUG_PRINT(pl) #define ACPI_DEBUG_PRINT_RAW(pl) @@ -701,7 +543,7 @@ #define return_UINT32(s) return(s) #define return_PTR(s) return(s) -#endif +#endif /* ACPI_DEBUG_OUTPUT */ /* * Some code only gets executed when the debugger is built in. @@ -715,28 +557,17 @@ #endif -#ifdef ACPI_DEBUG_OUTPUT -/* - * 1) Set name to blanks - * 2) Copy the object name - */ -#define ACPI_ADD_OBJECT_NAME(a,b) ACPI_MEMSET (a->Common.Name, ' ', sizeof (a->Common.Name));\ - ACPI_STRNCPY (a->Common.Name, AcpiGbl_NsTypeNames[b], sizeof (a->Common.Name)) -#else - -#define ACPI_ADD_OBJECT_NAME(a,b) -#endif - - /* * Memory allocation tracking (DEBUG ONLY) */ +#define ACPI_MEM_PARAMETERS _COMPONENT, _AcpiModuleName, __LINE__ + #ifndef ACPI_DBG_TRACK_ALLOCATIONS /* Memory allocation */ -#define ACPI_ALLOCATE(a) AcpiUtAllocate((ACPI_SIZE)(a),_COMPONENT,_AcpiModuleName,__LINE__) -#define ACPI_ALLOCATE_ZEROED(a) AcpiUtAllocateZeroed((ACPI_SIZE)(a), _COMPONENT,_AcpiModuleName,__LINE__) +#define ACPI_ALLOCATE(a) AcpiUtAllocate((ACPI_SIZE) (a), ACPI_MEM_PARAMETERS) +#define ACPI_ALLOCATE_ZEROED(a) AcpiUtAllocateZeroed((ACPI_SIZE) (a), ACPI_MEM_PARAMETERS) #define ACPI_FREE(a) AcpiOsFree(a) #define ACPI_MEM_TRACKING(a) @@ -744,11 +575,27 @@ /* Memory allocation */ -#define ACPI_ALLOCATE(a) AcpiUtAllocateAndTrack((ACPI_SIZE)(a),_COMPONENT,_AcpiModuleName,__LINE__) -#define ACPI_ALLOCATE_ZEROED(a) AcpiUtAllocateZeroedAndTrack((ACPI_SIZE)(a), _COMPONENT,_AcpiModuleName,__LINE__) -#define ACPI_FREE(a) AcpiUtFreeAndTrack(a,_COMPONENT,_AcpiModuleName,__LINE__) +#define ACPI_ALLOCATE(a) AcpiUtAllocateAndTrack((ACPI_SIZE) (a), ACPI_MEM_PARAMETERS) +#define ACPI_ALLOCATE_ZEROED(a) AcpiUtAllocateZeroedAndTrack((ACPI_SIZE) (a), ACPI_MEM_PARAMETERS) +#define ACPI_FREE(a) AcpiUtFreeAndTrack(a, ACPI_MEM_PARAMETERS) #define ACPI_MEM_TRACKING(a) a #endif /* ACPI_DBG_TRACK_ALLOCATIONS */ + +/* + * Macros used for ACPICA utilities only + */ + +/* Generate a UUID */ + +#define ACPI_INIT_UUID(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \ + (a) & 0xFF, ((a) >> 8) & 0xFF, ((a) >> 16) & 0xFF, ((a) >> 24) & 0xFF, \ + (b) & 0xFF, ((b) >> 8) & 0xFF, \ + (c) & 0xFF, ((c) >> 8) & 0xFF, \ + (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) + +#define ACPI_IS_OCTAL_DIGIT(d) (((char)(d) >= '0') && ((char)(d) <= '7')) + + #endif /* ACMACROS_H */ diff --git a/sys/contrib/dev/acpica/acnames.h b/sys/contrib/dev/acpica/include/acnames.h index 344a7cb40d23..eb9944aa16e5 100644 --- a/sys/contrib/dev/acpica/acnames.h +++ b/sys/contrib/dev/acpica/include/acnames.h @@ -1,7 +1,6 @@ /****************************************************************************** * * Name: acnames.h - Global names and strings - * $Revision: 1.7 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/acnamesp.h b/sys/contrib/dev/acpica/include/acnamesp.h index 8d07fb3dee93..3f9a6ce6faf8 100644 --- a/sys/contrib/dev/acpica/acnamesp.h +++ b/sys/contrib/dev/acpica/include/acnamesp.h @@ -1,7 +1,6 @@ /****************************************************************************** * * Name: acnamesp.h - Namespace subcomponent prototypes and defines - * $Revision: 1.152 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -169,7 +168,7 @@ AcpiNsLoadNamespace ( ACPI_STATUS AcpiNsLoadTable ( - ACPI_NATIVE_UINT TableIndex, + UINT32 TableIndex, ACPI_NAMESPACE_NODE *Node); @@ -188,23 +187,28 @@ AcpiNsWalkNamespace ( ACPI_NAMESPACE_NODE * AcpiNsGetNextNode ( - ACPI_OBJECT_TYPE Type, ACPI_NAMESPACE_NODE *Parent, ACPI_NAMESPACE_NODE *Child); +ACPI_NAMESPACE_NODE * +AcpiNsGetNextNodeTyped ( + ACPI_OBJECT_TYPE Type, + ACPI_NAMESPACE_NODE *Parent, + ACPI_NAMESPACE_NODE *Child); /* * nsparse - table parsing */ ACPI_STATUS AcpiNsParseTable ( - ACPI_NATIVE_UINT TableIndex, + UINT32 TableIndex, ACPI_NAMESPACE_NODE *StartNode); ACPI_STATUS AcpiNsOneCompleteParse ( - ACPI_NATIVE_UINT PassNumber, - ACPI_NATIVE_UINT TableIndex); + UINT32 PassNumber, + UINT32 TableIndex, + ACPI_NAMESPACE_NODE *StartNode); /* @@ -308,13 +312,35 @@ AcpiNsEvaluate ( /* + * nspredef - Support for predefined/reserved names + */ +ACPI_STATUS +AcpiNsCheckPredefinedNames ( + ACPI_NAMESPACE_NODE *Node, + UINT32 UserParamCount, + ACPI_STATUS ReturnStatus, + ACPI_OPERAND_OBJECT **ReturnObject); + +const ACPI_PREDEFINED_INFO * +AcpiNsCheckForPredefinedName ( + ACPI_NAMESPACE_NODE *Node); + +void +AcpiNsCheckParameterCount ( + char *Pathname, + ACPI_NAMESPACE_NODE *Node, + UINT32 UserParamCount, + const ACPI_PREDEFINED_INFO *Info); + + +/* * nsnames - Name and Scope manipulation */ UINT32 AcpiNsOpensScope ( ACPI_OBJECT_TYPE Type); -void +ACPI_STATUS AcpiNsBuildExternalPath ( ACPI_NAMESPACE_NODE *Node, ACPI_SIZE Size, @@ -341,7 +367,7 @@ AcpiNsPatternMatch ( ACPI_STATUS AcpiNsGetNode ( ACPI_NAMESPACE_NODE *PrefixNode, - char *ExternalPathname, + const char *ExternalPathname, UINT32 Flags, ACPI_NAMESPACE_NODE **OutNode); @@ -430,24 +456,24 @@ AcpiNsLocal ( void AcpiNsReportError ( - char *ModuleName, + const char *ModuleName, UINT32 LineNumber, - char *InternalName, + const char *InternalName, ACPI_STATUS LookupStatus); void AcpiNsReportMethodError ( - char *ModuleName, + const char *ModuleName, UINT32 LineNumber, - char *Message, + const char *Message, ACPI_NAMESPACE_NODE *Node, - char *Path, + const char *Path, ACPI_STATUS LookupStatus); void AcpiNsPrintNodePathname ( ACPI_NAMESPACE_NODE *Node, - char *Msg); + const char *Msg); ACPI_STATUS AcpiNsBuildInternalName ( @@ -459,13 +485,13 @@ AcpiNsGetInternalNameLength ( ACPI_STATUS AcpiNsInternalizeName ( - char *DottedName, + const char *DottedName, char **ConvertedName); ACPI_STATUS AcpiNsExternalizeName ( UINT32 InternalNameLength, - char *InternalName, + const char *InternalName, UINT32 *ConvertedNameLength, char **ConvertedName); diff --git a/sys/contrib/dev/acpica/acobject.h b/sys/contrib/dev/acpica/include/acobject.h index a9d27ebd5d0b..594185920994 100644 --- a/sys/contrib/dev/acpica/acobject.h +++ b/sys/contrib/dev/acpica/include/acobject.h @@ -2,7 +2,6 @@ /****************************************************************************** * * Name: acobject.h - Definition of ACPI_OPERAND_OBJECT (Internal object only) - * $Revision: 1.143 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -171,7 +170,6 @@ #define AOPOBJ_OBJECT_INITIALIZED 0x08 #define AOPOBJ_SETUP_COMPLETE 0x10 #define AOPOBJ_SINGLE_DATUM 0x20 -#define AOPOBJ_INVALID 0x40 /* Used if host OS won't allow an OpRegion address */ /****************************************************************************** @@ -480,21 +478,39 @@ typedef struct acpi_object_addr_handler *****************************************************************************/ /* - * The Reference object type is used for these opcodes: - * Arg[0-6], Local[0-7], IndexOp, NameOp, ZeroOp, OneOp, OnesOp, DebugOp + * The Reference object is used for these opcodes: + * Arg[0-6], Local[0-7], IndexOp, NameOp, RefOfOp, LoadOp, LoadTableOp, DebugOp + * The Reference.Class differentiates these types. */ typedef struct acpi_object_reference { ACPI_OBJECT_COMMON_HEADER - UINT8 TargetType; /* Used for IndexOp */ - UINT16 Opcode; - void *Object; /* NameOp=>HANDLE to obj, IndexOp=>ACPI_OPERAND_OBJECT */ - ACPI_NAMESPACE_NODE *Node; - union acpi_operand_object **Where; - UINT32 Offset; /* Used for ArgOp, LocalOp, and IndexOp */ + UINT8 Class; /* Reference Class */ + UINT8 TargetType; /* Used for Index Op */ + UINT8 Reserved; + void *Object; /* NameOp=>HANDLE to obj, IndexOp=>ACPI_OPERAND_OBJECT */ + ACPI_NAMESPACE_NODE *Node; /* RefOf or Namepath */ + union acpi_operand_object **Where; /* Target of Index */ + UINT32 Value; /* Used for Local/Arg/Index/DdbHandle */ } ACPI_OBJECT_REFERENCE; +/* Values for Reference.Class above */ + +typedef enum +{ + ACPI_REFCLASS_LOCAL = 0, /* Method local */ + ACPI_REFCLASS_ARG = 1, /* Method argument */ + ACPI_REFCLASS_REFOF = 2, /* Result of RefOf() TBD: Split to Ref/Node and Ref/OperandObj? */ + ACPI_REFCLASS_INDEX = 3, /* Result of Index() */ + ACPI_REFCLASS_TABLE = 4, /* DdbHandle - Load(), LoadTable() */ + ACPI_REFCLASS_NAME = 5, /* Reference to a named object */ + ACPI_REFCLASS_DEBUG = 6, /* Debug object */ + + ACPI_REFCLASS_MAX = 6 + +} ACPI_REFERENCE_CLASSES; + /* * Extra object is used as additional storage for types that @@ -569,6 +585,13 @@ typedef union acpi_operand_object ACPI_OBJECT_DATA Data; ACPI_OBJECT_CACHE_LIST Cache; + /* + * Add namespace node to union in order to simplify code that accepts both + * ACPI_OPERAND_OBJECTs and ACPI_NAMESPACE_NODEs. The structures share + * a common DescriptorType field in order to differentiate them. + */ + ACPI_NAMESPACE_NODE Node; + } ACPI_OPERAND_OBJECT; diff --git a/sys/contrib/dev/acpica/acopcode.h b/sys/contrib/dev/acpica/include/acopcode.h index 557fa571c8e9..bb309c78d3fe 100644 --- a/sys/contrib/dev/acpica/acopcode.h +++ b/sys/contrib/dev/acpica/include/acopcode.h @@ -1,7 +1,6 @@ /****************************************************************************** * * Name: acopcode.h - AML opcode information for the AML parser and interpreter - * $Revision: 1.7 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -308,7 +307,7 @@ #define ARGI_CREATE_WORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) #define ARGI_DATA_REGION_OP ARGI_LIST3 (ARGI_STRING, ARGI_STRING, ARGI_STRING) #define ARGI_DEBUG_OP ARG_NONE -#define ARGI_DECREMENT_OP ARGI_LIST1 (ARGI_INTEGER_REF) +#define ARGI_DECREMENT_OP ARGI_LIST1 (ARGI_TARGETREF) #define ARGI_DEREF_OF_OP ARGI_LIST1 (ARGI_REF_OR_STRING) #define ARGI_DEVICE_OP ARGI_INVALID_OPCODE #define ARGI_DIVIDE_OP ARGI_LIST4 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF, ARGI_TARGETREF) @@ -321,7 +320,7 @@ #define ARGI_FIND_SET_RIGHT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF) #define ARGI_FROM_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_FIXED_TARGET) #define ARGI_IF_OP ARGI_INVALID_OPCODE -#define ARGI_INCREMENT_OP ARGI_LIST1 (ARGI_INTEGER_REF) +#define ARGI_INCREMENT_OP ARGI_LIST1 (ARGI_TARGETREF) #define ARGI_INDEX_FIELD_OP ARGI_INVALID_OPCODE #define ARGI_INDEX_OP ARGI_LIST3 (ARGI_COMPLEXOBJ, ARGI_INTEGER, ARGI_TARGETREF) #define ARGI_LAND_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER) diff --git a/sys/contrib/dev/acpica/acoutput.h b/sys/contrib/dev/acpica/include/acoutput.h index ebd58c361b4e..2b796b541a61 100644 --- a/sys/contrib/dev/acpica/acoutput.h +++ b/sys/contrib/dev/acpica/include/acoutput.h @@ -1,7 +1,6 @@ /****************************************************************************** * * Name: acoutput.h -- debug output - * $Revision: 1.101 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -118,9 +117,9 @@ #define __ACOUTPUT_H__ /* - * Debug levels and component IDs. These are used to control the - * granularity of the output of the DEBUG_PRINT macro -- on a per- - * component basis and a per-exception-type basis. + * Debug levels and component IDs. These are used to control the + * granularity of the output of the ACPI_DEBUG_PRINT macro -- on a + * per-component basis and a per-exception-type basis. */ /* Component IDs are used in the global "DebugLayer" */ @@ -142,25 +141,24 @@ #define ACPI_COMPILER 0x00001000 #define ACPI_TOOLS 0x00002000 +#define ACPI_EXAMPLE 0x00004000 +#define ACPI_DRIVER 0x00008000 -#define ACPI_ALL_COMPONENTS 0x00003FFF +#define ACPI_ALL_COMPONENTS 0x0000FFFF #define ACPI_COMPONENT_DEFAULT (ACPI_ALL_COMPONENTS) - /* Component IDs reserved for ACPI drivers */ #define ACPI_ALL_DRIVERS 0xFFFF0000 /* - * Raw debug output levels, do not use these in the DEBUG_PRINT macros + * Raw debug output levels, do not use these in the ACPI_DEBUG_PRINT macros */ -#define ACPI_LV_ERROR 0x00000001 -#define ACPI_LV_WARN 0x00000002 -#define ACPI_LV_INIT 0x00000004 -#define ACPI_LV_DEBUG_OBJECT 0x00000008 -#define ACPI_LV_INFO 0x00000010 -#define ACPI_LV_ALL_EXCEPTIONS 0x0000001F +#define ACPI_LV_INIT 0x00000001 +#define ACPI_LV_DEBUG_OBJECT 0x00000002 +#define ACPI_LV_INFO 0x00000004 +#define ACPI_LV_ALL_EXCEPTIONS 0x00000007 /* Trace verbosity level 1 [Standard Trace Level] */ @@ -202,7 +200,6 @@ #define ACPI_LV_VERBOSE_INFO 0x20000000 #define ACPI_LV_FULL_TABLES 0x40000000 #define ACPI_LV_EVENTS 0x80000000 - #define ACPI_LV_VERBOSE 0xF0000000 @@ -211,21 +208,17 @@ */ #define ACPI_DEBUG_LEVEL(dl) (UINT32) dl,ACPI_DEBUG_PARAMETERS -/* Exception level -- used in the global "DebugLevel" */ - +/* + * Exception level -- used in the global "DebugLevel" + * + * Note: For errors, use the ACPI_ERROR or ACPI_EXCEPTION interfaces. + * For warnings, use ACPI_WARNING. + */ #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_ALL_EXCEPTIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALL_EXCEPTIONS) -/* - * These two levels are essentially obsolete, all instances in the - * ACPICA core code have been replaced by ACPI_ERROR and ACPI_WARNING - * (Kept here because some drivers may still use them) - */ -#define ACPI_DB_ERROR ACPI_DEBUG_LEVEL (ACPI_LV_ERROR) -#define ACPI_DB_WARN ACPI_DEBUG_LEVEL (ACPI_LV_WARN) - /* Trace level -- also used in the global "DebugLevel" */ #define ACPI_DB_INIT_NAMES ACPI_DEBUG_LEVEL (ACPI_LV_INIT_NAMES) @@ -249,15 +242,108 @@ #define ACPI_DB_USER_REQUESTS ACPI_DEBUG_LEVEL (ACPI_LV_USER_REQUESTS) #define ACPI_DB_PACKAGE ACPI_DEBUG_LEVEL (ACPI_LV_PACKAGE) #define ACPI_DB_MUTEX ACPI_DEBUG_LEVEL (ACPI_LV_MUTEX) +#define ACPI_DB_EVENTS ACPI_DEBUG_LEVEL (ACPI_LV_EVENTS) #define ACPI_DB_ALL ACPI_DEBUG_LEVEL (ACPI_LV_ALL) - /* Defaults for DebugLevel, debug and normal */ -#define ACPI_DEBUG_DEFAULT (ACPI_LV_INIT | ACPI_LV_WARN | ACPI_LV_ERROR | ACPI_LV_DEBUG_OBJECT) -#define ACPI_NORMAL_DEFAULT (ACPI_LV_INIT | ACPI_LV_WARN | ACPI_LV_ERROR | ACPI_LV_DEBUG_OBJECT) +#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_ALL (ACPI_LV_AML_DISASSEMBLE | ACPI_LV_ALL_EXCEPTIONS | ACPI_LV_ALL) +#if defined (ACPI_DEBUG_OUTPUT) || !defined (ACPI_NO_ERROR_MESSAGES) +/* + * Module name is included in both debug and non-debug versions primarily for + * error messages. The __FILE__ macro is not very useful for this, because it + * often includes the entire pathname to the module + */ +#define ACPI_MODULE_NAME(Name) static const char ACPI_UNUSED_VAR _AcpiModuleName[] = Name; +#else +#define ACPI_MODULE_NAME(Name) +#endif + +/* + * Ascii error messages can be configured out + */ +#ifndef ACPI_NO_ERROR_MESSAGES +#define AE_INFO _AcpiModuleName, __LINE__ + +/* + * Error reporting. Callers module and line number are inserted by AE_INFO, + * the plist contains a set of parens to allow variable-length lists. + * These macros are used for both the debug and non-debug versions of the code. + */ +#define ACPI_INFO(plist) AcpiInfo plist +#define ACPI_WARNING(plist) AcpiWarning plist +#define ACPI_EXCEPTION(plist) AcpiException plist +#define ACPI_ERROR(plist) AcpiError plist + +#else + +/* No error messages */ + +#define ACPI_INFO(plist) +#define ACPI_WARNING(plist) +#define ACPI_EXCEPTION(plist) +#define ACPI_ERROR(plist) + +#endif /* ACPI_NO_ERROR_MESSAGES */ + + +/* + * Debug macros that are conditionally compiled + */ +#ifdef ACPI_DEBUG_OUTPUT + +/* + * If ACPI_GET_FUNCTION_NAME was not defined in the compiler-dependent header, + * define it now. This is the case where there the compiler does not support + * a __FUNCTION__ macro or equivalent. + */ +#ifndef ACPI_GET_FUNCTION_NAME +#define ACPI_GET_FUNCTION_NAME _AcpiFunctionName + +/* + * The Name parameter should be the procedure name as a quoted string. + * The function name is also used by the function exit macros below. + * Note: (const char) is used to be compatible with the debug interfaces + * and macros such as __FUNCTION__. + */ +#define ACPI_FUNCTION_NAME(Name) static const char _AcpiFunctionName[] = #Name; + +#else +/* Compiler supports __FUNCTION__ (or equivalent) -- Ignore this macro */ + +#define ACPI_FUNCTION_NAME(Name) +#endif /* ACPI_GET_FUNCTION_NAME */ + +/* + * Common parameters used for debug output functions: + * line number, function name, module(file) name, component ID + */ +#define ACPI_DEBUG_PARAMETERS __LINE__, ACPI_GET_FUNCTION_NAME, _AcpiModuleName, _COMPONENT + +/* + * Master debug print macros + * Print message if and only if: + * 1) Debug print for the current component is enabled + * 2) Debug error level or trace level for the print statement is enabled + */ +#define ACPI_DEBUG_PRINT(plist) AcpiDebugPrint plist +#define ACPI_DEBUG_PRINT_RAW(plist) AcpiDebugPrintRaw plist + +#else +/* + * This is the non-debug case -- make everything go away, + * leaving no executable debug code! + */ +#define ACPI_FUNCTION_NAME(a) +#define ACPI_DEBUG_PRINT(pl) +#define ACPI_DEBUG_PRINT_RAW(pl) + +#endif /* ACPI_DEBUG_OUTPUT */ + + #endif /* __ACOUTPUT_H__ */ diff --git a/sys/contrib/dev/acpica/acparser.h b/sys/contrib/dev/acpica/include/acparser.h index 34b6bd125463..b65177b10dea 100644 --- a/sys/contrib/dev/acpica/acparser.h +++ b/sys/contrib/dev/acpica/include/acparser.h @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: acparser.h - AML Parser subcomponent prototypes and defines - * $Revision: 1.83 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/include/acpi.h b/sys/contrib/dev/acpica/include/acpi.h new file mode 100644 index 000000000000..ac0af0387bc9 --- /dev/null +++ b/sys/contrib/dev/acpica/include/acpi.h @@ -0,0 +1,138 @@ +/****************************************************************************** + * + * Name: acpi.h - Master public include file used to interface to ACPICA + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2009, 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 __ACPI_H__ +#define __ACPI_H__ + +/* + * Public include files for use by code that will interface to ACPICA. + * + * Information includes the ACPICA data types, names, exceptions, and + * external interface prototypes. Also included are the definitions for + * all ACPI tables (FADT, MADT, etc.) + * + * Note: The order of these include files is important. + */ +#include "platform/acenv.h" /* Environment-specific items */ +#include "acnames.h" /* Common ACPI names and strings */ +#include "actypes.h" /* ACPICA data types and structures */ +#include "acexcep.h" /* ACPICA exceptions */ +#include "actbl.h" /* ACPI table definitions */ +#include "acoutput.h" /* Error output and Debug macros */ +#include "acrestyp.h" /* Resource Descriptor structs */ +#include "acpiosxf.h" /* OSL interfaces (ACPICA-to-OS) */ +#include "acpixf.h" /* ACPI core subsystem external interfaces */ + +#endif /* __ACPI_H__ */ diff --git a/sys/contrib/dev/acpica/acpiosxf.h b/sys/contrib/dev/acpica/include/acpiosxf.h index 69997d885f76..730057d1efac 100644 --- a/sys/contrib/dev/acpica/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 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -121,8 +121,8 @@ #ifndef __ACPIOSXF_H__ #define __ACPIOSXF_H__ -#include <contrib/dev/acpica/acenv.h> -#include <contrib/dev/acpica/actypes.h> +#include "platform/acenv.h" +#include "actypes.h" /* Types for AcpiOsExecute */ @@ -233,8 +233,11 @@ AcpiOsSignalSemaphore ( /* - * Mutex primitives + * Mutex primitives. May be configured to use semaphores instead via + * ACPI_MUTEX_TYPE (see platform/acenv.h) */ +#if (ACPI_MUTEX_TYPE != ACPI_BINARY_SEMAPHORE) + ACPI_STATUS AcpiOsCreateMutex ( ACPI_MUTEX *OutHandle); @@ -251,13 +254,7 @@ AcpiOsAcquireMutex ( void AcpiOsReleaseMutex ( ACPI_MUTEX Handle); - -/* Temporary macros for Mutex* interfaces, map to existing semaphore xfaces */ - -#define AcpiOsCreateMutex(OutHandle) AcpiOsCreateSemaphore (1, 1, OutHandle) -#define AcpiOsDeleteMutex(Handle) (void) AcpiOsDeleteSemaphore (Handle) -#define AcpiOsAcquireMutex(Handle,Time) AcpiOsWaitSemaphore (Handle, 1, Time) -#define AcpiOsReleaseMutex(Handle) (void) AcpiOsSignalSemaphore (Handle, 1) +#endif /* @@ -274,7 +271,7 @@ AcpiOsFree ( void * AcpiOsMapMemory ( ACPI_PHYSICAL_ADDRESS Where, - ACPI_NATIVE_UINT Length); + ACPI_SIZE Length); void AcpiOsUnmapMemory ( @@ -425,12 +422,6 @@ ACPI_STATUS AcpiOsValidateInterface ( char *Interface); -ACPI_STATUS -AcpiOsValidateAddress ( - UINT8 SpaceId, - ACPI_PHYSICAL_ADDRESS Address, - ACPI_SIZE Length); - BOOLEAN AcpiOsReadable ( void *Pointer, diff --git a/sys/contrib/dev/acpica/acpixf.h b/sys/contrib/dev/acpica/include/acpixf.h index f85fd67d77cd..84e4a4f56f2d 100644 --- a/sys/contrib/dev/acpica/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 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -118,8 +118,33 @@ #ifndef __ACXFACE_H__ #define __ACXFACE_H__ -#include <contrib/dev/acpica/actypes.h> -#include <contrib/dev/acpica/actbl.h> +/* Current ACPICA subsystem version in YYYYMMDD format */ + +#define ACPI_CA_VERSION 0x20090521 + +#include "actypes.h" +#include "actbl.h" + +/* + * Globals that are publically available + */ +extern UINT32 AcpiCurrentGpeCount; +extern ACPI_TABLE_FADT AcpiGbl_FADT; + +/* Runtime configuration of debug print levels */ + +extern UINT32 AcpiDbgLevel; +extern UINT32 AcpiDbgLayer; + +/* ACPICA runtime options */ + +extern UINT8 AcpiGbl_EnableInterpreterSlack; +extern UINT8 AcpiGbl_AllMethodsSerialized; +extern UINT8 AcpiGbl_CreateOsiMethod; +extern UINT8 AcpiGbl_LeaveWakeGpesDisabled; +extern UINT8 AcpiGbl_UseDefaultRegisterWidths; +extern ACPI_NAME AcpiGbl_TraceMethodName; +extern UINT32 AcpiGbl_TraceFlags; /* @@ -163,6 +188,10 @@ ACPI_STATUS AcpiGetSystemInfo ( ACPI_BUFFER *RetBuffer); +ACPI_STATUS +AcpiGetStatistics ( + ACPI_STATISTICS *Stats); + const char * AcpiFormatException ( ACPI_STATUS Exception); @@ -171,10 +200,6 @@ ACPI_STATUS AcpiPurgeCachedObjects ( void); -ACPI_STATUS -AcpiInstallInitializationHandler ( - ACPI_INIT_HANDLER Handler, - UINT32 Function); /* * ACPI Memory managment @@ -201,7 +226,7 @@ AcpiReallocateRootTable ( ACPI_STATUS AcpiFindRootPointer ( - ACPI_NATIVE_UINT *RsdpAddress); + ACPI_SIZE *RsdpAddress); ACPI_STATUS AcpiLoadTables ( @@ -210,20 +235,29 @@ AcpiLoadTables ( ACPI_STATUS AcpiGetTableHeader ( ACPI_STRING Signature, - ACPI_NATIVE_UINT Instance, + UINT32 Instance, ACPI_TABLE_HEADER *OutTableHeader); ACPI_STATUS AcpiGetTable ( ACPI_STRING Signature, - ACPI_NATIVE_UINT Instance, + UINT32 Instance, ACPI_TABLE_HEADER **OutTable); ACPI_STATUS AcpiGetTableByIndex ( - ACPI_NATIVE_UINT TableIndex, + UINT32 TableIndex, ACPI_TABLE_HEADER **OutTable); +ACPI_STATUS +AcpiInstallTableHandler ( + ACPI_TABLE_HANDLER Handler, + void *Context); + +ACPI_STATUS +AcpiRemoveTableHandler ( + ACPI_TABLE_HANDLER Handler); + /* * Namespace and name interfaces @@ -305,6 +339,10 @@ AcpiGetObjectInfo ( ACPI_BUFFER *ReturnBuffer); ACPI_STATUS +AcpiInstallMethod ( + UINT8 *Buffer); + +ACPI_STATUS AcpiGetNextObject ( ACPI_OBJECT_TYPE Type, ACPI_HANDLE Parent, @@ -323,9 +361,14 @@ AcpiGetParent ( /* - * Event handler interfaces + * Handler interfaces */ ACPI_STATUS +AcpiInstallInitializationHandler ( + ACPI_INIT_HANDLER Handler, + UINT32 Function); + +ACPI_STATUS AcpiInstallFixedEventHandler ( UINT32 AcpiEvent, ACPI_EVENT_HANDLER Handler, @@ -372,6 +415,12 @@ AcpiInstallGpeHandler ( void *Context); ACPI_STATUS +AcpiRemoveGpeHandler ( + ACPI_HANDLE GpeDevice, + UINT32 GpeNumber, + ACPI_EVENT_HANDLER Address); + +ACPI_STATUS AcpiInstallExceptionHandler ( ACPI_EXCEPTION_HANDLER Handler); @@ -389,12 +438,6 @@ AcpiReleaseGlobalLock ( UINT32 Handle); ACPI_STATUS -AcpiRemoveGpeHandler ( - ACPI_HANDLE GpeDevice, - UINT32 GpeNumber, - ACPI_EVENT_HANDLER Address); - -ACPI_STATUS AcpiEnableEvent ( UINT32 Event, UINT32 Flags); @@ -413,6 +456,10 @@ AcpiGetEventStatus ( UINT32 Event, ACPI_EVENT_STATUS *EventStatus); + +/* + * GPE Interfaces + */ ACPI_STATUS AcpiSetGpeType ( ACPI_HANDLE GpeDevice, @@ -445,6 +492,19 @@ AcpiGetGpeStatus ( ACPI_EVENT_STATUS *EventStatus); ACPI_STATUS +AcpiDisableAllGpes ( + void); + +ACPI_STATUS +AcpiEnableAllRuntimeGpes ( + void); + +ACPI_STATUS +AcpiGetGpeDevice ( + UINT32 GpeIndex, + ACPI_HANDLE *GpeDevice); + +ACPI_STATUS AcpiInstallGpeBlock ( ACPI_HANDLE GpeDevice, ACPI_GENERIC_ADDRESS *GpeBlockAddress, @@ -503,26 +563,33 @@ AcpiResourceToAddress64 ( ACPI_RESOURCE *Resource, ACPI_RESOURCE_ADDRESS64 *Out); + /* * Hardware (ACPI device) interfaces */ ACPI_STATUS -AcpiGetRegister ( - UINT32 RegisterId, - UINT32 *ReturnValue); +AcpiReset ( + void); ACPI_STATUS -AcpiSetRegister ( - UINT32 RegisterId, - UINT32 Value); +AcpiRead ( + UINT32 *Value, + ACPI_GENERIC_ADDRESS *Reg); ACPI_STATUS -AcpiSetFirmwareWakingVector ( - ACPI_PHYSICAL_ADDRESS PhysicalAddress); +AcpiWrite ( + UINT32 Value, + ACPI_GENERIC_ADDRESS *Reg); ACPI_STATUS -AcpiGetFirmwareWakingVector ( - ACPI_PHYSICAL_ADDRESS *PhysicalAddress); +AcpiReadBitRegister ( + UINT32 RegisterId, + UINT32 *ReturnValue); + +ACPI_STATUS +AcpiWriteBitRegister ( + UINT32 RegisterId, + UINT32 Value); ACPI_STATUS AcpiGetSleepTypeData ( @@ -544,7 +611,76 @@ AcpiEnterSleepStateS4bios ( ACPI_STATUS AcpiLeaveSleepState ( - UINT8 SleepState); + UINT8 SleepState) + ; +ACPI_STATUS +AcpiSetFirmwareWakingVector ( + UINT32 PhysicalAddress); +#if ACPI_MACHINE_WIDTH == 64 +ACPI_STATUS +AcpiSetFirmwareWakingVector64 ( + UINT64 PhysicalAddress); +#endif + + +/* + * Error/Warning output + */ +void ACPI_INTERNAL_VAR_XFACE +AcpiError ( + const char *ModuleName, + UINT32 LineNumber, + const char *Format, + ...) ACPI_PRINTF_LIKE(3); + +void ACPI_INTERNAL_VAR_XFACE +AcpiException ( + const char *ModuleName, + UINT32 LineNumber, + ACPI_STATUS Status, + const char *Format, + ...) ACPI_PRINTF_LIKE(4); + +void ACPI_INTERNAL_VAR_XFACE +AcpiWarning ( + const char *ModuleName, + UINT32 LineNumber, + const char *Format, + ...) ACPI_PRINTF_LIKE(3); + +void ACPI_INTERNAL_VAR_XFACE +AcpiInfo ( + const char *ModuleName, + UINT32 LineNumber, + const char *Format, + ...) ACPI_PRINTF_LIKE(3); + + +/* + * Debug output + */ +#ifdef ACPI_DEBUG_OUTPUT + +void ACPI_INTERNAL_VAR_XFACE +AcpiDebugPrint ( + UINT32 RequestedDebugLevel, + UINT32 LineNumber, + const char *FunctionName, + const char *ModuleName, + UINT32 ComponentId, + const char *Format, + ...) ACPI_PRINTF_LIKE(6); + +void ACPI_INTERNAL_VAR_XFACE +AcpiDebugPrintRaw ( + UINT32 RequestedDebugLevel, + UINT32 LineNumber, + const char *FunctionName, + const char *ModuleName, + UINT32 ComponentId, + const char *Format, + ...) ACPI_PRINTF_LIKE(6); +#endif #endif /* __ACXFACE_H__ */ diff --git a/sys/contrib/dev/acpica/include/acpredef.h b/sys/contrib/dev/acpica/include/acpredef.h new file mode 100644 index 000000000000..9e5a5247e76a --- /dev/null +++ b/sys/contrib/dev/acpica/include/acpredef.h @@ -0,0 +1,534 @@ +/****************************************************************************** + * + * Name: acpredef - Information table for ACPI predefined methods and objects + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2009, 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 __ACPREDEF_H__ +#define __ACPREDEF_H__ + + +/****************************************************************************** + * + * Return Package types + * + * 1) PTYPE1 packages do not contain sub-packages. + * + * ACPI_PTYPE1_FIXED: Fixed-length length, 1 or 2 object types: + * object type + * count + * object type + * count + * + * ACPI_PTYPE1_VAR: Variable-length length: + * object type (Int/Buf/Ref) + * + * ACPI_PTYPE1_OPTION: Package has some required and some optional elements + * (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. + * + * ACPI_PTYPE2: Each subpackage contains 1 or 2 object types: + * object type + * count + * object type + * count + * (Used for _ALR,_MLS,_PSS,_TRT,_TSS) + * + * ACPI_PTYPE2_COUNT: Each subpackage has a count as first element: + * object type + * (Used for _CSD,_PSD,_TSD) + * + * ACPI_PTYPE2_PKG_COUNT: Count of subpackages at start, 1 or 2 object types: + * object type + * count + * object type + * count + * (Used for _CST) + * + * ACPI_PTYPE2_Fixed-length: Each subpackage is of Fixed-length length + * (Used for _PRT) + * + * ACPI_PTYPE2_MIN: Each subpackage has a Variable-length but minimum length + * (Used for _HPX) + * + *****************************************************************************/ + +enum AcpiReturnPackageTypes +{ + ACPI_PTYPE1_FIXED = 1, + ACPI_PTYPE1_VAR = 2, + ACPI_PTYPE1_OPTION = 3, + ACPI_PTYPE2 = 4, + ACPI_PTYPE2_COUNT = 5, + ACPI_PTYPE2_PKG_COUNT = 6, + ACPI_PTYPE2_FIXED = 7, + ACPI_PTYPE2_MIN = 8 +}; + + +/* + * Predefined method/object information table. + * + * These are the names that can actually be evaluated via AcpiEvaluateObject. + * Not present in this table are the following: + * + * 1) Predefined/Reserved names that are never evaluated via + * AcpiEvaluateObject: + * _Lxx and _Exx GPE methods + * _Qxx EC methods + * _T_x compiler temporary Variable-lengths + * + * 2) Predefined names that never actually exist within the AML code: + * Predefined resource descriptor field names + * + * 3) Predefined names that are implemented within ACPICA: + * _OSI + * + * 4) Some predefined names that are not documented within the ACPI spec. + * _WDG, _WED + * + * The main entries in the table each contain the following items: + * + * Name - The ACPI reserved name + * ParamCount - Number of arguments to the method + * ExpectedBtypes - Allowed type(s) for the return value. + * 0 means that no return value is expected. + * + * For methods that return packages, the next entry in the table contains + * information about the expected structure of the package. This information + * is saved here (rather than in a separate table) in order to minimize the + * overall size of the stored data. + * + * Note: The additional braces are intended to promote portability. + */ +static const ACPI_PREDEFINED_INFO PredefinedNames[] = +{ + {{"_AC0", 0, ACPI_RTYPE_INTEGER}}, + {{"_AC1", 0, ACPI_RTYPE_INTEGER}}, + {{"_AC2", 0, ACPI_RTYPE_INTEGER}}, + {{"_AC3", 0, ACPI_RTYPE_INTEGER}}, + {{"_AC4", 0, ACPI_RTYPE_INTEGER}}, + {{"_AC5", 0, ACPI_RTYPE_INTEGER}}, + {{"_AC6", 0, ACPI_RTYPE_INTEGER}}, + {{"_AC7", 0, ACPI_RTYPE_INTEGER}}, + {{"_AC8", 0, ACPI_RTYPE_INTEGER}}, + {{"_AC9", 0, ACPI_RTYPE_INTEGER}}, + {{"_ADR", 0, ACPI_RTYPE_INTEGER}}, + {{"_AL0", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, + + {{"_AL1", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, + + {{"_AL2", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, + + {{"_AL3", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, + + {{"_AL4", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, + + {{"_AL5", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, + + {{"_AL6", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, + + {{"_AL7", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, + + {{"_AL8", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, + + {{"_AL9", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, + + {{"_ALC", 0, ACPI_RTYPE_INTEGER}}, + {{"_ALI", 0, ACPI_RTYPE_INTEGER}}, + {{"_ALP", 0, ACPI_RTYPE_INTEGER}}, + {{"_ALR", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each 2 (Ints) */ + {{{ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 2,0}, 0,0}}, + + {{"_ALT", 0, ACPI_RTYPE_INTEGER}}, + {{"_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}}, + {{"_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}}, + + {{"_BLT", 3, 0}}, + {{"_BMC", 1, 0}}, + {{"_BMD", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (5 Int) */ + {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 5,0}, 0,0}}, + + {{"_BQC", 0, ACPI_RTYPE_INTEGER}}, + {{"_BST", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (4 Int) */ + {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4,0}, 0,0}}, + + {{"_BTM", 1, ACPI_RTYPE_INTEGER}}, + {{"_BTP", 1, 0}}, + {{"_CBA", 0, ACPI_RTYPE_INTEGER}}, /* See PCI firmware spec 3.0 */ + {{"_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}}, + + {{"_CRS", 0, ACPI_RTYPE_BUFFER}}, + {{"_CRT", 0, ACPI_RTYPE_INTEGER}}, + {{"_CSD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (1 Int(n), n-1 Int) */ + {{{ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 0,0}, 0,0}}, + + {{"_CST", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (1 Int(n), n Pkg (1 Buf/3 Int) */ + {{{ACPI_PTYPE2_PKG_COUNT,ACPI_RTYPE_BUFFER, 1, ACPI_RTYPE_INTEGER}, 3,0}}, + + {{"_DCK", 1, ACPI_RTYPE_INTEGER}}, + {{"_DCS", 0, ACPI_RTYPE_INTEGER}}, + {{"_DDC", 1, ACPI_RTYPE_INTEGER | ACPI_RTYPE_BUFFER}}, + {{"_DDN", 0, ACPI_RTYPE_STRING}}, + {{"_DGS", 0, ACPI_RTYPE_INTEGER}}, + {{"_DIS", 0, 0}}, + {{"_DMA", 0, ACPI_RTYPE_BUFFER}}, + {{"_DOD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Ints) */ + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0,0}, 0,0}}, + + {{"_DOS", 1, 0}}, + {{"_DSM", 4, ACPI_RTYPE_ALL}}, /* Must return a type, but it can be of any type */ + {{"_DSS", 1, 0}}, + {{"_DSW", 3, 0}}, + {{"_EC_", 0, ACPI_RTYPE_INTEGER}}, + {{"_EDL", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs)*/ + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, + + {{"_EJ0", 1, 0}}, + {{"_EJ1", 1, 0}}, + {{"_EJ2", 1, 0}}, + {{"_EJ3", 1, 0}}, + {{"_EJ4", 1, 0}}, + {{"_EJD", 0, ACPI_RTYPE_STRING}}, + {{"_FDE", 0, ACPI_RTYPE_BUFFER}}, + {{"_FDI", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (16 Int) */ + {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 16,0}, 0,0}}, + + {{"_FDM", 1, 0}}, + {{"_FIX", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Ints) */ + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0,0}, 0,0}}, + + {{"_GLK", 0, ACPI_RTYPE_INTEGER}}, + {{"_GPD", 0, ACPI_RTYPE_INTEGER}}, + {{"_GPE", 0, ACPI_RTYPE_INTEGER}}, /* _GPE method, not _GPE scope */ + {{"_GSB", 0, ACPI_RTYPE_INTEGER}}, + {{"_GTF", 0, ACPI_RTYPE_BUFFER}}, + {{"_GTM", 0, ACPI_RTYPE_BUFFER}}, + {{"_GTS", 1, 0}}, + {{"_HID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING}}, + {{"_HOT", 0, ACPI_RTYPE_INTEGER}}, + {{"_HPP", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (4 Int) */ + {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4,0}, 0,0}}, + + /* + * For _HPX, a single package is returned, containing a Variable-length number + * of sub-packages. Each sub-package contains a PCI record setting. + * There are several different type of record settings, of different + * lengths, but all elements of all settings are Integers. + */ + {{"_HPX", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (var Ints) */ + {{{ACPI_PTYPE2_MIN, ACPI_RTYPE_INTEGER, 5,0}, 0,0}}, + + {{"_IFT", 0, ACPI_RTYPE_INTEGER}}, /* See IPMI spec */ + {{"_INI", 0, 0}}, + {{"_IRC", 0, 0}}, + {{"_LCK", 1, 0}}, + {{"_LID", 0, ACPI_RTYPE_INTEGER}}, + {{"_MAT", 0, ACPI_RTYPE_BUFFER}}, + {{"_MLS", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (2 Str) */ + {{{ACPI_PTYPE2, ACPI_RTYPE_STRING, 2,0}, 0,0}}, + + {{"_MSG", 1, 0}}, + {{"_OFF", 0, 0}}, + {{"_ON_", 0, 0}}, + {{"_OS_", 0, ACPI_RTYPE_STRING}}, + {{"_OSC", 4, ACPI_RTYPE_BUFFER}}, + {{"_OST", 3, 0}}, + {{"_PCL", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, + + {{"_PCT", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (2 Buf) */ + {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_BUFFER, 2,0}, 0,0}}, + + {{"_PDC", 1, 0}}, + {{"_PIC", 1, 0}}, + {{"_PLD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Bufs) */ + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_BUFFER, 0,0}, 0,0}}, + + {{"_PPC", 0, ACPI_RTYPE_INTEGER}}, + {{"_PPE", 0, ACPI_RTYPE_INTEGER}}, /* See dig64 spec */ + {{"_PR0", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, + + {{"_PR1", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, + + {{"_PR2", 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. + */ + {{"_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}}, + + {{"_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, + ACPI_RTYPE_INTEGER}, ACPI_RTYPE_REFERENCE,0}}, + + {{"_PS0", 0, 0}}, + {{"_PS1", 0, 0}}, + {{"_PS2", 0, 0}}, + {{"_PS3", 0, 0}}, + {{"_PSC", 0, ACPI_RTYPE_INTEGER}}, + {{"_PSD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (5 Int) with count */ + {{{ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER,0,0}, 0,0}}, + + {{"_PSL", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, + + {{"_PSR", 0, ACPI_RTYPE_INTEGER}}, + {{"_PSS", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each (6 Int) */ + {{{ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 6,0}, 0,0}}, + + {{"_PSV", 0, ACPI_RTYPE_INTEGER}}, + {{"_PSW", 1, 0}}, + {{"_PTC", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (2 Buf) */ + {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_BUFFER, 2,0}, 0,0}}, + + {{"_PTS", 1, 0}}, + {{"_PXM", 0, ACPI_RTYPE_INTEGER}}, + {{"_REG", 2, 0}}, + {{"_REV", 0, ACPI_RTYPE_INTEGER}}, + {{"_RMV", 0, ACPI_RTYPE_INTEGER}}, + {{"_ROM", 2, ACPI_RTYPE_BUFFER}}, + {{"_RTV", 0, ACPI_RTYPE_INTEGER}}, + + /* + * For _S0_ through _S5_, the ACPI spec defines a return Package + * containing 1 Integer, but most DSDTs have it wrong - 2,3, or 4 integers. + * Allow this by making the objects "Variable-length length", but all elements + * must be Integers. + */ + {{"_S0_", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (1 Int) */ + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0}, 0,0}}, + + {{"_S1_", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (1 Int) */ + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0}, 0,0}}, + + {{"_S2_", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (1 Int) */ + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0}, 0,0}}, + + {{"_S3_", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (1 Int) */ + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0}, 0,0}}, + + {{"_S4_", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (1 Int) */ + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0}, 0,0}}, + + {{"_S5_", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (1 Int) */ + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1,0}, 0,0}}, + + {{"_S1D", 0, ACPI_RTYPE_INTEGER}}, + {{"_S2D", 0, ACPI_RTYPE_INTEGER}}, + {{"_S3D", 0, ACPI_RTYPE_INTEGER}}, + {{"_S4D", 0, ACPI_RTYPE_INTEGER}}, + {{"_S0W", 0, ACPI_RTYPE_INTEGER}}, + {{"_S1W", 0, ACPI_RTYPE_INTEGER}}, + {{"_S2W", 0, ACPI_RTYPE_INTEGER}}, + {{"_S3W", 0, ACPI_RTYPE_INTEGER}}, + {{"_S4W", 0, ACPI_RTYPE_INTEGER}}, + {{"_SBS", 0, ACPI_RTYPE_INTEGER}}, + {{"_SCP", 0x13, 0}}, /* Acpi 1.0 allowed 1 arg. Acpi 3.0 expanded to 3 args. Allow both. */ + /* Note: the 3-arg definition may be removed for ACPI 4.0 */ + {{"_SDD", 1, 0}}, + {{"_SEG", 0, ACPI_RTYPE_INTEGER}}, + {{"_SLI", 0, ACPI_RTYPE_BUFFER}}, + {{"_SPD", 1, ACPI_RTYPE_INTEGER}}, + {{"_SRS", 1, 0}}, + {{"_SRV", 0, ACPI_RTYPE_INTEGER}}, /* See IPMI spec */ + {{"_SST", 1, 0}}, + {{"_STA", 0, ACPI_RTYPE_INTEGER}}, + {{"_STM", 3, 0}}, + {{"_STR", 0, ACPI_RTYPE_BUFFER}}, + {{"_SUN", 0, ACPI_RTYPE_INTEGER}}, + {{"_SWS", 0, ACPI_RTYPE_INTEGER}}, + {{"_TC1", 0, ACPI_RTYPE_INTEGER}}, + {{"_TC2", 0, ACPI_RTYPE_INTEGER}}, + {{"_TMP", 0, ACPI_RTYPE_INTEGER}}, + {{"_TPC", 0, ACPI_RTYPE_INTEGER}}, + {{"_TPT", 1, 0}}, + {{"_TRT", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each 2Ref/6Int */ + {{{ACPI_PTYPE2, ACPI_RTYPE_REFERENCE, 2, ACPI_RTYPE_INTEGER}, 6, 0}}, + + {{"_TSD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each 5Int with count */ + {{{ACPI_PTYPE2_COUNT,ACPI_RTYPE_INTEGER, 5,0}, 0,0}}, + + {{"_TSP", 0, ACPI_RTYPE_INTEGER}}, + {{"_TSS", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each 5Int */ + {{{ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 5,0}, 0,0}}, + + {{"_TST", 0, ACPI_RTYPE_INTEGER}}, + {{"_TTS", 1, 0}}, + {{"_TZD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Refs) */ + {{{ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0}, 0,0}}, + + {{"_TZM", 0, ACPI_RTYPE_REFERENCE}}, + {{"_TZP", 0, ACPI_RTYPE_INTEGER}}, + {{"_UID", 0, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING}}, + {{"_UPC", 0, ACPI_RTYPE_PACKAGE}}, /* Fixed-length (4 Int) */ + {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4,0}, 0,0}}, + + {{"_UPD", 0, ACPI_RTYPE_INTEGER}}, + {{"_UPP", 0, ACPI_RTYPE_INTEGER}}, + {{"_VPO", 0, ACPI_RTYPE_INTEGER}}, + + /* Acpi 1.0 defined _WAK with no return value. Later, it was changed to return a package */ + + {{"_WAK", 1, ACPI_RTYPE_NONE | ACPI_RTYPE_INTEGER | ACPI_RTYPE_PACKAGE}}, + {{{ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 2,0}, 0,0}}, /* Fixed-length (2 Int), but is optional */ + + {{{0,0,0,0}, 0,0}} /* Table terminator */ +}; + +#if 0 + /* Not implemented */ + + {{"_WDG", 0, ACPI_RTYPE_BUFFER}}, /* MS Extension */ + {{"_WED", 1, ACPI_RTYPE_PACKAGE}}, /* MS Extension */ + + /* This is an internally implemented control method, no need to check */ + {{"_OSI", 1, ACPI_RTYPE_INTEGER}}, + + /* TBD: */ + + _PRT - currently ignore reversed entries. Attempt to fix here? + Think about possibly fixing package elements like _BIF, etc. +#endif + +#endif diff --git a/sys/contrib/dev/acpica/acresrc.h b/sys/contrib/dev/acpica/include/acresrc.h index 345c21e5f7de..c70aa5e23d4d 100644 --- a/sys/contrib/dev/acpica/acresrc.h +++ b/sys/contrib/dev/acpica/include/acresrc.h @@ -1,7 +1,6 @@ /****************************************************************************** * * Name: acresrc.h - Resource Manager function prototypes - * $Revision: 1.60 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -120,7 +119,7 @@ /* Need the AML resource descriptor structs */ -#include <contrib/dev/acpica/amlresrc.h> +#include "amlresrc.h" /* @@ -170,6 +169,7 @@ typedef const struct acpi_rsconvert_info #define ACPI_RSC_BITMASK16 18 #define ACPI_RSC_EXIT_NE 19 #define ACPI_RSC_EXIT_LE 20 +#define ACPI_RSC_EXIT_EQ 21 /* Resource Conversion sub-opcodes */ diff --git a/sys/contrib/dev/acpica/include/acrestyp.h b/sys/contrib/dev/acpica/include/acrestyp.h new file mode 100644 index 000000000000..7eb7600d9822 --- /dev/null +++ b/sys/contrib/dev/acpica/include/acrestyp.h @@ -0,0 +1,544 @@ +/****************************************************************************** + * + * Name: acrestyp.h - Defines, types, and structures for resource descriptors + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2009, 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 __ACRESTYP_H__ +#define __ACRESTYP_H__ + + +/* + * Definitions for Resource Attributes + */ +typedef UINT16 ACPI_RS_LENGTH; /* Resource Length field is fixed at 16 bits */ +typedef UINT32 ACPI_RSDESC_SIZE; /* Max Resource Descriptor size is (Length+3) = (64K-1)+3 */ + +/* + * Memory Attributes + */ +#define ACPI_READ_ONLY_MEMORY (UINT8) 0x00 +#define ACPI_READ_WRITE_MEMORY (UINT8) 0x01 + +#define ACPI_NON_CACHEABLE_MEMORY (UINT8) 0x00 +#define ACPI_CACHABLE_MEMORY (UINT8) 0x01 +#define ACPI_WRITE_COMBINING_MEMORY (UINT8) 0x02 +#define ACPI_PREFETCHABLE_MEMORY (UINT8) 0x03 + +/* + * IO Attributes + * The ISA IO ranges are: n000-n0FFh, n400-n4FFh, n800-n8FFh, nC00-nCFFh. + * The non-ISA IO ranges are: n100-n3FFh, n500-n7FFh, n900-nBFFh, nCD0-nFFFh. + */ +#define ACPI_NON_ISA_ONLY_RANGES (UINT8) 0x01 +#define ACPI_ISA_ONLY_RANGES (UINT8) 0x02 +#define ACPI_ENTIRE_RANGE (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES) + +/* Type of translation - 1=Sparse, 0=Dense */ + +#define ACPI_SPARSE_TRANSLATION (UINT8) 0x01 + +/* + * IO Port Descriptor Decode + */ +#define ACPI_DECODE_10 (UINT8) 0x00 /* 10-bit IO address decode */ +#define ACPI_DECODE_16 (UINT8) 0x01 /* 16-bit IO address decode */ + +/* + * IRQ Attributes + */ +#define ACPI_LEVEL_SENSITIVE (UINT8) 0x00 +#define ACPI_EDGE_SENSITIVE (UINT8) 0x01 + +#define ACPI_ACTIVE_HIGH (UINT8) 0x00 +#define ACPI_ACTIVE_LOW (UINT8) 0x01 + +#define ACPI_EXCLUSIVE (UINT8) 0x00 +#define ACPI_SHARED (UINT8) 0x01 + +/* + * DMA Attributes + */ +#define ACPI_COMPATIBILITY (UINT8) 0x00 +#define ACPI_TYPE_A (UINT8) 0x01 +#define ACPI_TYPE_B (UINT8) 0x02 +#define ACPI_TYPE_F (UINT8) 0x03 + +#define ACPI_NOT_BUS_MASTER (UINT8) 0x00 +#define ACPI_BUS_MASTER (UINT8) 0x01 + +#define ACPI_TRANSFER_8 (UINT8) 0x00 +#define ACPI_TRANSFER_8_16 (UINT8) 0x01 +#define ACPI_TRANSFER_16 (UINT8) 0x02 + +/* + * Start Dependent Functions Priority definitions + */ +#define ACPI_GOOD_CONFIGURATION (UINT8) 0x00 +#define ACPI_ACCEPTABLE_CONFIGURATION (UINT8) 0x01 +#define ACPI_SUB_OPTIMAL_CONFIGURATION (UINT8) 0x02 + +/* + * 16, 32 and 64-bit Address Descriptor resource types + */ +#define ACPI_MEMORY_RANGE (UINT8) 0x00 +#define ACPI_IO_RANGE (UINT8) 0x01 +#define ACPI_BUS_NUMBER_RANGE (UINT8) 0x02 + +#define ACPI_ADDRESS_NOT_FIXED (UINT8) 0x00 +#define ACPI_ADDRESS_FIXED (UINT8) 0x01 + +#define ACPI_POS_DECODE (UINT8) 0x00 +#define ACPI_SUB_DECODE (UINT8) 0x01 + +#define ACPI_PRODUCER (UINT8) 0x00 +#define ACPI_CONSUMER (UINT8) 0x01 + + +/* + * If possible, pack the following structures to byte alignment + */ +#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED +#pragma pack(1) +#endif + +/* UUID data structures for use in vendor-defined resource descriptors */ + +typedef struct acpi_uuid +{ + UINT8 Data[ACPI_UUID_LENGTH]; +} ACPI_UUID; + +typedef struct acpi_vendor_uuid +{ + UINT8 Subtype; + UINT8 Data[ACPI_UUID_LENGTH]; + +} ACPI_VENDOR_UUID; + +/* + * Structures used to describe device resources + */ +typedef struct acpi_resource_irq +{ + UINT8 DescriptorLength; + UINT8 Triggering; + UINT8 Polarity; + UINT8 Sharable; + UINT8 InterruptCount; + UINT8 Interrupts[1]; + +} ACPI_RESOURCE_IRQ; + +typedef struct ACPI_RESOURCE_DMA +{ + UINT8 Type; + UINT8 BusMaster; + UINT8 Transfer; + UINT8 ChannelCount; + UINT8 Channels[1]; + +} ACPI_RESOURCE_DMA; + +typedef struct acpi_resource_start_dependent +{ + UINT8 DescriptorLength; + UINT8 CompatibilityPriority; + UINT8 PerformanceRobustness; + +} ACPI_RESOURCE_START_DEPENDENT; + + +/* + * The END_DEPENDENT_FUNCTIONS_RESOURCE struct is not + * needed because it has no fields + */ + + +typedef struct acpi_resource_io +{ + UINT8 IoDecode; + UINT8 Alignment; + UINT8 AddressLength; + UINT16 Minimum; + UINT16 Maximum; + +} ACPI_RESOURCE_IO; + +typedef struct acpi_resource_fixed_io +{ + UINT16 Address; + UINT8 AddressLength; + +} ACPI_RESOURCE_FIXED_IO; + +typedef struct acpi_resource_vendor +{ + UINT16 ByteLength; + UINT8 ByteData[1]; + +} ACPI_RESOURCE_VENDOR; + +/* Vendor resource with UUID info (introduced in ACPI 3.0) */ + +typedef struct acpi_resource_vendor_typed +{ + UINT16 ByteLength; + UINT8 UuidSubtype; + UINT8 Uuid[ACPI_UUID_LENGTH]; + UINT8 ByteData[1]; + +} ACPI_RESOURCE_VENDOR_TYPED; + +typedef struct acpi_resource_end_tag +{ + UINT8 Checksum; + +} ACPI_RESOURCE_END_TAG; + +typedef struct acpi_resource_memory24 +{ + UINT8 WriteProtect; + UINT16 Minimum; + UINT16 Maximum; + UINT16 Alignment; + UINT16 AddressLength; + +} ACPI_RESOURCE_MEMORY24; + +typedef struct acpi_resource_memory32 +{ + UINT8 WriteProtect; + UINT32 Minimum; + UINT32 Maximum; + UINT32 Alignment; + UINT32 AddressLength; + +} ACPI_RESOURCE_MEMORY32; + +typedef struct acpi_resource_fixed_memory32 +{ + UINT8 WriteProtect; + UINT32 Address; + UINT32 AddressLength; + +} ACPI_RESOURCE_FIXED_MEMORY32; + +typedef struct acpi_memory_attribute +{ + UINT8 WriteProtect; + UINT8 Caching; + UINT8 RangeType; + UINT8 Translation; + +} ACPI_MEMORY_ATTRIBUTE; + +typedef struct acpi_io_attribute +{ + UINT8 RangeType; + UINT8 Translation; + UINT8 TranslationType; + UINT8 Reserved1; + +} ACPI_IO_ATTRIBUTE; + +typedef union acpi_resource_attribute +{ + ACPI_MEMORY_ATTRIBUTE Mem; + ACPI_IO_ATTRIBUTE Io; + + /* Used for the *WordSpace macros */ + + UINT8 TypeSpecific; + +} ACPI_RESOURCE_ATTRIBUTE; + +typedef struct acpi_resource_source +{ + UINT8 Index; + UINT16 StringLength; + char *StringPtr; + +} ACPI_RESOURCE_SOURCE; + +/* Fields common to all address descriptors, 16/32/64 bit */ + +#define ACPI_RESOURCE_ADDRESS_COMMON \ + UINT8 ResourceType; \ + UINT8 ProducerConsumer; \ + UINT8 Decode; \ + UINT8 MinAddressFixed; \ + UINT8 MaxAddressFixed; \ + ACPI_RESOURCE_ATTRIBUTE Info; + +typedef struct acpi_resource_address +{ + ACPI_RESOURCE_ADDRESS_COMMON + +} ACPI_RESOURCE_ADDRESS; + +typedef struct acpi_resource_address16 +{ + ACPI_RESOURCE_ADDRESS_COMMON + UINT16 Granularity; + UINT16 Minimum; + UINT16 Maximum; + UINT16 TranslationOffset; + UINT16 AddressLength; + ACPI_RESOURCE_SOURCE ResourceSource; + +} ACPI_RESOURCE_ADDRESS16; + +typedef struct acpi_resource_address32 +{ + ACPI_RESOURCE_ADDRESS_COMMON + UINT32 Granularity; + UINT32 Minimum; + UINT32 Maximum; + UINT32 TranslationOffset; + UINT32 AddressLength; + ACPI_RESOURCE_SOURCE ResourceSource; + +} ACPI_RESOURCE_ADDRESS32; + +typedef struct acpi_resource_address64 +{ + ACPI_RESOURCE_ADDRESS_COMMON + UINT64 Granularity; + UINT64 Minimum; + UINT64 Maximum; + UINT64 TranslationOffset; + UINT64 AddressLength; + ACPI_RESOURCE_SOURCE ResourceSource; + +} ACPI_RESOURCE_ADDRESS64; + +typedef struct acpi_resource_extended_address64 +{ + ACPI_RESOURCE_ADDRESS_COMMON + UINT8 RevisionID; + UINT64 Granularity; + UINT64 Minimum; + UINT64 Maximum; + UINT64 TranslationOffset; + UINT64 AddressLength; + UINT64 TypeSpecific; + +} ACPI_RESOURCE_EXTENDED_ADDRESS64; + +typedef struct acpi_resource_extended_irq +{ + UINT8 ProducerConsumer; + UINT8 Triggering; + UINT8 Polarity; + UINT8 Sharable; + UINT8 InterruptCount; + ACPI_RESOURCE_SOURCE ResourceSource; + UINT32 Interrupts[1]; + +} ACPI_RESOURCE_EXTENDED_IRQ; + +typedef struct acpi_resource_generic_register +{ + UINT8 SpaceId; + UINT8 BitWidth; + UINT8 BitOffset; + UINT8 AccessSize; + UINT64 Address; + +} ACPI_RESOURCE_GENERIC_REGISTER; + + +/* ACPI_RESOURCE_TYPEs */ + +#define ACPI_RESOURCE_TYPE_IRQ 0 +#define ACPI_RESOURCE_TYPE_DMA 1 +#define ACPI_RESOURCE_TYPE_START_DEPENDENT 2 +#define ACPI_RESOURCE_TYPE_END_DEPENDENT 3 +#define ACPI_RESOURCE_TYPE_IO 4 +#define ACPI_RESOURCE_TYPE_FIXED_IO 5 +#define ACPI_RESOURCE_TYPE_VENDOR 6 +#define ACPI_RESOURCE_TYPE_END_TAG 7 +#define ACPI_RESOURCE_TYPE_MEMORY24 8 +#define ACPI_RESOURCE_TYPE_MEMORY32 9 +#define ACPI_RESOURCE_TYPE_FIXED_MEMORY32 10 +#define ACPI_RESOURCE_TYPE_ADDRESS16 11 +#define ACPI_RESOURCE_TYPE_ADDRESS32 12 +#define ACPI_RESOURCE_TYPE_ADDRESS64 13 +#define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 14 /* ACPI 3.0 */ +#define ACPI_RESOURCE_TYPE_EXTENDED_IRQ 15 +#define ACPI_RESOURCE_TYPE_GENERIC_REGISTER 16 +#define ACPI_RESOURCE_TYPE_MAX 16 + +/* Master union for resource descriptors */ + +typedef union acpi_resource_data +{ + ACPI_RESOURCE_IRQ Irq; + ACPI_RESOURCE_DMA Dma; + ACPI_RESOURCE_START_DEPENDENT StartDpf; + ACPI_RESOURCE_IO Io; + ACPI_RESOURCE_FIXED_IO FixedIo; + ACPI_RESOURCE_VENDOR Vendor; + ACPI_RESOURCE_VENDOR_TYPED VendorTyped; + ACPI_RESOURCE_END_TAG EndTag; + ACPI_RESOURCE_MEMORY24 Memory24; + ACPI_RESOURCE_MEMORY32 Memory32; + ACPI_RESOURCE_FIXED_MEMORY32 FixedMemory32; + ACPI_RESOURCE_ADDRESS16 Address16; + ACPI_RESOURCE_ADDRESS32 Address32; + ACPI_RESOURCE_ADDRESS64 Address64; + ACPI_RESOURCE_EXTENDED_ADDRESS64 ExtAddress64; + ACPI_RESOURCE_EXTENDED_IRQ ExtendedIrq; + ACPI_RESOURCE_GENERIC_REGISTER GenericReg; + + /* Common fields */ + + ACPI_RESOURCE_ADDRESS Address; /* Common 16/32/64 address fields */ + +} ACPI_RESOURCE_DATA; + + +/* Common resource header */ + +typedef struct acpi_resource +{ + UINT32 Type; + UINT32 Length; + ACPI_RESOURCE_DATA Data; + +} ACPI_RESOURCE; + +/* restore default alignment */ + +#pragma pack() + + +#define ACPI_RS_SIZE_NO_DATA 8 /* Id + Length fields */ +#define ACPI_RS_SIZE_MIN (UINT32) ACPI_ROUND_UP_TO_NATIVE_WORD (12) +#define ACPI_RS_SIZE(Type) (UINT32) (ACPI_RS_SIZE_NO_DATA + sizeof (Type)) + +#define ACPI_NEXT_RESOURCE(Res) (ACPI_RESOURCE *)((UINT8 *) Res + Res->Length) + + +typedef struct acpi_pci_routing_table +{ + UINT32 Length; + UINT32 Pin; + ACPI_INTEGER Address; /* here for 64-bit alignment */ + UINT32 SourceIndex; + char Source[4]; /* pad to 64 bits so sizeof() works in all cases */ + +} ACPI_PCI_ROUTING_TABLE; + +#endif /* __ACRESTYP_H__ */ + diff --git a/sys/contrib/dev/acpica/acstruct.h b/sys/contrib/dev/acpica/include/acstruct.h index 7861e7ad22cf..45c85fe0b2f1 100644 --- a/sys/contrib/dev/acpica/acstruct.h +++ b/sys/contrib/dev/acpica/include/acstruct.h @@ -1,7 +1,6 @@ /****************************************************************************** * * Name: acstruct.h - Internal structs - * $Revision: 1.47 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -184,7 +183,6 @@ typedef struct acpi_walk_state union acpi_operand_object **CallerReturnDesc; ACPI_GENERIC_STATE *ControlState; /* List of control states (nested IFs) */ struct acpi_namespace_node *DeferredNode; /* Used when executing deferred opcodes */ - struct acpi_gpe_event_info *GpeEventInfo; /* Info for GPE (_Lxx/_Exx methods only */ union acpi_operand_object *ImplicitReturnObj; struct acpi_namespace_node *MethodCallNode; /* Called method Node*/ ACPI_PARSE_OBJECT *MethodCallOp; /* MethodCall Op if running a method */ @@ -222,7 +220,7 @@ typedef struct acpi_init_walk_info UINT16 PackageInit; UINT16 ObjectCount; ACPI_OWNER_ID OwnerId; - ACPI_NATIVE_UINT TableIndex; + UINT32 TableIndex; } ACPI_INIT_WALK_INFO; @@ -280,18 +278,13 @@ typedef struct acpi_evaluate_info ACPI_OPERAND_OBJECT **Parameters; ACPI_NAMESPACE_NODE *ResolvedNode; ACPI_OPERAND_OBJECT *ReturnObject; + UINT8 ParamCount; UINT8 PassNumber; - UINT8 ParameterType; UINT8 ReturnObjectType; UINT8 Flags; } ACPI_EVALUATE_INFO; -/* Types for ParameterType above */ - -#define ACPI_PARAM_ARGS 0 -#define ACPI_PARAM_GPE 1 - /* Values for Flags above */ #define ACPI_IGNORE_RETURN_VALUE 1 diff --git a/sys/contrib/dev/acpica/actables.h b/sys/contrib/dev/acpica/include/actables.h index 144b59f458d2..e4428e641550 100644 --- a/sys/contrib/dev/acpica/actables.h +++ b/sys/contrib/dev/acpica/include/actables.h @@ -1,7 +1,6 @@ /****************************************************************************** * * Name: actables.h - ACPI table management - * $Revision: 1.64 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -127,8 +126,7 @@ AcpiAllocateRootTable ( */ void AcpiTbParseFadt ( - ACPI_NATIVE_UINT TableIndex, - UINT8 Flags); + UINT32 TableIndex); void AcpiTbCreateLocalFadt ( @@ -144,7 +142,7 @@ AcpiTbFindTable ( char *Signature, char *OemId, char *OemTableId, - ACPI_NATIVE_UINT *TableIndex); + UINT32 *TableIndex); /* @@ -161,7 +159,7 @@ AcpiTbVerifyTable ( ACPI_STATUS AcpiTbAddTable ( ACPI_TABLE_DESC *TableDesc, - ACPI_NATIVE_UINT *TableIndex); + UINT32 *TableIndex); ACPI_STATUS AcpiTbStoreTable ( @@ -169,7 +167,7 @@ AcpiTbStoreTable ( ACPI_TABLE_HEADER *Table, UINT32 Length, UINT8 Flags, - ACPI_NATIVE_UINT *TableIndex); + UINT32 *TableIndex); void AcpiTbDeleteTable ( @@ -179,36 +177,40 @@ void AcpiTbTerminate ( void); -void +ACPI_STATUS AcpiTbDeleteNamespaceByOwner ( - ACPI_NATIVE_UINT TableIndex); + UINT32 TableIndex); ACPI_STATUS AcpiTbAllocateOwnerId ( - ACPI_NATIVE_UINT TableIndex); + UINT32 TableIndex); ACPI_STATUS AcpiTbReleaseOwnerId ( - ACPI_NATIVE_UINT TableIndex); + UINT32 TableIndex); ACPI_STATUS AcpiTbGetOwnerId ( - ACPI_NATIVE_UINT TableIndex, + UINT32 TableIndex, ACPI_OWNER_ID *OwnerId); BOOLEAN AcpiTbIsTableLoaded ( - ACPI_NATIVE_UINT TableIndex); + UINT32 TableIndex); void AcpiTbSetTableLoadedFlag ( - ACPI_NATIVE_UINT TableIndex, + UINT32 TableIndex, BOOLEAN IsLoaded); /* * tbutils - table manager utilities */ +ACPI_STATUS +AcpiTbInitializeFacs ( + void); + BOOLEAN AcpiTbTablesLoaded ( void); @@ -221,7 +223,7 @@ AcpiTbPrintTableHeader( UINT8 AcpiTbChecksum ( UINT8 *Buffer, - ACPI_NATIVE_UINT Length); + UINT32 Length); ACPI_STATUS AcpiTbVerifyChecksum ( @@ -231,13 +233,11 @@ AcpiTbVerifyChecksum ( void AcpiTbInstallTable ( ACPI_PHYSICAL_ADDRESS Address, - UINT8 Flags, char *Signature, - ACPI_NATIVE_UINT TableIndex); + UINT32 TableIndex); ACPI_STATUS AcpiTbParseRootTable ( - ACPI_PHYSICAL_ADDRESS RsdpAddress, - UINT8 Flags); + ACPI_PHYSICAL_ADDRESS RsdpAddress); #endif /* __ACTABLES_H__ */ diff --git a/sys/contrib/dev/acpica/actbl.h b/sys/contrib/dev/acpica/include/actbl.h index 41859ff0f300..9d53404d605a 100644 --- a/sys/contrib/dev/acpica/actbl.h +++ b/sys/contrib/dev/acpica/include/actbl.h @@ -1,7 +1,6 @@ /****************************************************************************** * * Name: actbl.h - Basic ACPI Table Definitions - * $Revision: 1.84 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -306,12 +305,12 @@ typedef struct acpi_table_fadt UINT16 C3Latency; /* Worst case HW latency to enter/exit C3 state */ UINT16 FlushSize; /* Processor's memory cache line width, in bytes */ UINT16 FlushStride; /* Number of flush strides that need to be read */ - UINT8 DutyOffset; /* Processor duty cycle index in processor's P_CNT reg*/ - UINT8 DutyWidth; /* Processor duty cycle value bit width in P_CNT register.*/ + UINT8 DutyOffset; /* Processor duty cycle index in processor's P_CNT reg */ + UINT8 DutyWidth; /* Processor duty cycle value bit width in P_CNT register */ UINT8 DayAlarm; /* Index to day-of-month alarm in RTC CMOS RAM */ UINT8 MonthAlarm; /* Index to month-of-year alarm in RTC CMOS RAM */ UINT8 Century; /* Index to century in RTC CMOS RAM */ - UINT16 BootFlags; /* IA-PC Boot Architecture Flags. See Table 5-10 for description */ + UINT16 BootFlags; /* IA-PC Boot Architecture Flags (see below for individual flags) */ UINT8 Reserved; /* Reserved, must be zero */ UINT32 Flags; /* Miscellaneous flag bits (see below for individual flags) */ ACPI_GENERIC_ADDRESS ResetRegister; /* 64-bit address of the Reset register */ @@ -331,33 +330,40 @@ typedef struct acpi_table_fadt } ACPI_TABLE_FADT; -/* FADT flags */ +/* FADT Boot Architecture Flags (BootFlags) */ -#define ACPI_FADT_WBINVD (1) /* 00: The wbinvd instruction works properly */ -#define ACPI_FADT_WBINVD_FLUSH (1<<1) /* 01: The wbinvd flushes but does not invalidate */ -#define ACPI_FADT_C1_SUPPORTED (1<<2) /* 02: All processors support C1 state */ -#define ACPI_FADT_C2_MP_SUPPORTED (1<<3) /* 03: C2 state works on MP system */ -#define ACPI_FADT_POWER_BUTTON (1<<4) /* 04: Power button is handled as a generic feature */ -#define ACPI_FADT_SLEEP_BUTTON (1<<5) /* 05: Sleep button is handled as a generic feature, or not present */ -#define ACPI_FADT_FIXED_RTC (1<<6) /* 06: RTC wakeup stat not in fixed register space */ -#define ACPI_FADT_S4_RTC_WAKE (1<<7) /* 07: RTC wakeup stat not possible from S4 */ -#define ACPI_FADT_32BIT_TIMER (1<<8) /* 08: tmr_val is 32 bits 0=24-bits */ -#define ACPI_FADT_DOCKING_SUPPORTED (1<<9) /* 09: Docking supported */ -#define ACPI_FADT_RESET_REGISTER (1<<10) /* 10: System reset via the FADT RESET_REG supported */ -#define ACPI_FADT_SEALED_CASE (1<<11) /* 11: No internal expansion capabilities and case is sealed */ -#define ACPI_FADT_HEADLESS (1<<12) /* 12: No local video capabilities or local input devices */ -#define ACPI_FADT_SLEEP_TYPE (1<<13) /* 13: Must execute native instruction after writing SLP_TYPx register */ -#define ACPI_FADT_PCI_EXPRESS_WAKE (1<<14) /* 14: System supports PCIEXP_WAKE (STS/EN) bits (ACPI 3.0) */ -#define ACPI_FADT_PLATFORM_CLOCK (1<<15) /* 15: OSPM should use platform-provided timer (ACPI 3.0) */ -#define ACPI_FADT_S4_RTC_VALID (1<<16) /* 16: Contents of RTC_STS valid after S4 wake (ACPI 3.0) */ -#define ACPI_FADT_REMOTE_POWER_ON (1<<17) /* 17: System is compatible with remote power on (ACPI 3.0) */ -#define ACPI_FADT_APIC_CLUSTER (1<<18) /* 18: All local APICs must use cluster model (ACPI 3.0) */ -#define ACPI_FADT_APIC_PHYSICAL (1<<19) /* 19: All local xAPICs must use physical dest mode (ACPI 3.0) */ +#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 */ +#define ACPI_FADT_NO_VGA (1<<2) /* 02: [V4] It is not safe to probe for VGA hardware */ +#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 */ + +#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 */ +#define ACPI_FADT_C1_SUPPORTED (1<<2) /* 02: [V1] All processors support C1 state */ +#define ACPI_FADT_C2_MP_SUPPORTED (1<<3) /* 03: [V1] C2 state works on MP system */ +#define ACPI_FADT_POWER_BUTTON (1<<4) /* 04: [V1] Power button is handled as a control method device */ +#define ACPI_FADT_SLEEP_BUTTON (1<<5) /* 05: [V1] Sleep button is handled as a control method device */ +#define ACPI_FADT_FIXED_RTC (1<<6) /* 06: [V1] RTC wakeup status not in fixed register space */ +#define ACPI_FADT_S4_RTC_WAKE (1<<7) /* 07: [V1] RTC alarm can wake system from S4 */ +#define ACPI_FADT_32BIT_TIMER (1<<8) /* 08: [V1] ACPI timer width is 32-bit (0=24-bit) */ +#define ACPI_FADT_DOCKING_SUPPORTED (1<<9) /* 09: [V1] Docking supported */ +#define ACPI_FADT_RESET_REGISTER (1<<10) /* 10: [V2] System reset via the FADT RESET_REG supported */ +#define ACPI_FADT_SEALED_CASE (1<<11) /* 11: [V3] No internal expansion capabilities and case is sealed */ +#define ACPI_FADT_HEADLESS (1<<12) /* 12: [V3] No local video capabilities or local input devices */ +#define ACPI_FADT_SLEEP_TYPE (1<<13) /* 13: [V3] Must execute native instruction after writing SLP_TYPx register */ +#define ACPI_FADT_PCI_EXPRESS_WAKE (1<<14) /* 14: [V4] System supports PCIEXP_WAKE (STS/EN) bits (ACPI 3.0) */ +#define ACPI_FADT_PLATFORM_CLOCK (1<<15) /* 15: [V4] OSPM should use platform-provided timer (ACPI 3.0) */ +#define ACPI_FADT_S4_RTC_VALID (1<<16) /* 16: [V4] Contents of RTC_STS valid after S4 wake (ACPI 3.0) */ +#define ACPI_FADT_REMOTE_POWER_ON (1<<17) /* 17: [V4] System is compatible with remote power on (ACPI 3.0) */ +#define ACPI_FADT_APIC_CLUSTER (1<<18) /* 18: [V4] All local APICs must use cluster model (ACPI 3.0) */ +#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 */ -/* - * FADT Prefered Power Management Profiles - */ enum AcpiPreferedPmProfiles { PM_UNSPECIFIED = 0, @@ -370,23 +376,46 @@ enum AcpiPreferedPmProfiles }; -/* FADT Boot Arch Flags */ +/* Reset to default packing */ -#define BAF_LEGACY_DEVICES 0x0001 -#define BAF_8042_KEYBOARD_CONTROLLER 0x0002 +#pragma pack() -#define FADT2_REVISION_ID 3 -#define FADT2_MINUS_REVISION_ID 2 +typedef union acpi_name_union +{ + UINT32 Integer; + char Ascii[4]; -/* Reset to default packing */ +} ACPI_NAME_UNION; + +/* + * Internal ACPI Table Descriptor. One per ACPI table + */ +typedef struct acpi_table_desc +{ + ACPI_PHYSICAL_ADDRESS Address; + ACPI_TABLE_HEADER *Pointer; + UINT32 Length; /* Length fixed at 32 bits */ + ACPI_NAME_UNION Signature; + ACPI_OWNER_ID OwnerId; + UINT8 Flags; + +} ACPI_TABLE_DESC; + +/* Flags for above */ + +#define ACPI_TABLE_ORIGIN_UNKNOWN (0) +#define ACPI_TABLE_ORIGIN_MAPPED (1) +#define ACPI_TABLE_ORIGIN_ALLOCATED (2) +#define ACPI_TABLE_ORIGIN_OVERRIDE (4) +#define ACPI_TABLE_ORIGIN_MASK (7) +#define ACPI_TABLE_IS_LOADED (8) -#pragma pack() /* * Get the remaining ACPI tables */ -#include <contrib/dev/acpica/actbl1.h> +#include "actbl1.h" /* Macros used to generate offsets to specific table fields */ diff --git a/sys/contrib/dev/acpica/actbl1.h b/sys/contrib/dev/acpica/include/actbl1.h index 41e435b62b5e..dc5519b62263 100644 --- a/sys/contrib/dev/acpica/actbl1.h +++ b/sys/contrib/dev/acpica/include/actbl1.h @@ -1,7 +1,6 @@ /****************************************************************************** * * Name: actbl1.h - Additional ACPI table definitions - * $Revision: 1.47 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -133,20 +132,28 @@ * 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_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 */ @@ -163,7 +170,7 @@ */ -/* Common Sub-table header (used in MADT, SRAT, etc.) */ +/* Common Subtable header (used in MADT, SRAT, etc.) */ typedef struct acpi_subtable_header { @@ -173,6 +180,21 @@ typedef struct acpi_subtable_header } ACPI_SUBTABLE_HEADER; +/* Common Subtable header for WHEA tables (EINJ, ERST, WDAT) */ + +typedef struct acpi_whea_header +{ + UINT8 Action; + UINT8 Instruction; + UINT8 Flags; + UINT8 Reserved; + ACPI_GENERIC_ADDRESS RegisterRegion; + UINT64 Value; /* Value used with Read/Write register */ + UINT64 Mask; /* Bitmask required for this register instruction */ + +} ACPI_WHEA_HEADER; + + /******************************************************************************* * * ASF - Alert Standard Format table (Signature "ASF!") @@ -306,6 +328,41 @@ typedef struct acpi_asf_address /******************************************************************************* * + * BERT - Boot Error Record Table + * + ******************************************************************************/ + +typedef struct acpi_table_bert +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT32 RegionLength; /* Length of the boot error region */ + UINT64 Address; /* Physical addresss of the error region */ + +} ACPI_TABLE_BERT; + + +/* Boot Error Region */ + +typedef struct acpi_bert_region +{ + UINT32 BlockStatus; + UINT32 RawDataOffset; + UINT32 RawDataLength; + UINT32 DataLength; + UINT32 ErrorSeverity; + +} ACPI_BERT_REGION; + +/* BlockStatus Flags */ + +#define ACPI_BERT_UNCORRECTABLE (1) +#define ACPI_BERT_CORRECTABLE (2) +#define ACPI_BERT_MULTIPLE_UNCORRECTABLE (4) +#define ACPI_BERT_MULTIPLE_CORRECTABLE (8) + + +/******************************************************************************* + * * BOOT - Simple Boot Flag Table * ******************************************************************************/ @@ -365,6 +422,7 @@ typedef struct acpi_table_dbgp /******************************************************************************* * * DMAR - DMA Remapping table + * From "Intel Virtualization Technology for Directed I/O", Sept. 2007 * ******************************************************************************/ @@ -372,18 +430,21 @@ typedef struct acpi_table_dmar { ACPI_TABLE_HEADER Header; /* Common ACPI table header */ UINT8 Width; /* Host Address Width */ - UINT8 Reserved[11]; + 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; - UINT8 Flags; - UINT8 Reserved[3]; } ACPI_DMAR_HEADER; @@ -393,14 +454,16 @@ enum AcpiDmarType { ACPI_DMAR_TYPE_HARDWARE_UNIT = 0, ACPI_DMAR_TYPE_RESERVED_MEMORY = 1, - ACPI_DMAR_TYPE_RESERVED = 2 /* 2 and greater are reserved */ + 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; - UINT8 Segment; + UINT16 Reserved; + UINT8 EnumerationId; UINT8 Bus; } ACPI_DMAR_DEVICE_SCOPE; @@ -412,9 +475,17 @@ 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_RESERVED = 3 /* 3 and greater are reserved */ + 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 @@ -425,6 +496,9 @@ enum AcpiDmarScopeType 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; @@ -438,7 +512,9 @@ typedef struct acpi_dmar_hardware_unit typedef struct acpi_dmar_reserved_memory { ACPI_DMAR_HEADER Header; - UINT64 Address; /* 4K aligned base address */ + UINT16 Reserved; + UINT16 Segment; + UINT64 BaseAddress; /* 4K aligned base address */ UINT64 EndAddress; /* 4K aligned limit address */ } ACPI_DMAR_RESERVED_MEMORY; @@ -447,6 +523,21 @@ typedef struct acpi_dmar_reserved_memory #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) + /******************************************************************************* * @@ -468,6 +559,419 @@ typedef struct acpi_table_ecdt /******************************************************************************* * + * EINJ - Error Injection Table + * + ******************************************************************************/ + +typedef struct acpi_table_einj +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT32 HeaderLength; + UINT32 Reserved; + UINT32 Entries; + +} ACPI_TABLE_EINJ; + +/* EINJ Injection Instruction Entries (actions) */ + +typedef struct acpi_einj_entry +{ + ACPI_WHEA_HEADER WheaHeader; /* Common header for WHEA tables */ + +} ACPI_EINJ_ENTRY; + +/* Values for Action field above */ + +enum AcpiEinjActions +{ + ACPI_EINJ_BEGIN_OPERATION = 0, + ACPI_EINJ_GET_TRIGGER_TABLE = 1, + ACPI_EINJ_SET_ERROR_TYPE = 2, + ACPI_EINJ_GET_ERROR_TYPE = 3, + ACPI_EINJ_END_OPERATION = 4, + ACPI_EINJ_EXECUTE_OPERATION = 5, + ACPI_EINJ_CHECK_BUSY_STATUS = 6, + ACPI_EINJ_GET_COMMAND_STATUS = 7, + ACPI_EINJ_ACTION_RESERVED = 8, /* 8 and greater are reserved */ + ACPI_EINJ_TRIGGER_ERROR = 0xFF /* Except for this value */ +}; + +/* Values for Instruction field above */ + +enum AcpiEinjInstructions +{ + ACPI_EINJ_READ_REGISTER = 0, + ACPI_EINJ_READ_REGISTER_VALUE = 1, + ACPI_EINJ_WRITE_REGISTER = 2, + ACPI_EINJ_WRITE_REGISTER_VALUE = 3, + ACPI_EINJ_NOOP = 4, + ACPI_EINJ_INSTRUCTION_RESERVED = 5 /* 5 and greater are reserved */ +}; + +/* EINJ Trigger Error Action Table */ + +typedef struct acpi_einj_trigger +{ + UINT32 HeaderSize; + UINT32 Revision; + UINT32 TableSize; + UINT32 EntryCount; + +} ACPI_EINJ_TRIGGER; + + +/******************************************************************************* + * + * ERST - Error Record Serialization Table + * + ******************************************************************************/ + +typedef struct acpi_table_erst +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT32 HeaderLength; + UINT32 Reserved; + UINT32 Entries; + +} ACPI_TABLE_ERST; + +/* ERST Serialization Entries (actions) */ + +typedef struct acpi_erst_entry +{ + ACPI_WHEA_HEADER WheaHeader; /* Common header for WHEA tables */ + +} ACPI_ERST_ENTRY; + +/* 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_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_COUNT = 10, + ACPI_ERST_BEGIN_DUMMY_WRIITE = 11, + ACPI_ERST_NOT_USED = 12, + ACPI_ERST_GET_ERROR_RANGE = 13, + ACPI_ERST_GET_ERROR_LENGTH = 14, + ACPI_ERST_GET_ERROR_ATTRIBUTES = 15, + ACPI_ERST_ACTION_RESERVED = 16 /* 16 and greater are reserved */ +}; + +/* Values for Instruction field above */ + +enum AcpiErstInstructions +{ + ACPI_ERST_READ_REGISTER = 0, + ACPI_ERST_READ_REGISTER_VALUE = 1, + ACPI_ERST_WRITE_REGISTER = 2, + ACPI_ERST_WRITE_REGISTER_VALUE = 3, + ACPI_ERST_NOOP = 4, + ACPI_ERST_LOAD_VAR1 = 5, + ACPI_ERST_LOAD_VAR2 = 6, + ACPI_ERST_STORE_VAR1 = 7, + ACPI_ERST_ADD = 8, + ACPI_ERST_SUBTRACT = 9, + ACPI_ERST_ADD_VALUE = 10, + ACPI_ERST_SUBTRACT_VALUE = 11, + ACPI_ERST_STALL = 12, + ACPI_ERST_STALL_WHILE_TRUE = 13, + ACPI_ERST_SKIP_NEXT_IF_TRUE = 14, + ACPI_ERST_GOTO = 15, + ACPI_ERST_SET_SRC_ADDRESS_BASE = 16, + ACPI_ERST_SET_DST_ADDRESS_BASE = 17, + ACPI_ERST_MOVE_DATA = 18, + ACPI_ERST_INSTRUCTION_RESERVED = 19 /* 19 and greater are reserved */ +}; + + +/******************************************************************************* + * + * HEST - Hardware Error Source Table + * + ******************************************************************************/ + +typedef struct acpi_table_hest +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT32 ErrorSourceCount; + +} ACPI_TABLE_HEST; + + +/* HEST subtable header */ + +typedef struct acpi_hest_header +{ + UINT16 Type; + +} ACPI_HEST_HEADER; + + +/* Values for Type field above for subtables */ + +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 */ +}; + + +/* + * HEST Sub-subtables + */ + +/* XPF Machine Check Error Bank */ + +typedef struct acpi_hest_xpf_error_bank +{ + UINT8 BankNumber; + UINT8 ClearStatusOnInit; + UINT8 StatusFormat; + UINT8 ConfigWriteEnable; + UINT32 ControlRegister; + UINT64 ControlInitData; + 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; + + +/* Common HEST structure for PCI/AER types below (6,7,8) */ + +typedef struct acpi_hest_aer_common +{ + UINT16 SourceId; + UINT16 ConfigWriteEnable; + UINT8 Flags; + UINT8 Enabled; + UINT32 RecordsToPreAllocate; + UINT32 MaxSectionsPerRecord; + UINT32 Bus; + UINT16 Device; + UINT16 Function; + UINT16 DeviceControl; + UINT16 Reserved; + UINT32 UncorrectableErrorMask; + UINT32 UncorrectableErrorSeverity; + UINT32 CorrectableErrorMask; + UINT32 AdvancedErrorCapabilities; + +} ACPI_HEST_AER_COMMON; + + +/* Hardware Error Notification */ + +typedef struct acpi_hest_notify +{ + UINT8 Type; + UINT8 Length; + UINT16 ConfigWriteEnable; + UINT32 PollInterval; + UINT32 Vector; + UINT32 PollingThresholdValue; + UINT32 PollingThresholdWindow; + UINT32 ErrorThresholdValue; + UINT32 ErrorThresholdWindow; + +} ACPI_HEST_NOTIFY; + +/* Values for Notify Type field above */ + +enum AcpiHestNotifyTypes +{ + ACPI_HEST_NOTIFY_POLLED = 0, + ACPI_HEST_NOTIFY_EXTERNAL = 1, + ACPI_HEST_NOTIFY_LOCAL = 2, + ACPI_HEST_NOTIFY_SCI = 3, + ACPI_HEST_NOTIFY_NMI = 4, + ACPI_HEST_NOTIFY_RESERVED = 5 /* 5 and greater are reserved */ +}; + + +/* + * 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 */ + +typedef struct acpi_hest_xpf_machine_check +{ + ACPI_HEST_HEADER Header; + UINT16 SourceId; + UINT16 ConfigWriteEnable; + UINT8 Flags; + UINT8 Reserved1; + UINT32 RecordsToPreAllocate; + UINT32 MaxSectionsPerRecord; + UINT64 GlobalCapabilityData; + UINT64 GlobalControlData; + UINT8 NumHardwareBanks; + UINT8 Reserved2[7]; + +} ACPI_HEST_XPF_MACHINE_CHECK; + + +/* 1: XPF Corrected Machine Check */ + +typedef struct acpi_table_hest_xpf_corrected +{ + ACPI_HEST_HEADER Header; + UINT16 SourceId; + UINT16 ConfigWriteEnable; + UINT8 Flags; + UINT8 Enabled; + UINT32 RecordsToPreAllocate; + UINT32 MaxSectionsPerRecord; + ACPI_HEST_NOTIFY Notify; + UINT8 NumHardwareBanks; + UINT8 Reserved[3]; + +} ACPI_HEST_XPF_CORRECTED; + + +/* 3: XPF Non-Maskable Interrupt */ + +typedef struct acpi_hest_xpf_nmi +{ + ACPI_HEST_HEADER Header; + UINT16 SourceId; + UINT32 Reserved; + UINT32 RecordsToPreAllocate; + UINT32 MaxSectionsPerRecord; + UINT32 MaxRawDataLength; + +} ACPI_HEST_XPF_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; + + +/* 6: PCI Express Root Port AER */ + +typedef struct acpi_hest_aer_root +{ + ACPI_HEST_HEADER Header; + ACPI_HEST_AER_COMMON Aer; + UINT32 RootErrorCommand; + +} ACPI_HEST_AER_ROOT; + + +/* 7: PCI Express AER (AER Endpoint) */ + +typedef struct acpi_hest_aer +{ + ACPI_HEST_HEADER Header; + ACPI_HEST_AER_COMMON Aer; + +} ACPI_HEST_AER; + + +/* 8: PCI Express/PCI-X Bridge AER */ + +typedef struct acpi_hest_aer_bridge +{ + ACPI_HEST_HEADER Header; + ACPI_HEST_AER_COMMON Aer; + UINT32 SecondaryUncorrectableErrorMask; + UINT32 SecondaryUncorrectableErrorSeverity; + UINT32 SecondaryAdvancedCapabilities; + +} ACPI_HEST_AER_BRIDGE; + + +/* 9: Generic Hardware Error Source */ + +typedef struct acpi_hest_generic +{ + ACPI_HEST_HEADER Header; + UINT16 SourceId; + UINT16 RelatedSourceId; + UINT8 ConfigWriteEnable; + UINT8 Enabled; + UINT32 RecordsToPreAllocate; + UINT32 MaxSectionsPerRecord; + UINT32 MaxRawDataLength; + ACPI_GENERIC_ADDRESS ErrorStatusAddress; + ACPI_HEST_NOTIFY Notify; + UINT32 ErrorStatusBlockLength; + +} ACPI_HEST_GENERIC; + + +/******************************************************************************* + * * HPET - High Precision Event Timer table * ******************************************************************************/ @@ -494,6 +998,113 @@ typedef struct acpi_table_hpet /******************************************************************************* * + * IBFT - Boot Firmware Table + * + ******************************************************************************/ + +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; + + +/******************************************************************************* + * * MADT - Multiple APIC Description Table * ******************************************************************************/ @@ -529,7 +1140,9 @@ enum AcpiMadtType ACPI_MADT_TYPE_IO_SAPIC = 6, ACPI_MADT_TYPE_LOCAL_SAPIC = 7, ACPI_MADT_TYPE_INTERRUPT_SOURCE = 8, - ACPI_MADT_TYPE_RESERVED = 9 /* 9 and greater are reserved */ + ACPI_MADT_TYPE_LOCAL_X2APIC = 9, + ACPI_MADT_TYPE_LOCAL_X2APIC_NMI = 10, + ACPI_MADT_TYPE_RESERVED = 11 /* 11 and greater are reserved */ }; @@ -649,6 +1262,30 @@ typedef struct acpi_madt_interrupt_source #define ACPI_MADT_CPEI_OVERRIDE (1) +/* 9: Processor Local X2APIC (07/2008) */ + +typedef struct acpi_madt_local_x2apic +{ + ACPI_SUBTABLE_HEADER Header; + UINT16 Reserved; /* Reserved - must be zero */ + UINT32 LocalApicId; /* Processor x2APIC ID */ + UINT32 LapicFlags; + UINT32 Uid; /* ACPI processor UID */ + +} ACPI_MADT_LOCAL_X2APIC; + +/* 10: Local X2APIC NMI (07/2008) */ + +typedef struct acpi_madt_local_x2apic_nmi +{ + ACPI_SUBTABLE_HEADER Header; + UINT16 IntiFlags; + UINT32 Uid; /* ACPI processor UID */ + UINT8 Lint; /* LINTn to which NMI is connected */ + UINT8 Reserved[3]; /* Reserved - must be zero */ + +} ACPI_MADT_LOCAL_X2APIC_NMI; + /* * Common flags fields for MADT subtables @@ -811,12 +1448,17 @@ typedef struct acpi_table_srat enum AcpiSratType { - ACPI_SRAT_TYPE_CPU_AFFINITY = 0, - ACPI_SRAT_TYPE_MEMORY_AFFINITY = 1, - ACPI_SRAT_TYPE_RESERVED = 2 + ACPI_SRAT_TYPE_CPU_AFFINITY = 0, + ACPI_SRAT_TYPE_MEMORY_AFFINITY = 1, + ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY = 2, + ACPI_SRAT_TYPE_RESERVED = 3 /* 3 and greater are reserved */ }; -/* SRAT sub-tables */ +/* + * SRAT Sub-tables, correspond to Type in ACPI_SUBTABLE_HEADER + */ + +/* 0: Processor Local APIC/SAPIC Affinity */ typedef struct acpi_srat_cpu_affinity { @@ -830,10 +1472,7 @@ typedef struct acpi_srat_cpu_affinity } ACPI_SRAT_CPU_AFFINITY; -/* Flags */ - -#define ACPI_SRAT_CPU_ENABLED (1) /* 00: Use affinity structure */ - +/* 1: Memory Affinity */ typedef struct acpi_srat_mem_affinity { @@ -842,9 +1481,9 @@ typedef struct acpi_srat_mem_affinity UINT16 Reserved; /* Reserved, must be zero */ UINT64 BaseAddress; UINT64 Length; - UINT32 MemoryType; /* See acpi_address_range_id */ + UINT32 Reserved1; UINT32 Flags; - UINT64 Reserved1; /* Reserved, must be zero */ + UINT64 Reserved2; /* Reserved, must be zero */ } ACPI_SRAT_MEM_AFFINITY; @@ -854,16 +1493,21 @@ 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 */ -/* Memory types */ +/* 2: Processor Local X2_APIC Affinity (07/2008) */ -enum acpi_address_range_id +typedef struct acpi_srat_x2apic_cpu_affinity { - ACPI_ADDRESS_RANGE_MEMORY = 1, - ACPI_ADDRESS_RANGE_RESERVED = 2, - ACPI_ADDRESS_RANGE_ACPI = 3, - ACPI_ADDRESS_RANGE_NVS = 4, - ACPI_ADDRESS_RANGE_COUNT = 5 -}; + ACPI_SUBTABLE_HEADER Header; + UINT16 Reserved; /* Reserved, must be zero */ + UINT32 ProximityDomain; + UINT32 ApicId; + UINT32 Flags; + +} ACPI_SRAT_X2APIC_CPU_AFFINITY; + +/* Flags for ACPI_SRAT_CPU_AFFINITY and ACPI_SRAT_X2APIC_CPU_AFFINITY */ + +#define ACPI_SRAT_CPU_ENABLED (1) /* 00: Use affinity structure */ /******************************************************************************* @@ -884,6 +1528,88 @@ typedef struct 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 * ******************************************************************************/ diff --git a/sys/contrib/dev/acpica/actbl2.h b/sys/contrib/dev/acpica/include/actbl2.h index 97979c64f9d5..6b3a88bcf1e3 100644 --- a/sys/contrib/dev/acpica/actbl2.h +++ b/sys/contrib/dev/acpica/include/actbl2.h @@ -1,7 +1,6 @@ /****************************************************************************** * * Name: actbl2.h - ACPI Specification Revision 2.0 Tables - * $Revision: 1.51 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/actypes.h b/sys/contrib/dev/acpica/include/actypes.h index 9f04da25d3d9..8f970d972960 100644 --- a/sys/contrib/dev/acpica/actypes.h +++ b/sys/contrib/dev/acpica/include/actypes.h @@ -1,7 +1,6 @@ /****************************************************************************** * * Name: actypes.h - Common data types for the entire ACPI subsystem - * $Revision: 1.316 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -184,10 +183,10 @@ * usually used for memory allocation, efficient loop counters, and array * indexes. The types are similar to the size_t type in the C library and are * required because there is no C type that consistently represents the native - * data width. + * data width. ACPI_SIZE is needed because there is no guarantee that a + * kernel-level C library is present. * * ACPI_SIZE 16/32/64-bit unsigned value - * ACPI_NATIVE_UINT 16/32/64-bit unsigned value * ACPI_NATIVE_INT 16/32/64-bit signed value * */ @@ -223,15 +222,13 @@ typedef int INT32; /*! [End] no source code translation !*/ -typedef UINT64 ACPI_NATIVE_UINT; typedef INT64 ACPI_NATIVE_INT; - +typedef UINT64 ACPI_SIZE; typedef UINT64 ACPI_IO_ADDRESS; typedef UINT64 ACPI_PHYSICAL_ADDRESS; #define ACPI_MAX_PTR ACPI_UINT64_MAX #define ACPI_SIZE_MAX ACPI_UINT64_MAX - #define ACPI_USE_NATIVE_DIVIDE /* Has native 64-bit integer support */ /* @@ -264,9 +261,8 @@ typedef int INT32; /*! [End] no source code translation !*/ -typedef UINT32 ACPI_NATIVE_UINT; typedef INT32 ACPI_NATIVE_INT; - +typedef UINT32 ACPI_SIZE; typedef UINT32 ACPI_IO_ADDRESS; typedef UINT32 ACPI_PHYSICAL_ADDRESS; @@ -281,46 +277,76 @@ typedef UINT32 ACPI_PHYSICAL_ADDRESS; #endif -/* Variable-width type, used instead of clib size_t */ - -typedef ACPI_NATIVE_UINT ACPI_SIZE; - - /******************************************************************************* * - * OS-dependent and compiler-dependent types + * OS-dependent types * * If the defaults below are not appropriate for the host system, they can - * be defined in the compiler-specific or OS-specific header, and this will - * take precedence. + * be defined in the OS-specific header, and this will take precedence. * ******************************************************************************/ - /* Value returned by AcpiOsGetThreadId */ #ifndef ACPI_THREAD_ID -#define ACPI_THREAD_ID ACPI_NATIVE_UINT -#endif - -/* Object returned from AcpiOsCreateLock */ - -#ifndef ACPI_SPINLOCK -#define ACPI_SPINLOCK void * +#define ACPI_THREAD_ID ACPI_SIZE #endif /* Flags for AcpiOsAcquireLock/AcpiOsReleaseLock */ #ifndef ACPI_CPU_FLAGS -#define ACPI_CPU_FLAGS ACPI_NATIVE_UINT +#define ACPI_CPU_FLAGS ACPI_SIZE #endif /* Object returned from AcpiOsCreateCache */ #ifndef ACPI_CACHE_T +#ifdef ACPI_USE_LOCAL_CACHE #define ACPI_CACHE_T ACPI_MEMORY_LIST +#else +#define ACPI_CACHE_T void * +#endif #endif +/* + * Synchronization objects - Mutexes, Semaphores, and SpinLocks + */ +#if (ACPI_MUTEX_TYPE == ACPI_BINARY_SEMAPHORE) +/* + * These macros are used if the host OS does not support a mutex object. + * Map the OSL Mutex interfaces to binary semaphores. + */ +#define ACPI_MUTEX ACPI_SEMAPHORE +#define AcpiOsCreateMutex(OutHandle) AcpiOsCreateSemaphore (1, 1, OutHandle) +#define AcpiOsDeleteMutex(Handle) (void) AcpiOsDeleteSemaphore (Handle) +#define AcpiOsAcquireMutex(Handle,Time) AcpiOsWaitSemaphore (Handle, 1, Time) +#define AcpiOsReleaseMutex(Handle) (void) AcpiOsSignalSemaphore (Handle, 1) +#endif + +/* Configurable types for synchronization objects */ + +#ifndef ACPI_SPINLOCK +#define ACPI_SPINLOCK void * +#endif + +#ifndef ACPI_SEMAPHORE +#define ACPI_SEMAPHORE void * +#endif + +#ifndef ACPI_MUTEX +#define ACPI_MUTEX void * +#endif + + +/******************************************************************************* + * + * Compiler-dependent types + * + * If the defaults below are not appropriate for the host compiler, they can + * be defined in the compiler-specific header, and this will take precedence. + * + ******************************************************************************/ + /* Use C99 uintptr_t for pointer casting if available, "void *" otherwise */ #ifndef ACPI_UINTPTR_T @@ -354,6 +380,44 @@ typedef ACPI_NATIVE_UINT ACPI_SIZE; #endif +/****************************************************************************** + * + * ACPI Specification constants (Do not change unless the specification changes) + * + *****************************************************************************/ + +/* Number of distinct FADT-based GPE register blocks (GPE0 and GPE1) */ + +#define ACPI_MAX_GPE_BLOCKS 2 + +/* Default ACPI register widths */ + +#define ACPI_GPE_REGISTER_WIDTH 8 +#define ACPI_PM1_REGISTER_WIDTH 16 +#define ACPI_PM2_REGISTER_WIDTH 8 +#define ACPI_PM_TIMER_WIDTH 32 + +/* Names within the namespace are 4 bytes long */ + +#define ACPI_NAME_SIZE 4 +#define ACPI_PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 char for separator */ +#define ACPI_PATH_SEPARATOR '.' + +/* Sizes for ACPI table headers */ + +#define ACPI_OEM_ID_SIZE 6 +#define ACPI_OEM_TABLE_ID_SIZE 8 + +/* ACPI/PNP hardware IDs */ + +#define PCI_ROOT_HID_STRING "PNP0A03" +#define PCI_EXPRESS_ROOT_HID_STRING "PNP0A08" + +/* PM Timer ticks per second (HZ) */ + +#define PM_TIMER_FREQUENCY 3579545 + + /******************************************************************************* * * Independent types @@ -378,13 +442,20 @@ typedef ACPI_NATIVE_UINT ACPI_SIZE; /* - * Mescellaneous types + * Miscellaneous types */ typedef UINT32 ACPI_STATUS; /* All ACPI Exceptions */ typedef UINT32 ACPI_NAME; /* 4-byte ACPI name */ typedef char * ACPI_STRING; /* Null terminated ASCII string */ typedef void * ACPI_HANDLE; /* Actually a ptr to a NS Node */ + +/* Owner IDs are used to track namespace nodes for selective deletion */ + +typedef UINT8 ACPI_OWNER_ID; +#define ACPI_OWNER_ID_MAX 0xFF + + typedef struct uint64_struct { UINT32 Lo; @@ -407,14 +478,8 @@ typedef struct uint32_struct } UINT32_STRUCT; -/* Synchronization objects */ - -#define ACPI_MUTEX void * -#define ACPI_SEMAPHORE void * - - /* - * Acpi integer width. In ACPI version 1, integers are 32 bits. In ACPI + * 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. @@ -423,12 +488,6 @@ 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 */ - - -#if ACPI_MACHINE_WIDTH == 64 -#define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 64-bit divide */ -#endif - #define ACPI_MAX64_DECIMAL_DIGITS 20 #define ACPI_MAX32_DECIMAL_DIGITS 10 #define ACPI_MAX16_DECIMAL_DIGITS 5 @@ -438,8 +497,62 @@ typedef UINT64 ACPI_INTEGER; * Constants with special meanings */ #define ACPI_ROOT_OBJECT ACPI_ADD_PTR (ACPI_HANDLE, NULL, ACPI_MAX_PTR) +#define ACPI_WAIT_FOREVER 0xFFFF /* UINT16, as per ACPI spec */ +#define ACPI_DO_NOT_WAIT 0 +/******************************************************************************* + * + * Commonly used macros + * + ******************************************************************************/ + +/* Data manipulation */ + +#define ACPI_LOBYTE(Integer) ((UINT8) (UINT16)(Integer)) +#define ACPI_HIBYTE(Integer) ((UINT8) (((UINT16)(Integer)) >> 8)) +#define ACPI_LOWORD(Integer) ((UINT16) (UINT32)(Integer)) +#define ACPI_HIWORD(Integer) ((UINT16)(((UINT32)(Integer)) >> 16)) +#define ACPI_LODWORD(Integer64) ((UINT32) (UINT64)(Integer64)) +#define ACPI_HIDWORD(Integer64) ((UINT32)(((UINT64)(Integer64)) >> 32)) + +#define ACPI_SET_BIT(target,bit) ((target) |= (bit)) +#define ACPI_CLEAR_BIT(target,bit) ((target) &= ~(bit)) +#define ACPI_MIN(a,b) (((a)<(b))?(a):(b)) +#define ACPI_MAX(a,b) (((a)>(b))?(a):(b)) + +/* Size calculation */ + +#define ACPI_ARRAY_LENGTH(x) (sizeof(x) / sizeof((x)[0])) + +/* Pointer manipulation */ + +#define ACPI_CAST_PTR(t, p) ((t *) (ACPI_UINTPTR_T) (p)) +#define ACPI_CAST_INDIRECT_PTR(t, p) ((t **) (ACPI_UINTPTR_T) (p)) +#define ACPI_ADD_PTR(t, a, b) ACPI_CAST_PTR (t, (ACPI_CAST_PTR (UINT8, (a)) + (ACPI_SIZE)(b))) +#define ACPI_PTR_DIFF(a, b) (ACPI_SIZE) (ACPI_CAST_PTR (UINT8, (a)) - ACPI_CAST_PTR (UINT8, (b))) + +/* Pointer/Integer type conversions */ + +#define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void, (void *) NULL,(ACPI_SIZE) i) +#define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p, (void *) NULL) +#define ACPI_OFFSET(d, f) (ACPI_SIZE) ACPI_PTR_DIFF (&(((d *)0)->f), (void *) NULL) +#define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i) +#define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i) + +#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED +#define ACPI_COMPARE_NAME(a,b) (*ACPI_CAST_PTR (UINT32, (a)) == *ACPI_CAST_PTR (UINT32, (b))) +#else +#define ACPI_COMPARE_NAME(a,b) (!ACPI_STRNCMP (ACPI_CAST_PTR (char, (a)), ACPI_CAST_PTR (char, (b)), ACPI_NAME_SIZE)) +#endif + + +/******************************************************************************* + * + * Miscellaneous constants + * + ******************************************************************************/ + /* * Initialization sequence */ @@ -495,19 +608,25 @@ typedef UINT64 ACPI_INTEGER; /* * Standard notify values */ -#define ACPI_NOTIFY_BUS_CHECK (UINT8) 0 -#define ACPI_NOTIFY_DEVICE_CHECK (UINT8) 1 -#define ACPI_NOTIFY_DEVICE_WAKE (UINT8) 2 -#define ACPI_NOTIFY_EJECT_REQUEST (UINT8) 3 -#define ACPI_NOTIFY_DEVICE_CHECK_LIGHT (UINT8) 4 -#define ACPI_NOTIFY_FREQUENCY_MISMATCH (UINT8) 5 -#define ACPI_NOTIFY_BUS_MODE_MISMATCH (UINT8) 6 -#define ACPI_NOTIFY_POWER_FAULT (UINT8) 7 +#define ACPI_NOTIFY_BUS_CHECK (UINT8) 0x00 +#define ACPI_NOTIFY_DEVICE_CHECK (UINT8) 0x01 +#define ACPI_NOTIFY_DEVICE_WAKE (UINT8) 0x02 +#define ACPI_NOTIFY_EJECT_REQUEST (UINT8) 0x03 +#define ACPI_NOTIFY_DEVICE_CHECK_LIGHT (UINT8) 0x04 +#define ACPI_NOTIFY_FREQUENCY_MISMATCH (UINT8) 0x05 +#define ACPI_NOTIFY_BUS_MODE_MISMATCH (UINT8) 0x06 +#define ACPI_NOTIFY_POWER_FAULT (UINT8) 0x07 +#define ACPI_NOTIFY_CAPABILITIES_CHECK (UINT8) 0x08 +#define ACPI_NOTIFY_DEVICE_PLD_CHECK (UINT8) 0x09 +#define ACPI_NOTIFY_RESERVED (UINT8) 0x0A +#define ACPI_NOTIFY_LOCALITY_UPDATE (UINT8) 0x0B + +#define ACPI_NOTIFY_MAX 0x0B /* - * Types associated with ACPI names and objects. The first group of + * Types associated with ACPI names and objects. The first group of * values (up to ACPI_TYPE_EXTERNAL_MAX) correspond to the definition - * of the ACPI ObjectType() operator (See the ACPI Spec). Therefore, + * of the ACPI ObjectType() operator (See the ACPI Spec). Therefore, * only add to the first group if the spec changes. * * NOTE: Types must be kept in sync with the global AcpiNsProperties @@ -570,6 +689,9 @@ typedef UINT32 ACPI_OBJECT_TYPE; #define ACPI_TYPE_INVALID 0x1E #define ACPI_TYPE_NOT_FOUND 0xFF +#define ACPI_NUM_NS_TYPES (ACPI_TYPE_INVALID + 1) + + /* * All I/O */ @@ -677,7 +799,7 @@ typedef UINT32 ACPI_EVENT_STATUS; #define ACPI_SYSTEM_NOTIFY 0x1 #define ACPI_DEVICE_NOTIFY 0x2 -#define ACPI_ALL_NOTIFY 0x3 +#define ACPI_ALL_NOTIFY (ACPI_SYSTEM_NOTIFY | ACPI_DEVICE_NOTIFY) #define ACPI_MAX_NOTIFY_HANDLER_TYPE 0x3 #define ACPI_MAX_SYS_NOTIFY 0x7f @@ -700,8 +822,15 @@ typedef UINT8 ACPI_ADR_SPACE_TYPE; /* * BitRegister IDs - * These are bitfields defined within the full ACPI registers + * + * These values are intended to be used by the hardware interfaces + * and are mapped to individual bitfields defined within the ACPI + * registers. See the AcpiGbl_BitRegisterInfo global table in utglobal.c + * for this mapping. */ + +/* PM1 Status register */ + #define ACPI_BITREG_TIMER_STATUS 0x00 #define ACPI_BITREG_BUS_MASTER_STATUS 0x01 #define ACPI_BITREG_GLOBAL_LOCK_STATUS 0x02 @@ -711,70 +840,89 @@ typedef UINT8 ACPI_ADR_SPACE_TYPE; #define ACPI_BITREG_WAKE_STATUS 0x06 #define ACPI_BITREG_PCIEXP_WAKE_STATUS 0x07 +/* PM1 Enable register */ + #define ACPI_BITREG_TIMER_ENABLE 0x08 #define ACPI_BITREG_GLOBAL_LOCK_ENABLE 0x09 #define ACPI_BITREG_POWER_BUTTON_ENABLE 0x0A #define ACPI_BITREG_SLEEP_BUTTON_ENABLE 0x0B #define ACPI_BITREG_RT_CLOCK_ENABLE 0x0C -#define ACPI_BITREG_WAKE_ENABLE 0x0D -#define ACPI_BITREG_PCIEXP_WAKE_DISABLE 0x0E +#define ACPI_BITREG_PCIEXP_WAKE_DISABLE 0x0D + +/* PM1 Control register */ -#define ACPI_BITREG_SCI_ENABLE 0x0F -#define ACPI_BITREG_BUS_MASTER_RLD 0x10 -#define ACPI_BITREG_GLOBAL_LOCK_RELEASE 0x11 -#define ACPI_BITREG_SLEEP_TYPE_A 0x12 -#define ACPI_BITREG_SLEEP_TYPE_B 0x13 -#define ACPI_BITREG_SLEEP_ENABLE 0x14 +#define ACPI_BITREG_SCI_ENABLE 0x0E +#define ACPI_BITREG_BUS_MASTER_RLD 0x0F +#define ACPI_BITREG_GLOBAL_LOCK_RELEASE 0x10 +#define ACPI_BITREG_SLEEP_TYPE 0x11 +#define ACPI_BITREG_SLEEP_ENABLE 0x12 -#define ACPI_BITREG_ARB_DISABLE 0x15 +/* PM2 Control register */ -#define ACPI_BITREG_MAX 0x15 +#define ACPI_BITREG_ARB_DISABLE 0x13 + +#define ACPI_BITREG_MAX 0x13 #define ACPI_NUM_BITREG ACPI_BITREG_MAX + 1 +/* Status register values. A 1 clears a status bit. 0 = no effect */ + +#define ACPI_CLEAR_STATUS 1 + +/* Enable and Control register values */ + +#define ACPI_ENABLE_EVENT 1 +#define ACPI_DISABLE_EVENT 0 + + /* * External ACPI object definition */ + +/* + * Note: Type == ACPI_TYPE_ANY (0) is used to indicate a NULL package element + * or an unresolved named reference. + */ typedef union acpi_object { ACPI_OBJECT_TYPE Type; /* See definition of AcpiNsType for values */ struct { - ACPI_OBJECT_TYPE Type; + ACPI_OBJECT_TYPE Type; /* ACPI_TYPE_INTEGER */ ACPI_INTEGER Value; /* The actual number */ } Integer; struct { - ACPI_OBJECT_TYPE Type; + ACPI_OBJECT_TYPE Type; /* ACPI_TYPE_STRING */ UINT32 Length; /* # of bytes in string, excluding trailing null */ char *Pointer; /* points to the string value */ } String; struct { - ACPI_OBJECT_TYPE Type; + ACPI_OBJECT_TYPE Type; /* ACPI_TYPE_BUFFER */ UINT32 Length; /* # of bytes in buffer */ UINT8 *Pointer; /* points to the buffer */ } Buffer; struct { - ACPI_OBJECT_TYPE Type; - UINT32 Fill1; - ACPI_HANDLE Handle; /* object reference */ - } Reference; - - struct - { - ACPI_OBJECT_TYPE Type; + ACPI_OBJECT_TYPE Type; /* ACPI_TYPE_PACKAGE */ UINT32 Count; /* # of elements in package */ union acpi_object *Elements; /* Pointer to an array of ACPI_OBJECTs */ } Package; struct { - ACPI_OBJECT_TYPE Type; + ACPI_OBJECT_TYPE Type; /* ACPI_TYPE_LOCAL_REFERENCE */ + ACPI_OBJECT_TYPE ActualType; /* Type associated with the Handle */ + ACPI_HANDLE Handle; /* object reference */ + } Reference; + + struct + { + ACPI_OBJECT_TYPE Type; /* ACPI_TYPE_PROCESSOR */ UINT32 ProcId; ACPI_IO_ADDRESS PblkAddress; UINT32 PblkLength; @@ -782,7 +930,7 @@ typedef union acpi_object struct { - ACPI_OBJECT_TYPE Type; + ACPI_OBJECT_TYPE Type; /* ACPI_TYPE_POWER */ UINT32 SystemLevel; UINT32 ResourceOrder; } PowerResource; @@ -825,6 +973,18 @@ typedef struct acpi_buffer /* + * Predefined Namespace items + */ +typedef struct acpi_predefined_names +{ + char *Name; + UINT8 Type; + char *Val; + +} ACPI_PREDEFINED_NAMES; + + +/* * Structure and flags for AcpiGetSystemInfo */ #define ACPI_SYS_MODE_UNKNOWN 0x0000 @@ -850,6 +1010,26 @@ typedef struct acpi_system_info /* + * System statistics returned by AcpiGetStatistics() + */ +typedef struct acpi_statistics +{ + UINT32 SciCount; + UINT32 GpeCount; + UINT32 FixedEventCount[ACPI_NUM_FIXED_EVENTS]; + UINT32 MethodCount; + +} ACPI_STATISTICS; + + +/* Table Event Types */ + +#define ACPI_TABLE_EVENT_LOAD 0x0 +#define ACPI_TABLE_EVENT_UNLOAD 0x1 +#define ACPI_NUM_TABLE_EVENTS 2 + + +/* * Types specific to the OS service interfaces */ typedef UINT32 @@ -894,6 +1074,18 @@ ACPI_STATUS (*ACPI_EXCEPTION_HANDLER) ( UINT32 AmlOffset, void *Context); +/* Table Event handler (Load, LoadTable, etc.) and types */ + +typedef +ACPI_STATUS (*ACPI_TABLE_HANDLER) ( + UINT32 Event, + void *Table, + void *Context); + +#define ACPI_TABLE_LOAD 0x0 +#define ACPI_TABLE_UNLOAD 0x1 +#define ACPI_NUM_TABLE_EVENTS 2 + /* Address Spaces (For Operation Regions) */ @@ -908,7 +1100,6 @@ ACPI_STATUS (*ACPI_ADR_SPACE_HANDLER) ( #define ACPI_DEFAULT_HANDLER NULL - typedef ACPI_STATUS (*ACPI_ADR_SPACE_SETUP) ( ACPI_HANDLE RegionHandle, @@ -933,6 +1124,12 @@ ACPI_STATUS (*ACPI_WALK_CALLBACK) ( #define ACPI_INTERRUPT_HANDLED 0x01 +/* Length of _HID, _UID, _CID, and UUID 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 */ typedef struct acpi_device_id @@ -995,6 +1192,7 @@ 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 */ @@ -1030,424 +1228,31 @@ typedef struct acpi_mem_space_context /* - * Definitions for Resource Attributes - */ -typedef UINT16 ACPI_RS_LENGTH; /* Resource Length field is fixed at 16 bits */ -typedef UINT32 ACPI_RSDESC_SIZE; /* Max Resource Descriptor size is (Length+3) = (64K-1)+3 */ - -/* - * Memory Attributes - */ -#define ACPI_READ_ONLY_MEMORY (UINT8) 0x00 -#define ACPI_READ_WRITE_MEMORY (UINT8) 0x01 - -#define ACPI_NON_CACHEABLE_MEMORY (UINT8) 0x00 -#define ACPI_CACHABLE_MEMORY (UINT8) 0x01 -#define ACPI_WRITE_COMBINING_MEMORY (UINT8) 0x02 -#define ACPI_PREFETCHABLE_MEMORY (UINT8) 0x03 - -/* - * IO Attributes - * The ISA IO ranges are: n000-n0FFh, n400-n4FFh, n800-n8FFh, nC00-nCFFh. - * The non-ISA IO ranges are: n100-n3FFh, n500-n7FFh, n900-nBFFh, nCD0-nFFFh. - */ -#define ACPI_NON_ISA_ONLY_RANGES (UINT8) 0x01 -#define ACPI_ISA_ONLY_RANGES (UINT8) 0x02 -#define ACPI_ENTIRE_RANGE (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES) - -/* Type of translation - 1=Sparse, 0=Dense */ - -#define ACPI_SPARSE_TRANSLATION (UINT8) 0x01 - -/* - * IO Port Descriptor Decode - */ -#define ACPI_DECODE_10 (UINT8) 0x00 /* 10-bit IO address decode */ -#define ACPI_DECODE_16 (UINT8) 0x01 /* 16-bit IO address decode */ - -/* - * IRQ Attributes - */ -#define ACPI_LEVEL_SENSITIVE (UINT8) 0x00 -#define ACPI_EDGE_SENSITIVE (UINT8) 0x01 - -#define ACPI_ACTIVE_HIGH (UINT8) 0x00 -#define ACPI_ACTIVE_LOW (UINT8) 0x01 - -#define ACPI_EXCLUSIVE (UINT8) 0x00 -#define ACPI_SHARED (UINT8) 0x01 - -/* - * DMA Attributes - */ -#define ACPI_COMPATIBILITY (UINT8) 0x00 -#define ACPI_TYPE_A (UINT8) 0x01 -#define ACPI_TYPE_B (UINT8) 0x02 -#define ACPI_TYPE_F (UINT8) 0x03 - -#define ACPI_NOT_BUS_MASTER (UINT8) 0x00 -#define ACPI_BUS_MASTER (UINT8) 0x01 - -#define ACPI_TRANSFER_8 (UINT8) 0x00 -#define ACPI_TRANSFER_8_16 (UINT8) 0x01 -#define ACPI_TRANSFER_16 (UINT8) 0x02 - -/* - * Start Dependent Functions Priority definitions - */ -#define ACPI_GOOD_CONFIGURATION (UINT8) 0x00 -#define ACPI_ACCEPTABLE_CONFIGURATION (UINT8) 0x01 -#define ACPI_SUB_OPTIMAL_CONFIGURATION (UINT8) 0x02 - -/* - * 16, 32 and 64-bit Address Descriptor resource types - */ -#define ACPI_MEMORY_RANGE (UINT8) 0x00 -#define ACPI_IO_RANGE (UINT8) 0x01 -#define ACPI_BUS_NUMBER_RANGE (UINT8) 0x02 - -#define ACPI_ADDRESS_NOT_FIXED (UINT8) 0x00 -#define ACPI_ADDRESS_FIXED (UINT8) 0x01 - -#define ACPI_POS_DECODE (UINT8) 0x00 -#define ACPI_SUB_DECODE (UINT8) 0x01 - -#define ACPI_PRODUCER (UINT8) 0x00 -#define ACPI_CONSUMER (UINT8) 0x01 - - -/* - * If possible, pack the following structures to byte alignment - */ -#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED -#pragma pack(1) -#endif - -/* UUID data structures for use in vendor-defined resource descriptors */ - -typedef struct acpi_uuid -{ - UINT8 Data[ACPI_UUID_LENGTH]; -} ACPI_UUID; - -typedef struct acpi_vendor_uuid -{ - UINT8 Subtype; - UINT8 Data[ACPI_UUID_LENGTH]; - -} ACPI_VENDOR_UUID; - -/* - * Structures used to describe device resources + * ACPI_MEMORY_LIST is used only if the ACPICA local cache is enabled */ -typedef struct acpi_resource_irq +typedef struct acpi_memory_list { - UINT8 Triggering; - UINT8 Polarity; - UINT8 Sharable; - UINT8 InterruptCount; - UINT8 Interrupts[1]; - -} ACPI_RESOURCE_IRQ; - - -typedef struct ACPI_RESOURCE_DMA -{ - UINT8 Type; - UINT8 BusMaster; - UINT8 Transfer; - UINT8 ChannelCount; - UINT8 Channels[1]; - -} ACPI_RESOURCE_DMA; - - -typedef struct acpi_resource_start_dependent -{ - UINT8 CompatibilityPriority; - UINT8 PerformanceRobustness; - -} ACPI_RESOURCE_START_DEPENDENT; - - -/* - * END_DEPENDENT_FUNCTIONS_RESOURCE struct is not - * needed because it has no fields - */ - - -typedef struct acpi_resource_io -{ - UINT8 IoDecode; - UINT8 Alignment; - UINT8 AddressLength; - UINT16 Minimum; - UINT16 Maximum; - -} ACPI_RESOURCE_IO; - -typedef struct acpi_resource_fixed_io -{ - UINT16 Address; - UINT8 AddressLength; - -} ACPI_RESOURCE_FIXED_IO; - -typedef struct acpi_resource_vendor -{ - UINT16 ByteLength; - UINT8 ByteData[1]; - -} ACPI_RESOURCE_VENDOR; - -/* Vendor resource with UUID info (introduced in ACPI 3.0) */ - -typedef struct acpi_resource_vendor_typed -{ - UINT16 ByteLength; - UINT8 UuidSubtype; - UINT8 Uuid[ACPI_UUID_LENGTH]; - UINT8 ByteData[1]; - -} ACPI_RESOURCE_VENDOR_TYPED; - -typedef struct acpi_resource_end_tag -{ - UINT8 Checksum; - -} ACPI_RESOURCE_END_TAG; - -typedef struct acpi_resource_memory24 -{ - UINT8 WriteProtect; - UINT16 Minimum; - UINT16 Maximum; - UINT16 Alignment; - UINT16 AddressLength; - -} ACPI_RESOURCE_MEMORY24; - -typedef struct acpi_resource_memory32 -{ - UINT8 WriteProtect; - UINT32 Minimum; - UINT32 Maximum; - UINT32 Alignment; - UINT32 AddressLength; - -} ACPI_RESOURCE_MEMORY32; - -typedef struct acpi_resource_fixed_memory32 -{ - UINT8 WriteProtect; - UINT32 Address; - UINT32 AddressLength; - -} ACPI_RESOURCE_FIXED_MEMORY32; - -typedef struct acpi_memory_attribute -{ - UINT8 WriteProtect; - UINT8 Caching; - UINT8 RangeType; - UINT8 Translation; - -} ACPI_MEMORY_ATTRIBUTE; - -typedef struct acpi_io_attribute -{ - UINT8 RangeType; - UINT8 Translation; - UINT8 TranslationType; - UINT8 Reserved1; - -} ACPI_IO_ATTRIBUTE; - -typedef union acpi_resource_attribute -{ - ACPI_MEMORY_ATTRIBUTE Mem; - ACPI_IO_ATTRIBUTE Io; - - /* Used for the *WordSpace macros */ - - UINT8 TypeSpecific; - -} ACPI_RESOURCE_ATTRIBUTE; - -typedef struct acpi_resource_source -{ - UINT8 Index; - UINT16 StringLength; - char *StringPtr; - -} ACPI_RESOURCE_SOURCE; - -/* Fields common to all address descriptors, 16/32/64 bit */ - -#define ACPI_RESOURCE_ADDRESS_COMMON \ - UINT8 ResourceType; \ - UINT8 ProducerConsumer; \ - UINT8 Decode; \ - UINT8 MinAddressFixed; \ - UINT8 MaxAddressFixed; \ - ACPI_RESOURCE_ATTRIBUTE Info; - -typedef struct acpi_resource_address -{ - ACPI_RESOURCE_ADDRESS_COMMON - -} ACPI_RESOURCE_ADDRESS; - -typedef struct acpi_resource_address16 -{ - ACPI_RESOURCE_ADDRESS_COMMON - UINT16 Granularity; - UINT16 Minimum; - UINT16 Maximum; - UINT16 TranslationOffset; - UINT16 AddressLength; - ACPI_RESOURCE_SOURCE ResourceSource; - -} ACPI_RESOURCE_ADDRESS16; - -typedef struct acpi_resource_address32 -{ - ACPI_RESOURCE_ADDRESS_COMMON - UINT32 Granularity; - UINT32 Minimum; - UINT32 Maximum; - UINT32 TranslationOffset; - UINT32 AddressLength; - ACPI_RESOURCE_SOURCE ResourceSource; - -} ACPI_RESOURCE_ADDRESS32; - -typedef struct acpi_resource_address64 -{ - ACPI_RESOURCE_ADDRESS_COMMON - UINT64 Granularity; - UINT64 Minimum; - UINT64 Maximum; - UINT64 TranslationOffset; - UINT64 AddressLength; - ACPI_RESOURCE_SOURCE ResourceSource; - -} ACPI_RESOURCE_ADDRESS64; - -typedef struct acpi_resource_extended_address64 -{ - ACPI_RESOURCE_ADDRESS_COMMON - UINT8 RevisionID; - UINT64 Granularity; - UINT64 Minimum; - UINT64 Maximum; - UINT64 TranslationOffset; - UINT64 AddressLength; - UINT64 TypeSpecific; - -} ACPI_RESOURCE_EXTENDED_ADDRESS64; - -typedef struct acpi_resource_extended_irq -{ - UINT8 ProducerConsumer; - UINT8 Triggering; - UINT8 Polarity; - UINT8 Sharable; - UINT8 InterruptCount; - ACPI_RESOURCE_SOURCE ResourceSource; - UINT32 Interrupts[1]; - -} ACPI_RESOURCE_EXTENDED_IRQ; - -typedef struct acpi_resource_generic_register -{ - UINT8 SpaceId; - UINT8 BitWidth; - UINT8 BitOffset; - UINT8 AccessSize; - UINT64 Address; - -} ACPI_RESOURCE_GENERIC_REGISTER; - - -/* ACPI_RESOURCE_TYPEs */ - -#define ACPI_RESOURCE_TYPE_IRQ 0 -#define ACPI_RESOURCE_TYPE_DMA 1 -#define ACPI_RESOURCE_TYPE_START_DEPENDENT 2 -#define ACPI_RESOURCE_TYPE_END_DEPENDENT 3 -#define ACPI_RESOURCE_TYPE_IO 4 -#define ACPI_RESOURCE_TYPE_FIXED_IO 5 -#define ACPI_RESOURCE_TYPE_VENDOR 6 -#define ACPI_RESOURCE_TYPE_END_TAG 7 -#define ACPI_RESOURCE_TYPE_MEMORY24 8 -#define ACPI_RESOURCE_TYPE_MEMORY32 9 -#define ACPI_RESOURCE_TYPE_FIXED_MEMORY32 10 -#define ACPI_RESOURCE_TYPE_ADDRESS16 11 -#define ACPI_RESOURCE_TYPE_ADDRESS32 12 -#define ACPI_RESOURCE_TYPE_ADDRESS64 13 -#define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 14 /* ACPI 3.0 */ -#define ACPI_RESOURCE_TYPE_EXTENDED_IRQ 15 -#define ACPI_RESOURCE_TYPE_GENERIC_REGISTER 16 -#define ACPI_RESOURCE_TYPE_MAX 16 - - -typedef union acpi_resource_data -{ - ACPI_RESOURCE_IRQ Irq; - ACPI_RESOURCE_DMA Dma; - ACPI_RESOURCE_START_DEPENDENT StartDpf; - ACPI_RESOURCE_IO Io; - ACPI_RESOURCE_FIXED_IO FixedIo; - ACPI_RESOURCE_VENDOR Vendor; - ACPI_RESOURCE_VENDOR_TYPED VendorTyped; - ACPI_RESOURCE_END_TAG EndTag; - ACPI_RESOURCE_MEMORY24 Memory24; - ACPI_RESOURCE_MEMORY32 Memory32; - ACPI_RESOURCE_FIXED_MEMORY32 FixedMemory32; - ACPI_RESOURCE_ADDRESS16 Address16; - ACPI_RESOURCE_ADDRESS32 Address32; - ACPI_RESOURCE_ADDRESS64 Address64; - ACPI_RESOURCE_EXTENDED_ADDRESS64 ExtAddress64; - ACPI_RESOURCE_EXTENDED_IRQ ExtendedIrq; - ACPI_RESOURCE_GENERIC_REGISTER GenericReg; - - /* Common fields */ - - ACPI_RESOURCE_ADDRESS Address; /* Common 16/32/64 address fields */ - -} ACPI_RESOURCE_DATA; - - -typedef struct acpi_resource -{ - UINT32 Type; - UINT32 Length; - ACPI_RESOURCE_DATA Data; - -} ACPI_RESOURCE; - -/* restore default alignment */ - -#pragma pack() - - -#define ACPI_RS_SIZE_MIN 12 -#define ACPI_RS_SIZE_NO_DATA 8 /* Id + Length fields */ -#define ACPI_RS_SIZE(Type) (UINT32) (ACPI_RS_SIZE_NO_DATA + sizeof (Type)) - -#define ACPI_NEXT_RESOURCE(Res) (ACPI_RESOURCE *)((UINT8 *) Res + Res->Length) - - -typedef struct acpi_pci_routing_table -{ - UINT32 Length; - UINT32 Pin; - ACPI_INTEGER Address; /* here for 64-bit alignment */ - UINT32 SourceIndex; - char Source[4]; /* pad to 64 bits so sizeof() works in all cases */ + char *ListName; + void *ListHead; + UINT16 ObjectSize; + UINT16 MaxDepth; + UINT16 CurrentDepth; + UINT16 LinkOffset; + +#ifdef ACPI_DBG_TRACK_ALLOCATIONS + + /* Statistics for debug memory tracking only */ + + UINT32 TotalAllocated; + UINT32 TotalFreed; + UINT32 MaxOccupied; + UINT32 TotalSize; + UINT32 CurrentTotalSize; + UINT32 Requests; + UINT32 Hits; +#endif -} ACPI_PCI_ROUTING_TABLE; +} ACPI_MEMORY_LIST; #endif /* __ACTYPES_H__ */ diff --git a/sys/contrib/dev/acpica/acutils.h b/sys/contrib/dev/acpica/include/acutils.h index fef6f088d7f8..5573754e89fd 100644 --- a/sys/contrib/dev/acpica/acutils.h +++ b/sys/contrib/dev/acpica/include/acutils.h @@ -1,7 +1,6 @@ /****************************************************************************** * * Name: acutils.h -- prototypes for the common (subsystem-wide) procedures - * $Revision: 1.200 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -190,7 +189,7 @@ typedef struct acpi_pkg_info /* * utglobal - Global data structures and procedures */ -void +ACPI_STATUS AcpiUtInitGlobals ( void); @@ -200,6 +199,10 @@ char * AcpiUtGetMutexName ( UINT32 MutexId); +const char * +AcpiUtGetNotifyName ( + UINT32 NotifyValue); + #endif char * @@ -214,6 +217,10 @@ char * AcpiUtGetDescriptorName ( void *Object); +const char * +AcpiUtGetReferenceName ( + ACPI_OPERAND_OBJECT *Object); + char * AcpiUtGetObjectTypeName ( ACPI_OPERAND_OBJECT *ObjDesc); @@ -316,7 +323,7 @@ AcpiUtMemcpy ( void * AcpiUtMemset ( void *Dest, - ACPI_NATIVE_UINT Value, + UINT8 Value, ACPI_SIZE Count); int @@ -348,7 +355,9 @@ extern const UINT8 _acpi_ctype[]; #define ACPI_IS_PRINT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_SP | _ACPI_PU)) #define ACPI_IS_ALPHA(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP)) -#endif /* ACPI_USE_SYSTEM_CLIBRARY */ +#endif /* !ACPI_USE_SYSTEM_CLIBRARY */ + +#define ACPI_IS_ASCII(c) ((c) < 0x80) /* @@ -413,14 +422,14 @@ void AcpiUtTrace ( UINT32 LineNumber, const char *FunctionName, - char *ModuleName, + const char *ModuleName, UINT32 ComponentId); void AcpiUtTracePtr ( UINT32 LineNumber, const char *FunctionName, - char *ModuleName, + const char *ModuleName, UINT32 ComponentId, void *Pointer); @@ -428,7 +437,7 @@ void AcpiUtTraceU32 ( UINT32 LineNumber, const char *FunctionName, - char *ModuleName, + const char *ModuleName, UINT32 ComponentId, UINT32 Integer); @@ -436,7 +445,7 @@ void AcpiUtTraceStr ( UINT32 LineNumber, const char *FunctionName, - char *ModuleName, + const char *ModuleName, UINT32 ComponentId, char *String); @@ -444,14 +453,14 @@ void AcpiUtExit ( UINT32 LineNumber, const char *FunctionName, - char *ModuleName, + const char *ModuleName, UINT32 ComponentId); void AcpiUtStatusExit ( UINT32 LineNumber, const char *FunctionName, - char *ModuleName, + const char *ModuleName, UINT32 ComponentId, ACPI_STATUS Status); @@ -459,7 +468,7 @@ void AcpiUtValueExit ( UINT32 LineNumber, const char *FunctionName, - char *ModuleName, + const char *ModuleName, UINT32 ComponentId, ACPI_INTEGER Value); @@ -467,7 +476,7 @@ void AcpiUtPtrExit ( UINT32 LineNumber, const char *FunctionName, - char *ModuleName, + const char *ModuleName, UINT32 ComponentId, UINT8 *Ptr); @@ -499,58 +508,6 @@ AcpiUtReportWarning ( char *ModuleName, UINT32 LineNumber); -/* Error and message reporting interfaces */ - -void ACPI_INTERNAL_VAR_XFACE -AcpiUtDebugPrint ( - UINT32 RequestedDebugLevel, - UINT32 LineNumber, - const char *FunctionName, - char *ModuleName, - UINT32 ComponentId, - char *Format, - ...) ACPI_PRINTF_LIKE(6); - -void ACPI_INTERNAL_VAR_XFACE -AcpiUtDebugPrintRaw ( - UINT32 RequestedDebugLevel, - UINT32 LineNumber, - const char *FunctionName, - char *ModuleName, - UINT32 ComponentId, - char *Format, - ...) ACPI_PRINTF_LIKE(6); - -void ACPI_INTERNAL_VAR_XFACE -AcpiUtError ( - char *ModuleName, - UINT32 LineNumber, - char *Format, - ...) ACPI_PRINTF_LIKE(3); - -void ACPI_INTERNAL_VAR_XFACE -AcpiUtException ( - char *ModuleName, - UINT32 LineNumber, - ACPI_STATUS Status, - char *Format, - ...) ACPI_PRINTF_LIKE(4); - -void ACPI_INTERNAL_VAR_XFACE -AcpiUtWarning ( - char *ModuleName, - UINT32 LineNumber, - char *Format, - ...) ACPI_PRINTF_LIKE(3); - -void ACPI_INTERNAL_VAR_XFACE -AcpiUtInfo ( - char *ModuleName, - UINT32 LineNumber, - char *Format, - ...) ACPI_PRINTF_LIKE(3); - - /* * utdelete - Object deletion and reference counts */ @@ -620,20 +577,47 @@ AcpiUtExecute_Sxds ( ACPI_NAMESPACE_NODE *DeviceNode, UINT8 *Highest); +/* + * utlock - reader/writer locks + */ +ACPI_STATUS +AcpiUtCreateRwLock ( + ACPI_RW_LOCK *Lock); + +void +AcpiUtDeleteRwLock ( + ACPI_RW_LOCK *Lock); + +ACPI_STATUS +AcpiUtAcquireReadLock ( + ACPI_RW_LOCK *Lock); + +ACPI_STATUS +AcpiUtReleaseReadLock ( + ACPI_RW_LOCK *Lock); + +ACPI_STATUS +AcpiUtAcquireWriteLock ( + ACPI_RW_LOCK *Lock); + +void +AcpiUtReleaseWriteLock ( + ACPI_RW_LOCK *Lock); + /* * utobject - internal object create/delete/cache routines */ ACPI_OPERAND_OBJECT * AcpiUtCreateInternalObjectDbg ( - char *ModuleName, + const char *ModuleName, UINT32 LineNumber, UINT32 ComponentId, ACPI_OBJECT_TYPE Type); void * AcpiUtAllocateObjectDescDbg ( - char *ModuleName, + const char *ModuleName, UINT32 LineNumber, UINT32 ComponentId); @@ -649,6 +633,10 @@ AcpiUtValidInternalObject ( void *Object); ACPI_OPERAND_OBJECT * +AcpiUtCreatePackageObject ( + UINT32 Count); + +ACPI_OPERAND_OBJECT * AcpiUtCreateBufferObject ( ACPI_SIZE BufferSize); @@ -772,14 +760,14 @@ BOOLEAN AcpiUtValidAcpiName ( UINT32 Name); -ACPI_NAME +void AcpiUtRepairName ( char *Name); BOOLEAN AcpiUtValidAcpiChar ( char Character, - ACPI_NATIVE_UINT Position); + UINT32 Position); ACPI_STATUS AcpiUtStrtoul64 ( @@ -889,14 +877,14 @@ void * AcpiUtAllocate ( ACPI_SIZE Size, UINT32 Component, - char *Module, + const char *Module, UINT32 Line); void * AcpiUtAllocateZeroed ( ACPI_SIZE Size, UINT32 Component, - char *Module, + const char *Module, UINT32 Line); #ifdef ACPI_DBG_TRACK_ALLOCATIONS @@ -904,21 +892,21 @@ void * AcpiUtAllocateAndTrack ( ACPI_SIZE Size, UINT32 Component, - char *Module, + const char *Module, UINT32 Line); void * AcpiUtAllocateZeroedAndTrack ( ACPI_SIZE Size, UINT32 Component, - char *Module, + const char *Module, UINT32 Line); void AcpiUtFreeAndTrack ( void *Address, UINT32 Component, - char *Module, + const char *Module, UINT32 Line); void @@ -928,7 +916,7 @@ AcpiUtDumpAllocationInfo ( void AcpiUtDumpAllocations ( UINT32 Component, - char *Module); + const char *Module); ACPI_STATUS AcpiUtCreateList ( diff --git a/sys/contrib/dev/acpica/amlcode.h b/sys/contrib/dev/acpica/include/amlcode.h index 6376b57e471d..7694acc14cf4 100644 --- a/sys/contrib/dev/acpica/amlcode.h +++ b/sys/contrib/dev/acpica/include/amlcode.h @@ -3,7 +3,6 @@ * Name: amlcode.h - Definitions for AML, as included in "definition blocks" * Declarations and definitions contained herein are derived * directly from the ACPI specification. - * $Revision: 1.86 $ * *****************************************************************************/ @@ -11,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -583,7 +582,7 @@ typedef enum #define AML_METHOD_ARG_COUNT 0x07 #define AML_METHOD_SERIALIZED 0x08 -#define AML_METHOD_SYNCH_LEVEL 0xF0 +#define AML_METHOD_SYNC_LEVEL 0xF0 /* METHOD_FLAGS_ARG_COUNT is not used internally, define additional flags */ diff --git a/sys/contrib/dev/acpica/amlresrc.h b/sys/contrib/dev/acpica/include/amlresrc.h index e5b19fa6ae30..689564c6289e 100644 --- a/sys/contrib/dev/acpica/amlresrc.h +++ b/sys/contrib/dev/acpica/include/amlresrc.h @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: amlresrc.h - AML resource descriptors - * $Revision: 1.40 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/include/platform/accygwin.h b/sys/contrib/dev/acpica/include/platform/accygwin.h new file mode 100644 index 000000000000..e9585b44b109 --- /dev/null +++ b/sys/contrib/dev/acpica/include/platform/accygwin.h @@ -0,0 +1,163 @@ +/****************************************************************************** + * + * Name: accygwin.h - OS specific defines, etc. for cygwin environment + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2009, 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 __ACCYGWIN_H__ +#define __ACCYGWIN_H__ + +/* + * ACPICA configuration + */ +#define ACPI_USE_SYSTEM_CLIBRARY +#define ACPI_USE_DO_WHILE_0 +#define ACPI_THREAD_ID pthread_t +#define ACPI_FLUSH_CPU_CACHE() +/* + * This is needed since sem_timedwait does not appear to work properly + * on cygwin (always hangs forever). + */ +#define ACPI_USE_ALTERNATE_TIMEOUT + + +#include <stdarg.h> +#include <string.h> +#include <stdlib.h> +#include <ctype.h> +#include <unistd.h> + +#if defined(__ia64__) || defined(__x86_64__) +#define ACPI_MACHINE_WIDTH 64 +#define COMPILER_DEPENDENT_INT64 long +#define COMPILER_DEPENDENT_UINT64 unsigned long +#else +#define ACPI_MACHINE_WIDTH 32 +#define COMPILER_DEPENDENT_INT64 long long +#define COMPILER_DEPENDENT_UINT64 unsigned long long +#define ACPI_USE_NATIVE_DIVIDE +#endif + +#ifndef __cdecl +#define __cdecl +#endif + +#ifdef _ANSI +#define inline +#endif + + +/* Cygwin uses GCC */ + +#include "acgcc.h" + +#endif /* __ACCYGWIN_H__ */ diff --git a/sys/contrib/dev/acpica/acefi.h b/sys/contrib/dev/acpica/include/platform/acefi.h index 3916ffa9235e..40afaa401cfa 100644 --- a/sys/contrib/dev/acpica/acefi.h +++ b/sys/contrib/dev/acpica/include/platform/acefi.h @@ -1,7 +1,6 @@ /****************************************************************************** * * Name: acefi.h - OS specific defines, etc. - * $Revision: 1.18 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License diff --git a/sys/contrib/dev/acpica/acenv.h b/sys/contrib/dev/acpica/include/platform/acenv.h index 7ae10429a099..58cb03bfc1a5 100644 --- a/sys/contrib/dev/acpica/acenv.h +++ b/sys/contrib/dev/acpica/include/platform/acenv.h @@ -1,7 +1,6 @@ /****************************************************************************** * - * Name: acenv.h - Generation environment specific items - * $Revision: 1.131 $ + * Name: acenv.h - Host and compiler configuration * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,54 +116,64 @@ #ifndef __ACENV_H__ #define __ACENV_H__ - /* - * Configuration for ACPI tools and utilities + * Environment configuration. The purpose of this file is to interface ACPICA + * to the local environment. This includes compiler-specific, OS-specific, + * and machine-specific configuration. */ -#ifdef ACPI_LIBRARY -/* - * Note: The non-debug version of the AcpiLibrary does not contain any - * debug support, for minimimal size. The debug version uses ACPI_FULL_DEBUG - */ -#define ACPI_USE_LOCAL_CACHE -#endif +/* Types for ACPI_MUTEX_TYPE */ + +#define ACPI_BINARY_SEMAPHORE 0 +#define ACPI_OSL_MUTEX 1 + +/* Types for DEBUGGER_THREADING */ + +#define DEBUGGER_SINGLE_THREADED 0 +#define DEBUGGER_MULTI_THREADED 1 + + +/****************************************************************************** + * + * Configuration for ACPI tools and utilities + * + *****************************************************************************/ + +/* iASL configuration */ #ifdef ACPI_ASL_COMPILER -#define ACPI_DEBUG_OUTPUT #define ACPI_APPLICATION #define ACPI_DISASSEMBLER +#define ACPI_DEBUG_OUTPUT #define ACPI_CONSTANT_EVAL_ONLY #define ACPI_LARGE_NAMESPACE_NODE #define ACPI_DATA_TABLE_DISASSEMBLY #endif +/* AcpiExec configuration */ + #ifdef ACPI_EXEC_APP -#undef DEBUGGER_THREADING -#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED -#define ACPI_FULL_DEBUG #define ACPI_APPLICATION -#define ACPI_DEBUGGER +#define ACPI_FULL_DEBUG #define ACPI_MUTEX_DEBUG #define ACPI_DBG_TRACK_ALLOCATIONS #endif -#ifdef ACPI_DASM_APP -#ifndef MSDOS -#define ACPI_DEBUG_OUTPUT -#endif -#define ACPI_APPLICATION -#define ACPI_DISASSEMBLER -#define ACPI_NO_METHOD_EXECUTION -#define ACPI_LARGE_NAMESPACE_NODE -#define ACPI_DATA_TABLE_DISASSEMBLY +/* Linkable ACPICA library */ + +#ifdef ACPI_LIBRARY +#define ACPI_USE_LOCAL_CACHE #endif +/* Common for all ACPICA applications */ + #ifdef ACPI_APPLICATION #define ACPI_USE_SYSTEM_CLIBRARY #define ACPI_USE_LOCAL_CACHE #endif +/* Common debug support */ + #ifdef ACPI_FULL_DEBUG #define ACPI_DEBUGGER #define ACPI_DEBUG_OUTPUT @@ -172,88 +181,123 @@ #endif -/* - * Environment configuration. The purpose of this file is to interface to the - * local generation environment. - * - * 1) ACPI_USE_SYSTEM_CLIBRARY - Define this if linking to an actual C library. - * Otherwise, local versions of string/memory functions will be used. - * 2) ACPI_USE_STANDARD_HEADERS - Define this if linking to a C library and - * the standard header files may be used. - * - * The ACPI subsystem only uses low level C library functions that do not call - * operating system services and may therefore be inlined in the code. - * - * It may be necessary to tailor these include files to the target - * generation environment. - * - * - * Functions and constants used from each header: - * - * string.h: memcpy - * memset - * strcat - * strcmp - * strcpy - * strlen - * strncmp - * strncat - * strncpy - * - * stdlib.h: strtoul +/*! [Begin] no source code translation */ + +/****************************************************************************** * - * stdarg.h: va_list - * va_arg - * va_start - * va_end + * Host configuration files. The compiler configuration files are included + * by the host files. * - */ - -/*! [Begin] no source code translation */ + *****************************************************************************/ -#if defined(__linux__) +#if defined(_LINUX) || defined(__linux__) #include "aclinux.h" -#elif defined(_AED_EFI) -#include "acefi.h" - -#elif defined(WIN32) -#include "acwin.h" - -#elif defined(WIN64) -#include "acwin64.h" - -#elif defined(MSDOS) /* Must appear after WIN32 and WIN64 check */ -#include "acdos16.h" - #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) -#include <contrib/dev/acpica/acfreebsd.h> +#include "acfreebsd.h" #elif defined(__NetBSD__) #include "acnetbsd.h" +#elif defined(__sun) +#include "acsolaris.h" + #elif defined(MODESTO) #include "acmodesto.h" #elif defined(NETWARE) #include "acnetware.h" -#elif defined(__sun) -#include "acsolaris.h" +#elif defined(_CYGWIN) +#include "accygwin.h" + +#elif defined(WIN32) +#include "acwin.h" + +#elif defined(WIN64) +#include "acwin64.h" + +#elif defined(_WRS_LIB_BUILD) +#include "acvxworks.h" + +#elif defined(__OS2__) +#include "acos2.h" + +#elif defined(_AED_EFI) +#include "acefi.h" #else -/* All other environments */ +/* Unknown environment */ + +#error Unknown target environment +#endif + +/*! [End] no source code translation !*/ + + +/****************************************************************************** + * + * Setup defaults for the required symbols that were not defined in one of + * the host/compiler files above. + * + *****************************************************************************/ -#define ACPI_USE_STANDARD_HEADERS +/* 64-bit data types */ +#ifndef COMPILER_DEPENDENT_INT64 #define COMPILER_DEPENDENT_INT64 long long +#endif + +#ifndef COMPILER_DEPENDENT_UINT64 #define COMPILER_DEPENDENT_UINT64 unsigned long long +#endif +/* Type of mutex supported by host. Default is binary semaphores. */ + +#ifndef ACPI_MUTEX_TYPE +#define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE #endif -/*! [End] no source code translation !*/ +/* Global Lock acquire/release */ + +#ifndef ACPI_ACQUIRE_GLOBAL_LOCK +#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) Acq = 1 +#endif + +#ifndef ACPI_RELEASE_GLOBAL_LOCK +#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) Acq = 0 +#endif + +/* Flush CPU cache - used when going to sleep. Wbinvd or similar. */ + +#ifndef ACPI_FLUSH_CPU_CACHE +#define ACPI_FLUSH_CPU_CACHE() +#endif + +/* + * Configurable calling conventions: + * + * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads) + * ACPI_EXTERNAL_XFACE - External ACPI interfaces + * ACPI_INTERNAL_XFACE - Internal ACPI interfaces + * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces + */ +#ifndef ACPI_SYSTEM_XFACE +#define ACPI_SYSTEM_XFACE +#endif + +#ifndef ACPI_EXTERNAL_XFACE +#define ACPI_EXTERNAL_XFACE +#endif + +#ifndef ACPI_INTERNAL_XFACE +#define ACPI_INTERNAL_XFACE +#endif +#ifndef ACPI_INTERNAL_VAR_XFACE +#define ACPI_INTERNAL_VAR_XFACE +#endif /* * Debugger threading model @@ -263,9 +307,6 @@ * By default the model is single threaded if ACPI_APPLICATION is set, * multi-threaded if ACPI_APPLICATION is not set. */ -#define DEBUGGER_SINGLE_THREADED 0 -#define DEBUGGER_MULTI_THREADED 1 - #ifndef DEBUGGER_THREADING #ifdef ACPI_APPLICATION #define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED @@ -282,17 +323,26 @@ * *****************************************************************************/ -#define ACPI_IS_ASCII(c) ((c) < 0x80) - -#ifdef ACPI_USE_SYSTEM_CLIBRARY /* - * Use the standard C library headers. - * We want to keep these to a minimum. + * ACPI_USE_SYSTEM_CLIBRARY - Define this if linking to an actual C library. + * Otherwise, local versions of string/memory functions will be used. + * ACPI_USE_STANDARD_HEADERS - Define this if linking to a C library and + * the standard header files may be used. + * + * The ACPICA subsystem only uses low level C library functions that do not call + * operating system services and may therefore be inlined in the code. + * + * It may be necessary to tailor these include files to the target + * generation environment. */ +#ifdef ACPI_USE_SYSTEM_CLIBRARY + +/* Use the standard C library headers. We want to keep these to a minimum */ + #ifdef ACPI_USE_STANDARD_HEADERS -/* - * Use the standard headers from the standard locations - */ + +/* Use the standard headers from the standard locations */ + #include <stdarg.h> #include <stdlib.h> #include <string.h> @@ -300,9 +350,8 @@ #endif /* ACPI_USE_STANDARD_HEADERS */ -/* - * We will be linking to the standard Clib functions - */ +/* We will be linking to the standard Clib functions */ + #define ACPI_STRSTR(s1,s2) strstr((s1), (s2)) #define ACPI_STRCHR(s1,c) strchr((s1), (c)) #define ACPI_STRLEN(s) (ACPI_SIZE) strlen((s)) @@ -316,7 +365,6 @@ #define ACPI_MEMCMP(s1,s2,n) memcmp((const char *)(s1), (const char *)(s2), (ACPI_SIZE)(n)) #define ACPI_MEMCPY(d,s,n) (void) memcpy((d), (s), (ACPI_SIZE)(n)) #define ACPI_MEMSET(d,s,n) (void) memset((d), (s), (ACPI_SIZE)(n)) - #define ACPI_TOUPPER(i) toupper((int) (i)) #define ACPI_TOLOWER(i) tolower((int) (i)) #define ACPI_IS_XDIGIT(i) isxdigit((int) (i)) @@ -334,13 +382,12 @@ * *****************************************************************************/ - /* - * Use local definitions of C library macros and functions - * NOTE: The function implementations may not be as efficient - * as an inline or assembly code implementation provided by a - * native C library. +/* + * Use local definitions of C library macros and functions. These function + * implementations may not be as efficient as an inline or assembly code + * implementation provided by a native C library, but they are functionally + * equivalent. */ - #ifndef va_arg #ifndef _VALIST @@ -348,15 +395,13 @@ typedef char *va_list; #endif /* _VALIST */ -/* - * Storage alignment properties - */ +/* Storage alignment properties */ + #define _AUPBND (sizeof (ACPI_NATIVE_INT) - 1) #define _ADNBND (sizeof (ACPI_NATIVE_INT) - 1) -/* - * Variable argument list macro definitions - */ +/* Variable argument list macro definitions */ + #define _Bnd(X, bnd) (((sizeof (X)) + (bnd)) & (~(bnd))) #define va_arg(ap, T) (*(T *)(((ap) += (_Bnd (T, _AUPBND))) - (_Bnd (T,_ADNBND)))) #define va_end(ap) (void) 0 @@ -364,6 +409,7 @@ typedef char *va_list; #endif /* va_arg */ +/* Use the local (ACPICA) definitions of the clib functions */ #define ACPI_STRSTR(s1,s2) AcpiUtStrstr ((s1), (s2)) #define ACPI_STRCHR(s1,c) AcpiUtStrchr ((s1), (c)) @@ -383,62 +429,4 @@ typedef char *va_list; #endif /* ACPI_USE_SYSTEM_CLIBRARY */ - -/****************************************************************************** - * - * Assembly code macros - * - *****************************************************************************/ - -/* - * Handle platform- and compiler-specific assembly language differences. - * These should already have been defined by the platform includes above. - * - * Notes: - * 1) Interrupt 3 is used to break into a debugger - * 2) Interrupts are turned off during ACPI register setup - */ - -/* Unrecognized compiler, use defaults */ - -#ifndef ACPI_ASM_MACROS - -/* - * Calling conventions: - * - * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads) - * ACPI_EXTERNAL_XFACE - External ACPI interfaces - * ACPI_INTERNAL_XFACE - Internal ACPI interfaces - * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces - */ -#define ACPI_SYSTEM_XFACE -#define ACPI_EXTERNAL_XFACE -#define ACPI_INTERNAL_XFACE -#define ACPI_INTERNAL_VAR_XFACE - -#define ACPI_ASM_MACROS -#define BREAKPOINT3 -#define ACPI_DISABLE_IRQS() -#define ACPI_ENABLE_IRQS() -#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) -#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) - -#endif /* ACPI_ASM_MACROS */ - - -#ifdef ACPI_APPLICATION - -/* Don't want software interrupts within a ring3 application */ - -#undef BREAKPOINT3 -#define BREAKPOINT3 -#endif - - -/****************************************************************************** - * - * Compiler-specific information is contained in the compiler-specific - * headers. - * - *****************************************************************************/ #endif /* __ACENV_H__ */ diff --git a/sys/contrib/dev/acpica/acfreebsd.h b/sys/contrib/dev/acpica/include/platform/acfreebsd.h index bc22ba2e08a3..20c5687c20b9 100644 --- a/sys/contrib/dev/acpica/acfreebsd.h +++ b/sys/contrib/dev/acpica/include/platform/acfreebsd.h @@ -1,7 +1,6 @@ /****************************************************************************** * * Name: acfreebsd.h - OS specific defines, etc. - * $Revision: 1.25 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -115,87 +114,67 @@ *****************************************************************************/ #ifndef __ACFREEBSD_H__ -#define __ACFREEBSD_H__ +#define __ACFREEBSD_H__ /* FreeBSD uses GCC */ -#include <contrib/dev/acpica/acgcc.h> +#include "acgcc.h" #include <sys/types.h> #include <machine/acpica_machdep.h> -#define ACPI_THREAD_ID pid_t -#define ACPI_UINTPTR_T uintptr_t -#define ACPI_USE_LOCAL_CACHE -#define __cdecl +#define ACPI_UINTPTR_T uintptr_t -#ifdef _KERNEL -#include "opt_acpi.h" -#endif +#define ACPI_USE_LOCAL_CACHE +#define ACPI_USE_SYSTEM_CLIBRARY -#ifdef ACPI_DEBUG -#define ACPI_DEBUG_OUTPUT /* for backward compatibility */ -#define ACPI_DISASSEMBLER -#endif +#define __cdecl #ifdef _KERNEL + #include <sys/ctype.h> #include <sys/param.h> #include <sys/systm.h> #include <sys/libkern.h> #include <machine/stdarg.h> -#ifdef DEBUGGER_THREADING -#undef DEBUGGER_THREADING -#endif /* DEBUGGER_THREADING */ +#include "opt_acpi.h" -#define DEBUGGER_THREADING 0 /* integrated with DDB */ +#define ACPI_THREAD_ID lwpid_t + +#ifdef ACPI_DEBUG +#define ACPI_DEBUG_OUTPUT /* for backward compatibility */ +#define ACPI_DISASSEMBLER +#endif #ifdef ACPI_DEBUG_OUTPUT #include "opt_ddb.h" #ifdef DDB -#define ACPI_DEBUGGER +#define ACPI_DEBUGGER #endif /* DDB */ #endif /* ACPI_DEBUG_OUTPUT */ -#else /* _KERNEL */ +#ifdef DEBUGGER_THREADING +#undef DEBUGGER_THREADING +#endif /* DEBUGGER_THREADING */ -/* Not building kernel code, so use libc */ -#define ACPI_USE_STANDARD_HEADERS -#define ACPI_FLUSH_CPU_CACHE() +#define DEBUGGER_THREADING 0 /* integrated with DDB */ + +#else /* _KERNEL */ #if __STDC_HOSTED__ #include <ctype.h> #endif -#define __cli() -#define __sti() +#define ACPI_THREAD_ID pthread_t -#endif /* _KERNEL */ +/* Not building kernel code, so use libc */ +#define ACPI_USE_STANDARD_HEADERS +#define ACPI_FLUSH_CPU_CACHE() + +#define __cli() +#define __sti() -/* Always use FreeBSD code over our local versions */ -#define ACPI_USE_SYSTEM_CLIBRARY - -#if defined(_KERNEL) && (__FreeBSD_version < 700020) -/* Or strstr (used in debugging mode, also move to libkern) */ -static __inline char * -strstr (char *s, char *find) -{ - char c, sc; - size_t len; - - if ((c = *find++) != 0) { - len = strlen (find); - do { - do { - if ((sc = *s++) == 0) - return (NULL); - } while (sc != c); - } while (strncmp (s, find, len) != 0); - s--; - } - return ((char *) s); -} #endif /* _KERNEL */ #endif /* __ACFREEBSD_H__ */ diff --git a/sys/contrib/dev/acpica/acgcc.h b/sys/contrib/dev/acpica/include/platform/acgcc.h index 28576b148163..449942278c99 100644 --- a/sys/contrib/dev/acpica/acgcc.h +++ b/sys/contrib/dev/acpica/include/platform/acgcc.h @@ -1,7 +1,6 @@ /****************************************************************************** * * Name: acgcc.h - GCC specific defines, etc. - * $Revision: 1.32 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -135,5 +134,4 @@ */ #define ACPI_UNUSED_VAR __attribute__ ((unused)) - #endif /* __ACGCC_H__ */ diff --git a/sys/contrib/dev/acpica/include/platform/acintel.h b/sys/contrib/dev/acpica/include/platform/acintel.h new file mode 100644 index 000000000000..44197a09946e --- /dev/null +++ b/sys/contrib/dev/acpica/include/platform/acintel.h @@ -0,0 +1,168 @@ +/****************************************************************************** + * + * Name: acintel.h - VC specific defines, etc. + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2009, 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 __ACINTEL_H__ +#define __ACINTEL_H__ + + +#define COMPILER_DEPENDENT_INT64 __int64 +#define COMPILER_DEPENDENT_UINT64 unsigned __int64 + +#define inline __inline + +/* + * Calling conventions: + * + * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads) + * ACPI_EXTERNAL_XFACE - External ACPI interfaces + * ACPI_INTERNAL_XFACE - Internal ACPI interfaces + * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces + */ +#define ACPI_SYSTEM_XFACE +#define ACPI_EXTERNAL_XFACE +#define ACPI_INTERNAL_XFACE +#define ACPI_INTERNAL_VAR_XFACE + +/* + * Math helper functions + */ +#define ACPI_DIV_64_BY_32(n, n_hi, n_lo, d32, q32, r32) \ +{ \ + q32 = n / d32; \ + r32 = n % d32; \ +} + +#define ACPI_SHIFT_RIGHT_64(n, n_hi, n_lo) \ +{ \ + n <<= 1; \ +} + +/* remark 981 - operands evaluated in no particular order */ +#pragma warning(disable:981) + +/* warn C4100: unreferenced formal parameter */ +#pragma warning(disable:4100) + +/* warn C4127: conditional expression is constant */ +#pragma warning(disable:4127) + +/* warn C4706: assignment within conditional expression */ +#pragma warning(disable:4706) + +/* warn C4214: bit field types other than int */ +#pragma warning(disable:4214) + + +#endif /* __ACINTEL_H__ */ diff --git a/sys/contrib/dev/acpica/include/platform/aclinux.h b/sys/contrib/dev/acpica/include/platform/aclinux.h new file mode 100644 index 000000000000..c6f868cdbf95 --- /dev/null +++ b/sys/contrib/dev/acpica/include/platform/aclinux.h @@ -0,0 +1,233 @@ +/****************************************************************************** + * + * Name: aclinux.h - OS specific defines, etc. for Linux + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2009, 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 __ACLINUX_H__ +#define __ACLINUX_H__ + +/* Common (in-kernel/user-space) ACPICA configuration */ + +#define ACPI_USE_SYSTEM_CLIBRARY +#define ACPI_USE_DO_WHILE_0 +#define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE + + +#ifdef __KERNEL__ + +#include <linux/string.h> +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/ctype.h> +#include <linux/sched.h> +#include <asm/system.h> +#include <asm/atomic.h> +#include <asm/div64.h> +#include <asm/acpi.h> +#include <linux/slab.h> +#include <linux/spinlock_types.h> +#include <asm/current.h> + +/* Host-dependent types and defines for in-kernel ACPICA */ + +#define ACPI_MACHINE_WIDTH BITS_PER_LONG +#define ACPI_EXPORT_SYMBOL(symbol) EXPORT_SYMBOL(symbol); +#define strtoul simple_strtoul + +#define ACPI_CACHE_T struct kmem_cache +#define ACPI_SPINLOCK spinlock_t * +#define ACPI_CPU_FLAGS unsigned long +#define ACPI_THREAD_ID struct task_struct * + +#else /* !__KERNEL__ */ + +#include <stdarg.h> +#include <string.h> +#include <stdlib.h> +#include <ctype.h> +#include <unistd.h> + +/* Host-dependent types and defines for user-space ACPICA */ + +#define ACPI_FLUSH_CPU_CACHE() +#define ACPI_THREAD_ID pthread_t + +#if defined(__ia64__) || defined(__x86_64__) +#define ACPI_MACHINE_WIDTH 64 +#define COMPILER_DEPENDENT_INT64 long +#define COMPILER_DEPENDENT_UINT64 unsigned long +#else +#define ACPI_MACHINE_WIDTH 32 +#define COMPILER_DEPENDENT_INT64 long long +#define COMPILER_DEPENDENT_UINT64 unsigned long long +#define ACPI_USE_NATIVE_DIVIDE +#endif + +#ifndef __cdecl +#define __cdecl +#endif + +#endif /* __KERNEL__ */ + +/* Linux uses GCC */ + +#include "acgcc.h" + + +#ifdef __KERNEL__ +/* + * Overrides for in-kernel ACPICA + */ +static inline acpi_thread_id acpi_os_get_thread_id(void) +{ + return current; +} + +/* + * The irqs_disabled() check is for resume from RAM. + * Interrupts are off during resume, just like they are for boot. + * However, boot has (system_state != SYSTEM_RUNNING) + * to quiet __might_sleep() in kmalloc() and resume does not. + */ +#include <acpi/actypes.h> +static inline void *acpi_os_allocate(acpi_size size) +{ + return kmalloc(size, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL); +} + +static inline void *acpi_os_allocate_zeroed(acpi_size size) +{ + return kzalloc(size, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL); +} + +static inline void *acpi_os_acquire_object(acpi_cache_t * cache) +{ + return kmem_cache_zalloc(cache, + irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL); +} + +#define ACPI_ALLOCATE(a) acpi_os_allocate(a) +#define ACPI_ALLOCATE_ZEROED(a) acpi_os_allocate_zeroed(a) +#define ACPI_FREE(a) kfree(a) + +/* Used within ACPICA to show where it is safe to preempt execution */ + +#define ACPI_PREEMPTION_POINT() \ + do { \ + if (!irqs_disabled()) \ + cond_resched(); \ + } while (0) + +#endif /* __KERNEL__ */ + +#endif /* __ACLINUX_H__ */ diff --git a/sys/contrib/dev/acpica/acpi.h b/sys/contrib/dev/acpica/include/platform/acmsvc.h index b0f7848f4622..0320e74d1e18 100644 --- a/sys/contrib/dev/acpica/acpi.h +++ b/sys/contrib/dev/acpica/include/platform/acmsvc.h @@ -1,7 +1,6 @@ /****************************************************************************** * - * Name: acpi.h - Master include file, Publics and external data. - * $Revision: 1.61 $ + * Name: acmsvc.h - VC specific defines, etc. * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -114,30 +113,71 @@ * *****************************************************************************/ -#ifndef __ACPI_H__ -#define __ACPI_H__ +#ifndef __ACMSVC_H__ +#define __ACMSVC_H__ + +#define COMPILER_DEPENDENT_INT64 __int64 +#define COMPILER_DEPENDENT_UINT64 unsigned __int64 /* - * Common includes for all ACPI driver files - * We put them here because we don't want to duplicate them - * in the rest of the source code again and again. + * Calling conventions: + * + * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads) + * ACPI_EXTERNAL_XFACE - External ACPI interfaces + * ACPI_INTERNAL_XFACE - Internal ACPI interfaces + * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces */ -#include <contrib/dev/acpica/acnames.h> /* Global ACPI names and strings */ -#include <contrib/dev/acpica/acconfig.h> /* Configuration constants */ -#include <contrib/dev/acpica/acenv.h> /* Target environment specific items */ -#include <contrib/dev/acpica/actypes.h> /* Fundamental common data types */ -#include <contrib/dev/acpica/acexcep.h> /* ACPI exception codes */ -#include <contrib/dev/acpica/acmacros.h> /* C macros */ -#include <contrib/dev/acpica/actbl.h> /* ACPI table definitions */ -#include <contrib/dev/acpica/aclocal.h> /* Internal data types */ -#include <contrib/dev/acpica/acoutput.h> /* Error output and Debug macros */ -#include <contrib/dev/acpica/acpiosxf.h> /* Interfaces to the ACPI-to-OS layer*/ -#include <contrib/dev/acpica/acpixf.h> /* ACPI core subsystem external interfaces */ -#include <contrib/dev/acpica/acobject.h> /* ACPI internal object */ -#include <contrib/dev/acpica/acstruct.h> /* Common structures */ -#include <contrib/dev/acpica/acglobal.h> /* All global variables */ -#include <contrib/dev/acpica/achware.h> /* Hardware defines and interfaces */ -#include <contrib/dev/acpica/acutils.h> /* Utility interfaces */ +#define ACPI_SYSTEM_XFACE __cdecl +#define ACPI_EXTERNAL_XFACE +#define ACPI_INTERNAL_XFACE +#define ACPI_INTERNAL_VAR_XFACE __cdecl + +#ifndef _LINT +/* + * Math helper functions + */ +#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \ +{ \ + __asm mov edx, n_hi \ + __asm mov eax, n_lo \ + __asm div d32 \ + __asm mov q32, eax \ + __asm mov r32, edx \ +} + +#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \ +{ \ + __asm shr n_hi, 1 \ + __asm rcr n_lo, 1 \ +} +#else + +/* Fake versions to make lint happy */ + +#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \ +{ \ + q32 = n_hi / d32; \ + r32 = n_lo / d32; \ +} + +#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \ +{ \ + n_hi >>= 1; \ + n_lo >>= 1; \ +} +#endif + +/* warn C4100: unreferenced formal parameter */ +#pragma warning(disable:4100) + +/* warn C4127: conditional expression is constant */ +#pragma warning(disable:4127) + +/* warn C4706: assignment within conditional expression */ +#pragma warning(disable:4706) + +/* warn C4131: uses old-style declarator (iASL compiler only) */ +#pragma warning(disable:4131) -#endif /* __ACPI_H__ */ +#endif /* __ACMSVC_H__ */ diff --git a/sys/contrib/dev/acpica/include/platform/acnetbsd.h b/sys/contrib/dev/acpica/include/platform/acnetbsd.h new file mode 100644 index 000000000000..c04851b926a2 --- /dev/null +++ b/sys/contrib/dev/acpica/include/platform/acnetbsd.h @@ -0,0 +1,188 @@ +/****************************************************************************** + * + * Name: acnetbsd.h - OS specific defines, etc. + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2009, 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 __ACNETBSD_H__ +#define __ACNETBSD_H__ + +/* NetBSD uses GCC */ + +#include "acgcc.h" + +#ifdef _LP64 +#define ACPI_MACHINE_WIDTH 64 +#else +#define ACPI_MACHINE_WIDTH 32 +#endif + +#define COMPILER_DEPENDENT_INT64 int64_t +#define COMPILER_DEPENDENT_UINT64 uint64_t + +#ifdef _KERNEL +#include "opt_acpi.h" /* collect build-time options here */ + +#include <sys/param.h> +#include <sys/systm.h> +#include <machine/stdarg.h> +#include <machine/acpi_func.h> + +#define asm __asm + +#define ACPI_USE_NATIVE_DIVIDE + +#define ACPI_SYSTEM_XFACE +#define ACPI_EXTERNAL_XFACE +#define ACPI_INTERNAL_XFACE +#define ACPI_INTERNAL_VAR_XFACE + +#ifdef ACPI_DEBUG +#define ACPI_DEBUG_OUTPUT +#define ACPI_DBG_TRACK_ALLOCATIONS +#ifdef DEBUGGER_THREADING +#undef DEBUGGER_THREADING +#endif /* DEBUGGER_THREADING */ +#define DEBUGGER_THREADING 0 /* integrated with DDB */ +#include "opt_ddb.h" +#ifdef DDB +#define ACPI_DISASSEMBLER +#define ACPI_DEBUGGER +#endif /* DDB */ +#endif /* ACPI_DEBUG */ + +static __inline int +isprint(int ch) +{ + return(isspace(ch) || isascii(ch)); +} + +#else /* _KERNEL */ + +#include <ctype.h> + +/* Not building kernel code, so use libc */ +#define ACPI_USE_STANDARD_HEADERS + +#define __cli() +#define __sti() + +/* XXX */ +#define __inline inline + +#endif /* _KERNEL */ + +/* Always use NetBSD code over our local versions */ +#define ACPI_USE_SYSTEM_CLIBRARY +#define ACPI_USE_NATIVE_DIVIDE + +#endif /* __ACNETBSD_H__ */ diff --git a/sys/contrib/dev/acpica/include/platform/acos2.h b/sys/contrib/dev/acpica/include/platform/acos2.h new file mode 100644 index 000000000000..21e3373c24de --- /dev/null +++ b/sys/contrib/dev/acpica/include/platform/acos2.h @@ -0,0 +1,172 @@ +/****************************************************************************** + * + * Name: acos2.h - OS/2 specific defines, etc. + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2009, 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 __ACOS2_H__ +#define __ACOS2_H__ +#define INCL_LONGLONG +#include <os2.h> + + +#define ACPI_MACHINE_WIDTH 32 + +#define COMPILER_DEPENDENT_INT64 long long +#define COMPILER_DEPENDENT_UINT64 unsigned long long +#define ACPI_USE_NATIVE_DIVIDE + +#define ACPI_SYSTEM_XFACE APIENTRY +#define ACPI_EXTERNAL_XFACE APIENTRY +#define ACPI_INTERNAL_XFACE APIENTRY +#define ACPI_INTERNAL_VAR_XFACE APIENTRY + +/* + * Some compilers complain about unused variables. Sometimes we don't want to + * use all the variables (most specifically for _THIS_MODULE). This allow us + * to to tell the compiler warning in a per-variable manner that a variable + * is unused. + */ +#define ACPI_UNUSED_VAR + +#define ACPI_USE_STANDARD_HEADERS +#include <io.h> + +#define ACPI_FLUSH_CPU_CACHE() Wbinvd() +void Wbinvd(void); + +#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) Acq = OSPMAcquireGlobalLock(GLptr) +#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Pnd) Pnd = OSPMReleaseGlobalLock(GLptr) +unsigned short OSPMAcquireGlobalLock (void *); +unsigned short OSPMReleaseGlobalLock (void *); + +#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \ +{ \ + unsigned long long val = 0LL; \ + val = n_lo | ( ((unsigned long long)h_hi) << 32 ); \ + __llrotr (val,1); \ + n_hi = (unsigned long)((val >> 32 ) & 0xffffffff ); \ + n_lo = (unsigned long)(val & 0xffffffff); \ +} + +/* IBM VAC does not have inline */ + +#if __IBMC__ || __IBMCPP__ +#define inline +#endif + +#ifndef ACPI_ASL_COMPILER +#define ACPI_USE_LOCAL_CACHE +#undef ACPI_DEBUGGER +#endif + +#endif /* __ACOS2_H__ */ diff --git a/sys/contrib/dev/acpica/include/platform/acwin.h b/sys/contrib/dev/acpica/include/platform/acwin.h new file mode 100644 index 000000000000..d1fa2ee22b94 --- /dev/null +++ b/sys/contrib/dev/acpica/include/platform/acwin.h @@ -0,0 +1,220 @@ +/****************************************************************************** + * + * Name: acwin.h - OS specific defines, etc. + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2009, 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 __ACWIN_H__ +#define __ACWIN_H__ + +/*! [Begin] no source code translation (Keep the include) */ + +/* Windows uses VC */ +#ifdef _MSC_VER +#include "acmsvc.h" +#endif +/*! [End] no source code translation !*/ + +#define ACPI_MACHINE_WIDTH 32 + +#define inline __inline + +#define ACPI_USE_STANDARD_HEADERS + +#ifdef ACPI_DEFINE_ALTERNATE_TYPES +/* + * Types used only in (Linux) translated source, defined here to enable + * cross-platform compilation (i.e., generate the Linux code on Windows, + * for test purposes only) + */ +typedef int s32; +typedef unsigned char u8; +typedef unsigned short u16; +typedef unsigned int u32; +typedef COMPILER_DEPENDENT_UINT64 u64; +#endif + + +/* + * Handle platform- and compiler-specific assembly language differences. + * + * Notes: + * 1) Interrupt 3 is used to break into a debugger + * 2) Interrupts are turned off during ACPI register setup + */ + +/*! [Begin] no source code translation */ + +#ifdef ACPI_APPLICATION +#define ACPI_FLUSH_CPU_CACHE() +#else +#define ACPI_FLUSH_CPU_CACHE() __asm {WBINVD} +#endif + +#ifdef _DEBUG +#define ACPI_SIMPLE_RETURN_MACROS +#endif + +/*! [End] no source code translation !*/ + +/* + * Global Lock acquire/release code + * + * Note: Handles case where the FACS pointer is null + */ +#define ACPI_ACQUIRE_GLOBAL_LOCK(FacsPtr, Acq) __asm \ +{ \ + __asm mov eax, 0xFF \ + __asm mov ecx, FacsPtr \ + __asm or ecx, ecx \ + __asm jz exit_acq \ + __asm lea ecx, [ecx].GlobalLock \ + \ + __asm acq10: \ + __asm mov eax, [ecx] \ + __asm mov edx, eax \ + __asm and edx, 0xFFFFFFFE \ + __asm bts edx, 1 \ + __asm adc edx, 0 \ + __asm lock cmpxchg dword ptr [ecx], edx \ + __asm jnz acq10 \ + \ + __asm cmp dl, 3 \ + __asm sbb eax, eax \ + \ + __asm exit_acq: \ + __asm mov Acq, al \ +} + +#define ACPI_RELEASE_GLOBAL_LOCK(FacsPtr, Pnd) __asm \ +{ \ + __asm xor eax, eax \ + __asm mov ecx, FacsPtr \ + __asm or ecx, ecx \ + __asm jz exit_rel \ + __asm lea ecx, [ecx].GlobalLock \ + \ + __asm Rel10: \ + __asm mov eax, [ecx] \ + __asm mov edx, eax \ + __asm and edx, 0xFFFFFFFC \ + __asm lock cmpxchg dword ptr [ecx], edx \ + __asm jnz Rel10 \ + \ + __asm cmp dl, 3 \ + __asm and eax, 1 \ + \ + __asm exit_rel: \ + __asm mov Pnd, al \ +} + +#endif /* __ACWIN_H__ */ diff --git a/sys/contrib/dev/acpica/include/platform/acwin64.h b/sys/contrib/dev/acpica/include/platform/acwin64.h new file mode 100644 index 000000000000..faec855e22d8 --- /dev/null +++ b/sys/contrib/dev/acpica/include/platform/acwin64.h @@ -0,0 +1,155 @@ +/****************************************************************************** + * + * Name: acwin.h - OS specific defines, etc. + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2009, 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 __ACWIN64_H__ +#define __ACWIN64_H__ + +/*! [Begin] no source code translation (Keep the include) */ + +#include "acintel.h" +/*! [End] no source code translation !*/ + +#define ACPI_MACHINE_WIDTH 64 + +#define ACPI_USE_STANDARD_HEADERS + +/* + * Handle platform- and compiler-specific assembly language differences. + * + * Notes: + * 1) Interrupt 3 is used to break into a debugger + * 2) Interrupts are turned off during ACPI register setup + */ + +/*! [Begin] no source code translation */ + +#define ACPI_FLUSH_CPU_CACHE() + +/* + * For Acpi applications, we don't want to try to access the global lock + */ +#ifdef ACPI_APPLICATION +#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) if (AcpiGbl_GlobalLockPresent) {Acq = 0xFF;} else {Acq = 0;} +#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Pnd) if (AcpiGbl_GlobalLockPresent) {Pnd = 0xFF;} else {Pnd = 0;} +#else + +#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) + +#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Pnd) + +#endif + + +#endif /* __ACWIN_H__ */ diff --git a/sys/contrib/dev/acpica/nsaccess.c b/sys/contrib/dev/acpica/namespace/nsaccess.c index d1b4f734d9dd..172b26d3abcd 100644 --- a/sys/contrib/dev/acpica/nsaccess.c +++ b/sys/contrib/dev/acpica/namespace/nsaccess.c @@ -1,7 +1,6 @@ /******************************************************************************* * * Module Name: nsaccess - Top-level functions for accessing ACPI namespace - * $Revision: 1.206 $ * ******************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,10 +115,11 @@ #define __NSACCESS_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/amlcode.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/acdispat.h> +#include "acpi.h" +#include "accommon.h" +#include "amlcode.h" +#include "acnamesp.h" +#include "acdispat.h" #define _COMPONENT ACPI_NAMESPACE @@ -202,9 +202,8 @@ AcpiNsRootInitialize ( } /* - * Name entered successfully. - * If entry in PreDefinedNames[] specifies an - * initial value, create the initial value. + * Name entered successfully. If entry in PreDefinedNames[] specifies + * an initial value, create the initial value. */ if (InitVal->Val) { @@ -252,11 +251,8 @@ AcpiNsRootInitialize ( /* Mark this as a very SPECIAL method */ ObjDesc->Method.MethodFlags = AML_METHOD_INTERNAL_ONLY; - -#ifndef ACPI_DUMP_APP ObjDesc->Method.Implementation = AcpiUtOsiImplementation; #endif -#endif break; case ACPI_TYPE_INTEGER: @@ -267,9 +263,8 @@ AcpiNsRootInitialize ( case ACPI_TYPE_STRING: - /* - * Build an object around the static string - */ + /* Build an object around the static string */ + ObjDesc->String.Length = (UINT32) ACPI_STRLEN (Val); ObjDesc->String.Pointer = Val; ObjDesc->Common.Flags |= AOPOBJ_STATIC_POINTER; @@ -321,7 +316,7 @@ AcpiNsRootInitialize ( /* Store pointer to value descriptor in the Node */ Status = AcpiNsAttachObject (NewNode, ObjDesc, - ACPI_GET_OBJECT_TYPE (ObjDesc)); + ObjDesc->Common.Type); /* Remove local reference to the object */ @@ -409,10 +404,8 @@ AcpiNsLookup ( return_ACPI_STATUS (AE_NO_NAMESPACE); } - /* - * Get the prefix scope. - * A null scope means use the root scope - */ + /* Get the prefix scope. A null scope means use the root scope */ + if ((!ScopeInfo) || (!ScopeInfo->Scope.Node)) { @@ -436,8 +429,8 @@ AcpiNsLookup ( { /* * This node might not be a actual "scope" node (such as a - * Device/Method, etc.) It could be a Package or other object node. - * Backup up the tree to find the containing scope node. + * Device/Method, etc.) It could be a Package or other object + * node. Backup up the tree to find the containing scope node. */ while (!AcpiNsOpensScope (PrefixNode->Type) && PrefixNode->Type != ACPI_TYPE_ANY) @@ -447,7 +440,7 @@ AcpiNsLookup ( } } - /* Save type TBD: may be no longer necessary */ + /* Save type. TBD: may be no longer necessary */ TypeToCheckFor = Type; @@ -513,6 +506,7 @@ AcpiNsLookup ( /* Name is fully qualified, no search rules apply */ SearchParentFlag = ACPI_NS_NO_UPSEARCH; + /* * Point past this prefix to the name segment * part or the next Parent Prefix @@ -528,7 +522,8 @@ AcpiNsLookup ( /* Current scope has no parent scope */ ACPI_ERROR ((AE_INFO, - "ACPI path has too many parent prefixes (^) - reached beyond root node")); + "ACPI path has too many parent prefixes (^) " + "- reached beyond root node")); return_ACPI_STATUS (AE_NOT_FOUND); } } @@ -618,11 +613,11 @@ AcpiNsLookup ( /* - * Search namespace for each segment of the name. Loop through and + * Search namespace for each segment of the name. Loop through and * verify (or add to the namespace) each name segment. * * The object type is significant only at the last name - * segment. (We don't care about the types along the path, only + * segment. (We don't care about the types along the path, only * the type of the final target object.) */ ThisSearchType = ACPI_TYPE_ANY; @@ -632,9 +627,8 @@ AcpiNsLookup ( NumSegments--; if (!NumSegments) { - /* - * This is the last segment, enable typechecking - */ + /* This is the last segment, enable typechecking */ + ThisSearchType = Type; /* @@ -679,44 +673,73 @@ AcpiNsLookup ( return_ACPI_STATUS (Status); } - /* - * Sanity typecheck of the target object: - * - * If 1) This is the last segment (NumSegments == 0) - * 2) And we are looking for a specific type - * (Not checking for TYPE_ANY) - * 3) Which is not an alias - * 4) Which is not a local type (TYPE_SCOPE) - * 5) And the type of target object is known (not TYPE_ANY) - * 6) And target object does not match what we are looking for - * - * Then we have a type mismatch. Just warn and ignore it. - */ - if ((NumSegments == 0) && - (TypeToCheckFor != ACPI_TYPE_ANY) && - (TypeToCheckFor != ACPI_TYPE_LOCAL_ALIAS) && - (TypeToCheckFor != ACPI_TYPE_LOCAL_METHOD_ALIAS) && - (TypeToCheckFor != ACPI_TYPE_LOCAL_SCOPE) && - (ThisNode->Type != ACPI_TYPE_ANY) && - (ThisNode->Type != TypeToCheckFor)) + /* More segments to follow? */ + + if (NumSegments > 0) { - /* Complain about a type mismatch */ + /* + * If we have an alias to an object that opens a scope (such as a + * device or processor), we need to dereference the alias here so + * that we can access any children of the original node (via the + * remaining segments). + */ + if (ThisNode->Type == ACPI_TYPE_LOCAL_ALIAS) + { + if (!ThisNode->Object) + { + return_ACPI_STATUS (AE_NOT_EXIST); + } - ACPI_WARNING ((AE_INFO, - "NsLookup: Type mismatch on %4.4s (%s), searching for (%s)", - ACPI_CAST_PTR (char, &SimpleName), - AcpiUtGetTypeName (ThisNode->Type), - AcpiUtGetTypeName (TypeToCheckFor))); + if (AcpiNsOpensScope (((ACPI_NAMESPACE_NODE *) + ThisNode->Object)->Type)) + { + ThisNode = (ACPI_NAMESPACE_NODE *) ThisNode->Object; + } + } } - /* - * If this is the last name segment and we are not looking for a - * specific type, but the type of found object is known, use that type - * to see if it opens a scope. - */ - if ((NumSegments == 0) && (Type == ACPI_TYPE_ANY)) + /* Special handling for the last segment (NumSegments == 0) */ + + else { - Type = ThisNode->Type; + /* + * Sanity typecheck of the target object: + * + * If 1) This is the last segment (NumSegments == 0) + * 2) And we are looking for a specific type + * (Not checking for TYPE_ANY) + * 3) Which is not an alias + * 4) Which is not a local type (TYPE_SCOPE) + * 5) And the type of target object is known (not TYPE_ANY) + * 6) And target object does not match what we are looking for + * + * Then we have a type mismatch. Just warn and ignore it. + */ + if ((TypeToCheckFor != ACPI_TYPE_ANY) && + (TypeToCheckFor != ACPI_TYPE_LOCAL_ALIAS) && + (TypeToCheckFor != ACPI_TYPE_LOCAL_METHOD_ALIAS) && + (TypeToCheckFor != ACPI_TYPE_LOCAL_SCOPE) && + (ThisNode->Type != ACPI_TYPE_ANY) && + (ThisNode->Type != TypeToCheckFor)) + { + /* Complain about a type mismatch */ + + ACPI_WARNING ((AE_INFO, + "NsLookup: Type mismatch on %4.4s (%s), searching for (%s)", + ACPI_CAST_PTR (char, &SimpleName), + AcpiUtGetTypeName (ThisNode->Type), + AcpiUtGetTypeName (TypeToCheckFor))); + } + + /* + * If this is the last name segment and we are not looking for a + * specific type, but the type of found object is known, use that + * type to (later) see if it opens a scope. + */ + if (Type == ACPI_TYPE_ANY) + { + Type = ThisNode->Type; + } } /* Point to next name segment and make this node current */ @@ -725,9 +748,8 @@ AcpiNsLookup ( CurrentNode = ThisNode; } - /* - * Always check if we need to open a new scope - */ + /* Always check if we need to open a new scope */ + if (!(Flags & ACPI_NS_DONT_OPEN_SCOPE) && (WalkState)) { /* diff --git a/sys/contrib/dev/acpica/nsalloc.c b/sys/contrib/dev/acpica/namespace/nsalloc.c index e6ecf5a40289..c3113b6cb3d4 100644 --- a/sys/contrib/dev/acpica/nsalloc.c +++ b/sys/contrib/dev/acpica/namespace/nsalloc.c @@ -1,7 +1,6 @@ /******************************************************************************* * * Module Name: nsalloc - Namespace allocation and deletion utilities - * $Revision: 1.108 $ * ******************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,8 +116,9 @@ #define __NSALLOC_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acnamesp.h> +#include "acpi.h" +#include "accommon.h" +#include "acnamesp.h" #define _COMPONENT ACPI_NAMESPACE @@ -159,7 +159,8 @@ AcpiNsCreateNode ( ACPI_MEM_TRACKING (AcpiGbl_NsNodeList->TotalAllocated++); #ifdef ACPI_DBG_TRACK_ALLOCATIONS - Temp = AcpiGbl_NsNodeList->TotalAllocated - AcpiGbl_NsNodeList->TotalFreed; + Temp = AcpiGbl_NsNodeList->TotalAllocated - + AcpiGbl_NsNodeList->TotalFreed; if (Temp > AcpiGbl_NsNodeList->MaxOccupied) { AcpiGbl_NsNodeList->MaxOccupied = Temp; @@ -238,9 +239,8 @@ AcpiNsDeleteNode ( ACPI_MEM_TRACKING (AcpiGbl_NsNodeList->TotalFreed++); - /* - * Detach an object if there is one, then delete the node - */ + /* Detach an object if there is one, then delete the node */ + AcpiNsDetachObject (Node); (void) AcpiOsReleaseObject (AcpiGbl_NamespaceCache, Node); return_VOID; @@ -282,9 +282,8 @@ AcpiNsInstallNode ( /* - * Get the owner ID from the Walk state - * The owner ID is used to track table deletion and - * deletion of objects created by methods + * Get the owner ID from the Walk state. The owner ID is used to track + * table deletion and deletion of objects created by methods. */ if (WalkState) { @@ -369,9 +368,8 @@ AcpiNsDeleteChildren ( return_VOID; } - /* - * Deallocate all children at this level - */ + /* Deallocate all children at this level */ + do { /* Get the things we need */ @@ -394,9 +392,8 @@ AcpiNsDeleteChildren ( 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 - */ + /* Detach an object if there is one, then free the child node */ + AcpiNsDetachObject (ChildNode); /* Now we can delete the node */ @@ -409,11 +406,9 @@ AcpiNsDeleteChildren ( } while (!(Flags & ANOBJ_END_OF_PEER_LIST)); - /* Clear the parent's child pointer */ ParentNode->Child = NULL; - return_VOID; } @@ -455,7 +450,7 @@ AcpiNsDeleteNamespaceSubtree ( { /* Get the next node in this scope (NULL if none) */ - ChildNode = AcpiNsGetNextNode (ACPI_TYPE_ANY, ParentNode, ChildNode); + ChildNode = AcpiNsGetNextNode (ParentNode, ChildNode); if (ChildNode) { /* Found a child node - detach any attached object */ @@ -464,7 +459,7 @@ AcpiNsDeleteNamespaceSubtree ( /* Check if this node has any children */ - if (AcpiNsGetNextNode (ACPI_TYPE_ANY, ChildNode, NULL)) + if (ChildNode->Child) { /* * There is at least one child of this node, @@ -561,7 +556,7 @@ AcpiNsDeleteNamespaceByOwner ( * Get the next child of this parent node. When ChildNode is NULL, * the first child of the parent is returned */ - ChildNode = AcpiNsGetNextNode (ACPI_TYPE_ANY, ParentNode, ChildNode); + ChildNode = AcpiNsGetNextNode (ParentNode, ChildNode); if (DeletionNode) { @@ -581,7 +576,7 @@ AcpiNsDeleteNamespaceByOwner ( /* Check if this node has any children */ - if (AcpiNsGetNextNode (ACPI_TYPE_ANY, ChildNode, NULL)) + if (ChildNode->Child) { /* * There is at least one child of this node, diff --git a/sys/contrib/dev/acpica/nsdump.c b/sys/contrib/dev/acpica/namespace/nsdump.c index 7c2028a2fb3e..762437aa1286 100644 --- a/sys/contrib/dev/acpica/nsdump.c +++ b/sys/contrib/dev/acpica/namespace/nsdump.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: nsdump - table dumping routines for debug - * $Revision: 1.182 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,9 +116,9 @@ #define __NSDUMP_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/acparser.h> +#include "acpi.h" +#include "accommon.h" +#include "acnamesp.h" #define _COMPONENT ACPI_NAMESPACE @@ -160,7 +159,7 @@ AcpiNsPrintPathname ( UINT32 NumSegments, char *Pathname) { - ACPI_NATIVE_UINT i; + UINT32 i; ACPI_FUNCTION_NAME (NsPrintPathname); @@ -288,6 +287,13 @@ AcpiNsDumpOneObject ( } ThisNode = AcpiNsMapHandleToNode (ObjHandle); + if (!ThisNode) + { + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Invalid object handle %p\n", + ObjHandle)); + return (AE_OK); + } + Type = ThisNode->Type; /* Check if the owner matches */ @@ -311,20 +317,11 @@ AcpiNsDumpOneObject ( ACPI_WARNING ((AE_INFO, "Invalid ACPI Object Type %08X", Type)); } - if (!AcpiUtValidAcpiName (ThisNode->Name.Integer)) - { - ThisNode->Name.Integer = AcpiUtRepairName (ThisNode->Name.Ascii); - - ACPI_WARNING ((AE_INFO, "Invalid ACPI Name %08X", - ThisNode->Name.Integer)); - } - AcpiOsPrintf ("%4.4s", AcpiUtGetNodeName (ThisNode)); } - /* - * Now we can print out the pertinent information - */ + /* Now we can print out the pertinent information */ + AcpiOsPrintf (" %-12s %p %2.2X ", AcpiUtGetTypeName (Type), ThisNode, ThisNode->OwnerId); @@ -358,7 +355,7 @@ AcpiNsDumpOneObject ( AcpiOsPrintf ("ID %X Len %.4X Addr %p\n", ObjDesc->Processor.ProcId, ObjDesc->Processor.Length, - (char *) ObjDesc->Processor.Address); + ACPI_CAST_PTR (void, ObjDesc->Processor.Address)); break; @@ -438,7 +435,7 @@ AcpiNsDumpOneObject ( if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID) { AcpiOsPrintf (" Addr %8.8X%8.8X Len %.4X\n", - ACPI_FORMAT_UINT64 (ObjDesc->Region.Address), + ACPI_FORMAT_NATIVE_UINT (ObjDesc->Region.Address), ObjDesc->Region.Length); } else @@ -450,8 +447,7 @@ AcpiNsDumpOneObject ( case ACPI_TYPE_LOCAL_REFERENCE: - AcpiOsPrintf ("[%s]\n", - AcpiPsGetOpcodeName (ObjDesc->Reference.Opcode)); + AcpiOsPrintf ("[%s]\n", AcpiUtGetReferenceName (ObjDesc)); break; @@ -461,7 +457,8 @@ AcpiNsDumpOneObject ( ObjDesc->BufferField.BufferObj->Buffer.Node) { AcpiOsPrintf ("Buf [%4.4s]", - AcpiUtGetNodeName (ObjDesc->BufferField.BufferObj->Buffer.Node)); + AcpiUtGetNodeName ( + ObjDesc->BufferField.BufferObj->Buffer.Node)); } break; @@ -469,23 +466,28 @@ AcpiNsDumpOneObject ( case ACPI_TYPE_LOCAL_REGION_FIELD: AcpiOsPrintf ("Rgn [%4.4s]", - AcpiUtGetNodeName (ObjDesc->CommonField.RegionObj->Region.Node)); + AcpiUtGetNodeName ( + ObjDesc->CommonField.RegionObj->Region.Node)); break; case ACPI_TYPE_LOCAL_BANK_FIELD: AcpiOsPrintf ("Rgn [%4.4s] Bnk [%4.4s]", - AcpiUtGetNodeName (ObjDesc->CommonField.RegionObj->Region.Node), - AcpiUtGetNodeName (ObjDesc->BankField.BankObj->CommonField.Node)); + AcpiUtGetNodeName ( + ObjDesc->CommonField.RegionObj->Region.Node), + AcpiUtGetNodeName ( + ObjDesc->BankField.BankObj->CommonField.Node)); break; case ACPI_TYPE_LOCAL_INDEX_FIELD: AcpiOsPrintf ("Idx [%4.4s] Dat [%4.4s]", - AcpiUtGetNodeName (ObjDesc->IndexField.IndexObj->CommonField.Node), - AcpiUtGetNodeName (ObjDesc->IndexField.DataObj->CommonField.Node)); + AcpiUtGetNodeName ( + ObjDesc->IndexField.IndexObj->CommonField.Node), + AcpiUtGetNodeName ( + ObjDesc->IndexField.DataObj->CommonField.Node)); break; @@ -544,25 +546,25 @@ AcpiNsDumpOneObject ( /* Name is a Method and its AML offset/length are set */ AcpiOsPrintf (" M:%p-%X\n", ObjDesc->Method.AmlStart, - ObjDesc->Method.AmlLength); + ObjDesc->Method.AmlLength); break; case ACPI_TYPE_INTEGER: AcpiOsPrintf (" I:%8.8X8.8%X\n", - ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); + ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); break; case ACPI_TYPE_STRING: AcpiOsPrintf (" S:%p-%X\n", ObjDesc->String.Pointer, - ObjDesc->String.Length); + ObjDesc->String.Length); break; case ACPI_TYPE_BUFFER: AcpiOsPrintf (" B:%p-%X\n", ObjDesc->Buffer.Pointer, - ObjDesc->Buffer.Length); + ObjDesc->Buffer.Length); break; default: @@ -585,7 +587,6 @@ AcpiNsDumpOneObject ( return (AE_OK); } - /* If there is an attached object, display it */ DbgLevel = AcpiDbgLevel; @@ -613,17 +614,17 @@ AcpiNsDumpOneObject ( case ACPI_DESC_TYPE_OPERAND: - ObjType = ACPI_GET_OBJECT_TYPE (ObjDesc); + ObjType = ObjDesc->Common.Type; if (ObjType > ACPI_TYPE_LOCAL_MAX) { - AcpiOsPrintf ("(Ptr to ACPI Object type %X [UNKNOWN])\n", + AcpiOsPrintf ("(Pointer to ACPI Object type %.2X [UNKNOWN])\n", ObjType); BytesToDump = 32; } else { - AcpiOsPrintf ("(Ptr to ACPI Object type %X [%s])\n", + AcpiOsPrintf ("(Pointer to ACPI Object type %.2X [%s])\n", ObjType, AcpiUtGetTypeName (ObjType)); BytesToDump = sizeof (ACPI_OPERAND_OBJECT); } @@ -643,9 +644,8 @@ AcpiNsDumpOneObject ( goto Cleanup; } - /* - * Valid object, get the pointer to next level, if any - */ + /* Valid object, get the pointer to next level, if any */ + switch (ObjType) { case ACPI_TYPE_BUFFER: @@ -705,14 +705,14 @@ Cleanup: * DisplayType - 0 or ACPI_DISPLAY_SUMMARY * MaxDepth - Maximum depth of dump. Use ACPI_UINT32_MAX * for an effectively unlimited depth. - * OwnerId - Dump only objects owned by this ID. Use + * OwnerId - Dump only objects owned by this ID. Use * ACPI_UINT32_MAX to match all owners. * StartHandle - Where in namespace to start/end search * * RETURN: None * - * DESCRIPTION: Dump typed objects within the loaded namespace. - * Uses AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObject. + * DESCRIPTION: Dump typed objects within the loaded namespace. Uses + * AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObject. * ******************************************************************************/ diff --git a/sys/contrib/dev/acpica/nsdumpdv.c b/sys/contrib/dev/acpica/namespace/nsdumpdv.c index 91c6b542f126..a2456b24291c 100644 --- a/sys/contrib/dev/acpica/nsdumpdv.c +++ b/sys/contrib/dev/acpica/namespace/nsdumpdv.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: nsdump - table dumping routines for debug - * $Revision: 1.20 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,7 +116,7 @@ #define __NSDUMPDV_C__ -#include <contrib/dev/acpica/acpi.h> +#include "acpi.h" /* TBD: This entire module is apparently obsolete and should be removed */ @@ -128,7 +127,7 @@ #ifdef ACPI_OBSOLETE_FUNCTIONS #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) -#include <contrib/dev/acpica/acnamesp.h> +#include "acnamesp.h" /******************************************************************************* * diff --git a/sys/contrib/dev/acpica/nseval.c b/sys/contrib/dev/acpica/namespace/nseval.c index c44af2d904e8..9b31a550a6ce 100644 --- a/sys/contrib/dev/acpica/nseval.c +++ b/sys/contrib/dev/acpica/namespace/nseval.c @@ -1,7 +1,6 @@ /******************************************************************************* * * Module Name: nseval - Object evaluation, includes control method execution - * $Revision: 1.144 $ * ******************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,10 +116,11 @@ #define __NSEVAL_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acparser.h> -#include <contrib/dev/acpica/acinterp.h> -#include <contrib/dev/acpica/acnamesp.h> +#include "acpi.h" +#include "accommon.h" +#include "acparser.h" +#include "acinterp.h" +#include "acnamesp.h" #define _COMPONENT ACPI_NAMESPACE @@ -159,6 +159,7 @@ AcpiNsEvaluate ( ACPI_EVALUATE_INFO *Info) { ACPI_STATUS Status; + ACPI_NAMESPACE_NODE *Node; ACPI_FUNCTION_TRACE (NsEvaluate); @@ -172,6 +173,7 @@ AcpiNsEvaluate ( /* Initialize the return value to an invalid object */ Info->ReturnObject = NULL; + Info->ParamCount = 0; /* * Get the actual namespace node for the target object. Handles these cases: @@ -200,6 +202,8 @@ AcpiNsEvaluate ( ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n", Info->Pathname, Info->ResolvedNode, AcpiNsGetAttachedObject (Info->ResolvedNode))); + Node = Info->ResolvedNode; + /* * Two major cases here: * @@ -221,7 +225,21 @@ AcpiNsEvaluate ( return_ACPI_STATUS (AE_NULL_OBJECT); } - ACPI_DUMP_PATHNAME (Info->ResolvedNode, "Execute Method:", + /* Count the number of arguments being passed to the method */ + + if (Info->Parameters) + { + while (Info->Parameters[Info->ParamCount]) + { + if (Info->ParamCount > ACPI_METHOD_MAX_ARG) + { + return_ACPI_STATUS (AE_LIMIT); + } + Info->ParamCount++; + } + } + + ACPI_DUMP_PATHNAME (Info->ResolvedNode, "ACPI: Execute Method", ACPI_LV_INFO, _COMPONENT); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, @@ -245,7 +263,28 @@ AcpiNsEvaluate ( { /* * 2) Object is not a method, return its current value + * + * Disallow certain object types. For these, "evaluation" is undefined. */ + switch (Info->ResolvedNode->Type) + { + case ACPI_TYPE_DEVICE: + case ACPI_TYPE_EVENT: + case ACPI_TYPE_MUTEX: + case ACPI_TYPE_REGION: + case ACPI_TYPE_THERMAL: + case ACPI_TYPE_LOCAL_SCOPE: + + ACPI_ERROR ((AE_INFO, + "[%4.4s] Evaluation of object type [%s] is not supported", + Info->ResolvedNode->Name.Ascii, + AcpiUtGetTypeName (Info->ResolvedNode->Type))); + + return_ACPI_STATUS (AE_TYPE); + + default: + break; + } /* * Objects require additional resolution steps (e.g., the Node may be @@ -287,8 +326,15 @@ AcpiNsEvaluate ( } /* - * Check if there is a return value that must be dealt with + * Check input argument count against the ASL-defined count for a method. + * Also check predefined names: argument count and return value against + * the ACPI specification. Some incorrect return value types are repaired. */ + (void) AcpiNsCheckPredefinedNames (Node, Info->ParamCount, + Status, &Info->ReturnObject); + + /* Check if there is a return value that must be dealt with */ + if (Status == AE_CTRL_RETURN_VALUE) { /* If caller does not want the return value, delete it */ diff --git a/sys/contrib/dev/acpica/nsinit.c b/sys/contrib/dev/acpica/namespace/nsinit.c index e06ccf75eb7f..c4cd6a62edb4 100644 --- a/sys/contrib/dev/acpica/nsinit.c +++ b/sys/contrib/dev/acpica/namespace/nsinit.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: nsinit - namespace initialization - * $Revision: 1.86 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,10 +116,11 @@ #define __NSXFINIT_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/acdispat.h> -#include <contrib/dev/acpica/acinterp.h> +#include "acpi.h" +#include "accommon.h" +#include "acnamesp.h" +#include "acdispat.h" +#include "acinterp.h" #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME ("nsinit") @@ -193,7 +193,8 @@ AcpiNsInitializeObjects ( } ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, - "\nInitialized %hd/%hd Regions %hd/%hd Fields %hd/%hd Buffers %hd/%hd Packages (%hd nodes)\n", + "\nInitialized %hd/%hd Regions %hd/%hd Fields %hd/%hd " + "Buffers %hd/%hd Packages (%hd nodes)\n", Info.OpRegionInit, Info.OpRegionCount, Info.FieldInit, Info.FieldCount, Info.BufferInit, Info.BufferCount, @@ -242,7 +243,8 @@ AcpiNsInitializeDevices ( Info.Num_INI = 0; ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, - "Initializing Device/Processor/Thermal objects by executing _INI methods:")); + "Initializing Device/Processor/Thermal objects " + "by executing _INI methods:")); /* Tree analysis: find all subtrees that contain _INI methods */ @@ -274,7 +276,8 @@ AcpiNsInitializeDevices ( } ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, - "\nExecuted %hd _INI methods requiring %hd _STA executions (examined %hd objects)\n", + "\nExecuted %hd _INI methods requiring %hd _STA executions " + "(examined %hd objects)\n", Info.Num_INI, Info.Num_STA, Info.DeviceCount)); return_ACPI_STATUS (Status); @@ -346,6 +349,10 @@ AcpiNsInitOneObject ( Info->FieldCount++; break; + case ACPI_TYPE_LOCAL_BANK_FIELD: + Info->FieldCount++; + break; + case ACPI_TYPE_BUFFER: Info->BufferCount++; break; @@ -360,17 +367,15 @@ AcpiNsInitOneObject ( return (AE_OK); } - /* - * If the object is already initialized, nothing else to do - */ + /* If the object is already initialized, nothing else to do */ + if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) { return (AE_OK); } - /* - * Must lock the interpreter before executing AML code - */ + /* Must lock the interpreter before executing AML code */ + AcpiExEnterInterpreter (); /* @@ -391,6 +396,12 @@ AcpiNsInitOneObject ( Status = AcpiDsGetBufferFieldArguments (ObjDesc); break; + case ACPI_TYPE_LOCAL_BANK_FIELD: + + Info->FieldInit++; + Status = AcpiDsGetBankFieldArguments (ObjDesc); + break; + case ACPI_TYPE_BUFFER: Info->BufferInit++; @@ -656,7 +667,6 @@ AcpiNsInitOneDevice ( Info->PrefixNode = DeviceNode; Info->Pathname = METHOD_NAME__INI; Info->Parameters = NULL; - Info->ParameterType = ACPI_PARAM_ARGS; Info->Flags = ACPI_IGNORE_RETURN_VALUE; Status = AcpiNsEvaluate (Info); diff --git a/sys/contrib/dev/acpica/nsload.c b/sys/contrib/dev/acpica/namespace/nsload.c index 07dd567448a1..10eff45cb36f 100644 --- a/sys/contrib/dev/acpica/nsload.c +++ b/sys/contrib/dev/acpica/namespace/nsload.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: nsload - namespace loading/expanding/contracting procedures - * $Revision: 1.80 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,10 +115,11 @@ #define __NSLOAD_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/acdispat.h> -#include <contrib/dev/acpica/actables.h> +#include "acpi.h" +#include "accommon.h" +#include "acnamesp.h" +#include "acdispat.h" +#include "actables.h" #define _COMPONENT ACPI_NAMESPACE @@ -154,7 +154,7 @@ AcpiNsDeleteSubtree ( ACPI_STATUS AcpiNsLoadTable ( - ACPI_NATIVE_UINT TableIndex, + UINT32 TableIndex, ACPI_NAMESPACE_NODE *Node) { ACPI_STATUS Status; @@ -195,14 +195,14 @@ AcpiNsLoadTable ( goto Unlock; } - Status = AcpiNsParseTable (TableIndex, Node->Child); + Status = AcpiNsParseTable (TableIndex, Node); if (ACPI_SUCCESS (Status)) { AcpiTbSetTableLoadedFlag (TableIndex, TRUE); } else { - AcpiTbReleaseOwnerId (TableIndex); + (void) AcpiTbReleaseOwnerId (TableIndex); } Unlock: @@ -220,12 +220,12 @@ Unlock: * parse trees. */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "**** Begin Table Method Parsing and Object Initialization ****\n")); + "**** Begin Table Method Parsing and Object Initialization\n")); Status = AcpiDsInitializeObjects (TableIndex, Node); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "**** Completed Table Method Parsing and Object Initialization ****\n")); + "**** Completed Table Method Parsing and Object Initialization\n")); return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/nsnames.c b/sys/contrib/dev/acpica/namespace/nsnames.c index 8ff7aafc51f4..0dd148fa7ca1 100644 --- a/sys/contrib/dev/acpica/nsnames.c +++ b/sys/contrib/dev/acpica/namespace/nsnames.c @@ -1,7 +1,6 @@ /******************************************************************************* * * Module Name: nsnames - Name manipulation and search - * $Revision: 1.98 $ * ******************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,9 +115,10 @@ #define __NSNAMES_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/amlcode.h> -#include <contrib/dev/acpica/acnamesp.h> +#include "acpi.h" +#include "accommon.h" +#include "amlcode.h" +#include "acnamesp.h" #define _COMPONENT ACPI_NAMESPACE @@ -133,14 +133,15 @@ * Size - Size of the pathname * *NameBuffer - Where to return the pathname * - * RETURN: Places the pathname into the NameBuffer, in external format + * RETURN: Status + * Places the pathname into the NameBuffer, in external format * (name segments separated by path separators) * * DESCRIPTION: Generate a full pathaname * ******************************************************************************/ -void +ACPI_STATUS AcpiNsBuildExternalPath ( ACPI_NAMESPACE_NODE *Node, ACPI_SIZE Size, @@ -160,7 +161,7 @@ AcpiNsBuildExternalPath ( { NameBuffer[0] = AML_ROOT_PREFIX; NameBuffer[1] = 0; - return; + return (AE_OK); } /* Store terminator byte, then build name backwards */ @@ -190,15 +191,16 @@ AcpiNsBuildExternalPath ( if (Index != 0) { ACPI_ERROR ((AE_INFO, - "Could not construct pathname; index=%X, size=%X, Path=%s", + "Could not construct external pathname; index=%X, size=%X, Path=%s", (UINT32) Index, (UINT32) Size, &NameBuffer[Size])); + + return (AE_BAD_PARAMETER); } - return; + return (AE_OK); } -#ifdef ACPI_DEBUG_OUTPUT /******************************************************************************* * * FUNCTION: AcpiNsGetExternalPathname @@ -209,7 +211,8 @@ AcpiNsBuildExternalPath ( * the node, In external format (name segments separated by path * separators.) * - * DESCRIPTION: Used for debug printing in AcpiNsSearchTable(). + * DESCRIPTION: Used to obtain the full pathname to a namespace node, usually + * for error and debug statements. * ******************************************************************************/ @@ -217,6 +220,7 @@ char * AcpiNsGetExternalPathname ( ACPI_NAMESPACE_NODE *Node) { + ACPI_STATUS Status; char *NameBuffer; ACPI_SIZE Size; @@ -227,22 +231,31 @@ AcpiNsGetExternalPathname ( /* Calculate required buffer size based on depth below root */ Size = AcpiNsGetPathnameLength (Node); + if (!Size) + { + return_PTR (NULL); + } /* Allocate a buffer to be returned to caller */ NameBuffer = ACPI_ALLOCATE_ZEROED (Size); if (!NameBuffer) { - ACPI_ERROR ((AE_INFO, "Allocation failure")); + ACPI_ERROR ((AE_INFO, "Could not allocate %u bytes", (UINT32) Size)); return_PTR (NULL); } /* Build the path in the allocated buffer */ - AcpiNsBuildExternalPath (Node, Size, NameBuffer); + Status = AcpiNsBuildExternalPath (Node, Size, NameBuffer); + if (ACPI_FAILURE (Status)) + { + ACPI_FREE (NameBuffer); + return_PTR (NULL); + } + return_PTR (NameBuffer); } -#endif /******************************************************************************* @@ -277,13 +290,20 @@ AcpiNsGetPathnameLength ( while (NextNode && (NextNode != AcpiGbl_RootNode)) { + if (ACPI_GET_DESCRIPTOR_TYPE (NextNode) != ACPI_DESC_TYPE_NAMED) + { + ACPI_ERROR ((AE_INFO, + "Invalid Namespace Node (%p) while traversing namespace", + NextNode)); + return 0; + } Size += ACPI_PATH_SEGMENT_LENGTH; NextNode = AcpiNsGetParentNode (NextNode); } if (!Size) { - Size = 1; /* Root node case */ + Size = 1; /* Root node case */ } return (Size + 1); /* +1 for null string terminator */ @@ -326,6 +346,10 @@ AcpiNsHandleToPathname ( /* Determine size required for the caller buffer */ RequiredSize = AcpiNsGetPathnameLength (Node); + if (!RequiredSize) + { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } /* Validate/Allocate/Clear caller buffer */ @@ -337,7 +361,11 @@ AcpiNsHandleToPathname ( /* Build the path in the caller buffer */ - AcpiNsBuildExternalPath (Node, RequiredSize, Buffer->Pointer); + Status = AcpiNsBuildExternalPath (Node, RequiredSize, Buffer->Pointer); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s [%X]\n", (char *) Buffer->Pointer, (UINT32) RequiredSize)); diff --git a/sys/contrib/dev/acpica/nsobject.c b/sys/contrib/dev/acpica/namespace/nsobject.c index 622638c1b619..c0163f4ea244 100644 --- a/sys/contrib/dev/acpica/nsobject.c +++ b/sys/contrib/dev/acpica/namespace/nsobject.c @@ -2,7 +2,6 @@ * * Module Name: nsobject - Utilities for objects attached to namespace * table entries - * $Revision: 1.98 $ * ******************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -118,8 +117,9 @@ #define __NSOBJECT_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acnamesp.h> +#include "acpi.h" +#include "accommon.h" +#include "acnamesp.h" #define _COMPONENT ACPI_NAMESPACE @@ -304,11 +304,21 @@ AcpiNsDetachObject ( ObjDesc = Node->Object; if (!ObjDesc || - (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_LOCAL_DATA)) + (ObjDesc->Common.Type == ACPI_TYPE_LOCAL_DATA)) { return_VOID; } + if (Node->Flags & ANOBJ_ALLOCATED_BUFFER) + { + /* Free the dynamic aml buffer */ + + if (ObjDesc->Common.Type == ACPI_TYPE_METHOD) + { + ACPI_FREE (ObjDesc->Method.AmlStart); + } + } + /* Clear the entry in all cases */ Node->Object = NULL; @@ -316,7 +326,7 @@ AcpiNsDetachObject ( { Node->Object = ObjDesc->Common.NextObject; if (Node->Object && - (ACPI_GET_OBJECT_TYPE (Node->Object) != ACPI_TYPE_LOCAL_DATA)) + ((Node->Object)->Common.Type != ACPI_TYPE_LOCAL_DATA)) { Node->Object = Node->Object->Common.NextObject; } @@ -365,7 +375,7 @@ AcpiNsGetAttachedObject ( if (!Node->Object || ((ACPI_GET_DESCRIPTOR_TYPE (Node->Object) != ACPI_DESC_TYPE_OPERAND) && (ACPI_GET_DESCRIPTOR_TYPE (Node->Object) != ACPI_DESC_TYPE_NAMED)) || - (ACPI_GET_OBJECT_TYPE (Node->Object) == ACPI_TYPE_LOCAL_DATA)) + ((Node->Object)->Common.Type == ACPI_TYPE_LOCAL_DATA)) { return_PTR (NULL); } @@ -394,10 +404,10 @@ AcpiNsGetSecondaryObject ( ACPI_FUNCTION_TRACE_PTR (NsGetSecondaryObject, ObjDesc); - if ((!ObjDesc) || - (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_LOCAL_DATA) || - (!ObjDesc->Common.NextObject) || - (ACPI_GET_OBJECT_TYPE (ObjDesc->Common.NextObject) == ACPI_TYPE_LOCAL_DATA)) + if ((!ObjDesc) || + (ObjDesc->Common.Type== ACPI_TYPE_LOCAL_DATA) || + (!ObjDesc->Common.NextObject) || + ((ObjDesc->Common.NextObject)->Common.Type == ACPI_TYPE_LOCAL_DATA)) { return_PTR (NULL); } @@ -437,7 +447,7 @@ AcpiNsAttachData ( ObjDesc = Node->Object; while (ObjDesc) { - if ((ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_LOCAL_DATA) && + if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_DATA) && (ObjDesc->Data.Handler == Handler)) { return (AE_ALREADY_EXISTS); @@ -500,7 +510,7 @@ AcpiNsDetachData ( ObjDesc = Node->Object; while (ObjDesc) { - if ((ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_LOCAL_DATA) && + if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_DATA) && (ObjDesc->Data.Handler == Handler)) { if (PrevObjDesc) @@ -551,7 +561,7 @@ AcpiNsGetAttachedData ( ObjDesc = Node->Object; while (ObjDesc) { - if ((ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_LOCAL_DATA) && + if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_DATA) && (ObjDesc->Data.Handler == Handler)) { *Data = ObjDesc->Data.Pointer; diff --git a/sys/contrib/dev/acpica/nsparse.c b/sys/contrib/dev/acpica/namespace/nsparse.c index 8cb17a712517..58301560ae06 100644 --- a/sys/contrib/dev/acpica/nsparse.c +++ b/sys/contrib/dev/acpica/namespace/nsparse.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: nsparse - namespace interface to AML parser - * $Revision: 1.16 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,11 +115,12 @@ #define __NSPARSE_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/acparser.h> -#include <contrib/dev/acpica/acdispat.h> -#include <contrib/dev/acpica/actables.h> +#include "acpi.h" +#include "accommon.h" +#include "acnamesp.h" +#include "acparser.h" +#include "acdispat.h" +#include "actables.h" #define _COMPONENT ACPI_NAMESPACE @@ -142,12 +142,13 @@ ACPI_STATUS AcpiNsOneCompleteParse ( - ACPI_NATIVE_UINT PassNumber, - ACPI_NATIVE_UINT TableIndex) + UINT32 PassNumber, + UINT32 TableIndex, + ACPI_NAMESPACE_NODE *StartNode) { ACPI_PARSE_OBJECT *ParseRoot; ACPI_STATUS Status; - ACPI_NATIVE_UINT AmlLength; + UINT32 AmlLength; UINT8 *AmlStart; ACPI_WALK_STATE *WalkState; ACPI_TABLE_HEADER *Table; @@ -205,16 +206,27 @@ AcpiNsOneCompleteParse ( if (ACPI_FAILURE (Status)) { AcpiDsDeleteWalkState (WalkState); - AcpiPsDeleteParseTree (ParseRoot); - return_ACPI_STATUS (Status); + goto Cleanup; + } + + /* StartNode is the default location to load the table */ + + if (StartNode && StartNode != AcpiGbl_RootNode) + { + Status = AcpiDsScopeStackPush (StartNode, ACPI_TYPE_METHOD, WalkState); + if (ACPI_FAILURE (Status)) + { + AcpiDsDeleteWalkState (WalkState); + goto Cleanup; + } } /* Parse the AML */ - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "*PARSE* pass %lu parse\n", - (unsigned long) PassNumber)); + ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "*PARSE* pass %d parse\n", PassNumber)); Status = AcpiPsParseAml (WalkState); +Cleanup: AcpiPsDeleteParseTree (ParseRoot); return_ACPI_STATUS (Status); } @@ -235,7 +247,7 @@ AcpiNsOneCompleteParse ( ACPI_STATUS AcpiNsParseTable ( - ACPI_NATIVE_UINT TableIndex, + UINT32 TableIndex, ACPI_NAMESPACE_NODE *StartNode) { ACPI_STATUS Status; @@ -255,7 +267,8 @@ AcpiNsParseTable ( * performs another complete parse of the AML. */ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 1\n")); - Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS1, TableIndex); + Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS1, + TableIndex, StartNode); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -271,7 +284,8 @@ AcpiNsParseTable ( * parse objects are all cached. */ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 2\n")); - Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS2, TableIndex); + Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS2, + TableIndex, StartNode); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); diff --git a/sys/contrib/dev/acpica/namespace/nspredef.c b/sys/contrib/dev/acpica/namespace/nspredef.c new file mode 100644 index 000000000000..bfd6d7b4fc3b --- /dev/null +++ b/sys/contrib/dev/acpica/namespace/nspredef.c @@ -0,0 +1,1196 @@ +/****************************************************************************** + * + * Module Name: nspredef - Validation of ACPI predefined methods and objects + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2009, 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 __NSPREDEF_C__ + +#include "acpi.h" +#include "accommon.h" +#include "acnamesp.h" +#include "acpredef.h" + + +#define _COMPONENT ACPI_NAMESPACE + ACPI_MODULE_NAME ("nspredef") + + +/******************************************************************************* + * + * This module validates predefined ACPI objects that appear in the namespace, + * at the time they are evaluated (via AcpiEvaluateObject). The purpose of this + * validation is to detect problems with BIOS-exposed predefined ACPI objects + * before the results are returned to the ACPI-related drivers. + * + * There are several areas that are validated: + * + * 1) The number of input arguments as defined by the method/object in the + * ASL is validated against the ACPI specification. + * 2) The type of the return object (if any) is validated against the ACPI + * specification. + * 3) For returned package objects, the count of package elements is + * validated, as well as the type of each package element. Nested + * packages are supported. + * + * For any problems found, a warning message is issued. + * + ******************************************************************************/ + +/* Local prototypes */ + +static ACPI_STATUS +AcpiNsCheckPackage ( + char *Pathname, + ACPI_OPERAND_OBJECT **ReturnObjectPtr, + const ACPI_PREDEFINED_INFO *Predefined); + +static ACPI_STATUS +AcpiNsCheckPackageElements ( + char *Pathname, + ACPI_OPERAND_OBJECT **Elements, + UINT8 Type1, + UINT32 Count1, + UINT8 Type2, + UINT32 Count2, + UINT32 StartIndex); + +static ACPI_STATUS +AcpiNsCheckObjectType ( + char *Pathname, + ACPI_OPERAND_OBJECT **ReturnObjectPtr, + UINT32 ExpectedBtypes, + UINT32 PackageIndex); + +static ACPI_STATUS +AcpiNsCheckReference ( + char *Pathname, + ACPI_OPERAND_OBJECT *ReturnObject); + +static ACPI_STATUS +AcpiNsRepairObject ( + UINT32 ExpectedBtypes, + UINT32 PackageIndex, + ACPI_OPERAND_OBJECT **ReturnObjectPtr); + +/* + * Names for the types that can be returned by the predefined objects. + * Used for warning messages. Must be in the same order as the ACPI_RTYPEs + */ +static const char *AcpiRtypeNames[] = +{ + "/Integer", + "/String", + "/Buffer", + "/Package", + "/Reference", +}; + +#define ACPI_NOT_PACKAGE ACPI_UINT32_MAX + + +/******************************************************************************* + * + * FUNCTION: AcpiNsCheckPredefinedNames + * + * PARAMETERS: Node - Namespace node for the method/object + * ReturnObjectPtr - Pointer to the object returned from the + * evaluation of a method or object + * + * RETURN: Status + * + * DESCRIPTION: Check an ACPI name for a match in the predefined name list. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiNsCheckPredefinedNames ( + ACPI_NAMESPACE_NODE *Node, + UINT32 UserParamCount, + ACPI_STATUS ReturnStatus, + ACPI_OPERAND_OBJECT **ReturnObjectPtr) +{ + ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr; + ACPI_STATUS Status = AE_OK; + const ACPI_PREDEFINED_INFO *Predefined; + char *Pathname; + + + /* 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 */ + + Pathname = AcpiNsGetExternalPathname (Node); + if (!Pathname) + { + return (AE_OK); /* Could not get pathname, ignore */ + } + + /* + * Check that the parameter count for this method matches the ASL + * definition. For predefined names, ensure that both the caller and + * the method itself are in accordance with the ACPI specification. + */ + AcpiNsCheckParameterCount (Pathname, Node, UserParamCount, Predefined); + + /* If not a predefined name, we cannot validate the return object */ + + 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; + } + + /* + * 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 (Node->Flags & ANOBJ_EVALUATED) + { + goto Exit; + } + + /* 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, + * for both methods and other objects. + * + * Exit now if there is no return object. Warning if one was expected. + */ + if (!ReturnObject) + { + if ((Predefined->Info.ExpectedBtypes) && + (!(Predefined->Info.ExpectedBtypes & ACPI_RTYPE_NONE))) + { + ACPI_ERROR ((AE_INFO, + "%s: Missing expected return value", Pathname)); + + Status = AE_AML_NO_RETURN_VALUE; + } + goto Exit; + } + + /* + * 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 + */ + if (!Predefined->Info.ExpectedBtypes) + { + goto Exit; + } + + /* + * Check that the type of the return object is what is expected for + * this predefined name + */ + Status = AcpiNsCheckObjectType (Pathname, ReturnObjectPtr, + Predefined->Info.ExpectedBtypes, ACPI_NOT_PACKAGE); + if (ACPI_FAILURE (Status)) + { + goto Exit; + } + + /* For returned Package objects, check the type of all sub-objects */ + + if (ReturnObject->Common.Type == ACPI_TYPE_PACKAGE) + { + Status = AcpiNsCheckPackage (Pathname, ReturnObjectPtr, Predefined); + } + +Exit: + ACPI_FREE (Pathname); + return (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiNsCheckParameterCount + * + * PARAMETERS: Pathname - Full pathname to the node (for error msgs) + * Node - Namespace node for the method/object + * UserParamCount - Number of args passed in by the caller + * Predefined - Pointer to entry in predefined name table + * + * RETURN: None + * + * DESCRIPTION: Check that the declared (in ASL/AML) parameter count for a + * predefined name is what is expected (i.e., what is defined in + * the ACPI specification for this predefined name.) + * + ******************************************************************************/ + +void +AcpiNsCheckParameterCount ( + char *Pathname, + ACPI_NAMESPACE_NODE *Node, + UINT32 UserParamCount, + const ACPI_PREDEFINED_INFO *Predefined) +{ + UINT32 ParamCount; + UINT32 RequiredParamsCurrent; + UINT32 RequiredParamsOld; + + + /* Methods have 0-7 parameters. All other types have zero. */ + + ParamCount = 0; + if (Node->Type == ACPI_TYPE_METHOD) + { + ParamCount = Node->Object->Method.ParamCount; + } + + /* Argument count check for non-predefined methods/objects */ + + if (!Predefined) + { + /* + * 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 + * arguments and the method attempts to use one of the missing ones. + */ + if (UserParamCount < ParamCount) + { + ACPI_WARNING ((AE_INFO, + "%s: Insufficient arguments - needs %d, found %d", + Pathname, ParamCount, UserParamCount)); + } + else if (UserParamCount > ParamCount) + { + ACPI_WARNING ((AE_INFO, + "%s: Excess arguments - needs %d, found %d", + Pathname, ParamCount, UserParamCount)); + } + return; + } + + /* 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)); + } + } + + /* + * 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. + */ + if ((ParamCount != RequiredParamsCurrent) && + (ParamCount != RequiredParamsOld)) + { + ACPI_WARNING ((AE_INFO, + "%s: Parameter count mismatch - ASL declared %d, ACPI requires %d", + Pathname, ParamCount, RequiredParamsCurrent)); + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiNsCheckForPredefinedName + * + * PARAMETERS: Node - Namespace node for the method/object + * + * RETURN: Pointer to entry in predefined table. NULL indicates not found. + * + * DESCRIPTION: Check an object name against the predefined object list. + * + ******************************************************************************/ + +const ACPI_PREDEFINED_INFO * +AcpiNsCheckForPredefinedName ( + ACPI_NAMESPACE_NODE *Node) +{ + const ACPI_PREDEFINED_INFO *ThisName; + + + /* Quick check for a predefined name, first character must be underscore */ + + if (Node->Name.Ascii[0] != '_') + { + return (NULL); + } + + /* Search info table for a predefined method/object name */ + + ThisName = PredefinedNames; + while (ThisName->Info.Name[0]) + { + if (ACPI_COMPARE_NAME (Node->Name.Ascii, ThisName->Info.Name)) + { + /* Return pointer to this table entry */ + + return (ThisName); + } + + /* + * Skip next entry in the table if this name returns a Package + * (next entry contains the package info) + */ + if (ThisName->Info.ExpectedBtypes & ACPI_RTYPE_PACKAGE) + { + ThisName++; + } + + ThisName++; + } + + return (NULL); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiNsCheckPackage + * + * PARAMETERS: Pathname - Full pathname to the node (for error msgs) + * ReturnObjectPtr - Pointer to the object returned from the + * evaluation of a method or object + * Predefined - Pointer to entry in predefined name table + * + * RETURN: Status + * + * DESCRIPTION: Check a returned package object for the correct count and + * correct type of all sub-objects. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiNsCheckPackage ( + char *Pathname, + ACPI_OPERAND_OBJECT **ReturnObjectPtr, + const ACPI_PREDEFINED_INFO *Predefined) +{ + 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; + UINT32 ExpectedCount; + UINT32 Count; + UINT32 i; + UINT32 j; + + + ACPI_FUNCTION_NAME (NsCheckPackage); + + + /* The package info for this name is in the next table entry */ + + Package = 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)); + + /* Extract package count and elements array */ + + Elements = ReturnObject->Package.Elements; + Count = ReturnObject->Package.Count; + + /* The package must have at least one element, else invalid */ + + if (!Count) + { + ACPI_WARNING ((AE_INFO, + "%s: Return Package has no elements (empty)", Pathname)); + + return (AE_AML_OPERAND_VALUE); + } + + /* + * Decode the type of the expected package contents + * + * PTYPE1 packages contain no subpackages + * PTYPE2 packages contain sub-packages + */ + switch (Package->RetInfo.Type) + { + case ACPI_PTYPE1_FIXED: + + /* + * The package count is fixed and there are no sub-packages + * + * If package is too small, exit. + * If package is larger than expected, issue warning but continue + */ + ExpectedCount = Package->RetInfo.Count1 + Package->RetInfo.Count2; + if (Count < ExpectedCount) + { + goto PackageTooSmall; + } + else if (Count > ExpectedCount) + { + ACPI_WARNING ((AE_INFO, + "%s: Return Package is larger than needed - " + "found %u, expected %u", Pathname, Count, ExpectedCount)); + } + + /* Validate all elements of the returned package */ + + Status = AcpiNsCheckPackageElements (Pathname, Elements, + Package->RetInfo.ObjectType1, Package->RetInfo.Count1, + Package->RetInfo.ObjectType2, Package->RetInfo.Count2, 0); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + break; + + + case ACPI_PTYPE1_VAR: + + /* + * The package count is variable, there are no sub-packages, and all + * elements must be of the same type + */ + for (i = 0; i < Count; i++) + { + Status = AcpiNsCheckObjectType (Pathname, Elements, + Package->RetInfo.ObjectType1, i); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + Elements++; + } + break; + + + case ACPI_PTYPE1_OPTION: + + /* + * The package count is variable, there are no sub-packages. There are + * a fixed number of required elements, and a variable number of + * optional elements. + * + * Check if package is at least as large as the minimum required + */ + ExpectedCount = Package->RetInfo3.Count; + if (Count < ExpectedCount) + { + goto PackageTooSmall; + } + + /* Variable number of sub-objects */ + + for (i = 0; i < Count; i++) + { + if (i < Package->RetInfo3.Count) + { + /* These are the required package elements (0, 1, or 2) */ + + Status = AcpiNsCheckObjectType (Pathname, Elements, + Package->RetInfo3.ObjectType[i], i); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + } + else + { + /* These are the optional package elements */ + + Status = AcpiNsCheckObjectType (Pathname, Elements, + Package->RetInfo3.TailObjectType, i); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + } + Elements++; + } + break; + + + case ACPI_PTYPE2_PKG_COUNT: + + /* First element is the (Integer) count of sub-packages to follow */ + + Status = AcpiNsCheckObjectType (Pathname, Elements, + ACPI_RTYPE_INTEGER, 0); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* + * Count cannot be larger than the parent package length, but allow it + * to be smaller. The >= accounts for the Integer above. + */ + ExpectedCount = (UINT32) (*Elements)->Integer.Value; + if (ExpectedCount >= Count) + { + goto PackageTooSmall; + } + + Count = ExpectedCount; + Elements++; + + /* Now we can walk the sub-packages */ + + /*lint -fallthrough */ + + + case ACPI_PTYPE2: + case ACPI_PTYPE2_FIXED: + case ACPI_PTYPE2_MIN: + case ACPI_PTYPE2_COUNT: + + /* + * These types all return a single package that consists of a variable + * number of sub-packages + */ + for (i = 0; i < Count; i++) + { + SubPackage = *Elements; + SubElements = SubPackage->Package.Elements; + + /* Each sub-object must be of type Package */ + + Status = AcpiNsCheckObjectType (Pathname, &SubPackage, + ACPI_RTYPE_PACKAGE, i); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* Examine the different types of sub-packages */ + + switch (Package->RetInfo.Type) + { + case ACPI_PTYPE2: + case ACPI_PTYPE2_PKG_COUNT: + + /* Each subpackage has a fixed number of elements */ + + ExpectedCount = + Package->RetInfo.Count1 + Package->RetInfo.Count2; + if (SubPackage->Package.Count != ExpectedCount) + { + Count = SubPackage->Package.Count; + goto PackageTooSmall; + } + + 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: + + /* Each sub-package has a fixed length */ + + ExpectedCount = Package->RetInfo2.Count; + if (SubPackage->Package.Count < ExpectedCount) + { + Count = SubPackage->Package.Count; + goto PackageTooSmall; + } + + /* Check the type of each sub-package element */ + + for (j = 0; j < ExpectedCount; j++) + { + Status = AcpiNsCheckObjectType (Pathname, &SubElements[j], + Package->RetInfo2.ObjectType[j], j); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + } + break; + + case ACPI_PTYPE2_MIN: + + /* Each sub-package has a variable but minimum length */ + + ExpectedCount = Package->RetInfo.Count1; + if (SubPackage->Package.Count < ExpectedCount) + { + Count = SubPackage->Package.Count; + goto PackageTooSmall; + } + + /* Check the type of each sub-package element */ + + Status = AcpiNsCheckPackageElements (Pathname, SubElements, + Package->RetInfo.ObjectType1, + SubPackage->Package.Count, 0, 0, 0); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + break; + + case ACPI_PTYPE2_COUNT: + + /* First element is the (Integer) count of elements to follow */ + + Status = AcpiNsCheckObjectType (Pathname, SubElements, + ACPI_RTYPE_INTEGER, 0); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* 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; + } + + /* Check the type of each sub-package element */ + + Status = AcpiNsCheckPackageElements (Pathname, + (SubElements + 1), + Package->RetInfo.ObjectType1, + (ExpectedCount - 1), 0, 0, 1); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + break; + + default: + break; + } + + Elements++; + } + break; + + + default: + + /* Should not get here if predefined info table is correct */ + + ACPI_WARNING ((AE_INFO, + "%s: Invalid internal return type in table entry: %X", + Pathname, Package->RetInfo.Type)); + + return (AE_AML_INTERNAL); + } + + return (AE_OK); + + +PackageTooSmall: + + /* Error exit for the case with an incorrect package count */ + + ACPI_WARNING ((AE_INFO, "%s: Return Package is too small - " + "found %u, expected %u", Pathname, Count, ExpectedCount)); + + return (AE_AML_OPERAND_VALUE); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiNsCheckPackageElements + * + * PARAMETERS: Pathname - Full pathname to the node (for error msgs) + * Elements - Pointer to the package elements array + * Type1 - Object type for first group + * Count1 - Count for first group + * Type2 - Object type for second group + * Count2 - Count for second group + * StartIndex - Start of the first group of elements + * + * RETURN: Status + * + * DESCRIPTION: Check that all elements of a package are of the correct object + * type. Supports up to two groups of different object types. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiNsCheckPackageElements ( + char *Pathname, + ACPI_OPERAND_OBJECT **Elements, + UINT8 Type1, + UINT32 Count1, + UINT8 Type2, + UINT32 Count2, + UINT32 StartIndex) +{ + ACPI_OPERAND_OBJECT **ThisElement = Elements; + ACPI_STATUS Status; + UINT32 i; + + + /* + * Up to two groups of package elements are supported by the data + * structure. All elements in each group must be of the same type. + * The second group can have a count of zero. + */ + for (i = 0; i < Count1; i++) + { + Status = AcpiNsCheckObjectType (Pathname, ThisElement, + Type1, i + StartIndex); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + ThisElement++; + } + + for (i = 0; i < Count2; i++) + { + Status = AcpiNsCheckObjectType (Pathname, ThisElement, + Type2, (i + Count1 + StartIndex)); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + ThisElement++; + } + + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiNsCheckObjectType + * + * PARAMETERS: Pathname - Full pathname to the node (for error msgs) + * 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) + * + * RETURN: Status + * + * DESCRIPTION: Check the type of the return object against the expected object + * type(s). Use of Btype allows multiple expected object types. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiNsCheckObjectType ( + char *Pathname, + ACPI_OPERAND_OBJECT **ReturnObjectPtr, + UINT32 ExpectedBtypes, + UINT32 PackageIndex) +{ + ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr; + 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 (!ReturnObject) + { + goto TypeErrorExit; + } + + /* A Namespace node should not get here, but make sure */ + + 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, + AcpiUtGetTypeName (ReturnObject->Node.Type))); + return (AE_AML_OPERAND_TYPE); + } + + /* + * Convert the object type (ACPI_TYPE_xxx) to a bitmapped object type. + * The bitmapped type allows multiple possible return types. + * + * Note, the cases below must handle all of the possible types returned + * from all of the predefined names (including elements of returned + * packages) + */ + switch (ReturnObject->Common.Type) + { + case ACPI_TYPE_INTEGER: + ReturnBtype = ACPI_RTYPE_INTEGER; + break; + + case ACPI_TYPE_BUFFER: + ReturnBtype = ACPI_RTYPE_BUFFER; + break; + + case ACPI_TYPE_STRING: + ReturnBtype = ACPI_RTYPE_STRING; + break; + + case ACPI_TYPE_PACKAGE: + ReturnBtype = ACPI_RTYPE_PACKAGE; + break; + + case ACPI_TYPE_LOCAL_REFERENCE: + ReturnBtype = ACPI_RTYPE_REFERENCE; + break; + + default: + /* Not one of the supported objects, must be incorrect */ + + goto TypeErrorExit; + } + + /* Is the object one of the expected types? */ + + if (!(ReturnBtype & ExpectedBtypes)) + { + /* Type mismatch -- attempt repair of the returned object */ + + Status = AcpiNsRepairObject (ExpectedBtypes, PackageIndex, + ReturnObjectPtr); + if (ACPI_SUCCESS (Status)) + { + return (Status); + } + goto TypeErrorExit; + } + + /* For reference objects, check that the reference type is correct */ + + if (ReturnObject->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) + { + Status = AcpiNsCheckReference (Pathname, ReturnObject); + } + + return (Status); + + +TypeErrorExit: + + /* Create a string with all expected types for this predefined object */ + + j = 1; + TypeBuffer[0] = 0; + ThisRtype = ACPI_RTYPE_INTEGER; + + for (i = 0; i < ACPI_NUM_RTYPES; i++) + { + /* 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)); + } + else + { + ACPI_WARNING ((AE_INFO, + "%s: Return Package type mismatch at index %u - " + "found %s, expected %s", Pathname, PackageIndex, + AcpiUtGetObjectTypeName (ReturnObject), TypeBuffer)); + } + + return (AE_AML_OPERAND_TYPE); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiNsCheckReference + * + * PARAMETERS: Pathname - Full pathname to the node (for error msgs) + * ReturnObject - Object returned from the evaluation of a + * method or object + * + * RETURN: Status + * + * DESCRIPTION: Check a returned reference object for the correct reference + * type. The only reference type that can be returned from a + * predefined method is a named reference. All others are invalid. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiNsCheckReference ( + char *Pathname, + ACPI_OPERAND_OBJECT *ReturnObject) +{ + + /* + * Check the reference object for the correct reference type (opcode). + * The only type of reference that can be converted to an ACPI_OBJECT is + * a reference to a named object (reference class: NAME) + */ + if (ReturnObject->Reference.Class == ACPI_REFCLASS_NAME) + { + return (AE_OK); + } + + ACPI_WARNING ((AE_INFO, + "%s: Return type mismatch - " + "unexpected reference object type [%s] %2.2X", + Pathname, AcpiUtGetReferenceName (ReturnObject), + ReturnObject->Reference.Class)); + + return (AE_AML_OPERAND_TYPE); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiNsRepairObject + * + * 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 + * + * RETURN: Status. AE_OK if repair was successful. + * + * DESCRIPTION: Attempt to repair/convert a return object of a type that was + * not expected. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiNsRepairObject ( + UINT32 ExpectedBtypes, + UINT32 PackageIndex, + ACPI_OPERAND_OBJECT **ReturnObjectPtr) +{ + 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); + } + + /* + * 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 */ + + AcpiUtRemoveReference (ReturnObject); + *ReturnObjectPtr = NewObject; + + /* + * 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) + { + AcpiUtRemoveReference (ReturnObject); + AcpiUtAddReference (NewObject); + } + return (AE_OK); + + default: + break; + } + + return (AE_AML_OPERAND_TYPE); +} + diff --git a/sys/contrib/dev/acpica/nssearch.c b/sys/contrib/dev/acpica/namespace/nssearch.c index 23d6ec2dddae..fce7c5ad4de9 100644 --- a/sys/contrib/dev/acpica/nssearch.c +++ b/sys/contrib/dev/acpica/namespace/nssearch.c @@ -1,7 +1,6 @@ /******************************************************************************* * * Module Name: nssearch - Namespace search - * $Revision: 1.121 $ * ******************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,9 +115,13 @@ #define __NSSEARCH_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acnamesp.h> +#include "acpi.h" +#include "accommon.h" +#include "acnamesp.h" +#ifdef ACPI_ASL_COMPILER +#include "amlcode.h" +#endif #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME ("nssearch") @@ -245,7 +248,8 @@ AcpiNsSearchOneScope ( /* Searched entire namespace level, not found */ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "Name [%4.4s] (%s) not found in search in scope [%4.4s] %p first child %p\n", + "Name [%4.4s] (%s) not found in search in scope [%4.4s] " + "%p first child %p\n", ACPI_CAST_PTR (char, &TargetName), AcpiUtGetTypeName (Type), AcpiUtGetNodeName (ParentNode), ParentNode, ParentNode->Child)); @@ -319,9 +323,8 @@ AcpiNsSearchParentTree ( "Searching parent [%4.4s] for [%4.4s]\n", AcpiUtGetNodeName (ParentNode), ACPI_CAST_PTR (char, &TargetName))); - /* - * Search parents until target is found or we have backed up to the root - */ + /* Search parents until target is found or we have backed up to the root */ + while (ParentNode) { /* @@ -408,25 +411,7 @@ AcpiNsSearchAndEnter ( * this problem, and we want to be able to enable ACPI support for them, * even though there are a few bad names. */ - if (!AcpiUtValidAcpiName (TargetName)) - { - TargetName = AcpiUtRepairName (ACPI_CAST_PTR (char, &TargetName)); - - /* Report warning only if in strict mode or debug mode */ - - if (!AcpiGbl_EnableInterpreterSlack) - { - ACPI_WARNING ((AE_INFO, - "Found bad character(s) in name, repaired: [%4.4s]\n", - ACPI_CAST_PTR (char, &TargetName))); - } - else - { - ACPI_DEBUG_PRINT ((ACPI_DB_WARN, - "Found bad character(s) in name, repaired: [%4.4s]\n", - ACPI_CAST_PTR (char, &TargetName))); - } - } + AcpiUtRepairName (ACPI_CAST_PTR (char, &TargetName)); /* Try to find the name in the namespace level specified by the caller */ @@ -444,6 +429,13 @@ AcpiNsSearchAndEnter ( Status = AE_ALREADY_EXISTS; } +#ifdef ACPI_ASL_COMPILER + if (*ReturnNode && (*ReturnNode)->Type == ACPI_TYPE_ANY) + { + (*ReturnNode)->Flags |= ANOBJ_IS_EXTERNAL; + } +#endif + /* Either found it or there was an error: finished either way */ return_ACPI_STATUS (Status); @@ -491,10 +483,11 @@ AcpiNsSearchAndEnter ( } #ifdef ACPI_ASL_COMPILER - /* - * Node is an object defined by an External() statement - */ - if (Flags & ACPI_NS_EXTERNAL) + + /* Node is an object defined by an External() statement */ + + if (Flags & ACPI_NS_EXTERNAL || + (WalkState && WalkState->Opcode == AML_SCOPE_OP)) { NewNode->Flags |= ANOBJ_IS_EXTERNAL; } diff --git a/sys/contrib/dev/acpica/nsutils.c b/sys/contrib/dev/acpica/namespace/nsutils.c index 7aac1f3891d2..dffc0d4432b1 100644 --- a/sys/contrib/dev/acpica/nsutils.c +++ b/sys/contrib/dev/acpica/namespace/nsutils.c @@ -2,7 +2,6 @@ * * Module Name: nsutils - Utilities for accessing ACPI namespace, accessing * parents and siblings and Scope manipulation - * $Revision: 1.155 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,10 +116,10 @@ #define __NSUTILS_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/amlcode.h> -#include <contrib/dev/acpica/actables.h> +#include "acpi.h" +#include "accommon.h" +#include "acnamesp.h" +#include "amlcode.h" #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME ("nsutils") @@ -155,9 +154,9 @@ AcpiNsFindParentName ( void AcpiNsReportError ( - char *ModuleName, + const char *ModuleName, UINT32 LineNumber, - char *InternalName, + const char *InternalName, ACPI_STATUS LookupStatus) { ACPI_STATUS Status; @@ -171,7 +170,7 @@ AcpiNsReportError ( { /* There is a non-ascii character in the name */ - ACPI_MOVE_32_TO_32 (&BadName, InternalName); + ACPI_MOVE_32_TO_32 (&BadName, ACPI_CAST_PTR (UINT32, InternalName)); AcpiOsPrintf ("[0x%4.4X] (NON-ASCII)", BadName); } else @@ -222,11 +221,11 @@ AcpiNsReportError ( void AcpiNsReportMethodError ( - char *ModuleName, + const char *ModuleName, UINT32 LineNumber, - char *Message, + const char *Message, ACPI_NAMESPACE_NODE *PrefixNode, - char *Path, + const char *Path, ACPI_STATUS MethodStatus) { ACPI_STATUS Status; @@ -265,7 +264,7 @@ AcpiNsReportMethodError ( void AcpiNsPrintNodePathname ( ACPI_NAMESPACE_NODE *Node, - char *Message) + const char *Message) { ACPI_BUFFER Buffer; ACPI_STATUS Status; @@ -416,7 +415,7 @@ void AcpiNsGetInternalNameLength ( ACPI_NAMESTRING_INFO *Info) { - char *NextExternalChar; + const char *NextExternalChar; UINT32 i; @@ -435,16 +434,22 @@ AcpiNsGetInternalNameLength ( * * strlen() + 1 covers the first NameSeg, which has no path separator */ - if (AcpiNsValidRootPrefix (NextExternalChar[0])) + if (AcpiNsValidRootPrefix (*NextExternalChar)) { Info->FullyQualified = TRUE; NextExternalChar++; + + /* Skip redundant RootPrefix, like \\_SB.PCI0.SBRG.EC0 */ + + while (AcpiNsValidRootPrefix (*NextExternalChar)) + { + NextExternalChar++; + } } else { - /* - * Handle Carat prefixes - */ + /* Handle Carat prefixes */ + while (*NextExternalChar == '^') { Info->NumCarats++; @@ -495,9 +500,9 @@ AcpiNsBuildInternalName ( { UINT32 NumSegments = Info->NumSegments; char *InternalName = Info->InternalName; - char *ExternalName = Info->NextExternalChar; + const char *ExternalName = Info->NextExternalChar; char *Result = NULL; - ACPI_NATIVE_UINT i; + UINT32 i; ACPI_FUNCTION_TRACE (NsBuildInternalName); @@ -547,13 +552,13 @@ AcpiNsBuildInternalName ( else if (NumSegments == 2) { InternalName[i] = AML_DUAL_NAME_PREFIX; - Result = &InternalName[(ACPI_NATIVE_UINT) (i+1)]; + Result = &InternalName[(ACPI_SIZE) i+1]; } else { InternalName[i] = AML_MULTI_NAME_PREFIX_OP; - InternalName[(ACPI_NATIVE_UINT) (i+1)] = (char) NumSegments; - Result = &InternalName[(ACPI_NATIVE_UINT) (i+2)]; + InternalName[(ACPI_SIZE) i+1] = (char) NumSegments; + Result = &InternalName[(ACPI_SIZE) i+2]; } } @@ -629,7 +634,7 @@ AcpiNsBuildInternalName ( ACPI_STATUS AcpiNsInternalizeName ( - char *ExternalName, + const char *ExternalName, char **ConvertedName) { char *InternalName; @@ -695,16 +700,16 @@ AcpiNsInternalizeName ( ACPI_STATUS AcpiNsExternalizeName ( UINT32 InternalNameLength, - char *InternalName, + const char *InternalName, UINT32 *ConvertedNameLength, char **ConvertedName) { - ACPI_NATIVE_UINT NamesIndex = 0; - ACPI_NATIVE_UINT NumSegments = 0; - ACPI_NATIVE_UINT RequiredLength; - ACPI_NATIVE_UINT PrefixLength = 0; - ACPI_NATIVE_UINT i = 0; - ACPI_NATIVE_UINT j = 0; + UINT32 NamesIndex = 0; + UINT32 NumSegments = 0; + UINT32 RequiredLength; + UINT32 PrefixLength = 0; + UINT32 i = 0; + UINT32 j = 0; ACPI_FUNCTION_TRACE (NsExternalizeName); @@ -717,9 +722,8 @@ AcpiNsExternalizeName ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - /* - * Check for a prefix (one '\' | one or more '^'). - */ + /* Check for a prefix (one '\' | one or more '^') */ + switch (InternalName[0]) { case '\\': @@ -751,7 +755,7 @@ AcpiNsExternalizeName ( } /* - * Check for object names. Note that there could be 0-255 of these + * Check for object names. Note that there could be 0-255 of these * 4-byte elements. */ if (PrefixLength < InternalNameLength) @@ -763,8 +767,8 @@ AcpiNsExternalizeName ( /* <count> 4-byte names */ NamesIndex = PrefixLength + 2; - NumSegments = (ACPI_NATIVE_UINT) (UINT8) - InternalName[(ACPI_NATIVE_UINT) (PrefixLength + 1)]; + NumSegments = (UINT8) + InternalName[(ACPI_SIZE) PrefixLength + 1]; break; case AML_DUAL_NAME_PREFIX: @@ -811,9 +815,8 @@ AcpiNsExternalizeName ( return_ACPI_STATUS (AE_BAD_PATHNAME); } - /* - * Build ConvertedName - */ + /* Build the ConvertedName */ + *ConvertedName = ACPI_ALLOCATE_ZEROED (RequiredLength); if (!(*ConvertedName)) { @@ -866,6 +869,9 @@ AcpiNsExternalizeName ( * 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. + * ******************************************************************************/ ACPI_NAMESPACE_NODE * @@ -876,9 +882,8 @@ AcpiNsMapHandleToNode ( ACPI_FUNCTION_ENTRY (); - /* - * Simple implementation - */ + /* Parameter validation */ + if ((!Handle) || (Handle == ACPI_ROOT_OBJECT)) { return (AcpiGbl_RootNode); @@ -1034,7 +1039,7 @@ AcpiNsOpensScope ( ACPI_STATUS AcpiNsGetNode ( ACPI_NAMESPACE_NODE *PrefixNode, - char *Pathname, + const char *Pathname, UINT32 Flags, ACPI_NAMESPACE_NODE **ReturnNode) { @@ -1043,7 +1048,7 @@ AcpiNsGetNode ( char *InternalPath; - ACPI_FUNCTION_TRACE_PTR (NsGetNode, Pathname); + ACPI_FUNCTION_TRACE_PTR (NsGetNode, ACPI_CAST_PTR (char, Pathname)); if (!Pathname) @@ -1083,7 +1088,7 @@ AcpiNsGetNode ( NULL, ReturnNode); if (ACPI_FAILURE (Status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s, %s\n", + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s, %s\n", Pathname, AcpiFormatException (Status))); } diff --git a/sys/contrib/dev/acpica/nswalk.c b/sys/contrib/dev/acpica/namespace/nswalk.c index a3ac86c1c89b..881573e905d2 100644 --- a/sys/contrib/dev/acpica/nswalk.c +++ b/sys/contrib/dev/acpica/namespace/nswalk.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: nswalk - Functions for walking the ACPI namespace - * $Revision: 1.46 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,8 +116,9 @@ #define __NSWALK_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acnamesp.h> +#include "acpi.h" +#include "accommon.h" +#include "acnamesp.h" #define _COMPONENT ACPI_NAMESPACE @@ -129,8 +129,7 @@ * * FUNCTION: AcpiNsGetNextNode * - * PARAMETERS: Type - Type of node to be searched for - * ParentNode - Parent node whose children we are + * PARAMETERS: ParentNode - Parent node whose children we are * getting * ChildNode - Previous child that was found. * The NEXT child will be returned @@ -146,13 +145,9 @@ ACPI_NAMESPACE_NODE * AcpiNsGetNextNode ( - ACPI_OBJECT_TYPE Type, ACPI_NAMESPACE_NODE *ParentNode, ACPI_NAMESPACE_NODE *ChildNode) { - ACPI_NAMESPACE_NODE *NextNode = NULL; - - ACPI_FUNCTION_ENTRY (); @@ -160,16 +155,58 @@ AcpiNsGetNextNode ( { /* It's really the parent's _scope_ that we want */ - NextNode = ParentNode->Child; + return (ParentNode->Child); } - else + /* + * Get the next node. + * + * If we are at the end of this peer list, return NULL + */ + if (ChildNode->Flags & ANOBJ_END_OF_PEER_LIST) { - /* Start search at the NEXT node */ - - NextNode = AcpiNsGetNextValidNode (ChildNode); + return NULL; } + /* Otherwise just return the next peer */ + + return (ChildNode->Peer); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiNsGetNextNodeTyped + * + * PARAMETERS: Type - Type of node to be searched for + * ParentNode - Parent node whose children we are + * getting + * ChildNode - Previous child that was found. + * The NEXT child will be returned + * + * RETURN: ACPI_NAMESPACE_NODE - Pointer to the NEXT child or NULL if + * none is found. + * + * DESCRIPTION: Return the next peer node within the namespace. If Handle + * is valid, Scope is ignored. Otherwise, the first node + * within Scope is returned. + * + ******************************************************************************/ + +ACPI_NAMESPACE_NODE * +AcpiNsGetNextNodeTyped ( + ACPI_OBJECT_TYPE Type, + ACPI_NAMESPACE_NODE *ParentNode, + ACPI_NAMESPACE_NODE *ChildNode) +{ + ACPI_NAMESPACE_NODE *NextNode = NULL; + + + ACPI_FUNCTION_ENTRY (); + + + NextNode = AcpiNsGetNextNode (ParentNode, ChildNode); + /* If any type is OK, we are done */ if (Type == ACPI_TYPE_ANY) @@ -220,8 +257,8 @@ AcpiNsGetNextNode ( * 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 - * a non-zero value, the search is terminated immediately and this - * value is returned to the caller. + * 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 @@ -276,7 +313,7 @@ AcpiNsWalkNamespace ( /* Get the next node in this scope. Null if not found */ Status = AE_OK; - ChildNode = AcpiNsGetNextNode (ACPI_TYPE_ANY, ParentNode, ChildNode); + ChildNode = AcpiNsGetNextNode (ParentNode, ChildNode); if (ChildNode) { /* Found next child, get the type if we are not searching for ANY */ @@ -289,10 +326,10 @@ AcpiNsWalkNamespace ( /* * 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. + * 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)) @@ -358,7 +395,7 @@ AcpiNsWalkNamespace ( */ if ((Level < MaxDepth) && (Status != AE_CTRL_DEPTH)) { - if (AcpiNsGetNextNode (ACPI_TYPE_ANY, ChildNode, NULL)) + if (ChildNode->Child) { /* There is at least one child of this node, visit it */ diff --git a/sys/contrib/dev/acpica/nsxfeval.c b/sys/contrib/dev/acpica/namespace/nsxfeval.c index 617002ca4849..c0d877839c3e 100644 --- a/sys/contrib/dev/acpica/nsxfeval.c +++ b/sys/contrib/dev/acpica/namespace/nsxfeval.c @@ -2,7 +2,6 @@ * * Module Name: nsxfeval - Public interfaces to the ACPI subsystem * ACPI Object evaluation interfaces - * $Revision: 1.30 $ * ******************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -118,14 +117,21 @@ #define __NSXFEVAL_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/acinterp.h> +#include "acpi.h" +#include "accommon.h" +#include "acnamesp.h" +#include "acinterp.h" #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME ("nsxfeval") +/* Local prototypes */ + +static void +AcpiNsResolveReferences ( + ACPI_EVALUATE_INFO *Info); + /******************************************************************************* * @@ -272,7 +278,6 @@ AcpiEvaluateObject ( } Info->Pathname = Pathname; - Info->ParameterType = ACPI_PARAM_ARGS; /* Convert and validate the device handle */ @@ -386,6 +391,10 @@ AcpiEvaluateObject ( if (ACPI_SUCCESS (Status)) { + /* Dereference Index and RefOf references */ + + AcpiNsResolveReferences (Info); + /* Get the size of the returned object */ Status = AcpiUtGetObjectSize (Info->ReturnObject, @@ -454,6 +463,82 @@ ACPI_EXPORT_SYMBOL (AcpiEvaluateObject) /******************************************************************************* * + * FUNCTION: AcpiNsResolveReferences + * + * PARAMETERS: Info - Evaluation info block + * + * RETURN: Info->ReturnObject is replaced with the dereferenced object + * + * DESCRIPTION: Dereference certain reference objects. Called before an + * internal return object is converted to an external ACPI_OBJECT. + * + * Performs an automatic dereference of Index and RefOf reference objects. + * These reference objects are not supported by the ACPI_OBJECT, so this is a + * last resort effort to return something useful. Also, provides compatibility + * with other ACPI implementations. + * + * NOTE: does not handle references within returned package objects or nested + * references, but this support could be added later if found to be necessary. + * + ******************************************************************************/ + +static void +AcpiNsResolveReferences ( + ACPI_EVALUATE_INFO *Info) +{ + ACPI_OPERAND_OBJECT *ObjDesc = NULL; + ACPI_NAMESPACE_NODE *Node; + + + /* We are interested in reference objects only */ + + if ((Info->ReturnObject)->Common.Type != ACPI_TYPE_LOCAL_REFERENCE) + { + return; + } + + /* + * Two types of references are supported - those created by Index and + * RefOf operators. A name reference (AML_NAMEPATH_OP) can be converted + * to an ACPI_OBJECT, so it is not dereferenced here. A DdbHandle + * (AML_LOAD_OP) cannot be dereferenced, nor can it be converted to + * an ACPI_OBJECT. + */ + switch (Info->ReturnObject->Reference.Class) + { + case ACPI_REFCLASS_INDEX: + + ObjDesc = *(Info->ReturnObject->Reference.Where); + break; + + case ACPI_REFCLASS_REFOF: + + Node = Info->ReturnObject->Reference.Object; + if (Node) + { + ObjDesc = Node->Object; + } + break; + + default: + return; + } + + /* Replace the existing reference object */ + + if (ObjDesc) + { + AcpiUtAddReference (ObjDesc); + AcpiUtRemoveReference (Info->ReturnObject); + Info->ReturnObject = ObjDesc; + } + + return; +} + + +/******************************************************************************* + * * FUNCTION: AcpiWalkNamespace * * PARAMETERS: Type - ACPI_OBJECT_TYPE to search for @@ -507,22 +592,41 @@ AcpiWalkNamespace ( } /* - * Lock the namespace around the walk. - * The namespace will be unlocked/locked around each call - * to the user function - since this function - * must be allowed to make Acpi calls itself. + * Need to acquire the namespace reader lock to prevent interference + * with any concurrent table unloads (which causes the deletion of + * namespace objects). We cannot allow the deletion of a namespace node + * while the user function is using it. The exception to this are the + * nodes created and deleted during control method execution -- these + * nodes are marked as temporary nodes and are ignored by the namespace + * walk. Thus, control methods can be executed while holding the + * namespace deletion lock (and the user function can execute control + * methods.) + */ + Status = AcpiUtAcquireReadLock (&AcpiGbl_NamespaceRwLock); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* + * Lock the namespace around the walk. The namespace will be + * unlocked/locked around each call to the user function - since the user + * function must be allowed to make ACPICA calls itself (for example, it + * will typically execute control methods during device enumeration.) */ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (Status)) { - return_ACPI_STATUS (Status); + goto UnlockAndExit; } Status = AcpiNsWalkNamespace (Type, StartObject, MaxDepth, - ACPI_NS_WALK_UNLOCK, - UserFunction, Context, ReturnValue); + ACPI_NS_WALK_UNLOCK, UserFunction, Context, ReturnValue); (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); + +UnlockAndExit: + (void) AcpiUtReleaseReadLock (&AcpiGbl_NamespaceRwLock); return_ACPI_STATUS (Status); } @@ -556,7 +660,8 @@ AcpiNsGetDeviceCallback ( UINT32 Flags; ACPI_DEVICE_ID Hid; ACPI_COMPATIBLE_ID_LIST *Cid; - ACPI_NATIVE_UINT i; + UINT32 i; + BOOLEAN Found; Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); @@ -585,10 +690,14 @@ AcpiNsGetDeviceCallback ( return (AE_CTRL_DEPTH); } - if (!(Flags & ACPI_STA_DEVICE_PRESENT)) + if (!(Flags & ACPI_STA_DEVICE_PRESENT) && + !(Flags & ACPI_STA_DEVICE_FUNCTIONING)) { - /* Don't examine children of the device if not present */ - + /* + * 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); } @@ -608,8 +717,10 @@ AcpiNsGetDeviceCallback ( if (ACPI_STRNCMP (Hid.Value, Info->Hid, sizeof (Hid.Value)) != 0) { - /* Get the list of Compatible IDs */ - + /* + * HID does not match, attempt match within the + * list of Compatible IDs (CIDs) + */ Status = AcpiUtExecute_CID (Node, &Cid); if (Status == AE_NOT_FOUND) { @@ -622,19 +733,29 @@ AcpiNsGetDeviceCallback ( /* Walk the CID list */ + Found = FALSE; for (i = 0; i < Cid->Count; i++) { if (ACPI_STRNCMP (Cid->Id[i].Value, Info->Hid, - sizeof (ACPI_COMPATIBLE_ID)) != 0) + sizeof (ACPI_COMPATIBLE_ID)) == 0) { - ACPI_FREE (Cid); - return (AE_OK); + /* Found a matching CID */ + + Found = TRUE; + break; } } + ACPI_FREE (Cid); + if (!Found) + { + return (AE_OK); + } } } + /* We have a valid device, invoke the user function */ + Status = Info->UserFunction (ObjHandle, NestingLevel, Info->Context, ReturnValue); return (Status); @@ -662,7 +783,7 @@ AcpiNsGetDeviceCallback ( * value is returned to the caller. * * This is a wrapper for WalkNamespace, but the callback performs - * additional filtering. Please see AcpiGetDeviceCallback. + * additional filtering. Please see AcpiNsGetDeviceCallback. * ******************************************************************************/ diff --git a/sys/contrib/dev/acpica/nsxfname.c b/sys/contrib/dev/acpica/namespace/nsxfname.c index c19f2a94b575..49ccb58092fa 100644 --- a/sys/contrib/dev/acpica/nsxfname.c +++ b/sys/contrib/dev/acpica/namespace/nsxfname.c @@ -2,7 +2,6 @@ * * Module Name: nsxfname - Public interfaces to the ACPI subsystem * ACPI Namespace oriented interfaces - * $Revision: 1.112 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,8 +116,11 @@ #define __NSXFNAME_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acnamesp.h> +#include "acpi.h" +#include "accommon.h" +#include "acnamesp.h" +#include "acparser.h" +#include "amlcode.h" #define _COMPONENT ACPI_NAMESPACE @@ -361,6 +363,7 @@ AcpiGetObjectInfo ( if (!Node) { (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); + Status = AE_BAD_PARAMETER; goto Cleanup; } @@ -372,6 +375,11 @@ AcpiGetObjectInfo ( Info->Name = Node->Name.Integer; Info->Valid = 0; + if (Node->Type == ACPI_TYPE_METHOD) + { + Info->ParamCount = Node->Object->Method.ParamCount; + } + Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (Status)) { @@ -472,3 +480,165 @@ Cleanup: ACPI_EXPORT_SYMBOL (AcpiGetObjectInfo) + +/****************************************************************************** + * + * FUNCTION: AcpiInstallMethod + * + * PARAMETERS: Buffer - An ACPI table containing one control method + * + * RETURN: Status + * + * DESCRIPTION: Install a control method into the namespace. If the method + * name already exists in the namespace, it is overwritten. The + * input buffer must contain a valid DSDT or SSDT containing a + * single control method. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiInstallMethod ( + UINT8 *Buffer) +{ + ACPI_TABLE_HEADER *Table = ACPI_CAST_PTR (ACPI_TABLE_HEADER, Buffer); + UINT8 *AmlBuffer; + UINT8 *AmlStart; + char *Path; + ACPI_NAMESPACE_NODE *Node; + ACPI_OPERAND_OBJECT *MethodObj; + ACPI_PARSE_STATE ParserState; + UINT32 AmlLength; + UINT16 Opcode; + UINT8 MethodFlags; + ACPI_STATUS Status; + + + /* Parameter validation */ + + if (!Buffer) + { + return (AE_BAD_PARAMETER); + } + + /* Table must be a DSDT or SSDT */ + + if (!ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_DSDT) && + !ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_SSDT)) + { + return (AE_BAD_HEADER); + } + + /* First AML opcode in the table must be a control method */ + + ParserState.Aml = Buffer + sizeof (ACPI_TABLE_HEADER); + Opcode = AcpiPsPeekOpcode (&ParserState); + if (Opcode != AML_METHOD_OP) + { + return (AE_BAD_PARAMETER); + } + + /* Extract method information from the raw AML */ + + ParserState.Aml += AcpiPsGetOpcodeSize (Opcode); + ParserState.PkgEnd = AcpiPsGetNextPackageEnd (&ParserState); + Path = AcpiPsGetNextNamestring (&ParserState); + MethodFlags = *ParserState.Aml++; + AmlStart = ParserState.Aml; + AmlLength = ACPI_PTR_DIFF (ParserState.PkgEnd, AmlStart); + + /* + * Allocate resources up-front. We don't want to have to delete a new + * node from the namespace if we cannot allocate memory. + */ + AmlBuffer = ACPI_ALLOCATE (AmlLength); + if (!AmlBuffer) + { + return (AE_NO_MEMORY); + } + + MethodObj = AcpiUtCreateInternalObject (ACPI_TYPE_METHOD); + if (!MethodObj) + { + ACPI_FREE (AmlBuffer); + return (AE_NO_MEMORY); + } + + /* Lock namespace for AcpiNsLookup, we may be creating a new node */ + + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (Status)) + { + goto ErrorExit; + } + + /* The lookup either returns an existing node or creates a new one */ + + Status = AcpiNsLookup (NULL, Path, ACPI_TYPE_METHOD, ACPI_IMODE_LOAD_PASS1, + ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_ERROR_IF_FOUND, NULL, &Node); + + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); + + if (ACPI_FAILURE (Status)) /* NsLookup */ + { + if (Status != AE_ALREADY_EXISTS) + { + goto ErrorExit; + } + + /* Node existed previously, make sure it is a method node */ + + if (Node->Type != ACPI_TYPE_METHOD) + { + Status = AE_TYPE; + goto ErrorExit; + } + } + + /* Copy the method AML to the local buffer */ + + ACPI_MEMCPY (AmlBuffer, AmlStart, AmlLength); + + /* Initialize the method object with the new method's information */ + + MethodObj->Method.AmlStart = AmlBuffer; + MethodObj->Method.AmlLength = AmlLength; + + MethodObj->Method.ParamCount = (UINT8) + (MethodFlags & AML_METHOD_ARG_COUNT); + + MethodObj->Method.MethodFlags = (UINT8) + (MethodFlags & ~AML_METHOD_ARG_COUNT); + + if (MethodFlags & AML_METHOD_SERIALIZED) + { + MethodObj->Method.SyncLevel = (UINT8) + ((MethodFlags & AML_METHOD_SYNC_LEVEL) >> 4); + } + + /* + * Now that it is complete, we can attach the new method object to + * the method Node (detaches/deletes any existing object) + */ + Status = AcpiNsAttachObject (Node, MethodObj, + ACPI_TYPE_METHOD); + + /* + * Flag indicates AML buffer is dynamic, must be deleted later. + * Must be set only after attach above. + */ + Node->Flags |= ANOBJ_ALLOCATED_BUFFER; + + /* Remove local reference to the method object */ + + AcpiUtRemoveReference (MethodObj); + return (Status); + + +ErrorExit: + + ACPI_FREE (AmlBuffer); + ACPI_FREE (MethodObj); + return (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiInstallMethod) diff --git a/sys/contrib/dev/acpica/nsxfobj.c b/sys/contrib/dev/acpica/namespace/nsxfobj.c index 3277379b7f93..023cb6990b0d 100644 --- a/sys/contrib/dev/acpica/nsxfobj.c +++ b/sys/contrib/dev/acpica/namespace/nsxfobj.c @@ -2,7 +2,6 @@ * * Module Name: nsxfobj - Public interfaces to the ACPI subsystem * ACPI Object oriented interfaces - * $Revision: 1.122 $ * ******************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -118,8 +117,9 @@ #define __NSXFOBJ_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acnamesp.h> +#include "acpi.h" +#include "accommon.h" +#include "acnamesp.h" #define _COMPONENT ACPI_NAMESPACE @@ -209,6 +209,7 @@ AcpiGetParent ( ACPI_HANDLE *RetHandle) { ACPI_NAMESPACE_NODE *Node; + ACPI_NAMESPACE_NODE *ParentNode; ACPI_STATUS Status; @@ -241,12 +242,12 @@ AcpiGetParent ( /* Get the parent entry */ - *RetHandle = - AcpiNsConvertEntryToHandle (AcpiNsGetParentNode (Node)); + ParentNode = AcpiNsGetParentNode (Node); + *RetHandle = AcpiNsConvertEntryToHandle (ParentNode); /* Return exception if parent is null */ - if (!AcpiNsGetParentNode (Node)) + if (!ParentNode) { Status = AE_NULL_ENTRY; } @@ -333,7 +334,7 @@ AcpiGetNextObject ( /* Internal function does the real work */ - Node = AcpiNsGetNextNode (Type, ParentNode, ChildNode); + Node = AcpiNsGetNextNodeTyped (Type, ParentNode, ChildNode); if (!Node) { Status = AE_NOT_FOUND; diff --git a/sys/contrib/dev/acpica/osunixxf.c b/sys/contrib/dev/acpica/osunixxf.c index 8fc21fc7cdc9..b430e83f1600 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 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,7 +116,7 @@ /* * These interfaces are required in order to compile the ASL compiler under - * Linux. + * Linux or other Unix-like system. */ #include <stdio.h> @@ -124,11 +124,14 @@ #include <stdarg.h> #include <unistd.h> #include <sys/time.h> +#include <semaphore.h> +#include <pthread.h> -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/amlcode.h> -#include <contrib/dev/acpica/acparser.h> -#include <contrib/dev/acpica/acdebug.h> +#include "acpi.h" +#include "accommon.h" +#include "amlcode.h" +#include "acparser.h" +#include "acdebug.h" #define _COMPONENT ACPI_OS_SERVICES ACPI_MODULE_NAME ("osunixxf") @@ -137,10 +140,20 @@ extern FILE *AcpiGbl_DebugFile; FILE *AcpiGbl_OutputFile; + +/* Upcalls to AcpiExec */ + ACPI_PHYSICAL_ADDRESS AeLocalGetRootPointer ( void); +void +AeTableOverride ( + ACPI_TABLE_HEADER *ExistingTable, + ACPI_TABLE_HEADER **NewTable); + +typedef void* (*PTHREAD_CALLBACK) (void *); + /****************************************************************************** * @@ -157,16 +170,17 @@ AeLocalGetRootPointer ( ACPI_STATUS AcpiOsInitialize (void) { - AcpiGbl_OutputFile = stdout; - return AE_OK; + AcpiGbl_OutputFile = stdout; + return (AE_OK); } ACPI_STATUS AcpiOsTerminate (void) { - return AE_OK; + + return (AE_OK); } @@ -250,64 +264,12 @@ AcpiOsTableOverride ( #ifdef ACPI_EXEC_APP - /* This code exercises the table override mechanism in the core */ - - if (ACPI_COMPARE_NAME (ExistingTable->Signature, ACPI_SIG_DSDT)) - { - /* override DSDT with itself */ - - *NewTable = AcpiGbl_DbTablePtr; - } + AeTableOverride (ExistingTable, NewTable); return (AE_OK); #else - return AE_NO_ACPI_TABLES; -#endif -} - - -/****************************************************************************** - * - * FUNCTION: AcpiOsReadable - * - * PARAMETERS: Pointer - Area to be verified - * Length - Size of area - * - * RETURN: TRUE if readable for entire length - * - * DESCRIPTION: Verify that a pointer is valid for reading - * - *****************************************************************************/ -BOOLEAN -AcpiOsReadable ( - void *Pointer, - ACPI_SIZE Length) -{ - - return (TRUE); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiOsWritable - * - * PARAMETERS: Pointer - Area to be verified - * Length - Size of area - * - * RETURN: TRUE if writable for entire length - * - * DESCRIPTION: Verify that a pointer is valid for writing - * - *****************************************************************************/ - -BOOLEAN -AcpiOsWritable ( - void *Pointer, - ACPI_SIZE Length) -{ - - return (TRUE); + return (AE_NO_ACPI_TABLES); +#endif } @@ -353,11 +315,8 @@ AcpiOsPrintf ( va_start (Args, Fmt); - AcpiOsVprintf (Fmt, Args); - va_end (Args); - return; } @@ -406,8 +365,6 @@ AcpiOsVprintf ( { Count = vfprintf (AcpiGbl_OutputFile, Fmt, Args); } - - return; } @@ -471,7 +428,7 @@ AcpiOsMapMemory ( ACPI_SIZE length) { - return (ACPI_TO_POINTER ((ACPI_NATIVE_UINT) where)); + return (ACPI_TO_POINTER ((ACPI_SIZE) where)); } @@ -519,8 +476,7 @@ AcpiOsAllocate ( Mem = (void *) malloc ((size_t) size); - - return Mem; + return (Mem); } @@ -541,7 +497,6 @@ AcpiOsFree ( void *mem) { - free (mem); } @@ -565,12 +520,32 @@ AcpiOsCreateSemaphore ( UINT32 InitialUnits, ACPI_HANDLE *OutHandle) { + sem_t *Sem; + + + if (!OutHandle) + { + return (AE_BAD_PARAMETER); + } + + Sem = AcpiOsAllocate (sizeof (sem_t)); + if (!Sem) + { + return (AE_NO_MEMORY); + } - *OutHandle = (ACPI_HANDLE) 1; - return AE_OK; + if (sem_init (Sem, 0, InitialUnits) == -1) + { + AcpiOsFree (Sem); + return (AE_BAD_PARAMETER); + } + + *OutHandle = (ACPI_HANDLE) Sem; + return (AE_OK); } + /****************************************************************************** * * FUNCTION: AcpiOsDeleteSemaphore @@ -587,13 +562,20 @@ ACPI_STATUS AcpiOsDeleteSemaphore ( ACPI_HANDLE Handle) { + sem_t *Sem = (sem_t *) Handle; - if (!Handle) + + if (!Sem) { - return AE_BAD_PARAMETER; + return (AE_BAD_PARAMETER); } - return AE_OK; + if (sem_destroy (Sem) == -1) + { + return (AE_BAD_PARAMETER); + } + + return (AE_OK); } @@ -617,9 +599,78 @@ AcpiOsWaitSemaphore ( UINT32 Units, UINT16 Timeout) { + ACPI_STATUS Status = AE_OK; + sem_t *Sem = (sem_t *) Handle; + struct timespec T; + + + if (!Sem) + { + return (AE_BAD_PARAMETER); + } + + switch (Timeout) + { + /* + * No Wait: + * -------- + * A zero timeout value indicates that we shouldn't wait - just + * acquire the semaphore if available otherwise return AE_TIME + * (a.k.a. 'would block'). + */ + case 0: + + if (sem_trywait(Sem) == -1) + { + Status = (AE_TIME); + } + break; + + /* Wait Indefinitely */ + + case ACPI_WAIT_FOREVER: + + if (sem_wait (Sem)) + { + Status = (AE_TIME); + } + break; + /* Wait with Timeout */ - return AE_OK; + default: + + T.tv_sec = Timeout / 1000; + T.tv_nsec = (Timeout - (T.tv_sec * 1000)) * 1000000; + +#ifdef ACPI_USE_ALTERNATE_TIMEOUT + /* + * Alternate timeout mechanism for environments where + * sem_timedwait is not available or does not work properly. + */ + while (Timeout) + { + if (sem_trywait (Sem) == 0) + { + /* Got the semaphore */ + return (AE_OK); + } + usleep (1000); /* one millisecond */ + Timeout--; + } + Status = (AE_TIME); +#else + + if (sem_timedwait (Sem, &T)) + { + Status = (AE_TIME); + } +#endif + + break; + } + + return (Status); } @@ -641,12 +692,31 @@ AcpiOsSignalSemaphore ( ACPI_HANDLE Handle, UINT32 Units) { + sem_t *Sem = (sem_t *)Handle; + + + if (!Sem) + { + return (AE_BAD_PARAMETER); + } + if (sem_post (Sem) == -1) + { + return (AE_LIMIT); + } - return AE_OK; + return (AE_OK); } +/****************************************************************************** + * + * FUNCTION: Spinlock interfaces + * + * DESCRIPTION: Map these interfaces to semaphore interfaces + * + *****************************************************************************/ + ACPI_STATUS AcpiOsCreateLock ( ACPI_SPINLOCK *OutHandle) @@ -655,6 +725,7 @@ AcpiOsCreateLock ( return (AcpiOsCreateSemaphore (1, 1, OutHandle)); } + void AcpiOsDeleteLock ( ACPI_SPINLOCK Handle) @@ -703,8 +774,7 @@ AcpiOsInstallInterruptHandler ( void *Context) { - - return AE_OK; + return (AE_OK); } @@ -726,7 +796,7 @@ AcpiOsRemoveInterruptHandler ( ACPI_OSD_HANDLER ServiceRoutine) { - return AE_OK; + return (AE_OK); } @@ -750,39 +820,16 @@ AcpiOsExecute ( ACPI_OSD_EXEC_CALLBACK Function, void *Context) { + pthread_t thread; + int ret; -// _beginthread (Function, (unsigned) 0, Context); - return 0; -} - - -/****************************************************************************** - * - * FUNCTION: AcpiOsBreakpoint - * - * PARAMETERS: Msg Message to print - * - * RETURN: Status - * - * DESCRIPTION: Print a message and break to the debugger. - * - *****************************************************************************/ - -ACPI_STATUS -AcpiOsBreakpoint ( - char *Msg) -{ - if (Msg) - { - AcpiOsPrintf ("AcpiOsBreakpoint: %s ****\n", Msg); - } - else + ret = pthread_create (&thread, NULL, (PTHREAD_CALLBACK) Function, Context); + if (ret) { - AcpiOsPrintf ("At AcpiOsBreakpoint ****\n"); + AcpiOsPrintf("Create thread failed"); } - - return AE_OK; + return (0); } @@ -807,7 +854,6 @@ AcpiOsStall ( { usleep (microseconds); } - return; } @@ -834,8 +880,6 @@ AcpiOsSleep ( * Arg to usleep() must be less than 1,000,000 (1 second) */ usleep ((milliseconds % 1000) * 1000); /* Sleep for remaining usecs */ - - return; } /****************************************************************************** @@ -853,9 +897,10 @@ AcpiOsSleep ( UINT64 AcpiOsGetTimer (void) { - struct timeval time; + struct timeval time; + - gettimeofday(&time, NULL); + gettimeofday (&time, NULL); /* Seconds * 10^7 = 100ns(10^-7), Microseconds(10^-6) * 10^1 = 100ns */ @@ -887,33 +932,6 @@ AcpiOsValidateInterface ( /****************************************************************************** * - * FUNCTION: AcpiOsValidateAddress - * - * PARAMETERS: SpaceId - ACPI space ID - * Address - Physical address - * Length - Address length - * - * RETURN: AE_OK if Address/Length is valid for the SpaceId. Otherwise, - * should return AE_AML_ILLEGAL_ADDRESS. - * - * DESCRIPTION: Validate a system address via the host OS. Used to validate - * the addresses accessed by AML operation regions. - * - *****************************************************************************/ - -ACPI_STATUS -AcpiOsValidateAddress ( - UINT8 SpaceId, - ACPI_PHYSICAL_ADDRESS Address, - ACPI_SIZE Length) -{ - - return (AE_OK); -} - - -/****************************************************************************** - * * FUNCTION: AcpiOsReadPciConfiguration * * PARAMETERS: PciId Seg/Bus/Dev @@ -1010,6 +1028,9 @@ AcpiOsReadPort ( case 32: *Value = 0xFFFFFFFF; break; + + default: + return (AE_BAD_PARAMETER); } return (AE_OK); @@ -1072,7 +1093,6 @@ AcpiOsReadMemory ( default: return (AE_BAD_PARAMETER); - break; } return (AE_OK); } @@ -1103,10 +1123,72 @@ AcpiOsWriteMemory ( } +/****************************************************************************** + * + * FUNCTION: AcpiOsReadable + * + * PARAMETERS: Pointer - Area to be verified + * Length - Size of area + * + * RETURN: TRUE if readable for entire length + * + * DESCRIPTION: Verify that a pointer is valid for reading + * + *****************************************************************************/ + +BOOLEAN +AcpiOsReadable ( + void *Pointer, + ACPI_SIZE Length) +{ + + return (TRUE); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiOsWritable + * + * PARAMETERS: Pointer - Area to be verified + * Length - Size of area + * + * RETURN: TRUE if writable for entire length + * + * DESCRIPTION: Verify that a pointer is valid for writing + * + *****************************************************************************/ + +BOOLEAN +AcpiOsWritable ( + void *Pointer, + ACPI_SIZE Length) +{ + + return (TRUE); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiOsGetThreadId + * + * PARAMETERS: None + * + * RETURN: Id of the running thread + * + * DESCRIPTION: Get the Id of the current (running) thread + * + * NOTE: The environment header should contain this line: + * #define ACPI_THREAD_ID pthread_t + * + *****************************************************************************/ + ACPI_THREAD_ID -AcpiOsGetThreadId(void) +AcpiOsGetThreadId (void) { - return getpid(); + + return (pthread_self ()); } @@ -1119,7 +1201,7 @@ AcpiOsGetThreadId(void) * * RETURN: Status * - * DESCRIPTION: Miscellaneous functions + * DESCRIPTION: Miscellaneous functions. Example implementation only. * *****************************************************************************/ @@ -1135,20 +1217,12 @@ AcpiOsSignal ( break; case ACPI_SIGNAL_BREAKPOINT: + break; - if (Info) - { - AcpiOsPrintf ("AcpiOsBreakpoint: %s ****\n", Info); - } - else - { - AcpiOsPrintf ("At AcpiOsBreakpoint ****\n"); - } - + default: break; } - return (AE_OK); } diff --git a/sys/contrib/dev/acpica/psargs.c b/sys/contrib/dev/acpica/parser/psargs.c index 3c3991940703..60d4a835b1b7 100644 --- a/sys/contrib/dev/acpica/psargs.c +++ b/sys/contrib/dev/acpica/parser/psargs.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: psargs - Parse AML opcode arguments - * $Revision: 1.92 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,11 +115,12 @@ #define __PSARGS_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acparser.h> -#include <contrib/dev/acpica/amlcode.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/acdispat.h> +#include "acpi.h" +#include "accommon.h" +#include "acparser.h" +#include "amlcode.h" +#include "acnamesp.h" +#include "acdispat.h" #define _COMPONENT ACPI_PARSER ACPI_MODULE_NAME ("psargs") @@ -156,7 +156,7 @@ AcpiPsGetNextPackageLength ( { UINT8 *Aml = ParserState->Aml; UINT32 PackageLength = 0; - ACPI_NATIVE_UINT ByteCount; + UINT32 ByteCount; UINT8 ByteZeroMask = 0x3F; /* Default [0:5] */ @@ -168,7 +168,7 @@ AcpiPsGetNextPackageLength ( * used to encode the package length, either 0,1,2, or 3 */ ByteCount = (Aml[0] >> 6); - ParserState->Aml += (ByteCount + 1); + ParserState->Aml += ((ACPI_SIZE) ByteCount + 1); /* Get bytes 3, 2, 1 as needed */ @@ -329,12 +329,12 @@ AcpiPsGetNextNamepath ( ACPI_PARSE_OBJECT *Arg, BOOLEAN PossibleMethodCall) { + ACPI_STATUS Status; char *Path; ACPI_PARSE_OBJECT *NameOp; - ACPI_STATUS Status; ACPI_OPERAND_OBJECT *MethodDesc; ACPI_NAMESPACE_NODE *Node; - ACPI_GENERIC_STATE ScopeInfo; + UINT8 *Start = ParserState->Aml; ACPI_FUNCTION_TRACE (PsGetNextNamepath); @@ -351,23 +351,16 @@ AcpiPsGetNextNamepath ( return_ACPI_STATUS (AE_OK); } - /* Setup search scope info */ - - ScopeInfo.Scope.Node = NULL; - Node = ParserState->StartNode; - if (Node) - { - ScopeInfo.Scope.Node = Node; - } - /* - * Lookup the name in the internal namespace. We don't want to add - * anything new to the namespace here, however, so we use MODE_EXECUTE. + * Lookup the name in the internal namespace, starting with the current + * scope. We don't want to add anything new to the namespace here, + * however, so we use MODE_EXECUTE. * Allow searching of the parent tree, but don't open a new scope - * we just want to lookup the object (must be mode EXECUTE to perform * the upsearch) */ - Status = AcpiNsLookup (&ScopeInfo, Path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, + Status = AcpiNsLookup (WalkState->ScopeInfo, Path, + ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node); /* @@ -378,6 +371,18 @@ AcpiPsGetNextNamepath ( PossibleMethodCall && (Node->Type == ACPI_TYPE_METHOD)) { + if (WalkState->Opcode == AML_UNLOAD_OP) + { + /* + * AcpiPsGetNextNamestring has increased the AML pointer, + * so we need to restore the saved AML pointer for method call. + */ + WalkState->ParserState.Aml = Start; + WalkState->ArgCount = 1; + AcpiPsInitOp (Arg, AML_INT_METHODCALL_OP); + return_ACPI_STATUS (AE_OK); + } + /* This name is actually a control method invocation */ MethodDesc = AcpiNsGetAttachedObject (Node); @@ -824,7 +829,26 @@ AcpiPsGetNextArg ( return_ACPI_STATUS (AE_NO_MEMORY); } - Status = AcpiPsGetNextNamepath (WalkState, ParserState, Arg, 0); + /* To support SuperName arg of Unload */ + + if (WalkState->Opcode == AML_UNLOAD_OP) + { + Status = AcpiPsGetNextNamepath (WalkState, ParserState, Arg, 1); + + /* + * If the SuperName arg of Unload is a method call, + * we have restored the AML pointer, just free this Arg + */ + if (Arg->Common.AmlOpcode == AML_INT_METHODCALL_OP) + { + AcpiPsFreeOp (Arg); + Arg = NULL; + } + } + else + { + Status = AcpiPsGetNextNamepath (WalkState, ParserState, Arg, 0); + } } else { diff --git a/sys/contrib/dev/acpica/psloop.c b/sys/contrib/dev/acpica/parser/psloop.c index 6c6ce47b1434..a6f4344f774b 100644 --- a/sys/contrib/dev/acpica/psloop.c +++ b/sys/contrib/dev/acpica/parser/psloop.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: psloop - Main AML parse loop - * $Revision: 1.16 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -123,10 +122,11 @@ * opcode templates in AmlOpInfo[]. */ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acparser.h> -#include <contrib/dev/acpica/acdispat.h> -#include <contrib/dev/acpica/amlcode.h> +#include "acpi.h" +#include "accommon.h" +#include "acparser.h" +#include "acdispat.h" +#include "amlcode.h" #define _COMPONENT ACPI_PARSER ACPI_MODULE_NAME ("psloop") @@ -338,7 +338,8 @@ AcpiPsBuildNamedOp ( AcpiPsAppendArg (*Op, UnnamedOp->Common.Value.Arg); AcpiGbl_Depth++; - if ((*Op)->Common.AmlOpcode == AML_REGION_OP) + if ((*Op)->Common.AmlOpcode == AML_REGION_OP || + (*Op)->Common.AmlOpcode == AML_DATA_REGION_OP) { /* * Defer final parsing of an OperationRegion body, because we don't @@ -429,6 +430,16 @@ AcpiPsCreateOp ( Op->Named.Length = 0; } + if (WalkState->Opcode == AML_BANK_FIELD_OP) + { + /* + * Backup to beginning of BankField declaration + * BodyLength is unknown until we parse the body + */ + Op->Named.Data = AmlOpStart; + Op->Named.Length = 0; + } + ParentScope = AcpiPsGetParentScope (&(WalkState->ParserState)); AcpiPsAppendArg (ParentScope, Op); @@ -1132,7 +1143,8 @@ AcpiPsParseLoop ( AcpiGbl_Depth--; } - if (Op->Common.AmlOpcode == AML_REGION_OP) + if (Op->Common.AmlOpcode == AML_REGION_OP || + Op->Common.AmlOpcode == AML_DATA_REGION_OP) { /* * Skip parsing of control method or opregion body, @@ -1157,6 +1169,16 @@ AcpiPsParseLoop ( Op->Named.Length = (UINT32) (ParserState->Aml - Op->Named.Data); } + if (Op->Common.AmlOpcode == AML_BANK_FIELD_OP) + { + /* + * Backup to beginning of BankField declaration + * + * BodyLength is unknown until we parse the body + */ + Op->Named.Length = (UINT32) (ParserState->Aml - Op->Named.Data); + } + /* This op complete, notify the dispatcher */ if (WalkState->AscendingCallback != NULL) diff --git a/sys/contrib/dev/acpica/psopcode.c b/sys/contrib/dev/acpica/parser/psopcode.c index fad6d394dcfe..d107c523707c 100644 --- a/sys/contrib/dev/acpica/psopcode.c +++ b/sys/contrib/dev/acpica/parser/psopcode.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: psopcode - Parser/Interpreter opcode information table - * $Revision: 1.99 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -115,17 +114,18 @@ *****************************************************************************/ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acparser.h> -#include <contrib/dev/acpica/acopcode.h> -#include <contrib/dev/acpica/amlcode.h> +#include "acpi.h" +#include "accommon.h" +#include "acparser.h" +#include "acopcode.h" +#include "amlcode.h" #define _COMPONENT ACPI_PARSER ACPI_MODULE_NAME ("psopcode") -const UINT8 AcpiGbl_ArgumentCount[] = {0,1,1,1,1,2,2,2,2,3,3,6}; +static const UINT8 AcpiGbl_ArgumentCount[] = {0,1,1,1,1,2,2,2,2,3,3,6}; /******************************************************************************* @@ -365,7 +365,7 @@ const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[AML_NUM_OPCODES] = /* 5C */ ACPI_OP ("PowerResource", ARGP_POWER_RES_OP, ARGI_POWER_RES_OP, ACPI_TYPE_POWER, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), /* 5D */ ACPI_OP ("ThermalZone", ARGP_THERMAL_ZONE_OP, ARGI_THERMAL_ZONE_OP, ACPI_TYPE_THERMAL, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), /* 5E */ ACPI_OP ("IndexField", ARGP_INDEX_FIELD_OP, ARGI_INDEX_FIELD_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD), -/* 5F */ ACPI_OP ("BankField", ARGP_BANK_FIELD_OP, ARGI_BANK_FIELD_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD), +/* 5F */ ACPI_OP ("BankField", ARGP_BANK_FIELD_OP, ARGI_BANK_FIELD_OP, ACPI_TYPE_LOCAL_BANK_FIELD, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD | AML_DEFER), /* Internal opcodes that map to invalid AML opcodes */ @@ -400,7 +400,7 @@ const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[AML_NUM_OPCODES] = /* 79 */ ACPI_OP ("Mid", ARGP_MID_OP, ARGI_MID_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_3A_1T_1R, AML_FLAGS_EXEC_3A_1T_1R | AML_CONSTANT), /* 7A */ ACPI_OP ("Continue", ARGP_CONTINUE_OP, ARGI_CONTINUE_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0), /* 7B */ ACPI_OP ("LoadTable", ARGP_LOAD_TABLE_OP, ARGI_LOAD_TABLE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R), -/* 7C */ ACPI_OP ("DataTableRegion", ARGP_DATA_REGION_OP, ARGI_DATA_REGION_OP, ACPI_TYPE_REGION, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), +/* 7C */ ACPI_OP ("DataTableRegion", ARGP_DATA_REGION_OP, ARGI_DATA_REGION_OP, ACPI_TYPE_REGION, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED | AML_DEFER), /* 7D */ ACPI_OP ("[EvalSubTree]", ARGP_SCOPE_OP, ARGI_SCOPE_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE), /* ACPI 3.0 opcodes */ diff --git a/sys/contrib/dev/acpica/psparse.c b/sys/contrib/dev/acpica/parser/psparse.c index e0afab84ed87..d9d6a2944bb5 100644 --- a/sys/contrib/dev/acpica/psparse.c +++ b/sys/contrib/dev/acpica/parser/psparse.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: psparse - Parser top level AML parse routines - * $Revision: 1.171 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -124,12 +123,13 @@ * templates in AmlOpInfo[] */ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acparser.h> -#include <contrib/dev/acpica/acdispat.h> -#include <contrib/dev/acpica/amlcode.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/acinterp.h> +#include "acpi.h" +#include "accommon.h" +#include "acparser.h" +#include "acdispat.h" +#include "amlcode.h" +#include "acnamesp.h" +#include "acinterp.h" #define _COMPONENT ACPI_PARSER ACPI_MODULE_NAME ("psparse") @@ -222,6 +222,7 @@ AcpiPsCompleteThisOp ( ACPI_PARSE_OBJECT *Next; const ACPI_OPCODE_INFO *ParentInfo; ACPI_PARSE_OBJECT *ReplacementOp = NULL; + ACPI_STATUS Status = AE_OK; ACPI_FUNCTION_TRACE_PTR (PsCompleteThisOp, Op); @@ -274,7 +275,7 @@ AcpiPsCompleteThisOp ( ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP); if (!ReplacementOp) { - goto AllocateError; + Status = AE_NO_MEMORY; } break; @@ -288,12 +289,13 @@ AcpiPsCompleteThisOp ( (Op->Common.Parent->Common.AmlOpcode == AML_DATA_REGION_OP) || (Op->Common.Parent->Common.AmlOpcode == AML_BUFFER_OP) || (Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) || + (Op->Common.Parent->Common.AmlOpcode == AML_BANK_FIELD_OP) || (Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP)) { ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP); if (!ReplacementOp) { - goto AllocateError; + Status = AE_NO_MEMORY; } } else if ((Op->Common.Parent->Common.AmlOpcode == AML_NAME_OP) && @@ -306,11 +308,13 @@ AcpiPsCompleteThisOp ( ReplacementOp = AcpiPsAllocOp (Op->Common.AmlOpcode); if (!ReplacementOp) { - goto AllocateError; + Status = AE_NO_MEMORY; + } + else + { + ReplacementOp->Named.Data = Op->Named.Data; + ReplacementOp->Named.Length = Op->Named.Length; } - - ReplacementOp->Named.Data = Op->Named.Data; - ReplacementOp->Named.Length = Op->Named.Length; } } break; @@ -320,7 +324,7 @@ AcpiPsCompleteThisOp ( ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP); if (!ReplacementOp) { - goto AllocateError; + Status = AE_NO_MEMORY; } } @@ -378,15 +382,7 @@ Cleanup: /* Now we can actually delete the subtree rooted at Op */ AcpiPsDeleteParseTree (Op); - return_ACPI_STATUS (AE_OK); - - -AllocateError: - - /* Always delete the subtree, even on error */ - - AcpiPsDeleteParseTree (Op); - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS (Status); } @@ -544,12 +540,23 @@ AcpiPsParseAml ( WalkState, WalkState->ParserState.Aml, WalkState->ParserState.AmlSize)); + if (!WalkState->ParserState.Aml) + { + return_ACPI_STATUS (AE_NULL_OBJECT); + } /* Create and initialize a new thread state */ Thread = AcpiUtCreateThreadState (); if (!Thread) { + if (WalkState->MethodDesc) + { + /* Executing a control method - additional cleanup */ + + AcpiDsTerminateControlMethod (WalkState->MethodDesc, WalkState); + } + AcpiDsDeleteWalkState (WalkState); return_ACPI_STATUS (AE_NO_MEMORY); } @@ -630,7 +637,8 @@ AcpiPsParseAml ( if ((Status == AE_ALREADY_EXISTS) && (!WalkState->MethodDesc->Method.Mutex)) { - ACPI_INFO ((AE_INFO, "Marking method %4.4s as Serialized", + ACPI_INFO ((AE_INFO, + "Marking method %4.4s as Serialized because of AE_ALREADY_EXISTS error", WalkState->MethodNode->Name.Ascii)); /* @@ -689,6 +697,25 @@ AcpiPsParseAml ( */ if (!PreviousWalkState->ReturnDesc) { + /* + * In slack mode execution, if there is no return value + * we should implicitly return zero (0) as a default value. + */ + if (AcpiGbl_EnableInterpreterSlack && + !PreviousWalkState->ImplicitReturnObj) + { + PreviousWalkState->ImplicitReturnObj = + AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); + if (!PreviousWalkState->ImplicitReturnObj) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + + PreviousWalkState->ImplicitReturnObj->Integer.Value = 0; + } + + /* Restart the calling control method */ + Status = AcpiDsRestartControlMethod (WalkState, PreviousWalkState->ImplicitReturnObj); } @@ -710,9 +737,10 @@ AcpiPsParseAml ( } else { - /* On error, delete any return object */ + /* On error, delete any return object or implicit return */ AcpiUtRemoveReference (PreviousWalkState->ReturnDesc); + AcpiDsClearImplicitReturn (PreviousWalkState); } } diff --git a/sys/contrib/dev/acpica/psscope.c b/sys/contrib/dev/acpica/parser/psscope.c index ea0a613b722c..979dbb151514 100644 --- a/sys/contrib/dev/acpica/psscope.c +++ b/sys/contrib/dev/acpica/parser/psscope.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: psscope - Parser scope stack management routines - * $Revision: 1.47 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -115,8 +114,9 @@ *****************************************************************************/ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acparser.h> +#include "acpi.h" +#include "accommon.h" +#include "acparser.h" #define _COMPONENT ACPI_PARSER ACPI_MODULE_NAME ("psscope") diff --git a/sys/contrib/dev/acpica/pstree.c b/sys/contrib/dev/acpica/parser/pstree.c index f6f017021f88..20ac405cac3a 100644 --- a/sys/contrib/dev/acpica/pstree.c +++ b/sys/contrib/dev/acpica/parser/pstree.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: pstree - Parser op tree manipulation/traversal/search - * $Revision: 1.51 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,9 +116,10 @@ #define __PSTREE_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acparser.h> -#include <contrib/dev/acpica/amlcode.h> +#include "acpi.h" +#include "accommon.h" +#include "acparser.h" +#include "amlcode.h" #define _COMPONENT ACPI_PARSER ACPI_MODULE_NAME ("pstree") diff --git a/sys/contrib/dev/acpica/psutils.c b/sys/contrib/dev/acpica/parser/psutils.c index e8c8cf0d9060..42f2b015d6c2 100644 --- a/sys/contrib/dev/acpica/psutils.c +++ b/sys/contrib/dev/acpica/parser/psutils.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: psutils - Parser miscellaneous utilities (Parser only) - * $Revision: 1.70 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -115,9 +114,10 @@ *****************************************************************************/ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acparser.h> -#include <contrib/dev/acpica/amlcode.h> +#include "acpi.h" +#include "accommon.h" +#include "acparser.h" +#include "amlcode.h" #define _COMPONENT ACPI_PARSER ACPI_MODULE_NAME ("psutils") diff --git a/sys/contrib/dev/acpica/pswalk.c b/sys/contrib/dev/acpica/parser/pswalk.c index af4099faac48..d8d5f5e6f21d 100644 --- a/sys/contrib/dev/acpica/pswalk.c +++ b/sys/contrib/dev/acpica/parser/pswalk.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: pswalk - Parser routines to walk parsed op tree(s) - * $Revision: 1.78 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -115,8 +114,9 @@ *****************************************************************************/ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acparser.h> +#include "acpi.h" +#include "accommon.h" +#include "acparser.h" #define _COMPONENT ACPI_PARSER ACPI_MODULE_NAME ("pswalk") diff --git a/sys/contrib/dev/acpica/psxface.c b/sys/contrib/dev/acpica/parser/psxface.c index b1ff8e8e6858..d63abb6f4e47 100644 --- a/sys/contrib/dev/acpica/psxface.c +++ b/sys/contrib/dev/acpica/parser/psxface.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: psxface - Parser external interfaces - * $Revision: 1.93 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,10 +115,12 @@ #define __PSXFACE_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acparser.h> -#include <contrib/dev/acpica/acdispat.h> -#include <contrib/dev/acpica/acinterp.h> +#include "acpi.h" +#include "accommon.h" +#include "acparser.h" +#include "acdispat.h" +#include "acinterp.h" +#include "amlcode.h" #define _COMPONENT ACPI_PARSER @@ -393,6 +394,40 @@ AcpiPsExecuteMethod ( goto Cleanup; } + /* Invoke an internal method if necessary */ + + if (Info->ObjDesc->Method.MethodFlags & AML_METHOD_INTERNAL_ONLY) + { + Status = Info->ObjDesc->Method.Implementation (WalkState); + Info->ReturnObject = WalkState->ReturnDesc; + + /* Cleanup states */ + + AcpiDsScopeStackClear (WalkState); + AcpiPsCleanupScope (&WalkState->ParserState); + AcpiDsTerminateControlMethod (WalkState->MethodDesc, WalkState); + AcpiDsDeleteWalkState (WalkState); + goto Cleanup; + } + + /* + * Start method evaluation with an implicit return of zero. This is done + * for Windows compatibility. + */ + if (AcpiGbl_EnableInterpreterSlack) + { + WalkState->ImplicitReturnObj = + AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); + if (!WalkState->ImplicitReturnObj) + { + Status = AE_NO_MEMORY; + AcpiDsDeleteWalkState (WalkState); + goto Cleanup; + } + + WalkState->ImplicitReturnObj->Integer.Value = 0; + } + /* Parse the AML */ Status = AcpiPsParseAml (WalkState); @@ -453,11 +488,10 @@ AcpiPsUpdateParameterList ( ACPI_EVALUATE_INFO *Info, UINT16 Action) { - ACPI_NATIVE_UINT i; + UINT32 i; - if ((Info->ParameterType == ACPI_PARAM_ARGS) && - (Info->Parameters)) + if (Info->Parameters) { /* Update reference count for each parameter */ diff --git a/sys/contrib/dev/acpica/rsaddr.c b/sys/contrib/dev/acpica/resources/rsaddr.c index 6a11937f3a76..f2f3c4421f66 100644 --- a/sys/contrib/dev/acpica/rsaddr.c +++ b/sys/contrib/dev/acpica/resources/rsaddr.c @@ -1,7 +1,6 @@ /******************************************************************************* * * Module Name: rsaddr - Address resource descriptors (16/32/64) - * $Revision: 1.50 $ * ******************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,8 +115,9 @@ #define __RSADDR_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acresrc.h> +#include "acpi.h" +#include "accommon.h" +#include "acresrc.h" #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME ("rsaddr") diff --git a/sys/contrib/dev/acpica/rscalc.c b/sys/contrib/dev/acpica/resources/rscalc.c index d04568abbbb6..76aa44ff839a 100644 --- a/sys/contrib/dev/acpica/rscalc.c +++ b/sys/contrib/dev/acpica/resources/rscalc.c @@ -1,7 +1,6 @@ /******************************************************************************* * * Module Name: rscalc - Calculate stream and list lengths - * $Revision: 1.80 $ * ******************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,10 +115,11 @@ #define __RSCALC_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acresrc.h> -#include <contrib/dev/acpica/amlcode.h> -#include <contrib/dev/acpica/acnamesp.h> +#include "acpi.h" +#include "accommon.h" +#include "acresrc.h" +#include "acnamesp.h" + #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME ("rscalc") @@ -168,7 +168,7 @@ AcpiRsCountSetBits ( { /* Zero the least significant bit that is set */ - BitField &= (BitField - 1); + BitField &= (UINT16) (BitField - 1); } return (BitsSet); @@ -312,6 +312,28 @@ AcpiRsGetAmlLength ( */ switch (Resource->Type) { + case ACPI_RESOURCE_TYPE_IRQ: + + /* Length can be 3 or 2 */ + + if (Resource->Data.Irq.DescriptorLength == 2) + { + TotalSize--; + } + break; + + + case ACPI_RESOURCE_TYPE_START_DEPENDENT: + + /* Length can be 1 or 0 */ + + if (Resource->Data.Irq.DescriptorLength == 0) + { + TotalSize--; + } + break; + + case ACPI_RESOURCE_TYPE_VENDOR: /* * Vendor Defined Resource: @@ -634,6 +656,14 @@ AcpiRsGetPciRoutingTableLength ( PackageElement = *TopObjectList; + /* We must have a valid Package object */ + + if (!PackageElement || + (PackageElement->Common.Type != ACPI_TYPE_PACKAGE)) + { + return_ACPI_STATUS (AE_AML_OPERAND_TYPE); + } + /* * The SubObjectList will now point to an array of the * four IRQ elements: Address, Pin, Source and SourceIndex @@ -649,13 +679,13 @@ AcpiRsGetPciRoutingTableLength ( if (*SubObjectList && /* Null object allowed */ ((ACPI_TYPE_STRING == - ACPI_GET_OBJECT_TYPE (*SubObjectList)) || + (*SubObjectList)->Common.Type) || ((ACPI_TYPE_LOCAL_REFERENCE == - ACPI_GET_OBJECT_TYPE (*SubObjectList)) && + (*SubObjectList)->Common.Type) && - ((*SubObjectList)->Reference.Opcode == - AML_INT_NAMEPATH_OP)))) + ((*SubObjectList)->Reference.Class == + ACPI_REFCLASS_NAME)))) { NameFound = TRUE; } @@ -673,7 +703,7 @@ AcpiRsGetPciRoutingTableLength ( if (NameFound) { - if (ACPI_GET_OBJECT_TYPE (*SubObjectList) == ACPI_TYPE_STRING) + if ((*SubObjectList)->Common.Type == ACPI_TYPE_STRING) { /* * The length String.Length field does not include the diff --git a/sys/contrib/dev/acpica/rscreate.c b/sys/contrib/dev/acpica/resources/rscreate.c index 6b986ea4c1d4..e9c840b64e58 100644 --- a/sys/contrib/dev/acpica/rscreate.c +++ b/sys/contrib/dev/acpica/resources/rscreate.c @@ -1,7 +1,6 @@ /******************************************************************************* * * Module Name: rscreate - Create resource lists/tables - * $Revision: 1.78 $ * ******************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -114,13 +113,12 @@ * *****************************************************************************/ - #define __RSCREATE_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acresrc.h> -#include <contrib/dev/acpica/amlcode.h> -#include <contrib/dev/acpica/acnamesp.h> +#include "acpi.h" +#include "accommon.h" +#include "acresrc.h" +#include "acnamesp.h" #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME ("rscreate") @@ -271,9 +269,9 @@ AcpiRsCreatePciRoutingTable ( } /* - * Loop through the ACPI_INTERNAL_OBJECTS - Each object - * should be a package that in turn contains an - * ACPI_INTEGER Address, a UINT8 Pin, a Name and a UINT8 SourceIndex. + * Loop through the ACPI_INTERNAL_OBJECTS - Each object should be a + * package that in turn contains an ACPI_INTEGER Address, a UINT8 Pin, + * a Name, and a UINT8 SourceIndex. */ TopObjectList = PackageObject->Package.Elements; NumberOfElements = PackageObject->Package.Count; @@ -300,7 +298,7 @@ AcpiRsCreatePciRoutingTable ( /* Each element of the top-level package must also be a package */ - if (ACPI_GET_OBJECT_TYPE (*TopObjectList) != ACPI_TYPE_PACKAGE) + if ((*TopObjectList)->Common.Type != ACPI_TYPE_PACKAGE) { ACPI_ERROR ((AE_INFO, "(PRT[%X]) Need sub-package, found %s", @@ -328,33 +326,44 @@ AcpiRsCreatePciRoutingTable ( /* 1) First subobject: Dereference the PRT.Address */ ObjDesc = SubObjectList[0]; - if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER) - { - UserPrt->Address = ObjDesc->Integer.Value; - } - else + if (ObjDesc->Common.Type != ACPI_TYPE_INTEGER) { - ACPI_ERROR ((AE_INFO, - "(PRT[%X].Address) Need Integer, found %s", + ACPI_ERROR ((AE_INFO, "(PRT[%X].Address) Need Integer, found %s", Index, AcpiUtGetObjectTypeName (ObjDesc))); return_ACPI_STATUS (AE_BAD_DATA); } + UserPrt->Address = ObjDesc->Integer.Value; + /* 2) Second subobject: Dereference the PRT.Pin */ ObjDesc = SubObjectList[1]; - if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER) + if (ObjDesc->Common.Type != ACPI_TYPE_INTEGER) { - UserPrt->Pin = (UINT32) ObjDesc->Integer.Value; - } - else - { - ACPI_ERROR ((AE_INFO, - "(PRT[%X].Pin) Need Integer, found %s", + ACPI_ERROR ((AE_INFO, "(PRT[%X].Pin) Need Integer, found %s", Index, AcpiUtGetObjectTypeName (ObjDesc))); return_ACPI_STATUS (AE_BAD_DATA); } + UserPrt->Pin = (UINT32) ObjDesc->Integer.Value; + + /* + * If the BIOS has erroneously reversed the _PRT SourceName (index 2) + * and the SourceIndex (index 3), fix it. _PRT is important enough to + * workaround this BIOS error. This also provides compatibility with + * other ACPI implementations. + */ + ObjDesc = SubObjectList[3]; + if (!ObjDesc || (ObjDesc->Common.Type != ACPI_TYPE_INTEGER)) + { + SubObjectList[3] = SubObjectList[2]; + SubObjectList[2] = ObjDesc; + + ACPI_WARNING ((AE_INFO, + "(PRT[%X].Source) SourceName and SourceIndex are reversed, fixed", + Index)); + } + /* * 3) Third subobject: Dereference the PRT.SourceName * The name may be unresolved (slack mode), so allow a null object @@ -362,15 +371,15 @@ AcpiRsCreatePciRoutingTable ( ObjDesc = SubObjectList[2]; if (ObjDesc) { - switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) + switch (ObjDesc->Common.Type) { case ACPI_TYPE_LOCAL_REFERENCE: - if (ObjDesc->Reference.Opcode != AML_INT_NAMEPATH_OP) + if (ObjDesc->Reference.Class != ACPI_REFCLASS_NAME) { ACPI_ERROR ((AE_INFO, - "(PRT[%X].Source) Need name, found reference op %X", - Index, ObjDesc->Reference.Opcode)); + "(PRT[%X].Source) Need name, found Reference Class %X", + Index, ObjDesc->Reference.Class)); return_ACPI_STATUS (AE_BAD_DATA); } @@ -430,11 +439,7 @@ AcpiRsCreatePciRoutingTable ( /* 4) Fourth subobject: Dereference the PRT.SourceIndex */ ObjDesc = SubObjectList[3]; - if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER) - { - UserPrt->SourceIndex = (UINT32) ObjDesc->Integer.Value; - } - else + if (ObjDesc->Common.Type != ACPI_TYPE_INTEGER) { ACPI_ERROR ((AE_INFO, "(PRT[%X].SourceIndex) Need Integer, found %s", @@ -442,6 +447,8 @@ AcpiRsCreatePciRoutingTable ( return_ACPI_STATUS (AE_BAD_DATA); } + UserPrt->SourceIndex = (UINT32) ObjDesc->Integer.Value; + /* Point to the next ACPI_OPERAND_OBJECT in the top level package */ TopObjectList++; diff --git a/sys/contrib/dev/acpica/rsdump.c b/sys/contrib/dev/acpica/resources/rsdump.c index eec3df9b577d..62db284c6f37 100644 --- a/sys/contrib/dev/acpica/rsdump.c +++ b/sys/contrib/dev/acpica/resources/rsdump.c @@ -1,7 +1,6 @@ /******************************************************************************* * * Module Name: rsdump - Functions to display the resource structures. - * $Revision: 1.62 $ * ******************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,8 +116,9 @@ #define __RSDUMP_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acresrc.h> +#include "acpi.h" +#include "accommon.h" +#include "acresrc.h" #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME ("rsdump") @@ -200,9 +200,10 @@ AcpiRsDumpDescriptor ( * ******************************************************************************/ -ACPI_RSDUMP_INFO AcpiRsDumpIrq[6] = +ACPI_RSDUMP_INFO AcpiRsDumpIrq[7] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpIrq), "IRQ", NULL}, + {ACPI_RSD_UINT8 , ACPI_RSD_OFFSET (Irq.DescriptorLength), "Descriptor Length", NULL}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Triggering), "Triggering", AcpiGbl_HeDecode}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Polarity), "Polarity", AcpiGbl_LlDecode}, {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Sharable), "Sharing", AcpiGbl_ShrDecode}, @@ -220,9 +221,10 @@ ACPI_RSDUMP_INFO AcpiRsDumpDma[6] = {ACPI_RSD_SHORTLIST,ACPI_RSD_OFFSET (Dma.Channels[0]), "Channel List", NULL} }; -ACPI_RSDUMP_INFO AcpiRsDumpStartDpf[3] = +ACPI_RSDUMP_INFO AcpiRsDumpStartDpf[4] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpStartDpf), "Start-Dependent-Functions",NULL}, + {ACPI_RSD_UINT8 , ACPI_RSD_OFFSET (StartDpf.DescriptorLength), "Descriptor Length", NULL}, {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (StartDpf.CompatibilityPriority), "Compatibility Priority", AcpiGbl_ConfigDecode}, {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (StartDpf.PerformanceRobustness), "Performance/Robustness", AcpiGbl_ConfigDecode} }; diff --git a/sys/contrib/dev/acpica/rsinfo.c b/sys/contrib/dev/acpica/resources/rsinfo.c index f5c1e0b766b1..abf79943d971 100644 --- a/sys/contrib/dev/acpica/rsinfo.c +++ b/sys/contrib/dev/acpica/resources/rsinfo.c @@ -1,7 +1,6 @@ /******************************************************************************* * * Module Name: rsinfo - Dispatch and Info tables - * $Revision: 1.8 $ * ******************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,8 +115,9 @@ #define __RSINFO_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acresrc.h> +#include "acpi.h" +#include "accommon.h" +#include "acresrc.h" #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME ("rsinfo") diff --git a/sys/contrib/dev/acpica/rsio.c b/sys/contrib/dev/acpica/resources/rsio.c index 52229796d036..fb9213dd72e9 100644 --- a/sys/contrib/dev/acpica/rsio.c +++ b/sys/contrib/dev/acpica/resources/rsio.c @@ -1,7 +1,6 @@ /******************************************************************************* * * Module Name: rsio - IO and DMA resource descriptors - * $Revision: 1.35 $ * ******************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,8 +115,9 @@ #define __RSIO_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acresrc.h> +#include "acpi.h" +#include "accommon.h" +#include "acresrc.h" #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME ("rsio") @@ -272,7 +272,7 @@ ACPI_RSCONVERT_INFO AcpiRsConvertEndTag[2] = * ******************************************************************************/ -ACPI_RSCONVERT_INFO AcpiRsGetStartDpf[5] = +ACPI_RSCONVERT_INFO AcpiRsGetStartDpf[6] = { {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_START_DEPENDENT, ACPI_RS_SIZE (ACPI_RESOURCE_START_DEPENDENT), @@ -284,6 +284,12 @@ ACPI_RSCONVERT_INFO AcpiRsGetStartDpf[5] = ACPI_ACCEPTABLE_CONFIGURATION, 2}, + /* Get the descriptor length (0 or 1 for Start Dpf descriptor) */ + + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.StartDpf.DescriptorLength), + AML_OFFSET (StartDpf.DescriptorType), + 0}, + /* All done if there is no flag byte present in the descriptor */ {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_AML_LENGTH, 0, 1}, @@ -306,8 +312,10 @@ ACPI_RSCONVERT_INFO AcpiRsGetStartDpf[5] = * ******************************************************************************/ -ACPI_RSCONVERT_INFO AcpiRsSetStartDpf[6] = +ACPI_RSCONVERT_INFO AcpiRsSetStartDpf[10] = { + /* Start with a default descriptor of length 1 */ + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_START_DEPENDENT, sizeof (AML_RESOURCE_START_DEPENDENT), ACPI_RSC_TABLE_SIZE (AcpiRsSetStartDpf)}, @@ -322,6 +330,33 @@ ACPI_RSCONVERT_INFO AcpiRsSetStartDpf[6] = AML_OFFSET (StartDpf.Flags), 2}, /* + * All done if the output descriptor length is required to be 1 + * (i.e., optimization to 0 bytes cannot be attempted) + */ + {ACPI_RSC_EXIT_EQ, ACPI_RSC_COMPARE_VALUE, + ACPI_RS_OFFSET(Data.StartDpf.DescriptorLength), + 1}, + + /* Set length to 0 bytes (no flags byte) */ + + {ACPI_RSC_LENGTH, 0, 0, sizeof (AML_RESOURCE_START_DEPENDENT_NOPRIO)}, + + /* + * All done if the output descriptor length is required to be 0. + * + * TBD: Perhaps we should check for error if input flags are not + * compatible with a 0-byte descriptor. + */ + {ACPI_RSC_EXIT_EQ, ACPI_RSC_COMPARE_VALUE, + ACPI_RS_OFFSET(Data.StartDpf.DescriptorLength), + 0}, + + /* Reset length to 1 byte (descriptor with flags byte) */ + + {ACPI_RSC_LENGTH, 0, 0, sizeof (AML_RESOURCE_START_DEPENDENT)}, + + + /* * All done if flags byte is necessary -- if either priority value * is not ACPI_ACCEPTABLE_CONFIGURATION */ diff --git a/sys/contrib/dev/acpica/rsirq.c b/sys/contrib/dev/acpica/resources/rsirq.c index abf72c6f8821..7eab43513996 100644 --- a/sys/contrib/dev/acpica/rsirq.c +++ b/sys/contrib/dev/acpica/resources/rsirq.c @@ -1,7 +1,6 @@ /******************************************************************************* * * Module Name: rsirq - IRQ resource descriptors - * $Revision: 1.50 $ * ******************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,8 +115,9 @@ #define __RSIRQ_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acresrc.h> +#include "acpi.h" +#include "accommon.h" +#include "acresrc.h" #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME ("rsirq") @@ -129,7 +129,7 @@ * ******************************************************************************/ -ACPI_RSCONVERT_INFO AcpiRsGetIrq[7] = +ACPI_RSCONVERT_INFO AcpiRsGetIrq[8] = { {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_IRQ, ACPI_RS_SIZE (ACPI_RESOURCE_IRQ), @@ -147,6 +147,12 @@ ACPI_RSCONVERT_INFO AcpiRsGetIrq[7] = ACPI_EDGE_SENSITIVE, 1}, + /* Get the descriptor length (2 or 3 for IRQ descriptor) */ + + {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.Irq.DescriptorLength), + AML_OFFSET (Irq.DescriptorType), + 0}, + /* All done if no flag byte present in descriptor */ {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_AML_LENGTH, 0, 3}, @@ -173,8 +179,10 @@ ACPI_RSCONVERT_INFO AcpiRsGetIrq[7] = * ******************************************************************************/ -ACPI_RSCONVERT_INFO AcpiRsSetIrq[9] = +ACPI_RSCONVERT_INFO AcpiRsSetIrq[13] = { + /* Start with a default descriptor of length 3 */ + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_IRQ, sizeof (AML_RESOURCE_IRQ), ACPI_RSC_TABLE_SIZE (AcpiRsSetIrq)}, @@ -185,7 +193,7 @@ ACPI_RSCONVERT_INFO AcpiRsSetIrq[9] = AML_OFFSET (Irq.IrqMask), ACPI_RS_OFFSET (Data.Irq.InterruptCount)}, - /* Set the flags byte by default */ + /* Set the flags byte */ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Irq.Triggering), AML_OFFSET (Irq.Flags), @@ -198,6 +206,33 @@ ACPI_RSCONVERT_INFO AcpiRsSetIrq[9] = {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Irq.Sharable), AML_OFFSET (Irq.Flags), 4}, + + /* + * All done if the output descriptor length is required to be 3 + * (i.e., optimization to 2 bytes cannot be attempted) + */ + {ACPI_RSC_EXIT_EQ, ACPI_RSC_COMPARE_VALUE, + ACPI_RS_OFFSET(Data.Irq.DescriptorLength), + 3}, + + /* Set length to 2 bytes (no flags byte) */ + + {ACPI_RSC_LENGTH, 0, 0, sizeof (AML_RESOURCE_IRQ_NOFLAGS)}, + + /* + * All done if the output descriptor length is required to be 2. + * + * TBD: Perhaps we should check for error if input flags are not + * compatible with a 2-byte descriptor. + */ + {ACPI_RSC_EXIT_EQ, ACPI_RSC_COMPARE_VALUE, + ACPI_RS_OFFSET(Data.Irq.DescriptorLength), + 2}, + + /* Reset length to 3 bytes (descriptor with flags byte) */ + + {ACPI_RSC_LENGTH, 0, 0, sizeof (AML_RESOURCE_IRQ)}, + /* * Check if the flags byte is necessary. Not needed if the flags are: * ACPI_EDGE_SENSITIVE, ACPI_ACTIVE_HIGH, ACPI_EXCLUSIVE @@ -214,7 +249,7 @@ ACPI_RSCONVERT_INFO AcpiRsSetIrq[9] = ACPI_RS_OFFSET (Data.Irq.Sharable), ACPI_EXCLUSIVE}, - /* IrqNoFlags() descriptor can be used */ + /* We can optimize to a 2-byte IrqNoFlags() descriptor */ {ACPI_RSC_LENGTH, 0, 0, sizeof (AML_RESOURCE_IRQ_NOFLAGS)} }; diff --git a/sys/contrib/dev/acpica/rslist.c b/sys/contrib/dev/acpica/resources/rslist.c index 37a0764e44e7..3adce2b39398 100644 --- a/sys/contrib/dev/acpica/rslist.c +++ b/sys/contrib/dev/acpica/resources/rslist.c @@ -1,7 +1,6 @@ /******************************************************************************* * * Module Name: rslist - Linked list utilities - * $Revision: 1.62 $ * ******************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,8 +115,9 @@ #define __RSLIST_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acresrc.h> +#include "acpi.h" +#include "accommon.h" +#include "acresrc.h" #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME ("rslist") diff --git a/sys/contrib/dev/acpica/rsmemory.c b/sys/contrib/dev/acpica/resources/rsmemory.c index e4ab62d18269..a3d08c01a1b7 100644 --- a/sys/contrib/dev/acpica/rsmemory.c +++ b/sys/contrib/dev/acpica/resources/rsmemory.c @@ -1,7 +1,6 @@ /******************************************************************************* * * Module Name: rsmem24 - Memory resource descriptors - * $Revision: 1.34 $ * ******************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,8 +115,9 @@ #define __RSMEMORY_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acresrc.h> +#include "acpi.h" +#include "accommon.h" +#include "acresrc.h" #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME ("rsmemory") diff --git a/sys/contrib/dev/acpica/rsmisc.c b/sys/contrib/dev/acpica/resources/rsmisc.c index 6150bdea8603..3565334e7324 100644 --- a/sys/contrib/dev/acpica/rsmisc.c +++ b/sys/contrib/dev/acpica/resources/rsmisc.c @@ -1,7 +1,6 @@ /******************************************************************************* * * Module Name: rsmisc - Miscellaneous resource descriptors - * $Revision: 1.46 $ * ******************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,8 +115,9 @@ #define __RSMISC_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acresrc.h> +#include "acpi.h" +#include "accommon.h" +#include "acresrc.h" #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME ("rsmisc") @@ -166,7 +166,7 @@ AcpiRsConvertAmlToResource ( ACPI_FUNCTION_TRACE (RsConvertAmlToResource); - if (((ACPI_NATIVE_UINT) Resource) & 0x3) + if (((ACPI_SIZE) Resource) & 0x3) { /* Each internal resource struct is expected to be 32-bit aligned */ @@ -610,6 +610,18 @@ AcpiRsConvertResourceToAml ( break; + case ACPI_RSC_EXIT_EQ: + /* + * Control - Exit conversion if equal + */ + if (*ACPI_ADD_PTR (UINT8, Resource, + COMPARE_TARGET (Info)) == COMPARE_VALUE (Info)) + { + goto Exit; + } + break; + + default: ACPI_ERROR ((AE_INFO, "Invalid conversion opcode")); diff --git a/sys/contrib/dev/acpica/rsutils.c b/sys/contrib/dev/acpica/resources/rsutils.c index 369eb868852a..4e0f04ce8e52 100644 --- a/sys/contrib/dev/acpica/rsutils.c +++ b/sys/contrib/dev/acpica/resources/rsutils.c @@ -1,7 +1,6 @@ /******************************************************************************* * * Module Name: rsutils - Utilities for the resource manager - * $Revision: 1.67 $ * ******************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,9 +116,10 @@ #define __RSUTILS_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/acresrc.h> +#include "acpi.h" +#include "accommon.h" +#include "acnamesp.h" +#include "acresrc.h" #define _COMPONENT ACPI_RESOURCES @@ -144,7 +144,7 @@ AcpiRsDecodeBitmask ( UINT16 Mask, UINT8 *List) { - ACPI_NATIVE_UINT i; + UINT8 i; UINT8 BitCount; @@ -157,7 +157,7 @@ AcpiRsDecodeBitmask ( { if (Mask & 0x0001) { - List[BitCount] = (UINT8) i; + List[BitCount] = i; BitCount++; } @@ -186,7 +186,7 @@ AcpiRsEncodeBitmask ( UINT8 *List, UINT8 Count) { - ACPI_NATIVE_UINT i; + UINT32 i; UINT16 Mask; @@ -197,7 +197,7 @@ AcpiRsEncodeBitmask ( for (i = 0, Mask = 0; i < Count; i++) { - Mask |= (0x0001 << List[i]); + Mask |= (0x1 << List[i]); } return (Mask); @@ -228,7 +228,7 @@ AcpiRsMoveData ( UINT16 ItemCount, UINT8 MoveType) { - ACPI_NATIVE_UINT i; + UINT32 i; ACPI_FUNCTION_ENTRY (); @@ -824,7 +824,6 @@ AcpiRsSetSrsMethodData ( Info->PrefixNode = Node; Info->Pathname = METHOD_NAME__SRS; Info->Parameters = Args; - Info->ParameterType = ACPI_PARAM_ARGS; Info->Flags = ACPI_IGNORE_RETURN_VALUE; /* diff --git a/sys/contrib/dev/acpica/rsxface.c b/sys/contrib/dev/acpica/resources/rsxface.c index a27331e32ad2..32ed559569f3 100644 --- a/sys/contrib/dev/acpica/rsxface.c +++ b/sys/contrib/dev/acpica/resources/rsxface.c @@ -1,7 +1,6 @@ /******************************************************************************* * * Module Name: rsxface - Public interfaces to the resource manager - * $Revision: 1.48 $ * ******************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,9 +116,10 @@ #define __RSXFACE_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acresrc.h> -#include <contrib/dev/acpica/acnamesp.h> +#include "acpi.h" +#include "accommon.h" +#include "acresrc.h" +#include "acnamesp.h" #define _COMPONENT ACPI_RESOURCES ACPI_MODULE_NAME ("rsxface") @@ -460,13 +460,13 @@ AcpiResourceToAddress64 ( { case ACPI_RESOURCE_TYPE_ADDRESS16: - Address16 = (ACPI_RESOURCE_ADDRESS16 *) &Resource->Data; + Address16 = ACPI_CAST_PTR (ACPI_RESOURCE_ADDRESS16, &Resource->Data); ACPI_COPY_ADDRESS (Out, Address16); break; case ACPI_RESOURCE_TYPE_ADDRESS32: - Address32 = (ACPI_RESOURCE_ADDRESS32 *) &Resource->Data; + Address32 = ACPI_CAST_PTR (ACPI_RESOURCE_ADDRESS32, &Resource->Data); ACPI_COPY_ADDRESS (Out, Address32); break; diff --git a/sys/contrib/dev/acpica/tbfadt.c b/sys/contrib/dev/acpica/tables/tbfadt.c index 554e46427516..c657a0b75ac1 100644 --- a/sys/contrib/dev/acpica/tbfadt.c +++ b/sys/contrib/dev/acpica/tables/tbfadt.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: tbfadt - FADT table utilities - * $Revision: 1.5 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,18 +115,20 @@ #define __TBFADT_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/actables.h> +#include "acpi.h" +#include "accommon.h" +#include "actables.h" #define _COMPONENT ACPI_TABLES ACPI_MODULE_NAME ("tbfadt") /* Local prototypes */ -static void inline +static inline void AcpiTbInitGenericAddress ( ACPI_GENERIC_ADDRESS *GenericAddress, - UINT8 BitWidth, + UINT8 SpaceId, + UINT8 ByteWidth, UINT64 Address); static void @@ -138,15 +139,20 @@ static void AcpiTbValidateFadt ( void); +static void +AcpiTbSetupFadtRegisters ( + void); + /* Table for conversion of FADT to common internal format and FADT validation */ typedef struct acpi_fadt_info { char *Name; - UINT8 Target; - UINT8 Source; + UINT8 Address64; + UINT8 Address32; UINT8 Length; + UINT8 DefaultLength; UINT8 Type; } ACPI_FADT_INFO; @@ -156,40 +162,98 @@ typedef struct acpi_fadt_info static ACPI_FADT_INFO FadtInfoTable[] = { - {"Pm1aEventBlock", ACPI_FADT_OFFSET (XPm1aEventBlock), - ACPI_FADT_OFFSET (Pm1aEventBlock), - ACPI_FADT_OFFSET (Pm1EventLength), ACPI_FADT_REQUIRED}, + {"Pm1aEventBlock", + ACPI_FADT_OFFSET (XPm1aEventBlock), + ACPI_FADT_OFFSET (Pm1aEventBlock), + ACPI_FADT_OFFSET (Pm1EventLength), + ACPI_PM1_REGISTER_WIDTH * 2, /* Enable + Status register */ + ACPI_FADT_REQUIRED}, + + {"Pm1bEventBlock", + ACPI_FADT_OFFSET (XPm1bEventBlock), + ACPI_FADT_OFFSET (Pm1bEventBlock), + ACPI_FADT_OFFSET (Pm1EventLength), + ACPI_PM1_REGISTER_WIDTH * 2, /* Enable + Status register */ + 0}, + + {"Pm1aControlBlock", + ACPI_FADT_OFFSET (XPm1aControlBlock), + ACPI_FADT_OFFSET (Pm1aControlBlock), + ACPI_FADT_OFFSET (Pm1ControlLength), + ACPI_PM1_REGISTER_WIDTH, + ACPI_FADT_REQUIRED}, + + {"Pm1bControlBlock", + ACPI_FADT_OFFSET (XPm1bControlBlock), + ACPI_FADT_OFFSET (Pm1bControlBlock), + ACPI_FADT_OFFSET (Pm1ControlLength), + ACPI_PM1_REGISTER_WIDTH, + 0}, + + {"Pm2ControlBlock", + ACPI_FADT_OFFSET (XPm2ControlBlock), + ACPI_FADT_OFFSET (Pm2ControlBlock), + ACPI_FADT_OFFSET (Pm2ControlLength), + ACPI_PM2_REGISTER_WIDTH, + ACPI_FADT_SEPARATE_LENGTH}, + + {"PmTimerBlock", + ACPI_FADT_OFFSET (XPmTimerBlock), + ACPI_FADT_OFFSET (PmTimerBlock), + ACPI_FADT_OFFSET (PmTimerLength), + ACPI_PM_TIMER_WIDTH, + ACPI_FADT_REQUIRED}, + + {"Gpe0Block", + ACPI_FADT_OFFSET (XGpe0Block), + ACPI_FADT_OFFSET (Gpe0Block), + ACPI_FADT_OFFSET (Gpe0BlockLength), + 0, + ACPI_FADT_SEPARATE_LENGTH}, + + {"Gpe1Block", + ACPI_FADT_OFFSET (XGpe1Block), + ACPI_FADT_OFFSET (Gpe1Block), + ACPI_FADT_OFFSET (Gpe1BlockLength), + 0, + ACPI_FADT_SEPARATE_LENGTH} +}; + +#define ACPI_FADT_INFO_ENTRIES \ + (sizeof (FadtInfoTable) / sizeof (ACPI_FADT_INFO)) + - {"Pm1bEventBlock", ACPI_FADT_OFFSET (XPm1bEventBlock), - ACPI_FADT_OFFSET (Pm1bEventBlock), - ACPI_FADT_OFFSET (Pm1EventLength), 0}, +/* Table used to split Event Blocks into separate status/enable registers */ - {"Pm1aControlBlock", ACPI_FADT_OFFSET (XPm1aControlBlock), - ACPI_FADT_OFFSET (Pm1aControlBlock), - ACPI_FADT_OFFSET (Pm1ControlLength), ACPI_FADT_REQUIRED}, +typedef struct acpi_fadt_pm_info +{ + ACPI_GENERIC_ADDRESS *Target; + UINT8 Source; + UINT8 RegisterNum; - {"Pm1bControlBlock", ACPI_FADT_OFFSET (XPm1bControlBlock), - ACPI_FADT_OFFSET (Pm1bControlBlock), - ACPI_FADT_OFFSET (Pm1ControlLength), 0}, +} ACPI_FADT_PM_INFO; - {"Pm2ControlBlock", ACPI_FADT_OFFSET (XPm2ControlBlock), - ACPI_FADT_OFFSET (Pm2ControlBlock), - ACPI_FADT_OFFSET (Pm2ControlLength), ACPI_FADT_SEPARATE_LENGTH}, +static ACPI_FADT_PM_INFO FadtPmInfoTable[] = +{ + {&AcpiGbl_XPm1aStatus, + ACPI_FADT_OFFSET (XPm1aEventBlock), + 0}, - {"PmTimerBlock", ACPI_FADT_OFFSET (XPmTimerBlock), - ACPI_FADT_OFFSET (PmTimerBlock), - ACPI_FADT_OFFSET (PmTimerLength), ACPI_FADT_REQUIRED}, + {&AcpiGbl_XPm1aEnable, + ACPI_FADT_OFFSET (XPm1aEventBlock), + 1}, - {"Gpe0Block", ACPI_FADT_OFFSET (XGpe0Block), - ACPI_FADT_OFFSET (Gpe0Block), - ACPI_FADT_OFFSET (Gpe0BlockLength), ACPI_FADT_SEPARATE_LENGTH}, + {&AcpiGbl_XPm1bStatus, + ACPI_FADT_OFFSET (XPm1bEventBlock), + 0}, - {"Gpe1Block", ACPI_FADT_OFFSET (XGpe1Block), - ACPI_FADT_OFFSET (Gpe1Block), - ACPI_FADT_OFFSET (Gpe1BlockLength), ACPI_FADT_SEPARATE_LENGTH} + {&AcpiGbl_XPm1bEnable, + ACPI_FADT_OFFSET (XPm1bEventBlock), + 1} }; -#define ACPI_FADT_INFO_ENTRIES (sizeof (FadtInfoTable) / sizeof (ACPI_FADT_INFO)) +#define ACPI_FADT_PM_INFO_ENTRIES \ + (sizeof (FadtPmInfoTable) / sizeof (ACPI_FADT_PM_INFO)) /******************************************************************************* @@ -197,7 +261,8 @@ static ACPI_FADT_INFO FadtInfoTable[] = * FUNCTION: AcpiTbInitGenericAddress * * PARAMETERS: GenericAddress - GAS struct to be initialized - * BitWidth - Width of this register + * SpaceId - ACPI Space ID for this register + * ByteWidth - Width of this register, in bytes * Address - Address of the register * * RETURN: None @@ -208,10 +273,11 @@ static ACPI_FADT_INFO FadtInfoTable[] = * ******************************************************************************/ -static void inline +static inline void AcpiTbInitGenericAddress ( ACPI_GENERIC_ADDRESS *GenericAddress, - UINT8 BitWidth, + UINT8 SpaceId, + UINT8 ByteWidth, UINT64 Address) { @@ -223,10 +289,10 @@ AcpiTbInitGenericAddress ( /* All other fields are byte-wide */ - GenericAddress->SpaceId = ACPI_ADR_SPACE_SYSTEM_IO; - GenericAddress->BitWidth = BitWidth; + GenericAddress->SpaceId = SpaceId; + GenericAddress->BitWidth = (UINT8) ACPI_MUL_8 (ByteWidth); GenericAddress->BitOffset = 0; - GenericAddress->AccessWidth = 0; + GenericAddress->AccessWidth = 0; /* Access width ANY */ } @@ -235,7 +301,6 @@ AcpiTbInitGenericAddress ( * FUNCTION: AcpiTbParseFadt * * PARAMETERS: TableIndex - Index for the FADT - * Flags - Flags * * RETURN: None * @@ -246,8 +311,7 @@ AcpiTbInitGenericAddress ( void AcpiTbParseFadt ( - ACPI_NATIVE_UINT TableIndex, - UINT8 Flags) + UINT32 TableIndex) { UINT32 Length; ACPI_TABLE_HEADER *Table; @@ -275,7 +339,7 @@ AcpiTbParseFadt ( */ (void) AcpiTbVerifyChecksum (Table, Length); - /* Obtain a local copy of the FADT in common ACPI 2.0+ format */ + /* Create a local copy of the FADT in common ACPI 2.0+ format */ AcpiTbCreateLocalFadt (Table, Length); @@ -286,10 +350,10 @@ AcpiTbParseFadt ( /* Obtain the DSDT and FACS tables via their addresses within the FADT */ AcpiTbInstallTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XDsdt, - Flags, ACPI_SIG_DSDT, ACPI_TABLE_INDEX_DSDT); + ACPI_SIG_DSDT, ACPI_TABLE_INDEX_DSDT); AcpiTbInstallTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XFacs, - Flags, ACPI_SIG_FACS, ACPI_TABLE_INDEX_FACS); + ACPI_SIG_FACS, ACPI_TABLE_INDEX_FACS); } @@ -305,6 +369,8 @@ AcpiTbParseFadt ( * DESCRIPTION: Get a local copy of the FADT and convert it to a common format. * Performs validation on some important FADT fields. * + * NOTE: We create a local copy of the FADT regardless of the version. + * ******************************************************************************/ void @@ -314,29 +380,38 @@ AcpiTbCreateLocalFadt ( { /* - * Check if the FADT is larger than what we know about (ACPI 2.0 version). - * Truncate the table, but make some noise. + * Check if the FADT is larger than the largest table that we expect + * (the ACPI 2.0/3.0 version). If so, truncate the table, and issue + * a warning. */ if (Length > sizeof (ACPI_TABLE_FADT)) { ACPI_WARNING ((AE_INFO, - "FADT (revision %u) is longer than ACPI 2.0 version, truncating length 0x%X to 0x%zX", - Table->Revision, Length, sizeof (ACPI_TABLE_FADT))); + "FADT (revision %u) is longer than ACPI 2.0 version, " + "truncating length 0x%X to 0x%X", + Table->Revision, Length, (UINT32) sizeof (ACPI_TABLE_FADT))); } - /* Copy the entire FADT locally. Zero first for TbConvertFadt */ + /* Clear the entire local FADT */ ACPI_MEMSET (&AcpiGbl_FADT, 0, sizeof (ACPI_TABLE_FADT)); + /* Copy the original FADT, up to sizeof (ACPI_TABLE_FADT) */ + ACPI_MEMCPY (&AcpiGbl_FADT, Table, ACPI_MIN (Length, sizeof (ACPI_TABLE_FADT))); - /* - * 1) Convert the local copy of the FADT to the common internal format - * 2) Validate some of the important values within the FADT - */ + /* Convert the local copy of the FADT to the common internal format */ + AcpiTbConvertFadt (); + + /* Validate FADT values now, before we make any changes */ + AcpiTbValidateFadt (); + + /* Initialize the global ACPI register structures */ + + AcpiTbSetupFadtRegisters (); } @@ -349,23 +424,28 @@ AcpiTbCreateLocalFadt ( * RETURN: None * * DESCRIPTION: Converts all versions of the FADT to a common internal format. - * -> Expand all 32-bit addresses to 64-bit. + * Expand 32-bit addresses to 64-bit as necessary. * * NOTE: AcpiGbl_FADT must be of size (ACPI_TABLE_FADT), * and must contain a copy of the actual FADT. * - * ACPICA will use the "X" fields of the FADT for all addresses. + * Notes on 64-bit register addresses: + * + * After this FADT conversion, later ACPICA code will only use the 64-bit "X" + * fields of the FADT for all ACPI register addresses. * - * "X" fields are optional extensions to the original V1.0 fields. Even if - * they are present in the structure, they can be optionally not used by - * setting them to zero. Therefore, we must selectively expand V1.0 fields - * if the corresponding X field is zero. + * The 64-bit "X" fields are optional extensions to the original 32-bit FADT + * V1.0 fields. Even if they are present in the FADT, they are optional and + * are unused if the BIOS sets them to zero. Therefore, we must copy/expand + * 32-bit V1.0 fields if the corresponding X field is zero. * - * For ACPI 1.0 FADTs, all address fields are expanded to the corresponding - * "X" fields. + * For ACPI 1.0 FADTs, all 32-bit address fields are expanded to the + * corresponding "X" fields in the internal FADT. * - * For ACPI 2.0 FADTs, any "X" fields that are NULL are filled in by - * expanding the corresponding ACPI 1.0 field. + * For ACPI 2.0+ FADTs, all valid (non-zero) 32-bit address fields are expanded + * to the corresponding 64-bit X fields. For compatibility with other ACPI + * implementations, we ignore the 64-bit field if the 32-bit field is valid, + * regardless of whether the host OS is 32-bit or 64-bit. * ******************************************************************************/ @@ -373,73 +453,96 @@ static void AcpiTbConvertFadt ( void) { - UINT8 Pm1RegisterLength; - ACPI_GENERIC_ADDRESS *Target; - ACPI_NATIVE_UINT i; + ACPI_GENERIC_ADDRESS *Address64; + UINT32 Address32; + UINT32 i; /* Update the local FADT table header length */ AcpiGbl_FADT.Header.Length = sizeof (ACPI_TABLE_FADT); - /* Expand the 32-bit FACS and DSDT addresses to 64-bit as necessary */ - + /* + * Expand the 32-bit FACS and DSDT addresses to 64-bit as necessary. + * Later code will always use the X 64-bit field. + */ if (!AcpiGbl_FADT.XFacs) { AcpiGbl_FADT.XFacs = (UINT64) AcpiGbl_FADT.Facs; } - if (!AcpiGbl_FADT.XDsdt) { AcpiGbl_FADT.XDsdt = (UINT64) AcpiGbl_FADT.Dsdt; } /* - * Expand the 32-bit V1.0 addresses to the 64-bit "X" generic address - * structures as necessary. + * For ACPI 1.0 FADTs (revision 1 or 2), ensure that reserved fields which + * should be zero are indeed zero. This will workaround BIOSs that + * inadvertently place values in these fields. + * + * The ACPI 1.0 reserved fields that will be zeroed are the bytes located + * at offset 45, 55, 95, and the word located at offset 109, 110. */ - for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++) + if (AcpiGbl_FADT.Header.Revision < 3) { - Target = ACPI_ADD_PTR ( - ACPI_GENERIC_ADDRESS, &AcpiGbl_FADT, FadtInfoTable[i].Target); - - /* Expand only if the X target is null */ - - if (!Target->Address) - { - AcpiTbInitGenericAddress (Target, - *ACPI_ADD_PTR (UINT8, &AcpiGbl_FADT, FadtInfoTable[i].Length), - (UINT64) *ACPI_ADD_PTR (UINT32, &AcpiGbl_FADT, FadtInfoTable[i].Source)); - } + AcpiGbl_FADT.PreferredProfile = 0; + AcpiGbl_FADT.PstateControl = 0; + AcpiGbl_FADT.CstControl = 0; + AcpiGbl_FADT.BootFlags = 0; } /* - * Calculate separate GAS structs for the PM1 Enable registers. - * These addresses do not appear (directly) in the FADT, so it is - * useful to calculate them once, here. + * Expand the ACPI 1.0 32-bit addresses to the ACPI 2.0 64-bit "X" + * generic address structures as necessary. Later code will always use + * the 64-bit address structures. * - * The PM event blocks are split into two register blocks, first is the - * PM Status Register block, followed immediately by the PM Enable Register - * block. Each is of length (Pm1EventLength/2) + * March 2009: + * We now always use the 32-bit address if it is valid (non-null). This + * is not in accordance with the ACPI specification which states that + * the 64-bit address supersedes the 32-bit version, but we do this for + * compatibility with other ACPI implementations. Most notably, in the + * case where both the 32 and 64 versions are non-null, we use the 32-bit + * version. This is the only address that is guaranteed to have been + * tested by the BIOS manufacturer. */ - Pm1RegisterLength = (UINT8) ACPI_DIV_2 (AcpiGbl_FADT.Pm1EventLength); - - /* The PM1A register block is required */ - - AcpiTbInitGenericAddress (&AcpiGbl_XPm1aEnable, Pm1RegisterLength, - (AcpiGbl_FADT.XPm1aEventBlock.Address + Pm1RegisterLength)); + for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++) + { + Address32 = *ACPI_ADD_PTR (UINT32, + &AcpiGbl_FADT, FadtInfoTable[i].Address32); + + Address64 = ACPI_ADD_PTR (ACPI_GENERIC_ADDRESS, + &AcpiGbl_FADT, FadtInfoTable[i].Address64); + + /* + * If both 32- and 64-bit addresses are valid (non-zero), + * they must match. + */ + if (Address64->Address && Address32 && + (Address64->Address != (UINT64) Address32)) + { + ACPI_ERROR ((AE_INFO, + "32/64X address mismatch in %s: %8.8X/%8.8X%8.8X, using 32", + FadtInfoTable[i].Name, Address32, + ACPI_FORMAT_UINT64 (Address64->Address))); + } - /* The PM1B register block is optional, ignore if not present */ + /* Always use 32-bit address if it is valid (non-null) */ - if (AcpiGbl_FADT.XPm1bEventBlock.Address) - { - AcpiTbInitGenericAddress (&AcpiGbl_XPm1bEnable, Pm1RegisterLength, - (AcpiGbl_FADT.XPm1bEventBlock.Address + Pm1RegisterLength)); + if (Address32) + { + /* + * Copy the 32-bit address to the 64-bit GAS structure. The + * Space ID is always I/O for 32-bit legacy address fields + */ + AcpiTbInitGenericAddress (Address64, ACPI_ADR_SPACE_SYSTEM_IO, + *ACPI_ADD_PTR (UINT8, &AcpiGbl_FADT, FadtInfoTable[i].Length), + (UINT64) Address32); + } } } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiTbValidateFadt * @@ -463,21 +566,64 @@ static void AcpiTbValidateFadt ( void) { - UINT32 *Address32; + char *Name; ACPI_GENERIC_ADDRESS *Address64; UINT8 Length; - ACPI_NATIVE_UINT i; + UINT32 i; + /* + * Check for FACS and DSDT address mismatches. An address mismatch between + * the 32-bit and 64-bit address fields (FIRMWARE_CTRL/X_FIRMWARE_CTRL and + * DSDT/X_DSDT) would indicate the presence of two FACS or two DSDT tables. + */ + if (AcpiGbl_FADT.Facs && + (AcpiGbl_FADT.XFacs != (UINT64) AcpiGbl_FADT.Facs)) + { + ACPI_WARNING ((AE_INFO, + "32/64X FACS address mismatch in FADT - " + "%8.8X/%8.8X%8.8X, using 32", + AcpiGbl_FADT.Facs, ACPI_FORMAT_UINT64 (AcpiGbl_FADT.XFacs))); + + AcpiGbl_FADT.XFacs = (UINT64) AcpiGbl_FADT.Facs; + } + + if (AcpiGbl_FADT.Dsdt && + (AcpiGbl_FADT.XDsdt != (UINT64) AcpiGbl_FADT.Dsdt)) + { + ACPI_WARNING ((AE_INFO, + "32/64X DSDT address mismatch in FADT - " + "%8.8X/%8.8X%8.8X, using 32", + AcpiGbl_FADT.Dsdt, ACPI_FORMAT_UINT64 (AcpiGbl_FADT.XDsdt))); + + AcpiGbl_FADT.XDsdt = (UINT64) AcpiGbl_FADT.Dsdt; + } + /* Examine all of the 64-bit extended address fields (X fields) */ for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++) { - /* Generate pointers to the 32-bit and 64-bit addresses and get the length */ - - Address64 = ACPI_ADD_PTR (ACPI_GENERIC_ADDRESS, &AcpiGbl_FADT, FadtInfoTable[i].Target); - Address32 = ACPI_ADD_PTR (UINT32, &AcpiGbl_FADT, FadtInfoTable[i].Source); - Length = *ACPI_ADD_PTR (UINT8, &AcpiGbl_FADT, FadtInfoTable[i].Length); + /* + * Generate pointer to the 64-bit address, get the register + * length (width) and the register name + */ + Address64 = ACPI_ADD_PTR (ACPI_GENERIC_ADDRESS, + &AcpiGbl_FADT, FadtInfoTable[i].Address64); + Length = *ACPI_ADD_PTR (UINT8, + &AcpiGbl_FADT, FadtInfoTable[i].Length); + Name = FadtInfoTable[i].Name; + + /* + * For each extended field, check for length mismatch between the + * legacy length field and the corresponding 64-bit X length field. + */ + if (Address64->Address && + (Address64->BitWidth != ACPI_MUL_8 (Length))) + { + ACPI_WARNING ((AE_INFO, + "32/64X length mismatch in %s: %d/%d", + Name, ACPI_MUL_8 (Length), Address64->BitWidth)); + } if (FadtInfoTable[i].Type & ACPI_FADT_REQUIRED) { @@ -488,32 +634,118 @@ AcpiTbValidateFadt ( if (!Address64->Address || !Length) { ACPI_ERROR ((AE_INFO, - "Required field \"%s\" has zero address and/or length: %8.8X%8.8X/%X", - FadtInfoTable[i].Name, ACPI_FORMAT_UINT64 (Address64->Address), Length)); + "Required field %s has zero address and/or length:" + " %8.8X%8.8X/%X", + Name, ACPI_FORMAT_UINT64 (Address64->Address), Length)); } } else if (FadtInfoTable[i].Type & ACPI_FADT_SEPARATE_LENGTH) { /* * Field is optional (PM2Control, GPE0, GPE1) AND has its own - * length field. If present, both the address and length must be valid. + * length field. If present, both the address and length must + * be valid. + */ + if ((Address64->Address && !Length) || + (!Address64->Address && Length)) + { + ACPI_WARNING ((AE_INFO, + "Optional field %s has zero address or length: " + "%8.8X%8.8X/%X", + Name, ACPI_FORMAT_UINT64 (Address64->Address), Length)); + } + } + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiTbSetupFadtRegisters + * + * PARAMETERS: None, uses AcpiGbl_FADT. + * + * RETURN: None + * + * DESCRIPTION: Initialize global ACPI PM1 register definitions. Optionally, + * force FADT register definitions to their default lengths. + * + ******************************************************************************/ + +static void +AcpiTbSetupFadtRegisters ( + void) +{ + ACPI_GENERIC_ADDRESS *Target64; + ACPI_GENERIC_ADDRESS *Source64; + UINT8 Pm1RegisterByteWidth; + UINT32 i; + + + /* + * Optionally check all register lengths against the default values and + * update them if they are incorrect. + */ + if (AcpiGbl_UseDefaultRegisterWidths) + { + for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++) + { + Target64 = ACPI_ADD_PTR (ACPI_GENERIC_ADDRESS, &AcpiGbl_FADT, + FadtInfoTable[i].Address64); + + /* + * If a valid register (Address != 0) and the (DefaultLength > 0) + * (Not a GPE register), then check the width against the default. */ - if ((Address64->Address && !Length) || (!Address64->Address && Length)) + if ((Target64->Address) && + (FadtInfoTable[i].DefaultLength > 0) && + (FadtInfoTable[i].DefaultLength != Target64->BitWidth)) { ACPI_WARNING ((AE_INFO, - "Optional field \"%s\" has zero address or length: %8.8X%8.8X/%X", - FadtInfoTable[i].Name, ACPI_FORMAT_UINT64 (Address64->Address), Length)); + "Invalid length for %s: %d, using default %d", + FadtInfoTable[i].Name, Target64->BitWidth, + FadtInfoTable[i].DefaultLength)); + + /* Incorrect size, set width to the default */ + + Target64->BitWidth = FadtInfoTable[i].DefaultLength; } } + } - /* If both 32- and 64-bit addresses are valid (non-zero), they must match */ + /* + * Get the length of the individual PM1 registers (enable and status). + * Each register is defined to be (event block length / 2). Extra divide + * by 8 converts bits to bytes. + */ + Pm1RegisterByteWidth = (UINT8) + ACPI_DIV_16 (AcpiGbl_FADT.XPm1aEventBlock.BitWidth); - if (Address64->Address && *Address32 && - (Address64->Address != (UINT64) *Address32)) + /* + * Calculate separate GAS structs for the PM1x (A/B) Status and Enable + * registers. These addresses do not appear (directly) in the FADT, so it + * is useful to pre-calculate them from the PM1 Event Block definitions. + * + * The PM event blocks are split into two register blocks, first is the + * PM Status Register block, followed immediately by the PM Enable + * Register block. Each is of length (Pm1EventLength/2) + * + * Note: The PM1A event block is required by the ACPI specification. + * However, the PM1B event block is optional and is rarely, if ever, + * used. + */ + + for (i = 0; i < ACPI_FADT_PM_INFO_ENTRIES; i++) + { + Source64 = ACPI_ADD_PTR (ACPI_GENERIC_ADDRESS, &AcpiGbl_FADT, + FadtPmInfoTable[i].Source); + + if (Source64->Address) { - ACPI_ERROR ((AE_INFO, - "32/64X address mismatch in \"%s\": [%8.8X] [%8.8X%8.8X], using 64X", - FadtInfoTable[i].Name, *Address32, ACPI_FORMAT_UINT64 (Address64->Address))); + AcpiTbInitGenericAddress (FadtPmInfoTable[i].Target, + Source64->SpaceId, Pm1RegisterByteWidth, + Source64->Address + + (FadtPmInfoTable[i].RegisterNum * Pm1RegisterByteWidth)); } } } diff --git a/sys/contrib/dev/acpica/tbfind.c b/sys/contrib/dev/acpica/tables/tbfind.c index be092934e0ee..1838b5eb78ae 100644 --- a/sys/contrib/dev/acpica/tbfind.c +++ b/sys/contrib/dev/acpica/tables/tbfind.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: tbfind - find table - * $Revision: 1.3 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,8 +115,9 @@ #define __TBFIND_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/actables.h> +#include "acpi.h" +#include "accommon.h" +#include "actables.h" #define _COMPONENT ACPI_TABLES ACPI_MODULE_NAME ("tbfind") @@ -145,19 +145,29 @@ AcpiTbFindTable ( char *Signature, char *OemId, char *OemTableId, - ACPI_NATIVE_UINT *TableIndex) + UINT32 *TableIndex) { - ACPI_NATIVE_UINT i; + UINT32 i; ACPI_STATUS Status; + ACPI_TABLE_HEADER Header; ACPI_FUNCTION_TRACE (TbFindTable); + /* Normalize the input strings */ + + ACPI_MEMSET (&Header, 0, sizeof (ACPI_TABLE_HEADER)); + ACPI_STRNCPY (Header.Signature, Signature, ACPI_NAME_SIZE); + ACPI_STRNCPY (Header.OemId, OemId, ACPI_OEM_ID_SIZE); + ACPI_STRNCPY (Header.OemTableId, OemTableId, ACPI_OEM_TABLE_ID_SIZE); + + /* Search for the table */ + for (i = 0; i < AcpiGbl_RootTableList.Count; ++i) { if (ACPI_MEMCMP (&(AcpiGbl_RootTableList.Tables[i].Signature), - Signature, ACPI_NAME_SIZE)) + Header.Signature, ACPI_NAME_SIZE)) { /* Not the requested table */ @@ -185,18 +195,18 @@ AcpiTbFindTable ( /* Check for table match on all IDs */ if (!ACPI_MEMCMP (AcpiGbl_RootTableList.Tables[i].Pointer->Signature, - Signature, ACPI_NAME_SIZE) && + Header.Signature, ACPI_NAME_SIZE) && (!OemId[0] || !ACPI_MEMCMP (AcpiGbl_RootTableList.Tables[i].Pointer->OemId, - OemId, ACPI_OEM_ID_SIZE)) && + Header.OemId, ACPI_OEM_ID_SIZE)) && (!OemTableId[0] || !ACPI_MEMCMP (AcpiGbl_RootTableList.Tables[i].Pointer->OemTableId, - OemTableId, ACPI_OEM_TABLE_ID_SIZE))) + Header.OemTableId, ACPI_OEM_TABLE_ID_SIZE))) { *TableIndex = i; ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Found table [%4.4s]\n", - Signature)); + Header.Signature)); return_ACPI_STATUS (AE_OK); } } diff --git a/sys/contrib/dev/acpica/tbinstal.c b/sys/contrib/dev/acpica/tables/tbinstal.c index fa7170211555..c911f84f68b9 100644 --- a/sys/contrib/dev/acpica/tbinstal.c +++ b/sys/contrib/dev/acpica/tables/tbinstal.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: tbinstal - ACPI table installation and removal - * $Revision: 1.91 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,9 +116,10 @@ #define __TBINSTAL_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/actables.h> +#include "acpi.h" +#include "accommon.h" +#include "acnamesp.h" +#include "actables.h" #define _COMPONENT ACPI_TABLES @@ -155,7 +155,8 @@ AcpiTbVerifyTable ( if ((TableDesc->Flags & ACPI_TABLE_ORIGIN_MASK) == ACPI_TABLE_ORIGIN_MAPPED) { - TableDesc->Pointer = AcpiOsMapMemory (TableDesc->Address, TableDesc->Length); + TableDesc->Pointer = AcpiOsMapMemory ( + TableDesc->Address, TableDesc->Length); } if (!TableDesc->Pointer) @@ -186,18 +187,20 @@ AcpiTbVerifyTable ( * * RETURN: Status * - * DESCRIPTION: This function is called to add the ACPI table + * DESCRIPTION: This function is called to add an ACPI table. It is used to + * dynamically load tables via the Load and LoadTable AML + * operators. * ******************************************************************************/ ACPI_STATUS AcpiTbAddTable ( ACPI_TABLE_DESC *TableDesc, - ACPI_NATIVE_UINT *TableIndex) + UINT32 *TableIndex) { - ACPI_NATIVE_UINT i; - ACPI_NATIVE_UINT Length; + UINT32 i; ACPI_STATUS Status = AE_OK; + ACPI_TABLE_HEADER *OverrideTable = NULL; ACPI_FUNCTION_TRACE (TbAddTable); @@ -212,16 +215,13 @@ AcpiTbAddTable ( } } - /* The table must be either an SSDT or a PSDT */ - - if ((!ACPI_COMPARE_NAME (TableDesc->Pointer->Signature, ACPI_SIG_PSDT)) && - (!ACPI_COMPARE_NAME (TableDesc->Pointer->Signature, ACPI_SIG_SSDT))) - { - ACPI_ERROR ((AE_INFO, - "Table has invalid signature [%4.4s], must be SSDT or PSDT", - TableDesc->Pointer->Signature)); - return_ACPI_STATUS (AE_BAD_SIGNATURE); - } + /* + * Originally, we checked the table signature for "SSDT" or "PSDT" here. + * Next, we added support for OEMx tables, signature "OEM". + * Valid tables were encountered with a null signature, so we've just + * given up on validating the signature, since it seems to be a waste + * of code. The original code was removed (05/2008). + */ (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); @@ -232,30 +232,95 @@ AcpiTbAddTable ( if (!AcpiGbl_RootTableList.Tables[i].Pointer) { Status = AcpiTbVerifyTable (&AcpiGbl_RootTableList.Tables[i]); - if (ACPI_FAILURE (Status) || !AcpiGbl_RootTableList.Tables[i].Pointer) + if (ACPI_FAILURE (Status) || + !AcpiGbl_RootTableList.Tables[i].Pointer) { continue; } } - Length = ACPI_MIN (TableDesc->Length, - AcpiGbl_RootTableList.Tables[i].Length); - if (ACPI_MEMCMP (TableDesc->Pointer, - AcpiGbl_RootTableList.Tables[i].Pointer, Length)) + /* + * Check for a table match on the entire table length, + * not just the header. + */ + if (TableDesc->Length != AcpiGbl_RootTableList.Tables[i].Length) { continue; } - /* Table is already registered */ + if (ACPI_MEMCMP (TableDesc->Pointer, + AcpiGbl_RootTableList.Tables[i].Pointer, + AcpiGbl_RootTableList.Tables[i].Length)) + { + continue; + } + /* + * Note: the current mechanism does not unregister a table if it is + * dynamically unloaded. The related namespace entries are deleted, + * but the table remains in the root table list. + * + * The assumption here is that the number of different tables that + * will be loaded is actually small, and there is minimal overhead + * in just keeping the table in case it is needed again. + * + * If this assumption changes in the future (perhaps on large + * machines with many table load/unload operations), tables will + * need to be unregistered when they are unloaded, and slots in the + * root table list should be reused when empty. + */ + + /* + * Table is already registered. + * We can delete the table that was passed as a parameter. + */ AcpiTbDeleteTable (TableDesc); *TableIndex = i; - goto Release; + + if (AcpiGbl_RootTableList.Tables[i].Flags & ACPI_TABLE_IS_LOADED) + { + /* Table is still loaded, this is an error */ + + Status = AE_ALREADY_EXISTS; + goto Release; + } + else + { + /* Table was unloaded, allow it to be reloaded */ + + TableDesc->Pointer = AcpiGbl_RootTableList.Tables[i].Pointer; + TableDesc->Address = AcpiGbl_RootTableList.Tables[i].Address; + Status = AE_OK; + goto PrintHeader; + } } /* - * Add the table to the global table list + * ACPI Table Override: + * Allow the host to override dynamically loaded tables. */ + Status = AcpiOsTableOverride (TableDesc->Pointer, &OverrideTable); + if (ACPI_SUCCESS (Status) && OverrideTable) + { + ACPI_INFO ((AE_INFO, + "%4.4s @ 0x%p Table override, replaced with:", + TableDesc->Pointer->Signature, + ACPI_CAST_PTR (void, TableDesc->Address))); + + /* We can delete the table that was passed as a parameter */ + + AcpiTbDeleteTable (TableDesc); + + /* Setup descriptor for the new table */ + + TableDesc->Address = ACPI_PTR_TO_PHYSADDR (OverrideTable); + TableDesc->Pointer = OverrideTable; + TableDesc->Length = OverrideTable->Length; + TableDesc->Flags = ACPI_TABLE_ORIGIN_OVERRIDE; + } + + /* Add the table to the global root table list */ + Status = AcpiTbStoreTable (TableDesc->Address, TableDesc->Pointer, TableDesc->Length, TableDesc->Flags, TableIndex); if (ACPI_FAILURE (Status)) @@ -263,6 +328,7 @@ AcpiTbAddTable ( goto Release; } +PrintHeader: AcpiTbPrintTableHeader (TableDesc->Address, TableDesc->Pointer); Release: @@ -304,8 +370,9 @@ AcpiTbResizeRootTableList ( /* Increase the Table Array size */ Tables = ACPI_ALLOCATE_ZEROED ( - (AcpiGbl_RootTableList.Size + ACPI_ROOT_TABLE_SIZE_INCREMENT) - * sizeof (ACPI_TABLE_DESC)); + ((ACPI_SIZE) AcpiGbl_RootTableList.Size + + ACPI_ROOT_TABLE_SIZE_INCREMENT) * + sizeof (ACPI_TABLE_DESC)); if (!Tables) { ACPI_ERROR ((AE_INFO, "Could not allocate new root table array")); @@ -317,7 +384,7 @@ AcpiTbResizeRootTableList ( if (AcpiGbl_RootTableList.Tables) { ACPI_MEMCPY (Tables, AcpiGbl_RootTableList.Tables, - AcpiGbl_RootTableList.Size * sizeof (ACPI_TABLE_DESC)); + (ACPI_SIZE) AcpiGbl_RootTableList.Size * sizeof (ACPI_TABLE_DESC)); if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED) { @@ -354,7 +421,7 @@ AcpiTbStoreTable ( ACPI_TABLE_HEADER *Table, UINT32 Length, UINT8 Flags, - ACPI_NATIVE_UINT *TableIndex) + UINT32 *TableIndex) { ACPI_STATUS Status = AE_OK; @@ -446,7 +513,7 @@ void AcpiTbTerminate ( void) { - ACPI_NATIVE_UINT i; + UINT32 i; ACPI_FUNCTION_TRACE (TbTerminate); @@ -485,32 +552,62 @@ AcpiTbTerminate ( * * PARAMETERS: TableIndex - Table index * - * RETURN: None + * RETURN: Status * * DESCRIPTION: Delete all namespace objects created when this table was loaded. * ******************************************************************************/ -void +ACPI_STATUS AcpiTbDeleteNamespaceByOwner ( - ACPI_NATIVE_UINT TableIndex) + UINT32 TableIndex) { ACPI_OWNER_ID OwnerId; + ACPI_STATUS Status; - (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); - if (TableIndex < AcpiGbl_RootTableList.Count) + ACPI_FUNCTION_TRACE (TbDeleteNamespaceByOwner); + + + Status = AcpiUtAcquireMutex (ACPI_MTX_TABLES); + if (ACPI_FAILURE (Status)) { - OwnerId = AcpiGbl_RootTableList.Tables[TableIndex].OwnerId; + return_ACPI_STATUS (Status); } - else + + if (TableIndex >= AcpiGbl_RootTableList.Count) { + /* The table index does not exist */ + (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); - return; + return_ACPI_STATUS (AE_NOT_EXIST); } + /* Get the owner ID for this table, used to delete namespace nodes */ + + OwnerId = AcpiGbl_RootTableList.Tables[TableIndex].OwnerId; (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); + + /* + * Need to acquire the namespace writer lock to prevent interference + * with any concurrent namespace walks. The interpreter must be + * released during the deletion since the acquisition of the deletion + * lock may block, and also since the execution of a namespace walk + * must be allowed to use the interpreter. + */ + (void) AcpiUtReleaseMutex (ACPI_MTX_INTERPRETER); + Status = AcpiUtAcquireWriteLock (&AcpiGbl_NamespaceRwLock); + AcpiNsDeleteNamespaceByOwner (OwnerId); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + AcpiUtReleaseWriteLock (&AcpiGbl_NamespaceRwLock); + + Status = AcpiUtAcquireMutex (ACPI_MTX_INTERPRETER); + return_ACPI_STATUS (Status); } @@ -528,7 +625,7 @@ AcpiTbDeleteNamespaceByOwner ( ACPI_STATUS AcpiTbAllocateOwnerId ( - ACPI_NATIVE_UINT TableIndex) + UINT32 TableIndex) { ACPI_STATUS Status = AE_BAD_PARAMETER; @@ -562,7 +659,7 @@ AcpiTbAllocateOwnerId ( ACPI_STATUS AcpiTbReleaseOwnerId ( - ACPI_NATIVE_UINT TableIndex) + UINT32 TableIndex) { ACPI_STATUS Status = AE_BAD_PARAMETER; @@ -573,7 +670,8 @@ AcpiTbReleaseOwnerId ( (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); if (TableIndex < AcpiGbl_RootTableList.Count) { - AcpiUtReleaseOwnerId (&(AcpiGbl_RootTableList.Tables[TableIndex].OwnerId)); + AcpiUtReleaseOwnerId ( + &(AcpiGbl_RootTableList.Tables[TableIndex].OwnerId)); Status = AE_OK; } @@ -597,7 +695,7 @@ AcpiTbReleaseOwnerId ( ACPI_STATUS AcpiTbGetOwnerId ( - ACPI_NATIVE_UINT TableIndex, + UINT32 TableIndex, ACPI_OWNER_ID *OwnerId) { ACPI_STATUS Status = AE_BAD_PARAMETER; @@ -630,7 +728,7 @@ AcpiTbGetOwnerId ( BOOLEAN AcpiTbIsTableLoaded ( - ACPI_NATIVE_UINT TableIndex) + UINT32 TableIndex) { BOOLEAN IsLoaded = FALSE; @@ -639,7 +737,8 @@ AcpiTbIsTableLoaded ( if (TableIndex < AcpiGbl_RootTableList.Count) { IsLoaded = (BOOLEAN) - (AcpiGbl_RootTableList.Tables[TableIndex].Flags & ACPI_TABLE_IS_LOADED); + (AcpiGbl_RootTableList.Tables[TableIndex].Flags & + ACPI_TABLE_IS_LOADED); } (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); @@ -662,7 +761,7 @@ AcpiTbIsTableLoaded ( void AcpiTbSetTableLoadedFlag ( - ACPI_NATIVE_UINT TableIndex, + UINT32 TableIndex, BOOLEAN IsLoaded) { @@ -671,11 +770,13 @@ AcpiTbSetTableLoadedFlag ( { if (IsLoaded) { - AcpiGbl_RootTableList.Tables[TableIndex].Flags |= ACPI_TABLE_IS_LOADED; + AcpiGbl_RootTableList.Tables[TableIndex].Flags |= + ACPI_TABLE_IS_LOADED; } else { - AcpiGbl_RootTableList.Tables[TableIndex].Flags &= ~ACPI_TABLE_IS_LOADED; + AcpiGbl_RootTableList.Tables[TableIndex].Flags &= + ~ACPI_TABLE_IS_LOADED; } } diff --git a/sys/contrib/dev/acpica/tbutils.c b/sys/contrib/dev/acpica/tables/tbutils.c index 5b64e2005e5f..f4803a2e7627 100644 --- a/sys/contrib/dev/acpica/tbutils.c +++ b/sys/contrib/dev/acpica/tables/tbutils.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: tbutils - table utilities - * $Revision: 1.88 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,8 +115,9 @@ #define __TBUTILS_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/actables.h> +#include "acpi.h" +#include "accommon.h" +#include "actables.h" #define _COMPONENT ACPI_TABLES ACPI_MODULE_NAME ("tbutils") @@ -127,7 +127,33 @@ static ACPI_PHYSICAL_ADDRESS AcpiTbGetRootTableEntry ( UINT8 *TableEntry, - ACPI_NATIVE_UINT TableEntrySize); + UINT32 TableEntrySize); + + +/******************************************************************************* + * + * FUNCTION: AcpiTbInitializeFacs + * + * PARAMETERS: None + * + * RETURN: Status + * + * DESCRIPTION: Create a permanent mapping for the FADT and save it in a global + * for accessing the Global Lock and Firmware Waking Vector + * + ******************************************************************************/ + +ACPI_STATUS +AcpiTbInitializeFacs ( + void) +{ + ACPI_STATUS Status; + + + Status = AcpiGetTableByIndex (ACPI_TABLE_INDEX_FACS, + ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &AcpiGbl_FACS)); + return (Status); +} /******************************************************************************* @@ -176,18 +202,23 @@ AcpiTbPrintTableHeader ( ACPI_TABLE_HEADER *Header) { + /* + * The reason that the Address is cast to a void pointer is so that we + * can use %p which will work properly on both 32-bit and 64-bit hosts. + */ if (ACPI_COMPARE_NAME (Header->Signature, ACPI_SIG_FACS)) { - /* FACS only has signature and length fields of common table header */ + /* FACS only has signature and length fields */ - ACPI_INFO ((AE_INFO, "%4.4s @ 0x%p/0x%04X", - Header->Signature, ACPI_CAST_PTR (void, Address), Header->Length)); + ACPI_INFO ((AE_INFO, "%4.4s %p %05X", + Header->Signature, ACPI_CAST_PTR (void, Address), + Header->Length)); } else if (ACPI_COMPARE_NAME (Header->Signature, ACPI_SIG_RSDP)) { /* RSDP has no common fields */ - ACPI_INFO ((AE_INFO, "RSDP @ 0x%p/0x%04X (v%3.3d %6.6s)", + 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, @@ -199,7 +230,7 @@ AcpiTbPrintTableHeader ( /* Standard ACPI table with full common header */ ACPI_INFO ((AE_INFO, - "%4.4s @ 0x%p/0x%04X (v%3.3d %6.6s %8.8s 0x%08X %4.4s 0x%08X)", + "%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, @@ -239,8 +270,9 @@ AcpiTbVerifyChecksum ( if (Checksum) { ACPI_WARNING ((AE_INFO, - "Incorrect checksum in table [%4.4s] - %2.2X, should be %2.2X", - Table->Signature, Table->Checksum, (UINT8) (Table->Checksum - Checksum))); + "Incorrect checksum in table [%4.4s] - %2.2X, should be %2.2X", + Table->Signature, Table->Checksum, + (UINT8) (Table->Checksum - Checksum))); #if (ACPI_CHECKSUM_ABORT) return (AE_BAD_CHECKSUM); @@ -267,7 +299,7 @@ AcpiTbVerifyChecksum ( UINT8 AcpiTbChecksum ( UINT8 *Buffer, - ACPI_NATIVE_UINT Length) + UINT32 Length) { UINT8 Sum = 0; UINT8 *End = Buffer + Length; @@ -287,25 +319,30 @@ AcpiTbChecksum ( * FUNCTION: AcpiTbInstallTable * * PARAMETERS: Address - Physical address of DSDT or FACS - * Flags - Flags * Signature - Table signature, NULL if no need to * match * TableIndex - Index into root table array * * RETURN: None * - * DESCRIPTION: Install an ACPI table into the global data structure. + * DESCRIPTION: Install an ACPI table into the global data structure. The + * table override mechanism is implemented here to allow the host + * OS to replace any table before it is installed in the root + * table array. * ******************************************************************************/ void AcpiTbInstallTable ( ACPI_PHYSICAL_ADDRESS Address, - UINT8 Flags, char *Signature, - ACPI_NATIVE_UINT TableIndex) + UINT32 TableIndex) { - ACPI_TABLE_HEADER *Table; + UINT8 Flags; + ACPI_STATUS Status; + ACPI_TABLE_HEADER *TableToInstall; + ACPI_TABLE_HEADER *MappedTable; + ACPI_TABLE_HEADER *OverrideTable = NULL; if (!Address) @@ -317,43 +354,70 @@ AcpiTbInstallTable ( /* Map just the table header */ - Table = AcpiOsMapMemory (Address, sizeof (ACPI_TABLE_HEADER)); - if (!Table) + MappedTable = AcpiOsMapMemory (Address, sizeof (ACPI_TABLE_HEADER)); + if (!MappedTable) { return; } - /* If a particular signature is expected, signature must match */ + /* If a particular signature is expected (DSDT/FACS), it must match */ if (Signature && - !ACPI_COMPARE_NAME (Table->Signature, Signature)) + !ACPI_COMPARE_NAME (MappedTable->Signature, Signature)) { - ACPI_ERROR ((AE_INFO, "Invalid signature 0x%X for ACPI table [%s]", - *ACPI_CAST_PTR (UINT32, Table->Signature), Signature)); + ACPI_ERROR ((AE_INFO, + "Invalid signature 0x%X for ACPI table, expected [%s]", + *ACPI_CAST_PTR (UINT32, MappedTable->Signature), Signature)); goto UnmapAndExit; } + /* + * ACPI Table Override: + * + * Before we install the table, let the host OS override it with a new + * one if desired. Any table within the RSDT/XSDT can be replaced, + * including the DSDT which is pointed to by the FADT. + */ + Status = AcpiOsTableOverride (MappedTable, &OverrideTable); + if (ACPI_SUCCESS (Status) && OverrideTable) + { + ACPI_INFO ((AE_INFO, + "%4.4s @ 0x%p Table override, replaced with:", + MappedTable->Signature, ACPI_CAST_PTR (void, Address))); + + AcpiGbl_RootTableList.Tables[TableIndex].Pointer = OverrideTable; + Address = ACPI_PTR_TO_PHYSADDR (OverrideTable); + + TableToInstall = OverrideTable; + Flags = ACPI_TABLE_ORIGIN_OVERRIDE; + } + else + { + TableToInstall = MappedTable; + Flags = ACPI_TABLE_ORIGIN_MAPPED; + } + /* Initialize the table entry */ AcpiGbl_RootTableList.Tables[TableIndex].Address = Address; - AcpiGbl_RootTableList.Tables[TableIndex].Length = Table->Length; + AcpiGbl_RootTableList.Tables[TableIndex].Length = TableToInstall->Length; AcpiGbl_RootTableList.Tables[TableIndex].Flags = Flags; ACPI_MOVE_32_TO_32 ( &(AcpiGbl_RootTableList.Tables[TableIndex].Signature), - Table->Signature); + TableToInstall->Signature); - AcpiTbPrintTableHeader (Address, Table); + AcpiTbPrintTableHeader (Address, TableToInstall); if (TableIndex == ACPI_TABLE_INDEX_DSDT) { /* Global integer width is based upon revision of the DSDT */ - AcpiUtSetIntegerWidth (Table->Revision); + AcpiUtSetIntegerWidth (TableToInstall->Revision); } UnmapAndExit: - AcpiOsUnmapMemory (Table, sizeof (ACPI_TABLE_HEADER)); + AcpiOsUnmapMemory (MappedTable, sizeof (ACPI_TABLE_HEADER)); } @@ -377,7 +441,7 @@ UnmapAndExit: static ACPI_PHYSICAL_ADDRESS AcpiTbGetRootTableEntry ( UINT8 *TableEntry, - ACPI_NATIVE_UINT TableEntrySize) + UINT32 TableEntrySize) { UINT64 Address64; @@ -398,7 +462,8 @@ AcpiTbGetRootTableEntry ( { /* * 32-bit platform, XSDT: Truncate 64-bit to 32-bit and return - * 64-bit platform, XSDT: Move (unaligned) 64-bit to local, return 64-bit + * 64-bit platform, XSDT: Move (unaligned) 64-bit to local, + * return 64-bit */ ACPI_MOVE_64_TO_64 (&Address64, TableEntry); @@ -408,7 +473,8 @@ AcpiTbGetRootTableEntry ( /* Will truncate 64-bit address to 32 bits, issue warning */ ACPI_WARNING ((AE_INFO, - "64-bit Physical Address in XSDT is too large (%8.8X%8.8X), truncating", + "64-bit Physical Address in XSDT is too large (%8.8X%8.8X)," + " truncating", ACPI_FORMAT_UINT64 (Address64))); } #endif @@ -422,7 +488,6 @@ AcpiTbGetRootTableEntry ( * FUNCTION: AcpiTbParseRootTable * * PARAMETERS: Rsdp - Pointer to the RSDP - * Flags - Flags * * RETURN: Status * @@ -437,12 +502,11 @@ AcpiTbGetRootTableEntry ( ACPI_STATUS AcpiTbParseRootTable ( - ACPI_PHYSICAL_ADDRESS RsdpAddress, - UINT8 Flags) + ACPI_PHYSICAL_ADDRESS RsdpAddress) { ACPI_TABLE_RSDP *Rsdp; - ACPI_NATIVE_UINT TableEntrySize; - ACPI_NATIVE_UINT i; + UINT32 TableEntrySize; + UINT32 i; UINT32 TableCount; ACPI_TABLE_HEADER *Table; ACPI_PHYSICAL_ADDRESS Address; @@ -463,7 +527,8 @@ AcpiTbParseRootTable ( return_ACPI_STATUS (AE_NO_MEMORY); } - AcpiTbPrintTableHeader (RsdpAddress, ACPI_CAST_PTR (ACPI_TABLE_HEADER, Rsdp)); + AcpiTbPrintTableHeader (RsdpAddress, + ACPI_CAST_PTR (ACPI_TABLE_HEADER, Rsdp)); /* Differentiate between RSDT and XSDT root tables */ @@ -530,11 +595,13 @@ AcpiTbParseRootTable ( /* Calculate the number of tables described in the root table */ - TableCount = (UINT32) ((Table->Length - sizeof (ACPI_TABLE_HEADER)) / TableEntrySize); + TableCount = (UINT32) ((Table->Length - sizeof (ACPI_TABLE_HEADER)) / + TableEntrySize); /* - * First two entries in the table array are reserved for the DSDT and FACS, - * which are not actually present in the RSDT/XSDT - they come from the FADT + * First two entries in the table array are reserved for the DSDT + * and FACS, which are not actually present in the RSDT/XSDT - they + * come from the FADT */ TableEntry = ACPI_CAST_PTR (UINT8, Table) + sizeof (ACPI_TABLE_HEADER); AcpiGbl_RootTableList.Count = 2; @@ -552,7 +619,8 @@ AcpiTbParseRootTable ( if (ACPI_FAILURE (Status)) { ACPI_WARNING ((AE_INFO, "Truncating %u table entries!", - (unsigned) (AcpiGbl_RootTableList.Size - AcpiGbl_RootTableList.Count))); + (unsigned) (TableCount - + (AcpiGbl_RootTableList.Count - 2)))); break; } } @@ -579,14 +647,14 @@ AcpiTbParseRootTable ( for (i = 2; i < AcpiGbl_RootTableList.Count; i++) { AcpiTbInstallTable (AcpiGbl_RootTableList.Tables[i].Address, - Flags, NULL, i); + NULL, i); /* Special case for FADT - get the DSDT and FACS */ if (ACPI_COMPARE_NAME ( &AcpiGbl_RootTableList.Tables[i].Signature, ACPI_SIG_FADT)) { - AcpiTbParseFadt (i, Flags); + AcpiTbParseFadt (i); } } diff --git a/sys/contrib/dev/acpica/tbxface.c b/sys/contrib/dev/acpica/tables/tbxface.c index a7a27c696e2f..5a1af4af135a 100644 --- a/sys/contrib/dev/acpica/tbxface.c +++ b/sys/contrib/dev/acpica/tables/tbxface.c @@ -2,7 +2,6 @@ * * Module Name: tbxface - Public interfaces to the ACPI subsystem * ACPI table oriented interfaces - * $Revision: 1.86 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,9 +116,10 @@ #define __TBXFACE_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/actables.h> +#include "acpi.h" +#include "accommon.h" +#include "acnamesp.h" +#include "actables.h" #define _COMPONENT ACPI_TABLES ACPI_MODULE_NAME ("tbxface") @@ -213,7 +213,7 @@ AcpiInitializeTables ( /* Root Table Array has been statically allocated by the host */ ACPI_MEMSET (InitialTableArray, 0, - InitialTableCount * sizeof (ACPI_TABLE_DESC)); + (ACPI_SIZE) InitialTableCount * sizeof (ACPI_TABLE_DESC)); AcpiGbl_RootTableList.Tables = InitialTableArray; AcpiGbl_RootTableList.Size = InitialTableCount; @@ -237,7 +237,7 @@ AcpiInitializeTables ( * Root Table Array. This array contains the information of the RSDT/XSDT * in a common, more useable format. */ - Status = AcpiTbParseRootTable (RsdpAddress, ACPI_TABLE_ORIGIN_MAPPED); + Status = AcpiTbParseRootTable (RsdpAddress); return_ACPI_STATUS (Status); } @@ -279,7 +279,8 @@ AcpiReallocateRootTable ( return_ACPI_STATUS (AE_SUPPORT); } - NewSize = (AcpiGbl_RootTableList.Count + ACPI_ROOT_TABLE_SIZE_INCREMENT) * + NewSize = ((ACPI_SIZE) AcpiGbl_RootTableList.Count + + ACPI_ROOT_TABLE_SIZE_INCREMENT) * sizeof (ACPI_TABLE_DESC); /* Create new array and copy the old array */ @@ -303,7 +304,7 @@ AcpiReallocateRootTable ( ACPI_EXPORT_SYMBOL (AcpiReallocateRootTable) -/****************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiGetTableHeader * @@ -318,16 +319,16 @@ ACPI_EXPORT_SYMBOL (AcpiReallocateRootTable) * NOTE: Caller is responsible in unmapping the header with * AcpiOsUnmapMemory * - *****************************************************************************/ + ******************************************************************************/ ACPI_STATUS AcpiGetTableHeader ( char *Signature, - ACPI_NATIVE_UINT Instance, + UINT32 Instance, ACPI_TABLE_HEADER *OutTableHeader) { - ACPI_NATIVE_UINT i; - ACPI_NATIVE_UINT j; + UINT32 i; + UINT32 j; ACPI_TABLE_HEADER *Header; @@ -338,9 +339,8 @@ AcpiGetTableHeader ( return (AE_BAD_PARAMETER); } - /* - * Walk the root table list - */ + /* Walk the root table list */ + for (i = 0, j = 0; i < AcpiGbl_RootTableList.Count; i++) { if (!ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature), @@ -356,10 +356,12 @@ AcpiGetTableHeader ( if (!AcpiGbl_RootTableList.Tables[i].Pointer) { - if ((AcpiGbl_RootTableList.Tables[i].Flags & ACPI_TABLE_ORIGIN_MASK) == + if ((AcpiGbl_RootTableList.Tables[i].Flags & + ACPI_TABLE_ORIGIN_MASK) == ACPI_TABLE_ORIGIN_MAPPED) { - Header = AcpiOsMapMemory (AcpiGbl_RootTableList.Tables[i].Address, + Header = AcpiOsMapMemory ( + AcpiGbl_RootTableList.Tables[i].Address, sizeof (ACPI_TABLE_HEADER)); if (!Header) { @@ -369,16 +371,15 @@ AcpiGetTableHeader ( ACPI_MEMCPY (OutTableHeader, Header, sizeof(ACPI_TABLE_HEADER)); AcpiOsUnmapMemory (Header, sizeof(ACPI_TABLE_HEADER)); } - else { return AE_NOT_FOUND; } } - else { - ACPI_MEMCPY (OutTableHeader, AcpiGbl_RootTableList.Tables[i].Pointer, + ACPI_MEMCPY (OutTableHeader, + AcpiGbl_RootTableList.Tables[i].Pointer, sizeof(ACPI_TABLE_HEADER)); } @@ -391,7 +392,7 @@ AcpiGetTableHeader ( ACPI_EXPORT_SYMBOL (AcpiGetTableHeader) -/****************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiGetTable * @@ -403,16 +404,16 @@ ACPI_EXPORT_SYMBOL (AcpiGetTableHeader) * * DESCRIPTION: Finds and verifies an ACPI table. * - *****************************************************************************/ + ******************************************************************************/ ACPI_STATUS AcpiGetTable ( char *Signature, - ACPI_NATIVE_UINT Instance, + UINT32 Instance, ACPI_TABLE_HEADER **OutTable) { - ACPI_NATIVE_UINT i; - ACPI_NATIVE_UINT j; + UINT32 i; + UINT32 j; ACPI_STATUS Status; @@ -423,9 +424,8 @@ AcpiGetTable ( return (AE_BAD_PARAMETER); } - /* - * Walk the root table list - */ + /* Walk the root table list */ + for (i = 0, j = 0; i < AcpiGbl_RootTableList.Count; i++) { if (!ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature), @@ -469,7 +469,7 @@ ACPI_EXPORT_SYMBOL (AcpiGetTable) ACPI_STATUS AcpiGetTableByIndex ( - ACPI_NATIVE_UINT TableIndex, + UINT32 TableIndex, ACPI_TABLE_HEADER **Table) { ACPI_STATUS Status; @@ -533,9 +533,7 @@ AcpiTbLoadNamespace ( void) { ACPI_STATUS Status; - ACPI_TABLE_HEADER *Table; - ACPI_NATIVE_UINT i; - BOOLEAN DsdtOverriden; + UINT32 i; ACPI_FUNCTION_TRACE (TbLoadNamespace); @@ -548,58 +546,38 @@ AcpiTbLoadNamespace ( * are optional. */ if (!AcpiGbl_RootTableList.Count || - !ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Signature), - ACPI_SIG_DSDT) || - ACPI_FAILURE (AcpiTbVerifyTable(&AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT]))) + !ACPI_COMPARE_NAME ( + &(AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Signature), + ACPI_SIG_DSDT) || + ACPI_FAILURE (AcpiTbVerifyTable ( + &AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT]))) { Status = AE_NO_ACPI_TABLES; goto UnlockAndExit; } - /* - * Find DSDT table - */ - DsdtOverriden = FALSE; - Status = AcpiOsTableOverride ( - AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Pointer, &Table); - if (ACPI_SUCCESS (Status) && Table) - { - /* - * DSDT table has been found - */ - AcpiTbDeleteTable (&AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT]); - AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Pointer = Table; - AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Length = Table->Length; - AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Flags = ACPI_TABLE_ORIGIN_UNKNOWN; - DsdtOverriden = TRUE; - - ACPI_INFO ((AE_INFO, "Table DSDT replaced by host OS")); - AcpiTbPrintTableHeader (0, Table); - } + /* A valid DSDT is required */ - Status = AcpiTbVerifyTable (&AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT]); + Status = AcpiTbVerifyTable ( + &AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT]); if (ACPI_FAILURE (Status)) { - /* A valid DSDT is required */ - Status = AE_NO_ACPI_TABLES; goto UnlockAndExit; } (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); - /* - * Load and parse tables. - */ + /* Load and parse tables */ + Status = AcpiNsLoadTable (ACPI_TABLE_INDEX_DSDT, AcpiGbl_RootNode); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } - /* - * Load any SSDT or PSDT tables. Note: Loop leaves tables locked - */ + /* Load any SSDT or PSDT tables. Note: Loop leaves tables locked */ + (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); for (i = 2; i < AcpiGbl_RootTableList.Count; ++i) { @@ -607,17 +585,19 @@ AcpiTbLoadNamespace ( ACPI_SIG_SSDT) && !ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature), ACPI_SIG_PSDT)) || - ACPI_FAILURE (AcpiTbVerifyTable (&AcpiGbl_RootTableList.Tables[i]))) + ACPI_FAILURE (AcpiTbVerifyTable ( + &AcpiGbl_RootTableList.Tables[i]))) { continue; } - /* Delete SSDT when DSDT is overriden */ + /* Skip SSDT when DSDT is overriden */ if (ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature), - ACPI_SIG_SSDT) && DsdtOverriden) + ACPI_SIG_SSDT) && + (AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Flags & + ACPI_TABLE_ORIGIN_OVERRIDE)) { - AcpiTbDeleteTable (&AcpiGbl_RootTableList.Tables[i]); continue; } @@ -658,13 +638,13 @@ AcpiLoadTables ( ACPI_FUNCTION_TRACE (AcpiLoadTables); - /* - * Load the namespace from the tables - */ + /* Load the namespace from the tables */ + Status = AcpiTbLoadNamespace (); if (ACPI_FAILURE (Status)) { - ACPI_EXCEPTION ((AE_INFO, Status, "While loading namespace from ACPI tables")); + ACPI_EXCEPTION ((AE_INFO, Status, + "While loading namespace from ACPI tables")); } return_ACPI_STATUS (Status); @@ -672,3 +652,109 @@ AcpiLoadTables ( ACPI_EXPORT_SYMBOL (AcpiLoadTables) + +/******************************************************************************* + * + * FUNCTION: AcpiInstallTableHandler + * + * PARAMETERS: Handler - Table event handler + * Context - Value passed to the handler on each event + * + * RETURN: Status + * + * DESCRIPTION: Install table event handler + * + ******************************************************************************/ + +ACPI_STATUS +AcpiInstallTableHandler ( + ACPI_TABLE_HANDLER Handler, + void *Context) +{ + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (AcpiInstallTableHandler); + + + if (!Handler) + { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + + Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* Don't allow more than one handler */ + + if (AcpiGbl_TableHandler) + { + Status = AE_ALREADY_EXISTS; + goto Cleanup; + } + + /* Install the handler */ + + AcpiGbl_TableHandler = Handler; + AcpiGbl_TableHandlerContext = Context; + +Cleanup: + (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiInstallTableHandler) + + +/******************************************************************************* + * + * FUNCTION: AcpiRemoveTableHandler + * + * PARAMETERS: Handler - Table event handler that was installed + * previously. + * + * RETURN: Status + * + * DESCRIPTION: Remove table event handler + * + ******************************************************************************/ + +ACPI_STATUS +AcpiRemoveTableHandler ( + ACPI_TABLE_HANDLER Handler) +{ + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (AcpiRemoveTableHandler); + + + Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* Make sure that the installed handler is the same */ + + if (!Handler || + Handler != AcpiGbl_TableHandler) + { + Status = AE_BAD_PARAMETER; + goto Cleanup; + } + + /* Remove the handler */ + + AcpiGbl_TableHandler = NULL; + +Cleanup: + (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); + return_ACPI_STATUS (Status); +} + +ACPI_EXPORT_SYMBOL (AcpiRemoveTableHandler) + diff --git a/sys/contrib/dev/acpica/tbxfroot.c b/sys/contrib/dev/acpica/tables/tbxfroot.c index afc30adac7fb..e0a571f36f44 100644 --- a/sys/contrib/dev/acpica/tbxfroot.c +++ b/sys/contrib/dev/acpica/tables/tbxfroot.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: tbxfroot - Find the root ACPI table (RSDT) - * $Revision: 1.105 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,8 +115,9 @@ #define __TBXFROOT_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/actables.h> +#include "acpi.h" +#include "accommon.h" +#include "actables.h" #define _COMPONENT ACPI_TABLES @@ -160,7 +160,8 @@ AcpiTbValidateRsdp ( * Note: Sometimes there exists more than one RSDP in memory; the valid * RSDP has a valid checksum, all others have an invalid checksum. */ - if (ACPI_STRNCMP ((char *) Rsdp, ACPI_SIG_RSDP, sizeof (ACPI_SIG_RSDP)-1) != 0) + if (ACPI_STRNCMP ((char *) Rsdp, ACPI_SIG_RSDP, + sizeof (ACPI_SIG_RSDP)-1) != 0) { /* Nope, BAD Signature */ @@ -188,7 +189,7 @@ AcpiTbValidateRsdp ( /******************************************************************************* * - * FUNCTION: AcpiTbFindRsdp + * FUNCTION: AcpiFindRootPointer * * PARAMETERS: TableAddress - Where the table pointer is returned * @@ -208,7 +209,7 @@ AcpiTbValidateRsdp ( ACPI_STATUS AcpiFindRootPointer ( - ACPI_NATIVE_UINT *TableAddress) + ACPI_SIZE *TableAddress) { UINT8 *TablePtr; UINT8 *MemRover; @@ -248,7 +249,7 @@ AcpiFindRootPointer ( * minimum of 1K length) */ TablePtr = AcpiOsMapMemory ( - (ACPI_NATIVE_UINT) PhysicalAddress, + (ACPI_PHYSICAL_ADDRESS) PhysicalAddress, ACPI_EBDA_WINDOW_SIZE); if (!TablePtr) { diff --git a/sys/contrib/dev/acpica/tools/acpiexec/Makefile b/sys/contrib/dev/acpica/tools/acpiexec/Makefile new file mode 100644 index 000000000000..a8ec4d00f43f --- /dev/null +++ b/sys/contrib/dev/acpica/tools/acpiexec/Makefile @@ -0,0 +1,146 @@ +PROG= acpiexec +SRCS= aetables.c aehandlers.c aeexec.c aemain.c \ + ../../common/getopt.c \ + ../../debugger/dbcmds.c \ + ../../debugger/dbdisply.c \ + ../../debugger/dbexec.c \ + ../../debugger/dbfileio.c \ + ../../debugger/dbhistry.c \ + ../../debugger/dbinput.c \ + ../../debugger/dbstats.c \ + ../../debugger/dbutils.c \ + ../../debugger/dbxface.c \ + ../../disassembler/dmbuffer.c \ + ../../disassembler/dmnames.c \ + ../../disassembler/dmobject.c \ + ../../disassembler/dmopcode.c \ + ../../disassembler/dmresrc.c \ + ../../disassembler/dmresrcl.c \ + ../../disassembler/dmresrcs.c \ + ../../disassembler/dmutils.c \ + ../../disassembler/dmwalk.c \ + ../../events/evevent.c \ + ../../events/evgpeblk.c \ + ../../events/evgpe.c \ + ../../events/evmisc.c \ + ../../events/evregion.c \ + ../../events/evrgnini.c \ + ../../events/evsci.c \ + ../../events/evxface.c \ + ../../events/evxfevnt.c \ + ../../events/evxfregn.c \ + ../../hardware/hwacpi.c \ + ../../hardware/hwgpe.c \ + ../../hardware/hwregs.c \ + ../../hardware/hwsleep.c \ + ../../hardware/hwvalid.c \ + ../../hardware/hwxface.c \ + ../../dispatcher/dsfield.c \ + ../../dispatcher/dsinit.c \ + ../../dispatcher/dsmethod.c \ + ../../dispatcher/dsmthdat.c \ + ../../dispatcher/dsobject.c \ + ../../dispatcher/dsopcode.c \ + ../../dispatcher/dsutils.c \ + ../../dispatcher/dswexec.c \ + ../../dispatcher/dswload.c \ + ../../dispatcher/dswscope.c \ + ../../dispatcher/dswstate.c \ + ../../executer/exconfig.c \ + ../../executer/exconvrt.c \ + ../../executer/excreate.c \ + ../../executer/exdump.c \ + ../../executer/exfield.c \ + ../../executer/exfldio.c \ + ../../executer/exmisc.c \ + ../../executer/exmutex.c \ + ../../executer/exnames.c \ + ../../executer/exoparg1.c \ + ../../executer/exoparg2.c \ + ../../executer/exoparg3.c \ + ../../executer/exoparg6.c \ + ../../executer/exprep.c \ + ../../executer/exregion.c \ + ../../executer/exresnte.c \ + ../../executer/exresolv.c \ + ../../executer/exresop.c \ + ../../executer/exstore.c \ + ../../executer/exstoren.c \ + ../../executer/exstorob.c \ + ../../executer/exsystem.c \ + ../../executer/exutils.c \ + ../../parser/psargs.c \ + ../../parser/psloop.c \ + ../../parser/psopcode.c \ + ../../parser/psparse.c \ + ../../parser/psscope.c \ + ../../parser/pstree.c \ + ../../parser/psutils.c \ + ../../parser/pswalk.c \ + ../../parser/psxface.c \ + ../../namespace/nsaccess.c \ + ../../namespace/nsalloc.c \ + ../../namespace/nsdump.c \ + ../../namespace/nsdumpdv.c \ + ../../namespace/nseval.c \ + ../../namespace/nsinit.c \ + ../../namespace/nsload.c \ + ../../namespace/nsnames.c \ + ../../namespace/nsobject.c \ + ../../namespace/nsparse.c \ + ../../namespace/nspredef.c \ + ../../namespace/nssearch.c \ + ../../namespace/nsutils.c \ + ../../namespace/nswalk.c \ + ../../namespace/nsxfeval.c \ + ../../namespace/nsxfname.c \ + ../../namespace/nsxfobj.c \ + ../../resources/rsaddr.c \ + ../../resources/rscalc.c \ + ../../resources/rscreate.c \ + ../../resources/rsdump.c \ + ../../resources/rsio.c \ + ../../resources/rsinfo.c \ + ../../resources/rsirq.c \ + ../../resources/rslist.c \ + ../../resources/rsmemory.c \ + ../../resources/rsmisc.c \ + ../../resources/rsutils.c \ + ../../resources/rsxface.c \ + ../../tables/tbfadt.c \ + ../../tables/tbfind.c \ + ../../tables/tbinstal.c \ + ../../tables/tbutils.c \ + ../../tables/tbxface.c \ + ../../tables/tbxfroot.c \ + ../../utilities/utalloc.c \ + ../../utilities/utcache.c \ + ../../utilities/utcopy.c \ + ../../utilities/utdebug.c \ + ../../utilities/utdelete.c \ + ../../utilities/uteval.c \ + ../../utilities/utglobal.c \ + ../../utilities/utinit.c \ + ../../utilities/utlock.c \ + ../../utilities/utmath.c \ + ../../utilities/utmisc.c \ + ../../utilities/utmutex.c \ + ../../utilities/utobject.c \ + ../../utilities/utresrc.c \ + ../../utilities/utstate.c \ + ../../utilities/uttrack.c \ + ../../utilities/utxface.c \ + ../../osunixxf.c + + +CFLAGS+= -Wall -g -D_LINUX -DNDEBUG -D_CONSOLE -DACPI_EXEC_APP -D_MULTI_THREADED -Wstrict-prototypes -I../../include + + +acpiexec : $(patsubst %.c,%.o, $(SRCS)) + $(CC) $(LDFLAGS) $(patsubst %.c,%.o, $(SRCS)) -lrt -lpthread -o $(PROG) + +CLEANFILES= $(PROG) + +clean : + rm -f $(CLEANFILES) $(patsubst %.c,%.o, $(SRCS)) + diff --git a/sys/contrib/dev/acpica/aecommon.h b/sys/contrib/dev/acpica/tools/acpiexec/aecommon.h index 0dd1e5f65979..3febf6f40c86 100644 --- a/sys/contrib/dev/acpica/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 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -125,14 +125,15 @@ #include <string.h> #include <signal.h> -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acparser.h> -#include <contrib/dev/acpica/amlcode.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/acdebug.h> -#include <contrib/dev/acpica/actables.h> -#include <contrib/dev/acpica/acinterp.h> -#include <contrib/dev/acpica/acapps.h> +#include "acpi.h" +#include "accommon.h" +#include "acparser.h" +#include "amlcode.h" +#include "acnamesp.h" +#include "acdebug.h" +#include "actables.h" +#include "acinterp.h" +#include "acapps.h" extern FILE *AcpiGbl_DebugFile; extern BOOLEAN AcpiGbl_IgnoreErrors; @@ -140,7 +141,7 @@ extern BOOLEAN AcpiGbl_IgnoreErrors; /* * Debug Regions */ -typedef struct Region +typedef struct ae_region { ACPI_PHYSICAL_ADDRESS Address; UINT32 Length; @@ -148,36 +149,14 @@ typedef struct Region void *NextRegion; UINT8 SpaceId; -} REGION; +} AE_REGION; -typedef struct DebugRegions +typedef struct ae_debug_regions { UINT32 NumberOfRegions; - REGION *RegionList; + AE_REGION *RegionList; -} DEBUG_REGIONS; - - -/* - * Pointer overlay for 16-bit code - */ -typedef union ptr_ovl -{ - void *ptr; - UINT32 dword; - struct - { - UINT16 offset; - UINT16 base; - } ovl; - -} PTR_OVL; - - -#define GET_SEGMENT(ptr) ((UINT16)(_segment)(ptr)) -#define GET_OFFSET(ptr) ((UINT16)(UINT32) (ptr)) -#define GET_PHYSICAL_ADDRESS(ptr) (((((UINT32)GET_SEGMENT(ptr)) << 4)) + GET_OFFSET(ptr)) -#define PTR_OVL_BUILD_PTR(p,b,o) {p.ovl.base=b;p.ovl.offset=o;} +} AE_DEBUG_REGIONS; #define TEST_OUTPUT_LEVEL(lvl) if ((lvl) & OutputLevel) @@ -238,6 +217,18 @@ void AeMiscellaneousTests ( void); +ACPI_STATUS +AeRegionHandler ( + UINT32 Function, + ACPI_PHYSICAL_ADDRESS Address, + UINT32 BitWidth, + ACPI_INTEGER *Value, + void *HandlerContext, + void *RegionContext); + +UINT32 +AeGpeHandler ( + void *Context); #endif /* _AECOMMON */ diff --git a/sys/contrib/dev/acpica/tools/acpiexec/aeexec.c b/sys/contrib/dev/acpica/tools/acpiexec/aeexec.c new file mode 100644 index 000000000000..798e841689af --- /dev/null +++ b/sys/contrib/dev/acpica/tools/acpiexec/aeexec.c @@ -0,0 +1,589 @@ +/****************************************************************************** + * + * Module Name: aeexec - Support routines for AcpiExec utility + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2009, 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 "aecommon.h" + +#define _COMPONENT ACPI_TOOLS + ACPI_MODULE_NAME ("aeexec") + +/* Local prototypes */ + +ACPI_STATUS +AeSetupConfiguration ( + void *RegionAddr); + +void +AfInstallGpeBlock ( + void); + +void +AeTestBufferArgument ( + void); + +void +AeTestPackageArgument ( + void); + +ACPI_STATUS +AeGetDevices ( + ACPI_HANDLE ObjHandle, + UINT32 NestingLevel, + void *Context, + void **ReturnValue); + +ACPI_STATUS +ExecuteOSI ( + char *OsiString, + UINT32 ExpectedResult); + +void +AeHardwareInterfaces ( + void); + +extern unsigned char Ssdt3Code[]; + + +/****************************************************************************** + * + * FUNCTION: AeSetupConfiguration + * + * PARAMETERS: RegionAddr - Address for an ACPI table to be loaded + * dynamically. Test purposes only. + * + * RETURN: Status + * + * DESCRIPTION: Call AML _CFG configuration control method + * + *****************************************************************************/ + +ACPI_STATUS +AeSetupConfiguration ( + void *RegionAddr) +{ + ACPI_STATUS Status; + ACPI_OBJECT_LIST ArgList; + ACPI_OBJECT Arg[3]; + + + /* + * Invoke _CFG method if present + */ + ArgList.Count = 1; + ArgList.Pointer = Arg; + + Arg[0].Type = ACPI_TYPE_INTEGER; + Arg[0].Integer.Value = ACPI_TO_INTEGER (RegionAddr); + + Status = AcpiEvaluateObject (NULL, "\\_CFG", &ArgList, NULL); + + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: AfInstallGpeBlock + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Various GPE initialization + * + *****************************************************************************/ + +void +AfInstallGpeBlock ( + void) +{ + ACPI_STATUS Status; + ACPI_HANDLE Handle; + ACPI_HANDLE Handle2 = NULL; + ACPI_HANDLE Handle3 = NULL; + ACPI_GENERIC_ADDRESS BlockAddress; + ACPI_HANDLE GpeDevice; + + + Status = AcpiGetHandle (NULL, "\\_GPE", &Handle); + if (ACPI_FAILURE (Status)) + { + return; + } + + BlockAddress.SpaceId = 0; + BlockAddress.Address = 0x76540000; + +#ifdef _OBSOLETE + Status = AcpiInstallGpeBlock (Handle, &BlockAddress, 4, 8); +#endif + + /* Above should fail, ignore */ + + Status = AcpiGetHandle (NULL, "\\GPE2", &Handle2); + if (ACPI_SUCCESS (Status)) + { + Status = AcpiInstallGpeBlock (Handle2, &BlockAddress, 8, 8); + + AcpiInstallGpeHandler (Handle2, 8, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL); + AcpiSetGpeType (Handle2, 8, ACPI_GPE_TYPE_WAKE); + AcpiEnableGpe (Handle2, 8, 0); + + Status = AcpiGetGpeDevice (0x30, &GpeDevice); + Status = AcpiGetGpeDevice (0x42, &GpeDevice); + Status = AcpiGetGpeDevice (AcpiCurrentGpeCount-1, &GpeDevice); + Status = AcpiGetGpeDevice (AcpiCurrentGpeCount, &GpeDevice); + + AcpiRemoveGpeHandler (Handle2, 8, AeGpeHandler); + + Status = AcpiRemoveGpeBlock (Handle2); + } + + Status = AcpiGetHandle (NULL, "\\GPE3", &Handle3); + if (ACPI_SUCCESS (Status)) + { + Status = AcpiInstallGpeBlock (Handle3, &BlockAddress, 8, 11); + } + +#ifdef _OBSOLETE + Status = AcpiRemoveGpeBlock (Handle); + Status = AcpiRemoveGpeBlock (Handle2); + Status = AcpiRemoveGpeBlock (Handle3); +#endif +} + + +/* Test using a Buffer object as a method argument */ + +void +AeTestBufferArgument ( + void) +{ + ACPI_STATUS Status; + ACPI_OBJECT_LIST Params; + ACPI_OBJECT BufArg; + UINT8 Buffer[] = { + 0,0,0,0, + 4,0,0,0, + 1,2,3,4}; + + + BufArg.Type = ACPI_TYPE_BUFFER; + BufArg.Buffer.Length = 12; + BufArg.Buffer.Pointer = Buffer; + + Params.Count = 1; + Params.Pointer = &BufArg; + + + Status = AcpiEvaluateObject (NULL, "\\BUF", &Params, NULL); +} + + +ACPI_OBJECT PkgArg; +ACPI_OBJECT PkgElements[5]; +ACPI_OBJECT Pkg2Elements[5]; +ACPI_OBJECT_LIST Params; + + +/* + * Test using a Package object as an method argument + */ +void +AeTestPackageArgument ( + void) +{ + ACPI_STATUS Status; + + + /* Main package */ + + PkgArg.Type = ACPI_TYPE_PACKAGE; + PkgArg.Package.Count = 4; + PkgArg.Package.Elements = PkgElements; + + /* Main package elements */ + + PkgElements[0].Type = ACPI_TYPE_INTEGER; + PkgElements[0].Integer.Value = 0x22228888; + + PkgElements[1].Type = ACPI_TYPE_STRING; + PkgElements[1].String.Length = sizeof ("Top-level package"); + PkgElements[1].String.Pointer = "Top-level package"; + + PkgElements[2].Type = ACPI_TYPE_BUFFER; + PkgElements[2].Buffer.Length = sizeof ("XXXX"); + PkgElements[2].Buffer.Pointer = (UINT8 *) "XXXX"; + + PkgElements[3].Type = ACPI_TYPE_PACKAGE; + PkgElements[3].Package.Count = 2; + PkgElements[3].Package.Elements = Pkg2Elements; + + /* Sub-package elements */ + + Pkg2Elements[0].Type = ACPI_TYPE_INTEGER; + Pkg2Elements[0].Integer.Value = 0xAAAABBBB; + + Pkg2Elements[1].Type = ACPI_TYPE_STRING; + Pkg2Elements[1].String.Length = sizeof ("Nested Package"); + Pkg2Elements[1].String.Pointer = "Nested Package"; + + /* Parameter object */ + + Params.Count = 1; + Params.Pointer = &PkgArg; + + Status = AcpiEvaluateObject (NULL, "\\_PKG", &Params, NULL); +} + + +ACPI_STATUS +AeGetDevices ( + ACPI_HANDLE ObjHandle, + UINT32 NestingLevel, + void *Context, + void **ReturnValue) +{ + + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: ExecuteOSI + * + * PARAMETERS: OsiString - String passed to _OSI method + * ExpectedResult - 0 (FALSE) or 0xFFFFFFFF (TRUE) + * + * RETURN: Status + * + * DESCRIPTION: Execute the internally implemented (in ACPICA) _OSI method. + * + *****************************************************************************/ + +ACPI_STATUS +ExecuteOSI ( + char *OsiString, + UINT32 ExpectedResult) +{ + ACPI_STATUS Status; + ACPI_OBJECT_LIST ArgList; + ACPI_OBJECT Arg[1]; + ACPI_BUFFER ReturnValue; + ACPI_OBJECT *Obj; + + + /* Setup input argument */ + + ArgList.Count = 1; + ArgList.Pointer = Arg; + + Arg[0].Type = ACPI_TYPE_STRING; + Arg[0].String.Pointer = OsiString; + Arg[0].String.Length = strlen (Arg[0].String.Pointer); + + /* Ask ACPICA to allocate space for the return object */ + + ReturnValue.Length = ACPI_ALLOCATE_BUFFER; + + Status = AcpiEvaluateObject (NULL, "\\_OSI", &ArgList, &ReturnValue); + + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("Could not execute _OSI method, %s\n", + AcpiFormatException (Status)); + return (Status); + } + + if (ReturnValue.Length < sizeof (ACPI_OBJECT)) + { + AcpiOsPrintf ("Return value from _OSI method too small, %.8X\n", + ReturnValue.Length); + return (AE_ERROR); + } + + Obj = ReturnValue.Pointer; + if (Obj->Type != ACPI_TYPE_INTEGER) + { + AcpiOsPrintf ("Invalid return type from _OSI method, %.2X\n", Obj->Type); + return (AE_ERROR); + } + + if (Obj->Integer.Value != ExpectedResult) + { + AcpiOsPrintf ("Invalid return value from _OSI, expected %.8X found %.8X\n", + ExpectedResult, (UINT32) Obj->Integer.Value); + return (AE_ERROR); + } + + /* Reset the OSI data */ + + AcpiGbl_OsiData = 0; + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: AeHardwareInterfaces + * + * DESCRIPTION: Call various hardware support interfaces + * + *****************************************************************************/ + +void +AeHardwareInterfaces ( + void) +{ + ACPI_STATUS Status; + UINT32 Value; + + + + Status = AcpiWriteBitRegister (ACPI_BITREG_WAKE_STATUS, 1); + Status = AcpiWriteBitRegister (ACPI_BITREG_GLOBAL_LOCK_ENABLE, 1); + Status = AcpiWriteBitRegister (ACPI_BITREG_SLEEP_ENABLE, 1); + Status = AcpiWriteBitRegister (ACPI_BITREG_ARB_DISABLE, 1); + + Status = AcpiReadBitRegister (ACPI_BITREG_WAKE_STATUS, &Value); + Status = AcpiReadBitRegister (ACPI_BITREG_GLOBAL_LOCK_ENABLE, &Value); + Status = AcpiReadBitRegister (ACPI_BITREG_SLEEP_ENABLE, &Value); + Status = AcpiReadBitRegister (ACPI_BITREG_ARB_DISABLE, &Value); +} + + +/****************************************************************************** + * + * FUNCTION: AeMiscellaneousTests + * + * DESCRIPTION: Various ACPICA validation tests. + * + *****************************************************************************/ + +void +AeMiscellaneousTests ( + void) +{ + ACPI_HANDLE Handle; + ACPI_BUFFER ReturnBuf; + char Buffer[32]; + ACPI_VENDOR_UUID Uuid = {0, {ACPI_INIT_UUID (0,0,0,0,0,0,0,0,0,0,0)}}; + ACPI_STATUS Status; + UINT32 LockHandle1; + UINT32 LockHandle2; + ACPI_STATISTICS Stats; + + + AeHardwareInterfaces (); + AeSetupConfiguration (Ssdt3Code); + + AeTestBufferArgument(); + AeTestPackageArgument (); + ExecuteOSI ("Windows 2001", 0xFFFFFFFF); + ExecuteOSI ("MichiganTerminalSystem", 0); + + + ReturnBuf.Length = 32; + ReturnBuf.Pointer = Buffer; + + AcpiGetName (AcpiGbl_RootNode, ACPI_FULL_PATHNAME, &ReturnBuf); + AcpiEnableEvent (ACPI_EVENT_GLOBAL, 0); + + AcpiInstallGpeHandler (NULL, 0, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL); + AcpiSetGpeType (NULL, 0, ACPI_GPE_TYPE_WAKE_RUN); + AcpiEnableGpe (NULL, 0, ACPI_NOT_ISR); + AcpiRemoveGpeHandler (NULL, 0, AeGpeHandler); + + AcpiInstallGpeHandler (NULL, 0, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL); + AcpiSetGpeType (NULL, 0, ACPI_GPE_TYPE_WAKE_RUN); + AcpiEnableGpe (NULL, 0, ACPI_NOT_ISR); + + AcpiInstallGpeHandler (NULL, 1, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL); + AcpiSetGpeType (NULL, 1, ACPI_GPE_TYPE_RUNTIME); + AcpiEnableGpe (NULL, 1, ACPI_NOT_ISR); + + AcpiInstallGpeHandler (NULL, 2, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL); + AcpiSetGpeType (NULL, 2, ACPI_GPE_TYPE_WAKE); + AcpiEnableGpe (NULL, 2, ACPI_NOT_ISR); + + AcpiInstallGpeHandler (NULL, 3, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL); + AcpiSetGpeType (NULL, 3, ACPI_GPE_TYPE_WAKE_RUN); + + AcpiInstallGpeHandler (NULL, 4, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL); + AcpiSetGpeType (NULL, 4, ACPI_GPE_TYPE_RUNTIME); + + AcpiInstallGpeHandler (NULL, 5, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL); + AcpiSetGpeType (NULL, 5, ACPI_GPE_TYPE_WAKE); + + AcpiInstallGpeHandler (NULL, 0x19, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL); + AcpiSetGpeType (NULL, 0x19, ACPI_GPE_TYPE_WAKE_RUN); + AcpiEnableGpe (NULL, 0x19, ACPI_NOT_ISR); + + AfInstallGpeBlock (); + + + Status = AcpiGetHandle (NULL, "RSRC", &Handle); + if (ACPI_SUCCESS (Status)) + { + ReturnBuf.Length = ACPI_ALLOCATE_BUFFER; + + Status = AcpiGetVendorResource (Handle, "_CRS", &Uuid, &ReturnBuf); + if (ACPI_SUCCESS (Status)) + { + AcpiOsFree (ReturnBuf.Pointer); + } + } + + /* Test global lock */ + + Status = AcpiAcquireGlobalLock (0xFFFF, &LockHandle1); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("Could not get GlobalLock, %X\n", Status); + } + + Status = AcpiAcquireGlobalLock (0x5, &LockHandle2); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("Could not get GlobalLock, %X\n", Status); + } + + Status = AcpiReleaseGlobalLock (LockHandle1); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("Could not release GlobalLock, %X\n", Status); + } + + Status = AcpiReleaseGlobalLock (LockHandle2); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("Could not release GlobalLock, %X\n", Status); + } + + /* Get Devices */ + + Status = AcpiGetDevices (NULL, AeGetDevices, NULL, NULL); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("Could not AcpiGetDevices, %X\n", Status); + } + + Status = AcpiGetStatistics (&Stats); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("Could not AcpiGetStatistics, %X\n", Status); + } +} + diff --git a/sys/contrib/dev/acpica/tools/acpiexec/aehandlers.c b/sys/contrib/dev/acpica/tools/acpiexec/aehandlers.c new file mode 100644 index 000000000000..47c95abae91d --- /dev/null +++ b/sys/contrib/dev/acpica/tools/acpiexec/aehandlers.c @@ -0,0 +1,909 @@ +/****************************************************************************** + * + * Module Name: aehandlers - Various handlers for acpiexec + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2009, 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 "aecommon.h" + +#define _COMPONENT ACPI_TOOLS + ACPI_MODULE_NAME ("aehandlers") + +/* Local prototypes */ + +void +AeNotifyHandler ( + ACPI_HANDLE Device, + UINT32 Value, + void *Context); + +void +AeDeviceNotifyHandler ( + ACPI_HANDLE Device, + UINT32 Value, + void *Context); + +ACPI_STATUS +AeExceptionHandler ( + ACPI_STATUS AmlStatus, + ACPI_NAME Name, + UINT16 Opcode, + UINT32 AmlOffset, + void *Context); + +ACPI_STATUS +AeTableHandler ( + UINT32 Event, + void *Table, + void *Context); + +ACPI_STATUS +AeRegionInit ( + ACPI_HANDLE RegionHandle, + UINT32 Function, + void *HandlerContext, + void **RegionContext); + + +UINT32 SigintCount = 0; +AE_DEBUG_REGIONS AeRegions; + + +/****************************************************************************** + * + * FUNCTION: AeCtrlCHandler + * + * PARAMETERS: Sig + * + * RETURN: none + * + * DESCRIPTION: Control-C handler. Abort running control method if any. + * + *****************************************************************************/ + +void __cdecl +AeCtrlCHandler ( + int Sig) +{ + + signal (SIGINT, SIG_IGN); + SigintCount++; + + AcpiOsPrintf ("Caught a ctrl-c (#%d)\n\n", SigintCount); + + if (AcpiGbl_MethodExecuting) + { + AcpiGbl_AbortMethod = TRUE; + signal (SIGINT, AeCtrlCHandler); + + if (SigintCount < 10) + { + return; + } + } + + exit (0); +} + + +/****************************************************************************** + * + * FUNCTION: AeNotifyHandler + * + * PARAMETERS: Standard notify handler parameters + * + * RETURN: Status + * + * DESCRIPTION: System notify handler for AcpiExec utility. Used by the ASL + * test suite(s) to communicate errors and other information to + * this utility via the Notify() operator. + * + *****************************************************************************/ + +void +AeNotifyHandler ( + ACPI_HANDLE Device, + UINT32 Value, + void *Context) +{ + + switch (Value) + { +#if 0 + case 0: + printf ("[AcpiExec] Method Error 0x%X: Results not equal\n", Value); + if (AcpiGbl_DebugFile) + { + AcpiOsPrintf ("[AcpiExec] Method Error: Results not equal\n"); + } + break; + + + case 1: + printf ("[AcpiExec] Method Error: Incorrect numeric result\n"); + if (AcpiGbl_DebugFile) + { + AcpiOsPrintf ("[AcpiExec] Method Error: Incorrect numeric result\n"); + } + break; + + + case 2: + printf ("[AcpiExec] Method Error: An operand was overwritten\n"); + if (AcpiGbl_DebugFile) + { + AcpiOsPrintf ("[AcpiExec] Method Error: An operand was overwritten\n"); + } + break; + +#endif + + default: + printf ("[AcpiExec] Received a System Notify on [%4.4s] %p Value 0x%2.2X (%s)\n", + AcpiUtGetNodeName (Device), Device, Value, + AcpiUtGetNotifyName (Value)); + if (AcpiGbl_DebugFile) + { + AcpiOsPrintf ("[AcpiExec] Received a system notify, Value 0x%2.2X\n", Value); + } + + (void) AcpiEvaluateObject (Device, "_NOT", NULL, NULL); + break; + } + +} + + +/****************************************************************************** + * + * FUNCTION: AeDeviceNotifyHandler + * + * PARAMETERS: Standard notify handler parameters + * + * RETURN: Status + * + * DESCRIPTION: Device notify handler for AcpiExec utility. Used by the ASL + * test suite(s) to communicate errors and other information to + * this utility via the Notify() operator. + * + *****************************************************************************/ + +void +AeDeviceNotifyHandler ( + ACPI_HANDLE Device, + UINT32 Value, + void *Context) +{ + + printf ("[AcpiExec] Received a Device Notify on [%4.4s] %p Value 0x%2.2X (%s)\n", + AcpiUtGetNodeName (Device), Device, Value, + AcpiUtGetNotifyName (Value)); + if (AcpiGbl_DebugFile) + { + AcpiOsPrintf ("[AcpiExec] Received a device notify, Value 0x%2.2X\n", Value); + } + + (void) AcpiEvaluateObject (Device, "_NOT", NULL, NULL); +} + + +/****************************************************************************** + * + * FUNCTION: AeExceptionHandler + * + * PARAMETERS: Standard exception handler parameters + * + * RETURN: Status + * + * DESCRIPTION: System exception handler for AcpiExec utility. + * + *****************************************************************************/ + +ACPI_STATUS +AeExceptionHandler ( + ACPI_STATUS AmlStatus, + ACPI_NAME Name, + UINT16 Opcode, + UINT32 AmlOffset, + void *Context) +{ + ACPI_STATUS NewAmlStatus = AmlStatus; + ACPI_STATUS Status; + ACPI_BUFFER ReturnObj; + ACPI_OBJECT_LIST ArgList; + ACPI_OBJECT Arg[3]; + const char *Exception; + + + Exception = AcpiFormatException (AmlStatus); + AcpiOsPrintf ("[AcpiExec] Exception %s during execution ", Exception); + if (Name) + { + AcpiOsPrintf ("of method [%4.4s]", (char *) &Name); + } + else + { + AcpiOsPrintf ("at module level (table load)"); + } + AcpiOsPrintf (" Opcode [%s] @%X\n", AcpiPsGetOpcodeName (Opcode), AmlOffset); + + /* + * Invoke the _ERR method if present + * + * Setup parameter object + */ + ArgList.Count = 3; + ArgList.Pointer = Arg; + + Arg[0].Type = ACPI_TYPE_INTEGER; + Arg[0].Integer.Value = AmlStatus; + + Arg[1].Type = ACPI_TYPE_STRING; + Arg[1].String.Pointer = ACPI_CAST_PTR (char, Exception); + Arg[1].String.Length = ACPI_STRLEN (Exception); + + Arg[2].Type = ACPI_TYPE_INTEGER; + Arg[2].Integer.Value = ACPI_TO_INTEGER (AcpiOsGetThreadId()); + + /* Setup return buffer */ + + ReturnObj.Pointer = NULL; + ReturnObj.Length = ACPI_ALLOCATE_BUFFER; + + Status = AcpiEvaluateObject (NULL, "\\_ERR", &ArgList, &ReturnObj); + if (ACPI_SUCCESS (Status)) + { + if (ReturnObj.Pointer) + { + /* Override original status */ + + NewAmlStatus = (ACPI_STATUS) + ((ACPI_OBJECT *) ReturnObj.Pointer)->Integer.Value; + + AcpiOsFree (ReturnObj.Pointer); + } + } + else if (Status != AE_NOT_FOUND) + { + AcpiOsPrintf ("[AcpiExec] Could not execute _ERR method, %s\n", + AcpiFormatException (Status)); + } + + /* Global override */ + + if (AcpiGbl_IgnoreErrors) + { + NewAmlStatus = AE_OK; + } + + if (NewAmlStatus != AmlStatus) + { + AcpiOsPrintf ("[AcpiExec] Exception override, new status %s\n", + AcpiFormatException (NewAmlStatus)); + } + + return (NewAmlStatus); +} + + +/****************************************************************************** + * + * FUNCTION: AeTableHandler + * + * PARAMETERS: Table handler + * + * RETURN: Status + * + * DESCRIPTION: System table handler for AcpiExec utility. + * + *****************************************************************************/ + +char *TableEvents[] = +{ + "LOAD", + "UNLOAD", + "UNKNOWN" +}; + +ACPI_STATUS +AeTableHandler ( + UINT32 Event, + void *Table, + void *Context) +{ + + if (Event > ACPI_NUM_TABLE_EVENTS) + { + Event = ACPI_NUM_TABLE_EVENTS; + } + + /* TBD: could dump entire table header, need a header dump routine */ + + printf ("[AcpiExec] Table Event %s, [%4.4s] %p\n", + TableEvents[Event], ((ACPI_TABLE_HEADER *) Table)->Signature, Table); + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: AeGpeHandler + * + * DESCRIPTION: GPE handler for acpiexec + * + *****************************************************************************/ + +UINT32 +AeGpeHandler ( + void *Context) +{ + + + AcpiOsPrintf ("Received a GPE at handler\n"); + return (0); +} + + +/****************************************************************************** + * + * FUNCTION: AeRegionInit + * + * PARAMETERS: None + * + * RETURN: Status + * + * DESCRIPTION: Opregion init function. + * + *****************************************************************************/ + +ACPI_STATUS +AeRegionInit ( + ACPI_HANDLE RegionHandle, + UINT32 Function, + void *HandlerContext, + void **RegionContext) +{ + /* + * Real simple, set the RegionContext to the RegionHandle + */ + *RegionContext = RegionHandle; + + return AE_OK; +} + + +/****************************************************************************** + * + * FUNCTION: AeInstallHandlers + * + * PARAMETERS: None + * + * RETURN: Status + * + * DESCRIPTION: Install handlers for the AcpiExec utility. + * + *****************************************************************************/ + +ACPI_ADR_SPACE_TYPE SpaceId[] = {0, 1, 2, 3, 4, 5, 6, 0x80}; +#define AEXEC_NUM_REGIONS 8 + +ACPI_STATUS +AeInstallHandlers (void) +{ + ACPI_STATUS Status; + UINT32 i; + ACPI_HANDLE Handle; + + + ACPI_FUNCTION_ENTRY (); + + + Status = AcpiInstallTableHandler (AeTableHandler, NULL); + if (ACPI_FAILURE (Status)) + { + printf ("Could not install table handler, %s\n", + AcpiFormatException (Status)); + } + + Status = AcpiInstallExceptionHandler (AeExceptionHandler); + if (ACPI_FAILURE (Status)) + { + printf ("Could not install exception handler, %s\n", + AcpiFormatException (Status)); + } + + /* Install global notify handler */ + + Status = AcpiInstallNotifyHandler (ACPI_ROOT_OBJECT, ACPI_SYSTEM_NOTIFY, + AeNotifyHandler, NULL); + if (ACPI_FAILURE (Status)) + { + printf ("Could not install a global notify handler, %s\n", + AcpiFormatException (Status)); + } + + Status = AcpiInstallNotifyHandler (ACPI_ROOT_OBJECT, ACPI_DEVICE_NOTIFY, + AeDeviceNotifyHandler, NULL); + if (ACPI_FAILURE (Status)) + { + printf ("Could not install a global notify handler, %s\n", + AcpiFormatException (Status)); + } + + Status = AcpiGetHandle (NULL, "\\_SB", &Handle); + if (ACPI_SUCCESS (Status)) + { + Status = AcpiInstallNotifyHandler (Handle, ACPI_SYSTEM_NOTIFY, + AeNotifyHandler, NULL); + if (ACPI_FAILURE (Status)) + { + printf ("Could not install a notify handler, %s\n", + AcpiFormatException (Status)); + } + + Status = AcpiRemoveNotifyHandler (Handle, ACPI_SYSTEM_NOTIFY, + AeNotifyHandler); + if (ACPI_FAILURE (Status)) + { + printf ("Could not remove a notify handler, %s\n", + AcpiFormatException (Status)); + } + + Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY, + AeNotifyHandler, NULL); + Status = AcpiRemoveNotifyHandler (Handle, ACPI_ALL_NOTIFY, + AeNotifyHandler); + Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY, + AeNotifyHandler, NULL); + if (ACPI_FAILURE (Status)) + { + printf ("Could not install a notify handler, %s\n", + AcpiFormatException (Status)); + } + } + else + { + printf ("No _SB_ found, %s\n", AcpiFormatException (Status)); + } + + /* Set a handler for all supported operation regions */ + + for (i = 0; i < AEXEC_NUM_REGIONS; i++) + { + Status = AcpiRemoveAddressSpaceHandler (AcpiGbl_RootNode, + SpaceId[i], AeRegionHandler); + + /* Install handler at the root object. + * TBD: all default handlers should be installed here! + */ + Status = AcpiInstallAddressSpaceHandler (AcpiGbl_RootNode, + SpaceId[i], AeRegionHandler, AeRegionInit, NULL); + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, Status, + "Could not install an OpRegion handler for %s space(%d)", + AcpiUtGetRegionName((UINT8) SpaceId[i]), SpaceId[i])); + return (Status); + } + } + + /* + * Initialize the global Region Handler space + * MCW 3/23/00 + */ + AeRegions.NumberOfRegions = 0; + AeRegions.RegionList = NULL; + + return Status; +} + + +/****************************************************************************** + * + * FUNCTION: AeRegionHandler + * + * PARAMETERS: Standard region handler parameters + * + * RETURN: Status + * + * DESCRIPTION: Test handler - Handles some dummy regions via memory that can + * be manipulated in Ring 3. Simulates actual reads and writes. + * + *****************************************************************************/ + +ACPI_STATUS +AeRegionHandler ( + UINT32 Function, + ACPI_PHYSICAL_ADDRESS Address, + UINT32 BitWidth, + ACPI_INTEGER *Value, + void *HandlerContext, + void *RegionContext) +{ + + ACPI_OPERAND_OBJECT *RegionObject = (ACPI_OPERAND_OBJECT*) RegionContext; + ACPI_PHYSICAL_ADDRESS BaseAddress; + ACPI_SIZE Length; + BOOLEAN BufferExists; + AE_REGION *RegionElement; + void *BufferValue; + ACPI_STATUS Status; + UINT32 ByteWidth; + UINT32 i; + UINT8 SpaceId; + + + ACPI_FUNCTION_NAME (AeRegionHandler); + + /* + * If the object is not a region, simply return + */ + if (RegionObject->Region.Type != ACPI_TYPE_REGION) + { + return AE_OK; + } + + /* + * Region support can be disabled with the -r option. + * We use this to support dynamically loaded tables where we pass a valid + * address to the AML. + */ + if (AcpiGbl_DbOpt_NoRegionSupport) + { + BufferValue = ACPI_TO_POINTER (Address); + ByteWidth = (BitWidth / 8); + + if (BitWidth % 8) + { + ByteWidth += 1; + } + goto DoFunction; + } + + /* + * Find the region's address space and length before searching + * the linked list. + */ + BaseAddress = RegionObject->Region.Address; + Length = (ACPI_SIZE) RegionObject->Region.Length; + SpaceId = RegionObject->Region.SpaceId; + + ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, "Operation Region request on %s at 0x%X\n", + AcpiUtGetRegionName (RegionObject->Region.SpaceId), + (UINT32) Address)); + + if (SpaceId == ACPI_ADR_SPACE_SYSTEM_IO) + { + /* + * For I/O space, exercise the port validation + */ + switch (Function & ACPI_IO_MASK) + { + case ACPI_READ: + Status = AcpiHwReadPort (Address, (UINT32 *) Value, BitWidth); + break; + + case ACPI_WRITE: + Status = AcpiHwWritePort (Address, (UINT32) *Value, BitWidth); + break; + + default: + Status = AE_BAD_PARAMETER; + break; + } + + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* Now go ahead and simulate the hardware */ + } + + else if (SpaceId == ACPI_ADR_SPACE_SMBUS) + { + Length = 0; + + switch (Function & ACPI_IO_MASK) + { + case ACPI_READ: + switch (Function >> 16) + { + case AML_FIELD_ATTRIB_SMB_QUICK: + case AML_FIELD_ATTRIB_SMB_SEND_RCV: + case AML_FIELD_ATTRIB_SMB_BYTE: + Length = 1; + break; + + case AML_FIELD_ATTRIB_SMB_WORD: + case AML_FIELD_ATTRIB_SMB_WORD_CALL: + Length = 2; + break; + + case AML_FIELD_ATTRIB_SMB_BLOCK: + case AML_FIELD_ATTRIB_SMB_BLOCK_CALL: + Length = 32; + break; + + default: + break; + } + break; + + case ACPI_WRITE: + switch (Function >> 16) + { + case AML_FIELD_ATTRIB_SMB_QUICK: + case AML_FIELD_ATTRIB_SMB_SEND_RCV: + case AML_FIELD_ATTRIB_SMB_BYTE: + case AML_FIELD_ATTRIB_SMB_WORD: + case AML_FIELD_ATTRIB_SMB_BLOCK: + Length = 0; + break; + + case AML_FIELD_ATTRIB_SMB_WORD_CALL: + Length = 2; + break; + + case AML_FIELD_ATTRIB_SMB_BLOCK_CALL: + Length = 32; + break; + + default: + break; + } + break; + + default: + break; + } + + for (i = 0; i < Length; i++) + { + ((UINT8 *) Value)[i+2] = (UINT8) (0xA0 + i); + } + + ((UINT8 *) Value)[0] = 0x7A; + ((UINT8 *) Value)[1] = (UINT8) Length; + + return AE_OK; + } + + /* + * Search through the linked list for this region's buffer + */ + BufferExists = FALSE; + RegionElement = AeRegions.RegionList; + + if (AeRegions.NumberOfRegions) + { + while (!BufferExists && RegionElement) + { + if (RegionElement->Address == BaseAddress && + RegionElement->Length == Length && + RegionElement->SpaceId == SpaceId) + { + BufferExists = TRUE; + } + else + { + RegionElement = RegionElement->NextRegion; + } + } + } + + /* + * If the Region buffer does not exist, create it now + */ + if (!BufferExists) + { + /* + * Do the memory allocations first + */ + RegionElement = AcpiOsAllocate (sizeof (AE_REGION)); + if (!RegionElement) + { + return AE_NO_MEMORY; + } + + RegionElement->Buffer = AcpiOsAllocate (Length); + if (!RegionElement->Buffer) + { + AcpiOsFree (RegionElement); + return AE_NO_MEMORY; + } + + ACPI_MEMSET (RegionElement->Buffer, 0, Length); + RegionElement->Address = BaseAddress; + RegionElement->Length = Length; + RegionElement->SpaceId = SpaceId; + RegionElement->NextRegion = NULL; + + /* + * Increment the number of regions and put this one + * at the head of the list as it will probably get accessed + * more often anyway. + */ + AeRegions.NumberOfRegions += 1; + + if (AeRegions.RegionList) + { + RegionElement->NextRegion = AeRegions.RegionList; + } + + AeRegions.RegionList = RegionElement; + } + + /* + * Calculate the size of the memory copy + */ + ByteWidth = (BitWidth / 8); + + if (BitWidth % 8) + { + ByteWidth += 1; + } + + /* + * The buffer exists and is pointed to by RegionElement. + * We now need to verify the request is valid and perform the operation. + * + * NOTE: RegionElement->Length is in bytes, therefore it we compare against + * ByteWidth (see above) + */ + if (((ACPI_INTEGER) Address + ByteWidth) > + ((ACPI_INTEGER)(RegionElement->Address) + RegionElement->Length)) + { + ACPI_WARNING ((AE_INFO, + "Request on [%4.4s] is beyond region limit Req-%X+%X, Base=%X, Len-%X", + (RegionObject->Region.Node)->Name.Ascii, (UINT32) Address, + ByteWidth, (UINT32)(RegionElement->Address), + RegionElement->Length)); + + return AE_AML_REGION_LIMIT; + } + + /* + * Get BufferValue to point to the "address" in the buffer + */ + BufferValue = ((UINT8 *) RegionElement->Buffer + + ((ACPI_INTEGER) Address - (ACPI_INTEGER) RegionElement->Address)); + +DoFunction: + + /* + * Perform a read or write to the buffer space + */ + switch (Function) + { + case ACPI_READ: + /* + * Set the pointer Value to whatever is in the buffer + */ + ACPI_MEMCPY (Value, BufferValue, ByteWidth); + break; + + case ACPI_WRITE: + /* + * Write the contents of Value to the buffer + */ + ACPI_MEMCPY (BufferValue, Value, ByteWidth); + break; + + default: + return AE_BAD_PARAMETER; + } + return AE_OK; +} + + + diff --git a/sys/contrib/dev/acpica/tools/acpiexec/aemain.c b/sys/contrib/dev/acpica/tools/acpiexec/aemain.c new file mode 100644 index 000000000000..3aec0740fecf --- /dev/null +++ b/sys/contrib/dev/acpica/tools/acpiexec/aemain.c @@ -0,0 +1,435 @@ +/****************************************************************************** + * + * Module Name: aemain - Main routine for the AcpiExec utility + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2009, 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 "aecommon.h" + +#ifdef _DEBUG +#include <crtdbg.h> +#endif + +#define _COMPONENT PARSER + ACPI_MODULE_NAME ("aemain") + +UINT8 AcpiGbl_BatchMode = 0; +BOOLEAN AcpiGbl_IgnoreErrors = FALSE; +BOOLEAN AcpiGbl_DbOpt_NoRegionSupport = FALSE; +BOOLEAN AcpiGbl_DebugTimeout = FALSE; +char BatchBuffer[128]; + + +/****************************************************************************** + * + * FUNCTION: usage + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Print a usage message + * + *****************************************************************************/ + +static void +usage (void) +{ + printf ("Usage: acpiexec [Options] [InputFile]\n\n"); + + printf ("Where:\n"); + printf (" -? Display this message\n"); + printf (" -a Do not abort methods on error\n"); + printf (" -b <CommandLine> Batch mode command execution\n"); + printf (" -e [Method] Batch mode method execution\n"); + printf (" -i Do not run STA/INI methods during init\n"); + printf (" -m Display final memory use statistics\n"); + printf (" -o <OutputFile> Send output to this file\n"); + printf (" -r Disable OpRegion address simulation\n"); + printf (" -s Enable Interpreter Slack Mode\n"); + printf (" -t Enable Interpreter Serialized Mode\n"); + printf (" -v Verbose init output\n"); + printf (" -x <DebugLevel> Specify debug output level\n"); + printf (" -z Enable debug semaphore timeout\n"); +} + + +/****************************************************************************** + * + * FUNCTION: AcpiDbRunBatchMode + * + * PARAMETERS: BatchCommandLine - A semicolon separated list of commands + * to be executed. + * Use only commas to separate elements of + * particular command. + * RETURN: Status + * + * DESCRIPTION: For each command of list separated by ';' prepare the command + * buffer and pass it to AcpiDbCommandDispatch. + * + *****************************************************************************/ + +static ACPI_STATUS +AcpiDbRunBatchMode ( + void) +{ + ACPI_STATUS Status; + char *Ptr = BatchBuffer; + char *Cmd = Ptr; + UINT8 Run = 0; + + AcpiGbl_MethodExecuting = FALSE; + AcpiGbl_StepToNextCall = FALSE; + + while (*Ptr) + { + if (*Ptr == ',') + { + /* Convert commas to spaces */ + *Ptr = ' '; + } + else if (*Ptr == ';') + { + *Ptr = '\0'; + Run = 1; + } + + Ptr++; + + if (Run || (*Ptr == '\0')) + { + (void) AcpiDbCommandDispatch (Cmd, NULL, NULL); + Run = 0; + Cmd = Ptr; + } + } + + Status = AcpiTerminate (); + return (Status); +} + + +/****************************************************************************** + * + * FUNCTION: main + * + * PARAMETERS: argc, argv + * + * RETURN: Status + * + * DESCRIPTION: Main routine for AcpiDump utility + * + *****************************************************************************/ + +int ACPI_SYSTEM_XFACE +main ( + int argc, + char **argv) +{ + int j; + ACPI_STATUS Status; + UINT32 InitFlags; + ACPI_TABLE_HEADER *Table; + + +#ifdef _DEBUG + _CrtSetDbgFlag (_CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_LEAK_CHECK_DF | + _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG)); +#endif + + printf ("\nIntel ACPI Component Architecture\nAML Execution/Debug Utility"); + printf (" version %8.8X", ((UINT32) ACPI_CA_VERSION)); + printf (" [%s]\n\n", __DATE__); + + if (argc < 2) + { + usage (); + return 0; + } + + signal (SIGINT, AeCtrlCHandler); + + /* Init globals */ + + AcpiDbgLevel = ACPI_NORMAL_DEFAULT; + AcpiDbgLayer = 0xFFFFFFFF; + + /* Init ACPI and start debugger thread */ + + AcpiInitializeSubsystem (); + + /* Get the command line options */ + + while ((j = AcpiGetopt (argc, argv, "?ab:de^gimo:rstvx:z")) != EOF) switch(j) + { + case 'a': + AcpiGbl_IgnoreErrors = TRUE; + break; + + case 'b': + if (strlen (AcpiGbl_Optarg) > 127) + { + printf ("**** The length of command line (%u) exceeded maximum (127)\n", + (UINT32) strlen (AcpiGbl_Optarg)); + return -1; + } + AcpiGbl_BatchMode = 1; + strcpy (BatchBuffer, AcpiGbl_Optarg); + break; + + case 'd': + AcpiGbl_DbOpt_disasm = TRUE; + AcpiGbl_DbOpt_stats = TRUE; + break; + + case 'e': + AcpiGbl_BatchMode = 2; + switch (AcpiGbl_Optarg[0]) + { + case '^': + strcpy (BatchBuffer, "MAIN"); + break; + default: + strcpy (BatchBuffer, AcpiGbl_Optarg); + break; + } + break; + + case 'g': + AcpiGbl_DbOpt_tables = TRUE; + AcpiGbl_DbFilename = NULL; + break; + + case 'i': + AcpiGbl_DbOpt_ini_methods = FALSE; + break; + + case 'm': +#ifdef ACPI_DBG_TRACK_ALLOCATIONS + AcpiGbl_DisplayFinalMemStats = TRUE; +#endif + break; + + case 'o': + printf ("O option is not implemented\n"); + break; + + case 'r': + AcpiGbl_DbOpt_NoRegionSupport = TRUE; + break; + + case 's': + AcpiGbl_EnableInterpreterSlack = TRUE; + printf ("Enabling AML Interpreter slack mode\n"); + break; + + case 't': + AcpiGbl_AllMethodsSerialized = TRUE; + printf ("Enabling AML Interpreter serialized mode\n"); + break; + + case 'v': + AcpiDbgLevel |= ACPI_LV_INIT_NAMES; + break; + + case 'x': + AcpiDbgLevel = strtoul (AcpiGbl_Optarg, NULL, 0); + AcpiGbl_DbConsoleDebugLevel = AcpiDbgLevel; + printf ("Debug Level: 0x%8.8X\n", AcpiDbgLevel); + break; + + case 'z': + AcpiGbl_DebugTimeout = TRUE; + break; + + case '?': + default: + usage(); + return -1; + } + + + InitFlags = (ACPI_NO_HANDLER_INIT | ACPI_NO_ACPI_ENABLE); + if (!AcpiGbl_DbOpt_ini_methods) + { + InitFlags |= (ACPI_NO_DEVICE_INIT | ACPI_NO_OBJECT_INIT); + } + + /* Standalone filename is the only argument */ + + if (argv[AcpiGbl_Optind]) + { + AcpiGbl_DbOpt_tables = TRUE; + AcpiGbl_DbFilename = argv[AcpiGbl_Optind]; + + Status = AcpiDbReadTableFromFile (AcpiGbl_DbFilename, &Table); + if (ACPI_FAILURE (Status)) + { + printf ("**** Could not get input table, %s\n", AcpiFormatException (Status)); + goto enterloop; + } + + AeBuildLocalTables (Table); + Status = AeInstallTables (); + if (ACPI_FAILURE (Status)) + { + printf ("**** Could not load ACPI tables, %s\n", AcpiFormatException (Status)); + goto enterloop; + } + + Status = AeInstallHandlers (); + if (ACPI_FAILURE (Status)) + { + goto enterloop; + } + + /* + * TBD: + * Need a way to call this after the "LOAD" command + */ + Status = AcpiEnableSubsystem (InitFlags); + if (ACPI_FAILURE (Status)) + { + printf ("**** Could not EnableSubsystem, %s\n", AcpiFormatException (Status)); + goto enterloop; + } + + Status = AcpiInitializeObjects (InitFlags); + if (ACPI_FAILURE (Status)) + { + printf ("**** Could not InitializeObjects, %s\n", AcpiFormatException (Status)); + goto enterloop; + } + + AeMiscellaneousTests (); + } + +enterloop: + + if (AcpiGbl_BatchMode == 1) + { + AcpiDbRunBatchMode (); + } + else if (AcpiGbl_BatchMode == 2) + { + AcpiDbExecute (BatchBuffer, NULL, EX_NO_SINGLE_STEP); + } + else + { + /* Enter the debugger command loop */ + + AcpiDbUserCommands (ACPI_DEBUGGER_COMMAND_PROMPT, NULL); + } + + return 0; +} + diff --git a/sys/contrib/dev/acpica/tools/acpiexec/aetables.c b/sys/contrib/dev/acpica/tools/acpiexec/aetables.c new file mode 100644 index 000000000000..1bf3b1e0d208 --- /dev/null +++ b/sys/contrib/dev/acpica/tools/acpiexec/aetables.c @@ -0,0 +1,505 @@ +/****************************************************************************** + * + * Module Name: aetables - Miscellaneous ACPI tables for acpiexec utility + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2009, 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 "aecommon.h" + +#define _COMPONENT ACPI_TOOLS + ACPI_MODULE_NAME ("aetables") + +/* Local prototypes */ + +void +AeTableOverride ( + ACPI_TABLE_HEADER *ExistingTable, + ACPI_TABLE_HEADER **NewTable); + +ACPI_PHYSICAL_ADDRESS +AeLocalGetRootPointer ( + void); + +/* + * Misc ACPI tables to be installed + */ + +/* Default DSDT. This will be replaced with the input DSDT */ + +unsigned char DsdtCode[] = +{ + 0x44,0x53,0x44,0x54,0x24,0x00,0x00,0x00, /* 00000000 "DSDT$..." */ + 0x02,0x6F,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 ".oIntel." */ + 0x4E,0x75,0x6C,0x6C,0x44,0x53,0x44,0x54, /* 00000010 "NullDSDT" */ + 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ + 0x04,0x12,0x08,0x20, +}; + +/* Several example SSDTs */ + +unsigned char Ssdt1Code[] = /* Has method _T98 */ +{ + 0x53,0x53,0x44,0x54,0x30,0x00,0x00,0x00, /* 00000000 "SSDT0..." */ + 0x01,0xB8,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 "..Intel." */ + 0x4D,0x61,0x6E,0x79,0x00,0x00,0x00,0x00, /* 00000010 "Many...." */ + 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ + 0x24,0x04,0x03,0x20,0x14,0x0B,0x5F,0x54, /* 00000020 "$.. .._T" */ + 0x39,0x38,0x00,0x70,0x0A,0x04,0x60,0xA4, /* 00000028 "98.p..`." */ +}; + +unsigned char Ssdt2Code[] = /* Has method _T99 */ +{ + 0x53,0x53,0x44,0x54,0x30,0x00,0x00,0x00, /* 00000000 "SSDT0..." */ + 0x01,0xB7,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 "..Intel." */ + 0x4D,0x61,0x6E,0x79,0x00,0x00,0x00,0x00, /* 00000010 "Many...." */ + 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ + 0x24,0x04,0x03,0x20,0x14,0x0B,0x5F,0x54, /* 00000020 "$.. .._T" */ + 0x39,0x39,0x00,0x70,0x0A,0x04,0x60,0xA4, /* 00000028 "99.p..`." */ +}; + +unsigned char Ssdt3Code[] = /* Has method _T97 */ +{ + 0x54,0x53,0x44,0x54,0x30,0x00,0x00,0x00, /* 00000000 "TSDT0..." */ + 0x01,0xB8,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 "..Intel." */ + 0x4D,0x61,0x6E,0x79,0x00,0x00,0x00,0x00, /* 00000010 "Many...." */ + 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ + 0x24,0x04,0x03,0x20,0x14,0x0B,0x5F,0x54, /* 00000020 "$.. .._T" */ + 0x39,0x37,0x00,0x70,0x0A,0x04,0x60,0xA4, /* 00000028 "97.p..`." */ +}; + +/* Example OEM table */ + +unsigned char Oem1Code[] = +{ + 0x4F,0x45,0x4D,0x31,0x38,0x00,0x00,0x00, /* 00000000 "OEM18..." */ + 0x01,0x4B,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 ".KIntel." */ + 0x4D,0x61,0x6E,0x79,0x00,0x00,0x00,0x00, /* 00000010 "Many...." */ + 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ + 0x18,0x09,0x03,0x20,0x08,0x5F,0x58,0x54, /* 00000020 "... ._XT" */ + 0x32,0x0A,0x04,0x14,0x0C,0x5F,0x58,0x54, /* 00000028 "2...._XT" */ + 0x31,0x00,0x70,0x01,0x5F,0x58,0x54,0x32, /* 00000030 "1.p._XT2" */ +}; + +/* + * Example installable control method + * + * DefinitionBlock ("", "DSDT", 2, "Intel", "MTHDTEST", 0x20090512) + * { + * Method (\_SI_._T97, 1, Serialized) + * { + * Store ("Example installed method", Debug) + * Store (Arg0, Debug) + * Return () + * } + * } + * + * Compiled byte code below. + */ +unsigned char MethodCode[] = +{ + 0x44,0x53,0x44,0x54,0x53,0x00,0x00,0x00, /* 00000000 "DSDTS..." */ + 0x02,0xF9,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 "..Intel." */ + 0x4D,0x54,0x48,0x44,0x54,0x45,0x53,0x54, /* 00000010 "MTHDTEST" */ + 0x12,0x05,0x09,0x20,0x49,0x4E,0x54,0x4C, /* 00000018 "... INTL" */ + 0x22,0x04,0x09,0x20,0x14,0x2E,0x2E,0x5F, /* 00000020 "".. ..._" */ + 0x54,0x49,0x5F,0x5F,0x54,0x39,0x37,0x09, /* 00000028 "SI__T97." */ + 0x70,0x0D,0x45,0x78,0x61,0x6D,0x70,0x6C, /* 00000030 "p.Exampl" */ + 0x65,0x20,0x69,0x6E,0x73,0x74,0x61,0x6C, /* 00000038 "e instal" */ + 0x6C,0x65,0x64,0x20,0x6D,0x65,0x74,0x68, /* 00000040 "led meth" */ + 0x6F,0x64,0x00,0x5B,0x31,0x70,0x68,0x5B, /* 00000048 "od.[1ph[" */ + 0x31,0xA4,0x00, +}; + + +/* + * We need a local FADT so that the hardware subcomponent will function, + * even though the underlying OSD HW access functions don't do + * anything. + */ +ACPI_TABLE_HEADER *DsdtToInstallOverride; +ACPI_TABLE_RSDP LocalRSDP; +ACPI_TABLE_FADT LocalFADT; +ACPI_TABLE_FACS LocalFACS; +ACPI_TABLE_HEADER LocalDSDT; +ACPI_TABLE_HEADER LocalTEST; +ACPI_TABLE_HEADER LocalBADTABLE; +ACPI_TABLE_RSDT *LocalRSDT; + +#define RSDT_TABLES 7 +#define RSDT_SIZE (sizeof (ACPI_TABLE_RSDT) + ((RSDT_TABLES -1) * sizeof (UINT32))) + +#define ACPI_MAX_INIT_TABLES (16) +static ACPI_TABLE_DESC Tables[ACPI_MAX_INIT_TABLES]; + + +/****************************************************************************** + * + * FUNCTION: AeTableOverride + * + * DESCRIPTION: Local implementation of AcpiOsTableOverride. + * Exercise the override mechanism + * + *****************************************************************************/ + +void +AeTableOverride ( + ACPI_TABLE_HEADER *ExistingTable, + ACPI_TABLE_HEADER **NewTable) +{ + + /* This code exercises the table override mechanism in the core */ + + if (ACPI_COMPARE_NAME (ExistingTable->Signature, ACPI_SIG_DSDT)) + { + *NewTable = DsdtToInstallOverride; + } + + /* This code tests override of dynamically loaded tables */ + + else if (ACPI_COMPARE_NAME (ExistingTable->Signature, "TSDT")) + { + *NewTable = ACPI_CAST_PTR (ACPI_TABLE_HEADER, Ssdt3Code); + } +} + + +/****************************************************************************** + * + * FUNCTION: AeBuildLocalTables + * + * PARAMETERS: UserTable - pointer to an input table to be loaded. + * a DSDT or SSDT + * + * RETURN: Status + * + * DESCRIPTION: Build a complete ACPI table chain, with a local RSDP, RSDT, + * FADT, and several other test tables. + * + *****************************************************************************/ + +ACPI_STATUS +AeBuildLocalTables ( + ACPI_TABLE_HEADER *UserTable) +{ + ACPI_PHYSICAL_ADDRESS DsdtAddress; + + + /* Build an RSDT */ + + LocalRSDT = AcpiOsAllocate (RSDT_SIZE); + if (!LocalRSDT) + { + return AE_NO_MEMORY; + } + + ACPI_MEMSET (LocalRSDT, 0, RSDT_SIZE); + ACPI_STRNCPY (LocalRSDT->Header.Signature, ACPI_SIG_RSDT, 4); + LocalRSDT->Header.Length = RSDT_SIZE; + + LocalRSDT->TableOffsetEntry[0] = ACPI_PTR_TO_PHYSADDR (&LocalTEST); + LocalRSDT->TableOffsetEntry[1] = ACPI_PTR_TO_PHYSADDR (&LocalBADTABLE); + LocalRSDT->TableOffsetEntry[2] = ACPI_PTR_TO_PHYSADDR (&LocalFADT); + LocalRSDT->TableOffsetEntry[3] = ACPI_PTR_TO_PHYSADDR (&LocalTEST); /* Just a placeholder for a user SSDT */ + + /* Install two SSDTs to test multiple table support */ + + LocalRSDT->TableOffsetEntry[4] = ACPI_PTR_TO_PHYSADDR (&Ssdt1Code); + LocalRSDT->TableOffsetEntry[5] = ACPI_PTR_TO_PHYSADDR (&Ssdt2Code); + + /* Install the OEM1 table to test LoadTable */ + + LocalRSDT->TableOffsetEntry[6] = ACPI_PTR_TO_PHYSADDR (&Oem1Code); + + /* Build an RSDP */ + + ACPI_MEMSET (&LocalRSDP, 0, sizeof (ACPI_TABLE_RSDP)); + ACPI_MEMCPY (LocalRSDP.Signature, ACPI_SIG_RSDP, 8); + LocalRSDP.Revision = 1; + LocalRSDP.RsdtPhysicalAddress = ACPI_PTR_TO_PHYSADDR (LocalRSDT); + LocalRSDP.Length = sizeof (ACPI_TABLE_RSDT); + ACPI_MEMCPY (LocalRSDP.OemId, "I_TEST", 6); + + /* + * Examine the incoming user table. At this point, it has been verified + * to be either a DSDT, SSDT, or a PSDT, but they must be handled differently + */ + if (ACPI_COMPARE_NAME (UserTable->Signature, ACPI_SIG_DSDT)) + { + /* The incoming user table is a DSDT */ + + DsdtAddress = ACPI_PTR_TO_PHYSADDR (&DsdtCode); + DsdtToInstallOverride = UserTable; + } + else + { + /* Build a local DSDT because incoming table is an SSDT or PSDT */ + + ACPI_MEMSET (&LocalDSDT, 0, sizeof (ACPI_TABLE_HEADER)); + ACPI_STRNCPY (LocalDSDT.Signature, ACPI_SIG_DSDT, 4); + LocalDSDT.Revision = 1; + LocalDSDT.Length = sizeof (ACPI_TABLE_HEADER); + LocalDSDT.Checksum = (UINT8) -AcpiTbChecksum ((void *) &LocalDSDT, LocalDSDT.Length); + + /* Install incoming table (SSDT or PSDT) directly into the RSDT */ + + LocalRSDT->TableOffsetEntry[3] = ACPI_PTR_TO_PHYSADDR (UserTable); + DsdtAddress = ACPI_PTR_TO_PHYSADDR (&LocalDSDT); + DsdtToInstallOverride = &LocalDSDT; + } + + /* Set checksums for both RSDT and RSDP */ + + LocalRSDT->Header.Checksum = (UINT8) -AcpiTbChecksum ((void *) LocalRSDT, LocalRSDT->Header.Length); + LocalRSDP.Checksum = (UINT8) -AcpiTbChecksum ((void *) &LocalRSDP, ACPI_RSDP_CHECKSUM_LENGTH); + + /* + * Build a FADT so we can test the hardware/event init + */ + ACPI_MEMSET (&LocalFADT, 0, sizeof (ACPI_TABLE_FADT)); + ACPI_STRNCPY (LocalFADT.Header.Signature, ACPI_SIG_FADT, 4); + + /* Setup FADT header and DSDT/FACS addresses */ + + LocalFADT.Dsdt = DsdtAddress; + LocalFADT.Facs = ACPI_PTR_TO_PHYSADDR (&LocalFACS); + + LocalFADT.XDsdt = DsdtAddress; + LocalFADT.XFacs = ACPI_PTR_TO_PHYSADDR (&LocalFACS); + + LocalFADT.Header.Revision = 3; + LocalFADT.Header.Length = sizeof (ACPI_TABLE_FADT); + + /* Miscellaneous FADT fields */ + + LocalFADT.Gpe0BlockLength = 16; + LocalFADT.Gpe1BlockLength = 6; + LocalFADT.Gpe1Base = 96; + + LocalFADT.Pm1EventLength = 4; + LocalFADT.Pm1ControlLength = 2; + LocalFADT.PmTimerLength = 4; + + LocalFADT.Gpe0Block = 0x00001234; + LocalFADT.Gpe1Block = 0x00005678; + + LocalFADT.Pm1aEventBlock = 0x00001aaa; + LocalFADT.Pm1bEventBlock = 0x00001bbb; + LocalFADT.PmTimerBlock = 0xA0; + LocalFADT.Pm1aControlBlock = 0xB0; + + /* Setup one example X-64 field */ + + LocalFADT.XPm1bEventBlock.SpaceId = ACPI_ADR_SPACE_SYSTEM_IO; + LocalFADT.XPm1bEventBlock.Address = LocalFADT.Pm1bEventBlock; + LocalFADT.XPm1bEventBlock.BitWidth = (UINT8) ACPI_MUL_8 (LocalFADT.Pm1EventLength); + + /* Complete the FADT with the checksum */ + + LocalFADT.Header.Checksum = 0; + LocalFADT.Header.Checksum = (UINT8) -AcpiTbChecksum ((void *) &LocalFADT, LocalFADT.Header.Length); + + /* Build a FACS */ + + ACPI_MEMSET (&LocalFACS, 0, sizeof (ACPI_TABLE_FACS)); + ACPI_STRNCPY (LocalFACS.Signature, ACPI_SIG_FACS, 4); + LocalFACS.Length = sizeof (ACPI_TABLE_FACS); + LocalFACS.GlobalLock = 0x11AA0011; + + /* Build a fake table [TEST] so that we make sure that the CA core ignores it */ + + ACPI_MEMSET (&LocalTEST, 0, sizeof (ACPI_TABLE_HEADER)); + ACPI_STRNCPY (LocalTEST.Signature, "TEST", 4); + + LocalTEST.Revision = 1; + LocalTEST.Length = sizeof (ACPI_TABLE_HEADER); + LocalTEST.Checksum = (UINT8) -AcpiTbChecksum ((void *) &LocalTEST, LocalTEST.Length); + + /* Build a fake table with a bad signature [BAD!] so that we make sure that the CA core ignores it */ + + ACPI_MEMSET (&LocalBADTABLE, 0, sizeof (ACPI_TABLE_HEADER)); + ACPI_STRNCPY (LocalBADTABLE.Signature, "BAD!", 4); + + LocalBADTABLE.Revision = 1; + LocalBADTABLE.Length = sizeof (ACPI_TABLE_HEADER); + LocalBADTABLE.Checksum = (UINT8) -AcpiTbChecksum ((void *) &LocalBADTABLE, LocalBADTABLE.Length); + + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: AeInstallTables + * + * PARAMETERS: None + * + * RETURN: Status + * + * DESCRIPTION: Install the various ACPI tables + * + *****************************************************************************/ + +ACPI_STATUS +AeInstallTables ( + void) +{ + ACPI_STATUS Status; + + Status = AcpiInitializeTables (Tables, ACPI_MAX_INIT_TABLES, TRUE); + Status = AcpiReallocateRootTable (); + Status = AcpiLoadTables (); + + /* + * Test run-time control method installation. Do it twice to test code + * for an existing name. + */ + Status = AcpiInstallMethod (MethodCode); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("%s, Could not install method\n", + AcpiFormatException (Status)); + } + + Status = AcpiInstallMethod (MethodCode); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("%s, Could not install method\n", + AcpiFormatException (Status)); + } + + return (AE_OK); +} + + +/****************************************************************************** + * + * FUNCTION: AeLocalGetRootPointer + * + * PARAMETERS: Flags - not used + * Address - Where the root pointer is returned + * + * RETURN: Status + * + * DESCRIPTION: Return a local RSDP, used to dynamically load tables via the + * standard ACPI mechanism. + * + *****************************************************************************/ + +ACPI_PHYSICAL_ADDRESS +AeLocalGetRootPointer ( + void) +{ + + return ((ACPI_PHYSICAL_ADDRESS) &LocalRSDP); +} + + diff --git a/sys/contrib/dev/acpica/tools/acpiexec/osunixdir.c b/sys/contrib/dev/acpica/tools/acpiexec/osunixdir.c new file mode 100644 index 000000000000..d9c55a1ef84a --- /dev/null +++ b/sys/contrib/dev/acpica/tools/acpiexec/osunixdir.c @@ -0,0 +1,306 @@ + +/****************************************************************************** + * + * Module Name: osunixdir - Unix directory access interfaces + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2009, 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 <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <dirent.h> +#include <fnmatch.h> +#include <ctype.h> +#include <sys/stat.h> + +#include "acpisrc.h" + +typedef struct ExternalFindInfo +{ + char *DirPathname; + DIR *DirPtr; + char temp_buffer[128]; + char *WildcardSpec; + char RequestedFileType; + +} EXTERNAL_FIND_INFO; + + +/******************************************************************************* + * + * FUNCTION: AcpiOsOpenDirectory + * + * PARAMETERS: DirPathname - Full pathname to the directory + * WildcardSpec - string of the form "*.c", etc. + * + * RETURN: A directory "handle" to be used in subsequent search operations. + * NULL returned on failure. + * + * DESCRIPTION: Open a directory in preparation for a wildcard search + * + ******************************************************************************/ + +void * +AcpiOsOpenDirectory ( + char *DirPathname, + char *WildcardSpec, + char RequestedFileType) +{ + EXTERNAL_FIND_INFO *ExternalInfo; + DIR *dir; + + + /* Allocate the info struct that will be returned to the caller */ + + ExternalInfo = calloc (sizeof (EXTERNAL_FIND_INFO), 1); + if (!ExternalInfo) + { + return (NULL); + } + + /* Get the directory stream */ + + dir = opendir (DirPathname); + if (!dir) + { + free (ExternalInfo); + return (NULL); + } + + /* Save the info in the return structure */ + + ExternalInfo->WildcardSpec = WildcardSpec; + ExternalInfo->RequestedFileType = RequestedFileType; + ExternalInfo->DirPathname = DirPathname; + ExternalInfo->DirPtr = dir; + return (ExternalInfo); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiOsGetNextFilename + * + * PARAMETERS: DirHandle - Created via AcpiOsOpenDirectory + * + * RETURN: Next filename matched. NULL if no more matches. + * + * DESCRIPTION: Get the next file in the directory that matches the wildcard + * specification. + * + ******************************************************************************/ + +char * +AcpiOsGetNextFilename ( + void *DirHandle) +{ + EXTERNAL_FIND_INFO *ExternalInfo = DirHandle; + struct dirent *dir_entry; + char *temp_str; + int str_len; + struct stat temp_stat; + int err; + + + while ((dir_entry = readdir (ExternalInfo->DirPtr))) + { + if (!fnmatch (ExternalInfo->WildcardSpec, dir_entry->d_name, 0)) + { + if (dir_entry->d_name[0] == '.') + continue; + + str_len = strlen (dir_entry->d_name) + + strlen (ExternalInfo->DirPathname) + 2; + + temp_str = calloc (str_len, 1); + if (!temp_str) + { + printf ("Could not allocate buffer for temporary string\n"); + return NULL; + } + + strcpy (temp_str, ExternalInfo->DirPathname); + strcat (temp_str, "/"); + strcat (temp_str, dir_entry->d_name); + + err = stat (temp_str, &temp_stat); + free (temp_str); + if (err == -1) + { + printf ("stat() error - should not happen\n"); + return NULL; + } + + if ((S_ISDIR (temp_stat.st_mode) + && (ExternalInfo->RequestedFileType == REQUEST_DIR_ONLY)) + || + ((!S_ISDIR (temp_stat.st_mode) + && ExternalInfo->RequestedFileType == REQUEST_FILE_ONLY))) + { + /* copy to a temp buffer because dir_entry struct is on the stack */ + + strcpy (ExternalInfo->temp_buffer, dir_entry->d_name); + return (ExternalInfo->temp_buffer); + } + } + } + + return NULL; +} + + +/******************************************************************************* + * + * FUNCTION: AcpiOsCloseDirectory + * + * PARAMETERS: DirHandle - Created via AcpiOsOpenDirectory + * + * RETURN: None. + * + * DESCRIPTION: Close the open directory and cleanup. + * + ******************************************************************************/ + +void +AcpiOsCloseDirectory ( + void *DirHandle) +{ + EXTERNAL_FIND_INFO *ExternalInfo = DirHandle; + + + /* Close the directory and free allocations */ + + closedir (ExternalInfo->DirPtr); + free (DirHandle); +} + +/* Other functions acpisrc uses but that aren't standard on Unix */ + +/* lowercase a string */ +char* +strlwr ( + char *str) +{ + int length; + int i; + + + length = strlen(str); + + for (i = 0; i < length; i++) + { + str[i] = tolower(str[i]); + } + + return (str); +} diff --git a/sys/contrib/dev/acpica/tools/acpisrc/Makefile b/sys/contrib/dev/acpica/tools/acpisrc/Makefile new file mode 100644 index 000000000000..96816ce129c7 --- /dev/null +++ b/sys/contrib/dev/acpica/tools/acpisrc/Makefile @@ -0,0 +1,17 @@ + + +PROG= acpisrc +SRCS= ascase.c asconvrt.c asfile.c asmain.c asremove.c astable.c \ + asutils.c osunixdir.c ../../common/getopt.c + +CFLAGS+= -Wall -O2 -D_LINUX -DACPI_APPLICATION -Wstrict-prototypes -I../../include + + +aslmain : $(patsubst %.c,%.o, $(SRCS)) + $(CC) $(LDFLAGS) $(patsubst %.c,%.o, $(SRCS)) -o $(PROG) + +CLEANFILES= $(PROG) + +clean : + rm -f $(CLEANFILES) $(patsubst %.c,%.o, $(SRCS)) + diff --git a/sys/contrib/dev/acpica/tools/acpisrc/acpisrc.h b/sys/contrib/dev/acpica/tools/acpisrc/acpisrc.h new file mode 100644 index 000000000000..651a0553f6f0 --- /dev/null +++ b/sys/contrib/dev/acpica/tools/acpisrc/acpisrc.h @@ -0,0 +1,475 @@ + +/****************************************************************************** + * + * Module Name: acpisrc.h - Include file for AcpiSrc utility + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2009, 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 LINES_IN_LEGAL_HEADER 105 /* See above */ +#define LEGAL_HEADER_SIGNATURE " * 2.1. This is your license from Intel Corp. under its intellectual property" +#define LINES_IN_LINUX_HEADER 34 +#define LINUX_HEADER_SIGNATURE " * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS" +#define LINES_IN_ASL_HEADER 29 /* Header as output from disassembler */ + +#include <stdio.h> +#include <sys/stat.h> +#include <sys/types.h> +#include <fcntl.h> +#include <ctype.h> +#ifdef WIN32 +#include <io.h> +#include <direct.h> +#endif +#include <errno.h> + +#include "acpi.h" +#include "accommon.h" + + +/* Fixups for non-Win32 compilation */ +#ifndef WIN32 +#ifndef O_BINARY +#define O_BINARY 0x0 +#endif + +#define mkdir(x) mkdir(x, 0770) +char * strlwr(char* str); +#endif + + +/* Constants */ + +#define ASRC_MAX_FILE_SIZE (1024 * 100) + +#define FILE_TYPE_SOURCE 1 +#define FILE_TYPE_HEADER 2 +#define FILE_TYPE_DIRECTORY 3 + +#define CVT_COUNT_TABS 0x00000001 +#define CVT_COUNT_NON_ANSI_COMMENTS 0x00000002 +#define CVT_TRIM_LINES 0x00000004 +#define CVT_CHECK_BRACES 0x00000008 +#define CVT_COUNT_LINES 0x00000010 +#define CVT_BRACES_ON_SAME_LINE 0x00000020 +#define CVT_MIXED_CASE_TO_UNDERSCORES 0x00000040 +#define CVT_LOWER_CASE_IDENTIFIERS 0x00000080 +#define CVT_REMOVE_DEBUG_MACROS 0x00000100 +#define CVT_TRIM_WHITESPACE 0x00000200 /* Should be after all line removal */ +#define CVT_REMOVE_EMPTY_BLOCKS 0x00000400 /* Should be after trimming lines */ +#define CVT_REDUCE_TYPEDEFS 0x00000800 +#define CVT_COUNT_SHORTMULTILINE_COMMENTS 0x00001000 +#define CVT_SPACES_TO_TABS4 0x40000000 /* Tab conversion should be last */ +#define CVT_SPACES_TO_TABS8 0x80000000 /* Tab conversion should be last */ + +#define FLG_DEFAULT_FLAGS 0x00000000 +#define FLG_NO_CARRIAGE_RETURNS 0x00000001 +#define FLG_NO_FILE_OUTPUT 0x00000002 +#define FLG_LOWERCASE_DIRNAMES 0x00000004 + +#define AS_START_IGNORE "/*!" +#define AS_STOP_IGNORE "!*/" + + +/* Globals */ + +extern UINT32 Gbl_Files; +extern UINT32 Gbl_MissingBraces; +extern UINT32 Gbl_Tabs; +extern UINT32 Gbl_NonAnsiComments; +extern UINT32 Gbl_SourceLines; +extern UINT32 Gbl_WhiteLines; +extern UINT32 Gbl_CommentLines; +extern UINT32 Gbl_LongLines; +extern UINT32 Gbl_TotalLines; +extern UINT32 Gbl_HeaderSize; +extern UINT32 Gbl_HeaderLines; +extern struct stat Gbl_StatBuf; +extern char *Gbl_FileBuffer; +extern UINT32 Gbl_TotalSize; +extern UINT32 Gbl_FileSize; +extern UINT32 Gbl_FileType; +extern BOOLEAN Gbl_VerboseMode; +extern BOOLEAN Gbl_QuietMode; +extern BOOLEAN Gbl_BatchMode; +extern BOOLEAN Gbl_MadeChanges; +extern BOOLEAN Gbl_Overwrite; +extern BOOLEAN Gbl_WidenDeclarations; +extern BOOLEAN Gbl_IgnoreLoneLineFeeds; +extern BOOLEAN Gbl_HasLoneLineFeeds; +extern void *Gbl_StructDefs; + +#define PARAM_LIST(pl) pl +#define TERSE_PRINT(a) if (!Gbl_VerboseMode) printf PARAM_LIST(a) +#define VERBOSE_PRINT(a) if (Gbl_VerboseMode) printf PARAM_LIST(a) + +#define REPLACE_WHOLE_WORD 0x00 +#define REPLACE_SUBSTRINGS 0x01 +#define REPLACE_MASK 0x01 + +#define EXTRA_INDENT_C 0x02 + + +/* Conversion table structs */ + +typedef struct acpi_string_table +{ + char *Target; + char *Replacement; + UINT8 Type; + +} ACPI_STRING_TABLE; + + +typedef struct acpi_typed_identifier_table +{ + char *Identifier; + UINT8 Type; + +} ACPI_TYPED_IDENTIFIER_TABLE; + +#define SRC_TYPE_SIMPLE 0 +#define SRC_TYPE_STRUCT 1 +#define SRC_TYPE_UNION 2 + + +typedef struct acpi_identifier_table +{ + char *Identifier; + +} ACPI_IDENTIFIER_TABLE; + +typedef struct acpi_conversion_table +{ + char *NewHeader; + UINT32 Flags; + + ACPI_TYPED_IDENTIFIER_TABLE *LowerCaseTable; + + ACPI_STRING_TABLE *SourceStringTable; + ACPI_IDENTIFIER_TABLE *SourceLineTable; + ACPI_IDENTIFIER_TABLE *SourceConditionalTable; + ACPI_IDENTIFIER_TABLE *SourceMacroTable; + ACPI_TYPED_IDENTIFIER_TABLE *SourceStructTable; + UINT32 SourceFunctions; + + ACPI_STRING_TABLE *HeaderStringTable; + ACPI_IDENTIFIER_TABLE *HeaderLineTable; + ACPI_IDENTIFIER_TABLE *HeaderConditionalTable; + ACPI_IDENTIFIER_TABLE *HeaderMacroTable; + ACPI_TYPED_IDENTIFIER_TABLE *HeaderStructTable; + UINT32 HeaderFunctions; + +} ACPI_CONVERSION_TABLE; + + +/* Conversion tables */ + +extern ACPI_CONVERSION_TABLE LinuxConversionTable; +extern ACPI_CONVERSION_TABLE CleanupConversionTable; +extern ACPI_CONVERSION_TABLE StatsConversionTable; +extern ACPI_CONVERSION_TABLE CustomConversionTable; + + +/* Prototypes */ + +char * +AsSkipUntilChar ( + char *Buffer, + char Target); + +char * +AsSkipPastChar ( + char *Buffer, + char Target); + +char * +AsReplaceData ( + char *Buffer, + UINT32 LengthToRemove, + char *BufferToAdd, + UINT32 LengthToAdd); + +int +AsReplaceString ( + char *Target, + char *Replacement, + UINT8 Type, + char *Buffer); + +int +AsLowerCaseString ( + char *Target, + char *Buffer); + +void +AsRemoveLine ( + char *Buffer, + char *Keyword); + +void +AsRemoveMacro ( + char *Buffer, + char *Keyword); + +void +AsCheckForBraces ( + char *Buffer, + char *Filename); + +void +AsTrimLines ( + char *Buffer, + char *Filename); + +void +AsMixedCaseToUnderscores ( + char *Buffer); + +void +AsCountTabs ( + char *Buffer, + char *Filename); + +void +AsBracesOnSameLine ( + char *Buffer); + +void +AsLowerCaseIdentifiers ( + char *Buffer); + +void +AsReduceTypedefs ( + char *Buffer, + char *Keyword); + +void +AsRemoveDebugMacros ( + char *Buffer); + +void +AsRemoveEmptyBlocks ( + char *Buffer, + char *Filename); + +void +AsCountSourceLines ( + char *Buffer, + char *Filename); + +void +AsCountNonAnsiComments ( + char *Buffer, + char *Filename); + +void +AsTrimWhitespace ( + char *Buffer); + +void +AsTabify4 ( + char *Buffer); + +void +AsTabify8 ( + char *Buffer); + +void +AsRemoveConditionalCompile ( + char *Buffer, + char *Keyword); + +ACPI_NATIVE_INT +AsProcessTree ( + ACPI_CONVERSION_TABLE *ConversionTable, + char *SourcePath, + char *TargetPath); + +int +AsGetFile ( + char *FileName, + char **FileBuffer, + UINT32 *FileSize); + +int +AsPutFile ( + char *Pathname, + char *FileBuffer, + UINT32 SystemFlags); + +void +AsReplaceHeader ( + char *Buffer, + char *NewHeader); + +void +AsConvertFile ( + ACPI_CONVERSION_TABLE *ConversionTable, + char *FileBuffer, + char *Filename, + ACPI_NATIVE_INT FileType); + +ACPI_NATIVE_INT +AsProcessOneFile ( + ACPI_CONVERSION_TABLE *ConversionTable, + char *SourcePath, + char *TargetPath, + int MaxPathLength, + char *Filename, + ACPI_NATIVE_INT FileType); + +ACPI_NATIVE_INT +AsCheckForDirectory ( + char *SourceDirPath, + char *TargetDirPath, + char *Filename, + char **SourcePath, + char **TargetPath); + +BOOLEAN +AsMatchExactWord ( + char *Word, + UINT32 WordLength); + +void +AsPrint ( + char *Message, + UINT32 Count, + char *Filename); + +void +AsInsertPrefix ( + char *Buffer, + char *Keyword, + UINT8 Type); + +char * +AsInsertData ( + char *Buffer, + char *BufferToAdd, + UINT32 LengthToAdd); + +char * +AsRemoveData ( + char *StartPointer, + char *EndPointer); + +void +AsInsertCarriageReturns ( + char *Buffer); + +void +AsConvertToLineFeeds ( + char *Buffer); + + diff --git a/sys/contrib/dev/acpica/tools/acpisrc/ascase.c b/sys/contrib/dev/acpica/tools/acpisrc/ascase.c new file mode 100644 index 000000000000..da1112d562de --- /dev/null +++ b/sys/contrib/dev/acpica/tools/acpisrc/ascase.c @@ -0,0 +1,646 @@ + +/****************************************************************************** + * + * Module Name: ascase - Source conversion - lower/upper case utilities + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2009, 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 "acpisrc.h" + +/* Local prototypes */ + +void +AsUppercaseTokens ( + char *Buffer, + char *PrefixString); + + +/****************************************************************************** + * + * FUNCTION: AsLowerCaseString + * + * DESCRIPTION: LowerCase all instances of a target string with a replacement + * string. Returns count of the strings replaced. + * + ******************************************************************************/ + +int +AsLowerCaseString ( + char *Target, + char *Buffer) +{ + char *SubString1; + char *SubString2; + char *SubBuffer; + int TargetLength; + int LowerCaseCount = 0; + int i; + + + TargetLength = strlen (Target); + + SubBuffer = Buffer; + SubString1 = Buffer; + + while (SubString1) + { + /* Find the target string */ + + SubString1 = strstr (SubBuffer, Target); + if (!SubString1) + { + return LowerCaseCount; + } + + /* + * Check for translation escape string -- means to ignore + * blocks of code while replacing + */ + SubString2 = strstr (SubBuffer, AS_START_IGNORE); + + if ((SubString2) && + (SubString2 < SubString1)) + { + /* Find end of the escape block starting at "Substring2" */ + + SubString2 = strstr (SubString2, AS_STOP_IGNORE); + if (!SubString2) + { + /* Didn't find terminator */ + + return LowerCaseCount; + } + + /* Move buffer to end of escape block and continue */ + + SubBuffer = SubString2; + } + + /* Do the actual replace if the target was found */ + + else + { + if (!AsMatchExactWord (SubString1, TargetLength)) + { + SubBuffer = SubString1 + 1; + continue; + } + + for (i = 0; i < TargetLength; i++) + { + SubString1[i] = (char) tolower (SubString1[i]); + } + + SubBuffer = SubString1 + TargetLength; + + if ((Gbl_WidenDeclarations) && (!Gbl_StructDefs)) + { + if ((SubBuffer[0] == ' ') && (SubBuffer[1] == ' ')) + { + AsInsertData (SubBuffer, " ", 8); + } + } + + LowerCaseCount++; + } + } + + return LowerCaseCount; +} + + +/****************************************************************************** + * + * FUNCTION: AsMixedCaseToUnderscores + * + * DESCRIPTION: Converts mixed case identifiers to underscored identifiers. + * for example, + * + * ThisUsefullyNamedIdentifier becomes: + * + * this_usefully_named_identifier + * + ******************************************************************************/ + +void +AsMixedCaseToUnderscores ( + char *Buffer) +{ + UINT32 Length; + char *SubBuffer = Buffer; + char *TokenEnd; + char *TokenStart = NULL; + char *SubString; + BOOLEAN HasLowerCase = FALSE; + + + while (*SubBuffer) + { + /* Ignore whitespace */ + + if (*SubBuffer == ' ') + { + while (*SubBuffer == ' ') + { + SubBuffer++; + } + TokenStart = NULL; + HasLowerCase = FALSE; + continue; + } + + /* Ignore commas */ + + if ((*SubBuffer == ',') || + (*SubBuffer == '>') || + (*SubBuffer == ')')) + { + SubBuffer++; + TokenStart = NULL; + HasLowerCase = FALSE; + continue; + } + + /* Check for quoted string -- ignore */ + + if (*SubBuffer == '"') + { + SubBuffer++; + while (*SubBuffer != '"') + { + if (!*SubBuffer) + { + return; + } + + /* Handle embedded escape sequences */ + + if (*SubBuffer == '\\') + { + SubBuffer++; + } + SubBuffer++; + } + SubBuffer++; + continue; + } + + if (islower (*SubBuffer)) + { + HasLowerCase = TRUE; + } + + /* + * Check for translation escape string -- means to ignore + * blocks of code while replacing + */ + if ((SubBuffer[0] == '/') && + (SubBuffer[1] == '*') && + (SubBuffer[2] == '!')) + { + SubBuffer = strstr (SubBuffer, "!*/"); + if (!SubBuffer) + { + return; + } + continue; + } + + /* Ignore hex constants */ + + if (SubBuffer[0] == '0') + { + if ((SubBuffer[1] == 'x') || + (SubBuffer[1] == 'X')) + { + SubBuffer += 2; + while (isxdigit (*SubBuffer)) + { + SubBuffer++; + } + continue; + } + } + +/* OBSOLETE CODE, all quoted strings now completely ignored. */ +#if 0 + /* Ignore format specification fields */ + + if (SubBuffer[0] == '%') + { + SubBuffer++; + + while ((isalnum (*SubBuffer)) || (*SubBuffer == '.')) + { + SubBuffer++; + } + + continue; + } +#endif + + /* Ignore standard escape sequences (\n, \r, etc.) Not Hex or Octal escapes */ + + if (SubBuffer[0] == '\\') + { + SubBuffer += 2; + continue; + } + + /* + * Ignore identifiers that already contain embedded underscores + * These are typically C macros or defines (all upper case) + * Note: there are some cases where identifiers have underscores + * AcpiGbl_* for example. HasLowerCase flag handles these. + */ + if ((*SubBuffer == '_') && (!HasLowerCase) && (TokenStart)) + { + /* Check the rest of the identifier for any lower case letters */ + + SubString = SubBuffer; + while ((isalnum (*SubString)) || (*SubString == '_')) + { + if (islower (*SubString)) + { + HasLowerCase = TRUE; + } + SubString++; + } + + /* If no lower case letters, we can safely ignore the entire token */ + + if (!HasLowerCase) + { + SubBuffer = SubString; + continue; + } + } + + /* A capital letter may indicate the start of a token; save it */ + + if (isupper (SubBuffer[0])) + { + TokenStart = SubBuffer; + } + + /* + * Convert each pair of letters that matches the form: + * + * <LowerCase><UpperCase> + * to + * <LowerCase><Underscore><LowerCase> + */ + else if ((islower (SubBuffer[0]) || isdigit (SubBuffer[0])) && + (isupper (SubBuffer[1]))) + { + if (isdigit (SubBuffer[0])) + { + /* Ignore <UpperCase><Digit><UpperCase> */ + /* Ignore <Underscore><Digit><UpperCase> */ + + if (isupper (*(SubBuffer-1)) || + *(SubBuffer-1) == '_') + { + SubBuffer++; + continue; + } + } + + /* + * Matched the pattern. + * Find the end of this identifier (token) + */ + TokenEnd = SubBuffer; + while ((isalnum (*TokenEnd)) || (*TokenEnd == '_')) + { + TokenEnd++; + } + + /* Force the UpperCase letter (#2) to lower case */ + + Gbl_MadeChanges = TRUE; + SubBuffer[1] = (char) tolower (SubBuffer[1]); + + SubString = TokenEnd; + Length = 0; + + while (*SubString != '\n') + { + /* + * If we have at least two trailing spaces, we can get rid of + * one to make up for the newly inserted underscore. This will + * help preserve the alignment of the text + */ + if ((SubString[0] == ' ') && + (SubString[1] == ' ')) + { + Length = SubString - SubBuffer - 2; + break; + } + + SubString++; + } + + if (!Length) + { + Length = strlen (&SubBuffer[1]); + } + + memmove (&SubBuffer[2], &SubBuffer[1], Length + 1); + SubBuffer[1] = '_'; + SubBuffer +=2; + + /* Lower case the leading character of the token */ + + if (TokenStart) + { + *TokenStart = (char) tolower (*TokenStart); + TokenStart = NULL; + } + } + + SubBuffer++; + } +} + + +/****************************************************************************** + * + * FUNCTION: AsLowerCaseIdentifiers + * + * DESCRIPTION: Converts mixed case identifiers to lower case. Leaves comments, + * quoted strings, and all-upper-case macros alone. + * + ******************************************************************************/ + +void +AsLowerCaseIdentifiers ( + char *Buffer) +{ + char *SubBuffer = Buffer; + + + while (*SubBuffer) + { + /* + * Check for translation escape string -- means to ignore + * blocks of code while replacing + */ + if ((SubBuffer[0] == '/') && + (SubBuffer[1] == '*') && + (SubBuffer[2] == '!')) + { + SubBuffer = strstr (SubBuffer, "!*/"); + if (!SubBuffer) + { + return; + } + } + + /* Ignore comments */ + + if ((SubBuffer[0] == '/') && + (SubBuffer[1] == '*')) + { + SubBuffer = strstr (SubBuffer, "*/"); + if (!SubBuffer) + { + return; + } + + SubBuffer += 2; + } + + /* Ignore quoted strings */ + + if ((SubBuffer[0] == '\"') && (SubBuffer[1] != '\'')) + { + SubBuffer++; + + /* Find the closing quote */ + + while (SubBuffer[0]) + { + /* Ignore escaped quote characters */ + + if (SubBuffer[0] == '\\') + { + SubBuffer++; + } + else if (SubBuffer[0] == '\"') + { + SubBuffer++; + break; + } + SubBuffer++; + } + } + + if (!SubBuffer[0]) + { + return; + } + + /* + * Only lower case if we have an upper followed by a lower + * This leaves the all-uppercase things (macros, etc.) intact + */ + if ((isupper (SubBuffer[0])) && + (islower (SubBuffer[1]))) + { + Gbl_MadeChanges = TRUE; + *SubBuffer = (char) tolower (*SubBuffer); + } + + SubBuffer++; + } +} + + +/****************************************************************************** + * + * FUNCTION: AsUppercaseTokens + * + * DESCRIPTION: Force to uppercase all tokens that begin with the prefix string. + * used to convert mixed-case macros and constants to uppercase. + * + ******************************************************************************/ + +void +AsUppercaseTokens ( + char *Buffer, + char *PrefixString) +{ + char *SubBuffer; + char *TokenEnd; + char *SubString; + int i; + UINT32 Length; + + + SubBuffer = Buffer; + + while (SubBuffer) + { + SubBuffer = strstr (SubBuffer, PrefixString); + if (SubBuffer) + { + TokenEnd = SubBuffer; + while ((isalnum (*TokenEnd)) || (*TokenEnd == '_')) + { + TokenEnd++; + } + + for (i = 0; i < (TokenEnd - SubBuffer); i++) + { + if ((islower (SubBuffer[i])) && + (isupper (SubBuffer[i+1]))) + { + + SubString = TokenEnd; + Length = 0; + + while (*SubString != '\n') + { + if ((SubString[0] == ' ') && + (SubString[1] == ' ')) + { + Length = SubString - &SubBuffer[i] - 2; + break; + } + + SubString++; + } + + if (!Length) + { + Length = strlen (&SubBuffer[i+1]); + } + + memmove (&SubBuffer[i+2], &SubBuffer[i+1], (Length+1)); + SubBuffer[i+1] = '_'; + i +=2; + TokenEnd++; + } + } + + for (i = 0; i < (TokenEnd - SubBuffer); i++) + { + SubBuffer[i] = (char) toupper (SubBuffer[i]); + } + + SubBuffer = TokenEnd; + } + } +} + + diff --git a/sys/contrib/dev/acpica/tools/acpisrc/asconvrt.c b/sys/contrib/dev/acpica/tools/acpisrc/asconvrt.c new file mode 100644 index 000000000000..b1c2ca4fe1db --- /dev/null +++ b/sys/contrib/dev/acpica/tools/acpisrc/asconvrt.c @@ -0,0 +1,1523 @@ + +/****************************************************************************** + * + * Module Name: asconvrt - Source conversion code + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2009, 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 "acpisrc.h" + +/* Local prototypes */ + +char * +AsCheckAndSkipLiterals ( + char *Buffer, + UINT32 *TotalLines); + +UINT32 +AsCountLines ( + char *Buffer, + char *Filename); + +/* Opening signature of the Intel legal header */ + +char *HeaderBegin = "/******************************************************************************\n *\n * 1. Copyright Notice"; + + +/****************************************************************************** + * + * FUNCTION: AsMatchExactWord + * + * DESCRIPTION: Check previous and next characters for whitespace + * + ******************************************************************************/ + +BOOLEAN +AsMatchExactWord ( + char *Word, + UINT32 WordLength) +{ + char NextChar; + char PrevChar; + + + NextChar = Word[WordLength]; + PrevChar = * (Word -1); + + if (isalnum (NextChar) || + (NextChar == '_') || + isalnum (PrevChar) || + (PrevChar == '_')) + { + return (FALSE); + } + + return (TRUE); +} + + +/****************************************************************************** + * + * FUNCTION: AsPrint + * + * DESCRIPTION: Common formatted print + * + ******************************************************************************/ + +void +AsPrint ( + char *Message, + UINT32 Count, + char *Filename) +{ + + if (Gbl_QuietMode) + { + return; + } + + printf ("-- %4u %28.28s : %s\n", Count, Message, Filename); +} + + +/****************************************************************************** + * + * FUNCTION: AsCheckAndSkipLiterals + * + * DESCRIPTION: Generic routine to skip comments and quoted string literals. + * Keeps a line count. + * + ******************************************************************************/ + +char * +AsCheckAndSkipLiterals ( + char *Buffer, + UINT32 *TotalLines) +{ + UINT32 NewLines = 0; + char *SubBuffer = Buffer; + char *LiteralEnd; + + + /* Ignore comments */ + + if ((SubBuffer[0] == '/') && + (SubBuffer[1] == '*')) + { + LiteralEnd = strstr (SubBuffer, "*/"); + SubBuffer += 2; /* Get past comment opening */ + + if (!LiteralEnd) + { + return SubBuffer; + } + + while (SubBuffer < LiteralEnd) + { + if (*SubBuffer == '\n') + { + NewLines++; + } + + SubBuffer++; + } + + SubBuffer += 2; /* Get past comment close */ + } + + /* Ignore quoted strings */ + + else if (*SubBuffer == '\"') + { + SubBuffer++; + LiteralEnd = AsSkipPastChar (SubBuffer, '\"'); + if (!LiteralEnd) + { + return SubBuffer; + } + } + + if (TotalLines) + { + (*TotalLines) += NewLines; + } + return SubBuffer; +} + + +/****************************************************************************** + * + * FUNCTION: AsAsCheckForBraces + * + * DESCRIPTION: Check for an open brace after each if statement + * + ******************************************************************************/ + +void +AsCheckForBraces ( + char *Buffer, + char *Filename) +{ + char *SubBuffer = Buffer; + char *NextBrace; + char *NextSemicolon; + char *NextIf; + UINT32 TotalLines = 1; + + + while (*SubBuffer) + { + + SubBuffer = AsCheckAndSkipLiterals (SubBuffer, &TotalLines); + + if (*SubBuffer == '\n') + { + TotalLines++; + } + else if (!(strncmp (" if", SubBuffer, 3))) + { + SubBuffer += 2; + NextBrace = strstr (SubBuffer, "{"); + NextSemicolon = strstr (SubBuffer, ";"); + NextIf = strstr (SubBuffer, " if"); + + if ((!NextBrace) || + (NextSemicolon && (NextBrace > NextSemicolon)) || + (NextIf && (NextBrace > NextIf))) + { + Gbl_MissingBraces++; + + if (!Gbl_QuietMode) + { + printf ("Missing braces for <if>, line %d: %s\n", TotalLines, Filename); + } + } + } + else if (!(strncmp (" else if", SubBuffer, 8))) + { + SubBuffer += 7; + NextBrace = strstr (SubBuffer, "{"); + NextSemicolon = strstr (SubBuffer, ";"); + NextIf = strstr (SubBuffer, " if"); + + if ((!NextBrace) || + (NextSemicolon && (NextBrace > NextSemicolon)) || + (NextIf && (NextBrace > NextIf))) + { + Gbl_MissingBraces++; + + if (!Gbl_QuietMode) + { + printf ("Missing braces for <if>, line %d: %s\n", TotalLines, Filename); + } + } + } + else if (!(strncmp (" else", SubBuffer, 5))) + { + SubBuffer += 4; + NextBrace = strstr (SubBuffer, "{"); + NextSemicolon = strstr (SubBuffer, ";"); + NextIf = strstr (SubBuffer, " if"); + + if ((!NextBrace) || + (NextSemicolon && (NextBrace > NextSemicolon)) || + (NextIf && (NextBrace > NextIf))) + { + Gbl_MissingBraces++; + + if (!Gbl_QuietMode) + { + printf ("Missing braces for <else>, line %d: %s\n", TotalLines, Filename); + } + } + } + + SubBuffer++; + } +} + + +/****************************************************************************** + * + * FUNCTION: AsTrimLines + * + * DESCRIPTION: Remove extra blanks from the end of source lines. Does not + * check for tabs. + * + ******************************************************************************/ + +void +AsTrimLines ( + char *Buffer, + char *Filename) +{ + char *SubBuffer = Buffer; + char *StartWhiteSpace = NULL; + UINT32 SpaceCount = 0; + + + while (*SubBuffer) + { + while (*SubBuffer != '\n') + { + if (!*SubBuffer) + { + goto Exit; + } + + if (*SubBuffer == ' ') + { + if (!StartWhiteSpace) + { + StartWhiteSpace = SubBuffer; + } + } + else + { + StartWhiteSpace = NULL; + } + + SubBuffer++; + } + + if (StartWhiteSpace) + { + SpaceCount += (SubBuffer - StartWhiteSpace); + + /* Remove the spaces */ + + SubBuffer = AsRemoveData (StartWhiteSpace, SubBuffer); + StartWhiteSpace = NULL; + } + + SubBuffer++; + } + + +Exit: + if (SpaceCount) + { + Gbl_MadeChanges = TRUE; + AsPrint ("Extraneous spaces removed", SpaceCount, Filename); + } +} + + +/****************************************************************************** + * + * FUNCTION: AsTrimWhitespace + * + * DESCRIPTION: Remove "excess" blank lines - any more than 2 blank lines. + * this can happen during the translation when lines are removed. + * + ******************************************************************************/ + +void +AsTrimWhitespace ( + char *Buffer) +{ + int ReplaceCount = 1; + + + while (ReplaceCount) + { + ReplaceCount = AsReplaceString ("\n\n\n\n", "\n\n\n", REPLACE_SUBSTRINGS, Buffer); + } +} + + +/****************************************************************************** + * + * FUNCTION: AsReplaceHeader + * + * DESCRIPTION: Replace the default Intel legal header with a new header + * + ******************************************************************************/ + +void +AsReplaceHeader ( + char *Buffer, + char *NewHeader) +{ + char *SubBuffer; + char *TokenEnd; + + + /* Find the original header */ + + SubBuffer = strstr (Buffer, HeaderBegin); + if (!SubBuffer) + { + return; + } + + /* Find the end of the original header */ + + TokenEnd = strstr (SubBuffer, "*/"); + TokenEnd = AsSkipPastChar (TokenEnd, '\n'); + + /* Delete old header, insert new one */ + + AsReplaceData (SubBuffer, TokenEnd - SubBuffer, NewHeader, strlen (NewHeader)); +} + + +/****************************************************************************** + * + * FUNCTION: AsReplaceString + * + * DESCRIPTION: Replace all instances of a target string with a replacement + * string. Returns count of the strings replaced. + * + ******************************************************************************/ + +int +AsReplaceString ( + char *Target, + char *Replacement, + UINT8 Type, + char *Buffer) +{ + char *SubString1; + char *SubString2; + char *SubBuffer; + int TargetLength; + int ReplacementLength; + int ReplaceCount = 0; + + + TargetLength = strlen (Target); + ReplacementLength = strlen (Replacement); + + SubBuffer = Buffer; + SubString1 = Buffer; + + while (SubString1) + { + /* Find the target string */ + + SubString1 = strstr (SubBuffer, Target); + if (!SubString1) + { + return ReplaceCount; + } + + /* + * Check for translation escape string -- means to ignore + * blocks of code while replacing + */ + SubString2 = strstr (SubBuffer, AS_START_IGNORE); + + if ((SubString2) && + (SubString2 < SubString1)) + { + /* Find end of the escape block starting at "Substring2" */ + + SubString2 = strstr (SubString2, AS_STOP_IGNORE); + if (!SubString2) + { + /* Didn't find terminator */ + + return ReplaceCount; + } + + /* Move buffer to end of escape block and continue */ + + SubBuffer = SubString2; + } + + /* Do the actual replace if the target was found */ + + else + { + if ((Type & REPLACE_MASK) == REPLACE_WHOLE_WORD) + { + if (!AsMatchExactWord (SubString1, TargetLength)) + { + SubBuffer = SubString1 + 1; + continue; + } + } + + SubBuffer = AsReplaceData (SubString1, TargetLength, Replacement, ReplacementLength); + + if ((Type & EXTRA_INDENT_C) && + (!Gbl_StructDefs)) + { + SubBuffer = AsInsertData (SubBuffer, " ", 8); + } + + ReplaceCount++; + } + } + + return ReplaceCount; +} + + +/****************************************************************************** + * + * FUNCTION: AsConvertToLineFeeds + * + * DESCRIPTION: + * + ******************************************************************************/ + +void +AsConvertToLineFeeds ( + char *Buffer) +{ + char *SubString; + char *SubBuffer; + + + SubBuffer = Buffer; + SubString = Buffer; + + while (SubString) + { + /* Find the target string */ + + SubString = strstr (SubBuffer, "\r\n"); + if (!SubString) + { + return; + } + + SubBuffer = AsReplaceData (SubString, 1, NULL, 0); + } + return; +} + + +/****************************************************************************** + * + * FUNCTION: AsInsertCarriageReturns + * + * DESCRIPTION: + * + ******************************************************************************/ + +void +AsInsertCarriageReturns ( + char *Buffer) +{ + char *SubString; + char *SubBuffer; + + + SubBuffer = Buffer; + SubString = Buffer; + + while (SubString) + { + /* Find the target string */ + + SubString = strstr (SubBuffer, "\n"); + if (!SubString) + { + return; + } + + SubBuffer = AsInsertData (SubString, "\r", 1); + SubBuffer += 1; + } + return; +} + + +/****************************************************************************** + * + * FUNCTION: AsBracesOnSameLine + * + * DESCRIPTION: Move opening braces up to the same line as an if, for, else, + * or while statement (leave function opening brace on separate + * line). + * + ******************************************************************************/ + +void +AsBracesOnSameLine ( + char *Buffer) +{ + UINT32 Length; + char *SubBuffer = Buffer; + char *Beginning; + char *StartOfThisLine; + char *Next; + BOOLEAN BlockBegin = TRUE; + + + while (*SubBuffer) + { + /* Ignore comments */ + + if ((SubBuffer[0] == '/') && + (SubBuffer[1] == '*')) + { + SubBuffer = strstr (SubBuffer, "*/"); + if (!SubBuffer) + { + return; + } + + SubBuffer += 2; + continue; + } + + /* Ignore quoted strings */ + + if (*SubBuffer == '\"') + { + SubBuffer++; + SubBuffer = AsSkipPastChar (SubBuffer, '\"'); + if (!SubBuffer) + { + return; + } + } + + if (!strncmp ("\n}", SubBuffer, 2)) + { + /* + * A newline followed by a closing brace closes a function + * or struct or initializer block + */ + BlockBegin = TRUE; + } + + /* + * Move every standalone brace up to the previous line + * Check for digit will ignore initializer lists surrounded by braces. + * This will work until we we need more complex detection. + */ + if ((*SubBuffer == '{') && !isdigit (SubBuffer[1])) + { + if (BlockBegin) + { + BlockBegin = FALSE; + } + else + { + /* + * Backup to previous non-whitespace + */ + Beginning = SubBuffer - 1; + while ((*Beginning == ' ') || + (*Beginning == '\n')) + { + Beginning--; + } + + StartOfThisLine = Beginning; + while (*StartOfThisLine != '\n') + { + StartOfThisLine--; + } + + /* + * Move the brace up to the previous line, UNLESS: + * + * 1) There is a conditional compile on the line (starts with '#') + * 2) Previous line ends with an '=' (Start of initializer block) + * 3) Previous line ends with a comma (part of an init list) + */ + if ((StartOfThisLine[1] != '#') && + (*Beginning != '/') && + (*Beginning != '{') && + (*Beginning != '=') && + (*Beginning != ',')) + { + Beginning++; + SubBuffer++; + Length = strlen (SubBuffer); + + Gbl_MadeChanges = TRUE; + +#ifdef ADD_EXTRA_WHITESPACE + AsReplaceData (Beginning, SubBuffer - Beginning, " {\n", 3); +#else + /* Find non-whitespace start of next line */ + + Next = SubBuffer + 1; + while ((*Next == ' ') || + (*Next == '\t')) + { + Next++; + } + + /* Find non-whitespace start of this line */ + + StartOfThisLine++; + while ((*StartOfThisLine == ' ') || + (*StartOfThisLine == '\t')) + { + StartOfThisLine++; + } + + /* + * Must be a single-line comment to need more whitespace + * Even then, we don't need more if the previous statement + * is an "else". + */ + if ((Next[0] == '/') && + (Next[1] == '*') && + (Next[2] != '\n') && + + (!strncmp (StartOfThisLine, "else if", 7) || + !strncmp (StartOfThisLine, "else while", 10) || + strncmp (StartOfThisLine, "else", 4))) + { + AsReplaceData (Beginning, SubBuffer - Beginning, " {\n", 3); + } + else + { + AsReplaceData (Beginning, SubBuffer - Beginning, " {", 2); + } +#endif + } + } + } + + SubBuffer++; + } +} + + +/****************************************************************************** + * + * FUNCTION: AsTabify4 + * + * DESCRIPTION: Convert the text to tabbed text. Alignment of text is + * preserved. + * + ******************************************************************************/ + +void +AsTabify4 ( + char *Buffer) +{ + char *SubBuffer = Buffer; + char *NewSubBuffer; + UINT32 SpaceCount = 0; + UINT32 Column = 0; + + + while (*SubBuffer) + { + if (*SubBuffer == '\n') + { + Column = 0; + } + else + { + Column++; + } + + /* Ignore comments */ + + if ((SubBuffer[0] == '/') && + (SubBuffer[1] == '*')) + { + SubBuffer = strstr (SubBuffer, "*/"); + if (!SubBuffer) + { + return; + } + + SubBuffer += 2; + continue; + } + + /* Ignore quoted strings */ + + if (*SubBuffer == '\"') + { + SubBuffer++; + SubBuffer = AsSkipPastChar (SubBuffer, '\"'); + if (!SubBuffer) + { + return; + } + SpaceCount = 0; + } + + if (*SubBuffer == ' ') + { + SpaceCount++; + + if (SpaceCount >= 4) + { + SpaceCount = 0; + + NewSubBuffer = (SubBuffer + 1) - 4; + *NewSubBuffer = '\t'; + NewSubBuffer++; + + /* Remove the spaces */ + + SubBuffer = AsRemoveData (NewSubBuffer, SubBuffer + 1); + } + + if ((Column % 4) == 0) + { + SpaceCount = 0; + } + } + else + { + SpaceCount = 0; + } + + SubBuffer++; + } +} + + +/****************************************************************************** + * + * FUNCTION: AsTabify8 + * + * DESCRIPTION: Convert the text to tabbed text. Alignment of text is + * preserved. + * + ******************************************************************************/ + +void +AsTabify8 ( + char *Buffer) +{ + char *SubBuffer = Buffer; + char *NewSubBuffer; + char *CommentEnd = NULL; + UINT32 SpaceCount = 0; + UINT32 Column = 0; + UINT32 TabCount = 0; + UINT32 LastLineTabCount = 0; + UINT32 LastLineColumnStart = 0; + UINT32 ThisColumnStart = 0; + UINT32 ThisTabCount = 0; + char *FirstNonBlank = NULL; + + + while (*SubBuffer) + { + if (*SubBuffer == '\n') + { + /* This is a standalone blank line */ + + FirstNonBlank = NULL; + Column = 0; + SpaceCount = 0; + TabCount = 0; + SubBuffer++; + continue; + } + + if (!FirstNonBlank) + { + /* Find the first non-blank character on this line */ + + FirstNonBlank = SubBuffer; + while (*FirstNonBlank == ' ') + { + FirstNonBlank++; + } + + /* + * This mechanism limits the difference in tab counts from + * line to line. It helps avoid the situation where a second + * continuation line (which was indented correctly for tabs=4) would + * get indented off the screen if we just blindly converted to tabs. + */ + ThisColumnStart = FirstNonBlank - SubBuffer; + + if (LastLineTabCount == 0) + { + ThisTabCount = 0; + } + else if (ThisColumnStart == LastLineColumnStart) + { + ThisTabCount = LastLineTabCount -1; + } + else + { + ThisTabCount = LastLineTabCount + 1; + } + } + + Column++; + + /* Check if we are in a comment */ + + if ((SubBuffer[0] == '*') && + (SubBuffer[1] == '/')) + { + SpaceCount = 0; + SubBuffer += 2; + + if (*SubBuffer == '\n') + { + if (TabCount > 0) + { + LastLineTabCount = TabCount; + TabCount = 0; + } + FirstNonBlank = NULL; + LastLineColumnStart = ThisColumnStart; + SubBuffer++; + } + + continue; + } + + /* Check for comment open */ + + if ((SubBuffer[0] == '/') && + (SubBuffer[1] == '*')) + { + /* Find the end of the comment, it must exist */ + + CommentEnd = strstr (SubBuffer, "*/"); + if (!CommentEnd) + { + return; + } + + /* Toss the rest of this line or single-line comment */ + + while ((SubBuffer < CommentEnd) && + (*SubBuffer != '\n')) + { + SubBuffer++; + } + + if (*SubBuffer == '\n') + { + if (TabCount > 0) + { + LastLineTabCount = TabCount; + TabCount = 0; + } + FirstNonBlank = NULL; + LastLineColumnStart = ThisColumnStart; + } + + SpaceCount = 0; + continue; + } + + /* Ignore quoted strings */ + + if ((!CommentEnd) && (*SubBuffer == '\"')) + { + SubBuffer++; + SubBuffer = AsSkipPastChar (SubBuffer, '\"'); + if (!SubBuffer) + { + return; + } + SpaceCount = 0; + } + + if (*SubBuffer != ' ') + { + /* Not a space, skip to end of line */ + + SubBuffer = AsSkipUntilChar (SubBuffer, '\n'); + if (!SubBuffer) + { + return; + } + if (TabCount > 0) + { + LastLineTabCount = TabCount; + TabCount = 0; + } + + FirstNonBlank = NULL; + LastLineColumnStart = ThisColumnStart; + Column = 0; + SpaceCount = 0; + } + else + { + /* Another space */ + + SpaceCount++; + + if (SpaceCount >= 4) + { + /* Replace this group of spaces with a tab character */ + + SpaceCount = 0; + + NewSubBuffer = SubBuffer - 3; + + if (TabCount <= ThisTabCount ? (ThisTabCount +1) : 0) + { + *NewSubBuffer = '\t'; + NewSubBuffer++; + SubBuffer++; + TabCount++; + } + + /* Remove the spaces */ + + SubBuffer = AsRemoveData (NewSubBuffer, SubBuffer); + continue; + } + } + + SubBuffer++; + } +} + + +/****************************************************************************** + * + * FUNCTION: AsCountLines + * + * DESCRIPTION: Count the number of lines in the input buffer. Also count + * the number of long lines (lines longer than 80 chars). + * + ******************************************************************************/ + +UINT32 +AsCountLines ( + char *Buffer, + char *Filename) +{ + char *SubBuffer = Buffer; + char *EndOfLine; + UINT32 LineCount = 0; + UINT32 LongLineCount = 0; + + + while (*SubBuffer) + { + EndOfLine = AsSkipUntilChar (SubBuffer, '\n'); + if (!EndOfLine) + { + Gbl_TotalLines += LineCount; + return LineCount; + } + + if ((EndOfLine - SubBuffer) > 80) + { + LongLineCount++; + VERBOSE_PRINT (("long: %.80s\n", SubBuffer)); + } + + LineCount++; + SubBuffer = EndOfLine + 1; + } + + if (LongLineCount) + { + VERBOSE_PRINT (("%d Lines longer than 80 found in %s\n", LongLineCount, Filename)); + Gbl_LongLines += LongLineCount; + } + + Gbl_TotalLines += LineCount; + return LineCount; +} + + +/****************************************************************************** + * + * FUNCTION: AsCountTabs + * + * DESCRIPTION: Simply count the number of tabs in the input file buffer + * + ******************************************************************************/ + +void +AsCountTabs ( + char *Buffer, + char *Filename) +{ + UINT32 i; + UINT32 TabCount = 0; + + + for (i = 0; Buffer[i]; i++) + { + if (Buffer[i] == '\t') + { + TabCount++; + } + } + + if (TabCount) + { + AsPrint ("Tabs found", TabCount, Filename); + Gbl_Tabs += TabCount; + } + + AsCountLines (Buffer, Filename); +} + + +/****************************************************************************** + * + * FUNCTION: AsCountNonAnsiComments + * + * DESCRIPTION: Count the number of "//" comments. This type of comment is + * non-ANSI C. + * + ******************************************************************************/ + +void +AsCountNonAnsiComments ( + char *Buffer, + char *Filename) +{ + char *SubBuffer = Buffer; + UINT32 CommentCount = 0; + + + while (SubBuffer) + { + SubBuffer = strstr (SubBuffer, "//"); + if (SubBuffer) + { + CommentCount++; + SubBuffer += 2; + } + } + + if (CommentCount) + { + AsPrint ("Non-ANSI Comments found", CommentCount, Filename); + Gbl_NonAnsiComments += CommentCount; + } +} + + +/****************************************************************************** + * + * FUNCTION: AsCountSourceLines + * + * DESCRIPTION: Count the number of C source lines. Defined by 1) not a + * comment, and 2) not a blank line. + * + ******************************************************************************/ + +void +AsCountSourceLines ( + char *Buffer, + char *Filename) +{ + char *SubBuffer = Buffer; + UINT32 LineCount = 0; + UINT32 WhiteCount = 0; + UINT32 CommentCount = 0; + + + while (*SubBuffer) + { + /* Detect comments (// comments are not used, non-ansii) */ + + if ((SubBuffer[0] == '/') && + (SubBuffer[1] == '*')) + { + SubBuffer += 2; + + /* First line of multi-line comment is often just whitespace */ + + if (SubBuffer[0] == '\n') + { + WhiteCount++; + SubBuffer++; + } + else + { + CommentCount++; + } + + /* Find end of comment */ + + while (SubBuffer[0] && SubBuffer[1] && + !(((SubBuffer[0] == '*') && + (SubBuffer[1] == '/')))) + { + if (SubBuffer[0] == '\n') + { + CommentCount++; + } + + SubBuffer++; + } + } + + /* A linefeed followed by a non-linefeed is a valid source line */ + + else if ((SubBuffer[0] == '\n') && + (SubBuffer[1] != '\n')) + { + LineCount++; + } + + /* Two back-to-back linefeeds indicate a whitespace line */ + + else if ((SubBuffer[0] == '\n') && + (SubBuffer[1] == '\n')) + { + WhiteCount++; + } + + SubBuffer++; + } + + /* Adjust comment count for legal header */ + + if (Gbl_HeaderSize < CommentCount) + { + CommentCount -= Gbl_HeaderSize; + Gbl_HeaderLines += Gbl_HeaderSize; + } + + Gbl_SourceLines += LineCount; + Gbl_WhiteLines += WhiteCount; + Gbl_CommentLines += CommentCount; + + VERBOSE_PRINT (("%d Comment %d White %d Code %d Lines in %s\n", + CommentCount, WhiteCount, LineCount, LineCount+WhiteCount+CommentCount, Filename)); +} + + +/****************************************************************************** + * + * FUNCTION: AsInsertPrefix + * + * DESCRIPTION: Insert struct or union prefixes + * + ******************************************************************************/ + +void +AsInsertPrefix ( + char *Buffer, + char *Keyword, + UINT8 Type) +{ + char *SubString; + char *SubBuffer; + char *EndKeyword; + int StrLength; + int InsertLength; + char *InsertString; + int TrailingSpaces; + char LowerKeyword[128]; + int KeywordLength; + + + switch (Type) + { + case SRC_TYPE_STRUCT: + InsertString = "struct "; + break; + + case SRC_TYPE_UNION: + InsertString = "union "; + break; + + default: + return; + } + + strcpy (LowerKeyword, Keyword); + strlwr (LowerKeyword); + + SubBuffer = Buffer; + SubString = Buffer; + InsertLength = strlen (InsertString); + KeywordLength = strlen (Keyword); + + + while (SubString) + { + /* Find an instance of the keyword */ + + SubString = strstr (SubBuffer, LowerKeyword); + + if (!SubString) + { + return; + } + + SubBuffer = SubString; + + /* Must be standalone word, not a substring */ + + if (AsMatchExactWord (SubString, KeywordLength)) + { + /* Make sure the keyword isn't already prefixed with the insert */ + + if (!strncmp (SubString - InsertLength, InsertString, InsertLength)) + { + /* Add spaces if not already at the end-of-line */ + + if (*(SubBuffer + KeywordLength) != '\n') + { + /* Already present, add spaces after to align structure members */ + +#if 0 +/* ONLY FOR C FILES */ + AsInsertData (SubBuffer + KeywordLength, " ", 8); +#endif + } + goto Next; + } + + /* Make sure the keyword isn't at the end of a struct/union */ + /* Note: This code depends on a single space after the brace */ + + if (*(SubString - 2) == '}') + { + goto Next; + } + + /* Prefix the keyword with the insert string */ + + Gbl_MadeChanges = TRUE; + StrLength = strlen (SubString); + + /* Is there room for insertion */ + + EndKeyword = SubString + strlen (LowerKeyword); + + TrailingSpaces = 0; + while (EndKeyword[TrailingSpaces] == ' ') + { + TrailingSpaces++; + } + + /* + * Use "if (TrailingSpaces > 1)" if we want to ignore casts + */ + SubBuffer = SubString + InsertLength; + + if (TrailingSpaces > InsertLength) + { + /* Insert the keyword */ + + memmove (SubBuffer, SubString, KeywordLength); + + /* Insert the keyword */ + + memmove (SubString, InsertString, InsertLength); + } + else + { + AsInsertData (SubString, InsertString, InsertLength); + } + } + +Next: + SubBuffer += KeywordLength; + } +} + +#ifdef ACPI_FUTURE_IMPLEMENTATION +/****************************************************************************** + * + * FUNCTION: AsTrimComments + * + * DESCRIPTION: Finds 3-line comments with only a single line of text + * + ******************************************************************************/ + +void +AsTrimComments ( + char *Buffer, + char *Filename) +{ + char *SubBuffer = Buffer; + char *Ptr1; + char *Ptr2; + UINT32 LineCount; + UINT32 ShortCommentCount = 0; + + + while (1) + { + /* Find comment open, within procedure level */ + + SubBuffer = strstr (SubBuffer, " /*"); + if (!SubBuffer) + { + goto Exit; + } + + /* Find comment terminator */ + + Ptr1 = strstr (SubBuffer, "*/"); + if (!Ptr1) + { + goto Exit; + } + + /* Find next EOL (from original buffer) */ + + Ptr2 = strstr (SubBuffer, "\n"); + if (!Ptr2) + { + goto Exit; + } + + /* Ignore one-line comments */ + + if (Ptr1 < Ptr2) + { + /* Normal comment, ignore and continue; */ + + SubBuffer = Ptr2; + continue; + } + + /* Examine multi-line comment */ + + LineCount = 1; + while (Ptr1 > Ptr2) + { + /* Find next EOL */ + + Ptr2++; + Ptr2 = strstr (Ptr2, "\n"); + if (!Ptr2) + { + goto Exit; + } + + LineCount++; + } + + SubBuffer = Ptr1; + + if (LineCount <= 3) + { + ShortCommentCount++; + } + } + + +Exit: + + if (ShortCommentCount) + { + AsPrint ("Short Comments found", ShortCommentCount, Filename); + } +} +#endif + + diff --git a/sys/contrib/dev/acpica/tools/acpisrc/asfile.c b/sys/contrib/dev/acpica/tools/acpisrc/asfile.c new file mode 100644 index 000000000000..d6561898095e --- /dev/null +++ b/sys/contrib/dev/acpica/tools/acpisrc/asfile.c @@ -0,0 +1,886 @@ + +/****************************************************************************** + * + * Module Name: asfile - Main module for the acpi source processor utility + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2009, 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 "acpisrc.h" + +/* Local prototypes */ + +void +AsDoWildcard ( + ACPI_CONVERSION_TABLE *ConversionTable, + char *SourcePath, + char *TargetPath, + int MaxPathLength, + int FileType, + char *WildcardSpec); + +BOOLEAN +AsDetectLoneLineFeeds ( + char *Filename, + char *Buffer); + +static inline int +AsMaxInt (int a, int b) +{ + return (a > b ? a : b); +} + + +/****************************************************************************** + * + * FUNCTION: AsDoWildcard + * + * DESCRIPTION: Process files via wildcards + * + ******************************************************************************/ + +void +AsDoWildcard ( + ACPI_CONVERSION_TABLE *ConversionTable, + char *SourcePath, + char *TargetPath, + int MaxPathLength, + int FileType, + char *WildcardSpec) +{ + void *DirInfo; + char *Filename; + char *SourceDirPath; + char *TargetDirPath; + char RequestedFileType; + + + if (FileType == FILE_TYPE_DIRECTORY) + { + RequestedFileType = REQUEST_DIR_ONLY; + } + else + { + RequestedFileType = REQUEST_FILE_ONLY; + } + + VERBOSE_PRINT (("Checking for %s source files in directory \"%s\"\n", + WildcardSpec, SourcePath)); + + /* Open the directory for wildcard search */ + + DirInfo = AcpiOsOpenDirectory (SourcePath, WildcardSpec, RequestedFileType); + if (DirInfo) + { + /* + * Get all of the files that match both the + * wildcard and the requested file type + */ + while ((Filename = AcpiOsGetNextFilename (DirInfo))) + { + /* Looking for directory files, must check file type */ + + switch (RequestedFileType) + { + case REQUEST_DIR_ONLY: + + /* If we actually have a dir, process the subtree */ + + if (!AsCheckForDirectory (SourcePath, TargetPath, Filename, + &SourceDirPath, &TargetDirPath)) + { + VERBOSE_PRINT (("Subdirectory: %s\n", Filename)); + + AsProcessTree (ConversionTable, SourceDirPath, TargetDirPath); + free (SourceDirPath); + free (TargetDirPath); + } + break; + + case REQUEST_FILE_ONLY: + + /* Otherwise, this is a file, not a directory */ + + VERBOSE_PRINT (("File: %s\n", Filename)); + + AsProcessOneFile (ConversionTable, SourcePath, TargetPath, + MaxPathLength, Filename, FileType); + break; + + default: + break; + } + } + + /* Cleanup */ + + AcpiOsCloseDirectory (DirInfo); + } +} + + +/****************************************************************************** + * + * FUNCTION: AsProcessTree + * + * DESCRIPTION: Process the directory tree. Files with the extension ".C" and + * ".H" are processed as the tree is traversed. + * + ******************************************************************************/ + +ACPI_NATIVE_INT +AsProcessTree ( + ACPI_CONVERSION_TABLE *ConversionTable, + char *SourcePath, + char *TargetPath) +{ + int MaxPathLength; + + + MaxPathLength = AsMaxInt (strlen (SourcePath), strlen (TargetPath)); + + if (!(ConversionTable->Flags & FLG_NO_FILE_OUTPUT)) + { + if (ConversionTable->Flags & FLG_LOWERCASE_DIRNAMES) + { + strlwr (TargetPath); + } + + VERBOSE_PRINT (("Creating Directory \"%s\"\n", TargetPath)); + if (mkdir (TargetPath)) + { + if (errno != EEXIST) + { + printf ("Could not create target directory\n"); + return -1; + } + } + } + + /* Do the C source files */ + + AsDoWildcard (ConversionTable, SourcePath, TargetPath, MaxPathLength, + FILE_TYPE_SOURCE, "*.c"); + + /* Do the C header files */ + + AsDoWildcard (ConversionTable, SourcePath, TargetPath, MaxPathLength, + FILE_TYPE_HEADER, "*.h"); + + /* Do the Lex file(s) */ + + AsDoWildcard (ConversionTable, SourcePath, TargetPath, MaxPathLength, + FILE_TYPE_SOURCE, "*.l"); + + /* Do the yacc file(s) */ + + AsDoWildcard (ConversionTable, SourcePath, TargetPath, MaxPathLength, + FILE_TYPE_SOURCE, "*.y"); + + /* Do any ASL files */ + + AsDoWildcard (ConversionTable, SourcePath, TargetPath, MaxPathLength, + FILE_TYPE_HEADER, "*.asl"); + + /* Do any subdirectories */ + + AsDoWildcard (ConversionTable, SourcePath, TargetPath, MaxPathLength, + FILE_TYPE_DIRECTORY, "*"); + + return 0; +} + + +/****************************************************************************** + * + * FUNCTION: AsDetectLoneLineFeeds + * + * DESCRIPTION: Find LF without CR. + * + ******************************************************************************/ + +BOOLEAN +AsDetectLoneLineFeeds ( + char *Filename, + char *Buffer) +{ + UINT32 i = 1; + UINT32 LfCount = 0; + UINT32 LineCount = 0; + + + if (!Buffer[0]) + { + return FALSE; + } + + while (Buffer[i]) + { + if (Buffer[i] == 0x0A) + { + if (Buffer[i-1] != 0x0D) + { + LfCount++; + } + LineCount++; + } + i++; + } + + if (LfCount) + { + if (LineCount == LfCount) + { + if (!Gbl_IgnoreLoneLineFeeds) + { + printf ("%s: ****File has UNIX format**** (LF only, not CR/LF) %d lines\n", + Filename, LfCount); + } + } + else + { + printf ("%s: %d lone linefeeds in file\n", Filename, LfCount); + } + return TRUE; + } + + return (FALSE); +} + + +/****************************************************************************** + * + * FUNCTION: AsConvertFile + * + * DESCRIPTION: Perform the requested transforms on the file buffer (as + * determined by the ConversionTable and the FileType). + * + ******************************************************************************/ + +void +AsConvertFile ( + ACPI_CONVERSION_TABLE *ConversionTable, + char *FileBuffer, + char *Filename, + ACPI_NATIVE_INT FileType) +{ + UINT32 i; + UINT32 Functions; + ACPI_STRING_TABLE *StringTable; + ACPI_IDENTIFIER_TABLE *ConditionalTable; + ACPI_IDENTIFIER_TABLE *LineTable; + ACPI_IDENTIFIER_TABLE *MacroTable; + ACPI_TYPED_IDENTIFIER_TABLE *StructTable; + + + switch (FileType) + { + case FILE_TYPE_SOURCE: + Functions = ConversionTable->SourceFunctions; + StringTable = ConversionTable->SourceStringTable; + LineTable = ConversionTable->SourceLineTable; + ConditionalTable = ConversionTable->SourceConditionalTable; + MacroTable = ConversionTable->SourceMacroTable; + StructTable = ConversionTable->SourceStructTable; + break; + + case FILE_TYPE_HEADER: + Functions = ConversionTable->HeaderFunctions; + StringTable = ConversionTable->HeaderStringTable; + LineTable = ConversionTable->HeaderLineTable; + ConditionalTable = ConversionTable->HeaderConditionalTable; + MacroTable = ConversionTable->HeaderMacroTable; + StructTable = ConversionTable->HeaderStructTable; + break; + + default: + printf ("Unknown file type, cannot process\n"); + return; + } + + + Gbl_StructDefs = strstr (FileBuffer, "/* acpisrc:StructDefs"); + Gbl_Files++; + VERBOSE_PRINT (("Processing %u bytes\n", strlen (FileBuffer))); + + if (ConversionTable->LowerCaseTable) + { + for (i = 0; ConversionTable->LowerCaseTable[i].Identifier; i++) + { + AsLowerCaseString (ConversionTable->LowerCaseTable[i].Identifier, + FileBuffer); + } + } + + /* Process all the string replacements */ + + if (StringTable) + { + for (i = 0; StringTable[i].Target; i++) + { + AsReplaceString (StringTable[i].Target, StringTable[i].Replacement, + StringTable[i].Type, FileBuffer); + } + } + + if (LineTable) + { + for (i = 0; LineTable[i].Identifier; i++) + { + AsRemoveLine (FileBuffer, LineTable[i].Identifier); + } + } + + if (ConditionalTable) + { + for (i = 0; ConditionalTable[i].Identifier; i++) + { + AsRemoveConditionalCompile (FileBuffer, ConditionalTable[i].Identifier); + } + } + + if (MacroTable) + { + for (i = 0; MacroTable[i].Identifier; i++) + { + AsRemoveMacro (FileBuffer, MacroTable[i].Identifier); + } + } + + if (StructTable) + { + for (i = 0; StructTable[i].Identifier; i++) + { + AsInsertPrefix (FileBuffer, StructTable[i].Identifier, StructTable[i].Type); + } + } + + /* Process the function table */ + + for (i = 0; i < 32; i++) + { + /* Decode the function bitmap */ + + switch ((1 << i) & Functions) + { + case 0: + /* This function not configured */ + break; + + + case CVT_COUNT_TABS: + + AsCountTabs (FileBuffer, Filename); + break; + + + case CVT_COUNT_NON_ANSI_COMMENTS: + + AsCountNonAnsiComments (FileBuffer, Filename); + break; + + + case CVT_CHECK_BRACES: + + AsCheckForBraces (FileBuffer, Filename); + break; + + + case CVT_TRIM_LINES: + + AsTrimLines (FileBuffer, Filename); + break; + + + case CVT_COUNT_LINES: + + AsCountSourceLines (FileBuffer, Filename); + break; + + + case CVT_BRACES_ON_SAME_LINE: + + AsBracesOnSameLine (FileBuffer); + break; + + + case CVT_MIXED_CASE_TO_UNDERSCORES: + + AsMixedCaseToUnderscores (FileBuffer); + break; + + + case CVT_LOWER_CASE_IDENTIFIERS: + + AsLowerCaseIdentifiers (FileBuffer); + break; + + + case CVT_REMOVE_DEBUG_MACROS: + + AsRemoveDebugMacros (FileBuffer); + break; + + + case CVT_TRIM_WHITESPACE: + + AsTrimWhitespace (FileBuffer); + break; + + + case CVT_REMOVE_EMPTY_BLOCKS: + + AsRemoveEmptyBlocks (FileBuffer, Filename); + break; + + + case CVT_REDUCE_TYPEDEFS: + + AsReduceTypedefs (FileBuffer, "typedef union"); + AsReduceTypedefs (FileBuffer, "typedef struct"); + break; + + + case CVT_SPACES_TO_TABS4: + + AsTabify4 (FileBuffer); + break; + + + case CVT_SPACES_TO_TABS8: + + AsTabify8 (FileBuffer); + break; + + case CVT_COUNT_SHORTMULTILINE_COMMENTS: + +#ifdef ACPI_FUTURE_IMPLEMENTATION + AsTrimComments (FileBuffer, Filename); +#endif + break; + + default: + + printf ("Unknown conversion subfunction opcode\n"); + break; + } + } + + if (ConversionTable->NewHeader) + { + AsReplaceHeader (FileBuffer, ConversionTable->NewHeader); + } +} + + +/****************************************************************************** + * + * FUNCTION: AsProcessOneFile + * + * DESCRIPTION: Process one source file. The file is opened, read entirely + * into a buffer, converted, then written to a new file. + * + ******************************************************************************/ + +ACPI_NATIVE_INT +AsProcessOneFile ( + ACPI_CONVERSION_TABLE *ConversionTable, + char *SourcePath, + char *TargetPath, + int MaxPathLength, + char *Filename, + ACPI_NATIVE_INT FileType) +{ + char *Pathname; + char *OutPathname = NULL; + + + /* Allocate a file pathname buffer for both source and target */ + + Pathname = calloc (MaxPathLength + strlen (Filename) + 2, 1); + if (!Pathname) + { + printf ("Could not allocate buffer for file pathnames\n"); + return -1; + } + + Gbl_FileType = FileType; + + /* Generate the source pathname and read the file */ + + if (SourcePath) + { + strcpy (Pathname, SourcePath); + strcat (Pathname, "/"); + } + + strcat (Pathname, Filename); + + if (AsGetFile (Pathname, &Gbl_FileBuffer, &Gbl_FileSize)) + { + return -1; + } + + Gbl_HeaderSize = 0; + if (strstr (Filename, ".asl")) + { + Gbl_HeaderSize = LINES_IN_ASL_HEADER; /* Lines in default ASL header */ + } + else if (strstr (Gbl_FileBuffer, LEGAL_HEADER_SIGNATURE)) + { + Gbl_HeaderSize = LINES_IN_LEGAL_HEADER; /* Normal C file and H header */ + } + else if (strstr (Gbl_FileBuffer, LINUX_HEADER_SIGNATURE)) + { + Gbl_HeaderSize = LINES_IN_LINUX_HEADER; /* Linuxized C file and H header */ + } + + /* Process the file in the buffer */ + + Gbl_MadeChanges = FALSE; + if (!Gbl_IgnoreLoneLineFeeds && Gbl_HasLoneLineFeeds) + { + /* + * All lone LFs will be converted to CR/LF + * (when file is written, Windows version only) + */ + printf ("Converting lone linefeeds\n"); + Gbl_MadeChanges = TRUE; + } + + AsConvertFile (ConversionTable, Gbl_FileBuffer, Pathname, FileType); + + if (!(ConversionTable->Flags & FLG_NO_FILE_OUTPUT)) + { + if (!(Gbl_Overwrite && !Gbl_MadeChanges)) + { + /* Generate the target pathname and write the file */ + + OutPathname = calloc (MaxPathLength + strlen (Filename) + 2 + strlen (TargetPath), 1); + if (!OutPathname) + { + printf ("Could not allocate buffer for file pathnames\n"); + return -1; + } + + strcpy (OutPathname, TargetPath); + if (SourcePath) + { + strcat (OutPathname, "/"); + strcat (OutPathname, Filename); + } + + AsPutFile (OutPathname, Gbl_FileBuffer, ConversionTable->Flags); + } + } + + free (Gbl_FileBuffer); + free (Pathname); + if (OutPathname) + { + free (OutPathname); + } + + return 0; +} + + +/****************************************************************************** + * + * FUNCTION: AsCheckForDirectory + * + * DESCRIPTION: Check if the current file is a valid directory. If not, + * construct the full pathname for the source and target paths. + * Checks for the dot and dot-dot files (they are ignored) + * + ******************************************************************************/ + +ACPI_NATIVE_INT +AsCheckForDirectory ( + char *SourceDirPath, + char *TargetDirPath, + char *Filename, + char **SourcePath, + char **TargetPath) +{ + char *SrcPath; + char *TgtPath; + + + if (!(strcmp (Filename, ".")) || + !(strcmp (Filename, ".."))) + { + return -1; + } + + SrcPath = calloc (strlen (SourceDirPath) + strlen (Filename) + 2, 1); + if (!SrcPath) + { + printf ("Could not allocate buffer for directory source pathname\n"); + return -1; + } + + TgtPath = calloc (strlen (TargetDirPath) + strlen (Filename) + 2, 1); + if (!TgtPath) + { + printf ("Could not allocate buffer for directory target pathname\n"); + free (SrcPath); + return -1; + } + + strcpy (SrcPath, SourceDirPath); + strcat (SrcPath, "/"); + strcat (SrcPath, Filename); + + strcpy (TgtPath, TargetDirPath); + strcat (TgtPath, "/"); + strcat (TgtPath, Filename); + + *SourcePath = SrcPath; + *TargetPath = TgtPath; + return 0; +} + + +/****************************************************************************** + * + * FUNCTION: AsGetFile + * + * DESCRIPTION: Open a file and read it entirely into a an allocated buffer + * + ******************************************************************************/ + +int +AsGetFile ( + char *Filename, + char **FileBuffer, + UINT32 *FileSize) +{ + + int FileHandle; + UINT32 Size; + char *Buffer; + + + /* Binary mode leaves CR/LF pairs */ + + FileHandle = open (Filename, O_BINARY | O_RDONLY); + if (!FileHandle) + { + printf ("Could not open %s\n", Filename); + return -1; + } + + if (fstat (FileHandle, &Gbl_StatBuf)) + { + printf ("Could not get file status for %s\n", Filename); + goto ErrorExit; + } + + /* + * Create a buffer for the entire file + * Add plenty extra buffer to accomodate string replacements + */ + Size = Gbl_StatBuf.st_size; + Gbl_TotalSize += Size; + + Buffer = calloc (Size * 2, 1); + if (!Buffer) + { + printf ("Could not allocate buffer of size %d\n", Size * 2); + goto ErrorExit; + } + + /* Read the entire file */ + + Size = read (FileHandle, Buffer, Size); + if (Size == -1) + { + printf ("Could not read the input file %s\n", Filename); + goto ErrorExit; + } + + Buffer [Size] = 0; /* Null terminate the buffer */ + close (FileHandle); + + /* Check for unix contamination */ + + Gbl_HasLoneLineFeeds = AsDetectLoneLineFeeds (Filename, Buffer); + + /* + * Convert all CR/LF pairs to LF only. We do this locally so that + * this code is portable across operating systems. + */ + AsConvertToLineFeeds (Buffer); + + *FileBuffer = Buffer; + *FileSize = Size; + + return 0; + + +ErrorExit: + + close (FileHandle); + return -1; +} + + +/****************************************************************************** + * + * FUNCTION: AsPutFile + * + * DESCRIPTION: Create a new output file and write the entire contents of the + * buffer to the new file. Buffer must be a zero terminated string + * + ******************************************************************************/ + +int +AsPutFile ( + char *Pathname, + char *FileBuffer, + UINT32 SystemFlags) +{ + UINT32 FileSize; + int DestHandle; + int OpenFlags; + + + /* Create the target file */ + + OpenFlags = O_TRUNC | O_CREAT | O_WRONLY | O_BINARY; + + if (!(SystemFlags & FLG_NO_CARRIAGE_RETURNS)) + { + /* Put back the CR before each LF */ + + AsInsertCarriageReturns (FileBuffer); + } + + DestHandle = open (Pathname, OpenFlags, S_IREAD | S_IWRITE); + if (DestHandle == -1) + { + perror ("Could not create destination file"); + printf ("Could not create destination file \"%s\"\n", Pathname); + return -1; + } + + /* Write the buffer to the file */ + + FileSize = strlen (FileBuffer); + write (DestHandle, FileBuffer, FileSize); + + close (DestHandle); + + return 0; +} + + diff --git a/sys/contrib/dev/acpica/tools/acpisrc/asmain.c b/sys/contrib/dev/acpica/tools/acpisrc/asmain.c new file mode 100644 index 000000000000..c1fbb0cf133c --- /dev/null +++ b/sys/contrib/dev/acpica/tools/acpisrc/asmain.c @@ -0,0 +1,512 @@ + +/****************************************************************************** + * + * Module Name: asmain - Main module for the acpi source processor utility + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2009, 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 "acpisrc.h" +#include "acapps.h" + +/* Local prototypes */ + +int +AsStricmp ( + char *String1, + char *String2); + +int +AsExaminePaths ( + ACPI_CONVERSION_TABLE *ConversionTable, + char *Source, + char *Target, + UINT32 *SourceFileType); + +void +AsDisplayStats ( + void); + +void +AsDisplayUsage ( + void); + +/* Globals */ + +UINT32 Gbl_Tabs = 0; +UINT32 Gbl_MissingBraces = 0; +UINT32 Gbl_NonAnsiComments = 0; +UINT32 Gbl_Files = 0; +UINT32 Gbl_WhiteLines = 0; +UINT32 Gbl_CommentLines = 0; +UINT32 Gbl_SourceLines = 0; +UINT32 Gbl_LongLines = 0; +UINT32 Gbl_TotalLines = 0; +UINT32 Gbl_TotalSize = 0; +UINT32 Gbl_HeaderLines = 0; +UINT32 Gbl_HeaderSize = 0; +void *Gbl_StructDefs = NULL; + +struct stat Gbl_StatBuf; +char *Gbl_FileBuffer; +UINT32 Gbl_FileSize; +UINT32 Gbl_FileType; +BOOLEAN Gbl_VerboseMode = FALSE; +BOOLEAN Gbl_QuietMode = FALSE; +BOOLEAN Gbl_BatchMode = FALSE; +BOOLEAN Gbl_DebugStatementsMode = FALSE; +BOOLEAN Gbl_MadeChanges = FALSE; +BOOLEAN Gbl_Overwrite = FALSE; +BOOLEAN Gbl_WidenDeclarations = FALSE; +BOOLEAN Gbl_IgnoreLoneLineFeeds = FALSE; +BOOLEAN Gbl_HasLoneLineFeeds = FALSE; + + +/****************************************************************************** + * + * FUNCTION: AsStricmp + * + * DESCRIPTION: Implementation of the non-ANSI stricmp function (compare + * strings with no case sensitivity) + * + ******************************************************************************/ + +int +AsStricmp ( + char *String1, + char *String2) +{ + int c1; + int c2; + + + do + { + c1 = tolower (*String1); + c2 = tolower (*String2); + + String1++; + String2++; + } + while ((c1 == c2) && (c1)); + + return (c1 - c2); +} + + +/****************************************************************************** + * + * FUNCTION: AsExaminePaths + * + * DESCRIPTION: Source and Target pathname verification and handling + * + ******************************************************************************/ + +int +AsExaminePaths ( + ACPI_CONVERSION_TABLE *ConversionTable, + char *Source, + char *Target, + UINT32 *SourceFileType) +{ + int Status; + char Response; + + + Status = stat (Source, &Gbl_StatBuf); + if (Status) + { + printf ("Source path \"%s\" does not exist\n", Source); + return -1; + } + + /* Return the filetype -- file or a directory */ + + *SourceFileType = 0; + if (Gbl_StatBuf.st_mode & S_IFDIR) + { + *SourceFileType = S_IFDIR; + } + + /* + * If we are in no-output mode or in batch mode, we are done + */ + if ((ConversionTable->Flags & FLG_NO_FILE_OUTPUT) || + (Gbl_BatchMode)) + { + return 0; + } + + if (!AsStricmp (Source, Target)) + { + printf ("Target path is the same as the source path, overwrite?\n"); + scanf ("%c", &Response); + + /* Check response */ + + if ((char) Response != 'y') + { + return -1; + } + + Gbl_Overwrite = TRUE; + } + else + { + Status = stat (Target, &Gbl_StatBuf); + if (!Status) + { + printf ("Target path already exists, overwrite?\n"); + scanf ("%c", &Response); + + /* Check response */ + + if ((char) Response != 'y') + { + return -1; + } + } + } + + return 0; +} + + +/****************************************************************************** + * + * FUNCTION: AsDisplayStats + * + * DESCRIPTION: Display global statistics gathered during translation + * + ******************************************************************************/ + +void +AsDisplayStats ( + void) +{ + + if (Gbl_QuietMode) + { + return; + } + + printf ("\nAcpiSrc statistics:\n\n"); + printf ("%8u Files processed\n", Gbl_Files); + printf ("%8u Total bytes (%.1fK/file)\n", + Gbl_TotalSize, ((double) Gbl_TotalSize/Gbl_Files)/1024); + printf ("%8u Tabs found\n", Gbl_Tabs); + printf ("%8u Missing if/else braces\n", Gbl_MissingBraces); + printf ("%8u Non-ANSI comments found\n", Gbl_NonAnsiComments); + printf ("%8u Total Lines\n", Gbl_TotalLines); + printf ("%8u Lines of code\n", Gbl_SourceLines); + printf ("%8u Lines of non-comment whitespace\n", Gbl_WhiteLines); + printf ("%8u Lines of comments\n", Gbl_CommentLines); + printf ("%8u Long lines found\n", Gbl_LongLines); + printf ("%8.1f Ratio of code to whitespace\n", + ((float) Gbl_SourceLines / (float) Gbl_WhiteLines)); + printf ("%8.1f Ratio of code to comments\n", + ((float) Gbl_SourceLines / (float) (Gbl_CommentLines + Gbl_NonAnsiComments))); + printf (" %u%% code, %u%% comments, %u%% whitespace, %u%% headers\n", + (Gbl_SourceLines * 100) / Gbl_TotalLines, + (Gbl_CommentLines * 100) / Gbl_TotalLines, + (Gbl_WhiteLines * 100) / Gbl_TotalLines, + (Gbl_HeaderLines * 100) / Gbl_TotalLines); + return; +} + + +/****************************************************************************** + * + * FUNCTION: AsDisplayUsage + * + * DESCRIPTION: Usage message + * + ******************************************************************************/ + +void +AsDisplayUsage ( + void) +{ + + printf ("\n"); + printf ("Usage: acpisrc [-c|l|u] [-dsvy] <SourceDir> <DestinationDir>\n\n"); + printf ("Where: -c Generate cleaned version of the source\n"); + printf (" -l Generate Linux version of the source\n"); + printf (" -u Generate Custom source translation\n"); + printf ("\n"); + printf (" -d Leave debug statements in code\n"); + printf (" -s Generate source statistics only\n"); + printf (" -v Verbose mode\n"); + printf (" -y Suppress file overwrite prompts\n"); + printf ("\n"); + return; +} + + +/****************************************************************************** + * + * FUNCTION: main + * + * DESCRIPTION: C main function + * + ******************************************************************************/ + +int ACPI_SYSTEM_XFACE +main ( + int argc, + char *argv[]) +{ + int j; + ACPI_CONVERSION_TABLE *ConversionTable = NULL; + char *SourcePath; + char *TargetPath; + UINT32 FileType; + + + printf ("ACPI Source Code Conversion Utility"); + printf (" version %8.8X", ((UINT32) ACPI_CA_VERSION)); + printf (" [%s]\n\n", __DATE__); + + if (argc < 2) + { + AsDisplayUsage (); + return 0; + } + + /* Command line options */ + + while ((j = AcpiGetopt (argc, argv, "cdlqsuvy")) != EOF) switch(j) + { + case 'l': + /* Linux code generation */ + + printf ("Creating Linux source code\n"); + ConversionTable = &LinuxConversionTable; + Gbl_WidenDeclarations = TRUE; + Gbl_IgnoreLoneLineFeeds = TRUE; + break; + + case 'c': + /* Cleanup code */ + + printf ("Code cleanup\n"); + ConversionTable = &CleanupConversionTable; + break; + + case 's': + /* Statistics only */ + + break; + + case 'u': + /* custom conversion */ + + printf ("Custom source translation\n"); + ConversionTable = &CustomConversionTable; + break; + + case 'v': + /* Verbose mode */ + + Gbl_VerboseMode = TRUE; + break; + + case 'y': + /* Batch mode */ + + Gbl_BatchMode = TRUE; + break; + + case 'd': + /* Leave debug statements in */ + + Gbl_DebugStatementsMode = TRUE; + break; + + case 'q': + /* Quiet mode */ + + Gbl_QuietMode = TRUE; + break; + + default: + AsDisplayUsage (); + return -1; + } + + + SourcePath = argv[AcpiGbl_Optind]; + if (!SourcePath) + { + printf ("Missing source path\n"); + AsDisplayUsage (); + return -1; + } + + TargetPath = argv[AcpiGbl_Optind+1]; + + if (!ConversionTable) + { + /* Just generate statistics. Ignore target path */ + + TargetPath = SourcePath; + + printf ("Source code statistics only\n"); + ConversionTable = &StatsConversionTable; + } + else if (!TargetPath) + { + TargetPath = SourcePath; + } + + if (Gbl_DebugStatementsMode) + { + ConversionTable->SourceFunctions &= ~CVT_REMOVE_DEBUG_MACROS; + } + + /* Check source and target paths and files */ + + if (AsExaminePaths (ConversionTable, SourcePath, TargetPath, &FileType)) + { + return -1; + } + + /* Source/target can be either directories or a files */ + + if (FileType == S_IFDIR) + { + /* Process the directory tree */ + + AsProcessTree (ConversionTable, SourcePath, TargetPath); + } + else + { + /* Process a single file */ + + /* Differentiate between source and header files */ + + if (strstr (SourcePath, ".h")) + { + AsProcessOneFile (ConversionTable, NULL, TargetPath, 0, SourcePath, FILE_TYPE_HEADER); + } + else + { + AsProcessOneFile (ConversionTable, NULL, TargetPath, 0, SourcePath, FILE_TYPE_SOURCE); + } + } + + /* Always display final summary and stats */ + + AsDisplayStats (); + + return 0; +} diff --git a/sys/contrib/dev/acpica/tools/acpisrc/asremove.c b/sys/contrib/dev/acpica/tools/acpisrc/asremove.c new file mode 100644 index 000000000000..18f72f3c1578 --- /dev/null +++ b/sys/contrib/dev/acpica/tools/acpisrc/asremove.c @@ -0,0 +1,688 @@ + +/****************************************************************************** + * + * Module Name: asremove - Source conversion - removal functions + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2009, 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 "acpisrc.h" + +/* Local prototypes */ + +void +AsRemoveStatement ( + char *Buffer, + char *Keyword, + UINT32 Type); + + +/****************************************************************************** + * + * FUNCTION: AsRemoveStatement + * + * DESCRIPTION: Remove all statements that contain the given keyword. + * Limitations: Removes text from the start of the line that + * contains the keyword to the next semicolon. Currently + * doesn't ignore comments. + * + ******************************************************************************/ + +void +AsRemoveStatement ( + char *Buffer, + char *Keyword, + UINT32 Type) +{ + char *SubString; + char *SubBuffer; + int KeywordLength; + + + KeywordLength = strlen (Keyword); + SubBuffer = Buffer; + SubString = Buffer; + + + while (SubString) + { + SubString = strstr (SubBuffer, Keyword); + + if (SubString) + { + SubBuffer = SubString; + + if ((Type == REPLACE_WHOLE_WORD) && + (!AsMatchExactWord (SubString, KeywordLength))) + { + SubBuffer++; + continue; + } + + /* Find start of this line */ + + while (*SubString != '\n') + { + SubString--; + } + SubString++; + + /* Find end of this statement */ + + SubBuffer = AsSkipPastChar (SubBuffer, ';'); + if (!SubBuffer) + { + return; + } + + /* Find end of this line */ + + SubBuffer = AsSkipPastChar (SubBuffer, '\n'); + if (!SubBuffer) + { + return; + } + + /* If next line is blank, remove it too */ + + if (*SubBuffer == '\n') + { + SubBuffer++; + } + + /* Remove the lines */ + + SubBuffer = AsRemoveData (SubString, SubBuffer); + } + } +} + + +/****************************************************************************** + * + * FUNCTION: AsRemoveConditionalCompile + * + * DESCRIPTION: Remove a "#ifdef" statement, and all text that it encompasses. + * Limitations: cannot handle nested ifdefs. + * + ******************************************************************************/ + +void +AsRemoveConditionalCompile ( + char *Buffer, + char *Keyword) +{ + char *SubString; + char *SubBuffer; + char *IfPtr; + char *EndifPtr; + char *ElsePtr; + char *Comment; + int KeywordLength; + + + KeywordLength = strlen (Keyword); + SubBuffer = Buffer; + SubString = Buffer; + + + while (SubString) + { + SubBuffer = strstr (SubString, Keyword); + if (!SubBuffer) + { + return; + } + + /* + * Check for translation escape string -- means to ignore + * blocks of code while replacing + */ + Comment = strstr (SubString, AS_START_IGNORE); + + if ((Comment) && + (Comment < SubBuffer)) + { + SubString = strstr (Comment, AS_STOP_IGNORE); + if (!SubString) + { + return; + } + + SubString += 3; + continue; + } + + /* Check for ordinary comment */ + + Comment = strstr (SubString, "/*"); + + if ((Comment) && + (Comment < SubBuffer)) + { + SubString = strstr (Comment, "*/"); + if (!SubString) + { + return; + } + + SubString += 2; + continue; + } + + SubString = SubBuffer; + if (!AsMatchExactWord (SubString, KeywordLength)) + { + SubString++; + continue; + } + + /* Find start of this line */ + + while (*SubString != '\n' && (SubString > Buffer)) + { + SubString--; + } + SubString++; + + /* Find the "#ifxxxx" */ + + IfPtr = strstr (SubString, "#if"); + if (!IfPtr) + { + return; + } + + if (IfPtr > SubBuffer) + { + /* Not the right #if */ + + SubString = SubBuffer + strlen (Keyword); + continue; + } + + /* Find closing #endif or #else */ + + EndifPtr = strstr (SubBuffer, "#endif"); + if (!EndifPtr) + { + /* There has to be an #endif */ + + return; + } + + ElsePtr = strstr (SubBuffer, "#else"); + if ((ElsePtr) && + (EndifPtr > ElsePtr)) + { + /* This #ifdef contains an #else clause */ + /* Find end of this line */ + + SubBuffer = AsSkipPastChar (ElsePtr, '\n'); + if (!SubBuffer) + { + return; + } + + /* Remove the #ifdef .... #else code */ + + AsRemoveData (SubString, SubBuffer); + + /* Next, we will remove the #endif statement */ + + EndifPtr = strstr (SubString, "#endif"); + if (!EndifPtr) + { + /* There has to be an #endif */ + + return; + } + + SubString = EndifPtr; + } + + /* Remove the ... #endif part */ + /* Find end of this line */ + + SubBuffer = AsSkipPastChar (EndifPtr, '\n'); + if (!SubBuffer) + { + return; + } + + /* Remove the lines */ + + SubBuffer = AsRemoveData (SubString, SubBuffer); + } +} + + +/****************************************************************************** + * + * FUNCTION: AsRemoveMacro + * + * DESCRIPTION: Remove every line that contains the keyword. Does not + * skip comments. + * + ******************************************************************************/ + +void +AsRemoveMacro ( + char *Buffer, + char *Keyword) +{ + char *SubString; + char *SubBuffer; + int NestLevel; + + + SubBuffer = Buffer; + SubString = Buffer; + + + while (SubString) + { + SubString = strstr (SubBuffer, Keyword); + + if (SubString) + { + SubBuffer = SubString; + + /* Find start of the macro parameters */ + + while (*SubString != '(') + { + SubString++; + } + SubString++; + + /* Remove the macro name and opening paren */ + + SubString = AsRemoveData (SubBuffer, SubString); + + NestLevel = 1; + while (*SubString) + { + if (*SubString == '(') + { + NestLevel++; + } + else if (*SubString == ')') + { + NestLevel--; + } + + SubString++; + + if (NestLevel == 0) + { + break; + } + } + + /* Remove the closing paren */ + + SubBuffer = AsRemoveData (SubString-1, SubString); + } + } +} + + +/****************************************************************************** + * + * FUNCTION: AsRemoveLine + * + * DESCRIPTION: Remove every line that contains the keyword. Does not + * skip comments. + * + ******************************************************************************/ + +void +AsRemoveLine ( + char *Buffer, + char *Keyword) +{ + char *SubString; + char *SubBuffer; + + + SubBuffer = Buffer; + SubString = Buffer; + + + while (SubString) + { + SubString = strstr (SubBuffer, Keyword); + + if (SubString) + { + SubBuffer = SubString; + + /* Find start of this line */ + + while (*SubString != '\n') + { + SubString--; + } + SubString++; + + /* Find end of this line */ + + SubBuffer = AsSkipPastChar (SubBuffer, '\n'); + if (!SubBuffer) + { + return; + } + + /* Remove the line */ + + SubBuffer = AsRemoveData (SubString, SubBuffer); + } + } +} + + +/****************************************************************************** + * + * FUNCTION: AsReduceTypedefs + * + * DESCRIPTION: Eliminate certain typedefs + * + ******************************************************************************/ + +void +AsReduceTypedefs ( + char *Buffer, + char *Keyword) +{ + char *SubString; + char *SubBuffer; + int NestLevel; + + + SubBuffer = Buffer; + SubString = Buffer; + + + while (SubString) + { + SubString = strstr (SubBuffer, Keyword); + + if (SubString) + { + /* Remove the typedef itself */ + + SubBuffer = SubString + strlen ("typedef") + 1; + SubBuffer = AsRemoveData (SubString, SubBuffer); + + /* Find the opening brace of the struct or union */ + + while (*SubString != '{') + { + SubString++; + } + SubString++; + + /* Find the closing brace. Handles nested braces */ + + NestLevel = 1; + while (*SubString) + { + if (*SubString == '{') + { + NestLevel++; + } + else if (*SubString == '}') + { + NestLevel--; + } + + SubString++; + + if (NestLevel == 0) + { + break; + } + } + + /* Remove an extra line feed if present */ + + if (!strncmp (SubString - 3, "\n\n", 2)) + { + *(SubString -2) = '}'; + SubString--; + } + + /* Find the end of the typedef name */ + + SubBuffer = AsSkipUntilChar (SubString, ';'); + + /* And remove the typedef name */ + + SubBuffer = AsRemoveData (SubString, SubBuffer); + } + } +} + + +/****************************************************************************** + * + * FUNCTION: AsRemoveEmptyBlocks + * + * DESCRIPTION: Remove any C blocks (e.g., if {}) that contain no code. This + * can happen as a result of removing lines such as DEBUG_PRINT. + * + ******************************************************************************/ + +void +AsRemoveEmptyBlocks ( + char *Buffer, + char *Filename) +{ + char *SubBuffer; + char *BlockStart; + BOOLEAN EmptyBlock = TRUE; + BOOLEAN AnotherPassRequired = TRUE; + UINT32 BlockCount = 0; + + + while (AnotherPassRequired) + { + SubBuffer = Buffer; + AnotherPassRequired = FALSE; + + while (*SubBuffer) + { + if (*SubBuffer == '{') + { + BlockStart = SubBuffer; + EmptyBlock = TRUE; + + SubBuffer++; + while (*SubBuffer != '}') + { + if ((*SubBuffer != ' ') && + (*SubBuffer != '\n')) + { + EmptyBlock = FALSE; + break; + } + SubBuffer++; + } + + if (EmptyBlock) + { + /* Find start of the first line of the block */ + + while (*BlockStart != '\n') + { + BlockStart--; + } + + /* Find end of the last line of the block */ + + SubBuffer = AsSkipUntilChar (SubBuffer, '\n'); + if (!SubBuffer) + { + break; + } + + /* Remove the block */ + + SubBuffer = AsRemoveData (BlockStart, SubBuffer); + BlockCount++; + AnotherPassRequired = TRUE; + continue; + } + } + + SubBuffer++; + } + } + + if (BlockCount) + { + Gbl_MadeChanges = TRUE; + AsPrint ("Code blocks deleted", BlockCount, Filename); + } +} + + +/****************************************************************************** + * + * FUNCTION: AsRemoveDebugMacros + * + * DESCRIPTION: Remove all "Debug" macros -- macros that produce debug output. + * + ******************************************************************************/ + +void +AsRemoveDebugMacros ( + char *Buffer) +{ + AsRemoveConditionalCompile (Buffer, "ACPI_DEBUG_OUTPUT"); + + AsRemoveStatement (Buffer, "ACPI_DEBUG_PRINT", REPLACE_WHOLE_WORD); + AsRemoveStatement (Buffer, "ACPI_DEBUG_PRINT_RAW", REPLACE_WHOLE_WORD); + AsRemoveStatement (Buffer, "DEBUG_EXEC", REPLACE_WHOLE_WORD); + AsRemoveStatement (Buffer, "FUNCTION_ENTRY", REPLACE_WHOLE_WORD); + AsRemoveStatement (Buffer, "PROC_NAME", REPLACE_WHOLE_WORD); + AsRemoveStatement (Buffer, "FUNCTION_TRACE", REPLACE_SUBSTRINGS); + AsRemoveStatement (Buffer, "DUMP_", REPLACE_SUBSTRINGS); + + AsReplaceString ("return_VOID", "return", REPLACE_WHOLE_WORD, Buffer); + AsReplaceString ("return_PTR", "return", REPLACE_WHOLE_WORD, Buffer); + AsReplaceString ("return_ACPI_STATUS", "return", REPLACE_WHOLE_WORD, Buffer); + AsReplaceString ("return_acpi_status", "return", REPLACE_WHOLE_WORD, Buffer); + AsReplaceString ("return_VALUE", "return", REPLACE_WHOLE_WORD, Buffer); +} + + diff --git a/sys/contrib/dev/acpica/tools/acpisrc/astable.c b/sys/contrib/dev/acpica/tools/acpisrc/astable.c new file mode 100644 index 000000000000..b8135514694c --- /dev/null +++ b/sys/contrib/dev/acpica/tools/acpisrc/astable.c @@ -0,0 +1,824 @@ + +/****************************************************************************** + * + * Module Name: astable - Tables used for source conversion + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2009, 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 "acpisrc.h" +#include "acapps.h" + + +/****************************************************************************** + * + * Standard/Common translation tables + * + ******************************************************************************/ + + +ACPI_STRING_TABLE StandardDataTypes[] = { + + /* Declarations first */ + + {"UINT32 ", "unsigned int", REPLACE_SUBSTRINGS}, + {"UINT16 ", "unsigned short", REPLACE_SUBSTRINGS}, + {"UINT8 ", "unsigned char", REPLACE_SUBSTRINGS}, + {"BOOLEAN ", "unsigned char", REPLACE_SUBSTRINGS}, + + /* Now do embedded typecasts */ + + {"UINT32", "unsigned int", REPLACE_SUBSTRINGS}, + {"UINT16", "unsigned short", REPLACE_SUBSTRINGS}, + {"UINT8", "unsigned char", REPLACE_SUBSTRINGS}, + {"BOOLEAN", "unsigned char", REPLACE_SUBSTRINGS}, + + {"INT32 ", "int ", REPLACE_SUBSTRINGS}, + {"INT32", "int", REPLACE_SUBSTRINGS}, + {"INT16", "short", REPLACE_SUBSTRINGS}, + {"INT8", "char", REPLACE_SUBSTRINGS}, + + /* Put back anything we broke (such as anything with _INT32_ in it) */ + + {"_int_", "_INT32_", REPLACE_SUBSTRINGS}, + {"_unsigned int_", "_UINT32_", REPLACE_SUBSTRINGS}, + {NULL, NULL, 0} +}; + + +/****************************************************************************** + * + * Linux-specific translation tables + * + ******************************************************************************/ + +char LinuxHeader[] = +"/*\n" +" * Copyright (C) 2000 - 2009, Intel Corp.\n" +" * All rights reserved.\n" +" *\n" +" * Redistribution and use in source and binary forms, with or without\n" +" * modification, are permitted provided that the following conditions\n" +" * are met:\n" +" * 1. Redistributions of source code must retain the above copyright\n" +" * notice, this list of conditions, and the following disclaimer,\n" +" * without modification.\n" +" * 2. Redistributions in binary form must reproduce at minimum a disclaimer\n" +" * substantially similar to the \"NO WARRANTY\" disclaimer below\n" +" * (\"Disclaimer\") and any redistribution must be conditioned upon\n" +" * including a substantially similar Disclaimer requirement for further\n" +" * binary redistribution.\n" +" * 3. Neither the names of the above-listed copyright holders nor the names\n" +" * of any contributors may be used to endorse or promote products derived\n" +" * from this software without specific prior written permission.\n" +" *\n" +" * Alternatively, this software may be distributed under the terms of the\n" +" * GNU General Public License (\"GPL\") version 2 as published by the Free\n" +" * Software Foundation.\n" +" *\n" +" * NO WARRANTY\n" +" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n" +" * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n" +" * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR\n" +" * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n" +" * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n" +" * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n" +" * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n" +" * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n" +" * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING\n" +" * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n" +" * POSSIBILITY OF SUCH DAMAGES.\n" +" */\n"; + +ACPI_STRING_TABLE LinuxDataTypes[] = { + +/* + * Extra space is added after the type so there is room to add "struct", "union", + * etc. when the existing struct typedefs are eliminated. + */ + + /* Declarations first - ACPI types and standard C types */ + + {"INT64 ", "s64 ", REPLACE_WHOLE_WORD | EXTRA_INDENT_C}, + {"UINT64 ", "u64 ", REPLACE_WHOLE_WORD | EXTRA_INDENT_C}, + {"UINT32 ", "u32 ", REPLACE_WHOLE_WORD | EXTRA_INDENT_C}, + {"INT32 ", "s32 ", REPLACE_WHOLE_WORD | EXTRA_INDENT_C}, + {"UINT16 ", "u16 ", REPLACE_WHOLE_WORD | EXTRA_INDENT_C}, + {"INT16 ", "s16 ", REPLACE_WHOLE_WORD | EXTRA_INDENT_C}, + {"UINT8 ", "u8 ", REPLACE_WHOLE_WORD | EXTRA_INDENT_C}, + {"BOOLEAN ", "u8 ", REPLACE_WHOLE_WORD | EXTRA_INDENT_C}, + {"char ", "char ", REPLACE_WHOLE_WORD | EXTRA_INDENT_C}, + {"void ", "void ", REPLACE_WHOLE_WORD | EXTRA_INDENT_C}, + {"char * ", "char * ", REPLACE_WHOLE_WORD | EXTRA_INDENT_C}, + {"void * ", "void * ", REPLACE_WHOLE_WORD | EXTRA_INDENT_C}, + {"int ", "int ", REPLACE_WHOLE_WORD | EXTRA_INDENT_C}, + {"FILE ", "FILE ", REPLACE_WHOLE_WORD | EXTRA_INDENT_C}, + {"size_t ", "size_t ", REPLACE_WHOLE_WORD | EXTRA_INDENT_C}, + + /* Now do embedded typecasts */ + + {"UINT64", "u64", REPLACE_WHOLE_WORD}, + {"UINT32", "u32", REPLACE_WHOLE_WORD}, + {"UINT16", "u16", REPLACE_WHOLE_WORD}, + {"UINT8", "u8", REPLACE_WHOLE_WORD}, + {"BOOLEAN", "u8", REPLACE_WHOLE_WORD}, + + {"INT64 ", "s64 ", REPLACE_WHOLE_WORD}, + {"INT64", "s64", REPLACE_WHOLE_WORD}, + {"INT32 ", "s32 ", REPLACE_WHOLE_WORD}, + {"INT32", "s32", REPLACE_WHOLE_WORD}, + {"INT16 ", "s16 ", REPLACE_WHOLE_WORD}, + {"INT8 ", "s8 ", REPLACE_WHOLE_WORD}, + {"INT16", "s16", REPLACE_WHOLE_WORD}, + {"INT8", "s8", REPLACE_WHOLE_WORD}, + + {NULL, NULL, 0}, +}; + +ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { + + {"ACPI_ADR_SPACE_HANDLER", SRC_TYPE_SIMPLE}, + {"ACPI_ADR_SPACE_SETUP", SRC_TYPE_SIMPLE}, + {"ACPI_ADR_SPACE_TYPE", SRC_TYPE_SIMPLE}, + {"ACPI_AML_OPERANDS", SRC_TYPE_UNION}, + {"ACPI_BIT_REGISTER_INFO", SRC_TYPE_STRUCT}, + {"ACPI_BUFFER", SRC_TYPE_STRUCT}, + {"ACPI_BUS_ATTRIBUTE", SRC_TYPE_STRUCT}, + {"ACPI_CACHE_T", SRC_TYPE_SIMPLE}, + {"ACPI_COMMON_FACS", SRC_TYPE_STRUCT}, + {"ACPI_COMMON_STATE", SRC_TYPE_STRUCT}, + {"ACPI_COMMON_DESCRIPTOR", SRC_TYPE_STRUCT}, + {"ACPI_COMPATIBLE_ID", SRC_TYPE_STRUCT}, + {"ACPI_COMPATIBLE_ID_LIST", SRC_TYPE_STRUCT}, + {"ACPI_CONTROL_STATE", SRC_TYPE_STRUCT}, + {"ACPI_CONVERSION_TABLE", SRC_TYPE_STRUCT}, + {"ACPI_CPU_FLAGS", SRC_TYPE_SIMPLE}, + {"ACPI_CREATE_FIELD_INFO", SRC_TYPE_STRUCT}, + {"ACPI_DB_METHOD_INFO", SRC_TYPE_STRUCT}, + {"ACPI_DEBUG_MEM_BLOCK", SRC_TYPE_STRUCT}, + {"ACPI_DEBUG_MEM_HEADER", SRC_TYPE_STRUCT}, + {"ACPI_DEBUG_PRINT_INFO", SRC_TYPE_STRUCT}, + {"ACPI_DESCRIPTOR", SRC_TYPE_UNION}, + {"ACPI_DEVICE_ID", SRC_TYPE_STRUCT}, + {"ACPI_DEVICE_INFO", SRC_TYPE_STRUCT}, + {"ACPI_DEVICE_WALK_INFO", SRC_TYPE_STRUCT}, + {"ACPI_DMTABLE_DATA", SRC_TYPE_STRUCT}, + {"ACPI_DMTABLE_INFO", SRC_TYPE_STRUCT}, + {"ACPI_DMTABLE_HANDLER", SRC_TYPE_SIMPLE}, + {"ACPI_EVALUATE_INFO", SRC_TYPE_STRUCT}, + {"ACPI_EVENT_HANDLER", SRC_TYPE_SIMPLE}, + {"ACPI_EVENT_STATUS", SRC_TYPE_SIMPLE}, + {"ACPI_EVENT_TYPE", SRC_TYPE_SIMPLE}, + {"ACPI_EXCEPTION_HANDLER", SRC_TYPE_SIMPLE}, + {"ACPI_EXDUMP_INFO", SRC_TYPE_STRUCT}, + {"ACPI_EXECUTE_TYPE", SRC_TYPE_SIMPLE}, + {"ACPI_EXTERNAL_LIST", SRC_TYPE_STRUCT}, + {"ACPI_FADT_INFO", SRC_TYPE_STRUCT}, + {"ACPI_FADT_PM_INFO", SRC_TYPE_STRUCT}, + {"ACPI_FIELD_INFO", SRC_TYPE_STRUCT}, + {"ACPI_FIND_CONTEXT", SRC_TYPE_STRUCT}, + {"ACPI_FIXED_EVENT_HANDLER", SRC_TYPE_STRUCT}, + {"ACPI_FIXED_EVENT_INFO", SRC_TYPE_STRUCT}, + {"ACPI_GENERIC_ADDRESS", SRC_TYPE_STRUCT}, + {"ACPI_GENERIC_STATE", SRC_TYPE_UNION}, + {"ACPI_GET_DEVICES_INFO", SRC_TYPE_STRUCT}, + {"ACPI_GPE_BLOCK_INFO", SRC_TYPE_STRUCT}, + {"ACPI_GPE_CALLBACK", SRC_TYPE_SIMPLE}, + {"ACPI_GPE_DEVICE_INFO", SRC_TYPE_STRUCT}, + {"ACPI_GPE_EVENT_INFO", SRC_TYPE_STRUCT}, + {"ACPI_GPE_HANDLER", SRC_TYPE_SIMPLE}, + {"ACPI_GPE_INDEX_INFO", SRC_TYPE_STRUCT}, + {"ACPI_GPE_REGISTER_INFO", SRC_TYPE_STRUCT}, + {"ACPI_GPE_WALK_INFO", SRC_TYPE_STRUCT}, + {"ACPI_GPE_XRUPT_INFO", SRC_TYPE_STRUCT}, + {"ACPI_HANDLE", SRC_TYPE_SIMPLE}, + {"ACPI_HANDLER_INFO", SRC_TYPE_STRUCT}, + {"ACPI_INIT_HANDLER", SRC_TYPE_SIMPLE}, + {"ACPI_IDENTIFIER_TABLE", SRC_TYPE_STRUCT}, + {"ACPI_INIT_WALK_INFO", SRC_TYPE_STRUCT}, + {"ACPI_INTEGER", SRC_TYPE_SIMPLE}, + {"ACPI_INTEGER_OVERLAY", SRC_TYPE_STRUCT}, + {"ACPI_INTEGRITY_INFO", SRC_TYPE_STRUCT}, + {"ACPI_INTERFACE_INFO", SRC_TYPE_STRUCT}, + {"ACPI_INTERNAL_RSDT", SRC_TYPE_STRUCT}, + {"ACPI_INTERPRETER_MODE", SRC_TYPE_SIMPLE}, + {"ACPI_IO_ADDRESS", SRC_TYPE_SIMPLE}, + {"ACPI_IO_ATTRIBUTE", SRC_TYPE_STRUCT}, + {"ACPI_MEM_SPACE_CONTEXT", SRC_TYPE_STRUCT}, + {"ACPI_MEMORY_ATTRIBUTE", SRC_TYPE_STRUCT}, + {"ACPI_MEMORY_LIST", SRC_TYPE_STRUCT}, + {"ACPI_MUTEX", SRC_TYPE_SIMPLE}, + {"ACPI_MUTEX_HANDLE", SRC_TYPE_SIMPLE}, + {"ACPI_MUTEX_INFO", SRC_TYPE_STRUCT}, + {"ACPI_NAME", SRC_TYPE_SIMPLE}, + {"ACPI_NAME_INFO", SRC_TYPE_STRUCT}, + {"ACPI_NAME_UNION", SRC_TYPE_UNION}, + {"ACPI_NAMESPACE_NODE", SRC_TYPE_STRUCT}, + {"ACPI_NAMESTRING_INFO", SRC_TYPE_STRUCT}, + {"ACPI_NATIVE_INT", SRC_TYPE_SIMPLE}, + {"ACPI_NATIVE_UINT", SRC_TYPE_SIMPLE}, + {"ACPI_NOTIFY_HANDLER", SRC_TYPE_SIMPLE}, + {"ACPI_NOTIFY_INFO", SRC_TYPE_STRUCT}, + {"ACPI_NS_SEARCH_DATA", SRC_TYPE_STRUCT}, + {"ACPI_OBJ_INFO_HEADER", SRC_TYPE_STRUCT}, + {"ACPI_OBJECT", SRC_TYPE_UNION}, + {"ACPI_OBJECT_ADDR_HANDLER", SRC_TYPE_STRUCT}, + {"ACPI_OBJECT_BANK_FIELD", SRC_TYPE_STRUCT}, + {"ACPI_OBJECT_BUFFER", SRC_TYPE_STRUCT}, + {"ACPI_OBJECT_BUFFER_FIELD", SRC_TYPE_STRUCT}, + {"ACPI_OBJECT_CACHE_LIST", SRC_TYPE_STRUCT}, + {"ACPI_OBJECT_COMMON", SRC_TYPE_STRUCT}, + {"ACPI_OBJECT_DATA", SRC_TYPE_STRUCT}, + {"ACPI_OBJECT_DEVICE", SRC_TYPE_STRUCT}, + {"ACPI_OBJECT_EVENT", SRC_TYPE_STRUCT}, + {"ACPI_OBJECT_EXTRA", SRC_TYPE_STRUCT}, + {"ACPI_OBJECT_FIELD_COMMON", SRC_TYPE_STRUCT}, + {"ACPI_OBJECT_HANDLER", SRC_TYPE_SIMPLE}, + {"ACPI_OBJECT_INDEX_FIELD", SRC_TYPE_STRUCT}, + {"ACPI_OBJECT_INTEGER", SRC_TYPE_STRUCT}, + {"ACPI_OBJECT_LIST", SRC_TYPE_STRUCT}, + {"ACPI_OBJECT_METHOD", SRC_TYPE_STRUCT}, + {"ACPI_OBJECT_MUTEX", SRC_TYPE_STRUCT}, + {"ACPI_OBJECT_NOTIFY_COMMON", SRC_TYPE_STRUCT}, + {"ACPI_OBJECT_NOTIFY_HANDLER", SRC_TYPE_STRUCT}, + {"ACPI_OBJECT_PACKAGE", SRC_TYPE_STRUCT}, + {"ACPI_OBJECT_POWER_RESOURCE", SRC_TYPE_STRUCT}, + {"ACPI_OBJECT_PROCESSOR", SRC_TYPE_STRUCT}, + {"ACPI_OBJECT_REFERENCE", SRC_TYPE_STRUCT}, + {"ACPI_OBJECT_REGION", SRC_TYPE_STRUCT}, + {"ACPI_OBJECT_REGION_FIELD", SRC_TYPE_STRUCT}, + {"ACPI_OBJECT_STRING", SRC_TYPE_STRUCT}, + {"ACPI_OBJECT_THERMAL_ZONE", SRC_TYPE_STRUCT}, + {"ACPI_OBJECT_TYPE", SRC_TYPE_SIMPLE}, + {"ACPI_OBJECT_TYPE8", SRC_TYPE_SIMPLE}, + {"ACPI_OP_WALK_INFO", SRC_TYPE_STRUCT}, + {"ACPI_OPCODE_INFO", SRC_TYPE_STRUCT}, + {"ACPI_OPERAND_OBJECT", SRC_TYPE_UNION}, + {"ACPI_OSD_HANDLER", SRC_TYPE_SIMPLE}, + {"ACPI_OSD_EXEC_CALLBACK", SRC_TYPE_SIMPLE}, + {"ACPI_OWNER_ID", SRC_TYPE_SIMPLE}, + {"ACPI_PACKAGE_INFO", SRC_TYPE_STRUCT}, + {"ACPI_PACKAGE_INFO2", SRC_TYPE_STRUCT}, + {"ACPI_PACKAGE_INFO3", SRC_TYPE_STRUCT}, + {"ACPI_PARSE_DOWNWARDS", SRC_TYPE_SIMPLE}, + {"ACPI_PARSE_OBJ_ASL", SRC_TYPE_STRUCT}, + {"ACPI_PARSE_OBJ_COMMON", SRC_TYPE_STRUCT}, + {"ACPI_PARSE_OBJ_NAMED", SRC_TYPE_STRUCT}, + {"ACPI_PARSE_OBJECT", SRC_TYPE_UNION}, + {"ACPI_PARSE_STATE", SRC_TYPE_STRUCT}, + {"ACPI_PARSE_UPWARDS", SRC_TYPE_SIMPLE}, + {"ACPI_PARSE_VALUE", SRC_TYPE_UNION}, + {"ACPI_PCI_ID", SRC_TYPE_STRUCT}, + {"ACPI_PCI_ROUTING_TABLE", SRC_TYPE_STRUCT}, + {"ACPI_PHYSICAL_ADDRESS", SRC_TYPE_SIMPLE}, + {"ACPI_PKG_CALLBACK", SRC_TYPE_SIMPLE}, + {"ACPI_PKG_INFO", SRC_TYPE_STRUCT}, + {"ACPI_PKG_STATE", SRC_TYPE_STRUCT}, + {"ACPI_POINTER", SRC_TYPE_STRUCT}, + {"ACPI_POINTERS", SRC_TYPE_UNION}, + {"ACPI_PORT_INFO", SRC_TYPE_STRUCT}, + {"ACPI_PREDEFINED_INFO", SRC_TYPE_UNION}, + {"ACPI_PREDEFINED_NAMES", SRC_TYPE_STRUCT}, + {"ACPI_PSCOPE_STATE", SRC_TYPE_STRUCT}, + {"ACPI_RESOURCE", SRC_TYPE_STRUCT}, + {"ACPI_RESOURCE_ADDRESS", SRC_TYPE_STRUCT}, + {"ACPI_RESOURCE_ADDRESS16", SRC_TYPE_STRUCT}, + {"ACPI_RESOURCE_ADDRESS32", SRC_TYPE_STRUCT}, + {"ACPI_RESOURCE_ADDRESS64", SRC_TYPE_STRUCT}, + {"ACPI_RESOURCE_EXTENDED_ADDRESS64", SRC_TYPE_STRUCT}, + {"ACPI_RESOURCE_ATTRIBUTE", SRC_TYPE_UNION}, + {"ACPI_RESOURCE_DATA", SRC_TYPE_UNION}, + {"ACPI_RESOURCE_DMA", SRC_TYPE_STRUCT}, + {"ACPI_RESOURCE_END_TAG", SRC_TYPE_STRUCT}, + {"ACPI_RESOURCE_EXTENDED_IRQ", SRC_TYPE_STRUCT}, + {"ACPI_RESOURCE_FIXED_IO", SRC_TYPE_STRUCT}, + {"ACPI_RESOURCE_FIXED_MEMORY32", SRC_TYPE_STRUCT}, + {"ACPI_RESOURCE_GENERIC_REGISTER", SRC_TYPE_STRUCT}, + {"ACPI_RESOURCE_INFO", SRC_TYPE_STRUCT}, + {"ACPI_RESOURCE_IO", SRC_TYPE_STRUCT}, + {"ACPI_RESOURCE_IRQ", SRC_TYPE_STRUCT}, + {"ACPI_RESOURCE_MEMORY24", SRC_TYPE_STRUCT}, + {"ACPI_RESOURCE_MEMORY32", SRC_TYPE_STRUCT}, + {"ACPI_RESOURCE_SOURCE", SRC_TYPE_STRUCT}, + {"ACPI_RESOURCE_START_DEPENDENT", SRC_TYPE_STRUCT}, + {"ACPI_RESOURCE_TAG", SRC_TYPE_STRUCT}, + {"ACPI_RESOURCE_TYPE", SRC_TYPE_SIMPLE}, + {"ACPI_RESOURCE_VENDOR", SRC_TYPE_STRUCT}, + {"ACPI_RESOURCE_VENDOR_TYPED", SRC_TYPE_STRUCT}, + {"ACPI_RESULT_VALUES", SRC_TYPE_STRUCT}, + {"ACPI_ROUND_UP_TO_32_BIT", SRC_TYPE_SIMPLE}, + {"ACPI_RSCONVERT_INFO", SRC_TYPE_STRUCT}, + {"ACPI_RSDUMP_INFO", SRC_TYPE_STRUCT}, + {"ACPI_RW_LOCK", SRC_TYPE_STRUCT}, + {"ACPI_SCOPE_STATE", SRC_TYPE_STRUCT}, + {"ACPI_SEMAPHORE", SRC_TYPE_SIMPLE}, + {"ACPI_SIGNAL_FATAL_INFO", SRC_TYPE_STRUCT}, + {"ACPI_SIZE", SRC_TYPE_SIMPLE}, + {"ACPI_SPINLOCK", SRC_TYPE_SIMPLE}, + {"ACPI_STATISTICS", SRC_TYPE_STRUCT}, + {"ACPI_STATUS", SRC_TYPE_SIMPLE}, + {"ACPI_STRING", SRC_TYPE_SIMPLE}, + {"ACPI_STRING_TABLE", SRC_TYPE_STRUCT}, + {"ACPI_SUBTABLE_HEADER", SRC_TYPE_STRUCT}, + {"ACPI_SYSTEM_INFO", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_DESC", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_HANDLER", SRC_TYPE_SIMPLE}, + {"ACPI_TABLE_HEADER", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_INFO", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_LIST", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_SUPPORT", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_TYPE", SRC_TYPE_SIMPLE}, + {"ACPI_THREAD_ID", SRC_TYPE_SIMPLE}, + {"ACPI_THREAD_STATE", SRC_TYPE_STRUCT}, + {"ACPI_TYPED_IDENTIFIER_TABLE", SRC_TYPE_STRUCT}, + {"ACPI_UINTPTR_T", SRC_TYPE_SIMPLE}, + {"ACPI_UPDATE_STATE", SRC_TYPE_STRUCT}, + {"ACPI_UUID", SRC_TYPE_STRUCT}, + {"ACPI_VENDOR_UUID", SRC_TYPE_STRUCT}, + {"ACPI_VENDOR_WALK_INFO", SRC_TYPE_STRUCT}, + {"ACPI_WALK_AML_CALLBACK", SRC_TYPE_SIMPLE}, + {"ACPI_WALK_CALLBACK", SRC_TYPE_SIMPLE}, + {"ACPI_WALK_RESOURCE_CALLBACK", SRC_TYPE_SIMPLE}, + {"ACPI_WALK_INFO", SRC_TYPE_STRUCT}, + {"ACPI_WALK_STATE", SRC_TYPE_STRUCT}, + {"ACPI_WHEA_HEADER", SRC_TYPE_STRUCT}, + + {"ACPI_RS_LENGTH", SRC_TYPE_SIMPLE}, + {"ACPI_RSDESC_SIZE", SRC_TYPE_SIMPLE}, + + {"AML_RESOURCE", SRC_TYPE_UNION}, + {"AML_RESOURCE_ADDRESS", SRC_TYPE_STRUCT}, + {"AML_RESOURCE_ADDRESS16", SRC_TYPE_STRUCT}, + {"AML_RESOURCE_ADDRESS32", SRC_TYPE_STRUCT}, + {"AML_RESOURCE_ADDRESS64", SRC_TYPE_STRUCT}, + {"AML_RESOURCE_DMA", SRC_TYPE_STRUCT}, + {"AML_RESOURCE_END_DEPENDENT", SRC_TYPE_STRUCT}, + {"AML_RESOURCE_END_TAG", SRC_TYPE_STRUCT}, + {"AML_RESOURCE_EXTENDED_ADDRESS64", SRC_TYPE_STRUCT}, + {"AML_RESOURCE_EXTENDED_IRQ", SRC_TYPE_STRUCT}, + {"AML_RESOURCE_FIXED_IO", SRC_TYPE_STRUCT}, + {"AML_RESOURCE_FIXED_MEMORY32", SRC_TYPE_STRUCT}, + {"AML_RESOURCE_GENERIC_REGISTER", SRC_TYPE_STRUCT}, + {"AML_RESOURCE_IO", SRC_TYPE_STRUCT}, + {"AML_RESOURCE_IRQ", SRC_TYPE_STRUCT}, + {"AML_RESOURCE_IRQ_NOFLAGS", SRC_TYPE_STRUCT}, + {"AML_RESOURCE_LARGE_HEADER", SRC_TYPE_STRUCT}, + {"AML_RESOURCE_MEMORY24", SRC_TYPE_STRUCT}, + {"AML_RESOURCE_MEMORY32", SRC_TYPE_STRUCT}, + {"AML_RESOURCE_SMALL_HEADER", SRC_TYPE_STRUCT}, + {"AML_RESOURCE_START_DEPENDENT", SRC_TYPE_STRUCT}, + {"AML_RESOURCE_START_DEPENDENT_NOPRIO", SRC_TYPE_STRUCT}, + {"AML_RESOURCE_VENDOR_LARGE", SRC_TYPE_STRUCT}, + {"AML_RESOURCE_VENDOR_SMALL", SRC_TYPE_STRUCT}, + + {"APIC_HEADER", SRC_TYPE_STRUCT}, + {"ARGUMENT_INFO", SRC_TYPE_STRUCT}, + {"AE_DEBUG_REGIONS", SRC_TYPE_STRUCT}, + {"AE_REGION", SRC_TYPE_STRUCT}, + {"ASL_ANALYSIS_WALK_INFO", SRC_TYPE_STRUCT}, + {"ASL_ERROR_MSG", SRC_TYPE_STRUCT}, + {"ASL_EVENT_INFO", SRC_TYPE_STRUCT}, + {"ASL_FILE_INFO", SRC_TYPE_STRUCT}, + {"ASL_FILE_STATUS", SRC_TYPE_STRUCT}, + {"ASL_LISTING_NODE", SRC_TYPE_STRUCT}, + {"ASL_MAPPING_ENTRY", SRC_TYPE_STRUCT}, + {"ASL_METHOD_INFO", SRC_TYPE_STRUCT}, + {"ASL_RESERVED_INFO", SRC_TYPE_STRUCT}, + {"ASL_RESOURCE_NODE", SRC_TYPE_STRUCT}, + {"ASL_WALK_CALLBACK", SRC_TYPE_SIMPLE}, + {"COMMAND_INFO", SRC_TYPE_STRUCT}, + {"UINT32_STRUCT", SRC_TYPE_STRUCT}, + {"UINT64_OVERLAY", SRC_TYPE_UNION}, + {"UINT64_STRUCT", SRC_TYPE_STRUCT}, + + /* + * Acpi table definition names. + */ + {"ACPI_TABLE_ASF", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_BERT", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_BOOT", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_CPEP", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_DBGP", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_DMAR", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_ECDT", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_EINJ", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_ERST", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_FACS", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_FADT", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_HEST", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_HPET", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_IBFT", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_MADT", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_MCFG", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_RSDP", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_RSDT", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_SBST", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_SLIT", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_SPCR", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_SPMI", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_SRAT", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_TCPA", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_UEFI", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_WDAT", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_WDRT", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_XSDT", SRC_TYPE_STRUCT}, + + {"ACPI_ASF_ADDRESS", SRC_TYPE_STRUCT}, + {"ACPI_ASF_ALERT", SRC_TYPE_STRUCT}, + {"ACPI_ASF_ALERT_DATA", SRC_TYPE_STRUCT}, + {"ACPI_ASF_CONTROL_DATA", SRC_TYPE_STRUCT}, + {"ACPI_ASF_HEADER", SRC_TYPE_STRUCT}, + {"ACPI_ASF_INFO", SRC_TYPE_STRUCT}, + {"ACPI_ASF_REMOTE", SRC_TYPE_STRUCT}, + {"ACPI_ASF_RMCP", SRC_TYPE_STRUCT}, + {"ACPI_BERT_REGION", SRC_TYPE_STRUCT}, + {"ACPI_CPEP_POLLING", SRC_TYPE_STRUCT}, + {"ACPI_DMAR_HEADER", SRC_TYPE_STRUCT}, + {"ACPI_DMAR_DEVICE_SCOPE", SRC_TYPE_STRUCT}, + {"ACPI_DMAR_HARDWARE_UNIT", SRC_TYPE_STRUCT}, + {"ACPI_DMAR_RESERVED_MEMORY", SRC_TYPE_STRUCT}, + {"ACPI_EINJ_ENTRY", SRC_TYPE_STRUCT}, + {"ACPI_ERST_ENTRY", SRC_TYPE_STRUCT}, + {"ACPI_HEST_AER_COMMON", SRC_TYPE_STRUCT}, + {"ACPI_HEST_HEADER", SRC_TYPE_STRUCT}, + {"ACPI_HEST_NOTIFY", SRC_TYPE_STRUCT}, + {"ACPI_IBFT_HEADER", SRC_TYPE_STRUCT}, + {"ACPI_IBFT_CONTROL", SRC_TYPE_STRUCT}, + {"ACPI_IBFT_INITIATOR", SRC_TYPE_STRUCT}, + {"ACPI_IBFT_NIC", SRC_TYPE_STRUCT}, + {"ACPI_IBFT_TARGET", SRC_TYPE_STRUCT}, + {"ACPI_MADT_ADDRESS_OVERRIDE", SRC_TYPE_STRUCT}, + {"ACPI_MADT_HEADER", SRC_TYPE_STRUCT}, + {"ACPI_MADT_IO_APIC", SRC_TYPE_STRUCT}, + {"ACPI_MADT_IO_SAPIC", SRC_TYPE_STRUCT}, + {"ACPI_MADT_LOCAL_APIC_NMI", SRC_TYPE_STRUCT}, + {"ACPI_MADT_LOCAL_SAPIC", SRC_TYPE_STRUCT}, + {"ACPI_MADT_NMI_SOURCE", SRC_TYPE_STRUCT}, + {"ACPI_MADT_PROCESSOR_APIC", SRC_TYPE_STRUCT}, + {"ACPI_MADT_XRUPT_OVERRIDE", SRC_TYPE_STRUCT}, + {"ACPI_MADT_XRUPT_SOURCE", SRC_TYPE_STRUCT}, + {"ACPI_MADT_LOCAL_X2APIC", SRC_TYPE_STRUCT}, + {"ACPI_MADT_LOCAL_X2APIC_NMI", SRC_TYPE_STRUCT}, + {"ACPI_MCFG_ALLOCATION", SRC_TYPE_STRUCT}, + {"ACPI_SRAT_CPU_AFFINITY", SRC_TYPE_STRUCT}, + {"ACPI_SRAT_HEADER", SRC_TYPE_STRUCT}, + {"ACPI_SRAT_MEM_AFFINITY", SRC_TYPE_STRUCT}, + {"ACPI_SRAT_X2APIC_CPU_AFFINITY", SRC_TYPE_STRUCT}, + {"ACPI_WDAT_ENTRY", SRC_TYPE_STRUCT}, + + + /* Legacy names, should be removed */ + + {"EC_BOOT_RESOURCES", SRC_TYPE_STRUCT}, + {"HPET_TABLE", SRC_TYPE_STRUCT}, + {"MADT_ADDRESS_OVERRIDE", SRC_TYPE_STRUCT}, + {"MADT_INTERRUPT_OVERRIDE", SRC_TYPE_STRUCT}, + {"MADT_INTERRUPT_SOURCE", SRC_TYPE_STRUCT}, + {"MADT_IO_APIC", SRC_TYPE_STRUCT}, + {"MADT_IO_SAPIC", SRC_TYPE_STRUCT}, + {"MADT_LOCAL_APIC_NMI", SRC_TYPE_STRUCT}, + {"MADT_LOCAL_SAPIC", SRC_TYPE_STRUCT}, + {"MADT_NMI_SOURCE", SRC_TYPE_STRUCT}, + {"MADT_PROCESSOR_APIC", SRC_TYPE_STRUCT}, + {"MEMORY_AFFINITY", SRC_TYPE_STRUCT}, + {"MULTIPLE_APIC_TABLE", SRC_TYPE_STRUCT}, + {"SMART_BATTERY_TABLE", SRC_TYPE_STRUCT}, + {"STATIC_RESOURCE_ALLOC", SRC_TYPE_STRUCT}, + {"SYSTEM_RESOURCE_AFFINITY", SRC_TYPE_STRUCT}, + {"SYSTEM_LOCALITY_INFO", SRC_TYPE_STRUCT}, + {"FACS_DESCRIPTOR", SRC_TYPE_STRUCT}, + {"FADT_DESCRIPTOR_REV1", SRC_TYPE_STRUCT}, + {"FADT_DESCRIPTOR", SRC_TYPE_STRUCT}, + {"FADT_DESCRIPTOR_REV2_MINUS", SRC_TYPE_STRUCT}, + {"RSDP_DESCRIPTOR", SRC_TYPE_STRUCT}, + {"RSDT_DESCRIPTOR", SRC_TYPE_STRUCT}, + {"XSDT_DESCRIPTOR", SRC_TYPE_STRUCT}, + {NULL, 0} +}; + + +ACPI_IDENTIFIER_TABLE LinuxAddStruct[] = { + {"acpi_namespace_node"}, + {"acpi_parse_object"}, + {"acpi_table_desc"}, + {"acpi_walk_state"}, + {NULL} +}; + + +ACPI_IDENTIFIER_TABLE LinuxEliminateMacros[] = { + + {"ACPI_GET_ADDRESS"}, + {"ACPI_VALID_ADDRESS"}, + {NULL} +}; + + +ACPI_IDENTIFIER_TABLE LinuxEliminateLines_C[] = { + + {"#define __"}, + {NULL} +}; + + +ACPI_IDENTIFIER_TABLE LinuxEliminateLines_H[] = { + + {NULL} +}; + + +ACPI_IDENTIFIER_TABLE LinuxConditionalIdentifiers[] = { + +/* {"ACPI_USE_STANDARD_HEADERS"}, */ + {"WIN32"}, + {"_MSC_VER"}, + {NULL} +}; + +ACPI_CONVERSION_TABLE LinuxConversionTable = { + + LinuxHeader, + FLG_NO_CARRIAGE_RETURNS | FLG_LOWERCASE_DIRNAMES, + + AcpiIdentifiers, + + /* C source files */ + + LinuxDataTypes, + LinuxEliminateLines_C, + NULL, + LinuxEliminateMacros, + AcpiIdentifiers, + (CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES | + CVT_CHECK_BRACES | CVT_TRIM_LINES | CVT_BRACES_ON_SAME_LINE | + CVT_MIXED_CASE_TO_UNDERSCORES | CVT_LOWER_CASE_IDENTIFIERS | + CVT_REMOVE_DEBUG_MACROS | CVT_TRIM_WHITESPACE | + CVT_REMOVE_EMPTY_BLOCKS | CVT_SPACES_TO_TABS8), + + /* C header files */ + + LinuxDataTypes, + LinuxEliminateLines_H, + LinuxConditionalIdentifiers, + NULL, + AcpiIdentifiers, + (CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES | + CVT_TRIM_LINES | CVT_MIXED_CASE_TO_UNDERSCORES | + CVT_LOWER_CASE_IDENTIFIERS | CVT_TRIM_WHITESPACE | + CVT_REMOVE_EMPTY_BLOCKS| CVT_REDUCE_TYPEDEFS | CVT_SPACES_TO_TABS8), +}; + + +/****************************************************************************** + * + * Code cleanup translation tables + * + ******************************************************************************/ + + +ACPI_CONVERSION_TABLE CleanupConversionTable = { + + NULL, + FLG_DEFAULT_FLAGS, + NULL, + /* C source files */ + + NULL, + NULL, + NULL, + NULL, + NULL, + (CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES | + CVT_CHECK_BRACES | CVT_TRIM_LINES | CVT_TRIM_WHITESPACE), + + /* C header files */ + + NULL, + NULL, + NULL, + NULL, + NULL, + (CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES | + CVT_TRIM_LINES | CVT_TRIM_WHITESPACE), +}; + + +ACPI_CONVERSION_TABLE StatsConversionTable = { + + NULL, + FLG_NO_FILE_OUTPUT, + NULL, + + /* C source files */ + + NULL, + NULL, + NULL, + NULL, + NULL, + (CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES | + CVT_COUNT_SHORTMULTILINE_COMMENTS), + + /* C header files */ + + NULL, + NULL, + NULL, + NULL, + NULL, + (CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES | + CVT_COUNT_SHORTMULTILINE_COMMENTS), +}; + + +/****************************************************************************** + * + * Customizable translation tables + * + ******************************************************************************/ + +ACPI_STRING_TABLE CustomReplacements[] = { + + + {"(c) 1999 - 2009", "(c) 1999 - 2009", REPLACE_WHOLE_WORD}, + +#if 0 + {"#include \"acpi.h\"", "#include \"acpi.h\"\n#include \"accommon.h\"", REPLACE_SUBSTRINGS}, + {"(c) 1999 - 2009", "(c) 1999 - 2009", REPLACE_WHOLE_WORD}, + {"AcpiTbSumTable", "AcpiTbSumTable", REPLACE_WHOLE_WORD}, + {"ACPI_SIG_BOOT", "ACPI_SIG_BOOT", REPLACE_WHOLE_WORD}, + {"ACPI_SIG_DBGP", "ACPI_SIG_DBGP", REPLACE_WHOLE_WORD}, + {"ACPI_SIG_DSDT", "ACPI_SIG_DSDT", REPLACE_WHOLE_WORD}, + {"ACPI_SIG_ECDT", "ACPI_SIG_ECDT", REPLACE_WHOLE_WORD}, + {"ACPI_SIG_FACS", "ACPI_SIG_FACS", REPLACE_WHOLE_WORD}, + {"ACPI_SIG_FADT", "ACPI_SIG_FADT", REPLACE_WHOLE_WORD}, + {"ACPI_SIG_HPET", "ACPI_SIG_HPET", REPLACE_WHOLE_WORD}, + {"ACPI_SIG_MADT", "ACPI_SIG_MADT", REPLACE_WHOLE_WORD}, + {"ACPI_SIG_MCFG", "ACPI_SIG_MCFG", REPLACE_WHOLE_WORD}, + {"ACPI_SIG_PSDT", "ACPI_SIG_PSDT", REPLACE_WHOLE_WORD}, + {"ACPI_NAME_RSDP", "ACPI_NAME_RSDP", REPLACE_WHOLE_WORD}, + {"ACPI_SIG_RSDP", "ACPI_SIG_RSDP", REPLACE_WHOLE_WORD}, + {"ACPI_SIG_RSDT", "ACPI_SIG_RSDT", REPLACE_WHOLE_WORD}, + {"ACPI_SIG_SBST", "ACPI_SIG_SBST", REPLACE_WHOLE_WORD}, + {"ACPI_SIG_SLIT", "ACPI_SIG_SLIT", REPLACE_WHOLE_WORD}, + {"ACPI_SIG_SPCR", "ACPI_SIG_SPCR", REPLACE_WHOLE_WORD}, + {"ACPI_SIG_SPIC", "ACPI_SIG_SPIC", REPLACE_WHOLE_WORD}, + {"ACPI_SIG_SPMI", "ACPI_SIG_SPMI", REPLACE_WHOLE_WORD}, + {"ACPI_SIG_SRAT", "ACPI_SIG_SRAT", REPLACE_WHOLE_WORD}, + {"ACPI_SIG_SSDT", "ACPI_SIG_SSDT", REPLACE_WHOLE_WORD}, + {"ACPI_SIG_TCPA", "ACPI_SIG_TCPA", REPLACE_WHOLE_WORD}, + {"ACPI_SIG_WDRT", "ACPI_SIG_WDRT", REPLACE_WHOLE_WORD}, + {"ACPI_SIG_XSDT", "ACPI_SIG_XSDT", REPLACE_WHOLE_WORD}, + + {"ACPI_ALLOCATE_ZEROED", "ACPI_ALLOCATE_ZEROED", REPLACE_WHOLE_WORD}, + {"ACPI_ALLOCATE", "ACPI_ALLOCATE", REPLACE_WHOLE_WORD}, + {"ACPI_FREE", "ACPI_FREE", REPLACE_WHOLE_WORD}, + + "ACPI_NATIVE_UINT", "ACPI_NATIVE_UINT", REPLACE_WHOLE_WORD, + "ACPI_NATIVE_UINT *", "ACPI_NATIVE_UINT *", REPLACE_WHOLE_WORD, + "ACPI_NATIVE_UINT", "ACPI_NATIVE_UINT", REPLACE_WHOLE_WORD, + "ACPI_NATIVE_INT", "ACPI_NATIVE_INT", REPLACE_WHOLE_WORD, + "ACPI_NATIVE_INT *", "ACPI_NATIVE_INT *", REPLACE_WHOLE_WORD, + "ACPI_NATIVE_INT", "ACPI_NATIVE_INT", REPLACE_WHOLE_WORD, +#endif + + {NULL, NULL, 0} +}; + + +ACPI_CONVERSION_TABLE CustomConversionTable = { + + NULL, + FLG_DEFAULT_FLAGS, + NULL, + + /* C source files */ + + CustomReplacements, + LinuxEliminateLines_H, + NULL, + NULL, + NULL, + (CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES | + CVT_TRIM_LINES | CVT_TRIM_WHITESPACE), + + /* C header files */ + + CustomReplacements, + LinuxEliminateLines_H, + NULL, + NULL, + NULL, + (CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES | + CVT_TRIM_LINES | CVT_TRIM_WHITESPACE), +}; + diff --git a/sys/contrib/dev/acpica/tools/acpisrc/asutils.c b/sys/contrib/dev/acpica/tools/acpisrc/asutils.c new file mode 100644 index 000000000000..7b59178a5a1d --- /dev/null +++ b/sys/contrib/dev/acpica/tools/acpisrc/asutils.c @@ -0,0 +1,306 @@ + +/****************************************************************************** + * + * Module Name: asutils - common utilities + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2009, 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 "acpisrc.h" + + +/****************************************************************************** + * + * FUNCTION: AsSkipUntilChar + * + * DESCRIPTION: Find the next instance of the input character + * + ******************************************************************************/ + +char * +AsSkipUntilChar ( + char *Buffer, + char Target) +{ + + while (*Buffer != Target) + { + if (!*Buffer) + { + return NULL; + } + + Buffer++; + } + + return (Buffer); +} + + +/****************************************************************************** + * + * FUNCTION: AsSkipPastChar + * + * DESCRIPTION: Find the next instance of the input character, return a buffer + * pointer to this character+1. + * + ******************************************************************************/ + +char * +AsSkipPastChar ( + char *Buffer, + char Target) +{ + + while (*Buffer != Target) + { + if (!*Buffer) + { + return NULL; + } + + Buffer++; + } + + Buffer++; + + return (Buffer); +} + + +/****************************************************************************** + * + * FUNCTION: AsReplaceData + * + * DESCRIPTION: This function inserts and removes data from the file buffer. + * if more data is inserted than is removed, the data in the buffer + * is moved to make room. If less data is inserted than is removed, + * the remaining data is moved to close the hole. + * + ******************************************************************************/ + +char * +AsReplaceData ( + char *Buffer, + UINT32 LengthToRemove, + char *BufferToAdd, + UINT32 LengthToAdd) +{ + UINT32 BufferLength; + + + /* + * Buffer is a string, so the length must include the terminating zero + */ + BufferLength = strlen (Buffer) + 1; + + if (LengthToRemove != LengthToAdd) + { + /* + * Move some of the existing data + * 1) If adding more bytes than removing, make room for the new data + * 2) if removing more bytes than adding, delete the extra space + */ + if (LengthToRemove > 0) + { + Gbl_MadeChanges = TRUE; + memmove ((Buffer + LengthToAdd), (Buffer + LengthToRemove), (BufferLength - LengthToRemove)); + } + } + + /* + * Now we can move in the new data + */ + if (LengthToAdd > 0) + { + Gbl_MadeChanges = TRUE; + memmove (Buffer, BufferToAdd, LengthToAdd); + } + + return (Buffer + LengthToAdd); +} + + +/****************************************************************************** + * + * FUNCTION: AsInsertData + * + * DESCRIPTION: This function inserts and removes data from the file buffer. + * if more data is inserted than is removed, the data in the buffer + * is moved to make room. If less data is inserted than is removed, + * the remaining data is moved to close the hole. + * + ******************************************************************************/ + +char * +AsInsertData ( + char *Buffer, + char *BufferToAdd, + UINT32 LengthToAdd) +{ + UINT32 BufferLength; + + + if (LengthToAdd > 0) + { + /* + * Buffer is a string, so the length must include the terminating zero + */ + BufferLength = strlen (Buffer) + 1; + + /* + * Move some of the existing data + * 1) If adding more bytes than removing, make room for the new data + * 2) if removing more bytes than adding, delete the extra space + */ + Gbl_MadeChanges = TRUE; + memmove ((Buffer + LengthToAdd), Buffer, BufferLength); + + /* + * Now we can move in the new data + */ + memmove (Buffer, BufferToAdd, LengthToAdd); + } + + return (Buffer + LengthToAdd); +} + + +/****************************************************************************** + * + * FUNCTION: AsRemoveData + * + * DESCRIPTION: This function inserts and removes data from the file buffer. + * if more data is inserted than is removed, the data in the buffer + * is moved to make room. If less data is inserted than is removed, + * the remaining data is moved to close the hole. + * + ******************************************************************************/ + +char * +AsRemoveData ( + char *StartPointer, + char *EndPointer) +{ + UINT32 BufferLength; + + + /* + * Buffer is a string, so the length must include the terminating zero + */ + BufferLength = strlen (EndPointer) + 1; + + Gbl_MadeChanges = TRUE; + memmove (StartPointer, EndPointer, BufferLength); + + return (StartPointer); +} + diff --git a/sys/contrib/dev/acpica/tools/acpisrc/osunixdir.c b/sys/contrib/dev/acpica/tools/acpisrc/osunixdir.c new file mode 100644 index 000000000000..d9c55a1ef84a --- /dev/null +++ b/sys/contrib/dev/acpica/tools/acpisrc/osunixdir.c @@ -0,0 +1,306 @@ + +/****************************************************************************** + * + * Module Name: osunixdir - Unix directory access interfaces + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2009, 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 <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <dirent.h> +#include <fnmatch.h> +#include <ctype.h> +#include <sys/stat.h> + +#include "acpisrc.h" + +typedef struct ExternalFindInfo +{ + char *DirPathname; + DIR *DirPtr; + char temp_buffer[128]; + char *WildcardSpec; + char RequestedFileType; + +} EXTERNAL_FIND_INFO; + + +/******************************************************************************* + * + * FUNCTION: AcpiOsOpenDirectory + * + * PARAMETERS: DirPathname - Full pathname to the directory + * WildcardSpec - string of the form "*.c", etc. + * + * RETURN: A directory "handle" to be used in subsequent search operations. + * NULL returned on failure. + * + * DESCRIPTION: Open a directory in preparation for a wildcard search + * + ******************************************************************************/ + +void * +AcpiOsOpenDirectory ( + char *DirPathname, + char *WildcardSpec, + char RequestedFileType) +{ + EXTERNAL_FIND_INFO *ExternalInfo; + DIR *dir; + + + /* Allocate the info struct that will be returned to the caller */ + + ExternalInfo = calloc (sizeof (EXTERNAL_FIND_INFO), 1); + if (!ExternalInfo) + { + return (NULL); + } + + /* Get the directory stream */ + + dir = opendir (DirPathname); + if (!dir) + { + free (ExternalInfo); + return (NULL); + } + + /* Save the info in the return structure */ + + ExternalInfo->WildcardSpec = WildcardSpec; + ExternalInfo->RequestedFileType = RequestedFileType; + ExternalInfo->DirPathname = DirPathname; + ExternalInfo->DirPtr = dir; + return (ExternalInfo); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiOsGetNextFilename + * + * PARAMETERS: DirHandle - Created via AcpiOsOpenDirectory + * + * RETURN: Next filename matched. NULL if no more matches. + * + * DESCRIPTION: Get the next file in the directory that matches the wildcard + * specification. + * + ******************************************************************************/ + +char * +AcpiOsGetNextFilename ( + void *DirHandle) +{ + EXTERNAL_FIND_INFO *ExternalInfo = DirHandle; + struct dirent *dir_entry; + char *temp_str; + int str_len; + struct stat temp_stat; + int err; + + + while ((dir_entry = readdir (ExternalInfo->DirPtr))) + { + if (!fnmatch (ExternalInfo->WildcardSpec, dir_entry->d_name, 0)) + { + if (dir_entry->d_name[0] == '.') + continue; + + str_len = strlen (dir_entry->d_name) + + strlen (ExternalInfo->DirPathname) + 2; + + temp_str = calloc (str_len, 1); + if (!temp_str) + { + printf ("Could not allocate buffer for temporary string\n"); + return NULL; + } + + strcpy (temp_str, ExternalInfo->DirPathname); + strcat (temp_str, "/"); + strcat (temp_str, dir_entry->d_name); + + err = stat (temp_str, &temp_stat); + free (temp_str); + if (err == -1) + { + printf ("stat() error - should not happen\n"); + return NULL; + } + + if ((S_ISDIR (temp_stat.st_mode) + && (ExternalInfo->RequestedFileType == REQUEST_DIR_ONLY)) + || + ((!S_ISDIR (temp_stat.st_mode) + && ExternalInfo->RequestedFileType == REQUEST_FILE_ONLY))) + { + /* copy to a temp buffer because dir_entry struct is on the stack */ + + strcpy (ExternalInfo->temp_buffer, dir_entry->d_name); + return (ExternalInfo->temp_buffer); + } + } + } + + return NULL; +} + + +/******************************************************************************* + * + * FUNCTION: AcpiOsCloseDirectory + * + * PARAMETERS: DirHandle - Created via AcpiOsOpenDirectory + * + * RETURN: None. + * + * DESCRIPTION: Close the open directory and cleanup. + * + ******************************************************************************/ + +void +AcpiOsCloseDirectory ( + void *DirHandle) +{ + EXTERNAL_FIND_INFO *ExternalInfo = DirHandle; + + + /* Close the directory and free allocations */ + + closedir (ExternalInfo->DirPtr); + free (DirHandle); +} + +/* Other functions acpisrc uses but that aren't standard on Unix */ + +/* lowercase a string */ +char* +strlwr ( + char *str) +{ + int length; + int i; + + + length = strlen(str); + + for (i = 0; i < length; i++) + { + str[i] = tolower(str[i]); + } + + return (str); +} diff --git a/sys/contrib/dev/acpica/tools/acpixtract/Makefile b/sys/contrib/dev/acpica/tools/acpixtract/Makefile new file mode 100644 index 000000000000..be7a73585350 --- /dev/null +++ b/sys/contrib/dev/acpica/tools/acpixtract/Makefile @@ -0,0 +1,16 @@ + + +PROG= acpixtract +SRCS= acpixtract.c + +CFLAGS+= -Wall -O2 -D_LINUX -DACPI_APPLICATION -Wstrict-prototypes -I../../include + + +acpixtract : $(patsubst %.c,%.o, $(SRCS)) + $(CC) $(LDFLAGS) $(patsubst %.c,%.o, $(SRCS)) -o $(PROG) + +CLEANFILES= $(PROG) + +clean : + rm -f $(CLEANFILES) $(patsubst %.c,%.o, $(SRCS)) + diff --git a/sys/contrib/dev/acpica/tools/acpixtract/acpixtract.c b/sys/contrib/dev/acpica/tools/acpixtract/acpixtract.c new file mode 100644 index 000000000000..324db12c92fa --- /dev/null +++ b/sys/contrib/dev/acpica/tools/acpixtract/acpixtract.c @@ -0,0 +1,788 @@ + +/****************************************************************************** + * + * Module Name: acpixtract - convert ascii ACPI tables to binary + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2009, 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 <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> + +#define VERSION 0x20060324 + +#define FIND_HEADER 0 +#define EXTRACT_DATA 1 +#define BUFFER_SIZE 256 + +char Filename[16]; +unsigned char Data[16]; + +/* Local prototypes */ + +void +CheckAscii ( + unsigned char *Name, + int Count); + +void +NormalizeSignature ( + char *Signature); + +unsigned int +GetNextInstance ( + char *InputPathname, + char *Signature); + +int +ExtractTables ( + char *InputPathname, + char *Signature, + unsigned int MinimumInstances); + +size_t +GetTableHeader ( + FILE *InputFile, + unsigned char *OutputData); + +unsigned int +CountTableInstances ( + char *InputPathname, + char *Signature); + +int +ListTables ( + char *InputPathname); + +size_t +ConvertLine ( + char *InputLine, + unsigned char *OutputData); + +void +DisplayUsage ( + void); + + +struct TableInfo +{ + unsigned int Signature; + unsigned int Instances; + unsigned int NextInstance; + struct TableInfo *Next; +}; + +struct TableInfo *ListHead = NULL; + + +/****************************************************************************** + * + * FUNCTION: DisplayUsage + * + * DESCRIPTION: Usage message + * + ******************************************************************************/ + +void +DisplayUsage ( + void) +{ + + printf ("Usage: acpixtract [option] <InputFile>\n"); + printf ("\nExtract binary ACPI tables from text acpidump output\n"); + printf ("Default invocation extracts all DSDTs and SSDTs\n"); + printf ("Version %8.8X\n\n", VERSION); + printf ("Options:\n"); + printf (" -a Extract all tables, not just DSDT/SSDT\n"); + printf (" -l List table summaries, do not extract\n"); + printf (" -s<Signature> Extract all tables named <Signature>\n"); + printf ("\n"); +} + + +/******************************************************************************* + * + * FUNCTION: CheckAscii + * + * PARAMETERS: Name - Ascii string, at least as long as Count + * Count - Number of characters to check + * + * RETURN: None + * + * DESCRIPTION: Ensure that the requested number of characters are printable + * Ascii characters. Sets non-printable and null chars to <space>. + * + ******************************************************************************/ + +void +CheckAscii ( + unsigned char *Name, + int Count) +{ + int i; + + + for (i = 0; i < Count; i++) + { + if (!Name[i] || !isprint (Name[i])) + { + Name[i] = ' '; + } + } +} + + +/******************************************************************************* + * + * FUNCTION: NormalizeSignature + * + * PARAMETERS: Name - Ascii string + * + * RETURN: None + * + * DESCRIPTION: Change "RSD PTR" to "RSDP" + * + ******************************************************************************/ + +void +NormalizeSignature ( + char *Signature) +{ + + if (!strncmp (Signature, "RSD ", 4)) + { + Signature[3] = 'P'; + } +} + + +/****************************************************************************** + * + * FUNCTION: ConvertLine + * + * DESCRIPTION: Convert one line of ascii text binary (up to 16 bytes) + * + ******************************************************************************/ + +size_t +ConvertLine ( + char *InputLine, + unsigned char *OutputData) +{ + char *End; + int BytesConverted; + int Converted[16]; + int i; + + + /* Terminate the input line at the end of the actual data (for sscanf) */ + + End = strstr (InputLine + 2, " "); + if (!End) + { + return 0; /* Don't understand the format */ + } + *End = 0; + + /* + * Convert one line of table data, of the form: + * <offset>: <up to 16 bytes of hex data> <ASCII representation> <newline> + * + * Example: + * 02C0: 5F 53 42 5F 4C 4E 4B 44 00 12 13 04 0C FF FF 08 _SB_LNKD........ + */ + BytesConverted = sscanf (InputLine, + "%*s %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x", + &Converted[0], &Converted[1], &Converted[2], &Converted[3], + &Converted[4], &Converted[5], &Converted[6], &Converted[7], + &Converted[8], &Converted[9], &Converted[10], &Converted[11], + &Converted[12], &Converted[13], &Converted[14], &Converted[15]); + + /* Pack converted data into a byte array */ + + for (i = 0; i < BytesConverted; i++) + { + OutputData[i] = (unsigned char) Converted[i]; + } + + return ((size_t) BytesConverted); +} + + +/****************************************************************************** + * + * FUNCTION: GetTableHeader + * + * DESCRIPTION: Extract and convert a table heaader + * + ******************************************************************************/ + +size_t +GetTableHeader ( + FILE *InputFile, + unsigned char *OutputData) +{ + size_t BytesConverted; + size_t TotalConverted = 0; + char Buffer[BUFFER_SIZE]; + int i; + + + /* Get the full 36 byte header, requires 3 lines */ + + for (i = 0; i < 3; i++) + { + if (!fgets (Buffer, BUFFER_SIZE, InputFile)) + { + return TotalConverted; + } + + BytesConverted = ConvertLine (Buffer, OutputData); + TotalConverted += BytesConverted; + OutputData += 16; + + if (BytesConverted != 16) + { + return TotalConverted; + } + } + + return TotalConverted; +} + + +/****************************************************************************** + * + * FUNCTION: CountTableInstances + * + * DESCRIPTION: Count the instances of table <Signature> within the input file + * + ******************************************************************************/ + +unsigned int +CountTableInstances ( + char *InputPathname, + char *Signature) +{ + char Buffer[BUFFER_SIZE]; + FILE *InputFile; + unsigned int Instances = 0; + + + InputFile = fopen (InputPathname, "rt"); + if (!InputFile) + { + printf ("Could not open %s\n", InputPathname); + return 0; + } + + /* Count the number of instances of this signature */ + + while (fgets (Buffer, BUFFER_SIZE, InputFile)) + { + /* Ignore empty lines and lines that start with a space */ + + if ((Buffer[0] == ' ') || + (Buffer[0] == '\n')) + { + continue; + } + + NormalizeSignature (Buffer); + if (!strncmp (Buffer, Signature, 4)) + { + Instances++; + } + } + + fclose (InputFile); + return Instances; +} + + +/****************************************************************************** + * + * FUNCTION: GetNextInstance + * + * DESCRIPTION: + * + ******************************************************************************/ + +unsigned int +GetNextInstance ( + char *InputPathname, + char *Signature) +{ + struct TableInfo *Info; + + + Info = ListHead; + while (Info) + { + if (*(unsigned int *) Signature == Info->Signature) + { + break; + } + + Info = Info->Next; + } + + if (!Info) + { + Info = malloc (sizeof (struct TableInfo)); + + Info->Signature = *(unsigned int *) Signature; + Info->Instances = CountTableInstances (InputPathname, Signature); + Info->NextInstance = 1; + + Info->Next = ListHead; + ListHead = Info; + } + + if (Info->Instances > 1) + { + return (Info->NextInstance++); + } + + return (0); +} + + +/****************************************************************************** + * + * FUNCTION: ExtractTables + * + * DESCRIPTION: Convert text ACPI tables to binary + * + ******************************************************************************/ + +int +ExtractTables ( + char *InputPathname, + char *Signature, + unsigned int MinimumInstances) +{ + char Buffer[BUFFER_SIZE]; + FILE *InputFile; + FILE *OutputFile = NULL; + size_t BytesWritten; + size_t TotalBytesWritten = 0; + size_t BytesConverted; + unsigned int State = FIND_HEADER; + unsigned int FoundTable = 0; + unsigned int Instances = 0; + unsigned int ThisInstance; + char ThisSignature[4]; + + + /* Open input in text mode, output is in binary mode */ + + InputFile = fopen (InputPathname, "rt"); + if (!InputFile) + { + printf ("Could not open %s\n", InputPathname); + return -1; + } + + if (Signature) + { + /* Are there enough instances of the table to continue? */ + + NormalizeSignature (Signature); + + Instances = CountTableInstances (InputPathname, Signature); + if (Instances < MinimumInstances) + { + printf ("Table %s was not found in %s\n", Signature, InputPathname); + return -1; + } + + if (Instances == 0) + { + return 0; + } + } + + /* Convert all instances of the table to binary */ + + while (fgets (Buffer, BUFFER_SIZE, InputFile)) + { + switch (State) + { + case FIND_HEADER: + + /* Ignore empty lines and lines that start with a space */ + + if ((Buffer[0] == ' ') || + (Buffer[0] == '\n')) + { + continue; + } + + NormalizeSignature (Buffer); + strncpy (ThisSignature, Buffer, 4); + + if (Signature) + { + /* Ignore signatures that don't match */ + + if (strncmp (ThisSignature, Signature, 4)) + { + continue; + } + } + + /* Get the instance # for this signature */ + + ThisInstance = GetNextInstance (InputPathname, ThisSignature); + + /* Build an output filename and create/open the output file */ + + if (ThisInstance > 0) + { + sprintf (Filename, "%4.4s%u.dat", ThisSignature, ThisInstance); + } + else + { + sprintf (Filename, "%4.4s.dat", ThisSignature); + } + + OutputFile = fopen (Filename, "w+b"); + if (!OutputFile) + { + printf ("Could not open %s\n", Filename); + return -1; + } + + State = EXTRACT_DATA; + TotalBytesWritten = 0; + FoundTable = 1; + continue; + + case EXTRACT_DATA: + + /* Empty line or non-data line terminates the data */ + + if ((Buffer[0] == '\n') || + (Buffer[0] != ' ')) + { + fclose (OutputFile); + OutputFile = NULL; + State = FIND_HEADER; + + printf ("Acpi table [%4.4s] - % 6d bytes written to %s\n", + ThisSignature, TotalBytesWritten, Filename); + continue; + } + + /* Convert the ascii data (one line of text) to binary */ + + BytesConverted = ConvertLine (Buffer, Data); + + /* Write the binary data */ + + BytesWritten = fwrite (Data, 1, BytesConverted, OutputFile); + if (BytesWritten != BytesConverted) + { + printf ("Write error on %s\n", Filename); + fclose (OutputFile); + return -1; + } + + TotalBytesWritten += BytesConverted; + continue; + + default: + return -1; + } + } + + if (!FoundTable) + { + printf ("Table %s was not found in %s\n", Signature, InputPathname); + } + + if (OutputFile) + { + fclose (OutputFile); + if (State == EXTRACT_DATA) + { + /* Received an EOF while extracting data */ + + printf ("Acpi table [%4.4s] - % 6d bytes written to %s\n", + ThisSignature, TotalBytesWritten, Filename); + } + } + + fclose (InputFile); + return 0; +} + + +/****************************************************************************** + * + * FUNCTION: ListTables + * + * DESCRIPTION: Display info for all ACPI tables found in input + * + ******************************************************************************/ + +int +ListTables ( + char *InputPathname) +{ + FILE *InputFile; + char Buffer[BUFFER_SIZE]; + size_t HeaderSize; + unsigned char Header[48]; + int TableCount = 0; + + + /* Open input in text mode, output is in binary mode */ + + InputFile = fopen (InputPathname, "rt"); + if (!InputFile) + { + printf ("Could not open %s\n", InputPathname); + return -1; + } + + printf ("\nSignature Length OemId OemTableId OemRevision CompilerId CompilerRevision\n\n"); + + while (fgets (Buffer, BUFFER_SIZE, InputFile)) + { + /* Ignore empty lines and lines that start with a space */ + + if ((Buffer[0] == ' ') || + (Buffer[0] == '\n')) + { + continue; + } + + /* Get the 36 byte header and display the fields */ + + HeaderSize = GetTableHeader (InputFile, Header); + if (HeaderSize < 16) + { + continue; + } + + /* RSDP has an oddball signature and header */ + + if (!strncmp ((char *) Header, "RSD PTR ", 8)) + { + CheckAscii (&Header[9], 6); + printf ("%8.4s \"%6.6s\"\n", "RSDP", &Header[9]); + TableCount++; + continue; + } + + /* Minimum size */ + + if (HeaderSize < 36) + { + continue; + } + + /* Signature and Table length */ + + TableCount++; + printf ("%8.4s % 7d", Header, *(int *) &Header[4]); + + /* FACS has only signature and length */ + + if (!strncmp ((char *) Header, "FACS", 4)) + { + printf ("\n"); + continue; + } + + /* OEM IDs and Compiler IDs */ + + CheckAscii (&Header[10], 6); + CheckAscii (&Header[16], 8); + CheckAscii (&Header[28], 4); + + printf (" \"%6.6s\" \"%8.8s\" %8.8X \"%4.4s\" %8.8X\n", + &Header[10], &Header[16], *(int *) &Header[24], + &Header[28], *(int *) &Header[32]); + } + + printf ("\nFound %d ACPI tables [%8.8X]\n", TableCount, VERSION); + fclose (InputFile); + return 0; +} + + +/****************************************************************************** + * + * FUNCTION: main + * + * DESCRIPTION: C main function + * + ******************************************************************************/ + +int +main ( + int argc, + char *argv[]) +{ + int Status; + + + if (argc < 2) + { + DisplayUsage (); + return 0; + } + + if (argv[1][0] == '-') + { + if (argc < 3) + { + DisplayUsage (); + return 0; + } + + switch (argv[1][1]) + { + case 'a': + return (ExtractTables (argv[2], NULL, 0)); + + case 'l': + return (ListTables (argv[2])); + + case 's': + return (ExtractTables (argv[2], &argv[1][2], 1)); + + default: + DisplayUsage (); + return 0; + } + } + + /* + * Default output is the DSDT and all SSDTs. One DSDT is required, + * any SSDTs are optional. + */ + Status = ExtractTables (argv[1], "DSDT", 1); + if (Status) + { + return Status; + } + + Status = ExtractTables (argv[1], "SSDT", 0); + return (Status); +} + + diff --git a/sys/contrib/dev/acpica/tools/examples/examples.c b/sys/contrib/dev/acpica/tools/examples/examples.c new file mode 100644 index 000000000000..e2dfacd20d02 --- /dev/null +++ b/sys/contrib/dev/acpica/tools/examples/examples.c @@ -0,0 +1,506 @@ +/****************************************************************************** + * + * Module Name: examples - Example ACPICA code + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2009, 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. + * + *****************************************************************************/ + + +/* Set the ACPICA application type for use in include/platform/acenv.h */ + +#ifndef WIN32 +#define WIN32 +#endif + +#define ACPI_DEBUG_OUTPUT + +/* ACPICA public headers */ + +#include "acpi.h" + +#define _COMPONENT ACPI_EXAMPLE + ACPI_MODULE_NAME ("examples") + + +/****************************************************************************** + * + * ACPICA Example Code + * + * This module contains examples of how the host OS should interface to the + * ACPICA subsystem. + * + * 1) How to use the platform/acenv.h file and how to set configuration + * options. + * + * 2) main - using the debug output mechanism and the error/warning output + * macros. + * + * 3) Two examples of the ACPICA initialization sequence. The first is a + * initialization with no "early" ACPI table access. The second shows + * how to use ACPICA to obtain the tables very early during kernel + * initialization, even before dynamic memory is available. + * + * 4) How to invoke a control method, including argument setup and how to + * access the return value. + * + *****************************************************************************/ + +/* Standard Clib headers */ + +#include <stdio.h> +#include <string.h> + +/* Local Prototypes */ + +ACPI_STATUS +InitializeFullAcpi (void); + +ACPI_STATUS +InstallHandlers (void); + +void +ExecuteOSI (void); + + +/****************************************************************************** + * + * FUNCTION: main + * + * PARAMETERS: argc, argv + * + * RETURN: Status + * + * DESCRIPTION: Main routine. Shows the use of the various output macros, as + * well as the use of the debug layer/level globals. + * + *****************************************************************************/ + +int ACPI_SYSTEM_XFACE +main ( + int argc, + char **argv) +{ + ACPI_FUNCTION_NAME (Examples-main); + + + InitializeFullAcpi (); + + /* Enable debug output, example debug print */ + + AcpiDbgLayer = ACPI_EXAMPLE; + AcpiDbgLevel = ACPI_LV_INIT; + ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "Example Debug output\n")); + + /* Example warning and error output */ + + ACPI_INFO ((AE_INFO, "ACPICA example info message")); + ACPI_WARNING ((AE_INFO, "ACPICA example warning message")); + ACPI_ERROR ((AE_INFO, "ACPICA example error message")); + ACPI_EXCEPTION ((AE_INFO, AE_AML_OPERAND_TYPE, "Example exception message")); + + ExecuteOSI (); + return (0); +} + + +/****************************************************************************** + * + * Example ACPICA initialization code. This shows a full initialization with + * no early ACPI table access. + * + *****************************************************************************/ + +ACPI_STATUS +InitializeFullAcpi (void) +{ + ACPI_STATUS Status; + + + /* Initialize the ACPICA subsystem */ + + Status = AcpiInitializeSubsystem (); + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, Status, "While initializing ACPICA")); + return (Status); + } + + /* Initialize the ACPICA Table Manager and get all ACPI tables */ + + Status = AcpiInitializeTables (NULL, 16, FALSE); + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, Status, "While initializing Table Manager")); + return (Status); + } + + /* Create the ACPI namespace from ACPI tables */ + + Status = AcpiLoadTables (); + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, Status, "While loading ACPI tables")); + return (Status); + } + + /* Install local handlers */ + + Status = InstallHandlers (); + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, Status, "While installing handlers")); + return (Status); + } + + /* Initialize the ACPI hardware */ + + Status = AcpiEnableSubsystem (ACPI_FULL_INITIALIZATION); + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, Status, "While enabling ACPICA")); + return (Status); + } + + /* Complete the ACPI namespace object initialization */ + + Status = AcpiInitializeObjects (ACPI_FULL_INITIALIZATION); + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, Status, "While initializing ACPICA objects")); + return (Status); + } + + return (AE_OK); +} + + +/****************************************************************************** + * + * Example ACPICA initialization code with early ACPI table access. This shows + * an initialization that requires early access to ACPI tables (before + * kernel dynamic memory is available) + * + *****************************************************************************/ + +/* + * The purpose of this static table array is to avoid the use of kernel + * dynamic memory which may not be available during early ACPI table + * access. + */ +#define ACPI_MAX_INIT_TABLES 16 +static ACPI_TABLE_DESC TableArray[ACPI_MAX_INIT_TABLES]; + + +/* + * This function would be called early in kernel initialization. After this + * is called, all ACPI tables are available to the host. + */ +ACPI_STATUS +InitializeAcpiTables (void) +{ + ACPI_STATUS Status; + + + /* Initialize the ACPICA Table Manager and get all ACPI tables */ + + Status = AcpiInitializeTables (TableArray, ACPI_MAX_INIT_TABLES, TRUE); + return (Status); +} + + +/* + * This function would be called after the kernel is initialized and + * dynamic/virtual memory is available. It completes the initialization of + * the ACPICA subsystem. + */ +ACPI_STATUS +InitializeAcpi (void) +{ + ACPI_STATUS Status; + + + /* Initialize the ACPICA subsystem */ + + Status = AcpiInitializeSubsystem (); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* Copy the root table list to dynamic memory */ + + Status = AcpiReallocateRootTable (); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* Create the ACPI namespace from ACPI tables */ + + Status = AcpiLoadTables (); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* Install local handlers */ + + Status = InstallHandlers (); + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, Status, "While installing handlers")); + return (Status); + } + + /* Initialize the ACPI hardware */ + + Status = AcpiEnableSubsystem (ACPI_FULL_INITIALIZATION); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* Complete the ACPI namespace object initialization */ + + Status = AcpiInitializeObjects (ACPI_FULL_INITIALIZATION); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + return (AE_OK); +} + + +/****************************************************************************** + * + * Example ACPICA handler and handler installation + * + *****************************************************************************/ + +void +NotifyHandler ( + ACPI_HANDLE Device, + UINT32 Value, + void *Context) +{ + + ACPI_INFO ((AE_INFO, "Received a notify %X", Value)); +} + + +ACPI_STATUS +InstallHandlers (void) +{ + ACPI_STATUS Status; + + + /* Install global notify handler */ + + Status = AcpiInstallNotifyHandler (ACPI_ROOT_OBJECT, ACPI_SYSTEM_NOTIFY, + NotifyHandler, NULL); + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, Status, "While installing Notify handler")); + return (Status); + } + + return (AE_OK); +} + + +/****************************************************************************** + * + * Example control method execution. + * + * _OSI is a predefined method that is implemented internally within ACPICA. + * + * Shows the following elements: + * + * 1) How to setup a control method argument and argument list + * 2) How to setup the return value object + * 3) How to invoke AcpiEvaluateObject + * 4) How to check the returned ACPI_STATUS + * 5) How to analyze the return value + * + *****************************************************************************/ + +void +ExecuteOSI (void) +{ + ACPI_STATUS Status; + ACPI_OBJECT_LIST ArgList; + ACPI_OBJECT Arg[1]; + ACPI_BUFFER ReturnValue; + ACPI_OBJECT *Object; + + + ACPI_INFO ((AE_INFO, "Executing OSI method")); + + /* Setup input argument */ + + ArgList.Count = 1; + ArgList.Pointer = Arg; + + Arg[0].Type = ACPI_TYPE_STRING; + Arg[0].String.Pointer = "Windows 2001"; + Arg[0].String.Length = strlen (Arg[0].String.Pointer); + + /* Ask ACPICA to allocate space for the return object */ + + ReturnValue.Length = ACPI_ALLOCATE_BUFFER; + + Status = AcpiEvaluateObject (NULL, "\\_OSI", &ArgList, &ReturnValue); + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, Status, "While executing _OSI")); + return; + } + + /* Ensure that the return object is large enough */ + + if (ReturnValue.Length < sizeof (ACPI_OBJECT)) + { + AcpiOsPrintf ("Return value from _OSI method too small, %.8X\n", + ReturnValue.Length); + return; + } + + /* Expect an integer return value from execution of _OSI */ + + Object = ReturnValue.Pointer; + if (Object->Type != ACPI_TYPE_INTEGER) + { + AcpiOsPrintf ("Invalid return type from _OSI, %.2X\n", Object->Type); + } + + ACPI_INFO ((AE_INFO, "_OSI returned %.8X", (UINT32) Object->Integer.Value)); + AcpiOsFree (Object); + return; +} + + +/****************************************************************************** + * + * OSL support (only needed to link to the windows OSL) + * + *****************************************************************************/ + +FILE *AcpiGbl_DebugFile; + +ACPI_PHYSICAL_ADDRESS +AeLocalGetRootPointer ( + void) +{ + + return (0); +} + diff --git a/sys/contrib/dev/acpica/utalloc.c b/sys/contrib/dev/acpica/utilities/utalloc.c index d1528e330411..a66b94005c1f 100644 --- a/sys/contrib/dev/acpica/utalloc.c +++ b/sys/contrib/dev/acpica/utilities/utalloc.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: utalloc - local memory allocation routines - * $Revision: 1.164 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,8 +115,9 @@ #define __UTALLOC_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acdebug.h> +#include "acpi.h" +#include "accommon.h" +#include "acdebug.h" #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("utalloc") @@ -225,7 +225,7 @@ AcpiUtDeleteCaches ( if (AcpiGbl_DisplayFinalMemStats) { ACPI_STRCPY (Buffer, "MEMORY"); - AcpiDbDisplayStatistics (Buffer); + (void) AcpiDbDisplayStatistics (Buffer); } #endif @@ -318,7 +318,7 @@ AcpiUtValidateBuffer ( * RETURN: Status * * DESCRIPTION: Validate that the buffer is of the required length or - * allocate a new buffer. Returned buffer is always zeroed. + * allocate a new buffer. Returned buffer is always zeroed. * ******************************************************************************/ @@ -327,65 +327,71 @@ AcpiUtInitializeBuffer ( ACPI_BUFFER *Buffer, ACPI_SIZE RequiredLength) { - ACPI_STATUS Status = AE_OK; + ACPI_SIZE InputBufferLength; - switch (Buffer->Length) + /* Parameter validation */ + + if (!Buffer || !RequiredLength) { - case ACPI_NO_BUFFER: + return (AE_BAD_PARAMETER); + } - /* Set the exception and returned the required length */ + /* + * Buffer->Length is used as both an input and output parameter. Get the + * input actual length and set the output required buffer length. + */ + InputBufferLength = Buffer->Length; + Buffer->Length = RequiredLength; - Status = AE_BUFFER_OVERFLOW; - break; + /* + * The input buffer length contains the actual buffer length, or the type + * of buffer to be allocated by this routine. + */ + switch (InputBufferLength) + { + case ACPI_NO_BUFFER: + + /* Return the exception (and the required buffer length) */ + return (AE_BUFFER_OVERFLOW); case ACPI_ALLOCATE_BUFFER: /* Allocate a new buffer */ Buffer->Pointer = AcpiOsAllocate (RequiredLength); - if (!Buffer->Pointer) - { - return (AE_NO_MEMORY); - } - - /* Clear the buffer */ - - ACPI_MEMSET (Buffer->Pointer, 0, RequiredLength); break; - case ACPI_ALLOCATE_LOCAL_BUFFER: /* Allocate a new buffer with local interface to allow tracking */ - Buffer->Pointer = ACPI_ALLOCATE_ZEROED (RequiredLength); - if (!Buffer->Pointer) - { - return (AE_NO_MEMORY); - } + Buffer->Pointer = ACPI_ALLOCATE (RequiredLength); break; - default: /* Existing buffer: Validate the size of the buffer */ - if (Buffer->Length < RequiredLength) + if (InputBufferLength < RequiredLength) { - Status = AE_BUFFER_OVERFLOW; - break; + return (AE_BUFFER_OVERFLOW); } + break; + } - /* Clear the buffer */ + /* Validate allocation from above or input buffer pointer */ - ACPI_MEMSET (Buffer->Pointer, 0, RequiredLength); - break; + if (!Buffer->Pointer) + { + return (AE_NO_MEMORY); } - Buffer->Length = RequiredLength; - return (Status); + /* Have a valid buffer, clear it */ + + ACPI_MEMSET (Buffer->Pointer, 0, RequiredLength); + return (AE_OK); } @@ -408,7 +414,7 @@ void * AcpiUtAllocate ( ACPI_SIZE Size, UINT32 Component, - char *Module, + const char *Module, UINT32 Line) { void *Allocation; @@ -460,7 +466,7 @@ void * AcpiUtAllocateZeroed ( ACPI_SIZE Size, UINT32 Component, - char *Module, + const char *Module, UINT32 Line) { void *Allocation; diff --git a/sys/contrib/dev/acpica/utcache.c b/sys/contrib/dev/acpica/utilities/utcache.c index 56e88b3d1a32..aabc0a23052e 100644 --- a/sys/contrib/dev/acpica/utcache.c +++ b/sys/contrib/dev/acpica/utilities/utcache.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: utcache - local cache allocation routines - * $Revision: 1.8 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,7 +115,8 @@ #define __UTCACHE_C__ -#include <contrib/dev/acpica/acpi.h> +#include "acpi.h" +#include "accommon.h" #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("utcache") @@ -194,6 +194,7 @@ AcpiOsPurgeCache ( ACPI_MEMORY_LIST *Cache) { char *Next; + ACPI_STATUS Status; ACPI_FUNCTION_ENTRY (); @@ -204,6 +205,12 @@ AcpiOsPurgeCache ( return (AE_BAD_PARAMETER); } + Status = AcpiUtAcquireMutex (ACPI_MTX_CACHES); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + /* Walk the list of objects in this cache */ while (Cache->ListHead) @@ -218,6 +225,7 @@ AcpiOsPurgeCache ( Cache->CurrentDepth--; } + (void) AcpiUtReleaseMutex (ACPI_MTX_CACHES); return (AE_OK); } diff --git a/sys/contrib/dev/acpica/utclib.c b/sys/contrib/dev/acpica/utilities/utclib.c index 77e0d0e7a545..a9b8122fab86 100644 --- a/sys/contrib/dev/acpica/utclib.c +++ b/sys/contrib/dev/acpica/utilities/utclib.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: cmclib - Local implementation of C library functions - * $Revision: 1.60 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,7 +116,8 @@ #define __CMCLIB_C__ -#include <contrib/dev/acpica/acpi.h> +#include "acpi.h" +#include "accommon.h" /* * These implementations of standard C Library routines can optionally be @@ -218,7 +218,7 @@ AcpiUtMemcpy ( void * AcpiUtMemset ( void *Dest, - ACPI_NATIVE_UINT Value, + UINT8 Value, ACPI_SIZE Count) { char *New = (char *) Dest; diff --git a/sys/contrib/dev/acpica/utcopy.c b/sys/contrib/dev/acpica/utilities/utcopy.c index 2d4072c12cfb..20a0e34324f7 100644 --- a/sys/contrib/dev/acpica/utcopy.c +++ b/sys/contrib/dev/acpica/utilities/utcopy.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: utcopy - Internal to external object translation utilities - * $Revision: 1.130 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,8 +115,9 @@ #define __UTCOPY_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/amlcode.h> +#include "acpi.h" +#include "accommon.h" +#include "acnamesp.h" #define _COMPONENT ACPI_UTILITIES @@ -151,6 +151,11 @@ AcpiUtCopyEsimpleToIsimple( ACPI_OPERAND_OBJECT **ReturnObj); static ACPI_STATUS +AcpiUtCopyEpackageToIpackage ( + ACPI_OBJECT *ExternalObject, + ACPI_OPERAND_OBJECT **InternalObject); + +static ACPI_STATUS AcpiUtCopySimpleObject ( ACPI_OPERAND_OBJECT *SourceDesc, ACPI_OPERAND_OBJECT *DestDesc); @@ -221,11 +226,11 @@ AcpiUtCopyIsimpleToEsimple ( * In general, the external object will be the same type as * the internal object */ - ExternalObject->Type = ACPI_GET_OBJECT_TYPE (InternalObject); + ExternalObject->Type = InternalObject->Common.Type; /* However, only a limited number of external types are supported */ - switch (ACPI_GET_OBJECT_TYPE (InternalObject)) + switch (InternalObject->Common.Type) { case ACPI_TYPE_STRING: @@ -261,42 +266,49 @@ AcpiUtCopyIsimpleToEsimple ( case ACPI_TYPE_LOCAL_REFERENCE: - /* - * This is an object reference. Attempt to dereference it. - */ - switch (InternalObject->Reference.Opcode) - { - case AML_INT_NAMEPATH_OP: + /* This is an object reference. */ - /* For namepath, return the object handle ("reference") */ + switch (InternalObject->Reference.Class) + { + case ACPI_REFCLASS_NAME: - default: /* - * Use the object type of "Any" to indicate a reference - * to object containing a handle to an ACPI named object. + * For namepath, return the object handle ("reference") + * We are referring to the namespace node */ - ExternalObject->Type = ACPI_TYPE_ANY; - ExternalObject->Reference.Handle = InternalObject->Reference.Node; + ExternalObject->Reference.Handle = + InternalObject->Reference.Node; + ExternalObject->Reference.ActualType = + AcpiNsGetType (InternalObject->Reference.Node); break; + + default: + + /* All other reference types are unsupported */ + + return_ACPI_STATUS (AE_TYPE); } break; case ACPI_TYPE_PROCESSOR: - ExternalObject->Processor.ProcId = InternalObject->Processor.ProcId; - ExternalObject->Processor.PblkAddress = InternalObject->Processor.Address; - ExternalObject->Processor.PblkLength = InternalObject->Processor.Length; + ExternalObject->Processor.ProcId = + InternalObject->Processor.ProcId; + ExternalObject->Processor.PblkAddress = + InternalObject->Processor.Address; + ExternalObject->Processor.PblkLength = + InternalObject->Processor.Length; break; case ACPI_TYPE_POWER: ExternalObject->PowerResource.SystemLevel = - InternalObject->PowerResource.SystemLevel; + InternalObject->PowerResource.SystemLevel; ExternalObject->PowerResource.ResourceOrder = - InternalObject->PowerResource.ResourceOrder; + InternalObject->PowerResource.ResourceOrder; break; @@ -304,6 +316,10 @@ AcpiUtCopyIsimpleToEsimple ( /* * There is no corresponding external object type */ + ACPI_ERROR ((AE_INFO, + "Unsupported object type, cannot convert to external object: %s", + AcpiUtGetTypeName (InternalObject->Common.Type))); + return_ACPI_STATUS (AE_SUPPORT); } @@ -442,7 +458,7 @@ AcpiUtCopyIpackageToEpackage ( Info.ObjectSpace = 0; Info.NumPackages = 1; - ExternalObject->Type = ACPI_GET_OBJECT_TYPE (InternalObject); + ExternalObject->Type = InternalObject->Common.Type; ExternalObject->Package.Count = InternalObject->Package.Count; ExternalObject->Package.Elements = ACPI_CAST_PTR (ACPI_OBJECT, Info.FreeSpace); @@ -489,7 +505,7 @@ AcpiUtCopyIobjectToEobject ( ACPI_FUNCTION_TRACE (UtCopyIobjectToEobject); - if (ACPI_GET_OBJECT_TYPE (InternalObject) == ACPI_TYPE_PACKAGE) + if (InternalObject->Common.Type == ACPI_TYPE_PACKAGE) { /* * Package object: Copy all subobjects (including @@ -554,6 +570,7 @@ AcpiUtCopyEsimpleToIsimple ( case ACPI_TYPE_STRING: case ACPI_TYPE_BUFFER: case ACPI_TYPE_INTEGER: + case ACPI_TYPE_LOCAL_REFERENCE: InternalObject = AcpiUtCreateInternalObject ( (UINT8) ExternalObject->Type); @@ -563,9 +580,18 @@ AcpiUtCopyEsimpleToIsimple ( } break; + case ACPI_TYPE_ANY: /* This is the case for a NULL object */ + + *RetInternalObject = NULL; + return_ACPI_STATUS (AE_OK); + default: /* All other types are not supported */ + ACPI_ERROR ((AE_INFO, + "Unsupported object type, cannot convert to internal object: %s", + AcpiUtGetTypeName (ExternalObject->Type))); + return_ACPI_STATUS (AE_SUPPORT); } @@ -577,7 +603,9 @@ AcpiUtCopyEsimpleToIsimple ( case ACPI_TYPE_STRING: InternalObject->String.Pointer = - ACPI_ALLOCATE_ZEROED ((ACPI_SIZE) ExternalObject->String.Length + 1); + ACPI_ALLOCATE_ZEROED ((ACPI_SIZE) + ExternalObject->String.Length + 1); + if (!InternalObject->String.Pointer) { goto ErrorExit; @@ -605,6 +633,10 @@ AcpiUtCopyEsimpleToIsimple ( ExternalObject->Buffer.Length); InternalObject->Buffer.Length = ExternalObject->Buffer.Length; + + /* Mark buffer data valid */ + + InternalObject->Buffer.Flags |= AOPOBJ_DATA_VALID; break; @@ -613,6 +645,14 @@ AcpiUtCopyEsimpleToIsimple ( InternalObject->Integer.Value = ExternalObject->Integer.Value; break; + case ACPI_TYPE_LOCAL_REFERENCE: + + /* TBD: should validate incoming handle */ + + InternalObject->Reference.Class = ACPI_REFCLASS_NAME; + InternalObject->Reference.Node = ExternalObject->Reference.Handle; + break; + default: /* Other types can't get here */ break; @@ -628,83 +668,81 @@ ErrorExit: } -#ifdef ACPI_FUTURE_IMPLEMENTATION -/* Code to convert packages that are parameters to control methods */ - /******************************************************************************* * * FUNCTION: AcpiUtCopyEpackageToIpackage * - * PARAMETERS: *InternalObject - Pointer to the object we are returning - * *Buffer - Where the object is returned - * *SpaceUsed - Where the length of the object is returned + * PARAMETERS: ExternalObject - The external object to be converted + * InternalObject - Where the internal object is returned * * RETURN: Status * - * DESCRIPTION: This function is called to place a package object in a user - * 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. + * DESCRIPTION: Copy an external package object to an internal package. + * Handles nested packages. * ******************************************************************************/ static ACPI_STATUS AcpiUtCopyEpackageToIpackage ( - ACPI_OPERAND_OBJECT *InternalObject, - UINT8 *Buffer, - UINT32 *SpaceUsed) + ACPI_OBJECT *ExternalObject, + ACPI_OPERAND_OBJECT **InternalObject) { - UINT8 *FreeSpace; - ACPI_OBJECT *ExternalObject; - UINT32 Length = 0; - UINT32 ThisIndex; - UINT32 ObjectSpace = 0; - ACPI_OPERAND_OBJECT *ThisInternalObj; - ACPI_OBJECT *ThisExternalObj; + ACPI_STATUS Status = AE_OK; + ACPI_OPERAND_OBJECT *PackageObject; + ACPI_OPERAND_OBJECT **PackageElements; + UINT32 i; ACPI_FUNCTION_TRACE (UtCopyEpackageToIpackage); - /* - * First package at head of the buffer - */ - ExternalObject = (ACPI_OBJECT *)Buffer; - - /* - * Free space begins right after the first package - */ - FreeSpace = Buffer + sizeof(ACPI_OBJECT); + /* Create the package object */ + PackageObject = AcpiUtCreatePackageObject (ExternalObject->Package.Count); + if (!PackageObject) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } - ExternalObject->Type = ACPI_GET_OBJECT_TYPE (InternalObject); - ExternalObject->Package.Count = InternalObject->Package.Count; - ExternalObject->Package.Elements = (ACPI_OBJECT *)FreeSpace; + PackageElements = PackageObject->Package.Elements; /* - * Build an array of ACPI_OBJECTS in the buffer - * and move the free space past it + * Recursive implementation. Probably ok, since nested external packages + * as parameters should be very rare. */ - FreeSpace += ExternalObject->Package.Count * sizeof(ACPI_OBJECT); + for (i = 0; i < ExternalObject->Package.Count; i++) + { + Status = AcpiUtCopyEobjectToIobject ( + &ExternalObject->Package.Elements[i], + &PackageElements[i]); + if (ACPI_FAILURE (Status)) + { + /* Truncate package and delete it */ + PackageObject->Package.Count = i; + PackageElements[i] = NULL; + AcpiUtRemoveReference (PackageObject); + return_ACPI_STATUS (Status); + } + } - /* Call WalkPackage */ + /* Mark package data valid */ -} + PackageObject->Package.Flags |= AOPOBJ_DATA_VALID; -#endif /* Future implementation */ + *InternalObject = PackageObject; + return_ACPI_STATUS (Status); +} /******************************************************************************* * * FUNCTION: AcpiUtCopyEobjectToIobject * - * PARAMETERS: *InternalObject - The external object to be converted - * *BufferPtr - Where the internal object is returned + * PARAMETERS: ExternalObject - The external object to be converted + * InternalObject - Where the internal object is returned * - * RETURN: Status - the status of the call + * RETURN: Status - the status of the call * * DESCRIPTION: Converts an external object to an internal object. * @@ -723,15 +761,8 @@ AcpiUtCopyEobjectToIobject ( if (ExternalObject->Type == ACPI_TYPE_PACKAGE) { - /* - * Packages as external input to control methods are not supported, - */ - ACPI_ERROR ((AE_INFO, - "Packages as parameters not implemented!")); - - return_ACPI_STATUS (AE_NOT_IMPLEMENTED); + Status = AcpiUtCopyEpackageToIpackage (ExternalObject, InternalObject); } - else { /* @@ -765,6 +796,7 @@ AcpiUtCopySimpleObject ( { UINT16 ReferenceCount; ACPI_OPERAND_OBJECT *NextObject; + ACPI_STATUS Status; /* Save fields from destination that we don't want to overwrite */ @@ -788,7 +820,7 @@ AcpiUtCopySimpleObject ( /* Handle the objects with extra data */ - switch (ACPI_GET_OBJECT_TYPE (DestDesc)) + switch (DestDesc->Common.Type) { case ACPI_TYPE_BUFFER: /* @@ -840,7 +872,16 @@ AcpiUtCopySimpleObject ( /* * We copied the reference object, so we now must add a reference * to the object pointed to by the reference + * + * DDBHandle reference (from Load/LoadTable) is a special reference, + * it does not have a Reference.Object, so does not need to + * increase the reference count */ + if (SourceDesc->Reference.Class == ACPI_REFCLASS_TABLE) + { + break; + } + AcpiUtAddReference (SourceDesc->Reference.Object); break; @@ -854,6 +895,29 @@ AcpiUtCopySimpleObject ( } break; + /* + * For Mutex and Event objects, we cannot simply copy the underlying + * OS object. We must create a new one. + */ + case ACPI_TYPE_MUTEX: + + Status = AcpiOsCreateMutex (&DestDesc->Mutex.OsMutex); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + break; + + case ACPI_TYPE_EVENT: + + Status = AcpiOsCreateSemaphore (ACPI_NO_UNIT_LIMIT, 0, + &DestDesc->Event.OsSemaphore); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + break; + default: /* Nothing to do for other simple objects */ break; @@ -907,7 +971,7 @@ AcpiUtCopyIelementToIelement ( * This is a simple object, just copy it */ TargetObject = AcpiUtCreateInternalObject ( - ACPI_GET_OBJECT_TYPE (SourceObject)); + SourceObject->Common.Type); if (!TargetObject) { return (AE_NO_MEMORY); @@ -936,34 +1000,20 @@ AcpiUtCopyIelementToIelement ( * This object is a package - go down another nesting level * Create and build the package object */ - TargetObject = AcpiUtCreateInternalObject (ACPI_TYPE_PACKAGE); + TargetObject = AcpiUtCreatePackageObject (SourceObject->Package.Count); if (!TargetObject) { return (AE_NO_MEMORY); } - TargetObject->Package.Count = SourceObject->Package.Count; - TargetObject->Common.Flags = SourceObject->Common.Flags; + TargetObject->Common.Flags = SourceObject->Common.Flags; - /* - * Create the object array - */ - TargetObject->Package.Elements = ACPI_ALLOCATE_ZEROED ( - ((ACPI_SIZE) SourceObject->Package.Count + 1) * sizeof (void *)); - if (!TargetObject->Package.Elements) - { - Status = AE_NO_MEMORY; - goto ErrorExit; - } + /* Pass the new package object back to the package walk routine */ - /* - * Pass the new package object back to the package walk routine - */ State->Pkg.ThisTargetObj = TargetObject; - /* - * Store the object pointer in the parent package object - */ + /* Store the object pointer in the parent package object */ + *ThisTargetPtr = TargetObject; break; @@ -1006,7 +1056,7 @@ AcpiUtCopyIpackageToIpackage ( ACPI_FUNCTION_TRACE (UtCopyIpackageToIpackage); - DestObj->Common.Type = ACPI_GET_OBJECT_TYPE (SourceObj); + DestObj->Common.Type = SourceObj->Common.Type; DestObj->Common.Flags = SourceObj->Common.Flags; DestObj->Package.Count = SourceObj->Package.Count; @@ -1067,7 +1117,7 @@ AcpiUtCopyIobjectToIobject ( /* Create the top level object */ - *DestDesc = AcpiUtCreateInternalObject (ACPI_GET_OBJECT_TYPE (SourceDesc)); + *DestDesc = AcpiUtCreateInternalObject (SourceDesc->Common.Type); if (!*DestDesc) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -1075,7 +1125,7 @@ AcpiUtCopyIobjectToIobject ( /* Copy the object and possible subobjects */ - if (ACPI_GET_OBJECT_TYPE (SourceDesc) == ACPI_TYPE_PACKAGE) + if (SourceDesc->Common.Type == ACPI_TYPE_PACKAGE) { Status = AcpiUtCopyIpackageToIpackage (SourceDesc, *DestDesc, WalkState); diff --git a/sys/contrib/dev/acpica/utdebug.c b/sys/contrib/dev/acpica/utilities/utdebug.c index 59b91d7f1fc2..3901b07d197e 100644 --- a/sys/contrib/dev/acpica/utdebug.c +++ b/sys/contrib/dev/acpica/utilities/utdebug.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: utdebug - Debug print routines - * $Revision: 1.133 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,7 +115,8 @@ #define __UTDEBUG_C__ -#include <contrib/dev/acpica/acpi.h> +#include "acpi.h" +#include "accommon.h" #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("utdebug") @@ -124,9 +124,9 @@ #ifdef ACPI_DEBUG_OUTPUT -static UINT32 AcpiGbl_PrevThreadId = 0xFFFFFFFF; -static char *AcpiGbl_FnEntryStr = "----Entry"; -static char *AcpiGbl_FnExitStr = "----Exit-"; +static ACPI_THREAD_ID AcpiGbl_PrevThreadId = (ACPI_THREAD_ID) 0xFFFFFFFF; +static char *AcpiGbl_FnEntryStr = "----Entry"; +static char *AcpiGbl_FnExitStr = "----Exit-"; /* Local prototypes */ @@ -151,10 +151,10 @@ void AcpiUtInitStackPtrTrace ( void) { - UINT32 CurrentSp; + ACPI_SIZE CurrentSp; - AcpiGbl_EntryStackPointer = ACPI_PTR_DIFF (&CurrentSp, NULL); + AcpiGbl_EntryStackPointer = &CurrentSp; } @@ -177,11 +177,9 @@ AcpiUtTrackStackPtr ( ACPI_SIZE CurrentSp; - CurrentSp = ACPI_PTR_DIFF (&CurrentSp, NULL); - - if (CurrentSp < AcpiGbl_LowestStackPointer) + if (&CurrentSp < AcpiGbl_LowestStackPointer) { - AcpiGbl_LowestStackPointer = CurrentSp; + AcpiGbl_LowestStackPointer = &CurrentSp; } if (AcpiGbl_NestingLevel > AcpiGbl_DeepestNesting) @@ -232,7 +230,7 @@ AcpiUtTrimFunctionName ( /******************************************************************************* * - * FUNCTION: AcpiUtDebugPrint + * FUNCTION: AcpiDebugPrint * * PARAMETERS: RequestedDebugLevel - Requested debug print level * LineNumber - Caller's line number (for error output) @@ -250,13 +248,13 @@ AcpiUtTrimFunctionName ( ******************************************************************************/ void ACPI_INTERNAL_VAR_XFACE -AcpiUtDebugPrint ( +AcpiDebugPrint ( UINT32 RequestedDebugLevel, UINT32 LineNumber, const char *FunctionName, - char *ModuleName, + const char *ModuleName, UINT32 ComponentId, - char *Format, + const char *Format, ...) { ACPI_THREAD_ID ThreadId; @@ -281,8 +279,9 @@ AcpiUtDebugPrint ( if (ACPI_LV_THREADS & AcpiDbgLevel) { AcpiOsPrintf ( - "\n**** Context Switch from TID %X to TID %X ****\n\n", - AcpiGbl_PrevThreadId, ThreadId); + "\n**** Context Switch from TID %p to TID %p ****\n\n", + ACPI_CAST_PTR (void, AcpiGbl_PrevThreadId), + ACPI_CAST_PTR (void, ThreadId)); } AcpiGbl_PrevThreadId = ThreadId; @@ -296,7 +295,7 @@ AcpiUtDebugPrint ( if (ACPI_LV_THREADS & AcpiDbgLevel) { - AcpiOsPrintf ("[%04lX] ", ThreadId); + AcpiOsPrintf ("[%p] ", ACPI_CAST_PTR (void, ThreadId)); } AcpiOsPrintf ("[%02ld] %-22.22s: ", @@ -304,14 +303,15 @@ AcpiUtDebugPrint ( va_start (args, Format); AcpiOsVprintf (Format, args); + va_end (args); } -ACPI_EXPORT_SYMBOL (AcpiUtDebugPrint) +ACPI_EXPORT_SYMBOL (AcpiDebugPrint) /******************************************************************************* * - * FUNCTION: AcpiUtDebugPrintRaw + * FUNCTION: AcpiDebugPrintRaw * * PARAMETERS: RequestedDebugLevel - Requested debug print level * LineNumber - Caller's line number @@ -329,13 +329,13 @@ ACPI_EXPORT_SYMBOL (AcpiUtDebugPrint) ******************************************************************************/ void ACPI_INTERNAL_VAR_XFACE -AcpiUtDebugPrintRaw ( +AcpiDebugPrintRaw ( UINT32 RequestedDebugLevel, UINT32 LineNumber, const char *FunctionName, - char *ModuleName, + const char *ModuleName, UINT32 ComponentId, - char *Format, + const char *Format, ...) { va_list args; @@ -349,9 +349,10 @@ AcpiUtDebugPrintRaw ( va_start (args, Format); AcpiOsVprintf (Format, args); + va_end (args); } -ACPI_EXPORT_SYMBOL (AcpiUtDebugPrintRaw) +ACPI_EXPORT_SYMBOL (AcpiDebugPrintRaw) /******************************************************************************* @@ -374,14 +375,14 @@ void AcpiUtTrace ( UINT32 LineNumber, const char *FunctionName, - char *ModuleName, + const char *ModuleName, UINT32 ComponentId) { AcpiGbl_NestingLevel++; AcpiUtTrackStackPtr (); - AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, + AcpiDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, FunctionName, ModuleName, ComponentId, "%s\n", AcpiGbl_FnEntryStr); } @@ -410,14 +411,14 @@ void AcpiUtTracePtr ( UINT32 LineNumber, const char *FunctionName, - char *ModuleName, + const char *ModuleName, UINT32 ComponentId, void *Pointer) { AcpiGbl_NestingLevel++; AcpiUtTrackStackPtr (); - AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, + AcpiDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, FunctionName, ModuleName, ComponentId, "%s %p\n", AcpiGbl_FnEntryStr, Pointer); } @@ -444,7 +445,7 @@ void AcpiUtTraceStr ( UINT32 LineNumber, const char *FunctionName, - char *ModuleName, + const char *ModuleName, UINT32 ComponentId, char *String) { @@ -452,7 +453,7 @@ AcpiUtTraceStr ( AcpiGbl_NestingLevel++; AcpiUtTrackStackPtr (); - AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, + AcpiDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, FunctionName, ModuleName, ComponentId, "%s %s\n", AcpiGbl_FnEntryStr, String); } @@ -479,7 +480,7 @@ void AcpiUtTraceU32 ( UINT32 LineNumber, const char *FunctionName, - char *ModuleName, + const char *ModuleName, UINT32 ComponentId, UINT32 Integer) { @@ -487,7 +488,7 @@ AcpiUtTraceU32 ( AcpiGbl_NestingLevel++; AcpiUtTrackStackPtr (); - AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, + AcpiDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, FunctionName, ModuleName, ComponentId, "%s %08X\n", AcpiGbl_FnEntryStr, Integer); } @@ -513,11 +514,11 @@ void AcpiUtExit ( UINT32 LineNumber, const char *FunctionName, - char *ModuleName, + const char *ModuleName, UINT32 ComponentId) { - AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, + AcpiDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, FunctionName, ModuleName, ComponentId, "%s\n", AcpiGbl_FnExitStr); @@ -548,21 +549,21 @@ void AcpiUtStatusExit ( UINT32 LineNumber, const char *FunctionName, - char *ModuleName, + const char *ModuleName, UINT32 ComponentId, ACPI_STATUS Status) { if (ACPI_SUCCESS (Status)) { - AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, + AcpiDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, FunctionName, ModuleName, ComponentId, "%s %s\n", AcpiGbl_FnExitStr, AcpiFormatException (Status)); } else { - AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, + AcpiDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, FunctionName, ModuleName, ComponentId, "%s ****Exception****: %s\n", AcpiGbl_FnExitStr, AcpiFormatException (Status)); @@ -595,12 +596,12 @@ void AcpiUtValueExit ( UINT32 LineNumber, const char *FunctionName, - char *ModuleName, + const char *ModuleName, UINT32 ComponentId, ACPI_INTEGER Value) { - AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, + AcpiDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, FunctionName, ModuleName, ComponentId, "%s %8.8X%8.8X\n", AcpiGbl_FnExitStr, ACPI_FORMAT_UINT64 (Value)); @@ -632,12 +633,12 @@ void AcpiUtPtrExit ( UINT32 LineNumber, const char *FunctionName, - char *ModuleName, + const char *ModuleName, UINT32 ComponentId, UINT8 *Ptr) { - AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, + AcpiDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, FunctionName, ModuleName, ComponentId, "%s %p\n", AcpiGbl_FnExitStr, Ptr); @@ -668,12 +669,18 @@ AcpiUtDumpBuffer2 ( UINT32 Count, UINT32 Display) { - ACPI_NATIVE_UINT i = 0; - ACPI_NATIVE_UINT j; + UINT32 i = 0; + UINT32 j; UINT32 Temp32; UINT8 BufChar; + if (!Buffer) + { + AcpiOsPrintf ("Null Buffer Pointer in DumpBuffer!\n"); + return; + } + if ((Count < 4) || (Count & 0x01)) { Display = DB_BYTE_DISPLAY; @@ -685,7 +692,7 @@ AcpiUtDumpBuffer2 ( { /* Print current offset */ - AcpiOsPrintf ("%6.4X: ", (UINT32) i); + AcpiOsPrintf ("%6.4X: ", i); /* Print 16 hex chars */ @@ -696,7 +703,7 @@ AcpiUtDumpBuffer2 ( /* Dump fill spaces */ AcpiOsPrintf ("%*s", ((Display * 2) + 1), " "); - j += (ACPI_NATIVE_UINT) Display; + j += Display; continue; } @@ -705,35 +712,35 @@ AcpiUtDumpBuffer2 ( case DB_BYTE_DISPLAY: default: /* Default is BYTE display */ - AcpiOsPrintf ("%02X ", Buffer[i + j]); + AcpiOsPrintf ("%02X ", Buffer[(ACPI_SIZE) i + j]); break; case DB_WORD_DISPLAY: - ACPI_MOVE_16_TO_32 (&Temp32, &Buffer[i + j]); + ACPI_MOVE_16_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]); AcpiOsPrintf ("%04X ", Temp32); break; case DB_DWORD_DISPLAY: - ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[i + j]); + ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]); AcpiOsPrintf ("%08X ", Temp32); break; case DB_QWORD_DISPLAY: - ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[i + j]); + ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j]); AcpiOsPrintf ("%08X", Temp32); - ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[i + j + 4]); + ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[(ACPI_SIZE) i + j + 4]); AcpiOsPrintf ("%08X ", Temp32); break; } - j += (ACPI_NATIVE_UINT) Display; + j += Display; } /* @@ -749,7 +756,7 @@ AcpiUtDumpBuffer2 ( return; } - BufChar = Buffer[i + j]; + BufChar = Buffer[(ACPI_SIZE) i + j]; if (ACPI_IS_PRINT (BufChar)) { AcpiOsPrintf ("%c", BufChar); diff --git a/sys/contrib/dev/acpica/utdelete.c b/sys/contrib/dev/acpica/utilities/utdelete.c index e78796edbb80..bf30aee74e06 100644 --- a/sys/contrib/dev/acpica/utdelete.c +++ b/sys/contrib/dev/acpica/utilities/utdelete.c @@ -1,7 +1,6 @@ /******************************************************************************* * * Module Name: utdelete - object deletion and reference count utilities - * $Revision: 1.123 $ * ******************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,11 +115,12 @@ #define __UTDELETE_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acinterp.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/acevents.h> -#include <contrib/dev/acpica/amlcode.h> +#include "acpi.h" +#include "accommon.h" +#include "acinterp.h" +#include "acnamesp.h" +#include "acevents.h" + #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("utdelete") @@ -158,6 +158,7 @@ AcpiUtDeleteInternalObj ( ACPI_OPERAND_OBJECT *HandlerDesc; ACPI_OPERAND_OBJECT *SecondDesc; ACPI_OPERAND_OBJECT *NextDesc; + ACPI_OPERAND_OBJECT **LastObjPtr; ACPI_FUNCTION_TRACE_PTR (UtDeleteInternalObj, Object); @@ -172,7 +173,7 @@ AcpiUtDeleteInternalObj ( * Must delete or free any pointers within the object that are not * actual ACPI objects (for example, a raw buffer pointer). */ - switch (ACPI_GET_OBJECT_TYPE (Object)) + switch (Object->Common.Type) { case ACPI_TYPE_STRING: @@ -222,6 +223,10 @@ AcpiUtDeleteInternalObj ( break; + /* + * These objects have a possible list of notify handlers. + * Device object also may have a GPE block. + */ case ACPI_TYPE_DEVICE: if (Object->Device.GpeBlock) @@ -229,9 +234,14 @@ AcpiUtDeleteInternalObj ( (void) AcpiEvDeleteGpeBlock (Object->Device.GpeBlock); } - /* Walk the handler list for this device */ + /*lint -fallthrough */ + + case ACPI_TYPE_PROCESSOR: + case ACPI_TYPE_THERMAL: - HandlerDesc = Object->Device.Handler; + /* Walk the notify handler list for this object */ + + HandlerDesc = Object->CommonNotify.Handler; while (HandlerDesc) { NextDesc = HandlerDesc->AddressSpace.Next; @@ -308,6 +318,25 @@ AcpiUtDeleteInternalObj ( HandlerDesc = Object->Region.Handler; if (HandlerDesc) { + NextDesc = HandlerDesc->AddressSpace.RegionList; + LastObjPtr = &HandlerDesc->AddressSpace.RegionList; + + /* Remove the region object from the handler's list */ + + while (NextDesc) + { + if (NextDesc == Object) + { + *LastObjPtr = NextDesc->Region.Next; + break; + } + + /* Walk the linked list of handler */ + + LastObjPtr = &NextDesc->Region.Next; + NextDesc = NextDesc->Region.Next; + } + if (HandlerDesc->AddressSpace.HandlerFlags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) { @@ -345,6 +374,19 @@ AcpiUtDeleteInternalObj ( break; + case ACPI_TYPE_LOCAL_BANK_FIELD: + + ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, + "***** Bank Field %p\n", Object)); + + SecondDesc = AcpiNsGetSecondaryObject (Object); + if (SecondDesc) + { + AcpiUtDeleteObjectDesc (SecondDesc); + } + break; + + default: break; } @@ -472,7 +514,7 @@ AcpiUtUpdateRefCount ( Object, NewCount)); } - if (ACPI_GET_OBJECT_TYPE (Object) == ACPI_TYPE_METHOD) + if (Object->Common.Type == ACPI_TYPE_METHOD) { ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Method Obj %p Refs=%X, [Decremented]\n", Object, NewCount)); @@ -544,7 +586,7 @@ AcpiUtUpdateObjectReference ( ACPI_GENERIC_STATE *StateList = NULL; ACPI_OPERAND_OBJECT *NextObject = NULL; ACPI_GENERIC_STATE *State; - ACPI_NATIVE_UINT i; + UINT32 i; ACPI_FUNCTION_TRACE_PTR (UtUpdateObjectReference, Object); @@ -565,7 +607,7 @@ AcpiUtUpdateObjectReference ( * All sub-objects must have their reference count incremented also. * Different object types have different subobjects. */ - switch (ACPI_GET_OBJECT_TYPE (Object)) + switch (Object->Common.Type) { case ACPI_TYPE_DEVICE: case ACPI_TYPE_PROCESSOR: @@ -633,10 +675,12 @@ AcpiUtUpdateObjectReference ( case ACPI_TYPE_LOCAL_REFERENCE: /* - * The target of an Index (a package, string, or buffer) must track - * changes to the ref count of the index. + * The target of an Index (a package, string, or buffer) or a named + * reference must track changes to the ref count of the index or + * target object. */ - if (Object->Reference.Opcode == AML_INDEX_OP) + if ((Object->Reference.Class == ACPI_REFCLASS_INDEX) || + (Object->Reference.Class== ACPI_REFCLASS_NAME)) { NextObject = Object->Reference.Object; } @@ -672,11 +716,20 @@ AcpiUtUpdateObjectReference ( return_ACPI_STATUS (AE_OK); + ErrorExit: ACPI_EXCEPTION ((AE_INFO, Status, "Could not update object reference count")); + /* Free any stacked Update State objects */ + + while (StateList) + { + State = AcpiUtPopGenericState (&StateList); + AcpiUtDeleteGenericState (State); + } + return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/uteval.c b/sys/contrib/dev/acpica/utilities/uteval.c index 5e16abb1f11e..a75ef3caf6e0 100644 --- a/sys/contrib/dev/acpica/uteval.c +++ b/sys/contrib/dev/acpica/utilities/uteval.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: uteval - Object evaluation - * $Revision: 1.71 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,9 +115,10 @@ #define __UTEVAL_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/acinterp.h> +#include "acpi.h" +#include "accommon.h" +#include "acnamesp.h" +#include "acinterp.h" #define _COMPONENT ACPI_UTILITIES @@ -140,26 +140,30 @@ AcpiUtTranslateOneCid ( /* * 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 + * BIOS-provided ASL code. + * + * The second element of each entry is used to track the newest version of + * Windows that the BIOS has requested. */ -static const char *AcpiInterfacesSupported[] = +static const ACPI_INTERFACE_INFO AcpiInterfacesSupported[] = { /* Operating System Vendor Strings */ - "Linux", - "Windows 2000", - "Windows 2001", - "Windows 2001 SP0", - "Windows 2001 SP1", - "Windows 2001 SP2", - "Windows 2001 SP3", - "Windows 2001 SP4", - "Windows 2001.1", - "Windows 2001.1 SP1", /* Added 03/2006 */ - "Windows 2006", /* Added 03/2006 */ + {"Windows 2000", ACPI_OSI_WIN_2000}, /* Windows 2000 */ + {"Windows 2001", ACPI_OSI_WIN_XP}, /* Windows XP */ + {"Windows 2001 SP1", ACPI_OSI_WIN_XP_SP1}, /* Windows XP SP1 */ + {"Windows 2001.1", ACPI_OSI_WINSRV_2003}, /* Windows Server 2003 */ + {"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 */ /* Feature Group Strings */ - "Extended Address Space Descriptor" + {"Extended Address Space Descriptor", 0} /* * All "optional" feature group strings (features that are implemented @@ -188,7 +192,8 @@ AcpiUtOsiImplementation ( ACPI_STATUS Status; ACPI_OPERAND_OBJECT *StringDesc; ACPI_OPERAND_OBJECT *ReturnDesc; - ACPI_NATIVE_UINT i; + UINT32 ReturnValue; + UINT32 i; ACPI_FUNCTION_TRACE (UtOsiImplementation); @@ -210,20 +215,29 @@ AcpiUtOsiImplementation ( return_ACPI_STATUS (AE_NO_MEMORY); } - /* Default return value is SUPPORTED */ + /* Default return value is 0, NOT SUPPORTED */ - ReturnDesc->Integer.Value = ACPI_UINT32_MAX; - WalkState->ReturnDesc = ReturnDesc; + ReturnValue = 0; /* Compare input string to static table of supported interfaces */ for (i = 0; i < ACPI_ARRAY_LENGTH (AcpiInterfacesSupported); i++) { - if (!ACPI_STRCMP (StringDesc->String.Pointer, AcpiInterfacesSupported[i])) + if (!ACPI_STRCMP (StringDesc->String.Pointer, + AcpiInterfacesSupported[i].Name)) { - /* The interface is supported */ + /* + * The interface is supported. + * Update the OsiData if necessary. We keep track of the latest + * version of Windows that has been requested by the BIOS. + */ + if (AcpiInterfacesSupported[i].Value > AcpiGbl_OsiData) + { + AcpiGbl_OsiData = AcpiInterfacesSupported[i].Value; + } - return_ACPI_STATUS (AE_CTRL_TERMINATE); + ReturnValue = ACPI_UINT32_MAX; + goto Exit; } } @@ -237,13 +251,20 @@ AcpiUtOsiImplementation ( { /* The interface is supported */ - return_ACPI_STATUS (AE_CTRL_TERMINATE); + ReturnValue = ACPI_UINT32_MAX; } - /* The interface is not supported */ - ReturnDesc->Integer.Value = 0; - return_ACPI_STATUS (AE_CTRL_TERMINATE); +Exit: + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, + "ACPI: BIOS _OSI(%s) is %ssupported\n", + StringDesc->String.Pointer, ReturnValue == 0 ? "not " : "")); + + /* Complete the return value */ + + ReturnDesc->Integer.Value = ReturnValue; + WalkState->ReturnDesc = ReturnDesc; + return_ACPI_STATUS (AE_OK); } @@ -291,7 +312,6 @@ AcpiUtEvaluateObject ( Info->PrefixNode = PrefixNode; Info->Pathname = Path; - Info->ParameterType = ACPI_PARAM_ARGS; /* Evaluate the object/method */ @@ -329,7 +349,7 @@ AcpiUtEvaluateObject ( /* Map the return object type to the bitmapped type */ - switch (ACPI_GET_OBJECT_TYPE (Info->ReturnObject)) + switch ((Info->ReturnObject)->Common.Type) { case ACPI_TYPE_INTEGER: ReturnBtype = ACPI_BTYPE_INTEGER; @@ -516,7 +536,7 @@ AcpiUtExecute_HID ( return_ACPI_STATUS (Status); } - if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER) + if (ObjDesc->Common.Type == ACPI_TYPE_INTEGER) { /* Convert the Numeric HID to string */ @@ -561,7 +581,7 @@ AcpiUtTranslateOneCid ( { - switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) + switch (ObjDesc->Common.Type) { case ACPI_TYPE_INTEGER: @@ -616,7 +636,7 @@ AcpiUtExecute_CID ( UINT32 Count; UINT32 Size; ACPI_COMPATIBLE_ID_LIST *CidList; - ACPI_NATIVE_UINT i; + UINT32 i; ACPI_FUNCTION_TRACE (UtExecute_CID); @@ -635,7 +655,7 @@ AcpiUtExecute_CID ( /* Get the number of _CIDs returned */ Count = 1; - if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_PACKAGE) + if (ObjDesc->Common.Type == ACPI_TYPE_PACKAGE) { Count = ObjDesc->Package.Count; } @@ -665,7 +685,7 @@ AcpiUtExecute_CID ( /* The _CID object can be either a single CID or a package (list) of CIDs */ - if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_PACKAGE) + if (ObjDesc->Common.Type == ACPI_TYPE_PACKAGE) { /* Translate each package element */ @@ -739,7 +759,7 @@ AcpiUtExecute_UID ( return_ACPI_STATUS (Status); } - if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER) + if (ObjDesc->Common.Type == ACPI_TYPE_INTEGER) { /* Convert the Numeric UID to string */ diff --git a/sys/contrib/dev/acpica/utglobal.c b/sys/contrib/dev/acpica/utilities/utglobal.c index b83d288c468a..c40a90013847 100644 --- a/sys/contrib/dev/acpica/utglobal.c +++ b/sys/contrib/dev/acpica/utilities/utglobal.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: utglobal - Global variables for the ACPI subsystem - * $Revision: 1.249 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,10 +116,9 @@ #define __UTGLOBAL_C__ #define DEFINE_ACPI_GLOBALS -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acnamesp.h> - -ACPI_EXPORT_SYMBOL (AcpiGbl_FADT) +#include "acpi.h" +#include "accommon.h" +#include "acnamesp.h" #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("utglobal") @@ -263,7 +261,7 @@ const ACPI_PREDEFINED_NAMES AcpiGbl_PreDefinedNames[] = * Properties of the ACPI Object Types, both internal and external. * The table is indexed by values of ACPI_OBJECT_TYPE */ -const UINT8 AcpiGbl_NsProperties[] = +const UINT8 AcpiGbl_NsProperties[ACPI_NUM_NS_TYPES] = { ACPI_NS_NORMAL, /* 00 Any */ ACPI_NS_NORMAL, /* 01 Number */ @@ -356,14 +354,12 @@ ACPI_BIT_REGISTER_INFO AcpiGbl_BitRegisterInfo[ACPI_NUM_BITREG] = /* ACPI_BITREG_POWER_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_POWER_BUTTON_ENABLE, ACPI_BITMASK_POWER_BUTTON_ENABLE}, /* ACPI_BITREG_SLEEP_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE, ACPI_BITMASK_SLEEP_BUTTON_ENABLE}, /* ACPI_BITREG_RT_CLOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_RT_CLOCK_ENABLE, ACPI_BITMASK_RT_CLOCK_ENABLE}, - /* ACPI_BITREG_WAKE_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, 0, 0}, /* ACPI_BITREG_PCIEXP_WAKE_DISABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE, ACPI_BITMASK_PCIEXP_WAKE_DISABLE}, /* ACPI_BITREG_SCI_ENABLE */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_SCI_ENABLE, ACPI_BITMASK_SCI_ENABLE}, /* ACPI_BITREG_BUS_MASTER_RLD */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_BUS_MASTER_RLD, ACPI_BITMASK_BUS_MASTER_RLD}, /* ACPI_BITREG_GLOBAL_LOCK_RELEASE */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE, ACPI_BITMASK_GLOBAL_LOCK_RELEASE}, - /* ACPI_BITREG_SLEEP_TYPE_A */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_SLEEP_TYPE_X, ACPI_BITMASK_SLEEP_TYPE_X}, - /* ACPI_BITREG_SLEEP_TYPE_B */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_SLEEP_TYPE_X, ACPI_BITMASK_SLEEP_TYPE_X}, + /* ACPI_BITREG_SLEEP_TYPE */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_SLEEP_TYPE, ACPI_BITMASK_SLEEP_TYPE}, /* ACPI_BITREG_SLEEP_ENABLE */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_SLEEP_ENABLE, ACPI_BITMASK_SLEEP_ENABLE}, /* ACPI_BITREG_ARB_DIS */ {ACPI_REGISTER_PM2_CONTROL, ACPI_BITPOSITION_ARB_DISABLE, ACPI_BITMASK_ARB_DISABLE} @@ -400,7 +396,7 @@ const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] = "PCI_Config", "EmbeddedControl", "SMBus", - "CMOS", + "SystemCMOS", "PCIBARTarget", "DataTable" }; @@ -546,7 +542,7 @@ AcpiUtGetObjectTypeName ( return ("[NULL Object Descriptor]"); } - return (AcpiUtGetTypeName (ACPI_GET_OBJECT_TYPE (ObjDesc))); + return (AcpiUtGetTypeName (ObjDesc->Common.Type)); } @@ -591,12 +587,11 @@ AcpiUtGetNodeName ( return ("####"); } - /* Name must be a valid ACPI name */ - - if (!AcpiUtValidAcpiName (Node->Name.Integer)) - { - Node->Name.Integer = AcpiUtRepairName (Node->Name.Ascii); - } + /* + * Ensure name is valid. The name was validated/repaired when the node + * was created, but make sure it has not been corrupted. + */ + AcpiUtRepairName (Node->Name.Ascii); /* Return the name */ @@ -660,6 +655,60 @@ AcpiUtGetDescriptorName ( } +/******************************************************************************* + * + * FUNCTION: AcpiUtGetReferenceName + * + * PARAMETERS: Object - An ACPI reference object + * + * RETURN: Pointer to a string + * + * DESCRIPTION: Decode a reference object sub-type to a string. + * + ******************************************************************************/ + +/* Printable names of reference object sub-types */ + +static const char *AcpiGbl_RefClassNames[] = +{ + /* 00 */ "Local", + /* 01 */ "Argument", + /* 02 */ "RefOf", + /* 03 */ "Index", + /* 04 */ "DdbHandle", + /* 05 */ "Named Object", + /* 06 */ "Debug" +}; + +const char * +AcpiUtGetReferenceName ( + ACPI_OPERAND_OBJECT *Object) +{ + + if (!Object) + { + return ("NULL Object"); + } + + if (ACPI_GET_DESCRIPTOR_TYPE (Object) != ACPI_DESC_TYPE_OPERAND) + { + return ("Not an Operand object"); + } + + if (Object->Common.Type != ACPI_TYPE_LOCAL_REFERENCE) + { + return ("Not a Reference object"); + } + + if (Object->Reference.Class > ACPI_REFCLASS_MAX) + { + return ("Unknown Reference class"); + } + + return (AcpiGbl_RefClassNames[Object->Reference.Class]); +} + + #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) /* * Strings and procedures used for debug only @@ -690,6 +739,56 @@ AcpiUtGetMutexName ( return (AcpiGbl_MutexNames[MutexId]); } + + +/******************************************************************************* + * + * FUNCTION: AcpiUtGetNotifyName + * + * PARAMETERS: NotifyValue - Value from the Notify() request + * + * RETURN: String corresponding to the Notify Value. + * + * DESCRIPTION: Translate a Notify Value to a notify namestring. + * + ******************************************************************************/ + +/* Names for Notify() values, used for debug output */ + +static const char *AcpiGbl_NotifyValueNames[] = +{ + "Bus Check", + "Device Check", + "Device Wake", + "Eject Request", + "Device Check Light", + "Frequency Mismatch", + "Bus Mode Mismatch", + "Power Fault", + "Capabilities Check", + "Device PLD Check", + "Reserved", + "System Locality Update" +}; + +const char * +AcpiUtGetNotifyName ( + UINT32 NotifyValue) +{ + + if (NotifyValue <= ACPI_NOTIFY_MAX) + { + return (AcpiGbl_NotifyValueNames[NotifyValue]); + } + else if (NotifyValue <= ACPI_MAX_SYS_NOTIFY) + { + return ("Reserved"); + } + else /* Greater or equal to 0x80 */ + { + return ("**Device Specific**"); + } +} #endif @@ -727,14 +826,14 @@ AcpiUtValidObjectType ( * * PARAMETERS: None * - * RETURN: None + * RETURN: Status * * DESCRIPTION: Init library globals. All globals that require specific * initialization should be initialized here! * ******************************************************************************/ -void +ACPI_STATUS AcpiUtInitGlobals ( void) { @@ -750,7 +849,7 @@ AcpiUtInitGlobals ( Status = AcpiUtCreateCaches (); if (ACPI_FAILURE (Status)) { - return; + return_ACPI_STATUS (Status); } /* Mutex locked flags */ @@ -766,21 +865,36 @@ AcpiUtInitGlobals ( { AcpiGbl_OwnerIdMask[i] = 0; } - AcpiGbl_OwnerIdMask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000; /* Last ID is never valid */ - /* GPE support */ + /* Last OwnerID is never valid */ + AcpiGbl_OwnerIdMask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000; + + /* Event counters */ + + AcpiMethodCount = 0; + AcpiSciCount = 0; AcpiGpeCount = 0; + + for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) + { + AcpiFixedEventCount[i] = 0; + } + + /* GPE support */ + AcpiGbl_GpeXruptListHead = NULL; AcpiGbl_GpeFadtBlocks[0] = NULL; AcpiGbl_GpeFadtBlocks[1] = NULL; + AcpiCurrentGpeCount = 0; - /* Global notify handlers */ + /* Global handlers */ AcpiGbl_SystemNotify.Handler = NULL; AcpiGbl_DeviceNotify.Handler = NULL; AcpiGbl_ExceptionHandler = NULL; AcpiGbl_InitHandler = NULL; + AcpiGbl_TableHandler = NULL; /* Global Lock support */ @@ -788,6 +902,7 @@ AcpiUtInitGlobals ( AcpiGbl_GlobalLockMutex = NULL; AcpiGbl_GlobalLockAcquired = FALSE; AcpiGbl_GlobalLockHandle = 0; + AcpiGbl_GlobalLockPresent = FALSE; /* Miscellaneous variables */ @@ -804,6 +919,7 @@ AcpiUtInitGlobals ( AcpiGbl_TraceDbgLayer = 0; AcpiGbl_DebuggerConfiguration = DEBUGGER_THREADING; AcpiGbl_DbOutputFlags = ACPI_DB_CONSOLE_OUTPUT; + AcpiGbl_OsiData = 0; /* Hardware oriented */ @@ -823,20 +939,22 @@ AcpiUtInitGlobals ( #ifdef ACPI_DEBUG_OUTPUT - AcpiGbl_LowestStackPointer = ACPI_SIZE_MAX; + AcpiGbl_LowestStackPointer = ACPI_CAST_PTR (ACPI_SIZE, ACPI_SIZE_MAX); #endif #ifdef ACPI_DBG_TRACK_ALLOCATIONS AcpiGbl_DisplayFinalMemStats = FALSE; #endif - return_VOID; + return_ACPI_STATUS (AE_OK); } /* Public globals */ +ACPI_EXPORT_SYMBOL (AcpiGbl_FADT) ACPI_EXPORT_SYMBOL (AcpiDbgLevel) ACPI_EXPORT_SYMBOL (AcpiDbgLayer) ACPI_EXPORT_SYMBOL (AcpiGpeCount) +ACPI_EXPORT_SYMBOL (AcpiCurrentGpeCount) diff --git a/sys/contrib/dev/acpica/utinit.c b/sys/contrib/dev/acpica/utilities/utinit.c index b16d5423eba8..8e8a83b354d2 100644 --- a/sys/contrib/dev/acpica/utinit.c +++ b/sys/contrib/dev/acpica/utilities/utinit.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: utinit - Common ACPI subsystem initialization - * $Revision: 1.135 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,10 +116,11 @@ #define __UTINIT_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/acevents.h> -#include <contrib/dev/acpica/actables.h> +#include "acpi.h" +#include "accommon.h" +#include "acnamesp.h" +#include "acevents.h" +#include "actables.h" #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("utinit") @@ -216,9 +216,12 @@ AcpiUtSubsystemShutdown ( ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Shutting down ACPI Subsystem\n")); +#ifndef ACPI_ASL_COMPILER + /* Close the AcpiEvent Handling */ AcpiEvTerminate (); +#endif /* Close the Namespace */ diff --git a/sys/contrib/dev/acpica/utilities/utlock.c b/sys/contrib/dev/acpica/utilities/utlock.c new file mode 100644 index 000000000000..dd4e100001af --- /dev/null +++ b/sys/contrib/dev/acpica/utilities/utlock.c @@ -0,0 +1,277 @@ +/****************************************************************************** + * + * Module Name: utlock - Reader/Writer lock interfaces + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2009, 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 __UTLOCK_C__ + +#include "acpi.h" +#include "accommon.h" + + +#define _COMPONENT ACPI_UTILITIES + ACPI_MODULE_NAME ("utlock") + + +/******************************************************************************* + * + * FUNCTION: AcpiUtCreateRwLock + * AcpiUtDeleteRwLock + * + * PARAMETERS: Lock - Pointer to a valid RW lock + * + * RETURN: Status + * + * DESCRIPTION: Reader/writer lock creation and deletion interfaces. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiUtCreateRwLock ( + ACPI_RW_LOCK *Lock) +{ + ACPI_STATUS Status; + + + Lock->NumReaders = 0; + Status = AcpiOsCreateMutex (&Lock->ReaderMutex); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + Status = AcpiOsCreateMutex (&Lock->WriterMutex); + return (Status); +} + + +void +AcpiUtDeleteRwLock ( + ACPI_RW_LOCK *Lock) +{ + + AcpiOsDeleteMutex (Lock->ReaderMutex); + AcpiOsDeleteMutex (Lock->WriterMutex); + + Lock->NumReaders = 0; + Lock->ReaderMutex = NULL; + Lock->WriterMutex = NULL; +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtAcquireReadLock + * AcpiUtReleaseReadLock + * + * PARAMETERS: Lock - Pointer to a valid RW lock + * + * RETURN: Status + * + * DESCRIPTION: Reader interfaces for reader/writer locks. On acquisition, + * only the first reader acquires the write mutex. On release, + * only the last reader releases the write mutex. Although this + * algorithm can in theory starve writers, this should not be a + * problem with ACPICA since the subsystem is infrequently used + * in comparison to (for example) an I/O system. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiUtAcquireReadLock ( + ACPI_RW_LOCK *Lock) +{ + ACPI_STATUS Status; + + + Status = AcpiOsAcquireMutex (Lock->ReaderMutex, ACPI_WAIT_FOREVER); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* Acquire the write lock only for the first reader */ + + Lock->NumReaders++; + if (Lock->NumReaders == 1) + { + Status = AcpiOsAcquireMutex (Lock->WriterMutex, ACPI_WAIT_FOREVER); + } + + AcpiOsReleaseMutex (Lock->ReaderMutex); + return (Status); +} + + +ACPI_STATUS +AcpiUtReleaseReadLock ( + ACPI_RW_LOCK *Lock) +{ + ACPI_STATUS Status; + + + Status = AcpiOsAcquireMutex (Lock->ReaderMutex, ACPI_WAIT_FOREVER); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* Release the write lock only for the very last reader */ + + Lock->NumReaders--; + if (Lock->NumReaders == 0) + { + AcpiOsReleaseMutex (Lock->WriterMutex); + } + + AcpiOsReleaseMutex (Lock->ReaderMutex); + return (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtAcquireWriteLock + * AcpiUtReleaseWriteLock + * + * PARAMETERS: Lock - Pointer to a valid RW lock + * + * RETURN: Status + * + * DESCRIPTION: Writer interfaces for reader/writer locks. Simply acquire or + * release the writer mutex associated with the lock. Acquisition + * of the lock is fully exclusive and will block all readers and + * writers until it is released. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiUtAcquireWriteLock ( + ACPI_RW_LOCK *Lock) +{ + ACPI_STATUS Status; + + + Status = AcpiOsAcquireMutex (Lock->WriterMutex, ACPI_WAIT_FOREVER); + return (Status); +} + + +void +AcpiUtReleaseWriteLock ( + ACPI_RW_LOCK *Lock) +{ + + AcpiOsReleaseMutex (Lock->WriterMutex); +} + diff --git a/sys/contrib/dev/acpica/utmath.c b/sys/contrib/dev/acpica/utilities/utmath.c index f6dad738abc1..b0a40ff2bcfd 100644 --- a/sys/contrib/dev/acpica/utmath.c +++ b/sys/contrib/dev/acpica/utilities/utmath.c @@ -1,7 +1,6 @@ /******************************************************************************* * * Module Name: utmath - Integer math support routines - * $Revision: 1.22 $ * ******************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,7 +116,8 @@ #define __UTMATH_C__ -#include <contrib/dev/acpica/acpi.h> +#include "acpi.h" +#include "accommon.h" #define _COMPONENT ACPI_UTILITIES @@ -387,7 +387,7 @@ AcpiUtShortDivide ( } if (OutRemainder) { - *OutRemainder = (UINT32) InDividend % Divisor; + *OutRemainder = (UINT32) (InDividend % Divisor); } return_ACPI_STATUS (AE_OK); diff --git a/sys/contrib/dev/acpica/utmisc.c b/sys/contrib/dev/acpica/utilities/utmisc.c index f1585da587e4..20b3a9533f35 100644 --- a/sys/contrib/dev/acpica/utmisc.c +++ b/sys/contrib/dev/acpica/utilities/utmisc.c @@ -1,7 +1,6 @@ /******************************************************************************* * * Module Name: utmisc - common utility procedures - * $Revision: 1.151 $ * ******************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,8 +116,9 @@ #define __UTMISC_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acnamesp.h> +#include "acpi.h" +#include "accommon.h" +#include "acnamesp.h" #define _COMPONENT ACPI_UTILITIES @@ -143,7 +143,7 @@ const char * AcpiUtValidateException ( ACPI_STATUS Status) { - ACPI_STATUS SubStatus; + UINT32 SubStatus; const char *Exception = NULL; @@ -169,7 +169,7 @@ AcpiUtValidateException ( if (SubStatus <= AE_CODE_PGM_MAX) { - Exception = AcpiGbl_ExceptionNames_Pgm [SubStatus -1]; + Exception = AcpiGbl_ExceptionNames_Pgm [SubStatus]; } break; @@ -177,7 +177,7 @@ AcpiUtValidateException ( if (SubStatus <= AE_CODE_TBL_MAX) { - Exception = AcpiGbl_ExceptionNames_Tbl [SubStatus -1]; + Exception = AcpiGbl_ExceptionNames_Tbl [SubStatus]; } break; @@ -185,7 +185,7 @@ AcpiUtValidateException ( if (SubStatus <= AE_CODE_AML_MAX) { - Exception = AcpiGbl_ExceptionNames_Aml [SubStatus -1]; + Exception = AcpiGbl_ExceptionNames_Aml [SubStatus]; } break; @@ -193,7 +193,7 @@ AcpiUtValidateException ( if (SubStatus <= AE_CODE_CTRL_MAX) { - Exception = AcpiGbl_ExceptionNames_Ctrl [SubStatus -1]; + Exception = AcpiGbl_ExceptionNames_Ctrl [SubStatus]; } break; @@ -255,9 +255,9 @@ ACPI_STATUS AcpiUtAllocateOwnerId ( ACPI_OWNER_ID *OwnerId) { - ACPI_NATIVE_UINT i; - ACPI_NATIVE_UINT j; - ACPI_NATIVE_UINT k; + UINT32 i; + UINT32 j; + UINT32 k; ACPI_STATUS Status; @@ -372,7 +372,7 @@ AcpiUtReleaseOwnerId ( { ACPI_OWNER_ID OwnerId = *OwnerIdPtr; ACPI_STATUS Status; - ACPI_NATIVE_UINT Index; + UINT32 Index; UINT32 Bit; @@ -740,7 +740,7 @@ AcpiUtDisplayInitPathname ( BOOLEAN AcpiUtValidAcpiChar ( char Character, - ACPI_NATIVE_UINT Position) + UINT32 Position) { if (!((Character >= 'A' && Character <= 'Z') || @@ -780,7 +780,7 @@ BOOLEAN AcpiUtValidAcpiName ( UINT32 Name) { - ACPI_NATIVE_UINT i; + UINT32 i; ACPI_FUNCTION_ENTRY (); @@ -807,34 +807,63 @@ AcpiUtValidAcpiName ( * RETURN: Repaired version of the name * * DESCRIPTION: Repair an ACPI name: Change invalid characters to '*' and - * return the new name. + * return the new name. NOTE: the Name parameter must reside in + * read/write memory, cannot be a const. + * + * An ACPI Name must consist of valid ACPI characters. We will repair the name + * if necessary because we don't want to abort because of this, but we want + * all namespace names to be printable. A warning message is appropriate. + * + * This issue came up because there are in fact machines that exhibit + * this problem, and we want to be able to enable ACPI support for them, + * even though there are a few bad names. * ******************************************************************************/ -ACPI_NAME +void AcpiUtRepairName ( char *Name) { - ACPI_NATIVE_UINT i; - char NewName[ACPI_NAME_SIZE]; + UINT32 i; + BOOLEAN FoundBadChar = FALSE; + + ACPI_FUNCTION_NAME (UtRepairName); + + + /* Check each character in the name */ for (i = 0; i < ACPI_NAME_SIZE; i++) { - NewName[i] = Name[i]; + if (AcpiUtValidAcpiChar (Name[i], i)) + { + continue; + } /* * Replace a bad character with something printable, yet technically * still invalid. This prevents any collisions with existing "good" * names in the namespace. */ - if (!AcpiUtValidAcpiChar (Name[i], i)) + Name[i] = '*'; + FoundBadChar = TRUE; + } + + if (FoundBadChar) + { + /* Report warning only if in strict mode or debug mode */ + + if (!AcpiGbl_EnableInterpreterSlack) { - NewName[i] = '*'; + ACPI_WARNING ((AE_INFO, + "Found bad character(s) in name, repaired: [%4.4s]\n", Name)); + } + else + { + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, + "Found bad character(s) in name, repaired: [%4.4s]\n", Name)); } } - - return (*(UINT32 *) NewName); } @@ -1147,7 +1176,7 @@ AcpiUtWalkPackageTree ( */ if ((!ThisSourceObj) || (ACPI_GET_DESCRIPTOR_TYPE (ThisSourceObj) != ACPI_DESC_TYPE_OPERAND) || - (ACPI_GET_OBJECT_TYPE (ThisSourceObj) != ACPI_TYPE_PACKAGE)) + (ThisSourceObj->Common.Type != ACPI_TYPE_PACKAGE)) { Status = WalkCallback (ACPI_COPY_TYPE_SIMPLE, ThisSourceObj, State, Context); @@ -1208,6 +1237,13 @@ AcpiUtWalkPackageTree ( State->Pkg.ThisTargetObj, 0); if (!State) { + /* Free any stacked Update State objects */ + + while (StateList) + { + State = AcpiUtPopGenericState (&StateList); + AcpiUtDeleteGenericState (State); + } return_ACPI_STATUS (AE_NO_MEMORY); } } @@ -1221,7 +1257,7 @@ AcpiUtWalkPackageTree ( /******************************************************************************* * - * FUNCTION: AcpiUtError, AcpiUtWarning, AcpiUtInfo + * FUNCTION: AcpiError, AcpiException, AcpiWarning, AcpiInfo * * PARAMETERS: ModuleName - Caller's module name (for error output) * LineNumber - Caller's line number (for error output) @@ -1234,63 +1270,65 @@ AcpiUtWalkPackageTree ( ******************************************************************************/ void ACPI_INTERNAL_VAR_XFACE -AcpiUtError ( - char *ModuleName, +AcpiError ( + const char *ModuleName, UINT32 LineNumber, - char *Format, + const char *Format, ...) { va_list args; - AcpiOsPrintf ("ACPI Error (%s-%04d): ", ModuleName, LineNumber); + AcpiOsPrintf ("ACPI Error: "); va_start (args, Format); AcpiOsVprintf (Format, args); - AcpiOsPrintf (" [%X]\n", ACPI_CA_VERSION); + AcpiOsPrintf (" %8.8X %s-%u\n", ACPI_CA_VERSION, ModuleName, LineNumber); + va_end (args); } void ACPI_INTERNAL_VAR_XFACE -AcpiUtException ( - char *ModuleName, +AcpiException ( + const char *ModuleName, UINT32 LineNumber, ACPI_STATUS Status, - char *Format, + const char *Format, ...) { va_list args; - AcpiOsPrintf ("ACPI Exception (%s-%04d): %s, ", ModuleName, LineNumber, - AcpiFormatException (Status)); + AcpiOsPrintf ("ACPI Exception: %s, ", AcpiFormatException (Status)); va_start (args, Format); AcpiOsVprintf (Format, args); - AcpiOsPrintf (" [%X]\n", ACPI_CA_VERSION); + AcpiOsPrintf (" %8.8X %s-%u\n", ACPI_CA_VERSION, ModuleName, LineNumber); + va_end (args); } void ACPI_INTERNAL_VAR_XFACE -AcpiUtWarning ( - char *ModuleName, +AcpiWarning ( + const char *ModuleName, UINT32 LineNumber, - char *Format, + const char *Format, ...) { va_list args; - AcpiOsPrintf ("ACPI Warning (%s-%04d): ", ModuleName, LineNumber); + AcpiOsPrintf ("ACPI Warning: "); va_start (args, Format); AcpiOsVprintf (Format, args); - AcpiOsPrintf (" [%X]\n", ACPI_CA_VERSION); + AcpiOsPrintf (" %8.8X %s-%u\n", ACPI_CA_VERSION, ModuleName, LineNumber); + va_end (args); } void ACPI_INTERNAL_VAR_XFACE -AcpiUtInfo ( - char *ModuleName, +AcpiInfo ( + const char *ModuleName, UINT32 LineNumber, - char *Format, + const char *Format, ...) { va_list args; @@ -1301,14 +1339,17 @@ AcpiUtInfo ( return; #endif - /* - * Removed ModuleName, LineNumber, and acpica version, not needed - * for info output - */ AcpiOsPrintf ("ACPI: "); va_start (args, Format); AcpiOsVprintf (Format, args); AcpiOsPrintf ("\n"); + va_end (args); } +ACPI_EXPORT_SYMBOL (AcpiError) +ACPI_EXPORT_SYMBOL (AcpiException) +ACPI_EXPORT_SYMBOL (AcpiWarning) +ACPI_EXPORT_SYMBOL (AcpiInfo) + + diff --git a/sys/contrib/dev/acpica/utmutex.c b/sys/contrib/dev/acpica/utilities/utmutex.c index 701d26951d1c..f6e7cc36522d 100644 --- a/sys/contrib/dev/acpica/utmutex.c +++ b/sys/contrib/dev/acpica/utilities/utmutex.c @@ -1,7 +1,6 @@ /******************************************************************************* * * Module Name: utmutex - local mutex support - * $Revision: 1.12 $ * ******************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,7 +116,8 @@ #define __UTMUTEX_C__ -#include <contrib/dev/acpica/acpi.h> +#include "acpi.h" +#include "accommon.h" #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("utmutex") @@ -141,7 +141,8 @@ AcpiUtDeleteMutex ( * * RETURN: Status * - * DESCRIPTION: Create the system mutex objects. + * DESCRIPTION: Create the system mutex objects. This includes mutexes, + * spin locks, and reader/writer locks. * ******************************************************************************/ @@ -156,9 +157,8 @@ AcpiUtMutexInitialize ( ACPI_FUNCTION_TRACE (UtMutexInitialize); - /* - * Create each of the predefined mutex objects - */ + /* Create each of the predefined mutex objects */ + for (i = 0; i < ACPI_NUM_MUTEX; i++) { Status = AcpiUtCreateMutex (i); @@ -177,6 +177,14 @@ AcpiUtMutexInitialize ( } Status = AcpiOsCreateLock (&AcpiGbl_HardwareLock); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* Create the reader/writer lock for namespace access */ + + Status = AcpiUtCreateRwLock (&AcpiGbl_NamespaceRwLock); return_ACPI_STATUS (Status); } @@ -189,7 +197,8 @@ AcpiUtMutexInitialize ( * * RETURN: None. * - * DESCRIPTION: Delete all of the system mutex objects. + * DESCRIPTION: Delete all of the system mutex objects. This includes mutexes, + * spin locks, and reader/writer locks. * ******************************************************************************/ @@ -203,9 +212,8 @@ AcpiUtMutexTerminate ( ACPI_FUNCTION_TRACE (UtMutexTerminate); - /* - * Delete each predefined mutex object - */ + /* Delete each predefined mutex object */ + for (i = 0; i < ACPI_NUM_MUTEX; i++) { (void) AcpiUtDeleteMutex (i); @@ -215,6 +223,10 @@ AcpiUtMutexTerminate ( AcpiOsDeleteLock (AcpiGbl_GpeLock); AcpiOsDeleteLock (AcpiGbl_HardwareLock); + + /* Delete the reader/writer lock */ + + AcpiUtDeleteRwLock (&AcpiGbl_NamespaceRwLock); return_VOID; } @@ -332,22 +344,23 @@ AcpiUtAcquireMutex ( * the mutex ordering rule. This indicates a coding error somewhere in * the ACPI subsystem code. */ - for (i = MutexId; i < ACPI_MAX_MUTEX; i++) + for (i = MutexId; i < ACPI_NUM_MUTEX; i++) { if (AcpiGbl_MutexInfo[i].ThreadId == ThisThreadId) { if (i == MutexId) { ACPI_ERROR ((AE_INFO, - "Mutex [%s] already acquired by this thread [%X]", - AcpiUtGetMutexName (MutexId), ThisThreadId)); + "Mutex [%s] already acquired by this thread [%p]", + AcpiUtGetMutexName (MutexId), + ACPI_CAST_PTR (void, ThisThreadId))); return (AE_ALREADY_ACQUIRED); } ACPI_ERROR ((AE_INFO, - "Invalid acquire order: Thread %X owns [%s], wants [%s]", - ThisThreadId, AcpiUtGetMutexName (i), + "Invalid acquire order: Thread %p owns [%s], wants [%s]", + ACPI_CAST_PTR (void, ThisThreadId), AcpiUtGetMutexName (i), AcpiUtGetMutexName (MutexId))); return (AE_ACQUIRE_DEADLOCK); @@ -357,15 +370,15 @@ AcpiUtAcquireMutex ( #endif ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, - "Thread %X attempting to acquire Mutex [%s]\n", - ThisThreadId, AcpiUtGetMutexName (MutexId))); + "Thread %p attempting to acquire Mutex [%s]\n", + ACPI_CAST_PTR (void, ThisThreadId), AcpiUtGetMutexName (MutexId))); Status = AcpiOsAcquireMutex (AcpiGbl_MutexInfo[MutexId].Mutex, ACPI_WAIT_FOREVER); if (ACPI_SUCCESS (Status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X acquired Mutex [%s]\n", - ThisThreadId, AcpiUtGetMutexName (MutexId))); + ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %p acquired Mutex [%s]\n", + ACPI_CAST_PTR (void, ThisThreadId), AcpiUtGetMutexName (MutexId))); AcpiGbl_MutexInfo[MutexId].UseCount++; AcpiGbl_MutexInfo[MutexId].ThreadId = ThisThreadId; @@ -373,7 +386,8 @@ AcpiUtAcquireMutex ( else { ACPI_EXCEPTION ((AE_INFO, Status, - "Thread %X could not acquire Mutex [%X]", ThisThreadId, MutexId)); + "Thread %p could not acquire Mutex [%X]", + ACPI_CAST_PTR (void, ThisThreadId), MutexId)); } return (Status); @@ -403,9 +417,8 @@ AcpiUtReleaseMutex ( ThisThreadId = AcpiOsGetThreadId (); - ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, - "Thread %X releasing Mutex [%s]\n", ThisThreadId, - AcpiUtGetMutexName (MutexId))); + ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %p releasing Mutex [%s]\n", + ACPI_CAST_PTR (void, ThisThreadId), AcpiUtGetMutexName (MutexId))); if (MutexId > ACPI_MAX_MUTEX) { @@ -434,7 +447,7 @@ AcpiUtReleaseMutex ( * ordering rule. This indicates a coding error somewhere in * the ACPI subsystem code. */ - for (i = MutexId; i < ACPI_MAX_MUTEX; i++) + for (i = MutexId; i < ACPI_NUM_MUTEX; i++) { if (AcpiGbl_MutexInfo[i].ThreadId == ThisThreadId) { diff --git a/sys/contrib/dev/acpica/utobject.c b/sys/contrib/dev/acpica/utilities/utobject.c index 5b0c3f320044..e38d2b28799e 100644 --- a/sys/contrib/dev/acpica/utobject.c +++ b/sys/contrib/dev/acpica/utilities/utobject.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: utobject - ACPI object create/delete/size/cache routines - * $Revision: 1.104 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -116,9 +115,9 @@ #define __UTOBJECT_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/amlcode.h> +#include "acpi.h" +#include "accommon.h" +#include "acnamesp.h" #define _COMPONENT ACPI_UTILITIES @@ -167,7 +166,7 @@ AcpiUtGetElementLength ( ACPI_OPERAND_OBJECT * AcpiUtCreateInternalObjectDbg ( - char *ModuleName, + const char *ModuleName, UINT32 LineNumber, UINT32 ComponentId, ACPI_OBJECT_TYPE Type) @@ -192,6 +191,7 @@ AcpiUtCreateInternalObjectDbg ( { case ACPI_TYPE_REGION: case ACPI_TYPE_BUFFER_FIELD: + case ACPI_TYPE_LOCAL_BANK_FIELD: /* These types require a secondary object */ @@ -232,6 +232,55 @@ AcpiUtCreateInternalObjectDbg ( /******************************************************************************* * + * FUNCTION: AcpiUtCreatePackageObject + * + * PARAMETERS: Count - Number of package elements + * + * RETURN: Pointer to a new Package object, null on failure + * + * DESCRIPTION: Create a fully initialized package object + * + ******************************************************************************/ + +ACPI_OPERAND_OBJECT * +AcpiUtCreatePackageObject ( + UINT32 Count) +{ + ACPI_OPERAND_OBJECT *PackageDesc; + ACPI_OPERAND_OBJECT **PackageElements; + + + ACPI_FUNCTION_TRACE_U32 (UtCreatePackageObject, Count); + + + /* Create a new Package object */ + + PackageDesc = AcpiUtCreateInternalObject (ACPI_TYPE_PACKAGE); + if (!PackageDesc) + { + return_PTR (NULL); + } + + /* + * Create the element array. Count+1 allows the array to be null + * terminated. + */ + PackageElements = ACPI_ALLOCATE_ZEROED ( + ((ACPI_SIZE) Count + 1) * sizeof (void *)); + if (!PackageElements) + { + ACPI_FREE (PackageDesc); + return_PTR (NULL); + } + + PackageDesc->Package.Count = Count; + PackageDesc->Package.Elements = PackageElements; + return_PTR (PackageDesc); +} + + +/******************************************************************************* + * * FUNCTION: AcpiUtCreateBufferObject * * PARAMETERS: BufferSize - Size of buffer to be created @@ -370,7 +419,7 @@ AcpiUtValidInternalObject ( if (!Object) { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** Null Object Ptr\n")); + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "**** Null Object Ptr\n")); return (FALSE); } @@ -385,7 +434,7 @@ AcpiUtValidInternalObject ( return (TRUE); default: - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p is not not an ACPI operand obj [%s]\n", Object, AcpiUtGetDescriptorName (Object))); break; @@ -412,7 +461,7 @@ AcpiUtValidInternalObject ( void * AcpiUtAllocateObjectDescDbg ( - char *ModuleName, + const char *ModuleName, UINT32 LineNumber, UINT32 ComponentId) { @@ -499,32 +548,36 @@ AcpiUtGetSimpleObjectSize ( ACPI_SIZE *ObjLength) { ACPI_SIZE Length; + ACPI_SIZE Size; ACPI_STATUS Status = AE_OK; ACPI_FUNCTION_TRACE_PTR (UtGetSimpleObjectSize, InternalObject); - /* - * Handle a null object (Could be a uninitialized package - * element -- which is legal) - */ + /* Start with the length of the (external) Acpi object */ + + Length = sizeof (ACPI_OBJECT); + + /* A NULL object is allowed, can be a legal uninitialized package element */ + if (!InternalObject) { - *ObjLength = 0; + /* + * Object is NULL, just return the length of ACPI_OBJECT + * (A NULL ACPI_OBJECT is an object of all zeroes.) + */ + *ObjLength = ACPI_ROUND_UP_TO_NATIVE_WORD (Length); return_ACPI_STATUS (AE_OK); } - /* Start with the length of the Acpi object */ - - Length = sizeof (ACPI_OBJECT); + /* A Namespace Node should never appear here */ if (ACPI_GET_DESCRIPTOR_TYPE (InternalObject) == ACPI_DESC_TYPE_NAMED) { - /* Object is a named object (reference), just return the length */ + /* A namespace node should never get here */ - *ObjLength = ACPI_ROUND_UP_TO_NATIVE_WORD (Length); - return_ACPI_STATUS (Status); + return_ACPI_STATUS (AE_AML_INTERNAL); } /* @@ -533,7 +586,7 @@ AcpiUtGetSimpleObjectSize ( * must be accessed bytewise or there may be alignment problems on * certain processors */ - switch (ACPI_GET_OBJECT_TYPE (InternalObject)) + switch (InternalObject->Common.Type) { case ACPI_TYPE_STRING: @@ -551,24 +604,28 @@ AcpiUtGetSimpleObjectSize ( case ACPI_TYPE_PROCESSOR: case ACPI_TYPE_POWER: - /* - * No extra data for these types - */ + /* No extra data for these types */ + break; case ACPI_TYPE_LOCAL_REFERENCE: - switch (InternalObject->Reference.Opcode) + switch (InternalObject->Reference.Class) { - case AML_INT_NAMEPATH_OP: + case ACPI_REFCLASS_NAME: /* * Get the actual length of the full pathname to this object. * The reference will be converted to the pathname to the object */ - Length += ACPI_ROUND_UP_TO_NATIVE_WORD ( - AcpiNsGetPathnameLength (InternalObject->Reference.Node)); + Size = AcpiNsGetPathnameLength (InternalObject->Reference.Node); + if (!Size) + { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + + Length += ACPI_ROUND_UP_TO_NATIVE_WORD (Size); break; default: @@ -578,9 +635,10 @@ AcpiUtGetSimpleObjectSize ( * Notably, Locals and Args are not supported, but this may be * required eventually. */ - ACPI_ERROR ((AE_INFO, - "Unsupported Reference opcode=%X in object %p", - InternalObject->Reference.Opcode, InternalObject)); + ACPI_ERROR ((AE_INFO, "Cannot convert to external object - " + "unsupported Reference Class [%s] %X in object %p", + AcpiUtGetReferenceName (InternalObject), + InternalObject->Reference.Class, InternalObject)); Status = AE_TYPE; break; } @@ -589,8 +647,10 @@ AcpiUtGetSimpleObjectSize ( default: - ACPI_ERROR ((AE_INFO, "Unsupported type=%X in object %p", - ACPI_GET_OBJECT_TYPE (InternalObject), InternalObject)); + ACPI_ERROR ((AE_INFO, "Cannot convert to external object - " + "unsupported type [%s] %X in object %p", + AcpiUtGetObjectTypeName (InternalObject), + InternalObject->Common.Type, InternalObject)); Status = AE_TYPE; break; } @@ -749,7 +809,7 @@ AcpiUtGetObjectSize ( if ((ACPI_GET_DESCRIPTOR_TYPE (InternalObject) == ACPI_DESC_TYPE_OPERAND) && - (ACPI_GET_OBJECT_TYPE (InternalObject) == ACPI_TYPE_PACKAGE)) + (InternalObject->Common.Type == ACPI_TYPE_PACKAGE)) { Status = AcpiUtGetPackageObjectSize (InternalObject, ObjLength); } diff --git a/sys/contrib/dev/acpica/utresrc.c b/sys/contrib/dev/acpica/utilities/utresrc.c index 530f782ae713..2f19d639868c 100644 --- a/sys/contrib/dev/acpica/utresrc.c +++ b/sys/contrib/dev/acpica/utilities/utresrc.c @@ -1,7 +1,6 @@ /******************************************************************************* * * Module Name: utresrc - Resource managment utilities - * $Revision: 1.14 $ * ******************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,8 +116,9 @@ #define __UTRESRC_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/amlresrc.h> +#include "acpi.h" +#include "accommon.h" +#include "amlresrc.h" #define _COMPONENT ACPI_UTILITIES diff --git a/sys/contrib/dev/acpica/utstate.c b/sys/contrib/dev/acpica/utilities/utstate.c index a58257bc0bd7..245ca02bfc5e 100644 --- a/sys/contrib/dev/acpica/utstate.c +++ b/sys/contrib/dev/acpica/utilities/utstate.c @@ -1,7 +1,6 @@ /******************************************************************************* * * Module Name: utstate - state object support procedures - * $Revision: 1.8 $ * ******************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,7 +116,8 @@ #define __UTSTATE_C__ -#include <contrib/dev/acpica/acpi.h> +#include "acpi.h" +#include "accommon.h" #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("utstate") @@ -302,7 +302,7 @@ AcpiUtCreateThreadState ( if (!State->Thread.ThreadId) { ACPI_ERROR ((AE_INFO, "Invalid zero ID from AcpiOsGetThreadId")); - State->Thread.ThreadId = 1; + State->Thread.ThreadId = (ACPI_THREAD_ID) 1; } return_PTR ((ACPI_THREAD_STATE *) State); diff --git a/sys/contrib/dev/acpica/uttrack.c b/sys/contrib/dev/acpica/utilities/uttrack.c index 5c2ae9380403..d712c1a3e5ab 100644 --- a/sys/contrib/dev/acpica/uttrack.c +++ b/sys/contrib/dev/acpica/utilities/uttrack.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: uttrack - Memory allocation tracking routines (debug only) - * $Revision: 1.5 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -127,7 +126,8 @@ #define __UTTRACK_C__ -#include <contrib/dev/acpica/acpi.h> +#include "acpi.h" +#include "accommon.h" #ifdef ACPI_DBG_TRACK_ALLOCATIONS @@ -146,14 +146,14 @@ AcpiUtTrackAllocation ( ACPI_SIZE Size, UINT8 AllocType, UINT32 Component, - char *Module, + const char *Module, UINT32 Line); static ACPI_STATUS AcpiUtRemoveAllocation ( ACPI_DEBUG_MEM_BLOCK *Address, UINT32 Component, - char *Module, + const char *Module, UINT32 Line); @@ -215,7 +215,7 @@ void * AcpiUtAllocateAndTrack ( ACPI_SIZE Size, UINT32 Component, - char *Module, + const char *Module, UINT32 Line) { ACPI_DEBUG_MEM_BLOCK *Allocation; @@ -268,7 +268,7 @@ void * AcpiUtAllocateZeroedAndTrack ( ACPI_SIZE Size, UINT32 Component, - char *Module, + const char *Module, UINT32 Line) { ACPI_DEBUG_MEM_BLOCK *Allocation; @@ -325,7 +325,7 @@ void AcpiUtFreeAndTrack ( void *Allocation, UINT32 Component, - char *Module, + const char *Module, UINT32 Line) { ACPI_DEBUG_MEM_BLOCK *DebugBlock; @@ -425,7 +425,7 @@ AcpiUtTrackAllocation ( ACPI_SIZE Size, UINT8 AllocType, UINT32 Component, - char *Module, + const char *Module, UINT32 Line) { ACPI_MEMORY_LIST *MemList; @@ -508,7 +508,7 @@ static ACPI_STATUS AcpiUtRemoveAllocation ( ACPI_DEBUG_MEM_BLOCK *Allocation, UINT32 Component, - char *Module, + const char *Module, UINT32 Line) { ACPI_MEMORY_LIST *MemList; @@ -639,7 +639,7 @@ AcpiUtDumpAllocationInfo ( void AcpiUtDumpAllocations ( UINT32 Component, - char *Module) + const char *Module) { ACPI_DEBUG_MEM_BLOCK *Element; ACPI_DESCRIPTOR *Descriptor; diff --git a/sys/contrib/dev/acpica/utxface.c b/sys/contrib/dev/acpica/utilities/utxface.c index 83c420ea9649..4207f3d598ab 100644 --- a/sys/contrib/dev/acpica/utxface.c +++ b/sys/contrib/dev/acpica/utilities/utxface.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: utxface - External interfaces for "global" ACPI functions - * $Revision: 1.125 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,15 +116,19 @@ #define __UTXFACE_C__ -#include <contrib/dev/acpica/acpi.h> -#include <contrib/dev/acpica/acevents.h> -#include <contrib/dev/acpica/acnamesp.h> -#include <contrib/dev/acpica/acdebug.h> +#include "acpi.h" +#include "accommon.h" +#include "acevents.h" +#include "acnamesp.h" +#include "acdebug.h" +#include "actables.h" #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("utxface") +#ifndef ACPI_ASL_COMPILER + /******************************************************************************* * * FUNCTION: AcpiInitializeSubsystem @@ -163,7 +166,12 @@ AcpiInitializeSubsystem ( /* Initialize all globals used by the subsystem */ - AcpiUtInitGlobals (); + Status = AcpiUtInitGlobals (); + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, Status, "During initialization of globals")); + return_ACPI_STATUS (Status); + } /* Create the default mutex objects */ @@ -234,6 +242,17 @@ AcpiEnableSubsystem ( } /* + * Obtain a permanent mapping for the FACS. This is required for the + * Global Lock and the Firmware Waking Vector + */ + Status = AcpiTbInitializeFacs (); + if (ACPI_FAILURE (Status)) + { + ACPI_WARNING ((AE_INFO, "Could not map the FACS table")); + return_ACPI_STATUS (Status); + } + + /* * Install the default OpRegion handlers. These are installed unless * other handlers have already been installed via the * InstallAddressSpaceHandler interface. @@ -260,7 +279,9 @@ AcpiEnableSubsystem ( * * Note2: Fixed events are initialized and enabled here. GPEs are * initialized, but cannot be enabled until after the hardware is - * completely initialized (SCI and GlobalLock activated) + * completely initialized (SCI and GlobalLock activated) and the various + * initialization control methods are run (_REG, _STA, _INI) on the + * entire namespace. */ if (!(Flags & ACPI_NO_EVENT_INIT)) { @@ -290,26 +311,6 @@ AcpiEnableSubsystem ( } } - /* - * Complete the GPE initialization for the GPE blocks defined in the FADT - * (GPE block 0 and 1). - * - * Note1: This is where the _PRW methods are executed for the GPEs. These - * methods can only be executed after the SCI and Global Lock handlers are - * installed and initialized. - * - * Note2: Currently, there seems to be no need to run the _REG methods - * before execution of the _PRW methods and enabling of the GPEs. - */ - if (!(Flags & ACPI_NO_EVENT_INIT)) - { - Status = AcpiEvInstallFadtGpes (); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } - return_ACPI_STATUS (Status); } @@ -392,6 +393,27 @@ AcpiInitializeObjects ( } /* + * Initialize the GPE blocks defined in the FADT (GPE block 0 and 1). + * The runtime GPEs are enabled here. + * + * This is where the _PRW methods are executed for the GPEs. These + * methods can only be executed after the SCI and Global Lock handlers are + * installed and initialized. + * + * GPEs can only be enabled after the _REG, _STA, and _INI methods have + * been run. This ensures that all Operation Regions and all Devices have + * been initialized and are ready. + */ + if (!(Flags & ACPI_NO_EVENT_INIT)) + { + Status = AcpiEvInstallFadtGpes (); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + } + + /* * Empty the caches (delete the cached objects) on the assumption that * the table load filled them up more than they will be at runtime -- * thus wasting non-paged memory. @@ -405,6 +427,8 @@ AcpiInitializeObjects ( ACPI_EXPORT_SYMBOL (AcpiInitializeObjects) +#endif + /******************************************************************************* * * FUNCTION: AcpiTerminate @@ -456,6 +480,7 @@ AcpiTerminate ( ACPI_EXPORT_SYMBOL (AcpiTerminate) +#ifndef ACPI_ASL_COMPILER /******************************************************************************* * @@ -572,6 +597,51 @@ AcpiGetSystemInfo ( ACPI_EXPORT_SYMBOL (AcpiGetSystemInfo) +/******************************************************************************* + * + * FUNCTION: AcpiGetStatistics + * + * PARAMETERS: Stats - Where the statistics are returned + * + * RETURN: Status - the status of the call + * + * DESCRIPTION: Get the contents of the various system counters + * + ******************************************************************************/ + +ACPI_STATUS +AcpiGetStatistics ( + ACPI_STATISTICS *Stats) +{ + ACPI_FUNCTION_TRACE (AcpiGetStatistics); + + + /* Parameter validation */ + + if (!Stats) + { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + + /* Various interrupt-based event counters */ + + Stats->SciCount = AcpiSciCount; + Stats->GpeCount = AcpiGpeCount; + + ACPI_MEMCPY (Stats->FixedEventCount, AcpiFixedEventCount, + sizeof (AcpiFixedEventCount)); + + + /* Other counters */ + + Stats->MethodCount = AcpiMethodCount; + + return_ACPI_STATUS (AE_OK); +} + +ACPI_EXPORT_SYMBOL (AcpiGetStatistics) + + /***************************************************************************** * * FUNCTION: AcpiInstallInitializationHandler @@ -636,3 +706,6 @@ AcpiPurgeCachedObjects ( } ACPI_EXPORT_SYMBOL (AcpiPurgeCachedObjects) + +#endif /* ACPI_ASL_COMPILER */ + |