1 /* 2 * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #include <assert.h> 8 9 #include <platform_def.h> 10 11 #include <common/debug.h> 12 #include <drivers/arm/pl011.h> 13 #include <drivers/console.h> 14 #include <plat/arm/common/plat_arm.h> 15 16 /******************************************************************************* 17 * Functions that set up the console 18 ******************************************************************************/ 19 static console_t arm_boot_console; 20 static console_t arm_runtime_console; 21 22 /* Initialize the console to provide early debug support */ 23 void __init arm_console_boot_init(void) 24 { 25 int rc = console_pl011_register(PLAT_ARM_BOOT_UART_BASE, 26 PLAT_ARM_BOOT_UART_CLK_IN_HZ, 27 ARM_CONSOLE_BAUDRATE, 28 &arm_boot_console); 29 if (rc == 0) { 30 /* 31 * The crash console doesn't use the multi console API, it uses 32 * the core console functions directly. It is safe to call panic 33 * and let it print debug information. 34 */ 35 panic(); 36 } 37 38 console_set_scope(&arm_boot_console, CONSOLE_FLAG_BOOT); 39 } 40 41 void arm_console_boot_end(void) 42 { 43 (void)console_flush(); 44 (void)console_unregister(&arm_boot_console); 45 } 46 47 /* Initialize the runtime console */ 48 void arm_console_runtime_init(void) 49 { 50 int rc = console_pl011_register(PLAT_ARM_RUN_UART_BASE, 51 PLAT_ARM_RUN_UART_CLK_IN_HZ, 52 ARM_CONSOLE_BAUDRATE, 53 &arm_runtime_console); 54 if (rc == 0) 55 panic(); 56 57 console_set_scope(&arm_runtime_console, CONSOLE_FLAG_RUNTIME); 58 } 59 60 void arm_console_runtime_end(void) 61 { 62 (void)console_flush(); 63 } 64