2 * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
4 * SPDX-License-Identifier: BSD-3-Clause
8 * If a platform wishes to use the functions in this file it has to be added to
9 * the Makefile of the platform. It is not included in the common Makefile.
12 #include <asm_macros.S>
13 #include <drivers/console.h>
15 .globl plat_crash_console_init
16 .globl plat_crash_console_putc
17 .globl plat_crash_console_flush
19 /* -----------------------------------------------------
20 * int plat_crash_console_init(void)
21 * Use normal console by default. Switch it to crash
22 * mode so serial consoles become active again.
23 * NOTE: This default implementation will only work for
24 * crashes that occur after a normal console (marked
25 * valid for the crash state) has been registered with
26 * the console framework. To debug crashes that occur
27 * earlier, the platform has to override these functions
28 * with an implementation that initializes a console
29 * driver with hardcoded parameters. See
30 * docs/porting-guide.rst for more information.
31 * -----------------------------------------------------
33 func plat_crash_console_init
34 #if defined(IMAGE_BL1)
36 * BL1 code can possibly crash so early that the data segment is not yet
37 * accessible. Don't risk undefined behavior by trying to run the normal
38 * console framework. Platforms that want to debug BL1 will need to
39 * override this with custom functions that can run from registers only.
45 mov r0, #CONSOLE_FLAG_CRASH
46 bl console_switch_state
50 endfunc plat_crash_console_init
52 /* -----------------------------------------------------
53 * void plat_crash_console_putc(int character)
54 * Output through the normal console by default.
55 * -----------------------------------------------------
57 func plat_crash_console_putc
59 endfunc plat_crash_console_putc
61 /* -----------------------------------------------------
62 * void plat_crash_console_flush(void)
63 * Flush normal console by default.
64 * -----------------------------------------------------
66 func plat_crash_console_flush
68 endfunc plat_crash_console_flush