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