diff options
author | Michalis Pappas <mpappas@fastmail.fm> | 2018-03-27 12:32:31 +0800 |
---|---|---|
committer | Michalis Pappas <mpappas@fastmail.fm> | 2018-03-31 16:26:18 +0800 |
commit | 0e24ea81564ef0444bd6e57f6dabc324284ec3b0 (patch) | |
tree | 06d5406ff41676377b0f7314251468eb06d564d2 /plat/qemu | |
parent | ba7848e283cd11326f60f3a3084c142875f3ec41 (diff) | |
download | trusted-firmware-a-0e24ea81564ef0444bd6e57f6dabc324284ec3b0.tar.gz |
qemu: don't use C functions for the crash console callbacks
Use the console_pl011_core_* functions directly in the crash console
callbacks.
This bypasses the MULTI_CONSOLE_API for the crash console (UART1), but
allows using the crash console before the C runtime has been initialized
(eg to call ASM_ASSERT). This retains backwards compatibility with respect
to functionality when the old API is used.
Use the MULTI_CONSOLE_API to register UART0 as the boot and runtime
console.
Fixes ARM-software/tf-issues#572
Signed-off-by: Michalis Pappas <mpappas@fastmail.fm>
Diffstat (limited to 'plat/qemu')
-rw-r--r-- | plat/qemu/aarch64/plat_helpers.S | 25 | ||||
-rw-r--r-- | plat/qemu/qemu_console.c | 16 | ||||
-rw-r--r-- | plat/qemu/qemu_private.h | 1 |
3 files changed, 22 insertions, 20 deletions
diff --git a/plat/qemu/aarch64/plat_helpers.S b/plat/qemu/aarch64/plat_helpers.S index ca5eec62fc..13a5ee461d 100644 --- a/plat/qemu/aarch64/plat_helpers.S +++ b/plat/qemu/aarch64/plat_helpers.S @@ -14,9 +14,8 @@ .globl platform_mem_init .globl plat_qemu_calc_core_pos .globl plat_crash_console_init -#if MULTI_CONSOLE_API .globl plat_crash_console_putc -#endif /* MULTI_CONSOLE_API */ + .globl plat_crash_console_flush .globl plat_secondary_cold_boot_setup .globl plat_get_my_entrypoint .globl plat_is_my_cpu_primary @@ -97,7 +96,10 @@ endfunc platform_mem_init * --------------------------------------------- */ func plat_crash_console_init - b qemu_crash_console_init + mov_imm x0, PLAT_QEMU_CRASH_UART_BASE + mov_imm x1, PLAT_QEMU_CRASH_UART_CLK_IN_HZ + mov_imm x2, PLAT_QEMU_CONSOLE_BAUDRATE + b console_pl011_core_init endfunc plat_crash_console_init /* --------------------------------------------- @@ -107,10 +109,21 @@ endfunc plat_crash_console_init * Clobber list : x1, x2 * --------------------------------------------- */ -#if !MULTI_CONSOLE_API func plat_crash_console_putc mov_imm x1, PLAT_QEMU_CRASH_UART_BASE - b console_core_putc + b console_pl011_core_putc endfunc plat_crash_console_putc -#endif /* MULTI_CONSOLE_API */ + + /* --------------------------------------------- + * int plat_crash_console_flush(int c) + * Function to force a write of all buffered + * data that hasn't been output. + * Out : return -1 on error else return 0. + * Clobber list : x0, x1 + * --------------------------------------------- + */ +func plat_crash_console_flush + mov_imm x0, PLAT_QEMU_CRASH_UART_BASE + b console_pl011_core_flush +endfunc plat_crash_console_flush diff --git a/plat/qemu/qemu_console.c b/plat/qemu/qemu_console.c index 1cf84aa78a..a90c9a18cc 100644 --- a/plat/qemu/qemu_console.c +++ b/plat/qemu/qemu_console.c @@ -9,7 +9,6 @@ #if MULTI_CONSOLE_API static console_pl011_t console; -static console_pl011_t crash_console; #endif /* MULTI_CONSOLE_API */ void qemu_console_init(void) @@ -18,6 +17,9 @@ void qemu_console_init(void) (void)console_pl011_register(PLAT_QEMU_BOOT_UART_BASE, PLAT_QEMU_BOOT_UART_CLK_IN_HZ, PLAT_QEMU_CONSOLE_BAUDRATE, &console); + + console_set_scope(&console.console, CONSOLE_FLAG_BOOT | + CONSOLE_FLAG_RUNTIME); #else console_init(PLAT_QEMU_BOOT_UART_BASE, PLAT_QEMU_BOOT_UART_CLK_IN_HZ, @@ -25,15 +27,3 @@ void qemu_console_init(void) #endif /* MULTI_CONSOLE_API */ } -void qemu_crash_console_init(void) -{ -#if MULTI_CONSOLE_API - (void)console_pl011_register(PLAT_QEMU_CRASH_UART_BASE, - PLAT_QEMU_CRASH_UART_CLK_IN_HZ, - PLAT_QEMU_CONSOLE_BAUDRATE, &crash_console); -#else - console_core_init(PLAT_QEMU_CRASH_UART_BASE, - PLAT_QEMU_CRASH_UART_CLK_IN_HZ, - PLAT_QEMU_CONSOLE_BAUDRATE); -#endif /* MULTI_CONSOLE_API */ -} diff --git a/plat/qemu/qemu_private.h b/plat/qemu/qemu_private.h index c66d0f9cd3..800fa037f7 100644 --- a/plat/qemu/qemu_private.h +++ b/plat/qemu/qemu_private.h @@ -35,6 +35,5 @@ int dt_add_psci_node(void *fdt); int dt_add_psci_cpu_enable_methods(void *fdt); void qemu_console_init(void); -void qemu_crash_console_init(void); #endif /*__QEMU_PRIVATE_H*/ |