summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2007-03-22 17:24:05 +0000
committerjkim <jkim@FreeBSD.org>2007-03-22 17:24:05 +0000
commite031ab5da47b5f6c28c3cc5d576128b2d8d202e6 (patch)
tree69d0fa3b3760b0abcc0335ff748e39701a8bf064 /sys/contrib/dev/acpica
parentdbc8115981195155aec9304dd8f0ee570bd3d32c (diff)
downloadFreeBSD-src-e031ab5da47b5f6c28c3cc5d576128b2d8d202e6.zip
FreeBSD-src-e031ab5da47b5f6c28c3cc5d576128b2d8d202e6.tar.gz
Vendor import of Intel ACPI-CA 20070320
Diffstat (limited to 'sys/contrib/dev/acpica')
-rw-r--r--sys/contrib/dev/acpica/CHANGES.txt1737
-rw-r--r--sys/contrib/dev/acpica/acapps.h83
-rw-r--r--sys/contrib/dev/acpica/acconfig.h60
-rw-r--r--sys/contrib/dev/acpica/acdebug.h15
-rw-r--r--sys/contrib/dev/acpica/acdisasm.h263
-rw-r--r--sys/contrib/dev/acpica/acdispat.h40
-rw-r--r--sys/contrib/dev/acpica/acefi.h4
-rw-r--r--sys/contrib/dev/acpica/acenv.h58
-rw-r--r--sys/contrib/dev/acpica/acevents.h15
-rw-r--r--sys/contrib/dev/acpica/acexcep.h18
-rw-r--r--sys/contrib/dev/acpica/acfreebsd.h29
-rw-r--r--sys/contrib/dev/acpica/acgcc.h13
-rw-r--r--sys/contrib/dev/acpica/acglobal.h199
-rw-r--r--sys/contrib/dev/acpica/achware.h10
-rw-r--r--sys/contrib/dev/acpica/acinterp.h94
-rw-r--r--sys/contrib/dev/acpica/aclocal.h707
-rw-r--r--sys/contrib/dev/acpica/acmacros.h275
-rw-r--r--sys/contrib/dev/acpica/acnames.h4
-rw-r--r--sys/contrib/dev/acpica/acnamesp.h54
-rw-r--r--sys/contrib/dev/acpica/acobject.h265
-rw-r--r--sys/contrib/dev/acpica/acopcode.h8
-rw-r--r--sys/contrib/dev/acpica/acoutput.h13
-rw-r--r--sys/contrib/dev/acpica/acparser.h12
-rw-r--r--sys/contrib/dev/acpica/acpi.h4
-rw-r--r--sys/contrib/dev/acpica/acpiosxf.h120
-rw-r--r--sys/contrib/dev/acpica/acpixf.h61
-rw-r--r--sys/contrib/dev/acpica/acresrc.h66
-rw-r--r--sys/contrib/dev/acpica/acstruct.h276
-rw-r--r--sys/contrib/dev/acpica/actables.h187
-rw-r--r--sys/contrib/dev/acpica/actbl.h472
-rw-r--r--sys/contrib/dev/acpica/actbl1.h857
-rw-r--r--sys/contrib/dev/acpica/actbl2.h271
-rw-r--r--sys/contrib/dev/acpica/actypes.h876
-rw-r--r--sys/contrib/dev/acpica/acutils.h203
-rw-r--r--sys/contrib/dev/acpica/aecommon.h11
-rw-r--r--sys/contrib/dev/acpica/amlcode.h12
-rw-r--r--sys/contrib/dev/acpica/amlresrc.h258
-rw-r--r--sys/contrib/dev/acpica/common/adfile.c398
-rw-r--r--sys/contrib/dev/acpica/common/adisasm.c643
-rw-r--r--sys/contrib/dev/acpica/common/adwalk.c1001
-rw-r--r--sys/contrib/dev/acpica/common/dmrestag.c990
-rw-r--r--sys/contrib/dev/acpica/common/dmtable.c734
-rw-r--r--sys/contrib/dev/acpica/common/dmtbdump.c798
-rw-r--r--sys/contrib/dev/acpica/common/dmtbinfo.c967
-rw-r--r--sys/contrib/dev/acpica/common/getopt.c4
-rw-r--r--sys/contrib/dev/acpica/compiler/aslanalyze.c369
-rw-r--r--sys/contrib/dev/acpica/compiler/aslcodegen.c57
-rw-r--r--sys/contrib/dev/acpica/compiler/aslcompile.c180
-rw-r--r--sys/contrib/dev/acpica/compiler/aslcompiler.h21
-rw-r--r--sys/contrib/dev/acpica/compiler/aslcompiler.l58
-rw-r--r--sys/contrib/dev/acpica/compiler/aslcompiler.y234
-rw-r--r--sys/contrib/dev/acpica/compiler/asldefine.h8
-rw-r--r--sys/contrib/dev/acpica/compiler/aslerror.c21
-rw-r--r--sys/contrib/dev/acpica/compiler/aslfiles.c4
-rw-r--r--sys/contrib/dev/acpica/compiler/aslfold.c4
-rw-r--r--sys/contrib/dev/acpica/compiler/aslglobal.h11
-rw-r--r--sys/contrib/dev/acpica/compiler/asllength.c4
-rw-r--r--sys/contrib/dev/acpica/compiler/asllisting.c96
-rw-r--r--sys/contrib/dev/acpica/compiler/aslload.c92
-rw-r--r--sys/contrib/dev/acpica/compiler/asllookup.c241
-rw-r--r--sys/contrib/dev/acpica/compiler/aslmain.c63
-rw-r--r--sys/contrib/dev/acpica/compiler/aslmap.c10
-rw-r--r--sys/contrib/dev/acpica/compiler/aslopcodes.c20
-rw-r--r--sys/contrib/dev/acpica/compiler/asloperands.c17
-rw-r--r--sys/contrib/dev/acpica/compiler/aslopt.c39
-rw-r--r--sys/contrib/dev/acpica/compiler/aslresource.c50
-rw-r--r--sys/contrib/dev/acpica/compiler/aslrestype1.c101
-rw-r--r--sys/contrib/dev/acpica/compiler/aslrestype2.c298
-rw-r--r--sys/contrib/dev/acpica/compiler/aslstubs.c21
-rw-r--r--sys/contrib/dev/acpica/compiler/asltransform.c75
-rw-r--r--sys/contrib/dev/acpica/compiler/asltree.c16
-rw-r--r--sys/contrib/dev/acpica/compiler/asltypes.h56
-rw-r--r--sys/contrib/dev/acpica/compiler/aslutils.c31
-rw-r--r--sys/contrib/dev/acpica/dbcmds.c108
-rw-r--r--sys/contrib/dev/acpica/dbdisply.c70
-rw-r--r--sys/contrib/dev/acpica/dbexec.c149
-rw-r--r--sys/contrib/dev/acpica/dbfileio.c172
-rw-r--r--sys/contrib/dev/acpica/dbhistry.c4
-rw-r--r--sys/contrib/dev/acpica/dbinput.c6
-rw-r--r--sys/contrib/dev/acpica/dbstats.c55
-rw-r--r--sys/contrib/dev/acpica/dbutils.c57
-rw-r--r--sys/contrib/dev/acpica/dbxface.c6
-rw-r--r--sys/contrib/dev/acpica/dmbuffer.c40
-rw-r--r--sys/contrib/dev/acpica/dmnames.c30
-rw-r--r--sys/contrib/dev/acpica/dmobject.c26
-rw-r--r--sys/contrib/dev/acpica/dmopcode.c99
-rw-r--r--sys/contrib/dev/acpica/dmresrc.c243
-rw-r--r--sys/contrib/dev/acpica/dmresrcl.c144
-rw-r--r--sys/contrib/dev/acpica/dmresrcs.c51
-rw-r--r--sys/contrib/dev/acpica/dmutils.c233
-rw-r--r--sys/contrib/dev/acpica/dmwalk.c110
-rw-r--r--sys/contrib/dev/acpica/dsfield.c76
-rw-r--r--sys/contrib/dev/acpica/dsinit.c77
-rw-r--r--sys/contrib/dev/acpica/dsmethod.c547
-rw-r--r--sys/contrib/dev/acpica/dsmthdat.c68
-rw-r--r--sys/contrib/dev/acpica/dsobject.c203
-rw-r--r--sys/contrib/dev/acpica/dsopcode.c105
-rw-r--r--sys/contrib/dev/acpica/dsutils.c209
-rw-r--r--sys/contrib/dev/acpica/dswexec.c172
-rw-r--r--sys/contrib/dev/acpica/dswload.c348
-rw-r--r--sys/contrib/dev/acpica/dswscope.c22
-rw-r--r--sys/contrib/dev/acpica/dswstate.c642
-rw-r--r--sys/contrib/dev/acpica/evevent.c99
-rw-r--r--sys/contrib/dev/acpica/evgpe.c198
-rw-r--r--sys/contrib/dev/acpica/evgpeblk.c355
-rw-r--r--sys/contrib/dev/acpica/evmisc.c259
-rw-r--r--sys/contrib/dev/acpica/evregion.c226
-rw-r--r--sys/contrib/dev/acpica/evrgnini.c224
-rw-r--r--sys/contrib/dev/acpica/evsci.c20
-rw-r--r--sys/contrib/dev/acpica/evxface.c108
-rw-r--r--sys/contrib/dev/acpica/evxfevnt.c107
-rw-r--r--sys/contrib/dev/acpica/evxfregn.c27
-rw-r--r--sys/contrib/dev/acpica/exconfig.c244
-rw-r--r--sys/contrib/dev/acpica/exconvrt.c38
-rw-r--r--sys/contrib/dev/acpica/excreate.c102
-rw-r--r--sys/contrib/dev/acpica/exdump.c666
-rw-r--r--sys/contrib/dev/acpica/exfield.c36
-rw-r--r--sys/contrib/dev/acpica/exfldio.c196
-rw-r--r--sys/contrib/dev/acpica/exmisc.c136
-rw-r--r--sys/contrib/dev/acpica/exmutex.c311
-rw-r--r--sys/contrib/dev/acpica/exnames.c32
-rw-r--r--sys/contrib/dev/acpica/exoparg1.c143
-rw-r--r--sys/contrib/dev/acpica/exoparg2.c142
-rw-r--r--sys/contrib/dev/acpica/exoparg3.c29
-rw-r--r--sys/contrib/dev/acpica/exoparg6.c25
-rw-r--r--sys/contrib/dev/acpica/exprep.c50
-rw-r--r--sys/contrib/dev/acpica/exregion.c101
-rw-r--r--sys/contrib/dev/acpica/exresnte.c37
-rw-r--r--sys/contrib/dev/acpica/exresolv.c126
-rw-r--r--sys/contrib/dev/acpica/exresop.c105
-rw-r--r--sys/contrib/dev/acpica/exstore.c31
-rw-r--r--sys/contrib/dev/acpica/exstoren.c22
-rw-r--r--sys/contrib/dev/acpica/exstorob.c18
-rw-r--r--sys/contrib/dev/acpica/exsystem.c187
-rw-r--r--sys/contrib/dev/acpica/exutils.c205
-rw-r--r--sys/contrib/dev/acpica/hwacpi.c80
-rw-r--r--sys/contrib/dev/acpica/hwgpe.c19
-rw-r--r--sys/contrib/dev/acpica/hwregs.c354
-rw-r--r--sys/contrib/dev/acpica/hwsleep.c132
-rw-r--r--sys/contrib/dev/acpica/hwtimer.c21
-rw-r--r--sys/contrib/dev/acpica/nsaccess.c121
-rw-r--r--sys/contrib/dev/acpica/nsalloc.c164
-rw-r--r--sys/contrib/dev/acpica/nsdump.c33
-rw-r--r--sys/contrib/dev/acpica/nsdumpdv.c10
-rw-r--r--sys/contrib/dev/acpica/nseval.c518
-rw-r--r--sys/contrib/dev/acpica/nsinit.c337
-rw-r--r--sys/contrib/dev/acpica/nsload.c198
-rw-r--r--sys/contrib/dev/acpica/nsnames.c28
-rw-r--r--sys/contrib/dev/acpica/nsobject.c24
-rw-r--r--sys/contrib/dev/acpica/nsparse.c60
-rw-r--r--sys/contrib/dev/acpica/nssearch.c162
-rw-r--r--sys/contrib/dev/acpica/nsutils.c129
-rw-r--r--sys/contrib/dev/acpica/nswalk.c73
-rw-r--r--sys/contrib/dev/acpica/nsxfeval.c225
-rw-r--r--sys/contrib/dev/acpica/nsxfname.c64
-rw-r--r--sys/contrib/dev/acpica/nsxfobj.c9
-rw-r--r--sys/contrib/dev/acpica/osunixxf.c105
-rw-r--r--sys/contrib/dev/acpica/psargs.c373
-rw-r--r--sys/contrib/dev/acpica/psloop.c1389
-rw-r--r--sys/contrib/dev/acpica/psopcode.c38
-rw-r--r--sys/contrib/dev/acpica/psparse.c72
-rw-r--r--sys/contrib/dev/acpica/psscope.c38
-rw-r--r--sys/contrib/dev/acpica/pstree.c8
-rw-r--r--sys/contrib/dev/acpica/psutils.c8
-rw-r--r--sys/contrib/dev/acpica/pswalk.c6
-rw-r--r--sys/contrib/dev/acpica/psxface.c153
-rw-r--r--sys/contrib/dev/acpica/rsaddr.c4
-rw-r--r--sys/contrib/dev/acpica/rscalc.c254
-rw-r--r--sys/contrib/dev/acpica/rscreate.c129
-rw-r--r--sys/contrib/dev/acpica/rsdump.c102
-rw-r--r--sys/contrib/dev/acpica/rsinfo.c90
-rw-r--r--sys/contrib/dev/acpica/rsio.c4
-rw-r--r--sys/contrib/dev/acpica/rsirq.c4
-rw-r--r--sys/contrib/dev/acpica/rslist.c280
-rw-r--r--sys/contrib/dev/acpica/rsmemory.c4
-rw-r--r--sys/contrib/dev/acpica/rsmisc.c119
-rw-r--r--sys/contrib/dev/acpica/rsutils.c279
-rw-r--r--sys/contrib/dev/acpica/rsxface.c531
-rw-r--r--sys/contrib/dev/acpica/tbfadt.c520
-rw-r--r--sys/contrib/dev/acpica/tbfind.c205
-rw-r--r--sys/contrib/dev/acpica/tbinstal.c680
-rw-r--r--sys/contrib/dev/acpica/tbutils.c521
-rw-r--r--sys/contrib/dev/acpica/tbxface.c613
-rw-r--r--sys/contrib/dev/acpica/tbxfroot.c592
-rw-r--r--sys/contrib/dev/acpica/utalloc.c718
-rw-r--r--sys/contrib/dev/acpica/utcache.c25
-rw-r--r--sys/contrib/dev/acpica/utclib.c4
-rw-r--r--sys/contrib/dev/acpica/utcopy.c60
-rw-r--r--sys/contrib/dev/acpica/utdebug.c69
-rw-r--r--sys/contrib/dev/acpica/utdelete.c126
-rw-r--r--sys/contrib/dev/acpica/uteval.c157
-rw-r--r--sys/contrib/dev/acpica/utglobal.c255
-rw-r--r--sys/contrib/dev/acpica/utinit.c158
-rw-r--r--sys/contrib/dev/acpica/utmath.c20
-rw-r--r--sys/contrib/dev/acpica/utmisc.c753
-rw-r--r--sys/contrib/dev/acpica/utmutex.c102
-rw-r--r--sys/contrib/dev/acpica/utobject.c44
-rw-r--r--sys/contrib/dev/acpica/utresrc.c772
-rw-r--r--sys/contrib/dev/acpica/utstate.c57
-rw-r--r--sys/contrib/dev/acpica/uttrack.c726
-rw-r--r--sys/contrib/dev/acpica/utxface.c143
201 files changed, 24503 insertions, 13627 deletions
diff --git a/sys/contrib/dev/acpica/CHANGES.txt b/sys/contrib/dev/acpica/CHANGES.txt
index e18b8f1..f26ed47 100644
--- a/sys/contrib/dev/acpica/CHANGES.txt
+++ b/sys/contrib/dev/acpica/CHANGES.txt
@@ -1,4 +1,1690 @@
----------------------------------------
+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:
@@ -46,6 +1732,7 @@ the compiler and the compiler options used during generation.
Debug Version: 163.5K Code, 67.0K Data, 230.5K Total
+
2) iASL Compiler/Disassembler:
Relaxed a compiler restriction that disallowed a ResourceIndex
@@ -297,6 +1984,7 @@ 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:
@@ -526,6 +2214,7 @@ 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.
@@ -822,6 +2511,7 @@ compiler and the compiler options used during generation.
Debug Version: 163.5K Code, 69.3K Data, 232.8K Total
+
2) iASL Compiler/Disassembler:
Fixed a problem with the resource descriptor generation/support.
@@ -988,7 +2678,7 @@ fields.
Implemented header support for the SRAT and SLIT ACPI tables.
Implemented the -s switch in AcpiExec to enable the
-"InterpeterSlack" flag at runtime.
+"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
@@ -1198,6 +2888,7 @@ 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
@@ -1526,6 +3217,7 @@ compiler and the compiler options used during generation.
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
@@ -1747,7 +3439,7 @@ 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_EnableInterpeterSlack flag.
+via the AcpiGbl_EnableInterpreterSlack flag.
Removed support for the PCI_Config address space from the
internal low level hardware interfaces (AcpiHwLowLevelRead and
@@ -1845,6 +3537,7 @@ 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.
@@ -1882,6 +3575,7 @@ 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
@@ -1934,6 +3628,7 @@ 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
@@ -2122,6 +3817,7 @@ compiler and the compiler options used during generation.
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
@@ -2228,6 +3924,7 @@ 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:
@@ -2299,6 +3996,7 @@ 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
@@ -2326,6 +4024,7 @@ 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-
@@ -2444,6 +4143,7 @@ generated. This was most noticeable on 64-bit platforms
1) ACPI CA Core Subsystem:
+
Fixed a problem where a level-triggered GPE with an associated
_Lxx control method was incorrectly cleared twice.
@@ -2500,6 +4200,7 @@ 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
@@ -2625,6 +4326,7 @@ 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:
@@ -2687,6 +4389,7 @@ 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.
@@ -2898,6 +4601,7 @@ 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.
@@ -2906,6 +4610,7 @@ 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
@@ -3385,6 +5090,7 @@ 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.
@@ -3394,6 +5100,7 @@ declarations for the symbols that are created within the
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.
@@ -4005,6 +5712,7 @@ 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.
@@ -4103,6 +5811,7 @@ 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.
@@ -4158,6 +5867,7 @@ 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
@@ -4238,6 +5948,7 @@ options used during generation.
2) Linux
+
Added preliminary support for obtaining _TRA data for PCI root
bridges (Bjorn Helgaas).
@@ -4376,6 +6087,7 @@ 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.
@@ -4386,6 +6098,7 @@ aligned properly with the parent block.
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
@@ -4506,6 +6219,7 @@ 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
@@ -4617,6 +6331,7 @@ 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.
@@ -4731,6 +6446,7 @@ 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.
@@ -4935,6 +6651,7 @@ 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.
@@ -5071,6 +6788,7 @@ 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
@@ -5102,6 +6820,7 @@ options used during generation.
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.
@@ -5275,6 +6994,7 @@ code.
+
----------------------------------------
Summary of changes for this label: 11_09_01
@@ -5288,6 +7008,7 @@ 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.
@@ -5470,11 +7191,13 @@ 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.
@@ -5646,6 +7369,7 @@ 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.
@@ -5781,6 +7505,7 @@ 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
@@ -5942,6 +7667,7 @@ 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
@@ -5970,6 +7696,7 @@ 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:
@@ -6125,6 +7852,7 @@ 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
@@ -6198,6 +7926,7 @@ 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.
@@ -6451,6 +8180,7 @@ 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
@@ -6552,6 +8282,7 @@ 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
@@ -6674,10 +8405,12 @@ 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
diff --git a/sys/contrib/dev/acpica/acapps.h b/sys/contrib/dev/acpica/acapps.h
index c93fa9a..e2d20b2 100644
--- a/sys/contrib/dev/acpica/acapps.h
+++ b/sys/contrib/dev/acpica/acapps.h
@@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -121,6 +121,9 @@
#pragma warning(disable:4100) /* warning C4100: unreferenced formal parameter */
#endif
+#define FILE_SUFFIX_DISASSEMBLY "dsl"
+#define ACPI_TABLE_FILE_SUFFIX ".dat"
+
extern UINT8 *DsdtPtr;
extern UINT32 AcpiDsdtLength;
extern UINT8 *AmlStart;
@@ -136,21 +139,9 @@ AcpiGetopt(
char **argv,
char *opts);
-ACPI_STATUS
-AdInitialize (
- void);
-
-char *
-FlGenerateFilename (
- char *InputFilename,
- char *Suffix);
-
-ACPI_STATUS
-FlSplitInputPathname (
- char *InputPath,
- char **OutDirectoryPath,
- char **OutFilename);
-
+/*
+ * adisasm
+ */
ACPI_STATUS
AdAmlDisassemble (
BOOLEAN OutToFile,
@@ -187,6 +178,66 @@ AdDisplayTables (
ACPI_STATUS
AdDisplayStatistics (void);
+/*
+ * adwalk
+ */
+void
+AcpiDmCrossReferenceNamespace (
+ ACPI_PARSE_OBJECT *ParseTreeRoot,
+ ACPI_NAMESPACE_NODE *NamespaceRoot);
+
+void
+AcpiDmDumpTree (
+ ACPI_PARSE_OBJECT *Origin);
+
+void
+AcpiDmFindOrphanMethods (
+ ACPI_PARSE_OBJECT *Origin);
+
+void
+AcpiDmFinishNamespaceLoad (
+ ACPI_PARSE_OBJECT *ParseTreeRoot,
+ ACPI_NAMESPACE_NODE *NamespaceRoot);
+
+void
+AcpiDmConvertResourceIndexes (
+ ACPI_PARSE_OBJECT *ParseTreeRoot,
+ ACPI_NAMESPACE_NODE *NamespaceRoot);
+
+/*
+ * adfile
+ */
+ACPI_STATUS
+AdInitialize (
+ void);
+
+char *
+FlGenerateFilename (
+ char *InputFilename,
+ char *Suffix);
+
+ACPI_STATUS
+FlSplitInputPathname (
+ char *InputPath,
+ char **OutDirectoryPath,
+ char **OutFilename);
+
+char *
+FlGenerateFilename (
+ char *InputFilename,
+ char *Suffix);
+
+char *
+AdGenerateFilename (
+ char *Prefix,
+ char *TableId);
+
+void
+AdWriteTable (
+ ACPI_TABLE_HEADER *Table,
+ UINT32 Length,
+ char *TableName,
+ char *OemTableId);
#endif /* _ACAPPS */
diff --git a/sys/contrib/dev/acpica/acconfig.h b/sys/contrib/dev/acpica/acconfig.h
index d3ff2a9..c3c15a8 100644
--- a/sys/contrib/dev/acpica/acconfig.h
+++ b/sys/contrib/dev/acpica/acconfig.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acconfig.h - Global configuration constants
- * $Revision: 1.194 $
+ * $Revision: 1.234 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -137,7 +137,7 @@
/* Current ACPICA subsystem version in YYYYMMDD format */
-#define ACPI_CA_VERSION 0x20051021
+#define ACPI_CA_VERSION 0x20070320
/*
* OS name, used for the _OS object. The _OS object is essentially obsolete,
@@ -155,9 +155,10 @@
#define ACPI_MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */
#define ACPI_MAX_EXTPARSE_CACHE_DEPTH 96 /* Parse tree objects */
#define ACPI_MAX_OBJECT_CACHE_DEPTH 96 /* Interpreter operand objects */
+#define ACPI_MAX_NAMESPACE_CACHE_DEPTH 96 /* Namespace objects */
/*
- * Should the subystem abort the loading of an ACPI table if the
+ * Should the subsystem abort the loading of an ACPI table if the
* table checksum is incorrect?
*/
#define ACPI_CHECKSUM_ABORT FALSE
@@ -173,23 +174,26 @@
#define ACPI_CA_SUPPORT_LEVEL 3
-/* String size constants */
-
-#define ACPI_MAX_STRING_LENGTH 512
-#define ACPI_PATHNAME_MAX 256 /* A full namespace pathname */
-
/* Maximum count for a semaphore object */
#define ACPI_MAX_SEMAPHORE_COUNT 256
-/* Max reference count (for debug only) */
+/* Maximum object reference count (detects object deletion issues) */
-#define ACPI_MAX_REFERENCE_COUNT 0x400
+#define ACPI_MAX_REFERENCE_COUNT 0x800
/* Size of cached memory mapping for system memory operation region */
#define ACPI_SYSMEM_REGION_WINDOW_SIZE 4096
+/* OwnerId tracking. 8 entries allows for 255 OwnerIds */
+
+#define ACPI_NUM_OWNERID_MASKS 8
+
+/* Size of the root table array is increased by this increment */
+
+#define ACPI_ROOT_TABLE_SIZE_INCREMENT 4
+
/******************************************************************************
*
@@ -210,14 +214,11 @@
#define ACPI_METHOD_NUM_ARGS 7
#define ACPI_METHOD_MAX_ARG 6
-/* Maximum length of resulting string when converting from a buffer */
-
-#define ACPI_MAX_STRING_CONVERSION 200
-
-/* Length of _HID, _UID, and _CID values */
+/* 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
@@ -225,12 +226,28 @@
#define ACPI_OBJ_NUM_OPERANDS 8
#define ACPI_OBJ_MAX_OPERAND 7
+/* Number of elements in the Result Stack frame, can be an arbitrary value */
+
+#define ACPI_RESULTS_FRAME_OBJ_NUM 8
+
+/*
+ * Maximal number of elements the Result Stack can contain,
+ * it may be an arbitray value not exceeding the types of
+ * ResultSize and ResultCount (now UINT8).
+ */
+#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 */
@@ -251,12 +268,7 @@
/* Array sizes. Used for range checking also */
-#define ACPI_NUM_ACCESS_TYPES 6
-#define ACPI_NUM_UPDATE_RULES 3
-#define ACPI_NUM_LOCK_RULES 2
-#define ACPI_NUM_MATCH_OPS 6
-#define ACPI_NUM_OPCODES 256
-#define ACPI_NUM_FIELD_NAMES 2
+#define ACPI_MAX_MATCH_OPCODE 5
/* RSDP checksums */
@@ -267,10 +279,6 @@
#define ACPI_SMBUS_BUFFER_SIZE 34
-/* Number of strings associated with the _OSI reserved method */
-
-#define ACPI_NUM_OSI_STRINGS 10
-
/******************************************************************************
*
diff --git a/sys/contrib/dev/acpica/acdebug.h b/sys/contrib/dev/acpica/acdebug.h
index 7222fed..cdf566e 100644
--- a/sys/contrib/dev/acpica/acdebug.h
+++ b/sys/contrib/dev/acpica/acdebug.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acdebug.h - ACPI/AML debugger
- * $Revision: 1.80 $
+ * $Revision: 1.84 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -323,6 +323,12 @@ AcpiDbCreateExecutionThreads (
char *NumLoopsArg,
char *MethodNameArg);
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+UINT32
+AcpiDbGetCacheInfo (
+ ACPI_MEMORY_LIST *Cache);
+#endif
+
/*
* dbfileio - Debugger file I/O commands
@@ -423,4 +429,9 @@ ACPI_NAMESPACE_NODE *
AcpiDbLocalNsLookup (
char *Name);
+void
+AcpiDbUInt32ToHexString (
+ UINT32 Value,
+ char *Buffer);
+
#endif /* __ACDEBUG_H__ */
diff --git a/sys/contrib/dev/acpica/acdisasm.h b/sys/contrib/dev/acpica/acdisasm.h
index 718f376..4371de7 100644
--- a/sys/contrib/dev/acpica/acdisasm.h
+++ b/sys/contrib/dev/acpica/acdisasm.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acdisasm.h - AML disassembler
- * $Revision: 1.25 $
+ * $Revision: 1.39 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -124,46 +124,83 @@
#define BLOCK_PAREN 1
#define BLOCK_BRACE 2
#define BLOCK_COMMA_LIST 4
+#define ACPI_DEFAULT_RESNAME *(UINT32 *) "__RD"
typedef struct acpi_external_list
{
char *Path;
+ char *InternalPath;
struct acpi_external_list *Next;
+ UINT32 Value;
+ UINT16 Length;
+ UINT8 Type;
} ACPI_EXTERNAL_LIST;
extern ACPI_EXTERNAL_LIST *AcpiGbl_ExternalList;
-extern const char *AcpiGbl_IoDecode[2];
-extern const char *AcpiGbl_WordDecode[4];
-extern const char *AcpiGbl_ConsumeDecode[2];
-extern const char *AcpiGbl_ConfigDecode[4];
-extern const char *AcpiGbl_MinDecode[2];
-extern const char *AcpiGbl_MaxDecode[2];
-extern const char *AcpiGbl_DECDecode[2];
-extern const char *AcpiGbl_RNGDecode[4];
-extern const char *AcpiGbl_MEMDecode[4];
-extern const char *AcpiGbl_RWDecode[2];
-extern const char *AcpiGbl_IrqDecode[2];
-extern const char *AcpiGbl_HEDecode[2];
-extern const char *AcpiGbl_LLDecode[2];
-extern const char *AcpiGbl_SHRDecode[2];
-extern const char *AcpiGbl_TYPDecode[4];
-extern const char *AcpiGbl_BMDecode[2];
-extern const char *AcpiGbl_SIZDecode[4];
-extern const char *AcpiGbl_TTPDecode[2];
-extern const char *AcpiGbl_MTPDecode[4];
-extern const char *AcpiGbl_TRSDecode[2];
-
-extern const char *AcpiGbl_LockRule[ACPI_NUM_LOCK_RULES];
-extern const char *AcpiGbl_AccessTypes[ACPI_NUM_ACCESS_TYPES];
-extern const char *AcpiGbl_UpdateRules[ACPI_NUM_UPDATE_RULES];
-extern const char *AcpiGbl_MatchOps[ACPI_NUM_MATCH_OPS];
+
+typedef const struct acpi_dmtable_info
+{
+ UINT8 Opcode;
+ UINT8 Offset;
+ char *Name;
+
+} ACPI_DMTABLE_INFO;
+
+/*
+ * Values for Opcode above.
+ * Note: 0-7 must not change, used as a flag shift value
+ */
+#define ACPI_DMT_FLAG0 0
+#define ACPI_DMT_FLAG1 1
+#define ACPI_DMT_FLAG2 2
+#define ACPI_DMT_FLAG3 3
+#define ACPI_DMT_FLAG4 4
+#define ACPI_DMT_FLAG5 5
+#define ACPI_DMT_FLAG6 6
+#define ACPI_DMT_FLAG7 7
+#define ACPI_DMT_FLAGS0 8
+#define ACPI_DMT_FLAGS2 9
+#define ACPI_DMT_UINT8 10
+#define ACPI_DMT_UINT16 11
+#define ACPI_DMT_UINT24 12
+#define ACPI_DMT_UINT32 13
+#define ACPI_DMT_UINT56 14
+#define ACPI_DMT_UINT64 15
+#define ACPI_DMT_STRING 16
+#define ACPI_DMT_NAME4 17
+#define ACPI_DMT_NAME6 18
+#define ACPI_DMT_NAME8 19
+#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
+
+typedef
+void (*ACPI_TABLE_HANDLER) (
+ ACPI_TABLE_HEADER *Table);
+
+typedef struct acpi_dmtable_data
+{
+ char *Signature;
+ ACPI_DMTABLE_INFO *TableInfo;
+ ACPI_TABLE_HANDLER TableHandler;
+ char *Name;
+
+} ACPI_DMTABLE_DATA;
typedef struct acpi_op_walk_info
{
UINT32 Level;
+ UINT32 LastLevel;
+ UINT32 Count;
UINT32 BitOffset;
+ UINT32 Flags;
ACPI_WALK_STATE *WalkState;
} ACPI_OP_WALK_INFO;
@@ -174,6 +211,148 @@ ACPI_STATUS (*ASL_WALK_CALLBACK) (
UINT32 Level,
void *Context);
+typedef struct acpi_resource_tag
+{
+ UINT32 BitIndex;
+ char *Tag;
+
+} ACPI_RESOURCE_TAG;
+
+/* Strings used for decoding flags to ASL keywords */
+
+extern const char *AcpiGbl_WordDecode[];
+extern const char *AcpiGbl_IrqDecode[];
+extern const char *AcpiGbl_LockRule[];
+extern const char *AcpiGbl_AccessTypes[];
+extern const char *AcpiGbl_UpdateRules[];
+extern const char *AcpiGbl_MatchOps[];
+
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoAsf0[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoAsf1[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoAsf1a[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoAsf2[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoAsf2a[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoAsf3[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoAsf4[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoAsfHdr[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoBoot[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoCpep[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoCpep0[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoDbgp[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmarHdr[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmarScope[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar0[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar1[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoEcdt[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoFacs[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoFadt1[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoFadt2[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoGas[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoHeader[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoHpet[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt0[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt1[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt2[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt3[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt4[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt5[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt6[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt7[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt8[];
+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 AcpiDmTableInfoSlit[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoSpcr[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoSpmi[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoSrat[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoSrat0[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoSrat1[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoTcpa[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoWdrt[];
+
+
+/*
+ * dmtable
+ */
+void
+AcpiDmDumpDataTable (
+ ACPI_TABLE_HEADER *Table);
+
+void
+AcpiDmDumpTable (
+ UINT32 TableLength,
+ UINT32 TableOffset,
+ void *Table,
+ UINT32 SubTableLength,
+ ACPI_DMTABLE_INFO *Info);
+
+void
+AcpiDmLineHeader (
+ UINT32 Offset,
+ UINT32 ByteLength,
+ char *Name);
+
+void
+AcpiDmLineHeader2 (
+ UINT32 Offset,
+ UINT32 ByteLength,
+ char *Name,
+ UINT32 Value);
+
+
+/*
+ * dmtbdump
+ */
+void
+AcpiDmDumpAsf (
+ ACPI_TABLE_HEADER *Table);
+
+void
+AcpiDmDumpCpep (
+ ACPI_TABLE_HEADER *Table);
+
+void
+AcpiDmDumpDmar (
+ ACPI_TABLE_HEADER *Table);
+
+void
+AcpiDmDumpFadt (
+ ACPI_TABLE_HEADER *Table);
+
+void
+AcpiDmDumpSrat (
+ ACPI_TABLE_HEADER *Table);
+
+void
+AcpiDmDumpMcfg (
+ ACPI_TABLE_HEADER *Table);
+
+void
+AcpiDmDumpMadt (
+ ACPI_TABLE_HEADER *Table);
+
+UINT32
+AcpiDmDumpRsdp (
+ ACPI_TABLE_HEADER *Table);
+
+void
+AcpiDmDumpRsdt (
+ ACPI_TABLE_HEADER *Table);
+
+void
+AcpiDmDumpSlit (
+ ACPI_TABLE_HEADER *Table);
+
+void
+AcpiDmDumpXsdt (
+ ACPI_TABLE_HEADER *Table);
+
/*
* dmwalk
@@ -184,6 +363,13 @@ AcpiDmDisassemble (
ACPI_PARSE_OBJECT *Origin,
UINT32 NumOpcodes);
+void
+AcpiDmWalkParseTree (
+ ACPI_PARSE_OBJECT *Op,
+ ASL_WALK_CALLBACK DescendingCallback,
+ ASL_WALK_CALLBACK AscendingCallback,
+ void *Context);
+
/*
* dmopcode
@@ -328,10 +514,11 @@ AcpiDmDumpInteger64 (
void
AcpiDmResourceTemplate (
ACPI_OP_WALK_INFO *Info,
+ ACPI_PARSE_OBJECT *Op,
UINT8 *ByteData,
UINT32 ByteCount);
-BOOLEAN
+ACPI_STATUS
AcpiDmIsResourceTemplate (
ACPI_PARSE_OBJECT *Op);
@@ -347,6 +534,10 @@ void
AcpiDmDecodeAttribute (
UINT8 Attribute);
+void
+AcpiDmDescriptorName (
+ void);
+
/*
* dmresrcl
@@ -470,6 +661,20 @@ AcpiDmVendorSmallDescriptor (
*/
void
AcpiDmAddToExternalList (
- char *Path);
+ char *Path,
+ UINT8 Type,
+ UINT32 Value);
+
+/*
+ * dmrestag
+ */
+void
+AcpiDmFindResources (
+ ACPI_PARSE_OBJECT *Root);
+
+void
+AcpiDmCheckResourceReference (
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_WALK_STATE *WalkState);
#endif /* __ACDISASM_H__ */
diff --git a/sys/contrib/dev/acpica/acdispat.h b/sys/contrib/dev/acpica/acdispat.h
index f7cedf4..056acd9 100644
--- a/sys/contrib/dev/acpica/acdispat.h
+++ b/sys/contrib/dev/acpica/acdispat.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acdispat.h - dispatcher (parser to interpreter interface)
- * $Revision: 1.67 $
+ * $Revision: 1.76 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -324,21 +324,26 @@ AcpiDsRestartControlMethod (
void
AcpiDsTerminateControlMethod (
+ ACPI_OPERAND_OBJECT *MethodDesc,
ACPI_WALK_STATE *WalkState);
ACPI_STATUS
AcpiDsBeginMethodExecution (
ACPI_NAMESPACE_NODE *MethodNode,
ACPI_OPERAND_OBJECT *ObjDesc,
- ACPI_NAMESPACE_NODE *CallingMethodNode);
+ ACPI_WALK_STATE *WalkState);
+ACPI_STATUS
+AcpiDsMethodError (
+ ACPI_STATUS Status,
+ ACPI_WALK_STATE *WalkState);
/*
* dsinit
*/
ACPI_STATUS
AcpiDsInitializeObjects (
- ACPI_TABLE_DESC *TableDesc,
+ ACPI_NATIVE_UINT TableIndex,
ACPI_NAMESPACE_NODE *StartNode);
@@ -416,6 +421,10 @@ void
AcpiDsClearOperands (
ACPI_WALK_STATE *WalkState);
+ACPI_STATUS
+AcpiDsEvaluateNamePath (
+ ACPI_WALK_STATE *WalkState);
+
/*
* dswscope - Scope Stack manipulation
@@ -463,10 +472,10 @@ AcpiDsInitAmlWalk (
ACPI_NAMESPACE_NODE *MethodNode,
UINT8 *AmlStart,
UINT32 AmlLength,
- ACPI_PARAMETER_INFO *Info,
+ ACPI_EVALUATE_INFO *Info,
UINT8 PassNumber);
-ACPI_STATUS
+void
AcpiDsObjStackPopAndDelete (
UINT32 PopCount,
ACPI_WALK_STATE *WalkState);
@@ -485,14 +494,6 @@ AcpiDsPushWalkState (
ACPI_THREAD_STATE *Thread);
ACPI_STATUS
-AcpiDsResultStackPop (
- ACPI_WALK_STATE *WalkState);
-
-ACPI_STATUS
-AcpiDsResultStackPush (
- ACPI_WALK_STATE *WalkState);
-
-ACPI_STATUS
AcpiDsResultStackClear (
ACPI_WALK_STATE *WalkState);
@@ -501,12 +502,6 @@ AcpiDsGetCurrentWalkState (
ACPI_THREAD_STATE *Thread);
ACPI_STATUS
-AcpiDsResultRemove (
- ACPI_OPERAND_OBJECT **Object,
- UINT32 Index,
- ACPI_WALK_STATE *WalkState);
-
-ACPI_STATUS
AcpiDsResultPop (
ACPI_OPERAND_OBJECT **Object,
ACPI_WALK_STATE *WalkState);
@@ -516,9 +511,4 @@ AcpiDsResultPush (
ACPI_OPERAND_OBJECT *Object,
ACPI_WALK_STATE *WalkState);
-ACPI_STATUS
-AcpiDsResultPopFromBottom (
- ACPI_OPERAND_OBJECT **Object,
- ACPI_WALK_STATE *WalkState);
-
#endif /* _ACDISPAT_H_ */
diff --git a/sys/contrib/dev/acpica/acefi.h b/sys/contrib/dev/acpica/acefi.h
index 7dde203..3916ffa 100644
--- a/sys/contrib/dev/acpica/acefi.h
+++ b/sys/contrib/dev/acpica/acefi.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acefi.h - OS specific defines, etc.
- * $Revision: 1.16 $
+ * $Revision: 1.18 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
diff --git a/sys/contrib/dev/acpica/acenv.h b/sys/contrib/dev/acpica/acenv.h
index ab7b529..7ae1042 100644
--- a/sys/contrib/dev/acpica/acenv.h
+++ b/sys/contrib/dev/acpica/acenv.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acenv.h - Generation environment specific items
- * $Revision: 1.119 $
+ * $Revision: 1.131 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -123,33 +123,41 @@
*/
#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
-#ifdef ACPI_DUMP_APP
-#ifndef MSDOS
+#ifdef ACPI_ASL_COMPILER
#define ACPI_DEBUG_OUTPUT
-#endif
#define ACPI_APPLICATION
#define ACPI_DISASSEMBLER
-#define ACPI_NO_METHOD_EXECUTION
+#define ACPI_CONSTANT_EVAL_ONLY
+#define ACPI_LARGE_NAMESPACE_NODE
+#define ACPI_DATA_TABLE_DISASSEMBLY
#endif
#ifdef ACPI_EXEC_APP
#undef DEBUGGER_THREADING
#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED
-#define ACPI_DEBUG_OUTPUT
+#define ACPI_FULL_DEBUG
#define ACPI_APPLICATION
#define ACPI_DEBUGGER
-#define ACPI_DISASSEMBLER
#define ACPI_MUTEX_DEBUG
+#define ACPI_DBG_TRACK_ALLOCATIONS
#endif
-#ifdef ACPI_ASL_COMPILER
+#ifdef ACPI_DASM_APP
+#ifndef MSDOS
#define ACPI_DEBUG_OUTPUT
+#endif
#define ACPI_APPLICATION
#define ACPI_DISASSEMBLER
-#define ACPI_CONSTANT_EVAL_ONLY
+#define ACPI_NO_METHOD_EXECUTION
+#define ACPI_LARGE_NAMESPACE_NODE
+#define ACPI_DATA_TABLE_DISASSEMBLY
#endif
#ifdef ACPI_APPLICATION
@@ -157,6 +165,13 @@
#define ACPI_USE_LOCAL_CACHE
#endif
+#ifdef ACPI_FULL_DEBUG
+#define ACPI_DEBUGGER
+#define ACPI_DEBUG_OUTPUT
+#define ACPI_DISASSEMBLER
+#endif
+
+
/*
* Environment configuration. The purpose of this file is to interface to the
* local generation environment.
@@ -211,7 +226,7 @@
#elif defined(MSDOS) /* Must appear after WIN32 and WIN64 check */
#include "acdos16.h"
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
#include <contrib/dev/acpica/acfreebsd.h>
#elif defined(__NetBSD__)
@@ -223,6 +238,9 @@
#elif defined(NETWARE)
#include "acnetware.h"
+#elif defined(__sun)
+#include "acsolaris.h"
+
#else
/* All other environments */
@@ -232,24 +250,6 @@
#define COMPILER_DEPENDENT_INT64 long long
#define COMPILER_DEPENDENT_UINT64 unsigned long long
-/*
- * This macro is used to tag functions as "printf-like" because
- * some compilers can catch printf format string problems. MSVC
- * doesn't, so this is proprocessed away.
- */
-#define ACPI_PRINTF_LIKE_FUNC
-
-#endif
-
-/*
- * Memory allocation tracking. Used only if
- * 1) This is the debug version
- * 2) This is NOT a 16-bit version of the code (not enough real-mode memory)
- */
-#ifdef ACPI_DEBUG_OUTPUT
-#if ACPI_MACHINE_WIDTH != 16
-#define ACPI_DBG_TRACK_ALLOCATIONS
-#endif
#endif
/*! [End] no source code translation !*/
diff --git a/sys/contrib/dev/acpica/acevents.h b/sys/contrib/dev/acpica/acevents.h
index 58dc9a1..8f74cb7 100644
--- a/sys/contrib/dev/acpica/acevents.h
+++ b/sys/contrib/dev/acpica/acevents.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acevents.h - Event subcomponent prototypes and defines
- * $Revision: 1.103 $
+ * $Revision: 1.107 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -129,6 +129,10 @@ ACPI_STATUS
AcpiEvInstallXruptHandlers (
void);
+ACPI_STATUS
+AcpiEvInstallFadtGpes (
+ void);
+
UINT32
AcpiEvFixedEventDetect (
void);
@@ -212,6 +216,11 @@ AcpiEvCreateGpeBlock (
ACPI_GPE_BLOCK_INFO **ReturnGpeBlock);
ACPI_STATUS
+AcpiEvInitializeGpeBlock (
+ ACPI_NAMESPACE_NODE *GpeDevice,
+ ACPI_GPE_BLOCK_INFO *GpeBlock);
+
+ACPI_STATUS
AcpiEvDeleteGpeBlock (
ACPI_GPE_BLOCK_INFO *GpeBlock);
@@ -255,7 +264,7 @@ AcpiEvAddressSpaceDispatch (
UINT32 Function,
ACPI_PHYSICAL_ADDRESS Address,
UINT32 BitWidth,
- void *Value);
+ ACPI_INTEGER *Value);
ACPI_STATUS
AcpiEvAttachRegion (
diff --git a/sys/contrib/dev/acpica/acexcep.h b/sys/contrib/dev/acpica/acexcep.h
index cf5d0ba..ccc1537 100644
--- a/sys/contrib/dev/acpica/acexcep.h
+++ b/sys/contrib/dev/acpica/acexcep.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acexcep.h - Exception codes returned by the ACPI subsystem
- * $Revision: 1.75 $
+ * $Revision: 1.79 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -239,8 +239,9 @@
#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 0x0021
+#define AE_CODE_AML_MAX 0x0022
/*
@@ -257,8 +258,10 @@
#define AE_CTRL_BREAK (ACPI_STATUS) (0x0009 | AE_CODE_CONTROL)
#define AE_CTRL_CONTINUE (ACPI_STATUS) (0x000A | AE_CODE_CONTROL)
#define AE_CTRL_SKIP (ACPI_STATUS) (0x000B | AE_CODE_CONTROL)
+#define AE_CTRL_PARSE_CONTINUE (ACPI_STATUS) (0x000C | AE_CODE_CONTROL)
+#define AE_CTRL_PARSE_PENDING (ACPI_STATUS) (0x000D | AE_CODE_CONTROL)
-#define AE_CODE_CTRL_MAX 0x000B
+#define AE_CODE_CTRL_MAX 0x000D
#ifdef DEFINE_ACPI_GLOBALS
@@ -361,7 +364,8 @@ char const *AcpiGbl_ExceptionNames_Aml[] =
"AE_AML_NO_RESOURCE_END_TAG",
"AE_AML_BAD_RESOURCE_VALUE",
"AE_AML_CIRCULAR_REFERENCE",
- "AE_AML_BAD_RESOURCE_LENGTH"
+ "AE_AML_BAD_RESOURCE_LENGTH",
+ "AE_AML_ILLEGAL_ADDRESS"
};
char const *AcpiGbl_ExceptionNames_Ctrl[] =
@@ -376,7 +380,9 @@ char const *AcpiGbl_ExceptionNames_Ctrl[] =
"AE_CTRL_TRANSFER",
"AE_CTRL_BREAK",
"AE_CTRL_CONTINUE",
- "AE_CTRL_SKIP"
+ "AE_CTRL_SKIP",
+ "AE_CTRL_PARSE_CONTINUE",
+ "AE_CTRL_PARSE_PENDING"
};
#endif /* ACPI GLOBALS */
diff --git a/sys/contrib/dev/acpica/acfreebsd.h b/sys/contrib/dev/acpica/acfreebsd.h
index 9284579..35975cd 100644
--- a/sys/contrib/dev/acpica/acfreebsd.h
+++ b/sys/contrib/dev/acpica/acfreebsd.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acfreebsd.h - OS specific defines, etc.
- * $Revision: 1.19 $
+ * $Revision: 1.25 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -124,6 +124,11 @@
#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
+
#ifdef _KERNEL
#include "opt_acpi.h"
#endif
@@ -143,7 +148,9 @@
#ifdef DEBUGGER_THREADING
#undef DEBUGGER_THREADING
#endif /* DEBUGGER_THREADING */
+
#define DEBUGGER_THREADING 0 /* integrated with DDB */
+
#ifdef ACPI_DEBUG_OUTPUT
#include "opt_ddb.h"
#ifdef DDB
@@ -172,22 +179,22 @@
#ifdef _KERNEL
/* Or strstr (used in debugging mode, also move to libkern) */
static __inline char *
-strstr(char *s, char *find)
+strstr (char *s, char *find)
{
char c, sc;
size_t len;
if ((c = *find++) != 0) {
- len = strlen(find);
- do {
+ len = strlen (find);
do {
- if ((sc = *s++) == 0)
- return (NULL);
- } while (sc != c);
- } while (strncmp(s, find, len) != 0);
- s--;
+ do {
+ if ((sc = *s++) == 0)
+ return (NULL);
+ } while (sc != c);
+ } while (strncmp (s, find, len) != 0);
+ s--;
}
- return ((char *)s);
+ return ((char *) s);
}
#endif /* _KERNEL */
diff --git a/sys/contrib/dev/acpica/acgcc.h b/sys/contrib/dev/acpica/acgcc.h
index 4902729..28576b1 100644
--- a/sys/contrib/dev/acpica/acgcc.h
+++ b/sys/contrib/dev/acpica/acgcc.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acgcc.h - GCC specific defines, etc.
- * $Revision: 1.29 $
+ * $Revision: 1.32 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -121,16 +121,19 @@
#define ACPI_GET_FUNCTION_NAME __FUNCTION__
-/* This macro is used to tag functions as "printf-like" because
+/*
+ * This macro is used to tag functions as "printf-like" because
* some compilers (like GCC) can catch printf format string problems.
*/
-#define ACPI_PRINTF_LIKE_FUNC __attribute__ ((__format__ (__printf__, 6, 7)))
+#define ACPI_PRINTF_LIKE(c) __attribute__ ((__format__ (__printf__, c, c+1)))
-/* Some compilers complain about unused variables. Sometimes we don't want to
+/*
+ * Some compilers complain about unused variables. Sometimes we don't want to
* use all the variables (for example, _AcpiModuleName). This allows us
* to to tell the compiler warning in a per-variable manner that a variable
* is unused.
*/
#define ACPI_UNUSED_VAR __attribute__ ((unused))
+
#endif /* __ACGCC_H__ */
diff --git a/sys/contrib/dev/acpica/acglobal.h b/sys/contrib/dev/acpica/acglobal.h
index 0046ae1..1e13733 100644
--- a/sys/contrib/dev/acpica/acglobal.h
+++ b/sys/contrib/dev/acpica/acglobal.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acglobal.h - Declarations for global variables
- * $Revision: 1.168 $
+ * $Revision: 1.194 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -132,37 +132,6 @@
#define ACPI_INIT_GLOBAL(a,b) a
#endif
-/*
- * Keep local copies of these FADT-based registers. NOTE: These globals
- * are first in this file for alignment reasons on 64-bit systems.
- */
-ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1aEnable;
-ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1bEnable;
-
-
-/*****************************************************************************
- *
- * Debug support
- *
- ****************************************************************************/
-
-/* Runtime configuration of debug print levels */
-
-extern UINT32 AcpiDbgLevel;
-extern UINT32 AcpiDbgLayer;
-
-/* Procedure nesting level for debug output */
-
-extern UINT32 AcpiGbl_NestingLevel;
-
-/* 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;
/*****************************************************************************
*
@@ -173,11 +142,16 @@ ACPI_EXTERN UINT32 AcpiGbl_TraceFlags;
/*
* Enable "slack" in the AML interpreter? Default is FALSE, and the
* interpreter strictly follows the ACPI specification. Setting to TRUE
- * allows the interpreter to forgive certain bad AML constructs. Currently:
+ * allows the interpreter to ignore certain errors and/or bad AML constructs.
+ *
+ * Currently, these features are enabled by this flag:
+ *
* 1) Allow "implicit return" of last value in a control method
- * 2) Allow access beyond end of operation region
+ * 2) Allow access beyond the end of an operation region
* 3) Allow access to uninitialized locals/args (auto-init to integer 0)
* 4) Allow ANY object type to be a source operand for the Store() operator
+ * 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);
@@ -211,55 +185,58 @@ ACPI_EXTERN UINT8 ACPI_INIT_GLOBAL (AcpiGbl_LeaveWakeGpesDisabled, TRUE);
****************************************************************************/
/*
- * Table pointers.
- * Although these pointers are somewhat redundant with the global AcpiTable,
- * they are convenient because they are typed pointers.
+ * AcpiGbl_RootTableList is the master list of ACPI tables found in the
+ * RSDT/XSDT.
*
- * These tables are single-table only; meaning that there can be at most one
- * of each in the system. Each global points to the actual table.
- */
-ACPI_EXTERN UINT32 AcpiGbl_TableFlags;
-ACPI_EXTERN UINT32 AcpiGbl_RsdtTableCount;
-ACPI_EXTERN RSDP_DESCRIPTOR *AcpiGbl_RSDP;
-ACPI_EXTERN XSDT_DESCRIPTOR *AcpiGbl_XSDT;
-ACPI_EXTERN FADT_DESCRIPTOR *AcpiGbl_FADT;
-ACPI_EXTERN ACPI_TABLE_HEADER *AcpiGbl_DSDT;
-ACPI_EXTERN FACS_DESCRIPTOR *AcpiGbl_FACS;
-ACPI_EXTERN ACPI_COMMON_FACS AcpiGbl_CommonFACS;
-/*
- * Since there may be multiple SSDTs and PSDTs, a single pointer is not
- * sufficient; Therefore, there isn't one!
+ * 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;
+/* These addresses are calculated from FADT address values */
-/* The root table can be either an RSDT or an XSDT */
-
-ACPI_EXTERN UINT8 AcpiGbl_RootTableType;
-#define ACPI_TABLE_TYPE_RSDT 'R'
-#define ACPI_TABLE_TYPE_XSDT 'X'
-
+ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1aEnable;
+ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1bEnable;
/*
- * Handle both ACPI 1.0 and ACPI 2.0 Integer widths:
- * If we are executing a method that exists in a 32-bit ACPI table,
- * use only the lower 32 bits of the (internal) 64-bit Integer.
+ * Handle both ACPI 1.0 and ACPI 2.0 Integer widths. The integer width is
+ * determined by the revision of the DSDT: If the DSDT revision is less than
+ * 2, use only the lower 32 bits of the internal 64-bit Integer.
*/
ACPI_EXTERN UINT8 AcpiGbl_IntegerBitWidth;
ACPI_EXTERN UINT8 AcpiGbl_IntegerByteWidth;
ACPI_EXTERN UINT8 AcpiGbl_IntegerNybbleWidth;
-/*
- * ACPI Table info arrays
- */
-extern ACPI_TABLE_LIST AcpiGbl_TableLists[NUM_ACPI_TABLE_TYPES];
-extern ACPI_TABLE_SUPPORT AcpiGbl_TableData[NUM_ACPI_TABLE_TYPES];
+
+/*****************************************************************************
+ *
+ * Mutual exlusion within ACPICA subsystem
+ *
+ ****************************************************************************/
/*
- * Predefined mutex objects. This array contains the
+ * Predefined mutex objects. This array contains the
* actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs.
* (The table maps local handles to the real OS handles)
*/
-ACPI_EXTERN ACPI_MUTEX_INFO AcpiGbl_MutexInfo[NUM_MUTEX];
+ACPI_EXTERN ACPI_MUTEX_INFO AcpiGbl_MutexInfo[ACPI_NUM_MUTEX];
+
+/*
+ * Global lock mutex is an actual AML mutex object
+ * Global lock semaphore works in conjunction with the HW global lock
+ */
+ACPI_EXTERN ACPI_OPERAND_OBJECT *AcpiGbl_GlobalLockMutex;
+ACPI_EXTERN ACPI_SEMAPHORE AcpiGbl_GlobalLockSemaphore;
+ACPI_EXTERN UINT16 AcpiGbl_GlobalLockHandle;
+ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockAcquired;
+ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockPresent;
+
+/*
+ * Spinlocks are used for interfaces that can be possibly called at
+ * interrupt level
+ */
+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 */
/*****************************************************************************
@@ -268,16 +245,9 @@ ACPI_EXTERN ACPI_MUTEX_INFO AcpiGbl_MutexInfo[NUM_MUTEX];
*
****************************************************************************/
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
-
-/* Lists for tracking memory allocations */
-
-ACPI_EXTERN ACPI_MEMORY_LIST *AcpiGbl_GlobalList;
-ACPI_EXTERN ACPI_MEMORY_LIST *AcpiGbl_NsNodeList;
-#endif
-
/* Object caches */
+ACPI_EXTERN ACPI_CACHE_T *AcpiGbl_NamespaceCache;
ACPI_EXTERN ACPI_CACHE_T *AcpiGbl_StateCache;
ACPI_EXTERN ACPI_CACHE_T *AcpiGbl_PsNodeCache;
ACPI_EXTERN ACPI_CACHE_T *AcpiGbl_PsNodeExtCache;
@@ -290,34 +260,56 @@ 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_WALK_STATE *AcpiGbl_BreakpointWalk;
-ACPI_EXTERN ACPI_HANDLE AcpiGbl_GlobalLockSemaphore;
+
+/* Owner ID support */
+
+ACPI_EXTERN UINT32 AcpiGbl_OwnerIdMask[ACPI_NUM_OWNERID_MASKS];
+ACPI_EXTERN UINT8 AcpiGbl_LastOwnerIdIndex;
+ACPI_EXTERN UINT8 AcpiGbl_NextOwnerIdOffset;
/* Misc */
-ACPI_EXTERN UINT32 AcpiGbl_GlobalLockThreadCount;
ACPI_EXTERN UINT32 AcpiGbl_OriginalMode;
ACPI_EXTERN UINT32 AcpiGbl_RsdpOriginalLocation;
ACPI_EXTERN UINT32 AcpiGbl_NsLookupCount;
ACPI_EXTERN UINT32 AcpiGbl_PsFindCount;
-ACPI_EXTERN UINT32 AcpiGbl_OwnerIdMask;
ACPI_EXTERN UINT16 AcpiGbl_Pm1EnableRegisterSave;
-ACPI_EXTERN UINT16 AcpiGbl_GlobalLockHandle;
ACPI_EXTERN UINT8 AcpiGbl_DebuggerConfiguration;
-ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockAcquired;
ACPI_EXTERN BOOLEAN AcpiGbl_StepToNextCall;
ACPI_EXTERN BOOLEAN AcpiGbl_AcpiHardwarePresent;
-ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockPresent;
ACPI_EXTERN BOOLEAN AcpiGbl_EventsInitialized;
ACPI_EXTERN BOOLEAN AcpiGbl_SystemAwakeAndRunning;
+
+#ifndef DEFINE_ACPI_GLOBALS
+
+/* Exception codes */
+
+extern char const *AcpiGbl_ExceptionNames_Env[];
+extern char const *AcpiGbl_ExceptionNames_Pgm[];
+extern char const *AcpiGbl_ExceptionNames_Tbl[];
+extern char const *AcpiGbl_ExceptionNames_Aml[];
+extern char const *AcpiGbl_ExceptionNames_Ctrl[];
+
+/* Other miscellaneous */
+
extern BOOLEAN AcpiGbl_Shutdown;
extern UINT32 AcpiGbl_StartupFlags;
-extern const UINT8 AcpiGbl_DecodeTo8bit[8];
extern const char *AcpiGbl_SleepStateNames[ACPI_S_STATE_COUNT];
extern const char *AcpiGbl_HighestDstateNames[4];
extern const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[AML_NUM_OPCODES];
extern const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS];
-extern const char *AcpiGbl_ValidOsiStrings[ACPI_NUM_OSI_STRINGS];
+#endif
+
+
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+
+/* Lists for tracking memory allocations */
+
+ACPI_EXTERN ACPI_MEMORY_LIST *AcpiGbl_GlobalList;
+ACPI_EXTERN ACPI_MEMORY_LIST *AcpiGbl_NsNodeList;
+ACPI_EXTERN BOOLEAN AcpiGbl_DisplayFinalMemStats;
+#endif
/*****************************************************************************
@@ -367,15 +359,6 @@ ACPI_EXTERN UINT8 AcpiGbl_CmSingleStep;
/*****************************************************************************
*
- * Parser globals
- *
- ****************************************************************************/
-
-ACPI_EXTERN ACPI_PARSE_OBJECT *AcpiGbl_ParsedNamespaceRoot;
-
-
-/*****************************************************************************
- *
* Hardware globals
*
****************************************************************************/
@@ -395,7 +378,35 @@ extern ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EV
ACPI_EXTERN ACPI_FIXED_EVENT_HANDLER AcpiGbl_FixedEventHandlers[ACPI_NUM_FIXED_EVENTS];
ACPI_EXTERN ACPI_GPE_XRUPT_INFO *AcpiGbl_GpeXruptListHead;
ACPI_EXTERN ACPI_GPE_BLOCK_INFO *AcpiGbl_GpeFadtBlocks[ACPI_MAX_GPE_BLOCKS];
-ACPI_EXTERN ACPI_HANDLE AcpiGbl_GpeLock;
+
+
+/*****************************************************************************
+ *
+ * Debug support
+ *
+ ****************************************************************************/
+
+/* 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 AcpiGpeCount;
+
+/* 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;
/*****************************************************************************
diff --git a/sys/contrib/dev/acpica/achware.h b/sys/contrib/dev/acpica/achware.h
index 76916b5..e132ec6 100644
--- a/sys/contrib/dev/acpica/achware.h
+++ b/sys/contrib/dev/acpica/achware.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: achware.h -- hardware specific interfaces
- * $Revision: 1.79 $
+ * $Revision: 1.83 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -138,10 +138,6 @@
* hwacpi - high level functions
*/
ACPI_STATUS
-AcpiHwInitialize (
- void);
-
-ACPI_STATUS
AcpiHwSetMode (
UINT32 Mode);
@@ -183,7 +179,7 @@ AcpiHwLowLevelWrite (
ACPI_STATUS
AcpiHwClearAcpiStatus (
- UINT32 Flags);
+ void);
/*
diff --git a/sys/contrib/dev/acpica/acinterp.h b/sys/contrib/dev/acpica/acinterp.h
index 470eef6..367266c 100644
--- a/sys/contrib/dev/acpica/acinterp.h
+++ b/sys/contrib/dev/acpica/acinterp.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acinterp.h - Interpreter subcomponent prototypes and defines
- * $Revision: 1.162 $
+ * $Revision: 1.171 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -118,7 +118,54 @@
#define __ACINTERP_H__
-#define ACPI_WALK_OPERANDS (&(WalkState->Operands [WalkState->NumOperands -1]))
+#define ACPI_WALK_OPERANDS (&(WalkState->Operands [WalkState->NumOperands -1]))
+
+/* Macros for tables used for debug output */
+
+#define ACPI_EXD_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_OPERAND_OBJECT,f)
+#define ACPI_EXD_NSOFFSET(f) (UINT8) ACPI_OFFSET (ACPI_NAMESPACE_NODE,f)
+#define ACPI_EXD_TABLE_SIZE(name) (sizeof(name) / sizeof (ACPI_EXDUMP_INFO))
+
+/*
+ * If possible, pack the following structures to byte alignment, since we
+ * don't care about performance for debug output. Two cases where we cannot
+ * pack the structures:
+ *
+ * 1) Hardware does not support misaligned memory transfers
+ * 2) Compiler does not support pointers within packed structures
+ */
+#if (!defined(ACPI_MISALIGNMENT_NOT_SUPPORTED) && !defined(ACPI_PACKED_POINTERS_NOT_SUPPORTED))
+#pragma pack(1)
+#endif
+
+typedef const struct acpi_exdump_info
+{
+ UINT8 Opcode;
+ UINT8 Offset;
+ char *Name;
+
+} ACPI_EXDUMP_INFO;
+
+/* Values for the Opcode field above */
+
+#define ACPI_EXD_INIT 0
+#define ACPI_EXD_TYPE 1
+#define ACPI_EXD_UINT8 2
+#define ACPI_EXD_UINT16 3
+#define ACPI_EXD_UINT32 4
+#define ACPI_EXD_UINT64 5
+#define ACPI_EXD_LITERAL 6
+#define ACPI_EXD_POINTER 7
+#define ACPI_EXD_ADDRESS 8
+#define ACPI_EXD_STRING 9
+#define ACPI_EXD_BUFFER 10
+#define ACPI_EXD_PACKAGE 11
+#define ACPI_EXD_FIELD 12
+#define ACPI_EXD_REFERENCE 13
+
+/* restore default alignment */
+
+#pragma pack()
/*
@@ -334,10 +381,20 @@ AcpiExAcquireMutex (
ACPI_WALK_STATE *WalkState);
ACPI_STATUS
+AcpiExAcquireMutexObject (
+ UINT16 Timeout,
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_THREAD_ID ThreadId);
+
+ACPI_STATUS
AcpiExReleaseMutex (
ACPI_OPERAND_OBJECT *ObjDesc,
ACPI_WALK_STATE *WalkState);
+ACPI_STATUS
+AcpiExReleaseMutexObject (
+ ACPI_OPERAND_OBJECT *ObjDesc);
+
void
AcpiExReleaseAllMutexes (
ACPI_THREAD_STATE *Thread);
@@ -380,15 +437,6 @@ AcpiExSystemDoStall (
UINT32 Time);
ACPI_STATUS
-AcpiExSystemAcquireMutex(
- ACPI_OPERAND_OBJECT *Time,
- ACPI_OPERAND_OBJECT *ObjDesc);
-
-ACPI_STATUS
-AcpiExSystemReleaseMutex(
- ACPI_OPERAND_OBJECT *ObjDesc);
-
-ACPI_STATUS
AcpiExSystemSignalEvent(
ACPI_OPERAND_OBJECT *ObjDesc);
@@ -403,9 +451,13 @@ AcpiExSystemResetEvent(
ACPI_STATUS
AcpiExSystemWaitSemaphore (
- ACPI_HANDLE Semaphore,
+ ACPI_SEMAPHORE Semaphore,
UINT16 Timeout);
+ACPI_STATUS
+AcpiExSystemWaitMutex (
+ ACPI_MUTEX Mutex,
+ UINT16 Timeout);
/*
* exoparg1 - ACPI AML execution, 1 operand
@@ -529,7 +581,7 @@ AcpiExDumpObjectDescriptor (
UINT32 Flags);
void
-AcpiExDumpNode (
+AcpiExDumpNamespaceNode (
ACPI_NAMESPACE_NODE *Node,
UINT32 Flags);
@@ -623,7 +675,7 @@ AcpiExCopyIntegerToBufferField (
/*
* exutils - interpreter/scanner utilities
*/
-ACPI_STATUS
+void
AcpiExEnterInterpreter (
void);
@@ -632,16 +684,24 @@ AcpiExExitInterpreter (
void);
void
+AcpiExReacquireInterpreter (
+ void);
+
+void
+AcpiExRelinquishInterpreter (
+ void);
+
+void
AcpiExTruncateFor32bitTable (
ACPI_OPERAND_OBJECT *ObjDesc);
-BOOLEAN
+void
AcpiExAcquireGlobalLock (
UINT32 Rule);
void
AcpiExReleaseGlobalLock (
- BOOLEAN Locked);
+ UINT32 Rule);
void
AcpiExEisaIdToString (
diff --git a/sys/contrib/dev/acpica/aclocal.h b/sys/contrib/dev/acpica/aclocal.h
index 314d69b..ba1145e 100644
--- a/sys/contrib/dev/acpica/aclocal.h
+++ b/sys/contrib/dev/acpica/aclocal.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: aclocal.h - Internal data types used across the ACPI subsystem
- * $Revision: 1.215 $
+ * $Revision: 1.247 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -117,12 +117,14 @@
#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 void * ACPI_MUTEX;
typedef UINT32 ACPI_MUTEX_HANDLE;
-
+#define ACPI_GLOBAL_LOCK (ACPI_SEMAPHORE) (-1)
/* Total number of aml opcodes defined */
@@ -147,55 +149,56 @@ union acpi_parse_object;
* Predefined handles for the mutex objects used within the subsystem
* All mutex objects are automatically created by AcpiUtMutexInitialize.
*
- * The acquire/release ordering protocol is implied via this list. Mutexes
+ * The acquire/release ordering protocol is implied via this list. Mutexes
* with a lower value must be acquired before mutexes with a higher value.
*
- * NOTE: any changes here must be reflected in the AcpiGbl_MutexNames table also!
+ * NOTE: any changes here must be reflected in the AcpiGbl_MutexNames
+ * table below also!
*/
-#define ACPI_MTX_EXECUTE 0
-#define ACPI_MTX_INTERPRETER 1
-#define ACPI_MTX_PARSER 2
-#define ACPI_MTX_DISPATCHER 3
-#define ACPI_MTX_TABLES 4
-#define ACPI_MTX_OP_REGIONS 5
-#define ACPI_MTX_NAMESPACE 6
-#define ACPI_MTX_EVENTS 7
-#define ACPI_MTX_HARDWARE 8
-#define ACPI_MTX_CACHES 9
-#define ACPI_MTX_MEMORY 10
-#define ACPI_MTX_DEBUG_CMD_COMPLETE 11
-#define ACPI_MTX_DEBUG_CMD_READY 12
-
-#define MAX_MUTEX 12
-#define NUM_MUTEX MAX_MUTEX+1
-
+#define ACPI_MTX_INTERPRETER 0 /* AML Interpreter, main lock */
+#define ACPI_MTX_NAMESPACE 1 /* ACPI Namespace */
+#define ACPI_MTX_TABLES 2 /* Data for ACPI tables */
+#define ACPI_MTX_EVENTS 3 /* Data for ACPI events */
+#define ACPI_MTX_CACHES 4 /* Internal caches, general purposes */
+#define ACPI_MTX_MEMORY 5 /* Debug memory tracking lists */
+#define ACPI_MTX_DEBUG_CMD_COMPLETE 6 /* AML debugger */
+#define ACPI_MTX_DEBUG_CMD_READY 7 /* AML debugger */
+
+#define ACPI_MAX_MUTEX 7
+#define ACPI_NUM_MUTEX ACPI_MAX_MUTEX+1
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
#ifdef DEFINE_ACPI_GLOBALS
-/* Names for the mutexes used in the subsystem */
+/* Debug names for the mutexes above */
-static char *AcpiGbl_MutexNames[] =
+static char *AcpiGbl_MutexNames[ACPI_NUM_MUTEX] =
{
- "ACPI_MTX_Execute",
"ACPI_MTX_Interpreter",
- "ACPI_MTX_Parser",
- "ACPI_MTX_Dispatcher",
"ACPI_MTX_Tables",
- "ACPI_MTX_OpRegions",
"ACPI_MTX_Namespace",
"ACPI_MTX_Events",
- "ACPI_MTX_Hardware",
"ACPI_MTX_Caches",
"ACPI_MTX_Memory",
- "ACPI_MTX_DebugCmdComplete",
- "ACPI_MTX_DebugCmdReady",
+ "ACPI_MTX_CommandComplete",
+ "ACPI_MTX_CommandReady"
};
#endif
#endif
+/*
+ * Predefined handles for spinlocks used within the subsystem.
+ * These spinlocks are created by AcpiUtMutexInitialize
+ */
+#define ACPI_LOCK_GPES 0
+#define ACPI_LOCK_HARDWARE 1
+
+#define ACPI_MAX_LOCK 1
+#define ACPI_NUM_LOCK ACPI_MAX_LOCK+1
+
+
/* Owner IDs are used to track namespace nodes for selective deletion */
typedef UINT8 ACPI_OWNER_ID;
@@ -209,9 +212,9 @@ typedef UINT8 ACPI_OWNER_ID;
typedef struct acpi_mutex_info
{
- ACPI_MUTEX Mutex;
- UINT32 UseCount;
- UINT32 ThreadId;
+ ACPI_MUTEX Mutex;
+ UINT32 UseCount;
+ ACPI_THREAD_ID ThreadId;
} ACPI_MUTEX_INFO;
@@ -230,6 +233,9 @@ typedef struct acpi_mutex_info
#define ACPI_FIELD_QWORD_GRANULARITY 8
+#define ACPI_ENTRY_NOT_FOUND NULL
+
+
/*****************************************************************************
*
* Namespace typedefs and structs
@@ -240,103 +246,126 @@ typedef struct acpi_mutex_info
typedef enum
{
- ACPI_IMODE_LOAD_PASS1 = 0x01,
- ACPI_IMODE_LOAD_PASS2 = 0x02,
- ACPI_IMODE_EXECUTE = 0x0E
+ ACPI_IMODE_LOAD_PASS1 = 0x01,
+ ACPI_IMODE_LOAD_PASS2 = 0x02,
+ ACPI_IMODE_EXECUTE = 0x03
} ACPI_INTERPRETER_MODE;
-
-/*
- * The Node describes a named object that appears in the AML
- * An AcpiNode is used to store Nodes.
- *
- * DataType is used to differentiate between internal descriptors, and MUST
- * be the first byte in this structure.
- */
typedef union acpi_name_union
{
- UINT32 Integer;
- char Ascii[4];
+ UINT32 Integer;
+ char Ascii[4];
} ACPI_NAME_UNION;
+
+/*
+ * The Namespace Node describes a named object that appears in the AML.
+ * DescriptorType is used to differentiate between internal descriptors.
+ *
+ * The node is optimized for both 32-bit and 64-bit platforms:
+ * 20 bytes for the 32-bit case, 32 bytes for the 64-bit case.
+ *
+ * Note: The DescriptorType and Type fields must appear in the identical
+ * position in both the ACPI_NAMESPACE_NODE and ACPI_OPERAND_OBJECT
+ * structures.
+ */
typedef struct acpi_namespace_node
{
- UINT8 Descriptor; /* Used to differentiate object descriptor types */
- UINT8 Type; /* Type associated with this name */
- UINT16 ReferenceCount; /* Current count of references and children */
- ACPI_NAME_UNION Name; /* ACPI Name, always 4 chars per ACPI spec */
- union acpi_operand_object *Object; /* Pointer to attached ACPI object (optional) */
- struct acpi_namespace_node *Child; /* First child */
- struct acpi_namespace_node *Peer; /* Next peer*/
- UINT8 OwnerId; /* Who created this node */
- UINT8 Flags;
-
- /* Fields used by the ASL compiler only */
-
-#ifdef ACPI_ASL_COMPILER
- UINT32 Value;
- union acpi_parse_object *Op;
+ union acpi_operand_object *Object; /* Interpreter object */
+ UINT8 DescriptorType; /* Differentiate object descriptor types */
+ UINT8 Type; /* ACPI Type associated with this name */
+ UINT8 Flags; /* Miscellaneous flags */
+ ACPI_OWNER_ID OwnerId; /* Node creator */
+ ACPI_NAME_UNION Name; /* ACPI Name, always 4 chars per ACPI spec */
+ struct acpi_namespace_node *Child; /* First child */
+ struct acpi_namespace_node *Peer; /* Peer. Parent if ANOBJ_END_OF_PEER_LIST set */
+
+ /*
+ * The following fields are used by the ASL compiler and disassembler only
+ */
+#ifdef ACPI_LARGE_NAMESPACE_NODE
+ union acpi_parse_object *Op;
+ UINT32 Value;
+ UINT32 Length;
#endif
} ACPI_NAMESPACE_NODE;
-#define ACPI_ENTRY_NOT_FOUND NULL
-
+/* Namespace Node flags */
-/* Node flags */
+#define ANOBJ_END_OF_PEER_LIST 0x01 /* End-of-list, Peer field points to parent */
+#define ANOBJ_TEMPORARY 0x02 /* Node is create by a method and is temporary */
+#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_RESERVED 0x01
-#define ANOBJ_END_OF_PEER_LIST 0x02
-#define ANOBJ_DATA_WIDTH_32 0x04 /* Parent table is 64-bits */
-#define ANOBJ_METHOD_ARG 0x08
-#define ANOBJ_METHOD_LOCAL 0x10
-#define ANOBJ_METHOD_NO_RETVAL 0x20
-#define ANOBJ_METHOD_SOME_NO_RETVAL 0x40
-#define ANOBJ_IS_BIT_OFFSET 0x80
+#define ANOBJ_IS_EXTERNAL 0x08 /* iASL only: This object created via External() */
+#define ANOBJ_METHOD_NO_RETVAL 0x10 /* iASL only: Method has no return value */
+#define ANOBJ_METHOD_SOME_NO_RETVAL 0x20 /* iASL only: Method has at least one return value */
+#define ANOBJ_IS_BIT_OFFSET 0x40 /* iASL only: Reference is a bit offset */
+#define ANOBJ_IS_REFERENCED 0x80 /* iASL only: Object was referenced */
/*
* ACPI Table Descriptor. One per ACPI table
*/
typedef struct acpi_table_desc
{
- struct acpi_table_desc *Prev;
- struct acpi_table_desc *Next;
- struct acpi_table_desc *InstalledDesc;
- ACPI_TABLE_HEADER *Pointer;
- UINT8 *AmlStart;
- UINT64 PhysicalAddress;
- UINT32 AmlLength;
- ACPI_SIZE Length;
- ACPI_OWNER_ID OwnerId;
- UINT8 Type;
- UINT8 Allocation;
- BOOLEAN LoadedIntoNamespace;
+ 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;
-typedef struct acpi_table_list
+/* 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 */
+
+typedef struct acpi_internal_rsdt
{
- struct acpi_table_desc *Next;
- UINT32 Count;
+ ACPI_TABLE_DESC *Tables;
+ UINT32 Count;
+ UINT32 Size;
+ UINT8 Flags;
-} ACPI_TABLE_LIST;
+} ACPI_INTERNAL_RSDT;
+
+/* Flags for above */
+
+#define ACPI_ROOT_ORIGIN_UNKNOWN (0) /* ~ORIGIN_ALLOCATED */
+#define ACPI_ROOT_ORIGIN_ALLOCATED (1)
+#define ACPI_ROOT_ALLOW_RESIZE (2)
+
+
+/* Predefined (fixed) table indexes */
+
+#define ACPI_TABLE_INDEX_DSDT (0)
+#define ACPI_TABLE_INDEX_FACS (1)
typedef struct acpi_find_context
{
- char *SearchFor;
- ACPI_HANDLE *List;
- UINT32 *Count;
+ char *SearchFor;
+ ACPI_HANDLE *List;
+ UINT32 *Count;
} ACPI_FIND_CONTEXT;
typedef struct acpi_ns_search_data
{
- ACPI_NAMESPACE_NODE *Node;
+ ACPI_NAMESPACE_NODE *Node;
} ACPI_NS_SEARCH_DATA;
@@ -346,30 +375,30 @@ typedef struct acpi_ns_search_data
*/
typedef struct acpi_predefined_names
{
- char *Name;
- UINT8 Type;
- char *Val;
+ char *Name;
+ UINT8 Type;
+ char *Val;
} ACPI_PREDEFINED_NAMES;
/* Object types used during package copies */
-
#define ACPI_COPY_TYPE_SIMPLE 0
#define ACPI_COPY_TYPE_PACKAGE 1
+
/* Info structure used to convert external<->internal namestrings */
typedef struct acpi_namestring_info
{
- char *ExternalName;
- char *NextExternalChar;
- char *InternalName;
- UINT32 Length;
- UINT32 NumSegments;
- UINT32 NumCarats;
- BOOLEAN FullyQualified;
+ char *ExternalName;
+ char *NextExternalChar;
+ char *InternalName;
+ UINT32 Length;
+ UINT32 NumSegments;
+ UINT32 NumCarats;
+ BOOLEAN FullyQualified;
} ACPI_NAMESTRING_INFO;
@@ -378,20 +407,57 @@ typedef struct acpi_namestring_info
typedef struct acpi_create_field_info
{
- ACPI_NAMESPACE_NODE *RegionNode;
- ACPI_NAMESPACE_NODE *FieldNode;
- ACPI_NAMESPACE_NODE *RegisterNode;
- ACPI_NAMESPACE_NODE *DataRegisterNode;
- UINT32 BankValue;
- UINT32 FieldBitPosition;
- UINT32 FieldBitLength;
- UINT8 FieldFlags;
- UINT8 Attribute;
- UINT8 FieldType;
+ ACPI_NAMESPACE_NODE *RegionNode;
+ ACPI_NAMESPACE_NODE *FieldNode;
+ ACPI_NAMESPACE_NODE *RegisterNode;
+ ACPI_NAMESPACE_NODE *DataRegisterNode;
+ UINT32 BankValue;
+ UINT32 FieldBitPosition;
+ UINT32 FieldBitLength;
+ UINT8 FieldFlags;
+ UINT8 Attribute;
+ UINT8 FieldType;
} ACPI_CREATE_FIELD_INFO;
+typedef
+ACPI_STATUS (*ACPI_INTERNAL_METHOD) (
+ struct acpi_walk_state *WalkState);
+
+
+/*
+ * Bitmapped ACPI types. Used internally only
+ */
+#define ACPI_BTYPE_ANY 0x00000000
+#define ACPI_BTYPE_INTEGER 0x00000001
+#define ACPI_BTYPE_STRING 0x00000002
+#define ACPI_BTYPE_BUFFER 0x00000004
+#define ACPI_BTYPE_PACKAGE 0x00000008
+#define ACPI_BTYPE_FIELD_UNIT 0x00000010
+#define ACPI_BTYPE_DEVICE 0x00000020
+#define ACPI_BTYPE_EVENT 0x00000040
+#define ACPI_BTYPE_METHOD 0x00000080
+#define ACPI_BTYPE_MUTEX 0x00000100
+#define ACPI_BTYPE_REGION 0x00000200
+#define ACPI_BTYPE_POWER 0x00000400
+#define ACPI_BTYPE_PROCESSOR 0x00000800
+#define ACPI_BTYPE_THERMAL 0x00001000
+#define ACPI_BTYPE_BUFFER_FIELD 0x00002000
+#define ACPI_BTYPE_DDB_HANDLE 0x00004000
+#define ACPI_BTYPE_DEBUG_OBJECT 0x00008000
+#define ACPI_BTYPE_REFERENCE 0x00010000
+#define ACPI_BTYPE_RESOURCE 0x00020000
+
+#define ACPI_BTYPE_COMPUTE_DATA (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER)
+
+#define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE)
+#define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE)
+#define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR)
+#define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */
+#define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF
+
+
/*****************************************************************************
*
* Event typedefs and structs
@@ -424,7 +490,7 @@ typedef struct acpi_gpe_event_info
union acpi_gpe_dispatch_info Dispatch; /* Either Method or Handler */
struct acpi_gpe_register_info *RegisterInfo; /* Backpointer to register info */
UINT8 Flags; /* Misc info about this GPE */
- UINT8 RegisterBit; /* This GPE bit within the register */
+ UINT8 GpeNumber; /* This GPE */
} ACPI_GPE_EVENT_INFO;
@@ -479,25 +545,25 @@ typedef struct acpi_gpe_walk_info
typedef ACPI_STATUS (*ACPI_GPE_CALLBACK) (
- ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
- ACPI_GPE_BLOCK_INFO *GpeBlock);
+ ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
+ ACPI_GPE_BLOCK_INFO *GpeBlock);
/* Information about each particular fixed event */
typedef struct acpi_fixed_event_handler
{
- ACPI_EVENT_HANDLER Handler; /* Address of handler. */
- void *Context; /* Context to be passed to handler */
+ ACPI_EVENT_HANDLER Handler; /* Address of handler. */
+ void *Context; /* Context to be passed to handler */
} ACPI_FIXED_EVENT_HANDLER;
typedef struct acpi_fixed_event_info
{
- UINT8 StatusRegisterId;
- UINT8 EnableRegisterId;
- UINT16 StatusBitMask;
- UINT16 EnableBitMask;
+ UINT8 StatusRegisterId;
+ UINT8 EnableRegisterId;
+ UINT16 StatusBitMask;
+ UINT16 EnableBitMask;
} ACPI_FIXED_EVENT_INFO;
@@ -505,9 +571,9 @@ typedef struct acpi_fixed_event_info
typedef struct acpi_field_info
{
- UINT8 SkipField;
- UINT8 FieldFlag;
- UINT32 PkgLength;
+ UINT8 SkipField;
+ UINT8 FieldFlag;
+ UINT32 PkgLength;
} ACPI_FIELD_INFO;
@@ -525,13 +591,14 @@ typedef struct acpi_field_info
#define ACPI_CONTROL_PREDICATE_TRUE 0xC4
-#define ACPI_STATE_COMMON /* Two 32-bit fields and a pointer */\
- UINT8 DataType; /* To differentiate various internal objs */\
- UINT8 Flags; \
- UINT16 Value; \
- UINT16 State; \
- UINT16 Reserved; \
- void *Next; \
+#define ACPI_STATE_COMMON \
+ void *Next; \
+ UINT8 DescriptorType; /* To differentiate various internal objs */\
+ UINT8 Flags; \
+ UINT16 Value; \
+ UINT16 State;
+
+ /* There are 2 bytes available here until the next natural alignment boundary */
typedef struct acpi_common_state
{
@@ -545,7 +612,7 @@ typedef struct acpi_common_state
typedef struct acpi_update_state
{
ACPI_STATE_COMMON
- union acpi_operand_object *Object;
+ union acpi_operand_object *Object;
} ACPI_UPDATE_STATE;
@@ -556,12 +623,12 @@ typedef struct acpi_update_state
typedef struct acpi_pkg_state
{
ACPI_STATE_COMMON
- union acpi_operand_object *SourceObject;
- union acpi_operand_object *DestObject;
- struct acpi_walk_state *WalkState;
- void *ThisTargetObj;
- UINT32 NumPackages;
- UINT16 Index;
+ UINT16 Index;
+ union acpi_operand_object *SourceObject;
+ union acpi_operand_object *DestObject;
+ struct acpi_walk_state *WalkState;
+ void *ThisTargetObj;
+ UINT32 NumPackages;
} ACPI_PKG_STATE;
@@ -573,10 +640,10 @@ typedef struct acpi_pkg_state
typedef struct acpi_control_state
{
ACPI_STATE_COMMON
- union acpi_parse_object *PredicateOp;
- UINT8 *AmlPredicateStart; /* Start of if/while predicate */
- UINT8 *PackageEnd; /* End of if/while block */
- UINT16 Opcode;
+ UINT16 Opcode;
+ union acpi_parse_object *PredicateOp;
+ UINT8 *AmlPredicateStart; /* Start of if/while predicate */
+ UINT8 *PackageEnd; /* End of if/while block */
} ACPI_CONTROL_STATE;
@@ -587,7 +654,7 @@ typedef struct acpi_control_state
typedef struct acpi_scope_state
{
ACPI_STATE_COMMON
- ACPI_NAMESPACE_NODE *Node;
+ ACPI_NAMESPACE_NODE *Node;
} ACPI_SCOPE_STATE;
@@ -595,11 +662,11 @@ typedef struct acpi_scope_state
typedef struct acpi_pscope_state
{
ACPI_STATE_COMMON
- union acpi_parse_object *Op; /* Current op being parsed */
- UINT8 *ArgEnd; /* Current argument end */
- UINT8 *PkgEnd; /* Current package end */
- UINT32 ArgList; /* Next argument to parse */
- UINT32 ArgCount; /* Number of fixed arguments */
+ UINT32 ArgCount; /* Number of fixed arguments */
+ union acpi_parse_object *Op; /* Current op being parsed */
+ UINT8 *ArgEnd; /* Current argument end */
+ UINT8 *PkgEnd; /* Current package end */
+ UINT32 ArgList; /* Next argument to parse */
} ACPI_PSCOPE_STATE;
@@ -611,10 +678,10 @@ typedef struct acpi_pscope_state
typedef struct acpi_thread_state
{
ACPI_STATE_COMMON
- struct acpi_walk_state *WalkStateList; /* Head of list of WalkStates for this thread */
- union acpi_operand_object *AcquiredMutexList; /* List of all currently acquired mutexes */
- UINT32 ThreadId; /* Running thread ID */
- UINT8 CurrentSyncLevel; /* Mutex Sync (nested acquire) level */
+ UINT8 CurrentSyncLevel; /* Mutex Sync (nested acquire) level */
+ struct acpi_walk_state *WalkStateList; /* Head of list of WalkStates for this thread */
+ union acpi_operand_object *AcquiredMutexList; /* List of all currently acquired mutexes */
+ ACPI_THREAD_ID ThreadId; /* Running thread ID */
} ACPI_THREAD_STATE;
@@ -626,21 +693,19 @@ typedef struct acpi_thread_state
typedef struct acpi_result_values
{
ACPI_STATE_COMMON
- union acpi_operand_object *ObjDesc [ACPI_OBJ_NUM_OPERANDS];
- UINT8 NumResults;
- UINT8 LastInsert;
+ union acpi_operand_object *ObjDesc [ACPI_RESULTS_FRAME_OBJ_NUM];
} ACPI_RESULT_VALUES;
typedef
ACPI_STATUS (*ACPI_PARSE_DOWNWARDS) (
- struct acpi_walk_state *WalkState,
- union acpi_parse_object **OutOp);
+ struct acpi_walk_state *WalkState,
+ union acpi_parse_object **OutOp);
typedef
ACPI_STATUS (*ACPI_PARSE_UPWARDS) (
- struct acpi_walk_state *WalkState);
+ struct acpi_walk_state *WalkState);
/*
@@ -650,8 +715,8 @@ ACPI_STATUS (*ACPI_PARSE_UPWARDS) (
typedef struct acpi_notify_info
{
ACPI_STATE_COMMON
- ACPI_NAMESPACE_NODE *Node;
- union acpi_operand_object *HandlerObj;
+ ACPI_NAMESPACE_NODE *Node;
+ union acpi_operand_object *HandlerObj;
} ACPI_NOTIFY_INFO;
@@ -660,15 +725,15 @@ typedef struct acpi_notify_info
typedef union acpi_generic_state
{
- ACPI_COMMON_STATE Common;
- ACPI_CONTROL_STATE Control;
- ACPI_UPDATE_STATE Update;
- ACPI_SCOPE_STATE Scope;
- ACPI_PSCOPE_STATE ParseScope;
- ACPI_PKG_STATE Pkg;
- ACPI_THREAD_STATE Thread;
- ACPI_RESULT_VALUES Results;
- ACPI_NOTIFY_INFO Notify;
+ ACPI_COMMON_STATE Common;
+ ACPI_CONTROL_STATE Control;
+ ACPI_UPDATE_STATE Update;
+ ACPI_SCOPE_STATE Scope;
+ ACPI_PSCOPE_STATE ParseScope;
+ ACPI_PKG_STATE Pkg;
+ ACPI_THREAD_STATE Thread;
+ ACPI_RESULT_VALUES Results;
+ ACPI_NOTIFY_INFO Notify;
} ACPI_GENERIC_STATE;
@@ -681,7 +746,7 @@ typedef union acpi_generic_state
typedef
ACPI_STATUS (*ACPI_EXECUTE_OP) (
- struct acpi_walk_state *WalkState);
+ struct acpi_walk_state *WalkState);
/*****************************************************************************
@@ -696,54 +761,57 @@ ACPI_STATUS (*ACPI_EXECUTE_OP) (
typedef struct acpi_opcode_info
{
#if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT)
- char *Name; /* Opcode name (disassembler/debug only) */
+ char *Name; /* Opcode name (disassembler/debug only) */
#endif
- UINT32 ParseArgs; /* Grammar/Parse time arguments */
- UINT32 RuntimeArgs; /* Interpret time arguments */
- UINT32 Flags; /* Misc flags */
- UINT8 ObjectType; /* Corresponding internal object type */
- UINT8 Class; /* Opcode class */
- UINT8 Type; /* Opcode type */
+ UINT32 ParseArgs; /* Grammar/Parse time arguments */
+ UINT32 RuntimeArgs; /* Interpret time arguments */
+ UINT16 Flags; /* Misc flags */
+ UINT8 ObjectType; /* Corresponding internal object type */
+ UINT8 Class; /* Opcode class */
+ UINT8 Type; /* Opcode type */
} ACPI_OPCODE_INFO;
typedef union acpi_parse_value
{
- ACPI_INTEGER Integer; /* Integer constant (Up to 64 bits) */
- UINT64_STRUCT Integer64; /* Structure overlay for 2 32-bit Dwords */
- UINT32 Size; /* bytelist or field size */
- char *String; /* NULL terminated string */
- UINT8 *Buffer; /* buffer or string */
- char *Name; /* NULL terminated string */
- union acpi_parse_object *Arg; /* arguments and contained ops */
+ ACPI_INTEGER Integer; /* Integer constant (Up to 64 bits) */
+ UINT64_STRUCT Integer64; /* Structure overlay for 2 32-bit Dwords */
+ UINT32 Size; /* bytelist or field size */
+ char *String; /* NULL terminated string */
+ UINT8 *Buffer; /* buffer or string */
+ char *Name; /* NULL terminated string */
+ union acpi_parse_object *Arg; /* arguments and contained ops */
} ACPI_PARSE_VALUE;
#define ACPI_PARSE_COMMON \
- UINT8 DataType; /* To differentiate various internal objs */\
- UINT8 Flags; /* Type of Op */\
- UINT16 AmlOpcode; /* AML opcode */\
- UINT32 AmlOffset; /* Offset of declaration in AML */\
- union acpi_parse_object *Parent; /* Parent op */\
- union acpi_parse_object *Next; /* Next op */\
+ union acpi_parse_object *Parent; /* Parent op */\
+ UINT8 DescriptorType; /* To differentiate various internal objs */\
+ UINT8 Flags; /* Type of Op */\
+ UINT16 AmlOpcode; /* AML opcode */\
+ UINT32 AmlOffset; /* Offset of declaration in AML */\
+ union acpi_parse_object *Next; /* Next op */\
+ ACPI_NAMESPACE_NODE *Node; /* For use by interpreter */\
+ ACPI_PARSE_VALUE Value; /* Value or args associated with the opcode */\
+ UINT8 ArgListLength; /* Number of elements in the arg list */\
ACPI_DISASM_ONLY_MEMBERS (\
- UINT8 DisasmFlags; /* Used during AML disassembly */\
- UINT8 DisasmOpcode; /* Subtype used for disassembly */\
- char AmlOpName[16]) /* Op name (debug only) */\
- /* NON-DEBUG members below: */\
- ACPI_NAMESPACE_NODE *Node; /* For use by interpreter */\
- ACPI_PARSE_VALUE Value; /* Value or args associated with the opcode */\
+ UINT8 DisasmFlags; /* Used during AML disassembly */\
+ UINT8 DisasmOpcode; /* Subtype used for disassembly */\
+ char AmlOpName[16]) /* Op name (debug only) */
-#define ACPI_DASM_BUFFER 0x00
-#define ACPI_DASM_RESOURCE 0x01
-#define ACPI_DASM_STRING 0x02
-#define ACPI_DASM_UNICODE 0x03
-#define ACPI_DASM_EISAID 0x04
-#define ACPI_DASM_MATCHOP 0x05
+#define ACPI_DASM_BUFFER 0x00
+#define ACPI_DASM_RESOURCE 0x01
+#define ACPI_DASM_STRING 0x02
+#define ACPI_DASM_UNICODE 0x03
+#define ACPI_DASM_EISAID 0x04
+#define ACPI_DASM_MATCHOP 0x05
+#define ACPI_DASM_LNOT_PREFIX 0x06
+#define ACPI_DASM_LNOT_SUFFIX 0x07
+#define ACPI_DASM_IGNORE 0x08
/*
- * generic operation (for example: If, While, Store)
+ * Generic operation (for example: If, While, Store)
*/
typedef struct acpi_parse_obj_common
{
@@ -758,51 +826,53 @@ typedef struct acpi_parse_obj_common
typedef struct acpi_parse_obj_named
{
ACPI_PARSE_COMMON
- UINT8 *Path;
- UINT8 *Data; /* AML body or bytelist data */
- UINT32 Length; /* AML length */
- UINT32 Name; /* 4-byte name or zero if no name */
+ UINT8 *Path;
+ UINT8 *Data; /* AML body or bytelist data */
+ UINT32 Length; /* AML length */
+ UINT32 Name; /* 4-byte name or zero if no name */
} ACPI_PARSE_OBJ_NAMED;
-/* The parse node is the fundamental element of the parse tree */
+/* This version is used by the iASL compiler only */
+
+#define ACPI_MAX_PARSEOP_NAME 20
typedef struct acpi_parse_obj_asl
{
ACPI_PARSE_COMMON
- union acpi_parse_object *Child;
- union acpi_parse_object *ParentMethod;
- char *Filename;
- char *ExternalName;
- char *Namepath;
- char NameSeg[4];
- UINT32 ExtraValue;
- UINT32 Column;
- UINT32 LineNumber;
- UINT32 LogicalLineNumber;
- UINT32 LogicalByteOffset;
- UINT32 EndLine;
- UINT32 EndLogicalLine;
- UINT32 AcpiBtype;
- UINT32 AmlLength;
- UINT32 AmlSubtreeLength;
- UINT32 FinalAmlLength;
- UINT32 FinalAmlOffset;
- UINT32 CompileFlags;
- UINT16 ParseOpcode;
- UINT8 AmlOpcodeLength;
- UINT8 AmlPkgLenBytes;
- UINT8 Extra;
- char ParseOpName[12];
+ union acpi_parse_object *Child;
+ union acpi_parse_object *ParentMethod;
+ char *Filename;
+ char *ExternalName;
+ char *Namepath;
+ char NameSeg[4];
+ UINT32 ExtraValue;
+ UINT32 Column;
+ UINT32 LineNumber;
+ UINT32 LogicalLineNumber;
+ UINT32 LogicalByteOffset;
+ UINT32 EndLine;
+ UINT32 EndLogicalLine;
+ UINT32 AcpiBtype;
+ UINT32 AmlLength;
+ UINT32 AmlSubtreeLength;
+ UINT32 FinalAmlLength;
+ UINT32 FinalAmlOffset;
+ UINT32 CompileFlags;
+ UINT16 ParseOpcode;
+ UINT8 AmlOpcodeLength;
+ UINT8 AmlPkgLenBytes;
+ UINT8 Extra;
+ char ParseOpName[ACPI_MAX_PARSEOP_NAME];
} ACPI_PARSE_OBJ_ASL;
typedef union acpi_parse_object
{
- ACPI_PARSE_OBJ_COMMON Common;
- ACPI_PARSE_OBJ_NAMED Named;
- ACPI_PARSE_OBJ_ASL Asl;
+ ACPI_PARSE_OBJ_COMMON Common;
+ ACPI_PARSE_OBJ_NAMED Named;
+ ACPI_PARSE_OBJ_ASL Asl;
} ACPI_PARSE_OBJECT;
@@ -813,34 +883,36 @@ typedef union acpi_parse_object
*/
typedef struct acpi_parse_state
{
- UINT32 AmlSize;
- UINT8 *AmlStart; /* First AML byte */
- UINT8 *Aml; /* Next AML byte */
- UINT8 *AmlEnd; /* (last + 1) AML byte */
- UINT8 *PkgStart; /* Current package begin */
- UINT8 *PkgEnd; /* Current package end */
- union acpi_parse_object *StartOp; /* Root of parse tree */
- struct acpi_namespace_node *StartNode;
- union acpi_generic_state *Scope; /* Current scope */
- union acpi_parse_object *StartScope;
+ UINT8 *AmlStart; /* First AML byte */
+ UINT8 *Aml; /* Next AML byte */
+ UINT8 *AmlEnd; /* (last + 1) AML byte */
+ UINT8 *PkgStart; /* Current package begin */
+ UINT8 *PkgEnd; /* Current package end */
+ union acpi_parse_object *StartOp; /* Root of parse tree */
+ struct acpi_namespace_node *StartNode;
+ union acpi_generic_state *Scope; /* Current scope */
+ union acpi_parse_object *StartScope;
+ UINT32 AmlSize;
} ACPI_PARSE_STATE;
/* Parse object flags */
-#define ACPI_PARSEOP_GENERIC 0x01
-#define ACPI_PARSEOP_NAMED 0x02
-#define ACPI_PARSEOP_DEFERRED 0x04
-#define ACPI_PARSEOP_BYTELIST 0x08
-#define ACPI_PARSEOP_IN_CACHE 0x80
+#define ACPI_PARSEOP_GENERIC 0x01
+#define ACPI_PARSEOP_NAMED 0x02
+#define ACPI_PARSEOP_DEFERRED 0x04
+#define ACPI_PARSEOP_BYTELIST 0x08
+#define ACPI_PARSEOP_IN_STACK 0x10
+#define ACPI_PARSEOP_TARGET 0x20
+#define ACPI_PARSEOP_IN_CACHE 0x80
/* Parse object DisasmFlags */
-#define ACPI_PARSEOP_IGNORE 0x01
-#define ACPI_PARSEOP_PARAMLIST 0x02
-#define ACPI_PARSEOP_EMPTY_TERMLIST 0x04
-#define ACPI_PARSEOP_SPECIAL 0x10
+#define ACPI_PARSEOP_IGNORE 0x01
+#define ACPI_PARSEOP_PARAMLIST 0x02
+#define ACPI_PARSEOP_EMPTY_TERMLIST 0x04
+#define ACPI_PARSEOP_SPECIAL 0x10
/*****************************************************************************
@@ -849,19 +921,27 @@ typedef struct acpi_parse_state
*
****************************************************************************/
-#define PCI_ROOT_HID_STRING "PNP0A03"
-#define PCI_EXPRESS_ROOT_HID_STRING "PNP0A08"
+#define PCI_ROOT_HID_STRING "PNP0A03"
+#define PCI_EXPRESS_ROOT_HID_STRING "PNP0A08"
typedef struct acpi_bit_register_info
{
- UINT8 ParentRegister;
- UINT8 BitPosition;
- UINT16 AccessBitMask;
+ UINT8 ParentRegister;
+ UINT8 BitPosition;
+ UINT16 AccessBitMask;
} ACPI_BIT_REGISTER_INFO;
/*
+ * Some ACPI registers have bits that must be ignored -- meaning that they
+ * 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) */
+
+
+/*
* Register IDs
* These are the full ACPI registers
*/
@@ -887,13 +967,14 @@ typedef struct acpi_bit_register_info
#define ACPI_BITMASK_PCIEXP_WAKE_STATUS 0x4000 /* ACPI 3.0 */
#define ACPI_BITMASK_WAKE_STATUS 0x8000
-#define ACPI_BITMASK_ALL_FIXED_STATUS (ACPI_BITMASK_TIMER_STATUS | \
- ACPI_BITMASK_BUS_MASTER_STATUS | \
- ACPI_BITMASK_GLOBAL_LOCK_STATUS | \
- ACPI_BITMASK_POWER_BUTTON_STATUS | \
- ACPI_BITMASK_SLEEP_BUTTON_STATUS | \
- ACPI_BITMASK_RT_CLOCK_STATUS | \
- ACPI_BITMASK_WAKE_STATUS)
+#define ACPI_BITMASK_ALL_FIXED_STATUS (\
+ ACPI_BITMASK_TIMER_STATUS | \
+ ACPI_BITMASK_BUS_MASTER_STATUS | \
+ ACPI_BITMASK_GLOBAL_LOCK_STATUS | \
+ ACPI_BITMASK_POWER_BUTTON_STATUS | \
+ ACPI_BITMASK_SLEEP_BUTTON_STATUS | \
+ ACPI_BITMASK_RT_CLOCK_STATUS | \
+ ACPI_BITMASK_WAKE_STATUS)
#define ACPI_BITMASK_TIMER_ENABLE 0x0001
#define ACPI_BITMASK_GLOBAL_LOCK_ENABLE 0x0020
@@ -1001,7 +1082,7 @@ typedef struct acpi_bit_register_info
*
****************************************************************************/
-#define ACPI_ASCII_ZERO 0x30
+#define ACPI_ASCII_ZERO 0x30
/*****************************************************************************
@@ -1012,26 +1093,44 @@ typedef struct acpi_bit_register_info
typedef struct acpi_db_method_info
{
- ACPI_HANDLE ThreadGate;
- char *Name;
- char **Args;
- UINT32 Flags;
- UINT32 NumLoops;
- char Pathname[128];
+ ACPI_HANDLE MainThreadGate;
+ ACPI_HANDLE ThreadCompleteGate;
+ UINT32 *Threads;
+ UINT32 NumThreads;
+ UINT32 NumCreated;
+ UINT32 NumCompleted;
+
+ char *Name;
+ UINT32 Flags;
+ UINT32 NumLoops;
+ char Pathname[128];
+ char **Args;
+
+ /*
+ * Arguments to be passed to method for the command
+ * Threads -
+ * the Number of threads, ID of current thread and
+ * Index of current thread inside all them created.
+ */
+ char InitArgs;
+ char *Arguments[4];
+ char NumThreadsStr[11];
+ char IdOfThreadStr[11];
+ char IndexOfThreadStr[11];
} ACPI_DB_METHOD_INFO;
typedef struct acpi_integrity_info
{
- UINT32 Nodes;
- UINT32 Objects;
+ UINT32 Nodes;
+ UINT32 Objects;
} ACPI_INTEGRITY_INFO;
-#define ACPI_DB_REDIRECTABLE_OUTPUT 0x01
-#define ACPI_DB_CONSOLE_OUTPUT 0x02
-#define ACPI_DB_DUPLICATE_OUTPUT 0x03
+#define ACPI_DB_REDIRECTABLE_OUTPUT 0x01
+#define ACPI_DB_CONSOLE_OUTPUT 0x02
+#define ACPI_DB_DUPLICATE_OUTPUT 0x03
/*****************************************************************************
@@ -1042,18 +1141,18 @@ typedef struct acpi_integrity_info
/* Entry for a memory allocation (debug only) */
-#define ACPI_MEM_MALLOC 0
-#define ACPI_MEM_CALLOC 1
-#define ACPI_MAX_MODULE_NAME 16
+#define ACPI_MEM_MALLOC 0
+#define ACPI_MEM_CALLOC 1
+#define ACPI_MAX_MODULE_NAME 16
#define ACPI_COMMON_DEBUG_MEM_HEADER \
- struct acpi_debug_mem_block *Previous; \
- struct acpi_debug_mem_block *Next; \
- UINT32 Size; \
- UINT32 Component; \
- UINT32 Line; \
- char Module[ACPI_MAX_MODULE_NAME]; \
- UINT8 AllocType;
+ struct acpi_debug_mem_block *Previous; \
+ struct acpi_debug_mem_block *Next; \
+ UINT32 Size; \
+ UINT32 Component; \
+ UINT32 Line; \
+ char Module[ACPI_MAX_MODULE_NAME]; \
+ UINT8 AllocType;
typedef struct acpi_debug_mem_header
{
@@ -1064,7 +1163,7 @@ typedef struct acpi_debug_mem_header
typedef struct acpi_debug_mem_block
{
ACPI_COMMON_DEBUG_MEM_HEADER
- UINT64 UserSpace;
+ UINT64 UserSpace;
} ACPI_DEBUG_MEM_BLOCK;
@@ -1077,22 +1176,24 @@ typedef struct acpi_debug_mem_block
typedef struct acpi_memory_list
{
- char *ListName;
- void *ListHead;
- UINT16 ObjectSize;
- UINT16 MaxDepth;
- UINT16 CurrentDepth;
- UINT16 LinkOffset;
+ 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 CurrentTotalSize;
- UINT32 Requests;
- UINT32 Hits;
+ UINT32 TotalAllocated;
+ UINT32 TotalFreed;
+ UINT32 MaxOccupied;
+ UINT32 TotalSize;
+ UINT32 CurrentTotalSize;
+ UINT32 Requests;
+ UINT32 Hits;
#endif
} ACPI_MEMORY_LIST;
diff --git a/sys/contrib/dev/acpica/acmacros.h b/sys/contrib/dev/acpica/acmacros.h
index 039641c..6583ba6 100644
--- a/sys/contrib/dev/acpica/acmacros.h
+++ b/sys/contrib/dev/acpica/acmacros.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acmacros.h - C macros for the entire subsystem.
- * $Revision: 1.165 $
+ * $Revision: 1.195 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -129,46 +129,19 @@
#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 */
-#if ACPI_MACHINE_WIDTH == 16
+#define ACPI_ARRAY_LENGTH(x) (sizeof(x) / sizeof((x)[0]))
-/*
- * For 16-bit addresses, we have to assume that the upper 32 bits
- * are zero.
- */
-#define ACPI_LODWORD(l) ((UINT32)(l))
-#define ACPI_HIDWORD(l) ((UINT32)(0))
-
-#define ACPI_GET_ADDRESS(a) ((a).Lo)
-#define ACPI_STORE_ADDRESS(a,b) {(a).Hi=0;(a).Lo=(UINT32)(b);}
-#define ACPI_VALID_ADDRESS(a) ((a).Hi | (a).Lo)
-
-#else
-#ifdef ACPI_NO_INTEGER64_SUPPORT
-/*
- * ACPI_INTEGER is 32-bits, no 64-bit support on this platform
- */
-#define ACPI_LODWORD(l) ((UINT32)(l))
-#define ACPI_HIDWORD(l) ((UINT32)(0))
-
-#define ACPI_GET_ADDRESS(a) (a)
-#define ACPI_STORE_ADDRESS(a,b) ((a)=(b))
-#define ACPI_VALID_ADDRESS(a) (a)
-
-#else
/*
- * Full 64-bit address/integer on both 32-bit and 64-bit platforms
+ * 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))
-#define ACPI_GET_ADDRESS(a) (a)
-#define ACPI_STORE_ADDRESS(a,b) ((a)=(ACPI_PHYSICAL_ADDRESS)(b))
-#define ACPI_VALID_ADDRESS(a) (a)
-#endif
-#endif
/*
* printf() format helpers
@@ -179,33 +152,39 @@
#define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i),ACPI_LODWORD(i)
/*
- * Extract a byte of data using a pointer. Any more than a byte and we
- * get into potential aligment issues -- see the STORE macros below
+ * 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.
*/
-#define ACPI_GET8(addr) (*(UINT8*)(addr))
+#define ACPI_GET8(ptr) *ACPI_CAST_PTR (UINT8, ptr)
+#define ACPI_GET16(ptr) *ACPI_CAST_PTR (UINT16, ptr)
+#define ACPI_GET32(ptr) *ACPI_CAST_PTR (UINT32, ptr)
+#define ACPI_GET64(ptr) *ACPI_CAST_PTR (UINT64, ptr)
+#define ACPI_SET8(ptr) *ACPI_CAST_PTR (UINT8, ptr)
+#define ACPI_SET16(ptr) *ACPI_CAST_PTR (UINT16, ptr)
+#define ACPI_SET32(ptr) *ACPI_CAST_PTR (UINT32, ptr)
+#define ACPI_SET64(ptr) *ACPI_CAST_PTR (UINT64, ptr)
-/* Pointer arithmetic */
-
-#define ACPI_PTR_ADD(t,a,b) (t *) (void *)((char *)(a) + (ACPI_NATIVE_UINT)(b))
-#define ACPI_PTR_DIFF(a,b) (ACPI_NATIVE_UINT) ((char *)(a) - (char *)(b))
+/*
+ * 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_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 */
-#define ACPI_TO_POINTER(i) ACPI_PTR_ADD (void, (void *) NULL,(ACPI_NATIVE_UINT)i)
+#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_FADT_OFFSET(f) ACPI_OFFSET (FADT_DESCRIPTOR, f)
-
-#define ACPI_CAST_PTR(t, p) ((t *)(void *)(p))
-#define ACPI_CAST_INDIRECT_PTR(t, p) ((t **)(void *)(p))
-
-#if ACPI_MACHINE_WIDTH == 16
-#define ACPI_STORE_POINTER(d,s) ACPI_MOVE_32_TO_32(d,s)
-#define ACPI_PHYSADDR_TO_PTR(i) (void *)(i)
-#define ACPI_PTR_TO_PHYSADDR(i) (UINT32) (char *)(i)
-#else
#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
/*
@@ -281,28 +260,6 @@
/* The hardware supports unaligned transfers, just do the little-endian move */
-#if ACPI_MACHINE_WIDTH == 16
-
-/* No 64-bit integers */
-/* 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) ACPI_MOVE_16_TO_32(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_32(d,s) *(UINT32 *)(void *)(d) = *(UINT32 *)(void *)(s)
-#define ACPI_MOVE_32_TO_64(d,s) 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) ACPI_MOVE_32_TO_32(d,s)
-
-#else
/* 16-bit source, 16/32/64 destination */
#define ACPI_MOVE_16_TO_16(d,s) *(UINT16 *)(void *)(d) = *(UINT16 *)(void *)(s)
@@ -320,7 +277,6 @@
#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)
-#endif
#else
/*
@@ -365,10 +321,7 @@
/* Macros based on machine integer width */
-#if ACPI_MACHINE_WIDTH == 16
-#define ACPI_MOVE_SIZE_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s)
-
-#elif ACPI_MACHINE_WIDTH == 32
+#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
@@ -402,30 +355,40 @@
#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)
/*
* 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_UP(value,boundary) ((((ACPI_NATIVE_UINT)(value)) + (((ACPI_NATIVE_UINT) boundary)-1)) & (~(((ACPI_NATIVE_UINT) boundary)-1)))
+#define ACPI_ROUND_DOWN(value,boundary) (((ACPI_NATIVE_UINT)(value)) & \
+ (~(((ACPI_NATIVE_UINT) 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_DOWN_TO_32_BITS(a) ACPI_ROUND_DOWN(a,4)
-#define ACPI_ROUND_DOWN_TO_64_BITS(a) ACPI_ROUND_DOWN(a,8)
-#define ACPI_ROUND_DOWN_TO_NATIVE_WORD(a) ACPI_ROUND_DOWN(a,ALIGNED_ADDRESS_BOUNDARY)
+/* Note: sizeof(ACPI_NATIVE_UINT) evaluates to either 2, 4, or 8 */
-#define ACPI_ROUND_UP_TO_32BITS(a) ACPI_ROUND_UP(a,4)
-#define ACPI_ROUND_UP_TO_64BITS(a) ACPI_ROUND_UP(a,8)
-#define ACPI_ROUND_UP_TO_NATIVE_WORD(a) ACPI_ROUND_UP(a,ALIGNED_ADDRESS_BOUNDARY)
+#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_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_BITS_UP_TO_BYTES(a) ACPI_DIV_8((a) + 7)
-#define ACPI_ROUND_BITS_DOWN_TO_BYTES(a) ACPI_DIV_8((a))
+#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))
-#define ACPI_ROUND_UP_TO_1K(a) (((a) + 1023) >> 10)
+#define ACPI_ROUND_UP_TO_1K(a) (((a) + 1023) >> 10)
/* 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))
/*
* Bitmask creation
@@ -433,10 +396,10 @@
* MASK_BITS_ABOVE creates a mask starting AT the position and above
* MASK_BITS_BELOW creates a mask starting one bit BELOW the position
*/
-#define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_INTEGER_MAX) << ((UINT32) (position))))
-#define ACPI_MASK_BITS_BELOW(position) ((ACPI_INTEGER_MAX) << ((UINT32) (position)))
+#define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_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'))
+#define ACPI_IS_OCTAL_DIGIT(d) (((char)(d) >= '0') && ((char)(d) <= '7'))
/* Bitfields within ACPI registers */
@@ -444,6 +407,16 @@
#define ACPI_REGISTER_PREPARE_BITS(Val, Pos, Mask) ((Val << Pos) & Mask)
#define ACPI_REGISTER_INSERT_VALUE(Reg, Pos, Mask, Val) Reg = (Reg & (~(Mask))) | ACPI_REGISTER_PREPARE_BITS(Val, Pos, Mask)
+#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
@@ -451,8 +424,8 @@
*
* The "Descriptor" field is the first field in both structures.
*/
-#define ACPI_GET_DESCRIPTOR_TYPE(d) (((ACPI_DESCRIPTOR *)(void *)(d))->DescriptorId)
-#define ACPI_SET_DESCRIPTOR_TYPE(d,t) (((ACPI_DESCRIPTOR *)(void *)(d))->DescriptorId = t)
+#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 */
@@ -504,57 +477,51 @@
#define INCREMENT_ARG_LIST(List) (List >>= ((UINT32) ARG_TYPE_WIDTH))
+#if defined (ACPI_DEBUG_OUTPUT) || !defined (ACPI_NO_ERROR_MESSAGES)
/*
- * Reporting macros that are never compiled out
+ * 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_PARAM_LIST(pl) pl
+#define ACPI_MODULE_NAME(Name) static char ACPI_UNUSED_VAR *_AcpiModuleName = Name;
+#else
+#define ACPI_MODULE_NAME(Name)
+#endif
/*
- * Error reporting. These versions add callers module and line#.
- *
- * Since _AcpiModuleName gets compiled out when ACPI_DEBUG_OUTPUT
- * isn't defined, only use it in debug mode.
+ * Ascii error messages can be configured out
*/
-#ifdef ACPI_DEBUG_OUTPUT
-
-#define ACPI_REPORT_INFO(fp) {AcpiUtReportInfo(_AcpiModuleName,__LINE__,_COMPONENT); \
- AcpiOsPrintf ACPI_PARAM_LIST(fp);}
-#define ACPI_REPORT_ERROR(fp) {AcpiUtReportError(_AcpiModuleName,__LINE__,_COMPONENT); \
- AcpiOsPrintf ACPI_PARAM_LIST(fp);}
-#define ACPI_REPORT_WARNING(fp) {AcpiUtReportWarning(_AcpiModuleName,__LINE__,_COMPONENT); \
- AcpiOsPrintf ACPI_PARAM_LIST(fp);}
-#define ACPI_REPORT_NSERROR(s,e) AcpiNsReportError(_AcpiModuleName,__LINE__,_COMPONENT, s, e);
+#ifndef ACPI_NO_ERROR_MESSAGES
+#define AE_INFO _AcpiModuleName, __LINE__
-#define ACPI_REPORT_METHOD_ERROR(s,n,p,e) AcpiNsReportMethodError(_AcpiModuleName,__LINE__,_COMPONENT, s, n, p, e);
+/*
+ * 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);
#else
-#define ACPI_REPORT_INFO(fp) {AcpiUtReportInfo("ACPI",__LINE__,_COMPONENT); \
- AcpiOsPrintf ACPI_PARAM_LIST(fp);}
-#define ACPI_REPORT_ERROR(fp) {AcpiUtReportError("ACPI",__LINE__,_COMPONENT); \
- AcpiOsPrintf ACPI_PARAM_LIST(fp);}
-#define ACPI_REPORT_WARNING(fp) {AcpiUtReportWarning("ACPI",__LINE__,_COMPONENT); \
- AcpiOsPrintf ACPI_PARAM_LIST(fp);}
-#define ACPI_REPORT_NSERROR(s,e) AcpiNsReportError("ACPI",__LINE__,_COMPONENT, s, e);
-
-#define ACPI_REPORT_METHOD_ERROR(s,n,p,e) AcpiNsReportMethodError("ACPI",__LINE__,_COMPONENT, s, n, p, e);
+/* 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
-/* Error reporting. These versions pass thru the module and line# */
-
-#define _ACPI_REPORT_INFO(a,b,c,fp) {AcpiUtReportInfo(a,b,c); \
- AcpiOsPrintf ACPI_PARAM_LIST(fp);}
-#define _ACPI_REPORT_ERROR(a,b,c,fp) {AcpiUtReportError(a,b,c); \
- AcpiOsPrintf ACPI_PARAM_LIST(fp);}
-#define _ACPI_REPORT_WARNING(a,b,c,fp) {AcpiUtReportWarning(a,b,c); \
- AcpiOsPrintf ACPI_PARAM_LIST(fp);}
-
/*
* Debug macros that are conditionally compiled
*/
#ifdef ACPI_DEBUG_OUTPUT
-#define ACPI_MODULE_NAME(Name) static char ACPI_UNUSED_VAR *_AcpiModuleName = Name;
/*
* Common parameters used for debug output functions:
@@ -581,7 +548,7 @@
* 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;
+#define ACPI_FUNCTION_NAME(Name) const char *_AcpiFunctionName = #Name;
#else
/* Compiler supports __FUNCTION__ (or equivalent) -- Ignore this macro */
@@ -687,19 +654,6 @@
#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)
-#define ACPI_BREAK_MSG(a) AcpiOsSignal (ACPI_SIGNAL_BREAKPOINT,(a))
-
-
-/*
- * Generate INT3 on ACPI_ERROR (Debug only!)
- */
-#define ACPI_ERROR_BREAK
-#ifdef ACPI_ERROR_BREAK
-#define ACPI_BREAK_ON_ERROR(lvl) if ((lvl)&ACPI_ERROR) \
- AcpiOsSignal(ACPI_SIGNAL_BREAKPOINT,"Fatal error encountered\n")
-#else
-#define ACPI_BREAK_ON_ERROR(lvl)
-#endif
/*
* Master debug print macros
@@ -707,8 +661,8 @@
* 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(pl) AcpiUtDebugPrint ACPI_PARAM_LIST(pl)
-#define ACPI_DEBUG_PRINT_RAW(pl) AcpiUtDebugPrintRaw ACPI_PARAM_LIST(pl)
+#define ACPI_DEBUG_PRINT(plist) AcpiUtDebugPrint plist
+#define ACPI_DEBUG_PRINT_RAW(plist) AcpiUtDebugPrintRaw plist
#else
@@ -716,9 +670,6 @@
* This is the non-debug case -- make everything go away,
* leaving no executable debug code!
*/
-#define ACPI_MODULE_NAME(Name)
-#define _AcpiModuleName ""
-
#define ACPI_DEBUG_EXEC(a)
#define ACPI_NORMAL_EXEC(a) a;
@@ -742,7 +693,6 @@
#define ACPI_DUMP_BUFFER(a,b)
#define ACPI_DEBUG_PRINT(pl)
#define ACPI_DEBUG_PRINT_RAW(pl)
-#define ACPI_BREAK_MSG(a)
#define return_VOID return
#define return_ACPI_STATUS(s) return(s)
@@ -765,17 +715,6 @@
#endif
-/*
- * For 16-bit code, we want to shrink some things even though
- * we are using ACPI_DEBUG_OUTPUT to get the debug output
- */
-#if ACPI_MACHINE_WIDTH == 16
-#undef ACPI_DEBUG_ONLY_MEMBERS
-#undef _VERBOSE_STRUCTURES
-#define ACPI_DEBUG_ONLY_MEMBERS(a)
-#endif
-
-
#ifdef ACPI_DEBUG_OUTPUT
/*
* 1) Set name to blanks
@@ -796,19 +735,19 @@
/* Memory allocation */
-#define ACPI_MEM_ALLOCATE(a) AcpiUtAllocate((ACPI_SIZE)(a),_COMPONENT,_AcpiModuleName,__LINE__)
-#define ACPI_MEM_CALLOCATE(a) AcpiUtCallocate((ACPI_SIZE)(a), _COMPONENT,_AcpiModuleName,__LINE__)
-#define ACPI_MEM_FREE(a) AcpiOsFree(a)
+#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_FREE(a) AcpiOsFree(a)
#define ACPI_MEM_TRACKING(a)
#else
/* Memory allocation */
-#define ACPI_MEM_ALLOCATE(a) AcpiUtAllocateAndTrack((ACPI_SIZE)(a),_COMPONENT,_AcpiModuleName,__LINE__)
-#define ACPI_MEM_CALLOCATE(a) AcpiUtCallocateAndTrack((ACPI_SIZE)(a), _COMPONENT,_AcpiModuleName,__LINE__)
-#define ACPI_MEM_FREE(a) AcpiUtFreeAndTrack(a,_COMPONENT,_AcpiModuleName,__LINE__)
-#define ACPI_MEM_TRACKING(a) a
+#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_MEM_TRACKING(a) a
#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
diff --git a/sys/contrib/dev/acpica/acnames.h b/sys/contrib/dev/acpica/acnames.h
index 243cc34..344a7cb 100644
--- a/sys/contrib/dev/acpica/acnames.h
+++ b/sys/contrib/dev/acpica/acnames.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acnames.h - Global names and strings
- * $Revision: 1.5 $
+ * $Revision: 1.7 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
diff --git a/sys/contrib/dev/acpica/acnamesp.h b/sys/contrib/dev/acpica/acnamesp.h
index abf3e12..8d07fb3 100644
--- a/sys/contrib/dev/acpica/acnamesp.h
+++ b/sys/contrib/dev/acpica/acnamesp.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acnamesp.h - Namespace subcomponent prototypes and defines
- * $Revision: 1.142 $
+ * $Revision: 1.152 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -137,9 +137,15 @@
#define ACPI_NS_DONT_OPEN_SCOPE 0x02
#define ACPI_NS_NO_PEER_SEARCH 0x04
#define ACPI_NS_ERROR_IF_FOUND 0x08
+#define ACPI_NS_PREFIX_IS_SCOPE 0x10
+#define ACPI_NS_EXTERNAL 0x20
+#define ACPI_NS_TEMPORARY 0x40
-#define ACPI_NS_WALK_UNLOCK TRUE
-#define ACPI_NS_WALK_NO_UNLOCK FALSE
+/* Flags for AcpiNsWalkNamespace */
+
+#define ACPI_NS_WALK_NO_UNLOCK 0
+#define ACPI_NS_WALK_UNLOCK 0x01
+#define ACPI_NS_WALK_TEMP_NODES 0x02
/*
@@ -163,7 +169,7 @@ AcpiNsLoadNamespace (
ACPI_STATUS
AcpiNsLoadTable (
- ACPI_TABLE_DESC *TableDesc,
+ ACPI_NATIVE_UINT TableIndex,
ACPI_NAMESPACE_NODE *Node);
@@ -175,7 +181,7 @@ AcpiNsWalkNamespace (
ACPI_OBJECT_TYPE Type,
ACPI_HANDLE StartObject,
UINT32 MaxDepth,
- BOOLEAN UnlockBeforeCallback,
+ UINT32 Flags,
ACPI_WALK_CALLBACK UserFunction,
void *Context,
void **ReturnValue);
@@ -192,13 +198,13 @@ AcpiNsGetNextNode (
*/
ACPI_STATUS
AcpiNsParseTable (
- ACPI_TABLE_DESC *TableDesc,
- ACPI_NAMESPACE_NODE *Scope);
+ ACPI_NATIVE_UINT TableIndex,
+ ACPI_NAMESPACE_NODE *StartNode);
ACPI_STATUS
AcpiNsOneCompleteParse (
- UINT8 PassNumber,
- ACPI_TABLE_DESC *TableDesc);
+ ACPI_NATIVE_UINT PassNumber,
+ ACPI_NATIVE_UINT TableIndex);
/*
@@ -297,18 +303,8 @@ AcpiNsDumpObjects (
* nseval - Namespace evaluation functions
*/
ACPI_STATUS
-AcpiNsEvaluateByHandle (
- ACPI_PARAMETER_INFO *Info);
-
-ACPI_STATUS
-AcpiNsEvaluateByName (
- char *Pathname,
- ACPI_PARAMETER_INFO *Info);
-
-ACPI_STATUS
-AcpiNsEvaluateRelative (
- char *Pathname,
- ACPI_PARAMETER_INFO *Info);
+AcpiNsEvaluate (
+ ACPI_EVALUATE_INFO *Info);
/*
@@ -318,6 +314,12 @@ UINT32
AcpiNsOpensScope (
ACPI_OBJECT_TYPE Type);
+void
+AcpiNsBuildExternalPath (
+ ACPI_NAMESPACE_NODE *Node,
+ ACPI_SIZE Size,
+ char *NameBuffer);
+
char *
AcpiNsGetExternalPathname (
ACPI_NAMESPACE_NODE *Node);
@@ -337,9 +339,9 @@ AcpiNsPatternMatch (
char *SearchFor);
ACPI_STATUS
-AcpiNsGetNodeByPath (
+AcpiNsGetNode (
+ ACPI_NAMESPACE_NODE *PrefixNode,
char *ExternalPathname,
- ACPI_NAMESPACE_NODE *InPrefixNode,
UINT32 Flags,
ACPI_NAMESPACE_NODE **OutNode);
@@ -397,7 +399,7 @@ AcpiNsSearchAndEnter (
ACPI_NAMESPACE_NODE **RetNode);
ACPI_STATUS
-AcpiNsSearchNode (
+AcpiNsSearchOneScope (
UINT32 EntryName,
ACPI_NAMESPACE_NODE *Node,
ACPI_OBJECT_TYPE Type,
@@ -430,7 +432,6 @@ void
AcpiNsReportError (
char *ModuleName,
UINT32 LineNumber,
- UINT32 ComponentId,
char *InternalName,
ACPI_STATUS LookupStatus);
@@ -438,7 +439,6 @@ void
AcpiNsReportMethodError (
char *ModuleName,
UINT32 LineNumber,
- UINT32 ComponentId,
char *Message,
ACPI_NAMESPACE_NODE *Node,
char *Path,
diff --git a/sys/contrib/dev/acpica/acobject.h b/sys/contrib/dev/acpica/acobject.h
index b56d4c1..a9d27eb 100644
--- a/sys/contrib/dev/acpica/acobject.h
+++ b/sys/contrib/dev/acpica/acobject.h
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Name: acobject.h - Definition of ACPI_OPERAND_OBJECT (Internal object only)
- * $Revision: 1.130 $
+ * $Revision: 1.143 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -118,13 +118,23 @@
#ifndef _ACOBJECT_H
#define _ACOBJECT_H
+/* acpisrc:StructDefs -- for acpisrc conversion */
+
/*
- * The ACPI_OPERAND_OBJECT is used to pass AML operands from the dispatcher
+ * The ACPI_OPERAND_OBJECT is used to pass AML operands from the dispatcher
* to the interpreter, and to keep track of the various handlers such as
- * address space handlers and notify handlers. The object is a constant
+ * address space handlers and notify handlers. The object is a constant
* size in order to allow it to be cached and reused.
+ *
+ * Note: The object is optimized to be aligned and will not work if it is
+ * byte-packed.
*/
+#if ACPI_MACHINE_WIDTH == 64
+#pragma pack(8)
+#else
+#pragma pack(4)
+#endif
/*******************************************************************************
*
@@ -135,17 +145,25 @@
/*
* Common area for all objects.
*
- * DataType is used to differentiate between internal descriptors, and MUST
- * be the first byte in this structure.
+ * DescriptorType is used to differentiate between internal descriptors, and
+ * must be in the same place across all descriptors
+ *
+ * Note: The DescriptorType and Type fields must appear in the identical
+ * position in both the ACPI_NAMESPACE_NODE and ACPI_OPERAND_OBJECT
+ * structures.
*/
-#define ACPI_OBJECT_COMMON_HEADER /* SIZE/ALIGNMENT: 32 bits, one ptr plus trailing 8-bit flag */\
- UINT8 Descriptor; /* To differentiate various internal objs */\
+#define ACPI_OBJECT_COMMON_HEADER \
+ union acpi_operand_object *NextObject; /* Objects linked to parent NS node */\
+ UINT8 DescriptorType; /* To differentiate various internal objs */\
UINT8 Type; /* ACPI_OBJECT_TYPE */\
UINT16 ReferenceCount; /* For object deletion management */\
- union acpi_operand_object *NextObject; /* Objects linked to parent NS node */\
- UINT8 Flags; \
+ UINT8 Flags;
+ /*
+ * Note: There are 3 bytes available here before the
+ * next natural alignment boundary (for both 32/64 cases)
+ */
-/* Values for flag byte above */
+/* Values for Flag byte above */
#define AOPOBJ_AML_CONSTANT 0x01
#define AOPOBJ_STATIC_POINTER 0x02
@@ -153,39 +171,7 @@
#define AOPOBJ_OBJECT_INITIALIZED 0x08
#define AOPOBJ_SETUP_COMPLETE 0x10
#define AOPOBJ_SINGLE_DATUM 0x20
-
-
-/*
- * Common bitfield for the field objects
- * "Field Datum" -- a datum from the actual field object
- * "Buffer Datum" -- a datum from a user buffer, read from or to be written to the field
- */
-#define ACPI_COMMON_FIELD_INFO /* SIZE/ALIGNMENT: 24 bits + three 32-bit values */\
- UINT8 FieldFlags; /* Access, update, and lock bits */\
- UINT8 Attribute; /* From AccessAs keyword */\
- UINT8 AccessByteWidth; /* Read/Write size in bytes */\
- UINT32 BitLength; /* Length of field in bits */\
- UINT32 BaseByteOffset; /* Byte offset within containing object */\
- UINT8 StartFieldBitOffset;/* Bit offset within first field datum (0-63) */\
- UINT8 AccessBitWidth; /* Read/Write size in bits (8-64) */\
- UINT32 Value; /* Value to store into the Bank or Index register */\
- ACPI_NAMESPACE_NODE *Node; /* Link back to parent node */
-
-
-/*
- * Fields common to both Strings and Buffers
- */
-#define ACPI_COMMON_BUFFER_INFO \
- UINT32 Length;
-
-
-/*
- * Common fields for objects that support ASL notifications
- */
-#define ACPI_COMMON_NOTIFY_INFO \
- union acpi_operand_object *SystemNotify; /* Handler for system notifies */\
- union acpi_operand_object *DeviceNotify; /* Handler for driver notifies */\
- union acpi_operand_object *Handler; /* Handler for Address space */
+#define AOPOBJ_INVALID 0x40 /* Used if host OS won't allow an OpRegion address */
/******************************************************************************
@@ -204,6 +190,7 @@ typedef struct acpi_object_common
typedef struct acpi_object_integer
{
ACPI_OBJECT_COMMON_HEADER
+ UINT8 Fill[3]; /* Prevent warning on some compilers */
ACPI_INTEGER Value;
} ACPI_OBJECT_INTEGER;
@@ -211,13 +198,19 @@ typedef struct acpi_object_integer
/*
* Note: The String and Buffer object must be identical through the Pointer
- * element. There is code that depends on this.
+ * and length elements. There is code that depends on this.
+ *
+ * Fields common to both Strings and Buffers
*/
+#define ACPI_COMMON_BUFFER_INFO(_Type) \
+ _Type *Pointer; \
+ UINT32 Length;
+
+
typedef struct acpi_object_string /* Null terminated, ASCII characters only */
{
ACPI_OBJECT_COMMON_HEADER
- ACPI_COMMON_BUFFER_INFO
- char *Pointer; /* String in AML stream or allocated string */
+ ACPI_COMMON_BUFFER_INFO (char) /* String in AML stream or allocated string */
} ACPI_OBJECT_STRING;
@@ -225,11 +218,10 @@ typedef struct acpi_object_string /* Null terminated, ASCII characters only */
typedef struct acpi_object_buffer
{
ACPI_OBJECT_COMMON_HEADER
- ACPI_COMMON_BUFFER_INFO
- UINT8 *Pointer; /* Buffer in AML stream or allocated buffer */
- ACPI_NAMESPACE_NODE *Node; /* Link back to parent node */
- UINT8 *AmlStart;
+ ACPI_COMMON_BUFFER_INFO (UINT8) /* Buffer in AML stream or allocated buffer */
UINT32 AmlLength;
+ UINT8 *AmlStart;
+ ACPI_NAMESPACE_NODE *Node; /* Link back to parent node */
} ACPI_OBJECT_BUFFER;
@@ -237,12 +229,11 @@ typedef struct acpi_object_buffer
typedef struct acpi_object_package
{
ACPI_OBJECT_COMMON_HEADER
-
- UINT32 Count; /* # of elements in package */
- UINT32 AmlLength;
- UINT8 *AmlStart;
ACPI_NAMESPACE_NODE *Node; /* Link back to parent node */
union acpi_operand_object **Elements; /* Array of pointers to AcpiObjects */
+ UINT8 *AmlStart;
+ UINT32 AmlLength;
+ UINT32 Count; /* # of elements in package */
} ACPI_OBJECT_PACKAGE;
@@ -256,40 +247,19 @@ typedef struct acpi_object_package
typedef struct acpi_object_event
{
ACPI_OBJECT_COMMON_HEADER
- void *Semaphore;
+ ACPI_SEMAPHORE OsSemaphore; /* Actual OS synchronization object */
} ACPI_OBJECT_EVENT;
-#define ACPI_INFINITE_CONCURRENCY 0xFF
-
-typedef
-ACPI_STATUS (*ACPI_INTERNAL_METHOD) (
- struct acpi_walk_state *WalkState);
-
-typedef struct acpi_object_method
-{
- ACPI_OBJECT_COMMON_HEADER
- UINT8 MethodFlags;
- UINT8 ParamCount;
- UINT32 AmlLength;
- void *Semaphore;
- UINT8 *AmlStart;
- ACPI_INTERNAL_METHOD Implementation;
- UINT8 Concurrency;
- UINT8 ThreadCount;
- ACPI_OWNER_ID OwnerId;
-
-} ACPI_OBJECT_METHOD;
-
-
typedef struct acpi_object_mutex
{
ACPI_OBJECT_COMMON_HEADER
UINT8 SyncLevel; /* 0-15, specified in Mutex() call */
UINT16 AcquisitionDepth; /* Allow multiple Acquires, same thread */
+ ACPI_MUTEX OsMutex; /* Actual OS synchronization object */
+ ACPI_THREAD_ID ThreadId; /* Current owner of the mutex */
struct acpi_thread_state *OwnerThread; /* Current owner of the mutex */
- void *Semaphore; /* Actual OS synchronization object */
union acpi_operand_object *Prev; /* Link for list of acquired mutexes */
union acpi_operand_object *Next; /* Link for list of acquired mutexes */
ACPI_NAMESPACE_NODE *Node; /* Containing namespace node */
@@ -301,23 +271,47 @@ typedef struct acpi_object_mutex
typedef struct acpi_object_region
{
ACPI_OBJECT_COMMON_HEADER
-
UINT8 SpaceId;
- union acpi_operand_object *Handler; /* Handler for region access */
ACPI_NAMESPACE_NODE *Node; /* Containing namespace node */
+ union acpi_operand_object *Handler; /* Handler for region access */
union acpi_operand_object *Next;
- UINT32 Length;
ACPI_PHYSICAL_ADDRESS Address;
+ UINT32 Length;
} ACPI_OBJECT_REGION;
+typedef struct acpi_object_method
+{
+ ACPI_OBJECT_COMMON_HEADER
+ UINT8 MethodFlags;
+ UINT8 ParamCount;
+ UINT8 SyncLevel;
+ union acpi_operand_object *Mutex;
+ UINT8 *AmlStart;
+ ACPI_INTERNAL_METHOD Implementation;
+ UINT32 AmlLength;
+ UINT8 ThreadCount;
+ ACPI_OWNER_ID OwnerId;
+
+} ACPI_OBJECT_METHOD;
+
+
/******************************************************************************
*
* Objects that can be notified. All share a common NotifyInfo area.
*
*****************************************************************************/
+/*
+ * Common fields for objects that support ASL notifications
+ */
+#define ACPI_COMMON_NOTIFY_INFO \
+ union acpi_operand_object *SystemNotify; /* Handler for system notifies */\
+ union acpi_operand_object *DeviceNotify; /* Handler for driver notifies */\
+ union acpi_operand_object *Handler; /* Handler for Address space */
+
+
typedef struct acpi_object_notify_common /* COMMON NOTIFY for POWER, PROCESSOR, DEVICE, and THERMAL */
{
ACPI_OBJECT_COMMON_HEADER
@@ -348,9 +342,12 @@ typedef struct acpi_object_power_resource
typedef struct acpi_object_processor
{
ACPI_OBJECT_COMMON_HEADER
+
+ /* The next two fields take advantage of the 3-byte space before NOTIFY_INFO */
+
+ UINT8 ProcId;
+ UINT8 Length;
ACPI_COMMON_NOTIFY_INFO
- UINT32 ProcId;
- UINT32 Length;
ACPI_IO_ADDRESS Address;
} ACPI_OBJECT_PROCESSOR;
@@ -370,12 +367,29 @@ typedef struct acpi_object_thermal_zone
*
*****************************************************************************/
+/*
+ * Common bitfield for the field objects
+ * "Field Datum" -- a datum from the actual field object
+ * "Buffer Datum" -- a datum from a user buffer, read from or to be written to the field
+ */
+#define ACPI_COMMON_FIELD_INFO \
+ UINT8 FieldFlags; /* Access, update, and lock bits */\
+ UINT8 Attribute; /* From AccessAs keyword */\
+ UINT8 AccessByteWidth; /* Read/Write size in bytes */\
+ ACPI_NAMESPACE_NODE *Node; /* Link back to parent node */\
+ UINT32 BitLength; /* Length of field in bits */\
+ UINT32 BaseByteOffset; /* Byte offset within containing object */\
+ UINT32 Value; /* Value to store into the Bank or Index register */\
+ UINT8 StartFieldBitOffset;/* Bit offset within first field datum (0-63) */\
+ UINT8 AccessBitWidth; /* Read/Write size in bits (8-64) */
+
+
typedef struct acpi_object_field_common /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */
{
ACPI_OBJECT_COMMON_HEADER
ACPI_COMMON_FIELD_INFO
- union acpi_operand_object *RegionObj; /* Containing Operation Region object */
- /* (REGION/BANK fields only) */
+ union acpi_operand_object *RegionObj; /* Parent Operation Region object (REGION/BANK fields only) */
+
} ACPI_OBJECT_FIELD_COMMON;
@@ -440,16 +454,11 @@ typedef struct acpi_object_notify_handler
} ACPI_OBJECT_NOTIFY_HANDLER;
-/* Flags for address handler */
-
-#define ACPI_ADDR_HANDLER_DEFAULT_INSTALLED 0x1
-
-
typedef struct acpi_object_addr_handler
{
ACPI_OBJECT_COMMON_HEADER
UINT8 SpaceId;
- UINT16 Hflags;
+ UINT8 HandlerFlags;
ACPI_ADR_SPACE_HANDLER Handler;
ACPI_NAMESPACE_NODE *Node; /* Parent device */
void *Context;
@@ -459,6 +468,10 @@ typedef struct acpi_object_addr_handler
} ACPI_OBJECT_ADDR_HANDLER;
+/* Flags for address handler (HandlerFlags) */
+
+#define ACPI_ADDR_HANDLER_DEFAULT_INSTALLED 0x01
+
/******************************************************************************
*
@@ -475,10 +488,10 @@ typedef struct acpi_object_reference
ACPI_OBJECT_COMMON_HEADER
UINT8 TargetType; /* Used for IndexOp */
UINT16 Opcode;
- UINT32 Offset; /* Used for ArgOp, LocalOp, and IndexOp */
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 */
} ACPI_OBJECT_REFERENCE;
@@ -493,12 +506,10 @@ typedef struct acpi_object_reference
typedef struct acpi_object_extra
{
ACPI_OBJECT_COMMON_HEADER
- UINT8 ByteFill1;
- UINT16 WordFill1;
- UINT32 AmlLength;
- UINT8 *AmlStart;
ACPI_NAMESPACE_NODE *Method_REG; /* _REG method for this region (if any) */
void *RegionContext; /* Region-specific data */
+ UINT8 *AmlStart;
+ UINT32 AmlLength;
} ACPI_OBJECT_EXTRA;
@@ -532,31 +543,31 @@ typedef struct acpi_object_cache_list
typedef union acpi_operand_object
{
- ACPI_OBJECT_COMMON Common;
- ACPI_OBJECT_INTEGER Integer;
- ACPI_OBJECT_STRING String;
- ACPI_OBJECT_BUFFER Buffer;
- ACPI_OBJECT_PACKAGE Package;
- ACPI_OBJECT_EVENT Event;
- ACPI_OBJECT_METHOD Method;
- ACPI_OBJECT_MUTEX Mutex;
- ACPI_OBJECT_REGION Region;
- ACPI_OBJECT_NOTIFY_COMMON CommonNotify;
- ACPI_OBJECT_DEVICE Device;
- ACPI_OBJECT_POWER_RESOURCE PowerResource;
- ACPI_OBJECT_PROCESSOR Processor;
- ACPI_OBJECT_THERMAL_ZONE ThermalZone;
- ACPI_OBJECT_FIELD_COMMON CommonField;
- ACPI_OBJECT_REGION_FIELD Field;
- ACPI_OBJECT_BUFFER_FIELD BufferField;
- ACPI_OBJECT_BANK_FIELD BankField;
- ACPI_OBJECT_INDEX_FIELD IndexField;
- ACPI_OBJECT_NOTIFY_HANDLER Notify;
- ACPI_OBJECT_ADDR_HANDLER AddressSpace;
- ACPI_OBJECT_REFERENCE Reference;
- ACPI_OBJECT_EXTRA Extra;
- ACPI_OBJECT_DATA Data;
- ACPI_OBJECT_CACHE_LIST Cache;
+ ACPI_OBJECT_COMMON Common;
+ ACPI_OBJECT_INTEGER Integer;
+ ACPI_OBJECT_STRING String;
+ ACPI_OBJECT_BUFFER Buffer;
+ ACPI_OBJECT_PACKAGE Package;
+ ACPI_OBJECT_EVENT Event;
+ ACPI_OBJECT_METHOD Method;
+ ACPI_OBJECT_MUTEX Mutex;
+ ACPI_OBJECT_REGION Region;
+ ACPI_OBJECT_NOTIFY_COMMON CommonNotify;
+ ACPI_OBJECT_DEVICE Device;
+ ACPI_OBJECT_POWER_RESOURCE PowerResource;
+ ACPI_OBJECT_PROCESSOR Processor;
+ ACPI_OBJECT_THERMAL_ZONE ThermalZone;
+ ACPI_OBJECT_FIELD_COMMON CommonField;
+ ACPI_OBJECT_REGION_FIELD Field;
+ ACPI_OBJECT_BUFFER_FIELD BufferField;
+ ACPI_OBJECT_BANK_FIELD BankField;
+ ACPI_OBJECT_INDEX_FIELD IndexField;
+ ACPI_OBJECT_NOTIFY_HANDLER Notify;
+ ACPI_OBJECT_ADDR_HANDLER AddressSpace;
+ ACPI_OBJECT_REFERENCE Reference;
+ ACPI_OBJECT_EXTRA Extra;
+ ACPI_OBJECT_DATA Data;
+ ACPI_OBJECT_CACHE_LIST Cache;
} ACPI_OPERAND_OBJECT;
@@ -587,14 +598,22 @@ typedef union acpi_operand_object
#define ACPI_DESC_TYPE_MAX 0x0F
+typedef struct acpi_common_descriptor
+{
+ void *CommonPointer;
+ UINT8 DescriptorType; /* To differentiate various internal objs */
+
+} ACPI_COMMON_DESCRIPTOR;
+
typedef union acpi_descriptor
{
- UINT8 DescriptorId; /* To differentiate various internal objs */\
+ ACPI_COMMON_DESCRIPTOR Common;
ACPI_OPERAND_OBJECT Object;
ACPI_NAMESPACE_NODE Node;
ACPI_PARSE_OBJECT Op;
} ACPI_DESCRIPTOR;
+#pragma pack()
#endif /* _ACOBJECT_H */
diff --git a/sys/contrib/dev/acpica/acopcode.h b/sys/contrib/dev/acpica/acopcode.h
index f7c329b..557fa57 100644
--- a/sys/contrib/dev/acpica/acopcode.h
+++ b/sys/contrib/dev/acpica/acopcode.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acopcode.h - AML opcode information for the AML parser and interpreter
- * $Revision: 1.3 $
+ * $Revision: 1.7 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -168,7 +168,7 @@
#define ARGP_CONCAT_RES_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_COND_REF_OF_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SUPERNAME)
#define ARGP_CONTINUE_OP ARG_NONE
-#define ARGP_COPY_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SIMPLENAME)
+#define ARGP_COPY_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_SIMPLENAME)
#define ARGP_CREATE_BIT_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
#define ARGP_CREATE_BYTE_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
#define ARGP_CREATE_DWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
@@ -332,7 +332,7 @@
#define ARGI_LLESSEQUAL_OP ARGI_INVALID_OPCODE
#define ARGI_LNOT_OP ARGI_LIST1 (ARGI_INTEGER)
#define ARGI_LNOTEQUAL_OP ARGI_INVALID_OPCODE
-#define ARGI_LOAD_OP ARGI_LIST2 (ARGI_REGION_OR_FIELD,ARGI_TARGETREF)
+#define ARGI_LOAD_OP ARGI_LIST2 (ARGI_REGION_OR_BUFFER,ARGI_TARGETREF)
#define ARGI_LOAD_TABLE_OP ARGI_LIST6 (ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_ANYTYPE)
#define ARGI_LOCAL0 ARG_NONE
#define ARGI_LOCAL1 ARG_NONE
diff --git a/sys/contrib/dev/acpica/acoutput.h b/sys/contrib/dev/acpica/acoutput.h
index 8988f32..ebd58c3 100644
--- a/sys/contrib/dev/acpica/acoutput.h
+++ b/sys/contrib/dev/acpica/acoutput.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acoutput.h -- debug output
- * $Revision: 1.97 $
+ * $Revision: 1.101 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -213,13 +213,18 @@
/* Exception level -- used in the global "DebugLevel" */
-#define ACPI_DB_ERROR ACPI_DEBUG_LEVEL (ACPI_LV_ERROR)
-#define ACPI_DB_WARN ACPI_DEBUG_LEVEL (ACPI_LV_WARN)
#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" */
diff --git a/sys/contrib/dev/acpica/acparser.h b/sys/contrib/dev/acpica/acparser.h
index 05bc566..34b6bd1 100644
--- a/sys/contrib/dev/acpica/acparser.h
+++ b/sys/contrib/dev/acpica/acparser.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: acparser.h - AML Parser subcomponent prototypes and defines
- * $Revision: 1.77 $
+ * $Revision: 1.83 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -121,7 +121,7 @@
#define OP_HAS_RETURN_VALUE 1
-/* variable # arguments */
+/* Variable number of arguments. This field must be 32 bits */
#define ACPI_VAR_ARGS ACPI_UINT32_MAX
@@ -151,7 +151,7 @@
*/
ACPI_STATUS
AcpiPsExecuteMethod (
- ACPI_PARAMETER_INFO *Info);
+ ACPI_EVALUATE_INFO *Info);
/*
@@ -211,6 +211,10 @@ char *
AcpiPsGetOpcodeName (
UINT16 Opcode);
+UINT8
+AcpiPsGetArgumentCount (
+ UINT32 OpType);
+
/*
* psparse - top level parsing routines
diff --git a/sys/contrib/dev/acpica/acpi.h b/sys/contrib/dev/acpica/acpi.h
index 260d81c..b0f7848 100644
--- a/sys/contrib/dev/acpica/acpi.h
+++ b/sys/contrib/dev/acpica/acpi.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acpi.h - Master include file, Publics and external data.
- * $Revision: 1.59 $
+ * $Revision: 1.61 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
diff --git a/sys/contrib/dev/acpica/acpiosxf.h b/sys/contrib/dev/acpica/acpiosxf.h
index 7f219ef..69997d8 100644
--- a/sys/contrib/dev/acpica/acpiosxf.h
+++ b/sys/contrib/dev/acpica/acpiosxf.h
@@ -12,7 +12,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -125,12 +125,18 @@
#include <contrib/dev/acpica/actypes.h>
-/* Priorities for AcpiOsQueueForExecution */
+/* Types for AcpiOsExecute */
-#define OSD_PRIORITY_GPE 1
-#define OSD_PRIORITY_HIGH 2
-#define OSD_PRIORITY_MED 3
-#define OSD_PRIORITY_LO 4
+typedef enum
+{
+ OSL_GLOBAL_LOCK_HANDLER,
+ OSL_NOTIFY_HANDLER,
+ OSL_GPE_HANDLER,
+ OSL_DEBUGGER_THREAD,
+ OSL_EC_POLL_HANDLER,
+ OSL_EC_BURST_HANDLER
+
+} ACPI_EXECUTE_TYPE;
#define ACPI_NO_UNIT_LIMIT ((UINT32) -1)
#define ACPI_MUTEX_SEM 1
@@ -165,10 +171,9 @@ AcpiOsTerminate (
/*
* ACPI Table interfaces
*/
-ACPI_STATUS
+ACPI_PHYSICAL_ADDRESS
AcpiOsGetRootPointer (
- UINT32 Flags,
- ACPI_POINTER *Address);
+ void);
ACPI_STATUS
AcpiOsPredefinedOverride (
@@ -182,45 +187,77 @@ AcpiOsTableOverride (
/*
- * Synchronization primitives
+ * Spinlock primitives
+ */
+ACPI_STATUS
+AcpiOsCreateLock (
+ ACPI_SPINLOCK *OutHandle);
+
+void
+AcpiOsDeleteLock (
+ ACPI_SPINLOCK Handle);
+
+ACPI_CPU_FLAGS
+AcpiOsAcquireLock (
+ ACPI_SPINLOCK Handle);
+
+void
+AcpiOsReleaseLock (
+ ACPI_SPINLOCK Handle,
+ ACPI_CPU_FLAGS Flags);
+
+
+/*
+ * Semaphore primitives
*/
ACPI_STATUS
AcpiOsCreateSemaphore (
UINT32 MaxUnits,
UINT32 InitialUnits,
- ACPI_HANDLE *OutHandle);
+ ACPI_SEMAPHORE *OutHandle);
ACPI_STATUS
AcpiOsDeleteSemaphore (
- ACPI_HANDLE Handle);
+ ACPI_SEMAPHORE Handle);
ACPI_STATUS
AcpiOsWaitSemaphore (
- ACPI_HANDLE Handle,
+ ACPI_SEMAPHORE Handle,
UINT32 Units,
UINT16 Timeout);
ACPI_STATUS
AcpiOsSignalSemaphore (
- ACPI_HANDLE Handle,
+ ACPI_SEMAPHORE Handle,
UINT32 Units);
+
+/*
+ * Mutex primitives
+ */
ACPI_STATUS
-AcpiOsCreateLock (
- ACPI_HANDLE *OutHandle);
+AcpiOsCreateMutex (
+ ACPI_MUTEX *OutHandle);
void
-AcpiOsDeleteLock (
- ACPI_HANDLE Handle);
+AcpiOsDeleteMutex (
+ ACPI_MUTEX Handle);
-ACPI_NATIVE_UINT
-AcpiOsAcquireLock (
- ACPI_HANDLE Handle);
+ACPI_STATUS
+AcpiOsAcquireMutex (
+ ACPI_MUTEX Handle,
+ UINT16 Timeout);
void
-AcpiOsReleaseLock (
- ACPI_HANDLE Handle,
- ACPI_NATIVE_UINT Flags);
+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)
/*
@@ -234,11 +271,10 @@ void
AcpiOsFree (
void * Memory);
-ACPI_STATUS
+void *
AcpiOsMapMemory (
- ACPI_PHYSICAL_ADDRESS PhysicalAddress,
- ACPI_SIZE Size,
- void **LogicalAddress);
+ ACPI_PHYSICAL_ADDRESS Where,
+ ACPI_NATIVE_UINT Length);
void
AcpiOsUnmapMemory (
@@ -297,13 +333,13 @@ AcpiOsRemoveInterruptHandler (
/*
* Threads and Scheduling
*/
-UINT32
+ACPI_THREAD_ID
AcpiOsGetThreadId (
void);
ACPI_STATUS
-AcpiOsQueueForExecution (
- UINT32 Priority,
+AcpiOsExecute (
+ ACPI_EXECUTE_TYPE Type,
ACPI_OSD_EXEC_CALLBACK Function,
void *Context);
@@ -371,6 +407,7 @@ AcpiOsWritePciConfiguration (
ACPI_INTEGER Value,
UINT32 Width);
+
/*
* Interim function needed for PCI IRQ routing
*/
@@ -380,9 +417,20 @@ AcpiOsDerivePciId(
ACPI_HANDLE Chandle,
ACPI_PCI_ID **PciId);
+
/*
* Miscellaneous
*/
+ACPI_STATUS
+AcpiOsValidateInterface (
+ char *Interface);
+
+ACPI_STATUS
+AcpiOsValidateAddress (
+ UINT8 SpaceId,
+ ACPI_PHYSICAL_ADDRESS Address,
+ ACPI_SIZE Length);
+
BOOLEAN
AcpiOsReadable (
void *Pointer,
@@ -402,6 +450,7 @@ AcpiOsSignal (
UINT32 Function,
void *Info);
+
/*
* Debug print routines
*/
@@ -451,14 +500,5 @@ void
AcpiOsCloseDirectory (
void *DirHandle);
-/*
- * Debug
- */
-void
-AcpiOsDbgAssert(
- void *FailedAssertion,
- void *FileName,
- UINT32 LineNumber,
- char *Message);
#endif /* __ACPIOSXF_H__ */
diff --git a/sys/contrib/dev/acpica/acpixf.h b/sys/contrib/dev/acpica/acpixf.h
index f895cc2..f85fd67 100644
--- a/sys/contrib/dev/acpica/acpixf.h
+++ b/sys/contrib/dev/acpica/acpixf.h
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -126,6 +126,12 @@
* Global interfaces
*/
ACPI_STATUS
+AcpiInitializeTables (
+ ACPI_TABLE_DESC *InitialStorage,
+ UINT32 InitialTableCount,
+ BOOLEAN AllowResize);
+
+ACPI_STATUS
AcpiInitializeSubsystem (
void);
@@ -190,40 +196,33 @@ AcpiFree (
* ACPI table manipulation interfaces
*/
ACPI_STATUS
-AcpiFindRootPointer (
- UINT32 Flags,
- ACPI_POINTER *RsdpAddress);
-
-ACPI_STATUS
-AcpiLoadTables (
+AcpiReallocateRootTable (
void);
ACPI_STATUS
-AcpiLoadTable (
- ACPI_TABLE_HEADER *TablePtr);
+AcpiFindRootPointer (
+ ACPI_NATIVE_UINT *RsdpAddress);
ACPI_STATUS
-AcpiUnloadTable (
- ACPI_TABLE_TYPE TableType);
+AcpiLoadTables (
+ void);
ACPI_STATUS
AcpiGetTableHeader (
- ACPI_TABLE_TYPE TableType,
- UINT32 Instance,
+ ACPI_STRING Signature,
+ ACPI_NATIVE_UINT Instance,
ACPI_TABLE_HEADER *OutTableHeader);
ACPI_STATUS
AcpiGetTable (
- ACPI_TABLE_TYPE TableType,
- UINT32 Instance,
- ACPI_BUFFER *RetBuffer);
+ ACPI_STRING Signature,
+ ACPI_NATIVE_UINT Instance,
+ ACPI_TABLE_HEADER **OutTable);
ACPI_STATUS
-AcpiGetFirmwareTable (
- ACPI_STRING Signature,
- UINT32 Instance,
- UINT32 Flags,
- ACPI_TABLE_HEADER **TablePointer);
+AcpiGetTableByIndex (
+ ACPI_NATIVE_UINT TableIndex,
+ ACPI_TABLE_HEADER **OutTable);
/*
@@ -465,6 +464,12 @@ ACPI_STATUS (*ACPI_WALK_RESOURCE_CALLBACK) (
ACPI_RESOURCE *Resource,
void *Context);
+ACPI_STATUS
+AcpiGetVendorResource (
+ ACPI_HANDLE DeviceHandle,
+ char *Name,
+ ACPI_VENDOR_UUID *Uuid,
+ ACPI_BUFFER *RetBuffer);
ACPI_STATUS
AcpiGetCurrentResources(
@@ -478,10 +483,10 @@ AcpiGetPossibleResources(
ACPI_STATUS
AcpiWalkResources (
- ACPI_HANDLE DeviceHandle,
- char *Path,
- ACPI_WALK_RESOURCE_CALLBACK UserFunction,
- void *Context);
+ ACPI_HANDLE DeviceHandle,
+ char *Name,
+ ACPI_WALK_RESOURCE_CALLBACK UserFunction,
+ void *Context);
ACPI_STATUS
AcpiSetCurrentResources (
@@ -504,14 +509,12 @@ AcpiResourceToAddress64 (
ACPI_STATUS
AcpiGetRegister (
UINT32 RegisterId,
- UINT32 *ReturnValue,
- UINT32 Flags);
+ UINT32 *ReturnValue);
ACPI_STATUS
AcpiSetRegister (
UINT32 RegisterId,
- UINT32 Value,
- UINT32 Flags);
+ UINT32 Value);
ACPI_STATUS
AcpiSetFirmwareWakingVector (
diff --git a/sys/contrib/dev/acpica/acresrc.h b/sys/contrib/dev/acpica/acresrc.h
index f0f5a40..345c21e 100644
--- a/sys/contrib/dev/acpica/acresrc.h
+++ b/sys/contrib/dev/acpica/acresrc.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acresrc.h - Resource Manager function prototypes
- * $Revision: 1.51 $
+ * $Revision: 1.60 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -125,9 +125,13 @@
/*
* If possible, pack the following structures to byte alignment, since we
- * don't care about performance for debug output
+ * don't care about performance for debug output. Two cases where we cannot
+ * pack the structures:
+ *
+ * 1) Hardware does not support misaligned memory transfers
+ * 2) Compiler does not support pointers within packed structures
*/
-#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
+#if (!defined(ACPI_MISALIGNMENT_NOT_SUPPORTED) && !defined(ACPI_PACKED_POINTERS_NOT_SUPPORTED))
#pragma pack(1)
#endif
@@ -178,29 +182,12 @@ typedef const struct acpi_rsconvert_info
#define AML_OFFSET(f) (UINT8) ACPI_OFFSET (AML_RESOURCE,f)
-/*
- * Resource dispatch and info tables
- */
-typedef const struct acpi_resource_info
-{
- UINT8 LengthType;
- UINT8 MinimumAmlResourceLength;
- UINT8 MinimumInternalStructLength;
-
-} ACPI_RESOURCE_INFO;
-
-/* Types for LengthType above */
-
-#define ACPI_FIXED_LENGTH 0
-#define ACPI_VARIABLE_LENGTH 1
-#define ACPI_SMALL_VARIABLE_LENGTH 2
-
typedef const struct acpi_rsdump_info
{
UINT8 Opcode;
UINT8 Offset;
char *Name;
- const void *Pointer;
+ const char **Pointer;
} ACPI_RSDUMP_INFO;
@@ -233,10 +220,17 @@ extern ACPI_RSCONVERT_INFO *AcpiGbl_SetResourceDispatch[];
/* Resource tables indexed by raw AML resource descriptor type */
-extern ACPI_RESOURCE_INFO AcpiGbl_SmResourceInfo[];
-extern ACPI_RESOURCE_INFO AcpiGbl_LgResourceInfo[];
-extern ACPI_RSCONVERT_INFO *AcpiGbl_SmGetResourceDispatch[];
-extern ACPI_RSCONVERT_INFO *AcpiGbl_LgGetResourceDispatch[];
+extern const UINT8 AcpiGbl_ResourceStructSizes[];
+extern ACPI_RSCONVERT_INFO *AcpiGbl_GetResourceDispatch[];
+
+
+typedef struct acpi_vendor_walk_info
+{
+ ACPI_VENDOR_UUID *Uuid;
+ ACPI_BUFFER *Buffer;
+ ACPI_STATUS Status;
+
+} ACPI_VENDOR_WALK_INFO;
/*
@@ -263,17 +257,17 @@ AcpiRsCreatePciRoutingTable (
*/
ACPI_STATUS
AcpiRsGetPrtMethodData (
- ACPI_HANDLE Handle,
+ ACPI_NAMESPACE_NODE *Node,
ACPI_BUFFER *RetBuffer);
ACPI_STATUS
AcpiRsGetCrsMethodData (
- ACPI_HANDLE Handle,
+ ACPI_NAMESPACE_NODE *Node,
ACPI_BUFFER *RetBuffer);
ACPI_STATUS
AcpiRsGetPrsMethodData (
- ACPI_HANDLE Handle,
+ ACPI_NAMESPACE_NODE *Node,
ACPI_BUFFER *RetBuffer);
ACPI_STATUS
@@ -284,7 +278,7 @@ AcpiRsGetMethodData (
ACPI_STATUS
AcpiRsSetSrsMethodData (
- ACPI_HANDLE Handle,
+ ACPI_NAMESPACE_NODE *Node,
ACPI_BUFFER *RetBuffer);
@@ -309,9 +303,11 @@ AcpiRsGetPciRoutingTableLength (
ACPI_STATUS
AcpiRsConvertAmlToResources (
- UINT8 *AmlBuffer,
- UINT32 AmlBufferLength,
- UINT8 *OutputBuffer);
+ UINT8 *Aml,
+ UINT32 Length,
+ UINT32 Offset,
+ UINT8 ResourceIndex,
+ void *Context);
ACPI_STATUS
AcpiRsConvertResourcesToAml (
@@ -395,10 +391,6 @@ AcpiRsSetResourceLength (
ACPI_RSDESC_SIZE TotalLength,
AML_RESOURCE *Aml);
-ACPI_RESOURCE_INFO *
-AcpiRsGetResourceInfo (
- UINT8 ResourceType);
-
/*
* rsdump
diff --git a/sys/contrib/dev/acpica/acstruct.h b/sys/contrib/dev/acpica/acstruct.h
index b45e9f4..7861e7a 100644
--- a/sys/contrib/dev/acpica/acstruct.h
+++ b/sys/contrib/dev/acpica/acstruct.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acstruct.h - Internal structs
- * $Revision: 1.37 $
+ * $Revision: 1.47 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -117,6 +117,7 @@
#ifndef __ACSTRUCT_H__
#define __ACSTRUCT_H__
+/* acpisrc:StructDefs -- for acpisrc conversion */
/*****************************************************************************
*
@@ -126,68 +127,81 @@
/*
- * Walk state - current state of a parse tree walk. Used for both a leisurely stroll through
- * the tree (for whatever reason), and for control method execution.
+ * Walk state - current state of a parse tree walk. Used for both a leisurely
+ * stroll through the tree (for whatever reason), and for control method
+ * execution.
*/
#define ACPI_NEXT_OP_DOWNWARD 1
#define ACPI_NEXT_OP_UPWARD 2
+/*
+ * Groups of definitions for WalkType used for different implementations of
+ * walkers (never simultaneously) - flags for interpreter:
+ */
#define ACPI_WALK_NON_METHOD 0
-#define ACPI_WALK_METHOD 1
-#define ACPI_WALK_METHOD_RESTART 2
-#define ACPI_WALK_CONST_REQUIRED 3
-#define ACPI_WALK_CONST_OPTIONAL 4
+#define ACPI_WALK_METHOD 0x01
+#define ACPI_WALK_METHOD_RESTART 0x02
+
+/* Flags for iASL compiler only */
+
+#define ACPI_WALK_CONST_REQUIRED 0x10
+#define ACPI_WALK_CONST_OPTIONAL 0x20
+
typedef struct acpi_walk_state
{
- UINT8 DataType; /* To differentiate various internal objs MUST BE FIRST!*/\
- UINT8 WalkType;
- ACPI_OWNER_ID OwnerId; /* Owner of objects created during the walk */
- BOOLEAN LastPredicate; /* Result of last predicate */
- UINT8 CurrentResult; /* */
- UINT8 NextOpInfo; /* Info about NextOp */
- UINT8 NumOperands; /* Stack pointer for Operands[] array */
- UINT8 ReturnUsed;
- UINT16 Opcode; /* Current AML opcode */
- UINT8 ScopeDepth;
- UINT8 PassNumber; /* Parse pass during table load */
- UINT32 ArgCount; /* push for fixed or var args */
- UINT32 AmlOffset;
- UINT32 ArgTypes;
- UINT32 MethodBreakpoint; /* For single stepping */
- UINT32 UserBreakpoint; /* User AML breakpoint */
- UINT32 ParseFlags;
- UINT32 PrevArgTypes;
-
- UINT8 *AmlLastWhile;
- struct acpi_namespace_node Arguments[ACPI_METHOD_NUM_ARGS]; /* Control method arguments */
- 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 LocalVariables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */
- struct acpi_namespace_node *MethodCallNode; /* Called method Node*/
- ACPI_PARSE_OBJECT *MethodCallOp; /* MethodCall Op if running a method */
- union acpi_operand_object *MethodDesc; /* Method descriptor if running a method */
- struct acpi_namespace_node *MethodNode; /* Method node if running a method. */
- ACPI_PARSE_OBJECT *Op; /* Current parser op */
- union acpi_operand_object *Operands[ACPI_OBJ_NUM_OPERANDS+1]; /* Operands passed to the interpreter (+1 for NULL terminator) */
- const ACPI_OPCODE_INFO *OpInfo; /* Info on current opcode */
- ACPI_PARSE_OBJECT *Origin; /* Start of walk [Obsolete] */
- union acpi_operand_object **Params;
- ACPI_PARSE_STATE ParserState; /* Current state of parser */
- union acpi_operand_object *ResultObj;
- ACPI_GENERIC_STATE *Results; /* Stack of accumulated results */
- union acpi_operand_object *ReturnDesc; /* Return object, if any */
- ACPI_GENERIC_STATE *ScopeInfo; /* Stack of nested scopes */
-
- ACPI_PARSE_OBJECT *PrevOp; /* Last op that was processed */
- ACPI_PARSE_OBJECT *NextOp; /* next op to be processed */
- ACPI_PARSE_DOWNWARDS DescendingCallback;
- ACPI_PARSE_UPWARDS AscendingCallback;
- ACPI_THREAD_STATE *Thread;
- struct acpi_walk_state *Next; /* Next WalkState in list */
+ struct acpi_walk_state *Next; /* Next WalkState in list */
+ UINT8 DescriptorType; /* To differentiate various internal objs */
+ UINT8 WalkType;
+ UINT16 Opcode; /* Current AML opcode */
+ UINT8 NextOpInfo; /* Info about NextOp */
+ UINT8 NumOperands; /* Stack pointer for Operands[] array */
+ UINT8 OperandIndex; /* Index into operand stack, to be used by AcpiDsObjStackPush */
+ ACPI_OWNER_ID OwnerId; /* Owner of objects created during the walk */
+ BOOLEAN LastPredicate; /* Result of last predicate */
+ UINT8 CurrentResult;
+ UINT8 ReturnUsed;
+ UINT8 ScopeDepth;
+ UINT8 PassNumber; /* Parse pass during table load */
+ UINT8 ResultSize; /* Total elements for the result stack */
+ UINT8 ResultCount; /* Current number of occupied elements of result stack */
+ UINT32 AmlOffset;
+ UINT32 ArgTypes;
+ UINT32 MethodBreakpoint; /* For single stepping */
+ UINT32 UserBreakpoint; /* User AML breakpoint */
+ UINT32 ParseFlags;
+
+ ACPI_PARSE_STATE ParserState; /* Current state of parser */
+ UINT32 PrevArgTypes;
+ UINT32 ArgCount; /* push for fixed or var args */
+
+ struct acpi_namespace_node Arguments[ACPI_METHOD_NUM_ARGS]; /* Control method arguments */
+ struct acpi_namespace_node LocalVariables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */
+ union acpi_operand_object *Operands[ACPI_OBJ_NUM_OPERANDS + 1]; /* Operands passed to the interpreter (+1 for NULL terminator) */
+ union acpi_operand_object **Params;
+
+ UINT8 *AmlLastWhile;
+ 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 */
+ union acpi_operand_object *MethodDesc; /* Method descriptor if running a method */
+ struct acpi_namespace_node *MethodNode; /* Method node if running a method. */
+ ACPI_PARSE_OBJECT *Op; /* Current parser op */
+ const ACPI_OPCODE_INFO *OpInfo; /* Info on current opcode */
+ ACPI_PARSE_OBJECT *Origin; /* Start of walk [Obsolete] */
+ union acpi_operand_object *ResultObj;
+ ACPI_GENERIC_STATE *Results; /* Stack of accumulated results */
+ union acpi_operand_object *ReturnDesc; /* Return object, if any */
+ ACPI_GENERIC_STATE *ScopeInfo; /* Stack of nested scopes */
+ ACPI_PARSE_OBJECT *PrevOp; /* Last op that was processed */
+ ACPI_PARSE_OBJECT *NextOp; /* next op to be processed */
+ ACPI_THREAD_STATE *Thread;
+ ACPI_PARSE_DOWNWARDS DescendingCallback;
+ ACPI_PARSE_UPWARDS AscendingCallback;
} ACPI_WALK_STATE;
@@ -196,112 +210,124 @@ typedef struct acpi_walk_state
typedef struct acpi_init_walk_info
{
- UINT16 MethodCount;
- UINT16 DeviceCount;
- UINT16 OpRegionCount;
- UINT16 FieldCount;
- UINT16 BufferCount;
- UINT16 PackageCount;
- UINT16 OpRegionInit;
- UINT16 FieldInit;
- UINT16 BufferInit;
- UINT16 PackageInit;
- UINT16 ObjectCount;
- ACPI_TABLE_DESC *TableDesc;
+ UINT16 MethodCount;
+ UINT16 DeviceCount;
+ UINT16 OpRegionCount;
+ UINT16 FieldCount;
+ UINT16 BufferCount;
+ UINT16 PackageCount;
+ UINT16 OpRegionInit;
+ UINT16 FieldInit;
+ UINT16 BufferInit;
+ UINT16 PackageInit;
+ UINT16 ObjectCount;
+ ACPI_OWNER_ID OwnerId;
+ ACPI_NATIVE_UINT TableIndex;
} ACPI_INIT_WALK_INFO;
-/* Info used by AcpiNsInitializeDevices */
-
-typedef struct acpi_device_walk_info
-{
- UINT16 DeviceCount;
- UINT16 Num_STA;
- UINT16 Num_INI;
- ACPI_TABLE_DESC *TableDesc;
-
-} ACPI_DEVICE_WALK_INFO;
-
-
-/* TBD: [Restructure] Merge with struct above */
-
-typedef struct acpi_walk_info
-{
- UINT32 DebugLevel;
- UINT32 Count;
- ACPI_OWNER_ID OwnerId;
- UINT8 DisplayType;
-
-} ACPI_WALK_INFO;
-
-/* Display Types */
-
-#define ACPI_DISPLAY_SUMMARY (UINT8) 0
-#define ACPI_DISPLAY_OBJECTS (UINT8) 1
-#define ACPI_DISPLAY_MASK (UINT8) 1
-
-#define ACPI_DISPLAY_SHORT (UINT8) 2
-
typedef struct acpi_get_devices_info
{
- ACPI_WALK_CALLBACK UserFunction;
- void *Context;
- char *Hid;
+ ACPI_WALK_CALLBACK UserFunction;
+ void *Context;
+ char *Hid;
} ACPI_GET_DEVICES_INFO;
typedef union acpi_aml_operands
{
- ACPI_OPERAND_OBJECT *Operands[7];
+ ACPI_OPERAND_OBJECT *Operands[7];
struct
{
- ACPI_OBJECT_INTEGER *Type;
- ACPI_OBJECT_INTEGER *Code;
- ACPI_OBJECT_INTEGER *Argument;
+ ACPI_OBJECT_INTEGER *Type;
+ ACPI_OBJECT_INTEGER *Code;
+ ACPI_OBJECT_INTEGER *Argument;
} Fatal;
struct
{
- ACPI_OPERAND_OBJECT *Source;
- ACPI_OBJECT_INTEGER *Index;
- ACPI_OPERAND_OBJECT *Target;
+ ACPI_OPERAND_OBJECT *Source;
+ ACPI_OBJECT_INTEGER *Index;
+ ACPI_OPERAND_OBJECT *Target;
} Index;
struct
{
- ACPI_OPERAND_OBJECT *Source;
- ACPI_OBJECT_INTEGER *Index;
- ACPI_OBJECT_INTEGER *Length;
- ACPI_OPERAND_OBJECT *Target;
+ ACPI_OPERAND_OBJECT *Source;
+ ACPI_OBJECT_INTEGER *Index;
+ ACPI_OBJECT_INTEGER *Length;
+ ACPI_OPERAND_OBJECT *Target;
} Mid;
} ACPI_AML_OPERANDS;
-/* Internal method parameter list */
-
-typedef struct acpi_parameter_info
+/*
+ * Structure used to pass object evaluation parameters.
+ * Purpose is to reduce CPU stack use.
+ */
+typedef struct acpi_evaluate_info
{
- ACPI_NAMESPACE_NODE *Node;
- ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_OPERAND_OBJECT **Parameters;
- ACPI_OPERAND_OBJECT *ReturnObject;
- UINT8 PassNumber;
- UINT8 ParameterType;
- UINT8 ReturnObjectType;
-
-} ACPI_PARAMETER_INFO;
+ ACPI_NAMESPACE_NODE *PrefixNode;
+ char *Pathname;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_OPERAND_OBJECT **Parameters;
+ ACPI_NAMESPACE_NODE *ResolvedNode;
+ ACPI_OPERAND_OBJECT *ReturnObject;
+ 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
+
+
+/* Info used by AcpiNsInitializeDevices */
+
+typedef struct acpi_device_walk_info
+{
+ UINT16 DeviceCount;
+ UINT16 Num_STA;
+ UINT16 Num_INI;
+ ACPI_TABLE_DESC *TableDesc;
+ ACPI_EVALUATE_INFO *EvaluateInfo;
+
+} ACPI_DEVICE_WALK_INFO;
+
+
+/* TBD: [Restructure] Merge with struct above */
+
+typedef struct acpi_walk_info
+{
+ UINT32 DebugLevel;
+ UINT32 Count;
+ ACPI_OWNER_ID OwnerId;
+ UINT8 DisplayType;
+
+} ACPI_WALK_INFO;
+
+/* Display Types */
+
+#define ACPI_DISPLAY_SUMMARY (UINT8) 0
+#define ACPI_DISPLAY_OBJECTS (UINT8) 1
+#define ACPI_DISPLAY_MASK (UINT8) 1
+
+#define ACPI_DISPLAY_SHORT (UINT8) 2
+
#endif
diff --git a/sys/contrib/dev/acpica/actables.h b/sys/contrib/dev/acpica/actables.h
index f3163d9..144b59f 100644
--- a/sys/contrib/dev/acpica/actables.h
+++ b/sys/contrib/dev/acpica/actables.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: actables.h - ACPI table management
- * $Revision: 1.53 $
+ * $Revision: 1.64 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -118,153 +118,126 @@
#define __ACTABLES_H__
-/* Used in AcpiTbMapAcpiTable for size parameter if table header is to be used */
-
-#define SIZE_IN_HEADER 0
-
-
-/*
- * tbconvrt - Table conversion routines
- */
-ACPI_STATUS
-AcpiTbConvertToXsdt (
- ACPI_TABLE_DESC *TableInfo);
-
-ACPI_STATUS
-AcpiTbConvertTableFadt (
- void);
-
ACPI_STATUS
-AcpiTbBuildCommonFacs (
- ACPI_TABLE_DESC *TableInfo);
-
-UINT32
-AcpiTbGetTableCount (
- RSDP_DESCRIPTOR *RSDP,
- ACPI_TABLE_HEADER *RSDT);
-
+AcpiAllocateRootTable (
+ UINT32 InitialTableCount);
/*
- * tbget - Table "get" routines
+ * tbfadt - FADT parse/convert/validate
*/
-ACPI_STATUS
-AcpiTbGetTable (
- ACPI_POINTER *Address,
- ACPI_TABLE_DESC *TableInfo);
-
-ACPI_STATUS
-AcpiTbGetTableHeader (
- ACPI_POINTER *Address,
- ACPI_TABLE_HEADER *ReturnHeader);
-
-ACPI_STATUS
-AcpiTbGetTableBody (
- ACPI_POINTER *Address,
- ACPI_TABLE_HEADER *Header,
- ACPI_TABLE_DESC *TableInfo);
-
-ACPI_STATUS
-AcpiTbGetTablePtr (
- ACPI_TABLE_TYPE TableType,
- UINT32 Instance,
- ACPI_TABLE_HEADER **TablePtrLoc);
-
-ACPI_STATUS
-AcpiTbVerifyRsdp (
- ACPI_POINTER *Address);
-
void
-AcpiTbGetRsdtAddress (
- ACPI_POINTER *OutAddress);
+AcpiTbParseFadt (
+ ACPI_NATIVE_UINT TableIndex,
+ UINT8 Flags);
-ACPI_STATUS
-AcpiTbValidateRsdt (
- ACPI_TABLE_HEADER *TablePtr);
+void
+AcpiTbCreateLocalFadt (
+ ACPI_TABLE_HEADER *Table,
+ UINT32 Length);
/*
- * tbgetall - get multiple required tables
+ * tbfind - find ACPI table
*/
ACPI_STATUS
-AcpiTbGetRequiredTables (
- void);
+AcpiTbFindTable (
+ char *Signature,
+ char *OemId,
+ char *OemTableId,
+ ACPI_NATIVE_UINT *TableIndex);
/*
- * tbinstall - Table installation
+ * tbinstal - Table removal and deletion
*/
ACPI_STATUS
-AcpiTbInstallTable (
- ACPI_TABLE_DESC *TableInfo);
+AcpiTbResizeRootTableList (
+ void);
ACPI_STATUS
-AcpiTbRecognizeTable (
- ACPI_TABLE_DESC *TableInfo,
- UINT8 SearchType);
+AcpiTbVerifyTable (
+ ACPI_TABLE_DESC *TableDesc);
ACPI_STATUS
-AcpiTbInitTableDescriptor (
- ACPI_TABLE_TYPE TableType,
- ACPI_TABLE_DESC *TableInfo);
+AcpiTbAddTable (
+ ACPI_TABLE_DESC *TableDesc,
+ ACPI_NATIVE_UINT *TableIndex);
+ACPI_STATUS
+AcpiTbStoreTable (
+ ACPI_PHYSICAL_ADDRESS Address,
+ ACPI_TABLE_HEADER *Table,
+ UINT32 Length,
+ UINT8 Flags,
+ ACPI_NATIVE_UINT *TableIndex);
-/*
- * tbremove - Table removal and deletion
- */
void
-AcpiTbDeleteAllTables (
- void);
+AcpiTbDeleteTable (
+ ACPI_TABLE_DESC *TableDesc);
void
-AcpiTbDeleteTablesByType (
- ACPI_TABLE_TYPE Type);
+AcpiTbTerminate (
+ void);
void
-AcpiTbDeleteSingleTable (
- ACPI_TABLE_DESC *TableDesc);
+AcpiTbDeleteNamespaceByOwner (
+ ACPI_NATIVE_UINT TableIndex);
-ACPI_TABLE_DESC *
-AcpiTbUninstallTable (
- ACPI_TABLE_DESC *TableDesc);
-
-
-/*
- * tbxfroot - RSDP, RSDT utilities
- */
ACPI_STATUS
-AcpiTbFindTable (
- char *Signature,
- char *OemId,
- char *OemTableId,
- ACPI_TABLE_HEADER **TablePtr);
+AcpiTbAllocateOwnerId (
+ ACPI_NATIVE_UINT TableIndex);
ACPI_STATUS
-AcpiTbGetTableRsdt (
- void);
+AcpiTbReleaseOwnerId (
+ ACPI_NATIVE_UINT TableIndex);
ACPI_STATUS
-AcpiTbValidateRsdp (
- RSDP_DESCRIPTOR *Rsdp);
+AcpiTbGetOwnerId (
+ ACPI_NATIVE_UINT TableIndex,
+ ACPI_OWNER_ID *OwnerId);
+
+BOOLEAN
+AcpiTbIsTableLoaded (
+ ACPI_NATIVE_UINT TableIndex);
+
+void
+AcpiTbSetTableLoadedFlag (
+ ACPI_NATIVE_UINT TableIndex,
+ BOOLEAN IsLoaded);
/*
- * tbutils - common table utilities
+ * tbutils - table manager utilities
*/
-ACPI_STATUS
-AcpiTbIsTableInstalled (
- ACPI_TABLE_DESC *NewTableDesc);
+BOOLEAN
+AcpiTbTablesLoaded (
+ void);
-ACPI_STATUS
-AcpiTbVerifyTableChecksum (
- ACPI_TABLE_HEADER *TableHeader);
+void
+AcpiTbPrintTableHeader(
+ ACPI_PHYSICAL_ADDRESS Address,
+ ACPI_TABLE_HEADER *Header);
UINT8
-AcpiTbGenerateChecksum (
- void *Buffer,
+AcpiTbChecksum (
+ UINT8 *Buffer,
+ ACPI_NATIVE_UINT Length);
+
+ACPI_STATUS
+AcpiTbVerifyChecksum (
+ ACPI_TABLE_HEADER *Table,
UINT32 Length);
+void
+AcpiTbInstallTable (
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT8 Flags,
+ char *Signature,
+ ACPI_NATIVE_UINT TableIndex);
+
ACPI_STATUS
-AcpiTbValidateTableHeader (
- ACPI_TABLE_HEADER *TableHeader);
+AcpiTbParseRootTable (
+ ACPI_PHYSICAL_ADDRESS RsdpAddress,
+ UINT8 Flags);
#endif /* __ACTABLES_H__ */
diff --git a/sys/contrib/dev/acpica/actbl.h b/sys/contrib/dev/acpica/actbl.h
index 1c8b9a6..41859ff 100644
--- a/sys/contrib/dev/acpica/actbl.h
+++ b/sys/contrib/dev/acpica/actbl.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
- * Name: actbl.h - Table data structures defined in ACPI specification
- * $Revision: 1.72 $
+ * Name: actbl.h - Basic ACPI Table Definitions
+ * $Revision: 1.84 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -117,329 +117,279 @@
#ifndef __ACTBL_H__
#define __ACTBL_H__
-
/*
- * Values for description table header signatures
+ * Values for description table header signatures. Useful because they make
+ * it more difficult to inadvertently type in the wrong signature.
*/
-#define RSDP_NAME "RSDP"
-#define RSDP_SIG "RSD PTR " /* RSDT Pointer signature */
-#define APIC_SIG "APIC" /* Multiple APIC Description Table */
-#define DSDT_SIG "DSDT" /* Differentiated System Description Table */
-#define FADT_SIG "FACP" /* Fixed ACPI Description Table */
-#define FACS_SIG "FACS" /* Firmware ACPI Control Structure */
-#define PSDT_SIG "PSDT" /* Persistent System Description Table */
-#define RSDT_SIG "RSDT" /* Root System Description Table */
-#define XSDT_SIG "XSDT" /* Extended System Description Table */
-#define SSDT_SIG "SSDT" /* Secondary System Description Table */
-#define SBST_SIG "SBST" /* Smart Battery Specification Table */
-#define SPIC_SIG "SPIC" /* IOSAPIC table */
-#define BOOT_SIG "BOOT" /* Boot table */
-
-
-#define GL_OWNED 0x02 /* Ownership of global lock is bit 1 */
+#define ACPI_SIG_DSDT "DSDT" /* Differentiated System Description Table */
+#define ACPI_SIG_FADT "FACP" /* Fixed ACPI Description Table */
+#define ACPI_SIG_FACS "FACS" /* Firmware ACPI Control Structure */
+#define ACPI_SIG_PSDT "PSDT" /* Persistent System Description Table */
+#define ACPI_SIG_RSDP "RSD PTR " /* Root System Description Pointer */
+#define ACPI_SIG_RSDT "RSDT" /* Root System Description Table */
+#define ACPI_SIG_XSDT "XSDT" /* Extended System Description Table */
+#define ACPI_SIG_SSDT "SSDT" /* Secondary System Description Table */
+#define ACPI_RSDP_NAME "RSDP" /* Short name for RSDP, not signature */
/*
- * Common table types. The base code can remain
- * constant if the underlying tables are changed
+ * All tables and structures must be byte-packed to match the ACPI
+ * specification, since the tables are provided by the system BIOS
*/
-#define RSDT_DESCRIPTOR RSDT_DESCRIPTOR_REV2
-#define XSDT_DESCRIPTOR XSDT_DESCRIPTOR_REV2
-#define FACS_DESCRIPTOR FACS_DESCRIPTOR_REV2
-#define FADT_DESCRIPTOR FADT_DESCRIPTOR_REV2
-
-
#pragma pack(1)
+
/*
- * ACPI Version-independent tables
+ * These are the ACPI tables that are directly consumed by the subsystem.
*
- * NOTE: The tables that are specific to ACPI versions (1.0, 2.0, etc.)
- * are in separate files.
+ * The RSDP and FACS do not use the common ACPI table header. All other ACPI
+ * tables use the header.
+ *
+ * Note about bitfields: The UINT8 type is used for bitfields in ACPI tables.
+ * This is the only type that is even remotely portable. Anything else is not
+ * portable, so do not use any other bitfield types.
*/
-typedef struct rsdp_descriptor /* Root System Descriptor Pointer */
-{
- char Signature[8]; /* ACPI signature, contains "RSD PTR " */
- UINT8 Checksum; /* ACPI 1.0 checksum */
- char OemId[6]; /* OEM identification */
- UINT8 Revision; /* Must be (0) for ACPI 1.0 or (2) for ACPI 2.0+ */
- UINT32 RsdtPhysicalAddress; /* 32-bit physical address of the RSDT */
- UINT32 Length; /* XSDT Length in bytes, including header */
- UINT64 XsdtPhysicalAddress; /* 64-bit physical address of the XSDT */
- UINT8 ExtendedChecksum; /* Checksum of entire table (ACPI 2.0) */
- char Reserved[3]; /* Reserved, must be zero */
-
-} RSDP_DESCRIPTOR;
-
-
-typedef struct acpi_common_facs /* Common FACS for internal use */
-{
- UINT32 *GlobalLock;
- UINT64 *FirmwareWakingVector;
- UINT8 VectorWidth;
-
-} ACPI_COMMON_FACS;
-
-
-#define ACPI_TABLE_HEADER_DEF /* ACPI common table header */ \
- char Signature[4]; /* ASCII table signature */\
- UINT32 Length; /* Length of table in bytes, including this header */\
- UINT8 Revision; /* ACPI Specification minor version # */\
- UINT8 Checksum; /* To make sum of entire table == 0 */\
- char OemId[6]; /* ASCII OEM identification */\
- char OemTableId[8]; /* ASCII OEM table identification */\
- UINT32 OemRevision; /* OEM revision number */\
- char AslCompilerId [4]; /* ASCII ASL compiler vendor ID */\
- UINT32 AslCompilerRevision; /* ASL compiler version */
+/*******************************************************************************
+ *
+ * ACPI Table Header. This common header is used by all tables except the
+ * RSDP and FACS. The define is used for direct inclusion of header into
+ * other ACPI tables
+ *
+ ******************************************************************************/
-typedef struct acpi_table_header /* ACPI common table header */
+typedef struct acpi_table_header
{
- ACPI_TABLE_HEADER_DEF
+ char Signature[ACPI_NAME_SIZE]; /* ASCII table signature */
+ UINT32 Length; /* Length of table in bytes, including this header */
+ UINT8 Revision; /* ACPI Specification minor version # */
+ UINT8 Checksum; /* To make sum of entire table == 0 */
+ char OemId[ACPI_OEM_ID_SIZE]; /* ASCII OEM identification */
+ char OemTableId[ACPI_OEM_TABLE_ID_SIZE]; /* ASCII OEM table identification */
+ UINT32 OemRevision; /* OEM revision number */
+ char AslCompilerId[ACPI_NAME_SIZE]; /* ASCII ASL compiler vendor ID */
+ UINT32 AslCompilerRevision; /* ASL compiler version */
} ACPI_TABLE_HEADER;
/*
- * MADT values and structures
+ * GAS - Generic Address Structure (ACPI 2.0+)
+ *
+ * Note: Since this structure is used in the ACPI tables, it is byte aligned.
+ * If misalignment is not supported, access to the Address field must be
+ * performed with care.
*/
-
-/* Values for MADT PCATCompat */
-
-#define DUAL_PIC 0
-#define MULTIPLE_APIC 1
-
-/* Master MADT */
-
-typedef struct multiple_apic_table
+typedef struct acpi_generic_address
{
- ACPI_TABLE_HEADER_DEF /* ACPI common table header */
- UINT32 LocalApicAddress; /* Physical address of local APIC */
-
- /* Flags (32 bits) */
-
- UINT8_BIT PCATCompat : 1; /* 00: System also has dual 8259s */
- UINT8_BIT : 7; /* 01-07: Reserved, must be zero */
- UINT8 Reserved1[3]; /* 08-31: Reserved, must be zero */
+ UINT8 SpaceId; /* Address space where struct or register exists */
+ UINT8 BitWidth; /* Size in bits of given register */
+ UINT8 BitOffset; /* Bit offset within the register */
+ UINT8 AccessWidth; /* Minimum Access size (ACPI 3.0) */
+ UINT64 Address; /* 64-bit address of struct or register */
-} MULTIPLE_APIC_TABLE;
+} ACPI_GENERIC_ADDRESS;
-/* Values for Type in APIC_HEADER_DEF */
-#define APIC_PROCESSOR 0
-#define APIC_IO 1
-#define APIC_XRUPT_OVERRIDE 2
-#define APIC_NMI 3
-#define APIC_LOCAL_NMI 4
-#define APIC_ADDRESS_OVERRIDE 5
-#define APIC_IO_SAPIC 6
-#define APIC_LOCAL_SAPIC 7
-#define APIC_XRUPT_SOURCE 8
-#define APIC_RESERVED 9 /* 9 and greater are reserved */
-
-/*
- * MADT sub-structures (Follow MULTIPLE_APIC_DESCRIPTION_TABLE)
- */
-#define APIC_HEADER_DEF /* Common APIC sub-structure header */\
- UINT8 Type; \
- UINT8 Length;
+/*******************************************************************************
+ *
+ * RSDP - Root System Description Pointer (Signature is "RSD PTR ")
+ *
+ ******************************************************************************/
-typedef struct apic_header
+typedef struct acpi_table_rsdp
{
- APIC_HEADER_DEF
-
-} APIC_HEADER;
-
-/* Values for MPS INTI flags */
+ char Signature[8]; /* ACPI signature, contains "RSD PTR " */
+ UINT8 Checksum; /* ACPI 1.0 checksum */
+ char OemId[ACPI_OEM_ID_SIZE]; /* OEM identification */
+ UINT8 Revision; /* Must be (0) for ACPI 1.0 or (2) for ACPI 2.0+ */
+ UINT32 RsdtPhysicalAddress; /* 32-bit physical address of the RSDT */
+ UINT32 Length; /* Table length in bytes, including header (ACPI 2.0+) */
+ UINT64 XsdtPhysicalAddress; /* 64-bit physical address of the XSDT (ACPI 2.0+) */
+ UINT8 ExtendedChecksum; /* Checksum of entire table (ACPI 2.0+) */
+ UINT8 Reserved[3]; /* Reserved, must be zero */
-#define POLARITY_CONFORMS 0
-#define POLARITY_ACTIVE_HIGH 1
-#define POLARITY_RESERVED 2
-#define POLARITY_ACTIVE_LOW 3
+} ACPI_TABLE_RSDP;
-#define TRIGGER_CONFORMS 0
-#define TRIGGER_EDGE 1
-#define TRIGGER_RESERVED 2
-#define TRIGGER_LEVEL 3
+#define ACPI_RSDP_REV0_SIZE 20 /* Size of original ACPI 1.0 RSDP */
-/* Common flag definitions (16 bits each) */
-#define MPS_INTI_FLAGS \
- UINT8_BIT Polarity : 2; /* 00-01: Polarity of APIC I/O input signals */\
- UINT8_BIT TriggerMode : 2; /* 02-03: Trigger mode of APIC input signals */\
- UINT8_BIT : 4; /* 04-07: Reserved, must be zero */\
- UINT8 Reserved1; /* 08-15: Reserved, must be zero */
-
-#define LOCAL_APIC_FLAGS \
- UINT8_BIT ProcessorEnabled: 1; /* 00: Processor is usable if set */\
- UINT8_BIT : 7; /* 01-07: Reserved, must be zero */\
- UINT8 Reserved2; /* 08-15: Reserved, must be zero */
-
-/* Sub-structures for MADT */
+/*******************************************************************************
+ *
+ * RSDT/XSDT - Root System Description Tables
+ *
+ ******************************************************************************/
-typedef struct madt_processor_apic
+typedef struct acpi_table_rsdt
{
- APIC_HEADER_DEF
- UINT8 ProcessorId; /* ACPI processor id */
- UINT8 LocalApicId; /* Processor's local APIC id */
- LOCAL_APIC_FLAGS
+ ACPI_TABLE_HEADER Header; /* Common ACPI table header */
+ UINT32 TableOffsetEntry[1]; /* Array of pointers to ACPI tables */
-} MADT_PROCESSOR_APIC;
+} ACPI_TABLE_RSDT;
-typedef struct madt_io_apic
+typedef struct acpi_table_xsdt
{
- APIC_HEADER_DEF
- UINT8 IoApicId; /* I/O APIC ID */
- UINT8 Reserved; /* Reserved - must be zero */
- UINT32 Address; /* APIC physical address */
- UINT32 Interrupt; /* Global system interrupt where INTI
- * lines start */
-} MADT_IO_APIC;
-
-typedef struct madt_interrupt_override
-{
- APIC_HEADER_DEF
- UINT8 Bus; /* 0 - ISA */
- UINT8 Source; /* Interrupt source (IRQ) */
- UINT32 Interrupt; /* Global system interrupt */
- MPS_INTI_FLAGS
+ ACPI_TABLE_HEADER Header; /* Common ACPI table header */
+ UINT64 TableOffsetEntry[1]; /* Array of pointers to ACPI tables */
-} MADT_INTERRUPT_OVERRIDE;
+} ACPI_TABLE_XSDT;
-typedef struct madt_nmi_source
-{
- APIC_HEADER_DEF
- MPS_INTI_FLAGS
- UINT32 Interrupt; /* Global system interrupt */
-} MADT_NMI_SOURCE;
+/*******************************************************************************
+ *
+ * FACS - Firmware ACPI Control Structure (FACS)
+ *
+ ******************************************************************************/
-typedef struct madt_local_apic_nmi
+typedef struct acpi_table_facs
{
- APIC_HEADER_DEF
- UINT8 ProcessorId; /* ACPI processor id */
- MPS_INTI_FLAGS
- UINT8 Lint; /* LINTn to which NMI is connected */
+ char Signature[4]; /* ASCII table signature */
+ UINT32 Length; /* Length of structure, in bytes */
+ UINT32 HardwareSignature; /* Hardware configuration signature */
+ UINT32 FirmwareWakingVector; /* 32-bit physical address of the Firmware Waking Vector */
+ UINT32 GlobalLock; /* Global Lock for shared hardware resources */
+ UINT32 Flags;
+ UINT64 XFirmwareWakingVector; /* 64-bit version of the Firmware Waking Vector (ACPI 2.0+) */
+ UINT8 Version; /* Version of this table (ACPI 2.0+) */
+ UINT8 Reserved[31]; /* Reserved, must be zero */
-} MADT_LOCAL_APIC_NMI;
+} ACPI_TABLE_FACS;
-typedef struct madt_address_override
-{
- APIC_HEADER_DEF
- UINT16 Reserved; /* Reserved, must be zero */
- UINT64 Address; /* APIC physical address */
+/* Flag macros */
-} MADT_ADDRESS_OVERRIDE;
+#define ACPI_FACS_S4_BIOS_PRESENT (1) /* 00: S4BIOS support is present */
-typedef struct madt_io_sapic
-{
- APIC_HEADER_DEF
- UINT8 IoSapicId; /* I/O SAPIC ID */
- UINT8 Reserved; /* Reserved, must be zero */
- UINT32 InterruptBase; /* Glocal interrupt for SAPIC start */
- UINT64 Address; /* SAPIC physical address */
+/* Global lock flags */
-} MADT_IO_SAPIC;
+#define ACPI_GLOCK_PENDING 0x01 /* 00: Pending global lock ownership */
+#define ACPI_GLOCK_OWNED 0x02 /* 01: Global lock is owned */
-typedef struct madt_local_sapic
-{
- APIC_HEADER_DEF
- UINT8 ProcessorId; /* ACPI processor id */
- UINT8 LocalSapicId; /* SAPIC ID */
- UINT8 LocalSapicEid; /* SAPIC EID */
- UINT8 Reserved[3]; /* Reserved, must be zero */
- LOCAL_APIC_FLAGS
- UINT32 ProcessorUID; /* Numeric UID - ACPI 3.0 */
- char ProcessorUIDString[1]; /* String UID - ACPI 3.0 */
-
-} MADT_LOCAL_SAPIC;
-
-typedef struct madt_interrupt_source
-{
- APIC_HEADER_DEF
- MPS_INTI_FLAGS
- UINT8 InterruptType; /* 1=PMI, 2=INIT, 3=corrected */
- UINT8 ProcessorId; /* Processor ID */
- UINT8 ProcessorEid; /* Processor EID */
- UINT8 IoSapicVector; /* Vector value for PMI interrupts */
- UINT32 Interrupt; /* Global system interrupt */
- UINT32 Flags; /* Interrupt Source Flags */
-} MADT_INTERRUPT_SOURCE;
+/*******************************************************************************
+ *
+ * FADT - Fixed ACPI Description Table (Signature "FACP")
+ *
+ ******************************************************************************/
+/* Fields common to all versions of the FADT */
-/*
- * Smart Battery
- */
-typedef struct smart_battery_table
+typedef struct acpi_table_fadt
{
- ACPI_TABLE_HEADER_DEF
- UINT32 WarningLevel;
- UINT32 LowLevel;
- UINT32 CriticalLevel;
-
-} SMART_BATTERY_TABLE;
-
-
-#pragma pack()
+ ACPI_TABLE_HEADER Header; /* Common ACPI table header */
+ UINT32 Facs; /* 32-bit physical address of FACS */
+ UINT32 Dsdt; /* 32-bit physical address of DSDT */
+ UINT8 Model; /* System Interrupt Model (ACPI 1.0) - not used in ACPI 2.0+ */
+ UINT8 PreferredProfile; /* Conveys preferred power management profile to OSPM. */
+ UINT16 SciInterrupt; /* System vector of SCI interrupt */
+ UINT32 SmiCommand; /* 32-bit Port address of SMI command port */
+ UINT8 AcpiEnable; /* Value to write to smi_cmd to enable ACPI */
+ UINT8 AcpiDisable; /* Value to write to smi_cmd to disable ACPI */
+ UINT8 S4BiosRequest; /* Value to write to SMI CMD to enter S4BIOS state */
+ UINT8 PstateControl; /* Processor performance state control*/
+ UINT32 Pm1aEventBlock; /* 32-bit Port address of Power Mgt 1a Event Reg Blk */
+ UINT32 Pm1bEventBlock; /* 32-bit Port address of Power Mgt 1b Event Reg Blk */
+ UINT32 Pm1aControlBlock; /* 32-bit Port address of Power Mgt 1a Control Reg Blk */
+ UINT32 Pm1bControlBlock; /* 32-bit Port address of Power Mgt 1b Control Reg Blk */
+ UINT32 Pm2ControlBlock; /* 32-bit Port address of Power Mgt 2 Control Reg Blk */
+ UINT32 PmTimerBlock; /* 32-bit Port address of Power Mgt Timer Ctrl Reg Blk */
+ UINT32 Gpe0Block; /* 32-bit Port address of General Purpose Event 0 Reg Blk */
+ UINT32 Gpe1Block; /* 32-bit Port address of General Purpose Event 1 Reg Blk */
+ UINT8 Pm1EventLength; /* Byte Length of ports at Pm1xEventBlock */
+ UINT8 Pm1ControlLength; /* Byte Length of ports at Pm1xControlBlock */
+ UINT8 Pm2ControlLength; /* Byte Length of ports at Pm2ControlBlock */
+ UINT8 PmTimerLength; /* Byte Length of ports at PmTimerBlock */
+ UINT8 Gpe0BlockLength; /* Byte Length of ports at Gpe0Block */
+ UINT8 Gpe1BlockLength; /* Byte Length of ports at Gpe1Block */
+ UINT8 Gpe1Base; /* Offset in GPE number space where GPE1 events start */
+ UINT8 CstControl; /* Support for the _CST object and C States change notification */
+ UINT16 C2Latency; /* Worst case HW latency to enter/exit C2 state */
+ 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 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 */
+ 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 */
+ UINT8 ResetValue; /* Value to write to the ResetRegister port to reset the system */
+ UINT8 Reserved4[3]; /* Reserved, must be zero */
+ UINT64 XFacs; /* 64-bit physical address of FACS */
+ UINT64 XDsdt; /* 64-bit physical address of DSDT */
+ ACPI_GENERIC_ADDRESS XPm1aEventBlock; /* 64-bit Extended Power Mgt 1a Event Reg Blk address */
+ ACPI_GENERIC_ADDRESS XPm1bEventBlock; /* 64-bit Extended Power Mgt 1b Event Reg Blk address */
+ ACPI_GENERIC_ADDRESS XPm1aControlBlock; /* 64-bit Extended Power Mgt 1a Control Reg Blk address */
+ ACPI_GENERIC_ADDRESS XPm1bControlBlock; /* 64-bit Extended Power Mgt 1b Control Reg Blk address */
+ ACPI_GENERIC_ADDRESS XPm2ControlBlock; /* 64-bit Extended Power Mgt 2 Control Reg Blk address */
+ ACPI_GENERIC_ADDRESS XPmTimerBlock; /* 64-bit Extended Power Mgt Timer Ctrl Reg Blk address */
+ ACPI_GENERIC_ADDRESS XGpe0Block; /* 64-bit Extended General Purpose Event 0 Reg Blk address */
+ ACPI_GENERIC_ADDRESS XGpe1Block; /* 64-bit Extended General Purpose Event 1 Reg Blk address */
+
+} ACPI_TABLE_FADT;
+
+
+/* FADT flags */
+
+#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) */
/*
- * ACPI Table information. We save the table address, length,
- * and type of memory allocation (mapped or allocated) for each
- * table for 1) when we exit, and 2) if a new table is installed
+ * FADT Prefered Power Management Profiles
*/
-#define ACPI_MEM_NOT_ALLOCATED 0
-#define ACPI_MEM_ALLOCATED 1
-#define ACPI_MEM_MAPPED 2
-
-/* Definitions for the Flags bitfield member of ACPI_TABLE_SUPPORT */
+enum AcpiPreferedPmProfiles
+{
+ PM_UNSPECIFIED = 0,
+ PM_DESKTOP = 1,
+ PM_MOBILE = 2,
+ PM_WORKSTATION = 3,
+ PM_ENTERPRISE_SERVER = 4,
+ PM_SOHO_SERVER = 5,
+ PM_APPLIANCE_PC = 6
+};
-#define ACPI_TABLE_SINGLE 0x00
-#define ACPI_TABLE_MULTIPLE 0x01
-#define ACPI_TABLE_EXECUTABLE 0x02
-#define ACPI_TABLE_ROOT 0x00
-#define ACPI_TABLE_PRIMARY 0x10
-#define ACPI_TABLE_SECONDARY 0x20
-#define ACPI_TABLE_ALL 0x30
-#define ACPI_TABLE_TYPE_MASK 0x30
+/* FADT Boot Arch Flags */
-/* Data about each known table type */
+#define BAF_LEGACY_DEVICES 0x0001
+#define BAF_8042_KEYBOARD_CONTROLLER 0x0002
-typedef struct acpi_table_support
-{
- char *Name;
- char *Signature;
- void **GlobalPtr;
- UINT8 SigLength;
- UINT8 Flags;
+#define FADT2_REVISION_ID 3
+#define FADT2_MINUS_REVISION_ID 2
-} ACPI_TABLE_SUPPORT;
+/* Reset to default packing */
-/*
- * Get the ACPI version-specific tables
- */
-#include <contrib/dev/acpica/actbl1.h> /* Acpi 1.0 table definitions */
-#include <contrib/dev/acpica/actbl2.h> /* Acpi 2.0 table definitions */
-
+#pragma pack()
-#pragma pack(1)
/*
- * High performance timer
+ * Get the remaining ACPI tables
*/
-typedef struct hpet_table
-{
- ACPI_TABLE_HEADER_DEF
- UINT32 HardwareId;
- ACPI_GENERIC_ADDRESS BaseAddress;
- UINT8 HpetNumber;
- UINT16 ClockTick;
- UINT8 Attributes;
+#include <contrib/dev/acpica/actbl1.h>
-} HPET_TABLE;
+/* Macros used to generate offsets to specific table fields */
-#pragma pack()
+#define ACPI_FADT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_FADT, f)
#endif /* __ACTBL_H__ */
diff --git a/sys/contrib/dev/acpica/actbl1.h b/sys/contrib/dev/acpica/actbl1.h
index 51ea92a..41e435b 100644
--- a/sys/contrib/dev/acpica/actbl1.h
+++ b/sys/contrib/dev/acpica/actbl1.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
- * Name: actbl1.h - ACPI 1.0 tables
- * $Revision: 1.32 $
+ * Name: actbl1.h - Additional ACPI table definitions
+ * $Revision: 1.47 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -117,102 +117,801 @@
#ifndef __ACTBL1_H__
#define __ACTBL1_H__
+
+/*******************************************************************************
+ *
+ * Additional ACPI Tables
+ *
+ * These tables are not consumed directly by the ACPICA subsystem, but are
+ * included here to support device drivers and the AML disassembler.
+ *
+ ******************************************************************************/
+
+
+/*
+ * Values for description table header signatures. Useful because they make
+ * it more difficult to inadvertently type in the wrong signature.
+ */
+#define ACPI_SIG_ASF "ASF!" /* Alert Standard Format table */
+#define ACPI_SIG_BOOT "BOOT" /* Simple Boot Flag Table */
+#define ACPI_SIG_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_HPET "HPET" /* High Precision Event Timer 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_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_WDRT "WDRT" /* Watchdog Resource Table */
+
+
+/*
+ * All tables must be byte-packed to match the ACPI specification, since
+ * the tables are provided by the system BIOS.
+ */
#pragma pack(1)
/*
- * ACPI 1.0 Root System Description Table (RSDT)
+ * Note about bitfields: The UINT8 type is used for bitfields in ACPI tables.
+ * This is the only type that is even remotely portable. Anything else is not
+ * portable, so do not use any other bitfield types.
*/
-typedef struct rsdt_descriptor_rev1
+
+
+/* Common Sub-table header (used in MADT, SRAT, etc.) */
+
+typedef struct acpi_subtable_header
{
- ACPI_TABLE_HEADER_DEF /* ACPI common table header */
- UINT32 TableOffsetEntry[1]; /* Array of pointers to ACPI tables */
+ UINT8 Type;
+ UINT8 Length;
-} RSDT_DESCRIPTOR_REV1;
+} ACPI_SUBTABLE_HEADER;
+/*******************************************************************************
+ *
+ * ASF - Alert Standard Format table (Signature "ASF!")
+ *
+ * Conforms to the Alert Standard Format Specification V2.0, 23 April 2003
+ *
+ ******************************************************************************/
+
+typedef struct acpi_table_asf
+{
+ ACPI_TABLE_HEADER Header; /* Common ACPI table header */
+
+} ACPI_TABLE_ASF;
+
+
+/* ASF subtable header */
+
+typedef struct acpi_asf_header
+{
+ UINT8 Type;
+ UINT8 Reserved;
+ UINT16 Length;
+
+} ACPI_ASF_HEADER;
+
+
+/* Values for Type field above */
+
+enum AcpiAsfType
+{
+ ACPI_ASF_TYPE_INFO = 0,
+ ACPI_ASF_TYPE_ALERT = 1,
+ ACPI_ASF_TYPE_CONTROL = 2,
+ ACPI_ASF_TYPE_BOOT = 3,
+ ACPI_ASF_TYPE_ADDRESS = 4,
+ ACPI_ASF_TYPE_RESERVED = 5
+};
+
/*
- * ACPI 1.0 Firmware ACPI Control Structure (FACS)
+ * ASF subtables
*/
-typedef struct facs_descriptor_rev1
+
+/* 0: ASF Information */
+
+typedef struct acpi_asf_info
+{
+ ACPI_ASF_HEADER Header;
+ UINT8 MinResetValue;
+ UINT8 MinPollInterval;
+ UINT16 SystemId;
+ UINT32 MfgId;
+ UINT8 Flags;
+ UINT8 Reserved2[3];
+
+} ACPI_ASF_INFO;
+
+/* 1: ASF Alerts */
+
+typedef struct acpi_asf_alert
+{
+ ACPI_ASF_HEADER Header;
+ UINT8 AssertMask;
+ UINT8 DeassertMask;
+ UINT8 Alerts;
+ UINT8 DataLength;
+
+} ACPI_ASF_ALERT;
+
+typedef struct acpi_asf_alert_data
+{
+ UINT8 Address;
+ UINT8 Command;
+ UINT8 Mask;
+ UINT8 Value;
+ UINT8 SensorType;
+ UINT8 Type;
+ UINT8 Offset;
+ UINT8 SourceType;
+ UINT8 Severity;
+ UINT8 SensorNumber;
+ UINT8 Entity;
+ UINT8 Instance;
+
+} ACPI_ASF_ALERT_DATA;
+
+/* 2: ASF Remote Control */
+
+typedef struct acpi_asf_remote
+{
+ ACPI_ASF_HEADER Header;
+ UINT8 Controls;
+ UINT8 DataLength;
+ UINT16 Reserved2;
+
+} ACPI_ASF_REMOTE;
+
+typedef struct acpi_asf_control_data
+{
+ UINT8 Function;
+ UINT8 Address;
+ UINT8 Command;
+ UINT8 Value;
+
+} ACPI_ASF_CONTROL_DATA;
+
+/* 3: ASF RMCP Boot Options */
+
+typedef struct acpi_asf_rmcp
+{
+ ACPI_ASF_HEADER Header;
+ UINT8 Capabilities[7];
+ UINT8 CompletionCode;
+ UINT32 EnterpriseId;
+ UINT8 Command;
+ UINT16 Parameter;
+ UINT16 BootOptions;
+ UINT16 OemParameters;
+
+} ACPI_ASF_RMCP;
+
+/* 4: ASF Address */
+
+typedef struct acpi_asf_address
+{
+ ACPI_ASF_HEADER Header;
+ UINT8 EpromAddress;
+ UINT8 Devices;
+
+} ACPI_ASF_ADDRESS;
+
+
+/*******************************************************************************
+ *
+ * BOOT - Simple Boot Flag Table
+ *
+ ******************************************************************************/
+
+typedef struct acpi_table_boot
+{
+ ACPI_TABLE_HEADER Header; /* Common ACPI table header */
+ UINT8 CmosIndex; /* Index in CMOS RAM for the boot register */
+ UINT8 Reserved[3];
+
+} ACPI_TABLE_BOOT;
+
+
+/*******************************************************************************
+ *
+ * CPEP - Corrected Platform Error Polling table
+ *
+ ******************************************************************************/
+
+typedef struct acpi_table_cpep
+{
+ ACPI_TABLE_HEADER Header; /* Common ACPI table header */
+ UINT64 Reserved;
+
+} ACPI_TABLE_CPEP;
+
+
+/* Subtable */
+
+typedef struct acpi_cpep_polling
+{
+ UINT8 Type;
+ UINT8 Length;
+ UINT8 Id; /* Processor ID */
+ UINT8 Eid; /* Processor EID */
+ UINT32 Interval; /* Polling interval (msec) */
+
+} ACPI_CPEP_POLLING;
+
+
+/*******************************************************************************
+ *
+ * DBGP - Debug Port table
+ *
+ ******************************************************************************/
+
+typedef struct acpi_table_dbgp
{
- char Signature[4]; /* ASCII table signature */
- UINT32 Length; /* Length of structure in bytes */
- UINT32 HardwareSignature; /* Hardware configuration signature */
- UINT32 FirmwareWakingVector; /* ACPI OS waking vector */
- UINT32 GlobalLock; /* Global Lock */
+ ACPI_TABLE_HEADER Header; /* Common ACPI table header */
+ UINT8 Type; /* 0=full 16550, 1=subset of 16550 */
+ UINT8 Reserved[3];
+ ACPI_GENERIC_ADDRESS DebugPort;
- /* Flags (32 bits) */
+} ACPI_TABLE_DBGP;
- UINT8_BIT S4Bios_f : 1; /* 00: S4BIOS support is present */
- UINT8_BIT : 7; /* 01-07: Reserved, must be zero */
- UINT8 Reserved1[3]; /* 08-31: Reserved, must be zero */
- UINT8 Reserved2[40]; /* Reserved, must be zero */
+/*******************************************************************************
+ *
+ * DMAR - DMA Remapping table
+ *
+ ******************************************************************************/
-} FACS_DESCRIPTOR_REV1;
+typedef struct acpi_table_dmar
+{
+ ACPI_TABLE_HEADER Header; /* Common ACPI table header */
+ UINT8 Width; /* Host Address Width */
+ UINT8 Reserved[11];
+
+} ACPI_TABLE_DMAR;
+
+/* DMAR subtable header */
+
+typedef struct acpi_dmar_header
+{
+ UINT16 Type;
+ UINT16 Length;
+ UINT8 Flags;
+ UINT8 Reserved[3];
+
+} ACPI_DMAR_HEADER;
+
+/* Values for subtable type in ACPI_DMAR_HEADER */
+
+enum AcpiDmarType
+{
+ ACPI_DMAR_TYPE_HARDWARE_UNIT = 0,
+ ACPI_DMAR_TYPE_RESERVED_MEMORY = 1,
+ ACPI_DMAR_TYPE_RESERVED = 2 /* 2 and greater are reserved */
+};
+
+typedef struct acpi_dmar_device_scope
+{
+ UINT8 EntryType;
+ UINT8 Length;
+ UINT8 Segment;
+ UINT8 Bus;
+
+} ACPI_DMAR_DEVICE_SCOPE;
+
+/* Values for EntryType in ACPI_DMAR_DEVICE_SCOPE */
+
+enum AcpiDmarScopeType
+{
+ ACPI_DMAR_SCOPE_TYPE_NOT_USED = 0,
+ ACPI_DMAR_SCOPE_TYPE_ENDPOINT = 1,
+ ACPI_DMAR_SCOPE_TYPE_BRIDGE = 2,
+ ACPI_DMAR_SCOPE_TYPE_RESERVED = 3 /* 3 and greater are reserved */
+};
/*
- * ACPI 1.0 Fixed ACPI Description Table (FADT)
+ * DMAR Sub-tables, correspond to Type in ACPI_DMAR_HEADER
*/
-typedef struct fadt_descriptor_rev1
-{
- ACPI_TABLE_HEADER_DEF /* ACPI common table header */
- UINT32 FirmwareCtrl; /* Physical address of FACS */
- UINT32 Dsdt; /* Physical address of DSDT */
- UINT8 Model; /* System Interrupt Model */
- UINT8 Reserved1; /* Reserved, must be zero */
- UINT16 SciInt; /* System vector of SCI interrupt */
- UINT32 SmiCmd; /* Port address of SMI command port */
- UINT8 AcpiEnable; /* Value to write to smi_cmd to enable ACPI */
- UINT8 AcpiDisable; /* Value to write to smi_cmd to disable ACPI */
- UINT8 S4BiosReq; /* Value to write to SMI CMD to enter S4BIOS state */
- UINT8 Reserved2; /* Reserved, must be zero */
- UINT32 Pm1aEvtBlk; /* Port address of Power Mgt 1a AcpiEvent Reg Blk */
- UINT32 Pm1bEvtBlk; /* Port address of Power Mgt 1b AcpiEvent Reg Blk */
- UINT32 Pm1aCntBlk; /* Port address of Power Mgt 1a Control Reg Blk */
- UINT32 Pm1bCntBlk; /* Port address of Power Mgt 1b Control Reg Blk */
- UINT32 Pm2CntBlk; /* Port address of Power Mgt 2 Control Reg Blk */
- UINT32 PmTmrBlk; /* Port address of Power Mgt Timer Ctrl Reg Blk */
- UINT32 Gpe0Blk; /* Port addr of General Purpose AcpiEvent 0 Reg Blk */
- UINT32 Gpe1Blk; /* Port addr of General Purpose AcpiEvent 1 Reg Blk */
- UINT8 Pm1EvtLen; /* Byte Length of ports at pm1X_evt_blk */
- UINT8 Pm1CntLen; /* Byte Length of ports at pm1X_cnt_blk */
- UINT8 Pm2CntLen; /* Byte Length of ports at pm2_cnt_blk */
- UINT8 PmTmLen; /* Byte Length of ports at pm_tm_blk */
- UINT8 Gpe0BlkLen; /* Byte Length of ports at gpe0_blk */
- UINT8 Gpe1BlkLen; /* Byte Length of ports at gpe1_blk */
- UINT8 Gpe1Base; /* Offset in gpe model where gpe1 events start */
- UINT8 Reserved3; /* Reserved, must be zero */
- UINT16 Plvl2Lat; /* Worst case HW latency to enter/exit C2 state */
- UINT16 Plvl3Lat; /* Worst case HW latency to enter/exit C3 state */
- UINT16 FlushSize; /* Size of area read to flush caches */
- UINT16 FlushStride; /* Stride used in flushing caches */
- UINT8 DutyOffset; /* Bit location of duty cycle field in p_cnt reg */
- UINT8 DutyWidth; /* Bit width of duty cycle field in p_cnt reg */
- UINT8 DayAlrm; /* Index to day-of-month alarm in RTC CMOS RAM */
- UINT8 MonAlrm; /* Index to month-of-year alarm in RTC CMOS RAM */
- UINT8 Century; /* Index to century in RTC CMOS RAM */
- UINT8 Reserved4[3]; /* Reserved, must be zero */
-
- /* Flags (32 bits) */
-
- UINT8_BIT WbInvd : 1; /* 00: The wbinvd instruction works properly */
- UINT8_BIT WbInvdFlush : 1; /* 01: The wbinvd flushes but does not invalidate */
- UINT8_BIT ProcC1 : 1; /* 02: All processors support C1 state */
- UINT8_BIT Plvl2Up : 1; /* 03: C2 state works on MP system */
- UINT8_BIT PwrButton : 1; /* 04: Power button is handled as a generic feature */
- UINT8_BIT SleepButton : 1; /* 05: Sleep button is handled as a generic feature, or not present */
- UINT8_BIT FixedRTC : 1; /* 06: RTC wakeup stat not in fixed register space */
- UINT8_BIT Rtcs4 : 1; /* 07: RTC wakeup stat not possible from S4 */
- UINT8_BIT TmrValExt : 1; /* 08: tmr_val width is 32 bits (0 = 24 bits) */
- UINT8_BIT : 7; /* 09-15: Reserved, must be zero */
- UINT8 Reserved5[2]; /* 16-31: Reserved, must be zero */
-
-} FADT_DESCRIPTOR_REV1;
-#pragma pack()
+/* 0: Hardware Unit Definition */
-#endif /* __ACTBL1_H__ */
+typedef struct acpi_dmar_hardware_unit
+{
+ ACPI_DMAR_HEADER Header;
+ UINT64 Address; /* Register Base Address */
+
+} ACPI_DMAR_HARDWARE_UNIT;
+
+/* Flags */
+
+#define ACPI_DMAR_INCLUDE_ALL (1)
+
+/* 1: Reserved Memory Defininition */
+
+typedef struct acpi_dmar_reserved_memory
+{
+ ACPI_DMAR_HEADER Header;
+ UINT64 Address; /* 4K aligned base address */
+ UINT64 EndAddress; /* 4K aligned limit address */
+
+} ACPI_DMAR_RESERVED_MEMORY;
+
+/* Flags */
+
+#define ACPI_DMAR_ALLOW_ALL (1)
+
+
+/*******************************************************************************
+ *
+ * ECDT - Embedded Controller Boot Resources Table
+ *
+ ******************************************************************************/
+
+typedef struct acpi_table_ecdt
+{
+ ACPI_TABLE_HEADER Header; /* Common ACPI table header */
+ ACPI_GENERIC_ADDRESS Control; /* Address of EC command/status register */
+ ACPI_GENERIC_ADDRESS Data; /* Address of EC data register */
+ UINT32 Uid; /* Unique ID - must be same as the EC _UID method */
+ UINT8 Gpe; /* The GPE for the EC */
+ UINT8 Id[1]; /* Full namepath of the EC in the ACPI namespace */
+
+} ACPI_TABLE_ECDT;
+
+
+/*******************************************************************************
+ *
+ * HPET - High Precision Event Timer table
+ *
+ ******************************************************************************/
+
+typedef struct acpi_table_hpet
+{
+ ACPI_TABLE_HEADER Header; /* Common ACPI table header */
+ UINT32 Id; /* Hardware ID of event timer block */
+ ACPI_GENERIC_ADDRESS Address; /* Address of event timer block */
+ UINT8 Sequence; /* HPET sequence number */
+ UINT16 MinimumTick; /* Main counter min tick, periodic mode */
+ UINT8 Flags;
+
+} ACPI_TABLE_HPET;
+
+/*! Flags */
+
+#define ACPI_HPET_PAGE_PROTECT (1) /* 00: No page protection */
+#define ACPI_HPET_PAGE_PROTECT_4 (1<<1) /* 01: 4KB page protected */
+#define ACPI_HPET_PAGE_PROTECT_64 (1<<2) /* 02: 64KB page protected */
+
+/*! [End] no source code translation !*/
+
+
+/*******************************************************************************
+ *
+ * MADT - Multiple APIC Description Table
+ *
+ ******************************************************************************/
+
+typedef struct acpi_table_madt
+{
+ ACPI_TABLE_HEADER Header; /* Common ACPI table header */
+ UINT32 Address; /* Physical address of local APIC */
+ UINT32 Flags;
+
+} ACPI_TABLE_MADT;
+
+/* Flags */
+
+#define ACPI_MADT_PCAT_COMPAT (1) /* 00: System also has dual 8259s */
+
+/* Values for PCATCompat flag */
+
+#define ACPI_MADT_DUAL_PIC 0
+#define ACPI_MADT_MULTIPLE_APIC 1
+
+
+/* Values for subtable type in ACPI_SUBTABLE_HEADER */
+enum AcpiMadtType
+{
+ ACPI_MADT_TYPE_LOCAL_APIC = 0,
+ ACPI_MADT_TYPE_IO_APIC = 1,
+ ACPI_MADT_TYPE_INTERRUPT_OVERRIDE = 2,
+ ACPI_MADT_TYPE_NMI_SOURCE = 3,
+ ACPI_MADT_TYPE_LOCAL_APIC_NMI = 4,
+ ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE = 5,
+ 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 */
+};
+
+
+/*
+ * MADT Sub-tables, correspond to Type in ACPI_SUBTABLE_HEADER
+ */
+
+/* 0: Processor Local APIC */
+
+typedef struct acpi_madt_local_apic
+{
+ ACPI_SUBTABLE_HEADER Header;
+ UINT8 ProcessorId; /* ACPI processor id */
+ UINT8 Id; /* Processor's local APIC id */
+ UINT32 LapicFlags;
+
+} ACPI_MADT_LOCAL_APIC;
+
+/* 1: IO APIC */
+
+typedef struct acpi_madt_io_apic
+{
+ ACPI_SUBTABLE_HEADER Header;
+ UINT8 Id; /* I/O APIC ID */
+ UINT8 Reserved; /* Reserved - must be zero */
+ UINT32 Address; /* APIC physical address */
+ UINT32 GlobalIrqBase; /* Global system interrupt where INTI lines start */
+
+} ACPI_MADT_IO_APIC;
+
+/* 2: Interrupt Override */
+
+typedef struct acpi_madt_interrupt_override
+{
+ ACPI_SUBTABLE_HEADER Header;
+ UINT8 Bus; /* 0 - ISA */
+ UINT8 SourceIrq; /* Interrupt source (IRQ) */
+ UINT32 GlobalIrq; /* Global system interrupt */
+ UINT16 IntiFlags;
+
+} ACPI_MADT_INTERRUPT_OVERRIDE;
+
+/* 3: NMI Source */
+
+typedef struct acpi_madt_nmi_source
+{
+ ACPI_SUBTABLE_HEADER Header;
+ UINT16 IntiFlags;
+ UINT32 GlobalIrq; /* Global system interrupt */
+
+} ACPI_MADT_NMI_SOURCE;
+
+/* 4: Local APIC NMI */
+
+typedef struct acpi_madt_local_apic_nmi
+{
+ ACPI_SUBTABLE_HEADER Header;
+ UINT8 ProcessorId; /* ACPI processor id */
+ UINT16 IntiFlags;
+ UINT8 Lint; /* LINTn to which NMI is connected */
+
+} ACPI_MADT_LOCAL_APIC_NMI;
+
+/* 5: Address Override */
+
+typedef struct acpi_madt_local_apic_override
+{
+ ACPI_SUBTABLE_HEADER Header;
+ UINT16 Reserved; /* Reserved, must be zero */
+ UINT64 Address; /* APIC physical address */
+
+} ACPI_MADT_LOCAL_APIC_OVERRIDE;
+
+/* 6: I/O Sapic */
+
+typedef struct acpi_madt_io_sapic
+{
+ ACPI_SUBTABLE_HEADER Header;
+ UINT8 Id; /* I/O SAPIC ID */
+ UINT8 Reserved; /* Reserved, must be zero */
+ UINT32 GlobalIrqBase; /* Global interrupt for SAPIC start */
+ UINT64 Address; /* SAPIC physical address */
+
+} ACPI_MADT_IO_SAPIC;
+
+/* 7: Local Sapic */
+
+typedef struct acpi_madt_local_sapic
+{
+ ACPI_SUBTABLE_HEADER Header;
+ UINT8 ProcessorId; /* ACPI processor id */
+ UINT8 Id; /* SAPIC ID */
+ UINT8 Eid; /* SAPIC EID */
+ UINT8 Reserved[3]; /* Reserved, must be zero */
+ UINT32 LapicFlags;
+ UINT32 Uid; /* Numeric UID - ACPI 3.0 */
+ char UidString[1]; /* String UID - ACPI 3.0 */
+
+} ACPI_MADT_LOCAL_SAPIC;
+
+/* 8: Platform Interrupt Source */
+
+typedef struct acpi_madt_interrupt_source
+{
+ ACPI_SUBTABLE_HEADER Header;
+ UINT16 IntiFlags;
+ UINT8 Type; /* 1=PMI, 2=INIT, 3=corrected */
+ UINT8 Id; /* Processor ID */
+ UINT8 Eid; /* Processor EID */
+ UINT8 IoSapicVector; /* Vector value for PMI interrupts */
+ UINT32 GlobalIrq; /* Global system interrupt */
+ UINT32 Flags; /* Interrupt Source Flags */
+
+} ACPI_MADT_INTERRUPT_SOURCE;
+
+/* Flags field above */
+
+#define ACPI_MADT_CPEI_OVERRIDE (1)
+
+
+/*
+ * Common flags fields for MADT subtables
+ */
+
+/* MADT Local APIC flags (LapicFlags) */
+
+#define ACPI_MADT_ENABLED (1) /* 00: Processor is usable if set */
+
+/* MADT MPS INTI flags (IntiFlags) */
+
+#define ACPI_MADT_POLARITY_MASK (3) /* 00-01: Polarity of APIC I/O input signals */
+#define ACPI_MADT_TRIGGER_MASK (3<<2) /* 02-03: Trigger mode of APIC input signals */
+
+/* Values for MPS INTI flags */
+
+#define ACPI_MADT_POLARITY_CONFORMS 0
+#define ACPI_MADT_POLARITY_ACTIVE_HIGH 1
+#define ACPI_MADT_POLARITY_RESERVED 2
+#define ACPI_MADT_POLARITY_ACTIVE_LOW 3
+
+#define ACPI_MADT_TRIGGER_CONFORMS (0)
+#define ACPI_MADT_TRIGGER_EDGE (1<<2)
+#define ACPI_MADT_TRIGGER_RESERVED (2<<2)
+#define ACPI_MADT_TRIGGER_LEVEL (3<<2)
+
+
+/*******************************************************************************
+ *
+ * MCFG - PCI Memory Mapped Configuration table and sub-table
+ *
+ ******************************************************************************/
+
+typedef struct acpi_table_mcfg
+{
+ ACPI_TABLE_HEADER Header; /* Common ACPI table header */
+ UINT8 Reserved[8];
+
+} ACPI_TABLE_MCFG;
+
+
+/* Subtable */
+
+typedef struct acpi_mcfg_allocation
+{
+ UINT64 Address; /* Base address, processor-relative */
+ UINT16 PciSegment; /* PCI segment group number */
+ UINT8 StartBusNumber; /* Starting PCI Bus number */
+ UINT8 EndBusNumber; /* Final PCI Bus number */
+ UINT32 Reserved;
+
+} ACPI_MCFG_ALLOCATION;
+
+
+/*******************************************************************************
+ *
+ * SBST - Smart Battery Specification Table
+ *
+ ******************************************************************************/
+typedef struct acpi_table_sbst
+{
+ ACPI_TABLE_HEADER Header; /* Common ACPI table header */
+ UINT32 WarningLevel;
+ UINT32 LowLevel;
+ UINT32 CriticalLevel;
+
+} ACPI_TABLE_SBST;
+
+
+/*******************************************************************************
+ *
+ * SLIT - System Locality Distance Information Table
+ *
+ ******************************************************************************/
+
+typedef struct acpi_table_slit
+{
+ ACPI_TABLE_HEADER Header; /* Common ACPI table header */
+ UINT64 LocalityCount;
+ UINT8 Entry[1]; /* Real size = localities^2 */
+
+} ACPI_TABLE_SLIT;
+
+
+/*******************************************************************************
+ *
+ * SPCR - Serial Port Console Redirection table
+ *
+ ******************************************************************************/
+
+typedef struct acpi_table_spcr
+{
+ ACPI_TABLE_HEADER Header; /* Common ACPI table header */
+ UINT8 InterfaceType; /* 0=full 16550, 1=subset of 16550 */
+ UINT8 Reserved[3];
+ ACPI_GENERIC_ADDRESS SerialPort;
+ UINT8 InterruptType;
+ UINT8 PcInterrupt;
+ UINT32 Interrupt;
+ UINT8 BaudRate;
+ UINT8 Parity;
+ UINT8 StopBits;
+ UINT8 FlowControl;
+ UINT8 TerminalType;
+ UINT8 Reserved1;
+ UINT16 PciDeviceId;
+ UINT16 PciVendorId;
+ UINT8 PciBus;
+ UINT8 PciDevice;
+ UINT8 PciFunction;
+ UINT32 PciFlags;
+ UINT8 PciSegment;
+ UINT32 Reserved2;
+
+} ACPI_TABLE_SPCR;
+
+
+/*******************************************************************************
+ *
+ * SPMI - Server Platform Management Interface table
+ *
+ ******************************************************************************/
+
+typedef struct acpi_table_spmi
+{
+ ACPI_TABLE_HEADER Header; /* Common ACPI table header */
+ UINT8 Reserved;
+ UINT8 InterfaceType;
+ UINT16 SpecRevision; /* Version of IPMI */
+ UINT8 InterruptType;
+ UINT8 GpeNumber; /* GPE assigned */
+ UINT8 Reserved1;
+ UINT8 PciDeviceFlag;
+ UINT32 Interrupt;
+ ACPI_GENERIC_ADDRESS IpmiRegister;
+ UINT8 PciSegment;
+ UINT8 PciBus;
+ UINT8 PciDevice;
+ UINT8 PciFunction;
+
+} ACPI_TABLE_SPMI;
+
+
+/*******************************************************************************
+ *
+ * SRAT - System Resource Affinity Table
+ *
+ ******************************************************************************/
+
+typedef struct acpi_table_srat
+{
+ ACPI_TABLE_HEADER Header; /* Common ACPI table header */
+ UINT32 TableRevision; /* Must be value '1' */
+ UINT64 Reserved; /* Reserved, must be zero */
+
+} ACPI_TABLE_SRAT;
+
+/* Values for subtable type in ACPI_SUBTABLE_HEADER */
+
+enum AcpiSratType
+{
+ ACPI_SRAT_TYPE_CPU_AFFINITY = 0,
+ ACPI_SRAT_TYPE_MEMORY_AFFINITY = 1,
+ ACPI_SRAT_TYPE_RESERVED = 2
+};
+
+/* SRAT sub-tables */
+
+typedef struct acpi_srat_cpu_affinity
+{
+ ACPI_SUBTABLE_HEADER Header;
+ UINT8 ProximityDomainLo;
+ UINT8 ApicId;
+ UINT32 Flags;
+ UINT8 LocalSapicEid;
+ UINT8 ProximityDomainHi[3];
+ UINT32 Reserved; /* Reserved, must be zero */
+
+} ACPI_SRAT_CPU_AFFINITY;
+
+/* Flags */
+
+#define ACPI_SRAT_CPU_ENABLED (1) /* 00: Use affinity structure */
+
+
+typedef struct acpi_srat_mem_affinity
+{
+ ACPI_SUBTABLE_HEADER Header;
+ UINT32 ProximityDomain;
+ UINT16 Reserved; /* Reserved, must be zero */
+ UINT64 BaseAddress;
+ UINT64 Length;
+ UINT32 MemoryType; /* See acpi_address_range_id */
+ UINT32 Flags;
+ UINT64 Reserved1; /* Reserved, must be zero */
+
+} ACPI_SRAT_MEM_AFFINITY;
+
+/* Flags */
+
+#define ACPI_SRAT_MEM_ENABLED (1) /* 00: Use affinity structure */
+#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 */
+
+enum acpi_address_range_id
+{
+ 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
+};
+
+
+/*******************************************************************************
+ *
+ * TCPA - Trusted Computing Platform Alliance table
+ *
+ ******************************************************************************/
+
+typedef struct acpi_table_tcpa
+{
+ ACPI_TABLE_HEADER Header; /* Common ACPI table header */
+ UINT16 Reserved;
+ UINT32 MaxLogLength; /* Maximum length for the event log area */
+ UINT64 LogAddress; /* Address of the event log area */
+
+} ACPI_TABLE_TCPA;
+
+
+/*******************************************************************************
+ *
+ * WDRT - Watchdog Resource Table
+ *
+ ******************************************************************************/
+
+typedef struct acpi_table_wdrt
+{
+ ACPI_TABLE_HEADER Header; /* Common ACPI table header */
+ UINT32 HeaderLength; /* Watchdog Header Length */
+ UINT8 PciSegment; /* PCI Segment number */
+ UINT8 PciBus; /* PCI Bus number */
+ UINT8 PciDevice; /* PCI Device number */
+ UINT8 PciFunction; /* PCI Function number */
+ UINT32 TimerPeriod; /* Period of one timer count (msec) */
+ UINT32 MaxCount; /* Maximum counter value supported */
+ UINT32 MinCount; /* Minimum counter value */
+ UINT8 Flags;
+ UINT8 Reserved[3];
+ UINT32 Entries; /* Number of watchdog entries that follow */
+
+} ACPI_TABLE_WDRT;
+
+/* Flags */
+
+#define ACPI_WDRT_TIMER_ENABLED (1) /* 00: Timer enabled */
+
+
+/* Reset to default packing */
+
+#pragma pack()
+
+#endif /* __ACTBL1_H__ */
diff --git a/sys/contrib/dev/acpica/actbl2.h b/sys/contrib/dev/acpica/actbl2.h
index 4b65d26..97979c6 100644
--- a/sys/contrib/dev/acpica/actbl2.h
+++ b/sys/contrib/dev/acpica/actbl2.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: actbl2.h - ACPI Specification Revision 2.0 Tables
- * $Revision: 1.45 $
+ * $Revision: 1.51 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -117,272 +117,7 @@
#ifndef __ACTBL2_H__
#define __ACTBL2_H__
-/*
- * Prefered Power Management Profiles
- */
-#define PM_UNSPECIFIED 0
-#define PM_DESKTOP 1
-#define PM_MOBILE 2
-#define PM_WORKSTATION 3
-#define PM_ENTERPRISE_SERVER 4
-#define PM_SOHO_SERVER 5
-#define PM_APPLIANCE_PC 6
-
-/*
- * ACPI Boot Arch Flags
- */
-#define BAF_LEGACY_DEVICES 0x0001
-#define BAF_8042_KEYBOARD_CONTROLLER 0x0002
-
-#define FADT2_REVISION_ID 3
-#define FADT2_MINUS_REVISION_ID 2
-
-
-#pragma pack(1)
-
-/*
- * ACPI 2.0 Root System Description Table (RSDT)
- */
-typedef struct rsdt_descriptor_rev2
-{
- ACPI_TABLE_HEADER_DEF /* ACPI common table header */
- UINT32 TableOffsetEntry[1]; /* Array of pointers to ACPI tables */
-
-} RSDT_DESCRIPTOR_REV2;
-
-
-/*
- * ACPI 2.0 Extended System Description Table (XSDT)
- */
-typedef struct xsdt_descriptor_rev2
-{
- ACPI_TABLE_HEADER_DEF /* ACPI common table header */
- UINT64 TableOffsetEntry[1]; /* Array of pointers to ACPI tables */
-
-} XSDT_DESCRIPTOR_REV2;
-
-
-/*
- * ACPI 2.0 Firmware ACPI Control Structure (FACS)
- */
-typedef struct facs_descriptor_rev2
-{
- char Signature[4]; /* ASCII table signature */
- UINT32 Length; /* Length of structure, in bytes */
- UINT32 HardwareSignature; /* Hardware configuration signature */
- UINT32 FirmwareWakingVector; /* 32-bit physical address of the Firmware Waking Vector. */
- UINT32 GlobalLock; /* Global Lock used to synchronize access to shared hardware resources */
-
- /* Flags (32 bits) */
-
- UINT8_BIT S4Bios_f : 1; /* 00: S4BIOS support is present */
- UINT8_BIT : 7; /* 01-07: Reserved, must be zero */
- UINT8 Reserved1[3]; /* 08-31: Reserved, must be zero */
-
- UINT64 XFirmwareWakingVector; /* 64-bit physical address of the Firmware Waking Vector. */
- UINT8 Version; /* Version of this table */
- UINT8 Reserved3[31]; /* Reserved, must be zero */
-
-} FACS_DESCRIPTOR_REV2;
-
-
-/*
- * ACPI 2.0+ Generic Address Structure (GAS)
- */
-typedef struct acpi_generic_address
-{
- UINT8 AddressSpaceId; /* Address space where struct or register exists. */
- UINT8 RegisterBitWidth; /* Size in bits of given register */
- UINT8 RegisterBitOffset; /* Bit offset within the register */
- UINT8 AccessWidth; /* Minimum Access size (ACPI 3.0) */
- UINT64 Address; /* 64-bit address of struct or register */
-
-} ACPI_GENERIC_ADDRESS;
-
-
-#define FADT_REV2_COMMON \
- UINT32 V1_FirmwareCtrl; /* 32-bit physical address of FACS */ \
- UINT32 V1_Dsdt; /* 32-bit physical address of DSDT */ \
- UINT8 Reserved1; /* System Interrupt Model isn't used in ACPI 2.0*/ \
- UINT8 Prefer_PM_Profile; /* Conveys preferred power management profile to OSPM. */ \
- UINT16 SciInt; /* System vector of SCI interrupt */ \
- UINT32 SmiCmd; /* Port address of SMI command port */ \
- UINT8 AcpiEnable; /* Value to write to smi_cmd to enable ACPI */ \
- UINT8 AcpiDisable; /* Value to write to smi_cmd to disable ACPI */ \
- UINT8 S4BiosReq; /* Value to write to SMI CMD to enter S4BIOS state */ \
- UINT8 PstateCnt; /* Processor performance state control*/ \
- UINT32 V1_Pm1aEvtBlk; /* Port address of Power Mgt 1a AcpiEvent Reg Blk */ \
- UINT32 V1_Pm1bEvtBlk; /* Port address of Power Mgt 1b AcpiEvent Reg Blk */ \
- UINT32 V1_Pm1aCntBlk; /* Port address of Power Mgt 1a Control Reg Blk */ \
- UINT32 V1_Pm1bCntBlk; /* Port address of Power Mgt 1b Control Reg Blk */ \
- UINT32 V1_Pm2CntBlk; /* Port address of Power Mgt 2 Control Reg Blk */ \
- UINT32 V1_PmTmrBlk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ \
- UINT32 V1_Gpe0Blk; /* Port addr of General Purpose AcpiEvent 0 Reg Blk */ \
- UINT32 V1_Gpe1Blk; /* Port addr of General Purpose AcpiEvent 1 Reg Blk */ \
- UINT8 Pm1EvtLen; /* Byte Length of ports at pm1X_evt_blk */ \
- UINT8 Pm1CntLen; /* Byte Length of ports at pm1X_cnt_blk */ \
- UINT8 Pm2CntLen; /* Byte Length of ports at pm2_cnt_blk */ \
- UINT8 PmTmLen; /* Byte Length of ports at pm_tm_blk */ \
- UINT8 Gpe0BlkLen; /* Byte Length of ports at gpe0_blk */ \
- UINT8 Gpe1BlkLen; /* Byte Length of ports at gpe1_blk */ \
- UINT8 Gpe1Base; /* Offset in gpe model where gpe1 events start */ \
- UINT8 CstCnt; /* Support for the _CST object and C States change notification.*/ \
- UINT16 Plvl2Lat; /* Worst case HW latency to enter/exit C2 state */ \
- UINT16 Plvl3Lat; /* Worst case HW latency to enter/exit C3 state */ \
- UINT16 FlushSize; /* Number of flush strides that need to be read */ \
- UINT16 FlushStride; /* Processor's memory cache line width, in bytes */ \
- UINT8 DutyOffset; /* Processor's duty cycle index in processor's P_CNT reg*/ \
- UINT8 DutyWidth; /* Processor's duty cycle value bit width in P_CNT register.*/ \
- UINT8 DayAlrm; /* Index to day-of-month alarm in RTC CMOS RAM */ \
- UINT8 MonAlrm; /* Index to month-of-year alarm in RTC CMOS RAM */ \
- UINT8 Century; /* Index to century in RTC CMOS RAM */ \
- UINT16 IapcBootArch; /* IA-PC Boot Architecture Flags. See Table 5-10 for description*/
-
-/*
- * ACPI 2.0+ Fixed ACPI Description Table (FADT)
- */
-typedef struct fadt_descriptor_rev2
-{
- ACPI_TABLE_HEADER_DEF /* ACPI common table header */
- FADT_REV2_COMMON
- UINT8 Reserved2; /* Reserved, must be zero */
-
- /* Flags (32 bits) */
-
- UINT8_BIT WbInvd : 1; /* 00: The wbinvd instruction works properly */
- UINT8_BIT WbInvdFlush : 1; /* 01: The wbinvd flushes but does not invalidate */
- UINT8_BIT ProcC1 : 1; /* 02: All processors support C1 state */
- UINT8_BIT Plvl2Up : 1; /* 03: C2 state works on MP system */
- UINT8_BIT PwrButton : 1; /* 04: Power button is handled as a generic feature */
- UINT8_BIT SleepButton : 1; /* 05: Sleep button is handled as a generic feature, or not present */
- UINT8_BIT FixedRTC : 1; /* 06: RTC wakeup stat not in fixed register space */
- UINT8_BIT Rtcs4 : 1; /* 07: RTC wakeup stat not possible from S4 */
- UINT8_BIT TmrValExt : 1; /* 08: tmr_val is 32 bits 0=24-bits */
- UINT8_BIT DockCap : 1; /* 09: Docking supported */
- UINT8_BIT ResetRegSup : 1; /* 10: System reset via the FADT RESET_REG supported */
- UINT8_BIT SealedCase : 1; /* 11: No internal expansion capabilities and case is sealed */
- UINT8_BIT Headless : 1; /* 12: No local video capabilities or local input devices */
- UINT8_BIT CpuSwSleep : 1; /* 13: Must execute native instruction after writing SLP_TYPx register */
-
- UINT8_BIT PciExpWak : 1; /* 14: System supports PCIEXP_WAKE (STS/EN) bits (ACPI 3.0) */
- UINT8_BIT UsePlatformClock : 1; /* 15: OSPM should use platform-provided timer (ACPI 3.0) */
- UINT8_BIT S4RtcStsValid : 1; /* 16: Contents of RTC_STS valid after S4 wake (ACPI 3.0) */
- UINT8_BIT RemotePowerOnCapable : 1; /* 17: System is compatible with remote power on (ACPI 3.0) */
- UINT8_BIT ForceApicClusterModel : 1; /* 18: All local APICs must use cluster model (ACPI 3.0) */
- UINT8_BIT ForceApicPhysicalDestinationMode : 1; /* 19: All local xAPICs must use physical dest mode (ACPI 3.0) */
- UINT8_BIT : 4; /* 20-23: Reserved, must be zero */
- UINT8 Reserved3; /* 24-31: Reserved, must be zero */
-
- ACPI_GENERIC_ADDRESS ResetRegister; /* Reset register address in GAS format */
- UINT8 ResetValue; /* Value to write to the ResetRegister port to reset the system */
- UINT8 Reserved4[3]; /* These three bytes must be zero */
- UINT64 XFirmwareCtrl; /* 64-bit physical address of FACS */
- UINT64 XDsdt; /* 64-bit physical address of DSDT */
- ACPI_GENERIC_ADDRESS XPm1aEvtBlk; /* Extended Power Mgt 1a AcpiEvent Reg Blk address */
- ACPI_GENERIC_ADDRESS XPm1bEvtBlk; /* Extended Power Mgt 1b AcpiEvent Reg Blk address */
- ACPI_GENERIC_ADDRESS XPm1aCntBlk; /* Extended Power Mgt 1a Control Reg Blk address */
- ACPI_GENERIC_ADDRESS XPm1bCntBlk; /* Extended Power Mgt 1b Control Reg Blk address */
- ACPI_GENERIC_ADDRESS XPm2CntBlk; /* Extended Power Mgt 2 Control Reg Blk address */
- ACPI_GENERIC_ADDRESS XPmTmrBlk; /* Extended Power Mgt Timer Ctrl Reg Blk address */
- ACPI_GENERIC_ADDRESS XGpe0Blk; /* Extended General Purpose AcpiEvent 0 Reg Blk address */
- ACPI_GENERIC_ADDRESS XGpe1Blk; /* Extended General Purpose AcpiEvent 1 Reg Blk address */
-
-} FADT_DESCRIPTOR_REV2;
-
-
-/* "Down-revved" ACPI 2.0 FADT descriptor */
-
-typedef struct fadt_descriptor_rev2_minus
-{
- ACPI_TABLE_HEADER_DEF /* ACPI common table header */
- FADT_REV2_COMMON
- UINT8 Reserved2; /* Reserved, must be zero */
- UINT32 Flags;
- ACPI_GENERIC_ADDRESS ResetRegister; /* Reset register address in GAS format */
- UINT8 ResetValue; /* Value to write to the ResetRegister port to reset the system. */
- UINT8 Reserved7[3]; /* Reserved, must be zero */
-
-} FADT_DESCRIPTOR_REV2_MINUS;
-
-
-/* ECDT - Embedded Controller Boot Resources Table */
-
-typedef struct ec_boot_resources
-{
- ACPI_TABLE_HEADER_DEF
- ACPI_GENERIC_ADDRESS EcControl; /* Address of EC command/status register */
- ACPI_GENERIC_ADDRESS EcData; /* Address of EC data register */
- UINT32 Uid; /* Unique ID - must be same as the EC _UID method */
- UINT8 GpeBit; /* The GPE for the EC */
- UINT8 EcId[1]; /* Full namepath of the EC in the ACPI namespace */
-
-} EC_BOOT_RESOURCES;
-
-
-/* SRAT - System Resource Affinity Table */
-
-typedef struct static_resource_alloc
-{
- UINT8 Type;
- UINT8 Length;
- UINT8 ProximityDomainLo;
- UINT8 ApicId;
-
- /* Flags (32 bits) */
-
- UINT8_BIT Enabled :1; /* 00: Use affinity structure */
- UINT8_BIT :7; /* 01-07: Reserved, must be zero */
- UINT8 Reserved3[3]; /* 08-31: Reserved, must be zero */
-
- UINT8 LocalSapicEid;
- UINT8 ProximityDomainHi[3];
- UINT32 Reserved4; /* Reserved, must be zero */
-
-} STATIC_RESOURCE_ALLOC;
-
-typedef struct memory_affinity
-{
- UINT8 Type;
- UINT8 Length;
- UINT32 ProximityDomain;
- UINT16 Reserved3;
- UINT64 BaseAddress;
- UINT64 AddressLength;
- UINT32 Reserved4;
-
- /* Flags (32 bits) */
-
- UINT8_BIT Enabled :1; /* 00: Use affinity structure */
- UINT8_BIT HotPluggable :1; /* 01: Memory region is hot pluggable */
- UINT8_BIT NonVolatile :1; /* 02: Memory is non-volatile */
- UINT8_BIT :5; /* 03-07: Reserved, must be zero */
- UINT8 Reserved5[3]; /* 08-31: Reserved, must be zero */
-
- UINT64 Reserved6; /* Reserved, must be zero */
-
-} MEMORY_AFFINITY;
-
-typedef struct system_resource_affinity
-{
- ACPI_TABLE_HEADER_DEF
- UINT32 Reserved1; /* Must be value '1' */
- UINT64 Reserved2; /* Reserved, must be zero */
-
-} SYSTEM_RESOURCE_AFFINITY;
-
-
-/* SLIT - System Locality Distance Information Table */
-
-typedef struct system_locality_info
-{
- ACPI_TABLE_HEADER_DEF
- UINT64 LocalityCount;
- UINT8 Entry[1][1];
-
-} SYSTEM_LOCALITY_INFO;
-
-
-#pragma pack()
+/* Code moved to both actbl.h and actbl1.h */
#endif /* __ACTBL2_H__ */
diff --git a/sys/contrib/dev/acpica/actypes.h b/sys/contrib/dev/acpica/actypes.h
index 067a02a..9f04da2 100644
--- a/sys/contrib/dev/acpica/actypes.h
+++ b/sys/contrib/dev/acpica/actypes.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: actypes.h - Common data types for the entire ACPI subsystem
- * $Revision: 1.288 $
+ * $Revision: 1.316 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -117,9 +117,18 @@
#ifndef __ACTYPES_H__
#define __ACTYPES_H__
-/*! [Begin] no source code translation (keep the typedefs) */
+/* acpisrc:StructDefs -- for acpisrc conversion */
+/*
+ * ACPI_MACHINE_WIDTH must be specified in an OS- or compiler-dependent header
+ * and must be either 32 or 64. 16-bit ACPICA is no longer supported, as of
+ * 12/2006.
+ */
+#ifndef ACPI_MACHINE_WIDTH
+#error ACPI_MACHINE_WIDTH not defined
+#endif
+/*! [Begin] no source code translation */
/*
* Data type ranges
@@ -134,214 +143,225 @@
#define ACPI_ASCII_MAX 0x7F
-#ifdef DEFINE_ALTERNATE_TYPES
/*
- * Types used only in translated source, defined here to enable
- * cross-platform compilation only.
+ * Architecture-specific ACPICA Subsystem Data Types
+ *
+ * The goal of these types is to provide source code portability across
+ * 16-bit, 32-bit, and 64-bit targets.
+ *
+ * 1) The following types are of fixed size for all targets (16/32/64):
+ *
+ * BOOLEAN Logical boolean
+ *
+ * UINT8 8-bit (1 byte) unsigned value
+ * UINT16 16-bit (2 byte) unsigned value
+ * UINT32 32-bit (4 byte) unsigned value
+ * UINT64 64-bit (8 byte) unsigned value
+ *
+ * INT16 16-bit (2 byte) signed value
+ * INT32 32-bit (4 byte) signed value
+ * INT64 64-bit (8 byte) signed value
+ *
+ * COMPILER_DEPENDENT_UINT64/INT64 - These types are defined in the
+ * compiler-dependent header(s) and were introduced because there is no common
+ * 64-bit integer type across the various compilation models, as shown in
+ * the table below.
+ *
+ * Datatype LP64 ILP64 LLP64 ILP32 LP32 16bit
+ * char 8 8 8 8 8 8
+ * short 16 16 16 16 16 16
+ * _int32 32
+ * int 32 64 32 32 16 16
+ * long 64 64 32 32 32 32
+ * long long 64 64
+ * pointer 64 64 64 32 32 32
+ *
+ * Note: ILP64 and LP32 are currently not supported.
+ *
+ *
+ * 2) These types represent the native word size of the target mode of the
+ * processor, and may be 16-bit, 32-bit, or 64-bit as required. They are
+ * 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.
+ *
+ * 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
+ *
*/
-typedef int s32;
-typedef unsigned char u8;
-typedef unsigned short u16;
-typedef unsigned int u32;
-typedef COMPILER_DEPENDENT_UINT64 u64;
-#endif
+/*******************************************************************************
+ *
+ * Common types for all compilers, all targets
+ *
+ ******************************************************************************/
+
+typedef unsigned char BOOLEAN;
+typedef unsigned char UINT8;
+typedef unsigned short UINT16;
+typedef COMPILER_DEPENDENT_UINT64 UINT64;
+typedef COMPILER_DEPENDENT_INT64 INT64;
+/*! [End] no source code translation !*/
-/*
- * Data types - Fixed across all compilation models (16/32/64)
- *
- * BOOLEAN Logical Boolean.
- * INT8 8-bit (1 byte) signed value
- * UINT8 8-bit (1 byte) unsigned value
- * INT16 16-bit (2 byte) signed value
- * UINT16 16-bit (2 byte) unsigned value
- * INT32 32-bit (4 byte) signed value
- * UINT32 32-bit (4 byte) unsigned value
- * INT64 64-bit (8 byte) signed value
- * UINT64 64-bit (8 byte) unsigned value
- * ACPI_NATIVE_INT 32-bit on IA-32, 64-bit on IA-64 signed value
- * ACPI_NATIVE_UINT 32-bit on IA-32, 64-bit on IA-64 unsigned value
- */
-#ifndef ACPI_MACHINE_WIDTH
-#error ACPI_MACHINE_WIDTH not defined
-#endif
+/*******************************************************************************
+ *
+ * Types specific to 64-bit targets
+ *
+ ******************************************************************************/
#if ACPI_MACHINE_WIDTH == 64
-/*! [Begin] no source code translation (keep the typedefs) */
+/*! [Begin] no source code translation (keep the typedefs as-is) */
-/*
- * 64-bit type definitions
- */
-typedef unsigned char UINT8;
-typedef unsigned char BOOLEAN;
-typedef unsigned short UINT16;
-typedef int INT32;
typedef unsigned int UINT32;
-typedef COMPILER_DEPENDENT_INT64 INT64;
-typedef COMPILER_DEPENDENT_UINT64 UINT64;
+typedef int INT32;
/*! [End] no source code translation !*/
-typedef INT64 ACPI_NATIVE_INT;
+
typedef UINT64 ACPI_NATIVE_UINT;
+typedef INT64 ACPI_NATIVE_INT;
-typedef UINT64 ACPI_TABLE_PTR;
typedef UINT64 ACPI_IO_ADDRESS;
typedef UINT64 ACPI_PHYSICAL_ADDRESS;
-typedef UINT64 ACPI_SIZE;
-#define ALIGNED_ADDRESS_BOUNDARY 0x00000008 /* No hardware alignment support in IA64 */
-#define ACPI_USE_NATIVE_DIVIDE /* Native 64-bit integer support */
#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 */
+
/*
* In the case of the Itanium Processor Family (IPF), the hardware does not
* support misaligned memory transfers. Set the MISALIGNMENT_NOT_SUPPORTED flag
* to indicate that special precautions must be taken to avoid alignment faults.
* (IA64 or ia64 is currently used by existing compilers to indicate IPF.)
*
- * Note: EM64T and other X86-64 processors do support misaligned transfers,
+ * Note: EM64T and other X86-64 processors support misaligned transfers,
* so there is no need to define this flag.
*/
#if defined (__IA64__) || defined (__ia64__)
#define ACPI_MISALIGNMENT_NOT_SUPPORTED
#endif
-#elif ACPI_MACHINE_WIDTH == 16
-
-/*! [Begin] no source code translation (keep the typedefs as-is) */
-
-/*
- * 16-bit type definitions
- */
-typedef unsigned char UINT8;
-typedef unsigned char BOOLEAN;
-typedef unsigned int UINT16;
-typedef long INT32;
-typedef int INT16;
-typedef unsigned long UINT32;
-
-typedef struct
-{
- UINT32 Lo;
- UINT32 Hi;
-
-} UINT64;
-
-/*! [End] no source code translation !*/
-
-typedef UINT16 ACPI_NATIVE_UINT;
-typedef INT16 ACPI_NATIVE_INT;
-
-typedef UINT32 ACPI_TABLE_PTR;
-typedef UINT32 ACPI_IO_ADDRESS;
-typedef char *ACPI_PHYSICAL_ADDRESS;
-typedef UINT16 ACPI_SIZE;
-
-#define ALIGNED_ADDRESS_BOUNDARY 0x00000002
-#define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */
-#define ACPI_MAX_PTR ACPI_UINT16_MAX
-#define ACPI_SIZE_MAX ACPI_UINT16_MAX
-
-/*
- * (16-bit only) internal integers must be 32-bits, so
- * 64-bit integers cannot be supported
- */
-#define ACPI_NO_INTEGER64_SUPPORT
+/*******************************************************************************
+ *
+ * Types specific to 32-bit targets
+ *
+ ******************************************************************************/
#elif ACPI_MACHINE_WIDTH == 32
-/*! [Begin] no source code translation (keep the typedefs) */
+/*! [Begin] no source code translation (keep the typedefs as-is) */
-/*
- * 32-bit type definitions (default)
- */
-typedef unsigned char UINT8;
-typedef unsigned char BOOLEAN;
-typedef unsigned short UINT16;
-typedef int INT32;
typedef unsigned int UINT32;
-typedef COMPILER_DEPENDENT_INT64 INT64;
-typedef COMPILER_DEPENDENT_UINT64 UINT64;
+typedef int INT32;
/*! [End] no source code translation !*/
-typedef INT32 ACPI_NATIVE_INT;
+
typedef UINT32 ACPI_NATIVE_UINT;
+typedef INT32 ACPI_NATIVE_INT;
-typedef UINT64 ACPI_TABLE_PTR;
typedef UINT32 ACPI_IO_ADDRESS;
-typedef UINT64 ACPI_PHYSICAL_ADDRESS;
-typedef UINT32 ACPI_SIZE;
+typedef UINT32 ACPI_PHYSICAL_ADDRESS;
-#define ALIGNED_ADDRESS_BOUNDARY 0x00000004
#define ACPI_MAX_PTR ACPI_UINT32_MAX
#define ACPI_SIZE_MAX ACPI_UINT32_MAX
#else
+
+/* ACPI_MACHINE_WIDTH must be either 64 or 32 */
+
#error unknown ACPI_MACHINE_WIDTH
#endif
-/*
- * This type is used for bitfields in ACPI tables. The only type that is
- * even remotely portable is UINT8. Anything else is not portable, so
- * do not add any more bitfield types.
- */
-typedef UINT8 UINT8_BIT;
-typedef ACPI_NATIVE_UINT ACPI_PTRDIFF;
+/* Variable-width type, used instead of clib size_t */
-/*
- * Pointer overlays to avoid lots of typecasting for
- * code that accepts both physical and logical pointers.
- */
-typedef union acpi_pointers
-{
- ACPI_PHYSICAL_ADDRESS Physical;
- void *Logical;
- ACPI_TABLE_PTR Value;
+typedef ACPI_NATIVE_UINT ACPI_SIZE;
-} ACPI_POINTERS;
-typedef struct acpi_pointer
-{
- UINT32 PointerType;
- union acpi_pointers Pointer;
+/*******************************************************************************
+ *
+ * OS-dependent and compiler-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.
+ *
+ ******************************************************************************/
-} ACPI_POINTER;
-/* PointerTypes for above */
+/* Value returned by AcpiOsGetThreadId */
-#define ACPI_PHYSICAL_POINTER 0x01
-#define ACPI_LOGICAL_POINTER 0x02
+#ifndef ACPI_THREAD_ID
+#define ACPI_THREAD_ID ACPI_NATIVE_UINT
+#endif
-/* Processor mode */
+/* Object returned from AcpiOsCreateLock */
-#define ACPI_PHYSICAL_ADDRESSING 0x04
-#define ACPI_LOGICAL_ADDRESSING 0x08
-#define ACPI_MEMORY_MODE 0x0C
+#ifndef ACPI_SPINLOCK
+#define ACPI_SPINLOCK void *
+#endif
-#define ACPI_PHYSMODE_PHYSPTR ACPI_PHYSICAL_ADDRESSING | ACPI_PHYSICAL_POINTER
-#define ACPI_LOGMODE_PHYSPTR ACPI_LOGICAL_ADDRESSING | ACPI_PHYSICAL_POINTER
-#define ACPI_LOGMODE_LOGPTR ACPI_LOGICAL_ADDRESSING | ACPI_LOGICAL_POINTER
+/* Flags for AcpiOsAcquireLock/AcpiOsReleaseLock */
+
+#ifndef ACPI_CPU_FLAGS
+#define ACPI_CPU_FLAGS ACPI_NATIVE_UINT
+#endif
+
+/* Object returned from AcpiOsCreateCache */
-/*
- * If ACPI_CACHE_T was not defined in the OS-dependent header,
- * define it now. This is typically the case where the local cache
- * manager implementation is to be used (ACPI_USE_LOCAL_CACHE)
- */
#ifndef ACPI_CACHE_T
#define ACPI_CACHE_T ACPI_MEMORY_LIST
#endif
+/* Use C99 uintptr_t for pointer casting if available, "void *" otherwise */
+
+#ifndef ACPI_UINTPTR_T
+#define ACPI_UINTPTR_T void *
+#endif
+
/*
- * Useful defines
+ * ACPI_PRINTF_LIKE is used to tag functions as "printf-like" because
+ * some compilers can catch printf format string problems
*/
+#ifndef ACPI_PRINTF_LIKE
+#define ACPI_PRINTF_LIKE(c)
+#endif
+
+/*
+ * Some compilers complain about unused variables. Sometimes we don't want to
+ * use all the variables (for example, _AcpiModuleName). This allows us
+ * to to tell the compiler in a per-variable manner that a variable
+ * is unused
+ */
+#ifndef ACPI_UNUSED_VAR
+#define ACPI_UNUSED_VAR
+#endif
+
+/*
+ * All ACPICA functions that are available to the rest of the kernel are
+ * tagged with this macro which can be defined as appropriate for the host.
+ */
+#ifndef ACPI_EXPORT_SYMBOL
+#define ACPI_EXPORT_SYMBOL(Symbol)
+#endif
+
+
+/*******************************************************************************
+ *
+ * Independent types
+ *
+ ******************************************************************************/
+
+/* Logical defines and NULL */
+
#ifdef FALSE
#undef FALSE
#endif
@@ -358,58 +378,47 @@ typedef struct acpi_pointer
/*
- * Local datatypes
+ * Mescellaneous 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 an Node */
+typedef void * ACPI_HANDLE; /* Actually a ptr to a NS Node */
typedef struct uint64_struct
{
- UINT32 Lo;
- UINT32 Hi;
+ UINT32 Lo;
+ UINT32 Hi;
} UINT64_STRUCT;
typedef union uint64_overlay
{
- UINT64 Full;
- UINT64_STRUCT Part;
+ UINT64 Full;
+ UINT64_STRUCT Part;
} UINT64_OVERLAY;
typedef struct uint32_struct
{
- UINT32 Lo;
- UINT32 Hi;
+ UINT32 Lo;
+ UINT32 Hi;
} UINT32_STRUCT;
-/*
- * Acpi integer width. In ACPI version 1, integers are
- * 32 bits. In ACPI version 2, integers are 64 bits.
- * Note that this pertains to the ACPI integer type only, not
- * other integers used in the implementation of the ACPI CA
- * subsystem.
- */
-#ifdef ACPI_NO_INTEGER64_SUPPORT
-
-/* 32-bit integers only, no 64-bit support */
-
-typedef UINT32 ACPI_INTEGER;
-#define ACPI_INTEGER_MAX ACPI_UINT32_MAX
-#define ACPI_INTEGER_BIT_SIZE 32
-#define ACPI_MAX_DECIMAL_DIGITS 10 /* 2^32 = 4,294,967,296 */
-
-#define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 32-bit divide */
+/* Synchronization objects */
+#define ACPI_MUTEX void *
+#define ACPI_SEMAPHORE void *
-#else
-
-/* 64-bit integers */
+/*
+ * Acpi integer width. In ACPI version 1, integers are 32 bits. In ACPI
+ * version 2, integers are 64 bits. Note that this pertains to the ACPI integer
+ * type only, not other integers used in the implementation of the ACPI CA
+ * subsystem.
+ */
typedef UINT64 ACPI_INTEGER;
#define ACPI_INTEGER_MAX ACPI_UINT64_MAX
#define ACPI_INTEGER_BIT_SIZE 64
@@ -419,7 +428,6 @@ typedef UINT64 ACPI_INTEGER;
#if ACPI_MACHINE_WIDTH == 64
#define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 64-bit divide */
#endif
-#endif
#define ACPI_MAX64_DECIMAL_DIGITS 20
#define ACPI_MAX32_DECIMAL_DIGITS 10
@@ -429,7 +437,7 @@ typedef UINT64 ACPI_INTEGER;
/*
* Constants with special meanings
*/
-#define ACPI_ROOT_OBJECT (ACPI_HANDLE) ACPI_PTR_ADD (char, NULL, ACPI_MAX_PTR)
+#define ACPI_ROOT_OBJECT ACPI_ADD_PTR (ACPI_HANDLE, NULL, ACPI_MAX_PTR)
/*
@@ -447,7 +455,8 @@ typedef UINT64 ACPI_INTEGER;
/*
* Initialization state
*/
-#define ACPI_INITIALIZED_OK 0x01
+#define ACPI_SUBSYSTEM_INITIALIZE 0x01
+#define ACPI_INITIALIZED_OK 0x02
/*
* Power state values
@@ -496,21 +505,6 @@ typedef UINT64 ACPI_INTEGER;
#define ACPI_NOTIFY_POWER_FAULT (UINT8) 7
/*
- * Table types. These values are passed to the table related APIs
- */
-typedef UINT32 ACPI_TABLE_TYPE;
-
-#define ACPI_TABLE_RSDP (ACPI_TABLE_TYPE) 0
-#define ACPI_TABLE_DSDT (ACPI_TABLE_TYPE) 1
-#define ACPI_TABLE_FADT (ACPI_TABLE_TYPE) 2
-#define ACPI_TABLE_FACS (ACPI_TABLE_TYPE) 3
-#define ACPI_TABLE_PSDT (ACPI_TABLE_TYPE) 4
-#define ACPI_TABLE_SSDT (ACPI_TABLE_TYPE) 5
-#define ACPI_TABLE_XSDT (ACPI_TABLE_TYPE) 6
-#define ACPI_TABLE_MAX 6
-#define NUM_ACPI_TABLE_TYPES (ACPI_TABLE_MAX+1)
-
-/*
* 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,
@@ -577,37 +571,6 @@ typedef UINT32 ACPI_OBJECT_TYPE;
#define ACPI_TYPE_NOT_FOUND 0xFF
/*
- * Bitmapped ACPI types. Used internally only
- */
-#define ACPI_BTYPE_ANY 0x00000000
-#define ACPI_BTYPE_INTEGER 0x00000001
-#define ACPI_BTYPE_STRING 0x00000002
-#define ACPI_BTYPE_BUFFER 0x00000004
-#define ACPI_BTYPE_PACKAGE 0x00000008
-#define ACPI_BTYPE_FIELD_UNIT 0x00000010
-#define ACPI_BTYPE_DEVICE 0x00000020
-#define ACPI_BTYPE_EVENT 0x00000040
-#define ACPI_BTYPE_METHOD 0x00000080
-#define ACPI_BTYPE_MUTEX 0x00000100
-#define ACPI_BTYPE_REGION 0x00000200
-#define ACPI_BTYPE_POWER 0x00000400
-#define ACPI_BTYPE_PROCESSOR 0x00000800
-#define ACPI_BTYPE_THERMAL 0x00001000
-#define ACPI_BTYPE_BUFFER_FIELD 0x00002000
-#define ACPI_BTYPE_DDB_HANDLE 0x00004000
-#define ACPI_BTYPE_DEBUG_OBJECT 0x00008000
-#define ACPI_BTYPE_REFERENCE 0x00010000
-#define ACPI_BTYPE_RESOURCE 0x00020000
-
-#define ACPI_BTYPE_COMPUTE_DATA (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER)
-
-#define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE)
-#define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE)
-#define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR)
-#define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */
-#define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF
-
-/*
* All I/O
*/
#define ACPI_READ 0
@@ -674,7 +637,7 @@ typedef UINT32 ACPI_EVENT_STATUS;
* | | | +--- Type of dispatch -- to method, handler, or none
* | | +--- Enabled for runtime?
* | +--- Enabled for wake?
- * +--- System state when GPE ocurred (running/waking)
+ * +--- Unused
*/
#define ACPI_GPE_XRUPT_TYPE_MASK (UINT8) 0x01
#define ACPI_GPE_LEVEL_TRIGGERED (UINT8) 0x01
@@ -700,10 +663,6 @@ typedef UINT32 ACPI_EVENT_STATUS;
#define ACPI_GPE_ENABLE_MASK (UINT8) 0x60 /* Both run/wake */
-#define ACPI_GPE_SYSTEM_MASK (UINT8) 0x80
-#define ACPI_GPE_SYSTEM_RUNNING (UINT8) 0x80
-#define ACPI_GPE_SYSTEM_WAKING (UINT8) 0x00
-
/*
* Flags for GPE and Lock interfaces
*/
@@ -778,54 +737,54 @@ typedef UINT8 ACPI_ADR_SPACE_TYPE;
*/
typedef union acpi_object
{
- ACPI_OBJECT_TYPE Type; /* See definition of AcpiNsType for values */
+ ACPI_OBJECT_TYPE Type; /* See definition of AcpiNsType for values */
struct
{
- ACPI_OBJECT_TYPE Type;
- ACPI_INTEGER Value; /* The actual number */
+ ACPI_OBJECT_TYPE Type;
+ ACPI_INTEGER Value; /* The actual number */
} Integer;
struct
{
- ACPI_OBJECT_TYPE Type;
- UINT32 Length; /* # of bytes in string, excluding trailing null */
- char *Pointer; /* points to the string value */
+ ACPI_OBJECT_TYPE Type;
+ UINT32 Length; /* # of bytes in string, excluding trailing null */
+ char *Pointer; /* points to the string value */
} String;
struct
{
- ACPI_OBJECT_TYPE Type;
- UINT32 Length; /* # of bytes in buffer */
- UINT8 *Pointer; /* points to the buffer */
+ ACPI_OBJECT_TYPE Type;
+ 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 */
+ ACPI_OBJECT_TYPE Type;
+ UINT32 Fill1;
+ ACPI_HANDLE Handle; /* object reference */
} Reference;
struct
{
- ACPI_OBJECT_TYPE Type;
- UINT32 Count; /* # of elements in package */
- union acpi_object *Elements; /* Pointer to an array of ACPI_OBJECTs */
+ ACPI_OBJECT_TYPE Type;
+ UINT32 Count; /* # of elements in package */
+ union acpi_object *Elements; /* Pointer to an array of ACPI_OBJECTs */
} Package;
struct
{
- ACPI_OBJECT_TYPE Type;
- UINT32 ProcId;
- ACPI_IO_ADDRESS PblkAddress;
- UINT32 PblkLength;
+ ACPI_OBJECT_TYPE Type;
+ UINT32 ProcId;
+ ACPI_IO_ADDRESS PblkAddress;
+ UINT32 PblkLength;
} Processor;
struct
{
- ACPI_OBJECT_TYPE Type;
- UINT32 SystemLevel;
- UINT32 ResourceOrder;
+ ACPI_OBJECT_TYPE Type;
+ UINT32 SystemLevel;
+ UINT32 ResourceOrder;
} PowerResource;
} ACPI_OBJECT;
@@ -836,8 +795,8 @@ typedef union acpi_object
*/
typedef struct acpi_object_list
{
- UINT32 Count;
- ACPI_OBJECT *Pointer;
+ UINT32 Count;
+ ACPI_OBJECT *Pointer;
} ACPI_OBJECT_LIST;
@@ -851,8 +810,8 @@ typedef struct acpi_object_list
typedef struct acpi_buffer
{
- ACPI_SIZE Length; /* Length in bytes of the buffer */
- void *Pointer; /* pointer to buffer */
+ ACPI_SIZE Length; /* Length in bytes of the buffer */
+ void *Pointer; /* pointer to buffer */
} ACPI_BUFFER;
@@ -875,29 +834,17 @@ typedef struct acpi_buffer
/*
- * ACPI Table Info. One per ACPI table _type_
- */
-typedef struct acpi_table_info
-{
- UINT32 Count;
-
-} ACPI_TABLE_INFO;
-
-
-/*
* System info returned by AcpiGetSystemInfo()
*/
typedef struct acpi_system_info
{
- UINT32 AcpiCaVersion;
- UINT32 Flags;
- UINT32 TimerResolution;
- UINT32 Reserved1;
- UINT32 Reserved2;
- UINT32 DebugLevel;
- UINT32 DebugLayer;
- UINT32 NumTableTypes;
- ACPI_TABLE_INFO TableInfo [NUM_ACPI_TABLE_TYPES];
+ UINT32 AcpiCaVersion;
+ UINT32 Flags;
+ UINT32 TimerResolution;
+ UINT32 Reserved1;
+ UINT32 Reserved2;
+ UINT32 DebugLevel;
+ UINT32 DebugLayer;
} ACPI_SYSTEM_INFO;
@@ -907,77 +854,77 @@ typedef struct acpi_system_info
*/
typedef UINT32
(ACPI_SYSTEM_XFACE *ACPI_OSD_HANDLER) (
- void *Context);
+ void *Context);
typedef void
(ACPI_SYSTEM_XFACE *ACPI_OSD_EXEC_CALLBACK) (
- void *Context);
+ void *Context);
/*
* Various handlers and callback procedures
*/
typedef
UINT32 (*ACPI_EVENT_HANDLER) (
- void *Context);
+ void *Context);
typedef
void (*ACPI_NOTIFY_HANDLER) (
- ACPI_HANDLE Device,
- UINT32 Value,
- void *Context);
+ ACPI_HANDLE Device,
+ UINT32 Value,
+ void *Context);
typedef
void (*ACPI_OBJECT_HANDLER) (
- ACPI_HANDLE Object,
- UINT32 Function,
- void *Data);
+ ACPI_HANDLE Object,
+ UINT32 Function,
+ void *Data);
typedef
ACPI_STATUS (*ACPI_INIT_HANDLER) (
- ACPI_HANDLE Object,
- UINT32 Function);
+ ACPI_HANDLE Object,
+ UINT32 Function);
#define ACPI_INIT_DEVICE_INI 1
typedef
ACPI_STATUS (*ACPI_EXCEPTION_HANDLER) (
- ACPI_STATUS AmlStatus,
- ACPI_NAME Name,
- UINT16 Opcode,
- UINT32 AmlOffset,
- void *Context);
+ ACPI_STATUS AmlStatus,
+ ACPI_NAME Name,
+ UINT16 Opcode,
+ UINT32 AmlOffset,
+ void *Context);
/* Address Spaces (For Operation Regions) */
typedef
ACPI_STATUS (*ACPI_ADR_SPACE_HANDLER) (
- UINT32 Function,
- ACPI_PHYSICAL_ADDRESS Address,
- UINT32 BitWidth,
- ACPI_INTEGER *Value,
- void *HandlerContext,
- void *RegionContext);
+ UINT32 Function,
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT32 BitWidth,
+ ACPI_INTEGER *Value,
+ void *HandlerContext,
+ void *RegionContext);
-#define ACPI_DEFAULT_HANDLER NULL
+#define ACPI_DEFAULT_HANDLER NULL
typedef
ACPI_STATUS (*ACPI_ADR_SPACE_SETUP) (
- ACPI_HANDLE RegionHandle,
- UINT32 Function,
- void *HandlerContext,
- void **RegionContext);
+ ACPI_HANDLE RegionHandle,
+ UINT32 Function,
+ void *HandlerContext,
+ void **RegionContext);
#define ACPI_REGION_ACTIVATE 0
#define ACPI_REGION_DEACTIVATE 1
typedef
ACPI_STATUS (*ACPI_WALK_CALLBACK) (
- ACPI_HANDLE ObjHandle,
- UINT32 NestingLevel,
- void *Context,
- void **ReturnValue);
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue);
/* Interrupt handler return values */
@@ -990,7 +937,7 @@ ACPI_STATUS (*ACPI_WALK_CALLBACK) (
typedef struct acpi_device_id
{
- char Value[ACPI_DEVICE_ID_LENGTH];
+ char Value[ACPI_DEVICE_ID_LENGTH];
} ACPI_DEVICE_ID;
@@ -998,15 +945,15 @@ typedef struct acpi_device_id
typedef struct acpi_compatible_id
{
- char Value[ACPI_MAX_CID_LENGTH];
+ char Value[ACPI_MAX_CID_LENGTH];
} ACPI_COMPATIBLE_ID;
typedef struct acpi_compatible_id_list
{
- UINT32 Count;
- UINT32 Size;
- ACPI_COMPATIBLE_ID Id[1];
+ UINT32 Count;
+ UINT32 Size;
+ ACPI_COMPATIBLE_ID Id[1];
} ACPI_COMPATIBLE_ID_LIST;
@@ -1020,10 +967,19 @@ typedef struct acpi_compatible_id_list
#define ACPI_VALID_CID 0x0010
#define ACPI_VALID_SXDS 0x0020
+/* Flags for _STA method */
+
+#define ACPI_STA_DEVICE_PRESENT 0x01
+#define ACPI_STA_DEVICE_ENABLED 0x02
+#define ACPI_STA_DEVICE_UI 0x04
+#define ACPI_STA_DEVICE_FUNCTIONING 0x08
+#define ACPI_STA_DEVICE_OK 0x08 /* Synonym */
+#define ACPI_STA_BATTERY_PRESENT 0x10
+
#define ACPI_COMMON_OBJ_INFO \
- ACPI_OBJECT_TYPE Type; /* ACPI object type */ \
- ACPI_NAME Name /* ACPI object Name */
+ ACPI_OBJECT_TYPE Type; /* ACPI object type */ \
+ ACPI_NAME Name /* ACPI object Name */
typedef struct acpi_obj_info_header
@@ -1039,13 +995,13 @@ typedef struct acpi_device_info
{
ACPI_COMMON_OBJ_INFO;
- UINT32 Valid; /* Indicates which fields below are valid */
- UINT32 CurrentStatus; /* _STA value */
- ACPI_INTEGER Address; /* _ADR value if any */
- ACPI_DEVICE_ID HardwareId; /* _HID value if any */
- ACPI_DEVICE_ID UniqueId; /* _UID value if any */
- UINT8 HighestDstates[4]; /* _SxD values: 0xFF indicates not valid */
- ACPI_COMPATIBLE_ID_LIST CompatibilityId; /* List of _CIDs if any */
+ UINT32 Valid; /* Indicates which fields below are valid */
+ UINT32 CurrentStatus; /* _STA value */
+ ACPI_INTEGER Address; /* _ADR value if any */
+ ACPI_DEVICE_ID HardwareId; /* _HID value if any */
+ ACPI_DEVICE_ID UniqueId; /* _UID value if any */
+ UINT8 HighestDstates[4]; /* _SxD values: 0xFF indicates not valid */
+ ACPI_COMPATIBLE_ID_LIST CompatibilityId; /* List of _CIDs if any */
} ACPI_DEVICE_INFO;
@@ -1054,21 +1010,21 @@ typedef struct acpi_device_info
typedef struct acpi_pci_id
{
- UINT16 Segment;
- UINT16 Bus;
- UINT16 Device;
- UINT16 Function;
+ UINT16 Segment;
+ UINT16 Bus;
+ UINT16 Device;
+ UINT16 Function;
} ACPI_PCI_ID;
typedef struct acpi_mem_space_context
{
- UINT32 Length;
- ACPI_PHYSICAL_ADDRESS Address;
- ACPI_PHYSICAL_ADDRESS MappedPhysicalAddress;
- UINT8 *MappedLogicalAddress;
- ACPI_SIZE MappedLength;
+ UINT32 Length;
+ ACPI_PHYSICAL_ADDRESS Address;
+ ACPI_PHYSICAL_ADDRESS MappedPhysicalAddress;
+ UINT8 *MappedLogicalAddress;
+ ACPI_SIZE MappedLength;
} ACPI_MEM_SPACE_CONTEXT;
@@ -1099,7 +1055,9 @@ typedef UINT32 ACPI_RSDESC_SIZE; /* Max Resource Descr
#define ACPI_ISA_ONLY_RANGES (UINT8) 0x02
#define ACPI_ENTIRE_RANGE (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES)
-#define ACPI_SPARSE_TRANSLATION (UINT8) 0x03
+/* Type of translation - 1=Sparse, 0=Dense */
+
+#define ACPI_SPARSE_TRANSLATION (UINT8) 0x01
/*
* IO Port Descriptor Decode
@@ -1165,35 +1123,49 @@ typedef UINT32 ACPI_RSDESC_SIZE; /* Max Resource Descr
#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 Triggering;
- UINT8 Polarity;
- UINT8 Sharable;
- UINT8 InterruptCount;
- UINT8 Interrupts[1];
+ 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];
+ UINT8 Type;
+ UINT8 BusMaster;
+ UINT8 Transfer;
+ UINT8 ChannelCount;
+ UINT8 Channels[1];
} ACPI_RESOURCE_DMA;
typedef struct acpi_resource_start_dependent
{
- UINT8 CompatibilityPriority;
- UINT8 PerformanceRobustness;
+ UINT8 CompatibilityPriority;
+ UINT8 PerformanceRobustness;
} ACPI_RESOURCE_START_DEPENDENT;
@@ -1206,108 +1178,119 @@ typedef struct acpi_resource_start_dependent
typedef struct acpi_resource_io
{
- UINT8 IoDecode;
- UINT8 Alignment;
- UINT8 AddressLength;
- UINT16 Minimum;
- UINT16 Maximum;
+ UINT8 IoDecode;
+ UINT8 Alignment;
+ UINT8 AddressLength;
+ UINT16 Minimum;
+ UINT16 Maximum;
} ACPI_RESOURCE_IO;
typedef struct acpi_resource_fixed_io
{
- UINT16 Address;
- UINT8 AddressLength;
+ UINT16 Address;
+ UINT8 AddressLength;
} ACPI_RESOURCE_FIXED_IO;
typedef struct acpi_resource_vendor
{
- UINT16 ByteLength;
- UINT8 ByteData[1];
+ 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;
+ UINT8 Checksum;
} ACPI_RESOURCE_END_TAG;
typedef struct acpi_resource_memory24
{
- UINT8 WriteProtect;
- UINT16 Minimum;
- UINT16 Maximum;
- UINT16 Alignment;
- UINT16 AddressLength;
+ 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;
+ 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;
+ UINT8 WriteProtect;
+ UINT32 Address;
+ UINT32 AddressLength;
} ACPI_RESOURCE_FIXED_MEMORY32;
typedef struct acpi_memory_attribute
{
- UINT8 WriteProtect;
- UINT8 Caching;
- UINT8 RangeType;
- UINT8 Translation;
+ UINT8 WriteProtect;
+ UINT8 Caching;
+ UINT8 RangeType;
+ UINT8 Translation;
} ACPI_MEMORY_ATTRIBUTE;
typedef struct acpi_io_attribute
{
- UINT8 RangeType;
- UINT8 Translation;
- UINT8 TranslationType;
- UINT8 Reserved1;
+ UINT8 RangeType;
+ UINT8 Translation;
+ UINT8 TranslationType;
+ UINT8 Reserved1;
} ACPI_IO_ATTRIBUTE;
typedef union acpi_resource_attribute
{
- ACPI_MEMORY_ATTRIBUTE Mem;
- ACPI_IO_ATTRIBUTE Io;
+ ACPI_MEMORY_ATTRIBUTE Mem;
+ ACPI_IO_ATTRIBUTE Io;
/* Used for the *WordSpace macros */
- UINT8 TypeSpecific;
+ UINT8 TypeSpecific;
} ACPI_RESOURCE_ATTRIBUTE;
typedef struct acpi_resource_source
{
- UINT8 Index;
- UINT16 StringLength;
- char *StringPtr;
+ 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;
+ UINT8 ResourceType; \
+ UINT8 ProducerConsumer; \
+ UINT8 Decode; \
+ UINT8 MinAddressFixed; \
+ UINT8 MaxAddressFixed; \
+ ACPI_RESOURCE_ATTRIBUTE Info;
typedef struct acpi_resource_address
{
@@ -1318,71 +1301,71 @@ typedef struct 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;
+ 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;
+ 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;
+ 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;
+ 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];
+ 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;
+ UINT8 SpaceId;
+ UINT8 BitWidth;
+ UINT8 BitOffset;
+ UINT8 AccessSize;
+ UINT64 Address;
} ACPI_RESOURCE_GENERIC_REGISTER;
@@ -1411,35 +1394,36 @@ typedef struct acpi_resource_generic_register
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_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;
+ 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_ADDRESS Address; /* Common 16/32/64 address fields */
} ACPI_RESOURCE_DATA;
typedef struct acpi_resource
{
- UINT32 Type;
- UINT32 Length;
- ACPI_RESOURCE_DATA Data;
+ UINT32 Type;
+ UINT32 Length;
+ ACPI_RESOURCE_DATA Data;
} ACPI_RESOURCE;
@@ -1454,30 +1438,16 @@ typedef struct acpi_resource
#define ACPI_NEXT_RESOURCE(Res) (ACPI_RESOURCE *)((UINT8 *) Res + Res->Length)
-#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
-#define ACPI_ALIGN_RESOURCE_SIZE(Length) (Length)
-#else
-#define ACPI_ALIGN_RESOURCE_SIZE(Length) ACPI_ROUND_UP_TO_NATIVE_WORD(Length)
-#endif
-
-/*
- * END: of definitions for Resource Attributes
- */
-
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 */
+ 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;
-/*
- * END: of definitions for PCI Routing tables
- */
-
#endif /* __ACTYPES_H__ */
diff --git a/sys/contrib/dev/acpica/acutils.h b/sys/contrib/dev/acpica/acutils.h
index c1726f1..fef6f08 100644
--- a/sys/contrib/dev/acpica/acutils.h
+++ b/sys/contrib/dev/acpica/acutils.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
- * $Revision: 1.182 $
+ * $Revision: 1.200 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -118,6 +118,47 @@
#define _ACUTILS_H
+extern const UINT8 AcpiGbl_ResourceAmlSizes[];
+
+/* Strings used by the disassembler and debugger resource dump routines */
+
+#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER)
+
+extern const char *AcpiGbl_BmDecode[];
+extern const char *AcpiGbl_ConfigDecode[];
+extern const char *AcpiGbl_ConsumeDecode[];
+extern const char *AcpiGbl_DecDecode[];
+extern const char *AcpiGbl_HeDecode[];
+extern const char *AcpiGbl_IoDecode[];
+extern const char *AcpiGbl_LlDecode[];
+extern const char *AcpiGbl_MaxDecode[];
+extern const char *AcpiGbl_MemDecode[];
+extern const char *AcpiGbl_MinDecode[];
+extern const char *AcpiGbl_MtpDecode[];
+extern const char *AcpiGbl_RngDecode[];
+extern const char *AcpiGbl_RwDecode[];
+extern const char *AcpiGbl_ShrDecode[];
+extern const char *AcpiGbl_SizDecode[];
+extern const char *AcpiGbl_TrsDecode[];
+extern const char *AcpiGbl_TtpDecode[];
+extern const char *AcpiGbl_TypDecode[];
+#endif
+
+/* Types for Resource descriptor entries */
+
+#define ACPI_INVALID_RESOURCE 0
+#define ACPI_FIXED_LENGTH 1
+#define ACPI_VARIABLE_LENGTH 2
+#define ACPI_SMALL_VARIABLE_LENGTH 3
+
+typedef
+ACPI_STATUS (*ACPI_WALK_AML_CALLBACK) (
+ UINT8 *Aml,
+ UINT32 Length,
+ UINT32 Offset,
+ UINT8 ResourceIndex,
+ void *Context);
+
typedef
ACPI_STATUS (*ACPI_PKG_CALLBACK) (
UINT8 ObjectType,
@@ -206,10 +247,6 @@ void
AcpiUtSubsystemShutdown (
void);
-ACPI_STATUS
-AcpiUtValidateFadt (
- void);
-
/*
* utclib - Local implementations of C library functions
@@ -435,29 +472,34 @@ AcpiUtPtrExit (
UINT8 *Ptr);
void
-AcpiUtReportInfo (
- char *ModuleName,
- UINT32 LineNumber,
- UINT32 ComponentId);
+AcpiUtDumpBuffer (
+ UINT8 *Buffer,
+ UINT32 Count,
+ UINT32 Display,
+ UINT32 componentId);
+
+void
+AcpiUtDumpBuffer2 (
+ UINT8 *Buffer,
+ UINT32 Count,
+ UINT32 Display);
void
AcpiUtReportError (
char *ModuleName,
- UINT32 LineNumber,
- UINT32 ComponentId);
+ UINT32 LineNumber);
void
-AcpiUtReportWarning (
+AcpiUtReportInfo (
char *ModuleName,
- UINT32 LineNumber,
- UINT32 ComponentId);
+ UINT32 LineNumber);
void
-AcpiUtDumpBuffer (
- UINT8 *Buffer,
- UINT32 Count,
- UINT32 Display,
- UINT32 componentId);
+AcpiUtReportWarning (
+ char *ModuleName,
+ UINT32 LineNumber);
+
+/* Error and message reporting interfaces */
void ACPI_INTERNAL_VAR_XFACE
AcpiUtDebugPrint (
@@ -467,7 +509,7 @@ AcpiUtDebugPrint (
char *ModuleName,
UINT32 ComponentId,
char *Format,
- ...) ACPI_PRINTF_LIKE_FUNC;
+ ...) ACPI_PRINTF_LIKE(6);
void ACPI_INTERNAL_VAR_XFACE
AcpiUtDebugPrintRaw (
@@ -477,7 +519,36 @@ AcpiUtDebugPrintRaw (
char *ModuleName,
UINT32 ComponentId,
char *Format,
- ...) ACPI_PRINTF_LIKE_FUNC;
+ ...) 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);
/*
@@ -665,6 +736,14 @@ AcpiUtShortDivide (
/*
* utmisc
*/
+const char *
+AcpiUtValidateException (
+ ACPI_STATUS Status);
+
+BOOLEAN
+AcpiUtIsAmlTable (
+ ACPI_TABLE_HEADER *Table);
+
ACPI_STATUS
AcpiUtAllocateOwnerId (
ACPI_OWNER_ID *OwnerId);
@@ -693,9 +772,14 @@ BOOLEAN
AcpiUtValidAcpiName (
UINT32 Name);
+ACPI_NAME
+AcpiUtRepairName (
+ char *Name);
+
BOOLEAN
-AcpiUtValidAcpiCharacter (
- char Character);
+AcpiUtValidAcpiChar (
+ char Character,
+ ACPI_NATIVE_UINT Position);
ACPI_STATUS
AcpiUtStrtoul64 (
@@ -708,27 +792,6 @@ AcpiUtStrtoul64 (
#define ACPI_ANY_BASE 0
UINT32
-AcpiUtGetDescriptorLength (
- void *Aml);
-
-UINT16
-AcpiUtGetResourceLength (
- void *Aml);
-
-UINT8
-AcpiUtGetResourceType (
- void *Aml);
-
-UINT8 *
-AcpiUtGetResourceEndTag (
- ACPI_OPERAND_OBJECT *ObjDesc);
-
-UINT8
-AcpiUtGenerateChecksum (
- UINT8 *Buffer,
- UINT32 Length);
-
-UINT32
AcpiUtDwordByteSwap (
UINT32 Value);
@@ -742,11 +805,47 @@ AcpiUtDisplayInitPathname (
UINT8 Type,
ACPI_NAMESPACE_NODE *ObjHandle,
char *Path);
-
#endif
/*
+ * utresrc
+ */
+ACPI_STATUS
+AcpiUtWalkAmlResources (
+ UINT8 *Aml,
+ ACPI_SIZE AmlLength,
+ ACPI_WALK_AML_CALLBACK UserFunction,
+ void *Context);
+
+ACPI_STATUS
+AcpiUtValidateResource (
+ void *Aml,
+ UINT8 *ReturnIndex);
+
+UINT32
+AcpiUtGetDescriptorLength (
+ void *Aml);
+
+UINT16
+AcpiUtGetResourceLength (
+ void *Aml);
+
+UINT8
+AcpiUtGetResourceHeaderLength (
+ void *Aml);
+
+UINT8
+AcpiUtGetResourceType (
+ void *Aml);
+
+ACPI_STATUS
+AcpiUtGetResourceEndTag (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ UINT8 **EndTag);
+
+
+/*
* utmutex - mutex support
*/
ACPI_STATUS
@@ -794,7 +893,7 @@ AcpiUtAllocate (
UINT32 Line);
void *
-AcpiUtCallocate (
+AcpiUtAllocateZeroed (
ACPI_SIZE Size,
UINT32 Component,
char *Module,
@@ -809,7 +908,7 @@ AcpiUtAllocateAndTrack (
UINT32 Line);
void *
-AcpiUtCallocateAndTrack (
+AcpiUtAllocateZeroedAndTrack (
ACPI_SIZE Size,
UINT32 Component,
char *Module,
@@ -830,6 +929,14 @@ void
AcpiUtDumpAllocations (
UINT32 Component,
char *Module);
+
+ACPI_STATUS
+AcpiUtCreateList (
+ char *ListName,
+ UINT16 ObjectSize,
+ ACPI_MEMORY_LIST **ReturnCache);
+
+
#endif
#endif /* _ACUTILS_H */
diff --git a/sys/contrib/dev/acpica/aecommon.h b/sys/contrib/dev/acpica/aecommon.h
index b9f4659..0dd1e5f 100644
--- a/sys/contrib/dev/acpica/aecommon.h
+++ b/sys/contrib/dev/acpica/aecommon.h
@@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -135,6 +135,7 @@
#include <contrib/dev/acpica/acapps.h>
extern FILE *AcpiGbl_DebugFile;
+extern BOOLEAN AcpiGbl_IgnoreErrors;
/*
* Debug Regions
@@ -145,6 +146,7 @@ typedef struct Region
UINT32 Length;
void *Buffer;
void *NextRegion;
+ UINT8 SpaceId;
} REGION;
@@ -229,7 +231,12 @@ AeDisplayAllMethods (
UINT32 DisplayCount);
ACPI_STATUS
-AeInstallHandlers (void);
+AeInstallHandlers (
+ void);
+
+void
+AeMiscellaneousTests (
+ void);
#endif /* _AECOMMON */
diff --git a/sys/contrib/dev/acpica/amlcode.h b/sys/contrib/dev/acpica/amlcode.h
index a48f1eb..6376b57 100644
--- a/sys/contrib/dev/acpica/amlcode.h
+++ b/sys/contrib/dev/acpica/amlcode.h
@@ -3,7 +3,7 @@
* 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.82 $
+ * $Revision: 1.86 $
*
*****************************************************************************/
@@ -11,7 +11,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -254,8 +254,10 @@
#define AML_DATA_REGION_OP (UINT16) 0x5b88 /* ACPI 2.0 */
-/* Bogus opcodes (they are actually two separate opcodes) */
-
+/*
+ * Combination opcodes (actually two one-byte opcodes)
+ * Used by the disassembler and iASL compiler
+ */
#define AML_LGREATEREQUAL_OP (UINT16) 0x9295
#define AML_LLESSEQUAL_OP (UINT16) 0x9294
#define AML_LNOTEQUAL_OP (UINT16) 0x9293
@@ -347,7 +349,7 @@
#define ARGI_DATAOBJECT 0x12 /* Buffer, String, package or reference to a Node - Used only by SizeOf operator*/
#define ARGI_COMPLEXOBJ 0x13 /* Buffer, String, or package (Used by INDEX op only) */
#define ARGI_REF_OR_STRING 0x14 /* Reference or String (Used by DEREFOF op only) */
-#define ARGI_REGION_OR_FIELD 0x15 /* Used by LOAD op only */
+#define ARGI_REGION_OR_BUFFER 0x15 /* Used by LOAD op only */
#define ARGI_DATAREFOBJ 0x16
/* Note: types above can expand to 0x1F maximum */
diff --git a/sys/contrib/dev/acpica/amlresrc.h b/sys/contrib/dev/acpica/amlresrc.h
index b934a1c..e5b19fa 100644
--- a/sys/contrib/dev/acpica/amlresrc.h
+++ b/sys/contrib/dev/acpica/amlresrc.h
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: amlresrc.h - AML resource descriptors
- * $Revision: 1.33 $
+ * $Revision: 1.40 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -115,41 +115,46 @@
*
*****************************************************************************/
+/* acpisrc:StructDefs -- for acpisrc conversion */
#ifndef __AMLRESRC_H
#define __AMLRESRC_H
-#define ASL_RESNAME_ADDRESS "_ADR"
-#define ASL_RESNAME_ALIGNMENT "_ALN"
-#define ASL_RESNAME_ADDRESSSPACE "_ASI"
-#define ASL_RESNAME_ACCESSSIZE "_ASZ"
-#define ASL_RESNAME_TYPESPECIFICATTRIBUTES "_ATT"
-#define ASL_RESNAME_BASEADDRESS "_BAS"
-#define ASL_RESNAME_BUSMASTER "_BM_" /* Master(1), Slave(0) */
-#define ASL_RESNAME_DECODE "_DEC"
-#define ASL_RESNAME_DMA "_DMA"
-#define ASL_RESNAME_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */
-#define ASL_RESNAME_GRANULARITY "_GRA"
-#define ASL_RESNAME_INTERRUPT "_INT"
-#define ASL_RESNAME_INTERRUPTLEVEL "_LL_" /* ActiveLo(1), ActiveHi(0) */
-#define ASL_RESNAME_INTERRUPTSHARE "_SHR" /* Shareable(1), NoShare(0) */
-#define ASL_RESNAME_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */
-#define ASL_RESNAME_LENGTH "_LEN"
-#define ASL_RESNAME_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */
-#define ASL_RESNAME_MEMTYPE "_MEM" /* NonCache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */
-#define ASL_RESNAME_MAXADDR "_MAX"
-#define ASL_RESNAME_MINADDR "_MIN"
-#define ASL_RESNAME_MAXTYPE "_MAF"
-#define ASL_RESNAME_MINTYPE "_MIF"
-#define ASL_RESNAME_REGISTERBITOFFSET "_RBO"
-#define ASL_RESNAME_REGISTERBITWIDTH "_RBW"
-#define ASL_RESNAME_RANGETYPE "_RNG"
-#define ASL_RESNAME_READWRITETYPE "_RW_" /* ReadOnly(0), Writeable (1) */
-#define ASL_RESNAME_TRANSLATION "_TRA"
-#define ASL_RESNAME_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */
-#define ASL_RESNAME_TYPE "_TTP" /* Translation(1), Static (0) */
-#define ASL_RESNAME_XFERTYPE "_SIZ" /* 8(0), 8And16(1), 16(2) */
+/*
+ * Resource descriptor tags, as defined in the ACPI specification.
+ * Used to symbolically reference fields within a descriptor.
+ */
+#define ACPI_RESTAG_ADDRESS "_ADR"
+#define ACPI_RESTAG_ALIGNMENT "_ALN"
+#define ACPI_RESTAG_ADDRESSSPACE "_ASI"
+#define ACPI_RESTAG_ACCESSSIZE "_ASZ"
+#define ACPI_RESTAG_TYPESPECIFICATTRIBUTES "_ATT"
+#define ACPI_RESTAG_BASEADDRESS "_BAS"
+#define ACPI_RESTAG_BUSMASTER "_BM_" /* Master(1), Slave(0) */
+#define ACPI_RESTAG_DECODE "_DEC"
+#define ACPI_RESTAG_DMA "_DMA"
+#define ACPI_RESTAG_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */
+#define ACPI_RESTAG_GRANULARITY "_GRA"
+#define ACPI_RESTAG_INTERRUPT "_INT"
+#define ACPI_RESTAG_INTERRUPTLEVEL "_LL_" /* ActiveLo(1), ActiveHi(0) */
+#define ACPI_RESTAG_INTERRUPTSHARE "_SHR" /* Shareable(1), NoShare(0) */
+#define ACPI_RESTAG_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */
+#define ACPI_RESTAG_LENGTH "_LEN"
+#define ACPI_RESTAG_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */
+#define ACPI_RESTAG_MEMTYPE "_MEM" /* NonCache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */
+#define ACPI_RESTAG_MAXADDR "_MAX"
+#define ACPI_RESTAG_MINADDR "_MIN"
+#define ACPI_RESTAG_MAXTYPE "_MAF"
+#define ACPI_RESTAG_MINTYPE "_MIF"
+#define ACPI_RESTAG_REGISTERBITOFFSET "_RBO"
+#define ACPI_RESTAG_REGISTERBITWIDTH "_RBW"
+#define ACPI_RESTAG_RANGETYPE "_RNG"
+#define ACPI_RESTAG_READWRITETYPE "_RW_" /* ReadOnly(0), Writeable (1) */
+#define ACPI_RESTAG_TRANSLATION "_TRA"
+#define ACPI_RESTAG_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */
+#define ACPI_RESTAG_TYPE "_TTP" /* Translation(1), Static (0) */
+#define ACPI_RESTAG_XFERTYPE "_SIZ" /* 8(0), 8And16(1), 16(2) */
/* Default sizes for "small" resource descriptors */
@@ -165,13 +170,18 @@
typedef struct asl_resource_node
{
- UINT32 BufferLength;
- void *Buffer;
- struct asl_resource_node *Next;
+ UINT32 BufferLength;
+ void *Buffer;
+ struct asl_resource_node *Next;
} ASL_RESOURCE_NODE;
+/* Macros used to generate AML resource length fields */
+
+#define ACPI_AML_SIZE_LARGE(r) (sizeof (r) - sizeof (AML_RESOURCE_LARGE_HEADER))
+#define ACPI_AML_SIZE_SMALL(r) (sizeof (r) - sizeof (AML_RESOURCE_SMALL_HEADER))
+
/*
* Resource descriptors defined in the ACPI specification.
*
@@ -184,7 +194,7 @@ typedef struct asl_resource_node
* SMALL descriptors
*/
#define AML_RESOURCE_SMALL_HEADER_COMMON \
- UINT8 DescriptorType;
+ UINT8 DescriptorType;
typedef struct aml_resource_small_header
{
@@ -196,8 +206,8 @@ typedef struct aml_resource_small_header
typedef struct aml_resource_irq
{
AML_RESOURCE_SMALL_HEADER_COMMON
- UINT16 IrqMask;
- UINT8 Flags;
+ UINT16 IrqMask;
+ UINT8 Flags;
} AML_RESOURCE_IRQ;
@@ -205,7 +215,7 @@ typedef struct aml_resource_irq
typedef struct aml_resource_irq_noflags
{
AML_RESOURCE_SMALL_HEADER_COMMON
- UINT16 IrqMask;
+ UINT16 IrqMask;
} AML_RESOURCE_IRQ_NOFLAGS;
@@ -213,8 +223,8 @@ typedef struct aml_resource_irq_noflags
typedef struct aml_resource_dma
{
AML_RESOURCE_SMALL_HEADER_COMMON
- UINT8 DmaChannelMask;
- UINT8 Flags;
+ UINT8 DmaChannelMask;
+ UINT8 Flags;
} AML_RESOURCE_DMA;
@@ -222,7 +232,7 @@ typedef struct aml_resource_dma
typedef struct aml_resource_start_dependent
{
AML_RESOURCE_SMALL_HEADER_COMMON
- UINT8 Flags;
+ UINT8 Flags;
} AML_RESOURCE_START_DEPENDENT;
@@ -244,11 +254,11 @@ typedef struct aml_resource_end_dependent
typedef struct aml_resource_io
{
AML_RESOURCE_SMALL_HEADER_COMMON
- UINT8 Flags;
- UINT16 Minimum;
- UINT16 Maximum;
- UINT8 Alignment;
- UINT8 AddressLength;
+ UINT8 Flags;
+ UINT16 Minimum;
+ UINT16 Maximum;
+ UINT8 Alignment;
+ UINT8 AddressLength;
} AML_RESOURCE_IO;
@@ -256,8 +266,8 @@ typedef struct aml_resource_io
typedef struct aml_resource_fixed_io
{
AML_RESOURCE_SMALL_HEADER_COMMON
- UINT16 Address;
- UINT8 AddressLength;
+ UINT16 Address;
+ UINT8 AddressLength;
} AML_RESOURCE_FIXED_IO;
@@ -272,7 +282,7 @@ typedef struct aml_resource_vendor_small
typedef struct aml_resource_end_tag
{
AML_RESOURCE_SMALL_HEADER_COMMON
- UINT8 Checksum;
+ UINT8 Checksum;
} AML_RESOURCE_END_TAG;
@@ -281,8 +291,8 @@ typedef struct aml_resource_end_tag
* LARGE descriptors
*/
#define AML_RESOURCE_LARGE_HEADER_COMMON \
- UINT8 DescriptorType;\
- UINT16 ResourceLength;
+ UINT8 DescriptorType;\
+ UINT16 ResourceLength;
typedef struct aml_resource_large_header
{
@@ -294,11 +304,11 @@ typedef struct aml_resource_large_header
typedef struct aml_resource_memory24
{
AML_RESOURCE_LARGE_HEADER_COMMON
- UINT8 Flags;
- UINT16 Minimum;
- UINT16 Maximum;
- UINT16 Alignment;
- UINT16 AddressLength;
+ UINT8 Flags;
+ UINT16 Minimum;
+ UINT16 Maximum;
+ UINT16 Alignment;
+ UINT16 AddressLength;
} AML_RESOURCE_MEMORY24;
@@ -313,11 +323,11 @@ typedef struct aml_resource_vendor_large
typedef struct aml_resource_memory32
{
AML_RESOURCE_LARGE_HEADER_COMMON
- UINT8 Flags;
- UINT32 Minimum;
- UINT32 Maximum;
- UINT32 Alignment;
- UINT32 AddressLength;
+ UINT8 Flags;
+ UINT32 Minimum;
+ UINT32 Maximum;
+ UINT32 Alignment;
+ UINT32 AddressLength;
} AML_RESOURCE_MEMORY32;
@@ -325,17 +335,17 @@ typedef struct aml_resource_memory32
typedef struct aml_resource_fixed_memory32
{
AML_RESOURCE_LARGE_HEADER_COMMON
- UINT8 Flags;
- UINT32 Address;
- UINT32 AddressLength;
+ UINT8 Flags;
+ UINT32 Address;
+ UINT32 AddressLength;
} AML_RESOURCE_FIXED_MEMORY32;
#define AML_RESOURCE_ADDRESS_COMMON \
- UINT8 ResourceType; \
- UINT8 Flags; \
- UINT8 SpecificFlags;
+ UINT8 ResourceType; \
+ UINT8 Flags; \
+ UINT8 SpecificFlags;
typedef struct aml_resource_address
@@ -350,14 +360,14 @@ typedef struct aml_resource_extended_address64
{
AML_RESOURCE_LARGE_HEADER_COMMON
AML_RESOURCE_ADDRESS_COMMON
- UINT8 RevisionID;
- UINT8 Reserved;
- UINT64 Granularity;
- UINT64 Minimum;
- UINT64 Maximum;
- UINT64 TranslationOffset;
- UINT64 AddressLength;
- UINT64 TypeSpecific;
+ UINT8 RevisionID;
+ UINT8 Reserved;
+ UINT64 Granularity;
+ UINT64 Minimum;
+ UINT64 Maximum;
+ UINT64 TranslationOffset;
+ UINT64 AddressLength;
+ UINT64 TypeSpecific;
} AML_RESOURCE_EXTENDED_ADDRESS64;
@@ -368,11 +378,11 @@ typedef struct aml_resource_address64
{
AML_RESOURCE_LARGE_HEADER_COMMON
AML_RESOURCE_ADDRESS_COMMON
- UINT64 Granularity;
- UINT64 Minimum;
- UINT64 Maximum;
- UINT64 TranslationOffset;
- UINT64 AddressLength;
+ UINT64 Granularity;
+ UINT64 Minimum;
+ UINT64 Maximum;
+ UINT64 TranslationOffset;
+ UINT64 AddressLength;
} AML_RESOURCE_ADDRESS64;
@@ -381,11 +391,11 @@ typedef struct aml_resource_address32
{
AML_RESOURCE_LARGE_HEADER_COMMON
AML_RESOURCE_ADDRESS_COMMON
- UINT32 Granularity;
- UINT32 Minimum;
- UINT32 Maximum;
- UINT32 TranslationOffset;
- UINT32 AddressLength;
+ UINT32 Granularity;
+ UINT32 Minimum;
+ UINT32 Maximum;
+ UINT32 TranslationOffset;
+ UINT32 AddressLength;
} AML_RESOURCE_ADDRESS32;
@@ -394,11 +404,11 @@ typedef struct aml_resource_address16
{
AML_RESOURCE_LARGE_HEADER_COMMON
AML_RESOURCE_ADDRESS_COMMON
- UINT16 Granularity;
- UINT16 Minimum;
- UINT16 Maximum;
- UINT16 TranslationOffset;
- UINT16 AddressLength;
+ UINT16 Granularity;
+ UINT16 Minimum;
+ UINT16 Maximum;
+ UINT16 TranslationOffset;
+ UINT16 AddressLength;
} AML_RESOURCE_ADDRESS16;
@@ -406,9 +416,9 @@ typedef struct aml_resource_address16
typedef struct aml_resource_extended_irq
{
AML_RESOURCE_LARGE_HEADER_COMMON
- UINT8 Flags;
- UINT8 InterruptCount;
- UINT32 Interrupts[1];
+ UINT8 Flags;
+ UINT8 InterruptCount;
+ UINT32 Interrupts[1];
/* ResSourceIndex, ResSource optional fields follow */
} AML_RESOURCE_EXTENDED_IRQ;
@@ -417,11 +427,11 @@ typedef struct aml_resource_extended_irq
typedef struct aml_resource_generic_register
{
AML_RESOURCE_LARGE_HEADER_COMMON
- UINT8 AddressSpaceId;
- UINT8 BitWidth;
- UINT8 BitOffset;
- UINT8 AccessSize; /* ACPI 3.0, was previously Reserved */
- UINT64 Address;
+ UINT8 AddressSpaceId;
+ UINT8 BitWidth;
+ UINT8 BitOffset;
+ UINT8 AccessSize; /* ACPI 3.0, was previously Reserved */
+ UINT64 Address;
} AML_RESOURCE_GENERIC_REGISTER;
@@ -435,42 +445,42 @@ typedef union aml_resource
{
/* Descriptor headers */
- AML_RESOURCE_SMALL_HEADER SmallHeader;
- AML_RESOURCE_LARGE_HEADER LargeHeader;
+ UINT8 DescriptorType;
+ AML_RESOURCE_SMALL_HEADER SmallHeader;
+ AML_RESOURCE_LARGE_HEADER LargeHeader;
/* Small resource descriptors */
- AML_RESOURCE_IRQ Irq;
- AML_RESOURCE_DMA Dma;
- AML_RESOURCE_START_DEPENDENT StartDpf;
- AML_RESOURCE_END_DEPENDENT EndDpf;
- AML_RESOURCE_IO Io;
- AML_RESOURCE_FIXED_IO FixedIo;
- AML_RESOURCE_VENDOR_SMALL VendorSmall;
- AML_RESOURCE_END_TAG EndTag;
+ AML_RESOURCE_IRQ Irq;
+ AML_RESOURCE_DMA Dma;
+ AML_RESOURCE_START_DEPENDENT StartDpf;
+ AML_RESOURCE_END_DEPENDENT EndDpf;
+ AML_RESOURCE_IO Io;
+ AML_RESOURCE_FIXED_IO FixedIo;
+ AML_RESOURCE_VENDOR_SMALL VendorSmall;
+ AML_RESOURCE_END_TAG EndTag;
/* Large resource descriptors */
- AML_RESOURCE_MEMORY24 Memory24;
- AML_RESOURCE_GENERIC_REGISTER GenericReg;
- AML_RESOURCE_VENDOR_LARGE VendorLarge;
- AML_RESOURCE_MEMORY32 Memory32;
- AML_RESOURCE_FIXED_MEMORY32 FixedMemory32;
- AML_RESOURCE_ADDRESS16 Address16;
- AML_RESOURCE_ADDRESS32 Address32;
- AML_RESOURCE_ADDRESS64 Address64;
- AML_RESOURCE_EXTENDED_ADDRESS64 ExtAddress64;
- AML_RESOURCE_EXTENDED_IRQ ExtendedIrq;
+ AML_RESOURCE_MEMORY24 Memory24;
+ AML_RESOURCE_GENERIC_REGISTER GenericReg;
+ AML_RESOURCE_VENDOR_LARGE VendorLarge;
+ AML_RESOURCE_MEMORY32 Memory32;
+ AML_RESOURCE_FIXED_MEMORY32 FixedMemory32;
+ AML_RESOURCE_ADDRESS16 Address16;
+ AML_RESOURCE_ADDRESS32 Address32;
+ AML_RESOURCE_ADDRESS64 Address64;
+ AML_RESOURCE_EXTENDED_ADDRESS64 ExtAddress64;
+ AML_RESOURCE_EXTENDED_IRQ ExtendedIrq;
/* Utility overlays */
- AML_RESOURCE_ADDRESS Address;
- UINT32 U32Item;
- UINT16 U16Item;
- UINT8 U8Item;
+ AML_RESOURCE_ADDRESS Address;
+ UINT32 DwordItem;
+ UINT16 WordItem;
+ UINT8 ByteItem;
} AML_RESOURCE;
-
#endif
diff --git a/sys/contrib/dev/acpica/common/adfile.c b/sys/contrib/dev/acpica/common/adfile.c
new file mode 100644
index 0000000..732b2bb
--- /dev/null
+++ b/sys/contrib/dev/acpica/common/adfile.c
@@ -0,0 +1,398 @@
+/******************************************************************************
+ *
+ * Module Name: adfile - Application-level disassembler file support routines
+ * $Revision: 1.3 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 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.
+ *
+ *****************************************************************************/
+
+
+#include <contrib/dev/acpica/acpi.h>
+#include <contrib/dev/acpica/acapps.h>
+
+#include <stdio.h>
+#include <string.h>
+
+
+#define _COMPONENT ACPI_TOOLS
+ ACPI_MODULE_NAME ("adfile")
+
+
+char FilenameBuf[20];
+
+/******************************************************************************
+ *
+ * FUNCTION: AfGenerateFilename
+ *
+ * PARAMETERS: Prefix - prefix string
+ * TableId - The table ID
+ *
+ * RETURN: Pointer to the completed string
+ *
+ * DESCRIPTION: Build an output filename from an ACPI table ID string
+ *
+ ******************************************************************************/
+
+char *
+AdGenerateFilename (
+ char *Prefix,
+ char *TableId)
+{
+ ACPI_NATIVE_UINT i;
+ ACPI_NATIVE_UINT j;
+
+
+ for (i = 0; Prefix[i]; i++)
+ {
+ FilenameBuf[i] = Prefix[i];
+ }
+
+ FilenameBuf[i] = '_';
+ i++;
+
+ for (j = 0; j < 8 && (TableId[j] != ' ') && (TableId[j] != 0); i++, j++)
+ {
+ FilenameBuf[i] = TableId[j];
+ }
+
+ FilenameBuf[i] = 0;
+ strcat (FilenameBuf, ACPI_TABLE_FILE_SUFFIX);
+ return FilenameBuf;
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AfWriteBuffer
+ *
+ * PARAMETERS: Filename - name of file
+ * Buffer - data to write
+ * Length - length of data
+ *
+ * RETURN: Actual number of bytes written
+ *
+ * DESCRIPTION: Open a file and write out a single buffer
+ *
+ ******************************************************************************/
+
+ACPI_NATIVE_INT
+AdWriteBuffer (
+ char *Filename,
+ char *Buffer,
+ UINT32 Length)
+{
+ FILE *fp;
+ ACPI_SIZE Actual;
+
+
+ fp = fopen (Filename, "wb");
+ if (!fp)
+ {
+ printf ("Couldn't open %s\n", Filename);
+ return (-1);
+ }
+
+ Actual = fwrite (Buffer, (size_t) Length, 1, fp);
+ fclose (fp);
+ return ((ACPI_NATIVE_INT) Actual);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AfWriteTable
+ *
+ * PARAMETERS: Table - pointer to the ACPI table
+ * Length - length of the table
+ * TableName - the table signature
+ * OemTableID - from the table header
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Dump the loaded tables to a file (or files)
+ *
+ ******************************************************************************/
+
+void
+AdWriteTable (
+ ACPI_TABLE_HEADER *Table,
+ UINT32 Length,
+ char *TableName,
+ char *OemTableId)
+{
+ char *Filename;
+
+
+ Filename = AdGenerateFilename (TableName, OemTableId);
+ AdWriteBuffer (Filename, (char *) Table, Length);
+
+ AcpiOsPrintf ("Table [%s] written to \"%s\"\n", TableName, Filename);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: FlGenerateFilename
+ *
+ * PARAMETERS: InputFilename - Original ASL source filename
+ * Suffix - New extension.
+ *
+ * RETURN: New filename containing the original base + the new suffix
+ *
+ * DESCRIPTION: Generate a new filename from the ASL source filename and a new
+ * extension. Used to create the *.LST, *.TXT, etc. files.
+ *
+ ******************************************************************************/
+
+char *
+FlGenerateFilename (
+ char *InputFilename,
+ char *Suffix)
+{
+ char *Position;
+ char *NewFilename;
+
+
+ /*
+ * Copy the original filename to a new buffer. Leave room for the worst case
+ * where we append the suffix, an added dot and the null terminator.
+ */
+ NewFilename = ACPI_ALLOCATE_ZEROED (
+ strlen (InputFilename) + strlen (Suffix) + 2);
+ strcpy (NewFilename, InputFilename);
+
+ /* Try to find the last dot in the filename */
+
+ Position = strrchr (NewFilename, '.');
+ if (Position)
+ {
+ /* Tack on the new suffix */
+
+ Position++;
+ *Position = 0;
+ strcat (Position, Suffix);
+ }
+ else
+ {
+ /* No dot, add one and then the suffix */
+
+ strcat (NewFilename, ".");
+ strcat (NewFilename, Suffix);
+ }
+
+ return NewFilename;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: FlStrdup
+ *
+ * DESCRIPTION: Local strdup function
+ *
+ ******************************************************************************/
+
+static char *
+FlStrdup (
+ char *String)
+{
+ char *NewString;
+
+
+ NewString = ACPI_ALLOCATE (strlen (String) + 1);
+ if (!NewString)
+ {
+ return (NULL);
+ }
+
+ strcpy (NewString, String);
+ return (NewString);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: FlSplitInputPathname
+ *
+ * PARAMETERS: InputFilename - The user-specified ASL source file to be
+ * compiled
+ * OutDirectoryPath - Where the directory path prefix is
+ * returned
+ * OutFilename - Where the filename part is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Split the input path into a directory and filename part
+ * 1) Directory part used to open include files
+ * 2) Filename part used to generate output filenames
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+FlSplitInputPathname (
+ char *InputPath,
+ char **OutDirectoryPath,
+ char **OutFilename)
+{
+ char *Substring;
+ char *DirectoryPath;
+ char *Filename;
+
+
+ *OutDirectoryPath = NULL;
+ *OutFilename = NULL;
+
+ if (!InputPath)
+ {
+ return (AE_OK);
+ }
+
+ /* Get the path to the input filename's directory */
+
+ DirectoryPath = FlStrdup (InputPath);
+ if (!DirectoryPath)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ Substring = strrchr (DirectoryPath, '\\');
+ if (!Substring)
+ {
+ Substring = strrchr (DirectoryPath, '/');
+ if (!Substring)
+ {
+ Substring = strrchr (DirectoryPath, ':');
+ }
+ }
+
+ if (!Substring)
+ {
+ DirectoryPath[0] = 0;
+ Filename = FlStrdup (InputPath);
+ }
+ else
+ {
+ Filename = FlStrdup (Substring + 1);
+ *(Substring+1) = 0;
+ }
+
+ if (!Filename)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ *OutDirectoryPath = DirectoryPath;
+ *OutFilename = Filename;
+
+ return (AE_OK);
+}
+
+
diff --git a/sys/contrib/dev/acpica/common/adisasm.c b/sys/contrib/dev/acpica/common/adisasm.c
index 472f1ba..843a9a8 100644
--- a/sys/contrib/dev/acpica/common/adisasm.c
+++ b/sys/contrib/dev/acpica/common/adisasm.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: adisasm - Application-level disassembler routines
- * $Revision: 1.77 $
+ * $Revision: 1.104 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -122,20 +122,42 @@
#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 <stdio.h>
-#include <string.h>
#include <time.h>
#define _COMPONENT ACPI_TOOLS
ACPI_MODULE_NAME ("adisasm")
+extern int AslCompilerdebug;
-ACPI_PARSE_OBJECT *AcpiGbl_ParsedNamespaceRoot;
+ACPI_STATUS
+LsDisplayNamespace (
+ void);
+
+void
+LsSetupNsList (void * Handle);
+
+
+/* Local prototypes */
+
+void
+AdCreateTableHeader (
+ char *Filename,
+ ACPI_TABLE_HEADER *Table);
+
+void
+AdDisassemblerHeader (
+ char *Filename);
+
+ACPI_PARSE_OBJECT *AcpiGbl_ParseOpRoot;
+/* Stubs for ASL compiler */
+
#ifndef ACPI_ASL_COMPILER
BOOLEAN
AcpiDsIsResultUsed (
@@ -144,9 +166,26 @@ AcpiDsIsResultUsed (
{
return TRUE;
}
+
+ACPI_STATUS
+AcpiDsMethodError (
+ ACPI_STATUS Status,
+ ACPI_WALK_STATE *WalkState)
+{
+ return (Status);
+}
+
#endif
ACPI_STATUS
+AcpiNsLoadTable (
+ ACPI_NATIVE_UINT TableIndex,
+ ACPI_NAMESPACE_NODE *Node)
+{
+ return (AE_NOT_IMPLEMENTED);
+}
+
+ACPI_STATUS
AcpiDsRestartControlMethod (
ACPI_WALK_STATE *WalkState,
ACPI_OPERAND_OBJECT *ReturnDesc)
@@ -156,6 +195,7 @@ AcpiDsRestartControlMethod (
void
AcpiDsTerminateControlMethod (
+ ACPI_OPERAND_OBJECT *MethodDesc,
ACPI_WALK_STATE *WalkState)
{
return;
@@ -180,118 +220,7 @@ AcpiDsMethodDataInitArgs (
}
-#define FILE_SUFFIX_DISASSEMBLY "dsl"
-#define ACPI_TABLE_FILE_SUFFIX ".dat"
-char FilenameBuf[20];
-
-/******************************************************************************
- *
- * FUNCTION: AfGenerateFilename
- *
- * PARAMETERS: Prefix - prefix string
- * TableId - The table ID
- *
- * RETURN: Pointer to the completed string
- *
- * DESCRIPTION: Build an output filename from an ACPI table ID string
- *
- ******************************************************************************/
-
-char *
-AdGenerateFilename (
- char *Prefix,
- char *TableId)
-{
- ACPI_NATIVE_UINT i;
- ACPI_NATIVE_UINT j;
-
-
- for (i = 0; Prefix[i]; i++)
- {
- FilenameBuf[i] = Prefix[i];
- }
-
- FilenameBuf[i] = '_';
- i++;
-
- for (j = 0; j < 8 && (TableId[j] != ' ') && (TableId[j] != 0); i++, j++)
- {
- FilenameBuf[i] = TableId[j];
- }
-
- FilenameBuf[i] = 0;
- strcat (FilenameBuf, ACPI_TABLE_FILE_SUFFIX);
- return FilenameBuf;
-}
-
-
-/******************************************************************************
- *
- * FUNCTION: AfWriteBuffer
- *
- * PARAMETERS: Filename - name of file
- * Buffer - data to write
- * Length - length of data
- *
- * RETURN: Actual number of bytes written
- *
- * DESCRIPTION: Open a file and write out a single buffer
- *
- ******************************************************************************/
-
-ACPI_NATIVE_INT
-AdWriteBuffer (
- char *Filename,
- char *Buffer,
- UINT32 Length)
-{
- FILE *fp;
- ACPI_NATIVE_INT Actual;
-
-
- fp = fopen (Filename, "wb");
- if (!fp)
- {
- printf ("Couldn't open %s\n", Filename);
- return -1;
- }
-
- Actual = fwrite (Buffer, (size_t) Length, 1, fp);
- fclose (fp);
- return Actual;
-}
-
-
-/******************************************************************************
- *
- * FUNCTION: AfWriteTable
- *
- * PARAMETERS: Table - pointer to the ACPI table
- * Length - length of the table
- * TableName - the table signature
- * OemTableID - from the table header
- *
- * RETURN: None
- *
- * DESCRIPTION: Dump the loaded tables to a file (or files)
- *
- ******************************************************************************/
-
-void
-AdWriteTable (
- ACPI_TABLE_HEADER *Table,
- UINT32 Length,
- char *TableName,
- char *OemTableId)
-{
- char *Filename;
-
-
- Filename = AdGenerateFilename (TableName, OemTableId);
- AdWriteBuffer (Filename, (char *) Table, Length);
-
- AcpiOsPrintf ("Table [%s] written to \"%s\"\n", TableName, Filename);
-}
+ACPI_TABLE_DESC LocalTables[1];
/*******************************************************************************
@@ -315,7 +244,9 @@ AdInitialize (
/* ACPI CA subsystem initialization */
+ Status = AcpiOsInitialize ();
AcpiUtInitGlobals ();
+
Status = AcpiUtMutexInitialize ();
if (ACPI_FAILURE (Status))
{
@@ -323,136 +254,92 @@ AdInitialize (
}
Status = AcpiNsRootInitialize ();
+ if (ACPI_FAILURE (Status))
+ {
+ return Status;
+ }
+
+ /* Setup the Table Manager (cheat - there is no RSDT) */
+
+ AcpiGbl_RootTableList.Size = 1;
+ AcpiGbl_RootTableList.Count = 0;
+ AcpiGbl_RootTableList.Tables = LocalTables;
+
return Status;
}
/*******************************************************************************
*
- * FUNCTION: FlGenerateFilename
+ * FUNCTION: AdAddExternalsToNamespace
*
- * PARAMETERS: InputFilename - Original ASL source filename
- * Suffix - New extension.
+ * PARAMETERS:
*
- * RETURN: New filename containing the original base + the new suffix
+ * RETURN: Status
*
- * DESCRIPTION: Generate a new filename from the ASL source filename and a new
- * extension. Used to create the *.LST, *.TXT, etc. files.
+ * DESCRIPTION:
*
******************************************************************************/
-char *
-FlGenerateFilename (
- char *InputFilename,
- char *Suffix)
+void
+AdAddExternalsToNamespace (
+ void)
{
- char *Position;
- char *NewFilename;
-
-
- /* Copy the original filename to a new buffer */
-
- NewFilename = ACPI_MEM_CALLOCATE (strlen (InputFilename) + strlen (Suffix));
- strcpy (NewFilename, InputFilename);
+ ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_EXTERNAL_LIST *External = AcpiGbl_ExternalList;
+ ACPI_OPERAND_OBJECT *MethodDesc;
- /* Try to find the last dot in the filename */
- Position = strrchr (NewFilename, '.');
- if (Position)
+ while (External)
{
- /* Tack on the new suffix */
+ Status = AcpiNsLookup (NULL, External->InternalPath, External->Type,
+ ACPI_IMODE_LOAD_PASS1, ACPI_NS_EXTERNAL | ACPI_NS_DONT_OPEN_SCOPE,
+ NULL, &Node);
- Position++;
- *Position = 0;
- strcat (Position, Suffix);
- }
- else
- {
- /* No dot, add one and then the suffix */
+ if (External->Type == ACPI_TYPE_METHOD)
+ {
+ MethodDesc = AcpiUtCreateInternalObject (ACPI_TYPE_METHOD);
+ MethodDesc->Method.ParamCount = (UINT8) External->Value;
+ Node->Object = MethodDesc;
+ }
- strcat (NewFilename, ".");
- strcat (NewFilename, Suffix);
+ External = External->Next;
}
-
- return NewFilename;
}
/*******************************************************************************
*
- * FUNCTION: FlSplitInputPathname
+ * FUNCTION: AdMethodExternalCount
*
- * PARAMETERS: InputFilename - The user-specified ASL source file to be
- * compiled
- * OutDirectoryPath - Where the directory path prefix is
- * returned
- * OutFilename - Where the filename part is returned
+ * PARAMETERS: None
*
* RETURN: Status
*
- * DESCRIPTION: Split the input path into a directory and filename part
- * 1) Directory part used to open include files
- * 2) Filename part used to generate output filenames
+ * DESCRIPTION: Return the number of externals that have been generated
*
******************************************************************************/
-ACPI_STATUS
-FlSplitInputPathname (
- char *InputPath,
- char **OutDirectoryPath,
- char **OutFilename)
+UINT32
+AdMethodExternalCount (
+ void)
{
- char *Substring;
- char *DirectoryPath;
- char *Filename;
+ ACPI_EXTERNAL_LIST *External = AcpiGbl_ExternalList;
+ UINT32 Count = 0;
- *OutDirectoryPath = NULL;
- *OutFilename = NULL;
-
- if (!InputPath)
- {
- return (AE_OK);
- }
-
- /* Get the path to the input filename's directory */
-
- DirectoryPath = strdup (InputPath);
- if (!DirectoryPath)
+ while (External)
{
- return (AE_NO_MEMORY);
- }
-
- Substring = strrchr (DirectoryPath, '\\');
- if (!Substring)
- {
- Substring = strrchr (DirectoryPath, '/');
- if (!Substring)
+ if (External->Type == ACPI_TYPE_METHOD)
{
- Substring = strrchr (DirectoryPath, ':');
+ Count++;
}
- }
- if (!Substring)
- {
- DirectoryPath[0] = 0;
- Filename = strdup (InputPath);
- }
- else
- {
- Filename = strdup (Substring + 1);
- *(Substring+1) = 0;
+ External = External->Next;
}
- if (!Filename)
- {
- return (AE_NO_MEMORY);
- }
-
- *OutDirectoryPath = DirectoryPath;
- *OutFilename = Filename;
-
- return (AE_OK);
+ return (Count);
}
@@ -472,6 +359,8 @@ FlSplitInputPathname (
*
*****************************************************************************/
+extern char *Gbl_ExternalFilename;
+
ACPI_STATUS
AdAmlDisassemble (
BOOLEAN OutToFile,
@@ -484,6 +373,7 @@ AdAmlDisassemble (
char *DisasmFilename = NULL;
FILE *File = NULL;
ACPI_TABLE_HEADER *Table;
+ ACPI_TABLE_HEADER *ExternalTable;
/*
@@ -497,6 +387,15 @@ AdAmlDisassemble (
{
return Status;
}
+
+ if (Gbl_ExternalFilename)
+ {
+ Status = AcpiDbGetTableFromFile (Gbl_ExternalFilename, &ExternalTable);
+ if (ACPI_FAILURE (Status))
+ {
+ return Status;
+ }
+ }
}
else
{
@@ -513,11 +412,18 @@ AdAmlDisassemble (
return AE_OK;
}
- /* Obtained the local tables, just disassmeble the DSDT */
+ /* Obtained the local tables, just disassemble the DSDT */
+
+ Status = AcpiGetTable (ACPI_SIG_DSDT, 0, &Table);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Could not get DSDT, %s\n",
+ AcpiFormatException (Status));
+ return Status;
+ }
- Table = AcpiGbl_DSDT;
AcpiOsPrintf ("\nDisassembly of DSDT\n");
- Prefix = AdGenerateFilename ("dsdt", AcpiGbl_DSDT->OemTableId);
+ Prefix = AdGenerateFilename ("dsdt", Table->OemTableId);
}
/*
@@ -539,7 +445,7 @@ AdAmlDisassemble (
File = fopen (DisasmFilename, "w+");
if (!File)
{
- fprintf (stderr, "Could not open output file\n");
+ fprintf (stderr, "Could not open output file %s\n", DisasmFilename);
Status = AE_ERROR;
goto Cleanup;
}
@@ -549,50 +455,173 @@ AdAmlDisassemble (
*OutFilename = DisasmFilename;
- /* Always parse the tables, only option is what to display */
-
- Status = AdParseTable (Table);
- if (ACPI_FAILURE (Status))
+ if (!AcpiUtIsAmlTable (Table))
{
- AcpiOsPrintf ("Could not parse ACPI tables, %s\n",
- AcpiFormatException (Status));
- goto Cleanup;
+ AdDisassemblerHeader (Filename);
+ AcpiOsPrintf (" * ACPI Data Table [%4.4s]\n *\n",
+ Table->Signature);
+ AcpiOsPrintf (" * Format: [HexOffset DecimalOffset ByteLength] FieldName : FieldValue\n */\n\n");
+
+ AcpiDmDumpDataTable (Table);
+ fprintf (stderr, "Acpi Data Table [%4.4s] decoded, written to \"%s\"\n",
+ Table->Signature, DisasmFilename);
}
+ else
+ {
+ /* Always parse the tables, only option is what to display */
- /*
- * TBD: We want to cross reference the namespace here, in order to
- * generate External() statements. The problem is that the parse
- * tree is in run-time (interpreter) format, not compiler format,
- * so we cannot directly use the function below:
- *
- * Status = LkCrossReferenceNamespace ();
- *
- * We need to either convert the parse tree or create a new
- * cross ref function that can handle interpreter parse trees
- */
+ Status = AdParseTable (Table);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Could not parse ACPI tables, %s\n",
+ AcpiFormatException (Status));
+ goto Cleanup;
+ }
- /* Optional displays */
+ if (AslCompilerdebug)
+ {
+ AcpiOsPrintf ("/**** Before second load\n");
- if (AcpiGbl_DbOpt_disasm)
- {
- AdDisplayTables (Filename, Table);
- fprintf (stderr, "Disassembly completed, written to \"%s\"\n", DisasmFilename);
+ LsSetupNsList (File);
+ LsDisplayNamespace ();
+ AcpiOsPrintf ("*****/\n");
+ }
+
+ /*
+ * Load namespace from names created within control methods
+ */
+ AcpiDmFinishNamespaceLoad (AcpiGbl_ParseOpRoot, AcpiGbl_RootNode);
+
+ /*
+ * Cross reference the namespace here, in order to generate External() statements
+ */
+ AcpiDmCrossReferenceNamespace (AcpiGbl_ParseOpRoot, AcpiGbl_RootNode);
+
+ if (AslCompilerdebug)
+ {
+ AcpiDmDumpTree (AcpiGbl_ParseOpRoot);
+ }
+
+ /* Find possible calls to external control methods */
+
+ AcpiDmFindOrphanMethods (AcpiGbl_ParseOpRoot);
+
+ /* Convert fixed-offset references to resource descriptors to symbolic references */
+
+ 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
+ * method)
+ */
+ if (AdMethodExternalCount ())
+ {
+ fprintf (stderr,
+ "\nFound %d external control methods, reparsing with new information\n",
+ AdMethodExternalCount());
+
+ /*
+ * Reparse, rebuild namespace. no need to xref namespace
+ */
+ AcpiPsDeleteParseTree (AcpiGbl_ParseOpRoot);
+ AcpiNsDeleteNamespaceSubtree (AcpiGbl_RootNode);
+
+ AcpiGbl_RootNode = NULL;
+ AcpiGbl_RootNodeStruct.Name.Integer = ACPI_ROOT_NAME;
+ AcpiGbl_RootNodeStruct.DescriptorType = ACPI_DESC_TYPE_NAMED;
+ AcpiGbl_RootNodeStruct.Type = ACPI_TYPE_DEVICE;
+ AcpiGbl_RootNodeStruct.Child = NULL;
+ AcpiGbl_RootNodeStruct.Peer = NULL;
+ AcpiGbl_RootNodeStruct.Object = NULL;
+ AcpiGbl_RootNodeStruct.Flags = ANOBJ_END_OF_PEER_LIST;
+
+ Status = AcpiNsRootInitialize ();
+ AdAddExternalsToNamespace ();
+
+ Status = AdParseTable (Table);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Could not parse ACPI tables, %s\n",
+ AcpiFormatException (Status));
+ goto Cleanup;
+ }
+
+ if (AslCompilerdebug)
+ {
+ AcpiDmDumpTree (AcpiGbl_ParseOpRoot);
+ }
+ }
+
+ /* Optional displays */
+
+ if (AcpiGbl_DbOpt_disasm)
+ {
+ AdDisplayTables (Filename, Table);
+ fprintf (stderr,
+ "Disassembly completed, written to \"%s\"\n",
+ DisasmFilename);
+ }
}
Cleanup:
- if (OutToFile)
+ if (OutToFile && File)
{
+
+#ifdef ASL_DISASM_DEBUG
+ LsSetupNsList (File);
+ LsDisplayNamespace ();
+#endif
fclose (File);
AcpiOsRedirectOutput (stdout);
}
- AcpiPsDeleteParseTree (AcpiGbl_ParsedNamespaceRoot);
+ AcpiPsDeleteParseTree (AcpiGbl_ParseOpRoot);
return Status;
}
/******************************************************************************
*
+ * FUNCTION: AdDisassemblerHeader
+ *
+ * PARAMETERS: Filename - Input file for the table
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Create the disassembler header, including ACPI CA signon with
+ * current time and date.
+ *
+ *****************************************************************************/
+
+void
+AdDisassemblerHeader (
+ char *Filename)
+{
+ time_t Timer;
+
+ time (&Timer);
+
+ /* Header and input table info */
+
+ AcpiOsPrintf ("/*\n * Intel ACPI Component Architecture\n");
+ AcpiOsPrintf (" * AML Disassembler version %8.8X\n", ACPI_CA_VERSION);
+
+ AcpiOsPrintf (" *\n * Disassembly of %s, %s", Filename, ctime (&Timer));
+ AcpiOsPrintf (" *\n");
+}
+
+
+/******************************************************************************
+ *
* FUNCTION: AdCreateTableHeader
*
* PARAMETERS: Filename - Input file for the table
@@ -610,18 +639,40 @@ AdCreateTableHeader (
char *Filename,
ACPI_TABLE_HEADER *Table)
{
- time_t Timer;
+ char *NewFilename;
- time (&Timer);
+ AdDisassemblerHeader (Filename);
- AcpiOsPrintf ("/*\n * Intel ACPI Component Architecture\n");
- AcpiOsPrintf (" * AML Disassembler version %8.8X\n", ACPI_CA_VERSION);
- AcpiOsPrintf (" *\n * Disassembly of %s, %s */\n", Filename, ctime (&Timer));
+ 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);
+ 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 (" */\n");
+
+ /* Create AML output filename based on input filename */
+
+ if (Filename)
+ {
+ NewFilename = FlGenerateFilename (Filename, "aml");
+ }
+ else
+ {
+ NewFilename = ACPI_ALLOCATE_ZEROED (9);
+ strncat (NewFilename, Table->Signature, 4);
+ strcat (NewFilename, ".aml");
+ }
+
+ /* Open the ASL definition block */
AcpiOsPrintf (
- "DefinitionBlock (\"%4.4s.aml\", \"%4.4s\", %hd, \"%.6s\", \"%.8s\", 0x%8.8X)\n",
- Table->Signature, Table->Signature, Table->Revision,
+ "DefinitionBlock (\"%s\", \"%4.4s\", %hd, \"%.6s\", \"%.8s\", 0x%8.8X)\n",
+ NewFilename, Table->Signature, Table->Revision,
Table->OemId, Table->OemTableId, Table->OemRevision);
}
@@ -646,7 +697,7 @@ AdDisplayTables (
{
- if (!AcpiGbl_ParsedNamespaceRoot)
+ if (!AcpiGbl_ParseOpRoot)
{
return AE_NOT_EXIST;
}
@@ -656,7 +707,7 @@ AdDisplayTables (
AdCreateTableHeader (Filename, Table);
}
- AcpiDmDisassemble (NULL, AcpiGbl_ParsedNamespaceRoot, ACPI_UINT32_MAX);
+ AcpiDmDisassemble (NULL, AcpiGbl_ParseOpRoot, ACPI_UINT32_MAX);
if (AcpiGbl_DbOpt_verbose)
{
@@ -702,7 +753,7 @@ AdDeferredParse (
ACPI_PARSE_OBJECT *ExtraOp;
- ACPI_FUNCTION_TRACE ("AdDeferredParse");
+ ACPI_FUNCTION_TRACE (AdDeferredParse);
fprintf (stderr, ".");
@@ -722,7 +773,7 @@ AdDeferredParse (
}
Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, Aml,
- AmlLength, NULL, 1);
+ AmlLength, NULL, ACPI_IMODE_LOAD_PASS1);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -820,7 +871,7 @@ AdParseDeferredOps (
const ACPI_OPCODE_INFO *OpInfo;
- ACPI_FUNCTION_NAME ("AdParseDeferredOps");
+ ACPI_FUNCTION_NAME (AdParseDeferredOps);
fprintf (stderr, "Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions)\n");
while (Op)
@@ -859,7 +910,7 @@ AdParseDeferredOps (
break;
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unhandled deferred opcode [%s]\n",
+ ACPI_ERROR ((AE_INFO, "Unhandled deferred opcode [%s]",
Op->Common.AmlOpName));
break;
}
@@ -895,12 +946,12 @@ AdGetLocalTables (
ACPI_TABLE_HEADER *NewTable;
UINT32 NumTables;
UINT32 PointerSize;
- char *FacsSuffix = "";
+ ACPI_NATIVE_UINT TableIndex;
if (GetAllTables)
{
- ACPI_STRNCPY (TableHeader.Signature, RSDT_SIG, 4);
+ ACPI_MOVE_32_TO_32 (TableHeader.Signature, ACPI_SIG_RSDT);
AcpiOsTableOverride (&TableHeader, &NewTable);
if (!NewTable)
{
@@ -908,14 +959,11 @@ AdGetLocalTables (
return AE_NO_ACPI_TABLES;
}
-#if ACPI_MACHINE_WIDTH != 64
-
- if (!ACPI_STRNCMP (NewTable->Signature, RSDT_SIG, 4))
+ if (ACPI_COMPARE_NAME (NewTable->Signature, ACPI_SIG_RSDT))
{
PointerSize = sizeof (UINT32);
}
else
-#endif
{
PointerSize = sizeof (UINT64);
}
@@ -932,43 +980,31 @@ AdGetLocalTables (
/* Get the FADT */
- ACPI_STRNCPY (TableHeader.Signature, FADT_SIG, 4);
+ ACPI_MOVE_32_TO_32 (TableHeader.Signature, ACPI_SIG_FADT);
AcpiOsTableOverride (&TableHeader, &NewTable);
if (NewTable)
{
- AcpiGbl_FADT = (void *) NewTable;
AdWriteTable (NewTable, NewTable->Length,
- FADT_SIG, NewTable->OemTableId);
-
- /* Use the FADT tableID for the FACS, since FACS has no ID */
-
- FacsSuffix = AcpiGbl_FADT->OemTableId;
+ ACPI_SIG_FADT, NewTable->OemTableId);
}
AcpiOsPrintf ("\n");
- /* Get the FACS */
-
- ACPI_STRNCPY (TableHeader.Signature, FACS_SIG, 4);
- AcpiOsTableOverride (&TableHeader, &NewTable);
- if (NewTable)
- {
- AcpiGbl_FACS = (void *) NewTable;
- AdWriteTable (NewTable, AcpiGbl_FACS->Length,
- FACS_SIG, FacsSuffix);
- }
- AcpiOsPrintf ("\n");
+ /* Don't bother with FACS, it is usually all zeros */
}
/* Always get the DSDT */
- ACPI_STRNCPY (TableHeader.Signature, DSDT_SIG, 4);
+ ACPI_MOVE_32_TO_32 (TableHeader.Signature, ACPI_SIG_DSDT);
AcpiOsTableOverride (&TableHeader, &NewTable);
if (NewTable)
{
- Status = AE_OK;
- AcpiGbl_DSDT = NewTable;
- AdWriteTable (AcpiGbl_DSDT, AcpiGbl_DSDT->Length,
- "DSDT", AcpiGbl_DSDT->OemTableId);
+ AdWriteTable (NewTable, NewTable->Length,
+ ACPI_SIG_DSDT, NewTable->OemTableId);
+
+ /* Store DSDT in the Table Manager */
+
+ Status = AcpiTbStoreTable (0, NewTable, NewTable->Length,
+ 0, &TableIndex);
}
else
{
@@ -976,23 +1012,26 @@ AdGetLocalTables (
return AE_NO_ACPI_TABLES;
}
+#if 0
+ /* TBD: Future implementation */
+
AcpiOsPrintf ("\n");
/* Get all SSDTs */
- ACPI_STRNCPY (TableHeader.Signature, SSDT_SIG, 4);
- Status = AcpiOsTableOverride (&TableHeader, &NewTable);
- if (NewTable)
+ ACPI_MOVE_32_TO_32 (TableHeader.Signature, ACPI_SIG_SSDT);
+ do
{
- while (NewTable)
- {
- Status = AcpiOsTableOverride (&TableHeader, &NewTable);
- }
- }
+ NewTable = NULL;
+ Status = AcpiOsTableOverride (&TableHeader, &NewTable);
+
+ } while (NewTable);
+#endif
return AE_OK;
}
+
/******************************************************************************
*
* FUNCTION: AdParseTable
@@ -1011,9 +1050,9 @@ AdParseTable (
{
ACPI_STATUS Status = AE_OK;
ACPI_WALK_STATE *WalkState;
- ACPI_TABLE_DESC TableDesc;
UINT8 *AmlStart;
UINT32 AmlLength;
+ ACPI_NATIVE_UINT TableIndex;
if (!Table)
@@ -1025,13 +1064,13 @@ AdParseTable (
fprintf (stderr, "Pass 1 parse of [%4.4s]\n", (char *) Table->Signature);
- AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER);
- AmlStart = ((UINT8 *) Table + sizeof (ACPI_TABLE_HEADER));
+ AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER);
+ AmlStart = ((UINT8 *) Table + sizeof (ACPI_TABLE_HEADER));
/* Create the root object */
- AcpiGbl_ParsedNamespaceRoot = AcpiPsCreateScopeOp ();
- if (!AcpiGbl_ParsedNamespaceRoot)
+ AcpiGbl_ParseOpRoot = AcpiPsCreateScopeOp ();
+ if (!AcpiGbl_ParseOpRoot)
{
return AE_NO_MEMORY;
}
@@ -1039,14 +1078,14 @@ AdParseTable (
/* Create and initialize a new walk state */
WalkState = AcpiDsCreateWalkState (0,
- AcpiGbl_ParsedNamespaceRoot, NULL, NULL);
+ AcpiGbl_ParseOpRoot, NULL, NULL);
if (!WalkState)
{
return (AE_NO_MEMORY);
}
- Status = AcpiDsInitAmlWalk (WalkState, AcpiGbl_ParsedNamespaceRoot,
- NULL, AmlStart, AmlLength, NULL, 1);
+ Status = AcpiDsInitAmlWalk (WalkState, AcpiGbl_ParseOpRoot,
+ NULL, AmlStart, AmlLength, NULL, ACPI_IMODE_LOAD_PASS1);
if (ACPI_FAILURE (Status))
{
return (Status);
@@ -1063,12 +1102,16 @@ AdParseTable (
/* Pass 2 */
- TableDesc.AmlStart = AmlStart;
- TableDesc.AmlLength = AmlLength;
+ Status = AcpiTbStoreTable ((ACPI_NATIVE_UINT) Table, Table,
+ Table->Length, ACPI_TABLE_ORIGIN_ALLOCATED, &TableIndex);
+ if (ACPI_FAILURE (Status))
+ {
+ return Status;
+ }
+
fprintf (stderr, "Pass 2 parse of [%4.4s]\n", (char *) Table->Signature);
- WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE;
- Status = AcpiNsOneCompleteParse (2, &TableDesc);
+ Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS2, 0);
if (ACPI_FAILURE (Status))
{
return (Status);
@@ -1076,7 +1119,11 @@ AdParseTable (
/* Pass 3: Parse control methods and link their parse trees into the main parse tree */
- Status = AdParseDeferredOps (AcpiGbl_ParsedNamespaceRoot);
+ Status = AdParseDeferredOps (AcpiGbl_ParseOpRoot);
+
+ /* Process Resource Templates */
+
+ AcpiDmFindResources (AcpiGbl_ParseOpRoot);
fprintf (stderr, "Parsing completed\n");
return AE_OK;
diff --git a/sys/contrib/dev/acpica/common/adwalk.c b/sys/contrib/dev/acpica/common/adwalk.c
new file mode 100644
index 0000000..108561c
--- /dev/null
+++ b/sys/contrib/dev/acpica/common/adwalk.c
@@ -0,0 +1,1001 @@
+/******************************************************************************
+ *
+ * Module Name: adwalk - Application-level disassembler parse tree walk routines
+ * $Revision: 1.6 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 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.
+ *
+ *****************************************************************************/
+
+
+#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>
+
+
+#define _COMPONENT ACPI_TOOLS
+ ACPI_MODULE_NAME ("adwalk")
+
+/*
+ * aslmap - opcode mappings and reserved method names
+ */
+ACPI_OBJECT_TYPE
+AslMapNamedOpcodeToDataType (
+ UINT16 Opcode);
+
+/* Local prototypes */
+
+static ACPI_STATUS
+AcpiDmFindOrphanDescending (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+static ACPI_STATUS
+AcpiDmDumpDescending (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+static ACPI_STATUS
+AcpiDmXrefDescendingOp (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+static ACPI_STATUS
+AcpiDmCommonAscendingOp (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+static ACPI_STATUS
+AcpiDmLoadDescendingOp (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+static UINT32
+AcpiDmInspectPossibleArgs (
+ UINT32 CurrentOpArgCount,
+ UINT32 TargetCount,
+ ACPI_PARSE_OBJECT *Op);
+
+static ACPI_STATUS
+AcpiDmResourceDescendingOp (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpTree
+ *
+ * PARAMETERS: Origin - Starting object
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Parse tree walk to format and output the nodes
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDumpTree (
+ ACPI_PARSE_OBJECT *Origin)
+{
+ ACPI_OP_WALK_INFO Info;
+
+
+ if (!Origin)
+ {
+ return;
+ }
+
+ AcpiOsPrintf ("/*\nAML Parse Tree\n\n");
+ Info.Flags = 0;
+ Info.Count = 0;
+ Info.Level = 0;
+ Info.WalkState = NULL;
+ AcpiDmWalkParseTree (Origin, AcpiDmDumpDescending, NULL, &Info);
+ AcpiOsPrintf ("*/\n\n");
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmFindOrphanMethods
+ *
+ * PARAMETERS: Origin - Starting object
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Parse tree walk to find "orphaned" method invocations -- methods
+ * that are not resolved in the namespace
+ *
+ ******************************************************************************/
+
+void
+AcpiDmFindOrphanMethods (
+ ACPI_PARSE_OBJECT *Origin)
+{
+ ACPI_OP_WALK_INFO Info;
+
+
+ if (!Origin)
+ {
+ return;
+ }
+
+ Info.Flags = 0;
+ Info.Level = 0;
+ Info.WalkState = NULL;
+ AcpiDmWalkParseTree (Origin, AcpiDmFindOrphanDescending, NULL, &Info);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmFinishNamespaceLoad
+ *
+ * PARAMETERS: ParseTreeRoot - Root of the parse tree
+ * NamespaceRoot - Root of the internal namespace
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Load all namespace items that are created within control
+ * methods. Used before namespace cross reference
+ *
+ ******************************************************************************/
+
+void
+AcpiDmFinishNamespaceLoad (
+ ACPI_PARSE_OBJECT *ParseTreeRoot,
+ ACPI_NAMESPACE_NODE *NamespaceRoot)
+{
+ ACPI_STATUS Status;
+ ACPI_OP_WALK_INFO Info;
+ ACPI_WALK_STATE *WalkState;
+
+
+ if (!ParseTreeRoot)
+ {
+ return;
+ }
+
+ /* Create and initialize a new walk state */
+
+ WalkState = AcpiDsCreateWalkState (0, ParseTreeRoot, NULL, NULL);
+ if (!WalkState)
+ {
+ return;
+ }
+
+ Status = AcpiDsScopeStackPush (NamespaceRoot, NamespaceRoot->Type, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return;
+ }
+
+ Info.Flags = 0;
+ Info.Level = 0;
+ Info.WalkState = WalkState;
+ AcpiDmWalkParseTree (ParseTreeRoot, AcpiDmLoadDescendingOp,
+ AcpiDmCommonAscendingOp, &Info);
+ ACPI_FREE (WalkState);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmCrossReferenceNamespace
+ *
+ * PARAMETERS: ParseTreeRoot - Root of the parse tree
+ * NamespaceRoot - Root of the internal namespace
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Cross reference the namespace to create externals
+ *
+ ******************************************************************************/
+
+void
+AcpiDmCrossReferenceNamespace (
+ ACPI_PARSE_OBJECT *ParseTreeRoot,
+ ACPI_NAMESPACE_NODE *NamespaceRoot)
+{
+ ACPI_STATUS Status;
+ ACPI_OP_WALK_INFO Info;
+ ACPI_WALK_STATE *WalkState;
+
+
+ if (!ParseTreeRoot)
+ {
+ return;
+ }
+
+ /* Create and initialize a new walk state */
+
+ WalkState = AcpiDsCreateWalkState (0, ParseTreeRoot, NULL, NULL);
+ if (!WalkState)
+ {
+ return;
+ }
+
+ Status = AcpiDsScopeStackPush (NamespaceRoot, NamespaceRoot->Type, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return;
+ }
+
+ Info.Flags = 0;
+ Info.Level = 0;
+ Info.WalkState = WalkState;
+ AcpiDmWalkParseTree (ParseTreeRoot, AcpiDmXrefDescendingOp,
+ AcpiDmCommonAscendingOp, &Info);
+ ACPI_FREE (WalkState);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmConvertResourceIndexes
+ *
+ * PARAMETERS: ParseTreeRoot - Root of the parse tree
+ * NamespaceRoot - Root of the internal namespace
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Convert fixed-offset references to resource descriptors to
+ * symbolic references. Should only be called after namespace has
+ * been cross referenced.
+ *
+ ******************************************************************************/
+
+void
+AcpiDmConvertResourceIndexes (
+ ACPI_PARSE_OBJECT *ParseTreeRoot,
+ ACPI_NAMESPACE_NODE *NamespaceRoot)
+{
+ ACPI_STATUS Status;
+ ACPI_OP_WALK_INFO Info;
+ ACPI_WALK_STATE *WalkState;
+
+
+ if (!ParseTreeRoot)
+ {
+ return;
+ }
+
+ /* Create and initialize a new walk state */
+
+ WalkState = AcpiDsCreateWalkState (0, ParseTreeRoot, NULL, NULL);
+ if (!WalkState)
+ {
+ return;
+ }
+
+ Status = AcpiDsScopeStackPush (NamespaceRoot, NamespaceRoot->Type, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return;
+ }
+
+ Info.Flags = 0;
+ Info.Level = 0;
+ Info.WalkState = WalkState;
+ AcpiDmWalkParseTree (ParseTreeRoot, AcpiDmResourceDescendingOp,
+ AcpiDmCommonAscendingOp, &Info);
+ ACPI_FREE (WalkState);
+ return;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpDescending
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Format and print contents of one parse Op.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiDmDumpDescending (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+ ACPI_OP_WALK_INFO *Info = Context;
+ const ACPI_OPCODE_INFO *OpInfo;
+ char *Path;
+
+
+ if (!Op)
+ {
+ return (AE_OK);
+ }
+
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+ Info->Count++;
+
+ /* Most of the information (count, level, name) here */
+
+ AcpiOsPrintf ("% 5d [%2.2d] ", Info->Count, Level);
+ AcpiDmIndent (Level);
+ AcpiOsPrintf ("%-28s", AcpiPsGetOpcodeName (Op->Common.AmlOpcode));
+
+ /* Extra info is helpful */
+
+ switch (Op->Common.AmlOpcode)
+ {
+ case AML_BYTE_OP:
+ case AML_WORD_OP:
+ case AML_DWORD_OP:
+ AcpiOsPrintf ("%X", (UINT32) Op->Common.Value.Integer);
+ break;
+
+ case AML_INT_NAMEPATH_OP:
+ if (Op->Common.Value.String)
+ {
+ AcpiNsExternalizeName (ACPI_UINT32_MAX, Op->Common.Value.String,
+ NULL, &Path);
+ AcpiOsPrintf ("%s %p", Path, Op->Common.Node);
+ ACPI_FREE (Path);
+ }
+ else
+ {
+ AcpiOsPrintf ("[NULL]");
+ }
+ break;
+
+ case AML_NAME_OP:
+ case AML_METHOD_OP:
+ case AML_DEVICE_OP:
+ case AML_INT_NAMEDFIELD_OP:
+ AcpiOsPrintf ("%4.4s", &Op->Named.Name);
+ break;
+ }
+
+ AcpiOsPrintf ("\n");
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmFindOrphanDescending
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Check namepath Ops for orphaned method invocations
+ *
+ * Note: Experimental.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiDmFindOrphanDescending (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+ const ACPI_OPCODE_INFO *OpInfo;
+ ACPI_PARSE_OBJECT *ChildOp;
+ ACPI_PARSE_OBJECT *NextOp;
+ ACPI_PARSE_OBJECT *ParentOp;
+ UINT32 ArgCount;
+
+
+ if (!Op)
+ {
+ return (AE_OK);
+ }
+
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+
+ switch (Op->Common.AmlOpcode)
+ {
+#ifdef ACPI_UNDER_DEVELOPMENT
+ case AML_ADD_OP:
+ ChildOp = Op->Common.Value.Arg;
+ if ((ChildOp->Common.AmlOpcode == AML_INT_NAMEPATH_OP) &&
+ !ChildOp->Common.Node)
+ {
+ AcpiNsExternalizeName (ACPI_UINT32_MAX, ChildOp->Common.Value.String,
+ NULL, &Path);
+ AcpiOsPrintf ("/* %-16s A-NAMEPATH: %s */\n", Op->Common.AmlOpName, Path);
+ ACPI_FREE (Path);
+
+ NextOp = Op->Common.Next;
+ if (!NextOp)
+ {
+ /* This NamePath has no args, assume it is an integer */
+
+ AcpiDmAddToExternalList (ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, 0);
+ return (AE_OK);
+ }
+
+ ArgCount = AcpiDmInspectPossibleArgs (3, 1, NextOp);
+ AcpiOsPrintf ("/* A-CHILDREN: %d Actual %d */\n", ArgCount, AcpiDmCountChildren (Op));
+
+ if (ArgCount < 1)
+ {
+ /* One Arg means this is just a Store(Name,Target) */
+
+ AcpiDmAddToExternalList (ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, 0);
+ return (AE_OK);
+ }
+
+ AcpiDmAddToExternalList (ChildOp->Common.Value.String, ACPI_TYPE_METHOD, ArgCount);
+ }
+ break;
+#endif
+
+ case AML_STORE_OP:
+
+ ChildOp = Op->Common.Value.Arg;
+ if ((ChildOp->Common.AmlOpcode == AML_INT_NAMEPATH_OP) &&
+ !ChildOp->Common.Node)
+ {
+ NextOp = Op->Common.Next;
+ if (!NextOp)
+ {
+ /* This NamePath has no args, assume it is an integer */
+
+ AcpiDmAddToExternalList (ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, 0);
+ return (AE_OK);
+ }
+
+ ArgCount = AcpiDmInspectPossibleArgs (2, 1, NextOp);
+ if (ArgCount <= 1)
+ {
+ /* One Arg means this is just a Store(Name,Target) */
+
+ AcpiDmAddToExternalList (ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, 0);
+ return (AE_OK);
+ }
+
+ AcpiDmAddToExternalList (ChildOp->Common.Value.String, ACPI_TYPE_METHOD, ArgCount);
+ }
+ break;
+
+ case AML_INT_NAMEPATH_OP:
+
+ /* Must examine parent to see if this namepath is an argument */
+
+ ParentOp = Op->Common.Parent;
+ OpInfo = AcpiPsGetOpcodeInfo (ParentOp->Common.AmlOpcode);
+
+ if ((OpInfo->Class != AML_CLASS_EXECUTE) &&
+ (OpInfo->Class != AML_CLASS_CREATE) &&
+ (ParentOp->Common.AmlOpcode != AML_INT_METHODCALL_OP) &&
+ !Op->Common.Node)
+ {
+ ArgCount = AcpiDmInspectPossibleArgs (0, 0, Op->Common.Next);
+
+ /*
+ * Check if namepath is a predicate for if/while or lone parameter to
+ * a return.
+ */
+ if (ArgCount == 0)
+ {
+ if (((ParentOp->Common.AmlOpcode == AML_IF_OP) ||
+ (ParentOp->Common.AmlOpcode == AML_WHILE_OP) ||
+ (ParentOp->Common.AmlOpcode == AML_RETURN_OP)) &&
+
+ /* And namepath is the first argument */
+ (ParentOp->Common.Value.Arg == Op))
+ {
+ AcpiDmAddToExternalList (Op->Common.Value.String, ACPI_TYPE_INTEGER, 0);
+ break;
+ }
+ }
+
+ /*
+ * This is a standalone namestring (not a parameter to another
+ * operator) - it *must* be a method invocation, nothing else is
+ * grammatically possible.
+ */
+ AcpiDmAddToExternalList (Op->Common.Value.String, ACPI_TYPE_METHOD, ArgCount);
+
+ }
+ break;
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmLoadDescendingOp
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Descending handler for namespace control method object load
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiDmLoadDescendingOp (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+ ACPI_OP_WALK_INFO *Info = Context;
+ const ACPI_OPCODE_INFO *OpInfo;
+ ACPI_WALK_STATE *WalkState;
+ ACPI_OBJECT_TYPE ObjectType;
+ ACPI_STATUS Status;
+ char *Path = NULL;
+ ACPI_PARSE_OBJECT *NextOp;
+ ACPI_NAMESPACE_NODE *Node;
+
+
+ WalkState = Info->WalkState;
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+ ObjectType = OpInfo->ObjectType;
+ ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode);
+
+ /* Only interested in operators that create new names */
+
+ if (!(OpInfo->Flags & AML_NAMED) &&
+ !(OpInfo->Flags & AML_CREATE))
+ {
+ goto Exit;
+ }
+
+ /* Get the NamePath from the appropriate place */
+
+ if (OpInfo->Flags & AML_NAMED)
+ {
+ /* For all named operators, get the new name */
+
+ Path = (char *) Op->Named.Path;
+ }
+ else if (OpInfo->Flags & AML_CREATE)
+ {
+ /* New name is the last child */
+
+ NextOp = Op->Common.Value.Arg;
+
+ while (NextOp->Common.Next)
+ {
+ NextOp = NextOp->Common.Next;
+ }
+ Path = NextOp->Common.Value.String;
+ }
+
+ if (!Path)
+ {
+ goto Exit;
+ }
+
+ /* Insert the name into the namespace */
+
+ Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
+ ACPI_IMODE_LOAD_PASS2, ACPI_NS_DONT_OPEN_SCOPE,
+ WalkState, &Node);
+
+ Op->Common.Node = Node;
+
+
+Exit:
+
+ if (AcpiNsOpensScope (ObjectType))
+ {
+ if (Op->Common.Node)
+ {
+ Status = AcpiDsScopeStackPush (Op->Common.Node, ObjectType, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+ }
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmXrefDescendingOp
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Descending handler for namespace cross reference
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiDmXrefDescendingOp (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+ ACPI_OP_WALK_INFO *Info = Context;
+ const ACPI_OPCODE_INFO *OpInfo;
+ ACPI_WALK_STATE *WalkState;
+ ACPI_OBJECT_TYPE ObjectType;
+ ACPI_STATUS Status;
+ char *Path = NULL;
+ ACPI_PARSE_OBJECT *NextOp;
+ ACPI_NAMESPACE_NODE *Node;
+
+
+ WalkState = Info->WalkState;
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+ ObjectType = OpInfo->ObjectType;
+ ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode);
+
+ if ((!(OpInfo->Flags & AML_NAMED)) &&
+ (!(OpInfo->Flags & AML_CREATE)) &&
+ (Op->Common.AmlOpcode != AML_INT_NAMEPATH_OP))
+ {
+ goto Exit;
+ }
+
+ /* Get the NamePath from the appropriate place */
+
+ if (OpInfo->Flags & AML_NAMED)
+ {
+ if ((Op->Common.AmlOpcode == AML_ALIAS_OP) ||
+ (Op->Common.AmlOpcode == AML_SCOPE_OP))
+ {
+ /*
+ * Only these two operators refer to an existing name,
+ * first argument
+ */
+ Path = (char *) Op->Named.Path;
+ }
+ }
+ else if (OpInfo->Flags & AML_CREATE)
+ {
+ /* Referenced Buffer Name is the first child */
+
+ NextOp = Op->Common.Value.Arg;
+ if (NextOp->Common.AmlOpcode == AML_INT_NAMEPATH_OP)
+ {
+ Path = NextOp->Common.Value.String;
+ }
+ }
+ else
+ {
+ Path = Op->Common.Value.String;
+ }
+
+ if (!Path)
+ {
+ goto Exit;
+ }
+
+ /*
+ * Lookup the name in the namespace. Name must exist at this point, or it
+ * is an invalid reference.
+ *
+ * The namespace is also used as a lookup table for references to resource
+ * descriptors and the fields within them.
+ */
+ Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY,
+ ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
+ WalkState, &Node);
+ if (ACPI_FAILURE (Status))
+ {
+ if (Status == AE_NOT_FOUND)
+ {
+ AcpiDmAddToExternalList (Path, (UINT8) ObjectType, 0);
+
+ /*
+ * We could install this into the namespace, but we catch duplicate
+ * externals when they are added to the list.
+ */
+#if 0
+ Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY,
+ ACPI_IMODE_LOAD_PASS1, ACPI_NS_DONT_OPEN_SCOPE,
+ WalkState, &Node);
+#endif
+ }
+ }
+ else
+ {
+ Op->Common.Node = Node;
+ }
+
+
+Exit:
+ /* Open new scope if necessary */
+
+ if (AcpiNsOpensScope (ObjectType))
+ {
+ if (Op->Common.Node)
+ {
+ Status = AcpiDsScopeStackPush (Op->Common.Node, ObjectType, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+ }
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmResourceDescendingOp
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Process one parse op during symbolic resource index conversion.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiDmResourceDescendingOp (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+ ACPI_OP_WALK_INFO *Info = Context;
+ const ACPI_OPCODE_INFO *OpInfo;
+ ACPI_WALK_STATE *WalkState;
+ ACPI_OBJECT_TYPE ObjectType;
+ ACPI_STATUS Status;
+
+
+ WalkState = Info->WalkState;
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+
+ /* Open new scope if necessary */
+
+ ObjectType = OpInfo->ObjectType;
+ if (AcpiNsOpensScope (ObjectType))
+ {
+ if (Op->Common.Node)
+ {
+
+ Status = AcpiDsScopeStackPush (Op->Common.Node, ObjectType, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+ }
+ }
+
+ /*
+ * Check if this operator contains a reference to a resource descriptor.
+ * If so, convert the reference into a symbolic reference.
+ */
+ AcpiDmCheckResourceReference (Op, WalkState);
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmCommonAscendingOp
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Ascending handler for combined parse/namespace walks. Closes
+ * scope if necessary.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiDmCommonAscendingOp (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+ ACPI_OP_WALK_INFO *Info = Context;
+ const ACPI_OPCODE_INFO *OpInfo;
+ ACPI_OBJECT_TYPE ObjectType;
+
+
+ /* Close scope if necessary */
+
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+ ObjectType = OpInfo->ObjectType;
+ ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode);
+
+ if (AcpiNsOpensScope (ObjectType))
+ {
+ (void) AcpiDsScopeStackPop (Info->WalkState);
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmInspectPossibleArgs
+ *
+ * PARAMETERS: CurrentOpArgCount - Which arg of the current op was the
+ * possible method invocation found
+ * TargetCount - Number of targets (0,1,2) for this op
+ * Op - Parse op
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Examine following args and next ops for possible arguments
+ * for an unrecognized method invocation.
+ *
+ ******************************************************************************/
+
+static UINT32
+AcpiDmInspectPossibleArgs (
+ UINT32 CurrentOpArgCount,
+ UINT32 TargetCount,
+ ACPI_PARSE_OBJECT *Op)
+{
+ const ACPI_OPCODE_INFO *OpInfo;
+ UINT32 i;
+ UINT32 Last = 0;
+ UINT32 Lookahead;
+
+
+ Lookahead = (ACPI_METHOD_NUM_ARGS + TargetCount) - CurrentOpArgCount;
+
+ /* Lookahead for the maximum number of possible arguments */
+
+ for (i = 0; i < Lookahead; i++)
+ {
+ if (!Op)
+ {
+ break;
+ }
+
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+
+ /*
+ * Any one of these operators is "very probably" not a method arg
+ */
+ if ((Op->Common.AmlOpcode == AML_STORE_OP) ||
+ (Op->Common.AmlOpcode == AML_NOTIFY_OP))
+ {
+ break;
+ }
+
+ if ((OpInfo->Class != AML_CLASS_EXECUTE) &&
+ (OpInfo->Class != AML_CLASS_CONTROL))
+ {
+ Last = i+1;
+ }
+
+ Op = Op->Common.Next;
+ }
+
+ return (Last);
+}
+
+
diff --git a/sys/contrib/dev/acpica/common/dmrestag.c b/sys/contrib/dev/acpica/common/dmrestag.c
new file mode 100644
index 0000000..ed8b36b
--- /dev/null
+++ b/sys/contrib/dev/acpica/common/dmrestag.c
@@ -0,0 +1,990 @@
+/******************************************************************************
+ *
+ * Module Name: dmrestag - Add tags to resource descriptors (Application-level)
+ * $Revision: 1.11 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 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.
+ *
+ *****************************************************************************/
+
+
+#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>
+
+/* This module used for application-level code only */
+
+#define _COMPONENT ACPI_CA_DISASSEMBLER
+ ACPI_MODULE_NAME ("dmrestag")
+
+/* Local prototypes */
+
+static void
+AcpiDmUpdateResourceName (
+ ACPI_NAMESPACE_NODE *ResourceNode);
+
+static char *
+AcpiDmSearchTagList (
+ UINT32 BitIndex,
+ ACPI_RESOURCE_TAG *TagList);
+
+static char *
+AcpiDmGetResourceTag (
+ UINT32 BitIndex,
+ AML_RESOURCE *Resource,
+ UINT8 ResourceIndex);
+
+static char *
+AcpiGetTagPathname (
+ ACPI_NAMESPACE_NODE *BufferNode,
+ ACPI_NAMESPACE_NODE *ResourceNode,
+ UINT32 BitIndex);
+
+static ACPI_NAMESPACE_NODE *
+AcpiDmGetResourceNode (
+ ACPI_NAMESPACE_NODE *BufferNode,
+ UINT32 BitIndex);
+
+static ACPI_STATUS
+AcpiDmAddResourceToNamespace (
+ UINT8 *Aml,
+ UINT32 Length,
+ UINT32 Offset,
+ UINT8 ResourceIndex,
+ void *Context);
+
+static void
+AcpiDmAddResourcesToNamespace (
+ ACPI_NAMESPACE_NODE *BufferNode,
+ ACPI_PARSE_OBJECT *Op);
+
+
+/******************************************************************************
+ *
+ * Resource Tag tables
+ *
+ * These are the predefined tags that refer to elements of a resource
+ * descriptor. Each name and offset is defined in the ACPI specification.
+ *
+ * Each table entry contains the bit offset of the field and the associated
+ * name.
+ *
+ ******************************************************************************/
+
+static ACPI_RESOURCE_TAG AcpiDmIrqTags[] =
+{
+ {( 1 * 8), ACPI_RESTAG_INTERRUPT},
+ {( 3 * 8) + 0, ACPI_RESTAG_INTERRUPTTYPE},
+ {( 3 * 8) + 3, ACPI_RESTAG_INTERRUPTLEVEL},
+ {( 3 * 8) + 4, ACPI_RESTAG_INTERRUPTSHARE},
+ {0, NULL}
+};
+
+static ACPI_RESOURCE_TAG AcpiDmDmaTags[] =
+{
+ {( 1 * 8), ACPI_RESTAG_DMA},
+ {( 2 * 8) + 0, ACPI_RESTAG_XFERTYPE},
+ {( 2 * 8) + 2, ACPI_RESTAG_BUSMASTER},
+ {( 2 * 8) + 5, ACPI_RESTAG_DMATYPE},
+ {0, NULL}
+};
+
+static ACPI_RESOURCE_TAG AcpiDmIoTags[] =
+{
+ {( 1 * 8) + 0, ACPI_RESTAG_DECODE},
+ {( 2 * 8), ACPI_RESTAG_MINADDR},
+ {( 4 * 8), ACPI_RESTAG_MAXADDR},
+ {( 6 * 8), ACPI_RESTAG_ALIGNMENT},
+ {( 7 * 8), ACPI_RESTAG_LENGTH},
+ {0, NULL}
+};
+
+static ACPI_RESOURCE_TAG AcpiDmFixedIoTags[] =
+{
+ {( 1 * 8), ACPI_RESTAG_BASEADDRESS},
+ {( 3 * 8), ACPI_RESTAG_LENGTH},
+ {0, NULL}
+};
+
+static ACPI_RESOURCE_TAG AcpiDmMemory24Tags[] =
+{
+ {( 3 * 8) + 0, ACPI_RESTAG_READWRITETYPE},
+ {( 4 * 8), ACPI_RESTAG_MINADDR},
+ {( 6 * 8), ACPI_RESTAG_MAXADDR},
+ {( 8 * 8), ACPI_RESTAG_ALIGNMENT},
+ {(10 * 8), ACPI_RESTAG_LENGTH},
+ {0, NULL}
+};
+
+static ACPI_RESOURCE_TAG AcpiDmRegisterTags[] =
+{
+ {( 3 * 8), ACPI_RESTAG_ADDRESSSPACE},
+ {( 4 * 8), ACPI_RESTAG_REGISTERBITWIDTH},
+ {( 5 * 8), ACPI_RESTAG_REGISTERBITOFFSET},
+ {( 6 * 8), ACPI_RESTAG_ACCESSSIZE},
+ {( 7 * 8), ACPI_RESTAG_ADDRESS},
+ {0, NULL}
+};
+
+static ACPI_RESOURCE_TAG AcpiDmMemory32Tags[] =
+{
+ {( 3 * 8) + 0, ACPI_RESTAG_READWRITETYPE},
+ {( 4 * 8), ACPI_RESTAG_MINADDR},
+ {( 8 * 8), ACPI_RESTAG_MAXADDR},
+ {(12 * 8), ACPI_RESTAG_ALIGNMENT},
+ {(16 * 8), ACPI_RESTAG_LENGTH},
+ {0, NULL}
+};
+
+static ACPI_RESOURCE_TAG AcpiDmFixedMemory32Tags[] =
+{
+ {( 3 * 8) + 0, ACPI_RESTAG_READWRITETYPE},
+ {( 4 * 8), ACPI_RESTAG_BASEADDRESS},
+ {( 8 * 8), ACPI_RESTAG_LENGTH},
+ {0, NULL}
+};
+
+static ACPI_RESOURCE_TAG AcpiDmInterruptTags[] =
+{
+ {( 3 * 8) + 1, ACPI_RESTAG_INTERRUPTTYPE},
+ {( 3 * 8) + 2, ACPI_RESTAG_INTERRUPTLEVEL},
+ {( 3 * 8) + 3, ACPI_RESTAG_INTERRUPTSHARE},
+ {( 5 * 8), ACPI_RESTAG_INTERRUPT},
+ {0, NULL}
+};
+
+static ACPI_RESOURCE_TAG AcpiDmAddress16Tags[] =
+{
+ {( 4 * 8) + 1, ACPI_RESTAG_DECODE},
+ {( 4 * 8) + 2, ACPI_RESTAG_MINTYPE},
+ {( 4 * 8) + 3, ACPI_RESTAG_MAXTYPE},
+ {( 6 * 8), ACPI_RESTAG_GRANULARITY},
+ {( 8 * 8), ACPI_RESTAG_MINADDR},
+ {(10 * 8), ACPI_RESTAG_MAXADDR},
+ {(12 * 8), ACPI_RESTAG_TRANSLATION},
+ {(14 * 8), ACPI_RESTAG_LENGTH},
+ {0, NULL}
+};
+
+static ACPI_RESOURCE_TAG AcpiDmAddress32Tags[] =
+{
+ {( 4 * 8) + 1, ACPI_RESTAG_DECODE},
+ {( 4 * 8) + 2, ACPI_RESTAG_MINTYPE},
+ {( 4 * 8) + 3, ACPI_RESTAG_MAXTYPE},
+ {( 6 * 8), ACPI_RESTAG_GRANULARITY},
+ {(10 * 8), ACPI_RESTAG_MINADDR},
+ {(14 * 8), ACPI_RESTAG_MAXADDR},
+ {(18 * 8), ACPI_RESTAG_TRANSLATION},
+ {(22 * 8), ACPI_RESTAG_LENGTH},
+ {0, NULL}
+};
+
+static ACPI_RESOURCE_TAG AcpiDmAddress64Tags[] =
+{
+ {( 4 * 8) + 1, ACPI_RESTAG_DECODE},
+ {( 4 * 8) + 2, ACPI_RESTAG_MINTYPE},
+ {( 4 * 8) + 3, ACPI_RESTAG_MAXTYPE},
+ {( 6 * 8), ACPI_RESTAG_GRANULARITY},
+ {(14 * 8), ACPI_RESTAG_MINADDR},
+ {(22 * 8), ACPI_RESTAG_MAXADDR},
+ {(30 * 8), ACPI_RESTAG_TRANSLATION},
+ {(38 * 8), ACPI_RESTAG_LENGTH},
+ {0, NULL}
+};
+
+static ACPI_RESOURCE_TAG AcpiDmExtendedAddressTags[] =
+{
+ {( 4 * 8) + 1, ACPI_RESTAG_DECODE},
+ {( 4 * 8) + 2, ACPI_RESTAG_MINTYPE},
+ {( 4 * 8) + 3, ACPI_RESTAG_MAXTYPE},
+ {( 8 * 8), ACPI_RESTAG_GRANULARITY},
+ {(16 * 8), ACPI_RESTAG_MINADDR},
+ {(24 * 8), ACPI_RESTAG_MAXADDR},
+ {(32 * 8), ACPI_RESTAG_TRANSLATION},
+ {(40 * 8), ACPI_RESTAG_LENGTH},
+ {(48 * 8), ACPI_RESTAG_TYPESPECIFICATTRIBUTES},
+ {0, NULL}
+};
+
+/* Special-case tables for the type-specific flags */
+
+static ACPI_RESOURCE_TAG AcpiDmMemoryFlagTags[] =
+{
+ {( 5 * 8) + 0, ACPI_RESTAG_READWRITETYPE},
+ {( 5 * 8) + 1, ACPI_RESTAG_MEMTYPE},
+ {( 5 * 8) + 3, ACPI_RESTAG_MEMATTRIBUTES},
+ {( 5 * 8) + 5, ACPI_RESTAG_TYPE},
+ {0, NULL}
+};
+
+static ACPI_RESOURCE_TAG AcpiDmIoFlagTags[] =
+{
+ {( 5 * 8) + 0, ACPI_RESTAG_RANGETYPE},
+ {( 5 * 8) + 4, ACPI_RESTAG_TYPE},
+ {( 5 * 8) + 5, ACPI_RESTAG_TRANSTYPE},
+ {0, NULL}
+};
+
+
+/* Dispatch table used to obtain the correct tag table for a descriptor */
+
+static ACPI_RESOURCE_TAG *AcpiGbl_ResourceTags [] =
+{
+ /* Small descriptors */
+
+ NULL, /* 0x00, Reserved */
+ NULL, /* 0x01, Reserved */
+ NULL, /* 0x02, Reserved */
+ NULL, /* 0x03, Reserved */
+ AcpiDmIrqTags, /* 0x04, ACPI_RESOURCE_NAME_IRQ_FORMAT */
+ AcpiDmDmaTags, /* 0x05, ACPI_RESOURCE_NAME_DMA_FORMAT */
+ NULL, /* 0x06, ACPI_RESOURCE_NAME_START_DEPENDENT */
+ NULL, /* 0x07, ACPI_RESOURCE_NAME_END_DEPENDENT */
+ AcpiDmIoTags, /* 0x08, ACPI_RESOURCE_NAME_IO_PORT */
+ AcpiDmFixedIoTags, /* 0x09, ACPI_RESOURCE_NAME_FIXED_IO_PORT */
+ NULL, /* 0x0A, Reserved */
+ NULL, /* 0x0B, Reserved */
+ NULL, /* 0x0C, Reserved */
+ NULL, /* 0x0D, Reserved */
+ NULL, /* 0x0E, ACPI_RESOURCE_NAME_SMALL_VENDOR */
+ NULL, /* 0x0F, ACPI_RESOURCE_NAME_END_TAG (not used) */
+
+ /* Large descriptors */
+
+ NULL, /* 0x00, Reserved */
+ AcpiDmMemory24Tags, /* 0x01, ACPI_RESOURCE_NAME_MEMORY_24 */
+ AcpiDmRegisterTags, /* 0x02, ACPI_RESOURCE_NAME_GENERIC_REGISTER */
+ NULL, /* 0x03, Reserved */
+ NULL, /* 0x04, ACPI_RESOURCE_NAME_LARGE_VENDOR */
+ AcpiDmMemory32Tags, /* 0x05, ACPI_RESOURCE_NAME_MEMORY_32 */
+ AcpiDmFixedMemory32Tags, /* 0x06, ACPI_RESOURCE_NAME_FIXED_MEMORY_32 */
+ AcpiDmAddress32Tags, /* 0x07, ACPI_RESOURCE_NAME_DWORD_ADDRESS_SPACE */
+ AcpiDmAddress16Tags, /* 0x08, ACPI_RESOURCE_NAME_WORD_ADDRESS_SPACE */
+ AcpiDmInterruptTags, /* 0x09, ACPI_RESOURCE_NAME_EXTENDED_XRUPT */
+ AcpiDmAddress64Tags, /* 0x0A, ACPI_RESOURCE_NAME_QWORD_ADDRESS_SPACE */
+ AcpiDmExtendedAddressTags /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS_SPACE */
+};
+
+
+/*
+ * Globals used to generate unique resource descriptor names. We use names that
+ * start with underscore and a prefix letter that is not used by other ACPI
+ * reserved names. To this, we append hex 0x00 through 0xFF. These 5 prefixes
+ * allow for 5*256 = 1280 unique names, probably sufficient for any single ASL
+ * file. If this becomes too small, we can use alpha+numerals for a total
+ * of 5*36*36 = 6480.
+ */
+#define ACPI_NUM_RES_PREFIX 5
+
+static UINT32 AcpiGbl_NextResourceId = 0;
+static UINT8 AcpiGbl_NextPrefix = 0;
+static UINT8 AcpiGbl_Prefix[ACPI_NUM_RES_PREFIX] =
+ {'Y','Z','J','K','X'};
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmCheckResourceReference
+ *
+ * PARAMETERS: Op - Parse Op for the AML opcode
+ * WalkState - Current walk state (with valid scope)
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Convert a reference to a resource descriptor to a symbolic
+ * reference if possible
+ *
+ * NOTE: Bit index is used to transparently handle both resource bit
+ * fields and byte fields.
+ *
+ ******************************************************************************/
+
+void
+AcpiDmCheckResourceReference (
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status;
+ ACPI_PARSE_OBJECT *BufferNameOp;
+ ACPI_PARSE_OBJECT *IndexOp;
+ ACPI_NAMESPACE_NODE *BufferNode;
+ ACPI_NAMESPACE_NODE *ResourceNode;
+ const ACPI_OPCODE_INFO *OpInfo;
+ char *Pathname;
+ UINT32 BitIndex;
+
+
+ /* We are only interested in the CreateXxxxField opcodes */
+
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+ if (OpInfo->Type != AML_TYPE_CREATE_FIELD)
+ {
+ return;
+ }
+
+ /* Get the buffer term operand */
+
+ BufferNameOp = AcpiPsGetDepthNext (NULL, Op);
+
+ /* Must be a named buffer, not an arg or local or method call */
+
+ if (BufferNameOp->Common.AmlOpcode != AML_INT_NAMEPATH_OP)
+ {
+ return;
+ }
+
+ /* Get the Index term, must be an integer constant to convert */
+
+ IndexOp = BufferNameOp->Common.Next;
+ OpInfo = AcpiPsGetOpcodeInfo (IndexOp->Common.AmlOpcode);
+ if (OpInfo->ObjectType != ACPI_TYPE_INTEGER)
+ {
+ return;
+ }
+
+ /* Get the bit offset of the descriptor within the buffer */
+
+ if ((Op->Common.AmlOpcode == AML_CREATE_BIT_FIELD_OP) ||
+ (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP))
+ {
+ /* Index operand is a bit offset */
+
+ BitIndex = (UINT32) IndexOp->Common.Value.Integer;
+ }
+ else
+ {
+ /* Index operand is a byte offset, convert to bits */
+
+ BitIndex = (UINT32) ACPI_MUL_8 (IndexOp->Common.Value.Integer);
+ }
+
+ /* Lookup the buffer in the namespace */
+
+ Status = AcpiNsLookup (WalkState->ScopeInfo,
+ BufferNameOp->Common.Value.String, ACPI_TYPE_BUFFER,
+ ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState,
+ &BufferNode);
+ if (ACPI_FAILURE (Status))
+ {
+ return;
+ }
+
+ /* Validate object type, we must have a buffer */
+
+ if (BufferNode->Type != ACPI_TYPE_BUFFER)
+ {
+ return;
+ }
+
+ /* Find the resource descriptor node corresponding to the index */
+
+ ResourceNode = AcpiDmGetResourceNode (BufferNode, BitIndex);
+ if (!ResourceNode)
+ {
+ return;
+ }
+
+ /* Translate the Index to a resource tag pathname */
+
+ Pathname = AcpiGetTagPathname (BufferNode, ResourceNode, BitIndex);
+ if (Pathname)
+ {
+ /* Complete the conversion of the Index to a symbol */
+
+ IndexOp->Common.AmlOpcode = AML_INT_NAMEPATH_OP;
+ IndexOp->Common.Value.String = Pathname;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmGetResourceNode
+ *
+ * PARAMETERS: BufferNode - Node for the parent buffer
+ * BitIndex - Index into the resource descriptor
+ *
+ * RETURN: Namespace node for the resource descriptor. NULL if not found
+ *
+ * DESCRIPTION: Find a resource descriptor that corresponds to the bit index
+ *
+ ******************************************************************************/
+
+static ACPI_NAMESPACE_NODE *
+AcpiDmGetResourceNode (
+ ACPI_NAMESPACE_NODE *BufferNode,
+ UINT32 BitIndex)
+{
+ ACPI_NAMESPACE_NODE *Node;
+ UINT32 ByteIndex = ACPI_DIV_8 (BitIndex);
+
+
+ /*
+ * Child list contains an entry for each resource descriptor. Find
+ * the descriptor that corresponds to the Index.
+ *
+ * If there are no children, this is not a resource template
+ */
+ Node = BufferNode->Child;
+ while (Node)
+ {
+ /*
+ * Check if the Index falls within this resource.
+ *
+ * Value contains the resource offset, Object contains the resource
+ * length (both in bytes)
+ */
+ if ((ByteIndex >= Node->Value) &&
+ (ByteIndex < (Node->Value + Node->Length)))
+ {
+ return (Node);
+ }
+
+ /* List is circular, this flag marks the end */
+
+ if (Node->Flags & ANOBJ_END_OF_PEER_LIST)
+ {
+ return (NULL);
+ }
+
+ Node = Node->Peer;
+ }
+
+ return (NULL);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiGetTagPathname
+ *
+ * PARAMETERS: BufferNode - Node for the parent buffer
+ * ResourceNode - Node for a resource descriptor
+ * BitIndex - Index into the resource descriptor
+ *
+ * RETURN: Full pathname for a resource tag. NULL if no match.
+ * Path is returned in AML (packed) format.
+ *
+ * DESCRIPTION: Convert a BitIndex into a symbolic resource tag (full pathname)
+ *
+ ******************************************************************************/
+
+static char *
+AcpiGetTagPathname (
+ ACPI_NAMESPACE_NODE *BufferNode,
+ ACPI_NAMESPACE_NODE *ResourceNode,
+ UINT32 BitIndex)
+{
+ ACPI_STATUS Status;
+ UINT32 ResourceBitIndex;
+ UINT8 ResourceTableIndex;
+ ACPI_SIZE RequiredSize;
+ char *Pathname;
+ AML_RESOURCE *Aml;
+ ACPI_PARSE_OBJECT *Op;
+ char *InternalPath;
+ char *Tag;
+
+
+ /* Get the Op that contains the actual buffer data */
+
+ Op = BufferNode->Op->Common.Value.Arg;
+ Op = Op->Common.Next;
+ if (!Op)
+ {
+ return (NULL);
+ }
+
+ /* Get the individual resource descriptor and validate it */
+
+ Aml = ACPI_CAST_PTR (AML_RESOURCE,
+ &Op->Named.Data[ResourceNode->Value]);
+
+ Status = AcpiUtValidateResource (Aml, &ResourceTableIndex);
+ if (ACPI_FAILURE (Status))
+ {
+ return (NULL);
+ }
+
+ /* Get offset into this descriptor (from offset into entire buffer) */
+
+ ResourceBitIndex = BitIndex - ACPI_MUL_8 (ResourceNode->Value);
+
+ /* Get the tag associated with this resource descriptor and offset */
+
+ Tag = AcpiDmGetResourceTag (ResourceBitIndex, Aml, ResourceTableIndex);
+ if (!Tag)
+ {
+ return (NULL);
+ }
+
+ /*
+ * Now that we know that we have a reference that can be converted to a
+ * symbol, change the name of the resource to a unique name.
+ */
+ AcpiDmUpdateResourceName (ResourceNode);
+
+ /* Get the full pathname to the parent buffer */
+
+ RequiredSize = AcpiNsGetPathnameLength (BufferNode);
+ Pathname = ACPI_ALLOCATE_ZEROED (RequiredSize + ACPI_PATH_SEGMENT_LENGTH);
+ if (!Pathname)
+ {
+ return (NULL);
+ }
+
+ AcpiNsBuildExternalPath (BufferNode, RequiredSize, Pathname);
+
+ /*
+ * Create the full path to the resource and tag by: remove the buffer name,
+ * append the resource descriptor name, append a dot, append the tag name.
+ *
+ * TBD: Always using the full path is a bit brute force, the path can be
+ * often be optimized with carats (if the original buffer namepath is a
+ * single nameseg). This doesn't really matter, because these paths do not
+ * end up in the final compiled AML, it's just an appearance issue for the
+ * disassembled code.
+ */
+ Pathname[ACPI_STRLEN (Pathname) - ACPI_NAME_SIZE] = 0;
+ ACPI_STRNCAT (Pathname, ResourceNode->Name.Ascii, ACPI_NAME_SIZE);
+ ACPI_STRCAT (Pathname, ".");
+ ACPI_STRNCAT (Pathname, Tag, ACPI_NAME_SIZE);
+
+ /* Internalize the namepath to AML format */
+
+ AcpiNsInternalizeName (Pathname, &InternalPath);
+ ACPI_FREE (Pathname);
+ return (InternalPath);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmUpdateResourceName
+ *
+ * PARAMETERS: ResourceNode - Node for a resource descriptor
+ *
+ * RETURN: Stores new name in the ResourceNode
+ *
+ * DESCRIPTION: Create a new, unique name for a resource descriptor. Used by
+ * both the disassembly of the descriptor itself and any symbolic
+ * references to the descriptor. Ignored if a unique name has
+ * already been assigned to the resource.
+ *
+ * NOTE: Single threaded, suitable for applications only!
+ *
+ ******************************************************************************/
+
+static void
+AcpiDmUpdateResourceName (
+ ACPI_NAMESPACE_NODE *ResourceNode)
+{
+ char Name[ACPI_NAME_SIZE];
+
+
+ /* Ignore if a unique name has already been assigned */
+
+ if (ResourceNode->Name.Integer != ACPI_DEFAULT_RESNAME)
+ {
+ return;
+ }
+
+ /* Generate a new ACPI name for the descriptor */
+
+ Name[0] = '_';
+ Name[1] = AcpiGbl_Prefix[AcpiGbl_NextPrefix];
+ Name[2] = AcpiUtHexToAsciiChar (AcpiGbl_NextResourceId, 4);
+ Name[3] = AcpiUtHexToAsciiChar (AcpiGbl_NextResourceId, 0);
+
+ /* Update globals for next name */
+
+ AcpiGbl_NextResourceId++;
+ if (AcpiGbl_NextResourceId >= 256)
+ {
+ AcpiGbl_NextResourceId = 0;
+ AcpiGbl_NextPrefix++;
+ if (AcpiGbl_NextPrefix > ACPI_NUM_RES_PREFIX)
+ {
+ AcpiGbl_NextPrefix = 0;
+ }
+ }
+
+ /* Change the resource descriptor name */
+
+ ResourceNode->Name.Integer = *(UINT32 *) Name;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmGetResourceTag
+ *
+ * PARAMETERS: BitIndex - Index into the resource descriptor
+ * Resource - Pointer to the raw resource data
+ * ResourceIndex - Index correspoinding to the resource type
+ *
+ * RETURN: Pointer to the resource tag (ACPI_NAME). NULL if no match.
+ *
+ * DESCRIPTION: Convert a BitIndex into a symbolic resource tag.
+ *
+ ******************************************************************************/
+
+static char *
+AcpiDmGetResourceTag (
+ UINT32 BitIndex,
+ AML_RESOURCE *Resource,
+ UINT8 ResourceIndex)
+{
+ ACPI_RESOURCE_TAG *TagList;
+ char *Tag = NULL;
+
+
+ /* Get the tag list for this resource descriptor type */
+
+ TagList = AcpiGbl_ResourceTags[ResourceIndex];
+ if (!TagList)
+ {
+ /* There are no tags for this resource type */
+
+ return (NULL);
+ }
+
+ /*
+ * Handle the type-specific flags field for the address descriptors.
+ * Kindof brute force, but just blindly search for an index match.
+ */
+ switch (Resource->DescriptorType)
+ {
+ case ACPI_RESOURCE_NAME_ADDRESS16:
+ case ACPI_RESOURCE_NAME_ADDRESS32:
+ case ACPI_RESOURCE_NAME_ADDRESS64:
+ case ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64:
+
+ if (Resource->Address.ResourceType == ACPI_ADDRESS_TYPE_MEMORY_RANGE)
+ {
+ Tag = AcpiDmSearchTagList (BitIndex, AcpiDmMemoryFlagTags);
+ }
+ else if (Resource->Address.ResourceType == ACPI_ADDRESS_TYPE_IO_RANGE)
+ {
+ Tag = AcpiDmSearchTagList (BitIndex, AcpiDmIoFlagTags);
+ }
+
+ /* If we found a match, all done. Else, drop to normal search below */
+
+ if (Tag)
+ {
+ return (Tag);
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ /* Search the tag list for this descriptor type */
+
+ Tag = AcpiDmSearchTagList (BitIndex, TagList);
+ return (Tag);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmSearchTagList
+ *
+ * PARAMETERS: BitIndex - Index into the resource descriptor
+ * TagList - List to search
+ *
+ * RETURN: Pointer to a tag (ACPI_NAME). NULL if no match found.
+ *
+ * DESCRIPTION: Search a tag list for a match to the input BitIndex. Matches
+ * a fixed offset to a symbolic resource tag name.
+ *
+ ******************************************************************************/
+
+static char *
+AcpiDmSearchTagList (
+ UINT32 BitIndex,
+ ACPI_RESOURCE_TAG *TagList)
+{
+
+ /*
+ * Walk the null-terminated tag list to find a matching bit offset.
+ * We are looking for an exact match.
+ */
+ for ( ; TagList->Tag; TagList++)
+ {
+ if (BitIndex == TagList->BitIndex)
+ {
+ return (TagList->Tag);
+ }
+ }
+
+ /* A matching offset was not found */
+
+ return (NULL);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmFindResources
+ *
+ * PARAMETERS: Root - Root of the parse tree
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Add all ResourceTemplate declarations to the namespace. Each
+ * resource descriptor in each template is given a node -- used
+ * for later conversion of resource references to symbolic refs.
+ *
+ ******************************************************************************/
+
+void
+AcpiDmFindResources (
+ ACPI_PARSE_OBJECT *Root)
+{
+ ACPI_PARSE_OBJECT *Op = Root;
+ ACPI_PARSE_OBJECT *Parent;
+
+
+ /* Walk the entire parse tree */
+
+ while (Op)
+ {
+ /* We are interested in Buffer() declarations */
+
+ if (Op->Common.AmlOpcode == AML_BUFFER_OP)
+ {
+ /* And only declarations of the form Name (XXXX, Buffer()... ) */
+
+ Parent = Op->Common.Parent;
+ if (Parent->Common.AmlOpcode == AML_NAME_OP)
+ {
+ /*
+ * If the buffer is a resource template, add the individual
+ * resource descriptors to the namespace, as children of the
+ * buffer node.
+ */
+ if (ACPI_SUCCESS (AcpiDmIsResourceTemplate (Op)))
+ {
+ Op->Common.DisasmOpcode = ACPI_DASM_RESOURCE;
+ AcpiDmAddResourcesToNamespace (Parent->Common.Node, Op);
+ }
+ }
+ }
+
+ Op = AcpiPsGetDepthNext (Root, Op);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmAddResourcesToNamespace
+ *
+ * PARAMETERS: BufferNode - Node for the parent buffer
+ * Op - Parse op for the buffer
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Add an entire resource template to the namespace. Each
+ * resource descriptor is added as a namespace node.
+ *
+ ******************************************************************************/
+
+static void
+AcpiDmAddResourcesToNamespace (
+ ACPI_NAMESPACE_NODE *BufferNode,
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_PARSE_OBJECT *NextOp;
+
+
+ /* Get to the ByteData list */
+
+ NextOp = Op->Common.Value.Arg;
+ NextOp = NextOp->Common.Next;
+ if (!NextOp)
+ {
+ return;
+ }
+
+ /* Set Node and Op to point to each other */
+
+ BufferNode->Op = Op;
+ Op->Common.Node = BufferNode;
+
+ /*
+ * Insert each resource into the namespace
+ * NextOp contains the Aml pointer and the Aml length
+ */
+ AcpiUtWalkAmlResources ((UINT8 *) NextOp->Named.Data,
+ (ACPI_SIZE) NextOp->Common.Value.Integer,
+ AcpiDmAddResourceToNamespace, BufferNode);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmAddResourceToNamespace
+ *
+ * PARAMETERS: ACPI_WALK_AML_CALLBACK
+ * BufferNode - Node for the parent buffer
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Add one resource descriptor to the namespace as a child of the
+ * parent buffer. The same name is used for each descriptor. This
+ * is changed later to a unique name if the resource is actually
+ * referenced by an AML operator.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiDmAddResourceToNamespace (
+ UINT8 *Aml,
+ UINT32 Length,
+ UINT32 Offset,
+ UINT8 ResourceIndex,
+ void *Context)
+{
+ ACPI_STATUS Status;
+ ACPI_GENERIC_STATE ScopeInfo;
+ ACPI_NAMESPACE_NODE *Node;
+
+
+ /* TBD: Don't need to add descriptors that have no tags defined? */
+
+ /* Add the resource to the namespace, as child of the buffer */
+
+ ScopeInfo.Scope.Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Context);
+ Status = AcpiNsLookup (&ScopeInfo, "_TMP", ACPI_TYPE_LOCAL_RESOURCE,
+ ACPI_IMODE_LOAD_PASS2,
+ ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_PREFIX_IS_SCOPE,
+ NULL, &Node);
+ if (ACPI_FAILURE (Status))
+ {
+ return (AE_OK);
+ }
+
+ /* Set the name to the default, changed later if resource is referenced */
+
+ Node->Name.Integer = ACPI_DEFAULT_RESNAME;
+
+ /* Save the offset of the descriptor (within the original buffer) */
+
+ Node->Value = Offset;
+ Node->Length = Length;
+ return (AE_OK);
+}
+
diff --git a/sys/contrib/dev/acpica/common/dmtable.c b/sys/contrib/dev/acpica/common/dmtable.c
new file mode 100644
index 0000000..ce4b5f9
--- /dev/null
+++ b/sys/contrib/dev/acpica/common/dmtable.c
@@ -0,0 +1,734 @@
+/******************************************************************************
+ *
+ * Module Name: dmtable - Support for ACPI tables that contain no AML code
+ * $Revision: 1.12 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 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.
+ *
+ *****************************************************************************/
+
+#include <contrib/dev/acpica/acpi.h>
+#include <contrib/dev/acpica/acdisasm.h>
+#include <contrib/dev/acpica/actables.h>
+
+/* This module used for application-level code only */
+
+#define _COMPONENT ACPI_CA_DISASSEMBLER
+ ACPI_MODULE_NAME ("dmtable")
+
+/* Local Prototypes */
+
+static ACPI_DMTABLE_DATA *
+AcpiDmGetTableData (
+ char *Signature);
+
+static void
+AcpiDmCheckAscii (
+ UINT8 *Target,
+ UINT32 Count);
+
+
+/* These tables map a subtable type to a description string */
+
+static const char *AcpiDmDmarSubnames[] =
+{
+ "Hardware Unit Definition",
+ "Reserved Memory Region",
+ "Unknown SubTable Type" /* Reserved */
+};
+
+static const char *AcpiDmMadtSubnames[] =
+{
+ "Processor Local APIC", /* ACPI_MADT_TYPE_LOCAL_APIC */
+ "I/O APIC", /* ACPI_MADT_TYPE_IO_APIC */
+ "Interrupt Source Override", /* ACPI_MADT_TYPE_INTERRUPT_OVERRIDE */
+ "NMI Source", /* ACPI_MADT_TYPE_NMI_SOURCE */
+ "Local APIC NMI", /* ACPI_MADT_TYPE_LOCAL_APIC_NMI */
+ "Local APIC Address Override", /* ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE */
+ "I/O SAPIC", /* ACPI_MADT_TYPE_IO_SAPIC */
+ "Local SAPIC", /* ACPI_MADT_TYPE_LOCAL_SAPIC */
+ "Platform Interrupt Sources", /* ACPI_MADT_TYPE_INTERRUPT_SOURCE */
+ "Unknown SubTable Type" /* Reserved */
+};
+
+static const char *AcpiDmSratSubnames[] =
+{
+ "Processor Local APIC/SAPIC Affinity",
+ "Memory Affinity",
+ "Unknown SubTable Type" /* Reserved */
+};
+
+
+/*******************************************************************************
+ *
+ * ACPI Table Data, indexed by signature.
+ *
+ * Simple tables have only a TableInfo structure, complex tables have a handler.
+ * This table must be NULL terminated. RSDP and FACS are special-cased
+ * elsewhere.
+ *
+ ******************************************************************************/
+
+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_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_FADT, NULL, AcpiDmDumpFadt, "Fixed ACPI Description 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_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"},
+ {ACPI_SIG_SRAT, NULL, AcpiDmDumpSrat, "System Resource Affinity Table"},
+ {ACPI_SIG_TCPA, AcpiDmTableInfoTcpa, NULL, "Trusted Computing Platform Alliance table"},
+ {ACPI_SIG_WDRT, AcpiDmTableInfoWdrt, NULL, "Watchdog Resource Table"},
+ {ACPI_SIG_XSDT, NULL, AcpiDmDumpXsdt, "Extended System Description Table"},
+ {NULL, NULL, NULL, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbGenerateChecksum
+ *
+ * PARAMETERS: Table - Pointer to a valid ACPI table (with a
+ * standard ACPI header)
+ *
+ * RETURN: 8 bit checksum of buffer
+ *
+ * DESCRIPTION: Computes an 8 bit checksum of the table.
+ *
+ ******************************************************************************/
+
+UINT8
+AcpiTbGenerateChecksum (
+ ACPI_TABLE_HEADER *Table)
+{
+ UINT8 Checksum;
+
+
+ /* Sum the entire table as-is */
+
+ Checksum = AcpiTbChecksum ((UINT8 *) Table, Table->Length);
+
+ /* Subtract off the existing checksum value in the table */
+
+ Checksum = (UINT8) (Checksum - Table->Checksum);
+
+ /* Compute the final checksum */
+
+ Checksum = (UINT8) (0 - Checksum);
+ return (Checksum);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmGetTableData
+ *
+ * PARAMETERS: Signature - ACPI signature (4 chars) to match
+ *
+ * RETURN: Pointer to a valid ACPI_DMTABLE_DATA. Null if no match found.
+ *
+ * DESCRIPTION: Find a match in the global table of supported ACPI tables
+ *
+ ******************************************************************************/
+
+static ACPI_DMTABLE_DATA *
+AcpiDmGetTableData (
+ char *Signature)
+{
+ ACPI_DMTABLE_DATA *TableData;
+
+
+ for (TableData = AcpiDmTableData; TableData->Signature; TableData++)
+ {
+ if (ACPI_COMPARE_NAME (Signature, TableData->Signature))
+ {
+ return (TableData);
+ }
+ }
+
+ return (NULL);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpDataTable
+ *
+ * PARAMETERS: Table - An ACPI table
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Format the contents of an ACPI data table (any table other
+ * than an SSDT or DSDT that does not contain executable AML code)
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDumpDataTable (
+ ACPI_TABLE_HEADER *Table)
+{
+ ACPI_DMTABLE_DATA *TableData;
+ UINT32 Length;
+
+
+ /* Ignore tables that contain AML */
+
+ if (AcpiUtIsAmlTable (Table))
+ {
+ return;
+ }
+
+ /*
+ * Handle tables that don't use the common ACPI table header structure.
+ * Currently, these are the FACS and RSDP.
+ */
+ if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FACS))
+ {
+ Length = Table->Length;
+ AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFacs);
+ }
+ else if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_RSDP))
+ {
+ Length = AcpiDmDumpRsdp (Table);
+ }
+ else
+ {
+ /*
+ * All other tables must use the common ACPI table header, dump it now
+ */
+ Length = Table->Length;
+ AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHeader);
+ AcpiOsPrintf ("\n");
+
+ /* Match signature and dispatch appropriately */
+
+ TableData = AcpiDmGetTableData (Table->Signature);
+ if (!TableData)
+ {
+ if (!ACPI_STRNCMP (Table->Signature, "OEM", 3))
+ {
+ AcpiOsPrintf ("\n**** OEM-defined ACPI table [%4.4s], unknown contents\n\n",
+ Table->Signature);
+ }
+ else
+ {
+ AcpiOsPrintf ("\n**** Unknown ACPI table type [%4.4s]\n\n",
+ Table->Signature);
+ }
+ }
+ else if (TableData->TableHandler)
+ {
+ /* Complex table, has a handler */
+
+ TableData->TableHandler (Table);
+ }
+ else if (TableData->TableInfo)
+ {
+ /* Simple table, just walk the info table */
+
+ AcpiDmDumpTable (Length, 0, Table, 0, TableData->TableInfo);
+ }
+ }
+
+ /* Always dump the raw table data */
+
+ AcpiOsPrintf ("\nRaw Table Data\n\n");
+ AcpiUtDumpBuffer2 (ACPI_CAST_PTR (UINT8, Table), Length, DB_BYTE_DISPLAY);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmLineHeader
+ *
+ * PARAMETERS: Offset - Current byte offset, from table start
+ * ByteLength - Length of the field in bytes, 0 for flags
+ * Name - Name of this field
+ * Value - Optional value, displayed on left of ':'
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Utility routines for formatting output lines. Displays the
+ * current table offset in hex and decimal, the field length,
+ * and the field name.
+ *
+ ******************************************************************************/
+
+void
+AcpiDmLineHeader (
+ UINT32 Offset,
+ UINT32 ByteLength,
+ char *Name)
+{
+
+ if (ByteLength)
+ {
+ AcpiOsPrintf ("[%3.3Xh %3.3d% 3d] %28s : ",
+ Offset, Offset, ByteLength, Name);
+ }
+ else
+ {
+ AcpiOsPrintf ("%42s : ",
+ Name);
+ }
+}
+
+void
+AcpiDmLineHeader2 (
+ UINT32 Offset,
+ UINT32 ByteLength,
+ char *Name,
+ UINT32 Value)
+{
+
+ if (ByteLength)
+ {
+ AcpiOsPrintf ("[%3.3Xh %3.3d% 3d] %24s % 3d : ",
+ Offset, Offset, ByteLength, Name, Value);
+ }
+ else
+ {
+ AcpiOsPrintf ("[%3.3Xh %3.3d ] %24s % 3d : ",
+ Offset, Offset, Name, Value);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpTable
+ *
+ * PARAMETERS: TableLength - Length of the entire ACPI table
+ * TableOffset - Starting offset within the table for this
+ * sub-descriptor (0 if main table)
+ * Table - The ACPI table
+ * SubtableLength - Lenghth of this sub-descriptor
+ * Info - Info table for this ACPI table
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display ACPI table contents by walking the Info table.
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDumpTable (
+ UINT32 TableLength,
+ UINT32 TableOffset,
+ void *Table,
+ UINT32 SubtableLength,
+ ACPI_DMTABLE_INFO *Info)
+{
+ UINT8 *Target;
+ UINT32 CurrentOffset;
+ UINT32 ByteLength;
+ UINT8 Temp8;
+ UINT16 Temp16;
+ ACPI_DMTABLE_DATA *TableData;
+
+
+ if (!Info)
+ {
+ AcpiOsPrintf ("Display not implemented\n");
+ return;
+ }
+
+ /* Walk entire Info table; Null name terminates */
+
+ for (; Info->Name; Info++)
+ {
+ /*
+ * Target points to the field within the ACPI Table. CurrentOffset is
+ * the offset of the field from the start of the main table.
+ */
+ Target = ACPI_ADD_PTR (UINT8, Table, Info->Offset);
+ CurrentOffset = TableOffset + Info->Offset;
+
+ /* Check for beyond EOT or beyond subtable end */
+
+ if ((CurrentOffset >= TableLength) ||
+ (SubtableLength && (Info->Offset >= SubtableLength)))
+ {
+ return;
+ }
+
+ /* Generate the byte length for this field */
+
+ switch (Info->Opcode)
+ {
+ case ACPI_DMT_UINT8:
+ case ACPI_DMT_CHKSUM:
+ case ACPI_DMT_SPACEID:
+ case ACPI_DMT_MADT:
+ case ACPI_DMT_SRAT:
+ ByteLength = 1;
+ break;
+ case ACPI_DMT_UINT16:
+ case ACPI_DMT_DMAR:
+ ByteLength = 2;
+ break;
+ case ACPI_DMT_UINT24:
+ ByteLength = 3;
+ break;
+ case ACPI_DMT_UINT32:
+ case ACPI_DMT_NAME4:
+ case ACPI_DMT_SIG:
+ ByteLength = 4;
+ break;
+ case ACPI_DMT_NAME6:
+ ByteLength = 6;
+ break;
+ case ACPI_DMT_UINT56:
+ ByteLength = 7;
+ break;
+ case ACPI_DMT_UINT64:
+ case ACPI_DMT_NAME8:
+ ByteLength = 8;
+ break;
+ case ACPI_DMT_STRING:
+ ByteLength = ACPI_STRLEN (ACPI_CAST_PTR (char, Target)) + 1;
+ break;
+ case ACPI_DMT_GAS:
+ AcpiOsPrintf ("\n");
+ ByteLength = sizeof (ACPI_GENERIC_ADDRESS);
+ break;
+ default:
+ ByteLength = 0;
+ break;
+ }
+
+ /* Start a new line and decode the opcode */
+
+ AcpiDmLineHeader (CurrentOffset, ByteLength, Info->Name);
+
+ switch (Info->Opcode)
+ {
+ /* Single-bit Flag fields. Note: Opcode is the bit position */
+
+ case ACPI_DMT_FLAG0:
+ case ACPI_DMT_FLAG1:
+ case ACPI_DMT_FLAG2:
+ case ACPI_DMT_FLAG3:
+ case ACPI_DMT_FLAG4:
+ case ACPI_DMT_FLAG5:
+ case ACPI_DMT_FLAG6:
+ case ACPI_DMT_FLAG7:
+
+ AcpiOsPrintf ("%1.1X\n", (*Target >> Info->Opcode) & 0x01);
+ break;
+
+ /* 2-bit Flag fields */
+
+ case ACPI_DMT_FLAGS0:
+
+ AcpiOsPrintf ("%1.1X\n", *Target & 0x03);
+ break;
+
+ case ACPI_DMT_FLAGS2:
+
+ AcpiOsPrintf ("%1.1X\n", (*Target >> 2) & 0x03);
+ break;
+
+ /* Standard Data Types */
+
+ case ACPI_DMT_UINT8:
+
+ AcpiOsPrintf ("%2.2X\n", *Target);
+ break;
+
+ case ACPI_DMT_UINT16:
+
+ AcpiOsPrintf ("%4.4X\n", ACPI_GET16 (Target));
+ break;
+
+ case ACPI_DMT_UINT24:
+
+ AcpiOsPrintf ("%2.2X%2.2X%2.2X\n",
+ *Target, *(Target + 1), *(Target + 2));
+ break;
+
+ case ACPI_DMT_UINT32:
+
+ AcpiOsPrintf ("%8.8X\n", ACPI_GET32 (Target));
+ break;
+
+ case ACPI_DMT_UINT56:
+
+ AcpiOsPrintf ("%6.6X%8.8X\n",
+ ACPI_HIDWORD (ACPI_GET64 (Target)) & 0x00FFFFFF,
+ ACPI_LODWORD (ACPI_GET64 (Target)));
+ break;
+
+ case ACPI_DMT_UINT64:
+
+ AcpiOsPrintf ("%8.8X%8.8X\n",
+ ACPI_FORMAT_UINT64 (ACPI_GET64 (Target)));
+ break;
+
+ case ACPI_DMT_STRING:
+
+ AcpiOsPrintf ("%s\n", ACPI_CAST_PTR (char, Target));
+ break;
+
+ /* Fixed length ASCII name fields */
+
+ case ACPI_DMT_SIG:
+
+ AcpiDmCheckAscii (Target, 4);
+ AcpiOsPrintf ("\"%4.4s\" ", Target);
+ TableData = AcpiDmGetTableData (ACPI_CAST_PTR (char, Target));
+ if (TableData)
+ {
+ AcpiOsPrintf ("/* %s */", TableData->Name);
+ }
+ AcpiOsPrintf ("\n");
+ break;
+
+ case ACPI_DMT_NAME4:
+
+ AcpiDmCheckAscii (Target, 4);
+ AcpiOsPrintf ("\"%4.4s\"\n", Target);
+ break;
+
+ case ACPI_DMT_NAME6:
+
+ AcpiDmCheckAscii (Target, 6);
+ AcpiOsPrintf ("\"%6.6s\"\n", Target);
+ break;
+
+ case ACPI_DMT_NAME8:
+
+ AcpiDmCheckAscii (Target, 8);
+ AcpiOsPrintf ("\"%8.8s\"\n", Target);
+ break;
+
+ /* Special Data Types */
+
+ case ACPI_DMT_CHKSUM:
+
+ /* Checksum, display and validate */
+
+ AcpiOsPrintf ("%2.2X", *Target);
+ Temp8 = AcpiTbGenerateChecksum (Table);
+ if (Temp8 != ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum)
+ {
+ AcpiOsPrintf (
+ " /* Incorrect checksum, should be %2.2X */", Temp8);
+ }
+ AcpiOsPrintf ("\n");
+ break;
+
+ case ACPI_DMT_SPACEID:
+
+ /* Address Space ID */
+
+ AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiUtGetRegionName (*Target));
+ break;
+
+ case ACPI_DMT_GAS:
+
+ /* Generic Address Structure */
+
+ AcpiOsPrintf ("<Generic Address Structure>\n");
+ AcpiDmDumpTable (ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length,
+ CurrentOffset, Target, 0, AcpiDmTableInfoGas);
+ break;
+
+ case ACPI_DMT_DMAR:
+
+ /* DMAR subtable types */
+
+ Temp16 = *Target;
+ if (Temp16 > ACPI_DMAR_TYPE_RESERVED)
+ {
+ Temp16 = ACPI_DMAR_TYPE_RESERVED;
+ }
+
+ AcpiOsPrintf ("%4.4X <%s>\n", *Target, AcpiDmDmarSubnames[Temp16]);
+ break;
+
+ case ACPI_DMT_MADT:
+
+ /* MADT subtable types */
+
+ Temp8 = *Target;
+ if (Temp8 > ACPI_MADT_TYPE_RESERVED)
+ {
+ Temp8 = ACPI_MADT_TYPE_RESERVED;
+ }
+
+ AcpiOsPrintf ("%2.2X <%s>\n", *Target, AcpiDmMadtSubnames[Temp8]);
+ break;
+
+ case ACPI_DMT_SRAT:
+
+ /* SRAT subtable types */
+
+ Temp8 = *Target;
+ if (Temp8 > ACPI_SRAT_TYPE_RESERVED)
+ {
+ Temp8 = ACPI_SRAT_TYPE_RESERVED;
+ }
+
+ AcpiOsPrintf ("%2.2X <%s>\n", *Target, AcpiDmSratSubnames[Temp8]);
+ break;
+
+ case ACPI_DMT_EXIT:
+ return;
+
+ default:
+ ACPI_ERROR ((AE_INFO,
+ "**** Invalid table opcode [%X] ****\n", Info->Opcode));
+ return;
+ }
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmCheckAscii
+ *
+ * PARAMETERS: Name - Ascii string
+ * 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>.
+ *
+ ******************************************************************************/
+
+static void
+AcpiDmCheckAscii (
+ UINT8 *Name,
+ UINT32 Count)
+{
+ UINT32 i;
+
+
+ for (i = 0; i < Count; i++)
+ {
+ if (!Name[i] || !isprint (Name[i]))
+ {
+ Name[i] = ' ';
+ }
+ }
+}
diff --git a/sys/contrib/dev/acpica/common/dmtbdump.c b/sys/contrib/dev/acpica/common/dmtbdump.c
new file mode 100644
index 0000000..03ca323
--- /dev/null
+++ b/sys/contrib/dev/acpica/common/dmtbdump.c
@@ -0,0 +1,798 @@
+/******************************************************************************
+ *
+ * Module Name: dmtbdump - Dump ACPI data tables that contain no AML code
+ * $Revision: 1.15 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 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.
+ *
+ *****************************************************************************/
+
+#include <contrib/dev/acpica/acpi.h>
+#include <contrib/dev/acpica/acdisasm.h>
+#include <contrib/dev/acpica/actables.h>
+
+/* This module used for application-level code only */
+
+#define _COMPONENT ACPI_CA_DISASSEMBLER
+ ACPI_MODULE_NAME ("dmtbdump")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpRsdp
+ *
+ * PARAMETERS: Table - A RSDP
+ *
+ * RETURN: Length of the table (there is no length field, use revision)
+ *
+ * DESCRIPTION: Format the contents of a RSDP
+ *
+ ******************************************************************************/
+
+UINT32
+AcpiDmDumpRsdp (
+ ACPI_TABLE_HEADER *Table)
+{
+ UINT32 Length = ACPI_RSDP_REV0_SIZE;
+
+
+ /* Dump the common ACPI 1.0 portion */
+
+ AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp1);
+
+ /* ACPI 2.0+ contains more data and has a Length field */
+
+ if (ACPI_CAST_PTR (ACPI_TABLE_RSDP, Table)->Revision > 0)
+ {
+ Length = ACPI_CAST_PTR (ACPI_TABLE_RSDP, Table)->Length;
+ AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp2);
+ }
+
+ return (Length);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpRsdt
+ *
+ * PARAMETERS: Table - A RSDT
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Format the contents of a RSDT
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDumpRsdt (
+ ACPI_TABLE_HEADER *Table)
+{
+ UINT32 *Array;
+ UINT32 Entries;
+ UINT32 Offset;
+ UINT32 i;
+
+
+ /* Point to start of table pointer array */
+
+ Array = ACPI_CAST_PTR (ACPI_TABLE_RSDT, Table)->TableOffsetEntry;
+ Offset = sizeof (ACPI_TABLE_HEADER);
+
+ /* RSDT uses 32-bit pointers */
+
+ Entries = (Table->Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT32);
+
+ for (i = 0; i < Entries; i++)
+ {
+ AcpiDmLineHeader2 (Offset, sizeof (UINT32), "ACPI Table Address", i);
+ AcpiOsPrintf ("%8.8X\n", Array[i]);
+ Offset += sizeof (UINT32);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpXsdt
+ *
+ * PARAMETERS: Table - A XSDT
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Format the contents of a XSDT
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDumpXsdt (
+ ACPI_TABLE_HEADER *Table)
+{
+ UINT64 *Array;
+ UINT32 Entries;
+ UINT32 Offset;
+ UINT32 i;
+
+
+ /* Point to start of table pointer array */
+
+ Array = ACPI_CAST_PTR (ACPI_TABLE_XSDT, Table)->TableOffsetEntry;
+ Offset = sizeof (ACPI_TABLE_HEADER);
+
+ /* XSDT uses 64-bit pointers */
+
+ Entries = (Table->Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT64);
+
+ for (i = 0; i < Entries; i++)
+ {
+ AcpiDmLineHeader2 (Offset, sizeof (UINT64), "ACPI Table Address", i);
+ AcpiOsPrintf ("%8.8X%8.8X\n", ACPI_FORMAT_UINT64 (Array[i]));
+ Offset += sizeof (UINT64);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpFadt
+ *
+ * PARAMETERS: Table - A FADT
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Format the contents of a FADT
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDumpFadt (
+ ACPI_TABLE_HEADER *Table)
+{
+
+ /* Common ACPI 1.0 portion of FADT */
+
+ AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt1);
+
+ /* Check for ACPI 2.0+ extended data (cannot depend on Revision field) */
+
+ if (Table->Length >= sizeof (ACPI_TABLE_FADT))
+ {
+ AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt2);
+ }
+
+ /* Validate various fields in the FADT, including length */
+
+ AcpiTbCreateLocalFadt (Table, Table->Length);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpAsf
+ *
+ * PARAMETERS: Table - A ASF table
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Format the contents of a ASF table
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDumpAsf (
+ ACPI_TABLE_HEADER *Table)
+{
+ 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;
+
+
+ /* No main table, only sub-tables */
+
+ SubTable = ACPI_ADD_PTR (ACPI_ASF_INFO, Table, Offset);
+ while (Offset < Table->Length)
+ {
+ /* Common sub-table header */
+
+ AcpiDmDumpTable (Table->Length, Offset, SubTable, 0, AcpiDmTableInfoAsfHdr);
+
+ switch (SubTable->Header.Type & 0x7F) /* Mask off top bit */
+ {
+ case ACPI_ASF_TYPE_INFO:
+ InfoTable = AcpiDmTableInfoAsf0;
+ break;
+
+ case ACPI_ASF_TYPE_ALERT:
+ InfoTable = AcpiDmTableInfoAsf1;
+ DataInfoTable = AcpiDmTableInfoAsf1a;
+ DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_ALERT));
+ DataCount = ((ACPI_ASF_ALERT *) SubTable)->Alerts;
+ DataLength = ((ACPI_ASF_ALERT *) SubTable)->DataLength;
+ DataOffset = Offset + sizeof (ACPI_ASF_ALERT);
+ break;
+
+ case ACPI_ASF_TYPE_CONTROL:
+ InfoTable = AcpiDmTableInfoAsf2;
+ DataInfoTable = AcpiDmTableInfoAsf2a;
+ DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_REMOTE));
+ DataCount = ((ACPI_ASF_REMOTE *) SubTable)->Controls;
+ DataLength = ((ACPI_ASF_REMOTE *) SubTable)->DataLength;
+ DataOffset = Offset + sizeof (ACPI_ASF_REMOTE);
+ break;
+
+ case ACPI_ASF_TYPE_BOOT:
+ InfoTable = AcpiDmTableInfoAsf3;
+ break;
+
+ case ACPI_ASF_TYPE_ADDRESS:
+ InfoTable = AcpiDmTableInfoAsf4;
+ DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_ADDRESS));
+ DataLength = ((ACPI_ASF_ADDRESS *) SubTable)->Devices;
+ DataOffset = Offset + sizeof (ACPI_ASF_ADDRESS);
+ break;
+
+ default:
+ AcpiOsPrintf ("\n**** Unknown ASF sub-table type %X\n", SubTable->Header.Type);
+ return;
+ }
+
+ AcpiDmDumpTable (Table->Length, Offset, SubTable, SubTable->Header.Length, InfoTable);
+
+
+ /* Dump variable-length extra data */
+
+ switch (SubTable->Header.Type & 0x7F) /* Mask off top bit */
+ {
+ case ACPI_ASF_TYPE_ALERT:
+ case ACPI_ASF_TYPE_CONTROL:
+
+ for (i = 0; i < DataCount; i++)
+ {
+ AcpiOsPrintf ("\n");
+ AcpiDmDumpTable (Table->Length, DataOffset, DataTable, DataLength, DataInfoTable);
+
+ DataTable = ACPI_ADD_PTR (UINT8, DataTable, DataLength);
+ DataOffset += DataLength;
+ }
+ break;
+
+ case ACPI_ASF_TYPE_ADDRESS:
+
+ for (i = 0; i < DataLength; i++)
+ {
+ if (!(i % 16))
+ {
+ AcpiDmLineHeader (DataOffset, 1, "Addresses");
+ }
+
+ AcpiOsPrintf ("%2.2X ", *DataTable);
+ DataTable++;
+ DataOffset++;
+ }
+
+ AcpiOsPrintf ("\n");
+ break;
+ }
+
+ AcpiOsPrintf ("\n");
+
+ /* Point to next sub-table */
+
+ Offset += SubTable->Header.Length;
+ SubTable = ACPI_ADD_PTR (ACPI_ASF_INFO, SubTable, SubTable->Header.Length);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpCpep
+ *
+ * PARAMETERS: Table - A CPEP table
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Format the contents of a CPEP. This table type consists
+ * of an open-ended number of subtables.
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDumpCpep (
+ ACPI_TABLE_HEADER *Table)
+{
+ ACPI_CPEP_POLLING *SubTable;
+ UINT32 Length = Table->Length;
+ UINT32 Offset = sizeof (ACPI_TABLE_CPEP);
+
+
+ /* Main table */
+
+ AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoCpep);
+
+ /* Sub-tables */
+
+ SubTable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, Table, Offset);
+ while (Offset < Table->Length)
+ {
+ AcpiOsPrintf ("\n");
+ AcpiDmDumpTable (Length, Offset, SubTable, SubTable->Length, AcpiDmTableInfoCpep0);
+
+ /* Point to next sub-table */
+
+ Offset += SubTable->Length;
+ SubTable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, SubTable, SubTable->Length);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpDmar
+ *
+ * PARAMETERS: Table - A DMAR table
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Format the contents of a DMAR. This table type consists
+ * of an open-ended number of subtables.
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDumpDmar (
+ ACPI_TABLE_HEADER *Table)
+{
+ ACPI_DMAR_HEADER *SubTable;
+ UINT32 Length = Table->Length;
+ UINT32 Offset = sizeof (ACPI_TABLE_DMAR);
+ ACPI_DMTABLE_INFO *InfoTable;
+ ACPI_DMAR_DEVICE_SCOPE *ScopeTable;
+ UINT32 ScopeOffset;
+ UINT8 *PciPath;
+ UINT32 PathOffset;
+
+
+ /* Main table */
+
+ AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDmar);
+
+ /* Sub-tables */
+
+ SubTable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Table, Offset);
+ while (Offset < Table->Length)
+ {
+ /* Common sub-table header */
+
+ AcpiOsPrintf ("\n");
+ AcpiDmDumpTable (Length, Offset, SubTable, 0, AcpiDmTableInfoDmarHdr);
+
+ switch (SubTable->Type)
+ {
+ case ACPI_DMAR_TYPE_HARDWARE_UNIT:
+ InfoTable = AcpiDmTableInfoDmar0;
+ ScopeOffset = sizeof (ACPI_DMAR_HARDWARE_UNIT);
+ break;
+ case ACPI_DMAR_TYPE_RESERVED_MEMORY:
+ InfoTable = AcpiDmTableInfoDmar1;
+ ScopeOffset = sizeof (ACPI_DMAR_RESERVED_MEMORY);
+ 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)
+ {
+ /* Dump the device scope entries */
+
+ ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE, SubTable, ScopeOffset);
+ while (ScopeOffset < SubTable->Length)
+ {
+ AcpiOsPrintf ("\n");
+ AcpiDmDumpTable (Length, Offset + ScopeOffset, ScopeTable,
+ ScopeTable->Length, AcpiDmTableInfoDmarScope);
+
+ /* Dump the PCI Path entries for this device scope */
+
+ PathOffset = sizeof (ACPI_DMAR_DEVICE_SCOPE); /* Path entries start at this offset */
+
+ 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]);
+
+ /* Point to next PCI Path entry */
+
+ PathOffset += 2;
+ PciPath += 2;
+ }
+
+ /* Point to next device scope entry */
+
+ ScopeOffset += ScopeTable->Length;
+ ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE,
+ ScopeTable, ScopeTable->Length);
+ }
+ }
+
+ /* Point to next sub-table */
+
+ Offset += SubTable->Length;
+ SubTable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, SubTable, SubTable->Length);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpMadt
+ *
+ * PARAMETERS: Table - A MADT table
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Format the contents of a MADT. This table type consists
+ * of an open-ended number of subtables.
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDumpMadt (
+ ACPI_TABLE_HEADER *Table)
+{
+ ACPI_SUBTABLE_HEADER *SubTable;
+ UINT32 Length = Table->Length;
+ UINT32 Offset = sizeof (ACPI_TABLE_MADT);
+ ACPI_DMTABLE_INFO *InfoTable;
+
+
+ /* Main table */
+
+ AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMadt);
+
+ /* Sub-tables */
+
+ SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
+ while (Offset < Table->Length)
+ {
+ /* Common sub-table header */
+
+ AcpiOsPrintf ("\n");
+ AcpiDmDumpTable (Length, Offset, SubTable, 0, AcpiDmTableInfoMadtHdr);
+
+ switch (SubTable->Type)
+ {
+ case ACPI_MADT_TYPE_LOCAL_APIC:
+ InfoTable = AcpiDmTableInfoMadt0;
+ break;
+ case ACPI_MADT_TYPE_IO_APIC:
+ InfoTable = AcpiDmTableInfoMadt1;
+ break;
+ case ACPI_MADT_TYPE_INTERRUPT_OVERRIDE:
+ InfoTable = AcpiDmTableInfoMadt2;
+ break;
+ case ACPI_MADT_TYPE_NMI_SOURCE:
+ InfoTable = AcpiDmTableInfoMadt3;
+ break;
+ case ACPI_MADT_TYPE_LOCAL_APIC_NMI:
+ InfoTable = AcpiDmTableInfoMadt4;
+ break;
+ case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE:
+ InfoTable = AcpiDmTableInfoMadt5;
+ break;
+ case ACPI_MADT_TYPE_IO_SAPIC:
+ InfoTable = AcpiDmTableInfoMadt6;
+ break;
+ case ACPI_MADT_TYPE_LOCAL_SAPIC:
+ InfoTable = AcpiDmTableInfoMadt7;
+ break;
+ case ACPI_MADT_TYPE_INTERRUPT_SOURCE:
+ InfoTable = AcpiDmTableInfoMadt8;
+ break;
+ default:
+ AcpiOsPrintf ("\n**** Unknown MADT sub-table type %X\n\n", SubTable->Type);
+ return;
+ }
+
+ AcpiDmDumpTable (Length, Offset, SubTable, SubTable->Length, InfoTable);
+
+ /* Point to next sub-table */
+
+ Offset += SubTable->Length;
+ SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, SubTable, SubTable->Length);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpMcfg
+ *
+ * PARAMETERS: Table - A MCFG Table
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Format the contents of a MCFG table
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDumpMcfg (
+ ACPI_TABLE_HEADER *Table)
+{
+ UINT32 Offset = sizeof (ACPI_TABLE_MCFG);
+ ACPI_MCFG_ALLOCATION *SubTable;
+
+
+ /* Main table */
+
+ AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMcfg);
+
+ /* Sub-tables */
+
+ SubTable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Table, Offset);
+ while (Offset < Table->Length)
+ {
+ if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Table->Length)
+ {
+ AcpiOsPrintf ("Warning: there are %d invalid trailing bytes\n",
+ sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Table->Length));
+ return;
+ }
+
+ AcpiOsPrintf ("\n");
+ AcpiDmDumpTable (Table->Length, Offset, SubTable, 0, AcpiDmTableInfoMcfg0);
+
+ /* Point to next sub-table (each subtable is of fixed length) */
+
+ Offset += sizeof (ACPI_MCFG_ALLOCATION);
+ SubTable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, SubTable,
+ sizeof (ACPI_MCFG_ALLOCATION));
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpSlit
+ *
+ * PARAMETERS: Table - An SLIT
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Format the contents of a SLIT
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDumpSlit (
+ ACPI_TABLE_HEADER *Table)
+{
+ UINT32 Offset;
+ UINT8 *Row;
+ UINT32 Localities;
+ UINT32 i;
+ UINT32 j;
+
+
+ /* Main table */
+
+ AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSlit);
+
+ /* Display the Locality NxN Matrix */
+
+ Localities = (UINT32) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->LocalityCount;
+ Offset = ACPI_OFFSET (ACPI_TABLE_SLIT, Entry[0]);
+ Row = (UINT8 *) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->Entry;
+
+ for (i = 0; i < Localities; i++)
+ {
+ /* Display one row of the matrix */
+
+ AcpiDmLineHeader2 (Offset, Localities, "Locality", i);
+ for (j = 0; j < Localities; j++)
+ {
+ /* Check for beyond EOT */
+
+ if (Offset >= Table->Length)
+ {
+ AcpiOsPrintf ("\n**** Not enough room in table for all localities\n");
+ return;
+ }
+
+ AcpiOsPrintf ("%2.2X ", Row[j]);
+ Offset++;
+
+ /* Display up to 16 bytes per output row */
+
+ if (j && (((j+1) % 16) == 0) && ((j+1) < Localities))
+ {
+ AcpiOsPrintf ("\n");
+ AcpiDmLineHeader (Offset, 0, "");
+ }
+ }
+
+ /* Point to next row */
+
+ AcpiOsPrintf ("\n");
+ Row += Localities;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpSrat
+ *
+ * PARAMETERS: Table - A SRAT table
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Format the contents of a SRAT
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDumpSrat (
+ ACPI_TABLE_HEADER *Table)
+{
+ UINT32 Offset = sizeof (ACPI_TABLE_SRAT);
+ ACPI_SUBTABLE_HEADER *SubTable;
+ ACPI_DMTABLE_INFO *InfoTable;
+
+
+ /* Main table */
+
+ AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSrat);
+
+ /* Sub-tables */
+
+ SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
+ while (Offset < Table->Length)
+ {
+ switch (SubTable->Type)
+ {
+ case ACPI_SRAT_TYPE_CPU_AFFINITY:
+ InfoTable = AcpiDmTableInfoSrat0;
+ break;
+ case ACPI_SRAT_TYPE_MEMORY_AFFINITY:
+ InfoTable = AcpiDmTableInfoSrat1;
+ break;
+ default:
+ AcpiOsPrintf ("\n**** Unknown SRAT sub-table type %X\n", SubTable->Type);
+ return;
+ }
+
+ AcpiOsPrintf ("\n");
+ AcpiDmDumpTable (Table->Length, Offset, SubTable, SubTable->Length, InfoTable);
+
+ /* Point to next sub-table */
+
+ Offset += SubTable->Length;
+ SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, SubTable, SubTable->Length);
+ }
+}
+
diff --git a/sys/contrib/dev/acpica/common/dmtbinfo.c b/sys/contrib/dev/acpica/common/dmtbinfo.c
new file mode 100644
index 0000000..5454005
--- /dev/null
+++ b/sys/contrib/dev/acpica/common/dmtbinfo.c
@@ -0,0 +1,967 @@
+/******************************************************************************
+ *
+ * Module Name: dmtbinfo - Table info for non-AML tables
+ * $Revision: 1.13 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 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.
+ *
+ *****************************************************************************/
+
+#include <contrib/dev/acpica/acpi.h>
+#include <contrib/dev/acpica/acdisasm.h>
+
+/* This module used for application-level code only */
+
+#define _COMPONENT ACPI_CA_DISASSEMBLER
+ ACPI_MODULE_NAME ("dmtbinfo")
+
+/*
+ * Macros used to generate offsets to specific table fields
+ */
+#define ACPI_FACS_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_FACS,f)
+#define ACPI_GAS_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_GENERIC_ADDRESS,f)
+#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_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_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)
+#define ACPI_SBST_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SBST,f)
+#define ACPI_SLIT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SLIT,f)
+#define ACPI_SPCR_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SPCR,f)
+#define ACPI_SPMI_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SPMI,f)
+#define ACPI_SRAT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SRAT,f)
+#define ACPI_TCPA_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_TCPA,f)
+#define ACPI_WDRT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_WDRT,f)
+
+/* Sub-tables */
+
+#define ACPI_ASF0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_INFO,f)
+#define ACPI_ASF1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_ALERT,f)
+#define ACPI_ASF1a_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_ALERT_DATA,f)
+#define ACPI_ASF2_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_REMOTE,f)
+#define ACPI_ASF2a_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_CONTROL_DATA,f)
+#define ACPI_ASF3_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_RMCP,f)
+#define ACPI_ASF4_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_ADDRESS,f)
+#define ACPI_CPEP0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_CPEP_POLLING,f)
+#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_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)
+#define ACPI_MADT3_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_NMI_SOURCE,f)
+#define ACPI_MADT4_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_LOCAL_APIC_NMI,f)
+#define ACPI_MADT5_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_LOCAL_APIC_OVERRIDE,f)
+#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_MADTH_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SUBTABLE_HEADER,f)
+#define ACPI_MCFG0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MCFG_ALLOCATION,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)
+
+/*
+ * Simplify access to flag fields by breaking them up into bytes
+ */
+#define ACPI_FLAG_OFFSET(d,f,o) (UINT8) (ACPI_OFFSET (d,f) + o)
+
+/* Flags */
+
+#define ACPI_FADT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_FADT,f,o)
+#define ACPI_FACS_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_FACS,f,o)
+#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_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)
+#define ACPI_MADT3_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_NMI_SOURCE,f,o)
+#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)
+
+
+/*
+ * ACPI Table Information, used to dump formatted ACPI tables
+ *
+ * Each entry is of the form: <Field Type, Field Offset, Field Name>
+ */
+
+/*******************************************************************************
+ *
+ * Common ACPI table header
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoHeader[] =
+{
+ {ACPI_DMT_SIG, ACPI_HDR_OFFSET (Signature[0]), "Signature"},
+ {ACPI_DMT_UINT32, ACPI_HDR_OFFSET (Length), "Table Length"},
+ {ACPI_DMT_UINT8, ACPI_HDR_OFFSET (Revision), "Revision"},
+ {ACPI_DMT_CHKSUM, ACPI_HDR_OFFSET (Checksum), "Checksum"},
+ {ACPI_DMT_NAME6, ACPI_HDR_OFFSET (OemId[0]), "Oem ID"},
+ {ACPI_DMT_NAME8, ACPI_HDR_OFFSET (OemTableId[0]), "Oem Table ID"},
+ {ACPI_DMT_UINT32, ACPI_HDR_OFFSET (OemRevision), "Oem Revision"},
+ {ACPI_DMT_NAME4, ACPI_HDR_OFFSET (AslCompilerId[0]), "Asl Compiler ID"},
+ {ACPI_DMT_UINT32, ACPI_HDR_OFFSET (AslCompilerRevision), "Asl Compiler Revision"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * GAS - Generic Address Structure
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoGas[] =
+{
+ {ACPI_DMT_SPACEID, ACPI_GAS_OFFSET (SpaceId), "Space ID"},
+ {ACPI_DMT_UINT8, ACPI_GAS_OFFSET (BitWidth), "Bit Width"},
+ {ACPI_DMT_UINT8, ACPI_GAS_OFFSET (BitOffset), "Bit Offset"},
+ {ACPI_DMT_UINT8, ACPI_GAS_OFFSET (AccessWidth), "Access Width"},
+ {ACPI_DMT_UINT64, ACPI_GAS_OFFSET (Address), "Address"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * RSDP - Root System Description Pointer (Signature is "RSD PTR ")
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoRsdp1[] =
+{
+ {ACPI_DMT_NAME8, ACPI_RSDP_OFFSET (Signature[0]), "Signature"},
+ {ACPI_DMT_UINT8, ACPI_RSDP_OFFSET (Checksum), "Checksum"},
+ {ACPI_DMT_NAME6, ACPI_RSDP_OFFSET (OemId[0]), "Oem ID"},
+ {ACPI_DMT_UINT8, ACPI_RSDP_OFFSET (Revision), "Revision"},
+ {ACPI_DMT_UINT32, ACPI_RSDP_OFFSET (RsdtPhysicalAddress), "RSDT Address"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* ACPI 2.0+ Extensions */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoRsdp2[] =
+{
+ {ACPI_DMT_UINT32, ACPI_RSDP_OFFSET (Length), "Length"},
+ {ACPI_DMT_UINT64, ACPI_RSDP_OFFSET (XsdtPhysicalAddress), "XSDT Address"},
+ {ACPI_DMT_UINT8, ACPI_RSDP_OFFSET (ExtendedChecksum), "Extended Checksum"},
+ {ACPI_DMT_UINT24, ACPI_RSDP_OFFSET (Reserved[0]), "Reserved"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * FACS - Firmware ACPI Control Structure
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoFacs[] =
+{
+ {ACPI_DMT_NAME4, ACPI_FACS_OFFSET (Signature[0]), "Signature"},
+ {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (Length), "Length"},
+ {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (HardwareSignature), "Hardware Signature"},
+ {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (FirmwareWakingVector), "Firmware Waking Vector(32)"},
+ {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (GlobalLock), "Global Lock"},
+ {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (Flags), "Flags (decoded below)"},
+ {ACPI_DMT_FLAG0, ACPI_FACS_FLAG_OFFSET (Flags,0), "S4BIOS Support Present"},
+ {ACPI_DMT_UINT64, ACPI_FACS_OFFSET (XFirmwareWakingVector), "Firmware Waking Vector(64)"},
+ {ACPI_DMT_UINT8, ACPI_FACS_OFFSET (Version), "Version"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * FADT - Fixed ACPI Description Table (Signature is FACP)
+ *
+ ******************************************************************************/
+
+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_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"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (AcpiDisable), "ACPI Disable Value"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (S4BiosRequest), "S4BIOS Command"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (PstateControl), "P-State Control"},
+ {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Pm1aEventBlock), "PM1A Event Block Address"},
+ {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Pm1bEventBlock), "PM1B Event Block Address"},
+ {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Pm1aControlBlock), "PM1A Control Block Address"},
+ {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Pm1bControlBlock), "PM1B Control Block Address"},
+ {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Pm2ControlBlock), "PM2 Control Block Address"},
+ {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (PmTimerBlock), "PM Timer Block Address"},
+ {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Gpe0Block), "GPE0 Block Address"},
+ {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Gpe1Block), "GPE1 Block Address"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Pm1EventLength), "PM1 Event Block Length"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Pm1ControlLength), "PM1 Control Block Length"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Pm2ControlLength), "PM2 Control Block Length"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (PmTimerLength), "PM Timer Block Length"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Gpe0BlockLength), "GPE0 Block Length"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Gpe1BlockLength), "GPE1 Block Length"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Gpe1Base), "GPE1 Base Offset"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (CstControl), "_CST Support"},
+ {ACPI_DMT_UINT16, ACPI_FADT_OFFSET (C2Latency), "C2 Latency"},
+ {ACPI_DMT_UINT16, ACPI_FADT_OFFSET (C3Latency), "C3 Latency"},
+ {ACPI_DMT_UINT16, ACPI_FADT_OFFSET (FlushSize), "CPU Cache Size"},
+ {ACPI_DMT_UINT16, ACPI_FADT_OFFSET (FlushStride), "Cache Flush Stride"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (DutyOffset), "Duty Cycle Offset"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (DutyWidth), "Duty Cycle Width"},
+ {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_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"},
+
+ /* 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_EXIT, 0, NULL}
+};
+
+/* ACPI 2.0+ Extensions */
+
+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_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_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_UINT64, ACPI_FADT_OFFSET (XFacs), "FACS Address"},
+ {ACPI_DMT_UINT64, ACPI_FADT_OFFSET (XDsdt), "DSDT Address"},
+ {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XPm1aEventBlock), "PM1A Event Block"},
+ {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XPm1bEventBlock), "PM1B Event Block"},
+ {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XPm1aControlBlock), "PM1A Control Block"},
+ {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XPm1bControlBlock), "PM1B Control Block"},
+ {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XPm2ControlBlock), "PM2 Control Block"},
+ {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XPmTimerBlock), "PM Timer Block"},
+ {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XGpe0Block), "GPE0 Block"},
+ {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XGpe1Block), "GPE1 Block"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*
+ * Remaining tables are not consumed directly by the ACPICA subsystem
+ */
+
+/*******************************************************************************
+ *
+ * ASF - Alert Standard Format table (Signature "ASF!")
+ *
+ ******************************************************************************/
+
+/* Common sub-table header (one per sub-table) */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoAsfHdr[] =
+{
+ {ACPI_DMT_UINT8, ACPI_ASF0_OFFSET (Header.Type), "Sub-Table Type"},
+ {ACPI_DMT_UINT8, ACPI_ASF0_OFFSET (Header.Reserved), "Reserved"},
+ {ACPI_DMT_UINT16, ACPI_ASF0_OFFSET (Header.Length), "Length"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 0: ASF Information */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoAsf0[] =
+{
+ {ACPI_DMT_UINT8, ACPI_ASF0_OFFSET (MinResetValue), "Minimum Reset Value"},
+ {ACPI_DMT_UINT8, ACPI_ASF0_OFFSET (MinResetValue), "Minimum Polling Interval"},
+ {ACPI_DMT_UINT16, ACPI_ASF0_OFFSET (SystemId), "System ID"},
+ {ACPI_DMT_UINT32, ACPI_ASF0_OFFSET (SystemId), "Manufacturer ID"},
+ {ACPI_DMT_UINT8, ACPI_ASF0_OFFSET (Flags), "Flags"},
+ {ACPI_DMT_UINT24, ACPI_ASF0_OFFSET (Reserved2[0]), "Reserved"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 1: ASF Alerts */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoAsf1[] =
+{
+ {ACPI_DMT_UINT8, ACPI_ASF1_OFFSET (AssertMask), "AssertMask"},
+ {ACPI_DMT_UINT8, ACPI_ASF1_OFFSET (DeassertMask), "DeassertMask"},
+ {ACPI_DMT_UINT8, ACPI_ASF1_OFFSET (Alerts), "Alert Count"},
+ {ACPI_DMT_UINT8, ACPI_ASF1_OFFSET (DataLength), "Alert Data Length"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 1a: ASF Alert data */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoAsf1a[] =
+{
+ {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Address), "Address"},
+ {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Command), "Command"},
+ {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Mask), "Mask"},
+ {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Value), "Value"},
+ {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (SensorType), "SensorType"},
+ {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Type), "Type"},
+ {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Offset), "Offset"},
+ {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (SourceType), "SourceType"},
+ {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Severity), "Severity"},
+ {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (SensorNumber), "SensorNumber"},
+ {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Entity), "Entity"},
+ {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Instance), "Instance"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 2: ASF Remote Control */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoAsf2[] =
+{
+ {ACPI_DMT_UINT8, ACPI_ASF2_OFFSET (Controls), "Control Count"},
+ {ACPI_DMT_UINT8, ACPI_ASF2_OFFSET (DataLength), "Control Data Length"},
+ {ACPI_DMT_UINT16, ACPI_ASF2_OFFSET (Reserved2), "Reserved"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 2a: ASF Control data */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoAsf2a[] =
+{
+ {ACPI_DMT_UINT8, ACPI_ASF2a_OFFSET (Function), "Function"},
+ {ACPI_DMT_UINT8, ACPI_ASF2a_OFFSET (Address), "Address"},
+ {ACPI_DMT_UINT8, ACPI_ASF2a_OFFSET (Command), "Command"},
+ {ACPI_DMT_UINT8, ACPI_ASF2a_OFFSET (Value), "Value"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 3: ASF RMCP Boot Options */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoAsf3[] =
+{
+ {ACPI_DMT_UINT56, ACPI_ASF3_OFFSET (Capabilities[0]), "Capabilites"},
+ {ACPI_DMT_UINT8, ACPI_ASF3_OFFSET (CompletionCode), "Completion Code"},
+ {ACPI_DMT_UINT32, ACPI_ASF3_OFFSET (EnterpriseId), "Enterprise ID"},
+ {ACPI_DMT_UINT8, ACPI_ASF3_OFFSET (Command), "Command"},
+ {ACPI_DMT_UINT16, ACPI_ASF3_OFFSET (Parameter), "Parameter"},
+ {ACPI_DMT_UINT16, ACPI_ASF3_OFFSET (BootOptions), "Boot Options"},
+ {ACPI_DMT_UINT16, ACPI_ASF3_OFFSET (OemParameters), "Oem Parameters"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 4: ASF Address */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoAsf4[] =
+{
+ {ACPI_DMT_UINT8, ACPI_ASF4_OFFSET (EpromAddress), "Eprom Address"},
+ {ACPI_DMT_UINT8, ACPI_ASF4_OFFSET (Devices), "Device Count"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * BOOT - Simple Boot Flag Table
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoBoot[] =
+{
+ {ACPI_DMT_UINT8, ACPI_BOOT_OFFSET (CmosIndex), "Boot Register Index"},
+ {ACPI_DMT_UINT24, ACPI_BOOT_OFFSET (Reserved[0]), "Reserved"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * CPEP - Corrected Platform Error Polling table
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoCpep[] =
+{
+ {ACPI_DMT_UINT64, ACPI_CPEP_OFFSET (Reserved), "Reserved"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoCpep0[] =
+{
+ {ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Type), "Sub-Table 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"},
+ {ACPI_DMT_UINT32, ACPI_CPEP0_OFFSET (Interval), "Polling Interval"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * DBGP - Debug Port
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoDbgp[] =
+{
+ {ACPI_DMT_UINT8, ACPI_DBGP_OFFSET (Type), "Interface Type"},
+ {ACPI_DMT_UINT24, ACPI_DBGP_OFFSET (Reserved[0]), "Reserved"},
+ {ACPI_DMT_GAS, ACPI_DBGP_OFFSET (DebugPort), "Debug Port Register"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * DMAR - DMA Remapping table
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoDmar[] =
+{
+ {ACPI_DMT_UINT8, ACPI_DMAR_OFFSET (Width), "Host Address Width"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* Common sub-table header (one per sub-table) */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoDmarHdr[] =
+{
+ {ACPI_DMT_DMAR, ACPI_DMAR0_OFFSET (Header.Type), "Sub-Table 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}
+};
+
+/* Common device scope entry */
+
+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_UINT8, ACPI_DMARS_OFFSET (Bus), "PCI Bus Number"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* DMAR sub-tables */
+
+/* 0: Hardware Unit Definition */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoDmar0[] =
+{
+ {ACPI_DMT_UINT64, ACPI_DMAR0_OFFSET (Address), "Register Base Address"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 1: Reserved Memory Defininition */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoDmar1[] =
+{
+ {ACPI_DMT_UINT64, ACPI_DMAR1_OFFSET (Address), "Base Address"},
+ {ACPI_DMT_UINT64, ACPI_DMAR1_OFFSET (EndAddress), "End Address (limit)"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * ECDT - Embedded Controller Boot Resources Table
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoEcdt[] =
+{
+ {ACPI_DMT_GAS, ACPI_ECDT_OFFSET (Control), "Command/Status Register"},
+ {ACPI_DMT_GAS, ACPI_ECDT_OFFSET (Data), "Data Register"},
+ {ACPI_DMT_UINT32, ACPI_ECDT_OFFSET (Uid), "UID"},
+ {ACPI_DMT_UINT8, ACPI_ECDT_OFFSET (Gpe), "GPE Number"},
+ {ACPI_DMT_STRING, ACPI_ECDT_OFFSET (Id[0]), "Namepath"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * HPET - High Precision Event Timer table
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoHpet[] =
+{
+ {ACPI_DMT_UINT32, ACPI_HPET_OFFSET (Id), "Hardware Block ID"},
+ {ACPI_DMT_GAS, ACPI_HPET_OFFSET (Address), "Timer Block Register"},
+ {ACPI_DMT_UINT8, ACPI_HPET_OFFSET (Sequence), "Sequence Number"},
+ {ACPI_DMT_UINT16, ACPI_HPET_OFFSET (MinimumTick), "Minimum Clock Ticks"},
+ {ACPI_DMT_UINT8, ACPI_HPET_OFFSET (Flags), "Flags (decoded below)"},
+ {ACPI_DMT_FLAG0, ACPI_HPET_FLAG_OFFSET (Flags,0), "Page Protect"},
+ {ACPI_DMT_FLAG1, ACPI_HPET_FLAG_OFFSET (Flags,0), "4K Page Protect"},
+ {ACPI_DMT_FLAG2, ACPI_HPET_FLAG_OFFSET (Flags,0), "64K Page Protect"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * MADT - Multiple APIC Description Table and subtables
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoMadt[] =
+{
+ {ACPI_DMT_UINT32, ACPI_MADT_OFFSET (Address), "Local Apic Address"},
+ {ACPI_DMT_UINT32, ACPI_MADT_OFFSET (Flags), "Flags (decoded below)"},
+ {ACPI_DMT_FLAG0, ACPI_MADT_FLAG_OFFSET (Flags,0), "PC-AT Compatibility"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* Common sub-table header (one per sub-table) */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoMadtHdr[] =
+{
+ {ACPI_DMT_MADT, ACPI_MADTH_OFFSET (Type), "Sub-Table Type"},
+ {ACPI_DMT_UINT8, ACPI_MADTH_OFFSET (Length), "Length"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* MADT sub-tables */
+
+/* 0: processor APIC */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoMadt0[] =
+{
+ {ACPI_DMT_UINT8, ACPI_MADT0_OFFSET (ProcessorId), "Processor ID"},
+ {ACPI_DMT_UINT8, ACPI_MADT0_OFFSET (Id), "Local Apic ID"},
+ {ACPI_DMT_UINT32, ACPI_MADT0_OFFSET (LapicFlags), "Flags (decoded below)"},
+ {ACPI_DMT_FLAG0, ACPI_MADT0_FLAG_OFFSET (LapicFlags,0), "Processor Enabled"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 1: IO APIC */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoMadt1[] =
+{
+ {ACPI_DMT_UINT8, ACPI_MADT1_OFFSET (Id), "I/O Apic ID"},
+ {ACPI_DMT_UINT8, ACPI_MADT1_OFFSET (Reserved), "Reserved"},
+ {ACPI_DMT_UINT32, ACPI_MADT1_OFFSET (Address), "Address"},
+ {ACPI_DMT_UINT32, ACPI_MADT1_OFFSET (GlobalIrqBase), "Interrupt"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 2: Interrupt Override */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoMadt2[] =
+{
+ {ACPI_DMT_UINT8, ACPI_MADT2_OFFSET (Bus), "Bus"},
+ {ACPI_DMT_UINT8, ACPI_MADT2_OFFSET (SourceIrq), "Source"},
+ {ACPI_DMT_UINT32, ACPI_MADT2_OFFSET (GlobalIrq), "Interrupt"},
+ {ACPI_DMT_UINT16, ACPI_MADT2_OFFSET (IntiFlags), "Flags (decoded below)"},
+ {ACPI_DMT_FLAGS0, ACPI_MADT2_FLAG_OFFSET (IntiFlags,0), "Polarity"},
+ {ACPI_DMT_FLAGS2, ACPI_MADT2_FLAG_OFFSET (IntiFlags,0), "Trigger Mode"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 3: NMI Sources */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoMadt3[] =
+{
+ {ACPI_DMT_UINT16, ACPI_MADT3_OFFSET (IntiFlags), "Flags (decoded below)"},
+ {ACPI_DMT_FLAGS0, ACPI_MADT3_FLAG_OFFSET (IntiFlags,0), "Polarity"},
+ {ACPI_DMT_FLAGS2, ACPI_MADT3_FLAG_OFFSET (IntiFlags,0), "Trigger Mode"},
+ {ACPI_DMT_UINT32, ACPI_MADT3_OFFSET (GlobalIrq), "Interrupt"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 4: Local APIC NMI */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoMadt4[] =
+{
+ {ACPI_DMT_UINT8, ACPI_MADT4_OFFSET (ProcessorId), "Processor ID"},
+ {ACPI_DMT_UINT16, ACPI_MADT4_OFFSET (IntiFlags), "Flags (decoded below)"},
+ {ACPI_DMT_FLAGS0, ACPI_MADT4_FLAG_OFFSET (IntiFlags,0), "Polarity"},
+ {ACPI_DMT_FLAGS2, ACPI_MADT4_FLAG_OFFSET (IntiFlags,0), "Trigger Mode"},
+ {ACPI_DMT_UINT8, ACPI_MADT4_OFFSET (Lint), "Interrupt Input LINT"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 5: Address Override */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoMadt5[] =
+{
+ {ACPI_DMT_UINT16, ACPI_MADT5_OFFSET (Reserved), "Reserved"},
+ {ACPI_DMT_UINT64, ACPI_MADT5_OFFSET (Address), "APIC Address"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 6: I/O Sapic */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoMadt6[] =
+{
+ {ACPI_DMT_UINT8, ACPI_MADT6_OFFSET (Id), "I/O Sapic ID"},
+ {ACPI_DMT_UINT8, ACPI_MADT6_OFFSET (Reserved), "Reserved"},
+ {ACPI_DMT_UINT32, ACPI_MADT6_OFFSET (GlobalIrqBase), "Interrupt Base"},
+ {ACPI_DMT_UINT64, ACPI_MADT6_OFFSET (Address), "Address"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 7: Local Sapic */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoMadt7[] =
+{
+ {ACPI_DMT_UINT8, ACPI_MADT7_OFFSET (ProcessorId), "Processor ID"},
+ {ACPI_DMT_UINT8, ACPI_MADT7_OFFSET (Id), "Local Sapic ID"},
+ {ACPI_DMT_UINT8, ACPI_MADT7_OFFSET (Eid), "Local Sapic EID"},
+ {ACPI_DMT_UINT24, ACPI_MADT7_OFFSET (Reserved[0]), "Reserved"},
+ {ACPI_DMT_UINT32, ACPI_MADT7_OFFSET (LapicFlags), "Flags (decoded below)"},
+ {ACPI_DMT_FLAG0, ACPI_MADT7_FLAG_OFFSET (LapicFlags,0), "Processor Enabled"},
+ {ACPI_DMT_UINT32, ACPI_MADT7_OFFSET (Uid), "Processor UID"},
+ {ACPI_DMT_STRING, ACPI_MADT7_OFFSET (UidString[0]), "Processor UID String"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 8: Platform Interrupt Source */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoMadt8[] =
+{
+ {ACPI_DMT_UINT16, ACPI_MADT8_OFFSET (IntiFlags), "Flags (decoded below)"},
+ {ACPI_DMT_FLAGS0, ACPI_MADT8_FLAG_OFFSET (IntiFlags,0), "Polarity"},
+ {ACPI_DMT_FLAGS2, ACPI_MADT8_FLAG_OFFSET (IntiFlags,0), "Trigger Mode"},
+ {ACPI_DMT_UINT8, ACPI_MADT8_OFFSET (Type), "InterruptType"},
+ {ACPI_DMT_UINT8, ACPI_MADT8_OFFSET (Id), "Processor ID"},
+ {ACPI_DMT_UINT8, ACPI_MADT8_OFFSET (Eid), "Processor EID"},
+ {ACPI_DMT_UINT8, ACPI_MADT8_OFFSET (IoSapicVector), "I/O Sapic Vector"},
+ {ACPI_DMT_UINT32, ACPI_MADT8_OFFSET (GlobalIrq), "Interrupt"},
+ {ACPI_DMT_UINT32, ACPI_MADT8_OFFSET (Flags), "Flags (decoded below)"},
+ {ACPI_DMT_FLAG0, ACPI_MADT8_OFFSET (Flags), "CPEI Override"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * MCFG - PCI Memory Mapped Configuration table and sub-table
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoMcfg[] =
+{
+ {ACPI_DMT_UINT64, ACPI_MCFG_OFFSET (Reserved[0]), "Reserved"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoMcfg0[] =
+{
+ {ACPI_DMT_UINT64, ACPI_MCFG0_OFFSET (Address), "Base Address"},
+ {ACPI_DMT_UINT16, ACPI_MCFG0_OFFSET (PciSegment), "Segment Group Number"},
+ {ACPI_DMT_UINT8, ACPI_MCFG0_OFFSET (StartBusNumber), "Start Bus Number"},
+ {ACPI_DMT_UINT8, ACPI_MCFG0_OFFSET (EndBusNumber), "End Bus Number"},
+ {ACPI_DMT_UINT32, ACPI_MCFG0_OFFSET (Reserved), "Reserved"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * SBST - Smart Battery Specification Table
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoSbst[] =
+{
+ {ACPI_DMT_UINT32, ACPI_SBST_OFFSET (WarningLevel), "Warning Level"},
+ {ACPI_DMT_UINT32, ACPI_SBST_OFFSET (LowLevel), "Low Level"},
+ {ACPI_DMT_UINT32, ACPI_SBST_OFFSET (CriticalLevel), "Critical Level"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * SLIT - System Locality Information Table
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoSlit[] =
+{
+ {ACPI_DMT_UINT64, ACPI_SLIT_OFFSET (LocalityCount), "Localities"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * SPCR - Serial Port Console Redirection table
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoSpcr[] =
+{
+ {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (InterfaceType), "Interface Type"},
+ {ACPI_DMT_UINT24, ACPI_SPCR_OFFSET (Reserved[0]), "Reserved"},
+ {ACPI_DMT_GAS, ACPI_SPCR_OFFSET (SerialPort), "Serial Port Register"},
+ {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (InterruptType), "Interrupt Type"},
+ {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (PcInterrupt), "PCAT-compatible IRQ"},
+ {ACPI_DMT_UINT32, ACPI_SPCR_OFFSET (Interrupt), "Interrupt"},
+ {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (BaudRate), "Baud Rate"},
+ {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (Parity), "Parity"},
+ {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (StopBits), "Stop Bits"},
+ {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (FlowControl), "Flow Control"},
+ {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (TerminalType), "Terminal Type"},
+ {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (Reserved2), "Reserved"},
+ {ACPI_DMT_UINT16, ACPI_SPCR_OFFSET (PciDeviceId), "PCI Device ID"},
+ {ACPI_DMT_UINT16, ACPI_SPCR_OFFSET (PciVendorId), "PCI Vendor ID"},
+ {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (PciBus), "PCI Bus"},
+ {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (PciDevice), "PCI Device"},
+ {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (PciFunction), "PCI Function"},
+ {ACPI_DMT_UINT32, ACPI_SPCR_OFFSET (PciFlags), "PCI Flags"},
+ {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (PciSegment), "PCI Segment"},
+ {ACPI_DMT_UINT32, ACPI_SPCR_OFFSET (Reserved2), "Reserved"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * SPMI - Server Platform Management Interface table
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoSpmi[] =
+{
+ {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (Reserved), "Reserved"},
+ {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (InterfaceType), "Interface Type"},
+ {ACPI_DMT_UINT16, ACPI_SPMI_OFFSET (SpecRevision), "IPMI Spec Version"},
+ {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (InterruptType), "Interrupt Type"},
+ {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (GpeNumber), "GPE Number"},
+ {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (Reserved1), "Reserved"},
+ {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (PciDeviceFlag), "PCI Device Flag"},
+ {ACPI_DMT_UINT32, ACPI_SPMI_OFFSET (Interrupt), "Interrupt"},
+ {ACPI_DMT_GAS, ACPI_SPMI_OFFSET (IpmiRegister), "IPMI Register"},
+ {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (PciSegment), "PCI Segment"},
+ {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (PciBus), "PCI Bus"},
+ {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (PciDevice), "PCI Device"},
+ {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (PciFunction), "PCI Function"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * SRAT - System Resource Affinity Table and sub-tables
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoSrat[] =
+{
+ {ACPI_DMT_UINT32, ACPI_SRAT_OFFSET (TableRevision), "Table Revision"},
+ {ACPI_DMT_UINT64, ACPI_SRAT_OFFSET (Reserved), "Reserved"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+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)"},
+ {ACPI_DMT_FLAG0, ACPI_SRAT0_FLAG_OFFSET (Flags,0), "Enabled"},
+ {ACPI_DMT_UINT8, ACPI_SRAT0_OFFSET (LocalSapicEid), "Local Sapic EID"},
+ {ACPI_DMT_UINT24, ACPI_SRAT0_OFFSET (ProximityDomainHi[0]), "Proximity Domain High(24)"},
+ {ACPI_DMT_UINT32, ACPI_SRAT0_OFFSET (Reserved), "Reserved"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+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 (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_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * TCPA - Trusted Computing Platform Alliance table
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoTcpa[] =
+{
+ {ACPI_DMT_UINT16, ACPI_TCPA_OFFSET (Reserved), "Reserved"},
+ {ACPI_DMT_UINT32, ACPI_TCPA_OFFSET (MaxLogLength), "Max Event Log Length"},
+ {ACPI_DMT_UINT64, ACPI_TCPA_OFFSET (LogAddress), "Event Log Address"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * WDRT - Watchdog Resource Table
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoWdrt[] =
+{
+ {ACPI_DMT_UINT32, ACPI_WDRT_OFFSET (HeaderLength), "Header Length"},
+ {ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (PciSegment), "PCI Segment"},
+ {ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (PciBus), "PCI Bus"},
+ {ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (PciDevice), "PCI Device"},
+ {ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (PciFunction), "PCI Function"},
+ {ACPI_DMT_UINT32, ACPI_WDRT_OFFSET (TimerPeriod), "Timer Period"},
+ {ACPI_DMT_UINT32, ACPI_WDRT_OFFSET (MaxCount), "Max Count"},
+ {ACPI_DMT_UINT32, ACPI_WDRT_OFFSET (MinCount), "Min Count"},
+ {ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (Flags), "Flags (decoded below)"},
+ {ACPI_DMT_FLAG0, ACPI_WDRT_OFFSET (Flags), "Enabled"},
+ {ACPI_DMT_FLAG7, ACPI_WDRT_OFFSET (Flags), "Stopped When Asleep"},
+ {ACPI_DMT_UINT24, ACPI_WDRT_OFFSET (Reserved[0]), "Reserved"},
+ {ACPI_DMT_UINT32, ACPI_WDRT_OFFSET (Entries), "Watchdog Entries"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
diff --git a/sys/contrib/dev/acpica/common/getopt.c b/sys/contrib/dev/acpica/common/getopt.c
index cdad6e1..2c61575 100644
--- a/sys/contrib/dev/acpica/common/getopt.c
+++ b/sys/contrib/dev/acpica/common/getopt.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: getopt
- * $Revision: 1.8 $
+ * $Revision: 1.10 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
diff --git a/sys/contrib/dev/acpica/compiler/aslanalyze.c b/sys/contrib/dev/acpica/compiler/aslanalyze.c
index 42f2247..93f2f0b 100644
--- a/sys/contrib/dev/acpica/compiler/aslanalyze.c
+++ b/sys/contrib/dev/acpica/compiler/aslanalyze.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: aslanalyze.c - check for semantic errors
- * $Revision: 1.96 $
+ * $Revision: 1.115 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -171,6 +171,68 @@ AnCheckMethodReturnValue (
UINT32 RequiredBtypes,
UINT32 ThisNodeBtype);
+static BOOLEAN
+AnIsInternalMethod (
+ ACPI_PARSE_OBJECT *Op);
+
+static UINT32
+AnGetInternalMethodReturnType (
+ ACPI_PARSE_OBJECT *Op);
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AnIsInternalMethod
+ *
+ * PARAMETERS: Op - Current op
+ *
+ * RETURN: Boolean
+ *
+ * DESCRIPTION: Check for an internal control method.
+ *
+ ******************************************************************************/
+
+static BOOLEAN
+AnIsInternalMethod (
+ ACPI_PARSE_OBJECT *Op)
+{
+
+ if ((!ACPI_STRCMP (Op->Asl.ExternalName, "\\_OSI")) ||
+ (!ACPI_STRCMP (Op->Asl.ExternalName, "_OSI")))
+ {
+ return (TRUE);
+ }
+
+ return (FALSE);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AnGetInternalMethodReturnType
+ *
+ * PARAMETERS: Op - Current op
+ *
+ * RETURN: Btype
+ *
+ * DESCRIPTION: Get the return type of an internal method
+ *
+ ******************************************************************************/
+
+static UINT32
+AnGetInternalMethodReturnType (
+ ACPI_PARSE_OBJECT *Op)
+{
+
+ if ((!ACPI_STRCMP (Op->Asl.ExternalName, "\\_OSI")) ||
+ (!ACPI_STRCMP (Op->Asl.ExternalName, "_OSI")))
+ {
+ return (ACPI_BTYPE_STRING);
+ }
+
+ return (0);
+}
+
/*******************************************************************************
*
@@ -182,7 +244,7 @@ AnCheckMethodReturnValue (
* RETURN: The corresponding Bit-encoded types
*
* DESCRIPTION: Convert an encoded ARGI required argument type code into a
- * bitfield type code. Implements the implicit source conversion
+ * bitfield type code. Implements the implicit source conversion
* rules.
*
******************************************************************************/
@@ -263,8 +325,11 @@ AnMapArgTypeToBtype (
case ARGI_REF_OR_STRING:
return (ACPI_BTYPE_STRING | ACPI_BTYPE_REFERENCE);
- case ARGI_REGION_OR_FIELD:
- return (ACPI_BTYPE_REGION | ACPI_BTYPE_FIELD_UNIT);
+ case ARGI_REGION_OR_BUFFER:
+
+ /* Used by Load() only. Allow buffers in addition to regions/fields */
+
+ return (ACPI_BTYPE_REGION | ACPI_BTYPE_BUFFER | ACPI_BTYPE_FIELD_UNIT);
case ARGI_DATAREFOBJ:
return (ACPI_BTYPE_INTEGER |ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER |
@@ -287,7 +352,7 @@ AnMapArgTypeToBtype (
* RETURN: Btype corresponding to the Etype
*
* DESCRIPTION: Convert an encoded ACPI type to a bitfield type applying the
- * operand conversion rules. In other words, returns the type(s)
+ * operand conversion rules. In other words, returns the type(s)
* this Etype is implicitly converted to during interpretation.
*
******************************************************************************/
@@ -480,7 +545,8 @@ AnGetBtype (
ThisNodeBtype = AnMapEtypeToBtype (Node->Type);
if (!ThisNodeBtype)
{
- AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, Op, NULL);
+ AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, Op,
+ "could not map type");
}
/*
@@ -494,8 +560,16 @@ AnGetBtype (
ReferencedNode = Node->Op;
if (!ReferencedNode)
{
- printf ("No back ptr to Op: type %X\n", Node->Type);
- return ACPI_UINT32_MAX;
+ /* Check for an internal method */
+
+ if (AnIsInternalMethod (Op))
+ {
+ return (AnGetInternalMethodReturnType (Op));
+ }
+
+ AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, Op,
+ "null Op pointer");
+ return ACPI_UINT32_MAX;
}
if (ReferencedNode->Asl.CompileFlags & NODE_METHOD_TYPED)
@@ -555,7 +629,7 @@ AnCheckForReservedName (
for (i = 0; ReservedMethods[i].Name; i++)
{
- if (!ACPI_STRNCMP (Name, ReservedMethods[i].Name, ACPI_NAME_SIZE))
+ if (ACPI_COMPARE_NAME (Name, ReservedMethods[i].Name))
{
if (ReservedMethods[i].Flags & ASL_RSVD_SCOPE)
{
@@ -613,7 +687,7 @@ AnCheckForReservedName (
}
/*
- * The name didn't match any of the known reserved names. Flag it as a
+ * The name didn't match any of the known reserved names. Flag it as a
* warning, since the entire namespace starting with an underscore is
* reserved by the ACPI spec.
*/
@@ -668,7 +742,7 @@ AnCheckForReservedMethod (
if (MethodInfo->NumArguments != 0)
{
- sprintf (MsgBuffer, " %s requires %d",
+ sprintf (MsgBuffer, "%s requires %d",
Op->Asl.ExternalName, 0);
AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_HI, Op, MsgBuffer);
@@ -684,7 +758,7 @@ AnCheckForReservedMethod (
if (MethodInfo->NumArguments != ReservedMethods[Index].NumArguments)
{
- sprintf (MsgBuffer, " %s requires %d",
+ sprintf (MsgBuffer, "%s requires %d",
ReservedMethods[Index].Name,
ReservedMethods[Index].NumArguments);
@@ -790,7 +864,7 @@ AnMapObjTypeToBtype (
*
* RETURN: Status
*
- * DESCRIPTION: Descending callback for the analysis walk. Check methods for :
+ * DESCRIPTION: Descending callback for the analysis walk. Check methods for:
* 1) Initialized local variables
* 2) Valid arguments
* 3) Return types
@@ -816,9 +890,6 @@ AnMethodAnalysisWalkBegin (
UINT8 ActualArgs = 0;
- ACPI_FUNCTION_NAME ("AnMethodAnalysisWalkBegin");
-
-
switch (Op->Asl.ParseOpcode)
{
case PARSEOP_METHOD:
@@ -942,7 +1013,7 @@ AnMethodAnalysisWalkBegin (
* Probably was an error in the method declaration,
* no additional error here
*/
- ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "%p, No parent method\n", Op));
+ ACPI_WARNING ((AE_INFO, "%p, No parent method", Op));
return (AE_ERROR);
}
@@ -986,7 +1057,7 @@ AnMethodAnalysisWalkBegin (
* Probably was an error in the method declaration,
* no additional error here
*/
- ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "%p, No parent method\n", Op));
+ ACPI_WARNING ((AE_INFO, "%p, No parent method", Op));
return (AE_ERROR);
}
@@ -1031,7 +1102,7 @@ AnMethodAnalysisWalkBegin (
* Probably was an error in the method declaration,
* no additional error here
*/
- ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "%p, No parent method\n", Op));
+ ACPI_WARNING ((AE_INFO, "%p, No parent method", Op));
return (AE_ERROR);
}
@@ -1152,7 +1223,6 @@ AnMethodAnalysisWalkBegin (
}
}
}
-
break;
@@ -1170,10 +1240,10 @@ AnMethodAnalysisWalkBegin (
*
* PARAMETERS: Op - A method parse node
*
- * RETURN: TRUE if last statement is an ASL RETURN. False otherwise
+ * RETURN: TRUE if last statement is an ASL RETURN. False otherwise
*
* DESCRIPTION: Walk down the list of top level statements within a method
- * to find the last one. Check if that last statement is in
+ * to find the last one. Check if that last statement is in
* fact a RETURN statement.
*
******************************************************************************/
@@ -1212,7 +1282,7 @@ AnLastStatementIsReturn (
*
* RETURN: Status
*
- * DESCRIPTION: Ascending callback for analysis walk. Complete method
+ * DESCRIPTION: Ascending callback for analysis walk. Complete method
* return analysis.
*
******************************************************************************/
@@ -1261,14 +1331,14 @@ AnMethodAnalysisWalkEnd (
{
/*
* No return statement, and execution can possibly exit
- * via this path. This is equivalent to Return ()
+ * via this path. This is equivalent to Return ()
*/
MethodInfo->NumReturnNoValue++;
}
/*
* Check for case where some return statements have a return value
- * and some do not. Exit without a return statement is a return with
+ * and some do not. Exit without a return statement is a return with
* no value
*/
if (MethodInfo->NumReturnNoValue &&
@@ -1281,7 +1351,7 @@ AnMethodAnalysisWalkEnd (
/*
* If there are any RETURN() statements with no value, or there is a
* control path that allows the method to exit without a return value,
- * we mark the method as a method that does not return a value. This
+ * we mark the method as a method that does not return a value. This
* knowledge can be used to check method invocations that expect a
* returned value.
*/
@@ -1302,7 +1372,7 @@ AnMethodAnalysisWalkEnd (
* and correct number of arguments
*/
AnCheckForReservedMethod (Op, MethodInfo);
- ACPI_MEM_FREE (MethodInfo);
+ ACPI_FREE (MethodInfo);
break;
@@ -1321,7 +1391,7 @@ AnMethodAnalysisWalkEnd (
/*
* If there is a peer node after the return statement, then this
* node is unreachable code -- i.e., it won't be executed because of
- * thepreceeding Return() statement.
+ * the preceeding Return() statement.
*/
if (Op->Asl.Next)
{
@@ -1337,7 +1407,7 @@ AnMethodAnalysisWalkEnd (
(Op->Asl.Next->Asl.ParseOpcode == PARSEOP_ELSE))
{
/*
- * This IF has a corresponding ELSE. The IF block has no exit,
+ * This IF has a corresponding ELSE. The IF block has no exit,
* (it contains an unconditional Return)
* mark the ELSE block to remember this fact.
*/
@@ -1353,7 +1423,7 @@ AnMethodAnalysisWalkEnd (
{
/*
* This ELSE block has no exit and the corresponding IF block
- * has no exit either. Therefore, the parent node has no exit.
+ * has no exit either. Therefore, the parent node has no exit.
*/
Op->Asl.Parent->Asl.CompileFlags |= NODE_HAS_NO_EXIT;
}
@@ -1407,8 +1477,8 @@ AnMethodTypingWalkBegin (
*
* RETURN: Status
*
- * DESCRIPTION: Ascending callback for typing walk. Complete method
- * return analysis. Check methods for :
+ * DESCRIPTION: Ascending callback for typing walk. Complete the method
+ * return analysis. Check methods for:
* 1) Initialized local variables
* 2) Valid arguments
* 3) Return types
@@ -1442,17 +1512,24 @@ AnMethodTypingWalkEnd (
(ThisNodeBtype == (ACPI_UINT32_MAX -1)))
{
/*
- * The method is untyped at this time (typically a forward
- * reference). We must recursively type the method here
+ * The called method is untyped at this time (typically a
+ * forward reference).
+ *
+ * Check for a recursive method call first.
*/
- TrWalkParseTree (Op->Asl.Child->Asl.Node->Op,
- ASL_WALK_VISIT_TWICE, AnMethodTypingWalkBegin,
- AnMethodTypingWalkEnd, NULL);
+ if (Op->Asl.ParentMethod != Op->Asl.Child->Asl.Node->Op)
+ {
+ /* We must type the method here */
- ThisNodeBtype = AnGetBtype (Op->Asl.Child);
+ TrWalkParseTree (Op->Asl.Child->Asl.Node->Op,
+ ASL_WALK_VISIT_TWICE, AnMethodTypingWalkBegin,
+ AnMethodTypingWalkEnd, NULL);
+
+ ThisNodeBtype = AnGetBtype (Op->Asl.Child);
+ }
}
- /* Returns a value, get it's type */
+ /* Returns a value, save the value type */
if (Op->Asl.ParentMethod)
{
@@ -1550,7 +1627,7 @@ AnCheckMethodReturnValue (
*
* RETURN: Status
*
- * DESCRIPTION: Descending callback for the analysis walk. Check methods for:
+ * DESCRIPTION: Descending callback for the analysis walk. Check methods for:
* 1) Initialized local variables
* 2) Valid arguments
* 3) Return types
@@ -1576,7 +1653,7 @@ AnOperandTypecheckWalkBegin (
*
* RETURN: Status
*
- * DESCRIPTION: Ascending callback for analysis walk. Complete method
+ * DESCRIPTION: Ascending callback for analysis walk. Complete method
* return analysis.
*
******************************************************************************/
@@ -1641,7 +1718,9 @@ AnOperandTypecheckWalkEnd (
if (ArgOp->Asl.ParseOpcode == PARSEOP_METHODCALL)
{
- if (!ACPI_STRCMP (ArgOp->Asl.ExternalName, "\\_OSI"))
+ /* Check for an internal method */
+
+ if (AnIsInternalMethod (ArgOp))
{
return (AE_OK);
}
@@ -1812,6 +1891,11 @@ AnOperandTypecheckWalkEnd (
if (ArgOp->Asl.ParseOpcode == PARSEOP_METHODCALL)
{
+ if (AnIsInternalMethod (ArgOp))
+ {
+ return (AE_OK);
+ }
+
/* Check a method call for a valid return value */
AnCheckMethodReturnValue (Op, OpInfo, ArgOp,
@@ -1851,16 +1935,81 @@ AnOperandTypecheckWalkEnd (
/*******************************************************************************
*
+ * FUNCTION: AnIsResultUsed
+ *
+ * PARAMETERS: Op - Parent op for the operator
+ *
+ * RETURN: TRUE if result from this operation is actually consumed
+ *
+ * DESCRIPTION: Determine if the function result value from an operator is
+ * used.
+ *
+ ******************************************************************************/
+
+BOOLEAN
+AnIsResultUsed (
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_PARSE_OBJECT *Parent;
+
+
+ switch (Op->Asl.ParseOpcode)
+ {
+ case PARSEOP_INCREMENT:
+ case PARSEOP_DECREMENT:
+
+ /* These are standalone operators, no return value */
+
+ return (TRUE);
+
+ default:
+ break;
+ }
+
+ /* Examine parent to determine if the return value is used */
+
+ Parent = Op->Asl.Parent;
+ switch (Parent->Asl.ParseOpcode)
+ {
+ /* If/While - check if the operator is the predicate */
+
+ case PARSEOP_IF:
+ case PARSEOP_WHILE:
+
+ /* First child is the predicate */
+
+ if (Parent->Asl.Child == Op)
+ {
+ return (TRUE);
+ }
+ return (FALSE);
+
+ /* Not used if one of these is the parent */
+
+ case PARSEOP_METHOD:
+ case PARSEOP_DEFINITIONBLOCK:
+ case PARSEOP_ELSE:
+
+ return (FALSE);
+
+ default:
+ /* Any other type of parent means that the result is used */
+
+ return (TRUE);
+ }
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AnOtherSemanticAnalysisWalkBegin
*
* PARAMETERS: ASL_WALK_CALLBACK
*
* RETURN: Status
*
- * DESCRIPTION: Descending callback for the analysis walk. Check methods for :
- * 1) Initialized local variables
- * 2) Valid arguments
- * 3) Return types
+ * DESCRIPTION: Descending callback for the analysis walk. Checks for
+ * miscellaneous issues in the code.
*
******************************************************************************/
@@ -1870,6 +2019,130 @@ AnOtherSemanticAnalysisWalkBegin (
UINT32 Level,
void *Context)
{
+ ACPI_PARSE_OBJECT *ArgNode;
+ ACPI_PARSE_OBJECT *PrevArgNode = NULL;
+ const ACPI_OPCODE_INFO *OpInfo;
+
+
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode);
+
+ /*
+ * Determine if an execution class operator actually does something by
+ * checking if it has a target and/or the function return value is used.
+ * (Target is optional, so a standalone statement can actually do nothing.)
+ */
+ if ((OpInfo->Class == AML_CLASS_EXECUTE) &&
+ (OpInfo->Flags & AML_HAS_RETVAL) &&
+ (!AnIsResultUsed (Op)))
+ {
+ if (OpInfo->Flags & AML_HAS_TARGET)
+ {
+ /*
+ * Find the target node, it is always the last child. If the traget
+ * is not specified in the ASL, a default node of type Zero was
+ * created by the parser.
+ */
+ ArgNode = Op->Asl.Child;
+ while (ArgNode->Asl.Next)
+ {
+ PrevArgNode = ArgNode;
+ ArgNode = ArgNode->Asl.Next;
+ }
+
+ /* Divide() is the only weird case, it has two targets */
+
+ if (Op->Asl.AmlOpcode == AML_DIVIDE_OP)
+ {
+ if ((ArgNode->Asl.ParseOpcode == PARSEOP_ZERO) &&
+ (PrevArgNode->Asl.ParseOpcode == PARSEOP_ZERO))
+ {
+ AslError (ASL_WARNING, ASL_MSG_RESULT_NOT_USED, Op, Op->Asl.ExternalName);
+ }
+ }
+ else if (ArgNode->Asl.ParseOpcode == PARSEOP_ZERO)
+ {
+ AslError (ASL_WARNING, ASL_MSG_RESULT_NOT_USED, Op, Op->Asl.ExternalName);
+ }
+ }
+ else
+ {
+ /*
+ * Has no target and the result is not used. Only a couple opcodes
+ * can have this combination.
+ */
+ switch (Op->Asl.ParseOpcode)
+ {
+ case PARSEOP_ACQUIRE:
+ case PARSEOP_WAIT:
+ break;
+
+ default:
+ AslError (ASL_WARNING, ASL_MSG_RESULT_NOT_USED, Op, Op->Asl.ExternalName);
+ break;
+ }
+ }
+ }
+
+
+ /*
+ * Semantic checks for individual ASL operators
+ */
+ switch (Op->Asl.ParseOpcode)
+ {
+ case PARSEOP_ACQUIRE:
+ case PARSEOP_WAIT:
+ /*
+ * Emit a warning if the timeout parameter for these operators is not
+ * ACPI_WAIT_FOREVER, and the result value from the operator is not
+ * checked, meaning that a timeout could happen, but the code
+ * would not know about it.
+ */
+
+ /* First child is the namepath, 2nd child is timeout */
+
+ ArgNode = Op->Asl.Child;
+ ArgNode = ArgNode->Asl.Next;
+
+ /*
+ * Check for the WAIT_FOREVER case - defined by the ACPI spec to be
+ * 0xFFFF or greater
+ */
+ if (((ArgNode->Asl.ParseOpcode == PARSEOP_WORDCONST) ||
+ (ArgNode->Asl.ParseOpcode == PARSEOP_INTEGER)) &&
+ (ArgNode->Asl.Value.Integer >= (ACPI_INTEGER) ACPI_WAIT_FOREVER))
+ {
+ break;
+ }
+
+ /*
+ * The operation could timeout. If the return value is not used
+ * (indicates timeout occurred), issue a warning
+ */
+ if (!AnIsResultUsed (Op))
+ {
+ AslError (ASL_WARNING, ASL_MSG_TIMEOUT, ArgNode, Op->Asl.ExternalName);
+ }
+ break;
+
+ case PARSEOP_CREATEFIELD:
+ /*
+ * Check for a zero Length (NumBits) operand. NumBits is the 3rd operand
+ */
+ ArgNode = Op->Asl.Child;
+ ArgNode = ArgNode->Asl.Next;
+ ArgNode = ArgNode->Asl.Next;
+
+ if ((ArgNode->Asl.ParseOpcode == PARSEOP_ZERO) ||
+ ((ArgNode->Asl.ParseOpcode == PARSEOP_INTEGER) &&
+ (ArgNode->Asl.Value.Integer == 0)))
+ {
+ AslError (ASL_ERROR, ASL_MSG_NON_ZERO, ArgNode, NULL);
+ }
+ break;
+
+ default:
+ break;
+ }
return AE_OK;
}
@@ -1883,7 +2156,7 @@ AnOtherSemanticAnalysisWalkBegin (
*
* RETURN: Status
*
- * DESCRIPTION: Ascending callback for analysis walk. Complete method
+ * DESCRIPTION: Ascending callback for analysis walk. Complete method
* return analysis.
*
******************************************************************************/
diff --git a/sys/contrib/dev/acpica/compiler/aslcodegen.c b/sys/contrib/dev/acpica/compiler/aslcodegen.c
index 234b17a..25ee729 100644
--- a/sys/contrib/dev/acpica/compiler/aslcodegen.c
+++ b/sys/contrib/dev/acpica/compiler/aslcodegen.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: aslcodegen - AML code generation
- * $Revision: 1.57 $
+ * $Revision: 1.62 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -205,6 +205,18 @@ CgAmlWriteWalk (
void *Context)
{
+ /*
+ * Print header at level 0. Alignment assumes 32-bit pointers
+ */
+ if (!Level)
+ {
+ DbgPrint (ASL_TREE_OUTPUT,
+ "Final parse tree used for AML output:\n");
+ DbgPrint (ASL_TREE_OUTPUT,
+ "%*s Value P_Op A_Op OpLen PByts Len SubLen PSubLen OpPtr Child Parent Flags AcTyp Final Col L\n",
+ 76, " ");
+ }
+
/* Debug output */
DbgPrint (ASL_TREE_OUTPUT,
@@ -223,23 +235,24 @@ CgAmlWriteWalk (
DbgPrint (ASL_TREE_OUTPUT, " ");
}
- DbgPrint (ASL_TREE_OUTPUT,
- "Val-%08X POp-%04X AOp-%04X OpLen-%01X PByts-%01X Len-%04X SubLen-%04X PSubLen-%04X Op-%08X Chld-%08X Paren-%08X Flags-%04X AcTyp-%08X C-%2d L-%d\n",
- (UINT32) Op->Asl.Value.Integer,
- Op->Asl.ParseOpcode,
- Op->Asl.AmlOpcode,
- Op->Asl.AmlOpcodeLength,
- Op->Asl.AmlPkgLenBytes,
- Op->Asl.AmlLength,
- Op->Asl.AmlSubtreeLength,
- Op->Asl.Parent ? Op->Asl.Parent->Asl.AmlSubtreeLength : 0,
- Op,
- Op->Asl.Child,
- Op->Asl.Parent,
- Op->Asl.CompileFlags,
- Op->Asl.AcpiBtype,
- Op->Asl.Column,
- 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 */
@@ -383,7 +396,7 @@ CgWriteAmlOpcode (
CgLocalWriteAmlData (Op, &PkgLen.LenBytes[0], 1);
}
- else
+ else if (Op->Asl.AmlPkgLenBytes != 0)
{
/*
* Encode the "bytes to follow" in the first byte, top two bits.
@@ -575,8 +588,6 @@ CgWriteNode (
ASL_RESOURCE_NODE *Rnode;
- Op->Asl.FinalAmlLength = 0;
-
/* Always check for DEFAULT_ARG and other "Noop" nodes */
/* TBD: this may not be the best place for this check */
@@ -588,6 +599,8 @@ CgWriteNode (
return;
}
+ Op->Asl.FinalAmlLength = 0;
+
switch (Op->Asl.AmlOpcode)
{
case AML_RAW_DATA_BYTE:
diff --git a/sys/contrib/dev/acpica/compiler/aslcompile.c b/sys/contrib/dev/acpica/compiler/aslcompile.c
index e6c2149..eba3552 100644
--- a/sys/contrib/dev/acpica/compiler/aslcompile.c
+++ b/sys/contrib/dev/acpica/compiler/aslcompile.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: aslcompile - top level compile module
- * $Revision: 1.88 $
+ * $Revision: 1.97 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -328,13 +328,97 @@ CmFlushSourceCode (
/*******************************************************************************
*
+ * FUNCTION: FlConsume*
+ *
+ * PARAMETERS: FileInfo - Points to an open input file
+ *
+ * RETURN: Number of lines consumed
+ *
+ * DESCRIPTION: Step over both types of comment during check for ascii chars
+ *
+ ******************************************************************************/
+
+void
+FlConsumeAnsiComment (
+ ASL_FILE_INFO *FileInfo,
+ ASL_FILE_STATUS *Status)
+{
+ UINT8 Byte;
+ BOOLEAN ClosingComment = FALSE;
+
+
+ while (fread (&Byte, 1, 1, FileInfo->Handle))
+ {
+ /* Scan until comment close is found */
+
+ if (ClosingComment)
+ {
+ if (Byte == '/')
+ {
+ return;
+ }
+
+ if (Byte != '*')
+ {
+ /* Reset */
+
+ ClosingComment = FALSE;
+ }
+ }
+ else if (Byte == '*')
+ {
+ ClosingComment = TRUE;
+ }
+
+ /* Maintain line count */
+
+ if (Byte == 0x0A)
+ {
+ Status->Line++;
+ }
+
+ Status->Offset++;
+ }
+}
+
+
+void
+FlConsumeNewComment (
+ ASL_FILE_INFO *FileInfo,
+ ASL_FILE_STATUS *Status)
+{
+ UINT8 Byte;
+
+
+ while (fread (&Byte, 1, 1, FileInfo->Handle))
+ {
+ Status->Offset++;
+
+ /* Comment ends at newline */
+
+ if (Byte == 0x0A)
+ {
+ Status->Line++;
+ return;
+ }
+ }
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: FlCheckForAscii
*
* PARAMETERS: FileInfo - Points to an open input file
*
* RETURN: Status
*
- * DESCRIPTION: Verify that the input file is entirely ASCII.
+ * DESCRIPTION: Verify that the input file is entirely ASCII. Ignores characters
+ * within comments. Note: does not handle nested comments and does
+ * not handle comment delimiters within string literals. However,
+ * on the rare chance this happens and an invalid character is
+ * missed, the parser will catch the error by failing in some
+ * spectactular manner.
*
******************************************************************************/
@@ -344,13 +428,42 @@ FlCheckForAscii (
{
UINT8 Byte;
ACPI_SIZE BadBytes = 0;
- ACPI_SIZE Offset = 0;
+ BOOLEAN OpeningComment = FALSE;
+ ASL_FILE_STATUS Status;
+
+ Status.Line = 1;
+ Status.Offset = 0;
/* Read the entire file */
while (fread (&Byte, 1, 1, FileInfo->Handle))
{
+ /* Ignore comment fields (allow non-ascii within) */
+
+ if (OpeningComment)
+ {
+ /* Check for second comment open delimiter */
+
+ if (Byte == '*')
+ {
+ FlConsumeAnsiComment (FileInfo, &Status);
+ }
+
+ if (Byte == '/')
+ {
+ FlConsumeNewComment (FileInfo, &Status);
+ }
+
+ /* Reset */
+
+ OpeningComment = FALSE;
+ }
+ else if (Byte == '/')
+ {
+ OpeningComment = TRUE;
+ }
+
/* Check for an ASCII character */
if (!isascii (Byte))
@@ -358,12 +471,21 @@ FlCheckForAscii (
if (BadBytes < 10)
{
AcpiOsPrintf (
- "Non-ASCII character [0x%2.2X] found at file offset 0x%8.8X\n",
- Byte, Offset);
+ "Non-ASCII character [0x%2.2X] found in line %u, file offset 0x%.2X\n",
+ Byte, Status.Line, Status.Offset);
}
+
BadBytes++;
}
- Offset++;
+
+ /* Update line counter */
+
+ else if (Byte == 0x0A)
+ {
+ Status.Line++;
+ }
+
+ Status.Offset++;
}
/* Seek back to the beginning of the source file */
@@ -375,9 +497,9 @@ FlCheckForAscii (
if (BadBytes)
{
AcpiOsPrintf (
- "%d non-ASCII characters found in input file, could be a binary file\n",
+ "%u non-ASCII characters found in input source text, could be a binary file\n",
BadBytes);
- AslError (ASL_WARNING, ASL_MSG_NON_ASCII, NULL, FileInfo->Filename);
+ AslError (ASL_ERROR, ASL_MSG_NON_ASCII, NULL, FileInfo->Filename);
return (AE_BAD_CHARACTER);
}
@@ -420,19 +542,13 @@ CmDoCompile (
return -1;
}
- /* Optional check for 100% ASCII source file */
+ /* Check for 100% ASCII source file (comments are ignored) */
- if (Gbl_CheckForAscii)
+ Status = FlCheckForAscii (&Gbl_Files[ASL_FILE_INPUT]);
+ if (ACPI_FAILURE (Status))
{
- /*
- * NOTE: This code is optional because there can be "special" characters
- * embedded in comments (such as the "copyright" symbol, 0xA9).
- * Just emit a warning if there are non-ascii characters present.
- */
-
- /* Check if the input file is 100% ASCII text */
-
- Status = FlCheckForAscii (&Gbl_Files[ASL_FILE_INPUT]);
+ AePrintErrorLog (ASL_FILE_STDERR);
+ return -1;
}
Status = FlOpenMiscOutputFiles (Gbl_OutputFilenamePrefix);
@@ -462,6 +578,10 @@ CmDoCompile (
return -1;
}
+ /* Optional parse tree dump, compiler debug output only */
+
+ LsDumpParseTree ();
+
OpcGetIntegerWidth (RootNode);
UtEndEvent (Event);
@@ -549,16 +669,20 @@ CmDoCompile (
return -1;
}
- /* Namespace lookup */
+ /* Namespace cross-reference */
AslGbl_NamespaceEvent = UtBeginEvent ("Cross reference parse tree and Namespace");
Status = LkCrossReferenceNamespace ();
- UtEndEvent (AslGbl_NamespaceEvent);
if (ACPI_FAILURE (Status))
{
return -1;
}
+ /* Namespace - Check for non-referenced objects */
+
+ LkFindUnreferencedObjects ();
+ UtEndEvent (AslGbl_NamespaceEvent);
+
/*
* Semantic analysis. This can happen only after the
* namespace has been loaded and cross-referenced.
@@ -774,24 +898,28 @@ CmCleanupAndExit (
*/
if (!Gbl_SourceOutputFlag)
{
- unlink (Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
+ remove (Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
}
/* Delete AML file if there are errors */
if ((Gbl_ExceptionCount[ASL_ERROR] > 0) && (!Gbl_IgnoreErrors))
{
- unlink (Gbl_Files[ASL_FILE_AML_OUTPUT].Filename);
+ remove (Gbl_Files[ASL_FILE_AML_OUTPUT].Filename);
}
if (Gbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT)
{
- printf ("\nMaximum error count (%d) exceeded.\n", ASL_MAX_ERROR_COUNT);
+ printf ("\nMaximum error count (%d) exceeded\n", ASL_MAX_ERROR_COUNT);
}
UtDisplaySummary (ASL_FILE_STDOUT);
- if (Gbl_ExceptionCount[ASL_ERROR] > 0)
+ /*
+ * 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);
}
diff --git a/sys/contrib/dev/acpica/compiler/aslcompiler.h b/sys/contrib/dev/acpica/compiler/aslcompiler.h
index d3216a6..6477665 100644
--- a/sys/contrib/dev/acpica/compiler/aslcompiler.h
+++ b/sys/contrib/dev/acpica/compiler/aslcompiler.h
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: aslcompiler.h - common include file for iASL
- * $Revision: 1.142 $
+ * $Revision: 1.148 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -307,10 +307,9 @@ void
AePrintErrorLog (
UINT32 FileId);
-ACPI_STATUS
+ACPI_PHYSICAL_ADDRESS
AeLocalGetRootPointer (
- UINT32 Flags,
- ACPI_PHYSICAL_ADDRESS *RsdpPhysicalAddress);
+ void);
/*
@@ -333,6 +332,9 @@ void
LsDoHexOutput (
void);
+void
+LsDumpParseTree (
+ void);
/*
* aslfold - constant folding
@@ -607,6 +609,10 @@ ACPI_STATUS
LkCrossReferenceNamespace (
void);
+void
+LkFindUnreferencedObjects (
+ void);
+
ACPI_STATUS
LsDisplayNamespace (
void);
@@ -760,6 +766,11 @@ RsDoResourceTemplate (
* aslrestype1 - generate Small descriptors
*/
ASL_RESOURCE_NODE *
+RsDoEndTagDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset);
+
+ASL_RESOURCE_NODE *
RsDoDmaDescriptor (
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset);
diff --git a/sys/contrib/dev/acpica/compiler/aslcompiler.l b/sys/contrib/dev/acpica/compiler/aslcompiler.l
index e5eb3c5..78be4ea 100644
--- a/sys/contrib/dev/acpica/compiler/aslcompiler.l
+++ b/sys/contrib/dev/acpica/compiler/aslcompiler.l
@@ -3,7 +3,7 @@
/******************************************************************************
*
* Module Name: aslcompiler.l - Flex input file
- * $Revision: 1.74 $
+ * $Revision: 1.79 $
*
*****************************************************************************/
@@ -11,7 +11,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -579,7 +579,7 @@ AslPopInputFileStack (
/* All done with this node */
- ACPI_MEM_FREE (Fnode);
+ ACPI_FREE (Fnode);
return 0;
}
@@ -926,13 +926,13 @@ comment2 (void)
char
literal (void)
{
- char *s = MsgBuffer;
+ char *StringBuffer = MsgBuffer;
+ char *EndBuffer = MsgBuffer + ASL_MSG_BUFFER_SIZE;
char *CleanString;
char StringChar;
UINT32 State = ASL_NORMAL_CHAR;
UINT32 i = 0;
UINT8 Digit;
- UINT8 StringLength = 0;
char ConvertBuffer[4];
@@ -944,17 +944,6 @@ literal (void)
InsertLineBuffer ('\"');
while ((StringChar = (char) input()) != EOF)
{
- StringLength++;
- if (StringLength == ACPI_MAX_STRING_CONVERSION)
- {
- /* Emit error only once, but keep going */
-
- AslCommonError (ASL_ERROR, ASL_MSG_STRING_LENGTH,
- Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
- Gbl_CurrentLineOffset, Gbl_CurrentColumn,
- Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
- }
-
InsertLineBuffer (StringChar);
DoCharacter:
@@ -1073,8 +1062,12 @@ DoCharacter:
}
else
{
- *s = (char) Digit;
- s++;
+ *StringBuffer = (char) Digit;
+ StringBuffer++;
+ if (StringBuffer >= EndBuffer)
+ {
+ goto BufferOverflow;
+ }
}
State = ASL_NORMAL_CHAR;
@@ -1114,8 +1107,12 @@ DoCharacter:
}
else
{
- *s = (char) Digit;
- s++;
+ *StringBuffer = (char) Digit;
+ StringBuffer++;
+ if (StringBuffer >= EndBuffer)
+ {
+ goto BufferOverflow;
+ }
}
State = ASL_NORMAL_CHAR;
@@ -1132,8 +1129,12 @@ DoCharacter:
/* Save the finished character */
- *s = StringChar;
- s++;
+ *StringBuffer = StringChar;
+ StringBuffer++;
+ if (StringBuffer >= EndBuffer)
+ {
+ goto BufferOverflow;
+ }
}
/*
@@ -1150,7 +1151,7 @@ CompletedString:
/*
* Null terminate the input string and copy string to a new buffer
*/
- *s = 0;
+ *StringBuffer = 0;
CleanString = UtGetStringBuffer (strlen (MsgBuffer) + 1);
if (!CleanString)
@@ -1165,6 +1166,17 @@ CompletedString:
ACPI_STRCPY (CleanString, MsgBuffer);
AslCompilerlval.s = CleanString;
return (TRUE);
+
+
+BufferOverflow:
+
+ /* Literal was too long */
+
+ AslCommonError (ASL_ERROR, ASL_MSG_STRING_LENGTH,
+ Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
+ Gbl_CurrentLineOffset, Gbl_CurrentColumn,
+ Gbl_Files[ASL_FILE_INPUT].Filename, "Max length 4096");
+ return (FALSE);
}
diff --git a/sys/contrib/dev/acpica/compiler/aslcompiler.y b/sys/contrib/dev/acpica/compiler/aslcompiler.y
index d7d9773..0b33d38 100644
--- a/sys/contrib/dev/acpica/compiler/aslcompiler.y
+++ b/sys/contrib/dev/acpica/compiler/aslcompiler.y
@@ -3,7 +3,7 @@
/******************************************************************************
*
* Module Name: aslcompiler.y - Bison input file (ASL grammar and actions)
- * $Revision: 1.92 $
+ * $Revision: 1.105 $
*
*****************************************************************************/
@@ -11,7 +11,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -133,6 +133,19 @@
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslparse")
+/*
+ * Global Notes:
+ *
+ * October 2005: The following list terms have been optimized (from the
+ * original ASL grammar in the ACPI specification) to force the immediate
+ * reduction of each list item so that the parse stack use doesn't increase on
+ * each list element and possibly overflow on very large lists (>4000 items).
+ * This dramatically reduces use of the parse stack overall.
+ *
+ * ArgList, TermList, Objectlist, ByteList, DWordList, PackageList,
+ * ResourceMacroList, and FieldUnitList
+ */
+
/*
* Next statement is important - this makes everything public so that
@@ -166,14 +179,20 @@ AslLocalAllocate (unsigned int Size);
*/
%union {
- UINT64 i;
- char *s;
- ACPI_PARSE_OBJECT *n;
+ UINT64 i;
+ char *s;
+ ACPI_PARSE_OBJECT *n;
}
/*! [Begin] no source code translation */
+/*
+ * These shift/reduce conflicts are expected. There should be zer0
+ * reduce/reduce conflicts.
+ */
+%expect 64
+
/*
* Token types: These are returned by the lexer
@@ -255,6 +274,7 @@ AslLocalAllocate (unsigned int Size);
%token <i> PARSEOP_ELSE
%token <i> PARSEOP_ELSEIF
%token <i> PARSEOP_ENDDEPENDENTFN
+%token <i> PARSEOP_ENDTAG
%token <i> PARSEOP_ERRORNODE
%token <i> PARSEOP_EVENT
%token <i> PARSEOP_EXTENDEDIO
@@ -464,7 +484,6 @@ AslLocalAllocate (unsigned int Size);
%type <n> NameSpaceModifier
%type <n> UserTerm
%type <n> ArgList
-%type <n> ArgListTail
%type <n> TermArg
%type <n> Target
%type <n> RequiredTarget
@@ -494,7 +513,6 @@ AslLocalAllocate (unsigned int Size);
%type <n> ExternalTerm
%type <n> FieldUnitList
-%type <n> FieldUnitListTail
%type <n> FieldUnit
%type <n> FieldUnitEntry
@@ -552,8 +570,8 @@ AslLocalAllocate (unsigned int Size);
%type <n> SleepTerm
%type <n> StallTerm
%type <n> SwitchTerm
-%type <n> CaseTermList
-%type <n> DefaultTermList
+%type <n> CaseDefaultTermList
+//%type <n> CaseTermList
%type <n> CaseTerm
%type <n> DefaultTerm
%type <n> UnloadTerm
@@ -652,19 +670,11 @@ AslLocalAllocate (unsigned int Size);
%type <n> LocalTerm
%type <n> DebugTerm
-
%type <n> Integer
-
%type <n> ByteConst
%type <n> WordConst
%type <n> DWordConst
%type <n> QWordConst
-
-/* Useless
-%type <n> WordConst
-%type <n> QWordConst
-*/
-
%type <n> String
%type <n> ConstTerm
@@ -676,13 +686,10 @@ AslLocalAllocate (unsigned int Size);
%type <n> BufferTerm
%type <n> ByteList
-%type <n> ByteListTail
%type <n> DWordList
-%type <n> DWordListTail
%type <n> PackageTerm
%type <n> PackageList
-%type <n> PackageListTail
%type <n> PackageElement
%type <n> VarPackageLengthTerm
@@ -802,8 +809,8 @@ DefinitionBlockTerm
TermList
: {$$ = NULL;}
- | Term TermList {$$ = TrLinkPeerNode (TrSetNodeFlags ($1, NODE_RESULT_NOT_USED),$2);}
- | Term ';' TermList {$$ = TrLinkPeerNode (TrSetNodeFlags ($1, NODE_RESULT_NOT_USED),$3);}
+ | TermList Term {$$ = TrLinkPeerNode (TrSetNodeFlags ($1, NODE_RESULT_NOT_USED),$2);}
+ | TermList ';' Term {$$ = TrLinkPeerNode (TrSetNodeFlags ($1, NODE_RESULT_NOT_USED),$3);}
;
Term
@@ -826,7 +833,7 @@ CompilerDirective
ObjectList
: {$$ = NULL;}
- | Object ObjectList {$$ = TrLinkPeerNode ($1,$2);}
+ | ObjectList Object {$$ = TrLinkPeerNode ($1,$2);}
| error {$$ = AslDoError(); yyclearin;}
;
@@ -901,21 +908,23 @@ UserTerm
ArgList
: {$$ = NULL;}
- | TermArg ArgListTail {$$ = TrLinkPeerNode ($1,$2);}
- ;
-
-ArgListTail
- : {$$ = NULL;}
- | ',' TermArg ArgListTail {$$ = TrLinkPeerNode ($2,$3);}
- | ',' {$$ = NULL;} /* Allows a trailing comma at list end */
+ | TermArg
+ | ArgList ',' /* Allows a trailing comma at list end */
+ | ArgList ','
+ TermArg {$$ = TrLinkPeerNode ($1,$3);}
;
-TermArg
- : Type2Opcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
+/*
+Removed from TermArg due to reduce/reduce conflicts
| Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
| Type2StringOpcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
| Type2BufferOpcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
| Type2BufferOrStringOpcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
+
+*/
+
+TermArg
+ : Type2Opcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
| DataObject {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
| NameString {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
| ArgTerm {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
@@ -938,61 +947,43 @@ SimpleTarget
| ArgTerm {}
;
-/* Rules for specifying the Return type for control methods */
+/* Rules for specifying the type of one method argument or return value */
ParameterTypePackage
: {$$ = NULL;}
| ObjectTypeKeyword {$$ = $1;}
- | '{''}' {$$ = NULL;}
- | '{'
- ObjectTypeKeyword
- '}' {$$ = $2;}
- | '{'
- ParameterTypePackageList
- '}' {$$ = $2;}
+ | ParameterTypePackage ','
+ ObjectTypeKeyword {$$ = TrLinkPeerNodes (2,$1,$3);}
;
ParameterTypePackageList
: {$$ = NULL;}
| ObjectTypeKeyword {$$ = $1;}
- | ObjectTypeKeyword ','
- ParameterTypePackageList {$$ = TrLinkPeerNodes (2,$1,$3);}
+ | '{' ParameterTypePackage '}' {$$ = $2;}
;
OptionalParameterTypePackage
: {$$ = TrCreateLeafNode (PARSEOP_DEFAULT_ARG);}
- | ',' {$$ = TrCreateLeafNode (PARSEOP_DEFAULT_ARG);}
- | ',' ParameterTypePackage {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_DEFAULT_ARG),1,$2);}
+ | ',' ParameterTypePackageList {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_DEFAULT_ARG),1,$2);}
;
-/* Rules for specifying the Argument types for control methods */
+/* Rules for specifying the types for method arguments */
ParameterTypesPackage
- : {$$ = NULL;}
- | ObjectTypeKeyword {$$ = $1;}
- | '{''}' {$$ = NULL;}
- | '{'
- ObjectTypeKeyword
- '}' {$$ = $2;}
- | '{'
- ParameterTypesPackageList
- '}' {$$ = $2;}
+ : ParameterTypePackageList {$$ = $1;}
+ | ParameterTypesPackage ','
+ ParameterTypePackageList {$$ = TrLinkPeerNodes (2,$1,$3);}
;
ParameterTypesPackageList
: {$$ = NULL;}
| ObjectTypeKeyword {$$ = $1;}
- | ParameterTypesPackage {$$ = $1;}
- | ParameterTypesPackage ','
- ParameterTypesPackageList {$$ = TrLinkPeerNodes (2,$1,$3);}
- | ParameterTypesPackage ','
- ParameterTypesPackage {$$ = TrLinkPeerNodes (2,$1,$3);}
+ | '{' ParameterTypesPackage '}' {$$ = $2;}
;
OptionalParameterTypesPackage
: {$$ = TrCreateLeafNode (PARSEOP_DEFAULT_ARG);}
- | ',' {$$ = TrCreateLeafNode (PARSEOP_DEFAULT_ARG);}
- | ',' ParameterTypesPackage {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_DEFAULT_ARG),1,$2);}
+ | ',' ParameterTypesPackageList {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_DEFAULT_ARG),1,$2);}
;
@@ -1172,14 +1163,9 @@ BankFieldTerm
FieldUnitList
: {$$ = NULL;}
| FieldUnit
- FieldUnitListTail {$$ = TrLinkPeerNode ($1,$2);}
- ;
-
-FieldUnitListTail
- : {$$ = NULL;}
- | ',' {$$ = NULL;} /* Allows a trailing comma at list end */
- | ',' FieldUnit
- FieldUnitListTail {$$ = TrLinkPeerNode ($2,$3);}
+ | FieldUnitList ',' /* Allows a trailing comma at list end */
+ | FieldUnitList ','
+ FieldUnit {$$ = TrLinkPeerNode ($1,$3);}
;
FieldUnit
@@ -1475,8 +1461,8 @@ IfTerm
: PARSEOP_IF '(' {$$ = TrCreateLeafNode (PARSEOP_IF);}
TermArg
')' '{'
- TermList '}'
- {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
+ TermList '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
+
| PARSEOP_IF '('
error ')' {$$ = AslDoError(); yyclearin;}
;
@@ -1484,19 +1470,26 @@ IfTerm
ElseTerm
: {$$ = NULL;}
| PARSEOP_ELSE '{' {$$ = TrCreateLeafNode (PARSEOP_ELSE);}
- TermList '}'
- {$$ = TrLinkChildren ($<n>3,1,$4);}
+ TermList '}' {$$ = TrLinkChildren ($<n>3,1,$4);}
+
| PARSEOP_ELSE '{'
error '}' {$$ = AslDoError(); yyclearin;}
+ | PARSEOP_ELSE
+ error {$$ = AslDoError(); yyclearin;}
+
| PARSEOP_ELSEIF '(' {$$ = TrCreateLeafNode (PARSEOP_ELSE);}
TermArg {$$ = TrCreateLeafNode (PARSEOP_IF);}
')' '{'
- TermList '}' {$$ = TrLinkChildren ($<n>5,2,$4,$8);}
+ TermList '}' {$$ = TrLinkChildren ($<n>5,2,$4,$8);}
ElseTerm {$$ = TrLinkPeerNode ($<n>5,$11);}
{$$ = TrLinkChildren ($<n>3,1,$<n>5);}
+
| PARSEOP_ELSEIF '('
error ')' {$$ = AslDoError(); yyclearin;}
+
+ | PARSEOP_ELSEIF
+ error {$$ = AslDoError(); yyclearin;}
;
LoadTerm
@@ -1574,27 +1567,44 @@ SwitchTerm
: PARSEOP_SWITCH '(' {$$ = TrCreateLeafNode (PARSEOP_SWITCH);}
TermArg
')' '{'
- CaseTermList '}'
+ CaseDefaultTermList '}'
{$$ = TrLinkChildren ($<n>3,2,$4,$7);}
| PARSEOP_SWITCH '('
error ')' {$$ = AslDoError(); yyclearin;}
;
-CaseTermList
+/*
+ * Case-Default list; allow only one Default term and unlimited Case terms
+ */
+
+CaseDefaultTermList
: {$$ = NULL;}
- | CaseTerm {}
- | DefaultTerm
- DefaultTermList {$$ = TrLinkPeerNode ($1,$2);}
- | CaseTerm
- CaseTermList {$$ = TrLinkPeerNode ($1,$2);}
+ | CaseTerm {}
+ | DefaultTerm {}
+ | CaseDefaultTermList
+ CaseTerm {$$ = TrLinkPeerNode ($1,$2);}
+ | CaseDefaultTermList
+ DefaultTerm {$$ = TrLinkPeerNode ($1,$2);}
+
+/* Original - attempts to force zero or one default term within the switch */
+
+/*
+CaseDefaultTermList
+ : {$$ = NULL;}
+ | CaseTermList
+ DefaultTerm
+ CaseTermList {$$ = TrLinkPeerNode ($1,TrLinkPeerNode ($2, $3));}
+ | CaseTermList
+ CaseTerm {$$ = TrLinkPeerNode ($1,$2);}
;
-DefaultTermList
+CaseTermList
: {$$ = NULL;}
| CaseTerm {}
- | CaseTerm
- DefaultTermList {$$ = TrLinkPeerNode ($1,$2);}
+ | CaseTermList
+ CaseTerm {$$ = TrLinkPeerNode ($1,$2);}
;
+*/
CaseTerm
: PARSEOP_CASE '(' {$$ = TrCreateLeafNode (PARSEOP_CASE);}
@@ -2405,27 +2415,17 @@ BufferTermData
ByteList
: {$$ = NULL;}
| ByteConstExpr
- ByteListTail {$$ = TrLinkPeerNode ($1,$2);}
- ;
-
-ByteListTail
- : {$$ = NULL;}
- | ',' {$$ = NULL;} /* Allows a trailing comma at list end */
- | ',' ByteConstExpr
- ByteListTail {$$ = TrLinkPeerNode ($2,$3);}
+ | ByteList ',' /* Allows a trailing comma at list end */
+ | ByteList ','
+ ByteConstExpr {$$ = TrLinkPeerNode ($1,$3);}
;
DWordList
: {$$ = NULL;}
| DWordConstExpr
- DWordListTail {$$ = TrLinkPeerNode ($1,$2);}
- ;
-
-DWordListTail
- : {$$ = NULL;}
- | ',' {$$ = NULL;} /* Allows a trailing comma at list end */
- | ',' DWordConstExpr
- DWordListTail {$$ = TrLinkPeerNode ($2,$3);}
+ | DWordList ',' /* Allows a trailing comma at list end */
+ | DWordList ','
+ DWordConstExpr {$$ = TrLinkPeerNode ($1,$3);}
;
PackageTerm
@@ -2445,14 +2445,9 @@ VarPackageLengthTerm
PackageList
: {$$ = NULL;}
| PackageElement
- PackageListTail {$$ = TrLinkPeerNode ($1,$2);}
- ;
-
-PackageListTail
- : {$$ = NULL;}
- | ',' {$$ = NULL;} /* Allows a trailing comma at list end */
- | ',' PackageElement
- PackageListTail {$$ = TrLinkPeerNode ($2,$3);}
+ | PackageList ',' /* Allows a trailing comma at list end */
+ | PackageList ','
+ PackageElement {$$ = TrLinkPeerNode ($1,$3);}
;
PackageElement
@@ -2471,12 +2466,18 @@ EISAIDTerm
/******* Resources and Memory ***********************************************/
+/*
+ * Note: Create two default nodes to allow conversion to a Buffer AML opcode
+ * Also, insert the EndTag at the end of the template.
+ */
ResourceTemplateTerm
: PARSEOP_RESOURCETEMPLATE '(' ')'
'{'
- ResourceMacroList '}' {$$ = TrCreateNode (PARSEOP_RESOURCETEMPLATE,3,
+ ResourceMacroList '}' {$$ = TrCreateNode (PARSEOP_RESOURCETEMPLATE,4,
TrCreateLeafNode (PARSEOP_DEFAULT_ARG),
- TrCreateLeafNode (PARSEOP_DEFAULT_ARG),$5);}
+ TrCreateLeafNode (PARSEOP_DEFAULT_ARG),
+ $5,
+ TrCreateLeafNode (PARSEOP_ENDTAG));}
;
UnicodeTerm
@@ -2489,8 +2490,8 @@ UnicodeTerm
ResourceMacroList
: {$$ = NULL;}
- | ResourceMacroTerm
- ResourceMacroList {$$ = TrLinkPeerNode ($1,$2);}
+ | ResourceMacroList
+ ResourceMacroTerm {$$ = TrLinkPeerNode ($1,$2);}
;
ResourceMacroTerm
@@ -2841,7 +2842,8 @@ RegisterTerm
',' ByteConstExpr
',' QWordConstExpr
OptionalAccessSize
- ')' {$$ = TrLinkChildren ($<n>3,5,$4,$6,$8,$10,$11);}
+ OptionalNameString_Last
+ ')' {$$ = TrLinkChildren ($<n>3,6,$4,$6,$8,$10,$11,$12);}
| PARSEOP_REGISTER '('
error ')' {$$ = AslDoError(); yyclearin;}
;
@@ -2947,10 +2949,14 @@ WordSpaceTerm
/******* Object References ***********************************************/
+/* Allow IO, DMA, IRQ Resource macro names to also be used as identifiers */
NameString
: NameSeg {}
| PARSEOP_NAMESTRING {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) AslCompilerlval.s);}
+ | PARSEOP_IO {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "IO");}
+ | PARSEOP_DMA {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "DMA");}
+ | PARSEOP_IRQ {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "IRQ");}
;
NameSeg
@@ -3160,7 +3166,7 @@ AslLocalAllocate (unsigned int Size)
DbgPrint (ASL_PARSE_OUTPUT, "\nAslLocalAllocate: Expanding Stack to %d\n\n", Size);
- Mem = ACPI_MEM_CALLOCATE (Size);
+ Mem = ACPI_ALLOCATE_ZEROED (Size);
if (!Mem)
{
AslCommonError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION,
diff --git a/sys/contrib/dev/acpica/compiler/asldefine.h b/sys/contrib/dev/acpica/compiler/asldefine.h
index 0f3a2f4..29f3568 100644
--- a/sys/contrib/dev/acpica/compiler/asldefine.h
+++ b/sys/contrib/dev/acpica/compiler/asldefine.h
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: asldefine.h - Common defines for the iASL compiler
- * $Revision: 1.4 $
+ * $Revision: 1.7 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -128,8 +128,8 @@
#define IntelAcpiCA "Intel ACPI Component Architecture"
#define CompilerId "ASL Optimizing Compiler"
#define DisassemblerId "AML Disassembler"
-#define CompilerCopyright "Copyright (C) 2000 - 2005 Intel Corporation"
-#define CompilerCompliance "Supports ACPI Specification Revision 3.0"
+#define CompilerCopyright "Copyright (C) 2000 - 2007 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 7031fde..7600158 100644
--- a/sys/contrib/dev/acpica/compiler/aslerror.c
+++ b/sys/contrib/dev/acpica/compiler/aslerror.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: aslerror - Error handling and statistics
- * $Revision: 1.88 $
+ * $Revision: 1.92 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -503,7 +503,7 @@ AslCommonError (
Gbl_ExceptionCount[Level]++;
if (Gbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT)
{
- printf ("\nMaximum error count (%d) exceeded.\n", ASL_MAX_ERROR_COUNT);
+ printf ("\nMaximum error count (%d) exceeded\n", ASL_MAX_ERROR_COUNT);
Gbl_SourceLine = 0;
Gbl_NextError = Gbl_ErrorLog;
@@ -539,6 +539,21 @@ AslError (
char *ExtraMessage)
{
+ switch (Level)
+ {
+ case ASL_WARNING2:
+ case ASL_WARNING3:
+ if (Gbl_WarningLevel < Level)
+ {
+ return;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+
if (Op)
{
AslCommonError (Level, MessageId, Op->Asl.LineNumber,
diff --git a/sys/contrib/dev/acpica/compiler/aslfiles.c b/sys/contrib/dev/acpica/compiler/aslfiles.c
index 7fd26f8..9eace43 100644
--- a/sys/contrib/dev/acpica/compiler/aslfiles.c
+++ b/sys/contrib/dev/acpica/compiler/aslfiles.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: aslfiles - file I/O suppoert
- * $Revision: 1.52 $
+ * $Revision: 1.54 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
diff --git a/sys/contrib/dev/acpica/compiler/aslfold.c b/sys/contrib/dev/acpica/compiler/aslfold.c
index 8ee845f..d744021 100644
--- a/sys/contrib/dev/acpica/compiler/aslfold.c
+++ b/sys/contrib/dev/acpica/compiler/aslfold.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: aslfold - Constant folding
- * $Revision: 1.18 $
+ * $Revision: 1.20 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
diff --git a/sys/contrib/dev/acpica/compiler/aslglobal.h b/sys/contrib/dev/acpica/compiler/aslglobal.h
index 3b3306d..07e8a46 100644
--- a/sys/contrib/dev/acpica/compiler/aslglobal.h
+++ b/sys/contrib/dev/acpica/compiler/aslglobal.h
@@ -3,7 +3,7 @@
/******************************************************************************
*
* Module Name: aslglobal.h - Global variable definitions
- * $Revision: 1.50 $
+ * $Revision: 1.56 $
*
*****************************************************************************/
@@ -11,7 +11,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -147,7 +147,7 @@ extern char *AslCompilertext;
extern char hex[];
#define ASL_LINE_BUFFER_SIZE 512
-#define ASL_MSG_BUFFER_SIZE (ASL_LINE_BUFFER_SIZE * 2)
+#define ASL_MSG_BUFFER_SIZE 4096
#define HEX_TABLE_LINE_SIZE 8
#define HEX_LISTING_LINE_SIZE 16
@@ -172,7 +172,6 @@ extern UINT32 Gbl_ExceptionCount[];
/* Option flags */
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_Acpi2, FALSE);
-ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_CheckForAscii, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_UseDefaultAmlFilename, TRUE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NsOutputFlag, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DebugFlag, FALSE);
@@ -182,7 +181,6 @@ ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_AsmIncludeOutputFlag, F
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_C_IncludeOutputFlag, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_ListingFlag, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_IgnoreErrors, FALSE);
-ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_GenerateExternals, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_SourceOutputFlag, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_ParseOnlyFlag, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_CompileTimesFlag, FALSE);
@@ -194,6 +192,8 @@ ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_IntegerOptimizationFlag
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_ReferenceOptimizationFlag, TRUE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisplayRemarks, TRUE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisplayOptimizations, FALSE);
+ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_WarningLevel, ASL_WARNING);
+
#define HEX_OUTPUT_NONE 0
#define HEX_OUTPUT_C 1
@@ -206,6 +206,7 @@ ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_HexOutputFlag, HEX_OUTP
ASL_EXTERN ASL_FILE_INFO Gbl_Files [ASL_NUM_FILES];
ASL_EXTERN char *Gbl_DirectoryPath;
+ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_ExternalFilename, NULL);
ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_IncludeFilename, NULL);
ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_OutputFilenamePrefix, NULL);
ASL_EXTERN char *Gbl_CurrentInputFilename;
diff --git a/sys/contrib/dev/acpica/compiler/asllength.c b/sys/contrib/dev/acpica/compiler/asllength.c
index 7d44ff0..056aaeb 100644
--- a/sys/contrib/dev/acpica/compiler/asllength.c
+++ b/sys/contrib/dev/acpica/compiler/asllength.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: asllength - Tree walk to determine package and opcode lengths
- * $Revision: 1.35 $
+ * $Revision: 1.37 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
diff --git a/sys/contrib/dev/acpica/compiler/asllisting.c b/sys/contrib/dev/acpica/compiler/asllisting.c
index a83b18c..31f70b8 100644
--- a/sys/contrib/dev/acpica/compiler/asllisting.c
+++ b/sys/contrib/dev/acpica/compiler/asllisting.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: asllisting - Listing file generation
- * $Revision: 1.58 $
+ * $Revision: 1.63 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -202,6 +202,54 @@ LsDoHexOutputAsm (
/*******************************************************************************
*
+ * FUNCTION: LsTreeWriteWalk
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Dump entire parse tree, for compiler debug only
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+LsTreeWriteWalk (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+
+ /* Debug output */
+
+ DbgPrint (ASL_TREE_OUTPUT,
+ "%5.5d [%2d]", Op->Asl.LogicalLineNumber, Level);
+ UtPrintFormattedName (Op->Asl.ParseOpcode, Level);
+
+
+ DbgPrint (ASL_TREE_OUTPUT, "\n");
+ return (AE_OK);
+}
+
+
+void
+LsDumpParseTree (
+ void)
+{
+
+ if (!Gbl_DebugFlag)
+ {
+ return;
+ }
+
+ DbgPrint (ASL_TREE_OUTPUT, "\nOriginal parse tree from parser:\n\n");
+ TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD,
+ LsTreeWriteWalk, NULL, NULL);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: LsDumpAscii
*
* PARAMETERS: FileId - ID of current listing file
@@ -319,11 +367,18 @@ LsAmlListingWalk (
{
UINT8 FileByte;
UINT32 i;
- UINT32 FileId = (UINT32) Context;
+ UINT32 FileId = (UINT32) ACPI_TO_INTEGER (Context);
LsWriteNodeToListing (Op, FileId);
+ if (Op->Asl.CompileFlags & NODE_IS_RESOURCE_DATA)
+ {
+ /* Buffer is a resource template, don't dump the data all at once */
+
+ return (AE_OK);
+ }
+
/* Write the hex bytes to the listing file(s) (if requested) */
for (i = 0; i < Op->Asl.FinalAmlLength; i++)
@@ -491,7 +546,7 @@ LsPopNode (
}
Gbl_ListingNode = Lnode->Next;
- ACPI_MEM_FREE (Lnode);
+ ACPI_FREE (Lnode);
/* New "Current" node is the new head */
@@ -1081,6 +1136,12 @@ LsWriteNodeToListing (
case PARSEOP_DEFAULT_ARG:
+
+ if (Op->Asl.CompileFlags & NODE_IS_RESOURCE_DESC)
+ {
+ LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.EndLogicalLine,
+ FileId);
+ }
return;
@@ -1109,7 +1170,6 @@ LsWriteNodeToListing (
case AML_FIELD_OP:
case AML_INDEX_FIELD_OP:
case AML_BANK_FIELD_OP:
- case AML_NAME_OP:
/*
* For fields, we want to dump all the AML after the
@@ -1119,6 +1179,24 @@ LsWriteNodeToListing (
FileId);
break;
+ case AML_NAME_OP:
+
+ if (Op->Asl.CompileFlags & NODE_IS_RESOURCE_DESC)
+ {
+ LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber,
+ FileId);
+ }
+ else
+ {
+ /*
+ * For fields, we want to dump all the AML after the
+ * entire definition
+ */
+ LsWriteSourceLines (Op->Asl.EndLine, Op->Asl.EndLogicalLine,
+ FileId);
+ }
+ break;
+
default:
LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber,
FileId);
@@ -1194,7 +1272,7 @@ LsWriteNodeToListing (
Gbl_TableSignature, Gbl_TableId, &Pathname[1]);
}
}
- ACPI_MEM_FREE (Pathname);
+ ACPI_FREE (Pathname);
}
break;
@@ -1209,6 +1287,12 @@ LsWriteNodeToListing (
case AML_CLASS_CREATE:
default:
+ if ((Op->Asl.ParseOpcode == PARSEOP_BUFFER) &&
+ (Op->Asl.CompileFlags & NODE_IS_RESOURCE_DESC))
+ {
+ return;
+ }
+
LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber,
FileId);
break;
diff --git a/sys/contrib/dev/acpica/compiler/aslload.c b/sys/contrib/dev/acpica/compiler/aslload.c
index f3e75be..ebbc487 100644
--- a/sys/contrib/dev/acpica/compiler/aslload.c
+++ b/sys/contrib/dev/acpica/compiler/aslload.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dswload - Dispatcher namespace load callbacks
- * $Revision: 1.71 $
+ * $Revision: 1.77 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -341,6 +341,9 @@ LdLoadResourceElements (
return (Status);
}
+ Node->Value = (UINT32) Op->Asl.Value.Integer;
+ Node->Op = Op;
+
/*
* Now enter the predefined fields, for easy lookup when referenced
* by the source ASL
@@ -412,9 +415,10 @@ LdNamespace1Begin (
UINT32 Flags = ACPI_NS_NO_UPSEARCH;
ACPI_PARSE_OBJECT *Arg;
UINT32 i;
+ BOOLEAN ForceNewScope = FALSE;
- ACPI_FUNCTION_NAME ("LdNamespace1Begin");
+ ACPI_FUNCTION_NAME (LdNamespace1Begin);
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op %p [%s]\n",
Op, Op->Asl.ParseOpName));
@@ -460,6 +464,16 @@ LdNamespace1Begin (
Arg = Op->Asl.Child; /* Get the NameSeg/NameString node */
Arg = Arg->Asl.Next; /* First peer is the object to be associated with the name */
+ /*
+ * If this name refers to a ResourceTemplate, we will need to open
+ * a new scope so that the resource subfield names can be entered into
+ * the namespace underneath this name
+ */
+ if (Op->Asl.CompileFlags & NODE_IS_RESOURCE_DESC)
+ {
+ ForceNewScope = TRUE;
+ }
+
/* Get the data type associated with the named object, not the name itself */
/* Log2 loop to convert from Btype (binary) to Etype (encoded) */
@@ -483,12 +497,30 @@ LdNamespace1Begin (
*/
ActualObjectType = (UINT8) Op->Asl.Child->Asl.Next->Asl.Value.Integer;
ObjectType = ACPI_TYPE_ANY;
- break;
+ /*
+ * We will mark every new node along the path as "External". This
+ * allows some or all of the nodes to be created later in the ASL
+ * code. Handles cases like this:
+ *
+ * External (\_SB_.PCI0.ABCD, IntObj)
+ * Scope (_SB_)
+ * {
+ * Device (PCI0)
+ * {
+ * }
+ * }
+ * Method (X)
+ * {
+ * Store (\_SB_.PCI0.ABCD, Local0)
+ * }
+ */
+ Flags |= ACPI_NS_EXTERNAL;
+ break;
case PARSEOP_DEFAULT_ARG:
- if(Op->Asl.CompileFlags == NODE_IS_RESOURCE_DESC)
+ if (Op->Asl.CompileFlags == NODE_IS_RESOURCE_DESC)
{
Status = LdLoadResourceElements (Op, WalkState);
goto Exit;
@@ -626,7 +658,7 @@ LdNamespace1Begin (
* parse tree later.
*/
Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
- ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &(Node));
+ ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &Node);
if (ACPI_FAILURE (Status))
{
if (Status == AE_ALREADY_EXISTS)
@@ -635,11 +667,36 @@ LdNamespace1Begin (
if (Node->Type == ACPI_TYPE_LOCAL_SCOPE)
{
+ /* Allow multiple references to the same scope */
+
Node->Type = (UINT8) ObjectType;
Status = AE_OK;
}
+ else if (Node->Flags & ANOBJ_IS_EXTERNAL)
+ {
+ /*
+ * Allow one create on an object or segment that was
+ * previously declared External
+ */
+ Node->Flags &= ~ANOBJ_IS_EXTERNAL;
+ Node->Type = (UINT8) ObjectType;
+
+ /* Just retyped a node, probably will need to open a scope */
+
+ if (AcpiNsOpensScope (ObjectType))
+ {
+ Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+ Status = AE_OK;
+ }
else
{
+ /* Valid error, object already exists */
+
AslError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Op,
Op->Asl.ExternalName);
Status = AE_OK;
@@ -654,6 +711,14 @@ LdNamespace1Begin (
}
}
+ if (ForceNewScope)
+ {
+ Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
FinishNode:
/*
@@ -706,9 +771,10 @@ LdNamespace1End (
{
ACPI_WALK_STATE *WalkState = (ACPI_WALK_STATE *) Context;
ACPI_OBJECT_TYPE ObjectType;
+ BOOLEAN ForceNewScope = FALSE;
- ACPI_FUNCTION_NAME ("LdNamespace1End");
+ ACPI_FUNCTION_NAME (LdNamespace1End);
/* We are only interested in opcodes that have an associated name */
@@ -732,9 +798,19 @@ LdNamespace1End (
ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode);
}
+ /* Pop scope that was pushed for Resource Templates */
+
+ if (Op->Asl.ParseOpcode == PARSEOP_NAME)
+ {
+ if (Op->Asl.CompileFlags & NODE_IS_RESOURCE_DESC)
+ {
+ ForceNewScope = TRUE;
+ }
+ }
+
/* Pop the scope stack */
- if (AcpiNsOpensScope (ObjectType))
+ if (ForceNewScope || AcpiNsOpensScope (ObjectType))
{
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
diff --git a/sys/contrib/dev/acpica/compiler/asllookup.c b/sys/contrib/dev/acpica/compiler/asllookup.c
index 750d53b..a970f12 100644
--- a/sys/contrib/dev/acpica/compiler/asllookup.c
+++ b/sys/contrib/dev/acpica/compiler/asllookup.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: asllookup- Namespace lookup
- * $Revision: 1.95 $
+ * $Revision: 1.103 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -167,6 +167,13 @@ LkNamespaceLocateEnd (
UINT32 Level,
void *Context);
+static ACPI_STATUS
+LkIsObjectUsed (
+ ACPI_HANDLE ObjHandle,
+ UINT32 Level,
+ void *Context,
+ void **ReturnValue);
+
/*******************************************************************************
*
@@ -196,9 +203,9 @@ LsDoOneNamespaceObject (
Gbl_NumNamespaceObjects++;
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "%5d [%d] %*s %4.4s - %s",
- Gbl_NumNamespaceObjects, Level, (Level * 3), " ",
- &Node->Name,
- AcpiUtGetTypeName (Node->Type));
+ Gbl_NumNamespaceObjects, Level, (Level * 3), " ",
+ &Node->Name,
+ AcpiUtGetTypeName (Node->Type));
Op = Node->Op;
ObjDesc = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Node->Object);
@@ -211,7 +218,7 @@ LsDoOneNamespaceObject (
if ((ObjDesc) &&
- (ObjDesc->Common.Descriptor == ACPI_DESC_TYPE_OPERAND))
+ (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND))
{
switch (Node->Type)
{
@@ -358,7 +365,7 @@ LsDoOneNamespaceObject (
}
Op = Op->Asl.Child;
- if (Op->Asl.ParseOpcode == PARSEOP_INTEGER)
+ if (Op && (Op->Asl.ParseOpcode == PARSEOP_INTEGER))
{
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
" [Initial Length 0x%.2X bytes]",
@@ -375,6 +382,29 @@ LsDoOneNamespaceObject (
break;
+ case ACPI_TYPE_LOCAL_RESOURCE:
+
+ FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
+ " [Desc Offset 0x%.4X Bytes]", Node->Value);
+ break;
+
+
+ case ACPI_TYPE_LOCAL_RESOURCE_FIELD:
+
+ if (Node->Flags & 0x80)
+ {
+ FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
+ " [Field Offset 0x%.4X Bits 0x%.4X Bytes]",
+ Node->Value, Node->Value / 8);
+ }
+ else
+ {
+ FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
+ " [Field Offset 0x%.4X Bytes]", Node->Value);
+ }
+ break;
+
+
default:
/* Nothing to do for other types */
break;
@@ -386,6 +416,15 @@ LsDoOneNamespaceObject (
}
+void
+LsSetupNsList (void * Handle)
+{
+
+ Gbl_NsOutputFlag = TRUE;
+ Gbl_Files[ASL_FILE_NAMESPACE_OUTPUT].Handle = Handle;
+}
+
+
/*******************************************************************************
*
* FUNCTION: LsDisplayNamespace
@@ -412,6 +451,8 @@ LsDisplayNamespace (
return (AE_OK);
}
+ Gbl_NumNamespaceObjects = 0;
+
/* File header */
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "Contents of ACPI Namespace\n\n");
@@ -498,6 +539,153 @@ LkObjectExists (
/*******************************************************************************
*
+ * FUNCTION: LkGetNameOp
+ *
+ * PARAMETERS: Op - Current Op
+ *
+ * RETURN: NameOp associated with the input op
+ *
+ * DESCRIPTION: Find the name declaration op associated with the operator
+ *
+ ******************************************************************************/
+
+ACPI_PARSE_OBJECT *
+LkGetNameOp (
+ ACPI_PARSE_OBJECT *Op)
+{
+ const ACPI_OPCODE_INFO *OpInfo;
+ ACPI_PARSE_OBJECT *NameOp = Op;
+
+
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode);
+
+
+ /* Get the NamePath from the appropriate place */
+
+ if (OpInfo->Flags & AML_NAMED)
+ {
+ /* For nearly all NAMED operators, the name reference is the first child */
+
+ NameOp = Op->Asl.Child;
+ if (Op->Asl.AmlOpcode == AML_ALIAS_OP)
+ {
+ /*
+ * ALIAS is the only oddball opcode, the name declaration
+ * (alias name) is the second operand
+ */
+ NameOp = Op->Asl.Child->Asl.Next;
+ }
+ }
+ else if (OpInfo->Flags & AML_CREATE)
+ {
+ /* Name must appear as the last parameter */
+
+ NameOp = Op->Asl.Child;
+ while (!(NameOp->Asl.CompileFlags & NODE_IS_NAME_DECLARATION))
+ {
+ NameOp = NameOp->Asl.Next;
+ }
+ }
+
+ return (NameOp);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: LkIsObjectUsed
+ *
+ * PARAMETERS: ACPI_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Check for an unreferenced namespace object and emit a warning.
+ * We have to be careful, because some types and names are
+ * typically or always unreferenced, we don't want to issue
+ * excessive warnings.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+LkIsObjectUsed (
+ ACPI_HANDLE ObjHandle,
+ UINT32 Level,
+ void *Context,
+ void **ReturnValue)
+{
+ ACPI_NAMESPACE_NODE *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle);
+
+
+ /* Referenced flag is set during the namespace xref */
+
+ if (Node->Flags & ANOBJ_IS_REFERENCED)
+ {
+ return (AE_OK);
+ }
+
+ /*
+ * Ignore names that start with an underscore,
+ * these are the reserved ACPI names and are typically not referenced,
+ * they are called by the host OS.
+ */
+ if (Node->Name.Ascii[0] == '_')
+ {
+ return (AE_OK);
+ }
+
+ /* There are some types that are typically not referenced, ignore them */
+
+ switch (Node->Type)
+ {
+ case ACPI_TYPE_DEVICE:
+ case ACPI_TYPE_PROCESSOR:
+ case ACPI_TYPE_POWER:
+ case ACPI_TYPE_LOCAL_RESOURCE:
+ return (AE_OK);
+
+ default:
+ break;
+ }
+
+ /* All others are valid unreferenced namespace objects */
+
+ if (Node->Op)
+ {
+ AslError (ASL_WARNING2, ASL_MSG_NOT_REFERENCED, LkGetNameOp (Node->Op), NULL);
+ }
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: LkFindUnreferencedObjects
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Namespace walk to find objects that are not referenced in any
+ * way. Must be called after the namespace has been cross
+ * referenced.
+ *
+ ******************************************************************************/
+
+void
+LkFindUnreferencedObjects (
+ void)
+{
+
+ /* Walk entire namespace from the supplied root */
+
+ (void) AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
+ ACPI_UINT32_MAX, FALSE, LkIsObjectUsed,
+ NULL, NULL);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: LkCrossReferenceNamespace
*
* PARAMETERS: None
@@ -641,7 +829,7 @@ LkNamespaceLocateBegin (
UINT32 Flags;
- ACPI_FUNCTION_TRACE_PTR ("LkNamespaceLocateBegin", Op);
+ ACPI_FUNCTION_TRACE_PTR (LkNamespaceLocateBegin, Op);
/*
* If this node is the actual declaration of a name
@@ -688,7 +876,7 @@ LkNamespaceLocateBegin (
if (OpInfo->Flags & AML_NAMED)
{
- /* For all NAMED operators, the name reference is the first child */
+ /* For nearly all NAMED operators, the name reference is the first child */
Path = Op->Asl.Child->Asl.Value.String;
if (Op->Asl.AmlOpcode == AML_ALIAS_OP)
@@ -729,7 +917,7 @@ LkNamespaceLocateBegin (
*/
Gbl_NsLookupCount++;
- Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
+ Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
ACPI_IMODE_EXECUTE, Flags, WalkState, &(Node));
if (ACPI_FAILURE (Status))
{
@@ -803,13 +991,23 @@ LkNamespaceLocateBegin (
return (Status);
}
+ /* Check for a reference vs. name declaration */
+
+ if (!(OpInfo->Flags & AML_NAMED) &&
+ !(OpInfo->Flags & AML_CREATE))
+ {
+ /* This node has been referenced, mark it for reference check */
+
+ Node->Flags |= ANOBJ_IS_REFERENCED;
+ }
+
/* Attempt to optimize the NamePath */
OptOptimizeNamePath (Op, OpInfo->Flags, WalkState, Path, Node);
/*
- * Dereference an alias. (A name reference that is an alias.)
- * Aliases are not nested; The alias always points to the final object
+ * 1) Dereference an alias (A name reference that is an alias)
+ * Aliases are not nested, the alias always points to the final object
*/
if ((Op->Asl.ParseOpcode != PARSEOP_ALIAS) &&
(Node->Type == ACPI_TYPE_LOCAL_ALIAS))
@@ -822,22 +1020,19 @@ LkNamespaceLocateBegin (
NextOp = NextOp->Asl.Child;
- /* Who in turn points back to original target alias node */
+ /* That in turn points back to original target alias node */
if (NextOp->Asl.Node)
{
Node = NextOp->Asl.Node;
}
- else
- {
- AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, Op,
- "Missing alias link");
- }
+
+ /* Else - forward reference to alias, will be resolved later */
}
- /* 1) Check for a reference to a resource descriptor */
+ /* 2) Check for a reference to a resource descriptor */
- else if ((Node->Type == ACPI_TYPE_LOCAL_RESOURCE_FIELD) ||
+ if ((Node->Type == ACPI_TYPE_LOCAL_RESOURCE_FIELD) ||
(Node->Type == ACPI_TYPE_LOCAL_RESOURCE))
{
/*
@@ -910,7 +1105,7 @@ LkNamespaceLocateBegin (
OpcGenerateAmlOpcode (Op);
}
- /* 2) Check for a method invocation */
+ /* 3) Check for a method invocation */
else if ((((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) || (Op->Asl.ParseOpcode == PARSEOP_NAMESEG)) &&
(Node->Type == ACPI_TYPE_METHOD) &&
@@ -996,7 +1191,7 @@ LkNamespaceLocateBegin (
}
}
- /* 3) Check for an ASL Field definition */
+ /* 4) Check for an ASL Field definition */
else if ((Op->Asl.Parent) &&
((Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_FIELD) ||
@@ -1137,7 +1332,7 @@ LkNamespaceLocateEnd (
const ACPI_OPCODE_INFO *OpInfo;
- ACPI_FUNCTION_TRACE ("LkNamespaceLocateEnd");
+ ACPI_FUNCTION_TRACE (LkNamespaceLocateEnd);
/* We are only interested in opcodes that have an associated name */
diff --git a/sys/contrib/dev/acpica/compiler/aslmain.c b/sys/contrib/dev/acpica/compiler/aslmain.c
index 3e8d2c6..6fe94b4 100644
--- a/sys/contrib/dev/acpica/compiler/aslmain.c
+++ b/sys/contrib/dev/acpica/compiler/aslmain.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: aslmain - compiler main and utilities
- * $Revision: 1.87 $
+ * $Revision: 1.96 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -120,6 +120,7 @@
#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>
#ifdef _DEBUG
@@ -162,10 +163,8 @@ AslCommandLine (
char **argv);
#ifdef _DEBUG
-#if ACPI_MACHINE_WIDTH != 16
#include <crtdbg.h>
#endif
-#endif
/*******************************************************************************
*
@@ -190,6 +189,7 @@ Options (
printf (" -vo Enable optimization comments\n");
printf (" -vr Disable remarks\n");
printf (" -vs Disable signon\n");
+ printf (" -w<1|2|3> Set warning reporting level\n");
printf ("\nAML Output Files:\n");
printf (" -s<a|c> Create AML in assembler or C source file (*.asm or *.c)\n");
@@ -209,16 +209,13 @@ Options (
printf (" -ls Create combined source file (expanded includes) (*.src)\n");
printf ("\nAML Disassembler:\n");
- printf (" -d [file] Disassemble AML to ASL source code file (*.dsl)\n");
+ 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 (" -2 Emit ACPI 2.0 compatible ASL code\n");
- printf (" -e Generate External() statements for unresolved symbols\n");
printf (" -g Get ACPI tables and write to files (*.dat)\n");
- printf ("\nMiscellaneous:\n");
- printf (" -a Verify source file is entirely ASCII text (0x00-0x7F)\n");
-
printf ("\nHelp:\n");
printf (" -h Additional help and compiler debug options\n");
printf (" -hc Display operators allowed in constant expressions\n");
@@ -254,7 +251,7 @@ HelpMessage (
Options ();
- printf ("\nCompiler Debug Options:\n");
+ printf ("\nCompiler/Disassembler Debug Options:\n");
printf (" -b<p|t|b> Create compiler debug/trace file (*.txt)\n");
printf (" Types: Parse/Tree/Both\n");
printf (" -f Ignore errors, force creation of AML output file(s)\n");
@@ -357,18 +354,13 @@ AslCommandLine (
/* Get the command line options */
- while ((j = AcpiGetopt (argc, argv, "2ab:cd^efgh^i^l^o:p:r:s:t:v:x:")) != EOF) switch (j)
+ while ((j = AcpiGetopt (argc, argv, "2b:cd^e:fgh^i^l^o:p:r:s:t:v:w:x:")) != EOF) switch (j)
{
case '2':
Gbl_Acpi2 = TRUE;
break;
- case 'a':
- Gbl_CheckForAscii = TRUE;
- break;
-
-
case 'b':
switch (AcpiGbl_Optarg[0])
@@ -425,10 +417,7 @@ AslCommandLine (
case 'e':
-
- /* Generate external statements for unresolved symbols */
-
- Gbl_GenerateExternals = TRUE;
+ Gbl_ExternalFilename = AcpiGbl_Optarg;
break;
@@ -672,6 +661,30 @@ AslCommandLine (
break;
+ case 'w': /* Set warning levels */
+
+ switch (AcpiGbl_Optarg[0])
+ {
+ case '1':
+ Gbl_WarningLevel = ASL_WARNING;
+ break;
+
+ case '2':
+ Gbl_WarningLevel = ASL_WARNING2;
+ break;
+
+ case '3':
+ Gbl_WarningLevel = ASL_WARNING3;
+ break;
+
+ default:
+ printf ("Unknown option: -w%s\n", AcpiGbl_Optarg);
+ BadCommandLine = TRUE;
+ break;
+ }
+ break;
+
+
case 'x':
AcpiDbgLevel = strtoul (AcpiGbl_Optarg, NULL, 16);
@@ -741,11 +754,9 @@ main (
#ifdef _DEBUG
-#if ACPI_MACHINE_WIDTH != 16
_CrtSetDbgFlag (_CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_LEAK_CHECK_DF |
_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG));
#endif
-#endif
/* Init and command line */
@@ -774,17 +785,17 @@ main (
{
/* ACPI CA subsystem initialization */
- Status = AcpiOsInitialize ();
- AcpiUtInitGlobals ();
- Status = AcpiUtMutexInitialize ();
+ Status = AdInitialize ();
if (ACPI_FAILURE (Status))
{
return -1;
}
- Status = AcpiNsRootInitialize ();
+ Status = AcpiAllocateRootTable (4);
if (ACPI_FAILURE (Status))
{
+ AcpiOsPrintf ("Could not initialize ACPI Table Manager, %s\n",
+ AcpiFormatException (Status));
return -1;
}
diff --git a/sys/contrib/dev/acpica/compiler/aslmap.c b/sys/contrib/dev/acpica/compiler/aslmap.c
index 0969065..5384d0b 100644
--- a/sys/contrib/dev/acpica/compiler/aslmap.c
+++ b/sys/contrib/dev/acpica/compiler/aslmap.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: aslmap - parser to AML opcode mapping table
- * $Revision: 1.80 $
+ * $Revision: 1.87 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -308,7 +308,7 @@ const ASL_RESERVED_INFO ReservedMethods[] = {
{"_EJ3", 1, 0},
{"_EJ4", 1, 0},
{"_EJD", 0, ASL_RSVD_RETURN_VALUE},
- {"_ERR", 2, ASL_RSVD_RETURN_VALUE},
+ {"_ERR", 3, ASL_RSVD_RETURN_VALUE},
{"_FDE", 0, ASL_RSVD_RETURN_VALUE},
{"_FDI", 0, ASL_RSVD_RETURN_VALUE},
{"_FDM", 1, 0},
@@ -421,6 +421,7 @@ const ASL_RESERVED_INFO ReservedMethods[] = {
{"_SWS", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
{"_TC1", 0, ASL_RSVD_RETURN_VALUE},
{"_TC2", 0, ASL_RSVD_RETURN_VALUE},
+ {"_TDL", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0b */
{"_TMP", 0, ASL_RSVD_RETURN_VALUE},
{"_TPC", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
{"_TPT", 1, 0}, /* Acpi 3.0 */
@@ -445,6 +446,8 @@ const ASL_RESERVED_INFO ReservedMethods[] = {
{"_UPP", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
{"_VPO", 0, ASL_RSVD_RETURN_VALUE},
{"_WAK", 1, ASL_RSVD_RETURN_VALUE},
+ {"_WDG", 0, ASL_RSVD_RETURN_VALUE}, /* MS Extension */
+ {"_WED", 1, ASL_RSVD_RETURN_VALUE}, /* MS Extension */
{NULL, 0, 0},
};
@@ -551,6 +554,7 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] =
/* ELSE */ OP_TABLE_ENTRY (AML_ELSE_OP, 0, NODE_AML_PACKAGE, 0),
/* ELSEIF */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, NODE_AML_PACKAGE, 0),
/* ENDDEPENDENTFN */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
+/* ENDTAG */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
/* ERRORNODE */ OP_TABLE_ENTRY (AML_NOOP_OP, 0, 0, 0),
/* EVENT */ OP_TABLE_ENTRY (AML_EVENT_OP, 0, 0, 0),
/* EXTENDEDIO */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
diff --git a/sys/contrib/dev/acpica/compiler/aslopcodes.c b/sys/contrib/dev/acpica/compiler/aslopcodes.c
index 2191741..ae91dc8 100644
--- a/sys/contrib/dev/acpica/compiler/aslopcodes.c
+++ b/sys/contrib/dev/acpica/compiler/aslopcodes.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: aslopcode - AML opcode generation
- * $Revision: 1.71 $
+ * $Revision: 1.74 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -213,7 +213,6 @@ OpcAmlOpcodeWalk (
OpcGenerateAmlOpcode (Op);
OpnGenerateAmlOperands (Op);
-
return (AE_OK);
}
@@ -593,14 +592,15 @@ OpcDoEisaId (
{
/* Create ID big-endian first (bits are contiguous) */
- BigEndianId = (UINT32) (InString[0] - 0x40) << 26 |
- (UINT32) (InString[1] - 0x40) << 21 |
- (UINT32) (InString[2] - 0x40) << 16 |
+ BigEndianId =
+ (UINT32) (InString[0] - 0x40) << 26 |
+ (UINT32) (InString[1] - 0x40) << 21 |
+ (UINT32) (InString[2] - 0x40) << 16 |
- (UtHexCharToValue (InString[3])) << 12 |
- (UtHexCharToValue (InString[4])) << 8 |
- (UtHexCharToValue (InString[5])) << 4 |
- UtHexCharToValue (InString[6]);
+ (UtHexCharToValue (InString[3])) << 12 |
+ (UtHexCharToValue (InString[4])) << 8 |
+ (UtHexCharToValue (InString[5])) << 4 |
+ UtHexCharToValue (InString[6]);
/* Swap to little-endian to get final ID (see function header) */
diff --git a/sys/contrib/dev/acpica/compiler/asloperands.c b/sys/contrib/dev/acpica/compiler/asloperands.c
index fb465e9..8f4500e 100644
--- a/sys/contrib/dev/acpica/compiler/asloperands.c
+++ b/sys/contrib/dev/acpica/compiler/asloperands.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: asloperands - AML operand processing
- * $Revision: 1.57 $
+ * $Revision: 1.61 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -959,10 +959,12 @@ OpnDoDefinitionBlock (
* as AML opcodes!
*/
- /* AML filename */
+ /* Get AML filename. Use it if non-null */
Child = Op->Asl.Child;
- if ((Child->Asl.Value.Buffer) && (Gbl_UseDefaultAmlFilename))
+ if (Child->Asl.Value.Buffer &&
+ *Child->Asl.Value.Buffer &&
+ (Gbl_UseDefaultAmlFilename))
{
Gbl_OutputFilenamePrefix = (char *) Child->Asl.Value.Buffer;
}
@@ -995,10 +997,9 @@ OpnDoDefinitionBlock (
Child = Child->Asl.Next;
Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
-
- /* Use the revision to set the integer width */
-
- AcpiUtSetIntegerWidth ((UINT8) Child->Asl.Value.Integer);
+ /*
+ * We used the revision to set the integer width earlier
+ */
/* OEMID */
diff --git a/sys/contrib/dev/acpica/compiler/aslopt.c b/sys/contrib/dev/acpica/compiler/aslopt.c
index e406abb..2ea9aea 100644
--- a/sys/contrib/dev/acpica/compiler/aslopt.c
+++ b/sys/contrib/dev/acpica/compiler/aslopt.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: aslopt- Compiler optimizations
- * $Revision: 1.21 $
+ * $Revision: 1.26 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -196,7 +196,7 @@ OptSearchToRoot (
char *Path;
- ACPI_FUNCTION_NAME ("OptSearchToRoot");
+ ACPI_FUNCTION_NAME (OptSearchToRoot);
/*
@@ -241,7 +241,7 @@ OptSearchToRoot (
/* We must allocate a new string for the name (TargetPath gets deleted) */
- *NewPath = ACPI_MEM_CALLOCATE (ACPI_NAME_SIZE + 1);
+ *NewPath = ACPI_ALLOCATE_ZEROED (ACPI_NAME_SIZE + 1);
ACPI_STRCPY (*NewPath, Path);
if (ACPI_STRNCMP (*NewPath, "_T_", 3))
@@ -299,7 +299,7 @@ OptBuildShortestPath (
BOOLEAN SubPath = FALSE;
- ACPI_FUNCTION_NAME ("OptBuildShortestPath");
+ ACPI_FUNCTION_NAME (OptBuildShortestPath);
ScopeInfo.Scope.Node = CurrentNode;
@@ -372,7 +372,8 @@ OptBuildShortestPath (
/*
* Construct a new target string
*/
- NewPathExternal = ACPI_MEM_CALLOCATE (TargetPath->Length + NumCarats + 1);
+ NewPathExternal = ACPI_ALLOCATE_ZEROED (
+ TargetPath->Length + NumCarats + 1);
/* Insert the Carats into the Target string */
@@ -415,7 +416,6 @@ OptBuildShortestPath (
Index = TargetPath->Length;
}
-
ACPI_STRCPY (&NewPathExternal[i], &((char *) TargetPath->Pointer)[Index]);
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " %-24s", NewPathExternal));
@@ -425,21 +425,20 @@ OptBuildShortestPath (
* original string is already optimal, there is no point in continuing.
*/
Status = AcpiNsInternalizeName (NewPathExternal, &NewPath);
-
if (ACPI_FAILURE (Status))
{
AslCoreSubsystemError (Op, Status, "Internalizing new NamePath",
ASL_NO_ABORT);
- ACPI_MEM_FREE (NewPathExternal);
+ ACPI_FREE (NewPathExternal);
return (Status);
}
if (ACPI_STRLEN (NewPath) >= AmlNameStringLength)
{
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS,
- " NOT SHORTER (New %d old %d)",
+ " NOT SHORTER (New %u old %u)",
ACPI_STRLEN (NewPath), AmlNameStringLength));
- ACPI_MEM_FREE (NewPathExternal);
+ ACPI_FREE (NewPathExternal);
return (AE_NOT_FOUND);
}
@@ -482,7 +481,7 @@ OptBuildShortestPath (
"Not using optimized name - did not find node");
}
- ACPI_MEM_FREE (NewPathExternal);
+ ACPI_FREE (NewPathExternal);
return (Status);
}
@@ -519,7 +518,7 @@ OptOptimizeNameDeclaration (
ACPI_NAMESPACE_NODE *Node;
- ACPI_FUNCTION_TRACE ("OptOptimizeNameDeclaration");
+ ACPI_FUNCTION_TRACE (OptOptimizeNameDeclaration);
if (((CurrentNode == AcpiGbl_RootNode) ||
@@ -587,7 +586,7 @@ OptOptimizeNameDeclaration (
"Not using optimized name - did not find node");
}
- ACPI_MEM_FREE (NewPathExternal);
+ ACPI_FREE (NewPathExternal);
return (Status);
}
@@ -634,7 +633,7 @@ OptOptimizeNamePath (
ACPI_PARSE_OBJECT *NextOp;
- ACPI_FUNCTION_TRACE ("OptOptimizeNamePath");
+ ACPI_FUNCTION_TRACE (OptOptimizeNamePath);
/* This is an optional optimization */
@@ -753,11 +752,11 @@ OptOptimizeNamePath (
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS,
- "%37s (%2d) ==> %-32s(%2d) %-32s",
+ "%37s (%2u) ==> %-32s(%2u) %-32s",
(char *) CurrentPath.Pointer, CurrentPath.Length,
(char *) TargetPath.Pointer, TargetPath.Length, ExternalNameString));
- ACPI_MEM_FREE (ExternalNameString);
+ ACPI_FREE (ExternalNameString);
/*
* Attempt an optmization depending on the type of namepath
@@ -812,7 +811,7 @@ OptOptimizeNamePath (
HowMuchShorter = (AmlNameStringLength - ACPI_STRLEN (NewPath));
OptTotal += HowMuchShorter;
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " REDUCED %2d (%d)",
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " REDUCED %2u (%u)",
HowMuchShorter, OptTotal));
if (Flags & AML_NAMED)
@@ -861,8 +860,8 @@ OptOptimizeNamePath (
/* Cleanup path buffers */
- ACPI_MEM_FREE (TargetPath.Pointer);
- ACPI_MEM_FREE (CurrentPath.Pointer);
+ ACPI_FREE (TargetPath.Pointer);
+ ACPI_FREE (CurrentPath.Pointer);
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, "\n"));
return_VOID;
diff --git a/sys/contrib/dev/acpica/compiler/aslresource.c b/sys/contrib/dev/acpica/compiler/aslresource.c
index 6623fbe..c33637e 100644
--- a/sys/contrib/dev/acpica/compiler/aslresource.c
+++ b/sys/contrib/dev/acpica/compiler/aslresource.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: aslresource - Resource templates and descriptors
- * $Revision: 1.38 $
+ * $Revision: 1.43 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -376,7 +376,7 @@ RsDoOneResourceDescriptor (
ASL_RESOURCE_NODE *Rnode = NULL;
- /* Determine type of resource */
+ /* Construct the resource */
switch (DescriptorTypeOp->Asl.ParseOpcode)
{
@@ -423,6 +423,11 @@ RsDoOneResourceDescriptor (
CurrentByteOffset);
break;
+ case PARSEOP_ENDTAG:
+ Rnode = RsDoEndTagDescriptor (DescriptorTypeOp,
+ CurrentByteOffset);
+ break;
+
case PARSEOP_EXTENDEDIO:
Rnode = RsDoExtendedIoDescriptor (DescriptorTypeOp,
CurrentByteOffset);
@@ -580,6 +585,12 @@ RsDoOneResourceDescriptor (
*/
DescriptorTypeOp->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
DescriptorTypeOp->Asl.CompileFlags = NODE_IS_RESOURCE_DESC;
+ DescriptorTypeOp->Asl.Value.Integer = CurrentByteOffset;
+
+ if (Rnode)
+ {
+ DescriptorTypeOp->Asl.FinalAmlLength = Rnode->BufferLength;
+ }
return (Rnode);
}
@@ -658,7 +669,6 @@ RsDoResourceTemplate (
ACPI_PARSE_OBJECT *BufferOp;
ACPI_PARSE_OBJECT *DescriptorTypeOp;
ACPI_PARSE_OBJECT *LastOp = NULL;
- AML_RESOURCE *Descriptor;
UINT32 CurrentByteOffset = 0;
ASL_RESOURCE_NODE HeadRnode;
ASL_RESOURCE_NODE *PreviousRnode;
@@ -666,6 +676,13 @@ RsDoResourceTemplate (
UINT8 State;
+ /* Mark parent as containing a resource template */
+
+ if (Op->Asl.Parent)
+ {
+ Op->Asl.Parent->Asl.CompileFlags |= NODE_IS_RESOURCE_DESC;
+ }
+
/* ResourceTemplate Opcode is first (Op) */
/* Buffer Length node is first child */
@@ -679,12 +696,16 @@ RsDoResourceTemplate (
DescriptorTypeOp = ASL_GET_PEER_NODE (BufferOp);
- /* Process all resource descriptors in the list */
-
+ /*
+ * Process all resource descriptors in the list
+ * Note: It is assumed that the EndTag node has been automatically
+ * inserted at the end of the template by the parser.
+ */
State = ACPI_RSTATE_NORMAL;
PreviousRnode = &HeadRnode;
while (DescriptorTypeOp)
{
+ DescriptorTypeOp->Asl.CompileFlags |= NODE_IS_RESOURCE_DESC;
Rnode = RsDoOneResourceDescriptor (DescriptorTypeOp, CurrentByteOffset,
&State);
@@ -712,19 +733,6 @@ RsDoResourceTemplate (
}
/*
- * Insert the EndTag descriptor after all other descriptors have
- * been processed
- */
- Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_END_TAG));
-
- Descriptor = Rnode->Buffer;
- Descriptor->EndTag.DescriptorType = ACPI_RESOURCE_NAME_END_TAG |
- ASL_RDESC_END_TAG_SIZE;
- Descriptor->EndTag.Checksum = 0;
-
- CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode, Rnode);
-
- /*
* Transform the nodes into the following
*
* Op -> AML_BUFFER_OP
@@ -733,11 +741,10 @@ RsDoResourceTemplate (
*/
Op->Asl.ParseOpcode = PARSEOP_BUFFER;
Op->Asl.AmlOpcode = AML_BUFFER_OP;
- Op->Asl.CompileFlags = NODE_AML_PACKAGE;
+ Op->Asl.CompileFlags = NODE_AML_PACKAGE | NODE_IS_RESOURCE_DESC;
BufferLengthOp->Asl.ParseOpcode = PARSEOP_INTEGER;
BufferLengthOp->Asl.Value.Integer = CurrentByteOffset;
-
(void) OpcSetOptimalIntegerSize (BufferLengthOp);
BufferOp->Asl.ParseOpcode = PARSEOP_RAW_DATA;
@@ -745,6 +752,7 @@ RsDoResourceTemplate (
BufferOp->Asl.AmlOpcodeLength = 0;
BufferOp->Asl.AmlLength = CurrentByteOffset;
BufferOp->Asl.Value.Buffer = (UINT8 *) HeadRnode.Next;
+ BufferOp->Asl.CompileFlags |= NODE_IS_RESOURCE_DATA;
return;
}
diff --git a/sys/contrib/dev/acpica/compiler/aslrestype1.c b/sys/contrib/dev/acpica/compiler/aslrestype1.c
index e81bcdd..e317436 100644
--- a/sys/contrib/dev/acpica/compiler/aslrestype1.c
+++ b/sys/contrib/dev/acpica/compiler/aslrestype1.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: aslrestype1 - Short (type1) resource templates and descriptors
- * $Revision: 1.35 $
+ * $Revision: 1.40 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -125,6 +125,40 @@
/*******************************************************************************
*
+ * FUNCTION: RsDoEndTagDescriptor
+ *
+ * PARAMETERS: Op - Parent resource descriptor parse node
+ * CurrentByteOffset - Offset into the resource template AML
+ * buffer (to track references to the desc)
+ *
+ * RETURN: Completed resource node
+ *
+ * DESCRIPTION: Construct a short "EndDependentFn" descriptor
+ *
+ ******************************************************************************/
+
+ASL_RESOURCE_NODE *
+RsDoEndTagDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset)
+{
+ AML_RESOURCE *Descriptor;
+ ASL_RESOURCE_NODE *Rnode;
+
+
+ Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_END_TAG));
+
+ Descriptor = Rnode->Buffer;
+ Descriptor->EndTag.DescriptorType = ACPI_RESOURCE_NAME_END_TAG |
+ ASL_RDESC_END_TAG_SIZE;
+ Descriptor->EndTag.Checksum = 0;
+
+ return (Rnode);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: RsDoDmaDescriptor
*
* PARAMETERS: Op - Parent resource descriptor parse node
@@ -166,21 +200,21 @@ RsDoDmaDescriptor (
case 0: /* DMA type */
RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 5, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_DMATYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_DMATYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 5);
break;
case 1: /* Bus Master */
RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 2, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_BUSMASTER,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_BUSMASTER,
CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 2);
break;
case 2: /* Xfer Type (transfer width) */
RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 0, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_XFERTYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_XFERTYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 0);
break;
@@ -227,7 +261,7 @@ RsDoDmaDescriptor (
/* Create a named field at the start of the list */
- RsCreateByteField (InitializerOp, ASL_RESNAME_DMA,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_DMA,
CurrentByteOffset +
ASL_RESDESC_OFFSET (Dma.DmaChannelMask));
}
@@ -318,7 +352,7 @@ RsDoFixedIoDescriptor (
Descriptor->FixedIo.Address =
(UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_BASEADDRESS,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_BASEADDRESS,
CurrentByteOffset + ASL_RESDESC_OFFSET (FixedIo.Address));
break;
@@ -326,7 +360,7 @@ RsDoFixedIoDescriptor (
Descriptor->FixedIo.AddressLength =
(UINT8) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
CurrentByteOffset + ASL_RESDESC_OFFSET (FixedIo.AddressLength));
break;
@@ -389,7 +423,7 @@ RsDoIoDescriptor (
case 0: /* Decode size */
RsSetFlagBits (&Descriptor->Io.Flags, InitializerOp, 0, 1);
- RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Flags), 0);
break;
@@ -397,7 +431,7 @@ RsDoIoDescriptor (
Descriptor->Io.Minimum =
(UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Minimum));
break;
@@ -405,7 +439,7 @@ RsDoIoDescriptor (
Descriptor->Io.Maximum =
(UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Maximum));
break;
@@ -413,7 +447,7 @@ RsDoIoDescriptor (
Descriptor->Io.Alignment =
(UINT8) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_ALIGNMENT,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Alignment));
break;
@@ -421,7 +455,7 @@ RsDoIoDescriptor (
Descriptor->Io.AddressLength =
(UINT8) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
CurrentByteOffset + ASL_RESDESC_OFFSET (Io.AddressLength));
break;
@@ -488,21 +522,21 @@ RsDoIrqDescriptor (
case 0: /* Interrupt Type (or Mode - edge/level) */
RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 0, 1);
- RsCreateBitField (InitializerOp, ASL_RESNAME_INTERRUPTTYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTTYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 0);
break;
case 1: /* Interrupt Level (or Polarity - Active high/low) */
RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 3, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_INTERRUPTLEVEL,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTLEVEL,
CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 3);
break;
case 2: /* Share Type - Default: exclusive (0) */
RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 4, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_INTERRUPTSHARE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 4);
break;
@@ -550,7 +584,7 @@ RsDoIrqDescriptor (
/* Create a named field at the start of the list */
- RsCreateByteField (InitializerOp, ASL_RESNAME_INTERRUPT,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_INTERRUPT,
CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.IrqMask));
}
break;
@@ -650,7 +684,7 @@ RsDoIrqNoFlagsDescriptor (
/* Create a named field at the start of the list */
- RsCreateByteField (InitializerOp, ASL_RESNAME_INTERRUPT,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_INTERRUPT,
CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.IrqMask));
}
break;
@@ -707,35 +741,35 @@ RsDoMemory24Descriptor (
case 0: /* Read/Write type */
RsSetFlagBits (&Descriptor->Memory24.Flags, InitializerOp, 0, 1);
- RsCreateBitField (InitializerOp, ASL_RESNAME_READWRITETYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Flags), 0);
break;
case 1: /* Min Address */
Descriptor->Memory24.Minimum = (UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Minimum));
break;
case 2: /* Max Address */
Descriptor->Memory24.Maximum = (UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Maximum));
break;
case 3: /* Alignment */
Descriptor->Memory24.Alignment = (UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_ALIGNMENT,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Alignment));
break;
case 4: /* Length */
Descriptor->Memory24.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.AddressLength));
break;
@@ -798,35 +832,35 @@ RsDoMemory32Descriptor (
case 0: /* Read/Write type */
RsSetFlagBits (&Descriptor->Memory32.Flags, InitializerOp, 0, 1);
- RsCreateBitField (InitializerOp, ASL_RESNAME_READWRITETYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Flags), 0);
break;
case 1: /* Min Address */
Descriptor->Memory32.Minimum = (UINT32) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Minimum));
break;
case 2: /* Max Address */
Descriptor->Memory32.Maximum = (UINT32) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Maximum));
break;
case 3: /* Alignment */
Descriptor->Memory32.Alignment = (UINT32) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_ALIGNMENT,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Alignment));
break;
case 4: /* Length */
Descriptor->Memory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.AddressLength));
break;
@@ -889,21 +923,21 @@ RsDoMemory32FixedDescriptor (
case 0: /* Read/Write type */
RsSetFlagBits (&Descriptor->FixedMemory32.Flags, InitializerOp, 0, 1);
- RsCreateBitField (InitializerOp, ASL_RESNAME_READWRITETYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.Flags), 0);
break;
case 1: /* Address */
Descriptor->FixedMemory32.Address = (UINT32) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_BASEADDRESS,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_BASEADDRESS,
CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.Address));
break;
case 2: /* Length */
Descriptor->FixedMemory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.AddressLength));
break;
@@ -1115,6 +1149,11 @@ RsDoVendorSmallDescriptor (
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
for (i = 0; InitializerOp; i++)
{
+ if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
+ {
+ break;
+ }
+
/* Maximum 7 vendor data bytes allowed (0-6) */
if (i >= 7)
diff --git a/sys/contrib/dev/acpica/compiler/aslrestype2.c b/sys/contrib/dev/acpica/compiler/aslrestype2.c
index 02e0f30..c42e4a9 100644
--- a/sys/contrib/dev/acpica/compiler/aslrestype2.c
+++ b/sys/contrib/dev/acpica/compiler/aslrestype2.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: aslrestype2 - Long (type2) resource templates and descriptors
- * $Revision: 1.42 $
+ * $Revision: 1.51 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -222,28 +222,28 @@ RsDoDwordIoDescriptor (
case 1: /* MinType */
RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 2, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_MINTYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 2);
break;
case 2: /* MaxType */
RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 3, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_MAXTYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 3);
break;
case 3: /* DecodeType */
RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 1, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 1);
break;
case 4: /* Range Type */
RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 0, 3);
- RsCreateBitField (InitializerOp, ASL_RESNAME_RANGETYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_RANGETYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 0);
break;
@@ -251,7 +251,7 @@ RsDoDwordIoDescriptor (
Descriptor->Address32.Granularity =
(UINT32) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_GRANULARITY,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity));
break;
@@ -259,7 +259,7 @@ RsDoDwordIoDescriptor (
Descriptor->Address32.Minimum =
(UINT32) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum));
break;
@@ -267,7 +267,7 @@ RsDoDwordIoDescriptor (
Descriptor->Address32.Maximum =
(UINT32) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum));
break;
@@ -275,7 +275,7 @@ RsDoDwordIoDescriptor (
Descriptor->Address32.TranslationOffset =
(UINT32) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_TRANSLATION,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset));
break;
@@ -283,7 +283,7 @@ RsDoDwordIoDescriptor (
Descriptor->Address32.AddressLength =
(UINT32) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength));
break;
@@ -347,14 +347,14 @@ RsDoDwordIoDescriptor (
case 13: /* Type */
RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 4, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_TYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 4);
break;
case 14: /* Translation Type */
RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 5, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_TRANSTYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_TRANSTYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 5);
break;
@@ -436,35 +436,35 @@ RsDoDwordMemoryDescriptor (
case 1: /* DecodeType */
RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 1, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 1);
break;
case 2: /* MinType */
RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 2, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_MINTYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 2);
break;
case 3: /* MaxType */
RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 3, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_MAXTYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 3);
break;
case 4: /* Memory Type */
RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 1, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_MEMTYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMTYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 1);
break;
case 5: /* Read/Write Type */
RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 0, 1);
- RsCreateBitField (InitializerOp, ASL_RESNAME_READWRITETYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 0);
break;
@@ -472,7 +472,7 @@ RsDoDwordMemoryDescriptor (
Descriptor->Address32.Granularity =
(UINT32) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_GRANULARITY,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity));
break;
@@ -480,7 +480,7 @@ RsDoDwordMemoryDescriptor (
Descriptor->Address32.Minimum =
(UINT32) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum));
break;
@@ -488,7 +488,7 @@ RsDoDwordMemoryDescriptor (
Descriptor->Address32.Maximum =
(UINT32) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum));
break;
@@ -496,7 +496,7 @@ RsDoDwordMemoryDescriptor (
Descriptor->Address32.TranslationOffset =
(UINT32) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_TRANSLATION,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset));
break;
@@ -504,7 +504,7 @@ RsDoDwordMemoryDescriptor (
Descriptor->Address32.AddressLength =
(UINT32) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength));
break;
@@ -565,14 +565,14 @@ RsDoDwordMemoryDescriptor (
case 14: /* Address Range */
RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 3, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_MEMATTRIBUTES,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMATTRIBUTES,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 3);
break;
case 15: /* Type */
RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 5, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_TYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 5);
break;
@@ -658,21 +658,21 @@ RsDoDwordSpaceDescriptor (
case 2: /* DecodeType */
RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 1, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 1);
break;
case 3: /* MinType */
RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 2, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_MINTYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 2);
break;
case 4: /* MaxType */
RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 3, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_MAXTYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 3);
break;
@@ -686,7 +686,7 @@ RsDoDwordSpaceDescriptor (
Descriptor->Address32.Granularity =
(UINT32) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_GRANULARITY,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity));
break;
@@ -694,7 +694,7 @@ RsDoDwordSpaceDescriptor (
Descriptor->Address32.Minimum =
(UINT32) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum));
break;
@@ -702,7 +702,7 @@ RsDoDwordSpaceDescriptor (
Descriptor->Address32.Maximum =
(UINT32) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum));
break;
@@ -710,7 +710,7 @@ RsDoDwordSpaceDescriptor (
Descriptor->Address32.TranslationOffset =
(UINT32) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_TRANSLATION,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset));
break;
@@ -718,7 +718,7 @@ RsDoDwordSpaceDescriptor (
Descriptor->Address32.AddressLength =
(UINT32) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength));
break;
@@ -814,7 +814,6 @@ RsDoExtendedIoDescriptor (
ACPI_PARSE_OBJECT *InitializerOp;
ASL_RESOURCE_NODE *Rnode;
UINT16 StringLength = 0;
-// UINT32 OptionIndex = 0;
UINT32 i;
@@ -847,70 +846,70 @@ RsDoExtendedIoDescriptor (
case 1: /* MinType */
RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 2, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_MINTYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 2);
break;
case 2: /* MaxType */
RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 3, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_MAXTYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 3);
break;
case 3: /* DecodeType */
RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 1, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 1);
break;
case 4: /* Range Type */
RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 0, 3);
- RsCreateBitField (InitializerOp, ASL_RESNAME_RANGETYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_RANGETYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 0);
break;
case 5: /* Address Granularity */
Descriptor->ExtAddress64.Granularity = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_GRANULARITY,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity));
break;
case 6: /* Address Min */
Descriptor->ExtAddress64.Minimum = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum));
break;
case 7: /* Address Max */
Descriptor->ExtAddress64.Maximum = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum));
break;
case 8: /* Translation Offset */
Descriptor->ExtAddress64.TranslationOffset = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_TRANSLATION,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TranslationOffset));
break;
case 9: /* Address Length */
Descriptor->ExtAddress64.AddressLength = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.AddressLength));
break;
case 10: /* Type-Specific Attributes */
Descriptor->ExtAddress64.TypeSpecific = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_TYPESPECIFICATTRIBUTES,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TypeSpecific));
break;
@@ -922,14 +921,14 @@ RsDoExtendedIoDescriptor (
case 12: /* Type */
RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 4, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_TYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 4);
break;
case 13: /* Translation Type */
RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 5, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_TRANSTYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_TRANSTYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 5);
break;
@@ -1002,77 +1001,77 @@ RsDoExtendedMemoryDescriptor (
case 1: /* DecodeType */
RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 1, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 1);
break;
case 2: /* MinType */
RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 2, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_MINTYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 2);
break;
case 3: /* MaxType */
RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 3, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_MAXTYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 3);
break;
case 4: /* Memory Type */
RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 1, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_MEMTYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMTYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 1);
break;
case 5: /* Read/Write Type */
RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 0, 1);
- RsCreateBitField (InitializerOp, ASL_RESNAME_READWRITETYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 0);
break;
case 6: /* Address Granularity */
Descriptor->ExtAddress64.Granularity = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_GRANULARITY,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity));
break;
case 7: /* Min Address */
Descriptor->ExtAddress64.Minimum = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum));
break;
case 8: /* Max Address */
Descriptor->ExtAddress64.Maximum = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum));
break;
case 9: /* Translation Offset */
Descriptor->ExtAddress64.TranslationOffset = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_TRANSLATION,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TranslationOffset));
break;
case 10: /* Address Length */
Descriptor->ExtAddress64.AddressLength = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.AddressLength));
break;
case 11: /* Type-Specific Attributes */
Descriptor->ExtAddress64.TypeSpecific = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_TYPESPECIFICATTRIBUTES,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TypeSpecific));
break;
@@ -1085,14 +1084,14 @@ RsDoExtendedMemoryDescriptor (
case 13: /* Address Range */
RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 3, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_MEMATTRIBUTES,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMATTRIBUTES,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 3);
break;
case 14: /* Type */
RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 5, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_TYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 5);
break;
@@ -1170,21 +1169,21 @@ RsDoExtendedSpaceDescriptor (
case 2: /* DecodeType */
RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 1, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 1);
break;
case 3: /* MinType */
RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 2, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_MINTYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 2);
break;
case 4: /* MaxType */
RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 3, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_MAXTYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 3);
break;
@@ -1197,42 +1196,42 @@ RsDoExtendedSpaceDescriptor (
case 6: /* Address Granularity */
Descriptor->ExtAddress64.Granularity = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_GRANULARITY,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity));
break;
case 7: /* Min Address */
Descriptor->ExtAddress64.Minimum = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum));
break;
case 8: /* Max Address */
Descriptor->ExtAddress64.Maximum = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum));
break;
case 9: /* Translation Offset */
Descriptor->ExtAddress64.TranslationOffset = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_TRANSLATION,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TranslationOffset));
break;
case 10: /* Address Length */
Descriptor->ExtAddress64.AddressLength = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.AddressLength));
break;
case 11: /* Type-Specific Attributes */
Descriptor->ExtAddress64.TypeSpecific = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_TYPESPECIFICATTRIBUTES,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TypeSpecific));
break;
@@ -1317,63 +1316,63 @@ RsDoQwordIoDescriptor (
case 1: /* MinType */
RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 2, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_MINTYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 2);
break;
case 2: /* MaxType */
RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 3, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_MAXTYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 3);
break;
case 3: /* DecodeType */
RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 1, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 1);
break;
case 4: /* Range Type */
RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 0, 3);
- RsCreateBitField (InitializerOp, ASL_RESNAME_RANGETYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_RANGETYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 0);
break;
case 5: /* Address Granularity */
Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_GRANULARITY,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity));
break;
case 6: /* Address Min */
Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum));
break;
case 7: /* Address Max */
Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum));
break;
case 8: /* Translation Offset */
Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_TRANSLATION,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset));
break;
case 9: /* Address Length */
Descriptor->Address64.AddressLength = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.AddressLength));
break;
@@ -1433,14 +1432,14 @@ RsDoQwordIoDescriptor (
case 13: /* Type */
RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 4, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_TYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 4);
break;
case 14: /* Translation Type */
RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 5, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_TRANSTYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_TRANSTYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 5);
break;
@@ -1521,70 +1520,70 @@ RsDoQwordMemoryDescriptor (
case 1: /* DecodeType */
RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 1, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 1);
break;
case 2: /* MinType */
RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 2, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_MINTYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 2);
break;
case 3: /* MaxType */
RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 3, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_MAXTYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 3);
break;
case 4: /* Memory Type */
RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 1, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_MEMTYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMTYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 1);
break;
case 5: /* Read/Write Type */
RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 0, 1);
- RsCreateBitField (InitializerOp, ASL_RESNAME_READWRITETYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 0);
break;
case 6: /* Address Granularity */
Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_GRANULARITY,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity));
break;
case 7: /* Min Address */
Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum));
break;
case 8: /* Max Address */
Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum));
break;
case 9: /* Translation Offset */
Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_TRANSLATION,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset));
break;
case 10: /* Address Length */
Descriptor->Address64.AddressLength = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.AddressLength));
break;
@@ -1645,14 +1644,14 @@ RsDoQwordMemoryDescriptor (
case 14: /* Address Range */
RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 3, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_MEMATTRIBUTES,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMATTRIBUTES,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 3);
break;
case 15: /* Type */
RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 5, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_TYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 5);
break;
@@ -1707,7 +1706,7 @@ RsDoQwordSpaceDescriptor (
sizeof (AML_RESOURCE_ADDRESS64) + 1 + StringLength);
Descriptor = Rnode->Buffer;
- Descriptor->Address64.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS32;
+ Descriptor->Address64.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS64;
/*
* Initial descriptor length -- may be enlarged if there are
@@ -1738,21 +1737,21 @@ RsDoQwordSpaceDescriptor (
case 2: /* DecodeType */
RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 1, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 1);
break;
case 3: /* MinType */
RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 2, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_MINTYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 2);
break;
case 4: /* MaxType */
RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 3, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_MAXTYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 3);
break;
@@ -1765,35 +1764,35 @@ RsDoQwordSpaceDescriptor (
case 6: /* Address Granularity */
Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_GRANULARITY,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity));
break;
case 7: /* Min Address */
Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum));
break;
case 8: /* Max Address */
Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum));
break;
case 9: /* Translation Offset */
Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_TRANSLATION,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset));
break;
case 10: /* Address Length */
Descriptor->Address64.AddressLength = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.AddressLength));
break;
@@ -1927,63 +1926,63 @@ RsDoWordIoDescriptor (
case 1: /* MinType */
RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 2, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_MINTYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 2);
break;
case 2: /* MaxType */
RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 3, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_MAXTYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 3);
break;
case 3: /* DecodeType */
RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 1, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 1);
break;
case 4: /* Range Type */
RsSetFlagBits (&Descriptor->Address16.SpecificFlags, InitializerOp, 0, 3);
- RsCreateBitField (InitializerOp, ASL_RESNAME_RANGETYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_RANGETYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.SpecificFlags), 0);
break;
case 5: /* Address Granularity */
Descriptor->Address16.Granularity = (UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_GRANULARITY,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Granularity));
break;
case 6: /* Address Min */
Descriptor->Address16.Minimum = (UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum));
break;
case 7: /* Address Max */
Descriptor->Address16.Maximum = (UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum));
break;
case 8: /* Translation Offset */
Descriptor->Address16.TranslationOffset = (UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_TRANSLATION,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset));
break;
case 9: /* Address Length */
Descriptor->Address16.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.AddressLength));
break;
@@ -2043,14 +2042,14 @@ RsDoWordIoDescriptor (
case 13: /* Type */
RsSetFlagBits (&Descriptor->Address16.SpecificFlags, InitializerOp, 4, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_TYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.SpecificFlags), 4);
break;
case 14: /* Translation Type */
RsSetFlagBits (&Descriptor->Address16.SpecificFlags, InitializerOp, 5, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_TRANSTYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_TRANSTYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.SpecificFlags), 5);
break;
@@ -2131,21 +2130,21 @@ RsDoWordBusNumberDescriptor (
case 1: /* MinType */
RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 2, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_MINTYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 2);
break;
case 2: /* MaxType */
RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 3, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_MAXTYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 3);
break;
case 3: /* DecodeType */
RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 1, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 1);
break;
@@ -2153,7 +2152,7 @@ RsDoWordBusNumberDescriptor (
Descriptor->Address16.Granularity =
(UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_GRANULARITY,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Granularity));
break;
@@ -2161,7 +2160,7 @@ RsDoWordBusNumberDescriptor (
Descriptor->Address16.Minimum =
(UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum));
break;
@@ -2169,7 +2168,7 @@ RsDoWordBusNumberDescriptor (
Descriptor->Address16.Maximum =
(UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum));
break;
@@ -2177,7 +2176,7 @@ RsDoWordBusNumberDescriptor (
Descriptor->Address16.TranslationOffset =
(UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_TRANSLATION,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset));
break;
@@ -2185,7 +2184,7 @@ RsDoWordBusNumberDescriptor (
Descriptor->Address16.AddressLength =
(UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.AddressLength));
break;
@@ -2324,21 +2323,21 @@ RsDoWordSpaceDescriptor (
case 2: /* DecodeType */
RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 1, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 1);
break;
case 3: /* MinType */
RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 2, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_MINTYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 2);
break;
case 4: /* MaxType */
RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 3, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_MAXTYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 3);
break;
@@ -2352,7 +2351,7 @@ RsDoWordSpaceDescriptor (
Descriptor->Address16.Granularity =
(UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_GRANULARITY,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Granularity));
break;
@@ -2360,7 +2359,7 @@ RsDoWordSpaceDescriptor (
Descriptor->Address16.Minimum =
(UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum));
break;
@@ -2368,7 +2367,7 @@ RsDoWordSpaceDescriptor (
Descriptor->Address16.Maximum =
(UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum));
break;
@@ -2376,7 +2375,7 @@ RsDoWordSpaceDescriptor (
Descriptor->Address16.TranslationOffset =
(UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_TRANSLATION,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset));
break;
@@ -2384,7 +2383,7 @@ RsDoWordSpaceDescriptor (
Descriptor->Address16.AddressLength =
(UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.AddressLength));
break;
@@ -2540,21 +2539,21 @@ RsDoInterruptDescriptor (
case 1: /* Interrupt Type (or Mode - edge/level) */
RsSetFlagBits (&Descriptor->ExtendedIrq.Flags, InitializerOp, 1, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_INTERRUPTTYPE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTTYPE,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtendedIrq.Flags), 1);
break;
case 2: /* Interrupt Level (or Polarity - Active high/low) */
RsSetFlagBits (&Descriptor->ExtendedIrq.Flags, InitializerOp, 2, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_INTERRUPTLEVEL,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTLEVEL,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtendedIrq.Flags), 2);
break;
case 3: /* Share Type - Default: exclusive (0) */
RsSetFlagBits (&Descriptor->ExtendedIrq.Flags, InitializerOp, 3, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_INTERRUPTSHARE,
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtendedIrq.Flags), 3);
break;
@@ -2628,8 +2627,8 @@ RsDoInterruptDescriptor (
/* Save the integer and move pointer to the next one */
- Rover->U32Item = (UINT32) InitializerOp->Asl.Value.Integer;
- Rover = ACPI_PTR_ADD (AML_RESOURCE, &(Rover->U32Item), 4);
+ Rover->DwordItem = (UINT32) InitializerOp->Asl.Value.Integer;
+ Rover = ACPI_ADD_PTR (AML_RESOURCE, &(Rover->DwordItem), 4);
Descriptor->ExtendedIrq.InterruptCount++;
Descriptor->ExtendedIrq.ResourceLength += 4;
@@ -2643,7 +2642,7 @@ RsDoInterruptDescriptor (
/* Create a named field at the start of the list */
- RsCreateByteField (InitializerOp, ASL_RESNAME_INTERRUPT,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_INTERRUPT,
CurrentByteOffset +
ASL_RESDESC_OFFSET (ExtendedIrq.Interrupts[0]));
}
@@ -2657,8 +2656,8 @@ RsDoInterruptDescriptor (
if (HasResSourceIndex)
{
- Rover->U8Item = ResSourceIndex;
- Rover = ACPI_PTR_ADD (AML_RESOURCE, &(Rover->U8Item), 1);
+ Rover->ByteItem = ResSourceIndex;
+ Rover = ACPI_ADD_PTR (AML_RESOURCE, &(Rover->ByteItem), 1);
Descriptor->ExtendedIrq.ResourceLength += 1;
}
@@ -2668,8 +2667,8 @@ RsDoInterruptDescriptor (
{
strcpy ((char *) Rover, (char *) ResSourceString);
- Rover = ACPI_PTR_ADD (
- AML_RESOURCE, &(Rover->U8Item), StringLength);
+ Rover = ACPI_ADD_PTR (
+ AML_RESOURCE, &(Rover->ByteItem), StringLength);
Descriptor->ExtendedIrq.ResourceLength = (UINT16)
(Descriptor->ExtendedIrq.ResourceLength + StringLength);
@@ -2715,6 +2714,10 @@ RsDoVendorLargeDescriptor (
for (i = 0; InitializerOp; i++)
{
+ if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
+ {
+ break;
+ }
InitializerOp = InitializerOp->Asl.Next;
}
@@ -2734,8 +2737,12 @@ RsDoVendorLargeDescriptor (
for (i = 0; InitializerOp; i++)
{
- VendorData[i] = (UINT8) InitializerOp->Asl.Value.Integer;
+ if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
+ {
+ break;
+ }
+ VendorData[i] = (UINT8) InitializerOp->Asl.Value.Integer;
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
}
@@ -2784,38 +2791,43 @@ RsDoGeneralRegisterDescriptor (
case 0: /* Address space */
Descriptor->GenericReg.AddressSpaceId = (UINT8) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_ADDRESSSPACE,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_ADDRESSSPACE,
CurrentByteOffset + ASL_RESDESC_OFFSET (GenericReg.AddressSpaceId));
break;
case 1: /* Register Bit Width */
Descriptor->GenericReg.BitWidth = (UINT8) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_REGISTERBITWIDTH,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_REGISTERBITWIDTH,
CurrentByteOffset + ASL_RESDESC_OFFSET (GenericReg.BitWidth));
break;
case 2: /* Register Bit Offset */
Descriptor->GenericReg.BitOffset = (UINT8) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_REGISTERBITOFFSET,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_REGISTERBITOFFSET,
CurrentByteOffset + ASL_RESDESC_OFFSET (GenericReg.BitOffset));
break;
case 3: /* Register Address */
Descriptor->GenericReg.Address = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_ADDRESS,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_ADDRESS,
CurrentByteOffset + ASL_RESDESC_OFFSET (GenericReg.Address));
break;
case 4: /* Access Size (ACPI 3.0) */
Descriptor->GenericReg.AccessSize = (UINT8) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_ACCESSSIZE,
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_ACCESSSIZE,
CurrentByteOffset + ASL_RESDESC_OFFSET (GenericReg.AccessSize));
break;
+ case 5: /* ResourceTag (ACPI 3.0b) */
+
+ UtAttachNamepathToOwner (Op, InitializerOp);
+ break;
+
default:
AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
diff --git a/sys/contrib/dev/acpica/compiler/aslstubs.c b/sys/contrib/dev/acpica/compiler/aslstubs.c
index fa2b63f..eb6b12a 100644
--- a/sys/contrib/dev/acpica/compiler/aslstubs.c
+++ b/sys/contrib/dev/acpica/compiler/aslstubs.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: aslstubs - Stubs used to link to Aml interpreter
- * $Revision: 1.14 $
+ * $Revision: 1.20 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -129,12 +129,19 @@
* Things like Events, Global Lock, etc. are not used
* by the compiler, so they are stubbed out here.
*/
-ACPI_STATUS
+ACPI_PHYSICAL_ADDRESS
AeLocalGetRootPointer (
- UINT32 Flags,
- ACPI_PHYSICAL_ADDRESS *RsdpPhysicalAddress)
+ void)
+{
+ return 0;
+}
+
+ACPI_STATUS
+AcpiDsMethodError (
+ ACPI_STATUS Status,
+ ACPI_WALK_STATE *WalkState)
{
- return AE_ERROR;
+ return (Status);
}
ACPI_STATUS
@@ -266,7 +273,7 @@ AcpiTbFindTable (
char *Signature,
char *OemId,
char *OemTableId,
- ACPI_TABLE_HEADER **TablePtr)
+ ACPI_NATIVE_UINT *TableIndex)
{
return (AE_SUPPORT);
}
diff --git a/sys/contrib/dev/acpica/compiler/asltransform.c b/sys/contrib/dev/acpica/compiler/asltransform.c
index 9ff4925..b76a266 100644
--- a/sys/contrib/dev/acpica/compiler/asltransform.c
+++ b/sys/contrib/dev/acpica/compiler/asltransform.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: asltransform - Parse tree transforms
- * $Revision: 1.35 $
+ * $Revision: 1.42 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -429,7 +429,7 @@ TrDoDefinitionBlock (
* to be at the root of the namespace; Therefore, namepath
* optimization can only be performed on the DSDT.
*/
- if (ACPI_STRNCMP (Next->Asl.Value.String, "DSDT", 4))
+ if (!ACPI_COMPARE_NAME (Next->Asl.Value.String, ACPI_SIG_DSDT))
{
Gbl_ReferenceOptimizationFlag = FALSE;
}
@@ -661,15 +661,16 @@ TrDoSwitch (
{
/*
* More than one Default
- * (Parser should catch this, should not get here)
+ * (Parser does not catch this, must check here)
*/
- AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, Next,
- "Found more than one Default()");
+ AslError (ASL_ERROR, ASL_MSG_MULTIPLE_DEFAULT, Next, NULL);
}
+ else
+ {
+ /* Save the DEFAULT node for later, after CASEs */
- /* Save the DEFAULT node for later, after CASEs */
-
- DefaultOp = Next;
+ DefaultOp = Next;
+ }
}
else
{
@@ -708,28 +709,55 @@ TrDoSwitch (
AslError (ASL_ERROR, ASL_MSG_NO_CASES, StartNode, NULL);
}
+
/*
- * Add a NAME node for the temp integer:
- * Change the SWITCH node to a Name (_T_x, Type)
+ * Create a Name(_T_x, ...) statement. This statement must appear at the
+ * method level, in case a loop surrounds the switch statement and could
+ * cause the name to be created twice (error).
*/
+
+ /* Create the Name node */
+
Predicate = StartNode->Asl.Child;
- TrAmlInitNode (StartNode, PARSEOP_NAME);
+ NewOp = TrCreateLeafNode (PARSEOP_NAME);
- NewOp = StartNode;
+ /* Find the parent method */
+
+ Next = StartNode;
+ while ((Next->Asl.ParseOpcode != PARSEOP_METHOD) &&
+ (Next->Asl.ParseOpcode != PARSEOP_DEFINITIONBLOCK))
+ {
+ Next = Next->Asl.Parent;
+ }
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;
+
+ TrAmlInsertPeer (Next, NewOp);
+ TrAmlInitLineNumbers (NewOp, Next);
+
+ /* Create the NameSeg child for the Name node */
NewOp2 = TrCreateValuedLeafNode (PARSEOP_NAMESEG,
(ACPI_INTEGER) ACPI_TO_INTEGER (PredicateValueName));
NewOp2->Asl.CompileFlags |= NODE_IS_NAME_DECLARATION;
NewOp->Asl.Child = NewOp2;
- /* Btype was already validated above */
+ /* Create the initial value for the Name. Btype was already validated above */
switch (Btype)
{
case ACPI_BTYPE_INTEGER:
- NewOp2->Asl.Next = TrCreateValuedLeafNode (PARSEOP_ZERO,
+ NewOp2->Asl.Next = TrCreateValuedLeafNode (PARSEOP_ZERO,
(ACPI_INTEGER) 0);
break;
@@ -757,26 +785,21 @@ TrDoSwitch (
TrAmlSetSubtreeParent (NewOp2, NewOp);
/*
- * Create and insert a new Store() node which will be used to save the
+ * Transform the Switch() into a Store() node which will be used to save the
* Switch() value. The store is of the form: Store (Value, _T_x)
* where _T_x is the temp variable.
*/
- Next = TrCreateLeafNode (PARSEOP_STORE);
- TrAmlInsertPeer (StartNode, Next);
- TrAmlSetSubtreeParent (Next, StartNode->Asl.Parent);
-
- TrAmlInitLineNumbers (Next, StartNode);
- TrAmlInitLineNumbers (NewOp2, StartNode);
- TrAmlInitLineNumbers (NewOp2->Asl.Next, StartNode);
+ TrAmlInitNode (StartNode, PARSEOP_STORE);
+ StartNode->Asl.Child = NULL;
/* Complete the Store subtree */
- Next->Asl.Child = Predicate;
- Predicate->Asl.Parent = Next;
+ StartNode->Asl.Child = Predicate;
+ Predicate->Asl.Parent = StartNode;
NewOp = TrCreateValuedLeafNode (PARSEOP_NAMESEG,
(ACPI_INTEGER) ACPI_TO_INTEGER (PredicateValueName));
- NewOp->Asl.Parent = Next;
+ NewOp->Asl.Parent = StartNode;
Predicate->Asl.Next = NewOp;
}
diff --git a/sys/contrib/dev/acpica/compiler/asltree.c b/sys/contrib/dev/acpica/compiler/asltree.c
index 6092607..db9893d 100644
--- a/sys/contrib/dev/acpica/compiler/asltree.c
+++ b/sys/contrib/dev/acpica/compiler/asltree.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: asltree - parse tree management
- * $Revision: 1.60 $
+ * $Revision: 1.63 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -467,8 +467,8 @@ TrCreateLeafNode (
Op = TrAllocateNode (ParseOpcode);
DbgPrint (ASL_PARSE_OUTPUT,
- "\nCreateLeafNode Line %d NewNode %p Op %s\n\n",
- Op->Asl.LineNumber, Op, UtGetOpName(ParseOpcode));
+ "\nCreateLeafNode Ln/Col %d/%d NewNode %p Op %s\n\n",
+ Op->Asl.LineNumber, Op->Asl.Column, Op, UtGetOpName(ParseOpcode));
return Op;
}
@@ -499,8 +499,8 @@ TrCreateValuedLeafNode (
Op = TrAllocateNode (ParseOpcode);
DbgPrint (ASL_PARSE_OUTPUT,
- "\nCreateValuedLeafNode Line %d NewNode %p Op %s Value %8.8X%8.8X ",
- Op->Asl.LineNumber, Op, UtGetOpName(ParseOpcode),
+ "\nCreateValuedLeafNode Ln/Col %d/%d NewNode %p Op %s Value %8.8X%8.8X ",
+ Op->Asl.LineNumber, Op->Asl.Column, Op, UtGetOpName(ParseOpcode),
ACPI_FORMAT_UINT64 (Value));
Op->Asl.Value.Integer = Value;
@@ -576,8 +576,8 @@ TrCreateNode (
Op = TrAllocateNode (ParseOpcode);
DbgPrint (ASL_PARSE_OUTPUT,
- "\nCreateNode Line %d NewParent %p Child %d Op %s ",
- Op->Asl.LineNumber, Op, NumChildren, UtGetOpName(ParseOpcode));
+ "\nCreateNode Ln/Col %d/%d NewParent %p Child %d Op %s ",
+ Op->Asl.LineNumber, Op->Asl.Column, Op, NumChildren, UtGetOpName(ParseOpcode));
/* Some extra debug output based on the parse opcode */
diff --git a/sys/contrib/dev/acpica/compiler/asltypes.h b/sys/contrib/dev/acpica/compiler/asltypes.h
index e681376..51beeb2 100644
--- a/sys/contrib/dev/acpica/compiler/asltypes.h
+++ b/sys/contrib/dev/acpica/compiler/asltypes.h
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: asltypes.h - compiler data types and struct definitions
- * $Revision: 1.78 $
+ * $Revision: 1.89 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -148,6 +148,7 @@
#define NODE_IS_NAME_DECLARATION 0x00010000
#define NODE_COMPILER_EMITTED 0x00020000
#define NODE_IS_DUPLICATE 0x00040000
+#define NODE_IS_RESOURCE_DATA 0x00080000
/* Keeps information about individual control methods */
@@ -222,6 +223,13 @@ typedef struct asl_file_info
} ASL_FILE_INFO;
+typedef struct asl_file_status
+{
+ UINT32 Line;
+ UINT32 Offset;
+
+} ASL_FILE_STATUS;
+
/* File types */
@@ -296,15 +304,18 @@ typedef struct asl_event_info
} ASL_EVENT_INFO;
-#define ASL_ERROR 0
-#define ASL_WARNING 1
-#define ASL_REMARK 2
-#define ASL_OPTIMIZATION 3
-#define ASL_NUM_REPORT_LEVELS 4
+#define ASL_WARNING 0
+#define ASL_WARNING2 1
+#define ASL_WARNING3 2
+#define ASL_ERROR 3
+#define ASL_REMARK 4
+#define ASL_OPTIMIZATION 5
+#define ASL_NUM_REPORT_LEVELS 6
typedef enum
{
+ ASL_MSG_RESERVED = 0,
ASL_MSG_ALPHANUMERIC_STRING,
ASL_MSG_AML_NOT_IMPLEMENTED,
ASL_MSG_ARG_COUNT_HI,
@@ -396,7 +407,6 @@ typedef enum
ASL_MSG_SEEK,
ASL_MSG_SINGLE_NAME_OPTIMIZATION,
ASL_MSG_SOME_NO_RETVAL,
- ASL_MSG_STRING_LENGTH,
ASL_MSG_SWITCH_TYPE,
ASL_MSG_SYNC_LEVEL,
ASL_MSG_SYNTAX,
@@ -406,13 +416,20 @@ typedef enum
ASL_MSG_UNREACHABLE_CODE,
ASL_MSG_UNSUPPORTED,
ASL_MSG_VENDOR_LIST,
- ASL_MSG_WRITE
+ ASL_MSG_WRITE,
+ ASL_MSG_MULTIPLE_DEFAULT,
+ ASL_MSG_TIMEOUT,
+ ASL_MSG_RESULT_NOT_USED,
+ ASL_MSG_NOT_REFERENCED,
+ ASL_MSG_NON_ZERO,
+ ASL_MSG_STRING_LENGTH
} ASL_MESSAGE_IDS;
#ifdef ASL_EXCEPTIONS
char *AslMessages [] = {
+/* The zeroth message is resesrved */ "",
/* ASL_MSG_ALPHANUMERIC_STRING */ "String must be entirely alphanumeric",
/* ASL_MSG_AML_NOT_IMPLEMENTED */ "Opcode is not implemented in compiler AML code generator",
/* ASL_MSG_ARG_COUNT_HI */ "Too many arguments",
@@ -470,7 +487,7 @@ char *AslMessages [] = {
/* ASL_MSG_NAME_EXISTS */ "Name already exists in scope",
/* ASL_MSG_NAME_OPTIMIZATION */ "NamePath optimized",
/* ASL_MSG_NESTED_COMMENT */ "Nested comment found",
-/* ASL_MSG_NO_CASES */ "No Case() statements under Switch()",
+/* ASL_MSG_NO_CASES */ "No Case statements under Switch",
/* ASL_MSG_NO_RETVAL */ "Called method returns no value",
/* ASL_MSG_NO_WHILE */ "No enclosing While statement",
/* ASL_MSG_NON_ASCII */ "Invalid characters found in file",
@@ -478,7 +495,7 @@ char *AslMessages [] = {
/* ASL_MSG_NOT_FOUND */ "Object not found or not accessible from scope",
/* ASL_MSG_NOT_METHOD */ "Not a control method, cannot invoke",
/* ASL_MSG_NOT_PARAMETER */ "Not a parameter, used as local only",
-/* ASL_MSG_NOT_REACHABLE */ "Object not accessible from this scope",
+/* ASL_MSG_NOT_REACHABLE */ "Object is not accessible from this scope",
/* ASL_MSG_OPEN */ "Could not open file",
/* ASL_MSG_OUTPUT_FILE_OPEN */ "Could not open output AML file",
/* ASL_MSG_OUTPUT_FILENAME */ "Could not create output filename",
@@ -499,12 +516,11 @@ char *AslMessages [] = {
/* ASL_MSG_RESOURCE_LIST */ "Too many resource items (internal error)",
/* ASL_MSG_RESOURCE_SOURCE */ "Missing ResourceSource string (required)",
/* ASL_MSG_RETURN_TYPES */ "Not all control paths return a value",
-/* ASL_MSG_SCOPE_FWD_REF */ "Forward references from Scope() not allowed",
+/* ASL_MSG_SCOPE_FWD_REF */ "Forward references from Scope operator not allowed",
/* ASL_MSG_SCOPE_TYPE */ "Existing object has invalid type for Scope operator",
/* ASL_MSG_SEEK */ "Could not seek file",
/* ASL_MSG_SINGLE_NAME_OPTIMIZATION */ "NamePath optimized to NameSeg (uses run-time search path)",
/* ASL_MSG_SOME_NO_RETVAL */ "Called method may not always return a value",
-/* ASL_MSG_STRING_LENGTH */ "String constant too long (200 max)",
/* ASL_MSG_SWITCH_TYPE */ "Switch expression is not a static Integer/Buffer/String data type, defaulting to Integer",
/* ASL_MSG_SYNC_LEVEL */ "SyncLevel must be in the range 0-15",
/* ASL_MSG_SYNTAX */ "",
@@ -514,14 +530,22 @@ char *AslMessages [] = {
/* ASL_MSG_UNREACHABLE_CODE */ "Statement is unreachable",
/* ASL_MSG_UNSUPPORTED */ "Unsupported feature",
/* ASL_MSG_VENDOR_LIST */ "Too many vendor data bytes (7 max)",
-/* ASL_MSG_WRITE */ "Could not write file"
+/* ASL_MSG_WRITE */ "Could not write file",
+/* ASL_MSG_MULTIPLE_DEFAULT */ "More than one Default statement within Switch construct",
+/* ASL_MSG_TIMEOUT */ "Possible operator timeout is ignored",
+/* 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"
};
char *AslErrorLevel [ASL_NUM_REPORT_LEVELS] = {
- "Error ",
"Warning ",
+ "Warning ",
+ "Warning ",
+ "Error ",
"Remark ",
"Optimize"
};
@@ -530,7 +554,7 @@ char *AslErrorLevel [ASL_NUM_REPORT_LEVELS] = {
/* Exception counters */
-UINT32 Gbl_ExceptionCount[ASL_NUM_REPORT_LEVELS] = {0,0,0,0};
+UINT32 Gbl_ExceptionCount[ASL_NUM_REPORT_LEVELS] = {0,0,0,0,0,0};
#endif
diff --git a/sys/contrib/dev/acpica/compiler/aslutils.c b/sys/contrib/dev/acpica/compiler/aslutils.c
index 1c9f48b..5acf1fc 100644
--- a/sys/contrib/dev/acpica/compiler/aslutils.c
+++ b/sys/contrib/dev/acpica/compiler/aslutils.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: aslutils -- compiler utilities
- * $Revision: 1.66 $
+ * $Revision: 1.72 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -166,7 +166,7 @@ void
UtDisplayConstantOpcodes (
void)
{
- UINT32 i;
+ UINT32 i;
printf ("Constant expression opcode information\n\n");
@@ -202,7 +202,7 @@ UtLocalCalloc (
void *Allocated;
- Allocated = ACPI_MEM_CALLOCATE (Size);
+ Allocated = ACPI_ALLOCATE_ZEROED (Size);
if (!Allocated)
{
AslCommonError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION,
@@ -214,7 +214,7 @@ UtLocalCalloc (
TotalAllocations++;
TotalAllocated += Size;
- return Allocated;
+ return (Allocated);
}
@@ -359,7 +359,6 @@ UtConvertByteToAsmHex (
{
Buffer[0] = '0';
-
Buffer[1] = (UINT8) hex[(RawByte >> 4) & 0xF];
Buffer[2] = (UINT8) hex[RawByte & 0xF];
Buffer[3] = 'h';
@@ -430,9 +429,13 @@ UtPrintFormattedName (
UINT32 Level)
{
+ if (Level)
+ {
+ DbgPrint (ASL_TREE_OUTPUT,
+ "%*s", (3 * Level), " ");
+ }
DbgPrint (ASL_TREE_OUTPUT,
- "%*s %-16.16s", (3 * Level), " ",
- UtGetOpName (ParseOpcode));
+ " %-20.20s", UtGetOpName (ParseOpcode));
if (Level < TEXT_OFFSET)
{
@@ -459,7 +462,8 @@ UtSetParseOpName (
ACPI_PARSE_OBJECT *Op)
{
- strncpy (Op->Asl.ParseOpName, UtGetOpName (Op->Asl.ParseOpcode), 12);
+ strncpy (Op->Asl.ParseOpName, UtGetOpName (Op->Asl.ParseOpcode),
+ ACPI_MAX_PARSEOP_NAME);
}
@@ -484,7 +488,8 @@ UtGetOpName (
* First entries (ASL_YYTNAME_START) in yytname are special reserved names.
* Ignore first 8 characters of the name
*/
- return ((char *) yytname [(ParseOpcode - ASL_FIRST_PARSE_OPCODE) + ASL_YYTNAME_START] + 8);
+ return ((char *) yytname
+ [(ParseOpcode - ASL_FIRST_PARSE_OPCODE) + ASL_YYTNAME_START] + 8);
}
@@ -535,7 +540,9 @@ UtDisplaySummary (
FlPrintFile (FileId,
"Compilation complete. %d Errors, %d Warnings, %d Remarks, %d Optimizations\n",
Gbl_ExceptionCount[ASL_ERROR],
- Gbl_ExceptionCount[ASL_WARNING],
+ Gbl_ExceptionCount[ASL_WARNING] +
+ Gbl_ExceptionCount[ASL_WARNING2] +
+ Gbl_ExceptionCount[ASL_WARNING3],
Gbl_ExceptionCount[ASL_REMARK],
Gbl_ExceptionCount[ASL_OPTIMIZATION]);
}
@@ -545,7 +552,7 @@ UtDisplaySummary (
*
* FUNCTION: UtDisplaySummary
*
- * PARAMETERS: Op - Integer parse node
+ * PARAMETERS: Op - Integer parse node
* LowValue - Smallest allowed value
* HighValue - Largest allowed value
*
diff --git a/sys/contrib/dev/acpica/dbcmds.c b/sys/contrib/dev/acpica/dbcmds.c
index 65e8593..76dd6d9 100644
--- a/sys/contrib/dev/acpica/dbcmds.c
+++ b/sys/contrib/dev/acpica/dbcmds.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbcmds - debug commands and output routines
- * $Revision: 1.132 $
+ * $Revision: 1.150 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -201,6 +201,12 @@ static ARGUMENT_INFO AcpiDbObjectTypes [] =
{"THERMALZONES"},
{"BUFFERFIELDS"},
{"DDBHANDLES"},
+ {"DEBUG"},
+ {"REGIONFIELDS"},
+ {"BANKFIELDS"},
+ {"INDEXFIELDS"},
+ {"REFERENCES"},
+ {"ALIAS"},
{NULL} /* Must be null terminated */
};
@@ -279,9 +285,6 @@ ACPI_STATUS
AcpiDbSleep (
char *ObjectArg)
{
-#if ACPI_MACHINE_WIDTH == 16
- return (AE_OK);
-#else
ACPI_STATUS Status;
UINT8 SleepState;
@@ -306,7 +309,6 @@ AcpiDbSleep (
Status = AcpiLeaveSleepState (SleepState);
return (Status);
-#endif
}
@@ -405,11 +407,11 @@ AcpiDbDisplayLocks (
UINT32 i;
- for (i = 0; i < MAX_MUTEX; i++)
+ for (i = 0; i < ACPI_MAX_MUTEX; i++)
{
AcpiOsPrintf ("%26s : %s\n", AcpiUtGetMutexName (i),
- AcpiGbl_MutexInfo[i].ThreadId == ACPI_MUTEX_NOT_ACQUIRED
- ? "Locked" : "Unlocked");
+ AcpiGbl_MutexInfo[i].ThreadId == ACPI_MUTEX_NOT_ACQUIRED
+ ? "Locked" : "Unlocked");
}
}
@@ -431,30 +433,28 @@ void
AcpiDbDisplayTableInfo (
char *TableArg)
{
- UINT32 i;
+ ACPI_NATIVE_UINT i;
ACPI_TABLE_DESC *TableDesc;
- for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++)
+ /*
+ * Walk the root table list
+ */
+ for (i = 0; i < AcpiGbl_RootTableList.Count; i++)
{
- TableDesc = AcpiGbl_TableLists[i].Next;
- while (TableDesc)
- {
- AcpiOsPrintf ( "%s at %p length %.5X",
- AcpiGbl_TableData[i].Name, TableDesc->Pointer,
- (UINT32) TableDesc->Length);
+ TableDesc = &AcpiGbl_RootTableList.Tables[i];
+ AcpiOsPrintf ( "%4.4s at %p length %.5X",
+ TableDesc->Signature.Ascii, TableDesc->Pointer,
+ (UINT32) TableDesc->Length);
- if (i != ACPI_TABLE_FACS)
- {
- AcpiOsPrintf (" OemID=%6s TableId=%8s OemRevision=%8.8X",
- TableDesc->Pointer->OemId,
- TableDesc->Pointer->OemTableId,
- TableDesc->Pointer->OemRevision);
- }
- AcpiOsPrintf ("\n");
-
- TableDesc = TableDesc->Next;
+ if (TableDesc->Pointer && (i != ACPI_TABLE_INDEX_FACS))
+ {
+ AcpiOsPrintf (" OemId=\"%6s\" OemTableId=\"%8s\" OemRevision=%8.8X",
+ TableDesc->Pointer->OemId,
+ TableDesc->Pointer->OemTableId,
+ TableDesc->Pointer->OemRevision);
}
+ AcpiOsPrintf ("\n");
}
}
@@ -479,13 +479,16 @@ AcpiDbUnloadAcpiTable (
char *TableArg,
char *InstanceArg)
{
+/* TBD: Need to reimplement for new data structures */
+
+#if 0
UINT32 i;
ACPI_STATUS Status;
/* Search all tables for the target type */
- for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++)
+ for (i = 0; i < (ACPI_TABLE_ID_MAX+1); i++)
{
if (!ACPI_STRNCMP (TableArg, AcpiGbl_TableData[i].Signature,
AcpiGbl_TableData[i].SigLength))
@@ -508,6 +511,7 @@ AcpiDbUnloadAcpiTable (
}
AcpiOsPrintf ("Unknown table type [%s]\n", TableArg);
+#endif
}
@@ -671,7 +675,7 @@ AcpiDbDisassembleMethod (
Status = AcpiDsInitAmlWalk (WalkState, Op, NULL,
ObjDesc->Method.AmlStart,
- ObjDesc->Method.AmlLength, NULL, 1);
+ ObjDesc->Method.AmlLength, NULL, ACPI_IMODE_LOAD_PASS1);
if (ACPI_FAILURE (Status))
{
return (Status);
@@ -931,14 +935,14 @@ AcpiDbSetMethodData (
if (Index > ACPI_METHOD_MAX_ARG)
{
AcpiOsPrintf ("Arg%d - Invalid argument name\n", Index);
- return;
+ goto Cleanup;
}
Status = AcpiDsStoreObjectToLocal (AML_ARG_OP, Index, ObjDesc,
WalkState);
if (ACPI_FAILURE (Status))
{
- return;
+ goto Cleanup;
}
ObjDesc = WalkState->Arguments[Index].Object;
@@ -954,14 +958,14 @@ AcpiDbSetMethodData (
if (Index > ACPI_METHOD_MAX_LOCAL)
{
AcpiOsPrintf ("Local%d - Invalid local variable name\n", Index);
- return;
+ goto Cleanup;
}
Status = AcpiDsStoreObjectToLocal (AML_LOCAL_OP, Index, ObjDesc,
WalkState);
if (ACPI_FAILURE (Status))
{
- return;
+ goto Cleanup;
}
ObjDesc = WalkState->LocalVariables[Index].Object;
@@ -973,6 +977,9 @@ AcpiDbSetMethodData (
default:
break;
}
+
+Cleanup:
+ AcpiUtRemoveReference (ObjDesc);
}
@@ -1013,7 +1020,7 @@ AcpiDbWalkForSpecificObjects (
}
AcpiOsPrintf ("%32s", (char *) Buffer.Pointer);
- ACPI_MEM_FREE (Buffer.Pointer);
+ ACPI_FREE (Buffer.Pointer);
/* Dump short info about the object */
@@ -1137,7 +1144,7 @@ AcpiDbWalkAndMatchName (
AcpiOsPrintf ("%32s", (char *) Buffer.Pointer);
(void) AcpiNsDumpOneObject (ObjHandle, NestingLevel, &Info, NULL);
- ACPI_MEM_FREE (Buffer.Pointer);
+ ACPI_FREE (Buffer.Pointer);
}
return (AE_OK);
@@ -1212,8 +1219,8 @@ AcpiDbSetScope (
{
/* Validate new scope from the root */
- Status = AcpiNsGetNodeByPath (Name, AcpiGbl_RootNode,
- ACPI_NS_NO_UPSEARCH, &Node);
+ Status = AcpiNsGetNode (AcpiGbl_RootNode, Name, ACPI_NS_NO_UPSEARCH,
+ &Node);
if (ACPI_FAILURE (Status))
{
goto ErrorExit;
@@ -1226,8 +1233,8 @@ AcpiDbSetScope (
{
/* Validate new scope relative to old scope */
- Status = AcpiNsGetNodeByPath (Name, AcpiGbl_DbScopeNode,
- ACPI_NS_NO_UPSEARCH, &Node);
+ Status = AcpiNsGetNode (AcpiGbl_DbScopeNode, Name, ACPI_NS_NO_UPSEARCH,
+ &Node);
if (ACPI_FAILURE (Status))
{
goto ErrorExit;
@@ -1309,12 +1316,11 @@ AcpiDmCompareAmlResources (
AcpiOsPrintf (
"**** Length mismatch in descriptor [%.2X] type %2.2X, Offset %8.8X L1 %X L2 %X ****\n",
Count, ResourceType, Offset, Aml1Length, Aml2Length);
- return;
}
/* Check for descriptor byte match */
- if (ACPI_MEMCMP (Aml1, Aml2, Aml1Length))
+ else if (ACPI_MEMCMP (Aml1, Aml2, Aml1Length))
{
AcpiOsPrintf (
"**** Data mismatch in descriptor [%.2X] type %2.2X, Offset %8.8X ****\n",
@@ -1333,7 +1339,7 @@ AcpiDmCompareAmlResources (
Count++;
Offset += Aml1Length;
Aml1 += Aml1Length;
- Aml2 += Aml1Length;
+ Aml2 += Aml2Length;
}
}
@@ -1410,11 +1416,11 @@ AcpiDmTestResourceConversion (
/* Cleanup and exit */
- ACPI_MEM_FREE (NewAml.Pointer);
+ ACPI_FREE (NewAml.Pointer);
Exit2:
- ACPI_MEM_FREE (ResourceObj.Pointer);
+ ACPI_FREE (ResourceObj.Pointer);
Exit1:
- ACPI_MEM_FREE (ReturnObj.Pointer);
+ ACPI_FREE (ReturnObj.Pointer);
return (Status);
}
@@ -1435,8 +1441,6 @@ void
AcpiDbDisplayResources (
char *ObjectArg)
{
-#if ACPI_MACHINE_WIDTH != 16
-
ACPI_NAMESPACE_NODE *Node;
ACPI_STATUS Status;
ACPI_BUFFER ReturnObj;
@@ -1483,7 +1487,7 @@ AcpiDbDisplayResources (
goto GetCrs;
}
- AcpiRsDumpIrqList ((UINT8 *) AcpiGbl_DbBuffer);
+ AcpiRsDumpIrqList (ACPI_CAST_PTR (UINT8, AcpiGbl_DbBuffer));
/* _CRS */
@@ -1574,7 +1578,6 @@ Cleanup:
AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
return;
-#endif
}
@@ -1734,7 +1737,8 @@ AcpiDbBusWalk (
/* Exit if there is no _PRT under this device */
- Status = AcpiGetHandle (Node, METHOD_NAME__PRT, &TempNode);
+ Status = AcpiGetHandle (Node, METHOD_NAME__PRT,
+ ACPI_CAST_PTR (ACPI_HANDLE, &TempNode));
if (ACPI_FAILURE (Status))
{
return (AE_OK);
@@ -1753,7 +1757,7 @@ AcpiDbBusWalk (
/* Display the full path */
AcpiOsPrintf ("%-32s", (char *) Buffer.Pointer);
- ACPI_MEM_FREE (Buffer.Pointer);
+ ACPI_FREE (Buffer.Pointer);
/* _PRT info */
@@ -1797,7 +1801,7 @@ AcpiDbBusWalk (
if (ACPI_SUCCESS (Status))
{
AcpiOsPrintf (" _CID=%s", Cid->Id[0].Value);
- ACPI_MEM_FREE (Cid);
+ ACPI_FREE (Cid);
}
AcpiOsPrintf ("\n");
diff --git a/sys/contrib/dev/acpica/dbdisply.c b/sys/contrib/dev/acpica/dbdisply.c
index 93fe8ef..40133a1 100644
--- a/sys/contrib/dev/acpica/dbdisply.c
+++ b/sys/contrib/dev/acpica/dbdisply.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbdisply - debug display commands
- * $Revision: 1.112 $
+ * $Revision: 1.120 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -160,24 +160,7 @@ AcpiDbGetPointer (
void *ObjPtr;
-#if ACPI_MACHINE_WIDTH == 16
-#include <stdio.h>
-
- /* Have to handle 16-bit pointers of the form segment:offset */
-
- if (!sscanf (Target, "%p", &ObjPtr))
- {
- AcpiOsPrintf ("Invalid pointer: %s\n", Target);
- return (NULL);
- }
-
-#else
-
- /* Simple flat pointer */
-
ObjPtr = ACPI_TO_POINTER (ACPI_STRTOUL (Target, NULL, 16));
-#endif
-
return (ObjPtr);
}
@@ -387,7 +370,7 @@ DumpNode:
AcpiUtDumpBuffer ((void *) Node, sizeof (ACPI_NAMESPACE_NODE),
Display, ACPI_UINT32_MAX);
- AcpiExDumpNode (Node, 1);
+ AcpiExDumpNamespaceNode (Node, 1);
ObjDesc = AcpiNsGetAttachedObject (Node);
if (ObjDesc)
@@ -435,8 +418,6 @@ AcpiDbDisplayMethodInfo (
UINT32 NumRemainingOps = 0;
UINT32 NumRemainingOperands = 0;
UINT32 NumRemainingOperators = 0;
- UINT32 NumArgs;
- UINT32 Concurrency;
BOOLEAN CountRemaining = FALSE;
@@ -450,13 +431,11 @@ AcpiDbDisplayMethodInfo (
ObjDesc = WalkState->MethodDesc;
Node = WalkState->MethodNode;
- NumArgs = ObjDesc->Method.ParamCount;
- Concurrency = ObjDesc->Method.Concurrency;
-
AcpiOsPrintf ("Currently executing control method is [%4.4s]\n",
AcpiUtGetNodeName (Node));
- AcpiOsPrintf ("%X arguments, max concurrency = %X\n",
- NumArgs, Concurrency);
+ AcpiOsPrintf ("%X Arguments, SyncLevel = %X\n",
+ (UINT32) ObjDesc->Method.ParamCount,
+ (UINT32) ObjDesc->Method.SyncLevel);
RootOp = StartOp;
@@ -601,8 +580,10 @@ AcpiDbDisplayResults (
UINT32 i;
ACPI_WALK_STATE *WalkState;
ACPI_OPERAND_OBJECT *ObjDesc;
- UINT32 NumResults = 0;
+ UINT32 ResultCount = 0;
ACPI_NAMESPACE_NODE *Node;
+ ACPI_GENERIC_STATE *Frame;
+ UINT32 Index; /* Index onto current frame */
WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
@@ -617,17 +598,28 @@ AcpiDbDisplayResults (
if (WalkState->Results)
{
- NumResults = WalkState->Results->Results.NumResults;
+ ResultCount = WalkState->ResultCount;
}
AcpiOsPrintf ("Method [%4.4s] has %X stacked result objects\n",
- AcpiUtGetNodeName (Node), NumResults);
+ AcpiUtGetNodeName (Node), ResultCount);
+
+ /* From the top element of result stack */
- for (i = 0; i < NumResults; i++)
+ Frame = WalkState->Results;
+ Index = (ResultCount - 1) % ACPI_RESULTS_FRAME_OBJ_NUM;
+
+ for (i = 0; i < ResultCount; i++)
{
- ObjDesc = WalkState->Results->Results.ObjDesc[i];
+ ObjDesc = Frame->Results.ObjDesc[Index];
AcpiOsPrintf ("Result%d: ", i);
AcpiDmDisplayInternalObject (ObjDesc, WalkState);
+ if (Index == 0)
+ {
+ Frame = Frame->Results.Next;
+ Index = ACPI_RESULTS_FRAME_OBJ_NUM;
+ }
+ Index--;
}
}
@@ -720,7 +712,7 @@ AcpiDbDisplayObjectType (
}
}
- ACPI_MEM_FREE (Info);
+ ACPI_FREE (Info);
}
else
{
@@ -857,8 +849,8 @@ AcpiDbDisplayGpes (
AcpiOsPrintf (
" RegisterInfo: %p Status %8.8X%8.8X Enable %8.8X%8.8X\n",
GpeBlock->RegisterInfo,
- ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (GpeBlock->RegisterInfo->StatusAddress.Address)),
- ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (GpeBlock->RegisterInfo->EnableAddress.Address)));
+ ACPI_FORMAT_UINT64 (GpeBlock->RegisterInfo->StatusAddress.Address),
+ ACPI_FORMAT_UINT64 (GpeBlock->RegisterInfo->EnableAddress.Address));
AcpiOsPrintf (" EventInfo: %p\n", GpeBlock->EventInfo);
@@ -872,8 +864,8 @@ AcpiDbDisplayGpes (
" Reg %u: WakeEnable %2.2X, RunEnable %2.2X Status %8.8X%8.8X Enable %8.8X%8.8X\n",
i, GpeRegisterInfo->EnableForWake,
GpeRegisterInfo->EnableForRun,
- ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (GpeRegisterInfo->StatusAddress.Address)),
- ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (GpeRegisterInfo->EnableAddress.Address)));
+ ACPI_FORMAT_UINT64 (GpeRegisterInfo->StatusAddress.Address),
+ ACPI_FORMAT_UINT64 (GpeRegisterInfo->EnableAddress.Address));
/* Now look at the individual GPEs in this byte register */
@@ -890,9 +882,9 @@ AcpiDbDisplayGpes (
}
AcpiOsPrintf (
- " GPE %.3X: %p Bit %2.2X Flags %2.2X: ",
+ " GPE %.3X: %p Flags %2.2X: ",
GpeBlock->BlockBaseNumber + GpeIndex,
- GpeEventInfo, GpeEventInfo->RegisterBit,
+ GpeEventInfo,
GpeEventInfo->Flags);
if (GpeEventInfo->Flags & ACPI_GPE_LEVEL_TRIGGERED)
diff --git a/sys/contrib/dev/acpica/dbexec.c b/sys/contrib/dev/acpica/dbexec.c
index 12c03bc..10e73f6 100644
--- a/sys/contrib/dev/acpica/dbexec.c
+++ b/sys/contrib/dev/acpica/dbexec.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbexec - debugger control method execution
- * $Revision: 1.70 $
+ * $Revision: 1.81 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -153,12 +153,6 @@ AcpiDbExecutionWalk (
void *Context,
void **ReturnValue);
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
-static UINT32
-AcpiDbGetCacheInfo (
- ACPI_MEMORY_LIST *Cache);
-#endif
-
/*******************************************************************************
*
@@ -283,7 +277,7 @@ AcpiDbExecuteSetup (
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
-static UINT32
+UINT32
AcpiDbGetCacheInfo (
ACPI_MEMORY_LIST *Cache)
{
@@ -399,6 +393,7 @@ AcpiDbExecute (
{
ACPI_STATUS Status;
ACPI_BUFFER ReturnObj;
+ char *NameString;
#ifdef ACPI_DEBUG_OUTPUT
@@ -419,8 +414,17 @@ AcpiDbExecute (
}
else
{
- AcpiUtStrupr (Name);
- AcpiGbl_DbMethodInfo.Name = Name;
+ NameString = ACPI_ALLOCATE (ACPI_STRLEN (Name) + 1);
+ if (!NameString)
+ {
+ return;
+ }
+
+ ACPI_MEMSET (&AcpiGbl_DbMethodInfo, 0, sizeof (ACPI_DB_METHOD_INFO));
+
+ ACPI_STRCPY (NameString, Name);
+ AcpiUtStrupr (NameString);
+ AcpiGbl_DbMethodInfo.Name = NameString;
AcpiGbl_DbMethodInfo.Args = Args;
AcpiGbl_DbMethodInfo.Flags = Flags;
@@ -429,6 +433,7 @@ AcpiDbExecute (
AcpiDbExecuteSetup (&AcpiGbl_DbMethodInfo);
Status = AcpiDbExecuteMethod (&AcpiGbl_DbMethodInfo, &ReturnObj);
+ ACPI_FREE (NameString);
}
/*
@@ -500,18 +505,23 @@ AcpiDbMethodThread (
ACPI_STATUS Status;
ACPI_DB_METHOD_INFO *Info = Context;
UINT32 i;
+ UINT8 Allow;
ACPI_BUFFER ReturnObj;
- for (i = 0; i < Info->NumLoops; i++)
+ if (Info->InitArgs)
{
-#if 0
- if (i == 0xEFDC)
- {
- AcpiDbgLevel = 0x00FFFFFF;
- }
-#endif
+ AcpiDbUInt32ToHexString (Info->NumCreated, Info->IndexOfThreadStr);
+ AcpiDbUInt32ToHexString (AcpiOsGetThreadId (), Info->IdOfThreadStr);
+ }
+
+ if (Info->Threads && (Info->NumCreated < Info->NumThreads))
+ {
+ Info->Threads[Info->NumCreated++] = AcpiOsGetThreadId();
+ }
+ for (i = 0; i < Info->NumLoops; i++)
+ {
Status = AcpiDbExecuteMethod (Info, &ReturnObj);
if (ACPI_FAILURE (Status))
{
@@ -523,12 +533,12 @@ AcpiDbMethodThread (
}
}
+#if 0
if ((i % 100) == 0)
{
- AcpiOsPrintf ("%d executions\n", i);
+ AcpiOsPrintf ("%d executions, Thread 0x%x\n", i, AcpiOsGetThreadId ());
}
-#if 0
if (ReturnObj.Length)
{
AcpiOsPrintf ("Execution of %s returned object %p Buflen %X\n",
@@ -540,10 +550,26 @@ AcpiDbMethodThread (
/* Signal our completion */
- Status = AcpiOsSignalSemaphore (Info->ThreadGate, 1);
- if (ACPI_FAILURE (Status))
+ Allow = 0;
+ AcpiOsWaitSemaphore (Info->ThreadCompleteGate, 1, ACPI_WAIT_FOREVER);
+ Info->NumCompleted++;
+
+ if (Info->NumCompleted == Info->NumThreads)
{
- AcpiOsPrintf ("Could not signal debugger semaphore\n");
+ /* Do signal for main thread once only */
+ Allow = 1;
+ }
+
+ AcpiOsSignalSemaphore (Info->ThreadCompleteGate, 1);
+
+ if (Allow)
+ {
+ Status = AcpiOsSignalSemaphore (Info->MainThreadGate, 1);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Could not signal debugger thread sync semaphore, %s\n",
+ AcpiFormatException (Status));
+ }
}
}
@@ -572,8 +598,9 @@ AcpiDbCreateExecutionThreads (
UINT32 NumThreads;
UINT32 NumLoops;
UINT32 i;
- ACPI_HANDLE ThreadGate;
-
+ UINT32 Size;
+ ACPI_MUTEX MainThreadGate;
+ ACPI_MUTEX ThreadCompleteGate;
/* Get the arguments */
@@ -587,23 +614,64 @@ AcpiDbCreateExecutionThreads (
return;
}
- /* Create the synchronization semaphore */
+ /*
+ * Create the semaphore for synchronization of
+ * the created threads with the main thread.
+ */
+ Status = AcpiOsCreateSemaphore (1, 0, &MainThreadGate);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Could not create semaphore for synchronization with the main thread, %s\n",
+ AcpiFormatException (Status));
+ return;
+ }
- Status = AcpiOsCreateSemaphore (1, 0, &ThreadGate);
+ /*
+ * Create the semaphore for synchronization
+ * between the created threads.
+ */
+ Status = AcpiOsCreateSemaphore (1, 1, &ThreadCompleteGate);
if (ACPI_FAILURE (Status))
{
- AcpiOsPrintf ("Could not create semaphore, %s\n",
+ AcpiOsPrintf ("Could not create semaphore for synchronization between the created threads, %s\n",
AcpiFormatException (Status));
+ (void) AcpiOsDeleteSemaphore (MainThreadGate);
return;
}
+ ACPI_MEMSET (&AcpiGbl_DbMethodInfo, 0, sizeof (ACPI_DB_METHOD_INFO));
+
+ /* Array to store IDs of threads */
+
+ AcpiGbl_DbMethodInfo.NumThreads = NumThreads;
+ Size = 4 * AcpiGbl_DbMethodInfo.NumThreads;
+ AcpiGbl_DbMethodInfo.Threads = (UINT32 *) AcpiOsAllocate (Size);
+ if (AcpiGbl_DbMethodInfo.Threads == NULL)
+ {
+ AcpiOsPrintf ("No memory for thread IDs array\n");
+ (void) AcpiOsDeleteSemaphore (MainThreadGate);
+ (void) AcpiOsDeleteSemaphore (ThreadCompleteGate);
+ return;
+ }
+ ACPI_MEMSET (AcpiGbl_DbMethodInfo.Threads, 0, Size);
+
/* Setup the context to be passed to each thread */
AcpiGbl_DbMethodInfo.Name = MethodNameArg;
- AcpiGbl_DbMethodInfo.Args = NULL;
AcpiGbl_DbMethodInfo.Flags = 0;
AcpiGbl_DbMethodInfo.NumLoops = NumLoops;
- AcpiGbl_DbMethodInfo.ThreadGate = ThreadGate;
+ AcpiGbl_DbMethodInfo.MainThreadGate = MainThreadGate;
+ AcpiGbl_DbMethodInfo.ThreadCompleteGate = ThreadCompleteGate;
+
+ /* Init arguments to be passed to method */
+
+ AcpiGbl_DbMethodInfo.InitArgs = 1;
+ AcpiGbl_DbMethodInfo.Args = AcpiGbl_DbMethodInfo.Arguments;
+ AcpiGbl_DbMethodInfo.Arguments[0] = AcpiGbl_DbMethodInfo.NumThreadsStr;
+ AcpiGbl_DbMethodInfo.Arguments[1] = AcpiGbl_DbMethodInfo.IdOfThreadStr;
+ AcpiGbl_DbMethodInfo.Arguments[2] = AcpiGbl_DbMethodInfo.IndexOfThreadStr;
+ AcpiGbl_DbMethodInfo.Arguments[3] = NULL;
+ AcpiDbUInt32ToHexString (NumThreads, AcpiGbl_DbMethodInfo.NumThreadsStr);
AcpiDbExecuteSetup (&AcpiGbl_DbMethodInfo);
@@ -614,7 +682,7 @@ AcpiDbCreateExecutionThreads (
for (i = 0; i < (NumThreads); i++)
{
- Status = AcpiOsQueueForExecution (OSD_PRIORITY_MED, AcpiDbMethodThread,
+ Status = AcpiOsExecute (OSL_DEBUGGER_THREAD, AcpiDbMethodThread,
&AcpiGbl_DbMethodInfo);
if (ACPI_FAILURE (Status))
{
@@ -624,20 +692,19 @@ AcpiDbCreateExecutionThreads (
/* Wait for all threads to complete */
- i = NumThreads;
- while (i) /* Brain damage for host OSs that only support wait of 1 unit */
- {
- Status = AcpiOsWaitSemaphore (ThreadGate, 1, ACPI_WAIT_FOREVER);
- i--;
- }
-
- /* Cleanup and exit */
-
- (void) AcpiOsDeleteSemaphore (ThreadGate);
+ AcpiOsWaitSemaphore (MainThreadGate, 1, ACPI_WAIT_FOREVER);
AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
AcpiOsPrintf ("All threads (%X) have completed\n", NumThreads);
AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
+
+ /* Cleanup and exit */
+
+ (void) AcpiOsDeleteSemaphore (MainThreadGate);
+ (void) AcpiOsDeleteSemaphore (ThreadCompleteGate);
+
+ AcpiOsFree (AcpiGbl_DbMethodInfo.Threads);
+ AcpiGbl_DbMethodInfo.Threads = NULL;
}
#endif /* ACPI_DEBUGGER */
diff --git a/sys/contrib/dev/acpica/dbfileio.c b/sys/contrib/dev/acpica/dbfileio.c
index c49b0b4..dc97d752 100644
--- a/sys/contrib/dev/acpica/dbfileio.c
+++ b/sys/contrib/dev/acpica/dbfileio.c
@@ -2,7 +2,7 @@
*
* 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.84 $
+ * $Revision: 1.94 $
*
******************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -120,6 +120,7 @@
#include <contrib/dev/acpica/acdebug.h>
#include <contrib/dev/acpica/acnamesp.h>
#include <contrib/dev/acpica/actables.h>
+#include <contrib/dev/acpica/acdisasm.h>
#if (defined ACPI_DEBUGGER || defined ACPI_DISASSEMBLER)
@@ -151,7 +152,6 @@ AcpiDbCheckTextModeCorruption (
static ACPI_STATUS
AeLocalLoadTable (
ACPI_TABLE_HEADER *TablePtr);
-
#endif
/*******************************************************************************
@@ -250,8 +250,8 @@ AcpiDbCheckTextModeCorruption (
if (TableLength != FileLength)
{
- ACPI_REPORT_WARNING ((
- "File length (0x%X) is not the same as the table length (0x%X)\n",
+ ACPI_WARNING ((AE_INFO,
+ "File length (0x%X) is not the same as the table length (0x%X)",
FileLength, TableLength));
}
@@ -277,6 +277,11 @@ AcpiDbCheckTextModeCorruption (
}
}
+ if (!Pairs)
+ {
+ return (AE_OK);
+ }
+
/*
* Entire table scanned, each CR is part of a CR/LF pair --
* meaning that the table was treated as a text file somewhere.
@@ -316,61 +321,95 @@ AcpiDbReadTable (
UINT32 Actual;
ACPI_STATUS Status;
UINT32 FileSize;
+ BOOLEAN StandardHeader = TRUE;
+
+ /* Get the file size */
fseek (fp, 0, SEEK_END);
FileSize = (UINT32) ftell (fp);
fseek (fp, 0, SEEK_SET);
- /* Read the table header */
-
- if (fread (&TableHeader, 1, sizeof (TableHeader), fp) !=
- sizeof (ACPI_TABLE_HEADER))
+ if (FileSize < 4)
{
- AcpiOsPrintf ("Could not read the table header\n");
return (AE_BAD_HEADER);
}
- /* Validate the table header/length */
+ /* Read the signature */
- Status = AcpiTbValidateTableHeader (&TableHeader);
- if (ACPI_FAILURE (Status))
+ if (fread (&TableHeader, 1, 4, fp) != 4)
{
- AcpiOsPrintf ("Table header is invalid!\n");
- return (Status);
+ AcpiOsPrintf ("Could not read the table signature\n");
+ return (AE_BAD_HEADER);
}
- /* File size must be at least as long as the Header-specified length */
+ fseek (fp, 0, SEEK_SET);
- if (TableHeader.Length > FileSize)
+ /* The RSDT and FACS tables do not have standard ACPI headers */
+
+ if (ACPI_COMPARE_NAME (TableHeader.Signature, "RSD ") ||
+ ACPI_COMPARE_NAME (TableHeader.Signature, "FACS"))
{
- AcpiOsPrintf (
- "TableHeader length [0x%X] greater than the input file size [0x%X]\n",
- TableHeader.Length, FileSize);
- return (AE_BAD_HEADER);
+ *TableLength = FileSize;
+ StandardHeader = FALSE;
}
+ else
+ {
+ /* Read the table header */
+
+ if (fread (&TableHeader, 1, sizeof (TableHeader), fp) !=
+ sizeof (ACPI_TABLE_HEADER))
+ {
+ AcpiOsPrintf ("Could not read the table header\n");
+ return (AE_BAD_HEADER);
+ }
- /* We only support a limited number of table types */
+#if 0
+ /* Validate the table header/length */
- if (ACPI_STRNCMP ((char *) TableHeader.Signature, DSDT_SIG, 4) &&
- ACPI_STRNCMP ((char *) TableHeader.Signature, PSDT_SIG, 4) &&
- ACPI_STRNCMP ((char *) TableHeader.Signature, SSDT_SIG, 4))
- {
- AcpiOsPrintf ("Table signature [%4.4s] is invalid or not supported\n",
- (char *) TableHeader.Signature);
- ACPI_DUMP_BUFFER (&TableHeader, sizeof (ACPI_TABLE_HEADER));
- return (AE_ERROR);
+ Status = AcpiTbValidateTableHeader (&TableHeader);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Table header is invalid!\n");
+ return (Status);
+ }
+#endif
+
+ /* File size must be at least as long as the Header-specified length */
+
+ if (TableHeader.Length > FileSize)
+ {
+ AcpiOsPrintf (
+ "TableHeader length [0x%X] greater than the input file size [0x%X]\n",
+ TableHeader.Length, FileSize);
+ return (AE_BAD_HEADER);
+ }
+
+#ifdef ACPI_OBSOLETE_CODE
+ /* We only support a limited number of table types */
+
+ if (ACPI_STRNCMP ((char *) TableHeader.Signature, DSDT_SIG, 4) &&
+ ACPI_STRNCMP ((char *) TableHeader.Signature, PSDT_SIG, 4) &&
+ ACPI_STRNCMP ((char *) TableHeader.Signature, SSDT_SIG, 4))
+ {
+ AcpiOsPrintf ("Table signature [%4.4s] is invalid or not supported\n",
+ (char *) TableHeader.Signature);
+ ACPI_DUMP_BUFFER (&TableHeader, sizeof (ACPI_TABLE_HEADER));
+ return (AE_ERROR);
+ }
+#endif
+
+ *TableLength = TableHeader.Length;
}
/* Allocate a buffer for the table */
- *TableLength = TableHeader.Length;
- *Table = AcpiOsAllocate ((size_t) (FileSize));
+ *Table = AcpiOsAllocate ((size_t) FileSize);
if (!*Table)
{
AcpiOsPrintf (
"Could not allocate memory for ACPI table %4.4s (size=0x%X)\n",
- TableHeader.Signature, TableHeader.Length);
+ TableHeader.Signature, *TableLength);
return (AE_NO_MEMORY);
}
@@ -380,15 +419,19 @@ AcpiDbReadTable (
Actual = fread (*Table, 1, (size_t) FileSize, fp);
if (Actual == FileSize)
{
- /* Now validate the checksum */
+ if (StandardHeader)
+ {
+ /* Now validate the checksum */
- Status = AcpiTbVerifyTableChecksum (*Table);
+ Status = AcpiTbChecksum ((void *) *Table,
+ ACPI_CAST_PTR (ACPI_TABLE_HEADER, *Table)->Length);
- if (Status == AE_BAD_CHECKSUM)
- {
- Status = AcpiDbCheckTextModeCorruption ((UINT8 *) *Table,
- FileSize, (*Table)->Length);
- return (Status);
+ if (Status == AE_BAD_CHECKSUM)
+ {
+ Status = AcpiDbCheckTextModeCorruption ((UINT8 *) *Table,
+ FileSize, (*Table)->Length);
+ return (Status);
+ }
}
return (AE_OK);
}
@@ -429,11 +472,12 @@ static ACPI_STATUS
AeLocalLoadTable (
ACPI_TABLE_HEADER *Table)
{
- ACPI_STATUS Status;
- ACPI_TABLE_DESC TableInfo;
+ ACPI_STATUS Status = AE_OK;
+/* ACPI_TABLE_DESC TableInfo; */
- ACPI_FUNCTION_TRACE ("AeLocalLoadTable");
+ ACPI_FUNCTION_TRACE (AeLocalLoadTable);
+#if 0
if (!Table)
@@ -473,10 +517,11 @@ AeLocalLoadTable (
{
/* Uninstall table and free the buffer */
- AcpiTbDeleteTablesByType (ACPI_TABLE_DSDT);
+ AcpiTbDeleteTablesByType (ACPI_TABLE_ID_DSDT);
return_ACPI_STATUS (Status);
}
#endif
+#endif
return_ACPI_STATUS (Status);
}
@@ -552,6 +597,7 @@ AcpiDbGetTableFromFile (
#ifdef ACPI_APPLICATION
ACPI_STATUS Status;
ACPI_TABLE_HEADER *Table;
+ BOOLEAN IsAmlTable = TRUE;
Status = AcpiDbReadTableFromFile (Filename, &Table);
@@ -560,28 +606,36 @@ AcpiDbGetTableFromFile (
return (Status);
}
- /* Attempt to recognize and install the table */
+#ifdef ACPI_DATA_TABLE_DISASSEMBLY
+ IsAmlTable = AcpiUtIsAmlTable (Table);
+#endif
- Status = AeLocalLoadTable (Table);
- if (ACPI_FAILURE (Status))
+ if (IsAmlTable)
{
- if (Status == AE_ALREADY_EXISTS)
- {
- AcpiOsPrintf ("Table %4.4s is already installed\n",
- Table->Signature);
- }
- else
+ /* Attempt to recognize and install the table */
+
+ Status = AeLocalLoadTable (Table);
+ if (ACPI_FAILURE (Status))
{
- AcpiOsPrintf ("Could not install table, %s\n",
- AcpiFormatException (Status));
+ if (Status == AE_ALREADY_EXISTS)
+ {
+ AcpiOsPrintf ("Table %4.4s is already installed\n",
+ Table->Signature);
+ }
+ else
+ {
+ AcpiOsPrintf ("Could not install table, %s\n",
+ AcpiFormatException (Status));
+ }
+
+ return (Status);
}
- return (Status);
+ fprintf (stderr,
+ "Acpi table [%4.4s] successfully installed and loaded\n",
+ Table->Signature);
}
- fprintf (stderr, "Acpi table [%4.4s] successfully installed and loaded\n",
- Table->Signature);
-
AcpiGbl_AcpiHardwarePresent = FALSE;
if (ReturnTable)
{
diff --git a/sys/contrib/dev/acpica/dbhistry.c b/sys/contrib/dev/acpica/dbhistry.c
index 161d389..f766f4f 100644
--- a/sys/contrib/dev/acpica/dbhistry.c
+++ b/sys/contrib/dev/acpica/dbhistry.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dbhistry - debugger HISTORY command
- * $Revision: 1.32 $
+ * $Revision: 1.34 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
diff --git a/sys/contrib/dev/acpica/dbinput.c b/sys/contrib/dev/acpica/dbinput.c
index 4b27946..a7257ad 100644
--- a/sys/contrib/dev/acpica/dbinput.c
+++ b/sys/contrib/dev/acpica/dbinput.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbinput - user front-end to the AML debugger
- * $Revision: 1.111 $
+ * $Revision: 1.114 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -366,7 +366,6 @@ AcpiDbDisplayHelp (
AcpiOsPrintf ("Set N <NamedObject> <Value> Set value for named integer\n");
AcpiOsPrintf ("Sleep <SleepState> Simulate sleep/wake sequence\n");
AcpiOsPrintf ("Terminate Delete namespace and all internal objects\n");
- AcpiOsPrintf ("Thread <Threads><Loops><NamePath> Spawn threads to execute method(s)\n");
AcpiOsPrintf ("Type <Object> Display object type\n");
return;
@@ -385,6 +384,7 @@ AcpiDbDisplayHelp (
AcpiOsPrintf ("Results Display method result stack\n");
AcpiOsPrintf ("Set <A|L> <#> <Value> Set method data (Arguments/Locals)\n");
AcpiOsPrintf ("Stop Terminate control method\n");
+ AcpiOsPrintf ("Thread <Threads><Loops><NamePath> Spawn threads to execute method(s)\n");
AcpiOsPrintf ("Trace <method name> Trace method execution\n");
AcpiOsPrintf ("Tree Display control method calling tree\n");
AcpiOsPrintf ("<Enter> Single step next AML opcode (over calls)\n");
diff --git a/sys/contrib/dev/acpica/dbstats.c b/sys/contrib/dev/acpica/dbstats.c
index a4c47e4..8a2f261 100644
--- a/sys/contrib/dev/acpica/dbstats.c
+++ b/sys/contrib/dev/acpica/dbstats.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbstats - Generation and display of ACPI table statistics
- * $Revision: 1.79 $
+ * $Revision: 1.87 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -170,6 +170,8 @@ static ARGUMENT_INFO AcpiDbStatTypes [] =
#define CMD_STAT_STACK 6
+#if defined ACPI_DBG_TRACK_ALLOCATIONS || defined ACPI_USE_LOCAL_CACHE
+
/*******************************************************************************
*
* FUNCTION: AcpiDbListInfo
@@ -188,7 +190,6 @@ AcpiDbListInfo (
{
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
UINT32 Outstanding;
- UINT32 Temp;
#endif
AcpiOsPrintf ("\n%s\n", List->ListName);
@@ -198,7 +199,7 @@ AcpiDbListInfo (
if (List->MaxDepth > 0)
{
AcpiOsPrintf (
- " Cache: [Depth Max Avail Size] % 7d % 7d % 7d % 7d B\n",
+ " Cache: [Depth MaxD Avail Size] %8.2X %8.2X %8.2X %8.2X\n",
List->CurrentDepth,
List->MaxDepth,
List->MaxDepth - List->CurrentDepth,
@@ -209,33 +210,39 @@ AcpiDbListInfo (
if (List->MaxDepth > 0)
{
AcpiOsPrintf (
- " Cache: [Requests Hits Misses ObjSize] % 7d % 7d % 7d % 7d B\n",
+ " Cache: [Requests Hits Misses ObjSize] %8.2X %8.2X %8.2X %8.2X\n",
List->Requests,
List->Hits,
List->Requests - List->Hits,
List->ObjectSize);
}
- Outstanding = List->TotalAllocated -
- List->TotalFreed -
- List->CurrentDepth;
+ Outstanding = AcpiDbGetCacheInfo (List);
if (List->ObjectSize)
{
- Temp = ACPI_ROUND_UP_TO_1K (Outstanding * List->ObjectSize);
+ AcpiOsPrintf (
+ " Mem: [Alloc Free Max CurSize Outstanding] %8.2X %8.2X %8.2X %8.2X %8.2X\n",
+ List->TotalAllocated,
+ List->TotalFreed,
+ List->MaxOccupied,
+ Outstanding * List->ObjectSize,
+ Outstanding);
}
else
{
- Temp = ACPI_ROUND_UP_TO_1K (List->CurrentTotalSize);
+ AcpiOsPrintf (
+ " Mem: [Alloc Free Max CurSize Outstanding Total] %8.2X %8.2X %8.2X %8.2X %8.2X %8.2X\n",
+ List->TotalAllocated,
+ List->TotalFreed,
+ List->MaxOccupied,
+ List->CurrentTotalSize,
+ Outstanding,
+ List->TotalSize);
}
-
- AcpiOsPrintf (
- " Mem: [Alloc Free Outstanding Size] % 7d % 7d % 7d % 7d Kb\n",
- List->TotalAllocated,
- List->TotalFreed,
- Outstanding, Temp);
#endif
}
+#endif
/*******************************************************************************
@@ -462,11 +469,6 @@ AcpiDbDisplayStatistics (
UINT32 Temp;
- if (!AcpiGbl_DSDT)
- {
- AcpiOsPrintf ("*** Warning: There is no DSDT loaded\n");
- }
-
if (!TypeArg)
{
AcpiOsPrintf ("The following subcommands are available:\n ALLOCATIONS, OBJECTS, MEMORY, MISC, SIZES, TABLES\n");
@@ -493,12 +495,7 @@ AcpiDbDisplayStatistics (
case CMD_STAT_TABLES:
- AcpiOsPrintf ("ACPI Table Information:\n\n");
- if (AcpiGbl_DSDT)
- {
- AcpiOsPrintf ("DSDT Length:................% 7ld (%X)\n",
- AcpiGbl_DSDT->Length, AcpiGbl_DSDT->Length);
- }
+ AcpiOsPrintf ("ACPI Table Information (not implemented):\n\n");
break;
case CMD_STAT_OBJECTS:
@@ -525,7 +522,7 @@ AcpiDbDisplayStatistics (
case CMD_STAT_MEMORY:
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
- AcpiOsPrintf ("\n----Object and Cache Statistics---------------------------------------------\n");
+ AcpiOsPrintf ("\n----Object and Cache Statistics (all in hex)---------\n");
AcpiDbListInfo (AcpiGbl_GlobalList);
AcpiDbListInfo (AcpiGbl_NsNodeList);
@@ -551,7 +548,7 @@ AcpiDbDisplayStatistics (
AcpiOsPrintf ("\n");
AcpiOsPrintf ("Mutex usage:\n\n");
- for (i = 0; i < NUM_MUTEX; i++)
+ for (i = 0; i < ACPI_NUM_MUTEX; i++)
{
AcpiOsPrintf ("%-28s: % 7ld\n",
AcpiUtGetMutexName (i), AcpiGbl_MutexInfo[i].UseCount);
diff --git a/sys/contrib/dev/acpica/dbutils.c b/sys/contrib/dev/acpica/dbutils.c
index 173e50e..dd1e67b 100644
--- a/sys/contrib/dev/acpica/dbutils.c
+++ b/sys/contrib/dev/acpica/dbutils.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbutils - AML debugger utilities
- * $Revision: 1.76 $
+ * $Revision: 1.83 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -138,6 +138,8 @@ AcpiDbDumpBuffer (
UINT32 Address);
#endif
+static char *Converter = "0123456789ABCDEF";
+
/*******************************************************************************
*
@@ -260,7 +262,7 @@ AcpiDbDumpExternalObject (
case ACPI_TYPE_STRING:
- AcpiOsPrintf ("[String] Value: ");
+ AcpiOsPrintf ("[String] Length %.2X = ", ObjDesc->String.Length);
for (i = 0; i < ObjDesc->String.Length; i++)
{
AcpiOsPrintf ("%c", ObjDesc->String.Pointer[i]);
@@ -274,7 +276,7 @@ AcpiDbDumpExternalObject (
AcpiOsPrintf ("[Buffer] Length %.2X = ", ObjDesc->Buffer.Length);
if (ObjDesc->Buffer.Length)
{
- AcpiUtDumpBuffer ((UINT8 *) ObjDesc->Buffer.Pointer,
+ AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, ObjDesc->Buffer.Pointer),
ObjDesc->Buffer.Length, DB_DWORD_DISPLAY, _COMPONENT);
}
else
@@ -286,7 +288,7 @@ AcpiDbDumpExternalObject (
case ACPI_TYPE_PACKAGE:
- AcpiOsPrintf ("[Package] Contains %d Elements:\n",
+ AcpiOsPrintf ("[Package] Contains %d Elements:\n",
ObjDesc->Package.Count);
for (i = 0; i < ObjDesc->Package.Count; i++)
@@ -419,15 +421,56 @@ AcpiDbLocalNsLookup (
ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node);
if (ACPI_FAILURE (Status))
{
- AcpiOsPrintf ("Could not locate name: %s %s\n",
+ AcpiOsPrintf ("Could not locate name: %s, %s\n",
Name, AcpiFormatException (Status));
}
- ACPI_MEM_FREE (InternalPath);
+ ACPI_FREE (InternalPath);
return (Node);
}
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbUInt32ToHexString
+ *
+ * PARAMETERS: Value - The value to be converted to string
+ * Buffer - Buffer for result (not less than 11 bytes)
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Convert the unsigned 32-bit value to the hexadecimal image
+ *
+ * NOTE: It is the caller's responsibility to ensure that the length of buffer
+ * is sufficient.
+ *
+ ******************************************************************************/
+
+void
+AcpiDbUInt32ToHexString (
+ UINT32 Value,
+ char *Buffer)
+{
+ UINT8 i;
+
+
+ if (Value == 0)
+ {
+ ACPI_STRCPY (Buffer, "0");
+ return;
+ }
+
+ ACPI_STRCPY (Buffer, "0x");
+ Buffer[10] = '\0';
+
+ for (i = 9; i > 1; i--)
+ {
+ Buffer[i] = Converter [Value & 0x0F];
+ Value = Value >> 4;
+ }
+}
+
+
#ifdef ACPI_OBSOLETE_FUNCTIONS
/*******************************************************************************
*
diff --git a/sys/contrib/dev/acpica/dbxface.c b/sys/contrib/dev/acpica/dbxface.c
index 053315d..50e1ecb 100644
--- a/sys/contrib/dev/acpica/dbxface.c
+++ b/sys/contrib/dev/acpica/dbxface.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbxface - AML Debugger external interfaces
- * $Revision: 1.75 $
+ * $Revision: 1.78 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -528,7 +528,7 @@ AcpiDbInitialize (
/* Create the debug execution thread to execute commands */
- Status = AcpiOsQueueForExecution (0, AcpiDbExecuteThread, NULL);
+ Status = AcpiOsExecute (OSL_DEBUGGER_THREAD, AcpiDbExecuteThread, NULL);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could not start debugger thread\n");
diff --git a/sys/contrib/dev/acpica/dmbuffer.c b/sys/contrib/dev/acpica/dmbuffer.c
index cd6f1f0..5540220 100644
--- a/sys/contrib/dev/acpica/dmbuffer.c
+++ b/sys/contrib/dev/acpica/dmbuffer.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dmbuffer - AML disassembler, buffer and string support
- * $Revision: 1.19 $
+ * $Revision: 1.25 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -143,7 +143,8 @@ AcpiDmUnicode (
*
* RETURN: None
*
- * DESCRIPTION: Dump an AML "ByteList" in Hex format
+ * DESCRIPTION: Dump an AML "ByteList" in Hex format. 8 bytes per line, prefixed
+ * with the hex buffer offset.
*
******************************************************************************/
@@ -156,12 +157,31 @@ AcpiDmDisasmByteList (
UINT32 i;
- AcpiDmIndent (Level);
+ if (!ByteCount)
+ {
+ return;
+ }
/* Dump the byte list */
for (i = 0; i < ByteCount; i++)
{
+ /* New line every 8 bytes */
+
+ if (((i % 8) == 0) && (i < ByteCount))
+ {
+ if (i > 0)
+ {
+ AcpiOsPrintf ("\n");
+ }
+
+ AcpiDmIndent (Level);
+ if (ByteCount > 7)
+ {
+ AcpiOsPrintf ("/* %04X */ ", i);
+ }
+ }
+
AcpiOsPrintf ("0x%2.2X", (UINT32) ByteData[i]);
/* Add comma if there are more bytes to display */
@@ -170,14 +190,6 @@ AcpiDmDisasmByteList (
{
AcpiOsPrintf (", ");
}
-
- /* New line every 8 bytes */
-
- if ((((i+1) % 8) == 0) && ((i+1) < ByteCount))
- {
- AcpiOsPrintf ("\n");
- AcpiDmIndent (Level);
- }
}
if (Level)
@@ -221,7 +233,7 @@ AcpiDmByteList (
{
case ACPI_DASM_RESOURCE:
- AcpiDmResourceTemplate (Info, ByteData, ByteCount);
+ AcpiDmResourceTemplate (Info, Op->Common.Parent, ByteData, ByteCount);
break;
case ACPI_DASM_STRING:
@@ -460,7 +472,7 @@ AcpiDmIsEisaId (
/* We are looking for _HID */
- if (ACPI_STRNCMP ((char *) &Name, METHOD_NAME__HID, 4))
+ if (!ACPI_COMPARE_NAME (&Name, METHOD_NAME__HID))
{
return;
}
diff --git a/sys/contrib/dev/acpica/dmnames.c b/sys/contrib/dev/acpica/dmnames.c
index 2c8029f..6936462 100644
--- a/sys/contrib/dev/acpica/dmnames.c
+++ b/sys/contrib/dev/acpica/dmnames.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dmnames - AML disassembler, names, namestrings, pathnames
- * $Revision: 1.11 $
+ * $Revision: 1.17 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -154,21 +154,33 @@ AcpiDmDumpName (
{
UINT32 i;
UINT32 Length;
- char *End = Name + ACPI_NAME_SIZE;
+ char NewName[4];
- for (i = 0; i < ACPI_NAME_SIZE; i++)
+ /* Ensure that the name is printable, even if we have to fix it */
+
+ *(UINT32 *) NewName = AcpiUtRepairName (Name);
+
+ /* Remove all trailing underscores from the name */
+
+ Length = ACPI_NAME_SIZE;
+ for (i = (ACPI_NAME_SIZE - 1); i != 0; i--)
{
- if (Name[i] != '_')
+ if (NewName[i] == '_')
{
- End = &Name[i];
+ Length--;
+ }
+ else
+ {
+ break;
}
}
- Length = (UINT32)(End - Name) + 1;
+ /* Dump the name, up to the start of the trailing underscores */
+
for (i = 0; i < Length; i++)
{
- AcpiOsPrintf ("%c", Name[i]);
+ AcpiOsPrintf ("%c", NewName[i]);
}
return (Length);
@@ -245,7 +257,7 @@ AcpiPsDisplayObjectPathname (
}
AcpiOsPrintf (" (Path %s)", (char *) Buffer.Pointer);
- ACPI_MEM_FREE (Buffer.Pointer);
+ ACPI_FREE (Buffer.Pointer);
Exit:
diff --git a/sys/contrib/dev/acpica/dmobject.c b/sys/contrib/dev/acpica/dmobject.c
index f63d3ee..7b7d3c3 100644
--- a/sys/contrib/dev/acpica/dmobject.c
+++ b/sys/contrib/dev/acpica/dmobject.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dmobject - ACPI object decode and display
- * $Revision: 1.17 $
+ * $Revision: 1.22 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -210,13 +210,16 @@ AcpiDmDumpMethodInfo (
if (NextWalkState == WalkState)
{
- /* Display currently executing ASL statement */
+ if (Op)
+ {
+ /* Display currently executing ASL statement */
- Next = Op->Common.Next;
- Op->Common.Next = NULL;
+ Next = Op->Common.Next;
+ Op->Common.Next = NULL;
- AcpiDmDisassemble (NextWalkState, Op, ACPI_UINT32_MAX);
- Op->Common.Next = Next;
+ AcpiDmDisassemble (NextWalkState, Op, ACPI_UINT32_MAX);
+ Op->Common.Next = Next;
+ }
}
else
{
@@ -378,7 +381,7 @@ AcpiDmDisplayInternalObject (
if (!ObjDesc)
{
- AcpiOsPrintf ("<NullObj>\n");
+ AcpiOsPrintf ("<Null Object>\n");
return;
}
@@ -611,8 +614,6 @@ AcpiDmDisplayArguments (
{
UINT32 i;
ACPI_OPERAND_OBJECT *ObjDesc;
- UINT32 NumArgs;
- UINT32 Concurrency;
ACPI_NAMESPACE_NODE *Node;
@@ -631,12 +632,9 @@ AcpiDmDisplayArguments (
return;
}
- NumArgs = ObjDesc->Method.ParamCount;
- Concurrency = ObjDesc->Method.Concurrency;
-
AcpiOsPrintf (
"Arguments for Method [%4.4s]: (%X arguments defined, max concurrency = %X)\n",
- AcpiUtGetNodeName (Node), NumArgs, Concurrency);
+ AcpiUtGetNodeName (Node), ObjDesc->Method.ParamCount, ObjDesc->Method.SyncLevel);
for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++)
{
diff --git a/sys/contrib/dev/acpica/dmopcode.c b/sys/contrib/dev/acpica/dmopcode.c
index 5e074b7..bdb9eef 100644
--- a/sys/contrib/dev/acpica/dmopcode.c
+++ b/sys/contrib/dev/acpica/dmopcode.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dmopcode - AML disassembler, specific AML opcodes
- * $Revision: 1.90 $
+ * $Revision: 1.101 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -202,16 +202,16 @@ AcpiDmFieldFlags (
UINT32 Flags;
- /* The next Op contains the flags */
+ /* The next peer Op (not child op) contains the flags */
- Op = AcpiPsGetDepthNext (NULL, Op);
+ Op = Op->Common.Next;
Flags = (UINT8) Op->Common.Value.Integer;
/* Mark the Op as completed */
Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
- AcpiOsPrintf ("%s, ", AcpiGbl_AccessTypes [Flags & 0x0F]);
+ AcpiOsPrintf ("%s, ", AcpiGbl_AccessTypes [Flags & 0x07]);
AcpiOsPrintf ("%s, ", AcpiGbl_LockRule [(Flags & 0x10) >> 4]);
AcpiOsPrintf ("%s)", AcpiGbl_UpdateRules [(Flags & 0x60) >> 5]);
}
@@ -340,14 +340,14 @@ AcpiDmMatchKeyword (
{
- if (((UINT32) Op->Common.Value.Integer) >= ACPI_NUM_MATCH_OPS)
+ if (((UINT32) Op->Common.Value.Integer) > ACPI_MAX_MATCH_OPCODE)
{
AcpiOsPrintf ("/* Unknown Match Keyword encoding */");
}
else
{
- AcpiOsPrintf ("%s", (char *)
- AcpiGbl_MatchOps[(ACPI_SIZE) Op->Common.Value.Integer]);
+ AcpiOsPrintf ("%s", ACPI_CAST_PTR (char,
+ AcpiGbl_MatchOps[(ACPI_SIZE) Op->Common.Value.Integer]));
}
}
@@ -375,6 +375,8 @@ AcpiDmDisassembleOneOp (
const ACPI_OPCODE_INFO *OpInfo = NULL;
UINT32 Offset;
UINT32 Length;
+ ACPI_PARSE_OBJECT *Child;
+ ACPI_STATUS Status;
if (!Op)
@@ -390,38 +392,52 @@ AcpiDmDisassembleOneOp (
AcpiDmMatchKeyword (Op);
return;
- default:
- break;
- }
-
- /* The op and arguments */
-
- switch (Op->Common.AmlOpcode)
- {
- case AML_ZERO_OP:
-
- AcpiOsPrintf ("Zero");
- break;
+ case ACPI_DASM_LNOT_SUFFIX:
+ switch (Op->Common.AmlOpcode)
+ {
+ case AML_LEQUAL_OP:
+ AcpiOsPrintf ("LNotEqual");
+ break;
+ case AML_LGREATER_OP:
+ AcpiOsPrintf ("LLessEqual");
+ break;
- case AML_ONE_OP:
+ case AML_LLESS_OP:
+ AcpiOsPrintf ("LGreaterEqual");
+ break;
+ }
+ Op->Common.DisasmOpcode = 0;
+ Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
+ return;
- AcpiOsPrintf ("One");
+ default:
break;
+ }
- case AML_ONES_OP:
-
- AcpiOsPrintf ("Ones");
- break;
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+ /* The op and arguments */
- case AML_REVISION_OP:
+ switch (Op->Common.AmlOpcode)
+ {
+ case AML_LNOT_OP:
- AcpiOsPrintf ("Revision");
+ Child = Op->Common.Value.Arg;
+ if ((Child->Common.AmlOpcode == AML_LEQUAL_OP) ||
+ (Child->Common.AmlOpcode == AML_LGREATER_OP) ||
+ (Child->Common.AmlOpcode == AML_LLESS_OP))
+ {
+ Child->Common.DisasmOpcode = ACPI_DASM_LNOT_SUFFIX;
+ Op->Common.DisasmOpcode = ACPI_DASM_LNOT_PREFIX;
+ }
+ else
+ {
+ AcpiOsPrintf ("%s", OpInfo->Name);
+ }
break;
-
case AML_BYTE_OP:
AcpiOsPrintf ("0x%2.2X", (UINT32) Op->Common.Value.Integer);
@@ -481,12 +497,19 @@ AcpiDmDisassembleOneOp (
* types of buffers, we have to closely look at the data in the
* buffer to determine the type.
*/
- if (AcpiDmIsResourceTemplate (Op))
+ Status = AcpiDmIsResourceTemplate (Op);
+ if (ACPI_SUCCESS (Status))
{
Op->Common.DisasmOpcode = ACPI_DASM_RESOURCE;
AcpiOsPrintf ("ResourceTemplate");
+ break;
}
- else if (AcpiDmIsUnicodeBuffer (Op))
+ else if (Status == AE_AML_NO_RESOURCE_END_TAG)
+ {
+ AcpiOsPrintf ("/**** Is ResourceTemplate, but EndTag not at buffer end ****/ ");
+ }
+
+ if (AcpiDmIsUnicodeBuffer (Op))
{
Op->Common.DisasmOpcode = ACPI_DASM_UNICODE;
AcpiOsPrintf ("Unicode (");
@@ -543,7 +566,7 @@ AcpiDmDisassembleOneOp (
if (Info->BitOffset % 8 == 0)
{
- AcpiOsPrintf ("Offset (0x%.2X)", ACPI_DIV_8 (Info->BitOffset));
+ AcpiOsPrintf (" Offset (0x%.2X)", ACPI_DIV_8 (Info->BitOffset));
}
else
{
@@ -556,8 +579,8 @@ AcpiDmDisassembleOneOp (
case AML_INT_ACCESSFIELD_OP:
- AcpiOsPrintf ("AccessAs (%s, ",
- AcpiGbl_AccessTypes [(UINT32) Op->Common.Value.Integer >> 8]);
+ AcpiOsPrintf (" AccessAs (%s, ",
+ AcpiGbl_AccessTypes [(UINT32) (Op->Common.Value.Integer >> 8) & 0x7]);
AcpiDmDecodeAttribute ((UINT8) Op->Common.Value.Integer);
AcpiOsPrintf (")");
@@ -573,7 +596,6 @@ AcpiDmDisassembleOneOp (
case AML_INT_METHODCALL_OP:
- OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
Op = AcpiPsGetDepthNext (NULL, Op);
Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
@@ -585,7 +607,6 @@ AcpiDmDisassembleOneOp (
/* Just get the opcode name and print it */
- OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
AcpiOsPrintf ("%s", OpInfo->Name);
@@ -594,13 +615,15 @@ AcpiDmDisassembleOneOp (
if ((Op->Common.AmlOpcode == AML_INT_RETURN_VALUE_OP) &&
(WalkState) &&
(WalkState->Results) &&
- (WalkState->Results->Results.NumResults))
+ (WalkState->ResultCount))
{
AcpiDmDecodeInternalObject (
WalkState->Results->Results.ObjDesc [
- WalkState->Results->Results.NumResults-1]);
+ (WalkState->ResultCount - 1) %
+ ACPI_RESULTS_FRAME_OBJ_NUM]);
}
#endif
+
break;
}
}
diff --git a/sys/contrib/dev/acpica/dmresrc.c b/sys/contrib/dev/acpica/dmresrc.c
index 1bbea38..60b7896 100644
--- a/sys/contrib/dev/acpica/dmresrc.c
+++ b/sys/contrib/dev/acpica/dmresrc.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dmresrc.c - Resource Descriptor disassembly
- * $Revision: 1.26 $
+ * $Revision: 1.35 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -133,8 +133,10 @@ void (*ACPI_RESOURCE_HANDLER) (
UINT32 Length,
UINT32 Level);
-static ACPI_RESOURCE_HANDLER AcpiGbl_SmResourceDispatch [] =
+static ACPI_RESOURCE_HANDLER AcpiGbl_DumpResourceDispatch [] =
{
+ /* Small descriptors */
+
NULL, /* 0x00, Reserved */
NULL, /* 0x01, Reserved */
NULL, /* 0x02, Reserved */
@@ -150,11 +152,10 @@ static ACPI_RESOURCE_HANDLER AcpiGbl_SmResourceDispatch [] =
NULL, /* 0x0C, Reserved */
NULL, /* 0x0D, Reserved */
AcpiDmVendorSmallDescriptor, /* 0x0E, ACPI_RESOURCE_NAME_SMALL_VENDOR */
- NULL /* 0x0F, ACPI_RESOURCE_NAME_END_TAG (not used) */
-};
+ NULL, /* 0x0F, ACPI_RESOURCE_NAME_END_TAG (not used) */
+
+ /* Large descriptors */
-static ACPI_RESOURCE_HANDLER AcpiGbl_LgResourceDispatch [] =
-{
NULL, /* 0x00, Reserved */
AcpiDmMemory24Descriptor, /* 0x01, ACPI_RESOURCE_NAME_MEMORY_24 */
AcpiDmGenericRegisterDescriptor,/* 0x02, ACPI_RESOURCE_NAME_GENERIC_REGISTER */
@@ -170,11 +171,39 @@ static ACPI_RESOURCE_HANDLER AcpiGbl_LgResourceDispatch [] =
};
-/* Local prototypes */
+/* Only used for single-threaded applications */
+/* TBD: remove when name is passed as parameter to the dump functions */
+
+static UINT32 ResourceName;
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDescriptorName
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Emit a name for the descriptor if one is present (indicated
+ * by the name being changed from the default name.) A name is only
+ * emitted if a reference to the descriptor has been made somewhere
+ * in the original ASL code.
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDescriptorName (
+ void)
+{
+
+ if (ResourceName == ACPI_DEFAULT_RESNAME)
+ {
+ return;
+ }
-static ACPI_RESOURCE_HANDLER
-AcpiDmGetResourceHandler (
- UINT8 ResourceType);
+ AcpiOsPrintf ("%4.4s", (char *) &ResourceName);
+}
/*******************************************************************************
@@ -219,53 +248,7 @@ AcpiDmDumpInteger64 (
UINT64 Value,
char *Name)
{
- AcpiOsPrintf ("0x%8.8X%8.8X, // %s\n",
- ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (Value)), Name);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDmGetResourceHandler
- *
- * PARAMETERS: ResourceType - Byte 0 of a resource descriptor
- *
- * RETURN: Pointer to the resource conversion handler. NULL is returned
- * if the ResourceType is invalid.
- *
- * DESCRIPTION: Return the handler associated with this resource type.
- * May also be used to validate a ResourceType.
- *
- ******************************************************************************/
-
-static ACPI_RESOURCE_HANDLER
-AcpiDmGetResourceHandler (
- UINT8 ResourceType)
-{
- ACPI_FUNCTION_ENTRY ();
-
-
- /* Determine if this is a small or large resource */
-
- if (ResourceType & ACPI_RESOURCE_NAME_LARGE)
- {
- /* Large Resource Type -- bits 6:0 contain the name */
-
- if (ResourceType > ACPI_RESOURCE_NAME_LARGE_MAX)
- {
- return (NULL);
- }
-
- return (AcpiGbl_LgResourceDispatch [
- (ResourceType & ACPI_RESOURCE_NAME_LARGE_MASK)]);
- }
- else
- {
- /* Small Resource Type -- bits 6:3 contain the name */
-
- return (AcpiGbl_SmResourceDispatch [
- ((ResourceType & ACPI_RESOURCE_NAME_SMALL_MASK) >> 3)]);
- }
+ AcpiOsPrintf ("0x%8.8X%8.8X, // %s\n", ACPI_FORMAT_UINT64 (Value), Name);
}
@@ -337,32 +320,51 @@ AcpiDmBitList (
void
AcpiDmResourceTemplate (
ACPI_OP_WALK_INFO *Info,
+ ACPI_PARSE_OBJECT *Op,
UINT8 *ByteData,
UINT32 ByteCount)
{
+ ACPI_STATUS Status;
ACPI_NATIVE_UINT CurrentByteOffset;
UINT8 ResourceType;
UINT32 ResourceLength;
- void *DescriptorBody;
+ void *Aml;
UINT32 Level;
BOOLEAN DependentFns = FALSE;
- ACPI_RESOURCE_HANDLER Handler;
+ UINT8 ResourceIndex;
+ ACPI_NAMESPACE_NODE *Node;
Level = Info->Level;
+ ResourceName = ACPI_DEFAULT_RESNAME;
+ Node = Op->Common.Node;
+ if (Node)
+ {
+ Node = Node->Child;
+ }
for (CurrentByteOffset = 0; CurrentByteOffset < ByteCount; )
{
+ Aml = &ByteData[CurrentByteOffset];
+
/* Get the descriptor type and length */
- DescriptorBody = &ByteData[CurrentByteOffset];
+ ResourceType = AcpiUtGetResourceType (Aml);
+ ResourceLength = AcpiUtGetResourceLength (Aml);
+
+ /* Validate the Resource Type and Resource Length */
- ResourceType = AcpiUtGetResourceType (DescriptorBody);
- ResourceLength = AcpiUtGetResourceLength (DescriptorBody);
+ Status = AcpiUtValidateResource (Aml, &ResourceIndex);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("/*** Could not validate Resource, type (%X) %s***/\n",
+ ResourceType, AcpiFormatException (Status));
+ return;
+ }
/* Point to next descriptor */
- CurrentByteOffset += AcpiUtGetDescriptorLength (DescriptorBody);
+ CurrentByteOffset += AcpiUtGetDescriptorLength (Aml);
/* Descriptor pre-processing */
@@ -401,7 +403,7 @@ AcpiDmResourceTemplate (
/* Go ahead and insert EndDependentFn() */
- AcpiDmEndDependentDescriptor (DescriptorBody, ResourceLength, Level);
+ AcpiDmEndDependentDescriptor (Aml, ResourceLength, Level);
AcpiDmIndent (Level);
AcpiOsPrintf (
@@ -413,25 +415,16 @@ AcpiDmResourceTemplate (
break;
}
- /* Get the handler associated with this Descriptor Type */
+ /* Disassemble the resource structure */
- Handler = AcpiDmGetResourceHandler (ResourceType);
- if (!Handler)
+ if (Node)
{
- /*
- * Invalid Descriptor Type.
- *
- * Since the entire resource buffer has been previously walked and
- * validated, this is a very serious error indicating that someone
- * overwrote the buffer.
- */
- AcpiOsPrintf ("/*** Unknown Resource type (%X) ***/\n", ResourceType);
- return;
+ ResourceName = Node->Name.Integer;
+ Node = Node->Peer;
}
- /* Disassemble the resource structure */
-
- Handler (DescriptorBody, ResourceLength, Level);
+ AcpiGbl_DumpResourceDispatch [ResourceIndex] (
+ Aml, ResourceLength, Level);
/* Descriptor post-processing */
@@ -450,101 +443,67 @@ AcpiDmResourceTemplate (
*
* PARAMETERS: Op - Buffer Op to be examined
*
- * RETURN: TRUE if this Buffer Op contains a valid resource
- * descriptor.
+ * RETURN: Status. AE_OK if valid template
*
* DESCRIPTION: Walk a byte list to determine if it consists of a valid set
* of resource descriptors. Nothing is output.
*
******************************************************************************/
-BOOLEAN
+ACPI_STATUS
AcpiDmIsResourceTemplate (
ACPI_PARSE_OBJECT *Op)
{
- UINT8 *ByteData;
- UINT32 ByteCount;
+ ACPI_STATUS Status;
ACPI_PARSE_OBJECT *NextOp;
- ACPI_NATIVE_UINT CurrentByteOffset;
- UINT8 ResourceType;
- void *DescriptorBody;
+ UINT8 *Aml;
+ UINT8 *EndAml;
+ ACPI_SIZE Length;
/* This op must be a buffer */
if (Op->Common.AmlOpcode != AML_BUFFER_OP)
{
- return FALSE;
+ return (AE_TYPE);
}
- /* Get to the ByteData list */
+ /* Get the ByteData list and length */
NextOp = Op->Common.Value.Arg;
NextOp = NextOp->Common.Next;
if (!NextOp)
{
- return (FALSE);
+ return (AE_TYPE);
}
- /* Extract the data pointer and data length */
+ Aml = NextOp->Named.Data;
+ Length = (ACPI_SIZE) NextOp->Common.Value.Integer;
- ByteCount = (UINT32) NextOp->Common.Value.Integer;
- ByteData = NextOp->Named.Data;
+ /* Walk the byte list, abort on any invalid descriptor type or length */
- /*
- * The absolute minimum resource template is an END_TAG (2 bytes),
- * and the list must be terminated by a valid 2-byte END_TAG
- */
- if ((ByteCount < 2) ||
- (ByteData[ByteCount - 2] != (ACPI_RESOURCE_NAME_END_TAG | 1)))
+ Status = AcpiUtWalkAmlResources (Aml, Length, NULL, &EndAml);
+ if (ACPI_FAILURE (Status))
{
- return (FALSE);
+ return (AE_TYPE);
}
- /* Walk the byte list, abort on any invalid descriptor ID or length */
-
- for (CurrentByteOffset = 0; CurrentByteOffset < ByteCount;)
+ /*
+ * For the resource template to be valid, one EndTag must appear
+ * at the very end of the ByteList, not before. (For proper disassembly
+ * of a ResourceTemplate, the buffer must not have any extra data after
+ * the EndTag.)
+ */
+ if ((Aml + Length - sizeof (AML_RESOURCE_END_TAG)) != EndAml)
{
- /* Get the descriptor type and length */
-
- DescriptorBody = &ByteData[CurrentByteOffset];
- ResourceType = AcpiUtGetResourceType (DescriptorBody);
-
- /* Point to next descriptor */
-
- CurrentByteOffset += AcpiUtGetDescriptorLength (DescriptorBody);
-
- /* END_TAG terminates the descriptor list */
-
- if (ResourceType == ACPI_RESOURCE_NAME_END_TAG)
- {
- /*
- * For the resource template to be valid, one END_TAG must appear
- * at the very end of the ByteList, not before
- */
- if (CurrentByteOffset != ByteCount)
- {
- return (FALSE);
- }
-
- /*
- * All resource descriptor types and lengths are valid,
- * this list appears to be a valid resource template
- */
- return (TRUE);
- }
-
- /* Validate the resource name (must be after check for END_TAG) */
-
- if (!AcpiDmGetResourceHandler (ResourceType))
- {
- return (FALSE);
- }
+ return (AE_AML_NO_RESOURCE_END_TAG);
}
- /* Did not find an END_TAG, something seriously wrong */
-
- return (FALSE);
+ /*
+ * All resource descriptors are valid, therefore this list appears
+ * to be a valid resource template
+ */
+ return (AE_OK);
}
#endif
diff --git a/sys/contrib/dev/acpica/dmresrcl.c b/sys/contrib/dev/acpica/dmresrcl.c
index ca8b780..1cc375d 100644
--- a/sys/contrib/dev/acpica/dmresrcl.c
+++ b/sys/contrib/dev/acpica/dmresrcl.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dmresrcl.c - "Large" Resource Descriptor disassembly
- * $Revision: 1.29 $
+ * $Revision: 1.37 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -129,19 +129,19 @@
static char *AcpiDmAddressNames[] =
{
- "Address Space Granularity",
- "Address Range Minimum",
- "Address Range Maximum",
- "Address Translation Offset",
- "Address Length"
+ "Granularity",
+ "Range Minimum",
+ "Range Maximum",
+ "Translation Offset",
+ "Length"
};
static char *AcpiDmMemoryNames[] =
{
- "Address Range Minimum",
- "Address Range Maximum",
- "Address Alignment",
- "Address Length"
+ "Range Minimum",
+ "Range Maximum",
+ "Alignment",
+ "Length"
};
@@ -225,11 +225,13 @@ AcpiDmMemoryFields (
switch (Type)
{
case 16:
- AcpiDmDumpInteger16 (((UINT16 *) Source)[i], AcpiDmMemoryNames[i]);
+ AcpiDmDumpInteger16 (ACPI_CAST_PTR (UINT16, Source)[i],
+ AcpiDmMemoryNames[i]);
break;
case 32:
- AcpiDmDumpInteger32 (((UINT32 *) Source)[i], AcpiDmMemoryNames[i]);
+ AcpiDmDumpInteger32 (ACPI_CAST_PTR (UINT32, Source)[i],
+ AcpiDmMemoryNames[i]);
break;
default:
@@ -241,7 +243,7 @@ AcpiDmMemoryFields (
/*******************************************************************************
*
- * FUNCTION: AcpiDm
+ * FUNCTION: AcpiDmAddressFields
*
* PARAMETERS: Source - Pointer to the contiguous data fields
* Type - 16, 32, or 64 (bit)
@@ -271,15 +273,18 @@ AcpiDmAddressFields (
switch (Type)
{
case 16:
- AcpiDmDumpInteger16 (((UINT16 *) Source)[i], AcpiDmAddressNames[i]);
+ AcpiDmDumpInteger16 (ACPI_CAST_PTR (UINT16, Source)[i],
+ AcpiDmAddressNames[i]);
break;
case 32:
- AcpiDmDumpInteger32 (((UINT32 *) Source)[i], AcpiDmAddressNames[i]);
+ AcpiDmDumpInteger32 (ACPI_CAST_PTR (UINT32, Source)[i],
+ AcpiDmAddressNames[i]);
break;
case 64:
- AcpiDmDumpInteger64 (((UINT64 *) Source)[i], AcpiDmAddressNames[i]);
+ AcpiDmDumpInteger64 (ACPI_CAST_PTR (UINT64, Source)[i],
+ AcpiDmAddressNames[i]);
break;
default:
@@ -385,7 +390,7 @@ AcpiDmAddressCommon (
/* This is either a Memory, IO, or BusNumber descriptor (0,1,2) */
- AcpiOsPrintf ("%s (", AcpiGbl_WordDecode [ResourceType]);
+ AcpiOsPrintf ("%s (", AcpiGbl_WordDecode [ResourceType & 0x3]);
/* Decode the general and type-specific flags */
@@ -398,7 +403,7 @@ AcpiDmAddressCommon (
AcpiDmIoFlags (Flags);
if (ResourceType == ACPI_IO_RANGE)
{
- AcpiOsPrintf (" %s,", AcpiGbl_RNGDecode [SpecificFlags & 0x3]);
+ AcpiOsPrintf (" %s,", AcpiGbl_RngDecode [SpecificFlags & 0x3]);
}
}
}
@@ -451,7 +456,7 @@ AcpiDmSpaceFlags (
AcpiOsPrintf ("%s, %s, %s, %s,",
AcpiGbl_ConsumeDecode [(Flags & 1)],
- AcpiGbl_DECDecode [(Flags & 0x2) >> 1],
+ AcpiGbl_DecDecode [(Flags & 0x2) >> 1],
AcpiGbl_MinDecode [(Flags & 0x4) >> 2],
AcpiGbl_MaxDecode [(Flags & 0x8) >> 3]);
}
@@ -477,7 +482,7 @@ AcpiDmIoFlags (
AcpiGbl_ConsumeDecode [(Flags & 1)],
AcpiGbl_MinDecode [(Flags & 0x4) >> 2],
AcpiGbl_MaxDecode [(Flags & 0x8) >> 3],
- AcpiGbl_DECDecode [(Flags & 0x2) >> 1]);
+ AcpiGbl_DecDecode [(Flags & 0x2) >> 1]);
}
@@ -499,14 +504,14 @@ AcpiDmIoFlags2 (
{
AcpiOsPrintf (", %s",
- AcpiGbl_TTPDecode [(SpecificFlags & 0x10) >> 4]);
+ AcpiGbl_TtpDecode [(SpecificFlags & 0x10) >> 4]);
/* TRS is only used if TTP is TypeTranslation */
if (SpecificFlags & 0x10)
{
AcpiOsPrintf (", %s",
- AcpiGbl_TRSDecode [(SpecificFlags & 0x20) >> 5]);
+ AcpiGbl_TrsDecode [(SpecificFlags & 0x20) >> 5]);
}
}
@@ -532,11 +537,11 @@ AcpiDmMemoryFlags (
AcpiOsPrintf ("%s, %s, %s, %s, %s, %s,",
AcpiGbl_ConsumeDecode [(Flags & 1)],
- AcpiGbl_DECDecode [(Flags & 0x2) >> 1],
+ AcpiGbl_DecDecode [(Flags & 0x2) >> 1],
AcpiGbl_MinDecode [(Flags & 0x4) >> 2],
AcpiGbl_MaxDecode [(Flags & 0x8) >> 3],
- AcpiGbl_MEMDecode [(SpecificFlags & 0x6) >> 1],
- AcpiGbl_RWDecode [(SpecificFlags & 0x1)]);
+ AcpiGbl_MemDecode [(SpecificFlags & 0x6) >> 1],
+ AcpiGbl_RwDecode [(SpecificFlags & 0x1)]);
}
@@ -558,8 +563,8 @@ AcpiDmMemoryFlags2 (
{
AcpiOsPrintf (", %s, %s",
- AcpiGbl_MTPDecode [(SpecificFlags & 0x18) >> 3],
- AcpiGbl_TTPDecode [(SpecificFlags & 0x20) >> 5]);
+ AcpiGbl_MtpDecode [(SpecificFlags & 0x18) >> 3],
+ AcpiGbl_TtpDecode [(SpecificFlags & 0x20) >> 5]);
}
@@ -595,13 +600,13 @@ AcpiDmResourceSource (
{
/* The two optional fields are not used */
- AcpiOsPrintf (",,");
+ AcpiOsPrintf (",, ");
return;
}
/* Get a pointer to the ResourceSource */
- AmlResourceSource = ((UINT8 *) Resource) + MinimumTotalLength;
+ AmlResourceSource = ACPI_ADD_PTR (UINT8, Resource, MinimumTotalLength);
/*
* Always emit the ResourceSourceIndex (Byte)
@@ -623,7 +628,7 @@ AcpiDmResourceSource (
AcpiUtPrintString ((char *) &AmlResourceSource[1], ACPI_UINT8_MAX);
}
- AcpiOsPrintf (",");
+ AcpiOsPrintf (", ");
}
@@ -661,6 +666,10 @@ AcpiDmWordDescriptor (
AcpiDmIndent (Level + 1);
AcpiDmResourceSource (Resource, sizeof (AML_RESOURCE_ADDRESS16), Length);
+ /* Insert a descriptor name */
+
+ AcpiDmDescriptorName ();
+
/* Type-specific flags */
AcpiDmAddressFlags (Resource);
@@ -702,6 +711,10 @@ AcpiDmDwordDescriptor (
AcpiDmIndent (Level + 1);
AcpiDmResourceSource (Resource, sizeof (AML_RESOURCE_ADDRESS32), Length);
+ /* Insert a descriptor name */
+
+ AcpiDmDescriptorName ();
+
/* Type-specific flags */
AcpiDmAddressFlags (Resource);
@@ -743,6 +756,10 @@ AcpiDmQwordDescriptor (
AcpiDmIndent (Level + 1);
AcpiDmResourceSource (Resource, sizeof (AML_RESOURCE_ADDRESS64), Length);
+ /* Insert a descriptor name */
+
+ AcpiDmDescriptorName ();
+
/* Type-specific flags */
AcpiDmAddressFlags (Resource);
@@ -785,9 +802,13 @@ AcpiDmExtendedDescriptor (
AcpiDmDumpInteger64 (Resource->ExtAddress64.TypeSpecific,
"Type-Specific Attributes");
- /* Type-specific flags */
+ /* Insert a descriptor name */
AcpiDmIndent (Level + 1);
+ AcpiDmDescriptorName ();
+
+ /* Type-specific flags */
+
AcpiDmAddressFlags (Resource);
AcpiOsPrintf (")\n");
}
@@ -818,13 +839,16 @@ AcpiDmMemory24Descriptor (
AcpiDmIndent (Level);
AcpiOsPrintf ("Memory24 (%s,\n",
- AcpiGbl_RWDecode [Resource->Memory24.Flags & 1]);
+ AcpiGbl_RwDecode [Resource->Memory24.Flags & 1]);
/* Dump the 4 contiguous WORD values */
AcpiDmMemoryFields (&Resource->Memory24.Minimum, 16, Level);
+ /* Insert a descriptor name */
+
AcpiDmIndent (Level + 1);
+ AcpiDmDescriptorName ();
AcpiOsPrintf (")\n");
}
@@ -854,13 +878,16 @@ AcpiDmMemory32Descriptor (
AcpiDmIndent (Level);
AcpiOsPrintf ("Memory32 (%s,\n",
- AcpiGbl_RWDecode [Resource->Memory32.Flags & 1]);
+ AcpiGbl_RwDecode [Resource->Memory32.Flags & 1]);
/* Dump the 4 contiguous DWORD values */
AcpiDmMemoryFields (&Resource->Memory32.Minimum, 32, Level);
+ /* Insert a descriptor name */
+
AcpiDmIndent (Level + 1);
+ AcpiDmDescriptorName ();
AcpiOsPrintf (")\n");
}
@@ -890,7 +917,7 @@ AcpiDmFixedMemory32Descriptor (
AcpiDmIndent (Level);
AcpiOsPrintf ("Memory32Fixed (%s,\n",
- AcpiGbl_RWDecode [Resource->FixedMemory32.Flags & 1]);
+ AcpiGbl_RwDecode [Resource->FixedMemory32.Flags & 1]);
AcpiDmIndent (Level + 1);
AcpiDmDumpInteger32 (Resource->FixedMemory32.Address, "Address Base");
@@ -898,7 +925,10 @@ AcpiDmFixedMemory32Descriptor (
AcpiDmIndent (Level + 1);
AcpiDmDumpInteger32 (Resource->FixedMemory32.AddressLength, "Address Length");
+ /* Insert a descriptor name */
+
AcpiDmIndent (Level + 1);
+ AcpiDmDescriptorName ();
AcpiOsPrintf (")\n");
}
@@ -930,24 +960,31 @@ AcpiDmGenericRegisterDescriptor (
AcpiOsPrintf ("\n");
AcpiDmIndent (Level + 1);
- AcpiDmDumpInteger8 (Resource->GenericReg.BitWidth, "Register Bit Width");
+ AcpiDmDumpInteger8 (Resource->GenericReg.BitWidth, "Bit Width");
AcpiDmIndent (Level + 1);
- AcpiDmDumpInteger8 (Resource->GenericReg.BitOffset, "Register Bit Offset");
+ AcpiDmDumpInteger8 (Resource->GenericReg.BitOffset, "Bit Offset");
AcpiDmIndent (Level + 1);
- AcpiDmDumpInteger64 (Resource->GenericReg.Address, "Register Address");
+ AcpiDmDumpInteger64 (Resource->GenericReg.Address, "Address");
/* Optional field for ACPI 3.0 */
+ AcpiDmIndent (Level + 1);
if (Resource->GenericReg.AccessSize)
{
- AcpiDmIndent (Level + 1);
- AcpiOsPrintf ("0x%2.2X // %s\n",
+ AcpiOsPrintf ("0x%2.2X, // %s\n",
Resource->GenericReg.AccessSize, "Access Size");
+ AcpiDmIndent (Level + 1);
+ }
+ else
+ {
+ AcpiOsPrintf (",");
}
- AcpiDmIndent (Level + 1);
+ /* DescriptorName was added for ACPI 3.0+ */
+
+ AcpiDmDescriptorName ();
AcpiOsPrintf (")\n");
}
@@ -978,9 +1015,9 @@ AcpiDmInterruptDescriptor (
AcpiDmIndent (Level);
AcpiOsPrintf ("Interrupt (%s, %s, %s, %s, ",
AcpiGbl_ConsumeDecode [(Resource->ExtendedIrq.Flags & 1)],
- AcpiGbl_HEDecode [(Resource->ExtendedIrq.Flags >> 1) & 1],
- AcpiGbl_LLDecode [(Resource->ExtendedIrq.Flags >> 2) & 1],
- AcpiGbl_SHRDecode [(Resource->ExtendedIrq.Flags >> 3) & 1]);
+ AcpiGbl_HeDecode [(Resource->ExtendedIrq.Flags >> 1) & 1],
+ AcpiGbl_LlDecode [(Resource->ExtendedIrq.Flags >> 2) & 1],
+ AcpiGbl_ShrDecode [(Resource->ExtendedIrq.Flags >> 3) & 1]);
/*
* The ResourceSource fields are optional and appear after the interrupt
@@ -992,9 +1029,13 @@ AcpiDmInterruptDescriptor (
(Resource->ExtendedIrq.InterruptCount - 1) * sizeof (UINT32),
Resource->ExtendedIrq.ResourceLength);
- /* Dump the interrupt list */
+ /* Insert a descriptor name */
+ AcpiDmDescriptorName ();
AcpiOsPrintf (")\n");
+
+ /* Dump the interrupt list */
+
AcpiDmIndent (Level);
AcpiOsPrintf ("{\n");
for (i = 0; i < Resource->ExtendedIrq.InterruptCount; i++)
@@ -1032,10 +1073,15 @@ AcpiDmVendorCommon (
UINT32 Level)
{
- /* Dump descriptor name */
+ /* Dump macro name */
AcpiDmIndent (Level);
- AcpiOsPrintf ("Vendor%s // Length = 0x%.2X\n", Name, Length);
+ AcpiOsPrintf ("Vendor%s (", Name);
+
+ /* Insert a descriptor name */
+
+ AcpiDmDescriptorName ();
+ AcpiOsPrintf (") // Length = 0x%.2X\n", Length);
/* Dump the vendor bytes */
@@ -1070,8 +1116,8 @@ AcpiDmVendorLargeDescriptor (
UINT32 Level)
{
- AcpiDmVendorCommon ("Long () ",
- ((UINT8 *) Resource) + sizeof (AML_RESOURCE_LARGE_HEADER),
+ AcpiDmVendorCommon ("Long ",
+ ACPI_ADD_PTR (UINT8, Resource, sizeof (AML_RESOURCE_LARGE_HEADER)),
Length, Level);
}
diff --git a/sys/contrib/dev/acpica/dmresrcs.c b/sys/contrib/dev/acpica/dmresrcs.c
index 78b5826..b7df965 100644
--- a/sys/contrib/dev/acpica/dmresrcs.c
+++ b/sys/contrib/dev/acpica/dmresrcs.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dmresrcs.c - "Small" Resource Descriptor disassembly
- * $Revision: 1.10 $
+ * $Revision: 1.16 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -154,11 +154,15 @@ AcpiDmIrqDescriptor (
if (Length & 1)
{
- AcpiOsPrintf ("%s, %s, %s",
- AcpiGbl_HEDecode [Resource->Irq.Flags & 1],
- AcpiGbl_LLDecode [(Resource->Irq.Flags >> 3) & 1],
- AcpiGbl_SHRDecode [(Resource->Irq.Flags >> 4) & 1]);
+ AcpiOsPrintf ("%s, %s, %s, ",
+ AcpiGbl_HeDecode [Resource->Irq.Flags & 1],
+ AcpiGbl_LlDecode [(Resource->Irq.Flags >> 3) & 1],
+ AcpiGbl_ShrDecode [(Resource->Irq.Flags >> 4) & 1]);
}
+
+ /* Insert a descriptor name */
+
+ AcpiDmDescriptorName ();
AcpiOsPrintf (")\n");
AcpiDmIndent (Level + 1);
@@ -188,10 +192,15 @@ AcpiDmDmaDescriptor (
{
AcpiDmIndent (Level);
- AcpiOsPrintf ("DMA (%s, %s, %s)\n",
- AcpiGbl_TYPDecode [(Resource->Dma.Flags >> 5) & 3],
- AcpiGbl_BMDecode [(Resource->Dma.Flags >> 2) & 1],
- AcpiGbl_SIZDecode [(Resource->Dma.Flags >> 0) & 3]);
+ AcpiOsPrintf ("DMA (%s, %s, %s, ",
+ AcpiGbl_TypDecode [(Resource->Dma.Flags >> 5) & 3],
+ AcpiGbl_BmDecode [(Resource->Dma.Flags >> 2) & 1],
+ AcpiGbl_SizDecode [(Resource->Dma.Flags >> 0) & 3]);
+
+ /* Insert a descriptor name */
+
+ AcpiDmDescriptorName ();
+ AcpiOsPrintf (")\n");
AcpiDmIndent (Level + 1);
AcpiDmBitList (Resource->Dma.DmaChannelMask);
@@ -224,18 +233,21 @@ AcpiDmIoDescriptor (
AcpiGbl_IoDecode [(Resource->Io.Flags & 1)]);
AcpiDmIndent (Level + 1);
- AcpiDmDumpInteger16 (Resource->Io.Minimum, "Address Range Minimum");
+ AcpiDmDumpInteger16 (Resource->Io.Minimum, "Range Minimum");
AcpiDmIndent (Level + 1);
- AcpiDmDumpInteger16 (Resource->Io.Maximum, "Address Range Maximum");
+ AcpiDmDumpInteger16 (Resource->Io.Maximum, "Range Maximum");
AcpiDmIndent (Level + 1);
- AcpiDmDumpInteger8 (Resource->Io.Alignment, "Address Alignment");
+ AcpiDmDumpInteger8 (Resource->Io.Alignment, "Alignment");
AcpiDmIndent (Level + 1);
- AcpiDmDumpInteger8 (Resource->Io.AddressLength, "Address Length");
+ AcpiDmDumpInteger8 (Resource->Io.AddressLength, "Length");
+
+ /* Insert a descriptor name */
AcpiDmIndent (Level + 1);
+ AcpiDmDescriptorName ();
AcpiOsPrintf (")\n");
}
@@ -265,12 +277,15 @@ AcpiDmFixedIoDescriptor (
AcpiOsPrintf ("FixedIO (\n");
AcpiDmIndent (Level + 1);
- AcpiDmDumpInteger16 (Resource->FixedIo.Address, "Address Base");
+ AcpiDmDumpInteger16 (Resource->FixedIo.Address, "Address");
AcpiDmIndent (Level + 1);
- AcpiDmDumpInteger8 (Resource->FixedIo.AddressLength, "Address Length");
+ AcpiDmDumpInteger8 (Resource->FixedIo.AddressLength, "Length");
+
+ /* Insert a descriptor name */
AcpiDmIndent (Level + 1);
+ AcpiDmDescriptorName ();
AcpiOsPrintf (")\n");
}
@@ -363,8 +378,8 @@ AcpiDmVendorSmallDescriptor (
UINT32 Level)
{
- AcpiDmVendorCommon ("Short ()",
- ((UINT8 *) Resource) + sizeof (AML_RESOURCE_SMALL_HEADER),
+ AcpiDmVendorCommon ("Short",
+ ACPI_ADD_PTR (UINT8, Resource, sizeof (AML_RESOURCE_SMALL_HEADER)),
Length, Level);
}
diff --git a/sys/contrib/dev/acpica/dmutils.c b/sys/contrib/dev/acpica/dmutils.c
index 002f835..e6340a2 100644
--- a/sys/contrib/dev/acpica/dmutils.c
+++ b/sys/contrib/dev/acpica/dmutils.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dmutils - AML disassembler utilities
- * $Revision: 1.19 $
+ * $Revision: 1.25 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -134,15 +134,16 @@ ACPI_EXTERNAL_LIST *AcpiGbl_ExternalList = NULL;
/* Data used in keeping track of fields */
#if 0
-const char *AcpiGbl_FENames[ACPI_NUM_FIELD_NAMES] =
+const char *AcpiGbl_FENames[] =
{
"skip",
"?access?"
}; /* FE = Field Element */
#endif
+/* Operators for Match() */
-const char *AcpiGbl_MatchOps[ACPI_NUM_MATCH_OPS] =
+const char *AcpiGbl_MatchOps[] =
{
"MTR",
"MEQ",
@@ -152,10 +153,9 @@ const char *AcpiGbl_MatchOps[ACPI_NUM_MATCH_OPS] =
"MGT"
};
-
/* Access type decoding */
-const char *AcpiGbl_AccessTypes[ACPI_NUM_ACCESS_TYPES] =
+const char *AcpiGbl_AccessTypes[] =
{
"AnyAcc",
"ByteAcc",
@@ -163,12 +163,13 @@ const char *AcpiGbl_AccessTypes[ACPI_NUM_ACCESS_TYPES] =
"DWordAcc",
"QWordAcc",
"BufferAcc",
+ "InvalidAccType",
+ "InvalidAccType"
};
-
/* Lock rule decoding */
-const char *AcpiGbl_LockRule[ACPI_NUM_LOCK_RULES] =
+const char *AcpiGbl_LockRule[] =
{
"NoLock",
"Lock"
@@ -176,152 +177,30 @@ const char *AcpiGbl_LockRule[ACPI_NUM_LOCK_RULES] =
/* Update rule decoding */
-const char *AcpiGbl_UpdateRules[ACPI_NUM_UPDATE_RULES] =
+const char *AcpiGbl_UpdateRules[] =
{
"Preserve",
"WriteAsOnes",
- "WriteAsZeros"
+ "WriteAsZeros",
+ "InvalidUpdateRule"
};
-/*
- * Strings used to decode resource descriptors
- */
-const char *AcpiGbl_IoDecode[2] =
-{
- "Decode10",
- "Decode16"
-};
+/* Strings used to decode resource descriptors */
-const char *AcpiGbl_WordDecode[4] =
+const char *AcpiGbl_WordDecode[] =
{
"Memory",
"IO",
"BusNumber",
- "Unknown-resource-type"
+ "UnknownResourceType"
};
-const char *AcpiGbl_ConsumeDecode[2] =
-{
- "ResourceProducer",
- "ResourceConsumer"
-};
-
-const char *AcpiGbl_MinDecode[2] =
-{
- "MinNotFixed",
- "MinFixed"
-};
-
-const char *AcpiGbl_MaxDecode[2] =
-{
- "MaxNotFixed",
- "MaxFixed"
-};
-
-const char *AcpiGbl_DECDecode[2] =
-{
- "PosDecode",
- "SubDecode"
-};
-
-const char *AcpiGbl_IrqDecode[2] =
+const char *AcpiGbl_IrqDecode[] =
{
"IRQNoFlags",
"IRQ"
};
-const char *AcpiGbl_HEDecode[2] =
-{
- "Level",
- "Edge"
-};
-
-const char *AcpiGbl_LLDecode[2] =
-{
- "ActiveHigh",
- "ActiveLow"
-};
-
-const char *AcpiGbl_SHRDecode[2] =
-{
- "Exclusive",
- "Shared"
-};
-
-const char *AcpiGbl_TYPDecode[4] =
-{
- "Compatibility",
- "TypeA",
- "TypeB",
- "TypeF"
-};
-
-const char *AcpiGbl_BMDecode[2] =
-{
- "NotBusMaster",
- "BusMaster"
-};
-
-const char *AcpiGbl_SIZDecode[4] =
-{
- "Transfer8",
- "Transfer8_16",
- "Transfer16",
- "InvalidSize"
-};
-
-/* Type Specific Flags */
-
-const char *AcpiGbl_TTPDecode[2] =
-{
- "TypeStatic",
- "TypeTranslation"
-};
-
-const char *AcpiGbl_MTPDecode[4] =
-{
- "AddressRangeMemory",
- "AddressRangeReserved",
- "AddressRangeACPI",
- "AddressRangeNVS"
-};
-
-const char *AcpiGbl_MEMDecode[4] =
-{
- "NonCacheable",
- "Cacheable",
- "WriteCombining",
- "Prefetchable"
-};
-
-const char *AcpiGbl_RWDecode[2] =
-{
- "ReadOnly",
- "ReadWrite"
-};
-
-const char *AcpiGbl_TRSDecode[2] =
-{
- "DenseTranslation",
- "SparseTranslation"
-};
-
-const char *AcpiGbl_RNGDecode[4] =
-{
- "InvalidRanges",
- "NonISAOnlyRanges",
- "ISAOnlyRanges",
- "EntireRange"
-};
-
-const char *AcpiGbl_ConfigDecode[4] =
-{
- "0 - Good Configuration",
- "1 - Acceptable Configuration",
- "2 - Suboptimal Configuration",
- "3 - ***Invalid Configuration***",
-};
-
#ifdef ACPI_ASL_COMPILER
/*******************************************************************************
@@ -340,10 +219,14 @@ const char *AcpiGbl_ConfigDecode[4] =
void
AcpiDmAddToExternalList (
- char *Path)
+ char *Path,
+ UINT8 Type,
+ UINT32 Value)
{
char *ExternalPath;
ACPI_EXTERNAL_LIST *NewExternal;
+ ACPI_EXTERNAL_LIST *NextExternal;
+ ACPI_EXTERNAL_LIST *PrevExternal = NULL;
ACPI_STATUS Status;
@@ -356,24 +239,84 @@ AcpiDmAddToExternalList (
Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, Path,
NULL, &ExternalPath);
- if (ACPI_SUCCESS (Status))
+ if (ACPI_FAILURE (Status))
+ {
+ return;
+ }
+
+ /* Ensure that we don't have duplicate externals */
+
+ NextExternal = AcpiGbl_ExternalList;
+ while (NextExternal)
{
- /* Allocate and init a new External() descriptor */
+ /* Allow upgrade of type from ANY */
+
+ if (!ACPI_STRCMP (ExternalPath, NextExternal->Path))
+ {
+ /* Duplicate method, check that the Value (ArgCount) is the same */
- NewExternal = ACPI_MEM_CALLOCATE (sizeof (ACPI_EXTERNAL_LIST));
- NewExternal->Path = ExternalPath;
+ if ((NextExternal->Type == ACPI_TYPE_METHOD) &&
+ (NextExternal->Value != Value))
+ {
+ ACPI_ERROR ((AE_INFO, "Argument count mismatch for method %s %d %d",
+ NextExternal->Path, NextExternal->Value, Value));
+ }
+ if (NextExternal->Type == ACPI_TYPE_ANY)
+ {
+ NextExternal->Type = Type;
+ NextExternal->Value = Value;
+ }
+ ACPI_FREE (ExternalPath);
+ return;
+ }
+ NextExternal = NextExternal->Next;
+ }
- /* Link the new descriptor into the global list */
+ /* Allocate and init a new External() descriptor */
- if (AcpiGbl_ExternalList)
+ NewExternal = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EXTERNAL_LIST));
+ NewExternal->InternalPath = Path;
+ NewExternal->Path = ExternalPath;
+ NewExternal->Type = Type;
+ NewExternal->Value = Value;
+ NewExternal->Length = (UINT16) ACPI_STRLEN (ExternalPath);
+
+ /* Link the new descriptor into the global list, ordered by string length */
+
+ NextExternal = AcpiGbl_ExternalList;
+ while (NextExternal)
+ {
+ if (NewExternal->Length <= NextExternal->Length)
{
- NewExternal->Next = AcpiGbl_ExternalList;
+ if (PrevExternal)
+ {
+ PrevExternal->Next = NewExternal;
+ }
+ else
+ {
+ AcpiGbl_ExternalList = NewExternal;
+ }
+
+ NewExternal->Next = NextExternal;
+ return;
}
+
+ PrevExternal = NextExternal;
+ NextExternal = NextExternal->Next;
+ }
+
+ if (PrevExternal)
+ {
+ PrevExternal->Next = NewExternal;
+ }
+ else
+ {
AcpiGbl_ExternalList = NewExternal;
}
}
#endif
+
/*******************************************************************************
*
* FUNCTION: AcpiDmDecodeAttribute
diff --git a/sys/contrib/dev/acpica/dmwalk.c b/sys/contrib/dev/acpica/dmwalk.c
index d6a1be7..12c74f4 100644
--- a/sys/contrib/dev/acpica/dmwalk.c
+++ b/sys/contrib/dev/acpica/dmwalk.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dmwalk - AML disassembly tree walk
- * $Revision: 1.24 $
+ * $Revision: 1.33 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -144,13 +144,6 @@ AcpiDmAscendingOp (
UINT32 Level,
void *Context);
-static void
-AcpiDmWalkParseTree (
- ACPI_PARSE_OBJECT *Op,
- ASL_WALK_CALLBACK DescendingCallback,
- ASL_WALK_CALLBACK AscendingCallback,
- void *Context);
-
static UINT32
AcpiDmBlockType (
ACPI_PARSE_OBJECT *Op);
@@ -186,7 +179,9 @@ AcpiDmDisassemble (
return;
}
+ Info.Flags = 0;
Info.Level = 0;
+ Info.Count = 0;
Info.WalkState = WalkState;
AcpiDmWalkParseTree (Op, AcpiDmDescendingOp, AcpiDmAscendingOp, &Info);
return;
@@ -208,7 +203,7 @@ AcpiDmDisassemble (
*
******************************************************************************/
-static void
+void
AcpiDmWalkParseTree (
ACPI_PARSE_OBJECT *Op,
ASL_WALK_CALLBACK DescendingCallback,
@@ -229,10 +224,13 @@ AcpiDmWalkParseTree (
{
if (NodePreviouslyVisited)
{
- Status = AscendingCallback (Op, Info->Level, Context);
- if (ACPI_FAILURE (Status))
+ if (AscendingCallback)
{
- return;
+ Status = AscendingCallback (Op, Info->Level, Context);
+ if (ACPI_FAILURE (Status))
+ {
+ return;
+ }
}
}
else
@@ -495,21 +493,47 @@ AcpiDmDescendingOp (
if (AcpiGbl_ExternalList)
{
- AcpiOsPrintf (
- " /*\n * These objects were referenced but not defined in this table\n */\n");
-
/*
* Walk the list of externals (unresolved references)
* found during parsing
*/
while (AcpiGbl_ExternalList)
{
- AcpiOsPrintf (" External (%s, DeviceObj)\n",
+ 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;
+ }
+
+ if (AcpiGbl_ExternalList->Type == ACPI_TYPE_METHOD)
+ {
+ AcpiOsPrintf (") // %d Arguments\n", AcpiGbl_ExternalList->Value);
+ }
+ else
+ {
+ AcpiOsPrintf (")\n");
+ }
+
NextExternal = AcpiGbl_ExternalList->Next;
- ACPI_MEM_FREE (AcpiGbl_ExternalList->Path);
- ACPI_MEM_FREE (AcpiGbl_ExternalList);
+ ACPI_FREE (AcpiGbl_ExternalList->Path);
+ ACPI_FREE (AcpiGbl_ExternalList);
AcpiGbl_ExternalList = NextExternal;
}
AcpiOsPrintf ("\n");
@@ -527,12 +551,33 @@ AcpiDmDescendingOp (
* indent a new line
*/
AcpiDmIndent (Level);
+ Info->LastLevel = Level;
+ Info->Count = 0;
+ }
+
+ /*
+ * This is an inexpensive mechanism to try and keep lines from getting
+ * too long. When the limit is hit, start a new line at the previous
+ * indent plus one. A better but more expensive mechanism would be to
+ * keep track of the current column.
+ */
+ Info->Count++;
+ if (Info->Count /*+Info->LastLevel*/ > 10)
+ {
+ Info->Count = 0;
+ AcpiOsPrintf ("\n");
+ AcpiDmIndent (Info->LastLevel + 1);
}
/* Print the opcode name */
AcpiDmDisassembleOneOp (NULL, Info, Op);
+ if (Op->Common.DisasmOpcode == ACPI_DASM_LNOT_PREFIX)
+ {
+ return (AE_OK);
+ }
+
if ((Op->Common.AmlOpcode == AML_NAME_OP) ||
(Op->Common.AmlOpcode == AML_RETURN_OP))
{
@@ -644,6 +689,7 @@ AcpiDmDescendingOp (
case AML_MUTEX_OP:
+ case AML_DATA_REGION_OP:
AcpiOsPrintf (", ");
return (AE_OK);
@@ -665,7 +711,7 @@ AcpiDmDescendingOp (
default:
- AcpiOsPrintf ("*** Unhandled named opcode\n");
+ AcpiOsPrintf ("*** Unhandled named opcode %X\n", Op->Common.AmlOpcode);
break;
}
}
@@ -689,23 +735,34 @@ AcpiDmDescendingOp (
{
case AML_BANK_FIELD_OP:
- /* Namestring */
+ /* Namestring - Bank Name */
NextOp = AcpiPsGetDepthNext (NULL, NextOp);
AcpiDmNamestring (NextOp->Common.Value.Name);
NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
AcpiOsPrintf (", ");
-
+ /*
+ * Bank Value. This is a TermArg in the middle of the parameter
+ * list, must handle it here.
+ *
+ * Disassemble the TermArg parse tree. ACPI_PARSEOP_PARAMLIST
+ * eliminates newline in the output.
+ */
NextOp = NextOp->Common.Next;
- AcpiDmDisassembleOneOp (NULL, Info, NextOp);
+
+ Info->Flags = ACPI_PARSEOP_PARAMLIST;
+ AcpiDmWalkParseTree (NextOp, AcpiDmDescendingOp, AcpiDmAscendingOp, Info);
+ Info->Flags = 0;
+ Info->Level = Level;
+
NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
AcpiOsPrintf (", ");
break;
case AML_INDEX_FIELD_OP:
- /* Namestring */
+ /* Namestring - Data Name */
NextOp = AcpiPsGetDepthNext (NULL, NextOp);
AcpiDmNamestring (NextOp->Common.Value.Name);
@@ -860,7 +917,10 @@ AcpiDmAscendingOp (
* This is a first-level element of a term list
* start a new line
*/
- AcpiOsPrintf ("\n");
+ if (!(Info->Flags & ACPI_PARSEOP_PARAMLIST))
+ {
+ AcpiOsPrintf ("\n");
+ }
}
}
break;
diff --git a/sys/contrib/dev/acpica/dsfield.c b/sys/contrib/dev/acpica/dsfield.c
index fd3745f..a13fe1d 100644
--- a/sys/contrib/dev/acpica/dsfield.c
+++ b/sys/contrib/dev/acpica/dsfield.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dsfield - Dispatcher field routines
- * $Revision: 1.78 $
+ * $Revision: 1.84 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -168,7 +168,7 @@ AcpiDsCreateBufferField (
UINT32 Flags;
- ACPI_FUNCTION_TRACE ("DsCreateBufferField");
+ ACPI_FUNCTION_TRACE (DsCreateBufferField);
/* Get the NameString argument */
@@ -219,12 +219,13 @@ AcpiDsCreateBufferField (
Flags, WalkState, &(Node));
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_NSERROR (Arg->Common.Value.String, Status);
+ ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status);
return_ACPI_STATUS (Status);
}
}
- /* We could put the returned object (Node) on the object stack for later,
+ /*
+ * 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
*/
@@ -308,7 +309,7 @@ AcpiDsGetFieldNames (
ACPI_INTEGER Position;
- ACPI_FUNCTION_TRACE_PTR ("DsGetFieldNames", Info);
+ ACPI_FUNCTION_TRACE_PTR (DsGetFieldNames, Info);
/* First field starts at bit zero */
@@ -334,8 +335,8 @@ AcpiDsGetFieldNames (
if (Position > ACPI_UINT32_MAX)
{
- ACPI_REPORT_ERROR ((
- "Bit offset within field too large (> 0xFFFFFFFF)\n"));
+ ACPI_ERROR ((AE_INFO,
+ "Bit offset within field too large (> 0xFFFFFFFF)"));
return_ACPI_STATUS (AE_SUPPORT);
}
@@ -372,7 +373,7 @@ AcpiDsGetFieldNames (
WalkState, &Info->FieldNode);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_NSERROR ((char *) &Arg->Named.Name, Status);
+ ACPI_ERROR_NAMESPACE ((char *) &Arg->Named.Name, Status);
if (Status != AE_ALREADY_EXISTS)
{
return_ACPI_STATUS (Status);
@@ -401,9 +402,9 @@ AcpiDsGetFieldNames (
if (Position > ACPI_UINT32_MAX)
{
- ACPI_REPORT_ERROR ((
- "Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n",
- (char *) &Info->FieldNode->Name));
+ ACPI_ERROR ((AE_INFO,
+ "Field [%4.4s] bit offset too large (> 0xFFFFFFFF)",
+ ACPI_CAST_PTR (char, &Info->FieldNode->Name)));
return_ACPI_STATUS (AE_SUPPORT);
}
@@ -413,8 +414,8 @@ AcpiDsGetFieldNames (
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Invalid opcode in field list: %X\n",
+ ACPI_ERROR ((AE_INFO,
+ "Invalid opcode in field list: %X",
Arg->Common.AmlOpcode));
return_ACPI_STATUS (AE_AML_BAD_OPCODE);
}
@@ -451,7 +452,7 @@ AcpiDsCreateField (
ACPI_CREATE_FIELD_INFO Info;
- ACPI_FUNCTION_TRACE_PTR ("DsCreateField", Op);
+ ACPI_FUNCTION_TRACE_PTR (DsCreateField, Op);
/* First arg is the name of the parent OpRegion (must already exist) */
@@ -464,7 +465,7 @@ AcpiDsCreateField (
ACPI_NS_SEARCH_PARENT, WalkState, &RegionNode);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_NSERROR (Arg->Common.Value.Name, Status);
+ ACPI_ERROR_NAMESPACE (Arg->Common.Value.Name, Status);
return_ACPI_STATUS (Status);
}
}
@@ -512,7 +513,7 @@ AcpiDsInitFieldObjects (
UINT8 Type = 0;
- ACPI_FUNCTION_TRACE_PTR ("DsInitFieldObjects", Op);
+ ACPI_FUNCTION_TRACE_PTR (DsInitFieldObjects, Op);
switch (WalkState->Opcode)
@@ -553,7 +554,7 @@ AcpiDsInitFieldObjects (
WalkState, &Node);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_NSERROR ((char *) &Arg->Named.Name, Status);
+ ACPI_ERROR_NAMESPACE ((char *) &Arg->Named.Name, Status);
if (Status != AE_ALREADY_EXISTS)
{
return_ACPI_STATUS (Status);
@@ -601,7 +602,7 @@ AcpiDsCreateBankField (
ACPI_CREATE_FIELD_INFO Info;
- ACPI_FUNCTION_TRACE_PTR ("DsCreateBankField", Op);
+ ACPI_FUNCTION_TRACE_PTR (DsCreateBankField, Op);
/* First arg is the name of the parent OpRegion (must already exist) */
@@ -614,7 +615,7 @@ AcpiDsCreateBankField (
ACPI_NS_SEARCH_PARENT, WalkState, &RegionNode);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_NSERROR (Arg->Common.Value.Name, Status);
+ ACPI_ERROR_NAMESPACE (Arg->Common.Value.Name, Status);
return_ACPI_STATUS (Status);
}
}
@@ -627,14 +628,39 @@ AcpiDsCreateBankField (
ACPI_NS_SEARCH_PARENT, WalkState, &Info.RegisterNode);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_NSERROR (Arg->Common.Value.String, Status);
+ ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status);
return_ACPI_STATUS (Status);
}
/* Third arg is the BankValue */
+ /* TBD: This arg is a TermArg, not a constant, and must be evaluated */
+
Arg = Arg->Common.Next;
- Info.BankValue = (UINT32) Arg->Common.Value.Integer;
+
+ /* 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 */
@@ -677,7 +703,7 @@ AcpiDsCreateIndexField (
ACPI_CREATE_FIELD_INFO Info;
- ACPI_FUNCTION_TRACE_PTR ("DsCreateIndexField", Op);
+ ACPI_FUNCTION_TRACE_PTR (DsCreateIndexField, Op);
/* First arg is the name of the Index register (must already exist) */
@@ -688,7 +714,7 @@ AcpiDsCreateIndexField (
ACPI_NS_SEARCH_PARENT, WalkState, &Info.RegisterNode);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_NSERROR (Arg->Common.Value.String, Status);
+ ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status);
return_ACPI_STATUS (Status);
}
@@ -700,7 +726,7 @@ AcpiDsCreateIndexField (
ACPI_NS_SEARCH_PARENT, WalkState, &Info.DataRegisterNode);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_NSERROR (Arg->Common.Value.String, Status);
+ ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status);
return_ACPI_STATUS (Status);
}
diff --git a/sys/contrib/dev/acpica/dsinit.c b/sys/contrib/dev/acpica/dsinit.c
index 8bcde17..32335e5 100644
--- a/sys/contrib/dev/acpica/dsinit.c
+++ b/sys/contrib/dev/acpica/dsinit.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dsinit - Object initialization namespace walk
- * $Revision: 1.17 $
+ * $Revision: 1.28 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -119,6 +119,7 @@
#include <contrib/dev/acpica/acpi.h>
#include <contrib/dev/acpica/acdispat.h>
#include <contrib/dev/acpica/acnamesp.h>
+#include <contrib/dev/acpica/actables.h>
#define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME ("dsinit")
@@ -166,14 +167,14 @@ AcpiDsInitOneObject (
ACPI_STATUS Status;
- ACPI_FUNCTION_NAME ("DsInitOneObject");
+ ACPI_FUNCTION_ENTRY ();
/*
* We are only interested in NS nodes owned by the table that
* was just loaded
*/
- if (Node->OwnerId != Info->TableDesc->OwnerId)
+ if (Node->OwnerId != Info->OwnerId)
{
return (AE_OK);
}
@@ -191,10 +192,9 @@ AcpiDsInitOneObject (
Status = AcpiDsInitializeRegion (ObjHandle);
if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Region %p [%4.4s] - Init failure, %s\n",
- ObjHandle, AcpiUtGetNodeName (ObjHandle),
- AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "During Region initialization %p [%4.4s]",
+ ObjHandle, AcpiUtGetNodeName (ObjHandle)));
}
Info->OpRegionCount++;
@@ -203,41 +203,6 @@ AcpiDsInitOneObject (
case ACPI_TYPE_METHOD:
- /*
- * Print a dot for each method unless we are going to print
- * the entire pathname
- */
- if (!(AcpiDbgLevel & ACPI_LV_INIT_NAMES))
- {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "."));
- }
-
- /*
- * Set the execution data width (32 or 64) based upon the
- * revision number of the parent ACPI table.
- * TBD: This is really for possible future support of integer width
- * on a per-table basis. Currently, we just use a global for the width.
- */
- if (Info->TableDesc->Pointer->Revision == 1)
- {
- Node->Flags |= ANOBJ_DATA_WIDTH_32;
- }
-
- /*
- * Always parse methods to detect errors, we will delete
- * the parse tree below
- */
- Status = AcpiDsParseMethod (ObjHandle);
- if (ACPI_FAILURE (Status))
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "\n+Method %p [%4.4s] - parse failure, %s\n",
- ObjHandle, AcpiUtGetNodeName (ObjHandle),
- AcpiFormatException (Status)));
-
- /* This parse failed, but we will continue parsing more methods */
- }
-
Info->MethodCount++;
break;
@@ -276,15 +241,23 @@ AcpiDsInitOneObject (
ACPI_STATUS
AcpiDsInitializeObjects (
- ACPI_TABLE_DESC *TableDesc,
+ ACPI_NATIVE_UINT TableIndex,
ACPI_NAMESPACE_NODE *StartNode)
{
ACPI_STATUS Status;
ACPI_INIT_WALK_INFO Info;
+ ACPI_TABLE_HEADER *Table;
+ ACPI_OWNER_ID OwnerId;
+
+ ACPI_FUNCTION_TRACE (DsInitializeObjects);
- ACPI_FUNCTION_TRACE ("DsInitializeObjects");
+ Status = AcpiTbGetOwnerId (TableIndex, &OwnerId);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"**** Starting initialization of namespace objects ****\n"));
@@ -294,7 +267,8 @@ AcpiDsInitializeObjects (
Info.OpRegionCount = 0;
Info.ObjectCount = 0;
Info.DeviceCount = 0;
- Info.TableDesc = TableDesc;
+ Info.TableIndex = TableIndex;
+ Info.OwnerId = OwnerId;
/* Walk entire namespace from the supplied root */
@@ -302,13 +276,18 @@ AcpiDsInitializeObjects (
AcpiDsInitOneObject, &Info, NULL);
if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "WalkNamespace failed, %s\n",
- AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status, "During WalkNamespace"));
+ }
+
+ Status = AcpiGetTableByIndex (TableIndex, &Table);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
"\nTable [%4.4s](id %4.4X) - %hd Objects with %hd Devices %hd Methods %hd Regions\n",
- TableDesc->Pointer->Signature, TableDesc->OwnerId, Info.ObjectCount,
+ Table->Signature, OwnerId, Info.ObjectCount,
Info.DeviceCount, Info.MethodCount, Info.OpRegionCount));
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
diff --git a/sys/contrib/dev/acpica/dsmethod.c b/sys/contrib/dev/acpica/dsmethod.c
index e66c828..514f3a1 100644
--- a/sys/contrib/dev/acpica/dsmethod.c
+++ b/sys/contrib/dev/acpica/dsmethod.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dsmethod - Parser/Interpreter interface - control method parsing
- * $Revision: 1.110 $
+ * $Revision: 1.136 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -122,149 +122,125 @@
#include <contrib/dev/acpica/acdispat.h>
#include <contrib/dev/acpica/acinterp.h>
#include <contrib/dev/acpica/acnamesp.h>
+#include <contrib/dev/acpica/acdisasm.h>
#define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME ("dsmethod")
+/* Local prototypes */
+
+static ACPI_STATUS
+AcpiDsCreateMethodMutex (
+ ACPI_OPERAND_OBJECT *MethodDesc);
+
/*******************************************************************************
*
- * FUNCTION: AcpiDsParseMethod
+ * FUNCTION: AcpiDsMethodError
*
- * PARAMETERS: Node - Method node
+ * PARAMETERS: Status - Execution status
+ * WalkState - Current state
*
* RETURN: Status
*
- * DESCRIPTION: Parse the AML that is associated with the method.
+ * DESCRIPTION: Called on method error. Invoke the global exception handler if
+ * present, dump the method data if the disassembler is configured
*
- * MUTEX: Assumes parser is locked
+ * Note: Allows the exception handler to change the status code
*
******************************************************************************/
ACPI_STATUS
-AcpiDsParseMethod (
- ACPI_NAMESPACE_NODE *Node)
+AcpiDsMethodError (
+ ACPI_STATUS Status,
+ ACPI_WALK_STATE *WalkState)
{
- ACPI_STATUS Status;
- ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_PARSE_OBJECT *Op;
- ACPI_WALK_STATE *WalkState;
-
+ ACPI_FUNCTION_ENTRY ();
- ACPI_FUNCTION_TRACE_PTR ("DsParseMethod", Node);
+ /* Ignore AE_OK and control exception codes */
- /* Parameter Validation */
-
- if (!Node)
+ if (ACPI_SUCCESS (Status) ||
+ (Status & AE_CODE_CONTROL))
{
- return_ACPI_STATUS (AE_NULL_ENTRY);
+ return (Status);
}
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Parsing [%4.4s] **** NamedObj=%p\n",
- AcpiUtGetNodeName (Node), Node));
-
- /* Extract the method object from the method Node */
+ /* Invoke the global exception handler */
- ObjDesc = AcpiNsGetAttachedObject (Node);
- if (!ObjDesc)
+ if (AcpiGbl_ExceptionHandler)
{
- return_ACPI_STATUS (AE_NULL_OBJECT);
- }
+ /* Exit the interpreter, allow handler to execute methods */
- /* Create a mutex for the method if there is a concurrency limit */
+ AcpiExExitInterpreter ();
- if ((ObjDesc->Method.Concurrency != ACPI_INFINITE_CONCURRENCY) &&
- (!ObjDesc->Method.Semaphore))
- {
- Status = AcpiOsCreateSemaphore (ObjDesc->Method.Concurrency,
- ObjDesc->Method.Concurrency,
- &ObjDesc->Method.Semaphore);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
+ /*
+ * Handler can map the exception code to anything it wants, including
+ * AE_OK, in which case the executing method will not be aborted.
+ */
+ Status = AcpiGbl_ExceptionHandler (Status,
+ WalkState->MethodNode ?
+ WalkState->MethodNode->Name.Integer : 0,
+ WalkState->Opcode, WalkState->AmlOffset, NULL);
+ (void) AcpiExEnterInterpreter ();
}
- /*
- * Allocate a new parser op to be the root of the parsed
- * method tree
- */
- Op = AcpiPsAllocOp (AML_METHOD_OP);
- if (!Op)
+#ifdef ACPI_DISASSEMBLER
+ if (ACPI_FAILURE (Status))
{
- return_ACPI_STATUS (AE_NO_MEMORY);
+ /* Display method locals/args if disassembler is present */
+
+ AcpiDmDumpMethodInfo (Status, WalkState, WalkState->Op);
}
+#endif
- /* Init new op with the method name and pointer back to the Node */
+ return (Status);
+}
- AcpiPsSetName (Op, Node->Name.Integer);
- Op->Common.Node = Node;
- /*
- * Get a new OwnerId for objects created by this method. Namespace
- * objects (such as Operation Regions) can be created during the
- * first pass parse.
- */
- Status = AcpiUtAllocateOwnerId (&ObjDesc->Method.OwnerId);
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsCreateMethodMutex
+ *
+ * PARAMETERS: ObjDesc - The method object
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Create a mutex object for a serialized control method
+ *
+ ******************************************************************************/
- /* Create and initialize a new walk state */
+static ACPI_STATUS
+AcpiDsCreateMethodMutex (
+ ACPI_OPERAND_OBJECT *MethodDesc)
+{
+ ACPI_OPERAND_OBJECT *MutexDesc;
+ ACPI_STATUS Status;
- WalkState = AcpiDsCreateWalkState (
- ObjDesc->Method.OwnerId, NULL, NULL, NULL);
- if (!WalkState)
- {
- Status = AE_NO_MEMORY;
- goto Cleanup2;
- }
- Status = AcpiDsInitAmlWalk (WalkState, Op, Node,
- ObjDesc->Method.AmlStart,
- ObjDesc->Method.AmlLength, NULL, 1);
- if (ACPI_FAILURE (Status))
+ ACPI_FUNCTION_TRACE (DsCreateMethodMutex);
+
+
+ /* Create the new mutex object */
+
+ MutexDesc = AcpiUtCreateInternalObject (ACPI_TYPE_MUTEX);
+ if (!MutexDesc)
{
- AcpiDsDeleteWalkState (WalkState);
- goto Cleanup2;
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
- /*
- * Parse the method, first pass
- *
- * The first pass load is where newly declared named objects are added into
- * the namespace. Actual evaluation of the named objects (what would be
- * called a "second pass") happens during the actual execution of the
- * method so that operands to the named objects can take on dynamic
- * run-time values.
- */
- Status = AcpiPsParseAml (WalkState);
+ /* Create the actual OS Mutex */
+
+ Status = AcpiOsCreateMutex (&MutexDesc->Mutex.OsMutex);
if (ACPI_FAILURE (Status))
{
- goto Cleanup2;
+ return_ACPI_STATUS (Status);
}
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
- "**** [%4.4s] Parsed **** NamedObj=%p Op=%p\n",
- AcpiUtGetNodeName (Node), Node, Op));
-
- /*
- * Delete the parse tree. We simply re-parse the method for every
- * execution since there isn't much overhead (compared to keeping lots
- * of parse trees around)
- */
- AcpiNsDeleteNamespaceSubtree (Node);
- AcpiNsDeleteNamespaceByOwner (ObjDesc->Method.OwnerId);
-
-Cleanup2:
- AcpiUtReleaseOwnerId (&ObjDesc->Method.OwnerId);
-
-Cleanup:
- AcpiPsDeleteParseTree (Op);
- return_ACPI_STATUS (Status);
+ MutexDesc->Mutex.SyncLevel = MethodDesc->Method.SyncLevel;
+ MethodDesc->Method.Mutex = MutexDesc;
+ return_ACPI_STATUS (AE_OK);
}
@@ -274,7 +250,8 @@ Cleanup:
*
* PARAMETERS: MethodNode - Node of the method
* ObjDesc - The method object
- * CallingMethodNode - Caller of this method (if non-null)
+ * WalkState - current state, NULL if not yet executing
+ * a method.
*
* RETURN: Status
*
@@ -288,12 +265,12 @@ ACPI_STATUS
AcpiDsBeginMethodExecution (
ACPI_NAMESPACE_NODE *MethodNode,
ACPI_OPERAND_OBJECT *ObjDesc,
- ACPI_NAMESPACE_NODE *CallingMethodNode)
+ ACPI_WALK_STATE *WalkState)
{
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE_PTR ("DsBeginMethodExecution", MethodNode);
+ ACPI_FUNCTION_TRACE_PTR (DsBeginMethodExecution, MethodNode);
if (!MethodNode)
@@ -305,39 +282,87 @@ AcpiDsBeginMethodExecution (
if (ObjDesc->Method.ThreadCount == ACPI_UINT8_MAX)
{
- ACPI_REPORT_ERROR ((
- "Method reached maximum reentrancy limit (255)\n"));
+ ACPI_ERROR ((AE_INFO,
+ "Method reached maximum reentrancy limit (255)"));
return_ACPI_STATUS (AE_AML_METHOD_LIMIT);
}
/*
- * If there is a concurrency limit on this method, we need to
- * obtain a unit from the method semaphore.
+ * If this method is serialized, we need to acquire the method mutex.
*/
- if (ObjDesc->Method.Semaphore)
+ if (ObjDesc->Method.MethodFlags & AML_METHOD_SERIALIZED)
{
/*
- * Allow recursive method calls, up to the reentrancy/concurrency
- * limit imposed by the SERIALIZED rule and the SyncLevel method
- * parameter.
- *
- * The point of this code is to avoid permanently blocking a
- * thread that is making recursive method calls.
+ * Create a mutex for the method if it is defined to be Serialized
+ * and a mutex has not already been created. We defer the mutex creation
+ * until a method is actually executed, to minimize the object count
*/
- if (MethodNode == CallingMethodNode)
+ if (!ObjDesc->Method.Mutex)
{
- if (ObjDesc->Method.ThreadCount >= ObjDesc->Method.Concurrency)
+ Status = AcpiDsCreateMethodMutex (ObjDesc);
+ if (ACPI_FAILURE (Status))
{
- return_ACPI_STATUS (AE_AML_METHOD_LIMIT);
+ return_ACPI_STATUS (Status);
}
}
/*
- * Get a unit from the method semaphore. This releases the
- * interpreter if we block
+ * The CurrentSyncLevel (per-thread) must be less than or equal to
+ * the sync level of the method. This mechanism provides some
+ * deadlock prevention
+ *
+ * Top-level method invocation has no walk state at this point
*/
- Status = AcpiExSystemWaitSemaphore (ObjDesc->Method.Semaphore,
- ACPI_WAIT_FOREVER);
+ if (WalkState &&
+ (WalkState->Thread->CurrentSyncLevel > ObjDesc->Method.Mutex->Mutex.SyncLevel))
+ {
+ ACPI_ERROR ((AE_INFO,
+ "Cannot acquire Mutex for method [%4.4s], current SyncLevel is too large (%d)",
+ AcpiUtGetNodeName (MethodNode),
+ WalkState->Thread->CurrentSyncLevel));
+
+ return_ACPI_STATUS (AE_AML_MUTEX_ORDER);
+ }
+
+ /*
+ * Obtain the method mutex if necessary. Do not acquire mutex for a
+ * recursive call.
+ */
+ if (!WalkState ||
+ !ObjDesc->Method.Mutex->Mutex.ThreadId ||
+ (WalkState->Thread->ThreadId != ObjDesc->Method.Mutex->Mutex.ThreadId))
+ {
+ /*
+ * Acquire the method mutex. This releases the interpreter if we
+ * block (and reacquires it before it returns)
+ */
+ Status = AcpiExSystemWaitMutex (ObjDesc->Method.Mutex->Mutex.OsMutex,
+ ACPI_WAIT_FOREVER);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Update the mutex and walk info and save the original SyncLevel */
+
+ if (WalkState)
+ {
+ ObjDesc->Method.Mutex->Mutex.OriginalSyncLevel =
+ WalkState->Thread->CurrentSyncLevel;
+
+ ObjDesc->Method.Mutex->Mutex.ThreadId = WalkState->Thread->ThreadId;
+ WalkState->Thread->CurrentSyncLevel = ObjDesc->Method.SyncLevel;
+ }
+ else
+ {
+ ObjDesc->Method.Mutex->Mutex.OriginalSyncLevel =
+ ObjDesc->Method.Mutex->Mutex.SyncLevel;
+ }
+ }
+
+ /* Always increase acquisition depth */
+
+ ObjDesc->Method.Mutex->Mutex.AcquisitionDepth++;
}
/*
@@ -345,14 +370,14 @@ AcpiDsBeginMethodExecution (
* to begin concurrent execution. We only need one OwnerId, even if the
* method is invoked recursively.
*/
- if (!ObjDesc->Method.OwnerId)
- {
- Status = AcpiUtAllocateOwnerId (&ObjDesc->Method.OwnerId);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
- }
+ if (!ObjDesc->Method.OwnerId)
+ {
+ Status = AcpiUtAllocateOwnerId (&ObjDesc->Method.OwnerId);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+ }
/*
* Increment the method parse tree thread count since it has been
@@ -360,6 +385,16 @@ AcpiDsBeginMethodExecution (
*/
ObjDesc->Method.ThreadCount++;
return_ACPI_STATUS (Status);
+
+
+Cleanup:
+ /* On error, must release the method mutex (if present) */
+
+ if (ObjDesc->Method.Mutex)
+ {
+ AcpiOsReleaseMutex (ObjDesc->Method.Mutex->Mutex.OsMutex);
+ }
+ return_ACPI_STATUS (Status);
}
@@ -387,13 +422,13 @@ AcpiDsCallControlMethod (
ACPI_NAMESPACE_NODE *MethodNode;
ACPI_WALK_STATE *NextWalkState = NULL;
ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_PARAMETER_INFO Info;
+ ACPI_EVALUATE_INFO *Info;
UINT32 i;
- ACPI_FUNCTION_TRACE_PTR ("DsCallControlMethod", ThisWalkState);
+ ACPI_FUNCTION_TRACE_PTR (DsCallControlMethod, ThisWalkState);
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Execute method %p, currentstate=%p\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Calling method %p, currentstate=%p\n",
ThisWalkState->PrevOp, ThisWalkState));
/*
@@ -411,59 +446,25 @@ AcpiDsCallControlMethod (
return_ACPI_STATUS (AE_NULL_OBJECT);
}
- /* Init for new method, wait on concurrency semaphore */
+ /* Init for new method, possibly wait on method mutex */
Status = AcpiDsBeginMethodExecution (MethodNode, ObjDesc,
- ThisWalkState->MethodNode);
+ ThisWalkState);
if (ACPI_FAILURE (Status))
{
- goto Cleanup;
+ return_ACPI_STATUS (Status);
}
- if (!(ObjDesc->Method.MethodFlags & AML_METHOD_INTERNAL_ONLY))
- {
- /* 1) Parse: Create a new walk state for the preempting walk */
-
- NextWalkState = AcpiDsCreateWalkState (ObjDesc->Method.OwnerId,
- Op, ObjDesc, NULL);
- if (!NextWalkState)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- /* Create and init a Root Node */
-
- Op = AcpiPsCreateScopeOp ();
- if (!Op)
- {
- Status = AE_NO_MEMORY;
- goto Cleanup;
- }
-
- Status = AcpiDsInitAmlWalk (NextWalkState, Op, MethodNode,
- ObjDesc->Method.AmlStart, ObjDesc->Method.AmlLength,
- NULL, 1);
- if (ACPI_FAILURE (Status))
- {
- AcpiDsDeleteWalkState (NextWalkState);
- goto Cleanup;
- }
-
- /* Begin AML parse */
-
- Status = AcpiPsParseAml (NextWalkState);
- AcpiPsDeleteParseTree (Op);
- }
-
- /* 2) Execute: Create a new state for the preempting walk */
+ /* Begin method parse/execution. Create a new walk state */
NextWalkState = AcpiDsCreateWalkState (ObjDesc->Method.OwnerId,
- NULL, ObjDesc, Thread);
+ NULL, ObjDesc, Thread);
if (!NextWalkState)
{
Status = AE_NO_MEMORY;
goto Cleanup;
}
+
/*
* The resolved arguments were put on the previous walk state's operand
* stack. Operands on the previous walk state stack always
@@ -471,12 +472,25 @@ AcpiDsCallControlMethod (
*/
ThisWalkState->Operands [ThisWalkState->NumOperands] = NULL;
- Info.Parameters = &ThisWalkState->Operands[0];
- Info.ParameterType = ACPI_PARAM_ARGS;
+ /*
+ * Allocate and initialize the evaluation information block
+ * TBD: this is somewhat inefficient, should change interface to
+ * DsInitAmlWalk. For now, keeps this struct off the CPU stack
+ */
+ Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO));
+ if (!Info)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ Info->Parameters = &ThisWalkState->Operands[0];
+ Info->ParameterType = ACPI_PARAM_ARGS;
Status = AcpiDsInitAmlWalk (NextWalkState, NULL, MethodNode,
- ObjDesc->Method.AmlStart, ObjDesc->Method.AmlLength,
- &Info, 3);
+ ObjDesc->Method.AmlStart, ObjDesc->Method.AmlLength,
+ Info, ACPI_IMODE_EXECUTE);
+
+ ACPI_FREE (Info);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
@@ -497,7 +511,10 @@ AcpiDsCallControlMethod (
ThisWalkState->NumOperands = 0;
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "Starting nested execution, newstate=%p\n", NextWalkState));
+ "**** Begin nested execution of [%4.4s] **** WalkState=%p\n",
+ MethodNode->Name.Ascii, NextWalkState));
+
+ /* Invoke an internal method if necessary */
if (ObjDesc->Method.MethodFlags & AML_METHOD_INTERNAL_ONLY)
{
@@ -508,17 +525,15 @@ AcpiDsCallControlMethod (
Cleanup:
- /* Decrement the thread count on the method parse tree */
- if (NextWalkState && (NextWalkState->MethodDesc))
+ /* On error, we must terminate the method properly */
+
+ AcpiDsTerminateControlMethod (ObjDesc, NextWalkState);
+ if (NextWalkState)
{
- NextWalkState->MethodDesc->Method.ThreadCount--;
+ AcpiDsDeleteWalkState (NextWalkState);
}
- /* On error, we must delete the new walk state */
-
- AcpiDsTerminateControlMethod (NextWalkState);
- AcpiDsDeleteWalkState (NextWalkState);
return_ACPI_STATUS (Status);
}
@@ -543,15 +558,16 @@ AcpiDsRestartControlMethod (
ACPI_OPERAND_OBJECT *ReturnDesc)
{
ACPI_STATUS Status;
+ int SameAsImplicitReturn;
- ACPI_FUNCTION_TRACE_PTR ("DsRestartControlMethod", WalkState);
+ ACPI_FUNCTION_TRACE_PTR (DsRestartControlMethod, WalkState);
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"****Restart [%4.4s] Op %p ReturnValueFromCallee %p\n",
- (char *) &WalkState->MethodNode->Name, WalkState->MethodCallOp,
- ReturnDesc));
+ AcpiUtGetNodeName (WalkState->MethodNode),
+ WalkState->MethodCallOp, ReturnDesc));
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
" ReturnFromThisMethodUsed?=%X ResStack %p Walk %p\n",
@@ -562,6 +578,10 @@ AcpiDsRestartControlMethod (
if (ReturnDesc)
{
+ /* Is the implicit return object the same as the return desc? */
+
+ SameAsImplicitReturn = (WalkState->ImplicitReturnObj == ReturnDesc);
+
/* Are we actually going to use the return value? */
if (WalkState->ReturnUsed)
@@ -583,18 +603,23 @@ AcpiDsRestartControlMethod (
}
/*
- * The following code is the
- * optional support for a so-called "implicit return". Some AML code
- * assumes that the last value of the method is "implicitly" returned
- * to the caller. Just save the last result as the return value.
+ * The following code is the optional support for the so-called
+ * "implicit return". Some AML code assumes that the last value of the
+ * method is "implicitly" returned to the caller, in the absence of an
+ * explicit return value.
+ *
+ * Just save the last result of the method as the return value.
+ *
* NOTE: this is optional because the ASL language does not actually
* support this behavior.
*/
- else if (!AcpiDsDoImplicitReturn (ReturnDesc, WalkState, FALSE))
+ else if (!AcpiDsDoImplicitReturn (ReturnDesc, WalkState, FALSE) ||
+ SameAsImplicitReturn)
{
/*
* Delete the return value if it will not be used by the
- * calling method
+ * calling method or remove one reference if the explicit return
+ * is the same as the implicit return value.
*/
AcpiUtRemoveReference (ReturnDesc);
}
@@ -608,7 +633,8 @@ AcpiDsRestartControlMethod (
*
* FUNCTION: AcpiDsTerminateControlMethod
*
- * PARAMETERS: WalkState - State of the method
+ * PARAMETERS: MethodDesc - Method object
+ * WalkState - State associated with the method
*
* RETURN: None
*
@@ -616,121 +642,112 @@ AcpiDsRestartControlMethod (
* created, delete all locals and arguments, and delete the parse
* tree if requested.
*
+ * MUTEX: Interpreter is locked
+ *
******************************************************************************/
void
AcpiDsTerminateControlMethod (
+ ACPI_OPERAND_OBJECT *MethodDesc,
ACPI_WALK_STATE *WalkState)
{
- ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_NAMESPACE_NODE *MethodNode;
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE_PTR ("DsTerminateControlMethod", WalkState);
-
+ ACPI_FUNCTION_TRACE_PTR (DsTerminateControlMethod, WalkState);
- if (!WalkState)
- {
- return_VOID;
- }
- /* The current method object was saved in the walk state */
+ /* MethodDesc is required, WalkState is optional */
- ObjDesc = WalkState->MethodDesc;
- if (!ObjDesc)
+ if (!MethodDesc)
{
return_VOID;
}
- /* Delete all arguments and locals */
+ if (WalkState)
+ {
+ /* Delete all arguments and locals */
- AcpiDsMethodDataDeleteAll (WalkState);
+ AcpiDsMethodDataDeleteAll (WalkState);
+ }
/*
- * Lock the parser while we terminate this method.
- * If this is the last thread executing the method,
- * we have additional cleanup to perform
+ * If method is serialized, release the mutex and restore the
+ * current sync level for this thread
*/
- Status = AcpiUtAcquireMutex (ACPI_MTX_PARSER);
- if (ACPI_FAILURE (Status))
+ if (MethodDesc->Method.Mutex)
{
- return_VOID;
- }
-
- /* Signal completion of the execution of this method if necessary */
+ /* Acquisition Depth handles recursive calls */
- if (WalkState->MethodDesc->Method.Semaphore)
- {
- Status = AcpiOsSignalSemaphore (
- WalkState->MethodDesc->Method.Semaphore, 1);
- if (ACPI_FAILURE (Status))
+ MethodDesc->Method.Mutex->Mutex.AcquisitionDepth--;
+ if (!MethodDesc->Method.Mutex->Mutex.AcquisitionDepth)
{
- ACPI_REPORT_ERROR (("Could not signal method semaphore\n"));
+ WalkState->Thread->CurrentSyncLevel =
+ MethodDesc->Method.Mutex->Mutex.OriginalSyncLevel;
- /* Ignore error and continue cleanup */
+ AcpiOsReleaseMutex (MethodDesc->Method.Mutex->Mutex.OsMutex);
+ MethodDesc->Method.Mutex->Mutex.ThreadId = 0;
}
}
- if (WalkState->MethodDesc->Method.ThreadCount)
+ if (WalkState)
+ {
+ /*
+ * Delete any namespace objects created anywhere within
+ * the namespace by the execution of this method
+ */
+ AcpiNsDeleteNamespaceByOwner (MethodDesc->Method.OwnerId);
+ }
+
+ /* Decrement the thread count on the method */
+
+ if (MethodDesc->Method.ThreadCount)
+ {
+ MethodDesc->Method.ThreadCount--;
+ }
+ else
+ {
+ ACPI_ERROR ((AE_INFO,
+ "Invalid zero thread count in method"));
+ }
+
+ /* Are there any other threads currently executing this method? */
+
+ if (MethodDesc->Method.ThreadCount)
{
+ /*
+ * Additional threads. Do not release the OwnerId in this case,
+ * we immediately reuse it for the next thread executing this method
+ */
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "*** Not deleting method namespace, there are still %d threads\n",
- WalkState->MethodDesc->Method.ThreadCount));
+ "*** Completed execution of one thread, %d threads remaining\n",
+ MethodDesc->Method.ThreadCount));
}
- else /* This is the last executing thread */
+ else
{
+ /* This is the only executing thread for this method */
+
/*
* Support to dynamically change a method from NotSerialized to
- * Serialized if it appears that the method is written foolishly and
- * does not support multiple thread execution. The best example of this
- * is if such a method creates namespace objects and blocks. A second
+ * Serialized if it appears that the method is incorrectly written and
+ * does not support multiple thread execution. The best example of this
+ * is if such a method creates namespace objects and blocks. A second
* thread will fail with an AE_ALREADY_EXISTS exception
*
* This code is here because we must wait until the last thread exits
* before creating the synchronization semaphore.
*/
- if ((WalkState->MethodDesc->Method.Concurrency == 1) &&
- (!WalkState->MethodDesc->Method.Semaphore))
- {
- Status = AcpiOsCreateSemaphore (1, 1,
- &WalkState->MethodDesc->Method.Semaphore);
- }
-
- /*
- * There are no more threads executing this method. Perform
- * additional cleanup.
- *
- * The method Node is stored in the walk state
- */
- MethodNode = WalkState->MethodNode;
-
- /*
- * Delete any namespace entries created immediately underneath
- * the method
- */
- Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (Status))
+ if ((MethodDesc->Method.MethodFlags & AML_METHOD_SERIALIZED) &&
+ (!MethodDesc->Method.Mutex))
{
- goto Exit;
+ Status = AcpiDsCreateMethodMutex (MethodDesc);
}
- if (MethodNode->Child)
- {
- AcpiNsDeleteNamespaceSubtree (MethodNode);
- }
+ /* No more threads, we can free the OwnerId */
- /*
- * Delete any namespace entries created anywhere else within
- * the namespace
- */
- AcpiNsDeleteNamespaceByOwner (WalkState->MethodDesc->Method.OwnerId);
- Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
- AcpiUtReleaseOwnerId (&WalkState->MethodDesc->Method.OwnerId);
+ AcpiUtReleaseOwnerId (&MethodDesc->Method.OwnerId);
}
-Exit:
- (void) AcpiUtReleaseMutex (ACPI_MTX_PARSER);
return_VOID;
}
diff --git a/sys/contrib/dev/acpica/dsmthdat.c b/sys/contrib/dev/acpica/dsmthdat.c
index da4aac5..10c1a9b 100644
--- a/sys/contrib/dev/acpica/dsmthdat.c
+++ b/sys/contrib/dev/acpica/dsmthdat.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dsmthdat - control method arguments and local variables
- * $Revision: 1.85 $
+ * $Revision: 1.92 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -164,7 +164,7 @@ AcpiDsMethodDataGetType (
* special data types.
*
* NOTES: WalkState fields are initialized to zero by the
- * ACPI_MEM_CALLOCATE().
+ * ACPI_ALLOCATE_ZEROED().
*
* A pseudo-Namespace Node is assigned to each argument and local
* so that RefOf() can return a pointer to the Node.
@@ -178,34 +178,32 @@ AcpiDsMethodDataInit (
UINT32 i;
- ACPI_FUNCTION_TRACE ("DsMethodDataInit");
+ ACPI_FUNCTION_TRACE (DsMethodDataInit);
/* Init the method arguments */
for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++)
{
- ACPI_MOVE_32_TO_32 (&WalkState->Arguments[i].Name,
- NAMEOF_ARG_NTE);
+ ACPI_MOVE_32_TO_32 (&WalkState->Arguments[i].Name, NAMEOF_ARG_NTE);
WalkState->Arguments[i].Name.Integer |= (i << 24);
- WalkState->Arguments[i].Descriptor = ACPI_DESC_TYPE_NAMED;
- WalkState->Arguments[i].Type = ACPI_TYPE_ANY;
- WalkState->Arguments[i].Flags = ANOBJ_END_OF_PEER_LIST |
- ANOBJ_METHOD_ARG;
+ WalkState->Arguments[i].DescriptorType = ACPI_DESC_TYPE_NAMED;
+ WalkState->Arguments[i].Type = ACPI_TYPE_ANY;
+ WalkState->Arguments[i].Flags =
+ ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_ARG;
}
/* Init the method locals */
for (i = 0; i < ACPI_METHOD_NUM_LOCALS; i++)
{
- ACPI_MOVE_32_TO_32 (&WalkState->LocalVariables[i].Name,
- NAMEOF_LOCAL_NTE);
+ ACPI_MOVE_32_TO_32 (&WalkState->LocalVariables[i].Name, NAMEOF_LOCAL_NTE);
WalkState->LocalVariables[i].Name.Integer |= (i << 24);
- WalkState->LocalVariables[i].Descriptor = ACPI_DESC_TYPE_NAMED;
- WalkState->LocalVariables[i].Type = ACPI_TYPE_ANY;
- WalkState->LocalVariables[i].Flags = ANOBJ_END_OF_PEER_LIST |
- ANOBJ_METHOD_LOCAL;
+ WalkState->LocalVariables[i].DescriptorType = ACPI_DESC_TYPE_NAMED;
+ WalkState->LocalVariables[i].Type = ACPI_TYPE_ANY;
+ WalkState->LocalVariables[i].Flags =
+ ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_LOCAL;
}
return_VOID;
@@ -232,7 +230,7 @@ AcpiDsMethodDataDeleteAll (
UINT32 Index;
- ACPI_FUNCTION_TRACE ("DsMethodDataDeleteAll");
+ ACPI_FUNCTION_TRACE (DsMethodDataDeleteAll);
/* Detach the locals */
@@ -295,7 +293,7 @@ AcpiDsMethodDataInitArgs (
UINT32 Index = 0;
- ACPI_FUNCTION_TRACE_PTR ("DsMethodDataInitArgs", Params);
+ ACPI_FUNCTION_TRACE_PTR (DsMethodDataInitArgs, Params);
if (!Params)
@@ -352,7 +350,7 @@ AcpiDsMethodDataGetNode (
ACPI_WALK_STATE *WalkState,
ACPI_NAMESPACE_NODE **Node)
{
- ACPI_FUNCTION_TRACE ("DsMethodDataGetNode");
+ ACPI_FUNCTION_TRACE (DsMethodDataGetNode);
/*
@@ -364,8 +362,8 @@ AcpiDsMethodDataGetNode (
if (Index > ACPI_METHOD_MAX_LOCAL)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Local index %d is invalid (max %d)\n",
+ ACPI_ERROR ((AE_INFO,
+ "Local index %d is invalid (max %d)",
Index, ACPI_METHOD_MAX_LOCAL));
return_ACPI_STATUS (AE_AML_INVALID_INDEX);
}
@@ -379,8 +377,8 @@ AcpiDsMethodDataGetNode (
if (Index > ACPI_METHOD_MAX_ARG)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Arg index %d is invalid (max %d)\n",
+ ACPI_ERROR ((AE_INFO,
+ "Arg index %d is invalid (max %d)",
Index, ACPI_METHOD_MAX_ARG));
return_ACPI_STATUS (AE_AML_INVALID_INDEX);
}
@@ -391,7 +389,7 @@ AcpiDsMethodDataGetNode (
break;
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Opcode %d is invalid\n", Opcode));
+ ACPI_ERROR ((AE_INFO, "Opcode %d is invalid", Opcode));
return_ACPI_STATUS (AE_AML_BAD_OPCODE);
}
@@ -426,7 +424,7 @@ AcpiDsMethodDataSetValue (
ACPI_NAMESPACE_NODE *Node;
- ACPI_FUNCTION_TRACE ("DsMethodDataSetValue");
+ ACPI_FUNCTION_TRACE (DsMethodDataSetValue);
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
@@ -485,14 +483,14 @@ AcpiDsMethodDataGetValue (
ACPI_OPERAND_OBJECT *Object;
- ACPI_FUNCTION_TRACE ("DsMethodDataGetValue");
+ ACPI_FUNCTION_TRACE (DsMethodDataGetValue);
/* Validate the object descriptor */
if (!DestDesc)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null object descriptor pointer\n"));
+ ACPI_ERROR ((AE_INFO, "Null object descriptor pointer"));
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
@@ -540,22 +538,22 @@ AcpiDsMethodDataGetValue (
{
case AML_ARG_OP:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Uninitialized Arg[%d] at node %p\n",
+ ACPI_ERROR ((AE_INFO,
+ "Uninitialized Arg[%d] at node %p",
Index, Node));
return_ACPI_STATUS (AE_AML_UNINITIALIZED_ARG);
case AML_LOCAL_OP:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Uninitialized Local[%d] at node %p\n",
+ ACPI_ERROR ((AE_INFO,
+ "Uninitialized Local[%d] at node %p",
Index, Node));
return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL);
default:
- ACPI_REPORT_ERROR (("Not Arg/Local opcode: %X\n", Opcode));
+ ACPI_ERROR ((AE_INFO, "Not a Arg/Local opcode: %X", Opcode));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
}
@@ -597,7 +595,7 @@ AcpiDsMethodDataDeleteValue (
ACPI_OPERAND_OBJECT *Object;
- ACPI_FUNCTION_TRACE ("DsMethodDataDeleteValue");
+ ACPI_FUNCTION_TRACE (DsMethodDataDeleteValue);
/* Get the namespace node for the arg/local */
@@ -664,7 +662,7 @@ AcpiDsStoreObjectToLocal (
ACPI_OPERAND_OBJECT *NewObjDesc;
- ACPI_FUNCTION_TRACE ("DsStoreObjectToLocal");
+ ACPI_FUNCTION_TRACE (DsStoreObjectToLocal);
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode=%X Index=%d Obj=%p\n",
Opcode, Index, ObjDesc));
@@ -816,7 +814,7 @@ AcpiDsMethodDataGetType (
ACPI_OPERAND_OBJECT *Object;
- ACPI_FUNCTION_TRACE ("DsMethodDataGetType");
+ ACPI_FUNCTION_TRACE (DsMethodDataGetType);
/* Get the namespace node for the arg/local */
diff --git a/sys/contrib/dev/acpica/dsobject.c b/sys/contrib/dev/acpica/dsobject.c
index e0e4917..a058299 100644
--- a/sys/contrib/dev/acpica/dsobject.c
+++ b/sys/contrib/dev/acpica/dsobject.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dsobject - Dispatcher object management routines
- * $Revision: 1.124 $
+ * $Revision: 1.135 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -126,6 +126,8 @@
#define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME ("dsobject")
+/* Local prototypes */
+
static ACPI_STATUS
AcpiDsBuildInternalObject (
ACPI_WALK_STATE *WalkState,
@@ -159,35 +161,59 @@ AcpiDsBuildInternalObject (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("DsBuildInternalObject");
+ ACPI_FUNCTION_TRACE (DsBuildInternalObject);
*ObjDescPtr = NULL;
if (Op->Common.AmlOpcode == AML_INT_NAMEPATH_OP)
{
/*
- * This is an named object reference. If this name was
+ * This is a named object reference. If this name was
* previously looked up in the namespace, it was stored in this op.
* Otherwise, go ahead and look it up now
*/
if (!Op->Common.Node)
{
Status = AcpiNsLookup (WalkState->ScopeInfo,
- Op->Common.Value.String,
- ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
- ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
- NULL,
- (ACPI_NAMESPACE_NODE **) &(Op->Common.Node));
-
+ Op->Common.Value.String,
+ ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
+ ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL,
+ ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, &(Op->Common.Node)));
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_NSERROR (Op->Common.Value.String, Status);
+ /* Check if we are resolving a named reference within a package */
+
+ if ((Status == AE_NOT_FOUND) && (AcpiGbl_EnableInterpreterSlack) &&
+
+ ((Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) ||
+ (Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP)))
+ {
+ /*
+ * We didn't find the target and we are populating elements
+ * of a package - ignore if slack enabled. Some ASL code
+ * contains dangling invalid references in packages and
+ * expects that no exception will be issued. Leave the
+ * element as a null element. It cannot be used, but it
+ * can be overwritten by subsequent ASL code - this is
+ * typically the case.
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "Ignoring unresolved reference in package [%4.4s]\n",
+ WalkState->ScopeInfo->Scope.Node->Name.Ascii));
+
+ return_ACPI_STATUS (AE_OK);
+ }
+ else
+ {
+ ACPI_ERROR_NAMESPACE (Op->Common.Value.String, Status);
+ }
+
return_ACPI_STATUS (Status);
}
}
}
- /* Create and init the internal ACPI object */
+ /* Create and init a new internal ACPI object */
ObjDesc = AcpiUtCreateInternalObject (
(AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode))->ObjectType);
@@ -238,18 +264,16 @@ AcpiDsBuildInternalBufferObj (
UINT32 ByteListLength = 0;
- ACPI_FUNCTION_TRACE ("DsBuildInternalBufferObj");
+ ACPI_FUNCTION_TRACE (DsBuildInternalBufferObj);
+ /*
+ * If we are evaluating a Named buffer object "Name (xxxx, Buffer)".
+ * The buffer object already exists (from the NS node), otherwise it must
+ * be created.
+ */
ObjDesc = *ObjDescPtr;
- if (ObjDesc)
- {
- /*
- * We are evaluating a Named buffer object "Name (xxxx, Buffer)".
- * The buffer object already exists (from the NS node)
- */
- }
- else
+ if (!ObjDesc)
{
/* Create a new buffer object */
@@ -273,8 +297,8 @@ AcpiDsBuildInternalBufferObj (
{
if (ByteList->Common.AmlOpcode != AML_INT_BYTELIST_OP)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Expecting bytelist, got AML opcode %X in op %p\n",
+ ACPI_ERROR ((AE_INFO,
+ "Expecting bytelist, got AML opcode %X in op %p",
ByteList->Common.AmlOpcode, ByteList));
AcpiUtRemoveReference (ObjDesc);
@@ -305,7 +329,7 @@ AcpiDsBuildInternalBufferObj (
}
else
{
- ObjDesc->Buffer.Pointer = ACPI_MEM_CALLOCATE (
+ ObjDesc->Buffer.Pointer = ACPI_ALLOCATE_ZEROED (
ObjDesc->Buffer.Length);
if (!ObjDesc->Buffer.Pointer)
{
@@ -323,7 +347,7 @@ AcpiDsBuildInternalBufferObj (
}
ObjDesc->Buffer.Flags |= AOPOBJ_DATA_VALID;
- Op->Common.Node = (ACPI_NAMESPACE_NODE *) ObjDesc;
+ Op->Common.Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjDesc);
return_ACPI_STATUS (AE_OK);
}
@@ -334,7 +358,8 @@ AcpiDsBuildInternalBufferObj (
*
* PARAMETERS: WalkState - Current walk state
* Op - Parser object to be translated
- * PackageLength - Number of elements in the package
+ * ElementCount - Number of elements in the package - this is
+ * the NumElements argument to Package()
* ObjDescPtr - Where the ACPI internal object is returned
*
* RETURN: Status
@@ -342,44 +367,54 @@ AcpiDsBuildInternalBufferObj (
* DESCRIPTION: Translate a parser Op package object to the equivalent
* namespace object
*
+ * NOTE: The number of elements in the package will be always be the NumElements
+ * count, regardless of the number of elements in the package list. If
+ * NumElements is smaller, only that many package list elements are used.
+ * if NumElements is larger, the Package object is padded out with
+ * objects of type Uninitialized (as per ACPI spec.)
+ *
+ * Even though the ASL compilers do not allow NumElements to be smaller
+ * than the Package list length (for the fixed length package opcode), some
+ * BIOS code modifies the AML on the fly to adjust the NumElements, and
+ * this code compensates for that. This also provides compatibility with
+ * other AML interpreters.
+ *
******************************************************************************/
ACPI_STATUS
AcpiDsBuildInternalPackageObj (
ACPI_WALK_STATE *WalkState,
ACPI_PARSE_OBJECT *Op,
- UINT32 PackageLength,
+ UINT32 ElementCount,
ACPI_OPERAND_OBJECT **ObjDescPtr)
{
ACPI_PARSE_OBJECT *Arg;
ACPI_PARSE_OBJECT *Parent;
ACPI_OPERAND_OBJECT *ObjDesc = NULL;
- UINT32 PackageListLength;
ACPI_STATUS Status = AE_OK;
- UINT32 i;
+ ACPI_NATIVE_UINT i;
+ UINT16 Index;
+ UINT16 ReferenceCount;
- ACPI_FUNCTION_TRACE ("DsBuildInternalPackageObj");
+ ACPI_FUNCTION_TRACE (DsBuildInternalPackageObj);
/* Find the parent of a possibly nested package */
Parent = Op->Common.Parent;
- while ((Parent->Common.AmlOpcode == AML_PACKAGE_OP) ||
+ while ((Parent->Common.AmlOpcode == AML_PACKAGE_OP) ||
(Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP))
{
Parent = Parent->Common.Parent;
}
+ /*
+ * If we are evaluating a Named package object "Name (xxxx, Package)",
+ * the package object already exists, otherwise it must be created.
+ */
ObjDesc = *ObjDescPtr;
- if (ObjDesc)
- {
- /*
- * We are evaluating a Named package object "Name (xxxx, Package)".
- * Get the existing package object from the NS node
- */
- }
- else
+ if (!ObjDesc)
{
ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_PACKAGE);
*ObjDescPtr = ObjDesc;
@@ -391,35 +426,13 @@ AcpiDsBuildInternalPackageObj (
ObjDesc->Package.Node = Parent->Common.Node;
}
- ObjDesc->Package.Count = PackageLength;
-
- /* Count the number of items in the package list */
-
- PackageListLength = 0;
- Arg = Op->Common.Value.Arg;
- Arg = Arg->Common.Next;
- while (Arg)
- {
- PackageListLength++;
- Arg = Arg->Common.Next;
- }
-
- /*
- * The package length (number of elements) will be the greater
- * of the specified length and the length of the initializer list
- */
- if (PackageListLength > PackageLength)
- {
- ObjDesc->Package.Count = PackageListLength;
- }
-
/*
- * Allocate the pointer array (array of pointers to the
- * individual objects). Add an extra pointer slot so
- * that the list is always null terminated.
+ * Allocate the element array (array of pointers to the individual
+ * objects) based on the NumElements parameter. Add an extra pointer slot
+ * so that the list is always null terminated.
*/
- ObjDesc->Package.Elements = ACPI_MEM_CALLOCATE (
- ((ACPI_SIZE) ObjDesc->Package.Count + 1) * sizeof (void *));
+ ObjDesc->Package.Elements = ACPI_ALLOCATE_ZEROED (
+ ((ACPI_SIZE) ElementCount + 1) * sizeof (void *));
if (!ObjDesc->Package.Elements)
{
@@ -427,17 +440,21 @@ AcpiDsBuildInternalPackageObj (
return_ACPI_STATUS (AE_NO_MEMORY);
}
+ ObjDesc->Package.Count = ElementCount;
+
/*
- * Now init the elements of the package
+ * Initialize the elements of the package, up to the NumElements count.
+ * Package is automatically padded with uninitialized (NULL) elements
+ * if NumElements is greater than the package list length. Likewise,
+ * Package is truncated if NumElements is less than the list length.
*/
- i = 0;
Arg = Op->Common.Value.Arg;
Arg = Arg->Common.Next;
- while (Arg)
+ for (i = 0; Arg && (i < ElementCount); i++)
{
if (Arg->Common.AmlOpcode == AML_INT_RETURN_VALUE_OP)
{
- /* Object (package or buffer) is already built */
+ /* This package element is already built, just get it */
ObjDesc->Package.Elements[i] =
ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Arg->Common.Node);
@@ -448,12 +465,34 @@ AcpiDsBuildInternalPackageObj (
&ObjDesc->Package.Elements[i]);
}
- i++;
+ if (*ObjDescPtr)
+ {
+ /* Existing package, get existing reference count */
+
+ ReferenceCount = (*ObjDescPtr)->Common.ReferenceCount;
+ if (ReferenceCount > 1)
+ {
+ /* Make new element ref count match original ref count */
+
+ for (Index = 0; Index < (ReferenceCount - 1); Index++)
+ {
+ AcpiUtAddReference ((ObjDesc->Package.Elements[i]));
+ }
+ }
+ }
+
Arg = Arg->Common.Next;
}
+ if (!Arg)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "Package List length larger than NumElements count (%X), truncated\n",
+ ElementCount));
+ }
+
ObjDesc->Package.Flags |= AOPOBJ_DATA_VALID;
- Op->Common.Node = (ACPI_NAMESPACE_NODE *) ObjDesc;
+ Op->Common.Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjDesc);
return_ACPI_STATUS (Status);
}
@@ -482,7 +521,7 @@ AcpiDsCreateNode (
ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_FUNCTION_TRACE_PTR ("DsCreateNode", Op);
+ ACPI_FUNCTION_TRACE_PTR (DsCreateNode, Op);
/*
@@ -557,7 +596,7 @@ AcpiDsInitObjectFromOp (
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE ("DsInitObjectFromOp");
+ ACPI_FUNCTION_TRACE (DsInitObjectFromOp);
ObjDesc = *RetObjDesc;
@@ -578,8 +617,8 @@ AcpiDsInitObjectFromOp (
/*
* Defer evaluation of Buffer TermArg operand
*/
- ObjDesc->Buffer.Node = (ACPI_NAMESPACE_NODE *)
- WalkState->Operands[0];
+ ObjDesc->Buffer.Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE,
+ WalkState->Operands[0]);
ObjDesc->Buffer.AmlStart = Op->Named.Data;
ObjDesc->Buffer.AmlLength = Op->Named.Length;
break;
@@ -590,8 +629,8 @@ AcpiDsInitObjectFromOp (
/*
* Defer evaluation of Package TermArg operand
*/
- ObjDesc->Package.Node = (ACPI_NAMESPACE_NODE *)
- WalkState->Operands[0];
+ ObjDesc->Package.Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE,
+ WalkState->Operands[0]);
ObjDesc->Package.AmlStart = Op->Named.Data;
ObjDesc->Package.AmlLength = Op->Named.Length;
break;
@@ -642,8 +681,8 @@ AcpiDsInitObjectFromOp (
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Unknown constant opcode %X\n", Opcode));
+ ACPI_ERROR ((AE_INFO,
+ "Unknown constant opcode %X", Opcode));
Status = AE_AML_OPERAND_TYPE;
break;
}
@@ -660,7 +699,7 @@ AcpiDsInitObjectFromOp (
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Integer type %X\n",
+ ACPI_ERROR ((AE_INFO, "Unknown Integer type %X",
OpInfo->Type));
Status = AE_AML_OPERAND_TYPE;
break;
@@ -737,7 +776,7 @@ AcpiDsInitObjectFromOp (
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unimplemented data type: %X\n",
+ ACPI_ERROR ((AE_INFO, "Unimplemented data type: %X",
ACPI_GET_OBJECT_TYPE (ObjDesc)));
Status = AE_AML_OPERAND_TYPE;
diff --git a/sys/contrib/dev/acpica/dsopcode.c b/sys/contrib/dev/acpica/dsopcode.c
index 6b1ed3a..7760ac6 100644
--- a/sys/contrib/dev/acpica/dsopcode.c
+++ b/sys/contrib/dev/acpica/dsopcode.c
@@ -2,7 +2,7 @@
*
* Module Name: dsopcode - Dispatcher Op Region support and handling of
* "control" opcodes
- * $Revision: 1.103 $
+ * $Revision: 1.111 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -174,7 +174,7 @@ AcpiDsExecuteArguments (
ACPI_WALK_STATE *WalkState;
- ACPI_FUNCTION_TRACE ("DsExecuteArguments");
+ ACPI_FUNCTION_TRACE (DsExecuteArguments);
/*
@@ -200,7 +200,7 @@ AcpiDsExecuteArguments (
}
Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, AmlStart,
- AmlLength, NULL, 1);
+ AmlLength, NULL, ACPI_IMODE_LOAD_PASS1);
if (ACPI_FAILURE (Status))
{
AcpiDsDeleteWalkState (WalkState);
@@ -247,7 +247,7 @@ AcpiDsExecuteArguments (
/* Execute the opcode and arguments */
Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, AmlStart,
- AmlLength, NULL, 3);
+ AmlLength, NULL, ACPI_IMODE_EXECUTE);
if (ACPI_FAILURE (Status))
{
AcpiDsDeleteWalkState (WalkState);
@@ -287,7 +287,7 @@ AcpiDsGetBufferFieldArguments (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE_PTR ("DsGetBufferFieldArguments", ObjDesc);
+ ACPI_FUNCTION_TRACE_PTR (DsGetBufferFieldArguments, ObjDesc);
if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
@@ -333,7 +333,7 @@ AcpiDsGetBufferArguments (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE_PTR ("DsGetBufferArguments", ObjDesc);
+ ACPI_FUNCTION_TRACE_PTR (DsGetBufferArguments, ObjDesc);
if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
@@ -346,8 +346,8 @@ AcpiDsGetBufferArguments (
Node = ObjDesc->Buffer.Node;
if (!Node)
{
- ACPI_REPORT_ERROR ((
- "No pointer back to NS node in buffer obj %p\n", ObjDesc));
+ ACPI_ERROR ((AE_INFO,
+ "No pointer back to NS node in buffer obj %p", ObjDesc));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
@@ -382,7 +382,7 @@ AcpiDsGetPackageArguments (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE_PTR ("DsGetPackageArguments", ObjDesc);
+ ACPI_FUNCTION_TRACE_PTR (DsGetPackageArguments, ObjDesc);
if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
@@ -395,8 +395,8 @@ AcpiDsGetPackageArguments (
Node = ObjDesc->Package.Node;
if (!Node)
{
- ACPI_REPORT_ERROR ((
- "No pointer back to NS node in package %p\n", ObjDesc));
+ ACPI_ERROR ((AE_INFO,
+ "No pointer back to NS node in package %p", ObjDesc));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
@@ -432,7 +432,7 @@ AcpiDsGetRegionArguments (
ACPI_OPERAND_OBJECT *ExtraDesc;
- ACPI_FUNCTION_TRACE_PTR ("DsGetRegionArguments", ObjDesc);
+ ACPI_FUNCTION_TRACE_PTR (DsGetRegionArguments, ObjDesc);
if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID)
@@ -459,6 +459,28 @@ 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);
}
@@ -525,15 +547,15 @@ AcpiDsInitBufferField (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE_PTR ("DsInitBufferField", ObjDesc);
+ ACPI_FUNCTION_TRACE_PTR (DsInitBufferField, ObjDesc);
/* Host object must be a Buffer */
if (ACPI_GET_OBJECT_TYPE (BufferDesc) != ACPI_TYPE_BUFFER)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Target of Create Field is not a Buffer object - %s\n",
+ ACPI_ERROR ((AE_INFO,
+ "Target of Create Field is not a Buffer object - %s",
AcpiUtGetObjectTypeName (BufferDesc)));
Status = AE_AML_OPERAND_TYPE;
@@ -547,10 +569,10 @@ AcpiDsInitBufferField (
*/
if (ACPI_GET_DESCRIPTOR_TYPE (ResultDesc) != ACPI_DESC_TYPE_NAMED)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "(%s) destination not a NS Node [%s]\n",
- AcpiPsGetOpcodeName (AmlOpcode),
- AcpiUtGetDescriptorName (ResultDesc)));
+ ACPI_ERROR ((AE_INFO,
+ "(%s) destination not a NS Node [%s]",
+ AcpiPsGetOpcodeName (AmlOpcode),
+ AcpiUtGetDescriptorName (ResultDesc)));
Status = AE_AML_OPERAND_TYPE;
goto Cleanup;
@@ -575,8 +597,8 @@ AcpiDsInitBufferField (
if (BitCount == 0)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Attempt to CreateField of length 0\n"));
+ ACPI_ERROR ((AE_INFO,
+ "Attempt to CreateField of length zero"));
Status = AE_AML_OPERAND_VALUE;
goto Cleanup;
}
@@ -629,8 +651,8 @@ AcpiDsInitBufferField (
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Unknown field creation opcode %02x\n",
+ ACPI_ERROR ((AE_INFO,
+ "Unknown field creation opcode %02x",
AmlOpcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
@@ -641,12 +663,12 @@ AcpiDsInitBufferField (
if ((BitOffset + BitCount) >
(8 * (UINT32) BufferDesc->Buffer.Length))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Field [%4.4s] size %d exceeds Buffer [%4.4s] size %d (bits)\n",
- AcpiUtGetNodeName (ResultDesc),
- BitOffset + BitCount,
- AcpiUtGetNodeName (BufferDesc->Buffer.Node),
- 8 * (UINT32) BufferDesc->Buffer.Length));
+ ACPI_ERROR ((AE_INFO,
+ "Field [%4.4s] at %d exceeds Buffer [%4.4s] size %d (bits)",
+ AcpiUtGetNodeName (ResultDesc),
+ BitOffset + BitCount,
+ AcpiUtGetNodeName (BufferDesc->Buffer.Node),
+ 8 * (UINT32) BufferDesc->Buffer.Length));
Status = AE_AML_BUFFER_LIMIT;
goto Cleanup;
}
@@ -725,7 +747,7 @@ AcpiDsEvalBufferFieldOperands (
ACPI_PARSE_OBJECT *NextOp;
- ACPI_FUNCTION_TRACE_PTR ("DsEvalBufferFieldOperands", Op);
+ ACPI_FUNCTION_TRACE_PTR (DsEvalBufferFieldOperands, Op);
/*
@@ -763,7 +785,7 @@ AcpiDsEvalBufferFieldOperands (
if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "(%s) bad operand(s) (%X)\n",
+ ACPI_ERROR ((AE_INFO, "(%s) bad operand(s) (%X)",
AcpiPsGetOpcodeName (Op->Common.AmlOpcode), Status));
return_ACPI_STATUS (Status);
@@ -818,7 +840,7 @@ AcpiDsEvalRegionOperands (
ACPI_PARSE_OBJECT *NextOp;
- ACPI_FUNCTION_TRACE_PTR ("DsEvalRegionOperands", Op);
+ ACPI_FUNCTION_TRACE_PTR (DsEvalRegionOperands, Op);
/*
@@ -920,11 +942,17 @@ AcpiDsEvalDataObjectOperands (
UINT32 Length;
- ACPI_FUNCTION_TRACE ("DsEvalDataObjectOperands");
+ ACPI_FUNCTION_TRACE (DsEvalDataObjectOperands);
/* The first operand (for all of these data objects) is the length */
+ /*
+ * Set proper index into operand stack for AcpiDsObjStackPush
+ * invoked inside AcpiDsCreateOperand.
+ */
+ WalkState->OperandIndex = WalkState->NumOperands;
+
Status = AcpiDsCreateOperand (WalkState, Op->Common.Value.Arg, 1);
if (ACPI_FAILURE (Status))
{
@@ -1017,7 +1045,7 @@ AcpiDsExecBeginControlOp (
ACPI_GENERIC_STATE *ControlState;
- ACPI_FUNCTION_NAME ("DsExecBeginControlOp");
+ ACPI_FUNCTION_NAME (DsExecBeginControlOp);
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p Opcode=%2.2X State=%p\n", Op,
@@ -1100,7 +1128,7 @@ AcpiDsExecEndControlOp (
ACPI_GENERIC_STATE *ControlState;
- ACPI_FUNCTION_NAME ("DsExecEndControlOp");
+ ACPI_FUNCTION_NAME (DsExecEndControlOp);
switch (Op->Common.AmlOpcode)
@@ -1195,8 +1223,7 @@ AcpiDsExecEndControlOp (
*/
WalkState->ReturnDesc = WalkState->Operands[0];
}
- else if ((WalkState->Results) &&
- (WalkState->Results->Results.NumResults > 0))
+ else if (WalkState->ResultCount)
{
/* Since we have a real Return(), delete any implicit return */
@@ -1305,7 +1332,7 @@ AcpiDsExecEndControlOp (
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown control opcode=%X Op=%p\n",
+ ACPI_ERROR ((AE_INFO, "Unknown control opcode=%X Op=%p",
Op->Common.AmlOpcode, Op));
Status = AE_AML_BAD_OPCODE;
diff --git a/sys/contrib/dev/acpica/dsutils.c b/sys/contrib/dev/acpica/dsutils.c
index eb7149a..eb75947 100644
--- a/sys/contrib/dev/acpica/dsutils.c
+++ b/sys/contrib/dev/acpica/dsutils.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dsutils - Dispatcher utilities
- * $Revision: 1.115 $
+ * $Revision: 1.124 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -147,7 +147,7 @@ void
AcpiDsClearImplicitReturn (
ACPI_WALK_STATE *WalkState)
{
- ACPI_FUNCTION_NAME ("DsClearImplicitReturn");
+ ACPI_FUNCTION_NAME (DsClearImplicitReturn);
/*
@@ -200,7 +200,7 @@ AcpiDsDoImplicitReturn (
ACPI_WALK_STATE *WalkState,
BOOLEAN AddReference)
{
- ACPI_FUNCTION_NAME ("DsDoImplicitReturn");
+ ACPI_FUNCTION_NAME (DsDoImplicitReturn);
/*
@@ -265,14 +265,14 @@ AcpiDsIsResultUsed (
{
const ACPI_OPCODE_INFO *ParentInfo;
- ACPI_FUNCTION_TRACE_PTR ("DsIsResultUsed", Op);
+ ACPI_FUNCTION_TRACE_PTR (DsIsResultUsed, Op);
/* Must have both an Op and a Result Object */
if (!Op)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Op\n"));
+ ACPI_ERROR ((AE_INFO, "Null Op"));
return_UINT8 (TRUE);
}
@@ -311,8 +311,8 @@ AcpiDsIsResultUsed (
ParentInfo = AcpiPsGetOpcodeInfo (Op->Common.Parent->Common.AmlOpcode);
if (ParentInfo->Class == AML_CLASS_UNKNOWN)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Unknown parent opcode. Op=%p\n", Op));
+ ACPI_ERROR ((AE_INFO,
+ "Unknown parent opcode Op=%p", Op));
return_UINT8 (FALSE);
}
@@ -442,12 +442,12 @@ AcpiDsDeleteResultIfNotUsed (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE_PTR ("DsDeleteResultIfNotUsed", ResultObj);
+ ACPI_FUNCTION_TRACE_PTR (DsDeleteResultIfNotUsed, ResultObj);
if (!Op)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Op\n"));
+ ACPI_ERROR ((AE_INFO, "Null Op"));
return_VOID;
}
@@ -493,7 +493,7 @@ AcpiDsResolveOperands (
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE_PTR ("DsResolveOperands", WalkState);
+ ACPI_FUNCTION_TRACE_PTR (DsResolveOperands, WalkState);
/*
@@ -533,7 +533,7 @@ AcpiDsClearOperands (
UINT32 i;
- ACPI_FUNCTION_TRACE_PTR ("DsClearOperands", WalkState);
+ ACPI_FUNCTION_TRACE_PTR (DsClearOperands, WalkState);
/* Remove a reference on each operand on the stack */
@@ -587,13 +587,14 @@ AcpiDsCreateOperand (
const ACPI_OPCODE_INFO *OpInfo;
- ACPI_FUNCTION_TRACE_PTR ("DsCreateOperand", Arg);
+ ACPI_FUNCTION_TRACE_PTR (DsCreateOperand, Arg);
/* A valid name must be looked up in the namespace */
if ((Arg->Common.AmlOpcode == AML_INT_NAMEPATH_OP) &&
- (Arg->Common.Value.String))
+ (Arg->Common.Value.String) &&
+ !(Arg->Common.Flags & ACPI_PARSEOP_IN_STACK))
{
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Getting a name: Arg=%p\n", Arg));
@@ -620,7 +621,7 @@ AcpiDsCreateOperand (
*/
if ((WalkState->DeferredNode) &&
(WalkState->DeferredNode->Type == ACPI_TYPE_BUFFER_FIELD) &&
- (ArgIndex != 0))
+ (ArgIndex == (UINT32) ((WalkState->Opcode == AML_CREATE_FIELD_OP) ? 3 : 2)))
{
ObjDesc = ACPI_CAST_PTR (
ACPI_OPERAND_OBJECT, WalkState->DeferredNode);
@@ -687,13 +688,13 @@ AcpiDsCreateOperand (
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_NSERROR (NameString, Status);
+ ACPI_ERROR_NAMESPACE (NameString, Status);
}
}
/* Free the namestring created above */
- ACPI_MEM_FREE (NameString);
+ ACPI_FREE (NameString);
/* Check status from the lookup */
@@ -715,7 +716,8 @@ AcpiDsCreateOperand (
{
/* Check for null name case */
- if (Arg->Common.AmlOpcode == AML_INT_NAMEPATH_OP)
+ if ((Arg->Common.AmlOpcode == AML_INT_NAMEPATH_OP) &&
+ !(Arg->Common.Flags & ACPI_PARSEOP_IN_STACK))
{
/*
* If the name is null, this means that this is an
@@ -741,7 +743,7 @@ AcpiDsCreateOperand (
return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
}
- if (OpInfo->Flags & AML_HAS_RETVAL)
+ if ((OpInfo->Flags & AML_HAS_RETVAL) || (Arg->Common.Flags & ACPI_PARSEOP_IN_STACK))
{
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"Argument previously created, already stacked\n"));
@@ -753,16 +755,15 @@ AcpiDsCreateOperand (
* Use value that was already previously returned
* by the evaluation of this argument
*/
- Status = AcpiDsResultPopFromBottom (&ObjDesc, WalkState);
+ Status = AcpiDsResultPop (&ObjDesc, WalkState);
if (ACPI_FAILURE (Status))
{
/*
* Only error is underflow, and this indicates
* a missing or null operand!
*/
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Missing or null operand, %s\n",
- AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Missing or null operand"));
return_ACPI_STATUS (Status);
}
}
@@ -824,30 +825,59 @@ AcpiDsCreateOperands (
{
ACPI_STATUS Status = AE_OK;
ACPI_PARSE_OBJECT *Arg;
- UINT32 ArgCount = 0;
+ ACPI_PARSE_OBJECT *Arguments[ACPI_OBJ_NUM_OPERANDS];
+ UINT8 ArgCount = 0;
+ UINT8 Count = 0;
+ UINT8 Index = WalkState->NumOperands;
+ UINT8 i;
- ACPI_FUNCTION_TRACE_PTR ("DsCreateOperands", FirstArg);
+ ACPI_FUNCTION_TRACE_PTR (DsCreateOperands, FirstArg);
- /* For all arguments in the list... */
+ /* Get all arguments in the list */
Arg = FirstArg;
while (Arg)
{
- Status = AcpiDsCreateOperand (WalkState, Arg, ArgCount);
- if (ACPI_FAILURE (Status))
+ if (Index >= ACPI_OBJ_NUM_OPERANDS)
{
- goto Cleanup;
+ return_ACPI_STATUS (AE_BAD_DATA);
}
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Arg #%d (%p) done, Arg1=%p\n",
- ArgCount, Arg, FirstArg));
+ Arguments[Index] = Arg;
+ WalkState->Operands [Index] = NULL;
/* Move on to next argument, if any */
Arg = Arg->Common.Next;
ArgCount++;
+ Index++;
+ }
+
+ Index--;
+
+ /* It is the appropriate order to get objects from the Result stack */
+
+ for (i = 0; i < ArgCount; i++)
+ {
+ Arg = Arguments[Index];
+
+ /* Force the filling of the operand stack in inverse order */
+
+ WalkState->OperandIndex = Index;
+
+ Status = AcpiDsCreateOperand (WalkState, Arg, Index);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+
+ Count++;
+ Index--;
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Arg #%d (%p) done, Arg1=%p\n",
+ Index, Arg, FirstArg));
}
return_ACPI_STATUS (Status);
@@ -859,11 +889,122 @@ Cleanup:
* pop everything off of the operand stack and delete those
* objects
*/
- (void) AcpiDsObjStackPopAndDelete (ArgCount, WalkState);
+ AcpiDsObjStackPopAndDelete (ArgCount, WalkState);
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "While creating Arg %d - %s\n",
- (ArgCount + 1), AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status, "While creating Arg %d", Index));
return_ACPI_STATUS (Status);
}
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiDsEvaluateNamePath
+ *
+ * PARAMETERS: WalkState - Current state of the parse tree walk,
+ * the opcode of current operation should be
+ * AML_INT_NAMEPATH_OP
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Translate the -NamePath- parse tree object to the equivalent
+ * interpreter object, convert it to value, if needed, duplicate
+ * it, if needed, and push it onto the current result stack.
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+AcpiDsEvaluateNamePath (
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status = AE_OK;
+ ACPI_PARSE_OBJECT *Op = WalkState->Op;
+ ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
+ ACPI_OPERAND_OBJECT *NewObjDesc;
+ UINT8 Type;
+
+
+ ACPI_FUNCTION_TRACE_PTR (DsEvaluateNamePath, WalkState);
+
+
+ if (!Op->Common.Parent)
+ {
+ /* This happens after certain exception processing */
+
+ goto Exit;
+ }
+
+ if ((Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) ||
+ (Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP) ||
+ (Op->Common.Parent->Common.AmlOpcode == AML_REF_OF_OP))
+ {
+ /* TBD: Should we specify this feature as a bit of OpInfo->Flags of these opcodes? */
+
+ goto Exit;
+ }
+
+ Status = AcpiDsCreateOperand (WalkState, Op, 0);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Exit;
+ }
+
+ if (Op->Common.Flags & ACPI_PARSEOP_TARGET)
+ {
+ NewObjDesc = *Operand;
+ goto PushResult;
+ }
+
+ Type = ACPI_GET_OBJECT_TYPE (*Operand);
+
+ Status = AcpiExResolveToValue (Operand, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Exit;
+ }
+
+ if (Type == ACPI_TYPE_INTEGER)
+ {
+ /* It was incremented by AcpiExResolveToValue */
+
+ AcpiUtRemoveReference (*Operand);
+
+ Status = AcpiUtCopyIobjectToIobject (*Operand, &NewObjDesc, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Exit;
+ }
+ }
+ else
+ {
+ /*
+ * The object either was anew created or is
+ * a Namespace node - don't decrement it.
+ */
+ NewObjDesc = *Operand;
+ }
+
+ /* Cleanup for name-path operand */
+
+ Status = AcpiDsObjStackPop (1, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ WalkState->ResultObj = NewObjDesc;
+ goto Exit;
+ }
+
+PushResult:
+
+ WalkState->ResultObj = NewObjDesc;
+
+ Status = AcpiDsResultPush (WalkState->ResultObj, WalkState);
+ if (ACPI_SUCCESS (Status))
+ {
+ /* Force to take it from stack */
+
+ Op->Common.Flags |= ACPI_PARSEOP_IN_STACK;
+ }
+
+Exit:
+
+ return_ACPI_STATUS (Status);
+}
diff --git a/sys/contrib/dev/acpica/dswexec.c b/sys/contrib/dev/acpica/dswexec.c
index d499afa..0eef999 100644
--- a/sys/contrib/dev/acpica/dswexec.c
+++ b/sys/contrib/dev/acpica/dswexec.c
@@ -2,7 +2,7 @@
*
* Module Name: dswexec - Dispatcher method execution callbacks;
* dispatch to interpreter.
- * $Revision: 1.120 $
+ * $Revision: 1.134 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -124,7 +124,6 @@
#include <contrib/dev/acpica/acinterp.h>
#include <contrib/dev/acpica/acnamesp.h>
#include <contrib/dev/acpica/acdebug.h>
-#include <contrib/dev/acpica/acdisasm.h>
#define _COMPONENT ACPI_DISPATCHER
@@ -133,19 +132,21 @@
/*
* Dispatch table for opcode classes
*/
-static ACPI_EXECUTE_OP AcpiGbl_OpTypeDispatch [] = {
- AcpiExOpcode_0A_0T_1R,
- AcpiExOpcode_1A_0T_0R,
- AcpiExOpcode_1A_0T_1R,
- AcpiExOpcode_1A_1T_0R,
- AcpiExOpcode_1A_1T_1R,
- AcpiExOpcode_2A_0T_0R,
- AcpiExOpcode_2A_0T_1R,
- AcpiExOpcode_2A_1T_1R,
- AcpiExOpcode_2A_2T_1R,
- AcpiExOpcode_3A_0T_0R,
- AcpiExOpcode_3A_1T_1R,
- AcpiExOpcode_6A_0T_1R};
+static ACPI_EXECUTE_OP AcpiGbl_OpTypeDispatch [] =
+{
+ AcpiExOpcode_0A_0T_1R,
+ AcpiExOpcode_1A_0T_0R,
+ AcpiExOpcode_1A_0T_1R,
+ AcpiExOpcode_1A_1T_0R,
+ AcpiExOpcode_1A_1T_1R,
+ AcpiExOpcode_2A_0T_0R,
+ AcpiExOpcode_2A_0T_1R,
+ AcpiExOpcode_2A_1T_1R,
+ AcpiExOpcode_2A_2T_1R,
+ AcpiExOpcode_3A_0T_0R,
+ AcpiExOpcode_3A_1T_1R,
+ AcpiExOpcode_6A_0T_1R
+};
/*****************************************************************************
@@ -171,7 +172,7 @@ AcpiDsGetPredicateValue (
ACPI_OPERAND_OBJECT *LocalObjDesc = NULL;
- ACPI_FUNCTION_TRACE_PTR ("DsGetPredicateValue", WalkState);
+ ACPI_FUNCTION_TRACE_PTR (DsGetPredicateValue, WalkState);
WalkState->ControlState->Common.State = 0;
@@ -181,9 +182,8 @@ AcpiDsGetPredicateValue (
Status = AcpiDsResultPop (&ObjDesc, WalkState);
if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Could not get result from predicate evaluation, %s\n",
- AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Could not get result from predicate evaluation"));
return_ACPI_STATUS (Status);
}
@@ -207,8 +207,8 @@ AcpiDsGetPredicateValue (
if (!ObjDesc)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "No predicate ObjDesc=%p State=%p\n",
+ ACPI_ERROR ((AE_INFO,
+ "No predicate ObjDesc=%p State=%p",
ObjDesc, WalkState));
return_ACPI_STATUS (AE_AML_NO_OPERAND);
@@ -226,8 +226,8 @@ AcpiDsGetPredicateValue (
if (ACPI_GET_OBJECT_TYPE (LocalObjDesc) != ACPI_TYPE_INTEGER)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Bad predicate (not an integer) ObjDesc=%p State=%p Type=%X\n",
+ ACPI_ERROR ((AE_INFO,
+ "Bad predicate (not an integer) ObjDesc=%p State=%p Type=%X",
ObjDesc, WalkState, ACPI_GET_OBJECT_TYPE (ObjDesc)));
Status = AE_AML_OPERAND_TYPE;
@@ -306,7 +306,7 @@ AcpiDsExecBeginOp (
UINT32 OpcodeClass;
- ACPI_FUNCTION_TRACE_PTR ("DsExecBeginOp", WalkState);
+ ACPI_FUNCTION_TRACE_PTR (DsExecBeginOp, WalkState);
Op = WalkState->Op;
@@ -315,7 +315,7 @@ AcpiDsExecBeginOp (
Status = AcpiDsLoad2BeginOp (WalkState, OutOp);
if (ACPI_FAILURE (Status))
{
- return_ACPI_STATUS (Status);
+ goto ErrorExit;
}
Op = *OutOp;
@@ -332,7 +332,7 @@ AcpiDsExecBeginOp (
Status = AcpiDsScopeStackPop (WalkState);
if (ACPI_FAILURE (Status))
{
- return_ACPI_STATUS (Status);
+ goto ErrorExit;
}
}
}
@@ -383,19 +383,13 @@ AcpiDsExecBeginOp (
{
case AML_CLASS_CONTROL:
- Status = AcpiDsResultStackPush (WalkState);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
Status = AcpiDsExecBeginControlOp (WalkState, Op);
break;
case AML_CLASS_NAMED_OBJECT:
- if (WalkState->WalkType == ACPI_WALK_METHOD)
+ if (WalkState->WalkType & ACPI_WALK_METHOD)
{
/*
* Found a named object declaration during method execution;
@@ -406,21 +400,12 @@ AcpiDsExecBeginOp (
Status = AcpiDsLoad2BeginOp (WalkState, NULL);
}
- if (Op->Common.AmlOpcode == AML_REGION_OP)
- {
- Status = AcpiDsResultStackPush (WalkState);
- }
break;
case AML_CLASS_EXECUTE:
case AML_CLASS_CREATE:
- /*
- * Most operators with arguments.
- * Start a new result/operand state
- */
- Status = AcpiDsResultStackPush (WalkState);
break;
@@ -431,6 +416,11 @@ AcpiDsExecBeginOp (
/* Nothing to do here during method execution */
return_ACPI_STATUS (Status);
+
+
+ErrorExit:
+ Status = AcpiDsMethodError (Status, WalkState);
+ return_ACPI_STATUS (Status);
}
@@ -460,7 +450,7 @@ AcpiDsExecEndOp (
ACPI_PARSE_OBJECT *FirstArg;
- ACPI_FUNCTION_TRACE_PTR ("DsExecEndOp", WalkState);
+ ACPI_FUNCTION_TRACE_PTR (DsExecEndOp, WalkState);
Op = WalkState->Op;
@@ -469,7 +459,7 @@ AcpiDsExecEndOp (
if (OpClass == AML_CLASS_UNKNOWN)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown opcode %X\n", Op->Common.AmlOpcode));
+ ACPI_ERROR ((AE_INFO, "Unknown opcode %X", Op->Common.AmlOpcode));
return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
}
@@ -478,6 +468,7 @@ AcpiDsExecEndOp (
/* Init the walk state */
WalkState->NumOperands = 0;
+ WalkState->OperandIndex = 0;
WalkState->ReturnDesc = NULL;
WalkState->ResultObj = NULL;
@@ -490,11 +481,20 @@ AcpiDsExecEndOp (
switch (OpClass)
{
- case AML_CLASS_ARGUMENT: /* constants, literals, etc. - do nothing */
+ case AML_CLASS_ARGUMENT: /* Constants, literals, etc. */
+
+ if (WalkState->Opcode == AML_INT_NAMEPATH_OP)
+ {
+ Status = AcpiDsEvaluateNamePath (WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+ }
break;
- case AML_CLASS_EXECUTE: /* most operators with arguments */
+ case AML_CLASS_EXECUTE: /* Most operators with arguments */
/* Build resolved operand stack */
@@ -504,14 +504,6 @@ AcpiDsExecEndOp (
goto Cleanup;
}
- /* Done with this result state (Now that operand stack is built) */
-
- Status = AcpiDsResultStackPop (WalkState);
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
-
/*
* All opcodes require operand resolution, with the only exceptions
* being the ObjectType and SizeOf operators.
@@ -559,10 +551,9 @@ AcpiDsExecEndOp (
}
else
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "[%s]: Could not resolve operands, %s\n",
- AcpiPsGetOpcodeName (WalkState->Opcode),
- AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "While resolving operands for [%s]",
+ AcpiPsGetOpcodeName (WalkState->Opcode)));
}
}
@@ -579,7 +570,6 @@ AcpiDsExecEndOp (
{
Status = AcpiDsResultPush (WalkState->ResultObj, WalkState);
}
-
break;
@@ -593,20 +583,6 @@ AcpiDsExecEndOp (
Status = AcpiDsExecEndControlOp (WalkState, Op);
- /* Make sure to properly pop the result stack */
-
- if (ACPI_SUCCESS (Status))
- {
- Status = AcpiDsResultStackPop (WalkState);
- }
- else if (Status == AE_CTRL_PENDING)
- {
- Status = AcpiDsResultStackPop (WalkState);
- if (ACPI_SUCCESS (Status))
- {
- Status = AE_CTRL_PENDING;
- }
- }
break;
@@ -623,6 +599,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;
AcpiUtAddReference (Op->Asl.Value.Arg->Asl.Node->Object);
return_ACPI_STATUS (AE_OK);
@@ -732,14 +709,6 @@ AcpiDsExecEndOp (
break;
}
- /* Done with result state (Now that operand stack is built) */
-
- Status = AcpiDsResultStackPop (WalkState);
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
-
/*
* If a result object was returned from above, push it on the
* current result stack
@@ -772,17 +741,14 @@ AcpiDsExecEndOp (
{
break;
}
-
- Status = AcpiDsResultStackPop (WalkState);
}
-
break;
case AML_TYPE_UNDEFINED:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Undefined opcode type Op=%p\n", Op));
+ ACPI_ERROR ((AE_INFO,
+ "Undefined opcode type Op=%p", Op));
return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
@@ -796,8 +762,8 @@ AcpiDsExecEndOp (
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Unimplemented opcode, class=%X type=%X Opcode=%X Op=%p\n",
+ ACPI_ERROR ((AE_INFO,
+ "Unimplemented opcode, class=%X type=%X Opcode=%X Op=%p",
OpClass, OpType, Op->Common.AmlOpcode, Op));
Status = AE_NOT_IMPLEMENTED;
@@ -815,7 +781,6 @@ AcpiDsExecEndOp (
* Check if we just completed the evaluation of a
* conditional predicate
*/
-
if ((ACPI_SUCCESS (Status)) &&
(WalkState->ControlState) &&
(WalkState->ControlState->Common.State ==
@@ -829,19 +794,6 @@ AcpiDsExecEndOp (
Cleanup:
- /* Invoke exception handler on error */
-
- if (ACPI_FAILURE (Status) &&
- AcpiGbl_ExceptionHandler &&
- !(Status & AE_CODE_CONTROL))
- {
- AcpiExExitInterpreter ();
- Status = AcpiGbl_ExceptionHandler (Status,
- WalkState->MethodNode->Name.Integer, WalkState->Opcode,
- WalkState->AmlOffset, NULL);
- (void) AcpiExEnterInterpreter ();
- }
-
if (WalkState->ResultObj)
{
/* Break to debugger to display result */
@@ -865,20 +817,16 @@ Cleanup:
}
#endif
- /* Always clear the object stack */
-
- WalkState->NumOperands = 0;
-
-#ifdef ACPI_DISASSEMBLER
-
- /* On error, display method locals/args */
+ /* Invoke exception handler on error */
if (ACPI_FAILURE (Status))
{
- AcpiDmDumpMethodInfo (Status, WalkState, Op);
+ Status = AcpiDsMethodError (Status, WalkState);
}
-#endif
+ /* Always clear the object stack */
+
+ WalkState->NumOperands = 0;
return_ACPI_STATUS (Status);
}
diff --git a/sys/contrib/dev/acpica/dswload.c b/sys/contrib/dev/acpica/dswload.c
index a11dc55..7a65942 100644
--- a/sys/contrib/dev/acpica/dswload.c
+++ b/sys/contrib/dev/acpica/dswload.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dswload - Dispatcher namespace load callbacks
- * $Revision: 1.98 $
+ * $Revision: 1.117 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -210,7 +210,7 @@ AcpiDsLoad1BeginOp (
UINT32 Flags;
- ACPI_FUNCTION_NAME ("DsLoad1BeginOp");
+ ACPI_FUNCTION_TRACE (DsLoad1BeginOp);
Op = WalkState->Op;
@@ -223,7 +223,7 @@ AcpiDsLoad1BeginOp (
if (!(WalkState->OpInfo->Flags & AML_NAMED))
{
*OutOp = Op;
- return (AE_OK);
+ return_ACPI_STATUS (AE_OK);
}
/* Check if this object has already been installed in the namespace */
@@ -231,7 +231,7 @@ AcpiDsLoad1BeginOp (
if (Op->Common.Node)
{
*OutOp = Op;
- return (AE_OK);
+ return_ACPI_STATUS (AE_OK);
}
}
@@ -260,19 +260,19 @@ AcpiDsLoad1BeginOp (
{
/*
* Table disassembly:
- * Target of Scope() not found. Generate an External for it, and
+ * Target of Scope() not found. Generate an External for it, and
* insert the name into the namespace.
*/
- AcpiDmAddToExternalList (Path);
+ AcpiDmAddToExternalList (Path, ACPI_TYPE_DEVICE, 0);
Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT,
- WalkState, &(Node));
+ WalkState, &Node);
}
#endif
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_NSERROR (Path, Status);
- return (Status);
+ ACPI_ERROR_NAMESPACE (Path, Status);
+ return_ACPI_STATUS (Status);
}
/*
@@ -281,6 +281,7 @@ AcpiDsLoad1BeginOp (
*/
switch (Node->Type)
{
+ case ACPI_TYPE_ANY:
case ACPI_TYPE_LOCAL_SCOPE: /* Scope */
case ACPI_TYPE_DEVICE:
case ACPI_TYPE_POWER:
@@ -295,16 +296,15 @@ AcpiDsLoad1BeginOp (
case ACPI_TYPE_BUFFER:
/*
- * These types we will allow, but we will change the type. This
+ * These types we will allow, but we will change the type. This
* enables some existing code of the form:
*
* Name (DEB, 0)
* Scope (DEB) { ... }
*
- * Note: silently change the type here. On the second pass, we will report
+ * Note: silently change the type here. On the second pass, we will report
* a warning
*/
-
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n",
Path, AcpiUtGetTypeName (Node->Type)));
@@ -317,17 +317,16 @@ AcpiDsLoad1BeginOp (
/* All other types are an error */
- ACPI_REPORT_ERROR ((
- "Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)\n",
+ ACPI_ERROR ((AE_INFO,
+ "Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)",
AcpiUtGetTypeName (Node->Type), Path));
- return (AE_AML_OPERAND_TYPE);
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
break;
default:
-
/*
* For all other named opcodes, we will enter the name into
* the namespace.
@@ -353,6 +352,17 @@ AcpiDsLoad1BeginOp (
break;
}
+ /*
+ * If we are executing a method, do not create any namespace objects
+ * during the load phase, only during execution.
+ */
+ if (WalkState->MethodNode)
+ {
+ Node = NULL;
+ Status = AE_OK;
+ break;
+ }
+
Flags = ACPI_NS_NO_UPSEARCH;
if ((WalkState->Opcode != AML_SCOPE_OP) &&
(!(WalkState->ParseFlags & ACPI_PARSE_DEFERRED_OP)))
@@ -369,22 +379,52 @@ AcpiDsLoad1BeginOp (
}
/*
- * 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.
*/
Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
- ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &(Node));
+ ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &Node);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_NSERROR (Path, Status);
- return (Status);
+ if (Status == AE_ALREADY_EXISTS)
+ {
+ /* The name already exists in this scope */
+
+ if (Node->Flags & ANOBJ_IS_EXTERNAL)
+ {
+ /*
+ * Allow one create on an object or segment that was
+ * previously declared External
+ */
+ Node->Flags &= ~ANOBJ_IS_EXTERNAL;
+ Node->Type = (UINT8) ObjectType;
+
+ /* Just retyped a node, probably will need to open a scope */
+
+ if (AcpiNsOpensScope (ObjectType))
+ {
+ Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ Status = AE_OK;
+ }
+ }
+
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_ERROR_NAMESPACE (Path, Status);
+ return_ACPI_STATUS (Status);
+ }
}
break;
}
-
/* Common exit */
if (!Op)
@@ -394,28 +434,29 @@ AcpiDsLoad1BeginOp (
Op = AcpiPsAllocOp (WalkState->Opcode);
if (!Op)
{
- return (AE_NO_MEMORY);
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
}
- /* Initialize */
-
- Op->Named.Name = Node->Name.Integer;
+ /* Initialize the op */
#if (defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY))
- Op->Named.Path = (UINT8 *) Path;
+ Op->Named.Path = ACPI_CAST_PTR (UINT8, Path);
#endif
+ if (Node)
+ {
+ /*
+ * Put the Node in the "op" object that the parser uses, so we
+ * can get it again quickly when this scope is closed
+ */
+ Op->Common.Node = Node;
+ Op->Named.Name = Node->Name.Integer;
+ }
- /*
- * Put the Node in the "op" object that the parser uses, so we
- * can get it again quickly when this scope is closed
- */
- Op->Common.Node = Node;
AcpiPsAppendArg (AcpiPsGetParentScope (&WalkState->ParserState), Op);
-
*OutOp = Op;
- return (Status);
+ return_ACPI_STATUS (Status);
}
@@ -441,7 +482,7 @@ AcpiDsLoad1EndOp (
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_NAME ("DsLoad1EndOp");
+ ACPI_FUNCTION_TRACE (DsLoad1EndOp);
Op = WalkState->Op;
@@ -451,7 +492,7 @@ AcpiDsLoad1EndOp (
if (!(WalkState->OpInfo->Flags & (AML_NAMED | AML_FIELD)))
{
- return (AE_OK);
+ return_ACPI_STATUS (AE_OK);
}
/* Get the object type to determine if we should pop the scope */
@@ -461,25 +502,37 @@ AcpiDsLoad1EndOp (
#ifndef ACPI_NO_METHOD_EXECUTION
if (WalkState->OpInfo->Flags & AML_FIELD)
{
- if (WalkState->Opcode == AML_FIELD_OP ||
- WalkState->Opcode == AML_BANK_FIELD_OP ||
- WalkState->Opcode == AML_INDEX_FIELD_OP)
+ /*
+ * If we are executing a method, do not create any namespace objects
+ * during the load phase, only during execution.
+ */
+ if (!WalkState->MethodNode)
{
- Status = AcpiDsInitFieldObjects (Op, WalkState);
+ if (WalkState->Opcode == AML_FIELD_OP ||
+ WalkState->Opcode == AML_BANK_FIELD_OP ||
+ WalkState->Opcode == AML_INDEX_FIELD_OP)
+ {
+ Status = AcpiDsInitFieldObjects (Op, WalkState);
+ }
}
- return (Status);
+ return_ACPI_STATUS (Status);
}
-
- if (Op->Common.AmlOpcode == AML_REGION_OP)
+ /*
+ * If we are executing a method, do not create any namespace objects
+ * during the load phase, only during execution.
+ */
+ if (!WalkState->MethodNode)
{
- Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length,
- (ACPI_ADR_SPACE_TYPE)
- ((Op->Common.Value.Arg)->Common.Value.Integer),
- WalkState);
- if (ACPI_FAILURE (Status))
+ if (Op->Common.AmlOpcode == AML_REGION_OP)
{
- return (Status);
+ Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length,
+ (ACPI_ADR_SPACE_TYPE) ((Op->Common.Value.Arg)->Common.Value.Integer),
+ WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
}
}
#endif
@@ -492,48 +545,63 @@ AcpiDsLoad1EndOp (
{
ObjectType = (AcpiPsGetOpcodeInfo (
(Op->Common.Value.Arg)->Common.AmlOpcode))->ObjectType;
- Op->Common.Node->Type = (UINT8) ObjectType;
+
+ /* Set node type if we have a namespace node */
+
+ if (Op->Common.Node)
+ {
+ Op->Common.Node->Type = (UINT8) ObjectType;
+ }
}
}
- if (Op->Common.AmlOpcode == AML_METHOD_OP)
+ /*
+ * If we are executing a method, do not create any namespace objects
+ * during the load phase, only during execution.
+ */
+ if (!WalkState->MethodNode)
{
- /*
- * MethodOp PkgLength NameString MethodFlags TermList
- *
- * Note: We must create the method node/object pair as soon as we
- * see the method declaration. This allows later pass1 parsing
- * of invocations of the method (need to know the number of
- * arguments.)
- */
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "LOADING-Method: State=%p Op=%p NamedObj=%p\n",
- WalkState, Op, Op->Named.Node));
-
- if (!AcpiNsGetAttachedObject (Op->Named.Node))
+ if (Op->Common.AmlOpcode == AML_METHOD_OP)
{
- WalkState->Operands[0] = (void *) Op->Named.Node;
- WalkState->NumOperands = 1;
+ /*
+ * MethodOp PkgLength NameString MethodFlags TermList
+ *
+ * Note: We must create the method node/object pair as soon as we
+ * see the method declaration. This allows later pass1 parsing
+ * of invocations of the method (need to know the number of
+ * arguments.)
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "LOADING-Method: State=%p Op=%p NamedObj=%p\n",
+ WalkState, Op, Op->Named.Node));
- Status = AcpiDsCreateOperands (WalkState, Op->Common.Value.Arg);
- if (ACPI_SUCCESS (Status))
+ if (!AcpiNsGetAttachedObject (Op->Named.Node))
{
- Status = AcpiExCreateMethod (Op->Named.Data,
- Op->Named.Length, WalkState);
- }
- WalkState->Operands[0] = NULL;
- WalkState->NumOperands = 0;
+ WalkState->Operands[0] = ACPI_CAST_PTR (void, Op->Named.Node);
+ WalkState->NumOperands = 1;
- if (ACPI_FAILURE (Status))
- {
- return (Status);
+ Status = AcpiDsCreateOperands (WalkState, Op->Common.Value.Arg);
+ if (ACPI_SUCCESS (Status))
+ {
+ Status = AcpiExCreateMethod (Op->Named.Data,
+ Op->Named.Length, WalkState);
+ }
+
+ WalkState->Operands[0] = NULL;
+ WalkState->NumOperands = 0;
+
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
}
}
}
- /* Pop the scope stack */
+ /* Pop the scope stack (only if loading a table) */
- if (AcpiNsOpensScope (ObjectType))
+ if (!WalkState->MethodNode &&
+ AcpiNsOpensScope (ObjectType))
{
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s): Popping scope for Op %p\n",
AcpiUtGetTypeName (ObjectType), Op));
@@ -541,7 +609,7 @@ AcpiDsLoad1EndOp (
Status = AcpiDsScopeStackPop (WalkState);
}
- return (Status);
+ return_ACPI_STATUS (Status);
}
@@ -568,9 +636,10 @@ AcpiDsLoad2BeginOp (
ACPI_STATUS Status;
ACPI_OBJECT_TYPE ObjectType;
char *BufferPtr;
+ UINT32 Flags;
- ACPI_FUNCTION_TRACE ("DsLoad2BeginOp");
+ ACPI_FUNCTION_TRACE (DsLoad2BeginOp);
Op = WalkState->Op;
@@ -598,7 +667,6 @@ AcpiDsLoad2BeginOp (
if ((WalkState->OpInfo->Class == AML_CLASS_EXECUTE) ||
(WalkState->OpInfo->Class == AML_CLASS_CONTROL))
{
-
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"Begin/EXEC: %s (fl %8.8X)\n", WalkState->OpInfo->Name,
WalkState->OpInfo->Flags));
@@ -630,7 +698,7 @@ AcpiDsLoad2BeginOp (
{
/* Get name from the op */
- BufferPtr = (char *) &Op->Named.Name;
+ BufferPtr = ACPI_CAST_PTR (char, &Op->Named.Name);
}
}
else
@@ -647,7 +715,6 @@ AcpiDsLoad2BeginOp (
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"State=%p Op=%p Type=%X\n", WalkState, Op, ObjectType));
-
switch (WalkState->Opcode)
{
case AML_FIELD_OP:
@@ -659,7 +726,6 @@ AcpiDsLoad2BeginOp (
break;
case AML_INT_NAMEPATH_OP:
-
/*
* The NamePath is an object reference to an existing object.
* Don't enter the name into the namespace, but look it up
@@ -671,7 +737,6 @@ AcpiDsLoad2BeginOp (
break;
case AML_SCOPE_OP:
-
/*
* The Path is an object reference to an existing object.
* Don't enter the name into the namespace, but look it up
@@ -689,19 +754,21 @@ AcpiDsLoad2BeginOp (
}
else
{
- ACPI_REPORT_NSERROR (BufferPtr, Status);
+ ACPI_ERROR_NAMESPACE (BufferPtr, Status);
}
#else
- ACPI_REPORT_NSERROR (BufferPtr, Status);
+ ACPI_ERROR_NAMESPACE (BufferPtr, Status);
#endif
return_ACPI_STATUS (Status);
}
+
/*
* We must check to make sure that the target is
* one of the opcodes that actually opens a scope
*/
switch (Node->Type)
{
+ case ACPI_TYPE_ANY:
case ACPI_TYPE_LOCAL_SCOPE: /* Scope */
case ACPI_TYPE_DEVICE:
case ACPI_TYPE_POWER:
@@ -716,15 +783,14 @@ AcpiDsLoad2BeginOp (
case ACPI_TYPE_BUFFER:
/*
- * These types we will allow, but we will change the type. This
+ * These types we will allow, but we will change the type. This
* enables some existing code of the form:
*
* Name (DEB, 0)
* Scope (DEB) { ... }
*/
-
- ACPI_REPORT_WARNING ((
- "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n",
+ ACPI_WARNING ((AE_INFO,
+ "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)",
BufferPtr, AcpiUtGetTypeName (Node->Type)));
Node->Type = ACPI_TYPE_ANY;
@@ -735,8 +801,8 @@ AcpiDsLoad2BeginOp (
/* All other types are an error */
- ACPI_REPORT_ERROR ((
- "Invalid type (%s) for target of Scope operator [%4.4s]\n",
+ ACPI_ERROR ((AE_INFO,
+ "Invalid type (%s) for target of Scope operator [%4.4s]",
AcpiUtGetTypeName (Node->Type), BufferPtr));
return (AE_AML_OPERAND_TYPE);
@@ -760,14 +826,14 @@ AcpiDsLoad2BeginOp (
{
return_ACPI_STATUS (Status);
}
-
}
+
return_ACPI_STATUS (AE_OK);
}
/*
- * 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.
*
@@ -782,17 +848,24 @@ AcpiDsLoad2BeginOp (
break;
}
- /* Add new entry into namespace */
+ Flags = ACPI_NS_NO_UPSEARCH;
+ if (WalkState->PassNumber == ACPI_IMODE_EXECUTE)
+ {
+ /* Execution mode, node cannot already exist, node is temporary */
+
+ Flags |= (ACPI_NS_ERROR_IF_FOUND | ACPI_NS_TEMPORARY);
+ }
+
+ /* Add new entry or lookup existing entry */
Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType,
- ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH,
- WalkState, &(Node));
+ ACPI_IMODE_LOAD_PASS2, Flags, WalkState, &Node);
break;
}
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_NSERROR (BufferPtr, Status);
+ ACPI_ERROR_NAMESPACE (BufferPtr, Status);
return_ACPI_STATUS (Status);
}
@@ -820,7 +893,6 @@ AcpiDsLoad2BeginOp (
* can get it again quickly when this scope is closed
*/
Op->Common.Node = Node;
-
return_ACPI_STATUS (Status);
}
@@ -853,7 +925,7 @@ AcpiDsLoad2EndOp (
#endif
- ACPI_FUNCTION_TRACE ("DsLoad2EndOp");
+ ACPI_FUNCTION_TRACE (DsLoad2EndOp);
Op = WalkState->Op;
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n",
@@ -961,7 +1033,6 @@ AcpiDsLoad2EndOp (
#ifndef ACPI_NO_METHOD_EXECUTION
case AML_TYPE_CREATE_FIELD:
-
/*
* Create the field object, but the field buffer and index must
* be evaluated later during the execution phase
@@ -971,6 +1042,13 @@ AcpiDsLoad2EndOp (
case AML_TYPE_NAMED_FIELD:
+ /*
+ * If we are executing a method, initialize the field
+ */
+ if (WalkState->MethodNode)
+ {
+ Status = AcpiDsInitFieldObjects (Op, WalkState);
+ }
switch (Op->Common.AmlOpcode)
{
@@ -1061,14 +1139,34 @@ AcpiDsLoad2EndOp (
{
#ifndef ACPI_NO_METHOD_EXECUTION
case AML_REGION_OP:
+
/*
- * The OpRegion is not fully parsed at this time. Only valid
+ * If we are executing a method, initialize the region
+ */
+ if (WalkState->MethodNode)
+ {
+ Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length,
+ (ACPI_ADR_SPACE_TYPE)
+ ((Op->Common.Value.Arg)->Common.Value.Integer),
+ WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+ }
+
+ /*
+ * The OpRegion is not fully parsed at this time. Only valid
* argument is the SpaceId. (We must save the address of the
* AML of the address and length operands)
*/
+
/*
* If we have a valid region, initialize it
* Namespace is NOT locked at this point.
+ *
+ * TBD: need to unlock interpreter if it is locked, in order
+ * to allow _REG methods to be run.
*/
Status = AcpiEvInitializeRegion (AcpiNsGetAttachedObject (Node),
FALSE);
@@ -1091,12 +1189,46 @@ AcpiDsLoad2EndOp (
Status = AcpiDsCreateNode (WalkState, Node, Op);
break;
-#endif /* ACPI_NO_METHOD_EXECUTION */
+ case AML_METHOD_OP:
+ /*
+ * MethodOp PkgLength NameString MethodFlags TermList
+ *
+ * Note: We must create the method node/object pair as soon as we
+ * see the method declaration. This allows later pass1 parsing
+ * of invocations of the method (need to know the number of
+ * arguments.)
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "LOADING-Method: State=%p Op=%p NamedObj=%p\n",
+ WalkState, Op, Op->Named.Node));
+
+ if (!AcpiNsGetAttachedObject (Op->Named.Node))
+ {
+ WalkState->Operands[0] = ACPI_CAST_PTR (void, Op->Named.Node);
+ WalkState->NumOperands = 1;
+
+ Status = AcpiDsCreateOperands (WalkState, Op->Common.Value.Arg);
+ if (ACPI_SUCCESS (Status))
+ {
+ Status = AcpiExCreateMethod (Op->Named.Data,
+ Op->Named.Length, WalkState);
+ }
+ WalkState->Operands[0] = NULL;
+ WalkState->NumOperands = 0;
+
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+ break;
+
+#endif /* ACPI_NO_METHOD_EXECUTION */
+
default:
/* All NAMED_COMPLEX opcodes must be handled above */
- /* Note: Method objects were already created in Pass 1 */
break;
}
break;
@@ -1141,7 +1273,7 @@ AcpiDsLoad2EndOp (
}
else
{
- ACPI_REPORT_NSERROR (Arg->Common.Value.String, Status);
+ ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status);
}
break;
diff --git a/sys/contrib/dev/acpica/dswscope.c b/sys/contrib/dev/acpica/dswscope.c
index 5f1cc62..fc55f13 100644
--- a/sys/contrib/dev/acpica/dswscope.c
+++ b/sys/contrib/dev/acpica/dswscope.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dswscope - Scope stack manipulation
- * $Revision: 1.63 $
+ * $Revision: 1.69 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -143,7 +143,7 @@ AcpiDsScopeStackClear (
{
ACPI_GENERIC_STATE *ScopeInfo;
- ACPI_FUNCTION_NAME ("DsScopeStackClear");
+ ACPI_FUNCTION_NAME (DsScopeStackClear);
while (WalkState->ScopeInfo)
@@ -186,14 +186,14 @@ AcpiDsScopeStackPush (
ACPI_GENERIC_STATE *OldScopeInfo;
- ACPI_FUNCTION_TRACE ("DsScopeStackPush");
+ ACPI_FUNCTION_TRACE (DsScopeStackPush);
if (!Node)
{
/* Invalid scope */
- ACPI_REPORT_ERROR (("DsScopeStackPush: null scope passed\n"));
+ ACPI_ERROR ((AE_INFO, "Null scope parameter"));
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
@@ -201,8 +201,8 @@ AcpiDsScopeStackPush (
if (!AcpiUtValidObjectType (Type))
{
- ACPI_REPORT_WARNING ((
- "DsScopeStackPush: Invalid object type: 0x%X\n", Type));
+ ACPI_WARNING ((AE_INFO,
+ "Invalid object type: 0x%X", Type));
}
/* Allocate a new scope object */
@@ -215,9 +215,9 @@ AcpiDsScopeStackPush (
/* Init new scope object */
- ScopeInfo->Common.DataType = ACPI_DESC_TYPE_STATE_WSCOPE;
- ScopeInfo->Scope.Node = Node;
- ScopeInfo->Common.Value = (UINT16) Type;
+ ScopeInfo->Common.DescriptorType = ACPI_DESC_TYPE_STATE_WSCOPE;
+ ScopeInfo->Scope.Node = Node;
+ ScopeInfo->Common.Value = (UINT16) Type;
WalkState->ScopeDepth++;
@@ -270,7 +270,7 @@ AcpiDsScopeStackPop (
ACPI_GENERIC_STATE *NewScopeInfo;
- ACPI_FUNCTION_TRACE ("DsScopeStackPop");
+ ACPI_FUNCTION_TRACE (DsScopeStackPop);
/*
diff --git a/sys/contrib/dev/acpica/dswstate.c b/sys/contrib/dev/acpica/dswstate.c
index f611d9d..f6f7bd2 100644
--- a/sys/contrib/dev/acpica/dswstate.c
+++ b/sys/contrib/dev/acpica/dswstate.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dswstate - Dispatcher parse tree walk management routines
- * $Revision: 1.90 $
+ * $Revision: 1.101 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -127,290 +127,170 @@
/* Local prototypes */
-#ifdef ACPI_OBSOLETE_FUNCTIONS
-ACPI_STATUS
-AcpiDsResultInsert (
- void *Object,
- UINT32 Index,
- ACPI_WALK_STATE *WalkState);
-
-ACPI_STATUS
-AcpiDsObjStackDeleteAll (
- ACPI_WALK_STATE *WalkState);
-
-ACPI_STATUS
-AcpiDsObjStackPopObject (
- ACPI_OPERAND_OBJECT **Object,
+static ACPI_STATUS
+AcpiDsResultStackPush (
ACPI_WALK_STATE *WalkState);
-void *
-AcpiDsObjStackGetValue (
- UINT32 Index,
+static ACPI_STATUS
+AcpiDsResultStackPop (
ACPI_WALK_STATE *WalkState);
-#endif
/*******************************************************************************
*
- * FUNCTION: AcpiDsResultRemove
+ * FUNCTION: AcpiDsResultPop
*
* PARAMETERS: Object - Where to return the popped object
- * Index - Where to extract the object
* WalkState - Current Walk state
*
* RETURN: Status
*
- * DESCRIPTION: Pop an object off the bottom of this walk's result stack. In
- * other words, this is a FIFO.
+ * DESCRIPTION: Pop an object off the top of this walk's result stack
*
******************************************************************************/
ACPI_STATUS
-AcpiDsResultRemove (
+AcpiDsResultPop (
ACPI_OPERAND_OBJECT **Object,
- UINT32 Index,
ACPI_WALK_STATE *WalkState)
{
+ ACPI_NATIVE_UINT Index;
ACPI_GENERIC_STATE *State;
+ ACPI_STATUS Status;
- ACPI_FUNCTION_NAME ("DsResultRemove");
+ ACPI_FUNCTION_NAME (DsResultPop);
State = WalkState->Results;
- if (!State)
+
+ /* Incorrect state of result stack */
+
+ if (State && !WalkState->ResultCount)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result object pushed! State=%p\n",
- WalkState));
- return (AE_NOT_EXIST);
+ ACPI_ERROR ((AE_INFO, "No results on result stack"));
+ return (AE_AML_INTERNAL);
}
- if (Index >= ACPI_OBJ_MAX_OPERAND)
+ if (!State && WalkState->ResultCount)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Index out of range: %X State=%p Num=%X\n",
- Index, WalkState, State->Results.NumResults));
+ ACPI_ERROR ((AE_INFO, "No result state for result stack"));
+ return (AE_AML_INTERNAL);
}
- /* Check for a valid result object */
+ /* Empty result stack */
- if (!State->Results.ObjDesc [Index])
+ if (!State)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Null operand! State=%p #Ops=%X, Index=%X\n",
- WalkState, State->Results.NumResults, Index));
+ ACPI_ERROR ((AE_INFO, "Result stack is empty! State=%p", WalkState));
return (AE_AML_NO_RETURN_VALUE);
}
- /* Remove the object */
+ /* Return object of the top element and clean that top element result stack */
- State->Results.NumResults--;
+ WalkState->ResultCount--;
+ Index = WalkState->ResultCount % ACPI_RESULTS_FRAME_OBJ_NUM;
*Object = State->Results.ObjDesc [Index];
- State->Results.ObjDesc [Index] = NULL;
-
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
- "Obj=%p [%s] Index=%X State=%p Num=%X\n",
- *Object, (*Object) ? AcpiUtGetObjectTypeName (*Object) : "NULL",
- Index, WalkState, State->Results.NumResults));
-
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsResultPop
- *
- * PARAMETERS: Object - Where to return the popped object
- * WalkState - Current Walk state
- *
- * RETURN: Status
- *
- * DESCRIPTION: Pop an object off the bottom of this walk's result stack. In
- * other words, this is a FIFO.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsResultPop (
- ACPI_OPERAND_OBJECT **Object,
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_NATIVE_UINT Index;
- ACPI_GENERIC_STATE *State;
-
-
- ACPI_FUNCTION_NAME ("DsResultPop");
-
-
- State = WalkState->Results;
- if (!State)
- {
- return (AE_OK);
- }
-
- if (!State->Results.NumResults)
+ if (!*Object)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Result stack is empty! State=%p\n",
+ ACPI_ERROR ((AE_INFO, "No result objects on result stack, State=%p",
WalkState));
return (AE_AML_NO_RETURN_VALUE);
}
- /* Remove top element */
-
- State->Results.NumResults--;
-
- for (Index = ACPI_OBJ_NUM_OPERANDS; Index; Index--)
+ State->Results.ObjDesc [Index] = NULL;
+ if (Index == 0)
{
- /* Check for a valid result object */
-
- if (State->Results.ObjDesc [Index -1])
+ Status = AcpiDsResultStackPop (WalkState);
+ if (ACPI_FAILURE (Status))
{
- *Object = State->Results.ObjDesc [Index -1];
- State->Results.ObjDesc [Index -1] = NULL;
-
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
- "Obj=%p [%s] Index=%X State=%p Num=%X\n",
- *Object,
- (*Object) ? AcpiUtGetObjectTypeName (*Object) : "NULL",
- (UINT32) Index -1, WalkState, State->Results.NumResults));
-
- return (AE_OK);
+ return (Status);
}
}
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "No result objects! State=%p\n", WalkState));
- return (AE_AML_NO_RETURN_VALUE);
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "Obj=%p [%s] Index=%X State=%p Num=%X\n", *Object,
+ AcpiUtGetObjectTypeName (*Object),
+ (UINT32) Index, WalkState, WalkState->ResultCount));
+
+ return (AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: AcpiDsResultPopFromBottom
+ * FUNCTION: AcpiDsResultPush
*
* PARAMETERS: Object - Where to return the popped object
* WalkState - Current Walk state
*
* RETURN: Status
*
- * DESCRIPTION: Pop an object off the bottom of this walk's result stack. In
- * other words, this is a FIFO.
+ * DESCRIPTION: Push an object onto the current result stack
*
******************************************************************************/
ACPI_STATUS
-AcpiDsResultPopFromBottom (
- ACPI_OPERAND_OBJECT **Object,
+AcpiDsResultPush (
+ ACPI_OPERAND_OBJECT *Object,
ACPI_WALK_STATE *WalkState)
{
- ACPI_NATIVE_UINT Index;
ACPI_GENERIC_STATE *State;
+ ACPI_STATUS Status;
+ ACPI_NATIVE_UINT Index;
- ACPI_FUNCTION_NAME ("DsResultPopFromBottom");
+ ACPI_FUNCTION_NAME (DsResultPush);
- State = WalkState->Results;
- if (!State)
+ if (WalkState->ResultCount > WalkState->ResultSize)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Warning: No result object pushed! State=%p\n", WalkState));
- return (AE_NOT_EXIST);
+ ACPI_ERROR ((AE_INFO, "Result stack is full"));
+ return (AE_AML_INTERNAL);
}
-
- if (!State->Results.NumResults)
+ else if (WalkState->ResultCount == WalkState->ResultSize)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result objects! State=%p\n",
- WalkState));
- return (AE_AML_NO_RETURN_VALUE);
- }
-
- /* Remove Bottom element */
-
- *Object = State->Results.ObjDesc [0];
+ /* Extend the result stack */
- /* Push entire stack down one element */
-
- for (Index = 0; Index < State->Results.NumResults; Index++)
- {
- State->Results.ObjDesc [Index] = State->Results.ObjDesc [Index + 1];
+ Status = AcpiDsResultStackPush (WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_ERROR ((AE_INFO, "Failed to extend the result stack"));
+ return (Status);
+ }
}
- State->Results.NumResults--;
-
- /* Check for a valid result object */
-
- if (!*Object)
+ if (!(WalkState->ResultCount < WalkState->ResultSize))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Null operand! State=%p #Ops=%X Index=%X\n",
- WalkState, State->Results.NumResults, (UINT32) Index));
- return (AE_AML_NO_RETURN_VALUE);
+ ACPI_ERROR ((AE_INFO, "No free elements in result stack"));
+ return (AE_AML_INTERNAL);
}
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] Results=%p State=%p\n",
- *Object, (*Object) ? AcpiUtGetObjectTypeName (*Object) : "NULL",
- State, WalkState));
-
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsResultPush
- *
- * PARAMETERS: Object - Where to return the popped object
- * WalkState - Current Walk state
- *
- * RETURN: Status
- *
- * DESCRIPTION: Push an object onto the current result stack
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsResultPush (
- ACPI_OPERAND_OBJECT *Object,
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_GENERIC_STATE *State;
-
-
- ACPI_FUNCTION_NAME ("DsResultPush");
-
-
State = WalkState->Results;
if (!State)
{
- ACPI_REPORT_ERROR (("No result stack frame during push\n"));
+ ACPI_ERROR ((AE_INFO, "No result stack frame during push"));
return (AE_AML_INTERNAL);
}
- if (State->Results.NumResults == ACPI_OBJ_NUM_OPERANDS)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Result stack overflow: Obj=%p State=%p Num=%X\n",
- Object, WalkState, State->Results.NumResults));
- return (AE_STACK_OVERFLOW);
- }
-
if (!Object)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Null Object! Obj=%p State=%p Num=%X\n",
- Object, WalkState, State->Results.NumResults));
+ ACPI_ERROR ((AE_INFO,
+ "Null Object! Obj=%p State=%p Num=%X",
+ Object, WalkState, WalkState->ResultCount));
return (AE_BAD_PARAMETER);
}
- State->Results.ObjDesc [State->Results.NumResults] = Object;
- State->Results.NumResults++;
+ /* Assign the address of object to the top free element of result stack */
+
+ Index = WalkState->ResultCount % ACPI_RESULTS_FRAME_OBJ_NUM;
+ State->Results.ObjDesc [Index] = Object;
+ WalkState->ResultCount++;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p Num=%X Cur=%X\n",
- Object, Object ? AcpiUtGetObjectTypeName ((ACPI_OPERAND_OBJECT *) Object) : "NULL",
- WalkState, State->Results.NumResults, WalkState->CurrentResult));
+ Object, AcpiUtGetObjectTypeName ((ACPI_OPERAND_OBJECT *) Object),
+ WalkState, WalkState->ResultCount, WalkState->CurrentResult));
return (AE_OK);
}
@@ -424,18 +304,29 @@ AcpiDsResultPush (
*
* RETURN: Status
*
- * DESCRIPTION: Push an object onto the WalkState result stack.
+ * DESCRIPTION: Push an object onto the WalkState result stack
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiDsResultStackPush (
ACPI_WALK_STATE *WalkState)
{
ACPI_GENERIC_STATE *State;
- ACPI_FUNCTION_NAME ("DsResultStackPush");
+ ACPI_FUNCTION_NAME (DsResultStackPush);
+
+
+ /* Check for stack overflow */
+
+ if ((WalkState->ResultSize + ACPI_RESULTS_FRAME_OBJ_NUM) >
+ ACPI_RESULTS_OBJ_NUM_MAX)
+ {
+ ACPI_ERROR ((AE_INFO, "Result stack overflow: State=%p Num=%X",
+ WalkState, WalkState->ResultSize));
+ return (AE_STACK_OVERFLOW);
+ }
State = AcpiUtCreateGenericState ();
if (!State)
@@ -443,9 +334,13 @@ AcpiDsResultStackPush (
return (AE_NO_MEMORY);
}
- State->Common.DataType = ACPI_DESC_TYPE_STATE_RESULT;
+ State->Common.DescriptorType = ACPI_DESC_TYPE_STATE_RESULT;
AcpiUtPushGenericState (&WalkState->Results, State);
+ /* Increase the length of the result stack by the length of frame */
+
+ WalkState->ResultSize += ACPI_RESULTS_FRAME_OBJ_NUM;
+
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Results=%p State=%p\n",
State, WalkState));
@@ -461,35 +356,45 @@ AcpiDsResultStackPush (
*
* RETURN: Status
*
- * DESCRIPTION: Pop an object off of the WalkState result stack.
+ * DESCRIPTION: Pop an object off of the WalkState result stack
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiDsResultStackPop (
ACPI_WALK_STATE *WalkState)
{
ACPI_GENERIC_STATE *State;
- ACPI_FUNCTION_NAME ("DsResultStackPop");
+
+ ACPI_FUNCTION_NAME (DsResultStackPop);
/* Check for stack underflow */
if (WalkState->Results == NULL)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Underflow - State=%p\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Result stack underflow - State=%p\n",
WalkState));
return (AE_AML_NO_OPERAND);
}
+ if (WalkState->ResultSize < ACPI_RESULTS_FRAME_OBJ_NUM)
+ {
+ ACPI_ERROR ((AE_INFO, "Insufficient result stack size"));
+ return (AE_AML_INTERNAL);
+ }
+
State = AcpiUtPopGenericState (&WalkState->Results);
+ AcpiUtDeleteGenericState (State);
+
+ /* Decrease the length of result stack by the length of frame */
+
+ WalkState->ResultSize -= ACPI_RESULTS_FRAME_OBJ_NUM;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Result=%p RemainingResults=%X State=%p\n",
- State, State->Results.NumResults, WalkState));
-
- AcpiUtDeleteGenericState (State);
+ State, WalkState->ResultCount, WalkState));
return (AE_OK);
}
@@ -513,27 +418,31 @@ AcpiDsObjStackPush (
void *Object,
ACPI_WALK_STATE *WalkState)
{
- ACPI_FUNCTION_NAME ("DsObjStackPush");
+ ACPI_FUNCTION_NAME (DsObjStackPush);
/* Check for stack overflow */
if (WalkState->NumOperands >= ACPI_OBJ_NUM_OPERANDS)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "overflow! Obj=%p State=%p #Ops=%X\n",
+ ACPI_ERROR ((AE_INFO,
+ "Object stack overflow! Obj=%p State=%p #Ops=%X",
Object, WalkState, WalkState->NumOperands));
return (AE_STACK_OVERFLOW);
}
/* Put the object onto the stack */
- WalkState->Operands [WalkState->NumOperands] = Object;
+ WalkState->Operands [WalkState->OperandIndex] = Object;
WalkState->NumOperands++;
+ /* For the usual order of filling the operand stack */
+
+ WalkState->OperandIndex++;
+
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n",
- Object, AcpiUtGetObjectTypeName ((ACPI_OPERAND_OBJECT *) Object),
- WalkState, WalkState->NumOperands));
+ Object, AcpiUtGetObjectTypeName ((ACPI_OPERAND_OBJECT *) Object),
+ WalkState, WalkState->NumOperands));
return (AE_OK);
}
@@ -560,7 +469,8 @@ AcpiDsObjStackPop (
{
UINT32 i;
- ACPI_FUNCTION_NAME ("DsObjStackPop");
+
+ ACPI_FUNCTION_NAME (DsObjStackPop);
for (i = 0; i < PopCount; i++)
@@ -569,8 +479,8 @@ AcpiDsObjStackPop (
if (WalkState->NumOperands == 0)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Underflow! Count=%X State=%p #Ops=%X\n",
+ ACPI_ERROR ((AE_INFO,
+ "Object stack underflow! Count=%X State=%p #Ops=%X",
PopCount, WalkState, WalkState->NumOperands));
return (AE_STACK_UNDERFLOW);
}
@@ -582,7 +492,7 @@ AcpiDsObjStackPop (
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%X\n",
- PopCount, WalkState, WalkState->NumOperands));
+ PopCount, WalkState, WalkState->NumOperands));
return (AE_OK);
}
@@ -602,7 +512,7 @@ AcpiDsObjStackPop (
*
******************************************************************************/
-ACPI_STATUS
+void
AcpiDsObjStackPopAndDelete (
UINT32 PopCount,
ACPI_WALK_STATE *WalkState)
@@ -611,36 +521,34 @@ AcpiDsObjStackPopAndDelete (
ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_FUNCTION_NAME ("DsObjStackPopAndDelete");
+ ACPI_FUNCTION_NAME (DsObjStackPopAndDelete);
- for (i = 0; i < PopCount; i++)
+ if (PopCount == 0)
{
- /* Check for stack underflow */
+ return;
+ }
+ for (i = (PopCount - 1); i >= 0; i--)
+ {
if (WalkState->NumOperands == 0)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Underflow! Count=%X State=%p #Ops=%X\n",
- PopCount, WalkState, WalkState->NumOperands));
- return (AE_STACK_UNDERFLOW);
+ return;
}
/* Pop the stack and delete an object if present in this stack entry */
WalkState->NumOperands--;
- ObjDesc = WalkState->Operands [WalkState->NumOperands];
+ ObjDesc = WalkState->Operands [i];
if (ObjDesc)
{
- AcpiUtRemoveReference (WalkState->Operands [WalkState->NumOperands]);
- WalkState->Operands [WalkState->NumOperands] = NULL;
+ AcpiUtRemoveReference (WalkState->Operands [i]);
+ WalkState->Operands [i] = NULL;
}
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%X\n",
- PopCount, WalkState, WalkState->NumOperands));
-
- return (AE_OK);
+ PopCount, WalkState, WalkState->NumOperands));
}
@@ -660,9 +568,8 @@ AcpiDsObjStackPopAndDelete (
ACPI_WALK_STATE *
AcpiDsGetCurrentWalkState (
ACPI_THREAD_STATE *Thread)
-
{
- ACPI_FUNCTION_NAME ("DsGetCurrentWalkState");
+ ACPI_FUNCTION_NAME (DsGetCurrentWalkState);
if (!Thread)
@@ -686,7 +593,7 @@ AcpiDsGetCurrentWalkState (
*
* RETURN: None
*
- * DESCRIPTION: Place the Thread state at the head of the state list.
+ * DESCRIPTION: Place the Thread state at the head of the state list
*
******************************************************************************/
@@ -695,10 +602,10 @@ AcpiDsPushWalkState (
ACPI_WALK_STATE *WalkState,
ACPI_THREAD_STATE *Thread)
{
- ACPI_FUNCTION_TRACE ("DsPushWalkState");
+ ACPI_FUNCTION_TRACE (DsPushWalkState);
- WalkState->Next = Thread->WalkStateList;
+ WalkState->Next = Thread->WalkStateList;
Thread->WalkStateList = WalkState;
return_VOID;
@@ -726,7 +633,7 @@ AcpiDsPopWalkState (
ACPI_WALK_STATE *WalkState;
- ACPI_FUNCTION_TRACE ("DsPopWalkState");
+ ACPI_FUNCTION_TRACE (DsPopWalkState);
WalkState = Thread->WalkStateList;
@@ -754,7 +661,7 @@ AcpiDsPopWalkState (
*
* PARAMETERS: OwnerId - ID for object creation
* Origin - Starting point for this walk
- * MthDesc - Method object
+ * MethodDesc - Method object
* Thread - Current thread state
*
* RETURN: Pointer to the new walk state.
@@ -768,27 +675,26 @@ ACPI_WALK_STATE *
AcpiDsCreateWalkState (
ACPI_OWNER_ID OwnerId,
ACPI_PARSE_OBJECT *Origin,
- ACPI_OPERAND_OBJECT *MthDesc,
+ ACPI_OPERAND_OBJECT *MethodDesc,
ACPI_THREAD_STATE *Thread)
{
ACPI_WALK_STATE *WalkState;
- ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("DsCreateWalkState");
+ ACPI_FUNCTION_TRACE (DsCreateWalkState);
- WalkState = ACPI_MEM_CALLOCATE (sizeof (ACPI_WALK_STATE));
+ WalkState = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_WALK_STATE));
if (!WalkState)
{
return_PTR (NULL);
}
- WalkState->DataType = ACPI_DESC_TYPE_WALK;
- WalkState->OwnerId = OwnerId;
- WalkState->Origin = Origin;
- WalkState->MethodDesc = MthDesc;
- WalkState->Thread = Thread;
+ WalkState->DescriptorType = ACPI_DESC_TYPE_WALK;
+ WalkState->MethodDesc = MethodDesc;
+ WalkState->OwnerId = OwnerId;
+ WalkState->Origin = Origin;
+ WalkState->Thread = Thread;
WalkState->ParserState.StartOp = Origin;
@@ -798,15 +704,6 @@ AcpiDsCreateWalkState (
AcpiDsMethodDataInit (WalkState);
#endif
- /* Create an initial result stack entry */
-
- Status = AcpiDsResultStackPush (WalkState);
- if (ACPI_FAILURE (Status))
- {
- ACPI_MEM_FREE (WalkState);
- return_PTR (NULL);
- }
-
/* Put the new state at the head of the walk list */
if (Thread)
@@ -843,7 +740,7 @@ AcpiDsInitAmlWalk (
ACPI_NAMESPACE_NODE *MethodNode,
UINT8 *AmlStart,
UINT32 AmlLength,
- ACPI_PARAMETER_INFO *Info,
+ ACPI_EVALUATE_INFO *Info,
UINT8 PassNumber)
{
ACPI_STATUS Status;
@@ -851,13 +748,13 @@ AcpiDsInitAmlWalk (
ACPI_PARSE_OBJECT *ExtraOp;
- ACPI_FUNCTION_TRACE ("DsInitAmlWalk");
+ ACPI_FUNCTION_TRACE (DsInitAmlWalk);
- WalkState->ParserState.Aml =
+ WalkState->ParserState.Aml =
WalkState->ParserState.AmlStart = AmlStart;
- WalkState->ParserState.AmlEnd =
- WalkState->ParserState.PkgEnd = AmlStart + AmlLength;
+ WalkState->ParserState.AmlEnd =
+ WalkState->ParserState.PkgEnd = AmlStart + AmlLength;
/* The NextOp of the NextWalk will be the beginning of the method */
@@ -868,12 +765,12 @@ AcpiDsInitAmlWalk (
{
if (Info->ParameterType == ACPI_PARAM_GPE)
{
- WalkState->GpeEventInfo = ACPI_CAST_PTR (ACPI_GPE_EVENT_INFO,
- Info->Parameters);
+ WalkState->GpeEventInfo =
+ ACPI_CAST_PTR (ACPI_GPE_EVENT_INFO, Info->Parameters);
}
else
{
- WalkState->Params = Info->Parameters;
+ WalkState->Params = Info->Parameters;
WalkState->CallerReturnDesc = &Info->ReturnObject;
}
}
@@ -887,9 +784,9 @@ AcpiDsInitAmlWalk (
if (MethodNode)
{
WalkState->ParserState.StartNode = MethodNode;
- WalkState->WalkType = ACPI_WALK_METHOD;
- WalkState->MethodNode = MethodNode;
- WalkState->MethodDesc = AcpiNsGetAttachedObject (MethodNode);
+ WalkState->WalkType = ACPI_WALK_METHOD;
+ WalkState->MethodNode = MethodNode;
+ WalkState->MethodDesc = AcpiNsGetAttachedObject (MethodNode);
/* Push start scope on scope stack and make it current */
@@ -968,7 +865,7 @@ AcpiDsDeleteWalkState (
ACPI_GENERIC_STATE *State;
- ACPI_FUNCTION_TRACE_PTR ("DsDeleteWalkState", WalkState);
+ ACPI_FUNCTION_TRACE_PTR (DsDeleteWalkState, WalkState);
if (!WalkState)
@@ -976,17 +873,20 @@ AcpiDsDeleteWalkState (
return;
}
- if (WalkState->DataType != ACPI_DESC_TYPE_WALK)
+ if (WalkState->DescriptorType != ACPI_DESC_TYPE_WALK)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p is not a valid walk state\n",
+ ACPI_ERROR ((AE_INFO, "%p is not a valid walk state",
WalkState));
return;
}
+ /* There should not be any open scopes */
+
if (WalkState->ParserState.Scope)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p walk still has a scope list\n",
+ ACPI_ERROR ((AE_INFO, "%p walk still has a scope list",
WalkState));
+ AcpiPsCleanupScope (&WalkState->ParserState);
}
/* Always must free any linked control states */
@@ -1019,214 +919,8 @@ AcpiDsDeleteWalkState (
AcpiUtDeleteGenericState (State);
}
- ACPI_MEM_FREE (WalkState);
+ ACPI_FREE (WalkState);
return_VOID;
}
-#ifdef ACPI_OBSOLETE_FUNCTIONS
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsResultInsert
- *
- * PARAMETERS: Object - Object to push
- * Index - Where to insert the object
- * WalkState - Current Walk state
- *
- * RETURN: Status
- *
- * DESCRIPTION: Insert an object onto this walk's result stack
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsResultInsert (
- void *Object,
- UINT32 Index,
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_GENERIC_STATE *State;
-
-
- ACPI_FUNCTION_NAME ("DsResultInsert");
-
-
- State = WalkState->Results;
- if (!State)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result object pushed! State=%p\n",
- WalkState));
- return (AE_NOT_EXIST);
- }
-
- if (Index >= ACPI_OBJ_NUM_OPERANDS)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Index out of range: %X Obj=%p State=%p Num=%X\n",
- Index, Object, WalkState, State->Results.NumResults));
- return (AE_BAD_PARAMETER);
- }
-
- if (!Object)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Null Object! Index=%X Obj=%p State=%p Num=%X\n",
- Index, Object, WalkState, State->Results.NumResults));
- return (AE_BAD_PARAMETER);
- }
-
- State->Results.ObjDesc [Index] = Object;
- State->Results.NumResults++;
-
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
- "Obj=%p [%s] State=%p Num=%X Cur=%X\n",
- Object, Object ? AcpiUtGetObjectTypeName ((ACPI_OPERAND_OBJECT *) Object) : "NULL",
- WalkState, State->Results.NumResults, WalkState->CurrentResult));
-
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsObjStackDeleteAll
- *
- * PARAMETERS: WalkState - Current Walk state
- *
- * RETURN: Status
- *
- * DESCRIPTION: Clear the object stack by deleting all objects that are on it.
- * Should be used with great care, if at all!
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsObjStackDeleteAll (
- ACPI_WALK_STATE *WalkState)
-{
- UINT32 i;
-
-
- ACPI_FUNCTION_TRACE_PTR ("DsObjStackDeleteAll", WalkState);
-
-
- /* The stack size is configurable, but fixed */
-
- for (i = 0; i < ACPI_OBJ_NUM_OPERANDS; i++)
- {
- if (WalkState->Operands[i])
- {
- AcpiUtRemoveReference (WalkState->Operands[i]);
- WalkState->Operands[i] = NULL;
- }
- }
-
- return_ACPI_STATUS (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsObjStackPopObject
- *
- * PARAMETERS: Object - Where to return the popped object
- * WalkState - Current Walk state
- *
- * RETURN: Status
- *
- * DESCRIPTION: Pop this walk's object stack. Objects on the stack are NOT
- * deleted by this routine.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsObjStackPopObject (
- ACPI_OPERAND_OBJECT **Object,
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_FUNCTION_NAME ("DsObjStackPopObject");
-
-
- /* Check for stack underflow */
-
- if (WalkState->NumOperands == 0)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Missing operand/stack empty! State=%p #Ops=%X\n",
- WalkState, WalkState->NumOperands));
- *Object = NULL;
- return (AE_AML_NO_OPERAND);
- }
-
- /* Pop the stack */
-
- WalkState->NumOperands--;
-
- /* Check for a valid operand */
-
- if (!WalkState->Operands [WalkState->NumOperands])
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Null operand! State=%p #Ops=%X\n",
- WalkState, WalkState->NumOperands));
- *Object = NULL;
- return (AE_AML_NO_OPERAND);
- }
-
- /* Get operand and set stack entry to null */
-
- *Object = WalkState->Operands [WalkState->NumOperands];
- WalkState->Operands [WalkState->NumOperands] = NULL;
-
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n",
- *Object, AcpiUtGetObjectTypeName (*Object),
- WalkState, WalkState->NumOperands));
-
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsObjStackGetValue
- *
- * PARAMETERS: Index - Stack index whose value is desired. Based
- * on the top of the stack (index=0 == top)
- * WalkState - Current Walk state
- *
- * RETURN: Pointer to the requested operand
- *
- * DESCRIPTION: Retrieve an object from this walk's operand stack. Index must
- * be within the range of the current stack pointer.
- *
- ******************************************************************************/
-
-void *
-AcpiDsObjStackGetValue (
- UINT32 Index,
- ACPI_WALK_STATE *WalkState)
-{
-
- ACPI_FUNCTION_TRACE_PTR ("DsObjStackGetValue", WalkState);
-
-
- /* Can't do it if the stack is empty */
-
- if (WalkState->NumOperands == 0)
- {
- return_PTR (NULL);
- }
-
- /* or if the index is past the top of the stack */
-
- if (Index > (WalkState->NumOperands - (UINT32) 1))
- {
- return_PTR (NULL);
- }
-
- return_PTR (WalkState->Operands[(ACPI_NATIVE_UINT)(WalkState->NumOperands - 1) -
- Index]);
-}
-#endif
-
-
diff --git a/sys/contrib/dev/acpica/evevent.c b/sys/contrib/dev/acpica/evevent.c
index a180731..0e15049 100644
--- a/sys/contrib/dev/acpica/evevent.c
+++ b/sys/contrib/dev/acpica/evevent.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evevent - Fixed Event handling and dispatch
- * $Revision: 1.117 $
+ * $Revision: 1.125 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -150,17 +150,9 @@ AcpiEvInitializeEvents (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("EvInitializeEvents");
+ ACPI_FUNCTION_TRACE (EvInitializeEvents);
- /* Make sure we have ACPI tables */
-
- if (!AcpiGbl_DSDT)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "No ACPI tables present!\n"));
- return_ACPI_STATUS (AE_NO_ACPI_TABLES);
- }
-
/*
* Initialize the Fixed and General Purpose Events. This is done prior to
* enabling SCIs to prevent interrupts from occurring before the handlers are
@@ -169,18 +161,16 @@ AcpiEvInitializeEvents (
Status = AcpiEvFixedEventInitialize ();
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR ((
- "Unable to initialize fixed events, %s\n",
- AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Unable to initialize fixed events"));
return_ACPI_STATUS (Status);
}
Status = AcpiEvGpeInitialize ();
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR ((
- "Unable to initialize general purpose events, %s\n",
- AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Unable to initialize general purpose events"));
return_ACPI_STATUS (Status);
}
@@ -190,6 +180,54 @@ AcpiEvInitializeEvents (
/*******************************************************************************
*
+ * FUNCTION: AcpiEvInstallFadtGpes
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Completes initialization of the FADT-defined GPE blocks
+ * (0 and 1). This causes the _PRW methods to be run, so the HW
+ * must be fully initialized at this point, including global lock
+ * support.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEvInstallFadtGpes (
+ void)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE (EvInstallFadtGpes);
+
+
+ /* Namespace must be locked */
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ /* FADT GPE Block 0 */
+
+ (void) AcpiEvInitializeGpeBlock (
+ AcpiGbl_FadtGpeDevice, AcpiGbl_GpeFadtBlocks[0]);
+
+ /* FADT GPE Block 1 */
+
+ (void) AcpiEvInitializeGpeBlock (
+ AcpiGbl_FadtGpeDevice, AcpiGbl_GpeFadtBlocks[1]);
+
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiEvInstallXruptHandlers
*
* PARAMETERS: None
@@ -207,7 +245,7 @@ AcpiEvInstallXruptHandlers (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("EvInstallXruptHandlers");
+ ACPI_FUNCTION_TRACE (EvInstallXruptHandlers);
/* Install the SCI handler */
@@ -215,9 +253,8 @@ AcpiEvInstallXruptHandlers (
Status = AcpiEvInstallSciHandler ();
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR ((
- "Unable to install System Control Interrupt Handler, %s\n",
- AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Unable to install System Control Interrupt handler"));
return_ACPI_STATUS (Status);
}
@@ -226,9 +263,8 @@ AcpiEvInstallXruptHandlers (
Status = AcpiEvInitGlobalLockHandler ();
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR ((
- "Unable to initialize Global Lock handler, %s\n",
- AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Unable to initialize Global Lock handler"));
return_ACPI_STATUS (Status);
}
@@ -271,8 +307,7 @@ AcpiEvFixedEventInitialize (
if (AcpiGbl_FixedEventInfo[i].EnableRegisterId != 0xFF)
{
Status = AcpiSetRegister (
- AcpiGbl_FixedEventInfo[i].EnableRegisterId,
- 0, ACPI_MTX_LOCK);
+ AcpiGbl_FixedEventInfo[i].EnableRegisterId, 0);
if (ACPI_FAILURE (Status))
{
return (Status);
@@ -306,7 +341,7 @@ AcpiEvFixedEventDetect (
ACPI_NATIVE_UINT i;
- ACPI_FUNCTION_NAME ("EvFixedEventDetect");
+ ACPI_FUNCTION_NAME (EvFixedEventDetect);
/*
@@ -366,8 +401,7 @@ AcpiEvFixedEventDispatch (
/* Clear the status bit */
- (void) AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].StatusRegisterId,
- 1, ACPI_MTX_DO_NOT_LOCK);
+ (void) AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].StatusRegisterId, 1);
/*
* Make sure we've got a handler. If not, report an error.
@@ -375,11 +409,10 @@ AcpiEvFixedEventDispatch (
*/
if (NULL == AcpiGbl_FixedEventHandlers[Event].Handler)
{
- (void) AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
- 0, ACPI_MTX_DO_NOT_LOCK);
+ (void) AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId, 0);
- ACPI_REPORT_ERROR (
- ("No installed handler for fixed event [%08X]\n",
+ ACPI_ERROR ((AE_INFO,
+ "No installed handler for fixed event [%08X]",
Event));
return (ACPI_INTERRUPT_NOT_HANDLED);
diff --git a/sys/contrib/dev/acpica/evgpe.c b/sys/contrib/dev/acpica/evgpe.c
index 20a7dc4..e470eae 100644
--- a/sys/contrib/dev/acpica/evgpe.c
+++ b/sys/contrib/dev/acpica/evgpe.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evgpe - General Purpose Event handling and dispatch
- * $Revision: 1.53 $
+ * $Revision: 1.68 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -149,7 +149,7 @@ AcpiEvSetGpeType (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("EvSetGpeType");
+ ACPI_FUNCTION_TRACE (EvSetGpeType);
/* Validate type and update register enable masks */
@@ -200,7 +200,7 @@ AcpiEvUpdateGpeEnableMasks (
UINT8 RegisterBit;
- ACPI_FUNCTION_TRACE ("EvUpdateGpeEnableMasks");
+ ACPI_FUNCTION_TRACE (EvUpdateGpeEnableMasks);
GpeRegisterInfo = GpeEventInfo->RegisterInfo;
@@ -208,7 +208,8 @@ AcpiEvUpdateGpeEnableMasks (
{
return_ACPI_STATUS (AE_NOT_EXIST);
}
- RegisterBit = GpeEventInfo->RegisterBit;
+ RegisterBit = (UINT8)
+ (1 << (GpeEventInfo->GpeNumber - GpeRegisterInfo->BaseGpeNumber));
/* 1) Disable case. Simply clear all enable bits */
@@ -268,7 +269,7 @@ AcpiEvEnableGpe (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("EvEnableGpe");
+ ACPI_FUNCTION_TRACE (EvEnableGpe);
/* Make sure HW enable masks are updated */
@@ -341,7 +342,7 @@ AcpiEvDisableGpe (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("EvDisableGpe");
+ ACPI_FUNCTION_TRACE (EvDisableGpe);
if (!(GpeEventInfo->Flags & ACPI_GPE_ENABLE_MASK))
@@ -488,12 +489,12 @@ AcpiEvGpeDetect (
UINT8 EnabledStatusByte;
UINT32 StatusReg;
UINT32 EnableReg;
- ACPI_NATIVE_UINT Flags;
+ ACPI_CPU_FLAGS Flags;
ACPI_NATIVE_UINT i;
ACPI_NATIVE_UINT j;
- ACPI_FUNCTION_NAME ("EvGpeDetect");
+ ACPI_FUNCTION_NAME (EvGpeDetect);
/* Check for the case where there are no GPEs */
@@ -502,9 +503,15 @@ AcpiEvGpeDetect (
return (IntStatus);
}
+ /*
+ * 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.
+ */
+ Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
+
/* Examine all GPE blocks attached to this interrupt level */
- Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
GpeBlock = GpeXruptList->GpeBlockListHead;
while (GpeBlock)
{
@@ -557,7 +564,7 @@ AcpiEvGpeDetect (
{
/* Examine one GPE bit */
- if (EnabledStatusByte & AcpiGbl_DecodeTo8bit[j])
+ if (EnabledStatusByte & (1 << j))
{
/*
* Found an active GPE. Dispatch the event to a handler
@@ -588,9 +595,9 @@ UnlockAndExit:
*
* RETURN: None
*
- * DESCRIPTION: Perform the actual execution of a GPE control method. This
- * function is called from an invocation of AcpiOsQueueForExecution
- * (and therefore does NOT execute at interrupt level) so that
+ * DESCRIPTION: Perform the actual execution of a GPE control method. This
+ * function is called from an invocation of AcpiOsExecute and
+ * therefore does NOT execute at interrupt level - so that
* the control method itself is not executed in the context of
* an interrupt handler.
*
@@ -601,13 +608,12 @@ AcpiEvAsynchExecuteGpeMethod (
void *Context)
{
ACPI_GPE_EVENT_INFO *GpeEventInfo = (void *) Context;
- UINT32 GpeNumber = 0;
ACPI_STATUS Status;
ACPI_GPE_EVENT_INFO LocalGpeEventInfo;
- ACPI_PARAMETER_INFO Info;
+ ACPI_EVALUATE_INFO *Info;
- ACPI_FUNCTION_TRACE ("EvAsynchExecuteGpeMethod");
+ ACPI_FUNCTION_TRACE (EvAsynchExecuteGpeMethod);
Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
@@ -648,22 +654,33 @@ AcpiEvAsynchExecuteGpeMethod (
if ((LocalGpeEventInfo.Flags & ACPI_GPE_DISPATCH_MASK) ==
ACPI_GPE_DISPATCH_METHOD)
{
- /*
- * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the _Lxx/_Exx
- * control method that corresponds to this GPE
- */
- Info.Node = LocalGpeEventInfo.Dispatch.MethodNode;
- Info.Parameters = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT *, GpeEventInfo);
- Info.ParameterType = ACPI_PARAM_GPE;
+ /* Allocate the evaluation information block */
+
+ Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO));
+ if (!Info)
+ {
+ Status = AE_NO_MEMORY;
+ }
+ else
+ {
+ /*
+ * 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->Flags = ACPI_IGNORE_RETURN_VALUE;
+
+ Status = AcpiNsEvaluate (Info);
+ ACPI_FREE (Info);
+ }
- Status = AcpiNsEvaluateByHandle (&Info);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR ((
- "%s while evaluating method [%4.4s] for GPE[%2X]\n",
- AcpiFormatException (Status),
- AcpiUtGetNodeName (LocalGpeEventInfo.Dispatch.MethodNode),
- GpeNumber));
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "while evaluating GPE method [%4.4s]",
+ AcpiUtGetNodeName (LocalGpeEventInfo.Dispatch.MethodNode)));
}
}
@@ -712,8 +729,10 @@ AcpiEvGpeDispatch (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("EvGpeDispatch");
+ ACPI_FUNCTION_TRACE (EvGpeDispatch);
+
+ AcpiGpeCount++;
/*
* If edge-triggered, clear the GPE status bit now. Note that
@@ -725,30 +744,30 @@ AcpiEvGpeDispatch (
Status = AcpiHwClearGpe (GpeEventInfo);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR ((
- "AcpiEvGpeDispatch: %s, Unable to clear GPE[%2X]\n",
- AcpiFormatException (Status), GpeNumber));
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Unable to clear GPE[%2X]", GpeNumber));
return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED);
}
}
- /* Save current system state */
-
- if (AcpiGbl_SystemAwakeAndRunning)
- {
- ACPI_SET_BIT (GpeEventInfo->Flags, ACPI_GPE_SYSTEM_RUNNING);
- }
- else
+ if (!AcpiGbl_SystemAwakeAndRunning)
{
- ACPI_CLEAR_BIT (GpeEventInfo->Flags, ACPI_GPE_SYSTEM_RUNNING);
+ /*
+ * 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 it and do not attempt to run the method.
- * If there is neither a handler nor a method, we disable the level to
- * prevent further events from coming in here.
+ * 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
+ * it and do not attempt to run the method. If there is neither a handler
+ * nor a method, we disable this GPE to prevent further such pointless
+ * events from firing.
*/
switch (GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK)
{
@@ -769,9 +788,8 @@ AcpiEvGpeDispatch (
Status = AcpiHwClearGpe (GpeEventInfo);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR ((
- "AcpiEvGpeDispatch: %s, Unable to clear GPE[%2X]\n",
- AcpiFormatException (Status), GpeNumber));
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Unable to clear GPE[%2X]", GpeNumber));
return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED);
}
}
@@ -780,15 +798,14 @@ AcpiEvGpeDispatch (
case ACPI_GPE_DISPATCH_METHOD:
/*
- * Disable GPE, so it doesn't keep firing before the method has a
- * chance to run.
+ * Disable the GPE, so it doesn't keep firing before the method has a
+ * chance to run (it runs asynchronously with interrupts enabled).
*/
Status = AcpiEvDisableGpe (GpeEventInfo);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR ((
- "AcpiEvGpeDispatch: %s, Unable to disable GPE[%2X]\n",
- AcpiFormatException (Status), GpeNumber));
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Unable to disable GPE[%2X]", GpeNumber));
return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED);
}
@@ -796,13 +813,13 @@ AcpiEvGpeDispatch (
* Execute the method associated with the GPE
* NOTE: Level-triggered GPEs are cleared after the method completes.
*/
- Status = AcpiOsQueueForExecution (OSD_PRIORITY_GPE,
+ Status = AcpiOsExecute (OSL_GPE_HANDLER,
AcpiEvAsynchExecuteGpeMethod, GpeEventInfo);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR ((
- "AcpiEvGpeDispatch: %s, Unable to queue handler for GPE[%2X] - event disabled\n",
- AcpiFormatException (Status), GpeNumber));
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Unable to queue handler for GPE[%2X] - event disabled",
+ GpeNumber));
}
break;
@@ -810,20 +827,19 @@ AcpiEvGpeDispatch (
/* No handler or method to run! */
- ACPI_REPORT_ERROR ((
- "AcpiEvGpeDispatch: No handler or method for GPE[%2X], disabling event\n",
+ ACPI_ERROR ((AE_INFO,
+ "No handler or method for GPE[%2X], disabling event",
GpeNumber));
/*
- * Disable the GPE. The GPE will remain disabled until the ACPI
+ * Disable the GPE. The GPE will remain disabled until the ACPI
* Core Subsystem is restarted, or a handler is installed.
*/
Status = AcpiEvDisableGpe (GpeEventInfo);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR ((
- "AcpiEvGpeDispatch: %s, Unable to disable GPE[%2X]\n",
- AcpiFormatException (Status), GpeNumber));
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Unable to disable GPE[%2X]", GpeNumber));
return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED);
}
break;
@@ -832,55 +848,3 @@ AcpiEvGpeDispatch (
return_UINT32 (ACPI_INTERRUPT_HANDLED);
}
-
-#ifdef ACPI_GPE_NOTIFY_CHECK
-/*******************************************************************************
- * TBD: NOT USED, PROTOTYPE ONLY AND WILL PROBABLY BE REMOVED
- *
- * FUNCTION: AcpiEvCheckForWakeOnlyGpe
- *
- * PARAMETERS: GpeEventInfo - info for this GPE
- *
- * RETURN: Status
- *
- * DESCRIPTION: Determine if a a GPE is "wake-only".
- *
- * Called from Notify() code in interpreter when a "DeviceWake"
- * Notify comes in.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiEvCheckForWakeOnlyGpe (
- ACPI_GPE_EVENT_INFO *GpeEventInfo)
-{
- ACPI_STATUS Status;
-
-
- ACPI_FUNCTION_TRACE ("EvCheckForWakeOnlyGpe");
-
-
- if ((GpeEventInfo) && /* Only >0 for _Lxx/_Exx */
- ((GpeEventInfo->Flags & ACPI_GPE_SYSTEM_MASK) == ACPI_GPE_SYSTEM_RUNNING)) /* System state at GPE time */
- {
- /* This must be a wake-only GPE, disable it */
-
- Status = AcpiEvDisableGpe (GpeEventInfo);
-
- /* Set GPE to wake-only. Do not change wake disabled/enabled status */
-
- AcpiEvSetGpeType (GpeEventInfo, ACPI_GPE_TYPE_WAKE);
-
- ACPI_REPORT_INFO (("GPE %p was updated from wake/run to wake-only\n",
- GpeEventInfo));
-
- /* This was a wake-only GPE */
-
- return_ACPI_STATUS (AE_WAKE_ONLY_GPE);
- }
-
- return_ACPI_STATUS (AE_OK);
-}
-#endif
-
-
diff --git a/sys/contrib/dev/acpica/evgpeblk.c b/sys/contrib/dev/acpica/evgpeblk.c
index ed6321c..5e1bdb7 100644
--- a/sys/contrib/dev/acpica/evgpeblk.c
+++ b/sys/contrib/dev/acpica/evgpeblk.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evgpeblk - GPE block creation and initialization.
- * $Revision: 1.47 $
+ * $Revision: 1.60 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -163,7 +163,7 @@ AcpiEvCreateGpeInfoBlocks (
*
* RETURN: TRUE if the GpeEvent is valid
*
- * DESCRIPTION: Validate a GPE event. DO NOT CALL FROM INTERRUPT LEVEL.
+ * DESCRIPTION: Validate a GPE event. DO NOT CALL FROM INTERRUPT LEVEL.
* Should be called only when the GPE lists are semaphore locked
* and not subject to change.
*
@@ -228,10 +228,10 @@ AcpiEvWalkGpeList (
ACPI_GPE_BLOCK_INFO *GpeBlock;
ACPI_GPE_XRUPT_INFO *GpeXruptInfo;
ACPI_STATUS Status = AE_OK;
- ACPI_NATIVE_UINT Flags;
+ ACPI_CPU_FLAGS Flags;
- ACPI_FUNCTION_TRACE ("EvWalkGpeList");
+ ACPI_FUNCTION_TRACE (EvWalkGpeList);
Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
@@ -290,7 +290,7 @@ AcpiEvDeleteGpeHandlers (
ACPI_NATIVE_UINT j;
- ACPI_FUNCTION_TRACE ("EvDeleteGpeHandlers");
+ ACPI_FUNCTION_TRACE (EvDeleteGpeHandlers);
/* Examine each GPE Register within the block */
@@ -306,7 +306,7 @@ AcpiEvDeleteGpeHandlers (
if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) ==
ACPI_GPE_DISPATCH_HANDLER)
{
- ACPI_MEM_FREE (GpeEventInfo->Dispatch.Handler);
+ ACPI_FREE (GpeEventInfo->Dispatch.Handler);
GpeEventInfo->Dispatch.Handler = NULL;
GpeEventInfo->Flags &= ~ACPI_GPE_DISPATCH_MASK;
}
@@ -325,7 +325,7 @@ AcpiEvDeleteGpeHandlers (
*
* RETURN: Status
*
- * DESCRIPTION: Called from AcpiWalkNamespace. Expects each object to be a
+ * DESCRIPTION: Called from AcpiWalkNamespace. Expects each object to be a
* control method under the _GPE portion of the namespace.
* Extract the name and GPE type from the object, saving this
* information for quick lookup during GPE dispatch
@@ -354,7 +354,7 @@ AcpiEvSaveMethodInfo (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("EvSaveMethodInfo");
+ ACPI_FUNCTION_TRACE (EvSaveMethodInfo);
/*
@@ -362,15 +362,15 @@ AcpiEvSaveMethodInfo (
*
* 1) Extract the name from the object and convert to a string
*/
- ACPI_MOVE_32_TO_32 (Name,
- &((ACPI_NAMESPACE_NODE *) ObjHandle)->Name.Integer);
+ ACPI_MOVE_32_TO_32 (
+ Name, &((ACPI_NAMESPACE_NODE *) ObjHandle)->Name.Integer);
Name[ACPI_NAME_SIZE] = 0;
/*
* 2) Edge/Level determination is based on the 2nd character
* of the method name
*
- * NOTE: Default GPE type is RUNTIME. May be changed later to WAKE
+ * NOTE: Default GPE type is RUNTIME. May be changed later to WAKE
* if a _PRW object is found that points to this GPE.
*/
switch (Name[1])
@@ -386,8 +386,8 @@ AcpiEvSaveMethodInfo (
default:
/* Unknown method type, just ignore it! */
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Unknown GPE method type: %s (name not of form _Lxx or _Exx)\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_LOAD,
+ "Ignoring unknown GPE method type: %s (name not of form _Lxx or _Exx)",
Name));
return_ACPI_STATUS (AE_OK);
}
@@ -399,8 +399,8 @@ AcpiEvSaveMethodInfo (
{
/* Conversion failed; invalid method, just ignore it */
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Could not extract GPE number from name: %s (name is not of form _Lxx or _Exx)\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_LOAD,
+ "Could not extract GPE number from name: %s (name is not of form _Lxx or _Exx)",
Name));
return_ACPI_STATUS (AE_OK);
}
@@ -420,13 +420,13 @@ AcpiEvSaveMethodInfo (
/*
* Now we can add this information to the GpeEventInfo block
- * for use during dispatch of this GPE. Default type is RUNTIME, although
+ * 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];
- GpeEventInfo->Flags = (UINT8) (Type | ACPI_GPE_DISPATCH_METHOD |
- ACPI_GPE_TYPE_RUNTIME);
+ GpeEventInfo->Flags = (UINT8)
+ (Type | ACPI_GPE_DISPATCH_METHOD | ACPI_GPE_TYPE_RUNTIME);
GpeEventInfo->Dispatch.MethodNode = (ACPI_NAMESPACE_NODE *) ObjHandle;
@@ -447,11 +447,11 @@ AcpiEvSaveMethodInfo (
*
* PARAMETERS: Callback from WalkNamespace
*
- * RETURN: Status. NOTE: We ignore errors so that the _PRW walk is
+ * RETURN: Status. NOTE: We ignore errors so that the _PRW walk is
* not aborted on a single _PRW failure.
*
- * DESCRIPTION: Called from AcpiWalkNamespace. Expects each object to be a
- * Device. Run the _PRW method. If present, extract the GPE
+ * DESCRIPTION: Called from AcpiWalkNamespace. Expects each object to be a
+ * Device. Run the _PRW method. If present, extract the GPE
* number and mark the GPE as a WAKE GPE.
*
******************************************************************************/
@@ -474,7 +474,7 @@ AcpiEvMatchPrwAndGpe (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("EvMatchPrwAndGpe");
+ ACPI_FUNCTION_TRACE (EvMatchPrwAndGpe);
/* Check for a _PRW method under this device */
@@ -556,6 +556,7 @@ AcpiEvMatchPrwAndGpe (
/* Mark GPE for WAKE-ONLY but WAKE_DISABLED */
GpeEventInfo->Flags &= ~(ACPI_GPE_WAKE_ENABLED | ACPI_GPE_RUN_ENABLED);
+
Status = AcpiEvSetGpeType (GpeEventInfo, ACPI_GPE_TYPE_WAKE);
if (ACPI_FAILURE (Status))
{
@@ -578,7 +579,7 @@ Cleanup:
*
* RETURN: A GPE interrupt block
*
- * DESCRIPTION: Get or Create a GPE interrupt block. There is one interrupt
+ * 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.
@@ -592,10 +593,10 @@ AcpiEvGetGpeXruptBlock (
ACPI_GPE_XRUPT_INFO *NextGpeXrupt;
ACPI_GPE_XRUPT_INFO *GpeXrupt;
ACPI_STATUS Status;
- ACPI_NATIVE_UINT Flags;
+ ACPI_CPU_FLAGS Flags;
- ACPI_FUNCTION_TRACE ("EvGetGpeXruptBlock");
+ ACPI_FUNCTION_TRACE (EvGetGpeXruptBlock);
/* No need for lock since we are not changing any list elements here */
@@ -613,7 +614,7 @@ AcpiEvGetGpeXruptBlock (
/* Not found, must allocate a new xrupt descriptor */
- GpeXrupt = ACPI_MEM_CALLOCATE (sizeof (ACPI_GPE_XRUPT_INFO));
+ GpeXrupt = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_GPE_XRUPT_INFO));
if (!GpeXrupt)
{
return_PTR (NULL);
@@ -643,14 +644,14 @@ AcpiEvGetGpeXruptBlock (
/* Install new interrupt handler if not SCI_INT */
- if (InterruptNumber != AcpiGbl_FADT->SciInt)
+ if (InterruptNumber != AcpiGbl_FADT.SciInterrupt)
{
Status = AcpiOsInstallInterruptHandler (InterruptNumber,
AcpiEvGpeXruptHandler, GpeXrupt);
if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Could not install GPE interrupt handler at level 0x%X\n",
+ ACPI_ERROR ((AE_INFO,
+ "Could not install GPE interrupt handler at level 0x%X",
InterruptNumber));
return_PTR (NULL);
}
@@ -668,7 +669,7 @@ AcpiEvGetGpeXruptBlock (
*
* RETURN: Status
*
- * DESCRIPTION: Remove and free a GpeXrupt block. Remove an associated
+ * DESCRIPTION: Remove and free a GpeXrupt block. Remove an associated
* interrupt handler if not the SCI interrupt.
*
******************************************************************************/
@@ -678,15 +679,15 @@ AcpiEvDeleteGpeXrupt (
ACPI_GPE_XRUPT_INFO *GpeXrupt)
{
ACPI_STATUS Status;
- ACPI_NATIVE_UINT Flags;
+ ACPI_CPU_FLAGS Flags;
- ACPI_FUNCTION_TRACE ("EvDeleteGpeXrupt");
+ ACPI_FUNCTION_TRACE (EvDeleteGpeXrupt);
/* We never want to remove the SCI interrupt handler */
- if (GpeXrupt->InterruptNumber == AcpiGbl_FADT->SciInt)
+ if (GpeXrupt->InterruptNumber == AcpiGbl_FADT.SciInterrupt)
{
GpeXrupt->GpeBlockListHead = NULL;
return_ACPI_STATUS (AE_OK);
@@ -694,8 +695,8 @@ AcpiEvDeleteGpeXrupt (
/* Disable this interrupt */
- Status = AcpiOsRemoveInterruptHandler (GpeXrupt->InterruptNumber,
- AcpiEvGpeXruptHandler);
+ Status = AcpiOsRemoveInterruptHandler (
+ GpeXrupt->InterruptNumber, AcpiEvGpeXruptHandler);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -717,7 +718,7 @@ AcpiEvDeleteGpeXrupt (
/* Free the block */
- ACPI_MEM_FREE (GpeXrupt);
+ ACPI_FREE (GpeXrupt);
return_ACPI_STATUS (AE_OK);
}
@@ -743,10 +744,10 @@ AcpiEvInstallGpeBlock (
ACPI_GPE_BLOCK_INFO *NextGpeBlock;
ACPI_GPE_XRUPT_INFO *GpeXruptBlock;
ACPI_STATUS Status;
- ACPI_NATIVE_UINT Flags;
+ ACPI_CPU_FLAGS Flags;
- ACPI_FUNCTION_TRACE ("EvInstallGpeBlock");
+ ACPI_FUNCTION_TRACE (EvInstallGpeBlock);
Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
@@ -784,6 +785,7 @@ AcpiEvInstallGpeBlock (
GpeBlock->XruptBlock = GpeXruptBlock;
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
+
UnlockAndExit:
Status = AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
return_ACPI_STATUS (Status);
@@ -807,10 +809,10 @@ AcpiEvDeleteGpeBlock (
ACPI_GPE_BLOCK_INFO *GpeBlock)
{
ACPI_STATUS Status;
- ACPI_NATIVE_UINT Flags;
+ ACPI_CPU_FLAGS Flags;
- ACPI_FUNCTION_TRACE ("EvInstallGpeBlock");
+ ACPI_FUNCTION_TRACE (EvInstallGpeBlock);
Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
@@ -856,9 +858,9 @@ AcpiEvDeleteGpeBlock (
/* Free the GpeBlock */
- ACPI_MEM_FREE (GpeBlock->RegisterInfo);
- ACPI_MEM_FREE (GpeBlock->EventInfo);
- ACPI_MEM_FREE (GpeBlock);
+ ACPI_FREE (GpeBlock->RegisterInfo);
+ ACPI_FREE (GpeBlock->EventInfo);
+ ACPI_FREE (GpeBlock);
UnlockAndExit:
Status = AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
@@ -891,33 +893,33 @@ AcpiEvCreateGpeInfoBlocks (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("EvCreateGpeInfoBlocks");
+ ACPI_FUNCTION_TRACE (EvCreateGpeInfoBlocks);
/* Allocate the GPE register information block */
- GpeRegisterInfo = ACPI_MEM_CALLOCATE (
- (ACPI_SIZE) GpeBlock->RegisterCount *
- sizeof (ACPI_GPE_REGISTER_INFO));
+ GpeRegisterInfo = ACPI_ALLOCATE_ZEROED (
+ (ACPI_SIZE) GpeBlock->RegisterCount *
+ sizeof (ACPI_GPE_REGISTER_INFO));
if (!GpeRegisterInfo)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Could not allocate the GpeRegisterInfo table\n"));
+ ACPI_ERROR ((AE_INFO,
+ "Could not allocate the GpeRegisterInfo table"));
return_ACPI_STATUS (AE_NO_MEMORY);
}
/*
- * Allocate the GPE EventInfo block. There are eight distinct GPEs
- * per register. Initialization to zeros is sufficient.
+ * Allocate the GPE EventInfo block. There are eight distinct GPEs
+ * per register. Initialization to zeros is sufficient.
*/
- GpeEventInfo = ACPI_MEM_CALLOCATE (
+ GpeEventInfo = ACPI_ALLOCATE_ZEROED (
((ACPI_SIZE) GpeBlock->RegisterCount *
ACPI_GPE_REGISTER_WIDTH) *
sizeof (ACPI_GPE_EVENT_INFO));
if (!GpeEventInfo)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Could not allocate the GpeEventInfo table\n"));
+ ACPI_ERROR ((AE_INFO,
+ "Could not allocate the GpeEventInfo table"));
Status = AE_NO_MEMORY;
goto ErrorExit;
}
@@ -928,9 +930,9 @@ AcpiEvCreateGpeInfoBlocks (
GpeBlock->EventInfo = GpeEventInfo;
/*
- * Initialize the GPE Register and Event structures. A goal of these
+ * 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,
+ * in a given GPE hardware block, the status registers occupy the first half,
* and the enable registers occupy the second half.
*/
ThisRegister = GpeRegisterInfo;
@@ -941,38 +943,32 @@ AcpiEvCreateGpeInfoBlocks (
/* Init the RegisterInfo for this GPE register (8 GPEs) */
ThisRegister->BaseGpeNumber = (UINT8) (GpeBlock->BlockBaseNumber +
- (i * ACPI_GPE_REGISTER_WIDTH));
+ (i * ACPI_GPE_REGISTER_WIDTH));
- ACPI_STORE_ADDRESS (ThisRegister->StatusAddress.Address,
- (ACPI_GET_ADDRESS (GpeBlock->BlockAddress.Address)
- + i));
+ ThisRegister->StatusAddress.Address =
+ GpeBlock->BlockAddress.Address + i;
- ACPI_STORE_ADDRESS (ThisRegister->EnableAddress.Address,
- (ACPI_GET_ADDRESS (GpeBlock->BlockAddress.Address)
- + i
- + GpeBlock->RegisterCount));
+ ThisRegister->EnableAddress.Address =
+ GpeBlock->BlockAddress.Address + i + GpeBlock->RegisterCount;
- ThisRegister->StatusAddress.AddressSpaceId = GpeBlock->BlockAddress.AddressSpaceId;
- ThisRegister->EnableAddress.AddressSpaceId = GpeBlock->BlockAddress.AddressSpaceId;
- ThisRegister->StatusAddress.RegisterBitWidth = ACPI_GPE_REGISTER_WIDTH;
- ThisRegister->EnableAddress.RegisterBitWidth = ACPI_GPE_REGISTER_WIDTH;
- ThisRegister->StatusAddress.RegisterBitOffset = ACPI_GPE_REGISTER_WIDTH;
- ThisRegister->EnableAddress.RegisterBitOffset = ACPI_GPE_REGISTER_WIDTH;
+ ThisRegister->StatusAddress.SpaceId = GpeBlock->BlockAddress.SpaceId;
+ 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;
/* Init the EventInfo for each GPE within this register */
for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++)
{
- ThisEvent->RegisterBit = AcpiGbl_DecodeTo8bit[j];
+ ThisEvent->GpeNumber = (UINT8) (ThisRegister->BaseGpeNumber + j);
ThisEvent->RegisterInfo = ThisRegister;
ThisEvent++;
}
- /*
- * Clear the status/enable registers. Note that status registers
- * are cleared by writing a '1', while enable registers are cleared
- * by writing a '0'.
- */
+ /* Disable all GPEs within this register */
+
Status = AcpiHwLowLevelWrite (ACPI_GPE_REGISTER_WIDTH, 0x00,
&ThisRegister->EnableAddress);
if (ACPI_FAILURE (Status))
@@ -980,6 +976,8 @@ AcpiEvCreateGpeInfoBlocks (
goto ErrorExit;
}
+ /* Clear any pending GPE events within this register */
+
Status = AcpiHwLowLevelWrite (ACPI_GPE_REGISTER_WIDTH, 0xFF,
&ThisRegister->StatusAddress);
if (ACPI_FAILURE (Status))
@@ -996,11 +994,11 @@ AcpiEvCreateGpeInfoBlocks (
ErrorExit:
if (GpeRegisterInfo)
{
- ACPI_MEM_FREE (GpeRegisterInfo);
+ ACPI_FREE (GpeRegisterInfo);
}
if (GpeEventInfo)
{
- ACPI_MEM_FREE (GpeEventInfo);
+ ACPI_FREE (GpeEventInfo);
}
return_ACPI_STATUS (Status);
@@ -1020,7 +1018,9 @@ ErrorExit:
*
* RETURN: Status
*
- * DESCRIPTION: Create and Install a block of GPE registers
+ * DESCRIPTION: Create and Install a block of GPE registers. All GPEs within
+ * the block are disabled at exit.
+ * Note: Assumes namespace is locked.
*
******************************************************************************/
@@ -1033,17 +1033,11 @@ AcpiEvCreateGpeBlock (
UINT32 InterruptNumber,
ACPI_GPE_BLOCK_INFO **ReturnGpeBlock)
{
- ACPI_GPE_BLOCK_INFO *GpeBlock;
- ACPI_GPE_EVENT_INFO *GpeEventInfo;
- ACPI_NATIVE_UINT i;
- ACPI_NATIVE_UINT j;
- UINT32 WakeGpeCount;
- UINT32 GpeEnabledCount;
ACPI_STATUS Status;
- ACPI_GPE_WALK_INFO GpeInfo;
+ ACPI_GPE_BLOCK_INFO *GpeBlock;
- ACPI_FUNCTION_TRACE ("EvCreateGpeBlock");
+ ACPI_FUNCTION_TRACE (EvCreateGpeBlock);
if (!RegisterCount)
@@ -1053,7 +1047,7 @@ AcpiEvCreateGpeBlock (
/* Allocate a new GPE block */
- GpeBlock = ACPI_MEM_CALLOCATE (sizeof (ACPI_GPE_BLOCK_INFO));
+ GpeBlock = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_GPE_BLOCK_INFO));
if (!GpeBlock)
{
return_ACPI_STATUS (AE_NO_MEMORY);
@@ -1061,61 +1055,126 @@ AcpiEvCreateGpeBlock (
/* Initialize the new GPE block */
- GpeBlock->RegisterCount = RegisterCount;
+ GpeBlock->Node = GpeDevice;
+ GpeBlock->RegisterCount = RegisterCount;
GpeBlock->BlockBaseNumber = GpeBlockBaseNumber;
- GpeBlock->Node = GpeDevice;
ACPI_MEMCPY (&GpeBlock->BlockAddress, GpeBlockAddress,
sizeof (ACPI_GENERIC_ADDRESS));
- /* Create the RegisterInfo and EventInfo sub-structures */
-
+ /*
+ * Create the RegisterInfo and EventInfo sub-structures
+ * Note: disables and clears all GPEs in the block
+ */
Status = AcpiEvCreateGpeInfoBlocks (GpeBlock);
if (ACPI_FAILURE (Status))
{
- ACPI_MEM_FREE (GpeBlock);
+ ACPI_FREE (GpeBlock);
return_ACPI_STATUS (Status);
}
- /* Install the new block in the global list(s) */
+ /* Install the new block in the global lists */
Status = AcpiEvInstallGpeBlock (GpeBlock, InterruptNumber);
if (ACPI_FAILURE (Status))
{
- ACPI_MEM_FREE (GpeBlock);
+ ACPI_FREE (GpeBlock);
return_ACPI_STATUS (Status);
}
/* Find all GPE methods (_Lxx, _Exx) for this block */
Status = AcpiNsWalkNamespace (ACPI_TYPE_METHOD, GpeDevice,
- ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, AcpiEvSaveMethodInfo,
- GpeBlock, NULL);
+ ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK,
+ AcpiEvSaveMethodInfo, GpeBlock, NULL);
+
+ /* Return the new block */
+
+ if (ReturnGpeBlock)
+ {
+ (*ReturnGpeBlock) = GpeBlock;
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
+ "GPE %02X to %02X [%4.4s] %u regs on int 0x%X\n",
+ (UINT32) GpeBlock->BlockBaseNumber,
+ (UINT32) (GpeBlock->BlockBaseNumber +
+ ((GpeBlock->RegisterCount * ACPI_GPE_REGISTER_WIDTH) -1)),
+ GpeDevice->Name.Ascii,
+ GpeBlock->RegisterCount,
+ InterruptNumber));
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvInitializeGpeBlock
+ *
+ * PARAMETERS: GpeDevice - Handle to the parent GPE block
+ * GpeBlock - Gpe Block info
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Initialize and enable a GPE block. First find and run any
+ * _PRT methods associated with the block, then enable the
+ * appropriate GPEs.
+ * Note: Assumes namespace is locked.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEvInitializeGpeBlock (
+ ACPI_NAMESPACE_NODE *GpeDevice,
+ ACPI_GPE_BLOCK_INFO *GpeBlock)
+{
+ ACPI_STATUS Status;
+ ACPI_GPE_EVENT_INFO *GpeEventInfo;
+ ACPI_GPE_WALK_INFO GpeInfo;
+ UINT32 WakeGpeCount;
+ UINT32 GpeEnabledCount;
+ ACPI_NATIVE_UINT i;
+ ACPI_NATIVE_UINT j;
+
+
+ ACPI_FUNCTION_TRACE (EvInitializeGpeBlock);
+
+
+ /* Ignore a null GPE block (e.g., if no GPE block 1 exists) */
+
+ if (!GpeBlock)
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
/*
- * Runtime option: Should Wake GPEs be enabled at runtime? The default
- * is No,they should only be enabled just as the machine goes to sleep.
+ * Runtime option: Should wake GPEs be enabled at runtime? The default
+ * is no, they should only be enabled just as the machine goes to sleep.
*/
if (AcpiGbl_LeaveWakeGpesDisabled)
{
/*
- * Differentiate RUNTIME vs WAKE GPEs, via the _PRW control methods.
- * (Each GPE that has one or more _PRWs that reference it is by
- * definition a WAKE GPE and will not be enabled while the machine
- * is running.)
+ * Differentiate runtime vs wake GPEs, via the _PRW control methods.
+ * Each GPE that has one or more _PRWs that reference it is by
+ * definition a wake GPE and will not be enabled while the machine
+ * is running.
*/
GpeInfo.GpeBlock = GpeBlock;
GpeInfo.GpeDevice = GpeDevice;
Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
- ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, AcpiEvMatchPrwAndGpe,
- &GpeInfo, NULL);
+ ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK,
+ AcpiEvMatchPrwAndGpe, &GpeInfo, NULL);
}
/*
- * Enable all GPEs in this block that are 1) "runtime" or "run/wake" GPEs,
- * and 2) have a corresponding _Lxx or _Exx method. All other GPEs must
- * be enabled via the AcpiEnableGpe() external interface.
+ * Enable all GPEs in this block that have these attributes:
+ * 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.
*/
WakeGpeCount = 0;
GpeEnabledCount = 0;
@@ -1141,33 +1200,20 @@ AcpiEvCreateGpeBlock (
}
}
- /* Dump info about this GPE block */
-
ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
- "GPE %02X to %02X [%4.4s] %u regs on int 0x%X\n",
- (UINT32) GpeBlock->BlockBaseNumber,
- (UINT32) (GpeBlock->BlockBaseNumber +
- ((GpeBlock->RegisterCount * ACPI_GPE_REGISTER_WIDTH) -1)),
- GpeDevice->Name.Ascii,
- GpeBlock->RegisterCount,
- InterruptNumber));
+ "Found %u Wake, Enabled %u Runtime GPEs in this block\n",
+ WakeGpeCount, GpeEnabledCount));
- /* Enable all valid GPEs found above */
+ /* Enable all valid runtime GPEs found above */
Status = AcpiHwEnableRuntimeGpeBlock (NULL, GpeBlock);
-
- ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
- "Found %u Wake, Enabled %u Runtime GPEs in this block\n",
- WakeGpeCount, GpeEnabledCount));
-
- /* Return the new block */
-
- if (ReturnGpeBlock)
+ if (ACPI_FAILURE (Status))
{
- (*ReturnGpeBlock) = GpeBlock;
+ ACPI_ERROR ((AE_INFO, "Could not enable GPEs in GpeBlock %p",
+ GpeBlock));
}
- return_ACPI_STATUS (AE_OK);
+ return_ACPI_STATUS (Status);
}
@@ -1193,7 +1239,7 @@ AcpiEvGpeInitialize (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("EvGpeInitialize");
+ ACPI_FUNCTION_TRACE (EvGpeInitialize);
Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
@@ -1227,45 +1273,44 @@ AcpiEvGpeInitialize (
* If EITHER the register length OR the block address are zero, then that
* particular block is not supported.
*/
- if (AcpiGbl_FADT->Gpe0BlkLen &&
- ACPI_GET_ADDRESS (AcpiGbl_FADT->XGpe0Blk.Address))
+ if (AcpiGbl_FADT.Gpe0BlockLength &&
+ AcpiGbl_FADT.XGpe0Block.Address)
{
/* GPE block 0 exists (has both length and address > 0) */
- RegisterCount0 = (UINT16) (AcpiGbl_FADT->Gpe0BlkLen / 2);
+ RegisterCount0 = (UINT16) (AcpiGbl_FADT.Gpe0BlockLength / 2);
GpeNumberMax = (RegisterCount0 * ACPI_GPE_REGISTER_WIDTH) - 1;
/* Install GPE Block 0 */
Status = AcpiEvCreateGpeBlock (AcpiGbl_FadtGpeDevice,
- &AcpiGbl_FADT->XGpe0Blk, RegisterCount0, 0,
- AcpiGbl_FADT->SciInt, &AcpiGbl_GpeFadtBlocks[0]);
+ &AcpiGbl_FADT.XGpe0Block, RegisterCount0, 0,
+ AcpiGbl_FADT.SciInterrupt, &AcpiGbl_GpeFadtBlocks[0]);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR ((
- "Could not create GPE Block 0, %s\n",
- AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Could not create GPE Block 0"));
}
}
- if (AcpiGbl_FADT->Gpe1BlkLen &&
- ACPI_GET_ADDRESS (AcpiGbl_FADT->XGpe1Blk.Address))
+ if (AcpiGbl_FADT.Gpe1BlockLength &&
+ AcpiGbl_FADT.XGpe1Block.Address)
{
/* GPE block 1 exists (has both length and address > 0) */
- RegisterCount1 = (UINT16) (AcpiGbl_FADT->Gpe1BlkLen / 2);
+ RegisterCount1 = (UINT16) (AcpiGbl_FADT.Gpe1BlockLength / 2);
/* Check for GPE0/GPE1 overlap (if both banks exist) */
if ((RegisterCount0) &&
- (GpeNumberMax >= AcpiGbl_FADT->Gpe1Base))
+ (GpeNumberMax >= AcpiGbl_FADT.Gpe1Base))
{
- ACPI_REPORT_ERROR ((
- "GPE0 block (GPE 0 to %d) overlaps the GPE1 block (GPE %d to %d) - Ignoring GPE1\n",
- GpeNumberMax, AcpiGbl_FADT->Gpe1Base,
- AcpiGbl_FADT->Gpe1Base +
+ ACPI_ERROR ((AE_INFO,
+ "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)));
/* Ignore GPE1 block by setting the register count to zero */
@@ -1277,22 +1322,21 @@ AcpiEvGpeInitialize (
/* Install GPE Block 1 */
Status = AcpiEvCreateGpeBlock (AcpiGbl_FadtGpeDevice,
- &AcpiGbl_FADT->XGpe1Blk, RegisterCount1,
- AcpiGbl_FADT->Gpe1Base,
- AcpiGbl_FADT->SciInt, &AcpiGbl_GpeFadtBlocks[1]);
+ &AcpiGbl_FADT.XGpe1Block, RegisterCount1,
+ AcpiGbl_FADT.Gpe1Base,
+ AcpiGbl_FADT.SciInterrupt, &AcpiGbl_GpeFadtBlocks[1]);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR ((
- "Could not create GPE Block 1, %s\n",
- AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Could not create GPE Block 1"));
}
/*
* GPE0 and GPE1 do not have to be contiguous in the GPE number
* space. However, GPE0 always starts at GPE number zero.
*/
- GpeNumberMax = AcpiGbl_FADT->Gpe1Base +
+ GpeNumberMax = AcpiGbl_FADT.Gpe1Base +
((RegisterCount1 * ACPI_GPE_REGISTER_WIDTH) - 1);
}
}
@@ -1304,7 +1348,7 @@ AcpiEvGpeInitialize (
/* GPEs are not required by ACPI, this is OK */
ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
- "There are no GPE blocks defined in the FADT\n"));
+ "There are no GPE blocks defined in the FADT\n"));
Status = AE_OK;
goto Cleanup;
}
@@ -1313,7 +1357,8 @@ AcpiEvGpeInitialize (
if (GpeNumberMax > ACPI_GPE_MAX)
{
- ACPI_REPORT_ERROR (("Maximum GPE number from FADT is too large: 0x%X\n",
+ ACPI_ERROR ((AE_INFO,
+ "Maximum GPE number from FADT is too large: 0x%X",
GpeNumberMax));
Status = AE_BAD_VALUE;
goto Cleanup;
diff --git a/sys/contrib/dev/acpica/evmisc.c b/sys/contrib/dev/acpica/evmisc.c
index abc685d..5fdc179 100644
--- a/sys/contrib/dev/acpica/evmisc.c
+++ b/sys/contrib/dev/acpica/evmisc.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evmisc - Miscellaneous event manager support functions
- * $Revision: 1.86 $
+ * $Revision: 1.103 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -123,13 +123,15 @@
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",
+ "Eject Request",
"Device Check Light",
"Frequency Mismatch",
"Bus Mode Mismatch",
@@ -137,20 +139,24 @@ static const char *AcpiNotifyValueNames[] =
};
#endif
+/* Pointer to FACS needed for the Global Lock */
+
+static ACPI_TABLE_FACS *Facs = NULL;
+
/* Local prototypes */
static void ACPI_SYSTEM_XFACE
AcpiEvNotifyDispatch (
void *Context);
-static void ACPI_SYSTEM_XFACE
-AcpiEvGlobalLockThread (
- void *Context);
-
static UINT32
AcpiEvGlobalLockHandler (
void *Context);
+static ACPI_STATUS
+AcpiEvRemoveGlobalLockHandler (
+ void);
+
/*******************************************************************************
*
@@ -212,7 +218,7 @@ AcpiEvQueueNotifyRequest (
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_NAME ("EvQueueNotifyRequest");
+ ACPI_FUNCTION_NAME (EvQueueNotifyRequest);
/*
@@ -228,7 +234,7 @@ AcpiEvQueueNotifyRequest (
if (NotifyValue <= 7)
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Notify value: %s\n",
- AcpiNotifyValueNames[NotifyValue]));
+ AcpiNotifyValueNames[NotifyValue]));
}
else
{
@@ -279,13 +285,13 @@ AcpiEvQueueNotifyRequest (
return (AE_NO_MEMORY);
}
- NotifyInfo->Common.DataType = ACPI_DESC_TYPE_STATE_NOTIFY;
- NotifyInfo->Notify.Node = Node;
- NotifyInfo->Notify.Value = (UINT16) NotifyValue;
+ NotifyInfo->Common.DescriptorType = ACPI_DESC_TYPE_STATE_NOTIFY;
+ NotifyInfo->Notify.Node = Node;
+ NotifyInfo->Notify.Value = (UINT16) NotifyValue;
NotifyInfo->Notify.HandlerObj = HandlerObj;
- Status = AcpiOsQueueForExecution (OSD_PRIORITY_HIGH,
- AcpiEvNotifyDispatch, NotifyInfo);
+ Status = AcpiOsExecute (
+ OSL_NOTIFY_HANDLER, AcpiEvNotifyDispatch, NotifyInfo);
if (ACPI_FAILURE (Status))
{
AcpiUtDeleteGenericState (NotifyInfo);
@@ -385,52 +391,19 @@ AcpiEvNotifyDispatch (
/*******************************************************************************
*
- * FUNCTION: AcpiEvGlobalLockThread
- *
- * PARAMETERS: Context - From thread interface, not used
- *
- * RETURN: None
- *
- * DESCRIPTION: Invoked by SCI interrupt handler upon acquisition of the
- * Global Lock. Simply signal all threads that are waiting
- * for the lock.
- *
- ******************************************************************************/
-
-static void ACPI_SYSTEM_XFACE
-AcpiEvGlobalLockThread (
- void *Context)
-{
- ACPI_STATUS Status;
-
-
- /* Signal threads that are waiting for the lock */
-
- if (AcpiGbl_GlobalLockThreadCount)
- {
- /* Send sufficient units to the semaphore */
-
- Status = AcpiOsSignalSemaphore (AcpiGbl_GlobalLockSemaphore,
- AcpiGbl_GlobalLockThreadCount);
- if (ACPI_FAILURE (Status))
- {
- ACPI_REPORT_ERROR (("Could not signal Global Lock semaphore\n"));
- }
- }
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: AcpiEvGlobalLockHandler
*
* PARAMETERS: Context - From thread interface, not used
*
- * RETURN: ACPI_INTERRUPT_HANDLED or ACPI_INTERRUPT_NOT_HANDLED
+ * RETURN: ACPI_INTERRUPT_HANDLED
*
* DESCRIPTION: Invoked directly from the SCI handler when a global lock
- * release interrupt occurs. Grab the global lock and queue
- * the global lock thread for execution
+ * release interrupt occurs. Attempt to acquire the global lock,
+ * if successful, signal the thread waiting for the lock.
+ *
+ * NOTE: Assumes that the semaphore can be signaled from interrupt level. If
+ * this is not possible for some reason, a separate thread will have to be
+ * scheduled to do this.
*
******************************************************************************/
@@ -443,27 +416,24 @@ AcpiEvGlobalLockHandler (
/*
- * Attempt to get the lock
+ * Attempt to get the lock.
+ *
* 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 (AcpiGbl_CommonFACS.GlobalLock, Acquired);
+ ACPI_ACQUIRE_GLOBAL_LOCK (Facs, Acquired);
if (Acquired)
{
- /* Got the lock, now wake all threads waiting for it */
+ /* Got the lock, now wake the thread waiting for it */
AcpiGbl_GlobalLockAcquired = TRUE;
- /* Run the Global Lock thread which will signal all waiting threads */
+ /* Send a unit to the semaphore */
- Status = AcpiOsQueueForExecution (OSD_PRIORITY_HIGH,
- AcpiEvGlobalLockThread, Context);
+ Status = AcpiOsSignalSemaphore (AcpiGbl_GlobalLockSemaphore, 1);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR (("Could not queue Global Lock thread, %s\n",
- AcpiFormatException (Status)));
-
- return (ACPI_INTERRUPT_NOT_HANDLED);
+ ACPI_ERROR ((AE_INFO, "Could not signal Global Lock semaphore"));
}
}
@@ -490,9 +460,15 @@ AcpiEvInitGlobalLockHandler (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("EvInitGlobalLockHandler");
+ ACPI_FUNCTION_TRACE (EvInitGlobalLockHandler);
+ Status = AcpiGetTableByIndex (ACPI_TABLE_INDEX_FACS, (ACPI_TABLE_HEADER **) &Facs);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
AcpiGbl_GlobalLockPresent = TRUE;
Status = AcpiInstallFixedEventHandler (ACPI_EVENT_GLOBAL,
AcpiEvGlobalLockHandler, NULL);
@@ -506,8 +482,8 @@ AcpiEvInitGlobalLockHandler (
*/
if (Status == AE_NO_HARDWARE_RESPONSE)
{
- ACPI_REPORT_ERROR ((
- "No response from Global Lock hardware, disabling lock\n"));
+ ACPI_ERROR ((AE_INFO,
+ "No response from Global Lock hardware, disabling lock"));
AcpiGbl_GlobalLockPresent = FALSE;
Status = AE_OK;
@@ -517,6 +493,35 @@ AcpiEvInitGlobalLockHandler (
}
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvRemoveGlobalLockHandler
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Remove the handler for the Global Lock
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiEvRemoveGlobalLockHandler (
+ void)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE (EvRemoveGlobalLockHandler);
+
+ AcpiGbl_GlobalLockPresent = FALSE;
+ Status = AcpiRemoveFixedEventHandler (ACPI_EVENT_GLOBAL,
+ AcpiEvGlobalLockHandler);
+
+ return_ACPI_STATUS (Status);
+}
+
+
/******************************************************************************
*
* FUNCTION: AcpiEvAcquireGlobalLock
@@ -527,6 +532,16 @@ AcpiEvInitGlobalLockHandler (
*
* DESCRIPTION: Attempt to gain ownership of the Global Lock.
*
+ * MUTEX: Interpreter must be locked
+ *
+ * Note: The original implementation allowed multiple threads to "acquire" the
+ * Global Lock, and the OS would hold the lock until the last thread had
+ * released it. However, this could potentially starve the BIOS out of the
+ * lock, especially in the case where there is a tight handshake between the
+ * Embedded Controller driver and the BIOS. Therefore, this implementation
+ * allows only one thread to acquire the HW Global Lock at a time, and makes
+ * the global lock appear as a standard mutex on the OS side.
+ *
*****************************************************************************/
ACPI_STATUS
@@ -537,56 +552,56 @@ AcpiEvAcquireGlobalLock (
BOOLEAN Acquired = FALSE;
- ACPI_FUNCTION_TRACE ("EvAcquireGlobalLock");
-
+ ACPI_FUNCTION_TRACE (EvAcquireGlobalLock);
-#ifndef ACPI_APPLICATION
- /* Make sure that we actually have a global lock */
- if (!AcpiGbl_GlobalLockPresent)
+ /*
+ * Only one thread can acquire the GL at a time, the GlobalLockMutex
+ * enforces this. This interface releases the interpreter if we must wait.
+ */
+ Status = AcpiExSystemWaitMutex (AcpiGbl_GlobalLockMutex->Mutex.OsMutex,
+ Timeout);
+ if (ACPI_FAILURE (Status))
{
- return_ACPI_STATUS (AE_NO_GLOBAL_LOCK);
+ return_ACPI_STATUS (Status);
}
-#endif
-
- /* One more thread wants the global lock */
-
- AcpiGbl_GlobalLockThreadCount++;
/*
- * If we (OS side vs. BIOS side) have the hardware lock already,
- * we are done
+ * Make sure that a global lock actually exists. If not, just treat
+ * the lock as a standard mutex.
*/
- if (AcpiGbl_GlobalLockAcquired)
+ if (!AcpiGbl_GlobalLockPresent)
{
+ AcpiGbl_GlobalLockAcquired = TRUE;
return_ACPI_STATUS (AE_OK);
}
- /* We must acquire the actual hardware lock */
+ /* Attempt to acquire the actual hardware lock */
- ACPI_ACQUIRE_GLOBAL_LOCK (AcpiGbl_CommonFACS.GlobalLock, Acquired);
+ ACPI_ACQUIRE_GLOBAL_LOCK (Facs, Acquired);
if (Acquired)
{
/* We got the lock */
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Acquired the HW Global Lock\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Acquired hardware Global Lock\n"));
AcpiGbl_GlobalLockAcquired = TRUE;
return_ACPI_STATUS (AE_OK);
}
/*
- * Did not get the lock. The pending bit was set above, and we must now
+ * Did not get the lock. The pending bit was set above, and we must now
* wait until we get the global lock released interrupt.
*/
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Waiting for the HW Global Lock\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Waiting for hardware Global Lock\n"));
/*
- * Acquire the global lock semaphore first.
- * Since this wait will block, we must release the interpreter
+ * Wait for handshake with the global lock interrupt handler.
+ * This interface releases the interpreter if we must wait.
*/
Status = AcpiExSystemWaitSemaphore (AcpiGbl_GlobalLockSemaphore,
- Timeout);
+ ACPI_WAIT_FOREVER);
+
return_ACPI_STATUS (Status);
}
@@ -611,43 +626,42 @@ AcpiEvReleaseGlobalLock (
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE ("EvReleaseGlobalLock");
+ ACPI_FUNCTION_TRACE (EvReleaseGlobalLock);
- if (!AcpiGbl_GlobalLockThreadCount)
+ /* Lock must be already acquired */
+
+ if (!AcpiGbl_GlobalLockAcquired)
{
- ACPI_REPORT_WARNING((
- "Cannot release HW Global Lock, it has not been acquired\n"));
+ ACPI_WARNING ((AE_INFO,
+ "Cannot release the ACPI Global Lock, it has not been acquired"));
return_ACPI_STATUS (AE_NOT_ACQUIRED);
}
- /* One fewer thread has the global lock */
-
- AcpiGbl_GlobalLockThreadCount--;
- if (AcpiGbl_GlobalLockThreadCount)
+ if (AcpiGbl_GlobalLockPresent)
{
- /* There are still some threads holding the lock, cannot release */
+ /* Allow any thread to release the lock */
- return_ACPI_STATUS (AE_OK);
+ ACPI_RELEASE_GLOBAL_LOCK (Facs, Pending);
+
+ /*
+ * If the pending bit was set, we must write GBL_RLS to the control
+ * register
+ */
+ if (Pending)
+ {
+ Status = AcpiSetRegister (
+ ACPI_BITREG_GLOBAL_LOCK_RELEASE, 1);
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Released hardware Global Lock\n"));
}
- /*
- * No more threads holding lock, we can do the actual hardware
- * release
- */
- ACPI_RELEASE_GLOBAL_LOCK (AcpiGbl_CommonFACS.GlobalLock, Pending);
AcpiGbl_GlobalLockAcquired = FALSE;
- /*
- * If the pending bit was set, we must write GBL_RLS to the control
- * register
- */
- if (Pending)
- {
- Status = AcpiSetRegister (ACPI_BITREG_GLOBAL_LOCK_RELEASE,
- 1, ACPI_MTX_LOCK);
- }
+ /* Release the local GL mutex */
+ AcpiOsReleaseMutex (AcpiGbl_GlobalLockMutex->Mutex.OsMutex);
return_ACPI_STATUS (Status);
}
@@ -672,7 +686,7 @@ AcpiEvTerminate (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("EvTerminate");
+ ACPI_FUNCTION_TRACE (EvTerminate);
if (AcpiGbl_EventsInitialized)
@@ -689,8 +703,8 @@ AcpiEvTerminate (
Status = AcpiDisableEvent ((UINT32) i, 0);
if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Could not disable fixed event %d\n", (UINT32) i));
+ ACPI_ERROR ((AE_INFO,
+ "Could not disable fixed event %d", (UINT32) i));
}
}
@@ -703,8 +717,15 @@ AcpiEvTerminate (
Status = AcpiEvRemoveSciHandler ();
if (ACPI_FAILURE(Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Could not remove SCI handler\n"));
+ ACPI_ERROR ((AE_INFO,
+ "Could not remove SCI handler"));
+ }
+
+ Status = AcpiEvRemoveGlobalLockHandler ();
+ if (ACPI_FAILURE(Status))
+ {
+ ACPI_ERROR ((AE_INFO,
+ "Could not remove Global Lock handler"));
}
}
@@ -719,7 +740,7 @@ AcpiEvTerminate (
Status = AcpiDisable ();
if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "AcpiDisable failed\n"));
+ ACPI_WARNING ((AE_INFO, "AcpiDisable failed"));
}
}
return_VOID;
diff --git a/sys/contrib/dev/acpica/evregion.c b/sys/contrib/dev/acpica/evregion.c
index 5447e13..f7071b1 100644
--- a/sys/contrib/dev/acpica/evregion.c
+++ b/sys/contrib/dev/acpica/evregion.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evregion - ACPI AddressSpace (OpRegion) handler dispatch
- * $Revision: 1.156 $
+ * $Revision: 1.168 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -127,11 +127,13 @@
#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};
+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 */
@@ -170,7 +172,7 @@ AcpiEvInstallRegionHandlers (
ACPI_NATIVE_UINT i;
- ACPI_FUNCTION_TRACE ("EvInstallRegionHandlers");
+ ACPI_FUNCTION_TRACE (EvInstallRegionHandlers);
Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
@@ -200,8 +202,8 @@ AcpiEvInstallRegionHandlers (
for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++)
{
Status = AcpiEvInstallSpaceHandler (AcpiGbl_RootNode,
- AcpiGbl_DefaultAddressSpaces[i],
- ACPI_DEFAULT_HANDLER, NULL, NULL);
+ AcpiGbl_DefaultAddressSpaces[i],
+ ACPI_DEFAULT_HANDLER, NULL, NULL);
switch (Status)
{
case AE_OK:
@@ -246,7 +248,7 @@ AcpiEvInitializeOpRegions (
ACPI_NATIVE_UINT i;
- ACPI_FUNCTION_TRACE ("EvInitializeOpRegions");
+ ACPI_FUNCTION_TRACE (EvInitializeOpRegions);
Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
@@ -264,7 +266,7 @@ AcpiEvInitializeOpRegions (
* _REG will have already been run.
*/
Status = AcpiEvExecuteRegMethods (AcpiGbl_RootNode,
- AcpiGbl_DefaultAddressSpaces[i]);
+ AcpiGbl_DefaultAddressSpaces[i]);
}
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
@@ -290,13 +292,13 @@ AcpiEvExecuteRegMethod (
ACPI_OPERAND_OBJECT *RegionObj,
UINT32 Function)
{
- ACPI_PARAMETER_INFO Info;
- ACPI_OPERAND_OBJECT *Params[3];
+ ACPI_EVALUATE_INFO *Info;
+ ACPI_OPERAND_OBJECT *Args[3];
ACPI_OPERAND_OBJECT *RegionObj2;
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("EvExecuteRegMethod");
+ ACPI_FUNCTION_TRACE (EvExecuteRegMethod);
RegionObj2 = AcpiNsGetSecondaryObject (RegionObj);
@@ -310,50 +312,63 @@ AcpiEvExecuteRegMethod (
return_ACPI_STATUS (AE_OK);
}
+ /* Allocate and initialize the evaluation information block */
+
+ Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO));
+ if (!Info)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ Info->PrefixNode = RegionObj2->Extra.Method_REG;
+ Info->Pathname = NULL;
+ Info->Parameters = Args;
+ Info->ParameterType = ACPI_PARAM_ARGS;
+ Info->Flags = ACPI_IGNORE_RETURN_VALUE;
+
/*
* The _REG method has two arguments:
*
- * Arg0, Integer: Operation region space ID
- * Same value as RegionObj->Region.SpaceId
- * Arg1, Integer: connection status
- * 1 for connecting the handler,
- * 0 for disconnecting the handler
- * Passed as a parameter
+ * Arg0 - Integer:
+ * Operation region space ID Same value as RegionObj->Region.SpaceId
+ *
+ * Arg1 - Integer:
+ * connection status 1 for connecting the handler, 0 for disconnecting
+ * the handler (Passed as a parameter)
*/
- Params[0] = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
- if (!Params[0])
+ Args[0] = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
+ if (!Args[0])
{
- return_ACPI_STATUS (AE_NO_MEMORY);
+ Status = AE_NO_MEMORY;
+ goto Cleanup1;
}
- Params[1] = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
- if (!Params[1])
+ Args[1] = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
+ if (!Args[1])
{
Status = AE_NO_MEMORY;
- goto Cleanup;
+ goto Cleanup2;
}
/* Setup the parameter objects */
- Params[0]->Integer.Value = RegionObj->Region.SpaceId;
- Params[1]->Integer.Value = Function;
- Params[2] = NULL;
-
- Info.Node = RegionObj2->Extra.Method_REG;
- Info.Parameters = Params;
- Info.ParameterType = ACPI_PARAM_ARGS;
+ Args[0]->Integer.Value = RegionObj->Region.SpaceId;
+ Args[1]->Integer.Value = Function;
+ Args[2] = NULL;
/* Execute the method, no return value */
- ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (
- ACPI_TYPE_METHOD, Info.Node, NULL));
- Status = AcpiNsEvaluateByHandle (&Info);
+ ACPI_DEBUG_EXEC (
+ AcpiUtDisplayInitPathname (ACPI_TYPE_METHOD, Info->PrefixNode, NULL));
- AcpiUtRemoveReference (Params[1]);
+ Status = AcpiNsEvaluate (Info);
+ AcpiUtRemoveReference (Args[1]);
-Cleanup:
- AcpiUtRemoveReference (Params[0]);
+Cleanup2:
+ AcpiUtRemoveReference (Args[0]);
+Cleanup1:
+ ACPI_FREE (Info);
return_ACPI_STATUS (Status);
}
@@ -366,7 +381,8 @@ Cleanup:
* Function - Read or Write operation
* Address - Where in the space to read or write
* BitWidth - Field width in bits (8, 16, 32, or 64)
- * Value - Pointer to in or out value
+ * Value - Pointer to in or out value, must be
+ * full 64-bit ACPI_INTEGER
*
* RETURN: Status
*
@@ -381,10 +397,9 @@ AcpiEvAddressSpaceDispatch (
UINT32 Function,
ACPI_PHYSICAL_ADDRESS Address,
UINT32 BitWidth,
- void *Value)
+ ACPI_INTEGER *Value)
{
ACPI_STATUS Status;
- ACPI_STATUS Status2;
ACPI_ADR_SPACE_HANDLER Handler;
ACPI_ADR_SPACE_SETUP RegionSetup;
ACPI_OPERAND_OBJECT *HandlerDesc;
@@ -392,7 +407,7 @@ AcpiEvAddressSpaceDispatch (
void *RegionContext = NULL;
- ACPI_FUNCTION_TRACE ("EvAddressSpaceDispatch");
+ ACPI_FUNCTION_TRACE (EvAddressSpaceDispatch);
RegionObj2 = AcpiNsGetSecondaryObject (RegionObj);
@@ -406,8 +421,8 @@ AcpiEvAddressSpaceDispatch (
HandlerDesc = RegionObj->Region.Handler;
if (!HandlerDesc)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "No handler for Region [%4.4s] (%p) [%s]\n",
+ ACPI_ERROR ((AE_INFO,
+ "No handler for Region [%4.4s] (%p) [%s]",
AcpiUtGetNodeName (RegionObj->Region.Node),
RegionObj, AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
@@ -428,8 +443,8 @@ AcpiEvAddressSpaceDispatch (
{
/* No initialization routine, exit with error */
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "No init routine for region(%p) [%s]\n",
+ ACPI_ERROR ((AE_INFO,
+ "No init routine for region(%p) [%s]",
RegionObj, AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
return_ACPI_STATUS (AE_NOT_EXIST);
}
@@ -439,25 +454,21 @@ AcpiEvAddressSpaceDispatch (
* setup will potentially execute control methods
* (e.g., _REG method for this region)
*/
- AcpiExExitInterpreter ();
+ AcpiExRelinquishInterpreter ();
Status = RegionSetup (RegionObj, ACPI_REGION_ACTIVATE,
- HandlerDesc->AddressSpace.Context, &RegionContext);
+ HandlerDesc->AddressSpace.Context, &RegionContext);
/* Re-enter the interpreter */
- Status2 = AcpiExEnterInterpreter ();
- if (ACPI_FAILURE (Status2))
- {
- return_ACPI_STATUS (Status2);
- }
+ AcpiExReacquireInterpreter ();
/* Check for failure of the Region Setup */
if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Region Init: %s [%s]\n",
- AcpiFormatException (Status),
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "During region initialization: [%s]",
AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
return_ACPI_STATUS (Status);
}
@@ -473,7 +484,7 @@ AcpiEvAddressSpaceDispatch (
{
/* The handler for this region was already installed */
- ACPI_MEM_FREE (RegionContext);
+ ACPI_FREE (RegionContext);
}
else
{
@@ -496,40 +507,36 @@ AcpiEvAddressSpaceDispatch (
ACPI_FORMAT_UINT64 (Address),
AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
- if (!(HandlerDesc->AddressSpace.Hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED))
+ if (!(HandlerDesc->AddressSpace.HandlerFlags &
+ ACPI_ADDR_HANDLER_DEFAULT_INSTALLED))
{
/*
* For handlers other than the default (supplied) handlers, we must
* 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.
*/
- AcpiExExitInterpreter();
+ AcpiExRelinquishInterpreter();
}
/* Call the handler */
Status = Handler (Function, Address, BitWidth, Value,
- HandlerDesc->AddressSpace.Context,
- RegionObj2->Extra.RegionContext);
+ HandlerDesc->AddressSpace.Context, RegionObj2->Extra.RegionContext);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR (("Handler for [%s] returned %s\n",
- AcpiUtGetRegionName (RegionObj->Region.SpaceId),
- AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status, "Returned by Handler for [%s]",
+ AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
}
- if (!(HandlerDesc->AddressSpace.Hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED))
+ if (!(HandlerDesc->AddressSpace.HandlerFlags &
+ ACPI_ADDR_HANDLER_DEFAULT_INSTALLED))
{
/*
* We just returned from a non-default handler, we must re-enter the
* interpreter
*/
- Status2 = AcpiExEnterInterpreter ();
- if (ACPI_FAILURE (Status2))
- {
- return_ACPI_STATUS (Status2);
- }
+ AcpiExReacquireInterpreter ();
}
return_ACPI_STATUS (Status);
@@ -564,7 +571,7 @@ AcpiEvDetachRegion(
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("EvDetachRegion");
+ ACPI_FUNCTION_TRACE (EvDetachRegion);
RegionObj2 = AcpiNsGetSecondaryObject (RegionObj);
@@ -618,8 +625,7 @@ AcpiEvDetachRegion(
Status = AcpiEvExecuteRegMethod (RegionObj, 0);
if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s from region _REG, [%s]\n",
- AcpiFormatException (Status),
+ ACPI_EXCEPTION ((AE_INFO, Status, "from region _REG, [%s]",
AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
}
@@ -632,32 +638,36 @@ AcpiEvDetachRegion(
}
}
- /* 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)
+ {
+ RegionSetup = HandlerObj->AddressSpace.Setup;
+ Status = RegionSetup (RegionObj, ACPI_REGION_DEACTIVATE,
+ HandlerObj->AddressSpace.Context, RegionContext);
- RegionSetup = HandlerObj->AddressSpace.Setup;
- Status = RegionSetup (RegionObj, ACPI_REGION_DEACTIVATE,
- HandlerObj->AddressSpace.Context, RegionContext);
+ /* Init routine may fail, Just ignore errors */
- /* Init routine may fail, Just ignore errors */
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "from region handler - deactivate, [%s]",
+ AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
+ }
- if (ACPI_FAILURE (Status))
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s from region init, [%s]\n",
- AcpiFormatException (Status),
- AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
+ RegionObj->Region.Flags &= ~(AOPOBJ_SETUP_COMPLETE);
}
- RegionObj->Region.Flags &= ~(AOPOBJ_SETUP_COMPLETE);
-
/*
* Remove handler reference in the region
*
- * NOTE: this doesn't mean that the region goes away
- * The region is just inaccessible as indicated to
- * the _REG method
+ * NOTE: this doesn't mean that the region goes away, the region
+ * is just inaccessible as indicated to the _REG method
*
- * If the region is on the handler's list
- * this better be the region's handler
+ * If the region is on the handler's list, this must be the
+ * region's handler
*/
RegionObj->Region.Handler = NULL;
AcpiUtRemoveReference (HandlerObj);
@@ -703,7 +713,7 @@ AcpiEvAttachRegion (
BOOLEAN AcpiNsIsLocked)
{
- ACPI_FUNCTION_TRACE ("EvAttachRegion");
+ ACPI_FUNCTION_TRACE (EvAttachRegion);
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
@@ -762,7 +772,7 @@ AcpiEvInstallHandler (
ACPI_STATUS Status;
- ACPI_FUNCTION_NAME ("EvInstallHandler");
+ ACPI_FUNCTION_NAME (EvInstallHandler);
HandlerObj = (ACPI_OPERAND_OBJECT *) Context;
@@ -899,10 +909,10 @@ AcpiEvInstallSpaceHandler (
ACPI_OPERAND_OBJECT *HandlerObj;
ACPI_STATUS Status;
ACPI_OBJECT_TYPE Type;
- UINT16 Flags = 0;
+ UINT8 Flags = 0;
- ACPI_FUNCTION_TRACE ("EvInstallSpaceHandler");
+ ACPI_FUNCTION_TRACE (EvInstallSpaceHandler);
/*
@@ -1073,17 +1083,17 @@ AcpiEvInstallSpaceHandler (
/* Init handler obj */
- HandlerObj->AddressSpace.SpaceId = (UINT8) SpaceId;
- HandlerObj->AddressSpace.Hflags = Flags;
- HandlerObj->AddressSpace.RegionList = NULL;
- HandlerObj->AddressSpace.Node = Node;
- HandlerObj->AddressSpace.Handler = Handler;
- HandlerObj->AddressSpace.Context = Context;
- HandlerObj->AddressSpace.Setup = Setup;
+ HandlerObj->AddressSpace.SpaceId = (UINT8) SpaceId;
+ HandlerObj->AddressSpace.HandlerFlags = Flags;
+ HandlerObj->AddressSpace.RegionList = NULL;
+ HandlerObj->AddressSpace.Node = Node;
+ HandlerObj->AddressSpace.Handler = Handler;
+ HandlerObj->AddressSpace.Context = Context;
+ HandlerObj->AddressSpace.Setup = Setup;
/* Install at head of Device.AddressSpace list */
- HandlerObj->AddressSpace.Next = ObjDesc->Device.Handler;
+ HandlerObj->AddressSpace.Next = ObjDesc->Device.Handler;
/*
* The Device object is the first reference on the HandlerObj.
@@ -1104,8 +1114,8 @@ AcpiEvInstallSpaceHandler (
* of the branch
*/
Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, Node, ACPI_UINT32_MAX,
- ACPI_NS_WALK_UNLOCK, AcpiEvInstallHandler,
- HandlerObj, NULL);
+ ACPI_NS_WALK_UNLOCK, AcpiEvInstallHandler,
+ HandlerObj, NULL);
UnlockAndExit:
return_ACPI_STATUS (Status);
@@ -1134,7 +1144,7 @@ AcpiEvExecuteRegMethods (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("EvExecuteRegMethods");
+ ACPI_FUNCTION_TRACE (EvExecuteRegMethods);
/*
@@ -1145,8 +1155,8 @@ AcpiEvExecuteRegMethods (
* can run any _REG methods)
*/
Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, Node, ACPI_UINT32_MAX,
- ACPI_NS_WALK_UNLOCK, AcpiEvRegRun,
- &SpaceId, NULL);
+ ACPI_NS_WALK_UNLOCK, AcpiEvRegRun,
+ &SpaceId, NULL);
return_ACPI_STATUS (Status);
}
diff --git a/sys/contrib/dev/acpica/evrgnini.c b/sys/contrib/dev/acpica/evrgnini.c
index 1af974c..615c397 100644
--- a/sys/contrib/dev/acpica/evrgnini.c
+++ b/sys/contrib/dev/acpica/evrgnini.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evrgnini- ACPI AddressSpace (OpRegion) init
- * $Revision: 1.78 $
+ * $Revision: 1.88 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -124,6 +124,16 @@
#define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evrgnini")
+/* Local prototypes */
+
+static BOOLEAN
+AcpiEvMatchPciRootBridge (
+ char *Id);
+
+static BOOLEAN
+AcpiEvIsPciRootBridge (
+ ACPI_NAMESPACE_NODE *Node);
+
/*******************************************************************************
*
@@ -151,14 +161,23 @@ AcpiEvSystemMemoryRegionSetup (
ACPI_MEM_SPACE_CONTEXT *LocalRegionContext;
- ACPI_FUNCTION_TRACE ("EvSystemMemoryRegionSetup");
+ ACPI_FUNCTION_TRACE (EvSystemMemoryRegionSetup);
if (Function == ACPI_REGION_DEACTIVATE)
{
if (*RegionContext)
{
- ACPI_MEM_FREE (*RegionContext);
+ LocalRegionContext = (ACPI_MEM_SPACE_CONTEXT *) *RegionContext;
+
+ /* Delete a cached mapping if present */
+
+ if (LocalRegionContext->MappedLength)
+ {
+ AcpiOsUnmapMemory (LocalRegionContext->MappedLogicalAddress,
+ LocalRegionContext->MappedLength);
+ }
+ ACPI_FREE (LocalRegionContext);
*RegionContext = NULL;
}
return_ACPI_STATUS (AE_OK);
@@ -166,7 +185,7 @@ AcpiEvSystemMemoryRegionSetup (
/* Create a new context */
- LocalRegionContext = ACPI_MEM_CALLOCATE (sizeof (ACPI_MEM_SPACE_CONTEXT));
+ LocalRegionContext = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_MEM_SPACE_CONTEXT));
if (!(LocalRegionContext))
{
return_ACPI_STATUS (AE_NO_MEMORY);
@@ -204,7 +223,7 @@ AcpiEvIoSpaceRegionSetup (
void *HandlerContext,
void **RegionContext)
{
- ACPI_FUNCTION_TRACE ("EvIoSpaceRegionSetup");
+ ACPI_FUNCTION_TRACE (EvIoSpaceRegionSetup);
if (Function == ACPI_REGION_DEACTIVATE)
@@ -250,11 +269,11 @@ AcpiEvPciConfigRegionSetup (
ACPI_OPERAND_OBJECT *HandlerObj;
ACPI_NAMESPACE_NODE *ParentNode;
ACPI_NAMESPACE_NODE *PciRootNode;
+ ACPI_NAMESPACE_NODE *PciDeviceNode;
ACPI_OPERAND_OBJECT *RegionObj = (ACPI_OPERAND_OBJECT *) Handle;
- ACPI_DEVICE_ID ObjectHID;
- ACPI_FUNCTION_TRACE ("EvPciConfigRegionSetup");
+ ACPI_FUNCTION_TRACE (EvPciConfigRegionSetup);
HandlerObj = RegionObj->Region.Handler;
@@ -274,7 +293,7 @@ AcpiEvPciConfigRegionSetup (
{
if (PciId)
{
- ACPI_MEM_FREE (PciId);
+ ACPI_FREE (PciId);
}
return_ACPI_STATUS (Status);
}
@@ -301,43 +320,35 @@ AcpiEvPciConfigRegionSetup (
PciRootNode = ParentNode;
while (PciRootNode != AcpiGbl_RootNode)
{
- Status = AcpiUtExecute_HID (PciRootNode, &ObjectHID);
- if (ACPI_SUCCESS (Status))
+ /* Get the _HID/_CID in order to detect a RootBridge */
+
+ if (AcpiEvIsPciRootBridge (PciRootNode))
{
- /*
- * Got a valid _HID string, check if this is a PCI root.
- * New for ACPI 3.0: check for a PCI Express root also.
- */
- if (!(ACPI_STRNCMP (ObjectHID.Value, PCI_ROOT_HID_STRING,
- sizeof (PCI_ROOT_HID_STRING)) ||
- !(ACPI_STRNCMP (ObjectHID.Value, PCI_EXPRESS_ROOT_HID_STRING,
- sizeof (PCI_EXPRESS_ROOT_HID_STRING)))))
- {
- /* Install a handler for this PCI root bridge */
+ /* Install a handler for this PCI root bridge */
- Status = AcpiInstallAddressSpaceHandler ((ACPI_HANDLE) PciRootNode,
- ACPI_ADR_SPACE_PCI_CONFIG,
- ACPI_DEFAULT_HANDLER, NULL, NULL);
- if (ACPI_FAILURE (Status))
+ Status = AcpiInstallAddressSpaceHandler (
+ (ACPI_HANDLE) PciRootNode,
+ ACPI_ADR_SPACE_PCI_CONFIG,
+ ACPI_DEFAULT_HANDLER, NULL, NULL);
+ if (ACPI_FAILURE (Status))
+ {
+ if (Status == AE_SAME_HANDLER)
{
- 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.
- */
- Status = AE_OK;
- }
- else
- {
- ACPI_REPORT_ERROR ((
- "Could not install PciConfig handler for Root Bridge %4.4s, %s\n",
- AcpiUtGetNodeName (PciRootNode), AcpiFormatException (Status)));
- }
+ /*
+ * 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",
+ AcpiUtGetNodeName (PciRootNode)));
}
- break;
}
+ break;
}
PciRootNode = AcpiNsGetParentNode (PciRootNode);
@@ -361,7 +372,7 @@ AcpiEvPciConfigRegionSetup (
/* Region is still not initialized. Create a new context */
- PciId = ACPI_MEM_CALLOCATE (sizeof (ACPI_PCI_ID));
+ PciId = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_PCI_ID));
if (!PciId)
{
return_ACPI_STATUS (AE_NO_MEMORY);
@@ -370,13 +381,26 @@ AcpiEvPciConfigRegionSetup (
/*
* 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.)
*/
+ PciDeviceNode = RegionObj->Region.Node;
+ while (PciDeviceNode && (PciDeviceNode->Type != ACPI_TYPE_DEVICE))
+ {
+ PciDeviceNode = AcpiNsGetParentNode (PciDeviceNode);
+ }
+
+ if (!PciDeviceNode)
+ {
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+ }
/*
* Get the PCI device and function numbers from the _ADR object
* contained in the parent's scope.
*/
- Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR, ParentNode, &PciValue);
+ Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR, PciDeviceNode, &PciValue);
/*
* The default is zero, and since the allocation above zeroed
@@ -415,6 +439,105 @@ AcpiEvPciConfigRegionSetup (
/*******************************************************************************
*
+ * FUNCTION: AcpiEvMatchPciRootBridge
+ *
+ * PARAMETERS: Id - The HID/CID in string format
+ *
+ * RETURN: TRUE if the Id is a match for a PCI/PCI-Express Root Bridge
+ *
+ * DESCRIPTION: Determine if the input ID is a PCI Root Bridge ID.
+ *
+ ******************************************************************************/
+
+static BOOLEAN
+AcpiEvMatchPciRootBridge (
+ char *Id)
+{
+
+ /*
+ * Check if this is a PCI root.
+ * ACPI 3.0+: check for a PCI Express root also.
+ */
+ if (!(ACPI_STRNCMP (Id,
+ PCI_ROOT_HID_STRING,
+ sizeof (PCI_ROOT_HID_STRING))) ||
+
+ !(ACPI_STRNCMP (Id,
+ PCI_EXPRESS_ROOT_HID_STRING,
+ sizeof (PCI_EXPRESS_ROOT_HID_STRING))))
+ {
+ return (TRUE);
+ }
+
+ return (FALSE);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvIsPciRootBridge
+ *
+ * PARAMETERS: Node - Device node being examined
+ *
+ * RETURN: TRUE if device is a PCI/PCI-Express Root Bridge
+ *
+ * DESCRIPTION: Determine if the input device represents a PCI Root Bridge by
+ * examining the _HID and _CID for the device.
+ *
+ ******************************************************************************/
+
+static BOOLEAN
+AcpiEvIsPciRootBridge (
+ ACPI_NAMESPACE_NODE *Node)
+{
+ ACPI_STATUS Status;
+ ACPI_DEVICE_ID Hid;
+ ACPI_COMPATIBLE_ID_LIST *Cid;
+ ACPI_NATIVE_UINT i;
+
+
+ /*
+ * Get the _HID and check for a PCI Root Bridge
+ */
+ Status = AcpiUtExecute_HID (Node, &Hid);
+ if (ACPI_FAILURE (Status))
+ {
+ return (FALSE);
+ }
+
+ if (AcpiEvMatchPciRootBridge (Hid.Value))
+ {
+ return (TRUE);
+ }
+
+ /*
+ * The _HID did not match.
+ * Get the _CID and check for a PCI Root Bridge
+ */
+ Status = AcpiUtExecute_CID (Node, &Cid);
+ if (ACPI_FAILURE (Status))
+ {
+ return (FALSE);
+ }
+
+ /* Check all _CIDs in the returned list */
+
+ for (i = 0; i < Cid->Count; i++)
+ {
+ if (AcpiEvMatchPciRootBridge (Cid->Id[i].Value))
+ {
+ ACPI_FREE (Cid);
+ return (TRUE);
+ }
+ }
+
+ ACPI_FREE (Cid);
+ return (FALSE);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiEvPciBarRegionSetup
*
* PARAMETERS: Handle - Region we are interested in
@@ -437,7 +560,7 @@ AcpiEvPciBarRegionSetup (
void *HandlerContext,
void **RegionContext)
{
- ACPI_FUNCTION_TRACE ("EvPciBarRegionSetup");
+ ACPI_FUNCTION_TRACE (EvPciBarRegionSetup);
return_ACPI_STATUS (AE_OK);
@@ -468,7 +591,7 @@ AcpiEvCmosRegionSetup (
void *HandlerContext,
void **RegionContext)
{
- ACPI_FUNCTION_TRACE ("EvCmosRegionSetup");
+ ACPI_FUNCTION_TRACE (EvCmosRegionSetup);
return_ACPI_STATUS (AE_OK);
@@ -497,7 +620,7 @@ AcpiEvDefaultRegionSetup (
void *HandlerContext,
void **RegionContext)
{
- ACPI_FUNCTION_TRACE ("EvDefaultRegionSetup");
+ ACPI_FUNCTION_TRACE (EvDefaultRegionSetup);
if (Function == ACPI_REGION_DEACTIVATE)
@@ -533,6 +656,9 @@ AcpiEvDefaultRegionSetup (
* 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
+ * method for this region.
+ *
******************************************************************************/
ACPI_STATUS
@@ -550,7 +676,7 @@ AcpiEvInitializeRegion (
ACPI_OPERAND_OBJECT *RegionObj2;
- ACPI_FUNCTION_TRACE_U32 ("EvInitializeRegion", AcpiNsLocked);
+ ACPI_FUNCTION_TRACE_U32 (EvInitializeRegion, AcpiNsLocked);
if (!RegionObj)
@@ -581,8 +707,8 @@ AcpiEvInitializeRegion (
/* Find any "_REG" method associated with this region definition */
- Status = AcpiNsSearchNode (*RegNamePtr, Node,
- ACPI_TYPE_METHOD, &MethodNode);
+ Status = AcpiNsSearchOneScope (
+ *RegNamePtr, Node, ACPI_TYPE_METHOD, &MethodNode);
if (ACPI_SUCCESS (Status))
{
/*
diff --git a/sys/contrib/dev/acpica/evsci.c b/sys/contrib/dev/acpica/evsci.c
index 653f048..ab81cbb 100644
--- a/sys/contrib/dev/acpica/evsci.c
+++ b/sys/contrib/dev/acpica/evsci.c
@@ -2,7 +2,7 @@
*
* Module Name: evsci - System Control Interrupt configuration and
* legacy to ACPI mode state transition functions
- * $Revision: 1.98 $
+ * $Revision: 1.102 $
*
******************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -151,7 +151,7 @@ AcpiEvSciXruptHandler (
UINT32 InterruptHandled = ACPI_INTERRUPT_NOT_HANDLED;
- ACPI_FUNCTION_TRACE("EvSciXruptHandler");
+ ACPI_FUNCTION_TRACE (EvSciXruptHandler);
/*
@@ -195,7 +195,7 @@ AcpiEvGpeXruptHandler (
UINT32 InterruptHandled = ACPI_INTERRUPT_NOT_HANDLED;
- ACPI_FUNCTION_TRACE("EvGpeXruptHandler");
+ ACPI_FUNCTION_TRACE (EvGpeXruptHandler);
/*
@@ -232,11 +232,11 @@ AcpiEvInstallSciHandler (
UINT32 Status = AE_OK;
- ACPI_FUNCTION_TRACE ("EvInstallSciHandler");
+ ACPI_FUNCTION_TRACE (EvInstallSciHandler);
- Status = AcpiOsInstallInterruptHandler ((UINT32) AcpiGbl_FADT->SciInt,
- AcpiEvSciXruptHandler, AcpiGbl_GpeXruptListHead);
+ Status = AcpiOsInstallInterruptHandler ((UINT32) AcpiGbl_FADT.SciInterrupt,
+ AcpiEvSciXruptHandler, AcpiGbl_GpeXruptListHead);
return_ACPI_STATUS (Status);
}
@@ -267,13 +267,13 @@ AcpiEvRemoveSciHandler (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("EvRemoveSciHandler");
+ ACPI_FUNCTION_TRACE (EvRemoveSciHandler);
/* Just let the OS remove the handler and disable the level */
- Status = AcpiOsRemoveInterruptHandler ((UINT32) AcpiGbl_FADT->SciInt,
- AcpiEvSciXruptHandler);
+ Status = AcpiOsRemoveInterruptHandler ((UINT32) AcpiGbl_FADT.SciInterrupt,
+ AcpiEvSciXruptHandler);
return_ACPI_STATUS (Status);
}
diff --git a/sys/contrib/dev/acpica/evxface.c b/sys/contrib/dev/acpica/evxface.c
index 6519ee5..021ebf7 100644
--- a/sys/contrib/dev/acpica/evxface.c
+++ b/sys/contrib/dev/acpica/evxface.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evxface - External interfaces for ACPI events
- * $Revision: 1.152 $
+ * $Revision: 1.165 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -41,7 +41,7 @@
* 3. Conditions
*
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
- * Redistribution of source code of any substantial prton of the Covered
+ * 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,
@@ -146,7 +146,7 @@ AcpiInstallExceptionHandler (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("AcpiInstallExceptionHandler");
+ ACPI_FUNCTION_TRACE (AcpiInstallExceptionHandler);
Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
@@ -172,6 +172,8 @@ Cleanup:
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiInstallExceptionHandler)
+
/*******************************************************************************
*
@@ -198,7 +200,7 @@ AcpiInstallFixedEventHandler (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("AcpiInstallFixedEventHandler");
+ ACPI_FUNCTION_TRACE (AcpiInstallFixedEventHandler);
/* Parameter validation */
@@ -230,7 +232,7 @@ AcpiInstallFixedEventHandler (
Status = AcpiEnableEvent (Event, 0);
if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Could not enable fixed event.\n"));
+ ACPI_WARNING ((AE_INFO, "Could not enable fixed event %X", Event));
/* Remove the handler */
@@ -249,6 +251,8 @@ Cleanup:
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiInstallFixedEventHandler)
+
/*******************************************************************************
*
@@ -271,7 +275,7 @@ AcpiRemoveFixedEventHandler (
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE ("AcpiRemoveFixedEventHandler");
+ ACPI_FUNCTION_TRACE (AcpiRemoveFixedEventHandler);
/* Parameter validation */
@@ -298,18 +302,20 @@ AcpiRemoveFixedEventHandler (
if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_WARN,
- "Could not write to fixed event enable register.\n"));
+ ACPI_WARNING ((AE_INFO,
+ "Could not write to fixed event enable register %X", Event));
}
else
{
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Disabled fixed event %X.\n", Event));
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Disabled fixed event %X\n", Event));
}
(void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiRemoveFixedEventHandler)
+
/*******************************************************************************
*
@@ -342,7 +348,7 @@ AcpiInstallNotifyHandler (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("AcpiInstallNotifyHandler");
+ ACPI_FUNCTION_TRACE (AcpiInstallNotifyHandler);
/* Parameter validation */
@@ -497,6 +503,8 @@ UnlockAndExit:
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiInstallNotifyHandler)
+
/*******************************************************************************
*
@@ -527,7 +535,7 @@ AcpiRemoveNotifyHandler (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("AcpiRemoveNotifyHandler");
+ ACPI_FUNCTION_TRACE (AcpiRemoveNotifyHandler);
/* Parameter validation */
@@ -559,7 +567,7 @@ AcpiRemoveNotifyHandler (
if (Device == ACPI_ROOT_OBJECT)
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Removing notify handler for ROOT object.\n"));
+ "Removing notify handler for namespace root object\n"));
if (((HandlerType & ACPI_SYSTEM_NOTIFY) &&
!AcpiGbl_SystemNotify.Handler) ||
@@ -611,8 +619,13 @@ AcpiRemoveNotifyHandler (
if (HandlerType & ACPI_SYSTEM_NOTIFY)
{
NotifyObj = ObjDesc->CommonNotify.SystemNotify;
- if ((!NotifyObj) ||
- (NotifyObj->Notify.Handler != Handler))
+ if (!NotifyObj)
+ {
+ Status = AE_NOT_EXIST;
+ goto UnlockAndExit;
+ }
+
+ if (NotifyObj->Notify.Handler != Handler)
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
@@ -627,8 +640,13 @@ AcpiRemoveNotifyHandler (
if (HandlerType & ACPI_DEVICE_NOTIFY)
{
NotifyObj = ObjDesc->CommonNotify.DeviceNotify;
- if ((!NotifyObj) ||
- (NotifyObj->Notify.Handler != Handler))
+ if (!NotifyObj)
+ {
+ Status = AE_NOT_EXIST;
+ goto UnlockAndExit;
+ }
+
+ if (NotifyObj->Notify.Handler != Handler)
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
@@ -647,6 +665,8 @@ UnlockAndExit:
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiRemoveNotifyHandler)
+
/*******************************************************************************
*
@@ -677,10 +697,10 @@ AcpiInstallGpeHandler (
ACPI_GPE_EVENT_INFO *GpeEventInfo;
ACPI_HANDLER_INFO *Handler;
ACPI_STATUS Status;
- ACPI_NATIVE_UINT Flags;
+ ACPI_CPU_FLAGS Flags;
- ACPI_FUNCTION_TRACE ("AcpiInstallGpeHandler");
+ ACPI_FUNCTION_TRACE (AcpiInstallGpeHandler);
/* Parameter validation */
@@ -715,7 +735,7 @@ AcpiInstallGpeHandler (
/* Allocate and init handler object */
- Handler = ACPI_MEM_CALLOCATE (sizeof (ACPI_HANDLER_INFO));
+ Handler = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_HANDLER_INFO));
if (!Handler)
{
Status = AE_NO_MEMORY;
@@ -752,6 +772,8 @@ UnlockAndExit:
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiInstallGpeHandler)
+
/*******************************************************************************
*
@@ -777,10 +799,10 @@ AcpiRemoveGpeHandler (
ACPI_GPE_EVENT_INFO *GpeEventInfo;
ACPI_HANDLER_INFO *Handler;
ACPI_STATUS Status;
- ACPI_NATIVE_UINT Flags;
+ ACPI_CPU_FLAGS Flags;
- ACPI_FUNCTION_TRACE ("AcpiRemoveGpeHandler");
+ ACPI_FUNCTION_TRACE (AcpiRemoveGpeHandler);
/* Parameter validation */
@@ -846,7 +868,7 @@ AcpiRemoveGpeHandler (
/* Now we can free the handler object */
- ACPI_MEM_FREE (Handler);
+ ACPI_FREE (Handler);
UnlockAndExit:
@@ -854,6 +876,8 @@ UnlockAndExit:
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiRemoveGpeHandler)
+
/*******************************************************************************
*
@@ -867,6 +891,12 @@ UnlockAndExit:
*
* DESCRIPTION: Acquire the ACPI Global Lock
*
+ * Note: Allows callers with the same thread ID to acquire the global lock
+ * multiple times. In other words, externally, the behavior of the global lock
+ * is identical to an AML mutex. On the first acquire, a new handle is
+ * returned. On any subsequent calls to acquire by the same thread, the same
+ * handle is returned.
+ *
******************************************************************************/
ACPI_STATUS
@@ -882,24 +912,35 @@ AcpiAcquireGlobalLock (
return (AE_BAD_PARAMETER);
}
- Status = AcpiExEnterInterpreter ();
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
+ /* Must lock interpreter to prevent race conditions */
- Status = AcpiEvAcquireGlobalLock (Timeout);
- AcpiExExitInterpreter ();
+ AcpiExEnterInterpreter ();
+
+ Status = AcpiExAcquireMutexObject (Timeout,
+ AcpiGbl_GlobalLockMutex, AcpiOsGetThreadId ());
if (ACPI_SUCCESS (Status))
{
- AcpiGbl_GlobalLockHandle++;
+ /*
+ * If this was the first acquisition of the Global Lock by this thread,
+ * create a new handle. Otherwise, return the existing handle.
+ */
+ if (AcpiGbl_GlobalLockMutex->Mutex.AcquisitionDepth == 1)
+ {
+ AcpiGbl_GlobalLockHandle++;
+ }
+
+ /* Return the global lock handle */
+
*Handle = AcpiGbl_GlobalLockHandle;
}
+ AcpiExExitInterpreter ();
return (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiAcquireGlobalLock)
+
/*******************************************************************************
*
@@ -920,13 +961,14 @@ AcpiReleaseGlobalLock (
ACPI_STATUS Status;
- if (Handle != AcpiGbl_GlobalLockHandle)
+ if (!Handle || (Handle != AcpiGbl_GlobalLockHandle))
{
return (AE_NOT_ACQUIRED);
}
- Status = AcpiEvReleaseGlobalLock ();
+ Status = AcpiExReleaseMutexObject (AcpiGbl_GlobalLockMutex);
return (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiReleaseGlobalLock)
diff --git a/sys/contrib/dev/acpica/evxfevnt.c b/sys/contrib/dev/acpica/evxfevnt.c
index 9a9b33b..e90bded 100644
--- a/sys/contrib/dev/acpica/evxfevnt.c
+++ b/sys/contrib/dev/acpica/evxfevnt.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evxfevnt - External Interfaces, ACPI event disable/enable
- * $Revision: 1.82 $
+ * $Revision: 1.93 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -41,7 +41,7 @@
* 3. Conditions
*
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
- * Redistribution of source code of any substantial prton of the Covered
+ * 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,
@@ -120,6 +120,7 @@
#include <contrib/dev/acpica/acpi.h>
#include <contrib/dev/acpica/acevents.h>
#include <contrib/dev/acpica/acnamesp.h>
+#include <contrib/dev/acpica/actables.h>
#define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evxfevnt")
@@ -144,17 +145,18 @@ AcpiEnable (
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE ("AcpiEnable");
+ ACPI_FUNCTION_TRACE (AcpiEnable);
- /* Make sure we have the FADT*/
+ /* ACPI tables must be present */
- if (!AcpiGbl_FADT)
+ if (!AcpiTbTablesLoaded ())
{
- ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "No FADT information present!\n"));
return_ACPI_STATUS (AE_NO_ACPI_TABLES);
}
+ /* Check current mode */
+
if (AcpiHwGetMode() == ACPI_SYS_MODE_ACPI)
{
ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "System is already in ACPI mode\n"));
@@ -166,7 +168,7 @@ AcpiEnable (
Status = AcpiHwSetMode (ACPI_SYS_MODE_ACPI);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR (("Could not transition to ACPI mode.\n"));
+ ACPI_ERROR ((AE_INFO, "Could not transition to ACPI mode"));
return_ACPI_STATUS (Status);
}
@@ -177,6 +179,8 @@ AcpiEnable (
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiEnable)
+
/*******************************************************************************
*
@@ -197,14 +201,8 @@ AcpiDisable (
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE ("AcpiDisable");
-
+ ACPI_FUNCTION_TRACE (AcpiDisable);
- if (!AcpiGbl_FADT)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "No FADT information present!\n"));
- return_ACPI_STATUS (AE_NO_ACPI_TABLES);
- }
if (AcpiHwGetMode() == ACPI_SYS_MODE_LEGACY)
{
@@ -219,7 +217,7 @@ AcpiDisable (
if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ ACPI_ERROR ((AE_INFO,
"Could not exit ACPI mode to legacy mode"));
return_ACPI_STATUS (Status);
}
@@ -230,6 +228,8 @@ AcpiDisable (
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiDisable)
+
/*******************************************************************************
*
@@ -253,7 +253,7 @@ AcpiEnableEvent (
UINT32 Value;
- ACPI_FUNCTION_TRACE ("AcpiEnableEvent");
+ ACPI_FUNCTION_TRACE (AcpiEnableEvent);
/* Decode the Fixed Event */
@@ -267,8 +267,7 @@ AcpiEnableEvent (
* Enable the requested fixed event (by writing a one to the
* enable register bit)
*/
- Status = AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
- 1, ACPI_MTX_LOCK);
+ Status = AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId, 1);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -277,7 +276,7 @@ AcpiEnableEvent (
/* Make sure that the hardware responded */
Status = AcpiGetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
- &Value, ACPI_MTX_LOCK);
+ &Value);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -285,14 +284,16 @@ AcpiEnableEvent (
if (Value != 1)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Could not enable %s event\n", AcpiUtGetEventName (Event)));
+ ACPI_ERROR ((AE_INFO,
+ "Could not enable %s event", AcpiUtGetEventName (Event)));
return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
}
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiEnableEvent)
+
/*******************************************************************************
*
@@ -318,7 +319,7 @@ AcpiSetGpeType (
ACPI_GPE_EVENT_INFO *GpeEventInfo;
- ACPI_FUNCTION_TRACE ("AcpiSetGpeType");
+ ACPI_FUNCTION_TRACE (AcpiSetGpeType);
/* Ensure that we have a valid GPE number */
@@ -343,6 +344,8 @@ UnlockAndExit:
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiSetGpeType)
+
/*******************************************************************************
*
@@ -369,7 +372,7 @@ AcpiEnableGpe (
ACPI_GPE_EVENT_INFO *GpeEventInfo;
- ACPI_FUNCTION_TRACE ("AcpiEnableGpe");
+ ACPI_FUNCTION_TRACE (AcpiEnableGpe);
/* Use semaphore lock if not executing at interrupt level */
@@ -404,6 +407,8 @@ UnlockAndExit:
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiEnableGpe)
+
/*******************************************************************************
*
@@ -430,7 +435,7 @@ AcpiDisableGpe (
ACPI_GPE_EVENT_INFO *GpeEventInfo;
- ACPI_FUNCTION_TRACE ("AcpiDisableGpe");
+ ACPI_FUNCTION_TRACE (AcpiDisableGpe);
/* Use semaphore lock if not executing at interrupt level */
@@ -463,6 +468,8 @@ UnlockAndExit:
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiDisableGpe)
+
/*******************************************************************************
*
@@ -486,7 +493,7 @@ AcpiDisableEvent (
UINT32 Value;
- ACPI_FUNCTION_TRACE ("AcpiDisableEvent");
+ ACPI_FUNCTION_TRACE (AcpiDisableEvent);
/* Decode the Fixed Event */
@@ -500,15 +507,14 @@ AcpiDisableEvent (
* Disable the requested fixed event (by writing a zero to the
* enable register bit)
*/
- Status = AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
- 0, ACPI_MTX_LOCK);
+ Status = AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId, 0);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
Status = AcpiGetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
- &Value, ACPI_MTX_LOCK);
+ &Value);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -516,14 +522,16 @@ AcpiDisableEvent (
if (Value != 0)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Could not disable %s events\n", AcpiUtGetEventName (Event)));
+ ACPI_ERROR ((AE_INFO,
+ "Could not disable %s events", AcpiUtGetEventName (Event)));
return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
}
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiDisableEvent)
+
/*******************************************************************************
*
@@ -544,7 +552,7 @@ AcpiClearEvent (
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE ("AcpiClearEvent");
+ ACPI_FUNCTION_TRACE (AcpiClearEvent);
/* Decode the Fixed Event */
@@ -558,12 +566,13 @@ AcpiClearEvent (
* Clear the requested fixed event (By writing a one to the
* status register bit)
*/
- Status = AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].StatusRegisterId,
- 1, ACPI_MTX_LOCK);
+ Status = AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].StatusRegisterId, 1);
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiClearEvent)
+
/*******************************************************************************
*
@@ -589,7 +598,7 @@ AcpiClearGpe (
ACPI_GPE_EVENT_INFO *GpeEventInfo;
- ACPI_FUNCTION_TRACE ("AcpiClearGpe");
+ ACPI_FUNCTION_TRACE (AcpiClearGpe);
/* Use semaphore lock if not executing at interrupt level */
@@ -622,6 +631,8 @@ UnlockAndExit:
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiClearGpe)
+
/*******************************************************************************
*
@@ -645,7 +656,7 @@ AcpiGetEventStatus (
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE ("AcpiGetEventStatus");
+ ACPI_FUNCTION_TRACE (AcpiGetEventStatus);
if (!EventStatus)
@@ -663,11 +674,13 @@ AcpiGetEventStatus (
/* Get the status of the requested fixed event */
Status = AcpiGetRegister (AcpiGbl_FixedEventInfo[Event].StatusRegisterId,
- EventStatus, ACPI_MTX_LOCK);
+ EventStatus);
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiGetEventStatus)
+
/*******************************************************************************
*
@@ -696,7 +709,7 @@ AcpiGetGpeStatus (
ACPI_GPE_EVENT_INFO *GpeEventInfo;
- ACPI_FUNCTION_TRACE ("AcpiGetGpeStatus");
+ ACPI_FUNCTION_TRACE (AcpiGetGpeStatus);
/* Use semaphore lock if not executing at interrupt level */
@@ -731,6 +744,8 @@ UnlockAndExit:
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiGetGpeStatus)
+
/*******************************************************************************
*
@@ -760,7 +775,7 @@ AcpiInstallGpeBlock (
ACPI_GPE_BLOCK_INFO *GpeBlock;
- ACPI_FUNCTION_TRACE ("AcpiInstallGpeBlock");
+ ACPI_FUNCTION_TRACE (AcpiInstallGpeBlock);
if ((!GpeDevice) ||
@@ -794,6 +809,14 @@ AcpiInstallGpeBlock (
goto UnlockAndExit;
}
+ /* Run the _PRW methods and enable the GPEs */
+
+ Status = AcpiEvInitializeGpeBlock (Node, GpeBlock);
+ if (ACPI_FAILURE (Status))
+ {
+ goto UnlockAndExit;
+ }
+
/* Get the DeviceObject attached to the node */
ObjDesc = AcpiNsGetAttachedObject (Node);
@@ -830,6 +853,8 @@ UnlockAndExit:
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiInstallGpeBlock)
+
/*******************************************************************************
*
@@ -852,7 +877,7 @@ AcpiRemoveGpeBlock (
ACPI_NAMESPACE_NODE *Node;
- ACPI_FUNCTION_TRACE ("AcpiRemoveGpeBlock");
+ ACPI_FUNCTION_TRACE (AcpiRemoveGpeBlock);
if (!GpeDevice)
@@ -895,3 +920,5 @@ UnlockAndExit:
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiRemoveGpeBlock)
+
diff --git a/sys/contrib/dev/acpica/evxfregn.c b/sys/contrib/dev/acpica/evxfregn.c
index a4f3c74..7058683 100644
--- a/sys/contrib/dev/acpica/evxfregn.c
+++ b/sys/contrib/dev/acpica/evxfregn.c
@@ -2,7 +2,7 @@
*
* Module Name: evxfregn - External Interfaces, ACPI Operation Regions and
* Address Spaces.
- * $Revision: 1.64 $
+ * $Revision: 1.70 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -42,7 +42,7 @@
* 3. Conditions
*
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
- * Redistribution of source code of any substantial prton of the Covered
+ * 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,
@@ -153,7 +153,7 @@ AcpiInstallAddressSpaceHandler (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("AcpiInstallAddressSpaceHandler");
+ ACPI_FUNCTION_TRACE (AcpiInstallAddressSpaceHandler);
/* Parameter validation */
@@ -195,6 +195,8 @@ UnlockAndExit:
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiInstallAddressSpaceHandler)
+
/*******************************************************************************
*
@@ -224,7 +226,7 @@ AcpiRemoveAddressSpaceHandler (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("AcpiRemoveAddressSpaceHandler");
+ ACPI_FUNCTION_TRACE (AcpiRemoveAddressSpaceHandler);
/* Parameter validation */
@@ -243,7 +245,11 @@ AcpiRemoveAddressSpaceHandler (
/* Convert and validate the device handle */
Node = AcpiNsMapHandleToNode (Device);
- if (!Node)
+ if (!Node ||
+ ((Node->Type != ACPI_TYPE_DEVICE) &&
+ (Node->Type != ACPI_TYPE_PROCESSOR) &&
+ (Node->Type != ACPI_TYPE_THERMAL) &&
+ (Node != AcpiGbl_RootNode)))
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
@@ -268,6 +274,14 @@ AcpiRemoveAddressSpaceHandler (
if (HandlerObj->AddressSpace.SpaceId == SpaceId)
{
+ /* Handler must be the same as the installed handler */
+
+ if (HandlerObj->AddressSpace.Handler != Handler)
+ {
+ Status = AE_BAD_PARAMETER;
+ goto UnlockAndExit;
+ }
+
/* Matched SpaceId, first dereference this in the Regions */
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
@@ -327,4 +341,5 @@ UnlockAndExit:
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiRemoveAddressSpaceHandler)
diff --git a/sys/contrib/dev/acpica/exconfig.c b/sys/contrib/dev/acpica/exconfig.c
index ea10bf5..60d8b36 100644
--- a/sys/contrib/dev/acpica/exconfig.c
+++ b/sys/contrib/dev/acpica/exconfig.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: exconfig - Namespace reconfiguration (Load/Unload opcodes)
- * $Revision: 1.87 $
+ * $Revision: 1.103 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -133,7 +133,7 @@
static ACPI_STATUS
AcpiExAddTable (
- ACPI_TABLE_HEADER *Table,
+ ACPI_NATIVE_UINT TableIndex,
ACPI_NAMESPACE_NODE *ParentNode,
ACPI_OPERAND_OBJECT **DdbHandle);
@@ -155,16 +155,15 @@ AcpiExAddTable (
static ACPI_STATUS
AcpiExAddTable (
- ACPI_TABLE_HEADER *Table,
+ ACPI_NATIVE_UINT TableIndex,
ACPI_NAMESPACE_NODE *ParentNode,
ACPI_OPERAND_OBJECT **DdbHandle)
{
ACPI_STATUS Status;
- ACPI_TABLE_DESC TableInfo;
ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_FUNCTION_TRACE ("ExAddTable");
+ ACPI_FUNCTION_TRACE (ExAddTable);
/* Create an object to be the table handle */
@@ -182,44 +181,17 @@ AcpiExAddTable (
/* Install the new table into the local data structures */
- ACPI_MEMSET (&TableInfo, 0, sizeof (ACPI_TABLE_DESC));
-
- TableInfo.Type = ACPI_TABLE_SSDT;
- TableInfo.Pointer = Table;
- TableInfo.Length = (ACPI_SIZE) Table->Length;
- TableInfo.Allocation = ACPI_MEM_ALLOCATED;
-
- Status = AcpiTbInstallTable (&TableInfo);
- ObjDesc->Reference.Object = TableInfo.InstalledDesc;
-
- if (ACPI_FAILURE (Status))
- {
- if (Status == AE_ALREADY_EXISTS)
- {
- /* Table already exists, just return the handle */
-
- return_ACPI_STATUS (AE_OK);
- }
- goto Cleanup;
- }
+ ObjDesc->Reference.Object = ACPI_CAST_PTR (void, TableIndex);
/* Add the table to the namespace */
- Status = AcpiNsLoadTable (TableInfo.InstalledDesc, ParentNode);
+ Status = AcpiNsLoadTable (TableIndex, ParentNode);
if (ACPI_FAILURE (Status))
{
- /* Uninstall table on error */
-
- (void) AcpiTbUninstallTable (TableInfo.InstalledDesc);
- goto Cleanup;
+ AcpiUtRemoveReference (ObjDesc);
+ *DdbHandle = NULL;
}
- return_ACPI_STATUS (AE_OK);
-
-
-Cleanup:
- AcpiUtRemoveReference (ObjDesc);
- *DdbHandle = NULL;
return_ACPI_STATUS (Status);
}
@@ -233,7 +205,7 @@ Cleanup:
*
* RETURN: Status
*
- * DESCRIPTION: Load an ACPI table
+ * DESCRIPTION: Load an ACPI table from the RSDT/XSDT
*
******************************************************************************/
@@ -244,35 +216,22 @@ AcpiExLoadTableOp (
{
ACPI_STATUS Status;
ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
- ACPI_TABLE_HEADER *Table;
+ 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;
- ACPI_FUNCTION_TRACE ("ExLoadTableOp");
+ ACPI_FUNCTION_TRACE (ExLoadTableOp);
-#if 0
- /*
- * Make sure that the signature does not match one of the tables that
- * is already loaded.
- */
- Status = AcpiTbMatchSignature (Operand[0]->String.Pointer, NULL);
- if (Status == AE_OK)
- {
- /* Signature matched -- don't allow override */
-
- return_ACPI_STATUS (AE_ALREADY_EXISTS);
- }
-#endif
-
- /* Find the ACPI table */
+ /* Find the ACPI table in the RSDT/XSDT */
Status = AcpiTbFindTable (Operand[0]->String.Pointer,
Operand[1]->String.Pointer,
- Operand[2]->String.Pointer, &Table);
+ Operand[2]->String.Pointer, &TableIndex);
if (ACPI_FAILURE (Status))
{
if (Status != AE_NOT_FOUND)
@@ -307,8 +266,8 @@ AcpiExLoadTableOp (
* Find the node referenced by the RootPathString. This is the
* location within the namespace where the table will be loaded.
*/
- Status = AcpiNsGetNodeByPath (Operand[3]->String.Pointer, StartNode,
- ACPI_NS_SEARCH_PARENT, &ParentNode);
+ Status = AcpiNsGetNode (StartNode, Operand[3]->String.Pointer,
+ ACPI_NS_SEARCH_PARENT, &ParentNode);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -331,7 +290,7 @@ AcpiExLoadTableOp (
/* Find the node referenced by the ParameterPathString */
- Status = AcpiNsGetNodeByPath (Operand[4]->String.Pointer, StartNode,
+ Status = AcpiNsGetNode (StartNode, Operand[4]->String.Pointer,
ACPI_NS_SEARCH_PARENT, &ParameterNode);
if (ACPI_FAILURE (Status))
{
@@ -341,7 +300,7 @@ AcpiExLoadTableOp (
/* Load the table into the namespace */
- Status = AcpiExAddTable (Table, ParentNode, &DdbHandle);
+ Status = AcpiExAddTable (TableIndex, ParentNode, &DdbHandle);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -363,6 +322,14 @@ AcpiExLoadTableOp (
}
}
+ Status = AcpiGetTableByIndex (TableIndex, &Table);
+ if (ACPI_SUCCESS (Status))
+ {
+ ACPI_INFO ((AE_INFO,
+ "Dynamic OEM Table Load - [%4.4s] OemId [%6.6s] OemTableId [%8.8s]",
+ Table->Signature, Table->OemId, Table->OemTableId));
+ }
+
*ReturnDesc = DdbHandle;
return_ACPI_STATUS (Status);
}
@@ -372,7 +339,7 @@ AcpiExLoadTableOp (
*
* FUNCTION: AcpiExLoadOp
*
- * PARAMETERS: ObjDesc - Region or Field where the table will be
+ * PARAMETERS: ObjDesc - Region or Buffer/Field where the table will be
* obtained
* Target - Where a handle to the table will be stored
* WalkState - Current state
@@ -381,6 +348,12 @@ AcpiExLoadTableOp (
*
* DESCRIPTION: Load an ACPI table from a field or operation region
*
+ * NOTE: Region Fields (Field, BankField, IndexFields) are resolved to buffer
+ * objects before this code is reached.
+ *
+ * If source is an operation region, it must refer to SystemMemory, as
+ * per the ACPI specification.
+ *
******************************************************************************/
ACPI_STATUS
@@ -389,23 +362,31 @@ AcpiExLoadOp (
ACPI_OPERAND_OBJECT *Target,
ACPI_WALK_STATE *WalkState)
{
- ACPI_STATUS Status;
ACPI_OPERAND_OBJECT *DdbHandle;
- ACPI_OPERAND_OBJECT *BufferDesc = NULL;
- ACPI_TABLE_HEADER *TablePtr = NULL;
- ACPI_PHYSICAL_ADDRESS Address;
- ACPI_TABLE_HEADER TableHeader;
- UINT32 i;
+ ACPI_TABLE_DESC TableDesc;
+ ACPI_NATIVE_UINT TableIndex;
+ ACPI_STATUS Status;
+
- ACPI_FUNCTION_TRACE ("ExLoadOp");
+ ACPI_FUNCTION_TRACE (ExLoadOp);
- /* Object can be either an OpRegion or a Field */
+ 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))
{
case ACPI_TYPE_REGION:
+ /* Region must be SystemMemory (from ACPI spec) */
+
+ if (ObjDesc->Region.SpaceId != ACPI_ADR_SPACE_SYSTEM_MEMORY)
+ {
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+ }
+
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Load from Region %p %s\n",
ObjDesc, AcpiUtGetObjectTypeName (ObjDesc)));
@@ -422,113 +403,40 @@ AcpiExLoadOp (
}
}
- /* Get the base physical address of the region */
-
- Address = ObjDesc->Region.Address;
-
- /* Get the table length from the table header */
-
- TableHeader.Length = 0;
- for (i = 0; i < 8; i++)
- {
- Status = AcpiEvAddressSpaceDispatch (ObjDesc, ACPI_READ,
- (ACPI_PHYSICAL_ADDRESS) (i + Address), 8,
- ((UINT8 *) &TableHeader) + i);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
- }
-
- /* Sanity check the table length */
-
- if (TableHeader.Length < sizeof (ACPI_TABLE_HEADER))
- {
- return_ACPI_STATUS (AE_BAD_HEADER);
- }
-
- /* Allocate a buffer for the entire table */
-
- TablePtr = ACPI_MEM_ALLOCATE (TableHeader.Length);
- if (!TablePtr)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- /* Get the entire table from the op region */
-
- for (i = 0; i < TableHeader.Length; i++)
- {
- Status = AcpiEvAddressSpaceDispatch (ObjDesc, ACPI_READ,
- (ACPI_PHYSICAL_ADDRESS) (i + Address), 8,
- ((UINT8 *) TablePtr + i));
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
- }
+ 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 */
- case ACPI_TYPE_LOCAL_REGION_FIELD:
- case ACPI_TYPE_LOCAL_BANK_FIELD:
- case ACPI_TYPE_LOCAL_INDEX_FIELD:
+ /* Simply extract the buffer from the buffer object */
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Load from Field %p %s\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Load from Buffer or Field %p %s\n",
ObjDesc, AcpiUtGetObjectTypeName (ObjDesc)));
- /*
- * The length of the field must be at least as large as the table.
- * Read the entire field and thus the entire table. Buffer is
- * allocated during the read.
- */
- Status = AcpiExReadDataFromField (WalkState, ObjDesc, &BufferDesc);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- TablePtr = ACPI_CAST_PTR (ACPI_TABLE_HEADER,
- BufferDesc->Buffer.Pointer);
-
- /* All done with the BufferDesc, delete it */
-
- BufferDesc->Buffer.Pointer = NULL;
- AcpiUtRemoveReference (BufferDesc);
-
- /* Sanity check the table length */
+ TableDesc.Pointer = ACPI_CAST_PTR (ACPI_TABLE_HEADER,
+ ObjDesc->Buffer.Pointer);
+ TableDesc.Length = TableDesc.Pointer->Length;
+ TableDesc.Flags = ACPI_TABLE_ORIGIN_ALLOCATED;
- if (TablePtr->Length < sizeof (ACPI_TABLE_HEADER))
- {
- Status = AE_BAD_HEADER;
- goto Cleanup;
- }
+ ObjDesc->Buffer.Pointer = NULL;
break;
-
default:
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
- /* The table must be either an SSDT or a PSDT */
-
- if ((!ACPI_STRNCMP (TablePtr->Signature,
- AcpiGbl_TableData[ACPI_TABLE_PSDT].Signature,
- AcpiGbl_TableData[ACPI_TABLE_PSDT].SigLength)) &&
- (!ACPI_STRNCMP (TablePtr->Signature,
- AcpiGbl_TableData[ACPI_TABLE_SSDT].Signature,
- AcpiGbl_TableData[ACPI_TABLE_SSDT].SigLength)))
+ /*
+ * Install the new table into the local data structures
+ */
+ Status = AcpiTbAddTable (&TableDesc, &TableIndex);
+ if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Table has invalid signature [%4.4s], must be SSDT or PSDT\n",
- TablePtr->Signature));
- Status = AE_BAD_SIGNATURE;
goto Cleanup;
}
- /* Install the new table into the local data structures */
-
- Status = AcpiExAddTable (TablePtr, AcpiGbl_RootNode, &DdbHandle);
+ Status = AcpiExAddTable (TableIndex, AcpiGbl_RootNode, &DdbHandle);
if (ACPI_FAILURE (Status))
{
/* On error, TablePtr was deallocated above */
@@ -551,7 +459,7 @@ AcpiExLoadOp (
Cleanup:
if (ACPI_FAILURE (Status))
{
- ACPI_MEM_FREE (TablePtr);
+ AcpiTbDeleteTable (&TableDesc);
}
return_ACPI_STATUS (Status);
}
@@ -575,10 +483,10 @@ AcpiExUnloadTable (
{
ACPI_STATUS Status = AE_OK;
ACPI_OPERAND_OBJECT *TableDesc = DdbHandle;
- ACPI_TABLE_DESC *TableInfo;
+ ACPI_NATIVE_UINT TableIndex;
- ACPI_FUNCTION_TRACE ("ExUnloadTable");
+ ACPI_FUNCTION_TRACE (ExUnloadTable);
/*
@@ -594,20 +502,18 @@ AcpiExUnloadTable (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- /* Get the actual table descriptor from the DdbHandle */
+ /* Get the table index from the DdbHandle */
- TableInfo = (ACPI_TABLE_DESC *) TableDesc->Reference.Object;
+ TableIndex = (ACPI_NATIVE_UINT) TableDesc->Reference.Object;
/*
* Delete the entire namespace under this table Node
* (Offset contains the TableId)
*/
- AcpiNsDeleteNamespaceByOwner (TableInfo->OwnerId);
- AcpiUtReleaseOwnerId (&TableInfo->OwnerId);
-
- /* Delete the table itself */
+ AcpiTbDeleteNamespaceByOwner (TableIndex);
+ AcpiTbReleaseOwnerId (TableIndex);
- (void) AcpiTbUninstallTable (TableInfo->InstalledDesc);
+ AcpiTbSetTableLoadedFlag (TableIndex, FALSE);
/* Delete the table descriptor (DdbHandle) */
diff --git a/sys/contrib/dev/acpica/exconvrt.c b/sys/contrib/dev/acpica/exconvrt.c
index 6566cbc..17c86c2 100644
--- a/sys/contrib/dev/acpica/exconvrt.c
+++ b/sys/contrib/dev/acpica/exconvrt.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: exconvrt - Object conversion routines
- * $Revision: 1.67 $
+ * $Revision: 1.74 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -164,7 +164,7 @@ AcpiExConvertToInteger (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE_PTR ("ExConvertToInteger", ObjDesc);
+ ACPI_FUNCTION_TRACE_PTR (ExConvertToInteger, ObjDesc);
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
@@ -265,6 +265,9 @@ AcpiExConvertToInteger (
return_ACPI_STATUS (AE_NO_MEMORY);
}
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Converted value: %8.8X%8.8X\n",
+ ACPI_FORMAT_UINT64 (Result)));
+
/* Save the Result */
ReturnDesc->Integer.Value = Result;
@@ -297,7 +300,7 @@ AcpiExConvertToBuffer (
UINT8 *NewBuf;
- ACPI_FUNCTION_TRACE_PTR ("ExConvertToBuffer", ObjDesc);
+ ACPI_FUNCTION_TRACE_PTR (ExConvertToBuffer, ObjDesc);
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
@@ -518,7 +521,7 @@ AcpiExConvertToString (
UINT8 Separator = ',';
- ACPI_FUNCTION_TRACE_PTR ("ExConvertToString", ObjDesc);
+ ACPI_FUNCTION_TRACE_PTR (ExConvertToString, ObjDesc);
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
@@ -632,18 +635,10 @@ AcpiExConvertToString (
}
/*
- * Perform the conversion.
+ * Create a new string object and string buffer
* (-1 because of extra separator included in StringLength from above)
*/
- StringLength--;
- if (StringLength > ACPI_MAX_STRING_CONVERSION) /* ACPI limit */
- {
- return_ACPI_STATUS (AE_AML_STRING_LIMIT);
- }
-
- /* Create a new string object and string buffer */
-
- ReturnDesc = AcpiUtCreateStringObject ((ACPI_SIZE) StringLength);
+ ReturnDesc = AcpiUtCreateStringObject ((ACPI_SIZE) (StringLength - 1));
if (!ReturnDesc)
{
return_ACPI_STATUS (AE_NO_MEMORY);
@@ -705,7 +700,7 @@ AcpiExConvertToTargetType (
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE ("ExConvertToTargetType");
+ ACPI_FUNCTION_TRACE (ExConvertToTargetType);
/* Default behavior */
@@ -782,7 +777,7 @@ AcpiExConvertToTargetType (
default:
- ACPI_REPORT_ERROR (("Bad destination type during conversion: %X\n",
+ ACPI_ERROR ((AE_INFO, "Bad destination type during conversion: %X",
DestinationType));
Status = AE_AML_INTERNAL;
break;
@@ -798,13 +793,10 @@ AcpiExConvertToTargetType (
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Unknown Target type ID 0x%X Op %s DestType %s\n",
+ ACPI_ERROR ((AE_INFO,
+ "Unknown Target type ID 0x%X AmlOpcode %X DestType %s",
GET_CURRENT_ARG_TYPE (WalkState->OpInfo->RuntimeArgs),
- WalkState->OpInfo->Name, AcpiUtGetTypeName (DestinationType)));
-
- ACPI_REPORT_ERROR (("Bad Target Type (ARGI): %X\n",
- GET_CURRENT_ARG_TYPE (WalkState->OpInfo->RuntimeArgs)))
+ WalkState->Opcode, AcpiUtGetTypeName (DestinationType)));
Status = AE_AML_INTERNAL;
}
diff --git a/sys/contrib/dev/acpica/excreate.c b/sys/contrib/dev/acpica/excreate.c
index f9d09e0..d237dab 100644
--- a/sys/contrib/dev/acpica/excreate.c
+++ b/sys/contrib/dev/acpica/excreate.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: excreate - Named object creation
- * $Revision: 1.106 $
+ * $Revision: 1.114 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -151,7 +151,7 @@ AcpiExCreateAlias (
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE ("ExCreateAlias");
+ ACPI_FUNCTION_TRACE (ExCreateAlias);
/* Get the source/alias operands (both namespace nodes) */
@@ -247,7 +247,7 @@ AcpiExCreateEvent (
ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_FUNCTION_TRACE ("ExCreateEvent");
+ ACPI_FUNCTION_TRACE (ExCreateEvent);
ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_EVENT);
@@ -262,7 +262,7 @@ AcpiExCreateEvent (
* that the event is created in an unsignalled state
*/
Status = AcpiOsCreateSemaphore (ACPI_NO_UNIT_LIMIT, 0,
- &ObjDesc->Event.Semaphore);
+ &ObjDesc->Event.OsSemaphore);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
@@ -305,7 +305,7 @@ AcpiExCreateMutex (
ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_FUNCTION_TRACE_PTR ("ExCreateMutex", ACPI_WALK_OPERANDS);
+ ACPI_FUNCTION_TRACE_PTR (ExCreateMutex, ACPI_WALK_OPERANDS);
/* Create the new mutex object */
@@ -317,12 +317,9 @@ AcpiExCreateMutex (
goto Cleanup;
}
- /*
- * Create the actual OS semaphore.
- * One unit max to make it a mutex, with one initial unit to allow
- * the mutex to be acquired.
- */
- Status = AcpiOsCreateSemaphore (1, 1, &ObjDesc->Mutex.Semaphore);
+ /* Create the actual OS Mutex */
+
+ Status = AcpiOsCreateMutex (&ObjDesc->Mutex.OsMutex);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
@@ -333,8 +330,7 @@ AcpiExCreateMutex (
ObjDesc->Mutex.SyncLevel = (UINT8) WalkState->Operands[1]->Integer.Value;
ObjDesc->Mutex.Node = (ACPI_NAMESPACE_NODE *) WalkState->Operands[0];
- Status = AcpiNsAttachObject (ObjDesc->Mutex.Node,
- ObjDesc, ACPI_TYPE_MUTEX);
+ Status = AcpiNsAttachObject (ObjDesc->Mutex.Node, ObjDesc, ACPI_TYPE_MUTEX);
Cleanup:
@@ -375,7 +371,7 @@ AcpiExCreateRegion (
ACPI_OPERAND_OBJECT *RegionObj2;
- ACPI_FUNCTION_TRACE ("ExCreateRegion");
+ ACPI_FUNCTION_TRACE (ExCreateRegion);
/* Get the Namespace Node */
@@ -398,7 +394,7 @@ AcpiExCreateRegion (
if ((RegionSpace >= ACPI_NUM_PREDEFINED_REGIONS) &&
(RegionSpace < ACPI_USER_REGION_BEGIN))
{
- ACPI_REPORT_ERROR (("Invalid AddressSpace type %X\n", RegionSpace));
+ ACPI_ERROR ((AE_INFO, "Invalid AddressSpace type %X", RegionSpace));
return_ACPI_STATUS (AE_AML_INVALID_SPACE_ID);
}
@@ -418,16 +414,16 @@ AcpiExCreateRegion (
* Remember location in AML stream of address & length
* operands since they need to be evaluated at run time.
*/
- RegionObj2 = ObjDesc->Common.NextObject;
- RegionObj2->Extra.AmlStart = AmlStart;
+ RegionObj2 = ObjDesc->Common.NextObject;
+ RegionObj2->Extra.AmlStart = AmlStart;
RegionObj2->Extra.AmlLength = AmlLength;
/* Init the region from the operands */
ObjDesc->Region.SpaceId = RegionSpace;
ObjDesc->Region.Address = 0;
- ObjDesc->Region.Length = 0;
- ObjDesc->Region.Node = Node;
+ ObjDesc->Region.Length = 0;
+ ObjDesc->Region.Node = Node;
/* Install the new region object in the parent Node */
@@ -463,11 +459,12 @@ AcpiExCreateTableRegion (
ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_NAMESPACE_NODE *Node;
- ACPI_TABLE_HEADER *Table;
ACPI_OPERAND_OBJECT *RegionObj2;
+ ACPI_NATIVE_UINT TableIndex;
+ ACPI_TABLE_HEADER *Table;
- ACPI_FUNCTION_TRACE ("ExCreateTableRegion");
+ ACPI_FUNCTION_TRACE (ExCreateTableRegion);
/* Get the Node from the object stack */
@@ -486,8 +483,8 @@ AcpiExCreateTableRegion (
/* Find the ACPI table */
Status = AcpiTbFindTable (Operand[1]->String.Pointer,
- Operand[2]->String.Pointer,
- Operand[3]->String.Pointer, &Table);
+ Operand[2]->String.Pointer, Operand[3]->String.Pointer,
+ &TableIndex);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -501,16 +498,22 @@ AcpiExCreateTableRegion (
return_ACPI_STATUS (AE_NO_MEMORY);
}
- RegionObj2 = ObjDesc->Common.NextObject;
+ 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;
+ ObjDesc->Region.Length = Table->Length;
+ ObjDesc->Region.Node = Node;
+ ObjDesc->Region.Flags = AOPOBJ_DATA_VALID;
/* Install the new region object in the parent Node */
@@ -568,7 +571,7 @@ AcpiExCreateProcessor (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE_PTR ("ExCreateProcessor", WalkState);
+ ACPI_FUNCTION_TRACE_PTR (ExCreateProcessor, WalkState);
/* Create the processor object */
@@ -581,9 +584,9 @@ AcpiExCreateProcessor (
/* Initialize the processor object from the operands */
- ObjDesc->Processor.ProcId = (UINT8) Operand[1]->Integer.Value;
+ ObjDesc->Processor.ProcId = (UINT8) Operand[1]->Integer.Value;
+ ObjDesc->Processor.Length = (UINT8) Operand[3]->Integer.Value;
ObjDesc->Processor.Address = (ACPI_IO_ADDRESS) Operand[2]->Integer.Value;
- ObjDesc->Processor.Length = (UINT8) Operand[3]->Integer.Value;
/* Install the processor object in the parent Node */
@@ -620,7 +623,7 @@ AcpiExCreatePowerResource (
ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_FUNCTION_TRACE_PTR ("ExCreatePowerResource", WalkState);
+ ACPI_FUNCTION_TRACE_PTR (ExCreatePowerResource, WalkState);
/* Create the power resource object */
@@ -633,7 +636,7 @@ AcpiExCreatePowerResource (
/* Initialize the power object from the operands */
- ObjDesc->PowerResource.SystemLevel = (UINT8) Operand[1]->Integer.Value;
+ ObjDesc->PowerResource.SystemLevel = (UINT8) Operand[1]->Integer.Value;
ObjDesc->PowerResource.ResourceOrder = (UINT16) Operand[2]->Integer.Value;
/* Install the power resource object in the parent Node */
@@ -675,7 +678,7 @@ AcpiExCreateMethod (
UINT8 MethodFlags;
- ACPI_FUNCTION_TRACE_PTR ("ExCreateMethod", WalkState);
+ ACPI_FUNCTION_TRACE_PTR (ExCreateMethod, WalkState);
/* Create a new method object */
@@ -683,44 +686,36 @@ AcpiExCreateMethod (
ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_METHOD);
if (!ObjDesc)
{
- return_ACPI_STATUS (AE_NO_MEMORY);
+ Status = AE_NO_MEMORY;
+ goto Exit;
}
/* Save the method's AML pointer and length */
- ObjDesc->Method.AmlStart = AmlStart;
+ ObjDesc->Method.AmlStart = AmlStart;
ObjDesc->Method.AmlLength = AmlLength;
/*
- * Disassemble the method flags. Split off the Arg Count
+ * Disassemble the method flags. Split off the Arg Count
* for efficiency
*/
MethodFlags = (UINT8) Operand[1]->Integer.Value;
ObjDesc->Method.MethodFlags = (UINT8) (MethodFlags & ~AML_METHOD_ARG_COUNT);
- ObjDesc->Method.ParamCount = (UINT8) (MethodFlags & AML_METHOD_ARG_COUNT);
+ ObjDesc->Method.ParamCount = (UINT8) (MethodFlags & AML_METHOD_ARG_COUNT);
/*
- * Get the concurrency count. If required, a semaphore will be
+ * Get the SyncLevel. If method is serialized, a mutex will be
* created for this method when it is parsed.
*/
- if (AcpiGbl_AllMethodsSerialized)
- {
- ObjDesc->Method.Concurrency = 1;
- ObjDesc->Method.MethodFlags |= AML_METHOD_SERIALIZED;
- }
- else if (MethodFlags & AML_METHOD_SERIALIZED)
+ if (MethodFlags & AML_METHOD_SERIALIZED)
{
/*
- * ACPI 1.0: Concurrency = 1
- * ACPI 2.0: Concurrency = (SyncLevel (in method declaration) + 1)
+ * ACPI 1.0: SyncLevel = 0
+ * ACPI 2.0: SyncLevel = SyncLevel in method declaration
*/
- ObjDesc->Method.Concurrency = (UINT8)
- (((MethodFlags & AML_METHOD_SYNCH_LEVEL) >> 4) + 1);
- }
- else
- {
- ObjDesc->Method.Concurrency = ACPI_INFINITE_CONCURRENCY;
+ ObjDesc->Method.SyncLevel = (UINT8)
+ ((MethodFlags & AML_METHOD_SYNCH_LEVEL) >> 4);
}
/* Attach the new object to the method Node */
@@ -732,6 +727,7 @@ AcpiExCreateMethod (
AcpiUtRemoveReference (ObjDesc);
+Exit:
/* Remove a reference to the operand */
AcpiUtRemoveReference (Operand[1]);
diff --git a/sys/contrib/dev/acpica/exdump.c b/sys/contrib/dev/acpica/exdump.c
index d3a4cd5..c7d26ae 100644
--- a/sys/contrib/dev/acpica/exdump.c
+++ b/sys/contrib/dev/acpica/exdump.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: exdump - Interpreter debug output routines
- * $Revision: 1.188 $
+ * $Revision: 1.202 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -143,21 +143,16 @@ AcpiExOutPointer (
void *Value);
static void
-AcpiExOutInteger (
- char *Title,
- UINT32 Value);
-
-static void
-AcpiExOutAddress (
- char *Title,
- ACPI_PHYSICAL_ADDRESS Value);
+AcpiExDumpObject (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_EXDUMP_INFO *Info);
static void
-AcpiExDumpReference (
+AcpiExDumpReferenceObj (
ACPI_OPERAND_OBJECT *ObjDesc);
static void
-AcpiExDumpPackage (
+AcpiExDumpPackageObj (
ACPI_OPERAND_OBJECT *ObjDesc,
UINT32 Level,
UINT32 Index);
@@ -165,6 +160,369 @@ AcpiExDumpPackage (
/*******************************************************************************
*
+ * Object Descriptor info tables
+ *
+ * Note: The first table entry must be an INIT opcode and must contain
+ * the table length (number of table entries)
+ *
+ ******************************************************************************/
+
+static ACPI_EXDUMP_INFO AcpiExDumpInteger[2] =
+{
+ {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpInteger), NULL},
+ {ACPI_EXD_UINT64, ACPI_EXD_OFFSET (Integer.Value), "Value"}
+};
+
+static ACPI_EXDUMP_INFO AcpiExDumpString[4] =
+{
+ {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpString), NULL},
+ {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (String.Length), "Length"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (String.Pointer), "Pointer"},
+ {ACPI_EXD_STRING, 0, NULL}
+};
+
+static ACPI_EXDUMP_INFO AcpiExDumpBuffer[5] =
+{
+ {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpBuffer), NULL},
+ {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Buffer.Length), "Length"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Buffer.Pointer), "Pointer"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Buffer.Node), "Parent Node"},
+ {ACPI_EXD_BUFFER, 0, NULL}
+};
+
+static ACPI_EXDUMP_INFO AcpiExDumpPackage[5] =
+{
+ {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpPackage), NULL},
+ {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Package.Flags), "Flags"},
+ {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Package.Count), "Elements"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Package.Elements), "Element List"},
+ {ACPI_EXD_PACKAGE, 0, NULL}
+};
+
+static ACPI_EXDUMP_INFO AcpiExDumpDevice[4] =
+{
+ {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpDevice), NULL},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Device.Handler), "Handler"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Device.SystemNotify), "System Notify"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Device.DeviceNotify), "Device Notify"}
+};
+
+static ACPI_EXDUMP_INFO AcpiExDumpEvent[2] =
+{
+ {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpEvent), NULL},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Event.OsSemaphore), "OsSemaphore"}
+};
+
+static ACPI_EXDUMP_INFO AcpiExDumpMethod[8] =
+{
+ {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.SyncLevel), "Sync Level"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Method.Mutex), "Mutex"},
+ {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.OwnerId), "Owner Id"},
+ {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.ThreadCount), "Thread Count"},
+ {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Method.AmlLength), "Aml Length"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Method.AmlStart), "Aml Start"}
+};
+
+static ACPI_EXDUMP_INFO AcpiExDumpMutex[5] =
+{
+ {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpMutex), NULL},
+ {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Mutex.SyncLevel), "Sync Level"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Mutex.OwnerThread), "Owner Thread"},
+ {ACPI_EXD_UINT16, ACPI_EXD_OFFSET (Mutex.AcquisitionDepth), "Acquire Depth"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Mutex.OsMutex), "OsMutex"}
+};
+
+static ACPI_EXDUMP_INFO AcpiExDumpRegion[7] =
+{
+ {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpRegion), NULL},
+ {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Region.SpaceId), "Space Id"},
+ {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Region.Flags), "Flags"},
+ {ACPI_EXD_ADDRESS, ACPI_EXD_OFFSET (Region.Address), "Address"},
+ {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Region.Length), "Length"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Region.Handler), "Handler"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Region.Next), "Next"}
+};
+
+static ACPI_EXDUMP_INFO AcpiExDumpPower[5] =
+{
+ {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpPower), NULL},
+ {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (PowerResource.SystemLevel), "System Level"},
+ {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (PowerResource.ResourceOrder), "Resource Order"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (PowerResource.SystemNotify), "System Notify"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (PowerResource.DeviceNotify), "Device Notify"}
+};
+
+static ACPI_EXDUMP_INFO AcpiExDumpProcessor[7] =
+{
+ {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpProcessor), NULL},
+ {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Processor.ProcId), "Processor ID"},
+ {ACPI_EXD_UINT8 , ACPI_EXD_OFFSET (Processor.Length), "Length"},
+ {ACPI_EXD_ADDRESS, ACPI_EXD_OFFSET (Processor.Address), "Address"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Processor.SystemNotify), "System Notify"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Processor.DeviceNotify), "Device Notify"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Processor.Handler), "Handler"}
+};
+
+static ACPI_EXDUMP_INFO AcpiExDumpThermal[4] =
+{
+ {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpThermal), NULL},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (ThermalZone.SystemNotify), "System Notify"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (ThermalZone.DeviceNotify), "Device Notify"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (ThermalZone.Handler), "Handler"}
+};
+
+static ACPI_EXDUMP_INFO AcpiExDumpBufferField[3] =
+{
+ {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpBufferField), NULL},
+ {ACPI_EXD_FIELD, 0, NULL},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (BufferField.BufferObj), "Buffer Object"}
+};
+
+static ACPI_EXDUMP_INFO AcpiExDumpRegionField[3] =
+{
+ {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpRegionField), NULL},
+ {ACPI_EXD_FIELD, 0, NULL},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Field.RegionObj), "Region Object"}
+};
+
+static ACPI_EXDUMP_INFO AcpiExDumpBankField[5] =
+{
+ {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpBankField), NULL},
+ {ACPI_EXD_FIELD, 0, NULL},
+ {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (BankField.Value), "Value"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (BankField.RegionObj), "Region Object"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (BankField.BankObj), "Bank Object"}
+};
+
+static ACPI_EXDUMP_INFO AcpiExDumpIndexField[5] =
+{
+ {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpBankField), NULL},
+ {ACPI_EXD_FIELD, 0, NULL},
+ {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (IndexField.Value), "Value"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (IndexField.IndexObj), "Index Object"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (IndexField.DataObj), "Data Object"}
+};
+
+
+static ACPI_EXDUMP_INFO AcpiExDumpReference[7] =
+{
+ {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpReference), NULL},
+ {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Reference.TargetType), "Target Type"},
+ {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Reference.Offset), "Offset"},
+ {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"},
+ {ACPI_EXD_REFERENCE,0, NULL}
+};
+
+static ACPI_EXDUMP_INFO AcpiExDumpAddressHandler[6] =
+{
+ {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpAddressHandler), NULL},
+ {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (AddressSpace.SpaceId), "Space Id"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (AddressSpace.Next), "Next"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (AddressSpace.RegionList), "Region List"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (AddressSpace.Node), "Node"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (AddressSpace.Context), "Context"}
+};
+
+static ACPI_EXDUMP_INFO AcpiExDumpNotify[3] =
+{
+ {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpNotify), NULL},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Notify.Node), "Node"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Notify.Context), "Context"}
+};
+
+
+/* Miscellaneous tables */
+
+static ACPI_EXDUMP_INFO AcpiExDumpCommon[4] =
+{
+ {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpCommon), NULL},
+ {ACPI_EXD_TYPE , 0, NULL},
+ {ACPI_EXD_UINT16, ACPI_EXD_OFFSET (Common.ReferenceCount), "Reference Count"},
+ {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Common.Flags), "Flags"}
+};
+
+
+static ACPI_EXDUMP_INFO AcpiExDumpFieldCommon[7] =
+{
+ {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpFieldCommon), NULL},
+ {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (CommonField.FieldFlags), "Field Flags"},
+ {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (CommonField.AccessByteWidth), "Access Byte Width"},
+ {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (CommonField.BitLength), "Bit Length"},
+ {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (CommonField.StartFieldBitOffset),"Field Bit Offset"},
+ {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (CommonField.BaseByteOffset), "Base Byte Offset"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (CommonField.Node), "Parent Node"}
+};
+
+static ACPI_EXDUMP_INFO AcpiExDumpNode[5] =
+{
+ {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpNode), NULL},
+ {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET (Flags), "Flags"},
+ {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET (OwnerId), "Owner Id"},
+ {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET (Child), "Child List"},
+ {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET (Peer), "Next Peer"}
+};
+
+
+/* Dispatch table, indexed by object type */
+
+static ACPI_EXDUMP_INFO *AcpiExDumpInfo[] =
+{
+ NULL,
+ AcpiExDumpInteger,
+ AcpiExDumpString,
+ AcpiExDumpBuffer,
+ AcpiExDumpPackage,
+ NULL,
+ AcpiExDumpDevice,
+ AcpiExDumpEvent,
+ AcpiExDumpMethod,
+ AcpiExDumpMutex,
+ AcpiExDumpRegion,
+ AcpiExDumpPower,
+ AcpiExDumpProcessor,
+ AcpiExDumpThermal,
+ AcpiExDumpBufferField,
+ NULL,
+ NULL,
+ AcpiExDumpRegionField,
+ AcpiExDumpBankField,
+ AcpiExDumpIndexField,
+ AcpiExDumpReference,
+ NULL,
+ NULL,
+ AcpiExDumpNotify,
+ AcpiExDumpAddressHandler,
+ NULL,
+ NULL,
+ NULL
+};
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExDumpObject
+ *
+ * PARAMETERS: ObjDesc - Descriptor to dump
+ * Info - Info table corresponding to this object
+ * type
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Walk the info table for this object
+ *
+ ******************************************************************************/
+
+static void
+AcpiExDumpObject (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_EXDUMP_INFO *Info)
+{
+ UINT8 *Target;
+ char *Name;
+ UINT8 Count;
+
+
+ if (!Info)
+ {
+ AcpiOsPrintf (
+ "ExDumpObject: Display not implemented for object type %s\n",
+ AcpiUtGetObjectTypeName (ObjDesc));
+ return;
+ }
+
+ /* First table entry must contain the table length (# of table entries) */
+
+ Count = Info->Offset;
+
+ while (Count)
+ {
+ Target = ACPI_ADD_PTR (UINT8, ObjDesc, Info->Offset);
+ Name = Info->Name;
+
+ switch (Info->Opcode)
+ {
+ case ACPI_EXD_INIT:
+ break;
+
+ case ACPI_EXD_TYPE:
+ AcpiExOutString ("Type", AcpiUtGetObjectTypeName (ObjDesc));
+ break;
+
+ case ACPI_EXD_UINT8:
+
+ AcpiOsPrintf ("%20s : %2.2X\n", Name, *Target);
+ break;
+
+ case ACPI_EXD_UINT16:
+
+ AcpiOsPrintf ("%20s : %4.4X\n", Name, ACPI_GET16 (Target));
+ break;
+
+ case ACPI_EXD_UINT32:
+
+ AcpiOsPrintf ("%20s : %8.8X\n", Name, ACPI_GET32 (Target));
+ break;
+
+ case ACPI_EXD_UINT64:
+
+ AcpiOsPrintf ("%20s : %8.8X%8.8X\n", "Value",
+ ACPI_FORMAT_UINT64 (ACPI_GET64 (Target)));
+ break;
+
+ case ACPI_EXD_POINTER:
+ case ACPI_EXD_ADDRESS:
+
+ AcpiExOutPointer (Name, *ACPI_CAST_PTR (void *, Target));
+ break;
+
+ case ACPI_EXD_STRING:
+
+ AcpiUtPrintString (ObjDesc->String.Pointer, ACPI_UINT8_MAX);
+ AcpiOsPrintf ("\n");
+ break;
+
+ case ACPI_EXD_BUFFER:
+
+ ACPI_DUMP_BUFFER (ObjDesc->Buffer.Pointer, ObjDesc->Buffer.Length);
+ break;
+
+ case ACPI_EXD_PACKAGE:
+
+ /* Dump the package contents */
+
+ AcpiOsPrintf ("\nPackage Contents:\n");
+ AcpiExDumpPackageObj (ObjDesc, 0, 0);
+ break;
+
+ case ACPI_EXD_FIELD:
+
+ AcpiExDumpObject (ObjDesc, AcpiExDumpFieldCommon);
+ break;
+
+ case ACPI_EXD_REFERENCE:
+
+ AcpiExOutString ("Opcode",
+ (AcpiPsGetOpcodeInfo (ObjDesc->Reference.Opcode))->Name);
+ AcpiExDumpReferenceObj (ObjDesc);
+ break;
+
+ default:
+ AcpiOsPrintf ("**** Invalid table opcode [%X] ****\n", Info->Opcode);
+ return;
+ }
+
+ Info++;
+ Count--;
+ }
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiExDumpOperand
*
* PARAMETERS: *ObjDesc - Pointer to entry to be dumped
@@ -185,7 +543,7 @@ AcpiExDumpOperand (
UINT32 Index;
- ACPI_FUNCTION_NAME ("ExDumpOperand")
+ ACPI_FUNCTION_NAME (ExDumpOperand)
if (!((ACPI_LV_EXEC & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer)))
@@ -243,14 +601,6 @@ AcpiExDumpOperand (
break;
- case AML_NAME_OP:
-
- ACPI_DUMP_PATHNAME (ObjDesc->Reference.Object,
- "Reference: Name: ", ACPI_LV_INFO, _COMPONENT);
- ACPI_DUMP_ENTRY (ObjDesc->Reference.Object, ACPI_LV_INFO);
- break;
-
-
case AML_INDEX_OP:
AcpiOsPrintf ("Reference: Index %p\n",
@@ -543,7 +893,7 @@ AcpiExDumpOperands (
ACPI_NATIVE_UINT i;
- ACPI_FUNCTION_NAME ("ExDumpOperands");
+ ACPI_FUNCTION_NAME (ExDumpOperands);
if (!Ident)
@@ -608,33 +958,12 @@ AcpiExOutPointer (
AcpiOsPrintf ("%20s : %p\n", Title, Value);
}
-static void
-AcpiExOutInteger (
- char *Title,
- UINT32 Value)
-{
- AcpiOsPrintf ("%20s : %.2X\n", Title, Value);
-}
-
-static void
-AcpiExOutAddress (
- char *Title,
- ACPI_PHYSICAL_ADDRESS Value)
-{
-
-#if ACPI_MACHINE_WIDTH == 16
- AcpiOsPrintf ("%20s : %p\n", Title, Value);
-#else
- AcpiOsPrintf ("%20s : %8.8X%8.8X\n", Title, ACPI_FORMAT_UINT64 (Value));
-#endif
-}
-
/*******************************************************************************
*
- * FUNCTION: AcpiExDumpNode
+ * FUNCTION: AcpiExDumpNamespaceNode
*
- * PARAMETERS: *Node - Descriptor to dump
+ * PARAMETERS: Node - Descriptor to dump
* Flags - Force display if TRUE
*
* DESCRIPTION: Dumps the members of the given.Node
@@ -642,7 +971,7 @@ AcpiExOutAddress (
******************************************************************************/
void
-AcpiExDumpNode (
+AcpiExDumpNamespaceNode (
ACPI_NAMESPACE_NODE *Node,
UINT32 Flags)
{
@@ -660,19 +989,17 @@ AcpiExDumpNode (
AcpiOsPrintf ("%20s : %4.4s\n", "Name", AcpiUtGetNodeName (Node));
AcpiExOutString ("Type", AcpiUtGetTypeName (Node->Type));
- AcpiExOutInteger ("Flags", Node->Flags);
- AcpiExOutInteger ("Owner Id", Node->OwnerId);
- AcpiExOutInteger ("Reference Count", Node->ReferenceCount);
AcpiExOutPointer ("Attached Object", AcpiNsGetAttachedObject (Node));
- AcpiExOutPointer ("ChildList", Node->Child);
- AcpiExOutPointer ("NextPeer", Node->Peer);
AcpiExOutPointer ("Parent", AcpiNsGetParentNode (Node));
+
+ AcpiExDumpObject (ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Node),
+ AcpiExDumpNode);
}
/*******************************************************************************
*
- * FUNCTION: AcpiExDumpReference
+ * FUNCTION: AcpiExDumpReferenceObj
*
* PARAMETERS: Object - Descriptor to dump
*
@@ -681,17 +1008,19 @@ AcpiExDumpNode (
******************************************************************************/
static void
-AcpiExDumpReference (
+AcpiExDumpReferenceObj (
ACPI_OPERAND_OBJECT *ObjDesc)
{
ACPI_BUFFER RetBuf;
ACPI_STATUS Status;
+ RetBuf.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
+
if (ObjDesc->Reference.Opcode == AML_INT_NAMEPATH_OP)
{
AcpiOsPrintf ("Named Object %p ", ObjDesc->Reference.Node);
- RetBuf.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
+
Status = AcpiNsHandleToPathname (ObjDesc->Reference.Node, &RetBuf);
if (ACPI_FAILURE (Status))
{
@@ -700,7 +1029,7 @@ AcpiExDumpReference (
else
{
AcpiOsPrintf ("%s\n", (char *) RetBuf.Pointer);
- ACPI_MEM_FREE (RetBuf.Pointer);
+ ACPI_FREE (RetBuf.Pointer);
}
}
else if (ObjDesc->Reference.Object)
@@ -712,9 +1041,9 @@ AcpiExDumpReference (
/*******************************************************************************
*
- * FUNCTION: AcpiExDumpPackage
+ * FUNCTION: AcpiExDumpPackageObj
*
- * PARAMETERS: Object - Descriptor to dump
+ * PARAMETERS: ObjDesc - Descriptor to dump
* Level - Indentation Level
* Index - Package index for this object
*
@@ -723,7 +1052,7 @@ AcpiExDumpReference (
******************************************************************************/
static void
-AcpiExDumpPackage (
+AcpiExDumpPackageObj (
ACPI_OPERAND_OBJECT *ObjDesc,
UINT32 Level,
UINT32 Index)
@@ -780,7 +1109,7 @@ AcpiExDumpPackage (
AcpiOsPrintf ("[Buffer] Length %.2X = ", ObjDesc->Buffer.Length);
if (ObjDesc->Buffer.Length)
{
- AcpiUtDumpBuffer ((UINT8 *) ObjDesc->Buffer.Pointer,
+ AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, ObjDesc->Buffer.Pointer),
ObjDesc->Buffer.Length, DB_DWORD_DISPLAY, _COMPONENT);
}
else
@@ -797,7 +1126,7 @@ AcpiExDumpPackage (
for (i = 0; i < ObjDesc->Package.Count; i++)
{
- AcpiExDumpPackage (ObjDesc->Package.Elements[i], Level+1, i);
+ AcpiExDumpPackageObj (ObjDesc->Package.Elements[i], Level+1, i);
}
break;
@@ -805,7 +1134,7 @@ AcpiExDumpPackage (
case ACPI_TYPE_LOCAL_REFERENCE:
AcpiOsPrintf ("[Object Reference] ");
- AcpiExDumpReference (ObjDesc);
+ AcpiExDumpReferenceObj (ObjDesc);
break;
@@ -821,7 +1150,7 @@ AcpiExDumpPackage (
*
* FUNCTION: AcpiExDumpObjectDescriptor
*
- * PARAMETERS: Object - Descriptor to dump
+ * PARAMETERS: ObjDesc - Descriptor to dump
* Flags - Force display if TRUE
*
* DESCRIPTION: Dumps the members of the object descriptor given.
@@ -833,7 +1162,7 @@ AcpiExDumpObjectDescriptor (
ACPI_OPERAND_OBJECT *ObjDesc,
UINT32 Flags)
{
- ACPI_FUNCTION_TRACE ("ExDumpObjectDescriptor");
+ ACPI_FUNCTION_TRACE (ExDumpObjectDescriptor);
if (!ObjDesc)
@@ -851,9 +1180,11 @@ AcpiExDumpObjectDescriptor (
if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED)
{
- AcpiExDumpNode ((ACPI_NAMESPACE_NODE *) ObjDesc, Flags);
+ AcpiExDumpNamespaceNode ((ACPI_NAMESPACE_NODE *) ObjDesc, Flags);
+
AcpiOsPrintf ("\nAttached Object (%p):\n",
((ACPI_NAMESPACE_NODE *) ObjDesc)->Object);
+
AcpiExDumpObjectDescriptor (
((ACPI_NAMESPACE_NODE *) ObjDesc)->Object, Flags);
return_VOID;
@@ -867,211 +1198,18 @@ AcpiExDumpObjectDescriptor (
return_VOID;
}
- /* Common Fields */
-
- AcpiExOutString ("Type", AcpiUtGetObjectTypeName (ObjDesc));
- AcpiExOutInteger ("Reference Count", ObjDesc->Common.ReferenceCount);
- AcpiExOutInteger ("Flags", ObjDesc->Common.Flags);
-
- /* Object-specific Fields */
-
- switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+ if (ObjDesc->Common.Type > ACPI_TYPE_NS_NODE_MAX)
{
- case ACPI_TYPE_INTEGER:
-
- AcpiOsPrintf ("%20s : %8.8X%8.8X\n", "Value",
- ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
- break;
-
-
- case ACPI_TYPE_STRING:
-
- AcpiExOutInteger ("Length", ObjDesc->String.Length);
-
- AcpiOsPrintf ("%20s : %p ", "Pointer", ObjDesc->String.Pointer);
- AcpiUtPrintString (ObjDesc->String.Pointer, ACPI_UINT8_MAX);
- AcpiOsPrintf ("\n");
- break;
-
-
- case ACPI_TYPE_BUFFER:
-
- AcpiExOutInteger ("Length", ObjDesc->Buffer.Length);
- AcpiExOutPointer ("Pointer", ObjDesc->Buffer.Pointer);
- ACPI_DUMP_BUFFER (ObjDesc->Buffer.Pointer, ObjDesc->Buffer.Length);
- break;
-
-
- case ACPI_TYPE_PACKAGE:
-
- AcpiExOutInteger ("Flags", ObjDesc->Package.Flags);
- AcpiExOutInteger ("Elements", ObjDesc->Package.Count);
- AcpiExOutPointer ("Element List", ObjDesc->Package.Elements);
-
- /* Dump the package contents */
-
- AcpiOsPrintf ("\nPackage Contents:\n");
- AcpiExDumpPackage (ObjDesc, 0, 0);
- break;
-
-
- case ACPI_TYPE_DEVICE:
-
- AcpiExOutPointer ("Handler", ObjDesc->Device.Handler);
- AcpiExOutPointer ("SystemNotify", ObjDesc->Device.SystemNotify);
- AcpiExOutPointer ("DeviceNotify", ObjDesc->Device.DeviceNotify);
- break;
-
-
- case ACPI_TYPE_EVENT:
-
- AcpiExOutPointer ("Semaphore", ObjDesc->Event.Semaphore);
- break;
-
-
- case ACPI_TYPE_METHOD:
-
- AcpiExOutInteger ("ParamCount", ObjDesc->Method.ParamCount);
- AcpiExOutInteger ("Concurrency", ObjDesc->Method.Concurrency);
- AcpiExOutPointer ("Semaphore", ObjDesc->Method.Semaphore);
- AcpiExOutInteger ("OwnerId", ObjDesc->Method.OwnerId);
- AcpiExOutInteger ("AmlLength", ObjDesc->Method.AmlLength);
- AcpiExOutPointer ("AmlStart", ObjDesc->Method.AmlStart);
- break;
-
-
- case ACPI_TYPE_MUTEX:
-
- AcpiExOutInteger ("SyncLevel", ObjDesc->Mutex.SyncLevel);
- AcpiExOutPointer ("OwnerThread", ObjDesc->Mutex.OwnerThread);
- AcpiExOutInteger ("AcquireDepth", ObjDesc->Mutex.AcquisitionDepth);
- AcpiExOutPointer ("Semaphore", ObjDesc->Mutex.Semaphore);
- break;
-
-
- case ACPI_TYPE_REGION:
-
- AcpiExOutInteger ("SpaceId", ObjDesc->Region.SpaceId);
- AcpiExOutInteger ("Flags", ObjDesc->Region.Flags);
- AcpiExOutAddress ("Address", ObjDesc->Region.Address);
- AcpiExOutInteger ("Length", ObjDesc->Region.Length);
- AcpiExOutPointer ("Handler", ObjDesc->Region.Handler);
- AcpiExOutPointer ("Next", ObjDesc->Region.Next);
- break;
-
-
- case ACPI_TYPE_POWER:
-
- AcpiExOutInteger ("SystemLevel", ObjDesc->PowerResource.SystemLevel);
- AcpiExOutInteger ("ResourceOrder", ObjDesc->PowerResource.ResourceOrder);
- AcpiExOutPointer ("SystemNotify", ObjDesc->PowerResource.SystemNotify);
- AcpiExOutPointer ("DeviceNotify", ObjDesc->PowerResource.DeviceNotify);
- break;
-
-
- case ACPI_TYPE_PROCESSOR:
-
- AcpiExOutInteger ("Processor ID", ObjDesc->Processor.ProcId);
- AcpiExOutInteger ("Length", ObjDesc->Processor.Length);
- AcpiExOutAddress ("Address", (ACPI_PHYSICAL_ADDRESS) ObjDesc->Processor.Address);
- AcpiExOutPointer ("SystemNotify", ObjDesc->Processor.SystemNotify);
- AcpiExOutPointer ("DeviceNotify", ObjDesc->Processor.DeviceNotify);
- AcpiExOutPointer ("Handler", ObjDesc->Processor.Handler);
- break;
-
-
- case ACPI_TYPE_THERMAL:
-
- AcpiExOutPointer ("SystemNotify", ObjDesc->ThermalZone.SystemNotify);
- AcpiExOutPointer ("DeviceNotify", ObjDesc->ThermalZone.DeviceNotify);
- AcpiExOutPointer ("Handler", ObjDesc->ThermalZone.Handler);
- break;
-
-
- case ACPI_TYPE_BUFFER_FIELD:
- case ACPI_TYPE_LOCAL_REGION_FIELD:
- case ACPI_TYPE_LOCAL_BANK_FIELD:
- case ACPI_TYPE_LOCAL_INDEX_FIELD:
-
- AcpiExOutInteger ("FieldFlags", ObjDesc->CommonField.FieldFlags);
- AcpiExOutInteger ("AccessByteWidth",ObjDesc->CommonField.AccessByteWidth);
- AcpiExOutInteger ("BitLength", ObjDesc->CommonField.BitLength);
- AcpiExOutInteger ("FldBitOffset", ObjDesc->CommonField.StartFieldBitOffset);
- AcpiExOutInteger ("BaseByteOffset", ObjDesc->CommonField.BaseByteOffset);
- AcpiExOutPointer ("ParentNode", ObjDesc->CommonField.Node);
-
- switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
- {
- case ACPI_TYPE_BUFFER_FIELD:
- AcpiExOutPointer ("BufferObj", ObjDesc->BufferField.BufferObj);
- break;
-
- case ACPI_TYPE_LOCAL_REGION_FIELD:
- AcpiExOutPointer ("RegionObj", ObjDesc->Field.RegionObj);
- break;
-
- case ACPI_TYPE_LOCAL_BANK_FIELD:
- AcpiExOutInteger ("Value", ObjDesc->BankField.Value);
- AcpiExOutPointer ("RegionObj", ObjDesc->BankField.RegionObj);
- AcpiExOutPointer ("BankObj", ObjDesc->BankField.BankObj);
- break;
-
- case ACPI_TYPE_LOCAL_INDEX_FIELD:
- AcpiExOutInteger ("Value", ObjDesc->IndexField.Value);
- AcpiExOutPointer ("Index", ObjDesc->IndexField.IndexObj);
- AcpiExOutPointer ("Data", ObjDesc->IndexField.DataObj);
- break;
-
- default:
- /* All object types covered above */
- break;
- }
- break;
-
-
- case ACPI_TYPE_LOCAL_REFERENCE:
-
- AcpiExOutInteger ("TargetType", ObjDesc->Reference.TargetType);
- AcpiExOutString ("Opcode", (AcpiPsGetOpcodeInfo (
- ObjDesc->Reference.Opcode))->Name);
- AcpiExOutInteger ("Offset", ObjDesc->Reference.Offset);
- AcpiExOutPointer ("ObjDesc", ObjDesc->Reference.Object);
- AcpiExOutPointer ("Node", ObjDesc->Reference.Node);
- AcpiExOutPointer ("Where", ObjDesc->Reference.Where);
-
- AcpiExDumpReference (ObjDesc);
- break;
-
-
- case ACPI_TYPE_LOCAL_ADDRESS_HANDLER:
-
- AcpiExOutInteger ("SpaceId", ObjDesc->AddressSpace.SpaceId);
- AcpiExOutPointer ("Next", ObjDesc->AddressSpace.Next);
- AcpiExOutPointer ("RegionList", ObjDesc->AddressSpace.RegionList);
- AcpiExOutPointer ("Node", ObjDesc->AddressSpace.Node);
- AcpiExOutPointer ("Context", ObjDesc->AddressSpace.Context);
- break;
-
-
- case ACPI_TYPE_LOCAL_NOTIFY:
-
- AcpiExOutPointer ("Node", ObjDesc->Notify.Node);
- AcpiExOutPointer ("Context", ObjDesc->Notify.Context);
- break;
+ return_VOID;
+ }
+ /* Common Fields */
- case ACPI_TYPE_LOCAL_ALIAS:
- case ACPI_TYPE_LOCAL_METHOD_ALIAS:
- case ACPI_TYPE_LOCAL_EXTRA:
- case ACPI_TYPE_LOCAL_DATA:
- default:
+ AcpiExDumpObject (ObjDesc, AcpiExDumpCommon);
- AcpiOsPrintf (
- "ExDumpObjectDescriptor: Display not implemented for object type %s\n",
- AcpiUtGetObjectTypeName (ObjDesc));
- break;
- }
+ /* Object-specific fields */
+ AcpiExDumpObject (ObjDesc, AcpiExDumpInfo[ObjDesc->Common.Type]);
return_VOID;
}
diff --git a/sys/contrib/dev/acpica/exfield.c b/sys/contrib/dev/acpica/exfield.c
index 3cb7482..c4cbf23 100644
--- a/sys/contrib/dev/acpica/exfield.c
+++ b/sys/contrib/dev/acpica/exfield.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: exfield - ACPI AML (p-code) execution - field manipulation
- * $Revision: 1.124 $
+ * $Revision: 1.131 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -151,10 +151,9 @@ AcpiExReadDataFromField (
ACPI_OPERAND_OBJECT *BufferDesc;
ACPI_SIZE Length;
void *Buffer;
- BOOLEAN Locked;
- ACPI_FUNCTION_TRACE_PTR ("ExReadDataFromField", ObjDesc);
+ ACPI_FUNCTION_TRACE_PTR (ExReadDataFromField, ObjDesc);
/* Parameter validation */
@@ -198,7 +197,7 @@ AcpiExReadDataFromField (
/* Lock entire transaction if requested */
- Locked = AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags);
+ AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags);
/*
* Perform the read.
@@ -207,7 +206,7 @@ AcpiExReadDataFromField (
Status = AcpiExAccessRegion (ObjDesc, 0,
ACPI_CAST_PTR (ACPI_INTEGER, BufferDesc->Buffer.Pointer),
ACPI_READ | (ObjDesc->Field.Attribute << 16));
- AcpiExReleaseGlobalLock (Locked);
+ AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags);
goto Exit;
}
@@ -259,12 +258,12 @@ AcpiExReadDataFromField (
/* Lock entire transaction if requested */
- Locked = AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags);
+ AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags);
/* Read from the field */
Status = AcpiExExtractFromField (ObjDesc, Buffer, (UINT32) Length);
- AcpiExReleaseGlobalLock (Locked);
+ AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags);
Exit:
@@ -306,11 +305,10 @@ AcpiExWriteDataToField (
UINT32 RequiredLength;
void *Buffer;
void *NewBuffer;
- BOOLEAN Locked;
ACPI_OPERAND_OBJECT *BufferDesc;
- ACPI_FUNCTION_TRACE_PTR ("ExWriteDataToField", ObjDesc);
+ ACPI_FUNCTION_TRACE_PTR (ExWriteDataToField, ObjDesc);
/* Parameter validation */
@@ -346,7 +344,7 @@ AcpiExWriteDataToField (
*/
if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_BUFFER)
{
- ACPI_REPORT_ERROR (("SMBus write requires Buffer, found type %s\n",
+ ACPI_ERROR ((AE_INFO, "SMBus write requires Buffer, found type %s",
AcpiUtGetObjectTypeName (SourceDesc)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
@@ -354,8 +352,8 @@ AcpiExWriteDataToField (
if (SourceDesc->Buffer.Length < ACPI_SMBUS_BUFFER_SIZE)
{
- ACPI_REPORT_ERROR ((
- "SMBus write requires Buffer of length %X, found length %X\n",
+ ACPI_ERROR ((AE_INFO,
+ "SMBus write requires Buffer of length %X, found length %X",
ACPI_SMBUS_BUFFER_SIZE, SourceDesc->Buffer.Length));
return_ACPI_STATUS (AE_AML_BUFFER_LIMIT);
@@ -373,7 +371,7 @@ AcpiExWriteDataToField (
/* Lock entire transaction if requested */
- Locked = AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags);
+ AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags);
/*
* Perform the write (returns status and perhaps data in the
@@ -383,7 +381,7 @@ AcpiExWriteDataToField (
Status = AcpiExAccessRegion (ObjDesc, 0,
(ACPI_INTEGER *) Buffer,
ACPI_WRITE | (ObjDesc->Field.Attribute << 16));
- AcpiExReleaseGlobalLock (Locked);
+ AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags);
*ResultDesc = BufferDesc;
return_ACPI_STATUS (Status);
@@ -426,7 +424,7 @@ AcpiExWriteDataToField (
{
/* We need to create a new buffer */
- NewBuffer = ACPI_MEM_CALLOCATE (RequiredLength);
+ NewBuffer = ACPI_ALLOCATE_ZEROED (RequiredLength);
if (!NewBuffer)
{
return_ACPI_STATUS (AE_NO_MEMORY);
@@ -457,18 +455,18 @@ AcpiExWriteDataToField (
/* Lock entire transaction if requested */
- Locked = AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags);
+ AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags);
/* Write to the field */
Status = AcpiExInsertIntoField (ObjDesc, Buffer, Length);
- AcpiExReleaseGlobalLock (Locked);
+ AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags);
/* Free temporary buffer if we used one */
if (NewBuffer)
{
- ACPI_MEM_FREE (NewBuffer);
+ ACPI_FREE (NewBuffer);
}
return_ACPI_STATUS (Status);
diff --git a/sys/contrib/dev/acpica/exfldio.c b/sys/contrib/dev/acpica/exfldio.c
index efd1dec..1a8631b 100644
--- a/sys/contrib/dev/acpica/exfldio.c
+++ b/sys/contrib/dev/acpica/exfldio.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: exfldio - Aml Field I/O
- * $Revision: 1.116 $
+ * $Revision: 1.128 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -172,7 +172,7 @@ AcpiExSetupRegion (
ACPI_OPERAND_OBJECT *RgnDesc;
- ACPI_FUNCTION_TRACE_U32 ("ExSetupRegion", FieldDatumByteOffset);
+ ACPI_FUNCTION_TRACE_U32 (ExSetupRegion, FieldDatumByteOffset);
RgnDesc = ObjDesc->CommonField.RegionObj;
@@ -181,7 +181,7 @@ AcpiExSetupRegion (
if (ACPI_GET_OBJECT_TYPE (RgnDesc) != ACPI_TYPE_REGION)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Needed Region, found type %X (%s)\n",
+ ACPI_ERROR ((AE_INFO, "Needed Region, found type %X (%s)",
ACPI_GET_OBJECT_TYPE (RgnDesc),
AcpiUtGetObjectTypeName (RgnDesc)));
@@ -201,6 +201,17 @@ 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
+ */
if (RgnDesc->Region.SpaceId == ACPI_ADR_SPACE_SMBUS)
{
/* SMBus has a non-linear address space */
@@ -227,9 +238,10 @@ AcpiExSetupRegion (
* length of one field datum (access width) must fit within the region.
* (Region length is specified in bytes)
*/
- if (RgnDesc->Region.Length < (ObjDesc->CommonField.BaseByteOffset +
- FieldDatumByteOffset +
- ObjDesc->CommonField.AccessByteWidth))
+ if (RgnDesc->Region.Length <
+ (ObjDesc->CommonField.BaseByteOffset +
+ FieldDatumByteOffset +
+ ObjDesc->CommonField.AccessByteWidth))
{
if (AcpiGbl_EnableInterpreterSlack)
{
@@ -239,10 +251,10 @@ AcpiExSetupRegion (
* access width boundary.
*/
if (ACPI_ROUND_UP (RgnDesc->Region.Length,
- ObjDesc->CommonField.AccessByteWidth) >=
+ ObjDesc->CommonField.AccessByteWidth) >=
(ObjDesc->CommonField.BaseByteOffset +
- (ACPI_NATIVE_UINT) ObjDesc->CommonField.AccessByteWidth +
- FieldDatumByteOffset))
+ (ACPI_NATIVE_UINT) ObjDesc->CommonField.AccessByteWidth +
+ FieldDatumByteOffset))
{
return_ACPI_STATUS (AE_OK);
}
@@ -255,8 +267,8 @@ AcpiExSetupRegion (
* than the region itself. For example, a region of length one
* byte, and a field with Dword access specified.
*/
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Field [%4.4s] access width (%d bytes) too large for region [%4.4s] (length %X)\n",
+ ACPI_ERROR ((AE_INFO,
+ "Field [%4.4s] access width (%d bytes) too large for region [%4.4s] (length %X)",
AcpiUtGetNodeName (ObjDesc->CommonField.Node),
ObjDesc->CommonField.AccessByteWidth,
AcpiUtGetNodeName (RgnDesc->Region.Node),
@@ -267,8 +279,8 @@ AcpiExSetupRegion (
* Offset rounded up to next multiple of field width
* exceeds region length, indicate an error
*/
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Field [%4.4s] Base+Offset+Width %X+%X+%X is beyond end of region [%4.4s] (length %X)\n",
+ ACPI_ERROR ((AE_INFO,
+ "Field [%4.4s] Base+Offset+Width %X+%X+%X is beyond end of region [%4.4s] (length %X)",
AcpiUtGetNodeName (ObjDesc->CommonField.Node),
ObjDesc->CommonField.BaseByteOffset,
FieldDatumByteOffset, ObjDesc->CommonField.AccessByteWidth,
@@ -312,7 +324,7 @@ AcpiExAccessRegion (
ACPI_PHYSICAL_ADDRESS Address;
- ACPI_FUNCTION_TRACE ("ExAccessRegion");
+ ACPI_FUNCTION_TRACE (ExAccessRegion);
/*
@@ -347,13 +359,13 @@ AcpiExAccessRegion (
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_BFIELD,
- " Region [%s:%X], Width %X, ByteBase %X, Offset %X at %8.8X%8.8X\n",
+ " Region [%s:%X], Width %X, ByteBase %X, Offset %X at %p\n",
AcpiUtGetRegionName (RgnDesc->Region.SpaceId),
RgnDesc->Region.SpaceId,
ObjDesc->CommonField.AccessByteWidth,
ObjDesc->CommonField.BaseByteOffset,
FieldDatumByteOffset,
- ACPI_FORMAT_UINT64 (Address)));
+ (void *) Address));
/* Invoke the appropriate AddressSpace/OpRegion handler */
@@ -365,15 +377,15 @@ AcpiExAccessRegion (
{
if (Status == AE_NOT_IMPLEMENTED)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Region %s(%X) not implemented\n",
+ ACPI_ERROR ((AE_INFO,
+ "Region %s(%X) not implemented",
AcpiUtGetRegionName (RgnDesc->Region.SpaceId),
RgnDesc->Region.SpaceId));
}
else if (Status == AE_NOT_EXIST)
{
- ACPI_REPORT_ERROR ((
- "Region %s(%X) has no handler\n",
+ ACPI_ERROR ((AE_INFO,
+ "Region %s(%X) has no handler",
AcpiUtGetRegionName (RgnDesc->Region.SpaceId),
RgnDesc->Region.SpaceId));
}
@@ -459,7 +471,7 @@ AcpiExFieldDatumIo (
ACPI_INTEGER LocalValue;
- ACPI_FUNCTION_TRACE_U32 ("ExFieldDatumIo", FieldDatumByteOffset);
+ ACPI_FUNCTION_TRACE_U32 (ExFieldDatumIo, FieldDatumByteOffset);
if (ReadWrite == ACPI_READ)
@@ -522,9 +534,9 @@ AcpiExFieldDatumIo (
* Length is the field width in bytes.
*/
ACPI_MEMCPY ((ObjDesc->BufferField.BufferObj)->Buffer.Pointer +
- ObjDesc->BufferField.BaseByteOffset +
- FieldDatumByteOffset,
- Value, ObjDesc->CommonField.AccessByteWidth);
+ ObjDesc->BufferField.BaseByteOffset +
+ FieldDatumByteOffset,
+ Value, ObjDesc->CommonField.AccessByteWidth);
}
Status = AE_OK;
@@ -538,7 +550,7 @@ AcpiExFieldDatumIo (
* the register
*/
if (AcpiExRegisterOverflow (ObjDesc->BankField.BankObj,
- (ACPI_INTEGER) ObjDesc->BankField.Value))
+ (ACPI_INTEGER) ObjDesc->BankField.Value))
{
return_ACPI_STATUS (AE_AML_REGISTER_LIMIT);
}
@@ -548,8 +560,8 @@ AcpiExFieldDatumIo (
* (itself a RegionField) before we can access the data.
*/
Status = AcpiExInsertIntoField (ObjDesc->BankField.BankObj,
- &ObjDesc->BankField.Value,
- sizeof (ObjDesc->BankField.Value));
+ &ObjDesc->BankField.Value,
+ sizeof (ObjDesc->BankField.Value));
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -569,7 +581,7 @@ AcpiExFieldDatumIo (
* Operation Region.
*/
Status = AcpiExAccessRegion (ObjDesc, FieldDatumByteOffset, Value,
- ReadWrite);
+ ReadWrite);
break;
@@ -581,7 +593,7 @@ AcpiExFieldDatumIo (
* the register
*/
if (AcpiExRegisterOverflow (ObjDesc->IndexField.IndexObj,
- (ACPI_INTEGER) ObjDesc->IndexField.Value))
+ (ACPI_INTEGER) ObjDesc->IndexField.Value))
{
return_ACPI_STATUS (AE_AML_REGISTER_LIMIT);
}
@@ -591,41 +603,40 @@ AcpiExFieldDatumIo (
FieldDatumByteOffset += ObjDesc->IndexField.Value;
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
- "Write to Index Register: Value %8.8X\n",
- FieldDatumByteOffset));
+ "Write to Index Register: Value %8.8X\n",
+ FieldDatumByteOffset));
Status = AcpiExInsertIntoField (ObjDesc->IndexField.IndexObj,
- &FieldDatumByteOffset,
- sizeof (FieldDatumByteOffset));
+ &FieldDatumByteOffset,
+ sizeof (FieldDatumByteOffset));
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
- "I/O to Data Register: ValuePtr %p\n",
- Value));
+ "I/O to Data Register: ValuePtr %p\n", Value));
if (ReadWrite == ACPI_READ)
{
/* Read the datum from the DataRegister */
Status = AcpiExExtractFromField (ObjDesc->IndexField.DataObj,
- Value, sizeof (ACPI_INTEGER));
+ Value, sizeof (ACPI_INTEGER));
}
else
{
/* Write the datum to the DataRegister */
Status = AcpiExInsertIntoField (ObjDesc->IndexField.DataObj,
- Value, sizeof (ACPI_INTEGER));
+ Value, sizeof (ACPI_INTEGER));
}
break;
default:
- ACPI_REPORT_ERROR (("Wrong object type in field I/O %X\n",
+ ACPI_ERROR ((AE_INFO, "Wrong object type in field I/O %X",
ACPI_GET_OBJECT_TYPE (ObjDesc)));
Status = AE_AML_INTERNAL;
break;
@@ -680,7 +691,7 @@ AcpiExWriteWithUpdateRule (
ACPI_INTEGER CurrentValue;
- ACPI_FUNCTION_TRACE_U32 ("ExWriteWithUpdateRule", Mask);
+ ACPI_FUNCTION_TRACE_U32 (ExWriteWithUpdateRule, Mask);
/* Start with the new bits */
@@ -708,7 +719,7 @@ AcpiExWriteWithUpdateRule (
* the field, and merge with the new field value.
*/
Status = AcpiExFieldDatumIo (ObjDesc, FieldDatumByteOffset,
- &CurrentValue, ACPI_READ);
+ &CurrentValue, ACPI_READ);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -734,8 +745,8 @@ AcpiExWriteWithUpdateRule (
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "WriteWithUpdateRule: Unknown UpdateRule setting: %X\n",
+ ACPI_ERROR ((AE_INFO,
+ "Unknown UpdateRule value: %X",
(ObjDesc->CommonField.FieldFlags & AML_FIELD_UPDATE_RULE_MASK)));
return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
}
@@ -752,7 +763,7 @@ AcpiExWriteWithUpdateRule (
/* Write the merged value */
Status = AcpiExFieldDatumIo (ObjDesc, FieldDatumByteOffset,
- &MergedValue, ACPI_WRITE);
+ &MergedValue, ACPI_WRITE);
return_ACPI_STATUS (Status);
}
@@ -789,16 +800,16 @@ AcpiExExtractFromField (
UINT32 i;
- ACPI_FUNCTION_TRACE ("ExExtractFromField");
+ ACPI_FUNCTION_TRACE (ExExtractFromField);
/* Validate target buffer and clear it */
- if (BufferLength < ACPI_ROUND_BITS_UP_TO_BYTES (
- ObjDesc->CommonField.BitLength))
+ if (BufferLength <
+ ACPI_ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Field size %X (bits) is too large for buffer (%X)\n",
+ ACPI_ERROR ((AE_INFO,
+ "Field size %X (bits) is too large for buffer (%X)",
ObjDesc->CommonField.BitLength, BufferLength));
return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
@@ -832,17 +843,27 @@ AcpiExExtractFromField (
FieldOffset += ObjDesc->CommonField.AccessByteWidth;
Status = AcpiExFieldDatumIo (ObjDesc, FieldOffset,
- &RawDatum, ACPI_READ);
+ &RawDatum, ACPI_READ);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
- /* Merge with previous datum if necessary */
-
- MergedDatum |= RawDatum <<
- (ObjDesc->CommonField.AccessBitWidth -
- ObjDesc->CommonField.StartFieldBitOffset);
+ /*
+ * Merge with previous datum if necessary.
+ *
+ * Note: Before the shift, check if the shift value will be larger than
+ * the integer size. If so, there is no need to perform the operation.
+ * This avoids the differences in behavior between different compilers
+ * concerning shift values larger than the target data width.
+ */
+ if ((ObjDesc->CommonField.AccessBitWidth -
+ ObjDesc->CommonField.StartFieldBitOffset) < ACPI_INTEGER_BIT_SIZE)
+ {
+ MergedDatum |= RawDatum <<
+ (ObjDesc->CommonField.AccessBitWidth -
+ ObjDesc->CommonField.StartFieldBitOffset);
+ }
if (i == DatumCount)
{
@@ -853,7 +874,7 @@ AcpiExExtractFromField (
ACPI_MEMCPY (((char *) Buffer) + BufferOffset, &MergedDatum,
ACPI_MIN(ObjDesc->CommonField.AccessByteWidth,
- BufferLength - BufferOffset));
+ BufferLength - BufferOffset));
BufferOffset += ObjDesc->CommonField.AccessByteWidth;
MergedDatum = RawDatum >> ObjDesc->CommonField.StartFieldBitOffset;
@@ -872,7 +893,7 @@ AcpiExExtractFromField (
ACPI_MEMCPY (((char *) Buffer) + BufferOffset, &MergedDatum,
ACPI_MIN(ObjDesc->CommonField.AccessByteWidth,
- BufferLength - BufferOffset));
+ BufferLength - BufferOffset));
return_ACPI_STATUS (AE_OK);
}
@@ -900,6 +921,7 @@ AcpiExInsertIntoField (
{
ACPI_STATUS Status;
ACPI_INTEGER Mask;
+ ACPI_INTEGER WidthMask;
ACPI_INTEGER MergedDatum;
ACPI_INTEGER RawDatum = 0;
UINT32 FieldOffset = 0;
@@ -910,26 +932,43 @@ AcpiExInsertIntoField (
UINT32 i;
- ACPI_FUNCTION_TRACE ("ExInsertIntoField");
+ ACPI_FUNCTION_TRACE (ExInsertIntoField);
/* Validate input buffer */
- if (BufferLength < ACPI_ROUND_BITS_UP_TO_BYTES (
- ObjDesc->CommonField.BitLength))
+ if (BufferLength <
+ ACPI_ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Field size %X (bits) is too large for buffer (%X)\n",
+ ACPI_ERROR ((AE_INFO,
+ "Field size %X (bits) is too large for buffer (%X)",
ObjDesc->CommonField.BitLength, BufferLength));
return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
}
+ /*
+ * Create the bitmasks used for bit insertion.
+ * Note: This if/else is used to bypass compiler differences with the
+ * shift operator
+ */
+ if (ObjDesc->CommonField.AccessBitWidth == ACPI_INTEGER_BIT_SIZE)
+ {
+ WidthMask = ACPI_INTEGER_MAX;
+ }
+ else
+ {
+ WidthMask = ACPI_MASK_BITS_ABOVE (ObjDesc->CommonField.AccessBitWidth);
+ }
+
+ Mask = WidthMask &
+ ACPI_MASK_BITS_BELOW (ObjDesc->CommonField.StartFieldBitOffset);
+
/* Compute the number of datums (access width data items) */
- Mask = ACPI_MASK_BITS_BELOW (ObjDesc->CommonField.StartFieldBitOffset);
DatumCount = ACPI_ROUND_UP_TO (ObjDesc->CommonField.BitLength,
ObjDesc->CommonField.AccessBitWidth);
+
FieldDatumCount = ACPI_ROUND_UP_TO (ObjDesc->CommonField.BitLength +
ObjDesc->CommonField.StartFieldBitOffset,
ObjDesc->CommonField.AccessBitWidth);
@@ -938,7 +977,7 @@ AcpiExInsertIntoField (
ACPI_MEMCPY (&RawDatum, Buffer,
ACPI_MIN(ObjDesc->CommonField.AccessByteWidth,
- BufferLength - BufferOffset));
+ BufferLength - BufferOffset));
MergedDatum = RawDatum << ObjDesc->CommonField.StartFieldBitOffset;
@@ -956,13 +995,30 @@ AcpiExInsertIntoField (
return_ACPI_STATUS (Status);
}
- /* Start new output datum by merging with previous input datum */
-
FieldOffset += ObjDesc->CommonField.AccessByteWidth;
- MergedDatum = RawDatum >>
- (ObjDesc->CommonField.AccessBitWidth -
- ObjDesc->CommonField.StartFieldBitOffset);
- Mask = ACPI_INTEGER_MAX;
+
+ /*
+ * Start new output datum by merging with previous input datum
+ * if necessary.
+ *
+ * Note: Before the shift, check if the shift value will be larger than
+ * the integer size. If so, there is no need to perform the operation.
+ * This avoids the differences in behavior between different compilers
+ * concerning shift values larger than the target data width.
+ */
+ if ((ObjDesc->CommonField.AccessBitWidth -
+ ObjDesc->CommonField.StartFieldBitOffset) < ACPI_INTEGER_BIT_SIZE)
+ {
+ MergedDatum = RawDatum >>
+ (ObjDesc->CommonField.AccessBitWidth -
+ ObjDesc->CommonField.StartFieldBitOffset);
+ }
+ else
+ {
+ MergedDatum = 0;
+ }
+
+ Mask = WidthMask;
if (i == DatumCount)
{
diff --git a/sys/contrib/dev/acpica/exmisc.c b/sys/contrib/dev/acpica/exmisc.c
index 2ab3d0a..11dd35a 100644
--- a/sys/contrib/dev/acpica/exmisc.c
+++ b/sys/contrib/dev/acpica/exmisc.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exmisc - ACPI AML (p-code) execution - specific opcodes
- * $Revision: 1.132 $
+ * $Revision: 1.144 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -121,6 +121,7 @@
#include <contrib/dev/acpica/acpi.h>
#include <contrib/dev/acpica/acinterp.h>
#include <contrib/dev/acpica/amlcode.h>
+#include <contrib/dev/acpica/amlresrc.h>
#define _COMPONENT ACPI_EXECUTER
@@ -152,7 +153,7 @@ AcpiExGetObjectReference (
ACPI_OPERAND_OBJECT *ReferencedObj;
- ACPI_FUNCTION_TRACE_PTR ("ExGetObjectReference", ObjDesc);
+ ACPI_FUNCTION_TRACE_PTR (ExGetObjectReference, ObjDesc);
*ReturnDesc = NULL;
@@ -182,7 +183,7 @@ AcpiExGetObjectReference (
default:
- ACPI_REPORT_ERROR (("Unknown Reference opcode in GetReference %X\n",
+ ACPI_ERROR ((AE_INFO, "Unknown Reference opcode %X",
ObjDesc->Reference.Opcode));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
@@ -200,8 +201,8 @@ AcpiExGetObjectReference (
default:
- ACPI_REPORT_ERROR (("Invalid descriptor type in GetReference: %X\n",
- ACPI_GET_DESCRIPTOR_TYPE (ObjDesc)));
+ ACPI_ERROR ((AE_INFO, "Invalid descriptor type %X",
+ ACPI_GET_DESCRIPTOR_TYPE (ObjDesc)));
return_ACPI_STATUS (AE_TYPE);
}
@@ -248,53 +249,70 @@ AcpiExConcatTemplate (
ACPI_OPERAND_OBJECT **ActualReturnDesc,
ACPI_WALK_STATE *WalkState)
{
+ ACPI_STATUS Status;
ACPI_OPERAND_OBJECT *ReturnDesc;
UINT8 *NewBuf;
- UINT8 *EndTag1;
- UINT8 *EndTag2;
+ UINT8 *EndTag;
+ ACPI_SIZE Length0;
ACPI_SIZE Length1;
- ACPI_SIZE Length2;
+ ACPI_SIZE NewLength;
- ACPI_FUNCTION_TRACE ("ExConcatTemplate");
+ ACPI_FUNCTION_TRACE (ExConcatTemplate);
- /* Find the EndTags in each resource template */
+ /*
+ * Find the EndTag descriptor in each resource template.
+ * Note1: returned pointers point TO the EndTag, not past it.
+ * Note2: zero-length buffers are allowed; treated like one EndTag
+ */
+
+ /* Get the length of the first resource template */
- EndTag1 = AcpiUtGetResourceEndTag (Operand0);
- EndTag2 = AcpiUtGetResourceEndTag (Operand1);
- if (!EndTag1 || !EndTag2)
+ Status = AcpiUtGetResourceEndTag (Operand0, &EndTag);
+ if (ACPI_FAILURE (Status))
{
- return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+ return_ACPI_STATUS (Status);
}
- /* Compute the length of each part */
+ Length0 = ACPI_PTR_DIFF (EndTag, Operand0->Buffer.Pointer);
- Length1 = ACPI_PTR_DIFF (EndTag1, Operand0->Buffer.Pointer);
- Length2 = ACPI_PTR_DIFF (EndTag2, Operand1->Buffer.Pointer) +
- 2; /* Size of END_TAG */
+ /* Get the length of the second resource template */
- /* Create a new buffer object for the result */
+ Status = AcpiUtGetResourceEndTag (Operand1, &EndTag);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ Length1 = ACPI_PTR_DIFF (EndTag, Operand1->Buffer.Pointer);
+
+ /* Combine both lengths, minimum size will be 2 for EndTag */
+
+ NewLength = Length0 + Length1 + sizeof (AML_RESOURCE_END_TAG);
- ReturnDesc = AcpiUtCreateBufferObject (Length1 + Length2);
+ /* Create a new buffer object for the result (with one EndTag) */
+
+ ReturnDesc = AcpiUtCreateBufferObject (NewLength);
if (!ReturnDesc)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
- /* Copy the templates to the new descriptor */
-
+ /*
+ * Copy the templates to the new buffer, 0 first, then 1 follows. One
+ * EndTag descriptor is copied from Operand1.
+ */
NewBuf = ReturnDesc->Buffer.Pointer;
- ACPI_MEMCPY (NewBuf, Operand0->Buffer.Pointer, Length1);
- ACPI_MEMCPY (NewBuf + Length1, Operand1->Buffer.Pointer, Length2);
+ ACPI_MEMCPY (NewBuf, Operand0->Buffer.Pointer, Length0);
+ ACPI_MEMCPY (NewBuf + Length0, Operand1->Buffer.Pointer, Length1);
- /* Compute the new checksum */
+ /* Insert EndTag and set the checksum to zero, means "ignore checksum" */
- NewBuf[ReturnDesc->Buffer.Length - 1] =
- AcpiUtGenerateChecksum (ReturnDesc->Buffer.Pointer,
- (ReturnDesc->Buffer.Length - 1));
+ NewBuf[NewLength - 1] = 0;
+ NewBuf[NewLength - 2] = ACPI_RESOURCE_NAME_END_TAG | 1;
- /* Return the completed template descriptor */
+ /* Return the completed resource template */
*ActualReturnDesc = ReturnDesc;
return_ACPI_STATUS (AE_OK);
@@ -327,10 +345,9 @@ AcpiExDoConcatenate (
ACPI_OPERAND_OBJECT *ReturnDesc;
char *NewBuf;
ACPI_STATUS Status;
- ACPI_SIZE NewLength;
- ACPI_FUNCTION_TRACE ("ExDoConcatenate");
+ ACPI_FUNCTION_TRACE (ExDoConcatenate);
/*
@@ -356,8 +373,8 @@ AcpiExDoConcatenate (
break;
default:
- ACPI_REPORT_ERROR (("Concat - invalid obj type: %X\n",
- ACPI_GET_OBJECT_TYPE (Operand0)));
+ ACPI_ERROR ((AE_INFO, "Invalid object type: %X",
+ ACPI_GET_OBJECT_TYPE (Operand0)));
Status = AE_AML_INTERNAL;
}
@@ -398,8 +415,7 @@ AcpiExDoConcatenate (
/* Copy the first integer, LSB first */
- ACPI_MEMCPY (NewBuf,
- &Operand0->Integer.Value,
+ ACPI_MEMCPY (NewBuf, &Operand0->Integer.Value,
AcpiGbl_IntegerByteWidth);
/* Copy the second integer (LSB first) after the first */
@@ -413,15 +429,9 @@ AcpiExDoConcatenate (
/* Result of two Strings is a String */
- NewLength = (ACPI_SIZE) Operand0->String.Length +
- (ACPI_SIZE) LocalOperand1->String.Length;
- if (NewLength > ACPI_MAX_STRING_CONVERSION)
- {
- Status = AE_AML_STRING_LIMIT;
- goto Cleanup;
- }
-
- ReturnDesc = AcpiUtCreateStringObject (NewLength);
+ ReturnDesc = AcpiUtCreateStringObject ((ACPI_SIZE)
+ (Operand0->String.Length +
+ LocalOperand1->String.Length));
if (!ReturnDesc)
{
Status = AE_NO_MEMORY;
@@ -432,8 +442,7 @@ AcpiExDoConcatenate (
/* Concatenate the strings */
- ACPI_STRCPY (NewBuf,
- Operand0->String.Pointer);
+ ACPI_STRCPY (NewBuf, Operand0->String.Pointer);
ACPI_STRCPY (NewBuf + Operand0->String.Length,
LocalOperand1->String.Pointer);
break;
@@ -442,9 +451,9 @@ AcpiExDoConcatenate (
/* Result of two Buffers is a Buffer */
- ReturnDesc = AcpiUtCreateBufferObject (
- (ACPI_SIZE) Operand0->Buffer.Length +
- (ACPI_SIZE) LocalOperand1->Buffer.Length);
+ ReturnDesc = AcpiUtCreateBufferObject ((ACPI_SIZE)
+ (Operand0->Buffer.Length +
+ LocalOperand1->Buffer.Length));
if (!ReturnDesc)
{
Status = AE_NO_MEMORY;
@@ -455,8 +464,7 @@ AcpiExDoConcatenate (
/* Concatenate the buffers */
- ACPI_MEMCPY (NewBuf,
- Operand0->Buffer.Pointer,
+ ACPI_MEMCPY (NewBuf, Operand0->Buffer.Pointer,
Operand0->Buffer.Length);
ACPI_MEMCPY (NewBuf + Operand0->Buffer.Length,
LocalOperand1->Buffer.Pointer,
@@ -467,8 +475,8 @@ AcpiExDoConcatenate (
/* Invalid object type, should not happen here */
- ACPI_REPORT_ERROR (("Concatenate - Invalid object type: %X\n",
- ACPI_GET_OBJECT_TYPE (Operand0)));
+ ACPI_ERROR ((AE_INFO, "Invalid object type: %X",
+ ACPI_GET_OBJECT_TYPE (Operand0)));
Status =AE_AML_INTERNAL;
goto Cleanup;
}
@@ -549,11 +557,27 @@ AcpiExDoMathOp (
case AML_SHIFT_LEFT_OP: /* ShiftLeft (Operand, ShiftCount, Result)*/
+ /*
+ * We need to check if the shiftcount is larger than the integer bit
+ * width since the behavior of this is not well-defined in the C language.
+ */
+ if (Integer1 >= AcpiGbl_IntegerBitWidth)
+ {
+ return (0);
+ }
return (Integer0 << Integer1);
case AML_SHIFT_RIGHT_OP: /* ShiftRight (Operand, ShiftCount, Result) */
+ /*
+ * We need to check if the shiftcount is larger than the integer bit
+ * width since the behavior of this is not well-defined in the C language.
+ */
+ if (Integer1 >= AcpiGbl_IntegerBitWidth)
+ {
+ return (0);
+ }
return (Integer0 >> Integer1);
@@ -599,7 +623,7 @@ AcpiExDoLogicalNumericOp (
BOOLEAN LocalResult = FALSE;
- ACPI_FUNCTION_TRACE ("ExDoLogicalNumericOp");
+ ACPI_FUNCTION_TRACE (ExDoLogicalNumericOp);
switch (Opcode)
@@ -675,7 +699,7 @@ AcpiExDoLogicalOp (
int Compare;
- ACPI_FUNCTION_TRACE ("ExDoLogicalOp");
+ ACPI_FUNCTION_TRACE (ExDoLogicalOp);
/*
diff --git a/sys/contrib/dev/acpica/exmutex.c b/sys/contrib/dev/acpica/exmutex.c
index 06f1972..e1925ec 100644
--- a/sys/contrib/dev/acpica/exmutex.c
+++ b/sys/contrib/dev/acpica/exmutex.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exmutex - ASL Mutex Acquire/Release functions
- * $Revision: 1.28 $
+ * $Revision: 1.40 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -119,6 +119,7 @@
#include <contrib/dev/acpica/acpi.h>
#include <contrib/dev/acpica/acinterp.h>
+#include <contrib/dev/acpica/acevents.h>
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME ("exmutex")
@@ -216,6 +217,88 @@ AcpiExLinkMutex (
/*******************************************************************************
*
+ * FUNCTION: AcpiExAcquireMutexObject
+ *
+ * PARAMETERS: TimeDesc - Timeout in milliseconds
+ * ObjDesc - Mutex object
+ * Thread - Current thread state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Acquire an AML mutex, low-level interface. Provides a common
+ * path that supports multiple acquires by the same thread.
+ *
+ * MUTEX: Interpreter must be locked
+ *
+ * NOTE: This interface is called from three places:
+ * 1) From AcpiExAcquireMutex, via an AML Acquire() operator
+ * 2) From AcpiExAcquireGlobalLock when an AML Field access requires the
+ * global lock
+ * 3) From the external interface, AcpiAcquireGlobalLock
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExAcquireMutexObject (
+ UINT16 Timeout,
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_THREAD_ID ThreadId)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE_PTR (ExAcquireMutexObject, ObjDesc);
+
+
+ if (!ObjDesc)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ /* Support for multiple acquires by the owning thread */
+
+ if (ObjDesc->Mutex.ThreadId == ThreadId)
+ {
+ /*
+ * The mutex is already owned by this thread, just increment the
+ * acquisition depth
+ */
+ ObjDesc->Mutex.AcquisitionDepth++;
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Acquire the mutex, wait if necessary. Special case for Global Lock */
+
+ if (ObjDesc == AcpiGbl_GlobalLockMutex)
+ {
+ Status = AcpiEvAcquireGlobalLock (Timeout);
+ }
+ else
+ {
+ Status = AcpiExSystemWaitMutex (ObjDesc->Mutex.OsMutex,
+ Timeout);
+ }
+
+ if (ACPI_FAILURE (Status))
+ {
+ /* Includes failure from a timeout on TimeDesc */
+
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Acquired the mutex: update mutex object */
+
+ ObjDesc->Mutex.ThreadId = ThreadId;
+ ObjDesc->Mutex.AcquisitionDepth = 1;
+ ObjDesc->Mutex.OriginalSyncLevel = 0;
+ ObjDesc->Mutex.OwnerThread = NULL; /* Used only for AML Acquire() */
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiExAcquireMutex
*
* PARAMETERS: TimeDesc - Timeout integer
@@ -237,7 +320,7 @@ AcpiExAcquireMutex (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE_PTR ("ExAcquireMutex", ObjDesc);
+ ACPI_FUNCTION_TRACE_PTR (ExAcquireMutex, ObjDesc);
if (!ObjDesc)
@@ -245,70 +328,117 @@ AcpiExAcquireMutex (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- /* Sanity check -- we must have a valid thread ID */
+ /* Must have a valid thread ID */
if (!WalkState->Thread)
{
- ACPI_REPORT_ERROR (("Cannot acquire Mutex [%4.4s], null thread info\n",
+ ACPI_ERROR ((AE_INFO, "Cannot acquire Mutex [%4.4s], null thread info",
AcpiUtGetNodeName (ObjDesc->Mutex.Node)));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
/*
- * Current Sync must be less than or equal to the sync level of the
- * mutex. This mechanism provides some deadlock prevention
+ * Current sync level must be less than or equal to the sync level of the
+ * mutex. This mechanism provides some deadlock prevention
*/
if (WalkState->Thread->CurrentSyncLevel > ObjDesc->Mutex.SyncLevel)
{
- ACPI_REPORT_ERROR ((
- "Cannot acquire Mutex [%4.4s], incorrect SyncLevel\n",
- AcpiUtGetNodeName (ObjDesc->Mutex.Node)));
+ ACPI_ERROR ((AE_INFO,
+ "Cannot acquire Mutex [%4.4s], current SyncLevel is too large (%d)",
+ AcpiUtGetNodeName (ObjDesc->Mutex.Node),
+ WalkState->Thread->CurrentSyncLevel));
return_ACPI_STATUS (AE_AML_MUTEX_ORDER);
}
- /* Support for multiple acquires by the owning thread */
-
- if (ObjDesc->Mutex.OwnerThread)
+ Status = AcpiExAcquireMutexObject ((UINT16) TimeDesc->Integer.Value,
+ ObjDesc, WalkState->Thread->ThreadId);
+ if (ACPI_SUCCESS (Status) && ObjDesc->Mutex.AcquisitionDepth == 1)
{
- /* Special case for Global Lock, allow all threads */
+ /* Save Thread object, original/current sync levels */
- if ((ObjDesc->Mutex.OwnerThread->ThreadId ==
- WalkState->Thread->ThreadId) ||
- (ObjDesc->Mutex.Semaphore ==
- AcpiGbl_GlobalLockSemaphore))
- {
- /*
- * The mutex is already owned by this thread,
- * just increment the acquisition depth
- */
- ObjDesc->Mutex.AcquisitionDepth++;
- return_ACPI_STATUS (AE_OK);
- }
+ ObjDesc->Mutex.OwnerThread = WalkState->Thread;
+ ObjDesc->Mutex.OriginalSyncLevel = WalkState->Thread->CurrentSyncLevel;
+ WalkState->Thread->CurrentSyncLevel = ObjDesc->Mutex.SyncLevel;
+
+ /* Link the mutex to the current thread for force-unlock at method exit */
+
+ AcpiExLinkMutex (ObjDesc, WalkState->Thread);
}
- /* Acquire the mutex, wait if necessary */
+ return_ACPI_STATUS (Status);
+}
- Status = AcpiExSystemAcquireMutex (TimeDesc, ObjDesc);
- if (ACPI_FAILURE (Status))
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExReleaseMutexObject
+ *
+ * PARAMETERS: ObjDesc - The object descriptor for this op
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Release a previously acquired Mutex, low level interface.
+ * Provides a common path that supports multiple releases (after
+ * previous multiple acquires) by the same thread.
+ *
+ * MUTEX: Interpreter must be locked
+ *
+ * NOTE: This interface is called from three places:
+ * 1) From AcpiExReleaseMutex, via an AML Acquire() operator
+ * 2) From AcpiExReleaseGlobalLock when an AML Field access requires the
+ * global lock
+ * 3) From the external interface, AcpiReleaseGlobalLock
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExReleaseMutexObject (
+ ACPI_OPERAND_OBJECT *ObjDesc)
+{
+ ACPI_STATUS Status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE (ExReleaseMutexObject);
+
+
+ if (ObjDesc->Mutex.AcquisitionDepth == 0)
{
- /* Includes failure from a timeout on TimeDesc */
+ return (AE_NOT_ACQUIRED);
+ }
- return_ACPI_STATUS (Status);
+ /* Match multiple Acquires with multiple Releases */
+
+ ObjDesc->Mutex.AcquisitionDepth--;
+ if (ObjDesc->Mutex.AcquisitionDepth != 0)
+ {
+ /* Just decrement the depth and return */
+
+ return_ACPI_STATUS (AE_OK);
}
- /* Have the mutex: update mutex and walk info and save the SyncLevel */
+ if (ObjDesc->Mutex.OwnerThread)
+ {
+ /* Unlink the mutex from the owner's list */
- ObjDesc->Mutex.OwnerThread = WalkState->Thread;
- ObjDesc->Mutex.AcquisitionDepth = 1;
- ObjDesc->Mutex.OriginalSyncLevel = WalkState->Thread->CurrentSyncLevel;
+ AcpiExUnlinkMutex (ObjDesc);
+ ObjDesc->Mutex.OwnerThread = NULL;
+ }
- WalkState->Thread->CurrentSyncLevel = ObjDesc->Mutex.SyncLevel;
+ /* Release the mutex, special case for Global Lock */
- /* Link the mutex to the current thread for force-unlock at method exit */
+ if (ObjDesc == AcpiGbl_GlobalLockMutex)
+ {
+ Status = AcpiEvReleaseGlobalLock ();
+ }
+ else
+ {
+ AcpiOsReleaseMutex (ObjDesc->Mutex.OsMutex);
+ }
- AcpiExLinkMutex (ObjDesc, WalkState->Thread);
+ /* Clear mutex info */
- return_ACPI_STATUS (AE_OK);
+ ObjDesc->Mutex.ThreadId = 0;
+ return_ACPI_STATUS (Status);
}
@@ -330,10 +460,10 @@ AcpiExReleaseMutex (
ACPI_OPERAND_OBJECT *ObjDesc,
ACPI_WALK_STATE *WalkState)
{
- ACPI_STATUS Status;
+ ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE ("ExReleaseMutex");
+ ACPI_FUNCTION_TRACE (ExReleaseMutex);
if (!ObjDesc)
@@ -345,70 +475,56 @@ AcpiExReleaseMutex (
if (!ObjDesc->Mutex.OwnerThread)
{
- ACPI_REPORT_ERROR (("Cannot release Mutex [%4.4s], not acquired\n",
- AcpiUtGetNodeName (ObjDesc->Mutex.Node)));
+ ACPI_ERROR ((AE_INFO, "Cannot release Mutex [%4.4s], not acquired",
+ AcpiUtGetNodeName (ObjDesc->Mutex.Node)));
return_ACPI_STATUS (AE_AML_MUTEX_NOT_ACQUIRED);
}
- /* Sanity check -- we must have a valid thread ID */
-
- if (!WalkState->Thread)
- {
- ACPI_REPORT_ERROR (("Cannot release Mutex [%4.4s], null thread info\n",
- AcpiUtGetNodeName (ObjDesc->Mutex.Node)));
- return_ACPI_STATUS (AE_AML_INTERNAL);
- }
-
/*
* The Mutex is owned, but this thread must be the owner.
* Special case for Global Lock, any thread can release
*/
if ((ObjDesc->Mutex.OwnerThread->ThreadId != WalkState->Thread->ThreadId) &&
- (ObjDesc->Mutex.Semaphore != AcpiGbl_GlobalLockSemaphore))
+ (ObjDesc != AcpiGbl_GlobalLockMutex))
{
- ACPI_REPORT_ERROR ((
- "Thread %X cannot release Mutex [%4.4s] acquired by thread %X\n",
+ ACPI_ERROR ((AE_INFO,
+ "Thread %X cannot release Mutex [%4.4s] acquired by thread %X",
WalkState->Thread->ThreadId,
AcpiUtGetNodeName (ObjDesc->Mutex.Node),
ObjDesc->Mutex.OwnerThread->ThreadId));
return_ACPI_STATUS (AE_AML_NOT_OWNER);
}
+ /* Must have a valid thread ID */
+
+ if (!WalkState->Thread)
+ {
+ ACPI_ERROR ((AE_INFO, "Cannot release Mutex [%4.4s], null thread info",
+ AcpiUtGetNodeName (ObjDesc->Mutex.Node)));
+ return_ACPI_STATUS (AE_AML_INTERNAL);
+ }
+
/*
- * The sync level of the mutex must be less than or
- * equal to the current sync level
+ * The sync level of the mutex must be less than or equal to the current
+ * sync level
*/
if (ObjDesc->Mutex.SyncLevel > WalkState->Thread->CurrentSyncLevel)
{
- ACPI_REPORT_ERROR ((
- "Cannot release Mutex [%4.4s], incorrect SyncLevel\n",
- AcpiUtGetNodeName (ObjDesc->Mutex.Node)));
+ ACPI_ERROR ((AE_INFO,
+ "Cannot release Mutex [%4.4s], SyncLevel mismatch: mutex %d current %d",
+ AcpiUtGetNodeName (ObjDesc->Mutex.Node),
+ ObjDesc->Mutex.SyncLevel, WalkState->Thread->CurrentSyncLevel));
return_ACPI_STATUS (AE_AML_MUTEX_ORDER);
}
- /* Match multiple Acquires with multiple Releases */
+ Status = AcpiExReleaseMutexObject (ObjDesc);
- ObjDesc->Mutex.AcquisitionDepth--;
- if (ObjDesc->Mutex.AcquisitionDepth != 0)
+ if (ObjDesc->Mutex.AcquisitionDepth == 0)
{
- /* Just decrement the depth and return */
+ /* Restore the original SyncLevel */
- return_ACPI_STATUS (AE_OK);
+ WalkState->Thread->CurrentSyncLevel = ObjDesc->Mutex.OriginalSyncLevel;
}
-
- /* Unlink the mutex from the owner's list */
-
- AcpiExUnlinkMutex (ObjDesc);
-
- /* Release the mutex */
-
- Status = AcpiExSystemReleaseMutex (ObjDesc);
-
- /* Update the mutex and walk state, restore SyncLevel before acquire */
-
- ObjDesc->Mutex.OwnerThread = NULL;
- WalkState->Thread->CurrentSyncLevel = ObjDesc->Mutex.OriginalSyncLevel;
-
return_ACPI_STATUS (Status);
}
@@ -423,6 +539,12 @@ AcpiExReleaseMutex (
*
* DESCRIPTION: Release all mutexes held by this thread
*
+ * NOTE: This function is called as the thread is exiting the interpreter.
+ * Mutexes are not released when an individual control method is exited, but
+ * only when the parent thread actually exits the interpreter. This allows one
+ * method to acquire a mutex, and a different method to release it, as long as
+ * this is performed underneath a single parent control method.
+ *
******************************************************************************/
void
@@ -430,8 +552,7 @@ AcpiExReleaseAllMutexes (
ACPI_THREAD_STATE *Thread)
{
ACPI_OPERAND_OBJECT *Next = Thread->AcquiredMutexList;
- ACPI_OPERAND_OBJECT *This;
- ACPI_STATUS Status;
+ ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_FUNCTION_ENTRY ();
@@ -441,28 +562,34 @@ AcpiExReleaseAllMutexes (
while (Next)
{
- This = Next;
- Next = This->Mutex.Next;
+ ObjDesc = Next;
+ Next = ObjDesc->Mutex.Next;
+
+ ObjDesc->Mutex.Prev = NULL;
+ ObjDesc->Mutex.Next = NULL;
+ ObjDesc->Mutex.AcquisitionDepth = 0;
- This->Mutex.AcquisitionDepth = 1;
- This->Mutex.Prev = NULL;
- This->Mutex.Next = NULL;
+ /* Release the mutex, special case for Global Lock */
- /* Release the mutex */
+ if (ObjDesc == AcpiGbl_GlobalLockMutex)
+ {
+ /* Ignore errors */
- Status = AcpiExSystemReleaseMutex (This);
- if (ACPI_FAILURE (Status))
+ (void) AcpiEvReleaseGlobalLock ();
+ }
+ else
{
- continue;
+ AcpiOsReleaseMutex (ObjDesc->Mutex.OsMutex);
}
/* Mark mutex unowned */
- This->Mutex.OwnerThread = NULL;
+ ObjDesc->Mutex.OwnerThread = NULL;
+ ObjDesc->Mutex.ThreadId = 0;
/* Update Thread SyncLevel (Last mutex is the important one) */
- Thread->CurrentSyncLevel = This->Mutex.OriginalSyncLevel;
+ Thread->CurrentSyncLevel = ObjDesc->Mutex.OriginalSyncLevel;
}
}
diff --git a/sys/contrib/dev/acpica/exnames.c b/sys/contrib/dev/acpica/exnames.c
index e45bcb3..1304adb 100644
--- a/sys/contrib/dev/acpica/exnames.c
+++ b/sys/contrib/dev/acpica/exnames.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exnames - interpreter/scanner name load/execute
- * $Revision: 1.103 $
+ * $Revision: 1.111 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -162,7 +162,7 @@ AcpiExAllocateNameString (
char *NameString;
UINT32 SizeNeeded;
- ACPI_FUNCTION_TRACE ("ExAllocateNameString");
+ ACPI_FUNCTION_TRACE (ExAllocateNameString);
/*
@@ -185,11 +185,11 @@ AcpiExAllocateNameString (
* Allocate a buffer for the name.
* This buffer must be deleted by the caller!
*/
- NameString = ACPI_MEM_ALLOCATE (SizeNeeded);
+ NameString = ACPI_ALLOCATE (SizeNeeded);
if (!NameString)
{
- ACPI_REPORT_ERROR ((
- "ExAllocateNameString: Could not allocate size %d\n", SizeNeeded));
+ ACPI_ERROR ((AE_INFO,
+ "Could not allocate size %d", SizeNeeded));
return_PTR (NULL);
}
@@ -260,7 +260,7 @@ AcpiExNameSegment (
char CharBuf[5];
- ACPI_FUNCTION_TRACE ("ExNameSegment");
+ ACPI_FUNCTION_TRACE (ExNameSegment);
/*
@@ -271,14 +271,14 @@ AcpiExNameSegment (
if ('0' <= CharBuf[0] && CharBuf[0] <= '9')
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "leading digit: %c\n", CharBuf[0]));
+ ACPI_ERROR ((AE_INFO, "Invalid leading digit: %c", CharBuf[0]));
return_ACPI_STATUS (AE_CTRL_PENDING);
}
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Bytes from stream:\n"));
for (Index = 0;
- (Index < ACPI_NAME_SIZE) && (AcpiUtValidAcpiCharacter (*AmlAddress));
+ (Index < ACPI_NAME_SIZE) && (AcpiUtValidAcpiChar (*AmlAddress, 0));
Index++)
{
CharBuf[Index] = *AmlAddress++;
@@ -324,12 +324,12 @@ AcpiExNameSegment (
* the required 4
*/
Status = AE_AML_BAD_NAME;
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Bad character %02x in name, at %p\n",
+ ACPI_ERROR ((AE_INFO,
+ "Bad character %02x in name, at %p",
*AmlAddress, AmlAddress));
}
- *InAmlAddress = (UINT8 *) AmlAddress;
+ *InAmlAddress = ACPI_CAST_PTR (UINT8, AmlAddress);
return_ACPI_STATUS (Status);
}
@@ -366,7 +366,7 @@ AcpiExGetNameString (
BOOLEAN HasPrefix = FALSE;
- ACPI_FUNCTION_TRACE_PTR ("ExGetNameString", AmlAddress);
+ ACPI_FUNCTION_TRACE_PTR (ExGetNameString, AmlAddress);
if (ACPI_TYPE_LOCAL_REGION_FIELD == DataType ||
@@ -537,8 +537,8 @@ AcpiExGetNameString (
{
/* Ran out of segments after processing a prefix */
- ACPI_REPORT_ERROR (
- ("ExDoName: Malformed Name at %p\n", NameString));
+ ACPI_ERROR ((AE_INFO,
+ "Malformed Name at %p", NameString));
Status = AE_AML_BAD_NAME;
}
@@ -546,7 +546,7 @@ AcpiExGetNameString (
{
if (NameString)
{
- ACPI_MEM_FREE (NameString);
+ ACPI_FREE (NameString);
}
return_ACPI_STATUS (Status);
}
diff --git a/sys/contrib/dev/acpica/exoparg1.c b/sys/contrib/dev/acpica/exoparg1.c
index cee66e0..51f34af 100644
--- a/sys/contrib/dev/acpica/exoparg1.c
+++ b/sys/contrib/dev/acpica/exoparg1.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exoparg1 - AML execution - opcodes with 1 argument
- * $Revision: 1.172 $
+ * $Revision: 1.184 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -171,7 +171,7 @@ AcpiExOpcode_0A_0T_1R (
ACPI_OPERAND_OBJECT *ReturnDesc = NULL;
- ACPI_FUNCTION_TRACE_STR ("ExOpcode_0A_0T_1R",
+ ACPI_FUNCTION_TRACE_STR (ExOpcode_0A_0T_1R,
AcpiPsGetOpcodeName (WalkState->Opcode));
@@ -189,14 +189,12 @@ AcpiExOpcode_0A_0T_1R (
Status = AE_NO_MEMORY;
goto Cleanup;
}
-#if ACPI_MACHINE_WIDTH != 16
ReturnDesc->Integer.Value = AcpiOsGetTimer ();
-#endif
break;
default: /* Unknown opcode */
- ACPI_REPORT_ERROR (("AcpiExOpcode_0A_0T_1R: Unknown opcode %X\n",
+ ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
break;
@@ -209,6 +207,7 @@ Cleanup:
if ((ACPI_FAILURE (Status)) || WalkState->ResultObj)
{
AcpiUtRemoveReference (ReturnDesc);
+ WalkState->ResultObj = NULL;
}
else
{
@@ -242,7 +241,7 @@ AcpiExOpcode_1A_0T_0R (
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE_STR ("ExOpcode_1A_0T_0R",
+ ACPI_FUNCTION_TRACE_STR (ExOpcode_1A_0T_0R,
AcpiPsGetOpcodeName (WalkState->Opcode));
@@ -288,7 +287,7 @@ AcpiExOpcode_1A_0T_0R (
default: /* Unknown opcode */
- ACPI_REPORT_ERROR (("AcpiExOpcode_1A_0T_0R: Unknown opcode %X\n",
+ ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
break;
@@ -319,7 +318,7 @@ AcpiExOpcode_1A_1T_0R (
ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
- ACPI_FUNCTION_TRACE_STR ("ExOpcode_1A_1T_0R",
+ ACPI_FUNCTION_TRACE_STR (ExOpcode_1A_1T_0R,
AcpiPsGetOpcodeName (WalkState->Opcode));
@@ -334,7 +333,7 @@ AcpiExOpcode_1A_1T_0R (
default: /* Unknown opcode */
- ACPI_REPORT_ERROR (("AcpiExOpcode_1A_1T_0R: Unknown opcode %X\n",
+ ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
@@ -374,7 +373,7 @@ AcpiExOpcode_1A_1T_1R (
ACPI_INTEGER Digit;
- ACPI_FUNCTION_TRACE_STR ("ExOpcode_1A_1T_1R",
+ ACPI_FUNCTION_TRACE_STR (ExOpcode_1A_1T_1R,
AcpiPsGetOpcodeName (WalkState->Opcode));
@@ -440,8 +439,8 @@ AcpiExOpcode_1A_1T_1R (
/* Since the bit position is one-based, subtract from 33 (65) */
- ReturnDesc->Integer.Value = Temp32 == 0 ? 0 :
- (ACPI_INTEGER_BIT_SIZE + 1) - Temp32;
+ ReturnDesc->Integer.Value =
+ Temp32 == 0 ? 0 : (ACPI_INTEGER_BIT_SIZE + 1) - Temp32;
break;
@@ -468,8 +467,8 @@ AcpiExOpcode_1A_1T_1R (
if (Temp32 > 9)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "BCD digit too large (not decimal): 0x%X\n",
+ ACPI_ERROR ((AE_INFO,
+ "BCD digit too large (not decimal): 0x%X",
Temp32));
Status = AE_AML_NUMERIC_OVERFLOW;
@@ -478,8 +477,8 @@ AcpiExOpcode_1A_1T_1R (
/* Sum the digit into the result with the current power of 10 */
- ReturnDesc->Integer.Value += (((ACPI_INTEGER) Temp32) *
- PowerOfTen);
+ ReturnDesc->Integer.Value +=
+ (((ACPI_INTEGER) Temp32) * PowerOfTen);
/* Shift to next BCD digit */
@@ -507,16 +506,16 @@ AcpiExOpcode_1A_1T_1R (
* Insert the BCD digit that resides in the
* remainder from above
*/
- ReturnDesc->Integer.Value |= (((ACPI_INTEGER) Temp32) <<
- ACPI_MUL_4 (i));
+ ReturnDesc->Integer.Value |=
+ (((ACPI_INTEGER) Temp32) << ACPI_MUL_4 (i));
}
/* Overflow if there is any data left in Digit */
if (Digit > 0)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Integer too large to convert to BCD: %8.8X%8.8X\n",
+ ACPI_ERROR ((AE_INFO,
+ "Integer too large to convert to BCD: %8.8X%8.8X",
ACPI_FORMAT_UINT64 (Operand[0]->Integer.Value)));
Status = AE_AML_NUMERIC_OVERFLOW;
goto Cleanup;
@@ -657,8 +656,8 @@ AcpiExOpcode_1A_1T_1R (
/* These are two obsolete opcodes */
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "%s is obsolete and not implemented\n",
+ ACPI_ERROR ((AE_INFO,
+ "%s is obsolete and not implemented",
AcpiPsGetOpcodeName (WalkState->Opcode)));
Status = AE_SUPPORT;
goto Cleanup;
@@ -666,7 +665,7 @@ AcpiExOpcode_1A_1T_1R (
default: /* Unknown opcode */
- ACPI_REPORT_ERROR (("AcpiExOpcode_1A_1T_1R: Unknown opcode %X\n",
+ ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
@@ -682,11 +681,6 @@ AcpiExOpcode_1A_1T_1R (
Cleanup:
- if (!WalkState->ResultObj)
- {
- WalkState->ResultObj = ReturnDesc;
- }
-
/* Delete return object on error */
if (ACPI_FAILURE (Status))
@@ -694,6 +688,13 @@ Cleanup:
AcpiUtRemoveReference (ReturnDesc);
}
+ /* Save return object on success */
+
+ else if (!WalkState->ResultObj)
+ {
+ WalkState->ResultObj = ReturnDesc;
+ }
+
return_ACPI_STATUS (Status);
}
@@ -722,7 +723,7 @@ AcpiExOpcode_1A_0T_1R (
ACPI_INTEGER Value;
- ACPI_FUNCTION_TRACE_STR ("ExOpcode_1A_0T_1R",
+ ACPI_FUNCTION_TRACE_STR (ExOpcode_1A_0T_1R,
AcpiPsGetOpcodeName (WalkState->Opcode));
@@ -786,9 +787,9 @@ AcpiExOpcode_1A_0T_1R (
Status = AcpiExResolveOperands (AML_LNOT_OP, &TempDesc, WalkState);
if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s: bad operand(s) %s\n",
- AcpiPsGetOpcodeName (WalkState->Opcode),
- AcpiFormatException(Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "While resolving operands for [%s]",
+ AcpiPsGetOpcodeName (WalkState->Opcode)));
goto Cleanup;
}
@@ -834,6 +835,7 @@ AcpiExOpcode_1A_0T_1R (
{
goto Cleanup;
}
+
/* Allocate a descriptor to hold the type. */
ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
@@ -891,8 +893,8 @@ AcpiExOpcode_1A_0T_1R (
break;
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "SizeOf - Operand is not Buf/Int/Str/Pkg - found type %s\n",
+ ACPI_ERROR ((AE_INFO,
+ "Operand is not Buf/Int/Str/Pkg - found type %s",
AcpiUtGetTypeName (Type)));
Status = AE_AML_OPERAND_TYPE;
goto Cleanup;
@@ -927,7 +929,24 @@ AcpiExOpcode_1A_0T_1R (
/* Check for a method local or argument, or standalone String */
- if (ACPI_GET_DESCRIPTOR_TYPE (Operand[0]) != ACPI_DESC_TYPE_NAMED)
+ if (ACPI_GET_DESCRIPTOR_TYPE (Operand[0]) == ACPI_DESC_TYPE_NAMED)
+ {
+ 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)))
+ {
+ Operand[0] = TempDesc;
+ AcpiUtAddReference (TempDesc);
+ }
+ else
+ {
+ Status = AE_AML_OPERAND_TYPE;
+ goto Cleanup;
+ }
+ }
+ else
{
switch (ACPI_GET_OBJECT_TYPE (Operand[0]))
{
@@ -977,19 +996,29 @@ AcpiExOpcode_1A_0T_1R (
}
break;
-
case ACPI_TYPE_STRING:
+ break;
+ default:
+ Status = AE_AML_OPERAND_TYPE;
+ goto Cleanup;
+ }
+ }
+
+ if (ACPI_GET_DESCRIPTOR_TYPE (Operand[0]) != ACPI_DESC_TYPE_NAMED)
+ {
+ if (ACPI_GET_OBJECT_TYPE (Operand[0]) == ACPI_TYPE_STRING)
+ {
/*
- * This is a DerefOf (String). The string is a reference
+ * This is a DerefOf (String). The string is a reference
* to a named ACPI object.
*
* 1) Find the owning Node
- * 2) Dereference the node to an actual object. Could be a
+ * 2) Dereference the node to an actual object. Could be a
* Field, so we need to resolve the node to a value.
*/
- Status = AcpiNsGetNodeByPath (Operand[0]->String.Pointer,
- WalkState->ScopeInfo->Scope.Node,
+ Status = AcpiNsGetNode (WalkState->ScopeInfo->Scope.Node,
+ Operand[0]->String.Pointer,
ACPI_NS_SEARCH_PARENT,
ACPI_CAST_INDIRECT_PTR (
ACPI_NAMESPACE_NODE, &ReturnDesc));
@@ -999,15 +1028,9 @@ AcpiExOpcode_1A_0T_1R (
}
Status = AcpiExResolveNodeToValue (
- ACPI_CAST_INDIRECT_PTR (
- ACPI_NAMESPACE_NODE, &ReturnDesc),
- WalkState);
- goto Cleanup;
-
-
- default:
-
- Status = AE_AML_OPERAND_TYPE;
+ ACPI_CAST_INDIRECT_PTR (
+ ACPI_NAMESPACE_NODE, &ReturnDesc),
+ WalkState);
goto Cleanup;
}
}
@@ -1082,14 +1105,13 @@ AcpiExOpcode_1A_0T_1R (
{
AcpiUtAddReference (ReturnDesc);
}
-
break;
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Unknown Index TargetType %X in obj %p\n",
+ ACPI_ERROR ((AE_INFO,
+ "Unknown Index TargetType %X in obj %p",
Operand[0]->Reference.TargetType, Operand[0]));
Status = AE_AML_OPERAND_TYPE;
goto Cleanup;
@@ -1104,7 +1126,6 @@ AcpiExOpcode_1A_0T_1R (
if (ACPI_GET_DESCRIPTOR_TYPE (ReturnDesc) ==
ACPI_DESC_TYPE_NAMED)
{
-
ReturnDesc = AcpiNsGetAttachedObject (
(ACPI_NAMESPACE_NODE *) ReturnDesc);
}
@@ -1116,8 +1137,8 @@ AcpiExOpcode_1A_0T_1R (
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Unknown opcode in ref(%p) - %X\n",
+ ACPI_ERROR ((AE_INFO,
+ "Unknown opcode in reference(%p) - %X",
Operand[0], Operand[0]->Reference.Opcode));
Status = AE_TYPE;
@@ -1129,7 +1150,7 @@ AcpiExOpcode_1A_0T_1R (
default:
- ACPI_REPORT_ERROR (("AcpiExOpcode_1A_0T_1R: Unknown opcode %X\n",
+ ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
@@ -1145,7 +1166,13 @@ Cleanup:
AcpiUtRemoveReference (ReturnDesc);
}
- WalkState->ResultObj = ReturnDesc;
+ /* Save return object on success */
+
+ else
+ {
+ WalkState->ResultObj = ReturnDesc;
+ }
+
return_ACPI_STATUS (Status);
}
diff --git a/sys/contrib/dev/acpica/exoparg2.c b/sys/contrib/dev/acpica/exoparg2.c
index 880a45c..f7f05e4 100644
--- a/sys/contrib/dev/acpica/exoparg2.c
+++ b/sys/contrib/dev/acpica/exoparg2.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: exoparg2 - AML execution - opcodes with 2 arguments
- * $Revision: 1.134 $
+ * $Revision: 1.143 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -176,7 +176,7 @@ AcpiExOpcode_2A_0T_0R (
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE_STR ("ExOpcode_2A_0T_0R",
+ ACPI_FUNCTION_TRACE_STR (ExOpcode_2A_0T_0R,
AcpiPsGetOpcodeName (WalkState->Opcode));
@@ -198,9 +198,9 @@ AcpiExOpcode_2A_0T_0R (
if (!AcpiEvIsNotifyObject (Node))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Unexpected notify object type [%s]\n",
- AcpiUtGetTypeName (Node->Type)));
+ ACPI_ERROR ((AE_INFO,
+ "Unexpected notify object type [%s]",
+ AcpiUtGetTypeName (Node->Type)));
Status = AE_AML_OPERAND_TYPE;
break;
@@ -246,8 +246,8 @@ AcpiExOpcode_2A_0T_0R (
default:
- ACPI_REPORT_ERROR (("AcpiExOpcode_2A_0T_0R: Unknown opcode %X\n",
- WalkState->Opcode));
+ ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
+ WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
}
@@ -278,7 +278,7 @@ AcpiExOpcode_2A_2T_1R (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE_STR ("ExOpcode_2A_2T_1R",
+ ACPI_FUNCTION_TRACE_STR (ExOpcode_2A_2T_1R,
AcpiPsGetOpcodeName (WalkState->Opcode));
@@ -319,8 +319,8 @@ AcpiExOpcode_2A_2T_1R (
default:
- ACPI_REPORT_ERROR (("AcpiExOpcode_2A_2T_1R: Unknown opcode %X\n",
- WalkState->Opcode));
+ ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
+ WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
}
@@ -339,11 +339,6 @@ AcpiExOpcode_2A_2T_1R (
goto Cleanup;
}
- /* Return the remainder */
-
- WalkState->ResultObj = ReturnDesc1;
-
-
Cleanup:
/*
* Since the remainder is not returned indirectly, remove a reference to
@@ -358,6 +353,13 @@ Cleanup:
AcpiUtRemoveReference (ReturnDesc1);
}
+ /* Save return object (the remainder) on success */
+
+ else
+ {
+ WalkState->ResultObj = ReturnDesc1;
+ }
+
return_ACPI_STATUS (Status);
}
@@ -386,7 +388,7 @@ AcpiExOpcode_2A_1T_1R (
ACPI_SIZE Length;
- ACPI_FUNCTION_TRACE_STR ("ExOpcode_2A_1T_1R",
+ ACPI_FUNCTION_TRACE_STR (ExOpcode_2A_1T_1R,
AcpiPsGetOpcodeName (WalkState->Opcode));
@@ -459,11 +461,6 @@ AcpiExOpcode_2A_1T_1R (
(Operand[0]->Buffer.Pointer[Length]))
{
Length++;
- if (Length > ACPI_MAX_STRING_CONVERSION)
- {
- Status = AE_AML_STRING_LIMIT;
- goto Cleanup;
- }
}
/* Allocate a new string object */
@@ -475,8 +472,10 @@ AcpiExOpcode_2A_1T_1R (
goto Cleanup;
}
- /* Copy the raw buffer data with no transform. NULL terminated already*/
-
+ /*
+ * Copy the raw buffer data with no transform.
+ * (NULL terminated already)
+ */
ACPI_MEMCPY (ReturnDesc->String.Pointer,
Operand[0]->Buffer.Pointer, Length);
break;
@@ -502,56 +501,72 @@ AcpiExOpcode_2A_1T_1R (
goto Cleanup;
}
- Index = Operand[1]->Integer.Value;
+ /* Initialize the Index reference object */
- /* At this point, the Source operand is a Package, Buffer, or String */
+ Index = Operand[1]->Integer.Value;
+ ReturnDesc->Reference.Offset = (UINT32) Index;
+ ReturnDesc->Reference.Opcode = AML_INDEX_OP;
- if (ACPI_GET_OBJECT_TYPE (Operand[0]) == ACPI_TYPE_PACKAGE)
+ /*
+ * 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]))
{
- /* Object to be indexed is a Package */
+ case ACPI_TYPE_STRING:
- if (Index >= Operand[0]->Package.Count)
+ if (Index >= Operand[0]->String.Length)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Index value (%X%8.8X) beyond package end (%X)\n",
- ACPI_FORMAT_UINT64 (Index), Operand[0]->Package.Count));
- Status = AE_AML_PACKAGE_LIMIT;
- goto Cleanup;
+ Status = AE_AML_STRING_LIMIT;
}
- ReturnDesc->Reference.TargetType = ACPI_TYPE_PACKAGE;
- ReturnDesc->Reference.Object = Operand[0];
- ReturnDesc->Reference.Where = &Operand[0]->Package.Elements [
- Index];
- }
- else
- {
- /* Object to be indexed is a Buffer/String */
+ ReturnDesc->Reference.TargetType = ACPI_TYPE_BUFFER_FIELD;
+ break;
+
+ case ACPI_TYPE_BUFFER:
if (Index >= Operand[0]->Buffer.Length)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Index value (%X%8.8X) beyond end of buffer (%X)\n",
- ACPI_FORMAT_UINT64 (Index), Operand[0]->Buffer.Length));
Status = AE_AML_BUFFER_LIMIT;
- goto Cleanup;
}
ReturnDesc->Reference.TargetType = ACPI_TYPE_BUFFER_FIELD;
- ReturnDesc->Reference.Object = Operand[0];
+ break;
+
+ case ACPI_TYPE_PACKAGE:
+
+ if (Index >= Operand[0]->Package.Count)
+ {
+ Status = AE_AML_PACKAGE_LIMIT;
+ }
+
+ ReturnDesc->Reference.TargetType = ACPI_TYPE_PACKAGE;
+ ReturnDesc->Reference.Where = &Operand[0]->Package.Elements [Index];
+ break;
+
+ default:
+
+ Status = AE_AML_INTERNAL;
+ goto Cleanup;
+ }
+
+ /* Failure means that the Index was beyond the end of the object */
+
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Index (%X%8.8X) is beyond end of object",
+ ACPI_FORMAT_UINT64 (Index)));
+ goto Cleanup;
}
/*
- * Add a reference to the target package/buffer/string for the life
- * of the index.
+ * Save the target object and add a reference to it for the life
+ * of the index
*/
+ ReturnDesc->Reference.Object = Operand[0];
AcpiUtAddReference (Operand[0]);
- /* Complete the Index reference object */
-
- ReturnDesc->Reference.Opcode = AML_INDEX_OP;
- ReturnDesc->Reference.Offset = (UINT32) Index;
-
/* Store the reference to the Target */
Status = AcpiExStore (ReturnDesc, Operand[2], WalkState);
@@ -564,8 +579,8 @@ AcpiExOpcode_2A_1T_1R (
default:
- ACPI_REPORT_ERROR (("AcpiExOpcode_2A_1T_1R: Unknown opcode %X\n",
- WalkState->Opcode));
+ ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
+ WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
break;
}
@@ -599,6 +614,7 @@ Cleanup:
if (ACPI_FAILURE (Status))
{
AcpiUtRemoveReference (ReturnDesc);
+ WalkState->ResultObj = NULL;
}
return_ACPI_STATUS (Status);
@@ -627,7 +643,7 @@ AcpiExOpcode_2A_0T_1R (
BOOLEAN LogicalResult = FALSE;
- ACPI_FUNCTION_TRACE_STR ("ExOpcode_2A_0T_1R",
+ ACPI_FUNCTION_TRACE_STR (ExOpcode_2A_0T_1R,
AcpiPsGetOpcodeName (WalkState->Opcode));
@@ -686,7 +702,7 @@ AcpiExOpcode_2A_0T_1R (
default:
- ACPI_REPORT_ERROR (("AcpiExOpcode_2A_0T_1R: Unknown opcode %X\n",
+ ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
@@ -703,9 +719,6 @@ StoreLogicalResult:
ReturnDesc->Integer.Value = ACPI_INTEGER_MAX;
}
- WalkState->ResultObj = ReturnDesc;
-
-
Cleanup:
/* Delete return object on error */
@@ -715,6 +728,13 @@ Cleanup:
AcpiUtRemoveReference (ReturnDesc);
}
+ /* Save return object on success */
+
+ else
+ {
+ WalkState->ResultObj = ReturnDesc;
+ }
+
return_ACPI_STATUS (Status);
}
diff --git a/sys/contrib/dev/acpica/exoparg3.c b/sys/contrib/dev/acpica/exoparg3.c
index f1b9ea0..926e22a 100644
--- a/sys/contrib/dev/acpica/exoparg3.c
+++ b/sys/contrib/dev/acpica/exoparg3.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exoparg3 - AML execution - opcodes with 3 arguments
- * $Revision: 1.27 $
+ * $Revision: 1.35 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -172,7 +172,7 @@ AcpiExOpcode_3A_0T_0R (
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE_STR ("ExOpcode_3A_0T_0R",
+ ACPI_FUNCTION_TRACE_STR (ExOpcode_3A_0T_0R,
AcpiPsGetOpcodeName (WalkState->Opcode));
@@ -186,7 +186,7 @@ AcpiExOpcode_3A_0T_0R (
(UINT32) Operand[1]->Integer.Value,
(UINT32) Operand[2]->Integer.Value));
- Fatal = ACPI_MEM_ALLOCATE (sizeof (ACPI_SIGNAL_FATAL_INFO));
+ Fatal = ACPI_ALLOCATE (sizeof (ACPI_SIGNAL_FATAL_INFO));
if (Fatal)
{
Fatal->Type = (UINT32) Operand[0]->Integer.Value;
@@ -200,14 +200,14 @@ AcpiExOpcode_3A_0T_0R (
/* Might return while OS is shutting down, just continue */
- ACPI_MEM_FREE (Fatal);
+ ACPI_FREE (Fatal);
break;
default:
- ACPI_REPORT_ERROR (("AcpiExOpcode_3A_0T_0R: Unknown opcode %X\n",
- WalkState->Opcode));
+ ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
+ WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
}
@@ -243,7 +243,7 @@ AcpiExOpcode_3A_1T_1R (
ACPI_SIZE Length;
- ACPI_FUNCTION_TRACE_STR ("ExOpcode_3A_1T_1R",
+ ACPI_FUNCTION_TRACE_STR (ExOpcode_3A_1T_1R,
AcpiPsGetOpcodeName (WalkState->Opcode));
@@ -293,7 +293,7 @@ AcpiExOpcode_3A_1T_1R (
/* Always allocate a new buffer for the String */
- Buffer = ACPI_MEM_CALLOCATE ((ACPI_SIZE) Length + 1);
+ Buffer = ACPI_ALLOCATE_ZEROED ((ACPI_SIZE) Length + 1);
if (!Buffer)
{
Status = AE_NO_MEMORY;
@@ -309,7 +309,7 @@ AcpiExOpcode_3A_1T_1R (
{
/* Allocate a new buffer for the Buffer */
- Buffer = ACPI_MEM_CALLOCATE (Length);
+ Buffer = ACPI_ALLOCATE_ZEROED (Length);
if (!Buffer)
{
Status = AE_NO_MEMORY;
@@ -324,9 +324,9 @@ AcpiExOpcode_3A_1T_1R (
goto Cleanup;
}
- if (Length > 0)
+ if (Buffer)
{
- /* Copy the portion requested */
+ /* We have a buffer, copy the portion requested */
ACPI_MEMCPY (Buffer, Operand[0]->String.Pointer + Index,
Length);
@@ -345,8 +345,8 @@ AcpiExOpcode_3A_1T_1R (
default:
- ACPI_REPORT_ERROR (("AcpiExOpcode_3A_0T_0R: Unknown opcode %X\n",
- WalkState->Opcode));
+ ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
+ WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
}
@@ -362,6 +362,7 @@ Cleanup:
if (ACPI_FAILURE (Status) || WalkState->ResultObj)
{
AcpiUtRemoveReference (ReturnDesc);
+ WalkState->ResultObj = NULL;
}
/* Set the return object and exit */
diff --git a/sys/contrib/dev/acpica/exoparg6.c b/sys/contrib/dev/acpica/exoparg6.c
index 1104842..e144bcf 100644
--- a/sys/contrib/dev/acpica/exoparg6.c
+++ b/sys/contrib/dev/acpica/exoparg6.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exoparg6 - AML execution - opcodes with 6 arguments
- * $Revision: 1.23 $
+ * $Revision: 1.29 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -309,7 +309,7 @@ AcpiExOpcode_6A_0T_1R (
ACPI_OPERAND_OBJECT *ThisElement;
- ACPI_FUNCTION_TRACE_STR ("ExOpcode_6A_0T_1R",
+ ACPI_FUNCTION_TRACE_STR (ExOpcode_6A_0T_1R,
AcpiPsGetOpcodeName (WalkState->Opcode));
@@ -326,7 +326,7 @@ AcpiExOpcode_6A_0T_1R (
if ((Operand[1]->Integer.Value > MAX_MATCH_OPERATOR) ||
(Operand[3]->Integer.Value > MAX_MATCH_OPERATOR))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Match operator out of range\n"));
+ ACPI_ERROR ((AE_INFO, "Match operator out of range"));
Status = AE_AML_OPERAND_VALUE;
goto Cleanup;
}
@@ -336,8 +336,8 @@ AcpiExOpcode_6A_0T_1R (
Index = Operand[5]->Integer.Value;
if (Index >= Operand[0]->Package.Count)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Index (%X%8.8X) beyond package end (%X)\n",
+ ACPI_ERROR ((AE_INFO,
+ "Index (%X%8.8X) beyond package end (%X)",
ACPI_FORMAT_UINT64 (Index), Operand[0]->Package.Count));
Status = AE_AML_PACKAGE_LIMIT;
goto Cleanup;
@@ -414,14 +414,12 @@ AcpiExOpcode_6A_0T_1R (
default:
- ACPI_REPORT_ERROR (("AcpiExOpcode_6A_0T_1R: Unknown opcode %X\n",
- WalkState->Opcode));
+ ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
+ WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
}
- WalkState->ResultObj = ReturnDesc;
-
Cleanup:
@@ -432,5 +430,12 @@ Cleanup:
AcpiUtRemoveReference (ReturnDesc);
}
+ /* Save return object on success */
+
+ else
+ {
+ WalkState->ResultObj = ReturnDesc;
+ }
+
return_ACPI_STATUS (Status);
}
diff --git a/sys/contrib/dev/acpica/exprep.c b/sys/contrib/dev/acpica/exprep.c
index 217afe2..b67db31 100644
--- a/sys/contrib/dev/acpica/exprep.c
+++ b/sys/contrib/dev/acpica/exprep.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exprep - ACPI AML (p-code) execution - field prep utilities
- * $Revision: 1.135 $
+ * $Revision: 1.142 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -182,7 +182,7 @@ AcpiExGenerateAccess (
UINT32 Accesses;
- ACPI_FUNCTION_TRACE ("ExGenerateAccess");
+ ACPI_FUNCTION_TRACE (ExGenerateAccess);
/* Round Field start offset and length to "minimal" byte boundaries */
@@ -316,7 +316,7 @@ AcpiExDecodeFieldAccess (
UINT32 BitLength;
- ACPI_FUNCTION_TRACE ("ExDecodeFieldAccess");
+ ACPI_FUNCTION_TRACE (ExDecodeFieldAccess);
Access = (FieldFlags & AML_FIELD_ACCESS_TYPE_MASK);
@@ -361,8 +361,8 @@ AcpiExDecodeFieldAccess (
default:
/* Invalid field access type */
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Unknown field access type %X\n",
+ ACPI_ERROR ((AE_INFO,
+ "Unknown field access type %X",
Access));
return_UINT32 (0);
}
@@ -416,7 +416,7 @@ AcpiExPrepCommonFieldObject (
UINT32 NearestByteAddress;
- ACPI_FUNCTION_TRACE ("ExPrepCommonFieldObject");
+ ACPI_FUNCTION_TRACE (ExPrepCommonFieldObject);
/*
@@ -515,7 +515,7 @@ AcpiExPrepFieldValue (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("ExPrepFieldValue");
+ ACPI_FUNCTION_TRACE (ExPrepFieldValue);
/* Parameter validation */
@@ -524,15 +524,15 @@ AcpiExPrepFieldValue (
{
if (!Info->RegionNode)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null RegionNode\n"));
+ ACPI_ERROR ((AE_INFO, "Null RegionNode"));
return_ACPI_STATUS (AE_AML_NO_OPERAND);
}
Type = AcpiNsGetType (Info->RegionNode);
if (Type != ACPI_TYPE_REGION)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Needed Region, found type %X (%s)\n",
+ ACPI_ERROR ((AE_INFO,
+ "Needed Region, found type %X (%s)",
Type, AcpiUtGetTypeName (Type)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
@@ -602,17 +602,16 @@ AcpiExPrepFieldValue (
case ACPI_TYPE_LOCAL_INDEX_FIELD:
+ /* Get the Index and Data registers */
+
ObjDesc->IndexField.IndexObj = AcpiNsGetAttachedObject (
Info->RegisterNode);
ObjDesc->IndexField.DataObj = AcpiNsGetAttachedObject (
Info->DataRegisterNode);
- ObjDesc->IndexField.Value = (UINT32)
- (Info->FieldBitPosition / ACPI_MUL_8 (
- ObjDesc->Field.AccessByteWidth));
if (!ObjDesc->IndexField.DataObj || !ObjDesc->IndexField.IndexObj)
{
- ACPI_REPORT_ERROR (("Null Index Object during field prep\n"));
+ ACPI_ERROR ((AE_INFO, "Null Index Object during field prep"));
AcpiUtDeleteObjectDesc (ObjDesc);
return_ACPI_STATUS (AE_AML_INTERNAL);
}
@@ -622,6 +621,27 @@ AcpiExPrepFieldValue (
AcpiUtAddReference (ObjDesc->IndexField.DataObj);
AcpiUtAddReference (ObjDesc->IndexField.IndexObj);
+ /*
+ * April 2006: Changed to match MS behavior
+ *
+ * The value written to the Index register is the byte offset of the
+ * target field in units of the granularity of the IndexField
+ *
+ * Previously, the value was calculated as an index in terms of the
+ * width of the Data register, as below:
+ *
+ * ObjDesc->IndexField.Value = (UINT32)
+ * (Info->FieldBitPosition / ACPI_MUL_8 (
+ * ObjDesc->Field.AccessByteWidth));
+ *
+ * February 2006: Tried value as a byte offset:
+ * ObjDesc->IndexField.Value = (UINT32)
+ * ACPI_DIV_8 (Info->FieldBitPosition);
+ */
+ ObjDesc->IndexField.Value = (UINT32) ACPI_ROUND_DOWN (
+ ACPI_DIV_8 (Info->FieldBitPosition),
+ ObjDesc->IndexField.AccessByteWidth);
+
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"IndexField: BitOff %X, Off %X, Value %X, Gran %X, Index %p, Data %p\n",
ObjDesc->IndexField.StartFieldBitOffset,
diff --git a/sys/contrib/dev/acpica/exregion.c b/sys/contrib/dev/acpica/exregion.c
index 52546cc..184ef7d 100644
--- a/sys/contrib/dev/acpica/exregion.c
+++ b/sys/contrib/dev/acpica/exregion.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exregion - ACPI default OpRegion (address space) handlers
- * $Revision: 1.91 $
+ * $Revision: 1.101 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -162,7 +162,8 @@ AcpiExSystemMemorySpaceHandler (
UINT32 Remainder;
#endif
- ACPI_FUNCTION_TRACE ("ExSystemMemorySpaceHandler");
+
+ ACPI_FUNCTION_TRACE (ExSystemMemorySpaceHandler);
/* Validate and translate the bit width */
@@ -186,7 +187,7 @@ AcpiExSystemMemorySpaceHandler (
break;
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid SystemMemory width %d\n",
+ ACPI_ERROR ((AE_INFO, "Invalid SystemMemory width %d",
BitWidth));
return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
}
@@ -222,7 +223,7 @@ AcpiExSystemMemorySpaceHandler (
/* Valid mapping, delete it */
AcpiOsUnmapMemory (MemInfo->MappedLogicalAddress,
- MemInfo->MappedLength);
+ MemInfo->MappedLength);
}
/*
@@ -239,15 +240,14 @@ AcpiExSystemMemorySpaceHandler (
/* Create a new mapping starting at the address given */
- Status = AcpiOsMapMemory (Address, WindowSize,
- (void **) &MemInfo->MappedLogicalAddress);
- if (ACPI_FAILURE (Status))
+ MemInfo->MappedLogicalAddress = AcpiOsMapMemory ((ACPI_NATIVE_UINT) Address, WindowSize);
+ if (!MemInfo->MappedLogicalAddress)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Could not map memory at %8.8X%8.8X, size %X\n",
+ ACPI_ERROR ((AE_INFO,
+ "Could not map memory at %8.8X%8.8X, size %X",
ACPI_FORMAT_UINT64 (Address), (UINT32) WindowSize));
MemInfo->MappedLength = 0;
- return_ACPI_STATUS (Status);
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Save the physical address and mapping size */
@@ -261,22 +261,20 @@ AcpiExSystemMemorySpaceHandler (
* access
*/
LogicalAddrPtr = MemInfo->MappedLogicalAddress +
- ((ACPI_INTEGER) Address -
- (ACPI_INTEGER) MemInfo->MappedPhysicalAddress);
+ ((ACPI_INTEGER) Address - (ACPI_INTEGER) MemInfo->MappedPhysicalAddress);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "SystemMemory %d (%d width) Address=%8.8X%8.8X\n",
- Function, BitWidth,
- ACPI_FORMAT_UINT64 (Address)));
-
- /*
- * Perform the memory read or write
- *
- * Note: For machines that do not support non-aligned transfers, the target
- * address was checked for alignment above. We do not attempt to break the
- * transfer up into smaller (byte-size) chunks because the AML specifically
- * asked for a transfer width that the hardware may require.
- */
+ "System-Memory (width %d) R/W %d Address=%8.8X%8.8X\n",
+ BitWidth, Function, ACPI_FORMAT_UINT64 (Address)));
+
+ /*
+ * Perform the memory read or write
+ *
+ * Note: For machines that do not support non-aligned transfers, the target
+ * address was checked for alignment above. We do not attempt to break the
+ * transfer up into smaller (byte-size) chunks because the AML specifically
+ * asked for a transfer width that the hardware may require.
+ */
switch (Function)
{
case ACPI_READ:
@@ -285,22 +283,21 @@ AcpiExSystemMemorySpaceHandler (
switch (BitWidth)
{
case 8:
- *Value = (ACPI_INTEGER) *((UINT8 *) LogicalAddrPtr);
+ *Value = (ACPI_INTEGER) ACPI_GET8 (LogicalAddrPtr);
break;
case 16:
- *Value = (ACPI_INTEGER) *((UINT16 *) LogicalAddrPtr);
+ *Value = (ACPI_INTEGER) ACPI_GET16 (LogicalAddrPtr);
break;
case 32:
- *Value = (ACPI_INTEGER) *((UINT32 *) LogicalAddrPtr);
+ *Value = (ACPI_INTEGER) ACPI_GET32 (LogicalAddrPtr);
break;
-#if ACPI_MACHINE_WIDTH != 16
case 64:
- *Value = (ACPI_INTEGER) *((UINT64 *) LogicalAddrPtr);
+ *Value = (ACPI_INTEGER) ACPI_GET64 (LogicalAddrPtr);
break;
-#endif
+
default:
/* BitWidth was already validated */
break;
@@ -312,22 +309,20 @@ AcpiExSystemMemorySpaceHandler (
switch (BitWidth)
{
case 8:
- *(UINT8 *) LogicalAddrPtr = (UINT8) *Value;
+ ACPI_SET8 (LogicalAddrPtr) = (UINT8) *Value;
break;
case 16:
- *(UINT16 *) LogicalAddrPtr = (UINT16) *Value;
+ ACPI_SET16 (LogicalAddrPtr) = (UINT16) *Value;
break;
case 32:
- *(UINT32 *) LogicalAddrPtr = (UINT32) *Value;
+ ACPI_SET32 ( LogicalAddrPtr) = (UINT32) *Value;
break;
-#if ACPI_MACHINE_WIDTH != 16
case 64:
- *(UINT64 *) LogicalAddrPtr = (UINT64) *Value;
+ ACPI_SET64 (LogicalAddrPtr) = (UINT64) *Value;
break;
-#endif
default:
/* BitWidth was already validated */
@@ -375,12 +370,12 @@ AcpiExSystemIoSpaceHandler (
UINT32 Value32;
- ACPI_FUNCTION_TRACE ("ExSystemIoSpaceHandler");
+ ACPI_FUNCTION_TRACE (ExSystemIoSpaceHandler);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "SystemIO %d (%d width) Address=%8.8X%8.8X\n", Function, BitWidth,
- ACPI_FORMAT_UINT64 (Address)));
+ "System-IO (width %d) R/W %d Address=%8.8X%8.8X\n",
+ BitWidth, Function, ACPI_FORMAT_UINT64 (Address)));
/* Decode the function parameter */
@@ -440,7 +435,7 @@ AcpiExPciConfigSpaceHandler (
UINT16 PciRegister;
- ACPI_FUNCTION_TRACE ("ExPciConfigSpaceHandler");
+ ACPI_FUNCTION_TRACE (ExPciConfigSpaceHandler);
/*
@@ -459,7 +454,7 @@ AcpiExPciConfigSpaceHandler (
PciRegister = (UINT16) (UINT32) Address;
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "PciConfig %d (%d) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n",
+ "Pci-Config %d (%d) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n",
Function, BitWidth, PciId->Segment, PciId->Bus, PciId->Device,
PciId->Function, PciRegister));
@@ -518,7 +513,7 @@ AcpiExCmosSpaceHandler (
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE ("ExCmosSpaceHandler");
+ ACPI_FUNCTION_TRACE (ExCmosSpaceHandler);
return_ACPI_STATUS (Status);
@@ -555,7 +550,7 @@ AcpiExPciBarSpaceHandler (
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE ("ExPciBarSpaceHandler");
+ ACPI_FUNCTION_TRACE (ExPciBarSpaceHandler);
return_ACPI_STATUS (Status);
@@ -589,16 +584,8 @@ AcpiExDataTableSpaceHandler (
void *HandlerContext,
void *RegionContext)
{
- ACPI_STATUS Status = AE_OK;
- UINT32 ByteWidth = ACPI_DIV_8 (BitWidth);
- UINT32 i;
- char *LogicalAddrPtr;
-
-
- ACPI_FUNCTION_TRACE ("ExDataTableSpaceHandler");
-
+ ACPI_FUNCTION_TRACE (ExDataTableSpaceHandler);
- LogicalAddrPtr = ACPI_PHYSADDR_TO_PTR (Address);
/* Perform the memory read or write */
@@ -606,10 +593,8 @@ AcpiExDataTableSpaceHandler (
{
case ACPI_READ:
- for (i = 0; i < ByteWidth; i++)
- {
- ((char *) Value) [i] = LogicalAddrPtr[i];
- }
+ ACPI_MEMCPY (ACPI_CAST_PTR (char, Value), ACPI_PHYSADDR_TO_PTR (Address),
+ ACPI_DIV_8 (BitWidth));
break;
case ACPI_WRITE:
@@ -618,7 +603,7 @@ AcpiExDataTableSpaceHandler (
return_ACPI_STATUS (AE_SUPPORT);
}
- return_ACPI_STATUS (Status);
+ return_ACPI_STATUS (AE_OK);
}
diff --git a/sys/contrib/dev/acpica/exresnte.c b/sys/contrib/dev/acpica/exresnte.c
index d5ea4c6..f5f2e14 100644
--- a/sys/contrib/dev/acpica/exresnte.c
+++ b/sys/contrib/dev/acpica/exresnte.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exresnte - AML Interpreter object resolution
- * $Revision: 1.68 $
+ * $Revision: 1.75 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -168,7 +168,7 @@ AcpiExResolveNodeToValue (
ACPI_OBJECT_TYPE EntryType;
- ACPI_FUNCTION_TRACE ("ExResolveNodeToValue");
+ ACPI_FUNCTION_TRACE (ExResolveNodeToValue);
/*
@@ -195,10 +195,11 @@ AcpiExResolveNodeToValue (
/*
* Several object types require no further processing:
- * 1) Devices rarely have an attached object, return the Node
+ * 1) Device/Thermal objects don't have a "real" subobject, return the Node
* 2) Method locals and arguments have a pseudo-Node
*/
- if (EntryType == ACPI_TYPE_DEVICE ||
+ if ((EntryType == ACPI_TYPE_DEVICE) ||
+ (EntryType == ACPI_TYPE_THERMAL) ||
(Node->Flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL)))
{
return_ACPI_STATUS (AE_OK);
@@ -206,7 +207,7 @@ AcpiExResolveNodeToValue (
if (!SourceDesc)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object attached to node %p\n",
+ ACPI_ERROR ((AE_INFO, "No object attached to node %p",
Node));
return_ACPI_STATUS (AE_AML_NO_OPERAND);
}
@@ -221,7 +222,7 @@ AcpiExResolveNodeToValue (
if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_PACKAGE)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Package, type %s\n",
+ ACPI_ERROR ((AE_INFO, "Object not a Package, type %s",
AcpiUtGetObjectTypeName (SourceDesc)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
@@ -241,7 +242,7 @@ AcpiExResolveNodeToValue (
if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_BUFFER)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Buffer, type %s\n",
+ ACPI_ERROR ((AE_INFO, "Object not a Buffer, type %s",
AcpiUtGetObjectTypeName (SourceDesc)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
@@ -261,7 +262,7 @@ AcpiExResolveNodeToValue (
if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_STRING)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a String, type %s\n",
+ ACPI_ERROR ((AE_INFO, "Object not a String, type %s",
AcpiUtGetObjectTypeName (SourceDesc)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
@@ -277,7 +278,7 @@ AcpiExResolveNodeToValue (
if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_INTEGER)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Integer, type %s\n",
+ ACPI_ERROR ((AE_INFO, "Object not a Integer, type %s",
AcpiUtGetObjectTypeName (SourceDesc)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
@@ -307,7 +308,6 @@ AcpiExResolveNodeToValue (
case ACPI_TYPE_METHOD:
case ACPI_TYPE_POWER:
case ACPI_TYPE_PROCESSOR:
- case ACPI_TYPE_THERMAL:
case ACPI_TYPE_EVENT:
case ACPI_TYPE_REGION:
@@ -321,9 +321,8 @@ AcpiExResolveNodeToValue (
case ACPI_TYPE_ANY:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Untyped entry %p, no attached object!\n",
- Node));
+ ACPI_ERROR ((AE_INFO,
+ "Untyped entry %p, no attached object!", Node));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE); /* Cannot be AE_TYPE */
@@ -337,6 +336,8 @@ AcpiExResolveNodeToValue (
/* This is a DdbHandle */
/* Return an additional reference to the object */
+ case AML_REF_OF_OP:
+
ObjDesc = SourceDesc;
AcpiUtAddReference (ObjDesc);
break;
@@ -344,8 +345,8 @@ AcpiExResolveNodeToValue (
default:
/* No named references are allowed here */
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Unsupported Reference opcode %X (%s)\n",
+ ACPI_ERROR ((AE_INFO,
+ "Unsupported Reference opcode %X (%s)",
SourceDesc->Reference.Opcode,
AcpiPsGetOpcodeName (SourceDesc->Reference.Opcode)));
@@ -358,8 +359,8 @@ AcpiExResolveNodeToValue (
/* Default case is for unknown types */
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Node %p - Unknown object type %X\n",
+ ACPI_ERROR ((AE_INFO,
+ "Node %p - Unknown object type %X",
Node, EntryType));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
diff --git a/sys/contrib/dev/acpica/exresolv.c b/sys/contrib/dev/acpica/exresolv.c
index 630540c..b15e86b 100644
--- a/sys/contrib/dev/acpica/exresolv.c
+++ b/sys/contrib/dev/acpica/exresolv.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exresolv - AML Interpreter object resolution
- * $Revision: 1.132 $
+ * $Revision: 1.142 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -159,12 +159,12 @@ AcpiExResolveToValue (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE_PTR ("ExResolveToValue", StackPtr);
+ ACPI_FUNCTION_TRACE_PTR (ExResolveToValue, StackPtr);
if (!StackPtr || !*StackPtr)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null pointer\n"));
+ ACPI_ERROR ((AE_INFO, "Internal - null pointer"));
return_ACPI_STATUS (AE_AML_NO_OPERAND);
}
@@ -183,7 +183,7 @@ AcpiExResolveToValue (
if (!*StackPtr)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null pointer\n"));
+ ACPI_ERROR ((AE_INFO, "Internal - null pointer"));
return_ACPI_STATUS (AE_AML_NO_OPERAND);
}
}
@@ -229,12 +229,11 @@ AcpiExResolveObjectToValue (
{
ACPI_STATUS Status = AE_OK;
ACPI_OPERAND_OBJECT *StackDesc;
- void *TempNode;
- ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_OPERAND_OBJECT *ObjDesc = NULL;
UINT16 Opcode;
- ACPI_FUNCTION_TRACE ("ExResolveObjectToValue");
+ ACPI_FUNCTION_TRACE (ExResolveObjectToValue);
StackDesc = *StackPtr;
@@ -249,24 +248,6 @@ AcpiExResolveObjectToValue (
switch (Opcode)
{
- case AML_NAME_OP:
-
- /*
- * Convert name reference to a namespace node
- * Then, AcpiExResolveNodeToValue can be used to get the value
- */
- TempNode = StackDesc->Reference.Object;
-
- /* Delete the Reference Object */
-
- AcpiUtRemoveReference (StackDesc);
-
- /* Return the namespace node */
-
- (*StackPtr) = TempNode;
- break;
-
-
case AML_LOCAL_OP:
case AML_ARG_OP:
@@ -323,8 +304,8 @@ AcpiExResolveObjectToValue (
* A NULL object descriptor means an unitialized element of
* the package, can't dereference it
*/
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Attempt to deref an Index to NULL pkg element Idx=%p\n",
+ ACPI_ERROR ((AE_INFO,
+ "Attempt to deref an Index to NULL pkg element Idx=%p",
StackDesc));
Status = AE_AML_UNINITIALIZED_ELEMENT;
}
@@ -335,8 +316,8 @@ AcpiExResolveObjectToValue (
/* Invalid reference object */
- ACPI_REPORT_ERROR ((
- "During resolve, Unknown TargetType %X in Index/Reference obj %p\n",
+ ACPI_ERROR ((AE_INFO,
+ "Unknown TargetType %X in Index/Reference obj %p",
StackDesc->Reference.TargetType, StackDesc));
Status = AE_AML_INTERNAL;
break;
@@ -354,17 +335,30 @@ AcpiExResolveObjectToValue (
case AML_INT_NAMEPATH_OP: /* Reference to a named object */
- /* Get the object pointed to by the namespace node */
+ /* Dereference the name */
+
+ if ((StackDesc->Reference.Node->Type == ACPI_TYPE_DEVICE) ||
+ (StackDesc->Reference.Node->Type == ACPI_TYPE_THERMAL))
+ {
+ /* These node types do not have 'real' subobjects */
+
+ *StackPtr = (void *) StackDesc->Reference.Node;
+ }
+ else
+ {
+ /* Get the object pointed to by the namespace node */
+
+ *StackPtr = (StackDesc->Reference.Node)->Object;
+ AcpiUtAddReference (*StackPtr);
+ }
- *StackPtr = (StackDesc->Reference.Node)->Object;
- AcpiUtAddReference (*StackPtr);
AcpiUtRemoveReference (StackDesc);
break;
default:
- ACPI_REPORT_ERROR ((
- "During resolve, Unknown Reference opcode %X (%s) in %p\n",
+ ACPI_ERROR ((AE_INFO,
+ "Unknown Reference opcode %X (%s) in %p",
Opcode, AcpiPsGetOpcodeName (Opcode), StackDesc));
Status = AE_AML_INTERNAL;
break;
@@ -384,8 +378,6 @@ AcpiExResolveObjectToValue (
break;
- /* These cases may never happen here, but just in case.. */
-
case ACPI_TYPE_BUFFER_FIELD:
case ACPI_TYPE_LOCAL_REGION_FIELD:
case ACPI_TYPE_LOCAL_BANK_FIELD:
@@ -395,6 +387,10 @@ AcpiExResolveObjectToValue (
StackDesc, ACPI_GET_OBJECT_TYPE (StackDesc)));
Status = AcpiExReadDataFromField (WalkState, StackDesc, &ObjDesc);
+
+ /* Remove a reference to the original operand, then override */
+
+ AcpiUtRemoveReference (*StackPtr);
*StackPtr = (void *) ObjDesc;
break;
@@ -435,7 +431,7 @@ AcpiExResolveMultiple (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("AcpiExResolveMultiple");
+ ACPI_FUNCTION_TRACE (AcpiExResolveMultiple);
/* Operand can be either a namespace node or an operand descriptor */
@@ -481,17 +477,25 @@ AcpiExResolveMultiple (
switch (ObjDesc->Reference.Opcode)
{
case AML_REF_OF_OP:
+ case AML_INT_NAMEPATH_OP:
/* Dereference the reference pointer */
- Node = ObjDesc->Reference.Object;
+ if (ObjDesc->Reference.Opcode == AML_REF_OF_OP)
+ {
+ Node = ObjDesc->Reference.Object;
+ }
+ else /* AML_INT_NAMEPATH_OP */
+ {
+ Node = ObjDesc->Reference.Node;
+ }
/* All "References" point to a NS node */
if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED)
{
- ACPI_REPORT_ERROR ((
- "AcpiExResolveMultiple: Not a NS node %p [%s]\n",
+ ACPI_ERROR ((AE_INFO,
+ "Not a NS node %p [%s]",
Node, AcpiUtGetDescriptorName (Node)));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
@@ -544,42 +548,6 @@ AcpiExResolveMultiple (
break;
- case AML_INT_NAMEPATH_OP:
-
- /* Dereference the reference pointer */
-
- Node = ObjDesc->Reference.Node;
-
- /* All "References" point to a NS node */
-
- if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED)
- {
- ACPI_REPORT_ERROR ((
- "AcpiExResolveMultiple: Not a NS node %p [%s]\n",
- Node, AcpiUtGetDescriptorName (Node)));
- return_ACPI_STATUS (AE_AML_INTERNAL);
- }
-
- /* Get the attached object */
-
- ObjDesc = AcpiNsGetAttachedObject (Node);
- if (!ObjDesc)
- {
- /* No object, use the NS node type */
-
- Type = AcpiNsGetType (Node);
- goto Exit;
- }
-
- /* Check for circular references */
-
- if (ObjDesc == Operand)
- {
- return_ACPI_STATUS (AE_AML_CIRCULAR_REFERENCE);
- }
- break;
-
-
case AML_LOCAL_OP:
case AML_ARG_OP:
@@ -622,8 +590,8 @@ AcpiExResolveMultiple (
default:
- ACPI_REPORT_ERROR ((
- "AcpiExResolveMultiple: Unknown Reference subtype %X\n",
+ ACPI_ERROR ((AE_INFO,
+ "Unknown Reference subtype %X",
ObjDesc->Reference.Opcode));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
diff --git a/sys/contrib/dev/acpica/exresop.c b/sys/contrib/dev/acpica/exresop.c
index 505d2e1..5bbce15 100644
--- a/sys/contrib/dev/acpica/exresop.c
+++ b/sys/contrib/dev/acpica/exresop.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exresop - AML Interpreter operand/object resolution
- * $Revision: 1.86 $
+ * $Revision: 1.95 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -121,6 +121,7 @@
#include <contrib/dev/acpica/amlcode.h>
#include <contrib/dev/acpica/acparser.h>
#include <contrib/dev/acpica/acinterp.h>
+#include <contrib/dev/acpica/acnamesp.h>
#define _COMPONENT ACPI_EXECUTER
@@ -155,7 +156,7 @@ AcpiExCheckObjectType (
ACPI_OBJECT_TYPE ThisType,
void *Object)
{
- ACPI_FUNCTION_NAME ("ExCheckObjectType");
+ ACPI_FUNCTION_ENTRY ();
if (TypeNeeded == ACPI_TYPE_ANY)
@@ -181,8 +182,8 @@ AcpiExCheckObjectType (
if (TypeNeeded != ThisType)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Needed [%s], found [%s] %p\n",
+ ACPI_ERROR ((AE_INFO,
+ "Needed type [%s], found [%s] %p",
AcpiUtGetTypeName (TypeNeeded),
AcpiUtGetTypeName (ThisType), Object));
@@ -223,7 +224,6 @@ AcpiExResolveOperands (
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_STATUS Status = AE_OK;
UINT8 ObjectType;
- void *TempNode;
UINT32 ArgTypes;
const ACPI_OPCODE_INFO *OpInfo;
UINT32 ThisArgType;
@@ -231,7 +231,7 @@ AcpiExResolveOperands (
UINT16 TargetOp = 0;
- ACPI_FUNCTION_TRACE_U32 ("ExResolveOperands", Opcode);
+ ACPI_FUNCTION_TRACE_U32 (ExResolveOperands, Opcode);
OpInfo = AcpiPsGetOpcodeInfo (Opcode);
@@ -243,7 +243,7 @@ AcpiExResolveOperands (
ArgTypes = OpInfo->RuntimeArgs;
if (ArgTypes == ARGI_INVALID_OPCODE)
{
- ACPI_REPORT_ERROR (("ResolveOperands: %X is not a valid AML opcode\n",
+ ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
Opcode));
return_ACPI_STATUS (AE_AML_INTERNAL);
@@ -264,7 +264,7 @@ AcpiExResolveOperands (
{
if (!StackPtr || !*StackPtr)
{
- ACPI_REPORT_ERROR (("ResolveOperands: Null stack entry at %p\n",
+ ACPI_ERROR ((AE_INFO, "Null stack entry at %p",
StackPtr));
return_ACPI_STATUS (AE_AML_INTERNAL);
@@ -283,6 +283,18 @@ AcpiExResolveOperands (
/* Namespace Node */
ObjectType = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type;
+
+ /*
+ * Resolve an alias object. The construction of these objects
+ * guarantees that there is only one level of alias indirection;
+ * thus, the attached object is always the aliased namespace node
+ */
+ if (ObjectType == ACPI_TYPE_LOCAL_ALIAS)
+ {
+ ObjDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) ObjDesc);
+ *StackPtr = ObjDesc;
+ ObjectType = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type;
+ }
break;
@@ -296,8 +308,8 @@ AcpiExResolveOperands (
if (!AcpiUtValidObjectType (ObjectType))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Bad operand object type [%X]\n",
+ ACPI_ERROR ((AE_INFO,
+ "Bad operand object type [%X]",
ObjectType));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
@@ -320,7 +332,6 @@ AcpiExResolveOperands (
/*lint -fallthrough */
- case AML_NAME_OP:
case AML_INDEX_OP:
case AML_REF_OF_OP:
case AML_ARG_OP:
@@ -334,10 +345,9 @@ AcpiExResolveOperands (
break;
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Operand is a Reference, Unknown Reference Opcode %X [%s]\n",
- ObjDesc->Reference.Opcode,
- (AcpiPsGetOpcodeInfo (ObjDesc->Reference.Opcode))->Name));
+ ACPI_ERROR ((AE_INFO,
+ "Operand is a Reference, Unknown Reference Opcode: %X",
+ ObjDesc->Reference.Opcode));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
@@ -349,9 +359,9 @@ AcpiExResolveOperands (
/* Invalid descriptor */
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Invalid descriptor %p [%s]\n",
- ObjDesc, AcpiUtGetDescriptorName (ObjDesc)));
+ ACPI_ERROR ((AE_INFO,
+ "Invalid descriptor %p [%s]",
+ ObjDesc, AcpiUtGetDescriptorName (ObjDesc)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
@@ -408,15 +418,6 @@ AcpiExResolveOperands (
{
return_ACPI_STATUS (Status);
}
-
- if (ObjDesc->Reference.Opcode == AML_NAME_OP)
- {
- /* Convert a named reference to the actual named object */
-
- TempNode = ObjDesc->Reference.Object;
- AcpiUtRemoveReference (ObjDesc);
- (*StackPtr) = TempNode;
- }
goto NextOperand;
@@ -514,8 +515,8 @@ AcpiExResolveOperands (
{
if (Status == AE_TYPE)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Needed [Integer/String/Buffer], found [%s] %p\n",
+ ACPI_ERROR ((AE_INFO,
+ "Needed [Integer/String/Buffer], found [%s] %p",
AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
@@ -543,8 +544,8 @@ AcpiExResolveOperands (
{
if (Status == AE_TYPE)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Needed [Integer/String/Buffer], found [%s] %p\n",
+ ACPI_ERROR ((AE_INFO,
+ "Needed [Integer/String/Buffer], found [%s] %p",
AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
@@ -573,8 +574,8 @@ AcpiExResolveOperands (
{
if (Status == AE_TYPE)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Needed [Integer/String/Buffer], found [%s] %p\n",
+ ACPI_ERROR ((AE_INFO,
+ "Needed [Integer/String/Buffer], found [%s] %p",
AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
@@ -604,8 +605,8 @@ AcpiExResolveOperands (
break;
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Needed [Integer/String/Buffer], found [%s] %p\n",
+ ACPI_ERROR ((AE_INFO,
+ "Needed [Integer/String/Buffer], found [%s] %p",
AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
@@ -642,8 +643,8 @@ AcpiExResolveOperands (
break;
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Needed [Integer/String/Buffer], found [%s] %p\n",
+ ACPI_ERROR ((AE_INFO,
+ "Needed [Integer/String/Buffer], found [%s] %p",
AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
@@ -670,8 +671,8 @@ AcpiExResolveOperands (
break;
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Needed [Buffer/String/Package/Reference], found [%s] %p\n",
+ ACPI_ERROR ((AE_INFO,
+ "Needed [Buffer/String/Package/Reference], found [%s] %p",
AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
@@ -693,8 +694,8 @@ AcpiExResolveOperands (
break;
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Needed [Buffer/String/Package], found [%s] %p\n",
+ ACPI_ERROR ((AE_INFO,
+ "Needed [Buffer/String/Package], found [%s] %p",
AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
@@ -702,23 +703,21 @@ AcpiExResolveOperands (
goto NextOperand;
- case ARGI_REGION_OR_FIELD:
+ case ARGI_REGION_OR_BUFFER: /* Used by Load() only */
- /* Need an operand of type REGION or a FIELD in a region */
+ /* Need an operand of type REGION or a BUFFER (which could be a resolved region field) */
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
{
+ case ACPI_TYPE_BUFFER:
case ACPI_TYPE_REGION:
- case ACPI_TYPE_LOCAL_REGION_FIELD:
- case ACPI_TYPE_LOCAL_BANK_FIELD:
- case ACPI_TYPE_LOCAL_INDEX_FIELD:
/* Valid operand */
break;
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Needed [Region/RegionField], found [%s] %p\n",
+ ACPI_ERROR ((AE_INFO,
+ "Needed [Region/Buffer], found [%s] %p",
AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
@@ -765,8 +764,8 @@ AcpiExResolveOperands (
break;
}
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p\n",
+ ACPI_ERROR ((AE_INFO,
+ "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p",
AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
@@ -778,8 +777,8 @@ AcpiExResolveOperands (
/* Unknown type */
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Internal - Unknown ARGI (required operand) type %X\n",
+ ACPI_ERROR ((AE_INFO,
+ "Internal - Unknown ARGI (required operand) type %X",
ThisArgType));
return_ACPI_STATUS (AE_BAD_PARAMETER);
diff --git a/sys/contrib/dev/acpica/exstore.c b/sys/contrib/dev/acpica/exstore.c
index cb35b62..c4eb8915 100644
--- a/sys/contrib/dev/acpica/exstore.c
+++ b/sys/contrib/dev/acpica/exstore.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exstore - AML Interpreter object store support
- * $Revision: 1.196 $
+ * $Revision: 1.203 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -166,7 +166,7 @@ AcpiExDoDebugObject (
UINT32 i;
- ACPI_FUNCTION_TRACE_PTR ("ExDoDebugObject", SourceDesc);
+ ACPI_FUNCTION_TRACE_PTR (ExDoDebugObject, SourceDesc);
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s",
@@ -233,7 +233,7 @@ AcpiExDoDebugObject (
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]\n",
(UINT32) SourceDesc->Buffer.Length));
ACPI_DUMP_BUFFER (SourceDesc->Buffer.Pointer,
- (SourceDesc->Buffer.Length < 32) ? SourceDesc->Buffer.Length : 32);
+ (SourceDesc->Buffer.Length < 256) ? SourceDesc->Buffer.Length : 256);
break;
case ACPI_TYPE_STRING:
@@ -334,14 +334,14 @@ AcpiExStore (
ACPI_OPERAND_OBJECT *RefDesc = DestDesc;
- ACPI_FUNCTION_TRACE_PTR ("ExStore", DestDesc);
+ ACPI_FUNCTION_TRACE_PTR (ExStore, DestDesc);
/* Validate parameters */
if (!SourceDesc || !DestDesc)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null parameter\n"));
+ ACPI_ERROR ((AE_INFO, "Null parameter"));
return_ACPI_STATUS (AE_AML_NO_OPERAND);
}
@@ -382,8 +382,8 @@ AcpiExStore (
/* Destination is not a Reference object */
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Target is not a Reference or Constant object - %s [%p]\n",
+ ACPI_ERROR ((AE_INFO,
+ "Target is not a Reference or Constant object - %s [%p]",
AcpiUtGetObjectTypeName (DestDesc), DestDesc));
ACPI_DUMP_STACK_ENTRY (SourceDesc);
@@ -404,7 +404,6 @@ AcpiExStore (
*/
switch (RefDesc->Reference.Opcode)
{
- case AML_NAME_OP:
case AML_REF_OF_OP:
/* Storing an object into a Name "container" */
@@ -449,7 +448,7 @@ AcpiExStore (
default:
- ACPI_REPORT_ERROR (("ExStore: Unknown Reference opcode %X\n",
+ ACPI_ERROR ((AE_INFO, "Unknown Reference opcode %X",
RefDesc->Reference.Opcode));
ACPI_DUMP_ENTRY (RefDesc, ACPI_LV_ERROR);
@@ -488,7 +487,7 @@ AcpiExStoreObjectToIndex (
UINT32 i;
- ACPI_FUNCTION_TRACE ("ExStoreObjectToIndex");
+ ACPI_FUNCTION_TRACE (ExStoreObjectToIndex);
/*
@@ -591,8 +590,8 @@ AcpiExStoreObjectToIndex (
/* All other types are invalid */
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Source must be Integer/Buffer/String type, not %s\n",
+ ACPI_ERROR ((AE_INFO,
+ "Source must be Integer/Buffer/String type, not %s",
AcpiUtGetObjectTypeName (SourceDesc)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
@@ -604,8 +603,8 @@ AcpiExStoreObjectToIndex (
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Target is not a Package or BufferField\n"));
+ ACPI_ERROR ((AE_INFO,
+ "Target is not a Package or BufferField"));
Status = AE_AML_OPERAND_TYPE;
break;
}
@@ -653,7 +652,7 @@ AcpiExStoreObjectToNode (
ACPI_OBJECT_TYPE TargetType;
- ACPI_FUNCTION_TRACE_PTR ("ExStoreObjectToNode", SourceDesc);
+ ACPI_FUNCTION_TRACE_PTR (ExStoreObjectToNode, SourceDesc);
/* Get current type of the node, and object attached to Node */
diff --git a/sys/contrib/dev/acpica/exstoren.c b/sys/contrib/dev/acpica/exstoren.c
index 23054a0..1f87ab2 100644
--- a/sys/contrib/dev/acpica/exstoren.c
+++ b/sys/contrib/dev/acpica/exstoren.c
@@ -3,7 +3,7 @@
*
* Module Name: exstoren - AML Interpreter object store support,
* Store to Node (namespace object)
- * $Revision: 1.64 $
+ * $Revision: 1.71 $
*
*****************************************************************************/
@@ -11,7 +11,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -152,7 +152,7 @@ AcpiExResolveObject (
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE ("ExResolveObject");
+ ACPI_FUNCTION_TRACE (ExResolveObject);
/* Ensure we have a Target that can be stored to */
@@ -204,8 +204,8 @@ AcpiExResolveObject (
{
/* Conversion successful but still not a valid type */
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Cannot assign type %s to %s (must be type Int/Str/Buf)\n",
+ ACPI_ERROR ((AE_INFO,
+ "Cannot assign type %s to %s (must be type Int/Str/Buf)",
AcpiUtGetObjectTypeName (SourceDesc),
AcpiUtGetTypeName (TargetType)));
Status = AE_AML_OPERAND_TYPE;
@@ -216,9 +216,11 @@ AcpiExResolveObject (
case ACPI_TYPE_LOCAL_ALIAS:
case ACPI_TYPE_LOCAL_METHOD_ALIAS:
- /* Aliases are resolved by AcpiExPrepOperands */
-
- ACPI_REPORT_ERROR (("Store into Alias - should never happen\n"));
+ /*
+ * All aliases should have been resolved earlier, during the
+ * operand resolution phase.
+ */
+ ACPI_ERROR ((AE_INFO, "Store into an unresolved Alias object"));
Status = AE_AML_INTERNAL;
break;
@@ -283,7 +285,7 @@ AcpiExStoreObjectToObject (
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE_PTR ("ExStoreObjectToObject", SourceDesc);
+ ACPI_FUNCTION_TRACE_PTR (ExStoreObjectToObject, SourceDesc);
ActualSrcDesc = SourceDesc;
@@ -362,7 +364,7 @@ AcpiExStoreObjectToObject (
/*
* All other types come here.
*/
- ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Store into type %s not implemented\n",
+ ACPI_WARNING ((AE_INFO, "Store into type %s not implemented",
AcpiUtGetObjectTypeName (DestDesc)));
Status = AE_NOT_IMPLEMENTED;
diff --git a/sys/contrib/dev/acpica/exstorob.c b/sys/contrib/dev/acpica/exstorob.c
index 73e5db2..02daa39 100644
--- a/sys/contrib/dev/acpica/exstorob.c
+++ b/sys/contrib/dev/acpica/exstorob.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exstorob - AML Interpreter object store support, store to object
- * $Revision: 1.57 $
+ * $Revision: 1.62 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -147,12 +147,12 @@ AcpiExStoreBufferToBuffer (
UINT8 *Buffer;
- ACPI_FUNCTION_TRACE_PTR ("ExStoreBufferToBuffer", SourceDesc);
+ ACPI_FUNCTION_TRACE_PTR (ExStoreBufferToBuffer, SourceDesc);
/* We know that SourceDesc is a buffer by now */
- Buffer = (UINT8 *) SourceDesc->Buffer.Pointer;
+ Buffer = ACPI_CAST_PTR (UINT8, SourceDesc->Buffer.Pointer);
Length = SourceDesc->Buffer.Length;
/*
@@ -162,7 +162,7 @@ AcpiExStoreBufferToBuffer (
if ((TargetDesc->Buffer.Length == 0) ||
(TargetDesc->Common.Flags & AOPOBJ_STATIC_POINTER))
{
- TargetDesc->Buffer.Pointer = ACPI_MEM_ALLOCATE (Length);
+ TargetDesc->Buffer.Pointer = ACPI_ALLOCATE (Length);
if (!TargetDesc->Buffer.Pointer)
{
return_ACPI_STATUS (AE_NO_MEMORY);
@@ -245,12 +245,12 @@ AcpiExStoreStringToString (
UINT8 *Buffer;
- ACPI_FUNCTION_TRACE_PTR ("ExStoreStringToString", SourceDesc);
+ ACPI_FUNCTION_TRACE_PTR (ExStoreStringToString, SourceDesc);
/* We know that SourceDesc is a string by now */
- Buffer = (UINT8 *) SourceDesc->String.Pointer;
+ Buffer = ACPI_CAST_PTR (UINT8, SourceDesc->String.Pointer);
Length = SourceDesc->String.Length;
/*
@@ -279,10 +279,10 @@ AcpiExStoreStringToString (
{
/* Only free if not a pointer into the DSDT */
- ACPI_MEM_FREE (TargetDesc->String.Pointer);
+ ACPI_FREE (TargetDesc->String.Pointer);
}
- TargetDesc->String.Pointer = ACPI_MEM_CALLOCATE (
+ TargetDesc->String.Pointer = ACPI_ALLOCATE_ZEROED (
(ACPI_SIZE) Length + 1);
if (!TargetDesc->String.Pointer)
{
diff --git a/sys/contrib/dev/acpica/exsystem.c b/sys/contrib/dev/acpica/exsystem.c
index d28b257..81c92be 100644
--- a/sys/contrib/dev/acpica/exsystem.c
+++ b/sys/contrib/dev/acpica/exsystem.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exsystem - Interface to OS services
- * $Revision: 1.84 $
+ * $Revision: 1.93 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -136,23 +136,22 @@
*
* DESCRIPTION: Implements a semaphore wait with a check to see if the
* semaphore is available immediately. If it is not, the
- * interpreter is released.
+ * interpreter is released before waiting.
*
******************************************************************************/
ACPI_STATUS
AcpiExSystemWaitSemaphore (
- ACPI_HANDLE Semaphore,
+ ACPI_SEMAPHORE Semaphore,
UINT16 Timeout)
{
ACPI_STATUS Status;
- ACPI_STATUS Status2;
- ACPI_FUNCTION_TRACE ("ExSystemWaitSemaphore");
+ ACPI_FUNCTION_TRACE (ExSystemWaitSemaphore);
- Status = AcpiOsWaitSemaphore (Semaphore, 1, 0);
+ Status = AcpiOsWaitSemaphore (Semaphore, 1, ACPI_DO_NOT_WAIT);
if (ACPI_SUCCESS (Status))
{
return_ACPI_STATUS (Status);
@@ -162,7 +161,7 @@ AcpiExSystemWaitSemaphore (
{
/* We must wait, so unlock the interpreter */
- AcpiExExitInterpreter ();
+ AcpiExRelinquishInterpreter ();
Status = AcpiOsWaitSemaphore (Semaphore, 1, Timeout);
@@ -172,13 +171,60 @@ AcpiExSystemWaitSemaphore (
/* Reacquire the interpreter */
- Status2 = AcpiExEnterInterpreter ();
- if (ACPI_FAILURE (Status2))
- {
- /* Report fatal error, could not acquire interpreter */
+ AcpiExReacquireInterpreter ();
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExSystemWaitMutex
+ *
+ * PARAMETERS: Mutex - Mutex to wait on
+ * Timeout - Max time to wait
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Implements a mutex wait with a check to see if the
+ * mutex is available immediately. If it is not, the
+ * interpreter is released before waiting.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExSystemWaitMutex (
+ ACPI_MUTEX Mutex,
+ UINT16 Timeout)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE (ExSystemWaitMutex);
+
+
+ Status = AcpiOsAcquireMutex (Mutex, ACPI_DO_NOT_WAIT);
+ if (ACPI_SUCCESS (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ if (Status == AE_TIME)
+ {
+ /* We must wait, so unlock the interpreter */
+
+ AcpiExRelinquishInterpreter ();
+
+ Status = AcpiOsAcquireMutex (Mutex, Timeout);
- return_ACPI_STATUS (Status2);
- }
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "*** Thread awake after blocking, %s\n",
+ AcpiFormatException (Status)));
+
+ /* Reacquire the interpreter */
+
+ AcpiExReacquireInterpreter ();
}
return_ACPI_STATUS (Status);
@@ -220,7 +266,7 @@ AcpiExSystemDoStall (
* (ACPI specifies 100 usec as max, but this gives some slack in
* order to support existing BIOSs)
*/
- ACPI_REPORT_ERROR (("Stall: Time parameter is too large (%d)\n",
+ ACPI_ERROR ((AE_INFO, "Time parameter is too large (%d)",
HowLong));
Status = AE_AML_OPERAND_VALUE;
}
@@ -250,110 +296,19 @@ ACPI_STATUS
AcpiExSystemDoSuspend (
ACPI_INTEGER HowLong)
{
- ACPI_STATUS Status;
-
-
ACPI_FUNCTION_ENTRY ();
/* Since this thread will sleep, we must release the interpreter */
- AcpiExExitInterpreter ();
+ AcpiExRelinquishInterpreter ();
AcpiOsSleep (HowLong);
/* And now we must get the interpreter again */
- Status = AcpiExEnterInterpreter ();
- return (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiExSystemAcquireMutex
- *
- * PARAMETERS: TimeDesc - The 'time to delay' object descriptor
- * ObjDesc - The object descriptor for this op
- *
- * RETURN: Status
- *
- * DESCRIPTION: Provides an access point to perform synchronization operations
- * within the AML. This function will cause a lock to be generated
- * for the Mutex pointed to by ObjDesc.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiExSystemAcquireMutex (
- ACPI_OPERAND_OBJECT *TimeDesc,
- ACPI_OPERAND_OBJECT *ObjDesc)
-{
- ACPI_STATUS Status = AE_OK;
-
-
- ACPI_FUNCTION_TRACE_PTR ("ExSystemAcquireMutex", ObjDesc);
-
-
- if (!ObjDesc)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- /* Support for the _GL_ Mutex object -- go get the global lock */
-
- if (ObjDesc->Mutex.Semaphore == AcpiGbl_GlobalLockSemaphore)
- {
- Status = AcpiEvAcquireGlobalLock ((UINT16) TimeDesc->Integer.Value);
- return_ACPI_STATUS (Status);
- }
-
- Status = AcpiExSystemWaitSemaphore (ObjDesc->Mutex.Semaphore,
- (UINT16) TimeDesc->Integer.Value);
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiExSystemReleaseMutex
- *
- * PARAMETERS: ObjDesc - The object descriptor for this op
- *
- * RETURN: Status
- *
- * DESCRIPTION: Provides an access point to perform synchronization operations
- * within the AML. This operation is a request to release a
- * previously acquired Mutex. If the Mutex variable is set then
- * it will be decremented.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiExSystemReleaseMutex (
- ACPI_OPERAND_OBJECT *ObjDesc)
-{
- ACPI_STATUS Status = AE_OK;
-
-
- ACPI_FUNCTION_TRACE ("ExSystemReleaseMutex");
-
-
- if (!ObjDesc)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- /* Support for the _GL_ Mutex object -- release the global lock */
-
- if (ObjDesc->Mutex.Semaphore == AcpiGbl_GlobalLockSemaphore)
- {
- Status = AcpiEvReleaseGlobalLock ();
- return_ACPI_STATUS (Status);
- }
-
- Status = AcpiOsSignalSemaphore (ObjDesc->Mutex.Semaphore, 1);
- return_ACPI_STATUS (Status);
+ AcpiExReacquireInterpreter ();
+ return (AE_OK);
}
@@ -377,12 +332,12 @@ AcpiExSystemSignalEvent (
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE ("ExSystemSignalEvent");
+ ACPI_FUNCTION_TRACE (ExSystemSignalEvent);
if (ObjDesc)
{
- Status = AcpiOsSignalSemaphore (ObjDesc->Event.Semaphore, 1);
+ Status = AcpiOsSignalSemaphore (ObjDesc->Event.OsSemaphore, 1);
}
return_ACPI_STATUS (Status);
@@ -412,12 +367,12 @@ AcpiExSystemWaitEvent (
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE ("ExSystemWaitEvent");
+ ACPI_FUNCTION_TRACE (ExSystemWaitEvent);
if (ObjDesc)
{
- Status = AcpiExSystemWaitSemaphore (ObjDesc->Event.Semaphore,
+ Status = AcpiExSystemWaitSemaphore (ObjDesc->Event.OsSemaphore,
(UINT16) TimeDesc->Integer.Value);
}
@@ -442,7 +397,7 @@ AcpiExSystemResetEvent (
ACPI_OPERAND_OBJECT *ObjDesc)
{
ACPI_STATUS Status = AE_OK;
- void *TempSemaphore;
+ ACPI_SEMAPHORE TempSemaphore;
ACPI_FUNCTION_ENTRY ();
@@ -455,8 +410,8 @@ AcpiExSystemResetEvent (
Status = AcpiOsCreateSemaphore (ACPI_NO_UNIT_LIMIT, 0, &TempSemaphore);
if (ACPI_SUCCESS (Status))
{
- (void) AcpiOsDeleteSemaphore (ObjDesc->Event.Semaphore);
- ObjDesc->Event.Semaphore = TempSemaphore;
+ (void) AcpiOsDeleteSemaphore (ObjDesc->Event.OsSemaphore);
+ ObjDesc->Event.OsSemaphore = TempSemaphore;
}
return (Status);
diff --git a/sys/contrib/dev/acpica/exutils.c b/sys/contrib/dev/acpica/exutils.c
index f22f959..2ce75bb 100644
--- a/sys/contrib/dev/acpica/exutils.c
+++ b/sys/contrib/dev/acpica/exutils.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exutils - interpreter/scanner utilities
- * $Revision: 1.118 $
+ * $Revision: 1.129 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -156,51 +156,81 @@ AcpiExDigitsNeeded (
*
* PARAMETERS: None
*
- * RETURN: Status
+ * RETURN: None
*
- * DESCRIPTION: Enter the interpreter execution region. Failure to enter
- * the interpreter region is a fatal system error
+ * DESCRIPTION: Enter the interpreter execution region. Failure to enter
+ * the interpreter region is a fatal system error. Used in
+ * conjunction with ExitInterpreter.
*
******************************************************************************/
-ACPI_STATUS
+void
AcpiExEnterInterpreter (
void)
{
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("ExEnterInterpreter");
+
+ ACPI_FUNCTION_TRACE (ExEnterInterpreter);
- Status = AcpiUtAcquireMutex (ACPI_MTX_EXECUTE);
+ Status = AcpiUtAcquireMutex (ACPI_MTX_INTERPRETER);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR (("Could not acquire interpreter mutex\n"));
+ ACPI_ERROR ((AE_INFO, "Could not acquire AML Interpreter mutex"));
}
- return_ACPI_STATUS (Status);
+ return_VOID;
}
/*******************************************************************************
*
- * FUNCTION: AcpiExExitInterpreter
+ * FUNCTION: AcpiExReacquireInterpreter
*
* PARAMETERS: None
*
* RETURN: None
*
- * DESCRIPTION: Exit the interpreter execution region
+ * DESCRIPTION: Reacquire the interpreter execution region from within the
+ * interpreter code. Failure to enter the interpreter region is a
+ * fatal system error. Used in conjuction with
+ * RelinquishInterpreter
*
- * Cases where the interpreter is unlocked:
- * 1) Completion of the execution of a control method
- * 2) Method blocked on a Sleep() AML opcode
- * 3) Method blocked on an Acquire() AML opcode
- * 4) Method blocked on a Wait() AML opcode
- * 5) Method blocked to acquire the global lock
- * 6) Method blocked to execute a serialized control method that is
- * already executing
- * 7) About to invoke a user-installed opregion handler
+ ******************************************************************************/
+
+void
+AcpiExReacquireInterpreter (
+ void)
+{
+ ACPI_FUNCTION_TRACE (ExReacquireInterpreter);
+
+
+ /*
+ * If the global serialized flag is set, do not release the interpreter,
+ * since it was not actually released by AcpiExRelinquishInterpreter.
+ * This forces the interpreter to be single threaded.
+ */
+ if (!AcpiGbl_AllMethodsSerialized)
+ {
+ AcpiExEnterInterpreter ();
+ }
+
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExExitInterpreter
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Exit the interpreter execution region. This is the top level
+ * routine used to exit the interpreter when all processing has
+ * been completed.
*
******************************************************************************/
@@ -211,13 +241,56 @@ AcpiExExitInterpreter (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("ExExitInterpreter");
+ ACPI_FUNCTION_TRACE (ExExitInterpreter);
- Status = AcpiUtReleaseMutex (ACPI_MTX_EXECUTE);
+ Status = AcpiUtReleaseMutex (ACPI_MTX_INTERPRETER);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR (("Could not release interpreter mutex\n"));
+ ACPI_ERROR ((AE_INFO, "Could not release AML Interpreter mutex"));
+ }
+
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExRelinquishInterpreter
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Exit the interpreter execution region, from within the
+ * interpreter - before attempting an operation that will possibly
+ * block the running thread.
+ *
+ * Cases where the interpreter is unlocked internally
+ * 1) Method to be blocked on a Sleep() AML opcode
+ * 2) Method to be blocked on an Acquire() AML opcode
+ * 3) Method to be blocked on a Wait() AML opcode
+ * 4) Method to be blocked to acquire the global lock
+ * 5) Method to be blocked waiting to execute a serialized control method
+ * that is currently executing
+ * 6) About to invoke a user-installed opregion handler
+ *
+ ******************************************************************************/
+
+void
+AcpiExRelinquishInterpreter (
+ void)
+{
+ ACPI_FUNCTION_TRACE (ExRelinquishInterpreter);
+
+
+ /*
+ * If the global serialized flag is set, do not release the interpreter.
+ * This forces the interpreter to be single threaded.
+ */
+ if (!AcpiGbl_AllMethodsSerialized)
+ {
+ AcpiExExitInterpreter ();
}
return_VOID;
@@ -232,8 +305,8 @@ AcpiExExitInterpreter (
*
* RETURN: none
*
- * DESCRIPTION: Truncate a number to 32-bits if the currently executing method
- * belongs to a 32-bit ACPI table.
+ * DESCRIPTION: Truncate an ACPI Integer to 32 bits if the execution mode is
+ * 32-bit, as determined by the revision of the DSDT.
*
******************************************************************************/
@@ -247,9 +320,10 @@ AcpiExTruncateFor32bitTable (
/*
* Object must be a valid number and we must be executing
- * a control method
+ * a control method. NS node could be there for AML_INT_NAMEPATH_OP.
*/
if ((!ObjDesc) ||
+ (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND) ||
(ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_INTEGER))
{
return;
@@ -273,45 +347,42 @@ AcpiExTruncateFor32bitTable (
* PARAMETERS: FieldFlags - Flags with Lock rule:
* AlwaysLock or NeverLock
*
- * RETURN: TRUE/FALSE indicating whether the lock was actually acquired
+ * RETURN: None
*
- * DESCRIPTION: Obtain the global lock and keep track of this fact via two
- * methods. A global variable keeps the state of the lock, and
- * the state is returned to the caller.
+ * DESCRIPTION: Obtain the ACPI hardware Global Lock, only if the field
+ * flags specifiy that it is to be obtained before field access.
*
******************************************************************************/
-BOOLEAN
+void
AcpiExAcquireGlobalLock (
UINT32 FieldFlags)
{
- BOOLEAN Locked = FALSE;
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("ExAcquireGlobalLock");
+ ACPI_FUNCTION_TRACE (ExAcquireGlobalLock);
- /* Only attempt lock if the AlwaysLock bit is set */
+ /* Only use the lock if the AlwaysLock bit is set */
- if (FieldFlags & AML_FIELD_LOCK_RULE_MASK)
+ if (!(FieldFlags & AML_FIELD_LOCK_RULE_MASK))
+ {
+ return_VOID;
+ }
+
+ /* Attempt to get the global lock, wait forever */
+
+ Status = AcpiExAcquireMutexObject (ACPI_WAIT_FOREVER,
+ AcpiGbl_GlobalLockMutex, AcpiOsGetThreadId ());
+
+ if (ACPI_FAILURE (Status))
{
- /* We should attempt to get the lock, wait forever */
-
- Status = AcpiEvAcquireGlobalLock (ACPI_WAIT_FOREVER);
- if (ACPI_SUCCESS (Status))
- {
- Locked = TRUE;
- }
- else
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Could not acquire Global Lock, %s\n",
- AcpiFormatException (Status)));
- }
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Could not acquire Global Lock"));
}
- return_UINT8 (Locked);
+ return_VOID;
}
@@ -319,39 +390,41 @@ AcpiExAcquireGlobalLock (
*
* FUNCTION: AcpiExReleaseGlobalLock
*
- * PARAMETERS: LockedByMe - Return value from corresponding call to
- * AcquireGlobalLock.
+ * PARAMETERS: FieldFlags - Flags with Lock rule:
+ * AlwaysLock or NeverLock
*
* RETURN: None
*
- * DESCRIPTION: Release the global lock if it is locked.
+ * DESCRIPTION: Release the ACPI hardware Global Lock
*
******************************************************************************/
void
AcpiExReleaseGlobalLock (
- BOOLEAN LockedByMe)
+ UINT32 FieldFlags)
{
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("ExReleaseGlobalLock");
+ ACPI_FUNCTION_TRACE (ExReleaseGlobalLock);
- /* Only attempt unlock if the caller locked it */
+ /* Only use the lock if the AlwaysLock bit is set */
- if (LockedByMe)
+ if (!(FieldFlags & AML_FIELD_LOCK_RULE_MASK))
{
- /* OK, now release the lock */
+ return_VOID;
+ }
+
+ /* Release the global lock */
- Status = AcpiEvReleaseGlobalLock ();
- if (ACPI_FAILURE (Status))
- {
- /* Report the error, but there isn't much else we can do */
+ Status = AcpiExReleaseMutexObject (AcpiGbl_GlobalLockMutex);
+ if (ACPI_FAILURE (Status))
+ {
+ /* Report the error, but there isn't much else we can do */
- ACPI_REPORT_ERROR (("Could not release ACPI Global Lock, %s\n",
- AcpiFormatException (Status)));
- }
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Could not release Global Lock"));
}
return_VOID;
@@ -381,7 +454,7 @@ AcpiExDigitsNeeded (
ACPI_INTEGER CurrentValue;
- ACPI_FUNCTION_TRACE ("ExDigitsNeeded");
+ ACPI_FUNCTION_TRACE (ExDigitsNeeded);
/* ACPI_INTEGER is unsigned, so we don't worry about a '-' prefix */
diff --git a/sys/contrib/dev/acpica/hwacpi.c b/sys/contrib/dev/acpica/hwacpi.c
index 940a045..3c9bce9 100644
--- a/sys/contrib/dev/acpica/hwacpi.c
+++ b/sys/contrib/dev/acpica/hwacpi.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: hwacpi - ACPI Hardware Initialization/Mode Interface
- * $Revision: 1.70 $
+ * $Revision: 1.78 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -126,50 +126,6 @@
/******************************************************************************
*
- * FUNCTION: AcpiHwInitialize
- *
- * PARAMETERS: None
- *
- * RETURN: Status
- *
- * DESCRIPTION: Initialize and validate the various ACPI registers defined in
- * the FADT.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiHwInitialize (
- void)
-{
- ACPI_STATUS Status;
-
-
- ACPI_FUNCTION_TRACE ("HwInitialize");
-
-
- /* We must have the ACPI tables by the time we get here */
-
- if (!AcpiGbl_FADT)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No FADT is present\n"));
-
- return_ACPI_STATUS (AE_NO_ACPI_TABLES);
- }
-
- /* Sanity check the FADT for valid values */
-
- Status = AcpiUtValidateFadt ();
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- return_ACPI_STATUS (AE_OK);
-}
-
-
-/******************************************************************************
- *
* FUNCTION: AcpiHwSetMode
*
* PARAMETERS: Mode - SYS_MODE_ACPI or SYS_MODE_LEGACY
@@ -189,15 +145,15 @@ AcpiHwSetMode (
UINT32 Retry;
- ACPI_FUNCTION_TRACE ("HwSetMode");
+ ACPI_FUNCTION_TRACE (HwSetMode);
/*
* ACPI 2.0 clarified that if SMI_CMD in FADT is zero,
* system does not support mode transition.
*/
- if (!AcpiGbl_FADT->SmiCmd)
+ if (!AcpiGbl_FADT.SmiCommand)
{
- ACPI_REPORT_ERROR (("No SMI_CMD in FADT, mode transition failed.\n"));
+ ACPI_ERROR ((AE_INFO, "No SMI_CMD in FADT, mode transition failed"));
return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
}
@@ -208,10 +164,10 @@ AcpiHwSetMode (
* we make sure both the numbers are zero to determine these
* transitions are not supported.
*/
- if (!AcpiGbl_FADT->AcpiEnable && !AcpiGbl_FADT->AcpiDisable)
+ if (!AcpiGbl_FADT.AcpiEnable && !AcpiGbl_FADT.AcpiDisable)
{
- ACPI_REPORT_ERROR ((
- "No ACPI mode transition supported in this system (enable/disable both zero)\n"));
+ ACPI_ERROR ((AE_INFO,
+ "No ACPI mode transition supported in this system (enable/disable both zero)"));
return_ACPI_STATUS (AE_OK);
}
@@ -221,8 +177,8 @@ AcpiHwSetMode (
/* BIOS should have disabled ALL fixed and GP events */
- Status = AcpiOsWritePort (AcpiGbl_FADT->SmiCmd,
- (UINT32) AcpiGbl_FADT->AcpiEnable, 8);
+ Status = AcpiOsWritePort (AcpiGbl_FADT.SmiCommand,
+ (UINT32) AcpiGbl_FADT.AcpiEnable, 8);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Attempting to enable ACPI mode\n"));
break;
@@ -232,8 +188,8 @@ AcpiHwSetMode (
* BIOS should clear all fixed status bits and restore fixed event
* enable bits to default
*/
- Status = AcpiOsWritePort (AcpiGbl_FADT->SmiCmd,
- (UINT32) AcpiGbl_FADT->AcpiDisable, 8);
+ Status = AcpiOsWritePort (AcpiGbl_FADT.SmiCommand,
+ (UINT32) AcpiGbl_FADT.AcpiDisable, 8);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Attempting to enable Legacy (non-ACPI) mode\n"));
break;
@@ -244,8 +200,8 @@ AcpiHwSetMode (
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR (("Could not write mode change, %s\n",
- AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Could not write ACPI mode change"));
return_ACPI_STATUS (Status);
}
@@ -266,7 +222,7 @@ AcpiHwSetMode (
Retry--;
}
- ACPI_REPORT_ERROR (("Hardware never changed modes\n"));
+ ACPI_ERROR ((AE_INFO, "Hardware did not change modes"));
return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
}
@@ -292,19 +248,19 @@ AcpiHwGetMode (
UINT32 Value;
- ACPI_FUNCTION_TRACE ("HwGetMode");
+ ACPI_FUNCTION_TRACE (HwGetMode);
/*
* ACPI 2.0 clarified that if SMI_CMD in FADT is zero,
* system does not support mode transition.
*/
- if (!AcpiGbl_FADT->SmiCmd)
+ if (!AcpiGbl_FADT.SmiCommand)
{
return_UINT32 (ACPI_SYS_MODE_ACPI);
}
- Status = AcpiGetRegister (ACPI_BITREG_SCI_ENABLE, &Value, ACPI_MTX_LOCK);
+ Status = AcpiGetRegister (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/hwgpe.c
index 591c524..d7498e5 100644
--- a/sys/contrib/dev/acpica/hwgpe.c
+++ b/sys/contrib/dev/acpica/hwgpe.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: hwgpe - Low level GPE enable/disable/clear functions
- * $Revision: 1.71 $
+ * $Revision: 1.75 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -188,16 +188,20 @@ AcpiHwClearGpe (
ACPI_GPE_EVENT_INFO *GpeEventInfo)
{
ACPI_STATUS Status;
+ UINT8 RegisterBit;
ACPI_FUNCTION_ENTRY ();
+ 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, GpeEventInfo->RegisterBit,
+ Status = AcpiHwLowLevelWrite (8, RegisterBit,
&GpeEventInfo->RegisterInfo->StatusAddress);
return (Status);
@@ -243,7 +247,8 @@ AcpiHwGetGpeStatus (
/* Get the register bitmask for this GPE */
- RegisterBit = GpeEventInfo->RegisterBit;
+ RegisterBit = (UINT8)
+ (1 << (GpeEventInfo->GpeNumber - GpeEventInfo->RegisterInfo->BaseGpeNumber));
/* GPE currently enabled? (enabled for runtime?) */
@@ -476,7 +481,7 @@ AcpiHwDisableAllGpes (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("HwDisableAllGpes");
+ ACPI_FUNCTION_TRACE (HwDisableAllGpes);
Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock);
@@ -504,7 +509,7 @@ AcpiHwEnableAllRuntimeGpes (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("HwEnableAllRuntimeGpes");
+ ACPI_FUNCTION_TRACE (HwEnableAllRuntimeGpes);
Status = AcpiEvWalkGpeList (AcpiHwEnableRuntimeGpeBlock);
@@ -531,7 +536,7 @@ AcpiHwEnableAllWakeupGpes (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("HwEnableAllWakeupGpes");
+ ACPI_FUNCTION_TRACE (HwEnableAllWakeupGpes);
Status = AcpiEvWalkGpeList (AcpiHwEnableWakeupGpeBlock);
diff --git a/sys/contrib/dev/acpica/hwregs.c b/sys/contrib/dev/acpica/hwregs.c
index 8cb5fc3..36cc47b 100644
--- a/sys/contrib/dev/acpica/hwregs.c
+++ b/sys/contrib/dev/acpica/hwregs.c
@@ -3,7 +3,7 @@
*
* Module Name: hwregs - Read/write access functions for the various ACPI
* control and status registers.
- * $Revision: 1.172 $
+ * $Revision: 1.187 $
*
******************************************************************************/
@@ -11,7 +11,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -130,9 +130,9 @@
*
* FUNCTION: AcpiHwClearAcpiStatus
*
- * PARAMETERS: Flags - Lock the hardware or not
+ * PARAMETERS: None
*
- * RETURN: none
+ * RETURN: None
*
* DESCRIPTION: Clears all fixed and general purpose status bits
* THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED
@@ -141,26 +141,20 @@
ACPI_STATUS
AcpiHwClearAcpiStatus (
- UINT32 Flags)
+ void)
{
ACPI_STATUS Status;
+ ACPI_CPU_FLAGS LockFlags = 0;
- ACPI_FUNCTION_TRACE ("HwClearAcpiStatus");
+ ACPI_FUNCTION_TRACE (HwClearAcpiStatus);
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %04X to %04X\n",
ACPI_BITMASK_ALL_FIXED_STATUS,
- (UINT16) ACPI_GET_ADDRESS (AcpiGbl_FADT->XPm1aEvtBlk.Address)));
+ (UINT16) AcpiGbl_FADT.XPm1aEventBlock.Address));
- if (Flags & ACPI_MTX_LOCK)
- {
- Status = AcpiUtAcquireMutex (ACPI_MTX_HARDWARE);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
- }
+ LockFlags = AcpiOsAcquireLock (AcpiGbl_HardwareLock);
Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK,
ACPI_REGISTER_PM1_STATUS,
@@ -172,10 +166,10 @@ AcpiHwClearAcpiStatus (
/* Clear the fixed events */
- if (ACPI_VALID_ADDRESS (AcpiGbl_FADT->XPm1bEvtBlk.Address))
+ if (AcpiGbl_FADT.XPm1bEventBlock.Address)
{
Status = AcpiHwLowLevelWrite (16, ACPI_BITMASK_ALL_FIXED_STATUS,
- &AcpiGbl_FADT->XPm1bEvtBlk);
+ &AcpiGbl_FADT.XPm1bEventBlock);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
@@ -187,10 +181,7 @@ AcpiHwClearAcpiStatus (
Status = AcpiEvWalkGpeList (AcpiHwClearGpeBlock);
UnlockAndExit:
- if (Flags & ACPI_MTX_LOCK)
- {
- (void) AcpiUtReleaseMutex (ACPI_MTX_HARDWARE);
- }
+ AcpiOsReleaseLock (AcpiGbl_HardwareLock, LockFlags);
return_ACPI_STATUS (Status);
}
@@ -217,11 +208,10 @@ AcpiGetSleepTypeData (
UINT8 *SleepTypeB)
{
ACPI_STATUS Status = AE_OK;
- ACPI_PARAMETER_INFO Info;
- char *SleepStateName;
+ ACPI_EVALUATE_INFO *Info;
- ACPI_FUNCTION_TRACE ("AcpiGetSleepTypeData");
+ ACPI_FUNCTION_TRACE (AcpiGetSleepTypeData);
/* Validate parameters */
@@ -232,64 +222,70 @@ AcpiGetSleepTypeData (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- /* Evaluate the namespace object containing the values for this state */
+ /* Allocate the evaluation information block */
+
+ Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO));
+ if (!Info)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
- Info.Parameters = NULL;
- Info.ReturnObject = NULL;
- SleepStateName = (char *) AcpiGbl_SleepStateNames[SleepState];
+ Info->Pathname = ACPI_CAST_PTR (char, AcpiGbl_SleepStateNames[SleepState]);
- Status = AcpiNsEvaluateByName (SleepStateName, &Info);
+ /* 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), SleepStateName));
+ AcpiFormatException (Status), Info->Pathname));
- return_ACPI_STATUS (Status);
+ goto Cleanup;
}
/* Must have a return object */
- if (!Info.ReturnObject)
+ if (!Info->ReturnObject)
{
- ACPI_REPORT_ERROR (("No Sleep State object returned from [%s]\n",
- SleepStateName));
+ 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)
+ else if (ACPI_GET_OBJECT_TYPE (Info->ReturnObject) != ACPI_TYPE_PACKAGE)
{
- ACPI_REPORT_ERROR (("Sleep State return object is not a Package\n"));
+ 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
+ * 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
+ * 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)
+ else if (Info->ReturnObject->Package.Count < 2)
{
- ACPI_REPORT_ERROR ((
- "Sleep State return package does not have at least two elements\n"));
+ 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])
+ else if ((ACPI_GET_OBJECT_TYPE (Info->ReturnObject->Package.Elements[0])
!= ACPI_TYPE_INTEGER) ||
- (ACPI_GET_OBJECT_TYPE (Info.ReturnObject->Package.Elements[1])
+ (ACPI_GET_OBJECT_TYPE (Info->ReturnObject->Package.Elements[1])
!= ACPI_TYPE_INTEGER))
{
- ACPI_REPORT_ERROR ((
- "Sleep State return package elements are not both Integers (%s, %s)\n",
- AcpiUtGetObjectTypeName (Info.ReturnObject->Package.Elements[0]),
- AcpiUtGetObjectTypeName (Info.ReturnObject->Package.Elements[1])));
+ 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
@@ -297,24 +293,28 @@ AcpiGetSleepTypeData (
/* Valid _Sx_ package size, type, and value */
*SleepTypeA = (UINT8)
- (Info.ReturnObject->Package.Elements[0])->Integer.Value;
+ (Info->ReturnObject->Package.Elements[0])->Integer.Value;
*SleepTypeB = (UINT8)
- (Info.ReturnObject->Package.Elements[1])->Integer.Value;
+ (Info->ReturnObject->Package.Elements[1])->Integer.Value;
}
if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "%s While evaluating SleepState [%s], bad Sleep object %p type %s\n",
- AcpiFormatException (Status),
- SleepStateName, Info.ReturnObject,
- AcpiUtGetObjectTypeName (Info.ReturnObject)));
+ 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);
+ AcpiUtRemoveReference (Info->ReturnObject);
+
+Cleanup:
+ ACPI_FREE (Info);
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiGetSleepTypeData)
+
/*******************************************************************************
*
@@ -332,12 +332,12 @@ ACPI_BIT_REGISTER_INFO *
AcpiHwGetBitRegisterInfo (
UINT32 RegisterId)
{
- ACPI_FUNCTION_NAME ("HwGetBitRegisterInfo");
+ ACPI_FUNCTION_ENTRY ();
if (RegisterId > ACPI_BITREG_MAX)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid BitRegister ID: %X\n", RegisterId));
+ ACPI_ERROR ((AE_INFO, "Invalid BitRegister ID: %X", RegisterId));
return (NULL);
}
@@ -351,9 +351,8 @@ AcpiHwGetBitRegisterInfo (
*
* PARAMETERS: RegisterId - ID of ACPI BitRegister to access
* ReturnValue - Value that was read from the register
- * Flags - Lock the hardware or not
*
- * RETURN: Status and the value read from specified Register. Value
+ * 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.
@@ -363,15 +362,14 @@ AcpiHwGetBitRegisterInfo (
ACPI_STATUS
AcpiGetRegister (
UINT32 RegisterId,
- UINT32 *ReturnValue,
- UINT32 Flags)
+ UINT32 *ReturnValue)
{
UINT32 RegisterValue = 0;
ACPI_BIT_REGISTER_INFO *BitRegInfo;
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("AcpiGetRegister");
+ ACPI_FUNCTION_TRACE (AcpiGetRegister);
/* Get the info structure corresponding to the requested ACPI Register */
@@ -382,24 +380,10 @@ AcpiGetRegister (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- if (Flags & ACPI_MTX_LOCK)
- {
- Status = AcpiUtAcquireMutex (ACPI_MTX_HARDWARE);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
- }
-
/* Read from the register */
- Status = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK,
- BitRegInfo->ParentRegister, &RegisterValue);
-
- if (Flags & ACPI_MTX_LOCK)
- {
- (void) AcpiUtReleaseMutex (ACPI_MTX_HARDWARE);
- }
+ Status = AcpiHwRegisterRead (ACPI_MTX_LOCK,
+ BitRegInfo->ParentRegister, &RegisterValue);
if (ACPI_SUCCESS (Status))
{
@@ -411,12 +395,14 @@ AcpiGetRegister (
*ReturnValue = RegisterValue;
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Read value %8.8X register %X\n",
- RegisterValue, BitRegInfo->ParentRegister));
+ RegisterValue, BitRegInfo->ParentRegister));
}
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiGetRegister)
+
/*******************************************************************************
*
@@ -425,7 +411,6 @@ AcpiGetRegister (
* 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
- * Flags - Lock the hardware or not
*
* RETURN: Status
*
@@ -436,15 +421,15 @@ AcpiGetRegister (
ACPI_STATUS
AcpiSetRegister (
UINT32 RegisterId,
- UINT32 Value,
- UINT32 Flags)
+ UINT32 Value)
{
UINT32 RegisterValue = 0;
ACPI_BIT_REGISTER_INFO *BitRegInfo;
ACPI_STATUS Status;
+ ACPI_CPU_FLAGS LockFlags;
- ACPI_FUNCTION_TRACE_U32 ("AcpiSetRegister", RegisterId);
+ ACPI_FUNCTION_TRACE_U32 (AcpiSetRegister, RegisterId);
/* Get the info structure corresponding to the requested ACPI Register */
@@ -452,18 +437,11 @@ AcpiSetRegister (
BitRegInfo = AcpiHwGetBitRegisterInfo (RegisterId);
if (!BitRegInfo)
{
- ACPI_REPORT_ERROR (("Bad ACPI HW RegisterId: %X\n", RegisterId));
+ ACPI_ERROR ((AE_INFO, "Bad ACPI HW RegisterId: %X", RegisterId));
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- if (Flags & ACPI_MTX_LOCK)
- {
- Status = AcpiUtAcquireMutex (ACPI_MTX_HARDWARE);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
- }
+ LockFlags = AcpiOsAcquireLock (AcpiGbl_HardwareLock);
/* Always do a register read first so we can insert the new bits */
@@ -486,8 +464,8 @@ AcpiSetRegister (
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
+ * 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.
*/
@@ -505,7 +483,7 @@ AcpiSetRegister (
case ACPI_REGISTER_PM1_ENABLE:
ACPI_REGISTER_INSERT_VALUE (RegisterValue, BitRegInfo->BitPosition,
- BitRegInfo->AccessBitMask, Value);
+ BitRegInfo->AccessBitMask, Value);
Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK,
ACPI_REGISTER_PM1_ENABLE, (UINT16) RegisterValue);
@@ -519,10 +497,11 @@ AcpiSetRegister (
* 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_DEBUG_PRINT ((ACPI_DB_IO, "PM1 control: Read %X\n",
+ RegisterValue));
ACPI_REGISTER_INSERT_VALUE (RegisterValue, BitRegInfo->BitPosition,
- BitRegInfo->AccessBitMask, Value);
+ BitRegInfo->AccessBitMask, Value);
Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK,
ACPI_REGISTER_PM1_CONTROL, (UINT16) RegisterValue);
@@ -540,16 +519,14 @@ AcpiSetRegister (
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM2 control: Read %X from %8.8X%8.8X\n",
RegisterValue,
- ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (
- AcpiGbl_FADT->XPm2CntBlk.Address))));
+ 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 (ACPI_GET_ADDRESS (
- AcpiGbl_FADT->XPm2CntBlk.Address))));
+ ACPI_FORMAT_UINT64 (AcpiGbl_FADT.XPm2ControlBlock.Address)));
Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK,
ACPI_REGISTER_PM2_CONTROL, (UINT8) (RegisterValue));
@@ -563,10 +540,7 @@ AcpiSetRegister (
UnlockAndExit:
- if (Flags & ACPI_MTX_LOCK)
- {
- (void) AcpiUtReleaseMutex (ACPI_MTX_HARDWARE);
- }
+ AcpiOsReleaseLock (AcpiGbl_HardwareLock, LockFlags);
/* Normalize the value that was read */
@@ -575,23 +549,24 @@ UnlockAndExit:
BitRegInfo->BitPosition));
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Set bits: %8.8X actual %8.8X register %X\n",
- Value, RegisterValue, BitRegInfo->ParentRegister));
+ Value, RegisterValue, BitRegInfo->ParentRegister));
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiSetRegister)
+
/******************************************************************************
*
* FUNCTION: AcpiHwRegisterRead
*
- * PARAMETERS: UseLock - Mutex hw access
- * RegisterId - RegisterID + Offset
+ * PARAMETERS: UseLock - Lock hardware? True/False
+ * RegisterId - ACPI Register ID
* ReturnValue - Where the register value is returned
*
* RETURN: Status and the value read.
*
- * DESCRIPTION: Acpi register read function. Registers are read at the
- * given offset.
+ * DESCRIPTION: Read from the specified ACPI register
*
******************************************************************************/
@@ -604,25 +579,22 @@ AcpiHwRegisterRead (
UINT32 Value1 = 0;
UINT32 Value2 = 0;
ACPI_STATUS Status;
+ ACPI_CPU_FLAGS LockFlags = 0;
- ACPI_FUNCTION_TRACE ("HwRegisterRead");
+ ACPI_FUNCTION_TRACE (HwRegisterRead);
if (ACPI_MTX_LOCK == UseLock)
{
- Status = AcpiUtAcquireMutex (ACPI_MTX_HARDWARE);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
+ LockFlags = AcpiOsAcquireLock (AcpiGbl_HardwareLock);
}
switch (RegisterId)
{
case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */
- Status = AcpiHwLowLevelRead (16, &Value1, &AcpiGbl_FADT->XPm1aEvtBlk);
+ Status = AcpiHwLowLevelRead (16, &Value1, &AcpiGbl_FADT.XPm1aEventBlock);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
@@ -630,7 +602,7 @@ AcpiHwRegisterRead (
/* PM1B is optional */
- Status = AcpiHwLowLevelRead (16, &Value2, &AcpiGbl_FADT->XPm1bEvtBlk);
+ Status = AcpiHwLowLevelRead (16, &Value2, &AcpiGbl_FADT.XPm1bEventBlock);
Value1 |= Value2;
break;
@@ -652,35 +624,35 @@ AcpiHwRegisterRead (
case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */
- Status = AcpiHwLowLevelRead (16, &Value1, &AcpiGbl_FADT->XPm1aCntBlk);
+ Status = AcpiHwLowLevelRead (16, &Value1, &AcpiGbl_FADT.XPm1aControlBlock);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
}
- Status = AcpiHwLowLevelRead (16, &Value2, &AcpiGbl_FADT->XPm1bCntBlk);
+ Status = AcpiHwLowLevelRead (16, &Value2, &AcpiGbl_FADT.XPm1bControlBlock);
Value1 |= Value2;
break;
case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */
- Status = AcpiHwLowLevelRead (8, &Value1, &AcpiGbl_FADT->XPm2CntBlk);
+ Status = AcpiHwLowLevelRead (8, &Value1, &AcpiGbl_FADT.XPm2ControlBlock);
break;
case ACPI_REGISTER_PM_TIMER: /* 32-bit access */
- Status = AcpiHwLowLevelRead (32, &Value1, &AcpiGbl_FADT->XPmTmrBlk);
+ Status = AcpiHwLowLevelRead (32, &Value1, &AcpiGbl_FADT.XPmTimerBlock);
break;
case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */
- Status = AcpiOsReadPort (AcpiGbl_FADT->SmiCmd, &Value1, 8);
+ Status = AcpiOsReadPort (AcpiGbl_FADT.SmiCommand, &Value1, 8);
break;
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Register ID: %X\n",
+ ACPI_ERROR ((AE_INFO, "Unknown Register ID: %X",
RegisterId));
Status = AE_BAD_PARAMETER;
break;
@@ -689,7 +661,7 @@ AcpiHwRegisterRead (
UnlockAndExit:
if (ACPI_MTX_LOCK == UseLock)
{
- (void) AcpiUtReleaseMutex (ACPI_MTX_HARDWARE);
+ AcpiOsReleaseLock (AcpiGbl_HardwareLock, LockFlags);
}
if (ACPI_SUCCESS (Status))
@@ -705,14 +677,26 @@ UnlockAndExit:
*
* FUNCTION: AcpiHwRegisterWrite
*
- * PARAMETERS: UseLock - Mutex hw access
- * RegisterId - RegisterID + Offset
+ * PARAMETERS: UseLock - Lock hardware? True/False
+ * RegisterId - ACPI Register ID
* Value - The value to write
*
* RETURN: Status
*
- * DESCRIPTION: Acpi register Write function. Registers are written at the
- * given offset.
+ * 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
*
******************************************************************************/
@@ -723,25 +707,38 @@ AcpiHwRegisterWrite (
UINT32 Value)
{
ACPI_STATUS Status;
+ ACPI_CPU_FLAGS LockFlags = 0;
+ UINT32 ReadValue;
- ACPI_FUNCTION_TRACE ("HwRegisterWrite");
+ ACPI_FUNCTION_TRACE (HwRegisterWrite);
if (ACPI_MTX_LOCK == UseLock)
{
- Status = AcpiUtAcquireMutex (ACPI_MTX_HARDWARE);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
+ LockFlags = AcpiOsAcquireLock (AcpiGbl_HardwareLock);
}
switch (RegisterId)
{
case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */
- Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1aEvtBlk);
+ /* 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;
@@ -749,11 +746,11 @@ AcpiHwRegisterWrite (
/* PM1B is optional */
- Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1bEvtBlk);
+ Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT.XPm1bEventBlock);
break;
- case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access*/
+ case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access */
Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_XPm1aEnable);
if (ACPI_FAILURE (Status))
@@ -769,37 +766,55 @@ AcpiHwRegisterWrite (
case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */
- Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1aCntBlk);
+ /*
+ * 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->XPm1bCntBlk);
+ Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT.XPm1bControlBlock);
break;
case ACPI_REGISTER_PM1A_CONTROL: /* 16-bit access */
- Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1aCntBlk);
+ Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT.XPm1aControlBlock);
break;
case ACPI_REGISTER_PM1B_CONTROL: /* 16-bit access */
- Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1bCntBlk);
+ Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT.XPm1bControlBlock);
break;
case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */
- Status = AcpiHwLowLevelWrite (8, Value, &AcpiGbl_FADT->XPm2CntBlk);
+ Status = AcpiHwLowLevelWrite (8, Value, &AcpiGbl_FADT.XPm2ControlBlock);
break;
case ACPI_REGISTER_PM_TIMER: /* 32-bit access */
- Status = AcpiHwLowLevelWrite (32, Value, &AcpiGbl_FADT->XPmTmrBlk);
+ Status = AcpiHwLowLevelWrite (32, Value, &AcpiGbl_FADT.XPmTimerBlock);
break;
@@ -807,7 +822,7 @@ AcpiHwRegisterWrite (
/* SMI_CMD is currently always in IO space */
- Status = AcpiOsWritePort (AcpiGbl_FADT->SmiCmd, Value, 8);
+ Status = AcpiOsWritePort (AcpiGbl_FADT.SmiCommand, Value, 8);
break;
@@ -819,7 +834,7 @@ AcpiHwRegisterWrite (
UnlockAndExit:
if (ACPI_MTX_LOCK == UseLock)
{
- (void) AcpiUtReleaseMutex (ACPI_MTX_HARDWARE);
+ AcpiOsReleaseLock (AcpiGbl_HardwareLock, LockFlags);
}
return_ACPI_STATUS (Status);
@@ -850,7 +865,7 @@ AcpiHwLowLevelRead (
ACPI_STATUS Status;
- ACPI_FUNCTION_NAME ("HwLowLevelRead");
+ ACPI_FUNCTION_NAME (HwLowLevelRead);
/*
@@ -863,10 +878,10 @@ AcpiHwLowLevelRead (
return (AE_OK);
}
- /* Get a local copy of the address. Handles possible alignment issues */
+ /* Get a local copy of the address. Handles possible alignment issues */
ACPI_MOVE_64_TO_64 (&Address, &Reg->Address);
- if (!ACPI_VALID_ADDRESS (Address))
+ if (!Address)
{
return (AE_OK);
}
@@ -876,34 +891,31 @@ AcpiHwLowLevelRead (
* Two address spaces supported: Memory or IO.
* PCI_Config is not supported here because the GAS struct is insufficient
*/
- switch (Reg->AddressSpaceId)
+ switch (Reg->SpaceId)
{
case ACPI_ADR_SPACE_SYSTEM_MEMORY:
Status = AcpiOsReadMemory (
- (ACPI_PHYSICAL_ADDRESS) ACPI_GET_ADDRESS (Address),
- Value, Width);
+ (ACPI_PHYSICAL_ADDRESS) Address, Value, Width);
break;
case ACPI_ADR_SPACE_SYSTEM_IO:
- Status = AcpiOsReadPort ((ACPI_IO_ADDRESS) ACPI_GET_ADDRESS (Address),
- Value, Width);
+ Status = AcpiOsReadPort ((ACPI_IO_ADDRESS) Address, Value, Width);
break;
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Unsupported address space: %X\n", Reg->AddressSpaceId));
+ 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 (ACPI_GET_ADDRESS (Address)),
- AcpiUtGetRegionName (Reg->AddressSpaceId)));
+ *Value, Width, ACPI_FORMAT_UINT64 (Address),
+ AcpiUtGetRegionName (Reg->SpaceId)));
return (Status);
}
@@ -933,7 +945,7 @@ AcpiHwLowLevelWrite (
ACPI_STATUS Status;
- ACPI_FUNCTION_NAME ("HwLowLevelWrite");
+ ACPI_FUNCTION_NAME (HwLowLevelWrite);
/*
@@ -946,10 +958,10 @@ AcpiHwLowLevelWrite (
return (AE_OK);
}
- /* Get a local copy of the address. Handles possible alignment issues */
+ /* Get a local copy of the address. Handles possible alignment issues */
ACPI_MOVE_64_TO_64 (&Address, &Reg->Address);
- if (!ACPI_VALID_ADDRESS (Address))
+ if (!Address)
{
return (AE_OK);
}
@@ -958,34 +970,32 @@ AcpiHwLowLevelWrite (
* Two address spaces supported: Memory or IO.
* PCI_Config is not supported here because the GAS struct is insufficient
*/
- switch (Reg->AddressSpaceId)
+ switch (Reg->SpaceId)
{
case ACPI_ADR_SPACE_SYSTEM_MEMORY:
Status = AcpiOsWriteMemory (
- (ACPI_PHYSICAL_ADDRESS) ACPI_GET_ADDRESS (Address),
- Value, Width);
+ (ACPI_PHYSICAL_ADDRESS) Address, Value, Width);
break;
case ACPI_ADR_SPACE_SYSTEM_IO:
- Status = AcpiOsWritePort ((ACPI_IO_ADDRESS) ACPI_GET_ADDRESS (Address),
- Value, Width);
+ Status = AcpiOsWritePort (
+ (ACPI_IO_ADDRESS) Address, Value, Width);
break;
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Unsupported address space: %X\n", Reg->AddressSpaceId));
+ 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 (ACPI_GET_ADDRESS (Address)),
- AcpiUtGetRegionName (Reg->AddressSpaceId)));
+ Value, Width, ACPI_FORMAT_UINT64 (Address),
+ AcpiUtGetRegionName (Reg->SpaceId)));
return (Status);
}
diff --git a/sys/contrib/dev/acpica/hwsleep.c b/sys/contrib/dev/acpica/hwsleep.c
index 42a1fdf..1b02406 100644
--- a/sys/contrib/dev/acpica/hwsleep.c
+++ b/sys/contrib/dev/acpica/hwsleep.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Name: hwsleep.c - ACPI Hardware Sleep/Wake Interface
- * $Revision: 1.77 $
+ * $Revision: 1.87 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -116,6 +116,7 @@
*****************************************************************************/
#include <contrib/dev/acpica/acpi.h>
+#include <contrib/dev/acpica/actables.h>
#define _COMPONENT ACPI_HARDWARE
ACPI_MODULE_NAME ("hwsleep")
@@ -136,28 +137,45 @@
ACPI_STATUS
AcpiSetFirmwareWakingVector (
- ACPI_PHYSICAL_ADDRESS PhysicalAddress)
+ ACPI_PHYSICAL_ADDRESS PhysicalAddress)
{
+ ACPI_TABLE_FACS *Facs;
+ ACPI_STATUS Status;
+
- ACPI_FUNCTION_TRACE ("AcpiSetFirmwareWakingVector");
+ ACPI_FUNCTION_TRACE (AcpiSetFirmwareWakingVector);
+ /* Get the FACS */
+
+ Status = AcpiGetTableByIndex (ACPI_TABLE_INDEX_FACS, (ACPI_TABLE_HEADER **) &Facs);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
/* Set the vector */
- if (AcpiGbl_CommonFACS.VectorWidth == 32)
+ if ((Facs->Length < 32) ||
+ (!(Facs->XFirmwareWakingVector)))
{
- *(ACPI_CAST_PTR (UINT32, AcpiGbl_CommonFACS.FirmwareWakingVector))
- = (UINT32) PhysicalAddress;
+ /*
+ * ACPI 1.0 FACS or short table or optional X_ field is zero
+ */
+ Facs->FirmwareWakingVector = (UINT32) PhysicalAddress;
}
else
{
- *AcpiGbl_CommonFACS.FirmwareWakingVector
- = PhysicalAddress;
+ /*
+ * ACPI 2.0 FACS with valid X_ field
+ */
+ Facs->XFirmwareWakingVector = PhysicalAddress;
}
return_ACPI_STATUS (AE_OK);
}
+ACPI_EXPORT_SYMBOL (AcpiSetFirmwareWakingVector)
+
/*******************************************************************************
*
@@ -175,10 +193,13 @@ AcpiSetFirmwareWakingVector (
ACPI_STATUS
AcpiGetFirmwareWakingVector (
- ACPI_PHYSICAL_ADDRESS *PhysicalAddress)
+ ACPI_PHYSICAL_ADDRESS *PhysicalAddress)
{
+ ACPI_TABLE_FACS *Facs;
+ ACPI_STATUS Status;
+
- ACPI_FUNCTION_TRACE ("AcpiGetFirmwareWakingVector");
+ ACPI_FUNCTION_TRACE (AcpiGetFirmwareWakingVector);
if (!PhysicalAddress)
@@ -186,22 +207,38 @@ AcpiGetFirmwareWakingVector (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
+ /* Get the FACS */
+
+ Status = AcpiGetTableByIndex (ACPI_TABLE_INDEX_FACS, (ACPI_TABLE_HEADER **) &Facs);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
/* Get the vector */
- if (AcpiGbl_CommonFACS.VectorWidth == 32)
+ if ((Facs->Length < 32) ||
+ (!(Facs->XFirmwareWakingVector)))
{
- *PhysicalAddress = (ACPI_PHYSICAL_ADDRESS)
- *(ACPI_CAST_PTR (UINT32, AcpiGbl_CommonFACS.FirmwareWakingVector));
+ /*
+ * ACPI 1.0 FACS or short table or optional X_ field is zero
+ */
+ *PhysicalAddress =
+ (ACPI_PHYSICAL_ADDRESS) Facs->FirmwareWakingVector;
}
else
{
- *PhysicalAddress =
- *AcpiGbl_CommonFACS.FirmwareWakingVector;
+ /*
+ * ACPI 2.0 FACS with valid X_ field
+ */
+ *PhysicalAddress = (ACPI_PHYSICAL_ADDRESS) Facs->XFirmwareWakingVector;
}
return_ACPI_STATUS (AE_OK);
}
+ACPI_EXPORT_SYMBOL (AcpiGetFirmwareWakingVector)
+
/*******************************************************************************
*
@@ -227,7 +264,7 @@ AcpiEnterSleepStatePrep (
ACPI_OBJECT Arg;
- ACPI_FUNCTION_TRACE ("AcpiEnterSleepStatePrep");
+ ACPI_FUNCTION_TRACE (AcpiEnterSleepStatePrep);
/*
@@ -290,13 +327,14 @@ AcpiEnterSleepStatePrep (
Status = AcpiEvaluateObject (NULL, METHOD_NAME__SST, &ArgList, NULL);
if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND)
{
- ACPI_REPORT_ERROR (("Method _SST failed, %s\n",
- AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status, "While executing method _SST"));
}
return_ACPI_STATUS (AE_OK);
}
+ACPI_EXPORT_SYMBOL (AcpiEnterSleepStatePrep)
+
/*******************************************************************************
*
@@ -323,13 +361,13 @@ AcpiEnterSleepState (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("AcpiEnterSleepState");
+ ACPI_FUNCTION_TRACE (AcpiEnterSleepState);
if ((AcpiGbl_SleepTypeA > ACPI_SLEEP_TYPE_MAX) ||
(AcpiGbl_SleepTypeB > ACPI_SLEEP_TYPE_MAX))
{
- ACPI_REPORT_ERROR (("Sleep values out of range: A=%X B=%X\n",
+ ACPI_ERROR ((AE_INFO, "Sleep values out of range: A=%X B=%X",
AcpiGbl_SleepTypeA, AcpiGbl_SleepTypeB));
return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
}
@@ -339,7 +377,7 @@ AcpiEnterSleepState (
/* Clear wake status */
- Status = AcpiSetRegister (ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK);
+ Status = AcpiSetRegister (ACPI_BITREG_WAKE_STATUS, 1);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -347,7 +385,7 @@ AcpiEnterSleepState (
/* Clear all fixed and general purpose status bits */
- Status = AcpiHwClearAcpiStatus (ACPI_MTX_DO_NOT_LOCK);
+ Status = AcpiHwClearAcpiStatus ();
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -357,8 +395,7 @@ AcpiEnterSleepState (
{
/* Disable BM arbitration */
- Status = AcpiSetRegister (ACPI_BITREG_ARB_DISABLE,
- 1, ACPI_MTX_DO_NOT_LOCK);
+ Status = AcpiSetRegister (ACPI_BITREG_ARB_DISABLE, 1);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -476,8 +513,7 @@ AcpiEnterSleepState (
do
{
- Status = AcpiGetRegister (ACPI_BITREG_WAKE_STATUS, &InValue,
- ACPI_MTX_DO_NOT_LOCK);
+ Status = AcpiGetRegister (ACPI_BITREG_WAKE_STATUS, &InValue);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -490,6 +526,8 @@ AcpiEnterSleepState (
return_ACPI_STATUS (AE_OK);
}
+ACPI_EXPORT_SYMBOL (AcpiEnterSleepState)
+
/*******************************************************************************
*
@@ -512,16 +550,16 @@ AcpiEnterSleepStateS4bios (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("AcpiEnterSleepStateS4bios");
+ ACPI_FUNCTION_TRACE (AcpiEnterSleepStateS4bios);
- Status = AcpiSetRegister (ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK);
+ Status = AcpiSetRegister (ACPI_BITREG_WAKE_STATUS, 1);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
- Status = AcpiHwClearAcpiStatus (ACPI_MTX_DO_NOT_LOCK);
+ Status = AcpiHwClearAcpiStatus ();
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -546,13 +584,12 @@ AcpiEnterSleepStateS4bios (
ACPI_FLUSH_CPU_CACHE ();
- Status = AcpiOsWritePort (AcpiGbl_FADT->SmiCmd,
- (UINT32) AcpiGbl_FADT->S4BiosReq, 8);
+ Status = AcpiOsWritePort (AcpiGbl_FADT.SmiCommand,
+ (UINT32) AcpiGbl_FADT.S4BiosRequest, 8);
do {
AcpiOsStall(1000);
- Status = AcpiGetRegister (ACPI_BITREG_WAKE_STATUS, &InValue,
- ACPI_MTX_DO_NOT_LOCK);
+ Status = AcpiGetRegister (ACPI_BITREG_WAKE_STATUS, &InValue);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -562,6 +599,8 @@ AcpiEnterSleepStateS4bios (
return_ACPI_STATUS (AE_OK);
}
+ACPI_EXPORT_SYMBOL (AcpiEnterSleepStateS4bios)
+
/*******************************************************************************
*
@@ -589,7 +628,7 @@ AcpiLeaveSleepState (
UINT32 PM1BControl;
- ACPI_FUNCTION_TRACE ("AcpiLeaveSleepState");
+ ACPI_FUNCTION_TRACE (AcpiLeaveSleepState);
/*
@@ -646,23 +685,20 @@ AcpiLeaveSleepState (
Status = AcpiEvaluateObject (NULL, METHOD_NAME__SST, &ArgList, NULL);
if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND)
{
- ACPI_REPORT_ERROR (("Method _SST failed, %s\n",
- AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status, "During Method _SST"));
}
Arg.Integer.Value = SleepState;
Status = AcpiEvaluateObject (NULL, METHOD_NAME__BFS, &ArgList, NULL);
if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND)
{
- ACPI_REPORT_ERROR (("Method _BFS failed, %s\n",
- AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status, "During Method _BFS"));
}
Status = AcpiEvaluateObject (NULL, METHOD_NAME__WAK, &ArgList, NULL);
if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND)
{
- ACPI_REPORT_ERROR (("Method _WAK failed, %s\n",
- AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status, "During Method _WAK"));
}
/* TBD: _WAK "sometimes" returns stuff - do we want to look at it? */
@@ -687,16 +723,14 @@ AcpiLeaveSleepState (
/* Enable power button */
(void) AcpiSetRegister(
- AcpiGbl_FixedEventInfo[ACPI_EVENT_POWER_BUTTON].EnableRegisterId,
- 1, ACPI_MTX_DO_NOT_LOCK);
+ AcpiGbl_FixedEventInfo[ACPI_EVENT_POWER_BUTTON].EnableRegisterId, 1);
(void) AcpiSetRegister(
- AcpiGbl_FixedEventInfo[ACPI_EVENT_POWER_BUTTON].StatusRegisterId,
- 1, ACPI_MTX_DO_NOT_LOCK);
+ AcpiGbl_FixedEventInfo[ACPI_EVENT_POWER_BUTTON].StatusRegisterId, 1);
/* Enable BM arbitration */
- Status = AcpiSetRegister (ACPI_BITREG_ARB_DISABLE, 0, ACPI_MTX_LOCK);
+ Status = AcpiSetRegister (ACPI_BITREG_ARB_DISABLE, 0);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -706,9 +740,11 @@ AcpiLeaveSleepState (
Status = AcpiEvaluateObject (NULL, METHOD_NAME__SST, &ArgList, NULL);
if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND)
{
- ACPI_REPORT_ERROR (("Method _SST failed, %s\n",
- AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status, "During Method _SST"));
}
return_ACPI_STATUS (Status);
}
+
+ACPI_EXPORT_SYMBOL (AcpiLeaveSleepState)
+
diff --git a/sys/contrib/dev/acpica/hwtimer.c b/sys/contrib/dev/acpica/hwtimer.c
index 58f5a79..78114e5 100644
--- a/sys/contrib/dev/acpica/hwtimer.c
+++ b/sys/contrib/dev/acpica/hwtimer.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Name: hwtimer.c - ACPI Power Management Timer Interface
- * $Revision: 1.30 $
+ * $Revision: 1.37 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -137,7 +137,7 @@ ACPI_STATUS
AcpiGetTimerResolution (
UINT32 *Resolution)
{
- ACPI_FUNCTION_TRACE ("AcpiGetTimerResolution");
+ ACPI_FUNCTION_TRACE (AcpiGetTimerResolution);
if (!Resolution)
@@ -145,7 +145,7 @@ AcpiGetTimerResolution (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- if (0 == AcpiGbl_FADT->TmrValExt)
+ if ((AcpiGbl_FADT.Flags & ACPI_FADT_32BIT_TIMER) == 0)
{
*Resolution = 24;
}
@@ -157,6 +157,8 @@ AcpiGetTimerResolution (
return_ACPI_STATUS (AE_OK);
}
+ACPI_EXPORT_SYMBOL (AcpiGetTimerResolution)
+
/******************************************************************************
*
@@ -177,7 +179,7 @@ AcpiGetTimer (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("AcpiGetTimer");
+ ACPI_FUNCTION_TRACE (AcpiGetTimer);
if (!Ticks)
@@ -185,11 +187,13 @@ AcpiGetTimer (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- Status = AcpiHwLowLevelRead (32, Ticks, &AcpiGbl_FADT->XPmTmrBlk);
+ Status = AcpiHwLowLevelRead (32, Ticks, &AcpiGbl_FADT.XPmTimerBlock);
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiGetTimer)
+
/******************************************************************************
*
@@ -231,7 +235,7 @@ AcpiGetTimerDuration (
ACPI_INTEGER Quotient;
- ACPI_FUNCTION_TRACE ("AcpiGetTimerDuration");
+ ACPI_FUNCTION_TRACE (AcpiGetTimerDuration);
if (!TimeElapsed)
@@ -249,7 +253,7 @@ AcpiGetTimerDuration (
}
else if (StartTicks > EndTicks)
{
- if (0 == AcpiGbl_FADT->TmrValExt)
+ if ((AcpiGbl_FADT.Flags & ACPI_FADT_32BIT_TIMER) == 0)
{
/* 24-bit Timer */
@@ -280,4 +284,5 @@ AcpiGetTimerDuration (
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiGetTimerDuration)
diff --git a/sys/contrib/dev/acpica/nsaccess.c b/sys/contrib/dev/acpica/nsaccess.c
index 84ec3c4..d1b4f73 100644
--- a/sys/contrib/dev/acpica/nsaccess.c
+++ b/sys/contrib/dev/acpica/nsaccess.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: nsaccess - Top-level functions for accessing ACPI namespace
- * $Revision: 1.192 $
+ * $Revision: 1.206 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -151,7 +151,7 @@ AcpiNsRootInitialize (
ACPI_STRING Val = NULL;
- ACPI_FUNCTION_TRACE ("NsRootInitialize");
+ ACPI_FUNCTION_TRACE (NsRootInitialize);
Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
@@ -196,9 +196,9 @@ AcpiNsRootInitialize (
if (ACPI_FAILURE (Status) || (!NewNode)) /* Must be on same line for code converter */
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Could not create predefined name %s, %s\n",
- InitVal->Name, AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Could not create predefined name %s",
+ InitVal->Name));
}
/*
@@ -211,8 +211,8 @@ AcpiNsRootInitialize (
Status = AcpiOsPredefinedOverride (InitVal, &Val);
if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Could not override predefined %s\n",
+ ACPI_ERROR ((AE_INFO,
+ "Could not override predefined %s",
InitVal->Name));
}
@@ -281,32 +281,25 @@ AcpiNsRootInitialize (
ObjDesc->Mutex.Node = NewNode;
ObjDesc->Mutex.SyncLevel = (UINT8) (ACPI_TO_INTEGER (Val) - 1);
- if (ACPI_STRCMP (InitVal->Name, "_GL_") == 0)
- {
- /*
- * Create a counting semaphore for the
- * global lock
- */
- Status = AcpiOsCreateSemaphore (ACPI_NO_UNIT_LIMIT,
- 1, &ObjDesc->Mutex.Semaphore);
- if (ACPI_FAILURE (Status))
- {
- AcpiUtRemoveReference (ObjDesc);
- goto UnlockAndExit;
- }
+ /* Create a mutex */
- /*
- * We just created the mutex for the
- * global lock, save it
- */
- AcpiGbl_GlobalLockSemaphore = ObjDesc->Mutex.Semaphore;
+ Status = AcpiOsCreateMutex (&ObjDesc->Mutex.OsMutex);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiUtRemoveReference (ObjDesc);
+ goto UnlockAndExit;
}
- else
+
+ /* Special case for ACPI Global Lock */
+
+ if (ACPI_STRCMP (InitVal->Name, "_GL_") == 0)
{
- /* Create a mutex */
+ AcpiGbl_GlobalLockMutex = ObjDesc;
+
+ /* Create additional counting semaphore for global lock */
- Status = AcpiOsCreateSemaphore (1, 1,
- &ObjDesc->Mutex.Semaphore);
+ Status = AcpiOsCreateSemaphore (
+ 1, 0, &AcpiGbl_GlobalLockSemaphore);
if (ACPI_FAILURE (Status))
{
AcpiUtRemoveReference (ObjDesc);
@@ -318,7 +311,7 @@ AcpiNsRootInitialize (
default:
- ACPI_REPORT_ERROR (("Unsupported initial type value %X\n",
+ ACPI_ERROR ((AE_INFO, "Unsupported initial type value %X",
InitVal->Type));
AcpiUtRemoveReference (ObjDesc);
ObjDesc = NULL;
@@ -344,8 +337,8 @@ UnlockAndExit:
if (ACPI_SUCCESS (Status))
{
- Status = AcpiNsGetNodeByPath ("\\_GPE", NULL, ACPI_NS_NO_UPSEARCH,
- &AcpiGbl_FadtGpeDevice);
+ Status = AcpiNsGetNode (NULL, "\\_GPE", ACPI_NS_NO_UPSEARCH,
+ &AcpiGbl_FadtGpeDevice);
}
return_ACPI_STATUS (Status);
@@ -396,11 +389,10 @@ AcpiNsLookup (
ACPI_OBJECT_TYPE TypeToCheckFor;
ACPI_OBJECT_TYPE ThisSearchType;
UINT32 SearchParentFlag = ACPI_NS_SEARCH_PARENT;
- UINT32 LocalFlags = Flags & ~(ACPI_NS_ERROR_IF_FOUND |
- ACPI_NS_SEARCH_PARENT);
+ UINT32 LocalFlags;
- ACPI_FUNCTION_TRACE ("NsLookup");
+ ACPI_FUNCTION_TRACE (NsLookup);
if (!ReturnNode)
@@ -408,8 +400,9 @@ AcpiNsLookup (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- AcpiGbl_NsLookupCount++;
+ LocalFlags = Flags & ~(ACPI_NS_ERROR_IF_FOUND | ACPI_NS_SEARCH_PARENT);
*ReturnNode = ACPI_ENTRY_NOT_FOUND;
+ AcpiGbl_NsLookupCount++;
if (!AcpiGbl_RootNode)
{
@@ -434,20 +427,23 @@ AcpiNsLookup (
PrefixNode = ScopeInfo->Scope.Node;
if (ACPI_GET_DESCRIPTOR_TYPE (PrefixNode) != ACPI_DESC_TYPE_NAMED)
{
- ACPI_REPORT_ERROR (("NsLookup: %p is not a namespace node [%s]\n",
- PrefixNode, AcpiUtGetDescriptorName (PrefixNode)));
+ ACPI_ERROR ((AE_INFO, "%p is not a namespace node [%s]",
+ PrefixNode, AcpiUtGetDescriptorName (PrefixNode)));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
- /*
- * 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.
- */
- while (!AcpiNsOpensScope (PrefixNode->Type) &&
- PrefixNode->Type != ACPI_TYPE_ANY)
+ if (!(Flags & ACPI_NS_PREFIX_IS_SCOPE))
{
- PrefixNode = AcpiNsGetParentNode (PrefixNode);
+ /*
+ * 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.
+ */
+ while (!AcpiNsOpensScope (PrefixNode->Type) &&
+ PrefixNode->Type != ACPI_TYPE_ANY)
+ {
+ PrefixNode = AcpiNsGetParentNode (PrefixNode);
+ }
}
}
@@ -462,9 +458,9 @@ AcpiNsLookup (
{
/* A Null NamePath is allowed and refers to the root */
- NumSegments = 0;
- ThisNode = AcpiGbl_RootNode;
- Path = "";
+ NumSegments = 0;
+ ThisNode = AcpiGbl_RootNode;
+ Path = "";
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"Null Pathname (Zero segments), Flags=%X\n", Flags));
@@ -531,8 +527,8 @@ AcpiNsLookup (
{
/* Current scope has no parent scope */
- ACPI_REPORT_ERROR (
- ("ACPI path has too many parent prefixes (^) - reached beyond root node\n"));
+ ACPI_ERROR ((AE_INFO,
+ "ACPI path has too many parent prefixes (^) - reached beyond root node"));
return_ACPI_STATUS (AE_NOT_FOUND);
}
}
@@ -696,19 +692,20 @@ AcpiNsLookup (
*
* 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))
+ 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))
{
/* Complain about a type mismatch */
- ACPI_REPORT_WARNING (
- ("NsLookup: Type mismatch on %4.4s (%s), searching for (%s)\n",
- (char *) &SimpleName, AcpiUtGetTypeName (ThisNode->Type),
+ ACPI_WARNING ((AE_INFO,
+ "NsLookup: Type mismatch on %4.4s (%s), searching for (%s)",
+ ACPI_CAST_PTR (char, &SimpleName),
+ AcpiUtGetTypeName (ThisNode->Type),
AcpiUtGetTypeName (TypeToCheckFor)));
}
diff --git a/sys/contrib/dev/acpica/nsalloc.c b/sys/contrib/dev/acpica/nsalloc.c
index 0173809..e6ecf5a 100644
--- a/sys/contrib/dev/acpica/nsalloc.c
+++ b/sys/contrib/dev/acpica/nsalloc.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: nsalloc - Namespace allocation and deletion utilities
- * $Revision: 1.97 $
+ * $Revision: 1.108 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -124,12 +124,6 @@
#define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME ("nsalloc")
-/* Local prototypes */
-
-static void
-AcpiNsRemoveReference (
- ACPI_NAMESPACE_NODE *Node);
-
/*******************************************************************************
*
@@ -148,12 +142,15 @@ AcpiNsCreateNode (
UINT32 Name)
{
ACPI_NAMESPACE_NODE *Node;
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+ UINT32 Temp;
+#endif
- ACPI_FUNCTION_TRACE ("NsCreateNode");
+ ACPI_FUNCTION_TRACE (NsCreateNode);
- Node = ACPI_MEM_CALLOCATE (sizeof (ACPI_NAMESPACE_NODE));
+ Node = AcpiOsAcquireObject (AcpiGbl_NamespaceCache);
if (!Node)
{
return_PTR (NULL);
@@ -161,10 +158,16 @@ AcpiNsCreateNode (
ACPI_MEM_TRACKING (AcpiGbl_NsNodeList->TotalAllocated++);
- Node->Name.Integer = Name;
- Node->ReferenceCount = 1;
- ACPI_SET_DESCRIPTOR_TYPE (Node, ACPI_DESC_TYPE_NAMED);
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+ Temp = AcpiGbl_NsNodeList->TotalAllocated - AcpiGbl_NsNodeList->TotalFreed;
+ if (Temp > AcpiGbl_NsNodeList->MaxOccupied)
+ {
+ AcpiGbl_NsNodeList->MaxOccupied = Temp;
+ }
+#endif
+ Node->Name.Integer = Name;
+ ACPI_SET_DESCRIPTOR_TYPE (Node, ACPI_DESC_TYPE_NAMED);
return_PTR (Node);
}
@@ -190,7 +193,7 @@ AcpiNsDeleteNode (
ACPI_NAMESPACE_NODE *NextNode;
- ACPI_FUNCTION_TRACE_PTR ("NsDeleteNode", Node);
+ ACPI_FUNCTION_TRACE_PTR (NsDeleteNode, Node);
ParentNode = AcpiNsGetParentNode (Node);
@@ -236,10 +239,10 @@ 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);
- ACPI_MEM_FREE (Node);
+ (void) AcpiOsReleaseObject (AcpiGbl_NamespaceCache, Node);
return_VOID;
}
@@ -275,7 +278,7 @@ AcpiNsInstallNode (
ACPI_NAMESPACE_NODE *ChildNode;
- ACPI_FUNCTION_TRACE ("NsInstallNode");
+ ACPI_FUNCTION_TRACE (NsInstallNode);
/*
@@ -324,15 +327,6 @@ AcpiNsInstallNode (
AcpiUtGetNodeName (ParentNode), AcpiUtGetTypeName (ParentNode->Type),
ParentNode));
- /*
- * Increment the reference count(s) of all parents up to
- * the root!
- */
- while ((Node = AcpiNsGetParentNode (Node)) != NULL)
- {
- Node->ReferenceCount++;
- }
-
return_VOID;
}
@@ -356,11 +350,10 @@ AcpiNsDeleteChildren (
{
ACPI_NAMESPACE_NODE *ChildNode;
ACPI_NAMESPACE_NODE *NextNode;
- ACPI_NAMESPACE_NODE *Node;
UINT8 Flags;
- ACPI_FUNCTION_TRACE_PTR ("NsDeleteChildren", ParentNode);
+ ACPI_FUNCTION_TRACE_PTR (NsDeleteChildren, ParentNode);
if (!ParentNode)
@@ -383,14 +376,14 @@ AcpiNsDeleteChildren (
{
/* Get the things we need */
- NextNode = ChildNode->Peer;
- Flags = ChildNode->Flags;
+ NextNode = ChildNode->Peer;
+ Flags = ChildNode->Flags;
/* Grandchildren should have all been deleted already */
if (ChildNode->Child)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Found a grandchild! P=%p C=%p\n",
+ ACPI_ERROR ((AE_INFO, "Found a grandchild! P=%p C=%p",
ParentNode, ChildNode));
}
@@ -406,28 +399,9 @@ AcpiNsDeleteChildren (
*/
AcpiNsDetachObject (ChildNode);
- /*
- * Decrement the reference count(s) of all parents up to
- * the root! (counts were incremented when the node was created)
- */
- Node = ChildNode;
- while ((Node = AcpiNsGetParentNode (Node)) != NULL)
- {
- Node->ReferenceCount--;
- }
-
- /* There should be only one reference remaining on this node */
-
- if (ChildNode->ReferenceCount != 1)
- {
- ACPI_REPORT_WARNING ((
- "Existing references (%d) on node being deleted (%p)\n",
- ChildNode->ReferenceCount, ChildNode));
- }
-
/* Now we can delete the node */
- ACPI_MEM_FREE (ChildNode);
+ (void) AcpiOsReleaseObject (AcpiGbl_NamespaceCache, ChildNode);
/* And move on to the next child in the list */
@@ -465,7 +439,7 @@ AcpiNsDeleteNamespaceSubtree (
UINT32 Level = 1;
- ACPI_FUNCTION_TRACE ("NsDeleteNamespaceSubtree");
+ ACPI_FUNCTION_TRACE (NsDeleteNamespaceSubtree);
if (!ParentNode)
@@ -481,8 +455,7 @@ AcpiNsDeleteNamespaceSubtree (
{
/* Get the next node in this scope (NULL if none) */
- ChildNode = AcpiNsGetNextNode (ACPI_TYPE_ANY, ParentNode,
- ChildNode);
+ ChildNode = AcpiNsGetNextNode (ACPI_TYPE_ANY, ParentNode, ChildNode);
if (ChildNode)
{
/* Found a child node - detach any attached object */
@@ -532,62 +505,6 @@ AcpiNsDeleteNamespaceSubtree (
/*******************************************************************************
*
- * FUNCTION: AcpiNsRemoveReference
- *
- * PARAMETERS: Node - Named node whose reference count is to be
- * decremented
- *
- * RETURN: None.
- *
- * DESCRIPTION: Remove a Node reference. Decrements the reference count
- * of all parent Nodes up to the root. Any node along
- * the way that reaches zero references is freed.
- *
- ******************************************************************************/
-
-static void
-AcpiNsRemoveReference (
- ACPI_NAMESPACE_NODE *Node)
-{
- ACPI_NAMESPACE_NODE *ParentNode;
- ACPI_NAMESPACE_NODE *ThisNode;
-
-
- ACPI_FUNCTION_ENTRY ();
-
-
- /*
- * Decrement the reference count(s) of this node and all
- * nodes up to the root, Delete anything with zero remaining references.
- */
- ThisNode = Node;
- while (ThisNode)
- {
- /* Prepare to move up to parent */
-
- ParentNode = AcpiNsGetParentNode (ThisNode);
-
- /* Decrement the reference count on this node */
-
- ThisNode->ReferenceCount--;
-
- /* Delete the node if no more references */
-
- if (!ThisNode->ReferenceCount)
- {
- /* Delete all children and delete the node */
-
- AcpiNsDeleteChildren (ThisNode);
- AcpiNsDeleteNode (ThisNode);
- }
-
- ThisNode = ParentNode;
- }
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: AcpiNsDeleteNamespaceByOwner
*
* PARAMETERS: OwnerId - All nodes with this owner will be deleted
@@ -598,6 +515,8 @@ AcpiNsRemoveReference (
* specific ID. Used to delete entire ACPI tables. All
* reference counts are updated.
*
+ * MUTEX: Locks namespace during deletion walk.
+ *
******************************************************************************/
void
@@ -606,11 +525,12 @@ AcpiNsDeleteNamespaceByOwner (
{
ACPI_NAMESPACE_NODE *ChildNode;
ACPI_NAMESPACE_NODE *DeletionNode;
- UINT32 Level;
ACPI_NAMESPACE_NODE *ParentNode;
+ UINT32 Level;
+ ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE_U32 ("NsDeleteNamespaceByOwner", OwnerId);
+ ACPI_FUNCTION_TRACE_U32 (NsDeleteNamespaceByOwner, OwnerId);
if (OwnerId == 0)
@@ -618,10 +538,18 @@ AcpiNsDeleteNamespaceByOwner (
return_VOID;
}
- ParentNode = AcpiGbl_RootNode;
- ChildNode = NULL;
- DeletionNode = NULL;
- Level = 1;
+ /* Lock namespace for possible update */
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_VOID;
+ }
+
+ DeletionNode = NULL;
+ ParentNode = AcpiGbl_RootNode;
+ ChildNode = NULL;
+ Level = 1;
/*
* Traverse the tree of nodes until we bubble back up
@@ -637,7 +565,8 @@ AcpiNsDeleteNamespaceByOwner (
if (DeletionNode)
{
- AcpiNsRemoveReference (DeletionNode);
+ AcpiNsDeleteChildren (DeletionNode);
+ AcpiNsDeleteNode (DeletionNode);
DeletionNode = NULL;
}
@@ -692,6 +621,7 @@ AcpiNsDeleteNamespaceByOwner (
}
}
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
return_VOID;
}
diff --git a/sys/contrib/dev/acpica/nsdump.c b/sys/contrib/dev/acpica/nsdump.c
index 007c20a..7c2028a 100644
--- a/sys/contrib/dev/acpica/nsdump.c
+++ b/sys/contrib/dev/acpica/nsdump.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: nsdump - table dumping routines for debug
- * $Revision: 1.172 $
+ * $Revision: 1.182 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -163,7 +163,7 @@ AcpiNsPrintPathname (
ACPI_NATIVE_UINT i;
- ACPI_FUNCTION_NAME ("NsPrintPathname");
+ ACPI_FUNCTION_NAME (NsPrintPathname);
if (!(AcpiDbgLevel & ACPI_LV_NAMES) || !(AcpiDbgLayer & ACPI_NAMESPACE))
@@ -220,7 +220,7 @@ AcpiNsDumpPathname (
UINT32 Component)
{
- ACPI_FUNCTION_TRACE ("NsDumpPathname");
+ ACPI_FUNCTION_TRACE (NsDumpPathname);
/* Do this only if the requested debug level and component are enabled */
@@ -271,7 +271,7 @@ AcpiNsDumpOneObject (
UINT32 i;
- ACPI_FUNCTION_NAME ("NsDumpOneObject");
+ ACPI_FUNCTION_NAME (NsDumpOneObject);
/* Is output enabled? */
@@ -308,12 +308,14 @@ AcpiNsDumpOneObject (
if (Type > ACPI_TYPE_LOCAL_MAX)
{
- ACPI_REPORT_WARNING (("Invalid ACPI Type %08X\n", Type));
+ ACPI_WARNING ((AE_INFO, "Invalid ACPI Object Type %08X", Type));
}
if (!AcpiUtValidAcpiName (ThisNode->Name.Integer))
{
- ACPI_REPORT_WARNING (("Invalid ACPI Name %08X\n",
+ ThisNode->Name.Integer = AcpiUtRepairName (ThisNode->Name.Ascii);
+
+ ACPI_WARNING ((AE_INFO, "Invalid ACPI Name %08X",
ThisNode->Name.Integer));
}
@@ -323,14 +325,21 @@ AcpiNsDumpOneObject (
/*
* Now we can print out the pertinent information
*/
- AcpiOsPrintf (" %-12s %p ",
- AcpiUtGetTypeName (Type), ThisNode);
+ AcpiOsPrintf (" %-12s %p %2.2X ",
+ AcpiUtGetTypeName (Type), ThisNode, ThisNode->OwnerId);
DbgLevel = AcpiDbgLevel;
AcpiDbgLevel = 0;
ObjDesc = AcpiNsGetAttachedObject (ThisNode);
AcpiDbgLevel = DbgLevel;
+ /* Temp nodes are those nodes created by a control method */
+
+ if (ThisNode->Flags & ANOBJ_TEMPORARY)
+ {
+ AcpiOsPrintf ("(T) ");
+ }
+
switch (Info->DisplayType & ACPI_DISPLAY_MASK)
{
case ACPI_DISPLAY_SUMMARY:
@@ -726,8 +735,8 @@ AcpiNsDumpObjects (
Info.DisplayType = DisplayType;
(void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth,
- ACPI_NS_WALK_NO_UNLOCK, AcpiNsDumpOneObject,
- (void *) &Info, NULL);
+ ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES,
+ AcpiNsDumpOneObject, (void *) &Info, NULL);
}
@@ -787,7 +796,7 @@ AcpiNsDumpTables (
ACPI_HANDLE SearchHandle = SearchBase;
- ACPI_FUNCTION_TRACE ("NsDumpTables");
+ ACPI_FUNCTION_TRACE (NsDumpTables);
if (!AcpiGbl_RootNode)
diff --git a/sys/contrib/dev/acpica/nsdumpdv.c b/sys/contrib/dev/acpica/nsdumpdv.c
index b62b85d..91c6b54 100644
--- a/sys/contrib/dev/acpica/nsdumpdv.c
+++ b/sys/contrib/dev/acpica/nsdumpdv.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: nsdump - table dumping routines for debug
- * $Revision: 1.16 $
+ * $Revision: 1.20 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -159,7 +159,7 @@ AcpiNsDumpOneDevice (
UINT32 i;
- ACPI_FUNCTION_NAME ("NsDumpOneDevice");
+ ACPI_FUNCTION_NAME (NsDumpOneDevice);
Status = AcpiNsDumpOneObject (ObjHandle, Level, Context, ReturnValue);
@@ -178,7 +178,7 @@ AcpiNsDumpOneDevice (
" HID: %s, ADR: %8.8X%8.8X, Status: %X\n",
Info->HardwareId.Value, ACPI_FORMAT_UINT64 (Info->Address),
Info->CurrentStatus));
- ACPI_MEM_FREE (Info);
+ ACPI_FREE (Info);
}
return (Status);
@@ -205,7 +205,7 @@ AcpiNsDumpRootDevices (
ACPI_STATUS Status;
- ACPI_FUNCTION_NAME ("NsDumpRootDevices");
+ ACPI_FUNCTION_NAME (NsDumpRootDevices);
/* Only dump the table if tracing is enabled */
diff --git a/sys/contrib/dev/acpica/nseval.c b/sys/contrib/dev/acpica/nseval.c
index e2ca559..c44af2d 100644
--- a/sys/contrib/dev/acpica/nseval.c
+++ b/sys/contrib/dev/acpica/nseval.c
@@ -1,8 +1,7 @@
/*******************************************************************************
*
- * Module Name: nseval - Object evaluation interfaces -- includes control
- * method lookup and execution.
- * $Revision: 1.134 $
+ * Module Name: nseval - Object evaluation, includes control method execution
+ * $Revision: 1.144 $
*
******************************************************************************/
@@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -127,221 +126,15 @@
#define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME ("nseval")
-/* Local prototypes */
-
-static ACPI_STATUS
-AcpiNsExecuteControlMethod (
- ACPI_PARAMETER_INFO *Info);
-
-static ACPI_STATUS
-AcpiNsGetObjectValue (
- ACPI_PARAMETER_INFO *Info);
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiNsEvaluateRelative
- *
- * PARAMETERS: Pathname - Name of method to execute, If NULL, the
- * handle is the object to execute
- * Info - Method info block, contains:
- * ReturnObject - Where to put method's return value (if
- * any). If NULL, no value is returned.
- * Params - List of parameters to pass to the method,
- * terminated by NULL. Params itself may be
- * NULL if no parameters are being passed.
- *
- * RETURN: Status
- *
- * DESCRIPTION: Evaluate the object or find and execute the requested method
- *
- * MUTEX: Locks Namespace
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiNsEvaluateRelative (
- char *Pathname,
- ACPI_PARAMETER_INFO *Info)
-{
- ACPI_STATUS Status;
- ACPI_NAMESPACE_NODE *Node = NULL;
- ACPI_GENERIC_STATE *ScopeInfo;
- char *InternalPath = NULL;
-
-
- ACPI_FUNCTION_TRACE ("NsEvaluateRelative");
-
-
- /*
- * Must have a valid object handle
- */
- if (!Info || !Info->Node)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- /* Build an internal name string for the method */
-
- Status = AcpiNsInternalizeName (Pathname, &InternalPath);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- ScopeInfo = AcpiUtCreateGenericState ();
- if (!ScopeInfo)
- {
- goto Cleanup1;
- }
-
- /* Get the prefix handle and Node */
-
- Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
-
- Info->Node = AcpiNsMapHandleToNode (Info->Node);
- if (!Info->Node)
- {
- (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
- Status = AE_BAD_PARAMETER;
- goto Cleanup;
- }
-
- /* Lookup the name in the namespace */
-
- ScopeInfo->Scope.Node = Info->Node;
- Status = AcpiNsLookup (ScopeInfo, InternalPath, ACPI_TYPE_ANY,
- ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL,
- &Node);
-
- (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
-
- if (ACPI_FAILURE (Status))
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Object [%s] not found [%s]\n",
- Pathname, AcpiFormatException (Status)));
- goto Cleanup;
- }
-
- /*
- * Now that we have a handle to the object, we can attempt to evaluate it.
- */
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n",
- Pathname, Node, AcpiNsGetAttachedObject (Node)));
-
- Info->Node = Node;
- Status = AcpiNsEvaluateByHandle (Info);
-
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "*** Completed eval of object %s ***\n",
- Pathname));
-
-Cleanup:
- AcpiUtDeleteGenericState (ScopeInfo);
-
-Cleanup1:
- ACPI_MEM_FREE (InternalPath);
- return_ACPI_STATUS (Status);
-}
-
/*******************************************************************************
*
- * FUNCTION: AcpiNsEvaluateByName
+ * FUNCTION: AcpiNsEvaluate
*
- * PARAMETERS: Pathname - Fully qualified pathname to the object
- * Info - Method info block, contains:
- * ReturnObject - Where to put method's return value (if
- * any). If NULL, no value is returned.
- * Params - List of parameters to pass to the method,
- * terminated by NULL. Params itself may be
- * NULL if no parameters are being passed.
- *
- * RETURN: Status
- *
- * DESCRIPTION: Evaluate the object or rind and execute the requested method
- * passing the given parameters
- *
- * MUTEX: Locks Namespace
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiNsEvaluateByName (
- char *Pathname,
- ACPI_PARAMETER_INFO *Info)
-{
- ACPI_STATUS Status;
- char *InternalPath = NULL;
-
-
- ACPI_FUNCTION_TRACE ("NsEvaluateByName");
-
-
- /* Build an internal name string for the method */
-
- Status = AcpiNsInternalizeName (Pathname, &InternalPath);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
-
- /* Lookup the name in the namespace */
-
- Status = AcpiNsLookup (NULL, InternalPath, ACPI_TYPE_ANY,
- ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL,
- &Info->Node);
-
- (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
-
- if (ACPI_FAILURE (Status))
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
- "Object at [%s] was not found, status=%.4X\n",
- Pathname, Status));
- goto Cleanup;
- }
-
- /*
- * Now that we have a handle to the object, we can attempt to evaluate it.
- */
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n",
- Pathname, Info->Node, AcpiNsGetAttachedObject (Info->Node)));
-
- Status = AcpiNsEvaluateByHandle (Info);
-
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "*** Completed eval of object %s ***\n",
- Pathname));
-
-
-Cleanup:
-
- /* Cleanup */
-
- if (InternalPath)
- {
- ACPI_MEM_FREE (InternalPath);
- }
-
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiNsEvaluateByHandle
- *
- * PARAMETERS: Info - Method info block, contains:
- * Node - Method/Object Node to execute
+ * PARAMETERS: Info - Evaluation info block, contains:
+ * PrefixNode - Prefix or Method/Object Node to execute
+ * Pathname - Name of method to execute, If NULL, the
+ * Node is the object to execute
* Parameters - List of parameters to pass to the method,
* terminated by NULL. Params itself may be
* NULL if no parameters are being passed.
@@ -350,34 +143,26 @@ Cleanup:
* ParameterType - Type of Parameter list
* ReturnObject - Where to put method's return value (if
* any). If NULL, no value is returned.
+ * Flags - ACPI_IGNORE_RETURN_VALUE to delete return
*
* RETURN: Status
*
- * DESCRIPTION: Evaluate object or execute the requested method passing the
- * given parameters
+ * DESCRIPTION: Execute a control method or return the current value of an
+ * ACPI namespace object.
*
- * MUTEX: Locks Namespace
+ * MUTEX: Locks interpreter
*
******************************************************************************/
ACPI_STATUS
-AcpiNsEvaluateByHandle (
- ACPI_PARAMETER_INFO *Info)
+AcpiNsEvaluate (
+ ACPI_EVALUATE_INFO *Info)
{
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("NsEvaluateByHandle");
-
-
- /* Check if namespace has been initialized */
-
- if (!AcpiGbl_RootNode)
- {
- return_ACPI_STATUS (AE_NO_NAMESPACE);
- }
+ ACPI_FUNCTION_TRACE (NsEvaluate);
- /* Parameter Validation */
if (!Info)
{
@@ -388,229 +173,144 @@ AcpiNsEvaluateByHandle (
Info->ReturnObject = NULL;
- /* Get the prefix handle and Node */
-
- Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ /*
+ * Get the actual namespace node for the target object. Handles these cases:
+ *
+ * 1) Null node, Pathname (absolute path)
+ * 2) Node, Pathname (path relative to Node)
+ * 3) Node, Null Pathname
+ */
+ Status = AcpiNsGetNode (Info->PrefixNode, Info->Pathname,
+ ACPI_NS_NO_UPSEARCH, &Info->ResolvedNode);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
- Info->Node = AcpiNsMapHandleToNode (Info->Node);
- if (!Info->Node)
- {
- (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
/*
* For a method alias, we must grab the actual method node so that proper
* scoping context will be established before execution.
*/
- if (AcpiNsGetType (Info->Node) == ACPI_TYPE_LOCAL_METHOD_ALIAS)
+ if (AcpiNsGetType (Info->ResolvedNode) == ACPI_TYPE_LOCAL_METHOD_ALIAS)
{
- Info->Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Info->Node->Object);
+ Info->ResolvedNode =
+ ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Info->ResolvedNode->Object);
}
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n", Info->Pathname,
+ Info->ResolvedNode, AcpiNsGetAttachedObject (Info->ResolvedNode)));
+
/*
* Two major cases here:
- * 1) The object is an actual control method -- execute it.
- * 2) The object is not a method -- just return it's current value
*
- * In both cases, the namespace is unlocked by the AcpiNs* procedure
+ * 1) The object is a control method -- execute it
+ * 2) The object is not a method -- just return it's current value
*/
- if (AcpiNsGetType (Info->Node) == ACPI_TYPE_METHOD)
- {
- /*
- * Case 1) We have an actual control method to execute
- */
- Status = AcpiNsExecuteControlMethod (Info);
- }
- else
+ if (AcpiNsGetType (Info->ResolvedNode) == ACPI_TYPE_METHOD)
{
/*
- * Case 2) Object is NOT a method, just return its current value
+ * 1) Object is a control method - execute it
*/
- Status = AcpiNsGetObjectValue (Info);
- }
-
- /*
- * Check if there is a return value on the stack that must be dealt with
- */
- if (Status == AE_CTRL_RETURN_VALUE)
- {
- /* Map AE_CTRL_RETURN_VALUE to AE_OK, we are done with it */
-
- Status = AE_OK;
- }
-
- /*
- * Namespace was unlocked by the handling AcpiNs* function, so we
- * just return
- */
- return_ACPI_STATUS (Status);
-}
+ /* Verify that there is a method object associated with this node */
-/*******************************************************************************
- *
- * FUNCTION: AcpiNsExecuteControlMethod
- *
- * PARAMETERS: Info - Method info block, contains:
- * Node - Method Node to execute
- * ObjDesc - Method object
- * Parameters - List of parameters to pass to the method,
- * terminated by NULL. Params itself may be
- * NULL if no parameters are being passed.
- * ReturnObject - Where to put method's return value (if
- * any). If NULL, no value is returned.
- * ParameterType - Type of Parameter list
- * ReturnObject - Where to put method's return value (if
- * any). If NULL, no value is returned.
- *
- * RETURN: Status
- *
- * DESCRIPTION: Execute the requested method passing the given parameters
- *
- * MUTEX: Assumes namespace is locked
- *
- ******************************************************************************/
-
-static ACPI_STATUS
-AcpiNsExecuteControlMethod (
- ACPI_PARAMETER_INFO *Info)
-{
- ACPI_STATUS Status;
-
-
- ACPI_FUNCTION_TRACE ("NsExecuteControlMethod");
-
-
- /* Verify that there is a method associated with this object */
-
- Info->ObjDesc = AcpiNsGetAttachedObject (Info->Node);
- if (!Info->ObjDesc)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No attached method object\n"));
-
- (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
- return_ACPI_STATUS (AE_NULL_OBJECT);
- }
+ Info->ObjDesc = AcpiNsGetAttachedObject (Info->ResolvedNode);
+ if (!Info->ObjDesc)
+ {
+ ACPI_ERROR ((AE_INFO, "Control method has no attached sub-object"));
+ return_ACPI_STATUS (AE_NULL_OBJECT);
+ }
- ACPI_DUMP_PATHNAME (Info->Node, "Execute Method:",
- ACPI_LV_INFO, _COMPONENT);
+ ACPI_DUMP_PATHNAME (Info->ResolvedNode, "Execute Method:",
+ ACPI_LV_INFO, _COMPONENT);
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Method at AML address %p Length %X\n",
- Info->ObjDesc->Method.AmlStart + 1, Info->ObjDesc->Method.AmlLength - 1));
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "Method at AML address %p Length %X\n",
+ Info->ObjDesc->Method.AmlStart + 1,
+ Info->ObjDesc->Method.AmlLength - 1));
- /*
- * Unlock the namespace before execution. This allows namespace access
- * via the external Acpi* interfaces while a method is being executed.
- * However, any namespace deletion must acquire both the namespace and
- * interpreter locks to ensure that no thread is using the portion of the
- * namespace that is being deleted.
- */
- Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
+ /*
+ * Any namespace deletion must acquire both the namespace and
+ * interpreter locks to ensure that no thread is using the portion of
+ * the namespace that is being deleted.
+ *
+ * Execute the method via the interpreter. The interpreter is locked
+ * here before calling into the AML parser
+ */
+ AcpiExEnterInterpreter ();
+ Status = AcpiPsExecuteMethod (Info);
+ AcpiExExitInterpreter ();
}
-
- /*
- * Execute the method via the interpreter. The interpreter is locked
- * here before calling into the AML parser
- */
- Status = AcpiExEnterInterpreter ();
- if (ACPI_FAILURE (Status))
+ else
{
- return_ACPI_STATUS (Status);
- }
-
- Status = AcpiPsExecuteMethod (Info);
- AcpiExExitInterpreter ();
-
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiNsGetObjectValue
- *
- * PARAMETERS: Info - Method info block, contains:
- * Node - Object's NS node
- * ReturnObject - Where to put object value (if
- * any). If NULL, no value is returned.
- *
- * RETURN: Status
- *
- * DESCRIPTION: Return the current value of the object
- *
- * MUTEX: Assumes namespace is locked, leaves namespace unlocked
- *
- ******************************************************************************/
-
-static ACPI_STATUS
-AcpiNsGetObjectValue (
- ACPI_PARAMETER_INFO *Info)
-{
- ACPI_STATUS Status = AE_OK;
- ACPI_NAMESPACE_NODE *ResolvedNode = Info->Node;
-
-
- ACPI_FUNCTION_TRACE ("NsGetObjectValue");
+ /*
+ * 2) Object is not a method, return its current value
+ */
+ /*
+ * Objects require additional resolution steps (e.g., the Node may be
+ * a field that must be read, etc.) -- we can't just grab the object
+ * out of the node.
+ *
+ * Use ResolveNodeToValue() to get the associated value.
+ *
+ * NOTE: we can get away with passing in NULL for a walk state because
+ * ResolvedNode is guaranteed to not be a reference to either a method
+ * local or a method argument (because this interface is never called
+ * from a running method.)
+ *
+ * Even though we do not directly invoke the interpreter for object
+ * resolution, we must lock it because we could access an opregion.
+ * The opregion access code assumes that the interpreter is locked.
+ */
+ AcpiExEnterInterpreter ();
- /*
- * Objects require additional resolution steps (e.g., the Node may be a
- * field that must be read, etc.) -- we can't just grab the object out of
- * the node.
- */
+ /* Function has a strange interface */
- /*
- * Use ResolveNodeToValue() to get the associated value. This call always
- * deletes ObjDesc (allocated above).
- *
- * NOTE: we can get away with passing in NULL for a walk state because
- * ObjDesc is guaranteed to not be a reference to either a method local or
- * a method argument (because this interface can only be called from the
- * AcpiEvaluate external interface, never called from a running method.)
- *
- * Even though we do not directly invoke the interpreter for this, we must
- * enter it because we could access an opregion. The opregion access code
- * assumes that the interpreter is locked.
- *
- * We must release the namespace lock before entering the intepreter.
- */
- Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
+ Status = AcpiExResolveNodeToValue (&Info->ResolvedNode, NULL);
+ AcpiExExitInterpreter ();
- Status = AcpiExEnterInterpreter ();
- if (ACPI_SUCCESS (Status))
- {
- Status = AcpiExResolveNodeToValue (&ResolvedNode, NULL);
/*
* If AcpiExResolveNodeToValue() succeeded, the return value was placed
* in ResolvedNode.
*/
- AcpiExExitInterpreter ();
-
if (ACPI_SUCCESS (Status))
{
Status = AE_CTRL_RETURN_VALUE;
- Info->ReturnObject = ACPI_CAST_PTR
- (ACPI_OPERAND_OBJECT, ResolvedNode);
+ Info->ReturnObject =
+ ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Info->ResolvedNode);
+
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Returning object %p [%s]\n",
Info->ReturnObject,
AcpiUtGetObjectTypeName (Info->ReturnObject)));
}
}
- /* Namespace is unlocked */
+ /*
+ * 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 */
+
+ if (Info->Flags & ACPI_IGNORE_RETURN_VALUE)
+ {
+ AcpiUtRemoveReference (Info->ReturnObject);
+ Info->ReturnObject = NULL;
+ }
+
+ /* Map AE_CTRL_RETURN_VALUE to AE_OK, we are done with it */
+ Status = AE_OK;
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
+ "*** Completed evaluation of object %s ***\n", Info->Pathname));
+
+ /*
+ * Namespace was unlocked by the handling AcpiNs* function, so we
+ * just return
+ */
return_ACPI_STATUS (Status);
}
diff --git a/sys/contrib/dev/acpica/nsinit.c b/sys/contrib/dev/acpica/nsinit.c
index 70a4d27..e06ccf7 100644
--- a/sys/contrib/dev/acpica/nsinit.c
+++ b/sys/contrib/dev/acpica/nsinit.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: nsinit - namespace initialization
- * $Revision: 1.68 $
+ * $Revision: 1.86 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -141,6 +141,13 @@ AcpiNsInitOneDevice (
void *Context,
void **ReturnValue);
+static ACPI_STATUS
+AcpiNsFindIniMethods (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue);
+
/*******************************************************************************
*
@@ -163,7 +170,7 @@ AcpiNsInitializeObjects (
ACPI_INIT_WALK_INFO Info;
- ACPI_FUNCTION_TRACE ("NsInitializeObjects");
+ ACPI_FUNCTION_TRACE (NsInitializeObjects);
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
@@ -182,8 +189,7 @@ AcpiNsInitializeObjects (
&Info, NULL);
if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "WalkNamespace failed! %s\n",
- AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status, "During WalkNamespace"));
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
@@ -226,7 +232,7 @@ AcpiNsInitializeDevices (
ACPI_DEVICE_WALK_INFO Info;
- ACPI_FUNCTION_TRACE ("NsInitializeDevices");
+ ACPI_FUNCTION_TRACE (NsInitializeDevices);
/* Init counters */
@@ -236,32 +242,47 @@ AcpiNsInitializeDevices (
Info.Num_INI = 0;
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
- "Executing all Device _STA and_INI methods:"));
+ "Initializing Device/Processor/Thermal objects by executing _INI methods:"));
+
+ /* Tree analysis: find all subtrees that contain _INI methods */
- Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
+ ACPI_UINT32_MAX, FALSE, AcpiNsFindIniMethods, &Info, NULL);
if (ACPI_FAILURE (Status))
{
- return_ACPI_STATUS (Status);
+ goto ErrorExit;
}
- /* Walk namespace for all objects */
+ /* Allocate the evaluation information block */
- Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
- ACPI_UINT32_MAX, TRUE, AcpiNsInitOneDevice, &Info, NULL);
+ Info.EvaluateInfo = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO));
+ if (!Info.EvaluateInfo)
+ {
+ Status = AE_NO_MEMORY;
+ goto ErrorExit;
+ }
- (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ /* Walk namespace to execute all _INIs on present devices */
+ Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
+ ACPI_UINT32_MAX, FALSE, AcpiNsInitOneDevice, &Info, NULL);
+
+ ACPI_FREE (Info.EvaluateInfo);
if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "WalkNamespace failed! %s\n",
- AcpiFormatException (Status)));
+ goto ErrorExit;
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
- "\n%hd Devices found containing: %hd _STA, %hd _INI methods\n",
- Info.DeviceCount, Info.Num_STA, Info.Num_INI));
+ "\nExecuted %hd _INI methods requiring %hd _STA executions (examined %hd objects)\n",
+ Info.Num_INI, Info.Num_STA, Info.DeviceCount));
return_ACPI_STATUS (Status);
+
+
+ErrorExit:
+ ACPI_EXCEPTION ((AE_INFO, Status, "During device initialization"));
+ return_ACPI_STATUS (Status);
}
@@ -293,13 +314,13 @@ AcpiNsInitOneObject (
void **ReturnValue)
{
ACPI_OBJECT_TYPE Type;
- ACPI_STATUS Status;
+ ACPI_STATUS Status = AE_OK;
ACPI_INIT_WALK_INFO *Info = (ACPI_INIT_WALK_INFO *) Context;
ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_FUNCTION_NAME ("NsInitOneObject");
+ ACPI_FUNCTION_NAME (NsInitOneObject);
Info->ObjectCount++;
@@ -350,11 +371,7 @@ AcpiNsInitOneObject (
/*
* Must lock the interpreter before executing AML code
*/
- Status = AcpiExEnterInterpreter ();
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
+ AcpiExEnterInterpreter ();
/*
* Each of these types can contain executable AML code within the
@@ -393,11 +410,9 @@ AcpiNsInitOneObject (
if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ERROR, "\n"));
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Could not execute arguments for [%4.4s] (%s), %s\n",
- AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Type),
- AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Could not execute arguments for [%4.4s] (%s)",
+ AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Type)));
}
/*
@@ -420,6 +435,80 @@ AcpiNsInitOneObject (
/*******************************************************************************
*
+ * FUNCTION: AcpiNsFindIniMethods
+ *
+ * PARAMETERS: ACPI_WALK_CALLBACK
+ *
+ * RETURN: ACPI_STATUS
+ *
+ * DESCRIPTION: Called during namespace walk. Finds objects named _INI under
+ * device/processor/thermal objects, and marks the entire subtree
+ * with a SUBTREE_HAS_INI flag. This flag is used during the
+ * subsequent device initialization walk to avoid entire subtrees
+ * that do not contain an _INI.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiNsFindIniMethods (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue)
+{
+ ACPI_DEVICE_WALK_INFO *Info = ACPI_CAST_PTR (ACPI_DEVICE_WALK_INFO, Context);
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_NAMESPACE_NODE *ParentNode;
+
+
+ /* Keep count of device/processor/thermal objects */
+
+ Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle);
+ if ((Node->Type == ACPI_TYPE_DEVICE) ||
+ (Node->Type == ACPI_TYPE_PROCESSOR) ||
+ (Node->Type == ACPI_TYPE_THERMAL))
+ {
+ Info->DeviceCount++;
+ return (AE_OK);
+ }
+
+ /* We are only looking for methods named _INI */
+
+ if (!ACPI_COMPARE_NAME (Node->Name.Ascii, METHOD_NAME__INI))
+ {
+ return (AE_OK);
+ }
+
+ /*
+ * The only _INI methods that we care about are those that are
+ * present under Device, Processor, and Thermal objects.
+ */
+ ParentNode = AcpiNsGetParentNode (Node);
+ switch (ParentNode->Type)
+ {
+ case ACPI_TYPE_DEVICE:
+ case ACPI_TYPE_PROCESSOR:
+ case ACPI_TYPE_THERMAL:
+
+ /* Mark parent and bubble up the INI present flag to the root */
+
+ while (ParentNode)
+ {
+ ParentNode->Flags |= ANOBJ_SUBTREE_HAS_INI;
+ ParentNode = AcpiNsGetParentNode (ParentNode);
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiNsInitOneDevice
*
* PARAMETERS: ACPI_WALK_CALLBACK
@@ -439,117 +528,173 @@ AcpiNsInitOneDevice (
void *Context,
void **ReturnValue)
{
- ACPI_DEVICE_WALK_INFO *Info = (ACPI_DEVICE_WALK_INFO *) Context;
- ACPI_PARAMETER_INFO Pinfo;
+ ACPI_DEVICE_WALK_INFO *WalkInfo = ACPI_CAST_PTR (ACPI_DEVICE_WALK_INFO, Context);
+ ACPI_EVALUATE_INFO *Info = WalkInfo->EvaluateInfo;
UINT32 Flags;
ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *DeviceNode;
- ACPI_FUNCTION_TRACE ("NsInitOneDevice");
+ ACPI_FUNCTION_TRACE (NsInitOneDevice);
- Pinfo.Parameters = NULL;
- Pinfo.ParameterType = ACPI_PARAM_ARGS;
+ /* We are interested in Devices, Processors and ThermalZones only */
- Pinfo.Node = AcpiNsMapHandleToNode (ObjHandle);
- if (!Pinfo.Node)
+ DeviceNode = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle);
+ if ((DeviceNode->Type != ACPI_TYPE_DEVICE) &&
+ (DeviceNode->Type != ACPI_TYPE_PROCESSOR) &&
+ (DeviceNode->Type != ACPI_TYPE_THERMAL))
{
- return_ACPI_STATUS (AE_BAD_PARAMETER);
+ return_ACPI_STATUS (AE_OK);
}
/*
- * We will run _STA/_INI on Devices, Processors and ThermalZones only
+ * Because of an earlier namespace analysis, all subtrees that contain an
+ * _INI method are tagged.
+ *
+ * If this device subtree does not contain any _INI methods, we
+ * can exit now and stop traversing this entire subtree.
*/
- if ((Pinfo.Node->Type != ACPI_TYPE_DEVICE) &&
- (Pinfo.Node->Type != ACPI_TYPE_PROCESSOR) &&
- (Pinfo.Node->Type != ACPI_TYPE_THERMAL))
+ if (!(DeviceNode->Flags & ANOBJ_SUBTREE_HAS_INI))
{
- return_ACPI_STATUS (AE_OK);
+ return_ACPI_STATUS (AE_CTRL_DEPTH);
}
- if ((AcpiDbgLevel <= ACPI_LV_ALL_EXCEPTIONS) &&
- (!(AcpiDbgLevel & ACPI_LV_INFO)))
- {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "."));
- }
-
- Info->DeviceCount++;
-
/*
- * Run _STA to determine if we can run _INI on the device.
+ * Run _STA to determine if this device is present and functioning. We
+ * must know this information for two important reasons (from ACPI spec):
+ *
+ * 1) We can only run _INI if the device is present.
+ * 2) We must abort the device tree walk on this subtree if the device is
+ * not present and is not functional (we will not examine the children)
+ *
+ * The _STA method is not required to be present under the device, we
+ * assume the device is present if _STA does not exist.
*/
- ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (ACPI_TYPE_METHOD,
- Pinfo.Node, METHOD_NAME__STA));
- Status = AcpiUtExecute_STA (Pinfo.Node, &Flags);
+ ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (
+ ACPI_TYPE_METHOD, DeviceNode, METHOD_NAME__STA));
+ Status = AcpiUtExecute_STA (DeviceNode, &Flags);
if (ACPI_FAILURE (Status))
{
- if (Pinfo.Node->Type == ACPI_TYPE_DEVICE)
- {
- /* Ignore error and move on to next device */
+ /* Ignore error and move on to next device */
- return_ACPI_STATUS (AE_OK);
- }
+ return_ACPI_STATUS (AE_OK);
+ }
- /* _STA is not required for Processor or ThermalZone objects */
+ /*
+ * Flags == -1 means that _STA was not found. In this case, we assume that
+ * the device is both present and functional.
+ *
+ * From the ACPI spec, description of _STA:
+ *
+ * "If a device object (including the processor object) does not have an
+ * _STA object, then OSPM assumes that all of the above bits are set (in
+ * other words, the device is present, ..., and functioning)"
+ */
+ if (Flags != ACPI_UINT32_MAX)
+ {
+ WalkInfo->Num_STA++;
}
- else
+
+ /*
+ * Examine the PRESENT and FUNCTIONING status bits
+ *
+ * Note: ACPI spec does not seem to specify behavior for the present but
+ * not functioning case, so we assume functioning if present.
+ */
+ if (!(Flags & ACPI_STA_DEVICE_PRESENT))
{
- Info->Num_STA++;
+ /* Device is not present, we must examine the Functioning bit */
- if (!(Flags & 0x01))
+ if (Flags & ACPI_STA_DEVICE_FUNCTIONING)
{
- /* Don't look at children of a not present device */
-
- return_ACPI_STATUS(AE_CTRL_DEPTH);
+ /*
+ * Device is not present but is "functioning". In this case,
+ * we will not run _INI, but we continue to examine the children
+ * of this device.
+ *
+ * From the ACPI spec, description of _STA: (Note - no mention
+ * of whether to run _INI or not on the device in question)
+ *
+ * "_STA may return bit 0 clear (not present) with bit 3 set
+ * (device is functional). This case is used to indicate a valid
+ * device for which no device driver should be loaded (for example,
+ * a bridge device.) Children of this device may be present and
+ * valid. OSPM should continue enumeration below a device whose
+ * _STA returns this bit combination"
+ */
+ return_ACPI_STATUS (AE_OK);
+ }
+ else
+ {
+ /*
+ * Device is not present and is not functioning. We must abort the
+ * walk of this subtree immediately -- don't look at the children
+ * of such a device.
+ *
+ * From the ACPI spec, description of _INI:
+ *
+ * "If the _STA method indicates that the device is not present,
+ * OSPM will not run the _INI and will not examine the children
+ * of the device for _INI methods"
+ */
+ return_ACPI_STATUS (AE_CTRL_DEPTH);
}
}
/*
- * The device is present. Run _INI.
+ * The device is present or is assumed present if no _STA exists.
+ * Run the _INI if it exists (not required to exist)
+ *
+ * Note: We know there is an _INI within this subtree, but it may not be
+ * under this particular device, it may be lower in the branch.
*/
- ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (ACPI_TYPE_METHOD,
- Pinfo.Node, METHOD_NAME__INI));
- Status = AcpiNsEvaluateRelative (METHOD_NAME__INI, &Pinfo);
- if (ACPI_FAILURE (Status))
+ ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (
+ ACPI_TYPE_METHOD, DeviceNode, METHOD_NAME__INI));
+
+ 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);
+ if (ACPI_SUCCESS (Status))
{
- /* No _INI (AE_NOT_FOUND) means device requires no initialization */
+ WalkInfo->Num_INI++;
- if (Status != AE_NOT_FOUND)
+ if ((AcpiDbgLevel <= ACPI_LV_ALL_EXCEPTIONS) &&
+ (!(AcpiDbgLevel & ACPI_LV_INFO)))
{
- /* Ignore error and move on to next device */
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "."));
+ }
+ }
#ifdef ACPI_DEBUG_OUTPUT
- char *ScopeName = AcpiNsGetExternalPathname (Pinfo.Node);
-
- ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "%s._INI failed: %s\n",
- ScopeName, AcpiFormatException (Status)));
+ else if (Status != AE_NOT_FOUND)
+ {
+ /* Ignore error and move on to next device */
- ACPI_MEM_FREE (ScopeName);
-#endif
- }
+ char *ScopeName = AcpiNsGetExternalPathname (Info->ResolvedNode);
- Status = AE_OK;
+ ACPI_EXCEPTION ((AE_INFO, Status, "during %s._INI execution",
+ ScopeName));
+ ACPI_FREE (ScopeName);
}
- else
- {
- /* Delete any return object (especially if ImplicitReturn is enabled) */
-
- if (Pinfo.ReturnObject)
- {
- AcpiUtRemoveReference (Pinfo.ReturnObject);
- }
+#endif
- /* Count of successful INIs */
+ /* Ignore errors from above */
- Info->Num_INI++;
- }
+ Status = AE_OK;
+ /*
+ * The _INI method has been run if present; call the Global Initialization
+ * Handler for this device.
+ */
if (AcpiGbl_InitHandler)
{
- /* External initialization handler is present, call it */
-
- Status = AcpiGbl_InitHandler (Pinfo.Node, ACPI_INIT_DEVICE_INI);
+ Status = AcpiGbl_InitHandler (DeviceNode, ACPI_INIT_DEVICE_INI);
}
return_ACPI_STATUS (Status);
diff --git a/sys/contrib/dev/acpica/nsload.c b/sys/contrib/dev/acpica/nsload.c
index ea99510..07dd567 100644
--- a/sys/contrib/dev/acpica/nsload.c
+++ b/sys/contrib/dev/acpica/nsload.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: nsload - namespace loading/expanding/contracting procedures
- * $Revision: 1.73 $
+ * $Revision: 1.80 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -119,6 +119,7 @@
#include <contrib/dev/acpica/acpi.h>
#include <contrib/dev/acpica/acnamesp.h>
#include <contrib/dev/acpica/acdispat.h>
+#include <contrib/dev/acpica/actables.h>
#define _COMPONENT ACPI_NAMESPACE
@@ -126,10 +127,6 @@
/* Local prototypes */
-static ACPI_STATUS
-AcpiNsLoadTableByType (
- ACPI_TABLE_TYPE TableType);
-
#ifdef ACPI_FUTURE_IMPLEMENTATION
ACPI_STATUS
AcpiNsUnloadNamespace (
@@ -146,7 +143,7 @@ AcpiNsDeleteSubtree (
*
* FUNCTION: AcpiNsLoadTable
*
- * PARAMETERS: TableDesc - Descriptor for table to be loaded
+ * PARAMETERS: TableIndex - Index for table to be loaded
* Node - Owning NS node
*
* RETURN: Status
@@ -157,43 +154,14 @@ AcpiNsDeleteSubtree (
ACPI_STATUS
AcpiNsLoadTable (
- ACPI_TABLE_DESC *TableDesc,
+ ACPI_NATIVE_UINT TableIndex,
ACPI_NAMESPACE_NODE *Node)
{
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("NsLoadTable");
-
-
- /* Check if table contains valid AML (must be DSDT, PSDT, SSDT, etc.) */
-
- if (!(AcpiGbl_TableData[TableDesc->Type].Flags & ACPI_TABLE_EXECUTABLE))
- {
- /* Just ignore this table */
-
- return_ACPI_STATUS (AE_OK);
- }
-
- /* Check validity of the AML start and length */
+ ACPI_FUNCTION_TRACE (NsLoadTable);
- if (!TableDesc->AmlStart)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null AML pointer\n"));
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "AML block at %p\n",
- TableDesc->AmlStart));
-
- /* Ignore table if there is no AML contained within */
-
- if (!TableDesc->AmlLength)
- {
- ACPI_REPORT_WARNING (("Zero-length AML block in table [%4.4s]\n",
- TableDesc->Pointer->Signature));
- return_ACPI_STATUS (AE_OK);
- }
/*
* Parse the table and load the namespace with all named
@@ -204,16 +172,40 @@ AcpiNsLoadTable (
* to another control method, we can't continue parsing
* because we don't know how many arguments to parse next!
*/
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* If table already loaded into namespace, just return */
+
+ if (AcpiTbIsTableLoaded (TableIndex))
+ {
+ Status = AE_ALREADY_EXISTS;
+ goto Unlock;
+ }
+
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"**** Loading table into namespace ****\n"));
- Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ Status = AcpiTbAllocateOwnerId (TableIndex);
if (ACPI_FAILURE (Status))
{
- return_ACPI_STATUS (Status);
+ goto Unlock;
}
- Status = AcpiNsParseTable (TableDesc, Node->Child);
+ Status = AcpiNsParseTable (TableIndex, Node->Child);
+ if (ACPI_SUCCESS (Status))
+ {
+ AcpiTbSetTableLoadedFlag (TableIndex, TRUE);
+ }
+ else
+ {
+ AcpiTbReleaseOwnerId (TableIndex);
+ }
+
+Unlock:
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (Status))
@@ -230,7 +222,7 @@ AcpiNsLoadTable (
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"**** Begin Table Method Parsing and Object Initialization ****\n"));
- Status = AcpiDsInitializeObjects (TableDesc, Node);
+ Status = AcpiDsInitializeObjects (TableIndex, Node);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"**** Completed Table Method Parsing and Object Initialization ****\n"));
@@ -239,111 +231,7 @@ AcpiNsLoadTable (
}
-/*******************************************************************************
- *
- * FUNCTION: AcpiNsLoadTableByType
- *
- * PARAMETERS: TableType - Id of the table type to load
- *
- * RETURN: Status
- *
- * DESCRIPTION: Load an ACPI table or tables into the namespace. All tables
- * of the given type are loaded. The mechanism allows this
- * routine to be called repeatedly.
- *
- ******************************************************************************/
-
-static ACPI_STATUS
-AcpiNsLoadTableByType (
- ACPI_TABLE_TYPE TableType)
-{
- UINT32 i;
- ACPI_STATUS Status;
- ACPI_TABLE_DESC *TableDesc;
-
-
- ACPI_FUNCTION_TRACE ("NsLoadTableByType");
-
-
- Status = AcpiUtAcquireMutex (ACPI_MTX_TABLES);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /*
- * Table types supported are:
- * DSDT (one), SSDT/PSDT (multiple)
- */
- switch (TableType)
- {
- case ACPI_TABLE_DSDT:
-
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace load: DSDT\n"));
-
- TableDesc = AcpiGbl_TableLists[ACPI_TABLE_DSDT].Next;
-
- /* If table already loaded into namespace, just return */
-
- if (TableDesc->LoadedIntoNamespace)
- {
- goto UnlockAndExit;
- }
-
- /* Now load the single DSDT */
-
- Status = AcpiNsLoadTable (TableDesc, AcpiGbl_RootNode);
- if (ACPI_SUCCESS (Status))
- {
- TableDesc->LoadedIntoNamespace = TRUE;
- }
- break;
-
-
- case ACPI_TABLE_SSDT:
- case ACPI_TABLE_PSDT:
-
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace load: %d SSDT or PSDTs\n",
- AcpiGbl_TableLists[TableType].Count));
-
- /*
- * Traverse list of SSDT or PSDT tables
- */
- TableDesc = AcpiGbl_TableLists[TableType].Next;
- for (i = 0; i < AcpiGbl_TableLists[TableType].Count; i++)
- {
- /*
- * Only attempt to load table into namespace if it is not
- * already loaded!
- */
- if (!TableDesc->LoadedIntoNamespace)
- {
- Status = AcpiNsLoadTable (TableDesc, AcpiGbl_RootNode);
- if (ACPI_FAILURE (Status))
- {
- break;
- }
-
- TableDesc->LoadedIntoNamespace = TRUE;
- }
-
- TableDesc = TableDesc->Next;
- }
- break;
-
-
- default:
- Status = AE_SUPPORT;
- break;
- }
-
-
-UnlockAndExit:
- (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
- return_ACPI_STATUS (Status);
-}
-
-
+#ifdef ACPI_OBSOLETE_FUNCTIONS
/*******************************************************************************
*
* FUNCTION: AcpiLoadNamespace
@@ -364,14 +252,14 @@ AcpiNsLoadNamespace (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("AcpiLoadNameSpace");
+ ACPI_FUNCTION_TRACE (AcpiLoadNameSpace);
/* There must be at least a DSDT installed */
if (AcpiGbl_DSDT == NULL)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "DSDT is not in memory\n"));
+ ACPI_ERROR ((AE_INFO, "DSDT is not in memory"));
return_ACPI_STATUS (AE_NO_ACPI_TABLES);
}
@@ -379,7 +267,7 @@ AcpiNsLoadNamespace (
* Load the namespace. The DSDT is required,
* but the SSDT and PSDT tables are optional.
*/
- Status = AcpiNsLoadTableByType (ACPI_TABLE_DSDT);
+ Status = AcpiNsLoadTableByType (ACPI_TABLE_ID_DSDT);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -387,8 +275,8 @@ AcpiNsLoadNamespace (
/* Ignore exceptions from these */
- (void) AcpiNsLoadTableByType (ACPI_TABLE_SSDT);
- (void) AcpiNsLoadTableByType (ACPI_TABLE_PSDT);
+ (void) AcpiNsLoadTableByType (ACPI_TABLE_ID_SSDT);
+ (void) AcpiNsLoadTableByType (ACPI_TABLE_ID_PSDT);
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
"ACPI Namespace successfully loaded at root %p\n",
@@ -396,7 +284,7 @@ AcpiNsLoadNamespace (
return_ACPI_STATUS (Status);
}
-
+#endif
#ifdef ACPI_FUTURE_IMPLEMENTATION
/*******************************************************************************
@@ -427,7 +315,7 @@ AcpiNsDeleteSubtree (
UINT32 Level;
- ACPI_FUNCTION_TRACE ("NsDeleteSubtree");
+ ACPI_FUNCTION_TRACE (NsDeleteSubtree);
ParentHandle = StartHandle;
@@ -515,7 +403,7 @@ AcpiNsUnloadNamespace (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("NsUnloadNameSpace");
+ ACPI_FUNCTION_TRACE (NsUnloadNameSpace);
/* Parameter validation */
diff --git a/sys/contrib/dev/acpica/nsnames.c b/sys/contrib/dev/acpica/nsnames.c
index 315257b..8ff7aaf 100644
--- a/sys/contrib/dev/acpica/nsnames.c
+++ b/sys/contrib/dev/acpica/nsnames.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: nsnames - Name manipulation and search
- * $Revision: 1.91 $
+ * $Revision: 1.98 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -124,14 +124,6 @@
#define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME ("nsnames")
-/* Local prototypes */
-
-static void
-AcpiNsBuildExternalPath (
- ACPI_NAMESPACE_NODE *Node,
- ACPI_SIZE Size,
- char *NameBuffer);
-
/*******************************************************************************
*
@@ -148,7 +140,7 @@ AcpiNsBuildExternalPath (
*
******************************************************************************/
-static void
+void
AcpiNsBuildExternalPath (
ACPI_NAMESPACE_NODE *Node,
ACPI_SIZE Size,
@@ -158,7 +150,7 @@ AcpiNsBuildExternalPath (
ACPI_NAMESPACE_NODE *ParentNode;
- ACPI_FUNCTION_NAME ("NsBuildExternalPath");
+ ACPI_FUNCTION_ENTRY ();
/* Special case for root */
@@ -197,8 +189,8 @@ AcpiNsBuildExternalPath (
if (Index != 0)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Could not construct pathname; index=%X, size=%X, Path=%s\n",
+ ACPI_ERROR ((AE_INFO,
+ "Could not construct pathname; index=%X, size=%X, Path=%s",
(UINT32) Index, (UINT32) Size, &NameBuffer[Size]));
}
@@ -229,7 +221,7 @@ AcpiNsGetExternalPathname (
ACPI_SIZE Size;
- ACPI_FUNCTION_TRACE_PTR ("NsGetExternalPathname", Node);
+ ACPI_FUNCTION_TRACE_PTR (NsGetExternalPathname, Node);
/* Calculate required buffer size based on depth below root */
@@ -238,10 +230,10 @@ AcpiNsGetExternalPathname (
/* Allocate a buffer to be returned to caller */
- NameBuffer = ACPI_MEM_CALLOCATE (Size);
+ NameBuffer = ACPI_ALLOCATE_ZEROED (Size);
if (!NameBuffer)
{
- ACPI_REPORT_ERROR (("NsGetTablePathname: allocation failure\n"));
+ ACPI_ERROR ((AE_INFO, "Allocation failure"));
return_PTR (NULL);
}
@@ -322,7 +314,7 @@ AcpiNsHandleToPathname (
ACPI_SIZE RequiredSize;
- ACPI_FUNCTION_TRACE_PTR ("NsHandleToPathname", TargetHandle);
+ ACPI_FUNCTION_TRACE_PTR (NsHandleToPathname, TargetHandle);
Node = AcpiNsMapHandleToNode (TargetHandle);
diff --git a/sys/contrib/dev/acpica/nsobject.c b/sys/contrib/dev/acpica/nsobject.c
index 59b8cb0..622638c 100644
--- a/sys/contrib/dev/acpica/nsobject.c
+++ b/sys/contrib/dev/acpica/nsobject.c
@@ -2,7 +2,7 @@
*
* Module Name: nsobject - Utilities for objects attached to namespace
* table entries
- * $Revision: 1.93 $
+ * $Revision: 1.98 $
*
******************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -158,7 +158,7 @@ AcpiNsAttachObject (
ACPI_OBJECT_TYPE ObjectType = ACPI_TYPE_ANY;
- ACPI_FUNCTION_TRACE ("NsAttachObject");
+ ACPI_FUNCTION_TRACE (NsAttachObject);
/*
@@ -168,7 +168,7 @@ AcpiNsAttachObject (
{
/* Invalid handle */
- ACPI_REPORT_ERROR (("NsAttachObject: Null NamedObj handle\n"));
+ ACPI_ERROR ((AE_INFO, "Null NamedObj handle"));
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
@@ -176,8 +176,8 @@ AcpiNsAttachObject (
{
/* Null object */
- ACPI_REPORT_ERROR ((
- "NsAttachObject: Null object, but type not ACPI_TYPE_ANY\n"));
+ ACPI_ERROR ((AE_INFO,
+ "Null object, but type not ACPI_TYPE_ANY"));
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
@@ -185,8 +185,8 @@ AcpiNsAttachObject (
{
/* Not a name handle */
- ACPI_REPORT_ERROR (("NsAttachObject: Invalid handle %p [%s]\n",
- Node, AcpiUtGetDescriptorName (Node)));
+ ACPI_ERROR ((AE_INFO, "Invalid handle %p [%s]",
+ Node, AcpiUtGetDescriptorName (Node)));
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
@@ -298,7 +298,7 @@ AcpiNsDetachObject (
ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_FUNCTION_TRACE ("NsDetachObject");
+ ACPI_FUNCTION_TRACE (NsDetachObject);
ObjDesc = Node->Object;
@@ -353,12 +353,12 @@ ACPI_OPERAND_OBJECT *
AcpiNsGetAttachedObject (
ACPI_NAMESPACE_NODE *Node)
{
- ACPI_FUNCTION_TRACE_PTR ("NsGetAttachedObject", Node);
+ ACPI_FUNCTION_TRACE_PTR (NsGetAttachedObject, Node);
if (!Node)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Null Node ptr\n"));
+ ACPI_WARNING ((AE_INFO, "Null Node ptr"));
return_PTR (NULL);
}
@@ -391,7 +391,7 @@ ACPI_OPERAND_OBJECT *
AcpiNsGetSecondaryObject (
ACPI_OPERAND_OBJECT *ObjDesc)
{
- ACPI_FUNCTION_TRACE_PTR ("NsGetSecondaryObject", ObjDesc);
+ ACPI_FUNCTION_TRACE_PTR (NsGetSecondaryObject, ObjDesc);
if ((!ObjDesc) ||
diff --git a/sys/contrib/dev/acpica/nsparse.c b/sys/contrib/dev/acpica/nsparse.c
index d288632..21ff6a4 100644
--- a/sys/contrib/dev/acpica/nsparse.c
+++ b/sys/contrib/dev/acpica/nsparse.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: nsparse - namespace interface to AML parser
- * $Revision: 1.10 $
+ * $Revision: 1.16 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -120,6 +120,7 @@
#include <contrib/dev/acpica/acnamesp.h>
#include <contrib/dev/acpica/acparser.h>
#include <contrib/dev/acpica/acdispat.h>
+#include <contrib/dev/acpica/actables.h>
#define _COMPONENT ACPI_NAMESPACE
@@ -141,17 +142,27 @@
ACPI_STATUS
AcpiNsOneCompleteParse (
- UINT8 PassNumber,
- ACPI_TABLE_DESC *TableDesc)
+ ACPI_NATIVE_UINT PassNumber,
+ ACPI_NATIVE_UINT TableIndex)
{
ACPI_PARSE_OBJECT *ParseRoot;
ACPI_STATUS Status;
+ ACPI_NATIVE_UINT AmlLength;
+ UINT8 *AmlStart;
ACPI_WALK_STATE *WalkState;
+ ACPI_TABLE_HEADER *Table;
+ ACPI_OWNER_ID OwnerId;
- ACPI_FUNCTION_TRACE ("NsOneCompleteParse");
+ ACPI_FUNCTION_TRACE (NsOneCompleteParse);
+ Status = AcpiTbGetOwnerId (TableIndex, &OwnerId);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
/* Create and init a Root Node */
ParseRoot = AcpiPsCreateScopeOp ();
@@ -162,20 +173,39 @@ AcpiNsOneCompleteParse (
/* Create and initialize a new walk state */
- WalkState = AcpiDsCreateWalkState (TableDesc->OwnerId,
- NULL, NULL, NULL);
+ WalkState = AcpiDsCreateWalkState (OwnerId, NULL, NULL, NULL);
if (!WalkState)
{
AcpiPsFreeOp (ParseRoot);
return_ACPI_STATUS (AE_NO_MEMORY);
}
- Status = AcpiDsInitAmlWalk (WalkState, ParseRoot, NULL,
- TableDesc->AmlStart, TableDesc->AmlLength,
- NULL, PassNumber);
+ Status = AcpiGetTableByIndex (TableIndex, &Table);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiDsDeleteWalkState (WalkState);
+ AcpiPsFreeOp (ParseRoot);
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Table must consist of at least a complete header */
+
+ if (Table->Length < sizeof (ACPI_TABLE_HEADER))
+ {
+ Status = AE_BAD_HEADER;
+ }
+ else
+ {
+ AmlStart = (UINT8 *) Table + sizeof (ACPI_TABLE_HEADER);
+ AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER);
+ Status = AcpiDsInitAmlWalk (WalkState, ParseRoot, NULL,
+ AmlStart, AmlLength, NULL, (UINT8) PassNumber);
+ }
+
if (ACPI_FAILURE (Status))
{
AcpiDsDeleteWalkState (WalkState);
+ AcpiPsDeleteParseTree (ParseRoot);
return_ACPI_STATUS (Status);
}
@@ -204,13 +234,13 @@ AcpiNsOneCompleteParse (
ACPI_STATUS
AcpiNsParseTable (
- ACPI_TABLE_DESC *TableDesc,
+ ACPI_NATIVE_UINT TableIndex,
ACPI_NAMESPACE_NODE *StartNode)
{
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("NsParseTable");
+ ACPI_FUNCTION_TRACE (NsParseTable);
/*
@@ -221,10 +251,10 @@ AcpiNsParseTable (
* each Parser Op subtree is deleted when it is finished. This saves
* a great deal of memory, and allows a small cache of parse objects
* to service the entire parse. The second pass of the parse then
- * performs another complete parse of the AML..
+ * performs another complete parse of the AML.
*/
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 1\n"));
- Status = AcpiNsOneCompleteParse (1, TableDesc);
+ Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS1, TableIndex);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -240,7 +270,7 @@ AcpiNsParseTable (
* parse objects are all cached.
*/
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 2\n"));
- Status = AcpiNsOneCompleteParse (2, TableDesc);
+ Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS2, TableIndex);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
diff --git a/sys/contrib/dev/acpica/nssearch.c b/sys/contrib/dev/acpica/nssearch.c
index 3310dba..23d6ec2 100644
--- a/sys/contrib/dev/acpica/nssearch.c
+++ b/sys/contrib/dev/acpica/nssearch.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: nssearch - Namespace search
- * $Revision: 1.106 $
+ * $Revision: 1.121 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -135,16 +135,16 @@ AcpiNsSearchParentTree (
/*******************************************************************************
*
- * FUNCTION: AcpiNsSearchNode
+ * FUNCTION: AcpiNsSearchOneScope
*
* PARAMETERS: TargetName - Ascii ACPI name to search for
- * Node - Starting node where search will begin
+ * ParentNode - Starting node where search will begin
* Type - Object type to match
* ReturnNode - Where the matched Named obj is returned
*
* RETURN: Status
*
- * DESCRIPTION: Search a single level of the namespace. Performs a
+ * DESCRIPTION: Search a single level of the namespace. Performs a
* simple search of the specified level, and does not add
* entries or search parents.
*
@@ -154,23 +154,28 @@ AcpiNsSearchParentTree (
*
* All namespace searching is linear in this implementation, but
* could be easily modified to support any improved search
- * algorithm. However, the linear search was chosen for simplicity
+ * algorithm. However, the linear search was chosen for simplicity
* and because the trees are small and the other interpreter
* execution overhead is relatively high.
*
+ * Note: CPU execution analysis has shown that the AML interpreter spends
+ * a very small percentage of its time searching the namespace. Therefore,
+ * the linear search seems to be sufficient, as there would seem to be
+ * little value in improving the search.
+ *
******************************************************************************/
ACPI_STATUS
-AcpiNsSearchNode (
+AcpiNsSearchOneScope (
UINT32 TargetName,
- ACPI_NAMESPACE_NODE *Node,
+ ACPI_NAMESPACE_NODE *ParentNode,
ACPI_OBJECT_TYPE Type,
ACPI_NAMESPACE_NODE **ReturnNode)
{
- ACPI_NAMESPACE_NODE *NextNode;
+ ACPI_NAMESPACE_NODE *Node;
- ACPI_FUNCTION_TRACE ("NsSearchNode");
+ ACPI_FUNCTION_TRACE (NsSearchOneScope);
#ifdef ACPI_DEBUG_OUTPUT
@@ -178,15 +183,15 @@ AcpiNsSearchNode (
{
char *ScopeName;
- ScopeName = AcpiNsGetExternalPathname (Node);
+ ScopeName = AcpiNsGetExternalPathname (ParentNode);
if (ScopeName)
{
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"Searching %s (%p) For [%4.4s] (%s)\n",
- ScopeName, Node, (char *) &TargetName,
+ ScopeName, ParentNode, ACPI_CAST_PTR (char, &TargetName),
AcpiUtGetTypeName (Type)));
- ACPI_MEM_FREE (ScopeName);
+ ACPI_FREE (ScopeName);
}
}
#endif
@@ -195,29 +200,29 @@ AcpiNsSearchNode (
* Search for name at this namespace level, which is to say that we
* must search for the name among the children of this object
*/
- NextNode = Node->Child;
- while (NextNode)
+ Node = ParentNode->Child;
+ while (Node)
{
/* Check for match against the name */
- if (NextNode->Name.Integer == TargetName)
+ if (Node->Name.Integer == TargetName)
{
/* Resolve a control method alias if any */
- if (AcpiNsGetType (NextNode) == ACPI_TYPE_LOCAL_METHOD_ALIAS)
+ if (AcpiNsGetType (Node) == ACPI_TYPE_LOCAL_METHOD_ALIAS)
{
- NextNode = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, NextNode->Object);
+ Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Node->Object);
}
- /*
- * Found matching entry.
- */
+ /* Found matching entry */
+
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"Name [%4.4s] (%s) %p found in scope [%4.4s] %p\n",
- (char *) &TargetName, AcpiUtGetTypeName (NextNode->Type),
- NextNode, AcpiUtGetNodeName (Node), Node));
+ ACPI_CAST_PTR (char, &TargetName),
+ AcpiUtGetTypeName (Node->Type),
+ Node, AcpiUtGetNodeName (ParentNode), ParentNode));
- *ReturnNode = NextNode;
+ *ReturnNode = Node;
return_ACPI_STATUS (AE_OK);
}
@@ -225,7 +230,7 @@ AcpiNsSearchNode (
* The last entry in the list points back to the parent,
* so a flag is used to indicate the end-of-list
*/
- if (NextNode->Flags & ANOBJ_END_OF_PEER_LIST)
+ if (Node->Flags & ANOBJ_END_OF_PEER_LIST)
{
/* Searched entire list, we are done */
@@ -234,15 +239,15 @@ AcpiNsSearchNode (
/* Didn't match name, move on to the next peer object */
- NextNode = NextNode->Peer;
+ Node = Node->Peer;
}
/* 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",
- (char *) &TargetName, AcpiUtGetTypeName (Type),
- AcpiUtGetNodeName (Node), Node, Node->Child));
+ ACPI_CAST_PTR (char, &TargetName), AcpiUtGetTypeName (Type),
+ AcpiUtGetNodeName (ParentNode), ParentNode, ParentNode->Child));
return_ACPI_STATUS (AE_NOT_FOUND);
}
@@ -260,14 +265,14 @@ AcpiNsSearchNode (
* RETURN: Status
*
* DESCRIPTION: Called when a name has not been found in the current namespace
- * level. Before adding it or giving up, ACPI scope rules require
+ * level. Before adding it or giving up, ACPI scope rules require
* searching enclosing scopes in cases identified by AcpiNsLocal().
*
* "A name is located by finding the matching name in the current
* name space, and then in the parent name space. If the parent
* name space does not contain the name, the search continues
* recursively until either the name is found or the name space
- * does not have a parent (the root of the name space). This
+ * does not have a parent (the root of the name space). This
* indicates that the name is not found" (From ACPI Specification,
* section 5.3)
*
@@ -284,7 +289,7 @@ AcpiNsSearchParentTree (
ACPI_NAMESPACE_NODE *ParentNode;
- ACPI_FUNCTION_TRACE ("NsSearchParentTree");
+ ACPI_FUNCTION_TRACE (NsSearchParentTree);
ParentNode = AcpiNsGetParentNode (Node);
@@ -296,7 +301,7 @@ AcpiNsSearchParentTree (
if (!ParentNode)
{
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[%4.4s] has no parent\n",
- (char *) &TargetName));
+ ACPI_CAST_PTR (char, &TargetName)));
return_ACPI_STATUS (AE_NOT_FOUND);
}
@@ -304,7 +309,7 @@ AcpiNsSearchParentTree (
{
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"[%4.4s] type [%s] must be local to this scope (no parent search)\n",
- (char *) &TargetName, AcpiUtGetTypeName (Type)));
+ ACPI_CAST_PTR (char, &TargetName), AcpiUtGetTypeName (Type)));
return_ACPI_STATUS (AE_NOT_FOUND);
}
@@ -312,7 +317,7 @@ AcpiNsSearchParentTree (
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"Searching parent [%4.4s] for [%4.4s]\n",
- AcpiUtGetNodeName (ParentNode), (char *) &TargetName));
+ AcpiUtGetNodeName (ParentNode), ACPI_CAST_PTR (char, &TargetName)));
/*
* Search parents until target is found or we have backed up to the root
@@ -320,21 +325,19 @@ AcpiNsSearchParentTree (
while (ParentNode)
{
/*
- * Search parent scope. Use TYPE_ANY because we don't care about the
+ * Search parent scope. Use TYPE_ANY because we don't care about the
* object type at this point, we only care about the existence of
- * the actual name we are searching for. Typechecking comes later.
+ * the actual name we are searching for. Typechecking comes later.
*/
- Status = AcpiNsSearchNode (TargetName, ParentNode,
- ACPI_TYPE_ANY, ReturnNode);
+ Status = AcpiNsSearchOneScope (
+ TargetName, ParentNode, ACPI_TYPE_ANY, ReturnNode);
if (ACPI_SUCCESS (Status))
{
return_ACPI_STATUS (Status);
}
- /*
- * Not found here, go up another level
- * (until we reach the root)
- */
+ /* Not found here, go up another level (until we reach the root) */
+
ParentNode = AcpiNsGetParentNode (ParentNode);
}
@@ -360,7 +363,7 @@ AcpiNsSearchParentTree (
* RETURN: Status
*
* DESCRIPTION: Search for a name segment in a single namespace level,
- * optionally adding it if it is not found. If the passed
+ * optionally adding it if it is not found. If the passed
* Type is not Any and the type previously stored in the
* entry was Any (i.e. unknown), update the stored type.
*
@@ -383,34 +386,52 @@ AcpiNsSearchAndEnter (
ACPI_NAMESPACE_NODE *NewNode;
- ACPI_FUNCTION_TRACE ("NsSearchAndEnter");
+ ACPI_FUNCTION_TRACE (NsSearchAndEnter);
/* Parameter validation */
if (!Node || !TargetName || !ReturnNode)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Null param: Node %p Name %X ReturnNode %p\n",
+ ACPI_ERROR ((AE_INFO,
+ "Null parameter: Node %p Name %X ReturnNode %p",
Node, TargetName, ReturnNode));
-
- ACPI_REPORT_ERROR (("NsSearchAndEnter: Null parameter\n"));
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- /* Name must consist of printable characters */
-
+ /*
+ * 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.
+ */
if (!AcpiUtValidAcpiName (TargetName))
{
- ACPI_REPORT_ERROR (("NsSearchAndEnter: Bad character in ACPI Name: %X\n",
- TargetName));
- return_ACPI_STATUS (AE_BAD_CHARACTER);
+ 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)));
+ }
}
/* Try to find the name in the namespace level specified by the caller */
*ReturnNode = ACPI_ENTRY_NOT_FOUND;
- Status = AcpiNsSearchNode (TargetName, Node, Type, ReturnNode);
+ Status = AcpiNsSearchOneScope (TargetName, Node, Type, ReturnNode);
if (Status != AE_NOT_FOUND)
{
/*
@@ -423,18 +444,16 @@ AcpiNsSearchAndEnter (
Status = AE_ALREADY_EXISTS;
}
- /*
- * Either found it or there was an error
- * -- finished either way
- */
+ /* Either found it or there was an error: finished either way */
+
return_ACPI_STATUS (Status);
}
/*
- * The name was not found. If we are NOT performing the first pass
+ * The name was not found. If we are NOT performing the first pass
* (name entry) of loading the namespace, search the parent tree (all the
* way to the root if necessary.) We don't want to perform the parent
- * search when the namespace is actually being loaded. We want to perform
+ * search when the namespace is actually being loaded. We want to perform
* the search when namespace references are being resolved (load pass 2)
* and during the execution phase.
*/
@@ -452,14 +471,13 @@ AcpiNsSearchAndEnter (
}
}
- /*
- * In execute mode, just search, never add names. Exit now.
- */
+ /* In execute mode, just search, never add names. Exit now */
+
if (InterpreterMode == ACPI_IMODE_EXECUTE)
{
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"%4.4s Not found in %p [Not adding]\n",
- (char *) &TargetName, Node));
+ ACPI_CAST_PTR (char, &TargetName), Node));
return_ACPI_STATUS (AE_NOT_FOUND);
}
@@ -472,11 +490,25 @@ AcpiNsSearchAndEnter (
return_ACPI_STATUS (AE_NO_MEMORY);
}
+#ifdef ACPI_ASL_COMPILER
+ /*
+ * Node is an object defined by an External() statement
+ */
+ if (Flags & ACPI_NS_EXTERNAL)
+ {
+ NewNode->Flags |= ANOBJ_IS_EXTERNAL;
+ }
+#endif
+
+ if (Flags & ACPI_NS_TEMPORARY)
+ {
+ NewNode->Flags |= ANOBJ_TEMPORARY;
+ }
+
/* Install the new object into the parent's list of children */
AcpiNsInstallNode (WalkState, Node, NewNode, Type);
*ReturnNode = NewNode;
-
return_ACPI_STATUS (AE_OK);
}
diff --git a/sys/contrib/dev/acpica/nsutils.c b/sys/contrib/dev/acpica/nsutils.c
index 184e885..7aac1f3 100644
--- a/sys/contrib/dev/acpica/nsutils.c
+++ b/sys/contrib/dev/acpica/nsutils.c
@@ -2,7 +2,7 @@
*
* Module Name: nsutils - Utilities for accessing ACPI namespace, accessing
* parents and siblings and Scope manipulation
- * $Revision: 1.141 $
+ * $Revision: 1.155 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -144,7 +144,6 @@ AcpiNsFindParentName (
*
* PARAMETERS: ModuleName - Caller's module name (for error output)
* LineNumber - Caller's line number (for error output)
- * ComponentId - Caller's component ID (for error output)
* InternalName - Name or path of the namespace node
* LookupStatus - Exception code from NS lookup
*
@@ -158,23 +157,22 @@ void
AcpiNsReportError (
char *ModuleName,
UINT32 LineNumber,
- UINT32 ComponentId,
char *InternalName,
ACPI_STATUS LookupStatus)
{
ACPI_STATUS Status;
+ UINT32 BadName;
char *Name = NULL;
- AcpiOsPrintf ("%8s-%04d: *** Error: Looking up ",
- ModuleName, LineNumber);
+ AcpiOsPrintf ("ACPI Error (%s-%04d): ", ModuleName, LineNumber);
if (LookupStatus == AE_BAD_CHARACTER)
{
/* There is a non-ascii character in the name */
- AcpiOsPrintf ("[0x%4.4X] (NON-ASCII)\n",
- *(ACPI_CAST_PTR (UINT32, InternalName)));
+ ACPI_MOVE_32_TO_32 (&BadName, InternalName);
+ AcpiOsPrintf ("[0x%4.4X] (NON-ASCII)", BadName);
}
else
{
@@ -196,11 +194,11 @@ AcpiNsReportError (
if (Name)
{
- ACPI_MEM_FREE (Name);
+ ACPI_FREE (Name);
}
}
- AcpiOsPrintf (" in namespace, %s\n",
+ AcpiOsPrintf (" Namespace lookup failure, %s\n",
AcpiFormatException (LookupStatus));
}
@@ -211,10 +209,9 @@ AcpiNsReportError (
*
* PARAMETERS: ModuleName - Caller's module name (for error output)
* LineNumber - Caller's line number (for error output)
- * ComponentId - Caller's component ID (for error output)
* Message - Error message to use on failure
* PrefixNode - Prefix relative to the path
- * Path - Path to the node
+ * Path - Path to the node (optional)
* MethodStatus - Execution status
*
* RETURN: None
@@ -227,7 +224,6 @@ void
AcpiNsReportMethodError (
char *ModuleName,
UINT32 LineNumber,
- UINT32 ComponentId,
char *Message,
ACPI_NAMESPACE_NODE *PrefixNode,
char *Path,
@@ -237,18 +233,18 @@ AcpiNsReportMethodError (
ACPI_NAMESPACE_NODE *Node = PrefixNode;
+ AcpiOsPrintf ("ACPI Error (%s-%04d): ", ModuleName, LineNumber);
+
if (Path)
{
- Status = AcpiNsGetNodeByPath (Path, PrefixNode,
- ACPI_NS_NO_UPSEARCH, &Node);
+ Status = AcpiNsGetNode (PrefixNode, Path, ACPI_NS_NO_UPSEARCH,
+ &Node);
if (ACPI_FAILURE (Status))
{
- AcpiOsPrintf ("ReportMethodError: Could not get node\n");
- return;
+ AcpiOsPrintf ("[Could not get node by pathname]");
}
}
- AcpiOsPrintf ("%8s-%04d: *** Error: ", ModuleName, LineNumber);
AcpiNsPrintNodePathname (Node, Message);
AcpiOsPrintf (", %s\n", AcpiFormatException (MethodStatus));
}
@@ -294,7 +290,7 @@ AcpiNsPrintNodePathname (
}
AcpiOsPrintf ("[%s] (Node %p)", (char *) Buffer.Pointer, Node);
- ACPI_MEM_FREE (Buffer.Pointer);
+ ACPI_FREE (Buffer.Pointer);
}
}
@@ -357,12 +353,12 @@ ACPI_OBJECT_TYPE
AcpiNsGetType (
ACPI_NAMESPACE_NODE *Node)
{
- ACPI_FUNCTION_TRACE ("NsGetType");
+ ACPI_FUNCTION_TRACE (NsGetType);
if (!Node)
{
- ACPI_REPORT_WARNING (("NsGetType: Null Node input pointer\n"));
+ ACPI_WARNING ((AE_INFO, "Null Node parameter"));
return_UINT32 (ACPI_TYPE_ANY);
}
@@ -387,14 +383,14 @@ UINT32
AcpiNsLocal (
ACPI_OBJECT_TYPE Type)
{
- ACPI_FUNCTION_TRACE ("NsLocal");
+ ACPI_FUNCTION_TRACE (NsLocal);
if (!AcpiUtValidObjectType (Type))
{
/* Type code out of range */
- ACPI_REPORT_WARNING (("NsLocal: Invalid Object Type\n"));
+ ACPI_WARNING ((AE_INFO, "Invalid Object Type %X", Type));
return_UINT32 (ACPI_NS_NORMAL);
}
@@ -504,7 +500,7 @@ AcpiNsBuildInternalName (
ACPI_NATIVE_UINT i;
- ACPI_FUNCTION_TRACE ("NsBuildInternalName");
+ ACPI_FUNCTION_TRACE (NsBuildInternalName);
/* Setup the correct prefixes, counts, and pointers */
@@ -641,7 +637,7 @@ AcpiNsInternalizeName (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("NsInternalizeName");
+ ACPI_FUNCTION_TRACE (NsInternalizeName);
if ((!ExternalName) ||
@@ -658,7 +654,7 @@ AcpiNsInternalizeName (
/* We need a segment to store the internal name */
- InternalName = ACPI_MEM_CALLOCATE (Info.Length);
+ InternalName = ACPI_ALLOCATE_ZEROED (Info.Length);
if (!InternalName)
{
return_ACPI_STATUS (AE_NO_MEMORY);
@@ -670,7 +666,7 @@ AcpiNsInternalizeName (
Status = AcpiNsBuildInternalName (&Info);
if (ACPI_FAILURE (Status))
{
- ACPI_MEM_FREE (InternalName);
+ ACPI_FREE (InternalName);
return_ACPI_STATUS (Status);
}
@@ -711,7 +707,7 @@ AcpiNsExternalizeName (
ACPI_NATIVE_UINT j = 0;
- ACPI_FUNCTION_TRACE ("NsExternalizeName");
+ ACPI_FUNCTION_TRACE (NsExternalizeName);
if (!InternalNameLength ||
@@ -811,14 +807,14 @@ AcpiNsExternalizeName (
*/
if (RequiredLength > InternalNameLength)
{
- ACPI_REPORT_ERROR (("NsExternalizeName: Invalid internal name\n"));
+ ACPI_ERROR ((AE_INFO, "Invalid internal name"));
return_ACPI_STATUS (AE_BAD_PATHNAME);
}
/*
* Build ConvertedName
*/
- *ConvertedName = ACPI_MEM_CALLOCATE (RequiredLength);
+ *ConvertedName = ACPI_ALLOCATE_ZEROED (RequiredLength);
if (!(*ConvertedName))
{
return_ACPI_STATUS (AE_NO_MEMORY);
@@ -881,14 +877,9 @@ AcpiNsMapHandleToNode (
/*
- * Simple implementation.
+ * Simple implementation
*/
- if (!Handle)
- {
- return (NULL);
- }
-
- if (Handle == ACPI_ROOT_OBJECT)
+ if ((!Handle) || (Handle == ACPI_ROOT_OBJECT))
{
return (AcpiGbl_RootNode);
}
@@ -900,7 +891,7 @@ AcpiNsMapHandleToNode (
return (NULL);
}
- return ((ACPI_NAMESPACE_NODE *) Handle);
+ return (ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Handle));
}
@@ -965,7 +956,7 @@ AcpiNsTerminate (
ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_FUNCTION_TRACE ("NsTerminate");
+ ACPI_FUNCTION_TRACE (NsTerminate);
/*
@@ -984,13 +975,6 @@ AcpiNsTerminate (
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace freed\n"));
-
- /*
- * 2) Now we can delete the ACPI tables
- */
- AcpiTbDeleteAllTables ();
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ACPI Tables freed\n"));
-
return_VOID;
}
@@ -1010,14 +994,14 @@ UINT32
AcpiNsOpensScope (
ACPI_OBJECT_TYPE Type)
{
- ACPI_FUNCTION_TRACE_STR ("NsOpensScope", AcpiUtGetTypeName (Type));
+ ACPI_FUNCTION_TRACE_STR (NsOpensScope, AcpiUtGetTypeName (Type));
if (!AcpiUtValidObjectType (Type))
{
/* type code out of range */
- ACPI_REPORT_WARNING (("NsOpensScope: Invalid Object Type %X\n", Type));
+ ACPI_WARNING ((AE_INFO, "Invalid Object Type %X", Type));
return_UINT32 (ACPI_NS_NORMAL);
}
@@ -1027,12 +1011,12 @@ AcpiNsOpensScope (
/*******************************************************************************
*
- * FUNCTION: AcpiNsGetNodeByPath
+ * FUNCTION: AcpiNsGetNode
*
* PARAMETERS: *Pathname - Name to be found, in external (ASL) format. The
* \ (backslash) and ^ (carat) prefixes, and the
* . (period) to separate segments are supported.
- * StartNode - Root of subtree to be searched, or NS_ALL for the
+ * PrefixNode - Root of subtree to be searched, or NS_ALL for the
* root of the name space. If Name is fully
* qualified (first INT8 is '\'), the passed value
* of Scope will not be accessed.
@@ -1048,29 +1032,36 @@ AcpiNsOpensScope (
******************************************************************************/
ACPI_STATUS
-AcpiNsGetNodeByPath (
+AcpiNsGetNode (
+ ACPI_NAMESPACE_NODE *PrefixNode,
char *Pathname,
- ACPI_NAMESPACE_NODE *StartNode,
UINT32 Flags,
ACPI_NAMESPACE_NODE **ReturnNode)
{
ACPI_GENERIC_STATE ScopeInfo;
ACPI_STATUS Status;
- char *InternalPath = NULL;
+ char *InternalPath;
- ACPI_FUNCTION_TRACE_PTR ("NsGetNodeByPath", Pathname);
+ ACPI_FUNCTION_TRACE_PTR (NsGetNode, Pathname);
- if (Pathname)
+ if (!Pathname)
{
- /* Convert path to internal representation */
-
- Status = AcpiNsInternalizeName (Pathname, &InternalPath);
- if (ACPI_FAILURE (Status))
+ *ReturnNode = PrefixNode;
+ if (!PrefixNode)
{
- return_ACPI_STATUS (Status);
+ *ReturnNode = AcpiGbl_RootNode;
}
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Convert path to internal representation */
+
+ Status = AcpiNsInternalizeName (Pathname, &InternalPath);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
}
/* Must lock namespace during lookup */
@@ -1083,27 +1074,23 @@ AcpiNsGetNodeByPath (
/* Setup lookup scope (search starting point) */
- ScopeInfo.Scope.Node = StartNode;
+ ScopeInfo.Scope.Node = PrefixNode;
/* Lookup the name in the namespace */
- Status = AcpiNsLookup (&ScopeInfo, InternalPath,
- ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
- (Flags | ACPI_NS_DONT_OPEN_SCOPE),
- NULL, ReturnNode);
+ Status = AcpiNsLookup (&ScopeInfo, InternalPath, ACPI_TYPE_ANY,
+ ACPI_IMODE_EXECUTE, (Flags | ACPI_NS_DONT_OPEN_SCOPE),
+ NULL, ReturnNode);
if (ACPI_FAILURE (Status))
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s, %s\n",
- InternalPath, AcpiFormatException (Status)));
+ Pathname, AcpiFormatException (Status)));
}
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
Cleanup:
- if (InternalPath)
- {
- ACPI_MEM_FREE (InternalPath);
- }
+ ACPI_FREE (InternalPath);
return_ACPI_STATUS (Status);
}
@@ -1200,7 +1187,7 @@ AcpiNsFindParentName (
ACPI_NAMESPACE_NODE *ParentNode;
- ACPI_FUNCTION_TRACE ("NsFindParentName");
+ ACPI_FUNCTION_TRACE (NsFindParentName);
if (ChildNode)
diff --git a/sys/contrib/dev/acpica/nswalk.c b/sys/contrib/dev/acpica/nswalk.c
index 847a3dc..a3ac86c 100644
--- a/sys/contrib/dev/acpica/nswalk.c
+++ b/sys/contrib/dev/acpica/nswalk.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: nswalk - Functions for walking the ACPI namespace
- * $Revision: 1.39 $
+ * $Revision: 1.46 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -160,10 +160,7 @@ AcpiNsGetNextNode (
{
/* It's really the parent's _scope_ that we want */
- if (ParentNode->Child)
- {
- NextNode = ParentNode->Child;
- }
+ NextNode = ParentNode->Child;
}
else
@@ -211,7 +208,7 @@ AcpiNsGetNextNode (
* PARAMETERS: Type - ACPI_OBJECT_TYPE to search for
* StartNode - Handle in namespace where search begins
* MaxDepth - Depth to which search is to reach
- * UnlockBeforeCallback- Whether to unlock the NS before invoking
+ * Flags - Whether to unlock the NS before invoking
* the callback routine
* UserFunction - Called when an object of "Type" is found
* Context - Passed to user function
@@ -239,7 +236,7 @@ AcpiNsWalkNamespace (
ACPI_OBJECT_TYPE Type,
ACPI_HANDLE StartNode,
UINT32 MaxDepth,
- BOOLEAN UnlockBeforeCallback,
+ UINT32 Flags,
ACPI_WALK_CALLBACK UserFunction,
void *Context,
void **ReturnValue)
@@ -252,7 +249,7 @@ AcpiNsWalkNamespace (
UINT32 Level;
- ACPI_FUNCTION_TRACE ("NsWalkNamespace");
+ ACPI_FUNCTION_TRACE (NsWalkNamespace);
/* Special case for the namespace Root Node */
@@ -282,22 +279,36 @@ AcpiNsWalkNamespace (
ChildNode = AcpiNsGetNextNode (ACPI_TYPE_ANY, ParentNode, ChildNode);
if (ChildNode)
{
- /*
- * Found node, Get the type if we are not
- * searching for ANY
- */
+ /* Found next child, get the type if we are not searching for ANY */
+
if (Type != ACPI_TYPE_ANY)
{
ChildType = ChildNode->Type;
}
- if (ChildType == Type)
+ /*
+ * Ignore all temporary namespace nodes (created during control
+ * method execution) unless told otherwise. These temporary nodes
+ * can cause a race condition because they can be deleted during the
+ * execution of the user function (if the namespace is unlocked before
+ * invocation of the user function.) Only the debugger namespace dump
+ * will examine the temporary nodes.
+ */
+ if ((ChildNode->Flags & ANOBJ_TEMPORARY) &&
+ !(Flags & ACPI_NS_WALK_TEMP_NODES))
+ {
+ Status = AE_CTRL_DEPTH;
+ }
+
+ /* Type must match requested type */
+
+ else if (ChildType == Type)
{
/*
- * Found a matching node, invoke the user
- * callback function
+ * Found a matching node, invoke the user callback function.
+ * Unlock the namespace if flag is set.
*/
- if (UnlockBeforeCallback)
+ if (Flags & ACPI_NS_WALK_UNLOCK)
{
MutexStatus = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (MutexStatus))
@@ -306,10 +317,9 @@ AcpiNsWalkNamespace (
}
}
- Status = UserFunction (ChildNode, Level,
- Context, ReturnValue);
+ Status = UserFunction (ChildNode, Level, Context, ReturnValue);
- if (UnlockBeforeCallback)
+ if (Flags & ACPI_NS_WALK_UNLOCK)
{
MutexStatus = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (MutexStatus))
@@ -341,33 +351,28 @@ AcpiNsWalkNamespace (
}
/*
- * Depth first search:
- * Attempt to go down another level in the namespace
- * if we are allowed to. Don't go any further if we
- * have reached the caller specified maximum depth
- * or if the user function has specified that the
- * maximum depth has been reached.
+ * Depth first search: Attempt to go down another level in the
+ * namespace if we are allowed to. Don't go any further if we have
+ * reached the caller specified maximum depth or if the user
+ * function has specified that the maximum depth has been reached.
*/
if ((Level < MaxDepth) && (Status != AE_CTRL_DEPTH))
{
if (AcpiNsGetNextNode (ACPI_TYPE_ANY, ChildNode, NULL))
{
- /*
- * There is at least one child of this
- * node, visit the onde
- */
+ /* There is at least one child of this node, visit it */
+
Level++;
ParentNode = ChildNode;
- ChildNode = NULL;
+ ChildNode = NULL;
}
}
}
else
{
/*
- * No more children of this node (AcpiNsGetNextNode
- * failed), go back upwards in the namespace tree to
- * the node's parent.
+ * No more children of this node (AcpiNsGetNextNode failed), go
+ * back upwards in the namespace tree to the node's parent.
*/
Level--;
ChildNode = ParentNode;
diff --git a/sys/contrib/dev/acpica/nsxfeval.c b/sys/contrib/dev/acpica/nsxfeval.c
index c4b9c8c..617002c 100644
--- a/sys/contrib/dev/acpica/nsxfeval.c
+++ b/sys/contrib/dev/acpica/nsxfeval.c
@@ -2,7 +2,7 @@
*
* Module Name: nsxfeval - Public interfaces to the ACPI subsystem
* ACPI Object evaluation interfaces
- * $Revision: 1.17 $
+ * $Revision: 1.30 $
*
******************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -160,7 +160,7 @@ AcpiEvaluateObjectTyped (
BOOLEAN MustFree = FALSE;
- ACPI_FUNCTION_TRACE ("AcpiEvaluateObjectTyped");
+ ACPI_FUNCTION_TRACE (AcpiEvaluateObjectTyped);
/* Return buffer must be valid */
@@ -194,9 +194,7 @@ AcpiEvaluateObjectTyped (
{
/* Error because caller specifically asked for a return value */
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "No return value\n"));
-
+ ACPI_ERROR ((AE_INFO, "No return value"));
return_ACPI_STATUS (AE_NULL_OBJECT);
}
@@ -209,8 +207,8 @@ AcpiEvaluateObjectTyped (
/* Return object type does not match requested type */
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Incorrect return type [%s] requested [%s]\n",
+ ACPI_ERROR ((AE_INFO,
+ "Incorrect return type [%s] requested [%s]",
AcpiUtGetTypeName (((ACPI_OBJECT *) ReturnBuffer->Pointer)->Type),
AcpiUtGetTypeName (ReturnType)));
@@ -226,6 +224,8 @@ AcpiEvaluateObjectTyped (
return_ACPI_STATUS (AE_TYPE);
}
+ACPI_EXPORT_SYMBOL (AcpiEvaluateObjectTyped)
+
/*******************************************************************************
*
@@ -255,24 +255,37 @@ AcpiEvaluateObject (
ACPI_BUFFER *ReturnBuffer)
{
ACPI_STATUS Status;
- ACPI_STATUS Status2;
- ACPI_PARAMETER_INFO Info;
+ ACPI_EVALUATE_INFO *Info;
ACPI_SIZE BufferSpaceNeeded;
UINT32 i;
- ACPI_FUNCTION_TRACE ("AcpiEvaluateObject");
+ ACPI_FUNCTION_TRACE (AcpiEvaluateObject);
+
+
+ /* Allocate and initialize the evaluation information block */
+
+ Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO));
+ if (!Info)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+ Info->Pathname = Pathname;
+ Info->ParameterType = ACPI_PARAM_ARGS;
- Info.Node = Handle;
- Info.Parameters = NULL;
- Info.ReturnObject = NULL;
- Info.ParameterType = ACPI_PARAM_ARGS;
+ /* Convert and validate the device handle */
+
+ Info->PrefixNode = AcpiNsMapHandleToNode (Handle);
+ if (!Info->PrefixNode)
+ {
+ Status = AE_BAD_PARAMETER;
+ goto Cleanup;
+ }
/*
- * If there are parameters to be passed to the object
- * (which must be a control method), the external objects
- * must be converted to internal objects
+ * If there are parameters to be passed to a control method, the external
+ * objects must all be converted to internal objects
*/
if (ExternalParams && ExternalParams->Count)
{
@@ -280,32 +293,28 @@ AcpiEvaluateObject (
* Allocate a new parameter block for the internal objects
* Add 1 to count to allow for null terminated internal list
*/
- Info.Parameters = ACPI_MEM_CALLOCATE (
- ((ACPI_SIZE) ExternalParams->Count + 1) *
- sizeof (void *));
- if (!Info.Parameters)
+ Info->Parameters = ACPI_ALLOCATE_ZEROED (
+ ((ACPI_SIZE) ExternalParams->Count + 1) * sizeof (void *));
+ if (!Info->Parameters)
{
- return_ACPI_STATUS (AE_NO_MEMORY);
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
}
- /*
- * Convert each external object in the list to an
- * internal object
- */
+ /* Convert each external object in the list to an internal object */
+
for (i = 0; i < ExternalParams->Count; i++)
{
- Status = AcpiUtCopyEobjectToIobject (&ExternalParams->Pointer[i],
- &Info.Parameters[i]);
+ Status = AcpiUtCopyEobjectToIobject (
+ &ExternalParams->Pointer[i], &Info->Parameters[i]);
if (ACPI_FAILURE (Status))
{
- AcpiUtDeleteInternalObjectList (Info.Parameters);
- return_ACPI_STATUS (Status);
+ goto Cleanup;
}
}
- Info.Parameters[ExternalParams->Count] = NULL;
+ Info->Parameters[ExternalParams->Count] = NULL;
}
-
/*
* Three major cases:
* 1) Fully qualified pathname
@@ -315,55 +324,37 @@ AcpiEvaluateObject (
if ((Pathname) &&
(AcpiNsValidRootPrefix (Pathname[0])))
{
- /*
- * The path is fully qualified, just evaluate by name
- */
- Status = AcpiNsEvaluateByName (Pathname, &Info);
+ /* The path is fully qualified, just evaluate by name */
+
+ Info->PrefixNode = NULL;
+ Status = AcpiNsEvaluate (Info);
}
else if (!Handle)
{
/*
- * A handle is optional iff a fully qualified pathname
- * is specified. Since we've already handled fully
- * qualified names above, this is an error
+ * A handle is optional iff a fully qualified pathname is specified.
+ * Since we've already handled fully qualified names above, this is
+ * an error
*/
if (!Pathname)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Both Handle and Pathname are NULL\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "Both Handle and Pathname are NULL"));
}
else
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Handle is NULL and Pathname is relative\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "Null Handle with relative pathname [%s]", Pathname));
}
Status = AE_BAD_PARAMETER;
}
else
{
- /*
- * We get here if we have a handle -- and if we have a
- * pathname it is relative. The handle will be validated
- * in the lower procedures
- */
- if (!Pathname)
- {
- /*
- * The null pathname case means the handle is for
- * the actual object to be evaluated
- */
- Status = AcpiNsEvaluateByHandle (&Info);
- }
- else
- {
- /*
- * Both a Handle and a relative Pathname
- */
- Status = AcpiNsEvaluateRelative (Pathname, &Info);
- }
- }
+ /* We have a namespace a node and a possible relative path */
+ Status = AcpiNsEvaluate (Info);
+ }
/*
* If we are expecting a return value, and all went well above,
@@ -371,13 +362,14 @@ AcpiEvaluateObject (
*/
if (ReturnBuffer)
{
- if (!Info.ReturnObject)
+ if (!Info->ReturnObject)
{
ReturnBuffer->Length = 0;
}
else
{
- if (ACPI_GET_DESCRIPTOR_TYPE (Info.ReturnObject) == ACPI_DESC_TYPE_NAMED)
+ if (ACPI_GET_DESCRIPTOR_TYPE (Info->ReturnObject) ==
+ ACPI_DESC_TYPE_NAMED)
{
/*
* If we received a NS Node as a return object, this means that
@@ -388,28 +380,27 @@ AcpiEvaluateObject (
* support for various types at a later date if necessary.
*/
Status = AE_TYPE;
- Info.ReturnObject = NULL; /* No need to delete a NS Node */
+ Info->ReturnObject = NULL; /* No need to delete a NS Node */
ReturnBuffer->Length = 0;
}
if (ACPI_SUCCESS (Status))
{
- /*
- * Find out how large a buffer is needed
- * to contain the returned object
- */
- Status = AcpiUtGetObjectSize (Info.ReturnObject,
- &BufferSpaceNeeded);
+ /* Get the size of the returned object */
+
+ Status = AcpiUtGetObjectSize (Info->ReturnObject,
+ &BufferSpaceNeeded);
if (ACPI_SUCCESS (Status))
{
/* Validate/Allocate/Clear caller buffer */
Status = AcpiUtInitializeBuffer (ReturnBuffer,
- BufferSpaceNeeded);
+ BufferSpaceNeeded);
if (ACPI_FAILURE (Status))
{
/*
- * Caller's buffer is too small or a new one can't be allocated
+ * Caller's buffer is too small or a new one can't
+ * be allocated
*/
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Needed buffer size %X, %s\n",
@@ -418,48 +409,48 @@ AcpiEvaluateObject (
}
else
{
- /*
- * We have enough space for the object, build it
- */
- Status = AcpiUtCopyIobjectToEobject (Info.ReturnObject,
- ReturnBuffer);
+ /* We have enough space for the object, build it */
+
+ Status = AcpiUtCopyIobjectToEobject (Info->ReturnObject,
+ ReturnBuffer);
}
}
}
}
}
- if (Info.ReturnObject)
+ if (Info->ReturnObject)
{
/*
- * Delete the internal return object. NOTE: Interpreter
- * must be locked to avoid race condition.
+ * Delete the internal return object. NOTE: Interpreter must be
+ * locked to avoid race condition.
*/
- Status2 = AcpiExEnterInterpreter ();
- if (ACPI_SUCCESS (Status2))
- {
- /*
- * Delete the internal return object. (Or at least
- * decrement the reference count by one)
- */
- AcpiUtRemoveReference (Info.ReturnObject);
- AcpiExExitInterpreter ();
- }
+ AcpiExEnterInterpreter ();
+
+ /* Remove one reference on the return object (should delete it) */
+
+ AcpiUtRemoveReference (Info->ReturnObject);
+ AcpiExExitInterpreter ();
}
- /*
- * Free the input parameter list (if we created one),
- */
- if (Info.Parameters)
+
+Cleanup:
+
+ /* Free the input parameter list (if we created one) */
+
+ if (Info->Parameters)
{
/* Free the allocated parameter block */
- AcpiUtDeleteInternalObjectList (Info.Parameters);
+ AcpiUtDeleteInternalObjectList (Info->Parameters);
}
+ ACPI_FREE (Info);
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiEvaluateObject)
+
/*******************************************************************************
*
@@ -503,13 +494,13 @@ AcpiWalkNamespace (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("AcpiWalkNamespace");
+ ACPI_FUNCTION_TRACE (AcpiWalkNamespace);
/* Parameter validation */
- if ((Type > ACPI_TYPE_EXTERNAL_MAX) ||
- (!MaxDepth) ||
+ if ((Type > ACPI_TYPE_LOCAL_MAX) ||
+ (!MaxDepth) ||
(!UserFunction))
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
@@ -535,6 +526,8 @@ AcpiWalkNamespace (
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiWalkNamespace)
+
/*******************************************************************************
*
@@ -592,9 +585,9 @@ AcpiNsGetDeviceCallback (
return (AE_CTRL_DEPTH);
}
- if (!(Flags & 0x01))
+ if (!(Flags & ACPI_STA_DEVICE_PRESENT))
{
- /* Don't return at the device or children of the device if not there */
+ /* Don't examine children of the device if not present */
return (AE_CTRL_DEPTH);
}
@@ -634,11 +627,11 @@ AcpiNsGetDeviceCallback (
if (ACPI_STRNCMP (Cid->Id[i].Value, Info->Hid,
sizeof (ACPI_COMPATIBLE_ID)) != 0)
{
- ACPI_MEM_FREE (Cid);
+ ACPI_FREE (Cid);
return (AE_OK);
}
}
- ACPI_MEM_FREE (Cid);
+ ACPI_FREE (Cid);
}
}
@@ -684,7 +677,7 @@ AcpiGetDevices (
ACPI_GET_DEVICES_INFO Info;
- ACPI_FUNCTION_TRACE ("AcpiGetDevices");
+ ACPI_FUNCTION_TRACE (AcpiGetDevices);
/* Parameter validation */
@@ -698,9 +691,9 @@ AcpiGetDevices (
* We're going to call their callback from OUR callback, so we need
* to know what it is, and their context parameter.
*/
+ Info.Hid = HID;
Info.Context = Context;
Info.UserFunction = UserFunction;
- Info.Hid = HID;
/*
* Lock the namespace around the walk.
@@ -714,16 +707,16 @@ AcpiGetDevices (
return_ACPI_STATUS (Status);
}
- Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE,
- ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
- ACPI_NS_WALK_UNLOCK,
- AcpiNsGetDeviceCallback, &Info,
- ReturnValue);
+ Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
+ ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK,
+ AcpiNsGetDeviceCallback, &Info, ReturnValue);
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiGetDevices)
+
/*******************************************************************************
*
@@ -780,6 +773,8 @@ UnlockAndExit:
return (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiAttachData)
+
/*******************************************************************************
*
@@ -833,6 +828,8 @@ UnlockAndExit:
return (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiDetachData)
+
/*******************************************************************************
*
@@ -889,4 +886,6 @@ UnlockAndExit:
return (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiGetData)
+
diff --git a/sys/contrib/dev/acpica/nsxfname.c b/sys/contrib/dev/acpica/nsxfname.c
index 7885849..c19f2a9 100644
--- a/sys/contrib/dev/acpica/nsxfname.c
+++ b/sys/contrib/dev/acpica/nsxfname.c
@@ -2,7 +2,7 @@
*
* Module Name: nsxfname - Public interfaces to the ACPI subsystem
* ACPI Namespace oriented interfaces
- * $Revision: 1.104 $
+ * $Revision: 1.112 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -168,41 +168,42 @@ AcpiGetHandle (
if (Parent)
{
- Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
-
PrefixNode = AcpiNsMapHandleToNode (Parent);
if (!PrefixNode)
{
- (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
return (AE_BAD_PARAMETER);
}
+ }
+
+ /*
+ * Valid cases are:
+ * 1) Fully qualified pathname
+ * 2) Parent + Relative pathname
+ *
+ * Error for <null Parent + relative path>
+ */
+ if (AcpiNsValidRootPrefix (Pathname[0]))
+ {
+ /* Pathname is fully qualified (starts with '\') */
+
+ /* Special case for root-only, since we can't search for it */
- Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (Status))
+ if (!ACPI_STRCMP (Pathname, ACPI_NS_ROOT_PATH))
{
- return (Status);
+ *RetHandle = AcpiNsConvertEntryToHandle (AcpiGbl_RootNode);
+ return (AE_OK);
}
}
-
- /* Special case for root, since we can't search for it */
-
- if (ACPI_STRCMP (Pathname, ACPI_NS_ROOT_PATH) == 0)
+ else if (!PrefixNode)
{
- *RetHandle = AcpiNsConvertEntryToHandle (AcpiGbl_RootNode);
- return (AE_OK);
+ /* Relative path with null prefix is disallowed */
+
+ return (AE_BAD_PARAMETER);
}
- /*
- * Find the Node and convert to a handle
- */
- Status = AcpiNsGetNodeByPath (Pathname, PrefixNode, ACPI_NS_NO_UPSEARCH,
- &Node);
+ /* Find the Node and convert to a handle */
- *RetHandle = NULL;
+ Status = AcpiNsGetNode (PrefixNode, Pathname, ACPI_NS_NO_UPSEARCH, &Node);
if (ACPI_SUCCESS (Status))
{
*RetHandle = AcpiNsConvertEntryToHandle (Node);
@@ -211,6 +212,8 @@ AcpiGetHandle (
return (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiGetHandle)
+
/******************************************************************************
*
@@ -298,6 +301,8 @@ UnlockAndExit:
return (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiGetName)
+
/******************************************************************************
*
@@ -340,7 +345,7 @@ AcpiGetObjectInfo (
return (Status);
}
- Info = ACPI_MEM_CALLOCATE (sizeof (ACPI_DEVICE_INFO));
+ Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_DEVICE_INFO));
if (!Info)
{
return (AE_NO_MEMORY);
@@ -407,8 +412,7 @@ AcpiGetObjectInfo (
Status = AcpiUtExecute_CID (Node, &CidList);
if (ACPI_SUCCESS (Status))
{
- Size += ((ACPI_SIZE) CidList->Count - 1) *
- sizeof (ACPI_COMPATIBLE_ID);
+ Size += CidList->Size;
Info->Valid |= ACPI_VALID_CID;
}
@@ -458,11 +462,13 @@ AcpiGetObjectInfo (
Cleanup:
- ACPI_MEM_FREE (Info);
+ ACPI_FREE (Info);
if (CidList)
{
- ACPI_MEM_FREE (CidList);
+ ACPI_FREE (CidList);
}
return (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiGetObjectInfo)
+
diff --git a/sys/contrib/dev/acpica/nsxfobj.c b/sys/contrib/dev/acpica/nsxfobj.c
index 0b98c55..3277379 100644
--- a/sys/contrib/dev/acpica/nsxfobj.c
+++ b/sys/contrib/dev/acpica/nsxfobj.c
@@ -2,7 +2,7 @@
*
* Module Name: nsxfobj - Public interfaces to the ACPI subsystem
* ACPI Object oriented interfaces
- * $Revision: 1.119 $
+ * $Revision: 1.122 $
*
******************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -186,6 +186,8 @@ AcpiGetType (
return (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiGetType)
+
/*******************************************************************************
*
@@ -256,6 +258,8 @@ UnlockAndExit:
return (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiGetParent)
+
/*******************************************************************************
*
@@ -348,4 +352,5 @@ UnlockAndExit:
return (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiGetNextObject)
diff --git a/sys/contrib/dev/acpica/osunixxf.c b/sys/contrib/dev/acpica/osunixxf.c
index b693305..8fc21fc 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 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -130,8 +130,6 @@
#include <contrib/dev/acpica/acparser.h>
#include <contrib/dev/acpica/acdebug.h>
-#include <contrib/dev/acpica/compiler/aslcompiler.h>
-
#define _COMPONENT ACPI_OS_SERVICES
ACPI_MODULE_NAME ("osunixxf")
@@ -139,6 +137,10 @@
extern FILE *AcpiGbl_DebugFile;
FILE *AcpiGbl_OutputFile;
+ACPI_PHYSICAL_ADDRESS
+AeLocalGetRootPointer (
+ void);
+
/******************************************************************************
*
@@ -172,22 +174,20 @@ AcpiOsTerminate (void)
*
* FUNCTION: AcpiOsGetRootPointer
*
- * PARAMETERS: Flags - Logical or physical addressing mode
- * Address - Where the address is returned
+ * PARAMETERS: None
*
- * RETURN: Status
+ * RETURN: RSDP physical address
*
* DESCRIPTION: Gets the root pointer (RSDP)
*
*****************************************************************************/
-ACPI_STATUS
+ACPI_PHYSICAL_ADDRESS
AcpiOsGetRootPointer (
- UINT32 Flags,
- ACPI_POINTER *Address)
+ void)
{
- return (AeLocalGetRootPointer(Flags, Address));
+ return (AeLocalGetRootPointer ());
}
@@ -252,7 +252,7 @@ AcpiOsTableOverride (
/* This code exercises the table override mechanism in the core */
- if (!ACPI_STRNCMP (ExistingTable->Signature, DSDT_SIG, ACPI_NAME_SIZE))
+ if (ACPI_COMPARE_NAME (ExistingTable->Signature, ACPI_SIG_DSDT))
{
/* override DSDT with itself */
@@ -458,7 +458,6 @@ AcpiOsGetLine (
*
* PARAMETERS: where Physical address of memory to be mapped
* length How much memory to map
- * there Logical address of mapped memory
*
* RETURN: Pointer to mapped memory. Null on error.
*
@@ -466,15 +465,13 @@ AcpiOsGetLine (
*
*****************************************************************************/
-ACPI_STATUS
+void *
AcpiOsMapMemory (
ACPI_PHYSICAL_ADDRESS where,
- ACPI_SIZE length,
- void **there)
+ ACPI_SIZE length)
{
- *there = ACPI_TO_POINTER (where);
- return AE_OK;
+ return (ACPI_TO_POINTER ((ACPI_NATIVE_UINT) where));
}
@@ -652,7 +649,7 @@ AcpiOsSignalSemaphore (
ACPI_STATUS
AcpiOsCreateLock (
- ACPI_HANDLE *OutHandle)
+ ACPI_SPINLOCK *OutHandle)
{
return (AcpiOsCreateSemaphore (1, 1, OutHandle));
@@ -660,13 +657,13 @@ AcpiOsCreateLock (
void
AcpiOsDeleteLock (
- ACPI_HANDLE Handle)
+ ACPI_SPINLOCK Handle)
{
AcpiOsDeleteSemaphore (Handle);
}
-ACPI_NATIVE_UINT
+ACPI_CPU_FLAGS
AcpiOsAcquireLock (
ACPI_HANDLE Handle)
{
@@ -677,8 +674,8 @@ AcpiOsAcquireLock (
void
AcpiOsReleaseLock (
- ACPI_HANDLE Handle,
- ACPI_NATIVE_UINT Flags)
+ ACPI_SPINLOCK Handle,
+ ACPI_CPU_FLAGS Flags)
{
AcpiOsSignalSemaphore (Handle, 1);
}
@@ -735,21 +732,21 @@ AcpiOsRemoveInterruptHandler (
/******************************************************************************
*
- * FUNCTION: AcpiOsQueueForExecution
+ * FUNCTION: AcpiOsExecute
*
- * PARAMETERS: Priority - Requested execution priority
+ * PARAMETERS: Type - Type of execution
* Function - Address of the function to execute
* Context - Passed as a parameter to the function
*
* RETURN: Status.
*
- * DESCRIPTION: Sleep at microsecond granularity
+ * DESCRIPTION: Execute a new thread
*
*****************************************************************************/
ACPI_STATUS
-AcpiOsQueueForExecution (
- UINT32 Priority,
+AcpiOsExecute (
+ ACPI_EXECUTE_TYPE Type,
ACPI_OSD_EXEC_CALLBACK Function,
void *Context)
{
@@ -776,8 +773,6 @@ AcpiOsBreakpoint (
char *Msg)
{
- /* Print the message and do an INT 3 */
-
if (Msg)
{
AcpiOsPrintf ("AcpiOsBreakpoint: %s ****\n", Msg);
@@ -787,7 +782,6 @@ AcpiOsBreakpoint (
AcpiOsPrintf ("At AcpiOsBreakpoint ****\n");
}
-
return AE_OK;
}
@@ -871,6 +865,55 @@ AcpiOsGetTimer (void)
/******************************************************************************
*
+ * FUNCTION: AcpiOsValidateInterface
+ *
+ * PARAMETERS: Interface - Requested interface to be validated
+ *
+ * RETURN: AE_OK if interface is supported, AE_SUPPORT otherwise
+ *
+ * DESCRIPTION: Match an interface string to the interfaces supported by the
+ * host. Strings originate from an AML call to the _OSI method.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsValidateInterface (
+ char *Interface)
+{
+
+ return (AE_SUPPORT);
+}
+
+
+/******************************************************************************
+ *
+ * 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
@@ -1060,7 +1103,7 @@ AcpiOsWriteMemory (
}
-UINT32
+ACPI_THREAD_ID
AcpiOsGetThreadId(void)
{
return getpid();
diff --git a/sys/contrib/dev/acpica/psargs.c b/sys/contrib/dev/acpica/psargs.c
index 33d5587..3c39919 100644
--- a/sys/contrib/dev/acpica/psargs.c
+++ b/sys/contrib/dev/acpica/psargs.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: psargs - Parse AML opcode arguments
- * $Revision: 1.81 $
+ * $Revision: 1.92 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -120,6 +120,7 @@
#include <contrib/dev/acpica/acparser.h>
#include <contrib/dev/acpica/amlcode.h>
#include <contrib/dev/acpica/acnamesp.h>
+#include <contrib/dev/acpica/acdispat.h>
#define _COMPONENT ACPI_PARSER
ACPI_MODULE_NAME ("psargs")
@@ -141,10 +142,11 @@ AcpiPsGetNextField (
*
* PARAMETERS: ParserState - Current parser state object
*
- * RETURN: Decoded package length. On completion, the AML pointer points
+ * RETURN: Decoded package length. On completion, the AML pointer points
* past the length byte or bytes.
*
- * DESCRIPTION: Decode and return a package length field
+ * DESCRIPTION: Decode and return a package length field.
+ * Note: Largest package length is 28 bits, from ACPI specification
*
******************************************************************************/
@@ -152,57 +154,43 @@ static UINT32
AcpiPsGetNextPackageLength (
ACPI_PARSE_STATE *ParserState)
{
- UINT32 EncodedLength;
- UINT32 Length = 0;
+ UINT8 *Aml = ParserState->Aml;
+ UINT32 PackageLength = 0;
+ ACPI_NATIVE_UINT ByteCount;
+ UINT8 ByteZeroMask = 0x3F; /* Default [0:5] */
- ACPI_FUNCTION_TRACE ("PsGetNextPackageLength");
+ ACPI_FUNCTION_TRACE (PsGetNextPackageLength);
- EncodedLength = (UINT32) ACPI_GET8 (ParserState->Aml);
- ParserState->Aml++;
-
- switch (EncodedLength >> 6) /* bits 6-7 contain encoding scheme */
- {
- case 0: /* 1-byte encoding (bits 0-5) */
-
- Length = (EncodedLength & 0x3F);
- break;
-
-
- case 1: /* 2-byte encoding (next byte + bits 0-3) */
-
- Length = ((ACPI_GET8 (ParserState->Aml) << 04) |
- (EncodedLength & 0x0F));
- ParserState->Aml++;
- break;
-
-
- case 2: /* 3-byte encoding (next 2 bytes + bits 0-3) */
-
- Length = ((ACPI_GET8 (ParserState->Aml + 1) << 12) |
- (ACPI_GET8 (ParserState->Aml) << 04) |
- (EncodedLength & 0x0F));
- ParserState->Aml += 2;
- break;
-
-
- case 3: /* 4-byte encoding (next 3 bytes + bits 0-3) */
+ /*
+ * Byte 0 bits [6:7] contain the number of additional bytes
+ * used to encode the package length, either 0,1,2, or 3
+ */
+ ByteCount = (Aml[0] >> 6);
+ ParserState->Aml += (ByteCount + 1);
- Length = ((ACPI_GET8 (ParserState->Aml + 2) << 20) |
- (ACPI_GET8 (ParserState->Aml + 1) << 12) |
- (ACPI_GET8 (ParserState->Aml) << 04) |
- (EncodedLength & 0x0F));
- ParserState->Aml += 3;
- break;
+ /* Get bytes 3, 2, 1 as needed */
- default:
+ while (ByteCount)
+ {
+ /*
+ * Final bit positions for the package length bytes:
+ * Byte3->[20:27]
+ * Byte2->[12:19]
+ * Byte1->[04:11]
+ * Byte0->[00:03]
+ */
+ PackageLength |= (Aml[ByteCount] << ((ByteCount << 3) - 4));
- /* Can't get here, only 2 bits / 4 cases */
- break;
+ ByteZeroMask = 0x0F; /* Use bits [0:3] of byte 0 */
+ ByteCount--;
}
- return_UINT32 (Length);
+ /* Byte 0 is a special case, either bits [0:3] or [0:5] are used */
+
+ PackageLength |= (Aml[0] & ByteZeroMask);
+ return_UINT32 (PackageLength);
}
@@ -224,17 +212,17 @@ AcpiPsGetNextPackageEnd (
ACPI_PARSE_STATE *ParserState)
{
UINT8 *Start = ParserState->Aml;
- ACPI_NATIVE_UINT Length;
+ UINT32 PackageLength;
- ACPI_FUNCTION_TRACE ("PsGetNextPackageEnd");
+ ACPI_FUNCTION_TRACE (PsGetNextPackageEnd);
- /* Function below changes ParserState->Aml */
+ /* Function below updates ParserState->Aml */
- Length = (ACPI_NATIVE_UINT) AcpiPsGetNextPackageLength (ParserState);
+ PackageLength = AcpiPsGetNextPackageLength (ParserState);
- return_PTR (Start + Length); /* end of package */
+ return_PTR (Start + PackageLength); /* end of package */
}
@@ -261,21 +249,19 @@ AcpiPsGetNextNamestring (
UINT8 *End = ParserState->Aml;
- ACPI_FUNCTION_TRACE ("PsGetNextNamestring");
+ ACPI_FUNCTION_TRACE (PsGetNextNamestring);
- /* Handle multiple prefix characters */
+ /* Point past any namestring prefix characters (backslash or carat) */
- while (AcpiPsIsPrefixChar (ACPI_GET8 (End)))
+ while (AcpiPsIsPrefixChar (*End))
{
- /* Include prefix '\\' or '^' */
-
End++;
}
- /* Decode the path */
+ /* Decode the path prefix character */
- switch (ACPI_GET8 (End))
+ switch (*End)
{
case 0:
@@ -297,9 +283,9 @@ AcpiPsGetNextNamestring (
case AML_MULTI_NAME_PREFIX_OP:
- /* Multiple name segments, 4 chars each */
+ /* Multiple name segments, 4 chars each, count in next byte */
- End += 2 + ((ACPI_SIZE) ACPI_GET8 (End + 1) * ACPI_NAME_SIZE);
+ End += 2 + (*(End + 1) * ACPI_NAME_SIZE);
break;
default:
@@ -310,7 +296,7 @@ AcpiPsGetNextNamestring (
break;
}
- ParserState->Aml = (UINT8*) End;
+ ParserState->Aml = End;
return_PTR ((char *) Start);
}
@@ -323,7 +309,7 @@ AcpiPsGetNextNamestring (
* Arg - Where the namepath will be stored
* ArgCount - If the namepath points to a control method
* the method's argument is returned here.
- * MethodCall - Whether the namepath can possibly be the
+ * PossibleMethodCall - Whether the namepath can possibly be the
* start of a method call
*
* RETURN: Status
@@ -341,136 +327,149 @@ AcpiPsGetNextNamepath (
ACPI_WALK_STATE *WalkState,
ACPI_PARSE_STATE *ParserState,
ACPI_PARSE_OBJECT *Arg,
- BOOLEAN MethodCall)
+ BOOLEAN PossibleMethodCall)
{
char *Path;
ACPI_PARSE_OBJECT *NameOp;
- ACPI_STATUS Status = AE_OK;
+ ACPI_STATUS Status;
ACPI_OPERAND_OBJECT *MethodDesc;
ACPI_NAMESPACE_NODE *Node;
ACPI_GENERIC_STATE ScopeInfo;
- ACPI_FUNCTION_TRACE ("PsGetNextNamepath");
+ ACPI_FUNCTION_TRACE (PsGetNextNamepath);
Path = AcpiPsGetNextNamestring (ParserState);
+ AcpiPsInitOp (Arg, AML_INT_NAMEPATH_OP);
- /* Null path case is allowed */
+ /* Null path case is allowed, just exit */
- if (Path)
+ if (!Path)
{
- /*
- * Lookup the name in the internal namespace
- */
- ScopeInfo.Scope.Node = NULL;
- Node = ParserState->StartNode;
- if (Node)
+ Arg->Common.Value.Name = Path;
+ 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.
+ * 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,
+ ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node);
+
+ /*
+ * If this name is a control method invocation, we must
+ * setup the method call
+ */
+ if (ACPI_SUCCESS (Status) &&
+ PossibleMethodCall &&
+ (Node->Type == ACPI_TYPE_METHOD))
+ {
+ /* This name is actually a control method invocation */
+
+ MethodDesc = AcpiNsGetAttachedObject (Node);
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+ "Control Method - %p Desc %p Path=%p\n", Node, MethodDesc, Path));
+
+ NameOp = AcpiPsAllocOp (AML_INT_NAMEPATH_OP);
+ if (!NameOp)
{
- ScopeInfo.Scope.Node = Node;
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
- /*
- * Lookup object. 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 upsearch)
- */
- Status = AcpiNsLookup (&ScopeInfo, Path, ACPI_TYPE_ANY,
- ACPI_IMODE_EXECUTE,
- ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
- NULL, &Node);
- if (ACPI_SUCCESS (Status) && MethodCall)
- {
- if (Node->Type == ACPI_TYPE_METHOD)
- {
- /* This name is actually a control method invocation */
+ /* Change Arg into a METHOD CALL and attach name to it */
- MethodDesc = AcpiNsGetAttachedObject (Node);
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
- "Control Method - %p Desc %p Path=%p\n",
- Node, MethodDesc, Path));
+ AcpiPsInitOp (Arg, AML_INT_METHODCALL_OP);
+ NameOp->Common.Value.Name = Path;
- NameOp = AcpiPsAllocOp (AML_INT_NAMEPATH_OP);
- if (!NameOp)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
+ /* Point METHODCALL/NAME to the METHOD Node */
- /* Change arg into a METHOD CALL and attach name to it */
+ NameOp->Common.Node = Node;
+ AcpiPsAppendArg (Arg, NameOp);
- AcpiPsInitOp (Arg, AML_INT_METHODCALL_OP);
- NameOp->Common.Value.Name = Path;
+ if (!MethodDesc)
+ {
+ ACPI_ERROR ((AE_INFO,
+ "Control Method %p has no attached object",
+ Node));
+ return_ACPI_STATUS (AE_AML_INTERNAL);
+ }
- /* Point METHODCALL/NAME to the METHOD Node */
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+ "Control Method - %p Args %X\n",
+ Node, MethodDesc->Method.ParamCount));
- NameOp->Common.Node = Node;
- AcpiPsAppendArg (Arg, NameOp);
+ /* Get the number of arguments to expect */
- if (!MethodDesc)
- {
- ACPI_REPORT_ERROR ((
- "PsGetNextNamepath: Control Method %p has no attached object\n",
- Node));
- return_ACPI_STATUS (AE_AML_INTERNAL);
- }
+ WalkState->ArgCount = MethodDesc->Method.ParamCount;
+ return_ACPI_STATUS (AE_OK);
+ }
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
- "Control Method - %p Args %X\n",
- Node, MethodDesc->Method.ParamCount));
+ /*
+ * Special handling if the name was not found during the lookup -
+ * some NotFound cases are allowed
+ */
+ if (Status == AE_NOT_FOUND)
+ {
+ /* 1) NotFound is ok during load pass 1/2 (allow forward references) */
- /* Get the number of arguments to expect */
+ if ((WalkState->ParseFlags & ACPI_PARSE_MODE_MASK) !=
+ ACPI_PARSE_EXECUTE)
+ {
+ Status = AE_OK;
+ }
- WalkState->ArgCount = MethodDesc->Method.ParamCount;
- return_ACPI_STATUS (AE_OK);
- }
+ /* 2) NotFound during a CondRefOf(x) is ok by definition */
- /*
- * Else this is normal named object reference.
- * Just init the NAMEPATH object with the pathname.
- * (See code below)
- */
+ else if (WalkState->Op->Common.AmlOpcode == AML_COND_REF_OF_OP)
+ {
+ Status = AE_OK;
}
- if (ACPI_FAILURE (Status))
+ /*
+ * 3) NotFound while building a Package is ok at this point, we
+ * may flag as an error later if slack mode is not enabled.
+ * (Some ASL code depends on allowing this behavior)
+ */
+ else if ((Arg->Common.Parent) &&
+ ((Arg->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) ||
+ (Arg->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP)))
{
- /*
- * 1) Any error other than NOT_FOUND is always severe
- * 2) NOT_FOUND is only important if we are executing a method.
- * 3) If executing a CondRefOf opcode, NOT_FOUND is ok.
- */
- if ((((WalkState->ParseFlags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) &&
- (Status == AE_NOT_FOUND) &&
- (WalkState->Op->Common.AmlOpcode != AML_COND_REF_OF_OP)) ||
-
- (Status != AE_NOT_FOUND))
- {
- ACPI_REPORT_NSERROR (Path, Status);
+ Status = AE_OK;
+ }
+ }
- AcpiOsPrintf ("SearchNode %p StartNode %p ReturnNode %p\n",
- ScopeInfo.Scope.Node, ParserState->StartNode, Node);
+ /* Final exception check (may have been changed from code above) */
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_ERROR_NAMESPACE (Path, Status);
- }
- else
- {
- /*
- * We got a NOT_FOUND during table load or we encountered
- * a CondRefOf(x) where the target does not exist.
- * Either case is ok
- */
- Status = AE_OK;
- }
+ if ((WalkState->ParseFlags & ACPI_PARSE_MODE_MASK) ==
+ ACPI_PARSE_EXECUTE)
+ {
+ /* Report a control method execution error */
+
+ Status = AcpiDsMethodError (Status, WalkState);
}
}
- /*
- * Regardless of success/failure above,
- * Just initialize the Op with the pathname.
- */
- AcpiPsInitOp (Arg, AML_INT_NAMEPATH_OP);
- Arg->Common.Value.Name = Path;
+ /* Save the namepath */
+ Arg->Common.Value.Name = Path;
return_ACPI_STATUS (Status);
}
@@ -495,63 +494,71 @@ AcpiPsGetNextSimpleArg (
UINT32 ArgType,
ACPI_PARSE_OBJECT *Arg)
{
+ UINT32 Length;
+ UINT16 Opcode;
+ UINT8 *Aml = ParserState->Aml;
- ACPI_FUNCTION_TRACE_U32 ("PsGetNextSimpleArg", ArgType);
+
+ ACPI_FUNCTION_TRACE_U32 (PsGetNextSimpleArg, ArgType);
switch (ArgType)
{
case ARGP_BYTEDATA:
- AcpiPsInitOp (Arg, AML_BYTE_OP);
- Arg->Common.Value.Integer = (UINT32) ACPI_GET8 (ParserState->Aml);
- ParserState->Aml++;
+ /* Get 1 byte from the AML stream */
+
+ Opcode = AML_BYTE_OP;
+ Arg->Common.Value.Integer = (ACPI_INTEGER) *Aml;
+ Length = 1;
break;
case ARGP_WORDDATA:
- AcpiPsInitOp (Arg, AML_WORD_OP);
-
/* Get 2 bytes from the AML stream */
- ACPI_MOVE_16_TO_32 (&Arg->Common.Value.Integer, ParserState->Aml);
- ParserState->Aml += 2;
+ Opcode = AML_WORD_OP;
+ ACPI_MOVE_16_TO_64 (&Arg->Common.Value.Integer, Aml);
+ Length = 2;
break;
case ARGP_DWORDDATA:
- AcpiPsInitOp (Arg, AML_DWORD_OP);
-
/* Get 4 bytes from the AML stream */
- ACPI_MOVE_32_TO_32 (&Arg->Common.Value.Integer, ParserState->Aml);
- ParserState->Aml += 4;
+ Opcode = AML_DWORD_OP;
+ ACPI_MOVE_32_TO_64 (&Arg->Common.Value.Integer, Aml);
+ Length = 4;
break;
case ARGP_QWORDDATA:
- AcpiPsInitOp (Arg, AML_QWORD_OP);
-
/* Get 8 bytes from the AML stream */
- ACPI_MOVE_64_TO_64 (&Arg->Common.Value.Integer, ParserState->Aml);
- ParserState->Aml += 8;
+ Opcode = AML_QWORD_OP;
+ ACPI_MOVE_64_TO_64 (&Arg->Common.Value.Integer, Aml);
+ Length = 8;
break;
case ARGP_CHARLIST:
- AcpiPsInitOp (Arg, AML_STRING_OP);
- Arg->Common.Value.String = (char *) ParserState->Aml;
+ /* Get a pointer to the string, point past the string */
- while (ACPI_GET8 (ParserState->Aml) != '\0')
+ Opcode = AML_STRING_OP;
+ Arg->Common.Value.String = ACPI_CAST_PTR (char, Aml);
+
+ /* Find the null terminator */
+
+ Length = 0;
+ while (Aml[Length])
{
- ParserState->Aml++;
+ Length++;
}
- ParserState->Aml++;
+ Length++;
break;
@@ -560,15 +567,17 @@ AcpiPsGetNextSimpleArg (
AcpiPsInitOp (Arg, AML_INT_NAMEPATH_OP);
Arg->Common.Value.Name = AcpiPsGetNextNamestring (ParserState);
- break;
+ return_VOID;
default:
- ACPI_REPORT_ERROR (("Invalid ArgType %X\n", ArgType));
- break;
+ ACPI_ERROR ((AE_INFO, "Invalid ArgType %X", ArgType));
+ return_VOID;
}
+ AcpiPsInitOp (Arg, Opcode);
+ ParserState->Aml += Length;
return_VOID;
}
@@ -597,7 +606,7 @@ AcpiPsGetNextField (
UINT32 Name;
- ACPI_FUNCTION_TRACE ("PsGetNextField");
+ ACPI_FUNCTION_TRACE (PsGetNextField);
/* Determine field type */
@@ -664,7 +673,7 @@ AcpiPsGetNextField (
* Get AccessType and AccessAttrib and merge into the field Op
* AccessType is first operand, AccessAttribute is second
*/
- Field->Common.Value.Integer = (ACPI_GET8 (ParserState->Aml) << 8);
+ Field->Common.Value.Integer = (((UINT32) ACPI_GET8 (ParserState->Aml) << 8));
ParserState->Aml++;
Field->Common.Value.Integer |= ACPI_GET8 (ParserState->Aml);
ParserState->Aml++;
@@ -710,7 +719,7 @@ AcpiPsGetNextArg (
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE_PTR ("PsGetNextArg", ParserState);
+ ACPI_FUNCTION_TRACE_PTR (PsGetNextArg, ParserState);
switch (ArgType)
@@ -850,7 +859,7 @@ AcpiPsGetNextArg (
default:
- ACPI_REPORT_ERROR (("Invalid ArgType: %X\n", ArgType));
+ ACPI_ERROR ((AE_INFO, "Invalid ArgType: %X", ArgType));
Status = AE_AML_OPERAND_TYPE;
break;
}
diff --git a/sys/contrib/dev/acpica/psloop.c b/sys/contrib/dev/acpica/psloop.c
index 91933c7..6c6ce47 100644
--- a/sys/contrib/dev/acpica/psloop.c
+++ b/sys/contrib/dev/acpica/psloop.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: psloop - Main AML parse loop
- * $Revision: 1.5 $
+ * $Revision: 1.16 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -116,12 +116,11 @@
/*
- * Parse the AML and build an operation tree as most interpreters,
- * like Perl, do. Parsing is done by hand rather than with a YACC
- * generated parser to tightly constrain stack and dynamic memory
- * usage. At the same time, parsing is kept flexible and the code
- * fairly compact by parsing based on a list of AML opcode
- * templates in AmlOpInfo[]
+ * Parse the AML and build an operation tree as most interpreters, (such as
+ * Perl) do. Parsing is done by hand rather than with a YACC generated parser
+ * to tightly constrain stack and dynamic memory usage. Parsing is kept
+ * flexible and the code fairly compact by parsing based on a list of AML
+ * opcode templates in AmlOpInfo[].
*/
#include <contrib/dev/acpica/acpi.h>
@@ -135,727 +134,739 @@
static UINT32 AcpiGbl_Depth = 0;
+/* Local prototypes */
+
+static ACPI_STATUS
+AcpiPsGetAmlOpcode (
+ ACPI_WALK_STATE *WalkState);
+
+static ACPI_STATUS
+AcpiPsBuildNamedOp (
+ ACPI_WALK_STATE *WalkState,
+ UINT8 *AmlOpStart,
+ ACPI_PARSE_OBJECT *UnnamedOp,
+ ACPI_PARSE_OBJECT **Op);
+
+static ACPI_STATUS
+AcpiPsCreateOp (
+ ACPI_WALK_STATE *WalkState,
+ UINT8 *AmlOpStart,
+ ACPI_PARSE_OBJECT **NewOp);
+
+static ACPI_STATUS
+AcpiPsGetArguments (
+ ACPI_WALK_STATE *WalkState,
+ UINT8 *AmlOpStart,
+ ACPI_PARSE_OBJECT *Op);
+
+static ACPI_STATUS
+AcpiPsCompleteOp (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT **Op,
+ ACPI_STATUS Status);
+
+static ACPI_STATUS
+AcpiPsCompleteFinalOp (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_STATUS Status);
+
+
/*******************************************************************************
*
- * FUNCTION: AcpiPsParseLoop
+ * FUNCTION: AcpiPsGetAmlOpcode
*
* PARAMETERS: WalkState - Current state
*
* RETURN: Status
*
- * DESCRIPTION: Parse AML (pointed to by the current parser state) and return
- * a tree of ops.
+ * DESCRIPTION: Extract the next AML opcode from the input stream.
*
******************************************************************************/
-ACPI_STATUS
-AcpiPsParseLoop (
+static ACPI_STATUS
+AcpiPsGetAmlOpcode (
ACPI_WALK_STATE *WalkState)
{
- ACPI_STATUS Status = AE_OK;
- ACPI_STATUS Status2;
- ACPI_PARSE_OBJECT *Op = NULL; /* current op */
- ACPI_PARSE_OBJECT *Arg = NULL;
- ACPI_PARSE_OBJECT *PreOp = NULL;
- ACPI_PARSE_STATE *ParserState;
- UINT8 *AmlOpStart = NULL;
+ ACPI_FUNCTION_TRACE_PTR (PsGetAmlOpcode, WalkState);
- ACPI_FUNCTION_TRACE_PTR ("PsParseLoop", WalkState);
- if (WalkState->DescendingCallback == NULL)
+ WalkState->AmlOffset = (UINT32) ACPI_PTR_DIFF (WalkState->ParserState.Aml,
+ WalkState->ParserState.AmlStart);
+ WalkState->Opcode = AcpiPsPeekOpcode (&(WalkState->ParserState));
+
+ /*
+ * First cut to determine what we have found:
+ * 1) A valid AML opcode
+ * 2) A name string
+ * 3) An unknown/invalid opcode
+ */
+ WalkState->OpInfo = AcpiPsGetOpcodeInfo (WalkState->Opcode);
+
+ switch (WalkState->OpInfo->Class)
{
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
+ case AML_CLASS_ASCII:
+ case AML_CLASS_PREFIX:
+ /*
+ * Starts with a valid prefix or ASCII char, this is a name
+ * string. Convert the bare name string to a namepath.
+ */
+ WalkState->Opcode = AML_INT_NAMEPATH_OP;
+ WalkState->ArgTypes = ARGP_NAMESTRING;
+ break;
- ParserState = &WalkState->ParserState;
- WalkState->ArgTypes = 0;
+ case AML_CLASS_UNKNOWN:
-#if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY))
+ /* The opcode is unrecognized. Just skip unknown opcodes */
- if (WalkState->WalkType & ACPI_WALK_METHOD_RESTART)
- {
- /* We are restarting a preempted control method */
+ ACPI_ERROR ((AE_INFO,
+ "Found unknown opcode %X at AML address %p offset %X, ignoring",
+ WalkState->Opcode, WalkState->ParserState.Aml, WalkState->AmlOffset));
- if (AcpiPsHasCompletedScope (ParserState))
- {
- /*
- * We must check if a predicate to an IF or WHILE statement
- * was just completed
- */
- if ((ParserState->Scope->ParseScope.Op) &&
- ((ParserState->Scope->ParseScope.Op->Common.AmlOpcode == AML_IF_OP) ||
- (ParserState->Scope->ParseScope.Op->Common.AmlOpcode == AML_WHILE_OP)) &&
- (WalkState->ControlState) &&
- (WalkState->ControlState->Common.State ==
- ACPI_CONTROL_PREDICATE_EXECUTING))
- {
- /*
- * A predicate was just completed, get the value of the
- * predicate and branch based on that value
- */
- WalkState->Op = NULL;
- Status = AcpiDsGetPredicateValue (WalkState, ACPI_TO_POINTER (TRUE));
- if (ACPI_FAILURE (Status) &&
- ((Status & AE_CODE_MASK) != AE_CODE_CONTROL))
- {
- if (Status == AE_AML_NO_RETURN_VALUE)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Invoked method did not return a value, %s\n",
- AcpiFormatException (Status)));
+ ACPI_DUMP_BUFFER (WalkState->ParserState.Aml, 128);
- }
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "GetPredicate Failed, %s\n",
- AcpiFormatException (Status)));
- return_ACPI_STATUS (Status);
- }
+ /* Assume one-byte bad opcode */
- Status = AcpiPsNextParseState (WalkState, Op, Status);
- }
+ WalkState->ParserState.Aml++;
+ return_ACPI_STATUS (AE_CTRL_PARSE_CONTINUE);
- AcpiPsPopScope (ParserState, &Op,
- &WalkState->ArgTypes, &WalkState->ArgCount);
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", Op));
- }
- else if (WalkState->PrevOp)
- {
- /* We were in the middle of an op */
+ default:
- Op = WalkState->PrevOp;
- WalkState->ArgTypes = WalkState->PrevArgTypes;
- }
+ /* Found opcode info, this is a normal opcode */
+
+ WalkState->ParserState.Aml += AcpiPsGetOpcodeSize (WalkState->Opcode);
+ WalkState->ArgTypes = WalkState->OpInfo->ParseArgs;
+ break;
}
-#endif
- /* Iterative parsing loop, while there is more AML to process: */
+ return_ACPI_STATUS (AE_OK);
+}
- while ((ParserState->Aml < ParserState->AmlEnd) || (Op))
- {
- AmlOpStart = ParserState->Aml;
- if (!Op)
- {
- /* Get the next opcode from the AML stream */
- WalkState->AmlOffset = (UINT32) ACPI_PTR_DIFF (ParserState->Aml,
- ParserState->AmlStart);
- WalkState->Opcode = AcpiPsPeekOpcode (ParserState);
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsBuildNamedOp
+ *
+ * PARAMETERS: WalkState - Current state
+ * AmlOpStart - Begin of named Op in AML
+ * UnnamedOp - Early Op (not a named Op)
+ * Op - Returned Op
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Parse a named Op
+ *
+ ******************************************************************************/
- /*
- * First cut to determine what we have found:
- * 1) A valid AML opcode
- * 2) A name string
- * 3) An unknown/invalid opcode
- */
- WalkState->OpInfo = AcpiPsGetOpcodeInfo (WalkState->Opcode);
- switch (WalkState->OpInfo->Class)
- {
- case AML_CLASS_ASCII:
- case AML_CLASS_PREFIX:
- /*
- * Starts with a valid prefix or ASCII char, this is a name
- * string. Convert the bare name string to a namepath.
- */
- WalkState->Opcode = AML_INT_NAMEPATH_OP;
- WalkState->ArgTypes = ARGP_NAMESTRING;
- break;
+static ACPI_STATUS
+AcpiPsBuildNamedOp (
+ ACPI_WALK_STATE *WalkState,
+ UINT8 *AmlOpStart,
+ ACPI_PARSE_OBJECT *UnnamedOp,
+ ACPI_PARSE_OBJECT **Op)
+{
+ ACPI_STATUS Status = AE_OK;
+ ACPI_PARSE_OBJECT *Arg = NULL;
- case AML_CLASS_UNKNOWN:
- /* The opcode is unrecognized. Just skip unknown opcodes */
+ ACPI_FUNCTION_TRACE_PTR (PsBuildNamedOp, WalkState);
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Found unknown opcode %X at AML address %p offset %X, ignoring\n",
- WalkState->Opcode, ParserState->Aml, WalkState->AmlOffset));
- ACPI_DUMP_BUFFER (ParserState->Aml, 128);
+ UnnamedOp->Common.Value.Arg = NULL;
+ UnnamedOp->Common.ArgListLength = 0;
+ UnnamedOp->Common.AmlOpcode = WalkState->Opcode;
- /* Assume one-byte bad opcode */
+ /*
+ * Get and append arguments until we find the node that contains
+ * the name (the type ARGP_NAME).
+ */
+ while (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) &&
+ (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) != ARGP_NAME))
+ {
+ Status = AcpiPsGetNextArg (WalkState, &(WalkState->ParserState),
+ GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), &Arg);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
- ParserState->Aml++;
- continue;
+ AcpiPsAppendArg (UnnamedOp, Arg);
+ INCREMENT_ARG_LIST (WalkState->ArgTypes);
+ }
- default:
+ /*
+ * Make sure that we found a NAME and didn't run out of arguments
+ */
+ if (!GET_CURRENT_ARG_TYPE (WalkState->ArgTypes))
+ {
+ return_ACPI_STATUS (AE_AML_NO_OPERAND);
+ }
- /* Found opcode info, this is a normal opcode */
+ /* We know that this arg is a name, move to next arg */
- ParserState->Aml += AcpiPsGetOpcodeSize (WalkState->Opcode);
- WalkState->ArgTypes = WalkState->OpInfo->ParseArgs;
- break;
- }
+ INCREMENT_ARG_LIST (WalkState->ArgTypes);
- /* Create Op structure and append to parent's argument list */
+ /*
+ * Find the object. This will either insert the object into
+ * the namespace or simply look it up
+ */
+ WalkState->Op = NULL;
- if (WalkState->OpInfo->Flags & AML_NAMED)
- {
- /* Allocate a new PreOp if necessary */
+ Status = WalkState->DescendingCallback (WalkState, Op);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_EXCEPTION ((AE_INFO, Status, "During name lookup/catalog"));
+ return_ACPI_STATUS (Status);
+ }
- if (!PreOp)
- {
- PreOp = AcpiPsAllocOp (WalkState->Opcode);
- if (!PreOp)
- {
- Status = AE_NO_MEMORY;
- goto CloseThisOp;
- }
- }
+ if (!*Op)
+ {
+ return_ACPI_STATUS (AE_CTRL_PARSE_CONTINUE);
+ }
- PreOp->Common.Value.Arg = NULL;
- PreOp->Common.AmlOpcode = WalkState->Opcode;
+ Status = AcpiPsNextParseState (WalkState, *Op, Status);
+ if (ACPI_FAILURE (Status))
+ {
+ if (Status == AE_CTRL_PENDING)
+ {
+ return_ACPI_STATUS (AE_CTRL_PARSE_PENDING);
+ }
+ return_ACPI_STATUS (Status);
+ }
- /*
- * Get and append arguments until we find the node that contains
- * the name (the type ARGP_NAME).
- */
- while (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) &&
- (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) != ARGP_NAME))
- {
- Status = AcpiPsGetNextArg (WalkState, ParserState,
- GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), &Arg);
- if (ACPI_FAILURE (Status))
- {
- goto CloseThisOp;
- }
+ AcpiPsAppendArg (*Op, UnnamedOp->Common.Value.Arg);
+ AcpiGbl_Depth++;
- AcpiPsAppendArg (PreOp, Arg);
- INCREMENT_ARG_LIST (WalkState->ArgTypes);
- }
+ if ((*Op)->Common.AmlOpcode == AML_REGION_OP)
+ {
+ /*
+ * Defer final parsing of an OperationRegion body, because we don't
+ * have enough info in the first pass to parse it correctly (i.e.,
+ * there may be method calls within the TermArg elements of the body.)
+ *
+ * However, we must continue parsing because the opregion is not a
+ * standalone package -- we don't know where the end is at this point.
+ *
+ * (Length is unknown until parse of the body complete)
+ */
+ (*Op)->Named.Data = AmlOpStart;
+ (*Op)->Named.Length = 0;
+ }
- /*
- * Make sure that we found a NAME and didn't run out of
- * arguments
- */
- if (!GET_CURRENT_ARG_TYPE (WalkState->ArgTypes))
- {
- Status = AE_AML_NO_OPERAND;
- goto CloseThisOp;
- }
+ return_ACPI_STATUS (AE_OK);
+}
- /* We know that this arg is a name, move to next arg */
- INCREMENT_ARG_LIST (WalkState->ArgTypes);
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsCreateOp
+ *
+ * PARAMETERS: WalkState - Current state
+ * AmlOpStart - Op start in AML
+ * NewOp - Returned Op
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Get Op from AML
+ *
+ ******************************************************************************/
- /*
- * Find the object. This will either insert the object into
- * the namespace or simply look it up
- */
- WalkState->Op = NULL;
+static ACPI_STATUS
+AcpiPsCreateOp (
+ ACPI_WALK_STATE *WalkState,
+ UINT8 *AmlOpStart,
+ ACPI_PARSE_OBJECT **NewOp)
+{
+ ACPI_STATUS Status = AE_OK;
+ ACPI_PARSE_OBJECT *Op;
+ ACPI_PARSE_OBJECT *NamedOp = NULL;
+ ACPI_PARSE_OBJECT *ParentScope;
+ UINT8 ArgumentCount;
+ const ACPI_OPCODE_INFO *OpInfo;
- Status = WalkState->DescendingCallback (WalkState, &Op);
- if (ACPI_FAILURE (Status))
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "During name lookup/catalog, %s\n",
- AcpiFormatException (Status)));
- goto CloseThisOp;
- }
- if (!Op)
- {
- continue;
- }
+ ACPI_FUNCTION_TRACE_PTR (PsCreateOp, WalkState);
- Status = AcpiPsNextParseState (WalkState, Op, Status);
- if (Status == AE_CTRL_PENDING)
- {
- Status = AE_OK;
- goto CloseThisOp;
- }
- if (ACPI_FAILURE (Status))
- {
- goto CloseThisOp;
- }
+ Status = AcpiPsGetAmlOpcode (WalkState);
+ if (Status == AE_CTRL_PARSE_CONTINUE)
+ {
+ return_ACPI_STATUS (AE_CTRL_PARSE_CONTINUE);
+ }
- AcpiPsAppendArg (Op, PreOp->Common.Value.Arg);
- AcpiGbl_Depth++;
+ /* Create Op structure and append to parent's argument list */
- if (Op->Common.AmlOpcode == AML_REGION_OP)
- {
- /*
- * Defer final parsing of an OperationRegion body,
- * because we don't have enough info in the first pass
- * to parse it correctly (i.e., there may be method
- * calls within the TermArg elements of the body.)
- *
- * However, we must continue parsing because
- * the opregion is not a standalone package --
- * we don't know where the end is at this point.
- *
- * (Length is unknown until parse of the body complete)
- */
- Op->Named.Data = AmlOpStart;
- Op->Named.Length = 0;
- }
- }
- else
- {
- /* Not a named opcode, just allocate Op and append to parent */
+ WalkState->OpInfo = AcpiPsGetOpcodeInfo (WalkState->Opcode);
+ Op = AcpiPsAllocOp (WalkState->Opcode);
+ if (!Op)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
- WalkState->OpInfo = AcpiPsGetOpcodeInfo (WalkState->Opcode);
- Op = AcpiPsAllocOp (WalkState->Opcode);
- if (!Op)
- {
- Status = AE_NO_MEMORY;
- goto CloseThisOp;
- }
+ if (WalkState->OpInfo->Flags & AML_NAMED)
+ {
+ Status = AcpiPsBuildNamedOp (WalkState, AmlOpStart, Op, &NamedOp);
+ AcpiPsFreeOp (Op);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
- if (WalkState->OpInfo->Flags & AML_CREATE)
- {
- /*
- * Backup to beginning of CreateXXXfield declaration
- * BodyLength is unknown until we parse the body
- */
- Op->Named.Data = AmlOpStart;
- Op->Named.Length = 0;
- }
+ *NewOp = NamedOp;
+ return_ACPI_STATUS (AE_OK);
+ }
- AcpiPsAppendArg (AcpiPsGetParentScope (ParserState), Op);
+ /* Not a named opcode, just allocate Op and append to parent */
- if ((WalkState->DescendingCallback != NULL))
- {
- /*
- * Find the object. This will either insert the object into
- * the namespace or simply look it up
- */
- WalkState->Op = Op;
-
- Status = WalkState->DescendingCallback (WalkState, &Op);
- Status = AcpiPsNextParseState (WalkState, Op, Status);
- if (Status == AE_CTRL_PENDING)
- {
- Status = AE_OK;
- goto CloseThisOp;
- }
-
- if (ACPI_FAILURE (Status))
- {
- goto CloseThisOp;
- }
- }
- }
+ if (WalkState->OpInfo->Flags & AML_CREATE)
+ {
+ /*
+ * Backup to beginning of CreateXXXfield declaration
+ * BodyLength is unknown until we parse the body
+ */
+ Op->Named.Data = AmlOpStart;
+ Op->Named.Length = 0;
+ }
- Op->Common.AmlOffset = WalkState->AmlOffset;
+ ParentScope = AcpiPsGetParentScope (&(WalkState->ParserState));
+ AcpiPsAppendArg (ParentScope, Op);
- if (WalkState->OpInfo)
+ if (ParentScope)
+ {
+ OpInfo = AcpiPsGetOpcodeInfo (ParentScope->Common.AmlOpcode);
+ if (OpInfo->Flags & AML_HAS_TARGET)
+ {
+ ArgumentCount = AcpiPsGetArgumentCount (OpInfo->Type);
+ if (ParentScope->Common.ArgListLength > ArgumentCount)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
- "Opcode %4.4X [%s] Op %p Aml %p AmlOffset %5.5X\n",
- (UINT32) Op->Common.AmlOpcode, WalkState->OpInfo->Name,
- Op, ParserState->Aml, Op->Common.AmlOffset));
+ Op->Common.Flags |= ACPI_PARSEOP_TARGET;
}
}
+ else if (ParentScope->Common.AmlOpcode == AML_INCREMENT_OP)
+ {
+ Op->Common.Flags |= ACPI_PARSEOP_TARGET;
+ }
+ }
-
+ if (WalkState->DescendingCallback != NULL)
+ {
/*
- * Start ArgCount at zero because we don't know if there are
- * any args yet
+ * Find the object. This will either insert the object into
+ * the namespace or simply look it up
*/
- WalkState->ArgCount = 0;
+ WalkState->Op = *NewOp = Op;
- /* Are there any arguments that must be processed? */
-
- if (WalkState->ArgTypes)
+ Status = WalkState->DescendingCallback (WalkState, &Op);
+ Status = AcpiPsNextParseState (WalkState, Op, Status);
+ if (Status == AE_CTRL_PENDING)
{
- /* Get arguments */
-
- switch (Op->Common.AmlOpcode)
- {
- case AML_BYTE_OP: /* AML_BYTEDATA_ARG */
- case AML_WORD_OP: /* AML_WORDDATA_ARG */
- case AML_DWORD_OP: /* AML_DWORDATA_ARG */
- case AML_QWORD_OP: /* AML_QWORDATA_ARG */
- case AML_STRING_OP: /* AML_ASCIICHARLIST_ARG */
-
- /* Fill in constant or string argument directly */
+ Status = AE_CTRL_PARSE_PENDING;
+ }
+ }
- AcpiPsGetNextSimpleArg (ParserState,
- GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), Op);
- break;
+ return_ACPI_STATUS (Status);
+}
- case AML_INT_NAMEPATH_OP: /* AML_NAMESTRING_ARG */
- Status = AcpiPsGetNextNamepath (WalkState, ParserState, Op, 1);
- if (ACPI_FAILURE (Status))
- {
- goto CloseThisOp;
- }
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsGetArguments
+ *
+ * PARAMETERS: WalkState - Current state
+ * AmlOpStart - Op start in AML
+ * Op - Current Op
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Get arguments for passed Op.
+ *
+ ******************************************************************************/
- WalkState->ArgTypes = 0;
- break;
+static ACPI_STATUS
+AcpiPsGetArguments (
+ ACPI_WALK_STATE *WalkState,
+ UINT8 *AmlOpStart,
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_STATUS Status = AE_OK;
+ ACPI_PARSE_OBJECT *Arg = NULL;
- default:
- /*
- * Op is not a constant or string, append each argument
- * to the Op
- */
- while (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) &&
- !WalkState->ArgCount)
- {
- WalkState->AmlOffset = (UINT32)
- ACPI_PTR_DIFF (ParserState->Aml, ParserState->AmlStart);
- Status = AcpiPsGetNextArg (WalkState, ParserState,
- GET_CURRENT_ARG_TYPE (WalkState->ArgTypes),
- &Arg);
- if (ACPI_FAILURE (Status))
- {
- goto CloseThisOp;
- }
+ ACPI_FUNCTION_TRACE_PTR (PsGetArguments, WalkState);
- if (Arg)
- {
- Arg->Common.AmlOffset = WalkState->AmlOffset;
- AcpiPsAppendArg (Op, Arg);
- }
- INCREMENT_ARG_LIST (WalkState->ArgTypes);
- }
+ switch (Op->Common.AmlOpcode)
+ {
+ case AML_BYTE_OP: /* AML_BYTEDATA_ARG */
+ case AML_WORD_OP: /* AML_WORDDATA_ARG */
+ case AML_DWORD_OP: /* AML_DWORDATA_ARG */
+ case AML_QWORD_OP: /* AML_QWORDATA_ARG */
+ case AML_STRING_OP: /* AML_ASCIICHARLIST_ARG */
- /* Special processing for certain opcodes */
+ /* Fill in constant or string argument directly */
- /* TBD (remove): Temporary mechanism to disable this code if needed */
+ AcpiPsGetNextSimpleArg (&(WalkState->ParserState),
+ GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), Op);
+ break;
-#ifdef ACPI_ENABLE_MODULE_LEVEL_CODE
+ case AML_INT_NAMEPATH_OP: /* AML_NAMESTRING_ARG */
- if ((WalkState->PassNumber <= ACPI_IMODE_LOAD_PASS1) &&
- ((WalkState->ParseFlags & ACPI_PARSE_DISASSEMBLE) == 0))
- {
- /*
- * We want to skip If/Else/While constructs during Pass1
- * because we want to actually conditionally execute the
- * code during Pass2.
- *
- * Except for disassembly, where we always want to
- * walk the If/Else/While packages
- */
- switch (Op->Common.AmlOpcode)
- {
- case AML_IF_OP:
- case AML_ELSE_OP:
- case AML_WHILE_OP:
+ Status = AcpiPsGetNextNamepath (WalkState, &(WalkState->ParserState), Op, 1);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
- "Pass1: Skipping an If/Else/While body\n"));
+ WalkState->ArgTypes = 0;
+ break;
- /* Skip body of if/else/while in pass 1 */
+ default:
+ /*
+ * Op is not a constant or string, append each argument to the Op
+ */
+ while (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) && !WalkState->ArgCount)
+ {
+ WalkState->AmlOffset = (UINT32) ACPI_PTR_DIFF (WalkState->ParserState.Aml,
+ WalkState->ParserState.AmlStart);
- ParserState->Aml = ParserState->PkgEnd;
- WalkState->ArgCount = 0;
- break;
+ Status = AcpiPsGetNextArg (WalkState, &(WalkState->ParserState),
+ GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), &Arg);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
- default:
- break;
- }
- }
-#endif
- switch (Op->Common.AmlOpcode)
- {
- case AML_METHOD_OP:
-
- /*
- * Skip parsing of control method
- * because we don't have enough info in the first pass
- * to parse it correctly.
- *
- * Save the length and address of the body
- */
- Op->Named.Data = ParserState->Aml;
- Op->Named.Length = (UINT32) (ParserState->PkgEnd -
- ParserState->Aml);
-
- /* Skip body of method */
-
- ParserState->Aml = ParserState->PkgEnd;
- WalkState->ArgCount = 0;
- break;
-
- case AML_BUFFER_OP:
- case AML_PACKAGE_OP:
- case AML_VAR_PACKAGE_OP:
-
- if ((Op->Common.Parent) &&
- (Op->Common.Parent->Common.AmlOpcode == AML_NAME_OP) &&
- (WalkState->PassNumber <= ACPI_IMODE_LOAD_PASS2))
- {
- /*
- * Skip parsing of Buffers and Packages
- * because we don't have enough info in the first pass
- * to parse them correctly.
- */
- Op->Named.Data = AmlOpStart;
- Op->Named.Length = (UINT32) (ParserState->PkgEnd -
- AmlOpStart);
-
- /* Skip body */
-
- ParserState->Aml = ParserState->PkgEnd;
- WalkState->ArgCount = 0;
- }
- break;
+ if (Arg)
+ {
+ Arg->Common.AmlOffset = WalkState->AmlOffset;
+ AcpiPsAppendArg (Op, Arg);
+ }
- case AML_WHILE_OP:
+ INCREMENT_ARG_LIST (WalkState->ArgTypes);
+ }
- if (WalkState->ControlState)
- {
- WalkState->ControlState->Control.PackageEnd =
- ParserState->PkgEnd;
- }
- break;
- default:
+ /* Special processing for certain opcodes */
- /* No action for all other opcodes */
- break;
- }
- break;
- }
- }
+ /* TBD (remove): Temporary mechanism to disable this code if needed */
- /* Check for arguments that need to be processed */
+#ifdef ACPI_ENABLE_MODULE_LEVEL_CODE
- if (WalkState->ArgCount)
+ if ((WalkState->PassNumber <= ACPI_IMODE_LOAD_PASS1) &&
+ ((WalkState->ParseFlags & ACPI_PARSE_DISASSEMBLE) == 0))
{
/*
- * There are arguments (complex ones), push Op and
- * prepare for argument
+ * We want to skip If/Else/While constructs during Pass1 because we
+ * want to actually conditionally execute the code during Pass2.
+ *
+ * Except for disassembly, where we always want to walk the
+ * If/Else/While packages
*/
- Status = AcpiPsPushScope (ParserState, Op,
- WalkState->ArgTypes, WalkState->ArgCount);
- if (ACPI_FAILURE (Status))
+ switch (Op->Common.AmlOpcode)
{
- goto CloseThisOp;
- }
- Op = NULL;
- continue;
- }
+ case AML_IF_OP:
+ case AML_ELSE_OP:
+ case AML_WHILE_OP:
- /*
- * All arguments have been processed -- Op is complete,
- * prepare for next
- */
- WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
- if (WalkState->OpInfo->Flags & AML_NAMED)
- {
- if (AcpiGbl_Depth)
- {
- AcpiGbl_Depth--;
- }
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+ "Pass1: Skipping an If/Else/While body\n"));
- if (Op->Common.AmlOpcode == AML_REGION_OP)
- {
- /*
- * Skip parsing of control method or opregion body,
- * because we don't have enough info in the first pass
- * to parse them correctly.
- *
- * Completed parsing an OpRegion declaration, we now
- * know the length.
- */
- Op->Named.Length = (UINT32) (ParserState->Aml - Op->Named.Data);
+ /* Skip body of if/else/while in pass 1 */
+
+ WalkState->ParserState.Aml = WalkState->ParserState.PkgEnd;
+ WalkState->ArgCount = 0;
+ break;
+
+ default:
+ break;
}
}
+#endif
- if (WalkState->OpInfo->Flags & AML_CREATE)
+ switch (Op->Common.AmlOpcode)
{
+ case AML_METHOD_OP:
/*
- * Backup to beginning of CreateXXXfield declaration (1 for
- * Opcode)
+ * Skip parsing of control method because we don't have enough
+ * info in the first pass to parse it correctly.
*
- * BodyLength is unknown until we parse the body
+ * Save the length and address of the body
*/
- Op->Named.Length = (UINT32) (ParserState->Aml - Op->Named.Data);
- }
+ Op->Named.Data = WalkState->ParserState.Aml;
+ Op->Named.Length = (UINT32)
+ (WalkState->ParserState.PkgEnd - WalkState->ParserState.Aml);
- /* This op complete, notify the dispatcher */
+ /* Skip body of method */
- if (WalkState->AscendingCallback != NULL)
- {
- WalkState->Op = Op;
- WalkState->Opcode = Op->Common.AmlOpcode;
+ WalkState->ParserState.Aml = WalkState->ParserState.PkgEnd;
+ WalkState->ArgCount = 0;
+ break;
- Status = WalkState->AscendingCallback (WalkState);
- Status = AcpiPsNextParseState (WalkState, Op, Status);
- if (Status == AE_CTRL_PENDING)
+ case AML_BUFFER_OP:
+ case AML_PACKAGE_OP:
+ case AML_VAR_PACKAGE_OP:
+
+ if ((Op->Common.Parent) &&
+ (Op->Common.Parent->Common.AmlOpcode == AML_NAME_OP) &&
+ (WalkState->PassNumber <= ACPI_IMODE_LOAD_PASS2))
{
- Status = AE_OK;
- goto CloseThisOp;
+ /*
+ * Skip parsing of Buffers and Packages because we don't have
+ * enough info in the first pass to parse them correctly.
+ */
+ Op->Named.Data = AmlOpStart;
+ Op->Named.Length = (UINT32)
+ (WalkState->ParserState.PkgEnd - AmlOpStart);
+
+ /* Skip body */
+
+ WalkState->ParserState.Aml = WalkState->ParserState.PkgEnd;
+ WalkState->ArgCount = 0;
}
- }
+ break;
+ case AML_WHILE_OP:
-CloseThisOp:
- /*
- * Finished one argument of the containing scope
- */
- ParserState->Scope->ParseScope.ArgCount--;
+ if (WalkState->ControlState)
+ {
+ WalkState->ControlState->Control.PackageEnd =
+ WalkState->ParserState.PkgEnd;
+ }
+ break;
- /* Finished with PreOp */
+ default:
- if (PreOp)
- {
- AcpiPsFreeOp (PreOp);
- PreOp = NULL;
+ /* No action for all other opcodes */
+ break;
}
- /* Close this Op (will result in parse subtree deletion) */
+ break;
+ }
- Status2 = AcpiPsCompleteThisOp (WalkState, Op);
- if (ACPI_FAILURE (Status2))
- {
- return_ACPI_STATUS (Status2);
- }
- Op = NULL;
+ return_ACPI_STATUS (AE_OK);
+}
- switch (Status)
- {
- case AE_OK:
- break;
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsCompleteOp
+ *
+ * PARAMETERS: WalkState - Current state
+ * Op - Returned Op
+ * Status - Parse status before complete Op
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Complete Op
+ *
+ ******************************************************************************/
- case AE_CTRL_TRANSFER:
+static ACPI_STATUS
+AcpiPsCompleteOp (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT **Op,
+ ACPI_STATUS Status)
+{
+ ACPI_STATUS Status2;
- /* We are about to transfer to a called method. */
- WalkState->PrevOp = Op;
- WalkState->PrevArgTypes = WalkState->ArgTypes;
- return_ACPI_STATUS (Status);
+ ACPI_FUNCTION_TRACE_PTR (PsCompleteOp, WalkState);
- case AE_CTRL_END:
+ /*
+ * Finished one argument of the containing scope
+ */
+ WalkState->ParserState.Scope->ParseScope.ArgCount--;
- AcpiPsPopScope (ParserState, &Op,
- &WalkState->ArgTypes, &WalkState->ArgCount);
+ /* Close this Op (will result in parse subtree deletion) */
- if (Op)
- {
- WalkState->Op = Op;
- WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
- WalkState->Opcode = Op->Common.AmlOpcode;
+ Status2 = AcpiPsCompleteThisOp (WalkState, *Op);
+ if (ACPI_FAILURE (Status2))
+ {
+ return_ACPI_STATUS (Status2);
+ }
- Status = WalkState->AscendingCallback (WalkState);
- Status = AcpiPsNextParseState (WalkState, Op, Status);
+ *Op = NULL;
- Status2 = AcpiPsCompleteThisOp (WalkState, Op);
- if (ACPI_FAILURE (Status2))
- {
- return_ACPI_STATUS (Status2);
- }
- Op = NULL;
- }
- Status = AE_OK;
- break;
+ switch (Status)
+ {
+ case AE_OK:
+ break;
- case AE_CTRL_BREAK:
- case AE_CTRL_CONTINUE:
+ case AE_CTRL_TRANSFER:
- /* Pop off scopes until we find the While */
+ /* We are about to transfer to a called method */
- while (!Op || (Op->Common.AmlOpcode != AML_WHILE_OP))
- {
- AcpiPsPopScope (ParserState, &Op,
- &WalkState->ArgTypes, &WalkState->ArgCount);
- }
+ WalkState->PrevOp = NULL;
+ WalkState->PrevArgTypes = WalkState->ArgTypes;
+ return_ACPI_STATUS (Status);
- /* Close this iteration of the While loop */
- WalkState->Op = Op;
- WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
- WalkState->Opcode = Op->Common.AmlOpcode;
+ case AE_CTRL_END:
+
+ AcpiPsPopScope (&(WalkState->ParserState), Op,
+ &WalkState->ArgTypes, &WalkState->ArgCount);
+
+ if (*Op)
+ {
+ WalkState->Op = *Op;
+ WalkState->OpInfo = AcpiPsGetOpcodeInfo ((*Op)->Common.AmlOpcode);
+ WalkState->Opcode = (*Op)->Common.AmlOpcode;
Status = WalkState->AscendingCallback (WalkState);
- Status = AcpiPsNextParseState (WalkState, Op, Status);
+ Status = AcpiPsNextParseState (WalkState, *Op, Status);
- Status2 = AcpiPsCompleteThisOp (WalkState, Op);
+ Status2 = AcpiPsCompleteThisOp (WalkState, *Op);
if (ACPI_FAILURE (Status2))
{
return_ACPI_STATUS (Status2);
}
- Op = NULL;
+ }
- Status = AE_OK;
- break;
+ Status = AE_OK;
+ break;
- case AE_CTRL_TERMINATE:
+ case AE_CTRL_BREAK:
+ case AE_CTRL_CONTINUE:
- Status = AE_OK;
+ /* Pop off scopes until we find the While */
- /* Clean up */
- do
- {
- if (Op)
- {
- Status2 = AcpiPsCompleteThisOp (WalkState, Op);
- if (ACPI_FAILURE (Status2))
- {
- return_ACPI_STATUS (Status2);
- }
- }
- AcpiPsPopScope (ParserState, &Op,
- &WalkState->ArgTypes, &WalkState->ArgCount);
+ while (!(*Op) || ((*Op)->Common.AmlOpcode != AML_WHILE_OP))
+ {
+ AcpiPsPopScope (&(WalkState->ParserState), Op,
+ &WalkState->ArgTypes, &WalkState->ArgCount);
+ }
- } while (Op);
+ /* Close this iteration of the While loop */
- return_ACPI_STATUS (Status);
+ WalkState->Op = *Op;
+ WalkState->OpInfo = AcpiPsGetOpcodeInfo ((*Op)->Common.AmlOpcode);
+ WalkState->Opcode = (*Op)->Common.AmlOpcode;
+
+ Status = WalkState->AscendingCallback (WalkState);
+ Status = AcpiPsNextParseState (WalkState, *Op, Status);
+ Status2 = AcpiPsCompleteThisOp (WalkState, *Op);
+ if (ACPI_FAILURE (Status2))
+ {
+ return_ACPI_STATUS (Status2);
+ }
- default: /* All other non-AE_OK status */
+ Status = AE_OK;
+ break;
- do
+
+ case AE_CTRL_TERMINATE:
+
+ /* Clean up */
+ do
+ {
+ if (*Op)
{
- if (Op)
+ Status2 = AcpiPsCompleteThisOp (WalkState, *Op);
+ if (ACPI_FAILURE (Status2))
{
- Status2 = AcpiPsCompleteThisOp (WalkState, Op);
- if (ACPI_FAILURE (Status2))
- {
- return_ACPI_STATUS (Status2);
- }
+ return_ACPI_STATUS (Status2);
}
- AcpiPsPopScope (ParserState, &Op,
- &WalkState->ArgTypes, &WalkState->ArgCount);
- } while (Op);
+ AcpiUtDeleteGenericState (
+ AcpiUtPopGenericState (&WalkState->ControlState));
+ }
+ AcpiPsPopScope (&(WalkState->ParserState), Op,
+ &WalkState->ArgTypes, &WalkState->ArgCount);
- /*
- * TBD: Cleanup parse ops on error
- */
-#if 0
- if (Op == NULL)
+ } while (*Op);
+
+ return_ACPI_STATUS (AE_OK);
+
+
+ default: /* All other non-AE_OK status */
+
+ do
+ {
+ if (*Op)
{
- AcpiPsPopScope (ParserState, &Op,
- &WalkState->ArgTypes, &WalkState->ArgCount);
+ Status2 = AcpiPsCompleteThisOp (WalkState, *Op);
+ if (ACPI_FAILURE (Status2))
+ {
+ return_ACPI_STATUS (Status2);
+ }
}
-#endif
- WalkState->PrevOp = Op;
- WalkState->PrevArgTypes = WalkState->ArgTypes;
- return_ACPI_STATUS (Status);
- }
- /* This scope complete? */
+ AcpiPsPopScope (&(WalkState->ParserState), Op,
+ &WalkState->ArgTypes, &WalkState->ArgCount);
- if (AcpiPsHasCompletedScope (ParserState))
+ } while (*Op);
+
+
+#if 0
+ /*
+ * TBD: Cleanup parse ops on error
+ */
+ if (*Op == NULL)
{
- AcpiPsPopScope (ParserState, &Op,
+ AcpiPsPopScope (ParserState, Op,
&WalkState->ArgTypes, &WalkState->ArgCount);
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", Op));
- }
- else
- {
- Op = NULL;
}
+#endif
+ WalkState->PrevOp = NULL;
+ WalkState->PrevArgTypes = WalkState->ArgTypes;
+ return_ACPI_STATUS (Status);
+ }
- } /* while ParserState->Aml */
+ /* This scope complete? */
+
+ if (AcpiPsHasCompletedScope (&(WalkState->ParserState)))
+ {
+ AcpiPsPopScope (&(WalkState->ParserState), Op,
+ &WalkState->ArgTypes, &WalkState->ArgCount);
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", *Op));
+ }
+ else
+ {
+ *Op = NULL;
+ }
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsCompleteFinalOp
+ *
+ * PARAMETERS: WalkState - Current state
+ * Op - Current Op
+ * Status - Current parse status before complete last
+ * Op
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Complete last Op.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiPsCompleteFinalOp (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_STATUS Status)
+{
+ ACPI_STATUS Status2;
+
+
+ ACPI_FUNCTION_TRACE_PTR (PsCompleteFinalOp, WalkState);
/*
* Complete the last Op (if not completed), and clear the scope stack.
* It is easily possible to end an AML "package" with an unbounded number
* of open scopes (such as when several ASL blocks are closed with
- * sequential closing braces). We want to terminate each one cleanly.
+ * sequential closing braces). We want to terminate each one cleanly.
*/
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "AML package complete at Op %p\n", Op));
do
@@ -864,7 +875,7 @@ CloseThisOp:
{
if (WalkState->AscendingCallback != NULL)
{
- WalkState->Op = Op;
+ WalkState->Op = Op;
WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
WalkState->Opcode = Op->Common.AmlOpcode;
@@ -872,8 +883,11 @@ CloseThisOp:
Status = AcpiPsNextParseState (WalkState, Op, Status);
if (Status == AE_CTRL_PENDING)
{
- Status = AE_OK;
- goto CloseThisOp;
+ Status = AcpiPsCompleteOp (WalkState, &Op, AE_OK);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
}
if (Status == AE_CTRL_TERMINATE)
@@ -892,7 +906,7 @@ CloseThisOp:
}
}
- AcpiPsPopScope (ParserState, &Op,
+ AcpiPsPopScope (&(WalkState->ParserState), &Op,
&WalkState->ArgTypes, &WalkState->ArgCount);
} while (Op);
@@ -916,7 +930,7 @@ CloseThisOp:
}
}
- AcpiPsPopScope (ParserState, &Op, &WalkState->ArgTypes,
+ AcpiPsPopScope (&(WalkState->ParserState), &Op, &WalkState->ArgTypes,
&WalkState->ArgCount);
} while (Op);
@@ -925,3 +939,248 @@ CloseThisOp:
}
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsParseLoop
+ *
+ * PARAMETERS: WalkState - Current state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Parse AML (pointed to by the current parser state) and return
+ * a tree of ops.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiPsParseLoop (
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status = AE_OK;
+ ACPI_PARSE_OBJECT *Op = NULL; /* current op */
+ ACPI_PARSE_STATE *ParserState;
+ UINT8 *AmlOpStart = NULL;
+
+
+ ACPI_FUNCTION_TRACE_PTR (PsParseLoop, WalkState);
+
+
+ if (WalkState->DescendingCallback == NULL)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ ParserState = &WalkState->ParserState;
+ WalkState->ArgTypes = 0;
+
+#if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY))
+
+ if (WalkState->WalkType & ACPI_WALK_METHOD_RESTART)
+ {
+ /* We are restarting a preempted control method */
+
+ if (AcpiPsHasCompletedScope (ParserState))
+ {
+ /*
+ * We must check if a predicate to an IF or WHILE statement
+ * was just completed
+ */
+ if ((ParserState->Scope->ParseScope.Op) &&
+ ((ParserState->Scope->ParseScope.Op->Common.AmlOpcode == AML_IF_OP) ||
+ (ParserState->Scope->ParseScope.Op->Common.AmlOpcode == AML_WHILE_OP)) &&
+ (WalkState->ControlState) &&
+ (WalkState->ControlState->Common.State ==
+ ACPI_CONTROL_PREDICATE_EXECUTING))
+ {
+ /*
+ * A predicate was just completed, get the value of the
+ * predicate and branch based on that value
+ */
+ WalkState->Op = NULL;
+ Status = AcpiDsGetPredicateValue (WalkState, ACPI_TO_POINTER (TRUE));
+ if (ACPI_FAILURE (Status) &&
+ ((Status & AE_CODE_MASK) != AE_CODE_CONTROL))
+ {
+ if (Status == AE_AML_NO_RETURN_VALUE)
+ {
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Invoked method did not return a value"));
+
+ }
+
+ ACPI_EXCEPTION ((AE_INFO, Status, "GetPredicate Failed"));
+ return_ACPI_STATUS (Status);
+ }
+
+ Status = AcpiPsNextParseState (WalkState, Op, Status);
+ }
+
+ AcpiPsPopScope (ParserState, &Op,
+ &WalkState->ArgTypes, &WalkState->ArgCount);
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", Op));
+ }
+ else if (WalkState->PrevOp)
+ {
+ /* We were in the middle of an op */
+
+ Op = WalkState->PrevOp;
+ WalkState->ArgTypes = WalkState->PrevArgTypes;
+ }
+ }
+#endif
+
+ /* Iterative parsing loop, while there is more AML to process: */
+
+ while ((ParserState->Aml < ParserState->AmlEnd) || (Op))
+ {
+ AmlOpStart = ParserState->Aml;
+ if (!Op)
+ {
+ Status = AcpiPsCreateOp (WalkState, AmlOpStart, &Op);
+ if (ACPI_FAILURE (Status))
+ {
+ if (Status == AE_CTRL_PARSE_CONTINUE)
+ {
+ continue;
+ }
+
+ if (Status == AE_CTRL_PARSE_PENDING)
+ {
+ Status = AE_OK;
+ }
+
+ Status = AcpiPsCompleteOp (WalkState, &Op, Status);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ continue;
+ }
+
+ Op->Common.AmlOffset = WalkState->AmlOffset;
+
+ if (WalkState->OpInfo)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+ "Opcode %4.4X [%s] Op %p Aml %p AmlOffset %5.5X\n",
+ (UINT32) Op->Common.AmlOpcode, WalkState->OpInfo->Name,
+ Op, ParserState->Aml, Op->Common.AmlOffset));
+ }
+ }
+
+
+ /*
+ * Start ArgCount at zero because we don't know if there are
+ * any args yet
+ */
+ WalkState->ArgCount = 0;
+
+ /* Are there any arguments that must be processed? */
+
+ if (WalkState->ArgTypes)
+ {
+ /* Get arguments */
+
+ Status = AcpiPsGetArguments (WalkState, AmlOpStart, Op);
+ if (ACPI_FAILURE (Status))
+ {
+ Status = AcpiPsCompleteOp (WalkState, &Op, Status);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ continue;
+ }
+ }
+
+ /* Check for arguments that need to be processed */
+
+ if (WalkState->ArgCount)
+ {
+ /*
+ * There are arguments (complex ones), push Op and
+ * prepare for argument
+ */
+ Status = AcpiPsPushScope (ParserState, Op,
+ WalkState->ArgTypes, WalkState->ArgCount);
+ if (ACPI_FAILURE (Status))
+ {
+ Status = AcpiPsCompleteOp (WalkState, &Op, Status);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ continue;
+ }
+
+ Op = NULL;
+ continue;
+ }
+
+ /*
+ * All arguments have been processed -- Op is complete,
+ * prepare for next
+ */
+ WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+ if (WalkState->OpInfo->Flags & AML_NAMED)
+ {
+ if (AcpiGbl_Depth)
+ {
+ AcpiGbl_Depth--;
+ }
+
+ if (Op->Common.AmlOpcode == AML_REGION_OP)
+ {
+ /*
+ * Skip parsing of control method or opregion body,
+ * because we don't have enough info in the first pass
+ * to parse them correctly.
+ *
+ * Completed parsing an OpRegion declaration, we now
+ * know the length.
+ */
+ Op->Named.Length = (UINT32) (ParserState->Aml - Op->Named.Data);
+ }
+ }
+
+ if (WalkState->OpInfo->Flags & AML_CREATE)
+ {
+ /*
+ * Backup to beginning of CreateXXXfield declaration (1 for
+ * Opcode)
+ *
+ * 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)
+ {
+ WalkState->Op = Op;
+ WalkState->Opcode = Op->Common.AmlOpcode;
+
+ Status = WalkState->AscendingCallback (WalkState);
+ Status = AcpiPsNextParseState (WalkState, Op, Status);
+ if (Status == AE_CTRL_PENDING)
+ {
+ Status = AE_OK;
+ }
+ }
+
+ Status = AcpiPsCompleteOp (WalkState, &Op, Status);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ } /* while ParserState->Aml */
+
+ Status = AcpiPsCompleteFinalOp (WalkState, Op, Status);
+ return_ACPI_STATUS (Status);
+}
+
diff --git a/sys/contrib/dev/acpica/psopcode.c b/sys/contrib/dev/acpica/psopcode.c
index b7a805a..fad6d39 100644
--- a/sys/contrib/dev/acpica/psopcode.c
+++ b/sys/contrib/dev/acpica/psopcode.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: psopcode - Parser/Interpreter opcode information table
- * $Revision: 1.93 $
+ * $Revision: 1.99 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -125,6 +125,9 @@
ACPI_MODULE_NAME ("psopcode")
+const UINT8 AcpiGbl_ArgumentCount[] = {0,1,1,1,1,2,2,2,2,3,3,6};
+
+
/*******************************************************************************
*
* NAME: AcpiGbl_AmlOpInfo
@@ -495,7 +498,7 @@ const ACPI_OPCODE_INFO *
AcpiPsGetOpcodeInfo (
UINT16 Opcode)
{
- ACPI_FUNCTION_NAME ("PsGetOpcodeInfo");
+ ACPI_FUNCTION_NAME (PsGetOpcodeInfo);
/*
@@ -518,7 +521,7 @@ AcpiPsGetOpcodeInfo (
/* Unknown AML opcode */
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Unknown AML opcode [%4.4X]\n", Opcode));
return (&AcpiGbl_AmlOpInfo [_UNK]);
@@ -554,8 +557,33 @@ AcpiPsGetOpcodeName (
return (Op->Name);
#else
- return ("AE_NOT_CONFIGURED");
+ return ("OpcodeName unavailable");
#endif
}
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsGetArgumentCount
+ *
+ * PARAMETERS: OpType - Type associated with the AML opcode
+ *
+ * RETURN: Argument count
+ *
+ * DESCRIPTION: Obtain the number of expected arguments for an AML opcode
+ *
+ ******************************************************************************/
+
+UINT8
+AcpiPsGetArgumentCount (
+ UINT32 OpType)
+{
+
+ if (OpType <= AML_TYPE_EXEC_6A_0T_1R)
+ {
+ return (AcpiGbl_ArgumentCount[OpType]);
+ }
+
+ return (0);
+}
diff --git a/sys/contrib/dev/acpica/psparse.c b/sys/contrib/dev/acpica/psparse.c
index 8260329..e0afab8 100644
--- a/sys/contrib/dev/acpica/psparse.c
+++ b/sys/contrib/dev/acpica/psparse.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: psparse - Parser top level AML parse routines
- * $Revision: 1.158 $
+ * $Revision: 1.171 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -224,7 +224,7 @@ AcpiPsCompleteThisOp (
ACPI_PARSE_OBJECT *ReplacementOp = NULL;
- ACPI_FUNCTION_TRACE_PTR ("PsCompleteThisOp", Op);
+ ACPI_FUNCTION_TRACE_PTR (PsCompleteThisOp, Op);
/* Check for null Op, can happen if AML code is corrupt */
@@ -415,13 +415,12 @@ AcpiPsNextParseState (
ACPI_STATUS Status = AE_CTRL_PENDING;
- ACPI_FUNCTION_TRACE_PTR ("PsNextParseState", Op);
+ ACPI_FUNCTION_TRACE_PTR (PsNextParseState, Op);
switch (CallbackStatus)
{
case AE_CTRL_TERMINATE:
-
/*
* A control method was terminated via a RETURN statement.
* The walk of this method is complete.
@@ -438,13 +437,14 @@ AcpiPsNextParseState (
Status = AE_CTRL_BREAK;
break;
- case AE_CTRL_CONTINUE:
+ case AE_CTRL_CONTINUE:
ParserState->Aml = WalkState->AmlLastWhile;
Status = AE_CTRL_CONTINUE;
break;
+
case AE_CTRL_PENDING:
ParserState->Aml = WalkState->AmlLastWhile;
@@ -459,17 +459,16 @@ AcpiPsNextParseState (
#endif
case AE_CTRL_TRUE:
-
/*
* Predicate of an IF was true, and we are at the matching ELSE.
* Just close out this package
*/
ParserState->Aml = AcpiPsGetNextPackageEnd (ParserState);
+ Status = AE_CTRL_PENDING;
break;
case AE_CTRL_FALSE:
-
/*
* Either an IF/WHILE Predicate was false or we encountered a BREAK
* opcode. In both cases, we do not execute the rest of the
@@ -538,7 +537,7 @@ AcpiPsParseAml (
ACPI_WALK_STATE *PreviousWalkState;
- ACPI_FUNCTION_TRACE ("PsParseAml");
+ ACPI_FUNCTION_TRACE (PsParseAml);
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
"Entered with WalkState=%p Aml=%p size=%X\n",
@@ -551,10 +550,21 @@ AcpiPsParseAml (
Thread = AcpiUtCreateThreadState ();
if (!Thread)
{
+ AcpiDsDeleteWalkState (WalkState);
return_ACPI_STATUS (AE_NO_MEMORY);
}
WalkState->Thread = Thread;
+
+ /*
+ * If executing a method, the starting SyncLevel is this method's
+ * SyncLevel
+ */
+ if (WalkState->MethodDesc)
+ {
+ WalkState->Thread->CurrentSyncLevel = WalkState->MethodDesc->Method.SyncLevel;
+ }
+
AcpiDsPushWalkState (WalkState, Thread);
/*
@@ -592,6 +602,10 @@ AcpiPsParseAml (
* Transfer control to the called control method
*/
Status = AcpiDsCallControlMethod (Thread, WalkState, NULL);
+ if (ACPI_FAILURE (Status))
+ {
+ Status = AcpiDsMethodError (Status, WalkState);
+ }
/*
* If the transfer to the new method method call worked, a new walk
@@ -606,26 +620,30 @@ AcpiPsParseAml (
}
else if ((Status != AE_OK) && (WalkState->MethodDesc))
{
- ACPI_REPORT_METHOD_ERROR ("Method execution failed",
- WalkState->MethodNode, NULL, Status);
+ /* Either the method parse or actual execution failed */
- /* Ensure proper cleanup */
-
- WalkState->ParseFlags |= ACPI_PARSE_EXECUTE;
+ ACPI_ERROR_METHOD ("Method parse/execution failed",
+ WalkState->MethodNode, NULL, Status);
/* Check for possible multi-thread reentrancy problem */
if ((Status == AE_ALREADY_EXISTS) &&
- (!WalkState->MethodDesc->Method.Semaphore))
+ (!WalkState->MethodDesc->Method.Mutex))
{
+ ACPI_INFO ((AE_INFO, "Marking method %4.4s as Serialized",
+ WalkState->MethodNode->Name.Ascii));
+
/*
- * This method is marked NotSerialized, but it tried to create
+ * Method tried to create an object twice. The probable cause is
+ * that the method cannot handle reentrancy.
+ *
+ * The method is marked NotSerialized, but it tried to create
* a named object, causing the second thread entrance to fail.
- * We will workaround this by marking the method permanently
+ * Workaround this problem by marking the method permanently
* as Serialized.
*/
WalkState->MethodDesc->Method.MethodFlags |= AML_METHOD_SERIALIZED;
- WalkState->MethodDesc->Method.Concurrency = 1;
+ WalkState->MethodDesc->Method.SyncLevel = 0;
}
}
@@ -638,25 +656,19 @@ AcpiPsParseAml (
AcpiDsScopeStackClear (WalkState);
/*
- * If we just returned from the execution of a control method,
- * there's lots of cleanup to do
+ * If we just returned from the execution of a control method or if we
+ * encountered an error during the method parse phase, there's lots of
+ * cleanup to do
*/
- if ((WalkState->ParseFlags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE)
+ if (((WalkState->ParseFlags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) ||
+ (ACPI_FAILURE (Status)))
{
- if (WalkState->MethodDesc)
- {
- /* Decrement the thread count on the method parse tree */
-
- WalkState->MethodDesc->Method.ThreadCount--;
- }
-
- AcpiDsTerminateControlMethod (WalkState);
+ AcpiDsTerminateControlMethod (WalkState->MethodDesc, WalkState);
}
/* Delete this walk state and all linked control states */
AcpiPsCleanupScope (&WalkState->ParserState);
-
PreviousWalkState = WalkState;
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
diff --git a/sys/contrib/dev/acpica/psscope.c b/sys/contrib/dev/acpica/psscope.c
index 0065910..ea0a613 100644
--- a/sys/contrib/dev/acpica/psscope.c
+++ b/sys/contrib/dev/acpica/psscope.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: psscope - Parser scope stack management routines
- * $Revision: 1.42 $
+ * $Revision: 1.47 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -189,7 +189,7 @@ AcpiPsInitScope (
ACPI_GENERIC_STATE *Scope;
- ACPI_FUNCTION_TRACE_PTR ("PsInitScope", RootOp);
+ ACPI_FUNCTION_TRACE_PTR (PsInitScope, RootOp);
Scope = AcpiUtCreateGenericState ();
@@ -198,14 +198,14 @@ AcpiPsInitScope (
return_ACPI_STATUS (AE_NO_MEMORY);
}
- Scope->Common.DataType = ACPI_DESC_TYPE_STATE_RPSCOPE;
- Scope->ParseScope.Op = RootOp;
- Scope->ParseScope.ArgCount = ACPI_VAR_ARGS;
- Scope->ParseScope.ArgEnd = ParserState->AmlEnd;
- Scope->ParseScope.PkgEnd = ParserState->AmlEnd;
+ Scope->Common.DescriptorType = ACPI_DESC_TYPE_STATE_RPSCOPE;
+ Scope->ParseScope.Op = RootOp;
+ Scope->ParseScope.ArgCount = ACPI_VAR_ARGS;
+ Scope->ParseScope.ArgEnd = ParserState->AmlEnd;
+ Scope->ParseScope.PkgEnd = ParserState->AmlEnd;
- ParserState->Scope = Scope;
- ParserState->StartOp = RootOp;
+ ParserState->Scope = Scope;
+ ParserState->StartOp = RootOp;
return_ACPI_STATUS (AE_OK);
}
@@ -236,7 +236,7 @@ AcpiPsPushScope (
ACPI_GENERIC_STATE *Scope;
- ACPI_FUNCTION_TRACE_PTR ("PsPushScope", Op);
+ ACPI_FUNCTION_TRACE_PTR (PsPushScope, Op);
Scope = AcpiUtCreateGenericState ();
@@ -245,11 +245,11 @@ AcpiPsPushScope (
return_ACPI_STATUS (AE_NO_MEMORY);
}
- Scope->Common.DataType = ACPI_DESC_TYPE_STATE_PSCOPE;
- Scope->ParseScope.Op = Op;
- Scope->ParseScope.ArgList = RemainingArgs;
+ Scope->Common.DescriptorType = ACPI_DESC_TYPE_STATE_PSCOPE;
+ Scope->ParseScope.Op = Op;
+ Scope->ParseScope.ArgList = RemainingArgs;
Scope->ParseScope.ArgCount = ArgCount;
- Scope->ParseScope.PkgEnd = ParserState->PkgEnd;
+ Scope->ParseScope.PkgEnd = ParserState->PkgEnd;
/* Push onto scope stack */
@@ -298,7 +298,7 @@ AcpiPsPopScope (
ACPI_GENERIC_STATE *Scope = ParserState->Scope;
- ACPI_FUNCTION_TRACE ("PsPopScope");
+ ACPI_FUNCTION_TRACE (PsPopScope);
/* Only pop the scope if there is in fact a next scope */
@@ -307,7 +307,7 @@ AcpiPsPopScope (
{
Scope = AcpiUtPopGenericState (&ParserState->Scope);
- /* return to parsing previous op */
+ /* Return to parsing previous op */
*Op = Scope->ParseScope.Op;
*ArgList = Scope->ParseScope.ArgList;
@@ -320,7 +320,7 @@ AcpiPsPopScope (
}
else
{
- /* empty parse stack, prepare to fetch next opcode */
+ /* Empty parse stack, prepare to fetch next opcode */
*Op = NULL;
*ArgList = 0;
@@ -353,7 +353,7 @@ AcpiPsCleanupScope (
ACPI_GENERIC_STATE *Scope;
- ACPI_FUNCTION_TRACE_PTR ("PsCleanupScope", ParserState);
+ ACPI_FUNCTION_TRACE_PTR (PsCleanupScope, ParserState);
if (!ParserState)
diff --git a/sys/contrib/dev/acpica/pstree.c b/sys/contrib/dev/acpica/pstree.c
index 61e0602..f6f0170 100644
--- a/sys/contrib/dev/acpica/pstree.c
+++ b/sys/contrib/dev/acpica/pstree.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: pstree - Parser op tree manipulation/traversal/search
- * $Revision: 1.46 $
+ * $Revision: 1.51 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -227,7 +227,7 @@ AcpiPsAppendArg (
{
/* Invalid opcode */
- ACPI_REPORT_ERROR (("PsAppendArg: Invalid AML Opcode: 0x%2.2X\n",
+ ACPI_ERROR ((AE_INFO, "Invalid AML Opcode: 0x%2.2X",
Op->Common.AmlOpcode));
return;
}
@@ -267,6 +267,8 @@ AcpiPsAppendArg (
{
Arg->Common.Parent = Op;
Arg = Arg->Common.Next;
+
+ Op->Common.ArgListLength++;
}
}
diff --git a/sys/contrib/dev/acpica/psutils.c b/sys/contrib/dev/acpica/psutils.c
index 877a8d7..e8c8cf0 100644
--- a/sys/contrib/dev/acpica/psutils.c
+++ b/sys/contrib/dev/acpica/psutils.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: psutils - Parser miscellaneous utilities (Parser only)
- * $Revision: 1.66 $
+ * $Revision: 1.70 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -174,7 +174,7 @@ AcpiPsInitOp (
ACPI_FUNCTION_ENTRY ();
- Op->Common.DataType = ACPI_DESC_TYPE_PARSER;
+ Op->Common.DescriptorType = ACPI_DESC_TYPE_PARSER;
Op->Common.AmlOpcode = Opcode;
ACPI_DISASM_ONLY_MEMBERS (ACPI_STRNCPY (Op->Common.AmlOpName,
@@ -270,7 +270,7 @@ void
AcpiPsFreeOp (
ACPI_PARSE_OBJECT *Op)
{
- ACPI_FUNCTION_NAME ("PsFreeOp");
+ ACPI_FUNCTION_NAME (PsFreeOp);
if (Op->Common.AmlOpcode == AML_INT_RETURN_VALUE_OP)
diff --git a/sys/contrib/dev/acpica/pswalk.c b/sys/contrib/dev/acpica/pswalk.c
index 99beef6..af4099f 100644
--- a/sys/contrib/dev/acpica/pswalk.c
+++ b/sys/contrib/dev/acpica/pswalk.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: pswalk - Parser routines to walk parsed op tree(s)
- * $Revision: 1.75 $
+ * $Revision: 1.78 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -143,7 +143,7 @@ AcpiPsDeleteParseTree (
ACPI_PARSE_OBJECT *Parent = NULL;
- ACPI_FUNCTION_TRACE_PTR ("PsDeleteParseTree", SubtreeRoot);
+ ACPI_FUNCTION_TRACE_PTR (PsDeleteParseTree, SubtreeRoot);
/* Visit all nodes in the subtree */
diff --git a/sys/contrib/dev/acpica/psxface.c b/sys/contrib/dev/acpica/psxface.c
index 4c202cf..b1ff8e8 100644
--- a/sys/contrib/dev/acpica/psxface.c
+++ b/sys/contrib/dev/acpica/psxface.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: psxface - Parser external interfaces
- * $Revision: 1.84 $
+ * $Revision: 1.93 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -129,19 +129,15 @@
static void
AcpiPsStartTrace (
- ACPI_PARAMETER_INFO *Info);
+ ACPI_EVALUATE_INFO *Info);
static void
AcpiPsStopTrace (
- ACPI_PARAMETER_INFO *Info);
-
-static ACPI_STATUS
-AcpiPsExecutePass (
- ACPI_PARAMETER_INFO *Info);
+ ACPI_EVALUATE_INFO *Info);
static void
AcpiPsUpdateParameterList (
- ACPI_PARAMETER_INFO *Info,
+ ACPI_EVALUATE_INFO *Info,
UINT16 Action);
@@ -179,7 +175,7 @@ AcpiDebugTrace (
/* TBDs: Validate name, allow full path or just nameseg */
- AcpiGbl_TraceMethodName = *(UINT32 *) Name;
+ AcpiGbl_TraceMethodName = *ACPI_CAST_PTR (UINT32, Name);
AcpiGbl_TraceFlags = Flags;
if (DebugLevel)
@@ -210,7 +206,7 @@ AcpiDebugTrace (
static void
AcpiPsStartTrace (
- ACPI_PARAMETER_INFO *Info)
+ ACPI_EVALUATE_INFO *Info)
{
ACPI_STATUS Status;
@@ -225,7 +221,7 @@ AcpiPsStartTrace (
}
if ((!AcpiGbl_TraceMethodName) ||
- (AcpiGbl_TraceMethodName != Info->Node->Name.Integer))
+ (AcpiGbl_TraceMethodName != Info->ResolvedNode->Name.Integer))
{
goto Exit;
}
@@ -265,7 +261,7 @@ Exit:
static void
AcpiPsStopTrace (
- ACPI_PARAMETER_INFO *Info)
+ ACPI_EVALUATE_INFO *Info)
{
ACPI_STATUS Status;
@@ -280,7 +276,7 @@ AcpiPsStopTrace (
}
if ((!AcpiGbl_TraceMethodName) ||
- (AcpiGbl_TraceMethodName != Info->Node->Name.Integer))
+ (AcpiGbl_TraceMethodName != Info->ResolvedNode->Name.Integer))
{
goto Exit;
}
@@ -327,32 +323,33 @@ Exit:
ACPI_STATUS
AcpiPsExecuteMethod (
- ACPI_PARAMETER_INFO *Info)
+ ACPI_EVALUATE_INFO *Info)
{
ACPI_STATUS Status;
+ ACPI_PARSE_OBJECT *Op;
+ ACPI_WALK_STATE *WalkState;
- ACPI_FUNCTION_TRACE ("PsExecuteMethod");
+ ACPI_FUNCTION_TRACE (PsExecuteMethod);
/* Validate the Info and method Node */
- if (!Info || !Info->Node)
+ if (!Info || !Info->ResolvedNode)
{
return_ACPI_STATUS (AE_NULL_ENTRY);
}
/* Init for new method, wait on concurrency semaphore */
- Status = AcpiDsBeginMethodExecution (Info->Node, Info->ObjDesc, NULL);
+ Status = AcpiDsBeginMethodExecution (Info->ResolvedNode, Info->ObjDesc, NULL);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/*
- * The caller "owns" the parameters, so give each one an extra
- * reference
+ * The caller "owns" the parameters, so give each one an extra reference
*/
AcpiPsUpdateParameterList (Info, REF_INCREMENT);
@@ -361,32 +358,50 @@ AcpiPsExecuteMethod (
AcpiPsStartTrace (Info);
/*
- * 1) Perform the first pass parse of the method to enter any
- * named objects that it creates into the namespace
+ * Execute the method. Performs parse simultaneously
*/
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
- "**** Begin Method Parse **** Entry=%p obj=%p\n",
- Info->Node, Info->ObjDesc));
+ "**** Begin Method Parse/Execute [%4.4s] **** Node=%p Obj=%p\n",
+ Info->ResolvedNode->Name.Ascii, Info->ResolvedNode, Info->ObjDesc));
- Info->PassNumber = 1;
- Status = AcpiPsExecutePass (Info);
+ /* Create and init a Root Node */
+
+ Op = AcpiPsCreateScopeOp ();
+ if (!Op)
+ {
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ /* Create and initialize a new walk state */
+
+ Info->PassNumber = ACPI_IMODE_EXECUTE;
+ WalkState = AcpiDsCreateWalkState (
+ Info->ObjDesc->Method.OwnerId, NULL, NULL, NULL);
+ if (!WalkState)
+ {
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ Status = AcpiDsInitAmlWalk (WalkState, Op, Info->ResolvedNode,
+ Info->ObjDesc->Method.AmlStart,
+ Info->ObjDesc->Method.AmlLength, Info, Info->PassNumber);
if (ACPI_FAILURE (Status))
{
+ AcpiDsDeleteWalkState (WalkState);
goto Cleanup;
}
- /*
- * 2) Execute the method. Performs second pass parse simultaneously
- */
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
- "**** Begin Method Execution **** Entry=%p obj=%p\n",
- Info->Node, Info->ObjDesc));
+ /* Parse the AML */
- Info->PassNumber = 3;
- Status = AcpiPsExecutePass (Info);
+ Status = AcpiPsParseAml (WalkState);
+ /* WalkState was deleted by ParseAml */
Cleanup:
+ AcpiPsDeleteParseTree (Op);
+
/* End optional tracing */
AcpiPsStopTrace (Info);
@@ -423,7 +438,7 @@ Cleanup:
*
* FUNCTION: AcpiPsUpdateParameterList
*
- * PARAMETERS: Info - See ACPI_PARAMETER_INFO
+ * PARAMETERS: Info - See ACPI_EVALUATE_INFO
* (Used: ParameterType and Parameters)
* Action - Add or Remove reference
*
@@ -435,7 +450,7 @@ Cleanup:
static void
AcpiPsUpdateParameterList (
- ACPI_PARAMETER_INFO *Info,
+ ACPI_EVALUATE_INFO *Info,
UINT16 Action)
{
ACPI_NATIVE_UINT i;
@@ -456,69 +471,3 @@ AcpiPsUpdateParameterList (
}
-/*******************************************************************************
- *
- * FUNCTION: AcpiPsExecutePass
- *
- * PARAMETERS: Info - See ACPI_PARAMETER_INFO
- * (Used: PassNumber, Node, and ObjDesc)
- *
- * RETURN: Status
- *
- * DESCRIPTION: Single AML pass: Parse or Execute a control method
- *
- ******************************************************************************/
-
-static ACPI_STATUS
-AcpiPsExecutePass (
- ACPI_PARAMETER_INFO *Info)
-{
- ACPI_STATUS Status;
- ACPI_PARSE_OBJECT *Op;
- ACPI_WALK_STATE *WalkState;
-
-
- ACPI_FUNCTION_TRACE ("PsExecutePass");
-
-
- /* Create and init a Root Node */
-
- Op = AcpiPsCreateScopeOp ();
- if (!Op)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- /* Create and initialize a new walk state */
-
- WalkState = AcpiDsCreateWalkState (
- Info->ObjDesc->Method.OwnerId, NULL, NULL, NULL);
- if (!WalkState)
- {
- Status = AE_NO_MEMORY;
- goto Cleanup;
- }
-
- Status = AcpiDsInitAmlWalk (WalkState, Op, Info->Node,
- Info->ObjDesc->Method.AmlStart,
- Info->ObjDesc->Method.AmlLength,
- Info->PassNumber == 1 ? NULL : Info,
- Info->PassNumber);
- if (ACPI_FAILURE (Status))
- {
- AcpiDsDeleteWalkState (WalkState);
- goto Cleanup;
- }
-
- /* Parse the AML */
-
- Status = AcpiPsParseAml (WalkState);
-
- /* Walk state was deleted by ParseAml */
-
-Cleanup:
- AcpiPsDeleteParseTree (Op);
- return_ACPI_STATUS (Status);
-}
-
-
diff --git a/sys/contrib/dev/acpica/rsaddr.c b/sys/contrib/dev/acpica/rsaddr.c
index c252978..6a11937 100644
--- a/sys/contrib/dev/acpica/rsaddr.c
+++ b/sys/contrib/dev/acpica/rsaddr.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rsaddr - Address resource descriptors (16/32/64)
- * $Revision: 1.48 $
+ * $Revision: 1.50 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
diff --git a/sys/contrib/dev/acpica/rscalc.c b/sys/contrib/dev/acpica/rscalc.c
index 6420f9f..d04568a 100644
--- a/sys/contrib/dev/acpica/rscalc.c
+++ b/sys/contrib/dev/acpica/rscalc.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rscalc - Calculate stream and list lengths
- * $Revision: 1.66 $
+ * $Revision: 1.80 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -256,9 +256,11 @@ AcpiRsStreamOptionLength (
StringLength = ResourceLength - MinimumAmlResourceLength - 1;
}
- /* Round up length to 32 bits for internal structure alignment */
-
- return (ACPI_ROUND_UP_TO_32BITS (StringLength));
+ /*
+ * Round the length up to a multiple of the native word in order to
+ * guarantee that the entire resource descriptor is native word aligned
+ */
+ return ((UINT32) ACPI_ROUND_UP_TO_NATIVE_WORD (StringLength));
}
@@ -283,10 +285,10 @@ AcpiRsGetAmlLength (
ACPI_SIZE *SizeNeeded)
{
ACPI_SIZE AmlSizeNeeded = 0;
- ACPI_RS_LENGTH TotalSize;
+ ACPI_RS_LENGTH TotalSize;
- ACPI_FUNCTION_TRACE ("RsGetAmlLength");
+ ACPI_FUNCTION_TRACE (RsGetAmlLength);
/* Traverse entire list of internal resource descriptors */
@@ -403,13 +405,12 @@ AcpiRsGetAmlLength (
/* Point to the next object */
- Resource = ACPI_PTR_ADD (ACPI_RESOURCE,
- Resource, Resource->Length);
+ Resource = ACPI_ADD_PTR (ACPI_RESOURCE, Resource, Resource->Length);
}
- /* Did not find an END_TAG descriptor */
+ /* Did not find an EndTag resource descriptor */
- return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
+ return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG);
}
@@ -435,179 +436,146 @@ AcpiRsGetListLength (
UINT32 AmlBufferLength,
ACPI_SIZE *SizeNeeded)
{
+ ACPI_STATUS Status;
+ UINT8 *EndAml;
UINT8 *Buffer;
- ACPI_RESOURCE_INFO *ResourceInfo;
- UINT32 BufferSize = 0;
- UINT32 BytesParsed = 0;
- UINT8 ResourceType;
+ UINT32 BufferSize;
UINT16 Temp16;
UINT16 ResourceLength;
- UINT16 HeaderLength;
UINT32 ExtraStructBytes;
+ UINT8 ResourceIndex;
+ UINT8 MinimumAmlResourceLength;
- ACPI_FUNCTION_TRACE ("RsGetListLength");
+ ACPI_FUNCTION_TRACE (RsGetListLength);
- while (BytesParsed < AmlBufferLength)
- {
- /* The next byte in the stream is the resource descriptor type */
+ *SizeNeeded = 0;
+ EndAml = AmlBuffer + AmlBufferLength;
- ResourceType = AcpiUtGetResourceType (AmlBuffer);
+ /* Walk the list of AML resource descriptors */
- /* Get the base stream size and structure sizes for the descriptor */
+ while (AmlBuffer < EndAml)
+ {
+ /* Validate the Resource Type and Resource Length */
- ResourceInfo = AcpiRsGetResourceInfo (ResourceType);
- if (!ResourceInfo)
+ Status = AcpiUtValidateResource (AmlBuffer, &ResourceIndex);
+ if (ACPI_FAILURE (Status))
{
- return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
+ return_ACPI_STATUS (Status);
}
- /* Get the Length field from the input resource descriptor */
+ /* Get the resource length and base (minimum) AML size */
ResourceLength = AcpiUtGetResourceLength (AmlBuffer);
+ MinimumAmlResourceLength = AcpiGbl_ResourceAmlSizes[ResourceIndex];
- /* Augment the size for descriptors with optional fields */
-
+ /*
+ * Augment the size for descriptors with optional
+ * and/or variable length fields
+ */
ExtraStructBytes = 0;
+ Buffer = AmlBuffer + AcpiUtGetResourceHeaderLength (AmlBuffer);
- if (!(ResourceType & ACPI_RESOURCE_NAME_LARGE))
+ switch (AcpiUtGetResourceType (AmlBuffer))
{
+ case ACPI_RESOURCE_NAME_IRQ:
/*
- * Small resource descriptors
+ * IRQ Resource:
+ * Get the number of bits set in the 16-bit IRQ mask
*/
- HeaderLength = sizeof (AML_RESOURCE_SMALL_HEADER);
- Buffer = AmlBuffer + HeaderLength;
-
- switch (ResourceType)
- {
- case ACPI_RESOURCE_NAME_IRQ:
- /*
- * IRQ Resource:
- * Get the number of bits set in the IRQ word
- */
- ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
- ExtraStructBytes = AcpiRsCountSetBits (Temp16);
- break;
-
-
- case ACPI_RESOURCE_NAME_DMA:
- /*
- * DMA Resource:
- * Get the number of bits set in the DMA channels byte
- */
- ExtraStructBytes = AcpiRsCountSetBits (*Buffer);
- break;
-
-
- case ACPI_RESOURCE_NAME_VENDOR_SMALL:
- /*
- * Vendor Specific Resource:
- * Ensure a 32-bit boundary for the structure
- */
- ExtraStructBytes = ACPI_ROUND_UP_TO_32BITS (ResourceLength);
- break;
+ ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
+ ExtraStructBytes = AcpiRsCountSetBits (Temp16);
+ break;
- case ACPI_RESOURCE_NAME_END_TAG:
- /*
- * End Tag: This is the normal exit, add size of EndTag
- */
- *SizeNeeded = BufferSize + ACPI_RS_SIZE_MIN;
- return_ACPI_STATUS (AE_OK);
-
- default:
- break;
- }
- }
- else
- {
+ case ACPI_RESOURCE_NAME_DMA:
/*
- * Large resource descriptors
+ * DMA Resource:
+ * Get the number of bits set in the 8-bit DMA mask
*/
- HeaderLength = sizeof (AML_RESOURCE_LARGE_HEADER);
- Buffer = AmlBuffer + HeaderLength;
+ ExtraStructBytes = AcpiRsCountSetBits (*Buffer);
+ break;
- switch (ResourceType)
- {
- case ACPI_RESOURCE_NAME_VENDOR_LARGE:
- /*
- * Vendor Defined Resource:
- * Add vendor data and ensure a 32-bit boundary for the structure
- */
- ExtraStructBytes = ACPI_ROUND_UP_TO_32BITS (ResourceLength);
- break;
+ case ACPI_RESOURCE_NAME_VENDOR_SMALL:
+ case ACPI_RESOURCE_NAME_VENDOR_LARGE:
+ /*
+ * Vendor Resource:
+ * Get the number of vendor data bytes
+ */
+ ExtraStructBytes = ResourceLength;
+ break;
- case ACPI_RESOURCE_NAME_ADDRESS32:
- case ACPI_RESOURCE_NAME_ADDRESS16:
- /*
- * 32-Bit or 16-bit Address Resource:
- * Add the size of any optional data (ResourceSource)
- */
- ExtraStructBytes = AcpiRsStreamOptionLength (ResourceLength,
- ResourceInfo->MinimumAmlResourceLength);
- break;
+ case ACPI_RESOURCE_NAME_END_TAG:
+ /*
+ * End Tag:
+ * This is the normal exit, add size of EndTag
+ */
+ *SizeNeeded += ACPI_RS_SIZE_MIN;
+ return_ACPI_STATUS (AE_OK);
- case ACPI_RESOURCE_NAME_EXTENDED_IRQ:
- /*
- * Extended IRQ:
- * Point past the InterruptVectorFlags to get the
- * InterruptTableLength.
- */
- Buffer++;
- /*
- * Add 4 bytes for each additional interrupt. Note: at least one
- * interrupt is required and is included in the minimum
- * descriptor size
- */
- ExtraStructBytes = ((*Buffer - 1) * sizeof (UINT32));
+ case ACPI_RESOURCE_NAME_ADDRESS32:
+ case ACPI_RESOURCE_NAME_ADDRESS16:
+ case ACPI_RESOURCE_NAME_ADDRESS64:
+ /*
+ * Address Resource:
+ * Add the size of the optional ResourceSource
+ */
+ ExtraStructBytes = AcpiRsStreamOptionLength (
+ ResourceLength, MinimumAmlResourceLength);
+ break;
- /* Add the size of any optional data (ResourceSource) */
- ExtraStructBytes += AcpiRsStreamOptionLength (
- ResourceLength - ExtraStructBytes,
- ResourceInfo->MinimumAmlResourceLength);
- break;
+ case ACPI_RESOURCE_NAME_EXTENDED_IRQ:
+ /*
+ * Extended IRQ Resource:
+ * Using the InterruptTableLength, add 4 bytes for each additional
+ * interrupt. Note: at least one interrupt is required and is
+ * included in the minimum descriptor size (reason for the -1)
+ */
+ ExtraStructBytes = (Buffer[1] - 1) * sizeof (UINT32);
+ /* Add the size of the optional ResourceSource */
- case ACPI_RESOURCE_NAME_ADDRESS64:
- /*
- * 64-Bit Address Resource:
- * Add the size of any optional data (ResourceSource)
- * Ensure a 64-bit boundary for the structure
- */
- ExtraStructBytes = ACPI_ROUND_UP_TO_64BITS (
- AcpiRsStreamOptionLength (ResourceLength,
- ResourceInfo->MinimumAmlResourceLength));
- break;
+ ExtraStructBytes += AcpiRsStreamOptionLength (
+ ResourceLength - ExtraStructBytes, MinimumAmlResourceLength);
+ break;
- default:
- break;
- }
+ default:
+ break;
}
- /* Update the required buffer size for the internal descriptor structs */
+ /*
+ * Update the required buffer size for the internal descriptor structs
+ *
+ * Important: Round the size up for the appropriate alignment. This
+ * is a requirement on IA64.
+ */
+ BufferSize = AcpiGbl_ResourceStructSizes[ResourceIndex] +
+ ExtraStructBytes;
+ BufferSize = (UINT32) ACPI_ROUND_UP_TO_NATIVE_WORD (BufferSize);
- Temp16 = (UINT16) (ResourceInfo->MinimumInternalStructLength + ExtraStructBytes);
- BufferSize += (UINT32) ACPI_ROUND_UP_TO_NATIVE_WORD (Temp16);
+ *SizeNeeded += BufferSize;
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_RESOURCES,
+ "Type %.2X, AmlLength %.2X InternalLength %.2X\n",
+ AcpiUtGetResourceType (AmlBuffer),
+ AcpiUtGetDescriptorLength (AmlBuffer), BufferSize));
/*
- * Update byte count and point to the next resource within the stream
- * using the size of the header plus the length contained in the header
+ * Point to the next resource within the AML stream using the length
+ * contained in the resource descriptor header
*/
- Temp16 = (UINT16) (HeaderLength + ResourceLength);
- BytesParsed += Temp16;
- AmlBuffer += Temp16;
+ AmlBuffer += AcpiUtGetDescriptorLength (AmlBuffer);
}
- /* This is the data the caller needs */
+ /* Did not find an EndTag resource descriptor */
- *SizeNeeded = BufferSize;
- return_ACPI_STATUS (AE_OK);
+ return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG);
}
@@ -643,7 +611,7 @@ AcpiRsGetPciRoutingTableLength (
UINT32 TableIndex;
- ACPI_FUNCTION_TRACE ("RsGetPciRoutingTableLength");
+ ACPI_FUNCTION_TRACE (RsGetPciRoutingTableLength);
NumberOfElements = PackageObject->Package.Count;
@@ -678,14 +646,16 @@ AcpiRsGetPciRoutingTableLength (
for (TableIndex = 0; TableIndex < 4 && !NameFound; TableIndex++)
{
- if ((ACPI_TYPE_STRING ==
+ if (*SubObjectList && /* Null object allowed */
+
+ ((ACPI_TYPE_STRING ==
ACPI_GET_OBJECT_TYPE (*SubObjectList)) ||
((ACPI_TYPE_LOCAL_REFERENCE ==
ACPI_GET_OBJECT_TYPE (*SubObjectList)) &&
((*SubObjectList)->Reference.Opcode ==
- AML_INT_NAMEPATH_OP)))
+ AML_INT_NAMEPATH_OP))))
{
NameFound = TRUE;
}
@@ -729,7 +699,7 @@ AcpiRsGetPciRoutingTableLength (
/* Round up the size since each element must be aligned */
- TempSizeNeeded = ACPI_ROUND_UP_TO_64BITS (TempSizeNeeded);
+ TempSizeNeeded = ACPI_ROUND_UP_TO_64BIT (TempSizeNeeded);
/* Point to the next ACPI_OPERAND_OBJECT */
@@ -737,7 +707,7 @@ AcpiRsGetPciRoutingTableLength (
}
/*
- * Adding an extra element to the end of the list, essentially a
+ * Add an extra element to the end of the list, essentially a
* NULL terminator
*/
*BufferSizeNeeded = TempSizeNeeded + sizeof (ACPI_PCI_ROUTING_TABLE);
diff --git a/sys/contrib/dev/acpica/rscreate.c b/sys/contrib/dev/acpica/rscreate.c
index 9d764bf..6b986ea 100644
--- a/sys/contrib/dev/acpica/rscreate.c
+++ b/sys/contrib/dev/acpica/rscreate.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rscreate - Create resource lists/tables
- * $Revision: 1.71 $
+ * $Revision: 1.78 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -154,9 +154,10 @@ AcpiRsCreateResourceList (
UINT8 *AmlStart;
ACPI_SIZE ListSizeNeeded = 0;
UINT32 AmlBufferLength;
+ void *Resource;
- ACPI_FUNCTION_TRACE ("RsCreateResourceList");
+ ACPI_FUNCTION_TRACE (RsCreateResourceList);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "AmlBuffer = %p\n",
@@ -191,8 +192,9 @@ AcpiRsCreateResourceList (
/* Do the conversion */
- Status = AcpiRsConvertAmlToResources (AmlStart, AmlBufferLength,
- OutputBuffer->Pointer);
+ Resource = OutputBuffer->Pointer;
+ Status = AcpiUtWalkAmlResources (AmlStart, AmlBufferLength,
+ AcpiRsConvertAmlToResources, &Resource);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -243,7 +245,7 @@ AcpiRsCreatePciRoutingTable (
ACPI_BUFFER PathBuffer;
- ACPI_FUNCTION_TRACE ("RsCreatePciRoutingTable");
+ ACPI_FUNCTION_TRACE (RsCreatePciRoutingTable);
/* Params already validated, so we don't re-validate here */
@@ -300,8 +302,8 @@ AcpiRsCreatePciRoutingTable (
if (ACPI_GET_OBJECT_TYPE (*TopObjectList) != ACPI_TYPE_PACKAGE)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "(PRT[%X]) Need sub-package, found %s\n",
+ ACPI_ERROR ((AE_INFO,
+ "(PRT[%X]) Need sub-package, found %s",
Index, AcpiUtGetObjectTypeName (*TopObjectList)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
@@ -310,8 +312,8 @@ AcpiRsCreatePciRoutingTable (
if ((*TopObjectList)->Package.Count != 4)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "(PRT[%X]) Need package of length 4, found length %d\n",
+ ACPI_ERROR ((AE_INFO,
+ "(PRT[%X]) Need package of length 4, found length %d",
Index, (*TopObjectList)->Package.Count));
return_ACPI_STATUS (AE_AML_PACKAGE_LIMIT);
}
@@ -332,8 +334,8 @@ AcpiRsCreatePciRoutingTable (
}
else
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "(PRT[%X].Address) Need Integer, found %s\n",
+ ACPI_ERROR ((AE_INFO,
+ "(PRT[%X].Address) Need Integer, found %s",
Index, AcpiUtGetObjectTypeName (ObjDesc)));
return_ACPI_STATUS (AE_BAD_DATA);
}
@@ -347,78 +349,83 @@ AcpiRsCreatePciRoutingTable (
}
else
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "(PRT[%X].Pin) Need Integer, found %s\n",
+ ACPI_ERROR ((AE_INFO,
+ "(PRT[%X].Pin) Need Integer, found %s",
Index, AcpiUtGetObjectTypeName (ObjDesc)));
return_ACPI_STATUS (AE_BAD_DATA);
}
- /* 3) Third subobject: Dereference the PRT.SourceName */
-
+ /*
+ * 3) Third subobject: Dereference the PRT.SourceName
+ * The name may be unresolved (slack mode), so allow a null object
+ */
ObjDesc = SubObjectList[2];
- switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+ if (ObjDesc)
{
- case ACPI_TYPE_LOCAL_REFERENCE:
-
- if (ObjDesc->Reference.Opcode != AML_INT_NAMEPATH_OP)
+ switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "(PRT[%X].Source) Need name, found reference op %X\n",
- Index, ObjDesc->Reference.Opcode));
- return_ACPI_STATUS (AE_BAD_DATA);
- }
+ case ACPI_TYPE_LOCAL_REFERENCE:
- Node = ObjDesc->Reference.Node;
+ if (ObjDesc->Reference.Opcode != AML_INT_NAMEPATH_OP)
+ {
+ ACPI_ERROR ((AE_INFO,
+ "(PRT[%X].Source) Need name, found reference op %X",
+ Index, ObjDesc->Reference.Opcode));
+ return_ACPI_STATUS (AE_BAD_DATA);
+ }
- /* Use *remaining* length of the buffer as max for pathname */
+ Node = ObjDesc->Reference.Node;
- PathBuffer.Length = OutputBuffer->Length -
- (UINT32) ((UINT8 *) UserPrt->Source -
- (UINT8 *) OutputBuffer->Pointer);
- PathBuffer.Pointer = UserPrt->Source;
+ /* Use *remaining* length of the buffer as max for pathname */
- Status = AcpiNsHandleToPathname ((ACPI_HANDLE) Node, &PathBuffer);
+ PathBuffer.Length = OutputBuffer->Length -
+ (UINT32) ((UINT8 *) UserPrt->Source -
+ (UINT8 *) OutputBuffer->Pointer);
+ PathBuffer.Pointer = UserPrt->Source;
- /* +1 to include null terminator */
+ Status = AcpiNsHandleToPathname ((ACPI_HANDLE) Node, &PathBuffer);
- UserPrt->Length += (UINT32) ACPI_STRLEN (UserPrt->Source) + 1;
- break;
+ /* +1 to include null terminator */
+ UserPrt->Length += (UINT32) ACPI_STRLEN (UserPrt->Source) + 1;
+ break;
- case ACPI_TYPE_STRING:
- ACPI_STRCPY (UserPrt->Source, ObjDesc->String.Pointer);
+ case ACPI_TYPE_STRING:
- /*
- * Add to the Length field the length of the string
- * (add 1 for terminator)
- */
- UserPrt->Length += ObjDesc->String.Length + 1;
- break;
+ ACPI_STRCPY (UserPrt->Source, ObjDesc->String.Pointer);
+ /*
+ * Add to the Length field the length of the string
+ * (add 1 for terminator)
+ */
+ UserPrt->Length += ObjDesc->String.Length + 1;
+ break;
- case ACPI_TYPE_INTEGER:
- /*
- * If this is a number, then the Source Name is NULL, since the
- * entire buffer was zeroed out, we can leave this alone.
- *
- * Add to the Length field the length of the UINT32 NULL
- */
- UserPrt->Length += sizeof (UINT32);
- break;
+ case ACPI_TYPE_INTEGER:
+ /*
+ * If this is a number, then the Source Name is NULL, since the
+ * entire buffer was zeroed out, we can leave this alone.
+ *
+ * Add to the Length field the length of the UINT32 NULL
+ */
+ UserPrt->Length += sizeof (UINT32);
+ break;
- default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "(PRT[%X].Source) Need Ref/String/Integer, found %s\n",
- Index, AcpiUtGetObjectTypeName (ObjDesc)));
- return_ACPI_STATUS (AE_BAD_DATA);
+ default:
+
+ ACPI_ERROR ((AE_INFO,
+ "(PRT[%X].Source) Need Ref/String/Integer, found %s",
+ Index, AcpiUtGetObjectTypeName (ObjDesc)));
+ return_ACPI_STATUS (AE_BAD_DATA);
+ }
}
/* Now align the current length */
- UserPrt->Length = (UINT32) ACPI_ROUND_UP_TO_64BITS (UserPrt->Length);
+ UserPrt->Length = (UINT32) ACPI_ROUND_UP_TO_64BIT (UserPrt->Length);
/* 4) Fourth subobject: Dereference the PRT.SourceIndex */
@@ -429,8 +436,8 @@ AcpiRsCreatePciRoutingTable (
}
else
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "(PRT[%X].SourceIndex) Need Integer, found %s\n",
+ ACPI_ERROR ((AE_INFO,
+ "(PRT[%X].SourceIndex) Need Integer, found %s",
Index, AcpiUtGetObjectTypeName (ObjDesc)));
return_ACPI_STATUS (AE_BAD_DATA);
}
@@ -473,7 +480,7 @@ AcpiRsCreateAmlResources (
ACPI_SIZE AmlSizeNeeded = 0;
- ACPI_FUNCTION_TRACE ("RsCreateAmlResources");
+ ACPI_FUNCTION_TRACE (RsCreateAmlResources);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "LinkedListBuffer = %p\n",
diff --git a/sys/contrib/dev/acpica/rsdump.c b/sys/contrib/dev/acpica/rsdump.c
index 8be18b5..eec3df9 100644
--- a/sys/contrib/dev/acpica/rsdump.c
+++ b/sys/contrib/dev/acpica/rsdump.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rsdump - Functions to display the resource structures.
- * $Revision: 1.54 $
+ * $Revision: 1.62 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -119,7 +119,6 @@
#include <contrib/dev/acpica/acpi.h>
#include <contrib/dev/acpica/acresrc.h>
-#include <contrib/dev/acpica/acdisasm.h>
#define _COMPONENT ACPI_RESOURCES
ACPI_MODULE_NAME ("rsdump")
@@ -204,9 +203,9 @@ AcpiRsDumpDescriptor (
ACPI_RSDUMP_INFO AcpiRsDumpIrq[6] =
{
{ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpIrq), "IRQ", 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},
+ {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},
{ACPI_RSD_UINT8 , ACPI_RSD_OFFSET (Irq.InterruptCount), "Interrupt Count", NULL},
{ACPI_RSD_SHORTLIST,ACPI_RSD_OFFSET (Irq.Interrupts[0]), "Interrupt List", NULL}
};
@@ -214,9 +213,9 @@ ACPI_RSDUMP_INFO AcpiRsDumpIrq[6] =
ACPI_RSDUMP_INFO AcpiRsDumpDma[6] =
{
{ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpDma), "DMA", NULL},
- {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Dma.Type), "Speed", AcpiGbl_TYPDecode},
- {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Dma.BusMaster), "Mastering", AcpiGbl_BMDecode},
- {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Dma.Transfer), "Transfer Type", AcpiGbl_SIZDecode},
+ {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Dma.Type), "Speed", AcpiGbl_TypDecode},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Dma.BusMaster), "Mastering", AcpiGbl_BmDecode},
+ {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Dma.Transfer), "Transfer Type", AcpiGbl_SizDecode},
{ACPI_RSD_UINT8, ACPI_RSD_OFFSET (Dma.ChannelCount), "Channel Count", NULL},
{ACPI_RSD_SHORTLIST,ACPI_RSD_OFFSET (Dma.Channels[0]), "Channel List", NULL}
};
@@ -265,7 +264,7 @@ ACPI_RSDUMP_INFO AcpiRsDumpEndTag[1] =
ACPI_RSDUMP_INFO AcpiRsDumpMemory24[6] =
{
{ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpMemory24), "24-Bit Memory Range", NULL},
- {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Memory24.WriteProtect), "Write Protect", AcpiGbl_RWDecode},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Memory24.WriteProtect), "Write Protect", AcpiGbl_RwDecode},
{ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Memory24.Minimum), "Address Minimum", NULL},
{ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Memory24.Maximum), "Address Maximum", NULL},
{ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Memory24.Alignment), "Alignment", NULL},
@@ -275,7 +274,7 @@ ACPI_RSDUMP_INFO AcpiRsDumpMemory24[6] =
ACPI_RSDUMP_INFO AcpiRsDumpMemory32[6] =
{
{ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpMemory32), "32-Bit Memory Range", NULL},
- {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Memory32.WriteProtect), "Write Protect", AcpiGbl_RWDecode},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Memory32.WriteProtect), "Write Protect", AcpiGbl_RwDecode},
{ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Memory32.Minimum), "Address Minimum", NULL},
{ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Memory32.Maximum), "Address Maximum", NULL},
{ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Memory32.Alignment), "Alignment", NULL},
@@ -285,7 +284,7 @@ ACPI_RSDUMP_INFO AcpiRsDumpMemory32[6] =
ACPI_RSDUMP_INFO AcpiRsDumpFixedMemory32[4] =
{
{ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpFixedMemory32), "32-Bit Fixed Memory Range",NULL},
- {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (FixedMemory32.WriteProtect), "Write Protect", AcpiGbl_RWDecode},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (FixedMemory32.WriteProtect), "Write Protect", AcpiGbl_RwDecode},
{ACPI_RSD_UINT32, ACPI_RSD_OFFSET (FixedMemory32.Address), "Address", NULL},
{ACPI_RSD_UINT32, ACPI_RSD_OFFSET (FixedMemory32.AddressLength), "Address Length", NULL}
};
@@ -342,9 +341,9 @@ ACPI_RSDUMP_INFO AcpiRsDumpExtIrq[8] =
{
{ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpExtIrq), "Extended IRQ", NULL},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.ProducerConsumer), "Type", AcpiGbl_ConsumeDecode},
- {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Triggering), "Triggering", AcpiGbl_HEDecode},
- {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Polarity), "Polarity", AcpiGbl_LLDecode},
- {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Sharable), "Sharing", AcpiGbl_SHRDecode},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Triggering), "Triggering", AcpiGbl_HeDecode},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Polarity), "Polarity", AcpiGbl_LlDecode},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Sharable), "Sharing", AcpiGbl_ShrDecode},
{ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (ExtendedIrq.ResourceSource), NULL, NULL},
{ACPI_RSD_UINT8, ACPI_RSD_OFFSET (ExtendedIrq.InterruptCount), "Interrupt Count", NULL},
{ACPI_RSD_DWORDLIST,ACPI_RSD_OFFSET (ExtendedIrq.Interrupts[0]), "Interrupt List", NULL}
@@ -368,26 +367,26 @@ static ACPI_RSDUMP_INFO AcpiRsDumpGeneralFlags[5] =
{
{ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpGeneralFlags), NULL, NULL},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.ProducerConsumer), "Consumer/Producer", AcpiGbl_ConsumeDecode},
- {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Decode), "Address Decode", AcpiGbl_DECDecode},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Decode), "Address Decode", AcpiGbl_DecDecode},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.MinAddressFixed), "Min Relocatability", AcpiGbl_MinDecode},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.MaxAddressFixed), "Max Relocatability", AcpiGbl_MaxDecode}
};
static ACPI_RSDUMP_INFO AcpiRsDumpMemoryFlags[5] =
{
- {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE (AcpiRsDumpMemoryFlags), "Resource Type", "Memory Range"},
- {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.WriteProtect), "Write Protect", AcpiGbl_RWDecode},
- {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.Caching), "Caching", AcpiGbl_MEMDecode},
- {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.RangeType), "Range Type", AcpiGbl_MTPDecode},
- {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.Translation), "Translation", AcpiGbl_TTPDecode}
+ {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE (AcpiRsDumpMemoryFlags), "Resource Type", (void *) "Memory Range"},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.WriteProtect), "Write Protect", AcpiGbl_RwDecode},
+ {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.Caching), "Caching", AcpiGbl_MemDecode},
+ {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.RangeType), "Range Type", AcpiGbl_MtpDecode},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.Translation), "Translation", AcpiGbl_TtpDecode}
};
static ACPI_RSDUMP_INFO AcpiRsDumpIoFlags[4] =
{
- {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE (AcpiRsDumpIoFlags), "Resource Type", "I/O Range"},
- {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Address.Info.Io.RangeType), "Range Type", AcpiGbl_RNGDecode},
- {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Io.Translation), "Translation", AcpiGbl_TTPDecode},
- {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Io.TranslationType), "Translation Type", AcpiGbl_TRSDecode}
+ {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE (AcpiRsDumpIoFlags), "Resource Type", (void *) "I/O Range"},
+ {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Address.Info.Io.RangeType), "Range Type", AcpiGbl_RngDecode},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Io.Translation), "Translation", AcpiGbl_TtpDecode},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Io.TranslationType), "Translation Type", AcpiGbl_TrsDecode}
};
@@ -421,8 +420,8 @@ AcpiRsDumpDescriptor (
void *Resource,
ACPI_RSDUMP_INFO *Table)
{
- void *Target = NULL;
- void *PreviousTarget;
+ UINT8 *Target = NULL;
+ UINT8 *PreviousTarget;
char *Name;
UINT8 Count;
@@ -434,7 +433,7 @@ AcpiRsDumpDescriptor (
while (Count)
{
PreviousTarget = Target;
- Target = ((UINT8 *) Resource) + Table->Offset;
+ Target = ACPI_ADD_PTR (UINT8, Resource, Table->Offset);
Name = Table->Name;
switch (Table->Opcode)
@@ -452,41 +451,41 @@ AcpiRsDumpDescriptor (
/* Strings */
case ACPI_RSD_LITERAL:
- AcpiRsOutString (Name, (char *) Table->Pointer);
+ AcpiRsOutString (Name, ACPI_CAST_PTR (char, Table->Pointer));
break;
case ACPI_RSD_STRING:
- AcpiRsOutString (Name, (char *) Target);
+ AcpiRsOutString (Name, ACPI_CAST_PTR (char, Target));
break;
/* Data items, 8/16/32/64 bit */
case ACPI_RSD_UINT8:
- AcpiRsOutInteger8 (Name, *(UINT8 *) Target);
+ AcpiRsOutInteger8 (Name, ACPI_GET8 (Target));
break;
case ACPI_RSD_UINT16:
- AcpiRsOutInteger16 (Name, *(UINT16 *) Target);
+ AcpiRsOutInteger16 (Name, ACPI_GET16 (Target));
break;
case ACPI_RSD_UINT32:
- AcpiRsOutInteger32 (Name, *(UINT32 *) Target);
+ AcpiRsOutInteger32 (Name, ACPI_GET32 (Target));
break;
case ACPI_RSD_UINT64:
- AcpiRsOutInteger64 (Name, *(UINT64 *) Target);
+ AcpiRsOutInteger64 (Name, ACPI_GET64 (Target));
break;
/* Flags: 1-bit and 2-bit flags supported */
case ACPI_RSD_1BITFLAG:
- AcpiRsOutString (Name, (char *)
- ((const char **) Table->Pointer)[(*(UINT8 *) Target) & 0x01]);
+ AcpiRsOutString (Name, ACPI_CAST_PTR (char,
+ Table->Pointer [*Target & 0x01]));
break;
case ACPI_RSD_2BITFLAG:
- AcpiRsOutString (Name, (char *)
- ((const char **) Table->Pointer)[(*(UINT8 *) Target) & 0x03]);
+ AcpiRsOutString (Name, ACPI_CAST_PTR (char,
+ Table->Pointer [*Target & 0x03]));
break;
case ACPI_RSD_SHORTLIST:
@@ -497,8 +496,7 @@ AcpiRsDumpDescriptor (
if (PreviousTarget)
{
AcpiRsOutTitle (Name);
- AcpiRsDumpShortByteList (*((UINT8 *) PreviousTarget),
- (UINT8 *) Target);
+ AcpiRsDumpShortByteList (*PreviousTarget, Target);
}
break;
@@ -509,8 +507,7 @@ AcpiRsDumpDescriptor (
*/
if (PreviousTarget)
{
- AcpiRsDumpByteList (*((UINT16 *) PreviousTarget),
- (UINT8 *) Target);
+ AcpiRsDumpByteList (ACPI_GET16 (PreviousTarget), Target);
}
break;
@@ -521,8 +518,8 @@ AcpiRsDumpDescriptor (
*/
if (PreviousTarget)
{
- AcpiRsDumpDwordList (*((UINT8 *) PreviousTarget),
- (UINT32 *) Target);
+ AcpiRsDumpDwordList (*PreviousTarget,
+ ACPI_CAST_PTR (UINT32, Target));
}
break;
@@ -530,14 +527,14 @@ AcpiRsDumpDescriptor (
/*
* Common flags for all Address resources
*/
- AcpiRsDumpAddressCommon ((ACPI_RESOURCE_DATA *) Target);
+ AcpiRsDumpAddressCommon (ACPI_CAST_PTR (ACPI_RESOURCE_DATA, Target));
break;
case ACPI_RSD_SOURCE:
/*
* Optional ResourceSource for Address resources
*/
- AcpiRsDumpResourceSource ((ACPI_RESOURCE_SOURCE *) Target);
+ AcpiRsDumpResourceSource (ACPI_CAST_PTR (ACPI_RESOURCE_SOURCE, Target));
break;
default:
@@ -691,7 +688,7 @@ AcpiRsDumpResourceList (
/* Point to the next resource structure */
- ResourceList = ACPI_PTR_ADD (ACPI_RESOURCE, ResourceList,
+ ResourceList = ACPI_ADD_PTR (ACPI_RESOURCE, ResourceList,
ResourceList->Length);
/* Exit when END_TAG descriptor is reached */
@@ -737,8 +734,8 @@ AcpiRsDumpIrqList (
AcpiOsPrintf ("\n[%02X] PCI IRQ Routing Table Package\n", Count);
AcpiRsDumpDescriptor (PrtElement, AcpiRsDumpPrt);
- PrtElement = ACPI_CAST_PTR (ACPI_PCI_ROUTING_TABLE,
- ((UINT8 *) PrtElement) + PrtElement->Length);
+ PrtElement = ACPI_ADD_PTR (ACPI_PCI_ROUTING_TABLE,
+ PrtElement, PrtElement->Length);
}
}
@@ -762,7 +759,12 @@ AcpiRsOutString (
char *Title,
char *Value)
{
- AcpiOsPrintf ("%27s : %s\n", Title, Value);
+ AcpiOsPrintf ("%27s : %s", Title, Value);
+ if (!*Value)
+ {
+ AcpiOsPrintf ("[NULL NAMESTRING]");
+ }
+ AcpiOsPrintf ("\n");
}
static void
diff --git a/sys/contrib/dev/acpica/rsinfo.c b/sys/contrib/dev/acpica/rsinfo.c
index eaf0b2b..f5c1e0b 100644
--- a/sys/contrib/dev/acpica/rsinfo.c
+++ b/sys/contrib/dev/acpica/rsinfo.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rsinfo - Dispatch and Info tables
- * $Revision: 1.4 $
+ * $Revision: 1.8 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -159,8 +159,10 @@ ACPI_RSCONVERT_INFO *AcpiGbl_SetResourceDispatch[] =
/* Dispatch tables for AML-to-resource (Get Resource) conversion functions */
-ACPI_RSCONVERT_INFO *AcpiGbl_SmGetResourceDispatch[] =
+ACPI_RSCONVERT_INFO *AcpiGbl_GetResourceDispatch[] =
{
+ /* Small descriptors */
+
NULL, /* 0x00, Reserved */
NULL, /* 0x01, Reserved */
NULL, /* 0x02, Reserved */
@@ -176,11 +178,10 @@ ACPI_RSCONVERT_INFO *AcpiGbl_SmGetResourceDispatch[] =
NULL, /* 0x0C, Reserved */
NULL, /* 0x0D, Reserved */
AcpiRsGetVendorSmall, /* 0x0E, ACPI_RESOURCE_NAME_VENDOR_SMALL */
- AcpiRsConvertEndTag /* 0x0F, ACPI_RESOURCE_NAME_END_TAG */
-};
+ AcpiRsConvertEndTag, /* 0x0F, ACPI_RESOURCE_NAME_END_TAG */
+
+ /* Large descriptors */
-ACPI_RSCONVERT_INFO *AcpiGbl_LgGetResourceDispatch[] =
-{
NULL, /* 0x00, Reserved */
AcpiRsConvertMemory24, /* 0x01, ACPI_RESOURCE_NAME_MEMORY24 */
AcpiRsConvertGenericReg, /* 0x02, ACPI_RESOURCE_NAME_GENERIC_REGISTER */
@@ -220,8 +221,6 @@ ACPI_RSDUMP_INFO *AcpiGbl_DumpResourceDispatch[] =
AcpiRsDumpExtIrq, /* ACPI_RESOURCE_TYPE_EXTENDED_IRQ */
AcpiRsDumpGenericReg, /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */
};
-
-
#endif
@@ -252,49 +251,40 @@ const UINT8 AcpiGbl_AmlResourceSizes[] =
};
-/* Macros used in the tables below */
+const UINT8 AcpiGbl_ResourceStructSizes[] =
+{
+ /* Small descriptors */
-#define ACPI_RLARGE(r) (sizeof (r) - sizeof (AML_RESOURCE_LARGE_HEADER))
-#define ACPI_RSMALL(r) (sizeof (r) - sizeof (AML_RESOURCE_SMALL_HEADER))
+ 0,
+ 0,
+ 0,
+ 0,
+ ACPI_RS_SIZE (ACPI_RESOURCE_IRQ),
+ ACPI_RS_SIZE (ACPI_RESOURCE_DMA),
+ ACPI_RS_SIZE (ACPI_RESOURCE_START_DEPENDENT),
+ ACPI_RS_SIZE_MIN,
+ ACPI_RS_SIZE (ACPI_RESOURCE_IO),
+ ACPI_RS_SIZE (ACPI_RESOURCE_FIXED_IO),
+ 0,
+ 0,
+ 0,
+ 0,
+ ACPI_RS_SIZE (ACPI_RESOURCE_VENDOR),
+ ACPI_RS_SIZE_MIN,
-/*
- * Base sizes of resource descriptors, both the AML stream resource length
- * (minus size of header and length fields),and the size of the internal
- * struct representation.
- */
-ACPI_RESOURCE_INFO AcpiGbl_SmResourceInfo [] =
-{
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {2, ACPI_RSMALL (AML_RESOURCE_IRQ), ACPI_RS_SIZE (ACPI_RESOURCE_IRQ)},
- {0, ACPI_RSMALL (AML_RESOURCE_DMA), ACPI_RS_SIZE (ACPI_RESOURCE_DMA)},
- {2, ACPI_RSMALL (AML_RESOURCE_START_DEPENDENT), ACPI_RS_SIZE (ACPI_RESOURCE_START_DEPENDENT)},
- {0, ACPI_RSMALL (AML_RESOURCE_END_DEPENDENT), ACPI_RS_SIZE_MIN},
- {0, ACPI_RSMALL (AML_RESOURCE_IO), ACPI_RS_SIZE (ACPI_RESOURCE_IO)},
- {0, ACPI_RSMALL (AML_RESOURCE_FIXED_IO), ACPI_RS_SIZE (ACPI_RESOURCE_FIXED_IO)},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {0, 0, 0},
- {1, ACPI_RSMALL (AML_RESOURCE_VENDOR_SMALL), ACPI_RS_SIZE (ACPI_RESOURCE_VENDOR)},
- {0, ACPI_RSMALL (AML_RESOURCE_END_TAG), ACPI_RS_SIZE_MIN}
-};
+ /* Large descriptors */
-ACPI_RESOURCE_INFO AcpiGbl_LgResourceInfo [] =
-{
- {0, 0, 0},
- {0, ACPI_RLARGE (AML_RESOURCE_MEMORY24), ACPI_RS_SIZE (ACPI_RESOURCE_MEMORY24)},
- {0, ACPI_RLARGE (AML_RESOURCE_GENERIC_REGISTER), ACPI_RS_SIZE (ACPI_RESOURCE_GENERIC_REGISTER)},
- {0, 0, 0},
- {1, ACPI_RLARGE (AML_RESOURCE_VENDOR_LARGE), ACPI_RS_SIZE (ACPI_RESOURCE_VENDOR)},
- {0, ACPI_RLARGE (AML_RESOURCE_MEMORY32), ACPI_RS_SIZE (ACPI_RESOURCE_MEMORY32)},
- {0, ACPI_RLARGE (AML_RESOURCE_FIXED_MEMORY32), ACPI_RS_SIZE (ACPI_RESOURCE_FIXED_MEMORY32)},
- {1, ACPI_RLARGE (AML_RESOURCE_ADDRESS32), ACPI_RS_SIZE (ACPI_RESOURCE_ADDRESS32)},
- {1, ACPI_RLARGE (AML_RESOURCE_ADDRESS16), ACPI_RS_SIZE (ACPI_RESOURCE_ADDRESS16)},
- {1, ACPI_RLARGE (AML_RESOURCE_EXTENDED_IRQ), ACPI_RS_SIZE (ACPI_RESOURCE_EXTENDED_IRQ)},
- {1, ACPI_RLARGE (AML_RESOURCE_ADDRESS64), ACPI_RS_SIZE (ACPI_RESOURCE_ADDRESS64)},
- {0, ACPI_RLARGE (AML_RESOURCE_EXTENDED_ADDRESS64), ACPI_RS_SIZE (ACPI_RESOURCE_EXTENDED_ADDRESS64)}
+ 0,
+ ACPI_RS_SIZE (ACPI_RESOURCE_MEMORY24),
+ ACPI_RS_SIZE (ACPI_RESOURCE_GENERIC_REGISTER),
+ 0,
+ ACPI_RS_SIZE (ACPI_RESOURCE_VENDOR),
+ ACPI_RS_SIZE (ACPI_RESOURCE_MEMORY32),
+ ACPI_RS_SIZE (ACPI_RESOURCE_FIXED_MEMORY32),
+ ACPI_RS_SIZE (ACPI_RESOURCE_ADDRESS32),
+ ACPI_RS_SIZE (ACPI_RESOURCE_ADDRESS16),
+ ACPI_RS_SIZE (ACPI_RESOURCE_EXTENDED_IRQ),
+ ACPI_RS_SIZE (ACPI_RESOURCE_ADDRESS64),
+ ACPI_RS_SIZE (ACPI_RESOURCE_EXTENDED_ADDRESS64)
};
diff --git a/sys/contrib/dev/acpica/rsio.c b/sys/contrib/dev/acpica/rsio.c
index 82667f1..5222979 100644
--- a/sys/contrib/dev/acpica/rsio.c
+++ b/sys/contrib/dev/acpica/rsio.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rsio - IO and DMA resource descriptors
- * $Revision: 1.33 $
+ * $Revision: 1.35 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
diff --git a/sys/contrib/dev/acpica/rsirq.c b/sys/contrib/dev/acpica/rsirq.c
index 0953fa4..abf72c6 100644
--- a/sys/contrib/dev/acpica/rsirq.c
+++ b/sys/contrib/dev/acpica/rsirq.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rsirq - IRQ resource descriptors
- * $Revision: 1.48 $
+ * $Revision: 1.50 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
diff --git a/sys/contrib/dev/acpica/rslist.c b/sys/contrib/dev/acpica/rslist.c
index ac1d95f..37a0764 100644
--- a/sys/contrib/dev/acpica/rslist.c
+++ b/sys/contrib/dev/acpica/rslist.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rslist - Linked list utilities
- * $Revision: 1.47 $
+ * $Revision: 1.62 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -123,232 +123,70 @@
ACPI_MODULE_NAME ("rslist")
-/* Local prototypes */
-
-static ACPI_RSCONVERT_INFO *
-AcpiRsGetConversionInfo (
- UINT8 ResourceType);
-
-static ACPI_STATUS
-AcpiRsValidateResourceLength (
- AML_RESOURCE *Aml);
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiRsValidateResourceLength
- *
- * PARAMETERS: Aml - Pointer to the AML resource descriptor
- *
- * RETURN: Status - AE_OK if the resource length appears valid
- *
- * DESCRIPTION: Validate the ResourceLength. Fixed-length descriptors must
- * have the exact length; variable-length descriptors must be
- * at least as long as the minimum. Certain Small descriptors
- * can vary in size by at most one byte.
- *
- ******************************************************************************/
-
-static ACPI_STATUS
-AcpiRsValidateResourceLength (
- AML_RESOURCE *Aml)
-{
- ACPI_RESOURCE_INFO *ResourceInfo;
- UINT16 MinimumAmlResourceLength;
- UINT16 ResourceLength;
-
-
- ACPI_FUNCTION_ENTRY ();
-
-
- /* Get the size and type info about this resource descriptor */
-
- ResourceInfo = AcpiRsGetResourceInfo (Aml->SmallHeader.DescriptorType);
- if (!ResourceInfo)
- {
- return (AE_AML_INVALID_RESOURCE_TYPE);
- }
-
- ResourceLength = AcpiUtGetResourceLength (Aml);
- MinimumAmlResourceLength = ResourceInfo->MinimumAmlResourceLength;
-
- /* Validate based upon the type of resource, fixed length or variable */
-
- if (ResourceInfo->LengthType == ACPI_FIXED_LENGTH)
- {
- /* Fixed length resource, length must match exactly */
-
- if (ResourceLength != MinimumAmlResourceLength)
- {
- return (AE_AML_BAD_RESOURCE_LENGTH);
- }
- }
- else if (ResourceInfo->LengthType == ACPI_VARIABLE_LENGTH)
- {
- /* Variable length resource, must be at least the minimum */
-
- if (ResourceLength < MinimumAmlResourceLength)
- {
- return (AE_AML_BAD_RESOURCE_LENGTH);
- }
- }
- else
- {
- /* Small variable length resource, allowed to be (Min) or (Min-1) */
-
- if ((ResourceLength > MinimumAmlResourceLength) ||
- (ResourceLength < (MinimumAmlResourceLength - 1)))
- {
- return (AE_AML_BAD_RESOURCE_LENGTH);
- }
- }
-
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiRsGetConversionInfo
- *
- * PARAMETERS: ResourceType - Byte 0 of a resource descriptor
- *
- * RETURN: Pointer to the resource conversion info table
- *
- * DESCRIPTION: Get the conversion table associated with this resource type
- *
- ******************************************************************************/
-
-static ACPI_RSCONVERT_INFO *
-AcpiRsGetConversionInfo (
- UINT8 ResourceType)
-{
- ACPI_FUNCTION_ENTRY ();
-
-
- /* Determine if this is a small or large resource */
-
- if (ResourceType & ACPI_RESOURCE_NAME_LARGE)
- {
- /* Large Resource Type -- bits 6:0 contain the name */
-
- if (ResourceType > ACPI_RESOURCE_NAME_LARGE_MAX)
- {
- return (NULL);
- }
-
- return (AcpiGbl_LgGetResourceDispatch [
- (ResourceType & ACPI_RESOURCE_NAME_LARGE_MASK)]);
- }
- else
- {
- /* Small Resource Type -- bits 6:3 contain the name */
-
- return (AcpiGbl_SmGetResourceDispatch [
- ((ResourceType & ACPI_RESOURCE_NAME_SMALL_MASK) >> 3)]);
- }
-}
-
-
/*******************************************************************************
*
* FUNCTION: AcpiRsConvertAmlToResources
*
- * PARAMETERS: AmlBuffer - Pointer to the resource byte stream
- * AmlBufferLength - Length of AmlBuffer
- * OutputBuffer - Pointer to the buffer that will
- * contain the output structures
+ * PARAMETERS: ACPI_WALK_AML_CALLBACK
+ * ResourcePtr - Pointer to the buffer that will
+ * contain the output structures
*
* RETURN: Status
*
- * DESCRIPTION: Takes the resource byte stream and parses it, creating a
- * linked list of resources in the caller's output buffer
+ * DESCRIPTION: Convert an AML resource to an internal representation of the
+ * resource that is aligned and easier to access.
*
******************************************************************************/
ACPI_STATUS
AcpiRsConvertAmlToResources (
- UINT8 *AmlBuffer,
- UINT32 AmlBufferLength,
- UINT8 *OutputBuffer)
+ UINT8 *Aml,
+ UINT32 Length,
+ UINT32 Offset,
+ UINT8 ResourceIndex,
+ void *Context)
{
- UINT8 *Buffer = OutputBuffer;
- ACPI_STATUS Status;
- ACPI_SIZE BytesParsed = 0;
+ ACPI_RESOURCE **ResourcePtr = ACPI_CAST_INDIRECT_PTR (
+ ACPI_RESOURCE, Context);
ACPI_RESOURCE *Resource;
- ACPI_RSDESC_SIZE DescriptorLength;
- ACPI_RSCONVERT_INFO *Info;
-
+ ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("RsConvertAmlToResources");
+ ACPI_FUNCTION_TRACE (RsConvertAmlToResources);
- /* Loop until end-of-buffer or an EndTag is found */
- while (BytesParsed < AmlBufferLength)
+ /*
+ * Check that the input buffer and all subsequent pointers into it
+ * are aligned on a native word boundary. Most important on IA64
+ */
+ Resource = *ResourcePtr;
+ if (ACPI_IS_MISALIGNED (Resource))
{
- /* Get the conversion table associated with this Descriptor Type */
-
- Info = AcpiRsGetConversionInfo (*AmlBuffer);
- if (!Info)
- {
- /* No table indicates an invalid resource type */
-
- return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
- }
-
- DescriptorLength = AcpiUtGetDescriptorLength (AmlBuffer);
-
- /*
- * Perform limited validation of the resource length, based upon
- * what we know about the resource type
- */
- Status = AcpiRsValidateResourceLength (
- ACPI_CAST_PTR (AML_RESOURCE, AmlBuffer));
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /* Convert the AML byte stream resource to a local resource struct */
-
- Status = AcpiRsConvertAmlToResource (
- ACPI_CAST_PTR (ACPI_RESOURCE, Buffer),
- ACPI_CAST_PTR (AML_RESOURCE, AmlBuffer),
- Info);
- if (ACPI_FAILURE (Status))
- {
- ACPI_REPORT_ERROR ((
- "Could not convert AML resource (type %X) to resource, %s\n",
- *AmlBuffer, AcpiFormatException (Status)));
- return_ACPI_STATUS (Status);
- }
-
- /* Set the aligned length of the new resource descriptor */
-
- Resource = ACPI_CAST_PTR (ACPI_RESOURCE, Buffer);
- Resource->Length = (UINT32) ACPI_ALIGN_RESOURCE_SIZE (Resource->Length);
-
- /* Normal exit on completion of an EndTag resource descriptor */
-
- if (AcpiUtGetResourceType (AmlBuffer) == ACPI_RESOURCE_NAME_END_TAG)
- {
- return_ACPI_STATUS (AE_OK);
- }
-
- /* Update counter and point to the next input resource */
-
- BytesParsed += DescriptorLength;
- AmlBuffer += DescriptorLength;
+ ACPI_WARNING ((AE_INFO,
+ "Misaligned resource pointer %p", Resource));
+ }
- /* Point to the next structure in the output buffer */
+ /* Convert the AML byte stream resource to a local resource struct */
- Buffer += Resource->Length;
+ Status = AcpiRsConvertAmlToResource (
+ Resource, ACPI_CAST_PTR (AML_RESOURCE, Aml),
+ AcpiGbl_GetResourceDispatch[ResourceIndex]);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Could not convert AML resource (Type %X)", *Aml));
+ return_ACPI_STATUS (Status);
}
- /* Completed buffer, but did not find an EndTag resource descriptor */
+ ACPI_DEBUG_PRINT ((ACPI_DB_RESOURCES,
+ "Type %.2X, AmlLength %.2X InternalLength %.2X\n",
+ AcpiUtGetResourceType (Aml), Length,
+ Resource->Length));
- return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG);
+ /* Point to the next structure in the output buffer */
+
+ *ResourcePtr = ACPI_ADD_PTR (void, Resource, Resource->Length);
+ return_ACPI_STATUS (AE_OK);
}
@@ -377,24 +215,24 @@ AcpiRsConvertResourcesToAml (
ACPI_SIZE AmlSizeNeeded,
UINT8 *OutputBuffer)
{
- UINT8 *AmlBuffer = OutputBuffer;
- UINT8 *EndAmlBuffer = OutputBuffer + AmlSizeNeeded;
+ UINT8 *Aml = OutputBuffer;
+ UINT8 *EndAml = OutputBuffer + AmlSizeNeeded;
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("RsConvertResourcesToAml");
+ ACPI_FUNCTION_TRACE (RsConvertResourcesToAml);
/* Walk the resource descriptor list, convert each descriptor */
- while (AmlBuffer < EndAmlBuffer)
+ while (Aml < EndAml)
{
- /* Validate the Resource Type */
+ /* Validate the (internal) Resource Type */
if (Resource->Type > ACPI_RESOURCE_TYPE_MAX)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Invalid descriptor type (%X) in resource list\n",
+ ACPI_ERROR ((AE_INFO,
+ "Invalid descriptor type (%X) in resource list",
Resource->Type));
return_ACPI_STATUS (AE_BAD_DATA);
}
@@ -402,19 +240,20 @@ AcpiRsConvertResourcesToAml (
/* Perform the conversion */
Status = AcpiRsConvertResourceToAml (Resource,
- ACPI_CAST_PTR (AML_RESOURCE, AmlBuffer),
+ ACPI_CAST_PTR (AML_RESOURCE, Aml),
AcpiGbl_SetResourceDispatch[Resource->Type]);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR (("Could not convert resource (type %X) to AML, %s\n",
- Resource->Type, AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Could not convert resource (type %X) to AML",
+ Resource->Type));
return_ACPI_STATUS (Status);
}
/* Perform final sanity check on the new AML resource descriptor */
- Status = AcpiRsValidateResourceLength (
- ACPI_CAST_PTR (AML_RESOURCE, AmlBuffer));
+ Status = AcpiUtValidateResource (
+ ACPI_CAST_PTR (AML_RESOURCE, Aml), NULL);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -431,16 +270,13 @@ AcpiRsConvertResourcesToAml (
/*
* Extract the total length of the new descriptor and set the
- * AmlBuffer to point to the next (output) resource descriptor
+ * Aml to point to the next (output) resource descriptor
*/
- AmlBuffer += AcpiUtGetDescriptorLength (AmlBuffer);
+ Aml += AcpiUtGetDescriptorLength (Aml);
/* Point to the next input resource descriptor */
- Resource = ACPI_PTR_ADD (ACPI_RESOURCE, Resource, Resource->Length);
-
- /* Check for end-of-list, normal exit */
-
+ Resource = ACPI_ADD_PTR (ACPI_RESOURCE, Resource, Resource->Length);
}
/* Completed buffer, but did not find an EndTag resource descriptor */
diff --git a/sys/contrib/dev/acpica/rsmemory.c b/sys/contrib/dev/acpica/rsmemory.c
index fcd4f6a..e4ab62d 100644
--- a/sys/contrib/dev/acpica/rsmemory.c
+++ b/sys/contrib/dev/acpica/rsmemory.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rsmem24 - Memory resource descriptors
- * $Revision: 1.32 $
+ * $Revision: 1.34 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
diff --git a/sys/contrib/dev/acpica/rsmisc.c b/sys/contrib/dev/acpica/rsmisc.c
index bc28464..6150bde 100644
--- a/sys/contrib/dev/acpica/rsmisc.c
+++ b/sys/contrib/dev/acpica/rsmisc.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rsmisc - Miscellaneous resource descriptors
- * $Revision: 1.35 $
+ * $Revision: 1.46 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -163,13 +163,16 @@ AcpiRsConvertAmlToResource (
UINT16 Temp16 = 0;
- ACPI_FUNCTION_TRACE ("RsGetResource");
+ ACPI_FUNCTION_TRACE (RsConvertAmlToResource);
if (((ACPI_NATIVE_UINT) Resource) & 0x3)
{
- AcpiOsPrintf ("**** GET: Misaligned resource pointer: %p Type %2.2X Len %X\n",
- Resource, Resource->Type, Resource->Length);
+ /* Each internal resource struct is expected to be 32-bit aligned */
+
+ ACPI_WARNING ((AE_INFO,
+ "Misaligned resource pointer (get): %p Type %2.2X Len %X",
+ Resource, Resource->Type, Resource->Length));
}
/* Extract the resource Length field (does not include header length) */
@@ -188,8 +191,8 @@ AcpiRsConvertAmlToResource (
* Source is the external AML byte stream buffer,
* destination is the internal resource descriptor
*/
- Source = ((UINT8 *) Aml) + Info->AmlOffset;
- Destination = ((UINT8 *) Resource) + Info->ResourceOffset;
+ Source = ACPI_ADD_PTR (void, Aml, Info->AmlOffset);
+ Destination = ACPI_ADD_PTR (void, Resource, Info->ResourceOffset);
switch (Info->Opcode)
{
@@ -217,8 +220,8 @@ AcpiRsConvertAmlToResource (
/*
* Mask and shift the flag bit
*/
- *((UINT8 *) Destination) = (UINT8)
- ((*((UINT8 *) Source) >> Info->Value) & 0x01);
+ ACPI_SET8 (Destination) = (UINT8)
+ ((ACPI_GET8 (Source) >> Info->Value) & 0x01);
break;
@@ -226,15 +229,15 @@ AcpiRsConvertAmlToResource (
/*
* Mask and shift the flag bits
*/
- *((UINT8 *) Destination) = (UINT8)
- ((*((UINT8 *) Source) >> Info->Value) & 0x03);
+ ACPI_SET8 (Destination) = (UINT8)
+ ((ACPI_GET8 (Source) >> Info->Value) & 0x03);
break;
case ACPI_RSC_COUNT:
- ItemCount = *((UINT8 *) Source);
- *((UINT8 *) Destination) = (UINT8) ItemCount;
+ ItemCount = ACPI_GET8 (Source);
+ ACPI_SET8 (Destination) = (UINT8) ItemCount;
Resource->Length = Resource->Length +
(Info->Value * (ItemCount - 1));
@@ -244,7 +247,7 @@ AcpiRsConvertAmlToResource (
case ACPI_RSC_COUNT16:
ItemCount = AmlResourceLength;
- *((UINT16 *) Destination) = ItemCount;
+ ACPI_SET16 (Destination) = ItemCount;
Resource->Length = Resource->Length +
(Info->Value * (ItemCount - 1));
@@ -269,8 +272,7 @@ AcpiRsConvertAmlToResource (
{
ItemCount = Info->Value;
}
- AcpiRsMoveData (Destination, Source, ItemCount,
- Info->Opcode);
+ AcpiRsMoveData (Destination, Source, ItemCount, Info->Opcode);
break;
@@ -282,8 +284,8 @@ AcpiRsConvertAmlToResource (
case ACPI_RSC_DATA8:
- Target = ((char *) Resource) + Info->Value;
- ACPI_MEMCPY (Destination, Source, *(ACPI_CAST_PTR (UINT16, Target)));
+ Target = ACPI_ADD_PTR (char, Resource, Info->Value);
+ ACPI_MEMCPY (Destination, Source, ACPI_GET16 (Target));
break;
@@ -313,7 +315,7 @@ AcpiRsConvertAmlToResource (
* Optional ResourceSource (Index and String). This is the more
* complicated case used by the Interrupt() macro
*/
- Target = ((char *) Resource) + Info->AmlOffset + (ItemCount * 4);
+ Target = ACPI_ADD_PTR (char, Resource, Info->AmlOffset + (ItemCount * 4));
Resource->Length +=
AcpiRsGetResourceSource (AmlResourceLength,
@@ -326,14 +328,14 @@ AcpiRsConvertAmlToResource (
/*
* 8-bit encoded bitmask (DMA macro)
*/
- ItemCount = AcpiRsDecodeBitmask (*((UINT8 *) Source), Destination);
+ ItemCount = AcpiRsDecodeBitmask (ACPI_GET8 (Source), Destination);
if (ItemCount)
{
Resource->Length += (ItemCount - 1);
}
- Target = ((char *) Resource) + Info->Value;
- *((UINT8 *) Target) = (UINT8) ItemCount;
+ Target = ACPI_ADD_PTR (char, Resource, Info->Value);
+ ACPI_SET8 (Target) = (UINT8) ItemCount;
break;
@@ -349,8 +351,8 @@ AcpiRsConvertAmlToResource (
Resource->Length += (ItemCount - 1);
}
- Target = ((char *) Resource) + Info->Value;
- *((UINT8 *) Target) = (UINT8) ItemCount;
+ Target = ACPI_ADD_PTR (char, Resource, Info->Value);
+ ACPI_SET8 (Target) = (UINT8) ItemCount;
break;
@@ -368,14 +370,15 @@ AcpiRsConvertAmlToResource (
break;
case ACPI_RSC_COMPARE_VALUE:
- if (*((UINT8 *) Source) != Info->Value)
+ if (ACPI_GET8 (Source) != Info->Value)
{
goto Exit;
}
break;
default:
- AcpiOsPrintf ("*** Invalid conversion sub-opcode\n");
+
+ ACPI_ERROR ((AE_INFO, "Invalid conversion sub-opcode"));
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
break;
@@ -383,7 +386,7 @@ AcpiRsConvertAmlToResource (
default:
- AcpiOsPrintf ("*** Invalid conversion opcode\n");
+ ACPI_ERROR ((AE_INFO, "Invalid conversion opcode"));
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
@@ -394,9 +397,9 @@ AcpiRsConvertAmlToResource (
Exit:
if (!FlagsMode)
{
- /* Round the resource struct length up to the next 32-bit boundary */
+ /* Round the resource struct length up to the next boundary (32 or 64) */
- Resource->Length = ACPI_ROUND_UP_TO_32BITS (Resource->Length);
+ Resource->Length = (UINT32) ACPI_ROUND_UP_TO_NATIVE_WORD (Resource->Length);
}
return_ACPI_STATUS (AE_OK);
}
@@ -431,16 +434,8 @@ AcpiRsConvertResourceToAml (
UINT16 ItemCount = 0;
- ACPI_FUNCTION_TRACE ("RsConvertResourceToAml");
-
-
- /* Validate the Resource pointer, must be 32-bit aligned */
+ ACPI_FUNCTION_TRACE (RsConvertResourceToAml);
- if (((ACPI_NATIVE_UINT) Resource) & 0x3)
- {
- AcpiOsPrintf ("**** SET: Misaligned resource pointer: %p Type %2.2X Len %X\n",
- Resource, Resource->Type, Resource->Length);
- }
/*
* First table entry must be ACPI_RSC_INITxxx and must contain the
@@ -454,8 +449,8 @@ AcpiRsConvertResourceToAml (
* Source is the internal resource descriptor,
* destination is the external AML byte stream buffer
*/
- Source = ((UINT8 *) Resource) + Info->ResourceOffset;
- Destination = ((UINT8 *) Aml) + Info->AmlOffset;
+ Source = ACPI_ADD_PTR (void, Resource, Info->ResourceOffset);
+ Destination = ACPI_ADD_PTR (void, Aml, Info->AmlOffset);
switch (Info->Opcode)
{
@@ -475,7 +470,7 @@ AcpiRsConvertResourceToAml (
/*
* Clear the flag byte
*/
- *((UINT8 *) Destination) = 0;
+ ACPI_SET8 (Destination) = 0;
break;
@@ -483,8 +478,8 @@ AcpiRsConvertResourceToAml (
/*
* Mask and shift the flag bit
*/
- *((UINT8 *) Destination) |= (UINT8)
- ((*((UINT8 *) Source) & 0x01) << Info->Value);
+ ACPI_SET8 (Destination) |= (UINT8)
+ ((ACPI_GET8 (Source) & 0x01) << Info->Value);
break;
@@ -492,24 +487,23 @@ AcpiRsConvertResourceToAml (
/*
* Mask and shift the flag bits
*/
- *((UINT8 *) Destination) |= (UINT8)
- ((*((UINT8 *) Source) & 0x03) << Info->Value);
+ ACPI_SET8 (Destination) |= (UINT8)
+ ((ACPI_GET8 (Source) & 0x03) << Info->Value);
break;
case ACPI_RSC_COUNT:
- ItemCount = *((UINT8 *) Source);
- *((UINT8 *) Destination) = (UINT8) ItemCount;
+ ItemCount = ACPI_GET8 (Source);
+ ACPI_SET8 (Destination) = (UINT8) ItemCount;
- AmlLength = (UINT16) (AmlLength +
- (Info->Value * (ItemCount - 1)));
+ AmlLength = (UINT16) (AmlLength + (Info->Value * (ItemCount - 1)));
break;
case ACPI_RSC_COUNT16:
- ItemCount = *((UINT16 *) Source);
+ ItemCount = ACPI_GET16 (Source);
AmlLength = (UINT16) (AmlLength + ItemCount);
AcpiRsSetResourceLength (AmlLength, Aml);
break;
@@ -566,8 +560,9 @@ AcpiRsConvertResourceToAml (
/*
* 8-bit encoded bitmask (DMA macro)
*/
- *((UINT8 *) Destination) = (UINT8)
- AcpiRsEncodeBitmask (Source, *(((UINT8 *) Resource) + Info->Value));
+ ACPI_SET8 (Destination) = (UINT8)
+ AcpiRsEncodeBitmask (Source,
+ *ACPI_ADD_PTR (UINT8, Resource, Info->Value));
break;
@@ -575,7 +570,8 @@ AcpiRsConvertResourceToAml (
/*
* 16-bit encoded bitmask (IRQ macro)
*/
- Temp16 = AcpiRsEncodeBitmask (Source, *(((UINT8 *) Resource) + Info->Value));
+ Temp16 = AcpiRsEncodeBitmask (Source,
+ *ACPI_ADD_PTR (UINT8, Resource, Info->Value));
ACPI_MOVE_16_TO_16 (Destination, &Temp16);
break;
@@ -598,14 +594,17 @@ AcpiRsConvertResourceToAml (
switch (COMPARE_OPCODE (Info))
{
case ACPI_RSC_COMPARE_VALUE:
- if (*((UINT8 *) (((UINT8 *) Resource) + COMPARE_TARGET(Info))) != COMPARE_VALUE (Info))
+
+ if (*ACPI_ADD_PTR (UINT8, Resource,
+ COMPARE_TARGET (Info)) != COMPARE_VALUE (Info))
{
goto Exit;
}
break;
default:
- AcpiOsPrintf ("*** Invalid conversion sub-opcode\n");
+
+ ACPI_ERROR ((AE_INFO, "Invalid conversion sub-opcode"));
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
break;
@@ -613,7 +612,7 @@ AcpiRsConvertResourceToAml (
default:
- AcpiOsPrintf ("*** Invalid conversion opcode\n");
+ ACPI_ERROR ((AE_INFO, "Invalid conversion opcode"));
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
@@ -647,8 +646,8 @@ Exit:
* polarity/trigger interrupts are allowed (ACPI spec, section
* "IRQ Format"), so 0x00 and 0x09 are illegal.
*/
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Invalid interrupt polarity/trigger in resource list, %X\n",
+ ACPI_ERROR ((AE_INFO,
+ "Invalid interrupt polarity/trigger in resource list, %X",
Aml->Irq.Flags));
return_ACPI_STATUS (AE_BAD_DATA);
}
@@ -663,8 +662,8 @@ Exit:
if (Resource->Data.Dma.Transfer == 0x03)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Invalid DMA.Transfer preference (3)\n"));
+ ACPI_ERROR ((AE_INFO,
+ "Invalid DMA.Transfer preference (3)"));
return_ACPI_STATUS (AE_BAD_DATA);
}
#endif
diff --git a/sys/contrib/dev/acpica/rsutils.c b/sys/contrib/dev/acpica/rsutils.c
index 72cb9bf..369eb86 100644
--- a/sys/contrib/dev/acpica/rsutils.c
+++ b/sys/contrib/dev/acpica/rsutils.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rsutils - Utilities for the resource manager
- * $Revision: 1.50 $
+ * $Revision: 1.67 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -148,6 +148,9 @@ AcpiRsDecodeBitmask (
UINT8 BitCount;
+ ACPI_FUNCTION_ENTRY ();
+
+
/* Decode the mask bits */
for (i = 0, BitCount = 0; Mask; i++)
@@ -187,6 +190,9 @@ AcpiRsEncodeBitmask (
UINT16 Mask;
+ ACPI_FUNCTION_ENTRY ();
+
+
/* Encode the list into a single bitmask */
for (i = 0, Mask = 0; i < Count; i++)
@@ -225,6 +231,9 @@ AcpiRsMoveData (
ACPI_NATIVE_UINT i;
+ ACPI_FUNCTION_ENTRY ();
+
+
/* One move per item */
for (i = 0; i < ItemCount; i++)
@@ -245,18 +254,18 @@ AcpiRsMoveData (
* misaligned memory transfers
*/
case ACPI_RSC_MOVE16:
- ACPI_MOVE_16_TO_16 (&((UINT16 *) Destination)[i],
- &((UINT16 *) Source)[i]);
+ ACPI_MOVE_16_TO_16 (&ACPI_CAST_PTR (UINT16, Destination)[i],
+ &ACPI_CAST_PTR (UINT16, Source)[i]);
break;
case ACPI_RSC_MOVE32:
- ACPI_MOVE_32_TO_32 (&((UINT32 *) Destination)[i],
- &((UINT32 *) Source)[i]);
+ ACPI_MOVE_32_TO_32 (&ACPI_CAST_PTR (UINT32, Destination)[i],
+ &ACPI_CAST_PTR (UINT32, Source)[i]);
break;
case ACPI_RSC_MOVE64:
- ACPI_MOVE_64_TO_64 (&((UINT64 *) Destination)[i],
- &((UINT64 *) Source)[i]);
+ ACPI_MOVE_64_TO_64 (&ACPI_CAST_PTR (UINT64, Destination)[i],
+ &ACPI_CAST_PTR (UINT64, Source)[i]);
break;
default:
@@ -268,62 +277,6 @@ AcpiRsMoveData (
/*******************************************************************************
*
- * FUNCTION: AcpiRsGetResourceInfo
- *
- * PARAMETERS: ResourceType - Byte 0 of a resource descriptor
- *
- * RETURN: Pointer to the resource conversion handler
- *
- * DESCRIPTION: Extract the Resource Type/Name from the first byte of
- * a resource descriptor.
- *
- ******************************************************************************/
-
-ACPI_RESOURCE_INFO *
-AcpiRsGetResourceInfo (
- UINT8 ResourceType)
-{
- ACPI_RESOURCE_INFO *SizeInfo;
-
-
- ACPI_FUNCTION_ENTRY ();
-
-
- /* Determine if this is a small or large resource */
-
- if (ResourceType & ACPI_RESOURCE_NAME_LARGE)
- {
- /* Large Resource Type -- bits 6:0 contain the name */
-
- if (ResourceType > ACPI_RESOURCE_NAME_LARGE_MAX)
- {
- return (NULL);
- }
-
- SizeInfo = &AcpiGbl_LgResourceInfo [
- (ResourceType & ACPI_RESOURCE_NAME_LARGE_MASK)];
- }
- else
- {
- /* Small Resource Type -- bits 6:3 contain the name */
-
- SizeInfo = &AcpiGbl_SmResourceInfo [
- ((ResourceType & ACPI_RESOURCE_NAME_SMALL_MASK) >> 3)];
- }
-
- /* Zero entry indicates an invalid resource type */
-
- if (!SizeInfo->MinimumInternalStructLength)
- {
- return (NULL);
- }
-
- return (SizeInfo);
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: AcpiRsSetResourceLength
*
* PARAMETERS: TotalLength - Length of the AML descriptor, including
@@ -350,27 +303,22 @@ AcpiRsSetResourceLength (
ACPI_FUNCTION_ENTRY ();
- /* Determine if this is a small or large resource */
+ /* Length is the total descriptor length minus the header length */
- if (Aml->SmallHeader.DescriptorType & ACPI_RESOURCE_NAME_LARGE)
- {
- /* Large Resource type -- bytes 1-2 contain the 16-bit length */
+ ResourceLength = (ACPI_RS_LENGTH)
+ (TotalLength - AcpiUtGetResourceHeaderLength (Aml));
- ResourceLength = (ACPI_RS_LENGTH)
- (TotalLength - sizeof (AML_RESOURCE_LARGE_HEADER));
+ /* Length is stored differently for large and small descriptors */
- /* Insert length into the Large descriptor length field */
+ if (Aml->SmallHeader.DescriptorType & ACPI_RESOURCE_NAME_LARGE)
+ {
+ /* Large descriptor -- bytes 1-2 contain the 16-bit length */
ACPI_MOVE_16_TO_16 (&Aml->LargeHeader.ResourceLength, &ResourceLength);
}
else
{
- /* Small Resource type -- bits 2:0 of byte 0 contain the length */
-
- ResourceLength = (ACPI_RS_LENGTH)
- (TotalLength - sizeof (AML_RESOURCE_SMALL_HEADER));
-
- /* Insert length into the descriptor type byte */
+ /* Small descriptor -- bits 2:0 of byte 0 contain the length */
Aml->SmallHeader.DescriptorType = (UINT8)
@@ -409,7 +357,7 @@ AcpiRsSetResourceHeader (
ACPI_FUNCTION_ENTRY ();
- /* Set the Descriptor Type */
+ /* Set the Resource Type */
Aml->SmallHeader.DescriptorType = DescriptorType;
@@ -469,7 +417,8 @@ AcpiRsStrcpy (
* StringPtr - (optional) where to store the actual
* ResourceSource string
*
- * RETURN: Length of the string plus NULL terminator, rounded up to 32 bit
+ * RETURN: Length of the string plus NULL terminator, rounded up to native
+ * word boundary
*
* DESCRIPTION: Copy the optional ResourceSource data from a raw AML descriptor
* to an internal resource descriptor
@@ -492,7 +441,7 @@ AcpiRsGetResourceSource (
TotalLength = ResourceLength + sizeof (AML_RESOURCE_LARGE_HEADER);
- AmlResourceSource = ((UINT8 *) Aml) + MinimumLength;
+ AmlResourceSource = ACPI_ADD_PTR (UINT8, Aml, MinimumLength);
/*
* ResourceSource is present if the length of the descriptor is longer than
@@ -501,7 +450,7 @@ AcpiRsGetResourceSource (
* Note: Some resource descriptors will have an additional null, so
* we add 1 to the minimum length.
*/
- if (TotalLength > (ACPI_RSDESC_SIZE )(MinimumLength + 1))
+ if (TotalLength > (ACPI_RSDESC_SIZE) (MinimumLength + 1))
{
/* Get the ResourceSourceIndex */
@@ -514,39 +463,40 @@ AcpiRsGetResourceSource (
* String destination pointer is not specified; Set the String
* pointer to the end of the current ResourceSource structure.
*/
- ResourceSource->StringPtr = (char *)
- ((UINT8 *) ResourceSource) + sizeof (ACPI_RESOURCE_SOURCE);
+ ResourceSource->StringPtr = ACPI_ADD_PTR (char, ResourceSource,
+ sizeof (ACPI_RESOURCE_SOURCE));
}
/*
- * In order for the StructSize to fall on a 32-bit boundary, calculate
- * the length of the string (+1 for the NULL terminator) and expand the
- * StructSize to the next 32-bit boundary.
+ * In order for the Resource length to be a multiple of the native
+ * word, calculate the length of the string (+1 for NULL terminator)
+ * and expand to the next word multiple.
*
* Zero the entire area of the buffer.
*/
- TotalLength = ACPI_ROUND_UP_TO_32BITS (
- ACPI_STRLEN ((char *) &AmlResourceSource[1]) + 1);
+ TotalLength = (UINT32) ACPI_STRLEN (
+ ACPI_CAST_PTR (char, &AmlResourceSource[1])) + 1;
+ TotalLength = (UINT32) ACPI_ROUND_UP_TO_NATIVE_WORD (TotalLength);
+
ACPI_MEMSET (ResourceSource->StringPtr, 0, TotalLength);
/* Copy the ResourceSource string to the destination */
ResourceSource->StringLength = AcpiRsStrcpy (ResourceSource->StringPtr,
- (char *) &AmlResourceSource[1]);
+ ACPI_CAST_PTR (char, &AmlResourceSource[1]));
return ((ACPI_RS_LENGTH) TotalLength);
}
- else
- {
- /* ResourceSource is not present */
- ResourceSource->Index = 0;
- ResourceSource->StringLength = 0;
- ResourceSource->StringPtr = NULL;
- return (0);
- }
+ /* ResourceSource is not present */
+
+ ResourceSource->Index = 0;
+ ResourceSource->StringLength = 0;
+ ResourceSource->StringPtr = NULL;
+ return (0);
}
+
/*******************************************************************************
*
* FUNCTION: AcpiRsSetResourceSource
@@ -585,7 +535,7 @@ AcpiRsSetResourceSource (
{
/* Point to the end of the AML descriptor */
- AmlResourceSource = ((UINT8 *) Aml) + MinimumLength;
+ AmlResourceSource = ACPI_ADD_PTR (UINT8, Aml, MinimumLength);
/* Copy the ResourceSourceIndex */
@@ -593,8 +543,8 @@ AcpiRsSetResourceSource (
/* Copy the ResourceSource string */
- ACPI_STRCPY ((char *) &AmlResourceSource[1],
- ResourceSource->StringPtr);
+ ACPI_STRCPY (ACPI_CAST_PTR (char, &AmlResourceSource[1]),
+ ResourceSource->StringPtr);
/*
* Add the length of the string (+ 1 for null terminator) to the
@@ -613,9 +563,9 @@ AcpiRsSetResourceSource (
*
* FUNCTION: AcpiRsGetPrtMethodData
*
- * PARAMETERS: Handle - a handle to the containing object
- * RetBuffer - a pointer to a buffer structure for the
- * results
+ * PARAMETERS: Node - Device node
+ * RetBuffer - Pointer to a buffer structure for the
+ * results
*
* RETURN: Status
*
@@ -629,21 +579,21 @@ AcpiRsSetResourceSource (
ACPI_STATUS
AcpiRsGetPrtMethodData (
- ACPI_HANDLE Handle,
+ ACPI_NAMESPACE_NODE *Node,
ACPI_BUFFER *RetBuffer)
{
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("RsGetPrtMethodData");
+ ACPI_FUNCTION_TRACE (RsGetPrtMethodData);
/* Parameters guaranteed valid by caller */
/* Execute the method, no parameters */
- Status = AcpiUtEvaluateObject (Handle, METHOD_NAME__PRT,
+ Status = AcpiUtEvaluateObject (Node, METHOD_NAME__PRT,
ACPI_BTYPE_PACKAGE, &ObjDesc);
if (ACPI_FAILURE (Status))
{
@@ -667,9 +617,9 @@ AcpiRsGetPrtMethodData (
*
* FUNCTION: AcpiRsGetCrsMethodData
*
- * PARAMETERS: Handle - a handle to the containing object
- * RetBuffer - a pointer to a buffer structure for the
- * results
+ * PARAMETERS: Node - Device node
+ * RetBuffer - Pointer to a buffer structure for the
+ * results
*
* RETURN: Status
*
@@ -683,21 +633,21 @@ AcpiRsGetPrtMethodData (
ACPI_STATUS
AcpiRsGetCrsMethodData (
- ACPI_HANDLE Handle,
+ ACPI_NAMESPACE_NODE *Node,
ACPI_BUFFER *RetBuffer)
{
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("RsGetCrsMethodData");
+ ACPI_FUNCTION_TRACE (RsGetCrsMethodData);
/* Parameters guaranteed valid by caller */
/* Execute the method, no parameters */
- Status = AcpiUtEvaluateObject (Handle, METHOD_NAME__CRS,
+ Status = AcpiUtEvaluateObject (Node, METHOD_NAME__CRS,
ACPI_BTYPE_BUFFER, &ObjDesc);
if (ACPI_FAILURE (Status))
{
@@ -722,9 +672,9 @@ AcpiRsGetCrsMethodData (
*
* FUNCTION: AcpiRsGetPrsMethodData
*
- * PARAMETERS: Handle - a handle to the containing object
- * RetBuffer - a pointer to a buffer structure for the
- * results
+ * PARAMETERS: Node - Device node
+ * RetBuffer - Pointer to a buffer structure for the
+ * results
*
* RETURN: Status
*
@@ -738,21 +688,21 @@ AcpiRsGetCrsMethodData (
ACPI_STATUS
AcpiRsGetPrsMethodData (
- ACPI_HANDLE Handle,
+ ACPI_NAMESPACE_NODE *Node,
ACPI_BUFFER *RetBuffer)
{
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("RsGetPrsMethodData");
+ ACPI_FUNCTION_TRACE (RsGetPrsMethodData);
/* Parameters guaranteed valid by caller */
/* Execute the method, no parameters */
- Status = AcpiUtEvaluateObject (Handle, METHOD_NAME__PRS,
+ Status = AcpiUtEvaluateObject (Node, METHOD_NAME__PRS,
ACPI_BTYPE_BUFFER, &ObjDesc);
if (ACPI_FAILURE (Status))
{
@@ -777,10 +727,10 @@ AcpiRsGetPrsMethodData (
*
* FUNCTION: AcpiRsGetMethodData
*
- * PARAMETERS: Handle - a handle to the containing object
+ * PARAMETERS: Handle - Handle to the containing object
* Path - Path to method, relative to Handle
- * RetBuffer - a pointer to a buffer structure for the
- * results
+ * RetBuffer - Pointer to a buffer structure for the
+ * results
*
* RETURN: Status
*
@@ -802,7 +752,7 @@ AcpiRsGetMethodData (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("RsGetMethodData");
+ ACPI_FUNCTION_TRACE (RsGetMethodData);
/* Parameters guaranteed valid by caller */
@@ -810,7 +760,8 @@ AcpiRsGetMethodData (
/* Execute the method, no parameters */
Status = AcpiUtEvaluateObject (Handle, Path, ACPI_BTYPE_BUFFER, &ObjDesc);
- if (ACPI_FAILURE (Status)) {
+ if (ACPI_FAILURE (Status))
+ {
return_ACPI_STATUS (Status);
}
@@ -827,13 +778,14 @@ AcpiRsGetMethodData (
return_ACPI_STATUS (Status);
}
+
/*******************************************************************************
*
* FUNCTION: AcpiRsSetSrsMethodData
*
- * PARAMETERS: Handle - a handle to the containing object
- * InBuffer - a pointer to a buffer structure of the
- * parameter
+ * PARAMETERS: Node - Device node
+ * InBuffer - Pointer to a buffer structure of the
+ * parameter
*
* RETURN: Status
*
@@ -843,27 +795,41 @@ AcpiRsGetMethodData (
* If the function fails an appropriate status will be returned
* and the contents of the callers buffer is undefined.
*
+ * Note: Parameters guaranteed valid by caller
+ *
******************************************************************************/
ACPI_STATUS
AcpiRsSetSrsMethodData (
- ACPI_HANDLE Handle,
+ ACPI_NAMESPACE_NODE *Node,
ACPI_BUFFER *InBuffer)
{
- ACPI_PARAMETER_INFO Info;
- ACPI_OPERAND_OBJECT *Params[2];
+ ACPI_EVALUATE_INFO *Info;
+ ACPI_OPERAND_OBJECT *Args[2];
ACPI_STATUS Status;
ACPI_BUFFER Buffer;
- ACPI_FUNCTION_TRACE ("RsSetSrsMethodData");
+ ACPI_FUNCTION_TRACE (RsSetSrsMethodData);
- /* Parameters guaranteed valid by caller */
+ /* Allocate and initialize the evaluation information block */
+
+ Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO));
+ if (!Info)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ Info->PrefixNode = Node;
+ Info->Pathname = METHOD_NAME__SRS;
+ Info->Parameters = Args;
+ Info->ParameterType = ACPI_PARAM_ARGS;
+ Info->Flags = ACPI_IGNORE_RETURN_VALUE;
/*
* The InBuffer parameter will point to a linked list of
- * resource parameters. It needs to be formatted into a
+ * resource parameters. It needs to be formatted into a
* byte stream to be sent in as an input parameter to _SRS
*
* Convert the linked list into a byte stream
@@ -872,45 +838,38 @@ AcpiRsSetSrsMethodData (
Status = AcpiRsCreateAmlResources (InBuffer->Pointer, &Buffer);
if (ACPI_FAILURE (Status))
{
- return_ACPI_STATUS (Status);
+ goto Cleanup;
}
- /* Init the param object */
+ /* Create and initialize the method parameter object */
- Params[0] = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER);
- if (!Params[0])
+ Args[0] = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER);
+ if (!Args[0])
{
- AcpiOsFree (Buffer.Pointer);
- return_ACPI_STATUS (AE_NO_MEMORY);
+ /*
+ * Must free the buffer allocated above (otherwise it is freed
+ * later)
+ */
+ ACPI_FREE (Buffer.Pointer);
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
}
- /* Set up the parameter object */
+ Args[0]->Buffer.Length = (UINT32) Buffer.Length;
+ Args[0]->Buffer.Pointer = Buffer.Pointer;
+ Args[0]->Common.Flags = AOPOBJ_DATA_VALID;
+ Args[1] = NULL;
- Params[0]->Buffer.Length = (UINT32) Buffer.Length;
- Params[0]->Buffer.Pointer = Buffer.Pointer;
- Params[0]->Common.Flags = AOPOBJ_DATA_VALID;
- Params[1] = NULL;
+ /* Execute the method, no return value is expected */
- Info.Node = Handle;
- Info.Parameters = Params;
- Info.ParameterType = ACPI_PARAM_ARGS;
+ Status = AcpiNsEvaluate (Info);
- /* Execute the method, no return value */
-
- Status = AcpiNsEvaluateRelative (METHOD_NAME__SRS, &Info);
- if (ACPI_SUCCESS (Status))
- {
- /* Delete any return object (especially if ImplicitReturn is enabled) */
-
- if (Info.ReturnObject)
- {
- AcpiUtRemoveReference (Info.ReturnObject);
- }
- }
+ /* Clean up and return the status from AcpiNsEvaluate */
- /* Clean up and return the status from AcpiNsEvaluateRelative */
+ AcpiUtRemoveReference (Args[0]);
- AcpiUtRemoveReference (Params[0]);
+Cleanup:
+ ACPI_FREE (Info);
return_ACPI_STATUS (Status);
}
diff --git a/sys/contrib/dev/acpica/rsxface.c b/sys/contrib/dev/acpica/rsxface.c
index 109179e..a27331e 100644
--- a/sys/contrib/dev/acpica/rsxface.c
+++ b/sys/contrib/dev/acpica/rsxface.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rsxface - Public interfaces to the resource manager
- * $Revision: 1.37 $
+ * $Revision: 1.48 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -119,6 +119,7 @@
#include <contrib/dev/acpica/acpi.h>
#include <contrib/dev/acpica/acresrc.h>
+#include <contrib/dev/acpica/acnamesp.h>
#define _COMPONENT ACPI_RESOURCES
ACPI_MODULE_NAME ("rsxface")
@@ -141,19 +142,97 @@
ACPI_COPY_FIELD(Out, In, ResourceSource);
+/* Local prototypes */
+
+static ACPI_STATUS
+AcpiRsMatchVendorResource (
+ ACPI_RESOURCE *Resource,
+ void *Context);
+
+static ACPI_STATUS
+AcpiRsValidateParameters (
+ ACPI_HANDLE DeviceHandle,
+ ACPI_BUFFER *Buffer,
+ ACPI_NAMESPACE_NODE **ReturnNode);
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsValidateParameters
+ *
+ * PARAMETERS: DeviceHandle - Handle to a device
+ * Buffer - Pointer to a data buffer
+ * ReturnNode - Pointer to where the device node is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Common parameter validation for resource interfaces
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiRsValidateParameters (
+ ACPI_HANDLE DeviceHandle,
+ ACPI_BUFFER *Buffer,
+ ACPI_NAMESPACE_NODE **ReturnNode)
+{
+ ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *Node;
+
+
+ ACPI_FUNCTION_TRACE (RsValidateParameters);
+
+
+ /*
+ * Must have a valid handle to an ACPI device
+ */
+ if (!DeviceHandle)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ Node = AcpiNsMapHandleToNode (DeviceHandle);
+ if (!Node)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ if (Node->Type != ACPI_TYPE_DEVICE)
+ {
+ return_ACPI_STATUS (AE_TYPE);
+ }
+
+ /*
+ * Validate the user buffer object
+ *
+ * if there is a non-zero buffer length we also need a valid pointer in
+ * the buffer. If it's a zero buffer length, we'll be returning the
+ * needed buffer size (later), so keep going.
+ */
+ Status = AcpiUtValidateBuffer (Buffer);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ *ReturnNode = Node;
+ return_ACPI_STATUS (AE_OK);
+}
+
+
/*******************************************************************************
*
* FUNCTION: AcpiGetIrqRoutingTable
*
- * PARAMETERS: DeviceHandle - a handle to the Bus device we are querying
- * RetBuffer - a pointer to a buffer to receive the
+ * PARAMETERS: DeviceHandle - Handle to the Bus device we are querying
+ * RetBuffer - Pointer to a buffer to receive the
* current resources for the device
*
* RETURN: Status
*
* DESCRIPTION: This function is called to get the IRQ routing table for a
- * specific bus. The caller must first acquire a handle for the
- * desired bus. The routine table is placed in the buffer pointed
+ * specific bus. The caller must first acquire a handle for the
+ * desired bus. The routine table is placed in the buffer pointed
* to by the RetBuffer variable parameter.
*
* If the function fails an appropriate status will be returned
@@ -170,47 +249,41 @@ AcpiGetIrqRoutingTable (
ACPI_BUFFER *RetBuffer)
{
ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *Node;
- ACPI_FUNCTION_TRACE ("AcpiGetIrqRoutingTable ");
+ ACPI_FUNCTION_TRACE (AcpiGetIrqRoutingTable);
- /*
- * Must have a valid handle and buffer, So we have to have a handle
- * and a return buffer structure, and if there is a non-zero buffer length
- * we also need a valid pointer in the buffer. If it's a zero buffer length,
- * we'll be returning the needed buffer size, so keep going.
- */
- if (!DeviceHandle)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
+ /* Validate parameters then dispatch to internal routine */
- Status = AcpiUtValidateBuffer (RetBuffer);
+ Status = AcpiRsValidateParameters (DeviceHandle, RetBuffer, &Node);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
- Status = AcpiRsGetPrtMethodData (DeviceHandle, RetBuffer);
+ Status = AcpiRsGetPrtMethodData (Node, RetBuffer);
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiGetIrqRoutingTable)
+
/*******************************************************************************
*
* FUNCTION: AcpiGetCurrentResources
*
- * PARAMETERS: DeviceHandle - a handle to the device object for the
+ * PARAMETERS: DeviceHandle - Handle to the device object for the
* device we are querying
- * RetBuffer - a pointer to a buffer to receive the
+ * RetBuffer - Pointer to a buffer to receive the
* current resources for the device
*
* RETURN: Status
*
* DESCRIPTION: This function is called to get the current resources for a
- * specific device. The caller must first acquire a handle for
- * the desired device. The resource data is placed in the buffer
+ * specific device. The caller must first acquire a handle for
+ * the desired device. The resource data is placed in the buffer
* pointed to by the RetBuffer variable parameter.
*
* If the function fails an appropriate status will be returned
@@ -227,47 +300,41 @@ AcpiGetCurrentResources (
ACPI_BUFFER *RetBuffer)
{
ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *Node;
- ACPI_FUNCTION_TRACE ("AcpiGetCurrentResources");
+ ACPI_FUNCTION_TRACE (AcpiGetCurrentResources);
- /*
- * Must have a valid handle and buffer, So we have to have a handle
- * and a return buffer structure, and if there is a non-zero buffer length
- * we also need a valid pointer in the buffer. If it's a zero buffer length,
- * we'll be returning the needed buffer size, so keep going.
- */
- if (!DeviceHandle)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
+ /* Validate parameters then dispatch to internal routine */
- Status = AcpiUtValidateBuffer (RetBuffer);
+ Status = AcpiRsValidateParameters (DeviceHandle, RetBuffer, &Node);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
- Status = AcpiRsGetCrsMethodData (DeviceHandle, RetBuffer);
+ Status = AcpiRsGetCrsMethodData (Node, RetBuffer);
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiGetCurrentResources)
+
/*******************************************************************************
*
* FUNCTION: AcpiGetPossibleResources
*
- * PARAMETERS: DeviceHandle - a handle to the device object for the
+ * PARAMETERS: DeviceHandle - Handle to the device object for the
* device we are querying
- * RetBuffer - a pointer to a buffer to receive the
+ * RetBuffer - Pointer to a buffer to receive the
* resources for the device
*
* RETURN: Status
*
* DESCRIPTION: This function is called to get a list of the possible resources
- * for a specific device. The caller must first acquire a handle
- * for the desired device. The resource data is placed in the
+ * for a specific device. The caller must first acquire a handle
+ * for the desired device. The resource data is placed in the
* buffer pointed to by the RetBuffer variable.
*
* If the function fails an appropriate status will be returned
@@ -281,236 +348,366 @@ AcpiGetPossibleResources (
ACPI_BUFFER *RetBuffer)
{
ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *Node;
- ACPI_FUNCTION_TRACE ("AcpiGetPossibleResources");
+ ACPI_FUNCTION_TRACE (AcpiGetPossibleResources);
- /*
- * Must have a valid handle and buffer, So we have to have a handle
- * and a return buffer structure, and if there is a non-zero buffer length
- * we also need a valid pointer in the buffer. If it's a zero buffer length,
- * we'll be returning the needed buffer size, so keep going.
- */
- if (!DeviceHandle)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
+ /* Validate parameters then dispatch to internal routine */
- Status = AcpiUtValidateBuffer (RetBuffer);
+ Status = AcpiRsValidateParameters (DeviceHandle, RetBuffer, &Node);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
- Status = AcpiRsGetPrsMethodData (DeviceHandle, RetBuffer);
+ Status = AcpiRsGetPrsMethodData (Node, RetBuffer);
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiGetPossibleResources)
+
/*******************************************************************************
*
- * FUNCTION: AcpiWalkResources
+ * FUNCTION: AcpiSetCurrentResources
*
- * PARAMETERS: DeviceHandle - a handle to the device object for the
- * device we are querying
- * Path - method name of the resources we want
- * (METHOD_NAME__CRS or METHOD_NAME__PRS)
- * UserFunction - called for each resource
- * Context - passed to UserFunction
+ * PARAMETERS: DeviceHandle - Handle to the device object for the
+ * device we are setting resources
+ * InBuffer - Pointer to a buffer containing the
+ * resources to be set for the device
*
* RETURN: Status
*
- * DESCRIPTION: Retrieves the current or possible resource list for the
- * specified device. The UserFunction is called once for
- * each resource in the list.
+ * DESCRIPTION: This function is called to set the current resources for a
+ * specific device. The caller must first acquire a handle for
+ * the desired device. The resource data is passed to the routine
+ * the buffer pointed to by the InBuffer variable.
*
******************************************************************************/
ACPI_STATUS
-AcpiWalkResources (
- ACPI_HANDLE DeviceHandle,
- char *Path,
- ACPI_WALK_RESOURCE_CALLBACK UserFunction,
- void *Context)
+AcpiSetCurrentResources (
+ ACPI_HANDLE DeviceHandle,
+ ACPI_BUFFER *InBuffer)
{
- ACPI_STATUS Status;
- ACPI_BUFFER Buffer = {ACPI_ALLOCATE_BUFFER, NULL};
- ACPI_RESOURCE *Resource;
- ACPI_RESOURCE *BufferEnd;
+ ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *Node;
- ACPI_FUNCTION_TRACE ("AcpiWalkResources");
+ ACPI_FUNCTION_TRACE (AcpiSetCurrentResources);
- if (!DeviceHandle ||
- (ACPI_STRNCMP (Path, METHOD_NAME__CRS, sizeof (METHOD_NAME__CRS)) &&
- ACPI_STRNCMP (Path, METHOD_NAME__PRS, sizeof (METHOD_NAME__PRS))))
+ /* Validate the buffer, don't allow zero length */
+
+ if ((!InBuffer) ||
+ (!InBuffer->Pointer) ||
+ (!InBuffer->Length))
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- Status = AcpiRsGetMethodData (DeviceHandle, Path, &Buffer);
+ /* Validate parameters then dispatch to internal routine */
+
+ Status = AcpiRsValidateParameters (DeviceHandle, InBuffer, &Node);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
- /* Setup pointers */
+ Status = AcpiRsSetSrsMethodData (Node, InBuffer);
+ return_ACPI_STATUS (Status);
+}
- Resource = (ACPI_RESOURCE *) Buffer.Pointer;
- BufferEnd = ACPI_CAST_PTR (ACPI_RESOURCE,
- ((UINT8 *) Buffer.Pointer + Buffer.Length));
+ACPI_EXPORT_SYMBOL (AcpiSetCurrentResources)
- /* Walk the resource list */
- for (;;)
+/******************************************************************************
+ *
+ * FUNCTION: AcpiResourceToAddress64
+ *
+ * PARAMETERS: Resource - Pointer to a resource
+ * Out - Pointer to the users's return buffer
+ * (a struct acpi_resource_address64)
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: If the resource is an address16, address32, or address64,
+ * copy it to the address64 return buffer. This saves the
+ * caller from having to duplicate code for different-sized
+ * addresses.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiResourceToAddress64 (
+ ACPI_RESOURCE *Resource,
+ ACPI_RESOURCE_ADDRESS64 *Out)
+{
+ ACPI_RESOURCE_ADDRESS16 *Address16;
+ ACPI_RESOURCE_ADDRESS32 *Address32;
+
+
+ if (!Resource || !Out)
{
- if (!Resource || Resource->Type == ACPI_RESOURCE_TYPE_END_TAG)
- {
- break;
- }
+ return (AE_BAD_PARAMETER);
+ }
- Status = UserFunction (Resource, Context);
+ /* Convert 16 or 32 address descriptor to 64 */
- switch (Status)
- {
- case AE_OK:
- case AE_CTRL_DEPTH:
+ switch (Resource->Type)
+ {
+ case ACPI_RESOURCE_TYPE_ADDRESS16:
+
+ Address16 = (ACPI_RESOURCE_ADDRESS16 *) &Resource->Data;
+ ACPI_COPY_ADDRESS (Out, Address16);
+ break;
- /* Just keep going */
+ case ACPI_RESOURCE_TYPE_ADDRESS32:
- Status = AE_OK;
- break;
+ Address32 = (ACPI_RESOURCE_ADDRESS32 *) &Resource->Data;
+ ACPI_COPY_ADDRESS (Out, Address32);
+ break;
- case AE_CTRL_TERMINATE:
+ case ACPI_RESOURCE_TYPE_ADDRESS64:
- /* Exit now, with OK stats */
+ /* Simple copy for 64 bit source */
- Status = AE_OK;
- goto Cleanup;
+ ACPI_MEMCPY (Out, &Resource->Data, sizeof (ACPI_RESOURCE_ADDRESS64));
+ break;
- default:
+ default:
+ return (AE_BAD_PARAMETER);
+ }
- /* All others are valid exceptions */
+ return (AE_OK);
+}
- goto Cleanup;
- }
+ACPI_EXPORT_SYMBOL (AcpiResourceToAddress64)
- /* Get the next resource descriptor */
- Resource = ACPI_NEXT_RESOURCE (Resource);
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiGetVendorResource
+ *
+ * PARAMETERS: DeviceHandle - Handle for the parent device object
+ * Name - Method name for the parent resource
+ * (METHOD_NAME__CRS or METHOD_NAME__PRS)
+ * Uuid - Pointer to the UUID to be matched.
+ * includes both subtype and 16-byte UUID
+ * RetBuffer - Where the vendor resource is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Walk a resource template for the specified evice to find a
+ * vendor-defined resource that matches the supplied UUID and
+ * UUID subtype. Returns a ACPI_RESOURCE of type Vendor.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiGetVendorResource (
+ ACPI_HANDLE DeviceHandle,
+ char *Name,
+ ACPI_VENDOR_UUID *Uuid,
+ ACPI_BUFFER *RetBuffer)
+{
+ ACPI_VENDOR_WALK_INFO Info;
+ ACPI_STATUS Status;
- /* Check for end-of-buffer */
- if (Resource >= BufferEnd)
- {
- goto Cleanup;
- }
+ /* Other parameters are validated by AcpiWalkResources */
+
+ if (!Uuid || !RetBuffer)
+ {
+ return (AE_BAD_PARAMETER);
}
-Cleanup:
+ Info.Uuid = Uuid;
+ Info.Buffer = RetBuffer;
+ Info.Status = AE_NOT_EXIST;
- AcpiOsFree (Buffer.Pointer);
- return_ACPI_STATUS (Status);
+ /* Walk the _CRS or _PRS resource list for this device */
+
+ Status = AcpiWalkResources (DeviceHandle, Name, AcpiRsMatchVendorResource,
+ &Info);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ return (Info.Status);
}
+ACPI_EXPORT_SYMBOL (AcpiGetVendorResource)
+
/*******************************************************************************
*
- * FUNCTION: AcpiSetCurrentResources
+ * FUNCTION: AcpiRsMatchVendorResource
*
- * PARAMETERS: DeviceHandle - a handle to the device object for the
- * device we are changing the resources of
- * InBuffer - a pointer to a buffer containing the
- * resources to be set for the device
+ * PARAMETERS: ACPI_WALK_RESOURCE_CALLBACK
*
* RETURN: Status
*
- * DESCRIPTION: This function is called to set the current resources for a
- * specific device. The caller must first acquire a handle for
- * the desired device. The resource data is passed to the routine
- * the buffer pointed to by the InBuffer variable.
+ * DESCRIPTION: Match a vendor resource via the ACPI 3.0 UUID
*
******************************************************************************/
-ACPI_STATUS
-AcpiSetCurrentResources (
- ACPI_HANDLE DeviceHandle,
- ACPI_BUFFER *InBuffer)
+static ACPI_STATUS
+AcpiRsMatchVendorResource (
+ ACPI_RESOURCE *Resource,
+ void *Context)
{
- ACPI_STATUS Status;
+ ACPI_VENDOR_WALK_INFO *Info = Context;
+ ACPI_RESOURCE_VENDOR_TYPED *Vendor;
+ ACPI_BUFFER *Buffer;
+ ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("AcpiSetCurrentResources");
+ /* Ignore all descriptors except Vendor */
+ if (Resource->Type != ACPI_RESOURCE_TYPE_VENDOR)
+ {
+ return (AE_OK);
+ }
- /* Must have a valid handle and buffer */
+ Vendor = &Resource->Data.VendorTyped;
- if ((!DeviceHandle) ||
- (!InBuffer) ||
- (!InBuffer->Pointer) ||
- (!InBuffer->Length))
+ /*
+ * For a valid match, these conditions must hold:
+ *
+ * 1) Length of descriptor data must be at least as long as a UUID struct
+ * 2) The UUID subtypes must match
+ * 3) The UUID data must match
+ */
+ if ((Vendor->ByteLength < (ACPI_UUID_LENGTH + 1)) ||
+ (Vendor->UuidSubtype != Info->Uuid->Subtype) ||
+ (ACPI_MEMCMP (Vendor->Uuid, Info->Uuid->Data, ACPI_UUID_LENGTH)))
{
- return_ACPI_STATUS (AE_BAD_PARAMETER);
+ return (AE_OK);
}
- Status = AcpiRsSetSrsMethodData (DeviceHandle, InBuffer);
- return_ACPI_STATUS (Status);
+ /* Validate/Allocate/Clear caller buffer */
+
+ Buffer = Info->Buffer;
+ Status = AcpiUtInitializeBuffer (Buffer, Resource->Length);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ /* Found the correct resource, copy and return it */
+
+ ACPI_MEMCPY (Buffer->Pointer, Resource, Resource->Length);
+ Buffer->Length = Resource->Length;
+
+ /* Found the desired descriptor, terminate resource walk */
+
+ Info->Status = AE_OK;
+ return (AE_CTRL_TERMINATE);
}
-/******************************************************************************
+/*******************************************************************************
*
- * FUNCTION: AcpiResourceToAddress64
+ * FUNCTION: AcpiWalkResources
*
- * PARAMETERS: Resource - Pointer to a resource
- * Out - Pointer to the users's return
- * buffer (a struct
- * acpi_resource_address64)
+ * PARAMETERS: DeviceHandle - Handle to the device object for the
+ * device we are querying
+ * Name - Method name of the resources we want
+ * (METHOD_NAME__CRS or METHOD_NAME__PRS)
+ * UserFunction - Called for each resource
+ * Context - Passed to UserFunction
*
* RETURN: Status
*
- * DESCRIPTION: If the resource is an address16, address32, or address64,
- * copy it to the address64 return buffer. This saves the
- * caller from having to duplicate code for different-sized
- * addresses.
+ * DESCRIPTION: Retrieves the current or possible resource list for the
+ * specified device. The UserFunction is called once for
+ * each resource in the list.
*
******************************************************************************/
ACPI_STATUS
-AcpiResourceToAddress64 (
- ACPI_RESOURCE *Resource,
- ACPI_RESOURCE_ADDRESS64 *Out)
+AcpiWalkResources (
+ ACPI_HANDLE DeviceHandle,
+ char *Name,
+ ACPI_WALK_RESOURCE_CALLBACK UserFunction,
+ void *Context)
{
- ACPI_RESOURCE_ADDRESS16 *Address16;
- ACPI_RESOURCE_ADDRESS32 *Address32;
+ ACPI_STATUS Status;
+ ACPI_BUFFER Buffer;
+ ACPI_RESOURCE *Resource;
+ ACPI_RESOURCE *ResourceEnd;
- switch (Resource->Type)
+ ACPI_FUNCTION_TRACE (AcpiWalkResources);
+
+
+ /* Parameter validation */
+
+ if (!DeviceHandle || !UserFunction || !Name ||
+ (!ACPI_COMPARE_NAME (Name, METHOD_NAME__CRS) &&
+ !ACPI_COMPARE_NAME (Name, METHOD_NAME__PRS)))
{
- case ACPI_RESOURCE_TYPE_ADDRESS16:
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
- Address16 = (ACPI_RESOURCE_ADDRESS16 *) &Resource->Data;
- ACPI_COPY_ADDRESS (Out, Address16);
- break;
+ /* Get the _CRS or _PRS resource list */
- case ACPI_RESOURCE_TYPE_ADDRESS32:
+ Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
+ Status = AcpiRsGetMethodData (DeviceHandle, Name, &Buffer);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
- Address32 = (ACPI_RESOURCE_ADDRESS32 *) &Resource->Data;
- ACPI_COPY_ADDRESS (Out, Address32);
- break;
+ /* Buffer now contains the resource list */
- case ACPI_RESOURCE_TYPE_ADDRESS64:
+ Resource = ACPI_CAST_PTR (ACPI_RESOURCE, Buffer.Pointer);
+ ResourceEnd = ACPI_ADD_PTR (ACPI_RESOURCE, Buffer.Pointer, Buffer.Length);
- /* Simple copy for 64 bit source */
+ /* Walk the resource list until the EndTag is found (or buffer end) */
- ACPI_MEMCPY (Out, &Resource->Data, sizeof (ACPI_RESOURCE_ADDRESS64));
- break;
+ while (Resource < ResourceEnd)
+ {
+ /* Sanity check the resource */
- default:
- return (AE_BAD_PARAMETER);
+ if (Resource->Type > ACPI_RESOURCE_TYPE_MAX)
+ {
+ Status = AE_AML_INVALID_RESOURCE_TYPE;
+ break;
+ }
+
+ /* Invoke the user function, abort on any error returned */
+
+ Status = UserFunction (Resource, Context);
+ if (ACPI_FAILURE (Status))
+ {
+ if (Status == AE_CTRL_TERMINATE)
+ {
+ /* This is an OK termination by the user function */
+
+ Status = AE_OK;
+ }
+ break;
+ }
+
+ /* EndTag indicates end-of-list */
+
+ if (Resource->Type == ACPI_RESOURCE_TYPE_END_TAG)
+ {
+ break;
+ }
+
+ /* Get the next resource descriptor */
+
+ Resource = ACPI_ADD_PTR (ACPI_RESOURCE, Resource, Resource->Length);
}
- return (AE_OK);
+ ACPI_FREE (Buffer.Pointer);
+ return_ACPI_STATUS (Status);
}
+
+ACPI_EXPORT_SYMBOL (AcpiWalkResources)
diff --git a/sys/contrib/dev/acpica/tbfadt.c b/sys/contrib/dev/acpica/tbfadt.c
new file mode 100644
index 0000000..c22cf5e
--- /dev/null
+++ b/sys/contrib/dev/acpica/tbfadt.c
@@ -0,0 +1,520 @@
+/******************************************************************************
+ *
+ * Module Name: tbfadt - FADT table utilities
+ * $Revision: 1.5 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 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 __TBFADT_C__
+
+#include <contrib/dev/acpica/acpi.h>
+#include <contrib/dev/acpica/actables.h>
+
+#define _COMPONENT ACPI_TABLES
+ ACPI_MODULE_NAME ("tbfadt")
+
+/* Local prototypes */
+
+static void inline
+AcpiTbInitGenericAddress (
+ ACPI_GENERIC_ADDRESS *GenericAddress,
+ UINT8 BitWidth,
+ UINT64 Address);
+
+static void
+AcpiTbConvertFadt (
+ void);
+
+static void
+AcpiTbValidateFadt (
+ 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 Length;
+ UINT8 Type;
+
+} ACPI_FADT_INFO;
+
+#define ACPI_FADT_REQUIRED 1
+#define ACPI_FADT_SEPARATE_LENGTH 2
+
+static ACPI_FADT_INFO FadtInfoTable[] =
+{
+ {"Pm1aEventBlock", ACPI_FADT_OFFSET (XPm1aEventBlock),
+ ACPI_FADT_OFFSET (Pm1aEventBlock),
+ ACPI_FADT_OFFSET (Pm1EventLength), ACPI_FADT_REQUIRED},
+
+ {"Pm1bEventBlock", ACPI_FADT_OFFSET (XPm1bEventBlock),
+ ACPI_FADT_OFFSET (Pm1bEventBlock),
+ ACPI_FADT_OFFSET (Pm1EventLength), 0},
+
+ {"Pm1aControlBlock", ACPI_FADT_OFFSET (XPm1aControlBlock),
+ ACPI_FADT_OFFSET (Pm1aControlBlock),
+ ACPI_FADT_OFFSET (Pm1ControlLength), ACPI_FADT_REQUIRED},
+
+ {"Pm1bControlBlock", ACPI_FADT_OFFSET (XPm1bControlBlock),
+ ACPI_FADT_OFFSET (Pm1bControlBlock),
+ ACPI_FADT_OFFSET (Pm1ControlLength), 0},
+
+ {"Pm2ControlBlock", ACPI_FADT_OFFSET (XPm2ControlBlock),
+ ACPI_FADT_OFFSET (Pm2ControlBlock),
+ ACPI_FADT_OFFSET (Pm2ControlLength), ACPI_FADT_SEPARATE_LENGTH},
+
+ {"PmTimerBlock", ACPI_FADT_OFFSET (XPmTimerBlock),
+ ACPI_FADT_OFFSET (PmTimerBlock),
+ ACPI_FADT_OFFSET (PmTimerLength), ACPI_FADT_REQUIRED},
+
+ {"Gpe0Block", ACPI_FADT_OFFSET (XGpe0Block),
+ ACPI_FADT_OFFSET (Gpe0Block),
+ ACPI_FADT_OFFSET (Gpe0BlockLength), ACPI_FADT_SEPARATE_LENGTH},
+
+ {"Gpe1Block", ACPI_FADT_OFFSET (XGpe1Block),
+ ACPI_FADT_OFFSET (Gpe1Block),
+ ACPI_FADT_OFFSET (Gpe1BlockLength), ACPI_FADT_SEPARATE_LENGTH}
+};
+
+#define ACPI_FADT_INFO_ENTRIES (sizeof (FadtInfoTable) / sizeof (ACPI_FADT_INFO))
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbInitGenericAddress
+ *
+ * PARAMETERS: GenericAddress - GAS struct to be initialized
+ * BitWidth - Width of this register
+ * Address - Address of the register
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Initialize a Generic Address Structure (GAS)
+ * See the ACPI specification for a full description and
+ * definition of this structure.
+ *
+ ******************************************************************************/
+
+static void inline
+AcpiTbInitGenericAddress (
+ ACPI_GENERIC_ADDRESS *GenericAddress,
+ UINT8 BitWidth,
+ UINT64 Address)
+{
+
+ /*
+ * The 64-bit Address field is non-aligned in the byte packed
+ * GAS struct.
+ */
+ ACPI_MOVE_64_TO_64 (&GenericAddress->Address, &Address);
+
+ /* All other fields are byte-wide */
+
+ GenericAddress->SpaceId = ACPI_ADR_SPACE_SYSTEM_IO;
+ GenericAddress->BitWidth = BitWidth;
+ GenericAddress->BitOffset = 0;
+ GenericAddress->AccessWidth = 0;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbParseFadt
+ *
+ * PARAMETERS: TableIndex - Index for the FADT
+ * Flags - Flags
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Initialize the FADT, DSDT and FACS tables
+ * (FADT contains the addresses of the DSDT and FACS)
+ *
+ ******************************************************************************/
+
+void
+AcpiTbParseFadt (
+ ACPI_NATIVE_UINT TableIndex,
+ UINT8 Flags)
+{
+ UINT32 Length;
+ ACPI_TABLE_HEADER *Table;
+
+
+ /*
+ * The FADT has multiple versions with different lengths,
+ * and it contains pointers to both the DSDT and FACS tables.
+ *
+ * Get a local copy of the FADT and convert it to a common format
+ * Map entire FADT, assumed to be smaller than one page.
+ */
+ Length = AcpiGbl_RootTableList.Tables[TableIndex].Length;
+
+ Table = AcpiOsMapMemory (
+ AcpiGbl_RootTableList.Tables[TableIndex].Address, Length);
+ if (!Table)
+ {
+ return;
+ }
+
+ /*
+ * Validate the FADT checksum before we copy the table. Ignore
+ * checksum error as we want to try to get the DSDT and FACS.
+ */
+ (void) AcpiTbVerifyChecksum (Table, Length);
+
+ /* Obtain a local copy of the FADT in common ACPI 2.0+ format */
+
+ AcpiTbCreateLocalFadt (Table, Length);
+
+ /* All done with the real FADT, unmap it */
+
+ AcpiOsUnmapMemory (Table, Length);
+
+ /* 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);
+
+ AcpiTbInstallTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XFacs,
+ Flags, ACPI_SIG_FACS, ACPI_TABLE_INDEX_FACS);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbCreateLocalFadt
+ *
+ * PARAMETERS: Table - Pointer to BIOS FADT
+ * Length - Length of the table
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Get a local copy of the FADT and convert it to a common format.
+ * Performs validation on some important FADT fields.
+ *
+ ******************************************************************************/
+
+void
+AcpiTbCreateLocalFadt (
+ ACPI_TABLE_HEADER *Table,
+ UINT32 Length)
+{
+
+ /*
+ * Check if the FADT is larger than what we know about (ACPI 2.0 version).
+ * Truncate the table, but make some noise.
+ */
+ 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%X",
+ Table->Revision, Length, sizeof (ACPI_TABLE_FADT)));
+ }
+
+ /* Copy the entire FADT locally. Zero first for TbConvertFadt */
+
+ ACPI_MEMSET (&AcpiGbl_FADT, 0, 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
+ */
+ AcpiTbConvertFadt ();
+ AcpiTbValidateFadt ();
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbConvertFadt
+ *
+ * PARAMETERS: None, uses AcpiGbl_FADT
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Converts all versions of the FADT to a common internal format.
+ * -> Expand all 32-bit addresses to 64-bit.
+ *
+ * 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.
+ *
+ * "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.
+ *
+ * For ACPI 1.0 FADTs, all address fields are expanded to the corresponding
+ * "X" fields.
+ *
+ * For ACPI 2.0 FADTs, any "X" fields that are NULL are filled in by
+ * expanding the corresponding ACPI 1.0 field.
+ *
+ ******************************************************************************/
+
+static void
+AcpiTbConvertFadt (
+ void)
+{
+ UINT8 Pm1RegisterLength;
+ ACPI_GENERIC_ADDRESS *Target;
+ ACPI_NATIVE_UINT 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 */
+
+ 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 (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++)
+ {
+ 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));
+ }
+ }
+
+ /*
+ * 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.
+ *
+ * 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)
+ */
+ Pm1RegisterLength = (UINT8) ACPI_DIV_2 (AcpiGbl_FADT.Pm1EventLength);
+
+ /* The PM1A register block is required */
+
+ AcpiTbInitGenericAddress (&AcpiGbl_XPm1aEnable, Pm1RegisterLength,
+ (AcpiGbl_FADT.XPm1aEventBlock.Address + Pm1RegisterLength));
+
+ /* The PM1B register block is optional, ignore if not present */
+
+ if (AcpiGbl_FADT.XPm1bEventBlock.Address)
+ {
+ AcpiTbInitGenericAddress (&AcpiGbl_XPm1bEnable, Pm1RegisterLength,
+ (AcpiGbl_FADT.XPm1bEventBlock.Address + Pm1RegisterLength));
+ }
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiTbValidateFadt
+ *
+ * PARAMETERS: Table - Pointer to the FADT to be validated
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Validate various important fields within the FADT. If a problem
+ * is found, issue a message, but no status is returned.
+ * Used by both the table manager and the disassembler.
+ *
+ * Possible additional checks:
+ * (AcpiGbl_FADT.Pm1EventLength >= 4)
+ * (AcpiGbl_FADT.Pm1ControlLength >= 2)
+ * (AcpiGbl_FADT.PmTimerLength >= 4)
+ * Gpe block lengths must be multiple of 2
+ *
+ ******************************************************************************/
+
+static void
+AcpiTbValidateFadt (
+ void)
+{
+ UINT32 *Address32;
+ ACPI_GENERIC_ADDRESS *Address64;
+ UINT8 Length;
+ ACPI_NATIVE_UINT i;
+
+
+ /* 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);
+
+ if (FadtInfoTable[i].Type & ACPI_FADT_REQUIRED)
+ {
+ /*
+ * Field is required (PM1aEvent, PM1aControl, PmTimer).
+ * Both the address and length must be non-zero.
+ */
+ 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));
+ }
+ }
+ 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.
+ */
+ if ((Address64->Address && !Length) || (!Address64->Address && Length))
+ {
+ 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));
+ }
+ }
+
+ /* 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 64X",
+ FadtInfoTable[i].Name, *Address32, ACPI_FORMAT_UINT64 (Address64->Address)));
+ }
+ }
+}
+
diff --git a/sys/contrib/dev/acpica/tbfind.c b/sys/contrib/dev/acpica/tbfind.c
new file mode 100644
index 0000000..be09293
--- /dev/null
+++ b/sys/contrib/dev/acpica/tbfind.c
@@ -0,0 +1,205 @@
+/******************************************************************************
+ *
+ * Module Name: tbfind - find table
+ * $Revision: 1.3 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 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 __TBFIND_C__
+
+#include <contrib/dev/acpica/acpi.h>
+#include <contrib/dev/acpica/actables.h>
+
+#define _COMPONENT ACPI_TABLES
+ ACPI_MODULE_NAME ("tbfind")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbFindTable
+ *
+ * PARAMETERS: Signature - String with ACPI table signature
+ * OemId - String with the table OEM ID
+ * OemTableId - String with the OEM Table ID
+ * TableIndex - Where the table index is returned
+ *
+ * RETURN: Status and table index
+ *
+ * DESCRIPTION: Find an ACPI table (in the RSDT/XSDT) that matches the
+ * Signature, OEM ID and OEM Table ID. Returns an index that can
+ * be used to get the table header or entire table.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiTbFindTable (
+ char *Signature,
+ char *OemId,
+ char *OemTableId,
+ ACPI_NATIVE_UINT *TableIndex)
+{
+ ACPI_NATIVE_UINT i;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE (TbFindTable);
+
+
+ for (i = 0; i < AcpiGbl_RootTableList.Count; ++i)
+ {
+ if (ACPI_MEMCMP (&(AcpiGbl_RootTableList.Tables[i].Signature),
+ Signature, ACPI_NAME_SIZE))
+ {
+ /* Not the requested table */
+
+ continue;
+ }
+
+ /* Table with matching signature has been found */
+
+ if (!AcpiGbl_RootTableList.Tables[i].Pointer)
+ {
+ /* Table is not currently mapped, map it */
+
+ Status = AcpiTbVerifyTable (&AcpiGbl_RootTableList.Tables[i]);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ if (!AcpiGbl_RootTableList.Tables[i].Pointer)
+ {
+ continue;
+ }
+ }
+
+ /* Check for table match on all IDs */
+
+ if (!ACPI_MEMCMP (AcpiGbl_RootTableList.Tables[i].Pointer->Signature,
+ Signature, ACPI_NAME_SIZE) &&
+ (!OemId[0] ||
+ !ACPI_MEMCMP (AcpiGbl_RootTableList.Tables[i].Pointer->OemId,
+ OemId, ACPI_OEM_ID_SIZE)) &&
+ (!OemTableId[0] ||
+ !ACPI_MEMCMP (AcpiGbl_RootTableList.Tables[i].Pointer->OemTableId,
+ OemTableId, ACPI_OEM_TABLE_ID_SIZE)))
+ {
+ *TableIndex = i;
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Found table [%4.4s]\n",
+ Signature));
+ return_ACPI_STATUS (AE_OK);
+ }
+ }
+
+ return_ACPI_STATUS (AE_NOT_FOUND);
+}
diff --git a/sys/contrib/dev/acpica/tbinstal.c b/sys/contrib/dev/acpica/tbinstal.c
index f7bd0db..fa71702 100644
--- a/sys/contrib/dev/acpica/tbinstal.c
+++ b/sys/contrib/dev/acpica/tbinstal.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: tbinstal - ACPI table installation and removal
- * $Revision: 1.80 $
+ * $Revision: 1.91 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -118,139 +118,154 @@
#define __TBINSTAL_C__
#include <contrib/dev/acpica/acpi.h>
+#include <contrib/dev/acpica/acnamesp.h>
#include <contrib/dev/acpica/actables.h>
#define _COMPONENT ACPI_TABLES
ACPI_MODULE_NAME ("tbinstal")
-/* Local prototypes */
-static ACPI_STATUS
-AcpiTbMatchSignature (
- char *Signature,
- ACPI_TABLE_DESC *TableInfo,
- UINT8 SearchType);
-
-
-/*******************************************************************************
+/******************************************************************************
*
- * FUNCTION: AcpiTbMatchSignature
+ * FUNCTION: AcpiTbVerifyTable
*
- * PARAMETERS: Signature - Table signature to match
- * TableInfo - Return data
- * SearchType - Table type to match (primary/secondary)
+ * PARAMETERS: TableDesc - table
*
* RETURN: Status
*
- * DESCRIPTION: Compare signature against the list of "ACPI-subsystem-owned"
- * tables (DSDT/FADT/SSDT, etc.) Returns the TableTypeID on match.
+ * DESCRIPTION: this function is called to verify and map table
*
- ******************************************************************************/
+ *****************************************************************************/
-static ACPI_STATUS
-AcpiTbMatchSignature (
- char *Signature,
- ACPI_TABLE_DESC *TableInfo,
- UINT8 SearchType)
+ACPI_STATUS
+AcpiTbVerifyTable (
+ ACPI_TABLE_DESC *TableDesc)
{
- ACPI_NATIVE_UINT i;
+ ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE ("TbMatchSignature");
+ ACPI_FUNCTION_TRACE (TbVerifyTable);
- /* Search for a signature match among the known table types */
+ /* Map the table if necessary */
- for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++)
+ if (!TableDesc->Pointer)
{
- if (!(AcpiGbl_TableData[i].Flags & SearchType))
+ if ((TableDesc->Flags & ACPI_TABLE_ORIGIN_MASK) ==
+ ACPI_TABLE_ORIGIN_MAPPED)
{
- continue;
+ TableDesc->Pointer = AcpiOsMapMemory (TableDesc->Address, TableDesc->Length);
}
- if (!ACPI_STRNCMP (Signature, AcpiGbl_TableData[i].Signature,
- AcpiGbl_TableData[i].SigLength))
+ if (!TableDesc->Pointer)
{
- /* Found a signature match, return index if requested */
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+ }
- if (TableInfo)
- {
- TableInfo->Type = (UINT8) i;
- }
+ /* FACS is the odd table, has no standard ACPI header and no checksum */
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Table [%4.4s] is an ACPI table consumed by the core subsystem\n",
- (char *) AcpiGbl_TableData[i].Signature));
+ if (!ACPI_COMPARE_NAME (&TableDesc->Signature, ACPI_SIG_FACS))
+ {
+ /* Always calculate checksum, ignore bad checksum if requested */
- return_ACPI_STATUS (AE_OK);
- }
+ Status = AcpiTbVerifyChecksum (TableDesc->Pointer, TableDesc->Length);
}
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Table [%4.4s] is not an ACPI table consumed by the core subsystem - ignored\n",
- (char *) Signature));
-
- return_ACPI_STATUS (AE_TABLE_NOT_SUPPORTED);
+ return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
- * FUNCTION: AcpiTbInstallTable
+ * FUNCTION: AcpiTbAddTable
*
- * PARAMETERS: TableInfo - Return value from AcpiTbGetTableBody
+ * PARAMETERS: TableDesc - Table descriptor
+ * TableIndex - Where the table index is returned
*
* RETURN: Status
*
- * DESCRIPTION: Install the table into the global data structures.
+ * DESCRIPTION: This function is called to add the ACPI table
*
******************************************************************************/
ACPI_STATUS
-AcpiTbInstallTable (
- ACPI_TABLE_DESC *TableInfo)
+AcpiTbAddTable (
+ ACPI_TABLE_DESC *TableDesc,
+ ACPI_NATIVE_UINT *TableIndex)
{
- ACPI_STATUS Status;
-
+ ACPI_NATIVE_UINT i;
+ ACPI_NATIVE_UINT Length;
+ ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE ("TbInstallTable");
+ ACPI_FUNCTION_TRACE (TbAddTable);
- /* Lock tables while installing */
- Status = AcpiUtAcquireMutex (ACPI_MTX_TABLES);
- if (ACPI_FAILURE (Status))
+ if (!TableDesc->Pointer)
{
- ACPI_REPORT_ERROR (("Could not acquire table mutex, %s\n",
- AcpiFormatException (Status)));
- return_ACPI_STATUS (Status);
+ Status = AcpiTbVerifyTable (TableDesc);
+ if (ACPI_FAILURE (Status) || !TableDesc->Pointer)
+ {
+ return_ACPI_STATUS (Status);
+ }
}
- /*
- * Ignore a table that is already installed. For example, some BIOS
- * ASL code will repeatedly attempt to load the same SSDT.
- */
- Status = AcpiTbIsTableInstalled (TableInfo);
- if (ACPI_FAILURE (Status))
+ /* 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)))
{
- goto UnlockAndExit;
+ ACPI_ERROR ((AE_INFO,
+ "Table has invalid signature [%4.4s], must be SSDT or PSDT",
+ TableDesc->Pointer->Signature));
+ return_ACPI_STATUS (AE_BAD_SIGNATURE);
}
- /* Install the table into the global data structure */
+ (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
- Status = AcpiTbInitTableDescriptor (TableInfo->Type, TableInfo);
- if (ACPI_FAILURE (Status))
+ /* Check if table is already registered */
+
+ for (i = 0; i < AcpiGbl_RootTableList.Count; ++i)
{
- ACPI_REPORT_ERROR (("Could not install table [%4.4s], %s\n",
- TableInfo->Pointer->Signature, AcpiFormatException (Status)));
+ if (!AcpiGbl_RootTableList.Tables[i].Pointer)
+ {
+ Status = AcpiTbVerifyTable (&AcpiGbl_RootTableList.Tables[i]);
+ 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))
+ {
+ continue;
+ }
+
+ /* Table is already registered */
+
+ AcpiTbDeleteTable (TableDesc);
+ *TableIndex = i;
+ goto Release;
}
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s located at %p\n",
- AcpiGbl_TableData[TableInfo->Type].Name, TableInfo->Pointer));
+ /*
+ * Add the table to the global table list
+ */
+ Status = AcpiTbStoreTable (TableDesc->Address, TableDesc->Pointer,
+ TableDesc->Length, TableDesc->Flags, TableIndex);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Release;
+ }
+ AcpiTbPrintTableHeader (TableDesc->Address, TableDesc->Pointer);
-UnlockAndExit:
+Release:
(void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
return_ACPI_STATUS (Status);
}
@@ -258,429 +273,412 @@ UnlockAndExit:
/*******************************************************************************
*
- * FUNCTION: AcpiTbRecognizeTable
+ * FUNCTION: AcpiTbResizeRootTableList
*
- * PARAMETERS: TableInfo - Return value from AcpiTbGetTableBody
- * SearchType - Table type to match (primary/secondary)
+ * PARAMETERS: None
*
* RETURN: Status
*
- * DESCRIPTION: Check a table signature for a match against known table types
- *
- * NOTE: All table pointers are validated as follows:
- * 1) Table pointer must point to valid physical memory
- * 2) Signature must be 4 ASCII chars, even if we don't recognize the
- * name
- * 3) Table must be readable for length specified in the header
- * 4) Table checksum must be valid (with the exception of the FACS
- * which has no checksum for some odd reason)
+ * DESCRIPTION: Expand the size of global table array
*
******************************************************************************/
ACPI_STATUS
-AcpiTbRecognizeTable (
- ACPI_TABLE_DESC *TableInfo,
- UINT8 SearchType)
+AcpiTbResizeRootTableList (
+ void)
{
- ACPI_TABLE_HEADER *TableHeader;
- ACPI_STATUS Status;
+ ACPI_TABLE_DESC *Tables;
- ACPI_FUNCTION_TRACE ("TbRecognizeTable");
+ ACPI_FUNCTION_TRACE (TbResizeRootTableList);
- /* Ensure that we have a valid table pointer */
+ /* AllowResize flag is a parameter to AcpiInitializeTables */
- TableHeader = (ACPI_TABLE_HEADER *) TableInfo->Pointer;
- if (!TableHeader)
+ if (!(AcpiGbl_RootTableList.Flags & ACPI_ROOT_ALLOW_RESIZE))
{
- return_ACPI_STATUS (AE_BAD_PARAMETER);
+ ACPI_ERROR ((AE_INFO, "Resize of Root Table Array is not allowed"));
+ return_ACPI_STATUS (AE_SUPPORT);
}
- /*
- * We only "recognize" a limited number of ACPI tables -- namely, the
- * ones that are used by the subsystem (DSDT, FADT, etc.)
- *
- * An AE_TABLE_NOT_SUPPORTED means that the table was not recognized.
- * This can be any one of many valid ACPI tables, it just isn't one of
- * the tables that is consumed by the core subsystem
- */
- Status = AcpiTbMatchSignature (TableHeader->Signature,
- TableInfo, SearchType);
- if (ACPI_FAILURE (Status))
+ /* Increase the Table Array size */
+
+ Tables = ACPI_ALLOCATE_ZEROED (
+ (AcpiGbl_RootTableList.Size + ACPI_ROOT_TABLE_SIZE_INCREMENT)
+ * sizeof (ACPI_TABLE_DESC));
+ if (!Tables)
{
- return_ACPI_STATUS (Status);
+ ACPI_ERROR ((AE_INFO, "Could not allocate new root table array"));
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
- Status = AcpiTbValidateTableHeader (TableHeader);
- if (ACPI_FAILURE (Status))
+ /* Copy and free the previous table array */
+
+ if (AcpiGbl_RootTableList.Tables)
{
- return_ACPI_STATUS (Status);
- }
+ ACPI_MEMCPY (Tables, AcpiGbl_RootTableList.Tables,
+ AcpiGbl_RootTableList.Size * sizeof (ACPI_TABLE_DESC));
- /* Return the table type and length via the info struct */
+ if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED)
+ {
+ ACPI_FREE (AcpiGbl_RootTableList.Tables);
+ }
+ }
- TableInfo->Length = (ACPI_SIZE) TableHeader->Length;
+ AcpiGbl_RootTableList.Tables = Tables;
+ AcpiGbl_RootTableList.Size += ACPI_ROOT_TABLE_SIZE_INCREMENT;
+ AcpiGbl_RootTableList.Flags |= (UINT8) ACPI_ROOT_ORIGIN_ALLOCATED;
- return_ACPI_STATUS (Status);
+ return_ACPI_STATUS (AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: AcpiTbInitTableDescriptor
+ * FUNCTION: AcpiTbStoreTable
*
- * PARAMETERS: TableType - The type of the table
- * TableInfo - A table info struct
+ * PARAMETERS: Address - Table address
+ * Table - Table header
+ * Length - Table length
+ * Flags - flags
*
- * RETURN: None.
+ * RETURN: Status and table index.
*
- * DESCRIPTION: Install a table into the global data structs.
+ * DESCRIPTION: Add an ACPI table to the global table list
*
******************************************************************************/
ACPI_STATUS
-AcpiTbInitTableDescriptor (
- ACPI_TABLE_TYPE TableType,
- ACPI_TABLE_DESC *TableInfo)
+AcpiTbStoreTable (
+ ACPI_PHYSICAL_ADDRESS Address,
+ ACPI_TABLE_HEADER *Table,
+ UINT32 Length,
+ UINT8 Flags,
+ ACPI_NATIVE_UINT *TableIndex)
{
- ACPI_TABLE_LIST *ListHead;
- ACPI_TABLE_DESC *TableDesc;
- ACPI_STATUS Status;
-
-
- ACPI_FUNCTION_TRACE_U32 ("TbInitTableDescriptor", TableType);
+ ACPI_STATUS Status = AE_OK;
- /* Allocate a descriptor for this table */
+ /* Ensure that there is room for the table in the Root Table List */
- TableDesc = ACPI_MEM_CALLOCATE (sizeof (ACPI_TABLE_DESC));
- if (!TableDesc)
+ if (AcpiGbl_RootTableList.Count >= AcpiGbl_RootTableList.Size)
{
- return_ACPI_STATUS (AE_NO_MEMORY);
+ Status = AcpiTbResizeRootTableList();
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
}
- /* Get a new owner ID for the table */
-
- Status = AcpiUtAllocateOwnerId (&TableDesc->OwnerId);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
+ /* Initialize added table */
- /* Install the table into the global data structure */
+ AcpiGbl_RootTableList.Tables[AcpiGbl_RootTableList.Count].Address = Address;
+ AcpiGbl_RootTableList.Tables[AcpiGbl_RootTableList.Count].Pointer = Table;
+ AcpiGbl_RootTableList.Tables[AcpiGbl_RootTableList.Count].Length = Length;
+ AcpiGbl_RootTableList.Tables[AcpiGbl_RootTableList.Count].OwnerId = 0;
+ AcpiGbl_RootTableList.Tables[AcpiGbl_RootTableList.Count].Flags = Flags;
- ListHead = &AcpiGbl_TableLists[TableType];
+ ACPI_MOVE_32_TO_32 (
+ &(AcpiGbl_RootTableList.Tables[AcpiGbl_RootTableList.Count].Signature),
+ Table->Signature);
- /*
- * Two major types of tables: 1) Only one instance is allowed. This
- * includes most ACPI tables such as the DSDT. 2) Multiple instances of
- * the table are allowed. This includes SSDT and PSDTs.
- */
- if (ACPI_IS_SINGLE_TABLE (AcpiGbl_TableData[TableType].Flags))
- {
- /*
- * Only one table allowed, and a table has alread been installed
- * at this location, so return an error.
- */
- if (ListHead->Next)
- {
- ACPI_MEM_FREE (TableDesc);
- return_ACPI_STATUS (AE_ALREADY_EXISTS);
- }
+ *TableIndex = AcpiGbl_RootTableList.Count;
+ AcpiGbl_RootTableList.Count++;
+ return (Status);
+}
- TableDesc->Next = ListHead->Next;
- ListHead->Next = TableDesc;
- if (TableDesc->Next)
- {
- TableDesc->Next->Prev = TableDesc;
- }
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbDeleteTable
+ *
+ * PARAMETERS: TableIndex - Table index
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Delete one internal ACPI table
+ *
+ ******************************************************************************/
- ListHead->Count++;
- }
- else
- {
- /*
- * Link the new table in to the list of tables of this type.
- * Insert at the end of the list, order IS IMPORTANT.
- *
- * TableDesc->Prev & Next are already NULL from calloc()
- */
- ListHead->Count++;
-
- if (!ListHead->Next)
- {
- ListHead->Next = TableDesc;
- }
- else
- {
- TableDesc->Next = ListHead->Next;
+void
+AcpiTbDeleteTable (
+ ACPI_TABLE_DESC *TableDesc)
+{
- while (TableDesc->Next->Next)
- {
- TableDesc->Next = TableDesc->Next->Next;
- }
+ /* Table must be mapped or allocated */
- TableDesc->Next->Next = TableDesc;
- TableDesc->Prev = TableDesc->Next;
- TableDesc->Next = NULL;
- }
+ if (!TableDesc->Pointer)
+ {
+ return;
}
- /* Finish initialization of the table descriptor */
-
- TableDesc->Type = (UINT8) TableType;
- TableDesc->Pointer = TableInfo->Pointer;
- TableDesc->Length = TableInfo->Length;
- TableDesc->Allocation = TableInfo->Allocation;
- TableDesc->AmlStart = (UINT8 *) (TableDesc->Pointer + 1),
- TableDesc->AmlLength = (UINT32) (TableDesc->Length -
- (UINT32) sizeof (ACPI_TABLE_HEADER));
- TableDesc->LoadedIntoNamespace = FALSE;
-
- /*
- * Set the appropriate global pointer (if there is one) to point to the
- * newly installed table
- */
- if (AcpiGbl_TableData[TableType].GlobalPtr)
+ switch (TableDesc->Flags & ACPI_TABLE_ORIGIN_MASK)
{
- *(AcpiGbl_TableData[TableType].GlobalPtr) = TableInfo->Pointer;
- }
+ case ACPI_TABLE_ORIGIN_MAPPED:
+ AcpiOsUnmapMemory (TableDesc->Pointer, TableDesc->Length);
+ break;
- /* Return Data */
+ case ACPI_TABLE_ORIGIN_ALLOCATED:
+ ACPI_FREE (TableDesc->Pointer);
+ break;
- TableInfo->OwnerId = TableDesc->OwnerId;
- TableInfo->InstalledDesc = TableDesc;
+ default:
+ break;
+ }
- return_ACPI_STATUS (AE_OK);
+ TableDesc->Pointer = NULL;
}
/*******************************************************************************
*
- * FUNCTION: AcpiTbDeleteAllTables
+ * FUNCTION: AcpiTbTerminate
*
- * PARAMETERS: None.
+ * PARAMETERS: None
*
- * RETURN: None.
+ * RETURN: None
*
* DESCRIPTION: Delete all internal ACPI tables
*
******************************************************************************/
void
-AcpiTbDeleteAllTables (
+AcpiTbTerminate (
void)
{
- ACPI_TABLE_TYPE Type;
+ ACPI_NATIVE_UINT i;
+
+
+ ACPI_FUNCTION_TRACE (TbTerminate);
+
+ (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
+
+ /* Delete the individual tables */
+
+ for (i = 0; i < AcpiGbl_RootTableList.Count; i++)
+ {
+ AcpiTbDeleteTable (&AcpiGbl_RootTableList.Tables[i]);
+ }
/*
- * Free memory allocated for ACPI tables
- * Memory can either be mapped or allocated
+ * Delete the root table array if allocated locally. Array cannot be
+ * mapped, so we don't need to check for that flag.
*/
- for (Type = 0; Type < NUM_ACPI_TABLE_TYPES; Type++)
+ if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED)
{
- AcpiTbDeleteTablesByType (Type);
+ ACPI_FREE (AcpiGbl_RootTableList.Tables);
}
+
+ AcpiGbl_RootTableList.Tables = NULL;
+ AcpiGbl_RootTableList.Flags = 0;
+ AcpiGbl_RootTableList.Count = 0;
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ACPI Tables freed\n"));
+ (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
}
/*******************************************************************************
*
- * FUNCTION: AcpiTbDeleteTablesByType
+ * FUNCTION: AcpiTbDeleteNamespaceByOwner
*
- * PARAMETERS: Type - The table type to be deleted
+ * PARAMETERS: TableIndex - Table index
*
- * RETURN: None.
+ * RETURN: None
*
- * DESCRIPTION: Delete an internal ACPI table
- * Locks the ACPI table mutex
+ * DESCRIPTION: Delete all namespace objects created when this table was loaded.
*
******************************************************************************/
void
-AcpiTbDeleteTablesByType (
- ACPI_TABLE_TYPE Type)
+AcpiTbDeleteNamespaceByOwner (
+ ACPI_NATIVE_UINT TableIndex)
{
- ACPI_TABLE_DESC *TableDesc;
- UINT32 Count;
- UINT32 i;
+ ACPI_OWNER_ID OwnerId;
- ACPI_FUNCTION_TRACE_U32 ("TbDeleteTablesByType", Type);
-
-
- if (Type > ACPI_TABLE_MAX)
+ (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
+ if (TableIndex < AcpiGbl_RootTableList.Count)
{
- return_VOID;
+ OwnerId = AcpiGbl_RootTableList.Tables[TableIndex].OwnerId;
}
-
- if (ACPI_FAILURE (AcpiUtAcquireMutex (ACPI_MTX_TABLES)))
+ else
{
+ (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
return;
}
- /* Clear the appropriate "typed" global table pointer */
-
- switch (Type)
- {
- case ACPI_TABLE_RSDP:
- AcpiGbl_RSDP = NULL;
- break;
+ (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
+ AcpiNsDeleteNamespaceByOwner (OwnerId);
+}
- case ACPI_TABLE_DSDT:
- AcpiGbl_DSDT = NULL;
- break;
- case ACPI_TABLE_FADT:
- AcpiGbl_FADT = NULL;
- break;
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbAllocateOwnerId
+ *
+ * PARAMETERS: TableIndex - Table index
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Allocates OwnerId in TableDesc
+ *
+ ******************************************************************************/
- case ACPI_TABLE_FACS:
- AcpiGbl_FACS = NULL;
- break;
+ACPI_STATUS
+AcpiTbAllocateOwnerId (
+ ACPI_NATIVE_UINT TableIndex)
+{
+ ACPI_STATUS Status = AE_BAD_PARAMETER;
- case ACPI_TABLE_XSDT:
- AcpiGbl_XSDT = NULL;
- break;
- case ACPI_TABLE_SSDT:
- case ACPI_TABLE_PSDT:
- default:
- break;
- }
+ ACPI_FUNCTION_TRACE (TbAllocateOwnerId);
- /*
- * Free the table
- * 1) Get the head of the list
- */
- TableDesc = AcpiGbl_TableLists[Type].Next;
- Count = AcpiGbl_TableLists[Type].Count;
- /*
- * 2) Walk the entire list, deleting both the allocated tables
- * and the table descriptors
- */
- for (i = 0; i < Count; i++)
+ (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
+ if (TableIndex < AcpiGbl_RootTableList.Count)
{
- TableDesc = AcpiTbUninstallTable (TableDesc);
+ Status = AcpiUtAllocateOwnerId
+ (&(AcpiGbl_RootTableList.Tables[TableIndex].OwnerId));
}
(void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
- return_VOID;
+ return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
- * FUNCTION: AcpiTbDeleteSingleTable
+ * FUNCTION: AcpiTbReleaseOwnerId
*
- * PARAMETERS: TableInfo - A table info struct
+ * PARAMETERS: TableIndex - Table index
*
- * RETURN: None.
+ * RETURN: Status
*
- * DESCRIPTION: Low-level free for a single ACPI table. Handles cases where
- * the table was allocated a buffer or was mapped.
+ * DESCRIPTION: Releases OwnerId in TableDesc
*
******************************************************************************/
-void
-AcpiTbDeleteSingleTable (
- ACPI_TABLE_DESC *TableDesc)
+ACPI_STATUS
+AcpiTbReleaseOwnerId (
+ ACPI_NATIVE_UINT TableIndex)
{
+ ACPI_STATUS Status = AE_BAD_PARAMETER;
- /* Must have a valid table descriptor and pointer */
- if ((!TableDesc) ||
- (!TableDesc->Pointer))
- {
- return;
- }
+ ACPI_FUNCTION_TRACE (TbReleaseOwnerId);
- /* Valid table, determine type of memory allocation */
- switch (TableDesc->Allocation)
+ (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
+ if (TableIndex < AcpiGbl_RootTableList.Count)
{
- case ACPI_MEM_NOT_ALLOCATED:
- break;
-
- case ACPI_MEM_ALLOCATED:
-
- ACPI_MEM_FREE (TableDesc->Pointer);
- break;
-
- case ACPI_MEM_MAPPED:
-
- AcpiOsUnmapMemory (TableDesc->Pointer, TableDesc->Length);
- break;
-
- default:
- break;
+ AcpiUtReleaseOwnerId (&(AcpiGbl_RootTableList.Tables[TableIndex].OwnerId));
+ Status = AE_OK;
}
+
+ (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
+ return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
- * FUNCTION: AcpiTbUninstallTable
+ * FUNCTION: AcpiTbGetOwnerId
*
- * PARAMETERS: TableInfo - A table info struct
+ * PARAMETERS: TableIndex - Table index
+ * OwnerId - Where the table OwnerId is returned
*
- * RETURN: Pointer to the next table in the list (of same type)
+ * RETURN: Status
*
- * DESCRIPTION: Free the memory associated with an internal ACPI table that
- * is either installed or has never been installed.
- * Table mutex should be locked.
+ * DESCRIPTION: returns OwnerId for the ACPI table
*
******************************************************************************/
-ACPI_TABLE_DESC *
-AcpiTbUninstallTable (
- ACPI_TABLE_DESC *TableDesc)
+ACPI_STATUS
+AcpiTbGetOwnerId (
+ ACPI_NATIVE_UINT TableIndex,
+ ACPI_OWNER_ID *OwnerId)
{
- ACPI_TABLE_DESC *NextDesc;
+ ACPI_STATUS Status = AE_BAD_PARAMETER;
- ACPI_FUNCTION_TRACE_PTR ("TbUninstallTable", TableDesc);
+ ACPI_FUNCTION_TRACE (TbGetOwnerId);
- if (!TableDesc)
+ (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
+ if (TableIndex < AcpiGbl_RootTableList.Count)
{
- return_PTR (NULL);
+ *OwnerId = AcpiGbl_RootTableList.Tables[TableIndex].OwnerId;
+ Status = AE_OK;
}
- /* Unlink the descriptor from the doubly linked list */
+ (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
+ return_ACPI_STATUS (Status);
+}
- if (TableDesc->Prev)
- {
- TableDesc->Prev->Next = TableDesc->Next;
- }
- else
- {
- /* Is first on list, update list head */
- AcpiGbl_TableLists[TableDesc->Type].Next = TableDesc->Next;
- }
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbIsTableLoaded
+ *
+ * PARAMETERS: TableIndex - Table index
+ *
+ * RETURN: Table Loaded Flag
+ *
+ ******************************************************************************/
- if (TableDesc->Next)
+BOOLEAN
+AcpiTbIsTableLoaded (
+ ACPI_NATIVE_UINT TableIndex)
+{
+ BOOLEAN IsLoaded = FALSE;
+
+
+ (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
+ if (TableIndex < AcpiGbl_RootTableList.Count)
{
- TableDesc->Next->Prev = TableDesc->Prev;
+ IsLoaded = (BOOLEAN)
+ (AcpiGbl_RootTableList.Tables[TableIndex].Flags & ACPI_TABLE_IS_LOADED);
}
- /* Free the memory allocated for the table itself */
+ (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
+ return (IsLoaded);
+}
- AcpiTbDeleteSingleTable (TableDesc);
- /* Free the table descriptor */
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbSetTableLoadedFlag
+ *
+ * PARAMETERS: TableIndex - Table index
+ * IsLoaded - TRUE if table is loaded, FALSE otherwise
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Sets the table loaded flag to either TRUE or FALSE.
+ *
+ ******************************************************************************/
- NextDesc = TableDesc->Next;
- ACPI_MEM_FREE (TableDesc);
+void
+AcpiTbSetTableLoadedFlag (
+ ACPI_NATIVE_UINT TableIndex,
+ BOOLEAN IsLoaded)
+{
- /* Return pointer to the next descriptor */
+ (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
+ if (TableIndex < AcpiGbl_RootTableList.Count)
+ {
+ if (IsLoaded)
+ {
+ AcpiGbl_RootTableList.Tables[TableIndex].Flags |= ACPI_TABLE_IS_LOADED;
+ }
+ else
+ {
+ AcpiGbl_RootTableList.Tables[TableIndex].Flags &= ~ACPI_TABLE_IS_LOADED;
+ }
+ }
- return_PTR (NextDesc);
+ (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
}
-
diff --git a/sys/contrib/dev/acpica/tbutils.c b/sys/contrib/dev/acpica/tbutils.c
index 3429ebf..5b64e20 100644
--- a/sys/contrib/dev/acpica/tbutils.c
+++ b/sys/contrib/dev/acpica/tbutils.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
- * Module Name: tbutils - Table manipulation utilities
- * $Revision: 1.71 $
+ * Module Name: tbutils - table utilities
+ * $Revision: 1.88 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -119,289 +119,476 @@
#include <contrib/dev/acpica/acpi.h>
#include <contrib/dev/acpica/actables.h>
-
#define _COMPONENT ACPI_TABLES
ACPI_MODULE_NAME ("tbutils")
/* Local prototypes */
-#ifdef ACPI_OBSOLETE_FUNCTIONS
-ACPI_STATUS
-AcpiTbHandleToObject (
- UINT16 TableId,
- ACPI_TABLE_DESC **TableDesc);
-#endif
+static ACPI_PHYSICAL_ADDRESS
+AcpiTbGetRootTableEntry (
+ UINT8 *TableEntry,
+ ACPI_NATIVE_UINT TableEntrySize);
/*******************************************************************************
*
- * FUNCTION: AcpiTbIsTableInstalled
+ * FUNCTION: AcpiTbTablesLoaded
*
- * PARAMETERS: NewTableDesc - Descriptor for new table being installed
+ * PARAMETERS: None
*
- * RETURN: Status - AE_ALREADY_EXISTS if the table is already installed
+ * RETURN: TRUE if required ACPI tables are loaded
*
- * DESCRIPTION: Determine if an ACPI table is already installed
- *
- * MUTEX: Table data structures should be locked
+ * DESCRIPTION: Determine if the minimum required ACPI tables are present
+ * (FADT, FACS, DSDT)
*
******************************************************************************/
-ACPI_STATUS
-AcpiTbIsTableInstalled (
- ACPI_TABLE_DESC *NewTableDesc)
+BOOLEAN
+AcpiTbTablesLoaded (
+ void)
{
- ACPI_TABLE_DESC *TableDesc;
+ if (AcpiGbl_RootTableList.Count >= 3)
+ {
+ return (TRUE);
+ }
- ACPI_FUNCTION_TRACE ("TbIsTableInstalled");
-
+ return (FALSE);
+}
- /* Get the list descriptor and first table descriptor */
- TableDesc = AcpiGbl_TableLists[NewTableDesc->Type].Next;
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbPrintTableHeader
+ *
+ * PARAMETERS: Address - Table physical address
+ * Header - Table header
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Print an ACPI table header. Special cases for FACS and RSDP.
+ *
+ ******************************************************************************/
- /* Examine all installed tables of this type */
+void
+AcpiTbPrintTableHeader (
+ ACPI_PHYSICAL_ADDRESS Address,
+ ACPI_TABLE_HEADER *Header)
+{
- while (TableDesc)
+ if (ACPI_COMPARE_NAME (Header->Signature, ACPI_SIG_FACS))
{
- /*
- * If the table lengths match, perform a full bytewise compare. This
- * means that we will allow tables with duplicate OemTableId(s), as
- * long as the tables are different in some way.
- *
- * Checking if the table has been loaded into the namespace means that
- * we don't check for duplicate tables during the initial installation
- * of tables within the RSDT/XSDT.
- */
- if ((TableDesc->LoadedIntoNamespace) &&
- (TableDesc->Pointer->Length == NewTableDesc->Pointer->Length) &&
- (!ACPI_MEMCMP (TableDesc->Pointer, NewTableDesc->Pointer,
- NewTableDesc->Pointer->Length)))
- {
- /* Match: this table is already installed */
-
- ACPI_DEBUG_PRINT ((ACPI_DB_TABLES,
- "Table [%4.4s] already installed: Rev %X OemTableId [%8.8s]\n",
- NewTableDesc->Pointer->Signature,
- NewTableDesc->Pointer->Revision,
- NewTableDesc->Pointer->OemTableId));
-
- NewTableDesc->OwnerId = TableDesc->OwnerId;
- NewTableDesc->InstalledDesc = TableDesc;
-
- return_ACPI_STATUS (AE_ALREADY_EXISTS);
- }
-
- /* Get next table on the list */
+ /* FACS only has signature and length fields of common table header */
- TableDesc = TableDesc->Next;
+ ACPI_INFO ((AE_INFO, "%4.4s @ 0x%p/0x%04X",
+ 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_CAST_PTR (void, Address),
+ (ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->Revision > 0) ?
+ ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->Length : 20,
+ ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->Revision,
+ ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->OemId));
+ }
+ else
+ {
+ /* 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)",
+ Header->Signature, ACPI_CAST_PTR (void, Address),
+ Header->Length, Header->Revision, Header->OemId,
+ Header->OemTableId, Header->OemRevision, Header->AslCompilerId,
+ Header->AslCompilerRevision));
}
-
- return_ACPI_STATUS (AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: AcpiTbValidateTableHeader
+ * FUNCTION: AcpiTbValidateChecksum
*
- * PARAMETERS: TableHeader - Logical pointer to the table
+ * PARAMETERS: Table - ACPI table to verify
+ * Length - Length of entire table
*
* RETURN: Status
*
- * DESCRIPTION: Check an ACPI table header for validity
- *
- * NOTE: Table pointers are validated as follows:
- * 1) Table pointer must point to valid physical memory
- * 2) Signature must be 4 ASCII chars, even if we don't recognize the
- * name
- * 3) Table must be readable for length specified in the header
- * 4) Table checksum must be valid (with the exception of the FACS
- * which has no checksum because it contains variable fields)
+ * DESCRIPTION: Verifies that the table checksums to zero. Optionally returns
+ * exception on bad checksum.
*
******************************************************************************/
ACPI_STATUS
-AcpiTbValidateTableHeader (
- ACPI_TABLE_HEADER *TableHeader)
+AcpiTbVerifyChecksum (
+ ACPI_TABLE_HEADER *Table,
+ UINT32 Length)
{
- ACPI_NAME Signature;
+ UINT8 Checksum;
- ACPI_FUNCTION_NAME ("TbValidateTableHeader");
+ /* Compute the checksum on the table */
+ Checksum = AcpiTbChecksum (ACPI_CAST_PTR (UINT8, Table), Length);
- /* Verify that this is a valid address */
+ /* Checksum ok? (should be zero) */
- if (!AcpiOsReadable (TableHeader, sizeof (ACPI_TABLE_HEADER)))
+ if (Checksum)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Cannot read table header at %p\n", TableHeader));
+ ACPI_WARNING ((AE_INFO,
+ "Incorrect checksum in table [%4.4s] - %2.2X, should be %2.2X",
+ Table->Signature, Table->Checksum, (UINT8) (Table->Checksum - Checksum)));
- return (AE_BAD_ADDRESS);
+#if (ACPI_CHECKSUM_ABORT)
+ return (AE_BAD_CHECKSUM);
+#endif
}
- /* Ensure that the signature is 4 ASCII characters */
+ return (AE_OK);
+}
- ACPI_MOVE_32_TO_32 (&Signature, TableHeader->Signature);
- if (!AcpiUtValidAcpiName (Signature))
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Table signature at %p [%p] has invalid characters\n",
- TableHeader, &Signature));
- ACPI_REPORT_WARNING (("Invalid table signature found: [%4.4s]\n",
- (char *) &Signature));
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbChecksum
+ *
+ * PARAMETERS: Buffer - Pointer to memory region to be checked
+ * Length - Length of this memory region
+ *
+ * RETURN: Checksum (UINT8)
+ *
+ * DESCRIPTION: Calculates circular checksum of memory region.
+ *
+ ******************************************************************************/
- ACPI_DUMP_BUFFER (TableHeader, sizeof (ACPI_TABLE_HEADER));
- return (AE_BAD_SIGNATURE);
- }
+UINT8
+AcpiTbChecksum (
+ UINT8 *Buffer,
+ ACPI_NATIVE_UINT Length)
+{
+ UINT8 Sum = 0;
+ UINT8 *End = Buffer + Length;
- /* Validate the table length */
- if (TableHeader->Length < sizeof (ACPI_TABLE_HEADER))
+ while (Buffer < End)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Invalid length in table header %p name %4.4s\n",
- TableHeader, (char *) &Signature));
-
- ACPI_REPORT_WARNING (("Invalid table header length (0x%X) found\n",
- (UINT32) TableHeader->Length));
-
- ACPI_DUMP_BUFFER (TableHeader, sizeof (ACPI_TABLE_HEADER));
- return (AE_BAD_HEADER);
+ Sum = (UINT8) (Sum + *(Buffer++));
}
- return (AE_OK);
+ return Sum;
}
/*******************************************************************************
*
- * FUNCTION: AcpiTbVerifyTableChecksum
+ * FUNCTION: AcpiTbInstallTable
*
- * PARAMETERS: *TableHeader - ACPI table to verify
+ * 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: 8 bit checksum of table
+ * RETURN: None
*
- * DESCRIPTION: Does an 8 bit checksum of table and returns status. A correct
- * table should have a checksum of 0.
+ * DESCRIPTION: Install an ACPI table into the global data structure.
*
******************************************************************************/
-ACPI_STATUS
-AcpiTbVerifyTableChecksum (
- ACPI_TABLE_HEADER *TableHeader)
+void
+AcpiTbInstallTable (
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT8 Flags,
+ char *Signature,
+ ACPI_NATIVE_UINT TableIndex)
{
- UINT8 Checksum;
- ACPI_STATUS Status = AE_OK;
+ ACPI_TABLE_HEADER *Table;
- ACPI_FUNCTION_TRACE ("TbVerifyTableChecksum");
+ if (!Address)
+ {
+ ACPI_ERROR ((AE_INFO, "Null physical address for ACPI table [%s]",
+ Signature));
+ return;
+ }
+ /* Map just the table header */
- /* Compute the checksum on the table */
+ Table = AcpiOsMapMemory (Address, sizeof (ACPI_TABLE_HEADER));
+ if (!Table)
+ {
+ return;
+ }
+
+ /* If a particular signature is expected, signature must match */
+
+ if (Signature &&
+ !ACPI_COMPARE_NAME (Table->Signature, Signature))
+ {
+ ACPI_ERROR ((AE_INFO, "Invalid signature 0x%X for ACPI table [%s]",
+ *ACPI_CAST_PTR (UINT32, Table->Signature), Signature));
+ goto UnmapAndExit;
+ }
- Checksum = AcpiTbGenerateChecksum (TableHeader, TableHeader->Length);
+ /* Initialize the table entry */
- /* Return the appropriate exception */
+ AcpiGbl_RootTableList.Tables[TableIndex].Address = Address;
+ AcpiGbl_RootTableList.Tables[TableIndex].Length = Table->Length;
+ AcpiGbl_RootTableList.Tables[TableIndex].Flags = Flags;
- if (Checksum)
+ ACPI_MOVE_32_TO_32 (
+ &(AcpiGbl_RootTableList.Tables[TableIndex].Signature),
+ Table->Signature);
+
+ AcpiTbPrintTableHeader (Address, Table);
+
+ if (TableIndex == ACPI_TABLE_INDEX_DSDT)
{
- ACPI_REPORT_WARNING ((
- "Invalid checksum in table [%4.4s] (%02X, sum %02X is not zero)\n",
- TableHeader->Signature, (UINT32) TableHeader->Checksum,
- (UINT32) Checksum));
+ /* Global integer width is based upon revision of the DSDT */
- Status = AE_BAD_CHECKSUM;
+ AcpiUtSetIntegerWidth (Table->Revision);
}
- return_ACPI_STATUS (Status);
+
+UnmapAndExit:
+ AcpiOsUnmapMemory (Table, sizeof (ACPI_TABLE_HEADER));
}
/*******************************************************************************
*
- * FUNCTION: AcpiTbGenerateChecksum
+ * FUNCTION: AcpiTbGetRootTableEntry
+ *
+ * PARAMETERS: TableEntry - Pointer to the RSDT/XSDT table entry
+ * TableEntrySize - sizeof 32 or 64 (RSDT or XSDT)
*
- * PARAMETERS: Buffer - Buffer to checksum
- * Length - Size of the buffer
+ * RETURN: Physical address extracted from the root table
*
- * RETURN: 8 bit checksum of buffer
+ * DESCRIPTION: Get one root table entry. Handles 32-bit and 64-bit cases on
+ * both 32-bit and 64-bit platforms
*
- * DESCRIPTION: Computes an 8 bit checksum of the buffer(length) and returns it.
+ * NOTE: ACPI_PHYSICAL_ADDRESS is 32-bit on 32-bit platforms, 64-bit on
+ * 64-bit platforms.
*
******************************************************************************/
-UINT8
-AcpiTbGenerateChecksum (
- void *Buffer,
- UINT32 Length)
+static ACPI_PHYSICAL_ADDRESS
+AcpiTbGetRootTableEntry (
+ UINT8 *TableEntry,
+ ACPI_NATIVE_UINT TableEntrySize)
{
- const UINT8 *limit;
- const UINT8 *rover;
- UINT8 sum = 0;
+ UINT64 Address64;
- if (Buffer && Length)
+ /*
+ * Get the table physical address (32-bit for RSDT, 64-bit for XSDT):
+ * Note: Addresses are 32-bit aligned (not 64) in both RSDT and XSDT
+ */
+ if (TableEntrySize == sizeof (UINT32))
{
- /* Buffer and Length are valid */
-
- limit = (UINT8 *) Buffer + Length;
+ /*
+ * 32-bit platform, RSDT: Return 32-bit table entry
+ * 64-bit platform, RSDT: Expand 32-bit to 64-bit and return
+ */
+ return ((ACPI_PHYSICAL_ADDRESS) (*ACPI_CAST_PTR (UINT32, TableEntry)));
+ }
+ else
+ {
+ /*
+ * 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
+ */
+ ACPI_MOVE_64_TO_64 (&Address64, TableEntry);
- for (rover = Buffer; rover < limit; rover++)
+#if ACPI_MACHINE_WIDTH == 32
+ if (Address64 > ACPI_UINT32_MAX)
{
- sum = (UINT8) (sum + *rover);
+ /* 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",
+ ACPI_FORMAT_UINT64 (Address64)));
}
+#endif
+ return ((ACPI_PHYSICAL_ADDRESS) (Address64));
}
- return (sum);
}
-#ifdef ACPI_OBSOLETE_FUNCTIONS
/*******************************************************************************
*
- * FUNCTION: AcpiTbHandleToObject
+ * FUNCTION: AcpiTbParseRootTable
+ *
+ * PARAMETERS: Rsdp - Pointer to the RSDP
+ * Flags - Flags
+ *
+ * RETURN: Status
*
- * PARAMETERS: TableId - Id for which the function is searching
- * TableDesc - Pointer to return the matching table
- * descriptor.
+ * DESCRIPTION: This function is called to parse the Root System Description
+ * Table (RSDT or XSDT)
*
- * RETURN: Search the tables to find one with a matching TableId and
- * return a pointer to that table descriptor.
+ * NOTE: Tables are mapped (not copied) for efficiency. The FACS must
+ * be mapped and cannot be copied because it contains the actual
+ * memory location of the ACPI Global Lock.
*
******************************************************************************/
ACPI_STATUS
-AcpiTbHandleToObject (
- UINT16 TableId,
- ACPI_TABLE_DESC **ReturnTableDesc)
+AcpiTbParseRootTable (
+ ACPI_PHYSICAL_ADDRESS RsdpAddress,
+ UINT8 Flags)
{
- UINT32 i;
- ACPI_TABLE_DESC *TableDesc;
+ ACPI_TABLE_RSDP *Rsdp;
+ ACPI_NATIVE_UINT TableEntrySize;
+ ACPI_NATIVE_UINT i;
+ UINT32 TableCount;
+ ACPI_TABLE_HEADER *Table;
+ ACPI_PHYSICAL_ADDRESS Address;
+ UINT32 Length;
+ UINT8 *TableEntry;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE (TbParseRootTable);
+
+
+ /*
+ * Map the entire RSDP and extract the address of the RSDT or XSDT
+ */
+ Rsdp = AcpiOsMapMemory (RsdpAddress, sizeof (ACPI_TABLE_RSDP));
+ if (!Rsdp)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ AcpiTbPrintTableHeader (RsdpAddress, ACPI_CAST_PTR (ACPI_TABLE_HEADER, Rsdp));
+
+ /* Differentiate between RSDT and XSDT root tables */
+
+ if (Rsdp->Revision > 1 && Rsdp->XsdtPhysicalAddress)
+ {
+ /*
+ * Root table is an XSDT (64-bit physical addresses). We must use the
+ * XSDT if the revision is > 1 and the XSDT pointer is present, as per
+ * the ACPI specification.
+ */
+ Address = (ACPI_PHYSICAL_ADDRESS) Rsdp->XsdtPhysicalAddress;
+ TableEntrySize = sizeof (UINT64);
+ }
+ else
+ {
+ /* Root table is an RSDT (32-bit physical addresses) */
+
+ Address = (ACPI_PHYSICAL_ADDRESS) Rsdp->RsdtPhysicalAddress;
+ TableEntrySize = sizeof (UINT32);
+ }
+ /*
+ * It is not possible to map more than one entry in some environments,
+ * so unmap the RSDP here before mapping other tables
+ */
+ AcpiOsUnmapMemory (Rsdp, sizeof (ACPI_TABLE_RSDP));
- ACPI_FUNCTION_NAME ("TbHandleToObject");
+ /* Map the RSDT/XSDT table header to get the full table length */
- for (i = 0; i < ACPI_TABLE_MAX; i++)
+ Table = AcpiOsMapMemory (Address, sizeof (ACPI_TABLE_HEADER));
+ if (!Table)
{
- TableDesc = AcpiGbl_TableLists[i].Next;
- while (TableDesc)
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ AcpiTbPrintTableHeader (Address, Table);
+
+ /* Get the length of the full table, verify length and map entire table */
+
+ Length = Table->Length;
+ AcpiOsUnmapMemory (Table, sizeof (ACPI_TABLE_HEADER));
+
+ if (Length < sizeof (ACPI_TABLE_HEADER))
+ {
+ ACPI_ERROR ((AE_INFO, "Invalid length 0x%X in RSDT/XSDT", Length));
+ return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH);
+ }
+
+ Table = AcpiOsMapMemory (Address, Length);
+ if (!Table)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /* Validate the root table checksum */
+
+ Status = AcpiTbVerifyChecksum (Table, Length);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsUnmapMemory (Table, Length);
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Calculate the number of tables described in the root table */
+
+ 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
+ */
+ TableEntry = ACPI_CAST_PTR (UINT8, Table) + sizeof (ACPI_TABLE_HEADER);
+ AcpiGbl_RootTableList.Count = 2;
+
+ /*
+ * Initialize the root table array from the RSDT/XSDT
+ */
+ for (i = 0; i < TableCount; i++)
+ {
+ if (AcpiGbl_RootTableList.Count >= AcpiGbl_RootTableList.Size)
{
- if (TableDesc->TableId == TableId)
+ /* There is no more room in the root table array, attempt resize */
+
+ Status = AcpiTbResizeRootTableList ();
+ if (ACPI_FAILURE (Status))
{
- *ReturnTableDesc = TableDesc;
- return (AE_OK);
+ ACPI_WARNING ((AE_INFO, "Truncating %u table entries!",
+ (unsigned) (AcpiGbl_RootTableList.Size - AcpiGbl_RootTableList.Count)));
+ break;
}
-
- TableDesc = TableDesc->Next;
}
+
+ /* Get the table physical address (32-bit for RSDT, 64-bit for XSDT) */
+
+ AcpiGbl_RootTableList.Tables[AcpiGbl_RootTableList.Count].Address =
+ AcpiTbGetRootTableEntry (TableEntry, TableEntrySize);
+
+ TableEntry += TableEntrySize;
+ AcpiGbl_RootTableList.Count++;
}
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "TableId=%X does not exist\n", TableId));
- return (AE_BAD_PARAMETER);
-}
-#endif
+ /*
+ * It is not possible to map more than one entry in some environments,
+ * so unmap the root table here before mapping other tables
+ */
+ AcpiOsUnmapMemory (Table, Length);
+
+ /*
+ * Complete the initialization of the root table array by examining
+ * the header of each table
+ */
+ for (i = 2; i < AcpiGbl_RootTableList.Count; i++)
+ {
+ AcpiTbInstallTable (AcpiGbl_RootTableList.Tables[i].Address,
+ Flags, 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);
+ }
+ }
+ return_ACPI_STATUS (AE_OK);
+}
diff --git a/sys/contrib/dev/acpica/tbxface.c b/sys/contrib/dev/acpica/tbxface.c
index b4bb3fe..1e820dd 100644
--- a/sys/contrib/dev/acpica/tbxface.c
+++ b/sys/contrib/dev/acpica/tbxface.c
@@ -2,7 +2,7 @@
*
* Module Name: tbxface - Public interfaces to the ACPI subsystem
* ACPI table oriented interfaces
- * $Revision: 1.70 $
+ * $Revision: 1.86 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -121,431 +121,542 @@
#include <contrib/dev/acpica/acnamesp.h>
#include <contrib/dev/acpica/actables.h>
-
#define _COMPONENT ACPI_TABLES
ACPI_MODULE_NAME ("tbxface")
+/* Local prototypes */
+
+static ACPI_STATUS
+AcpiTbLoadNamespace (
+ void);
+
/*******************************************************************************
*
- * FUNCTION: AcpiLoadTables
+ * FUNCTION: AcpiAllocateRootTable
*
- * PARAMETERS: None
+ * PARAMETERS: InitialTableCount - Size of InitialTableArray, in number of
+ * ACPI_TABLE_DESC structures
*
* RETURN: Status
*
- * DESCRIPTION: This function is called to load the ACPI tables from the
- * provided RSDT
+ * DESCRIPTION: Allocate a root table array. Used by iASL compiler and
+ * AcpiInitializeTables.
*
******************************************************************************/
ACPI_STATUS
-AcpiLoadTables (
- void)
+AcpiAllocateRootTable (
+ UINT32 InitialTableCount)
{
- ACPI_POINTER RsdpAddress;
- ACPI_STATUS Status;
+ AcpiGbl_RootTableList.Size = InitialTableCount;
+ AcpiGbl_RootTableList.Flags = ACPI_ROOT_ALLOW_RESIZE;
- ACPI_FUNCTION_TRACE ("AcpiLoadTables");
+ return (AcpiTbResizeRootTableList ());
+}
- /* Get the RSDP */
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiInitializeTables
+ *
+ * PARAMETERS: InitialTableArray - Pointer to an array of pre-allocated
+ * ACPI_TABLE_DESC structures. If NULL, the
+ * array is dynamically allocated.
+ * InitialTableCount - Size of InitialTableArray, in number of
+ * ACPI_TABLE_DESC structures
+ * AllowRealloc - Flag to tell Table Manager if resize of
+ * pre-allocated array is allowed. Ignored
+ * if InitialTableArray is NULL.
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Initialize the table manager, get the RSDP and RSDT/XSDT.
+ *
+ * NOTE: Allows static allocation of the initial table array in order
+ * to avoid the use of dynamic memory in confined environments
+ * such as the kernel boot sequence where it may not be available.
+ *
+ * If the host OS memory managers are initialized, use NULL for
+ * InitialTableArray, and the table will be dynamically allocated.
+ *
+ ******************************************************************************/
- Status = AcpiOsGetRootPointer (ACPI_LOGICAL_ADDRESSING,
- &RsdpAddress);
- if (ACPI_FAILURE (Status))
- {
- ACPI_REPORT_ERROR (("AcpiLoadTables: Could not get RSDP, %s\n",
- AcpiFormatException (Status)));
- goto ErrorExit;
- }
+ACPI_STATUS
+AcpiInitializeTables (
+ ACPI_TABLE_DESC *InitialTableArray,
+ UINT32 InitialTableCount,
+ BOOLEAN AllowResize)
+{
+ ACPI_PHYSICAL_ADDRESS RsdpAddress;
+ ACPI_STATUS Status;
- /* Map and validate the RSDP */
- AcpiGbl_TableFlags = RsdpAddress.PointerType;
+ ACPI_FUNCTION_TRACE (AcpiInitializeTables);
- Status = AcpiTbVerifyRsdp (&RsdpAddress);
- if (ACPI_FAILURE (Status))
- {
- ACPI_REPORT_ERROR (("AcpiLoadTables: RSDP Failed validation: %s\n",
- AcpiFormatException (Status)));
- goto ErrorExit;
- }
-
- /* Get the RSDT via the RSDP */
- Status = AcpiTbGetTableRsdt ();
- if (ACPI_FAILURE (Status))
+ /*
+ * Set up the Root Table Array
+ * Allocate the table array if requested
+ */
+ if (!InitialTableArray)
{
- ACPI_REPORT_ERROR (("AcpiLoadTables: Could not load RSDT: %s\n",
- AcpiFormatException (Status)));
- goto ErrorExit;
+ Status = AcpiAllocateRootTable (InitialTableCount);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
}
+ else
+ {
+ /* Root Table Array has been statically allocated by the host */
- /* Now get the tables needed by this subsystem (FADT, DSDT, etc.) */
+ ACPI_MEMSET (InitialTableArray, 0,
+ InitialTableCount * sizeof (ACPI_TABLE_DESC));
- Status = AcpiTbGetRequiredTables ();
- if (ACPI_FAILURE (Status))
- {
- ACPI_REPORT_ERROR ((
- "AcpiLoadTables: Error getting required tables (DSDT/FADT/FACS): %s\n",
- AcpiFormatException (Status)));
- goto ErrorExit;
+ AcpiGbl_RootTableList.Tables = InitialTableArray;
+ AcpiGbl_RootTableList.Size = InitialTableCount;
+ AcpiGbl_RootTableList.Flags = ACPI_ROOT_ORIGIN_UNKNOWN;
+ if (AllowResize)
+ {
+ AcpiGbl_RootTableList.Flags |= ACPI_ROOT_ALLOW_RESIZE;
+ }
}
- ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "ACPI Tables successfully acquired\n"));
-
- /* Load the namespace from the tables */
+ /* Get the address of the RSDP */
- Status = AcpiNsLoadNamespace ();
- if (ACPI_FAILURE (Status))
+ RsdpAddress = AcpiOsGetRootPointer ();
+ if (!RsdpAddress)
{
- ACPI_REPORT_ERROR (("AcpiLoadTables: Could not load namespace: %s\n",
- AcpiFormatException (Status)));
- goto ErrorExit;
+ return_ACPI_STATUS (AE_NOT_FOUND);
}
- return_ACPI_STATUS (AE_OK);
-
-
-ErrorExit:
- ACPI_REPORT_ERROR (("AcpiLoadTables: Could not load tables: %s\n",
- AcpiFormatException (Status)));
-
+ /*
+ * Get the root table (RSDT or XSDT) and extract all entries to the local
+ * 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);
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiInitializeTables)
+
/*******************************************************************************
*
- * FUNCTION: AcpiLoadTable
+ * FUNCTION: AcpiReallocateRootTable
*
- * PARAMETERS: TablePtr - pointer to a buffer containing the entire
- * table to be loaded
+ * PARAMETERS: None
*
* 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
- * is determined that the table is invalid, the call will fail.
+ * DESCRIPTION: Reallocate Root Table List into dynamic memory. Copies the
+ * root list from the previously provided scratch area. Should
+ * be called once dynamic memory allocation is available in the
+ * kernel
*
******************************************************************************/
ACPI_STATUS
-AcpiLoadTable (
- ACPI_TABLE_HEADER *TablePtr)
+AcpiReallocateRootTable (
+ void)
{
- ACPI_STATUS Status;
- ACPI_TABLE_DESC TableInfo;
- ACPI_POINTER Address;
+ ACPI_TABLE_DESC *Tables;
+ ACPI_SIZE NewSize;
- ACPI_FUNCTION_TRACE ("AcpiLoadTable");
+ ACPI_FUNCTION_TRACE (AcpiReallocateRootTable);
- if (!TablePtr)
+ /*
+ * Only reallocate the root table if the host provided a static buffer
+ * for the table array in the call to AcpiInitializeTables.
+ */
+ if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED)
{
- return_ACPI_STATUS (AE_BAD_PARAMETER);
+ return_ACPI_STATUS (AE_SUPPORT);
}
- /* Copy the table to a local buffer */
+ NewSize = (AcpiGbl_RootTableList.Count + ACPI_ROOT_TABLE_SIZE_INCREMENT) *
+ sizeof (ACPI_TABLE_DESC);
- Address.PointerType = ACPI_LOGICAL_POINTER | ACPI_LOGICAL_ADDRESSING;
- Address.Pointer.Logical = TablePtr;
+ /* Create new array and copy the old array */
- Status = AcpiTbGetTableBody (&Address, TablePtr, &TableInfo);
- if (ACPI_FAILURE (Status))
+ Tables = ACPI_ALLOCATE_ZEROED (NewSize);
+ if (!Tables)
{
- return_ACPI_STATUS (Status);
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
- /* Check signature for a valid table type */
+ ACPI_MEMCPY (Tables, AcpiGbl_RootTableList.Tables, NewSize);
- Status = AcpiTbRecognizeTable (&TableInfo, ACPI_TABLE_ALL);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /* Install the new table into the local data structures */
+ AcpiGbl_RootTableList.Size = AcpiGbl_RootTableList.Count;
+ AcpiGbl_RootTableList.Tables = Tables;
+ AcpiGbl_RootTableList.Flags =
+ ACPI_ROOT_ORIGIN_ALLOCATED | ACPI_ROOT_ALLOW_RESIZE;
- Status = AcpiTbInstallTable (&TableInfo);
- if (ACPI_FAILURE (Status))
- {
- if (Status == AE_ALREADY_EXISTS)
- {
- /* Table already exists, no error */
+ return_ACPI_STATUS (AE_OK);
+}
- Status = AE_OK;
- }
+ACPI_EXPORT_SYMBOL (AcpiReallocateRootTable)
- /* Free table allocated by AcpiTbGetTableBody */
- AcpiTbDeleteSingleTable (&TableInfo);
- return_ACPI_STATUS (Status);
- }
+/******************************************************************************
+ *
+ * FUNCTION: AcpiGetTableHeader
+ *
+ * PARAMETERS: Signature - ACPI signature of needed table
+ * Instance - Which instance (for SSDTs)
+ * OutTableHeader - The pointer to the table header to fill
+ *
+ * RETURN: Status and pointer to mapped table header
+ *
+ * DESCRIPTION: Finds an ACPI table header.
+ *
+ * NOTE: Caller is responsible in unmapping the header with
+ * AcpiOsUnmapMemory
+ *
+ *****************************************************************************/
- /* Convert the table to common format if necessary */
+ACPI_STATUS
+AcpiGetTableHeader (
+ char *Signature,
+ ACPI_NATIVE_UINT Instance,
+ ACPI_TABLE_HEADER *OutTableHeader)
+{
+ ACPI_NATIVE_UINT i;
+ ACPI_NATIVE_UINT j;
+ ACPI_TABLE_HEADER *Header;
- switch (TableInfo.Type)
- {
- case ACPI_TABLE_FADT:
- Status = AcpiTbConvertTableFadt ();
- break;
+ /* Parameter validation */
- case ACPI_TABLE_FACS:
+ if (!Signature || !OutTableHeader)
+ {
+ return (AE_BAD_PARAMETER);
+ }
- Status = AcpiTbBuildCommonFacs (&TableInfo);
- break;
+ /*
+ * Walk the root table list
+ */
+ for (i = 0, j = 0; i < AcpiGbl_RootTableList.Count; i++)
+ {
+ if (!ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature),
+ Signature))
+ {
+ continue;
+ }
- default:
- /* Load table into namespace if it contains executable AML */
+ if (++j < Instance)
+ {
+ continue;
+ }
- Status = AcpiNsLoadTable (TableInfo.InstalledDesc, AcpiGbl_RootNode);
- break;
- }
+ if (!AcpiGbl_RootTableList.Tables[i].Pointer)
+ {
+ if ((AcpiGbl_RootTableList.Tables[i].Flags & ACPI_TABLE_ORIGIN_MASK) ==
+ ACPI_TABLE_ORIGIN_MAPPED)
+ {
+ Header = AcpiOsMapMemory (AcpiGbl_RootTableList.Tables[i].Address,
+ sizeof (ACPI_TABLE_HEADER));
+ if (!Header)
+ {
+ return AE_NO_MEMORY;
+ }
+
+ ACPI_MEMCPY (OutTableHeader, Header, sizeof(ACPI_TABLE_HEADER));
+ AcpiOsUnmapMemory (Header, sizeof(ACPI_TABLE_HEADER));
+ }
+
+ else
+ {
+ return AE_NOT_FOUND;
+ }
+ }
- if (ACPI_FAILURE (Status))
- {
- /* Uninstall table and free the buffer */
+ else
+ {
+ ACPI_MEMCPY (OutTableHeader, AcpiGbl_RootTableList.Tables[i].Pointer,
+ sizeof(ACPI_TABLE_HEADER));
+ }
- (void) AcpiTbUninstallTable (TableInfo.InstalledDesc);
+ return (AE_OK);
}
- return_ACPI_STATUS (Status);
+ return (AE_NOT_FOUND);
}
+ACPI_EXPORT_SYMBOL (AcpiGetTableHeader)
-/*******************************************************************************
+
+/******************************************************************************
*
- * FUNCTION: AcpiUnloadTable
+ * FUNCTION: AcpiGetTable
*
- * PARAMETERS: TableType - Type of table to be unloaded
+ * PARAMETERS: Signature - ACPI signature of needed table
+ * Instance - Which instance (for SSDTs)
+ * OutTable - Where the pointer to the table is returned
*
- * RETURN: Status
+ * RETURN: Status and pointer to table
*
- * DESCRIPTION: This routine is used to force the unload of a table
+ * DESCRIPTION: Finds and verifies an ACPI table.
*
- ******************************************************************************/
+ *****************************************************************************/
ACPI_STATUS
-AcpiUnloadTable (
- ACPI_TABLE_TYPE TableType)
+AcpiGetTable (
+ char *Signature,
+ ACPI_NATIVE_UINT Instance,
+ ACPI_TABLE_HEADER **OutTable)
{
- ACPI_TABLE_DESC *TableDesc;
-
-
- ACPI_FUNCTION_TRACE ("AcpiUnloadTable");
+ ACPI_NATIVE_UINT i;
+ ACPI_NATIVE_UINT j;
+ ACPI_STATUS Status;
/* Parameter validation */
- if (TableType > ACPI_TABLE_MAX)
+ if (!Signature || !OutTable)
{
- return_ACPI_STATUS (AE_BAD_PARAMETER);
+ return (AE_BAD_PARAMETER);
}
- /* Find all tables of the requested type */
-
- TableDesc = AcpiGbl_TableLists[TableType].Next;
- while (TableDesc)
+ /*
+ * Walk the root table list
+ */
+ for (i = 0, j = 0; i < AcpiGbl_RootTableList.Count; i++)
{
- /*
- * Delete all namespace entries owned by this table. Note that these
- * entries can appear anywhere in the namespace by virtue of the AML
- * "Scope" operator. Thus, we need to track ownership by an ID, not
- * simply a position within the hierarchy
- */
- AcpiNsDeleteNamespaceByOwner (TableDesc->OwnerId);
- AcpiUtReleaseOwnerId (&TableDesc->OwnerId);
- TableDesc = TableDesc->Next;
- }
+ if (!ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature),
+ Signature))
+ {
+ continue;
+ }
- /* Delete (or unmap) all tables of this type */
+ if (++j < Instance)
+ {
+ continue;
+ }
- AcpiTbDeleteTablesByType (TableType);
- return_ACPI_STATUS (AE_OK);
+ Status = AcpiTbVerifyTable (&AcpiGbl_RootTableList.Tables[i]);
+ if (ACPI_SUCCESS (Status))
+ {
+ *OutTable = AcpiGbl_RootTableList.Tables[i].Pointer;
+ }
+
+ return (Status);
+ }
+
+ return (AE_NOT_FOUND);
}
+ACPI_EXPORT_SYMBOL (AcpiGetTable)
+
/*******************************************************************************
*
- * FUNCTION: AcpiGetTableHeader
+ * FUNCTION: AcpiGetTableByIndex
*
- * PARAMETERS: TableType - one of the defined table types
- * Instance - the non zero instance of the table, allows
- * support for multiple tables of the same type
- * see AcpiGbl_AcpiTableFlag
- * OutTableHeader - pointer to the ACPI_TABLE_HEADER if successful
+ * PARAMETERS: TableIndex - Table index
+ * Table - Where the pointer to the table is returned
*
- * DESCRIPTION: This function is called to get an ACPI table header. The caller
- * supplies an pointer to a data area sufficient to contain an ACPI
- * ACPI_TABLE_HEADER structure.
+ * RETURN: Status and pointer to the table
*
- * The header contains a length field that can be used to determine
- * the size of the buffer needed to contain the entire table. This
- * function is not valid for the RSD PTR table since it does not
- * have a standard header and is fixed length.
+ * DESCRIPTION: Obtain a table by an index into the global table list.
*
******************************************************************************/
ACPI_STATUS
-AcpiGetTableHeader (
- ACPI_TABLE_TYPE TableType,
- UINT32 Instance,
- ACPI_TABLE_HEADER *OutTableHeader)
+AcpiGetTableByIndex (
+ ACPI_NATIVE_UINT TableIndex,
+ ACPI_TABLE_HEADER **Table)
{
- ACPI_TABLE_HEADER *TblPtr;
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("AcpiGetTableHeader");
+ ACPI_FUNCTION_TRACE (AcpiGetTableByIndex);
- if ((Instance == 0) ||
- (TableType == ACPI_TABLE_RSDP) ||
- (!OutTableHeader))
+ /* Parameter validation */
+
+ if (!Table)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- /* Check the table type and instance */
+ (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
+
+ /* Validate index */
- if ((TableType > ACPI_TABLE_MAX) ||
- (ACPI_IS_SINGLE_TABLE (AcpiGbl_TableData[TableType].Flags) &&
- Instance > 1))
+ if (TableIndex >= AcpiGbl_RootTableList.Count)
{
+ (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- /* Get a pointer to the entire table */
-
- Status = AcpiTbGetTablePtr (TableType, Instance, &TblPtr);
- if (ACPI_FAILURE (Status))
+ if (!AcpiGbl_RootTableList.Tables[TableIndex].Pointer)
{
- return_ACPI_STATUS (Status);
- }
+ /* Table is not mapped, map it */
- /* The function will return a NULL pointer if the table is not loaded */
-
- if (TblPtr == NULL)
- {
- return_ACPI_STATUS (AE_NOT_EXIST);
+ Status = AcpiTbVerifyTable (&AcpiGbl_RootTableList.Tables[TableIndex]);
+ if (ACPI_FAILURE (Status))
+ {
+ (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
+ return_ACPI_STATUS (Status);
+ }
}
- /* Copy the header to the caller's buffer */
-
- ACPI_MEMCPY ((void *) OutTableHeader, (void *) TblPtr,
- sizeof (ACPI_TABLE_HEADER));
-
- return_ACPI_STATUS (Status);
+ *Table = AcpiGbl_RootTableList.Tables[TableIndex].Pointer;
+ (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
+ return_ACPI_STATUS (AE_OK);
}
+ACPI_EXPORT_SYMBOL (AcpiGetTableByIndex)
+
/*******************************************************************************
*
- * FUNCTION: AcpiGetTable
+ * FUNCTION: AcpiTbLoadNamespace
*
- * PARAMETERS: TableType - one of the defined table types
- * Instance - the non zero instance of the table, allows
- * support for multiple tables of the same type
- * see AcpiGbl_AcpiTableFlag
- * RetBuffer - pointer to a structure containing a buffer to
- * receive the table
+ * PARAMETERS: None
*
* RETURN: Status
*
- * DESCRIPTION: This function is called to get an ACPI table. The caller
- * supplies an OutBuffer large enough to contain the entire ACPI
- * table. The caller should call the AcpiGetTableHeader function
- * first to determine the buffer size needed. Upon completion
- * the OutBuffer->Length field will indicate the number of bytes
- * copied into the OutBuffer->BufPtr buffer. This table will be
- * a complete table including the header.
+ * DESCRIPTION: Load the namespace from the DSDT and all SSDTs/PSDTs found in
+ * the RSDT/XSDT.
*
******************************************************************************/
-ACPI_STATUS
-AcpiGetTable (
- ACPI_TABLE_TYPE TableType,
- UINT32 Instance,
- ACPI_BUFFER *RetBuffer)
+static ACPI_STATUS
+AcpiTbLoadNamespace (
+ void)
{
- ACPI_TABLE_HEADER *TblPtr;
ACPI_STATUS Status;
- ACPI_SIZE TableLength;
+ ACPI_TABLE_HEADER *Table;
+ ACPI_NATIVE_UINT i;
- ACPI_FUNCTION_TRACE ("AcpiGetTable");
+ ACPI_FUNCTION_TRACE (TbLoadNamespace);
- /* Parameter validation */
+ (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
- if (Instance == 0)
+ /*
+ * Load the namespace. The DSDT is required, but any SSDT and PSDT tables
+ * 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])))
{
- return_ACPI_STATUS (AE_BAD_PARAMETER);
+ Status = AE_NO_ACPI_TABLES;
+ goto UnlockAndExit;
}
- Status = AcpiUtValidateBuffer (RetBuffer);
- if (ACPI_FAILURE (Status))
+ /*
+ * Find DSDT table
+ */
+ Status = AcpiOsTableOverride (
+ AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Pointer, &Table);
+ if (ACPI_SUCCESS (Status) && Table)
{
- return_ACPI_STATUS (Status);
- }
+ /*
+ * 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;
- /* Check the table type and instance */
+ ACPI_INFO ((AE_INFO, "Table DSDT replaced by host OS"));
+ AcpiTbPrintTableHeader (0, Table);
+ }
- if ((TableType > ACPI_TABLE_MAX) ||
- (ACPI_IS_SINGLE_TABLE (AcpiGbl_TableData[TableType].Flags) &&
- Instance > 1))
+ Status = AcpiTbVerifyTable (&AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT]);
+ if (ACPI_FAILURE (Status))
{
- return_ACPI_STATUS (AE_BAD_PARAMETER);
+ /* A valid DSDT is required */
+
+ Status = AE_NO_ACPI_TABLES;
+ goto UnlockAndExit;
}
- /* Get a pointer to the entire table */
+ (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
- Status = AcpiTbGetTablePtr (TableType, Instance, &TblPtr);
+ /*
+ * Load and parse tables.
+ */
+ Status = AcpiNsLoadTable (ACPI_TABLE_INDEX_DSDT, AcpiGbl_RootNode);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/*
- * AcpiTbGetTablePtr will return a NULL pointer if the
- * table is not loaded.
+ * Load any SSDT or PSDT tables. Note: Loop leaves tables locked
*/
- if (TblPtr == NULL)
+ (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
+ for (i = 0; i < AcpiGbl_RootTableList.Count; ++i)
{
- return_ACPI_STATUS (AE_NOT_EXIST);
+ if ((!ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature),
+ ACPI_SIG_SSDT) &&
+ !ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature),
+ ACPI_SIG_PSDT)) ||
+ ACPI_FAILURE (AcpiTbVerifyTable (&AcpiGbl_RootTableList.Tables[i])))
+ {
+ continue;
+ }
+
+ /* Ignore errors while loading tables, get as many as possible */
+
+ (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
+ (void) AcpiNsLoadTable (i, AcpiGbl_RootNode);
+ (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
}
- /* Get the table length */
+ ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "ACPI Tables successfully acquired\n"));
- if (TableType == ACPI_TABLE_RSDP)
- {
- /* RSD PTR is the only "table" without a header */
+UnlockAndExit:
+ (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
+ return_ACPI_STATUS (Status);
+}
- TableLength = sizeof (RSDP_DESCRIPTOR);
- }
- else
- {
- TableLength = (ACPI_SIZE) TblPtr->Length;
- }
- /* Validate/Allocate/Clear caller buffer */
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiLoadTables
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Load the ACPI tables from the RSDT/XSDT
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiLoadTables (
+ void)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE (AcpiLoadTables);
+
- Status = AcpiUtInitializeBuffer (RetBuffer, TableLength);
+ /*
+ * Load the namespace from the tables
+ */
+ Status = AcpiTbLoadNamespace ();
if (ACPI_FAILURE (Status))
{
- return_ACPI_STATUS (Status);
+ ACPI_EXCEPTION ((AE_INFO, Status, "While loading namespace from ACPI tables"));
}
- /* Copy the table to the buffer */
-
- ACPI_MEMCPY ((void *) RetBuffer->Pointer, (void *) TblPtr, TableLength);
- return_ACPI_STATUS (AE_OK);
+ return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiLoadTables)
diff --git a/sys/contrib/dev/acpica/tbxfroot.c b/sys/contrib/dev/acpica/tbxfroot.c
index af51d3b..afc30ad 100644
--- a/sys/contrib/dev/acpica/tbxfroot.c
+++ b/sys/contrib/dev/acpica/tbxfroot.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: tbxfroot - Find the root ACPI table (RSDT)
- * $Revision: 1.91 $
+ * $Revision: 1.105 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -125,22 +125,21 @@
/* Local prototypes */
-static ACPI_STATUS
-AcpiTbFindRsdp (
- ACPI_TABLE_DESC *TableInfo,
- UINT32 Flags);
-
static UINT8 *
AcpiTbScanMemoryForRsdp (
UINT8 *StartAddress,
UINT32 Length);
+static ACPI_STATUS
+AcpiTbValidateRsdp (
+ ACPI_TABLE_RSDP *Rsdp);
+
/*******************************************************************************
*
* FUNCTION: AcpiTbValidateRsdp
*
- * PARAMETERS: Rsdp - Pointer to unvalidated RSDP
+ * PARAMETERS: Rsdp - Pointer to unvalidated RSDP
*
* RETURN: Status
*
@@ -148,17 +147,20 @@ AcpiTbScanMemoryForRsdp (
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiTbValidateRsdp (
- RSDP_DESCRIPTOR *Rsdp)
+ ACPI_TABLE_RSDP *Rsdp)
{
ACPI_FUNCTION_ENTRY ();
/*
- * The signature and checksum must both be correct
+ * The signature and checksum must both be correct
+ *
+ * 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, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0)
+ if (ACPI_STRNCMP ((char *) Rsdp, ACPI_SIG_RSDP, sizeof (ACPI_SIG_RSDP)-1) != 0)
{
/* Nope, BAD Signature */
@@ -167,7 +169,7 @@ AcpiTbValidateRsdp (
/* Check the standard checksum */
- if (AcpiTbGenerateChecksum (Rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0)
+ if (AcpiTbChecksum ((UINT8 *) Rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0)
{
return (AE_BAD_CHECKSUM);
}
@@ -175,7 +177,7 @@ AcpiTbValidateRsdp (
/* Check extended checksum if table version >= 2 */
if ((Rsdp->Revision >= 2) &&
- (AcpiTbGenerateChecksum (Rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0))
+ (AcpiTbChecksum ((UINT8 *) Rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0))
{
return (AE_BAD_CHECKSUM);
}
@@ -186,356 +188,129 @@ AcpiTbValidateRsdp (
/*******************************************************************************
*
- * FUNCTION: AcpiTbFindTable
- *
- * PARAMETERS: Signature - String with ACPI table signature
- * OemId - String with the table OEM ID
- * OemTableId - String with the OEM Table ID
- * TablePtr - Where the table pointer is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Find an ACPI table (in the RSDT/XSDT) that matches the
- * Signature, OEM ID and OEM Table ID.
+ * FUNCTION: AcpiTbFindRsdp
*
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiTbFindTable (
- char *Signature,
- char *OemId,
- char *OemTableId,
- ACPI_TABLE_HEADER **TablePtr)
-{
- ACPI_STATUS Status;
- ACPI_TABLE_HEADER *Table;
-
-
- ACPI_FUNCTION_TRACE ("TbFindTable");
-
-
- /* Validate string lengths */
-
- if ((ACPI_STRLEN (Signature) > ACPI_NAME_SIZE) ||
- (ACPI_STRLEN (OemId) > sizeof (Table->OemId)) ||
- (ACPI_STRLEN (OemTableId) > sizeof (Table->OemTableId)))
- {
- return_ACPI_STATUS (AE_AML_STRING_LIMIT);
- }
-
- if (!ACPI_STRNCMP (Signature, DSDT_SIG, ACPI_NAME_SIZE))
- {
- /*
- * The DSDT pointer is contained in the FADT, not the RSDT.
- * This code should suffice, because the only code that would perform
- * a "find" on the DSDT is the DataTableRegion() AML opcode -- in
- * which case, the DSDT is guaranteed to be already loaded.
- * If this becomes insufficient, the FADT will have to be found first.
- */
- if (!AcpiGbl_DSDT)
- {
- return_ACPI_STATUS (AE_NO_ACPI_TABLES);
- }
- Table = AcpiGbl_DSDT;
- }
- else
- {
- /* Find the table */
-
- Status = AcpiGetFirmwareTable (Signature, 1,
- ACPI_LOGICAL_ADDRESSING, &Table);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
- }
-
- /* Check OemId and OemTableId */
-
- if ((OemId[0] && ACPI_STRNCMP (
- OemId, Table->OemId,
- sizeof (Table->OemId))) ||
-
- (OemTableId[0] && ACPI_STRNCMP (
- OemTableId, Table->OemTableId,
- sizeof (Table->OemTableId))))
- {
- return_ACPI_STATUS (AE_AML_NAME_NOT_FOUND);
- }
-
- ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Found table [%4.4s]\n",
- Table->Signature));
-
- *TablePtr = Table;
- return_ACPI_STATUS (AE_OK);
-}
-
-
-/*******************************************************************************
+ * PARAMETERS: TableAddress - Where the table pointer is returned
*
- * FUNCTION: AcpiGetFirmwareTable
+ * RETURN: Status, RSDP physical address
*
- * PARAMETERS: Signature - Any ACPI table signature
- * Instance - the non zero instance of the table, allows
- * support for multiple tables of the same type
- * Flags - Physical/Virtual support
- * TablePointer - Where a buffer containing the table is
- * returned
+ * DESCRIPTION: Search lower 1Mbyte of memory for the root system descriptor
+ * pointer structure. If it is found, set *RSDP to point to it.
*
- * RETURN: Status
+ * NOTE1: The RSDP must be either in the first 1K of the Extended
+ * BIOS Data Area or between E0000 and FFFFF (From ACPI Spec.)
+ * Only a 32-bit physical address is necessary.
*
- * DESCRIPTION: This function is called to get an ACPI table. A buffer is
- * allocated for the table and returned in TablePointer.
- * This table will be a complete table including the header.
+ * NOTE2: This function is always available, regardless of the
+ * initialization state of the rest of ACPI.
*
******************************************************************************/
ACPI_STATUS
-AcpiGetFirmwareTable (
- ACPI_STRING Signature,
- UINT32 Instance,
- UINT32 Flags,
- ACPI_TABLE_HEADER **TablePointer)
+AcpiFindRootPointer (
+ ACPI_NATIVE_UINT *TableAddress)
{
- ACPI_STATUS Status;
- ACPI_POINTER Address;
- ACPI_TABLE_HEADER *Header = NULL;
- ACPI_TABLE_DESC *TableInfo = NULL;
- ACPI_TABLE_DESC *RsdtInfo;
- UINT32 TableCount;
- UINT32 i;
- UINT32 j;
-
+ UINT8 *TablePtr;
+ UINT8 *MemRover;
+ UINT32 PhysicalAddress;
- ACPI_FUNCTION_TRACE ("AcpiGetFirmwareTable");
+ ACPI_FUNCTION_TRACE (AcpiFindRootPointer);
- /*
- * Ensure that at least the table manager is initialized. We don't
- * require that the entire ACPI subsystem is up for this interface.
- * If we have a buffer, we must have a length too
- */
- if ((Instance == 0) ||
- (!Signature) ||
- (!TablePointer))
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
- /* Ensure that we have a RSDP */
+ /* 1a) Get the location of the Extended BIOS Data Area (EBDA) */
- if (!AcpiGbl_RSDP)
+ TablePtr = AcpiOsMapMemory (
+ (ACPI_PHYSICAL_ADDRESS) ACPI_EBDA_PTR_LOCATION,
+ ACPI_EBDA_PTR_LENGTH);
+ if (!TablePtr)
{
- /* Get the RSDP */
-
- Status = AcpiOsGetRootPointer (Flags, &Address);
- if (ACPI_FAILURE (Status))
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "RSDP not found\n"));
- return_ACPI_STATUS (AE_NO_ACPI_TABLES);
- }
-
- /* Map and validate the RSDP */
-
- if ((Flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING)
- {
- Status = AcpiOsMapMemory (Address.Pointer.Physical,
- sizeof (RSDP_DESCRIPTOR), (void *) &AcpiGbl_RSDP);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
- }
- else
- {
- AcpiGbl_RSDP = Address.Pointer.Logical;
- }
-
- /* The RDSP signature and checksum must both be correct */
-
- Status = AcpiTbValidateRsdp (AcpiGbl_RSDP);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
- }
-
- /* Get the RSDT address via the RSDP */
-
- AcpiTbGetRsdtAddress (&Address);
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "RSDP located at %p, RSDT physical=%8.8X%8.8X\n",
- AcpiGbl_RSDP,
- ACPI_FORMAT_UINT64 (Address.Pointer.Value)));
-
- /* Insert ProcessorMode flags */
-
- Address.PointerType |= Flags;
-
- /* Get and validate the RSDT */
+ ACPI_ERROR ((AE_INFO,
+ "Could not map memory at %8.8X for length %X",
+ ACPI_EBDA_PTR_LOCATION, ACPI_EBDA_PTR_LENGTH));
- RsdtInfo = ACPI_MEM_CALLOCATE (sizeof (ACPI_TABLE_DESC));
- if (!RsdtInfo)
- {
return_ACPI_STATUS (AE_NO_MEMORY);
}
- Status = AcpiTbGetTable (&Address, RsdtInfo);
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
-
- Status = AcpiTbValidateRsdt (RsdtInfo->Pointer);
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
-
- /* Allocate a scratch table header and table descriptor */
+ ACPI_MOVE_16_TO_32 (&PhysicalAddress, TablePtr);
- Header = ACPI_MEM_ALLOCATE (sizeof (ACPI_TABLE_HEADER));
- if (!Header)
- {
- Status = AE_NO_MEMORY;
- goto Cleanup;
- }
+ /* Convert segment part to physical address */
- TableInfo = ACPI_MEM_ALLOCATE (sizeof (ACPI_TABLE_DESC));
- if (!TableInfo)
- {
- Status = AE_NO_MEMORY;
- goto Cleanup;
- }
+ PhysicalAddress <<= 4;
+ AcpiOsUnmapMemory (TablePtr, ACPI_EBDA_PTR_LENGTH);
- /* Get the number of table pointers within the RSDT */
+ /* EBDA present? */
- TableCount = AcpiTbGetTableCount (AcpiGbl_RSDP, RsdtInfo->Pointer);
- Address.PointerType = AcpiGbl_TableFlags | Flags;
-
- /*
- * Search the RSDT/XSDT for the correct instance of the
- * requested table
- */
- for (i = 0, j = 0; i < TableCount; i++)
+ if (PhysicalAddress > 0x400)
{
/*
- * Get the next table pointer, handle RSDT vs. XSDT
- * RSDT pointers are 32 bits, XSDT pointers are 64 bits
+ * 1b) Search EBDA paragraphs (EBDA is required to be a
+ * minimum of 1K length)
*/
- if (AcpiGbl_RootTableType == ACPI_TABLE_TYPE_RSDT)
+ TablePtr = AcpiOsMapMemory (
+ (ACPI_NATIVE_UINT) PhysicalAddress,
+ ACPI_EBDA_WINDOW_SIZE);
+ if (!TablePtr)
{
- Address.Pointer.Value = (ACPI_CAST_PTR (
- RSDT_DESCRIPTOR, RsdtInfo->Pointer))->TableOffsetEntry[i];
- }
- else
- {
- Address.Pointer.Value = ACPI_GET_ADDRESS ((ACPI_CAST_PTR (
- XSDT_DESCRIPTOR, RsdtInfo->Pointer))->TableOffsetEntry[i]);
+ ACPI_ERROR ((AE_INFO,
+ "Could not map memory at %8.8X for length %X",
+ PhysicalAddress, ACPI_EBDA_WINDOW_SIZE));
+
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
- /* Get the table header */
+ MemRover = AcpiTbScanMemoryForRsdp (TablePtr, ACPI_EBDA_WINDOW_SIZE);
+ AcpiOsUnmapMemory (TablePtr, ACPI_EBDA_WINDOW_SIZE);
- Status = AcpiTbGetTableHeader (&Address, Header);
- if (ACPI_FAILURE (Status))
+ if (MemRover)
{
- goto Cleanup;
- }
+ /* Return the physical address */
- /* Compare table signatures and table instance */
+ PhysicalAddress += (UINT32) ACPI_PTR_DIFF (MemRover, TablePtr);
- if (!ACPI_STRNCMP (Header->Signature, Signature, ACPI_NAME_SIZE))
- {
- /* An instance of the table was found */
-
- j++;
- if (j >= Instance)
- {
- /* Found the correct instance, get the entire table */
-
- Status = AcpiTbGetTableBody (&Address, Header, TableInfo);
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
-
- *TablePointer = TableInfo->Pointer;
- goto Cleanup;
- }
+ *TableAddress = PhysicalAddress;
+ return_ACPI_STATUS (AE_OK);
}
}
- /* Did not find the table */
-
- Status = AE_NOT_EXIST;
-
+ /*
+ * 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh
+ */
+ TablePtr = AcpiOsMapMemory (
+ (ACPI_PHYSICAL_ADDRESS) ACPI_HI_RSDP_WINDOW_BASE,
+ ACPI_HI_RSDP_WINDOW_SIZE);
-Cleanup:
- if (RsdtInfo->Pointer)
+ if (!TablePtr)
{
- AcpiOsUnmapMemory (RsdtInfo->Pointer,
- (ACPI_SIZE) RsdtInfo->Pointer->Length);
- }
- ACPI_MEM_FREE (RsdtInfo);
+ ACPI_ERROR ((AE_INFO,
+ "Could not map memory at %8.8X for length %X",
+ ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE));
- if (Header)
- {
- ACPI_MEM_FREE (Header);
- }
- if (TableInfo)
- {
- ACPI_MEM_FREE (TableInfo);
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
- return_ACPI_STATUS (Status);
-}
-
-
-/* TBD: Move to a new file */
-
-#if ACPI_MACHINE_WIDTH != 16
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiFindRootPointer
- *
- * PARAMETERS: Flags - Logical/Physical addressing
- * RsdpAddress - Where to place the RSDP address
- *
- * RETURN: Status, Physical address of the RSDP
- *
- * DESCRIPTION: Find the RSDP
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiFindRootPointer (
- UINT32 Flags,
- ACPI_POINTER *RsdpAddress)
-{
- ACPI_TABLE_DESC TableInfo;
- ACPI_STATUS Status;
-
- ACPI_FUNCTION_TRACE ("AcpiFindRootPointer");
+ MemRover = AcpiTbScanMemoryForRsdp (TablePtr, ACPI_HI_RSDP_WINDOW_SIZE);
+ AcpiOsUnmapMemory (TablePtr, ACPI_HI_RSDP_WINDOW_SIZE);
-
- /* Get the RSDP */
-
- Status = AcpiTbFindRsdp (&TableInfo, Flags);
- if (ACPI_FAILURE (Status))
+ if (MemRover)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "RSDP structure not found, %s Flags=%X\n",
- AcpiFormatException (Status), Flags));
+ /* Return the physical address */
- return_ACPI_STATUS (AE_NO_ACPI_TABLES);
+ PhysicalAddress = (UINT32)
+ (ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF (MemRover, TablePtr));
+
+ *TableAddress = PhysicalAddress;
+ return_ACPI_STATUS (AE_OK);
}
- RsdpAddress->PointerType = ACPI_PHYSICAL_POINTER;
- RsdpAddress->Pointer.Physical = TableInfo.PhysicalAddress;
- return_ACPI_STATUS (AE_OK);
+ /* A valid RSDP was not found */
+
+ ACPI_ERROR ((AE_INFO, "A valid RSDP was not found"));
+ return_ACPI_STATUS (AE_NOT_FOUND);
}
+ACPI_EXPORT_SYMBOL (AcpiFindRootPointer)
+
/*******************************************************************************
*
@@ -560,7 +335,7 @@ AcpiTbScanMemoryForRsdp (
UINT8 *EndAddress;
- ACPI_FUNCTION_TRACE ("TbScanMemoryForRsdp");
+ ACPI_FUNCTION_TRACE (TbScanMemoryForRsdp);
EndAddress = StartAddress + Length;
@@ -572,7 +347,7 @@ AcpiTbScanMemoryForRsdp (
{
/* The RSDP signature and checksum must both be correct */
- Status = AcpiTbValidateRsdp (ACPI_CAST_PTR (RSDP_DESCRIPTOR, MemRover));
+ Status = AcpiTbValidateRsdp (ACPI_CAST_PTR (ACPI_TABLE_RSDP, MemRover));
if (ACPI_SUCCESS (Status))
{
/* Sig and checksum valid, we have found a real RSDP */
@@ -593,186 +368,3 @@ AcpiTbScanMemoryForRsdp (
return_PTR (NULL);
}
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiTbFindRsdp
- *
- * PARAMETERS: TableInfo - Where the table info is returned
- * Flags - Current memory mode (logical vs.
- * physical addressing)
- *
- * RETURN: Status, RSDP physical address
- *
- * DESCRIPTION: Search lower 1Mbyte of memory for the root system descriptor
- * pointer structure. If it is found, set *RSDP to point to it.
- *
- * NOTE1: The RSDP must be either in the first 1K of the Extended
- * BIOS Data Area or between E0000 and FFFFF (From ACPI Spec.)
- * Only a 32-bit physical address is necessary.
- *
- * NOTE2: This function is always available, regardless of the
- * initialization state of the rest of ACPI.
- *
- ******************************************************************************/
-
-static ACPI_STATUS
-AcpiTbFindRsdp (
- ACPI_TABLE_DESC *TableInfo,
- UINT32 Flags)
-{
- UINT8 *TablePtr;
- UINT8 *MemRover;
- UINT32 PhysicalAddress;
- ACPI_STATUS Status;
-
-
- ACPI_FUNCTION_TRACE ("TbFindRsdp");
-
-
- /*
- * Scan supports either logical addressing or physical addressing
- */
- if ((Flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING)
- {
- /* 1a) Get the location of the Extended BIOS Data Area (EBDA) */
-
- Status = AcpiOsMapMemory (
- (ACPI_PHYSICAL_ADDRESS) ACPI_EBDA_PTR_LOCATION,
- ACPI_EBDA_PTR_LENGTH, (void *) &TablePtr);
- if (ACPI_FAILURE (Status))
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Could not map memory at %8.8X for length %X\n",
- ACPI_EBDA_PTR_LOCATION, ACPI_EBDA_PTR_LENGTH));
-
- return_ACPI_STATUS (Status);
- }
-
- ACPI_MOVE_16_TO_32 (&PhysicalAddress, TablePtr);
-
- /* Convert segment part to physical address */
-
- PhysicalAddress <<= 4;
- AcpiOsUnmapMemory (TablePtr, ACPI_EBDA_PTR_LENGTH);
-
- /* EBDA present? */
-
- if (PhysicalAddress > 0x400)
- {
- /*
- * 1b) Search EBDA paragraphs (EBDA is required to be a
- * minimum of 1K length)
- */
- Status = AcpiOsMapMemory (
- (ACPI_PHYSICAL_ADDRESS) PhysicalAddress,
- ACPI_EBDA_WINDOW_SIZE, (void *) &TablePtr);
- if (ACPI_FAILURE (Status))
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Could not map memory at %8.8X for length %X\n",
- PhysicalAddress, ACPI_EBDA_WINDOW_SIZE));
-
- return_ACPI_STATUS (Status);
- }
-
- MemRover = AcpiTbScanMemoryForRsdp (TablePtr,
- ACPI_EBDA_WINDOW_SIZE);
- AcpiOsUnmapMemory (TablePtr, ACPI_EBDA_WINDOW_SIZE);
-
- if (MemRover)
- {
- /* Return the physical address */
-
- PhysicalAddress += ACPI_PTR_DIFF (MemRover, TablePtr);
-
- TableInfo->PhysicalAddress =
- (ACPI_PHYSICAL_ADDRESS) PhysicalAddress;
- return_ACPI_STATUS (AE_OK);
- }
- }
-
- /*
- * 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh
- */
- Status = AcpiOsMapMemory (
- (ACPI_PHYSICAL_ADDRESS) ACPI_HI_RSDP_WINDOW_BASE,
- ACPI_HI_RSDP_WINDOW_SIZE, (void *) &TablePtr);
-
- if (ACPI_FAILURE (Status))
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Could not map memory at %8.8X for length %X\n",
- ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE));
-
- return_ACPI_STATUS (Status);
- }
-
- MemRover = AcpiTbScanMemoryForRsdp (TablePtr, ACPI_HI_RSDP_WINDOW_SIZE);
- AcpiOsUnmapMemory (TablePtr, ACPI_HI_RSDP_WINDOW_SIZE);
-
- if (MemRover)
- {
- /* Return the physical address */
-
- PhysicalAddress =
- ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF (MemRover, TablePtr);
-
- TableInfo->PhysicalAddress =
- (ACPI_PHYSICAL_ADDRESS) PhysicalAddress;
- return_ACPI_STATUS (AE_OK);
- }
- }
-
- /*
- * Physical addressing
- */
- else
- {
- /* 1a) Get the location of the EBDA */
-
- ACPI_MOVE_16_TO_32 (&PhysicalAddress, ACPI_EBDA_PTR_LOCATION);
- PhysicalAddress <<= 4; /* Convert segment to physical address */
-
- /* EBDA present? */
-
- if (PhysicalAddress > 0x400)
- {
- /*
- * 1b) Search EBDA paragraphs (EBDA is required to be a minimum of
- * 1K length)
- */
- MemRover = AcpiTbScanMemoryForRsdp (
- ACPI_PHYSADDR_TO_PTR (PhysicalAddress),
- ACPI_EBDA_WINDOW_SIZE);
- if (MemRover)
- {
- /* Return the physical address */
-
- TableInfo->PhysicalAddress = ACPI_TO_INTEGER (MemRover);
- return_ACPI_STATUS (AE_OK);
- }
- }
-
- /* 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh */
-
- MemRover = AcpiTbScanMemoryForRsdp (
- ACPI_PHYSADDR_TO_PTR (ACPI_HI_RSDP_WINDOW_BASE),
- ACPI_HI_RSDP_WINDOW_SIZE);
- if (MemRover)
- {
- /* Found it, return the physical address */
-
- TableInfo->PhysicalAddress = ACPI_TO_INTEGER (MemRover);
- return_ACPI_STATUS (AE_OK);
- }
- }
-
- /* A valid RSDP was not found */
-
- ACPI_REPORT_ERROR (("No valid RSDP was found\n"));
- return_ACPI_STATUS (AE_NOT_FOUND);
-}
-
-#endif
-
diff --git a/sys/contrib/dev/acpica/utalloc.c b/sys/contrib/dev/acpica/utalloc.c
index cc5fd01..d1528e3 100644
--- a/sys/contrib/dev/acpica/utalloc.c
+++ b/sys/contrib/dev/acpica/utalloc.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: utalloc - local memory allocation routines
- * $Revision: 1.149 $
+ * $Revision: 1.164 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -117,40 +117,11 @@
#define __UTALLOC_C__
#include <contrib/dev/acpica/acpi.h>
+#include <contrib/dev/acpica/acdebug.h>
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME ("utalloc")
-/* Local prototypes */
-
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
-static ACPI_DEBUG_MEM_BLOCK *
-AcpiUtFindAllocation (
- void *Allocation);
-
-static ACPI_STATUS
-AcpiUtTrackAllocation (
- ACPI_DEBUG_MEM_BLOCK *Address,
- ACPI_SIZE Size,
- UINT8 AllocType,
- UINT32 Component,
- char *Module,
- UINT32 Line);
-
-static ACPI_STATUS
-AcpiUtRemoveAllocation (
- ACPI_DEBUG_MEM_BLOCK *Address,
- UINT32 Component,
- char *Module,
- UINT32 Line);
-
-static ACPI_STATUS
-AcpiUtCreateList (
- char *ListName,
- UINT16 ObjectSize,
- ACPI_MEMORY_LIST **ReturnCache);
-#endif
-
/*******************************************************************************
*
@@ -171,26 +142,14 @@ AcpiUtCreateCaches (
ACPI_STATUS Status;
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
-
- /* Memory allocation lists */
-
- Status = AcpiUtCreateList ("Acpi-Global", 0,
- &AcpiGbl_GlobalList);
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
+ /* Object Caches, for frequently used objects */
- Status = AcpiUtCreateList ("Acpi-Namespace", sizeof (ACPI_NAMESPACE_NODE),
- &AcpiGbl_NsNodeList);
+ Status = AcpiOsCreateCache ("Acpi-Namespace", sizeof (ACPI_NAMESPACE_NODE),
+ ACPI_MAX_NAMESPACE_CACHE_DEPTH, &AcpiGbl_NamespaceCache);
if (ACPI_FAILURE (Status))
{
return (Status);
}
-#endif
-
- /* Object Caches, for frequently used objects */
Status = AcpiOsCreateCache ("Acpi-State", sizeof (ACPI_GENERIC_STATE),
ACPI_MAX_STATE_CACHE_DEPTH, &AcpiGbl_StateCache);
@@ -220,6 +179,26 @@ AcpiUtCreateCaches (
return (Status);
}
+
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+
+ /* Memory allocation lists */
+
+ Status = AcpiUtCreateList ("Acpi-Global", 0,
+ &AcpiGbl_GlobalList);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ Status = AcpiUtCreateList ("Acpi-Namespace", sizeof (ACPI_NAMESPACE_NODE),
+ &AcpiGbl_NsNodeList);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+#endif
+
return (AE_OK);
}
@@ -240,6 +219,18 @@ ACPI_STATUS
AcpiUtDeleteCaches (
void)
{
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+ char Buffer[7];
+
+ if (AcpiGbl_DisplayFinalMemStats)
+ {
+ ACPI_STRCPY (Buffer, "MEMORY");
+ AcpiDbDisplayStatistics (Buffer);
+ }
+#endif
+
+ (void) AcpiOsDeleteCache (AcpiGbl_NamespaceCache);
+ AcpiGbl_NamespaceCache = NULL;
(void) AcpiOsDeleteCache (AcpiGbl_StateCache);
AcpiGbl_StateCache = NULL;
@@ -253,6 +244,22 @@ AcpiUtDeleteCaches (
(void) AcpiOsDeleteCache (AcpiGbl_PsNodeExtCache);
AcpiGbl_PsNodeExtCache = NULL;
+
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+
+ /* Debug only - display leftover memory allocation, if any */
+
+ AcpiUtDumpAllocations (ACPI_UINT32_MAX, NULL);
+
+ /* Free memory lists */
+
+ AcpiOsFree (AcpiGbl_GlobalList);
+ AcpiGbl_GlobalList = NULL;
+
+ AcpiOsFree (AcpiGbl_NsNodeList);
+ AcpiGbl_NsNodeList = NULL;
+#endif
+
return (AE_OK);
}
@@ -353,7 +360,7 @@ AcpiUtInitializeBuffer (
/* Allocate a new buffer with local interface to allow tracking */
- Buffer->Pointer = ACPI_MEM_CALLOCATE (RequiredLength);
+ Buffer->Pointer = ACPI_ALLOCATE_ZEROED (RequiredLength);
if (!Buffer->Pointer)
{
return (AE_NO_MEMORY);
@@ -393,7 +400,7 @@ AcpiUtInitializeBuffer (
*
* RETURN: Address of the allocated memory on success, NULL on failure.
*
- * DESCRIPTION: The subsystem's equivalent of malloc.
+ * DESCRIPTION: Subsystem equivalent of malloc.
*
******************************************************************************/
@@ -407,15 +414,15 @@ AcpiUtAllocate (
void *Allocation;
- ACPI_FUNCTION_TRACE_U32 ("UtAllocate", Size);
+ ACPI_FUNCTION_TRACE_U32 (UtAllocate, Size);
/* Check for an inadvertent size of zero bytes */
if (!Size)
{
- _ACPI_REPORT_ERROR (Module, Line, Component,
- ("UtAllocate: Attempt to allocate zero bytes, allocating 1 byte\n"));
+ ACPI_WARNING ((Module, Line,
+ "Attempt to allocate zero bytes, allocating 1 byte"));
Size = 1;
}
@@ -424,8 +431,8 @@ AcpiUtAllocate (
{
/* Report allocation error */
- _ACPI_REPORT_ERROR (Module, Line, Component,
- ("UtAllocate: Could not allocate size %X\n", (UINT32) Size));
+ ACPI_WARNING ((Module, Line,
+ "Could not allocate size %X", (UINT32) Size));
return_PTR (NULL);
}
@@ -436,7 +443,7 @@ AcpiUtAllocate (
/*******************************************************************************
*
- * FUNCTION: AcpiUtCallocate
+ * FUNCTION: AcpiUtAllocateZeroed
*
* PARAMETERS: Size - Size of the allocation
* Component - Component type of caller
@@ -445,12 +452,12 @@ AcpiUtAllocate (
*
* RETURN: Address of the allocated memory on success, NULL on failure.
*
- * DESCRIPTION: Subsystem equivalent of calloc.
+ * DESCRIPTION: Subsystem equivalent of calloc. Allocate and zero memory.
*
******************************************************************************/
void *
-AcpiUtCallocate (
+AcpiUtAllocateZeroed (
ACPI_SIZE Size,
UINT32 Component,
char *Module,
@@ -459,604 +466,17 @@ AcpiUtCallocate (
void *Allocation;
- ACPI_FUNCTION_TRACE_U32 ("UtCallocate", Size);
-
-
- /* Check for an inadvertent size of zero bytes */
-
- if (!Size)
- {
- _ACPI_REPORT_ERROR (Module, Line, Component,
- ("UtCallocate: Attempt to allocate zero bytes, allocating 1 byte\n"));
- Size = 1;
- }
-
- Allocation = AcpiOsAllocate (Size);
- if (!Allocation)
- {
- /* Report allocation error */
-
- _ACPI_REPORT_ERROR (Module, Line, Component,
- ("UtCallocate: Could not allocate size %X\n", (UINT32) Size));
- return_PTR (NULL);
- }
-
- /* Clear the memory block */
-
- ACPI_MEMSET (Allocation, 0, Size);
- return_PTR (Allocation);
-}
-
-
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
-/*
- * These procedures are used for tracking memory leaks in the subsystem, and
- * they get compiled out when the ACPI_DBG_TRACK_ALLOCATIONS is not set.
- *
- * Each memory allocation is tracked via a doubly linked list. Each
- * element contains the caller's component, module name, function name, and
- * line number. AcpiUtAllocate and AcpiUtCallocate call
- * AcpiUtTrackAllocation to add an element to the list; deletion
- * occurs in the body of AcpiUtFree.
- */
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtCreateList
- *
- * PARAMETERS: CacheName - Ascii name for the cache
- * ObjectSize - Size of each cached object
- * ReturnCache - Where the new cache object is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Create a local memory list for tracking purposed
- *
- ******************************************************************************/
-
-static ACPI_STATUS
-AcpiUtCreateList (
- char *ListName,
- UINT16 ObjectSize,
- ACPI_MEMORY_LIST **ReturnCache)
-{
- ACPI_MEMORY_LIST *Cache;
-
-
- Cache = AcpiOsAllocate (sizeof (ACPI_MEMORY_LIST));
- if (!Cache)
- {
- return (AE_NO_MEMORY);
- }
-
- ACPI_MEMSET (Cache, 0, sizeof (ACPI_MEMORY_LIST));
-
- Cache->ListName = ListName;
- Cache->ObjectSize = ObjectSize;
-
- *ReturnCache = Cache;
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtAllocateAndTrack
- *
- * PARAMETERS: Size - Size of the allocation
- * Component - Component type of caller
- * Module - Source file name of caller
- * Line - Line number of caller
- *
- * RETURN: Address of the allocated memory on success, NULL on failure.
- *
- * DESCRIPTION: The subsystem's equivalent of malloc.
- *
- ******************************************************************************/
-
-void *
-AcpiUtAllocateAndTrack (
- ACPI_SIZE Size,
- UINT32 Component,
- char *Module,
- UINT32 Line)
-{
- ACPI_DEBUG_MEM_BLOCK *Allocation;
- ACPI_STATUS Status;
-
-
- Allocation = AcpiUtAllocate (Size + sizeof (ACPI_DEBUG_MEM_HEADER),
- Component, Module, Line);
- if (!Allocation)
- {
- return (NULL);
- }
-
- Status = AcpiUtTrackAllocation (Allocation, Size,
- ACPI_MEM_MALLOC, Component, Module, Line);
- if (ACPI_FAILURE (Status))
- {
- AcpiOsFree (Allocation);
- return (NULL);
- }
-
- AcpiGbl_GlobalList->TotalAllocated++;
- AcpiGbl_GlobalList->CurrentTotalSize += (UINT32) Size;
-
- return ((void *) &Allocation->UserSpace);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtCallocateAndTrack
- *
- * PARAMETERS: Size - Size of the allocation
- * Component - Component type of caller
- * Module - Source file name of caller
- * Line - Line number of caller
- *
- * RETURN: Address of the allocated memory on success, NULL on failure.
- *
- * DESCRIPTION: Subsystem equivalent of calloc.
- *
- ******************************************************************************/
-
-void *
-AcpiUtCallocateAndTrack (
- ACPI_SIZE Size,
- UINT32 Component,
- char *Module,
- UINT32 Line)
-{
- ACPI_DEBUG_MEM_BLOCK *Allocation;
- ACPI_STATUS Status;
-
-
- Allocation = AcpiUtCallocate (Size + sizeof (ACPI_DEBUG_MEM_HEADER),
- Component, Module, Line);
- if (!Allocation)
- {
- /* Report allocation error */
-
- _ACPI_REPORT_ERROR (Module, Line, Component,
- ("UtCallocate: Could not allocate size %X\n", (UINT32) Size));
- return (NULL);
- }
-
- Status = AcpiUtTrackAllocation (Allocation, Size,
- ACPI_MEM_CALLOC, Component, Module, Line);
- if (ACPI_FAILURE (Status))
- {
- AcpiOsFree (Allocation);
- return (NULL);
- }
-
- AcpiGbl_GlobalList->TotalAllocated++;
- AcpiGbl_GlobalList->CurrentTotalSize += (UINT32) Size;
-
- return ((void *) &Allocation->UserSpace);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtFreeAndTrack
- *
- * PARAMETERS: Allocation - Address of the memory to deallocate
- * Component - Component type of caller
- * Module - Source file name of caller
- * Line - Line number of caller
- *
- * RETURN: None
- *
- * DESCRIPTION: Frees the memory at Allocation
- *
- ******************************************************************************/
-
-void
-AcpiUtFreeAndTrack (
- void *Allocation,
- UINT32 Component,
- char *Module,
- UINT32 Line)
-{
- ACPI_DEBUG_MEM_BLOCK *DebugBlock;
- ACPI_STATUS Status;
-
-
- ACPI_FUNCTION_TRACE_PTR ("UtFree", Allocation);
-
-
- if (NULL == Allocation)
- {
- _ACPI_REPORT_ERROR (Module, Line, Component,
- ("AcpiUtFree: Attempt to delete a NULL address\n"));
-
- return_VOID;
- }
-
- DebugBlock = ACPI_CAST_PTR (ACPI_DEBUG_MEM_BLOCK,
- (((char *) Allocation) - sizeof (ACPI_DEBUG_MEM_HEADER)));
-
- AcpiGbl_GlobalList->TotalFreed++;
- AcpiGbl_GlobalList->CurrentTotalSize -= DebugBlock->Size;
-
- Status = AcpiUtRemoveAllocation (DebugBlock,
- Component, Module, Line);
- if (ACPI_FAILURE (Status))
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not free memory, %s\n",
- AcpiFormatException (Status)));
- }
-
- AcpiOsFree (DebugBlock);
-
- ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "%p freed\n", Allocation));
-
- return_VOID;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtFindAllocation
- *
- * PARAMETERS: Allocation - Address of allocated memory
- *
- * RETURN: A list element if found; NULL otherwise.
- *
- * DESCRIPTION: Searches for an element in the global allocation tracking list.
- *
- ******************************************************************************/
-
-static ACPI_DEBUG_MEM_BLOCK *
-AcpiUtFindAllocation (
- void *Allocation)
-{
- ACPI_DEBUG_MEM_BLOCK *Element;
-
-
ACPI_FUNCTION_ENTRY ();
- Element = AcpiGbl_GlobalList->ListHead;
-
- /* Search for the address. */
-
- while (Element)
+ Allocation = AcpiUtAllocate (Size, Component, Module, Line);
+ if (Allocation)
{
- if (Element == Allocation)
- {
- return (Element);
- }
+ /* Clear the memory block */
- Element = Element->Next;
+ ACPI_MEMSET (Allocation, 0, Size);
}
- return (NULL);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtTrackAllocation
- *
- * PARAMETERS: Allocation - Address of allocated memory
- * Size - Size of the allocation
- * AllocType - MEM_MALLOC or MEM_CALLOC
- * Component - Component type of caller
- * Module - Source file name of caller
- * Line - Line number of caller
- *
- * RETURN: None.
- *
- * DESCRIPTION: Inserts an element into the global allocation tracking list.
- *
- ******************************************************************************/
-
-static ACPI_STATUS
-AcpiUtTrackAllocation (
- ACPI_DEBUG_MEM_BLOCK *Allocation,
- ACPI_SIZE Size,
- UINT8 AllocType,
- UINT32 Component,
- char *Module,
- UINT32 Line)
-{
- ACPI_MEMORY_LIST *MemList;
- ACPI_DEBUG_MEM_BLOCK *Element;
- ACPI_STATUS Status = AE_OK;
-
-
- ACPI_FUNCTION_TRACE_PTR ("UtTrackAllocation", Allocation);
-
-
- MemList = AcpiGbl_GlobalList;
- Status = AcpiUtAcquireMutex (ACPI_MTX_MEMORY);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /*
- * Search list for this address to make sure it is not already on the list.
- * This will catch several kinds of problems.
- */
- Element = AcpiUtFindAllocation (Allocation);
- if (Element)
- {
- ACPI_REPORT_ERROR ((
- "UtTrackAllocation: Allocation already present in list! (%p)\n",
- Allocation));
-
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Element %p Address %p\n",
- Element, Allocation));
-
- goto UnlockAndExit;
- }
-
- /* Fill in the instance data. */
-
- Allocation->Size = (UINT32) Size;
- Allocation->AllocType = AllocType;
- Allocation->Component = Component;
- Allocation->Line = Line;
-
- ACPI_STRNCPY (Allocation->Module, Module, ACPI_MAX_MODULE_NAME);
- Allocation->Module[ACPI_MAX_MODULE_NAME-1] = 0;
-
- /* Insert at list head */
-
- if (MemList->ListHead)
- {
- ((ACPI_DEBUG_MEM_BLOCK *)(MemList->ListHead))->Previous = Allocation;
- }
-
- Allocation->Next = MemList->ListHead;
- Allocation->Previous = NULL;
-
- MemList->ListHead = Allocation;
-
-
-UnlockAndExit:
- Status = AcpiUtReleaseMutex (ACPI_MTX_MEMORY);
- return_ACPI_STATUS (Status);
+ return (Allocation);
}
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtRemoveAllocation
- *
- * PARAMETERS: Allocation - Address of allocated memory
- * Component - Component type of caller
- * Module - Source file name of caller
- * Line - Line number of caller
- *
- * RETURN:
- *
- * DESCRIPTION: Deletes an element from the global allocation tracking list.
- *
- ******************************************************************************/
-
-static ACPI_STATUS
-AcpiUtRemoveAllocation (
- ACPI_DEBUG_MEM_BLOCK *Allocation,
- UINT32 Component,
- char *Module,
- UINT32 Line)
-{
- ACPI_MEMORY_LIST *MemList;
- ACPI_STATUS Status;
-
-
- ACPI_FUNCTION_TRACE ("UtRemoveAllocation");
-
-
- MemList = AcpiGbl_GlobalList;
- if (NULL == MemList->ListHead)
- {
- /* No allocations! */
-
- _ACPI_REPORT_ERROR (Module, Line, Component,
- ("UtRemoveAllocation: Empty allocation list, nothing to free!\n"));
-
- return_ACPI_STATUS (AE_OK);
- }
-
- Status = AcpiUtAcquireMutex (ACPI_MTX_MEMORY);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /* Unlink */
-
- if (Allocation->Previous)
- {
- (Allocation->Previous)->Next = Allocation->Next;
- }
- else
- {
- MemList->ListHead = Allocation->Next;
- }
-
- if (Allocation->Next)
- {
- (Allocation->Next)->Previous = Allocation->Previous;
- }
-
- /* Mark the segment as deleted */
-
- ACPI_MEMSET (&Allocation->UserSpace, 0xEA, Allocation->Size);
-
- ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Freeing size 0%X\n",
- Allocation->Size));
-
- Status = AcpiUtReleaseMutex (ACPI_MTX_MEMORY);
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtDumpAllocationInfo
- *
- * PARAMETERS:
- *
- * RETURN: None
- *
- * DESCRIPTION: Print some info about the outstanding allocations.
- *
- ******************************************************************************/
-
-void
-AcpiUtDumpAllocationInfo (
- void)
-{
-/*
- ACPI_MEMORY_LIST *MemList;
-*/
-
- ACPI_FUNCTION_TRACE ("UtDumpAllocationInfo");
-
-/*
- ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
- ("%30s: %4d (%3d Kb)\n", "Current allocations",
- MemList->CurrentCount,
- ROUND_UP_TO_1K (MemList->CurrentSize)));
-
- ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
- ("%30s: %4d (%3d Kb)\n", "Max concurrent allocations",
- MemList->MaxConcurrentCount,
- ROUND_UP_TO_1K (MemList->MaxConcurrentSize)));
-
-
- ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
- ("%30s: %4d (%3d Kb)\n", "Total (all) internal objects",
- RunningObjectCount,
- ROUND_UP_TO_1K (RunningObjectSize)));
-
- ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
- ("%30s: %4d (%3d Kb)\n", "Total (all) allocations",
- RunningAllocCount,
- ROUND_UP_TO_1K (RunningAllocSize)));
-
-
- ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
- ("%30s: %4d (%3d Kb)\n", "Current Nodes",
- AcpiGbl_CurrentNodeCount,
- ROUND_UP_TO_1K (AcpiGbl_CurrentNodeSize)));
-
- ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
- ("%30s: %4d (%3d Kb)\n", "Max Nodes",
- AcpiGbl_MaxConcurrentNodeCount,
- ROUND_UP_TO_1K ((AcpiGbl_MaxConcurrentNodeCount *
- sizeof (ACPI_NAMESPACE_NODE)))));
-*/
- return_VOID;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtDumpAllocations
- *
- * PARAMETERS: Component - Component(s) to dump info for.
- * Module - Module to dump info for. NULL means all.
- *
- * RETURN: None
- *
- * DESCRIPTION: Print a list of all outstanding allocations.
- *
- ******************************************************************************/
-
-void
-AcpiUtDumpAllocations (
- UINT32 Component,
- char *Module)
-{
- ACPI_DEBUG_MEM_BLOCK *Element;
- ACPI_DESCRIPTOR *Descriptor;
- UINT32 NumOutstanding = 0;
-
-
- ACPI_FUNCTION_TRACE ("UtDumpAllocations");
-
-
- /*
- * Walk the allocation list.
- */
- if (ACPI_FAILURE (AcpiUtAcquireMutex (ACPI_MTX_MEMORY)))
- {
- return;
- }
-
- Element = AcpiGbl_GlobalList->ListHead;
- while (Element)
- {
- if ((Element->Component & Component) &&
- ((Module == NULL) || (0 == ACPI_STRCMP (Module, Element->Module))))
- {
- /* Ignore allocated objects that are in a cache */
-
- Descriptor = ACPI_CAST_PTR (ACPI_DESCRIPTOR, &Element->UserSpace);
- if (Descriptor->DescriptorId != ACPI_DESC_TYPE_CACHED)
- {
- AcpiOsPrintf ("%p Len %04X %9.9s-%d [%s] ",
- Descriptor, Element->Size, Element->Module,
- Element->Line, AcpiUtGetDescriptorName (Descriptor));
-
- /* Most of the elements will be Operand objects. */
-
- switch (ACPI_GET_DESCRIPTOR_TYPE (Descriptor))
- {
- case ACPI_DESC_TYPE_OPERAND:
- AcpiOsPrintf ("%12.12s R%hd",
- AcpiUtGetTypeName (Descriptor->Object.Common.Type),
- Descriptor->Object.Common.ReferenceCount);
- break;
-
- case ACPI_DESC_TYPE_PARSER:
- AcpiOsPrintf ("AmlOpcode %04hX",
- Descriptor->Op.Asl.AmlOpcode);
- break;
-
- case ACPI_DESC_TYPE_NAMED:
- AcpiOsPrintf ("%4.4s",
- AcpiUtGetNodeName (&Descriptor->Node));
- break;
-
- default:
- break;
- }
-
- AcpiOsPrintf ( "\n");
- NumOutstanding++;
- }
- }
- Element = Element->Next;
- }
-
- (void) AcpiUtReleaseMutex (ACPI_MTX_MEMORY);
-
- /* Print summary */
-
- if (!NumOutstanding)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "No outstanding allocations\n"));
- }
- else
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "%d(%X) Outstanding allocations\n",
- NumOutstanding, NumOutstanding));
- }
-
- return_VOID;
-}
-
-#endif /* #ifdef ACPI_DBG_TRACK_ALLOCATIONS */
-
diff --git a/sys/contrib/dev/acpica/utcache.c b/sys/contrib/dev/acpica/utcache.c
index 8e568a5..56e88b3 100644
--- a/sys/contrib/dev/acpica/utcache.c
+++ b/sys/contrib/dev/acpica/utcache.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: utcache - local cache allocation routines
- * $Revision: 1.2 $
+ * $Revision: 1.8 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -212,7 +212,7 @@ AcpiOsPurgeCache (
Next = *(ACPI_CAST_INDIRECT_PTR (char,
&(((char *) Cache->ListHead)[Cache->LinkOffset])));
- ACPI_MEM_FREE (Cache->ListHead);
+ ACPI_FREE (Cache->ListHead);
Cache->ListHead = Next;
Cache->CurrentDepth--;
@@ -294,7 +294,7 @@ AcpiOsReleaseObject (
if (Cache->CurrentDepth >= Cache->MaxDepth)
{
- ACPI_MEM_FREE (Object);
+ ACPI_FREE (Object);
ACPI_MEM_TRACKING (Cache->TotalFreed++);
}
@@ -348,7 +348,7 @@ AcpiOsAcquireObject (
void *Object;
- ACPI_FUNCTION_NAME ("OsAcquireObject");
+ ACPI_FUNCTION_NAME (OsAcquireObject);
if (!Cache)
@@ -377,8 +377,8 @@ AcpiOsAcquireObject (
Cache->CurrentDepth--;
ACPI_MEM_TRACKING (Cache->Hits++);
- ACPI_MEM_TRACKING (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
- "Object %p from %s cache\n", Object, Cache->ListName)));
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "Object %p from %s cache\n", Object, Cache->ListName));
Status = AcpiUtReleaseMutex (ACPI_MTX_CACHES);
if (ACPI_FAILURE (Status))
@@ -396,7 +396,14 @@ AcpiOsAcquireObject (
ACPI_MEM_TRACKING (Cache->TotalAllocated++);
- /* Avoid deadlock with ACPI_MEM_CALLOCATE */
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+ if ((Cache->TotalAllocated - Cache->TotalFreed) > Cache->MaxOccupied)
+ {
+ Cache->MaxOccupied = Cache->TotalAllocated - Cache->TotalFreed;
+ }
+#endif
+
+ /* Avoid deadlock with ACPI_ALLOCATE_ZEROED */
Status = AcpiUtReleaseMutex (ACPI_MTX_CACHES);
if (ACPI_FAILURE (Status))
@@ -404,7 +411,7 @@ AcpiOsAcquireObject (
return (NULL);
}
- Object = ACPI_MEM_CALLOCATE (Cache->ObjectSize);
+ Object = ACPI_ALLOCATE_ZEROED (Cache->ObjectSize);
if (!Object)
{
return (NULL);
diff --git a/sys/contrib/dev/acpica/utclib.c b/sys/contrib/dev/acpica/utclib.c
index 3aba44c..77e0d0e 100644
--- a/sys/contrib/dev/acpica/utclib.c
+++ b/sys/contrib/dev/acpica/utclib.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: cmclib - Local implementation of C library functions
- * $Revision: 1.58 $
+ * $Revision: 1.60 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
diff --git a/sys/contrib/dev/acpica/utcopy.c b/sys/contrib/dev/acpica/utcopy.c
index b282987..2d4072c 100644
--- a/sys/contrib/dev/acpica/utcopy.c
+++ b/sys/contrib/dev/acpica/utcopy.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: utcopy - Internal to external object translation utilities
- * $Revision: 1.122 $
+ * $Revision: 1.130 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -199,7 +199,7 @@ AcpiUtCopyIsimpleToEsimple (
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE ("UtCopyIsimpleToEsimple");
+ ACPI_FUNCTION_TRACE (UtCopyIsimpleToEsimple);
*BufferSpaceUsed = 0;
@@ -425,7 +425,7 @@ AcpiUtCopyIpackageToEpackage (
ACPI_PKG_INFO Info;
- ACPI_FUNCTION_TRACE ("UtCopyIpackageToEpackage");
+ ACPI_FUNCTION_TRACE (UtCopyIpackageToEpackage);
/*
@@ -486,7 +486,7 @@ AcpiUtCopyIobjectToEobject (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("UtCopyIobjectToEobject");
+ ACPI_FUNCTION_TRACE (UtCopyIobjectToEobject);
if (ACPI_GET_OBJECT_TYPE (InternalObject) == ACPI_TYPE_PACKAGE)
@@ -504,9 +504,9 @@ AcpiUtCopyIobjectToEobject (
* Build a simple object (no nested objects)
*/
Status = AcpiUtCopyIsimpleToEsimple (InternalObject,
- (ACPI_OBJECT *) RetBuffer->Pointer,
- ((UINT8 *) RetBuffer->Pointer +
- ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT))),
+ ACPI_CAST_PTR (ACPI_OBJECT, RetBuffer->Pointer),
+ ACPI_ADD_PTR (UINT8, RetBuffer->Pointer,
+ ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT))),
&RetBuffer->Length);
/*
* build simple does not include the object size in the length
@@ -543,7 +543,7 @@ AcpiUtCopyEsimpleToIsimple (
ACPI_OPERAND_OBJECT *InternalObject;
- ACPI_FUNCTION_TRACE ("UtCopyEsimpleToIsimple");
+ ACPI_FUNCTION_TRACE (UtCopyEsimpleToIsimple);
/*
@@ -577,7 +577,7 @@ AcpiUtCopyEsimpleToIsimple (
case ACPI_TYPE_STRING:
InternalObject->String.Pointer =
- ACPI_MEM_CALLOCATE ((ACPI_SIZE) ExternalObject->String.Length + 1);
+ ACPI_ALLOCATE_ZEROED ((ACPI_SIZE) ExternalObject->String.Length + 1);
if (!InternalObject->String.Pointer)
{
goto ErrorExit;
@@ -594,7 +594,7 @@ AcpiUtCopyEsimpleToIsimple (
case ACPI_TYPE_BUFFER:
InternalObject->Buffer.Pointer =
- ACPI_MEM_CALLOCATE (ExternalObject->Buffer.Length);
+ ACPI_ALLOCATE_ZEROED (ExternalObject->Buffer.Length);
if (!InternalObject->Buffer.Pointer)
{
goto ErrorExit;
@@ -665,7 +665,7 @@ AcpiUtCopyEpackageToIpackage (
ACPI_OBJECT *ThisExternalObj;
- ACPI_FUNCTION_TRACE ("UtCopyEpackageToIpackage");
+ ACPI_FUNCTION_TRACE (UtCopyEpackageToIpackage);
/*
@@ -718,7 +718,7 @@ AcpiUtCopyEobjectToIobject (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("UtCopyEobjectToIobject");
+ ACPI_FUNCTION_TRACE (UtCopyEobjectToIobject);
if (ExternalObject->Type == ACPI_TYPE_PACKAGE)
@@ -726,8 +726,8 @@ AcpiUtCopyEobjectToIobject (
/*
* Packages as external input to control methods are not supported,
*/
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Packages as parameters not implemented!\n"));
+ ACPI_ERROR ((AE_INFO,
+ "Packages as parameters not implemented!"));
return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
}
@@ -800,7 +800,7 @@ AcpiUtCopySimpleObject (
(SourceDesc->Buffer.Length))
{
DestDesc->Buffer.Pointer =
- ACPI_MEM_ALLOCATE (SourceDesc->Buffer.Length);
+ ACPI_ALLOCATE (SourceDesc->Buffer.Length);
if (!DestDesc->Buffer.Pointer)
{
return (AE_NO_MEMORY);
@@ -823,7 +823,7 @@ AcpiUtCopySimpleObject (
if (SourceDesc->String.Pointer)
{
DestDesc->String.Pointer =
- ACPI_MEM_ALLOCATE ((ACPI_SIZE) SourceDesc->String.Length + 1);
+ ACPI_ALLOCATE ((ACPI_SIZE) SourceDesc->String.Length + 1);
if (!DestDesc->String.Pointer)
{
return (AE_NO_MEMORY);
@@ -844,6 +844,16 @@ AcpiUtCopySimpleObject (
AcpiUtAddReference (SourceDesc->Reference.Object);
break;
+ case ACPI_TYPE_REGION:
+ /*
+ * We copied the Region Handler, so we now must add a reference
+ */
+ if (DestDesc->Region.Handler)
+ {
+ AcpiUtAddReference (DestDesc->Region.Handler);
+ }
+ break;
+
default:
/* Nothing to do for other simple objects */
break;
@@ -938,9 +948,8 @@ AcpiUtCopyIelementToIelement (
/*
* Create the object array
*/
- TargetObject->Package.Elements =
- ACPI_MEM_CALLOCATE (((ACPI_SIZE) SourceObject->Package.Count + 1) *
- sizeof (void *));
+ TargetObject->Package.Elements = ACPI_ALLOCATE_ZEROED (
+ ((ACPI_SIZE) SourceObject->Package.Count + 1) * sizeof (void *));
if (!TargetObject->Package.Elements)
{
Status = AE_NO_MEMORY;
@@ -994,7 +1003,7 @@ AcpiUtCopyIpackageToIpackage (
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE ("UtCopyIpackageToIpackage");
+ ACPI_FUNCTION_TRACE (UtCopyIpackageToIpackage);
DestObj->Common.Type = ACPI_GET_OBJECT_TYPE (SourceObj);
@@ -1004,13 +1013,12 @@ AcpiUtCopyIpackageToIpackage (
/*
* Create the object array and walk the source package tree
*/
- DestObj->Package.Elements = ACPI_MEM_CALLOCATE (
+ DestObj->Package.Elements = ACPI_ALLOCATE_ZEROED (
((ACPI_SIZE) SourceObj->Package.Count + 1) *
sizeof (void *));
if (!DestObj->Package.Elements)
{
- ACPI_REPORT_ERROR (
- ("AmlBuildCopyInternalPackageObject: Package allocation failure\n"));
+ ACPI_ERROR ((AE_INFO, "Package allocation failure"));
return_ACPI_STATUS (AE_NO_MEMORY);
}
@@ -1019,7 +1027,7 @@ AcpiUtCopyIpackageToIpackage (
* This handles nested packages of arbitrary depth.
*/
Status = AcpiUtWalkPackageTree (SourceObj, DestObj,
- AcpiUtCopyIelementToIelement, WalkState);
+ AcpiUtCopyIelementToIelement, WalkState);
if (ACPI_FAILURE (Status))
{
/* On failure, delete the destination package object */
@@ -1054,7 +1062,7 @@ AcpiUtCopyIobjectToIobject (
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE ("UtCopyIobjectToIobject");
+ ACPI_FUNCTION_TRACE (UtCopyIobjectToIobject);
/* Create the top level object */
diff --git a/sys/contrib/dev/acpica/utdebug.c b/sys/contrib/dev/acpica/utdebug.c
index 7d78a4c..59b91d7 100644
--- a/sys/contrib/dev/acpica/utdebug.c
+++ b/sys/contrib/dev/acpica/utdebug.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: utdebug - Debug print routines
- * $Revision: 1.126 $
+ * $Revision: 1.133 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -259,7 +259,7 @@ AcpiUtDebugPrint (
char *Format,
...)
{
- UINT32 ThreadId;
+ ACPI_THREAD_ID ThreadId;
va_list args;
@@ -276,7 +276,6 @@ AcpiUtDebugPrint (
* Thread tracking and context switch notification
*/
ThreadId = AcpiOsGetThreadId ();
-
if (ThreadId != AcpiGbl_PrevThreadId)
{
if (ACPI_LV_THREADS & AcpiDbgLevel)
@@ -307,6 +306,8 @@ AcpiUtDebugPrint (
AcpiOsVprintf (Format, args);
}
+ACPI_EXPORT_SYMBOL (AcpiUtDebugPrint)
+
/*******************************************************************************
*
@@ -350,6 +351,8 @@ AcpiUtDebugPrintRaw (
AcpiOsVprintf (Format, args);
}
+ACPI_EXPORT_SYMBOL (AcpiUtDebugPrintRaw)
+
/*******************************************************************************
*
@@ -383,6 +386,8 @@ AcpiUtTrace (
"%s\n", AcpiGbl_FnEntryStr);
}
+ACPI_EXPORT_SYMBOL (AcpiUtTrace)
+
/*******************************************************************************
*
@@ -519,6 +524,8 @@ AcpiUtExit (
AcpiGbl_NestingLevel--;
}
+ACPI_EXPORT_SYMBOL (AcpiUtExit)
+
/*******************************************************************************
*
@@ -564,6 +571,8 @@ AcpiUtStatusExit (
AcpiGbl_NestingLevel--;
}
+ACPI_EXPORT_SYMBOL (AcpiUtStatusExit)
+
/*******************************************************************************
*
@@ -599,6 +608,8 @@ AcpiUtValueExit (
AcpiGbl_NestingLevel--;
}
+ACPI_EXPORT_SYMBOL (AcpiUtValueExit)
+
/*******************************************************************************
*
@@ -652,11 +663,10 @@ AcpiUtPtrExit (
******************************************************************************/
void
-AcpiUtDumpBuffer (
+AcpiUtDumpBuffer2 (
UINT8 *Buffer,
UINT32 Count,
- UINT32 Display,
- UINT32 ComponentId)
+ UINT32 Display)
{
ACPI_NATIVE_UINT i = 0;
ACPI_NATIVE_UINT j;
@@ -664,14 +674,6 @@ AcpiUtDumpBuffer (
UINT8 BufChar;
- /* Only dump the buffer if tracing is enabled */
-
- if (!((ACPI_LV_TABLES & AcpiDbgLevel) &&
- (ComponentId & AcpiDbgLayer)))
- {
- return;
- }
-
if ((Count < 4) || (Count & 0x01))
{
Display = DB_BYTE_DISPLAY;
@@ -700,6 +702,7 @@ AcpiUtDumpBuffer (
switch (Display)
{
+ case DB_BYTE_DISPLAY:
default: /* Default is BYTE display */
AcpiOsPrintf ("%02X ", Buffer[i + j]);
@@ -766,3 +769,39 @@ AcpiUtDumpBuffer (
return;
}
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtDumpBuffer
+ *
+ * PARAMETERS: Buffer - Buffer to dump
+ * Count - Amount to dump, in bytes
+ * Display - BYTE, WORD, DWORD, or QWORD display
+ * ComponentID - Caller's component ID
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Generic dump buffer in both hex and ascii.
+ *
+ ******************************************************************************/
+
+void
+AcpiUtDumpBuffer (
+ UINT8 *Buffer,
+ UINT32 Count,
+ UINT32 Display,
+ UINT32 ComponentId)
+{
+
+ /* Only dump the buffer if tracing is enabled */
+
+ if (!((ACPI_LV_TABLES & AcpiDbgLevel) &&
+ (ComponentId & AcpiDbgLayer)))
+ {
+ return;
+ }
+
+ AcpiUtDumpBuffer2 (Buffer, Count, Display);
+}
+
+
diff --git a/sys/contrib/dev/acpica/utdelete.c b/sys/contrib/dev/acpica/utdelete.c
index 95d1feb..e78796e 100644
--- a/sys/contrib/dev/acpica/utdelete.c
+++ b/sys/contrib/dev/acpica/utdelete.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: utdelete - object deletion and reference count utilities
- * $Revision: 1.107 $
+ * $Revision: 1.123 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -160,7 +160,7 @@ AcpiUtDeleteInternalObj (
ACPI_OPERAND_OBJECT *NextDesc;
- ACPI_FUNCTION_TRACE_PTR ("UtDeleteInternalObj", Object);
+ ACPI_FUNCTION_TRACE_PTR (UtDeleteInternalObj, Object);
if (!Object)
@@ -244,22 +244,35 @@ AcpiUtDeleteInternalObj (
case ACPI_TYPE_MUTEX:
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
- "***** Mutex %p, Semaphore %p\n",
- Object, Object->Mutex.Semaphore));
+ "***** Mutex %p, OS Mutex %p\n",
+ Object, Object->Mutex.OsMutex));
- AcpiExUnlinkMutex (Object);
- (void) AcpiOsDeleteSemaphore (Object->Mutex.Semaphore);
+ if (Object == AcpiGbl_GlobalLockMutex)
+ {
+ /* Global Lock has extra semaphore */
+
+ (void) AcpiOsDeleteSemaphore (AcpiGbl_GlobalLockSemaphore);
+ AcpiGbl_GlobalLockSemaphore = NULL;
+
+ AcpiOsDeleteMutex (Object->Mutex.OsMutex);
+ AcpiGbl_GlobalLockMutex = NULL;
+ }
+ else
+ {
+ AcpiExUnlinkMutex (Object);
+ AcpiOsDeleteMutex (Object->Mutex.OsMutex);
+ }
break;
case ACPI_TYPE_EVENT:
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
- "***** Event %p, Semaphore %p\n",
- Object, Object->Event.Semaphore));
+ "***** Event %p, OS Semaphore %p\n",
+ Object, Object->Event.OsSemaphore));
- (void) AcpiOsDeleteSemaphore (Object->Event.Semaphore);
- Object->Event.Semaphore = NULL;
+ (void) AcpiOsDeleteSemaphore (Object->Event.OsSemaphore);
+ Object->Event.OsSemaphore = NULL;
break;
@@ -268,12 +281,13 @@ AcpiUtDeleteInternalObj (
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
"***** Method %p\n", Object));
- /* Delete the method semaphore if it exists */
+ /* Delete the method mutex if it exists */
- if (Object->Method.Semaphore)
+ if (Object->Method.Mutex)
{
- (void) AcpiOsDeleteSemaphore (Object->Method.Semaphore);
- Object->Method.Semaphore = NULL;
+ AcpiOsDeleteMutex (Object->Method.Mutex->Mutex.OsMutex);
+ AcpiUtDeleteObjectDesc (Object->Method.Mutex);
+ Object->Method.Mutex = NULL;
}
break;
@@ -294,9 +308,18 @@ AcpiUtDeleteInternalObj (
HandlerDesc = Object->Region.Handler;
if (HandlerDesc)
{
- if (HandlerDesc->AddressSpace.Hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)
+ if (HandlerDesc->AddressSpace.HandlerFlags &
+ ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)
{
- ObjPointer = SecondDesc->Extra.RegionContext;
+ /* Deactivate region and free region context */
+
+ if (HandlerDesc->AddressSpace.Setup)
+ {
+ (void) HandlerDesc->AddressSpace.Setup (Object,
+ ACPI_REGION_DEACTIVATE,
+ HandlerDesc->AddressSpace.Context,
+ &SecondDesc->Extra.RegionContext);
+ }
}
AcpiUtRemoveReference (HandlerDesc);
@@ -331,14 +354,14 @@ AcpiUtDeleteInternalObj (
if (ObjPointer)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Deleting Object Subptr %p\n",
- ObjPointer));
- ACPI_MEM_FREE (ObjPointer);
+ ObjPointer));
+ ACPI_FREE (ObjPointer);
}
/* Now the object can be safely deleted */
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Deleting Object %p [%s]\n",
- Object, AcpiUtGetObjectTypeName (Object)));
+ Object, AcpiUtGetObjectTypeName (Object)));
AcpiUtDeleteObjectDesc (Object);
return_VOID;
@@ -365,7 +388,7 @@ AcpiUtDeleteInternalObjectList (
ACPI_OPERAND_OBJECT **InternalObj;
- ACPI_FUNCTION_TRACE ("UtDeleteInternalObjectList");
+ ACPI_FUNCTION_TRACE (UtDeleteInternalObjectList);
/* Walk the null-terminated internal list */
@@ -377,7 +400,7 @@ AcpiUtDeleteInternalObjectList (
/* Free the combined parameter pointer list and object array */
- ACPI_MEM_FREE (ObjList);
+ ACPI_FREE (ObjList);
return_VOID;
}
@@ -404,7 +427,7 @@ AcpiUtUpdateRefCount (
UINT16 NewCount;
- ACPI_FUNCTION_NAME ("UtUpdateRefCount");
+ ACPI_FUNCTION_NAME (UtUpdateRefCount);
if (!Object)
@@ -416,12 +439,10 @@ AcpiUtUpdateRefCount (
NewCount = Count;
/*
- * Perform the reference count action
- * (increment, decrement, or force delete)
+ * Perform the reference count action (increment, decrement, force delete)
*/
switch (Action)
{
-
case REF_INCREMENT:
NewCount++;
@@ -432,7 +453,6 @@ AcpiUtUpdateRefCount (
Object, NewCount));
break;
-
case REF_DECREMENT:
if (Count < 1)
@@ -455,8 +475,7 @@ AcpiUtUpdateRefCount (
if (ACPI_GET_OBJECT_TYPE (Object) == ACPI_TYPE_METHOD)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
- "Method Obj %p Refs=%X, [Decremented]\n",
- Object, NewCount));
+ "Method Obj %p Refs=%X, [Decremented]\n", Object, NewCount));
}
Object->Common.ReferenceCount = NewCount;
@@ -464,25 +483,21 @@ AcpiUtUpdateRefCount (
{
AcpiUtDeleteInternalObj (Object);
}
-
break;
-
case REF_FORCE_DELETE:
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
- "Obj %p Refs=%X, Force delete! (Set to 0)\n",
- Object, Count));
+ "Obj %p Refs=%X, Force delete! (Set to 0)\n", Object, Count));
NewCount = 0;
Object->Common.ReferenceCount = NewCount;
AcpiUtDeleteInternalObj (Object);
break;
-
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown action (%X)\n", Action));
+ ACPI_ERROR ((AE_INFO, "Unknown action (%X)", Action));
break;
}
@@ -492,13 +507,9 @@ AcpiUtUpdateRefCount (
*/
if (Count > ACPI_MAX_REFERENCE_COUNT)
{
-
- ACPI_DEBUG_PRINT ((ACPI_DB_WARN,
- "**** Warning **** Large Reference Count (%X) in object %p\n\n",
- Count, Object));
+ ACPI_WARNING ((AE_INFO,
+ "Large Reference Count (%X) in object %p", Count, Object));
}
-
- return;
}
@@ -536,7 +547,7 @@ AcpiUtUpdateObjectReference (
ACPI_NATIVE_UINT i;
- ACPI_FUNCTION_TRACE_PTR ("UtUpdateObjectReference", Object);
+ ACPI_FUNCTION_TRACE_PTR (UtUpdateObjectReference, Object);
while (Object)
@@ -557,9 +568,14 @@ AcpiUtUpdateObjectReference (
switch (ACPI_GET_OBJECT_TYPE (Object))
{
case ACPI_TYPE_DEVICE:
+ case ACPI_TYPE_PROCESSOR:
+ case ACPI_TYPE_POWER:
+ case ACPI_TYPE_THERMAL:
+
+ /* Update the notify objects for these types (if present) */
- AcpiUtUpdateRefCount (Object->Device.SystemNotify, Action);
- AcpiUtUpdateRefCount (Object->Device.DeviceNotify, Action);
+ AcpiUtUpdateRefCount (Object->CommonNotify.SystemNotify, Action);
+ AcpiUtUpdateRefCount (Object->CommonNotify.DeviceNotify, Action);
break;
case ACPI_TYPE_PACKAGE:
@@ -628,11 +644,11 @@ AcpiUtUpdateObjectReference (
case ACPI_TYPE_REGION:
default:
- break;/* No subobjects */
+ break; /* No subobjects for all other types */
}
/*
- * Now we can update the count in the main object. This can only
+ * Now we can update the count in the main object. This can only
* happen after we update the sub-objects in case this causes the
* main object to be deleted.
*/
@@ -658,8 +674,8 @@ AcpiUtUpdateObjectReference (
ErrorExit:
- ACPI_REPORT_ERROR (("Could not update object reference count, %s\n",
- AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Could not update object reference count"));
return_ACPI_STATUS (Status);
}
@@ -683,7 +699,7 @@ AcpiUtAddReference (
ACPI_OPERAND_OBJECT *Object)
{
- ACPI_FUNCTION_TRACE_PTR ("UtAddReference", Object);
+ ACPI_FUNCTION_TRACE_PTR (UtAddReference, Object);
/* Ensure that we have a valid object */
@@ -699,7 +715,7 @@ AcpiUtAddReference (
/* Increment the reference count */
- (void) AcpiUtUpdateObjectReference (Object, REF_INCREMENT);
+ (void) AcpiUtUpdateObjectReference (Object, REF_INCREMENT);
return_VOID;
}
@@ -721,12 +737,12 @@ AcpiUtRemoveReference (
ACPI_OPERAND_OBJECT *Object)
{
- ACPI_FUNCTION_TRACE_PTR ("UtRemoveReference", Object);
+ ACPI_FUNCTION_TRACE_PTR (UtRemoveReference, Object);
/*
- * Allow a NULL pointer to be passed in, just ignore it. This saves
- * each caller from having to check. Also, ignore NS nodes.
+ * Allow a NULL pointer to be passed in, just ignore it. This saves
+ * each caller from having to check. Also, ignore NS nodes.
*
*/
if (!Object ||
@@ -749,10 +765,10 @@ AcpiUtRemoveReference (
/*
* Decrement the reference count, and only actually delete the object
- * if the reference count becomes 0. (Must also decrement the ref count
+ * if the reference count becomes 0. (Must also decrement the ref count
* of all subobjects!)
*/
- (void) AcpiUtUpdateObjectReference (Object, REF_DECREMENT);
+ (void) AcpiUtUpdateObjectReference (Object, REF_DECREMENT);
return_VOID;
}
diff --git a/sys/contrib/dev/acpica/uteval.c b/sys/contrib/dev/acpica/uteval.c
index c1fd6d8..5e16abb 100644
--- a/sys/contrib/dev/acpica/uteval.c
+++ b/sys/contrib/dev/acpica/uteval.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: uteval - Object evaluation
- * $Revision: 1.59 $
+ * $Revision: 1.71 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -138,6 +138,37 @@ AcpiUtTranslateOneCid (
ACPI_COMPATIBLE_ID *OneCid);
+/*
+ * Strings supported by the _OSI predefined (internal) method.
+ */
+static const char *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 */
+
+ /* Feature Group Strings */
+
+ "Extended Address Space Descriptor"
+
+ /*
+ * All "optional" feature group strings (features that are implemented
+ * by the host) should be implemented in the host version of
+ * AcpiOsValidateInterface and should not be added here.
+ */
+};
+
+
/*******************************************************************************
*
* FUNCTION: AcpiUtOsiImplementation
@@ -146,8 +177,7 @@ AcpiUtTranslateOneCid (
*
* RETURN: Status
*
- * DESCRIPTION: Implementation of _OSI predefined control method
- * Supported = _OSI (String)
+ * DESCRIPTION: Implementation of the _OSI predefined control method
*
******************************************************************************/
@@ -155,12 +185,13 @@ ACPI_STATUS
AcpiUtOsiImplementation (
ACPI_WALK_STATE *WalkState)
{
+ ACPI_STATUS Status;
ACPI_OPERAND_OBJECT *StringDesc;
ACPI_OPERAND_OBJECT *ReturnDesc;
ACPI_NATIVE_UINT i;
- ACPI_FUNCTION_TRACE ("UtOsiImplementation");
+ ACPI_FUNCTION_TRACE (UtOsiImplementation);
/* Validate the string input argument */
@@ -171,7 +202,7 @@ AcpiUtOsiImplementation (
return_ACPI_STATUS (AE_TYPE);
}
- /* Create a return object (Default value = 0) */
+ /* Create a return object */
ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
if (!ReturnDesc)
@@ -179,21 +210,39 @@ AcpiUtOsiImplementation (
return_ACPI_STATUS (AE_NO_MEMORY);
}
- /* Compare input string to table of supported strings */
+ /* Default return value is SUPPORTED */
+
+ ReturnDesc->Integer.Value = ACPI_UINT32_MAX;
+ WalkState->ReturnDesc = ReturnDesc;
+
+ /* Compare input string to static table of supported interfaces */
- for (i = 0; i < ACPI_NUM_OSI_STRINGS; i++)
+ for (i = 0; i < ACPI_ARRAY_LENGTH (AcpiInterfacesSupported); i++)
{
- if (!ACPI_STRCMP (StringDesc->String.Pointer,
- (char *) AcpiGbl_ValidOsiStrings[i]))
+ if (!ACPI_STRCMP (StringDesc->String.Pointer, AcpiInterfacesSupported[i]))
{
- /* This string is supported */
+ /* The interface is supported */
- ReturnDesc->Integer.Value = 0xFFFFFFFF;
- break;
+ return_ACPI_STATUS (AE_CTRL_TERMINATE);
}
}
- WalkState->ReturnDesc = ReturnDesc;
+ /*
+ * Did not match the string in the static table, call the host OSL to
+ * check for a match with one of the optional strings (such as
+ * "Module Device", "3.0 Thermal Model", etc.)
+ */
+ Status = AcpiOsValidateInterface (StringDesc->String.Pointer);
+ if (ACPI_SUCCESS (Status))
+ {
+ /* The interface is supported */
+
+ return_ACPI_STATUS (AE_CTRL_TERMINATE);
+ }
+
+ /* The interface is not supported */
+
+ ReturnDesc->Integer.Value = 0;
return_ACPI_STATUS (AE_CTRL_TERMINATE);
}
@@ -224,21 +273,29 @@ AcpiUtEvaluateObject (
UINT32 ExpectedReturnBtypes,
ACPI_OPERAND_OBJECT **ReturnDesc)
{
- ACPI_PARAMETER_INFO Info;
+ ACPI_EVALUATE_INFO *Info;
ACPI_STATUS Status;
UINT32 ReturnBtype;
- ACPI_FUNCTION_TRACE ("UtEvaluateObject");
+ ACPI_FUNCTION_TRACE (UtEvaluateObject);
- Info.Node = PrefixNode;
- Info.Parameters = NULL;
- Info.ParameterType = ACPI_PARAM_ARGS;
+ /* Allocate the evaluation information block */
+
+ Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO));
+ if (!Info)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ Info->PrefixNode = PrefixNode;
+ Info->Pathname = Path;
+ Info->ParameterType = ACPI_PARAM_ARGS;
/* Evaluate the object/method */
- Status = AcpiNsEvaluateRelative (Path, &Info);
+ Status = AcpiNsEvaluate (Info);
if (ACPI_FAILURE (Status))
{
if (Status == AE_NOT_FOUND)
@@ -248,31 +305,31 @@ AcpiUtEvaluateObject (
}
else
{
- ACPI_REPORT_METHOD_ERROR ("Method execution failed",
+ ACPI_ERROR_METHOD ("Method execution failed",
PrefixNode, Path, Status);
}
- return_ACPI_STATUS (Status);
+ goto Cleanup;
}
/* Did we get a return object? */
- if (!Info.ReturnObject)
+ if (!Info->ReturnObject)
{
if (ExpectedReturnBtypes)
{
- ACPI_REPORT_METHOD_ERROR ("No object was returned from",
+ ACPI_ERROR_METHOD ("No object was returned from",
PrefixNode, Path, AE_NOT_EXIST);
- return_ACPI_STATUS (AE_NOT_EXIST);
+ Status = AE_NOT_EXIST;
}
- return_ACPI_STATUS (AE_OK);
+ goto Cleanup;
}
/* Map the return object type to the bitmapped type */
- switch (ACPI_GET_OBJECT_TYPE (Info.ReturnObject))
+ switch (ACPI_GET_OBJECT_TYPE (Info->ReturnObject))
{
case ACPI_TYPE_INTEGER:
ReturnBtype = ACPI_BTYPE_INTEGER;
@@ -303,32 +360,36 @@ AcpiUtEvaluateObject (
* happen frequently if the "implicit return" feature is enabled.
* Just delete the return object and return AE_OK.
*/
- AcpiUtRemoveReference (Info.ReturnObject);
- return_ACPI_STATUS (AE_OK);
+ AcpiUtRemoveReference (Info->ReturnObject);
+ goto Cleanup;
}
/* Is the return object one of the expected types? */
if (!(ExpectedReturnBtypes & ReturnBtype))
{
- ACPI_REPORT_METHOD_ERROR ("Return object type is incorrect",
+ ACPI_ERROR_METHOD ("Return object type is incorrect",
PrefixNode, Path, AE_TYPE);
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Type returned from %s was incorrect: %s, expected Btypes: %X\n",
- Path, AcpiUtGetObjectTypeName (Info.ReturnObject),
+ ACPI_ERROR ((AE_INFO,
+ "Type returned from %s was incorrect: %s, expected Btypes: %X",
+ Path, AcpiUtGetObjectTypeName (Info->ReturnObject),
ExpectedReturnBtypes));
/* On error exit, we must delete the return object */
- AcpiUtRemoveReference (Info.ReturnObject);
- return_ACPI_STATUS (AE_TYPE);
+ AcpiUtRemoveReference (Info->ReturnObject);
+ Status = AE_TYPE;
+ goto Cleanup;
}
/* Object type is OK, return it */
- *ReturnDesc = Info.ReturnObject;
- return_ACPI_STATUS (AE_OK);
+ *ReturnDesc = Info->ReturnObject;
+
+Cleanup:
+ ACPI_FREE (Info);
+ return_ACPI_STATUS (Status);
}
@@ -359,7 +420,7 @@ AcpiUtEvaluateNumericObject (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("UtEvaluateNumericObject");
+ ACPI_FUNCTION_TRACE (UtEvaluateNumericObject);
Status = AcpiUtEvaluateObject (DeviceNode, ObjectName,
@@ -445,7 +506,7 @@ AcpiUtExecute_HID (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("UtExecute_HID");
+ ACPI_FUNCTION_TRACE (UtExecute_HID);
Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__HID,
@@ -558,7 +619,7 @@ AcpiUtExecute_CID (
ACPI_NATIVE_UINT i;
- ACPI_FUNCTION_TRACE ("UtExecute_CID");
+ ACPI_FUNCTION_TRACE (UtExecute_CID);
/* Evaluate the _CID method for this device */
@@ -584,7 +645,7 @@ AcpiUtExecute_CID (
Size = (((Count - 1) * sizeof (ACPI_COMPATIBLE_ID)) +
sizeof (ACPI_COMPATIBLE_ID_LIST));
- CidList = ACPI_MEM_CALLOCATE ((ACPI_SIZE) Size);
+ CidList = ACPI_ALLOCATE_ZEROED ((ACPI_SIZE) Size);
if (!CidList)
{
return_ACPI_STATUS (AE_NO_MEMORY);
@@ -629,7 +690,7 @@ AcpiUtExecute_CID (
if (ACPI_FAILURE (Status))
{
- ACPI_MEM_FREE (CidList);
+ ACPI_FREE (CidList);
}
else
{
@@ -668,7 +729,7 @@ AcpiUtExecute_UID (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("UtExecute_UID");
+ ACPI_FUNCTION_TRACE (UtExecute_UID);
Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__UID,
@@ -724,7 +785,7 @@ AcpiUtExecute_STA (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("UtExecute_STA");
+ ACPI_FUNCTION_TRACE (UtExecute_STA);
Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__STA,
@@ -737,7 +798,7 @@ AcpiUtExecute_STA (
"_STA on %4.4s was not found, assuming device is present\n",
AcpiUtGetNodeName (DeviceNode)));
- *Flags = 0x0F;
+ *Flags = ACPI_UINT32_MAX;
Status = AE_OK;
}
@@ -781,14 +842,14 @@ AcpiUtExecute_Sxds (
UINT32 i;
- ACPI_FUNCTION_TRACE ("UtExecute_Sxds");
+ ACPI_FUNCTION_TRACE (UtExecute_Sxds);
for (i = 0; i < 4; i++)
{
Highest[i] = 0xFF;
Status = AcpiUtEvaluateObject (DeviceNode,
- (char *) AcpiGbl_HighestDstateNames[i],
+ ACPI_CAST_PTR (char, AcpiGbl_HighestDstateNames[i]),
ACPI_BTYPE_INTEGER, &ObjDesc);
if (ACPI_FAILURE (Status))
{
@@ -796,7 +857,7 @@ AcpiUtExecute_Sxds (
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"%s on Device %4.4s, %s\n",
- (char *) AcpiGbl_HighestDstateNames[i],
+ ACPI_CAST_PTR (char, AcpiGbl_HighestDstateNames[i]),
AcpiUtGetNodeName (DeviceNode),
AcpiFormatException (Status)));
diff --git a/sys/contrib/dev/acpica/utglobal.c b/sys/contrib/dev/acpica/utglobal.c
index c8378b4..b83d288 100644
--- a/sys/contrib/dev/acpica/utglobal.c
+++ b/sys/contrib/dev/acpica/utglobal.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: utglobal - Global variables for the ACPI subsystem
- * $Revision: 1.216 $
+ * $Revision: 1.249 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -120,98 +120,14 @@
#include <contrib/dev/acpica/acpi.h>
#include <contrib/dev/acpica/acnamesp.h>
+ACPI_EXPORT_SYMBOL (AcpiGbl_FADT)
+
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME ("utglobal")
/*******************************************************************************
*
- * FUNCTION: AcpiFormatException
- *
- * PARAMETERS: Status - The ACPI_STATUS code to be formatted
- *
- * RETURN: A string containing the exception text. A valid pointer is
- * always returned.
- *
- * DESCRIPTION: This function translates an ACPI exception into an ASCII string.
- *
- ******************************************************************************/
-
-const char *
-AcpiFormatException (
- ACPI_STATUS Status)
-{
- ACPI_STATUS SubStatus;
- const char *Exception = NULL;
-
-
- ACPI_FUNCTION_NAME ("FormatException");
-
-
- SubStatus = (Status & ~AE_CODE_MASK);
-
- switch (Status & AE_CODE_MASK)
- {
- case AE_CODE_ENVIRONMENTAL:
-
- if (SubStatus <= AE_CODE_ENV_MAX)
- {
- Exception = AcpiGbl_ExceptionNames_Env [SubStatus];
- }
- break;
-
- case AE_CODE_PROGRAMMER:
-
- if (SubStatus <= AE_CODE_PGM_MAX)
- {
- Exception = AcpiGbl_ExceptionNames_Pgm [SubStatus -1];
- }
- break;
-
- case AE_CODE_ACPI_TABLES:
-
- if (SubStatus <= AE_CODE_TBL_MAX)
- {
- Exception = AcpiGbl_ExceptionNames_Tbl [SubStatus -1];
- }
- break;
-
- case AE_CODE_AML:
-
- if (SubStatus <= AE_CODE_AML_MAX)
- {
- Exception = AcpiGbl_ExceptionNames_Aml [SubStatus -1];
- }
- break;
-
- case AE_CODE_CONTROL:
-
- if (SubStatus <= AE_CODE_CTRL_MAX)
- {
- Exception = AcpiGbl_ExceptionNames_Ctrl [SubStatus -1];
- }
- break;
-
- default:
- break;
- }
-
- if (!Exception)
- {
- /* Exception code was not recognized */
-
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Unknown exception code: 0x%8.8X\n", Status));
-
- return ((const char *) "UNKNOWN_STATUS_CODE");
- }
-
- return ((const char *) Exception);
-}
-
-
-/*******************************************************************************
- *
* Static global variable initialization.
*
******************************************************************************/
@@ -234,7 +150,6 @@ UINT32 AcpiDbgLevel = ACPI_NORMAL_DEFAULT;
UINT32 AcpiDbgLayer = ACPI_COMPONENT_DEFAULT;
UINT32 AcpiGbl_NestingLevel = 0;
-
/* Debugger globals */
BOOLEAN AcpiGbl_DbTerminateThreads = FALSE;
@@ -249,8 +164,6 @@ UINT32 AcpiGbl_StartupFlags = 0;
BOOLEAN AcpiGbl_Shutdown = TRUE;
-const UINT8 AcpiGbl_DecodeTo8bit [8] = {1,2,4,8,16,32,64,128};
-
const char *AcpiGbl_SleepStateNames[ACPI_S_STATE_COUNT] =
{
"\\_S0_",
@@ -269,28 +182,46 @@ const char *AcpiGbl_HighestDstateNames[4] =
"_S4D"
};
-/*
- * Strings supported by the _OSI predefined (internal) method.
- * When adding strings, be sure to update ACPI_NUM_OSI_STRINGS.
- */
-const char *AcpiGbl_ValidOsiStrings[ACPI_NUM_OSI_STRINGS] =
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiFormatException
+ *
+ * PARAMETERS: Status - The ACPI_STATUS code to be formatted
+ *
+ * RETURN: A string containing the exception text. A valid pointer is
+ * always returned.
+ *
+ * DESCRIPTION: This function translates an ACPI exception into an ASCII string
+ * It is here instead of utxface.c so it is always present.
+ *
+ ******************************************************************************/
+
+const char *
+AcpiFormatException (
+ ACPI_STATUS Status)
{
- /* Operating System Vendor Strings */
+ const char *Exception = NULL;
- "Linux",
- "Windows 2000",
- "Windows 2001",
- "Windows 2001.1",
- "Windows 2001 SP0",
- "Windows 2001 SP1",
- "Windows 2001 SP2",
- "Windows 2001 SP3",
- "Windows 2001 SP4",
- /* Feature Group Strings */
+ ACPI_FUNCTION_ENTRY ();
- "Extended Address Space Descriptor"
-};
+
+ Exception = AcpiUtValidateException (Status);
+ if (!Exception)
+ {
+ /* Exception code was not recognized */
+
+ ACPI_ERROR ((AE_INFO,
+ "Unknown exception code: 0x%8.8X", Status));
+
+ Exception = "UNKNOWN_STATUS_CODE";
+ }
+
+ return (ACPI_CAST_PTR (const char, Exception));
+}
+
+ACPI_EXPORT_SYMBOL (AcpiFormatException)
/*******************************************************************************
@@ -401,35 +332,6 @@ AcpiUtHexToAsciiChar (
}
-/*******************************************************************************
- *
- * Table name globals
- *
- * NOTE: This table includes ONLY the ACPI tables that the subsystem consumes.
- * it is NOT an exhaustive list of all possible ACPI tables. All ACPI tables
- * that are not used by the subsystem are simply ignored.
- *
- * Do NOT add any table to this list that is not consumed directly by this
- * subsystem (No MADT, ECDT, SBST, etc.)
- *
- ******************************************************************************/
-
-ACPI_TABLE_LIST AcpiGbl_TableLists[NUM_ACPI_TABLE_TYPES];
-
-ACPI_TABLE_SUPPORT AcpiGbl_TableData[NUM_ACPI_TABLE_TYPES] =
-{
- /*********** Name, Signature, Global typed pointer Signature size, Type How many allowed?, Contains valid AML? */
-
- /* RSDP 0 */ {RSDP_NAME, RSDP_SIG, NULL, sizeof (RSDP_SIG)-1, ACPI_TABLE_ROOT | ACPI_TABLE_SINGLE},
- /* DSDT 1 */ {DSDT_SIG, DSDT_SIG, (void *) &AcpiGbl_DSDT, sizeof (DSDT_SIG)-1, ACPI_TABLE_SECONDARY| ACPI_TABLE_SINGLE | ACPI_TABLE_EXECUTABLE},
- /* FADT 2 */ {FADT_SIG, FADT_SIG, (void *) &AcpiGbl_FADT, sizeof (FADT_SIG)-1, ACPI_TABLE_PRIMARY | ACPI_TABLE_SINGLE},
- /* FACS 3 */ {FACS_SIG, FACS_SIG, (void *) &AcpiGbl_FACS, sizeof (FACS_SIG)-1, ACPI_TABLE_SECONDARY| ACPI_TABLE_SINGLE},
- /* PSDT 4 */ {PSDT_SIG, PSDT_SIG, NULL, sizeof (PSDT_SIG)-1, ACPI_TABLE_PRIMARY | ACPI_TABLE_MULTIPLE | ACPI_TABLE_EXECUTABLE},
- /* SSDT 5 */ {SSDT_SIG, SSDT_SIG, NULL, sizeof (SSDT_SIG)-1, ACPI_TABLE_PRIMARY | ACPI_TABLE_MULTIPLE | ACPI_TABLE_EXECUTABLE},
- /* XSDT 6 */ {XSDT_SIG, XSDT_SIG, NULL, sizeof (RSDT_SIG)-1, ACPI_TABLE_ROOT | ACPI_TABLE_SINGLE},
-};
-
-
/******************************************************************************
*
* Event and Hardware globals
@@ -493,7 +395,6 @@ ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS] =
const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] =
{
-/*! [Begin] no source code translation (keep these ASL Keywords as-is) */
"SystemMemory",
"SystemIO",
"PCI_Config",
@@ -502,7 +403,6 @@ const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] =
"CMOS",
"PCIBARTarget",
"DataTable"
-/*! [End] no source code translation !*/
};
@@ -520,7 +420,7 @@ AcpiUtGetRegionName (
return ("InvalidSpaceId");
}
- return ((char *) AcpiGbl_RegionTypes[SpaceId]);
+ return (ACPI_CAST_PTR (char, AcpiGbl_RegionTypes[SpaceId]));
}
@@ -540,13 +440,11 @@ AcpiUtGetRegionName (
static const char *AcpiGbl_EventTypes[ACPI_NUM_FIXED_EVENTS] =
{
-/*! [Begin] no source code translation (keep these strings as-is) */
"PM_Timer",
"GlobalLock",
"PowerButton",
"SleepButton",
"RealTimeClock",
-/*! [End] no source code translation !*/
};
@@ -560,7 +458,7 @@ AcpiUtGetEventName (
return ("InvalidEventID");
}
- return ((char *) AcpiGbl_EventTypes[EventId]);
+ return (ACPI_CAST_PTR (char, AcpiGbl_EventTypes[EventId]));
}
@@ -590,7 +488,6 @@ static const char AcpiGbl_BadType[] = "UNDEFINED";
static const char *AcpiGbl_NsTypeNames[] =
{
-/*! [Begin] no source code translation (keep these strings as-is) */
/* 00 */ "Untyped",
/* 01 */ "Integer",
/* 02 */ "String",
@@ -622,7 +519,6 @@ static const char *AcpiGbl_NsTypeNames[] =
/* 28 */ "Extra",
/* 29 */ "Data",
/* 30 */ "Invalid"
-/*! [End] no source code translation !*/
};
@@ -633,10 +529,10 @@ AcpiUtGetTypeName (
if (Type > ACPI_TYPE_INVALID)
{
- return ((char *) AcpiGbl_BadType);
+ return (ACPI_CAST_PTR (char, AcpiGbl_BadType));
}
- return ((char *) AcpiGbl_NsTypeNames[Type]);
+ return (ACPI_CAST_PTR (char, AcpiGbl_NsTypeNames[Type]));
}
@@ -690,16 +586,16 @@ AcpiUtGetNodeName (
/* Descriptor must be a namespace node */
- if (Node->Descriptor != ACPI_DESC_TYPE_NAMED)
+ if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED)
{
return ("####");
}
/* Name must be a valid ACPI name */
- if (!AcpiUtValidAcpiName (* (UINT32 *) Node->Name.Ascii))
+ if (!AcpiUtValidAcpiName (Node->Name.Integer))
{
- return ("????");
+ Node->Name.Integer = AcpiUtRepairName (Node->Name.Ascii);
}
/* Return the name */
@@ -724,7 +620,6 @@ AcpiUtGetNodeName (
static const char *AcpiGbl_DescTypeNames[] =
{
-/*! [Begin] no source code translation (keep these ASL Keywords as-is) */
/* 00 */ "Invalid",
/* 01 */ "Cached",
/* 02 */ "State-Generic",
@@ -741,7 +636,6 @@ static const char *AcpiGbl_DescTypeNames[] =
/* 13 */ "Parser",
/* 14 */ "Operand",
/* 15 */ "Node"
-/*! [End] no source code translation !*/
};
@@ -757,10 +651,11 @@ AcpiUtGetDescriptorName (
if (ACPI_GET_DESCRIPTOR_TYPE (Object) > ACPI_DESC_TYPE_MAX)
{
- return ((char *) AcpiGbl_BadType);
+ return (ACPI_CAST_PTR (char, AcpiGbl_BadType));
}
- return ((char *) AcpiGbl_DescTypeNames[ACPI_GET_DESCRIPTOR_TYPE (Object)]);
+ return (ACPI_CAST_PTR (char,
+ AcpiGbl_DescTypeNames[ACPI_GET_DESCRIPTOR_TYPE (Object)]));
}
@@ -788,7 +683,7 @@ AcpiUtGetMutexName (
UINT32 MutexId)
{
- if (MutexId > MAX_MUTEX)
+ if (MutexId > ACPI_MAX_MUTEX)
{
return ("Invalid Mutex ID");
}
@@ -847,7 +742,7 @@ AcpiUtInitGlobals (
UINT32 i;
- ACPI_FUNCTION_TRACE ("UtInitGlobals");
+ ACPI_FUNCTION_TRACE (UtInitGlobals);
/* Create all memory caches */
@@ -858,25 +753,24 @@ AcpiUtInitGlobals (
return;
}
- /* ACPI table structure */
-
- for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++)
- {
- AcpiGbl_TableLists[i].Next = NULL;
- AcpiGbl_TableLists[i].Count = 0;
- }
-
/* Mutex locked flags */
- for (i = 0; i < NUM_MUTEX; i++)
+ for (i = 0; i < ACPI_NUM_MUTEX; i++)
{
AcpiGbl_MutexInfo[i].Mutex = NULL;
AcpiGbl_MutexInfo[i].ThreadId = ACPI_MUTEX_NOT_ACQUIRED;
AcpiGbl_MutexInfo[i].UseCount = 0;
}
+ for (i = 0; i < ACPI_NUM_OWNERID_MASKS; i++)
+ {
+ AcpiGbl_OwnerIdMask[i] = 0;
+ }
+ AcpiGbl_OwnerIdMask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000; /* Last ID is never valid */
+
/* GPE support */
+ AcpiGpeCount = 0;
AcpiGbl_GpeXruptListHead = NULL;
AcpiGbl_GpeFadtBlocks[0] = NULL;
AcpiGbl_GpeFadtBlocks[1] = NULL;
@@ -888,31 +782,23 @@ AcpiUtInitGlobals (
AcpiGbl_ExceptionHandler = NULL;
AcpiGbl_InitHandler = NULL;
- /* Global "typed" ACPI table pointers */
-
- AcpiGbl_RSDP = NULL;
- AcpiGbl_XSDT = NULL;
- AcpiGbl_FACS = NULL;
- AcpiGbl_FADT = NULL;
- AcpiGbl_DSDT = NULL;
-
/* Global Lock support */
+ AcpiGbl_GlobalLockSemaphore = NULL;
+ AcpiGbl_GlobalLockMutex = NULL;
AcpiGbl_GlobalLockAcquired = FALSE;
- AcpiGbl_GlobalLockThreadCount = 0;
AcpiGbl_GlobalLockHandle = 0;
/* Miscellaneous variables */
- AcpiGbl_TableFlags = ACPI_PHYSICAL_POINTER;
- AcpiGbl_RsdpOriginalLocation = 0;
AcpiGbl_CmSingleStep = FALSE;
AcpiGbl_DbTerminateThreads = FALSE;
AcpiGbl_Shutdown = FALSE;
AcpiGbl_NsLookupCount = 0;
AcpiGbl_PsFindCount = 0;
AcpiGbl_AcpiHardwarePresent = TRUE;
- AcpiGbl_OwnerIdMask = 0;
+ AcpiGbl_LastOwnerIdIndex = 0;
+ AcpiGbl_NextOwnerIdOffset = 0;
AcpiGbl_TraceMethodName = 0;
AcpiGbl_TraceDbgLevel = 0;
AcpiGbl_TraceDbgLayer = 0;
@@ -927,9 +813,8 @@ AcpiUtInitGlobals (
/* Namespace */
AcpiGbl_RootNode = NULL;
-
AcpiGbl_RootNodeStruct.Name.Integer = ACPI_ROOT_NAME;
- AcpiGbl_RootNodeStruct.Descriptor = ACPI_DESC_TYPE_NAMED;
+ AcpiGbl_RootNodeStruct.DescriptorType = ACPI_DESC_TYPE_NAMED;
AcpiGbl_RootNodeStruct.Type = ACPI_TYPE_DEVICE;
AcpiGbl_RootNodeStruct.Child = NULL;
AcpiGbl_RootNodeStruct.Peer = NULL;
@@ -941,7 +826,17 @@ AcpiUtInitGlobals (
AcpiGbl_LowestStackPointer = ACPI_SIZE_MAX;
#endif
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+ AcpiGbl_DisplayFinalMemStats = FALSE;
+#endif
+
return_VOID;
}
+/* Public globals */
+
+ACPI_EXPORT_SYMBOL (AcpiDbgLevel)
+ACPI_EXPORT_SYMBOL (AcpiDbgLayer)
+ACPI_EXPORT_SYMBOL (AcpiGpeCount)
+
diff --git a/sys/contrib/dev/acpica/utinit.c b/sys/contrib/dev/acpica/utinit.c
index f346eea..b16d542 100644
--- a/sys/contrib/dev/acpica/utinit.c
+++ b/sys/contrib/dev/acpica/utinit.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: utinit - Common ACPI subsystem initialization
- * $Revision: 1.123 $
+ * $Revision: 1.135 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -120,138 +120,17 @@
#include <contrib/dev/acpica/acpi.h>
#include <contrib/dev/acpica/acnamesp.h>
#include <contrib/dev/acpica/acevents.h>
+#include <contrib/dev/acpica/actables.h>
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME ("utinit")
/* Local prototypes */
-static void
-AcpiUtFadtRegisterError (
- char *RegisterName,
- UINT32 Value,
- ACPI_SIZE Offset);
-
static void AcpiUtTerminate (
void);
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtFadtRegisterError
- *
- * PARAMETERS: RegisterName - Pointer to string identifying register
- * Value - Actual register contents value
- * Offset - Byte offset in the FADT
- *
- * RETURN: AE_BAD_VALUE
- *
- * DESCRIPTION: Display failure message
- *
- ******************************************************************************/
-
-static void
-AcpiUtFadtRegisterError (
- char *RegisterName,
- UINT32 Value,
- ACPI_SIZE Offset)
-{
-
- ACPI_REPORT_WARNING (
- ("Invalid FADT value %s=%X at offset %X FADT=%p\n",
- RegisterName, Value, (UINT32) Offset, AcpiGbl_FADT));
-}
-
-
-/******************************************************************************
- *
- * FUNCTION: AcpiUtValidateFadt
- *
- * PARAMETERS: None
- *
- * RETURN: Status
- *
- * DESCRIPTION: Validate various ACPI registers in the FADT
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiUtValidateFadt (
- void)
-{
-
- /*
- * Verify Fixed ACPI Description Table fields,
- * but don't abort on any problems, just display error
- */
- if (AcpiGbl_FADT->Pm1EvtLen < 4)
- {
- AcpiUtFadtRegisterError ("PM1_EVT_LEN",
- (UINT32) AcpiGbl_FADT->Pm1EvtLen,
- ACPI_FADT_OFFSET (Pm1EvtLen));
- }
-
- if (!AcpiGbl_FADT->Pm1CntLen)
- {
- AcpiUtFadtRegisterError ("PM1_CNT_LEN", 0,
- ACPI_FADT_OFFSET (Pm1CntLen));
- }
-
- if (!ACPI_VALID_ADDRESS (AcpiGbl_FADT->XPm1aEvtBlk.Address))
- {
- AcpiUtFadtRegisterError ("X_PM1a_EVT_BLK", 0,
- ACPI_FADT_OFFSET (XPm1aEvtBlk.Address));
- }
-
- if (!ACPI_VALID_ADDRESS (AcpiGbl_FADT->XPm1aCntBlk.Address))
- {
- AcpiUtFadtRegisterError ("X_PM1a_CNT_BLK", 0,
- ACPI_FADT_OFFSET (XPm1aCntBlk.Address));
- }
-
- if (!ACPI_VALID_ADDRESS (AcpiGbl_FADT->XPmTmrBlk.Address))
- {
- AcpiUtFadtRegisterError ("X_PM_TMR_BLK", 0,
- ACPI_FADT_OFFSET (XPmTmrBlk.Address));
- }
-
- if ((ACPI_VALID_ADDRESS (AcpiGbl_FADT->XPm2CntBlk.Address) &&
- !AcpiGbl_FADT->Pm2CntLen))
- {
- AcpiUtFadtRegisterError ("PM2_CNT_LEN",
- (UINT32) AcpiGbl_FADT->Pm2CntLen,
- ACPI_FADT_OFFSET (Pm2CntLen));
- }
-
- if (AcpiGbl_FADT->PmTmLen < 4)
- {
- AcpiUtFadtRegisterError ("PM_TM_LEN",
- (UINT32) AcpiGbl_FADT->PmTmLen,
- ACPI_FADT_OFFSET (PmTmLen));
- }
-
- /* Length of GPE blocks must be a multiple of 2 */
-
- if (ACPI_VALID_ADDRESS (AcpiGbl_FADT->XGpe0Blk.Address) &&
- (AcpiGbl_FADT->Gpe0BlkLen & 1))
- {
- AcpiUtFadtRegisterError ("(x)GPE0_BLK_LEN",
- (UINT32) AcpiGbl_FADT->Gpe0BlkLen,
- ACPI_FADT_OFFSET (Gpe0BlkLen));
- }
-
- if (ACPI_VALID_ADDRESS (AcpiGbl_FADT->XGpe1Blk.Address) &&
- (AcpiGbl_FADT->Gpe1BlkLen & 1))
- {
- AcpiUtFadtRegisterError ("(x)GPE1_BLK_LEN",
- (UINT32) AcpiGbl_FADT->Gpe1BlkLen,
- ACPI_FADT_OFFSET (Gpe1BlkLen));
- }
-
- return (AE_OK);
-}
-
-
/******************************************************************************
*
* FUNCTION: AcpiUtTerminate
@@ -274,10 +153,9 @@ AcpiUtTerminate (
ACPI_GPE_XRUPT_INFO *NextGpeXruptInfo;
- ACPI_FUNCTION_TRACE ("UtTerminate");
+ ACPI_FUNCTION_TRACE (UtTerminate);
- /* Free global tables, etc. */
/* Free global GPE blocks and related info structures */
GpeXruptInfo = AcpiGbl_GpeXruptListHead;
@@ -287,14 +165,14 @@ AcpiUtTerminate (
while (GpeBlock)
{
NextGpeBlock = GpeBlock->Next;
- ACPI_MEM_FREE (GpeBlock->EventInfo);
- ACPI_MEM_FREE (GpeBlock->RegisterInfo);
- ACPI_MEM_FREE (GpeBlock);
+ ACPI_FREE (GpeBlock->EventInfo);
+ ACPI_FREE (GpeBlock->RegisterInfo);
+ ACPI_FREE (GpeBlock);
GpeBlock = NextGpeBlock;
}
NextGpeXruptInfo = GpeXruptInfo->Next;
- ACPI_MEM_FREE (GpeXruptInfo);
+ ACPI_FREE (GpeXruptInfo);
GpeXruptInfo = NextGpeXruptInfo;
}
@@ -320,22 +198,23 @@ AcpiUtSubsystemShutdown (
void)
{
- ACPI_FUNCTION_TRACE ("UtSubsystemShutdown");
+ ACPI_FUNCTION_TRACE (UtSubsystemShutdown);
/* Just exit if subsystem is already shutdown */
if (AcpiGbl_Shutdown)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "ACPI Subsystem is already terminated\n"));
+ ACPI_ERROR ((AE_INFO,
+ "ACPI Subsystem is already terminated"));
return_VOID;
}
/* Subsystem appears active, go ahead and shut it down */
AcpiGbl_Shutdown = TRUE;
+ AcpiGbl_StartupFlags = 0;
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Shutting down ACPI Subsystem...\n"));
+ "Shutting down ACPI Subsystem\n"));
/* Close the AcpiEvent Handling */
@@ -345,6 +224,10 @@ AcpiUtSubsystemShutdown (
AcpiNsTerminate ();
+ /* Delete the ACPI tables */
+
+ AcpiTbTerminate ();
+
/* Close the globals */
AcpiUtTerminate ();
@@ -352,13 +235,6 @@ AcpiUtSubsystemShutdown (
/* Purge the local caches */
(void) AcpiUtDeleteCaches ();
-
- /* Debug only - display leftover memory allocation, if any */
-
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
- AcpiUtDumpAllocations (ACPI_UINT32_MAX, NULL);
-#endif
-
return_VOID;
}
diff --git a/sys/contrib/dev/acpica/utmath.c b/sys/contrib/dev/acpica/utmath.c
index eeee80a..f6dad73 100644
--- a/sys/contrib/dev/acpica/utmath.c
+++ b/sys/contrib/dev/acpica/utmath.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: utmath - Integer math support routines
- * $Revision: 1.17 $
+ * $Revision: 1.22 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -159,14 +159,14 @@ AcpiUtShortDivide (
UINT32 Remainder32;
- ACPI_FUNCTION_TRACE ("UtShortDivide");
+ ACPI_FUNCTION_TRACE (UtShortDivide);
/* Always check for a zero divisor */
if (Divisor == 0)
{
- ACPI_REPORT_ERROR (("AcpiUtShortDivide: Divide by zero\n"));
+ ACPI_ERROR ((AE_INFO, "Divide by zero"));
return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO);
}
@@ -229,14 +229,14 @@ AcpiUtDivide (
UINT64_OVERLAY Partial3;
- ACPI_FUNCTION_TRACE ("UtDivide");
+ ACPI_FUNCTION_TRACE (UtDivide);
/* Always check for a zero divisor */
if (InDivisor == 0)
{
- ACPI_REPORT_ERROR (("AcpiUtDivide: Divide by zero\n"));
+ ACPI_ERROR ((AE_INFO, "Divide by zero"));
return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO);
}
@@ -368,14 +368,14 @@ AcpiUtShortDivide (
UINT32 *OutRemainder)
{
- ACPI_FUNCTION_TRACE ("UtShortDivide");
+ ACPI_FUNCTION_TRACE (UtShortDivide);
/* Always check for a zero divisor */
if (Divisor == 0)
{
- ACPI_REPORT_ERROR (("AcpiUtShortDivide: Divide by zero\n"));
+ ACPI_ERROR ((AE_INFO, "Divide by zero"));
return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO);
}
@@ -400,14 +400,14 @@ AcpiUtDivide (
ACPI_INTEGER *OutQuotient,
ACPI_INTEGER *OutRemainder)
{
- ACPI_FUNCTION_TRACE ("UtDivide");
+ ACPI_FUNCTION_TRACE (UtDivide);
/* Always check for a zero divisor */
if (InDivisor == 0)
{
- ACPI_REPORT_ERROR (("AcpiUtDivide: Divide by zero\n"));
+ ACPI_ERROR ((AE_INFO, "Divide by zero"));
return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO);
}
diff --git a/sys/contrib/dev/acpica/utmisc.c b/sys/contrib/dev/acpica/utmisc.c
index 81b75db..1c1a1315 100644
--- a/sys/contrib/dev/acpica/utmisc.c
+++ b/sys/contrib/dev/acpica/utmisc.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: utmisc - common utility procedures
- * $Revision: 1.125 $
+ * $Revision: 1.151 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -119,7 +119,6 @@
#include <contrib/dev/acpica/acpi.h>
#include <contrib/dev/acpica/acnamesp.h>
-#include <contrib/dev/acpica/amlresrc.h>
#define _COMPONENT ACPI_UTILITIES
@@ -128,6 +127,118 @@
/*******************************************************************************
*
+ * FUNCTION: AcpiUtValidateException
+ *
+ * PARAMETERS: Status - The ACPI_STATUS code to be formatted
+ *
+ * RETURN: A string containing the exception text. NULL if exception is
+ * not valid.
+ *
+ * DESCRIPTION: This function validates and translates an ACPI exception into
+ * an ASCII string.
+ *
+ ******************************************************************************/
+
+const char *
+AcpiUtValidateException (
+ ACPI_STATUS Status)
+{
+ ACPI_STATUS SubStatus;
+ const char *Exception = NULL;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /*
+ * Status is composed of two parts, a "type" and an actual code
+ */
+ SubStatus = (Status & ~AE_CODE_MASK);
+
+ switch (Status & AE_CODE_MASK)
+ {
+ case AE_CODE_ENVIRONMENTAL:
+
+ if (SubStatus <= AE_CODE_ENV_MAX)
+ {
+ Exception = AcpiGbl_ExceptionNames_Env [SubStatus];
+ }
+ break;
+
+ case AE_CODE_PROGRAMMER:
+
+ if (SubStatus <= AE_CODE_PGM_MAX)
+ {
+ Exception = AcpiGbl_ExceptionNames_Pgm [SubStatus -1];
+ }
+ break;
+
+ case AE_CODE_ACPI_TABLES:
+
+ if (SubStatus <= AE_CODE_TBL_MAX)
+ {
+ Exception = AcpiGbl_ExceptionNames_Tbl [SubStatus -1];
+ }
+ break;
+
+ case AE_CODE_AML:
+
+ if (SubStatus <= AE_CODE_AML_MAX)
+ {
+ Exception = AcpiGbl_ExceptionNames_Aml [SubStatus -1];
+ }
+ break;
+
+ case AE_CODE_CONTROL:
+
+ if (SubStatus <= AE_CODE_CTRL_MAX)
+ {
+ Exception = AcpiGbl_ExceptionNames_Ctrl [SubStatus -1];
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return (ACPI_CAST_PTR (const char, Exception));
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtIsAmlTable
+ *
+ * PARAMETERS: Table - An ACPI table
+ *
+ * RETURN: TRUE if table contains executable AML; FALSE otherwise
+ *
+ * DESCRIPTION: Check ACPI Signature for a table that contains AML code.
+ * Currently, these are DSDT,SSDT,PSDT. All other table types are
+ * data tables that do not contain AML code.
+ *
+ ******************************************************************************/
+
+BOOLEAN
+AcpiUtIsAmlTable (
+ ACPI_TABLE_HEADER *Table)
+{
+
+ /* These are the only tables that contain executable AML */
+
+ if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_DSDT) ||
+ ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_PSDT) ||
+ ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_SSDT))
+ {
+ return (TRUE);
+ }
+
+ return (FALSE);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiUtAllocateOwnerId
*
* PARAMETERS: OwnerId - Where the new owner ID is returned
@@ -145,17 +256,19 @@ AcpiUtAllocateOwnerId (
ACPI_OWNER_ID *OwnerId)
{
ACPI_NATIVE_UINT i;
+ ACPI_NATIVE_UINT j;
+ ACPI_NATIVE_UINT k;
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("UtAllocateOwnerId");
+ ACPI_FUNCTION_TRACE (UtAllocateOwnerId);
/* Guard against multiple allocations of ID to the same location */
if (*OwnerId)
{
- ACPI_REPORT_ERROR (("Owner ID [%2.2X] already exists\n", *OwnerId));
+ ACPI_ERROR ((AE_INFO, "Owner ID [%2.2X] already exists", *OwnerId));
return_ACPI_STATUS (AE_ALREADY_EXISTS);
}
@@ -167,33 +280,71 @@ AcpiUtAllocateOwnerId (
return_ACPI_STATUS (Status);
}
- /* Find a free owner ID */
-
- for (i = 0; i < 32; i++)
+ /*
+ * Find a free owner ID, cycle through all possible IDs on repeated
+ * allocations. (ACPI_NUM_OWNERID_MASKS + 1) because first index may have
+ * to be scanned twice.
+ */
+ for (i = 0, j = AcpiGbl_LastOwnerIdIndex;
+ i < (ACPI_NUM_OWNERID_MASKS + 1);
+ i++, j++)
{
- if (!(AcpiGbl_OwnerIdMask & (1 << i)))
+ if (j >= ACPI_NUM_OWNERID_MASKS)
+ {
+ j = 0; /* Wraparound to start of mask array */
+ }
+
+ for (k = AcpiGbl_NextOwnerIdOffset; k < 32; k++)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_VALUES,
- "Current OwnerId mask: %8.8X New ID: %2.2X\n",
- AcpiGbl_OwnerIdMask, (unsigned int) (i + 1)));
+ if (AcpiGbl_OwnerIdMask[j] == ACPI_UINT32_MAX)
+ {
+ /* There are no free IDs in this mask */
+
+ break;
+ }
+
+ if (!(AcpiGbl_OwnerIdMask[j] & (1 << k)))
+ {
+ /*
+ * Found a free ID. The actual ID is the bit index plus one,
+ * making zero an invalid Owner ID. Save this as the last ID
+ * allocated and update the global ID mask.
+ */
+ AcpiGbl_OwnerIdMask[j] |= (1 << k);
- AcpiGbl_OwnerIdMask |= (1 << i);
- *OwnerId = (ACPI_OWNER_ID) (i + 1);
- goto Exit;
+ AcpiGbl_LastOwnerIdIndex = (UINT8) j;
+ AcpiGbl_NextOwnerIdOffset = (UINT8) (k + 1);
+
+ /*
+ * Construct encoded ID from the index and bit position
+ *
+ * Note: Last [j].k (bit 255) is never used and is marked
+ * permanently allocated (prevents +1 overflow)
+ */
+ *OwnerId = (ACPI_OWNER_ID) ((k + 1) + ACPI_MUL_32 (j));
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_VALUES,
+ "Allocated OwnerId: %2.2X\n", (unsigned int) *OwnerId));
+ goto Exit;
+ }
}
+
+ AcpiGbl_NextOwnerIdOffset = 0;
}
/*
- * If we are here, all OwnerIds have been allocated. This probably should
+ * All OwnerIds have been allocated. This typically should
* not happen since the IDs are reused after deallocation. The IDs are
* allocated upon table load (one per table) and method execution, and
* they are released when a table is unloaded or a method completes
* execution.
+ *
+ * If this error happens, there may be very deep nesting of invoked control
+ * methods, or there may be a bug where the IDs are not released.
*/
- *OwnerId = 0;
Status = AE_OWNER_ID_LIMIT;
- ACPI_REPORT_ERROR ((
- "Could not allocate new OwnerId (32 max), AE_OWNER_ID_LIMIT\n"));
+ ACPI_ERROR ((AE_INFO,
+ "Could not allocate new OwnerId (255 max), AE_OWNER_ID_LIMIT"));
Exit:
(void) AcpiUtReleaseMutex (ACPI_MTX_CACHES);
@@ -211,7 +362,7 @@ Exit:
* control method or unloading a table. Either way, we would
* ignore any error anyway.
*
- * DESCRIPTION: Release a table or method owner ID. Valid IDs are 1 - 32
+ * DESCRIPTION: Release a table or method owner ID. Valid IDs are 1 - 255
*
******************************************************************************/
@@ -221,9 +372,11 @@ AcpiUtReleaseOwnerId (
{
ACPI_OWNER_ID OwnerId = *OwnerIdPtr;
ACPI_STATUS Status;
+ ACPI_NATIVE_UINT Index;
+ UINT32 Bit;
- ACPI_FUNCTION_TRACE_U32 ("UtReleaseOwnerId", OwnerId);
+ ACPI_FUNCTION_TRACE_U32 (UtReleaseOwnerId, OwnerId);
/* Always clear the input OwnerId (zero is an invalid ID) */
@@ -232,9 +385,9 @@ AcpiUtReleaseOwnerId (
/* Zero is not a valid OwnerID */
- if ((OwnerId == 0) || (OwnerId > 32))
+ if (OwnerId == 0)
{
- ACPI_REPORT_ERROR (("Invalid OwnerId: %2.2X\n", OwnerId));
+ ACPI_ERROR ((AE_INFO, "Invalid OwnerId: %2.2X", OwnerId));
return_VOID;
}
@@ -250,11 +403,21 @@ AcpiUtReleaseOwnerId (
OwnerId--;
+ /* Decode ID to index/offset pair */
+
+ Index = ACPI_DIV_32 (OwnerId);
+ Bit = 1 << ACPI_MOD_32 (OwnerId);
+
/* Free the owner ID only if it is valid */
- if (AcpiGbl_OwnerIdMask & (1 << OwnerId))
+ if (AcpiGbl_OwnerIdMask[Index] & Bit)
+ {
+ AcpiGbl_OwnerIdMask[Index] ^= Bit;
+ }
+ else
{
- AcpiGbl_OwnerIdMask ^= (1 << OwnerId);
+ ACPI_ERROR ((AE_INFO,
+ "Release of non-allocated OwnerId: %2.2X", OwnerId + 1));
}
(void) AcpiUtReleaseMutex (ACPI_MTX_CACHES);
@@ -338,7 +501,7 @@ AcpiUtPrintString (
switch (String[i])
{
case 0x07:
- AcpiOsPrintf ("\\a"); /* BELL */
+ AcpiOsPrintf ("\\a"); /* BELL */
break;
case 0x08:
@@ -461,14 +624,18 @@ AcpiUtSetIntegerWidth (
UINT8 Revision)
{
- if (Revision <= 1)
+ if (Revision < 2)
{
+ /* 32-bit case */
+
AcpiGbl_IntegerBitWidth = 32;
AcpiGbl_IntegerNybbleWidth = 8;
AcpiGbl_IntegerByteWidth = 4;
}
else
{
+ /* 64-bit case (ACPI 2.0+) */
+
AcpiGbl_IntegerBitWidth = 64;
AcpiGbl_IntegerNybbleWidth = 16;
AcpiGbl_IntegerByteWidth = 8;
@@ -547,13 +714,55 @@ AcpiUtDisplayInitPathname (
}
AcpiOsPrintf ("\n");
- ACPI_MEM_FREE (Buffer.Pointer);
+ ACPI_FREE (Buffer.Pointer);
}
#endif
/*******************************************************************************
*
+ * FUNCTION: AcpiUtValidAcpiChar
+ *
+ * PARAMETERS: Char - The character to be examined
+ * Position - Byte position (0-3)
+ *
+ * RETURN: TRUE if the character is valid, FALSE otherwise
+ *
+ * DESCRIPTION: Check for a valid ACPI character. Must be one of:
+ * 1) Upper case alpha
+ * 2) numeric
+ * 3) underscore
+ *
+ * We allow a '!' as the last character because of the ASF! table
+ *
+ ******************************************************************************/
+
+BOOLEAN
+AcpiUtValidAcpiChar (
+ char Character,
+ ACPI_NATIVE_UINT Position)
+{
+
+ if (!((Character >= 'A' && Character <= 'Z') ||
+ (Character >= '0' && Character <= '9') ||
+ (Character == '_')))
+ {
+ /* Allow a '!' in the last position */
+
+ if (Character == '!' && Position == 3)
+ {
+ return (TRUE);
+ }
+
+ return (FALSE);
+ }
+
+ return (TRUE);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiUtValidAcpiName
*
* PARAMETERS: Name - The name to be examined
@@ -571,8 +780,6 @@ BOOLEAN
AcpiUtValidAcpiName (
UINT32 Name)
{
- char *NamePtr = (char *) &Name;
- char Character;
ACPI_NATIVE_UINT i;
@@ -581,12 +788,7 @@ AcpiUtValidAcpiName (
for (i = 0; i < ACPI_NAME_SIZE; i++)
{
- Character = *NamePtr;
- NamePtr++;
-
- if (!((Character == '_') ||
- (Character >= 'A' && Character <= 'Z') ||
- (Character >= '0' && Character <= '9')))
+ if (!AcpiUtValidAcpiChar ((ACPI_CAST_PTR (char, &Name))[i], i))
{
return (FALSE);
}
@@ -598,26 +800,41 @@ AcpiUtValidAcpiName (
/*******************************************************************************
*
- * FUNCTION: AcpiUtValidAcpiCharacter
+ * FUNCTION: AcpiUtRepairName
*
- * PARAMETERS: Character - The character to be examined
+ * PARAMETERS: Name - The ACPI name to be repaired
*
- * RETURN: 1 if Character may appear in a name, else 0
+ * RETURN: Repaired version of the name
*
- * DESCRIPTION: Check for a printable character
+ * DESCRIPTION: Repair an ACPI name: Change invalid characters to '*' and
+ * return the new name.
*
******************************************************************************/
-BOOLEAN
-AcpiUtValidAcpiCharacter (
- char Character)
+ACPI_NAME
+AcpiUtRepairName (
+ char *Name)
{
+ ACPI_NATIVE_UINT i;
+ char NewName[ACPI_NAME_SIZE];
- ACPI_FUNCTION_ENTRY ();
- return ((BOOLEAN) ((Character == '_') ||
- (Character >= 'A' && Character <= 'Z') ||
- (Character >= '0' && Character <= '9')));
+ for (i = 0; i < ACPI_NAME_SIZE; i++)
+ {
+ NewName[i] = Name[i];
+
+ /*
+ * 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))
+ {
+ NewName[i] = '*';
+ }
+ }
+
+ return (*(UINT32 *) NewName);
}
@@ -626,12 +843,15 @@ AcpiUtValidAcpiCharacter (
* FUNCTION: AcpiUtStrtoul64
*
* PARAMETERS: String - Null terminated string
- * Base - Radix of the string: 10, 16, or ACPI_ANY_BASE
+ * Base - Radix of the string: 16 or ACPI_ANY_BASE;
+ * ACPI_ANY_BASE means 'in behalf of ToInteger'
* RetInteger - Where the converted integer is returned
*
* RETURN: Status and Converted value
*
- * DESCRIPTION: Convert a string into an unsigned value.
+ * DESCRIPTION: Convert a string into an unsigned value. Performs either a
+ * 32-bit or 64-bit conversion, depending on the current mode
+ * of the interpreter.
* NOTE: Does not support Octal strings, not needed.
*
******************************************************************************/
@@ -645,20 +865,20 @@ AcpiUtStrtoul64 (
UINT32 ThisDigit = 0;
ACPI_INTEGER ReturnValue = 0;
ACPI_INTEGER Quotient;
+ ACPI_INTEGER Dividend;
+ UINT32 ToIntegerOp = (Base == ACPI_ANY_BASE);
+ UINT32 Mode32 = (AcpiGbl_IntegerByteWidth == 4);
+ UINT8 ValidDigits = 0;
+ UINT8 SignOf0x = 0;
+ UINT8 Term = 0;
- ACPI_FUNCTION_TRACE ("UtStroul64");
+ ACPI_FUNCTION_TRACE_STR (UtStroul64, String);
- if ((!String) || !(*String))
- {
- goto ErrorExit;
- }
-
switch (Base)
{
case ACPI_ANY_BASE:
- case 10:
case 16:
break;
@@ -667,23 +887,30 @@ AcpiUtStrtoul64 (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
+ if (!String)
+ {
+ goto ErrorExit;
+ }
+
/* Skip over any white space in the buffer */
- while (ACPI_IS_SPACE (*String) || *String == '\t')
+ while ((*String) && (ACPI_IS_SPACE (*String) || *String == '\t'))
{
String++;
}
- /*
- * If the input parameter Base is zero, then we need to
- * determine if it is decimal or hexadecimal:
- */
- if (Base == 0)
+ if (ToIntegerOp)
{
- if ((*String == '0') &&
- (ACPI_TOLOWER (*(String + 1)) == 'x'))
+ /*
+ * Base equal to ACPI_ANY_BASE means 'ToInteger operation case'.
+ * We need to determine if it is decimal or hexadecimal.
+ */
+ if ((*String == '0') && (ACPI_TOLOWER (*(String + 1)) == 'x'))
{
+ SignOf0x = 1;
Base = 16;
+
+ /* Skip over the leading '0x' */
String += 2;
}
else
@@ -692,25 +919,27 @@ AcpiUtStrtoul64 (
}
}
- /*
- * For hexadecimal base, skip over the leading
- * 0 or 0x, if they are present.
- */
- if ((Base == 16) &&
- (*String == '0') &&
- (ACPI_TOLOWER (*(String + 1)) == 'x'))
- {
- String += 2;
- }
+ /* Any string left? Check that '0x' is not followed by white space. */
- /* Any string left? */
-
- if (!(*String))
+ if (!(*String) || ACPI_IS_SPACE (*String) || *String == '\t')
{
- goto ErrorExit;
+ if (ToIntegerOp)
+ {
+ goto ErrorExit;
+ }
+ else
+ {
+ goto AllDone;
+ }
}
- /* Main loop: convert the string to a 64-bit integer */
+ /*
+ * Perform a 32-bit or 64-bit conversion, depending upon the current
+ * execution mode of the interpreter
+ */
+ Dividend = (Mode32) ? ACPI_UINT32_MAX : ACPI_UINT64_MAX;
+
+ /* Main loop: convert the string to a 32- or 64-bit integer */
while (*String)
{
@@ -720,15 +949,14 @@ AcpiUtStrtoul64 (
ThisDigit = ((UINT8) *String) - '0';
}
- else
+ else if (Base == 10)
{
- if (Base == 10)
- {
- /* Digit is out of range */
-
- goto ErrorExit;
- }
+ /* Digit is out of range; possible in ToInteger case only */
+ Term = 1;
+ }
+ else
+ {
ThisDigit = (UINT8) ACPI_TOUPPER (*String);
if (ACPI_IS_XDIGIT ((char) ThisDigit))
{
@@ -738,21 +966,55 @@ AcpiUtStrtoul64 (
}
else
{
- /*
- * We allow non-hex chars, just stop now, same as end-of-string.
- * See ACPI spec, string-to-integer conversion.
- */
+ Term = 1;
+ }
+ }
+
+ if (Term)
+ {
+ if (ToIntegerOp)
+ {
+ goto ErrorExit;
+ }
+ else
+ {
break;
}
}
+ else if ((ValidDigits == 0) && (ThisDigit == 0) && !SignOf0x)
+ {
+ /* Skip zeros */
+ String++;
+ continue;
+ }
+
+ ValidDigits++;
+
+ if (SignOf0x && ((ValidDigits > 16) || ((ValidDigits > 8) && Mode32)))
+ {
+ /*
+ * This is ToInteger operation case.
+ * No any restrictions for string-to-integer conversion,
+ * see ACPI spec.
+ */
+ goto ErrorExit;
+ }
/* Divide the digit into the correct position */
- (void) AcpiUtShortDivide ((ACPI_INTEGER_MAX - (ACPI_INTEGER) ThisDigit),
+ (void) AcpiUtShortDivide ((Dividend - (ACPI_INTEGER) ThisDigit),
Base, &Quotient, NULL);
+
if (ReturnValue > Quotient)
{
- goto ErrorExit;
+ if (ToIntegerOp)
+ {
+ goto ErrorExit;
+ }
+ else
+ {
+ break;
+ }
}
ReturnValue *= Base;
@@ -762,6 +1024,11 @@ AcpiUtStrtoul64 (
/* All done, normal exit */
+AllDone:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Converted value: %8.8X%8.8X\n",
+ ACPI_FORMAT_UINT64 (ReturnValue)));
+
*RetInteger = ReturnValue;
return_ACPI_STATUS (AE_OK);
@@ -853,7 +1120,7 @@ AcpiUtWalkPackageTree (
ACPI_OPERAND_OBJECT *ThisSourceObj;
- ACPI_FUNCTION_TRACE ("UtWalkPackageTree");
+ ACPI_FUNCTION_TRACE (UtWalkPackageTree);
State = AcpiUtCreatePkgState (SourceObject, TargetObject, 0);
@@ -954,283 +1221,89 @@ AcpiUtWalkPackageTree (
/*******************************************************************************
*
- * FUNCTION: AcpiUtGenerateChecksum
- *
- * PARAMETERS: Buffer - Buffer to be scanned
- * Length - number of bytes to examine
- *
- * RETURN: The generated checksum
- *
- * DESCRIPTION: Generate a checksum on a raw buffer
- *
- ******************************************************************************/
-
-UINT8
-AcpiUtGenerateChecksum (
- UINT8 *Buffer,
- UINT32 Length)
-{
- UINT32 i;
- signed char Sum = 0;
-
-
- for (i = 0; i < Length; i++)
- {
- Sum = (signed char) (Sum + Buffer[i]);
- }
-
- return ((UINT8) (0 - Sum));
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtGetResourceType
- *
- * PARAMETERS: Aml - Pointer to the raw AML resource descriptor
- *
- * RETURN: The Resource Type with no extraneous bits (except the
- * Large/Small descriptor bit -- this is left alone)
- *
- * DESCRIPTION: Extract the Resource Type/Name from the first byte of
- * a resource descriptor.
- *
- ******************************************************************************/
-
-UINT8
-AcpiUtGetResourceType (
- void *Aml)
-{
- ACPI_FUNCTION_ENTRY ();
-
-
- /*
- * Byte 0 contains the descriptor name (Resource Type)
- * Determine if this is a small or large resource
- */
- if (*((UINT8 *) Aml) & ACPI_RESOURCE_NAME_LARGE)
- {
- /* Large Resource Type -- bits 6:0 contain the name */
-
- return (*((UINT8 *) Aml));
- }
- else
- {
- /* Small Resource Type -- bits 6:3 contain the name */
-
- return ((UINT8) (*((UINT8 *) Aml) & ACPI_RESOURCE_NAME_SMALL_MASK));
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtGetResourceLength
- *
- * PARAMETERS: Aml - Pointer to the raw AML resource descriptor
- *
- * RETURN: Byte Length
- *
- * DESCRIPTION: Get the "Resource Length" of a raw AML descriptor. By
- * definition, this does not include the size of the descriptor
- * header or the length field itself.
+ * FUNCTION: AcpiUtError, AcpiUtWarning, AcpiUtInfo
*
- ******************************************************************************/
-
-UINT16
-AcpiUtGetResourceLength (
- void *Aml)
-{
- UINT16 ResourceLength;
-
-
- ACPI_FUNCTION_ENTRY ();
-
-
- /*
- * Byte 0 contains the descriptor name (Resource Type)
- * Determine if this is a small or large resource
- */
- if (*((UINT8 *) Aml) & ACPI_RESOURCE_NAME_LARGE)
- {
- /* Large Resource type -- bytes 1-2 contain the 16-bit length */
-
- ACPI_MOVE_16_TO_16 (&ResourceLength, &((UINT8 *) Aml)[1]);
-
- }
- else
- {
- /* Small Resource type -- bits 2:0 of byte 0 contain the length */
-
- ResourceLength = (UINT16) (*((UINT8 *) Aml) &
- ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK);
- }
-
- return (ResourceLength);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtGetDescriptorLength
- *
- * PARAMETERS: Aml - Pointer to the raw AML resource descriptor
+ * PARAMETERS: ModuleName - Caller's module name (for error output)
+ * LineNumber - Caller's line number (for error output)
+ * Format - Printf format string + additional args
*
- * RETURN: Byte length
+ * RETURN: None
*
- * DESCRIPTION: Get the total byte length of a raw AML descriptor, including the
- * length of the descriptor header and the length field itself.
- * Used to walk descriptor lists.
+ * DESCRIPTION: Print message with module/line/version info
*
******************************************************************************/
-UINT32
-AcpiUtGetDescriptorLength (
- void *Aml)
+void ACPI_INTERNAL_VAR_XFACE
+AcpiUtError (
+ char *ModuleName,
+ UINT32 LineNumber,
+ char *Format,
+ ...)
{
- UINT32 DescriptorLength;
-
-
- ACPI_FUNCTION_ENTRY ();
+ va_list args;
- /* First get the Resource Length (Does not include header length) */
+ AcpiOsPrintf ("ACPI Error (%s-%04d): ", ModuleName, LineNumber);
- DescriptorLength = AcpiUtGetResourceLength (Aml);
-
- /* Determine if this is a small or large resource */
-
- if (*((UINT8 *) Aml) & ACPI_RESOURCE_NAME_LARGE)
- {
- DescriptorLength += sizeof (AML_RESOURCE_LARGE_HEADER);
- }
- else
- {
- DescriptorLength += sizeof (AML_RESOURCE_SMALL_HEADER);
- }
-
- return (DescriptorLength);
+ va_start (args, Format);
+ AcpiOsVprintf (Format, args);
+ AcpiOsPrintf (" [%X]\n", ACPI_CA_VERSION);
}
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtGetResourceEndTag
- *
- * PARAMETERS: ObjDesc - The resource template buffer object
- *
- * RETURN: Pointer to the end tag
- *
- * DESCRIPTION: Find the END_TAG resource descriptor in an AML resource template
- *
- ******************************************************************************/
-
-
-UINT8 *
-AcpiUtGetResourceEndTag (
- ACPI_OPERAND_OBJECT *ObjDesc)
+void ACPI_INTERNAL_VAR_XFACE
+AcpiUtException (
+ char *ModuleName,
+ UINT32 LineNumber,
+ ACPI_STATUS Status,
+ char *Format,
+ ...)
{
- UINT8 *Aml;
- UINT8 *EndAml;
-
-
- Aml = ObjDesc->Buffer.Pointer;
- EndAml = Aml + ObjDesc->Buffer.Length;
+ va_list args;
- /* Walk the resource template, one descriptor per loop */
- while (Aml < EndAml)
- {
- if (AcpiUtGetResourceType (Aml) == ACPI_RESOURCE_NAME_END_TAG)
- {
- /* Found the end_tag descriptor, all done */
-
- return (Aml);
- }
-
- /* Point to the next resource descriptor */
+ AcpiOsPrintf ("ACPI Exception (%s-%04d): %s, ", ModuleName, LineNumber,
+ AcpiFormatException (Status));
- Aml += AcpiUtGetResourceLength (Aml);
- }
-
- /* End tag was not found */
-
- return (NULL);
+ va_start (args, Format);
+ AcpiOsVprintf (Format, args);
+ AcpiOsPrintf (" [%X]\n", ACPI_CA_VERSION);
}
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtReportError
- *
- * PARAMETERS: ModuleName - Caller's module name (for error output)
- * LineNumber - Caller's line number (for error output)
- * ComponentId - Caller's component ID (for error output)
- *
- * RETURN: None
- *
- * DESCRIPTION: Print error message
- *
- ******************************************************************************/
-
-void
-AcpiUtReportError (
+void ACPI_INTERNAL_VAR_XFACE
+AcpiUtWarning (
char *ModuleName,
UINT32 LineNumber,
- UINT32 ComponentId)
+ char *Format,
+ ...)
{
+ va_list args;
- AcpiOsPrintf ("%8s-%04d: *** Error: ", ModuleName, LineNumber);
-}
+ AcpiOsPrintf ("ACPI Warning (%s-%04d): ", ModuleName, LineNumber);
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtReportWarning
- *
- * PARAMETERS: ModuleName - Caller's module name (for error output)
- * LineNumber - Caller's line number (for error output)
- * ComponentId - Caller's component ID (for error output)
- *
- * RETURN: None
- *
- * DESCRIPTION: Print warning message
- *
- ******************************************************************************/
+ va_start (args, Format);
+ AcpiOsVprintf (Format, args);
+ AcpiOsPrintf (" [%X]\n", ACPI_CA_VERSION);
+}
-void
-AcpiUtReportWarning (
+void ACPI_INTERNAL_VAR_XFACE
+AcpiUtInfo (
char *ModuleName,
UINT32 LineNumber,
- UINT32 ComponentId)
+ char *Format,
+ ...)
{
+ va_list args;
- AcpiOsPrintf ("%8s-%04d: *** Warning: ", ModuleName, LineNumber);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtReportInfo
- *
- * PARAMETERS: ModuleName - Caller's module name (for error output)
- * LineNumber - Caller's line number (for error output)
- * ComponentId - Caller's component ID (for error output)
- *
- * RETURN: None
- *
- * DESCRIPTION: Print information message
- *
- ******************************************************************************/
-void
-AcpiUtReportInfo (
- char *ModuleName,
- UINT32 LineNumber,
- UINT32 ComponentId)
-{
+ /*
+ * Removed ModuleName, LineNumber, and acpica version, not needed
+ * for info output
+ */
+ AcpiOsPrintf ("ACPI: ");
- AcpiOsPrintf ("%8s-%04d: *** Info: ", ModuleName, LineNumber);
+ va_start (args, Format);
+ AcpiOsVprintf (Format, args);
+ AcpiOsPrintf ("\n");
}
-
diff --git a/sys/contrib/dev/acpica/utmutex.c b/sys/contrib/dev/acpica/utmutex.c
index e685511..701d269 100644
--- a/sys/contrib/dev/acpica/utmutex.c
+++ b/sys/contrib/dev/acpica/utmutex.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: utmutex - local mutex support
- * $Revision: 1.3 $
+ * $Revision: 1.12 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -153,13 +153,13 @@ AcpiUtMutexInitialize (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("UtMutexInitialize");
+ ACPI_FUNCTION_TRACE (UtMutexInitialize);
/*
* Create each of the predefined mutex objects
*/
- for (i = 0; i < NUM_MUTEX; i++)
+ for (i = 0; i < ACPI_NUM_MUTEX; i++)
{
Status = AcpiUtCreateMutex (i);
if (ACPI_FAILURE (Status))
@@ -168,7 +168,15 @@ AcpiUtMutexInitialize (
}
}
+ /* Create the spinlocks for use at interrupt level */
+
Status = AcpiOsCreateLock (&AcpiGbl_GpeLock);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ Status = AcpiOsCreateLock (&AcpiGbl_HardwareLock);
return_ACPI_STATUS (Status);
}
@@ -192,18 +200,21 @@ AcpiUtMutexTerminate (
UINT32 i;
- ACPI_FUNCTION_TRACE ("UtMutexTerminate");
+ ACPI_FUNCTION_TRACE (UtMutexTerminate);
/*
* Delete each predefined mutex object
*/
- for (i = 0; i < NUM_MUTEX; i++)
+ for (i = 0; i < ACPI_NUM_MUTEX; i++)
{
(void) AcpiUtDeleteMutex (i);
}
+ /* Delete the spinlocks */
+
AcpiOsDeleteLock (AcpiGbl_GpeLock);
+ AcpiOsDeleteLock (AcpiGbl_HardwareLock);
return_VOID;
}
@@ -227,18 +238,17 @@ AcpiUtCreateMutex (
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE_U32 ("UtCreateMutex", MutexId);
+ ACPI_FUNCTION_TRACE_U32 (UtCreateMutex, MutexId);
- if (MutexId > MAX_MUTEX)
+ if (MutexId > ACPI_MAX_MUTEX)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
if (!AcpiGbl_MutexInfo[MutexId].Mutex)
{
- Status = AcpiOsCreateSemaphore (1, 1,
- &AcpiGbl_MutexInfo[MutexId].Mutex);
+ Status = AcpiOsCreateMutex (&AcpiGbl_MutexInfo[MutexId].Mutex);
AcpiGbl_MutexInfo[MutexId].ThreadId = ACPI_MUTEX_NOT_ACQUIRED;
AcpiGbl_MutexInfo[MutexId].UseCount = 0;
}
@@ -263,23 +273,21 @@ static ACPI_STATUS
AcpiUtDeleteMutex (
ACPI_MUTEX_HANDLE MutexId)
{
- ACPI_STATUS Status;
-
- ACPI_FUNCTION_TRACE_U32 ("UtDeleteMutex", MutexId);
+ ACPI_FUNCTION_TRACE_U32 (UtDeleteMutex, MutexId);
- if (MutexId > MAX_MUTEX)
+ if (MutexId > ACPI_MAX_MUTEX)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- Status = AcpiOsDeleteSemaphore (AcpiGbl_MutexInfo[MutexId].Mutex);
+ AcpiOsDeleteMutex (AcpiGbl_MutexInfo[MutexId].Mutex);
AcpiGbl_MutexInfo[MutexId].Mutex = NULL;
AcpiGbl_MutexInfo[MutexId].ThreadId = ACPI_MUTEX_NOT_ACQUIRED;
- return_ACPI_STATUS (Status);
+ return_ACPI_STATUS (AE_OK);
}
@@ -300,13 +308,13 @@ AcpiUtAcquireMutex (
ACPI_MUTEX_HANDLE MutexId)
{
ACPI_STATUS Status;
- UINT32 ThisThreadId;
+ ACPI_THREAD_ID ThisThreadId;
- ACPI_FUNCTION_NAME ("UtAcquireMutex");
+ ACPI_FUNCTION_NAME (UtAcquireMutex);
- if (MutexId > MAX_MUTEX)
+ if (MutexId > ACPI_MAX_MUTEX)
{
return (AE_BAD_PARAMETER);
}
@@ -324,21 +332,21 @@ AcpiUtAcquireMutex (
* the mutex ordering rule. This indicates a coding error somewhere in
* the ACPI subsystem code.
*/
- for (i = MutexId; i < MAX_MUTEX; i++)
+ for (i = MutexId; i < ACPI_MAX_MUTEX; i++)
{
if (AcpiGbl_MutexInfo[i].ThreadId == ThisThreadId)
{
if (i == MutexId)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Mutex [%s] already acquired by this thread [%X]\n",
+ ACPI_ERROR ((AE_INFO,
+ "Mutex [%s] already acquired by this thread [%X]",
AcpiUtGetMutexName (MutexId), ThisThreadId));
return (AE_ALREADY_ACQUIRED);
}
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Invalid acquire order: Thread %X owns [%s], wants [%s]\n",
+ ACPI_ERROR ((AE_INFO,
+ "Invalid acquire order: Thread %X owns [%s], wants [%s]",
ThisThreadId, AcpiUtGetMutexName (i),
AcpiUtGetMutexName (MutexId)));
@@ -352,8 +360,8 @@ AcpiUtAcquireMutex (
"Thread %X attempting to acquire Mutex [%s]\n",
ThisThreadId, AcpiUtGetMutexName (MutexId)));
- Status = AcpiOsWaitSemaphore (AcpiGbl_MutexInfo[MutexId].Mutex,
- 1, ACPI_WAIT_FOREVER);
+ 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",
@@ -364,10 +372,8 @@ AcpiUtAcquireMutex (
}
else
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Thread %X could not acquire Mutex [%s] %s\n",
- ThisThreadId, AcpiUtGetMutexName (MutexId),
- AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Thread %X could not acquire Mutex [%X]", ThisThreadId, MutexId));
}
return (Status);
@@ -390,11 +396,10 @@ ACPI_STATUS
AcpiUtReleaseMutex (
ACPI_MUTEX_HANDLE MutexId)
{
- ACPI_STATUS Status;
- UINT32 ThisThreadId;
+ ACPI_THREAD_ID ThisThreadId;
- ACPI_FUNCTION_NAME ("UtReleaseMutex");
+ ACPI_FUNCTION_NAME (UtReleaseMutex);
ThisThreadId = AcpiOsGetThreadId ();
@@ -402,7 +407,7 @@ AcpiUtReleaseMutex (
"Thread %X releasing Mutex [%s]\n", ThisThreadId,
AcpiUtGetMutexName (MutexId)));
- if (MutexId > MAX_MUTEX)
+ if (MutexId > ACPI_MAX_MUTEX)
{
return (AE_BAD_PARAMETER);
}
@@ -412,9 +417,8 @@ AcpiUtReleaseMutex (
*/
if (AcpiGbl_MutexInfo[MutexId].ThreadId == ACPI_MUTEX_NOT_ACQUIRED)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Mutex [%s] is not acquired, cannot release\n",
- AcpiUtGetMutexName (MutexId)));
+ ACPI_ERROR ((AE_INFO,
+ "Mutex [%X] is not acquired, cannot release", MutexId));
return (AE_NOT_ACQUIRED);
}
@@ -430,7 +434,7 @@ AcpiUtReleaseMutex (
* ordering rule. This indicates a coding error somewhere in
* the ACPI subsystem code.
*/
- for (i = MutexId; i < MAX_MUTEX; i++)
+ for (i = MutexId; i < ACPI_MAX_MUTEX; i++)
{
if (AcpiGbl_MutexInfo[i].ThreadId == ThisThreadId)
{
@@ -439,8 +443,8 @@ AcpiUtReleaseMutex (
continue;
}
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Invalid release order: owns [%s], releasing [%s]\n",
+ ACPI_ERROR ((AE_INFO,
+ "Invalid release order: owns [%s], releasing [%s]",
AcpiUtGetMutexName (i), AcpiUtGetMutexName (MutexId)));
return (AE_RELEASE_DEADLOCK);
@@ -453,22 +457,8 @@ AcpiUtReleaseMutex (
AcpiGbl_MutexInfo[MutexId].ThreadId = ACPI_MUTEX_NOT_ACQUIRED;
- Status = AcpiOsSignalSemaphore (AcpiGbl_MutexInfo[MutexId].Mutex, 1);
-
- if (ACPI_FAILURE (Status))
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Thread %X could not release Mutex [%s] %s\n",
- ThisThreadId, AcpiUtGetMutexName (MutexId),
- AcpiFormatException (Status)));
- }
- else
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X released Mutex [%s]\n",
- ThisThreadId, AcpiUtGetMutexName (MutexId)));
- }
-
- return (Status);
+ AcpiOsReleaseMutex (AcpiGbl_MutexInfo[MutexId].Mutex);
+ return (AE_OK);
}
diff --git a/sys/contrib/dev/acpica/utobject.c b/sys/contrib/dev/acpica/utobject.c
index d63250b..5b0c3f3 100644
--- a/sys/contrib/dev/acpica/utobject.c
+++ b/sys/contrib/dev/acpica/utobject.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: utobject - ACPI object create/delete/size/cache routines
- * $Revision: 1.97 $
+ * $Revision: 1.104 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -176,7 +176,7 @@ AcpiUtCreateInternalObjectDbg (
ACPI_OPERAND_OBJECT *SecondObject;
- ACPI_FUNCTION_TRACE_STR ("UtCreateInternalObjectDbg",
+ ACPI_FUNCTION_TRACE_STR (UtCreateInternalObjectDbg,
AcpiUtGetTypeName (Type));
@@ -250,7 +250,7 @@ AcpiUtCreateBufferObject (
UINT8 *Buffer = NULL;
- ACPI_FUNCTION_TRACE_U32 ("UtCreateBufferObject", BufferSize);
+ ACPI_FUNCTION_TRACE_U32 (UtCreateBufferObject, BufferSize);
/* Create a new Buffer object */
@@ -267,10 +267,10 @@ AcpiUtCreateBufferObject (
{
/* Allocate the actual buffer */
- Buffer = ACPI_MEM_CALLOCATE (BufferSize);
+ Buffer = ACPI_ALLOCATE_ZEROED (BufferSize);
if (!Buffer)
{
- ACPI_REPORT_ERROR (("CreateBuffer: could not allocate size %X\n",
+ ACPI_ERROR ((AE_INFO, "Could not allocate size %X",
(UINT32) BufferSize));
AcpiUtRemoveReference (BufferDesc);
return_PTR (NULL);
@@ -311,7 +311,7 @@ AcpiUtCreateStringObject (
char *String;
- ACPI_FUNCTION_TRACE_U32 ("UtCreateStringObject", StringSize);
+ ACPI_FUNCTION_TRACE_U32 (UtCreateStringObject, StringSize);
/* Create a new String object */
@@ -326,10 +326,10 @@ AcpiUtCreateStringObject (
* Allocate the actual string buffer -- (Size + 1) for NULL terminator.
* NOTE: Zero-length strings are NULL terminated
*/
- String = ACPI_MEM_CALLOCATE (StringSize + 1);
+ String = ACPI_ALLOCATE_ZEROED (StringSize + 1);
if (!String)
{
- ACPI_REPORT_ERROR (("CreateString: could not allocate size %X\n",
+ ACPI_ERROR ((AE_INFO, "Could not allocate size %X",
(UINT32) StringSize));
AcpiUtRemoveReference (StringDesc);
return_PTR (NULL);
@@ -363,7 +363,7 @@ AcpiUtValidInternalObject (
void *Object)
{
- ACPI_FUNCTION_NAME ("UtValidInternalObject");
+ ACPI_FUNCTION_NAME (UtValidInternalObject);
/* Check for a null pointer */
@@ -419,14 +419,14 @@ AcpiUtAllocateObjectDescDbg (
ACPI_OPERAND_OBJECT *Object;
- ACPI_FUNCTION_TRACE ("UtAllocateObjectDescDbg");
+ ACPI_FUNCTION_TRACE (UtAllocateObjectDescDbg);
Object = AcpiOsAcquireObject (AcpiGbl_OperandCache);
if (!Object)
{
- _ACPI_REPORT_ERROR (ModuleName, LineNumber, ComponentId,
- ("Could not allocate an object descriptor\n"));
+ ACPI_ERROR ((ModuleName, LineNumber,
+ "Could not allocate an object descriptor"));
return_PTR (NULL);
}
@@ -458,16 +458,16 @@ void
AcpiUtDeleteObjectDesc (
ACPI_OPERAND_OBJECT *Object)
{
- ACPI_FUNCTION_TRACE_PTR ("UtDeleteObjectDesc", Object);
+ ACPI_FUNCTION_TRACE_PTR (UtDeleteObjectDesc, Object);
/* Object must be an ACPI_OPERAND_OBJECT */
if (ACPI_GET_DESCRIPTOR_TYPE (Object) != ACPI_DESC_TYPE_OPERAND)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "%p is not an ACPI Operand object [%s]\n", Object,
- AcpiUtGetDescriptorName (Object)));
+ ACPI_ERROR ((AE_INFO,
+ "%p is not an ACPI Operand object [%s]", Object,
+ AcpiUtGetDescriptorName (Object)));
return_VOID;
}
@@ -502,7 +502,7 @@ AcpiUtGetSimpleObjectSize (
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE_PTR ("UtGetSimpleObjectSize", InternalObject);
+ ACPI_FUNCTION_TRACE_PTR (UtGetSimpleObjectSize, InternalObject);
/*
@@ -578,8 +578,8 @@ AcpiUtGetSimpleObjectSize (
* Notably, Locals and Args are not supported, but this may be
* required eventually.
*/
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Unsupported Reference opcode=%X in object %p\n",
+ ACPI_ERROR ((AE_INFO,
+ "Unsupported Reference opcode=%X in object %p",
InternalObject->Reference.Opcode, InternalObject));
Status = AE_TYPE;
break;
@@ -589,7 +589,7 @@ AcpiUtGetSimpleObjectSize (
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unsupported type=%X in object %p\n",
+ ACPI_ERROR ((AE_INFO, "Unsupported type=%X in object %p",
ACPI_GET_OBJECT_TYPE (InternalObject), InternalObject));
Status = AE_TYPE;
break;
@@ -694,7 +694,7 @@ AcpiUtGetPackageObjectSize (
ACPI_PKG_INFO Info;
- ACPI_FUNCTION_TRACE_PTR ("UtGetPackageObjectSize", InternalObject);
+ ACPI_FUNCTION_TRACE_PTR (UtGetPackageObjectSize, InternalObject);
Info.Length = 0;
diff --git a/sys/contrib/dev/acpica/utresrc.c b/sys/contrib/dev/acpica/utresrc.c
new file mode 100644
index 0000000..530f782
--- /dev/null
+++ b/sys/contrib/dev/acpica/utresrc.c
@@ -0,0 +1,772 @@
+/*******************************************************************************
+ *
+ * Module Name: utresrc - Resource managment utilities
+ * $Revision: 1.14 $
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 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 __UTRESRC_C__
+
+#include <contrib/dev/acpica/acpi.h>
+#include <contrib/dev/acpica/amlresrc.h>
+
+
+#define _COMPONENT ACPI_UTILITIES
+ ACPI_MODULE_NAME ("utresrc")
+
+
+#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER)
+
+/*
+ * Strings used to decode resource descriptors.
+ * Used by both the disasssembler and the debugger resource dump routines
+ */
+const char *AcpiGbl_BmDecode[] =
+{
+ "NotBusMaster",
+ "BusMaster"
+};
+
+const char *AcpiGbl_ConfigDecode[] =
+{
+ "0 - Good Configuration",
+ "1 - Acceptable Configuration",
+ "2 - Suboptimal Configuration",
+ "3 - ***Invalid Configuration***",
+};
+
+const char *AcpiGbl_ConsumeDecode[] =
+{
+ "ResourceProducer",
+ "ResourceConsumer"
+};
+
+const char *AcpiGbl_DecDecode[] =
+{
+ "PosDecode",
+ "SubDecode"
+};
+
+const char *AcpiGbl_HeDecode[] =
+{
+ "Level",
+ "Edge"
+};
+
+const char *AcpiGbl_IoDecode[] =
+{
+ "Decode10",
+ "Decode16"
+};
+
+const char *AcpiGbl_LlDecode[] =
+{
+ "ActiveHigh",
+ "ActiveLow"
+};
+
+const char *AcpiGbl_MaxDecode[] =
+{
+ "MaxNotFixed",
+ "MaxFixed"
+};
+
+const char *AcpiGbl_MemDecode[] =
+{
+ "NonCacheable",
+ "Cacheable",
+ "WriteCombining",
+ "Prefetchable"
+};
+
+const char *AcpiGbl_MinDecode[] =
+{
+ "MinNotFixed",
+ "MinFixed"
+};
+
+const char *AcpiGbl_MtpDecode[] =
+{
+ "AddressRangeMemory",
+ "AddressRangeReserved",
+ "AddressRangeACPI",
+ "AddressRangeNVS"
+};
+
+const char *AcpiGbl_RngDecode[] =
+{
+ "InvalidRanges",
+ "NonISAOnlyRanges",
+ "ISAOnlyRanges",
+ "EntireRange"
+};
+
+const char *AcpiGbl_RwDecode[] =
+{
+ "ReadOnly",
+ "ReadWrite"
+};
+
+const char *AcpiGbl_ShrDecode[] =
+{
+ "Exclusive",
+ "Shared"
+};
+
+const char *AcpiGbl_SizDecode[] =
+{
+ "Transfer8",
+ "Transfer8_16",
+ "Transfer16",
+ "InvalidSize"
+};
+
+const char *AcpiGbl_TrsDecode[] =
+{
+ "DenseTranslation",
+ "SparseTranslation"
+};
+
+const char *AcpiGbl_TtpDecode[] =
+{
+ "TypeStatic",
+ "TypeTranslation"
+};
+
+const char *AcpiGbl_TypDecode[] =
+{
+ "Compatibility",
+ "TypeA",
+ "TypeB",
+ "TypeF"
+};
+
+#endif
+
+
+/*
+ * Base sizes of the raw AML resource descriptors, indexed by resource type.
+ * Zero indicates a reserved (and therefore invalid) resource type.
+ */
+const UINT8 AcpiGbl_ResourceAmlSizes[] =
+{
+ /* Small descriptors */
+
+ 0,
+ 0,
+ 0,
+ 0,
+ ACPI_AML_SIZE_SMALL (AML_RESOURCE_IRQ),
+ ACPI_AML_SIZE_SMALL (AML_RESOURCE_DMA),
+ ACPI_AML_SIZE_SMALL (AML_RESOURCE_START_DEPENDENT),
+ ACPI_AML_SIZE_SMALL (AML_RESOURCE_END_DEPENDENT),
+ ACPI_AML_SIZE_SMALL (AML_RESOURCE_IO),
+ ACPI_AML_SIZE_SMALL (AML_RESOURCE_FIXED_IO),
+ 0,
+ 0,
+ 0,
+ 0,
+ ACPI_AML_SIZE_SMALL (AML_RESOURCE_VENDOR_SMALL),
+ ACPI_AML_SIZE_SMALL (AML_RESOURCE_END_TAG),
+
+ /* Large descriptors */
+
+ 0,
+ ACPI_AML_SIZE_LARGE (AML_RESOURCE_MEMORY24),
+ ACPI_AML_SIZE_LARGE (AML_RESOURCE_GENERIC_REGISTER),
+ 0,
+ ACPI_AML_SIZE_LARGE (AML_RESOURCE_VENDOR_LARGE),
+ ACPI_AML_SIZE_LARGE (AML_RESOURCE_MEMORY32),
+ ACPI_AML_SIZE_LARGE (AML_RESOURCE_FIXED_MEMORY32),
+ ACPI_AML_SIZE_LARGE (AML_RESOURCE_ADDRESS32),
+ ACPI_AML_SIZE_LARGE (AML_RESOURCE_ADDRESS16),
+ ACPI_AML_SIZE_LARGE (AML_RESOURCE_EXTENDED_IRQ),
+ ACPI_AML_SIZE_LARGE (AML_RESOURCE_ADDRESS64),
+ ACPI_AML_SIZE_LARGE (AML_RESOURCE_EXTENDED_ADDRESS64)
+};
+
+
+/*
+ * Resource types, used to validate the resource length field.
+ * The length of fixed-length types must match exactly, variable
+ * lengths must meet the minimum required length, etc.
+ * Zero indicates a reserved (and therefore invalid) resource type.
+ */
+static const UINT8 AcpiGbl_ResourceTypes[] =
+{
+ /* Small descriptors */
+
+ 0,
+ 0,
+ 0,
+ 0,
+ ACPI_SMALL_VARIABLE_LENGTH,
+ ACPI_FIXED_LENGTH,
+ ACPI_SMALL_VARIABLE_LENGTH,
+ ACPI_FIXED_LENGTH,
+ ACPI_FIXED_LENGTH,
+ ACPI_FIXED_LENGTH,
+ 0,
+ 0,
+ 0,
+ 0,
+ ACPI_VARIABLE_LENGTH,
+ ACPI_FIXED_LENGTH,
+
+ /* Large descriptors */
+
+ 0,
+ ACPI_FIXED_LENGTH,
+ ACPI_FIXED_LENGTH,
+ 0,
+ ACPI_VARIABLE_LENGTH,
+ ACPI_FIXED_LENGTH,
+ ACPI_FIXED_LENGTH,
+ ACPI_VARIABLE_LENGTH,
+ ACPI_VARIABLE_LENGTH,
+ ACPI_VARIABLE_LENGTH,
+ ACPI_VARIABLE_LENGTH,
+ ACPI_FIXED_LENGTH
+};
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtWalkAmlResources
+ *
+ * PARAMETERS: Aml - Pointer to the raw AML resource template
+ * AmlLength - Length of the entire template
+ * UserFunction - Called once for each descriptor found. If
+ * NULL, a pointer to the EndTag is returned
+ * Context - Passed to UserFunction
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Walk a raw AML resource list(buffer). User function called
+ * once for each resource found.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtWalkAmlResources (
+ UINT8 *Aml,
+ ACPI_SIZE AmlLength,
+ ACPI_WALK_AML_CALLBACK UserFunction,
+ void *Context)
+{
+ ACPI_STATUS Status;
+ UINT8 *EndAml;
+ UINT8 ResourceIndex;
+ UINT32 Length;
+ UINT32 Offset = 0;
+
+
+ ACPI_FUNCTION_TRACE (UtWalkAmlResources);
+
+
+ /* The absolute minimum resource template is one EndTag descriptor */
+
+ if (AmlLength < sizeof (AML_RESOURCE_END_TAG))
+ {
+ return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG);
+ }
+
+ /* Point to the end of the resource template buffer */
+
+ EndAml = Aml + AmlLength;
+
+ /* Walk the byte list, abort on any invalid descriptor type or length */
+
+ while (Aml < EndAml)
+ {
+ /* Validate the Resource Type and Resource Length */
+
+ Status = AcpiUtValidateResource (Aml, &ResourceIndex);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Get the length of this descriptor */
+
+ Length = AcpiUtGetDescriptorLength (Aml);
+
+ /* Invoke the user function */
+
+ if (UserFunction)
+ {
+ Status = UserFunction (Aml, Length, Offset, ResourceIndex, Context);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+ }
+
+ /* An EndTag descriptor terminates this resource template */
+
+ if (AcpiUtGetResourceType (Aml) == ACPI_RESOURCE_NAME_END_TAG)
+ {
+ /*
+ * There must be at least one more byte in the buffer for
+ * the 2nd byte of the EndTag
+ */
+ if ((Aml + 1) >= EndAml)
+ {
+ return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG);
+ }
+
+ /* Return the pointer to the EndTag if requested */
+
+ if (!UserFunction)
+ {
+ *(void **) Context = Aml;
+ }
+
+ /* Normal exit */
+
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ Aml += Length;
+ Offset += Length;
+ }
+
+ /* Did not find an EndTag descriptor */
+
+ return (AE_AML_NO_RESOURCE_END_TAG);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtValidateResource
+ *
+ * PARAMETERS: Aml - Pointer to the raw AML resource descriptor
+ * ReturnIndex - Where the resource index is returned. NULL
+ * if the index is not required.
+ *
+ * RETURN: Status, and optionally the Index into the global resource tables
+ *
+ * DESCRIPTION: Validate an AML resource descriptor by checking the Resource
+ * Type and Resource Length. Returns an index into the global
+ * resource information/dispatch tables for later use.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtValidateResource (
+ void *Aml,
+ UINT8 *ReturnIndex)
+{
+ UINT8 ResourceType;
+ UINT8 ResourceIndex;
+ ACPI_RS_LENGTH ResourceLength;
+ ACPI_RS_LENGTH MinimumResourceLength;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /*
+ * 1) Validate the ResourceType field (Byte 0)
+ */
+ ResourceType = ACPI_GET8 (Aml);
+
+ /*
+ * Byte 0 contains the descriptor name (Resource Type)
+ * Examine the large/small bit in the resource header
+ */
+ if (ResourceType & ACPI_RESOURCE_NAME_LARGE)
+ {
+ /* Verify the large resource type (name) against the max */
+
+ if (ResourceType > ACPI_RESOURCE_NAME_LARGE_MAX)
+ {
+ return (AE_AML_INVALID_RESOURCE_TYPE);
+ }
+
+ /*
+ * Large Resource Type -- bits 6:0 contain the name
+ * Translate range 0x80-0x8B to index range 0x10-0x1B
+ */
+ ResourceIndex = (UINT8) (ResourceType - 0x70);
+ }
+ else
+ {
+ /*
+ * Small Resource Type -- bits 6:3 contain the name
+ * Shift range to index range 0x00-0x0F
+ */
+ ResourceIndex = (UINT8)
+ ((ResourceType & ACPI_RESOURCE_NAME_SMALL_MASK) >> 3);
+ }
+
+ /* Check validity of the resource type, zero indicates name is invalid */
+
+ if (!AcpiGbl_ResourceTypes[ResourceIndex])
+ {
+ return (AE_AML_INVALID_RESOURCE_TYPE);
+ }
+
+
+ /*
+ * 2) Validate the ResourceLength field. This ensures that the length
+ * is at least reasonable, and guarantees that it is non-zero.
+ */
+ ResourceLength = AcpiUtGetResourceLength (Aml);
+ MinimumResourceLength = AcpiGbl_ResourceAmlSizes[ResourceIndex];
+
+ /* Validate based upon the type of resource - fixed length or variable */
+
+ switch (AcpiGbl_ResourceTypes[ResourceIndex])
+ {
+ case ACPI_FIXED_LENGTH:
+
+ /* Fixed length resource, length must match exactly */
+
+ if (ResourceLength != MinimumResourceLength)
+ {
+ return (AE_AML_BAD_RESOURCE_LENGTH);
+ }
+ break;
+
+ case ACPI_VARIABLE_LENGTH:
+
+ /* Variable length resource, length must be at least the minimum */
+
+ if (ResourceLength < MinimumResourceLength)
+ {
+ return (AE_AML_BAD_RESOURCE_LENGTH);
+ }
+ break;
+
+ case ACPI_SMALL_VARIABLE_LENGTH:
+
+ /* Small variable length resource, length can be (Min) or (Min-1) */
+
+ if ((ResourceLength > MinimumResourceLength) ||
+ (ResourceLength < (MinimumResourceLength - 1)))
+ {
+ return (AE_AML_BAD_RESOURCE_LENGTH);
+ }
+ break;
+
+ default:
+
+ /* Shouldn't happen (because of validation earlier), but be sure */
+
+ return (AE_AML_INVALID_RESOURCE_TYPE);
+ }
+
+ /* Optionally return the resource table index */
+
+ if (ReturnIndex)
+ {
+ *ReturnIndex = ResourceIndex;
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtGetResourceType
+ *
+ * PARAMETERS: Aml - Pointer to the raw AML resource descriptor
+ *
+ * RETURN: The Resource Type with no extraneous bits (except the
+ * Large/Small descriptor bit -- this is left alone)
+ *
+ * DESCRIPTION: Extract the Resource Type/Name from the first byte of
+ * a resource descriptor.
+ *
+ ******************************************************************************/
+
+UINT8
+AcpiUtGetResourceType (
+ void *Aml)
+{
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /*
+ * Byte 0 contains the descriptor name (Resource Type)
+ * Examine the large/small bit in the resource header
+ */
+ if (ACPI_GET8 (Aml) & ACPI_RESOURCE_NAME_LARGE)
+ {
+ /* Large Resource Type -- bits 6:0 contain the name */
+
+ return (ACPI_GET8 (Aml));
+ }
+ else
+ {
+ /* Small Resource Type -- bits 6:3 contain the name */
+
+ return ((UINT8) (ACPI_GET8 (Aml) & ACPI_RESOURCE_NAME_SMALL_MASK));
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtGetResourceLength
+ *
+ * PARAMETERS: Aml - Pointer to the raw AML resource descriptor
+ *
+ * RETURN: Byte Length
+ *
+ * DESCRIPTION: Get the "Resource Length" of a raw AML descriptor. By
+ * definition, this does not include the size of the descriptor
+ * header or the length field itself.
+ *
+ ******************************************************************************/
+
+UINT16
+AcpiUtGetResourceLength (
+ void *Aml)
+{
+ ACPI_RS_LENGTH ResourceLength;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /*
+ * Byte 0 contains the descriptor name (Resource Type)
+ * Examine the large/small bit in the resource header
+ */
+ if (ACPI_GET8 (Aml) & ACPI_RESOURCE_NAME_LARGE)
+ {
+ /* Large Resource type -- bytes 1-2 contain the 16-bit length */
+
+ ACPI_MOVE_16_TO_16 (&ResourceLength, ACPI_ADD_PTR (UINT8, Aml, 1));
+
+ }
+ else
+ {
+ /* Small Resource type -- bits 2:0 of byte 0 contain the length */
+
+ ResourceLength = (UINT16) (ACPI_GET8 (Aml) &
+ ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK);
+ }
+
+ return (ResourceLength);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtGetResourceHeaderLength
+ *
+ * PARAMETERS: Aml - Pointer to the raw AML resource descriptor
+ *
+ * RETURN: Length of the AML header (depends on large/small descriptor)
+ *
+ * DESCRIPTION: Get the length of the header for this resource.
+ *
+ ******************************************************************************/
+
+UINT8
+AcpiUtGetResourceHeaderLength (
+ void *Aml)
+{
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /* Examine the large/small bit in the resource header */
+
+ if (ACPI_GET8 (Aml) & ACPI_RESOURCE_NAME_LARGE)
+ {
+ return (sizeof (AML_RESOURCE_LARGE_HEADER));
+ }
+ else
+ {
+ return (sizeof (AML_RESOURCE_SMALL_HEADER));
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtGetDescriptorLength
+ *
+ * PARAMETERS: Aml - Pointer to the raw AML resource descriptor
+ *
+ * RETURN: Byte length
+ *
+ * DESCRIPTION: Get the total byte length of a raw AML descriptor, including the
+ * length of the descriptor header and the length field itself.
+ * Used to walk descriptor lists.
+ *
+ ******************************************************************************/
+
+UINT32
+AcpiUtGetDescriptorLength (
+ void *Aml)
+{
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /*
+ * Get the Resource Length (does not include header length) and add
+ * the header length (depends on if this is a small or large resource)
+ */
+ return (AcpiUtGetResourceLength (Aml) +
+ AcpiUtGetResourceHeaderLength (Aml));
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtGetResourceEndTag
+ *
+ * PARAMETERS: ObjDesc - The resource template buffer object
+ * EndTag - Where the pointer to the EndTag is returned
+ *
+ * RETURN: Status, pointer to the end tag
+ *
+ * DESCRIPTION: Find the EndTag resource descriptor in an AML resource template
+ * Note: allows a buffer length of zero.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtGetResourceEndTag (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ UINT8 **EndTag)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE (UtGetResourceEndTag);
+
+
+ /* Allow a buffer length of zero */
+
+ if (!ObjDesc->Buffer.Length)
+ {
+ *EndTag = ObjDesc->Buffer.Pointer;
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Validate the template and get a pointer to the EndTag */
+
+ Status = AcpiUtWalkAmlResources (ObjDesc->Buffer.Pointer,
+ ObjDesc->Buffer.Length, NULL, EndTag);
+
+ return_ACPI_STATUS (Status);
+}
+
+
diff --git a/sys/contrib/dev/acpica/utstate.c b/sys/contrib/dev/acpica/utstate.c
index bd049ec..a58257b 100644
--- a/sys/contrib/dev/acpica/utstate.c
+++ b/sys/contrib/dev/acpica/utstate.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: utstate - state object support procedures
- * $Revision: 1.2 $
+ * $Revision: 1.8 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -179,7 +179,7 @@ AcpiUtPushGenericState (
ACPI_GENERIC_STATE **ListHead,
ACPI_GENERIC_STATE *State)
{
- ACPI_FUNCTION_TRACE ("UtPushGenericState");
+ ACPI_FUNCTION_TRACE (UtPushGenericState);
/* Push the state object onto the front of the list (stack) */
@@ -210,7 +210,7 @@ AcpiUtPopGenericState (
ACPI_GENERIC_STATE *State;
- ACPI_FUNCTION_TRACE ("UtPopGenericState");
+ ACPI_FUNCTION_TRACE (UtPopGenericState);
/* Remove the state object at the head of the list (stack) */
@@ -254,7 +254,7 @@ AcpiUtCreateGenericState (
if (State)
{
/* Initialize */
- State->Common.DataType = ACPI_DESC_TYPE_STATE;
+ State->Common.DescriptorType = ACPI_DESC_TYPE_STATE;
}
return (State);
@@ -281,7 +281,7 @@ AcpiUtCreateThreadState (
ACPI_GENERIC_STATE *State;
- ACPI_FUNCTION_TRACE ("UtCreateThreadState");
+ ACPI_FUNCTION_TRACE (UtCreateThreadState);
/* Create the generic state object */
@@ -294,9 +294,17 @@ AcpiUtCreateThreadState (
/* Init fields specific to the update struct */
- State->Common.DataType = ACPI_DESC_TYPE_STATE_THREAD;
+ State->Common.DescriptorType = ACPI_DESC_TYPE_STATE_THREAD;
State->Thread.ThreadId = AcpiOsGetThreadId ();
+ /* Check for invalid thread ID - zero is very bad, it will break things */
+
+ if (!State->Thread.ThreadId)
+ {
+ ACPI_ERROR ((AE_INFO, "Invalid zero ID from AcpiOsGetThreadId"));
+ State->Thread.ThreadId = 1;
+ }
+
return_PTR ((ACPI_THREAD_STATE *) State);
}
@@ -324,7 +332,7 @@ AcpiUtCreateUpdateState (
ACPI_GENERIC_STATE *State;
- ACPI_FUNCTION_TRACE_PTR ("UtCreateUpdateState", Object);
+ ACPI_FUNCTION_TRACE_PTR (UtCreateUpdateState, Object);
/* Create the generic state object */
@@ -337,9 +345,9 @@ AcpiUtCreateUpdateState (
/* Init fields specific to the update struct */
- State->Common.DataType = ACPI_DESC_TYPE_STATE_UPDATE;
+ State->Common.DescriptorType = ACPI_DESC_TYPE_STATE_UPDATE;
State->Update.Object = Object;
- State->Update.Value = Action;
+ State->Update.Value = Action;
return_PTR (State);
}
@@ -367,7 +375,7 @@ AcpiUtCreatePkgState (
ACPI_GENERIC_STATE *State;
- ACPI_FUNCTION_TRACE_PTR ("UtCreatePkgState", InternalObject);
+ ACPI_FUNCTION_TRACE_PTR (UtCreatePkgState, InternalObject);
/* Create the generic state object */
@@ -380,11 +388,11 @@ AcpiUtCreatePkgState (
/* Init fields specific to the update struct */
- State->Common.DataType = ACPI_DESC_TYPE_STATE_PACKAGE;
+ State->Common.DescriptorType = ACPI_DESC_TYPE_STATE_PACKAGE;
State->Pkg.SourceObject = (ACPI_OPERAND_OBJECT *) InternalObject;
- State->Pkg.DestObject = ExternalObject;
- State->Pkg.Index = Index;
- State->Pkg.NumPackages = 1;
+ State->Pkg.DestObject = ExternalObject;
+ State->Pkg.Index= Index;
+ State->Pkg.NumPackages = 1;
return_PTR (State);
}
@@ -410,7 +418,7 @@ AcpiUtCreateControlState (
ACPI_GENERIC_STATE *State;
- ACPI_FUNCTION_TRACE ("UtCreateControlState");
+ ACPI_FUNCTION_TRACE (UtCreateControlState);
/* Create the generic state object */
@@ -423,8 +431,8 @@ AcpiUtCreateControlState (
/* Init fields specific to the control struct */
- State->Common.DataType = ACPI_DESC_TYPE_STATE_CONTROL;
- State->Common.State = ACPI_CONTROL_CONDITIONAL_EXECUTING;
+ State->Common.DescriptorType = ACPI_DESC_TYPE_STATE_CONTROL;
+ State->Common.State = ACPI_CONTROL_CONDITIONAL_EXECUTING;
return_PTR (State);
}
@@ -438,8 +446,8 @@ AcpiUtCreateControlState (
*
* RETURN: None
*
- * DESCRIPTION: Put a state object back into the global state cache. The object
- * is not actually freed at this time.
+ * DESCRIPTION: Release a state object to the state cache. NULL state objects
+ * are ignored.
*
******************************************************************************/
@@ -447,10 +455,15 @@ void
AcpiUtDeleteGenericState (
ACPI_GENERIC_STATE *State)
{
- ACPI_FUNCTION_TRACE ("UtDeleteGenericState");
+ ACPI_FUNCTION_TRACE (UtDeleteGenericState);
- (void) AcpiOsReleaseObject (AcpiGbl_StateCache, State);
+ /* Ignore null state */
+
+ if (State)
+ {
+ (void) AcpiOsReleaseObject (AcpiGbl_StateCache, State);
+ }
return_VOID;
}
diff --git a/sys/contrib/dev/acpica/uttrack.c b/sys/contrib/dev/acpica/uttrack.c
new file mode 100644
index 0000000..5c2ae93
--- /dev/null
+++ b/sys/contrib/dev/acpica/uttrack.c
@@ -0,0 +1,726 @@
+/******************************************************************************
+ *
+ * Module Name: uttrack - Memory allocation tracking routines (debug only)
+ * $Revision: 1.5 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 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.
+ *
+ *****************************************************************************/
+
+/*
+ * These procedures are used for tracking memory leaks in the subsystem, and
+ * they get compiled out when the ACPI_DBG_TRACK_ALLOCATIONS is not set.
+ *
+ * Each memory allocation is tracked via a doubly linked list. Each
+ * element contains the caller's component, module name, function name, and
+ * line number. AcpiUtAllocate and AcpiUtAllocateZeroed call
+ * AcpiUtTrackAllocation to add an element to the list; deletion
+ * occurs in the body of AcpiUtFree.
+ */
+
+#define __UTTRACK_C__
+
+#include <contrib/dev/acpica/acpi.h>
+
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+
+#define _COMPONENT ACPI_UTILITIES
+ ACPI_MODULE_NAME ("uttrack")
+
+/* Local prototypes */
+
+static ACPI_DEBUG_MEM_BLOCK *
+AcpiUtFindAllocation (
+ void *Allocation);
+
+static ACPI_STATUS
+AcpiUtTrackAllocation (
+ ACPI_DEBUG_MEM_BLOCK *Address,
+ ACPI_SIZE Size,
+ UINT8 AllocType,
+ UINT32 Component,
+ char *Module,
+ UINT32 Line);
+
+static ACPI_STATUS
+AcpiUtRemoveAllocation (
+ ACPI_DEBUG_MEM_BLOCK *Address,
+ UINT32 Component,
+ char *Module,
+ UINT32 Line);
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtCreateList
+ *
+ * PARAMETERS: CacheName - Ascii name for the cache
+ * ObjectSize - Size of each cached object
+ * ReturnCache - Where the new cache object is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Create a local memory list for tracking purposed
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtCreateList (
+ char *ListName,
+ UINT16 ObjectSize,
+ ACPI_MEMORY_LIST **ReturnCache)
+{
+ ACPI_MEMORY_LIST *Cache;
+
+
+ Cache = AcpiOsAllocate (sizeof (ACPI_MEMORY_LIST));
+ if (!Cache)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ ACPI_MEMSET (Cache, 0, sizeof (ACPI_MEMORY_LIST));
+
+ Cache->ListName = ListName;
+ Cache->ObjectSize = ObjectSize;
+
+ *ReturnCache = Cache;
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtAllocateAndTrack
+ *
+ * PARAMETERS: Size - Size of the allocation
+ * Component - Component type of caller
+ * Module - Source file name of caller
+ * Line - Line number of caller
+ *
+ * RETURN: Address of the allocated memory on success, NULL on failure.
+ *
+ * DESCRIPTION: The subsystem's equivalent of malloc.
+ *
+ ******************************************************************************/
+
+void *
+AcpiUtAllocateAndTrack (
+ ACPI_SIZE Size,
+ UINT32 Component,
+ char *Module,
+ UINT32 Line)
+{
+ ACPI_DEBUG_MEM_BLOCK *Allocation;
+ ACPI_STATUS Status;
+
+
+ Allocation = AcpiUtAllocate (Size + sizeof (ACPI_DEBUG_MEM_HEADER),
+ Component, Module, Line);
+ if (!Allocation)
+ {
+ return (NULL);
+ }
+
+ Status = AcpiUtTrackAllocation (Allocation, Size,
+ ACPI_MEM_MALLOC, Component, Module, Line);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsFree (Allocation);
+ return (NULL);
+ }
+
+ AcpiGbl_GlobalList->TotalAllocated++;
+ AcpiGbl_GlobalList->TotalSize += (UINT32) Size;
+ AcpiGbl_GlobalList->CurrentTotalSize += (UINT32) Size;
+ if (AcpiGbl_GlobalList->CurrentTotalSize > AcpiGbl_GlobalList->MaxOccupied)
+ {
+ AcpiGbl_GlobalList->MaxOccupied = AcpiGbl_GlobalList->CurrentTotalSize;
+ }
+
+ return ((void *) &Allocation->UserSpace);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtAllocateZeroedAndTrack
+ *
+ * PARAMETERS: Size - Size of the allocation
+ * Component - Component type of caller
+ * Module - Source file name of caller
+ * Line - Line number of caller
+ *
+ * RETURN: Address of the allocated memory on success, NULL on failure.
+ *
+ * DESCRIPTION: Subsystem equivalent of calloc.
+ *
+ ******************************************************************************/
+
+void *
+AcpiUtAllocateZeroedAndTrack (
+ ACPI_SIZE Size,
+ UINT32 Component,
+ char *Module,
+ UINT32 Line)
+{
+ ACPI_DEBUG_MEM_BLOCK *Allocation;
+ ACPI_STATUS Status;
+
+
+ Allocation = AcpiUtAllocateZeroed (Size + sizeof (ACPI_DEBUG_MEM_HEADER),
+ Component, Module, Line);
+ if (!Allocation)
+ {
+ /* Report allocation error */
+
+ ACPI_ERROR ((Module, Line,
+ "Could not allocate size %X", (UINT32) Size));
+ return (NULL);
+ }
+
+ Status = AcpiUtTrackAllocation (Allocation, Size,
+ ACPI_MEM_CALLOC, Component, Module, Line);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsFree (Allocation);
+ return (NULL);
+ }
+
+ AcpiGbl_GlobalList->TotalAllocated++;
+ AcpiGbl_GlobalList->TotalSize += (UINT32) Size;
+ AcpiGbl_GlobalList->CurrentTotalSize += (UINT32) Size;
+ if (AcpiGbl_GlobalList->CurrentTotalSize > AcpiGbl_GlobalList->MaxOccupied)
+ {
+ AcpiGbl_GlobalList->MaxOccupied = AcpiGbl_GlobalList->CurrentTotalSize;
+ }
+
+ return ((void *) &Allocation->UserSpace);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtFreeAndTrack
+ *
+ * PARAMETERS: Allocation - Address of the memory to deallocate
+ * Component - Component type of caller
+ * Module - Source file name of caller
+ * Line - Line number of caller
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Frees the memory at Allocation
+ *
+ ******************************************************************************/
+
+void
+AcpiUtFreeAndTrack (
+ void *Allocation,
+ UINT32 Component,
+ char *Module,
+ UINT32 Line)
+{
+ ACPI_DEBUG_MEM_BLOCK *DebugBlock;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE_PTR (UtFree, Allocation);
+
+
+ if (NULL == Allocation)
+ {
+ ACPI_ERROR ((Module, Line,
+ "Attempt to delete a NULL address"));
+
+ return_VOID;
+ }
+
+ DebugBlock = ACPI_CAST_PTR (ACPI_DEBUG_MEM_BLOCK,
+ (((char *) Allocation) - sizeof (ACPI_DEBUG_MEM_HEADER)));
+
+ AcpiGbl_GlobalList->TotalFreed++;
+ AcpiGbl_GlobalList->CurrentTotalSize -= DebugBlock->Size;
+
+ Status = AcpiUtRemoveAllocation (DebugBlock,
+ Component, Module, Line);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_EXCEPTION ((AE_INFO, Status, "Could not free memory"));
+ }
+
+ AcpiOsFree (DebugBlock);
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "%p freed\n", Allocation));
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtFindAllocation
+ *
+ * PARAMETERS: Allocation - Address of allocated memory
+ *
+ * RETURN: A list element if found; NULL otherwise.
+ *
+ * DESCRIPTION: Searches for an element in the global allocation tracking list.
+ *
+ ******************************************************************************/
+
+static ACPI_DEBUG_MEM_BLOCK *
+AcpiUtFindAllocation (
+ void *Allocation)
+{
+ ACPI_DEBUG_MEM_BLOCK *Element;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ Element = AcpiGbl_GlobalList->ListHead;
+
+ /* Search for the address. */
+
+ while (Element)
+ {
+ if (Element == Allocation)
+ {
+ return (Element);
+ }
+
+ Element = Element->Next;
+ }
+
+ return (NULL);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtTrackAllocation
+ *
+ * PARAMETERS: Allocation - Address of allocated memory
+ * Size - Size of the allocation
+ * AllocType - MEM_MALLOC or MEM_CALLOC
+ * Component - Component type of caller
+ * Module - Source file name of caller
+ * Line - Line number of caller
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Inserts an element into the global allocation tracking list.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiUtTrackAllocation (
+ ACPI_DEBUG_MEM_BLOCK *Allocation,
+ ACPI_SIZE Size,
+ UINT8 AllocType,
+ UINT32 Component,
+ char *Module,
+ UINT32 Line)
+{
+ ACPI_MEMORY_LIST *MemList;
+ ACPI_DEBUG_MEM_BLOCK *Element;
+ ACPI_STATUS Status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE_PTR (UtTrackAllocation, Allocation);
+
+
+ MemList = AcpiGbl_GlobalList;
+ Status = AcpiUtAcquireMutex (ACPI_MTX_MEMORY);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * Search list for this address to make sure it is not already on the list.
+ * This will catch several kinds of problems.
+ */
+ Element = AcpiUtFindAllocation (Allocation);
+ if (Element)
+ {
+ ACPI_ERROR ((AE_INFO,
+ "UtTrackAllocation: Allocation already present in list! (%p)",
+ Allocation));
+
+ ACPI_ERROR ((AE_INFO, "Element %p Address %p",
+ Element, Allocation));
+
+ goto UnlockAndExit;
+ }
+
+ /* Fill in the instance data. */
+
+ Allocation->Size = (UINT32) Size;
+ Allocation->AllocType = AllocType;
+ Allocation->Component = Component;
+ Allocation->Line = Line;
+
+ ACPI_STRNCPY (Allocation->Module, Module, ACPI_MAX_MODULE_NAME);
+ Allocation->Module[ACPI_MAX_MODULE_NAME-1] = 0;
+
+ /* Insert at list head */
+
+ if (MemList->ListHead)
+ {
+ ((ACPI_DEBUG_MEM_BLOCK *)(MemList->ListHead))->Previous = Allocation;
+ }
+
+ Allocation->Next = MemList->ListHead;
+ Allocation->Previous = NULL;
+
+ MemList->ListHead = Allocation;
+
+
+UnlockAndExit:
+ Status = AcpiUtReleaseMutex (ACPI_MTX_MEMORY);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtRemoveAllocation
+ *
+ * PARAMETERS: Allocation - Address of allocated memory
+ * Component - Component type of caller
+ * Module - Source file name of caller
+ * Line - Line number of caller
+ *
+ * RETURN:
+ *
+ * DESCRIPTION: Deletes an element from the global allocation tracking list.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiUtRemoveAllocation (
+ ACPI_DEBUG_MEM_BLOCK *Allocation,
+ UINT32 Component,
+ char *Module,
+ UINT32 Line)
+{
+ ACPI_MEMORY_LIST *MemList;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE (UtRemoveAllocation);
+
+
+ MemList = AcpiGbl_GlobalList;
+ if (NULL == MemList->ListHead)
+ {
+ /* No allocations! */
+
+ ACPI_ERROR ((Module, Line,
+ "Empty allocation list, nothing to free!"));
+
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_MEMORY);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Unlink */
+
+ if (Allocation->Previous)
+ {
+ (Allocation->Previous)->Next = Allocation->Next;
+ }
+ else
+ {
+ MemList->ListHead = Allocation->Next;
+ }
+
+ if (Allocation->Next)
+ {
+ (Allocation->Next)->Previous = Allocation->Previous;
+ }
+
+ /* Mark the segment as deleted */
+
+ ACPI_MEMSET (&Allocation->UserSpace, 0xEA, Allocation->Size);
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Freeing size 0%X\n",
+ Allocation->Size));
+
+ Status = AcpiUtReleaseMutex (ACPI_MTX_MEMORY);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtDumpAllocationInfo
+ *
+ * PARAMETERS:
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Print some info about the outstanding allocations.
+ *
+ ******************************************************************************/
+
+void
+AcpiUtDumpAllocationInfo (
+ void)
+{
+/*
+ ACPI_MEMORY_LIST *MemList;
+*/
+
+ ACPI_FUNCTION_TRACE (UtDumpAllocationInfo);
+
+/*
+ ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
+ ("%30s: %4d (%3d Kb)\n", "Current allocations",
+ MemList->CurrentCount,
+ ROUND_UP_TO_1K (MemList->CurrentSize)));
+
+ ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
+ ("%30s: %4d (%3d Kb)\n", "Max concurrent allocations",
+ MemList->MaxConcurrentCount,
+ ROUND_UP_TO_1K (MemList->MaxConcurrentSize)));
+
+
+ ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
+ ("%30s: %4d (%3d Kb)\n", "Total (all) internal objects",
+ RunningObjectCount,
+ ROUND_UP_TO_1K (RunningObjectSize)));
+
+ ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
+ ("%30s: %4d (%3d Kb)\n", "Total (all) allocations",
+ RunningAllocCount,
+ ROUND_UP_TO_1K (RunningAllocSize)));
+
+
+ ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
+ ("%30s: %4d (%3d Kb)\n", "Current Nodes",
+ AcpiGbl_CurrentNodeCount,
+ ROUND_UP_TO_1K (AcpiGbl_CurrentNodeSize)));
+
+ ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
+ ("%30s: %4d (%3d Kb)\n", "Max Nodes",
+ AcpiGbl_MaxConcurrentNodeCount,
+ ROUND_UP_TO_1K ((AcpiGbl_MaxConcurrentNodeCount *
+ sizeof (ACPI_NAMESPACE_NODE)))));
+*/
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtDumpAllocations
+ *
+ * PARAMETERS: Component - Component(s) to dump info for.
+ * Module - Module to dump info for. NULL means all.
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Print a list of all outstanding allocations.
+ *
+ ******************************************************************************/
+
+void
+AcpiUtDumpAllocations (
+ UINT32 Component,
+ char *Module)
+{
+ ACPI_DEBUG_MEM_BLOCK *Element;
+ ACPI_DESCRIPTOR *Descriptor;
+ UINT32 NumOutstanding = 0;
+
+
+ ACPI_FUNCTION_TRACE (UtDumpAllocations);
+
+
+ /*
+ * Walk the allocation list.
+ */
+ if (ACPI_FAILURE (AcpiUtAcquireMutex (ACPI_MTX_MEMORY)))
+ {
+ return;
+ }
+
+ Element = AcpiGbl_GlobalList->ListHead;
+ while (Element)
+ {
+ if ((Element->Component & Component) &&
+ ((Module == NULL) || (0 == ACPI_STRCMP (Module, Element->Module))))
+ {
+ /* Ignore allocated objects that are in a cache */
+
+ Descriptor = ACPI_CAST_PTR (ACPI_DESCRIPTOR, &Element->UserSpace);
+ if (ACPI_GET_DESCRIPTOR_TYPE (Descriptor) != ACPI_DESC_TYPE_CACHED)
+ {
+ AcpiOsPrintf ("%p Len %04X %9.9s-%d [%s] ",
+ Descriptor, Element->Size, Element->Module,
+ Element->Line, AcpiUtGetDescriptorName (Descriptor));
+
+ /* Most of the elements will be Operand objects. */
+
+ switch (ACPI_GET_DESCRIPTOR_TYPE (Descriptor))
+ {
+ case ACPI_DESC_TYPE_OPERAND:
+ AcpiOsPrintf ("%12.12s R%hd",
+ AcpiUtGetTypeName (Descriptor->Object.Common.Type),
+ Descriptor->Object.Common.ReferenceCount);
+ break;
+
+ case ACPI_DESC_TYPE_PARSER:
+ AcpiOsPrintf ("AmlOpcode %04hX",
+ Descriptor->Op.Asl.AmlOpcode);
+ break;
+
+ case ACPI_DESC_TYPE_NAMED:
+ AcpiOsPrintf ("%4.4s",
+ AcpiUtGetNodeName (&Descriptor->Node));
+ break;
+
+ default:
+ break;
+ }
+
+ AcpiOsPrintf ( "\n");
+ NumOutstanding++;
+ }
+ }
+ Element = Element->Next;
+ }
+
+ (void) AcpiUtReleaseMutex (ACPI_MTX_MEMORY);
+
+ /* Print summary */
+
+ if (!NumOutstanding)
+ {
+ ACPI_INFO ((AE_INFO,
+ "No outstanding allocations"));
+ }
+ else
+ {
+ ACPI_ERROR ((AE_INFO,
+ "%d(%X) Outstanding allocations",
+ NumOutstanding, NumOutstanding));
+ }
+
+ return_VOID;
+}
+
+#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
+
diff --git a/sys/contrib/dev/acpica/utxface.c b/sys/contrib/dev/acpica/utxface.c
index b6f5076..83c420e 100644
--- a/sys/contrib/dev/acpica/utxface.c
+++ b/sys/contrib/dev/acpica/utxface.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: utxface - External interfaces for "global" ACPI functions
- * $Revision: 1.112 $
+ * $Revision: 1.125 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -146,9 +146,10 @@ AcpiInitializeSubsystem (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("AcpiInitializeSubsystem");
+ ACPI_FUNCTION_TRACE (AcpiInitializeSubsystem);
+ AcpiGbl_StartupFlags = ACPI_SUBSYSTEM_INITIALIZE;
ACPI_DEBUG_EXEC (AcpiUtInitStackPtrTrace ());
/* Initialize the OS-Dependent layer */
@@ -156,8 +157,7 @@ AcpiInitializeSubsystem (
Status = AcpiOsInitialize ();
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR (("OSD failed to initialize, %s\n",
- AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status, "During OSL initialization"));
return_ACPI_STATUS (Status);
}
@@ -170,8 +170,7 @@ AcpiInitializeSubsystem (
Status = AcpiUtMutexInitialize ();
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR (("Global mutex creation failure, %s\n",
- AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status, "During Global Mutex creation"));
return_ACPI_STATUS (Status);
}
@@ -182,18 +181,18 @@ AcpiInitializeSubsystem (
Status = AcpiNsRootInitialize ();
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR (("Namespace initialization failure, %s\n",
- AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status, "During Namespace initialization"));
return_ACPI_STATUS (Status);
}
/* If configured, initialize the AML debugger */
ACPI_DEBUGGER_EXEC (Status = AcpiDbInitialize ());
-
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiInitializeSubsystem)
+
/*******************************************************************************
*
@@ -215,25 +214,9 @@ AcpiEnableSubsystem (
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE ("AcpiEnableSubsystem");
+ ACPI_FUNCTION_TRACE (AcpiEnableSubsystem);
- /*
- * We must initialize the hardware before we can enable ACPI.
- * The values from the FADT are validated here.
- */
- if (!(Flags & ACPI_NO_HARDWARE_INIT))
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
- "[Init] Initializing ACPI hardware\n"));
-
- Status = AcpiHwInitialize ();
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
- }
-
/* Enable ACPI mode */
if (!(Flags & ACPI_NO_ACPI_ENABLE))
@@ -245,7 +228,7 @@ AcpiEnableSubsystem (
Status = AcpiEnable ();
if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "AcpiEnable failed.\n"));
+ ACPI_WARNING ((AE_INFO, "AcpiEnable failed"));
return_ACPI_STATUS (Status);
}
}
@@ -270,10 +253,14 @@ AcpiEnableSubsystem (
/*
* Initialize ACPI Event handling (Fixed and General Purpose)
*
- * NOTE: We must have the hardware AND events initialized before we can
- * execute ANY control methods SAFELY. Any control method can require
- * ACPI hardware support, so the hardware MUST be initialized before
- * execution!
+ * Note1: We must have the hardware and events initialized before we can
+ * execute any control methods safely. Any control method can require
+ * ACPI hardware support, so the hardware must be fully initialized before
+ * any method execution!
+ *
+ * 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)
*/
if (!(Flags & ACPI_NO_EVENT_INIT))
{
@@ -287,8 +274,10 @@ AcpiEnableSubsystem (
}
}
- /* Install the SCI handler and Global Lock handler */
-
+ /*
+ * Install the SCI handler and Global Lock handler. This completes the
+ * hardware initialization.
+ */
if (!(Flags & ACPI_NO_HANDLER_INIT))
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
@@ -301,9 +290,32 @@ 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);
}
+ACPI_EXPORT_SYMBOL (AcpiEnableSubsystem)
+
+
/*******************************************************************************
*
* FUNCTION: AcpiInitializeObjects
@@ -324,15 +336,15 @@ AcpiInitializeObjects (
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE ("AcpiInitializeObjects");
+ ACPI_FUNCTION_TRACE (AcpiInitializeObjects);
/*
* Run all _REG methods
*
- * NOTE: Any objects accessed
- * by the _REG methods will be automatically initialized, even if they
- * contain executable AML (see call to AcpiNsInitializeObjects below).
+ * Note: Any objects accessed by the _REG methods will be automatically
+ * initialized, even if they contain executable AML (see the call to
+ * AcpiNsInitializeObjects below).
*/
if (!(Flags & ACPI_NO_ADDRESS_SPACE_INIT))
{
@@ -347,9 +359,9 @@ AcpiInitializeObjects (
}
/*
- * Initialize the objects that remain uninitialized. This
- * runs the executable AML that may be part of the declaration of these
- * objects: OperationRegions, BufferFields, Buffers, and Packages.
+ * Initialize the objects that remain uninitialized. This runs the
+ * executable AML that may be part of the declaration of these objects:
+ * OperationRegions, BufferFields, Buffers, and Packages.
*/
if (!(Flags & ACPI_NO_OBJECT_INIT))
{
@@ -364,8 +376,8 @@ AcpiInitializeObjects (
}
/*
- * Initialize all device objects in the namespace
- * This runs the _STA and _INI methods.
+ * Initialize all device objects in the namespace. This runs the device
+ * _STA and _INI methods.
*/
if (!(Flags & ACPI_NO_DEVICE_INIT))
{
@@ -390,6 +402,8 @@ AcpiInitializeObjects (
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiInitializeObjects)
+
/*******************************************************************************
*
@@ -410,7 +424,7 @@ AcpiTerminate (
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("AcpiTerminate");
+ ACPI_FUNCTION_TRACE (AcpiTerminate);
/* Terminate the AML Debugger if present */
@@ -440,6 +454,8 @@ AcpiTerminate (
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiTerminate)
+
/*******************************************************************************
*
@@ -470,6 +486,8 @@ AcpiSubsystemStatus (
}
}
+ACPI_EXPORT_SYMBOL (AcpiSubsystemStatus)
+
/*******************************************************************************
*
@@ -495,10 +513,9 @@ AcpiGetSystemInfo (
{
ACPI_SYSTEM_INFO *InfoPtr;
ACPI_STATUS Status;
- UINT32 i;
- ACPI_FUNCTION_TRACE ("AcpiGetSystemInfo");
+ ACPI_FUNCTION_TRACE (AcpiGetSystemInfo);
/* Parameter validation */
@@ -522,19 +539,15 @@ AcpiGetSystemInfo (
*/
InfoPtr = (ACPI_SYSTEM_INFO *) OutBuffer->Pointer;
- InfoPtr->AcpiCaVersion = ACPI_CA_VERSION;
+ InfoPtr->AcpiCaVersion = ACPI_CA_VERSION;
/* System flags (ACPI capabilities) */
- InfoPtr->Flags = ACPI_SYS_MODE_ACPI;
+ InfoPtr->Flags = ACPI_SYS_MODE_ACPI;
/* Timer resolution - 24 or 32 bits */
- if (!AcpiGbl_FADT)
- {
- InfoPtr->TimerResolution = 0;
- }
- else if (AcpiGbl_FADT->TmrValExt == 0)
+ if (AcpiGbl_FADT.Flags & ACPI_FADT_32BIT_TIMER)
{
InfoPtr->TimerResolution = 24;
}
@@ -545,25 +558,19 @@ AcpiGetSystemInfo (
/* Clear the reserved fields */
- InfoPtr->Reserved1 = 0;
- InfoPtr->Reserved2 = 0;
+ InfoPtr->Reserved1 = 0;
+ InfoPtr->Reserved2 = 0;
/* Current debug levels */
- InfoPtr->DebugLayer = AcpiDbgLayer;
- InfoPtr->DebugLevel = AcpiDbgLevel;
-
- /* Current status of the ACPI tables, per table type */
-
- InfoPtr->NumTableTypes = NUM_ACPI_TABLE_TYPES;
- for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++)
- {
- InfoPtr->TableInfo[i].Count = AcpiGbl_TableLists[i].Count;
- }
+ InfoPtr->DebugLayer = AcpiDbgLayer;
+ InfoPtr->DebugLevel = AcpiDbgLevel;
return_ACPI_STATUS (AE_OK);
}
+ACPI_EXPORT_SYMBOL (AcpiGetSystemInfo)
+
/*****************************************************************************
*
@@ -600,6 +607,8 @@ AcpiInstallInitializationHandler (
return AE_OK;
}
+ACPI_EXPORT_SYMBOL (AcpiInstallInitializationHandler)
+
/*****************************************************************************
*
@@ -617,7 +626,7 @@ ACPI_STATUS
AcpiPurgeCachedObjects (
void)
{
- ACPI_FUNCTION_TRACE ("AcpiPurgeCachedObjects");
+ ACPI_FUNCTION_TRACE (AcpiPurgeCachedObjects);
(void) AcpiOsPurgeCache (AcpiGbl_StateCache);
(void) AcpiOsPurgeCache (AcpiGbl_OperandCache);
@@ -625,3 +634,5 @@ AcpiPurgeCachedObjects (
(void) AcpiOsPurgeCache (AcpiGbl_PsNodeExtCache);
return_ACPI_STATUS (AE_OK);
}
+
+ACPI_EXPORT_SYMBOL (AcpiPurgeCachedObjects)
OpenPOWER on IntegriCloud