From 0791be881388c32c13b5ed9e79dc640aeefaaab4 Mon Sep 17 00:00:00 2001 From: Maheedhar Bollapalli Date: Wed, 5 Feb 2025 04:21:54 +0000 Subject: [PATCH] fix(xilinx): runtime console to handle dt failure If the Device Tree is missing or parsing fails in the runtime console, the console still gets registered with zeroed DT values, leading to a panic due to the absence of a console type. Added fallback option and check for zero base address. Change-Id: I5f5e0222685ba015ab7db2ecbd46d906f5ab9116 Signed-off-by: Maheedhar Bollapalli --- plat/xilinx/common/plat_console.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/plat/xilinx/common/plat_console.c b/plat/xilinx/common/plat_console.c index 2d478cdc8..617a34550 100644 --- a/plat/xilinx/common/plat_console.c +++ b/plat/xilinx/common/plat_console.c @@ -274,14 +274,16 @@ void setup_console(void) INFO("BL31: Early console setup\n"); #ifdef CONSOLE_RUNTIME -#if (RT_CONSOLE_IS(dtb) && (XLNX_DT_CFG == 1)) - rt_hd_console.base = dt_uart_info.base; - rt_hd_console.baud_rate = dt_uart_info.baud_rate; - rt_hd_console.console_type = dt_uart_info.console_type; -#else rt_hd_console.base = (uintptr_t)RT_UART_BASE; rt_hd_console.baud_rate = (uint32_t)UART_BAUDRATE; rt_hd_console.console_type = RT_UART_TYPE; + +#if (RT_CONSOLE_IS(dtb) && (XLNX_DT_CFG == 1)) + if (dt_uart_info.base != 0U) { + rt_hd_console.base = dt_uart_info.base; + rt_hd_console.baud_rate = dt_uart_info.baud_rate; + rt_hd_console.console_type = dt_uart_info.console_type; + } #endif if ((rt_hd_console.console_type == boot_hd_console.console_type) &&