aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2011-02-11 22:56:14 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2011-02-11 22:56:14 +0000
commit19834a6cfd047752c68451e6ded1a2950f6b1f44 (patch)
tree9d61cc356dc91b33ff673ba89e884aab6cbb55be
parent8f74426ca5911529047348ff4731e7f5fbb49c67 (diff)
downloadsrc-19834a6cfd047752c68451e6ded1a2950f6b1f44.tar.gz
src-19834a6cfd047752c68451e6ded1a2950f6b1f44.zip
Import ACPICA 20110211.vendor/acpica/20110211
Notes
Notes: svn path=/vendor-sys/acpica/dist/; revision=218585 svn path=/vendor-sys/acpica/20110211/; revision=218586; tag=vendor/acpica/20110211
-rw-r--r--changes.txt609
-rw-r--r--common/dmtable.c14
-rw-r--r--common/dmtbdump.c83
-rw-r--r--common/dmtbinfo.c3
-rw-r--r--compiler/Makefile29
-rw-r--r--compiler/aslanalyze.c1734
-rw-r--r--compiler/aslbtypes.c525
-rw-r--r--compiler/aslcompile.c14
-rw-r--r--compiler/aslcompiler.h79
-rw-r--r--compiler/aslcompiler.l3
-rw-r--r--compiler/aslcompiler.y12
-rw-r--r--compiler/aslmessages.h14
-rw-r--r--compiler/aslpredef.c69
-rw-r--r--compiler/asltree.c70
-rw-r--r--compiler/aslwalks.c1148
-rw-r--r--compiler/dtcompile.c16
-rw-r--r--compiler/dtcompiler.h32
-rw-r--r--compiler/dtexpress.c390
-rw-r--r--compiler/dtfield.c51
-rw-r--r--compiler/dtio.c64
-rw-r--r--compiler/dttable.c22
-rw-r--r--compiler/dtutils.c7
-rw-r--r--debugger/dbcmds.c1331
-rw-r--r--debugger/dbdisply.c137
-rw-r--r--debugger/dbinput.c196
-rw-r--r--debugger/dbmethod.c525
-rw-r--r--debugger/dbnames.c934
-rw-r--r--dispatcher/dsargs.c430
-rw-r--r--dispatcher/dscontrol.c424
-rw-r--r--dispatcher/dsopcode.c746
-rw-r--r--dispatcher/dswload.c695
-rw-r--r--dispatcher/dswload2.c747
-rw-r--r--events/evgpe.c10
-rw-r--r--events/evregion.c2
-rw-r--r--events/evxfregn.c36
-rw-r--r--executer/exfldio.c4
-rw-r--r--generate/unix/Makefile31
-rw-r--r--generate/unix/Makefile.config87
-rw-r--r--generate/unix/acpiexec/Makefile649
-rw-r--r--generate/unix/acpinames/Makefile297
-rw-r--r--generate/unix/acpisrc/Makefile77
-rw-r--r--generate/unix/acpixtract/Makefile17
-rw-r--r--generate/unix/iasl/Makefile602
-rw-r--r--generate/unix/readme.txt51
-rw-r--r--include/acdebug.h117
-rw-r--r--include/acdisasm.h2
-rw-r--r--include/acdispat.h50
-rw-r--r--include/acglobal.h4
-rw-r--r--include/aclocal.h19
-rw-r--r--include/acoutput.h12
-rw-r--r--include/acpixf.h2
-rw-r--r--include/actbl.h16
-rw-r--r--tables/tbfadt.c5
-rw-r--r--tests/misc/badcode.asl31
-rw-r--r--tools/acpiexec/Makefile24
-rw-r--r--tools/acpiexec/aecommon.h6
-rw-r--r--tools/acpiexec/aehandlers.c130
-rw-r--r--tools/acpiexec/aemain.c14
-rw-r--r--tools/acpinames/Makefile298
-rw-r--r--tools/acpisrc/astable.c1
-rw-r--r--utilities/utdecode.c627
-rw-r--r--utilities/utglobal.c564
62 files changed, 9434 insertions, 5504 deletions
diff --git a/changes.txt b/changes.txt
index 29a9aa2e0668..b7e53872752d 100644
--- a/changes.txt
+++ b/changes.txt
@@ -1,18 +1,107 @@
----------------------------------------
+11 February 2011. Summary of changes for version 20110211:
+
+This release is available at www.acpica.org/downloads
+
+1) ACPI CA Core Subsystem:
+
+Added a mechanism to defer _REG methods for some early-installed handlers.
+Most user handlers should be installed before call to AcpiEnableSubsystem.
+However, Event handlers and region handlers should be installed after
+AcpiInitializeObjects. Override handlers for the "default" regions should be
+installed early, however. This change executes all _REG methods for the
+default regions (Memory/IO/PCI/DataTable) simultaneously to prevent any
+chicken/egg issues between them. ACPICA BZ 848.
+
+Implemented an optimization for GPE detection. This optimization will simply
+ignore GPE registers that contain no enabled GPEs -- there is no need to
+read the register since this information is available internally. This
+becomes more important on machines with a large GPE space. ACPICA bugzilla
+884. Lin Ming. Suggestion from Joe Liu.
+
+Removed all use of the highly unreliable FADT revision field. The revision
+number in the FADT has been found to be completely unreliable and cannot be
+trusted. Only the actual table length can be used to infer the version. This
+change updates the ACPICA core and the disassembler so that both no longer
+even look at the FADT version and instead depend solely upon the FADT
+length.
+
+Fix an unresolved name issue for the no-debug and no-error-message source
+generation cases. The _AcpiModuleName was left undefined in these cases, but
+it is actually needed as a parameter to some interfaces. Define
+_AcpiModuleName as a null string in these cases. ACPICA Bugzilla 888.
+
+Split several large files (makefiles and project files updated)
+ utglobal.c -> utdecode.c
+ dbcomds.c -> dbmethod.c dbnames.c
+ dsopcode.c -> dsargs.c dscontrol.c
+ dsload.c -> dsload2.c
+ aslanalyze.c -> aslbtypes.c aslwalks.c
+
+Example Code and Data Size: These are the sizes for the OS-independent
+acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The
+debug version of the code includes the debug output trace mechanism and has
+a much larger code and data size.
+
+ Previous Release (VC 9.0):
+ Non-Debug Version: 89.7K Code, 23.7K Data, 113.4K Total
+ Debug Version: 163.9K Code, 67.5K Data, 231.4K Total
+ Current Release (VC 9.0):
+ Non-Debug Version: 89.7K Code, 23.7K Data, 113.4K Total
+ Debug Version: 163.9K Code, 67.5K Data, 231.4K Total
+
+2) iASL Compiler/Disassembler and Tools:
+
+iASL: Implemented the predefined macros __LINE__, __FILE__, and __DATE__.
+These are useful C-style macros with the standard definitions. ACPICA
+bugzilla 898.
+
+iASL/DTC: Added support for integer expressions and labels. Support for full
+expressions for all integer fields in all ACPI tables. Support for labels in
+"generic" portions of tables such as UEFI. See the iASL reference manual.
+
+Debugger: Added a command to display the status of global handlers. The
+"handlers" command will display op region, fixed event, and miscellaneous
+global handlers. installation status -- and for op regions, whether default
+or user-installed handler will be used.
+
+iASL: Warn if reserved method incorrectly returns a value. Many predefined
+names are defined such that they do not return a value. If implemented as a
+method, issue a warning if such a name explicitly returns a value. ACPICA
+Bugzilla 855.
+
+iASL: Added detection of GPE method name conflicts. Detects a conflict where
+there are two GPE methods of the form _Lxy and _Exy in the same scope. (For
+example, _L1D and _E1D in the same scope.) ACPICA bugzilla 848.
+
+iASL/DTC: Fixed a couple input scanner issues with comments and line
+numbers. Comment remover could get confused and miss a comment ending. Fixed
+a problem with line counter maintenance.
+
+iASL/DTC: Reduced the severity of some errors from fatal to error. There is
+no need to abort on simple errors within a field definition.
+
+Debugger: Simplified the output of the help command. All help output now in
+a single screen, instead of help subcommands. ACPICA Bugzilla 897.
+
+
+----------------------------------------
12 January 2011. Summary of changes for version 20110112:
1) ACPI CA Core Subsystem:
Fixed a race condition between method execution and namespace walks that can
possibly cause a fault. The problem was apparently introduced in version
-20100528 as a result of a performance optimization that reduces the number of
+20100528 as a result of a performance optimization that reduces the number
+of
namespace walks upon method exit by using the delete_namespace_subtree
function instead of the delete_namespace_by_owner function used previously.
Bug is a missing namespace lock in the delete_namespace_subtree function.
dana.myers@oracle.com
Fixed several issues and a possible fault with the automatic "serialized"
-method support. History: This support changes a method to "serialized" on the
+method support. History: This support changes a method to "serialized" on
+the
fly if the method generates an AE_ALREADY_EXISTS error, indicating the
possibility that it cannot handle reentrancy. This fix repairs a couple of
issues seen in the field, especially on machines with many cores:
@@ -50,7 +139,8 @@ details.
Example Code and Data Size: These are the sizes for the OS-independent
acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The
-debug version of the code includes the debug output trace mechanism and has a
+debug version of the code includes the debug output trace mechanism and has
+a
much larger code and data size.
Previous Release (VC 6.0):
@@ -62,11 +152,13 @@ much larger code and data size.
2) iASL Compiler/Disassembler and Tools:
-iASL: Added generic data types to the Data Table compiler. Add "generic" data
+iASL: Added generic data types to the Data Table compiler. Add "generic"
+data
types such as UINT32, String, Unicode, etc., to simplify the generation of
platform-defined tables such as UEFI. Lin Ming.
-iASL: Added listing support for the Data Table Compiler. Adds listing support
+iASL: Added listing support for the Data Table Compiler. Adds listing
+support
(-l) to display actual binary output for each line of input code.
----------------------------------------
@@ -98,13 +190,15 @@ when a Wake GPE is received if there is no corresponding GPE method or
handler. ACPICA BZ 870.
Fixed a problem with the Scope() operator during table parse and load phase.
-During load phase (table load or method execution), the scope operator should
+During load phase (table load or method execution), the scope operator
+should
not enter the target into the namespace. Instead, it should open a new scope
at the target location. Linux BZ 19462, ACPICA BZ 882.
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
+debug version of the code includes the debug output trace mechanism and has
+a
much larger code and data size.
Previous Release:
@@ -163,7 +257,8 @@ longer needed in Execute_HID, Execute_CID, and Execute_UID. ACPICA BZ 878.
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
+debug version of the code includes the debug output trace mechanism and has
+a
much larger code and data size.
Previous Release:
@@ -176,13 +271,16 @@ much larger code and data size.
2) iASL Compiler/Disassembler and Tools:
iASL: Implemented additional compile-time validation for _HID strings. The
-non-hex prefix (such as "PNP" or "ACPI") must be uppercase, and the length of
+non-hex prefix (such as "PNP" or "ACPI") must be uppercase, and the length
+of
the string must be exactly seven or eight characters. For both _HID and _CID
strings, all characters must be alphanumeric. ACPICA BZ 874.
iASL: Allow certain "null" resource descriptors. Some BIOS code creates
-descriptors that are mostly or all zeros, with the expectation that they will
-be filled in at runtime. iASL now allows this as long as there is a "resource
+descriptors that are mostly or all zeros, with the expectation that they
+will
+be filled in at runtime. iASL now allows this as long as there is a
+"resource
tag" (name) associated with the descriptor, which gives the ASL a handle
needed to modify the descriptor. ACPICA BZ 873.
@@ -192,7 +290,8 @@ threaded ACPICA tools/applications - increasing performance. The
_MULTI_THREADED option was replaced by the (reverse) ACPI_SINGLE_THREADED
option. ACPICA BZ 879.
-AcpiExec: several fixes for the 64-bit version. Adds XSDT support and support
+AcpiExec: several fixes for the 64-bit version. Adds XSDT support and
+support
for 64-bit DSDT/FACS addresses in the FADT. Lin Ming.
iASL: Moved all compiler messages to a new file, aslmessages.h.
@@ -202,7 +301,8 @@ iASL: Moved all compiler messages to a new file, aslmessages.h.
1) ACPI CA Core Subsystem:
-Removed the AcpiOsDerivePciId OSL interface. The various host implementations
+Removed the AcpiOsDerivePciId OSL interface. The various host
+implementations
of this function were not OS-dependent and are now obsolete and can be
removed from all host OSLs. This function has been replaced by
AcpiHwDerivePciId, which is now part of the ACPICA core code.
@@ -216,7 +316,8 @@ accordance with the ACPI specification and will simplify host driver code.
ACPICA BZ 871.
The ACPI_THREAD_ID type is no longer configurable, internally it is now
-always UINT64. This simplifies the ACPICA code, especially any printf output.
+always UINT64. This simplifies the ACPICA code, especially any printf
+output.
UINT64 is the only common data type for all thread_id types across all
operating systems. It is now up to the host OSL to cast the native thread_id
type to UINT64 before returning the value to ACPICA (via AcpiOsGetThreadId).
@@ -238,7 +339,8 @@ is used. ACPICA BZ 829. Lin Ming, Bob Moore.
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
+debug version of the code includes the debug output trace mechanism and has
+a
much larger code and data size.
Previous Release:
@@ -267,7 +369,8 @@ of size_t on 32-bit versus 64-bit generations. Lin Ming.
Designed and implemented a new host interface to the _OSI support code. This
will allow the host to dynamically add or remove multiple _OSI strings, as
well as install an optional handler that is called for each _OSI invocation.
-Also added a new AML debugger command, 'osi' to display and modify the global
+Also added a new AML debugger command, 'osi' to display and modify the
+global
_OSI string table, and test support in the AcpiExec utility. See the ACPICA
reference manual for full details. Lin Ming, Bob Moore. ACPICA BZ 836.
New Functions:
@@ -296,12 +399,14 @@ It should be a (UINT64 *). This may affect some host OSL code.
Fixed a couple problems with the recently modified Linux makefiles for iASL
and AcpiExec. These new makefiles place the generated object files in the
-local directory so that there can be no collisions between the files that are
+local directory so that there can be no collisions between the files that
+are
shared between them that are compiled with different options.
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
+debug version of the code includes the debug output trace mechanism and has
+a
much larger code and data size.
Previous Release:
@@ -342,25 +447,29 @@ interface. This interface will set or clear individual GPEs for wakeup.
5) Remove GpeType argument from AcpiEnable and AcpiDisable. These interfaces
are now used for "runtime" GPEs only.
-Changed the behavior of the GPE install/remove handler interfaces. The GPE is
+Changed the behavior of the GPE install/remove handler interfaces. The GPE
+is
no longer disabled during this process, as it was found to cause problems on
some machines. Rafael J. Wysocki.
Reverted a change introduced in version 20100528 to enable Embedded
-Controller multi-byte transfers. This change was found to cause problems with
+Controller multi-byte transfers. This change was found to cause problems
+with
Index Fields and possibly Bank Fields. It will be reintroduced when these
problems have been resolved.
Fixed a problem with references to Alias objects within Package Objects. A
reference to an Alias within the definition of a Package was not always
resolved properly. Aliases to objects like Processors, Thermal zones, etc.
-were resolved to the actual object instead of a reference to the object as it
+were resolved to the actual object instead of a reference to the object as
+it
should be. Package objects are only allowed to contain integer, string,
buffer, package, and reference objects. Redhat bugzilla 608648.
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
+debug version of the code includes the debug output trace mechanism and has
+a
much larger code and data size.
Previous Release:
@@ -410,7 +519,8 @@ ACPI tables that have been seen in the field: ATKG, IEIT, GSCI.
Implemented support to enable multi-byte transfers for Embedded Controller
(EC) operation regions. Previously, the maximum data size passed to the EC
operation region handler was a single byte. There are often EC Fields larger
-than one byte that need to be transferred, and it is useful for the EC driver
+than one byte that need to be transferred, and it is useful for the EC
+driver
to lock these as a single transaction. This change enables single transfers
larger than 8 bits. This effectively changes the access to the EC space from
ByteAcc to AnyAcc, and will probably require changes to the host OS Embedded
@@ -427,12 +537,16 @@ node and an ACPI operand object. However, this is the first growth of the
namespace in ten years. ACPICA bugzilla 817. Alexey Starikovskiy.
Implemented a performance optimization that reduces the number of namespace
-walks. On control method exit, only walk the namespace if the method is known
-to have created namespace objects outside of its local scope. Previously, the
+walks. On control method exit, only walk the namespace if the method is
+known
+to have created namespace objects outside of its local scope. Previously,
+the
entire namespace was traversed on each control method exit. This change can
-improve overall ACPI performance by up to 3X. Alexey Starikovskiy, Bob Moore.
+improve overall ACPI performance by up to 3X. Alexey Starikovskiy, Bob
+Moore.
-Added support to truncate I/O addresses to 16 bits for Windows compatibility.
+Added support to truncate I/O addresses to 16 bits for Windows
+compatibility.
Some ASL code has been seen in the field that inadvertently has bits set
above bit 15. This feature is optional and is enabled if the BIOS requests
any Windows OSI strings. It can also be enabled by the host OS. Matthew
@@ -450,15 +564,18 @@ part of the ACPI spec. ACPICA BZ 860.
Expanded all statistic counters used during namespace and device
initialization from 16 to 32 bits in order to support very large namespaces.
-Replaced all instances of %d in printf format specifiers with %u since nearly
+Replaced all instances of %d in printf format specifiers with %u since
+nearly
all integers in ACPICA are unsigned.
-Fixed the exception namestring for AE_WAKE_ONLY_GPE. Was incorrectly returned
+Fixed the exception namestring for AE_WAKE_ONLY_GPE. Was incorrectly
+returned
as AE_NO_HANDLER.
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
+debug version of the code includes the debug output trace mechanism and has
+a
much larger code and data size.
Previous Release:
@@ -492,7 +609,8 @@ new table, and process any _Lxx/_Exx GPE methods in the new table. Any
runtime GPE that is referenced by an _Lxx/_Exx method in the new table is
immediately enabled. Handles the FADT-defined GPEs as well as GPE Block
Devices. Provides compatibility with other ACPI implementations. Two new
-files added, evgpeinit.c and evgpeutil.c. ACPICA BZ 833. Lin Ming, Bob Moore.
+files added, evgpeinit.c and evgpeutil.c. ACPICA BZ 833. Lin Ming, Bob
+Moore.
Fixed a regression introduced in version 20100331 within the table manager
where initial table loading could fail. This was introduced in the fix for
@@ -504,12 +622,14 @@ AcpiUtCopySimpleObject. The original code did not correctly handle the case
where the object to be copied was a namespace node. Lin Ming. ACPICA BZ 847.
Updated the allocation dump routine, AcpiUtDumpAllocation and fixed a
-possible access beyond end-of-allocation. Also, now fully validate descriptor
+possible access beyond end-of-allocation. Also, now fully validate
+descriptor
(size and type) before output. Lin Ming, Bob Moore. ACPICA BZ 847
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
+debug version of the code includes the debug output trace mechanism and has
+a
much larger code and data size.
Previous Release:
@@ -526,7 +646,8 @@ descriptors. This change implements validation for the address fields that
are common to all address-type resource descriptors. These checks are
implemented: Checks for valid Min/Max, length within the Min/Max window,
valid granularity, Min/Max a multiple of granularity, and _MIF/_MAF as per
-table 6-40 in the ACPI 4.0a specification. Also split the large aslrestype1.c
+table 6-40 in the ACPI 4.0a specification. Also split the large
+aslrestype1.c
and aslrestype2.c files into five new files. ACPICA BZ 840.
iASL: Added support for the _Wxx predefined names. This support was missing
@@ -570,8 +691,10 @@ New:
AcpiSetGpe
Implemented write support for DataTable operation regions. These regions are
-defined via the DataTableRegion() operator. Previously, only read support was
-implemented. The ACPI specification allows DataTableRegions to be read/write,
+defined via the DataTableRegion() operator. Previously, only read support
+was
+implemented. The ACPI specification allows DataTableRegions to be
+read/write,
however.
Implemented a new subsystem option to force a copy of the DSDT to local
@@ -581,7 +704,8 @@ the original DSDT, creating the need for this option. Default is FALSE, do
not copy the DSDT.
Implemented detection of a corrupted or replaced DSDT. This change adds
-support to detect a DSDT that has been corrupted and/or replaced from outside
+support to detect a DSDT that has been corrupted and/or replaced from
+outside
the OS (by firmware). This is typically catastrophic for the system, but has
been seen on some machines. Once this problem has been detected, the DSDT
copy option can be enabled via system configuration. Lin Ming, Bob Moore.
@@ -594,7 +718,8 @@ was not set correctly. Alexey Starikovskiy, Bob Moore.
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
+debug version of the code includes the debug output trace mechanism and has
+a
much larger code and data size.
Previous Release:
@@ -610,7 +735,8 @@ iASL: Implement limited typechecking for values returned from predefined
control methods. The type of any returned static (unnamed) object is now
validated. For example, Return(1). ACPICA BZ 786.
-iASL: Fixed a predefined name object verification regression. Fixes a problem
+iASL: Fixed a predefined name object verification regression. Fixes a
+problem
introduced in version 20100304. An error is incorrectly generated if a
predefined name is declared as a static named object with a value defined
using the keywords "Zero", "One", or "Ones". Lin Ming.
@@ -629,21 +755,25 @@ Introduced in commit ae7d6fd: Properly handle externals with parent-prefix
Fixed a possible problem with the AML Mutex handling function
AcpiExReleaseMutex where the function could fault under the very rare
-condition when the interpreter has blocked, the interpreter lock is released,
+condition when the interpreter has blocked, the interpreter lock is
+released,
the interpreter is then reentered via the same thread, and attempts to
-acquire an AML mutex that was previously acquired. FreeBSD report 140979. Lin
+acquire an AML mutex that was previously acquired. FreeBSD report 140979.
+Lin
Ming.
Implemented additional configuration support for the AML "Debug Object".
Output from the debug object can now be enabled via a global variable,
-AcpiGbl_EnableAmlDebugObject. This will assist with remote machine debugging.
+AcpiGbl_EnableAmlDebugObject. This will assist with remote machine
+debugging.
This debug output is now available in the release version of ACPICA instead
of just the debug version. Also, the entire debug output module can now be
configured out of the ACPICA build if desired. One new file added,
executer/exdebug.c. Lin Ming, Bob Moore.
Added header support for the ACPI MCHI table (Management Controller Host
-Interface Table). This table was added in ACPI 4.0, but the defining document
+Interface Table). This table was added in ACPI 4.0, but the defining
+document
has only recently become available.
Standardized output of integer values for ACPICA warnings/errors. Always use
@@ -654,7 +784,8 @@ ACPI_DEBUG_PRINT invocations and were not consistent. ACPICA BZ 835.
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
+debug version of the code includes the debug output trace mechanism and has
+a
much larger code and data size.
Previous Release:
@@ -669,7 +800,8 @@ much larger code and data size.
iASL: Implemented typechecking support for static (non-control method)
predefined named objects that are declared with the Name() operator. For
example, the type of this object is now validated to be of type Integer:
-Name(_BBN, 1). This change migrates the compiler to using the core predefined
+Name(_BBN, 1). This change migrates the compiler to using the core
+predefined
name table instead of maintaining a local version. Added a new file,
aslpredef.c. ACPICA BZ 832.
@@ -684,15 +816,20 @@ Added the 2010 copyright to all module headers and signons. This affects
virtually every file in the ACPICA core subsystem, the iASL compiler, the
tools/utilities, and the test suites.
-Implemented a change to the AcpiGetDevices interface to eliminate unnecessary
+Implemented a change to the AcpiGetDevices interface to eliminate
+unnecessary
invocations of the _STA method. In the case where a specific _HID is
requested, do not run _STA until a _HID match is found. This eliminates
-potentially dozens of _STA calls during a search for a particular device/HID,
+potentially dozens of _STA calls during a search for a particular
+device/HID,
which in turn can improve boot times. ACPICA BZ 828. Lin Ming.
-Implemented an additional repair for predefined method return values. Attempt
-to repair unexpected NULL elements within returned Package objects. Create an
-Integer of value zero, a NULL String, or a zero-length Buffer as appropriate.
+Implemented an additional repair for predefined method return values.
+Attempt
+to repair unexpected NULL elements within returned Package objects. Create
+an
+Integer of value zero, a NULL String, or a zero-length Buffer as
+appropriate.
ACPICA BZ 818. Lin Ming, Bob Moore.
Removed the obsolete ACPI_INTEGER data type. This type was introduced as the
@@ -704,14 +841,16 @@ for now for compatibility with existing device driver code. ACPICA BZ 824.
Removed the unused UINT32_STRUCT type, and the obsolete Integer64 field in
the parse tree object.
-Added additional warning options for the gcc-4 generation. Updated the source
+Added additional warning options for the gcc-4 generation. Updated the
+source
accordingly. This includes some code restructuring to eliminate unreachable
code, elimination of some gotos, elimination of unused return values, some
additional casting, and removal of redundant declarations.
Example Code and Data Size: These are the sizes for the OS-independent
acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. The
-debug version of the code includes the debug output trace mechanism and has a
+debug version of the code includes the debug output trace mechanism and has
+a
much larger code and data size.
Previous Release:
@@ -733,10 +872,12 @@ No functional changes for this release.
Enhanced automatic data type conversions for predefined name repairs. This
change expands the automatic repairs/conversions for predefined name return
values to make Integers, Strings, and Buffers fully interchangeable. Also, a
-Buffer can be converted to a Package of Integers if necessary. The nsrepair.c
+Buffer can be converted to a Package of Integers if necessary. The
+nsrepair.c
module was completely restructured. Lin Ming, Bob Moore.
-Implemented automatic removal of null package elements during predefined name
+Implemented automatic removal of null package elements during predefined
+name
repairs. This change will automatically remove embedded and trailing NULL
package elements from returned package objects that are defined to contain a
variable number of sub-packages. The driver is then presented with a package
@@ -745,7 +886,8 @@ with no null elements to deal with. ACPICA BZ 819.
Implemented a repair for the predefined _FDE and _GTM names. The expected
return value for both names is a Buffer of 5 DWORDs. This repair fixes two
possible problems (both seen in the field), where a package of integers is
-returned, or a buffer of BYTEs is returned. With assistance from Jung-uk Kim.
+returned, or a buffer of BYTEs is returned. With assistance from Jung-uk
+Kim.
Implemented additional module-level code support. This change will properly
execute module-level code that is not at the root of the namespace (under a
@@ -760,7 +902,8 @@ not been seen before. ACPICA BZ 826. Lin Ming, Bob Moore.
Fixed a possible memory leak during module-level code execution. An object
could be leaked for each block of executed module-level code if the
-interpreter slack mode is enabled This change deletes any implicitly returned
+interpreter slack mode is enabled This change deletes any implicitly
+returned
object from the module-level code block. Lin Ming.
Removed messages for successful predefined repair(s). The repair mechanism
@@ -770,7 +913,8 @@ repairs were converted to ACPI_DEBUG_PRINT messages for now. ACPICA BZ 827.
Example Code and Data Size: These are the sizes for the OS-independent
acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. The
-debug version of the code includes the debug output trace mechanism and has a
+debug version of the code includes the debug output trace mechanism and has
+a
much larger code and data size.
Previous Release:
@@ -782,7 +926,8 @@ much larger code and data size.
2) iASL Compiler/Disassembler and Tools:
-iASL: Fixed a regression introduced in 20091112 where intermediate .SRC files
+iASL: Fixed a regression introduced in 20091112 where intermediate .SRC
+files
were no longer automatically removed at the termination of the compile.
acpiexec: Implemented the -f option to specify default region fill value.
@@ -808,19 +953,23 @@ attributes. Such regions are probably BIOS bugs, and this is the workaround.
Linux BZ 14445. Lin Ming.
Implemented an automatic repair for predefined methods that must return
-sorted lists. This change will repair (by sorting) packages returned by _ALR,
-_PSS, and _TSS. Drivers can now assume that the packages are correctly sorted
+sorted lists. This change will repair (by sorting) packages returned by
+_ALR,
+_PSS, and _TSS. Drivers can now assume that the packages are correctly
+sorted
and do not contain NULL package elements. Adds one new file,
namespace/nsrepair2.c. ACPICA BZ 784. Lin Ming, Bob Moore.
Fixed a possible fault during predefined name validation if a return Package
object contains NULL elements. Also adds a warning if a NULL element is
-followed by any non-null elements. ACPICA BZ 813, 814. Future enhancement may
+followed by any non-null elements. ACPICA BZ 813, 814. Future enhancement
+may
include repair or removal of all such NULL elements where possible.
Implemented additional module-level executable AML code support. This change
will execute module-level code that is not at the root of the namespace
-(under a Device object, etc.) at table load time. Module-level executable AML
+(under a Device object, etc.) at table load time. Module-level executable
+AML
code has been illegal since ACPI 2.0. ACPICA BZ 762. Lin Ming.
Implemented a new internal function to create Integer objects. This function
@@ -828,12 +977,14 @@ simplifies miscellaneous object creation code. ACPICA BZ 823.
Reduced the severity of predefined repair messages, Warning to Info. Since
the object was successfully repaired, a warning is too severe. Reduced to an
-info message for now. These messages may eventually be changed to debug-only.
+info message for now. These messages may eventually be changed to debug-
+only.
ACPICA BZ 812.
Example Code and Data Size: These are the sizes for the OS-independent
acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. The
-debug version of the code includes the debug output trace mechanism and has a
+debug version of the code includes the debug output trace mechanism and has
+a
much larger code and data size.
Previous Release:
@@ -855,10 +1006,12 @@ exists, but is shorter than the declared length of the package. Although
technically legal, this is probably a coding error and it is seen in the
field. ACPICA BZ 815. Lin Ming, Bob Moore.
-iASL: Fixed a problem where the compiler could fault after the maximum number
+iASL: Fixed a problem where the compiler could fault after the maximum
+number
of errors was reached (200).
-acpixtract: Fixed a possible warning for pointer cast if the compiler warning
+acpixtract: Fixed a possible warning for pointer cast if the compiler
+warning
level set very high.
----------------------------------------
@@ -878,7 +1031,8 @@ operand object was leaked. Lin Ming.
Implemented a run-time repair for the _MAT predefined method. If the _MAT
return value is defined as a Field object in the AML, and the field
-size is less than or equal to the default width of an integer (32 or 64),_MAT
+size is less than or equal to the default width of an integer (32 or
+64),_MAT
can incorrectly return an Integer instead of a Buffer. ACPICA now
automatically repairs this problem. ACPICA BZ 810.
@@ -891,7 +1045,8 @@ within the returned Package. ACPICA BZ 807.
Example Code and Data Size: These are the sizes for the OS-independent
acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. The
-debug version of the code includes the debug output trace mechanism and has a
+debug version of the code includes the debug output trace mechanism and has
+a
much larger code and data size.
Previous Release:
@@ -934,8 +1089,10 @@ Fixed a possible memory leak in the interpreter for AML package objects if
the package initializer list is longer than the defined size of the package.
This apparently can only happen if the BIOS changes the package size on the
fly (seen in a _PSS object), as ASL compilers do not allow this. The
-interpreter will truncate the package to the defined size (and issue an error
-message), but previously could leave the extra objects undeleted if they were
+interpreter will truncate the package to the defined size (and issue an
+error
+message), but previously could leave the extra objects undeleted if they
+were
pre-created during the argument processing (such is the case if the package
consists of a number of sub-packages as in the _PSS.) ACPICA BZ 805.
@@ -955,7 +1112,8 @@ return type cannot be performed. ACPICA BZ 802.
Example Code and Data Size: These are the sizes for the OS-independent
acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. The
-debug version of the code includes the debug output trace mechanism and has a
+debug version of the code includes the debug output trace mechanism and has
+a
much larger code and data size.
Previous Release:
@@ -1005,13 +1163,17 @@ EINJ, ERST, and HEST. Other newly supported tables are: UEFI and WDAT. There
have been some ACPI 4.0 changes to other existing tables. Split the large
actbl1.h header into the existing actbl2.h header. ACPICA BZ 774.
-ACPI 4.0: Implemented predefined name validation for all new names. There are
-31 new names in ACPI 4.0. The predefined validation module was split into two
+ACPI 4.0: Implemented predefined name validation for all new names. There
+are
+31 new names in ACPI 4.0. The predefined validation module was split into
+two
files. The new file is namespace/nsrepair.c. ACPICA BZ 770.
Implemented support for so-called "module-level executable code". This is
-executable AML code that exists outside of any control method and is intended
-to be executed at table load time. Although illegal since ACPI 2.0, this type
+executable AML code that exists outside of any control method and is
+intended
+to be executed at table load time. Although illegal since ACPI 2.0, this
+type
of code still exists and is apparently still being created. Blocks of this
code are now detected and executed as intended. Currently, the code blocks
must exist under either an If, Else, or While construct; these are the
@@ -1027,7 +1189,8 @@ be repaired: _ALR, _CSD, _HPX, _MLS, _PRT, _PSS, _TRT, and _TSS. ACPICA BZ
790.
Fixed a regression introduced in 20090625 for the AcpiGetDevices interface.
-The _HID/_CID matching was broken and no longer matched IDs correctly. ACPICA
+The _HID/_CID matching was broken and no longer matched IDs correctly.
+ACPICA
BZ 793.
Fixed a problem with AcpiReset where the reset would silently fail if the
@@ -1041,12 +1204,14 @@ does not exist during an attempt to write the Bus Master Arbitration bit.
(However, some hosts already delete the code that writes this bit, and the
code may in fact be obsolete at this date.) ACPICA BZ 799.
-Fixed a problem where AcpiTerminate could fault if inadvertently called twice
+Fixed a problem where AcpiTerminate could fault if inadvertently called
+twice
in succession. ACPICA BZ 795.
Example Code and Data Size: These are the sizes for the OS-independent
acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. The
-debug version of the code includes the debug output trace mechanism and has a
+debug version of the code includes the debug output trace mechanism and has
+a
much larger code and data size.
Previous Release:
@@ -1091,7 +1256,8 @@ been added - utilities/utids.c. ACPICA BZ 368, 780.
Updated the AcpiRead and AcpiWrite external interfaces to support 64-bit
transfers. The Value parameter has been extended from 32 bits to 64 bits in
-order to support new ACPI 4.0 tables. These changes will require an update to
+order to support new ACPI 4.0 tables. These changes will require an update
+to
all callers of these interfaces. See the ACPICA Programmer Reference for
details. ACPICA BZ 768.
@@ -1119,7 +1285,8 @@ tree head. ACPICA BZ 776.
Example Code and Data Size: These are the sizes for the OS-independent
acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. The
-debug version of the code includes the debug output trace mechanism and has a
+debug version of the code includes the debug output trace mechanism and has
+a
much larger code and data size.
Previous Release:
@@ -1143,7 +1310,8 @@ predefined names and control methods (31 total). ACPICA BZ 769.
1) ACPI CA Core Subsystem:
Disabled the preservation of the SCI enable bit in the PM1 control register.
-The SCI enable bit (bit 0, SCI_EN) is defined by the ACPI specification to be
+The SCI enable bit (bit 0, SCI_EN) is defined by the ACPI specification to
+be
a "preserved" bit - "OSPM always preserves this bit position", section
4.7.3.2.1. However, some machines fail if this bit is in fact preserved
because the bit needs to be explicitly set by the OS as a workaround. No
@@ -1155,7 +1323,8 @@ incorrectly formed _PRT package could cause a fault. Added validation to
ensure that each package element is actually a sub-package.
Implemented a new interface to install or override a single control method,
-AcpiInstallMethod. This interface is useful when debugging in order to repair
+AcpiInstallMethod. This interface is useful when debugging in order to
+repair
an existing method or to install a missing method without having to override
the entire ACPI table. See the ACPICA Programmer Reference for use and
examples. Lin Ming, Bob Moore.
@@ -1169,7 +1338,8 @@ caller. Lin Ming.
Fixed a problem with Mutex Sync Levels. Fixed a problem where if multiple
mutexes of the same sync level are acquired but then not released in strict
-opposite order, the internally maintained Current Sync Level becomes confused
+opposite order, the internally maintained Current Sync Level becomes
+confused
and can cause subsequent execution errors. ACPICA BZ 471.
Changed the allowable release order for ASL mutex objects. The ACPI 4.0
@@ -1192,7 +1362,8 @@ and reduced code for this frequently used function.
Example Code and Data Size: These are the sizes for the OS-independent
acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. The
-debug version of the code includes the debug output trace mechanism and has a
+debug version of the code includes the debug output trace mechanism and has
+a
much larger code and data size.
Previous Release:
@@ -1217,10 +1388,12 @@ Fixed a compatibility issue with the recently released I/O port protection
mechanism. For windows compatibility, 1) On a port protection violation,
simply ignore the request and do not return an exception (allow the control
method to continue execution.) 2) If only part of the request overlaps a
-protected port, read/write the individual ports that are not protected. Linux
+protected port, read/write the individual ports that are not protected.
+Linux
BZ 13036. Lin Ming
-Enhanced the execution of the ASL/AML BreakPoint operator so that it actually
+Enhanced the execution of the ASL/AML BreakPoint operator so that it
+actually
breaks into the AML debugger if the debugger is present. This matches the
ACPI-defined behavior.
@@ -1233,12 +1406,14 @@ ACPICA BZ 766, 767.
Fixed a number of possible warnings when compiling with gcc 4+ (depending on
warning options.) Examples include printf formats, aliasing, unused globals,
missing prototypes, missing switch default statements, use of non-ANSI
-library functions, use of non-ANSI constructs. See generate/unix/Makefile for
+library functions, use of non-ANSI constructs. See generate/unix/Makefile
+for
a list of warning options used with gcc 3 and 4. ACPICA BZ 735.
Example Code and Data Size: These are the sizes for the OS-independent
acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. The
-debug version of the code includes the debug output trace mechanism and has a
+debug version of the code includes the debug output trace mechanism and has
+a
much larger code and data size.
Previous Release:
@@ -1250,10 +1425,12 @@ much larger code and data size.
2) iASL Compiler/Disassembler and Tools:
-iASL: Fixed a generation warning from Bison 2.3 and fixed several warnings on
+iASL: Fixed a generation warning from Bison 2.3 and fixed several warnings
+on
the 64-bit build.
-iASL: Fixed a problem where the Unix/Linux versions of the compiler could not
+iASL: Fixed a problem where the Unix/Linux versions of the compiler could
+not
correctly digest Windows/DOS formatted files (with CR/LF).
iASL: Added a new option for "quiet mode" (-va) that produces only the
@@ -1281,8 +1458,10 @@ execute fully on Cygwin.
1) ACPI CA Core Subsystem:
Fixed a possible race condition between AcpiWalkNamespace and dynamic table
-unloads. Added a reader/writer locking mechanism to allow multiple concurrent
-namespace walks (readers), but block a dynamic table unload until it can gain
+unloads. Added a reader/writer locking mechanism to allow multiple
+concurrent
+namespace walks (readers), but block a dynamic table unload until it can
+gain
exclusive write access to the namespace. This fixes a problem where a table
unload could (possibly catastrophically) delete the portion of the namespace
that is currently being examined by a walk. Adds a new file, utlock.c, that
@@ -1316,7 +1495,8 @@ performed on a per-field basis instead of the entire region.
Modified the handling of the PM1 Status Register ignored bit (bit 11.)
Ignored bits must be "preserved" according to the ACPI spec. Usually, this
means a read/modify/write when writing to the register. However, for status
-registers, writing a one means clear the event. Writing a zero means preserve
+registers, writing a one means clear the event. Writing a zero means
+preserve
the event (do not clear.) This behavior is clarified in the ACPI 4.0 spec,
and the ACPICA code now simply always writes a zero to the ignored bit.
@@ -1356,7 +1536,8 @@ AcpiGetRegisterUnlocked function is no longer needed and has been removed.
This will improve performance for reads on these registers. ACPICA BZ 760.
Fixed the parameter validation for AcpiRead/Write. Now return
-AE_BAD_PARAMETER if the input register pointer is null, and AE_BAD_ADDRESS if
+AE_BAD_PARAMETER if the input register pointer is null, and AE_BAD_ADDRESS
+if
the register has an address of zero. Previously, these cases simply returned
AE_OK. For optional registers such as PM1B status/enable/control, the caller
should check for a valid register address before calling. ACPICA BZ 748.
@@ -1369,27 +1550,33 @@ and condensing duplicate code to reduce code size.
Added new functions to transparently handle the possibly split PM1 A/B
registers. AcpiHwReadMultiple and AcpiHwWriteMultiple. These two functions
-now handle the split registers for PM1 Status, Enable, and Control. ACPICA BZ
+now handle the split registers for PM1 Status, Enable, and Control. ACPICA
+BZ
746.
Added a function to handle the PM1 control registers, AcpiHwWritePm1Control.
-This function writes both of the PM1 control registers (A/B). These registers
+This function writes both of the PM1 control registers (A/B). These
+registers
are different than the PM1 A/B status and enable registers in that different
values can be written to the A/B registers. Most notably, the SLP_TYP bits
-can be different, as per the values returned from the _Sx predefined methods.
+can be different, as per the values returned from the _Sx predefined
+methods.
Removed an extra register write within AcpiHwClearAcpiStatus. This function
was writing an optional PM1B status register twice. The existing call to the
low-level AcpiHwRegisterWrite automatically handles a possibly split PM1 A/B
register. ACPICA BZ 751.
-Split out the PM1 Status registers from the FADT. Added new globals for these
+Split out the PM1 Status registers from the FADT. Added new globals for
+these
registers (A/B), similar to the way the PM1 Enable registers are handled.
Instead of overloading the FADT Event Register blocks. This makes the code
clearer and less prone to error.
-Fixed the warning message for when the platform contains too many ACPI tables
-for the default size of the global root table data structure. The calculation
+Fixed the warning message for when the platform contains too many ACPI
+tables
+for the default size of the global root table data structure. The
+calculation
for the truncation value was incorrect.
Removed the ACPI_GET_OBJECT_TYPE macro. Removed all instances of this
@@ -1404,13 +1591,15 @@ Conditionally compile the AcpiSetFirmwareWakingVector64 function. This
function is only needed on 64-bit host operating systems and is thus not
included for 32-bit hosts.
-Debug output: print the input and result for invocations of the _OSI reserved
+Debug output: print the input and result for invocations of the _OSI
+reserved
control method via the ACPI_LV_INFO debug level. Also, reduced some of the
verbosity of this debug level. Len Brown.
Example Code and Data Size: These are the sizes for the OS-independent
acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. The
-debug version of the code includes the debug output trace mechanism and has a
+debug version of the code includes the debug output trace mechanism and has
+a
much larger code and data size.
Previous Release:
@@ -1435,7 +1624,8 @@ virtually every file in the ACPICA core subsystem, the iASL compiler, and
the tools/utilities.
Implemented a change to allow the host to override any ACPI table, including
-dynamically loaded tables. Previously, only the DSDT could be replaced by the
+dynamically loaded tables. Previously, only the DSDT could be replaced by
+the
host. With this change, the AcpiOsTableOverride interface is called for each
table found in the RSDT/XSDT during ACPICA initialization, and also whenever
a table is dynamically loaded via the AML Load operator.
@@ -1448,7 +1638,8 @@ with the actual namespace entry which is itself padded with underscores.
Example Code and Data Size: These are the sizes for the OS-independent
acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. The
-debug version of the code includes the debug output trace mechanism and has a
+debug version of the code includes the debug output trace mechanism and has
+a
much larger code and data size.
Previous Release:
@@ -1494,7 +1685,8 @@ file, components/hardware/hwxface.c
Enhanced the FADT parsing and low-level ACPI register access: The ACPI
register lengths within the FADT are now used, and the low level ACPI
register access no longer hardcodes the ACPI register lengths. Given that
-there may be some risk in actually trusting the FADT register lengths, a run-
+there may be some risk in actually trusting the FADT register lengths, a
+run-
time option was added to fall back to the default hardcoded lengths if the
FADT proves to contain incorrect values - UseDefaultRegisterWidths. This
option is set to true for now, and a warning is issued if a suspicious FADT
@@ -1507,12 +1699,14 @@ Packages. Lin Ming.
Added semaphore support to the Linux/Unix application OS-services layer
(OSL). ACPICA BZ 448. Lin Ming.
-Added the ACPI_MUTEX_TYPE configuration option to select whether mutexes will
+Added the ACPI_MUTEX_TYPE configuration option to select whether mutexes
+will
be implemented in the OSL, or will binary semaphores be used instead.
Example Code and Data Size: These are the sizes for the OS-independent
acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. The
-debug version of the code includes the debug output trace mechanism and has a
+debug version of the code includes the debug output trace mechanism and has
+a
much larger code and data size.
Previous Release:
@@ -1524,7 +1718,8 @@ much larger code and data size.
2) iASL Compiler/Disassembler and Tools:
-iASL: Completed the '-e' option to include additional ACPI tables in order to
+iASL: Completed the '-e' option to include additional ACPI tables in order
+to
aid with disassembly and External statement generation. ACPICA BZ 742. Lin
Ming.
@@ -1541,7 +1736,8 @@ Disassembler: Updates for several ACPI data tables (HEST, EINJ, and MCFG).
1) ACPI CA Core Subsystem:
-Restructured the ACPICA header files into public/private. acpi.h now includes
+Restructured the ACPICA header files into public/private. acpi.h now
+includes
only the "public" acpica headers. All other acpica headers are "private" and
should not be included by acpica users. One new file, accommon.h is used to
include the commonly used private headers for acpica code generation. Future
@@ -1558,7 +1754,8 @@ with a valid null-terminated string. Linux BZ 11822.
Updated the FACS waking vector interfaces. Split AcpiSetFirmwareWakingVector
into two: one for the 32-bit vector, another for the 64-bit vector. This is
required because the host OS must setup the wake much differently for each
-vector (real vs. protected mode, etc.) and the interface itself should not be
+vector (real vs. protected mode, etc.) and the interface itself should not
+be
deciding which vector to use. Also, eliminated the GetFirmwareWakingVector
interface, as it served no purpose (only the firmware reads the vector, OS
only writes the vector.) ACPICA BZ 731.
@@ -1599,13 +1796,15 @@ handler installation, and calling a control method. Available at
source/tools/examples.
Added a global pointer for FACS table to simplify internal FACS access. Use
-the global pointer instead of using AcpiGetTableByIndex for each FACS access.
+the global pointer instead of using AcpiGetTableByIndex for each FACS
+access.
This simplifies the code for the Global Lock and the Firmware Waking
Vector(s).
Example Code and Data Size: These are the sizes for the OS-independent
acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. The
-debug version of the code includes the debug output trace mechanism and has a
+debug version of the code includes the debug output trace mechanism and has
+a
much larger code and data size.
Previous Release:
@@ -1618,7 +1817,8 @@ much larger code and data size.
2) iASL Compiler/Disassembler and Tools:
iASL: Improved disassembly of external method calls. Added the -e option to
-allow the inclusion of additional ACPI tables to help with the disassembly of
+allow the inclusion of additional ACPI tables to help with the disassembly
+of
method invocations and the generation of external declarations during the
disassembly. Certain external method invocations cannot be disassembled
properly without the actual declaration of the method. Use the -e option to
@@ -1638,12 +1838,14 @@ references from the Alias operator itself. ACPICA BZ 738.
1) ACPI CA Core Subsystem:
Designed and implemented a mechanism to validate predefined ACPI methods and
-objects. This code validates the predefined ACPI objects (objects whose names
+objects. This code validates the predefined ACPI objects (objects whose
+names
start with underscore) that appear in the namespace, at the time they are
evaluated. The argument count and the type of the returned object are
validated against the ACPI specification. The purpose of this validation is
to detect problems with the BIOS-implemented predefined ACPI objects before
-the results are returned to the ACPI-related drivers. Future enhancements may
+the results are returned to the ACPI-related drivers. Future enhancements
+may
include actual repair of incorrect return objects where possible. Two new
files are nspredef.c and acpredef.h.
@@ -1665,7 +1867,8 @@ similar in that they use a stack of state objects in order to eliminate
recursion. The stack must be fully unwound and deallocated if an error
occurs. Lin Ming. ACPICA BZ 383.
-Removed the unused ACPI_BITREG_WAKE_ENABLE definition and entry in the global
+Removed the unused ACPI_BITREG_WAKE_ENABLE definition and entry in the
+global
ACPI register table. This bit does not exist and is unused. Lin Ming, Bob
Moore ACPICA BZ 442.
@@ -1676,7 +1879,8 @@ only incorrect, it could also be misleading.
Example Code and Data Size: These are the sizes for the OS-independent
acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. The
-debug version of the code includes the debug output trace mechanism and has a
+debug version of the code includes the debug output trace mechanism and has
+a
much larger code and data size.
Previous Release:
@@ -1694,18 +1898,22 @@ much larger code and data size.
Completed a major cleanup of the internal ACPI_OPERAND_OBJECT of type
Reference. Changes include the elimination of cheating on the Object field
for the DdbHandle subtype, addition of a reference class field to
-differentiate the various reference types (instead of an AML opcode), and the
+differentiate the various reference types (instead of an AML opcode), and
+the
cleanup of debug output for this object. Lin Ming, Bob Moore. BZ 723
Reduce an error to a warning for an incorrect method argument count.
Previously aborted with an error if too few arguments were passed to a
-control method via the external ACPICA interface. Now issue a warning instead
+control method via the external ACPICA interface. Now issue a warning
+instead
and continue. Handles the case where the method inadvertently declares too
many arguments, but does not actually use the extra ones. Applies mainly to
the predefined methods. Lin Ming. Linux BZ 11032.
-Disallow the evaluation of named object types with no intrinsic value. Return
-AE_TYPE for objects that have no value and therefore evaluation is undefined:
+Disallow the evaluation of named object types with no intrinsic value.
+Return
+AE_TYPE for objects that have no value and therefore evaluation is
+undefined:
Device, Event, Mutex, Region, Thermal, and Scope. Previously, evaluation of
these types were allowed, but an exception would be generated at some point
during the evaluation. Now, the error is generated up front.
@@ -1713,8 +1921,10 @@ during the evaluation. Now, the error is generated up front.
Fixed a possible memory leak in the AcpiNsGetExternalPathname function
(nsnames.c). Fixes a leak in the error exit path.
-Removed the obsolete debug levels ACPI_DB_WARN and ACPI_DB_ERROR. These debug
-levels were made obsolete by the ACPI_WARNING, ACPI_ERROR, and ACPI_EXCEPTION
+Removed the obsolete debug levels ACPI_DB_WARN and ACPI_DB_ERROR. These
+debug
+levels were made obsolete by the ACPI_WARNING, ACPI_ERROR, and
+ACPI_EXCEPTION
interfaces. Also added ACPI_DB_EVENTS to correspond with the existing
ACPI_LV_EVENTS.
@@ -1728,7 +1938,8 @@ compiler reference, and the changes.txt release logfile.
Example Code and Data Size: These are the sizes for the OS-independent
acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. The
-debug version of the code includes the debug output trace mechanism and has a
+debug version of the code includes the debug output trace mechanism and has
+a
much larger code and data size.
Previous Release:
@@ -1761,12 +1972,14 @@ header.
1) ACPI CA Core Subsystem:
Fix a possible deadlock in the GPE dispatch. Remove call to
-AcpiHwDisableAllGpes during wake in AcpiEvGpeDispatch. This call will attempt
+AcpiHwDisableAllGpes during wake in AcpiEvGpeDispatch. This call will
+attempt
to acquire the GPE lock but can deadlock since the GPE lock is already held
at dispatch time. This code was introduced in version 20060831 as a response
to Linux BZ 6881 and has since been removed from Linux.
-Add a function to dereference returned reference objects. Examines the return
+Add a function to dereference returned reference objects. Examines the
+return
object from a call to AcpiEvaluateObject. Any Index or RefOf references are
automatically dereferenced in an attempt to return something useful (these
reference types cannot be converted into an external ACPI_OBJECT.) Provides
@@ -1789,13 +2002,16 @@ The function could possibly fail when the caches are initialized. Yang Yi.
Add a function to decode reference object types to strings. Created for
improved error messages.
-Improve object conversion error messages. Better error messages during object
-conversion from internal to the external ACPI_OBJECT. Used for external calls
+Improve object conversion error messages. Better error messages during
+object
+conversion from internal to the external ACPI_OBJECT. Used for external
+calls
to AcpiEvaluateObject.
Example Code and Data Size: These are the sizes for the OS-independent
acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. The
-debug version of the code includes the debug output trace mechanism and has a
+debug version of the code includes the debug output trace mechanism and has
+a
much larger code and data size.
Previous Release:
@@ -1817,16 +2033,19 @@ appear in a disassembled ASL file if they were emitted by the original
compiler. Instead of issuing an error or warning and forcing the user to
manually change these names, issue a remark instead.
-iASL: error if named object created in while loop. Emit an error if any named
+iASL: error if named object created in while loop. Emit an error if any
+named
object is created within a While loop. If allowed, this code will generate a
-run-time error on the second iteration of the loop when an attempt is made to
+run-time error on the second iteration of the loop when an attempt is made
+to
create the same named object twice. ACPICA bugzilla 730.
iASL: Support absolute pathnames for include files. Add support for absolute
pathnames within the Include operator. previously, only relative pathnames
were supported.
-iASL: Enforce minimum 1 interrupt in interrupt macro and Resource Descriptor.
+iASL: Enforce minimum 1 interrupt in interrupt macro and Resource
+Descriptor.
The ACPI spec requires one interrupt minimum. BZ 423
iASL: Handle a missing ResourceSource arg, with a present SourceIndex.
@@ -1838,9 +2057,11 @@ iASL: Prevent error message if CondRefOf target does not exist. Fixes cases
where an error message is emitted if the target does not exist. BZ 516
iASL: Fix broken -g option (get Windows ACPI tables). Fixes the -g option
-(get ACPI tables on Windows). This was apparently broken in version 20070919.
+(get ACPI tables on Windows). This was apparently broken in version
+20070919.
-AcpiXtract: Handle EOF while extracting data. Correctly handle the case where
+AcpiXtract: Handle EOF while extracting data. Correctly handle the case
+where
the EOF happens immediately after the last table in the input file. Print
completion message. Previously, no message was displayed in this case.
@@ -1857,7 +2078,8 @@ source tree.
Implemented a "careful" GPE disable in AcpiEvDisableGpe, only modify one
enable bit. Now performs a read-change-write of the enable register instead
of simply writing out the cached enable mask. This will prevent inadvertent
-enabling of GPEs if a rogue GPE is received during initialization (before GPE
+enabling of GPEs if a rogue GPE is received during initialization (before
+GPE
handlers are installed.)
Implemented a copy for dynamically loaded tables. Previously, dynamically
@@ -1867,10 +2089,12 @@ OpRegion case, added checksum verify. Use the table length from the table
header, not the region length. For the Buffer case, use the table length
also. Dennis Noordsij, Bob Moore. BZ 10734
-Fixed a problem where the same ACPI table could not be dynamically loaded and
+Fixed a problem where the same ACPI table could not be dynamically loaded
+and
unloaded more than once. Without this change, a table cannot be loaded again
once it has been loaded/unloaded one time. The current mechanism does not
-unregister a table upon an unload. During a load, if the same table is found,
+unregister a table upon an unload. During a load, if the same table is
+found,
this no longer returns an exception. BZ 722
Fixed a problem where the wrong descriptor length was calculated for the
@@ -1880,7 +2104,8 @@ descriptor is 16 because of the round-up to 8 on the 64-bit build. Reported
by Linn Crosetto. BZ 728
Fixed a possible memory leak in the Unload operator. The DdbHandle returned
-by Load() did not have its reference count decremented during unload, leading
+by Load() did not have its reference count decremented during unload,
+leading
to a memory leak. Lin Ming. BZ 727
Fixed a possible memory leak when deleting thermal/processor objects. Any
@@ -1888,7 +2113,8 @@ associated notify handlers (and objects) were not being deleted. Fiodor
Suietov. BZ 506
Fixed the ordering of the ASCII names in the global mutex table to match the
-actual mutex IDs. Used by AcpiUtGetMutexName, a function used for debug only.
+actual mutex IDs. Used by AcpiUtGetMutexName, a function used for debug
+only.
Vegard Nossum. BZ 726
Enhanced the AcpiGetObjectInfo interface to return the number of required
@@ -1903,7 +2129,8 @@ Fixed an extraneous warning from exconfig.c on the 64-bit build.
Example Code and Data Size: These are the sizes for the OS-independent
acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. The
-debug version of the code includes the debug output trace mechanism and has a
+debug version of the code includes the debug output trace mechanism and has
+a
much larger code and data size.
Previous Release:
@@ -1918,7 +2145,8 @@ much larger code and data size.
iASL: Added two missing ACPI reserved names. Added _MTP and _ASZ, both
resource descriptor names.
-iASL: Detect invalid ASCII characters in input (windows version). Removed the
+iASL: Detect invalid ASCII characters in input (windows version). Removed
+the
"-CF" flag from the flex compile, enables correct detection of non-ASCII
characters in the input. BZ 441
@@ -1926,9 +2154,12 @@ iASL: Eliminate warning when result of LoadTable is not used. Eliminate the
"result of operation not used" warning when the DDB handle returned from
LoadTable is not used. The warning is not needed. BZ 590
-AcpiExec: Add support for dynamic table load/unload. Now calls _CFG method to
-pass address of table to the AML. Added option to disable OpRegion simulation
-to allow creation of an OpRegion with a real address that was passed to _CFG.
+AcpiExec: Add support for dynamic table load/unload. Now calls _CFG method
+to
+pass address of table to the AML. Added option to disable OpRegion
+simulation
+to allow creation of an OpRegion with a real address that was passed to
+_CFG.
All of this allows testing of the Load and Unload operators from AcpiExec.
Debugger: update tables command for unloaded tables. Handle unloaded tables
@@ -1948,10 +2179,12 @@ Simplified the internal ACPI hardware interfaces to eliminate the locking
flag parameter from Register Read/Write. Added a new external interface,
AcpiGetRegisterUnlocked.
-Fixed a problem where the invocation of a GPE control method could hang. This
+Fixed a problem where the invocation of a GPE control method could hang.
+This
was a regression introduced in 20080514. The new method argument count
validation mechanism can enter an infinite loop when a GPE method is
-dispatched. Problem fixed by removing the obsolete code that passed GPE block
+dispatched. Problem fixed by removing the obsolete code that passed GPE
+block
information to the notify handler via the control method parameter pointer.
Fixed a problem where the _SST execution status was incorrectly returned to
@@ -1960,7 +2193,8 @@ the caller of AcpiEnterSleepStatePrep. This was a regression introduced in
returned. BZ 716
Fixed a problem where a deleted object could be accessed from within the AML
-parser. This was a regression introduced in version 20080123 as a fix for the
+parser. This was a regression introduced in version 20080123 as a fix for
+the
Unload operator. Lin Ming. BZ 10669
Cleaned up the debug operand dump mechanism. Eliminated unnecessary operands
@@ -1981,7 +2215,8 @@ one mutex. Linn Crosetto
Example Code and Data Size: These are the sizes for the OS-independent
acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. The
-debug version of the code includes the debug output trace mechanism and has a
+debug version of the code includes the debug output trace mechanism and has
+a
much larger code and data size.
Previous Release:
@@ -2022,20 +2257,25 @@ the GPE, even if ACPICA thinks that that it is already disabled. It is
possible that the AML or some other code has enabled the GPE unbeknownst to
the ACPICA code.
-Fixed a problem with the Field operator where zero-length fields would return
-an AE_AML_NO_OPERAND exception during table load. Fix enables zero-length ASL
+Fixed a problem with the Field operator where zero-length fields would
+return
+an AE_AML_NO_OPERAND exception during table load. Fix enables zero-length
+ASL
field declarations in Field(), BankField(), and IndexField(). BZ 10606.
Implemented a fix for the Load operator, now load the table at the namespace
root. This reverts a change introduced in version 20071019. The table is now
loaded at the namespace root even though this goes against the ACPI
specification. This provides compatibility with other ACPI implementations.
-The ACPI specification will be updated to reflect this in ACPI 4.0. Lin Ming.
+The ACPI specification will be updated to reflect this in ACPI 4.0. Lin
+Ming.
-Fixed a problem where ACPICA would not Load() tables with unusual signatures.
+Fixed a problem where ACPICA would not Load() tables with unusual
+signatures.
Now ignore ACPI table signature for Load() operator. Only "SSDT" is
acceptable to the ACPI spec, but tables are seen with OEMx and null sigs.
-Therefore, signature validation is worthless. Apparently MS ACPI accepts such
+Therefore, signature validation is worthless. Apparently MS ACPI accepts
+such
signatures, ACPICA must be compatible. BZ 10454.
Fixed a possible negative array index in AcpiUtValidateException. Added NULL
@@ -2052,8 +2292,10 @@ many. This applies only to extern programmatic control method execution, not
method-to-method calls within the AML. Lin Ming.
Eliminated the ACPI_NATIVE_UINT type across all ACPICA code. This type is no
-longer needed, especially with the removal of 16-bit support. It was replaced
-mostly with UINT32, but also ACPI_SIZE where a type that changes 32/64 bit on
+longer needed, especially with the removal of 16-bit support. It was
+replaced
+mostly with UINT32, but also ACPI_SIZE where a type that changes 32/64 bit
+on
32/64-bit platforms is required.
Added the C const qualifier for appropriate string constants -- mostly
@@ -2061,7 +2303,8 @@ MODULE_NAME and printf format strings. Jan Beulich.
Example Code and Data Size: These are the sizes for the OS-independent
acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. The
-debug version of the code includes the debug output trace mechanism and has a
+debug version of the code includes the debug output trace mechanism and has
+a
much larger code and data size.
Previous Release:
@@ -2085,7 +2328,8 @@ means 32-bit and this is unusual. 2 or greater is 64-bit.
Implemented an additional change to the GPE support in order to suppress
spurious or stray GPEs. The AcpiEvDisableGpe function will now permanently
disable incoming GPEs that are neither enabled nor disabled -- meaning that
-the GPE is unknown to the system. This should prevent future interrupt floods
+the GPE is unknown to the system. This should prevent future interrupt
+floods
from that GPE. BZ 6217 (Zhang Rui)
Fixed a problem where NULL package elements were not returned to the
@@ -2094,7 +2338,8 @@ instead of returning a NULL ACPI_OBJECT package element, potentially causing
a buffer overflow and/or confusing the caller who expected a fixed number of
elements. BZ 10132 (Lin Ming, Bob Moore)
-Fixed a problem with the CreateField, CreateXXXField (Bit, Byte, Word, Dword,
+Fixed a problem with the CreateField, CreateXXXField (Bit, Byte, Word,
+Dword,
Qword), Field, BankField, and IndexField operators when invoked from inside
an executing control method. In this case, these operators created namespace
nodes that were incorrectly left marked as permanent nodes instead of
@@ -2106,20 +2351,23 @@ Fixed a problem where the CreateField and CreateXXXField operators would
incorrectly allow duplicate names (the name of the field) with no exception
generated.
-Implemented several changes for Notify handling. Added support for new Notify
+Implemented several changes for Notify handling. Added support for new
+Notify
values (ACPI 2.0+) and improved the Notify debug output. Notify on
PowerResource objects is no longer allowed, as per the ACPI specification.
(Bob Moore, Zhang Rui)
All Reference Objects returned via the AcpiEvaluateObject interface are now
-marked as type "REFERENCE" instead of "ANY". The type ANY is now reserved for
+marked as type "REFERENCE" instead of "ANY". The type ANY is now reserved
+for
NULL objects - either NULL package elements or unresolved named references.
Fixed a problem where an extraneous debug message was produced for package
objects (when debugging enabled). The message "Package List length larger
than NumElements count" is now produced in the correct case, and is now an
error message rather than a debug message. Added a debug message for the
-opposite case, where NumElements is larger than the Package List (the package
+opposite case, where NumElements is larger than the Package List (the
+package
will be padded out with NULL elements as per the ACPI spec.)
Implemented several improvements for the output of the ASL "Debug" object to
@@ -2157,7 +2405,8 @@ uses Switch as Serialized, thus preventing multiple thread entries. BZ 469.
Implemented another MS compatibility design change for GPE/Notify handling.
GPEs are now cleared/enabled asynchronously to allow all pending notifies to
complete first. It is expected that the OSL will queue the enable request
-behind all pending notify requests (may require changes to the local host OSL
+behind all pending notify requests (may require changes to the local host
+OSL
in AcpiOsExecute). Alexey Starikovskiy.
Fixed a problem where buffer and package objects passed as arguments to a
@@ -2172,8 +2421,10 @@ returned from _CRS. This change affects the following resource descriptors:
IRQ / IRQNoFlags and StartDependendentFn / StartDependentFnNoPri. (BZ 9487)
Fixed a problem where a CopyObject to RegionField, BankField, and IndexField
-objects did not perform an implicit conversion as it should. These types must
-retain their initial type permanently as per the ACPI specification. However,
+objects did not perform an implicit conversion as it should. These types
+must
+retain their initial type permanently as per the ACPI specification.
+However,
a CopyObject to all other object types should not perform an implicit
conversion, as per the ACPI specification. (Lin Ming, Bob Moore) BZ 388
@@ -2181,7 +2432,8 @@ Fixed a problem with the AcpiGetDevices interface where the mechanism to
match device CIDs did not examine the entire list of available CIDs, but
instead aborted on the first non-matching CID. Andrew Patterson.
-Fixed a regression introduced in version 20071114. The ACPI_HIDWORD macro was
+Fixed a regression introduced in version 20071114. The ACPI_HIDWORD macro
+was
inadvertently changed to return a 16-bit value instead of a 32-bit value,
truncating the upper dword of a 64-bit value. This macro is only used to
display debug output, so no incorrect calculations were made. Also,
@@ -2221,19 +2473,24 @@ the tools/utilities.
Fixed a problem with the SizeOf operator when used with Package and Buffer
objects. These objects have deferred execution for some arguments, and the
-execution is now completed before the SizeOf is executed. This problem caused
+execution is now completed before the SizeOf is executed. This problem
+caused
unexpected AE_PACKAGE_LIMIT errors on some systems (Lin Ming, Bob Moore) BZ
9558
-Implemented an enhancement to the interpreter "slack mode". In the absence of
+Implemented an enhancement to the interpreter "slack mode". In the absence
+of
an explicit return or an implicitly returned object from the last executed
-opcode, a control method will now implicitly return an integer of value 0 for
+opcode, a control method will now implicitly return an integer of value 0
+for
Microsoft compatibility. (Lin Ming) BZ 392
-Fixed a problem with the Load operator where an exception was not returned in
+Fixed a problem with the Load operator where an exception was not returned
+in
the case where the table is already loaded. (Lin Ming) BZ 463
-Implemented support for the use of DDBHandles as an Indexed Reference, as per
+Implemented support for the use of DDBHandles as an Indexed Reference, as
+per
the ACPI spec. (Lin Ming) BZ 486
Implemented support for UserTerm (Method invocation) for the Unload operator
@@ -2246,7 +2503,8 @@ maximum lengths allowed. (Lin Ming, Bob Moore) BZ 576
Implemented support for UserTerm (Method invocation) for the Unload operator
as per the ACPI spec. (Lin Ming) BZ 580
-Implemented header file support for new ACPI tables - BERT, ERST, EINJ, HEST,
+Implemented header file support for new ACPI tables - BERT, ERST, EINJ,
+HEST,
IBFT, UEFI, WDAT. Disassembler support is forthcoming.
Example Code and Data Size: These are the sizes for the OS-independent
@@ -2264,7 +2522,8 @@ a much larger code and data size.
2) iASL Compiler/Disassembler and Tools:
Implemented support in the disassembler for checksum validation on incoming
-binary DSDTs and SSDTs. If incorrect, a message is displayed within the table
+binary DSDTs and SSDTs. If incorrect, a message is displayed within the
+table
header dump at the start of the disassembly.
Implemented additional debugging information in the namespace listing file
@@ -2291,7 +2550,8 @@ Ming) BZ 583,587
Implemented full support for deferred execution for the TermArg string
arguments for DataTableRegion. This enables forward references and full
-operand resolution for the three string arguments. Similar to OperationRegion
+operand resolution for the three string arguments. Similar to
+OperationRegion
deferred argument execution.) Lin Ming. BZ 430
Implemented full argument resolution support for the BankValue argument to
@@ -2306,7 +2566,8 @@ Zhao.
Fixed a problem where "unknown" GPEs could be allowed to fire repeatedly if
the underlying AML code changed the GPE enable registers. Now, any unknown
-incoming GPE (no _Lxx/_Exx method and not the EC GPE) is immediately disabled
+incoming GPE (no _Lxx/_Exx method and not the EC GPE) is immediately
+disabled
instead of simply ignored. Rui Zhang.
Fixed a problem with Index Fields where the Index register was incorrectly
diff --git a/common/dmtable.c b/common/dmtable.c
index cb9c1f914609..61d9fa22b5f8 100644
--- a/common/dmtable.c
+++ b/common/dmtable.c
@@ -641,6 +641,7 @@ AcpiDmDumpTable (
ByteLength = 6;
break;
case ACPI_DMT_UINT56:
+ case ACPI_DMT_BUF7:
ByteLength = 7;
break;
case ACPI_DMT_UINT64:
@@ -751,16 +752,19 @@ AcpiDmDumpTable (
ACPI_FORMAT_UINT64 (ACPI_GET64 (Target)));
break;
+ case ACPI_DMT_BUF7:
case ACPI_DMT_BUF16:
- /* Buffer of length 16 */
-
- for (Temp8 = 0; Temp8 < 16; Temp8++)
+ /*
+ * Buffer: Size depends on the opcode and was set above.
+ * Each hex byte is separated with a space.
+ */
+ for (Temp8 = 0; Temp8 < ByteLength; Temp8++)
{
AcpiOsPrintf ("%2.2X", Target[Temp8]);
- if ((Temp8 + 1) < 16)
+ if ((UINT32) (Temp8 + 1) < ByteLength)
{
- AcpiOsPrintf (",");
+ AcpiOsPrintf (" ");
}
}
AcpiOsPrintf ("\n");
diff --git a/common/dmtbdump.c b/common/dmtbdump.c
index 4c10af25ca17..280e3eeae5c3 100644
--- a/common/dmtbdump.c
+++ b/common/dmtbdump.c
@@ -52,6 +52,12 @@
ACPI_MODULE_NAME ("dmtbdump")
+static void
+AcpiDmValidateFadtLength (
+ UINT32 Revision,
+ UINT32 Length);
+
+
/*******************************************************************************
*
* FUNCTION: AcpiDmDumpRsdp
@@ -201,6 +207,10 @@ AcpiDmDumpXsdt (
*
* DESCRIPTION: Format the contents of a FADT
*
+ * NOTE: We cannot depend on the FADT version to indicate the actual
+ * contents of the FADT because of BIOS bugs. The table length
+ * is the only reliable indicator.
+ *
******************************************************************************/
void
@@ -208,20 +218,21 @@ AcpiDmDumpFadt (
ACPI_TABLE_HEADER *Table)
{
- /* Common ACPI 1.0 portion of FADT */
+ /* Always dump the minimum FADT revision 1 fields (ACPI 1.0) */
AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt1);
- /* Check for ACPI 1.0B MS extensions (FADT revision 2) */
+ /* Check for FADT revision 2 fields (ACPI 1.0B MS extensions) */
- if (Table->Revision == 2)
+ if ((Table->Length > ACPI_FADT_V1_SIZE) &&
+ (Table->Length <= ACPI_FADT_V2_SIZE))
{
AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt2);
}
- /* Check for ACPI 2.0+ extended data (FADT revision 3+) */
+ /* Check for FADT revision 3 fields and up (ACPI 2.0+ extended data) */
- else if (Table->Length >= sizeof (ACPI_TABLE_FADT))
+ else if (Table->Length > ACPI_FADT_V2_SIZE)
{
AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt3);
}
@@ -229,6 +240,68 @@ AcpiDmDumpFadt (
/* Validate various fields in the FADT, including length */
AcpiTbCreateLocalFadt (Table, Table->Length);
+
+ /* Validate FADT length against the revision */
+
+ AcpiDmValidateFadtLength (Table->Revision, Table->Length);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmValidateFadtLength
+ *
+ * PARAMETERS: Revision - FADT revision (Header->Revision)
+ * Length - FADT length (Header->Length
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Check the FADT revision against the expected table length for
+ * that revision. Issue a warning if the length is not what was
+ * expected. This seems to be such a common BIOS bug that the
+ * FADT revision has been rendered virtually meaningless.
+ *
+ ******************************************************************************/
+
+static void
+AcpiDmValidateFadtLength (
+ UINT32 Revision,
+ UINT32 Length)
+{
+ UINT32 ExpectedLength;
+
+
+ switch (Revision)
+ {
+ case 0:
+ AcpiOsPrintf ("// ACPI Warning: Invalid FADT revision: 0\n");
+ return;
+
+ case 1:
+ ExpectedLength = ACPI_FADT_V1_SIZE;
+ break;
+
+ case 2:
+ ExpectedLength = ACPI_FADT_V2_SIZE;
+ break;
+
+ case 3:
+ case 4:
+ ExpectedLength = ACPI_FADT_V3_SIZE;
+ break;
+
+ default:
+ return;
+ }
+
+ if (Length == ExpectedLength)
+ {
+ return;
+ }
+
+ AcpiOsPrintf (
+ "\n// ACPI Warning: FADT revision %X does not match length: found %X expected %X\n",
+ Revision, Length, ExpectedLength);
}
diff --git a/common/dmtbinfo.c b/common/dmtbinfo.c
index 293dd3e50e2a..3cc9a1708d4b 100644
--- a/common/dmtbinfo.c
+++ b/common/dmtbinfo.c
@@ -477,7 +477,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoAsf2a[] =
ACPI_DMTABLE_INFO AcpiDmTableInfoAsf3[] =
{
- {ACPI_DMT_UINT56, ACPI_ASF3_OFFSET (Capabilities[0]), "Capabilities", 0},
+ {ACPI_DMT_BUF7, ACPI_ASF3_OFFSET (Capabilities[0]), "Capabilities", 0},
{ACPI_DMT_UINT8, ACPI_ASF3_OFFSET (CompletionCode), "Completion Code", 0},
{ACPI_DMT_UINT32, ACPI_ASF3_OFFSET (EnterpriseId), "Enterprise ID", 0},
{ACPI_DMT_UINT8, ACPI_ASF3_OFFSET (Command), "Command", 0},
@@ -1588,5 +1588,6 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoGeneric[][2] =
ACPI_DM_GENERIC_ENTRY (ACPI_DMT_BUFFER, "Buffer"),
ACPI_DM_GENERIC_ENTRY (ACPI_DMT_UUID, "GUID"),
ACPI_DM_GENERIC_ENTRY (ACPI_DMT_STRING, "DevicePath"),
+ ACPI_DM_GENERIC_ENTRY (ACPI_DMT_LABEL, "Label"),
{ACPI_DMT_TERMINATOR}
};
diff --git a/compiler/Makefile b/compiler/Makefile
index b967c74ba31f..e10878597df8 100644
--- a/compiler/Makefile
+++ b/compiler/Makefile
@@ -32,7 +32,9 @@ OBJS = \
adfile.o \
adisasm.o \
adwalk.o \
+ aslbtypes.o \
aslanalyze.o \
+ aslbtypes.o \
aslcodegen.o \
aslcompile.o \
aslcompilerlex.o \
@@ -64,7 +66,9 @@ OBJS = \
asltree.o \
aslutils.o \
asluuid.o \
+ aslwalks.o \
dtcompile.o \
+ dtexpress.o \
dtfield.o \
dtio.o \
dtsubtable.o \
@@ -86,12 +90,15 @@ OBJS = \
dmtbinfo.o \
dmutils.o \
dmwalk.o \
+ dsargs.o \
+ dscontrol.o \
dsfield.o \
dsobject.o \
dsopcode.o \
dsutils.o \
dswexec.o \
dswload.o \
+ dswload2.o \
dswscope.o \
dswstate.o \
exconvrt.o \
@@ -142,6 +149,7 @@ OBJS = \
utcache.o \
utcopy.o \
utdebug.o \
+ utdecode.o \
utdelete.o \
utglobal.o \
utinit.o \
@@ -201,6 +209,9 @@ aslcompilerparse.o : aslcompilerparse.c
aslanalyze.o : $(ASL_COMPILER)/aslanalyze.c
$(COMPILE)
+aslbtypes.o : $(ASL_COMPILER)/aslbtypes.c
+ $(COMPILE)
+
aslcodegen.o : $(ASL_COMPILER)/aslcodegen.c
$(COMPILE)
@@ -288,6 +299,9 @@ aslutils.o : $(ASL_COMPILER)/aslutils.c
asluuid.o : $(ASL_COMPILER)/asluuid.c
$(COMPILE)
+aslwalks.o : $(ASL_COMPILER)/aslwalks.c
+ $(COMPILE)
+
#
# Data Table Compiler
@@ -295,6 +309,9 @@ asluuid.o : $(ASL_COMPILER)/asluuid.c
dtcompile.o : $(ASL_COMPILER)/dtcompile.c
$(COMPILE)
+dtexpress.o : $(ASL_COMPILER)/dtexpress.c
+ $(COMPILE)
+
dtfield.o : $(ASL_COMPILER)/dtfield.c
$(COMPILE)
@@ -378,6 +395,12 @@ dmutils.o : $(ACPICA_CORE)/disassembler/dmutils.c
dmwalk.o : $(ACPICA_CORE)/disassembler/dmwalk.c
$(COMPILE)
+dsargs.o : $(ACPICA_CORE)/dispatcher/dsargs.c
+ $(COMPILE)
+
+dscontrol.o : $(ACPICA_CORE)/dispatcher/dscontrol.c
+ $(COMPILE)
+
dsfield.o : $(ACPICA_CORE)/dispatcher/dsfield.c
$(COMPILE)
@@ -396,6 +419,9 @@ dswexec.o : $(ACPICA_CORE)/dispatcher/dswexec.c
dswload.o : $(ACPICA_CORE)/dispatcher/dswload.c
$(COMPILE)
+dswload2.o : $(ACPICA_CORE)/dispatcher/dswload2.c
+ $(COMPILE)
+
dswscope.o : $(ACPICA_CORE)/dispatcher/dswscope.c
$(COMPILE)
@@ -540,6 +566,9 @@ utcopy.o : $(ACPICA_CORE)/utilities/utcopy.c
utdebug.o : $(ACPICA_CORE)/utilities/utdebug.c
$(COMPILE)
+utdecode.o : $(ACPICA_CORE)/utilities/utdecode.c
+ $(COMPILE)
+
utdelete.o : $(ACPICA_CORE)/utilities/utdelete.c
$(COMPILE)
diff --git a/compiler/aslanalyze.c b/compiler/aslanalyze.c
index 9f1133c68808..0bb0a4bc0e22 100644
--- a/compiler/aslanalyze.c
+++ b/compiler/aslanalyze.c
@@ -1,7 +1,6 @@
-
/******************************************************************************
*
- * Module Name: aslanalyze.c - check for semantic errors
+ * Module Name: aslanalyze.c - Support functions for parse tree walks
*
*****************************************************************************/
@@ -45,65 +44,18 @@
#include "aslcompiler.h"
#include "aslcompiler.y.h"
-#include "acparser.h"
-#include "amlcode.h"
+#include <string.h>
+
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslanalyze")
-/* Local prototypes */
-
-static UINT32
-AnMapArgTypeToBtype (
- UINT32 ArgType);
-
-static UINT32
-AnMapEtypeToBtype (
- UINT32 Etype);
-
-static void
-AnFormatBtype (
- char *Buffer,
- UINT32 Btype);
-
-static UINT32
-AnGetBtype (
- ACPI_PARSE_OBJECT *Op);
-
-static UINT32
-AnMapObjTypeToBtype (
- ACPI_PARSE_OBJECT *Op);
-
-static BOOLEAN
-AnLastStatementIsReturn (
- ACPI_PARSE_OBJECT *Op);
-
-static void
-AnCheckMethodReturnValue (
- ACPI_PARSE_OBJECT *Op,
- const ACPI_OPCODE_INFO *OpInfo,
- ACPI_PARSE_OBJECT *ArgOp,
- UINT32 RequiredBtypes,
- UINT32 ThisNodeBtype);
-
-static BOOLEAN
-AnIsInternalMethod (
- ACPI_PARSE_OBJECT *Op);
-
-static UINT32
-AnGetInternalMethodReturnType (
- ACPI_PARSE_OBJECT *Op);
-
-static BOOLEAN
-AnIsResultUsed (
- ACPI_PARSE_OBJECT *Op);
-
/*******************************************************************************
*
* FUNCTION: AnIsInternalMethod
*
- * PARAMETERS: Op - Current op
+ * PARAMETERS: Op - Current op
*
* RETURN: Boolean
*
@@ -111,7 +63,7 @@ AnIsResultUsed (
*
******************************************************************************/
-static BOOLEAN
+BOOLEAN
AnIsInternalMethod (
ACPI_PARSE_OBJECT *Op)
{
@@ -130,7 +82,7 @@ AnIsInternalMethod (
*
* FUNCTION: AnGetInternalMethodReturnType
*
- * PARAMETERS: Op - Current op
+ * PARAMETERS: Op - Current op
*
* RETURN: Btype
*
@@ -138,7 +90,7 @@ AnIsInternalMethod (
*
******************************************************************************/
-static UINT32
+UINT32
AnGetInternalMethodReturnType (
ACPI_PARSE_OBJECT *Op)
{
@@ -155,437 +107,6 @@ AnGetInternalMethodReturnType (
/*******************************************************************************
*
- * FUNCTION: AnMapArgTypeToBtype
- *
- * PARAMETERS: ArgType - The ARGI required type(s) for this argument,
- * from the opcode info table
- *
- * 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
- * rules.
- *
- ******************************************************************************/
-
-static UINT32
-AnMapArgTypeToBtype (
- UINT32 ArgType)
-{
-
- switch (ArgType)
- {
-
- /* Simple types */
-
- case ARGI_ANYTYPE:
- return (ACPI_BTYPE_OBJECTS_AND_REFS);
-
- case ARGI_PACKAGE:
- return (ACPI_BTYPE_PACKAGE);
-
- case ARGI_EVENT:
- return (ACPI_BTYPE_EVENT);
-
- case ARGI_MUTEX:
- return (ACPI_BTYPE_MUTEX);
-
- case ARGI_DDBHANDLE:
- /*
- * DDBHandleObject := SuperName
- * ACPI_BTYPE_REFERENCE: Index reference as parameter of Load/Unload
- */
- return (ACPI_BTYPE_DDB_HANDLE | ACPI_BTYPE_REFERENCE);
-
- /* Interchangeable types */
- /*
- * Source conversion rules:
- * Integer, String, and Buffer are all interchangeable
- */
- case ARGI_INTEGER:
- case ARGI_STRING:
- case ARGI_BUFFER:
- case ARGI_BUFFER_OR_STRING:
- case ARGI_COMPUTEDATA:
- return (ACPI_BTYPE_COMPUTE_DATA);
-
- /* References */
-
- case ARGI_INTEGER_REF:
- return (ACPI_BTYPE_INTEGER);
-
- case ARGI_OBJECT_REF:
- return (ACPI_BTYPE_ALL_OBJECTS);
-
- case ARGI_DEVICE_REF:
- return (ACPI_BTYPE_DEVICE_OBJECTS);
-
- case ARGI_REFERENCE:
- return (ACPI_BTYPE_REFERENCE);
-
- case ARGI_TARGETREF:
- case ARGI_FIXED_TARGET:
- case ARGI_SIMPLE_TARGET:
- return (ACPI_BTYPE_OBJECTS_AND_REFS);
-
- /* Complex types */
-
- case ARGI_DATAOBJECT:
-
- /*
- * Buffer, string, package or reference to a Op -
- * Used only by SizeOf operator
- */
- return (ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER |
- ACPI_BTYPE_PACKAGE | ACPI_BTYPE_REFERENCE);
-
- case ARGI_COMPLEXOBJ:
-
- /* Buffer, String, or package */
-
- return (ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER | ACPI_BTYPE_PACKAGE);
-
- case ARGI_REF_OR_STRING:
- return (ACPI_BTYPE_STRING | ACPI_BTYPE_REFERENCE);
-
- 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 |
- ACPI_BTYPE_PACKAGE | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE);
-
- default:
- break;
- }
-
- return (ACPI_BTYPE_OBJECTS_AND_REFS);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AnMapEtypeToBtype
- *
- * PARAMETERS: Etype - Encoded ACPI Type
- *
- * 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)
- * this Etype is implicitly converted to during interpretation.
- *
- ******************************************************************************/
-
-static UINT32
-AnMapEtypeToBtype (
- UINT32 Etype)
-{
-
-
- if (Etype == ACPI_TYPE_ANY)
- {
- return ACPI_BTYPE_OBJECTS_AND_REFS;
- }
-
- /* Try the standard ACPI data types */
-
- if (Etype <= ACPI_TYPE_EXTERNAL_MAX)
- {
- /*
- * This switch statement implements the allowed operand conversion
- * rules as per the "ASL Data Types" section of the ACPI
- * specification.
- */
- switch (Etype)
- {
- case ACPI_TYPE_INTEGER:
- return (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_DDB_HANDLE);
-
- case ACPI_TYPE_STRING:
- case ACPI_TYPE_BUFFER:
- return (ACPI_BTYPE_COMPUTE_DATA);
-
- case ACPI_TYPE_PACKAGE:
- return (ACPI_BTYPE_PACKAGE);
-
- case ACPI_TYPE_FIELD_UNIT:
- return (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_FIELD_UNIT);
-
- case ACPI_TYPE_BUFFER_FIELD:
- return (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_BUFFER_FIELD);
-
- case ACPI_TYPE_DDB_HANDLE:
- return (ACPI_BTYPE_INTEGER | ACPI_BTYPE_DDB_HANDLE);
-
- case ACPI_BTYPE_DEBUG_OBJECT:
-
- /* Cannot be used as a source operand */
-
- return (0);
-
- default:
- return (1 << (Etype - 1));
- }
- }
-
- /* Try the internal data types */
-
- switch (Etype)
- {
- case ACPI_TYPE_LOCAL_REGION_FIELD:
- case ACPI_TYPE_LOCAL_BANK_FIELD:
- case ACPI_TYPE_LOCAL_INDEX_FIELD:
-
- /* Named fields can be either Integer/Buffer/String */
-
- return (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_FIELD_UNIT);
-
- case ACPI_TYPE_LOCAL_ALIAS:
-
- return (ACPI_BTYPE_INTEGER);
-
-
- case ACPI_TYPE_LOCAL_RESOURCE:
- case ACPI_TYPE_LOCAL_RESOURCE_FIELD:
-
- return (ACPI_BTYPE_REFERENCE);
-
- default:
- printf ("Unhandled encoded type: %X\n", Etype);
- return (0);
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AnFormatBtype
- *
- * PARAMETERS: Btype - Bitfield of ACPI types
- * Buffer - Where to put the ascii string
- *
- * RETURN: None.
- *
- * DESCRIPTION: Convert a Btype to a string of ACPI types
- *
- ******************************************************************************/
-
-static void
-AnFormatBtype (
- char *Buffer,
- UINT32 Btype)
-{
- UINT32 Type;
- BOOLEAN First = TRUE;
-
-
- *Buffer = 0;
-
- if (Btype == 0)
- {
- strcat (Buffer, "NoReturnValue");
- return;
- }
-
- for (Type = 1; Type <= ACPI_TYPE_EXTERNAL_MAX; Type++)
- {
- if (Btype & 0x00000001)
- {
- if (!First)
- {
- strcat (Buffer, "|");
- }
- First = FALSE;
- strcat (Buffer, AcpiUtGetTypeName (Type));
- }
- Btype >>= 1;
- }
-
- if (Btype & 0x00000001)
- {
- if (!First)
- {
- strcat (Buffer, "|");
- }
- First = FALSE;
- strcat (Buffer, "Reference");
- }
-
- Btype >>= 1;
- if (Btype & 0x00000001)
- {
- if (!First)
- {
- strcat (Buffer, "|");
- }
- First = FALSE;
- strcat (Buffer, "Resource");
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AnGetBtype
- *
- * PARAMETERS: Op - Parse node whose type will be returned.
- *
- * RETURN: The Btype associated with the Op.
- *
- * DESCRIPTION: Get the (bitfield) ACPI type associated with the parse node.
- * Handles the case where the node is a name or method call and
- * the actual type must be obtained from the namespace node.
- *
- ******************************************************************************/
-
-static UINT32
-AnGetBtype (
- ACPI_PARSE_OBJECT *Op)
-{
- ACPI_NAMESPACE_NODE *Node;
- ACPI_PARSE_OBJECT *ReferencedNode;
- UINT32 ThisNodeBtype = 0;
-
-
- if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) ||
- (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) ||
- (Op->Asl.ParseOpcode == PARSEOP_METHODCALL))
- {
- Node = Op->Asl.Node;
- if (!Node)
- {
- DbgPrint (ASL_DEBUG_OUTPUT,
- "No attached Nsnode: [%s] at line %u name [%s], ignoring typecheck\n",
- Op->Asl.ParseOpName, Op->Asl.LineNumber,
- Op->Asl.ExternalName);
- return ACPI_UINT32_MAX;
- }
-
- ThisNodeBtype = AnMapEtypeToBtype (Node->Type);
- if (!ThisNodeBtype)
- {
- AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, Op,
- "could not map type");
- }
-
- /*
- * Since it was a named reference, enable the
- * reference bit also
- */
- ThisNodeBtype |= ACPI_BTYPE_REFERENCE;
-
- if (Op->Asl.ParseOpcode == PARSEOP_METHODCALL)
- {
- ReferencedNode = Node->Op;
- if (!ReferencedNode)
- {
- /* 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)
- {
- ThisNodeBtype = ReferencedNode->Asl.AcpiBtype;
- }
- else
- {
- return (ACPI_UINT32_MAX -1);
- }
- }
- }
- else
- {
- ThisNodeBtype = Op->Asl.AcpiBtype;
- }
-
- return (ThisNodeBtype);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AnMapObjTypeToBtype
- *
- * PARAMETERS: Op - A parse node
- *
- * RETURN: A Btype
- *
- * DESCRIPTION: Map object to the associated "Btype"
- *
- ******************************************************************************/
-
-static UINT32
-AnMapObjTypeToBtype (
- ACPI_PARSE_OBJECT *Op)
-{
-
- switch (Op->Asl.ParseOpcode)
- {
- case PARSEOP_OBJECTTYPE_BFF: /* "BuffFieldObj" */
- return (ACPI_BTYPE_BUFFER_FIELD);
-
- case PARSEOP_OBJECTTYPE_BUF: /* "BuffObj" */
- return (ACPI_BTYPE_BUFFER);
-
- case PARSEOP_OBJECTTYPE_DDB: /* "DDBHandleObj" */
- return (ACPI_BTYPE_DDB_HANDLE);
-
- case PARSEOP_OBJECTTYPE_DEV: /* "DeviceObj" */
- return (ACPI_BTYPE_DEVICE);
-
- case PARSEOP_OBJECTTYPE_EVT: /* "EventObj" */
- return (ACPI_BTYPE_EVENT);
-
- case PARSEOP_OBJECTTYPE_FLD: /* "FieldUnitObj" */
- return (ACPI_BTYPE_FIELD_UNIT);
-
- case PARSEOP_OBJECTTYPE_INT: /* "IntObj" */
- return (ACPI_BTYPE_INTEGER);
-
- case PARSEOP_OBJECTTYPE_MTH: /* "MethodObj" */
- return (ACPI_BTYPE_METHOD);
-
- case PARSEOP_OBJECTTYPE_MTX: /* "MutexObj" */
- return (ACPI_BTYPE_MUTEX);
-
- case PARSEOP_OBJECTTYPE_OPR: /* "OpRegionObj" */
- return (ACPI_BTYPE_REGION);
-
- case PARSEOP_OBJECTTYPE_PKG: /* "PkgObj" */
- return (ACPI_BTYPE_PACKAGE);
-
- case PARSEOP_OBJECTTYPE_POW: /* "PowerResObj" */
- return (ACPI_BTYPE_POWER);
-
- case PARSEOP_OBJECTTYPE_STR: /* "StrObj" */
- return (ACPI_BTYPE_STRING);
-
- case PARSEOP_OBJECTTYPE_THZ: /* "ThermalZoneObj" */
- return (ACPI_BTYPE_THERMAL);
-
- case PARSEOP_OBJECTTYPE_UNK: /* "UnknownObj" */
- return (ACPI_BTYPE_OBJECTS_AND_REFS);
-
- default:
- return (0);
- }
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: AnCheckId
*
* PARAMETERS: Op - Current parse op
@@ -598,11 +119,7 @@ AnMapObjTypeToBtype (
*
******************************************************************************/
-#define ASL_TYPE_HID 0
-#define ASL_TYPE_CID 1
-#include <string.h>
-
-static void
+void
AnCheckId (
ACPI_PARSE_OBJECT *Op,
ACPI_NAME Type)
@@ -694,371 +211,9 @@ AnCheckId (
/*******************************************************************************
*
- * FUNCTION: AnMethodAnalysisWalkBegin
- *
- * 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
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AnMethodAnalysisWalkBegin (
- ACPI_PARSE_OBJECT *Op,
- UINT32 Level,
- void *Context)
-{
- ASL_ANALYSIS_WALK_INFO *WalkInfo = (ASL_ANALYSIS_WALK_INFO *) Context;
- ASL_METHOD_INFO *MethodInfo = WalkInfo->MethodStack;
- ACPI_PARSE_OBJECT *Next;
- UINT32 RegisterNumber;
- UINT32 i;
- char LocalName[] = "Local0";
- char ArgName[] = "Arg0";
- ACPI_PARSE_OBJECT *ArgNode;
- ACPI_PARSE_OBJECT *NextType;
- ACPI_PARSE_OBJECT *NextParamType;
- UINT8 ActualArgs = 0;
-
-
- switch (Op->Asl.ParseOpcode)
- {
- case PARSEOP_METHOD:
-
- TotalMethods++;
-
- /* Create and init method info */
-
- MethodInfo = UtLocalCalloc (sizeof (ASL_METHOD_INFO));
- MethodInfo->Next = WalkInfo->MethodStack;
- MethodInfo->Op = Op;
-
- WalkInfo->MethodStack = MethodInfo;
-
- /* Get the name node, ignored here */
-
- Next = Op->Asl.Child;
-
- /* Get the NumArguments node */
-
- Next = Next->Asl.Next;
- MethodInfo->NumArguments = (UINT8)
- (((UINT8) Next->Asl.Value.Integer) & 0x07);
-
- /* Get the SerializeRule and SyncLevel nodes, ignored here */
-
- Next = Next->Asl.Next;
- Next = Next->Asl.Next;
- ArgNode = Next;
-
- /* Get the ReturnType node */
-
- Next = Next->Asl.Next;
-
- NextType = Next->Asl.Child;
- while (NextType)
- {
- /* Get and map each of the ReturnTypes */
-
- MethodInfo->ValidReturnTypes |= AnMapObjTypeToBtype (NextType);
- NextType->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
- NextType = NextType->Asl.Next;
- }
-
- /* Get the ParameterType node */
-
- Next = Next->Asl.Next;
-
- NextType = Next->Asl.Child;
- while (NextType)
- {
- if (NextType->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
- {
- NextParamType = NextType->Asl.Child;
- while (NextParamType)
- {
- MethodInfo->ValidArgTypes[ActualArgs] |= AnMapObjTypeToBtype (NextParamType);
- NextParamType->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
- NextParamType = NextParamType->Asl.Next;
- }
- }
- else
- {
- MethodInfo->ValidArgTypes[ActualArgs] =
- AnMapObjTypeToBtype (NextType);
- NextType->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
- ActualArgs++;
- }
-
- NextType = NextType->Asl.Next;
- }
-
- if ((MethodInfo->NumArguments) &&
- (MethodInfo->NumArguments != ActualArgs))
- {
- /* error: Param list did not match number of args */
- }
-
- /* Allow numarguments == 0 for Function() */
-
- if ((!MethodInfo->NumArguments) && (ActualArgs))
- {
- MethodInfo->NumArguments = ActualArgs;
- ArgNode->Asl.Value.Integer |= ActualArgs;
- }
-
- /*
- * Actual arguments are initialized at method entry.
- * All other ArgX "registers" can be used as locals, so we
- * track their initialization.
- */
- for (i = 0; i < MethodInfo->NumArguments; i++)
- {
- MethodInfo->ArgInitialized[i] = TRUE;
- }
- break;
-
-
- case PARSEOP_METHODCALL:
-
- if (MethodInfo &&
- (Op->Asl.Node == MethodInfo->Op->Asl.Node))
- {
- AslError (ASL_REMARK, ASL_MSG_RECURSION, Op, Op->Asl.ExternalName);
- }
- break;
-
-
- case PARSEOP_LOCAL0:
- case PARSEOP_LOCAL1:
- case PARSEOP_LOCAL2:
- case PARSEOP_LOCAL3:
- case PARSEOP_LOCAL4:
- case PARSEOP_LOCAL5:
- case PARSEOP_LOCAL6:
- case PARSEOP_LOCAL7:
-
- if (!MethodInfo)
- {
- /*
- * Local was used outside a control method, or there was an error
- * in the method declaration.
- */
- AslError (ASL_REMARK, ASL_MSG_LOCAL_OUTSIDE_METHOD, Op, Op->Asl.ExternalName);
- return (AE_ERROR);
- }
-
- RegisterNumber = (Op->Asl.AmlOpcode & 0x000F);
-
- /*
- * If the local is being used as a target, mark the local
- * initialized
- */
- if (Op->Asl.CompileFlags & NODE_IS_TARGET)
- {
- MethodInfo->LocalInitialized[RegisterNumber] = TRUE;
- }
-
- /*
- * Otherwise, this is a reference, check if the local
- * has been previously initialized.
- *
- * The only operator that accepts an uninitialized value is ObjectType()
- */
- else if ((!MethodInfo->LocalInitialized[RegisterNumber]) &&
- (Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_OBJECTTYPE))
- {
- LocalName[strlen (LocalName) -1] = (char) (RegisterNumber + 0x30);
- AslError (ASL_ERROR, ASL_MSG_LOCAL_INIT, Op, LocalName);
- }
- break;
-
-
- case PARSEOP_ARG0:
- case PARSEOP_ARG1:
- case PARSEOP_ARG2:
- case PARSEOP_ARG3:
- case PARSEOP_ARG4:
- case PARSEOP_ARG5:
- case PARSEOP_ARG6:
-
- if (!MethodInfo)
- {
- /*
- * Arg was used outside a control method, or there was an error
- * in the method declaration.
- */
- AslError (ASL_REMARK, ASL_MSG_LOCAL_OUTSIDE_METHOD, Op, Op->Asl.ExternalName);
- return (AE_ERROR);
- }
-
- RegisterNumber = (Op->Asl.AmlOpcode & 0x000F) - 8;
- ArgName[strlen (ArgName) -1] = (char) (RegisterNumber + 0x30);
-
- /*
- * If the Arg is being used as a target, mark the local
- * initialized
- */
- if (Op->Asl.CompileFlags & NODE_IS_TARGET)
- {
- MethodInfo->ArgInitialized[RegisterNumber] = TRUE;
- }
-
- /*
- * Otherwise, this is a reference, check if the Arg
- * has been previously initialized.
- *
- * The only operator that accepts an uninitialized value is ObjectType()
- */
- else if ((!MethodInfo->ArgInitialized[RegisterNumber]) &&
- (Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_OBJECTTYPE))
- {
- AslError (ASL_ERROR, ASL_MSG_ARG_INIT, Op, ArgName);
- }
-
- /* Flag this arg if it is not a "real" argument to the method */
-
- if (RegisterNumber >= MethodInfo->NumArguments)
- {
- AslError (ASL_REMARK, ASL_MSG_NOT_PARAMETER, Op, ArgName);
- }
- break;
-
-
- case PARSEOP_RETURN:
-
- if (!MethodInfo)
- {
- /*
- * Probably was an error in the method declaration,
- * no additional error here
- */
- ACPI_WARNING ((AE_INFO, "%p, No parent method", Op));
- return (AE_ERROR);
- }
-
- /* Child indicates a return value */
-
- if ((Op->Asl.Child) &&
- (Op->Asl.Child->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG))
- {
- MethodInfo->NumReturnWithValue++;
- }
- else
- {
- MethodInfo->NumReturnNoValue++;
- }
- break;
-
-
- case PARSEOP_BREAK:
- case PARSEOP_CONTINUE:
-
- Next = Op->Asl.Parent;
- while (Next)
- {
- if (Next->Asl.ParseOpcode == PARSEOP_WHILE)
- {
- break;
- }
- Next = Next->Asl.Parent;
- }
-
- if (!Next)
- {
- AslError (ASL_ERROR, ASL_MSG_NO_WHILE, Op, NULL);
- }
- break;
-
-
- case PARSEOP_STALL:
-
- /* We can range check if the argument is an integer */
-
- if ((Op->Asl.Child->Asl.ParseOpcode == PARSEOP_INTEGER) &&
- (Op->Asl.Child->Asl.Value.Integer > ACPI_UINT8_MAX))
- {
- AslError (ASL_ERROR, ASL_MSG_INVALID_TIME, Op, NULL);
- }
- break;
-
-
- case PARSEOP_DEVICE:
- case PARSEOP_EVENT:
- case PARSEOP_MUTEX:
- case PARSEOP_OPERATIONREGION:
- case PARSEOP_POWERRESOURCE:
- case PARSEOP_PROCESSOR:
- case PARSEOP_THERMALZONE:
-
- /*
- * The first operand is a name to be created in the namespace.
- * Check against the reserved list.
- */
- i = ApCheckForPredefinedName (Op, Op->Asl.NameSeg);
- if (i < ACPI_VALID_RESERVED_NAME_MAX)
- {
- AslError (ASL_ERROR, ASL_MSG_RESERVED_USE, Op, Op->Asl.ExternalName);
- }
- break;
-
-
- case PARSEOP_NAME:
-
- /* Typecheck any predefined names statically defined with Name() */
-
- ApCheckForPredefinedObject (Op, Op->Asl.NameSeg);
-
- /* Special typechecking for _HID */
-
- if (!ACPI_STRCMP (METHOD_NAME__HID, Op->Asl.NameSeg))
- {
- Next = Op->Asl.Child->Asl.Next;
- AnCheckId (Next, ASL_TYPE_HID);
- }
-
- /* Special typechecking for _CID */
-
- else if (!ACPI_STRCMP (METHOD_NAME__CID, Op->Asl.NameSeg))
- {
- Next = Op->Asl.Child->Asl.Next;
-
- if ((Next->Asl.ParseOpcode == PARSEOP_PACKAGE) ||
- (Next->Asl.ParseOpcode == PARSEOP_VAR_PACKAGE))
- {
- Next = Next->Asl.Child;
- while (Next)
- {
- AnCheckId (Next, ASL_TYPE_CID);
- Next = Next->Asl.Next;
- }
- }
- else
- {
- AnCheckId (Next, ASL_TYPE_CID);
- }
- }
- break;
-
-
- default:
- break;
- }
-
- return AE_OK;
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: AnLastStatementIsReturn
*
- * PARAMETERS: Op - A method parse node
+ * PARAMETERS: Op - A method parse node
*
* RETURN: TRUE if last statement is an ASL RETURN. False otherwise
*
@@ -1068,307 +223,28 @@ AnMethodAnalysisWalkBegin (
*
******************************************************************************/
-static BOOLEAN
+BOOLEAN
AnLastStatementIsReturn (
ACPI_PARSE_OBJECT *Op)
{
ACPI_PARSE_OBJECT *Next;
- /*
- * Check if last statement is a return
- */
+ /* Check if last statement is a return */
+
Next = ASL_GET_CHILD_NODE (Op);
while (Next)
{
if ((!Next->Asl.Next) &&
(Next->Asl.ParseOpcode == PARSEOP_RETURN))
{
- return TRUE;
+ return (TRUE);
}
Next = ASL_GET_PEER_NODE (Next);
}
- return FALSE;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AnMethodAnalysisWalkEnd
- *
- * PARAMETERS: ASL_WALK_CALLBACK
- *
- * RETURN: Status
- *
- * DESCRIPTION: Ascending callback for analysis walk. Complete method
- * return analysis.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AnMethodAnalysisWalkEnd (
- ACPI_PARSE_OBJECT *Op,
- UINT32 Level,
- void *Context)
-{
- ASL_ANALYSIS_WALK_INFO *WalkInfo = (ASL_ANALYSIS_WALK_INFO *) Context;
- ASL_METHOD_INFO *MethodInfo = WalkInfo->MethodStack;
-
-
- switch (Op->Asl.ParseOpcode)
- {
- case PARSEOP_METHOD:
- case PARSEOP_RETURN:
- if (!MethodInfo)
- {
- printf ("No method info for method! [%s]\n", Op->Asl.Namepath);
- AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, Op,
- "No method info for this method");
- CmCleanupAndExit ();
- return (AE_AML_INTERNAL);
- }
- break;
-
- default:
- break;
- }
-
- switch (Op->Asl.ParseOpcode)
- {
- case PARSEOP_METHOD:
-
- WalkInfo->MethodStack = MethodInfo->Next;
-
- /*
- * Check if there is no return statement at the end of the
- * method AND we can actually get there -- i.e., the execution
- * of the method can possibly terminate without a return statement.
- */
- if ((!AnLastStatementIsReturn (Op)) &&
- (!(Op->Asl.CompileFlags & NODE_HAS_NO_EXIT)))
- {
- /*
- * No return statement, and execution can possibly exit
- * 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
- * no value
- */
- if (MethodInfo->NumReturnNoValue &&
- MethodInfo->NumReturnWithValue)
- {
- AslError (ASL_WARNING, ASL_MSG_RETURN_TYPES, Op,
- Op->Asl.ExternalName);
- }
-
- /*
- * 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
- * knowledge can be used to check method invocations that expect a
- * returned value.
- */
- if (MethodInfo->NumReturnNoValue)
- {
- if (MethodInfo->NumReturnWithValue)
- {
- Op->Asl.CompileFlags |= NODE_METHOD_SOME_NO_RETVAL;
- }
- else
- {
- Op->Asl.CompileFlags |= NODE_METHOD_NO_RETVAL;
- }
- }
-
- /*
- * Check predefined method names for correct return behavior
- * and correct number of arguments
- */
- ApCheckForPredefinedMethod (Op, MethodInfo);
- ACPI_FREE (MethodInfo);
- break;
-
-
- case PARSEOP_RETURN:
-
- /*
- * If the parent is a predefined method name, attempt to typecheck
- * the return value. Only static types can be validated.
- */
- ApCheckPredefinedReturnValue (Op, MethodInfo);
-
- /*
- * The parent block does not "exit" and continue execution -- the
- * method is terminated here with the Return() statement.
- */
- Op->Asl.Parent->Asl.CompileFlags |= NODE_HAS_NO_EXIT;
-
- /* Used in the "typing" pass later */
-
- Op->Asl.ParentMethod = MethodInfo->Op;
-
- /*
- * 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
- * the preceeding Return() statement.
- */
- if (Op->Asl.Next)
- {
- AslError (ASL_WARNING, ASL_MSG_UNREACHABLE_CODE, Op->Asl.Next, NULL);
- }
- break;
-
-
- case PARSEOP_IF:
-
- if ((Op->Asl.CompileFlags & NODE_HAS_NO_EXIT) &&
- (Op->Asl.Next) &&
- (Op->Asl.Next->Asl.ParseOpcode == PARSEOP_ELSE))
- {
- /*
- * 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.
- */
- Op->Asl.Next->Asl.CompileFlags |= NODE_IF_HAS_NO_EXIT;
- }
- break;
-
-
- case PARSEOP_ELSE:
-
- if ((Op->Asl.CompileFlags & NODE_HAS_NO_EXIT) &&
- (Op->Asl.CompileFlags & NODE_IF_HAS_NO_EXIT))
- {
- /*
- * This ELSE block has no exit and the corresponding IF block
- * has no exit either. Therefore, the parent node has no exit.
- */
- Op->Asl.Parent->Asl.CompileFlags |= NODE_HAS_NO_EXIT;
- }
- break;
-
-
- default:
-
- if ((Op->Asl.CompileFlags & NODE_HAS_NO_EXIT) &&
- (Op->Asl.Parent))
- {
- /* If this node has no exit, then the parent has no exit either */
-
- Op->Asl.Parent->Asl.CompileFlags |= NODE_HAS_NO_EXIT;
- }
- break;
- }
-
- return AE_OK;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AnMethodTypingWalkBegin
- *
- * PARAMETERS: ASL_WALK_CALLBACK
- *
- * RETURN: Status
- *
- * DESCRIPTION: Descending callback for the typing walk.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AnMethodTypingWalkBegin (
- ACPI_PARSE_OBJECT *Op,
- UINT32 Level,
- void *Context)
-{
-
- return AE_OK;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AnMethodTypingWalkEnd
- *
- * PARAMETERS: ASL_WALK_CALLBACK
- *
- * RETURN: Status
- *
- * DESCRIPTION: Ascending callback for typing walk. Complete the method
- * return analysis. Check methods for:
- * 1) Initialized local variables
- * 2) Valid arguments
- * 3) Return types
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AnMethodTypingWalkEnd (
- ACPI_PARSE_OBJECT *Op,
- UINT32 Level,
- void *Context)
-{
- UINT32 ThisNodeBtype;
-
-
- switch (Op->Asl.ParseOpcode)
- {
- case PARSEOP_METHOD:
-
- Op->Asl.CompileFlags |= NODE_METHOD_TYPED;
- break;
-
- case PARSEOP_RETURN:
-
- if ((Op->Asl.Child) &&
- (Op->Asl.Child->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG))
- {
- ThisNodeBtype = AnGetBtype (Op->Asl.Child);
-
- if ((Op->Asl.Child->Asl.ParseOpcode == PARSEOP_METHODCALL) &&
- (ThisNodeBtype == (ACPI_UINT32_MAX -1)))
- {
- /*
- * The called method is untyped at this time (typically a
- * forward reference).
- *
- * Check for a recursive method call first.
- */
- if (Op->Asl.ParentMethod != Op->Asl.Child->Asl.Node->Op)
- {
- /* We must type the method here */
-
- TrWalkParseTree (Op->Asl.Child->Asl.Node->Op,
- ASL_WALK_VISIT_TWICE, AnMethodTypingWalkBegin,
- AnMethodTypingWalkEnd, NULL);
-
- ThisNodeBtype = AnGetBtype (Op->Asl.Child);
- }
- }
-
- /* Returns a value, save the value type */
-
- if (Op->Asl.ParentMethod)
- {
- Op->Asl.ParentMethod->Asl.AcpiBtype |= ThisNodeBtype;
- }
- }
- break;
-
- default:
- break;
- }
-
- return AE_OK;
+ return (FALSE);
}
@@ -1389,7 +265,7 @@ AnMethodTypingWalkEnd (
*
******************************************************************************/
-static void
+void
AnCheckMethodReturnValue (
ACPI_PARSE_OBJECT *Op,
const ACPI_OPCODE_INFO *OpInfo,
@@ -1426,7 +302,6 @@ AnCheckMethodReturnValue (
AnFormatBtype (StringBuffer, ThisNodeBtype);
AnFormatBtype (StringBuffer2, RequiredBtypes);
-
/*
* The case where the method does not return any value at all
* was already handled in the namespace cross reference
@@ -1447,347 +322,9 @@ AnCheckMethodReturnValue (
/*******************************************************************************
*
- * FUNCTION: AnOperandTypecheckWalkBegin
- *
- * 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
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AnOperandTypecheckWalkBegin (
- ACPI_PARSE_OBJECT *Op,
- UINT32 Level,
- void *Context)
-{
-
- return AE_OK;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AnOperandTypecheckWalkEnd
- *
- * PARAMETERS: ASL_WALK_CALLBACK
- *
- * RETURN: Status
- *
- * DESCRIPTION: Ascending callback for analysis walk. Complete method
- * return analysis.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AnOperandTypecheckWalkEnd (
- ACPI_PARSE_OBJECT *Op,
- UINT32 Level,
- void *Context)
-{
- const ACPI_OPCODE_INFO *OpInfo;
- UINT32 RuntimeArgTypes;
- UINT32 RuntimeArgTypes2;
- UINT32 RequiredBtypes;
- UINT32 ThisNodeBtype;
- UINT32 CommonBtypes;
- UINT32 OpcodeClass;
- ACPI_PARSE_OBJECT *ArgOp;
- UINT32 ArgType;
-
-
- switch (Op->Asl.AmlOpcode)
- {
- case AML_RAW_DATA_BYTE:
- case AML_RAW_DATA_WORD:
- case AML_RAW_DATA_DWORD:
- case AML_RAW_DATA_QWORD:
- case AML_RAW_DATA_BUFFER:
- case AML_RAW_DATA_CHAIN:
- case AML_PACKAGE_LENGTH:
- case AML_UNASSIGNED_OPCODE:
- case AML_DEFAULT_ARG_OP:
-
- /* Ignore the internal (compiler-only) AML opcodes */
-
- return (AE_OK);
-
- default:
- break;
- }
-
- OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode);
- if (!OpInfo)
- {
- return (AE_OK);
- }
-
- ArgOp = Op->Asl.Child;
- RuntimeArgTypes = OpInfo->RuntimeArgs;
- OpcodeClass = OpInfo->Class;
-
-#ifdef ASL_ERROR_NAMED_OBJECT_IN_WHILE
- /*
- * Update 11/2008: In practice, we can't perform this check. A simple
- * analysis is not sufficient. Also, it can cause errors when compiling
- * disassembled code because of the way Switch operators are implemented
- * (a While(One) loop with a named temp variable created within.)
- */
-
- /*
- * If we are creating a named object, check if we are within a while loop
- * by checking if the parent is a WHILE op. This is a simple analysis, but
- * probably sufficient for many cases.
- *
- * Allow Scope(), Buffer(), and Package().
- */
- if (((OpcodeClass == AML_CLASS_NAMED_OBJECT) && (Op->Asl.AmlOpcode != AML_SCOPE_OP)) ||
- ((OpcodeClass == AML_CLASS_CREATE) && (OpInfo->Flags & AML_NSNODE)))
- {
- if (Op->Asl.Parent->Asl.AmlOpcode == AML_WHILE_OP)
- {
- AslError (ASL_ERROR, ASL_MSG_NAMED_OBJECT_IN_WHILE, Op, NULL);
- }
- }
-#endif
-
- /*
- * Special case for control opcodes IF/RETURN/WHILE since they
- * have no runtime arg list (at this time)
- */
- switch (Op->Asl.AmlOpcode)
- {
- case AML_IF_OP:
- case AML_WHILE_OP:
- case AML_RETURN_OP:
-
- if (ArgOp->Asl.ParseOpcode == PARSEOP_METHODCALL)
- {
- /* Check for an internal method */
-
- if (AnIsInternalMethod (ArgOp))
- {
- return (AE_OK);
- }
-
- /* The lone arg is a method call, check it */
-
- RequiredBtypes = AnMapArgTypeToBtype (ARGI_INTEGER);
- if (Op->Asl.AmlOpcode == AML_RETURN_OP)
- {
- RequiredBtypes = 0xFFFFFFFF;
- }
-
- ThisNodeBtype = AnGetBtype (ArgOp);
- if (ThisNodeBtype == ACPI_UINT32_MAX)
- {
- return (AE_OK);
- }
- AnCheckMethodReturnValue (Op, OpInfo, ArgOp,
- RequiredBtypes, ThisNodeBtype);
- }
- return (AE_OK);
-
- default:
- break;
- }
-
- /* Ignore the non-executable opcodes */
-
- if (RuntimeArgTypes == ARGI_INVALID_OPCODE)
- {
- return (AE_OK);
- }
-
- switch (OpcodeClass)
- {
- case AML_CLASS_EXECUTE:
- case AML_CLASS_CREATE:
- case AML_CLASS_CONTROL:
- case AML_CLASS_RETURN_VALUE:
-
- /* TBD: Change class or fix typechecking for these */
-
- if ((Op->Asl.AmlOpcode == AML_BUFFER_OP) ||
- (Op->Asl.AmlOpcode == AML_PACKAGE_OP) ||
- (Op->Asl.AmlOpcode == AML_VAR_PACKAGE_OP))
- {
- break;
- }
-
- /* Reverse the runtime argument list */
-
- RuntimeArgTypes2 = 0;
- while ((ArgType = GET_CURRENT_ARG_TYPE (RuntimeArgTypes)))
- {
- RuntimeArgTypes2 <<= ARG_TYPE_WIDTH;
- RuntimeArgTypes2 |= ArgType;
- INCREMENT_ARG_LIST (RuntimeArgTypes);
- }
-
- while ((ArgType = GET_CURRENT_ARG_TYPE (RuntimeArgTypes2)))
- {
- RequiredBtypes = AnMapArgTypeToBtype (ArgType);
-
- ThisNodeBtype = AnGetBtype (ArgOp);
- if (ThisNodeBtype == ACPI_UINT32_MAX)
- {
- goto NextArgument;
- }
-
- /* Examine the arg based on the required type of the arg */
-
- switch (ArgType)
- {
- case ARGI_TARGETREF:
-
- if (ArgOp->Asl.ParseOpcode == PARSEOP_ZERO)
- {
- /* ZERO is the placeholder for "don't store result" */
-
- ThisNodeBtype = RequiredBtypes;
- break;
- }
-
- if (ArgOp->Asl.ParseOpcode == PARSEOP_INTEGER)
- {
- /*
- * This is the case where an original reference to a resource
- * descriptor field has been replaced by an (Integer) offset.
- * These named fields are supported at compile-time only;
- * the names are not passed to the interpreter (via the AML).
- */
- if ((ArgOp->Asl.Node->Type == ACPI_TYPE_LOCAL_RESOURCE_FIELD) ||
- (ArgOp->Asl.Node->Type == ACPI_TYPE_LOCAL_RESOURCE))
- {
- AslError (ASL_ERROR, ASL_MSG_RESOURCE_FIELD, ArgOp, NULL);
- }
- else
- {
- AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ArgOp, NULL);
- }
- break;
- }
-
- if ((ArgOp->Asl.ParseOpcode == PARSEOP_METHODCALL) ||
- (ArgOp->Asl.ParseOpcode == PARSEOP_DEREFOF))
- {
- break;
- }
-
- ThisNodeBtype = RequiredBtypes;
- break;
-
-
- case ARGI_REFERENCE: /* References */
- case ARGI_INTEGER_REF:
- case ARGI_OBJECT_REF:
- case ARGI_DEVICE_REF:
-
- switch (ArgOp->Asl.ParseOpcode)
- {
- case PARSEOP_LOCAL0:
- case PARSEOP_LOCAL1:
- case PARSEOP_LOCAL2:
- case PARSEOP_LOCAL3:
- case PARSEOP_LOCAL4:
- case PARSEOP_LOCAL5:
- case PARSEOP_LOCAL6:
- case PARSEOP_LOCAL7:
-
- /* TBD: implement analysis of current value (type) of the local */
- /* For now, just treat any local as a typematch */
-
- /*ThisNodeBtype = RequiredBtypes;*/
- break;
-
- case PARSEOP_ARG0:
- case PARSEOP_ARG1:
- case PARSEOP_ARG2:
- case PARSEOP_ARG3:
- case PARSEOP_ARG4:
- case PARSEOP_ARG5:
- case PARSEOP_ARG6:
-
- /* Hard to analyze argument types, sow we won't */
- /* For now, just treat any arg as a typematch */
-
- /* ThisNodeBtype = RequiredBtypes; */
- break;
-
- case PARSEOP_DEBUG:
- break;
-
- case PARSEOP_REFOF:
- case PARSEOP_INDEX:
- default:
- break;
-
- }
- break;
-
- case ARGI_INTEGER:
- default:
- break;
- }
-
-
- CommonBtypes = ThisNodeBtype & RequiredBtypes;
-
- 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,
- RequiredBtypes, ThisNodeBtype);
- }
-
- /*
- * Now check if the actual type(s) match at least one
- * bit to the required type
- */
- else if (!CommonBtypes)
- {
- /* No match -- this is a type mismatch error */
-
- AnFormatBtype (StringBuffer, ThisNodeBtype);
- AnFormatBtype (StringBuffer2, RequiredBtypes);
-
- sprintf (MsgBuffer, "[%s] found, %s operator requires [%s]",
- StringBuffer, OpInfo->Name, StringBuffer2);
-
- AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ArgOp, MsgBuffer);
- }
-
- NextArgument:
- ArgOp = ArgOp->Asl.Next;
- INCREMENT_ARG_LIST (RuntimeArgTypes2);
- }
- break;
-
- default:
- break;
- }
-
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: AnIsResultUsed
*
- * PARAMETERS: Op - Parent op for the operator
+ * PARAMETERS: Op - Parent op for the operator
*
* RETURN: TRUE if result from this operation is actually consumed
*
@@ -1796,7 +333,7 @@ AnOperandTypecheckWalkEnd (
*
******************************************************************************/
-static BOOLEAN
+BOOLEAN
AnIsResultUsed (
ACPI_PARSE_OBJECT *Op)
{
@@ -1852,212 +389,97 @@ AnIsResultUsed (
/*******************************************************************************
*
- * FUNCTION: AnOtherSemanticAnalysisWalkBegin
+ * FUNCTION: ApCheckForGpeNameConflict
*
- * PARAMETERS: ASL_WALK_CALLBACK
+ * PARAMETERS: Op - Current parse op
*
- * RETURN: Status
+ * RETURN: None
*
- * DESCRIPTION: Descending callback for the analysis walk. Checks for
- * miscellaneous issues in the code.
+ * DESCRIPTION: Check for a conflict between GPE names within this scope.
+ * Conflict means two GPE names with the same GPE number, but
+ * different types -- such as _L1C and _E1C.
*
******************************************************************************/
-ACPI_STATUS
-AnOtherSemanticAnalysisWalkBegin (
- ACPI_PARSE_OBJECT *Op,
- UINT32 Level,
- void *Context)
+void
+ApCheckForGpeNameConflict (
+ ACPI_PARSE_OBJECT *Op)
{
- ACPI_PARSE_OBJECT *ArgNode;
- ACPI_PARSE_OBJECT *PrevArgNode = NULL;
- const ACPI_OPCODE_INFO *OpInfo;
+ ACPI_PARSE_OBJECT *NextOp;
+ UINT32 GpeNumber;
+ char Name[ACPI_NAME_SIZE + 1];
+ char Target[ACPI_NAME_SIZE];
+
+ /* Need a null-terminated string version of NameSeg */
- OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode);
+ ACPI_MOVE_32_TO_32 (Name, &Op->Asl.NameSeg);
+ Name[ACPI_NAME_SIZE] = 0;
/*
- * 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.)
+ * For a GPE method:
+ * 1st char must be underscore
+ * 2nd char must be L or E
+ * 3rd/4th chars must be a hex number
*/
- if ((OpInfo->Class == AML_CLASS_EXECUTE) &&
- (OpInfo->Flags & AML_HAS_RETVAL) &&
- (!AnIsResultUsed (Op)))
+ if ((Name[0] != '_') ||
+ ((Name[1] != 'L') && (Name[1] != 'E')))
{
- 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;
- }
+ return;
+ }
- /* Divide() is the only weird case, it has two targets */
+ /* Verify 3rd/4th chars are a valid hex value */
- if (Op->Asl.AmlOpcode == AML_DIVIDE_OP)
- {
- if ((ArgNode->Asl.ParseOpcode == PARSEOP_ZERO) &&
- (PrevArgNode) &&
- (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:
- case PARSEOP_LOADTABLE:
- break;
-
- default:
- AslError (ASL_WARNING, ASL_MSG_RESULT_NOT_USED, Op, Op->Asl.ExternalName);
- break;
- }
- }
+ GpeNumber = ACPI_STRTOUL (&Name[2], NULL, 16);
+ if (GpeNumber == ACPI_UINT32_MAX)
+ {
+ return;
}
-
/*
- * Semantic checks for individual ASL operators
+ * We are now sure we have an _Lxx or _Exx.
+ * Create the target name that would cause collision (Flip E/L)
*/
- 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.
- */
+ ACPI_MOVE_32_TO_32 (Target, Name);
- /* First child is the namepath, 2nd child is timeout */
+ /* Inject opposite letter ("L" versus "E") */
- ArgNode = Op->Asl.Child;
- ArgNode = ArgNode->Asl.Next;
+ if (Name[1] == 'L')
+ {
+ Target[1] = 'E';
+ }
+ else /* Name[1] == 'E' */
+ {
+ Target[1] = 'L';
+ }
- /*
- * 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 >= (UINT64) ACPI_WAIT_FOREVER))
- {
- break;
- }
+ /* Search all peers (objects within this scope) for target match */
+ NextOp = Op->Asl.Next;
+ while (NextOp)
+ {
/*
- * The operation could timeout. If the return value is not used
- * (indicates timeout occurred), issue a warning
+ * We mostly care about methods, but check Name() constructs also,
+ * even though they will get another error for not being a method.
+ * All GPE names must be defined as control methods.
*/
- if (!AnIsResultUsed (Op))
+ if ((NextOp->Asl.ParseOpcode == PARSEOP_METHOD) ||
+ (NextOp->Asl.ParseOpcode == PARSEOP_NAME))
{
- 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 (ACPI_COMPARE_NAME (Target, NextOp->Asl.NameSeg))
+ {
+ /* Found both _Exy and _Lxy in the same scope, error */
- 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);
+ AslError (ASL_ERROR, ASL_MSG_GPE_NAME_CONFLICT, NextOp,
+ Name);
+ return;
+ }
}
- break;
-
- default:
- break;
- }
-
- return AE_OK;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AnOtherSemanticAnalysisWalkEnd
- *
- * PARAMETERS: ASL_WALK_CALLBACK
- *
- * RETURN: Status
- *
- * DESCRIPTION: Ascending callback for analysis walk. Complete method
- * return analysis.
- *
- ******************************************************************************/
-ACPI_STATUS
-AnOtherSemanticAnalysisWalkEnd (
- ACPI_PARSE_OBJECT *Op,
- UINT32 Level,
- void *Context)
-{
-
- return AE_OK;
-
-}
-
-
-#ifdef ACPI_OBSOLETE_FUNCTIONS
-/*******************************************************************************
- *
- * FUNCTION: AnMapBtypeToEtype
- *
- * PARAMETERS: Btype - Bitfield of ACPI types
- *
- * RETURN: The Etype corresponding the the Btype
- *
- * DESCRIPTION: Convert a bitfield type to an encoded type
- *
- ******************************************************************************/
-
-UINT32
-AnMapBtypeToEtype (
- UINT32 Btype)
-{
- UINT32 i;
- UINT32 Etype;
-
-
- if (Btype == 0)
- {
- return 0;
+ NextOp = NextOp->Asl.Next;
}
- Etype = 1;
- for (i = 1; i < Btype; i *= 2)
- {
- Etype++;
- }
+ /* OK, no conflict found */
- return (Etype);
+ return;
}
-#endif
-
diff --git a/compiler/aslbtypes.c b/compiler/aslbtypes.c
new file mode 100644
index 000000000000..e1a4d0d29bc0
--- /dev/null
+++ b/compiler/aslbtypes.c
@@ -0,0 +1,525 @@
+/******************************************************************************
+ *
+ * Module Name: aslbtypes - Support for bitfield types
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2011, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * substantially similar to the "NO WARRANTY" disclaimer below
+ * ("Disclaimer") and any redistribution must be conditioned upon
+ * including a substantially similar Disclaimer requirement for further
+ * binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ * of any contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+
+#include "aslcompiler.h"
+#include "aslcompiler.y.h"
+#include "amlcode.h"
+
+
+#define _COMPONENT ACPI_COMPILER
+ ACPI_MODULE_NAME ("aslbtypes")
+
+/* Local prototypes */
+
+static UINT32
+AnMapEtypeToBtype (
+ UINT32 Etype);
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AnMapArgTypeToBtype
+ *
+ * PARAMETERS: ArgType - The ARGI required type(s) for this
+ * argument, from the opcode info table
+ *
+ * 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
+ * rules.
+ *
+ ******************************************************************************/
+
+UINT32
+AnMapArgTypeToBtype (
+ UINT32 ArgType)
+{
+
+ switch (ArgType)
+ {
+
+ /* Simple types */
+
+ case ARGI_ANYTYPE:
+ return (ACPI_BTYPE_OBJECTS_AND_REFS);
+
+ case ARGI_PACKAGE:
+ return (ACPI_BTYPE_PACKAGE);
+
+ case ARGI_EVENT:
+ return (ACPI_BTYPE_EVENT);
+
+ case ARGI_MUTEX:
+ return (ACPI_BTYPE_MUTEX);
+
+ case ARGI_DDBHANDLE:
+ /*
+ * DDBHandleObject := SuperName
+ * ACPI_BTYPE_REFERENCE: Index reference as parameter of Load/Unload
+ */
+ return (ACPI_BTYPE_DDB_HANDLE | ACPI_BTYPE_REFERENCE);
+
+ /* Interchangeable types */
+ /*
+ * Source conversion rules:
+ * Integer, String, and Buffer are all interchangeable
+ */
+ case ARGI_INTEGER:
+ case ARGI_STRING:
+ case ARGI_BUFFER:
+ case ARGI_BUFFER_OR_STRING:
+ case ARGI_COMPUTEDATA:
+ return (ACPI_BTYPE_COMPUTE_DATA);
+
+ /* References */
+
+ case ARGI_INTEGER_REF:
+ return (ACPI_BTYPE_INTEGER);
+
+ case ARGI_OBJECT_REF:
+ return (ACPI_BTYPE_ALL_OBJECTS);
+
+ case ARGI_DEVICE_REF:
+ return (ACPI_BTYPE_DEVICE_OBJECTS);
+
+ case ARGI_REFERENCE:
+ return (ACPI_BTYPE_REFERENCE);
+
+ case ARGI_TARGETREF:
+ case ARGI_FIXED_TARGET:
+ case ARGI_SIMPLE_TARGET:
+ return (ACPI_BTYPE_OBJECTS_AND_REFS);
+
+ /* Complex types */
+
+ case ARGI_DATAOBJECT:
+
+ /*
+ * Buffer, string, package or reference to a Op -
+ * Used only by SizeOf operator
+ */
+ return (ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER |
+ ACPI_BTYPE_PACKAGE | ACPI_BTYPE_REFERENCE);
+
+ case ARGI_COMPLEXOBJ:
+
+ /* Buffer, String, or package */
+
+ return (ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER | ACPI_BTYPE_PACKAGE);
+
+ case ARGI_REF_OR_STRING:
+ return (ACPI_BTYPE_STRING | ACPI_BTYPE_REFERENCE);
+
+ 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 |
+ ACPI_BTYPE_PACKAGE | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE);
+
+ default:
+ break;
+ }
+
+ return (ACPI_BTYPE_OBJECTS_AND_REFS);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AnMapEtypeToBtype
+ *
+ * PARAMETERS: Etype - Encoded ACPI Type
+ *
+ * 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)
+ * this Etype is implicitly converted to during interpretation.
+ *
+ ******************************************************************************/
+
+static UINT32
+AnMapEtypeToBtype (
+ UINT32 Etype)
+{
+
+
+ if (Etype == ACPI_TYPE_ANY)
+ {
+ return (ACPI_BTYPE_OBJECTS_AND_REFS);
+ }
+
+ /* Try the standard ACPI data types */
+
+ if (Etype <= ACPI_TYPE_EXTERNAL_MAX)
+ {
+ /*
+ * This switch statement implements the allowed operand conversion
+ * rules as per the "ASL Data Types" section of the ACPI
+ * specification.
+ */
+ switch (Etype)
+ {
+ case ACPI_TYPE_INTEGER:
+ return (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_DDB_HANDLE);
+
+ case ACPI_TYPE_STRING:
+ case ACPI_TYPE_BUFFER:
+ return (ACPI_BTYPE_COMPUTE_DATA);
+
+ case ACPI_TYPE_PACKAGE:
+ return (ACPI_BTYPE_PACKAGE);
+
+ case ACPI_TYPE_FIELD_UNIT:
+ return (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_FIELD_UNIT);
+
+ case ACPI_TYPE_BUFFER_FIELD:
+ return (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_BUFFER_FIELD);
+
+ case ACPI_TYPE_DDB_HANDLE:
+ return (ACPI_BTYPE_INTEGER | ACPI_BTYPE_DDB_HANDLE);
+
+ case ACPI_BTYPE_DEBUG_OBJECT:
+
+ /* Cannot be used as a source operand */
+
+ return (0);
+
+ default:
+ return (1 << (Etype - 1));
+ }
+ }
+
+ /* Try the internal data types */
+
+ switch (Etype)
+ {
+ case ACPI_TYPE_LOCAL_REGION_FIELD:
+ case ACPI_TYPE_LOCAL_BANK_FIELD:
+ case ACPI_TYPE_LOCAL_INDEX_FIELD:
+
+ /* Named fields can be either Integer/Buffer/String */
+
+ return (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_FIELD_UNIT);
+
+ case ACPI_TYPE_LOCAL_ALIAS:
+
+ return (ACPI_BTYPE_INTEGER);
+
+
+ case ACPI_TYPE_LOCAL_RESOURCE:
+ case ACPI_TYPE_LOCAL_RESOURCE_FIELD:
+
+ return (ACPI_BTYPE_REFERENCE);
+
+ default:
+ printf ("Unhandled encoded type: %X\n", Etype);
+ return (0);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AnFormatBtype
+ *
+ * PARAMETERS: Btype - Bitfield of ACPI types
+ * Buffer - Where to put the ascii string
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Convert a Btype to a string of ACPI types
+ *
+ ******************************************************************************/
+
+void
+AnFormatBtype (
+ char *Buffer,
+ UINT32 Btype)
+{
+ UINT32 Type;
+ BOOLEAN First = TRUE;
+
+
+ *Buffer = 0;
+
+ if (Btype == 0)
+ {
+ strcat (Buffer, "NoReturnValue");
+ return;
+ }
+
+ for (Type = 1; Type <= ACPI_TYPE_EXTERNAL_MAX; Type++)
+ {
+ if (Btype & 0x00000001)
+ {
+ if (!First)
+ {
+ strcat (Buffer, "|");
+ }
+ First = FALSE;
+ strcat (Buffer, AcpiUtGetTypeName (Type));
+ }
+ Btype >>= 1;
+ }
+
+ if (Btype & 0x00000001)
+ {
+ if (!First)
+ {
+ strcat (Buffer, "|");
+ }
+ First = FALSE;
+ strcat (Buffer, "Reference");
+ }
+
+ Btype >>= 1;
+ if (Btype & 0x00000001)
+ {
+ if (!First)
+ {
+ strcat (Buffer, "|");
+ }
+ First = FALSE;
+ strcat (Buffer, "Resource");
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AnGetBtype
+ *
+ * PARAMETERS: Op - Parse node whose type will be returned.
+ *
+ * RETURN: The Btype associated with the Op.
+ *
+ * DESCRIPTION: Get the (bitfield) ACPI type associated with the parse node.
+ * Handles the case where the node is a name or method call and
+ * the actual type must be obtained from the namespace node.
+ *
+ ******************************************************************************/
+
+UINT32
+AnGetBtype (
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_PARSE_OBJECT *ReferencedNode;
+ UINT32 ThisNodeBtype = 0;
+
+
+ if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) ||
+ (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) ||
+ (Op->Asl.ParseOpcode == PARSEOP_METHODCALL))
+ {
+ Node = Op->Asl.Node;
+ if (!Node)
+ {
+ DbgPrint (ASL_DEBUG_OUTPUT,
+ "No attached Nsnode: [%s] at line %u name [%s], ignoring typecheck\n",
+ Op->Asl.ParseOpName, Op->Asl.LineNumber,
+ Op->Asl.ExternalName);
+ return (ACPI_UINT32_MAX);
+ }
+
+ ThisNodeBtype = AnMapEtypeToBtype (Node->Type);
+ if (!ThisNodeBtype)
+ {
+ AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, Op,
+ "could not map type");
+ }
+
+ /*
+ * Since it was a named reference, enable the
+ * reference bit also
+ */
+ ThisNodeBtype |= ACPI_BTYPE_REFERENCE;
+
+ if (Op->Asl.ParseOpcode == PARSEOP_METHODCALL)
+ {
+ ReferencedNode = Node->Op;
+ if (!ReferencedNode)
+ {
+ /* 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)
+ {
+ ThisNodeBtype = ReferencedNode->Asl.AcpiBtype;
+ }
+ else
+ {
+ return (ACPI_UINT32_MAX -1);
+ }
+ }
+ }
+ else
+ {
+ ThisNodeBtype = Op->Asl.AcpiBtype;
+ }
+
+ return (ThisNodeBtype);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AnMapObjTypeToBtype
+ *
+ * PARAMETERS: Op - A parse node
+ *
+ * RETURN: A Btype
+ *
+ * DESCRIPTION: Map object to the associated "Btype"
+ *
+ ******************************************************************************/
+
+UINT32
+AnMapObjTypeToBtype (
+ ACPI_PARSE_OBJECT *Op)
+{
+
+ switch (Op->Asl.ParseOpcode)
+ {
+ case PARSEOP_OBJECTTYPE_BFF: /* "BuffFieldObj" */
+ return (ACPI_BTYPE_BUFFER_FIELD);
+
+ case PARSEOP_OBJECTTYPE_BUF: /* "BuffObj" */
+ return (ACPI_BTYPE_BUFFER);
+
+ case PARSEOP_OBJECTTYPE_DDB: /* "DDBHandleObj" */
+ return (ACPI_BTYPE_DDB_HANDLE);
+
+ case PARSEOP_OBJECTTYPE_DEV: /* "DeviceObj" */
+ return (ACPI_BTYPE_DEVICE);
+
+ case PARSEOP_OBJECTTYPE_EVT: /* "EventObj" */
+ return (ACPI_BTYPE_EVENT);
+
+ case PARSEOP_OBJECTTYPE_FLD: /* "FieldUnitObj" */
+ return (ACPI_BTYPE_FIELD_UNIT);
+
+ case PARSEOP_OBJECTTYPE_INT: /* "IntObj" */
+ return (ACPI_BTYPE_INTEGER);
+
+ case PARSEOP_OBJECTTYPE_MTH: /* "MethodObj" */
+ return (ACPI_BTYPE_METHOD);
+
+ case PARSEOP_OBJECTTYPE_MTX: /* "MutexObj" */
+ return (ACPI_BTYPE_MUTEX);
+
+ case PARSEOP_OBJECTTYPE_OPR: /* "OpRegionObj" */
+ return (ACPI_BTYPE_REGION);
+
+ case PARSEOP_OBJECTTYPE_PKG: /* "PkgObj" */
+ return (ACPI_BTYPE_PACKAGE);
+
+ case PARSEOP_OBJECTTYPE_POW: /* "PowerResObj" */
+ return (ACPI_BTYPE_POWER);
+
+ case PARSEOP_OBJECTTYPE_STR: /* "StrObj" */
+ return (ACPI_BTYPE_STRING);
+
+ case PARSEOP_OBJECTTYPE_THZ: /* "ThermalZoneObj" */
+ return (ACPI_BTYPE_THERMAL);
+
+ case PARSEOP_OBJECTTYPE_UNK: /* "UnknownObj" */
+ return (ACPI_BTYPE_OBJECTS_AND_REFS);
+
+ default:
+ return (0);
+ }
+}
+
+
+#ifdef ACPI_OBSOLETE_FUNCTIONS
+/*******************************************************************************
+ *
+ * FUNCTION: AnMapBtypeToEtype
+ *
+ * PARAMETERS: Btype - Bitfield of ACPI types
+ *
+ * RETURN: The Etype corresponding the the Btype
+ *
+ * DESCRIPTION: Convert a bitfield type to an encoded type
+ *
+ ******************************************************************************/
+
+UINT32
+AnMapBtypeToEtype (
+ UINT32 Btype)
+{
+ UINT32 i;
+ UINT32 Etype;
+
+
+ if (Btype == 0)
+ {
+ return (0);
+ }
+
+ Etype = 1;
+ for (i = 1; i < Btype; i *= 2)
+ {
+ Etype++;
+ }
+
+ return (Etype);
+}
+#endif
diff --git a/compiler/aslcompile.c b/compiler/aslcompile.c
index f22d01f9af0d..ec1b59783cbd 100644
--- a/compiler/aslcompile.c
+++ b/compiler/aslcompile.c
@@ -600,27 +600,25 @@ CmDoCompile (
Event = UtBeginEvent ("Determine object types returned by methods");
DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - Method typing\n\n");
- TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE,
- AnMethodTypingWalkBegin,
- AnMethodTypingWalkEnd, NULL);
+ TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD,
+ NULL, AnMethodTypingWalkEnd, NULL);
UtEndEvent (Event);
/* Semantic error checking part three - operand type checking */
Event = UtBeginEvent ("Analyze AML operand types");
DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - Operand type checking\n\n");
- TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE,
- AnOperandTypecheckWalkBegin,
- AnOperandTypecheckWalkEnd, &AnalysisWalkInfo);
+ TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD,
+ NULL, AnOperandTypecheckWalkEnd, &AnalysisWalkInfo);
UtEndEvent (Event);
/* Semantic error checking part four - other miscellaneous checks */
Event = UtBeginEvent ("Miscellaneous analysis");
DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - miscellaneous\n\n");
- TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE,
+ TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD,
AnOtherSemanticAnalysisWalkBegin,
- AnOtherSemanticAnalysisWalkEnd, &AnalysisWalkInfo);
+ NULL, &AnalysisWalkInfo);
UtEndEvent (Event);
/* Calculate all AML package lengths */
diff --git a/compiler/aslcompiler.h b/compiler/aslcompiler.h
index 05cc16b4f8cc..74bf55f33e1b 100644
--- a/compiler/aslcompiler.h
+++ b/compiler/aslcompiler.h
@@ -164,7 +164,7 @@ FlCheckForAscii (
/*
- * aslanalyze - semantic analysis
+ * aslwalks - semantic analysis and parse tree walks
*/
ACPI_STATUS
AnOtherSemanticAnalysisWalkBegin (
@@ -179,12 +179,6 @@ AnOtherSemanticAnalysisWalkEnd (
void *Context);
ACPI_STATUS
-AnOperandTypecheckWalkBegin (
- ACPI_PARSE_OBJECT *Op,
- UINT32 Level,
- void *Context);
-
-ACPI_STATUS
AnOperandTypecheckWalkEnd (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
@@ -203,16 +197,73 @@ AnMethodAnalysisWalkEnd (
void *Context);
ACPI_STATUS
-AnMethodTypingWalkBegin (
+AnMethodTypingWalkEnd (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context);
-ACPI_STATUS
-AnMethodTypingWalkEnd (
+
+/*
+ * aslbtypes - bitfield data types
+ */
+UINT32
+AnMapObjTypeToBtype (
+ ACPI_PARSE_OBJECT *Op);
+
+UINT32
+AnMapArgTypeToBtype (
+ UINT32 ArgType);
+
+UINT32
+AnGetBtype (
+ ACPI_PARSE_OBJECT *Op);
+
+void
+AnFormatBtype (
+ char *Buffer,
+ UINT32 Btype);
+
+
+/*
+ * aslanalyze - Support functions for parse tree walks
+ */
+void
+AnCheckId (
ACPI_PARSE_OBJECT *Op,
- UINT32 Level,
- void *Context);
+ ACPI_NAME Type);
+
+/* Values for Type argument above */
+
+#define ASL_TYPE_HID 0
+#define ASL_TYPE_CID 1
+
+BOOLEAN
+AnIsInternalMethod (
+ ACPI_PARSE_OBJECT *Op);
+
+UINT32
+AnGetInternalMethodReturnType (
+ ACPI_PARSE_OBJECT *Op);
+
+BOOLEAN
+AnLastStatementIsReturn (
+ ACPI_PARSE_OBJECT *Op);
+
+void
+AnCheckMethodReturnValue (
+ ACPI_PARSE_OBJECT *Op,
+ const ACPI_OPCODE_INFO *OpInfo,
+ ACPI_PARSE_OBJECT *ArgOp,
+ UINT32 RequiredBtypes,
+ UINT32 ThisNodeBtype);
+
+BOOLEAN
+AnIsResultUsed (
+ ACPI_PARSE_OBJECT *Op);
+
+void
+ApCheckForGpeNameConflict (
+ ACPI_PARSE_OBJECT *Op);
/*
@@ -488,6 +539,10 @@ TrCreateValuedLeafNode (
UINT64 Value);
ACPI_PARSE_OBJECT *
+TrCreateConstantLeafNode (
+ UINT32 ParseOpcode);
+
+ACPI_PARSE_OBJECT *
TrLinkChildren (
ACPI_PARSE_OBJECT *Op,
UINT32 NumChildren,
diff --git a/compiler/aslcompiler.l b/compiler/aslcompiler.l
index 48b514c4ae59..c5458bd8625e 100644
--- a/compiler/aslcompiler.l
+++ b/compiler/aslcompiler.l
@@ -392,6 +392,9 @@ NamePathTail [.]{NameSeg}
"AddressRangeNVS" { count (0); return (PARSEOP_ADDRESSTYPE_NVS); }
"AddressRangeACPI" { count (0); return (PARSEOP_ADDRESSTYPE_ACPI); }
+"__DATE__" { count (0); return (PARSEOP___DATE__); }
+"__FILE__" { count (0); return (PARSEOP___FILE__); }
+"__LINE__" { count (0); return (PARSEOP___LINE__); }
"{" { count (0); return('{'); }
"}" { count (0); return('}'); }
diff --git a/compiler/aslcompiler.y b/compiler/aslcompiler.y
index 6c84f889c1b9..5574f8815950 100644
--- a/compiler/aslcompiler.y
+++ b/compiler/aslcompiler.y
@@ -392,6 +392,13 @@ AslLocalAllocate (unsigned int Size);
%token <i> PARSEOP_XOR
%token <i> PARSEOP_ZERO
+/*
+ * Special functions. These should probably stay at the end of this
+ * table.
+ */
+%token <i> PARSEOP___DATE__
+%token <i> PARSEOP___FILE__
+%token <i> PARSEOP___LINE__
/*
* Production names
@@ -695,7 +702,6 @@ AslLocalAllocate (unsigned int Size);
%type <n> OptionalReference
%type <n> OptionalAccessSize
-
%type <n> TermArgItem
%type <n> NameStringItem
@@ -2317,6 +2323,9 @@ ConstExprTerm
: PARSEOP_ZERO {$$ = TrCreateValuedLeafNode (PARSEOP_ZERO, 0);}
| PARSEOP_ONE {$$ = TrCreateValuedLeafNode (PARSEOP_ONE, 1);}
| PARSEOP_ONES {$$ = TrCreateValuedLeafNode (PARSEOP_ONES, ACPI_UINT64_MAX);}
+ | PARSEOP___DATE__ {$$ = TrCreateConstantLeafNode (PARSEOP___DATE__);}
+ | PARSEOP___FILE__ {$$ = TrCreateConstantLeafNode (PARSEOP___FILE__);}
+ | PARSEOP___LINE__ {$$ = TrCreateConstantLeafNode (PARSEOP___LINE__);}
;
/* OptionalCount must appear before ByteList or an incorrect reduction will result */
@@ -3070,7 +3079,6 @@ NameStringItem
| ',' error {$$ = AslDoError (); yyclearin;}
;
-
%%
diff --git a/compiler/aslmessages.h b/compiler/aslmessages.h
index cab6968d05ba..62c51e424576 100644
--- a/compiler/aslmessages.h
+++ b/compiler/aslmessages.h
@@ -188,6 +188,8 @@ typedef enum
ASL_MSG_HID_LENGTH,
ASL_MSG_NULL_STRING,
ASL_MSG_LEADING_ASTERISK,
+ ASL_MSG_RESERVED_NO_RETURN_VAL,
+ ASL_MSG_GPE_NAME_CONFLICT,
ASL_MSG_INVALID_FIELD_NAME,
ASL_MSG_INTEGER_SIZE,
@@ -198,7 +200,10 @@ typedef enum
ASL_MSG_ZERO_VALUE,
ASL_MSG_UNKNOWN_TABLE,
ASL_MSG_UNKNOWN_SUBTABLE,
- ASL_MSG_OEM_TABLE
+ ASL_MSG_OEM_TABLE,
+ ASL_MSG_UNKNOWN_LABEL,
+ ASL_MSG_INVALID_EXPRESSION,
+ ASL_MSG_DIVIDE_BY_ZERO
} ASL_MESSAGE_IDS;
@@ -336,6 +341,8 @@ char *AslMessages [] = {
/* ASL_MSG_HID_LENGTH */ "_HID string must be exactly 7 or 8 characters",
/* ASL_MSG_NULL_STRING */ "Invalid zero-length (null) string",
/* ASL_MSG_LEADING_ASTERISK */ "Invalid leading asterisk",
+/* ASL_MSG_RESERVED_NO_RETURN_VAL */ "Reserved method should not return a value",
+/* ASL_MSG_GPE_NAME_CONFLICT */ "Name conflicts with a previous GPE method",
/* These messages are used by the data table compiler only */
@@ -348,7 +355,10 @@ char *AslMessages [] = {
/* ASL_MSG_ZERO_VALUE */ "Value must be non-zero",
/* ASL_MSG_UNKNOWN_TABLE */ "Unknown ACPI table signature",
/* ASL_MSG_UNKNOWN_SUBTABLE */ "Unknown subtable type",
-/* ASL_MSG_OEM_TABLE */ "OEM table - unknown contents"
+/* ASL_MSG_OEM_TABLE */ "OEM table - unknown contents",
+/* ASL_MSG_UNKNOWN_LABEL */ "Label is undefined",
+/* ASL_MSG_INVALID_EXPRESSION */ "Invalid expression",
+/* ASL_MSG_DIVIDE_BY_ZERO */ "Expression contains divide-by-zero"
};
diff --git a/compiler/aslpredef.c b/compiler/aslpredef.c
index 2fc3dd38ab90..702058fc3bc0 100644
--- a/compiler/aslpredef.c
+++ b/compiler/aslpredef.c
@@ -54,6 +54,11 @@
/* Local prototypes */
+static void
+ApCheckForUnexpectedReturnValue (
+ ACPI_PARSE_OBJECT *Op,
+ ASL_METHOD_INFO *MethodInfo);
+
static UINT32
ApCheckForSpecialName (
ACPI_PARSE_OBJECT *Op,
@@ -238,6 +243,53 @@ ApCheckForPredefinedMethod (
/*******************************************************************************
*
+ * FUNCTION: ApCheckForUnexpectedReturnValue
+ *
+ * PARAMETERS: Op - A parse node of type "RETURN".
+ * MethodInfo - Saved info about this method
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Check for an unexpected return value from a predefined method.
+ * Invoked for predefined methods that are defined to not return
+ * any value. If there is a return value, issue a remark, since
+ * the ASL writer may be confused as to the method definition
+ * and/or functionality.
+ *
+ * Note: We ignore all return values of "Zero", since this is what a standalone
+ * Return() statement will always generate -- so we ignore it here --
+ * i.e., there is no difference between Return() and Return(Zero).
+ * Also, a null Return() will be disassembled to return(Zero) -- so, we
+ * don't want to generate extraneous remarks/warnings for a disassembled
+ * ASL file.
+ *
+ ******************************************************************************/
+
+static void
+ApCheckForUnexpectedReturnValue (
+ ACPI_PARSE_OBJECT *Op,
+ ASL_METHOD_INFO *MethodInfo)
+{
+ ACPI_PARSE_OBJECT *ReturnValueOp;
+
+
+ /* Ignore Return() and Return(Zero) (they are the same) */
+
+ ReturnValueOp = Op->Asl.Child;
+ if (ReturnValueOp->Asl.ParseOpcode == PARSEOP_ZERO)
+ {
+ return;
+ }
+
+ /* We have a valid return value, but the reserved name did not expect it */
+
+ AslError (ASL_WARNING, ASL_MSG_RESERVED_NO_RETURN_VAL,
+ Op, MethodInfo->Op->Asl.ExternalName);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: ApCheckPredefinedReturnValue
*
* PARAMETERS: Op - A parse node of type "RETURN".
@@ -249,7 +301,9 @@ ApCheckForPredefinedMethod (
* value. Only "static" types can be validated - a simple return
* of an integer/string/buffer/package or a named reference to
* a static object. Values such as a Localx or Argx or a control
- * method invocation are not checked.
+ * method invocation are not checked. Issue a warning if there is
+ * a valid return value, but the reserved method defines no
+ * return value.
*
******************************************************************************/
@@ -269,20 +323,27 @@ ApCheckPredefinedReturnValue (
switch (Index)
{
+ case ACPI_EVENT_RESERVED_NAME: /* _Lxx/_Exx/_Wxx/_Qxx methods */
+
+ /* No return value expected, warn if there is one */
+
+ ApCheckForUnexpectedReturnValue (Op, MethodInfo);
+ return;
+
case ACPI_NOT_RESERVED_NAME: /* No underscore or _Txx or _xxx name not matched */
case ACPI_PREDEFINED_NAME: /* Resource Name or reserved scope name */
case ACPI_COMPILER_RESERVED_NAME: /* A _Txx that was not emitted by compiler */
- case ACPI_EVENT_RESERVED_NAME: /* _Lxx/_Exx/_Wxx/_Qxx methods */
/* Just return, nothing to do */
return;
default: /* A standard predefined ACPI name */
- /* Exit if no return value expected */
-
if (!PredefinedNames[Index].Info.ExpectedBtypes)
{
+ /* No return value expected, warn if there is one */
+
+ ApCheckForUnexpectedReturnValue (Op, MethodInfo);
return;
}
diff --git a/compiler/asltree.c b/compiler/asltree.c
index 0e7788dddf68..ded426ac44c5 100644
--- a/compiler/asltree.c
+++ b/compiler/asltree.c
@@ -45,6 +45,7 @@
#include "aslcompiler.h"
#include "aslcompiler.y.h"
+#include <time.h>
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("asltree")
@@ -403,6 +404,75 @@ TrCreateLeafNode (
/*******************************************************************************
*
+ * FUNCTION: TrCreateConstantLeafNode
+ *
+ * PARAMETERS: ParseOpcode - The constant opcode
+ *
+ * RETURN: Pointer to the new node. Aborts on allocation failure
+ *
+ * DESCRIPTION: Create a leaf node (no children or peers) for one of the
+ * special constants - __LINE__, __FILE__, and __DATE__.
+ *
+ * Note: An implemenation of __FUNC__ cannot happen here because we don't
+ * have a full parse tree at this time and cannot find the parent control
+ * method. If it is ever needed, __FUNC__ must be implemented later, after
+ * the parse tree has been fully constructed.
+ *
+ ******************************************************************************/
+
+ACPI_PARSE_OBJECT *
+TrCreateConstantLeafNode (
+ UINT32 ParseOpcode)
+{
+ ACPI_PARSE_OBJECT *Op = NULL;
+ time_t CurrentTime;
+ char *StaticTimeString;
+ char *TimeString;
+
+
+ switch (ParseOpcode)
+ {
+ case PARSEOP___LINE__:
+ Op = TrAllocateNode (PARSEOP_INTEGER);
+ Op->Asl.Value.Integer = Op->Asl.LineNumber;
+ break;
+
+ case PARSEOP___FILE__:
+ Op = TrAllocateNode (PARSEOP_STRING_LITERAL);
+
+ /* Op.Asl.Filename contains the full pathname to the file */
+
+ Op->Asl.Value.String = Op->Asl.Filename;
+ break;
+
+ case PARSEOP___DATE__:
+ Op = TrAllocateNode (PARSEOP_STRING_LITERAL);
+
+ /* Get a copy of the current time */
+
+ CurrentTime = time (NULL);
+ StaticTimeString = ctime (&CurrentTime);
+ TimeString = UtLocalCalloc (strlen (StaticTimeString) + 1);
+ strcpy (TimeString, StaticTimeString);
+
+ TimeString[strlen(TimeString) -1] = 0; /* Remove trailing newline */
+ Op->Asl.Value.String = TimeString;
+ break;
+
+ default: /* This would be an internal error */
+ return (NULL);
+ }
+
+ DbgPrint (ASL_PARSE_OUTPUT,
+ "\nCreateConstantLeafNode Ln/Col %u/%u NewNode %p Op %s Value %8.8X%8.8X ",
+ Op->Asl.LineNumber, Op->Asl.Column, Op, UtGetOpName (ParseOpcode),
+ ACPI_FORMAT_UINT64 (Op->Asl.Value.Integer));
+ return (Op);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: TrCreateValuedLeafNode
*
* PARAMETERS: ParseOpcode - New opcode to be assigned to the node
diff --git a/compiler/aslwalks.c b/compiler/aslwalks.c
new file mode 100644
index 000000000000..82ea1ec6c250
--- /dev/null
+++ b/compiler/aslwalks.c
@@ -0,0 +1,1148 @@
+/******************************************************************************
+ *
+ * Module Name: aslwalks.c - major analytical parse tree walks
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2011, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * substantially similar to the "NO WARRANTY" disclaimer below
+ * ("Disclaimer") and any redistribution must be conditioned upon
+ * including a substantially similar Disclaimer requirement for further
+ * binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ * of any contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+
+#include "aslcompiler.h"
+#include "aslcompiler.y.h"
+#include "acparser.h"
+#include "amlcode.h"
+
+
+#define _COMPONENT ACPI_COMPILER
+ ACPI_MODULE_NAME ("aslwalks")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AnMethodAnalysisWalkBegin
+ *
+ * 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
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AnMethodAnalysisWalkBegin (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+ ASL_ANALYSIS_WALK_INFO *WalkInfo = (ASL_ANALYSIS_WALK_INFO *) Context;
+ ASL_METHOD_INFO *MethodInfo = WalkInfo->MethodStack;
+ ACPI_PARSE_OBJECT *Next;
+ UINT32 RegisterNumber;
+ UINT32 i;
+ char LocalName[] = "Local0";
+ char ArgName[] = "Arg0";
+ ACPI_PARSE_OBJECT *ArgNode;
+ ACPI_PARSE_OBJECT *NextType;
+ ACPI_PARSE_OBJECT *NextParamType;
+ UINT8 ActualArgs = 0;
+
+
+ switch (Op->Asl.ParseOpcode)
+ {
+ case PARSEOP_METHOD:
+
+ TotalMethods++;
+
+ /* Create and init method info */
+
+ MethodInfo = UtLocalCalloc (sizeof (ASL_METHOD_INFO));
+ MethodInfo->Next = WalkInfo->MethodStack;
+ MethodInfo->Op = Op;
+
+ WalkInfo->MethodStack = MethodInfo;
+
+ /* Get the name node, ignored here */
+
+ Next = Op->Asl.Child;
+
+ /* Get the NumArguments node */
+
+ Next = Next->Asl.Next;
+ MethodInfo->NumArguments = (UINT8)
+ (((UINT8) Next->Asl.Value.Integer) & 0x07);
+
+ /* Get the SerializeRule and SyncLevel nodes, ignored here */
+
+ Next = Next->Asl.Next;
+ Next = Next->Asl.Next;
+ ArgNode = Next;
+
+ /* Get the ReturnType node */
+
+ Next = Next->Asl.Next;
+
+ NextType = Next->Asl.Child;
+ while (NextType)
+ {
+ /* Get and map each of the ReturnTypes */
+
+ MethodInfo->ValidReturnTypes |= AnMapObjTypeToBtype (NextType);
+ NextType->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
+ NextType = NextType->Asl.Next;
+ }
+
+ /* Get the ParameterType node */
+
+ Next = Next->Asl.Next;
+
+ NextType = Next->Asl.Child;
+ while (NextType)
+ {
+ if (NextType->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
+ {
+ NextParamType = NextType->Asl.Child;
+ while (NextParamType)
+ {
+ MethodInfo->ValidArgTypes[ActualArgs] |= AnMapObjTypeToBtype (NextParamType);
+ NextParamType->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
+ NextParamType = NextParamType->Asl.Next;
+ }
+ }
+ else
+ {
+ MethodInfo->ValidArgTypes[ActualArgs] =
+ AnMapObjTypeToBtype (NextType);
+ NextType->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
+ ActualArgs++;
+ }
+
+ NextType = NextType->Asl.Next;
+ }
+
+ if ((MethodInfo->NumArguments) &&
+ (MethodInfo->NumArguments != ActualArgs))
+ {
+ /* error: Param list did not match number of args */
+ }
+
+ /* Allow numarguments == 0 for Function() */
+
+ if ((!MethodInfo->NumArguments) && (ActualArgs))
+ {
+ MethodInfo->NumArguments = ActualArgs;
+ ArgNode->Asl.Value.Integer |= ActualArgs;
+ }
+
+ /*
+ * Actual arguments are initialized at method entry.
+ * All other ArgX "registers" can be used as locals, so we
+ * track their initialization.
+ */
+ for (i = 0; i < MethodInfo->NumArguments; i++)
+ {
+ MethodInfo->ArgInitialized[i] = TRUE;
+ }
+ break;
+
+
+ case PARSEOP_METHODCALL:
+
+ if (MethodInfo &&
+ (Op->Asl.Node == MethodInfo->Op->Asl.Node))
+ {
+ AslError (ASL_REMARK, ASL_MSG_RECURSION, Op, Op->Asl.ExternalName);
+ }
+ break;
+
+
+ case PARSEOP_LOCAL0:
+ case PARSEOP_LOCAL1:
+ case PARSEOP_LOCAL2:
+ case PARSEOP_LOCAL3:
+ case PARSEOP_LOCAL4:
+ case PARSEOP_LOCAL5:
+ case PARSEOP_LOCAL6:
+ case PARSEOP_LOCAL7:
+
+ if (!MethodInfo)
+ {
+ /*
+ * Local was used outside a control method, or there was an error
+ * in the method declaration.
+ */
+ AslError (ASL_REMARK, ASL_MSG_LOCAL_OUTSIDE_METHOD, Op, Op->Asl.ExternalName);
+ return (AE_ERROR);
+ }
+
+ RegisterNumber = (Op->Asl.AmlOpcode & 0x000F);
+
+ /*
+ * If the local is being used as a target, mark the local
+ * initialized
+ */
+ if (Op->Asl.CompileFlags & NODE_IS_TARGET)
+ {
+ MethodInfo->LocalInitialized[RegisterNumber] = TRUE;
+ }
+
+ /*
+ * Otherwise, this is a reference, check if the local
+ * has been previously initialized.
+ *
+ * The only operator that accepts an uninitialized value is ObjectType()
+ */
+ else if ((!MethodInfo->LocalInitialized[RegisterNumber]) &&
+ (Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_OBJECTTYPE))
+ {
+ LocalName[strlen (LocalName) -1] = (char) (RegisterNumber + 0x30);
+ AslError (ASL_ERROR, ASL_MSG_LOCAL_INIT, Op, LocalName);
+ }
+ break;
+
+
+ case PARSEOP_ARG0:
+ case PARSEOP_ARG1:
+ case PARSEOP_ARG2:
+ case PARSEOP_ARG3:
+ case PARSEOP_ARG4:
+ case PARSEOP_ARG5:
+ case PARSEOP_ARG6:
+
+ if (!MethodInfo)
+ {
+ /*
+ * Arg was used outside a control method, or there was an error
+ * in the method declaration.
+ */
+ AslError (ASL_REMARK, ASL_MSG_LOCAL_OUTSIDE_METHOD, Op, Op->Asl.ExternalName);
+ return (AE_ERROR);
+ }
+
+ RegisterNumber = (Op->Asl.AmlOpcode & 0x000F) - 8;
+ ArgName[strlen (ArgName) -1] = (char) (RegisterNumber + 0x30);
+
+ /*
+ * If the Arg is being used as a target, mark the local
+ * initialized
+ */
+ if (Op->Asl.CompileFlags & NODE_IS_TARGET)
+ {
+ MethodInfo->ArgInitialized[RegisterNumber] = TRUE;
+ }
+
+ /*
+ * Otherwise, this is a reference, check if the Arg
+ * has been previously initialized.
+ *
+ * The only operator that accepts an uninitialized value is ObjectType()
+ */
+ else if ((!MethodInfo->ArgInitialized[RegisterNumber]) &&
+ (Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_OBJECTTYPE))
+ {
+ AslError (ASL_ERROR, ASL_MSG_ARG_INIT, Op, ArgName);
+ }
+
+ /* Flag this arg if it is not a "real" argument to the method */
+
+ if (RegisterNumber >= MethodInfo->NumArguments)
+ {
+ AslError (ASL_REMARK, ASL_MSG_NOT_PARAMETER, Op, ArgName);
+ }
+ break;
+
+
+ case PARSEOP_RETURN:
+
+ if (!MethodInfo)
+ {
+ /*
+ * Probably was an error in the method declaration,
+ * no additional error here
+ */
+ ACPI_WARNING ((AE_INFO, "%p, No parent method", Op));
+ return (AE_ERROR);
+ }
+
+ /* Child indicates a return value */
+
+ if ((Op->Asl.Child) &&
+ (Op->Asl.Child->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG))
+ {
+ MethodInfo->NumReturnWithValue++;
+ }
+ else
+ {
+ MethodInfo->NumReturnNoValue++;
+ }
+ break;
+
+
+ case PARSEOP_BREAK:
+ case PARSEOP_CONTINUE:
+
+ Next = Op->Asl.Parent;
+ while (Next)
+ {
+ if (Next->Asl.ParseOpcode == PARSEOP_WHILE)
+ {
+ break;
+ }
+ Next = Next->Asl.Parent;
+ }
+
+ if (!Next)
+ {
+ AslError (ASL_ERROR, ASL_MSG_NO_WHILE, Op, NULL);
+ }
+ break;
+
+
+ case PARSEOP_STALL:
+
+ /* We can range check if the argument is an integer */
+
+ if ((Op->Asl.Child->Asl.ParseOpcode == PARSEOP_INTEGER) &&
+ (Op->Asl.Child->Asl.Value.Integer > ACPI_UINT8_MAX))
+ {
+ AslError (ASL_ERROR, ASL_MSG_INVALID_TIME, Op, NULL);
+ }
+ break;
+
+
+ case PARSEOP_DEVICE:
+ case PARSEOP_EVENT:
+ case PARSEOP_MUTEX:
+ case PARSEOP_OPERATIONREGION:
+ case PARSEOP_POWERRESOURCE:
+ case PARSEOP_PROCESSOR:
+ case PARSEOP_THERMALZONE:
+
+ /*
+ * The first operand is a name to be created in the namespace.
+ * Check against the reserved list.
+ */
+ i = ApCheckForPredefinedName (Op, Op->Asl.NameSeg);
+ if (i < ACPI_VALID_RESERVED_NAME_MAX)
+ {
+ AslError (ASL_ERROR, ASL_MSG_RESERVED_USE, Op, Op->Asl.ExternalName);
+ }
+ break;
+
+
+ case PARSEOP_NAME:
+
+ /* Typecheck any predefined names statically defined with Name() */
+
+ ApCheckForPredefinedObject (Op, Op->Asl.NameSeg);
+
+ /* Special typechecking for _HID */
+
+ if (!ACPI_STRCMP (METHOD_NAME__HID, Op->Asl.NameSeg))
+ {
+ Next = Op->Asl.Child->Asl.Next;
+ AnCheckId (Next, ASL_TYPE_HID);
+ }
+
+ /* Special typechecking for _CID */
+
+ else if (!ACPI_STRCMP (METHOD_NAME__CID, Op->Asl.NameSeg))
+ {
+ Next = Op->Asl.Child->Asl.Next;
+
+ if ((Next->Asl.ParseOpcode == PARSEOP_PACKAGE) ||
+ (Next->Asl.ParseOpcode == PARSEOP_VAR_PACKAGE))
+ {
+ Next = Next->Asl.Child;
+ while (Next)
+ {
+ AnCheckId (Next, ASL_TYPE_CID);
+ Next = Next->Asl.Next;
+ }
+ }
+ else
+ {
+ AnCheckId (Next, ASL_TYPE_CID);
+ }
+ }
+ break;
+
+
+ default:
+ break;
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AnMethodAnalysisWalkEnd
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Ascending callback for analysis walk. Complete method
+ * return analysis.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AnMethodAnalysisWalkEnd (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+ ASL_ANALYSIS_WALK_INFO *WalkInfo = (ASL_ANALYSIS_WALK_INFO *) Context;
+ ASL_METHOD_INFO *MethodInfo = WalkInfo->MethodStack;
+
+
+ switch (Op->Asl.ParseOpcode)
+ {
+ case PARSEOP_METHOD:
+ case PARSEOP_RETURN:
+ if (!MethodInfo)
+ {
+ printf ("No method info for method! [%s]\n", Op->Asl.Namepath);
+ AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, Op,
+ "No method info for this method");
+
+ CmCleanupAndExit ();
+ return (AE_AML_INTERNAL);
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ switch (Op->Asl.ParseOpcode)
+ {
+ case PARSEOP_METHOD:
+
+ WalkInfo->MethodStack = MethodInfo->Next;
+
+ /*
+ * Check if there is no return statement at the end of the
+ * method AND we can actually get there -- i.e., the execution
+ * of the method can possibly terminate without a return statement.
+ */
+ if ((!AnLastStatementIsReturn (Op)) &&
+ (!(Op->Asl.CompileFlags & NODE_HAS_NO_EXIT)))
+ {
+ /*
+ * No return statement, and execution can possibly exit
+ * 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
+ * no value
+ */
+ if (MethodInfo->NumReturnNoValue &&
+ MethodInfo->NumReturnWithValue)
+ {
+ AslError (ASL_WARNING, ASL_MSG_RETURN_TYPES, Op,
+ Op->Asl.ExternalName);
+ }
+
+ /*
+ * 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
+ * knowledge can be used to check method invocations that expect a
+ * returned value.
+ */
+ if (MethodInfo->NumReturnNoValue)
+ {
+ if (MethodInfo->NumReturnWithValue)
+ {
+ Op->Asl.CompileFlags |= NODE_METHOD_SOME_NO_RETVAL;
+ }
+ else
+ {
+ Op->Asl.CompileFlags |= NODE_METHOD_NO_RETVAL;
+ }
+ }
+
+ /*
+ * Check predefined method names for correct return behavior
+ * and correct number of arguments
+ */
+ ApCheckForPredefinedMethod (Op, MethodInfo);
+
+ /* Special check for two names like _L01 and _E01 in same scope */
+
+ ApCheckForGpeNameConflict (Op);
+ ACPI_FREE (MethodInfo);
+ break;
+
+
+ case PARSEOP_NAME:
+
+ /* Special check for two names like _L01 and _E01 in same scope */
+
+ ApCheckForGpeNameConflict (Op);
+ break;
+
+
+ case PARSEOP_RETURN:
+
+ /*
+ * If the parent is a predefined method name, attempt to typecheck
+ * the return value. Only static types can be validated.
+ */
+ ApCheckPredefinedReturnValue (Op, MethodInfo);
+
+ /*
+ * The parent block does not "exit" and continue execution -- the
+ * method is terminated here with the Return() statement.
+ */
+ Op->Asl.Parent->Asl.CompileFlags |= NODE_HAS_NO_EXIT;
+
+ /* Used in the "typing" pass later */
+
+ Op->Asl.ParentMethod = MethodInfo->Op;
+
+ /*
+ * 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
+ * the preceeding Return() statement.
+ */
+ if (Op->Asl.Next)
+ {
+ AslError (ASL_WARNING, ASL_MSG_UNREACHABLE_CODE, Op->Asl.Next, NULL);
+ }
+ break;
+
+
+ case PARSEOP_IF:
+
+ if ((Op->Asl.CompileFlags & NODE_HAS_NO_EXIT) &&
+ (Op->Asl.Next) &&
+ (Op->Asl.Next->Asl.ParseOpcode == PARSEOP_ELSE))
+ {
+ /*
+ * 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.
+ */
+ Op->Asl.Next->Asl.CompileFlags |= NODE_IF_HAS_NO_EXIT;
+ }
+ break;
+
+
+ case PARSEOP_ELSE:
+
+ if ((Op->Asl.CompileFlags & NODE_HAS_NO_EXIT) &&
+ (Op->Asl.CompileFlags & NODE_IF_HAS_NO_EXIT))
+ {
+ /*
+ * This ELSE block has no exit and the corresponding IF block
+ * has no exit either. Therefore, the parent node has no exit.
+ */
+ Op->Asl.Parent->Asl.CompileFlags |= NODE_HAS_NO_EXIT;
+ }
+ break;
+
+
+ default:
+
+ if ((Op->Asl.CompileFlags & NODE_HAS_NO_EXIT) &&
+ (Op->Asl.Parent))
+ {
+ /* If this node has no exit, then the parent has no exit either */
+
+ Op->Asl.Parent->Asl.CompileFlags |= NODE_HAS_NO_EXIT;
+ }
+ break;
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AnMethodTypingWalkEnd
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Ascending callback for typing walk. Complete the method
+ * return analysis. Check methods for:
+ * 1) Initialized local variables
+ * 2) Valid arguments
+ * 3) Return types
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AnMethodTypingWalkEnd (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+ UINT32 ThisNodeBtype;
+
+
+ switch (Op->Asl.ParseOpcode)
+ {
+ case PARSEOP_METHOD:
+
+ Op->Asl.CompileFlags |= NODE_METHOD_TYPED;
+ break;
+
+ case PARSEOP_RETURN:
+
+ if ((Op->Asl.Child) &&
+ (Op->Asl.Child->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG))
+ {
+ ThisNodeBtype = AnGetBtype (Op->Asl.Child);
+
+ if ((Op->Asl.Child->Asl.ParseOpcode == PARSEOP_METHODCALL) &&
+ (ThisNodeBtype == (ACPI_UINT32_MAX -1)))
+ {
+ /*
+ * The called method is untyped at this time (typically a
+ * forward reference).
+ *
+ * Check for a recursive method call first.
+ */
+ if (Op->Asl.ParentMethod != Op->Asl.Child->Asl.Node->Op)
+ {
+ /* We must type the method here */
+
+ TrWalkParseTree (Op->Asl.Child->Asl.Node->Op,
+ ASL_WALK_VISIT_UPWARD, NULL,
+ AnMethodTypingWalkEnd, NULL);
+
+ ThisNodeBtype = AnGetBtype (Op->Asl.Child);
+ }
+ }
+
+ /* Returns a value, save the value type */
+
+ if (Op->Asl.ParentMethod)
+ {
+ Op->Asl.ParentMethod->Asl.AcpiBtype |= ThisNodeBtype;
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AnOperandTypecheckWalkEnd
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Ascending callback for analysis walk. Complete method
+ * return analysis.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AnOperandTypecheckWalkEnd (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+ const ACPI_OPCODE_INFO *OpInfo;
+ UINT32 RuntimeArgTypes;
+ UINT32 RuntimeArgTypes2;
+ UINT32 RequiredBtypes;
+ UINT32 ThisNodeBtype;
+ UINT32 CommonBtypes;
+ UINT32 OpcodeClass;
+ ACPI_PARSE_OBJECT *ArgOp;
+ UINT32 ArgType;
+
+
+ switch (Op->Asl.AmlOpcode)
+ {
+ case AML_RAW_DATA_BYTE:
+ case AML_RAW_DATA_WORD:
+ case AML_RAW_DATA_DWORD:
+ case AML_RAW_DATA_QWORD:
+ case AML_RAW_DATA_BUFFER:
+ case AML_RAW_DATA_CHAIN:
+ case AML_PACKAGE_LENGTH:
+ case AML_UNASSIGNED_OPCODE:
+ case AML_DEFAULT_ARG_OP:
+
+ /* Ignore the internal (compiler-only) AML opcodes */
+
+ return (AE_OK);
+
+ default:
+ break;
+ }
+
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode);
+ if (!OpInfo)
+ {
+ return (AE_OK);
+ }
+
+ ArgOp = Op->Asl.Child;
+ RuntimeArgTypes = OpInfo->RuntimeArgs;
+ OpcodeClass = OpInfo->Class;
+
+#ifdef ASL_ERROR_NAMED_OBJECT_IN_WHILE
+ /*
+ * Update 11/2008: In practice, we can't perform this check. A simple
+ * analysis is not sufficient. Also, it can cause errors when compiling
+ * disassembled code because of the way Switch operators are implemented
+ * (a While(One) loop with a named temp variable created within.)
+ */
+
+ /*
+ * If we are creating a named object, check if we are within a while loop
+ * by checking if the parent is a WHILE op. This is a simple analysis, but
+ * probably sufficient for many cases.
+ *
+ * Allow Scope(), Buffer(), and Package().
+ */
+ if (((OpcodeClass == AML_CLASS_NAMED_OBJECT) && (Op->Asl.AmlOpcode != AML_SCOPE_OP)) ||
+ ((OpcodeClass == AML_CLASS_CREATE) && (OpInfo->Flags & AML_NSNODE)))
+ {
+ if (Op->Asl.Parent->Asl.AmlOpcode == AML_WHILE_OP)
+ {
+ AslError (ASL_ERROR, ASL_MSG_NAMED_OBJECT_IN_WHILE, Op, NULL);
+ }
+ }
+#endif
+
+ /*
+ * Special case for control opcodes IF/RETURN/WHILE since they
+ * have no runtime arg list (at this time)
+ */
+ switch (Op->Asl.AmlOpcode)
+ {
+ case AML_IF_OP:
+ case AML_WHILE_OP:
+ case AML_RETURN_OP:
+
+ if (ArgOp->Asl.ParseOpcode == PARSEOP_METHODCALL)
+ {
+ /* Check for an internal method */
+
+ if (AnIsInternalMethod (ArgOp))
+ {
+ return (AE_OK);
+ }
+
+ /* The lone arg is a method call, check it */
+
+ RequiredBtypes = AnMapArgTypeToBtype (ARGI_INTEGER);
+ if (Op->Asl.AmlOpcode == AML_RETURN_OP)
+ {
+ RequiredBtypes = 0xFFFFFFFF;
+ }
+
+ ThisNodeBtype = AnGetBtype (ArgOp);
+ if (ThisNodeBtype == ACPI_UINT32_MAX)
+ {
+ return (AE_OK);
+ }
+ AnCheckMethodReturnValue (Op, OpInfo, ArgOp,
+ RequiredBtypes, ThisNodeBtype);
+ }
+ return (AE_OK);
+
+ default:
+ break;
+ }
+
+ /* Ignore the non-executable opcodes */
+
+ if (RuntimeArgTypes == ARGI_INVALID_OPCODE)
+ {
+ return (AE_OK);
+ }
+
+ switch (OpcodeClass)
+ {
+ case AML_CLASS_EXECUTE:
+ case AML_CLASS_CREATE:
+ case AML_CLASS_CONTROL:
+ case AML_CLASS_RETURN_VALUE:
+
+ /* TBD: Change class or fix typechecking for these */
+
+ if ((Op->Asl.AmlOpcode == AML_BUFFER_OP) ||
+ (Op->Asl.AmlOpcode == AML_PACKAGE_OP) ||
+ (Op->Asl.AmlOpcode == AML_VAR_PACKAGE_OP))
+ {
+ break;
+ }
+
+ /* Reverse the runtime argument list */
+
+ RuntimeArgTypes2 = 0;
+ while ((ArgType = GET_CURRENT_ARG_TYPE (RuntimeArgTypes)))
+ {
+ RuntimeArgTypes2 <<= ARG_TYPE_WIDTH;
+ RuntimeArgTypes2 |= ArgType;
+ INCREMENT_ARG_LIST (RuntimeArgTypes);
+ }
+
+ while ((ArgType = GET_CURRENT_ARG_TYPE (RuntimeArgTypes2)))
+ {
+ RequiredBtypes = AnMapArgTypeToBtype (ArgType);
+
+ ThisNodeBtype = AnGetBtype (ArgOp);
+ if (ThisNodeBtype == ACPI_UINT32_MAX)
+ {
+ goto NextArgument;
+ }
+
+ /* Examine the arg based on the required type of the arg */
+
+ switch (ArgType)
+ {
+ case ARGI_TARGETREF:
+
+ if (ArgOp->Asl.ParseOpcode == PARSEOP_ZERO)
+ {
+ /* ZERO is the placeholder for "don't store result" */
+
+ ThisNodeBtype = RequiredBtypes;
+ break;
+ }
+
+ if (ArgOp->Asl.ParseOpcode == PARSEOP_INTEGER)
+ {
+ /*
+ * This is the case where an original reference to a resource
+ * descriptor field has been replaced by an (Integer) offset.
+ * These named fields are supported at compile-time only;
+ * the names are not passed to the interpreter (via the AML).
+ */
+ if ((ArgOp->Asl.Node->Type == ACPI_TYPE_LOCAL_RESOURCE_FIELD) ||
+ (ArgOp->Asl.Node->Type == ACPI_TYPE_LOCAL_RESOURCE))
+ {
+ AslError (ASL_ERROR, ASL_MSG_RESOURCE_FIELD, ArgOp, NULL);
+ }
+ else
+ {
+ AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ArgOp, NULL);
+ }
+ break;
+ }
+
+ if ((ArgOp->Asl.ParseOpcode == PARSEOP_METHODCALL) ||
+ (ArgOp->Asl.ParseOpcode == PARSEOP_DEREFOF))
+ {
+ break;
+ }
+
+ ThisNodeBtype = RequiredBtypes;
+ break;
+
+
+ case ARGI_REFERENCE: /* References */
+ case ARGI_INTEGER_REF:
+ case ARGI_OBJECT_REF:
+ case ARGI_DEVICE_REF:
+
+ switch (ArgOp->Asl.ParseOpcode)
+ {
+ case PARSEOP_LOCAL0:
+ case PARSEOP_LOCAL1:
+ case PARSEOP_LOCAL2:
+ case PARSEOP_LOCAL3:
+ case PARSEOP_LOCAL4:
+ case PARSEOP_LOCAL5:
+ case PARSEOP_LOCAL6:
+ case PARSEOP_LOCAL7:
+
+ /* TBD: implement analysis of current value (type) of the local */
+ /* For now, just treat any local as a typematch */
+
+ /*ThisNodeBtype = RequiredBtypes;*/
+ break;
+
+ case PARSEOP_ARG0:
+ case PARSEOP_ARG1:
+ case PARSEOP_ARG2:
+ case PARSEOP_ARG3:
+ case PARSEOP_ARG4:
+ case PARSEOP_ARG5:
+ case PARSEOP_ARG6:
+
+ /* Hard to analyze argument types, sow we won't */
+ /* For now, just treat any arg as a typematch */
+
+ /* ThisNodeBtype = RequiredBtypes; */
+ break;
+
+ case PARSEOP_DEBUG:
+ break;
+
+ case PARSEOP_REFOF:
+ case PARSEOP_INDEX:
+ default:
+ break;
+
+ }
+ break;
+
+ case ARGI_INTEGER:
+ default:
+ break;
+ }
+
+
+ CommonBtypes = ThisNodeBtype & RequiredBtypes;
+
+ 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,
+ RequiredBtypes, ThisNodeBtype);
+ }
+
+ /*
+ * Now check if the actual type(s) match at least one
+ * bit to the required type
+ */
+ else if (!CommonBtypes)
+ {
+ /* No match -- this is a type mismatch error */
+
+ AnFormatBtype (StringBuffer, ThisNodeBtype);
+ AnFormatBtype (StringBuffer2, RequiredBtypes);
+
+ sprintf (MsgBuffer, "[%s] found, %s operator requires [%s]",
+ StringBuffer, OpInfo->Name, StringBuffer2);
+
+ AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ArgOp, MsgBuffer);
+ }
+
+ NextArgument:
+ ArgOp = ArgOp->Asl.Next;
+ INCREMENT_ARG_LIST (RuntimeArgTypes2);
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AnOtherSemanticAnalysisWalkBegin
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Descending callback for the analysis walk. Checks for
+ * miscellaneous issues in the code.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AnOtherSemanticAnalysisWalkBegin (
+ ACPI_PARSE_OBJECT *Op,
+ 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) &&
+ (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:
+ case PARSEOP_LOADTABLE:
+ 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 >= (UINT64) 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);
+}
diff --git a/compiler/dtcompile.c b/compiler/dtcompile.c
index 723447116b8c..c1a7b08d5a34 100644
--- a/compiler/dtcompile.c
+++ b/compiler/dtcompile.c
@@ -426,7 +426,10 @@ DtCompileTable (
Length = DtGetSubtableLength (*Field, Info);
Subtable = UtLocalCalloc (sizeof (DT_SUBTABLE));
- Subtable->Buffer = UtLocalCalloc (Length);
+ if (Length > 0)
+ {
+ Subtable->Buffer = UtLocalCalloc (Length);
+ }
Subtable->Length = Length;
Subtable->TotalLength = Length;
Buffer = Subtable->Buffer;
@@ -470,7 +473,12 @@ DtCompileTable (
}
}
+ /* Maintain table offsets */
+
+ LocalField->TableOffset = Gbl_CurrentTableOffset;
FieldLength = DtGetFieldLength (LocalField, Info);
+ Gbl_CurrentTableOffset += FieldLength;
+
FieldType = DtGetFieldType (Info);
Gbl_InputFieldCount++;
@@ -537,6 +545,12 @@ DtCompileTable (
LocalField = *Field;
break;
+ case DT_FIELD_TYPE_LABEL:
+
+ DtWriteFieldToListing (Buffer, LocalField, 0);
+ LocalField = LocalField->Next;
+ break;
+
default:
/* Normal case for most field types (Integer, String, etc.) */
diff --git a/compiler/dtcompiler.h b/compiler/dtcompiler.h
index 6b969d5a45ce..a344a5ba2fb4 100644
--- a/compiler/dtcompiler.h
+++ b/compiler/dtcompiler.h
@@ -73,6 +73,7 @@
#define DT_FIELD_TYPE_UUID 7
#define DT_FIELD_TYPE_UNICODE 8
#define DT_FIELD_TYPE_DEVICE_PATH 9
+#define DT_FIELD_TYPE_LABEL 10
/*
@@ -80,13 +81,15 @@
*/
typedef struct dt_field
{
- char *Name;
- char *Value;
- struct dt_field *Next;
+ char *Name; /* Field name (from name : value) */
+ char *Value; /* Field value (from name : value) */
+ struct dt_field *Next; /* Next field */
+ struct dt_field *NextLabel; /* If field is a label, next label */
UINT32 Line; /* Line number for this field */
UINT32 ByteOffset; /* Offset in source file for field */
UINT32 NameColumn; /* Start column for field name */
UINT32 Column; /* Start column for field value */
+ UINT32 TableOffset;/* Binary offset within ACPI table */
UINT8 Flags;
} DT_FIELD;
@@ -131,6 +134,14 @@ DT_EXTERN DT_SUBTABLE DT_INIT_GLOBAL (*Gbl_RootTable, NULL);
DT_EXTERN DT_SUBTABLE DT_INIT_GLOBAL (*Gbl_SubtableStack, NULL);
+/* List for defined labels */
+
+DT_EXTERN DT_FIELD DT_INIT_GLOBAL (*Gbl_LabelList, NULL);
+
+/* Current offset within the binary output table */
+
+DT_EXTERN UINT32 DT_INIT_GLOBAL (Gbl_CurrentTableOffset, 0);
+
/* dtcompiler - main module */
@@ -207,6 +218,17 @@ DtGetParentSubtable (
DT_SUBTABLE *Subtable);
+/* dtexpress - Integer expressions and labels */
+
+UINT64
+DtResolveIntegerExpression (
+ DT_FIELD *Field);
+
+void
+DtDetectAllLabels (
+ DT_FIELD *FieldList);
+
+
/* dtfield - Compile individual fields within a table */
void
@@ -391,6 +413,10 @@ ACPI_STATUS
DtCompileXsdt (
void **PFieldList);
+ACPI_DMTABLE_INFO *
+DtGetGenericTableInfo (
+ char *Name);
+
/* ACPI Table templates */
extern const unsigned char TemplateAsf[];
diff --git a/compiler/dtexpress.c b/compiler/dtexpress.c
new file mode 100644
index 000000000000..20a2e3eb1d06
--- /dev/null
+++ b/compiler/dtexpress.c
@@ -0,0 +1,390 @@
+/******************************************************************************
+ *
+ * Module Name: dtexpress.c - Support for integer expressions and labels
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2011, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * substantially similar to the "NO WARRANTY" disclaimer below
+ * ("Disclaimer") and any redistribution must be conditioned upon
+ * including a substantially similar Disclaimer requirement for further
+ * binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ * of any contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#define __DTEXPRESS_C__
+
+#include "aslcompiler.h"
+#include "dtcompiler.h"
+
+#define _COMPONENT DT_COMPILER
+ ACPI_MODULE_NAME ("dtexpress")
+
+
+/* Local prototypes */
+
+static UINT64
+DtResolveInteger (
+ DT_FIELD *Field,
+ char *IntegerString);
+
+static void
+DtInsertLabelField (
+ DT_FIELD *Field);
+
+static DT_FIELD *
+DtLookupLabel (
+ char *Name);
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtResolveIntegerExpression
+ *
+ * PARAMETERS: Field - Field object with Integer expression
+ *
+ * RETURN: A 64-bit integer value
+ *
+ * DESCRIPTION: Resolve an integer expression to a single value. Supports
+ * both integer constants and labels. Supported operators are:
+ * +,-,*,/,%,|,&,^
+ *
+ *****************************************************************************/
+
+UINT64
+DtResolveIntegerExpression (
+ DT_FIELD *Field)
+{
+ char *IntegerString;
+ char *Operator;
+ UINT64 Value;
+ UINT64 Value2;
+
+
+ DbgPrint (ASL_DEBUG_OUTPUT, "Full Integer expression: %s\n",
+ Field->Value);
+
+ strcpy (MsgBuffer, Field->Value); /* Must take a copy for strtok() */
+
+ /* Obtain and resolve the first operand */
+
+ IntegerString = strtok (MsgBuffer, " ");
+ if (!IntegerString)
+ {
+ DtError (ASL_ERROR, ASL_MSG_INVALID_EXPRESSION, Field, Field->Value);
+ return (0);
+ }
+
+ Value = DtResolveInteger (Field, IntegerString);
+ DbgPrint (ASL_DEBUG_OUTPUT, "Integer resolved to V1: %8.8X%8.8X\n",
+ ACPI_FORMAT_UINT64 (Value));
+
+ /*
+ * Consume the entire expression string. For the rest of the
+ * expression string, values are of the form:
+ * <operator> <integer>
+ */
+ while (1)
+ {
+ Operator = strtok (NULL, " ");
+ if (!Operator)
+ {
+ /* Normal exit */
+
+ DbgPrint (ASL_DEBUG_OUTPUT, "Expression Resolved to: %8.8X%8.8X\n",
+ ACPI_FORMAT_UINT64 (Value));
+
+ return (Value);
+ }
+
+ IntegerString = strtok (NULL, " ");
+ if (!IntegerString ||
+ (strlen (Operator) > 1))
+ {
+ /* No corresponding operand for operator or invalid operator */
+
+ DtError (ASL_ERROR, ASL_MSG_INVALID_EXPRESSION, Field, Field->Value);
+ return (0);
+ }
+
+ Value2 = DtResolveInteger (Field, IntegerString);
+ DbgPrint (ASL_DEBUG_OUTPUT, "Integer resolved to V2: %8.8X%8.8X\n",
+ ACPI_FORMAT_UINT64 (Value2));
+
+ /* Perform the requested operation */
+
+ switch (*Operator)
+ {
+ case '-':
+ Value -= Value2;
+ break;
+
+ case '+':
+ Value += Value2;
+ break;
+
+ case '*':
+ Value *= Value2;
+ break;
+
+ case '|':
+ Value |= Value2;
+ break;
+
+ case '&':
+ Value &= Value2;
+ break;
+
+ case '^':
+ Value ^= Value2;
+ break;
+
+ case '/':
+ if (!Value2)
+ {
+ DtError (ASL_ERROR, ASL_MSG_DIVIDE_BY_ZERO, Field, Field->Value);
+ return (0);
+ }
+ Value /= Value2;
+ break;
+
+ case '%':
+ if (!Value2)
+ {
+ DtError (ASL_ERROR, ASL_MSG_DIVIDE_BY_ZERO, Field, Field->Value);
+ return (0);
+ }
+ Value %= Value2;
+ break;
+
+ default:
+
+ /* Unknown operator */
+
+ DtFatal (ASL_MSG_INVALID_EXPRESSION, Field, Field->Value);
+ break;
+ }
+ }
+
+ return (Value);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtResolveInteger
+ *
+ * PARAMETERS: Field - Field object with string to be resolved
+ * IntegerString - Integer to be resolved
+ *
+ * RETURN: A 64-bit integer value
+ *
+ * DESCRIPTION: Resolve a single integer string to a value. Supports both
+ * integer constants and labels.
+ *
+ * NOTE: References to labels must begin with a dollar sign ($)
+ *
+ *****************************************************************************/
+
+static UINT64
+DtResolveInteger (
+ DT_FIELD *Field,
+ char *IntegerString)
+{
+ DT_FIELD *LabelField;
+ UINT64 Value = 0;
+ char *Message = NULL;
+ ACPI_STATUS Status;
+
+
+ DbgPrint (ASL_DEBUG_OUTPUT, "Resolve Integer: %s\n", IntegerString);
+
+ /* Resolve a label reference to an integer (table offset) */
+
+ if (*IntegerString == '$')
+ {
+ LabelField = DtLookupLabel (IntegerString);
+ if (!LabelField)
+ {
+ DtError (ASL_ERROR, ASL_MSG_UNKNOWN_LABEL, Field, IntegerString);
+ return (0);
+ }
+
+ /* All we need from the label is the offset in the table */
+
+ Value = LabelField->TableOffset;
+ return (Value);
+ }
+
+ /* Convert string to an actual integer */
+
+ Status = DtStrtoul64 (IntegerString, &Value);
+ if (ACPI_FAILURE (Status))
+ {
+ if (Status == AE_LIMIT)
+ {
+ Message = "Constant larger than 64 bits";
+ }
+ else if (Status == AE_BAD_CHARACTER)
+ {
+ Message = "Invalid character in constant";
+ }
+
+ DtError (ASL_ERROR, ASL_MSG_INVALID_HEX_INTEGER, Field, Message);
+ }
+
+ return (Value);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtDetectAllLabels
+ *
+ * PARAMETERS: FieldList - Field object at start of generic list
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Detect all labels in a list of "generic" opcodes (such as
+ * a UEFI table.) and insert them into the global label list.
+ *
+ *****************************************************************************/
+
+void
+DtDetectAllLabels (
+ DT_FIELD *FieldList)
+{
+ ACPI_DMTABLE_INFO *Info;
+ DT_FIELD *GenericField;
+ UINT32 TableOffset;
+
+
+ TableOffset = Gbl_CurrentTableOffset;
+ GenericField = FieldList;
+
+ /*
+ * Process all "Label:" fields within the parse tree. We need
+ * to know the offsets for all labels before we can compile
+ * the parse tree in order to handle forward references. Traverse
+ * tree and get/set all field lengths of all operators in order to
+ * determine the label offsets.
+ */
+ while (GenericField)
+ {
+ Info = DtGetGenericTableInfo (GenericField->Name);
+ if (Info)
+ {
+ /* Maintain table offsets */
+
+ GenericField->TableOffset = TableOffset;
+ TableOffset += DtGetFieldLength (GenericField, Info);
+
+ /* Insert all labels in the global label list */
+
+ if (Info->Opcode == ACPI_DMT_LABEL)
+ {
+ DtInsertLabelField (GenericField);
+ }
+ }
+
+ GenericField = GenericField->Next;
+ }
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtInsertLabelField
+ *
+ * PARAMETERS: Field - Field object with Label to be inserted
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Insert a label field into the global label list
+ *
+ *****************************************************************************/
+
+static void
+DtInsertLabelField (
+ DT_FIELD *Field)
+{
+
+ DbgPrint (ASL_DEBUG_OUTPUT,
+ "DtInsertLabelField: Found Label : %s at output table offset %X\n",
+ Field->Value, Field->TableOffset);
+
+ Field->NextLabel = Gbl_LabelList;
+ Gbl_LabelList = Field;
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: DtLookupLabel
+ *
+ * PARAMETERS: Name - Label to be resolved
+ *
+ * RETURN: Field object associated with the label
+ *
+ * DESCRIPTION: Lookup a label in the global label list. Used during the
+ * resolution of integer expressions.
+ *
+ *****************************************************************************/
+
+static DT_FIELD *
+DtLookupLabel (
+ char *Name)
+{
+ DT_FIELD *LabelField;
+
+
+ /* Skip a leading $ */
+
+ if (*Name == '$')
+ {
+ Name++;
+ }
+
+ /* Search global list */
+
+ LabelField = Gbl_LabelList;
+ while (LabelField)
+ {
+ if (!ACPI_STRCMP (Name, LabelField->Value))
+ {
+ return (LabelField);
+ }
+ LabelField = LabelField->NextLabel;
+ }
+
+ return (NULL);
+}
diff --git a/compiler/dtfield.c b/compiler/dtfield.c
index 6b6e6ea025a3..4b631b6cf583 100644
--- a/compiler/dtfield.c
+++ b/compiler/dtfield.c
@@ -266,10 +266,12 @@ DtCompileUuid (
* PARAMETERS: Buffer - Output buffer
* Field - Field obj with Integer to be compiled
* ByteLength - Byte length of the integer
+ * Flags - Additional compile info
*
* RETURN: None
*
- * DESCRIPTION: Compile an integer
+ * DESCRIPTION: Compile an integer. Supports integer expressions with C-style
+ * operators.
*
*****************************************************************************/
@@ -280,15 +282,11 @@ DtCompileInteger (
UINT32 ByteLength,
UINT8 Flags)
{
- UINT64 Value = 0;
+ UINT64 Value;
UINT64 MaxValue;
- UINT8 *Hex;
- char *Message = NULL;
- ACPI_STATUS Status;
- int i;
- /* Byte length must be in range 1-8 */
+ /* Output buffer byte length must be in range 1-8 */
if ((ByteLength > 8) || (ByteLength == 0))
{
@@ -297,23 +295,9 @@ DtCompileInteger (
return;
}
- /* Convert string to an actual integer */
-
- Status = DtStrtoul64 (Field->Value, &Value);
- if (ACPI_FAILURE (Status))
- {
- if (Status == AE_LIMIT)
- {
- Message = "Constant larger than 64 bits";
- }
- else if (Status == AE_BAD_CHARACTER)
- {
- Message = "Invalid character in constant";
- }
+ /* Resolve integer expression to a single integer value */
- DtError (ASL_ERROR, ASL_MSG_INVALID_HEX_INTEGER, Field, Message);
- goto Exit;
- }
+ Value = DtResolveIntegerExpression (Field);
/* Ensure that reserved fields are set to zero */
/* TBD: should we set to zero, or just make this an ERROR? */
@@ -344,29 +328,10 @@ DtCompileInteger (
if (Value > MaxValue)
{
- sprintf (MsgBuffer, "Maximum %u bytes", ByteLength);
+ sprintf (MsgBuffer, "%8.8X%8.8X", ACPI_FORMAT_UINT64 (Value));
DtError (ASL_ERROR, ASL_MSG_INTEGER_SIZE, Field, MsgBuffer);
}
- /*
- * TBD: hard code for ASF! Capabilites field.
- *
- * This field is actually a buffer, not a 56-bit integer --
- * so, the ordering is reversed. Something should be fixed
- * so we don't need this code.
- */
- if (ByteLength == 7)
- {
- Hex = ACPI_CAST_PTR (UINT8, &Value);
- for (i = 6; i >= 0; i--)
- {
- Buffer[i] = *Hex;
- Hex++;
- }
- return;
- }
-
-Exit:
ACPI_MEMCPY (Buffer, &Value, ByteLength);
return;
}
diff --git a/compiler/dtio.c b/compiler/dtio.c
index 5fc50f73e6eb..395645035e6d 100644
--- a/compiler/dtio.c
+++ b/compiler/dtio.c
@@ -66,7 +66,7 @@ DtParseLine (
UINT32 Line,
UINT32 Offset);
-static UINT32
+UINT32
DtGetNextLine (
FILE *Handle);
@@ -80,8 +80,10 @@ static void
DtDumpBuffer (
UINT32 FileId,
UINT8 *Buffer,
+ UINT32 Offset,
UINT32 Length);
+
/* States for DtGetNextLine */
#define DT_NORMAL_TEXT 0
@@ -324,7 +326,7 @@ DtParseLine (
if (*End == '"')
{
End++;
- while (*End && *End != '"')
+ while (*End && (*End != '"'))
{
End++;
}
@@ -333,9 +335,16 @@ DtParseLine (
break;
}
+ /*
+ * Special "comment" fields at line end, ignore them.
+ * Note: normal slash-slash and slash-asterisk comments are
+ * stripped already by the DtGetNextLine parser.
+ *
+ * TBD: Perhaps DtGetNextLine should parse the following type
+ * of comments also.
+ */
if (*End == '(' ||
- *End == '<' ||
- *End == '/')
+ *End == '<')
{
break;
}
@@ -385,7 +394,7 @@ DtParseLine (
*
*****************************************************************************/
-static UINT32
+UINT32
DtGetNextLine (
FILE *Handle)
{
@@ -400,6 +409,19 @@ DtGetNextLine (
c = (char) getc (Handle);
if (c == EOF)
{
+ switch (State)
+ {
+ case DT_START_QUOTED_STRING:
+ case DT_SLASH_ASTERISK_COMMENT:
+ case DT_SLASH_SLASH_COMMENT:
+
+ AcpiOsPrintf ("**** EOF within comment/string %u\n", State);
+ break;
+
+ default:
+ break;
+ }
+
return (0);
}
@@ -520,6 +542,16 @@ DtGetNextLine (
State = DT_NORMAL_TEXT;
break;
+ case '\n':
+ CurrentLineOffset = Gbl_NextLineOffset;
+ Gbl_NextLineOffset = (UINT32) ftell (Handle);
+ Gbl_CurrentLineNumber++;
+ break;
+
+ case '*':
+ /* Consume all adjacent asterisks */
+ break;
+
default:
State = DT_SLASH_ASTERISK_COMMENT;
break;
@@ -653,6 +685,7 @@ DtOutputBinary (
*
* PARAMETERS: FileID - Where to write buffer data
* Buffer - Buffer to dump
+ * Offset - Offset in current table
* Length - Buffer Length
*
* RETURN: None
@@ -667,6 +700,7 @@ static void
DtDumpBuffer (
UINT32 FileId,
UINT8 *Buffer,
+ UINT32 Offset,
UINT32 Length)
{
UINT32 i;
@@ -674,12 +708,18 @@ DtDumpBuffer (
UINT8 BufChar;
+ FlPrintFile (FileId, "Output: [%3.3Xh %4.4d% 3d] ",
+ Offset, Offset, Length);
+
i = 0;
while (i < Length)
{
- /* Print 16 hex chars */
+ if (i >= 16)
+ {
+ FlPrintFile (FileId, "%23s", "");
+ }
- FlPrintFile (FileId, "Output: [%.3d] ", Length);
+ /* Print 16 hex chars */
for (j = 0; j < 16;)
{
@@ -773,17 +813,9 @@ DtWriteFieldToListing (
FlPrintFile (ASL_FILE_LISTING_OUTPUT, "Parsed: %*s : %s\n",
Field->Column-4, Field->Name, Field->Value);
-#if 0
- /* TBD Dump the length and AML offset */
-
- FlPrintFile (ASL_FILE_LISTING_OUTPUT,
- "Output: Length %d(0x%X) Offset %d(0x%X)\n",
- Field->Column-4, Field->Name, Field->Value);
-#endif
-
/* Dump the hex data that will be output for this field */
- DtDumpBuffer (ASL_FILE_LISTING_OUTPUT, Buffer, Length);
+ DtDumpBuffer (ASL_FILE_LISTING_OUTPUT, Buffer, Field->TableOffset, Length);
}
diff --git a/compiler/dttable.c b/compiler/dttable.c
index 702a71a0a571..f818d3e96a56 100644
--- a/compiler/dttable.c
+++ b/compiler/dttable.c
@@ -1278,7 +1278,7 @@ DtCompileSrat (
/******************************************************************************
*
- * FUNCTION: DtTableInfoGeneric
+ * FUNCTION: DtGetGenericTableInfo
*
* PARAMETERS: Name - Generic type name
*
@@ -1288,8 +1288,8 @@ DtCompileSrat (
*
*****************************************************************************/
-static ACPI_DMTABLE_INFO *
-DtTableInfoGeneric (
+ACPI_DMTABLE_INFO *
+DtGetGenericTableInfo (
char *Name)
{
ACPI_DMTABLE_INFO *Info;
@@ -1346,6 +1346,8 @@ DtCompileUefi (
UINT16 *DataOffset;
+ /* Compile the predefined portion of the UEFI table */
+
Status = DtCompileTable (PFieldList, AcpiDmTableInfoUefi,
&Subtable, TRUE);
if (ACPI_FAILURE (Status))
@@ -1359,9 +1361,21 @@ DtCompileUefi (
ParentTable = DtPeekSubtable ();
DtInsertSubtable (ParentTable, Subtable);
+ /*
+ * Compile the "generic" portion of the UEFI table. This
+ * part of the table is not predefined and any of the generic
+ * operators may be used.
+ */
+
+ /* Find any and all labels in the entire generic portion */
+
+ DtDetectAllLabels (*PFieldList);
+
+ /* Now we can actually compile the parse tree */
+
while (*PFieldList)
{
- Info = DtTableInfoGeneric ((*PFieldList)->Name);
+ Info = DtGetGenericTableInfo ((*PFieldList)->Name);
if (!Info)
{
sprintf (MsgBuffer, "Generic data type \"%s\" not found",
diff --git a/compiler/dtutils.c b/compiler/dtutils.c
index dcea17628250..2198cb55ddef 100644
--- a/compiler/dtutils.c
+++ b/compiler/dtutils.c
@@ -399,6 +399,7 @@ DtGetFieldType (
break;
case ACPI_DMT_BUFFER:
+ case ACPI_DMT_BUF7:
case ACPI_DMT_BUF16:
case ACPI_DMT_PCI_PATH:
Type = DT_FIELD_TYPE_BUFFER;
@@ -421,6 +422,10 @@ DtGetFieldType (
Type = DT_FIELD_TYPE_DEVICE_PATH;
break;
+ case ACPI_DMT_LABEL:
+ Type = DT_FIELD_TYPE_LABEL;
+ break;
+
default:
Type = DT_FIELD_TYPE_INTEGER;
break;
@@ -507,6 +512,7 @@ DtGetFieldLength (
case ACPI_DMT_FLAG7:
case ACPI_DMT_FLAGS0:
case ACPI_DMT_FLAGS2:
+ case ACPI_DMT_LABEL:
ByteLength = 0;
break;
@@ -549,6 +555,7 @@ DtGetFieldLength (
break;
case ACPI_DMT_UINT56:
+ case ACPI_DMT_BUF7:
ByteLength = 7;
break;
diff --git a/debugger/dbcmds.c b/debugger/dbcmds.c
index 37df3dc3889b..73387b872c6b 100644
--- a/debugger/dbcmds.c
+++ b/debugger/dbcmds.c
@@ -1,6 +1,6 @@
/*******************************************************************************
*
- * Module Name: dbcmds - debug commands and output routines
+ * Module Name: dbcmds - Miscellaneous debug commands and output routines
*
******************************************************************************/
@@ -44,14 +44,10 @@
#include "acpi.h"
#include "accommon.h"
-#include "acdispat.h"
-#include "acnamesp.h"
#include "acevents.h"
#include "acdebug.h"
#include "acresrc.h"
-#include "acdisasm.h"
#include "actables.h"
-#include "acparser.h"
#ifdef ACPI_DEBUGGER
@@ -61,38 +57,6 @@
/* Local prototypes */
-static ACPI_STATUS
-AcpiDbIntegrityWalk (
- ACPI_HANDLE ObjHandle,
- UINT32 NestingLevel,
- void *Context,
- void **ReturnValue);
-
-static ACPI_STATUS
-AcpiDbWalkAndMatchName (
- ACPI_HANDLE ObjHandle,
- UINT32 NestingLevel,
- void *Context,
- void **ReturnValue);
-
-static ACPI_STATUS
-AcpiDbWalkForReferences (
- ACPI_HANDLE ObjHandle,
- UINT32 NestingLevel,
- void *Context,
- void **ReturnValue);
-
-static ACPI_STATUS
-AcpiDbWalkForSpecificObjects (
- ACPI_HANDLE ObjHandle,
- UINT32 NestingLevel,
- void *Context,
- void **ReturnValue);
-
-static ACPI_NAMESPACE_NODE *
-AcpiDbConvertToNode (
- char *InString);
-
static void
AcpiDmCompareAmlResources (
UINT8 *Aml1Buffer,
@@ -106,38 +70,6 @@ AcpiDmTestResourceConversion (
char *Name);
-/*
- * Arguments for the Objects command
- * These object types map directly to the ACPI_TYPES
- */
-static ARGUMENT_INFO AcpiDbObjectTypes [] =
-{
- {"ANY"},
- {"INTEGERS"},
- {"STRINGS"},
- {"BUFFERS"},
- {"PACKAGES"},
- {"FIELDS"},
- {"DEVICES"},
- {"EVENTS"},
- {"METHODS"},
- {"MUTEXES"},
- {"REGIONS"},
- {"POWERRESOURCES"},
- {"PROCESSORS"},
- {"THERMALZONES"},
- {"BUFFERFIELDS"},
- {"DDBHANDLES"},
- {"DEBUG"},
- {"REGIONFIELDS"},
- {"BANKFIELDS"},
- {"INDEXFIELDS"},
- {"REFERENCES"},
- {"ALIAS"},
- {NULL} /* Must be null terminated */
-};
-
-
/*******************************************************************************
*
* FUNCTION: AcpiDbConvertToNode
@@ -151,7 +83,7 @@ static ARGUMENT_INFO AcpiDbObjectTypes [] =
*
******************************************************************************/
-static ACPI_NAMESPACE_NODE *
+ACPI_NAMESPACE_NODE *
AcpiDbConvertToNode (
char *InString)
{
@@ -238,319 +170,6 @@ AcpiDbSleep (
return (Status);
}
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDbWalkForReferences
- *
- * PARAMETERS: Callback from WalkNamespace
- *
- * RETURN: Status
- *
- * DESCRIPTION: Check if this namespace object refers to the target object
- * that is passed in as the context value.
- *
- * Note: Currently doesn't check subobjects within the Node's object
- *
- ******************************************************************************/
-
-static ACPI_STATUS
-AcpiDbWalkForReferences (
- ACPI_HANDLE ObjHandle,
- UINT32 NestingLevel,
- void *Context,
- void **ReturnValue)
-{
- ACPI_OPERAND_OBJECT *ObjDesc = (ACPI_OPERAND_OBJECT *) Context;
- ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
-
-
- /* Check for match against the namespace node itself */
-
- if (Node == (void *) ObjDesc)
- {
- AcpiOsPrintf ("Object is a Node [%4.4s]\n",
- AcpiUtGetNodeName (Node));
- }
-
- /* Check for match against the object attached to the node */
-
- if (AcpiNsGetAttachedObject (Node) == ObjDesc)
- {
- AcpiOsPrintf ("Reference at Node->Object %p [%4.4s]\n",
- Node, AcpiUtGetNodeName (Node));
- }
-
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDbFindReferences
- *
- * PARAMETERS: ObjectArg - String with hex value of the object
- *
- * RETURN: None
- *
- * DESCRIPTION: Search namespace for all references to the input object
- *
- ******************************************************************************/
-
-void
-AcpiDbFindReferences (
- char *ObjectArg)
-{
- ACPI_OPERAND_OBJECT *ObjDesc;
-
-
- /* Convert string to object pointer */
-
- ObjDesc = ACPI_TO_POINTER (ACPI_STRTOUL (ObjectArg, NULL, 16));
-
- /* Search all nodes in namespace */
-
- (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
- AcpiDbWalkForReferences, NULL, (void *) ObjDesc, NULL);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDbWalkForPredefinedNames
- *
- * PARAMETERS: Callback from WalkNamespace
- *
- * RETURN: Status
- *
- * DESCRIPTION: Detect and display predefined ACPI names (names that start with
- * an underscore)
- *
- ******************************************************************************/
-
-static ACPI_STATUS
-AcpiDbWalkForPredefinedNames (
- ACPI_HANDLE ObjHandle,
- UINT32 NestingLevel,
- void *Context,
- void **ReturnValue)
-{
- ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
- UINT32 *Count = (UINT32 *) Context;
- const ACPI_PREDEFINED_INFO *Predefined;
- const ACPI_PREDEFINED_INFO *Package = NULL;
- char *Pathname;
-
-
- Predefined = AcpiNsCheckForPredefinedName (Node);
- if (!Predefined)
- {
- return (AE_OK);
- }
-
- Pathname = AcpiNsGetExternalPathname (Node);
- if (!Pathname)
- {
- return (AE_OK);
- }
-
- /* If method returns a package, the info is in the next table entry */
-
- if (Predefined->Info.ExpectedBtypes & ACPI_BTYPE_PACKAGE)
- {
- Package = Predefined + 1;
- }
-
- AcpiOsPrintf ("%-32s arg %X ret %2.2X", Pathname,
- Predefined->Info.ParamCount, Predefined->Info.ExpectedBtypes);
-
- if (Package)
- {
- AcpiOsPrintf (" PkgType %2.2X ObjType %2.2X Count %2.2X",
- Package->RetInfo.Type, Package->RetInfo.ObjectType1,
- Package->RetInfo.Count1);
- }
-
- AcpiOsPrintf("\n");
-
- AcpiNsCheckParameterCount (Pathname, Node, ACPI_UINT32_MAX, Predefined);
- ACPI_FREE (Pathname);
- (*Count)++;
-
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDbCheckPredefinedNames
- *
- * PARAMETERS: None
- *
- * RETURN: None
- *
- * DESCRIPTION: Validate all predefined names in the namespace
- *
- ******************************************************************************/
-
-void
-AcpiDbCheckPredefinedNames (
- void)
-{
- UINT32 Count = 0;
-
-
- /* Search all nodes in namespace */
-
- (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
- AcpiDbWalkForPredefinedNames, NULL, (void *) &Count, NULL);
-
- AcpiOsPrintf ("Found %u predefined names in the namespace\n", Count);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDbWalkForExecute
- *
- * PARAMETERS: Callback from WalkNamespace
- *
- * RETURN: Status
- *
- * DESCRIPTION: Batch execution module. Currently only executes predefined
- * ACPI names.
- *
- ******************************************************************************/
-
-static ACPI_STATUS
-AcpiDbWalkForExecute (
- ACPI_HANDLE ObjHandle,
- UINT32 NestingLevel,
- void *Context,
- void **ReturnValue)
-{
- ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
- ACPI_EXECUTE_WALK *Info = (ACPI_EXECUTE_WALK *) Context;
- ACPI_BUFFER ReturnObj;
- ACPI_STATUS Status;
- char *Pathname;
- UINT32 i;
- ACPI_DEVICE_INFO *ObjInfo;
- ACPI_OBJECT_LIST ParamObjects;
- ACPI_OBJECT Params[ACPI_METHOD_NUM_ARGS];
- const ACPI_PREDEFINED_INFO *Predefined;
-
-
- Predefined = AcpiNsCheckForPredefinedName (Node);
- if (!Predefined)
- {
- return (AE_OK);
- }
-
- if (Node->Type == ACPI_TYPE_LOCAL_SCOPE)
- {
- return (AE_OK);
- }
-
- Pathname = AcpiNsGetExternalPathname (Node);
- if (!Pathname)
- {
- return (AE_OK);
- }
-
- /* Get the object info for number of method parameters */
-
- Status = AcpiGetObjectInfo (ObjHandle, &ObjInfo);
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
-
- ParamObjects.Pointer = NULL;
- ParamObjects.Count = 0;
-
- if (ObjInfo->Type == ACPI_TYPE_METHOD)
- {
- /* Setup default parameters */
-
- for (i = 0; i < ObjInfo->ParamCount; i++)
- {
- Params[i].Type = ACPI_TYPE_INTEGER;
- Params[i].Integer.Value = 1;
- }
-
- ParamObjects.Pointer = Params;
- ParamObjects.Count = ObjInfo->ParamCount;
- }
-
- ACPI_FREE (ObjInfo);
- ReturnObj.Pointer = NULL;
- ReturnObj.Length = ACPI_ALLOCATE_BUFFER;
-
- /* Do the actual method execution */
-
- AcpiGbl_MethodExecuting = TRUE;
-
- Status = AcpiEvaluateObject (Node, NULL, &ParamObjects, &ReturnObj);
-
- AcpiOsPrintf ("%-32s returned %s\n", Pathname, AcpiFormatException (Status));
- AcpiGbl_MethodExecuting = FALSE;
- ACPI_FREE (Pathname);
-
- /* Ignore status from method execution */
-
- Status = AE_OK;
-
- /* Update count, check if we have executed enough methods */
-
- Info->Count++;
- if (Info->Count >= Info->MaxCount)
- {
- Status = AE_CTRL_TERMINATE;
- }
-
- return (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDbBatchExecute
- *
- * PARAMETERS: CountArg - Max number of methods to execute
- *
- * RETURN: None
- *
- * DESCRIPTION: Namespace batch execution. Execute predefined names in the
- * namespace, up to the max count, if specified.
- *
- ******************************************************************************/
-
-void
-AcpiDbBatchExecute (
- char *CountArg)
-{
- ACPI_EXECUTE_WALK Info;
-
-
- Info.Count = 0;
- Info.MaxCount = ACPI_UINT32_MAX;
-
- if (CountArg)
- {
- Info.MaxCount = ACPI_STRTOUL (CountArg, NULL, 0);
- }
-
-
- /* Search all nodes in namespace */
-
- (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
- AcpiDbWalkForExecute, NULL, (void *) &Info, NULL);
-
- AcpiOsPrintf ("Executed %u predefined names in the namespace\n", Info.Count);
-}
-
-
/*******************************************************************************
*
* FUNCTION: AcpiDbDisplayLocks
@@ -691,282 +310,6 @@ AcpiDbUnloadAcpiTable (
/*******************************************************************************
*
- * FUNCTION: AcpiDbSetMethodBreakpoint
- *
- * PARAMETERS: Location - AML offset of breakpoint
- * WalkState - Current walk info
- * Op - Current Op (from parse walk)
- *
- * RETURN: None
- *
- * DESCRIPTION: Set a breakpoint in a control method at the specified
- * AML offset
- *
- ******************************************************************************/
-
-void
-AcpiDbSetMethodBreakpoint (
- char *Location,
- ACPI_WALK_STATE *WalkState,
- ACPI_PARSE_OBJECT *Op)
-{
- UINT32 Address;
-
-
- if (!Op)
- {
- AcpiOsPrintf ("There is no method currently executing\n");
- return;
- }
-
- /* Get and verify the breakpoint address */
-
- Address = ACPI_STRTOUL (Location, NULL, 16);
- if (Address <= Op->Common.AmlOffset)
- {
- AcpiOsPrintf ("Breakpoint %X is beyond current address %X\n",
- Address, Op->Common.AmlOffset);
- }
-
- /* Save breakpoint in current walk */
-
- WalkState->UserBreakpoint = Address;
- AcpiOsPrintf ("Breakpoint set at AML offset %X\n", Address);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDbSetMethodCallBreakpoint
- *
- * PARAMETERS: Op - Current Op (from parse walk)
- *
- * RETURN: None
- *
- * DESCRIPTION: Set a breakpoint in a control method at the specified
- * AML offset
- *
- ******************************************************************************/
-
-void
-AcpiDbSetMethodCallBreakpoint (
- ACPI_PARSE_OBJECT *Op)
-{
-
-
- if (!Op)
- {
- AcpiOsPrintf ("There is no method currently executing\n");
- return;
- }
-
- AcpiGbl_StepToNextCall = TRUE;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDbDisassembleAml
- *
- * PARAMETERS: Statements - Number of statements to disassemble
- * Op - Current Op (from parse walk)
- *
- * RETURN: None
- *
- * DESCRIPTION: Display disassembled AML (ASL) starting from Op for the number
- * of statements specified.
- *
- ******************************************************************************/
-
-void
-AcpiDbDisassembleAml (
- char *Statements,
- ACPI_PARSE_OBJECT *Op)
-{
- UINT32 NumStatements = 8;
-
-
- if (!Op)
- {
- AcpiOsPrintf ("There is no method currently executing\n");
- return;
- }
-
- if (Statements)
- {
- NumStatements = ACPI_STRTOUL (Statements, NULL, 0);
- }
-
- AcpiDmDisassemble (NULL, Op, NumStatements);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDbDisassembleMethod
- *
- * PARAMETERS: Name - Name of control method
- *
- * RETURN: None
- *
- * DESCRIPTION: Display disassembled AML (ASL) starting from Op for the number
- * of statements specified.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDbDisassembleMethod (
- char *Name)
-{
- ACPI_STATUS Status;
- ACPI_PARSE_OBJECT *Op;
- ACPI_WALK_STATE *WalkState;
- ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_NAMESPACE_NODE *Method;
-
-
- Method = AcpiDbConvertToNode (Name);
- if (!Method)
- {
- return (AE_BAD_PARAMETER);
- }
-
- ObjDesc = Method->Object;
-
- Op = AcpiPsCreateScopeOp ();
- if (!Op)
- {
- return (AE_NO_MEMORY);
- }
-
- /* Create and initialize a new walk state */
-
- WalkState = AcpiDsCreateWalkState (0, Op, NULL, NULL);
- if (!WalkState)
- {
- return (AE_NO_MEMORY);
- }
-
- Status = AcpiDsInitAmlWalk (WalkState, Op, NULL,
- ObjDesc->Method.AmlStart,
- ObjDesc->Method.AmlLength, NULL, ACPI_IMODE_LOAD_PASS1);
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
-
- /* Parse the AML */
-
- WalkState->ParseFlags &= ~ACPI_PARSE_DELETE_TREE;
- WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE;
- Status = AcpiPsParseAml (WalkState);
-
- AcpiDmDisassemble (NULL, Op, 0);
- AcpiPsDeleteParseTree (Op);
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDbDumpNamespace
- *
- * PARAMETERS: StartArg - Node to begin namespace dump
- * DepthArg - Maximum tree depth to be dumped
- *
- * RETURN: None
- *
- * DESCRIPTION: Dump entire namespace or a subtree. Each node is displayed
- * with type and other information.
- *
- ******************************************************************************/
-
-void
-AcpiDbDumpNamespace (
- char *StartArg,
- char *DepthArg)
-{
- ACPI_HANDLE SubtreeEntry = AcpiGbl_RootNode;
- UINT32 MaxDepth = ACPI_UINT32_MAX;
-
-
- /* No argument given, just start at the root and dump entire namespace */
-
- if (StartArg)
- {
- SubtreeEntry = AcpiDbConvertToNode (StartArg);
- if (!SubtreeEntry)
- {
- return;
- }
-
- /* Now we can check for the depth argument */
-
- if (DepthArg)
- {
- MaxDepth = ACPI_STRTOUL (DepthArg, NULL, 0);
- }
- }
-
- AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
- AcpiOsPrintf ("ACPI Namespace (from %4.4s (%p) subtree):\n",
- ((ACPI_NAMESPACE_NODE *) SubtreeEntry)->Name.Ascii, SubtreeEntry);
-
- /* Display the subtree */
-
- AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
- AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, MaxDepth,
- ACPI_OWNER_ID_MAX, SubtreeEntry);
- AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDbDumpNamespaceByOwner
- *
- * PARAMETERS: OwnerArg - Owner ID whose nodes will be displayed
- * DepthArg - Maximum tree depth to be dumped
- *
- * RETURN: None
- *
- * DESCRIPTION: Dump elements of the namespace that are owned by the OwnerId.
- *
- ******************************************************************************/
-
-void
-AcpiDbDumpNamespaceByOwner (
- char *OwnerArg,
- char *DepthArg)
-{
- ACPI_HANDLE SubtreeEntry = AcpiGbl_RootNode;
- UINT32 MaxDepth = ACPI_UINT32_MAX;
- ACPI_OWNER_ID OwnerId;
-
-
- OwnerId = (ACPI_OWNER_ID) ACPI_STRTOUL (OwnerArg, NULL, 0);
-
- /* Now we can check for the depth argument */
-
- if (DepthArg)
- {
- MaxDepth = ACPI_STRTOUL (DepthArg, NULL, 0);
- }
-
- AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
- AcpiOsPrintf ("ACPI Namespace by owner %X:\n", OwnerId);
-
- /* Display the subtree */
-
- AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
- AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, MaxDepth, OwnerId,
- SubtreeEntry);
- AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: AcpiDbSendNotify
*
* PARAMETERS: Name - Name of ACPI object to send the notify to
@@ -1021,245 +364,6 @@ AcpiDbSendNotify (
/*******************************************************************************
*
- * FUNCTION: AcpiDbSetMethodData
- *
- * PARAMETERS: TypeArg - L for local, A for argument
- * IndexArg - which one
- * ValueArg - Value to set.
- *
- * RETURN: None
- *
- * DESCRIPTION: Set a local or argument for the running control method.
- * NOTE: only object supported is Number.
- *
- ******************************************************************************/
-
-void
-AcpiDbSetMethodData (
- char *TypeArg,
- char *IndexArg,
- char *ValueArg)
-{
- char Type;
- UINT32 Index;
- UINT32 Value;
- ACPI_WALK_STATE *WalkState;
- ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_STATUS Status;
- ACPI_NAMESPACE_NODE *Node;
-
-
- /* Validate TypeArg */
-
- AcpiUtStrupr (TypeArg);
- Type = TypeArg[0];
- if ((Type != 'L') &&
- (Type != 'A') &&
- (Type != 'N'))
- {
- AcpiOsPrintf ("Invalid SET operand: %s\n", TypeArg);
- return;
- }
-
- Value = ACPI_STRTOUL (ValueArg, NULL, 16);
-
- if (Type == 'N')
- {
- Node = AcpiDbConvertToNode (IndexArg);
- if (Node->Type != ACPI_TYPE_INTEGER)
- {
- AcpiOsPrintf ("Can only set Integer nodes\n");
- return;
- }
- ObjDesc = Node->Object;
- ObjDesc->Integer.Value = Value;
- return;
- }
-
- /* Get the index and value */
-
- Index = ACPI_STRTOUL (IndexArg, NULL, 16);
-
- WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
- if (!WalkState)
- {
- AcpiOsPrintf ("There is no method currently executing\n");
- return;
- }
-
- /* Create and initialize the new object */
-
- ObjDesc = AcpiUtCreateIntegerObject ((UINT64) Value);
- if (!ObjDesc)
- {
- AcpiOsPrintf ("Could not create an internal object\n");
- return;
- }
-
- /* Store the new object into the target */
-
- switch (Type)
- {
- case 'A':
-
- /* Set a method argument */
-
- if (Index > ACPI_METHOD_MAX_ARG)
- {
- AcpiOsPrintf ("Arg%u - Invalid argument name\n", Index);
- goto Cleanup;
- }
-
- Status = AcpiDsStoreObjectToLocal (ACPI_REFCLASS_ARG, Index, ObjDesc,
- WalkState);
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
-
- ObjDesc = WalkState->Arguments[Index].Object;
-
- AcpiOsPrintf ("Arg%u: ", Index);
- AcpiDmDisplayInternalObject (ObjDesc, WalkState);
- break;
-
- case 'L':
-
- /* Set a method local */
-
- if (Index > ACPI_METHOD_MAX_LOCAL)
- {
- AcpiOsPrintf ("Local%u - Invalid local variable name\n", Index);
- goto Cleanup;
- }
-
- Status = AcpiDsStoreObjectToLocal (ACPI_REFCLASS_LOCAL, Index, ObjDesc,
- WalkState);
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
-
- ObjDesc = WalkState->LocalVariables[Index].Object;
-
- AcpiOsPrintf ("Local%u: ", Index);
- AcpiDmDisplayInternalObject (ObjDesc, WalkState);
- break;
-
- default:
- break;
- }
-
-Cleanup:
- AcpiUtRemoveReference (ObjDesc);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDbWalkForSpecificObjects
- *
- * PARAMETERS: Callback from WalkNamespace
- *
- * RETURN: Status
- *
- * DESCRIPTION: Display short info about objects in the namespace
- *
- ******************************************************************************/
-
-static ACPI_STATUS
-AcpiDbWalkForSpecificObjects (
- ACPI_HANDLE ObjHandle,
- UINT32 NestingLevel,
- void *Context,
- void **ReturnValue)
-{
- ACPI_WALK_INFO *Info = (ACPI_WALK_INFO *) Context;
- ACPI_BUFFER Buffer;
- ACPI_STATUS Status;
-
-
- Info->Count++;
-
- /* Get and display the full pathname to this object */
-
- Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
- Status = AcpiNsHandleToPathname (ObjHandle, &Buffer);
- if (ACPI_FAILURE (Status))
- {
- AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle);
- return (AE_OK);
- }
-
- AcpiOsPrintf ("%32s", (char *) Buffer.Pointer);
- ACPI_FREE (Buffer.Pointer);
-
- /* Dump short info about the object */
-
- (void) AcpiNsDumpOneObject (ObjHandle, NestingLevel, Info, NULL);
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDbDisplayObjects
- *
- * PARAMETERS: ObjTypeArg - Type of object to display
- * DisplayCountArg - Max depth to display
- *
- * RETURN: None
- *
- * DESCRIPTION: Display objects in the namespace of the requested type
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDbDisplayObjects (
- char *ObjTypeArg,
- char *DisplayCountArg)
-{
- ACPI_WALK_INFO Info;
- ACPI_OBJECT_TYPE Type;
-
-
- /* Get the object type */
-
- Type = AcpiDbMatchArgument (ObjTypeArg, AcpiDbObjectTypes);
- if (Type == ACPI_TYPE_NOT_FOUND)
- {
- AcpiOsPrintf ("Invalid or unsupported argument\n");
- return (AE_OK);
- }
-
- AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
- AcpiOsPrintf (
- "Objects of type [%s] defined in the current ACPI Namespace:\n",
- AcpiUtGetTypeName (Type));
-
- AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
-
- Info.Count = 0;
- Info.OwnerId = ACPI_OWNER_ID_MAX;
- Info.DebugLevel = ACPI_UINT32_MAX;
- Info.DisplayType = ACPI_DISPLAY_SUMMARY | ACPI_DISPLAY_SHORT;
-
- /* Walk the namespace from the root */
-
- (void) AcpiWalkNamespace (Type, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
- AcpiDbWalkForSpecificObjects, NULL, (void *) &Info, NULL);
-
- AcpiOsPrintf (
- "\nFound %u objects of type [%s] in the current ACPI Namespace\n",
- Info.Count, AcpiUtGetTypeName (Type));
-
- AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: AcpiDbDisplayInterfaces
*
* PARAMETERS: ActionArg - Null, "install", or "remove"
@@ -1352,187 +456,6 @@ AcpiDbDisplayInterfaces (
/*******************************************************************************
*
- * FUNCTION: AcpiDbWalkAndMatchName
- *
- * PARAMETERS: Callback from WalkNamespace
- *
- * RETURN: Status
- *
- * DESCRIPTION: Find a particular name/names within the namespace. Wildcards
- * are supported -- '?' matches any character.
- *
- ******************************************************************************/
-
-static ACPI_STATUS
-AcpiDbWalkAndMatchName (
- ACPI_HANDLE ObjHandle,
- UINT32 NestingLevel,
- void *Context,
- void **ReturnValue)
-{
- ACPI_STATUS Status;
- char *RequestedName = (char *) Context;
- UINT32 i;
- ACPI_BUFFER Buffer;
- ACPI_WALK_INFO Info;
-
-
- /* Check for a name match */
-
- for (i = 0; i < 4; i++)
- {
- /* Wildcard support */
-
- if ((RequestedName[i] != '?') &&
- (RequestedName[i] != ((ACPI_NAMESPACE_NODE *) ObjHandle)->Name.Ascii[i]))
- {
- /* No match, just exit */
-
- return (AE_OK);
- }
- }
-
- /* Get the full pathname to this object */
-
- Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
- Status = AcpiNsHandleToPathname (ObjHandle, &Buffer);
- if (ACPI_FAILURE (Status))
- {
- AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle);
- }
- else
- {
- Info.OwnerId = ACPI_OWNER_ID_MAX;
- Info.DebugLevel = ACPI_UINT32_MAX;
- Info.DisplayType = ACPI_DISPLAY_SUMMARY | ACPI_DISPLAY_SHORT;
-
- AcpiOsPrintf ("%32s", (char *) Buffer.Pointer);
- (void) AcpiNsDumpOneObject (ObjHandle, NestingLevel, &Info, NULL);
- ACPI_FREE (Buffer.Pointer);
- }
-
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDbFindNameInNamespace
- *
- * PARAMETERS: NameArg - The 4-character ACPI name to find.
- * wildcards are supported.
- *
- * RETURN: None
- *
- * DESCRIPTION: Search the namespace for a given name (with wildcards)
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDbFindNameInNamespace (
- char *NameArg)
-{
- char AcpiName[5] = "____";
- char *AcpiNamePtr = AcpiName;
-
-
- if (ACPI_STRLEN (NameArg) > 4)
- {
- AcpiOsPrintf ("Name must be no longer than 4 characters\n");
- return (AE_OK);
- }
-
- /* Pad out name with underscores as necessary to create a 4-char name */
-
- AcpiUtStrupr (NameArg);
- while (*NameArg)
- {
- *AcpiNamePtr = *NameArg;
- AcpiNamePtr++;
- NameArg++;
- }
-
- /* Walk the namespace from the root */
-
- (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
- AcpiDbWalkAndMatchName, NULL, AcpiName, NULL);
-
- AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDbSetScope
- *
- * PARAMETERS: Name - New scope path
- *
- * RETURN: Status
- *
- * DESCRIPTION: Set the "current scope" as maintained by this utility.
- * The scope is used as a prefix to ACPI paths.
- *
- ******************************************************************************/
-
-void
-AcpiDbSetScope (
- char *Name)
-{
- ACPI_STATUS Status;
- ACPI_NAMESPACE_NODE *Node;
-
-
- if (!Name || Name[0] == 0)
- {
- AcpiOsPrintf ("Current scope: %s\n", AcpiGbl_DbScopeBuf);
- return;
- }
-
- AcpiDbPrepNamestring (Name);
-
- if (Name[0] == '\\')
- {
- /* Validate new scope from the root */
-
- Status = AcpiNsGetNode (AcpiGbl_RootNode, Name, ACPI_NS_NO_UPSEARCH,
- &Node);
- if (ACPI_FAILURE (Status))
- {
- goto ErrorExit;
- }
-
- ACPI_STRCPY (AcpiGbl_DbScopeBuf, Name);
- ACPI_STRCAT (AcpiGbl_DbScopeBuf, "\\");
- }
- else
- {
- /* Validate new scope relative to old scope */
-
- Status = AcpiNsGetNode (AcpiGbl_DbScopeNode, Name, ACPI_NS_NO_UPSEARCH,
- &Node);
- if (ACPI_FAILURE (Status))
- {
- goto ErrorExit;
- }
-
- ACPI_STRCAT (AcpiGbl_DbScopeBuf, Name);
- ACPI_STRCAT (AcpiGbl_DbScopeBuf, "\\");
- }
-
- AcpiGbl_DbScopeNode = Node;
- AcpiOsPrintf ("New scope: %s\n", AcpiGbl_DbScopeBuf);
- return;
-
-ErrorExit:
-
- AcpiOsPrintf ("Could not attach scope: %s, %s\n",
- Name, AcpiFormatException (Status));
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: AcpiDmCompareAmlResources
*
* PARAMETERS: Aml1Buffer - Contains first resource list
@@ -1859,112 +782,6 @@ Cleanup:
/*******************************************************************************
*
- * FUNCTION: AcpiDbIntegrityWalk
- *
- * PARAMETERS: Callback from WalkNamespace
- *
- * RETURN: Status
- *
- * DESCRIPTION: Examine one NS node for valid values.
- *
- ******************************************************************************/
-
-static ACPI_STATUS
-AcpiDbIntegrityWalk (
- ACPI_HANDLE ObjHandle,
- UINT32 NestingLevel,
- void *Context,
- void **ReturnValue)
-{
- ACPI_INTEGRITY_INFO *Info = (ACPI_INTEGRITY_INFO *) Context;
- ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
- ACPI_OPERAND_OBJECT *Object;
- BOOLEAN Alias = TRUE;
-
-
- Info->Nodes++;
-
- /* Verify the NS node, and dereference aliases */
-
- while (Alias)
- {
- if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED)
- {
- AcpiOsPrintf ("Invalid Descriptor Type for Node %p [%s] - is %2.2X should be %2.2X\n",
- Node, AcpiUtGetDescriptorName (Node), ACPI_GET_DESCRIPTOR_TYPE (Node),
- ACPI_DESC_TYPE_NAMED);
- return (AE_OK);
- }
-
- if ((Node->Type == ACPI_TYPE_LOCAL_ALIAS) ||
- (Node->Type == ACPI_TYPE_LOCAL_METHOD_ALIAS))
- {
- Node = (ACPI_NAMESPACE_NODE *) Node->Object;
- }
- else
- {
- Alias = FALSE;
- }
- }
-
- if (Node->Type > ACPI_TYPE_LOCAL_MAX)
- {
- AcpiOsPrintf ("Invalid Object Type for Node %p, Type = %X\n",
- Node, Node->Type);
- return (AE_OK);
- }
-
- if (!AcpiUtValidAcpiName (Node->Name.Integer))
- {
- AcpiOsPrintf ("Invalid AcpiName for Node %p\n", Node);
- return (AE_OK);
- }
-
- Object = AcpiNsGetAttachedObject (Node);
- if (Object)
- {
- Info->Objects++;
- if (ACPI_GET_DESCRIPTOR_TYPE (Object) != ACPI_DESC_TYPE_OPERAND)
- {
- AcpiOsPrintf ("Invalid Descriptor Type for Object %p [%s]\n",
- Object, AcpiUtGetDescriptorName (Object));
- }
- }
-
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDbCheckIntegrity
- *
- * PARAMETERS: None
- *
- * RETURN: None
- *
- * DESCRIPTION: Check entire namespace for data structure integrity
- *
- ******************************************************************************/
-
-void
-AcpiDbCheckIntegrity (
- void)
-{
- ACPI_INTEGRITY_INFO Info = {0,0};
-
- /* Search all nodes in namespace */
-
- (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
- AcpiDbIntegrityWalk, NULL, (void *) &Info, NULL);
-
- AcpiOsPrintf ("Verified %u namespace nodes with %u Objects\n",
- Info.Nodes, Info.Objects);
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: AcpiDbGenerateGpe
*
* PARAMETERS: GpeArg - Raw GPE number, ascii string
@@ -2002,148 +819,4 @@ AcpiDbGenerateGpe (
(void) AcpiEvGpeDispatch (NULL, GpeEventInfo, GpeNumber);
}
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDbBusWalk
- *
- * PARAMETERS: Callback from WalkNamespace
- *
- * RETURN: Status
- *
- * DESCRIPTION: Display info about device objects that have a corresponding
- * _PRT method.
- *
- ******************************************************************************/
-
-static ACPI_STATUS
-AcpiDbBusWalk (
- ACPI_HANDLE ObjHandle,
- UINT32 NestingLevel,
- void *Context,
- void **ReturnValue)
-{
- ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
- ACPI_STATUS Status;
- ACPI_BUFFER Buffer;
- ACPI_NAMESPACE_NODE *TempNode;
- ACPI_DEVICE_INFO *Info;
- UINT32 i;
-
-
- if ((Node->Type != ACPI_TYPE_DEVICE) &&
- (Node->Type != ACPI_TYPE_PROCESSOR))
- {
- return (AE_OK);
- }
-
- /* Exit if there is no _PRT under this device */
-
- Status = AcpiGetHandle (Node, METHOD_NAME__PRT,
- ACPI_CAST_PTR (ACPI_HANDLE, &TempNode));
- if (ACPI_FAILURE (Status))
- {
- return (AE_OK);
- }
-
- /* Get the full path to this device object */
-
- Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
- Status = AcpiNsHandleToPathname (ObjHandle, &Buffer);
- if (ACPI_FAILURE (Status))
- {
- AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle);
- return (AE_OK);
- }
-
- Status = AcpiGetObjectInfo (ObjHandle, &Info);
- if (ACPI_FAILURE (Status))
- {
- return (AE_OK);
- }
-
- /* Display the full path */
-
- AcpiOsPrintf ("%-32s Type %X", (char *) Buffer.Pointer, Node->Type);
- ACPI_FREE (Buffer.Pointer);
-
- if (Info->Flags & ACPI_PCI_ROOT_BRIDGE)
- {
- AcpiOsPrintf (" - Is PCI Root Bridge");
- }
- AcpiOsPrintf ("\n");
-
- /* _PRT info */
-
- AcpiOsPrintf ("_PRT: %p\n", TempNode);
-
- /* Dump _ADR, _HID, _UID, _CID */
-
- if (Info->Valid & ACPI_VALID_ADR)
- {
- AcpiOsPrintf ("_ADR: %8.8X%8.8X\n", ACPI_FORMAT_UINT64 (Info->Address));
- }
- else
- {
- AcpiOsPrintf ("_ADR: <Not Present>\n");
- }
-
- if (Info->Valid & ACPI_VALID_HID)
- {
- AcpiOsPrintf ("_HID: %s\n", Info->HardwareId.String);
- }
- else
- {
- AcpiOsPrintf ("_HID: <Not Present>\n");
- }
-
- if (Info->Valid & ACPI_VALID_UID)
- {
- AcpiOsPrintf ("_UID: %s\n", Info->UniqueId.String);
- }
- else
- {
- AcpiOsPrintf ("_UID: <Not Present>\n");
- }
-
- if (Info->Valid & ACPI_VALID_CID)
- {
- for (i = 0; i < Info->CompatibleIdList.Count; i++)
- {
- AcpiOsPrintf ("_CID: %s\n",
- Info->CompatibleIdList.Ids[i].String);
- }
- }
- else
- {
- AcpiOsPrintf ("_CID: <Not Present>\n");
- }
-
- ACPI_FREE (Info);
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDbGetBusInfo
- *
- * PARAMETERS: None
- *
- * RETURN: None
- *
- * DESCRIPTION: Display info about system busses.
- *
- ******************************************************************************/
-
-void
-AcpiDbGetBusInfo (
- void)
-{
- /* Search all nodes in namespace */
-
- (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
- AcpiDbBusWalk, NULL, NULL, NULL);
-}
-
#endif /* ACPI_DEBUGGER */
diff --git a/debugger/dbdisply.c b/debugger/dbdisply.c
index 72de597a7791..bb5cccb7c9d5 100644
--- a/debugger/dbdisply.c
+++ b/debugger/dbdisply.c
@@ -887,5 +887,140 @@ AcpiDbDisplayGpes (
}
}
-#endif /* ACPI_DEBUGGER */
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbDisplayHandlers
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display the currently installed global handlers
+ *
+ ******************************************************************************/
+
+#define ACPI_PREDEFINED_PREFIX "%25s (%.2X) : "
+#define ACPI_HANDLER_NAME_STRING "%30s : "
+#define ACPI_HANDLER_PRESENT_STRING "%-9s (%p)\n"
+#define ACPI_HANDLER_NOT_PRESENT_STRING "%-9s\n"
+
+/* All predefined Space IDs */
+
+static ACPI_ADR_SPACE_TYPE SpaceIdList[] =
+{
+ ACPI_ADR_SPACE_SYSTEM_MEMORY,
+ ACPI_ADR_SPACE_SYSTEM_IO,
+ ACPI_ADR_SPACE_PCI_CONFIG,
+ ACPI_ADR_SPACE_EC,
+ ACPI_ADR_SPACE_SMBUS,
+ ACPI_ADR_SPACE_CMOS,
+ ACPI_ADR_SPACE_PCI_BAR_TARGET,
+ ACPI_ADR_SPACE_IPMI,
+ ACPI_ADR_SPACE_DATA_TABLE,
+ ACPI_ADR_SPACE_FIXED_HARDWARE
+};
+
+/* Global handler information */
+
+typedef struct acpi_handler_info
+{
+ void *Handler;
+ char *Name;
+
+} ACPI_HANDLER_INFO;
+
+ACPI_HANDLER_INFO HandlerList[] =
+{
+ {&AcpiGbl_SystemNotify.Handler, "System Notifications"},
+ {&AcpiGbl_DeviceNotify.Handler, "Device Notifications"},
+ {&AcpiGbl_TableHandler, "ACPI Table Events"},
+ {&AcpiGbl_ExceptionHandler, "Control Method Exceptions"},
+ {&AcpiGbl_InterfaceHandler, "OSI Invocations"}
+};
+
+
+void
+AcpiDbDisplayHandlers (
+ void)
+{
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_OPERAND_OBJECT *HandlerObj;
+ ACPI_ADR_SPACE_TYPE SpaceId;
+ UINT32 i;
+
+
+ /* Operation region handlers */
+
+ AcpiOsPrintf ("\nOperation Region Handlers:\n");
+
+ ObjDesc = AcpiNsGetAttachedObject (AcpiGbl_RootNode);
+ if (ObjDesc)
+ {
+ for (i = 0; i < ACPI_ARRAY_LENGTH (SpaceIdList); i++)
+ {
+ SpaceId = SpaceIdList[i];
+ HandlerObj = ObjDesc->Device.Handler;
+ AcpiOsPrintf (ACPI_PREDEFINED_PREFIX,
+ AcpiUtGetRegionName ((UINT8) SpaceId), SpaceId);
+
+ while (HandlerObj)
+ {
+ if (i == HandlerObj->AddressSpace.SpaceId)
+ {
+ AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING,
+ (HandlerObj->AddressSpace.HandlerFlags &
+ ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? "Default" : "User",
+ HandlerObj->AddressSpace.Handler);
+ goto FoundHandler;
+ }
+
+ HandlerObj = HandlerObj->AddressSpace.Next;
+ }
+
+ /* There is no handler for this SpaceId */
+
+ AcpiOsPrintf ("None\n");
+
+ FoundHandler:;
+ }
+ }
+
+ /* Fixed event handlers */
+
+ AcpiOsPrintf ("\nFixed Event Handlers:\n");
+
+ for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++)
+ {
+ AcpiOsPrintf (ACPI_PREDEFINED_PREFIX, AcpiUtGetEventName (i), i);
+ if (AcpiGbl_FixedEventHandlers[i].Handler)
+ {
+ AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, "User",
+ AcpiGbl_FixedEventHandlers[i].Handler);
+ }
+ else
+ {
+ AcpiOsPrintf (ACPI_HANDLER_NOT_PRESENT_STRING, "None");
+ }
+ }
+
+ /* Miscellaneous global handlers */
+
+ AcpiOsPrintf ("\nMiscellaneous Global Handlers:\n");
+
+ for (i = 0; i < ACPI_ARRAY_LENGTH (HandlerList); i++)
+ {
+ AcpiOsPrintf (ACPI_HANDLER_NAME_STRING, HandlerList[i].Name);
+ if (HandlerList[i].Handler)
+ {
+ AcpiOsPrintf (ACPI_HANDLER_PRESENT_STRING, "User",
+ HandlerList[i].Handler);
+ }
+ else
+ {
+ AcpiOsPrintf (ACPI_HANDLER_NOT_PRESENT_STRING, "None");
+ }
+ }
+}
+
+#endif /* ACPI_DEBUGGER */
diff --git a/debugger/dbinput.c b/debugger/dbinput.c
index ea9ef18388d9..dffa531ceea3 100644
--- a/debugger/dbinput.c
+++ b/debugger/dbinput.c
@@ -73,7 +73,7 @@ AcpiDbSingleThread (
static void
AcpiDbDisplayHelp (
- char *HelpType);
+ void);
/*
@@ -104,6 +104,7 @@ enum AcpiExDebuggerCommands
CMD_GO,
CMD_GPE,
CMD_GPES,
+ CMD_HANDLERS,
CMD_HELP,
CMD_HELP2,
CMD_HISTORY,
@@ -171,6 +172,7 @@ static const COMMAND_INFO AcpiGbl_DbCommands[] =
{"GO", 0},
{"GPE", 2},
{"GPES", 0},
+ {"HANDLERS", 0},
{"HELP", 0},
{"?", 0},
{"HISTORY", 0},
@@ -216,7 +218,7 @@ static const COMMAND_INFO AcpiGbl_DbCommands[] =
*
* FUNCTION: AcpiDbDisplayHelp
*
- * PARAMETERS: HelpType - Subcommand (optional)
+ * PARAMETERS: None
*
* RETURN: None
*
@@ -226,120 +228,80 @@ static const COMMAND_INFO AcpiGbl_DbCommands[] =
static void
AcpiDbDisplayHelp (
- char *HelpType)
+ void)
{
- AcpiUtStrupr (HelpType);
-
- /* No parameter, just give the overview */
-
- if (!HelpType)
- {
- AcpiOsPrintf ("ACPI CA Debugger Commands\n\n");
- AcpiOsPrintf ("The following classes of commands are available. Help is available for\n");
- AcpiOsPrintf ("each class by entering \"Help <ClassName>\"\n\n");
- AcpiOsPrintf (" [GENERAL] General-Purpose Commands\n");
- AcpiOsPrintf (" [NAMESPACE] Namespace Access Commands\n");
- AcpiOsPrintf (" [METHOD] Control Method Execution Commands\n");
- AcpiOsPrintf (" [STATISTICS] Statistical Information\n");
- AcpiOsPrintf (" [FILE] File I/O Commands\n");
- return;
- }
-
- /*
- * Parameter is the command class
- *
- * The idea here is to keep each class of commands smaller than a screenful
- */
- switch (HelpType[0])
- {
- case 'G':
- AcpiOsPrintf ("\nGeneral-Purpose Commands\n\n");
- AcpiOsPrintf ("Allocations Display list of current memory allocations\n");
- AcpiOsPrintf ("Dump <Address>|<Namepath>\n");
- AcpiOsPrintf (" [Byte|Word|Dword|Qword] Display ACPI objects or memory\n");
- AcpiOsPrintf ("EnableAcpi Enable ACPI (hardware) mode\n");
- AcpiOsPrintf ("Help This help screen\n");
- AcpiOsPrintf ("History Display command history buffer\n");
- AcpiOsPrintf ("Level [<DebugLevel>] [console] Get/Set debug level for file or console\n");
- AcpiOsPrintf ("Locks Current status of internal mutexes\n");
- AcpiOsPrintf ("Osi [Install|Remove <name>] Display or modify global _OSI list\n");
- AcpiOsPrintf ("Quit or Exit Exit this command\n");
- AcpiOsPrintf ("Stats [Allocations|Memory|Misc\n");
- AcpiOsPrintf (" |Objects|Sizes|Stack|Tables] Display namespace and memory statistics\n");
- AcpiOsPrintf ("Tables Display info about loaded ACPI tables\n");
- AcpiOsPrintf ("Unload <TableSig> [Instance] Unload an ACPI table\n");
- AcpiOsPrintf ("! <CommandNumber> Execute command from history buffer\n");
- AcpiOsPrintf ("!! Execute last command again\n");
- return;
-
- case 'S':
- AcpiOsPrintf ("\nStats Subcommands\n\n");
- AcpiOsPrintf ("Allocations Display list of current memory allocations\n");
- AcpiOsPrintf ("Memory Dump internal memory lists\n");
- AcpiOsPrintf ("Misc Namespace search and mutex stats\n");
- AcpiOsPrintf ("Objects Summary of namespace objects\n");
- AcpiOsPrintf ("Sizes Sizes for each of the internal objects\n");
- AcpiOsPrintf ("Stack Display CPU stack usage\n");
- AcpiOsPrintf ("Tables Info about current ACPI table(s)\n");
- return;
-
- case 'N':
- AcpiOsPrintf ("\nNamespace Access Commands\n\n");
- AcpiOsPrintf ("Businfo Display system bus info\n");
- AcpiOsPrintf ("Disassemble <Method> Disassemble a control method\n");
- AcpiOsPrintf ("Event <F|G> <Value> Generate AcpiEvent (Fixed/GPE)\n");
- AcpiOsPrintf ("Find <AcpiName> (? is wildcard) Find ACPI name(s) with wildcards\n");
- AcpiOsPrintf ("Gpe <GpeNum> <GpeBlock> Simulate a GPE\n");
- AcpiOsPrintf ("Gpes Display info on all GPEs\n");
- AcpiOsPrintf ("Integrity Validate namespace integrity\n");
- AcpiOsPrintf ("Methods Display list of loaded control methods\n");
- AcpiOsPrintf ("Namespace [Object] [Depth] Display loaded namespace tree/subtree\n");
- AcpiOsPrintf ("Notify <Object> <Value> Send a notification on Object\n");
- AcpiOsPrintf ("Objects <ObjectType> Display all objects of the given type\n");
- AcpiOsPrintf ("Owner <OwnerId> [Depth] Display loaded namespace by object owner\n");
- AcpiOsPrintf ("Predefined Check all predefined names\n");
- AcpiOsPrintf ("Prefix [<NamePath>] Set or Get current execution prefix\n");
- AcpiOsPrintf ("References <Addr> Find all references to object at addr\n");
- AcpiOsPrintf ("Resources <Device> Get and display Device resources\n");
- 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 ("Type <Object> Display object type\n");
- return;
-
- case 'M':
- AcpiOsPrintf ("\nControl Method Execution Commands\n\n");
- AcpiOsPrintf ("Arguments (or Args) Display method arguments\n");
- AcpiOsPrintf ("Breakpoint <AmlOffset> Set an AML execution breakpoint\n");
- AcpiOsPrintf ("Call Run to next control method invocation\n");
- AcpiOsPrintf ("Debug <Namepath> [Arguments] Single Step a control method\n");
- AcpiOsPrintf ("Execute <Namepath> [Arguments] Execute control method\n");
- AcpiOsPrintf ("Go Allow method to run to completion\n");
- AcpiOsPrintf ("Information Display info about the current method\n");
- AcpiOsPrintf ("Into Step into (not over) a method call\n");
- AcpiOsPrintf ("List [# of Aml Opcodes] Display method ASL statements\n");
- AcpiOsPrintf ("Locals Display method local variables\n");
- 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");
- return;
-
- case 'F':
- AcpiOsPrintf ("\nFile I/O Commands\n\n");
- AcpiOsPrintf ("Close Close debug output file\n");
- AcpiOsPrintf ("Open <Output Filename> Open a file for debug output\n");
- AcpiOsPrintf ("Load <Input Filename> Load ACPI table from a file\n");
- return;
-
- default:
- AcpiOsPrintf ("Unrecognized Command Class: %s\n", HelpType);
- return;
- }
+ AcpiOsPrintf ("\nGeneral-Purpose Commands:\n");
+ AcpiOsPrintf (" Allocations Display list of current memory allocations\n");
+ AcpiOsPrintf (" Dump <Address>|<Namepath>\n");
+ AcpiOsPrintf (" [Byte|Word|Dword|Qword] Display ACPI objects or memory\n");
+ AcpiOsPrintf (" EnableAcpi Enable ACPI (hardware) mode\n");
+ AcpiOsPrintf (" Handlers Info about global handlers\n");
+ AcpiOsPrintf (" Help This help screen\n");
+ AcpiOsPrintf (" History Display command history buffer\n");
+ AcpiOsPrintf (" Level [<DebugLevel>] [console] Get/Set debug level for file or console\n");
+ AcpiOsPrintf (" Locks Current status of internal mutexes\n");
+ AcpiOsPrintf (" Osi [Install|Remove <name>] Display or modify global _OSI list\n");
+ AcpiOsPrintf (" Quit or Exit Exit this command\n");
+ AcpiOsPrintf (" Stats [Allocations|Memory|Misc|\n");
+ AcpiOsPrintf (" Objects|Sizes|Stack|Tables] Display namespace and memory statistics\n");
+ AcpiOsPrintf (" Allocations Display list of current memory allocations\n");
+ AcpiOsPrintf (" Memory Dump internal memory lists\n");
+ AcpiOsPrintf (" Misc Namespace search and mutex stats\n");
+ AcpiOsPrintf (" Objects Summary of namespace objects\n");
+ AcpiOsPrintf (" Sizes Sizes for each of the internal objects\n");
+ AcpiOsPrintf (" Stack Display CPU stack usage\n");
+ AcpiOsPrintf (" Tables Info about current ACPI table(s)\n");
+ AcpiOsPrintf (" Tables Display info about loaded ACPI tables\n");
+ AcpiOsPrintf (" Unload <TableSig> [Instance] Unload an ACPI table\n");
+ AcpiOsPrintf (" ! <CommandNumber> Execute command from history buffer\n");
+ AcpiOsPrintf (" !! Execute last command again\n");
+
+ AcpiOsPrintf ("\nNamespace Access Commands:\n");
+ AcpiOsPrintf (" Businfo Display system bus info\n");
+ AcpiOsPrintf (" Disassemble <Method> Disassemble a control method\n");
+ AcpiOsPrintf (" Event <F|G> <Value> Generate AcpiEvent (Fixed/GPE)\n");
+ AcpiOsPrintf (" Find <AcpiName> (? is wildcard) Find ACPI name(s) with wildcards\n");
+ AcpiOsPrintf (" Gpe <GpeNum> <GpeBlock> Simulate a GPE\n");
+ AcpiOsPrintf (" Gpes Display info on all GPEs\n");
+ AcpiOsPrintf (" Integrity Validate namespace integrity\n");
+ AcpiOsPrintf (" Methods Display list of loaded control methods\n");
+ AcpiOsPrintf (" Namespace [Object] [Depth] Display loaded namespace tree/subtree\n");
+ AcpiOsPrintf (" Notify <Object> <Value> Send a notification on Object\n");
+ AcpiOsPrintf (" Objects <ObjectType> Display all objects of the given type\n");
+ AcpiOsPrintf (" Owner <OwnerId> [Depth] Display loaded namespace by object owner\n");
+ AcpiOsPrintf (" Predefined Check all predefined names\n");
+ AcpiOsPrintf (" Prefix [<NamePath>] Set or Get current execution prefix\n");
+ AcpiOsPrintf (" References <Addr> Find all references to object at addr\n");
+ AcpiOsPrintf (" Resources <Device> Get and display Device resources\n");
+ 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 (" Type <Object> Display object type\n");
+
+ AcpiOsPrintf ("\nControl Method Execution Commands:\n");
+ AcpiOsPrintf (" Arguments (or Args) Display method arguments\n");
+ AcpiOsPrintf (" Breakpoint <AmlOffset> Set an AML execution breakpoint\n");
+ AcpiOsPrintf (" Call Run to next control method invocation\n");
+ AcpiOsPrintf (" Debug <Namepath> [Arguments] Single Step a control method\n");
+ AcpiOsPrintf (" Execute <Namepath> [Arguments] Execute control method\n");
+ AcpiOsPrintf (" Go Allow method to run to completion\n");
+ AcpiOsPrintf (" Information Display info about the current method\n");
+ AcpiOsPrintf (" Into Step into (not over) a method call\n");
+ AcpiOsPrintf (" List [# of Aml Opcodes] Display method ASL statements\n");
+ AcpiOsPrintf (" Locals Display method local variables\n");
+ 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");
+
+ AcpiOsPrintf ("\nFile I/O Commands:\n");
+ AcpiOsPrintf (" Close Close debug output file\n");
+ AcpiOsPrintf (" Load <Input Filename> Load ACPI table from a file\n");
+ AcpiOsPrintf (" Open <Output Filename> Open a file for debug output\n");
}
@@ -658,9 +620,13 @@ AcpiDbCommandDispatch (
AcpiDbDisplayGpes ();
break;
+ case CMD_HANDLERS:
+ AcpiDbDisplayHandlers ();
+ break;
+
case CMD_HELP:
case CMD_HELP2:
- AcpiDbDisplayHelp (AcpiGbl_DbArgs[1]);
+ AcpiDbDisplayHelp ();
break;
case CMD_HISTORY:
diff --git a/debugger/dbmethod.c b/debugger/dbmethod.c
new file mode 100644
index 000000000000..f0b88ebdb32f
--- /dev/null
+++ b/debugger/dbmethod.c
@@ -0,0 +1,525 @@
+/*******************************************************************************
+ *
+ * Module Name: dbmethod - Debug commands for control methods
+ *
+ ******************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2011, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * substantially similar to the "NO WARRANTY" disclaimer below
+ * ("Disclaimer") and any redistribution must be conditioned upon
+ * including a substantially similar Disclaimer requirement for further
+ * binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ * of any contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+
+#include "acpi.h"
+#include "accommon.h"
+#include "acdispat.h"
+#include "acnamesp.h"
+#include "acdebug.h"
+#include "acdisasm.h"
+#include "acparser.h"
+
+
+#ifdef ACPI_DEBUGGER
+
+#define _COMPONENT ACPI_CA_DEBUGGER
+ ACPI_MODULE_NAME ("dbmethod")
+
+
+/* Local prototypes */
+
+static ACPI_STATUS
+AcpiDbWalkForExecute (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue);
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbSetMethodBreakpoint
+ *
+ * PARAMETERS: Location - AML offset of breakpoint
+ * WalkState - Current walk info
+ * Op - Current Op (from parse walk)
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Set a breakpoint in a control method at the specified
+ * AML offset
+ *
+ ******************************************************************************/
+
+void
+AcpiDbSetMethodBreakpoint (
+ char *Location,
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op)
+{
+ UINT32 Address;
+
+
+ if (!Op)
+ {
+ AcpiOsPrintf ("There is no method currently executing\n");
+ return;
+ }
+
+ /* Get and verify the breakpoint address */
+
+ Address = ACPI_STRTOUL (Location, NULL, 16);
+ if (Address <= Op->Common.AmlOffset)
+ {
+ AcpiOsPrintf ("Breakpoint %X is beyond current address %X\n",
+ Address, Op->Common.AmlOffset);
+ }
+
+ /* Save breakpoint in current walk */
+
+ WalkState->UserBreakpoint = Address;
+ AcpiOsPrintf ("Breakpoint set at AML offset %X\n", Address);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbSetMethodCallBreakpoint
+ *
+ * PARAMETERS: Op - Current Op (from parse walk)
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Set a breakpoint in a control method at the specified
+ * AML offset
+ *
+ ******************************************************************************/
+
+void
+AcpiDbSetMethodCallBreakpoint (
+ ACPI_PARSE_OBJECT *Op)
+{
+
+
+ if (!Op)
+ {
+ AcpiOsPrintf ("There is no method currently executing\n");
+ return;
+ }
+
+ AcpiGbl_StepToNextCall = TRUE;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbSetMethodData
+ *
+ * PARAMETERS: TypeArg - L for local, A for argument
+ * IndexArg - which one
+ * ValueArg - Value to set.
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Set a local or argument for the running control method.
+ * NOTE: only object supported is Number.
+ *
+ ******************************************************************************/
+
+void
+AcpiDbSetMethodData (
+ char *TypeArg,
+ char *IndexArg,
+ char *ValueArg)
+{
+ char Type;
+ UINT32 Index;
+ UINT32 Value;
+ ACPI_WALK_STATE *WalkState;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *Node;
+
+
+ /* Validate TypeArg */
+
+ AcpiUtStrupr (TypeArg);
+ Type = TypeArg[0];
+ if ((Type != 'L') &&
+ (Type != 'A') &&
+ (Type != 'N'))
+ {
+ AcpiOsPrintf ("Invalid SET operand: %s\n", TypeArg);
+ return;
+ }
+
+ Value = ACPI_STRTOUL (ValueArg, NULL, 16);
+
+ if (Type == 'N')
+ {
+ Node = AcpiDbConvertToNode (IndexArg);
+ if (Node->Type != ACPI_TYPE_INTEGER)
+ {
+ AcpiOsPrintf ("Can only set Integer nodes\n");
+ return;
+ }
+ ObjDesc = Node->Object;
+ ObjDesc->Integer.Value = Value;
+ return;
+ }
+
+ /* Get the index and value */
+
+ Index = ACPI_STRTOUL (IndexArg, NULL, 16);
+
+ WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
+ if (!WalkState)
+ {
+ AcpiOsPrintf ("There is no method currently executing\n");
+ return;
+ }
+
+ /* Create and initialize the new object */
+
+ ObjDesc = AcpiUtCreateIntegerObject ((UINT64) Value);
+ if (!ObjDesc)
+ {
+ AcpiOsPrintf ("Could not create an internal object\n");
+ return;
+ }
+
+ /* Store the new object into the target */
+
+ switch (Type)
+ {
+ case 'A':
+
+ /* Set a method argument */
+
+ if (Index > ACPI_METHOD_MAX_ARG)
+ {
+ AcpiOsPrintf ("Arg%u - Invalid argument name\n", Index);
+ goto Cleanup;
+ }
+
+ Status = AcpiDsStoreObjectToLocal (ACPI_REFCLASS_ARG, Index, ObjDesc,
+ WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+
+ ObjDesc = WalkState->Arguments[Index].Object;
+
+ AcpiOsPrintf ("Arg%u: ", Index);
+ AcpiDmDisplayInternalObject (ObjDesc, WalkState);
+ break;
+
+ case 'L':
+
+ /* Set a method local */
+
+ if (Index > ACPI_METHOD_MAX_LOCAL)
+ {
+ AcpiOsPrintf ("Local%u - Invalid local variable name\n", Index);
+ goto Cleanup;
+ }
+
+ Status = AcpiDsStoreObjectToLocal (ACPI_REFCLASS_LOCAL, Index, ObjDesc,
+ WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+
+ ObjDesc = WalkState->LocalVariables[Index].Object;
+
+ AcpiOsPrintf ("Local%u: ", Index);
+ AcpiDmDisplayInternalObject (ObjDesc, WalkState);
+ break;
+
+ default:
+ break;
+ }
+
+Cleanup:
+ AcpiUtRemoveReference (ObjDesc);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbDisassembleAml
+ *
+ * PARAMETERS: Statements - Number of statements to disassemble
+ * Op - Current Op (from parse walk)
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display disassembled AML (ASL) starting from Op for the number
+ * of statements specified.
+ *
+ ******************************************************************************/
+
+void
+AcpiDbDisassembleAml (
+ char *Statements,
+ ACPI_PARSE_OBJECT *Op)
+{
+ UINT32 NumStatements = 8;
+
+
+ if (!Op)
+ {
+ AcpiOsPrintf ("There is no method currently executing\n");
+ return;
+ }
+
+ if (Statements)
+ {
+ NumStatements = ACPI_STRTOUL (Statements, NULL, 0);
+ }
+
+ AcpiDmDisassemble (NULL, Op, NumStatements);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbDisassembleMethod
+ *
+ * PARAMETERS: Name - Name of control method
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display disassembled AML (ASL) starting from Op for the number
+ * of statements specified.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDbDisassembleMethod (
+ char *Name)
+{
+ ACPI_STATUS Status;
+ ACPI_PARSE_OBJECT *Op;
+ ACPI_WALK_STATE *WalkState;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_NAMESPACE_NODE *Method;
+
+
+ Method = AcpiDbConvertToNode (Name);
+ if (!Method)
+ {
+ return (AE_BAD_PARAMETER);
+ }
+
+ ObjDesc = Method->Object;
+
+ Op = AcpiPsCreateScopeOp ();
+ if (!Op)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ /* Create and initialize a new walk state */
+
+ WalkState = AcpiDsCreateWalkState (0, Op, NULL, NULL);
+ if (!WalkState)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ Status = AcpiDsInitAmlWalk (WalkState, Op, NULL,
+ ObjDesc->Method.AmlStart,
+ ObjDesc->Method.AmlLength, NULL, ACPI_IMODE_LOAD_PASS1);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ /* Parse the AML */
+
+ WalkState->ParseFlags &= ~ACPI_PARSE_DELETE_TREE;
+ WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE;
+ Status = AcpiPsParseAml (WalkState);
+
+ AcpiDmDisassemble (NULL, Op, 0);
+ AcpiPsDeleteParseTree (Op);
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbWalkForExecute
+ *
+ * PARAMETERS: Callback from WalkNamespace
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Batch execution module. Currently only executes predefined
+ * ACPI names.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiDbWalkForExecute (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue)
+{
+ ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
+ ACPI_EXECUTE_WALK *Info = (ACPI_EXECUTE_WALK *) Context;
+ ACPI_BUFFER ReturnObj;
+ ACPI_STATUS Status;
+ char *Pathname;
+ UINT32 i;
+ ACPI_DEVICE_INFO *ObjInfo;
+ ACPI_OBJECT_LIST ParamObjects;
+ ACPI_OBJECT Params[ACPI_METHOD_NUM_ARGS];
+ const ACPI_PREDEFINED_INFO *Predefined;
+
+
+ Predefined = AcpiNsCheckForPredefinedName (Node);
+ if (!Predefined)
+ {
+ return (AE_OK);
+ }
+
+ if (Node->Type == ACPI_TYPE_LOCAL_SCOPE)
+ {
+ return (AE_OK);
+ }
+
+ Pathname = AcpiNsGetExternalPathname (Node);
+ if (!Pathname)
+ {
+ return (AE_OK);
+ }
+
+ /* Get the object info for number of method parameters */
+
+ Status = AcpiGetObjectInfo (ObjHandle, &ObjInfo);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ ParamObjects.Pointer = NULL;
+ ParamObjects.Count = 0;
+
+ if (ObjInfo->Type == ACPI_TYPE_METHOD)
+ {
+ /* Setup default parameters */
+
+ for (i = 0; i < ObjInfo->ParamCount; i++)
+ {
+ Params[i].Type = ACPI_TYPE_INTEGER;
+ Params[i].Integer.Value = 1;
+ }
+
+ ParamObjects.Pointer = Params;
+ ParamObjects.Count = ObjInfo->ParamCount;
+ }
+
+ ACPI_FREE (ObjInfo);
+ ReturnObj.Pointer = NULL;
+ ReturnObj.Length = ACPI_ALLOCATE_BUFFER;
+
+ /* Do the actual method execution */
+
+ AcpiGbl_MethodExecuting = TRUE;
+
+ Status = AcpiEvaluateObject (Node, NULL, &ParamObjects, &ReturnObj);
+
+ AcpiOsPrintf ("%-32s returned %s\n", Pathname, AcpiFormatException (Status));
+ AcpiGbl_MethodExecuting = FALSE;
+ ACPI_FREE (Pathname);
+
+ /* Ignore status from method execution */
+
+ Status = AE_OK;
+
+ /* Update count, check if we have executed enough methods */
+
+ Info->Count++;
+ if (Info->Count >= Info->MaxCount)
+ {
+ Status = AE_CTRL_TERMINATE;
+ }
+
+ return (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbBatchExecute
+ *
+ * PARAMETERS: CountArg - Max number of methods to execute
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Namespace batch execution. Execute predefined names in the
+ * namespace, up to the max count, if specified.
+ *
+ ******************************************************************************/
+
+void
+AcpiDbBatchExecute (
+ char *CountArg)
+{
+ ACPI_EXECUTE_WALK Info;
+
+
+ Info.Count = 0;
+ Info.MaxCount = ACPI_UINT32_MAX;
+
+ if (CountArg)
+ {
+ Info.MaxCount = ACPI_STRTOUL (CountArg, NULL, 0);
+ }
+
+
+ /* Search all nodes in namespace */
+
+ (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
+ AcpiDbWalkForExecute, NULL, (void *) &Info, NULL);
+
+ AcpiOsPrintf ("Executed %u predefined names in the namespace\n", Info.Count);
+}
+
+#endif /* ACPI_DEBUGGER */
diff --git a/debugger/dbnames.c b/debugger/dbnames.c
new file mode 100644
index 000000000000..e4e4280f29b1
--- /dev/null
+++ b/debugger/dbnames.c
@@ -0,0 +1,934 @@
+/*******************************************************************************
+ *
+ * Module Name: dbnames - Debugger commands for the acpi namespace
+ *
+ ******************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2011, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * substantially similar to the "NO WARRANTY" disclaimer below
+ * ("Disclaimer") and any redistribution must be conditioned upon
+ * including a substantially similar Disclaimer requirement for further
+ * binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ * of any contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+
+#include "acpi.h"
+#include "accommon.h"
+#include "acnamesp.h"
+#include "acdebug.h"
+
+
+#ifdef ACPI_DEBUGGER
+
+#define _COMPONENT ACPI_CA_DEBUGGER
+ ACPI_MODULE_NAME ("dbnames")
+
+
+/* Local prototypes */
+
+static ACPI_STATUS
+AcpiDbWalkAndMatchName (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue);
+
+static ACPI_STATUS
+AcpiDbWalkForPredefinedNames (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue);
+
+static ACPI_STATUS
+AcpiDbWalkForSpecificObjects (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue);
+
+static ACPI_STATUS
+AcpiDbIntegrityWalk (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue);
+
+static ACPI_STATUS
+AcpiDbWalkForReferences (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue);
+
+static ACPI_STATUS
+AcpiDbBusWalk (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue);
+
+/*
+ * Arguments for the Objects command
+ * These object types map directly to the ACPI_TYPES
+ */
+static ARGUMENT_INFO AcpiDbObjectTypes [] =
+{
+ {"ANY"},
+ {"INTEGERS"},
+ {"STRINGS"},
+ {"BUFFERS"},
+ {"PACKAGES"},
+ {"FIELDS"},
+ {"DEVICES"},
+ {"EVENTS"},
+ {"METHODS"},
+ {"MUTEXES"},
+ {"REGIONS"},
+ {"POWERRESOURCES"},
+ {"PROCESSORS"},
+ {"THERMALZONES"},
+ {"BUFFERFIELDS"},
+ {"DDBHANDLES"},
+ {"DEBUG"},
+ {"REGIONFIELDS"},
+ {"BANKFIELDS"},
+ {"INDEXFIELDS"},
+ {"REFERENCES"},
+ {"ALIAS"},
+ {NULL} /* Must be null terminated */
+};
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbSetScope
+ *
+ * PARAMETERS: Name - New scope path
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Set the "current scope" as maintained by this utility.
+ * The scope is used as a prefix to ACPI paths.
+ *
+ ******************************************************************************/
+
+void
+AcpiDbSetScope (
+ char *Name)
+{
+ ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *Node;
+
+
+ if (!Name || Name[0] == 0)
+ {
+ AcpiOsPrintf ("Current scope: %s\n", AcpiGbl_DbScopeBuf);
+ return;
+ }
+
+ AcpiDbPrepNamestring (Name);
+
+ if (Name[0] == '\\')
+ {
+ /* Validate new scope from the root */
+
+ Status = AcpiNsGetNode (AcpiGbl_RootNode, Name, ACPI_NS_NO_UPSEARCH,
+ &Node);
+ if (ACPI_FAILURE (Status))
+ {
+ goto ErrorExit;
+ }
+
+ ACPI_STRCPY (AcpiGbl_DbScopeBuf, Name);
+ ACPI_STRCAT (AcpiGbl_DbScopeBuf, "\\");
+ }
+ else
+ {
+ /* Validate new scope relative to old scope */
+
+ Status = AcpiNsGetNode (AcpiGbl_DbScopeNode, Name, ACPI_NS_NO_UPSEARCH,
+ &Node);
+ if (ACPI_FAILURE (Status))
+ {
+ goto ErrorExit;
+ }
+
+ ACPI_STRCAT (AcpiGbl_DbScopeBuf, Name);
+ ACPI_STRCAT (AcpiGbl_DbScopeBuf, "\\");
+ }
+
+ AcpiGbl_DbScopeNode = Node;
+ AcpiOsPrintf ("New scope: %s\n", AcpiGbl_DbScopeBuf);
+ return;
+
+ErrorExit:
+
+ AcpiOsPrintf ("Could not attach scope: %s, %s\n",
+ Name, AcpiFormatException (Status));
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbDumpNamespace
+ *
+ * PARAMETERS: StartArg - Node to begin namespace dump
+ * DepthArg - Maximum tree depth to be dumped
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Dump entire namespace or a subtree. Each node is displayed
+ * with type and other information.
+ *
+ ******************************************************************************/
+
+void
+AcpiDbDumpNamespace (
+ char *StartArg,
+ char *DepthArg)
+{
+ ACPI_HANDLE SubtreeEntry = AcpiGbl_RootNode;
+ UINT32 MaxDepth = ACPI_UINT32_MAX;
+
+
+ /* No argument given, just start at the root and dump entire namespace */
+
+ if (StartArg)
+ {
+ SubtreeEntry = AcpiDbConvertToNode (StartArg);
+ if (!SubtreeEntry)
+ {
+ return;
+ }
+
+ /* Now we can check for the depth argument */
+
+ if (DepthArg)
+ {
+ MaxDepth = ACPI_STRTOUL (DepthArg, NULL, 0);
+ }
+ }
+
+ AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
+ AcpiOsPrintf ("ACPI Namespace (from %4.4s (%p) subtree):\n",
+ ((ACPI_NAMESPACE_NODE *) SubtreeEntry)->Name.Ascii, SubtreeEntry);
+
+ /* Display the subtree */
+
+ AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
+ AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, MaxDepth,
+ ACPI_OWNER_ID_MAX, SubtreeEntry);
+ AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbDumpNamespaceByOwner
+ *
+ * PARAMETERS: OwnerArg - Owner ID whose nodes will be displayed
+ * DepthArg - Maximum tree depth to be dumped
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Dump elements of the namespace that are owned by the OwnerId.
+ *
+ ******************************************************************************/
+
+void
+AcpiDbDumpNamespaceByOwner (
+ char *OwnerArg,
+ char *DepthArg)
+{
+ ACPI_HANDLE SubtreeEntry = AcpiGbl_RootNode;
+ UINT32 MaxDepth = ACPI_UINT32_MAX;
+ ACPI_OWNER_ID OwnerId;
+
+
+ OwnerId = (ACPI_OWNER_ID) ACPI_STRTOUL (OwnerArg, NULL, 0);
+
+ /* Now we can check for the depth argument */
+
+ if (DepthArg)
+ {
+ MaxDepth = ACPI_STRTOUL (DepthArg, NULL, 0);
+ }
+
+ AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
+ AcpiOsPrintf ("ACPI Namespace by owner %X:\n", OwnerId);
+
+ /* Display the subtree */
+
+ AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
+ AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, MaxDepth, OwnerId,
+ SubtreeEntry);
+ AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbWalkAndMatchName
+ *
+ * PARAMETERS: Callback from WalkNamespace
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Find a particular name/names within the namespace. Wildcards
+ * are supported -- '?' matches any character.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiDbWalkAndMatchName (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue)
+{
+ ACPI_STATUS Status;
+ char *RequestedName = (char *) Context;
+ UINT32 i;
+ ACPI_BUFFER Buffer;
+ ACPI_WALK_INFO Info;
+
+
+ /* Check for a name match */
+
+ for (i = 0; i < 4; i++)
+ {
+ /* Wildcard support */
+
+ if ((RequestedName[i] != '?') &&
+ (RequestedName[i] != ((ACPI_NAMESPACE_NODE *) ObjHandle)->Name.Ascii[i]))
+ {
+ /* No match, just exit */
+
+ return (AE_OK);
+ }
+ }
+
+ /* Get the full pathname to this object */
+
+ Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
+ Status = AcpiNsHandleToPathname (ObjHandle, &Buffer);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle);
+ }
+ else
+ {
+ Info.OwnerId = ACPI_OWNER_ID_MAX;
+ Info.DebugLevel = ACPI_UINT32_MAX;
+ Info.DisplayType = ACPI_DISPLAY_SUMMARY | ACPI_DISPLAY_SHORT;
+
+ AcpiOsPrintf ("%32s", (char *) Buffer.Pointer);
+ (void) AcpiNsDumpOneObject (ObjHandle, NestingLevel, &Info, NULL);
+ ACPI_FREE (Buffer.Pointer);
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbFindNameInNamespace
+ *
+ * PARAMETERS: NameArg - The 4-character ACPI name to find.
+ * wildcards are supported.
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Search the namespace for a given name (with wildcards)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDbFindNameInNamespace (
+ char *NameArg)
+{
+ char AcpiName[5] = "____";
+ char *AcpiNamePtr = AcpiName;
+
+
+ if (ACPI_STRLEN (NameArg) > 4)
+ {
+ AcpiOsPrintf ("Name must be no longer than 4 characters\n");
+ return (AE_OK);
+ }
+
+ /* Pad out name with underscores as necessary to create a 4-char name */
+
+ AcpiUtStrupr (NameArg);
+ while (*NameArg)
+ {
+ *AcpiNamePtr = *NameArg;
+ AcpiNamePtr++;
+ NameArg++;
+ }
+
+ /* Walk the namespace from the root */
+
+ (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
+ AcpiDbWalkAndMatchName, NULL, AcpiName, NULL);
+
+ AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbWalkForPredefinedNames
+ *
+ * PARAMETERS: Callback from WalkNamespace
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Detect and display predefined ACPI names (names that start with
+ * an underscore)
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiDbWalkForPredefinedNames (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue)
+{
+ ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
+ UINT32 *Count = (UINT32 *) Context;
+ const ACPI_PREDEFINED_INFO *Predefined;
+ const ACPI_PREDEFINED_INFO *Package = NULL;
+ char *Pathname;
+
+
+ Predefined = AcpiNsCheckForPredefinedName (Node);
+ if (!Predefined)
+ {
+ return (AE_OK);
+ }
+
+ Pathname = AcpiNsGetExternalPathname (Node);
+ if (!Pathname)
+ {
+ return (AE_OK);
+ }
+
+ /* If method returns a package, the info is in the next table entry */
+
+ if (Predefined->Info.ExpectedBtypes & ACPI_BTYPE_PACKAGE)
+ {
+ Package = Predefined + 1;
+ }
+
+ AcpiOsPrintf ("%-32s arg %X ret %2.2X", Pathname,
+ Predefined->Info.ParamCount, Predefined->Info.ExpectedBtypes);
+
+ if (Package)
+ {
+ AcpiOsPrintf (" PkgType %2.2X ObjType %2.2X Count %2.2X",
+ Package->RetInfo.Type, Package->RetInfo.ObjectType1,
+ Package->RetInfo.Count1);
+ }
+
+ AcpiOsPrintf("\n");
+
+ AcpiNsCheckParameterCount (Pathname, Node, ACPI_UINT32_MAX, Predefined);
+ ACPI_FREE (Pathname);
+ (*Count)++;
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbCheckPredefinedNames
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Validate all predefined names in the namespace
+ *
+ ******************************************************************************/
+
+void
+AcpiDbCheckPredefinedNames (
+ void)
+{
+ UINT32 Count = 0;
+
+
+ /* Search all nodes in namespace */
+
+ (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
+ AcpiDbWalkForPredefinedNames, NULL, (void *) &Count, NULL);
+
+ AcpiOsPrintf ("Found %u predefined names in the namespace\n", Count);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbWalkForSpecificObjects
+ *
+ * PARAMETERS: Callback from WalkNamespace
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Display short info about objects in the namespace
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiDbWalkForSpecificObjects (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue)
+{
+ ACPI_WALK_INFO *Info = (ACPI_WALK_INFO *) Context;
+ ACPI_BUFFER Buffer;
+ ACPI_STATUS Status;
+
+
+ Info->Count++;
+
+ /* Get and display the full pathname to this object */
+
+ Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
+ Status = AcpiNsHandleToPathname (ObjHandle, &Buffer);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle);
+ return (AE_OK);
+ }
+
+ AcpiOsPrintf ("%32s", (char *) Buffer.Pointer);
+ ACPI_FREE (Buffer.Pointer);
+
+ /* Dump short info about the object */
+
+ (void) AcpiNsDumpOneObject (ObjHandle, NestingLevel, Info, NULL);
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbDisplayObjects
+ *
+ * PARAMETERS: ObjTypeArg - Type of object to display
+ * DisplayCountArg - Max depth to display
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display objects in the namespace of the requested type
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDbDisplayObjects (
+ char *ObjTypeArg,
+ char *DisplayCountArg)
+{
+ ACPI_WALK_INFO Info;
+ ACPI_OBJECT_TYPE Type;
+
+
+ /* Get the object type */
+
+ Type = AcpiDbMatchArgument (ObjTypeArg, AcpiDbObjectTypes);
+ if (Type == ACPI_TYPE_NOT_FOUND)
+ {
+ AcpiOsPrintf ("Invalid or unsupported argument\n");
+ return (AE_OK);
+ }
+
+ AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
+ AcpiOsPrintf (
+ "Objects of type [%s] defined in the current ACPI Namespace:\n",
+ AcpiUtGetTypeName (Type));
+
+ AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
+
+ Info.Count = 0;
+ Info.OwnerId = ACPI_OWNER_ID_MAX;
+ Info.DebugLevel = ACPI_UINT32_MAX;
+ Info.DisplayType = ACPI_DISPLAY_SUMMARY | ACPI_DISPLAY_SHORT;
+
+ /* Walk the namespace from the root */
+
+ (void) AcpiWalkNamespace (Type, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
+ AcpiDbWalkForSpecificObjects, NULL, (void *) &Info, NULL);
+
+ AcpiOsPrintf (
+ "\nFound %u objects of type [%s] in the current ACPI Namespace\n",
+ Info.Count, AcpiUtGetTypeName (Type));
+
+ AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbIntegrityWalk
+ *
+ * PARAMETERS: Callback from WalkNamespace
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Examine one NS node for valid values.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiDbIntegrityWalk (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue)
+{
+ ACPI_INTEGRITY_INFO *Info = (ACPI_INTEGRITY_INFO *) Context;
+ ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
+ ACPI_OPERAND_OBJECT *Object;
+ BOOLEAN Alias = TRUE;
+
+
+ Info->Nodes++;
+
+ /* Verify the NS node, and dereference aliases */
+
+ while (Alias)
+ {
+ if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED)
+ {
+ AcpiOsPrintf ("Invalid Descriptor Type for Node %p [%s] - is %2.2X should be %2.2X\n",
+ Node, AcpiUtGetDescriptorName (Node), ACPI_GET_DESCRIPTOR_TYPE (Node),
+ ACPI_DESC_TYPE_NAMED);
+ return (AE_OK);
+ }
+
+ if ((Node->Type == ACPI_TYPE_LOCAL_ALIAS) ||
+ (Node->Type == ACPI_TYPE_LOCAL_METHOD_ALIAS))
+ {
+ Node = (ACPI_NAMESPACE_NODE *) Node->Object;
+ }
+ else
+ {
+ Alias = FALSE;
+ }
+ }
+
+ if (Node->Type > ACPI_TYPE_LOCAL_MAX)
+ {
+ AcpiOsPrintf ("Invalid Object Type for Node %p, Type = %X\n",
+ Node, Node->Type);
+ return (AE_OK);
+ }
+
+ if (!AcpiUtValidAcpiName (Node->Name.Integer))
+ {
+ AcpiOsPrintf ("Invalid AcpiName for Node %p\n", Node);
+ return (AE_OK);
+ }
+
+ Object = AcpiNsGetAttachedObject (Node);
+ if (Object)
+ {
+ Info->Objects++;
+ if (ACPI_GET_DESCRIPTOR_TYPE (Object) != ACPI_DESC_TYPE_OPERAND)
+ {
+ AcpiOsPrintf ("Invalid Descriptor Type for Object %p [%s]\n",
+ Object, AcpiUtGetDescriptorName (Object));
+ }
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbCheckIntegrity
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Check entire namespace for data structure integrity
+ *
+ ******************************************************************************/
+
+void
+AcpiDbCheckIntegrity (
+ void)
+{
+ ACPI_INTEGRITY_INFO Info = {0,0};
+
+ /* Search all nodes in namespace */
+
+ (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
+ AcpiDbIntegrityWalk, NULL, (void *) &Info, NULL);
+
+ AcpiOsPrintf ("Verified %u namespace nodes with %u Objects\n",
+ Info.Nodes, Info.Objects);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbWalkForReferences
+ *
+ * PARAMETERS: Callback from WalkNamespace
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Check if this namespace object refers to the target object
+ * that is passed in as the context value.
+ *
+ * Note: Currently doesn't check subobjects within the Node's object
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiDbWalkForReferences (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue)
+{
+ ACPI_OPERAND_OBJECT *ObjDesc = (ACPI_OPERAND_OBJECT *) Context;
+ ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
+
+
+ /* Check for match against the namespace node itself */
+
+ if (Node == (void *) ObjDesc)
+ {
+ AcpiOsPrintf ("Object is a Node [%4.4s]\n",
+ AcpiUtGetNodeName (Node));
+ }
+
+ /* Check for match against the object attached to the node */
+
+ if (AcpiNsGetAttachedObject (Node) == ObjDesc)
+ {
+ AcpiOsPrintf ("Reference at Node->Object %p [%4.4s]\n",
+ Node, AcpiUtGetNodeName (Node));
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbFindReferences
+ *
+ * PARAMETERS: ObjectArg - String with hex value of the object
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Search namespace for all references to the input object
+ *
+ ******************************************************************************/
+
+void
+AcpiDbFindReferences (
+ char *ObjectArg)
+{
+ ACPI_OPERAND_OBJECT *ObjDesc;
+
+
+ /* Convert string to object pointer */
+
+ ObjDesc = ACPI_TO_POINTER (ACPI_STRTOUL (ObjectArg, NULL, 16));
+
+ /* Search all nodes in namespace */
+
+ (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
+ AcpiDbWalkForReferences, NULL, (void *) ObjDesc, NULL);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbBusWalk
+ *
+ * PARAMETERS: Callback from WalkNamespace
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Display info about device objects that have a corresponding
+ * _PRT method.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiDbBusWalk (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue)
+{
+ ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
+ ACPI_STATUS Status;
+ ACPI_BUFFER Buffer;
+ ACPI_NAMESPACE_NODE *TempNode;
+ ACPI_DEVICE_INFO *Info;
+ UINT32 i;
+
+
+ if ((Node->Type != ACPI_TYPE_DEVICE) &&
+ (Node->Type != ACPI_TYPE_PROCESSOR))
+ {
+ return (AE_OK);
+ }
+
+ /* Exit if there is no _PRT under this device */
+
+ Status = AcpiGetHandle (Node, METHOD_NAME__PRT,
+ ACPI_CAST_PTR (ACPI_HANDLE, &TempNode));
+ if (ACPI_FAILURE (Status))
+ {
+ return (AE_OK);
+ }
+
+ /* Get the full path to this device object */
+
+ Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
+ Status = AcpiNsHandleToPathname (ObjHandle, &Buffer);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle);
+ return (AE_OK);
+ }
+
+ Status = AcpiGetObjectInfo (ObjHandle, &Info);
+ if (ACPI_FAILURE (Status))
+ {
+ return (AE_OK);
+ }
+
+ /* Display the full path */
+
+ AcpiOsPrintf ("%-32s Type %X", (char *) Buffer.Pointer, Node->Type);
+ ACPI_FREE (Buffer.Pointer);
+
+ if (Info->Flags & ACPI_PCI_ROOT_BRIDGE)
+ {
+ AcpiOsPrintf (" - Is PCI Root Bridge");
+ }
+ AcpiOsPrintf ("\n");
+
+ /* _PRT info */
+
+ AcpiOsPrintf ("_PRT: %p\n", TempNode);
+
+ /* Dump _ADR, _HID, _UID, _CID */
+
+ if (Info->Valid & ACPI_VALID_ADR)
+ {
+ AcpiOsPrintf ("_ADR: %8.8X%8.8X\n", ACPI_FORMAT_UINT64 (Info->Address));
+ }
+ else
+ {
+ AcpiOsPrintf ("_ADR: <Not Present>\n");
+ }
+
+ if (Info->Valid & ACPI_VALID_HID)
+ {
+ AcpiOsPrintf ("_HID: %s\n", Info->HardwareId.String);
+ }
+ else
+ {
+ AcpiOsPrintf ("_HID: <Not Present>\n");
+ }
+
+ if (Info->Valid & ACPI_VALID_UID)
+ {
+ AcpiOsPrintf ("_UID: %s\n", Info->UniqueId.String);
+ }
+ else
+ {
+ AcpiOsPrintf ("_UID: <Not Present>\n");
+ }
+
+ if (Info->Valid & ACPI_VALID_CID)
+ {
+ for (i = 0; i < Info->CompatibleIdList.Count; i++)
+ {
+ AcpiOsPrintf ("_CID: %s\n",
+ Info->CompatibleIdList.Ids[i].String);
+ }
+ }
+ else
+ {
+ AcpiOsPrintf ("_CID: <Not Present>\n");
+ }
+
+ ACPI_FREE (Info);
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbGetBusInfo
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display info about system busses.
+ *
+ ******************************************************************************/
+
+void
+AcpiDbGetBusInfo (
+ void)
+{
+ /* Search all nodes in namespace */
+
+ (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
+ AcpiDbBusWalk, NULL, NULL, NULL);
+}
+
+#endif /* ACPI_DEBUGGER */
diff --git a/dispatcher/dsargs.c b/dispatcher/dsargs.c
new file mode 100644
index 000000000000..87def860516c
--- /dev/null
+++ b/dispatcher/dsargs.c
@@ -0,0 +1,430 @@
+/******************************************************************************
+ *
+ * Module Name: dsargs - Support for execution of dynamic arguments for static
+ * objects (regions, fields, buffer fields, etc.)
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2011, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * substantially similar to the "NO WARRANTY" disclaimer below
+ * ("Disclaimer") and any redistribution must be conditioned upon
+ * including a substantially similar Disclaimer requirement for further
+ * binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ * of any contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#define __DSARGS_C__
+
+#include "acpi.h"
+#include "accommon.h"
+#include "acparser.h"
+#include "amlcode.h"
+#include "acdispat.h"
+#include "acnamesp.h"
+
+#define _COMPONENT ACPI_DISPATCHER
+ ACPI_MODULE_NAME ("dsargs")
+
+/* Local prototypes */
+
+static ACPI_STATUS
+AcpiDsExecuteArguments (
+ ACPI_NAMESPACE_NODE *Node,
+ ACPI_NAMESPACE_NODE *ScopeNode,
+ UINT32 AmlLength,
+ UINT8 *AmlStart);
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsExecuteArguments
+ *
+ * PARAMETERS: Node - Object NS node
+ * ScopeNode - Parent NS node
+ * AmlLength - Length of executable AML
+ * AmlStart - Pointer to the AML
+ *
+ * RETURN: Status.
+ *
+ * DESCRIPTION: Late (deferred) execution of region or field arguments
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiDsExecuteArguments (
+ ACPI_NAMESPACE_NODE *Node,
+ ACPI_NAMESPACE_NODE *ScopeNode,
+ UINT32 AmlLength,
+ UINT8 *AmlStart)
+{
+ ACPI_STATUS Status;
+ ACPI_PARSE_OBJECT *Op;
+ ACPI_WALK_STATE *WalkState;
+
+
+ ACPI_FUNCTION_TRACE (DsExecuteArguments);
+
+
+ /* Allocate a new parser op to be the root of the parsed tree */
+
+ Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP);
+ if (!Op)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /* Save the Node for use in AcpiPsParseAml */
+
+ Op->Common.Node = ScopeNode;
+
+ /* Create and initialize a new parser state */
+
+ WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);
+ if (!WalkState)
+ {
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, AmlStart,
+ AmlLength, NULL, ACPI_IMODE_LOAD_PASS1);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiDsDeleteWalkState (WalkState);
+ goto Cleanup;
+ }
+
+ /* Mark this parse as a deferred opcode */
+
+ WalkState->ParseFlags = ACPI_PARSE_DEFERRED_OP;
+ WalkState->DeferredNode = Node;
+
+ /* Pass1: Parse the entire declaration */
+
+ Status = AcpiPsParseAml (WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+
+ /* Get and init the Op created above */
+
+ Op->Common.Node = Node;
+ AcpiPsDeleteParseTree (Op);
+
+ /* Evaluate the deferred arguments */
+
+ Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP);
+ if (!Op)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ Op->Common.Node = ScopeNode;
+
+ /* Create and initialize a new parser state */
+
+ WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);
+ if (!WalkState)
+ {
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ /* Execute the opcode and arguments */
+
+ Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, AmlStart,
+ AmlLength, NULL, ACPI_IMODE_EXECUTE);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiDsDeleteWalkState (WalkState);
+ goto Cleanup;
+ }
+
+ /* Mark this execution as a deferred opcode */
+
+ WalkState->DeferredNode = Node;
+ Status = AcpiPsParseAml (WalkState);
+
+Cleanup:
+ AcpiPsDeleteParseTree (Op);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsGetBufferFieldArguments
+ *
+ * PARAMETERS: ObjDesc - A valid BufferField object
+ *
+ * RETURN: Status.
+ *
+ * DESCRIPTION: Get BufferField Buffer and Index. This implements the late
+ * evaluation of these field attributes.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsGetBufferFieldArguments (
+ ACPI_OPERAND_OBJECT *ObjDesc)
+{
+ ACPI_OPERAND_OBJECT *ExtraDesc;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE_PTR (DsGetBufferFieldArguments, ObjDesc);
+
+
+ if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Get the AML pointer (method object) and BufferField node */
+
+ ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc);
+ Node = ObjDesc->BufferField.Node;
+
+ ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (ACPI_TYPE_BUFFER_FIELD,
+ Node, NULL));
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] BufferField Arg Init\n",
+ AcpiUtGetNodeName (Node)));
+
+ /* Execute the AML code for the TermArg arguments */
+
+ Status = AcpiDsExecuteArguments (Node, Node->Parent,
+ ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsGetBankFieldArguments
+ *
+ * PARAMETERS: ObjDesc - A valid BankField object
+ *
+ * RETURN: Status.
+ *
+ * DESCRIPTION: Get BankField BankValue. This implements the late
+ * evaluation of these field attributes.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsGetBankFieldArguments (
+ ACPI_OPERAND_OBJECT *ObjDesc)
+{
+ ACPI_OPERAND_OBJECT *ExtraDesc;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE_PTR (DsGetBankFieldArguments, ObjDesc);
+
+
+ if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Get the AML pointer (method object) and BankField node */
+
+ ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc);
+ Node = ObjDesc->BankField.Node;
+
+ ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (ACPI_TYPE_LOCAL_BANK_FIELD,
+ Node, NULL));
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] BankField Arg Init\n",
+ AcpiUtGetNodeName (Node)));
+
+ /* Execute the AML code for the TermArg arguments */
+
+ Status = AcpiDsExecuteArguments (Node, Node->Parent,
+ ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsGetBufferArguments
+ *
+ * PARAMETERS: ObjDesc - A valid Buffer object
+ *
+ * RETURN: Status.
+ *
+ * DESCRIPTION: Get Buffer length and initializer byte list. This implements
+ * the late evaluation of these attributes.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsGetBufferArguments (
+ ACPI_OPERAND_OBJECT *ObjDesc)
+{
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE_PTR (DsGetBufferArguments, ObjDesc);
+
+
+ if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Get the Buffer node */
+
+ Node = ObjDesc->Buffer.Node;
+ if (!Node)
+ {
+ ACPI_ERROR ((AE_INFO,
+ "No pointer back to namespace node in buffer object %p", ObjDesc));
+ return_ACPI_STATUS (AE_AML_INTERNAL);
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Buffer Arg Init\n"));
+
+ /* Execute the AML code for the TermArg arguments */
+
+ Status = AcpiDsExecuteArguments (Node, Node,
+ ObjDesc->Buffer.AmlLength, ObjDesc->Buffer.AmlStart);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsGetPackageArguments
+ *
+ * PARAMETERS: ObjDesc - A valid Package object
+ *
+ * RETURN: Status.
+ *
+ * DESCRIPTION: Get Package length and initializer byte list. This implements
+ * the late evaluation of these attributes.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsGetPackageArguments (
+ ACPI_OPERAND_OBJECT *ObjDesc)
+{
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE_PTR (DsGetPackageArguments, ObjDesc);
+
+
+ if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Get the Package node */
+
+ Node = ObjDesc->Package.Node;
+ if (!Node)
+ {
+ ACPI_ERROR ((AE_INFO,
+ "No pointer back to namespace node in package %p", ObjDesc));
+ return_ACPI_STATUS (AE_AML_INTERNAL);
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Package Arg Init\n"));
+
+ /* Execute the AML code for the TermArg arguments */
+
+ Status = AcpiDsExecuteArguments (Node, Node,
+ ObjDesc->Package.AmlLength, ObjDesc->Package.AmlStart);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsGetRegionArguments
+ *
+ * PARAMETERS: ObjDesc - A valid region object
+ *
+ * RETURN: Status.
+ *
+ * DESCRIPTION: Get region address and length. This implements the late
+ * evaluation of these region attributes.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsGetRegionArguments (
+ ACPI_OPERAND_OBJECT *ObjDesc)
+{
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_STATUS Status;
+ ACPI_OPERAND_OBJECT *ExtraDesc;
+
+
+ ACPI_FUNCTION_TRACE_PTR (DsGetRegionArguments, ObjDesc);
+
+
+ if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID)
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc);
+ if (!ExtraDesc)
+ {
+ return_ACPI_STATUS (AE_NOT_EXIST);
+ }
+
+ /* Get the Region node */
+
+ Node = ObjDesc->Region.Node;
+
+ ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (ACPI_TYPE_REGION, Node, NULL));
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] OpRegion Arg Init at AML %p\n",
+ AcpiUtGetNodeName (Node), ExtraDesc->Extra.AmlStart));
+
+ /* Execute the argument AML */
+
+ Status = AcpiDsExecuteArguments (Node, Node->Parent,
+ ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart);
+ return_ACPI_STATUS (Status);
+}
diff --git a/dispatcher/dscontrol.c b/dispatcher/dscontrol.c
new file mode 100644
index 000000000000..41a44951c246
--- /dev/null
+++ b/dispatcher/dscontrol.c
@@ -0,0 +1,424 @@
+/******************************************************************************
+ *
+ * Module Name: dscontrol - Support for execution control opcodes -
+ * if/else/while/return
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2011, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * substantially similar to the "NO WARRANTY" disclaimer below
+ * ("Disclaimer") and any redistribution must be conditioned upon
+ * including a substantially similar Disclaimer requirement for further
+ * binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ * of any contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#define __DSCONTROL_C__
+
+#include "acpi.h"
+#include "accommon.h"
+#include "amlcode.h"
+#include "acdispat.h"
+#include "acinterp.h"
+
+#define _COMPONENT ACPI_DISPATCHER
+ ACPI_MODULE_NAME ("dscontrol")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsExecBeginControlOp
+ *
+ * PARAMETERS: WalkList - The list that owns the walk stack
+ * Op - The control Op
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Handles all control ops encountered during control method
+ * execution.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsExecBeginControlOp (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_STATUS Status = AE_OK;
+ ACPI_GENERIC_STATE *ControlState;
+
+
+ ACPI_FUNCTION_NAME (DsExecBeginControlOp);
+
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p Opcode=%2.2X State=%p\n",
+ Op, Op->Common.AmlOpcode, WalkState));
+
+ switch (Op->Common.AmlOpcode)
+ {
+ case AML_WHILE_OP:
+
+ /*
+ * If this is an additional iteration of a while loop, continue.
+ * There is no need to allocate a new control state.
+ */
+ if (WalkState->ControlState)
+ {
+ if (WalkState->ControlState->Control.AmlPredicateStart ==
+ (WalkState->ParserState.Aml - 1))
+ {
+ /* Reset the state to start-of-loop */
+
+ WalkState->ControlState->Common.State =
+ ACPI_CONTROL_CONDITIONAL_EXECUTING;
+ break;
+ }
+ }
+
+ /*lint -fallthrough */
+
+ case AML_IF_OP:
+
+ /*
+ * IF/WHILE: Create a new control state to manage these
+ * constructs. We need to manage these as a stack, in order
+ * to handle nesting.
+ */
+ ControlState = AcpiUtCreateControlState ();
+ if (!ControlState)
+ {
+ Status = AE_NO_MEMORY;
+ break;
+ }
+ /*
+ * Save a pointer to the predicate for multiple executions
+ * of a loop
+ */
+ ControlState->Control.AmlPredicateStart = WalkState->ParserState.Aml - 1;
+ ControlState->Control.PackageEnd = WalkState->ParserState.PkgEnd;
+ ControlState->Control.Opcode = Op->Common.AmlOpcode;
+
+
+ /* Push the control state on this walk's control stack */
+
+ AcpiUtPushGenericState (&WalkState->ControlState, ControlState);
+ break;
+
+ case AML_ELSE_OP:
+
+ /* Predicate is in the state object */
+ /* If predicate is true, the IF was executed, ignore ELSE part */
+
+ if (WalkState->LastPredicate)
+ {
+ Status = AE_CTRL_TRUE;
+ }
+
+ break;
+
+ case AML_RETURN_OP:
+
+ break;
+
+ default:
+ break;
+ }
+
+ return (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsExecEndControlOp
+ *
+ * PARAMETERS: WalkList - The list that owns the walk stack
+ * Op - The control Op
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Handles all control ops encountered during control method
+ * execution.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsExecEndControlOp (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_STATUS Status = AE_OK;
+ ACPI_GENERIC_STATE *ControlState;
+
+
+ ACPI_FUNCTION_NAME (DsExecEndControlOp);
+
+
+ switch (Op->Common.AmlOpcode)
+ {
+ case AML_IF_OP:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[IF_OP] Op=%p\n", Op));
+
+ /*
+ * Save the result of the predicate in case there is an
+ * ELSE to come
+ */
+ WalkState->LastPredicate =
+ (BOOLEAN) WalkState->ControlState->Common.Value;
+
+ /*
+ * Pop the control state that was created at the start
+ * of the IF and free it
+ */
+ ControlState = AcpiUtPopGenericState (&WalkState->ControlState);
+ AcpiUtDeleteGenericState (ControlState);
+ break;
+
+
+ case AML_ELSE_OP:
+
+ break;
+
+
+ case AML_WHILE_OP:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", Op));
+
+ ControlState = WalkState->ControlState;
+ if (ControlState->Common.Value)
+ {
+ /* Predicate was true, the body of the loop was just executed */
+
+ /*
+ * This loop counter mechanism allows the interpreter to escape
+ * possibly infinite loops. This can occur in poorly written AML
+ * when the hardware does not respond within a while loop and the
+ * loop does not implement a timeout.
+ */
+ ControlState->Control.LoopCount++;
+ if (ControlState->Control.LoopCount > ACPI_MAX_LOOP_ITERATIONS)
+ {
+ Status = AE_AML_INFINITE_LOOP;
+ break;
+ }
+
+ /*
+ * Go back and evaluate the predicate and maybe execute the loop
+ * another time
+ */
+ Status = AE_CTRL_PENDING;
+ WalkState->AmlLastWhile = ControlState->Control.AmlPredicateStart;
+ break;
+ }
+
+ /* Predicate was false, terminate this while loop */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "[WHILE_OP] termination! Op=%p\n",Op));
+
+ /* Pop this control state and free it */
+
+ ControlState = AcpiUtPopGenericState (&WalkState->ControlState);
+ AcpiUtDeleteGenericState (ControlState);
+ break;
+
+
+ case AML_RETURN_OP:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "[RETURN_OP] Op=%p Arg=%p\n",Op, Op->Common.Value.Arg));
+
+ /*
+ * One optional operand -- the return value
+ * It can be either an immediate operand or a result that
+ * has been bubbled up the tree
+ */
+ if (Op->Common.Value.Arg)
+ {
+ /* Since we have a real Return(), delete any implicit return */
+
+ AcpiDsClearImplicitReturn (WalkState);
+
+ /* Return statement has an immediate operand */
+
+ Status = AcpiDsCreateOperands (WalkState, Op->Common.Value.Arg);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ /*
+ * If value being returned is a Reference (such as
+ * an arg or local), resolve it now because it may
+ * cease to exist at the end of the method.
+ */
+ Status = AcpiExResolveToValue (&WalkState->Operands [0], WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ /*
+ * Get the return value and save as the last result
+ * value. This is the only place where WalkState->ReturnDesc
+ * is set to anything other than zero!
+ */
+ WalkState->ReturnDesc = WalkState->Operands[0];
+ }
+ else if (WalkState->ResultCount)
+ {
+ /* Since we have a real Return(), delete any implicit return */
+
+ AcpiDsClearImplicitReturn (WalkState);
+
+ /*
+ * The return value has come from a previous calculation.
+ *
+ * If value being returned is a Reference (such as
+ * an arg or local), resolve it now because it may
+ * cease to exist at the end of the method.
+ *
+ * Allow references created by the Index operator to return
+ * unchanged.
+ */
+ if ((ACPI_GET_DESCRIPTOR_TYPE (WalkState->Results->Results.ObjDesc[0]) == ACPI_DESC_TYPE_OPERAND) &&
+ ((WalkState->Results->Results.ObjDesc [0])->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
+ ((WalkState->Results->Results.ObjDesc [0])->Reference.Class != ACPI_REFCLASS_INDEX))
+ {
+ Status = AcpiExResolveToValue (&WalkState->Results->Results.ObjDesc [0], WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+ }
+
+ WalkState->ReturnDesc = WalkState->Results->Results.ObjDesc [0];
+ }
+ else
+ {
+ /* No return operand */
+
+ if (WalkState->NumOperands)
+ {
+ AcpiUtRemoveReference (WalkState->Operands [0]);
+ }
+
+ WalkState->Operands [0] = NULL;
+ WalkState->NumOperands = 0;
+ WalkState->ReturnDesc = NULL;
+ }
+
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "Completed RETURN_OP State=%p, RetVal=%p\n",
+ WalkState, WalkState->ReturnDesc));
+
+ /* End the control method execution right now */
+
+ Status = AE_CTRL_TERMINATE;
+ break;
+
+
+ case AML_NOOP_OP:
+
+ /* Just do nothing! */
+ break;
+
+
+ case AML_BREAK_POINT_OP:
+
+ /*
+ * Set the single-step flag. This will cause the debugger (if present)
+ * to break to the console within the AML debugger at the start of the
+ * next AML instruction.
+ */
+ ACPI_DEBUGGER_EXEC (
+ AcpiGbl_CmSingleStep = TRUE);
+ ACPI_DEBUGGER_EXEC (
+ AcpiOsPrintf ("**break** Executed AML BreakPoint opcode\n"));
+
+ /* Call to the OSL in case OS wants a piece of the action */
+
+ Status = AcpiOsSignal (ACPI_SIGNAL_BREAKPOINT,
+ "Executed AML Breakpoint opcode");
+ break;
+
+
+ case AML_BREAK_OP:
+ case AML_CONTINUE_OP: /* ACPI 2.0 */
+
+
+ /* Pop and delete control states until we find a while */
+
+ while (WalkState->ControlState &&
+ (WalkState->ControlState->Control.Opcode != AML_WHILE_OP))
+ {
+ ControlState = AcpiUtPopGenericState (&WalkState->ControlState);
+ AcpiUtDeleteGenericState (ControlState);
+ }
+
+ /* No while found? */
+
+ if (!WalkState->ControlState)
+ {
+ return (AE_AML_NO_WHILE);
+ }
+
+ /* Was: WalkState->AmlLastWhile = WalkState->ControlState->Control.AmlPredicateStart; */
+
+ WalkState->AmlLastWhile = WalkState->ControlState->Control.PackageEnd;
+
+ /* Return status depending on opcode */
+
+ if (Op->Common.AmlOpcode == AML_BREAK_OP)
+ {
+ Status = AE_CTRL_BREAK;
+ }
+ else
+ {
+ Status = AE_CTRL_CONTINUE;
+ }
+ break;
+
+
+ default:
+
+ ACPI_ERROR ((AE_INFO, "Unknown control opcode=0x%X Op=%p",
+ Op->Common.AmlOpcode, Op));
+
+ Status = AE_AML_BAD_OPCODE;
+ break;
+ }
+
+ return (Status);
+}
diff --git a/dispatcher/dsopcode.c b/dispatcher/dsopcode.c
index 3f8cc6b1ec96..45fbed1e627c 100644
--- a/dispatcher/dsopcode.c
+++ b/dispatcher/dsopcode.c
@@ -1,7 +1,6 @@
/******************************************************************************
*
- * Module Name: dsopcode - Dispatcher Op Region support and handling of
- * "control" opcodes
+ * Module Name: dsopcode - Dispatcher suport for regions and fields
*
*****************************************************************************/
@@ -60,13 +59,6 @@
/* Local prototypes */
static ACPI_STATUS
-AcpiDsExecuteArguments (
- ACPI_NAMESPACE_NODE *Node,
- ACPI_NAMESPACE_NODE *ScopeNode,
- UINT32 AmlLength,
- UINT8 *AmlStart);
-
-static ACPI_STATUS
AcpiDsInitBufferField (
UINT16 AmlOpcode,
ACPI_OPERAND_OBJECT *ObjDesc,
@@ -78,369 +70,6 @@ AcpiDsInitBufferField (
/*******************************************************************************
*
- * FUNCTION: AcpiDsExecuteArguments
- *
- * PARAMETERS: Node - Object NS node
- * ScopeNode - Parent NS node
- * AmlLength - Length of executable AML
- * AmlStart - Pointer to the AML
- *
- * RETURN: Status.
- *
- * DESCRIPTION: Late (deferred) execution of region or field arguments
- *
- ******************************************************************************/
-
-static ACPI_STATUS
-AcpiDsExecuteArguments (
- ACPI_NAMESPACE_NODE *Node,
- ACPI_NAMESPACE_NODE *ScopeNode,
- UINT32 AmlLength,
- UINT8 *AmlStart)
-{
- ACPI_STATUS Status;
- ACPI_PARSE_OBJECT *Op;
- ACPI_WALK_STATE *WalkState;
-
-
- ACPI_FUNCTION_TRACE (DsExecuteArguments);
-
-
- /*
- * Allocate a new parser op to be the root of the parsed tree
- */
- Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP);
- if (!Op)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- /* Save the Node for use in AcpiPsParseAml */
-
- Op->Common.Node = ScopeNode;
-
- /* Create and initialize a new parser state */
-
- WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);
- if (!WalkState)
- {
- Status = AE_NO_MEMORY;
- goto Cleanup;
- }
-
- Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, AmlStart,
- AmlLength, NULL, ACPI_IMODE_LOAD_PASS1);
- if (ACPI_FAILURE (Status))
- {
- AcpiDsDeleteWalkState (WalkState);
- goto Cleanup;
- }
-
- /* Mark this parse as a deferred opcode */
-
- WalkState->ParseFlags = ACPI_PARSE_DEFERRED_OP;
- WalkState->DeferredNode = Node;
-
- /* Pass1: Parse the entire declaration */
-
- Status = AcpiPsParseAml (WalkState);
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
-
- /* Get and init the Op created above */
-
- Op->Common.Node = Node;
- AcpiPsDeleteParseTree (Op);
-
- /* Evaluate the deferred arguments */
-
- Op = AcpiPsAllocOp (AML_INT_EVAL_SUBTREE_OP);
- if (!Op)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- Op->Common.Node = ScopeNode;
-
- /* Create and initialize a new parser state */
-
- WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);
- if (!WalkState)
- {
- Status = AE_NO_MEMORY;
- goto Cleanup;
- }
-
- /* Execute the opcode and arguments */
-
- Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, AmlStart,
- AmlLength, NULL, ACPI_IMODE_EXECUTE);
- if (ACPI_FAILURE (Status))
- {
- AcpiDsDeleteWalkState (WalkState);
- goto Cleanup;
- }
-
- /* Mark this execution as a deferred opcode */
-
- WalkState->DeferredNode = Node;
- Status = AcpiPsParseAml (WalkState);
-
-Cleanup:
- AcpiPsDeleteParseTree (Op);
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsGetBufferFieldArguments
- *
- * PARAMETERS: ObjDesc - A valid BufferField object
- *
- * RETURN: Status.
- *
- * DESCRIPTION: Get BufferField Buffer and Index. This implements the late
- * evaluation of these field attributes.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsGetBufferFieldArguments (
- ACPI_OPERAND_OBJECT *ObjDesc)
-{
- ACPI_OPERAND_OBJECT *ExtraDesc;
- ACPI_NAMESPACE_NODE *Node;
- ACPI_STATUS Status;
-
-
- ACPI_FUNCTION_TRACE_PTR (DsGetBufferFieldArguments, ObjDesc);
-
-
- if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
- {
- return_ACPI_STATUS (AE_OK);
- }
-
- /* Get the AML pointer (method object) and BufferField node */
-
- ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc);
- Node = ObjDesc->BufferField.Node;
-
- ACPI_DEBUG_EXEC(AcpiUtDisplayInitPathname (ACPI_TYPE_BUFFER_FIELD, Node, NULL));
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] BufferField Arg Init\n",
- AcpiUtGetNodeName (Node)));
-
- /* Execute the AML code for the TermArg arguments */
-
- Status = AcpiDsExecuteArguments (Node, Node->Parent,
- ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart);
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsGetBankFieldArguments
- *
- * PARAMETERS: ObjDesc - A valid BankField object
- *
- * RETURN: Status.
- *
- * DESCRIPTION: Get BankField BankValue. This implements the late
- * evaluation of these field attributes.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsGetBankFieldArguments (
- ACPI_OPERAND_OBJECT *ObjDesc)
-{
- ACPI_OPERAND_OBJECT *ExtraDesc;
- ACPI_NAMESPACE_NODE *Node;
- ACPI_STATUS Status;
-
-
- ACPI_FUNCTION_TRACE_PTR (DsGetBankFieldArguments, ObjDesc);
-
-
- if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
- {
- return_ACPI_STATUS (AE_OK);
- }
-
- /* Get the AML pointer (method object) and BankField node */
-
- ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc);
- Node = ObjDesc->BankField.Node;
-
- ACPI_DEBUG_EXEC(AcpiUtDisplayInitPathname (ACPI_TYPE_LOCAL_BANK_FIELD, Node, NULL));
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] BankField Arg Init\n",
- AcpiUtGetNodeName (Node)));
-
- /* Execute the AML code for the TermArg arguments */
-
- Status = AcpiDsExecuteArguments (Node, Node->Parent,
- ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart);
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsGetBufferArguments
- *
- * PARAMETERS: ObjDesc - A valid Buffer object
- *
- * RETURN: Status.
- *
- * DESCRIPTION: Get Buffer length and initializer byte list. This implements
- * the late evaluation of these attributes.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsGetBufferArguments (
- ACPI_OPERAND_OBJECT *ObjDesc)
-{
- ACPI_NAMESPACE_NODE *Node;
- ACPI_STATUS Status;
-
-
- ACPI_FUNCTION_TRACE_PTR (DsGetBufferArguments, ObjDesc);
-
-
- if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
- {
- return_ACPI_STATUS (AE_OK);
- }
-
- /* Get the Buffer node */
-
- Node = ObjDesc->Buffer.Node;
- if (!Node)
- {
- ACPI_ERROR ((AE_INFO,
- "No pointer back to namespace node in buffer object %p", ObjDesc));
- return_ACPI_STATUS (AE_AML_INTERNAL);
- }
-
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Buffer Arg Init\n"));
-
- /* Execute the AML code for the TermArg arguments */
-
- Status = AcpiDsExecuteArguments (Node, Node,
- ObjDesc->Buffer.AmlLength, ObjDesc->Buffer.AmlStart);
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsGetPackageArguments
- *
- * PARAMETERS: ObjDesc - A valid Package object
- *
- * RETURN: Status.
- *
- * DESCRIPTION: Get Package length and initializer byte list. This implements
- * the late evaluation of these attributes.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsGetPackageArguments (
- ACPI_OPERAND_OBJECT *ObjDesc)
-{
- ACPI_NAMESPACE_NODE *Node;
- ACPI_STATUS Status;
-
-
- ACPI_FUNCTION_TRACE_PTR (DsGetPackageArguments, ObjDesc);
-
-
- if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
- {
- return_ACPI_STATUS (AE_OK);
- }
-
- /* Get the Package node */
-
- Node = ObjDesc->Package.Node;
- if (!Node)
- {
- ACPI_ERROR ((AE_INFO,
- "No pointer back to namespace node in package %p", ObjDesc));
- return_ACPI_STATUS (AE_AML_INTERNAL);
- }
-
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Package Arg Init\n"));
-
- /* Execute the AML code for the TermArg arguments */
-
- Status = AcpiDsExecuteArguments (Node, Node,
- ObjDesc->Package.AmlLength, ObjDesc->Package.AmlStart);
- return_ACPI_STATUS (Status);
-}
-
-
-/*****************************************************************************
- *
- * FUNCTION: AcpiDsGetRegionArguments
- *
- * PARAMETERS: ObjDesc - A valid region object
- *
- * RETURN: Status.
- *
- * DESCRIPTION: Get region address and length. This implements the late
- * evaluation of these region attributes.
- *
- ****************************************************************************/
-
-ACPI_STATUS
-AcpiDsGetRegionArguments (
- ACPI_OPERAND_OBJECT *ObjDesc)
-{
- ACPI_NAMESPACE_NODE *Node;
- ACPI_STATUS Status;
- ACPI_OPERAND_OBJECT *ExtraDesc;
-
-
- ACPI_FUNCTION_TRACE_PTR (DsGetRegionArguments, ObjDesc);
-
-
- if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID)
- {
- return_ACPI_STATUS (AE_OK);
- }
-
- ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc);
- if (!ExtraDesc)
- {
- return_ACPI_STATUS (AE_NOT_EXIST);
- }
-
- /* Get the Region node */
-
- Node = ObjDesc->Region.Node;
-
- ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (ACPI_TYPE_REGION, Node, NULL));
-
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] OpRegion Arg Init at AML %p\n",
- AcpiUtGetNodeName (Node), ExtraDesc->Extra.AmlStart));
-
- /* Execute the argument AML */
-
- Status = AcpiDsExecuteArguments (Node, Node->Parent,
- ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart);
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: AcpiDsInitializeRegion
*
* PARAMETERS: ObjHandle - Region namespace node
@@ -870,8 +499,9 @@ AcpiDsEvalRegionOperands (
*
* RETURN: Status
*
- * DESCRIPTION: Get region address and length
- * Called from AcpiDsExecEndOp during DataTableRegion parse tree walk
+ * DESCRIPTION: Get region address and length.
+ * Called from AcpiDsExecEndOp during DataTableRegion parse
+ * tree walk.
*
******************************************************************************/
@@ -1177,371 +807,3 @@ AcpiDsEvalBankFieldOperands (
return_ACPI_STATUS (Status);
}
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsExecBeginControlOp
- *
- * PARAMETERS: WalkList - The list that owns the walk stack
- * Op - The control Op
- *
- * RETURN: Status
- *
- * DESCRIPTION: Handles all control ops encountered during control method
- * execution.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsExecBeginControlOp (
- ACPI_WALK_STATE *WalkState,
- ACPI_PARSE_OBJECT *Op)
-{
- ACPI_STATUS Status = AE_OK;
- ACPI_GENERIC_STATE *ControlState;
-
-
- ACPI_FUNCTION_NAME (DsExecBeginControlOp);
-
-
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p Opcode=%2.2X State=%p\n", Op,
- Op->Common.AmlOpcode, WalkState));
-
- switch (Op->Common.AmlOpcode)
- {
- case AML_WHILE_OP:
-
- /*
- * If this is an additional iteration of a while loop, continue.
- * There is no need to allocate a new control state.
- */
- if (WalkState->ControlState)
- {
- if (WalkState->ControlState->Control.AmlPredicateStart ==
- (WalkState->ParserState.Aml - 1))
- {
- /* Reset the state to start-of-loop */
-
- WalkState->ControlState->Common.State = ACPI_CONTROL_CONDITIONAL_EXECUTING;
- break;
- }
- }
-
- /*lint -fallthrough */
-
- case AML_IF_OP:
-
- /*
- * IF/WHILE: Create a new control state to manage these
- * constructs. We need to manage these as a stack, in order
- * to handle nesting.
- */
- ControlState = AcpiUtCreateControlState ();
- if (!ControlState)
- {
- Status = AE_NO_MEMORY;
- break;
- }
- /*
- * Save a pointer to the predicate for multiple executions
- * of a loop
- */
- ControlState->Control.AmlPredicateStart = WalkState->ParserState.Aml - 1;
- ControlState->Control.PackageEnd = WalkState->ParserState.PkgEnd;
- ControlState->Control.Opcode = Op->Common.AmlOpcode;
-
-
- /* Push the control state on this walk's control stack */
-
- AcpiUtPushGenericState (&WalkState->ControlState, ControlState);
- break;
-
- case AML_ELSE_OP:
-
- /* Predicate is in the state object */
- /* If predicate is true, the IF was executed, ignore ELSE part */
-
- if (WalkState->LastPredicate)
- {
- Status = AE_CTRL_TRUE;
- }
-
- break;
-
- case AML_RETURN_OP:
-
- break;
-
- default:
- break;
- }
-
- return (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsExecEndControlOp
- *
- * PARAMETERS: WalkList - The list that owns the walk stack
- * Op - The control Op
- *
- * RETURN: Status
- *
- * DESCRIPTION: Handles all control ops encountered during control method
- * execution.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsExecEndControlOp (
- ACPI_WALK_STATE *WalkState,
- ACPI_PARSE_OBJECT *Op)
-{
- ACPI_STATUS Status = AE_OK;
- ACPI_GENERIC_STATE *ControlState;
-
-
- ACPI_FUNCTION_NAME (DsExecEndControlOp);
-
-
- switch (Op->Common.AmlOpcode)
- {
- case AML_IF_OP:
-
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[IF_OP] Op=%p\n", Op));
-
- /*
- * Save the result of the predicate in case there is an
- * ELSE to come
- */
- WalkState->LastPredicate =
- (BOOLEAN) WalkState->ControlState->Common.Value;
-
- /*
- * Pop the control state that was created at the start
- * of the IF and free it
- */
- ControlState = AcpiUtPopGenericState (&WalkState->ControlState);
- AcpiUtDeleteGenericState (ControlState);
- break;
-
-
- case AML_ELSE_OP:
-
- break;
-
-
- case AML_WHILE_OP:
-
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", Op));
-
- ControlState = WalkState->ControlState;
- if (ControlState->Common.Value)
- {
- /* Predicate was true, the body of the loop was just executed */
-
- /*
- * This loop counter mechanism allows the interpreter to escape
- * possibly infinite loops. This can occur in poorly written AML
- * when the hardware does not respond within a while loop and the
- * loop does not implement a timeout.
- */
- ControlState->Control.LoopCount++;
- if (ControlState->Control.LoopCount > ACPI_MAX_LOOP_ITERATIONS)
- {
- Status = AE_AML_INFINITE_LOOP;
- break;
- }
-
- /*
- * Go back and evaluate the predicate and maybe execute the loop
- * another time
- */
- Status = AE_CTRL_PENDING;
- WalkState->AmlLastWhile = ControlState->Control.AmlPredicateStart;
- break;
- }
-
- /* Predicate was false, terminate this while loop */
-
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "[WHILE_OP] termination! Op=%p\n",Op));
-
- /* Pop this control state and free it */
-
- ControlState = AcpiUtPopGenericState (&WalkState->ControlState);
- AcpiUtDeleteGenericState (ControlState);
- break;
-
-
- case AML_RETURN_OP:
-
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "[RETURN_OP] Op=%p Arg=%p\n",Op, Op->Common.Value.Arg));
-
- /*
- * One optional operand -- the return value
- * It can be either an immediate operand or a result that
- * has been bubbled up the tree
- */
- if (Op->Common.Value.Arg)
- {
- /* Since we have a real Return(), delete any implicit return */
-
- AcpiDsClearImplicitReturn (WalkState);
-
- /* Return statement has an immediate operand */
-
- Status = AcpiDsCreateOperands (WalkState, Op->Common.Value.Arg);
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
-
- /*
- * If value being returned is a Reference (such as
- * an arg or local), resolve it now because it may
- * cease to exist at the end of the method.
- */
- Status = AcpiExResolveToValue (&WalkState->Operands [0], WalkState);
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
-
- /*
- * Get the return value and save as the last result
- * value. This is the only place where WalkState->ReturnDesc
- * is set to anything other than zero!
- */
- WalkState->ReturnDesc = WalkState->Operands[0];
- }
- else if (WalkState->ResultCount)
- {
- /* Since we have a real Return(), delete any implicit return */
-
- AcpiDsClearImplicitReturn (WalkState);
-
- /*
- * The return value has come from a previous calculation.
- *
- * If value being returned is a Reference (such as
- * an arg or local), resolve it now because it may
- * cease to exist at the end of the method.
- *
- * Allow references created by the Index operator to return unchanged.
- */
- if ((ACPI_GET_DESCRIPTOR_TYPE (WalkState->Results->Results.ObjDesc[0]) == ACPI_DESC_TYPE_OPERAND) &&
- ((WalkState->Results->Results.ObjDesc [0])->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
- ((WalkState->Results->Results.ObjDesc [0])->Reference.Class != ACPI_REFCLASS_INDEX))
- {
- Status = AcpiExResolveToValue (&WalkState->Results->Results.ObjDesc [0], WalkState);
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
- }
-
- WalkState->ReturnDesc = WalkState->Results->Results.ObjDesc [0];
- }
- else
- {
- /* No return operand */
-
- if (WalkState->NumOperands)
- {
- AcpiUtRemoveReference (WalkState->Operands [0]);
- }
-
- WalkState->Operands [0] = NULL;
- WalkState->NumOperands = 0;
- WalkState->ReturnDesc = NULL;
- }
-
-
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "Completed RETURN_OP State=%p, RetVal=%p\n",
- WalkState, WalkState->ReturnDesc));
-
- /* End the control method execution right now */
-
- Status = AE_CTRL_TERMINATE;
- break;
-
-
- case AML_NOOP_OP:
-
- /* Just do nothing! */
- break;
-
-
- case AML_BREAK_POINT_OP:
-
- /*
- * Set the single-step flag. This will cause the debugger (if present)
- * to break to the console within the AML debugger at the start of the
- * next AML instruction.
- */
- ACPI_DEBUGGER_EXEC (
- AcpiGbl_CmSingleStep = TRUE);
- ACPI_DEBUGGER_EXEC (
- AcpiOsPrintf ("**break** Executed AML BreakPoint opcode\n"));
-
- /* Call to the OSL in case OS wants a piece of the action */
-
- Status = AcpiOsSignal (ACPI_SIGNAL_BREAKPOINT,
- "Executed AML Breakpoint opcode");
- break;
-
-
- case AML_BREAK_OP:
- case AML_CONTINUE_OP: /* ACPI 2.0 */
-
-
- /* Pop and delete control states until we find a while */
-
- while (WalkState->ControlState &&
- (WalkState->ControlState->Control.Opcode != AML_WHILE_OP))
- {
- ControlState = AcpiUtPopGenericState (&WalkState->ControlState);
- AcpiUtDeleteGenericState (ControlState);
- }
-
- /* No while found? */
-
- if (!WalkState->ControlState)
- {
- return (AE_AML_NO_WHILE);
- }
-
- /* Was: WalkState->AmlLastWhile = WalkState->ControlState->Control.AmlPredicateStart; */
-
- WalkState->AmlLastWhile = WalkState->ControlState->Control.PackageEnd;
-
- /* Return status depending on opcode */
-
- if (Op->Common.AmlOpcode == AML_BREAK_OP)
- {
- Status = AE_CTRL_BREAK;
- }
- else
- {
- Status = AE_CTRL_CONTINUE;
- }
- break;
-
-
- default:
-
- ACPI_ERROR ((AE_INFO, "Unknown control opcode=0x%X Op=%p",
- Op->Common.AmlOpcode, Op));
-
- Status = AE_AML_BAD_OPCODE;
- break;
- }
-
- return (Status);
-}
-
diff --git a/dispatcher/dswload.c b/dispatcher/dswload.c
index 9df7dbaaefda..97c3a9486c7f 100644
--- a/dispatcher/dswload.c
+++ b/dispatcher/dswload.c
@@ -1,6 +1,6 @@
/******************************************************************************
*
- * Module Name: dswload - Dispatcher namespace load callbacks
+ * Module Name: dswload - Dispatcher first pass namespace load callbacks
*
*****************************************************************************/
@@ -50,7 +50,6 @@
#include "acdispat.h"
#include "acinterp.h"
#include "acnamesp.h"
-#include "acevents.h"
#ifdef ACPI_ASL_COMPILER
#include "acdisasm.h"
@@ -550,695 +549,3 @@ AcpiDsLoad1EndOp (
return_ACPI_STATUS (Status);
}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsLoad2BeginOp
- *
- * PARAMETERS: WalkState - Current state of the parse tree walk
- * OutOp - Wher to return op if a new one is created
- *
- * RETURN: Status
- *
- * DESCRIPTION: Descending callback used during the loading of ACPI tables.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsLoad2BeginOp (
- ACPI_WALK_STATE *WalkState,
- ACPI_PARSE_OBJECT **OutOp)
-{
- ACPI_PARSE_OBJECT *Op;
- ACPI_NAMESPACE_NODE *Node;
- ACPI_STATUS Status;
- ACPI_OBJECT_TYPE ObjectType;
- char *BufferPtr;
- UINT32 Flags;
-
-
- ACPI_FUNCTION_TRACE (DsLoad2BeginOp);
-
-
- Op = WalkState->Op;
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState));
-
- if (Op)
- {
- if ((WalkState->ControlState) &&
- (WalkState->ControlState->Common.State ==
- ACPI_CONTROL_CONDITIONAL_EXECUTING))
- {
- /* We are executing a while loop outside of a method */
-
- Status = AcpiDsExecBeginOp (WalkState, OutOp);
- return_ACPI_STATUS (Status);
- }
-
- /* We only care about Namespace opcodes here */
-
- if ((!(WalkState->OpInfo->Flags & AML_NSOPCODE) &&
- (WalkState->Opcode != AML_INT_NAMEPATH_OP)) ||
- (!(WalkState->OpInfo->Flags & AML_NAMED)))
- {
- return_ACPI_STATUS (AE_OK);
- }
-
- /* Get the name we are going to enter or lookup in the namespace */
-
- if (WalkState->Opcode == AML_INT_NAMEPATH_OP)
- {
- /* For Namepath op, get the path string */
-
- BufferPtr = Op->Common.Value.String;
- if (!BufferPtr)
- {
- /* No name, just exit */
-
- return_ACPI_STATUS (AE_OK);
- }
- }
- else
- {
- /* Get name from the op */
-
- BufferPtr = ACPI_CAST_PTR (char, &Op->Named.Name);
- }
- }
- else
- {
- /* Get the namestring from the raw AML */
-
- BufferPtr = AcpiPsGetNextNamestring (&WalkState->ParserState);
- }
-
- /* Map the opcode into an internal object type */
-
- ObjectType = WalkState->OpInfo->ObjectType;
-
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "State=%p Op=%p Type=%X\n", WalkState, Op, ObjectType));
-
- switch (WalkState->Opcode)
- {
- case AML_FIELD_OP:
- case AML_BANK_FIELD_OP:
- case AML_INDEX_FIELD_OP:
-
- Node = NULL;
- Status = AE_OK;
- 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
- * for use later.
- */
- Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType,
- ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
- WalkState, &(Node));
- break;
-
- case AML_SCOPE_OP:
-
- /* Special case for Scope(\) -> refers to the Root node */
-
- if (Op && (Op->Named.Node == AcpiGbl_RootNode))
- {
- Node = Op->Named.Node;
-
- Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
- }
- else
- {
- /*
- * The Path is an object reference to an existing object.
- * Don't enter the name into the namespace, but look it up
- * for use later.
- */
- Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType,
- ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
- WalkState, &(Node));
- if (ACPI_FAILURE (Status))
- {
-#ifdef ACPI_ASL_COMPILER
- if (Status == AE_NOT_FOUND)
- {
- Status = AE_OK;
- }
- else
- {
- ACPI_ERROR_NAMESPACE (BufferPtr, Status);
- }
-#else
- 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:
- case ACPI_TYPE_PROCESSOR:
- case ACPI_TYPE_THERMAL:
-
- /* These are acceptable types */
- break;
-
- case ACPI_TYPE_INTEGER:
- case ACPI_TYPE_STRING:
- case ACPI_TYPE_BUFFER:
-
- /*
- * These types we will allow, but we will change the type.
- * This enables some existing code of the form:
- *
- * Name (DEB, 0)
- * Scope (DEB) { ... }
- */
- ACPI_WARNING ((AE_INFO,
- "Type override - [%4.4s] had invalid type (%s) "
- "for Scope operator, changed to type ANY\n",
- AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type)));
-
- Node->Type = ACPI_TYPE_ANY;
- WalkState->ScopeInfo->Common.Value = ACPI_TYPE_ANY;
- break;
-
- default:
-
- /* All other types are an error */
-
- ACPI_ERROR ((AE_INFO,
- "Invalid type (%s) for target of "
- "Scope operator [%4.4s] (Cannot override)",
- AcpiUtGetTypeName (Node->Type), AcpiUtGetNodeName (Node)));
-
- return (AE_AML_OPERAND_TYPE);
- }
- break;
-
- default:
-
- /* All other opcodes */
-
- if (Op && Op->Common.Node)
- {
- /* This op/node was previously entered into the namespace */
-
- Node = Op->Common.Node;
-
- if (AcpiNsOpensScope (ObjectType))
- {
- Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState);
- if (ACPI_FAILURE (Status))
- {
- 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
- * involve arguments to the opcode must be created as we go back up the
- * parse tree later.
- *
- * Note: Name may already exist if we are executing a deferred opcode.
- */
- if (WalkState->DeferredNode)
- {
- /* This name is already in the namespace, get the node */
-
- Node = WalkState->DeferredNode;
- Status = AE_OK;
- break;
- }
-
- 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;
-
- if (!(WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL))
- {
- Flags |= ACPI_NS_TEMPORARY;
- }
- }
-
- /* Add new entry or lookup existing entry */
-
- Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType,
- ACPI_IMODE_LOAD_PASS2, Flags, WalkState, &Node);
-
- if (ACPI_SUCCESS (Status) && (Flags & ACPI_NS_TEMPORARY))
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "***New Node [%4.4s] %p is temporary\n",
- AcpiUtGetNodeName (Node), Node));
- }
- break;
- }
-
- if (ACPI_FAILURE (Status))
- {
- ACPI_ERROR_NAMESPACE (BufferPtr, Status);
- return_ACPI_STATUS (Status);
- }
-
- if (!Op)
- {
- /* Create a new op */
-
- Op = AcpiPsAllocOp (WalkState->Opcode);
- if (!Op)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- /* Initialize the new op */
-
- if (Node)
- {
- Op->Named.Name = Node->Name.Integer;
- }
- *OutOp = Op;
- }
-
- /*
- * 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;
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsLoad2EndOp
- *
- * PARAMETERS: WalkState - Current state of the parse tree walk
- *
- * RETURN: Status
- *
- * DESCRIPTION: Ascending callback used during the loading of the namespace,
- * both control methods and everything else.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsLoad2EndOp (
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_PARSE_OBJECT *Op;
- ACPI_STATUS Status = AE_OK;
- ACPI_OBJECT_TYPE ObjectType;
- ACPI_NAMESPACE_NODE *Node;
- ACPI_PARSE_OBJECT *Arg;
- ACPI_NAMESPACE_NODE *NewNode;
-#ifndef ACPI_NO_METHOD_EXECUTION
- UINT32 i;
- UINT8 RegionSpace;
-#endif
-
-
- ACPI_FUNCTION_TRACE (DsLoad2EndOp);
-
- Op = WalkState->Op;
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n",
- WalkState->OpInfo->Name, Op, WalkState));
-
- /* Check if opcode had an associated namespace object */
-
- if (!(WalkState->OpInfo->Flags & AML_NSOBJECT))
- {
- return_ACPI_STATUS (AE_OK);
- }
-
- if (Op->Common.AmlOpcode == AML_SCOPE_OP)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "Ending scope Op=%p State=%p\n", Op, WalkState));
- }
-
- ObjectType = WalkState->OpInfo->ObjectType;
-
- /*
- * Get the Node/name from the earlier lookup
- * (It was saved in the *op structure)
- */
- Node = Op->Common.Node;
-
- /*
- * Put the Node on the object stack (Contains the ACPI Name of
- * this object)
- */
- WalkState->Operands[0] = (void *) Node;
- WalkState->NumOperands = 1;
-
- /* Pop the scope stack */
-
- if (AcpiNsOpensScope (ObjectType) &&
- (Op->Common.AmlOpcode != AML_INT_METHODCALL_OP))
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n",
- AcpiUtGetTypeName (ObjectType), Op));
-
- Status = AcpiDsScopeStackPop (WalkState);
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
- }
-
- /*
- * Named operations are as follows:
- *
- * AML_ALIAS
- * AML_BANKFIELD
- * AML_CREATEBITFIELD
- * AML_CREATEBYTEFIELD
- * AML_CREATEDWORDFIELD
- * AML_CREATEFIELD
- * AML_CREATEQWORDFIELD
- * AML_CREATEWORDFIELD
- * AML_DATA_REGION
- * AML_DEVICE
- * AML_EVENT
- * AML_FIELD
- * AML_INDEXFIELD
- * AML_METHOD
- * AML_METHODCALL
- * AML_MUTEX
- * AML_NAME
- * AML_NAMEDFIELD
- * AML_OPREGION
- * AML_POWERRES
- * AML_PROCESSOR
- * AML_SCOPE
- * AML_THERMALZONE
- */
-
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "Create-Load [%s] State=%p Op=%p NamedObj=%p\n",
- AcpiPsGetOpcodeName (Op->Common.AmlOpcode), WalkState, Op, Node));
-
- /* Decode the opcode */
-
- Arg = Op->Common.Value.Arg;
-
- switch (WalkState->OpInfo->Type)
- {
-#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
- */
- Status = AcpiDsCreateBufferField (Op, WalkState);
- break;
-
-
- 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)
- {
- case AML_INDEX_FIELD_OP:
-
- Status = AcpiDsCreateIndexField (Op, (ACPI_HANDLE) Arg->Common.Node,
- WalkState);
- break;
-
- case AML_BANK_FIELD_OP:
-
- Status = AcpiDsCreateBankField (Op, Arg->Common.Node, WalkState);
- break;
-
- case AML_FIELD_OP:
-
- Status = AcpiDsCreateField (Op, Arg->Common.Node, WalkState);
- break;
-
- default:
- /* All NAMED_FIELD opcodes must be handled above */
- break;
- }
- break;
-
-
- case AML_TYPE_NAMED_SIMPLE:
-
- Status = AcpiDsCreateOperands (WalkState, Arg);
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
-
- switch (Op->Common.AmlOpcode)
- {
- case AML_PROCESSOR_OP:
-
- Status = AcpiExCreateProcessor (WalkState);
- break;
-
- case AML_POWER_RES_OP:
-
- Status = AcpiExCreatePowerResource (WalkState);
- break;
-
- case AML_MUTEX_OP:
-
- Status = AcpiExCreateMutex (WalkState);
- break;
-
- case AML_EVENT_OP:
-
- Status = AcpiExCreateEvent (WalkState);
- break;
-
-
- case AML_ALIAS_OP:
-
- Status = AcpiExCreateAlias (WalkState);
- break;
-
- default:
- /* Unknown opcode */
-
- Status = AE_OK;
- goto Cleanup;
- }
-
- /* Delete operands */
-
- for (i = 1; i < WalkState->NumOperands; i++)
- {
- AcpiUtRemoveReference (WalkState->Operands[i]);
- WalkState->Operands[i] = NULL;
- }
-
- break;
-#endif /* ACPI_NO_METHOD_EXECUTION */
-
- case AML_TYPE_NAMED_COMPLEX:
-
- switch (Op->Common.AmlOpcode)
- {
-#ifndef ACPI_NO_METHOD_EXECUTION
- case AML_REGION_OP:
- case AML_DATA_REGION_OP:
-
- if (Op->Common.AmlOpcode == AML_REGION_OP)
- {
- RegionSpace = (ACPI_ADR_SPACE_TYPE)
- ((Op->Common.Value.Arg)->Common.Value.Integer);
- }
- else
- {
- RegionSpace = REGION_DATA_TABLE;
- }
-
- /*
- * The OpRegion is not fully parsed at this time. The only valid
- * argument is the SpaceId. (We must save the address of the
- * AML of the address and length operands)
- *
- * If we have a valid region, initialize it. The namespace is
- * unlocked at this point.
- *
- * Need to unlock interpreter if it is locked (if we are running
- * a control method), in order to allow _REG methods to be run
- * during AcpiEvInitializeRegion.
- */
- if (WalkState->MethodNode)
- {
- /*
- * Executing a method: initialize the region and unlock
- * the interpreter
- */
- Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length,
- RegionSpace, WalkState);
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
-
- AcpiExExitInterpreter ();
- }
-
- Status = AcpiEvInitializeRegion (AcpiNsGetAttachedObject (Node),
- FALSE);
- if (WalkState->MethodNode)
- {
- AcpiExEnterInterpreter ();
- }
-
- if (ACPI_FAILURE (Status))
- {
- /*
- * If AE_NOT_EXIST is returned, it is not fatal
- * because many regions get created before a handler
- * is installed for said region.
- */
- if (AE_NOT_EXIST == Status)
- {
- Status = AE_OK;
- }
- }
- break;
-
-
- case AML_NAME_OP:
-
- Status = AcpiDsCreateNode (WalkState, Node, Op);
- break;
-
-
- 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 */
- break;
- }
- break;
-
-
- case AML_CLASS_INTERNAL:
-
- /* case AML_INT_NAMEPATH_OP: */
- break;
-
-
- case AML_CLASS_METHOD_CALL:
-
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "RESOLVING-MethodCall: State=%p Op=%p NamedObj=%p\n",
- WalkState, Op, Node));
-
- /*
- * Lookup the method name and save the Node
- */
- Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String,
- ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS2,
- ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
- WalkState, &(NewNode));
- if (ACPI_SUCCESS (Status))
- {
- /*
- * Make sure that what we found is indeed a method
- * We didn't search for a method on purpose, to see if the name
- * would resolve
- */
- if (NewNode->Type != ACPI_TYPE_METHOD)
- {
- Status = AE_AML_OPERAND_TYPE;
- }
-
- /* 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
- */
- Op->Common.Node = NewNode;
- }
- else
- {
- ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status);
- }
- break;
-
-
- default:
- break;
- }
-
-Cleanup:
-
- /* Remove the Node pushed at the very beginning */
-
- WalkState->Operands[0] = NULL;
- WalkState->NumOperands = 0;
- return_ACPI_STATUS (Status);
-}
-
-
diff --git a/dispatcher/dswload2.c b/dispatcher/dswload2.c
new file mode 100644
index 000000000000..be8055856fef
--- /dev/null
+++ b/dispatcher/dswload2.c
@@ -0,0 +1,747 @@
+/******************************************************************************
+ *
+ * Module Name: dswload2 - Dispatcher second pass namespace load callbacks
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2011, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * substantially similar to the "NO WARRANTY" disclaimer below
+ * ("Disclaimer") and any redistribution must be conditioned upon
+ * including a substantially similar Disclaimer requirement for further
+ * binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ * of any contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#define __DSWLOAD2_C__
+
+#include "acpi.h"
+#include "accommon.h"
+#include "acparser.h"
+#include "amlcode.h"
+#include "acdispat.h"
+#include "acinterp.h"
+#include "acnamesp.h"
+#include "acevents.h"
+
+#define _COMPONENT ACPI_DISPATCHER
+ ACPI_MODULE_NAME ("dswload2")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsLoad2BeginOp
+ *
+ * PARAMETERS: WalkState - Current state of the parse tree walk
+ * OutOp - Wher to return op if a new one is created
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Descending callback used during the loading of ACPI tables.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsLoad2BeginOp (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT **OutOp)
+{
+ ACPI_PARSE_OBJECT *Op;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_STATUS Status;
+ ACPI_OBJECT_TYPE ObjectType;
+ char *BufferPtr;
+ UINT32 Flags;
+
+
+ ACPI_FUNCTION_TRACE (DsLoad2BeginOp);
+
+
+ Op = WalkState->Op;
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState));
+
+ if (Op)
+ {
+ if ((WalkState->ControlState) &&
+ (WalkState->ControlState->Common.State ==
+ ACPI_CONTROL_CONDITIONAL_EXECUTING))
+ {
+ /* We are executing a while loop outside of a method */
+
+ Status = AcpiDsExecBeginOp (WalkState, OutOp);
+ return_ACPI_STATUS (Status);
+ }
+
+ /* We only care about Namespace opcodes here */
+
+ if ((!(WalkState->OpInfo->Flags & AML_NSOPCODE) &&
+ (WalkState->Opcode != AML_INT_NAMEPATH_OP)) ||
+ (!(WalkState->OpInfo->Flags & AML_NAMED)))
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Get the name we are going to enter or lookup in the namespace */
+
+ if (WalkState->Opcode == AML_INT_NAMEPATH_OP)
+ {
+ /* For Namepath op, get the path string */
+
+ BufferPtr = Op->Common.Value.String;
+ if (!BufferPtr)
+ {
+ /* No name, just exit */
+
+ return_ACPI_STATUS (AE_OK);
+ }
+ }
+ else
+ {
+ /* Get name from the op */
+
+ BufferPtr = ACPI_CAST_PTR (char, &Op->Named.Name);
+ }
+ }
+ else
+ {
+ /* Get the namestring from the raw AML */
+
+ BufferPtr = AcpiPsGetNextNamestring (&WalkState->ParserState);
+ }
+
+ /* Map the opcode into an internal object type */
+
+ ObjectType = WalkState->OpInfo->ObjectType;
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "State=%p Op=%p Type=%X\n", WalkState, Op, ObjectType));
+
+ switch (WalkState->Opcode)
+ {
+ case AML_FIELD_OP:
+ case AML_BANK_FIELD_OP:
+ case AML_INDEX_FIELD_OP:
+
+ Node = NULL;
+ Status = AE_OK;
+ 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
+ * for use later.
+ */
+ Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType,
+ ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
+ WalkState, &(Node));
+ break;
+
+ case AML_SCOPE_OP:
+
+ /* Special case for Scope(\) -> refers to the Root node */
+
+ if (Op && (Op->Named.Node == AcpiGbl_RootNode))
+ {
+ Node = Op->Named.Node;
+
+ Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+ else
+ {
+ /*
+ * The Path is an object reference to an existing object.
+ * Don't enter the name into the namespace, but look it up
+ * for use later.
+ */
+ Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType,
+ ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
+ WalkState, &(Node));
+ if (ACPI_FAILURE (Status))
+ {
+#ifdef ACPI_ASL_COMPILER
+ if (Status == AE_NOT_FOUND)
+ {
+ Status = AE_OK;
+ }
+ else
+ {
+ ACPI_ERROR_NAMESPACE (BufferPtr, Status);
+ }
+#else
+ 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:
+ case ACPI_TYPE_PROCESSOR:
+ case ACPI_TYPE_THERMAL:
+
+ /* These are acceptable types */
+ break;
+
+ case ACPI_TYPE_INTEGER:
+ case ACPI_TYPE_STRING:
+ case ACPI_TYPE_BUFFER:
+
+ /*
+ * These types we will allow, but we will change the type.
+ * This enables some existing code of the form:
+ *
+ * Name (DEB, 0)
+ * Scope (DEB) { ... }
+ */
+ ACPI_WARNING ((AE_INFO,
+ "Type override - [%4.4s] had invalid type (%s) "
+ "for Scope operator, changed to type ANY\n",
+ AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type)));
+
+ Node->Type = ACPI_TYPE_ANY;
+ WalkState->ScopeInfo->Common.Value = ACPI_TYPE_ANY;
+ break;
+
+ default:
+
+ /* All other types are an error */
+
+ ACPI_ERROR ((AE_INFO,
+ "Invalid type (%s) for target of "
+ "Scope operator [%4.4s] (Cannot override)",
+ AcpiUtGetTypeName (Node->Type), AcpiUtGetNodeName (Node)));
+
+ return (AE_AML_OPERAND_TYPE);
+ }
+ break;
+
+ default:
+
+ /* All other opcodes */
+
+ if (Op && Op->Common.Node)
+ {
+ /* This op/node was previously entered into the namespace */
+
+ Node = Op->Common.Node;
+
+ if (AcpiNsOpensScope (ObjectType))
+ {
+ Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ 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
+ * involve arguments to the opcode must be created as we go back up the
+ * parse tree later.
+ *
+ * Note: Name may already exist if we are executing a deferred opcode.
+ */
+ if (WalkState->DeferredNode)
+ {
+ /* This name is already in the namespace, get the node */
+
+ Node = WalkState->DeferredNode;
+ Status = AE_OK;
+ break;
+ }
+
+ 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;
+
+ if (!(WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL))
+ {
+ Flags |= ACPI_NS_TEMPORARY;
+ }
+ }
+
+ /* Add new entry or lookup existing entry */
+
+ Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType,
+ ACPI_IMODE_LOAD_PASS2, Flags, WalkState, &Node);
+
+ if (ACPI_SUCCESS (Status) && (Flags & ACPI_NS_TEMPORARY))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "***New Node [%4.4s] %p is temporary\n",
+ AcpiUtGetNodeName (Node), Node));
+ }
+ break;
+ }
+
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_ERROR_NAMESPACE (BufferPtr, Status);
+ return_ACPI_STATUS (Status);
+ }
+
+ if (!Op)
+ {
+ /* Create a new op */
+
+ Op = AcpiPsAllocOp (WalkState->Opcode);
+ if (!Op)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /* Initialize the new op */
+
+ if (Node)
+ {
+ Op->Named.Name = Node->Name.Integer;
+ }
+ *OutOp = Op;
+ }
+
+ /*
+ * 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;
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsLoad2EndOp
+ *
+ * PARAMETERS: WalkState - Current state of the parse tree walk
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Ascending callback used during the loading of the namespace,
+ * both control methods and everything else.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiDsLoad2EndOp (
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_PARSE_OBJECT *Op;
+ ACPI_STATUS Status = AE_OK;
+ ACPI_OBJECT_TYPE ObjectType;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_PARSE_OBJECT *Arg;
+ ACPI_NAMESPACE_NODE *NewNode;
+#ifndef ACPI_NO_METHOD_EXECUTION
+ UINT32 i;
+ UINT8 RegionSpace;
+#endif
+
+
+ ACPI_FUNCTION_TRACE (DsLoad2EndOp);
+
+ Op = WalkState->Op;
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n",
+ WalkState->OpInfo->Name, Op, WalkState));
+
+ /* Check if opcode had an associated namespace object */
+
+ if (!(WalkState->OpInfo->Flags & AML_NSOBJECT))
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ if (Op->Common.AmlOpcode == AML_SCOPE_OP)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "Ending scope Op=%p State=%p\n", Op, WalkState));
+ }
+
+ ObjectType = WalkState->OpInfo->ObjectType;
+
+ /*
+ * Get the Node/name from the earlier lookup
+ * (It was saved in the *op structure)
+ */
+ Node = Op->Common.Node;
+
+ /*
+ * Put the Node on the object stack (Contains the ACPI Name of
+ * this object)
+ */
+ WalkState->Operands[0] = (void *) Node;
+ WalkState->NumOperands = 1;
+
+ /* Pop the scope stack */
+
+ if (AcpiNsOpensScope (ObjectType) &&
+ (Op->Common.AmlOpcode != AML_INT_METHODCALL_OP))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n",
+ AcpiUtGetTypeName (ObjectType), Op));
+
+ Status = AcpiDsScopeStackPop (WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+ }
+
+ /*
+ * Named operations are as follows:
+ *
+ * AML_ALIAS
+ * AML_BANKFIELD
+ * AML_CREATEBITFIELD
+ * AML_CREATEBYTEFIELD
+ * AML_CREATEDWORDFIELD
+ * AML_CREATEFIELD
+ * AML_CREATEQWORDFIELD
+ * AML_CREATEWORDFIELD
+ * AML_DATA_REGION
+ * AML_DEVICE
+ * AML_EVENT
+ * AML_FIELD
+ * AML_INDEXFIELD
+ * AML_METHOD
+ * AML_METHODCALL
+ * AML_MUTEX
+ * AML_NAME
+ * AML_NAMEDFIELD
+ * AML_OPREGION
+ * AML_POWERRES
+ * AML_PROCESSOR
+ * AML_SCOPE
+ * AML_THERMALZONE
+ */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "Create-Load [%s] State=%p Op=%p NamedObj=%p\n",
+ AcpiPsGetOpcodeName (Op->Common.AmlOpcode), WalkState, Op, Node));
+
+ /* Decode the opcode */
+
+ Arg = Op->Common.Value.Arg;
+
+ switch (WalkState->OpInfo->Type)
+ {
+#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
+ */
+ Status = AcpiDsCreateBufferField (Op, WalkState);
+ break;
+
+
+ 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)
+ {
+ case AML_INDEX_FIELD_OP:
+
+ Status = AcpiDsCreateIndexField (Op, (ACPI_HANDLE) Arg->Common.Node,
+ WalkState);
+ break;
+
+ case AML_BANK_FIELD_OP:
+
+ Status = AcpiDsCreateBankField (Op, Arg->Common.Node, WalkState);
+ break;
+
+ case AML_FIELD_OP:
+
+ Status = AcpiDsCreateField (Op, Arg->Common.Node, WalkState);
+ break;
+
+ default:
+ /* All NAMED_FIELD opcodes must be handled above */
+ break;
+ }
+ break;
+
+
+ case AML_TYPE_NAMED_SIMPLE:
+
+ Status = AcpiDsCreateOperands (WalkState, Arg);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+
+ switch (Op->Common.AmlOpcode)
+ {
+ case AML_PROCESSOR_OP:
+
+ Status = AcpiExCreateProcessor (WalkState);
+ break;
+
+ case AML_POWER_RES_OP:
+
+ Status = AcpiExCreatePowerResource (WalkState);
+ break;
+
+ case AML_MUTEX_OP:
+
+ Status = AcpiExCreateMutex (WalkState);
+ break;
+
+ case AML_EVENT_OP:
+
+ Status = AcpiExCreateEvent (WalkState);
+ break;
+
+
+ case AML_ALIAS_OP:
+
+ Status = AcpiExCreateAlias (WalkState);
+ break;
+
+ default:
+ /* Unknown opcode */
+
+ Status = AE_OK;
+ goto Cleanup;
+ }
+
+ /* Delete operands */
+
+ for (i = 1; i < WalkState->NumOperands; i++)
+ {
+ AcpiUtRemoveReference (WalkState->Operands[i]);
+ WalkState->Operands[i] = NULL;
+ }
+
+ break;
+#endif /* ACPI_NO_METHOD_EXECUTION */
+
+ case AML_TYPE_NAMED_COMPLEX:
+
+ switch (Op->Common.AmlOpcode)
+ {
+#ifndef ACPI_NO_METHOD_EXECUTION
+ case AML_REGION_OP:
+ case AML_DATA_REGION_OP:
+
+ if (Op->Common.AmlOpcode == AML_REGION_OP)
+ {
+ RegionSpace = (ACPI_ADR_SPACE_TYPE)
+ ((Op->Common.Value.Arg)->Common.Value.Integer);
+ }
+ else
+ {
+ RegionSpace = REGION_DATA_TABLE;
+ }
+
+ /*
+ * The OpRegion is not fully parsed at this time. The only valid
+ * argument is the SpaceId. (We must save the address of the
+ * AML of the address and length operands)
+ *
+ * If we have a valid region, initialize it. The namespace is
+ * unlocked at this point.
+ *
+ * Need to unlock interpreter if it is locked (if we are running
+ * a control method), in order to allow _REG methods to be run
+ * during AcpiEvInitializeRegion.
+ */
+ if (WalkState->MethodNode)
+ {
+ /*
+ * Executing a method: initialize the region and unlock
+ * the interpreter
+ */
+ Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length,
+ RegionSpace, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ AcpiExExitInterpreter ();
+ }
+
+ Status = AcpiEvInitializeRegion (AcpiNsGetAttachedObject (Node),
+ FALSE);
+ if (WalkState->MethodNode)
+ {
+ AcpiExEnterInterpreter ();
+ }
+
+ if (ACPI_FAILURE (Status))
+ {
+ /*
+ * If AE_NOT_EXIST is returned, it is not fatal
+ * because many regions get created before a handler
+ * is installed for said region.
+ */
+ if (AE_NOT_EXIST == Status)
+ {
+ Status = AE_OK;
+ }
+ }
+ break;
+
+
+ case AML_NAME_OP:
+
+ Status = AcpiDsCreateNode (WalkState, Node, Op);
+ break;
+
+
+ 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 */
+ break;
+ }
+ break;
+
+
+ case AML_CLASS_INTERNAL:
+
+ /* case AML_INT_NAMEPATH_OP: */
+ break;
+
+
+ case AML_CLASS_METHOD_CALL:
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "RESOLVING-MethodCall: State=%p Op=%p NamedObj=%p\n",
+ WalkState, Op, Node));
+
+ /*
+ * Lookup the method name and save the Node
+ */
+ Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String,
+ ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS2,
+ ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
+ WalkState, &(NewNode));
+ if (ACPI_SUCCESS (Status))
+ {
+ /*
+ * Make sure that what we found is indeed a method
+ * We didn't search for a method on purpose, to see if the name
+ * would resolve
+ */
+ if (NewNode->Type != ACPI_TYPE_METHOD)
+ {
+ Status = AE_AML_OPERAND_TYPE;
+ }
+
+ /* 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
+ */
+ Op->Common.Node = NewNode;
+ }
+ else
+ {
+ ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status);
+ }
+ break;
+
+
+ default:
+ break;
+ }
+
+Cleanup:
+
+ /* Remove the Node pushed at the very beginning */
+
+ WalkState->Operands[0] = NULL;
+ WalkState->NumOperands = 0;
+ return_ACPI_STATUS (Status);
+}
+
diff --git a/events/evgpe.c b/events/evgpe.c
index d86723bf6318..c4326c721bc3 100644
--- a/events/evgpe.c
+++ b/events/evgpe.c
@@ -422,6 +422,16 @@ AcpiEvGpeDetect (
GpeRegisterInfo = &GpeBlock->RegisterInfo[i];
+ /*
+ * Optimization: If there are no GPEs enabled within this
+ * register, we can safely ignore the entire register.
+ */
+ if (!(GpeRegisterInfo->EnableForRun |
+ GpeRegisterInfo->EnableForWake))
+ {
+ continue;
+ }
+
/* Read the Status Register */
Status = AcpiHwRead (&StatusReg, &GpeRegisterInfo->StatusAddress);
diff --git a/events/evregion.c b/events/evregion.c
index f5ee81b88379..aac9258eec72 100644
--- a/events/evregion.c
+++ b/events/evregion.c
@@ -262,6 +262,8 @@ AcpiEvInitializeOpRegions (
}
}
+ AcpiGbl_RegMethodsExecuted = TRUE;
+
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (Status);
}
diff --git a/events/evxfregn.c b/events/evxfregn.c
index 3e1bb2f38e82..5f6893aaabc2 100644
--- a/events/evxfregn.c
+++ b/events/evxfregn.c
@@ -120,9 +120,41 @@ AcpiInstallAddressSpaceHandler (
goto UnlockAndExit;
}
- /* Run all _REG methods for this address space */
+ /*
+ * For the default SpaceIDs, (the IDs for which there are default region handlers
+ * installed) Only execute the _REG methods if the global initialization _REG
+ * methods have already been run (via AcpiInitializeObjects). In other words,
+ * we will defer the execution of the _REG methods for these SpaceIDs until
+ * execution of AcpiInitializeObjects. This is done because we need the handlers
+ * for the default spaces (mem/io/pci/table) to be installed before we can run
+ * any control methods (or _REG methods). There is known BIOS code that depends
+ * on this.
+ *
+ * For all other SpaceIDs, we can safely execute the _REG methods immediately.
+ * This means that for IDs like EmbeddedController, this function should be called
+ * only after AcpiEnableSubsystem has been called.
+ */
+ switch (SpaceId)
+ {
+ case ACPI_ADR_SPACE_SYSTEM_MEMORY:
+ case ACPI_ADR_SPACE_SYSTEM_IO:
+ case ACPI_ADR_SPACE_PCI_CONFIG:
+ case ACPI_ADR_SPACE_DATA_TABLE:
+
+ if (AcpiGbl_RegMethodsExecuted)
+ {
+ /* Run all _REG methods for this address space */
+
+ Status = AcpiEvExecuteRegMethods (Node, SpaceId);
+ }
+ break;
+
+ default:
+
+ Status = AcpiEvExecuteRegMethods (Node, SpaceId);
+ break;
+ }
- Status = AcpiEvExecuteRegMethods (Node, SpaceId);
UnlockAndExit:
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
diff --git a/executer/exfldio.c b/executer/exfldio.c
index 5c9fff000e07..bf663a2f5ecc 100644
--- a/executer/exfldio.c
+++ b/executer/exfldio.c
@@ -298,14 +298,14 @@ AcpiExAccessRegion (
if (Status == AE_NOT_IMPLEMENTED)
{
ACPI_ERROR ((AE_INFO,
- "Region %s(0x%X) not implemented",
+ "Region %s (ID=%u) not implemented",
AcpiUtGetRegionName (RgnDesc->Region.SpaceId),
RgnDesc->Region.SpaceId));
}
else if (Status == AE_NOT_EXIST)
{
ACPI_ERROR ((AE_INFO,
- "Region %s(0x%X) has no handler",
+ "Region %s (ID=%u) has no handler",
AcpiUtGetRegionName (RgnDesc->Region.SpaceId),
RgnDesc->Region.SpaceId));
}
diff --git a/generate/unix/Makefile b/generate/unix/Makefile
new file mode 100644
index 000000000000..f1ca17f2632c
--- /dev/null
+++ b/generate/unix/Makefile
@@ -0,0 +1,31 @@
+#
+# Common make for acpica tools and utilities
+#
+include Makefile.config
+
+
+all: ${DIRS}
+${DIRS}: FORCE
+ @cd $@; make; ls -al $@
+
+clean: FORCE
+ @for d in ${DIRS}; do \
+ (cd $$d; \
+ if [ $$? -ne 0 ]; then \
+ echo "Bad element of DIRS: <$$d>"; \
+ else \
+ pwd; make clean; \
+ fi); \
+ done
+
+install: FORCE
+ @for d in ${DIRS}; do \
+ (cd $$d; \
+ if [ $$? -ne 0 ]; then \
+ echo "Bad element of DIRS: <$$d>"; \
+ else \
+ pwd; make install; \
+ fi); \
+ done
+
+FORCE:
diff --git a/generate/unix/Makefile.config b/generate/unix/Makefile.config
new file mode 100644
index 000000000000..160fa38afdbb
--- /dev/null
+++ b/generate/unix/Makefile.config
@@ -0,0 +1,87 @@
+#
+# Makefile.config
+#
+# Common configuration and setup file to generate the ACPICA tools and
+# utilities: acpiexec, acpisrc, acpixtract, and the iASL compiler.
+#
+# This file is included by the individual makefiles for each tool.
+#
+
+#
+# Configuration
+#
+HOST = _CYGWIN
+CC = gcc-4
+ACPICA_SRC = ../../../source
+DIRS = acpiexec acpinames acpisrc acpixtract iasl
+INSTALLDIR = /usr/bin
+
+#
+# Common defines
+#
+ASL_COMPILER = $(ACPICA_SRC)/compiler
+ACPICA_COMMON = $(ACPICA_SRC)/common
+ACPICA_CORE = $(ACPICA_SRC)/components
+ACPICA_TOOLS = $(ACPICA_SRC)/tools
+ACPICA_OSL = $(ACPICA_SRC)/os_specific/service_layers
+COMPILE = $(CC) -c $(CFLAGS) $(CWARNINGFLAGS) -o$@ $?
+COPYPROG = @mkdir -p ../bin; rm -f ../bin/$(PROG); cp --remove-destination $(PROG) ../bin
+INSTALLPROG = cp --remove-destination $(PROG) $(INSTALLDIR)
+
+#
+# Common compiler flags. The warning flags in addition to -Wall are not
+# automatically included in -Wall.
+#
+CFLAGS+= -Os -D$(HOST) -I$(ACPICA_SRC)/include -D_GNU_SOURCE
+CWARNINGFLAGS = \
+ -ansi \
+ -Wall \
+ -Wbad-function-cast \
+ -Wdeclaration-after-statement \
+ -Werror \
+ -Wformat=2 \
+ -Wmissing-declarations \
+ -Wmissing-prototypes \
+ -Wstrict-aliasing=2 \
+ -Wstrict-prototypes \
+ -Wswitch-default \
+ -Wpointer-arith \
+ -Wundef
+
+#
+# gcc 4+ flags
+#
+CWARNINGFLAGS+= \
+ -Waddress \
+ -Waggregate-return \
+ -Wchar-subscripts \
+ -Wempty-body \
+ -Wlogical-op \
+ -Wmissing-declarations \
+ -Wmissing-field-initializers \
+ -Wmissing-parameter-type \
+ -Wnested-externs \
+ -Wold-style-declaration \
+ -Wold-style-definition \
+ -Wredundant-decls \
+ -Wtype-limits
+
+#
+# Extra warning flags (possible future use)
+#
+#CWARNINGFLAGS+= \
+# -Wredundant-decls \
+# -Wunreachable-code \
+# -Wcast-qual \
+# -Wconversion
+# -Wshadow \
+
+#
+# Bison/Flex configuration
+#
+YACC= bison
+YFLAGS+= -v -d -y -pAslCompiler
+
+LEX= flex
+LFLAGS+= -i -s -PAslCompiler
+
diff --git a/generate/unix/acpiexec/Makefile b/generate/unix/acpiexec/Makefile
new file mode 100644
index 000000000000..68b82e35ce6e
--- /dev/null
+++ b/generate/unix/acpiexec/Makefile
@@ -0,0 +1,649 @@
+#
+# AcpiExec utility
+#
+include ../Makefile.config
+
+PROG = acpiexec
+
+
+#
+# Flags specific to acpiexec utility
+#
+CFLAGS+= -DACPI_EXEC_APP -I$(ACPICA_TOOLS)/acpiexec
+
+OBJS = \
+ aeexec.o \
+ aehandlers.o \
+ aemain.o \
+ aetables.o \
+ dbcmds.o \
+ dbdisply.o \
+ dbexec.o \
+ dbfileio.o \
+ dbhistry.o \
+ dbinput.o \
+ dbmethod.o \
+ dbnames.o \
+ dbstats.o \
+ dbutils.o \
+ dbxface.o \
+ dmbuffer.o \
+ dmnames.o \
+ dmobject.o \
+ dmopcode.o \
+ dmresrc.o \
+ dmresrcl.o \
+ dmresrcs.o \
+ dmutils.o \
+ dmwalk.o \
+ dsargs.o \
+ dscontrol.o \
+ dsfield.o \
+ dsinit.o \
+ dsmethod.o \
+ dsmthdat.o \
+ dsobject.o \
+ dsopcode.o \
+ dsutils.o \
+ dswexec.o \
+ dswload.o \
+ dswload2.o \
+ dswscope.o \
+ dswstate.o \
+ evevent.o \
+ evgpe.o \
+ evgpeblk.o \
+ evgpeinit.o \
+ evgpeutil.o \
+ evmisc.o \
+ evregion.o \
+ evrgnini.o \
+ evsci.o \
+ evxface.o \
+ evxfevnt.o \
+ evxfgpe.o \
+ evxfregn.o \
+ exconfig.o \
+ exconvrt.o \
+ excreate.o \
+ exdebug.o \
+ exdump.o \
+ exfield.o \
+ exfldio.o \
+ exmisc.o \
+ exmutex.o \
+ exnames.o \
+ exoparg1.o \
+ exoparg2.o \
+ exoparg3.o \
+ exoparg6.o \
+ exprep.o \
+ exregion.o \
+ exresnte.o \
+ exresolv.o \
+ exresop.o \
+ exstore.o \
+ exstoren.o \
+ exstorob.o \
+ exsystem.o \
+ exutils.o \
+ getopt.o \
+ hwacpi.o \
+ hwgpe.o \
+ hwpci.o \
+ hwregs.o \
+ hwsleep.o \
+ hwvalid.o \
+ hwxface.o \
+ nsaccess.o \
+ nsalloc.o \
+ nsdump.o \
+ nsdumpdv.o \
+ nseval.o \
+ nsinit.o \
+ nsload.o \
+ nsnames.o \
+ nsobject.o \
+ nsparse.o \
+ nspredef.o \
+ nsrepair.o \
+ nsrepair2.o \
+ nssearch.o \
+ nsutils.o \
+ nswalk.o \
+ nsxfeval.o \
+ nsxfname.o \
+ nsxfobj.o \
+ osunixxf.o \
+ psargs.o \
+ psloop.o \
+ psopcode.o \
+ psparse.o \
+ psscope.o \
+ pstree.o \
+ psutils.o \
+ pswalk.o \
+ psxface.o \
+ rsaddr.o \
+ rscalc.o \
+ rscreate.o \
+ rsdump.o \
+ rsinfo.o \
+ rsio.o \
+ rsirq.o \
+ rslist.o \
+ rsmemory.o \
+ rsmisc.o \
+ rsutils.o \
+ rsxface.o \
+ tbfadt.o \
+ tbfind.o \
+ tbinstal.o \
+ tbutils.o \
+ tbxface.o \
+ tbxfroot.o \
+ utalloc.o \
+ utcache.o \
+ utcopy.o \
+ utdebug.o \
+ utdecode.o \
+ utdelete.o \
+ uteval.o \
+ utglobal.o \
+ utids.o \
+ utinit.o \
+ utlock.o \
+ utmath.o \
+ utmisc.o \
+ utmutex.o \
+ utobject.o \
+ utresrc.o \
+ utstate.o \
+ uttrack.o \
+ utosi.o \
+ utxferror.o \
+ utxface.o
+
+
+#
+# Root rule
+#
+$(PROG) : $(OBJS)
+ $(CC) $(LDFLAGS) $(OBJS) -lpthread -o $(PROG)
+ $(COPYPROG)
+
+
+#
+# acpiexec source
+#
+aeexec.o : $(ACPICA_TOOLS)/acpiexec/aeexec.c
+ $(COMPILE)
+
+aehandlers.o : $(ACPICA_TOOLS)/acpiexec/aehandlers.c
+ $(COMPILE)
+
+aemain.o : $(ACPICA_TOOLS)/acpiexec/aemain.c
+ $(COMPILE)
+
+aetables.o : $(ACPICA_TOOLS)/acpiexec/aetables.c
+ $(COMPILE)
+
+
+#
+# ACPICA core source - common
+#
+getopt.o : $(ACPICA_COMMON)/getopt.c
+ $(COMPILE)
+
+
+#
+# ACPICA core source
+#
+dbcmds.o : $(ACPICA_CORE)/debugger/dbcmds.c
+ $(COMPILE)
+
+dbdisply.o : $(ACPICA_CORE)/debugger/dbdisply.c
+ $(COMPILE)
+
+dbexec.o : $(ACPICA_CORE)/debugger/dbexec.c
+ $(COMPILE)
+
+dbfileio.o : $(ACPICA_CORE)/debugger/dbfileio.c
+ $(COMPILE)
+
+dbhistry.o : $(ACPICA_CORE)/debugger/dbhistry.c
+ $(COMPILE)
+
+dbinput.o : $(ACPICA_CORE)/debugger/dbinput.c
+ $(COMPILE)
+
+dbmethod.o : $(ACPICA_CORE)/debugger/dbmethod.c
+ $(COMPILE)
+
+dbnames.o : $(ACPICA_CORE)/debugger/dbnames.c
+ $(COMPILE)
+
+dbstats.o : $(ACPICA_CORE)/debugger/dbstats.c
+ $(COMPILE)
+
+dbutils.o : $(ACPICA_CORE)/debugger/dbutils.c
+ $(COMPILE)
+
+dbxface.o : $(ACPICA_CORE)/debugger/dbxface.c
+ $(COMPILE)
+
+dmbuffer.o : $(ACPICA_CORE)/disassembler/dmbuffer.c
+ $(COMPILE)
+
+dmnames.o : $(ACPICA_CORE)/disassembler/dmnames.c
+ $(COMPILE)
+
+dmobject.o : $(ACPICA_CORE)/disassembler/dmobject.c
+ $(COMPILE)
+
+dmopcode.o : $(ACPICA_CORE)/disassembler/dmopcode.c
+ $(COMPILE)
+
+dmresrc.o : $(ACPICA_CORE)/disassembler/dmresrc.c
+ $(COMPILE)
+
+dmresrcl.o : $(ACPICA_CORE)/disassembler/dmresrcl.c
+ $(COMPILE)
+
+dmresrcs.o : $(ACPICA_CORE)/disassembler/dmresrcs.c
+ $(COMPILE)
+
+dmutils.o : $(ACPICA_CORE)/disassembler/dmutils.c
+ $(COMPILE)
+
+dmwalk.o : $(ACPICA_CORE)/disassembler/dmwalk.c
+ $(COMPILE)
+
+dsargs.o : $(ACPICA_CORE)/dispatcher/dsargs.c
+ $(COMPILE)
+
+dscontrol.o : $(ACPICA_CORE)/dispatcher/dscontrol.c
+ $(COMPILE)
+
+dsfield.o : $(ACPICA_CORE)/dispatcher/dsfield.c
+ $(COMPILE)
+
+dsinit.o : $(ACPICA_CORE)/dispatcher/dsinit.c
+ $(COMPILE)
+
+dsmethod.o : $(ACPICA_CORE)/dispatcher/dsmethod.c
+ $(COMPILE)
+
+dsmthdat.o : $(ACPICA_CORE)/dispatcher/dsmthdat.c
+ $(COMPILE)
+
+dsobject.o : $(ACPICA_CORE)/dispatcher/dsobject.c
+ $(COMPILE)
+
+dsopcode.o : $(ACPICA_CORE)/dispatcher/dsopcode.c
+ $(COMPILE)
+
+dsutils.o : $(ACPICA_CORE)/dispatcher/dsutils.c
+ $(COMPILE)
+
+dswexec.o : $(ACPICA_CORE)/dispatcher/dswexec.c
+ $(COMPILE)
+
+dswload.o : $(ACPICA_CORE)/dispatcher/dswload.c
+ $(COMPILE)
+
+dswload2.o : $(ACPICA_CORE)/dispatcher/dswload2.c
+ $(COMPILE)
+
+dswscope.o : $(ACPICA_CORE)/dispatcher/dswscope.c
+ $(COMPILE)
+
+dswstate.o : $(ACPICA_CORE)/dispatcher/dswstate.c
+ $(COMPILE)
+
+evevent.o : $(ACPICA_CORE)/events/evevent.c
+ $(COMPILE)
+
+evgpe.o : $(ACPICA_CORE)/events/evgpe.c
+ $(COMPILE)
+
+evgpeblk.o : $(ACPICA_CORE)/events/evgpeblk.c
+ $(COMPILE)
+
+evgpeinit.o : $(ACPICA_CORE)/events/evgpeinit.c
+ $(COMPILE)
+
+evgpeutil.o : $(ACPICA_CORE)/events/evgpeutil.c
+ $(COMPILE)
+
+evmisc.o : $(ACPICA_CORE)/events/evmisc.c
+ $(COMPILE)
+
+evregion.o : $(ACPICA_CORE)/events/evregion.c
+ $(COMPILE)
+
+evrgnini.o : $(ACPICA_CORE)/events/evrgnini.c
+ $(COMPILE)
+
+evsci.o : $(ACPICA_CORE)/events/evsci.c
+ $(COMPILE)
+
+evxface.o : $(ACPICA_CORE)/events/evxface.c
+ $(COMPILE)
+
+evxfevnt.o : $(ACPICA_CORE)/events/evxfevnt.c
+ $(COMPILE)
+
+evxfgpe.o : $(ACPICA_CORE)/events/evxfgpe.c
+ $(COMPILE)
+
+evxfregn.o : $(ACPICA_CORE)/events/evxfregn.c
+ $(COMPILE)
+
+exconfig.o : $(ACPICA_CORE)/executer/exconfig.c
+ $(COMPILE)
+
+exconvrt.o : $(ACPICA_CORE)/executer/exconvrt.c
+ $(COMPILE)
+
+excreate.o : $(ACPICA_CORE)/executer/excreate.c
+ $(COMPILE)
+
+exdebug.o : $(ACPICA_CORE)/executer/exdebug.c
+ $(COMPILE)
+
+exdump.o : $(ACPICA_CORE)/executer/exdump.c
+ $(COMPILE)
+
+exfield.o : $(ACPICA_CORE)/executer/exfield.c
+ $(COMPILE)
+
+exfldio.o : $(ACPICA_CORE)/executer/exfldio.c
+ $(COMPILE)
+
+exmisc.o : $(ACPICA_CORE)/executer/exmisc.c
+ $(COMPILE)
+
+exmutex.o : $(ACPICA_CORE)/executer/exmutex.c
+ $(COMPILE)
+
+exnames.o : $(ACPICA_CORE)/executer/exnames.c
+ $(COMPILE)
+
+exoparg1.o : $(ACPICA_CORE)/executer/exoparg1.c
+ $(COMPILE)
+
+exoparg2.o : $(ACPICA_CORE)/executer/exoparg2.c
+ $(COMPILE)
+
+exoparg3.o : $(ACPICA_CORE)/executer/exoparg3.c
+ $(COMPILE)
+
+exoparg6.o : $(ACPICA_CORE)/executer/exoparg6.c
+ $(COMPILE)
+
+exprep.o : $(ACPICA_CORE)/executer/exprep.c
+ $(COMPILE)
+
+exregion.o : $(ACPICA_CORE)/executer/exregion.c
+ $(COMPILE)
+
+exresnte.o : $(ACPICA_CORE)/executer/exresnte.c
+ $(COMPILE)
+
+exresolv.o : $(ACPICA_CORE)/executer/exresolv.c
+ $(COMPILE)
+
+exresop.o : $(ACPICA_CORE)/executer/exresop.c
+ $(COMPILE)
+
+exstore.o : $(ACPICA_CORE)/executer/exstore.c
+ $(COMPILE)
+
+exstoren.o : $(ACPICA_CORE)/executer/exstoren.c
+ $(COMPILE)
+
+exstorob.o : $(ACPICA_CORE)/executer/exstorob.c
+ $(COMPILE)
+
+exsystem.o : $(ACPICA_CORE)/executer/exsystem.c
+ $(COMPILE)
+
+exutils.o : $(ACPICA_CORE)/executer/exutils.c
+ $(COMPILE)
+
+hwacpi.o : $(ACPICA_CORE)/hardware/hwacpi.c
+ $(COMPILE)
+
+hwgpe.o : $(ACPICA_CORE)/hardware/hwgpe.c
+ $(COMPILE)
+
+hwpci.o : $(ACPICA_CORE)/hardware/hwpci.c
+ $(COMPILE)
+
+hwregs.o : $(ACPICA_CORE)/hardware/hwregs.c
+ $(COMPILE)
+
+hwsleep.o : $(ACPICA_CORE)/hardware/hwsleep.c
+ $(COMPILE)
+
+hwvalid.o : $(ACPICA_CORE)/hardware/hwvalid.c
+ $(COMPILE)
+
+hwxface.o : $(ACPICA_CORE)/hardware/hwxface.c
+ $(COMPILE)
+
+nsaccess.o : $(ACPICA_CORE)/namespace/nsaccess.c
+ $(COMPILE)
+
+nsalloc.o : $(ACPICA_CORE)/namespace/nsalloc.c
+ $(COMPILE)
+
+nsdump.o : $(ACPICA_CORE)/namespace/nsdump.c
+ $(COMPILE)
+
+nsdumpdv.o : $(ACPICA_CORE)/namespace/nsdumpdv.c
+ $(COMPILE)
+
+nseval.o : $(ACPICA_CORE)/namespace/nseval.c
+ $(COMPILE)
+
+nsinit.o : $(ACPICA_CORE)/namespace/nsinit.c
+ $(COMPILE)
+
+nsload.o : $(ACPICA_CORE)/namespace/nsload.c
+ $(COMPILE)
+
+nsnames.o : $(ACPICA_CORE)/namespace/nsnames.c
+ $(COMPILE)
+
+nsobject.o : $(ACPICA_CORE)/namespace/nsobject.c
+ $(COMPILE)
+
+nsparse.o : $(ACPICA_CORE)/namespace/nsparse.c
+ $(COMPILE)
+
+nspredef.o : $(ACPICA_CORE)/namespace/nspredef.c
+ $(COMPILE)
+
+nsrepair.o : $(ACPICA_CORE)/namespace/nsrepair.c
+ $(COMPILE)
+
+nsrepair2.o : $(ACPICA_CORE)/namespace/nsrepair2.c
+ $(COMPILE)
+
+nssearch.o : $(ACPICA_CORE)/namespace/nssearch.c
+ $(COMPILE)
+
+nsutils.o : $(ACPICA_CORE)/namespace/nsutils.c
+ $(COMPILE)
+
+nswalk.o : $(ACPICA_CORE)/namespace/nswalk.c
+ $(COMPILE)
+
+nsxfeval.o : $(ACPICA_CORE)/namespace/nsxfeval.c
+ $(COMPILE)
+
+nsxfname.o : $(ACPICA_CORE)/namespace/nsxfname.c
+ $(COMPILE)
+
+nsxfobj.o : $(ACPICA_CORE)/namespace/nsxfobj.c
+ $(COMPILE)
+
+psargs.o : $(ACPICA_CORE)/parser/psargs.c
+ $(COMPILE)
+
+psloop.o : $(ACPICA_CORE)/parser/psloop.c
+ $(COMPILE)
+
+psopcode.o : $(ACPICA_CORE)/parser/psopcode.c
+ $(COMPILE)
+
+psparse.o : $(ACPICA_CORE)/parser/psparse.c
+ $(COMPILE)
+
+psscope.o : $(ACPICA_CORE)/parser/psscope.c
+ $(COMPILE)
+
+pstree.o : $(ACPICA_CORE)/parser/pstree.c
+ $(COMPILE)
+
+psutils.o : $(ACPICA_CORE)/parser/psutils.c
+ $(COMPILE)
+
+pswalk.o : $(ACPICA_CORE)/parser/pswalk.c
+ $(COMPILE)
+
+psxface.o : $(ACPICA_CORE)/parser/psxface.c
+ $(COMPILE)
+
+rsaddr.o : $(ACPICA_CORE)/resources/rsaddr.c
+ $(COMPILE)
+
+rscalc.o : $(ACPICA_CORE)/resources/rscalc.c
+ $(COMPILE)
+
+rscreate.o : $(ACPICA_CORE)/resources/rscreate.c
+ $(COMPILE)
+
+rsdump.o : $(ACPICA_CORE)/resources/rsdump.c
+ $(COMPILE)
+
+rsio.o : $(ACPICA_CORE)/resources/rsio.c
+ $(COMPILE)
+
+rsinfo.o : $(ACPICA_CORE)/resources/rsinfo.c
+ $(COMPILE)
+
+rsirq.o : $(ACPICA_CORE)/resources/rsirq.c
+ $(COMPILE)
+
+rslist.o : $(ACPICA_CORE)/resources/rslist.c
+ $(COMPILE)
+
+rsmemory.o : $(ACPICA_CORE)/resources/rsmemory.c
+ $(COMPILE)
+
+rsmisc.o : $(ACPICA_CORE)/resources/rsmisc.c
+ $(COMPILE)
+
+rsutils.o : $(ACPICA_CORE)/resources/rsutils.c
+ $(COMPILE)
+
+rsxface.o : $(ACPICA_CORE)/resources/rsxface.c
+ $(COMPILE)
+
+tbfadt.o : $(ACPICA_CORE)/tables/tbfadt.c
+ $(COMPILE)
+
+tbfind.o : $(ACPICA_CORE)/tables/tbfind.c
+ $(COMPILE)
+
+tbinstal.o : $(ACPICA_CORE)/tables/tbinstal.c
+ $(COMPILE)
+
+tbutils.o : $(ACPICA_CORE)/tables/tbutils.c
+ $(COMPILE)
+
+tbxface.o : $(ACPICA_CORE)/tables/tbxface.c
+ $(COMPILE)
+
+tbxfroot.o : $(ACPICA_CORE)/tables/tbxfroot.c
+ $(COMPILE)
+
+utalloc.o : $(ACPICA_CORE)/utilities/utalloc.c
+ $(COMPILE)
+
+utcache.o : $(ACPICA_CORE)/utilities/utcache.c
+ $(COMPILE)
+
+utcopy.o : $(ACPICA_CORE)/utilities/utcopy.c
+ $(COMPILE)
+
+utdebug.o : $(ACPICA_CORE)/utilities/utdebug.c
+ $(COMPILE)
+
+utdecode.o : $(ACPICA_CORE)/utilities/utdecode.c
+ $(COMPILE)
+
+utdelete.o : $(ACPICA_CORE)/utilities/utdelete.c
+ $(COMPILE)
+
+uteval.o : $(ACPICA_CORE)/utilities/uteval.c
+ $(COMPILE)
+
+utglobal.o : $(ACPICA_CORE)/utilities/utglobal.c
+ $(COMPILE)
+
+utids.o : $(ACPICA_CORE)/utilities/utids.c
+ $(COMPILE)
+
+utinit.o : $(ACPICA_CORE)/utilities/utinit.c
+ $(COMPILE)
+
+utlock.o : $(ACPICA_CORE)/utilities/utlock.c
+ $(COMPILE)
+
+utmath.o : $(ACPICA_CORE)/utilities/utmath.c
+ $(COMPILE)
+
+utmisc.o : $(ACPICA_CORE)/utilities/utmisc.c
+ $(COMPILE)
+
+utmutex.o : $(ACPICA_CORE)/utilities/utmutex.c
+ $(COMPILE)
+
+utobject.o : $(ACPICA_CORE)/utilities/utobject.c
+ $(COMPILE)
+
+utresrc.o : $(ACPICA_CORE)/utilities/utresrc.c
+ $(COMPILE)
+
+utstate.o : $(ACPICA_CORE)/utilities/utstate.c
+ $(COMPILE)
+
+uttrack.o : $(ACPICA_CORE)/utilities/uttrack.c
+ $(COMPILE)
+
+utosi.o : $(ACPICA_CORE)/utilities/utosi.c
+ $(COMPILE)
+
+utxferror.o : $(ACPICA_CORE)/utilities/utxferror.c
+ $(COMPILE)
+
+utxface.o : $(ACPICA_CORE)/utilities/utxface.c
+ $(COMPILE)
+
+
+#
+# Unix OS services layer (OSL)
+#
+osunixxf.o : $(ACPICA_OSL)/osunixxf.c
+ $(COMPILE)
+
+
+clean :
+ rm -f $(PROG) $(PROG).exe $(OBJS)
+
+install :
+ $(INSTALLPROG)
diff --git a/generate/unix/acpinames/Makefile b/generate/unix/acpinames/Makefile
new file mode 100644
index 000000000000..abf916b94dd8
--- /dev/null
+++ b/generate/unix/acpinames/Makefile
@@ -0,0 +1,297 @@
+#
+# AcpiNames utility
+#
+include ../Makefile.config
+
+PROG = acpinames
+
+
+#
+# Flags specific to acpinames utility
+#
+CFLAGS+= -DACPI_APPLICATION -DACPI_SINGLE_THREADED -DACPI_DEBUGGER -I$(ACPICA_TOOLS)/acpinames
+
+OBJS = \
+ anmain.o \
+ anstubs.o \
+ antables.o \
+ dbfileio.o \
+ dsfield.o \
+ dsmthdat.o \
+ dsobject.o \
+ dsutils.o \
+ dswload.o \
+ dswload2.o \
+ dswscope.o \
+ dswstate.o \
+ excreate.o \
+ exnames.o \
+ exresnte.o \
+ exresolv.o \
+ exutils.o \
+ getopt.o \
+ nsaccess.o \
+ nsalloc.o \
+ nsdump.o \
+ nsinit.o \
+ nsload.o \
+ nsnames.o \
+ nsobject.o \
+ nsparse.o \
+ nssearch.o \
+ nsutils.o \
+ nswalk.o \
+ nsxfeval.o \
+ nsxfname.o \
+ nsxfobj.o \
+ osunixxf.o \
+ psargs.o \
+ psloop.o \
+ psopcode.o \
+ psparse.o \
+ psscope.o \
+ pstree.o \
+ psutils.o \
+ pswalk.o \
+ psxface.o \
+ tbfadt.o \
+ tbfind.o \
+ tbinstal.o \
+ tbutils.o \
+ tbxface.o \
+ tbxfroot.o \
+ utalloc.o \
+ utcache.o \
+ utdebug.o \
+ utdecode.o \
+ utdelete.o \
+ utglobal.o \
+ utlock.o \
+ utmath.o \
+ utmisc.o \
+ utmutex.o \
+ utobject.o \
+ utstate.o \
+ utosi.o \
+ utxferror.o \
+ utxface.o
+
+
+#
+# Root rule
+#
+$(PROG) : $(OBJS)
+ $(CC) $(LDFLAGS) $(OBJS) -lpthread -o $(PROG)
+ $(COPYPROG)
+
+
+#
+# acpinames source
+#
+anmain.o : $(ACPICA_TOOLS)/acpinames/anmain.c
+ $(COMPILE)
+
+anstubs.o : $(ACPICA_TOOLS)/acpinames/anstubs.c
+ $(COMPILE)
+
+antables.o : $(ACPICA_TOOLS)/acpinames/antables.c
+ $(COMPILE)
+
+
+#
+# ACPICA core source - common
+#
+getopt.o : $(ACPICA_COMMON)/getopt.c
+ $(COMPILE)
+
+
+#
+# ACPICA core source
+#
+dbfileio.o : $(ACPICA_CORE)/debugger/dbfileio.c
+ $(COMPILE)
+
+dsfield.o : $(ACPICA_CORE)/dispatcher/dsfield.c
+ $(COMPILE)
+
+dsmthdat.o : $(ACPICA_CORE)/dispatcher/dsmthdat.c
+ $(COMPILE)
+
+dsobject.o : $(ACPICA_CORE)/dispatcher/dsobject.c
+ $(COMPILE)
+
+dsutils.o : $(ACPICA_CORE)/dispatcher/dsutils.c
+ $(COMPILE)
+
+dswload.o : $(ACPICA_CORE)/dispatcher/dswload.c
+ $(COMPILE)
+
+dswload2.o : $(ACPICA_CORE)/dispatcher/dswload2.c
+ $(COMPILE)
+
+dswscope.o : $(ACPICA_CORE)/dispatcher/dswscope.c
+ $(COMPILE)
+
+dswstate.o : $(ACPICA_CORE)/dispatcher/dswstate.c
+ $(COMPILE)
+
+excreate.o : $(ACPICA_CORE)/executer/excreate.c
+ $(COMPILE)
+
+exnames.o : $(ACPICA_CORE)/executer/exnames.c
+ $(COMPILE)
+
+exresnte.o : $(ACPICA_CORE)/executer/exresnte.c
+ $(COMPILE)
+
+exresolv.o : $(ACPICA_CORE)/executer/exresolv.c
+ $(COMPILE)
+
+exutils.o : $(ACPICA_CORE)/executer/exutils.c
+ $(COMPILE)
+
+nsaccess.o : $(ACPICA_CORE)/namespace/nsaccess.c
+ $(COMPILE)
+
+nsalloc.o : $(ACPICA_CORE)/namespace/nsalloc.c
+ $(COMPILE)
+
+nsdump.o : $(ACPICA_CORE)/namespace/nsdump.c
+ $(COMPILE)
+
+nsinit.o : $(ACPICA_CORE)/namespace/nsinit.c
+ $(COMPILE)
+
+nsload.o : $(ACPICA_CORE)/namespace/nsload.c
+ $(COMPILE)
+
+nsnames.o : $(ACPICA_CORE)/namespace/nsnames.c
+ $(COMPILE)
+
+nsobject.o : $(ACPICA_CORE)/namespace/nsobject.c
+ $(COMPILE)
+
+nsparse.o : $(ACPICA_CORE)/namespace/nsparse.c
+ $(COMPILE)
+
+nssearch.o : $(ACPICA_CORE)/namespace/nssearch.c
+ $(COMPILE)
+
+nsutils.o : $(ACPICA_CORE)/namespace/nsutils.c
+ $(COMPILE)
+
+nswalk.o : $(ACPICA_CORE)/namespace/nswalk.c
+ $(COMPILE)
+
+nsxfeval.o : $(ACPICA_CORE)/namespace/nsxfeval.c
+ $(COMPILE)
+
+nsxfname.o : $(ACPICA_CORE)/namespace/nsxfname.c
+ $(COMPILE)
+
+nsxfobj.o : $(ACPICA_CORE)/namespace/nsxfobj.c
+ $(COMPILE)
+
+psargs.o : $(ACPICA_CORE)/parser/psargs.c
+ $(COMPILE)
+
+psloop.o : $(ACPICA_CORE)/parser/psloop.c
+ $(COMPILE)
+
+psopcode.o : $(ACPICA_CORE)/parser/psopcode.c
+ $(COMPILE)
+
+psparse.o : $(ACPICA_CORE)/parser/psparse.c
+ $(COMPILE)
+
+psscope.o : $(ACPICA_CORE)/parser/psscope.c
+ $(COMPILE)
+
+pstree.o : $(ACPICA_CORE)/parser/pstree.c
+ $(COMPILE)
+
+psutils.o : $(ACPICA_CORE)/parser/psutils.c
+ $(COMPILE)
+
+pswalk.o : $(ACPICA_CORE)/parser/pswalk.c
+ $(COMPILE)
+
+psxface.o : $(ACPICA_CORE)/parser/psxface.c
+ $(COMPILE)
+
+tbfadt.o : $(ACPICA_CORE)/tables/tbfadt.c
+ $(COMPILE)
+
+tbfind.o : $(ACPICA_CORE)/tables/tbfind.c
+ $(COMPILE)
+
+tbinstal.o : $(ACPICA_CORE)/tables/tbinstal.c
+ $(COMPILE)
+
+tbutils.o : $(ACPICA_CORE)/tables/tbutils.c
+ $(COMPILE)
+
+tbxface.o : $(ACPICA_CORE)/tables/tbxface.c
+ $(COMPILE)
+
+tbxfroot.o : $(ACPICA_CORE)/tables/tbxfroot.c
+ $(COMPILE)
+
+utalloc.o : $(ACPICA_CORE)/utilities/utalloc.c
+ $(COMPILE)
+
+utcache.o : $(ACPICA_CORE)/utilities/utcache.c
+ $(COMPILE)
+
+utdebug.o : $(ACPICA_CORE)/utilities/utdebug.c
+ $(COMPILE)
+
+utdecode.o : $(ACPICA_CORE)/utilities/utdecode.c
+ $(COMPILE)
+
+utdelete.o : $(ACPICA_CORE)/utilities/utdelete.c
+ $(COMPILE)
+
+utglobal.o : $(ACPICA_CORE)/utilities/utglobal.c
+ $(COMPILE)
+
+utlock.o : $(ACPICA_CORE)/utilities/utlock.c
+ $(COMPILE)
+
+utmath.o : $(ACPICA_CORE)/utilities/utmath.c
+ $(COMPILE)
+
+utmisc.o : $(ACPICA_CORE)/utilities/utmisc.c
+ $(COMPILE)
+
+utmutex.o : $(ACPICA_CORE)/utilities/utmutex.c
+ $(COMPILE)
+
+utobject.o : $(ACPICA_CORE)/utilities/utobject.c
+ $(COMPILE)
+
+utstate.o : $(ACPICA_CORE)/utilities/utstate.c
+ $(COMPILE)
+
+utosi.o : $(ACPICA_CORE)/utilities/utosi.c
+ $(COMPILE)
+
+utxferror.o : $(ACPICA_CORE)/utilities/utxferror.c
+ $(COMPILE)
+
+utxface.o : $(ACPICA_CORE)/utilities/utxface.c
+ $(COMPILE)
+
+
+#
+# Unix OS services layer (OSL)
+#
+osunixxf.o : $(ACPICA_OSL)/osunixxf.c
+ $(COMPILE)
+
+
+clean :
+ rm -f $(PROG) $(PROG).exe $(OBJS)
+
+install :
+ $(INSTALLPROG)
diff --git a/generate/unix/acpisrc/Makefile b/generate/unix/acpisrc/Makefile
new file mode 100644
index 000000000000..9cc93fc54bd7
--- /dev/null
+++ b/generate/unix/acpisrc/Makefile
@@ -0,0 +1,77 @@
+#
+# acpisrc utility
+#
+include ../Makefile.config
+
+PROG = acpisrc
+
+
+#
+# Flags specific to acpisrc
+#
+CFLAGS+= -DACPI_APPLICATION -I$(ACPICA_TOOLS)/acpisrc
+
+OBJS = \
+ ascase.o \
+ asconvrt.o \
+ asfile.o \
+ asmain.o \
+ asremove.o \
+ astable.o \
+ asutils.o \
+ getopt.o \
+ osunixdir.o
+
+
+#
+# Root rule
+#
+$(PROG) : $(OBJS)
+ $(CC) $(LDFLAGS) $(OBJS) -o $(PROG)
+ $(COPYPROG)
+
+
+#
+# acpisrc source
+#
+ascase.o : $(ACPICA_TOOLS)/acpisrc/ascase.c
+ $(COMPILE)
+
+asconvrt.o : $(ACPICA_TOOLS)/acpisrc/asconvrt.c
+ $(COMPILE)
+
+asfile.o : $(ACPICA_TOOLS)/acpisrc/asfile.c
+ $(COMPILE)
+
+asmain.o : $(ACPICA_TOOLS)/acpisrc/asmain.c
+ $(COMPILE)
+
+asremove.o : $(ACPICA_TOOLS)/acpisrc/asremove.c
+ $(COMPILE)
+
+astable.o : $(ACPICA_TOOLS)/acpisrc/astable.c
+ $(COMPILE)
+
+asutils.o : $(ACPICA_TOOLS)/acpisrc/asutils.c
+ $(COMPILE)
+
+
+#
+# ACPICA core source - common
+#
+getopt.o : $(ACPICA_COMMON)/getopt.c
+ $(COMPILE)
+
+
+#
+# Unix OS services layer (OSL)
+#
+osunixdir.o : $(ACPICA_OSL)/osunixdir.c
+ $(COMPILE)
+
+
+clean :
+ rm -f $(PROG) $(PROG).exe $(OBJS)
+
+install :
+ $(INSTALLPROG)
diff --git a/generate/unix/acpixtract/Makefile b/generate/unix/acpixtract/Makefile
new file mode 100644
index 000000000000..f6be17117557
--- /dev/null
+++ b/generate/unix/acpixtract/Makefile
@@ -0,0 +1,17 @@
+#
+# acpixtract utility
+#
+include ../Makefile.config
+
+PROG = acpixtract
+
+
+$(PROG) : $(ACPICA_TOOLS)/acpixtract/acpixtract.c
+ $(CC) $(CFLAGS) $(CWARNINGFLAGS) $(LDFLAGS) -o$(PROG) $?
+ $(COPYPROG)
+
+clean :
+ rm -f $(PROG) $(PROG).exe
+
+install :
+ $(INSTALLPROG)
diff --git a/generate/unix/iasl/Makefile b/generate/unix/iasl/Makefile
new file mode 100644
index 000000000000..6705560991d6
--- /dev/null
+++ b/generate/unix/iasl/Makefile
@@ -0,0 +1,602 @@
+#
+# iASL compiler
+#
+include ../Makefile.config
+
+PROG = iasl
+
+#
+# Flags specific to iASL compiler
+#
+CFLAGS+= -DACPI_ASL_COMPILER -I$(ASL_COMPILER) -I.
+LDFLAGS+= -lpthread
+
+OBJS = \
+ adfile.o \
+ adisasm.o \
+ adwalk.o \
+ aslanalyze.o \
+ aslbtypes.o \
+ aslcodegen.o \
+ aslcompile.o \
+ aslcompilerlex.o \
+ aslcompilerparse.o \
+ aslerror.o \
+ aslfiles.o \
+ aslfold.o \
+ asllength.o \
+ asllisting.o \
+ aslload.o \
+ asllookup.o \
+ aslmain.o \
+ aslmap.o \
+ aslopcodes.o \
+ asloperands.o \
+ aslopt.o \
+ aslpredef.o \
+ aslresource.o \
+ aslrestype1.o \
+ aslrestype1i.o \
+ aslrestype2.o \
+ aslrestype2d.o \
+ aslrestype2e.o \
+ aslrestype2q.o \
+ aslrestype2w.o \
+ aslstartup.o \
+ aslstubs.o \
+ asltransform.o \
+ asltree.o \
+ aslutils.o \
+ asluuid.o \
+ aslwalks.o \
+ dtcompile.o \
+ dtexpress.o \
+ dtfield.o \
+ dtio.o \
+ dtsubtable.o \
+ dttable.o \
+ dttemplate.o \
+ dtutils.o \
+ dbfileio.o \
+ dmbuffer.o \
+ dmextern.o \
+ dmnames.o \
+ dmobject.o \
+ dmopcode.o \
+ dmresrc.o \
+ dmresrcl.o \
+ dmresrcs.o \
+ dmrestag.o \
+ dmtable.o \
+ dmtbdump.o \
+ dmtbinfo.o \
+ dmutils.o \
+ dmwalk.o \
+ dsargs.o \
+ dscontrol.o \
+ dsfield.o \
+ dsobject.o \
+ dsopcode.o \
+ dsutils.o \
+ dswexec.o \
+ dswload.o \
+ dswload2.o \
+ dswscope.o \
+ dswstate.o \
+ exconvrt.o \
+ excreate.o \
+ exdump.o \
+ exmisc.o \
+ exmutex.o \
+ exnames.o \
+ exoparg1.o \
+ exoparg2.o \
+ exoparg3.o \
+ exoparg6.o \
+ exprep.o \
+ exregion.o \
+ exresnte.o \
+ exresolv.o \
+ exresop.o \
+ exstore.o \
+ exstoren.o \
+ exstorob.o \
+ exsystem.o \
+ exutils.o \
+ getopt.o \
+ nsaccess.o \
+ nsalloc.o \
+ nsdump.o \
+ nsnames.o \
+ nsobject.o \
+ nsparse.o \
+ nssearch.o \
+ nsutils.o \
+ nswalk.o \
+ nsxfobj.o \
+ osunixxf.o \
+ psargs.o \
+ psloop.o \
+ psopcode.o \
+ psparse.o \
+ psscope.o \
+ pstree.o \
+ psutils.o \
+ pswalk.o \
+ tbfadt.o \
+ tbinstal.o \
+ tbutils.o \
+ tbxface.o \
+ utalloc.o \
+ utcache.o \
+ utcopy.o \
+ utdebug.o \
+ utdecode.o \
+ utdelete.o \
+ utglobal.o \
+ utinit.o \
+ utlock.o \
+ utmath.o \
+ utmisc.o \
+ utmutex.o \
+ utobject.o \
+ utresrc.o \
+ utstate.o \
+ utxferror.o \
+ utxface.o
+
+INTERMEDIATES = \
+ aslcompilerlex.c \
+ aslcompilerparse.c
+
+MISC = \
+ aslcompiler.y.h \
+ aslcompilerparse.output
+
+
+#
+# Root rule
+#
+$(PROG) : $(INTERMEDIATES) $(OBJS)
+ $(CC) $(LDFLAGS) $(OBJS) -o $(PROG)
+ $(COPYPROG)
+
+
+#
+# Parser and Lexer - intermediate C files
+#
+aslcompilerlex.c : $(ASL_COMPILER)/aslcompiler.l
+ ${LEX} ${LFLAGS} -o$@ $?
+
+aslcompilerparse.c : $(ASL_COMPILER)/aslcompiler.y
+ ${YACC} ${YFLAGS} -o$@ $?
+ @mv -f aslcompilerparse.h aslcompiler.y.h
+
+#
+# Parser and Lexer - final object files
+#
+# Cannot use the common compile warning flags since the C files are created
+# by the utilities above and they are not necessarily ANSI C, etc.
+#
+aslcompilerlex.o : aslcompilerlex.c
+ $(CC) -c $(CFLAGS) -Wall -Werror -o$@ $?
+
+aslcompilerparse.o : aslcompilerparse.c
+ $(CC) -c $(CFLAGS) -Wall -Werror -o$@ $?
+
+
+#
+# Compiler source
+#
+aslanalyze.o : $(ASL_COMPILER)/aslanalyze.c
+ $(COMPILE)
+
+aslbtypes.o : $(ASL_COMPILER)/aslbtypes.c
+ $(COMPILE)
+
+aslcodegen.o : $(ASL_COMPILER)/aslcodegen.c
+ $(COMPILE)
+
+aslcompile.o : $(ASL_COMPILER)/aslcompile.c
+ $(COMPILE)
+
+aslerror.o : $(ASL_COMPILER)/aslerror.c
+ $(COMPILE)
+
+aslfiles.o : $(ASL_COMPILER)/aslfiles.c
+ $(COMPILE)
+
+aslfold.o : $(ASL_COMPILER)/aslfold.c
+ $(COMPILE)
+
+asllength.o : $(ASL_COMPILER)/asllength.c
+ $(COMPILE)
+
+asllisting.o : $(ASL_COMPILER)/asllisting.c
+ $(COMPILE)
+
+aslload.o : $(ASL_COMPILER)/aslload.c
+ $(COMPILE)
+
+asllookup.o : $(ASL_COMPILER)/asllookup.c
+ $(COMPILE)
+
+aslmain.o : $(ASL_COMPILER)/aslmain.c
+ $(COMPILE)
+
+aslmap.o : $(ASL_COMPILER)/aslmap.c
+ $(COMPILE)
+
+aslopcodes.o : $(ASL_COMPILER)/aslopcodes.c
+ $(COMPILE)
+
+asloperands.o : $(ASL_COMPILER)/asloperands.c
+ $(COMPILE)
+
+aslopt.o : $(ASL_COMPILER)/aslopt.c
+ $(COMPILE)
+
+aslpredef.o : $(ASL_COMPILER)/aslpredef.c
+ $(COMPILE)
+
+aslresource.o : $(ASL_COMPILER)/aslresource.c
+ $(COMPILE)
+
+aslrestype1.o : $(ASL_COMPILER)/aslrestype1.c
+ $(COMPILE)
+
+aslrestype1i.o : $(ASL_COMPILER)/aslrestype1i.c
+ $(COMPILE)
+
+aslrestype2.o : $(ASL_COMPILER)/aslrestype2.c
+ $(COMPILE)
+
+aslrestype2d.o : $(ASL_COMPILER)/aslrestype2d.c
+ $(COMPILE)
+
+aslrestype2e.o : $(ASL_COMPILER)/aslrestype2e.c
+ $(COMPILE)
+
+aslrestype2q.o : $(ASL_COMPILER)/aslrestype2q.c
+ $(COMPILE)
+
+aslrestype2w.o : $(ASL_COMPILER)/aslrestype2w.c
+ $(COMPILE)
+
+aslstartup.o : $(ASL_COMPILER)/aslstartup.c
+ $(COMPILE)
+
+aslstubs.o : $(ASL_COMPILER)/aslstubs.c
+ $(COMPILE)
+
+asltransform.o : $(ASL_COMPILER)/asltransform.c
+ $(COMPILE)
+
+asltree.o : $(ASL_COMPILER)/asltree.c
+ $(COMPILE)
+
+aslutils.o : $(ASL_COMPILER)/aslutils.c
+ $(COMPILE)
+
+asluuid.o : $(ASL_COMPILER)/asluuid.c
+ $(COMPILE)
+
+aslwalks.o : $(ASL_COMPILER)/aslwalks.c
+ $(COMPILE)
+
+
+#
+# Data Table Compiler
+#
+dtcompile.o : $(ASL_COMPILER)/dtcompile.c
+ $(COMPILE)
+
+dtexpress.o : $(ASL_COMPILER)/dtexpress.c
+ $(COMPILE)
+
+dtfield.o : $(ASL_COMPILER)/dtfield.c
+ $(COMPILE)
+
+dtio.o : $(ASL_COMPILER)/dtio.c
+ $(COMPILE)
+
+dtsubtable.o : $(ASL_COMPILER)/dtsubtable.c
+ $(COMPILE)
+
+dttable.o : $(ASL_COMPILER)/dttable.c
+ $(COMPILE)
+
+dttemplate.o : $(ASL_COMPILER)/dttemplate.c
+ $(COMPILE)
+
+dtutils.o : $(ASL_COMPILER)/dtutils.c
+ $(COMPILE)
+
+
+#
+# ACPICA core source - common
+#
+adfile.o : $(ACPICA_COMMON)/adfile.c
+ $(COMPILE)
+
+adisasm.o : $(ACPICA_COMMON)/adisasm.c
+ $(COMPILE)
+
+adwalk.o : $(ACPICA_COMMON)/adwalk.c
+ $(COMPILE)
+
+dmextern.o : $(ACPICA_COMMON)/dmextern.c
+ $(COMPILE)
+
+dmrestag.o : $(ACPICA_COMMON)/dmrestag.c
+ $(COMPILE)
+
+dmtable.o : $(ACPICA_COMMON)/dmtable.c
+ $(COMPILE)
+
+dmtbdump.o : $(ACPICA_COMMON)/dmtbdump.c
+ $(COMPILE)
+
+dmtbinfo.o : $(ACPICA_COMMON)/dmtbinfo.c
+ $(COMPILE)
+
+getopt.o : $(ACPICA_COMMON)/getopt.c
+ $(COMPILE)
+
+
+#
+# ACPICA core source
+#
+dbfileio.o : $(ACPICA_CORE)/debugger/dbfileio.c
+ $(COMPILE)
+
+dmbuffer.o : $(ACPICA_CORE)/disassembler/dmbuffer.c
+ $(COMPILE)
+
+dmnames.o : $(ACPICA_CORE)/disassembler/dmnames.c
+ $(COMPILE)
+
+dmobject.o : $(ACPICA_CORE)/disassembler/dmobject.c
+ $(COMPILE)
+
+dmopcode.o : $(ACPICA_CORE)/disassembler/dmopcode.c
+ $(COMPILE)
+
+dmresrc.o : $(ACPICA_CORE)/disassembler/dmresrc.c
+ $(COMPILE)
+
+dmresrcl.o : $(ACPICA_CORE)/disassembler/dmresrcl.c
+ $(COMPILE)
+
+dmresrcs.o : $(ACPICA_CORE)/disassembler/dmresrcs.c
+ $(COMPILE)
+
+dmutils.o : $(ACPICA_CORE)/disassembler/dmutils.c
+ $(COMPILE)
+
+dmwalk.o : $(ACPICA_CORE)/disassembler/dmwalk.c
+ $(COMPILE)
+
+dsargs.o : $(ACPICA_CORE)/dispatcher/dsargs.c
+ $(COMPILE)
+
+dscontrol.o : $(ACPICA_CORE)/dispatcher/dscontrol.c
+ $(COMPILE)
+
+dsfield.o : $(ACPICA_CORE)/dispatcher/dsfield.c
+ $(COMPILE)
+
+dsobject.o : $(ACPICA_CORE)/dispatcher/dsobject.c
+ $(COMPILE)
+
+dsopcode.o : $(ACPICA_CORE)/dispatcher/dsopcode.c
+ $(COMPILE)
+
+dsutils.o : $(ACPICA_CORE)/dispatcher/dsutils.c
+ $(COMPILE)
+
+dswexec.o : $(ACPICA_CORE)/dispatcher/dswexec.c
+ $(COMPILE)
+
+dswload.o : $(ACPICA_CORE)/dispatcher/dswload.c
+ $(COMPILE)
+
+dswload2.o : $(ACPICA_CORE)/dispatcher/dswload2.c
+ $(COMPILE)
+
+dswscope.o : $(ACPICA_CORE)/dispatcher/dswscope.c
+ $(COMPILE)
+
+dswstate.o : $(ACPICA_CORE)/dispatcher/dswstate.c
+ $(COMPILE)
+
+exconvrt.o : $(ACPICA_CORE)/executer/exconvrt.c
+ $(COMPILE)
+
+excreate.o : $(ACPICA_CORE)/executer/excreate.c
+ $(COMPILE)
+
+exdump.o : $(ACPICA_CORE)/executer/exdump.c
+ $(COMPILE)
+
+exmisc.o : $(ACPICA_CORE)/executer/exmisc.c
+ $(COMPILE)
+
+exmutex.o : $(ACPICA_CORE)/executer/exmutex.c
+ $(COMPILE)
+
+exnames.o : $(ACPICA_CORE)/executer/exnames.c
+ $(COMPILE)
+
+exoparg1.o : $(ACPICA_CORE)/executer/exoparg1.c
+ $(COMPILE)
+
+exoparg2.o : $(ACPICA_CORE)/executer/exoparg2.c
+ $(COMPILE)
+
+exoparg3.o : $(ACPICA_CORE)/executer/exoparg3.c
+ $(COMPILE)
+
+exoparg6.o : $(ACPICA_CORE)/executer/exoparg6.c
+ $(COMPILE)
+
+exprep.o : $(ACPICA_CORE)/executer/exprep.c
+ $(COMPILE)
+
+exregion.o : $(ACPICA_CORE)/executer/exregion.c
+ $(COMPILE)
+
+exresnte.o : $(ACPICA_CORE)/executer/exresnte.c
+ $(COMPILE)
+
+exresolv.o : $(ACPICA_CORE)/executer/exresolv.c
+ $(COMPILE)
+
+exresop.o : $(ACPICA_CORE)/executer/exresop.c
+ $(COMPILE)
+
+exstore.o : $(ACPICA_CORE)/executer/exstore.c
+ $(COMPILE)
+
+exstoren.o : $(ACPICA_CORE)/executer/exstoren.c
+ $(COMPILE)
+
+exstorob.o : $(ACPICA_CORE)/executer/exstorob.c
+ $(COMPILE)
+
+exsystem.o : $(ACPICA_CORE)/executer/exsystem.c
+ $(COMPILE)
+
+exutils.o : $(ACPICA_CORE)/executer/exutils.c
+ $(COMPILE)
+
+nsaccess.o : $(ACPICA_CORE)/namespace/nsaccess.c
+ $(COMPILE)
+
+nsalloc.o : $(ACPICA_CORE)/namespace/nsalloc.c
+ $(COMPILE)
+
+nsdump.o : $(ACPICA_CORE)/namespace/nsdump.c
+ $(COMPILE)
+
+nsnames.o : $(ACPICA_CORE)/namespace/nsnames.c
+ $(COMPILE)
+
+nsobject.o : $(ACPICA_CORE)/namespace/nsobject.c
+ $(COMPILE)
+
+nsparse.o : $(ACPICA_CORE)/namespace/nsparse.c
+ $(COMPILE)
+
+nssearch.o : $(ACPICA_CORE)/namespace/nssearch.c
+ $(COMPILE)
+
+nsutils.o : $(ACPICA_CORE)/namespace/nsutils.c
+ $(COMPILE)
+
+nswalk.o : $(ACPICA_CORE)/namespace/nswalk.c
+ $(COMPILE)
+
+nsxfobj.o : $(ACPICA_CORE)/namespace/nsxfobj.c
+ $(COMPILE)
+
+psargs.o : $(ACPICA_CORE)/parser/psargs.c
+ $(COMPILE)
+
+psloop.o : $(ACPICA_CORE)/parser/psloop.c
+ $(COMPILE)
+
+psopcode.o : $(ACPICA_CORE)/parser/psopcode.c
+ $(COMPILE)
+
+psparse.o : $(ACPICA_CORE)/parser/psparse.c
+ $(COMPILE)
+
+psscope.o : $(ACPICA_CORE)/parser/psscope.c
+ $(COMPILE)
+
+pstree.o : $(ACPICA_CORE)/parser/pstree.c
+ $(COMPILE)
+
+psutils.o : $(ACPICA_CORE)/parser/psutils.c
+ $(COMPILE)
+
+pswalk.o : $(ACPICA_CORE)/parser/pswalk.c
+ $(COMPILE)
+
+tbfadt.o : $(ACPICA_CORE)/tables/tbfadt.c
+ $(COMPILE)
+
+tbinstal.o : $(ACPICA_CORE)/tables/tbinstal.c
+ $(COMPILE)
+
+tbutils.o : $(ACPICA_CORE)/tables/tbutils.c
+ $(COMPILE)
+
+tbxface.o : $(ACPICA_CORE)/tables/tbxface.c
+ $(COMPILE)
+
+utalloc.o : $(ACPICA_CORE)/utilities/utalloc.c
+ $(COMPILE)
+
+utcache.o : $(ACPICA_CORE)/utilities/utcache.c
+ $(COMPILE)
+
+utcopy.o : $(ACPICA_CORE)/utilities/utcopy.c
+ $(COMPILE)
+
+utdebug.o : $(ACPICA_CORE)/utilities/utdebug.c
+ $(COMPILE)
+
+utdecode.o : $(ACPICA_CORE)/utilities/utdecode.c
+ $(COMPILE)
+
+utdelete.o : $(ACPICA_CORE)/utilities/utdelete.c
+ $(COMPILE)
+
+utglobal.o : $(ACPICA_CORE)/utilities/utglobal.c
+ $(COMPILE)
+
+utinit.o : $(ACPICA_CORE)/utilities/utinit.c
+ $(COMPILE)
+
+utlock.o : $(ACPICA_CORE)/utilities/utlock.c
+ $(COMPILE)
+
+utmath.o : $(ACPICA_CORE)/utilities/utmath.c
+ $(COMPILE)
+
+utmisc.o : $(ACPICA_CORE)/utilities/utmisc.c
+ $(COMPILE)
+
+utmutex.o : $(ACPICA_CORE)/utilities/utmutex.c
+ $(COMPILE)
+
+utobject.o : $(ACPICA_CORE)/utilities/utobject.c
+ $(COMPILE)
+
+utresrc.o : $(ACPICA_CORE)/utilities/utresrc.c
+ $(COMPILE)
+
+utstate.o : $(ACPICA_CORE)/utilities/utstate.c
+ $(COMPILE)
+
+utxferror.o : $(ACPICA_CORE)/utilities/utxferror.c
+ $(COMPILE)
+
+utxface.o : $(ACPICA_CORE)/utilities/utxface.c
+ $(COMPILE)
+
+
+#
+# Unix OS services layer (OSL)
+#
+osunixxf.o : $(ACPICA_OSL)/osunixxf.c
+ $(COMPILE)
+
+
+clean :
+ rm -f $(PROG) $(PROG).exe $(OBJS) $(INTERMEDIATES) $(MISC)
+
+install :
+ $(INSTALLPROG)
diff --git a/generate/unix/readme.txt b/generate/unix/readme.txt
new file mode 100644
index 000000000000..6e20a437b5de
--- /dev/null
+++ b/generate/unix/readme.txt
@@ -0,0 +1,51 @@
+Unix ACPICA makefiles
+---------------------
+
+These makefiles are intended for generating the ACPICA utilities in
+a Unix-like environment, with the original ACPICA code (not linuxized),
+and in the original (git tree) ACPICA directory structure.
+
+The top level makefile will generate the following utilities:
+
+acpiexec
+acpinames
+acpisrc
+acpixtract
+iasl
+
+
+Requirements
+------------
+
+make
+gcc compiler (3+ or 4+)
+bison
+flex
+
+
+Configuration
+-------------
+
+The Makefile.config file contains the configuration information:
+
+HOST = _CYGWIN /* Host system, must appear in acenv.h */
+CC = gcc-4 /* C compiler */
+ACPICA_SRC = ../../../source /* Location of acpica source tree */
+
+
+Intermediate Files
+------------------
+
+The intermediate files for each utility (.o, etc.) are placed in the
+subdirectory corresponding to each utility, not in the source code
+tree itself. This prevents collisions when different utilities compile
+the same source modules with different options.
+
+
+Output
+------
+
+The executable utilities are copied to the local bin directory.
+
+"make install" will install the binaries to /usr/bin
+
diff --git a/include/acdebug.h b/include/acdebug.h
index 169459ef6d5f..9b4822d14ae1 100644
--- a/include/acdebug.h
+++ b/include/acdebug.h
@@ -98,9 +98,9 @@ AcpiDbSingleStep (
/*
* dbcmds - debug commands and output routines
*/
-ACPI_STATUS
-AcpiDbDisassembleMethod (
- char *Name);
+ACPI_NAMESPACE_NODE *
+AcpiDbConvertToNode (
+ char *InString);
void
AcpiDbDisplayTableInfo (
@@ -112,38 +112,53 @@ AcpiDbUnloadAcpiTable (
char *InstanceArg);
void
-AcpiDbSetMethodBreakpoint (
- char *Location,
- ACPI_WALK_STATE *WalkState,
- ACPI_PARSE_OBJECT *Op);
+AcpiDbSendNotify (
+ char *Name,
+ UINT32 Value);
void
-AcpiDbSetMethodCallBreakpoint (
- ACPI_PARSE_OBJECT *Op);
+AcpiDbDisplayInterfaces (
+ char *ActionArg,
+ char *InterfaceNameArg);
+
+ACPI_STATUS
+AcpiDbSleep (
+ char *ObjectArg);
void
-AcpiDbGetBusInfo (
+AcpiDbDisplayLocks (
void);
void
-AcpiDbDisassembleAml (
- char *Statements,
- ACPI_PARSE_OBJECT *Op);
+AcpiDbDisplayResources (
+ char *ObjectArg);
void
-AcpiDbDumpNamespace (
- char *StartArg,
- char *DepthArg);
+AcpiDbDisplayGpes (
+ void);
void
-AcpiDbDumpNamespaceByOwner (
- char *OwnerArg,
- char *DepthArg);
+AcpiDbDisplayHandlers (
+ void);
void
-AcpiDbSendNotify (
- char *Name,
- UINT32 Value);
+AcpiDbGenerateGpe (
+ char *GpeArg,
+ char *BlockArg);
+
+
+/*
+ * dbmethod - control method commands
+ */
+void
+AcpiDbSetMethodBreakpoint (
+ char *Location,
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op);
+
+void
+AcpiDbSetMethodCallBreakpoint (
+ ACPI_PARSE_OBJECT *Op);
void
AcpiDbSetMethodData (
@@ -152,59 +167,61 @@ AcpiDbSetMethodData (
char *ValueArg);
ACPI_STATUS
-AcpiDbDisplayObjects (
- char *ObjTypeArg,
- char *DisplayCountArg);
+AcpiDbDisassembleMethod (
+ char *Name);
void
-AcpiDbDisplayInterfaces (
- char *ActionArg,
- char *InterfaceNameArg);
+AcpiDbDisassembleAml (
+ char *Statements,
+ ACPI_PARSE_OBJECT *Op);
-ACPI_STATUS
-AcpiDbFindNameInNamespace (
- char *NameArg);
+void
+AcpiDbBatchExecute (
+ char *CountArg);
+
+/*
+ * dbnames - namespace commands
+ */
void
AcpiDbSetScope (
char *Name);
-ACPI_STATUS
-AcpiDbSleep (
- char *ObjectArg);
-
void
-AcpiDbFindReferences (
- char *ObjectArg);
+AcpiDbDumpNamespace (
+ char *StartArg,
+ char *DepthArg);
void
-AcpiDbDisplayLocks (
- void);
+AcpiDbDumpNamespaceByOwner (
+ char *OwnerArg,
+ char *DepthArg);
-void
-AcpiDbDisplayResources (
- char *ObjectArg);
+ACPI_STATUS
+AcpiDbFindNameInNamespace (
+ char *NameArg);
void
-AcpiDbDisplayGpes (
+AcpiDbCheckPredefinedNames (
void);
+ACPI_STATUS
+AcpiDbDisplayObjects (
+ char *ObjTypeArg,
+ char *DisplayCountArg);
+
void
AcpiDbCheckIntegrity (
void);
void
-AcpiDbGenerateGpe (
- char *GpeArg,
- char *BlockArg);
+AcpiDbFindReferences (
+ char *ObjectArg);
void
-AcpiDbCheckPredefinedNames (
+AcpiDbGetBusInfo (
void);
-void
-AcpiDbBatchExecute (
- char *CountArg);
/*
* dbdisply - debug display commands
diff --git a/include/acdisasm.h b/include/acdisasm.h
index 0e5cc0aa9c58..01235ca95caf 100644
--- a/include/acdisasm.h
+++ b/include/acdisasm.h
@@ -127,6 +127,8 @@ typedef const struct acpi_dmtable_info
#define ACPI_DMT_UNICODE 42
#define ACPI_DMT_UUID 43
#define ACPI_DMT_DEVICE_PATH 44
+#define ACPI_DMT_LABEL 45
+#define ACPI_DMT_BUF7 46
typedef
diff --git a/include/acdispat.h b/include/acdispat.h
index aae055c1c8bc..ae8dd931545b 100644
--- a/include/acdispat.h
+++ b/include/acdispat.h
@@ -51,7 +51,7 @@
/*
- * dsopcode - support for late evaluation
+ * dsargs - execution of dynamic arguments for static objects
*/
ACPI_STATUS
AcpiDsGetBufferFieldArguments (
@@ -73,6 +73,24 @@ ACPI_STATUS
AcpiDsGetPackageArguments (
ACPI_OPERAND_OBJECT *ObjDesc);
+
+/*
+ * dscontrol - support for execution control opcodes
+ */
+ACPI_STATUS
+AcpiDsExecBeginControlOp (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op);
+
+ACPI_STATUS
+AcpiDsExecEndControlOp (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op);
+
+
+/*
+ * dsopcode - support for late operand evaluation
+ */
ACPI_STATUS
AcpiDsEvalBufferFieldOperands (
ACPI_WALK_STATE *WalkState,
@@ -105,20 +123,6 @@ AcpiDsInitializeRegion (
/*
- * dsctrl - Parser/Interpreter interface, control stack routines
- */
-ACPI_STATUS
-AcpiDsExecBeginControlOp (
- ACPI_WALK_STATE *WalkState,
- ACPI_PARSE_OBJECT *Op);
-
-ACPI_STATUS
-AcpiDsExecEndControlOp (
- ACPI_WALK_STATE *WalkState,
- ACPI_PARSE_OBJECT *Op);
-
-
-/*
* dsexec - Parser/Interpreter interface, method execution callbacks
*/
ACPI_STATUS
@@ -169,9 +173,14 @@ AcpiDsInitFieldObjects (
/*
- * dsload - Parser/Interpreter interface, namespace load callbacks
+ * dsload - Parser/Interpreter interface, pass 1 namespace load callbacks
*/
ACPI_STATUS
+AcpiDsInitCallbacks (
+ ACPI_WALK_STATE *WalkState,
+ UINT32 PassNumber);
+
+ACPI_STATUS
AcpiDsLoad1BeginOp (
ACPI_WALK_STATE *WalkState,
ACPI_PARSE_OBJECT **OutOp);
@@ -180,6 +189,10 @@ ACPI_STATUS
AcpiDsLoad1EndOp (
ACPI_WALK_STATE *WalkState);
+
+/*
+ * dsload - Parser/Interpreter interface, pass 2 namespace load callbacks
+ */
ACPI_STATUS
AcpiDsLoad2BeginOp (
ACPI_WALK_STATE *WalkState,
@@ -189,11 +202,6 @@ ACPI_STATUS
AcpiDsLoad2EndOp (
ACPI_WALK_STATE *WalkState);
-ACPI_STATUS
-AcpiDsInitCallbacks (
- ACPI_WALK_STATE *WalkState,
- UINT32 PassNumber);
-
/*
* dsmthdat - method data (locals/args)
diff --git a/include/acglobal.h b/include/acglobal.h
index 1ae262434403..65cf6911f2db 100644
--- a/include/acglobal.h
+++ b/include/acglobal.h
@@ -245,6 +245,10 @@ ACPI_EXTERN UINT32 AcpiGbl_OwnerIdMask[ACPI_NUM_OWNERID_MAS
ACPI_EXTERN UINT8 AcpiGbl_LastOwnerIdIndex;
ACPI_EXTERN UINT8 AcpiGbl_NextOwnerIdOffset;
+/* Initialization sequencing */
+
+ACPI_EXTERN BOOLEAN AcpiGbl_RegMethodsExecuted;
+
/* Misc */
ACPI_EXTERN UINT32 AcpiGbl_OriginalMode;
diff --git a/include/aclocal.h b/include/aclocal.h
index 1c6868ab5c71..bdefb7671f60 100644
--- a/include/aclocal.h
+++ b/include/aclocal.h
@@ -93,25 +93,6 @@ union acpi_parse_object;
#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
-
-/* Debug names for the mutexes above */
-
-static char *AcpiGbl_MutexNames[ACPI_NUM_MUTEX] =
-{
- "ACPI_MTX_Interpreter",
- "ACPI_MTX_Namespace",
- "ACPI_MTX_Tables",
- "ACPI_MTX_Events",
- "ACPI_MTX_Caches",
- "ACPI_MTX_Memory",
- "ACPI_MTX_CommandComplete",
- "ACPI_MTX_CommandReady"
-};
-
-#endif
-#endif
/* Lock structure for reader/writer interfaces */
diff --git a/include/acoutput.h b/include/acoutput.h
index 4b689040ae4d..c8007e21fb35 100644
--- a/include/acoutput.h
+++ b/include/acoutput.h
@@ -186,13 +186,19 @@
#if defined (ACPI_DEBUG_OUTPUT) || !defined (ACPI_NO_ERROR_MESSAGES)
/*
- * Module name is included in both debug and non-debug versions primarily for
- * error messages. The __FILE__ macro is not very useful for this, because it
- * often includes the entire pathname to the module
+ * The module name is used primarily for error and debug messages.
+ * The __FILE__ macro is not very useful for this, because it
+ * usually includes the entire pathname to the module making the
+ * debug output difficult to read.
*/
#define ACPI_MODULE_NAME(Name) static const char ACPI_UNUSED_VAR _AcpiModuleName[] = Name;
#else
+/*
+ * For the no-debug and no-error-msg cases, we must at least define
+ * a null module name.
+ */
#define ACPI_MODULE_NAME(Name)
+#define _AcpiModuleName ""
#endif
/*
diff --git a/include/acpixf.h b/include/acpixf.h
index 3838b3323786..a8573617c9e7 100644
--- a/include/acpixf.h
+++ b/include/acpixf.h
@@ -48,7 +48,7 @@
/* Current ACPICA subsystem version in YYYYMMDD format */
-#define ACPI_CA_VERSION 0x20110112
+#define ACPI_CA_VERSION 0x20110211
#include "actypes.h"
#include "actbl.h"
diff --git a/include/actbl.h b/include/actbl.h
index 39b475c1a330..e632291cd0fe 100644
--- a/include/actbl.h
+++ b/include/actbl.h
@@ -397,4 +397,20 @@ typedef struct acpi_table_desc
#define ACPI_FADT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_FADT, f)
+/*
+ * Sizes of the various flavors of FADT. We need to look closely
+ * at the FADT length because the version number essentially tells
+ * us nothing because of many BIOS bugs where the version does not
+ * match the expected length. In other words, the length of the
+ * FADT is the bottom line as to what the version really is.
+ *
+ * For reference, the values below are as follows:
+ * FADT V1 size: 0x74
+ * FADT V2 size: 0x84
+ * FADT V3+ size: 0xF4
+ */
+#define ACPI_FADT_V1_SIZE (UINT32) (ACPI_FADT_OFFSET (Flags) + 4)
+#define ACPI_FADT_V2_SIZE (UINT32) (ACPI_FADT_OFFSET (Reserved4[0]) + 3)
+#define ACPI_FADT_V3_SIZE (UINT32) (sizeof (ACPI_TABLE_FADT))
+
#endif /* __ACTBL_H__ */
diff --git a/tables/tbfadt.c b/tables/tbfadt.c
index 5d138d681289..f8c63408b9f5 100644
--- a/tables/tbfadt.c
+++ b/tables/tbfadt.c
@@ -410,8 +410,11 @@ AcpiTbConvertFadt (
*
* The ACPI 1.0 reserved fields that will be zeroed are the bytes located
* at offset 45, 55, 95, and the word located at offset 109, 110.
+ *
+ * Note: The FADT revision value is unreliable. Only the length can be
+ * trusted.
*/
- if (AcpiGbl_FADT.Header.Revision < 3)
+ if (AcpiGbl_FADT.Header.Length <= ACPI_FADT_V2_SIZE)
{
AcpiGbl_FADT.PreferredProfile = 0;
AcpiGbl_FADT.PstateControl = 0;
diff --git a/tests/misc/badcode.asl b/tests/misc/badcode.asl
index 9b576c575594..59e8e2434437 100644
--- a/tests/misc/badcode.asl
+++ b/tests/misc/badcode.asl
@@ -165,6 +165,29 @@ DefinitionBlock ("badcode.aml", "DSDT", 1, "Intel", "Example", 0x00000001)
Name (_INI, 1)
Name (_PTP, 2)
+ // GPE methods that cause type collision (L vs. E)
+
+ Scope (\_GPE)
+ {
+ Method (_L1D)
+ {
+ }
+ Method (_E1D)
+ {
+ }
+ }
+
+ // Predefined names that should not have a return value
+
+ Method (_FDM, 1)
+ {
+ Return (Buffer(1){0x33})
+ }
+ Method (_Q22)
+ {
+ Return ("Unexpected Return Value")
+ }
+
/*
* Resource Descriptor error checking
*/
@@ -172,10 +195,10 @@ DefinitionBlock ("badcode.aml", "DSDT", 1, "Intel", "Example", 0x00000001)
{
// Illegal nested StartDependent macros
- StartDependentFn (0, 0)
- {
- StartDependentFn (0, 0)
- {
+ StartDependentFn (0, 0)
+ {
+ StartDependentFn (0, 0)
+ {
}
}
diff --git a/tools/acpiexec/Makefile b/tools/acpiexec/Makefile
index 827a4187a952..37c0358ee89d 100644
--- a/tools/acpiexec/Makefile
+++ b/tools/acpiexec/Makefile
@@ -27,6 +27,8 @@ OBJS = \
dbfileio.o \
dbhistry.o \
dbinput.o \
+ dbmethod.o \
+ dbnames.o \
dbstats.o \
dbutils.o \
dbxface.o \
@@ -39,6 +41,8 @@ OBJS = \
dmresrcs.o \
dmutils.o \
dmwalk.o \
+ dsargs.o \
+ dscontrol.o \
dsfield.o \
dsinit.o \
dsmethod.o \
@@ -48,6 +52,7 @@ OBJS = \
dsutils.o \
dswexec.o \
dswload.o \
+ dswload2.o \
dswscope.o \
dswstate.o \
evevent.o \
@@ -146,6 +151,7 @@ OBJS = \
utcache.o \
utcopy.o \
utdebug.o \
+ utdecode.o \
utdelete.o \
uteval.o \
utglobal.o \
@@ -216,6 +222,12 @@ dbhistry.o : $(ACPICA_CORE)/debugger/dbhistry.c
dbinput.o : $(ACPICA_CORE)/debugger/dbinput.c
$(COMPILE)
+dbmethod.o : $(ACPICA_CORE)/debugger/dbmethod.c
+ $(COMPILE)
+
+dbnames.o : $(ACPICA_CORE)/debugger/dbnames.c
+ $(COMPILE)
+
dbstats.o : $(ACPICA_CORE)/debugger/dbstats.c
$(COMPILE)
@@ -252,6 +264,12 @@ dmutils.o : $(ACPICA_CORE)/disassembler/dmutils.c
dmwalk.o : $(ACPICA_CORE)/disassembler/dmwalk.c
$(COMPILE)
+dsargs.o : $(ACPICA_CORE)/dispatcher/dsargs.c
+ $(COMPILE)
+
+dscontrol.o : $(ACPICA_CORE)/dispatcher/dscontrol.c
+ $(COMPILE)
+
dsfield.o : $(ACPICA_CORE)/dispatcher/dsfield.c
$(COMPILE)
@@ -279,6 +297,9 @@ dswexec.o : $(ACPICA_CORE)/dispatcher/dswexec.c
dswload.o : $(ACPICA_CORE)/dispatcher/dswload.c
$(COMPILE)
+dswload2.o : $(ACPICA_CORE)/dispatcher/dswload2.c
+ $(COMPILE)
+
dswscope.o : $(ACPICA_CORE)/dispatcher/dswscope.c
$(COMPILE)
@@ -567,6 +588,9 @@ utcopy.o : $(ACPICA_CORE)/utilities/utcopy.c
utdebug.o : $(ACPICA_CORE)/utilities/utdebug.c
$(COMPILE)
+utdebug.o : $(ACPICA_CORE)/utilities/utdebug.c
+ $(COMPILE)
+
utdelete.o : $(ACPICA_CORE)/utilities/utdelete.c
$(COMPILE)
diff --git a/tools/acpiexec/aecommon.h b/tools/acpiexec/aecommon.h
index 429575968861..0baee381232a 100644
--- a/tools/acpiexec/aecommon.h
+++ b/tools/acpiexec/aecommon.h
@@ -160,7 +160,11 @@ AeDisplayAllMethods (
UINT32 DisplayCount);
ACPI_STATUS
-AeInstallHandlers (
+AeInstallEarlyHandlers (
+ void);
+
+ACPI_STATUS
+AeInstallLateHandlers (
void);
void
diff --git a/tools/acpiexec/aehandlers.c b/tools/acpiexec/aehandlers.c
index 4fa8e4da6291..79ca33b275ef 100644
--- a/tools/acpiexec/aehandlers.c
+++ b/tools/acpiexec/aehandlers.c
@@ -91,10 +91,41 @@ AeInterfaceHandler (
ACPI_STRING InterfaceName,
UINT32 Supported);
+static UINT32
+AeEventHandler (
+ void *Context);
+
static UINT32 SigintCount = 0;
static AE_DEBUG_REGIONS AeRegions;
+/*
+ * We will override default region handlers for memory and I/O. Especially
+ * the SystemMemory handler, which must be implemented locally to simulate
+ * memory operation regions. Do not override the PCI_Config handler since
+ * we would like to exercise the default handler code. Do not override
+ * DataTable handler, since the default handler works correctly under
+ * acpiexec (and is used by the test suites.)
+ */
+static ACPI_ADR_SPACE_TYPE DefaultSpaceIdList[] =
+{
+ ACPI_ADR_SPACE_SYSTEM_MEMORY,
+ ACPI_ADR_SPACE_SYSTEM_IO
+};
+
+/*
+ * We will install handlers for some of the various address space IDs
+ */
+static ACPI_ADR_SPACE_TYPE SpaceIdList[] =
+{
+ ACPI_ADR_SPACE_EC,
+ ACPI_ADR_SPACE_SMBUS,
+ ACPI_ADR_SPACE_PCI_BAR_TARGET,
+ ACPI_ADR_SPACE_IPMI,
+ ACPI_ADR_SPACE_FIXED_HARDWARE
+};
+
+
/******************************************************************************
*
* FUNCTION: AeCtrlCHandler
@@ -485,6 +516,22 @@ AeInterfaceHandler (
/******************************************************************************
*
+ * FUNCTION: AeEventHandler
+ *
+ * DESCRIPTION: Handler for Fixed Events
+ *
+ *****************************************************************************/
+
+static UINT32
+AeEventHandler (
+ void *Context)
+{
+ return (0);
+}
+
+
+/******************************************************************************
+ *
* FUNCTION: AeRegionInit
*
* PARAMETERS: None
@@ -513,7 +560,58 @@ AeRegionInit (
/******************************************************************************
*
- * FUNCTION: AeInstallHandlers
+ * FUNCTION: AeInstallLateHandlers
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Install handlers for the AcpiExec utility.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AeInstallLateHandlers (
+ void)
+{
+ ACPI_STATUS Status;
+ UINT32 i;
+
+
+ /* Install some fixed event handlers */
+
+ Status = AcpiInstallFixedEventHandler (ACPI_EVENT_GLOBAL, AeEventHandler, NULL);
+ AE_CHECK_OK (AcpiInstallFixedEventHandler, Status);
+
+ Status = AcpiInstallFixedEventHandler (ACPI_EVENT_RTC, AeEventHandler, NULL);
+ AE_CHECK_OK (AcpiInstallFixedEventHandler, Status);
+
+ /*
+ * Install handlers for some of the "device driver" address spaces
+ * such as EC, SMBus, etc.
+ */
+ for (i = 0; i < ACPI_ARRAY_LENGTH (SpaceIdList); i++)
+ {
+ /* Install handler at the root object */
+
+ Status = AcpiInstallAddressSpaceHandler (AcpiGbl_RootNode,
+ SpaceIdList[i], AeRegionHandler, AeRegionInit, NULL);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Could not install an OpRegion handler for %s space(%u)",
+ AcpiUtGetRegionName((UINT8) SpaceIdList[i]), SpaceIdList[i]));
+ return (Status);
+ }
+ }
+
+ return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AeInstallEarlyHandlers
*
* PARAMETERS: None
*
@@ -526,11 +624,9 @@ AeRegionInit (
*
*****************************************************************************/
-static ACPI_ADR_SPACE_TYPE SpaceIdList[] = {0, 1, 3, 4, 5, 6, 7, 0x80};
-#define AEXEC_NUM_REGIONS 8
-
ACPI_STATUS
-AeInstallHandlers (void)
+AeInstallEarlyHandlers (
+ void)
{
ACPI_STATUS Status;
UINT32 i;
@@ -628,25 +724,24 @@ AeInstallHandlers (void)
printf ("No _SB_ found, %s\n", AcpiFormatException (Status));
}
- /* Set a handler for all supported operation regions */
- for (i = 0; i < AEXEC_NUM_REGIONS; i++)
+ /*
+ * Install handlers that will override the default handlers for some of
+ * the space IDs.
+ */
+ for (i = 0; i < ACPI_ARRAY_LENGTH (DefaultSpaceIdList); i++)
{
- /* Remove any existing handler */
+ /* Install handler at the root object */
- (void) AcpiRemoveAddressSpaceHandler (AcpiGbl_RootNode,
- SpaceIdList[i], AeRegionHandler);
-
- /* Install handler at the root object.
- * TBD: all default handlers should be installed here!
- */
Status = AcpiInstallAddressSpaceHandler (AcpiGbl_RootNode,
- SpaceIdList[i], AeRegionHandler, AeRegionInit, NULL);
+ DefaultSpaceIdList[i], AeRegionHandler,
+ AeRegionInit, NULL);
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status,
- "Could not install an OpRegion handler for %s space(%u)",
- AcpiUtGetRegionName((UINT8) SpaceIdList[i]), SpaceIdList[i]));
+ "Could not install a default OpRegion handler for %s space(%u)",
+ AcpiUtGetRegionName ((UINT8) DefaultSpaceIdList[i]),
+ DefaultSpaceIdList[i]));
return (Status);
}
}
@@ -657,7 +752,6 @@ AeInstallHandlers (void)
*/
AeRegions.NumberOfRegions = 0;
AeRegions.RegionList = NULL;
-
return (Status);
}
diff --git a/tools/acpiexec/aemain.c b/tools/acpiexec/aemain.c
index c0fa5fe235e1..5c59573dcd8e 100644
--- a/tools/acpiexec/aemain.c
+++ b/tools/acpiexec/aemain.c
@@ -616,15 +616,18 @@ main (
goto enterloop;
}
- Status = AeInstallHandlers ();
+ /*
+ * Install most of the handlers.
+ * Override some default region handlers, especially SystemMemory
+ */
+ Status = AeInstallEarlyHandlers ();
if (ACPI_FAILURE (Status))
{
goto enterloop;
}
/*
- * TBD:
- * Need a way to call this after the "LOAD" command
+ * TBD: Need a way to call this after the "LOAD" command
*/
Status = AcpiEnableSubsystem (InitFlags);
if (ACPI_FAILURE (Status))
@@ -640,6 +643,11 @@ main (
goto enterloop;
}
+ /*
+ * Install handlers for "device driver" space IDs (EC,SMBus, etc.)
+ * and fixed event handlers
+ */
+ AeInstallLateHandlers ();
AeMiscellaneousTests ();
}
diff --git a/tools/acpinames/Makefile b/tools/acpinames/Makefile
new file mode 100644
index 000000000000..9e20e4e795ad
--- /dev/null
+++ b/tools/acpinames/Makefile
@@ -0,0 +1,298 @@
+#
+# AcpiNames utility
+#
+PROG = acpinames
+
+ACPICA_SRC = ../..
+ACPICA_COMMON = $(ACPICA_SRC)/common
+ACPICA_CORE = $(ACPICA_SRC)
+ACPICA_TOOLS = $(ACPICA_SRC)/tools
+ACPICA_OSL = $(ACPICA_SRC)/os_specific/service_layers
+
+NOMAN= YES
+CFLAGS+= -Wall -g -D_LINUX -DNDEBUG -D_CONSOLE -DACPI_APPLICATION -DACPI_SINGLE_THREADED -DACPI_DEBUGGER -Wstrict-prototypes -I$(ACPICA_SRC)/include -I$(ACPICA_TOOLS)/acpinames
+
+COMPILE = $(CC) -c $(CFLAGS) -o$@ $?
+LDFLAGS += -lpthread -lrt
+
+OBJS = \
+ anmain.o \
+ anstubs.o \
+ antables.o \
+ dbfileio.o \
+ dsfield.o \
+ dsmthdat.o \
+ dsobject.o \
+ dsutils.o \
+ dswload.o \
+ dswload2.o \
+ dswscope.o \
+ dswstate.o \
+ excreate.o \
+ exnames.o \
+ exresnte.o \
+ exresolv.o \
+ exutils.o \
+ getopt.o \
+ nsaccess.o \
+ nsalloc.o \
+ nsdump.o \
+ nsinit.o \
+ nsload.o \
+ nsnames.o \
+ nsobject.o \
+ nsparse.o \
+ nssearch.o \
+ nsutils.o \
+ nswalk.o \
+ nsxfeval.o \
+ nsxfname.o \
+ nsxfobj.o \
+ osunixxf.o \
+ psargs.o \
+ psloop.o \
+ psopcode.o \
+ psparse.o \
+ psscope.o \
+ pstree.o \
+ psutils.o \
+ pswalk.o \
+ psxface.o \
+ tbfadt.o \
+ tbfind.o \
+ tbinstal.o \
+ tbutils.o \
+ tbxface.o \
+ tbxfroot.o \
+ utalloc.o \
+ utcache.o \
+ utdebug.o \
+ utdecode.o \
+ utdelete.o \
+ utglobal.o \
+ utlock.o \
+ utmath.o \
+ utmisc.o \
+ utmutex.o \
+ utobject.o \
+ utstate.o \
+ utosi.o \
+ utxferror.o \
+ utxface.o
+
+
+#
+# Root rule
+#
+$(PROG) : $(OBJS)
+ $(CC) $(LDFLAGS) $(OBJS) -lpthread -o $(PROG)
+ $(COPYPROG)
+
+
+#
+# acpinames source
+#
+anmain.o : $(ACPICA_TOOLS)/acpinames/anmain.c
+ $(COMPILE)
+
+anstubs.o : $(ACPICA_TOOLS)/acpinames/anstubs.c
+ $(COMPILE)
+
+antables.o : $(ACPICA_TOOLS)/acpinames/antables.c
+ $(COMPILE)
+
+
+#
+# ACPICA core source - common
+#
+getopt.o : $(ACPICA_COMMON)/getopt.c
+ $(COMPILE)
+
+
+#
+# ACPICA core source
+#
+dbfileio.o : $(ACPICA_CORE)/debugger/dbfileio.c
+ $(COMPILE)
+
+dsfield.o : $(ACPICA_CORE)/dispatcher/dsfield.c
+ $(COMPILE)
+
+dsmthdat.o : $(ACPICA_CORE)/dispatcher/dsmthdat.c
+ $(COMPILE)
+
+dsobject.o : $(ACPICA_CORE)/dispatcher/dsobject.c
+ $(COMPILE)
+
+dsutils.o : $(ACPICA_CORE)/dispatcher/dsutils.c
+ $(COMPILE)
+
+dswload.o : $(ACPICA_CORE)/dispatcher/dswload.c
+ $(COMPILE)
+
+dswload2.o : $(ACPICA_CORE)/dispatcher/dswload2.c
+ $(COMPILE)
+
+dswscope.o : $(ACPICA_CORE)/dispatcher/dswscope.c
+ $(COMPILE)
+
+dswstate.o : $(ACPICA_CORE)/dispatcher/dswstate.c
+ $(COMPILE)
+
+excreate.o : $(ACPICA_CORE)/executer/excreate.c
+ $(COMPILE)
+
+exnames.o : $(ACPICA_CORE)/executer/exnames.c
+ $(COMPILE)
+
+exresnte.o : $(ACPICA_CORE)/executer/exresnte.c
+ $(COMPILE)
+
+exresolv.o : $(ACPICA_CORE)/executer/exresolv.c
+ $(COMPILE)
+
+exutils.o : $(ACPICA_CORE)/executer/exutils.c
+ $(COMPILE)
+
+nsaccess.o : $(ACPICA_CORE)/namespace/nsaccess.c
+ $(COMPILE)
+
+nsalloc.o : $(ACPICA_CORE)/namespace/nsalloc.c
+ $(COMPILE)
+
+nsdump.o : $(ACPICA_CORE)/namespace/nsdump.c
+ $(COMPILE)
+
+nsinit.o : $(ACPICA_CORE)/namespace/nsinit.c
+ $(COMPILE)
+
+nsload.o : $(ACPICA_CORE)/namespace/nsload.c
+ $(COMPILE)
+
+nsnames.o : $(ACPICA_CORE)/namespace/nsnames.c
+ $(COMPILE)
+
+nsobject.o : $(ACPICA_CORE)/namespace/nsobject.c
+ $(COMPILE)
+
+nsparse.o : $(ACPICA_CORE)/namespace/nsparse.c
+ $(COMPILE)
+
+nssearch.o : $(ACPICA_CORE)/namespace/nssearch.c
+ $(COMPILE)
+
+nsutils.o : $(ACPICA_CORE)/namespace/nsutils.c
+ $(COMPILE)
+
+nswalk.o : $(ACPICA_CORE)/namespace/nswalk.c
+ $(COMPILE)
+
+nsxfeval.o : $(ACPICA_CORE)/namespace/nsxfeval.c
+ $(COMPILE)
+
+nsxfname.o : $(ACPICA_CORE)/namespace/nsxfname.c
+ $(COMPILE)
+
+nsxfobj.o : $(ACPICA_CORE)/namespace/nsxfobj.c
+ $(COMPILE)
+
+psargs.o : $(ACPICA_CORE)/parser/psargs.c
+ $(COMPILE)
+
+psloop.o : $(ACPICA_CORE)/parser/psloop.c
+ $(COMPILE)
+
+psopcode.o : $(ACPICA_CORE)/parser/psopcode.c
+ $(COMPILE)
+
+psparse.o : $(ACPICA_CORE)/parser/psparse.c
+ $(COMPILE)
+
+psscope.o : $(ACPICA_CORE)/parser/psscope.c
+ $(COMPILE)
+
+pstree.o : $(ACPICA_CORE)/parser/pstree.c
+ $(COMPILE)
+
+psutils.o : $(ACPICA_CORE)/parser/psutils.c
+ $(COMPILE)
+
+pswalk.o : $(ACPICA_CORE)/parser/pswalk.c
+ $(COMPILE)
+
+psxface.o : $(ACPICA_CORE)/parser/psxface.c
+ $(COMPILE)
+
+tbfadt.o : $(ACPICA_CORE)/tables/tbfadt.c
+ $(COMPILE)
+
+tbfind.o : $(ACPICA_CORE)/tables/tbfind.c
+ $(COMPILE)
+
+tbinstal.o : $(ACPICA_CORE)/tables/tbinstal.c
+ $(COMPILE)
+
+tbutils.o : $(ACPICA_CORE)/tables/tbutils.c
+ $(COMPILE)
+
+tbxface.o : $(ACPICA_CORE)/tables/tbxface.c
+ $(COMPILE)
+
+tbxfroot.o : $(ACPICA_CORE)/tables/tbxfroot.c
+ $(COMPILE)
+
+utalloc.o : $(ACPICA_CORE)/utilities/utalloc.c
+ $(COMPILE)
+
+utcache.o : $(ACPICA_CORE)/utilities/utcache.c
+ $(COMPILE)
+
+utdebug.o : $(ACPICA_CORE)/utilities/utdebug.c
+ $(COMPILE)
+
+utdecode.o : $(ACPICA_CORE)/utilities/utdecode.c
+ $(COMPILE)
+
+utdelete.o : $(ACPICA_CORE)/utilities/utdelete.c
+ $(COMPILE)
+
+utglobal.o : $(ACPICA_CORE)/utilities/utglobal.c
+ $(COMPILE)
+
+utlock.o : $(ACPICA_CORE)/utilities/utlock.c
+ $(COMPILE)
+
+utmath.o : $(ACPICA_CORE)/utilities/utmath.c
+ $(COMPILE)
+
+utmisc.o : $(ACPICA_CORE)/utilities/utmisc.c
+ $(COMPILE)
+
+utmutex.o : $(ACPICA_CORE)/utilities/utmutex.c
+ $(COMPILE)
+
+utobject.o : $(ACPICA_CORE)/utilities/utobject.c
+ $(COMPILE)
+
+utstate.o : $(ACPICA_CORE)/utilities/utstate.c
+ $(COMPILE)
+
+utosi.o : $(ACPICA_CORE)/utilities/utosi.c
+ $(COMPILE)
+
+utxferror.o : $(ACPICA_CORE)/utilities/utxferror.c
+ $(COMPILE)
+
+utxface.o : $(ACPICA_CORE)/utilities/utxface.c
+ $(COMPILE)
+
+
+#
+# Unix OS services layer (OSL)
+#
+osunixxf.o : $(ACPICA_OSL)/osunixxf.c
+ $(COMPILE)
+
+
+clean :
+ rm -f $(PROG) $(PROG).exe $(OBJS)
diff --git a/tools/acpisrc/astable.c b/tools/acpisrc/astable.c
index 0d9f2fc722b9..a1ef455beef2 100644
--- a/tools/acpisrc/astable.c
+++ b/tools/acpisrc/astable.c
@@ -236,6 +236,7 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = {
{"ACPI_GPE_WALK_INFO", SRC_TYPE_STRUCT},
{"ACPI_GPE_XRUPT_INFO", SRC_TYPE_STRUCT},
{"ACPI_HANDLE", SRC_TYPE_SIMPLE},
+ {"ACPI_HANDLER_INFO", SRC_TYPE_STRUCT},
{"ACPI_INIT_HANDLER", SRC_TYPE_SIMPLE},
{"ACPI_IDENTIFIER_TABLE", SRC_TYPE_STRUCT},
{"ACPI_INIT_WALK_INFO", SRC_TYPE_STRUCT},
diff --git a/utilities/utdecode.c b/utilities/utdecode.c
new file mode 100644
index 000000000000..59b27f0e47ca
--- /dev/null
+++ b/utilities/utdecode.c
@@ -0,0 +1,627 @@
+/******************************************************************************
+ *
+ * Module Name: utdecode - Utility decoding routines (value-to-string)
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2011, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * substantially similar to the "NO WARRANTY" disclaimer below
+ * ("Disclaimer") and any redistribution must be conditioned upon
+ * including a substantially similar Disclaimer requirement for further
+ * binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ * of any contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#define __UTDECODE_C__
+
+#include "acpi.h"
+#include "accommon.h"
+#include "acnamesp.h"
+
+#define _COMPONENT ACPI_UTILITIES
+ ACPI_MODULE_NAME ("utdecode")
+
+
+/*******************************************************************************
+ *
+ * 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)
+{
+ const char *Exception = NULL;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ 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)
+
+
+/*
+ * Properties of the ACPI Object Types, both internal and external.
+ * The table is indexed by values of ACPI_OBJECT_TYPE
+ */
+const UINT8 AcpiGbl_NsProperties[ACPI_NUM_NS_TYPES] =
+{
+ ACPI_NS_NORMAL, /* 00 Any */
+ ACPI_NS_NORMAL, /* 01 Number */
+ ACPI_NS_NORMAL, /* 02 String */
+ ACPI_NS_NORMAL, /* 03 Buffer */
+ ACPI_NS_NORMAL, /* 04 Package */
+ ACPI_NS_NORMAL, /* 05 FieldUnit */
+ ACPI_NS_NEWSCOPE, /* 06 Device */
+ ACPI_NS_NORMAL, /* 07 Event */
+ ACPI_NS_NEWSCOPE, /* 08 Method */
+ ACPI_NS_NORMAL, /* 09 Mutex */
+ ACPI_NS_NORMAL, /* 10 Region */
+ ACPI_NS_NEWSCOPE, /* 11 Power */
+ ACPI_NS_NEWSCOPE, /* 12 Processor */
+ ACPI_NS_NEWSCOPE, /* 13 Thermal */
+ ACPI_NS_NORMAL, /* 14 BufferField */
+ ACPI_NS_NORMAL, /* 15 DdbHandle */
+ ACPI_NS_NORMAL, /* 16 Debug Object */
+ ACPI_NS_NORMAL, /* 17 DefField */
+ ACPI_NS_NORMAL, /* 18 BankField */
+ ACPI_NS_NORMAL, /* 19 IndexField */
+ ACPI_NS_NORMAL, /* 20 Reference */
+ ACPI_NS_NORMAL, /* 21 Alias */
+ ACPI_NS_NORMAL, /* 22 MethodAlias */
+ ACPI_NS_NORMAL, /* 23 Notify */
+ ACPI_NS_NORMAL, /* 24 Address Handler */
+ ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 25 Resource Desc */
+ ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 26 Resource Field */
+ ACPI_NS_NEWSCOPE, /* 27 Scope */
+ ACPI_NS_NORMAL, /* 28 Extra */
+ ACPI_NS_NORMAL, /* 29 Data */
+ ACPI_NS_NORMAL /* 30 Invalid */
+};
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtHexToAsciiChar
+ *
+ * PARAMETERS: Integer - Contains the hex digit
+ * Position - bit position of the digit within the
+ * integer (multiple of 4)
+ *
+ * RETURN: The converted Ascii character
+ *
+ * DESCRIPTION: Convert a hex digit to an Ascii character
+ *
+ ******************************************************************************/
+
+/* Hex to ASCII conversion table */
+
+static const char AcpiGbl_HexToAscii[] =
+{
+ '0','1','2','3','4','5','6','7',
+ '8','9','A','B','C','D','E','F'
+};
+
+char
+AcpiUtHexToAsciiChar (
+ UINT64 Integer,
+ UINT32 Position)
+{
+
+ return (AcpiGbl_HexToAscii[(Integer >> Position) & 0xF]);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtGetRegionName
+ *
+ * PARAMETERS: Space ID - ID for the region
+ *
+ * RETURN: Decoded region SpaceId name
+ *
+ * DESCRIPTION: Translate a Space ID into a name string (Debug only)
+ *
+ ******************************************************************************/
+
+/* Region type decoding */
+
+const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] =
+{
+ "SystemMemory",
+ "SystemIO",
+ "PCI_Config",
+ "EmbeddedControl",
+ "SMBus",
+ "SystemCMOS",
+ "PCIBARTarget",
+ "IPMI",
+ "DataTable"
+};
+
+
+char *
+AcpiUtGetRegionName (
+ UINT8 SpaceId)
+{
+
+ if (SpaceId >= ACPI_USER_REGION_BEGIN)
+ {
+ return ("UserDefinedRegion");
+ }
+ else if (SpaceId == ACPI_ADR_SPACE_FIXED_HARDWARE)
+ {
+ return ("FunctionalFixedHW");
+ }
+ else if (SpaceId >= ACPI_NUM_PREDEFINED_REGIONS)
+ {
+ return ("InvalidSpaceId");
+ }
+
+ return (ACPI_CAST_PTR (char, AcpiGbl_RegionTypes[SpaceId]));
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtGetEventName
+ *
+ * PARAMETERS: EventId - Fixed event ID
+ *
+ * RETURN: Decoded event ID name
+ *
+ * DESCRIPTION: Translate a Event ID into a name string (Debug only)
+ *
+ ******************************************************************************/
+
+/* Event type decoding */
+
+static const char *AcpiGbl_EventTypes[ACPI_NUM_FIXED_EVENTS] =
+{
+ "PM_Timer",
+ "GlobalLock",
+ "PowerButton",
+ "SleepButton",
+ "RealTimeClock",
+};
+
+
+char *
+AcpiUtGetEventName (
+ UINT32 EventId)
+{
+
+ if (EventId > ACPI_EVENT_MAX)
+ {
+ return ("InvalidEventID");
+ }
+
+ return (ACPI_CAST_PTR (char, AcpiGbl_EventTypes[EventId]));
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtGetTypeName
+ *
+ * PARAMETERS: Type - An ACPI object type
+ *
+ * RETURN: Decoded ACPI object type name
+ *
+ * DESCRIPTION: Translate a Type ID into a name string (Debug only)
+ *
+ ******************************************************************************/
+
+/*
+ * Elements of AcpiGbl_NsTypeNames below must match
+ * one-to-one with values of ACPI_OBJECT_TYPE
+ *
+ * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching;
+ * when stored in a table it really means that we have thus far seen no
+ * evidence to indicate what type is actually going to be stored for this entry.
+ */
+static const char AcpiGbl_BadType[] = "UNDEFINED";
+
+/* Printable names of the ACPI object types */
+
+static const char *AcpiGbl_NsTypeNames[] =
+{
+ /* 00 */ "Untyped",
+ /* 01 */ "Integer",
+ /* 02 */ "String",
+ /* 03 */ "Buffer",
+ /* 04 */ "Package",
+ /* 05 */ "FieldUnit",
+ /* 06 */ "Device",
+ /* 07 */ "Event",
+ /* 08 */ "Method",
+ /* 09 */ "Mutex",
+ /* 10 */ "Region",
+ /* 11 */ "Power",
+ /* 12 */ "Processor",
+ /* 13 */ "Thermal",
+ /* 14 */ "BufferField",
+ /* 15 */ "DdbHandle",
+ /* 16 */ "DebugObject",
+ /* 17 */ "RegionField",
+ /* 18 */ "BankField",
+ /* 19 */ "IndexField",
+ /* 20 */ "Reference",
+ /* 21 */ "Alias",
+ /* 22 */ "MethodAlias",
+ /* 23 */ "Notify",
+ /* 24 */ "AddrHandler",
+ /* 25 */ "ResourceDesc",
+ /* 26 */ "ResourceFld",
+ /* 27 */ "Scope",
+ /* 28 */ "Extra",
+ /* 29 */ "Data",
+ /* 30 */ "Invalid"
+};
+
+
+char *
+AcpiUtGetTypeName (
+ ACPI_OBJECT_TYPE Type)
+{
+
+ if (Type > ACPI_TYPE_INVALID)
+ {
+ return (ACPI_CAST_PTR (char, AcpiGbl_BadType));
+ }
+
+ return (ACPI_CAST_PTR (char, AcpiGbl_NsTypeNames[Type]));
+}
+
+
+char *
+AcpiUtGetObjectTypeName (
+ ACPI_OPERAND_OBJECT *ObjDesc)
+{
+
+ if (!ObjDesc)
+ {
+ return ("[NULL Object Descriptor]");
+ }
+
+ return (AcpiUtGetTypeName (ObjDesc->Common.Type));
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtGetNodeName
+ *
+ * PARAMETERS: Object - A namespace node
+ *
+ * RETURN: ASCII name of the node
+ *
+ * DESCRIPTION: Validate the node and return the node's ACPI name.
+ *
+ ******************************************************************************/
+
+char *
+AcpiUtGetNodeName (
+ void *Object)
+{
+ ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) Object;
+
+
+ /* Must return a string of exactly 4 characters == ACPI_NAME_SIZE */
+
+ if (!Object)
+ {
+ return ("NULL");
+ }
+
+ /* Check for Root node */
+
+ if ((Object == ACPI_ROOT_OBJECT) ||
+ (Object == AcpiGbl_RootNode))
+ {
+ return ("\"\\\" ");
+ }
+
+ /* Descriptor must be a namespace node */
+
+ if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED)
+ {
+ return ("####");
+ }
+
+ /*
+ * Ensure name is valid. The name was validated/repaired when the node
+ * was created, but make sure it has not been corrupted.
+ */
+ AcpiUtRepairName (Node->Name.Ascii);
+
+ /* Return the name */
+
+ return (Node->Name.Ascii);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtGetDescriptorName
+ *
+ * PARAMETERS: Object - An ACPI object
+ *
+ * RETURN: Decoded name of the descriptor type
+ *
+ * DESCRIPTION: Validate object and return the descriptor type
+ *
+ ******************************************************************************/
+
+/* Printable names of object descriptor types */
+
+static const char *AcpiGbl_DescTypeNames[] =
+{
+ /* 00 */ "Not a Descriptor",
+ /* 01 */ "Cached",
+ /* 02 */ "State-Generic",
+ /* 03 */ "State-Update",
+ /* 04 */ "State-Package",
+ /* 05 */ "State-Control",
+ /* 06 */ "State-RootParseScope",
+ /* 07 */ "State-ParseScope",
+ /* 08 */ "State-WalkScope",
+ /* 09 */ "State-Result",
+ /* 10 */ "State-Notify",
+ /* 11 */ "State-Thread",
+ /* 12 */ "Walk",
+ /* 13 */ "Parser",
+ /* 14 */ "Operand",
+ /* 15 */ "Node"
+};
+
+
+char *
+AcpiUtGetDescriptorName (
+ void *Object)
+{
+
+ if (!Object)
+ {
+ return ("NULL OBJECT");
+ }
+
+ if (ACPI_GET_DESCRIPTOR_TYPE (Object) > ACPI_DESC_TYPE_MAX)
+ {
+ return ("Not a Descriptor");
+ }
+
+ return (ACPI_CAST_PTR (char,
+ AcpiGbl_DescTypeNames[ACPI_GET_DESCRIPTOR_TYPE (Object)]));
+
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtGetReferenceName
+ *
+ * PARAMETERS: Object - An ACPI reference object
+ *
+ * RETURN: Decoded name of the type of reference
+ *
+ * DESCRIPTION: Decode a reference object sub-type to a string.
+ *
+ ******************************************************************************/
+
+/* Printable names of reference object sub-types */
+
+static const char *AcpiGbl_RefClassNames[] =
+{
+ /* 00 */ "Local",
+ /* 01 */ "Argument",
+ /* 02 */ "RefOf",
+ /* 03 */ "Index",
+ /* 04 */ "DdbHandle",
+ /* 05 */ "Named Object",
+ /* 06 */ "Debug"
+};
+
+const char *
+AcpiUtGetReferenceName (
+ ACPI_OPERAND_OBJECT *Object)
+{
+
+ if (!Object)
+ {
+ return ("NULL Object");
+ }
+
+ if (ACPI_GET_DESCRIPTOR_TYPE (Object) != ACPI_DESC_TYPE_OPERAND)
+ {
+ return ("Not an Operand object");
+ }
+
+ if (Object->Common.Type != ACPI_TYPE_LOCAL_REFERENCE)
+ {
+ return ("Not a Reference object");
+ }
+
+ if (Object->Reference.Class > ACPI_REFCLASS_MAX)
+ {
+ return ("Unknown Reference class");
+ }
+
+ return (AcpiGbl_RefClassNames[Object->Reference.Class]);
+}
+
+
+#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
+/*
+ * Strings and procedures used for debug only
+ */
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtGetMutexName
+ *
+ * PARAMETERS: MutexId - The predefined ID for this mutex.
+ *
+ * RETURN: Decoded name of the internal mutex
+ *
+ * DESCRIPTION: Translate a mutex ID into a name string (Debug only)
+ *
+ ******************************************************************************/
+
+/* Names for internal mutex objects, used for debug output */
+
+static char *AcpiGbl_MutexNames[ACPI_NUM_MUTEX] =
+{
+ "ACPI_MTX_Interpreter",
+ "ACPI_MTX_Namespace",
+ "ACPI_MTX_Tables",
+ "ACPI_MTX_Events",
+ "ACPI_MTX_Caches",
+ "ACPI_MTX_Memory",
+ "ACPI_MTX_CommandComplete",
+ "ACPI_MTX_CommandReady"
+};
+
+char *
+AcpiUtGetMutexName (
+ UINT32 MutexId)
+{
+
+ if (MutexId > ACPI_MAX_MUTEX)
+ {
+ return ("Invalid Mutex ID");
+ }
+
+ return (AcpiGbl_MutexNames[MutexId]);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtGetNotifyName
+ *
+ * PARAMETERS: NotifyValue - Value from the Notify() request
+ *
+ * RETURN: Decoded name for the notify value
+ *
+ * DESCRIPTION: Translate a Notify Value to a notify namestring.
+ *
+ ******************************************************************************/
+
+/* Names for Notify() values, used for debug output */
+
+static const char *AcpiGbl_NotifyValueNames[] =
+{
+ "Bus Check",
+ "Device Check",
+ "Device Wake",
+ "Eject Request",
+ "Device Check Light",
+ "Frequency Mismatch",
+ "Bus Mode Mismatch",
+ "Power Fault",
+ "Capabilities Check",
+ "Device PLD Check",
+ "Reserved",
+ "System Locality Update"
+};
+
+const char *
+AcpiUtGetNotifyName (
+ UINT32 NotifyValue)
+{
+
+ if (NotifyValue <= ACPI_NOTIFY_MAX)
+ {
+ return (AcpiGbl_NotifyValueNames[NotifyValue]);
+ }
+ else if (NotifyValue <= ACPI_MAX_SYS_NOTIFY)
+ {
+ return ("Reserved");
+ }
+ else /* Greater or equal to 0x80 */
+ {
+ return ("**Device Specific**");
+ }
+}
+#endif
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtValidObjectType
+ *
+ * PARAMETERS: Type - Object type to be validated
+ *
+ * RETURN: TRUE if valid object type, FALSE otherwise
+ *
+ * DESCRIPTION: Validate an object type
+ *
+ ******************************************************************************/
+
+BOOLEAN
+AcpiUtValidObjectType (
+ ACPI_OBJECT_TYPE Type)
+{
+
+ if (Type > ACPI_TYPE_LOCAL_MAX)
+ {
+ /* Note: Assumes all TYPEs are contiguous (external/local) */
+
+ return (FALSE);
+ }
+
+ return (TRUE);
+}
diff --git a/utilities/utglobal.c b/utilities/utglobal.c
index 8e8cd433d7ff..336f6706c172 100644
--- a/utilities/utglobal.c
+++ b/utilities/utglobal.c
@@ -46,7 +46,6 @@
#include "acpi.h"
#include "accommon.h"
-#include "acnamesp.h"
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME ("utglobal")
@@ -120,47 +119,6 @@ const char *AcpiGbl_HighestDstateNames[ACPI_NUM_SxD_METHODS] =
/*******************************************************************************
*
- * 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)
-{
- const char *Exception = NULL;
-
-
- ACPI_FUNCTION_ENTRY ();
-
-
- 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)
-
-
-/*******************************************************************************
- *
* Namespace globals
*
******************************************************************************/
@@ -196,78 +154,6 @@ const ACPI_PREDEFINED_NAMES AcpiGbl_PreDefinedNames[] =
{NULL, ACPI_TYPE_ANY, NULL}
};
-/*
- * Properties of the ACPI Object Types, both internal and external.
- * The table is indexed by values of ACPI_OBJECT_TYPE
- */
-const UINT8 AcpiGbl_NsProperties[ACPI_NUM_NS_TYPES] =
-{
- ACPI_NS_NORMAL, /* 00 Any */
- ACPI_NS_NORMAL, /* 01 Number */
- ACPI_NS_NORMAL, /* 02 String */
- ACPI_NS_NORMAL, /* 03 Buffer */
- ACPI_NS_NORMAL, /* 04 Package */
- ACPI_NS_NORMAL, /* 05 FieldUnit */
- ACPI_NS_NEWSCOPE, /* 06 Device */
- ACPI_NS_NORMAL, /* 07 Event */
- ACPI_NS_NEWSCOPE, /* 08 Method */
- ACPI_NS_NORMAL, /* 09 Mutex */
- ACPI_NS_NORMAL, /* 10 Region */
- ACPI_NS_NEWSCOPE, /* 11 Power */
- ACPI_NS_NEWSCOPE, /* 12 Processor */
- ACPI_NS_NEWSCOPE, /* 13 Thermal */
- ACPI_NS_NORMAL, /* 14 BufferField */
- ACPI_NS_NORMAL, /* 15 DdbHandle */
- ACPI_NS_NORMAL, /* 16 Debug Object */
- ACPI_NS_NORMAL, /* 17 DefField */
- ACPI_NS_NORMAL, /* 18 BankField */
- ACPI_NS_NORMAL, /* 19 IndexField */
- ACPI_NS_NORMAL, /* 20 Reference */
- ACPI_NS_NORMAL, /* 21 Alias */
- ACPI_NS_NORMAL, /* 22 MethodAlias */
- ACPI_NS_NORMAL, /* 23 Notify */
- ACPI_NS_NORMAL, /* 24 Address Handler */
- ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 25 Resource Desc */
- ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 26 Resource Field */
- ACPI_NS_NEWSCOPE, /* 27 Scope */
- ACPI_NS_NORMAL, /* 28 Extra */
- ACPI_NS_NORMAL, /* 29 Data */
- ACPI_NS_NORMAL /* 30 Invalid */
-};
-
-
-/* Hex to ASCII conversion table */
-
-static const char AcpiGbl_HexToAscii[] =
-{
- '0','1','2','3','4','5','6','7',
- '8','9','A','B','C','D','E','F'
-};
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtHexToAsciiChar
- *
- * PARAMETERS: Integer - Contains the hex digit
- * Position - bit position of the digit within the
- * integer (multiple of 4)
- *
- * RETURN: The converted Ascii character
- *
- * DESCRIPTION: Convert a hex digit to an Ascii character
- *
- ******************************************************************************/
-
-char
-AcpiUtHexToAsciiChar (
- UINT64 Integer,
- UINT32 Position)
-{
-
- return (AcpiGbl_HexToAscii[(Integer >> Position) & 0xF]);
-}
-
/******************************************************************************
*
@@ -314,451 +200,6 @@ ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS] =
/* ACPI_EVENT_RTC */ {ACPI_BITREG_RT_CLOCK_STATUS, ACPI_BITREG_RT_CLOCK_ENABLE, ACPI_BITMASK_RT_CLOCK_STATUS, ACPI_BITMASK_RT_CLOCK_ENABLE},
};
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtGetRegionName
- *
- * PARAMETERS: None.
- *
- * RETURN: Status
- *
- * DESCRIPTION: Translate a Space ID into a name string (Debug only)
- *
- ******************************************************************************/
-
-/* Region type decoding */
-
-const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] =
-{
- "SystemMemory",
- "SystemIO",
- "PCI_Config",
- "EmbeddedControl",
- "SMBus",
- "SystemCMOS",
- "PCIBARTarget",
- "IPMI",
- "DataTable"
-};
-
-
-char *
-AcpiUtGetRegionName (
- UINT8 SpaceId)
-{
-
- if (SpaceId >= ACPI_USER_REGION_BEGIN)
- {
- return ("UserDefinedRegion");
- }
- else if (SpaceId >= ACPI_NUM_PREDEFINED_REGIONS)
- {
- return ("InvalidSpaceId");
- }
-
- return (ACPI_CAST_PTR (char, AcpiGbl_RegionTypes[SpaceId]));
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtGetEventName
- *
- * PARAMETERS: None.
- *
- * RETURN: Status
- *
- * DESCRIPTION: Translate a Event ID into a name string (Debug only)
- *
- ******************************************************************************/
-
-/* Event type decoding */
-
-static const char *AcpiGbl_EventTypes[ACPI_NUM_FIXED_EVENTS] =
-{
- "PM_Timer",
- "GlobalLock",
- "PowerButton",
- "SleepButton",
- "RealTimeClock",
-};
-
-
-char *
-AcpiUtGetEventName (
- UINT32 EventId)
-{
-
- if (EventId > ACPI_EVENT_MAX)
- {
- return ("InvalidEventID");
- }
-
- return (ACPI_CAST_PTR (char, AcpiGbl_EventTypes[EventId]));
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtGetTypeName
- *
- * PARAMETERS: None.
- *
- * RETURN: Status
- *
- * DESCRIPTION: Translate a Type ID into a name string (Debug only)
- *
- ******************************************************************************/
-
-/*
- * Elements of AcpiGbl_NsTypeNames below must match
- * one-to-one with values of ACPI_OBJECT_TYPE
- *
- * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching;
- * when stored in a table it really means that we have thus far seen no
- * evidence to indicate what type is actually going to be stored for this entry.
- */
-static const char AcpiGbl_BadType[] = "UNDEFINED";
-
-/* Printable names of the ACPI object types */
-
-static const char *AcpiGbl_NsTypeNames[] =
-{
- /* 00 */ "Untyped",
- /* 01 */ "Integer",
- /* 02 */ "String",
- /* 03 */ "Buffer",
- /* 04 */ "Package",
- /* 05 */ "FieldUnit",
- /* 06 */ "Device",
- /* 07 */ "Event",
- /* 08 */ "Method",
- /* 09 */ "Mutex",
- /* 10 */ "Region",
- /* 11 */ "Power",
- /* 12 */ "Processor",
- /* 13 */ "Thermal",
- /* 14 */ "BufferField",
- /* 15 */ "DdbHandle",
- /* 16 */ "DebugObject",
- /* 17 */ "RegionField",
- /* 18 */ "BankField",
- /* 19 */ "IndexField",
- /* 20 */ "Reference",
- /* 21 */ "Alias",
- /* 22 */ "MethodAlias",
- /* 23 */ "Notify",
- /* 24 */ "AddrHandler",
- /* 25 */ "ResourceDesc",
- /* 26 */ "ResourceFld",
- /* 27 */ "Scope",
- /* 28 */ "Extra",
- /* 29 */ "Data",
- /* 30 */ "Invalid"
-};
-
-
-char *
-AcpiUtGetTypeName (
- ACPI_OBJECT_TYPE Type)
-{
-
- if (Type > ACPI_TYPE_INVALID)
- {
- return (ACPI_CAST_PTR (char, AcpiGbl_BadType));
- }
-
- return (ACPI_CAST_PTR (char, AcpiGbl_NsTypeNames[Type]));
-}
-
-
-char *
-AcpiUtGetObjectTypeName (
- ACPI_OPERAND_OBJECT *ObjDesc)
-{
-
- if (!ObjDesc)
- {
- return ("[NULL Object Descriptor]");
- }
-
- return (AcpiUtGetTypeName (ObjDesc->Common.Type));
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtGetNodeName
- *
- * PARAMETERS: Object - A namespace node
- *
- * RETURN: Pointer to a string
- *
- * DESCRIPTION: Validate the node and return the node's ACPI name.
- *
- ******************************************************************************/
-
-char *
-AcpiUtGetNodeName (
- void *Object)
-{
- ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) Object;
-
-
- /* Must return a string of exactly 4 characters == ACPI_NAME_SIZE */
-
- if (!Object)
- {
- return ("NULL");
- }
-
- /* Check for Root node */
-
- if ((Object == ACPI_ROOT_OBJECT) ||
- (Object == AcpiGbl_RootNode))
- {
- return ("\"\\\" ");
- }
-
- /* Descriptor must be a namespace node */
-
- if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED)
- {
- return ("####");
- }
-
- /*
- * Ensure name is valid. The name was validated/repaired when the node
- * was created, but make sure it has not been corrupted.
- */
- AcpiUtRepairName (Node->Name.Ascii);
-
- /* Return the name */
-
- return (Node->Name.Ascii);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtGetDescriptorName
- *
- * PARAMETERS: Object - An ACPI object
- *
- * RETURN: Pointer to a string
- *
- * DESCRIPTION: Validate object and return the descriptor type
- *
- ******************************************************************************/
-
-/* Printable names of object descriptor types */
-
-static const char *AcpiGbl_DescTypeNames[] =
-{
- /* 00 */ "Not a Descriptor",
- /* 01 */ "Cached",
- /* 02 */ "State-Generic",
- /* 03 */ "State-Update",
- /* 04 */ "State-Package",
- /* 05 */ "State-Control",
- /* 06 */ "State-RootParseScope",
- /* 07 */ "State-ParseScope",
- /* 08 */ "State-WalkScope",
- /* 09 */ "State-Result",
- /* 10 */ "State-Notify",
- /* 11 */ "State-Thread",
- /* 12 */ "Walk",
- /* 13 */ "Parser",
- /* 14 */ "Operand",
- /* 15 */ "Node"
-};
-
-
-char *
-AcpiUtGetDescriptorName (
- void *Object)
-{
-
- if (!Object)
- {
- return ("NULL OBJECT");
- }
-
- if (ACPI_GET_DESCRIPTOR_TYPE (Object) > ACPI_DESC_TYPE_MAX)
- {
- return ("Not a Descriptor");
- }
-
- return (ACPI_CAST_PTR (char,
- AcpiGbl_DescTypeNames[ACPI_GET_DESCRIPTOR_TYPE (Object)]));
-
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtGetReferenceName
- *
- * PARAMETERS: Object - An ACPI reference object
- *
- * RETURN: Pointer to a string
- *
- * DESCRIPTION: Decode a reference object sub-type to a string.
- *
- ******************************************************************************/
-
-/* Printable names of reference object sub-types */
-
-static const char *AcpiGbl_RefClassNames[] =
-{
- /* 00 */ "Local",
- /* 01 */ "Argument",
- /* 02 */ "RefOf",
- /* 03 */ "Index",
- /* 04 */ "DdbHandle",
- /* 05 */ "Named Object",
- /* 06 */ "Debug"
-};
-
-const char *
-AcpiUtGetReferenceName (
- ACPI_OPERAND_OBJECT *Object)
-{
-
- if (!Object)
- {
- return ("NULL Object");
- }
-
- if (ACPI_GET_DESCRIPTOR_TYPE (Object) != ACPI_DESC_TYPE_OPERAND)
- {
- return ("Not an Operand object");
- }
-
- if (Object->Common.Type != ACPI_TYPE_LOCAL_REFERENCE)
- {
- return ("Not a Reference object");
- }
-
- if (Object->Reference.Class > ACPI_REFCLASS_MAX)
- {
- return ("Unknown Reference class");
- }
-
- return (AcpiGbl_RefClassNames[Object->Reference.Class]);
-}
-
-
-#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
-/*
- * Strings and procedures used for debug only
- */
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtGetMutexName
- *
- * PARAMETERS: MutexId - The predefined ID for this mutex.
- *
- * RETURN: String containing the name of the mutex. Always returns a valid
- * pointer.
- *
- * DESCRIPTION: Translate a mutex ID into a name string (Debug only)
- *
- ******************************************************************************/
-
-char *
-AcpiUtGetMutexName (
- UINT32 MutexId)
-{
-
- if (MutexId > ACPI_MAX_MUTEX)
- {
- return ("Invalid Mutex ID");
- }
-
- return (AcpiGbl_MutexNames[MutexId]);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtGetNotifyName
- *
- * PARAMETERS: NotifyValue - Value from the Notify() request
- *
- * RETURN: String corresponding to the Notify Value.
- *
- * DESCRIPTION: Translate a Notify Value to a notify namestring.
- *
- ******************************************************************************/
-
-/* Names for Notify() values, used for debug output */
-
-static const char *AcpiGbl_NotifyValueNames[] =
-{
- "Bus Check",
- "Device Check",
- "Device Wake",
- "Eject Request",
- "Device Check Light",
- "Frequency Mismatch",
- "Bus Mode Mismatch",
- "Power Fault",
- "Capabilities Check",
- "Device PLD Check",
- "Reserved",
- "System Locality Update"
-};
-
-const char *
-AcpiUtGetNotifyName (
- UINT32 NotifyValue)
-{
-
- if (NotifyValue <= ACPI_NOTIFY_MAX)
- {
- return (AcpiGbl_NotifyValueNames[NotifyValue]);
- }
- else if (NotifyValue <= ACPI_MAX_SYS_NOTIFY)
- {
- return ("Reserved");
- }
- else /* Greater or equal to 0x80 */
- {
- return ("**Device Specific**");
- }
-}
-#endif
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtValidObjectType
- *
- * PARAMETERS: Type - Object type to be validated
- *
- * RETURN: TRUE if valid object type, FALSE otherwise
- *
- * DESCRIPTION: Validate an object type
- *
- ******************************************************************************/
-
-BOOLEAN
-AcpiUtValidObjectType (
- ACPI_OBJECT_TYPE Type)
-{
-
- if (Type > ACPI_TYPE_LOCAL_MAX)
- {
- /* Note: Assumes all TYPEs are contiguous (external/local) */
-
- return (FALSE);
- }
-
- return (TRUE);
-}
-
/*******************************************************************************
*
@@ -768,7 +209,7 @@ AcpiUtValidObjectType (
*
* RETURN: Status
*
- * DESCRIPTION: Init library globals. All globals that require specific
+ * DESCRIPTION: Init ACPICA globals. All globals that require specific
* initialization should be initialized here!
*
******************************************************************************/
@@ -865,6 +306,7 @@ AcpiUtInitGlobals (
AcpiGbl_DbOutputFlags = ACPI_DB_CONSOLE_OUTPUT;
AcpiGbl_OsiData = 0;
AcpiGbl_OsiMutex = NULL;
+ AcpiGbl_RegMethodsExecuted = FALSE;
/* Hardware oriented */
@@ -907,5 +349,3 @@ ACPI_EXPORT_SYMBOL (AcpiDbgLevel)
ACPI_EXPORT_SYMBOL (AcpiDbgLayer)
ACPI_EXPORT_SYMBOL (AcpiGpeCount)
ACPI_EXPORT_SYMBOL (AcpiCurrentGpeCount)
-
-