13052 Commits

Author SHA1 Message Date
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
Robert Moore
f0071e7169 iASL: optimization improvement for 32-bit tables
For 32-bit case only, compute the optimum integer opcode
after 64-to-32 bit truncation. Warning message is still
emitted, however.
2016-10-31 12:43:36 -07:00
Lv Zheng
e24b6af0f8 ASLTS: table: Add TLD0.tstk test
Add a test to see if a recursive "Load" - loading table2 via MLC during
table1 loading - can be performed. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2016-10-26 14:48:17 +08:00
Lv Zheng
2272cc45f5 ASLTS: cntl: Cleanup y260 checks
The y260 bug excluded code now works. We are using y260 to exclude an
implicit target operand conversion bug. So this patch corrects the y260
code.
Note that there is no bug demo code related to this bug, so we can simply
remove old exclusions for y260 as it is useless to keep such kind of
simple exclusions.

Link: https://bugs.acpica.org/show_bug.cgi?id=1327
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2016-10-26 14:48:17 +08:00
Lv Zheng
4af71b11e6 ASLTS: table: Fix TLD0.tstg test
This patch cleans up TLD0.tstg, keeping it working for catching
'Load/Unload' regressions.

This patch fixes TLD0.tstg around the old forward referencing approaches
as the TermList parsing support has changed the old behavior:
1. OPR0 couldn't be referenced at the position created after FLU0.
2. FieldUnit/BufferField have already been initialized during the table
   loading (can be validated via changing arg2 into a named object).
Such forward referencing test shouldn't be maintained by the 'table' case.

Another issue is:
If ArgX is a RefOf(OldObj), writing NewObj to ArgX should result in
RefOf(NewObj). This is not working for object types other than Integer,
String, Buffer, so this patch disables such tests with y260.

Link: https://bugs.acpica.org/show_bug.cgi?id=1327
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2016-10-26 14:48:17 +08:00
Lv Zheng
2a0907db7a ASLTS: table: Fix TLT0.tst1 test
This patch cleans up TLT0.tst1, keeping it working for catching
'LoadTable/Unload' regressions.

The wrong signature of LoadTable opcode now results in AE_BAD_SIGNATURE
exception rather than siliently returning zero.

This patch also re-sorts error indexes in TLT0.tst1.

Link: https://bugs.acpica.org/show_bug.cgi?id=1327
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2016-10-26 14:48:17 +08:00
Lv Zheng
fe71d3deca ASLTS: table: Fix TLT0.tste test
This patch cleans up TLT0.tste, keeping it working for catching
'LoadTable/Unload' regressions.

The wrong signature of LoadTable opcode now results in AE_BAD_SIGNATURE.

Link: https://bugs.acpica.org/show_bug.cgi?id=1327
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2016-10-26 14:48:17 +08:00
Lv Zheng
cc8a4f3943 ASLTS: table: Fix TLT0.tst4 test
This patch cleans up TLT0.tst4, keeping it working for catching
'LoadTable/Unload' regressions.

In order to install OEM1 objects to "\DTM2", RootPathString should be 5
bytes rather than 1 bytes.

Link: https://bugs.acpica.org/show_bug.cgi?id=1327
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2016-10-26 14:48:17 +08:00
Robert Moore
8ad249078f Merge branch 'master' of ssh://ssh.github.com/acpica/acpica 2016-10-25 14:14:48 -07:00
Robert Moore
b2e89d72ef Disassembler: fix regression for ResourceTemplates
detection and proper disassembly of resource templates was broken.
2016-10-25 14:12:45 -07:00
Robert Moore
d2be037cdc Merge pull request #181 from zetalog/acpica-script
Acpica script
2016-10-14 21:32:06 -07:00
Lv Zheng
e97f20f3d6 Fix ACPICA release issues for recent distros
Several issues were found in recent cygwin/ubuntu distros:

1. Newer git implements "-c" with different meaning, removes it;
2. "tempfile" is mostly debian specific command, replaces it with
   "mktemp -u", the latter is more portable.

Singed-off-by: Lv Zheng <lv.zheng@intel.com>
2016-10-14 22:09:39 +08:00
Hoan Tran
c991d08535 avoid iasl return Access Size error with PCC register when
its value is over 4.

Signed-off-by: Hoan Tran <hotran@apm.com>
2016-10-11 09:21:31 -07:00
Robert Moore
a68b02b47f Test suite: Some small changes for new test generation method
minor changes to allow for disassembly/recompile.
2016-10-06 13:33:16 -07:00
Robert Moore
ec434a8549 Revert "ToHexString: Add "0x" prefix to the converted string"
This reverts commit f9efaa885dc3fbdd73307e3748c096ec0849f7a5.

Collides with hex buffer code.
2016-10-05 13:00:51 -07:00
Robert Moore
9f76de2d24 Resources: Not a valid resource if buffer length too long
The declared buffer length must be the same as the length of the
byte initializer list, otherwise not a valid resource descriptor.
2016-10-04 14:35:07 -07:00
Robert Moore
a002071b5a Disassembler: Improve detection of Resource Descriptors in Buffers
Cannot be a resource descriptor if the declared buffer length is
not the same as the length of the buffer initializer list. For
a resource descriptor, both values will always be equal.
2016-10-04 14:17:42 -07:00
Robert Moore
0cc9d5be1c Disassembler: Improve Unicode and String detection for Buffers
1) Only detect unicode if all buffer characters are printable ASCII.
Prevents some false positives.

