13397 Commits

Author SHA1 Message Date
Lv Zheng
fa0680030a MSVC: Fix MSVC6 build issues
Build environment has changed because of new improvements:
1. New files are split
2. New inclusion order
This patch updates MSVC project files accordingly.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2016-12-05 16:24:03 +08:00
Robert Moore
bee9af547c Merge branch 'master' of ssh://ssh.github.com/acpica/acpica 2016-12-02 12:54:50 -08:00
Robert Moore
aa72e7745f Fix a couple of debug output statements
Remove extraneous quotes around function names.
2016-12-02 12:53:57 -08:00
Robert Moore
e033071cf5 Merge pull request #190 from zetalog/acpica-sleep
Acpica sleep
2016-12-02 08:14:56 -08:00
Robert Moore
47614972f7 Merge pull request #161 from zetalog/acpica-gas
Acpica gas
2016-12-02 08:14:38 -08:00
Robert Moore
2f4aaeb703 Merge pull request #148 from zetalog/acpica-debugger
Acpica debugger
2016-12-02 08:14:06 -08:00
Robert Moore
df3db6f49b Merge pull request #192 from ColinIanKing/master
Linux-specific header: Add support for s390x compilation.
2016-11-30 08:19:05 -08:00
Colin Ian King
ecac9504e3 Linux-specific header: Add support for s390x compilation.
Adds s390x as a 64-bit architecture.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
2016-11-30 13:09:33 +00:00
Robert Moore
d1b8a8751d Grammar test: Deploy __LINE__ macro to simplify debugging
ERR_ method now accepts __LINE__ from caller
2016-11-18 08:57:40 -08:00
Robert Moore
0d5a056877 Update version to 20161117
Version 20161117.
R11_17_16
2016-11-17 09:17:14 -08:00
Robert Moore
092d442e7a Logfile: Changes for version 20161117
Version 20161117.
2016-11-17 09:16:40 -08:00
Robert Moore
35ce65feeb Table Manager: Fix error path memory leak while getting table(s) from file
Possible leak after allocation of table descriptor.
2016-11-17 08:34:17 -08:00
Robert Moore
040740976d Revert "FADT support cleanup"
This reverts commit 34ccd43af3fd1870fddfac0617dd0ba706963558.

This is an attempt to remove all references in the source to the
FADT version 2, which never was a legal version number. It was
skipped because it was an early version of 64-bit support that
was eventually abandoned for the current 64-bit support.

Appears to have caused problems on some machines. Another attempt
at this will be made later.
2016-11-17 08:03:51 -08:00
Robert Moore
fd0b3e1b86 Merge pull request #180 from coypoop/master
avoid resource leak, check for alloc failure
2016-11-16 10:40:00 -08:00
Robert Moore
a670da6d3d Merge pull request #186 from Lekensteyn/acpixtract-crlf
acpixtract: support CRLF in input files
2016-11-16 10:14:34 -08:00
Peter Wu
86167914ea acpixtract: change fopen mode from "rt" to "r"
fopen mode "t" is non-standard and specific to Windows. Since the
default mode is already text ("b" is needed for binary mode), just
remove it. (This matches all other fopen callers in ACPICA that open a
text file). There is no functional change.

Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2016-11-16 18:59:14 +01:00
Peter Wu
03de67d713 acpixtract: support CRLF in input files
Currently acpixtract expects that acpidump lines are terminated by LF.
This is not always true, for example when taking the acpidump output
from Windows or from pastebin websites (HTML forms always convert input
to CRLF per HTML5 specification). On such files with CRLFs, acpixtract
would output only the first table from the file.

That happens because `\r\n` is not considered an empty line. Then
AxListTables would continue trying to read a whole header (`\r\nSSDT @
0x...`) and discover that `\r\nSS` is not a valid signature and skip to
the next line. At that point however, the file pointer has advanced and
no new header can be matched anymore.

Affected functions are AxCountTableInstances, AxIsDataBlockHeader,
AxProcessOneTextLine (from axutils.c) and AxListTables (from
acpixtract.c). All of these functions skip the input line if it is
determined to be an empty line (ends with LF). To handle the above
situation, consider a CR (part of CRLF) also as newline.

