From a467e813a362fae69484e70ecb26fd8b14489d38 Mon Sep 17 00:00:00 2001 From: Prasad Kummari Date: Wed, 20 Sep 2023 10:12:41 +0530 Subject: [PATCH] feat(versal-net): retrieval of console information from dtb Introduces functionality to retrieve console information from the device tree (DTB) and use it in TF-A code. Comparing early console information and the data populated from the DTB. In case of a mistmatch, the changes takes care of unregistering the build time console configuration and registering the DTB-based console. Reorganizes the console configuration setup in BL31 by moving it to a dedicated function called setup_console() in the plat_console.c file. This change improves code readability by isolating console- related settings, making it easier to manage and extend the console configuration in the future. Signed-off-by: Prasad Kummari Change-Id: I7b6ebad0e91133ab5fbda8f3a8663abfb6dd2458 --- .../xilinx/versal_net/bl31_versal_net_setup.c | 31 ++----------------- plat/xilinx/versal_net/platform.mk | 2 ++ 2 files changed, 4 insertions(+), 29 deletions(-) diff --git a/plat/xilinx/versal_net/bl31_versal_net_setup.c b/plat/xilinx/versal_net/bl31_versal_net_setup.c index 7e877a4a5..08f79deae 100644 --- a/plat/xilinx/versal_net/bl31_versal_net_setup.c +++ b/plat/xilinx/versal_net/bl31_versal_net_setup.c @@ -12,13 +12,11 @@ #include #include #include -#include -#include -#include #include #include #include #include +#include #include #include @@ -69,13 +67,11 @@ static inline void bl31_set_default_config(void) void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1, u_register_t arg2, u_register_t arg3) { - int32_t rc; #if !(TFA_NO_PM) uint64_t tfa_handoff_addr, buff[HANDOFF_PARAMS_MAX_SIZE] = {0}; uint32_t payload[PAYLOAD_ARG_CNT], max_size = HANDOFF_PARAMS_MAX_SIZE; enum pm_ret_status ret_status; #endif /* !(TFA_NO_PM) */ - uint32_t uart_clk = get_uart_clk(); board_detection(); @@ -97,30 +93,7 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1, panic(); } - if (CONSOLE_IS(pl011_0) || CONSOLE_IS(pl011_1)) { - static console_t versal_net_runtime_console; - - /* Initialize the console to provide early debug support */ - rc = console_pl011_register(UART_BASE, uart_clk, - UART_BAUDRATE, - &versal_net_runtime_console); - if (rc == 0) { - panic(); - } - - console_set_scope(&versal_net_runtime_console, CONSOLE_FLAG_BOOT | - CONSOLE_FLAG_RUNTIME | CONSOLE_FLAG_CRASH); - } else if (CONSOLE_IS(dcc)) { - /* Initialize the dcc console for debug. - * dcc is over jtag and does not configures uart0 or uart1. - */ - rc = console_dcc_register(); - if (rc == 0) { - panic(); - } - } else { - /* No console device found. */ - } + setup_console(); NOTICE("TF-A running on %s %d.%d\n", board_name_decode(), platform_version / 10U, platform_version % 10U); diff --git a/plat/xilinx/versal_net/platform.mk b/plat/xilinx/versal_net/platform.mk index 9fa16fdee..fb229bb45 100644 --- a/plat/xilinx/versal_net/platform.mk +++ b/plat/xilinx/versal_net/platform.mk @@ -108,12 +108,14 @@ BL31_SOURCES += ${PLAT_PATH}/plat_psci.c endif BL31_SOURCES += plat/xilinx/common/plat_fdt.c \ plat/xilinx/common/plat_startup.c \ + plat/xilinx/common/plat_console.c \ plat/xilinx/common/ipi.c \ plat/xilinx/common/ipi_mailbox_service/ipi_mailbox_svc.c \ plat/xilinx/common/versal.c \ ${PLAT_PATH}/bl31_versal_net_setup.c \ ${PLAT_PATH}/plat_topology.c \ common/fdt_fixup.c \ + common/fdt_wrappers.c \ ${LIBFDT_SRCS} \ ${PLAT_PATH}/sip_svc_setup.c \ ${PLAT_PATH}/versal_net_gicv3.c \