aboutsummaryrefslogtreecommitdiff
path: root/hw/nvram/fw_cfg.c
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@linaro.org>2023-09-22 15:06:59 +0200
committerPhilippe Mathieu-Daudé <philmd@linaro.org>2024-02-22 12:47:40 +0100
commit0068b069c3ffb9ac8e5ad56bf0c9d853bbfc3997 (patch)
tree4f242f84e877c71bddfcd0e1eff66b88782b70ed /hw/nvram/fw_cfg.c
parent40f27a785f6b9d238f4b87c17c3ec8329dcde803 (diff)
downloadqemu-0068b069c3ffb9ac8e5ad56bf0c9d853bbfc3997.zip
qemu-0068b069c3ffb9ac8e5ad56bf0c9d853bbfc3997.tar.gz
qemu-0068b069c3ffb9ac8e5ad56bf0c9d853bbfc3997.tar.bz2
hw/sysbus: Inline and remove sysbus_add_io()
sysbus_add_io(...) is a simple wrapper to memory_region_add_subregion(get_system_io(), ...). It is used in 3 places; inline it directly. Rationale: we want to move to an explicit I/O bus, rather that an implicit one. Besides in heterogeneous setup we can have more than one I/O bus. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20240216150441.45681-1-philmd@linaro.org> [PMD: Include missing "exec/address-spaces.h" header] Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Diffstat (limited to 'hw/nvram/fw_cfg.c')
-rw-r--r--hw/nvram/fw_cfg.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
index e85493d..fc0263f 100644
--- a/hw/nvram/fw_cfg.c
+++ b/hw/nvram/fw_cfg.c
@@ -27,6 +27,7 @@
#include "sysemu/sysemu.h"
#include "sysemu/dma.h"
#include "sysemu/reset.h"
+#include "exec/address-spaces.h"
#include "hw/boards.h"
#include "hw/nvram/fw_cfg.h"
#include "hw/qdev-properties.h"
@@ -1142,6 +1143,7 @@ FWCfgState *fw_cfg_init_io_dma(uint32_t iobase, uint32_t dma_iobase,
SysBusDevice *sbd;
FWCfgIoState *ios;
FWCfgState *s;
+ MemoryRegion *iomem = get_system_io();
bool dma_requested = dma_iobase && dma_as;
dev = qdev_new(TYPE_FW_CFG_IO);
@@ -1155,7 +1157,7 @@ FWCfgState *fw_cfg_init_io_dma(uint32_t iobase, uint32_t dma_iobase,
sbd = SYS_BUS_DEVICE(dev);
sysbus_realize_and_unref(sbd, &error_fatal);
ios = FW_CFG_IO(dev);
- sysbus_add_io(sbd, iobase, &ios->comb_iomem);
+ memory_region_add_subregion(iomem, iobase, &ios->comb_iomem);
s = FW_CFG(dev);
@@ -1163,7 +1165,7 @@ FWCfgState *fw_cfg_init_io_dma(uint32_t iobase, uint32_t dma_iobase,
/* 64 bits for the address field */
s->dma_as = dma_as;
s->dma_addr = 0;
- sysbus_add_io(sbd, dma_iobase, &s->dma_iomem);
+ memory_region_add_subregion(iomem, dma_iobase, &s->dma_iomem);
}
return s;