Prasad Kummari | b72494e | 2023-09-19 22:15:05 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2023, Advanced Micro Devices, Inc. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #include <assert.h> |
| 8 | #include <errno.h> |
| 9 | #include <stdlib.h> |
| 10 | #include <string.h> |
| 11 | |
| 12 | #include <common/debug.h> |
| 13 | #include <common/fdt_fixup.h> |
| 14 | #include <common/fdt_wrappers.h> |
| 15 | #include <drivers/arm/dcc.h> |
| 16 | #include <drivers/arm/pl011.h> |
| 17 | #include <drivers/cadence/cdns_uart.h> |
| 18 | #include <drivers/console.h> |
| 19 | #include <libfdt.h> |
| 20 | #include <plat_console.h> |
Prasad Kummari | 5eafc83 | 2023-11-03 16:47:26 +0530 | [diff] [blame] | 21 | #include <plat_fdt.h> |
Prasad Kummari | b72494e | 2023-09-19 22:15:05 +0530 | [diff] [blame] | 22 | |
| 23 | #include <platform_def.h> |
| 24 | #include <plat_private.h> |
| 25 | |
Prasad Kummari | a1b9b45 | 2024-03-07 15:28:11 +0530 | [diff] [blame] | 26 | static console_t boot_console; |
Maheedhar Bollapalli | 6775ec4 | 2024-03-19 22:19:28 +0530 | [diff] [blame^] | 27 | static console_holder boot_hd_console; |
| 28 | #if defined(CONSOLE_RUNTIME) |
| 29 | static console_t runtime_console; |
| 30 | static console_holder rt_hd_console; |
| 31 | #endif |
Prasad Kummari | b72494e | 2023-09-19 22:15:05 +0530 | [diff] [blame] | 32 | |
Maheedhar Bollapalli | 6775ec4 | 2024-03-19 22:19:28 +0530 | [diff] [blame^] | 33 | #if ((CONSOLE_IS(dtb) || RT_CONSOLE_IS(dtb)) && defined(XILINX_OF_BOARD_DTB_ADDR)) && \ |
Prasad Kummari | 3ded36f | 2024-03-18 10:14:31 +0530 | [diff] [blame] | 34 | (!defined(PLAT_zynqmp) || (defined(PLAT_zynqmp) && \ |
Maheedhar Bollapalli | 6775ec4 | 2024-03-19 22:19:28 +0530 | [diff] [blame^] | 35 | !IS_TFA_IN_OCM(BL31_BASE))) |
| 36 | static dt_uart_info_t dt_uart_info; |
| 37 | #endif |
| 38 | |
Prasad Kummari | 80232f7 | 2024-03-14 15:19:10 +0530 | [diff] [blame] | 39 | /** |
Maheedhar Bollapalli | 6775ec4 | 2024-03-19 22:19:28 +0530 | [diff] [blame^] | 40 | * register_console() - Registers the uart with console list. |
| 41 | * @consoleh: Console holder structure with UART base address, |
| 42 | * UART clock, UART buad rate, flags & console type |
Prasad Kummari | 80232f7 | 2024-03-14 15:19:10 +0530 | [diff] [blame] | 43 | * @console: Pointer to the console information structure. |
Prasad Kummari | 80232f7 | 2024-03-14 15:19:10 +0530 | [diff] [blame] | 44 | */ |
Maheedhar Bollapalli | 6775ec4 | 2024-03-19 22:19:28 +0530 | [diff] [blame^] | 45 | static void register_console(const console_holder *consoleh, console_t *console) |
Prasad Kummari | 80232f7 | 2024-03-14 15:19:10 +0530 | [diff] [blame] | 46 | { |
| 47 | int32_t rc = 0; |
| 48 | |
Maheedhar Bollapalli | 6775ec4 | 2024-03-19 22:19:28 +0530 | [diff] [blame^] | 49 | switch (consoleh->console_type) { |
Prasad Kummari | 80232f7 | 2024-03-14 15:19:10 +0530 | [diff] [blame] | 50 | #if defined(PLAT_zynqmp) |
Maheedhar Bollapalli | 6775ec4 | 2024-03-19 22:19:28 +0530 | [diff] [blame^] | 51 | case CONSOLE_CDNS: |
| 52 | rc = console_cdns_register(consoleh->base, |
| 53 | consoleh->clk, |
| 54 | consoleh->baud_rate, |
Prasad Kummari | 80232f7 | 2024-03-14 15:19:10 +0530 | [diff] [blame] | 55 | console); |
Maheedhar Bollapalli | 6775ec4 | 2024-03-19 22:19:28 +0530 | [diff] [blame^] | 56 | break; |
| 57 | #else |
| 58 | case CONSOLE_PL011: |
| 59 | rc = console_pl011_register(consoleh->base, |
| 60 | consoleh->clk, |
| 61 | consoleh->baud_rate, |
Prasad Kummari | 80232f7 | 2024-03-14 15:19:10 +0530 | [diff] [blame] | 62 | console); |
Maheedhar Bollapalli | 6775ec4 | 2024-03-19 22:19:28 +0530 | [diff] [blame^] | 63 | break; |
Prasad Kummari | 80232f7 | 2024-03-14 15:19:10 +0530 | [diff] [blame] | 64 | #endif |
Maheedhar Bollapalli | 6775ec4 | 2024-03-19 22:19:28 +0530 | [diff] [blame^] | 65 | case CONSOLE_DCC: |
Prasad Kummari | 80232f7 | 2024-03-14 15:19:10 +0530 | [diff] [blame] | 66 | rc = console_dcc_register(console); |
Maheedhar Bollapalli | 6775ec4 | 2024-03-19 22:19:28 +0530 | [diff] [blame^] | 67 | break; |
| 68 | default: |
Prasad Kummari | 80232f7 | 2024-03-14 15:19:10 +0530 | [diff] [blame] | 69 | INFO("Invalid console type\n"); |
Maheedhar Bollapalli | 6775ec4 | 2024-03-19 22:19:28 +0530 | [diff] [blame^] | 70 | break; |
Prasad Kummari | 80232f7 | 2024-03-14 15:19:10 +0530 | [diff] [blame] | 71 | } |
| 72 | |
| 73 | if (rc == 0) { |
| 74 | panic(); |
| 75 | } |
| 76 | |
Maheedhar Bollapalli | 6775ec4 | 2024-03-19 22:19:28 +0530 | [diff] [blame^] | 77 | console_set_scope(console, consoleh->console_scope); |
Prasad Kummari | 80232f7 | 2024-03-14 15:19:10 +0530 | [diff] [blame] | 78 | } |
Prasad Kummari | 80232f7 | 2024-03-14 15:19:10 +0530 | [diff] [blame] | 79 | |
Maheedhar Bollapalli | 6775ec4 | 2024-03-19 22:19:28 +0530 | [diff] [blame^] | 80 | #if ((CONSOLE_IS(dtb) || RT_CONSOLE_IS(dtb)) && defined(XILINX_OF_BOARD_DTB_ADDR)) && \ |
Prasad Kummari | 3ded36f | 2024-03-18 10:14:31 +0530 | [diff] [blame] | 81 | (!defined(PLAT_zynqmp) || (defined(PLAT_zynqmp) && \ |
| 82 | !IS_TFA_IN_OCM(BL31_BASE))) |
Prasad Kummari | b72494e | 2023-09-19 22:15:05 +0530 | [diff] [blame] | 83 | /** |
| 84 | * get_baudrate() - Get the baudrate form DTB. |
| 85 | * @dtb: Address of the Device Tree Blob (DTB). |
| 86 | * |
| 87 | * Return: On success returns the baudrate; on failure returns an error. |
| 88 | */ |
| 89 | static int32_t get_baudrate(void *dtb) |
| 90 | { |
| 91 | int node; |
| 92 | int32_t ret = 0; |
| 93 | const char *prop, *path; |
| 94 | char *end; |
| 95 | int32_t baud_rate = 0; |
| 96 | |
| 97 | node = fdt_path_offset(dtb, "/secure-chosen"); |
| 98 | if (node < 0) { |
| 99 | node = fdt_path_offset(dtb, "/chosen"); |
| 100 | if (node < 0) { |
| 101 | ret = -FDT_ERR_NOTFOUND; |
| 102 | goto error; |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | prop = fdt_getprop(dtb, node, "stdout-path", NULL); |
| 107 | if (prop == NULL) { |
| 108 | ret = -FDT_ERR_NOTFOUND; |
| 109 | goto error; |
| 110 | } |
| 111 | |
| 112 | /* Parse string serial0:115200n8 */ |
| 113 | path = strchr(prop, ':'); |
| 114 | if (!path) { |
| 115 | ret = -FDT_ERR_NOTFOUND; |
| 116 | goto error; |
| 117 | } else { |
| 118 | |
| 119 | baud_rate = strtoul(path + 1, &end, 10); |
| 120 | if (baud_rate == 0 && end == path) { |
| 121 | ERROR("Conversion error occurred: %d\n", baud_rate); |
| 122 | ret = -FDT_ERR_NOTFOUND; |
| 123 | goto error; |
| 124 | } |
| 125 | ret = baud_rate; |
| 126 | } |
| 127 | |
| 128 | error: |
| 129 | return ret; |
| 130 | } |
| 131 | |
| 132 | /** |
| 133 | * get_node_status() - Get the DTB node status. |
| 134 | * @dtb: Address of the Device Tree Blob (DTB). |
| 135 | * @node: Node address in the device tree. |
| 136 | * |
| 137 | * Return: On success, it returns 1; on failure, it returns an 0. |
| 138 | */ |
| 139 | static uint32_t get_node_status(void *dtb, int node) |
| 140 | { |
| 141 | const char *status_cell; |
| 142 | uint32_t status = 0; |
| 143 | |
| 144 | status_cell = fdt_getprop(dtb, node, "status", NULL); |
| 145 | if (!status_cell || strcmp(status_cell, "okay") == 0) { |
| 146 | status = 1; |
| 147 | } else { |
| 148 | status = 0; |
| 149 | } |
| 150 | |
| 151 | return status; |
| 152 | } |
| 153 | |
| 154 | /** |
| 155 | * fdt_add_uart_info() - Add DTB information to a UART structure. |
| 156 | * @info: Pointer to the UART information structure. |
| 157 | * @node: Node address in the device tree. |
| 158 | * @dtb: Address of the Device Tree Blob(DTB). |
| 159 | * |
Maheedhar Bollapalli | 6775ec4 | 2024-03-19 22:19:28 +0530 | [diff] [blame^] | 160 | * Return: On success, it returns 0; on failure, it returns -1 or -FDT_ERR_NOTFOUND. |
Prasad Kummari | b72494e | 2023-09-19 22:15:05 +0530 | [diff] [blame] | 161 | */ |
Maheedhar Bollapalli | 6775ec4 | 2024-03-19 22:19:28 +0530 | [diff] [blame^] | 162 | static int32_t fdt_add_uart_info(dt_uart_info_t *info, int node, void *dtb) |
Prasad Kummari | b72494e | 2023-09-19 22:15:05 +0530 | [diff] [blame] | 163 | { |
| 164 | uintptr_t base_addr; |
| 165 | const char *com; |
Prasad Kummari | 4e5ebe5 | 2023-11-08 16:50:03 +0530 | [diff] [blame] | 166 | int32_t ret = 0; |
Maheedhar Bollapalli | 6775ec4 | 2024-03-19 22:19:28 +0530 | [diff] [blame^] | 167 | uint32_t status; |
Prasad Kummari | b72494e | 2023-09-19 22:15:05 +0530 | [diff] [blame] | 168 | |
| 169 | com = fdt_getprop(dtb, node, "compatible", NULL); |
| 170 | if (com != NULL) { |
| 171 | strlcpy(info->compatible, com, sizeof(info->compatible)); |
| 172 | } else { |
| 173 | ERROR("Compatible property not found in DTB node\n"); |
Maheedhar Bollapalli | 6775ec4 | 2024-03-19 22:19:28 +0530 | [diff] [blame^] | 174 | ret = -FDT_ERR_NOTFOUND; |
Prasad Kummari | b72494e | 2023-09-19 22:15:05 +0530 | [diff] [blame] | 175 | goto error; |
| 176 | } |
| 177 | |
Maheedhar Bollapalli | 6775ec4 | 2024-03-19 22:19:28 +0530 | [diff] [blame^] | 178 | status = get_node_status(dtb, node); |
| 179 | if (status == 0) { |
Prasad Kummari | c143b57 | 2024-03-08 14:26:25 +0530 | [diff] [blame] | 180 | ERROR("Uart node is disabled in DTB\n"); |
Maheedhar Bollapalli | 6775ec4 | 2024-03-19 22:19:28 +0530 | [diff] [blame^] | 181 | ret = -FDT_ERR_NOTFOUND; |
Prasad Kummari | b72494e | 2023-09-19 22:15:05 +0530 | [diff] [blame] | 182 | goto error; |
| 183 | } |
| 184 | |
Prasad Kummari | c143b57 | 2024-03-08 14:26:25 +0530 | [diff] [blame] | 185 | if (strncmp(info->compatible, DT_UART_DCC_COMPAT, strlen(DT_UART_DCC_COMPAT)) != 0) { |
| 186 | ret = fdt_get_reg_props_by_index(dtb, node, 0, &base_addr, NULL); |
| 187 | if (ret >= 0) { |
| 188 | info->base = base_addr; |
| 189 | } else { |
| 190 | ERROR("Failed to retrieve base address. Error code: %d\n", ret); |
Maheedhar Bollapalli | 6775ec4 | 2024-03-19 22:19:28 +0530 | [diff] [blame^] | 191 | ret = -FDT_ERR_NOTFOUND; |
Prasad Kummari | c143b57 | 2024-03-08 14:26:25 +0530 | [diff] [blame] | 192 | goto error; |
| 193 | } |
| 194 | |
| 195 | info->baud_rate = get_baudrate(dtb); |
Maheedhar Bollapalli | 6775ec4 | 2024-03-19 22:19:28 +0530 | [diff] [blame^] | 196 | |
| 197 | if (strncmp(info->compatible, DT_UART_CAD_COMPAT, |
| 198 | strlen(DT_UART_CAD_COMPAT)) == 0) { |
| 199 | info->console_type = CONSOLE_CDNS; |
| 200 | } else if (strncmp(info->compatible, DT_UART_PL011_COMPAT, |
| 201 | strlen(DT_UART_PL011_COMPAT)) == 0) { |
| 202 | info->console_type = CONSOLE_PL011; |
| 203 | } else { |
| 204 | ERROR("Incompatible uart node in DTB\n"); |
| 205 | ret = -FDT_ERR_NOTFOUND; |
| 206 | } |
| 207 | } else { |
| 208 | info->console_type = CONSOLE_DCC; |
Prasad Kummari | c143b57 | 2024-03-08 14:26:25 +0530 | [diff] [blame] | 209 | } |
Prasad Kummari | b72494e | 2023-09-19 22:15:05 +0530 | [diff] [blame] | 210 | |
| 211 | error: |
| 212 | return ret; |
| 213 | } |
| 214 | |
| 215 | /** |
| 216 | * fdt_get_uart_info() - Get the uart information form DTB. |
| 217 | * @info: Pointer to the UART information structure. |
| 218 | * |
| 219 | * Return: On success, it returns 0; on failure, it returns an error+reason. |
| 220 | */ |
| 221 | static int fdt_get_uart_info(dt_uart_info_t *info) |
| 222 | { |
Prasad Kummari | 4e5ebe5 | 2023-11-08 16:50:03 +0530 | [diff] [blame] | 223 | int node = 0, ret = 0; |
Prasad Kummari | b72494e | 2023-09-19 22:15:05 +0530 | [diff] [blame] | 224 | void *dtb = (void *)XILINX_OF_BOARD_DTB_ADDR; |
| 225 | |
Prasad Kummari | 5eafc83 | 2023-11-03 16:47:26 +0530 | [diff] [blame] | 226 | ret = is_valid_dtb(dtb); |
Prasad Kummari | b72494e | 2023-09-19 22:15:05 +0530 | [diff] [blame] | 227 | if (ret < 0) { |
| 228 | ERROR("Invalid Device Tree at %p: error %d\n", dtb, ret); |
Prasad Kummari | b72494e | 2023-09-19 22:15:05 +0530 | [diff] [blame] | 229 | goto error; |
| 230 | } |
| 231 | |
| 232 | node = fdt_get_stdout_node_offset(dtb); |
| 233 | if (node < 0) { |
| 234 | ERROR("DT get stdout node failed : %d\n", node); |
Prasad Kummari | b72494e | 2023-09-19 22:15:05 +0530 | [diff] [blame] | 235 | goto error; |
| 236 | } |
| 237 | |
| 238 | ret = fdt_add_uart_info(info, node, dtb); |
| 239 | if (ret < 0) { |
| 240 | ERROR("Failed to add DT UART info: %d\n", ret); |
Prasad Kummari | b72494e | 2023-09-19 22:15:05 +0530 | [diff] [blame] | 241 | goto error; |
| 242 | } |
| 243 | |
| 244 | error: |
| 245 | return ret; |
| 246 | } |
Maheedhar Bollapalli | 6775ec4 | 2024-03-19 22:19:28 +0530 | [diff] [blame^] | 247 | #endif |
Prasad Kummari | c143b57 | 2024-03-08 14:26:25 +0530 | [diff] [blame] | 248 | |
Maheedhar Bollapalli | 6775ec4 | 2024-03-19 22:19:28 +0530 | [diff] [blame^] | 249 | #if defined(CONSOLE_RUNTIME) |
Prasad Kummari | c143b57 | 2024-03-08 14:26:25 +0530 | [diff] [blame] | 250 | /** |
Maheedhar Bollapalli | 6775ec4 | 2024-03-19 22:19:28 +0530 | [diff] [blame^] | 251 | * get_rt_console() - Retrieves console data for runtime console. |
Prasad Kummari | b72494e | 2023-09-19 22:15:05 +0530 | [diff] [blame] | 252 | * |
Maheedhar Bollapalli | 6775ec4 | 2024-03-19 22:19:28 +0530 | [diff] [blame^] | 253 | * Return: returns 0 if consoles differ else returns 1 if |
| 254 | * dt node is disabled or consoles match. |
Prasad Kummari | b72494e | 2023-09-19 22:15:05 +0530 | [diff] [blame] | 255 | */ |
Maheedhar Bollapalli | 6775ec4 | 2024-03-19 22:19:28 +0530 | [diff] [blame^] | 256 | static uint32_t get_rt_console(void) |
Prasad Kummari | 80232f7 | 2024-03-14 15:19:10 +0530 | [diff] [blame] | 257 | { |
Maheedhar Bollapalli | 6775ec4 | 2024-03-19 22:19:28 +0530 | [diff] [blame^] | 258 | uint32_t rc = 0; |
Prasad Kummari | 80232f7 | 2024-03-14 15:19:10 +0530 | [diff] [blame] | 259 | |
| 260 | #if (RT_CONSOLE_IS(dtb) && defined(XILINX_OF_BOARD_DTB_ADDR)) && \ |
| 261 | (!defined(PLAT_zynqmp) || (defined(PLAT_zynqmp) && \ |
| 262 | !IS_TFA_IN_OCM(BL31_BASE))) |
Maheedhar Bollapalli | 6775ec4 | 2024-03-19 22:19:28 +0530 | [diff] [blame^] | 263 | /* DT based runtime console */ |
| 264 | if ((dt_uart_info.base != 0) && (dt_uart_info.status != 0)) { |
| 265 | rt_hd_console.base = dt_uart_info.base; |
| 266 | rt_hd_console.baud_rate = dt_uart_info.baud_rate; |
| 267 | rt_hd_console.console_state = dt_uart_info.status; |
| 268 | if (rt_hd_console.base == boot_console.base) { |
| 269 | rc = 1; |
| 270 | } |
Prasad Kummari | 80232f7 | 2024-03-14 15:19:10 +0530 | [diff] [blame] | 271 | } else { |
Maheedhar Bollapalli | 6775ec4 | 2024-03-19 22:19:28 +0530 | [diff] [blame^] | 272 | rc = 1; |
Prasad Kummari | 80232f7 | 2024-03-14 15:19:10 +0530 | [diff] [blame] | 273 | } |
| 274 | #else |
Maheedhar Bollapalli | 6775ec4 | 2024-03-19 22:19:28 +0530 | [diff] [blame^] | 275 | rt_hd_console.base = (uintptr_t)RT_UART_BASE; |
| 276 | rt_hd_console.baud_rate = (uint32_t)UART_BAUDRATE; |
| 277 | if (rt_hd_console.base != boot_console.base) { |
| 278 | rt_hd_console.console_state = 1; |
| 279 | } else { |
| 280 | rt_hd_console.console_state = 0; |
| 281 | rc = 1; |
Prasad Kummari | 80232f7 | 2024-03-14 15:19:10 +0530 | [diff] [blame] | 282 | } |
| 283 | #endif |
Maheedhar Bollapalli | 6775ec4 | 2024-03-19 22:19:28 +0530 | [diff] [blame^] | 284 | rt_hd_console.clk = get_uart_clk(); |
| 285 | rt_hd_console.console_type = RT_UART_TYPE; |
| 286 | rt_hd_console.console_scope = CONSOLE_FLAG_RUNTIME; |
| 287 | return rc; |
| 288 | } |
Prasad Kummari | 80232f7 | 2024-03-14 15:19:10 +0530 | [diff] [blame] | 289 | |
Maheedhar Bollapalli | 6775ec4 | 2024-03-19 22:19:28 +0530 | [diff] [blame^] | 290 | void console_runtime_init(void) |
| 291 | { |
| 292 | /* skip console registration if runtime and boot console are same */ |
| 293 | if (rt_hd_console.console_state) { |
| 294 | register_console(&rt_hd_console, &runtime_console); |
Prasad Kummari | 80232f7 | 2024-03-14 15:19:10 +0530 | [diff] [blame] | 295 | INFO("Successfully initialized runtime console\n"); |
| 296 | } |
Prasad Kummari | 80232f7 | 2024-03-14 15:19:10 +0530 | [diff] [blame] | 297 | } |
| 298 | #endif |
| 299 | |
Prasad Kummari | b72494e | 2023-09-19 22:15:05 +0530 | [diff] [blame] | 300 | void setup_console(void) |
| 301 | { |
Maheedhar Bollapalli | 6775ec4 | 2024-03-19 22:19:28 +0530 | [diff] [blame^] | 302 | /* This is hardcoded console setup just in case that DTB console fails */ |
| 303 | boot_hd_console.base = (uintptr_t)UART_BASE; |
| 304 | boot_hd_console.baud_rate = (uint32_t)UART_BAUDRATE; |
| 305 | boot_hd_console.console_state = 1; |
| 306 | boot_hd_console.clk = get_uart_clk(); |
| 307 | boot_hd_console.console_scope = CONSOLE_FLAG_BOOT | CONSOLE_FLAG_CRASH; |
| 308 | boot_hd_console.console_type = UART_TYPE; |
Prasad Kummari | b72494e | 2023-09-19 22:15:05 +0530 | [diff] [blame] | 309 | |
Maheedhar Bollapalli | 6775ec4 | 2024-03-19 22:19:28 +0530 | [diff] [blame^] | 310 | /* For DT code decoding uncomment console registration below */ |
| 311 | /* register_console(&boot_hd_console, &boot_console); */ |
| 312 | |
| 313 | #if ((CONSOLE_IS(dtb) || RT_CONSOLE_IS(dtb)) && defined(XILINX_OF_BOARD_DTB_ADDR)) && \ |
Prasad Kummari | 3ded36f | 2024-03-18 10:14:31 +0530 | [diff] [blame] | 314 | (!defined(PLAT_zynqmp) || (defined(PLAT_zynqmp) && \ |
| 315 | !IS_TFA_IN_OCM(BL31_BASE))) |
Maheedhar Bollapalli | 6775ec4 | 2024-03-19 22:19:28 +0530 | [diff] [blame^] | 316 | /* Parse DTB console for UART information */ |
| 317 | if (fdt_get_uart_info(&dt_uart_info) == 0) { |
| 318 | if (CONSOLE_IS(dtb)) { |
| 319 | boot_hd_console.base = dt_uart_info.base; |
| 320 | boot_hd_console.baud_rate = dt_uart_info.baud_rate; |
| 321 | boot_hd_console.console_type = dt_uart_info.console_type; |
| 322 | } |
Prasad Kummari | 3ded36f | 2024-03-18 10:14:31 +0530 | [diff] [blame] | 323 | } else { |
Maheedhar Bollapalli | 6775ec4 | 2024-03-19 22:19:28 +0530 | [diff] [blame^] | 324 | ERROR("Failed to initialize DT console or console node is disabled\n"); |
Prasad Kummari | 3ded36f | 2024-03-18 10:14:31 +0530 | [diff] [blame] | 325 | } |
| 326 | #endif |
| 327 | |
Maheedhar Bollapalli | 6775ec4 | 2024-03-19 22:19:28 +0530 | [diff] [blame^] | 328 | /* Initialize the boot console */ |
| 329 | register_console(&boot_hd_console, &boot_console); |
Prasad Kummari | b72494e | 2023-09-19 22:15:05 +0530 | [diff] [blame] | 330 | |
Maheedhar Bollapalli | 6775ec4 | 2024-03-19 22:19:28 +0530 | [diff] [blame^] | 331 | #ifdef CONSOLE_RUNTIME |
| 332 | int32_t rc; |
| 333 | uint32_t console_scope; |
Prasad Kummari | b72494e | 2023-09-19 22:15:05 +0530 | [diff] [blame] | 334 | |
Maheedhar Bollapalli | 6775ec4 | 2024-03-19 22:19:28 +0530 | [diff] [blame^] | 335 | rc = get_rt_console(); |
| 336 | if (rc) { |
| 337 | console_scope = CONSOLE_FLAG_BOOT | CONSOLE_FLAG_CRASH | CONSOLE_FLAG_RUNTIME; |
| 338 | console_set_scope(&boot_console, console_scope); |
Prasad Kummari | b72494e | 2023-09-19 22:15:05 +0530 | [diff] [blame] | 339 | } |
Prasad Kummari | b72494e | 2023-09-19 22:15:05 +0530 | [diff] [blame] | 340 | #endif |
Prasad Kummari | 3ded36f | 2024-03-18 10:14:31 +0530 | [diff] [blame] | 341 | INFO("BL31: Early console setup\n"); |
Prasad Kummari | b72494e | 2023-09-19 22:15:05 +0530 | [diff] [blame] | 342 | } |