2) Do not detect a string for buffers that contain 0x79, 0x00
because this is a resource descriptor EndTag, and will cause
a false postive for a string.
2016-10-04 14:11:37 -07:00
Robert Moore
60225ffb77 Test suite: Delete extraneous text file
Delete an extraneous test output file.
2016-10-03 10:08:18 -07:00
Robert Moore
f9efaa885d ToHexString: Add "0x" prefix to the converted string
This is more to the spirit of the ACPI spec, even though it
is not explicitly stated what a "hexadecimal string" is.
However, a hex string is defined in ToInteger to be prefixed
with 0x. Other ACPI implementation already add the 0x, so
this also fixes a compatibility issue.
2016-10-03 10:02:04 -07:00
Robert Moore
e1342c9f2d Fix for implicit result conversion for the ToXXXX functions
Implicit result conversion was incorrectly disabled for the
following functions:
FromBCD
ToBCD
ToDecimalString
ToHexString
ToInteger
ToBuffer
2016-10-03 08:43:01 -07:00
Robert Moore
cb8dfc8157 Update version to 20160930
Version 20160930.
R09_30_16
2016-09-30 09:41:27 -07:00
Robert Moore
73cbaa3fb2 Logfile: Changes for version 20160930
Version 20160930.
2016-09-30 09:40:42 -07:00
Robert Moore
eb8b219420 Move AcpiGbl_MaxLoopIterations to the public globals file
Moved to acpixf.h with the rest of the configuration globals.
2016-09-30 07:15:09 -07:00
Robert Moore
5c5bf49f68 Merge pull request #179 from zetalog/acpica-macosx
Acpica MacOSX
2016-09-30 07:13:59 -07:00
Lv Zheng
de5b9c0ef1 MacOSX: Fix anonymous semaphore implementation
Using of temporal file name functions can easily result in bus errors on
MacOSX. This patch implements anonymous semaphore using an automatic
increasing number. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2016-09-30 11:04:49 +08:00
Robert Moore
483b0adb71 acpibin: exit with non-zero status on miscompare
For the compare option, return -1 if any bytes miscompare.
2016-09-29 14:10:05 -07:00
Robert Moore
4b36740865 Disassembler: Fix for Divide() support, new support for test suite
Fixes a problem with complex expressions where an illegal mix
of legacy ASL and ASL+ could be emitted.

Adds new support for ASLTS that disables some disassembler
optimizations could be changed during a conversion to ASL+.
These expressions are now emitted in legacy ASL instead
of ASL+.
2016-09-29 14:04:23 -07:00
Robert Moore
14b4464b8b Test suites, ASLTS: Update for ASL+; Resources, Store
Update for latest resource descriptor macro names
Update for various Store(operator, operand tests) for ASL+
2016-09-28 10:25:46 -07:00
Robert Moore
9f83b34cb1 Increase loop limit for AE_AML_INFINITE_LOOP exception
increase loop limit to accomodate faster processors. From 64k loops max
to 1 million.
2016-09-27 14:19:46 -07:00
Robert Moore
be9a1059d4 iASL: Optimization for FieldUnit lists
Ignore a field unit that is both unnamed and has a length of zero.
Previously, two zero bytes were emitted for no good reason.
2016-09-23 13:17:24 -07:00
Robert Moore
72910e63ce Disassembler: Always emit value of the _TRS flag.
Was conditionally emitting the value of the flag, however, the
disassembler should always emit exactly what is in the AML.
2016-09-23 13:15:50 -07:00
Robert Moore
72fd279870 Merge branch 'master' of ssh://ssh.github.com/acpica/acpica 2016-09-23 12:51:24 -07:00
Robert Moore
39ec745ded Disassembler: Fix missing code problem with ElseIf conversion
During conversion of Else...If sequences to ASL ElseIf statements,
blocks of code can become detached from the parse tree and lost.
This change fixes the problem.
2016-09-23 12:45:33 -07:00
Robert Moore
0c16662871 Merge pull request #176 from zetalog/acpica-mac
Acpica mac
2016-09-22 18:25:57 -07:00
Robert Moore
5b72f1c25e Merge pull request #175 from zetalog/acpica-locks
Acpica locks
2016-09-22 18:24:39 -07:00
Lv Zheng
a78506e0ce Parser: Fix a regression in LoadTable support
LoadTable allows an alternative RootPathString than the default "\", while
the new table execution support fails to keep this logic.

This regression can be detected by ASLTS - TLT0.tst4, this patch fixes this
regression.

Linux upstream is not affected by this regression as we haven't enabled the
new table execution support there. BZ 1326, Lv Zheng.

Link: https://bugs.acpica.org/show_bug.cgi?id=1326
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2016-09-23 08:44:12 +08:00
Lv Zheng
39227380f5 Tables: Fix "UNLOAD" code path lock issues
The previous lock fixes didn't cover "Unload" opcode and table unload APIs,
this patch fixes lock issues in the "Unload" code path. BZ 1325, Lv Zheng.

Link: https://bugs.acpica.org/show_bug.cgi?id=1325
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2016-09-23 08:44:11 +08:00
Lv Zheng
55b49920db Tables: Fix a regression in AcpiTbFindTable()
This was just an already fixed issue, and accidently released due to my
local process issues. Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2016-09-23 08:44:11 +08:00
Lv Zheng
1a69fcaa99 ASLTS: Fix script regression of running LoadTable
LoadTable opcodes require acpiexec to build OEM tables in RSDT/XSDT.
However, during the EFI porting, OEM test table loading becomes an optional
behavior for acpiexec.
As ASLTS requires the OEM test tables, disabling this option by default
triggers the regression for ASLTS, causing LoadTable related cases to fail.

This patch fixes this regression by enabling this option for ASLTS.

Link: https://bugs.acpica.org/show_bug.cgi?id=1327
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
2016-09-23 08:44:10 +08:00