2021-09-12 15:56:09 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
|
|
|
|
|
|
|
#include <debug_uart.h>
|
|
|
|
#include <asm/sbi.h>
|
|
|
|
|
2023-09-04 11:24:04 +00:00
|
|
|
#ifdef CONFIG_SBI_V01
|
|
|
|
|
2021-09-12 15:56:09 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2023-09-04 11:24:04 +00:00
|
|
|
#else
|
|
|
|
|
|
|
|
static int sbi_dbcn_available;
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2021-09-12 15:56:09 +00:00
|
|
|
DEBUG_UART_FUNCS
|