mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
hw/riscv: opentitan: Add the flash alias
OpenTitan has an alias of flash avaliable which is called virtual flash. Add support for that in the QEMU model. Signed-off-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Message-id: c9cfbd2dd840fd0076877b8ea4d6dcfce60db5e9.1625801868.git.alistair.francis@wdc.com
This commit is contained in:
parent
5ee257649f
commit
bb7e0cde3c
2 changed files with 8 additions and 0 deletions
|
@ -59,6 +59,7 @@ static const MemMapEntry ibex_memmap[] = {
|
||||||
[IBEX_DEV_NMI_GEN] = { 0x411c0000, 0x1000 },
|
[IBEX_DEV_NMI_GEN] = { 0x411c0000, 0x1000 },
|
||||||
[IBEX_DEV_OTBN] = { 0x411d0000, 0x10000 },
|
[IBEX_DEV_OTBN] = { 0x411d0000, 0x10000 },
|
||||||
[IBEX_DEV_PERI] = { 0x411f0000, 0x10000 },
|
[IBEX_DEV_PERI] = { 0x411f0000, 0x10000 },
|
||||||
|
[IBEX_DEV_FLASH_VIRTUAL] = { 0x80000000, 0x80000 },
|
||||||
};
|
};
|
||||||
|
|
||||||
static void opentitan_board_init(MachineState *machine)
|
static void opentitan_board_init(MachineState *machine)
|
||||||
|
@ -134,8 +135,13 @@ static void lowrisc_ibex_soc_realize(DeviceState *dev_soc, Error **errp)
|
||||||
/* Flash memory */
|
/* Flash memory */
|
||||||
memory_region_init_rom(&s->flash_mem, OBJECT(dev_soc), "riscv.lowrisc.ibex.flash",
|
memory_region_init_rom(&s->flash_mem, OBJECT(dev_soc), "riscv.lowrisc.ibex.flash",
|
||||||
memmap[IBEX_DEV_FLASH].size, &error_fatal);
|
memmap[IBEX_DEV_FLASH].size, &error_fatal);
|
||||||
|
memory_region_init_alias(&s->flash_alias, OBJECT(dev_soc),
|
||||||
|
"riscv.lowrisc.ibex.flash_virtual", &s->flash_mem, 0,
|
||||||
|
memmap[IBEX_DEV_FLASH_VIRTUAL].size);
|
||||||
memory_region_add_subregion(sys_mem, memmap[IBEX_DEV_FLASH].base,
|
memory_region_add_subregion(sys_mem, memmap[IBEX_DEV_FLASH].base,
|
||||||
&s->flash_mem);
|
&s->flash_mem);
|
||||||
|
memory_region_add_subregion(sys_mem, memmap[IBEX_DEV_FLASH_VIRTUAL].base,
|
||||||
|
&s->flash_alias);
|
||||||
|
|
||||||
/* PLIC */
|
/* PLIC */
|
||||||
if (!sysbus_realize(SYS_BUS_DEVICE(&s->plic), errp)) {
|
if (!sysbus_realize(SYS_BUS_DEVICE(&s->plic), errp)) {
|
||||||
|
|
|
@ -40,6 +40,7 @@ struct LowRISCIbexSoCState {
|
||||||
|
|
||||||
MemoryRegion flash_mem;
|
MemoryRegion flash_mem;
|
||||||
MemoryRegion rom;
|
MemoryRegion rom;
|
||||||
|
MemoryRegion flash_alias;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct OpenTitanState {
|
typedef struct OpenTitanState {
|
||||||
|
@ -54,6 +55,7 @@ enum {
|
||||||
IBEX_DEV_ROM,
|
IBEX_DEV_ROM,
|
||||||
IBEX_DEV_RAM,
|
IBEX_DEV_RAM,
|
||||||
IBEX_DEV_FLASH,
|
IBEX_DEV_FLASH,
|
||||||
|
IBEX_DEV_FLASH_VIRTUAL,
|
||||||
IBEX_DEV_UART,
|
IBEX_DEV_UART,
|
||||||
IBEX_DEV_GPIO,
|
IBEX_DEV_GPIO,
|
||||||
IBEX_DEV_SPI,
|
IBEX_DEV_SPI,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue