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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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.
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.
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.
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>
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+.
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.
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>
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>