Bugzilla: 3045 (https://bugzilla.tianocore.org/show_bug.cgi?id=3045)
Add a new parser for the Heterogeneous Memory Attribute Table. The
parser also validates some fields for this table.
The HMAT table is used to describe the memory attributes such as memory
side cache attributes and bandwidth and latency details related to
memory proximity domains. The info in the HMAT table can be used by an
operating system for optimisation.
Signed-off-by: Marc Moisson-Franckhauser <[email protected]>
Signed-off-by: Sami Mujawar <[email protected]>
Tested-by: Vijayenthiran Subramaniam <[email protected]>
Reviewed-by: Zhichao Gao <[email protected]>
Bugzilla: 3048 (https://bugzilla.tianocore.org/show_bug.cgi?id=3048)
Add a new parser for the Arm Error Source Table (AEST) described in
the ACPI for the Armv8 RAS Extensions 1.1 Platform Design Document,
dated 28 September 2020.
(https://developer.arm.com/documentation/den0085/0101/)
AEST enables kernel-first handling of errors in a system that supports
the Armv8 RAS extensions. It covers Armv8.2+ RAS extensions for PEs
and the RAS system architecture for non-PE system components.
Signed-off-by: Marc Moisson-Franckhauser <[email protected]>
Signed-off-by: Sami Mujawar <[email protected]>
Reviewed-by: Zhichao Gao <[email protected]>
Bugzilla: 3047 (https://bugzilla.tianocore.org/show_bug.cgi?id=3047)
Create a new parser for the PCCT Table.
The PCCT Table is used to describe how the OSPM can
communicate with entities outside the platform. It
describes which memory spaces correspond to which
entity as well as a few of the needed information
to handle the communications.
This new PCCT parser dumps the values and names of
the table fields. It also performs some validation
on the table's fields.
Signed-off-by: Marc Moisson-Franckhauser <[email protected]>
Signed-off-by: Sami Mujawar <[email protected]>
Reviewed-by: Zhichao Gao <[email protected]>
Bugzilla: 3046 (https://bugzilla.tianocore.org/show_bug.cgi?id=3046)
The field validator function provides means to validate fields
in the ACPI table structures. To print complex field types a
print formatter function is provided.
The field validator was being invoked for simple data fields
for which the default print format is used. However, the field
validator function was not invoked if a print formatter function
was provided.
This problem is noticed when a Generic Address Structure (GAS)
is printed using DumpGas() and a field validator is present
to validate the GAS structure.
To fix this move the invocation of the field validator after
the field is printed such that the validation function is
called even when a print formatter function is present.
Signed-off-by: Sami Mujawar <[email protected]>
Reviewed-by: Zhichao Gao <[email protected]>
The UefiShellAcpiViewCommandLib is converted from NULL library to a
named library so that it may be used in modules other than shell.
The library interface exposes the main method for to AcpiView
functionality as well as a helper method to dump a buffer to a file.
The Shell module is still built by pulling UefiShellAcpiViewCommandLib
as a NULL library to preserve the modularity of shell builds.
Cc: Ray Ni <[email protected]>
Cc: Zhichao Gao <[email protected]>
Reviewed-by: Zhichao Gao <[email protected]>
Signed-off-by: Tomas Pilar <[email protected]>
Method is refactored into two parts. A new method is
created that dumps arbitrary buffers into a newly created
file. This method is called from core code after the core code
determined the appropriate filename to be used.
This improves the modular design.
Cc: Ray Ni <[email protected]>
Cc: Zhichao Gao <[email protected]>
Reviewed-by: Zhichao Gao <[email protected]>
Signed-off-by: Tomas Pilar <[email protected]>
Parsing command line parameters is done in the shell
command wrapper. This declutters the core code and improves
modular design.
Cc: Ray Ni <[email protected]>
Cc: Zhichao Gao <[email protected]>
Reviewed-by: Zhichao Gao <[email protected]>
Signed-off-by: Tomas Pilar <[email protected]>
The table count module level symbols are now reset when
executing the core method, rather than the shell command
wrapper.
Cc: Ray Ni <[email protected]>
Cc: Zhichao Gao <[email protected]>
Reviewed-by: Zhichao Gao <[email protected]>
Signed-off-by: Tomas Pilar <[email protected]>
A new file and header (AcpiViewConfig.[ch]) is created
that houses the user configuration. This declutters the
core code and improves modularity of the design.
The module level symbols for verbosity, table selection, and
highlighting are refactored into the new file.
Cc: Ray Ni <[email protected]>
Cc: Zhichao Gao <[email protected]>
Reviewed-by: Zhichao Gao <[email protected]>
Signed-off-by: Tomas Pilar <[email protected]>
The error and warning counters are reset in the AcpiView main method.
This improves reusability of the main method.
Cc: Ray Ni <[email protected]>
Cc: Zhichao Gao <[email protected]>
Reviewed-by: Zhichao Gao <[email protected]>
Signed-off-by: Tomas Pilar <[email protected]>
For Arm-based platforms, count the instances of installed tables for
each ACPI table listed as 'mandatory' in any Server Base Boot
Requirements (SBBR) specification.
Validate that the all the mandatory SBBR tables present. Report an error
for each missing table.
This new feature is optional and can be enabled with the -r command line
parameter.
Reference(s):
- Arm Server Base Boot Requirements 1.2, September 2019
- Arm Server Base Boot Requirements 1.1, May 2018
- Arm Server Base Boot Requirements 1.0, March 2016
Signed-off-by: Krzysztof Koch <[email protected]>
Reviewed-by: Sami Mujawar <[email protected]>
Reviewed-by: Zhichao Gao <[email protected]>
For Arm-based platforms, define and implement an interface for Server
Base Boot Requirements (SBBR) compliance checks. The library is
responsible for validating that all mandatory ACPI tables are installed
on the platform.
Internally, the library maintains a data structure which tracks
instance counts for ACPI tables which are labeled as 'mandatory' in any
SBBR specification version. The provided interface allows:
- resetting all instance counts to 0
- incremementing the instance count for a table with a given signature
- validating the instance counts against the requirements in SBBR
The ACPI table requirements for each SBBR spec version are represented
internally as a list of table signatures.
Every missing mandatory table (for the input SBBR version) is reported
to the user as a separate error. If all requirements are met, an info
message is displayed.
Reference(s):
- Arm Server Base Boot Requirements 1.2, September 2019
- Arm Server Base Boot Requirements 1.1, May 2018
- Arm Server Base Boot Requirements 1.0, March 2016
Signed-off-by: Krzysztof Koch <[email protected]>
Reviewed-by: Sami Mujawar <[email protected]>
Reviewed-by: Zhichao Gao <[email protected]>
Define a new command line parameter '-r' to enable checking if all
mandatory ACPI tables listed in a specification are present.
The -r parameter takes an integer value to specify which specification
the validation should be performed against.
The parameter is used to set two Acpiview variables. An interface to
access these variables is implemented in this patch.
The new functionality is aimed at Arm-based platforms, however,
there are no restriction on extending it to other architectures.
For the 32-bit and 64-bit Arm architectures, the possible values for
the -r parameter are:
0: Arm Server Base Boot Requirements 1.0, March 2016
1: Arm Server Base Boot Requirements 1.1, May 2018
2: Arm Server Base Boot Requirements 1.2, September 2019
Signed-off-by: Krzysztof Koch <[email protected]>
Reviewed-by: Sami Mujawar <[email protected]>
Reviewed-by: Zhichao Gao <[email protected]>
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2534
Extend validation of ACPI structure lengths which are read from the
ACPI table being parsed. Additionally check if the structure 'Length'
field value is positive. If not, stop parsing the faulting table.
Some ACPI tables define internal structures of variable size. The
'Length' field inside the substructure is used to update a pointer used
for table traversal. If the byte-length of the structure is equal to 0,
acpiview can enter an infinite loop. This condition can occur if, for
example, the zero-allocated ACPI table buffer is not fully populated.
This is typically a bug on the ACPI table writer side.
In short, this method helps acpiview recover gracefully from a
zero-valued ACPI structure length.
Signed-off-by: Krzysztof Koch <[email protected]>
Reviewed-by: Sami Mujawar <[email protected]>
Reviewed-by: Zhichao Gao <[email protected]>
Check if the ACPI table length, as reported in the ACPI table header, is
big enough to fit at least the header itself.
If not, report an error to the user and stop parsing the table in order
to prevent buffer overruns.
Signed-off-by: Krzysztof Koch <[email protected]>
Reviewed-by: Sami Mujawar <[email protected]>
Reviewed-by: Zhichao Gao <[email protected]>
Remove duplicate Generic Address Structure (GAS) and ACPI table header
size definitions. Replace any dependencies with the definitions from
Acpi63.h.
AcpiParser.h redefines the size of Generic Address Structure (GAS) and
the ACPI table header. The motivation is to 'minimise any reference to
the EDK2 ACPI headers in an attempt to provide cross checking'. While
the redefined values are unlikely to change, redefinition causes
unnecessary maintenance overhead for acpiview.
In addition to this, EDK2 ACPI headers are referenced throughout the
entire project, so the assumption should be that the definitions in
these header files are correct.
Signed-off-by: Krzysztof Koch <[email protected]>
Reviewed-by: Sami Mujawar <[email protected]>
Reviewed-by: Zhichao Gao <[email protected]>
Check if global (in the scope of the DBG2 parser) pointers have been
successfully updated before they are used for further table parsing.
Signed-off-by: Krzysztof Koch <[email protected]>
Check if global (in the scope of the GTDT parser) pointers have been
successfully updated before they are used for further table parsing.
Signed-off-by: Krzysztof Koch <[email protected]>
Check if global (in the scope of the IORT parser) pointers have been
successfully updated before they are used for further table parsing.
Signed-off-by: Krzysztof Koch <[email protected]>
Check if the NumberOfPrivateResources, ProcessorTopologyStructureType
and ProcessorTopologyStructureLength pointers have been successfully
updated before they are used for further table parsing.
Signed-off-by: Krzysztof Koch <[email protected]>
Check if the MadtInterruptControllerType and
MadtInterruptControllerLength pointers have been successfully updated
before they are used for further table parsing.
Signed-off-by: Krzysztof Koch <[email protected]>
Check if SratRAType and SratRALength pointers have been successfully
updated before they are used for further table parsing.
Signed-off-by: Krzysztof Koch <[email protected]>
1. Check if the 'Number of System Localities' provided can be
represented in the SLIT table. The table 'Length' field is a 32-bit
value while the 'Number of System Localities' field is 64-bit long.
2. Check if the SLIT matrix fits in the table buffer. If N is the SLIT
locality count, then the matrix used to represent the localities is
N*N bytes long. The ACPI table length must be big enough to fit the
matrix.
3. Remove (now) redundant 64x64 bit multiplication.
Signed-off-by: Krzysztof Koch <[email protected]>
Check if SlitSystemLocalityCount pointer has been successfully updated
before it is used for further table parsing.
Signed-off-by: Krzysztof Koch <[email protected]>
Check if global pointers have been successfully updated before they
are used for further table parsing.
Signed-off-by: Krzysztof Koch <[email protected]>
Check if XsdtAddress pointer has been successfully updated before it
is used for further table parsing.
Signed-off-by: Krzysztof Koch <[email protected]>
For fields outside the buffer length provided, reset any pointers,
which were supposed to be updated by a ParseAcpi() function call to
NULL. This way one can easily validate if a pointer was successfully
updated.
The ParseAcpi() function parses the given ACPI table buffer by a
number of bytes which is a minimum of the buffer length and the length
described by ACPI_PARSER array. If the buffer length is shorter than
the array describing how to process the ACPI structure, then it is
possible that the ItemPtr inside ACPI_PARSER may not get updated or
initialized. This can lead to an error if the value pointed to by
ItemPtr is later used to control the parsing logic.
A typical example would be a 'number of elements' field in an ACPI
structure header which defines how many substructures of a given type
are present in the structure body. If the 'number of elements' field
is not parsed, we will have a dangling pointer which could cause a
problem later.
Signed-off-by: Krzysztof Koch <[email protected]>
FADT parser was checking for reduced ACPI flag incorrectly
leading to incorrect error message if FIRMWARE_CTRL and
X_FIRMWARE_CTRL are both 0.
Reviewed-by: Zhichao Gao <[email protected]>
Signed-off-by: Ashish Singhal <[email protected]>
Add support for revision 3 of System Resource Affinity Table (SRAT).
Decode and dump the new Generic Initiator Affinity Structure.
Validate the Device Handle Type field inside the Generic Initiator
Affinity Structure.
Reviewed-by: Alexei Fedorov <[email protected]>
Reviewed-by: Jaben Carsey <[email protected]>
Reviewed-by: Sami Mujawar <[email protected]>
Reviewed-by: Zhichao Gao <[email protected]>
Tested-by: Sudipto Paul <[email protected]>
Signed-off-by: Krzysztof Koch <[email protected]>
Updated IORT parser to conform to the IO Remapping
Table, Platform Design Document, Revision D, March 2018.
The following structure parsers have been updated:
1. SMMUv3 - added proximity domain and device Id
mapping index.
2. RootComplex - added memory address size limit.
2. PMCG - added page 1 support.
Cc: Ray Ni <[email protected]>
Cc: Zhichao Gao <[email protected]>
Reviewed-by: Zhichao Gao <[email protected]>
Signed-off-by: Sami Mujawar <[email protected]>
Add support for parsing the ACPI FACS table.
The FADT parser has also been updated as it
links the FACS table using the FIRMWARE_CTRL
or X_FIRMWARE_CTRL fields.
Since the FACS table does not follow the standard
ACPI header, the FADT parser extracts the FACS
signature, length and version fields before invoking
the FACS parser.
Cc: Ray Ni <[email protected]>
Cc: Zhichao Gao <[email protected]>
Reviewed-by: Zhichao Gao <[email protected]>
Signed-off-by: Sami Mujawar <[email protected]>
Replace the operation to shift logical left with the function
LShiftU64, which has the same functionality.
The original code causes ShellPkg build failure with build
target"-b NOOPT".
Cc: Jaben Carsey <[email protected]>
Cc: Ray Ni <[email protected]>
Cc: Zhichao Gao <[email protected]>
Signed-off-by: Shenglei Zhang <[email protected]>
Reviewed-by: Zhichao Gao <[email protected]>
Modify the SRAT parsing logic to prevent reading past the table buffer
length provided.
Check if the Static Resource Allocation Structure's buffer fits in the
SRAT table buffer before its contents are dumped.
Prevent buffer overruns when reading the Static Resource Allocation
Structure's header.
References:
- ACPI 6.3, January 2019, Section 5.2.16
Signed-off-by: Krzysztof Koch <[email protected]>
Reviewed-by: Alexei Fedorov <[email protected]>
Reviewed-by: Zhichao Gao <[email protected]>
Reviewed-by: Sami Mujawar <[email protected]>
Modify the PPTT table parsing logic to prevent reading past the ACPI
buffer lengths provided.
Check if the Number of Private Resources specified in the Processor
Hierarchy Node (Type 0) is possible given the Type 0 Structure's buffer
length.
Make sure that the processor topology structure's buffer fits in the
PPTT table buffer before its contents are dumped.
Prevent buffer overruns when reading the processor topology structure's
header.
References:
- ACPI 6.3, January 2019, Section 5.2.29
Signed-off-by: Krzysztof Koch <[email protected]>
Reviewed-by: Alexei Fedorov <[email protected]>
Reviewed-by: Zhichao Gao <[email protected]>
Reviewed-by: Sami Mujawar <[email protected]>
Modify the IORT table parsing logic to prevent reading past the buffer
lengths provided.
Change DumpIortNodeIdMappings() function's signature and implementation
to simplify buffer overrun prevention. Update all calls to this
function accordingly.
Modify the parser for each type of IORT node such that the offset from
the start of the node's buffer is tracked as the parsing function is
executed. Again, this change helps prevent buffer overruns.
Test that the IORT node buffer fits in the table buffer before the
node's buffer contents are dumped.
References:
- IO Remapping Table (Issue D), Platform Design Document, March 2018
Signed-off-by: Krzysztof Koch <[email protected]>
Reviewed-by: Alexei Fedorov <[email protected]>
Reviewed-by: Zhichao Gao <[email protected]>
Reviewed-by: Sami Mujawar <[email protected]>
Modify the GTDT table parsing logic to prevent reading past the ACPI
buffer lengths provided and to make it consistent with other table
parsers. This includes converting the do-while loop in ParseAcpiGtdt()
into a while loop.
Remove a check which ensures that the entire Platform GT Block
Structure buffer has been parsed. The ACPI specification does not ban
from defining buffers which are larger than the size indicated by the
count and sizes of substructures which constitute it.
Change the data type of the Length parameter to the DumpGTBlock()
function to reflect the width of the respective ACPI structure's
field.
References:
- ACPI 6.3, January 2019, Table 5-124
Signed-off-by: Krzysztof Koch <[email protected]>
Reviewed-by: Alexei Fedorov <[email protected]>
Reviewed-by: Zhichao Gao <[email protected]>
Reviewed-by: Sami Mujawar <[email protected]>
Modify the DBG2 table parsing logic to prevent reading past the ACPI
buffer lengths provided.
Modify the signature of the DumpDbgDeviceInfo() function to make it
consistent with the ACPI structure processing functions in other
acpiview parsers. Now, the length of the Debug Device Information
Structure is read before the entire structure is dumped.
This refactoring change makes it easier to stop reading beyond the
DBG2 table buffer if the Debug Device Information Structure Buffer
does not fit in the DBG2 buffer.
For processing the first two fields of the Debug Device Information
Structure (to get the length) a new ACPI_PARSER array is defined.
References:
- Microsoft Debug Port Table 2 (DBG2), December 10, 2015
Signed-off-by: Krzysztof Koch <[email protected]>
Reviewed-by: Alexei Fedorov <[email protected]>
Reviewed-by: Zhichao Gao <[email protected]>
Reviewed-by: Sami Mujawar <[email protected]>
Move Performance Monitoring Counter Group (PMCG) node ID mapping count
validation from the core IORT acpiview parser logic to a dedicated
function. Now, the pointer to the validation function is passed to the
IortNodePmcgParser[] ACPI_PARSER array.
This check does not affect the flow of IORT parsing and is limited to
a single table field in scope, therefore, it is better to keep it away
from the code responsible for traversing the table.
Signed-off-by: Krzysztof Koch <[email protected]>
Reviewed-by: Sami Mujawar <[email protected]>
Reviewed-by: Jaben Carsey <[email protected]>
Reviewed-by: Zhichao Gao <[email protected]>
Split the Interrupt Controller Structure length validation in the
acpiview UEFI shell tool into two logical parts:
1. Ensuring MADT table parser forward progress.
2. Preventing MADT table buffer overruns.
Also, make the condition for infinite loop detection applicable to
all types of Interrupt Controller Structures (for all interrupt models
which can be represented in MADT). Check if the controller length
specified is shorter than the byte size of the first two fields
('Type' and 'Length') present in every valid Interrupt Controller
Structure.
Signed-off-by: Krzysztof Koch <[email protected]>
Reviewed-by: Sami Mujawar <[email protected]>
Reviewed-by: Jaben Carsey <[email protected]>
Reviewed-by: Zhichao Gao <[email protected]>
Minor changes to the SRAT parser code to conform with the EDKII coding
style and to make it consistent with other ACPI table parsers.
Signed-off-by: Krzysztof Koch <[email protected]>
Reviewed-by: Sami Mujawar <[email protected]>
Reviewed-by: Jaben Carsey <[email protected]>
Reviewed-by: Zhichao Gao <[email protected]>
List ParseAcpi() function arguments one per line in order to make this
function call consistent with ParseAcpi() calls in other ACPI table
parsers.
Also, notify the user that XsdtAddress value of 0 results in RSDP
parsing being terminated and that the XSDT table will not be processed.
This effectively means that no more ACPI tables will be parsed because
of this RSDP table content error.
Signed-off-by: Krzysztof Koch <[email protected]>
Reviewed-by: Sami Mujawar <[email protected]>
Reviewed-by: Jaben Carsey <[email protected]>
Reviewed-by: Zhichao Gao <[email protected]>
Remove a call to ParseAcpi() responsible for getting the XSDT table
length. This call is not needed because the ACPI table buffer length is
provided as an input argument to the ParseAcpiXsdt() function.
Modify remaining code to use the AcpiTableLength argument of the
ParseAcpiXsdt() function instead of a global static variable.
Signed-off-by: Krzysztof Koch <[email protected]>
Reviewed-by: Sami Mujawar <[email protected]>
Reviewed-by: Jaben Carsey <[email protected]>
Reviewed-by: Zhichao Gao <[email protected]>
Modify the signature of the DumpGasStruct() function to include the
buffer length parameter and to return the number of bytes parsed by
the function.
This way it becomes possible to prevent buffer overruns when dumping
Generic Address Structure's (GAS) fields in the acpiview table
parsers.
Update all existing DumpGasStruct() calls in acpiview to add the
length argument.
Signed-off-by: Krzysztof Koch <[email protected]>
Reviewed-by: Sami Mujawar <[email protected]>
Reviewed-by: Zhichao Gao <[email protected]>
Remove redundant forward function declarations by repositioning
blocks of code. This way the code structure is consistent across
ACPI table parsers and the code becomes more concise.
Signed-off-by: Krzysztof Koch <[email protected]>
Reviewed-by: Jaben Carsey <[email protected]>
Reviewed-by: Sami Mujawar <[email protected]>
Reviewed-by: Alexei Fedorov <[email protected]>
Reviewed-by: Zhichao Gao <[email protected]>
Remove redundant forward function declarations by repositioning
blocks of code. This way the code structure is consistent across
ACPI table parsers and the code becomes more concise.
Replace multple use of literal values for GT Block Timer Frame
count/number validation with a macro definition.
Signed-off-by: Krzysztof Koch <[email protected]>
Reviewed-by: Jaben Carsey <[email protected]>
Reviewed-by: Sami Mujawar <[email protected]>
Reviewed-by: Alexei Fedorov <[email protected]>
Reviewed-by: Zhichao Gao <[email protected]>