mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-08-23 23:41:19 +02:00
The old API is deprecated and will eventually be removed. Arm platforms now use the multi console driver for boot and runtime consoles. However, the crash console uses the direct console API because it doesn't need any memory access to work. This makes it more robust during crashes. The AArch32 port of the Trusted Firmware doesn't support this new API yet, so it is only enabled in AArch64 builds. Because of this, the common code must maintain compatibility with both systems. SP_MIN doesn't have to be updated because it's only used in AArch32 builds. The TSP is only used in AArch64, so it only needs to support the new API without keeping support for the old one. Special care must be taken because of PSCI_SYSTEM_SUSPEND. In Juno, this causes the UARTs to reset (except for the one used by the TSP). This means that they must be unregistered when suspending and re-registered when resuming. This wasn't a problem with the old driver because it just restarted the UART, and there were no problems associated with registering and unregistering consoles. The size reserved for BL2 has been increased. Change-Id: Icefd117dd1eb9c498921181a21318c2d2435c441 Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
86 lines
2.1 KiB
C
86 lines
2.1 KiB
C
/*
|
|
* Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
#include <assert.h>
|
|
#include <console.h>
|
|
#include <debug.h>
|
|
#include <pl011.h>
|
|
#include <plat_arm.h>
|
|
#include <platform_def.h>
|
|
|
|
/*******************************************************************************
|
|
* Functions that set up the console
|
|
******************************************************************************/
|
|
#if MULTI_CONSOLE_API
|
|
static console_pl011_t arm_boot_console;
|
|
static console_pl011_t arm_runtime_console;
|
|
#endif
|
|
|
|
/* Initialize the console to provide early debug support */
|
|
void arm_console_boot_init(void)
|
|
{
|
|
#if MULTI_CONSOLE_API
|
|
int rc = console_pl011_register(PLAT_ARM_BOOT_UART_BASE,
|
|
PLAT_ARM_BOOT_UART_CLK_IN_HZ,
|
|
ARM_CONSOLE_BAUDRATE,
|
|
&arm_boot_console);
|
|
if (rc == 0) {
|
|
/*
|
|
* The crash console doesn't use the multi console API, it uses
|
|
* the core console functions directly. It is safe to call panic
|
|
* and let it print debug information.
|
|
*/
|
|
panic();
|
|
}
|
|
|
|
console_set_scope(&arm_boot_console.console, CONSOLE_FLAG_BOOT);
|
|
#else
|
|
(void)console_init(PLAT_ARM_BOOT_UART_BASE,
|
|
PLAT_ARM_BOOT_UART_CLK_IN_HZ,
|
|
ARM_CONSOLE_BAUDRATE);
|
|
#endif /* MULTI_CONSOLE_API */
|
|
}
|
|
|
|
void arm_console_boot_end(void)
|
|
{
|
|
(void)console_flush();
|
|
|
|
#if MULTI_CONSOLE_API
|
|
(void)console_unregister(&arm_boot_console.console);
|
|
#else
|
|
console_uninit();
|
|
#endif /* MULTI_CONSOLE_API */
|
|
}
|
|
|
|
/* Initialize the runtime console */
|
|
void arm_console_runtime_init(void)
|
|
{
|
|
#if MULTI_CONSOLE_API
|
|
int rc = console_pl011_register(PLAT_ARM_BL31_RUN_UART_BASE,
|
|
PLAT_ARM_BL31_RUN_UART_CLK_IN_HZ,
|
|
ARM_CONSOLE_BAUDRATE,
|
|
&arm_runtime_console);
|
|
if (rc == 0)
|
|
panic();
|
|
|
|
console_set_scope(&arm_runtime_console.console, CONSOLE_FLAG_RUNTIME);
|
|
#else
|
|
(void)console_init(PLAT_ARM_BL31_RUN_UART_BASE,
|
|
PLAT_ARM_BL31_RUN_UART_CLK_IN_HZ,
|
|
ARM_CONSOLE_BAUDRATE);
|
|
#endif /* MULTI_CONSOLE_API */
|
|
}
|
|
|
|
void arm_console_runtime_end(void)
|
|
{
|
|
(void)console_flush();
|
|
|
|
#if MULTI_CONSOLE_API
|
|
(void)console_unregister(&arm_runtime_console.console);
|
|
#else
|
|
console_uninit();
|
|
#endif /* MULTI_CONSOLE_API */
|
|
}
|