summaryrefslogtreecommitdiffstats
path: root/DynamicTablesPkg
Commit message (Collapse)AuthorAgeFilesLines
* DynamicTablesPkg: DynamicPlatRepo: Add TokenFixerPierre Gondois2021-12-142-0/+217
| | | | | | | | | | | | | | | | | | | | The DynamicPlatRepo library allows to handle dynamically created CmObj. The dynamic platform repository can be in the following states: 1 - Non-initialised 2 - Transient: Possibility to add CmObj to the platform, but not to query them. 3 - Finalised: Possibility to query CmObj, but not to add new. A token is allocated to each CmObj added to the dynamic platform repository (except for reference tokens CmObj). This allows to retrieve dynamic CmObjs among all CmObj (static CmObj for instance). This patch add the TokenFixer files, allowing to update the self-token some CmObj have. Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* DynamicTablesPkg: DynamicPlatRepo: Add TokenGeneratorPierre Gondois2021-12-142-0/+55
| | | | | | | | | | | | | | | | | | | The DynamicPlatRepo library allows to handle dynamically created CmObj. The dynamic platform repository can be in the following states: 1 - Non-initialised 2 - Transient: Possibility to add CmObj to the platform, but not to query them. 3 - Finalised: Possibility to query CmObj, but not to add new. A token is allocated to each CmObj added to the dynamic platform repository (except for reference tokens CmObj). This allows to retrieve dynamic CmObjs among all CmObj (static CmObj for instance). This patch add the TokenGenerator files. Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* DynamicTablesPkg: Definition for DynamicPlatRepoLib interfacePierre Gondois2021-12-142-0/+117
| | | | | | | | | | | | | | | | | | | The DynamicPlatRepoLib library allows to handle dynamically created CmObj. The dynamic platform repository can be in the following states: 1 - Non-initialised 2 - Transient: Possibility to add CmObj to the platform, but not to query them. 3 - Finalised: Possibility to query CmObj, but not to add new. A token is allocated to each CmObj added to the dynamic platform repository (except for reference tokens CmObj). This allows to retrieve dynamic CmObjs among all CmObj (static CmObj for instance). This patch defines the library interface of the DynamicPlatRepo. Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* DynamicTablesPkg: Handle 16550_WITH_GAS idPierre Gondois2021-12-141-1/+4
| | | | | | | | | | Handle the EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_16550_WITH_GAS id when generating an AML description of a serial port. The same _HID/_CID as the EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_FULL_16550 are generated. Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* DynamicTablesPkg: Add FdtHwInfoParser libraryPierre Gondois2021-12-145-1/+330
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Hardware information parser is an optional module defined by the Dynamic Tables Framework. It can either parse an XML, a Device Tree or a Json file containing the platform hardware information to populate the platform information repository. FdtHwInfoParser library is an instance of a HwInfoParser that parses a Device Tree and populates the Configuration Manager Platform information repository. FdtHwInfoParser library is aimed at providing a solution for generating ACPI tables for Guest Partitions launched by virtual machine managers (VMMs). One such use case is Kvmtool where the Device Tree for the Guest is passed on to the firmware by Kvmtool. The Configuration Manager for Kvmtool firmware shall invoke the FdtHwInfoParser to parse the Device Tree to populate the hardware information in the Platform Info Repository. The Kvmtool Configuration Manager can the process this information to generate the required ACPI tables for the Guest VM. This approach also scales well if the number of CPUs or if the hardware configuration of the Guest partition is varied. FdtHwInfoParser thereby introduces 'Dynamic Tables for Virtual Machines'. Ref:https://bugzilla.tianocore.org/show_bug.cgi?id=3741 Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* DynamicTablesPkg: FdtHwInfoParser: Add PCI config parserPierre Gondois2021-12-142-0/+956
| | | | | | | | | | | | | | | | | | | | | | | | On platforms that implement PCIe, the PCIe configuration space information must be described to a standards-based operating system in the Memory mapped configuration space base address Description (MCFG) table. The PCIe information is described in the platform Device Tree, the bindings for which can be found at: - linux/Documentation/devicetree/bindings/pci/ host-generic-pci.yaml The FdtHwInfoParser implements a PCI configuration space Parser that parses the platform Device Tree to create CM_ARM_PCI_CONFIG_SPACE_INFO objects which are encapsulated in a Configuration Manager descriptor object and added to the platform information repository. The platform Configuration Manager can then utilise this information when generating the MCFG table. Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* DynamicTablesPkg: FdtHwInfoParser: Add GIC dispatcherPierre Gondois2021-12-142-0/+290
| | | | | | | | | The GIC Dispatcher is the top-level component that is responsible for invoking the respective parsers for GICC, GICD, GIC MSI Frame, GIC ITS and the GICR. Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* DynamicTablesPkg: FdtHwInfoParser: Add GICR parserPierre Gondois2021-12-142-0/+285
| | | | | | | | | | | | | | | | | | | | | | | | | | | The GIC Redistributor (GICR) structure is part of the Multiple APIC Description Table (MADT) that enables the discovery of GIC Redistributor base addresses by providing the Physical Base Address of a page range containing the GIC Redistributors. More than one GICR Structure may be presented in the MADT. The GICR structures should only be used when describing GIC version 3 or higher. The GIC Redistributor information is described in the platform Device Tree, the bindings for which can be found at: - linux/Documentation/devicetree/bindings/interrupt-controller/ arm,gic-v3.yaml The FdtHwInfoParser implements a GIC Redistributor Parser that parses the platform Device Tree to create CM_ARM_GIC_REDIST_INFO objects which are encapsulated in a Configuration Manager descriptor object and added to the platform information repository. The platform Configuration Manager can then utilise this information when generating the MADT table. Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* DynamicTablesPkg: FdtHwInfoParser: Add ITS parserPierre Gondois2021-12-142-0/+266
| | | | | | | | | | | | | | | | | | | | | | | | Arm GIC v3/v4 optionally includes support for GIC Interrupt Translation Service (ITS). The GIC ITS Structure is part of the Multiple APIC Description Table (MADT) that describes the GIC Interrupt Translation service to the OS. The GIC Interrupt Translation Service information is described in the platform Device Tree, the bindings for which can be found at: - linux/Documentation/devicetree/bindings/interrupt-controller/ arm,gic-v3.yaml The FdtHwInfoParser implements a GIC ITS Parser that parses the platform Device Tree to create CM_ARM_GIC_ITS_INFO objects which are encapsulated in a Configuration Manager descriptor object and added to the platform information repository. The platform Configuration Manager can then utilise this information when generating the MADT table. Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* DynamicTablesPkg: FdtHwInfoParser: Add MSI Frame parserPierre Gondois2021-12-142-0/+267
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Arm GIC version 2 systems that support Message Signalled Interrupts implement GICv2m MSI frame(s). Each GICv2m MSI frame consists of a 4k page which includes registers to generate message signalled interrupts to an associated GIC distributor. The frame also includes registers to discover the set of distributor lines which may be signalled by MSIs from that frame. A system may have multiple MSI frames, and separate frames may be defined for secure and non-secure access. A MSI Frame structure is part of the Multiple APIC Description Table (MADT) and must only be used to describe non-secure MSI frames. The MSI Frame information is described in the platform Device Tree, the bindings for which can be found at: - linux/Documentation/devicetree/bindings/interrupt-controller/ arm,gic.yaml - linux/Documentation/devicetree/bindings/interrupt-controller/ arm,gic-v3.yaml The FdtHwInfoParser implements a MSI Frame Parser that parses the platform Device Tree to create CM_ARM_GIC_MSI_FRAME_INFO objects which are encapsulated in a Configuration Manager descriptor object and added to the platform information repository. The platform Configuration Manager can then utilise this information when generating the MADT table. Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* DynamicTablesPkg: FdtHwInfoParser: Add GICD parserPierre Gondois2021-12-142-0/+221
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On ARM-based systems the Generic Interrupt Controller (GIC) manages interrupts on the system. Each interrupt is identified in the GIC by an interrupt identifier (INTID). ACPI GSIVs map one to one to GIC INTIDs for peripheral interrupts, whether shared (SPI) or private (PPI). The GIC distributor provides the routing configuration for the interrupts. The GIC Distributor (GICD) structure is part of the Multiple APIC Description Table (MADT) that describes the GIC distributor to the OS. The MADT table is a mandatory table required for booting a standards-based operating system. The GIC Distributor information is described in the platform Device Tree, the bindings for which can be found at: - linux/Documentation/devicetree/bindings/interrupt-controller/ arm,gic.yaml - linux/Documentation/devicetree/bindings/interrupt-controller/ arm,gic-v3.yaml The FdtHwInfoParser implements a GIC Distributor Parser that parses the platform Device Tree to create CM_ARM_GICD_INFO object which is encapsulated in a Configuration Manager descriptor object and added to the platform information repository. The platform Configuration Manager can then utilise this information when generating the MADT table. Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* DynamicTablesPkg: FdtHwInfoParser: Add GICC parserPierre Gondois2021-12-142-0/+844
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The GIC CPU Interface (GICC) structure is part of the Multiple APIC Description Table (MADT) that describes the interrupt model for the platform. The MADT table is a mandatory table required for booting a standards-based operating system. Arm requires the GIC interrupt model, in which the 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. The CPU and GIC information is described in the platform Device Tree, the bindings for which can be found at: - linux/Documentation/devicetree/bindings/arm/cpus.yaml - linux/Documentation/devicetree/bindings/interrupt-controller/ arm,gic.yaml - linux/Documentation/devicetree/bindings/interrupt-controller/ arm,gic-v3.yaml The FdtHwInfoParser implements a GIC CPU Interface Parser that parses the platform Device Tree to create CM_ARM_GICC_INFO objects which are encapsulated in a Configuration Manager descriptor object and added to the platform information repository. The platform Configuration Manager can then utilise this information when generating the MADT and the SSDT CPU information tables. Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* DynamicTablesPkg: FdtHwInfoParser: Add Serial port parserPierre Gondois2021-12-142-0/+680
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Microsoft Debug Port Table 2 (DBG2), the Serial Port Console Redirector (SPCR) table are mandatory tables required for booting a standards-based operating system. The DBG2 table is used by the OS debugger while the SPCR table is used to configure the serial terminal. Additionally, the serial ports available on a platform for generic use also need to be described in DSDT/SSDT for an OS to be able to use the serial ports. The Arm Base System Architecture 1.0 specification a lists of supported serial port hardware for Arm Platforms. This list includes the following serial port UARTs: - SBSA/Generic UART - a fully 16550 compatible UART. Along, with these the PL011 UART is the most commonly used serial port hardware on Arm platforms. The serial port hardware information is described in the platform Device Tree, the bindings for which can be found at: - linux/Documentation/devicetree/bindings/serial/serial.yaml - linux/Documentation/devicetree/bindings/serial/8250.txt - linux/Documentation/devicetree/bindings/serial/arm_sbsa_uart.txt - linux/Documentation/devicetree/bindings/serial/pl011.yaml The FdtHwInfoParser implements a Serial Port Parser that parses the platform Device Tree to create CM_ARM_SERIAL_PORT_INFO objects with the following IDs: - EArmObjSerialConsolePortInfo (for use by SPCR) - EArmObjSerialDebugPortInfo (for use by DBG2) - EArmObjSerialPortInfo (for use as generic Serial Ports) The Serial Port for use by SPCR is selected by parsing the Device Tree for the '/chosen' node with the 'stdout-path' property. The next Serial Port is selected for use as the Debug Serial Port and the remaining serial ports are used as generic serial ports. The CM_ARM_SERIAL_PORT_INFO objects are encapsulated in Configuration Manager descriptor objects with the respective IDs and are added to the platform information repository. The platform Configuration Manager can then utilise this information when generating the DBG2, SPCR and the SSDT serial port tables. Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* DynamicTablesPkg: FdtHwInfoParser: Generic Timer ParserPierre Gondois2021-12-142-0/+324
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Generic Timer Description Table (GTDT) is a mandatory table required for booting a standards-based operating system. It provides an OSPM with information about a system's Generic Timer configuration. The Generic Timer (GT) is a standard timer interface implemented on ARM processor-based systems. The GTDT provides OSPM with information about a system's GT interrupt configurations, for both per-processor timers, and platform (memory-mapped) timers. The Generic Timer information is described in the platform Device Tree. The Device Tree bindings for the Generic timers can be found at: - linux/Documentation/devicetree/bindings/timer/arm,arch_timer.yaml The FdtHwInfoParser implements a Generic Timer Parser that parses the platform Device Tree to create a CM_ARM_GENERIC_TIMER_INFO object. The CM_ARM_GENERIC_TIMER_INFO object is encapsulated in a Configuration Manager descriptor object and added to the platform information repository. The platform Configuration Manager can then utilise this information when generating the GTDT table. Note: The Generic Timer Parser currently does not support parsing of memory-mapped platform timers. Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* DynamicTablesPkg: FdtHwInfoParser: Add Boot Arch parserPierre Gondois2021-12-142-0/+204
| | | | | | | | | | | | | | | | | | | | | | | | | | | The Fixed ACPI Description Table (FADT) is a mandatory table required for booting a standards-based operating system. The FADT table has an 'ARM Boot Architecture Flags' field that is used by an OS at boot time to determine the code path during boot. This field is used to specify if the platform complies with the PSCI specification. It is also used to describe the conduit (SMC/HVC) to be used for PSCI. The PSCI compliance information for a platform is described in the platform Device Tree, the bindings for which can be found at: - linux/Documentation/devicetree/bindings/arm/psci.yaml The FdtHwInfoParser implements a Boot Arch Parser that parses the platform Device Tree to create a CM_ARM_BOOT_ARCH_INFO object. The CM_ARM_BOOT_ARCH_INFO object is encapsulated in a Configuration Manager descriptor object and added to the platform information repository. The platform Configuration Manager can then utilise this information when generating the FADT table. Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* DynamicTablesPkg: FdtHwInfoParser: Add FDT utility functionsPierre Gondois2021-12-142-0/+1381
| | | | | | | | | | | | The FdtHwInfoParser parses a platform Device Tree and populates the Platform Information repository with Configuration Manager objects. Therefore, add a set of helper functions to simplify parsing of the platform Device Tree. Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* DynamicTablesPkg: FdtHwInfoParser: CM Object descriptor helperPierre Gondois2021-12-142-0/+437
| | | | | | | | | | | | | | | FdtHwInfoParserLib is an instance of the HwInfoParser. The FdtHwInfoParser parses a platform Device Tree and populates the Platform Information repository with Configuration Manager objects that describe the platform hardware. These Configuration Manager objects are encapsulated in Configuration Manager Object Descriptors. Therefore, add helper functions to create and free the Configuration Manager Object descriptors. Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* DynamicTablesPkg: Definition for HwInfoParser interfacePierre Gondois2021-12-142-0/+102
| | | | | | | | | | | | | | | | | | Hardware information parser is an optional module defined by the Dynamic Tables Framework. It can either parse an XML, a Device Tree or a Json file containing the platform hardware information to populate the platform information repository. The Configuration Manager can then utilise this information to generate ACPI tables for the platform. Therefore, define an interface for the HwInfoParser library class. Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Co-authored-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Joey Gouly <joey.gouly@arm.com>
* DynamicTablesPkg: Fix multiple objects parsingPierre Gondois2021-12-131-1/+13
| | | | | | | | | When a CmObjDesc contains multiple objects, only the first one is parsed as the buffer doesn't progress. Fix this. Also check that the whole buffer has been parsed with an asset. Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* DynamicTablesPkg: SSDT Pci express generatorPierre Gondois2021-12-136-0/+1717
| | | | | | | | | | | | | | | | 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>
* DynamicTablesPkg: Add Pci related objectsPierre Gondois2021-12-132-8/+112
| | | | | | | | | | | | | | Introduce the following CmObj in the ArmNameSpaceObjects: - CM_ARM_PCI_ADDRESS_MAP_INFO - CM_ARM_PCI_INTERRUPT_MAP_INFO These objects allow to describe address range mapping of Pci busses and interrupt mapping of Pci devices. 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>
* DynamicTablesPkg: Add AmlAttachNode()Pierre Gondois2021-12-132-0/+69
| | | | | | | | | | | | | | | | | | | | | | | | This function allows to add a node as the last node of a parent node in an AML tree. For instance, ASL code corresponding to NewNode: Name (_UID, 0) ASL code corresponding to ParentNode: Device (PCI0) { Name(_HID, EISAID("PNP0A08")) } "AmlAttachNode (ParentNode, NewNode)" will result in: ASL code: Device (PCI0) { Name(_HID, EISAID("PNP0A08")) Name (_UID, 0) } 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>
* DynamicTablesPkg: AML Code generation to add _PRT entriesPierre Gondois2021-12-132-0/+266
| | | | | | | | | | | | | _PRT entries can describe interrupt mapping for Pci devices. The object is described in ACPI 6.4 s6.2.13 "_PRT (PCI Routing Table)". Add AmlCodeGenPrtEntry() helper function to add _PRT entries to an existing _PRT object. 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>
* DynamicTablesPkg: AML Code generation to create a named ResourceTemplate()Pierre Gondois2021-12-132-0/+84
| | | | | | | | | | | | | | Add AmlCodeGenNameResourceTemplate() to generate code for a ResourceTemplate(). AmlCodeGenNameResourceTemplate ("REST", ParentNode, NewObjectNode) is equivalent of the following ASL code: Name(REST, ResourceTemplate () {}) 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>
* DynamicTablesPkg: AML Code generation to create a named Package()Pierre Gondois2021-12-132-0/+84
| | | | | | | | | | | | | Add AmlCodeGenNamePackage() to generate code for a Package(). AmlCodeGenNamePackage ("PACK", ParentNode, NewObjectNode) is equivalent of the following ASL code: Name(PACK, Package () {}) 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>
* DynamicTablesPkg: AML Code generation for memory rangesPierre Gondois2021-12-132-0/+1223
| | | | | | | | | | | | | | | | Add helper functions to generate AML Resource Data describing memory ranges. Memory ranges can be one, double or four words long. They can be of 'normal', IO or bus number memory type. The following APIs are exposed: - AmlCodeGenRdDWordIo () - AmlCodeGenRdDWordMemory () - AmlCodeGenRdWordBusNumber () - AmlCodeGenRdQWordMemory () 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>
* DynamicTablesPkg: Add CacheId to PPTT generatorChris Jones2021-12-102-12/+97
| | | | | | | | | | | | 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>
* DynamicTablesPkg: Update PPTT generator to ACPI 6.4Chris Jones2021-12-101-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>
* DynamicTablesPkg: Remove PPTT ID structure from ACPI 6.4 generatorChris Jones2021-12-103-178/+3
| | | | | | | | | | | | | | 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>
* DynamicTablesPkg: Apply uncrustify changesMichael Kubacki2021-12-0785-4805/+5357
| | | | | | | | | | | | 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>
* DynamicTablesPkg: Change complex DEBUG_CODE() to DEBUG_CODE_BEGIN/END()Michael D Kinney2021-12-071-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>
* DynamicTablesPkg: Change OPTIONAL keyword usage styleMichael D Kinney2021-12-078-53/+53
| | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3760 Update all use of ', OPTIONAL' to ' OPTIONAL,' for function params. 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>
* DynamicTablesPkg: Add missing BaseStackCheckLib instanceMichael D Kinney2021-11-051-1/+1
| | | | | | | | | | | Fix ARM and AARCH64 build issues by adding the BaseStackCheckLib instance. Cc: Sami Mujawar <Sami.Mujawar@arm.com> Cc: Alexei Fedorov <Alexei.Fedorov@arm.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* DynamicTablesPkg: Fix void pointer arithmeticPierre Gondois2021-10-201-1/+1
| | | | | | | | | | | | Building the DynamicTablesPkg with the additional -Wpointer-arith flag triggers the following error: "pointer of type ‘void *’ used in arithmetic [-Werror=pointer-arith]" Cast the void pointer to fix the error. Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* DynamicTablesPkg: Fix unitialized variable useMoritz Fischer2021-10-201-1/+1
| | | | | | | | | In the success case we should return EFI_SUCCESS rather than returning a potentially unitialized value of Status. Cc: Sami Mujawar <Sami.Mujawar@arm.com> Cc: Alexei Fedorov <Alexei.Fedorov@arm.com> Signed-off-by: Moritz Fischer <moritzf@google.com>
* DynamicTablesPkg: SSDT CPU topology and LPI state generatorPierre Gondois2021-10-085-1/+1407
| | | | | | | | | | | | | | | 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>
* DynamicTablesPkg: Add CM_ARM_LPI_INFO objectPierre Gondois2021-10-082-0/+103
| | | | | | | | | Introduce the CM_ARM_LPI_INFO CmObj in the ArmNameSpaceObjects. This allows to describe LPI state information, as described in ACPI 6.4, s8.4.4.3 "_LPI (Low Power Idle States)". Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
* DynamicTablesPkg: AML code generation to add an _LPI statePierre Gondois2021-10-082-0/+530
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add AmlAddLpiState() to generates AML code to add an _LPI state to an _LPI object created using AmlCreateLpiNode(). AmlAddLpiState increments the count of LPI states in the LPI node by one, and adds the following package: Package() { MinResidency, WorstCaseWakeLatency, Flags, ArchFlags, ResCntFreq, EnableParentState, (GenericRegisterDescriptor != NULL) ? // Entry method. If a ResourceTemplate(GenericRegisterDescriptor) : // Register is given, Integer, // use it. Use the // Integer otherwise ResourceTemplate() { // NULL Residency Register (SystemMemory, 0, 0, 0, 0) // Counter }, ResourceTemplate() { // NULL Usage Counter Register (SystemMemory, 0, 0, 0, 0) }, "" // NULL State Name }, Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
* DynamicTablesPkg: AML code generation for a _LPI objectPierre Gondois2021-10-082-0/+177
| | | | | | | | | | | | | | | | | | | | _LPI object provides a method to describe Low Power Idle states that define the local power states for each node in a hierarchical processor topology. Therefore, add AmlCreateLpiNode() to generate code for a _LPI object. AmlCreateLpiNode ("_LPI", 0, 1, ParentNode, &LpiNode) is equivalent of the following ASL code: Name (_LPI, Package ( 0, // Revision 1, // LevelId 0 // Count )) Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
* DynamicTablesPkg: AML code generation for a Method returning a NSPierre Gondois2021-10-082-0/+159
| | | | | | | | | | | | | | | | Add AmlCodeGenMethodRetNameString() to generate AML code to create a Method returning a NameString (NS). AmlCodeGenMethodRetNameString ( "MET0", "_CRS", 1, TRUE, 3, ParentNode, NewObjectNode ); is equivalent of the following ASL code: Method(MET0, 1, Serialized, 3) { Return (_CRS) } Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
* DynamicTablesPkg: AML code generation to Return a NameStringPierre Gondois2021-10-081-0/+181
| | | | | | | | | | | | Add AmlCodeGenReturnNameString() to generate AML code for a Return object node, returning the object as a NameString. AmlCodeGenReturn ("NAM1", ParentNode, NewObjectNode) is equivalent of the following ASL code: Return(NAM1) Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
* DynamicTablesPkg: AML code generation for a MethodPierre Gondois2021-10-081-0/+184
| | | | | | | | | | | Add AmlCodeGenMethod() to generate code for a control method. AmlCodeGenMethod ("MET0", 1, TRUE, 3, ParentNode, NewObjectNode) is equivalent of the following ASL code: Method(MET0, 1, Serialized, 3) {} Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
* DynamicTablesPkg: AML code generation for a ResourceTemplatePierre Gondois2021-10-081-0/+190
| | | | | | | | | | | | | | | ASL provides a ResourceTemplate macro that creates a Buffer in which resource descriptor macros can be listed. The ResourceTemplate macro automatically generates an End descriptor and calculates the checksum for the resource template. Therefore, add AmlCodeGenResourceTemplate() to generate AML code for the ResourceTemplate() macro. This function generates a Buffer node with an EndTag resource data descriptor, which is similar to the ASL ResourceTemplate() macro. Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
* DynamicTablesPkg: Helper function to compute package lengthPierre Gondois2021-10-082-2/+132
| | | | | | | | | | | | | | | Some AML object have a PkgLen which indicates the size of the AML object. The package length can be encoded in 1 to 4 bytes. The bytes used to encode the PkgLen is itself counted in the PkgLen value. So, if an AML object's size increments/decrements, the number of bytes used to encode the PkgLen value can itself increment/decrement. Therefore, a helper function AmlComputePkgLength() is introduced to simply computation of the PkgLen. Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
* DynamicTablesPkg: AML code generation for a PackagePierre Gondois2021-10-081-1/+80
| | | | | | | | | | Add AmlCodeGenPackage() to generate AML code for declaring a Package() object. This function generates an empty package node. New elements can then be added to the package's variable argument list. Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
* DynamicTablesPkg: AML Code generation for Resource data EndTagPierre Gondois2021-10-082-0/+156
| | | | | | | | | | | | | Add a helper function AmlCodeGenEndTag() to generate AML Resource Data EndTag. The EndTag resource data is automatically generated by the ASL compiler at the end of a list of resource data elements. Therefore, an equivalent function is not present in ASL. However, AmlCodeGenEndTag() is useful when generating AML code for the ResourceTemplate() macro. Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
* DynamicTablesPkg: AML Code generation for Register()Pierre Gondois2021-10-082-0/+136
| | | | | | | | | Add AmlCodeGenRegister() to generate AML code for the Generic Register Resource Descriptor. This function is equivalent to the ASL macro Register(). Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
* DynamicTablesPkg: Make AmlNodeGetIntegerValue publicPierre Gondois2021-10-082-3/+18
| | | | | | | | | | Remove the STATIC qualifier for the AmlUtility function AmlNodeGetIntegerValue() and add the definition to the header file so that it can be used by other AmlLib sub-modules. Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
* DynamicTablesPkg: Update error handling for node creationPierre Gondois2021-10-082-7/+1
| | | | | | | | | | | | | The node creation functions: - AmlCreateRootNode() - AmlCreateObjectNode() - AmlCreateDataNode() are now resetting the input pointer where the created node is stored. Thus, it is not necessary to set some local variables to NULL or check a node value before trying to delete it. Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
* DynamicTablesPkg: Clear pointer in node creation fctsPierre Gondois2021-10-084-10/+40
| | | | | | | | | | | | | | | | | The following functions: - AmlCreateRootNode() - AmlCreateObjectNode() - AmlCreateDataNode() create a node and return it by populating a pointer. This pointer should only be considered/used if the function returns successfully. Otherwise, the value stored in this pointer should be ignored. For their error handling, some other functions assume that this pointer is reset to NULL if an error occurs during a node creation. To make this assumption correct, explicitly clear this input pointer. Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>