summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSunil V L <sunilvl@ventanamicro.com>2025-09-12 15:27:08 +0300
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2025-12-02 23:52:41 +0300
commitd6748c514b1f04ecf4e4ed71bb41a159462cde77 (patch)
tree3aacbbbbd053e60adc7f63e3246fcedfd86d7d70
parent524e4c8a0586ef7ea874300c63a8fd8335bdafe3 (diff)
downloadedk2-d6748c514b1f04ecf4e4ed71bb41a159462cde77.tar.xz
DynamicTablesPkg/FdtHwInfoParserLib/Serial: RISC-V: Convert to GSI
In RISC-V, the GSI space is spread across multiple PLICs/APLICs. Hence, any device's IRQ number in the FDT should be appropriately converted to a GSI number based on its parent interrupt controller. Do this for UART parsing in RISC-V. Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/Serial/SerialPortParser.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Serial/SerialPortParser.c b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Serial/SerialPortParser.c
index 8a25d5b3f9..6a26effd13 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Serial/SerialPortParser.c
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Serial/SerialPortParser.c
@@ -182,6 +182,15 @@ SerialPortNodeParser (
SerialPortInfo->Interrupt = FdtGetInterruptId ((CONST UINT32 *)Data);
+ /*
+ * In RISC-V, GSI space can be divided among multiple APLIC/PLICs.
+ * So, convert the interrupt number in DT to appropriate GSI number
+ * using the parent interrupt controller information.
+ */
+ #if defined (MDE_CPU_RISCV64)
+ SerialPortInfo->Interrupt = FdtConvertToGsi (IntcNode, SerialPortInfo->Interrupt);
+ #endif
+
// Note: clock-frequency is optional for SBSA UART.
Data = FdtGetProp (Fdt, SerialPortNode, "clock-frequency", &DataSize);
if (Data != NULL) {