Merge ACPICA 20160422.

This commit is contained in:
Jung-uk Kim 2016-04-27 19:09:21 +00:00
commit f8146b882b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=298714
341 changed files with 19576 additions and 13253 deletions

View File

@ -288,7 +288,6 @@ contrib/dev/acpica/components/debugger/dbcmds.c optional acpi acpi_debug
contrib/dev/acpica/components/debugger/dbconvert.c optional acpi acpi_debug
contrib/dev/acpica/components/debugger/dbdisply.c optional acpi acpi_debug
contrib/dev/acpica/components/debugger/dbexec.c optional acpi acpi_debug
contrib/dev/acpica/components/debugger/dbfileio.c optional acpi acpi_debug
contrib/dev/acpica/components/debugger/dbhistry.c optional acpi acpi_debug
contrib/dev/acpica/components/debugger/dbinput.c optional acpi acpi_debug
contrib/dev/acpica/components/debugger/dbmethod.c optional acpi acpi_debug
@ -339,6 +338,7 @@ contrib/dev/acpica/components/events/evxface.c optional acpi
contrib/dev/acpica/components/events/evxfevnt.c optional acpi
contrib/dev/acpica/components/events/evxfgpe.c optional acpi
contrib/dev/acpica/components/events/evxfregn.c optional acpi
contrib/dev/acpica/components/executer/exconcat.c optional acpi
contrib/dev/acpica/components/executer/exconfig.c optional acpi
contrib/dev/acpica/components/executer/exconvrt.c optional acpi
contrib/dev/acpica/components/executer/excreate.c optional acpi
@ -362,6 +362,7 @@ contrib/dev/acpica/components/executer/exstore.c optional acpi
contrib/dev/acpica/components/executer/exstoren.c optional acpi
contrib/dev/acpica/components/executer/exstorob.c optional acpi
contrib/dev/acpica/components/executer/exsystem.c optional acpi
contrib/dev/acpica/components/executer/extrace.c optional acpi
contrib/dev/acpica/components/executer/exutils.c optional acpi
contrib/dev/acpica/components/hardware/hwacpi.c optional acpi
contrib/dev/acpica/components/hardware/hwesleep.c optional acpi
@ -430,6 +431,7 @@ contrib/dev/acpica/components/tables/tbxfload.c optional acpi
contrib/dev/acpica/components/tables/tbxfroot.c optional acpi
contrib/dev/acpica/components/utilities/utaddress.c optional acpi
contrib/dev/acpica/components/utilities/utalloc.c optional acpi
contrib/dev/acpica/components/utilities/utascii.c optional acpi
contrib/dev/acpica/components/utilities/utbuffer.c optional acpi
contrib/dev/acpica/components/utilities/utcache.c optional acpi
contrib/dev/acpica/components/utilities/utcopy.c optional acpi
@ -3412,6 +3414,7 @@ libkern/strndup.c standard
libkern/strlcat.c standard
libkern/strlcpy.c standard
libkern/strlen.c standard
libkern/strncat.c standard
libkern/strncmp.c standard
libkern/strncpy.c standard
libkern/strnlen.c standard

View File

@ -20,8 +20,8 @@ fulldirs="common compiler components include os_specific"
stripdirs="generate libraries tests tools"
stripfiles="Makefile README accygwin.h acdragonfly.h acdragonflyex.h \
acefi.h acefiex.h achaiku.h acintel.h aclinux.h aclinuxex.h \
acmacosx.h acmsvc.h acmsvcex.h acnetbsd.h acos2.h acwin.h \
acwin64.h acwinex.h new_table.txt osbsdtbl.c osefitbl.c \
acmacosx.h acmsvc.h acmsvcex.h acnetbsd.h acos2.h acqnx.h \
acwin.h acwin64.h acwinex.h new_table.txt osbsdtbl.c osefitbl.c \
osefixf.c osfreebsdtbl.c oslinuxtbl.c osunixdir.c osunixmap.c \
oswindir.c oswintbl.c oswinxf.c readme.txt utclib.c"

View File

@ -1,8 +1,605 @@
----------------------------------------
22 April 2016. Summary of changes for version 20160422:
1) ACPICA kernel-resident subsystem:
Fixed a regression in the GAS (generic address structure) arbitrary bit
support in AcpiHwRead/AcpiHwWrite. Problem could cause incorrect behavior
and incorrect return values. Lv Zheng. ACPICA BZ 1270.
ACPI 6.0: Added support for new/renamed resource macros. One new argument
was added to each of these macros, and the original name has been
deprecated. The AML disassembler will always disassemble to the new
names. Support for the new macros was added to iASL, disassembler,
resource manager, and the acpihelp utility. ACPICA BZ 1274.
I2cSerialBus -> I2cSerialBusV2
SpiSerialBus -> SpiSerialBusV2
UartSerialBus -> UartSerialBusV2
ACPI 6.0: Added support for a new integer field that was appended to the
package object returned by the _BIX method. This adds iASL compile-time
and AML runtime error checking. ACPICA BZ 1273.
ACPI 6.1: Added support for a new PCCT subtable, "HW-Reduced Comm
Subspace Type2" (Headers, Disassembler, and data table compiler).
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.
Current Release:
Non-Debug Version: 137.4K Code, 52.6K Data, 190.0K Total
Debug Version: 201.5K Code, 82.2K Data, 283.7K Total
Previous Release:
Non-Debug Version: 137.1K Code, 51.5K Data, 188.6K Total
Debug Version: 201.0K Code, 82.0K Data, 283.0K Total
2) iASL Compiler/Disassembler and Tools:
iASL: Implemented an ASL grammar extension to allow/enable executable
"module-level code" to be created and executed under the various
operators that create new scopes. This type of AML code is already
supported in all known AML interpreters, and the grammar change will
appear in the next version of the ACPI specification. Simplifies the
conditional runtime creation of named objects under these object types:
Device
PowerResource
Processor
Scope
ThermalZone
iASL: Implemented a new ASL extension, a "For" loop macro to add greater
ease-of-use to the ASL language. The syntax is similar to the
corresponding C operator, and is implemented with the existing AML While
opcode -- thus requiring no changes to existing AML interpreters.
For (Initialize, Predicate, Update) {TermList}
Grammar:
ForTerm :=
For (
Initializer // Nothing | TermArg => ComputationalData
Predicate // Nothing | TermArg => ComputationalData
Update // Nothing | TermArg => ComputationalData
) {TermList}
iASL: The _HID/_ADR detection and validation has been enhanced to search
under conditionals in order to allow these objects to be conditionally
created at runtime.
iASL: Fixed several issues with the constant folding feature. The
improvement allows better detection and resolution of statements that can
be folded at compile time. ACPICA BZ 1266.
iASL/Disassembler: Fixed a couple issues with the Else{If{}...}
conversion to the ASL ElseIf operator where incorrect ASL code could be
generated.
iASL/Disassembler: Fixed a problem with the ASL+ code disassembly where
sometimes an extra (and extraneous) set of parentheses were emitted for
some combinations of operators. Although this did not cause any problems
with recompilation of the disassembled code, it made the code more
difficult to read. David Box. ACPICA BZ 1231.
iASL: Changed to ignore the unreferenced detection for predefined names
of resource descriptor elements, when the resource descriptor is
created/defined within a control method.
iASL: Disassembler: Fix a possible fault with externally declared Buffer
objects.
----------------------------------------
18 March 2016. Summary of changes for version 20160318:
1) ACPICA kernel-resident subsystem:
Added support for arbitrary bit lengths and bit offsets for registers
defined by the Generic Address Structure. Previously, only aligned bit
lengths of 8/16/32/64 were supported. This was sufficient for many years,
but recently some machines have been seen that require arbitrary bit-
level support. ACPICA BZ 1240. Lv Zheng.
Fixed an issue where the \_SB._INI method sometimes must be evaluated
before any _REG methods are evaluated. Lv Zheng.
Implemented several changes related to ACPI table support
(Headers/Disassembler/TableCompiler):
NFIT: For ACPI 6.1, updated to add some additional new fields and
constants.
FADT: Updated a warning message and set compliance to ACPI 6.1 (Version
6).
DMAR: Added new constants per the 10/2014 DMAR spec.
IORT: Added new subtable per the 10/2015 IORT spec.
HEST: For ACPI 6.1, added new constants and new subtable.
DBG2: Added new constants per the 12/2015 DBG2 spec.
FPDT: Fixed several incorrect fields, add the FPDT boot record structure.
ACPICA BZ 1249.
ERST/EINJ: Updated disassembler with new "Execute Timings" actions.
Updated header support for the DMAR table to match the current version of
the related spec.
Added extensions to the ASL Concatenate operator to allow any ACPI object
to be passed as an operand. Any object other than Integer/String/Buffer
simply returns a string containing the object type. This extends the
usefulness of the Printf macros. Previously, Concatenate would abort the
control method if a non-data object was encountered.
ACPICA source code: Deployed the C "const" keyword across the source code
where appropriate. ACPICA BZ 732. Joerg Sonnenberger (NetBSD).
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.
Current Release:
Non-Debug Version: 137.1K Code, 51.5K Data, 188.6K Total
Debug Version: 201.0K Code, 82.0K Data, 283.0K Total
Previous Release:
Non-Debug Version: 136.2K Code, 51.5K Data, 187.7K Total
Debug Version: 200.4K Code, 82.0K Data, 282.4K Total
2) iASL Compiler/Disassembler and Tools:
iASL/Disassembler: Improved the heuristic used to determine the number of
arguments for an externally defined control method (a method in another
table). Although this is an improvement, there is no deterministic way to
"guess" the number of method arguments. Only the ACPI 6.0 External opcode
will completely solve this problem as it is deployed (automatically) in
newer BIOS code.
iASL/Disassembler: Fixed an ordering issue for emitted External() ASL
statements that could cause errors when the disassembled file is
compiled. ACPICA BZ 1243. David Box.
iASL: Fixed a regression caused by the merger of the two versions of the
local strtoul64. Because of a dependency on a global variable, strtoul64
could return an error for integers greater than a 32-bit value. ACPICA BZ
1260.
iASL: Fixed a regression where a fault could occur for an ASL Return
statement if it invokes a control method that is not resolved. ACPICA BZ
1264.
AcpiXtract: Improved input file validation: detection of binary files and
non-acpidump text files.
----------------------------------------
12 February 2016. Summary of changes for version 20160212:
1) ACPICA kernel-resident subsystem:
Implemented full support for the ACPI 6.1 specification (released in
January). This version of the specification is available at:
http://www.uefi.org/specifications
Only a relatively small number of changes were required in ACPICA to
support ACPI 6.1, in these areas:
- New predefined names
- New _HID values
- A new subtable for HEST
- A few other header changes for new values
Ensure \_SB_._INI is executed before any _REG methods are executed. There
appears to be existing BIOS code that relies on this behavior. Lv Zheng.
Reverted a change made in version 20151218 which enabled method
invocations to be targets of various ASL operators (SuperName and Target
grammar elements). While the new behavior is supported by the ACPI
specification, other AML interpreters do not support this behavior and
never will. The ACPI specification will be updated for ACPI 6.2 to remove
this support. Therefore, the change was reverted to the original ACPICA
behavior.
ACPICA now supports the GCC 6 compiler.
Current Release: (Note: build changes increased sizes)
Non-Debug Version: 136.2K Code, 51.5K Data, 187.7K Total
Debug Version: 200.4K Code, 82.0K Data, 282.4K Total
Previous Release:
Non-Debug Version: 102.7K Code, 28.4K Data, 131.1K Total
Debug Version: 200.4K Code, 81.9K Data, 282.3K Total
2) iASL Compiler/Disassembler and Tools:
Completed full support for the ACPI 6.0 External() AML opcode. The
compiler emits an external AML opcode for each ASL External statement.
This opcode is used by the disassembler to assist with the disassembly of
external control methods by specifying the required number of arguments
for the method. AML interpreters do not use this opcode. To ensure that
interpreters do not even see the opcode, a block of one or more external
opcodes is surrounded by an "If(0)" construct. As this feature becomes
commonly deployed in BIOS code, the ability of disassemblers to correctly
disassemble AML code will be greatly improved. David Box.
iASL: Implemented support for an optional cross-reference output file.
The -lx option will create a the cross-reference file with the suffix
"xrf". Three different types of cross-reference are created in this file:
- List of object references made from within each control method
- Invocation (caller) list for each user-defined control method
- List of references to each non-method object in the namespace
iASL: Method invocations as ASL Target operands are now disallowed and
flagged as errors in preparation for ACPI 6.2 (see the description of the
problem above).
----------------------------------------
8 January 2016. Summary of changes for version 20160108:
1) ACPICA kernel-resident subsystem:
Updated all ACPICA copyrights and signons to 2016: Added the 2016
copyright to all source code module headers and utility/tool signons.
This includes the standard Linux dual-license header. This affects
virtually every file in the ACPICA core subsystem, iASL compiler, all
ACPICA utilities, and the ACPICA test suite.
Fixed a regression introduced in version 20151218 concerning the
execution of so-called module-level ASL/AML code. Namespace objects
created under a module-level If() construct were not properly/fully
entered into the namespace and could cause an interpreter fault when
accessed.
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.
Current Release:
Non-Debug Version: 102.7K Code, 28.4K Data, 131.1K Total
Debug Version: 200.4K Code, 81.9K Data, 282.4K Total
Previous Release:
Non-Debug Version: 102.6K Code, 28.4K Data, 131.0K Total
Debug Version: 200.3K Code, 81.9K Data, 282.3K Total
2) iASL Compiler/Disassembler and Tools:
Fixed a problem with the compilation of the GpioIo and GpioInt resource
descriptors. The _PIN field name was incorrectly defined to be an array
of 32-bit values, but the _PIN values are in fact 16 bits each. This
would cause incorrect bit width warnings when using Word (16-bit) fields
to access the descriptors.
----------------------------------------
18 December 2015. Summary of changes for version 20151218:
1) ACPICA kernel-resident subsystem:
Implemented per-AML-table execution of "module-level code" as individual
ACPI tables are loaded into the namespace during ACPICA initialization.
In other words, any module-level code within an AML table is executed
immediately after the table is loaded, instead of batched and executed
after all of the tables have been loaded. This provides compatibility
with other ACPI implementations. ACPICA BZ 1219. Bob Moore, Lv Zheng,
David Box.
To fully support the feature above, the default operation region handlers
for the SystemMemory, SystemIO, and PCI_Config address spaces are now
installed before any ACPI tables are loaded. This enables module-level
code to access these address spaces during the table load and module-
level code execution phase. ACPICA BZ 1220. Bob Moore, Lv Zheng, David
Box.
Implemented several changes to the internal _REG support in conjunction
with the changes above. Also, changes to the AcpiExec/AcpiNames/Examples
utilities for the changes above. Although these tools were changed, host
operating systems that simply use the default handlers for SystemMemory,
SystemIO, and PCI_Config spaces should not require any update. Lv Zheng.
For example, in the code below, DEV1 is conditionally added to the
namespace by the DSDT via module-level code that accesses an operation
region. The SSDT references DEV1 via the Scope operator. DEV1 must be
created immediately after the DSDT is loaded in order for the SSDT to
successfully reference DEV1. Previously, this code would cause an
AE_NOT_EXIST exception during the load of the SSDT. Now, this code is
fully supported by ACPICA.
DefinitionBlock ("", "DSDT", 2, "Intel", "DSDT1", 1)
{
OperationRegion (OPR1, SystemMemory, 0x400, 32)
Field (OPR1, AnyAcc, NoLock, Preserve)
{
FLD1, 1
}
If (FLD1)
{
Device (\DEV1)
{
}
}
}
DefinitionBlock ("", "SSDT", 2, "Intel", "SSDT1", 1)
{
External (\DEV1, DeviceObj)
Scope (\DEV1)
{
}
}
Fixed an AML interpreter problem where control method invocations were
not handled correctly when the invocation was itself a SuperName argument
to another ASL operator. In these cases, the method was not invoked.
ACPICA BZ 1002. Affects the following ASL operators that have a SuperName
argument:
Store
Acquire, Wait
CondRefOf, RefOf
Decrement, Increment
Load, Unload
Notify
Signal, Release, Reset
SizeOf
Implemented automatic String-to-ObjectReference conversion support for
packages returned by predefined names (such as _DEP). A common BIOS error
is to add double quotes around an ObjectReference namepath, which turns
the reference into an unexpected string object. This support detects the
problem and corrects it before the package is returned to the caller that
invoked the method. Lv Zheng.
Implemented extensions to the Concatenate operator. Concatenate now
accepts any type of object, it is not restricted to simply
Integer/String/Buffer. For objects other than these 3 basic data types,
the argument is treated as a string containing the name of the object
type. This expands the utility of Concatenate and the Printf/Fprintf
macros. ACPICA BZ 1222.
Cleaned up the output of the ASL Debug object. The timer() value is now
optional and no longer emitted by default. Also, the basic data types of
Integer/String/Buffer are simply emitted as their values, without a data
type string -- since the data type is obvious from the output. ACPICA BZ
1221.
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.
Current Release:
Non-Debug Version: 102.6K Code, 28.4K Data, 131.0K Total
Debug Version: 200.3K Code, 81.9K Data, 282.3K Total
Previous Release:
Non-Debug Version: 102.0K Code, 28.3K Data, 130.3K Total
Debug Version: 199.6K Code, 81.8K Data, 281.4K Total
2) iASL Compiler/Disassembler and Tools:
iASL: Fixed some issues with the ASL Include() operator. This operator
was incorrectly defined in the iASL parser rules, causing a new scope to
be opened for the code within the include file. This could lead to
several issues, including allowing ASL code that is technically illegal
and not supported by AML interpreters. Note, this does not affect the
related #include preprocessor operator. ACPICA BZ 1212.
iASL/Disassembler: Implemented support for the ASL ElseIf operator. This
operator is essentially an ASL macro since there is no AML opcode
associated with it. The code emitted by the iASL compiler for ElseIf is
an Else opcode followed immediately by an If opcode. The disassembler
will now emit an ElseIf if it finds an Else immediately followed by an
If. This simplifies the decoded ASL, especially for deeply nested
If..Else and large Switch constructs. Thus, the disassembled code more
closely follows the original source ASL. ACPICA BZ 1211. Example:
Old disassembly:
Else
{
If (Arg0 == 0x02)
{
Local0 = 0x05
}
}
New disassembly:
ElseIf (Arg0 == 0x02)
{
Local0 = 0x05
}
AcpiExec: Added support for the new module level code behavior and the
early region installation. This required a small change to the
initialization, since AcpiExec must install its own operation region
handlers.
AcpiExec: Added support to make the debug object timer optional. Default
is timer disabled. This cleans up the debug object output -- the timer
data is rarely used.
AcpiExec: Multiple ACPI tables are now loaded in the order that they
appear on the command line. This can be important when there are
interdependencies/references between the tables.
iASL/Templates. Add support to generate template files with multiple
SSDTs within a single output file. Also added ommand line support to
specify the number of SSDTs (in addition to a single DSDT). ACPICA BZ
1223, 1225.
----------------------------------------
24 November 2015. Summary of changes for version 20151124:
1) ACPICA kernel-resident subsystem:
Fixed a possible regression for a previous update to FADT handling. The
FADT no longer has a fixed table ID, causing some issues with code that
was hardwired to a specific ID. Lv Zheng.
Fixed a problem where the method auto-serialization could interfere with
the current SyncLevel. This change makes the auto-serialization support
transparent to the SyncLevel support and management.
Removed support for the _SUB predefined name in AcpiGetObjectInfo. This
interface is intended for early access to the namespace during the
initial namespace device discovery walk. The _SUB method has been seen to
access operation regions in some cases, causing errors because the
operation regions are not fully initialized.
AML Debugger: Fixed some issues with the terminate/quit/exit commands
that can cause faults. Lv Zheng.
AML Debugger: Add thread ID support so that single-step mode only applies
to the AML Debugger thread. This prevents runtime errors within some
kernels. Lv Zheng.
Eliminated extraneous warnings from AcpiGetSleepTypeData. Since the _Sx
methods that are invoked by this interface are optional, removed warnings
emitted for the case where one or more of these methods do not exist.
ACPICA BZ 1208, original change by Prarit Bhargava.
Made a major pass through the entire ACPICA source code base to
standardize formatting that has diverged a bit over time. There are no
functional changes, but this will of course cause quite a few code
differences from the previous ACPICA release.
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.
Current Release:
Non-Debug Version: 102.0K Code, 28.3K Data, 130.3K Total
Debug Version: 199.6K Code, 81.8K Data, 281.4K Total
Previous Release:
Non-Debug Version: 101.7K Code, 27.9K Data, 129.6K Total
Debug Version: 199.3K Code, 81.4K Data, 280.7K Total
2) iASL Compiler/Disassembler and Tools:
iASL/acpiexec/acpixtract/disassembler: Added support to allow multiple
definition blocks within a single ASL file and the resulting AML file.
Support for this type of file was also added to the various tools that
use binary AML files: acpiexec, acpixtract, and the AML disassembler. The
example code below shows two definition blocks within the same file:
DefinitionBlock ("dsdt.aml", "DSDT", 2, "Intel", "Template",
0x12345678)
{
}
DefinitionBlock ("", "SSDT", 2, "Intel", "Template", 0xABCDEF01)
{
}
iASL: Enhanced typechecking for the Name() operator. All expressions for
the value of the named object must be reduced/folded to a single constant
at compile time, as per the ACPI specification (the AML definition of
Name()).
iASL: Fixed some code indentation issues for the -ic and -ia options (C
and assembly headers). Now all emitted code correctly begins in column 1.
iASL: Added an error message for an attempt to open a Scope() on an
object defined in an SSDT. The DSDT is always loaded into the namespace
first, so any attempt to open a Scope on an SSDT object will fail at
runtime.
----------------------------------------
30 September 2015. Summary of changes for version 20150930:
1) ACPICA kernel-resident subsystem:
Debugger: Implemented several changes and bug fixes to assist support for
the in-kernel version of the AML debugger. Lv Zheng.
- Fix the "predefined" command for in-kernel debugger.
- Do not enter debug command loop for the help and version commands.
- Disallow "execute" command during execution/single-step of a method.
Interpreter: Updated runtime typechecking for all operators that have
target operands. The operand is resolved and validated that it is legal.
For example, the target cannot be a non-data object such as a Device,
Mutex, ThermalZone, etc., as per the ACPI specification.
Debugger: Fixed the double-mutex user I/O handshake to work when local
deadlock detection is enabled.
Debugger: limited display of method locals and arguments (LocalX and
ArgX) to only those that have actually been initialized. This prevents
lines of extraneous output.
Updated the definition of the NFIT table to correct the bit polarity of
one flag: ACPI_NFIT_MEM_ARMED --> ACPI_NFIT_MEM_NOT_ARMED
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.
Current Release:
Non-Debug Version: 101.7K Code, 27.9K Data, 129.6K Total
Debug Version: 199.3K Code, 81.4K Data, 280.7K Total
Previous Release:
Non-Debug Version: 101.3K Code, 27.7K Data, 129.0K Total
Debug Version: 198.6K Code, 80.9K Data, 279.5K Total
2) iASL Compiler/Disassembler and Tools:
iASL: Improved the compile-time typechecking for operands of many of the
ASL operators:
-- Added an option to disable compiler operand/operator typechecking (-
ot).
-- For the following operators, the TermArg operands are now validated
when possible to be Integer data objects: BankField, OperationRegion,
DataTableRegion, Buffer, and Package.
-- Store (Source, Target): Both the source and target operands are
resolved and checked that the operands are both legal. For example,
neither operand can be a non-data object such as a Device, Mutex,
ThermalZone, etc. Note, as per the ACPI specification, the CopyObject
operator can be used to store an object to any type of target object.
-- Store (Source, Target): If the source is a Package object, the target
must be a Package object, LocalX, ArgX, or Debug. Likewise, if the target
is a Package, the source must also be a Package.
-- Store (Source, Target): A warning is issued if the source and target
resolve to the identical named object.
-- Store (Source, <method invocation>): An error is generated for the
target method invocation, as this construct is not supported by the AML
interpreter.
-- For all ASL math and logic operators, the target operand must be a
data object (Integer, String, Buffer, LocalX, ArgX, or Debug). This
includes the function return value also.
-- External declarations are also included in the typechecking where
possible. External objects defined using the UnknownObj keyword cannot be
typechecked, however.
iASL and Disassembler: Added symbolic (ASL+) support for the ASL Index
operator:
- Legacy code: Index(PKG1, 3)
- New ASL+ code: PKG1[3]
This completes the ACPI 6.0 ASL+ support as it was the only operator not
supported.
iASL: Fixed the file suffix for the preprocessor output file (.i). Two
spaces were inadvertently appended to the filename, causing file access
and deletion problems on some systems.
ASL Test Suite (ASLTS): Updated the master makefile to generate all
possible compiler output files when building the test suite -- thus
exercising these features of the compiler. These files are automatically
deleted when the test suite exits.
----------------------------------------
18 August 2015. Summary of changes for version 20150818:
This release is available at https://acpica.org/downloads
1) ACPICA kernel-resident subsystem:
Fix a regression for AcpiGetTableByIndex interface causing it to fail. Lv
@ -84,6 +681,7 @@ the command is entered with no arguments.
AcpiNames: Add -x option to specify debug level, similar to AcpiExec.
----------------------------------------
17 July 2015. Summary of changes for version 20150717:
@ -340,6 +938,7 @@ directives.
AcpiHelp: Added a new option, -t, to display all known/supported ACPI
tables.
----------------------------------------
10 April 2015. Summary of changes for version 20150410:
@ -347,6 +946,7 @@ Reverted a change introduced in version 20150408 that caused
a regression in the disassembler where incorrect operator
symbols could be emitted.
----------------------------------------
08 April 2015. Summary of changes for version 20150408:
@ -419,6 +1019,7 @@ Debugger: Removed some unused global variables.
Tests: Updated the makefile for proper generation of the AAPITS suite.
----------------------------------------
04 February 2015. Summary of changes for version 20150204:
@ -459,7 +1060,8 @@ David Box
Non-Debug Version: 101.7K Code, 27.9K Data, 129.6K Total
Debug Version: 199.2K Code, 82.4K Data, 281.6K Total
----------------------------------------
--
--------------------------------------
07 November 2014. Summary of changes for version 20141107:
This release is available at https://acpica.org/downloads
@ -963,6 +1565,7 @@ Disassembler: Cleaned up a block of code that extracts a parent Op
object. Added a comment that explains that the parent is guaranteed to be
valid in this case. ACPICA BZ 1069.
----------------------------------------
24 April 2014. Summary of changes for version 20140424:
@ -1030,6 +1633,7 @@ checking and take care not to reset terminal attributes on exit if they
were never set. This should help guarantee that the terminal is always
left in the previous state on program exit.
----------------------------------------
25 March 2014. Summary of changes for version 20140325:
@ -1130,6 +1734,7 @@ AcpiBin utility:
is made obsolete by the AcpiXtract utility.
2) General cleanup of open files and allocated buffers.
----------------------------------------
14 February 2014. Summary of changes for version 20140214:
@ -1195,6 +1800,7 @@ iASL: Removed the obsolete -g option to obtain ACPI tables from the
Windows registry. This feature has been superseded by the acpidump
utility.
----------------------------------------
14 January 2014. Summary of changes for version 20140114:
@ -1271,6 +1877,7 @@ Debugger: Added the "test predefined" command. This change makes this
test public and puts it under the new "test" command. The test executes
each and every predefined name within the current namespace.
----------------------------------------
18 December 2013. Summary of changes for version 20131218:
@ -1373,6 +1980,7 @@ that it builds to an actual working program, not just example code. Added
ACPI tables and execution of an example control method in the DSDT. Added
makefile support for Unix generation.
----------------------------------------
15 November 2013. Summary of changes for version 20131115:

View File

@ -0,0 +1,538 @@
/******************************************************************************
*
* Module Name: acfileio - Get ACPI tables from file
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2016, 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 <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
#include <contrib/dev/acpica/include/acapps.h>
#include <contrib/dev/acpica/include/actables.h>
#include <contrib/dev/acpica/include/acutils.h>
#include <errno.h>
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME ("acfileio")
/* Local prototypes */
static ACPI_STATUS
AcGetOneTableFromFile (
char *Filename,
FILE *File,
UINT8 GetOnlyAmlTables,
ACPI_TABLE_HEADER **Table);
static ACPI_STATUS
AcCheckTextModeCorruption (
ACPI_TABLE_HEADER *Table);
/*******************************************************************************
*
* FUNCTION: AcGetAllTablesFromFile
*
* PARAMETERS: Filename - Table filename
* GetOnlyAmlTables - TRUE if the tables must be AML tables
* ReturnListHead - Where table list is returned
*
* RETURN: Status
*
* DESCRIPTION: Get all ACPI tables from within a single file.
*
******************************************************************************/
ACPI_STATUS
AcGetAllTablesFromFile (
char *Filename,
UINT8 GetOnlyAmlTables,
ACPI_NEW_TABLE_DESC **ReturnListHead)
{
ACPI_NEW_TABLE_DESC *ListHead = NULL;
ACPI_NEW_TABLE_DESC *ListTail = NULL;
ACPI_NEW_TABLE_DESC *TableDesc;
FILE *File;
ACPI_TABLE_HEADER *Table = NULL;
UINT32 FileSize;
ACPI_STATUS Status = AE_OK;
File = fopen (Filename, "rb");
if (!File)
{
perror ("Could not open input file");
if (errno == ENOENT)
{
return (AE_NOT_EXIST);
}
return (AE_ERROR);
}
/* Get the file size */
FileSize = CmGetFileSize (File);
if (FileSize == ACPI_UINT32_MAX)
{
Status = AE_ERROR;
goto ErrorExit;
}
fprintf (stderr,
"Input file %s, Length 0x%X (%u) bytes\n",
Filename, FileSize, FileSize);
/* We must have at least one ACPI table header */
if (FileSize < sizeof (ACPI_TABLE_HEADER))
{
Status = AE_BAD_HEADER;
goto ErrorExit;
}
/* Check for an non-binary file */
if (!AcIsFileBinary (File))
{
fprintf (stderr,
" %s: File does not appear to contain a valid AML table\n",
Filename);
return (AE_TYPE);
}
/* Read all tables within the file */
while (ACPI_SUCCESS (Status))
{
/* Get one entire ACPI table */
Status = AcGetOneTableFromFile (
Filename, File, GetOnlyAmlTables, &Table);
if (Status == AE_CTRL_TERMINATE)
{
Status = AE_OK;
break;
}
else if (Status == AE_TYPE)
{
return (AE_OK);
}
else if (ACPI_FAILURE (Status))
{
goto ErrorExit;
}
/* Print table header for iASL/disassembler only */
#ifdef ACPI_ASL_COMPILER
AcpiTbPrintTableHeader (0, Table);
#endif
/* Allocate and link a table descriptor */
TableDesc = AcpiOsAllocate (sizeof (ACPI_NEW_TABLE_DESC));
TableDesc->Table = Table;
TableDesc->Next = NULL;
/* Link at the end of the local table list */
if (!ListHead)
{
ListHead = TableDesc;
ListTail = TableDesc;
}
else
{
ListTail->Next = TableDesc;
ListTail = TableDesc;
}
}
/* Add the local table list to the end of the global list */
if (*ReturnListHead)
{
ListTail = *ReturnListHead;
while (ListTail->Next)
{
ListTail = ListTail->Next;
}
ListTail->Next = ListHead;
}
else
{
*ReturnListHead = ListHead;
}
ErrorExit:
fclose(File);
return (Status);
}
/*******************************************************************************
*
* FUNCTION: AcGetOneTableFromFile
*
* PARAMETERS: Filename - File where table is located
* File - Open FILE pointer to Filename
* GetOnlyAmlTables - TRUE if the tables must be AML tables.
* ReturnTable - Where a pointer to the table is returned
*
* RETURN: Status
*
* DESCRIPTION: Read the next ACPI table from a file. Implements support
* for multiple tables within a single file. File must already
* be open.
*
* Note: Loading an RSDP is not supported.
*
******************************************************************************/
static ACPI_STATUS
AcGetOneTableFromFile (
char *Filename,
FILE *File,
UINT8 GetOnlyAmlTables,
ACPI_TABLE_HEADER **ReturnTable)
{
ACPI_STATUS Status = AE_OK;
ACPI_TABLE_HEADER TableHeader;
ACPI_TABLE_HEADER *Table;
INT32 Count;
long TableOffset;
*ReturnTable = NULL;
/* Get the table header to examine signature and length */
TableOffset = ftell (File);
Count = fread (&TableHeader, 1, sizeof (ACPI_TABLE_HEADER), File);
if (Count != sizeof (ACPI_TABLE_HEADER))
{
return (AE_CTRL_TERMINATE);
}
/* Validate the table signature/header (limited ASCII chars) */
Status = AcValidateTableHeader (File, TableOffset);
if (ACPI_FAILURE (Status))
{
return (Status);
}
if (GetOnlyAmlTables)
{
/* Table must be an AML table (DSDT/SSDT) or FADT */
if (!ACPI_COMPARE_NAME (TableHeader.Signature, ACPI_SIG_FADT) &&
!AcpiUtIsAmlTable (&TableHeader))
{
fprintf (stderr,
" %s: Table [%4.4s] is not an AML table - ignoring\n",
Filename, TableHeader.Signature);
return (AE_TYPE);
}
}
/* Allocate a buffer for the entire table */
Table = AcpiOsAllocate ((size_t) TableHeader.Length);
if (!Table)
{
return (AE_NO_MEMORY);
}
/* Read the entire ACPI table, including header */
fseek (File, TableOffset, SEEK_SET);
Count = fread (Table, 1, TableHeader.Length, File);
if (Count != (INT32) TableHeader.Length)
{
Status = AE_ERROR;
goto ErrorExit;
}
/* Validate the checksum (just issue a warning) */
Status = AcpiTbVerifyChecksum (Table, TableHeader.Length);
if (ACPI_FAILURE (Status))
{
Status = AcCheckTextModeCorruption (Table);
if (ACPI_FAILURE (Status))
{
goto ErrorExit;
}
}
*ReturnTable = Table;
return (AE_OK);
ErrorExit:
AcpiOsFree (Table);
return (Status);
}
/*******************************************************************************
*
* FUNCTION: AcIsFileBinary
*
* PARAMETERS: File - Open input file
*
* RETURN: TRUE if file appears to be binary
*
* DESCRIPTION: Scan a file for any non-ASCII bytes.
*
* Note: Maintains current file position.
*
******************************************************************************/
BOOLEAN
AcIsFileBinary (
FILE *File)
{
UINT8 Byte;
BOOLEAN IsBinary = FALSE;
long FileOffset;
/* Scan entire file for any non-ASCII bytes */
FileOffset = ftell (File);
while (fread (&Byte, 1, 1, File) == 1)
{
if (!isprint (Byte) && !isspace (Byte))
{
IsBinary = TRUE;
goto Exit;
}
}
Exit:
fseek (File, FileOffset, SEEK_SET);
return (IsBinary);
}
/*******************************************************************************
*
* FUNCTION: AcValidateTableHeader
*
* PARAMETERS: File - Open input file
*
* RETURN: Status
*
* DESCRIPTION: Determine if a file seems to contain one or more binary ACPI
* tables, via the
* following checks on what would be the table header:
* 1) File must be at least as long as an ACPI_TABLE_HEADER
* 2) There must be enough room in the file to hold entire table
* 3) Signature, OemId, OemTableId, AslCompilerId must be ASCII
*
* Note: There can be multiple definition blocks per file, so we cannot
* expect/compare the file size to be equal to the table length. 12/2015.
*
* Note: Maintains current file position.
*
******************************************************************************/
ACPI_STATUS
AcValidateTableHeader (
FILE *File,
long TableOffset)
{
ACPI_TABLE_HEADER TableHeader;
size_t Actual;
long OriginalOffset;
UINT32 FileSize;
UINT32 i;
ACPI_FUNCTION_TRACE ("AcValidateTableHeader");
/* Read a potential table header */
OriginalOffset = ftell (File);
fseek (File, TableOffset, SEEK_SET);
Actual = fread (&TableHeader, 1, sizeof (ACPI_TABLE_HEADER), File);
fseek (File, OriginalOffset, SEEK_SET);
if (Actual < sizeof (ACPI_TABLE_HEADER))
{
return (AE_ERROR);
}
/* Validate the signature (limited ASCII chars) */
if (!AcpiUtValidNameseg (TableHeader.Signature))
{
fprintf (stderr, "Invalid table signature: 0x%8.8X\n",
*ACPI_CAST_PTR (UINT32, TableHeader.Signature));
return (AE_BAD_SIGNATURE);
}
/* Validate table length against bytes remaining in the file */
FileSize = CmGetFileSize (File);
if (TableHeader.Length > (UINT32) (FileSize - TableOffset))
{
fprintf (stderr, "Table [%4.4s] is too long for file - "
"needs: 0x%.2X, remaining in file: 0x%.2X\n",
TableHeader.Signature, TableHeader.Length,
(UINT32) (FileSize - TableOffset));
return (AE_BAD_HEADER);
}
/*
* These fields must be ASCII: OemId, OemTableId, AslCompilerId.
* We allow a NULL terminator in OemId and OemTableId.
*/
for (i = 0; i < ACPI_NAME_SIZE; i++)
{
if (!ACPI_IS_ASCII ((UINT8) TableHeader.AslCompilerId[i]))
{
goto BadCharacters;
}
}
for (i = 0; (i < ACPI_OEM_ID_SIZE) && (TableHeader.OemId[i]); i++)
{
if (!ACPI_IS_ASCII ((UINT8) TableHeader.OemId[i]))
{
goto BadCharacters;
}
}
for (i = 0; (i < ACPI_OEM_TABLE_ID_SIZE) && (TableHeader.OemTableId[i]); i++)
{
if (!ACPI_IS_ASCII ((UINT8) TableHeader.OemTableId[i]))
{
goto BadCharacters;
}
}
return (AE_OK);
BadCharacters:
ACPI_WARNING ((AE_INFO,
"Table header for [%4.4s] has invalid ASCII character(s)",
TableHeader.Signature));
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcCheckTextModeCorruption
*
* PARAMETERS: Table - Table buffer starting with table header
*
* RETURN: Status
*
* DESCRIPTION: Check table for text mode file corruption where all linefeed
* characters (LF) have been replaced by carriage return linefeed
* pairs (CR/LF).
*
******************************************************************************/
static ACPI_STATUS
AcCheckTextModeCorruption (
ACPI_TABLE_HEADER *Table)
{
UINT32 i;
UINT32 Pairs = 0;
UINT8 *Buffer = ACPI_CAST_PTR (UINT8, Table);
/* Scan entire table to determine if each LF has been prefixed with a CR */
for (i = 1; i < Table->Length; i++)
{
if (Buffer[i] == 0x0A)
{
if (Buffer[i - 1] != 0x0D)
{
/* The LF does not have a preceding CR, table not corrupted */
return (AE_OK);
}
else
{
/* Found a CR/LF pair */
Pairs++;
}
i++;
}
}
if (!Pairs)
{
return (AE_OK);
}
/*
* Entire table scanned, each CR is part of a CR/LF pair --
* meaning that the table was treated as a text file somewhere.
*
* NOTE: We can't "fix" the table, because any existing CR/LF pairs in the
* original table are left untouched by the text conversion process --
* meaning that we cannot simply replace CR/LF pairs with LFs.
*/
AcpiOsPrintf ("Table has been corrupted by text mode conversion\n");
AcpiOsPrintf ("All LFs (%u) were changed to CR/LF pairs\n", Pairs);
AcpiOsPrintf ("Table cannot be repaired!\n");
return (AE_BAD_VALUE);
}

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -262,6 +262,7 @@ AcpiOsGetLine (
ACPI_BACKUP_CURSOR (i, EndOfLine - CursorPosition + 1);
EndOfLine--;
if (CursorPosition > 0)
{
CursorPosition--;

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -99,7 +99,7 @@ AdGenerateFilename (
}
FilenameBuf[i] = 0;
strcat (FilenameBuf, ACPI_TABLE_FILE_SUFFIX);
strcat (FilenameBuf, FILE_SUFFIX_BINARY_TABLE);
return (FilenameBuf);
}

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -135,6 +135,7 @@ AcpiDmDumpTree (
Info.Count = 0;
Info.Level = 0;
Info.WalkState = NULL;
AcpiDmWalkParseTree (Origin, AcpiDmDumpDescending, NULL, &Info);
AcpiOsPrintf ("*/\n\n");
}
@ -168,6 +169,7 @@ AcpiDmFindOrphanMethods (
Info.Flags = 0;
Info.Level = 0;
Info.WalkState = NULL;
AcpiDmWalkParseTree (Origin, AcpiDmFindOrphanDescending, NULL, &Info);
}
@ -211,7 +213,8 @@ AcpiDmFinishNamespaceLoad (
return;
}
Status = AcpiDsScopeStackPush (NamespaceRoot, NamespaceRoot->Type, WalkState);
Status = AcpiDsScopeStackPush (NamespaceRoot, NamespaceRoot->Type,
WalkState);
if (ACPI_FAILURE (Status))
{
return;
@ -220,6 +223,7 @@ AcpiDmFinishNamespaceLoad (
Info.Flags = 0;
Info.Level = 0;
Info.WalkState = WalkState;
AcpiDmWalkParseTree (ParseTreeRoot, AcpiDmLoadDescendingOp,
AcpiDmCommonAscendingOp, &Info);
ACPI_FREE (WalkState);
@ -264,7 +268,8 @@ AcpiDmCrossReferenceNamespace (
return;
}
Status = AcpiDsScopeStackPush (NamespaceRoot, NamespaceRoot->Type, WalkState);
Status = AcpiDsScopeStackPush (NamespaceRoot, NamespaceRoot->Type,
WalkState);
if (ACPI_FAILURE (Status))
{
return;
@ -273,6 +278,7 @@ AcpiDmCrossReferenceNamespace (
Info.Flags = 0;
Info.Level = 0;
Info.WalkState = WalkState;
AcpiDmWalkParseTree (ParseTreeRoot, AcpiDmXrefDescendingOp,
AcpiDmCommonAscendingOp, &Info);
ACPI_FREE (WalkState);
@ -317,15 +323,18 @@ AcpiDmConvertResourceIndexes (
return;
}
Status = AcpiDsScopeStackPush (NamespaceRoot, NamespaceRoot->Type, WalkState);
Status = AcpiDsScopeStackPush (NamespaceRoot, NamespaceRoot->Type,
WalkState);
if (ACPI_FAILURE (Status))
{
ACPI_FREE (WalkState);
return;
}
Info.Flags = 0;
Info.Level = 0;
Info.WalkState = WalkState;
AcpiDmWalkParseTree (ParseTreeRoot, AcpiDmResourceDescendingOp,
AcpiDmCommonAscendingOp, &Info);
ACPI_FREE (WalkState);
@ -396,7 +405,7 @@ AcpiDmDumpDescending (
if (Op->Common.Value.String)
{
AcpiNsExternalizeName (ACPI_UINT32_MAX, Op->Common.Value.String,
NULL, &Path);
NULL, &Path);
AcpiOsPrintf ("%s %p", Path, Op->Common.Node);
ACPI_FREE (Path);
}
@ -434,7 +443,7 @@ AcpiDmDumpDescending (
*
* DESCRIPTION: Check namepath Ops for orphaned method invocations
*
* Note: Experimental.
* Note: Parts of this are experimental, under possible further development.
*
******************************************************************************/
@ -500,6 +509,7 @@ AcpiDmFindOrphanDescending (
ChildOp->Common.Value.String, ACPI_TYPE_METHOD, ArgCount, 0);
}
break;
#endif
case AML_STORE_OP:
@ -524,7 +534,7 @@ AcpiDmFindOrphanDescending (
/* One Arg means this is just a Store(Name,Target) */
AcpiDmAddOpToExternalList (ChildOp,
ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, 0, 0);
ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, ArgCount, 0);
return (AE_OK);
}
@ -546,7 +556,7 @@ AcpiDmFindOrphanDescending (
(ParentOp->Common.AmlOpcode != AML_INT_METHODCALL_OP) &&
!Op->Common.Node)
{
ArgCount = AcpiDmInspectPossibleArgs (0, 0, Op->Common.Next);
ArgCount = AcpiDmInspectPossibleArgs (0, 0, Op);
/*
* Check if namepath is a predicate for if/while or lone parameter to
@ -655,6 +665,7 @@ AcpiDmLoadDescendingOp (
{
NextOp = NextOp->Common.Next;
}
Path = NextOp->Common.Value.String;
}
@ -666,8 +677,8 @@ AcpiDmLoadDescendingOp (
/* Insert the name into the namespace */
Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
ACPI_IMODE_LOAD_PASS2, ACPI_NS_DONT_OPEN_SCOPE,
WalkState, &Node);
ACPI_IMODE_LOAD_PASS2, ACPI_NS_DONT_OPEN_SCOPE,
WalkState, &Node);
Op->Common.Node = Node;
@ -708,7 +719,8 @@ AcpiDmLoadDescendingOp (
{
if (Op->Common.Node)
{
Status = AcpiDsScopeStackPush (Op->Common.Node, ObjectType, WalkState);
Status = AcpiDsScopeStackPush (Op->Common.Node, ObjectType,
WalkState);
if (ACPI_FAILURE (Status))
{
return (Status);
@ -750,6 +762,7 @@ AcpiDmXrefDescendingOp (
ACPI_OPERAND_OBJECT *Object;
UINT32 ParamCount = 0;
char *Pathname;
UINT16 Flags = 0;
WalkState = Info->WalkState;
@ -764,7 +777,25 @@ AcpiDmXrefDescendingOp (
{
goto Exit;
}
else if (Op->Common.Parent &&
Op->Common.Parent->Common.AmlOpcode == AML_EXTERNAL_OP)
{
/* External() NamePath */
Path = Op->Common.Value.String;
ObjectType = (ACPI_OBJECT_TYPE) Op->Common.Next->Common.Value.Integer;
if (ObjectType == ACPI_TYPE_METHOD)
{
ParamCount = (UINT32)
Op->Common.Next->Common.Next->Common.Value.Integer;
}
Flags |= ACPI_EXT_RESOLVED_REFERENCE | ACPI_EXT_ORIGIN_FROM_OPCODE;
AcpiDmAddOpToExternalList (Op, Path,
(UINT8) ObjectType, ParamCount, Flags);
goto Exit;
}
/* Get the NamePath from the appropriate place */
@ -825,8 +856,9 @@ AcpiDmXrefDescendingOp (
*/
Node = NULL;
Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY,
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
WalkState, &Node);
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
WalkState, &Node);
if (ACPI_SUCCESS (Status) && (Node->Flags & ANOBJ_IS_EXTERNAL))
{
/* Node was created by an External() statement */
@ -851,12 +883,12 @@ AcpiDmXrefDescendingOp (
if (Node)
{
AcpiDmAddNodeToExternalList (Node,
(UINT8) ObjectType, 0, 0);
(UINT8) ObjectType, 7, Flags);
}
else
{
AcpiDmAddOpToExternalList (Op, Path,
(UINT8) ObjectType, 0, 0);
(UINT8) ObjectType, 7, Flags);
}
}
}
@ -908,7 +940,8 @@ AcpiDmXrefDescendingOp (
{
if (Op->Common.Node)
{
Status = AcpiDsScopeStackPush (Op->Common.Node, ObjectType, WalkState);
Status = AcpiDsScopeStackPush (Op->Common.Node, ObjectType,
WalkState);
if (ACPI_FAILURE (Status))
{
return (Status);
@ -956,7 +989,8 @@ AcpiDmResourceDescendingOp (
if (Op->Common.Node)
{
Status = AcpiDsScopeStackPush (Op->Common.Node, ObjectType, WalkState);
Status = AcpiDsScopeStackPush (Op->Common.Node, ObjectType,
WalkState);
if (ACPI_FAILURE (Status))
{
return (Status);
@ -1036,40 +1070,69 @@ AcpiDmInspectPossibleArgs (
{
const ACPI_OPCODE_INFO *OpInfo;
UINT32 i;
UINT32 Last = 0;
UINT32 Lookahead;
UINT32 ArgumentCount = 0;
ACPI_PARSE_OBJECT *NextOp;
ACPI_PARSE_OBJECT *ExecuteOp;
Lookahead = (ACPI_METHOD_NUM_ARGS + TargetCount) - CurrentOpArgCount;
if (!Op)
{
return (0);
}
/* Lookahead for the maximum number of possible arguments */
for (i = 0; i < Lookahead; i++)
NextOp = Op->Common.Next;
for (i = 0; (i < ACPI_METHOD_NUM_ARGS) && NextOp; i++)
{
if (!Op)
OpInfo = AcpiPsGetOpcodeInfo (NextOp->Common.AmlOpcode);
/* Any one of these operators is "very probably" not a method arg */
if ((NextOp->Common.AmlOpcode == AML_STORE_OP) ||
(NextOp->Common.AmlOpcode == AML_NOTIFY_OP) ||
(OpInfo->Class == AML_CLASS_CONTROL) ||
(OpInfo->Class == AML_CLASS_CREATE) ||
(OpInfo->Class == AML_CLASS_NAMED_OBJECT))
{
break;
}
OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
/*
* Any one of these operators is "very probably" not a method arg
*/
if ((Op->Common.AmlOpcode == AML_STORE_OP) ||
(Op->Common.AmlOpcode == AML_NOTIFY_OP))
if (OpInfo->Class == AML_CLASS_EXECUTE)
{
break;
/* Probable that this is method arg if there is no target */
ExecuteOp = NextOp->Common.Value.Arg;
while (ExecuteOp)
{
if ((ExecuteOp->Common.AmlOpcode == AML_INT_NAMEPATH_OP) &&
(ExecuteOp->Common.Value.Arg == NULL))
{
/* No target, could be a method arg */
break;
}
if (NextOp->Common.AmlOpcode == AML_REF_OF_OP)
{
break;
}
ExecuteOp = ExecuteOp->Common.Next;
}
if (!ExecuteOp)
{
/* Has a target, not method arg */
return (ArgumentCount);
}
}
if ((OpInfo->Class != AML_CLASS_EXECUTE) &&
(OpInfo->Class != AML_CLASS_CONTROL))
{
Last = i+1;
}
Op = Op->Common.Next;
ArgumentCount++;
NextOp = NextOp->Common.Next;
}
return (Last);
return (ArgumentCount);
}

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -75,6 +75,10 @@ const AH_DEVICE_ID AslDeviceIds[] =
{"ACPI000D", "Power Meter Device"},
{"ACPI000E", "Time and Alarm Device"},
{"ACPI000F", "User Presence Detection Device"},
{"ACPI0010", "Processor Container Device"},
{"ACPI0011", "Generic Buttons Device"},
{"ACPI0012", "NVDIMM Root Device"},
{"ACPI0013", "Generic Event Device"},
{"ADMA0F28", "Intel Audio DMA"},
{"AMCR0F28", "Intel Audio Machine Driver"},
{"ATK4001", "Asus Radio Control Button"},
@ -185,6 +189,7 @@ const AH_DEVICE_ID AslDeviceIds[] =
{"PNP0C12", "Device Bay Controller"},
{"PNP0C14", "Windows Management Instrumentation Device"},
{"PNP0C15", "Docking Station"},
{"PNP0C33", "Error Device"},
{"PNP0C40", "Standard Button Controller"},
{"PNP0C50", "HID Protocol Device (I2C bus)"},
{"PNP0C60", "Display Sensor Device"},

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -140,6 +140,7 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] =
AH_PREDEF ("_FDI", "Floppy Drive Information", "Returns a floppy drive information block"),
AH_PREDEF ("_FDM", "Floppy Drive Mode", "Sets a floppy drive speed"),
AH_PREDEF ("_FIF", "Fan Information", "Returns fan device information"),
AH_PREDEF ("_FIT", "Firmware Interface Table", "Returns a list of NFIT structures"),
AH_PREDEF ("_FIX", "Fixed Register Resource Provider", "Returns a list of devices that implement FADT register blocks"),
AH_PREDEF ("_FLC", "Flow Control", "Flow control, Resource Descriptor field"),
AH_PREDEF ("_FPS", "Fan Performance States", "Returns a list of supported fan performance states"),
@ -332,8 +333,10 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] =
AH_PREDEF ("_UPP", "User Presence Polling", "Returns the recommended user presence polling interval"),
AH_PREDEF ("_VEN", "Vendor Data", "Resource Descriptor field"),
AH_PREDEF ("_VPO", "Video Post Options", "Returns the implemented video post options"),
AH_PREDEF ("_WAK", "Wake", "Inform AML that the system has just awakened"),
AH_PREDEF ("_Wxx", "Wake Event", "Method executed as a result of a wake event"),
AH_PREDEF ("_WAK", "Wake", "Inform AML that the system has just awakened"),
AH_PREDEF ("_WPC", "Wireless Power Calibration", "Calibrate power and notify wireless device"),
AH_PREDEF ("_WPP", "Wireless Power Polling", "Get recommended polling interval"),
AH_PREDEF (NULL, NULL, NULL)
};

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -48,6 +48,7 @@
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME ("ahuuids")
/*
* Table of "known" (ACPI-related) UUIDs
*/

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -140,7 +140,6 @@ AcpiDmGetObjectTypeName (
{
Type = ACPI_TYPE_DEVICE;
}
else if (Type > ACPI_TYPE_LOCAL_INDEX_FIELD)
{
return ("");
@ -410,6 +409,7 @@ AcpiDmGetExternalsFromFile (
{
continue;
}
if (strcmp (Token, "External"))
{
continue;
@ -447,6 +447,7 @@ AcpiDmGetExternalsFromFile (
fprintf (stderr, "Invalid argument count (%s)\n", Token);
continue;
}
if (ArgCount > 7)
{
fprintf (stderr, "Invalid argument count (%u)\n", ArgCount);
@ -465,7 +466,8 @@ AcpiDmGetExternalsFromFile (
if (!ImportCount)
{
fprintf (stderr, "Did not find any external methods in reference file \"%s\"\n",
fprintf (stderr,
"Did not find any external methods in reference file \"%s\"\n",
Gbl_ExternalRefFilename);
}
else
@ -806,27 +808,39 @@ AcpiDmCreateNewExternal (
NextExternal = AcpiGbl_ExternalList;
while (NextExternal)
{
/* Check for duplicates */
if (!strcmp (ExternalPath, NextExternal->Path))
{
/* Duplicate method, check that the Value (ArgCount) is the same */
if ((NextExternal->Type == ACPI_TYPE_METHOD) &&
(NextExternal->Value != Value) &&
(Value > 0))
/*
* If this external came from an External() opcode, we are
* finished with this one. (No need to check any further).
*/
if (NextExternal->Flags & ACPI_EXT_ORIGIN_FROM_OPCODE)
{
ACPI_ERROR ((AE_INFO,
"External method arg count mismatch %s: Current %u, attempted %u",
NextExternal->Path, NextExternal->Value, Value));
return_ACPI_STATUS (AE_ALREADY_EXISTS);
}
/* Allow upgrade of type from ANY */
else if (NextExternal->Type == ACPI_TYPE_ANY)
else if ((NextExternal->Type == ACPI_TYPE_ANY) &&
(Type != ACPI_TYPE_ANY))
{
NextExternal->Type = Type;
}
/* Update the argument count as necessary */
if (Value < NextExternal->Value)
{
NextExternal->Value = Value;
}
/* Update flags. */
NextExternal->Flags |= Flags;
NextExternal->Flags &= ~ACPI_EXT_INTERNAL_PATH_ALLOCATED;
return_ACPI_STATUS (AE_ALREADY_EXISTS);
}
@ -917,9 +931,9 @@ AcpiDmAddExternalsToNamespace (
/* Add the external name (object) into the namespace */
Status = AcpiNsLookup (NULL, External->InternalPath, External->Type,
ACPI_IMODE_LOAD_PASS1,
ACPI_NS_ERROR_IF_FOUND | ACPI_NS_EXTERNAL | ACPI_NS_DONT_OPEN_SCOPE,
NULL, &Node);
ACPI_IMODE_LOAD_PASS1,
ACPI_NS_ERROR_IF_FOUND | ACPI_NS_EXTERNAL | ACPI_NS_DONT_OPEN_SCOPE,
NULL, &Node);
if (ACPI_FAILURE (Status))
{
@ -1074,90 +1088,62 @@ AcpiDmEmitExternals (
AcpiDmUnresolvedWarning (1);
/* Emit any unresolved method externals in a single text block */
NextExternal = AcpiGbl_ExternalList;
while (NextExternal)
{
if ((NextExternal->Type == ACPI_TYPE_METHOD) &&
(!(NextExternal->Flags & ACPI_EXT_RESOLVED_REFERENCE)))
{
AcpiOsPrintf (" External (%s%s",
NextExternal->Path,
AcpiDmGetObjectTypeName (NextExternal->Type));
AcpiOsPrintf (") // Warning: Unresolved method, "
"guessing %u arguments\n",
NextExternal->Value);
NextExternal->Flags |= ACPI_EXT_EXTERNAL_EMITTED;
}
NextExternal = NextExternal->Next;
}
AcpiOsPrintf ("\n");
/* Emit externals that were imported from a file */
if (Gbl_ExternalRefFilename)
{
AcpiOsPrintf (
" /*\n * External declarations that were imported from\n"
" * the reference file [%s]\n */\n",
" /*\n * External declarations were imported from\n"
" * a reference file -- %s\n */\n\n",
Gbl_ExternalRefFilename);
NextExternal = AcpiGbl_ExternalList;
while (NextExternal)
{
if (!(NextExternal->Flags & ACPI_EXT_EXTERNAL_EMITTED) &&
(NextExternal->Flags & ACPI_EXT_ORIGIN_FROM_FILE))
{
AcpiOsPrintf (" External (%s%s",
NextExternal->Path,
AcpiDmGetObjectTypeName (NextExternal->Type));
if (NextExternal->Type == ACPI_TYPE_METHOD)
{
AcpiOsPrintf (") // %u Arguments\n",
NextExternal->Value);
}
else
{
AcpiOsPrintf (")\n");
}
NextExternal->Flags |= ACPI_EXT_EXTERNAL_EMITTED;
}
NextExternal = NextExternal->Next;
}
AcpiOsPrintf ("\n");
}
/*
* Walk the list of externals found during the AML parsing
* Walk and emit the list of externals found during the AML parsing
*/
while (AcpiGbl_ExternalList)
{
if (!(AcpiGbl_ExternalList->Flags & ACPI_EXT_EXTERNAL_EMITTED))
{
AcpiOsPrintf (" External (%s%s",
AcpiOsPrintf (" External (%s%s)",
AcpiGbl_ExternalList->Path,
AcpiDmGetObjectTypeName (AcpiGbl_ExternalList->Type));
/* For methods, add a comment with the number of arguments */
/* Check for "unresolved" method reference */
if (AcpiGbl_ExternalList->Type == ACPI_TYPE_METHOD)
if ((AcpiGbl_ExternalList->Type == ACPI_TYPE_METHOD) &&
(!(AcpiGbl_ExternalList->Flags & ACPI_EXT_RESOLVED_REFERENCE)))
{
AcpiOsPrintf (") // %u Arguments\n",
AcpiOsPrintf (" // Warning: Unknown method, "
"guessing %u arguments",
AcpiGbl_ExternalList->Value);
}
/* Check for external from a external references file */
else if (AcpiGbl_ExternalList->Flags & ACPI_EXT_ORIGIN_FROM_FILE)
{
if (AcpiGbl_ExternalList->Type == ACPI_TYPE_METHOD)
{
AcpiOsPrintf (" // %u Arguments",
AcpiGbl_ExternalList->Value);
}
AcpiOsPrintf (" // From external reference file");
}
/* This is the normal external case */
else
{
AcpiOsPrintf (")\n");
/* For methods, add a comment with the number of arguments */
if (AcpiGbl_ExternalList->Type == ACPI_TYPE_METHOD)
{
AcpiOsPrintf (" // %u Arguments",
AcpiGbl_ExternalList->Value);
}
}
AcpiOsPrintf ("\n");
}
/* Free this external info block and move on to next external */
@ -1263,76 +1249,87 @@ appearing in an SSDT, the disassembler does not know what to do unless
the owning SSDT has been loaded via the -e option.
#endif
static char ExternalWarningPart1[600];
static char ExternalWarningPart2[400];
static char ExternalWarningPart3[400];
static char ExternalWarningPart4[200];
void
AcpiDmUnresolvedWarning (
UINT8 Type)
{
char *Format;
char Pad[] = " *";
char NoPad[] = "";
if (!AcpiGbl_NumExternalMethods)
{
return;
}
if (AcpiGbl_NumExternalMethods == AcpiGbl_ResolvedExternalMethods)
{
return;
}
Format = Type ? Pad : NoPad;
sprintf (ExternalWarningPart1,
"%s iASL Warning: There %s %u external control method%s found during\n"
"%s disassembly, but only %u %s resolved (%u unresolved). Additional\n"
"%s ACPI tables may be required to properly disassemble the code. This\n"
"%s resulting disassembler output file may not compile because the\n"
"%s disassembler did not know how many arguments to assign to the\n"
"%s unresolved methods. Note: SSDTs can be dynamically loaded at\n"
"%s runtime and may or may not be available via the host OS.\n",
Format, (AcpiGbl_NumExternalMethods != 1 ? "were" : "was"),
AcpiGbl_NumExternalMethods, (AcpiGbl_NumExternalMethods != 1 ? "s" : ""),
Format, AcpiGbl_ResolvedExternalMethods,
(AcpiGbl_ResolvedExternalMethods != 1 ? "were" : "was"),
(AcpiGbl_NumExternalMethods - AcpiGbl_ResolvedExternalMethods),
Format, Format, Format, Format, Format);
sprintf (ExternalWarningPart2,
"%s To specify the tables needed to resolve external control method\n"
"%s references, the -e option can be used to specify the filenames.\n"
"%s Example iASL invocations:\n"
"%s iasl -e ssdt1.aml ssdt2.aml ssdt3.aml -d dsdt.aml\n"
"%s iasl -e dsdt.aml ssdt2.aml -d ssdt1.aml\n"
"%s iasl -e ssdt*.aml -d dsdt.aml\n",
Format, Format, Format, Format, Format, Format);
sprintf (ExternalWarningPart3,
"%s In addition, the -fe option can be used to specify a file containing\n"
"%s control method external declarations with the associated method\n"
"%s argument counts. Each line of the file must be of the form:\n"
"%s External (<method pathname>, MethodObj, <argument count>)\n"
"%s Invocation:\n"
"%s iasl -fe refs.txt -d dsdt.aml\n",
Format, Format, Format, Format, Format, Format);
sprintf (ExternalWarningPart4,
"%s The following methods were unresolved and many not compile properly\n"
"%s because the disassembler had to guess at the number of arguments\n"
"%s required for each:\n",
Format, Format, Format);
if (Type)
{
if (!AcpiGbl_ExternalFileList)
{
/* The -e option was not specified */
AcpiOsPrintf (" /*\n"
" * iASL Warning: There were %u external control methods found during\n"
" * disassembly, but additional ACPI tables to resolve these externals\n"
" * were not specified. This resulting disassembler output file may not\n"
" * compile because the disassembler did not know how many arguments\n"
" * to assign to these methods. To specify the tables needed to resolve\n"
" * external control method references, the -e option can be used to\n"
" * specify the filenames. Note: SSDTs can be dynamically loaded at\n"
" * runtime and may or may not be available via the host OS.\n"
" * Example iASL invocations:\n"
" * iasl -e ssdt1.aml ssdt2.aml ssdt3.aml -d dsdt.aml\n"
" * iasl -e dsdt.aml ssdt2.aml -d ssdt1.aml\n"
" * iasl -e ssdt*.aml -d dsdt.aml\n"
" *\n"
" * In addition, the -fe option can be used to specify a file containing\n"
" * control method external declarations with the associated method\n"
" * argument counts. Each line of the file must be of the form:\n"
" * External (<method pathname>, MethodObj, <argument count>)\n"
" * Invocation:\n"
" * iasl -fe refs.txt -d dsdt.aml\n"
" *\n"
" * The following methods were unresolved and many not compile properly\n"
" * because the disassembler had to guess at the number of arguments\n"
" * required for each:\n"
" */\n",
AcpiGbl_NumExternalMethods);
AcpiOsPrintf (" /*\n%s *\n%s *\n%s *\n%s */\n",
ExternalWarningPart1, ExternalWarningPart2, ExternalWarningPart3,
ExternalWarningPart4);
}
else if (AcpiGbl_NumExternalMethods != AcpiGbl_ResolvedExternalMethods)
else
{
/* The -e option was specified, but there are still some unresolved externals */
AcpiOsPrintf (" /*\n"
" * iASL Warning: There were %u external control methods found during\n"
" * disassembly, but only %u %s resolved (%u unresolved). Additional\n"
" * ACPI tables may be required to properly disassemble the code. This\n"
" * resulting disassembler output file may not compile because the\n"
" * disassembler did not know how many arguments to assign to the\n"
" * unresolved methods. Note: SSDTs can be dynamically loaded at\n"
" * runtime and may or may not be available via the host OS.\n"
" *\n"
" * If necessary, the -fe option can be used to specify a file containing\n"
" * control method external declarations with the associated method\n"
" * argument counts. Each line of the file must be of the form:\n"
" * External (<method pathname>, MethodObj, <argument count>)\n"
" * Invocation:\n"
" * iasl -fe refs.txt -d dsdt.aml\n"
" *\n"
" * The following methods were unresolved and many not compile properly\n"
" * because the disassembler had to guess at the number of arguments\n"
" * required for each:\n"
" */\n",
AcpiGbl_NumExternalMethods, AcpiGbl_ResolvedExternalMethods,
(AcpiGbl_ResolvedExternalMethods > 1 ? "were" : "was"),
(AcpiGbl_NumExternalMethods - AcpiGbl_ResolvedExternalMethods));
AcpiOsPrintf (" /*\n%s *\n%s *\n%s */\n",
ExternalWarningPart1, ExternalWarningPart3, ExternalWarningPart4);
}
}
else
@ -1341,50 +1338,15 @@ AcpiDmUnresolvedWarning (
{
/* The -e option was not specified */
fprintf (stderr, "\n"
"iASL Warning: There were %u external control methods found during\n"
"disassembly, but additional ACPI tables to resolve these externals\n"
"were not specified. The resulting disassembler output file may not\n"
"compile because the disassembler did not know how many arguments\n"
"to assign to these methods. To specify the tables needed to resolve\n"
"external control method references, the -e option can be used to\n"
"specify the filenames. Note: SSDTs can be dynamically loaded at\n"
"runtime and may or may not be available via the host OS.\n"
"Example iASL invocations:\n"
" iasl -e ssdt1.aml ssdt2.aml ssdt3.aml -d dsdt.aml\n"
" iasl -e dsdt.aml ssdt2.aml -d ssdt1.aml\n"
" iasl -e ssdt*.aml -d dsdt.aml\n"
"\n"
"In addition, the -fe option can be used to specify a file containing\n"
"control method external declarations with the associated method\n"
"argument counts. Each line of the file must be of the form:\n"
" External (<method pathname>, MethodObj, <argument count>)\n"
"Invocation:\n"
" iasl -fe refs.txt -d dsdt.aml\n",
AcpiGbl_NumExternalMethods);
fprintf (stderr, "\n%s\n%s\n%s\n",
ExternalWarningPart1, ExternalWarningPart2, ExternalWarningPart3);
}
else if (AcpiGbl_NumExternalMethods != AcpiGbl_ResolvedExternalMethods)
else
{
/* The -e option was specified, but there are still some unresolved externals */
fprintf (stderr, "\n"
"iASL Warning: There were %u external control methods found during\n"
"disassembly, but only %u %s resolved (%u unresolved). Additional\n"
"ACPI tables may be required to properly disassemble the code. The\n"
"resulting disassembler output file may not compile because the\n"
"disassembler did not know how many arguments to assign to the\n"
"unresolved methods. Note: SSDTs can be dynamically loaded at\n"
"runtime and may or may not be available via the host OS.\n"
"\n"
"If necessary, the -fe option can be used to specify a file containing\n"
"control method external declarations with the associated method\n"
"argument counts. Each line of the file must be of the form:\n"
" External (<method pathname>, MethodObj, <argument count>)\n"
"Invocation:\n"
" iasl -fe refs.txt -d dsdt.aml\n",
AcpiGbl_NumExternalMethods, AcpiGbl_ResolvedExternalMethods,
(AcpiGbl_ResolvedExternalMethods > 1 ? "were" : "was"),
(AcpiGbl_NumExternalMethods - AcpiGbl_ResolvedExternalMethods));
fprintf (stderr, "\n%s\n%s\n",
ExternalWarningPart1, ExternalWarningPart3);
}
}
}

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -279,6 +279,7 @@ static const ACPI_RESOURCE_TAG AcpiDmGpioIoTags[] =
static const ACPI_RESOURCE_TAG AcpiDmI2cSerialBusTags[] =
{
{( 6 * 8) + 0, ACPI_RESTAG_SLAVEMODE},
{( 6 * 8) + 2, ACPI_RESTAG_INTERRUPTSHARE}, /* V2 - ACPI 6.0 */
{( 7 * 8) + 0, ACPI_RESTAG_MODE},
{(12 * 8), ACPI_RESTAG_SPEED},
{(16 * 8), ACPI_RESTAG_ADDRESS},
@ -288,6 +289,7 @@ static const ACPI_RESOURCE_TAG AcpiDmI2cSerialBusTags[] =
static const ACPI_RESOURCE_TAG AcpiDmSpiSerialBusTags[] =
{
{( 6 * 8) + 0, ACPI_RESTAG_SLAVEMODE},
{( 6 * 8) + 2, ACPI_RESTAG_INTERRUPTSHARE}, /* V2 - ACPI 6.0 */
{( 7 * 8) + 0, ACPI_RESTAG_MODE},
{( 7 * 8) + 1, ACPI_RESTAG_DEVICEPOLARITY},
{(12 * 8), ACPI_RESTAG_SPEED},
@ -300,7 +302,8 @@ static const ACPI_RESOURCE_TAG AcpiDmSpiSerialBusTags[] =
static const ACPI_RESOURCE_TAG AcpiDmUartSerialBusTags[] =
{
{( 6 * 8) + 0, ACPI_RESTAG_SLAVEMODE}, /* Note: not part of original macro */
{( 6 * 8) + 0, ACPI_RESTAG_SLAVEMODE}, /* Note: not part of original macro */
{( 6 * 8) + 2, ACPI_RESTAG_INTERRUPTSHARE}, /* V2 - ACPI 6.0 */
{( 7 * 8) + 0, ACPI_RESTAG_FLOWCONTROL},
{( 7 * 8) + 2, ACPI_RESTAG_STOPBITS},
{( 7 * 8) + 4, ACPI_RESTAG_LENGTH},
@ -498,9 +501,9 @@ AcpiDmCheckResourceReference (
/* Lookup the buffer in the namespace */
Status = AcpiNsLookup (WalkState->ScopeInfo,
BufferNameOp->Common.Value.String, ACPI_TYPE_BUFFER,
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState,
&BufferNode);
BufferNameOp->Common.Value.String, ACPI_TYPE_BUFFER,
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState,
&BufferNode);
if (ACPI_FAILURE (Status))
{
return;
@ -621,8 +624,8 @@ AcpiGetTagPathname (
/* Get the individual resource descriptor and validate it */
Aml = ACPI_CAST_PTR (AML_RESOURCE,
&Op->Named.Data[ResourceNode->Value]);
Aml = ACPI_CAST_PTR (
AML_RESOURCE, &Op->Named.Data[ResourceNode->Value]);
Status = AcpiUtValidateResource (NULL, Aml, &ResourceTableIndex);
if (ACPI_FAILURE (Status))
@ -663,7 +666,7 @@ AcpiGetTagPathname (
}
(void) AcpiNsBuildNormalizedPath (BufferNode, Pathname,
RequiredSize, FALSE);
RequiredSize, FALSE);
/*
* Create the full path to the resource and tag by: remove the buffer name,
@ -742,6 +745,7 @@ AcpiDmUpdateResourceName (
{
AcpiGbl_NextResourceId = 0;
AcpiGbl_NextPrefix++;
if (AcpiGbl_NextPrefix > ACPI_NUM_RES_PREFIX)
{
AcpiGbl_NextPrefix = 0;
@ -1028,9 +1032,9 @@ AcpiDmAddResourceToNamespace (
ScopeInfo.Scope.Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Context);
Status = AcpiNsLookup (&ScopeInfo, "_TMP", ACPI_TYPE_LOCAL_RESOURCE,
ACPI_IMODE_LOAD_PASS2,
ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_PREFIX_IS_SCOPE,
NULL, &Node);
ACPI_IMODE_LOAD_PASS2,
ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_PREFIX_IS_SCOPE,
NULL, &Node);
if (ACPI_FAILURE (Status))
{
return (AE_OK);

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -58,15 +58,6 @@ AcpiAhGetTableInfo (
char *Signature);
/* Local Prototypes */
static void
AcpiDmCheckAscii (
UINT8 *Target,
char *RepairedName,
UINT32 Count);
/* Common format strings for commented values */
#define UINT8_FORMAT "%2.2X [%s]\n"
@ -118,6 +109,7 @@ static const char *AcpiDmEinjActions[] =
"Check Busy Status",
"Get Command Status",
"Set Error Type With Address",
"Get Execute Timings",
"Unknown Action"
};
@ -150,6 +142,7 @@ static const char *AcpiDmErstActions[] =
"Get Error Address Range",
"Get Error Address Length",
"Get Error Attributes",
"Execute Timings",
"Unknown Action"
};
@ -196,6 +189,7 @@ static const char *AcpiDmHestSubnames[] =
"PCI Express AER (AER Endpoint)",
"PCI Express/PCI-X Bridge AER",
"Generic Hardware Error Source",
"Generic Hardware Error Source V2",
"Unknown Subtable Type" /* Reserved */
};
@ -208,6 +202,10 @@ static const char *AcpiDmHestNotifySubnames[] =
"NMI",
"CMCI", /* ACPI 5.0 */
"MCE", /* ACPI 5.0 */
"GPIO", /* ACPI 6.0 */
"SEA", /* ACPI 6.1 */
"SEI", /* ACPI 6.1 */
"GSIV", /* ACPI 6.1 */
"Unknown Notify Type" /* Reserved */
};
@ -248,6 +246,7 @@ static const char *AcpiDmPcctSubnames[] =
{
"Generic Communications Subspace", /* ACPI_PCCT_TYPE_GENERIC_SUBSPACE */
"HW-Reduced Comm Subspace", /* ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE */
"HW-Reduced Comm Subspace Type2", /* ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2 */
"Unknown Subtable Type" /* Reserved */
};
@ -875,6 +874,7 @@ AcpiDmDumpTable (
AcpiOsPrintf ("\n");
LastOutputBlankLine = TRUE;
}
ByteLength = sizeof (ACPI_GENERIC_ADDRESS);
break;
@ -885,6 +885,7 @@ AcpiDmDumpTable (
AcpiOsPrintf ("\n");
LastOutputBlankLine = TRUE;
}
ByteLength = sizeof (ACPI_HEST_NOTIFY);
break;
@ -894,6 +895,7 @@ AcpiDmDumpTable (
{
LastOutputBlankLine = FALSE;
}
ByteLength = sizeof (ACPI_IORT_MEMORY_ACCESS);
break;
@ -1027,6 +1029,7 @@ AcpiDmDumpTable (
}
}
}
AcpiOsPrintf ("\n");
break;
@ -1048,8 +1051,9 @@ AcpiDmDumpTable (
case ACPI_DMT_SIG:
AcpiDmCheckAscii (Target, RepairedName, 4);
AcpiUtCheckAndRepairAscii (Target, RepairedName, 4);
AcpiOsPrintf ("\"%.4s\" ", RepairedName);
TableData = AcpiAhGetTableInfo (ACPI_CAST_PTR (char, Target));
if (TableData)
{
@ -1063,19 +1067,19 @@ AcpiDmDumpTable (
case ACPI_DMT_NAME4:
AcpiDmCheckAscii (Target, RepairedName, 4);
AcpiUtCheckAndRepairAscii (Target, RepairedName, 4);
AcpiOsPrintf ("\"%.4s\"\n", RepairedName);
break;
case ACPI_DMT_NAME6:
AcpiDmCheckAscii (Target, RepairedName, 6);
AcpiUtCheckAndRepairAscii (Target, RepairedName, 6);
AcpiOsPrintf ("\"%.6s\"\n", RepairedName);
break;
case ACPI_DMT_NAME8:
AcpiDmCheckAscii (Target, RepairedName, 8);
AcpiUtCheckAndRepairAscii (Target, RepairedName, 8);
AcpiOsPrintf ("\"%.8s\"\n", RepairedName);
break;
@ -1095,6 +1099,7 @@ AcpiDmDumpTable (
AcpiOsPrintf (
" /* Incorrect checksum, should be %2.2X */", Temp8);
}
AcpiOsPrintf ("\n");
break;
@ -1477,42 +1482,3 @@ AcpiDmDumpTable (
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiDmCheckAscii
*
* PARAMETERS: Name - Ascii string
* Count - Number of characters to check
*
* RETURN: None
*
* DESCRIPTION: Ensure that the requested number of characters are printable
* Ascii characters. Sets non-printable and null chars to <space>.
*
******************************************************************************/
static void
AcpiDmCheckAscii (
UINT8 *Name,
char *RepairedName,
UINT32 Count)
{
UINT32 i;
for (i = 0; i < Count; i++)
{
RepairedName[i] = (char) Name[i];
if (!Name[i])
{
return;
}
if (!isprint (Name[i]))
{
RepairedName[i] = ' ';
}
}
}

View File

@ -0,0 +1,485 @@
/******************************************************************************
*
* Module Name: dmtables - disassembler ACPI table support
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2016, 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 <contrib/dev/acpica/compiler/aslcompiler.h>
#include <contrib/dev/acpica/include/acapps.h>
#include <contrib/dev/acpica/include/acdispat.h>
#include <contrib/dev/acpica/include/acnamesp.h>
#include <contrib/dev/acpica/include/actables.h>
#include <contrib/dev/acpica/include/acparser.h>
#include <stdio.h>
#include <time.h>
#define _COMPONENT ACPI_TOOLS
ACPI_MODULE_NAME ("dmtables")
/* Local prototypes */
static void
AdCreateTableHeader (
char *Filename,
ACPI_TABLE_HEADER *Table);
static ACPI_STATUS
AdStoreTable (
ACPI_TABLE_HEADER *Table,
UINT32 *TableIndex);
extern ACPI_TABLE_DESC LocalTables[1];
extern ACPI_PARSE_OBJECT *AcpiGbl_ParseOpRoot;
/******************************************************************************
*
* FUNCTION: AdDisassemblerHeader
*
* PARAMETERS: Filename - Input file for the table
* TableType - Either AML or DataTable
*
* RETURN: None
*
* DESCRIPTION: Create the disassembler header, including ACPICA signon with
* current time and date.
*
*****************************************************************************/
void
AdDisassemblerHeader (
char *Filename,
UINT8 TableType)
{
time_t Timer;
time (&Timer);
/* Header and input table info */
AcpiOsPrintf ("/*\n");
AcpiOsPrintf (ACPI_COMMON_HEADER (AML_DISASSEMBLER_NAME, " * "));
if (TableType == ACPI_IS_AML_TABLE)
{
if (AcpiGbl_CstyleDisassembly)
{
AcpiOsPrintf (
" * Disassembling to symbolic ASL+ operators\n"
" *\n");
}
else
{
AcpiOsPrintf (
" * Disassembling to non-symbolic legacy ASL operators\n"
" *\n");
}
}
AcpiOsPrintf (" * Disassembly of %s, %s", Filename, ctime (&Timer));
AcpiOsPrintf (" *\n");
}
/******************************************************************************
*
* FUNCTION: AdCreateTableHeader
*
* PARAMETERS: Filename - Input file for the table
* Table - Pointer to the raw table
*
* RETURN: None
*
* DESCRIPTION: Create the ASL table header, including ACPICA signon with
* current time and date.
*
*****************************************************************************/
static void
AdCreateTableHeader (
char *Filename,
ACPI_TABLE_HEADER *Table)
{
UINT8 Checksum;
/* Reset globals for External statements */
AcpiGbl_NumExternalMethods = 0;
AcpiGbl_ResolvedExternalMethods = 0;
/*
* Print file header and dump original table header
*/
AdDisassemblerHeader (Filename, ACPI_IS_AML_TABLE);
AcpiOsPrintf (" * Original Table Header:\n");
AcpiOsPrintf (" * Signature \"%4.4s\"\n", Table->Signature);
AcpiOsPrintf (" * Length 0x%8.8X (%u)\n", Table->Length, Table->Length);
/* Print and validate the revision */
AcpiOsPrintf (" * Revision 0x%2.2X", Table->Revision);
switch (Table->Revision)
{
case 0:
AcpiOsPrintf (" **** Invalid Revision");
break;
case 1:
/* Revision of DSDT controls the ACPI integer width */
if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_DSDT))
{
AcpiOsPrintf (" **** 32-bit table (V1), no 64-bit math support");
}
break;
default:
break;
}
/* Print and validate the table checksum */
AcpiOsPrintf ("\n * Checksum 0x%2.2X", Table->Checksum);
Checksum = AcpiTbChecksum (ACPI_CAST_PTR (UINT8, Table), Table->Length);
if (Checksum)
{
AcpiOsPrintf (" **** Incorrect checksum, should be 0x%2.2X",
(UINT8) (Table->Checksum - Checksum));
}
AcpiOsPrintf ("\n");
AcpiOsPrintf (" * OEM ID \"%.6s\"\n", Table->OemId);
AcpiOsPrintf (" * OEM Table ID \"%.8s\"\n", Table->OemTableId);
AcpiOsPrintf (" * OEM Revision 0x%8.8X (%u)\n", Table->OemRevision, Table->OemRevision);
AcpiOsPrintf (" * Compiler ID \"%.4s\"\n", Table->AslCompilerId);
AcpiOsPrintf (" * Compiler Version 0x%8.8X (%u)\n", Table->AslCompilerRevision, Table->AslCompilerRevision);
AcpiOsPrintf (" */\n");
/*
* Open the ASL definition block.
*
* Note: the AMLFilename string is left zero-length in order to just let
* the compiler create it when the disassembled file is compiled. This
* makes it easier to rename the disassembled ASL file if needed.
*/
AcpiOsPrintf (
"DefinitionBlock (\"\", \"%4.4s\", %hu, \"%.6s\", \"%.8s\", 0x%8.8X)\n",
Table->Signature, Table->Revision,
Table->OemId, Table->OemTableId, Table->OemRevision);
}
/******************************************************************************
*
* FUNCTION: AdDisplayTables
*
* PARAMETERS: Filename - Input file for the table
* Table - Pointer to the raw table
*
* RETURN: Status
*
* DESCRIPTION: Display (disassemble) loaded tables and dump raw tables
*
*****************************************************************************/
ACPI_STATUS
AdDisplayTables (
char *Filename,
ACPI_TABLE_HEADER *Table)
{
if (!AcpiGbl_ParseOpRoot)
{
return (AE_NOT_EXIST);
}
if (!AcpiGbl_DmOpt_Listing)
{
AdCreateTableHeader (Filename, Table);
}
AcpiDmDisassemble (NULL, AcpiGbl_ParseOpRoot, ACPI_UINT32_MAX);
MpEmitMappingInfo ();
if (AcpiGbl_DmOpt_Listing)
{
AcpiOsPrintf ("\n\nTable Header:\n");
AcpiUtDebugDumpBuffer ((UINT8 *) Table, sizeof (ACPI_TABLE_HEADER),
DB_BYTE_DISPLAY, ACPI_UINT32_MAX);
AcpiOsPrintf ("Table Body (Length 0x%X)\n", Table->Length);
AcpiUtDebugDumpBuffer (((UINT8 *) Table + sizeof (ACPI_TABLE_HEADER)),
Table->Length, DB_BYTE_DISPLAY, ACPI_UINT32_MAX);
}
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AdStoreTable
*
* PARAMETERS: Table - Table header
* TableIndex - Where the table index is returned
*
* RETURN: Status and table index.
*
* DESCRIPTION: Add an ACPI table to the global table list
*
******************************************************************************/
static ACPI_STATUS
AdStoreTable (
ACPI_TABLE_HEADER *Table,
UINT32 *TableIndex)
{
ACPI_STATUS Status;
ACPI_TABLE_DESC *TableDesc;
Status = AcpiTbGetNextTableDescriptor (TableIndex, &TableDesc);
if (ACPI_FAILURE (Status))
{
return (Status);
}
/* Initialize added table */
AcpiTbInitTableDescriptor (TableDesc, ACPI_PTR_TO_PHYSADDR (Table),
ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL, Table);
Status = AcpiTbValidateTable (TableDesc);
return (Status);
}
/******************************************************************************
*
* FUNCTION: AdGetLocalTables
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Get the ACPI tables from either memory or a file
*
*****************************************************************************/
ACPI_STATUS
AdGetLocalTables (
void)
{
ACPI_STATUS Status;
ACPI_TABLE_HEADER TableHeader;
ACPI_TABLE_HEADER *NewTable;
UINT32 TableIndex;
/* Get the DSDT via table override */
ACPI_MOVE_32_TO_32 (TableHeader.Signature, ACPI_SIG_DSDT);
AcpiOsTableOverride (&TableHeader, &NewTable);
if (!NewTable)
{
fprintf (stderr, "Could not obtain DSDT\n");
return (AE_NO_ACPI_TABLES);
}
AdWriteTable (NewTable, NewTable->Length,
ACPI_SIG_DSDT, NewTable->OemTableId);
/* Store DSDT in the Table Manager */
Status = AdStoreTable (NewTable, &TableIndex);
if (ACPI_FAILURE (Status))
{
fprintf (stderr, "Could not store DSDT\n");
return (AE_NO_ACPI_TABLES);
}
return (AE_OK);
}
/******************************************************************************
*
* FUNCTION: AdParseTable
*
* PARAMETERS: Table - Pointer to the raw table
* OwnerId - Returned OwnerId of the table
* LoadTable - If add table to the global table list
* External - If this is an external table
*
* RETURN: Status
*
* DESCRIPTION: Parse an ACPI AML table
*
*****************************************************************************/
ACPI_STATUS
AdParseTable (
ACPI_TABLE_HEADER *Table,
ACPI_OWNER_ID *OwnerId,
BOOLEAN LoadTable,
BOOLEAN External)
{
ACPI_STATUS Status = AE_OK;
ACPI_WALK_STATE *WalkState;
UINT8 *AmlStart;
UINT32 AmlLength;
UINT32 TableIndex;
if (!Table)
{
return (AE_NOT_EXIST);
}
/* Pass 1: Parse everything except control method bodies */
fprintf (stderr, "Pass 1 parse of [%4.4s]\n", (char *) Table->Signature);
AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER);
AmlStart = ((UINT8 *) Table + sizeof (ACPI_TABLE_HEADER));
/* Create the root object */
AcpiGbl_ParseOpRoot = AcpiPsCreateScopeOp (AmlStart);
if (!AcpiGbl_ParseOpRoot)
{
return (AE_NO_MEMORY);
}
/* Create and initialize a new walk state */
WalkState = AcpiDsCreateWalkState (0, AcpiGbl_ParseOpRoot, NULL, NULL);
if (!WalkState)
{
return (AE_NO_MEMORY);
}
Status = AcpiDsInitAmlWalk (WalkState, AcpiGbl_ParseOpRoot,
NULL, AmlStart, AmlLength, NULL, ACPI_IMODE_LOAD_PASS1);
if (ACPI_FAILURE (Status))
{
return (Status);
}
WalkState->ParseFlags &= ~ACPI_PARSE_DELETE_TREE;
WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE;
Status = AcpiPsParseAml (WalkState);
if (ACPI_FAILURE (Status))
{
return (Status);
}
/* If LoadTable is FALSE, we are parsing the last loaded table */
TableIndex = AcpiGbl_RootTableList.CurrentTableCount - 1;
/* Pass 2 */
if (LoadTable)
{
Status = AdStoreTable (Table, &TableIndex);
if (ACPI_FAILURE (Status))
{
return (Status);
}
Status = AcpiTbAllocateOwnerId (TableIndex);
if (ACPI_FAILURE (Status))
{
return (Status);
}
if (OwnerId)
{
Status = AcpiTbGetOwnerId (TableIndex, OwnerId);
if (ACPI_FAILURE (Status))
{
return (Status);
}
}
}
fprintf (stderr, "Pass 2 parse of [%4.4s]\n", (char *) Table->Signature);
Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS2, TableIndex, NULL);
if (ACPI_FAILURE (Status))
{
return (Status);
}
/* No need to parse control methods of external table */
if (External)
{
return (AE_OK);
}
/*
* Pass 3: Parse control methods and link their parse trees
* into the main parse tree
*/
fprintf (stderr,
"Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions)\n");
Status = AcpiDmParseDeferredOps (AcpiGbl_ParseOpRoot);
fprintf (stderr, "\n");
/* Process Resource Templates */
AcpiDmFindResources (AcpiGbl_ParseOpRoot);
fprintf (stderr, "Parsing completed\n");
return (AE_OK);
}

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -150,8 +150,8 @@
#define ACPI_EINJ0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_WHEA_HEADER,f)
#define ACPI_ERST0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_WHEA_HEADER,f)
#define ACPI_FPDTH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_FPDT_HEADER,f)
#define ACPI_FPDT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_FPDT_BOOT,f)
#define ACPI_FPDT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_FPDT_S3PT_PTR,f)
#define ACPI_FPDT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_FPDT_BOOT_POINTER,f)
#define ACPI_FPDT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_FPDT_S3PT_POINTER,f)
#define ACPI_GTDT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_GTDT_TIMER_BLOCK,f)
#define ACPI_GTDT0a_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_GTDT_TIMER_ENTRY,f)
#define ACPI_GTDT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_GTDT_WATCHDOG,f)
@ -163,12 +163,14 @@
#define ACPI_HEST7_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_AER,f)
#define ACPI_HEST8_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_AER_BRIDGE,f)
#define ACPI_HEST9_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_GENERIC,f)
#define ACPI_HEST10_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_GENERIC_V2,f)
#define ACPI_HESTN_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_NOTIFY,f)
#define ACPI_HESTB_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_IA_ERROR_BANK,f)
#define ACPI_IORT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_ITS_GROUP,f)
#define ACPI_IORT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_NAMED_COMPONENT,f)
#define ACPI_IORT2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_ROOT_COMPLEX,f)
#define ACPI_IORT3_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_SMMU,f)
#define ACPI_IORT4_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_SMMU_V3,f)
#define ACPI_IORTA_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_MEMORY_ACCESS,f)
#define ACPI_IORTH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_NODE,f)
#define ACPI_IORTM_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_ID_MAPPING,f)
@ -216,12 +218,13 @@
#define ACPI_NFIT6_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_NFIT_FLUSH_ADDRESS,f)
#define ACPI_PCCT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PCCT_SUBSPACE,f)
#define ACPI_PCCT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PCCT_HW_REDUCED,f)
#define ACPI_PCCT2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PCCT_HW_REDUCED_TYPE2,f)
#define ACPI_PMTT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PMTT_SOCKET,f)
#define ACPI_PMTT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PMTT_CONTROLLER,f)
#define ACPI_PMTT1A_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PMTT_DOMAIN,f)
#define ACPI_PMTT2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PMTT_PHYSICAL_COMPONENT,f)
#define ACPI_PMTTH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PMTT_HEADER,f)
#define ACPI_S3PTH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_S3PT_HEADER,f)
#define ACPI_S3PTH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_FPDT_HEADER,f)
#define ACPI_S3PT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_S3PT_RESUME,f)
#define ACPI_S3PT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_S3PT_SUSPEND,f)
#define ACPI_SLIC_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SLIC,f)
@ -255,6 +258,7 @@
#define ACPI_GTDT0a_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_GTDT_TIMER_ENTRY,f,o)
#define ACPI_GTDT1_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_GTDT_WATCHDOG,f,o)
#define ACPI_IORT3_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_IORT_SMMU,f,o)
#define ACPI_IORT4_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_IORT_SMMU_V3,f,o)
#define ACPI_IORTA_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_IORT_MEMORY_ACCESS,f,o)
#define ACPI_IORTM_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_IORT_ID_MAPPING,f,o)
#define ACPI_LPITH_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_LPIT_HEADER,f,o)
@ -276,6 +280,7 @@
#define ACPI_NFIT4_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_NFIT_CONTROL_REGION,f,o)
#define ACPI_PCCT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_PCCT,f,o)
#define ACPI_PCCT1_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_PCCT_HW_REDUCED,f,o)
#define ACPI_PCCT2_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_PCCT_HW_REDUCED_TYPE2,f,o)
#define ACPI_PMTTH_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_PMTT_HEADER,f,o)
#define ACPI_WDDT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_WDDT,f,o)
#define ACPI_EINJ0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_WHEA_HEADER,f,o)
@ -1094,11 +1099,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoFpdtHdr[] =
ACPI_DMTABLE_INFO AcpiDmTableInfoFpdt0[] =
{
{ACPI_DMT_UINT32, ACPI_FPDT0_OFFSET (Reserved), "Reserved", 0},
{ACPI_DMT_UINT64, ACPI_FPDT0_OFFSET (ResetEnd), "Reset End", 0},
{ACPI_DMT_UINT64, ACPI_FPDT0_OFFSET (LoadStart), "Load Image Start", 0},
{ACPI_DMT_UINT64, ACPI_FPDT0_OFFSET (StartupStart), "Start Image Start", 0},
{ACPI_DMT_UINT64, ACPI_FPDT0_OFFSET (ExitServicesEntry), "Exit Services Entry", 0},
{ACPI_DMT_UINT64, ACPI_FPDT0_OFFSET (ExitServicesExit), "Exit Services Exit", 0},
{ACPI_DMT_UINT64, ACPI_FPDT1_OFFSET (Address), "FPDT Boot Record Address", 0},
ACPI_DMT_TERMINATOR
};
@ -1107,10 +1108,18 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoFpdt0[] =
ACPI_DMTABLE_INFO AcpiDmTableInfoFpdt1[] =
{
{ACPI_DMT_UINT32, ACPI_FPDT1_OFFSET (Reserved), "Reserved", 0},
{ACPI_DMT_UINT64, ACPI_FPDT1_OFFSET (Address), "S3PT Address", 0},
{ACPI_DMT_UINT64, ACPI_FPDT1_OFFSET (Address), "S3PT Record Address", 0},
ACPI_DMT_TERMINATOR
};
#if 0
/* Boot Performance Record, not supported at this time. */
{ACPI_DMT_UINT64, ACPI_FPDT0_OFFSET (ResetEnd), "Reset End", 0},
{ACPI_DMT_UINT64, ACPI_FPDT0_OFFSET (LoadStart), "Load Image Start", 0},
{ACPI_DMT_UINT64, ACPI_FPDT0_OFFSET (StartupStart), "Start Image Start", 0},
{ACPI_DMT_UINT64, ACPI_FPDT0_OFFSET (ExitServicesEntry), "Exit Services Entry", 0},
{ACPI_DMT_UINT64, ACPI_FPDT0_OFFSET (ExitServicesExit), "Exit Services Exit", 0},
#endif
/*******************************************************************************
*
@ -1342,6 +1351,26 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoHest9[] =
ACPI_DMT_TERMINATOR
};
/* 10: Generic Hardware Error Source - Version 2 */
ACPI_DMTABLE_INFO AcpiDmTableInfoHest10[] =
{
ACPI_DM_HEST_HEADER,
{ACPI_DMT_UINT16, ACPI_HEST10_OFFSET (RelatedSourceId), "Related Source Id", 0},
{ACPI_DMT_UINT8, ACPI_HEST10_OFFSET (Reserved), "Reserved", 0},
{ACPI_DMT_UINT8, ACPI_HEST10_OFFSET (Enabled), "Enabled", 0},
{ACPI_DMT_UINT32, ACPI_HEST10_OFFSET (RecordsToPreallocate), "Records To Preallocate", 0},
{ACPI_DMT_UINT32, ACPI_HEST10_OFFSET (MaxSectionsPerRecord), "Max Sections Per Record", 0},
{ACPI_DMT_UINT32, ACPI_HEST10_OFFSET (MaxRawDataLength), "Max Raw Data Length", 0},
{ACPI_DMT_GAS, ACPI_HEST10_OFFSET (ErrorStatusAddress), "Error Status Address", 0},
{ACPI_DMT_HESTNTFY, ACPI_HEST10_OFFSET (Notify), "Notify", 0},
{ACPI_DMT_UINT32, ACPI_HEST10_OFFSET (ErrorBlockLength), "Error Status Block Length", 0},
{ACPI_DMT_GAS, ACPI_HEST10_OFFSET (ReadAckRegister), "Read Ack Register", 0},
{ACPI_DMT_UINT64, ACPI_HEST10_OFFSET (ReadAckPreserve), "Read Ack Preserve", 0},
{ACPI_DMT_UINT64, ACPI_HEST10_OFFSET (ReadAckWrite), "Read Ack Write", 0},
ACPI_DMT_TERMINATOR
};
ACPI_DMTABLE_INFO AcpiDmTableInfoHestNotify[] =
{
{ACPI_DMT_HESTNTYP, ACPI_HESTN_OFFSET (Type), "Notify Type", 0},
@ -1536,6 +1565,23 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoIort3c[] =
ACPI_DMT_TERMINATOR
};
/* 0x04: SMMUv3 */
ACPI_DMTABLE_INFO AcpiDmTableInfoIort4[] =
{
{ACPI_DMT_UINT64, ACPI_IORT4_OFFSET (BaseAddress), "Base Address", 0},
{ACPI_DMT_UINT32, ACPI_IORT4_OFFSET (Flags), "Flags (decoded below)", 0},
{ACPI_DMT_FLAG0, ACPI_IORT4_FLAG_OFFSET (Flags, 0), "COHACC Override", 0},
{ACPI_DMT_FLAG1, ACPI_IORT4_FLAG_OFFSET (Flags, 0), "HTTU Override", 0},
{ACPI_DMT_UINT32, ACPI_IORT4_OFFSET (Reserved), "Reserved", 0},
{ACPI_DMT_UINT64, ACPI_IORT4_OFFSET (VatosAddress), "VATOS Address", 0},
{ACPI_DMT_UINT32, ACPI_IORT4_OFFSET (Model), "Model", 0},
{ACPI_DMT_UINT32, ACPI_IORT4_OFFSET (EventGsiv), "Event GSIV", 0},
{ACPI_DMT_UINT32, ACPI_IORT4_OFFSET (PriGsiv), "PRI GSIV", 0},
{ACPI_DMT_UINT32, ACPI_IORT4_OFFSET (GerrGsiv), "GERR GSIV", 0},
{ACPI_DMT_UINT32, ACPI_IORT4_OFFSET (SyncGsiv), "Sync GSIV", 0},
ACPI_DMT_TERMINATOR
};
/*******************************************************************************
*
@ -2141,6 +2187,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoNfit1[] =
{ACPI_DMT_FLAG3, ACPI_NFIT1_FLAG_OFFSET (Flags,0), "Device not armed", 0},
{ACPI_DMT_FLAG4, ACPI_NFIT1_FLAG_OFFSET (Flags,0), "Health events observed", 0},
{ACPI_DMT_FLAG5, ACPI_NFIT1_FLAG_OFFSET (Flags,0), "Health events enabled", 0},
{ACPI_DMT_FLAG6, ACPI_NFIT1_FLAG_OFFSET (Flags,0), "Mapping failed", 0},
{ACPI_DMT_UINT16, ACPI_NFIT1_OFFSET (Reserved), "Reserved", 0},
ACPI_DMT_TERMINATOR
};
@ -2187,7 +2234,10 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoNfit4[] =
{ACPI_DMT_UINT16, ACPI_NFIT4_OFFSET (SubsystemVendorId), "Subsystem Vendor Id", 0},
{ACPI_DMT_UINT16, ACPI_NFIT4_OFFSET (SubsystemDeviceId), "Subsystem Device Id", 0},
{ACPI_DMT_UINT16, ACPI_NFIT4_OFFSET (SubsystemRevisionId), "Subsystem Revision Id", 0},
{ACPI_DMT_UINT48, ACPI_NFIT4_OFFSET (Reserved[0]), "Reserved", 0},
{ACPI_DMT_UINT8, ACPI_NFIT4_OFFSET (ValidFields), "Valid Fields", 0},
{ACPI_DMT_UINT8, ACPI_NFIT4_OFFSET (ManufacturingLocation), "Manufacturing Location", 0},
{ACPI_DMT_UINT16, ACPI_NFIT4_OFFSET (ManufacturingDate), "Manufacturing Date", 0},
{ACPI_DMT_UINT16, ACPI_NFIT4_OFFSET (Reserved[0]), "Reserved", 0},
{ACPI_DMT_UINT32, ACPI_NFIT4_OFFSET (SerialNumber), "Serial Number", 0},
{ACPI_DMT_UINT16, ACPI_NFIT4_OFFSET (Code), "Code", 0},
{ACPI_DMT_UINT16, ACPI_NFIT4_OFFSET (Windows), "Window Count", 0},
@ -2291,6 +2341,29 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoPcct1[] =
ACPI_DMT_TERMINATOR
};
/* 2: HW-reduced Communications Subspace Type 2 (ACPI 6.1) */
ACPI_DMTABLE_INFO AcpiDmTableInfoPcct2[] =
{
{ACPI_DMT_UINT32, ACPI_PCCT2_OFFSET (DoorbellInterrupt), "Doorbell Interrupt", 0},
{ACPI_DMT_UINT8, ACPI_PCCT2_OFFSET (Flags), "Flags (Decoded Below)", DT_FLAG},
{ACPI_DMT_FLAG0, ACPI_PCCT2_FLAG_OFFSET (Flags,0), "Polarity", 0},
{ACPI_DMT_FLAG1, ACPI_PCCT2_FLAG_OFFSET (Flags,0), "Mode", 0},
{ACPI_DMT_UINT8, ACPI_PCCT2_OFFSET (Reserved), "Reserved", 0},
{ACPI_DMT_UINT64, ACPI_PCCT2_OFFSET (BaseAddress), "Base Address", 0},
{ACPI_DMT_UINT64, ACPI_PCCT2_OFFSET (Length), "Address Length", 0},
{ACPI_DMT_GAS, ACPI_PCCT2_OFFSET (DoorbellRegister), "Doorbell Register", 0},
{ACPI_DMT_UINT64, ACPI_PCCT2_OFFSET (PreserveMask), "Preserve Mask", 0},
{ACPI_DMT_UINT64, ACPI_PCCT2_OFFSET (WriteMask), "Write Mask", 0},
{ACPI_DMT_UINT32, ACPI_PCCT2_OFFSET (Latency), "Command Latency", 0},
{ACPI_DMT_UINT32, ACPI_PCCT2_OFFSET (MaxAccessRate), "Maximum Access Rate", 0},
{ACPI_DMT_UINT16, ACPI_PCCT2_OFFSET (MinTurnaroundTime), "Minimum Turnaround Time", 0},
{ACPI_DMT_GAS, ACPI_PCCT2_OFFSET (DoorbellAckRegister), "Doorbell ACK Register", 0},
{ACPI_DMT_UINT64, ACPI_PCCT2_OFFSET (AckPreserveMask), "ACK Preserve Mask", 0},
{ACPI_DMT_UINT64, ACPI_PCCT2_OFFSET (AckWriteMask), "ACK Write Mask", 0},
ACPI_DMT_TERMINATOR
};
/*******************************************************************************
*

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -47,6 +47,7 @@
* Option strings:
* "f" - Option has no arguments
* "f:" - Option requires an argument
* "f+" - Option has an optional argument
* "f^" - Option has optional single-char sub-options
* "f|" - Option has required single-char sub-options
*/
@ -90,6 +91,7 @@ AcpiGetoptArgument (
int argc,
char **argv)
{
AcpiGbl_Optind--;
CurrentCharPtr++;
@ -182,7 +184,8 @@ AcpiGetopt(
}
else if (++AcpiGbl_Optind >= argc)
{
ACPI_OPTION_ERROR ("Option requires an argument: -", CurrentChar);
ACPI_OPTION_ERROR (
"Option requires an argument: -", CurrentChar);
CurrentCharPtr = 1;
return ('?');
@ -243,7 +246,9 @@ AcpiGetopt(
}
else
{
ACPI_OPTION_ERROR ("Option requires a single-character suboption: -", CurrentChar);
ACPI_OPTION_ERROR (
"Option requires a single-character suboption: -",
CurrentChar);
CurrentCharPtr = 1;
return ('?');

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -50,6 +50,15 @@
ACPI_MODULE_NAME ("aslanalyze")
/* Local Prototypes */
static ACPI_STATUS
ApDeviceSubtreeWalk (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context);
/*******************************************************************************
*
* FUNCTION: AnIsInternalMethod
@ -139,8 +148,7 @@ AnCheckId (
Length = strlen (Op->Asl.Value.String);
if (!Length)
{
AslError (ASL_ERROR, ASL_MSG_NULL_STRING,
Op, NULL);
AslError (ASL_ERROR, ASL_MSG_NULL_STRING, Op, NULL);
return;
}
@ -191,7 +199,7 @@ AnCheckId (
return;
}
/* _HID Length is valid (7 or 8), now check the prefix (first 3 or 4 chars) */
/* _HID Length is valid (7 or 8), now check prefix (first 3 or 4 chars) */
if (Length == 7)
{
@ -231,8 +239,8 @@ AnCheckId (
{
if (!isxdigit ((int) Op->Asl.Value.String[i]))
{
AslError (ASL_ERROR, ASL_MSG_HID_SUFFIX,
Op, &Op->Asl.Value.String[i]);
AslError (ASL_ERROR, ASL_MSG_HID_SUFFIX,
Op, &Op->Asl.Value.String[i]);
break;
}
}
@ -309,6 +317,12 @@ AnCheckMethodReturnValue (
Node = ArgOp->Asl.Node;
if (!Node)
{
/* No error message, this can happen and is OK */
return;
}
/* Examine the parent op of this method */
@ -323,7 +337,8 @@ AnCheckMethodReturnValue (
{
/* Method SOMETIMES returns a value, SOMETIMES not */
AslError (ASL_WARNING, ASL_MSG_SOME_NO_RETVAL, Op, Op->Asl.ExternalName);
AslError (ASL_WARNING, ASL_MSG_SOME_NO_RETVAL,
Op, Op->Asl.ExternalName);
}
else if (!(ThisNodeBtype & RequiredBtypes))
{
@ -400,12 +415,13 @@ AnIsResultUsed (
{
return (TRUE);
}
return (FALSE);
/* Not used if one of these is the parent */
case PARSEOP_METHOD:
case PARSEOP_DEFINITIONBLOCK:
case PARSEOP_DEFINITION_BLOCK:
case PARSEOP_ELSE:
return (FALSE);
@ -570,6 +586,108 @@ ApCheckRegMethod (
}
/*******************************************************************************
*
* FUNCTION: ApFindNameInDeviceTree
*
* PARAMETERS: Name - Name to search for
* Op - Current parse op
*
* RETURN: TRUE if name found in the same scope as Op.
*
* DESCRIPTION: Determine if a name appears in the same scope as Op, as either
* a Method() or a Name(). "Same scope" can mean under an If or
* Else statement.
*
* NOTE: Detects _HID/_ADR in this type of construct (legal in ACPI 6.1+)
*
* Scope (\_SB.PCI0)
* {
* Device (I2C0)
* {
* If (SMD0 != 4) {
* Name (_HID, "INT3442")
* } Else {
* Name (_ADR, 0x400)
* }
* }
* }
******************************************************************************/
BOOLEAN
ApFindNameInDeviceTree (
char *Name,
ACPI_PARSE_OBJECT *Op)
{
ACPI_STATUS Status;
Status = TrWalkParseTree (Op, ASL_WALK_VISIT_DOWNWARD,
ApDeviceSubtreeWalk, NULL, Name);
if (Status == AE_CTRL_TRUE)
{
return (TRUE); /* Found a match */
}
return (FALSE);
}
/* Callback function for interface above */
static ACPI_STATUS
ApDeviceSubtreeWalk (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context)
{
char *Name = ACPI_CAST_PTR (char, Context);
switch (Op->Asl.ParseOpcode)
{
case PARSEOP_DEVICE:
/* Level 0 is the starting device, ignore it */
if (Level > 0)
{
/* Ignore sub-devices */
return (AE_CTRL_DEPTH);
}
break;
case PARSEOP_NAME:
case PARSEOP_METHOD:
/* These are what we are looking for */
if (ACPI_COMPARE_NAME (Name, Op->Asl.NameSeg))
{
return (AE_CTRL_TRUE);
}
return (AE_CTRL_DEPTH);
case PARSEOP_SCOPE:
case PARSEOP_FIELD:
case PARSEOP_OPERATIONREGION:
/*
* We want to ignore these, because either they can be large
* subtrees or open a scope to somewhere else.
*/
return (AE_CTRL_DEPTH);
default:
break;
}
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: ApFindNameInScope

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -42,6 +42,7 @@
*/
#include <contrib/dev/acpica/compiler/aslcompiler.h>
#include <contrib/dev/acpica/include/actables.h>
#include <contrib/dev/acpica/include/acapps.h>
#define _COMPONENT ACPI_COMPILER
@ -63,90 +64,7 @@ FlConsumeNewComment (
/*******************************************************************************
*
* FUNCTION: FlCheckForAcpiTable
*
* PARAMETERS: Handle - Open input file
*
* RETURN: Status
*
* DESCRIPTION: Determine if a file seems to be a binary ACPI table, via the
* following checks on what would be the table header:
* 0) File must be at least as long as an ACPI_TABLE_HEADER
* 1) The header length field must match the file size
* 2) Signature, OemId, OemTableId, AslCompilerId must be ASCII
*
******************************************************************************/
ACPI_STATUS
FlCheckForAcpiTable (
FILE *Handle)
{
ACPI_TABLE_HEADER Table;
UINT32 FileSize;
size_t Actual;
UINT32 i;
/* Read a potential table header */
Actual = fread (&Table, 1, sizeof (ACPI_TABLE_HEADER), Handle);
fseek (Handle, 0, SEEK_SET);
if (Actual < sizeof (ACPI_TABLE_HEADER))
{
return (AE_ERROR);
}
/* Header length field must match the file size */
FileSize = CmGetFileSize (Handle);
if (Table.Length != FileSize)
{
return (AE_ERROR);
}
/*
* These fields must be ASCII:
* Signature, OemId, OemTableId, AslCompilerId.
* We allow a NULL terminator in OemId and OemTableId.
*/
for (i = 0; i < ACPI_NAME_SIZE; i++)
{
if (!ACPI_IS_ASCII ((UINT8) Table.Signature[i]))
{
return (AE_ERROR);
}
if (!ACPI_IS_ASCII ((UINT8) Table.AslCompilerId[i]))
{
return (AE_ERROR);
}
}
for (i = 0; (i < ACPI_OEM_ID_SIZE) && (Table.OemId[i]); i++)
{
if (!ACPI_IS_ASCII ((UINT8) Table.OemId[i]))
{
return (AE_ERROR);
}
}
for (i = 0; (i < ACPI_OEM_TABLE_ID_SIZE) && (Table.OemTableId[i]); i++)
{
if (!ACPI_IS_ASCII ((UINT8) Table.OemTableId[i]))
{
return (AE_ERROR);
}
}
printf ("Binary file appears to be a valid ACPI table, disassembling\n");
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: FlCheckForAscii
* FUNCTION: FlIsFileAsciiSource
*
* PARAMETERS: Filename - Full input filename
* DisplayErrors - TRUE if error messages desired
@ -163,7 +81,7 @@ FlCheckForAcpiTable (
******************************************************************************/
ACPI_STATUS
FlCheckForAscii (
FlIsFileAsciiSource (
char *Filename,
BOOLEAN DisplayErrors)
{

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -78,7 +78,6 @@ AnMapArgTypeToBtype (
switch (ArgType)
{
/* Simple types */
case ARGI_ANYTYPE:
@ -100,9 +99,10 @@ AnMapArgTypeToBtype (
case ARGI_DDBHANDLE:
/*
* DDBHandleObject := SuperName
* ACPI_BTYPE_REFERENCE: Index reference as parameter of Load/Unload
* ACPI_BTYPE_REFERENCE_OBJECT:
* Index reference as parameter of Load/Unload
*/
return (ACPI_BTYPE_DDB_HANDLE | ACPI_BTYPE_REFERENCE);
return (ACPI_BTYPE_DDB_HANDLE | ACPI_BTYPE_REFERENCE_OBJECT);
/* Interchangeable types */
/*
@ -133,9 +133,24 @@ AnMapArgTypeToBtype (
case ARGI_REFERENCE:
return (ACPI_BTYPE_REFERENCE);
return (ACPI_BTYPE_NAMED_REFERENCE); /* Name or Namestring */
case ARGI_TARGETREF:
/*
* Target operand for most math and logic operators.
* Package objects not allowed as target.
*/
return (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_DEBUG_OBJECT |
ACPI_BTYPE_REFERENCE_OBJECT);
case ARGI_STORE_TARGET:
/* Special target for Store(), includes packages */
return (ACPI_BTYPE_DATA | ACPI_BTYPE_DEBUG_OBJECT |
ACPI_BTYPE_REFERENCE_OBJECT);
case ARGI_FIXED_TARGET:
case ARGI_SIMPLE_TARGET:
@ -149,28 +164,33 @@ AnMapArgTypeToBtype (
* Used only by SizeOf operator
*/
return (ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER |
ACPI_BTYPE_PACKAGE | ACPI_BTYPE_REFERENCE);
ACPI_BTYPE_PACKAGE | ACPI_BTYPE_REFERENCE_OBJECT);
case ARGI_COMPLEXOBJ:
/* Buffer, String, or package */
return (ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER | ACPI_BTYPE_PACKAGE);
return (ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER |
ACPI_BTYPE_PACKAGE);
case ARGI_REF_OR_STRING:
return (ACPI_BTYPE_STRING | ACPI_BTYPE_REFERENCE);
/* Used by DeRefOf operator only */
return (ACPI_BTYPE_STRING | ACPI_BTYPE_REFERENCE_OBJECT);
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);
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);
/* Used by Store() only, as the source operand */
return (ACPI_BTYPE_DATA_REFERENCE | ACPI_BTYPE_REFERENCE_OBJECT);
default:
@ -200,7 +220,6 @@ AnMapEtypeToBtype (
UINT32 Etype)
{
if (Etype == ACPI_TYPE_ANY)
{
return (ACPI_BTYPE_OBJECTS_AND_REFS);
@ -274,7 +293,7 @@ AnMapEtypeToBtype (
case ACPI_TYPE_LOCAL_RESOURCE:
case ACPI_TYPE_LOCAL_RESOURCE_FIELD:
return (ACPI_BTYPE_REFERENCE);
return (ACPI_BTYPE_REFERENCE_OBJECT);
default:
@ -307,7 +326,6 @@ AnFormatBtype (
*Buffer = 0;
if (Btype == 0)
{
strcat (Buffer, "NoReturnValue");
@ -322,6 +340,7 @@ AnFormatBtype (
{
strcat (Buffer, "|");
}
First = FALSE;
strcat (Buffer, AcpiUtGetTypeName (Type));
}
@ -334,6 +353,7 @@ AnFormatBtype (
{
strcat (Buffer, "|");
}
First = FALSE;
strcat (Buffer, "Reference");
}
@ -345,6 +365,7 @@ AnFormatBtype (
{
strcat (Buffer, "|");
}
First = FALSE;
strcat (Buffer, "Resource");
}
@ -387,11 +408,25 @@ AnGetBtype (
Node = Op->Asl.Node;
if (!Node)
{
/* These are not expected to have a node at this time */
if ((Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CREATEWORDFIELD) ||
(Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CREATEDWORDFIELD) ||
(Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CREATEQWORDFIELD) ||
(Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CREATEBYTEFIELD) ||
(Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CREATEBITFIELD) ||
(Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CREATEFIELD) ||
(Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONDREFOF))
{
return (ACPI_UINT32_MAX - 1);
}
DbgPrint (ASL_DEBUG_OUTPUT,
"No attached Nsnode: [%s] at line %u name [%s], ignoring typecheck\n",
"No attached Nsnode: [%s] at line %u name [%s], "
"ignoring typecheck. Parent [%s]\n",
Op->Asl.ParseOpName, Op->Asl.LineNumber,
Op->Asl.ExternalName);
return (ACPI_UINT32_MAX);
Op->Asl.ExternalName, Op->Asl.Parent->Asl.ParseOpName);
return (ACPI_UINT32_MAX - 1);
}
ThisNodeBtype = AnMapEtypeToBtype (Node->Type);
@ -401,12 +436,6 @@ AnGetBtype (
"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;

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -97,22 +97,16 @@ CgGenerateAmlOutput (
void)
{
DbgPrint (ASL_DEBUG_OUTPUT, "\nWriting AML\n\n");
/* Generate the AML output file */
FlSeekFile (ASL_FILE_SOURCE_OUTPUT, 0);
Gbl_SourceLine = 0;
Gbl_NextError = Gbl_ErrorLog;
TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD,
TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD,
CgAmlWriteWalk, NULL, NULL);
DbgPrint (ASL_TREE_OUTPUT,
"%*s Value P_Op A_Op OpLen PByts Len SubLen PSubLen OpPtr"
" Parent Child Next Flags AcTyp Final Col L# EL# LL# ELL#\n",
76, " ");
DbgPrint (ASL_TREE_OUTPUT, ASL_PARSE_TREE_HEADER2);
CgCloseTable ();
}
@ -136,64 +130,64 @@ CgAmlWriteWalk (
void *Context)
{
/*
* Print header at level 0. Alignment assumes 32-bit pointers
*/
if (!Level)
{
DbgPrint (ASL_TREE_OUTPUT,
"Final parse tree used for AML output:\n");
DbgPrint (ASL_TREE_OUTPUT,
"%*s Value P_Op A_Op OpLen PByts Len SubLen PSubLen OpPtr"
" Parent Child Next Flags AcTyp Final Col L# EL# LL# ELL#\n",
76, " ");
}
/* Debug output */
DbgPrint (ASL_TREE_OUTPUT,
"%5.5d [%2d]", Op->Asl.LogicalLineNumber, Level);
UtPrintFormattedName (Op->Asl.ParseOpcode, Level);
if (Op->Asl.ParseOpcode == PARSEOP_NAMESEG ||
Op->Asl.ParseOpcode == PARSEOP_NAMESTRING ||
Op->Asl.ParseOpcode == PARSEOP_METHODCALL)
{
DbgPrint (ASL_TREE_OUTPUT,
"%10.32s ", Op->Asl.ExternalName);
}
else
{
DbgPrint (ASL_TREE_OUTPUT, " ");
}
DbgPrint (ASL_TREE_OUTPUT,
"%08X %04X %04X %01X %04X %04X %04X %04X "
"%08X %08X %08X %08X %08X %08X %04X %02d %02d %02d %02d %02d\n",
/* 1 */ (UINT32) Op->Asl.Value.Integer,
/* 2 */ Op->Asl.ParseOpcode,
/* 3 */ Op->Asl.AmlOpcode,
/* 4 */ Op->Asl.AmlOpcodeLength,
/* 5 */ Op->Asl.AmlPkgLenBytes,
/* 6 */ Op->Asl.AmlLength,
/* 7 */ Op->Asl.AmlSubtreeLength,
/* 8 */ Op->Asl.Parent ? Op->Asl.Parent->Asl.AmlSubtreeLength : 0,
/* 9 */ Op,
/* 10 */ Op->Asl.Parent,
/* 11 */ Op->Asl.Child,
/* 12 */ Op->Asl.Next,
/* 13 */ Op->Asl.CompileFlags,
/* 14 */ Op->Asl.AcpiBtype,
/* 15 */ Op->Asl.FinalAmlLength,
/* 16 */ Op->Asl.Column,
/* 17 */ Op->Asl.LineNumber,
/* 18 */ Op->Asl.EndLine,
/* 19 */ Op->Asl.LogicalLineNumber,
/* 20 */ Op->Asl.EndLogicalLine);
/* Generate the AML for this node */
CgWriteNode (Op);
if (!Gbl_DebugFlag)
{
return (AE_OK);
}
/* Print header at level 0. Alignment assumes 32-bit pointers */
if (!Level)
{
DbgPrint (ASL_TREE_OUTPUT,
"\nFinal parse tree used for AML output:\n");
DbgPrint (ASL_TREE_OUTPUT, ASL_PARSE_TREE_HEADER2);
}
/* Dump ParseOp name and possible value */
switch (Op->Asl.ParseOpcode)
{
case PARSEOP_NAMESEG:
case PARSEOP_NAMESTRING:
case PARSEOP_METHODCALL:
case PARSEOP_STRING_LITERAL:
UtDumpStringOp (Op, Level);
break;
default:
UtDumpBasicOp (Op, Level);
break;
}
DbgPrint (ASL_TREE_OUTPUT, ASL_PARSE_TREE_DEBUG2,
/* 1 */ (UINT32) Op->Asl.Value.Integer,
/* 2 */ Op->Asl.ParseOpcode,
/* 3 */ Op->Asl.AmlOpcode,
/* 4 */ Op->Asl.AmlOpcodeLength,
/* 5 */ Op->Asl.AmlPkgLenBytes,
/* 6 */ Op->Asl.AmlLength,
/* 7 */ Op->Asl.AmlSubtreeLength,
/* 8 */ Op->Asl.Parent ? Op->Asl.Parent->Asl.AmlSubtreeLength : 0,
/* 9 */ Op,
/* 10 */ Op->Asl.Parent,
/* 11 */ Op->Asl.Child,
/* 12 */ Op->Asl.Next,
/* 13 */ Op->Asl.CompileFlags,
/* 14 */ Op->Asl.AcpiBtype,
/* 15 */ Op->Asl.FinalAmlLength,
/* 16 */ Op->Asl.Column,
/* 17 */ Op->Asl.LineNumber,
/* 18 */ Op->Asl.EndLine,
/* 19 */ Op->Asl.LogicalLineNumber,
/* 20 */ Op->Asl.EndLogicalLine);
return (AE_OK);
}
@ -274,7 +268,8 @@ CgWriteAmlOpcode (
/* These opcodes should not get here */
printf ("Found a node with an unassigned AML opcode\n");
FlPrintFile (ASL_FILE_STDERR, "Found a node with an unassigned AML opcode\n");
FlPrintFile (ASL_FILE_STDERR,
"Found a node with an unassigned AML opcode\n");
return;
case AML_INT_RESERVEDFIELD_OP:
@ -357,8 +352,10 @@ CgWriteAmlOpcode (
*/
PkgLen.Len >>= 4;
/* Now we can write the remaining bytes - either 1, 2, or 3 bytes */
/*
* Now we can write the remaining bytes -
* either 1, 2, or 3 bytes
*/
for (i = 0; i < (UINT32) (Op->Asl.AmlPkgLenBytes - 1); i++)
{
CgLocalWriteAmlData (Op, &PkgLen.LenBytes[i], 1);
@ -467,10 +464,68 @@ CgWriteTableHeader (
/* Table length. Checksum zero for now, will rewrite later */
TableHeader.Length = Gbl_TableLength;
TableHeader.Length = sizeof (ACPI_TABLE_HEADER) +
Op->Asl.AmlSubtreeLength;
TableHeader.Checksum = 0;
Op->Asl.FinalAmlOffset = ftell (Gbl_Files[ASL_FILE_AML_OUTPUT].Handle);
/* Write entire header and clear the table header global */
CgLocalWriteAmlData (Op, &TableHeader, sizeof (ACPI_TABLE_HEADER));
memset (&TableHeader, 0, sizeof (ACPI_TABLE_HEADER));
}
/*******************************************************************************
*
* FUNCTION: CgUpdateHeader
*
* PARAMETERS: Op - Op for the Definition Block
*
* RETURN: None.
*
* DESCRIPTION: Complete the ACPI table by calculating the checksum and
* re-writing the header for the input definition block
*
******************************************************************************/
static void
CgUpdateHeader (
ACPI_PARSE_OBJECT *Op)
{
signed char Sum;
UINT32 i;
UINT32 Length;
UINT8 FileByte;
UINT8 Checksum;
/* Calculate the checksum over the entire definition block */
Sum = 0;
Length = sizeof (ACPI_TABLE_HEADER) + Op->Asl.AmlSubtreeLength;
FlSeekFile (ASL_FILE_AML_OUTPUT, Op->Asl.FinalAmlOffset);
for (i = 0; i < Length; i++)
{
if (FlReadFile (ASL_FILE_AML_OUTPUT, &FileByte, 1) != AE_OK)
{
printf ("EOF while reading checksum bytes\n");
return;
}
Sum = (signed char) (Sum + FileByte);
}
Checksum = (UINT8) (0 - Sum);
/* Re-write the the checksum byte */
FlSeekFile (ASL_FILE_AML_OUTPUT, Op->Asl.FinalAmlOffset +
ACPI_OFFSET (ACPI_TABLE_HEADER, Checksum));
FlWriteFile (ASL_FILE_AML_OUTPUT, &Checksum, 1);
}
@ -483,7 +538,8 @@ CgWriteTableHeader (
* RETURN: None.
*
* DESCRIPTION: Complete the ACPI table by calculating the checksum and
* re-writing the header.
* re-writing each table header. This allows support for
* multiple definition blocks in a single source file.
*
******************************************************************************/
@ -491,26 +547,17 @@ static void
CgCloseTable (
void)
{
signed char Sum;
UINT8 FileByte;
ACPI_PARSE_OBJECT *Op;
FlSeekFile (ASL_FILE_AML_OUTPUT, 0);
Sum = 0;
/* Process all definition blocks */
/* Calculate the checksum over the entire file */
while (FlReadFile (ASL_FILE_AML_OUTPUT, &FileByte, 1) == AE_OK)
Op = Gbl_ParseTreeRoot->Asl.Child;
while (Op)
{
Sum = (signed char) (Sum + FileByte);
CgUpdateHeader (Op);
Op = Op->Asl.Next;
}
/* Re-write the table header with the checksum */
TableHeader.Checksum = (UINT8) (0 - Sum);
FlSeekFile (ASL_FILE_AML_OUTPUT, 0);
CgLocalWriteAmlData (NULL, &TableHeader, sizeof (ACPI_TABLE_HEADER));
}
@ -537,13 +584,18 @@ CgWriteNode (
/* TBD: this may not be the best place for this check */
if ((Op->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) ||
(Op->Asl.ParseOpcode == PARSEOP_EXTERNAL) ||
(Op->Asl.ParseOpcode == PARSEOP_INCLUDE) ||
(Op->Asl.ParseOpcode == PARSEOP_INCLUDE_END))
{
return;
}
if ((Op->Asl.ParseOpcode == PARSEOP_EXTERNAL) &&
Gbl_DoExternals == FALSE)
{
return;
}
Op->Asl.FinalAmlLength = 0;
switch (Op->Asl.AmlOpcode)
@ -586,7 +638,7 @@ CgWriteNode (
break;
case PARSEOP_DEFINITIONBLOCK:
case PARSEOP_DEFINITION_BLOCK:
CgWriteTableHeader (Op);
break;

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -130,14 +130,15 @@ CmDoCompile (
if (Gbl_SyntaxError)
{
fprintf (stderr, "Compiler aborting due to parser-detected syntax error(s)\n");
fprintf (stderr,
"Compiler aborting due to parser-detected syntax error(s)\n");
LsDumpParseTree ();
goto ErrorExit;
}
/* Did the parse tree get successfully constructed? */
if (!RootNode)
if (!Gbl_ParseTreeRoot)
{
/*
* If there are no errors, then we have some sort of
@ -165,29 +166,29 @@ CmDoCompile (
LsDumpParseTree ();
OpcGetIntegerWidth (RootNode);
OpcGetIntegerWidth (Gbl_ParseTreeRoot->Asl.Child);
UtEndEvent (Event);
/* Pre-process parse tree for any operator transforms */
Event = UtBeginEvent ("Parse tree transforms");
DbgPrint (ASL_DEBUG_OUTPUT, "\nParse tree transforms\n\n");
TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD,
TrAmlTransformWalk, NULL, NULL);
TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_TWICE,
TrAmlTransformWalkBegin, TrAmlTransformWalkEnd, NULL);
UtEndEvent (Event);
/* Generate AML opcodes corresponding to the parse tokens */
Event = UtBeginEvent ("Generate AML opcodes");
DbgPrint (ASL_DEBUG_OUTPUT, "\nGenerating AML opcodes\n\n");
TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL,
DbgPrint (ASL_DEBUG_OUTPUT, "Generating AML opcodes\n\n");
TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, NULL,
OpcAmlOpcodeWalk, NULL);
UtEndEvent (Event);
/*
* Now that the input is parsed, we can open the AML output file.
* Note: by default, the name of this file comes from the table descriptor
* within the input file.
* Note: by default, the name of this file comes from the table
* descriptor within the input file.
*/
Event = UtBeginEvent ("Open AML output file");
Status = FlOpenAmlOutputFile (Gbl_OutputFilenamePrefix);
@ -202,12 +203,12 @@ CmDoCompile (
Event = UtBeginEvent ("Constant folding via AML interpreter");
DbgPrint (ASL_DEBUG_OUTPUT,
"\nInterpreting compile-time constant expressions\n\n");
"Interpreting compile-time constant expressions\n\n");
if (Gbl_FoldConstants)
{
TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD,
OpcAmlConstantWalk, NULL, NULL);
TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD,
NULL, OpcAmlConstantWalk, NULL);
}
else
{
@ -219,16 +220,16 @@ CmDoCompile (
Event = UtBeginEvent ("Updating AML opcodes after constant folding");
DbgPrint (ASL_DEBUG_OUTPUT,
"\nUpdating AML opcodes after constant folding\n\n");
TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD,
"Updating AML opcodes after constant folding\n\n");
TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD,
NULL, OpcAmlOpcodeUpdateWalk, NULL);
UtEndEvent (Event);
/* Calculate all AML package lengths */
Event = UtBeginEvent ("Generate AML package lengths");
DbgPrint (ASL_DEBUG_OUTPUT, "\nGenerating Package lengths\n\n");
TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL,
DbgPrint (ASL_DEBUG_OUTPUT, "Generating Package lengths\n\n");
TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, NULL,
LnPackageLengthWalk, NULL);
UtEndEvent (Event);
@ -254,7 +255,8 @@ CmDoCompile (
/* Namespace loading */
Event = UtBeginEvent ("Create ACPI Namespace");
Status = LdLoadNamespace (RootNode);
DbgPrint (ASL_DEBUG_OUTPUT, "Creating ACPI Namespace\n\n");
Status = LdLoadNamespace (Gbl_ParseTreeRoot);
UtEndEvent (Event);
if (ACPI_FAILURE (Status))
{
@ -263,7 +265,9 @@ CmDoCompile (
/* Namespace cross-reference */
AslGbl_NamespaceEvent = UtBeginEvent ("Cross reference parse tree and Namespace");
AslGbl_NamespaceEvent = UtBeginEvent (
"Cross reference parse tree and Namespace");
DbgPrint (ASL_DEBUG_OUTPUT, "Cross referencing namespace\n\n");
Status = XfCrossReferenceNamespace ();
if (ACPI_FAILURE (Status))
{
@ -275,6 +279,17 @@ CmDoCompile (
LkFindUnreferencedObjects ();
UtEndEvent (AslGbl_NamespaceEvent);
/* Resolve External Declarations */
if (Gbl_DoExternals)
{
Event = UtBeginEvent ("Resolve all Externals");
DbgPrint (ASL_DEBUG_OUTPUT, "\nResolve Externals\n\n");
TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_TWICE,
ExAmlExternalWalkBegin, ExAmlExternalWalkEnd, NULL);
UtEndEvent (Event);
}
/*
* Semantic analysis. This can happen only after the
* namespace has been loaded and cross-referenced.
@ -284,33 +299,50 @@ CmDoCompile (
Event = UtBeginEvent ("Analyze control method return types");
AnalysisWalkInfo.MethodStack = NULL;
DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - Method analysis\n\n");
TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE,
DbgPrint (ASL_DEBUG_OUTPUT, "Semantic analysis - Method analysis\n\n");
if (Gbl_CrossReferenceOutput)
{
OtPrintHeaders ("Part 1: Object Reference Map "
"(Object references from within each control method)");
}
TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_TWICE,
MtMethodAnalysisWalkBegin,
MtMethodAnalysisWalkEnd, &AnalysisWalkInfo);
UtEndEvent (Event);
/* Generate the object cross-reference file if requested */
Event = UtBeginEvent ("Generate cross-reference file");
OtCreateXrefFile ();
UtEndEvent (Event);
/* Semantic error checking part two - typing of method returns */
Event = UtBeginEvent ("Determine object types returned by methods");
DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - Method typing\n\n");
TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD,
DbgPrint (ASL_DEBUG_OUTPUT, "Semantic analysis - Method typing\n\n");
TrWalkParseTree (Gbl_ParseTreeRoot, 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_UPWARD,
NULL, AnOperandTypecheckWalkEnd, &AnalysisWalkInfo);
DbgPrint (ASL_DEBUG_OUTPUT,
"Semantic analysis - Operand type checking\n\n");
if (Gbl_DoTypechecking)
{
TrWalkParseTree (Gbl_ParseTreeRoot, 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_DOWNWARD,
DbgPrint (ASL_DEBUG_OUTPUT, "Semantic analysis - miscellaneous\n\n");
TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD,
AnOtherSemanticAnalysisWalkBegin,
NULL, &AnalysisWalkInfo);
UtEndEvent (Event);
@ -318,16 +350,17 @@ CmDoCompile (
/* Calculate all AML package lengths */
Event = UtBeginEvent ("Finish AML package length generation");
DbgPrint (ASL_DEBUG_OUTPUT, "\nGenerating Package lengths\n\n");
TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL,
DbgPrint (ASL_DEBUG_OUTPUT, "Generating Package lengths\n\n");
TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, NULL,
LnInitLengthsWalk, NULL);
TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL,
TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, NULL,
LnPackageLengthWalk, NULL);
UtEndEvent (Event);
/* Code generation - emit the AML */
Event = UtBeginEvent ("Generate AML code and write output files");
DbgPrint (ASL_DEBUG_OUTPUT, "Writing AML byte code\n\n");
CgGenerateAmlOutput ();
UtEndEvent (Event);
@ -587,8 +620,8 @@ CmDumpAllEvents (
{
ASL_EVENT_INFO *Event;
UINT32 Delta;
UINT32 USec;
UINT32 MSec;
UINT32 MicroSeconds;
UINT32 MilliSeconds;
UINT32 i;
@ -608,23 +641,23 @@ CmDumpAllEvents (
Delta = (UINT32) (Event->EndTime - Event->StartTime);
USec = Delta / ACPI_100NSEC_PER_USEC;
MSec = Delta / ACPI_100NSEC_PER_MSEC;
MicroSeconds = Delta / ACPI_100NSEC_PER_USEC;
MilliSeconds = Delta / ACPI_100NSEC_PER_MSEC;
/* Round milliseconds up */
if ((USec - (MSec * ACPI_USEC_PER_MSEC)) >= 500)
if ((MicroSeconds - (MilliSeconds * ACPI_USEC_PER_MSEC)) >= 500)
{
MSec++;
MilliSeconds++;
}
DbgPrint (ASL_DEBUG_OUTPUT, "%8u usec %8u msec - %s\n",
USec, MSec, Event->EventName);
MicroSeconds, MilliSeconds, Event->EventName);
if (Gbl_CompileTimesFlag)
{
printf ("%8u usec %8u msec - %s\n",
USec, MSec, Event->EventName);
MicroSeconds, MilliSeconds, Event->EventName);
}
}
@ -810,7 +843,7 @@ CmDeleteCaches (
Gbl_ParseOpCount = 0;
Gbl_ParseOpCacheNext = NULL;
Gbl_ParseOpCacheLast = NULL;
RootNode = NULL;
Gbl_ParseTreeRoot = NULL;
/* Generic string cache */

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -167,11 +167,7 @@ CmDeleteCaches (
* aslascii - ascii support
*/
ACPI_STATUS
FlCheckForAcpiTable (
FILE *Handle);
ACPI_STATUS
FlCheckForAscii (
FlIsFileAsciiSource (
char *Filename,
BOOLEAN DisplayErrors);
@ -291,6 +287,10 @@ ApFindNameInScope (
char *Name,
ACPI_PARSE_OBJECT *Op);
BOOLEAN
ApFindNameInDeviceTree (
char *Name,
ACPI_PARSE_OBJECT *Op);
/*
* aslerror - error handling/reporting
@ -541,6 +541,14 @@ OptOptimizeNamePath (
ACPI_NAMESPACE_NODE *TargetNode);
/*
* aslpld - ToPLD macro support
*/
void
OpcDoPld (
ACPI_PARSE_OBJECT *Op);
/*
* aslprintf - Printf/Fprintf macros
*/
@ -656,7 +664,13 @@ ApCheckPackage (
* asltransform - parse tree transformations
*/
ACPI_STATUS
TrAmlTransformWalk (
TrAmlTransformWalkBegin (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context);
ACPI_STATUS
TrAmlTransformWalkEnd (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context);
@ -673,6 +687,25 @@ TrWalkParseTree (
ASL_WALK_CALLBACK AscendingCallback,
void *Context);
/*
* aslexternal - External opcode support
*/
ACPI_STATUS
ExAmlExternalWalkBegin (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context);
ACPI_STATUS
ExAmlExternalWalkEnd (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context);
void
ExDoExternal (
ACPI_PARSE_OBJECT *Op);
/* Values for "Visitation" parameter above */
#define ASL_WALK_VISIT_DOWNWARD 0x01
@ -680,6 +713,11 @@ TrWalkParseTree (
#define ASL_WALK_VISIT_TWICE (ASL_WALK_VISIT_DOWNWARD | ASL_WALK_VISIT_UPWARD)
void
TrSetParent (
ACPI_PARSE_OBJECT *Op,
ACPI_PARSE_OBJECT *ParentOp);
ACPI_PARSE_OBJECT *
TrAllocateNode (
UINT32 ParseOpcode);
@ -740,6 +778,10 @@ void
TrSetEndLineNumber (
ACPI_PARSE_OBJECT *Op);
void
TrSetCurrentFilename (
ACPI_PARSE_OBJECT *Op);
void
TrWalkTree (
void);
@ -908,6 +950,24 @@ XfCrossReferenceNamespace (
void);
/*
* aslxrefout
*/
void
OtPrintHeaders (
char *Message);
void
OtCreateXrefFile (
void);
void
OtXrefWalkPart1 (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
ASL_METHOD_INFO *MethodInfo);
/*
* aslutils - common compiler utilites
*/
@ -923,6 +983,30 @@ DbgPrint (
#define ASL_PARSE_OUTPUT 1
#define ASL_TREE_OUTPUT 2
UINT8
UtIsBigEndianMachine (
void);
BOOLEAN
UtQueryForOverwrite (
char *Pathname);
void
UtDumpStringOp (
ACPI_PARSE_OBJECT *Op,
UINT32 Level);
void
UtDumpIntegerOp (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
UINT32 IntegerLength);
void
UtDumpBasicOp (
ACPI_PARSE_OBJECT *Op,
UINT32 Level);
void
UtDisplaySupportedTables (
void);
@ -943,11 +1027,6 @@ void *
UtLocalCalloc (
UINT32 Size);
void
UtPrintFormattedName (
UINT16 ParseOpcode,
UINT32 Level);
void
UtDisplaySummary (
UINT32 FileId);
@ -1002,12 +1081,6 @@ UINT64
UtDoConstant (
char *String);
ACPI_STATUS
stroul64 (
char *String,
UINT32 Base,
UINT64 *RetInteger);
/*
* asluuid - UUID support
@ -1281,6 +1354,6 @@ DtDoCompile(
ACPI_STATUS
DtCreateTemplates (
char *Signature);
char **argv);
#endif /* __ASLCOMPILER_H */

View File

@ -6,7 +6,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -156,6 +156,9 @@ NamePathTail [.]{NameSeg}
"^=" { count (3); return (PARSEOP_EXP_XOR_EQ); }
"|=" { count (3); return (PARSEOP_EXP_OR_EQ); }
"[" { count (3); return(PARSEOP_EXP_INDEX_LEFT); }
"]" { count (0); return(PARSEOP_EXP_INDEX_RIGHT); }
/*
* Begin standard ASL grammar
@ -207,7 +210,7 @@ NamePathTail [.]{NameSeg}
"Debug" { count (1); return (PARSEOP_DEBUG); }
"Decrement" { count (3); return (PARSEOP_DECREMENT); }
"Default" { count (3); return (PARSEOP_DEFAULT); }
"DefinitionBlock" { count (1); return (PARSEOP_DEFINITIONBLOCK); }
"DefinitionBlock" { count (1); return (PARSEOP_DEFINITION_BLOCK); }
"DeRefOf" { count (3); return (PARSEOP_DEREFOF); }
"Device" { count (2); return (PARSEOP_DEVICE); }
"Divide" { count (3); return (PARSEOP_DIVIDE); }
@ -329,6 +332,7 @@ NamePathTail [.]{NameSeg}
"GpioInt" { count (1); return (PARSEOP_GPIO_INT); }
"GpioIo" { count (1); return (PARSEOP_GPIO_IO); }
"I2cSerialBus" { count (1); return (PARSEOP_I2C_SERIALBUS); }
"I2cSerialBusV2" { count (1); return (PARSEOP_I2C_SERIALBUS_V2); }
"Interrupt" { count (1); return (PARSEOP_INTERRUPT); }
"IO" { count (1); return (PARSEOP_IO); }
"IRQ" { count (1); return (PARSEOP_IRQ); }
@ -341,9 +345,11 @@ NamePathTail [.]{NameSeg}
"QWordSpace" { count (1); return (PARSEOP_QWORDSPACE); }
"Register" { count (1); return (PARSEOP_REGISTER); }
"SpiSerialBus" { count (1); return (PARSEOP_SPI_SERIALBUS); }
"SpiSerialBusV2" { count (1); return (PARSEOP_SPI_SERIALBUS_V2); }
"StartDependentFn" { count (1); return (PARSEOP_STARTDEPENDENTFN); }
"StartDependentFnNoPri" { count (1); return (PARSEOP_STARTDEPENDENTFN_NOPRI); }
"UartSerialBus" { count (1); return (PARSEOP_UART_SERIALBUS); }
"UartSerialBusV2" { count (1); return (PARSEOP_UART_SERIALBUS_V2); }
"VendorLong" { count (1); return (PARSEOP_VENDORLONG); }
"VendorShort" { count (1); return (PARSEOP_VENDORSHORT); }
"WordBusNumber" { count (1); return (PARSEOP_WORDBUSNUMBER); }
@ -669,9 +675,14 @@ NamePathTail [.]{NameSeg}
/* printf debug macros */
"printf" { count (0); return (PARSEOP_PRINTF); }
"fprintf" { count (0); return (PARSEOP_FPRINTF); }
/* Other macros */
"For" { count (0); return (PARSEOP_FOR); }
/* Predefined compiler names */
"__DATE__" { count (0); return (PARSEOP___DATE__); }

View File

@ -0,0 +1,209 @@
NoEcho('
/******************************************************************************
*
* Module Name: aslcstyle.y - Production rules for symbolic operators
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2016, 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.
*/
')
/*******************************************************************************
*
* Production rules for the symbolic (c-style) operators
*
******************************************************************************/
/*
* ASL Extensions: C-style math/logical operators and expressions.
* The implementation transforms these operators into the standard
* AML opcodes and syntax.
*
* Supported operators and precedence rules (high-to-low)
*
* NOTE: The operator precedence and associativity rules are
* implemented by the tokens in asltokens.y
*
* (left-to-right):
* 1) ( ) expr++ expr--
*
* (right-to-left):
* 2) ! ~
*
* (left-to-right):
* 3) * / %
* 4) + -
* 5) >> <<
* 6) < > <= >=
* 7) == !=
* 8) &
* 9) ^
* 10) |
* 11) &&
* 12) ||
*
* (right-to-left):
* 13) = += -= *= /= %= <<= >>= &= ^= |=
*/
Expression
/* Unary operators */
: PARSEOP_EXP_LOGICAL_NOT {$<n>$ = TrCreateLeafNode (PARSEOP_LNOT);}
TermArg {$$ = TrLinkChildren ($<n>2,1,$3);}
| PARSEOP_EXP_NOT {$<n>$ = TrCreateLeafNode (PARSEOP_NOT);}
TermArg {$$ = TrLinkChildren ($<n>2,2,$3,TrCreateNullTarget ());}
| SuperName PARSEOP_EXP_INCREMENT {$<n>$ = TrCreateLeafNode (PARSEOP_INCREMENT);}
{$$ = TrLinkChildren ($<n>3,1,$1);}
| SuperName PARSEOP_EXP_DECREMENT {$<n>$ = TrCreateLeafNode (PARSEOP_DECREMENT);}
{$$ = TrLinkChildren ($<n>3,1,$1);}
/* Binary operators: math and logical */
| TermArg PARSEOP_EXP_ADD {$<n>$ = TrCreateLeafNode (PARSEOP_ADD);}
TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateNullTarget ());}
| TermArg PARSEOP_EXP_DIVIDE {$<n>$ = TrCreateLeafNode (PARSEOP_DIVIDE);}
TermArg {$$ = TrLinkChildren ($<n>3,4,$1,$4,TrCreateNullTarget (),
TrCreateNullTarget ());}
| TermArg PARSEOP_EXP_MODULO {$<n>$ = TrCreateLeafNode (PARSEOP_MOD);}
TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateNullTarget ());}
| TermArg PARSEOP_EXP_MULTIPLY {$<n>$ = TrCreateLeafNode (PARSEOP_MULTIPLY);}
TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateNullTarget ());}
| TermArg PARSEOP_EXP_SHIFT_LEFT {$<n>$ = TrCreateLeafNode (PARSEOP_SHIFTLEFT);}
TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateNullTarget ());}
| TermArg PARSEOP_EXP_SHIFT_RIGHT {$<n>$ = TrCreateLeafNode (PARSEOP_SHIFTRIGHT);}
TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateNullTarget ());}
| TermArg PARSEOP_EXP_SUBTRACT {$<n>$ = TrCreateLeafNode (PARSEOP_SUBTRACT);}
TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateNullTarget ());}
| TermArg PARSEOP_EXP_AND {$<n>$ = TrCreateLeafNode (PARSEOP_AND);}
TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateNullTarget ());}
| TermArg PARSEOP_EXP_OR {$<n>$ = TrCreateLeafNode (PARSEOP_OR);}
TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateNullTarget ());}
| TermArg PARSEOP_EXP_XOR {$<n>$ = TrCreateLeafNode (PARSEOP_XOR);}
TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateNullTarget ());}
| TermArg PARSEOP_EXP_GREATER {$<n>$ = TrCreateLeafNode (PARSEOP_LGREATER);}
TermArg {$$ = TrLinkChildren ($<n>3,2,$1,$4);}
| TermArg PARSEOP_EXP_GREATER_EQUAL {$<n>$ = TrCreateLeafNode (PARSEOP_LGREATEREQUAL);}
TermArg {$$ = TrLinkChildren ($<n>3,2,$1,$4);}
| TermArg PARSEOP_EXP_LESS {$<n>$ = TrCreateLeafNode (PARSEOP_LLESS);}
TermArg {$$ = TrLinkChildren ($<n>3,2,$1,$4);}
| TermArg PARSEOP_EXP_LESS_EQUAL {$<n>$ = TrCreateLeafNode (PARSEOP_LLESSEQUAL);}
TermArg {$$ = TrLinkChildren ($<n>3,2,$1,$4);}
| TermArg PARSEOP_EXP_EQUAL {$<n>$ = TrCreateLeafNode (PARSEOP_LEQUAL);}
TermArg {$$ = TrLinkChildren ($<n>3,2,$1,$4);}
| TermArg PARSEOP_EXP_NOT_EQUAL {$<n>$ = TrCreateLeafNode (PARSEOP_LNOTEQUAL);}
TermArg {$$ = TrLinkChildren ($<n>3,2,$1,$4);}
| TermArg PARSEOP_EXP_LOGICAL_AND {$<n>$ = TrCreateLeafNode (PARSEOP_LAND);}
TermArg {$$ = TrLinkChildren ($<n>3,2,$1,$4);}
| TermArg PARSEOP_EXP_LOGICAL_OR {$<n>$ = TrCreateLeafNode (PARSEOP_LOR);}
TermArg {$$ = TrLinkChildren ($<n>3,2,$1,$4);}
/* Parentheses */
| '(' TermArg ')' { $$ = $2;}
/* Index term -- "= BUF1[5]" on right-hand side of an equals (source) */
| SuperName PARSEOP_EXP_INDEX_LEFT TermArg PARSEOP_EXP_INDEX_RIGHT
{$$ = TrCreateLeafNode (PARSEOP_INDEX);
TrLinkChildren ($$,3,$1,$3,TrCreateNullTarget ());}
;
/* Index term -- "BUF1[5] = " on left-hand side of an equals (target) */
IndexExpTerm
: SuperName PARSEOP_EXP_INDEX_LEFT TermArg PARSEOP_EXP_INDEX_RIGHT
{$$ = TrCreateLeafNode (PARSEOP_INDEX);
TrLinkChildren ($$,3,$1,$3,TrCreateNullTarget ());}
;
EqualsTerm
/* All assignment-type operations */
: SuperName PARSEOP_EXP_EQUALS
TermArg {$$ = TrCreateAssignmentNode ($1, $3);}
| TermArg PARSEOP_EXP_ADD_EQ {$<n>$ = TrCreateLeafNode (PARSEOP_ADD);}
TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4,
TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));}
| TermArg PARSEOP_EXP_DIV_EQ {$<n>$ = TrCreateLeafNode (PARSEOP_DIVIDE);}
TermArg {$$ = TrLinkChildren ($<n>3,4,$1,$4,TrCreateNullTarget (),
TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));}
| TermArg PARSEOP_EXP_MOD_EQ {$<n>$ = TrCreateLeafNode (PARSEOP_MOD);}
TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4,
TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));}
| TermArg PARSEOP_EXP_MUL_EQ {$<n>$ = TrCreateLeafNode (PARSEOP_MULTIPLY);}
TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4,
TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));}
| TermArg PARSEOP_EXP_SHL_EQ {$<n>$ = TrCreateLeafNode (PARSEOP_SHIFTLEFT);}
TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4,
TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));}
| TermArg PARSEOP_EXP_SHR_EQ {$<n>$ = TrCreateLeafNode (PARSEOP_SHIFTRIGHT);}
TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4,
TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));}
| TermArg PARSEOP_EXP_SUB_EQ {$<n>$ = TrCreateLeafNode (PARSEOP_SUBTRACT);}
TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4,
TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));}
| TermArg PARSEOP_EXP_AND_EQ {$<n>$ = TrCreateLeafNode (PARSEOP_AND);}
TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4,
TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));}
| TermArg PARSEOP_EXP_OR_EQ {$<n>$ = TrCreateLeafNode (PARSEOP_OR);}
TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4,
TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));}
| TermArg PARSEOP_EXP_XOR_EQ {$<n>$ = TrCreateLeafNode (PARSEOP_XOR);}
TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4,
TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));}
;

View File

@ -0,0 +1,253 @@
/******************************************************************************
*
* Module Name: asldebug -- Debug output support
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2016, 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 <contrib/dev/acpica/compiler/aslcompiler.h>
#include "aslcompiler.y.h"
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("asldebug")
/* Local prototypes */
static void
UtDumpParseOpName (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
UINT32 DataLength);
/*******************************************************************************
*
* FUNCTION: UtDumpIntegerOp
*
* PARAMETERS: Op - Current parse op
* Level - Current output indentation level
* IntegerLength - Output length of the integer (2/4/8/16)
*
* RETURN: None
*
* DESCRIPTION: Emit formatted debug output for "integer" ops.
* Note: IntegerLength must be one of 2,4,8,16.
*
******************************************************************************/
void
UtDumpIntegerOp (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
UINT32 IntegerLength)
{
/* Emit the ParseOp name, leaving room for the integer */
UtDumpParseOpName (Op, Level, IntegerLength);
/* Emit the integer based upon length */
switch (IntegerLength)
{
case 2: /* Byte */
case 4: /* Word */
case 8: /* Dword */
DbgPrint (ASL_TREE_OUTPUT,
"%*.*X", IntegerLength, IntegerLength, Op->Asl.Value.Integer);
break;
case 16: /* Qword and Integer */
DbgPrint (ASL_TREE_OUTPUT,
"%8.8X%8.8X", ACPI_FORMAT_UINT64 (Op->Asl.Value.Integer));
break;
default:
break;
}
}
/*******************************************************************************
*
* FUNCTION: UtDumpStringOp
*
* PARAMETERS: Op - Current parse op
* Level - Current output indentation level
*
* RETURN: None
*
* DESCRIPTION: Emit formatted debug output for String/Pathname ops.
*
******************************************************************************/
void
UtDumpStringOp (
ACPI_PARSE_OBJECT *Op,
UINT32 Level)
{
char *String;
String = Op->Asl.Value.String;
if (Op->Asl.ParseOpcode != PARSEOP_STRING_LITERAL)
{
/*
* For the "path" ops NAMEPATH, NAMESEG, METHODCALL -- if the
* ExternalName is valid, it takes precedence. In these cases the
* Value.String is the raw "internal" name from the AML code, which
* we don't want to use, because it contains non-ascii characters.
*/
if (Op->Asl.ExternalName)
{
String = Op->Asl.ExternalName;
}
}
if (!String)
{
DbgPrint (ASL_TREE_OUTPUT,
" ERROR: Could not find a valid String/Path pointer\n");
return;
}
/* Emit the ParseOp name, leaving room for the string */
UtDumpParseOpName (Op, Level, strlen (String));
DbgPrint (ASL_TREE_OUTPUT, "%s", String);
}
/*******************************************************************************
*
* FUNCTION: UtDumpBasicOp
*
* PARAMETERS: Op - Current parse op
* Level - Current output indentation level
*
* RETURN: None
*
* DESCRIPTION: Generic formatted debug output for "basic" ops that have no
* associated strings or integer values.
*
******************************************************************************/
void
UtDumpBasicOp (
ACPI_PARSE_OBJECT *Op,
UINT32 Level)
{
/* Just print out the ParseOp name, there is no extra data */
UtDumpParseOpName (Op, Level, 0);
}
/*******************************************************************************
*
* FUNCTION: UtDumpParseOpName
*
* PARAMETERS: Op - Current parse op
* Level - Current output indentation level
* DataLength - Length of data to appear after the name
*
* RETURN: None
*
* DESCRIPTION: Indent and emit the ascii ParseOp name for the op
*
******************************************************************************/
static void
UtDumpParseOpName (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
UINT32 DataLength)
{
char *ParseOpName;
UINT32 IndentLength;
UINT32 NameLength;
UINT32 LineLength;
UINT32 PaddingLength;
/* Emit the LineNumber/IndentLevel prefix on each output line */
DbgPrint (ASL_TREE_OUTPUT,
"%5.5d [%2d]", Op->Asl.LogicalLineNumber, Level);
ParseOpName = UtGetOpName (Op->Asl.ParseOpcode);
/* Calculate various lengths for output alignment */
IndentLength = Level * DEBUG_SPACES_PER_INDENT;
NameLength = strlen (ParseOpName);
LineLength = IndentLength + 1 + NameLength + 1 + DataLength;
PaddingLength = (DEBUG_MAX_LINE_LENGTH + 1) - LineLength;
/* Parse tree indentation is based upon the nesting/indent level */
if (Level)
{
DbgPrint (ASL_TREE_OUTPUT, "%*s", IndentLength, " ");
}
/* Emit the actual name here */
DbgPrint (ASL_TREE_OUTPUT, " %s", ParseOpName);
/* Emit extra padding blanks for alignment of later data items */
if (LineLength > DEBUG_MAX_LINE_LENGTH)
{
/* Split a long line immediately after the ParseOpName string */
DbgPrint (ASL_TREE_OUTPUT, "\n%*s",
(DEBUG_FULL_LINE_LENGTH - DataLength), " ");
}
else
{
DbgPrint (ASL_TREE_OUTPUT, "%*s", PaddingLength, " ");
}
}

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -54,7 +54,7 @@
#define ASL_CREATOR_ID "INTL"
#define ASL_DEFINE "__IASL__"
#define ASL_COMPLIANCE "Supports ACPI Specification Revision 6.0"
#define ASL_COMPLIANCE "Supports ACPI Specification Revision 6.1"
/* Configuration constants */
@ -104,32 +104,12 @@
#define AML_DEFAULT_ARG_OP (UINT16) 0xDDDD
/* filename suffixes for output files */
#define FILE_SUFFIX_PREPROC_USER "i "
#define FILE_SUFFIX_PREPROCESSOR "pre"
#define FILE_SUFFIX_AML_CODE "aml"
#define FILE_SUFFIX_MAP "map"
#define FILE_SUFFIX_LISTING "lst"
#define FILE_SUFFIX_HEX_DUMP "hex"
#define FILE_SUFFIX_DEBUG "txt"
#define FILE_SUFFIX_SOURCE "src"
#define FILE_SUFFIX_NAMESPACE "nsp"
#define FILE_SUFFIX_ASM_SOURCE "asm"
#define FILE_SUFFIX_C_SOURCE "c"
#define FILE_SUFFIX_DISASSEMBLY "dsl"
#define FILE_SUFFIX_ASM_INCLUDE "inc"
#define FILE_SUFFIX_C_INCLUDE "h"
#define FILE_SUFFIX_ASL_CODE "asl"
#define FILE_SUFFIX_C_OFFSET "offset.h"
/* Types for input files */
#define ASL_INPUT_TYPE_BINARY 0
#define ASL_INPUT_TYPE_ACPI_TABLE 1
#define ASL_INPUT_TYPE_ASCII_ASL 2
#define ASL_INPUT_TYPE_ASCII_DATA 3
#define ASL_INPUT_TYPE_BINARY 0
#define ASL_INPUT_TYPE_BINARY_ACPI_TABLE 1
#define ASL_INPUT_TYPE_ASCII_ASL 2
#define ASL_INPUT_TYPE_ASCII_DATA 3
/* Misc */
@ -138,8 +118,7 @@
#define ASL_ABORT TRUE
#define ASL_NO_ABORT FALSE
#define ASL_EOF ACPI_UINT32_MAX
#define ASL_WITHIN_COMMENT (ACPI_UINT32_MAX -1)
#define ASL_BLANK_LINE (ACPI_UINT32_MAX -1)
#define ASL_IGNORE_LINE (ACPI_UINT32_MAX -1)
/* Listings */
@ -176,4 +155,34 @@
#define RsCreateQwordField(Op, Name, ByteOffset) \
RsCreateResourceField (Op, Name, ByteOffset, 0, 64);
/*
* Macros for debug output
*/
#define DEBUG_MAX_LINE_LENGTH 61
#define DEBUG_SPACES_PER_INDENT 3
#define DEBUG_FULL_LINE_LENGTH 71
#define ASL_PARSE_TREE_FULL_LINE "\n%71.71s"
/* Header/Trailer for original parse tree directly from the parser */
#define ASL_PARSE_TREE_HEADER1 \
"%*s Value P_Op Flags Line# End# LogL# EndL#\n", 65, " "
#define ASL_PARSE_TREE_DEBUG1 \
" %4.4X %8.8X %5d %5d %5d %5d"
/* Header/Trailer for processed parse tree used for AML generation */
#define ASL_PARSE_TREE_HEADER2 \
"%*s NameString Value P_Op A_Op OpLen PByts Len SubLen PSubLen OpPtr"\
" Parent Child Next Flags AcTyp Final Col"\
" Line# End# LogL# EndL#\n", 60, " "
#define ASL_PARSE_TREE_DEBUG2 \
" %08X %04X %04X %01X %04X %04X %05X %05X "\
"%08X %08X %08X %08X %08X %08X %04X %02d %5d %5d %5d %5d\n"
#endif /* ASLDEFINE.H */

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -267,8 +267,10 @@ AePrintException (
if (!Enode->SourceLine)
{
/* Use the merged header/source file if present, otherwise use input file */
/*
* Use the merged header/source file if present, otherwise
* use input file
*/
SourceFile = Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle;
if (!SourceFile)
{
@ -314,18 +316,18 @@ AePrintException (
fprintf (OutputFile, " %6u: ", Enode->LineNumber);
/*
* If not at EOF, get the corresponding source code line and
* display it. Don't attempt this if we have a premature EOF
* condition.
* If not at EOF, get the corresponding source code line
* and display it. Don't attempt this if we have a
* premature EOF condition.
*/
if (!PrematureEOF)
{
/*
* Seek to the offset in the combined source file, read
* the source line, and write it to the output.
* Seek to the offset in the combined source file,
* read the source line, and write it to the output.
*/
Actual = fseek (SourceFile, (long) Enode->LogicalByteOffset,
(int) SEEK_SET);
Actual = fseek (SourceFile,
(long) Enode->LogicalByteOffset, (int) SEEK_SET);
if (Actual)
{
fprintf (OutputFile,
@ -880,16 +882,17 @@ AslCoreSubsystemError (
if (Op)
{
AslCommonError (ASL_ERROR, ASL_MSG_CORE_EXCEPTION, Op->Asl.LineNumber,
Op->Asl.LogicalLineNumber,
Op->Asl.LogicalByteOffset,
Op->Asl.Column,
Op->Asl.Filename, MsgBuffer);
AslCommonError (ASL_ERROR, ASL_MSG_CORE_EXCEPTION,
Op->Asl.LineNumber,
Op->Asl.LogicalLineNumber,
Op->Asl.LogicalByteOffset,
Op->Asl.Column,
Op->Asl.Filename, MsgBuffer);
}
else
{
AslCommonError (ASL_ERROR, ASL_MSG_CORE_EXCEPTION, 0,
0, 0, 0, NULL, MsgBuffer);
AslCommonError (ASL_ERROR, ASL_MSG_CORE_EXCEPTION,
0, 0, 0, 0, NULL, MsgBuffer);
}
if (Abort)

View File

@ -0,0 +1,498 @@
/******************************************************************************
*
* Module Name: aslexternal - ASL External opcode compiler support
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2016, 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 <contrib/dev/acpica/compiler/aslcompiler.h>
#include "aslcompiler.y.h"
#include <contrib/dev/acpica/include/acparser.h>
#include <contrib/dev/acpica/include/amlcode.h>
#include <contrib/dev/acpica/include/acnamesp.h>
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslexternal")
/* Local prototypes */
static void
ExInsertArgCount (
ACPI_PARSE_OBJECT *Op);
static void
ExMoveExternals (
ACPI_PARSE_OBJECT *DefinitionBlockOp);
/*******************************************************************************
*
* FUNCTION: ExDoExternal
*
* PARAMETERS: Op - Current Parse node
*
* RETURN: None
*
* DESCRIPTION: Add an External() definition to the global list. This list
* is used to generate External opcodes.
*
******************************************************************************/
void
ExDoExternal (
ACPI_PARSE_OBJECT *Op)
{
ACPI_PARSE_OBJECT *ListOp;
ACPI_PARSE_OBJECT *Prev;
ACPI_PARSE_OBJECT *Next;
ACPI_PARSE_OBJECT *ArgCountOp;
ArgCountOp = Op->Asl.Child->Asl.Next->Asl.Next;
ArgCountOp->Asl.AmlOpcode = AML_RAW_DATA_BYTE;
ArgCountOp->Asl.ParseOpcode = PARSEOP_BYTECONST;
ArgCountOp->Asl.Value.Integer = 0;
UtSetParseOpName (ArgCountOp);
/* Create new list node of arbitrary type */
ListOp = TrAllocateNode (PARSEOP_DEFAULT_ARG);
/* Store External node as child */
ListOp->Asl.Child = Op;
ListOp->Asl.Next = NULL;
if (Gbl_ExternalsListHead)
{
/* Link new External to end of list */
Prev = Gbl_ExternalsListHead;
Next = Prev;
while (Next)
{
Prev = Next;
Next = Next->Asl.Next;
}
Prev->Asl.Next = ListOp;
}
else
{
Gbl_ExternalsListHead = ListOp;
}
}
/*******************************************************************************
*
* FUNCTION: ExInsertArgCount
*
* PARAMETERS: Op - Op for a method invocation
*
* RETURN: None
*
* DESCRIPTION: Obtain the number of arguments for a control method -- from
* the actual invocation.
*
******************************************************************************/
static void
ExInsertArgCount (
ACPI_PARSE_OBJECT *Op)
{
ACPI_PARSE_OBJECT *Next;
ACPI_PARSE_OBJECT *NameOp;
ACPI_PARSE_OBJECT *Child;
ACPI_PARSE_OBJECT *ArgCountOp;
char * ExternalName;
char * CallName;
UINT16 ArgCount = 0;
ACPI_STATUS Status;
CallName = AcpiNsGetNormalizedPathname (Op->Asl.Node, TRUE);
Next = Gbl_ExternalsListHead;
while (Next)
{
ArgCount = 0;
/* Skip if External node already handled */
if (Next->Asl.Child->Asl.CompileFlags & NODE_VISITED)
{
Next = Next->Asl.Next;
continue;
}
NameOp = Next->Asl.Child->Asl.Child;
ExternalName = AcpiNsGetNormalizedPathname (NameOp->Asl.Node, TRUE);
if (strcmp (CallName, ExternalName))
{
ACPI_FREE (ExternalName);
Next = Next->Asl.Next;
continue;
}
Next->Asl.Child->Asl.CompileFlags |= NODE_VISITED;
/*
* Since we will reposition Externals to the Root, set Namepath
* to the fully qualified name and recalculate the aml length
*/
Status = UtInternalizeName (ExternalName,
&NameOp->Asl.Value.String);
ACPI_FREE (ExternalName);
if (ACPI_FAILURE (Status))
{
AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL,
NULL, "- Could not Internalize External");
break;
}
NameOp->Asl.AmlLength = strlen (NameOp->Asl.Value.String);
/* Get argument count */
Child = Op->Asl.Child;
while (Child)
{
ArgCount++;
Child = Child->Asl.Next;
}
/* Setup ArgCount operand */
ArgCountOp = Next->Asl.Child->Asl.Child->Asl.Next->Asl.Next;
ArgCountOp->Asl.Value.Integer = ArgCount;
break;
}
ACPI_FREE (CallName);
}
/*******************************************************************************
*
* FUNCTION: ExAmlExternalWalkBegin
*
* PARAMETERS: ASL_WALK_CALLBACK
*
* RETURN: None
*
* DESCRIPTION: Parse tree walk to create external opcode list for methods.
*
******************************************************************************/
ACPI_STATUS
ExAmlExternalWalkBegin (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context)
{
/* External list head saved in the definition block op */
if (Op->Asl.ParseOpcode == PARSEOP_DEFINITION_BLOCK)
{
Gbl_ExternalsListHead = Op->Asl.Value.Arg;
}
if (!Gbl_ExternalsListHead)
{
return (AE_OK);
}
if (Op->Asl.ParseOpcode != PARSEOP_METHODCALL)
{
return (AE_OK);
}
/*
* The NameOp child under an ExternalOp gets turned into PARSE_METHODCALL
* by XfNamespaceLocateBegin(). Ignore these.
*/
if (Op->Asl.Parent &&
Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_EXTERNAL)
{
return (AE_OK);
}
ExInsertArgCount (Op);
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: ExAmlExternalWalkEnd
*
* PARAMETERS: ASL_WALK_CALLBACK
*
* RETURN: None
*
* DESCRIPTION: Parse tree walk to create external opcode list for methods.
* Here, we just want to catch the case where a definition block
* has been completed. Then we move all of the externals into
* a single block in the parse tree and thus the AML code.
*
******************************************************************************/
ACPI_STATUS
ExAmlExternalWalkEnd (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context)
{
if (Op->Asl.ParseOpcode == PARSEOP_DEFINITION_BLOCK)
{
/*
* Process any existing external list. (Support for
* multiple definition blocks in a single file/compile)
*/
ExMoveExternals (Op);
Gbl_ExternalsListHead = NULL;
}
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: ExMoveExternals
*
* PARAMETERS: DefinitionBlockOp - Op for current definition block
*
* RETURN: None
*
* DESCRIPTION: Move all externals present in the source file into a single
* block of AML code, surrounded by an "If (0)" to prevent
* AML interpreters from attempting to execute the External
* opcodes.
*
******************************************************************************/
static void
ExMoveExternals (
ACPI_PARSE_OBJECT *DefinitionBlockOp)
{
ACPI_PARSE_OBJECT *ParentOp;
ACPI_PARSE_OBJECT *ExternalOp;
ACPI_PARSE_OBJECT *PredicateOp;
ACPI_PARSE_OBJECT *NextOp;
ACPI_PARSE_OBJECT *Prev;
ACPI_PARSE_OBJECT *Next;
ACPI_OBJECT_TYPE ObjType;
UINT32 i;
if (!Gbl_ExternalsListHead)
{
return;
}
/* Remove the External nodes from the tree */
NextOp = Gbl_ExternalsListHead;
while (NextOp)
{
/*
* The External is stored in child pointer of each node in the
* list
*/
ExternalOp = NextOp->Asl.Child;
/* Set line numbers (for listings, etc.) */
ExternalOp->Asl.LineNumber = 0;
ExternalOp->Asl.LogicalLineNumber = 0;
Next = ExternalOp->Asl.Child;
Next->Asl.LineNumber = 0;
Next->Asl.LogicalLineNumber = 0;
Next = Next->Asl.Next;
Next->Asl.LineNumber = 0;
Next->Asl.LogicalLineNumber = 0;
Next = Next->Asl.Next;
Next->Asl.LineNumber = 0;
Next->Asl.LogicalLineNumber = 0;
Next = Next->Asl.Next;
Next->Asl.LineNumber = 0;
Next->Asl.LogicalLineNumber = 0;
ParentOp = ExternalOp->Asl.Parent;
Prev = Next = ParentOp->Asl.Child;
/* Now find the External node's position in parse tree */
while (Next != ExternalOp)
{
Prev = Next;
Next = Next->Asl.Next;
}
/* Remove the External from the parse tree */
if (Prev == ExternalOp)
{
/* External was the first child node */
ParentOp->Asl.Child = ExternalOp->Asl.Next;
}
Prev->Asl.Next = ExternalOp->Asl.Next;
ExternalOp->Asl.Next = NULL;
ExternalOp->Asl.Parent = Gbl_ExternalsListHead;
/* Point the External to the next in the list */
if (NextOp->Asl.Next)
{
ExternalOp->Asl.Next = NextOp->Asl.Next->Asl.Child;
}
NextOp = NextOp->Asl.Next;
}
/*
* Loop again to remove MethodObj Externals for which
* a MethodCall was not found (dead external reference)
*/
Prev = Gbl_ExternalsListHead->Asl.Child;
Next = Prev;
while (Next)
{
ObjType = (ACPI_OBJECT_TYPE)
Next->Asl.Child->Asl.Next->Asl.Value.Integer;
if (ObjType == ACPI_TYPE_METHOD &&
!(Next->Asl.CompileFlags & NODE_VISITED))
{
if (Next == Prev)
{
Gbl_ExternalsListHead->Asl.Child = Next->Asl.Next;
Next->Asl.Next = NULL;
Prev = Gbl_ExternalsListHead->Asl.Child;
Next = Prev;
continue;
}
else
{
Prev->Asl.Next = Next->Asl.Next;
Next->Asl.Next = NULL;
Next = Prev->Asl.Next;
continue;
}
}
Prev = Next;
Next = Next->Asl.Next;
}
/* If list is now empty, don't bother to make If (0) block */
if (!Gbl_ExternalsListHead->Asl.Child)
{
return;
}
/* Convert Gbl_ExternalsListHead parent to If(). */
Gbl_ExternalsListHead->Asl.ParseOpcode = PARSEOP_IF;
Gbl_ExternalsListHead->Asl.AmlOpcode = AML_IF_OP;
Gbl_ExternalsListHead->Asl.CompileFlags = NODE_AML_PACKAGE;
UtSetParseOpName (Gbl_ExternalsListHead);
/* Create a Zero op for the If predicate */
PredicateOp = TrAllocateNode (PARSEOP_ZERO);
PredicateOp->Asl.AmlOpcode = AML_ZERO_OP;
PredicateOp->Asl.Parent = Gbl_ExternalsListHead;
PredicateOp->Asl.Child = NULL;
PredicateOp->Asl.Next = Gbl_ExternalsListHead->Asl.Child;
Gbl_ExternalsListHead->Asl.Child = PredicateOp;
/* Set line numbers (for listings, etc.) */
Gbl_ExternalsListHead->Asl.LineNumber = 0;
Gbl_ExternalsListHead->Asl.LogicalLineNumber = 0;
PredicateOp->Asl.LineNumber = 0;
PredicateOp->Asl.LogicalLineNumber = 0;
/* Insert block back in the list */
Prev = DefinitionBlockOp->Asl.Child;
Next = Prev;
/* Find last default arg */
for (i = 0; i < 6; i++)
{
Prev = Next;
Next = Prev->Asl.Next;
}
if (Next)
{
/* Definition Block is not empty */
Gbl_ExternalsListHead->Asl.Next = Next;
}
else
{
/* Definition Block is empty. */
Gbl_ExternalsListHead->Asl.Next = NULL;
}
Prev->Asl.Next = Gbl_ExternalsListHead;
Gbl_ExternalsListHead->Asl.Parent = Prev->Asl.Parent;
}

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -70,6 +70,7 @@ FlFileError (
sprintf (MsgBuffer, "\"%s\" (%s) - %s", Gbl_Files[FileId].Filename,
Gbl_Files[FileId].Description, strerror (errno));
AslCommonError (ASL_ERROR, ErrorId, 0, 0, 0, 0, NULL, MsgBuffer);
}
@ -269,7 +270,8 @@ FlPrintFile (
AslAbort ();
}
if ((FileId == ASL_FILE_PREPROCESSOR) && Gbl_PreprocessorOutputFlag)
if ((FileId == ASL_FILE_PREPROCESSOR) &&
Gbl_PreprocessorOutputFlag)
{
/*
* Duplicate the output to the user preprocessor (.i) file,
@ -291,7 +293,6 @@ FlPrintFile (
AslAbort ();
}
}
}

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -56,7 +56,6 @@ FlOpenIncludeWithPrefix (
ACPI_PARSE_OBJECT *Op,
char *Filename);
#ifdef ACPI_OBSOLETE_FUNCTIONS
ACPI_STATUS
FlParseInputPathname (
@ -262,7 +261,8 @@ FlMergePathnames (
/* Build the final merged pathname */
ConcatenatePaths:
Pathname = UtStringCacheCalloc (strlen (CommonPath) + strlen (FilePathname) + 2);
Pathname = UtStringCacheCalloc (
strlen (CommonPath) + strlen (FilePathname) + 2);
if (LastElement && *CommonPath)
{
strcpy (Pathname, CommonPath);
@ -336,6 +336,7 @@ FlOpenIncludeWithPrefix (
*/
Gbl_CurrentLineNumber--;
OriginalLineNumber = Gbl_CurrentLineNumber;
while (DtGetNextLine (IncludeFile, DT_ALLOW_MULTILINE_QUOTES) != ASL_EOF)
{
if (Gbl_CurrentLineBuffer[0] == '#')
@ -344,6 +345,7 @@ FlOpenIncludeWithPrefix (
Op, "use #include instead");
}
}
Gbl_CurrentLineNumber = OriginalLineNumber;
/* Must seek back to the start of the file */
@ -422,7 +424,8 @@ FlOpenIncludeFile (
*
* Construct the file pathname from the global directory name.
*/
IncludeFile = FlOpenIncludeWithPrefix (Gbl_DirectoryPath, Op, Op->Asl.Value.String);
IncludeFile = FlOpenIncludeWithPrefix (
Gbl_DirectoryPath, Op, Op->Asl.Value.String);
if (IncludeFile)
{
return;
@ -435,7 +438,8 @@ FlOpenIncludeFile (
NextDir = Gbl_IncludeDirList;
while (NextDir)
{
IncludeFile = FlOpenIncludeWithPrefix (NextDir->Dir, Op, Op->Asl.Value.String);
IncludeFile = FlOpenIncludeWithPrefix (
NextDir->Dir, Op, Op->Asl.Value.String);
if (IncludeFile)
{
return;
@ -568,7 +572,7 @@ FlOpenMiscOutputFiles (
/* All done for disassembler */
if (Gbl_FileType == ASL_INPUT_TYPE_ACPI_TABLE)
if (Gbl_FileType == ASL_INPUT_TYPE_BINARY_ACPI_TABLE)
{
return (AE_OK);
}
@ -629,6 +633,24 @@ FlOpenMiscOutputFiles (
AslCompilerFileHeader (ASL_FILE_DEBUG_OUTPUT);
}
/* Create/Open a cross-reference output file if asked */
if (Gbl_CrossReferenceOutput)
{
Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_XREF);
if (!Filename)
{
AslCommonError (ASL_ERROR, ASL_MSG_DEBUG_FILENAME,
0, 0, 0, 0, NULL, NULL);
return (AE_ERROR);
}
FlOpenFile (ASL_FILE_XREF_OUTPUT, Filename, "w+t");
AslCompilerSignon (ASL_FILE_XREF_OUTPUT);
AslCompilerFileHeader (ASL_FILE_XREF_OUTPUT);
}
/* Create/Open a listing output file if asked */
if (Gbl_ListingFlag)

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -100,7 +100,8 @@ TrInstallReducedConstant (
*
* RETURN: Status
*
* DESCRIPTION: Reduce an Op and its subtree to a constant if possible
* DESCRIPTION: Reduce an Op and its subtree to a constant if possible.
* Called during ascent of the parse tree.
*
******************************************************************************/
@ -192,9 +193,7 @@ OpcAmlConstantWalk (
OpcUpdateIntegerNode (Op, 0);
}
/* Abort the walk of this subtree, we are done with it */
return (AE_CTRL_DEPTH);
return (AE_OK);
}
@ -206,7 +205,8 @@ OpcAmlConstantWalk (
*
* RETURN: Status
*
* DESCRIPTION: Check one Op for a type 3/4/5 AML opcode
* DESCRIPTION: Check one Op for a reducible type 3/4/5 AML opcode.
* This is performed via an upward walk of the parse subtree.
*
******************************************************************************/
@ -218,6 +218,8 @@ OpcAmlCheckForConstant (
{
ACPI_WALK_STATE *WalkState = Context;
ACPI_STATUS Status = AE_OK;
ACPI_PARSE_OBJECT *NextOp;
const ACPI_OPCODE_INFO *OpInfo;
WalkState->Op = Op;
@ -227,21 +229,6 @@ OpcAmlCheckForConstant (
DbgPrint (ASL_PARSE_OUTPUT, "[%.4d] Opcode: %12.12s ",
Op->Asl.LogicalLineNumber, Op->Asl.ParseOpName);
/*
* TBD: Ignore buffer constants for now. The problem is that these
* constants have been transformed into RAW_DATA at this point, from
* the parse tree transform process which currently happens before
* the constant folding process. We may need to defer this transform
* for buffer until after the constant folding.
*/
if (WalkState->Opcode == AML_BUFFER_OP)
{
DbgPrint (ASL_PARSE_OUTPUT,
"\nBuffer+Buffer->Buffer constant reduction is not supported yet");
Status = AE_TYPE;
goto CleanupAndExit;
}
/*
* These opcodes do not appear in the OpcodeInfo table, but
* they represent constants, so abort the constant walk now.
@ -256,11 +243,95 @@ OpcAmlCheckForConstant (
goto CleanupAndExit;
}
/*
* Search upwards for a possible Name() operator. This is done
* because a type 3/4/5 opcode within a Name() expression
* MUST be reduced to a simple constant.
*/
NextOp = Op->Asl.Parent;
while (NextOp)
{
/* Finished if we find a Name() opcode */
if (NextOp->Asl.AmlOpcode == AML_NAME_OP)
{
break;
}
/*
* Any "deferred" opcodes contain one or more TermArg parameters,
* and thus are not required to be folded to constants at compile
* time. This affects things like Buffer() and Package() objects.
* We just ignore them here. However, any sub-expressions can and
* will still be typechecked. Note: These are called the
* "deferred" opcodes in the AML interpreter.
*/
OpInfo = AcpiPsGetOpcodeInfo (NextOp->Common.AmlOpcode);
if (OpInfo->Flags & AML_DEFER)
{
NextOp = NULL;
break;
}
NextOp = NextOp->Asl.Parent;
}
/* Type 3/4/5 opcodes have the AML_CONSTANT flag set */
if (!(WalkState->OpInfo->Flags & AML_CONSTANT))
{
/* Not 3/4/5 opcode, but maybe can convert to STORE */
/*
* From the ACPI specification:
*
* "The Type 3/4/5 opcodes return a value and can be used in an
* expression that evaluates to a constant. These opcodes may be
* evaluated at ASL compile-time. To ensure that these opcodes
* will evaluate to a constant, the following rules apply: The
* term cannot have a destination (target) operand, and must have
* either a Type3Opcode, Type4Opcode, Type5Opcode, ConstExprTerm,
* Integer, BufferTerm, Package, or String for all arguments."
*/
/*
* The value (second) operand for the Name() operator MUST
* reduce to a single constant, as per the ACPI specification
* (the operand is a DataObject). This also implies that there
* can be no target operand. Name() is the only ASL operator
* with a "DataObject" as an operand and is thus special-
* cased here.
*/
if (NextOp) /* Inspect a Name() operator */
{
/* Error if there is a target operand */
if (Op->Asl.CompileFlags & NODE_IS_TARGET)
{
AslError (ASL_ERROR, ASL_MSG_INVALID_TARGET, Op, NULL);
Status = AE_TYPE;
}
/* Error if expression cannot be reduced (folded) */
if (!(NextOp->Asl.CompileFlags & NODE_COULD_NOT_REDUCE))
{
/* Ensure only one error message per statement */
NextOp->Asl.CompileFlags |= NODE_COULD_NOT_REDUCE;
DbgPrint (ASL_PARSE_OUTPUT,
"**** Could not reduce operands for NAME opcode ****\n");
AslError (ASL_ERROR, ASL_MSG_CONSTANT_REQUIRED, Op,
"Constant is required for Name operator");
Status = AE_TYPE;
}
}
if (ACPI_FAILURE (Status))
{
goto CleanupAndExit;
}
/* This is not a 3/4/5 opcode, but maybe can convert to STORE */
if (Op->Asl.CompileFlags & NODE_IS_TARGET)
{
@ -272,13 +343,35 @@ OpcAmlCheckForConstant (
/* Expression cannot be reduced */
DbgPrint (ASL_PARSE_OUTPUT,
"**** Not a Type 3/4/5 opcode (%s) ****",
"**** Not a Type 3/4/5 opcode or cannot reduce/fold (%s) ****\n",
Op->Asl.ParseOpName);
Status = AE_TYPE;
goto CleanupAndExit;
}
/*
* TBD: Ignore buffer constants for now. The problem is that these
* constants have been transformed into RAW_DATA at this point, from
* the parse tree transform process which currently happens before
* the constant folding process. We may need to defer this transform
* for buffer until after the constant folding.
*/
if (WalkState->Opcode == AML_BUFFER_OP)
{
DbgPrint (ASL_PARSE_OUTPUT,
"\nBuffer constant reduction is not supported yet\n");
if (NextOp) /* Found a Name() operator, error */
{
AslError (ASL_ERROR, ASL_MSG_UNSUPPORTED, Op,
"Buffer expression cannot be reduced");
}
Status = AE_TYPE;
goto CleanupAndExit;
}
/* Debug output */
DbgPrint (ASL_PARSE_OUTPUT, "TYPE_345");
@ -294,6 +387,7 @@ OpcAmlCheckForConstant (
DbgPrint (ASL_PARSE_OUTPUT, "%-16s", " VALID TARGET");
}
}
if (Op->Asl.CompileFlags & NODE_IS_TERM_ARG)
{
DbgPrint (ASL_PARSE_OUTPUT, "%-16s", " TERMARG");
@ -423,9 +517,6 @@ TrTransformToStoreOp (
ACPI_STATUS Status;
DbgPrint (ASL_PARSE_OUTPUT,
"Reduction/Transform to StoreOp: Store(Constant, Target)\n");
/* Extract the operands */
Child1 = Op->Asl.Child;
@ -447,6 +538,10 @@ TrTransformToStoreOp (
}
}
DbgPrint (ASL_PARSE_OUTPUT,
"Reduction/Transform to StoreOp: Store(%s, %s)\n",
Child1->Asl.ParseOpName, Child2->Asl.ParseOpName);
/*
* Create a NULL (zero) target so that we can use the
* interpreter to evaluate the expression.

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -83,7 +83,8 @@ ASL_FILE_INFO Gbl_Files [ASL_NUM_FILES] =
{NULL, NULL, "ASM Include: ", "Assembly Header Output"},
{NULL, NULL, "C Include: ", "C Header Output"},
{NULL, NULL, "Offset Table: ", "C Offset Table Output"},
{NULL, NULL, "Device Map: ", "Device Map Output"}
{NULL, NULL, "Device Map: ", "Device Map Output"},
{NULL, NULL, "Cross Ref: ", "Cross-reference Output"}
};
#else
@ -149,6 +150,7 @@ ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NsOutputFlag, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_PreprocessorOutputFlag, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_KeepPreprocessorTempFile, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DebugFlag, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_CrossReferenceOutput, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_AsmOutputFlag, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_C_OutputFlag, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_C_OffsetTableFlag, FALSE);
@ -177,6 +179,9 @@ ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoTemplates, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_CompileGeneric, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_AllExceptionsDisabled, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_PruneParseTree, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoTypechecking, TRUE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_EnableReferenceTypechecking, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoExternals, TRUE);
#define HEX_OUTPUT_NONE 0
@ -195,6 +200,7 @@ ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_OutputFilenamePrefix,
ASL_EXTERN ASL_INCLUDE_DIR ASL_INIT_GLOBAL (*Gbl_IncludeDirList, NULL);
ASL_EXTERN char *Gbl_CurrentInputFilename;
ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_ExternalRefFilename, NULL);
ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_PreviousIncludeFilename, NULL);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_HasIncludeFiles, FALSE);
@ -237,14 +243,15 @@ ASL_EXTERN ACPI_SERIAL_INFO ASL_INIT_GLOBAL (*Gbl_SerialList, NULL);
ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_RevisionOverride, 0);
ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_TempCount, 0);
ASL_EXTERN ACPI_PARSE_OBJECT ASL_INIT_GLOBAL (*RootNode, NULL);
ASL_EXTERN ACPI_PARSE_OBJECT ASL_INIT_GLOBAL (*Gbl_ParseTreeRoot, NULL);
ASL_EXTERN ACPI_PARSE_OBJECT ASL_INIT_GLOBAL (*Gbl_ExternalsListHead, NULL);
ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_TableLength, 0);
ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_SourceLine, 0);
ASL_EXTERN ASL_LISTING_NODE ASL_INIT_GLOBAL (*Gbl_ListingNode, NULL);
ASL_EXTERN ACPI_PARSE_OBJECT *Gbl_FirstLevelInsertionNode;
ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_FileType, 0);
ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_Signature, NULL);
ASL_EXTERN char *Gbl_TemplateSignature;
ASL_EXTERN ACPI_PARSE_OBJECT *Gbl_FirstLevelInsertionNode;
ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentHexColumn, 0);
ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentAmlOffset, 0);
@ -266,7 +273,7 @@ ASL_EXTERN ACPI_TABLE_HEADER TableHeader;
/* Event timing */
#define ASL_NUM_EVENTS 20
#define ASL_NUM_EVENTS 24
ASL_EXTERN ASL_EVENT_INFO AslGbl_Events[ASL_NUM_EVENTS];
ASL_EXTERN UINT8 AslGbl_NextEvent;
ASL_EXTERN UINT8 AslGbl_NamespaceEvent;

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -50,7 +50,6 @@
* This module emits ASCII hex output files in either C, ASM, or ASL format
*/
/* Local prototypes */
static void
@ -223,6 +222,7 @@ HxDoHexOutputC (
FlPrintFile (ASL_FILE_HEX_OUTPUT, " /* %8.8X", Offset);
LsDumpAsciiInComment (ASL_FILE_HEX_OUTPUT, LineLength, FileData);
FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s*/\n",
HEX_TABLE_LINE_SIZE - LineLength + 1, " ");
@ -310,6 +310,7 @@ HxDoHexOutputAsl (
FlPrintFile (ASL_FILE_HEX_OUTPUT, " /* %8.8X", Offset);
LsDumpAsciiInComment (ASL_FILE_HEX_OUTPUT, LineLength, FileData);
FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s*/\n",
HEX_TABLE_LINE_SIZE - LineLength + 1, " ");
@ -393,6 +394,7 @@ HxDoHexOutputAsm (
FlPrintFile (ASL_FILE_HEX_OUTPUT, " ; %8.8X", Offset);
LsDumpAsciiInComment (ASL_FILE_HEX_OUTPUT, LineLength, FileData);
FlPrintFile (ASL_FILE_HEX_OUTPUT, "\n");
Offset += LineLength;

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -132,10 +132,11 @@ LnPackageLengthWalk (
if ((Op->Asl.Parent) &&
(Op->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG))
{
Op->Asl.Parent->Asl.AmlSubtreeLength += (Op->Asl.AmlLength +
Op->Asl.AmlOpcodeLength +
Op->Asl.AmlPkgLenBytes +
Op->Asl.AmlSubtreeLength);
Op->Asl.Parent->Asl.AmlSubtreeLength += (
Op->Asl.AmlLength +
Op->Asl.AmlOpcodeLength +
Op->Asl.AmlPkgLenBytes +
Op->Asl.AmlSubtreeLength);
}
return (AE_OK);
}
@ -229,7 +230,7 @@ CgGenerateAmlOpcodeLength (
if (Op->Asl.CompileFlags & NODE_AML_PACKAGE)
{
Op->Asl.AmlPkgLenBytes = CgGetPackageLenByteCount (
Op, Op->Asl.AmlSubtreeLength);
Op, Op->Asl.AmlSubtreeLength);
}
/* Data opcode lengths are easy */
@ -332,10 +333,9 @@ CgGenerateAmlLengths (
switch (Op->Asl.ParseOpcode)
{
case PARSEOP_DEFINITIONBLOCK:
case PARSEOP_DEFINITION_BLOCK:
Gbl_TableLength = sizeof (ACPI_TABLE_HEADER) +
Op->Asl.AmlSubtreeLength;
Gbl_TableLength = sizeof (ACPI_TABLE_HEADER) + Op->Asl.AmlSubtreeLength;
break;
case PARSEOP_NAMESEG:
@ -365,7 +365,6 @@ CgGenerateAmlLengths (
Op->Asl.ExternalName = Op->Asl.Value.String;
Op->Asl.Value.String = Buffer;
Op->Asl.CompileFlags |= NODE_NAME_INTERNALIZED;
Op->Asl.AmlLength = strlen (Buffer);
/*
@ -391,7 +390,7 @@ CgGenerateAmlLengths (
Op->Asl.AmlOpcodeLength = 0;
Op->Asl.AmlPkgLenBytes = CgGetPackageLenByteCount (Op,
(UINT32) Op->Asl.Value.Integer);
(UINT32) Op->Asl.Value.Integer);
break;
case PARSEOP_RAW_DATA:
@ -400,7 +399,6 @@ CgGenerateAmlLengths (
break;
case PARSEOP_DEFAULT_ARG:
case PARSEOP_EXTERNAL:
case PARSEOP_INCLUDE:
case PARSEOP_INCLUDE_END:
@ -408,6 +406,14 @@ CgGenerateAmlLengths (
break;
case PARSEOP_EXTERNAL:
if (Gbl_DoExternals == TRUE)
{
CgGenerateAmlOpcodeLength (Op);
}
break;
default:
CgGenerateAmlOpcodeLength (Op);

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -163,16 +163,16 @@ LsGenerateListing (
LsDoOffsetTableHeader (FileId);
TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, LsAmlOffsetWalk,
NULL, (void *) ACPI_TO_POINTER (FileId));
TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD,
LsAmlOffsetWalk, NULL, (void *) ACPI_TO_POINTER (FileId));
LsDoOffsetTableFooter (FileId);
return;
}
/* Process all parse nodes */
TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, LsAmlListingWalk,
NULL, (void *) ACPI_TO_POINTER (FileId));
TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD,
LsAmlListingWalk, NULL, (void *) ACPI_TO_POINTER (FileId));
/* Final processing */
@ -212,6 +212,12 @@ LsAmlListingWalk (
return (AE_OK);
}
if ((FileId == ASL_FILE_ASM_INCLUDE_OUTPUT) ||
(FileId == ASL_FILE_C_INCLUDE_OUTPUT))
{
return (AE_OK);
}
/* Write the hex bytes to the listing file(s) (if requested) */
for (i = 0; i < Op->Asl.FinalAmlLength; i++)
@ -221,6 +227,7 @@ LsAmlListingWalk (
FlFileError (ASL_FILE_AML_OUTPUT, ASL_MSG_READ);
AslAbort ();
}
LsWriteListingHexBytes (&FileByte, 1, FileId);
}
@ -251,8 +258,12 @@ LsDumpParseTree (
}
DbgPrint (ASL_TREE_OUTPUT, "\nOriginal parse tree from parser:\n\n");
TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD,
DbgPrint (ASL_TREE_OUTPUT, ASL_PARSE_TREE_HEADER1);
TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD,
LsTreeWriteWalk, NULL, NULL);
DbgPrint (ASL_TREE_OUTPUT, ASL_PARSE_TREE_HEADER1);
}
@ -263,15 +274,69 @@ LsTreeWriteWalk (
void *Context)
{
/* Debug output */
/* Dump ParseOp name and possible value */
DbgPrint (ASL_TREE_OUTPUT,
"%5.5d [%2d]", Op->Asl.LogicalLineNumber, Level);
switch (Op->Asl.ParseOpcode)
{
case PARSEOP_NAMESEG:
case PARSEOP_NAMESTRING:
case PARSEOP_METHODCALL:
case PARSEOP_STRING_LITERAL:
UtPrintFormattedName (Op->Asl.ParseOpcode, Level);
UtDumpStringOp (Op, Level);
break;
case PARSEOP_BYTECONST:
UtDumpIntegerOp (Op, Level, 2);
break;
case PARSEOP_WORDCONST:
case PARSEOP_PACKAGE_LENGTH:
UtDumpIntegerOp (Op, Level, 4);
break;
case PARSEOP_DWORDCONST:
case PARSEOP_EISAID:
UtDumpIntegerOp (Op, Level, 8);
break;
case PARSEOP_QWORDCONST:
case PARSEOP_INTEGER:
case PARSEOP_ONE:
case PARSEOP_ZERO:
case PARSEOP_ONES:
UtDumpIntegerOp (Op, Level, 16);
break;
case PARSEOP_INCLUDE:
DbgPrint (ASL_TREE_OUTPUT,
"Open: %s\n", Op->Asl.Value.String);
return (AE_OK);
case PARSEOP_INCLUDE_END:
DbgPrint (ASL_TREE_OUTPUT,
"Close: %s\n", Op->Asl.Filename);
return (AE_OK);
default:
UtDumpBasicOp (Op, Level);
break;
}
/* Dump the remaining data */
DbgPrint (ASL_TREE_OUTPUT, ASL_PARSE_TREE_DEBUG1,
Op->Asl.ParseOpcode, Op->Asl.CompileFlags,
Op->Asl.LineNumber, Op->Asl.EndLine,
Op->Asl.LogicalLineNumber, Op->Asl.EndLogicalLine);
DbgPrint (ASL_TREE_OUTPUT, " (%.4X) Flags %8.8X",
Op->Asl.ParseOpcode, Op->Asl.CompileFlags);
TrPrintNodeCompileFlags (Op->Asl.CompileFlags);
DbgPrint (ASL_TREE_OUTPUT, "\n");
return (AE_OK);
@ -316,7 +381,7 @@ LsWriteNodeToListing (
{
switch (Op->Asl.ParseOpcode)
{
case PARSEOP_DEFINITIONBLOCK:
case PARSEOP_DEFINITION_BLOCK:
case PARSEOP_METHODCALL:
case PARSEOP_INCLUDE:
case PARSEOP_INCLUDE_END:
@ -362,36 +427,49 @@ LsWriteNodeToListing (
switch (Op->Asl.ParseOpcode)
{
case PARSEOP_DEFINITIONBLOCK:
case PARSEOP_DEFINITION_BLOCK:
/* Always start a definition block at AML offset zero */
Gbl_CurrentAmlOffset = 0;
LsWriteSourceLines (Op->Asl.EndLine, Op->Asl.EndLogicalLine, FileId);
/* Use the table Signature and TableId to build a unique name */
if (FileId == ASL_FILE_ASM_SOURCE_OUTPUT)
switch (FileId)
{
case ASL_FILE_ASM_SOURCE_OUTPUT:
FlPrintFile (FileId,
"%s_%s_Header \\\n",
Gbl_TableSignature, Gbl_TableId);
}
if (FileId == ASL_FILE_C_SOURCE_OUTPUT)
{
break;
case ASL_FILE_C_SOURCE_OUTPUT:
FlPrintFile (FileId,
" unsigned char %s_%s_Header [] =\n {\n",
Gbl_TableSignature, Gbl_TableId);
}
if (FileId == ASL_FILE_ASM_INCLUDE_OUTPUT)
{
break;
case ASL_FILE_ASM_INCLUDE_OUTPUT:
FlPrintFile (FileId,
"extrn %s_%s_Header : byte\n",
Gbl_TableSignature, Gbl_TableId);
}
if (FileId == ASL_FILE_C_INCLUDE_OUTPUT)
{
break;
case ASL_FILE_C_INCLUDE_OUTPUT:
FlPrintFile (FileId,
"extern unsigned char %s_%s_Header [];\n",
Gbl_TableSignature, Gbl_TableId);
break;
default:
break;
}
return;
@ -411,7 +489,7 @@ LsWriteNodeToListing (
/* Create a new listing node and push it */
LsPushNode (Op->Asl.Child->Asl.Value.String);
LsPushNode (Op->Asl.Value.String);
return;
@ -540,31 +618,41 @@ LsWriteNodeToListing (
/* Create the appropriate symbol in the output file */
if (FileId == ASL_FILE_ASM_SOURCE_OUTPUT)
switch (FileId)
{
case ASL_FILE_ASM_SOURCE_OUTPUT:
FlPrintFile (FileId,
"%s_%s_%s \\\n",
Gbl_TableSignature, Gbl_TableId, &Pathname[1]);
}
if (FileId == ASL_FILE_C_SOURCE_OUTPUT)
{
break;
case ASL_FILE_C_SOURCE_OUTPUT:
FlPrintFile (FileId,
" unsigned char %s_%s_%s [] =\n {\n",
Gbl_TableSignature, Gbl_TableId, &Pathname[1]);
}
if (FileId == ASL_FILE_ASM_INCLUDE_OUTPUT)
{
break;
case ASL_FILE_ASM_INCLUDE_OUTPUT:
FlPrintFile (FileId,
"extrn %s_%s_%s : byte\n",
Gbl_TableSignature, Gbl_TableId, &Pathname[1]);
}
if (FileId == ASL_FILE_C_INCLUDE_OUTPUT)
{
break;
case ASL_FILE_C_INCLUDE_OUTPUT:
FlPrintFile (FileId,
"extern unsigned char %s_%s_%s [];\n",
Gbl_TableSignature, Gbl_TableId, &Pathname[1]);
break;
default:
break;
}
}
ACPI_FREE (Pathname);
}
break;

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -88,6 +88,7 @@ LsDumpAscii (
FlPrintFile (FileId, ".");
}
}
FlPrintFile (FileId, "\"");
}
@ -185,7 +186,6 @@ LsCheckException (
(LineNumber >= Gbl_NextError->LogicalLineNumber))
{
AePrintException (FileId, Gbl_NextError, "\n[****iasl****]\n");
Gbl_NextError = Gbl_NextError->Next;
}
@ -576,6 +576,7 @@ LsFlushListingBuffer (
{
FlPrintFile (FileId, ",");
}
FlPrintFile (FileId, "0%2.2Xh", Gbl_AmlBuffer[i]);
}

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -104,8 +104,6 @@ LdLoadNamespace (
ACPI_WALK_STATE *WalkState;
DbgPrint (ASL_DEBUG_OUTPUT, "\nCreating namespace\n\n");
/* Create a new walk state */
WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);
@ -196,12 +194,11 @@ LdLoadFieldElements (
default:
Status = AcpiNsLookup (WalkState->ScopeInfo,
Child->Asl.Value.String,
ACPI_TYPE_LOCAL_REGION_FIELD,
ACPI_IMODE_LOAD_PASS1,
ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
ACPI_NS_ERROR_IF_FOUND,
NULL, &Node);
Child->Asl.Value.String,
ACPI_TYPE_LOCAL_REGION_FIELD,
ACPI_IMODE_LOAD_PASS1,
ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
ACPI_NS_ERROR_IF_FOUND, NULL, &Node);
if (ACPI_FAILURE (Status))
{
if (Status != AE_ALREADY_EXISTS)
@ -266,9 +263,9 @@ LdLoadResourceElements (
* This opens a scope, so later field names are guaranteed to be new/unique.
*/
Status = AcpiNsLookup (WalkState->ScopeInfo, Op->Asl.Namepath,
ACPI_TYPE_LOCAL_RESOURCE, ACPI_IMODE_LOAD_PASS1,
ACPI_NS_NO_UPSEARCH | ACPI_NS_ERROR_IF_FOUND,
WalkState, &Node);
ACPI_TYPE_LOCAL_RESOURCE, ACPI_IMODE_LOAD_PASS1,
ACPI_NS_NO_UPSEARCH | ACPI_NS_ERROR_IF_FOUND,
WalkState, &Node);
if (ACPI_FAILURE (Status))
{
if (Status == AE_ALREADY_EXISTS)
@ -296,11 +293,11 @@ LdLoadResourceElements (
if (InitializerOp->Asl.ExternalName)
{
Status = AcpiNsLookup (WalkState->ScopeInfo,
InitializerOp->Asl.ExternalName,
ACPI_TYPE_LOCAL_RESOURCE_FIELD,
ACPI_IMODE_LOAD_PASS1,
ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE,
NULL, &Node);
InitializerOp->Asl.ExternalName,
ACPI_TYPE_LOCAL_RESOURCE_FIELD,
ACPI_IMODE_LOAD_PASS1,
ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE,
NULL, &Node);
if (ACPI_FAILURE (Status))
{
return (Status);
@ -344,6 +341,7 @@ LdNamespace1Begin (
{
ACPI_WALK_STATE *WalkState = (ACPI_WALK_STATE *) Context;
ACPI_NAMESPACE_NODE *Node;
ACPI_PARSE_OBJECT *MethodOp;
ACPI_STATUS Status;
ACPI_OBJECT_TYPE ObjectType;
ACPI_OBJECT_TYPE ActualObjectType = ACPI_TYPE_ANY;
@ -500,8 +498,8 @@ LdNamespace1Begin (
* handle this case. Perhaps someday this case can go away.
*/
Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY,
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
WalkState, &(Node));
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
WalkState, &(Node));
if (ACPI_FAILURE (Status))
{
if (Status == AE_NOT_FOUND)
@ -509,9 +507,9 @@ LdNamespace1Begin (
/* The name was not found, go ahead and create it */
Status = AcpiNsLookup (WalkState->ScopeInfo, Path,
ACPI_TYPE_LOCAL_SCOPE,
ACPI_IMODE_LOAD_PASS1, Flags,
WalkState, &(Node));
ACPI_TYPE_LOCAL_SCOPE,
ACPI_IMODE_LOAD_PASS1, Flags,
WalkState, &(Node));
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@ -534,6 +532,35 @@ LdNamespace1Begin (
return_ACPI_STATUS (Status);
}
else /* Status AE_OK */
{
/*
* Do not allow references to external scopes from the DSDT.
* This is because the DSDT is always loaded first, and the
* external reference cannot be resolved -- causing a runtime
* error because Scope() must be resolved immediately.
* 10/2015.
*/
if ((Node->Flags & ANOBJ_IS_EXTERNAL) &&
(ACPI_COMPARE_NAME (Gbl_TableSignature, "DSDT")))
{
/* However, allowed if the reference is within a method */
MethodOp = Op->Asl.Parent;
while (MethodOp &&
(MethodOp->Asl.ParseOpcode != PARSEOP_METHOD))
{
MethodOp = MethodOp->Asl.Parent;
}
if (!MethodOp)
{
/* Not in a control method, error */
AslError (ASL_ERROR, ASL_MSG_CROSS_TABLE_SCOPE, Op, NULL);
}
}
}
/* We found a node with this name, now check the type */
@ -569,7 +596,7 @@ LdNamespace1Begin (
Node->Type = ACPI_TYPE_LOCAL_SCOPE;
Status = AcpiDsScopeStackPush (Node, ACPI_TYPE_LOCAL_SCOPE,
WalkState);
WalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@ -591,7 +618,7 @@ LdNamespace1Begin (
*/
Node->Type = ACPI_TYPE_LOCAL_SCOPE;
Status = AcpiDsScopeStackPush (Node, ACPI_TYPE_LOCAL_SCOPE,
WalkState);
WalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@ -611,7 +638,7 @@ LdNamespace1Begin (
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Loading name: %s, (%s)\n",
Op->Asl.ExternalName, AcpiUtGetTypeName (ObjectType)));
Op->Asl.ExternalName, AcpiUtGetTypeName (ObjectType)));
/* The name must not already exist */
@ -624,7 +651,7 @@ LdNamespace1Begin (
* parse tree later.
*/
Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &Node);
ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &Node);
if (ACPI_FAILURE (Status))
{
if (Status == AE_ALREADY_EXISTS)
@ -658,8 +685,38 @@ LdNamespace1Begin (
return_ACPI_STATUS (Status);
}
}
Status = AE_OK;
}
else if (!(Node->Flags & ANOBJ_IS_EXTERNAL) &&
(Op->Asl.ParseOpcode == PARSEOP_EXTERNAL))
{
/*
* Allow externals in same scope as the definition of the
* actual object. Similar to C. Allows multiple definition
* blocks that refer to each other in the same file.
*/
Status = AE_OK;
}
else if ((Node->Flags & ANOBJ_IS_EXTERNAL) &&
(Op->Asl.ParseOpcode == PARSEOP_EXTERNAL) &&
(ObjectType == ACPI_TYPE_ANY))
{
/* Allow update of externals of unknown type. */
if (AcpiNsOpensScope (ActualObjectType))
{
Node->Type = (UINT8) ActualObjectType;
Status = AE_OK;
}
else
{
sprintf (MsgBuffer, "%s [%s]", Op->Asl.ExternalName,
AcpiUtGetTypeName (Node->Type));
AslError (ASL_ERROR, ASL_MSG_SCOPE_TYPE, Op, MsgBuffer);
return_ACPI_STATUS (AE_OK);
}
}
else
{
/* Valid error, object already exists */
@ -818,8 +875,8 @@ LdNamespace2Begin (
/* Get the NS node associated with the target. It must exist. */
Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY,
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
WalkState, &TargetNode);
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
WalkState, &TargetNode);
if (ACPI_FAILURE (Status))
{
if (Status == AE_NOT_FOUND)
@ -832,9 +889,9 @@ LdNamespace2Begin (
* This prevents more errors later.
*/
Status = AcpiNsLookup (WalkState->ScopeInfo, Path,
ACPI_TYPE_ANY,
ACPI_IMODE_LOAD_PASS1, ACPI_NS_NO_UPSEARCH,
WalkState, &(Node));
ACPI_TYPE_ANY,
ACPI_IMODE_LOAD_PASS1, ACPI_NS_NO_UPSEARCH,
WalkState, &(Node));
return (AE_OK);
}

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -207,6 +207,7 @@ LkIsObjectUsed (
case ACPI_TYPE_POWER:
case ACPI_TYPE_THERMAL:
case ACPI_TYPE_LOCAL_RESOURCE:
case ACPI_TYPE_LOCAL_RESOURCE_FIELD: /* Names assigned to descriptor elements */
return (AE_OK);
@ -227,8 +228,8 @@ LkIsObjectUsed (
* Issue a remark even if it is a reserved name (starts
* with an underscore).
*/
sprintf (MsgBuffer, "Name is within method [%4.4s]",
Next->Name.Ascii);
sprintf (MsgBuffer, "Name [%4.4s] is within a method [%4.4s]",
Node->Name.Ascii, Next->Name.Ascii);
AslError (ASL_REMARK, ASL_MSG_NOT_REFERENCED,
LkGetNameOp (Node->Op), MsgBuffer);
return (AE_OK);

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -73,36 +73,6 @@ static void
AslInitialize (
void);
UINT8
AcpiIsBigEndianMachine (
void);
/*******************************************************************************
*
* FUNCTION: AcpiIsBigEndianMachine
*
* PARAMETERS: None
*
* RETURN: TRUE if machine is big endian
* FALSE if machine is little endian
*
* DESCRIPTION: Detect whether machine is little endian or big endian.
*
******************************************************************************/
UINT8
AcpiIsBigEndianMachine (
void)
{
union {
UINT32 Integer;
UINT8 Bytes[4];
} Overlay = {0xFF000000};
return (Overlay.Bytes[0]); /* Returns 0xFF (TRUE) for big endian */
}
/*******************************************************************************
*
@ -127,7 +97,8 @@ Usage (
printf ("\nGeneral:\n");
ACPI_OPTION ("-@ <file>", "Specify command file");
ACPI_OPTION ("-I <dir>", "Specify additional include directory");
ACPI_OPTION ("-T <sig>|ALL|*", "Create table template file for ACPI <Sig>");
ACPI_OPTION ("-T <sig list>|ALL", "Create ACPI table template/example files");
ACPI_OPTION ("-T <count>", "Emit DSDT and <count> SSDTs to same file");
ACPI_OPTION ("-p <prefix>", "Specify path/filename prefix for all output files");
ACPI_OPTION ("-v", "Display compiler version");
ACPI_OPTION ("-vo", "Enable optimization comments");
@ -160,6 +131,7 @@ Usage (
ACPI_OPTION ("-of", "Disable constant folding");
ACPI_OPTION ("-oi", "Disable integer optimization to Zero/One/Ones");
ACPI_OPTION ("-on", "Disable named reference string optimization");
ACPI_OPTION ("-ot", "Disable typechecking");
ACPI_OPTION ("-cr", "Disable Resource Descriptor error checking");
ACPI_OPTION ("-in", "Ignore NoOp operators");
ACPI_OPTION ("-r <revision>", "Override table header Revision (1-255)");
@ -175,6 +147,7 @@ Usage (
ACPI_OPTION ("-lm", "Create hardware summary map file (*.map)");
ACPI_OPTION ("-ln", "Create namespace file (*.nsp)");
ACPI_OPTION ("-ls", "Create combined source file (expanded includes) (*.src)");
ACPI_OPTION ("-lx", "Create cross-reference file (*.xrf)");
printf ("\nData Table Compiler:\n");
ACPI_OPTION ("-G", "Compile custom table that contains generic operators");
@ -203,7 +176,7 @@ Usage (
ACPI_OPTION ("-f", "Ignore errors, force creation of AML output file(s)");
ACPI_OPTION ("-m <size>", "Set internal line buffer size (in Kbytes)");
ACPI_OPTION ("-n", "Parse only, no output generation");
ACPI_OPTION ("-ot", "Display compile times and statistics");
ACPI_OPTION ("-oc", "Display compile times and statistics");
ACPI_OPTION ("-x <level>", "Set debug level for trace output");
ACPI_OPTION ("-z", "Do not insert new compiler ID for DataTables");
}
@ -301,6 +274,12 @@ AslInitialize (
AcpiGbl_DmOpt_Verbose = FALSE;
/* Default integer width is 64 bits */
AcpiGbl_IntegerBitWidth = 64;
AcpiGbl_IntegerNybbleWidth = 16;
AcpiGbl_IntegerByteWidth = 8;
for (i = 0; i < ASL_NUM_FILES; i++)
{
Gbl_Files[i].Handle = NULL;
@ -344,7 +323,7 @@ main (
* be little-endian, and support for big-endian machines needs to
* be implemented.
*/
if (AcpiIsBigEndianMachine ())
if (UtIsBigEndianMachine ())
{
fprintf (stderr,
"iASL is not currently supported on big-endian machines.\n");

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -123,6 +123,7 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] =
{
/*! [Begin] no source code translation (keep the table structure) */
/* AML Opcode Value Flags Btype */
/* ACCESSAS */ OP_TABLE_ENTRY (AML_INT_ACCESSFIELD_OP, 0, 0, 0),
/* ACCESSATTRIB_BLOCK */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_BLOCK, 0, 0),
@ -237,11 +238,12 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] =
/* GPIOINT */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
/* GPIOIO */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
/* I2CSERIALBUS */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
/* I2CSERIALBUSV2 */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
/* IF */ OP_TABLE_ENTRY (AML_IF_OP, 0, NODE_AML_PACKAGE, 0),
/* INCLUDE */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
/* INCLUDE_END */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
/* INCREMENT */ OP_TABLE_ENTRY (AML_INCREMENT_OP, 0, 0, ACPI_BTYPE_INTEGER),
/* INDEX */ OP_TABLE_ENTRY (AML_INDEX_OP, 0, 0, ACPI_BTYPE_REFERENCE),
/* INDEX */ OP_TABLE_ENTRY (AML_INDEX_OP, 0, 0, ACPI_BTYPE_REFERENCE_OBJECT),
/* INDEXFIELD */ OP_TABLE_ENTRY (AML_INDEX_FIELD_OP, 0, NODE_AML_PACKAGE, 0),
/* INTEGER */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, ACPI_BTYPE_INTEGER),
/* INTERRUPT */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
@ -312,23 +314,23 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] =
/* NOR */ OP_TABLE_ENTRY (AML_BIT_NOR_OP, 0, 0, ACPI_BTYPE_INTEGER),
/* NOT */ OP_TABLE_ENTRY (AML_BIT_NOT_OP, 0, 0, ACPI_BTYPE_INTEGER),
/* NOTIFY */ OP_TABLE_ENTRY (AML_NOTIFY_OP, 0, 0, 0),
/* OBJECTTYPE */ OP_TABLE_ENTRY (AML_TYPE_OP, 0, 0, ACPI_BTYPE_INTEGER),
/* OBJECTTYPE_BFF */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_BUFFER_FIELD, 0, 0),
/* OBJECTTYPE_BUF */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_BUFFER, 0, 0),
/* OBJECTTYPE_DDB */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_DDB_HANDLE, 0, 0),
/* OBJECTTYPE_DEV */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_DEVICE, 0, 0),
/* OBJECTTYPE_EVT */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_EVENT, 0, 0),
/* OBJECTTYPE_FLD */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_FIELD_UNIT, 0, 0),
/* OBJECTTYPE_INT */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_INTEGER, 0, 0),
/* OBJECTTYPE_MTH */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_METHOD, 0, 0),
/* OBJECTTYPE_MTX */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_MUTEX, 0, 0),
/* OBJECTTYPE_OPR */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_REGION, 0, 0),
/* OBJECTTYPE_PKG */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_PACKAGE, 0, 0),
/* OBJECTTYPE_POW */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_POWER, 0, 0),
/* OBJECTTYPE_PRO */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_PROCESSOR, 0, 0),
/* OBJECTTYPE_STR */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_STRING, 0, 0),
/* OBJECTTYPE_THZ */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_THERMAL, 0, 0),
/* OBJECTTYPE_UNK */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_ANY, 0, 0),
/* OBJECTTYPE */ OP_TABLE_ENTRY (AML_OBJECT_TYPE_OP, 0, 0, ACPI_BTYPE_INTEGER),
/* OBJECTTYPE_BFF */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_TYPE_BUFFER_FIELD, 0, 0),
/* OBJECTTYPE_BUF */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_TYPE_BUFFER, 0, 0),
/* OBJECTTYPE_DDB */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_TYPE_DDB_HANDLE, 0, 0),
/* OBJECTTYPE_DEV */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_TYPE_DEVICE, 0, 0),
/* OBJECTTYPE_EVT */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_TYPE_EVENT, 0, 0),
/* OBJECTTYPE_FLD */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_TYPE_FIELD_UNIT, 0, 0),
/* OBJECTTYPE_INT */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_TYPE_INTEGER, 0, 0),
/* OBJECTTYPE_MTH */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_TYPE_METHOD, 0, 0),
/* OBJECTTYPE_MTX */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_TYPE_MUTEX, 0, 0),
/* OBJECTTYPE_OPR */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_TYPE_REGION, 0, 0),
/* OBJECTTYPE_PKG */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_TYPE_PACKAGE, 0, 0),
/* OBJECTTYPE_POW */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_TYPE_POWER, 0, 0),
/* OBJECTTYPE_PRO */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_TYPE_PROCESSOR, 0, 0),
/* OBJECTTYPE_STR */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_TYPE_STRING, 0, 0),
/* OBJECTTYPE_THZ */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_TYPE_THERMAL, 0, 0),
/* OBJECTTYPE_UNK */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_TYPE_ANY, 0, 0),
/* OFFSET */ OP_TABLE_ENTRY (AML_INT_RESERVEDFIELD_OP, 0, 0, 0),
/* ONE */ OP_TABLE_ENTRY (AML_ONE_OP, 0, 0, ACPI_BTYPE_INTEGER),
/* ONES */ OP_TABLE_ENTRY (AML_ONES_OP, 0, 0, ACPI_BTYPE_INTEGER),
@ -357,7 +359,7 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] =
/* RAW_DATA */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
/* READWRITETYPE_BOTH */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0),
/* READWRITETYPE_READONLY */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
/* REFOF */ OP_TABLE_ENTRY (AML_REF_OF_OP, 0, 0, ACPI_BTYPE_REFERENCE),
/* REFOF */ OP_TABLE_ENTRY (AML_REF_OF_OP, 0, 0, ACPI_BTYPE_REFERENCE_OBJECT),
/* REGIONSPACE_CMOS */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_CMOS, 0, 0),
/* REGIONSPACE_EC */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_EC, 0, 0),
/* REGIONSPACE_FFIXEDHW */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_FIXED_HARDWARE, 0, 0),
@ -394,6 +396,7 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] =
/* SLAVEMODE_DEVICEINIT */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0),
/* SLEEP */ OP_TABLE_ENTRY (AML_SLEEP_OP, 0, 0, 0),
/* SPISERIALBUS */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
/* SPISERIALBUSV2 */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
/* STALL */ OP_TABLE_ENTRY (AML_STALL_OP, 0, 0, 0),
/* STARTDEPENDENTFN */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
/* STARTDEPENDENTFN_NOPRI */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
@ -419,6 +422,7 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] =
/* TYPE_STATIC */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
/* TYPE_TRANSLATION */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0),
/* UART_SERIALBUS */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
/* UART_SERIALBUSV2 */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
/* UNICODE */ OP_TABLE_ENTRY (AML_BUFFER_OP, 0, NODE_AML_PACKAGE, 0),
/* UNLOAD */ OP_TABLE_ENTRY (AML_UNLOAD_OP, 0, 0, 0),
/* UPDATERULE_ONES */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_UPDATE_WRITE_AS_ONES, 0, 0),
@ -478,6 +482,7 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] =
/* HORIZONTALOFFSET */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
/* PRINTF */ OP_TABLE_ENTRY (AML_STORE_OP, 0, 0, ACPI_BTYPE_DATA_REFERENCE),
/* FPRINTF */ OP_TABLE_ENTRY (AML_STORE_OP, 0, 0, ACPI_BTYPE_DATA_REFERENCE),
/* ASLCODE */ OP_TABLE_ENTRY (0, 0, 0, 0)
/*! [End] no source code translation !*/
};

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -239,7 +239,7 @@ MpCreateGpioInfo (
/* Sort on source DeviceName first */
while (NextGpio &&
(strcmp (DeviceName, NextGpio->DeviceName) > 0))
(strcmp (DeviceName, NextGpio->DeviceName) > 0))
{
PrevGpio = NextGpio;
NextGpio = NextGpio->Next;
@ -248,8 +248,8 @@ MpCreateGpioInfo (
/* Now sort on the PinNumber */
while (NextGpio &&
(NextGpio->PinNumber < PinNumber) &&
!strcmp (DeviceName, NextGpio->DeviceName))
(NextGpio->PinNumber < PinNumber) &&
!strcmp (DeviceName, NextGpio->DeviceName))
{
PrevGpio = NextGpio;
NextGpio = NextGpio->Next;

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -453,7 +453,7 @@ MpEmitDeviceTree (
/* Walk the namespace from the root */
(void) AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
ACPI_UINT32_MAX, FALSE, MpEmitOneDevice, NULL, NULL, NULL);
ACPI_UINT32_MAX, FALSE, MpEmitOneDevice, NULL, NULL, NULL);
}
@ -533,7 +533,7 @@ MpXrefDevices (
/* Walk the entire parse tree */
TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD,
TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD,
MpNamespaceXrefBegin, NULL, Info);
if (!Info->References)

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -130,7 +130,7 @@ const char *AslCompilerMsgs [] =
/* ASL_MSG_HID_SUFFIX */ "_HID suffix must be all hex digits",
/* ASL_MSG_INCLUDE_FILE_OPEN */ "Could not open include file",
/* ASL_MSG_INPUT_FILE_OPEN */ "Could not open input file",
/* ASL_MSG_INTEGER_LENGTH */ "64-bit integer in 32-bit table, truncating (DSDT version < 2)",
/* ASL_MSG_INTEGER_LENGTH */ "64-bit integer in 32-bit table, truncating (DSDT or SSDT version < 2)",
/* ASL_MSG_INTEGER_OPTIMIZATION */ "Integer optimized to single-byte AML opcode",
/* ASL_MSG_INTERRUPT_LIST */ "Too many interrupts (16 max)",
/* ASL_MSG_INTERRUPT_NUMBER */ "Invalid interrupt number (must be 0-15)",
@ -224,7 +224,7 @@ const char *AslCompilerMsgs [] =
/* ASL_MSG_TAG_SMALLER */ "ResourceTag smaller than Field",
/* ASL_MSG_TIMEOUT */ "Result is not used, possible operator timeout will be missed",
/* ASL_MSG_TOO_MANY_TEMPS */ "Method requires too many temporary variables (_T_x)",
/* ASL_MSG_TRUNCATION */ "64-bit return value will be truncated to 32 bits (DSDT version < 2)",
/* ASL_MSG_TRUNCATION */ "64-bit return value will be truncated to 32 bits (DSDT or SSDT version < 2)",
/* ASL_MSG_UNKNOWN_RESERVED_NAME */ "Unknown reserved name",
/* ASL_MSG_UNREACHABLE_CODE */ "Statement is unreachable",
/* ASL_MSG_UNSUPPORTED */ "Unsupported feature",
@ -238,8 +238,9 @@ const char *AslCompilerMsgs [] =
/* ASL_MSG_ILLEGAL_METHOD_REF */ "Illegal reference across two methods",
/* ASL_MSG_LOCAL_NOT_USED */ "Method Local is set but never used",
/* ASL_MSG_ARG_AS_LOCAL_NOT_USED */ "Method Argument (as a local) is set but never used",
/* ASL_MSG_ARG_NOT_USED */ "Method Argument is never used"
/* ASL_MSG_ARG_NOT_USED */ "Method Argument is never used",
/* ASL_MSG_CONSTANT_REQUIRED */ "Non-reducible expression",
/* ASL_MSG_CROSS_TABLE_SCOPE */ "Illegal open scope on external object from within DSDT"
};
/* Table compiler */

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -241,6 +241,8 @@ typedef enum
ASL_MSG_LOCAL_NOT_USED,
ASL_MSG_ARG_AS_LOCAL_NOT_USED,
ASL_MSG_ARG_NOT_USED,
ASL_MSG_CONSTANT_REQUIRED,
ASL_MSG_CROSS_TABLE_SCOPE,
/* These messages are used by the Data Table compiler only */

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -53,7 +53,7 @@
/* Local prototypes */
void
static void
MtCheckNamedObjectInMethod (
ACPI_PARSE_OBJECT *Op,
ASL_METHOD_INFO *MethodInfo);
@ -93,6 +93,13 @@ MtMethodAnalysisWalkBegin (
UINT8 ActualArgs = 0;
/* Build cross-reference output file if requested */
if (Gbl_CrossReferenceOutput)
{
OtXrefWalkPart1 (Op, Level, MethodInfo);
}
switch (Op->Asl.ParseOpcode)
{
case PARSEOP_METHOD:
@ -101,7 +108,7 @@ MtMethodAnalysisWalkBegin (
/* Create and init method info */
MethodInfo = UtLocalCalloc (sizeof (ASL_METHOD_INFO));
MethodInfo = UtLocalCalloc (sizeof (ASL_METHOD_INFO));
MethodInfo->Next = WalkInfo->MethodStack;
MethodInfo->Op = Op;
@ -186,7 +193,9 @@ MtMethodAnalysisWalkBegin (
NextParamType = NextType->Asl.Child;
while (NextParamType)
{
MethodInfo->ValidArgTypes[ActualArgs] |= AnMapObjTypeToBtype (NextParamType);
MethodInfo->ValidArgTypes[ActualArgs] |=
AnMapObjTypeToBtype (NextParamType);
NextParamType->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
NextParamType = NextParamType->Asl.Next;
}
@ -195,6 +204,7 @@ MtMethodAnalysisWalkBegin (
{
MethodInfo->ValidArgTypes[ActualArgs] =
AnMapObjTypeToBtype (NextType);
NextType->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
ActualArgs++;
}
@ -251,7 +261,8 @@ MtMethodAnalysisWalkBegin (
* 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);
AslError (ASL_REMARK, ASL_MSG_LOCAL_OUTSIDE_METHOD,
Op, Op->Asl.ExternalName);
return (AE_ERROR);
}
@ -294,7 +305,8 @@ MtMethodAnalysisWalkBegin (
* 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);
AslError (ASL_REMARK, ASL_MSG_LOCAL_OUTSIDE_METHOD,
Op, Op->Asl.ExternalName);
return (AE_ERROR);
}
@ -317,7 +329,7 @@ MtMethodAnalysisWalkBegin (
* The only operator that accepts an uninitialized value is ObjectType()
*/
else if ((!MethodInfo->ArgInitialized[RegisterNumber]) &&
(Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_OBJECTTYPE))
(Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_OBJECTTYPE))
{
AslError (ASL_ERROR, ASL_MSG_ARG_INIT, Op, ArgName);
}
@ -394,10 +406,8 @@ MtMethodAnalysisWalkBegin (
case PARSEOP_DEVICE:
Next = Op->Asl.Child;
if (!ApFindNameInScope (METHOD_NAME__HID, Next) &&
!ApFindNameInScope (METHOD_NAME__ADR, Next))
if (!ApFindNameInDeviceTree (METHOD_NAME__HID, Op) &&
!ApFindNameInDeviceTree (METHOD_NAME__ADR, Op))
{
AslError (ASL_WARNING, ASL_MSG_MISSING_DEPENDENCY, Op,
"Device object requires a _HID or _ADR in same scope");
@ -418,7 +428,8 @@ MtMethodAnalysisWalkBegin (
i = ApCheckForPredefinedName (Op, Op->Asl.NameSeg);
if (i < ACPI_VALID_RESERVED_NAME_MAX)
{
AslError (ASL_ERROR, ASL_MSG_RESERVED_USE, Op, Op->Asl.ExternalName);
AslError (ASL_ERROR, ASL_MSG_RESERVED_USE,
Op, Op->Asl.ExternalName);
}
break;
@ -487,7 +498,7 @@ MtMethodAnalysisWalkBegin (
*
******************************************************************************/
void
static void
MtCheckNamedObjectInMethod (
ACPI_PARSE_OBJECT *Op,
ASL_METHOD_INFO *MethodInfo)
@ -495,9 +506,10 @@ MtCheckNamedObjectInMethod (
const ACPI_OPCODE_INFO *OpInfo;
/* We don't care about actual method declarations */
/* We don't care about actual method declarations or scopes */
if (Op->Asl.AmlOpcode == AML_METHOD_OP)
if ((Op->Asl.AmlOpcode == AML_METHOD_OP) ||
(Op->Asl.AmlOpcode == AML_SCOPE_OP))
{
return;
}
@ -677,7 +689,8 @@ MtMethodAnalysisWalkEnd (
*/
if (Op->Asl.Next)
{
AslError (ASL_WARNING, ASL_MSG_UNREACHABLE_CODE, Op->Asl.Next, NULL);
AslError (ASL_WARNING, ASL_MSG_UNREACHABLE_CODE,
Op->Asl.Next, NULL);
}
break;

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -124,16 +124,16 @@ NsDisplayNamespace (
/* Walk entire namespace from the root */
Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
ACPI_UINT32_MAX, FALSE, NsDoOneNamespaceObject, NULL,
NULL, NULL);
ACPI_UINT32_MAX, FALSE, NsDoOneNamespaceObject, NULL,
NULL, NULL);
/* Print the full pathname for each namespace node */
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "\nNamespace pathnames\n\n");
Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
ACPI_UINT32_MAX, FALSE, NsDoOnePathname, NULL,
NULL, NULL);
ACPI_UINT32_MAX, FALSE, NsDoOnePathname, NULL,
NULL, NULL);
return (Status);
}
@ -168,8 +168,7 @@ NsDoOneNamespaceObject (
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "%5u [%u] %*s %4.4s - %s",
Gbl_NumNamespaceObjects, Level, (Level * 3), " ",
&Node->Name,
AcpiUtGetTypeName (Node->Type));
&Node->Name, AcpiUtGetTypeName (Node->Type));
Op = Node->Op;
ObjDesc = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Node->Object);
@ -218,11 +217,13 @@ NsDoOneNamespaceObject (
{
Op = Op->Asl.Child;
}
if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) ||
(Op->Asl.ParseOpcode == PARSEOP_NAMESTRING))
{
Op = Op->Asl.Next;
}
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
" [Initial Value 0x%8.8X%8.8X]",
ACPI_FORMAT_UINT64 (Op->Asl.Value.Integer));
@ -234,11 +235,13 @@ NsDoOneNamespaceObject (
{
Op = Op->Asl.Child;
}
if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) ||
(Op->Asl.ParseOpcode == PARSEOP_NAMESTRING))
{
Op = Op->Asl.Next;
}
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
" [Initial Value \"%s\"]",
Op->Asl.Value.String);
@ -251,6 +254,7 @@ NsDoOneNamespaceObject (
{
Op = Op->Asl.Child;
}
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
" [Offset 0x%04X Length 0x%04X bits]",
Op->Asl.Parent->Asl.ExtraValue, (UINT32) Op->Asl.Value.Integer);
@ -303,11 +307,13 @@ NsDoOneNamespaceObject (
{
Op = Op->Asl.Child;
}
if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) ||
(Op->Asl.ParseOpcode == PARSEOP_NAMESTRING))
{
Op = Op->Asl.Next;
}
Op = Op->Asl.Child;
if ((Op->Asl.ParseOpcode == PARSEOP_BYTECONST) ||
@ -325,11 +331,13 @@ NsDoOneNamespaceObject (
{
Op = Op->Asl.Child;
}
if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) ||
(Op->Asl.ParseOpcode == PARSEOP_NAMESTRING))
{
Op = Op->Asl.Next;
}
Op = Op->Asl.Child;
if (Op && (Op->Asl.ParseOpcode == PARSEOP_INTEGER))
@ -417,6 +425,5 @@ NsDoOnePathname (
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "%s\n", TargetPath.Pointer);
ACPI_FREE (TargetPath.Pointer);
return (AE_OK);
}

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -67,63 +67,10 @@ static void
OpcDoEisaId (
ACPI_PARSE_OBJECT *Op);
static void
OpcDoPld (
ACPI_PARSE_OBJECT *Op);
static void
OpcDoUuId (
ACPI_PARSE_OBJECT *Op);
static UINT8 *
OpcEncodePldBuffer (
ACPI_PLD_INFO *PldInfo);
/* ToPld strings */
static char *AslPldPanelList[] =
{
"TOP",
"BOTTOM",
"LEFT",
"RIGHT",
"FRONT",
"BACK",
"UNKNOWN",
NULL
};
static char *AslPldVerticalPositionList[] =
{
"UPPER",
"CENTER",
"LOWER",
NULL
};
static char *AslPldHorizontalPositionList[] =
{
"LEFT",
"CENTER",
"RIGHT",
NULL
};
static char *AslPldShapeList[] =
{
"ROUND",
"OVAL",
"SQUARE",
"VERTICALRECTANGLE",
"HORIZONTALRECTANGLE",
"VERTICALTRAPEZOID",
"HORIZONTALTRAPEZOID",
"UNKNOWN",
"CHAMFERED",
NULL
};
/*******************************************************************************
*
@ -260,7 +207,7 @@ OpcSetOptimalIntegerSize (
*/
if (Op->Asl.Parent &&
Op->Asl.Parent->Asl.Parent &&
(Op->Asl.Parent->Asl.Parent->Asl.ParseOpcode == PARSEOP_DEFINITIONBLOCK))
(Op->Asl.Parent->Asl.Parent->Asl.ParseOpcode == PARSEOP_DEFINITION_BLOCK))
{
return (0);
}
@ -330,11 +277,13 @@ OpcSetOptimalIntegerSize (
Op->Asl.AmlOpcode = AML_BYTE_OP;
return (1);
}
if (Op->Asl.Value.Integer <= ACPI_UINT16_MAX)
{
Op->Asl.AmlOpcode = AML_WORD_OP;
return (2);
}
if (Op->Asl.Value.Integer <= ACPI_UINT32_MAX)
{
Op->Asl.AmlOpcode = AML_DWORD_OP;
@ -398,6 +347,7 @@ OpcDoAccessAs (
{
AttribOp->Asl.Value.Integer = 0;
}
AttribOp->Asl.AmlOpcode = AML_RAW_DATA_BYTE;
AttribOp->Asl.ParseOpcode = PARSEOP_RAW_DATA;
@ -486,21 +436,21 @@ OpcDoConnection (
* First Child -> BufferLength
* Second Child -> Descriptor Buffer (raw byte data)
*/
BufferOp->Asl.ParseOpcode = PARSEOP_BUFFER;
BufferOp->Asl.AmlOpcode = AML_BUFFER_OP;
BufferOp->Asl.CompileFlags = NODE_AML_PACKAGE | NODE_IS_RESOURCE_DESC;
BufferOp->Asl.ParseOpcode = PARSEOP_BUFFER;
BufferOp->Asl.AmlOpcode = AML_BUFFER_OP;
BufferOp->Asl.CompileFlags = NODE_AML_PACKAGE | NODE_IS_RESOURCE_DESC;
UtSetParseOpName (BufferOp);
BufferLengthOp->Asl.ParseOpcode = PARSEOP_INTEGER;
BufferLengthOp->Asl.ParseOpcode = PARSEOP_INTEGER;
BufferLengthOp->Asl.Value.Integer = Rnode->BufferLength;
(void) OpcSetOptimalIntegerSize (BufferLengthOp);
UtSetParseOpName (BufferLengthOp);
BufferDataOp->Asl.ParseOpcode = PARSEOP_RAW_DATA;
BufferDataOp->Asl.AmlOpcode = AML_RAW_DATA_CHAIN;
BufferDataOp->Asl.AmlOpcodeLength = 0;
BufferDataOp->Asl.AmlLength = Rnode->BufferLength;
BufferDataOp->Asl.Value.Buffer = (UINT8 *) Rnode;
BufferDataOp->Asl.ParseOpcode = PARSEOP_RAW_DATA;
BufferDataOp->Asl.AmlOpcode = AML_RAW_DATA_CHAIN;
BufferDataOp->Asl.AmlOpcodeLength = 0;
BufferDataOp->Asl.AmlLength = Rnode->BufferLength;
BufferDataOp->Asl.Value.Buffer = (UINT8 *) Rnode;
UtSetParseOpName (BufferDataOp);
}
@ -564,8 +514,8 @@ OpcDoUnicode (
* Just set the buffer size node to be the buffer length, regardless
* of whether it was previously an integer or a default_arg placeholder
*/
BufferLengthOp->Asl.ParseOpcode = PARSEOP_INTEGER;
BufferLengthOp->Asl.AmlOpcode = AML_DWORD_OP;
BufferLengthOp->Asl.ParseOpcode = PARSEOP_INTEGER;
BufferLengthOp->Asl.AmlOpcode = AML_DWORD_OP;
BufferLengthOp->Asl.Value.Integer = Length;
UtSetParseOpName (BufferLengthOp);
@ -573,11 +523,11 @@ OpcDoUnicode (
/* The Unicode string is a raw data buffer */
InitializerOp->Asl.Value.Buffer = (UINT8 *) UnicodeString;
InitializerOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER;
InitializerOp->Asl.AmlLength = Length;
InitializerOp->Asl.ParseOpcode = PARSEOP_RAW_DATA;
InitializerOp->Asl.Child = NULL;
InitializerOp->Asl.Value.Buffer = (UINT8 *) UnicodeString;
InitializerOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER;
InitializerOp->Asl.AmlLength = Length;
InitializerOp->Asl.ParseOpcode = PARSEOP_RAW_DATA;
InitializerOp->Asl.Child = NULL;
UtSetParseOpName (InitializerOp);
}
@ -704,651 +654,6 @@ OpcDoEisaId (
}
/*******************************************************************************
*
* FUNCTION: OpcEncodePldBuffer
*
* PARAMETERS: PldInfo - _PLD buffer struct (Using local struct)
*
* RETURN: Encode _PLD buffer suitable for return value from _PLD
*
* DESCRIPTION: Bit-packs a _PLD buffer struct.
*
******************************************************************************/
static UINT8 *
OpcEncodePldBuffer (
ACPI_PLD_INFO *PldInfo)
{
UINT32 *Buffer;
UINT32 Dword;
Buffer = ACPI_ALLOCATE_ZEROED (ACPI_PLD_BUFFER_SIZE);
if (!Buffer)
{
return (NULL);
}
/* First 32 bits */
Dword = 0;
ACPI_PLD_SET_REVISION (&Dword, PldInfo->Revision);
ACPI_PLD_SET_IGNORE_COLOR (&Dword, PldInfo->IgnoreColor);
ACPI_PLD_SET_RED (&Dword, PldInfo->Red);
ACPI_PLD_SET_GREEN (&Dword, PldInfo->Green);
ACPI_PLD_SET_BLUE (&Dword, PldInfo->Blue);
ACPI_MOVE_32_TO_32 (&Buffer[0], &Dword);
/* Second 32 bits */
Dword = 0;
ACPI_PLD_SET_WIDTH (&Dword, PldInfo->Width);
ACPI_PLD_SET_HEIGHT (&Dword, PldInfo->Height);
ACPI_MOVE_32_TO_32 (&Buffer[1], &Dword);
/* Third 32 bits */
Dword = 0;
ACPI_PLD_SET_USER_VISIBLE (&Dword, PldInfo->UserVisible);
ACPI_PLD_SET_DOCK (&Dword, PldInfo->Dock);
ACPI_PLD_SET_LID (&Dword, PldInfo->Lid);
ACPI_PLD_SET_PANEL (&Dword, PldInfo->Panel);
ACPI_PLD_SET_VERTICAL (&Dword, PldInfo->VerticalPosition);
ACPI_PLD_SET_HORIZONTAL (&Dword, PldInfo->HorizontalPosition);
ACPI_PLD_SET_SHAPE (&Dword, PldInfo->Shape);
ACPI_PLD_SET_ORIENTATION (&Dword, PldInfo->GroupOrientation);
ACPI_PLD_SET_TOKEN (&Dword, PldInfo->GroupToken);
ACPI_PLD_SET_POSITION (&Dword, PldInfo->GroupPosition);
ACPI_PLD_SET_BAY (&Dword, PldInfo->Bay);
ACPI_MOVE_32_TO_32 (&Buffer[2], &Dword);
/* Fourth 32 bits */
Dword = 0;
ACPI_PLD_SET_EJECTABLE (&Dword, PldInfo->Ejectable);
ACPI_PLD_SET_OSPM_EJECT (&Dword, PldInfo->OspmEjectRequired);
ACPI_PLD_SET_CABINET (&Dword, PldInfo->CabinetNumber);
ACPI_PLD_SET_CARD_CAGE (&Dword, PldInfo->CardCageNumber);
ACPI_PLD_SET_REFERENCE (&Dword, PldInfo->Reference);
ACPI_PLD_SET_ROTATION (&Dword, PldInfo->Rotation);
ACPI_PLD_SET_ORDER (&Dword, PldInfo->Order);
ACPI_MOVE_32_TO_32 (&Buffer[3], &Dword);
if (PldInfo->Revision >= 2)
{
/* Fifth 32 bits */
Dword = 0;
ACPI_PLD_SET_VERT_OFFSET (&Dword, PldInfo->VerticalOffset);
ACPI_PLD_SET_HORIZ_OFFSET (&Dword, PldInfo->HorizontalOffset);
ACPI_MOVE_32_TO_32 (&Buffer[4], &Dword);
}
return (ACPI_CAST_PTR (UINT8, Buffer));
}
/*******************************************************************************
*
* FUNCTION: OpcFindName
*
* PARAMETERS: List - Array of char strings to be searched
* Name - Char string to string for
* Index - Index value to set if found
*
* RETURN: TRUE if any names matched, FALSE otherwise
*
* DESCRIPTION: Match PLD name to value in lookup table. Sets Value to
* equivalent parameter value.
*
******************************************************************************/
static BOOLEAN
OpcFindName (
char **List,
char *Name,
UINT64 *Index)
{
char *Str;
UINT32 i;
AcpiUtStrupr (Name);
for (i = 0, Str = List[0]; Str; i++, Str = List[i])
{
if (!(strncmp (Str, Name, strlen (Name))))
{
*Index = i;
return (TRUE);
}
}
return (FALSE);
}
/*******************************************************************************
*
* FUNCTION: OpcDoPld
*
* PARAMETERS: Op - Parse node
*
* RETURN: None
*
* DESCRIPTION: Convert ToPLD macro to 20-byte buffer
*
******************************************************************************/
static void
OpcDoPld (
ACPI_PARSE_OBJECT *Op)
{
UINT8 *Buffer;
ACPI_PARSE_OBJECT *Node;
ACPI_PLD_INFO PldInfo;
ACPI_PARSE_OBJECT *NewOp;
if (!Op)
{
AslError(ASL_ERROR, ASL_MSG_NOT_EXIST, Op, NULL);
return;
}
if (Op->Asl.ParseOpcode != PARSEOP_TOPLD)
{
AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Op, NULL);
return;
}
memset (&PldInfo, 0, sizeof (ACPI_PLD_INFO));
Node = Op->Asl.Child;
while (Node)
{
switch (Node->Asl.ParseOpcode)
{
case PARSEOP_PLD_REVISION:
if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER)
{
AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL);
break;
}
if (Node->Asl.Child->Asl.Value.Integer > 127)
{
AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
break;
}
PldInfo.Revision = (UINT8) Node->Asl.Child->Asl.Value.Integer;
break;
case PARSEOP_PLD_IGNORECOLOR:
if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER)
{
AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL);
break;
}
if (Node->Asl.Child->Asl.Value.Integer > 1)
{
AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
break;
}
PldInfo.IgnoreColor = (UINT8) Node->Asl.Child->Asl.Value.Integer;
break;
case PARSEOP_PLD_RED:
case PARSEOP_PLD_GREEN:
case PARSEOP_PLD_BLUE:
if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER)
{
AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
break;
}
if (Node->Asl.Child->Asl.Value.Integer > 255)
{
AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
break;
}
if (Node->Asl.ParseOpcode == PARSEOP_PLD_RED)
{
PldInfo.Red = (UINT8) Node->Asl.Child->Asl.Value.Integer;
}
else if (Node->Asl.ParseOpcode == PARSEOP_PLD_GREEN)
{
PldInfo.Green = (UINT8) Node->Asl.Child->Asl.Value.Integer;
}
else /* PARSEOP_PLD_BLUE */
{
PldInfo.Blue = (UINT8) Node->Asl.Child->Asl.Value.Integer;
}
break;
case PARSEOP_PLD_WIDTH:
case PARSEOP_PLD_HEIGHT:
if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER)
{
AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL);
break;
}
if (Node->Asl.Child->Asl.Value.Integer > 65535)
{
AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
break;
}
if (Node->Asl.ParseOpcode == PARSEOP_PLD_WIDTH)
{
PldInfo.Width = (UINT16) Node->Asl.Child->Asl.Value.Integer;
}
else /* PARSEOP_PLD_HEIGHT */
{
PldInfo.Height = (UINT16) Node->Asl.Child->Asl.Value.Integer;
}
break;
case PARSEOP_PLD_USERVISIBLE:
case PARSEOP_PLD_DOCK:
case PARSEOP_PLD_LID:
if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER)
{
AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL);
break;
}
if (Node->Asl.Child->Asl.Value.Integer > 1)
{
AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
break;
}
if (Node->Asl.ParseOpcode == PARSEOP_PLD_USERVISIBLE)
{
PldInfo.UserVisible = (UINT8) Node->Asl.Child->Asl.Value.Integer;
}
else if (Node->Asl.ParseOpcode == PARSEOP_PLD_DOCK)
{
PldInfo.Dock = (UINT8) Node->Asl.Child->Asl.Value.Integer;
}
else
{
PldInfo.Lid = (UINT8) Node->Asl.Child->Asl.Value.Integer;
}
break;
case PARSEOP_PLD_PANEL:
if (Node->Asl.Child->Asl.ParseOpcode == PARSEOP_INTEGER)
{
if (Node->Asl.Child->Asl.Value.Integer > 6)
{
AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
break;
}
}
else /* PARSEOP_STRING */
{
if (!OpcFindName(AslPldPanelList,
Node->Asl.Child->Asl.Value.String,
&Node->Asl.Child->Asl.Value.Integer))
{
AslError(ASL_ERROR, ASL_MSG_INVALID_OPERAND, Node, NULL);
break;
}
}
PldInfo.Panel = (UINT8) Node->Asl.Child->Asl.Value.Integer;
break;
case PARSEOP_PLD_VERTICALPOSITION:
if (Node->Asl.Child->Asl.ParseOpcode == PARSEOP_INTEGER)
{
if (Node->Asl.Child->Asl.Value.Integer > 2)
{
AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
break;
}
}
else /* PARSEOP_STRING */
{
if (!OpcFindName(AslPldVerticalPositionList,
Node->Asl.Child->Asl.Value.String,
&Node->Asl.Child->Asl.Value.Integer))
{
AslError(ASL_ERROR, ASL_MSG_INVALID_OPERAND, Node, NULL);
break;
}
}
PldInfo.VerticalPosition = (UINT8) Node->Asl.Child->Asl.Value.Integer;
break;
case PARSEOP_PLD_HORIZONTALPOSITION:
if (Node->Asl.Child->Asl.ParseOpcode == PARSEOP_INTEGER)
{
if (Node->Asl.Child->Asl.Value.Integer > 2)
{
AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
break;
}
}
else /* PARSEOP_STRING */
{
if (!OpcFindName(AslPldHorizontalPositionList,
Node->Asl.Child->Asl.Value.String,
&Node->Asl.Child->Asl.Value.Integer))
{
AslError(ASL_ERROR, ASL_MSG_INVALID_OPERAND, Node, NULL);
break;
}
}
PldInfo.HorizontalPosition = (UINT8) Node->Asl.Child->Asl.Value.Integer;
break;
case PARSEOP_PLD_SHAPE:
if (Node->Asl.Child->Asl.ParseOpcode == PARSEOP_INTEGER)
{
if (Node->Asl.Child->Asl.Value.Integer > 8)
{
AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
break;
}
}
else /* PARSEOP_STRING */
{
if (!OpcFindName(AslPldShapeList,
Node->Asl.Child->Asl.Value.String,
&Node->Asl.Child->Asl.Value.Integer))
{
AslError(ASL_ERROR, ASL_MSG_INVALID_OPERAND, Node, NULL);
break;
}
}
PldInfo.Shape = (UINT8) Node->Asl.Child->Asl.Value.Integer;
break;
case PARSEOP_PLD_GROUPORIENTATION:
if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER)
{
AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL);
break;
}
if (Node->Asl.Child->Asl.Value.Integer > 1)
{
AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
break;
}
PldInfo.GroupOrientation = (UINT8) Node->Asl.Child->Asl.Value.Integer;
break;
case PARSEOP_PLD_GROUPTOKEN:
case PARSEOP_PLD_GROUPPOSITION:
if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER)
{
AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL);
break;
}
if (Node->Asl.Child->Asl.Value.Integer > 255)
{
AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
break;
}
if (Node->Asl.ParseOpcode == PARSEOP_PLD_GROUPTOKEN)
{
PldInfo.GroupToken = (UINT8) Node->Asl.Child->Asl.Value.Integer;
}
else /* PARSEOP_PLD_GROUPPOSITION */
{
PldInfo.GroupPosition = (UINT8) Node->Asl.Child->Asl.Value.Integer;
}
break;
case PARSEOP_PLD_BAY:
case PARSEOP_PLD_EJECTABLE:
case PARSEOP_PLD_EJECTREQUIRED:
if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER)
{
AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL);
break;
}
if (Node->Asl.Child->Asl.Value.Integer > 1)
{
AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
break;
}
if (Node->Asl.ParseOpcode == PARSEOP_PLD_BAY)
{
PldInfo.Bay = (UINT8) Node->Asl.Child->Asl.Value.Integer;
}
else if (Node->Asl.ParseOpcode == PARSEOP_PLD_EJECTABLE)
{
PldInfo.Ejectable = (UINT8) Node->Asl.Child->Asl.Value.Integer;
}
else /* PARSEOP_PLD_EJECTREQUIRED */
{
PldInfo.OspmEjectRequired = (UINT8) Node->Asl.Child->Asl.Value.Integer;
}
break;
case PARSEOP_PLD_CABINETNUMBER:
case PARSEOP_PLD_CARDCAGENUMBER:
if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER)
{
AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL);
break;
}
if (Node->Asl.Child->Asl.Value.Integer > 255)
{
AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
break;
}
if (Node->Asl.ParseOpcode == PARSEOP_PLD_CABINETNUMBER)
{
PldInfo.CabinetNumber = (UINT8) Node->Asl.Child->Asl.Value.Integer;
}
else /* PARSEOP_PLD_CARDCAGENUMBER */
{
PldInfo.CardCageNumber = (UINT8) Node->Asl.Child->Asl.Value.Integer;
}
break;
case PARSEOP_PLD_REFERENCE:
if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER)
{
AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL);
break;
}
if (Node->Asl.Child->Asl.Value.Integer > 1)
{
AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
break;
}
PldInfo.Reference = (UINT8) Node->Asl.Child->Asl.Value.Integer;
break;
case PARSEOP_PLD_ROTATION:
if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER)
{
AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL);
break;
}
if (Node->Asl.Child->Asl.Value.Integer > 7)
{
switch (Node->Asl.Child->Asl.Value.Integer)
{
case 45:
Node->Asl.Child->Asl.Value.Integer = 1;
break;
case 90:
Node->Asl.Child->Asl.Value.Integer = 2;
break;
case 135:
Node->Asl.Child->Asl.Value.Integer = 3;
break;
case 180:
Node->Asl.Child->Asl.Value.Integer = 4;
break;
case 225:
Node->Asl.Child->Asl.Value.Integer = 5;
break;
case 270:
Node->Asl.Child->Asl.Value.Integer = 6;
break;
case 315:
Node->Asl.Child->Asl.Value.Integer = 7;
break;
default:
AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
break;
}
}
PldInfo.Rotation = (UINT8) Node->Asl.Child->Asl.Value.Integer;
break;
case PARSEOP_PLD_ORDER:
if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER)
{
AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL);
break;
}
if (Node->Asl.Child->Asl.Value.Integer > 31)
{
AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
break;
}
PldInfo.Order = (UINT8) Node->Asl.Child->Asl.Value.Integer;
break;
case PARSEOP_PLD_VERTICALOFFSET:
case PARSEOP_PLD_HORIZONTALOFFSET:
if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER)
{
AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL);
break;
}
if (Node->Asl.Child->Asl.Value.Integer > 65535)
{
AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL);
break;
}
if (Node->Asl.ParseOpcode == PARSEOP_PLD_VERTICALOFFSET)
{
PldInfo.VerticalOffset = (UINT16) Node->Asl.Child->Asl.Value.Integer;
}
else /* PARSEOP_PLD_HORIZONTALOFFSET */
{
PldInfo.HorizontalOffset = (UINT16) Node->Asl.Child->Asl.Value.Integer;
}
break;
default:
AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL);
break;
}
Node = Node->Asl.Next;
}
Buffer = OpcEncodePldBuffer(&PldInfo);
/* Change Op to a Buffer */
Op->Asl.ParseOpcode = PARSEOP_BUFFER;
Op->Common.AmlOpcode = AML_BUFFER_OP;
/* Disable further optimization */
Op->Asl.CompileFlags &= ~NODE_COMPILE_TIME_CONST;
UtSetParseOpName (Op);
/* Child node is the buffer length */
NewOp = TrAllocateNode (PARSEOP_INTEGER);
NewOp->Asl.AmlOpcode = AML_BYTE_OP;
NewOp->Asl.Value.Integer = 20;
NewOp->Asl.Parent = Op;
Op->Asl.Child = NewOp;
Op = NewOp;
/* Peer to the child is the raw buffer data */
NewOp = TrAllocateNode (PARSEOP_RAW_DATA);
NewOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER;
NewOp->Asl.AmlLength = 20;
NewOp->Asl.Value.String = ACPI_CAST_PTR (char, Buffer);
NewOp->Asl.Parent = Op->Asl.Parent;
Op->Asl.Next = NewOp;
}
/*******************************************************************************
*
* FUNCTION: OpcDoUuId
@ -1398,9 +703,9 @@ OpcDoUuId (
NewOp = TrAllocateNode (PARSEOP_INTEGER);
NewOp->Asl.AmlOpcode = AML_BYTE_OP;
NewOp->Asl.AmlOpcode = AML_BYTE_OP;
NewOp->Asl.Value.Integer = 16;
NewOp->Asl.Parent = Op;
NewOp->Asl.Parent = Op;
Op->Asl.Child = NewOp;
Op = NewOp;
@ -1408,10 +713,10 @@ OpcDoUuId (
/* Peer to the child is the raw buffer data */
NewOp = TrAllocateNode (PARSEOP_RAW_DATA);
NewOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER;
NewOp->Asl.AmlLength = 16;
NewOp->Asl.Value.String = ACPI_CAST_PTR (char, Buffer);
NewOp->Asl.Parent = Op->Asl.Parent;
NewOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER;
NewOp->Asl.AmlLength = 16;
NewOp->Asl.Value.String = ACPI_CAST_PTR (char, Buffer);
NewOp->Asl.Parent = Op->Asl.Parent;
Op->Asl.Next = NewOp;
}
@ -1507,14 +812,16 @@ OpcGenerateAmlOpcode (
case PARSEOP_INCLUDE:
Op->Asl.Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
Gbl_HasIncludeFiles = TRUE;
break;
case PARSEOP_EXTERNAL:
Op->Asl.Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
Op->Asl.Child->Asl.Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
if (Gbl_DoExternals == FALSE)
{
Op->Asl.Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
Op->Asl.Child->Asl.Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
}
break;
case PARSEOP_TIMER:

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -188,14 +188,16 @@ OpnDoMethod (
{
AslError (ASL_ERROR, ASL_MSG_SYNC_LEVEL, Next, NULL);
}
Concurrency = (UINT8) Next->Asl.Value.Integer;
}
/* Put the bits in their proper places */
MethodFlags = (UINT8) ((NumArgs & 0x7) |
((Serialized & 0x1) << 3) |
((Concurrency & 0xF) << 4));
MethodFlags = (UINT8)
((NumArgs & 0x7) |
((Serialized & 0x1) << 3) |
((Concurrency & 0xF) << 4));
/* Use the last node for the combined flags byte */
@ -272,9 +274,9 @@ OpnDoFieldCommon (
/* Set the node to RAW_DATA */
Next->Asl.Value.Integer = FieldFlags;
Next->Asl.AmlOpcode = AML_RAW_DATA_BYTE;
Next->Asl.AmlLength = 1;
Next->Asl.ParseOpcode = PARSEOP_RAW_DATA;
Next->Asl.AmlOpcode = AML_RAW_DATA_BYTE;
Next->Asl.AmlLength = 1;
Next->Asl.ParseOpcode = PARSEOP_RAW_DATA;
/* Process the FieldUnitList */
@ -345,8 +347,8 @@ OpnDoFieldCommon (
/* Named or reserved field entry */
PkgLengthNode = Next->Asl.Child;
NewBitOffset = (UINT32) PkgLengthNode->Asl.Value.Integer;
PkgLengthNode = Next->Asl.Child;
NewBitOffset = (UINT32) PkgLengthNode->Asl.Value.Integer;
CurrentBitOffset += NewBitOffset;
/* Save the current AccessAs value for error checking later */
@ -601,9 +603,9 @@ OpnDoBuffer (
{
/* For buffers, this is a list of raw bytes */
InitializerOp->Asl.AmlOpcode = AML_RAW_DATA_BYTE;
InitializerOp->Asl.AmlLength = 1;
InitializerOp->Asl.ParseOpcode = PARSEOP_RAW_DATA;
InitializerOp->Asl.AmlOpcode = AML_RAW_DATA_BYTE;
InitializerOp->Asl.AmlLength = 1;
InitializerOp->Asl.ParseOpcode = PARSEOP_RAW_DATA;
BufferLength++;
InitializerOp = ASL_GET_PEER_NODE (InitializerOp);
@ -618,9 +620,9 @@ OpnDoBuffer (
*/
BufferLength = strlen (InitializerOp->Asl.Value.String) + 1;
InitializerOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER;
InitializerOp->Asl.AmlLength = BufferLength;
InitializerOp->Asl.ParseOpcode = PARSEOP_RAW_DATA;
InitializerOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER;
InitializerOp->Asl.AmlLength = BufferLength;
InitializerOp->Asl.ParseOpcode = PARSEOP_RAW_DATA;
break;
case PARSEOP_RAW_DATA:
@ -636,7 +638,7 @@ OpnDoBuffer (
AslError (ASL_ERROR, ASL_MSG_INVALID_OPERAND, InitializerOp,
"Unknown buffer initializer opcode");
printf ("Unknown buffer initializer opcode [%s]\n",
UtGetOpName (InitializerOp->Asl.ParseOpcode));
UtGetOpName (InitializerOp->Asl.ParseOpcode));
return;
}
@ -660,8 +662,8 @@ OpnDoBuffer (
* Just set the buffer size node to be the buffer length, regardless
* of whether it was previously an integer or a default_arg placeholder
*/
BufferLengthOp->Asl.ParseOpcode = PARSEOP_INTEGER;
BufferLengthOp->Asl.AmlOpcode = AML_DWORD_OP;
BufferLengthOp->Asl.ParseOpcode = PARSEOP_INTEGER;
BufferLengthOp->Asl.AmlOpcode = AML_DWORD_OP;
BufferLengthOp->Asl.Value.Integer = BufferLength;
(void) OpcSetOptimalIntegerSize (BufferLengthOp);
@ -839,9 +841,9 @@ OpnDoLoadTable (
Next = Next->Asl.Next;
if (Next->Asl.ParseOpcode == PARSEOP_ZERO)
{
Next->Asl.ParseOpcode = PARSEOP_STRING_LITERAL;
Next->Asl.Value.String = "\\";
Next->Asl.AmlLength = 2;
Next->Asl.ParseOpcode = PARSEOP_STRING_LITERAL;
Next->Asl.Value.String = "\\";
Next->Asl.AmlLength = 2;
OpcGenerateAmlOpcode (Next);
}
@ -923,6 +925,7 @@ OpnDoDefinitionBlock (
Gbl_OutputFilenamePrefix = Filename;
UtConvertBackslashes (Gbl_OutputFilenamePrefix);
}
Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
/* Signature */
@ -1046,15 +1049,12 @@ OpnAttachNameToNode (
ACPI_PARSE_OBJECT *Child = NULL;
if (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL)
{
Child = UtGetArg (Op, 0);
}
else switch (Op->Asl.AmlOpcode)
switch (Op->Asl.AmlOpcode)
{
case AML_DATA_REGION_OP:
case AML_DEVICE_OP:
case AML_EVENT_OP:
case AML_EXTERNAL_OP:
case AML_METHOD_OP:
case AML_MUTEX_OP:
case AML_REGION_OP:
@ -1131,7 +1131,7 @@ OpnGenerateAmlOperands (
switch (Op->Asl.ParseOpcode)
{
case PARSEOP_DEFINITIONBLOCK:
case PARSEOP_DEFINITION_BLOCK:
OpnDoDefinitionBlock (Op);
break;
@ -1185,9 +1185,6 @@ OpnGenerateAmlOperands (
case PARSEOP_NAMESTRING:
case PARSEOP_METHODCALL:
case PARSEOP_STRING_LITERAL:
break;
default:
break;

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -53,7 +53,7 @@
ACPI_MODULE_NAME ("aslopt")
static UINT32 OptTotal = 0;
static UINT32 OptTotal = 0;
/* Local prototypes */
@ -132,15 +132,15 @@ OptSearchToRoot (
* name in the search path before the one we want, the nodes will
* not match, and we cannot use this optimization.
*/
Path = &(((char *) TargetPath->Pointer)[TargetPath->Length -
ACPI_NAME_SIZE]),
Path = &(((char *) TargetPath->Pointer)[
TargetPath->Length - ACPI_NAME_SIZE]),
ScopeInfo.Scope.Node = CurrentNode;
/* Lookup the NameSeg using SEARCH_PARENT (search-to-root) */
Status = AcpiNsLookup (&ScopeInfo, Path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
WalkState, &(Node));
ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
WalkState, &(Node));
if (ACPI_FAILURE (Status))
{
return (Status);
@ -172,8 +172,8 @@ OptSearchToRoot (
if (strncmp (*NewPath, "_T_", 3))
{
AslError (ASL_OPTIMIZATION, ASL_MSG_SINGLE_NAME_OPTIMIZATION, Op,
*NewPath);
AslError (ASL_OPTIMIZATION, ASL_MSG_SINGLE_NAME_OPTIMIZATION,
Op, *NewPath);
}
return (AE_OK);
@ -217,7 +217,7 @@ OptBuildShortestPath (
UINT32 Index;
UINT32 NumCarats;
UINT32 i;
char *NewPath;
char *NewPathInternal;
char *NewPathExternal;
ACPI_NAMESPACE_NODE *Node;
ACPI_GENERIC_STATE ScopeInfo;
@ -253,11 +253,11 @@ OptBuildShortestPath (
{
/* Compare two single NameSegs */
Index = (NumCommonSegments * ACPI_PATH_SEGMENT_LENGTH) + 1;
if (!ACPI_COMPARE_NAME (
&((char *) TargetPath->Pointer)[
(NumCommonSegments * ACPI_PATH_SEGMENT_LENGTH) + 1],
&((char *) CurrentPath->Pointer)[
(NumCommonSegments * ACPI_PATH_SEGMENT_LENGTH) + 1]))
&(ACPI_CAST_PTR (char, TargetPath->Pointer)) [Index],
&(ACPI_CAST_PTR (char, CurrentPath->Pointer)) [Index]))
{
/* Mismatch */
@ -292,13 +292,13 @@ OptBuildShortestPath (
/* Determine how many prefix Carats are required */
NumCarats = (CurrentPath->Length / ACPI_PATH_SEGMENT_LENGTH) -
NumCommonSegments;
NumCommonSegments;
/*
* Construct a new target string
*/
NewPathExternal = ACPI_ALLOCATE_ZEROED (
TargetPath->Length + NumCarats + 1);
NewPathExternal =
ACPI_ALLOCATE_ZEROED (TargetPath->Length + NumCarats + 1);
/* Insert the Carats into the Target string */
@ -315,7 +315,8 @@ OptBuildShortestPath (
/* Special handling for exact subpath in a name declaration */
if (IsDeclaration && SubPath && (CurrentPath->Length > TargetPath->Length))
if (IsDeclaration && SubPath &&
(CurrentPath->Length > TargetPath->Length))
{
/*
* The current path is longer than the target, and the target is a
@ -341,7 +342,8 @@ OptBuildShortestPath (
Index = TargetPath->Length;
}
strcpy (&NewPathExternal[i], &((char *) TargetPath->Pointer)[Index]);
strcpy (&NewPathExternal[i],
&(ACPI_CAST_PTR (char, TargetPath->Pointer))[Index]);
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " %-24s", NewPathExternal));
/*
@ -349,22 +351,24 @@ OptBuildShortestPath (
* string to make sure that this is in fact an optimization. If the
* original string is already optimal, there is no point in continuing.
*/
Status = AcpiNsInternalizeName (NewPathExternal, &NewPath);
Status = AcpiNsInternalizeName (NewPathExternal, &NewPathInternal);
if (ACPI_FAILURE (Status))
{
AslCoreSubsystemError (Op, Status, "Internalizing new NamePath",
ASL_NO_ABORT);
ACPI_FREE (NewPathExternal);
return (Status);
goto Cleanup;
}
if (strlen (NewPath) >= AmlNameStringLength)
if (strlen (NewPathInternal) >= AmlNameStringLength)
{
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS,
" NOT SHORTER (New %u old %u)",
(UINT32) strlen (NewPath), (UINT32) AmlNameStringLength));
ACPI_FREE (NewPathExternal);
return (AE_NOT_FOUND);
(UINT32) strlen (NewPathInternal),
(UINT32) AmlNameStringLength));
ACPI_FREE (NewPathInternal);
Status = AE_NOT_FOUND;
goto Cleanup;
}
/*
@ -372,9 +376,9 @@ OptBuildShortestPath (
* looking for. This is simply a sanity check on the new
* path that has been created.
*/
Status = AcpiNsLookup (&ScopeInfo, NewPath,
ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
ACPI_NS_DONT_OPEN_SCOPE, WalkState, &(Node));
Status = AcpiNsLookup (&ScopeInfo, NewPathInternal,
ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
ACPI_NS_DONT_OPEN_SCOPE, WalkState, &(Node));
if (ACPI_SUCCESS (Status))
{
/* Found the namepath, but make sure the node is correct */
@ -385,7 +389,7 @@ OptBuildShortestPath (
AslError (ASL_OPTIMIZATION, ASL_MSG_NAME_OPTIMIZATION,
Op, NewPathExternal);
*ReturnNewPath = NewPath;
*ReturnNewPath = NewPathInternal;
}
else
{
@ -401,11 +405,15 @@ OptBuildShortestPath (
{
/* The lookup failed, we obviously cannot use this optimization */
ACPI_FREE (NewPathInternal);
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " ***** NOT FOUND"));
AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Op,
"Not using optimized name - did not find node");
}
Cleanup:
ACPI_FREE (NewPathExternal);
return (Status);
}
@ -446,7 +454,7 @@ OptOptimizeNameDeclaration (
if (((CurrentNode == AcpiGbl_RootNode) ||
(Op->Common.Parent->Asl.ParseOpcode == PARSEOP_DEFINITIONBLOCK)) &&
(Op->Common.Parent->Asl.ParseOpcode == PARSEOP_DEFINITION_BLOCK)) &&
(ACPI_IS_ROOT_PREFIX (AmlNameString[0])))
{
/*
@ -458,7 +466,7 @@ OptOptimizeNameDeclaration (
/* Debug output */
Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, *NewPath,
NULL, &NewPathExternal);
NULL, &NewPathExternal);
if (ACPI_FAILURE (Status))
{
AslCoreSubsystemError (Op, Status, "Externalizing NamePath",
@ -474,8 +482,8 @@ OptOptimizeNameDeclaration (
* We know that we are at the root, so NULL is used for the scope.
*/
Status = AcpiNsLookup (NULL, *NewPath,
ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
ACPI_NS_DONT_OPEN_SCOPE, WalkState, &(Node));
ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
ACPI_NS_DONT_OPEN_SCOPE, WalkState, &(Node));
if (ACPI_SUCCESS (Status))
{
/* Found the namepath, but make sure the node is correct */
@ -633,6 +641,7 @@ OptOptimizeNamePath (
{
NextOp = NextOp->Asl.Parent;
}
if (NextOp && NextOp->Asl.Node)
{
CurrentNode = NextOp->Asl.Node;
@ -662,6 +671,7 @@ OptOptimizeNamePath (
ASL_NO_ABORT);
return_VOID;
}
TargetPath.Length--; /* Subtract one for null terminator */
/* CurrentPath is the path to this scope (where we are in the namespace) */
@ -674,12 +684,13 @@ OptOptimizeNamePath (
ASL_NO_ABORT);
return_VOID;
}
CurrentPath.Length--; /* Subtract one for null terminator */
/* Debug output only */
Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, AmlNameString,
NULL, &ExternalNameString);
NULL, &ExternalNameString);
if (ACPI_FAILURE (Status))
{
AslCoreSubsystemError (Op, Status, "Externalizing NamePath",
@ -705,7 +716,7 @@ OptOptimizeNamePath (
* a reference.
*/
Status = OptOptimizeNameDeclaration (Op, WalkState, CurrentNode,
TargetNode, AmlNameString, &NewPath);
TargetNode, AmlNameString, &NewPath);
if (ACPI_FAILURE (Status))
{
/*
@ -713,8 +724,8 @@ OptOptimizeNamePath (
* optimize the namestring with carats (up-arrow)
*/
Status = OptBuildShortestPath (Op, WalkState, CurrentNode,
TargetNode, &CurrentPath, &TargetPath,
AmlNameStringLength, 1, &NewPath);
TargetNode, &CurrentPath, &TargetPath,
AmlNameStringLength, 1, &NewPath);
}
}
else
@ -726,7 +737,7 @@ OptOptimizeNamePath (
* NameSeg of the NamePath
*/
Status = OptSearchToRoot (Op, WalkState, CurrentNode,
TargetNode, &TargetPath, &NewPath);
TargetNode, &TargetPath, &NewPath);
if (ACPI_FAILURE (Status))
{
/*
@ -734,8 +745,8 @@ OptOptimizeNamePath (
* optimize the namestring with carats (up-arrow)
*/
Status = OptBuildShortestPath (Op, WalkState, CurrentNode,
TargetNode, &CurrentPath, &TargetPath,
AmlNameStringLength, 0, &NewPath);
TargetNode, &CurrentPath, &TargetPath,
AmlNameStringLength, 0, &NewPath);
}
}

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -68,7 +68,7 @@ AslDoResponseFile (
#define ASL_TOKEN_SEPARATORS " \t\n"
#define ASL_SUPPORTED_OPTIONS "@:b|c|d^D:e:f^gh^i|I:l^m:no|p:P^r:s|t|T+G^v^w|x:z"
#define ASL_SUPPORTED_OPTIONS "@:a:b|c|d^D:e:f^gh^i|I:l^m:no|p:P^r:s|t|T+G^v^w|x:z"
/*******************************************************************************
@ -107,7 +107,7 @@ AslCommandLine (
if (Gbl_DoTemplates)
{
Status = DtCreateTemplates (Gbl_TemplateSignature);
Status = DtCreateTemplates (argv);
if (ACPI_FAILURE (Status))
{
exit (-1);
@ -184,6 +184,24 @@ AslDoOptions (
}
break;
case 'a': /* Debug options */
switch (AcpiGbl_Optarg[0])
{
case 'r':
Gbl_EnableReferenceTypechecking = TRUE;
break;
default:
printf ("Unknown option: -a%s\n", AcpiGbl_Optarg);
return (-1);
}
break;
case 'b': /* Debug options */
switch (AcpiGbl_Optarg[0])
@ -313,7 +331,8 @@ AslDoOptions (
Status = AcpiDmAddToExternalFileList (argv[AcpiGbl_Optind]);
if (ACPI_FAILURE (Status))
{
printf ("Could not add %s to external list\n", argv[AcpiGbl_Optind]);
printf ("Could not add %s to external list\n",
argv[AcpiGbl_Optind]);
return (-1);
}
@ -471,6 +490,13 @@ AslDoOptions (
Gbl_SourceOutputFlag = TRUE;
break;
case 'x':
/* Produce cross-reference file */
Gbl_CrossReferenceOutput = TRUE;
break;
default:
printf ("Unknown option: -l%s\n", AcpiGbl_Optarg);
@ -506,6 +532,20 @@ AslDoOptions (
Gbl_ReferenceOptimizationFlag = FALSE;
break;
case 'c':
/* Display compile time(s) */
Gbl_CompileTimesFlag = TRUE;
break;
case 'e':
/* Disable External opcode generation */
Gbl_DoExternals = FALSE;
break;
case 'f':
/* Disable folding on "normal" expressions */
@ -529,9 +569,9 @@ AslDoOptions (
case 't':
/* Display compile time(s) */
/* Disable heavy typechecking */
Gbl_CompileTimesFlag = TRUE;
Gbl_DoTypechecking = FALSE;
break;
default:
@ -636,7 +676,6 @@ AslDoOptions (
case 'T': /* Create a ACPI table template file */
Gbl_DoTemplates = TRUE;
Gbl_TemplateSignature = AcpiGbl_Optarg;
break;
case 'v': /* Version and verbosity settings */

View File

@ -6,7 +6,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -58,7 +58,7 @@
* each list element and possibly overflow on very large lists (>4000 items).
* This dramatically reduces use of the parse stack overall.
*
* ArgList, TermList, Objectlist, ByteList, DWordList, PackageList,
* ArgList, TermList, ByteList, DWordList, PackageList,
* ResourceMacroList, and FieldUnitList
*/
@ -99,7 +99,7 @@ AslLocalAllocate (
* These shift/reduce conflicts are expected. There should be zero
* reduce/reduce conflicts.
*/
%expect 89
%expect 101
/*! [Begin] no source code translation */
@ -122,6 +122,8 @@ m4_include(asltypes.y)
/* Production rules */
m4_include(aslrules.y)
m4_include(aslcstyle.y)
m4_include(aslresources.y)
%%
/*! [End] no source code translation !*/

View File

@ -0,0 +1,729 @@
/******************************************************************************
*
* Module Name: aslpld - Implementation of ASL ToPLD macro
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2016, 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 <contrib/dev/acpica/compiler/aslcompiler.h>
#include "aslcompiler.y.h"
#include <contrib/dev/acpica/include/amlcode.h>
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslpld")
/* Local prototypes */
static UINT8 *
OpcEncodePldBuffer (
ACPI_PLD_INFO *PldInfo);
static BOOLEAN
OpcFindName (
const char **List,
char *Name,
UINT32 *Index);
/*******************************************************************************
*
* FUNCTION: OpcDoPld
*
* PARAMETERS: Op - Current parse node
*
* RETURN: None
*
* DESCRIPTION: Convert ToPLD macro to 20-byte buffer
*
* The ToPLD parse tree looks like this:
*
* TOPLD
* PLD_REVISION
* INTEGER
* PLD_IGNORECOLOR
* INTEGER
* ...
* etc.
*
******************************************************************************/
void
OpcDoPld (
ACPI_PARSE_OBJECT *Op)
{
ACPI_PLD_INFO PldInfo;
UINT8 *Buffer;
ACPI_PARSE_OBJECT *ThisOp;
ACPI_PARSE_OBJECT *NewOp;
UINT16 ParseOpcode;
UINT32 Value;
if (!Op)
{
AslError (ASL_ERROR, ASL_MSG_NOT_EXIST, Op, NULL);
return;
}
if (Op->Asl.ParseOpcode != PARSEOP_TOPLD)
{
AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, Op, NULL);
return;
}
memset (&PldInfo, 0, sizeof (ACPI_PLD_INFO));
/* Traverse the list of PLD Ops (one per PLD field) */
ThisOp = Op->Asl.Child;
while (ThisOp)
{
/* Get child values */
ParseOpcode = ThisOp->Asl.Child->Asl.ParseOpcode;
Value = (UINT32) ThisOp->Asl.Child->Asl.Value.Integer;
switch (ThisOp->Asl.ParseOpcode)
{
case PARSEOP_PLD_REVISION:
if (ParseOpcode != PARSEOP_INTEGER)
{
AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL);
break;
}
if (Value > 127)
{
AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);
break;
}
PldInfo.Revision = (UINT8) Value;
break;
case PARSEOP_PLD_IGNORECOLOR:
if (ParseOpcode != PARSEOP_INTEGER)
{
AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL);
break;
}
if (Value > 1)
{
AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);
break;
}
PldInfo.IgnoreColor = (UINT8) Value;
break;
case PARSEOP_PLD_RED:
case PARSEOP_PLD_GREEN:
case PARSEOP_PLD_BLUE:
if (ParseOpcode != PARSEOP_INTEGER)
{
AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);
break;
}
if (Value > 255)
{
AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);
break;
}
if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_RED)
{
PldInfo.Red = (UINT8) Value;
}
else if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_GREEN)
{
PldInfo.Green = (UINT8) Value;
}
else /* PARSEOP_PLD_BLUE */
{
PldInfo.Blue = (UINT8) Value;
}
break;
case PARSEOP_PLD_WIDTH:
case PARSEOP_PLD_HEIGHT:
if (ParseOpcode != PARSEOP_INTEGER)
{
AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL);
break;
}
if (Value > 65535)
{
AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);
break;
}
if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_WIDTH)
{
PldInfo.Width = (UINT16) Value;
}
else /* PARSEOP_PLD_HEIGHT */
{
PldInfo.Height = (UINT16) Value;
}
break;
case PARSEOP_PLD_USERVISIBLE:
case PARSEOP_PLD_DOCK:
case PARSEOP_PLD_LID:
if (ParseOpcode != PARSEOP_INTEGER)
{
AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL);
break;
}
if (Value > 1)
{
AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);
break;
}
if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_USERVISIBLE)
{
PldInfo.UserVisible = (UINT8) Value;
}
else if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_DOCK)
{
PldInfo.Dock = (UINT8) Value;
}
else
{
PldInfo.Lid = (UINT8) Value;
}
break;
case PARSEOP_PLD_PANEL:
if (ParseOpcode == PARSEOP_INTEGER)
{
if (Value > 6)
{
AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);
break;
}
}
else /* PARSEOP_STRING */
{
if (!OpcFindName (AcpiGbl_PldPanelList,
ThisOp->Asl.Child->Asl.Value.String,
&Value))
{
AslError (ASL_ERROR, ASL_MSG_INVALID_OPERAND, ThisOp, NULL);
break;
}
}
PldInfo.Panel = (UINT8) Value;
break;
case PARSEOP_PLD_VERTICALPOSITION:
if (ParseOpcode == PARSEOP_INTEGER)
{
if (Value > 2)
{
AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);
break;
}
}
else /* PARSEOP_STRING */
{
if (!OpcFindName (AcpiGbl_PldVerticalPositionList,
ThisOp->Asl.Child->Asl.Value.String,
&Value))
{
AslError (ASL_ERROR, ASL_MSG_INVALID_OPERAND, ThisOp, NULL);
break;
}
}
PldInfo.VerticalPosition = (UINT8) Value;
break;
case PARSEOP_PLD_HORIZONTALPOSITION:
if (ParseOpcode == PARSEOP_INTEGER)
{
if (Value > 2)
{
AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);
break;
}
}
else /* PARSEOP_STRING */
{
if (!OpcFindName (AcpiGbl_PldHorizontalPositionList,
ThisOp->Asl.Child->Asl.Value.String,
&Value))
{
AslError (ASL_ERROR, ASL_MSG_INVALID_OPERAND, ThisOp, NULL);
break;
}
}
PldInfo.HorizontalPosition = (UINT8) Value;
break;
case PARSEOP_PLD_SHAPE:
if (ParseOpcode == PARSEOP_INTEGER)
{
if (Value > 8)
{
AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);
break;
}
}
else /* PARSEOP_STRING */
{
if (!OpcFindName (AcpiGbl_PldShapeList,
ThisOp->Asl.Child->Asl.Value.String,
&Value))
{
AslError (ASL_ERROR, ASL_MSG_INVALID_OPERAND, ThisOp, NULL);
break;
}
}
PldInfo.Shape = (UINT8) Value;
break;
case PARSEOP_PLD_GROUPORIENTATION:
if (ParseOpcode != PARSEOP_INTEGER)
{
AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL);
break;
}
if (Value > 1)
{
AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);
break;
}
PldInfo.GroupOrientation = (UINT8) Value;
break;
case PARSEOP_PLD_GROUPTOKEN:
case PARSEOP_PLD_GROUPPOSITION:
if (ParseOpcode != PARSEOP_INTEGER)
{
AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL);
break;
}
if (Value > 255)
{
AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);
break;
}
if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_GROUPTOKEN)
{
PldInfo.GroupToken = (UINT8) Value;
}
else /* PARSEOP_PLD_GROUPPOSITION */
{
PldInfo.GroupPosition = (UINT8) Value;
}
break;
case PARSEOP_PLD_BAY:
case PARSEOP_PLD_EJECTABLE:
case PARSEOP_PLD_EJECTREQUIRED:
if (ParseOpcode != PARSEOP_INTEGER)
{
AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL);
break;
}
if (Value > 1)
{
AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);
break;
}
if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_BAY)
{
PldInfo.Bay = (UINT8) Value;
}
else if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_EJECTABLE)
{
PldInfo.Ejectable = (UINT8) Value;
}
else /* PARSEOP_PLD_EJECTREQUIRED */
{
PldInfo.OspmEjectRequired = (UINT8) Value;
}
break;
case PARSEOP_PLD_CABINETNUMBER:
case PARSEOP_PLD_CARDCAGENUMBER:
if (ParseOpcode != PARSEOP_INTEGER)
{
AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL);
break;
}
if (Value > 255)
{
AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);
break;
}
if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_CABINETNUMBER)
{
PldInfo.CabinetNumber = (UINT8) Value;
}
else /* PARSEOP_PLD_CARDCAGENUMBER */
{
PldInfo.CardCageNumber = (UINT8) Value;
}
break;
case PARSEOP_PLD_REFERENCE:
if (ParseOpcode != PARSEOP_INTEGER)
{
AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL);
break;
}
if (Value > 1)
{
AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);
break;
}
PldInfo.Reference = (UINT8) Value;
break;
case PARSEOP_PLD_ROTATION:
if (ParseOpcode != PARSEOP_INTEGER)
{
AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL);
break;
}
if (Value > 7)
{
switch (Value)
{
case 45:
Value = 1;
break;
case 90:
Value = 2;
break;
case 135:
Value = 3;
break;
case 180:
Value = 4;
break;
case 225:
Value = 5;
break;
case 270:
Value = 6;
break;
case 315:
Value = 7;
break;
default:
AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);
break;
}
}
PldInfo.Rotation = (UINT8) Value;
break;
case PARSEOP_PLD_ORDER:
if (ParseOpcode != PARSEOP_INTEGER)
{
AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL);
break;
}
if (Value > 31)
{
AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);
break;
}
PldInfo.Order = (UINT8) Value;
break;
case PARSEOP_PLD_VERTICALOFFSET:
case PARSEOP_PLD_HORIZONTALOFFSET:
if (ParseOpcode != PARSEOP_INTEGER)
{
AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL);
break;
}
if (Value > 65535)
{
AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);
break;
}
if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_VERTICALOFFSET)
{
PldInfo.VerticalOffset = (UINT16) Value;
}
else /* PARSEOP_PLD_HORIZONTALOFFSET */
{
PldInfo.HorizontalOffset = (UINT16) Value;
}
break;
default:
AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL);
break;
}
ThisOp = ThisOp->Asl.Next;
}
Buffer = OpcEncodePldBuffer (&PldInfo);
/* Change Op to a Buffer */
Op->Asl.ParseOpcode = PARSEOP_BUFFER;
Op->Common.AmlOpcode = AML_BUFFER_OP;
/* Disable further optimization */
Op->Asl.CompileFlags &= ~NODE_COMPILE_TIME_CONST;
UtSetParseOpName (Op);
/* Child node is the buffer length */
NewOp = TrAllocateNode (PARSEOP_INTEGER);
NewOp->Asl.AmlOpcode = AML_BYTE_OP;
NewOp->Asl.Value.Integer = 20;
NewOp->Asl.Parent = Op;
Op->Asl.Child = NewOp;
Op = NewOp;
/* Peer to the child is the raw buffer data */
NewOp = TrAllocateNode (PARSEOP_RAW_DATA);
NewOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER;
NewOp->Asl.AmlLength = 20;
NewOp->Asl.Value.String = ACPI_CAST_PTR (char, Buffer);
NewOp->Asl.Parent = Op->Asl.Parent;
Op->Asl.Next = NewOp;
}
/*******************************************************************************
*
* FUNCTION: OpcEncodePldBuffer
*
* PARAMETERS: PldInfo - _PLD buffer struct (Using local struct)
*
* RETURN: Encode _PLD buffer suitable for return value from _PLD
*
* DESCRIPTION: Bit-packs a _PLD buffer struct.
*
******************************************************************************/
static UINT8 *
OpcEncodePldBuffer (
ACPI_PLD_INFO *PldInfo)
{
UINT32 *Buffer;
UINT32 Dword;
Buffer = ACPI_ALLOCATE_ZEROED (ACPI_PLD_BUFFER_SIZE);
if (!Buffer)
{
return (NULL);
}
/* First 32 bits */
Dword = 0;
ACPI_PLD_SET_REVISION (&Dword, PldInfo->Revision);
ACPI_PLD_SET_IGNORE_COLOR (&Dword, PldInfo->IgnoreColor);
ACPI_PLD_SET_RED (&Dword, PldInfo->Red);
ACPI_PLD_SET_GREEN (&Dword, PldInfo->Green);
ACPI_PLD_SET_BLUE (&Dword, PldInfo->Blue);
ACPI_MOVE_32_TO_32 (&Buffer[0], &Dword);
/* Second 32 bits */
Dword = 0;
ACPI_PLD_SET_WIDTH (&Dword, PldInfo->Width);
ACPI_PLD_SET_HEIGHT (&Dword, PldInfo->Height);
ACPI_MOVE_32_TO_32 (&Buffer[1], &Dword);
/* Third 32 bits */
Dword = 0;
ACPI_PLD_SET_USER_VISIBLE (&Dword, PldInfo->UserVisible);
ACPI_PLD_SET_DOCK (&Dword, PldInfo->Dock);
ACPI_PLD_SET_LID (&Dword, PldInfo->Lid);
ACPI_PLD_SET_PANEL (&Dword, PldInfo->Panel);
ACPI_PLD_SET_VERTICAL (&Dword, PldInfo->VerticalPosition);
ACPI_PLD_SET_HORIZONTAL (&Dword, PldInfo->HorizontalPosition);
ACPI_PLD_SET_SHAPE (&Dword, PldInfo->Shape);
ACPI_PLD_SET_ORIENTATION (&Dword, PldInfo->GroupOrientation);
ACPI_PLD_SET_TOKEN (&Dword, PldInfo->GroupToken);
ACPI_PLD_SET_POSITION (&Dword, PldInfo->GroupPosition);
ACPI_PLD_SET_BAY (&Dword, PldInfo->Bay);
ACPI_MOVE_32_TO_32 (&Buffer[2], &Dword);
/* Fourth 32 bits */
Dword = 0;
ACPI_PLD_SET_EJECTABLE (&Dword, PldInfo->Ejectable);
ACPI_PLD_SET_OSPM_EJECT (&Dword, PldInfo->OspmEjectRequired);
ACPI_PLD_SET_CABINET (&Dword, PldInfo->CabinetNumber);
ACPI_PLD_SET_CARD_CAGE (&Dword, PldInfo->CardCageNumber);
ACPI_PLD_SET_REFERENCE (&Dword, PldInfo->Reference);
ACPI_PLD_SET_ROTATION (&Dword, PldInfo->Rotation);
ACPI_PLD_SET_ORDER (&Dword, PldInfo->Order);
ACPI_MOVE_32_TO_32 (&Buffer[3], &Dword);
/* Revision 2 adds an additional DWORD */
if (PldInfo->Revision >= 2)
{
/* Fifth 32 bits */
Dword = 0;
ACPI_PLD_SET_VERT_OFFSET (&Dword, PldInfo->VerticalOffset);
ACPI_PLD_SET_HORIZ_OFFSET (&Dword, PldInfo->HorizontalOffset);
ACPI_MOVE_32_TO_32 (&Buffer[4], &Dword);
}
return (ACPI_CAST_PTR (UINT8, Buffer));
}
/*******************************************************************************
*
* FUNCTION: OpcFindName
*
* PARAMETERS: List - Array of char strings to be searched
* Name - Char string to string for
* Index - Index value to set if found
*
* RETURN: TRUE if any names matched, FALSE otherwise
*
* DESCRIPTION: Match PLD name to value in lookup table. Sets Value to
* equivalent parameter value.
*
******************************************************************************/
static BOOLEAN
OpcFindName (
const char **List,
char *Name,
UINT32 *Index)
{
const char *NameString;
UINT32 i;
AcpiUtStrupr (Name);
for (i = 0, NameString = List[0];
NameString;
i++, NameString = List[i])
{
if (!(strncmp (NameString, Name, strlen (Name))))
{
*Index = i;
return (TRUE);
}
}
return (FALSE);
}

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -259,7 +259,7 @@ ApCheckPredefinedReturnValue (
*/
Gbl_AllExceptionsDisabled = TRUE;
Index = ApCheckForPredefinedName (MethodInfo->Op,
MethodInfo->Op->Asl.NameSeg);
MethodInfo->Op->Asl.NameSeg);
Gbl_AllExceptionsDisabled = FALSE;
switch (Index)
@ -454,8 +454,8 @@ ApCheckForPredefinedName (
if (Name[0] == 0)
{
AcpiOsPrintf ("Found a null name, external = %s\n",
Op->Asl.ExternalName);
AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, Op,
"zero length name found");
}
/* All reserved names are prefixed with a single underscore */
@ -571,7 +571,8 @@ ApCheckForSpecialName (
* warning and force the user to manually change the names. So, we
* will issue a remark instead.
*/
AslError (ASL_REMARK, ASL_MSG_COMPILER_RESERVED, Op, Op->Asl.ExternalName);
AslError (ASL_REMARK, ASL_MSG_COMPILER_RESERVED,
Op, Op->Asl.ExternalName);
return (ACPI_COMPILER_RESERVED_NAME);
}
@ -580,8 +581,8 @@ ApCheckForSpecialName (
* warning, since the entire namespace starting with an underscore is
* reserved by the ACPI spec.
*/
AslError (ASL_WARNING, ASL_MSG_UNKNOWN_RESERVED_NAME, Op,
Op->Asl.ExternalName);
AslError (ASL_WARNING, ASL_MSG_UNKNOWN_RESERVED_NAME,
Op, Op->Asl.ExternalName);
return (ACPI_NOT_RESERVED_NAME);
}

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -52,7 +52,7 @@
/* Local prototypes */
static void
static ACPI_PARSE_OBJECT *
ApCheckPackageElements (
const char *PredefinedName,
ACPI_PARSE_OBJECT *Op,
@ -88,6 +88,11 @@ ApPackageTooLarge (
UINT32 Count,
UINT32 ExpectedCount);
static void
ApCustomPackage (
ACPI_PARSE_OBJECT *ParentOp,
const ACPI_PREDEFINED_INFO *Predefined);
/*******************************************************************************
*
@ -168,6 +173,11 @@ ApCheckPackage (
switch (Package->RetInfo.Type)
{
case ACPI_PTYPE_CUSTOM:
ApCustomPackage (ParentOp, Predefined);
break;
case ACPI_PTYPE1_FIXED:
/*
* The package count is fixed and there are no subpackages
@ -238,6 +248,7 @@ ApCheckPackage (
ApCheckObjectType (Predefined->Info.Name, Op,
Package->RetInfo3.TailObjectType, i);
}
Op = Op->Asl.Next;
}
break;
@ -379,6 +390,86 @@ ApCheckPackage (
}
/*******************************************************************************
*
* FUNCTION: ApCustomPackage
*
* PARAMETERS: ParentOp - Parse op for the package
* Predefined - Pointer to package-specific info for
* the method
*
* RETURN: None
*
* DESCRIPTION: Validate packages that don't fit into the standard model and
* require custom code.
*
* NOTE: Currently used for the _BIX method only. When needed for two or more
* methods, probably a detect/dispatch mechanism will be required.
*
******************************************************************************/
static void
ApCustomPackage (
ACPI_PARSE_OBJECT *ParentOp,
const ACPI_PREDEFINED_INFO *Predefined)
{
ACPI_PARSE_OBJECT *Op;
UINT32 Count;
UINT32 ExpectedCount;
UINT32 Version;
/* First child is the package length */
Op = ParentOp->Asl.Child;
Count = (UINT32) Op->Asl.Value.Integer;
/* Get the version number, must be Integer */
Op = Op->Asl.Next;
Version = (UINT32) Op->Asl.Value.Integer;
if (Op->Asl.ParseOpcode != PARSEOP_INTEGER)
{
AslError (ASL_ERROR, ASL_MSG_RESERVED_OPERAND_TYPE, Op, MsgBuffer);
return;
}
/* Validate count (# of elements) */
ExpectedCount = 21; /* Version 1 */
if (Version == 0)
{
ExpectedCount = 20; /* Version 0 */
}
if (Count < ExpectedCount)
{
ApPackageTooSmall (Predefined->Info.Name, ParentOp,
Count, ExpectedCount);
return;
}
else if (Count > ExpectedCount)
{
ApPackageTooLarge (Predefined->Info.Name, ParentOp,
Count, ExpectedCount);
}
/* Validate all elements of the package */
Op = ApCheckPackageElements (Predefined->Info.Name, Op,
ACPI_RTYPE_INTEGER, 16,
ACPI_RTYPE_STRING, 4);
/* Version 1 has a single trailing integer */
if (Version > 0)
{
ApCheckPackageElements (Predefined->Info.Name, Op,
ACPI_RTYPE_INTEGER, 1, 0, 0);
}
}
/*******************************************************************************
*
* FUNCTION: ApCheckPackageElements
@ -390,7 +481,9 @@ ApCheckPackage (
* Type2 - Object type for second group
* Count2 - Count for second group
*
* RETURN: None
* RETURN: Next Op peer in the parse tree, after all specified elements
* have been validated. Used for multiple validations (calls
* to this function).
*
* DESCRIPTION: Validate all elements of a package. Works with packages that
* are defined to contain up to two groups of different object
@ -398,7 +491,7 @@ ApCheckPackage (
*
******************************************************************************/
static void
static ACPI_PARSE_OBJECT *
ApCheckPackageElements (
const char *PredefinedName,
ACPI_PARSE_OBJECT *Op,
@ -430,6 +523,8 @@ ApCheckPackageElements (
ApCheckObjectType (PredefinedName, Op, Type2, (i + Count1));
Op = Op->Asl.Next;
}
return (Op);
}

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -63,6 +63,8 @@ PrPrintObjectAtLevel (
const char *ObjectName);
/* Structure used for the pruning parse tree walk */
typedef struct acpi_prune_info
{
UINT32 PruneLevel;
@ -120,7 +122,7 @@ AslPruneParseTree (
AcpiOsPrintf ("\nRemoving Objects:\n");
TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD,
TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD,
PrTreePruneWalk, NULL, ACPI_CAST_PTR (void, &PruneObj));
AcpiOsPrintf ("\n%u Total Objects Removed\n", PruneObj.Count);

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -396,6 +396,7 @@ RsGetStringDataLength (
{
return ((UINT16) (strlen (InitializerOp->Asl.Value.String) + 1));
}
InitializerOp = ASL_GET_PEER_NODE (InitializerOp);
}
@ -431,7 +432,6 @@ RsAllocateResourceNode (
Rnode->Buffer = UtLocalCalloc (Size);
Rnode->BufferLength = Size;
return (Rnode);
}
@ -467,7 +467,6 @@ RsCreateResourceField (
Op->Asl.ExternalName = Name;
Op->Asl.CompileFlags |= NODE_IS_RESOURCE_FIELD;
Op->Asl.Value.Tag.BitOffset = (ByteOffset * 8) + BitOffset;
Op->Asl.Value.Tag.BitLength = BitLength;
}
@ -866,16 +865,19 @@ RsDoOneResourceDescriptor (
break;
case PARSEOP_I2C_SERIALBUS:
case PARSEOP_I2C_SERIALBUS_V2:
Rnode = RsDoI2cSerialBusDescriptor (Info);
break;
case PARSEOP_SPI_SERIALBUS:
case PARSEOP_SPI_SERIALBUS_V2:
Rnode = RsDoSpiSerialBusDescriptor (Info);
break;
case PARSEOP_UART_SERIALBUS:
case PARSEOP_UART_SERIALBUS_V2:
Rnode = RsDoUartSerialBusDescriptor (Info);
break;
@ -888,7 +890,7 @@ RsDoOneResourceDescriptor (
default:
printf ("Unknown resource descriptor type [%s]\n",
Info->DescriptorTypeOp->Asl.ParseOpName);
Info->DescriptorTypeOp->Asl.ParseOpName);
break;
}
@ -904,7 +906,8 @@ RsDoOneResourceDescriptor (
if (Rnode)
{
Info->DescriptorTypeOp->Asl.FinalAmlLength = Rnode->BufferLength;
Info->DescriptorTypeOp->Asl.Extra = ((AML_RESOURCE *) Rnode->Buffer)->DescriptorType;
Info->DescriptorTypeOp->Asl.Extra =
((AML_RESOURCE *) Rnode->Buffer)->DescriptorType;
}
return (Rnode);

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -86,7 +86,6 @@ RsDoEndTagDescriptor (
Descriptor->EndTag.DescriptorType = ACPI_RESOURCE_NAME_END_TAG |
ASL_RDESC_END_TAG_SIZE;
Descriptor->EndTag.Checksum = 0;
return (Rnode);
}
@ -114,8 +113,8 @@ RsDoEndDependentDescriptor (
Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_END_DEPENDENT));
Descriptor = Rnode->Buffer;
Descriptor->EndDpf.DescriptorType = ACPI_RESOURCE_NAME_END_DEPENDENT |
ASL_RDESC_END_DEPEND_SIZE;
Descriptor->EndDpf.DescriptorType =
ACPI_RESOURCE_NAME_END_DEPENDENT | ASL_RDESC_END_DEPEND_SIZE;
return (Rnode);
}
@ -151,7 +150,7 @@ RsDoMemory24Descriptor (
Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_MEMORY24));
Descriptor = Rnode->Buffer;
Descriptor->Memory24.DescriptorType = ACPI_RESOURCE_NAME_MEMORY24;
Descriptor->Memory24.DescriptorType = ACPI_RESOURCE_NAME_MEMORY24;
Descriptor->Memory24.ResourceLength = 9;
/* Process all child initialization nodes */
@ -257,7 +256,7 @@ RsDoMemory32Descriptor (
Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_MEMORY32));
Descriptor = Rnode->Buffer;
Descriptor->Memory32.DescriptorType = ACPI_RESOURCE_NAME_MEMORY32;
Descriptor->Memory32.DescriptorType = ACPI_RESOURCE_NAME_MEMORY32;
Descriptor->Memory32.ResourceLength = 17;
/* Process all child initialization nodes */
@ -360,7 +359,7 @@ RsDoMemory32FixedDescriptor (
Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_FIXED_MEMORY32));
Descriptor = Rnode->Buffer;
Descriptor->FixedMemory32.DescriptorType = ACPI_RESOURCE_NAME_FIXED_MEMORY32;
Descriptor->FixedMemory32.DescriptorType = ACPI_RESOURCE_NAME_FIXED_MEMORY32;
Descriptor->FixedMemory32.ResourceLength = 9;
/* Process all child initialization nodes */
@ -448,8 +447,8 @@ RsDoStartDependentDescriptor (
/* Descriptor has priority byte */
Descriptor->StartDpf.DescriptorType = ACPI_RESOURCE_NAME_START_DEPENDENT |
(ASL_RDESC_ST_DEPEND_SIZE + 0x01);
Descriptor->StartDpf.DescriptorType =
ACPI_RESOURCE_NAME_START_DEPENDENT | (ASL_RDESC_ST_DEPEND_SIZE + 0x01);
/* Process all child initialization nodes */
@ -493,8 +492,8 @@ RsDoStartDependentDescriptor (
* must keep track of the offset of not only each descriptor, but each
* element (field) within each descriptor as well.
*/
CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode,
NextRnode);
CurrentByteOffset += RsLinkDescriptorChain (
&PreviousRnode, NextRnode);
break;
}
@ -536,8 +535,8 @@ RsDoStartDependentNoPriDescriptor (
Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_START_DEPENDENT_NOPRIO));
Descriptor = Rnode->Buffer;
Descriptor->StartDpf.DescriptorType = ACPI_RESOURCE_NAME_START_DEPENDENT |
ASL_RDESC_ST_DEPEND_SIZE;
Descriptor->StartDpf.DescriptorType =
ACPI_RESOURCE_NAME_START_DEPENDENT | ASL_RDESC_ST_DEPEND_SIZE;
PreviousRnode = Rnode;
/* Increment offset past StartDependentNoPri descriptor */
@ -599,7 +598,7 @@ RsDoVendorSmallDescriptor (
Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_VENDOR_SMALL) + 7);
Descriptor = Rnode->Buffer;
Descriptor->VendorSmall.DescriptorType = ACPI_RESOURCE_NAME_VENDOR_SMALL;
Descriptor->VendorSmall.DescriptorType = ACPI_RESOURCE_NAME_VENDOR_SMALL;
VendorData = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_SMALL_HEADER);
/* Process all child initialization nodes */

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -88,8 +88,8 @@ RsDoDmaDescriptor (
Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_DMA));
Descriptor = Rnode->Buffer;
Descriptor->Dma.DescriptorType = ACPI_RESOURCE_NAME_DMA |
ASL_RDESC_DMA_SIZE;
Descriptor->Dma.DescriptorType =
ACPI_RESOURCE_NAME_DMA | ASL_RDESC_DMA_SIZE;
/* Process all child initialization nodes */
@ -282,8 +282,8 @@ RsDoFixedIoDescriptor (
Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_FIXED_IO));
Descriptor = Rnode->Buffer;
Descriptor->Io.DescriptorType = ACPI_RESOURCE_NAME_FIXED_IO |
ASL_RDESC_FIXED_IO_SIZE;
Descriptor->Io.DescriptorType =
ACPI_RESOURCE_NAME_FIXED_IO | ASL_RDESC_FIXED_IO_SIZE;
/* Process all child initialization nodes */
@ -365,8 +365,8 @@ RsDoIoDescriptor (
Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IO));
Descriptor = Rnode->Buffer;
Descriptor->Io.DescriptorType = ACPI_RESOURCE_NAME_IO |
ASL_RDESC_IO_SIZE;
Descriptor->Io.DescriptorType =
ACPI_RESOURCE_NAME_IO | ASL_RDESC_IO_SIZE;
/* Process all child initialization nodes */
@ -476,8 +476,8 @@ RsDoIrqDescriptor (
/* Length = 3 (with flag byte) */
Descriptor = Rnode->Buffer;
Descriptor->Irq.DescriptorType = ACPI_RESOURCE_NAME_IRQ |
(ASL_RDESC_IRQ_SIZE + 0x01);
Descriptor->Irq.DescriptorType =
ACPI_RESOURCE_NAME_IRQ | (ASL_RDESC_IRQ_SIZE + 0x01);
/* Process all child initialization nodes */
@ -596,8 +596,8 @@ RsDoIrqNoFlagsDescriptor (
Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IRQ_NOFLAGS));
Descriptor = Rnode->Buffer;
Descriptor->Irq.DescriptorType = ACPI_RESOURCE_NAME_IRQ |
ASL_RDESC_IRQ_SIZE;
Descriptor->Irq.DescriptorType =
ACPI_RESOURCE_NAME_IRQ | ASL_RDESC_IRQ_SIZE;
/* Process all child initialization nodes */

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -147,6 +147,7 @@ RsDoGeneralRegisterDescriptor (
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
}
return (Rnode);
}
@ -213,7 +214,7 @@ RsDoInterruptDescriptor (
1 + OptionIndex + StringLength);
Descriptor = Rnode->Buffer;
Descriptor->ExtendedIrq.DescriptorType = ACPI_RESOURCE_NAME_EXTENDED_IRQ;
Descriptor->ExtendedIrq.DescriptorType = ACPI_RESOURCE_NAME_EXTENDED_IRQ;
/*
* Initial descriptor length -- may be enlarged if there are
@ -223,7 +224,7 @@ RsDoInterruptDescriptor (
Descriptor->ExtendedIrq.InterruptCount = 0;
Rover = ACPI_CAST_PTR (AML_RESOURCE,
(&(Descriptor->ExtendedIrq.Interrupts[0])));
(&(Descriptor->ExtendedIrq.Interrupts[0])));
/* Process all child initialization nodes */
@ -382,9 +383,10 @@ RsDoInterruptDescriptor (
(Descriptor->ExtendedIrq.ResourceLength + StringLength);
}
Rnode->BufferLength = (ASL_RESDESC_OFFSET (ExtendedIrq.Interrupts[0]) -
ASL_RESDESC_OFFSET (ExtendedIrq.DescriptorType))
+ OptionIndex + StringLength;
Rnode->BufferLength =
(ASL_RESDESC_OFFSET (ExtendedIrq.Interrupts[0]) -
ASL_RESDESC_OFFSET (ExtendedIrq.DescriptorType))
+ OptionIndex + StringLength;
return (Rnode);
}
@ -431,7 +433,7 @@ RsDoVendorLargeDescriptor (
Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_VENDOR_LARGE) + i);
Descriptor = Rnode->Buffer;
Descriptor->VendorLarge.DescriptorType = ACPI_RESOURCE_NAME_VENDOR_LARGE;
Descriptor->VendorLarge.DescriptorType = ACPI_RESOURCE_NAME_VENDOR_LARGE;
Descriptor->VendorLarge.ResourceLength = (UINT16) i;
/* Point to end-of-descriptor for vendor data */

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -91,11 +91,11 @@ RsDoDwordIoDescriptor (
CurrentByteOffset = Info->CurrentByteOffset;
Rnode = RsAllocateResourceNode (
sizeof (AML_RESOURCE_ADDRESS32) + 1 + StringLength);
sizeof (AML_RESOURCE_ADDRESS32) + 1 + StringLength);
Descriptor = Rnode->Buffer;
Descriptor->Address32.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS32;
Descriptor->Address32.ResourceType = ACPI_ADDRESS_TYPE_IO_RANGE;
Descriptor->Address32.ResourceType = ACPI_ADDRESS_TYPE_IO_RANGE;
/*
* Initial descriptor length -- may be enlarged if there are
@ -325,7 +325,7 @@ RsDoDwordMemoryDescriptor (
Descriptor = Rnode->Buffer;
Descriptor->Address32.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS32;
Descriptor->Address32.ResourceType = ACPI_ADDRESS_TYPE_MEMORY_RANGE;
Descriptor->Address32.ResourceType = ACPI_ADDRESS_TYPE_MEMORY_RANGE;
/*
* Initial descriptor length -- may be enlarged if there are
@ -556,7 +556,7 @@ RsDoDwordSpaceDescriptor (
CurrentByteOffset = Info->CurrentByteOffset;
Rnode = RsAllocateResourceNode (
sizeof (AML_RESOURCE_ADDRESS32) + 1 + StringLength);
sizeof (AML_RESOURCE_ADDRESS32) + 1 + StringLength);
Descriptor = Rnode->Buffer;
Descriptor->Address32.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS32;

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -87,14 +87,14 @@ RsDoExtendedIoDescriptor (
CurrentByteOffset = Info->CurrentByteOffset;
Rnode = RsAllocateResourceNode (
sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + 1 + StringLength);
sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + 1 + StringLength);
Descriptor = Rnode->Buffer;
Descriptor->ExtAddress64.DescriptorType = ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64;
Descriptor->ExtAddress64.ResourceType = ACPI_ADDRESS_TYPE_IO_RANGE;
Descriptor->ExtAddress64.RevisionID = AML_RESOURCE_EXTENDED_ADDRESS_REVISION;
Descriptor->ExtAddress64.DescriptorType = ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64;
Descriptor->ExtAddress64.ResourceType = ACPI_ADDRESS_TYPE_IO_RANGE;
Descriptor->ExtAddress64.RevisionID = AML_RESOURCE_EXTENDED_ADDRESS_REVISION;
Descriptor->ExtAddress64.ResourceLength = (UINT16)
Descriptor->ExtAddress64.ResourceLength = (UINT16)
(sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) -
sizeof (AML_RESOURCE_LARGE_HEADER));
@ -143,7 +143,7 @@ RsDoExtendedIoDescriptor (
RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity));
GranOp = InitializerOp;
break;
break;
case 6: /* Address Min */
@ -263,11 +263,11 @@ RsDoExtendedMemoryDescriptor (
sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + 1 + StringLength);
Descriptor = Rnode->Buffer;
Descriptor->ExtAddress64.DescriptorType = ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64;
Descriptor->ExtAddress64.ResourceType = ACPI_ADDRESS_TYPE_MEMORY_RANGE;
Descriptor->ExtAddress64.RevisionID = AML_RESOURCE_EXTENDED_ADDRESS_REVISION;
Descriptor->ExtAddress64.DescriptorType = ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64;
Descriptor->ExtAddress64.ResourceType = ACPI_ADDRESS_TYPE_MEMORY_RANGE;
Descriptor->ExtAddress64.RevisionID = AML_RESOURCE_EXTENDED_ADDRESS_REVISION;
Descriptor->ExtAddress64.ResourceLength = (UINT16)
Descriptor->ExtAddress64.ResourceLength = (UINT16)
(sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) -
sizeof (AML_RESOURCE_LARGE_HEADER));
@ -441,13 +441,13 @@ RsDoExtendedSpaceDescriptor (
CurrentByteOffset = Info->CurrentByteOffset;
Rnode = RsAllocateResourceNode (
sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + 1 + StringLength);
sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + 1 + StringLength);
Descriptor = Rnode->Buffer;
Descriptor->ExtAddress64.DescriptorType = ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64;
Descriptor->ExtAddress64.RevisionID = AML_RESOURCE_EXTENDED_ADDRESS_REVISION;
Descriptor->ExtAddress64.DescriptorType = ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64;
Descriptor->ExtAddress64.RevisionID = AML_RESOURCE_EXTENDED_ADDRESS_REVISION;
Descriptor->ExtAddress64.ResourceLength = (UINT16)
Descriptor->ExtAddress64.ResourceLength = (UINT16)
(sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) -
sizeof (AML_RESOURCE_LARGE_HEADER));

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -91,11 +91,11 @@ RsDoQwordIoDescriptor (
CurrentByteOffset = Info->CurrentByteOffset;
Rnode = RsAllocateResourceNode (
sizeof (AML_RESOURCE_ADDRESS64) + 1 + StringLength);
sizeof (AML_RESOURCE_ADDRESS64) + 1 + StringLength);
Descriptor = Rnode->Buffer;
Descriptor->Address64.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS64;
Descriptor->Address64.ResourceType = ACPI_ADDRESS_TYPE_IO_RANGE;
Descriptor->Address64.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS64;
Descriptor->Address64.ResourceType = ACPI_ADDRESS_TYPE_IO_RANGE;
/*
* Initial descriptor length -- may be enlarged if there are
@ -312,11 +312,11 @@ RsDoQwordMemoryDescriptor (
CurrentByteOffset = Info->CurrentByteOffset;
Rnode = RsAllocateResourceNode (
sizeof (AML_RESOURCE_ADDRESS64) + 1 + StringLength);
sizeof (AML_RESOURCE_ADDRESS64) + 1 + StringLength);
Descriptor = Rnode->Buffer;
Descriptor->Address64.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS64;
Descriptor->Address64.ResourceType = ACPI_ADDRESS_TYPE_MEMORY_RANGE;
Descriptor->Address64.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS64;
Descriptor->Address64.ResourceType = ACPI_ADDRESS_TYPE_MEMORY_RANGE;
/*
* Initial descriptor length -- may be enlarged if there are
@ -541,7 +541,7 @@ RsDoQwordSpaceDescriptor (
CurrentByteOffset = Info->CurrentByteOffset;
Rnode = RsAllocateResourceNode (
sizeof (AML_RESOURCE_ADDRESS64) + 1 + StringLength);
sizeof (AML_RESOURCE_ADDRESS64) + 1 + StringLength);
Descriptor = Rnode->Buffer;
Descriptor->Address64.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS64;

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -313,17 +313,19 @@ RsDoGpioIntDescriptor (
/* Allocate the local resource node and initialize */
Rnode = RsAllocateResourceNode (DescriptorSize + sizeof (AML_RESOURCE_LARGE_HEADER));
Rnode = RsAllocateResourceNode (DescriptorSize +
sizeof (AML_RESOURCE_LARGE_HEADER));
Descriptor = Rnode->Buffer;
Descriptor->Gpio.ResourceLength = DescriptorSize;
Descriptor->Gpio.DescriptorType = ACPI_RESOURCE_NAME_GPIO;
Descriptor->Gpio.RevisionId = AML_RESOURCE_GPIO_REVISION;
Descriptor->Gpio.ConnectionType = AML_RESOURCE_GPIO_TYPE_INT;
Descriptor->Gpio.ResourceLength = DescriptorSize;
Descriptor->Gpio.DescriptorType = ACPI_RESOURCE_NAME_GPIO;
Descriptor->Gpio.RevisionId = AML_RESOURCE_GPIO_REVISION;
Descriptor->Gpio.ConnectionType = AML_RESOURCE_GPIO_TYPE_INT;
/* Build pointers to optional areas */
InterruptList = ACPI_ADD_PTR (UINT16, Descriptor, sizeof (AML_RESOURCE_GPIO));
InterruptList = ACPI_ADD_PTR (UINT16, Descriptor,
sizeof (AML_RESOURCE_GPIO));
PinList = InterruptList;
ResourceSource = ACPI_ADD_PTR (char, InterruptList, InterruptLength);
VendorData = ACPI_ADD_PTR (UINT8, ResourceSource, ResSourceLength);
@ -336,11 +338,6 @@ RsDoGpioIntDescriptor (
Descriptor->Gpio.ResSourceOffset = (UINT16)
ACPI_PTR_DIFF (ResourceSource, Descriptor);
DbgPrint (ASL_DEBUG_OUTPUT,
"%16s - Actual: %.2X, Base: %.2X, ResLen: %.2X, VendLen: %.2X, IntLen: %.2X\n",
"GpioInt", Descriptor->Gpio.ResourceLength, (UINT16) sizeof (AML_RESOURCE_GPIO),
ResSourceLength, VendorLength, InterruptLength);
/* Process all child initialization nodes */
for (i = 0; InitializerOp; i++)
@ -397,7 +394,8 @@ RsDoGpioIntDescriptor (
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
{
Descriptor->Gpio.ResSourceIndex = (UINT8) InitializerOp->Asl.Value.Integer;
Descriptor->Gpio.ResSourceIndex =
(UINT8) InitializerOp->Asl.Value.Integer;
}
break;
@ -422,7 +420,7 @@ RsDoGpioIntDescriptor (
ACPI_PTR_DIFF (VendorData, Descriptor);
if (RsGetVendorData (InitializerOp, VendorData,
(CurrentByteOffset + Descriptor->Gpio.VendorOffset)))
(CurrentByteOffset + Descriptor->Gpio.VendorOffset)))
{
Descriptor->Gpio.VendorLength = VendorLength;
}
@ -430,7 +428,7 @@ RsDoGpioIntDescriptor (
default:
/*
* PINs come through here, repeatedly. Each PIN must be a DWORD.
* PINs come through here, repeatedly. Each PIN must be a WORD.
* NOTE: there is no "length" field for this, so from ACPI spec:
* The number of pins in the table can be calculated from:
* PinCount = (Resource Source Name Offset - Pin Table Offset) / 2
@ -459,7 +457,7 @@ RsDoGpioIntDescriptor (
/* Create a named field at the start of the list */
RsCreateDwordField (InitializerOp, ACPI_RESTAG_PIN,
RsCreateWordField (InitializerOp, ACPI_RESTAG_PIN,
CurrentByteOffset + Descriptor->Gpio.PinTableOffset);
}
break;
@ -468,7 +466,8 @@ RsDoGpioIntDescriptor (
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
}
MpSaveGpioInfo (Info->MappingOp, Descriptor, PinCount, PinList, ResourceSource);
MpSaveGpioInfo (Info->MappingOp, Descriptor,
PinCount, PinList, ResourceSource);
return (Rnode);
}
@ -524,13 +523,14 @@ RsDoGpioIoDescriptor (
/* Allocate the local resource node and initialize */
Rnode = RsAllocateResourceNode (DescriptorSize + sizeof (AML_RESOURCE_LARGE_HEADER));
Rnode = RsAllocateResourceNode (DescriptorSize +
sizeof (AML_RESOURCE_LARGE_HEADER));
Descriptor = Rnode->Buffer;
Descriptor->Gpio.ResourceLength = DescriptorSize;
Descriptor->Gpio.DescriptorType = ACPI_RESOURCE_NAME_GPIO;
Descriptor->Gpio.RevisionId = AML_RESOURCE_GPIO_REVISION;
Descriptor->Gpio.ConnectionType = AML_RESOURCE_GPIO_TYPE_IO;
Descriptor->Gpio.ResourceLength = DescriptorSize;
Descriptor->Gpio.DescriptorType = ACPI_RESOURCE_NAME_GPIO;
Descriptor->Gpio.RevisionId = AML_RESOURCE_GPIO_REVISION;
Descriptor->Gpio.ConnectionType = AML_RESOURCE_GPIO_TYPE_IO;
/* Build pointers to optional areas */
@ -547,11 +547,6 @@ RsDoGpioIoDescriptor (
Descriptor->Gpio.ResSourceOffset = (UINT16)
ACPI_PTR_DIFF (ResourceSource, Descriptor);
DbgPrint (ASL_DEBUG_OUTPUT,
"%16s - Actual: %.2X, Base: %.2X, ResLen: %.2X, VendLen: %.2X, IntLen: %.2X\n",
"GpioIo", Descriptor->Gpio.ResourceLength, (UINT16) sizeof (AML_RESOURCE_GPIO),
ResSourceLength, VendorLength, InterruptLength);
/* Process all child initialization nodes */
for (i = 0; InitializerOp; i++)
@ -632,7 +627,7 @@ RsDoGpioIoDescriptor (
ACPI_PTR_DIFF (VendorData, Descriptor);
if (RsGetVendorData (InitializerOp, VendorData,
(CurrentByteOffset + Descriptor->Gpio.VendorOffset)))
(CurrentByteOffset + Descriptor->Gpio.VendorOffset)))
{
Descriptor->Gpio.VendorLength = VendorLength;
}
@ -640,7 +635,7 @@ RsDoGpioIoDescriptor (
default:
/*
* PINs come through here, repeatedly. Each PIN must be a DWORD.
* PINs come through here, repeatedly. Each PIN must be a WORD.
* NOTE: there is no "length" field for this, so from ACPI spec:
* The number of pins in the table can be calculated from:
* PinCount = (Resource Source Name Offset - Pin Table Offset) / 2
@ -669,7 +664,7 @@ RsDoGpioIoDescriptor (
/* Create a named field at the start of the list */
RsCreateDwordField (InitializerOp, ACPI_RESTAG_PIN,
RsCreateWordField (InitializerOp, ACPI_RESTAG_PIN,
CurrentByteOffset + Descriptor->Gpio.PinTableOffset);
}
break;
@ -678,7 +673,8 @@ RsDoGpioIoDescriptor (
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
}
MpSaveGpioInfo (Info->MappingOp, Descriptor, PinCount, PinList, ResourceSource);
MpSaveGpioInfo (Info->MappingOp, Descriptor,
PinCount, PinList, ResourceSource);
return (Rnode);
}
@ -727,27 +723,27 @@ RsDoI2cSerialBusDescriptor (
/* Allocate the local resource node and initialize */
Rnode = RsAllocateResourceNode (DescriptorSize + sizeof (AML_RESOURCE_LARGE_HEADER));
Rnode = RsAllocateResourceNode (DescriptorSize +
sizeof (AML_RESOURCE_LARGE_HEADER));
Descriptor = Rnode->Buffer;
Descriptor->I2cSerialBus.ResourceLength = DescriptorSize;
Descriptor->I2cSerialBus.DescriptorType = ACPI_RESOURCE_NAME_SERIAL_BUS;
Descriptor->I2cSerialBus.RevisionId = AML_RESOURCE_I2C_REVISION;
Descriptor->I2cSerialBus.RevisionId = AML_RESOURCE_I2C_REVISION;
Descriptor->I2cSerialBus.TypeRevisionId = AML_RESOURCE_I2C_TYPE_REVISION;
Descriptor->I2cSerialBus.Type = AML_RESOURCE_I2C_SERIALBUSTYPE;
Descriptor->I2cSerialBus.Type = AML_RESOURCE_I2C_SERIALBUSTYPE;
Descriptor->I2cSerialBus.TypeDataLength = AML_RESOURCE_I2C_MIN_DATA_LEN + VendorLength;
if (Info->DescriptorTypeOp->Asl.ParseOpcode == PARSEOP_I2C_SERIALBUS_V2)
{
Descriptor->I2cSerialBus.RevisionId = 2;
}
/* Build pointers to optional areas */
VendorData = ACPI_ADD_PTR (UINT8, Descriptor, sizeof (AML_RESOURCE_I2C_SERIALBUS));
ResourceSource = ACPI_ADD_PTR (char, VendorData, VendorLength);
DbgPrint (ASL_DEBUG_OUTPUT,
"%16s - Actual: %.2X, Base: %.2X, ResLen: %.2X, VendLen: %.2X, TypLen: %.2X\n",
"I2cSerialBus", Descriptor->I2cSerialBus.ResourceLength,
(UINT16) sizeof (AML_RESOURCE_I2C_SERIALBUS), ResSourceLength,
VendorLength, Descriptor->I2cSerialBus.TypeDataLength);
/* Process all child initialization nodes */
for (i = 0; InitializerOp; i++)
@ -797,7 +793,8 @@ RsDoI2cSerialBusDescriptor (
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
{
Descriptor->I2cSerialBus.ResSourceIndex = (UINT8) InitializerOp->Asl.Value.Integer;
Descriptor->I2cSerialBus.ResSourceIndex =
(UINT8) InitializerOp->Asl.Value.Integer;
}
break;
@ -811,7 +808,18 @@ RsDoI2cSerialBusDescriptor (
UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
break;
case 8: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */
case 8:
/*
* Connection Share - Added for V2 (ACPI 6.0) version of the descriptor
* Note: For V1, the share bit will be zero (Op is DEFAULT_ARG from
* the ASL parser)
*/
RsSetFlagBits (&Descriptor->I2cSerialBus.Flags, InitializerOp, 2, 0);
RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.Flags), 2);
break;
case 9: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */
RsGetVendorData (InitializerOp, VendorData,
CurrentByteOffset + sizeof (AML_RESOURCE_I2C_SERIALBUS));
@ -874,27 +882,28 @@ RsDoSpiSerialBusDescriptor (
/* Allocate the local resource node and initialize */
Rnode = RsAllocateResourceNode (DescriptorSize + sizeof (AML_RESOURCE_LARGE_HEADER));
Rnode = RsAllocateResourceNode (DescriptorSize +
sizeof (AML_RESOURCE_LARGE_HEADER));
Descriptor = Rnode->Buffer;
Descriptor->SpiSerialBus.ResourceLength = DescriptorSize;
Descriptor->SpiSerialBus.DescriptorType = ACPI_RESOURCE_NAME_SERIAL_BUS;
Descriptor->SpiSerialBus.RevisionId = AML_RESOURCE_SPI_REVISION;
Descriptor->SpiSerialBus.RevisionId = AML_RESOURCE_SPI_REVISION;
Descriptor->SpiSerialBus.TypeRevisionId = AML_RESOURCE_SPI_TYPE_REVISION;
Descriptor->SpiSerialBus.Type = AML_RESOURCE_SPI_SERIALBUSTYPE;
Descriptor->SpiSerialBus.Type = AML_RESOURCE_SPI_SERIALBUSTYPE;
Descriptor->SpiSerialBus.TypeDataLength = AML_RESOURCE_SPI_MIN_DATA_LEN + VendorLength;
if (Info->DescriptorTypeOp->Asl.ParseOpcode == PARSEOP_SPI_SERIALBUS_V2)
{
Descriptor->I2cSerialBus.RevisionId = 2;
}
/* Build pointers to optional areas */
VendorData = ACPI_ADD_PTR (UINT8, Descriptor, sizeof (AML_RESOURCE_SPI_SERIALBUS));
VendorData = ACPI_ADD_PTR (UINT8, Descriptor,
sizeof (AML_RESOURCE_SPI_SERIALBUS));
ResourceSource = ACPI_ADD_PTR (char, VendorData, VendorLength);
DbgPrint (ASL_DEBUG_OUTPUT,
"%16s - Actual: %.2X, Base: %.2X, ResLen: %.2X, VendLen: %.2X, TypLen: %.2X\n",
"SpiSerialBus", Descriptor->SpiSerialBus.ResourceLength,
(UINT16) sizeof (AML_RESOURCE_SPI_SERIALBUS), ResSourceLength,
VendorLength, Descriptor->SpiSerialBus.TypeDataLength);
/* Process all child initialization nodes */
for (i = 0; InitializerOp; i++)
@ -972,7 +981,8 @@ RsDoSpiSerialBusDescriptor (
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
{
Descriptor->SpiSerialBus.ResSourceIndex = (UINT8) InitializerOp->Asl.Value.Integer;
Descriptor->SpiSerialBus.ResSourceIndex =
(UINT8) InitializerOp->Asl.Value.Integer;
}
break;
@ -986,7 +996,18 @@ RsDoSpiSerialBusDescriptor (
UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
break;
case 12: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */
case 12:
/*
* Connection Share - Added for V2 (ACPI 6.0) version of the descriptor
* Note: For V1, the share bit will be zero (Op is DEFAULT_ARG from
* the ASL parser)
*/
RsSetFlagBits (&Descriptor->SpiSerialBus.Flags, InitializerOp, 2, 0);
RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.Flags), 2);
break;
case 13: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */
RsGetVendorData (InitializerOp, VendorData,
CurrentByteOffset + sizeof (AML_RESOURCE_SPI_SERIALBUS));
@ -1049,27 +1070,27 @@ RsDoUartSerialBusDescriptor (
/* Allocate the local resource node and initialize */
Rnode = RsAllocateResourceNode (DescriptorSize + sizeof (AML_RESOURCE_LARGE_HEADER));
Rnode = RsAllocateResourceNode (DescriptorSize +
sizeof (AML_RESOURCE_LARGE_HEADER));
Descriptor = Rnode->Buffer;
Descriptor->UartSerialBus.ResourceLength = DescriptorSize;
Descriptor->UartSerialBus.DescriptorType = ACPI_RESOURCE_NAME_SERIAL_BUS;
Descriptor->UartSerialBus.RevisionId = AML_RESOURCE_UART_REVISION;
Descriptor->UartSerialBus.RevisionId = AML_RESOURCE_UART_REVISION;
Descriptor->UartSerialBus.TypeRevisionId = AML_RESOURCE_UART_TYPE_REVISION;
Descriptor->UartSerialBus.Type = AML_RESOURCE_UART_SERIALBUSTYPE;
Descriptor->UartSerialBus.Type = AML_RESOURCE_UART_SERIALBUSTYPE;
Descriptor->UartSerialBus.TypeDataLength = AML_RESOURCE_UART_MIN_DATA_LEN + VendorLength;
if (Info->DescriptorTypeOp->Asl.ParseOpcode == PARSEOP_UART_SERIALBUS_V2)
{
Descriptor->I2cSerialBus.RevisionId = 2;
}
/* Build pointers to optional areas */
VendorData = ACPI_ADD_PTR (UINT8, Descriptor, sizeof (AML_RESOURCE_UART_SERIALBUS));
ResourceSource = ACPI_ADD_PTR (char, VendorData, VendorLength);
DbgPrint (ASL_DEBUG_OUTPUT,
"%16s - Actual: %.2X, Base: %.2X, ResLen: %.2X, VendLen: %.2X, TypLen: %.2X\n",
"UartSerialBus", Descriptor->UartSerialBus.ResourceLength,
(UINT16) sizeof (AML_RESOURCE_UART_SERIALBUS), ResSourceLength,
VendorLength, Descriptor->UartSerialBus.TypeDataLength);
/* Process all child initialization nodes */
for (i = 0; InitializerOp; i++)
@ -1154,7 +1175,8 @@ RsDoUartSerialBusDescriptor (
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
{
Descriptor->UartSerialBus.ResSourceIndex = (UINT8) InitializerOp->Asl.Value.Integer;
Descriptor->UartSerialBus.ResSourceIndex =
(UINT8) InitializerOp->Asl.Value.Integer;
}
break;
@ -1178,7 +1200,18 @@ RsDoUartSerialBusDescriptor (
UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
break;
case 13: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */
case 13:
/*
* Connection Share - Added for V2 (ACPI 6.0) version of the descriptor
* Note: For V1, the share bit will be zero (Op is DEFAULT_ARG from
* the ASL parser)
*/
RsSetFlagBits (&Descriptor->UartSerialBus.Flags, InitializerOp, 2, 0);
RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.Flags), 2);
break;
case 14: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */
RsGetVendorData (InitializerOp, VendorData,
CurrentByteOffset + sizeof (AML_RESOURCE_UART_SERIALBUS));

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -91,11 +91,11 @@ RsDoWordIoDescriptor (
CurrentByteOffset = Info->CurrentByteOffset;
Rnode = RsAllocateResourceNode (
sizeof (AML_RESOURCE_ADDRESS16) + 1 + StringLength);
sizeof (AML_RESOURCE_ADDRESS16) + 1 + StringLength);
Descriptor = Rnode->Buffer;
Descriptor->Address16.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS16;
Descriptor->Address16.ResourceType = ACPI_ADDRESS_TYPE_IO_RANGE;
Descriptor->Address16.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS16;
Descriptor->Address16.ResourceType = ACPI_ADDRESS_TYPE_IO_RANGE;
/*
* Initial descriptor length -- may be enlarged if there are
@ -312,11 +312,11 @@ RsDoWordBusNumberDescriptor (
CurrentByteOffset = Info->CurrentByteOffset;
Rnode = RsAllocateResourceNode (
sizeof (AML_RESOURCE_ADDRESS16) + 1 + StringLength);
sizeof (AML_RESOURCE_ADDRESS16) + 1 + StringLength);
Descriptor = Rnode->Buffer;
Descriptor->Address16.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS16;
Descriptor->Address16.ResourceType = ACPI_ADDRESS_TYPE_BUS_NUMBER_RANGE;
Descriptor->Address16.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS16;
Descriptor->Address16.ResourceType = ACPI_ADDRESS_TYPE_BUS_NUMBER_RANGE;
/*
* Initial descriptor length -- may be enlarged if there are
@ -517,10 +517,10 @@ RsDoWordSpaceDescriptor (
CurrentByteOffset = Info->CurrentByteOffset;
Rnode = RsAllocateResourceNode (
sizeof (AML_RESOURCE_ADDRESS16) + 1 + StringLength);
sizeof (AML_RESOURCE_ADDRESS16) + 1 + StringLength);
Descriptor = Rnode->Buffer;
Descriptor->Address16.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS16;
Descriptor->Address16.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS16;
/*
* Initial descriptor length -- may be enlarged if there are

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -144,62 +144,63 @@ AslDetectSourceFileType (
ASL_FILE_INFO *Info)
{
char *FileChar;
UINT8 Type;
UINT8 Type = ASL_INPUT_TYPE_ASCII_DATA; /* default */
ACPI_STATUS Status;
/* Check for a valid binary ACPI table */
/* Check for 100% ASCII source file (comments are ignored) */
Status = FlCheckForAcpiTable (Info->Handle);
Status = FlIsFileAsciiSource (Info->Filename, FALSE);
if (ACPI_SUCCESS (Status))
{
Type = ASL_INPUT_TYPE_ACPI_TABLE;
/*
* File contains ASCII source code. Determine if this is an ASL
* file or an ACPI data table file.
*/
while (fgets (Gbl_CurrentLineBuffer, Gbl_LineBufferSize, Info->Handle))
{
/* Uppercase the buffer for caseless compare */
FileChar = Gbl_CurrentLineBuffer;
while (*FileChar)
{
*FileChar = (char) toupper ((int) *FileChar);
FileChar++;
}
/* Presence of "DefinitionBlock" indicates actual ASL code */
if (strstr (Gbl_CurrentLineBuffer, "DEFINITIONBLOCK"))
{
/* Appears to be an ASL file */
Type = ASL_INPUT_TYPE_ASCII_ASL;
goto Cleanup;
}
}
/* Appears to be an ASCII data table source file */
Type = ASL_INPUT_TYPE_ASCII_DATA;
goto Cleanup;
}
/* Check for 100% ASCII source file (comments are ignored) */
/* We have some sort of binary table, check for valid ACPI table */
Status = FlCheckForAscii (Info->Filename, TRUE);
if (ACPI_FAILURE (Status))
fseek (Info->Handle, 0, SEEK_SET);
Status = AcValidateTableHeader (Info->Handle, 0);
if (ACPI_SUCCESS (Status))
{
printf ("Invalid characters in input file - %s\n", Info->Filename);
fprintf (stderr,
"Binary file appears to be a valid ACPI table, disassembling\n");
if (!Gbl_IgnoreErrors)
{
Type = ASL_INPUT_TYPE_BINARY;
goto Cleanup;
}
Type = ASL_INPUT_TYPE_BINARY_ACPI_TABLE;
goto Cleanup;
}
/*
* File is ASCII. Determine if this is an ASL file or an ACPI data
* table file.
*/
while (fgets (Gbl_CurrentLineBuffer, Gbl_LineBufferSize, Info->Handle))
{
/* Uppercase the buffer for caseless compare */
Type = ASL_INPUT_TYPE_BINARY;
FileChar = Gbl_CurrentLineBuffer;
while (*FileChar)
{
*FileChar = (char) toupper ((int) *FileChar);
FileChar++;
}
/* Presence of "DefinitionBlock" indicates actual ASL code */
if (strstr (Gbl_CurrentLineBuffer, "DEFINITIONBLOCK"))
{
/* Appears to be an ASL file */
Type = ASL_INPUT_TYPE_ASCII_ASL;
goto Cleanup;
}
}
/* Not an ASL source file, default to a data table source file */
Type = ASL_INPUT_TYPE_ASCII_DATA;
Cleanup:
@ -248,7 +249,7 @@ AslDoDisassembly (
/* Handle additional output files for disassembler */
Gbl_FileType = ASL_INPUT_TYPE_ACPI_TABLE;
Gbl_FileType = ASL_INPUT_TYPE_BINARY_ACPI_TABLE;
Status = FlOpenMiscOutputFiles (Gbl_OutputFilenamePrefix);
/* This is where the disassembly happens */
@ -454,7 +455,7 @@ AslDoOneFile (
/*
* Binary ACPI table was auto-detected, disassemble it
*/
case ASL_INPUT_TYPE_ACPI_TABLE:
case ASL_INPUT_TYPE_BINARY_ACPI_TABLE:
/* We have what appears to be an ACPI table, disassemble it */

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -63,6 +63,13 @@ AcpiNsExecModuleCodeList (
{
}
ACPI_STATUS
AcpiNsInitializeObjects (
void)
{
return (AE_OK);
}
ACPI_STATUS
AcpiHwReadPort (
ACPI_IO_ADDRESS Address,
@ -119,6 +126,13 @@ AcpiDsStoreObjectToLocal (
return (AE_OK);
}
ACPI_STATUS
AcpiEvInstallRegionHandlers (
void)
{
return (AE_OK);
}
ACPI_STATUS
AcpiEvQueueNotifyRequest (
ACPI_NAMESPACE_NODE *Node,
@ -270,3 +284,45 @@ AcpiTbFindTable (
{
return (AE_SUPPORT);
}
ACPI_STATUS
AcpiNsLoadTable (
UINT32 TableIndex,
ACPI_NAMESPACE_NODE *Node)
{
return (AE_NOT_IMPLEMENTED);
}
ACPI_STATUS
AcpiDsRestartControlMethod (
ACPI_WALK_STATE *WalkState,
ACPI_OPERAND_OBJECT *ReturnDesc)
{
return (AE_OK);
}
void
AcpiDsTerminateControlMethod (
ACPI_OPERAND_OBJECT *MethodDesc,
ACPI_WALK_STATE *WalkState)
{
return;
}
ACPI_STATUS
AcpiDsCallControlMethod (
ACPI_THREAD_STATE *Thread,
ACPI_WALK_STATE *WalkState,
ACPI_PARSE_OBJECT *Op)
{
return (AE_OK);
}
ACPI_STATUS
AcpiDsMethodDataInitArgs (
ACPI_OPERAND_OBJECT **Params,
UINT32 MaxParamCount,
ACPI_WALK_STATE *WalkState)
{
return (AE_OK);
}

View File

@ -6,7 +6,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -196,9 +196,13 @@ AslPopInputFileStack (
ASL_FILE_NODE *Fnode;
Gbl_PreviousIncludeFilename = Gbl_Files[ASL_FILE_INPUT].Filename;
Fnode = Gbl_IncludeFileStack;
DbgPrint (ASL_PARSE_OUTPUT,
"\nPop InputFile Stack, Fnode %p\n\n", Fnode);
"\nPop InputFile Stack, Fnode %p\n", Fnode);
DbgPrint (ASL_PARSE_OUTPUT,
"Include: Closing \"%s\"\n\n", Gbl_Files[ASL_FILE_INPUT].Filename);
if (!Fnode)
{

View File

@ -6,7 +6,7 @@ NoEcho('
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View File

@ -6,7 +6,7 @@ NoEcho('
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -124,7 +124,7 @@ NoEcho('
%token <i> PARSEOP_DECREMENT
%token <i> PARSEOP_DEFAULT
%token <i> PARSEOP_DEFAULT_ARG
%token <i> PARSEOP_DEFINITIONBLOCK
%token <i> PARSEOP_DEFINITION_BLOCK
%token <i> PARSEOP_DEREFOF
%token <i> PARSEOP_DEVICE
%token <i> PARSEOP_DEVICEPOLARITY_HIGH
@ -166,6 +166,7 @@ NoEcho('
%token <i> PARSEOP_GPIO_INT
%token <i> PARSEOP_GPIO_IO
%token <i> PARSEOP_I2C_SERIALBUS
%token <i> PARSEOP_I2C_SERIALBUS_V2
%token <i> PARSEOP_IF
%token <i> PARSEOP_INCLUDE
%token <i> PARSEOP_INCLUDE_END
@ -323,6 +324,7 @@ NoEcho('
%token <i> PARSEOP_SLAVEMODE_DEVICEINIT
%token <i> PARSEOP_SLEEP
%token <i> PARSEOP_SPI_SERIALBUS
%token <i> PARSEOP_SPI_SERIALBUS_V2
%token <i> PARSEOP_STALL
%token <i> PARSEOP_STARTDEPENDENTFN
%token <i> PARSEOP_STARTDEPENDENTFN_NOPRI
@ -348,6 +350,7 @@ NoEcho('
%token <i> PARSEOP_TYPE_STATIC
%token <i> PARSEOP_TYPE_TRANSLATION
%token <i> PARSEOP_UART_SERIALBUS
%token <i> PARSEOP_UART_SERIALBUS_V2
%token <i> PARSEOP_UNICODE
%token <i> PARSEOP_UNLOAD
%token <i> PARSEOP_UPDATERULE_ONES
@ -452,12 +455,24 @@ NoEcho('
%left <i> PARSEOP_EXP_INCREMENT
PARSEOP_EXP_DECREMENT
/* Brackets for Index() support */
%left <i> PARSEOP_EXP_INDEX_LEFT
%right <i> PARSEOP_EXP_INDEX_RIGHT
/* Macros */
%token <i> PARSEOP_PRINTF
%token <i> PARSEOP_FPRINTF
%token <i> PARSEOP_FOR
/* Specific parentheses tokens are not used at this time */
/* PARSEOP_EXP_PAREN_OPEN */
/* PARSEOP_EXP_PAREN_CLOSE */
%token <i> PARSEOP_ASL_CODE
/*
* Special functions. These should probably stay at the end of this
* table.

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -111,7 +111,7 @@ TrAmlGetNextTempName (
char *TempName;
if (*TempCount >= (10+26)) /* 0-35 valid: 0-9 and A-Z for TempName[3] */
if (*TempCount >= (10 + 26)) /* 0-35 valid: 0-9 and A-Z for TempName[3] */
{
/* Too many temps */
@ -129,6 +129,7 @@ TrAmlGetNextTempName (
{
TempName[3] = (char) (*TempCount + ('A' - 10));
}
(*TempCount)++;
/* First three characters are always "_T_" */
@ -217,7 +218,7 @@ TrAmlSetSubtreeParent (
while (Next)
{
Next->Asl.Parent = Parent;
Next = Next->Asl.Next;
Next = Next->Asl.Next;
}
}
@ -242,13 +243,13 @@ TrAmlInsertPeer (
{
NewPeer->Asl.Next = Op->Asl.Next;
Op->Asl.Next = NewPeer;
Op->Asl.Next = NewPeer;
}
/*******************************************************************************
*
* FUNCTION: TrAmlTransformWalk
* FUNCTION: TrAmlTransformWalkBegin
*
* PARAMETERS: ASL_WALK_CALLBACK
*
@ -260,7 +261,7 @@ TrAmlInsertPeer (
******************************************************************************/
ACPI_STATUS
TrAmlTransformWalk (
TrAmlTransformWalkBegin (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context)
@ -271,6 +272,38 @@ TrAmlTransformWalk (
}
/*******************************************************************************
*
* FUNCTION: TrAmlTransformWalkEnd
*
* PARAMETERS: ASL_WALK_CALLBACK
*
* RETURN: None
*
* DESCRIPTION: Parse tree walk to generate both the AML opcodes and the AML
* operands.
*
******************************************************************************/
ACPI_STATUS
TrAmlTransformWalkEnd (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context)
{
/* Save possible Externals list in the DefintionBlock Op */
if (Op->Asl.ParseOpcode == PARSEOP_DEFINITION_BLOCK)
{
Op->Asl.Value.Arg = Gbl_ExternalsListHead;
Gbl_ExternalsListHead = NULL;
}
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: TrTransformSubtree
@ -297,7 +330,7 @@ TrTransformSubtree (
switch (Op->Asl.ParseOpcode)
{
case PARSEOP_DEFINITIONBLOCK:
case PARSEOP_DEFINITION_BLOCK:
TrDoDefinitionBlock (Op);
break;
@ -315,6 +348,15 @@ TrTransformSubtree (
Gbl_TempCount = 0;
break;
case PARSEOP_EXTERNAL:
if (Gbl_DoExternals == TRUE)
{
ExDoExternal (Op);
}
break;
default:
/* Nothing to do here for other opcodes */
@ -346,6 +388,10 @@ TrDoDefinitionBlock (
UINT32 i;
/* Reset external list when starting a definition block */
Gbl_ExternalsListHead = NULL;
Next = Op->Asl.Child;
for (i = 0; i < 5; i++)
{
@ -448,7 +494,7 @@ TrDoSwitch (
{
/* Add an ELSE to complete the previous CASE */
NewOp = TrCreateLeafNode (PARSEOP_ELSE);
NewOp = TrCreateLeafNode (PARSEOP_ELSE);
NewOp->Asl.Parent = Conditional->Asl.Parent;
TrAmlInitLineNumbers (NewOp, NewOp->Asl.Parent);
@ -458,9 +504,9 @@ TrDoSwitch (
CurrentParentNode = NewOp;
}
CaseOp = Next;
CaseOp = Next;
Conditional = CaseOp;
CaseBlock = CaseOp->Asl.Child->Asl.Next;
CaseBlock = CaseOp->Asl.Child->Asl.Next;
Conditional->Asl.Child->Asl.Next = NULL;
Predicate = CaseOp->Asl.Child;
@ -537,7 +583,7 @@ TrDoSwitch (
* CaseOp->Child->Peer is the beginning of the case block
*/
NewOp = TrCreateValuedLeafNode (PARSEOP_NAMESTRING,
(UINT64) ACPI_TO_INTEGER (PredicateValueName));
(UINT64) ACPI_TO_INTEGER (PredicateValueName));
NewOp->Asl.Next = Predicate;
TrAmlInitLineNumbers (NewOp, Predicate);
@ -600,7 +646,7 @@ TrDoSwitch (
/* Unknown peer opcode */
AcpiOsPrintf ("Unknown parse opcode for switch statement: %s (%u)\n",
Next->Asl.ParseOpName, Next->Asl.ParseOpcode);
Next->Asl.ParseOpName, Next->Asl.ParseOpcode);
}
}
@ -645,7 +691,7 @@ TrDoSwitch (
Next = StartNode;
while ((Next->Asl.ParseOpcode != PARSEOP_METHOD) &&
(Next->Asl.ParseOpcode != PARSEOP_DEFINITIONBLOCK))
(Next->Asl.ParseOpcode != PARSEOP_DEFINITION_BLOCK))
{
Next = Next->Asl.Parent;
}
@ -668,7 +714,8 @@ TrDoSwitch (
*/
if (Next->Asl.ParseOpcode != PARSEOP_SERIALIZERULE_SERIAL)
{
AslError (ASL_REMARK, ASL_MSG_SERIALIZED, MethodOp, "Due to use of Switch operator");
AslError (ASL_REMARK, ASL_MSG_SERIALIZED, MethodOp,
"Due to use of Switch operator");
Next->Asl.ParseOpcode = PARSEOP_SERIALIZERULE_SERIAL;
}
@ -682,7 +729,7 @@ TrDoSwitch (
/* Create the NameSeg child for the Name node */
NewOp2 = TrCreateValuedLeafNode (PARSEOP_NAMESEG,
(UINT64) ACPI_TO_INTEGER (PredicateValueName));
(UINT64) ACPI_TO_INTEGER (PredicateValueName));
TrAmlInitLineNumbers (NewOp2, NewOp);
NewOp2->Asl.CompileFlags |= NODE_IS_NAME_DECLARATION;
NewOp->Asl.Child = NewOp2;
@ -694,25 +741,25 @@ TrDoSwitch (
case ACPI_BTYPE_INTEGER:
NewOp2->Asl.Next = TrCreateValuedLeafNode (PARSEOP_ZERO,
(UINT64) 0);
(UINT64) 0);
TrAmlInitLineNumbers (NewOp2->Asl.Next, NewOp);
break;
case ACPI_BTYPE_STRING:
NewOp2->Asl.Next = TrCreateValuedLeafNode (PARSEOP_STRING_LITERAL,
(UINT64) ACPI_TO_INTEGER (""));
(UINT64) ACPI_TO_INTEGER (""));
TrAmlInitLineNumbers (NewOp2->Asl.Next, NewOp);
break;
case ACPI_BTYPE_BUFFER:
(void) TrLinkPeerNode (NewOp2, TrCreateValuedLeafNode (PARSEOP_BUFFER,
(UINT64) 0));
(UINT64) 0));
Next = NewOp2->Asl.Next;
TrAmlInitLineNumbers (Next, NewOp2);
(void) TrLinkChildren (Next, 1, TrCreateValuedLeafNode (PARSEOP_ZERO,
(UINT64) 1));
(UINT64) 1));
TrAmlInitLineNumbers (Next->Asl.Child, Next);
BufferOp = TrCreateValuedLeafNode (PARSEOP_DEFAULT_ARG, (UINT64) 0);
@ -755,7 +802,7 @@ TrDoSwitch (
Predicate->Asl.Parent = StoreOp;
NewOp = TrCreateValuedLeafNode (PARSEOP_NAMESEG,
(UINT64) ACPI_TO_INTEGER (PredicateValueName));
(UINT64) ACPI_TO_INTEGER (PredicateValueName));
TrAmlInitLineNumbers (NewOp, StoreOp);
NewOp->Asl.Parent = StoreOp;
Predicate->Asl.Next = NewOp;

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -56,6 +56,29 @@ TrGetNextNode (
void);
/*******************************************************************************
*
* FUNCTION: TrSetParent
*
* PARAMETERS: Op - To be set to new parent
* ParentOp - The parent
*
* RETURN: None, sets Op parent directly
*
* DESCRIPTION: Change the parent of a parse op.
*
******************************************************************************/
void
TrSetParent (
ACPI_PARSE_OBJECT *Op,
ACPI_PARSE_OBJECT *ParentOp)
{
Op->Asl.Parent = ParentOp;
}
/*******************************************************************************
*
* FUNCTION: TrGetNextNode
@ -155,12 +178,32 @@ TrReleaseNode (
}
/*******************************************************************************
*
* FUNCTION: TrSetCurrentFilename
*
* PARAMETERS: Op - An existing parse node
*
* RETURN: None
*
* DESCRIPTION: Save the include file filename. Used for debug output only.
*
******************************************************************************/
void
TrSetCurrentFilename (
ACPI_PARSE_OBJECT *Op)
{
Op->Asl.Filename = Gbl_PreviousIncludeFilename;
}
/*******************************************************************************
*
* FUNCTION: TrUpdateNode
*
* PARAMETERS: ParseOpcode - New opcode to be assigned to the node
* Op - An existing parse node
* Op - An existing parse node
*
* RETURN: The updated node
*
@ -340,6 +383,11 @@ TrPrintNodeCompileFlags (
FlagName = "NODE_METHOD_TYPED";
break;
case NODE_COULD_NOT_REDUCE:
FlagName = "NODE_COULD_NOT_REDUCE";
break;
case NODE_COMPILE_TIME_CONST:
FlagName = "NODE_COMPILE_TIME_CONST";
@ -489,7 +537,7 @@ TrSetEndLineNumber (
return;
}
Op->Asl.EndLine = Gbl_CurrentLineNumber;
Op->Asl.EndLine = Gbl_CurrentLineNumber;
Op->Asl.EndLogicalLine = Gbl_LogicalLineNumber;
}
@ -538,6 +586,7 @@ TrCreateAssignmentNode (
case PARSEOP_ADD:
case PARSEOP_AND:
case PARSEOP_DIVIDE:
case PARSEOP_INDEX:
case PARSEOP_MOD:
case PARSEOP_MULTIPLY:
case PARSEOP_NOT:
@ -752,7 +801,8 @@ TrCreateConstantLeafNode (
}
DbgPrint (ASL_PARSE_OUTPUT,
"\nCreateConstantLeafNode Ln/Col %u/%u NewNode %p Op %s Value %8.8X%8.8X \n",
"\nCreateConstantLeafNode Ln/Col %u/%u NewNode %p "
"Op %s Value %8.8X%8.8X \n",
Op->Asl.LineNumber, Op->Asl.Column, Op, UtGetOpName (ParseOpcode),
ACPI_FORMAT_UINT64 (Op->Asl.Value.Integer));
return (Op);
@ -859,7 +909,8 @@ TrCreateValuedLeafNode (
Op = TrAllocateNode (ParseOpcode);
DbgPrint (ASL_PARSE_OUTPUT,
"\nCreateValuedLeafNode Ln/Col %u/%u NewNode %p Op %s Value %8.8X%8.8X ",
"\nCreateValuedLeafNode 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 (Value));
Op->Asl.Value.Integer = Value;
@ -945,15 +996,22 @@ TrCreateNode (
DbgPrint (ASL_PARSE_OUTPUT,
"\nCreateNode Ln/Col %u/%u NewParent %p Child %u Op %s ",
Op->Asl.LineNumber, Op->Asl.Column, Op, NumChildren, UtGetOpName(ParseOpcode));
Op->Asl.LineNumber, Op->Asl.Column, Op,
NumChildren, UtGetOpName(ParseOpcode));
/* Some extra debug output based on the parse opcode */
switch (ParseOpcode)
{
case PARSEOP_DEFINITIONBLOCK:
case PARSEOP_ASL_CODE:
Gbl_ParseTreeRoot = Op;
Op->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
DbgPrint (ASL_PARSE_OUTPUT, "ASLCODE (Tree Completed)->");
break;
case PARSEOP_DEFINITION_BLOCK:
RootNode = Op;
DbgPrint (ASL_PARSE_OUTPUT, "DEFINITION_BLOCK (Tree Completed)->");
break;
@ -1074,9 +1132,15 @@ TrLinkChildren (
switch (Op->Asl.ParseOpcode)
{
case PARSEOP_DEFINITIONBLOCK:
case PARSEOP_ASL_CODE:
Gbl_ParseTreeRoot = Op;
Op->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
DbgPrint (ASL_PARSE_OUTPUT, "ASLCODE (Tree Completed)->");
break;
case PARSEOP_DEFINITION_BLOCK:
RootNode = Op;
DbgPrint (ASL_PARSE_OUTPUT, "DEFINITION_BLOCK (Tree Completed)->");
break;
@ -1154,6 +1218,7 @@ TrLinkChildren (
Child = Child->Asl.Next;
Child->Asl.Parent = Op;
}
PrevChild = Child;
}
@ -1375,7 +1440,7 @@ TrWalkParseTree (
ACPI_STATUS Status;
if (!RootNode)
if (!Gbl_ParseTreeRoot)
{
return (AE_OK);
}

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -66,7 +66,7 @@
#define NODE_METHOD_SOME_NO_RETVAL 0x00000200
#define NODE_RESULT_NOT_USED 0x00000400
#define NODE_METHOD_TYPED 0x00000800
#define NODE_UNUSED_FLAG 0x00001000
#define NODE_COULD_NOT_REDUCE 0x00001000
#define NODE_COMPILE_TIME_CONST 0x00002000
#define NODE_IS_TERM_ARG 0x00004000
#define NODE_WAS_ONES_OP 0x00008000
@ -81,6 +81,7 @@
typedef struct asl_method_info
{
ACPI_PARSE_OBJECT *Op;
ACPI_PARSE_OBJECT *CurrentOp;
struct asl_method_info *Next;
UINT32 ValidArgTypes[ACPI_METHOD_NUM_ARGS];
UINT32 ValidReturnTypes;
@ -170,33 +171,34 @@ typedef enum
ASL_FILE_C_SOURCE_OUTPUT, /* .c */
ASL_FILE_ASM_INCLUDE_OUTPUT,/* .inc */
ASL_FILE_C_INCLUDE_OUTPUT, /* .h */
ASL_FILE_C_OFFSET_OUTPUT, /* offset.h */
ASL_FILE_MAP_OUTPUT /* .map */
ASL_FILE_C_OFFSET_OUTPUT, /* .offset.h */
ASL_FILE_MAP_OUTPUT, /* .map */
ASL_FILE_XREF_OUTPUT /* .xrf */
} ASL_FILE_TYPES;
#define ASL_MAX_FILE_TYPE 16
#define ASL_MAX_FILE_TYPE 17
#define ASL_NUM_FILES (ASL_MAX_FILE_TYPE + 1)
/* filename suffixes for output files */
/* Name suffixes used to create filenames for output files */
#define FILE_SUFFIX_PREPROC_USER "i "
#define FILE_SUFFIX_PREPROCESSOR "pre"
#define FILE_SUFFIX_ASL_CODE "asl"
#define FILE_SUFFIX_AML_CODE "aml"
#define FILE_SUFFIX_MAP "map"
#define FILE_SUFFIX_SOURCE "src"
#define FILE_SUFFIX_PREPROCESSOR "pre"
#define FILE_SUFFIX_PREPROC_USER "i"
#define FILE_SUFFIX_LISTING "lst"
#define FILE_SUFFIX_HEX_DUMP "hex"
#define FILE_SUFFIX_DEBUG "txt"
#define FILE_SUFFIX_SOURCE "src"
#define FILE_SUFFIX_NAMESPACE "nsp"
#define FILE_SUFFIX_DEBUG "txt"
#define FILE_SUFFIX_ASM_SOURCE "asm"
#define FILE_SUFFIX_C_SOURCE "c"
#define FILE_SUFFIX_DISASSEMBLY "dsl"
#define FILE_SUFFIX_ASM_INCLUDE "inc"
#define FILE_SUFFIX_C_INCLUDE "h"
#define FILE_SUFFIX_ASL_CODE "asl"
#define FILE_SUFFIX_C_OFFSET "offset.h"
#define FILE_SUFFIX_MAP "map"
#define FILE_SUFFIX_XREF "xrf"
/* Cache block structure for ParseOps and Strings */
@ -317,4 +319,21 @@ typedef struct asl_method_local
#define ASL_ARG_INITIALIZED (1<<3)
#define ASL_ARG_REFERENCED (1<<4)
/* Info used to track method counts for cross reference output file */
typedef struct asl_xref_info
{
UINT32 ThisMethodInvocations;
UINT32 TotalPredefinedMethods;
UINT32 TotalUserMethods;
UINT32 TotalUnreferenceUserMethods;
UINT32 ThisObjectReferences;
UINT32 TotalObjects;
UINT32 TotalUnreferencedObjects;
ACPI_PARSE_OBJECT *MethodOp;
ACPI_PARSE_OBJECT *CurrentMethodOp;
} ASL_XREF_INFO;
#endif /* __ASLTYPES_H */

View File

@ -6,7 +6,7 @@ NoEcho('
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -51,17 +51,17 @@ NoEcho('
*****************************************************************************/
%type <n> ArgList
%type <n> ASLCode
%type <n> AslCode
%type <n> BufferData
%type <n> BufferTermData
%type <n> CompilerDirective
%type <n> DataObject
%type <n> DefinitionBlockTerm
%type <n> DefinitionBlockList
%type <n> IntegerData
%type <n> NamedObject
%type <n> NameSpaceModifier
%type <n> Object
%type <n> ObjectList
%type <n> PackageData
%type <n> ParameterTypePackage
%type <n> ParameterTypePackageList
@ -136,7 +136,7 @@ NoEcho('
%type <n> DefaultTerm
%type <n> ElseTerm
%type <n> FatalTerm
%type <n> IfElseTerm
%type <n> ElseIfTerm
%type <n> IfTerm
%type <n> LoadTerm
%type <n> NoOpTerm
@ -188,6 +188,7 @@ NoEcho('
%type <n> NotTerm
%type <n> ObjectTypeTerm
%type <n> OrTerm
%type <n> RawDataBufferTerm
%type <n> RefOfTerm
%type <n> ShiftLeftTerm
%type <n> ShiftRightTerm
@ -293,11 +294,11 @@ NoEcho('
%type <n> PrintfArgList
%type <n> PrintfTerm
%type <n> FprintfTerm
%type <n> ForTerm
/* Resource Descriptors */
%type <n> ConnectionTerm
%type <n> DataBufferTerm
%type <n> DMATerm
%type <n> DWordIOTerm
%type <n> DWordMemoryTerm
@ -311,6 +312,7 @@ NoEcho('
%type <n> GpioIntTerm
%type <n> GpioIoTerm
%type <n> I2cSerialBusTerm
%type <n> I2cSerialBusTermV2
%type <n> InterruptTerm
%type <n> IOTerm
%type <n> IRQNoFlagsTerm
@ -325,9 +327,11 @@ NoEcho('
%type <n> QWordSpaceTerm
%type <n> RegisterTerm
%type <n> SpiSerialBusTerm
%type <n> SpiSerialBusTermV2
%type <n> StartDependentFnNoPriTerm
%type <n> StartDependentFnTerm
%type <n> UartSerialBusTerm
%type <n> UartSerialBusTermV2
%type <n> VendorLongTerm
%type <n> VendorShortTerm
%type <n> WordBusNumberTerm
@ -346,6 +350,7 @@ NoEcho('
%type <n> OptionalAddressRange
%type <n> OptionalBitsPerByte
%type <n> OptionalBuffer_Last
%type <n> OptionalBufferLength
%type <n> OptionalByteConstExpr
%type <n> OptionalCount
%type <n> OptionalDecodeType
@ -365,6 +370,7 @@ NoEcho('
%type <n> OptionalParameterTypePackage
%type <n> OptionalParameterTypesPackage
%type <n> OptionalParityType
%type <n> OptionalPredicate
%type <n> OptionalQWordConstExpr
%type <n> OptionalRangeType
%type <n> OptionalReference
@ -391,3 +397,4 @@ NoEcho('
*/
%type <n> Expression
%type <n> EqualsTerm
%type <n> IndexExpTerm

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -47,6 +47,8 @@
#include <contrib/dev/acpica/include/acnamesp.h>
#include <contrib/dev/acpica/include/amlcode.h>
#include <contrib/dev/acpica/include/acapps.h>
#include <sys/stat.h>
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslutils")
@ -65,6 +67,67 @@ UtAttachNameseg (
char *Name);
/*******************************************************************************
*
* FUNCTION: UtIsBigEndianMachine
*
* PARAMETERS: None
*
* RETURN: TRUE if machine is big endian
* FALSE if machine is little endian
*
* DESCRIPTION: Detect whether machine is little endian or big endian.
*
******************************************************************************/
UINT8
UtIsBigEndianMachine (
void)
{
union {
UINT32 Integer;
UINT8 Bytes[4];
} Overlay = {0xFF000000};
return (Overlay.Bytes[0]); /* Returns 0xFF (TRUE) for big endian */
}
/******************************************************************************
*
* FUNCTION: UtQueryForOverwrite
*
* PARAMETERS: Pathname - Output filename
*
* RETURN: TRUE if file does not exist or overwrite is authorized
*
* DESCRIPTION: Query for file overwrite if it already exists.
*
******************************************************************************/
BOOLEAN
UtQueryForOverwrite (
char *Pathname)
{
struct stat StatInfo;
if (!stat (Pathname, &StatInfo))
{
fprintf (stderr, "Target file \"%s\" already exists, overwrite? [y|n] ",
Pathname);
if (getchar () != 'y')
{
return (FALSE);
}
}
return (TRUE);
}
/*******************************************************************************
*
* FUNCTION: UtDisplaySupportedTables
@ -199,7 +262,6 @@ UtBeginEvent (
AslGbl_Events[AslGbl_NextEvent].StartTime = AcpiOsGetTimer ();
AslGbl_Events[AslGbl_NextEvent].EventName = Name;
AslGbl_Events[AslGbl_NextEvent].Valid = TRUE;
return (AslGbl_NextEvent++);
}
@ -232,63 +294,6 @@ UtEndEvent (
}
/*******************************************************************************
*
* FUNCTION: UtConvertByteToHex
*
* PARAMETERS: RawByte - Binary data
* Buffer - Pointer to where the hex bytes will be
* stored
*
* RETURN: Ascii hex byte is stored in Buffer.
*
* DESCRIPTION: Perform hex-to-ascii translation. The return data is prefixed
* with "0x"
*
******************************************************************************/
void
UtConvertByteToHex (
UINT8 RawByte,
UINT8 *Buffer)
{
Buffer[0] = '0';
Buffer[1] = 'x';
Buffer[2] = (UINT8) AcpiUtHexToAsciiChar (RawByte, 4);
Buffer[3] = (UINT8) AcpiUtHexToAsciiChar (RawByte, 0);
}
/*******************************************************************************
*
* FUNCTION: UtConvertByteToAsmHex
*
* PARAMETERS: RawByte - Binary data
* Buffer - Pointer to where the hex bytes will be
* stored
*
* RETURN: Ascii hex byte is stored in Buffer.
*
* DESCRIPTION: Perform hex-to-ascii translation. The return data is prefixed
* with '0', and a trailing 'h' is added.
*
******************************************************************************/
void
UtConvertByteToAsmHex (
UINT8 RawByte,
UINT8 *Buffer)
{
Buffer[0] = '0';
Buffer[1] = (UINT8) AcpiUtHexToAsciiChar (RawByte, 4);
Buffer[2] = (UINT8) AcpiUtHexToAsciiChar (RawByte, 0);
Buffer[3] = 'h';
}
/*******************************************************************************
*
* FUNCTION: DbgPrint
@ -331,43 +336,6 @@ DbgPrint (
}
/*******************************************************************************
*
* FUNCTION: UtPrintFormattedName
*
* PARAMETERS: ParseOpcode - Parser keyword ID
* Level - Indentation level
*
* RETURN: None
*
* DESCRIPTION: Print the ascii name of the parse opcode.
*
******************************************************************************/
#define TEXT_OFFSET 10
void
UtPrintFormattedName (
UINT16 ParseOpcode,
UINT32 Level)
{
if (Level)
{
DbgPrint (ASL_TREE_OUTPUT,
"%*s", (3 * Level), " ");
}
DbgPrint (ASL_TREE_OUTPUT,
" %-20.20s", UtGetOpName (ParseOpcode));
if (Level < TEXT_OFFSET)
{
DbgPrint (ASL_TREE_OUTPUT,
"%*s", (TEXT_OFFSET - Level) * 3, " ");
}
}
/*******************************************************************************
*
* FUNCTION: UtSetParseOpName
@ -450,9 +418,11 @@ UtDisplaySummary (
if (Gbl_Files[ASL_FILE_AML_OUTPUT].Handle)
{
FlPrintFile (FileId,
"%-14s %s - %u bytes, %u named objects, %u executable opcodes\n",
"%-14s %s - %u bytes, %u named objects, "
"%u executable opcodes\n",
"AML Output:",
Gbl_Files[ASL_FILE_AML_OUTPUT].Filename, Gbl_TableLength,
Gbl_Files[ASL_FILE_AML_OUTPUT].Filename,
FlGetFileSize (ASL_FILE_AML_OUTPUT),
TotalNamedObjects, TotalExecutableOpcodes);
}
}
@ -806,6 +776,7 @@ UtPadNameWithUnderscores (
{
*PaddedNameSeg = '_';
}
PaddedNameSeg++;
}
}
@ -935,7 +906,9 @@ UtDoConstant (
char ErrBuf[64];
Status = stroul64 (String, 0, &Converted);
Status = AcpiUtStrtoul64 (String, ACPI_ANY_BASE,
ACPI_MAX64_BYTE_WIDTH, &Converted);
if (ACPI_FAILURE (Status))
{
sprintf (ErrBuf, "%s %s\n", "Conversion error:",
@ -947,198 +920,62 @@ UtDoConstant (
}
/* TBD: use version in ACPICA main code base? */
#ifdef _OBSOLETE_FUNCTIONS
/* Removed 01/2016 */
/*******************************************************************************
*
* FUNCTION: stroul64
* FUNCTION: UtConvertByteToHex
*
* PARAMETERS: String - Null terminated string
* Terminater - Where a pointer to the terminating byte
* is returned
* Base - Radix of the string
* PARAMETERS: RawByte - Binary data
* Buffer - Pointer to where the hex bytes will be
* stored
*
* RETURN: Converted value
* RETURN: Ascii hex byte is stored in Buffer.
*
* DESCRIPTION: Convert a string into an unsigned value.
* DESCRIPTION: Perform hex-to-ascii translation. The return data is prefixed
* with "0x"
*
******************************************************************************/
ACPI_STATUS
stroul64 (
char *String,
UINT32 Base,
UINT64 *RetInteger)
void
UtConvertByteToHex (
UINT8 RawByte,
UINT8 *Buffer)
{
UINT32 Index;
UINT32 Sign;
UINT64 ReturnValue = 0;
ACPI_STATUS Status = AE_OK;
Buffer[0] = '0';
Buffer[1] = 'x';
*RetInteger = 0;
switch (Base)
{
case 0:
case 8:
case 10:
case 16:
break;
default:
/*
* The specified Base parameter is not in the domain of
* this function:
*/
return (AE_BAD_PARAMETER);
}
/* Skip over any white space in the buffer: */
while (isspace ((int) *String) || *String == '\t')
{
++String;
}
/*
* The buffer may contain an optional plus or minus sign.
* If it does, then skip over it but remember what is was:
*/
if (*String == '-')
{
Sign = ACPI_SIGN_NEGATIVE;
++String;
}
else if (*String == '+')
{
++String;
Sign = ACPI_SIGN_POSITIVE;
}
else
{
Sign = ACPI_SIGN_POSITIVE;
}
/*
* If the input parameter Base is zero, then we need to
* determine if it is octal, decimal, or hexadecimal:
*/
if (Base == 0)
{
if (*String == '0')
{
if (tolower ((int) *(++String)) == 'x')
{
Base = 16;
++String;
}
else
{
Base = 8;
}
}
else
{
Base = 10;
}
}
/*
* For octal and hexadecimal bases, skip over the leading
* 0 or 0x, if they are present.
*/
if (Base == 8 && *String == '0')
{
String++;
}
if (Base == 16 &&
*String == '0' &&
tolower ((int) *(++String)) == 'x')
{
String++;
}
/* Main loop: convert the string to an unsigned long */
while (*String)
{
if (isdigit ((int) *String))
{
Index = ((UINT8) *String) - '0';
}
else
{
Index = (UINT8) toupper ((int) *String);
if (isupper ((int) Index))
{
Index = Index - 'A' + 10;
}
else
{
goto ErrorExit;
}
}
if (Index >= Base)
{
goto ErrorExit;
}
/* Check to see if value is out of range: */
if (ReturnValue > ((ACPI_UINT64_MAX - (UINT64) Index) /
(UINT64) Base))
{
goto ErrorExit;
}
else
{
ReturnValue *= Base;
ReturnValue += Index;
}
++String;
}
/* If a minus sign was present, then "the conversion is negated": */
if (Sign == ACPI_SIGN_NEGATIVE)
{
ReturnValue = (ACPI_UINT32_MAX - ReturnValue) + 1;
}
*RetInteger = ReturnValue;
return (Status);
ErrorExit:
switch (Base)
{
case 8:
Status = AE_BAD_OCTAL_CONSTANT;
break;
case 10:
Status = AE_BAD_DECIMAL_CONSTANT;
break;
case 16:
Status = AE_BAD_HEX_CONSTANT;
break;
default:
/* Base validated above */
break;
}
return (Status);
Buffer[2] = (UINT8) AcpiUtHexToAsciiChar (RawByte, 4);
Buffer[3] = (UINT8) AcpiUtHexToAsciiChar (RawByte, 0);
}
/*******************************************************************************
*
* FUNCTION: UtConvertByteToAsmHex
*
* PARAMETERS: RawByte - Binary data
* Buffer - Pointer to where the hex bytes will be
* stored
*
* RETURN: Ascii hex byte is stored in Buffer.
*
* DESCRIPTION: Perform hex-to-ascii translation. The return data is prefixed
* with '0', and a trailing 'h' is added.
*
******************************************************************************/
void
UtConvertByteToAsmHex (
UINT8 RawByte,
UINT8 *Buffer)
{
Buffer[0] = '0';
Buffer[1] = (UINT8) AcpiUtHexToAsciiChar (RawByte, 4);
Buffer[2] = (UINT8) AcpiUtHexToAsciiChar (RawByte, 0);
Buffer[3] = 'h';
}
#endif /* OBSOLETE_FUNCTIONS */

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -47,7 +47,7 @@
ACPI_MODULE_NAME ("asluuid")
extern UINT8 AcpiGbl_MapToUuidOffset[UUID_BUFFER_LENGTH];
extern UINT8 AcpiGbl_MapToUuidOffset[UUID_BUFFER_LENGTH];
/*******************************************************************************
@ -90,11 +90,10 @@ AuValidateUuid (
return (AE_BAD_PARAMETER);
}
}
/* All other positions must contain hex digits */
else
{
/* All other positions must contain hex digits */
if (!isxdigit ((int) InString[i]))
{
return (AE_BAD_PARAMETER);

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -51,6 +51,13 @@
ACPI_MODULE_NAME ("aslwalks")
/* Local prototypes */
static void
AnAnalyzeStoreOperator (
ACPI_PARSE_OBJECT *Op);
/*******************************************************************************
*
* FUNCTION: AnMethodTypingWalkEnd
@ -73,7 +80,7 @@ AnMethodTypingWalkEnd (
UINT32 Level,
void *Context)
{
UINT32 ThisNodeBtype;
UINT32 ThisOpBtype;
switch (Op->Asl.ParseOpcode)
@ -88,18 +95,21 @@ AnMethodTypingWalkEnd (
if ((Op->Asl.Child) &&
(Op->Asl.Child->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG))
{
ThisNodeBtype = AnGetBtype (Op->Asl.Child);
ThisOpBtype = AnGetBtype (Op->Asl.Child);
if ((Op->Asl.Child->Asl.ParseOpcode == PARSEOP_METHODCALL) &&
(ThisNodeBtype == (ACPI_UINT32_MAX -1)))
(ThisOpBtype == (ACPI_UINT32_MAX -1)))
{
/*
* The called method is untyped at this time (typically a
* forward reference).
*
* Check for a recursive method call first.
* Check for a recursive method call first. Note: the
* Child->Node will be null if the method has not been
* resolved.
*/
if (Op->Asl.ParentMethod != Op->Asl.Child->Asl.Node->Op)
if (Op->Asl.Child->Asl.Node &&
(Op->Asl.ParentMethod != Op->Asl.Child->Asl.Node->Op))
{
/* We must type the method here */
@ -107,7 +117,7 @@ AnMethodTypingWalkEnd (
ASL_WALK_VISIT_UPWARD, NULL,
AnMethodTypingWalkEnd, NULL);
ThisNodeBtype = AnGetBtype (Op->Asl.Child);
ThisOpBtype = AnGetBtype (Op->Asl.Child);
}
}
@ -115,7 +125,7 @@ AnMethodTypingWalkEnd (
if (Op->Asl.ParentMethod)
{
Op->Asl.ParentMethod->Asl.AcpiBtype |= ThisNodeBtype;
Op->Asl.ParentMethod->Asl.AcpiBtype |= ThisOpBtype;
}
}
break;
@ -186,9 +196,9 @@ AnOperandTypecheckWalkEnd (
return (AE_OK);
}
ArgOp = Op->Asl.Child;
ArgOp = Op->Asl.Child;
OpcodeClass = OpInfo->Class;
RuntimeArgTypes = OpInfo->RuntimeArgs;
OpcodeClass = OpInfo->Class;
#ifdef ASL_ERROR_NAMED_OBJECT_IN_WHILE
/*
@ -247,6 +257,7 @@ AnOperandTypecheckWalkEnd (
{
return (AE_OK);
}
AnCheckMethodReturnValue (Op, OpInfo, ArgOp,
RequiredBtypes, ThisNodeBtype);
}
@ -271,6 +282,70 @@ AnOperandTypecheckWalkEnd (
return (AE_OK);
}
/*
* Special handling for certain opcodes.
*/
switch (Op->Asl.AmlOpcode)
{
/* BankField has one TermArg */
case AML_BANK_FIELD_OP:
OpcodeClass = AML_CLASS_EXECUTE;
ArgOp = ArgOp->Asl.Next;
ArgOp = ArgOp->Asl.Next;
break;
/* Operation Region has 2 TermArgs */
case AML_REGION_OP:
OpcodeClass = AML_CLASS_EXECUTE;
ArgOp = ArgOp->Asl.Next;
ArgOp = ArgOp->Asl.Next;
break;
/* DataTableRegion has 3 TermArgs */
case AML_DATA_REGION_OP:
OpcodeClass = AML_CLASS_EXECUTE;
ArgOp = ArgOp->Asl.Next;
break;
/* Buffers/Packages have a length that is a TermArg */
case AML_BUFFER_OP:
case AML_PACKAGE_OP:
case AML_VAR_PACKAGE_OP:
/* If length is a constant, we are done */
if ((ArgOp->Asl.ParseOpcode == PARSEOP_INTEGER) ||
(ArgOp->Asl.ParseOpcode == PARSEOP_RAW_DATA))
{
return (AE_OK);
}
break;
/* Store can write any object to the Debug object */
case AML_STORE_OP:
/*
* If this is a Store() to the Debug object, we don't need
* to perform any further validation -- because a Store of
* any object to Debug is permitted and supported.
*/
if (ArgOp->Asl.Next->Asl.AmlOpcode == AML_DEBUG_OP)
{
return (AE_OK);
}
break;
default:
break;
}
switch (OpcodeClass)
{
case AML_CLASS_EXECUTE:
@ -278,15 +353,6 @@ AnOperandTypecheckWalkEnd (
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;
@ -297,8 +363,12 @@ AnOperandTypecheckWalkEnd (
INCREMENT_ARG_LIST (RuntimeArgTypes);
}
/* Typecheck each argument */
while ((ArgType = GET_CURRENT_ARG_TYPE (RuntimeArgTypes2)))
{
/* Get the required type(s) for the argument */
RequiredBtypes = AnMapArgTypeToBtype (ArgType);
if (!ArgOp)
@ -308,6 +378,8 @@ AnOperandTypecheckWalkEnd (
AslAbort ();
}
/* Get the actual type of the argument */
ThisNodeBtype = AnGetBtype (ArgOp);
if (ThisNodeBtype == ACPI_UINT32_MAX)
{
@ -328,6 +400,10 @@ AnOperandTypecheckWalkEnd (
break;
}
/* Fallthrough */
case ARGI_STORE_TARGET:
if (ArgOp->Asl.ParseOpcode == PARSEOP_INTEGER)
{
/*
@ -339,25 +415,22 @@ AnOperandTypecheckWalkEnd (
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);
AslError (ASL_ERROR, ASL_MSG_RESOURCE_FIELD,
ArgOp, NULL);
}
else
{
AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ArgOp, NULL);
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;
#ifdef __FUTURE_IMPLEMENTATION
/*
* Possible future typechecking support
*/
case ARGI_REFERENCE: /* References */
case ARGI_INTEGER_REF:
case ARGI_OBJECT_REF:
@ -388,8 +461,8 @@ AnOperandTypecheckWalkEnd (
case PARSEOP_ARG5:
case PARSEOP_ARG6:
/* Hard to analyze argument types, sow we won't */
/* For now, just treat any arg as a typematch */
/* Hard to analyze argument types, so we won't */
/* for now. Just treat any arg as a typematch */
/* ThisNodeBtype = RequiredBtypes; */
break;
@ -400,10 +473,9 @@ AnOperandTypecheckWalkEnd (
default:
break;
}
break;
#endif
case ARGI_INTEGER:
default:
@ -411,6 +483,8 @@ AnOperandTypecheckWalkEnd (
}
/* Check for a type mismatch (required versus actual) */
CommonBtypes = ThisNodeBtype & RequiredBtypes;
if (ArgOp->Asl.ParseOpcode == PARSEOP_METHODCALL)
@ -438,9 +512,10 @@ AnOperandTypecheckWalkEnd (
AnFormatBtype (StringBuffer2, RequiredBtypes);
sprintf (MsgBuffer, "[%s] found, %s operator requires [%s]",
StringBuffer, OpInfo->Name, StringBuffer2);
StringBuffer, OpInfo->Name, StringBuffer2);
AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ArgOp, MsgBuffer);
AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE,
ArgOp, MsgBuffer);
}
NextArgument:
@ -477,14 +552,15 @@ AnOtherSemanticAnalysisWalkBegin (
UINT32 Level,
void *Context)
{
ACPI_PARSE_OBJECT *ArgNode;
ACPI_PARSE_OBJECT *PrevArgNode = NULL;
ACPI_PARSE_OBJECT *ArgOp;
ACPI_PARSE_OBJECT *PrevArgOp = NULL;
const ACPI_OPCODE_INFO *OpInfo;
ACPI_NAMESPACE_NODE *Node;
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.
@ -497,30 +573,31 @@ AnOtherSemanticAnalysisWalkBegin (
if (OpInfo->Flags & AML_HAS_TARGET)
{
/*
* Find the target node, it is always the last child. If the traget
* Find the target node, it is always the last child. If the target
* 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)
ArgOp = Op->Asl.Child;
while (ArgOp->Asl.Next)
{
PrevArgNode = ArgNode;
ArgNode = ArgNode->Asl.Next;
PrevArgOp = ArgOp;
ArgOp = ArgOp->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))
if ((ArgOp->Asl.ParseOpcode == PARSEOP_ZERO) &&
(PrevArgOp) &&
(PrevArgOp->Asl.ParseOpcode == PARSEOP_ZERO))
{
AslError (ASL_ERROR, ASL_MSG_RESULT_NOT_USED,
Op, Op->Asl.ExternalName);
}
}
else if (ArgNode->Asl.ParseOpcode == PARSEOP_ZERO)
else if (ArgOp->Asl.ParseOpcode == PARSEOP_ZERO)
{
AslError (ASL_ERROR, ASL_MSG_RESULT_NOT_USED,
Op, Op->Asl.ExternalName);
@ -555,6 +632,15 @@ AnOtherSemanticAnalysisWalkBegin (
*/
switch (Op->Asl.ParseOpcode)
{
case PARSEOP_STORE:
if (Gbl_DoTypechecking)
{
AnAnalyzeStoreOperator (Op);
}
break;
case PARSEOP_ACQUIRE:
case PARSEOP_WAIT:
/*
@ -566,16 +652,16 @@ AnOtherSemanticAnalysisWalkBegin (
/* First child is the namepath, 2nd child is timeout */
ArgNode = Op->Asl.Child;
ArgNode = ArgNode->Asl.Next;
ArgOp = Op->Asl.Child;
ArgOp = ArgOp->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))
if (((ArgOp->Asl.ParseOpcode == PARSEOP_WORDCONST) ||
(ArgOp->Asl.ParseOpcode == PARSEOP_INTEGER)) &&
(ArgOp->Asl.Value.Integer >= (UINT64) ACPI_WAIT_FOREVER))
{
break;
}
@ -586,7 +672,7 @@ AnOtherSemanticAnalysisWalkBegin (
*/
if (!AnIsResultUsed (Op))
{
AslError (ASL_WARNING, ASL_MSG_TIMEOUT, ArgNode,
AslError (ASL_WARNING, ASL_MSG_TIMEOUT, ArgOp,
Op->Asl.ExternalName);
}
break;
@ -595,15 +681,15 @@ AnOtherSemanticAnalysisWalkBegin (
/*
* Check for a zero Length (NumBits) operand. NumBits is the 3rd operand
*/
ArgNode = Op->Asl.Child;
ArgNode = ArgNode->Asl.Next;
ArgNode = ArgNode->Asl.Next;
ArgOp = Op->Asl.Child;
ArgOp = ArgOp->Asl.Next;
ArgOp = ArgOp->Asl.Next;
if ((ArgNode->Asl.ParseOpcode == PARSEOP_ZERO) ||
((ArgNode->Asl.ParseOpcode == PARSEOP_INTEGER) &&
(ArgNode->Asl.Value.Integer == 0)))
if ((ArgOp->Asl.ParseOpcode == PARSEOP_ZERO) ||
((ArgOp->Asl.ParseOpcode == PARSEOP_INTEGER) &&
(ArgOp->Asl.Value.Integer == 0)))
{
AslError (ASL_ERROR, ASL_MSG_NON_ZERO, ArgNode, NULL);
AslError (ASL_ERROR, ASL_MSG_NON_ZERO, ArgOp, NULL);
}
break;
@ -612,24 +698,24 @@ AnOtherSemanticAnalysisWalkBegin (
* Ensure that the referenced operation region has the correct SPACE_ID.
* From the grammar/parser, we know the parent is a FIELD definition.
*/
ArgNode = Op->Asl.Parent; /* Field definition */
ArgNode = ArgNode->Asl.Child; /* First child is the OpRegion Name */
Node = ArgNode->Asl.Node; /* OpRegion namespace node */
ArgOp = Op->Asl.Parent; /* Field definition */
ArgOp = ArgOp->Asl.Child; /* First child is the OpRegion Name */
Node = ArgOp->Asl.Node; /* OpRegion namespace node */
if (!Node)
{
break;
}
ArgNode = Node->Op; /* OpRegion definition */
ArgNode = ArgNode->Asl.Child; /* First child is the OpRegion Name */
ArgNode = ArgNode->Asl.Next; /* Next peer is the SPACE_ID (what we want) */
ArgOp = Node->Op; /* OpRegion definition */
ArgOp = ArgOp->Asl.Child; /* First child is the OpRegion Name */
ArgOp = ArgOp->Asl.Next; /* Next peer is the SPACE_ID (what we want) */
/*
* The Connection() operator is only valid for the following operation
* region SpaceIds: GeneralPurposeIo and GenericSerialBus.
*/
if ((ArgNode->Asl.Value.Integer != ACPI_ADR_SPACE_GPIO) &&
(ArgNode->Asl.Value.Integer != ACPI_ADR_SPACE_GSBUS))
if ((ArgOp->Asl.Value.Integer != ACPI_ADR_SPACE_GPIO) &&
(ArgOp->Asl.Value.Integer != ACPI_ADR_SPACE_GSBUS))
{
AslError (ASL_ERROR, ASL_MSG_CONNECTION_INVALID, Op, NULL);
}
@ -640,46 +726,46 @@ AnOtherSemanticAnalysisWalkBegin (
* Ensure that fields for GeneralPurposeIo and GenericSerialBus
* contain at least one Connection() operator
*/
ArgNode = Op->Asl.Child; /* 1st child is the OpRegion Name */
Node = ArgNode->Asl.Node; /* OpRegion namespace node */
ArgOp = Op->Asl.Child; /* 1st child is the OpRegion Name */
Node = ArgOp->Asl.Node; /* OpRegion namespace node */
if (!Node)
{
break;
}
ArgNode = Node->Op; /* OpRegion definition */
ArgNode = ArgNode->Asl.Child; /* First child is the OpRegion Name */
ArgNode = ArgNode->Asl.Next; /* Next peer is the SPACE_ID (what we want) */
ArgOp = Node->Op; /* OpRegion definition */
ArgOp = ArgOp->Asl.Child; /* First child is the OpRegion Name */
ArgOp = ArgOp->Asl.Next; /* Next peer is the SPACE_ID (what we want) */
/* We are only interested in GeneralPurposeIo and GenericSerialBus */
if ((ArgNode->Asl.Value.Integer != ACPI_ADR_SPACE_GPIO) &&
(ArgNode->Asl.Value.Integer != ACPI_ADR_SPACE_GSBUS))
if ((ArgOp->Asl.Value.Integer != ACPI_ADR_SPACE_GPIO) &&
(ArgOp->Asl.Value.Integer != ACPI_ADR_SPACE_GSBUS))
{
break;
}
ArgNode = Op->Asl.Child; /* 1st child is the OpRegion Name */
ArgNode = ArgNode->Asl.Next; /* AccessType */
ArgNode = ArgNode->Asl.Next; /* LockRule */
ArgNode = ArgNode->Asl.Next; /* UpdateRule */
ArgNode = ArgNode->Asl.Next; /* Start of FieldUnitList */
ArgOp = Op->Asl.Child; /* 1st child is the OpRegion Name */
ArgOp = ArgOp->Asl.Next; /* AccessType */
ArgOp = ArgOp->Asl.Next; /* LockRule */
ArgOp = ArgOp->Asl.Next; /* UpdateRule */
ArgOp = ArgOp->Asl.Next; /* Start of FieldUnitList */
/* Walk the FieldUnitList */
while (ArgNode)
while (ArgOp)
{
if (ArgNode->Asl.ParseOpcode == PARSEOP_CONNECTION)
if (ArgOp->Asl.ParseOpcode == PARSEOP_CONNECTION)
{
break;
}
else if (ArgNode->Asl.ParseOpcode == PARSEOP_NAMESEG)
else if (ArgOp->Asl.ParseOpcode == PARSEOP_NAMESEG)
{
AslError (ASL_ERROR, ASL_MSG_CONNECTION_MISSING, ArgNode, NULL);
AslError (ASL_ERROR, ASL_MSG_CONNECTION_MISSING, ArgOp, NULL);
break;
}
ArgNode = ArgNode->Asl.Next;
ArgOp = ArgOp->Asl.Next;
}
break;
@ -690,3 +776,202 @@ AnOtherSemanticAnalysisWalkBegin (
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AnAnalyzeStoreOperator
*
* PARAMETERS: Op - Store() operator
*
* RETURN: None
*
* DESCRIPTION: Analyze a store operator. Mostly for stores to/from package
* objects where there are more restrictions than other data
* types.
*
******************************************************************************/
static void
AnAnalyzeStoreOperator (
ACPI_PARSE_OBJECT *Op)
{
ACPI_NAMESPACE_NODE *SourceNode;
ACPI_NAMESPACE_NODE *TargetNode;
ACPI_PARSE_OBJECT *SourceOperandOp;
ACPI_PARSE_OBJECT *TargetOperandOp;
UINT32 SourceOperandBtype;
UINT32 TargetOperandBtype;
/* Extract the two operands for STORE */
SourceOperandOp = Op->Asl.Child;
TargetOperandOp = SourceOperandOp->Asl.Next;
/*
* Ignore these Source operand opcodes, they cannot be typechecked,
* the actual result is unknown here.
*/
switch (SourceOperandOp->Asl.ParseOpcode)
{
/* For these, type of the returned value is unknown at compile time */
case PARSEOP_DEREFOF:
case PARSEOP_METHODCALL:
case PARSEOP_STORE:
case PARSEOP_COPYOBJECT:
return;
case PARSEOP_INDEX:
case PARSEOP_REFOF:
if (!Gbl_EnableReferenceTypechecking)
{
return;
}
/*
* These opcodes always return an object reference, and thus
* the result can only be stored to a Local, Arg, or Debug.
*/
if (TargetOperandOp->Asl.AmlOpcode == AML_DEBUG_OP)
{
return;
}
if ((TargetOperandOp->Asl.AmlOpcode < AML_LOCAL0) ||
(TargetOperandOp->Asl.AmlOpcode > AML_ARG6))
{
AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, TargetOperandOp,
"Source [Reference], Target must be [Local/Arg/Debug]");
}
return;
default:
break;
}
/*
* Ignore these Target operand opcodes, they cannot be typechecked
*/
switch (TargetOperandOp->Asl.ParseOpcode)
{
case PARSEOP_DEBUG:
case PARSEOP_DEREFOF:
case PARSEOP_REFOF:
case PARSEOP_INDEX:
return;
case PARSEOP_METHODCALL:
/*
* A target is not allowed to be a method call.
* It is not supported by the ACPICA interpreter, nor is it
* supported by the MS ASL compiler or the MS interpreter.
* Although legal syntax up until ACPI 6.1, support for this
* will be removed for ACPI 6.2 (02/2016)
*/
AslError (ASL_ERROR, ASL_MSG_SYNTAX,
TargetOperandOp, "Illegal method invocation as a target operand");
return;
default:
break;
}
/*
* Ignore typecheck for External() operands of type "UnknownObj",
* we don't know the actual type (source or target).
*/
SourceNode = SourceOperandOp->Asl.Node;
if (SourceNode &&
(SourceNode->Flags & ANOBJ_IS_EXTERNAL) &&
(SourceNode->Type == ACPI_TYPE_ANY))
{
return;
}
TargetNode = TargetOperandOp->Asl.Node;
if (TargetNode &&
(TargetNode->Flags & ANOBJ_IS_EXTERNAL) &&
(TargetNode->Type == ACPI_TYPE_ANY))
{
return;
}
/*
* A NULL node with a namepath AML opcode indicates non-existent
* name. Just return, the error message is generated elsewhere.
*/
if ((!SourceNode && (SourceOperandOp->Asl.AmlOpcode == AML_INT_NAMEPATH_OP)) ||
(!TargetNode && (TargetOperandOp->Asl.AmlOpcode == AML_INT_NAMEPATH_OP)))
{
return;
}
/*
* Simple check for source same as target via NS node.
* -- Could be expanded to locals and args.
*/
if (SourceNode && TargetNode)
{
if (SourceNode == TargetNode)
{
AslError (ASL_WARNING, ASL_MSG_DUPLICATE_ITEM,
TargetOperandOp, "Source is the same as Target");
return;
}
}
/* Ignore typecheck if either source or target is a local or arg */
if ((SourceOperandOp->Asl.AmlOpcode >= AML_LOCAL0) &&
(SourceOperandOp->Asl.AmlOpcode <= AML_ARG6))
{
return; /* Cannot type a local/arg at compile time */
}
if ((TargetOperandOp->Asl.AmlOpcode >= AML_LOCAL0) &&
(TargetOperandOp->Asl.AmlOpcode <= AML_ARG6))
{
return; /* Cannot type a local/arg at compile time */
}
/*
* Package objects are a special case because they cannot by implicitly
* converted to/from anything. Check for these two illegal cases:
*
* Store (non-package, package)
* Store (package, non-package)
*/
SourceOperandBtype = AnGetBtype (SourceOperandOp);
TargetOperandBtype = AnGetBtype (TargetOperandOp);
/* Check source first for (package, non-package) case */
if (SourceOperandBtype & ACPI_BTYPE_PACKAGE)
{
/* If Source is PACKAGE-->Target must be PACKAGE */
if (!(TargetOperandBtype & ACPI_BTYPE_PACKAGE))
{
AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, TargetOperandOp,
"Source is [Package], Target must be a package also");
}
}
/* Else check target for (non-package, package) case */
else if (TargetOperandBtype & ACPI_BTYPE_PACKAGE)
{
/* If Target is PACKAGE, Source must be PACKAGE */
if (!(SourceOperandBtype & ACPI_BTYPE_PACKAGE))
{
AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, SourceOperandOp,
"Target is [Package], Source must be a package also");
}
}
}

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -133,8 +133,6 @@ XfCrossReferenceNamespace (
ACPI_WALK_STATE *WalkState;
DbgPrint (ASL_DEBUG_OUTPUT, "\nCross referencing namespace\n\n");
/*
* Create a new walk state for use when looking up names
* within the namespace (Passed as context to the callbacks)
@ -147,8 +145,8 @@ XfCrossReferenceNamespace (
/* Walk the entire parse tree */
TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, XfNamespaceLocateBegin,
XfNamespaceLocateEnd, WalkState);
TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_TWICE,
XfNamespaceLocateBegin, XfNamespaceLocateEnd, WalkState);
ACPI_FREE (WalkState);
return (AE_OK);
@ -177,8 +175,8 @@ XfObjectExists (
/* Walk entire namespace from the supplied root */
Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
ACPI_UINT32_MAX, FALSE, XfCompareOneNamespaceObject, NULL,
Name, NULL);
ACPI_UINT32_MAX, FALSE, XfCompareOneNamespaceObject, NULL,
Name, NULL);
if (Status == AE_CTRL_TRUE)
{
/* At least one instance of the name was found */
@ -575,6 +573,7 @@ XfNamespaceLocateBegin (
{
NextOp = NextOp->Asl.Next;
}
Path = NextOp->Asl.Value.String;
}
else
@ -596,7 +595,7 @@ XfNamespaceLocateBegin (
Gbl_NsLookupCount++;
Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
ACPI_IMODE_EXECUTE, Flags, WalkState, &(Node));
ACPI_IMODE_EXECUTE, Flags, WalkState, &(Node));
if (ACPI_FAILURE (Status))
{
if (Status == AE_NOT_FOUND)
@ -778,7 +777,8 @@ XfNamespaceLocateBegin (
if (Message)
{
sprintf (MsgBuffer, "Size mismatch, Tag: %u bit%s, Field: %u bit%s",
sprintf (MsgBuffer,
"Size mismatch, Tag: %u bit%s, Field: %u bit%s",
TagBitLength, (TagBitLength > 1) ? "s" : "",
FieldBitLength, (FieldBitLength > 1) ? "s" : "");
@ -847,7 +847,7 @@ XfNamespaceLocateBegin (
if (Node->Type != ACPI_TYPE_METHOD)
{
sprintf (MsgBuffer, "%s is a %s",
Op->Asl.ExternalName, AcpiUtGetTypeName (Node->Type));
Op->Asl.ExternalName, AcpiUtGetTypeName (Node->Type));
AslError (ASL_ERROR, ASL_MSG_NOT_METHOD, Op, MsgBuffer);
return_ACPI_STATUS (AE_OK);
@ -870,7 +870,7 @@ XfNamespaceLocateBegin (
UtSetParseOpName (Op);
PassedArgs = 0;
NextOp = Op->Asl.Child;
NextOp = Op->Asl.Child;
while (NextOp)
{
@ -878,7 +878,8 @@ XfNamespaceLocateBegin (
NextOp = NextOp->Asl.Next;
}
if (Node->Value != ASL_EXTERNAL_METHOD)
if (Node->Value != ASL_EXTERNAL_METHOD &&
Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_EXTERNAL)
{
/*
* Check the parsed arguments with the number expected by the
@ -976,7 +977,8 @@ XfNamespaceLocateBegin (
case ACPI_ADR_SPACE_CMOS:
case ACPI_ADR_SPACE_GPIO:
if ((UINT8) Op->Asl.Parent->Asl.Value.Integer != AML_FIELD_ACCESS_BYTE)
if ((UINT8) Op->Asl.Parent->Asl.Value.Integer !=
AML_FIELD_ACCESS_BYTE)
{
AslError (ASL_ERROR, ASL_MSG_REGION_BYTE_ACCESS, Op, NULL);
}
@ -986,7 +988,8 @@ XfNamespaceLocateBegin (
case ACPI_ADR_SPACE_IPMI:
case ACPI_ADR_SPACE_GSBUS:
if ((UINT8) Op->Asl.Parent->Asl.Value.Integer != AML_FIELD_ACCESS_BUFFER)
if ((UINT8) Op->Asl.Parent->Asl.Value.Integer !=
AML_FIELD_ACCESS_BUFFER)
{
AslError (ASL_ERROR, ASL_MSG_REGION_BUFFER_ACCESS, Op, NULL);
}
@ -1014,10 +1017,10 @@ XfNamespaceLocateBegin (
if (Op->Asl.Parent->Asl.ExtraValue && Op->Asl.Child)
{
XfCheckFieldRange (Op,
Op->Asl.Parent->Asl.ExtraValue,
Op->Asl.ExtraValue,
(UINT32) Op->Asl.Child->Asl.Value.Integer,
Op->Asl.Child->Asl.ExtraValue);
Op->Asl.Parent->Asl.ExtraValue,
Op->Asl.ExtraValue,
(UINT32) Op->Asl.Child->Asl.Value.Integer,
Op->Asl.Child->Asl.ExtraValue);
}
}
}

View File

@ -0,0 +1,814 @@
/******************************************************************************
*
* Module Name: aslxrefout.c - support for optional cross-reference file
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2016, 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 <contrib/dev/acpica/compiler/aslcompiler.h>
#include "aslcompiler.y.h"
#include <contrib/dev/acpica/include/acnamesp.h>
#include <contrib/dev/acpica/include/acparser.h>
#include <contrib/dev/acpica/include/amlcode.h>
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslxrefout")
/* Local prototypes */
static ACPI_STATUS
OtXrefWalkPart2 (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context);
static ACPI_STATUS
OtXrefWalkPart3 (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context);
static ACPI_STATUS
OtXrefAnalysisWalkPart1 (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context);
static ACPI_STATUS
OtXrefAnalysisWalkPart2 (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context);
static ACPI_STATUS
OtXrefAnalysisWalkPart3 (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context);
/*******************************************************************************
*
* FUNCTION: OtPrintHeaders
*
* PARAMETERS: Message - Main header message
*
* RETURN: None
*
* DESCRIPTION: Emits the main header message along with field descriptions
*
******************************************************************************/
void
OtPrintHeaders (
char *Message)
{
UINT32 Length;
Length = strlen (Message);
FlPrintFile (ASL_FILE_XREF_OUTPUT, "\n\n%s\n", Message);
while (Length)
{
FlPrintFile (ASL_FILE_XREF_OUTPUT, "-");
Length--;
}
FlPrintFile (ASL_FILE_XREF_OUTPUT, "\n\nLineno %-40s Description\n",
"Full Pathname");
}
/*******************************************************************************
*
* FUNCTION: OtCreateXrefFile
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION Main entry point for parts 2 and 3 of the cross-reference
* file.
*
******************************************************************************/
void
OtCreateXrefFile (
void)
{
ASL_XREF_INFO XrefInfo;
/* Build cross-reference output file if requested */
if (!Gbl_CrossReferenceOutput)
{
return;
}
memset (&XrefInfo, 0, sizeof (ASL_XREF_INFO));
/* Cross-reference output file, part 2 (Method invocations) */
OtPrintHeaders ("Part 2: Method Reference Map "
"(Invocations of each user-defined control method)");
TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD,
OtXrefWalkPart2, NULL, &XrefInfo);
/* Cross-reference output file, part 3 (All other object refs) */
OtPrintHeaders ("Part 3: Full Object Reference Map "
"(Methods that reference each object in namespace");
TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD,
OtXrefWalkPart3, NULL, &XrefInfo);
/* Cross-reference summary */
FlPrintFile (ASL_FILE_XREF_OUTPUT, "\n\nObject Summary\n");
FlPrintFile (ASL_FILE_XREF_OUTPUT,
"\nTotal methods: %u\n",
XrefInfo.TotalPredefinedMethods + XrefInfo.TotalUserMethods);
FlPrintFile (ASL_FILE_XREF_OUTPUT,
"Total predefined methods: %u\n",
XrefInfo.TotalPredefinedMethods);
FlPrintFile (ASL_FILE_XREF_OUTPUT,
"\nTotal user methods: %u\n",
XrefInfo.TotalUserMethods);
FlPrintFile (ASL_FILE_XREF_OUTPUT,
"Total unreferenced user methods %u\n",
XrefInfo.TotalUnreferenceUserMethods);
FlPrintFile (ASL_FILE_XREF_OUTPUT,
"\nTotal defined objects: %u\n",
XrefInfo.TotalObjects);
FlPrintFile (ASL_FILE_XREF_OUTPUT,
"Total unreferenced objects: %u\n",
XrefInfo.TotalUnreferencedObjects);
}
/*
* Part 1 of the cross reference file. This part emits the namespace objects
* that are referenced by each control method in the namespace.
*
* Part 2 and 3 are below part 1.
*/
/*******************************************************************************
*
* FUNCTION: OtXrefWalkPart1
*
* PARAMETERS: Op - Current parse Op
* Level - Current tree nesting level
* MethodInfo - Info block for the current method
*
*
* RETURN: None
*
* DESCRIPTION: Entry point for the creation of the method call reference map.
* For each control method in the namespace, all other methods
* that invoke the method are listed. Predefined names/methods
* that start with an underscore are ignored, because these are
* essentially external/public interfaces.
* DESCRIPTION: Entry point for the creation of the object reference map.
* For each control method in the namespace, all objects that
* are referenced by the method are listed.
*
* Called during a normal namespace walk, once per namespace
* object. (MtMethodAnalysisWalkBegin)
*
******************************************************************************/
void
OtXrefWalkPart1 (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
ASL_METHOD_INFO *MethodInfo)
{
ACPI_NAMESPACE_NODE *Node;
ACPI_PARSE_OBJECT *NextOp;
ACPI_PARSE_OBJECT *FieldOp;
char *ParentPath;
UINT32 Length;
ACPI_STATUS Status;
switch (Op->Asl.ParseOpcode)
{
case PARSEOP_NAMESEG:
case PARSEOP_NAMESTRING:
case PARSEOP_METHODCALL:
if (!MethodInfo ||
(MethodInfo->Op->Asl.Child == Op) ||
!Op->Asl.Node)
{
break;
}
MethodInfo->CurrentOp = Op;
Node = Op->Asl.Node;
/* Find all objects referenced by this method */
Status = TrWalkParseTree (MethodInfo->Op, ASL_WALK_VISIT_DOWNWARD,
OtXrefAnalysisWalkPart1, NULL, MethodInfo);
if (Status == AE_CTRL_TERMINATE)
{
ParentPath = AcpiNsGetNormalizedPathname (Node, TRUE);
FlPrintFile (ASL_FILE_XREF_OUTPUT, " %-40s %s",
ParentPath, AcpiUtGetTypeName (Node->Type));
ACPI_FREE (ParentPath);
switch (Node->Type)
{
/* Handle externals */
case ACPI_TYPE_ANY:
case ACPI_TYPE_FIELD_UNIT:
FlPrintFile (ASL_FILE_XREF_OUTPUT, " <External Object>");
break;
case ACPI_TYPE_INTEGER:
FlPrintFile (ASL_FILE_XREF_OUTPUT, " %8.8X%8.8X",
ACPI_FORMAT_UINT64 (Op->Asl.Value.Integer));
break;
case ACPI_TYPE_METHOD:
FlPrintFile (ASL_FILE_XREF_OUTPUT, " Invocation (%u args)",
Node->ArgCount);
break;
case ACPI_TYPE_BUFFER_FIELD:
NextOp = Node->Op; /* Create Buffer Field Op */
switch (NextOp->Asl.ParseOpcode)
{
case PARSEOP_CREATEBITFIELD:
Length = 1;
break;
case PARSEOP_CREATEBYTEFIELD:
Length = 8;
break;
case PARSEOP_CREATEWORDFIELD:
Length = 16;
break;
case PARSEOP_CREATEDWORDFIELD:
Length = 32;
break;
case PARSEOP_CREATEQWORDFIELD:
Length = 64;
break;
default:
Length = 0;
break;
}
NextOp = NextOp->Asl.Child; /* Buffer name */
if (!NextOp->Asl.ExternalName)
{
FlPrintFile (ASL_FILE_XREF_OUTPUT, " in Arg/Local");
}
else
{
ParentPath = AcpiNsGetNormalizedPathname (
NextOp->Asl.Node, TRUE);
FlPrintFile (ASL_FILE_XREF_OUTPUT, " (%.2u bit) in Buffer %s",
Length, ParentPath);
ACPI_FREE (ParentPath);
}
break;
case ACPI_TYPE_LOCAL_REGION_FIELD:
NextOp = Node->Op;
FieldOp = NextOp->Asl.Parent;
NextOp = FieldOp->Asl.Child;
ParentPath = AcpiNsGetNormalizedPathname (
NextOp->Asl.Node, TRUE);
FlPrintFile (ASL_FILE_XREF_OUTPUT, " (%.2u bit) in Region %s",
(UINT32) Node->Op->Asl.Child->Asl.Value.Integer,
ParentPath);
ACPI_FREE (ParentPath);
if (FieldOp->Asl.ParseOpcode == PARSEOP_FIELD)
{
Node = NextOp->Asl.Node; /* Region node */
NextOp = Node->Op; /* PARSEOP_REGION */
NextOp = NextOp->Asl.Child; /* Region name */
NextOp = NextOp->Asl.Next;
/* Get region space/addr/len? */
FlPrintFile (ASL_FILE_XREF_OUTPUT, " (%s)",
AcpiUtGetRegionName ((UINT8)
NextOp->Asl.Value.Integer));
}
break;
default:
break;
}
FlPrintFile (ASL_FILE_XREF_OUTPUT, "\n");
}
break;
case PARSEOP_METHOD:
ParentPath = AcpiNsGetNormalizedPathname (Op->Asl.Node, TRUE);
FlPrintFile (ASL_FILE_XREF_OUTPUT,
"\n[%5u] %-40s %s Declaration (%u args)\n",
Op->Asl.LogicalLineNumber, ParentPath,
AcpiUtGetTypeName (Op->Asl.Node->Type), Op->Asl.Node->ArgCount);
ACPI_FREE (ParentPath);
break;
default:
break;
}
}
/*******************************************************************************
*
* FUNCTION: OtXrefAnalysisWalkPart1
*
* PARAMETERS: ASL_WALK_CALLBACK
*
* RETURN: Status
*
* DESCRIPTION: Secondary walk for cross-reference part 1.
*
******************************************************************************/
static ACPI_STATUS
OtXrefAnalysisWalkPart1 (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context)
{
ASL_METHOD_INFO *MethodInfo = (ASL_METHOD_INFO *) Context;
ACPI_PARSE_OBJECT *Next;
/* Only interested in name string Ops -- ignore all others */
if ((Op->Asl.ParseOpcode != PARSEOP_NAMESEG) &&
(Op->Asl.ParseOpcode != PARSEOP_NAMESTRING) &&
(Op->Asl.ParseOpcode != PARSEOP_METHODCALL))
{
return (AE_OK);
}
/* No node means a locally declared object -- ignore */
if (!Op->Asl.Node)
{
return (AE_OK);
}
/* When we encounter the source Op, we are done */
Next = MethodInfo->CurrentOp;
if (Next == Op)
{
return (AE_CTRL_TERMINATE);
}
/* If we have a name match, this Op is a duplicate */
if ((Next->Asl.ParseOpcode == PARSEOP_NAMESEG) ||
(Next->Asl.ParseOpcode == PARSEOP_NAMESTRING) ||
(Next->Asl.ParseOpcode == PARSEOP_METHODCALL))
{
if (!strcmp (Op->Asl.ExternalName, Next->Asl.ExternalName))
{
return (AE_ALREADY_EXISTS);
}
}
return (AE_OK);
}
/*
* Part 2 of the cross reference file. This part emits the names of each
* non-predefined method in the namespace (user methods), along with the
* names of each control method that references that method.
*/
/*******************************************************************************
*
* FUNCTION: OtXrefWalkPart2
*
* PARAMETERS: ASL_WALK_CALLBACK
*
* RETURN: Status
*
* DESCRIPTION: For each control method in the namespace, we will re-walk the
* namespace to find each and every invocation of that control
* method. Brute force, but does not matter, even for large
* namespaces. Ignore predefined names (start with underscore).
*
******************************************************************************/
static ACPI_STATUS
OtXrefWalkPart2 (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context)
{
ASL_XREF_INFO *XrefInfo = (ASL_XREF_INFO *) Context;
ACPI_NAMESPACE_NODE *Node;
char *ParentPath;
/* Looking for Method Declaration Ops only */
if (!Op->Asl.Node ||
(Op->Asl.ParseOpcode != PARSEOP_METHOD))
{
return (AE_OK);
}
/* Ignore predefined names */
if (Op->Asl.Node->Name.Ascii[0] == '_')
{
XrefInfo->TotalPredefinedMethods++;
return (AE_OK);
}
Node = Op->Asl.Node;
ParentPath = AcpiNsGetNormalizedPathname (Node, TRUE);
FlPrintFile (ASL_FILE_XREF_OUTPUT,
"\n[%5u] %-40s %s Declaration (%u args)\n",
Op->Asl.LogicalLineNumber, ParentPath,
AcpiUtGetTypeName (Node->Type), Node->ArgCount);
XrefInfo->TotalUserMethods++;
XrefInfo->ThisMethodInvocations = 0;
XrefInfo->MethodOp = Op;
(void) TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD,
OtXrefAnalysisWalkPart2, NULL, XrefInfo);
if (!XrefInfo->ThisMethodInvocations)
{
FlPrintFile (ASL_FILE_XREF_OUTPUT,
" Zero invocations of this method in this module\n");
XrefInfo->TotalUnreferenceUserMethods++;
}
else
{
FlPrintFile (ASL_FILE_XREF_OUTPUT,
" %u invocations of method %s in this module\n",
XrefInfo->ThisMethodInvocations, ParentPath);
}
ACPI_FREE (ParentPath);
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: OtXrefAnalysisWalkPart2
*
* PARAMETERS: ASL_WALK_CALLBACK
*
* RETURN: Status
*
* DESCRIPTION: For every Op that is a method invocation, emit a reference
* line if the Op is invoking the target method.
*
******************************************************************************/
static ACPI_STATUS
OtXrefAnalysisWalkPart2 (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context)
{
ASL_XREF_INFO *XrefInfo = (ASL_XREF_INFO *) Context;
ACPI_PARSE_OBJECT *CallerOp;
char *CallerFullPathname;
/* Looking for MethodCall Ops only */
if (!Op->Asl.Node ||
(Op->Asl.ParseOpcode != PARSEOP_METHODCALL))
{
return (AE_OK);
}
/* If not a match to the target method, we are done */
if (Op->Asl.Node != XrefInfo->MethodOp->Asl.Node)
{
return (AE_CTRL_DEPTH);
}
/* Find parent method to get method caller namepath */
CallerOp = Op->Asl.Parent;
while (CallerOp &&
(CallerOp->Asl.ParseOpcode != PARSEOP_METHOD))
{
CallerOp = CallerOp->Asl.Parent;
}
/* There is no parent method for External() statements */
if (!CallerOp)
{
return (AE_OK);
}
CallerFullPathname = AcpiNsGetNormalizedPathname (
CallerOp->Asl.Node, TRUE);
FlPrintFile (ASL_FILE_XREF_OUTPUT,
"[%5u] %-40s Invocation path: %s\n",
Op->Asl.LogicalLineNumber, CallerFullPathname,
Op->Asl.ExternalName);
ACPI_FREE (CallerFullPathname);
XrefInfo->ThisMethodInvocations++;
return (AE_OK);
}
/*
* Part 3 of the cross reference file. This part emits the names of each
* non-predefined method in the namespace (user methods), along with the
* names of each control method that references that method.
*/
/*******************************************************************************
*
* FUNCTION: OtXrefWalkPart3
*
* PARAMETERS: ASL_WALK_CALLBACK
*
* RETURN: Status
*
* DESCRIPTION: Cross-reference part 3. references to objects other than
* control methods.
*
******************************************************************************/
static ACPI_STATUS
OtXrefWalkPart3 (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context)
{
ASL_XREF_INFO *XrefInfo = (ASL_XREF_INFO *) Context;
ACPI_NAMESPACE_NODE *Node;
char *ParentPath;
const ACPI_OPCODE_INFO *OpInfo;
/* Ignore method declarations */
if (!Op->Asl.Node ||
(Op->Asl.ParseOpcode == PARSEOP_METHOD))
{
return (AE_OK);
}
OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode);
if (!(OpInfo->Class & AML_CLASS_NAMED_OBJECT))
{
return (AE_OK);
}
/* Only care about named object creation opcodes */
if ((Op->Asl.ParseOpcode != PARSEOP_NAME) &&
(Op->Asl.ParseOpcode != PARSEOP_DEVICE) &&
(Op->Asl.ParseOpcode != PARSEOP_MUTEX) &&
(Op->Asl.ParseOpcode != PARSEOP_OPERATIONREGION) &&
(Op->Asl.ParseOpcode != PARSEOP_FIELD) &&
(Op->Asl.ParseOpcode != PARSEOP_EVENT))
{
return (AE_OK);
}
/* Ignore predefined names */
if (Op->Asl.Node->Name.Ascii[0] == '_')
{
return (AE_OK);
}
Node = Op->Asl.Node;
ParentPath = AcpiNsGetNormalizedPathname (Node, TRUE);
FlPrintFile (ASL_FILE_XREF_OUTPUT,
"\n[%5u] %-40s %s Declaration\n",
Op->Asl.LogicalLineNumber, ParentPath,
AcpiUtGetTypeName (Node->Type));
ACPI_FREE (ParentPath);
XrefInfo->MethodOp = Op;
XrefInfo->ThisObjectReferences = 0;
XrefInfo->TotalObjects = 0;
(void) TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD,
OtXrefAnalysisWalkPart3, NULL, XrefInfo);
if (!XrefInfo->ThisObjectReferences)
{
FlPrintFile (ASL_FILE_XREF_OUTPUT,
" Zero references to this object in this module\n");
XrefInfo->TotalUnreferencedObjects++;
}
else
{
FlPrintFile (ASL_FILE_XREF_OUTPUT,
" %u references to this object in this module\n",
XrefInfo->ThisObjectReferences, ParentPath);
}
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: OtXrefAnalysisWalkPart3
*
* PARAMETERS: ASL_WALK_CALLBACK
*
* RETURN: Status
*
* DESCRIPTION: Secondary walk for cross-reference part 3.
*
******************************************************************************/
static ACPI_STATUS
OtXrefAnalysisWalkPart3 (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context)
{
ASL_XREF_INFO *XrefInfo = (ASL_XREF_INFO *) Context;
char *CallerFullPathname = NULL;
ACPI_PARSE_OBJECT *CallerOp;
const char *Operator;
if (!Op->Asl.Node)
{
return (AE_OK);
}
XrefInfo->TotalObjects++;
/* Ignore Op that actually defined the object */
if (Op == XrefInfo->MethodOp)
{
return (AE_OK);
}
/* Only interested in Ops that reference the target node */
if (Op->Asl.Node != XrefInfo->MethodOp->Asl.Node)
{
return (AE_OK);
}
/* Find parent "open scope" object to get method caller namepath */
CallerOp = Op->Asl.Parent;
while (CallerOp &&
(CallerOp->Asl.ParseOpcode != PARSEOP_NAME) &&
(CallerOp->Asl.ParseOpcode != PARSEOP_METHOD) &&
(CallerOp->Asl.ParseOpcode != PARSEOP_DEVICE) &&
(CallerOp->Asl.ParseOpcode != PARSEOP_POWERRESOURCE) &&
(CallerOp->Asl.ParseOpcode != PARSEOP_PROCESSOR) &&
(CallerOp->Asl.ParseOpcode != PARSEOP_THERMALZONE))
{
CallerOp = CallerOp->Asl.Parent;
}
if (CallerOp == XrefInfo->CurrentMethodOp)
{
return (AE_OK);
}
/* Null CallerOp means the caller is at the namespace root */
if (CallerOp)
{
CallerFullPathname = AcpiNsGetNormalizedPathname (
CallerOp->Asl.Node, TRUE);
}
/* There are some special cases for the oddball operators */
if (Op->Asl.ParseOpcode == PARSEOP_SCOPE)
{
Operator = "Scope";
}
else if (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_ALIAS)
{
Operator = "Alias";
}
else if (!CallerOp)
{
Operator = "ModLevel";
}
else
{
Operator = AcpiUtGetTypeName (CallerOp->Asl.Node->Type);
}
FlPrintFile (ASL_FILE_XREF_OUTPUT,
"[%5u] %-40s %-8s via path: %s, Operator: %s\n",
Op->Asl.LogicalLineNumber,
CallerFullPathname ? CallerFullPathname : "<root>",
Operator,
Op->Asl.ExternalName,
Op->Asl.Parent->Asl.ParseOpName);
if (!CallerOp)
{
CallerOp = ACPI_TO_POINTER (0xFFFFFFFF);
}
if (CallerFullPathname)
{
ACPI_FREE (CallerFullPathname);
}
XrefInfo->CurrentMethodOp = CallerOp;
XrefInfo->ThisObjectReferences++;
return (AE_OK);
}

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -345,7 +345,7 @@ DtCompileDataTable (
DtInsertCompilerIds (*FieldList);
Status = DtCompileTable (FieldList, AcpiDmTableInfoHeader,
&Gbl_RootTable, TRUE);
&Gbl_RootTable, TRUE);
if (ACPI_FAILURE (Status))
{
return (Status);
@ -382,7 +382,7 @@ DtCompileDataTable (
Subtable = NULL;
Status = DtCompileTable (FieldList, TableData->TableInfo,
&Subtable, TRUE);
&Subtable, TRUE);
if (ACPI_FAILURE (Status))
{
return (Status);
@ -637,6 +637,57 @@ DtCompileTable (
}
/******************************************************************************
*
* FUNCTION: DtCompileTwoSubtables
*
* PARAMETERS: List - Current field list pointer
* TableInfo1 - Info table 1
* TableInfo1 - Info table 2
*
* RETURN: Status
*
* DESCRIPTION: Compile tables with a header and one or more same subtables.
* Include CPEP, EINJ, ERST, MCFG, MSCT, WDAT
*
*****************************************************************************/
ACPI_STATUS
DtCompileTwoSubtables (
void **List,
ACPI_DMTABLE_INFO *TableInfo1,
ACPI_DMTABLE_INFO *TableInfo2)
{
ACPI_STATUS Status;
DT_SUBTABLE *Subtable;
DT_SUBTABLE *ParentTable;
DT_FIELD **PFieldList = (DT_FIELD **) List;
Status = DtCompileTable (PFieldList, TableInfo1, &Subtable, TRUE);
if (ACPI_FAILURE (Status))
{
return (Status);
}
ParentTable = DtPeekSubtable ();
DtInsertSubtable (ParentTable, Subtable);
while (*PFieldList)
{
Status = DtCompileTable (PFieldList, TableInfo2, &Subtable, FALSE);
if (ACPI_FAILURE (Status))
{
return (Status);
}
DtInsertSubtable (ParentTable, Subtable);
}
return (AE_OK);
}
/******************************************************************************
*
* FUNCTION: DtCompilePadding

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -171,6 +171,12 @@ DtCompileTable (
DT_SUBTABLE **RetSubtable,
BOOLEAN Required);
ACPI_STATUS
DtCompileTwoSubtables (
void **List,
ACPI_DMTABLE_INFO *TableInfo1,
ACPI_DMTABLE_INFO *TableInfo2);
ACPI_STATUS
DtCompilePadding (
UINT32 Length,

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -147,6 +147,7 @@ DtDoOperator (
Gbl_CurrentField, NULL);
return (0);
}
Result = LeftValue / RightValue;
break;
@ -158,6 +159,7 @@ DtDoOperator (
Gbl_CurrentField, NULL);
return (0);
}
Result = LeftValue % RightValue;
break;
@ -417,6 +419,7 @@ DtLookupLabel (
{
return (LabelField);
}
LabelField = LabelField->NextLabel;
}

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -99,6 +99,7 @@ DtCompileOneField (
{
ACPI_STATUS Status;
switch (Type)
{
case DT_FIELD_TYPE_INTEGER:

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -102,7 +102,7 @@ DtDumpSubtableTree (
#define DT_MERGE_LINES 6
#define DT_ESCAPE_SEQUENCE 7
static UINT32 Gbl_NextLineOffset;
static UINT32 Gbl_NextLineOffset;
/******************************************************************************
@ -354,6 +354,7 @@ DtParseLine (
End--;
break;
}
End++;
}
@ -553,7 +554,8 @@ DtGetNextLine (
if (!(Flags & DT_ALLOW_MULTILINE_QUOTES))
{
AcpiOsPrintf ("ERROR at line %u: Unterminated quoted string\n",
AcpiOsPrintf (
"ERROR at line %u: Unterminated quoted string\n",
Gbl_CurrentLineNumber++);
State = DT_NORMAL_TEXT;
}
@ -755,7 +757,8 @@ DtScanFile (
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Line %2.2u/%4.4X - %s",
Gbl_CurrentLineNumber, Offset, Gbl_CurrentLineBuffer));
Status = DtParseLine (Gbl_CurrentLineBuffer, Gbl_CurrentLineNumber, Offset);
Status = DtParseLine (Gbl_CurrentLineBuffer,
Gbl_CurrentLineNumber, Offset);
if (Status == AE_NOT_FOUND)
{
break;
@ -946,6 +949,7 @@ DtDumpFieldList (
DbgPrint (ASL_DEBUG_OUTPUT, "\nField List:\n"
"LineNo ByteOff NameCol Column TableOff "
"Flags %32s : %s\n\n", "Name", "Value");
while (Field)
{
DbgPrint (ASL_DEBUG_OUTPUT,
@ -1092,6 +1096,7 @@ DtWriteFieldToListing (
FlPrintFile (ASL_FILE_LISTING_OUTPUT, "...Additional data, length 0x%X\n",
strlen (Field->Value));
}
FlPrintFile (ASL_FILE_LISTING_OUTPUT, "\n");
/* Dump the hex data that will be output for this field */

View File

@ -6,7 +6,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View File

@ -6,7 +6,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -169,15 +169,15 @@ Expression
/* Default base for a non-prefixed integer is 16 */
| EXPOP_NUMBER { stroul64 (DtParsertext, 16, &$$);}
| EXPOP_NUMBER { AcpiUtStrtoul64 (DtParsertext, 16, ACPI_MAX64_BYTE_WIDTH, &$$);}
/* Standard hex number (0x1234) */
| EXPOP_HEX_NUMBER { stroul64 (DtParsertext, 16, &$$);}
| EXPOP_HEX_NUMBER { AcpiUtStrtoul64 (DtParsertext, 16, ACPI_MAX64_BYTE_WIDTH, &$$);}
/* TBD: Decimal number with prefix (0d1234) - Not supported by stroul64 at this time */
/* TBD: Decimal number with prefix (0d1234) - Not supported by strtoul64 at this time */
| EXPOP_DECIMAL_NUMBER { stroul64 (DtParsertext, 10, &$$);}
| EXPOP_DECIMAL_NUMBER { AcpiUtStrtoul64 (DtParsertext, 10, ACPI_MAX64_BYTE_WIDTH, &$$);}
;
%%

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -56,15 +56,28 @@ static BOOLEAN
AcpiUtIsSpecialTable (
char *Signature);
static ACPI_STATUS
DtCreateOneTemplateFile (
char *Signature,
UINT32 TableCount);
static ACPI_STATUS
DtCreateOneTemplate (
char *Signature,
UINT32 TableCount,
const ACPI_DMTABLE_DATA *TableData);
static ACPI_STATUS
DtCreateAllTemplates (
void);
static int
DtEmitDefinitionBlock (
FILE *File,
char *Filename,
char *Signature,
UINT32 Instance);
/*******************************************************************************
*
@ -101,7 +114,7 @@ AcpiUtIsSpecialTable (
*
* FUNCTION: DtCreateTemplates
*
* PARAMETERS: Signature - ACPI table signature
* PARAMETERS: argv - Standard command line arguments
*
* RETURN: Status
*
@ -111,32 +124,115 @@ AcpiUtIsSpecialTable (
ACPI_STATUS
DtCreateTemplates (
char *Signature)
char **argv)
{
const ACPI_DMTABLE_DATA *TableData;
ACPI_STATUS Status;
char *Signature;
char *End;
unsigned long TableCount;
ACPI_STATUS Status = AE_OK;
AslInitializeGlobals ();
/* Default (no signature) is DSDT */
if (!Signature)
Status = AdInitialize ();
if (ACPI_FAILURE (Status))
{
Signature = "DSDT";
goto GetTemplate;
return (Status);
}
/*
* Special cases for DSDT, ALL, and '*'
*/
/* Default (no signature option) is DSDT */
if (AcpiGbl_Optind < 3)
{
Status = DtCreateOneTemplateFile (ACPI_SIG_DSDT, 0);
goto Exit;
}
AcpiGbl_Optind--;
Signature = argv[AcpiGbl_Optind];
AcpiUtStrupr (Signature);
if (!strcmp (Signature, "ALL") ||
!strcmp (Signature, "*"))
/*
* Multiple SSDT support (-T <ssdt count>)
*/
TableCount = strtoul (Signature, &End, 0);
if (Signature != End)
{
/* The count is used for table ID and method name - max is 254(+1) */
if (TableCount > 254)
{
fprintf (stderr, "%u SSDTs requested, maximum is 254\n",
(unsigned int) TableCount);
Status = AE_LIMIT;
goto Exit;
}
Status = DtCreateOneTemplateFile (ACPI_SIG_DSDT, TableCount);
goto Exit;
}
if (!strcmp (Signature, "ALL"))
{
/* Create all available/known templates */
Status = DtCreateAllTemplates ();
return (Status);
goto Exit;
}
/*
* Normal case: Create template for each signature
*/
while (argv[AcpiGbl_Optind])
{
Signature = argv[AcpiGbl_Optind];
AcpiUtStrupr (Signature);
Status = DtCreateOneTemplateFile (Signature, 0);
if (ACPI_FAILURE (Status))
{
goto Exit;
}
AcpiGbl_Optind++;
}
Exit:
/* Shutdown ACPICA subsystem */
(void) AcpiTerminate ();
CmDeleteCaches ();
return (Status);
}
/*******************************************************************************
*
* FUNCTION: DtCreateOneTemplateFile
*
* PARAMETERS: Signature - ACPI table signature
*
* RETURN: Status
*
* DESCRIPTION: Create one template file of the requested signature.
*
******************************************************************************/
static ACPI_STATUS
DtCreateOneTemplateFile (
char *Signature,
UINT32 TableCount)
{
const ACPI_DMTABLE_DATA *TableData;
ACPI_STATUS Status;
/*
* Validate signature and get the template data:
* 1) Signature must be 4 characters
@ -146,8 +242,8 @@ DtCreateTemplates (
if (strlen (Signature) != ACPI_NAME_SIZE)
{
fprintf (stderr,
"%s: Invalid ACPI table signature (length must be 4 characters)\n",
Signature);
"%s: Invalid ACPI table signature "
"(length must be 4 characters)\n", Signature);
return (AE_ERROR);
}
@ -164,7 +260,8 @@ DtCreateTemplates (
Signature = "FACP";
}
GetTemplate:
/* TableData will point to the template */
TableData = AcpiDmGetTableData (Signature);
if (TableData)
{
@ -181,19 +278,7 @@ DtCreateTemplates (
return (AE_ERROR);
}
Status = AdInitialize ();
if (ACPI_FAILURE (Status))
{
return (Status);
}
Status = DtCreateOneTemplate (Signature, TableData);
/* Shutdown ACPICA subsystem */
(void) AcpiTerminate ();
CmDeleteCaches ();
Status = DtCreateOneTemplate (Signature, TableCount, TableData);
return (Status);
}
@ -218,12 +303,6 @@ DtCreateAllTemplates (
ACPI_STATUS Status;
Status = AdInitialize ();
if (ACPI_FAILURE (Status))
{
return (Status);
}
fprintf (stderr, "Creating all supported Template files\n");
/* Walk entire ACPI table data structure */
@ -235,7 +314,7 @@ DtCreateAllTemplates (
if (TableData->Template)
{
Status = DtCreateOneTemplate (TableData->Signature,
TableData);
0, TableData);
if (ACPI_FAILURE (Status))
{
return (Status);
@ -248,25 +327,31 @@ DtCreateAllTemplates (
* 1) DSDT/SSDT are AML tables, not data tables
* 2) FACS and RSDP have non-standard headers
*/
Status = DtCreateOneTemplate (ACPI_SIG_DSDT, NULL);
Status = DtCreateOneTemplate (ACPI_SIG_DSDT, 0, NULL);
if (ACPI_FAILURE (Status))
{
return (Status);
}
Status = DtCreateOneTemplate (ACPI_SIG_SSDT, NULL);
Status = DtCreateOneTemplate (ACPI_SIG_SSDT, 0, NULL);
if (ACPI_FAILURE (Status))
{
return (Status);
}
Status = DtCreateOneTemplate (ACPI_SIG_FACS, NULL);
Status = DtCreateOneTemplate (ACPI_SIG_OSDT, 0, NULL);
if (ACPI_FAILURE (Status))
{
return (Status);
}
Status = DtCreateOneTemplate (ACPI_RSDP_NAME, NULL);
Status = DtCreateOneTemplate (ACPI_SIG_FACS, 0, NULL);
if (ACPI_FAILURE (Status))
{
return (Status);
}
Status = DtCreateOneTemplate (ACPI_RSDP_NAME, 0, NULL);
if (ACPI_FAILURE (Status))
{
return (Status);
@ -281,6 +366,7 @@ DtCreateAllTemplates (
* FUNCTION: DtCreateOneTemplate
*
* PARAMETERS: Signature - ACPI signature, NULL terminated.
* TableCount - Used for SSDTs in same file as DSDT
* TableData - Entry in ACPI table data structure.
* NULL if a special ACPI table.
*
@ -293,12 +379,14 @@ DtCreateAllTemplates (
static ACPI_STATUS
DtCreateOneTemplate (
char *Signature,
UINT32 TableCount,
const ACPI_DMTABLE_DATA *TableData)
{
char *DisasmFilename;
FILE *File;
ACPI_STATUS Status = AE_OK;
ACPI_SIZE Actual;
int Actual;
UINT32 i;
/* New file will have a .asl suffix */
@ -311,13 +399,17 @@ DtCreateOneTemplate (
return (AE_ERROR);
}
/* Probably should prompt to overwrite the file */
AcpiUtStrlwr (DisasmFilename);
if (!UtQueryForOverwrite (DisasmFilename))
{
return (AE_ERROR);
}
File = fopen (DisasmFilename, "w+");
if (!File)
{
fprintf (stderr, "Could not open output file %s\n", DisasmFilename);
fprintf (stderr, "Could not open output file %s\n",
DisasmFilename);
return (AE_ERROR);
}
@ -328,8 +420,16 @@ DtCreateOneTemplate (
AcpiOsPrintf ("/*\n");
AcpiOsPrintf (ACPI_COMMON_HEADER ("iASL Compiler/Disassembler", " * "));
AcpiOsPrintf (" * Template for [%4.4s] ACPI Table",
Signature);
if (TableCount == 0)
{
AcpiOsPrintf (" * Template for [%4.4s] ACPI Table",
Signature);
}
else
{
AcpiOsPrintf (" * Template for [%4.4s] and %u [SSDT] ACPI Tables",
Signature, TableCount);
}
/* Dump the actual ACPI table */
@ -355,45 +455,55 @@ DtCreateOneTemplate (
}
else
{
/* Special ACPI tables - DSDT, SSDT, OSDT, FADT, RSDP */
/* Special ACPI tables - DSDT, SSDT, OSDT, FACS, RSDP */
AcpiOsPrintf (" (AML byte code table)\n");
AcpiOsPrintf (" */\n");
if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_DSDT))
{
Actual = fwrite (TemplateDsdt, 1, sizeof (TemplateDsdt) -1, File);
if (Actual != sizeof (TemplateDsdt) -1)
Actual = DtEmitDefinitionBlock (
File, DisasmFilename, ACPI_SIG_DSDT, 1);
if (Actual < 0)
{
fprintf (stderr,
"Could not write to output file %s\n", DisasmFilename);
Status = AE_ERROR;
goto Cleanup;
}
/* Emit any requested SSDTs into the same file */
for (i = 1; i <= TableCount; i++)
{
Actual = DtEmitDefinitionBlock (
File, DisasmFilename, ACPI_SIG_SSDT, i + 1);
if (Actual < 0)
{
Status = AE_ERROR;
goto Cleanup;
}
}
}
else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_SSDT))
{
Actual = fwrite (TemplateSsdt, 1, sizeof (TemplateSsdt) -1, File);
if (Actual != sizeof (TemplateSsdt) -1)
Actual = DtEmitDefinitionBlock (
File, DisasmFilename, ACPI_SIG_SSDT, 1);
if (Actual < 0)
{
fprintf (stderr,
"Could not write to output file %s\n", DisasmFilename);
Status = AE_ERROR;
goto Cleanup;
}
}
else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_OSDT))
{
Actual = fwrite (TemplateOsdt, 1, sizeof (TemplateOsdt) -1, File);
if (Actual != sizeof (TemplateOsdt) -1)
Actual = DtEmitDefinitionBlock (
File, DisasmFilename, ACPI_SIG_OSDT, 1);
if (Actual < 0)
{
fprintf (stderr,
"Could not write to output file %s\n", DisasmFilename);
Status = AE_ERROR;
goto Cleanup;
}
}
else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_FACS)) /* FADT */
else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_FACS))
{
AcpiDmDumpDataTable (ACPI_CAST_PTR (ACPI_TABLE_HEADER,
TemplateFacs));
@ -412,12 +522,72 @@ DtCreateOneTemplate (
}
}
fprintf (stderr,
"Created ACPI table template for [%4.4s], written to \"%s\"\n",
Signature, DisasmFilename);
if (TableCount == 0)
{
fprintf (stderr,
"Created ACPI table template for [%4.4s], "
"written to \"%s\"\n",
Signature, DisasmFilename);
}
else
{
fprintf (stderr,
"Created ACPI table templates for [%4.4s] "
"and %u [SSDT], written to \"%s\"\n",
Signature, TableCount, DisasmFilename);
}
Cleanup:
fclose (File);
AcpiOsRedirectOutput (stdout);
return (Status);
}
/*******************************************************************************
*
* FUNCTION: DtEmitDefinitionBlock
*
* PARAMETERS: File - An open file for the block
* Filename - Filename for same, for error msg(s)
* Signature - ACPI signature for the block
* Instance - Used for multiple SSDTs in the same file
*
* RETURN: Status from fprintf
*
* DESCRIPTION: Emit the raw ASL for a complete Definition Block (DSDT or SSDT)
*
* Note: The AMLFileName parameter for DefinitionBlock is left as a NULL
* string. This allows the compiler to create the output AML filename from
* the input filename.
*
******************************************************************************/
static int
DtEmitDefinitionBlock (
FILE *File,
char *Filename,
char *Signature,
UINT32 Instance)
{
int Status;
Status = fprintf (File,
"DefinitionBlock (\"\", \"%4.4s\", 2, \"Intel\", \"_%4.4s_%.2X\", 0x00000001)\n"
"{\n"
" Method (%2.2s%.2X)\n"
" {\n"
" }\n"
"}\n\n",
Signature, Signature, Instance, Signature, Instance);
if (Status < 0)
{
fprintf (stderr,
"Could not write %4.4s to output file %s\n",
Signature, Filename);
}
return (Status);
}

View File

@ -5,7 +5,7 @@
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -45,36 +45,6 @@
#define __DTTEMPLATE_H
/* Special templates for the ASL/AML tables: DSDT, SSDT, and OSDT */
const char TemplateDsdt[] =
"DefinitionBlock (\"dsdt.aml\", \"DSDT\", 2, \"Intel\", \"Template\", 0x00000001)\n"
"{\n"
" Method (MAIN, 0, NotSerialized)\n"
" {\n"
" Return (Zero)\n"
" }\n"
"}\n\n";
const char TemplateSsdt[] =
"DefinitionBlock (\"ssdt.aml\", \"SSDT\", 2, \"Intel\", \"Template\", 0x00000001)\n"
"{\n"
" Method (MAIN, 0, NotSerialized)\n"
" {\n"
" Return (Zero)\n"
" }\n"
"}\n\n";
const char TemplateOsdt[] =
"DefinitionBlock (\"osdt.aml\", \"OSDT\", 2, \"Intel\", \"Template\", 0x00000001)\n"
"{\n"
" Method (MAIN, 0, NotSerialized)\n"
" {\n"
" Return (Zero)\n"
" }\n"
"}\n\n";
/* Templates for ACPI data tables */
const unsigned char TemplateAsf[] =
@ -573,11 +543,11 @@ const unsigned char TemplateHpet[] =
const unsigned char TemplateIort[] =
{
0x49,0x4F,0x52,0x54,0x0C,0x01,0x00,0x00, /* 00000000 "IORT...." */
0x00,0xBC,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
0x49,0x4F,0x52,0x54,0x48,0x01,0x00,0x00, /* 00000000 "IORTH..." */
0x00,0x02,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
0x00,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
0x10,0x04,0x15,0x20,0x04,0x00,0x00,0x00, /* 00000020 "... ...." */
0x12,0x02,0x16,0x20,0x05,0x00,0x00,0x00, /* 00000020 "... ...." */
0x34,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "4......." */
0x00,0x00,0x00,0x00,0x00,0x2C,0x00,0x00, /* 00000030 ".....,.." */
0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000038 "........" */
@ -606,7 +576,14 @@ const unsigned char TemplateIort[] =
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000F0 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000F8 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000100 "........" */
0x00,0x00,0x00,0x00 /* 00000108 "...." */
0x00,0x00,0x00,0x00,0x04,0x3C,0x00,0x00, /* 00000108 ".....<.." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000110 "........" */
0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000118 "<......." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000120 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000128 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000130 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000138 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 /* 00000140 "........" */
};
const unsigned char TemplateIvrs[] =
@ -867,28 +844,39 @@ const unsigned char TemplateMtmr[] =
const unsigned char TemplatePcct[] =
{
0x50,0x43,0x43,0x54,0xAC,0x00,0x00,0x00, /* 00000000 "PCCT...." */
0x01,0xCF,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
0x54,0x65,0x6D,0x70,0x6C,0x61,0x74,0x65, /* 00000010 "Template" */
0x50,0x43,0x43,0x54,0x06,0x01,0x00,0x00, /* 00000000 "PCCT...." */
0x01,0xE3,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
0x27,0x06,0x14,0x20,0x01,0x00,0x00,0x00, /* 00000020 "'.. ...." */
0x18,0x03,0x16,0x20,0x01,0x00,0x00,0x00, /* 00000020 "... ...." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */
0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000030 ".>......" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */
0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000040 "........" */
0x01,0x32,0x00,0x03,0x00,0x00,0x00,0x00, /* 00000048 ".2......" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000050 "........" */
0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF, /* 00000058 "........" */
0xFF,0xFF,0xFF,0xFF,0x01,0x00,0x00,0x00, /* 00000060 "........" */
0x01,0x00,0x00,0x00,0x01,0x00,0x01,0x3E, /* 00000068 ".......>" */
0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000070 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00, /* 00000078 "........" */
0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, /* 00000038 "........" */
0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22, /* 00000040 """""""""" */
0x01,0x32,0x00,0x03,0x33,0x33,0x33,0x33, /* 00000048 ".2..3333" */
0x33,0x33,0x33,0x33,0x44,0x44,0x44,0x44, /* 00000050 "3333DDDD" */
0x44,0x44,0x44,0x44,0x55,0x55,0x55,0x55, /* 00000058 "DDDDUUUU" */
0x55,0x55,0x55,0x55,0x66,0x66,0x66,0x66, /* 00000060 "UUUUffff" */
0x77,0x77,0x77,0x77,0x88,0x88,0x01,0x3E, /* 00000068 "wwww...>" */
0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000070 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000078 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x32, /* 00000080 ".......2" */
0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000088 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000090 "........" */
0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* 00000098 "........" */
0xFF,0xFF,0x01,0x00,0x00,0x00,0x01,0x00, /* 000000A0 "........" */
0x00,0x00,0x01,0x00 /* 000000A8 "...." */
0x00,0x03,0x44,0x44,0x44,0x44,0x44,0x44, /* 00000088 "..DDDDDD" */
0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44, /* 00000090 "DDDDDDDD" */
0x44,0x44,0x55,0x55,0x55,0x55,0x55,0x55, /* 00000098 "DDUUUUUU" */
0x55,0x55,0x66,0x66,0x66,0x66,0x77,0x77, /* 000000A0 "UUffffww" */
0x77,0x77,0x88,0x88,0x02,0x5A,0x01,0x00, /* 000000A8 "ww...Z.." */
0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00, /* 000000B0 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000B8 "........" */
0x00,0x00,0x00,0x00,0x01,0x32,0x00,0x03, /* 000000C0 ".....2.." */
0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44, /* 000000C8 "DDDDDDDD" */
0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44, /* 000000D0 "DDDDDDDD" */
0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55, /* 000000D8 "UUUUUUUU" */
0x66,0x66,0x66,0x66,0x77,0x77,0x77,0x77, /* 000000E0 "ffffwwww" */
0x88,0x88,0x01,0x32,0x00,0x03,0x33,0x33, /* 000000E8 "...2..33" */
0x33,0x33,0x33,0x33,0x33,0x33,0x44,0x44, /* 000000F0 "333333DD" */
0x44,0x44,0x44,0x44,0x44,0x44,0x55,0x55, /* 000000F8 "DDDDDDUU" */
0x55,0x55,0x55,0x55,0x55,0x55 /* 00000100 "UUUUUU" */
};
const unsigned char TemplatePmtt[] =

Some files were not shown because too many files have changed in this diff Show More