summaryrefslogtreecommitdiff
path: root/DynamicTablesPkg/Library/Acpi/Arm
AgeCommit message (Collapse)AuthorFilesLines
2022-07-29MdePkg: IORT header update for IORT Rev E.d specSami Mujawar1-10/+9
Bugzilla: 3458 - Add support IORT Rev E.d specification updates (https://bugzilla.tianocore.org/show_bug.cgi?id=3458) The IO Remapping Table, Platform Design Document, Revision E.d, Feb 2022 (https://developer.arm.com/documentation/den0049/) introduces the following updates, collectively including the updates and errata fixes to Rev E, Rev E.a, Rev E.b, Rev E.c: - increments the IORT table revision to 5. - updates the node definition to add an 'Identifier' field. - adds definition of node type 6 - Reserved Memory Range node. - adds definition for Memory Range Descriptors. - adds flag to indicate PRI support for root complexes. - adds flag to indicate if the root complex supports forwarding of PASID information on translated transactions to the SMMU. - adds flag to indicate if the root complex supports PASID. - adds flags to define access privilege and attributes for the memory ranges. Therefore, update the IORT header file to reflect these changes, and also rename the EFI_ACPI_IO_REMAPPING_TABLE_REVISION macro to EFI_ACPI_IO_REMAPPING_TABLE_REVISION_00. Also update the IORT generator in DynamicTablesPkg to fix the compilation errors so that Git Bisect can work. Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
2022-07-29DynamicTablesPkg: IORT set reference to interrupt array if presentSami Mujawar1-30/+57
The IORT generator is populating the reference field for Context and PMU interrupts even if their count is zero. Update the IORT generator to set the references only if the interrupt count is not 0. Also add checks to ensure a valid reference token has been provided. Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
2022-07-29DynamicTablesPkg: IORT set reference to Id array only if presentSami Mujawar1-12/+15
The IORT table generator is setting up a reference to ID array for nodes even when the ID Mapping count is zero. This is not an issue as an OS would only access the ID Reference if the ID mapping count is not zero. However, it would be good to set the reference to ID array to zero when the ID Mapping count is zero rather than populating it with an incorrect value. Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
2022-07-29DynamicTablesPkg: Handle error when IdMappingToken is NULLSami Mujawar1-16/+66
Add error handling when the IdMappingCount is not zero and the IdMappingToken is NULL. Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
2022-07-19DynamicTablesPkg: AcpiSsdtPcieLibArm: Create support libraryJeff Brasen4-267/+4
Add support library to allow for customization of _OSC and slot info. The functions in the library are unchanged, with the exception of adding PciInfo pointer to the APIs. Signed-off-by: Jeff Brasen <jbrasen@nvidia.com> Reviewed-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2022-07-19DynamicTablesPkg: AcpiSsdtPcieLibArm: Support UID > 0xFJeff Brasen2-2/+5
Add support for PCIe devices with UID > 0xF. This is done by using the next value in the name so PCI5, PC26, etc Signed-off-by: Jeff Brasen <jbrasen@nvidia.com> Reviewed-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2022-07-19DynamicTablesPkg: AcpiSsdtPcieLibArm: Correct translation valueJeff Brasen1-6/+12
The translation value in ACPI should be the difference between the CPU and PCIe address. Signed-off-by: Jeff Brasen <jbrasen@nvidia.com> Reviewed-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2022-07-18DynamicTables: Fix DT PCI interrupt flags parsingPierre Gondois1-1/+1
Device Tree PCI interrupt flags use the convention described at linux/Documentation/devicetree/bindings/interrupt-controller/arm,gic.yaml The 3rd cell is the flags, encoded as follows: bits[3:0] trigger type and level flags. 1 = low-to-high edge triggered 2 = high-to-low edge triggered (invalid for SPIs) 4 = active high level-sensitive 8 = active low level-sensitive (invalid for SPIs). Fix the incorrect code. Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2022-07-15DynamicTablesPkg: Add support to specify FADT minor revisionSami Mujawar1-2/+27
The CM_STD_OBJ_ACPI_TABLE_INFO.AcpiTableRevision can be used to specify the major revision number of the ACPI table that the generator must use. Although most ACPI tables only have a major revision number, the FADT table additionally has a minor revision number. The FADT generator currently defaults to setting the latest supported ACPI revision for the FADT table i.e. ACPI 6.4. This means that the minor revision for the FADT table is always set to 4 and there is no provision for a user to specify the minor revision to be selected. Therefore, update CM_STD_OBJ_ACPI_TABLE_INFO to introduce a new field MinorRevision which can be used to specify the minor revision for an ACPI table. Also update the FADT generator to validate the supported FADT revisions ans use the specified minor revision for the FADT table if supported. If an unsupported minor revision is specified the FADT generator defaults to the latest supported minor revision. Since the CM_STD_OBJ_ACPI_TABLE_INFO.MinorRevision field is added to the end of the structure, it should not break existing platform code. Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: <pierre.gondois@arm.com> Tested-by: Jagadeesh Ujja <Jagadeesh.Ujja@arm.com>
2022-03-15DynamicTablesPkg: Fix serial port namespace path in DBG2Sami Mujawar1-3/+7
According to the Debug Port Table 2 (DBG2) specification, February 17, 2021, the NamespaceString is a NULL terminated ASCII string that consists of a fully qualified reference to the object that represents the serial port device in the ACPI namespace. The DBG2 table generator did not populate the full device path for the serial port device, and this results in a FWTS test failure. Therefore, populate the full namespace device path for the serial port in DBG2 table. Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Pierre Gondois <pierre.gondois@arm.com> Tested-by: Jagadeesh Ujja <Jagadeesh.Ujja@arm.com> Tested-by: Sunny Wang <sunny.wang@arm.com>
2022-02-01DynamicTablesPkg: AcpiSsdtPcieLibArm: Remove link device generationPierre Gondois2-288/+15
In ACPI 6.4, s6.2.13, _PRT objects describing PCI legacy interrupts can be defined following 2 models. In the first model, _PRT entries reference link devices. Link devices then describe interrupts. This allows to dynamically modify interrupts through _SRS and _PRS objects and to choose exactly the interrupt type (level/edge triggered, active high/low). In the second model, interrupt numbder are described in the _PRT entry. The interrupt type is then assumed by the OS. The Arm BSA, sE.6 "Legacy interrupts" states that PCI legacy interrupts must be converted to SPIs, and programmed level-sensitive, active high. Thus any OS must configure interrupts as such and there is no need to specify the interrupt type. Plus it is not possible to dynamically configure PCI interrupts. Thus remove the link device generation and use the second model for _PRT. Suggested-by: Ard Biesheuvel <ardb+tianocore@kernel.org> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
2021-12-13DynamicTablesPkg: SSDT Pci express generatorPierre Gondois4-0/+1710
This generator allows to generate a SSDT table describing a Pci express Bus. It uses the following CmObj: - EArmObjCmRef - EArmObjPciConfigSpaceInfo - EArmObjPciAddressMapInfo - EArmObjPciInterruptMapInfo REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3682 To: Sami Mujawar <sami.mujawar@arm.com> To: Alexei Fedorov <Alexei.Fedorov@arm.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2021-12-10DynamicTablesPkg: Add CacheId to PPTT generatorChris Jones1-11/+94
Bugzilla: 3697 (https://bugzilla.tianocore.org/show_bug.cgi?id=3697) Update the PPTT generator with the CacheId field as defined in table 5.140 of the ACPI 6.4 specification. Also add validations to ensure that the cache id generated is unique. Signed-off-by: Chris Jones <christopher.jones@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2021-12-10DynamicTablesPkg: Update PPTT generator to ACPI 6.4Chris Jones1-22/+22
Bugzilla: 3697 (https://bugzilla.tianocore.org/show_bug.cgi?id=3697) Update the PPTT generator to use Acpi64.h. Signed-off-by: Chris Jones <christopher.jones@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2021-12-10DynamicTablesPkg: Remove PPTT ID structure from ACPI 6.4 generatorChris Jones2-156/+2
Bugzilla: 3697 (https://bugzilla.tianocore.org/show_bug.cgi?id=3697) ACPI 6.3A deprecated PPTT ID (type 2) structure which was subsequently removed in ACPI 6.4. Therefore remove support for generating PPTT ID structures. Mantis ID for removing PPTT type 2 structure: 2072 (https://mantis.uefi.org/mantis/view.php?id=2072) Signed-off-by: Chris Jones <christopher.jones@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2021-12-07DynamicTablesPkg: Apply uncrustify changesMichael Kubacki17-1289/+1382
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the DynamicTablesPkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2021-12-07DynamicTablesPkg: Change complex DEBUG_CODE() to DEBUG_CODE_BEGIN/END()Michael D Kinney1-2/+2
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3767 Update use of DEBUG_CODE(Expression) if Expression is a complex code block with if/while/for/case statements that use {}. Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael Kubacki <michael.kubacki@microsoft.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2021-10-08DynamicTablesPkg: SSDT CPU topology and LPI state generatorPierre Gondois3-0/+1395
In the GIC interrupt model, logical processors are required to have a Processor Device object in the DSDT and must convey each processor's GIC information to the OS using the GICC structure. Additionally, _LPI objects may be needed as they provide a method to describe Low Power Idle states that defines the local power states for each node in a hierarchical processor topology. Therefore, add support to generate the CPU topology and the LPI state information in an SSDT table. Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-10-08DynamicTablesPkg: Remove unnecessary includesPierre Gondois2-5/+0
Some includes are not necessary. Remove them. Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-10-05DynamicTablesPkg: Rename SBSA generic watchdogChris Jones1-30/+30
Buzilla: 3565 (https://bugzilla.tianocore.org/show_bug.cgi?id=3565) As part of the updates to ACPI 6.4 the "SBSA Generic Watchdog" was renamed to the "Arm Generic Watchdog". This patch implements that change by updating the GTDT generator to use Acpi64.h and renames any occurence of "SBSA Generic Watchdog" to "Arm Generic Watchdog". Signed-off-by: Chris Jones <christopher.jones@arm.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2021-10-05DynamicTablesPkg: Update FADT generator to ACPI 6.4Chris Jones1-52/+52
Bugzilla: 3568 (https://bugzilla.tianocore.org/show_bug.cgi?id=3568) Update the FADT generator to use Acpi64.h. As the FADT revision tracks the ACPI revision this updates the minor revision value generated. Mantis ID for change: https://mantis.uefi.org/mantis/view.php?id=2105 Signed-off-by: Chris Jones <christopher.jones@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2021-10-01DynamicTablesPkg: Rework AmlResourceDataCodegen.c/hPierre Gondois1-3/+5
Rework all the functions to to have a generic prototype: - First take take the resource data specific arguments. E.g.: for a Register(): the AddressSpace, BitWidth, ... - The penultimate parameter is a NameOpNode. The resource data created is appended to the ResourceTemplate() contained in the NameOpNode. - The last parameter is a pointer holding the created resource data. A least one of the two last parameter must be provided. One of them can be omitted. This generic interface allows to either: - Add the resource data to a NameOpNode. This is a common case for the Ssdt tables generator. - Get the created resource data and let the caller place it in an AML tree. Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-10-01DynamicTablesPkg: Deprecate Crs specific methods in AmlLibPierre Gondois1-3/+3
Some functions in the AmlLib have 'Crs' in their name and can only be applied to '_CRS' AML objects. To re-use them on AML objects that have different names: - Rename them and remove the '_CRS' name check. - Create aliases having of the 'Crs' function prototypes. These aliases are available when DISABLE_NEW_DEPRECATED_INTERFACES is not defined. They will be deprecated in a near future. The deprecated functions are: - AmlNameOpCrsGetFirstRdNode() - AmlNameOpCrsGetNextRdNode() - AmlCodeGenCrsAddRdInterrupt() Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-10-01DynamicTablesPkg: Extract AcpiHelperLib from TableHelperLibPierre Gondois4-5/+7
The TableHelperLib contains helper functions. Some rely on DynamicTablesPkg definitions (they use Configuration Manager objects). Some others are more generic. To allow using these generic functions without including DynamicTablesPkg definitions, move them to a new AcpiHelperLib library. Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2021-06-02DynamicTablesPkg: Use AML_NAME_SEG_SIZE definePierre Gondois2-4/+4
Use the newly introduced defined value in: MdePkg/Include/IndustryStandard/AcpiAml.h Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2021-04-19DynamicTablesPkg: Set the Access size for the DBG2 tableJoey Gouly1-1/+23
The DBG2 table generator set the access size for the UART to DWORD (4 bytes) by default. However, according to Section B Generic UART, Arm Base System Architecture 1.0, Platform Design Document, a Generic UART can have BYTE, WORD or DWORD access sizes. To address this an AccessSize field has been introduced in CM_ARM_SERIAL_PORT_INFO object. This patch updates the DBG2 generator to setup the AccessSize field in the Generic Address Structure (GAS) for the UART in the DBG2 table with information provided by the platform. Signed-off-by: Joey Gouly <joey.gouly@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2021-04-19DynamicTablesPkg: Set the Access size for the SPCR tableJoey Gouly1-1/+21
The SPCR table generator set the access size for the UART to DWORD (4 bytes) by default. However, according to Section B Generic UART, Arm Base System Architecture 1.0, Platform Design Document, a Generic UART can have BYTE, WORD or DWORD access sizes. To address this an AccessSize field has been introduced in CM_ARM_SERIAL_PORT_INFO object. This patch updates the SPCR generator to setup the AccessSize field in the Generic Address Structure (GAS) for the UART in the SPCR table with information provided by the platform. Signed-off-by: Joey Gouly <joey.gouly@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2020-11-03DynamicTablesPkg: Add SSDT CMN-600 Table generatorPierre Gondois4-0/+874
The Generic ACPI for Arm Components 1.0 Platform Design Document, s2.6.4 "ASL code examples" provides information to describe an Arm CoreLink CMN-600 Coherent Mesh Network using an ASL definition block table. The SSDT CMN-600 Table Generator uses the Configuration Manager protocol to obtain the following information about the CMN-600 device on the platform: - the PERIPHBASE address location and address range; - the ROOTNODEBASE address location; - the number of Debug and Trace Controller (DTC) and their respective interrupt number; The CMN-600 mesh is described using the CM_ARM_CMN_600_INFO and CM_ARM_EXTENDED_INTERRUPT structures in the Configuration Manager. The SSDT CMN-600 Table generator: - gets the CMN-600 hardware information from the configuration manager. - uses the AmlLib interfaces to parse the AML template BLOB and construct an AML tree. - uses the AmlLib to update: - the "_UID" value; - the address location and range of the PERIPHBASE; - the address location of the ROOTNODEBASE; - the number of Debug and Trace Controller (DTC) and their respective interrupt number; - serializes the AML tree to an output buffer. This output buffer contains the fixed-up AML code, which is then installed as an ACPI SSDT table. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Co-authored-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
2020-10-21DynamicTablesPkg: AcpiSratLibArm fix ECC errorSami Mujawar1-2/+2
Fix the following ECC reported error in AcpiSratLibArm. - [9002] The function headers should follow Doxygen special documentation blocks in section 2.3.5 Comment does NOT have tail **/ Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
2020-10-21DynamicTablesPkg: SsdtSerialPortLibArm fix ECC errorSami Mujawar1-1/+5
Fix the following ECC reported error in SsdtSerialPortLibArm. - [5007] There should be no initialization of a variable as part of its declaration Variable Name. Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
2020-10-21DynamicTablesPkg: Fix order of assert checksSami Mujawar1-2/+2
Reordered the asserts to first check if the pointer is valid before de-referencing the pointer. Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
2020-08-13DynamicTablesPkg: Add SSDT Serial port for DBG2Pierre Gondois2-70/+165
The SSDT Serial port fixup library provides interfaces to generate a SSDT Serial port table based on the serial port information. Update the DBG2 Generator to use the SSDT serial port fixup library to build a serial port definition block for the DBG2 serial port and install the SSDT table. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
2020-08-13DynamicTablesPkg: Add SSDT Serial port for SPCRPierre Gondois2-62/+164
According to Arm Server Base Boot Requirements, Platform Design Document version 1.2 revision D, September 2, 2019, section '4.2.1.8 SPCR'; the SPCR console device must be included in the DSDT. The SSDT Serial port fixup library provides interfaces to generate a SSDT Serial port table based on the serial port information. Update the SPCR Generator to use the SSDT serial port fixup library to build a serial port definition block corresponding to the SPCR serial port and install the SSDT table. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
2020-08-13DynamicTablesPkg: SSDT Serial Port generatorPierre Gondois2-0/+400
Most platforms have several serial ports. These serial ports are described to an operating system using definition block tables. The SSDT Serial Port Table Generator uses the Configuration Manager protocol to obtain information for the Serial Ports on the platform. The serial ports are described using the CM_ARM_SERIAL_PORT_INFO structure. The EArmObjSerialPortInfo ID is used to represent a standard serial port. The SSDT Serial port fixup library provides interfaces to generate a SSDT Serial port table based on the serial port information. The SSDT Serial Port Table Generator uses the SSDT serial port fixup library to build serial port definition blocks and installs the SSDT tables. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
2020-08-07DynamicTablesPkg: Fix issues reported by EDKII CISami Mujawar5-17/+17
The TianoCore EDKII project has introduced a Core CI infrastructure using TianoCore EDKII Tools PIP modules: * https://pypi.org/project/edk2-pytool-library/ * https://pypi.org/project/edk2-pytool-extensions/ More information on configuring the environment and running the builds can be found in edk2\.pytool\Readme.md This patch fixes the issues reported by the CI system mainly around fixing typo errors and package dec and dsc files. A subsequent patch enables the CI builds for the DynamicTablesPkg. Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
2020-03-31DynamicTablesPkg: SRAT: Fix uninitialized memory usageSami Mujawar1-1/+1
On enabling the /analyse option the VS2017 compiler reports: warning C6001: Using uninitialized memory. This warning is reported for the Status variable in AddGenericInitiatorAffinity() as it is not initialised to a default value. This condition is only valid if GenInitAffCount is equal to 0. Since GenInitAffCount is already checked in BuildSratTable() this condition can never happen. The value of the Status variable is returned in failure cases from appropriate locations in AddGenericInitiatorAffinity(). The only case where Status value is being used un-initialised is the return statement at the end of AddGenericInitiatorAffinity(). Therefore, to fix this issue EFI_SUCCESS can be safely returned instead of returning the Status variable at the end of the function. Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
2020-03-31DynamicTablesPkg: SRAT: Fix entry pointsSami Mujawar1-4/+4
VS2017 reports 'warning C4028: formal parameter 2 different from declaration' for the library constructor and destructor interfaces for the SRAT Generator modules. Remove the CONST qualifier for the ImageHandle and the SystemTable pointer in the library constructor and destructor to make it compatible with the formal declaration. Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
2020-03-29DynamicTablesPkg: PPTT: Fix uninitialized memory usageSami Mujawar1-30/+29
On enabling the /analyse option the VS2017 compiler reports: warning C6001: Using uninitialized memory. This warning is reported as some variables that were being logged were uninitialised. To fix this, moved the logging code after the variables being logged are initialised. Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
2020-03-29DynamicTablesPkg: IORT: Fix uninitialized memory usageSami Mujawar1-48/+48
On enabling the /analyse option the VS2017 compiler reports: warning C6001: Using uninitialized memory. This warning is reported as some variables that were being logged were uninitialised. To fix this, moved the logging code after the variables being logged are initialised. Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
2020-03-29DynamicTablesPkg: Fix IORT node length assignmentSami Mujawar1-99/+253
The VS2017 compiler reports 'warning C4267: 'return': conversion from 'size_t' to 'UINT32', possible loss of data' for a number of functions that compute the IORT node length. Similarly, it reports warnings for IORT node length field assignments as the length field is 16-bit wide. This patch adds type casts at appropriate places and also implements validations to ensure that the max width of the respective fields is not exceeded. This patch also fixes a typo in one of the local variable names. Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
2020-03-29DynamicTablesPkg: Remove redundant frame count checkSami Mujawar1-10/+0
Removing GT Block frame count check from AddGTBlockTimerFrames() as this is already validated in BuildGtdtTable(). Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
2020-03-29DynamicTablesPkg: Serial debug port initialisationSami Mujawar1-10/+17
The ARM DCC serial port subtype is an option that is supported by the DBG2 generator. However, the serial port initialisation should only be done for PL011/SBSA compatible UARTs. Add check to conditionally initialise the serial port. Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
2020-03-29DynamicTablesPkg: Fix unaligned pointers usageSami Mujawar2-13/+24
The VS2017 compiler reports 'warning C4366: The result of the unary '&' operator may be unaligned' if an address of an unaligned structure member is passed as an argument to a function. Fix this warning by using local variables in place of unaligned structure members. Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
2020-03-29DynamicTablesPkg: Fix GT Block length assignmentSami Mujawar1-4/+21
The VS2017 compiler reports 'warning C4267: '=': conversion from 'size_t' to 'UINT16', possible loss of data'. The sizeof() operator is used to calculate the size of the GT Block structure. The length field in the GT Block structure is 16-bit wide. Since the return type of sizeof() operator is size_t the VS2017 compiler reports the above warning. To fix the warning, an explicit type cast is added. An additional check is also performed to ensure that the calculated GT Block length does not exceed MAX_UINT16. Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
2020-03-29DynamicTablesPkg: Fix Proc node length assignmentSami Mujawar1-3/+4
The length field for the Processor Hierarchy node structure is 8-bit wide while the number of private resource field is 32-bit wide. Therefore, the GetProcHierarchyNodeSize() returns the size as a 32-bit value. The VS2017 compiler reports 'warning C4244: '=': conversion from 'UINT32' to 'UINT8', possible loss of data' while assigning the length field of the Processor Hierarchy node structure. To fix this, a type cast is added. In addition, there is a check to ensure that the Processor Hierarchy node size does not exceed MAX_UINT8. Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
2020-03-29DynamicTablesPkg: Fix serial port subtype warningSami Mujawar1-1/+14
The VS2017 compiler reports 'warning C4244: '=': conversion from 'UINT16' to 'UINT8', possible loss of data' for the SPCR InterfaceType field assignment. The SPCR InterfaceType field uses the same encoding as that of the DBG2 table Port Subtype field. However SPCR.InterfaceType is 8-bit while the Port Subtype field in DBG2 table is 16-bit. Since the Configuration Manager represents the Serial port information using the struct CM_ARM_SERIAL_PORT_INFO, the PortSubtype member in this struct is 16-bit. To fix the warning an explicit type case is added. A validation is also added to ensure that the Serial Port Subtype value provided by the Configuration Manager is within the 8-bit range (less than 256). Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
2020-03-29DynamicTablesPkg: Fix missing local header warningSami Mujawar2-1/+3
The edk2 BaseTools report a warning if a local header file is not listed under the [Sources] section in the INF file. Add header files to the [Sources] section in the respective INF files to fix the warnings. Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
2020-03-29DynamicTablesPkg: Fix entry point param definitionSami Mujawar9-36/+36
VS2017 reports 'warning C4028: formal parameter 2 different from declaration' for the library constructor and destructor interfaces for the Generator modules. VS2017 compiler also reports similar warnings for the DXE entry points. Remove the CONST qualifier for the SystemTable pointer (the second parameter to the constructor/destructor/DXE Entry point) to make it compatible with the formal declaration. Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
2020-03-26DynamicTablesPkg: Update FADT generator to ACPI 6.3Sami Mujawar1-51/+51
Update FADT table generator to support ACPI revision 6.3 Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
2019-10-21DynamicTablesPkg: Arm SRAT Table GeneratorSami Mujawar2-0/+864
The SRAT generator uses the configuration manager protocol to obtain the affinity information for the GICC, GIC ITS, Memory, Generic Initiator, etc. and generates the SRAT table. The table generator supports ACPI 6.3, SRAT table revision 3. The ACPI and PCI device handles of the Generic Initiator Affinity structures are represented using tokens. The generator invokes the configuration manager protocol interfaces and requests for objects referenced by tokens to get the device handle information. The Configuration Manager object definition for the GICC has been updated to include the Proximity Domain, Clock Domain and associated flag information. Similarly the Configuration Manager object for the GIC ITS has been updated to include the Proximity Domain information. These changes should not impact any existing implementations as the new fields have been added towards the end of the Configuration Manager Objects. Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>