There is no need to replace the CRLF by LF for normal use:

 - AxListTables first reads a line (presumably `SSDT @ 0x...`), then
   reads the actual data lines via AxGetTableHeader. That uses
   AxConvertLine which uses `sscanf(InputLine, "... %x")` and needs no
   further changes.
 - AxExtractTables and AxExtractToMultiAmlFile uses
   (1) AxIsDataBlockHeader to find the first line (`SSDT @ ...`) but
   only looks at the first four characters for the signature.
   (2) AxProcessOneTextLine for data lines which uses AxConvertLine
   which was already shown to be safe.
 - AxListTables may also check whether a table needs a number suffix and
   call AxGetNextInstance which calls AxCountTableInstances. That
   function is similar to AxIsDataBlockHeader, but additionally counts
   the number of occurrences. This is also safe.

Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2016-11-16 18:59:01 +01:00
Robert Moore
980243e222 Merge pull request #188 from Lekensteyn/spelling-fixes
Spelling fixes
2016-11-15 14:51:59 -08:00
Peter Wu
4f4e12b8ee ASLTS: fix acpiexec command example
The -e option was changed in commit d90488f43579 ("acpiexec: add option
to disable memory tracking mechanism."), released as version 20100528.

Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2016-11-15 15:31:04 +01:00
Peter Wu
6729c3d308 ASLTS: cntl: fix spelling errors
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2016-11-12 12:18:45 +01:00
Lv Zheng
ba665dc8e2 Hardware: Add sleep register hooks
In Linux, para-virtualization implmentation hooks critical register writes
to prevent real hardware operations. This increases divergences when the
sleep registers are cracked in Linux resident ACPICA. This patch tries to
introduce a single OSL to reduce the divergences. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2016-11-11 01:14:39 +08:00
Lv Zheng
365b321a31 Hardware: Sort access bit width algorithm
GAS can be in register or register region format, so we need to improve our
"register" format detection code in order not to regress.

Such detection may be still experimental, and is generated according to the
current known facts. Lv Zheng.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=151501
Reported-and-tested-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2016-11-09 04:05:05 +08:00
Lv Zheng
cbb0294649 Utilities: Add power of two rounding support
This patch adds power of two rounding support up to 32 bits.

The result of the shift operations rearching to the boundary of the cpu
word is unpredicatable, so 64-bit roundings are not supported in order to
make sure no rounded shift-overs.
This support may not be performance friendly, so the APIs might be
overridden by the hosts implementations with ACPI_USE_NATIVE_BIT_FINDER
defined. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2016-11-09 04:05:05 +08:00
Lv Zheng
1ecab20bbe Hardware: Add AccessWidth/BitOffset support in AcpiHwWrite()
This patch adds AccessWidth/BitOffset support in AcpiHwWrite().
Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2016-11-09 04:05:05 +08:00
Lv Zheng
bc7c529186 Hardware: Add AccessWidth/BitOffset support in AcpiHwRead()
This patch adds AccessWidth/BitOffset support in AcpiHwRead().
This also enables GAS definition where BitWidth is not a power of
two. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2016-11-09 04:05:05 +08:00
Lv Zheng
1869476aed Hardware: Add optimized access bit width support
For Access Size = 0, it actually can use user expected access bit width.
This patch implements this. Lv Zheng.

The old register descriptors are translated in AcpiTbInitGenericAddress()
with AccessWidth being filled with 0. This breaks code in
AcpiHwGetAccessBitWidth() when the registers are 16-bit IO ports and their
BitWidth fields are filled with 16. The rapid fix is meant to make code
written for AcpiHwGetAccessBitWidth() regression safer before the issue is
correctly fixed from AcpiTbInitGenericAddress().
Reported by John Baldwin <jhb@freebsd.org>,
            Jung-uk Kim <jkim@freebsd.org>,
            Boris Ostrovsky <boris.ostrovsky@oracle.com>,
            Mike Marshall <hubcap@omnibond.com>,
Fixed by Lv Zheng <lv.zheng@intel.com>.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2016-11-09 04:05:05 +08:00
Lv Zheng
f7e7a20852 Hardware: Enhance AcpiHwValidateRegister() with AccessWidth/BitOffset awareness
This patch enhances AcpiHwValidateRegister() to sanitize register
accesses with awareness of AccessWidth and BitOffset. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2016-11-09 04:05:05 +08:00
Lv Zheng
cfca5fb4c9 Hardware: Introduce a set of macros to handle bit width mask generation
This patch adds a set of macros to generate masks from bit width values.
This patch also cleans up an existing line using the new macros. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2016-11-09 04:05:05 +08:00
Lv Zheng
adaead47de Utilities: Add ACPI_IS_POWER_OF_TWO()
This patch adds a macro ACPI_IS_POWER_OF_TWO, which can be used to
detect if a number is a power of two. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2016-11-09 04:05:05 +08:00
Robert Moore
b138a24ae1 iASL: Grammar change updates
1) Make parentheses the highest precedence operators. This affects
definition of most grammar elements to reflect tokenization of
parens.

