]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
risc-v: implement DBCN write byte
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Mon, 4 Sep 2023 11:24:03 +0000 (13:24 +0200)
committerLeo Yu-Chi Liang <ycliang@andestech.com>
Tue, 5 Sep 2023 02:53:55 +0000 (10:53 +0800)
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>
arch/riscv/include/asm/sbi.h
arch/riscv/lib/sbi.c

index 009a26885c6ff1138bf6fbe17b650f24a497b61d..bf4c9af6220216b21db3ef061a02c7fe5d35722a 100644 (file)
@@ -170,5 +170,6 @@ int sbi_get_mvendorid(long *mvendorid);
 int sbi_get_marchid(long *marchid);
 int sbi_get_mimpid(long *mimpid);
 void sbi_srst_reset(unsigned long type, unsigned long reason);
+int sbi_dbcn_write_byte(unsigned char ch);
 
 #endif
index 8724e3a4600fca93fda445f48194c575b274c19e..55a3bc3b5c9d47ab0bfaccc813bdc36a815a76d5 100644 (file)
@@ -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
 
 /**