aboutsummaryrefslogtreecommitdiff
path: root/arch/riscv/lib
diff options
context:
space:
mode:
authorHeinrich Schuchardt2023-09-04 13:24:03 +0200
committerLeo Yu-Chi Liang2023-09-05 10:53:55 +0800
commitd14222e7c152e36bf7d370c2623242a22fb9e821 (patch)
tree2c93ebf14147fc4eeefc9f48f16dddbf849df99b /arch/riscv/lib
parentef08687ea0e2b5d57a1df51e6613bc4263747943 (diff)
risc-v: implement DBCN write byte
The DBCN extension provides a Console Write Byte call. Implement function sbi_dbcn_write_byte to invoke it. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Diffstat (limited to 'arch/riscv/lib')
-rw-r--r--arch/riscv/lib/sbi.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/arch/riscv/lib/sbi.c b/arch/riscv/lib/sbi.c
index 8724e3a4600..55a3bc3b5c9 100644
--- a/arch/riscv/lib/sbi.c
+++ b/arch/riscv/lib/sbi.c
@@ -204,6 +204,22 @@ void sbi_srst_reset(unsigned long type, unsigned long reason)
0, 0, 0, 0);
}
+/**
+ * sbi_dbcn_write_byte() - write byte to debug console
+ *
+ * @ch: byte to be written
+ * Return: SBI error code (SBI_SUCCESS = 0 on success)
+ */
+int sbi_dbcn_write_byte(unsigned char ch)
+{
+ struct sbiret ret;
+
+ ret = sbi_ecall(SBI_EXT_DBCN,
+ SBI_EXT_DBCN_CONSOLE_WRITE_BYTE,
+ ch, 0, 0, 0, 0, 0);
+ return ret.error;
+}
+
#ifdef CONFIG_SBI_V01
/**