mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-28 15:41:40 +00:00
25e7d4bf64
U-Boot SPL loads the device-tree directly behind main U-Boot overlapping
the .bss section. reserve_fdt() is called in board_init_f() to relocate the
device-tree to a safe location.
Debug UARTs are enabled before board_init_f(). With sbi_dbcn_available in
the .bss section the device-tree is corrupted when _debug_uart_init() is
called in the SBI serial driver. Move the variable to the .data section.
Link: https://bugs.launchpad.net/ubuntu/+source/u-boot/+bug/2054091
Fixes: dfe0837494
("risc-v: implement DBCN based debug console")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Tested-by: Aurelien Jarno <aurelien@aurel32.net>
Tested-by: Conor Dooley <conor.dooley@microchip.com>
36 lines
625 B
C
36 lines
625 B
C
// SPDX-License-Identifier: GPL-2.0+
|
|
|
|
#include <debug_uart.h>
|
|
#include <asm/sbi.h>
|
|
|
|
#ifdef CONFIG_SBI_V01
|
|
|
|
static inline void _debug_uart_init(void)
|
|
{
|
|
}
|
|
|
|
static inline void _debug_uart_putc(int c)
|
|
{
|
|
if (CONFIG_IS_ENABLED(RISCV_SMODE))
|
|
sbi_console_putchar(c);
|
|
}
|
|
|
|
#else
|
|
|
|
static int sbi_dbcn_available __section(".data");
|
|
|
|
static inline void _debug_uart_init(void)
|
|
{
|
|
if (CONFIG_IS_ENABLED(RISCV_SMODE))
|
|
sbi_dbcn_available = sbi_probe_extension(SBI_EXT_DBCN);
|
|
}
|
|
|
|
static inline void _debug_uart_putc(int ch)
|
|
{
|
|
if (CONFIG_IS_ENABLED(RISCV_SMODE) && sbi_dbcn_available)
|
|
sbi_dbcn_write_byte(ch);
|
|
}
|
|
|
|
#endif
|
|
|
|
DEBUG_UART_FUNCS
|