This error is added because this can lead to unresolved references
during table load and control method execution. This warning helps
the user detect these issues during compilation rather than runtime.
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Some ACPICA userspace tools call AcpiUtSubsystemShutdown() during
cleanup and dereference a null pointer when cleaning up the
namespace.
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Performing parse tree analysis on all definition blocks
simultaneously results in more effective namespace cross-reference.
This enables iASL static analysis to determine unresolved external
declarations and namespace collisions during compilation.
In order to take advantage of this, compile definition blocks
with the following command:
iasl dsdt.asl ssdt1.asl ssdt2.asl ...
*** Changes related to multiple files:
Keep track of all files in a global list that is persistent
throughout compilation of both files. This is done in order to
compile multiple ASL files in the same namespace and parse tree.
This also resulted in moving the file handle assignment for the -vi
option during file initialization rather than commandline processing.
As each definition block is parsed, it is connected as a sibling node
to the previous definiton block.
*** Changes related to iASL error reporting:
Also, more error messages were added by replacing the fprintf to
stderr with AslError. By doing so, an error can be logged properly
and AML output files will be cleaned if there is a compiler error.
Adds the ability to print the correct source line by logging the .src
filename in each error node. This is necessary for errors that point
to an include file.
New iASL error: emitting an error when compiling duplicate files.
Ignore max error count when compiling with -f because
compilation needs to continue.
Fix parser error path to correctly abort compilation rather
than trying to proceed with more compilation.
*** Changes related to codegen behavior:
Seek to the end of the AML output file after codegen in case multiple
definition blocks need to be encoded in the same AML file. This makes
other parts of the codebase a little more convinent since it doesn't
have to seek to the correct place in the AML.
*** Misc changes:
Remove a call to ACPI_FREE. We should never be calling ACPI_FREE in
memory allocated in caches.
Display compilation summaries for multiple input files. Files that
have parser errors are reported as having parser errors. The summary
is based on the global file list.
Encapsulate global variables in global file nodes used for summary
reporting.
Final cleanup functions for iASL has been consolidated to the main()
function for simplicity.
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
This seems to be an old vestige resulting from some sort of
restructuring in iASL. These code snippsets are redundant. In
general, iASL needs to do the following:
1.) open all files before starting compilation or disassembly
2.) limit calling AslDoDisassembly() to only two places: for AML
disassembly and ASL/ASL+ converter
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Commit 18996f2db918 ("ACPICA: Events: Stop unconditionally
clearing ACPI IRQs during suspend/resume") was added to stop clearing
of event status bits unconditionally on suspend and resume paths. This
was done because of an issue
reported (https://bugzilla.kernel.org/show_bug.cgi?id=196249) where
lid status stays closed even on resume (which happens because event
status bits are cleared unconditionally on resume). Though this change
fixed the issue on suspend path, it introduced regressions on several
resume paths.
First regression was reported and fixed on S5 path by the following
change: commit fa85015c0d95 ("ACPICA: Clear status of all events when
entering S5"). Next regression was reported and fixed on all legacy
sleep paths by the commit f317c7dc12b7 ("ACPICA: Clear status of all
events when entering sleep states"). However, regression still exists
on S0ix sleep path since it does not follow the legacy sleep path.
In case of S0ix, events are enabled as part of device suspend path. If
status bits for the events are set when they are enabled, it could
result in premature wake from S0ix. This change ensures that status is
cleared for any event that is being enabled so that any stale events
are cleared out.
Signed-off-by: Furquan Shaikh <furquan@google.com>
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
ASL OperationRegions declare a range of addresses that it uses. In a
perfect world, the range of addresses should be used exclusively by
the AML interpreter. The OS can use this information to decide which
drivers to load so that the AML interpreter and device drivers use
different regions of memory.
During table load, the address information is added to a global
address range list. Each node in this list contains an address range
as well as a namespace node of the OperationRegion. This list is
deleted at ACPI shutdown.
Unfortunately, ASL OperationRegions can be declared inside of control
methods. Although this is not recommended, modern firmware contains
such code. New module level code changes unintentionally removed the
functionality of adding and removing nodes to the global address
range list.
A few months ago, support for adding addresses has been re-
implemented. However, the removal of the address range list was
missed and resulted in some systems to crash due to the address list
containing bogus namespace nodes from OperationRegions declared in
control methods. In order to fix the crash, this change removes
dynamic OperationRegions after control method termination.
Link: https://bugzilla.kernel.org/show_bug.cgi?id=202475
Reported-by: Michael J Gruber <mjg@fedoraproject.org>
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
There is no mechanism to test proper removal of the global address
list entry added by OperationRegions declared inside of control
methods. In the worst case, there can be a dangling pointer in the
address list and cause systems to crash. This change adds a sanity
check to traverse each element of the global address list before to
ensure that all namespace nodes in the global address list are valid.
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
ACPI_NAME_SIZE changed to ACPI_NAMESEG_SIZE
This clarifies that this is the length of an individual
nameseg, not the length of a generic namestring/namepath.
Improves understanding of the code.
ACPI_COMPARE_NAME changed to ACPI_COMPARE_NAMESEG
This clarifies (1) this is a compare on 4-byte namesegs, not
a generic compare. Improves understanding of the code.
ACPI_MOVE_NAME changed to ACPI_COPY_NAMESEG
This clarifies (1) this is a copy operation, and
(2) it operates on ACPI NameSegs.
Improves understanding of the code.
Now detect and emit error upon detection of a forward reference
from a Field to an Operation Region. This will fail at runtime
if allowed to pass the compiler.
Improve code that generates resource descriptor and resource
tag pathnames. The original code used a bunch of str* C library
functions that caused warnings on some compilers.
There is a missing comma between strings on the array declaration. Fix
this by adding the missing comma.
Fixes: 205ac8fc7210 ("ACPI 6.3: add Error Disconnect Recover Notification value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
This change reserves several field to be reserved as well as rename
subtable 0 to "memory proximity domain attributes"
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>