2) Grammar changes for ObjectType, RefOf, CondRefOf, DerefOf --
mostly to disallow method invocations.
2016-11-04 08:52:10 -07:00
Robert Moore
503e47826a iASL: Update for handling of External() statements/opcodes
Additional support for names and pathnames, to simplify
generation of External opcode(s).
2016-11-04 08:50:06 -07:00
Robert Moore
a0bc123e80 iASL: Remove error for method invocation as a target
Technically legal to invoke a method as a target operand.
Fixed in the interpreter, make it legal in the compiler.
2016-11-04 08:46:52 -07:00
Robert Moore
1c83d1876b Disassembler: Add support to disable ASL+ optimizations for some ops
Optionally retain legacy ASL code rather than optimizing and
folding into ASL+ code. Used for internal ASL test suite only,
in order to allow for binary compatibility for legacy ASL and
ASL+ compilations.
2016-11-04 08:40:52 -07:00
Robert Moore
198fde8a06 Utilities: Add new decode function for parser values
Implements a decode function for the ARGP_* parser info values
for all AML opcodes.
2016-11-04 08:05:38 -07:00
Robert Moore
b90e399489 Parser: Update parse info table for some operators
Operand for DerefOf should not have been a TermArg, should be SuperName.
Rename NAME_OR_REF to SIMPLENAME.
2016-11-04 08:01:23 -07:00
Robert Moore
a6cca7a478 Parser: Allow method invocations as target operands
Method invocations as target operands are allowed as target
operands in the ASL grammar. This change implements support
for this. Method must return a reference for this to work
properly at runtime, however.
2016-11-04 07:59:05 -07:00
Robert Moore
072069bfa5 acpibin: Add two new command line options for comparing files
-a: compare and display ALL mismatches
-o: start compare at this offset into the second file
2016-11-04 07:41:41 -07:00
Robert Moore
7ea2a52bd2 Test suite: Update for ASL grammar changes:
Tests related to these grammar changes have been removed/commented-out:

RefOf, DerefOf, ObjectType: Control method invocation as an operand is
no longer supported by the ASL grammar.
2016-11-04 07:25:24 -07:00
Robert Moore
3ba8145958 Merge pull request #178 from zetalog/acpica-name
Acpica name
2016-11-03 13:36:12 -07:00
Robert Moore
04c3745d43 Merge pull request #182 from zetalog/acpica-diverg-table
Acpica diverg table
2016-11-03 13:33:05 -07:00
Robert Moore
9316ad9b20 Merge pull request #177 from zetalog/aslts-table
Aslts table
2016-11-03 13:30:18 -07:00
Lv Zheng
d98de9ca14 Tables: Allow FADT to be customized with virtual address
FADT parsing code requires FADT to be installed as
ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL, using new
AcpiTbGetTable()/AcpiTbPutTable(), other address types can also be allowed,
thus facilitates FADT customization with virtual address. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2016-11-04 04:09:15 +08:00
Lv Zheng
cac6790954 Tables: Back port acpi_get_table_with_size() and early_acpi_os_unmap_memory() from Linux kernel
This patch back ports Linux acpi_get_table_with_size() and
early_acpi_os_unmap_memory() into ACPICA upstream to reduce divergences.

The 2 APIs are used by Linux as table management APIs for long time, it
contains a hidden logic that during the early stage, the mapped tables
should be unmapped before the early stage ends.

During the early stage, tables are handled by the following sequence:
 acpi_get_table_with_size();
 parse the table
 early_acpi_os_unmap_memory();
During the late stage, tables are handled by the following sequence:
 acpi_get_table();
 parse the table
Linux uses acpi_gbl_permanent_mmap to distinguish the early stage and the
late stage.

