summaryrefslogtreecommitdiff
path: root/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/GenericTimer
AgeCommit message (Collapse)AuthorFilesLines
2026-09-11DynamicTablesPkg/HwInfoParser: Add FdtResolveInterrupt()Pierre Gondois1-70/+70
The Devicetree Specification [1] defines the concept of interrupt mapping, interrupt domain, interrupt nexus and interrupt controller. An interrupt property might need to be translated through an interrupt nexus to obtain the interrupt type, id, flags. Add a FdtResolveInterrupt() function, resolving an interrupt property through interrupt nexuses until reaching the interrupt-controller node. Make use of FdtResolveInterrupt() wherever relevant. This allows to handle the presence of interrupt nexus by default. [1] Spec. v0.4, s2.4 Interrupts and Interrupt Mapping Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-09-11DynamicTablesPkg/HwInfoParser: Add Size param to interrupt gettersPierre Gondois1-10/+10
Add a Size parameter to: - FdtGetInterruptId() - FdtGetInterruptFlags() This allows to check the size of the interrupt data to parse inside the later functions. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-09-11DynamicTablesPkg/HwInfoParser: Relax GetNodeInterruptCells()Pierre Gondois1-1/+1
FdtGetInterruptCellsInfo() expects to receive an interrupt controller node. However, a common use-case is to get the "#interrupt-cells" of a non interrupt-controller node in order to decode an "interrupts" property. Add a "SearchInHierarchy" parameter to FdtGetInterruptCellsInfo() to conditionnaly relax the function and either get the "#interrupt-cells" property: - from the input node - from the hierachy of the input node. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-09-11DynamicTablesPkg/HwInfoParser: Split FdtGetIntcParentNode()Pierre Gondois1-1/+1
The Devicetree Specification [1] defines the concept of interrupt mapping, interrupt domain, interrupt nexus and interrupt controller. The "interrupt-controller" property defines a node as an interrupt controller. The "interrupt-map" property defines a node as an interrupt nexus. Both node types are defined as the root of an interrupt domain. A GIC (Generic Interrupt Controller) is an interrupt controller. The GIC version should be fetched to the matching device tree node. A node defining an interrupt domain might not necessarily be an interrupt controller and contain this information. Introduce 2 functions: - FdtGetIntControllerNode() - FdtGetIntDomainNode()` to distinguish the 2 concepts. As the presence of interrupt nexus/domains is currently not supported, replace FdtGetIntcParentNode() calls with FdtGetIntControllerNode(). The distinction will be useful in following patches. Also, update the detection of an interrupt domain to the presence of one of these properties: - interrupt-controller - interrupt-map instead of relying on the presence of the #interrupt-cells property, which is not a guarantee. [1] Spec. v0.4, s2.4 Interrupts and Interrupt Mapping Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-09-11DynamicTablesPkg/HwInfoParser: Rename FdtGetIntcParentNodePierre Gondois1-2/+2
The interrupt parent of a node is: - the node pointed by the "interrupt-parent" property if the property is present - the direct parent otherwise. FdtGetIntcParentNode() doesn't aim to find the next parent node in the interrupt hierarchy. It aims to find the interrupt-controller node upon which the input node depends. This interrupt-controller node might be multiple nodes up in the device tree hierarchy. Thus, rename FdtGetIntcParentNode() to FdtGetIntcNode() to make the function name less ambiguous and prepare for the addition of a function which gets the next parent node in an interrupt hierarchy. No functional change. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2026-07-31DynamicTablesPkg: Support EL2 virtual timer in ArmGenericTimerParserMarc Zyngier2-32/+59
When edk2 runs as a kvmtool guest with nested virtualization enabled, the Arm architectural timer DT node contains five interrupt specifiers. The fifth interrupt describes the EL2 virtual timer. ArmGenericTimerParser currently expects exactly four timer interrupts. It therefore asserts when parsing the timer node generated for a nested virtualization guest. Determine the number of interrupt specifiers present in the DT and populate each architectural timer entry only when it is available. Add support for the EL2 virtual timer and use it to populate the VirtualPL2Timer fields in the generated GTDT information. Tested as a KVM guest at EL1 and EL2, with both E2H==0 and E2H==1. Signed-off-by: Marc Zyngier <maz@kernel.org> [Varshit Pandya: Rewrite commit message for clarity.] Ref: https://edk2.groups.io/g/devel/message/122008 Signed-off-by: Varshit Pandya <varshit.pandya@arm.com>
2026-02-24DynamicTablesPkg: Replace include guards with #pragma onceMichael Kubacki1-4/+1
Replace traditional `#ifndef`/`#define`/`#endif` include guards with `#pragma` once. `#pragma once` is a widely supported preprocessor directive that prevents header files from being included multiple times. It is supported by all toolchains used to build edk2: GCC, Clang/LLVM, and MSVC. Compared to macro-based include guards, `#pragma once`: - Eliminates the risk of macro name collisions or copy/paste errors where two headers inadvertently use the same guard macro. - Eliminate inconsistency in the way include guard macros are named (e.g., some files use `__FILE_H__`, others use `FILE_H_`, etc.). - Reduces boilerplate (three lines replaced by one). - Avoids polluting the macro namespace with guard symbols. - Can improve build times as the preprocessor can skip re-opening the file entirely, rather than re-reading it to find the matching `#endif` ("multiple-include optimization"). - Note that some compilers may already optimize traditional include guards, by recognzining the idiomatic pattern. This change is made acknowledging that overall portability of the code will technically be reduced, as `#pragma once` is not part of the C/C++ standards. However, this is considered acceptable given: 1. edk2 already defines a subset of supported compilers in BaseTools/Conf/tools_def.template, all of which have supported `#pragma once` for over two decades. 2. There have been concerns raised to the project about inconsistent include guard naming and potential macro collisions. Approximate compiler support dates: - MSVC: Supported since Visual C++ 4.2 (1996) - GCC: Supported since 3.4 (2004) (http://gnu.ist.utl.pt/software/gcc/gcc-3.4/changes.html) - Clang (LLVM based): Since initial release in 2007 Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2025-04-30ArmVirtPkg,DynamicTablesPkg,EmbeddedPkg,OvmfPkg: use MdePkg BaseFdtLibLeif Lindholm1-2/+3
Migrate these packages to use the up-to-date BaseFdtLib instead of the EmbeddedPkg relic that is going away. Continuous-integration-options: PatchCheck.ignore-multi-package Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
2024-09-27DynamicTablesPkg/FdtHwInfoParserLib: add missing resolutions/includesLeif Lindholm1-0/+1
FdtHwInfoParserLib does not explicitly call out its dependencies on BaseLib/BaseMemoryLib, which is currently hidden when EmbeddedPkg FdtLib pulls them in instead. But that is going away, so make the necessary explicit references and add missing include statements. Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
2024-07-29DynamicTablesPkg: FdtHwInfoParserLib: Move ARM parsers to Arm directoryPierre Gondois2-0/+324
Create an Arm directory in the FdtHwInfoParserLib as a preparation step to support other architectures. Suggested-by: Sunil V L <sunilvl@ventanamicro.com> Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>