lib: utils/sys: Allow custom HTIF base address for RV32
PATCH 1/1 lib: utils/sys: Allow custom HTIF base address for RV32
commit 6dde43584f18 ("lib: utils/sys: Extend HTIF library to allow custom base address") forgot to update do_tohost_fromhost() codes for RV32, which still
accesses the HTIF registers using the ELF symbol address directly.
---
lib/utils/sys/htif.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
lib/utils/sys/htif.c +2 -2
@@ -135,11 +135,11 @@ static void do_tohost_fromhost(uint64_t dev, uint64_t cmd, uint64_t data)__set_tohost (HTIF_DEV_SYSTEM , cmd, data);while (1 ) { -uint64_t fh = fromhost; +uint64_t fh =__read_fromhost ();if (fh) {if (FROMHOST_DEV (fh) ==HTIF_DEV_SYSTEM &&FROMHOST_CMD (fh) == cmd) { - fromhost =0 ; +__write_fromhost (0 );break ; }__check_fromhost ();
Signature · 1 line
2.34.1
PATCH 1/1 lib: utils/sys: Allow custom HTIF base address for RV32
Quoted 7 lines · Bin Meng
commit
6dde43584f18("lib: utils/sys: Extend HTIF library to allow custom base address") forgot to updatedo_tohost_fromhost()codes for RV32, which still
accesses the HTIF registers using the ELF symbol address directly.Fixes 6dde43584f18 ("lib: utils/sys: Extend HTIF library to allow custom base address")Signed-off-by Bin Meng <[email protected]>---
With this patch, "qemu-system-riscv32 -M spike -bios fw_payload.bin -nographic" now displays OpenSBI output in the terminal
Quoted 22 lines
lib/utils/sys/htif.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)lib/utils/sys/htif.c +2
-2@@ -135,11 +135,11 @@ static void do_tohost_fromhost(uint64_t dev, uint64_t cmd, uint64_t data)__set_tohost (HTIF_DEV_SYSTEM , cmd, data);while (1 ) { -uint64_t fh = fromhost; +uint64_t fh =__read_fromhost ();if (fh) {if (FROMHOST_DEV (fh) ==HTIF_DEV_SYSTEM &&FROMHOST_CMD (fh) == cmd) { - fromhost =0 ; +__write_fromhost (0 );break ; }__check_fromhost ();
Anup Patel
AppliedPATCH 1/1 lib: utils/sys: Allow custom HTIF base address for RV32
In reply to Bin MengQuoted 7 lines · Bin Meng
commit
6dde43584f18("lib: utils/sys: Extend HTIF library to allow custom base address") forgot to updatedo_tohost_fromhost()codes for RV32, which still
accesses the HTIF registers using the ELF symbol address directly.Fixes 6dde43584f18 ("lib: utils/sys: Extend HTIF library to allow custom base address")Signed-off-by Bin Meng <[email protected]>
Looks good to me.
Applied this patch to the riscv/opensbi repo.
Thanks,
Anup
Quoted 26 lines
---
lib/utils/sys/htif.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)lib/utils/sys/htif.c +2
-3@@ -135,11 +135,11 @@ static void do_tohost_fromhost(uint64_t dev, uint64_t cmd, uint64_t data)__set_tohost (HTIF_DEV_SYSTEM , cmd, data);while (1 ) { -uint64_t fh = fromhost; +uint64_t fh =__read_fromhost ();if (fh) {if (FROMHOST_DEV (fh) ==HTIF_DEV_SYSTEM &&FROMHOST_CMD (fh) == cmd) { - fromhost =0 ; +__write_fromhost (0 );break ; }__check_fromhost (); --2.34.1