hw/char: riscv_htif: Move registers from CPUArchState to HTIFState

At present for some unknown reason the HTIF registers (fromhost &
tohost) are defined in the RISC-V CPUArchState. It should really
be put in the HTIFState struct as it is only meaningful to HTIF.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20221229091828.1945072-6-bmeng@tinylab.org>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
Bin Meng 2022-12-29 17:18:21 +08:00 committed by Alistair Francis
parent dadee9e3ce
commit 1237c2d694
5 changed files with 24 additions and 32 deletions

View file

@ -23,7 +23,6 @@
#include "chardev/char.h"
#include "chardev/char-fe.h"
#include "exec/memory.h"
#include "target/riscv/cpu.h"
#define TYPE_HTIF_UART "riscv.htif.uart"
@ -31,11 +30,12 @@ typedef struct HTIFState {
int allow_tohost;
int fromhost_inprogress;
uint64_t tohost;
uint64_t fromhost;
hwaddr tohost_offset;
hwaddr fromhost_offset;
MemoryRegion mmio;
CPURISCVState *env;
CharBackend chr;
uint64_t pending_read;
} HTIFState;
@ -51,7 +51,7 @@ void htif_symbol_callback(const char *st_name, int st_info, uint64_t st_value,
bool htif_uses_elf_symbols(void);
/* legacy pre qom */
HTIFState *htif_mm_init(MemoryRegion *address_space, CPURISCVState *env,
Chardev *chr, uint64_t nonelf_base);
HTIFState *htif_mm_init(MemoryRegion *address_space, Chardev *chr,
uint64_t nonelf_base);
#endif