The reasoning of introducing acpi_get_table_with_size() is: ACPICA will
remember the early mapped pointer in AcpiGetTable() and Linux isn't able to
prevent ACPICA from using the wrong early mapped pointer during the late
stage as there is no API provided from ACPICA to be an inverse of
AcpiGetTable() to forget the early mapped pointer.

But how ACPICA can work with the early/late stage requirement? Inside of
ACPICA, tables are ensured to be remained in "INSTALLED" state during the
early stage, and they are carefully not transitioned to "VALIDATED" state
until the late stage. So the same logic is in fact implemented inside of
ACPICA in a different way. The gap is only that the feature is not provided
to the OSPMs in an accessible external API style.

It then is possible to fix the gap by providing an inverse of
AcpiGetTable() from ACPICA, so that the two Linux sequences can be
combined:
 AcpiGetTable();
 parse the table
 AcpiPutTable();
In order to work easier with the current Linux code, AcpiGetTable() and
AcpiPutTable() is implemented in a usage counting based style:
 1. When the usage count of the table is increased from 0 to 1, table is
    mapped and .Pointer is set with the mapping address (VALIDATED);
 2. When the usage count of the table is decreased from 1 to 0, .Pointer
    is unset and the mapping address is unmapped (INVALIDATED).
So that we can deploy the new APIs to Linux with minimal effort by just
invoking AcpiGetTable() in acpi_get_table_with_size() and invoking
AcpiPutTable() in early_acpi_os_unmap_memory(). Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2016-11-04 04:09:15 +08:00
Lv Zheng
68af3c3aa2 Tables: Add an error message complaining driver bugs
During early OS boot stage, drivers that have mapped system memory should
unmap it during the same stage. Linux kernel has an error message
indicating the unbalanced early memory mappings.

This patch back ports such error message into ACPICA for the early table
mappings, so that ACPICA development environment is also aware of this OS
specific requirement and thus is able to ensure the consistent quality
locally. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2016-11-04 04:09:15 +08:00
Lv Zheng
80e24663b2 Tables: Add AcpiTbUnloadTable()
This patch introduces AcpiTbUnloadTable() to eliminate redundant code from
AcpiExUnloadTable() and AcpiUnloadParentTable().

No functional change. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2016-11-04 04:09:15 +08:00
Lv Zheng
7fdac0289f Tables: Cleanup AcpiTbInstallAndLoadTable()
AcpiTbInstallAndLoadTable() can invoke AcpiTbLoadTable() to eliminate
redundant code.

No functional change. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2016-11-04 04:09:15 +08:00
Lv Zheng
543342ab7a Events: Fix AcpiEvInitializeRegion() return value
This patch changes AcpiEvInitializeRegion(), stop returning AE_NOT_EXIST
from it so that, not only in AcpiDsLoad2EndOp(), but all places invoking
this function won't emit exceptions. The exception can be seen in
AcpiDsInitializeObjects() when certain table loading mode is chosen.

This patch also removes useless AcpiNsLocked from AcpiEvInitializeRegion()
as this function will always be invoked with interpreter lock held now, and
the lock granularity has been tuned to lock around _REG execution, thus it
is now handled by AcpiExExitInterpreter(). Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2016-11-04 04:06:15 +08:00
Lv Zheng
bc481e758e Dispatcher: Tune interpreter lock around AcpiEvInitializeRegion()
In code path of AcpiEvInitializeRegion(), there are namespace modification
code unlocked. This patch tunes the code to make sure such modifications
are locked. Lv Zheng.

Tested-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2016-11-04 04:06:15 +08:00
Lv Zheng
54d340b727 Dispatcher: Fix an unbalanced lock exit path in AcpiDsAutoSerializeMethod()
There is a lock unbalanced exit path in AcpiDsInitializeMethod(),
this patch corrects it. Lv Zheng.

Tested-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2016-11-04 04:06:15 +08:00
Lv Zheng
7f2a587a74 Dispatcher: Fix order issue of method termination
The last step of the method termination should be the end of the method
serialization. Otherwise, the steps happening after it will face the race
issues that cannot be protected by the method serialization mechanism.

This patch fixes this issue by moving the per-method-object deletion code
prior than the end of the method serialization. Otherwise, the possible
race issues may result in AE_ALREADY_EXISTS error in a parallel
environment. Reported by Imre Deak. Fixed by Lv Zheng.

Reported-and-tested-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2016-11-04 04:06:15 +08:00