TYPE_PFLASH_CFI01 is a TYPE_SYS_BUS_DEVICE which registers its romd MemoryRegion with sysbus_init_mmio(), so we can use the generic sysbus_mmio_get_region() to get the region, no need for a specific pflash_cfi01_get_memory() helper.
Signed-off-by: Philippe Mathieu-Daudé <[email protected]> --- hw/xtensa/xtfpga.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/xtensa/xtfpga.c b/hw/xtensa/xtfpga.c index 7be53f1895b..1d15a9aae9f 100644 --- a/hw/xtensa/xtfpga.c +++ b/hw/xtensa/xtfpga.c @@ -460,10 +460,11 @@ static void xtfpga_init(const XtfpgaBoardDesc *board, MachineState *machine) } } else { if (flash) { - MemoryRegion *flash_mr = pflash_cfi01_get_memory(flash); + MemoryRegion *flash_mr; MemoryRegion *flash_io = g_malloc(sizeof(*flash_io)); uint32_t size = env->config->sysrom.location[0].size; + flash_mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(flash), 0); if (board->flash->size - board->flash->boot_base < size) { size = board->flash->size - board->flash->boot_base; } -- 2.26.2
