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>
This commit is contained in:
parent
40f27a785f
commit
0068b069c3
@ -298,12 +298,6 @@ static char *sysbus_get_fw_dev_path(DeviceState *dev)
|
||||
return g_strdup(qdev_fw_name(dev));
|
||||
}
|
||||
|
||||
void sysbus_add_io(SysBusDevice *dev, hwaddr addr,
|
||||
MemoryRegion *mem)
|
||||
{
|
||||
memory_region_add_subregion(get_system_io(), addr, mem);
|
||||
}
|
||||
|
||||
MemoryRegion *sysbus_address_space(SysBusDevice *dev)
|
||||
{
|
||||
return get_system_memory();
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "sysemu/hw_accel.h"
|
||||
#include "sysemu/kvm.h"
|
||||
#include "sysemu/runstate.h"
|
||||
#include "exec/address-spaces.h"
|
||||
#include "hw/i386/apic_internal.h"
|
||||
#include "hw/sysbus.h"
|
||||
#include "hw/boards.h"
|
||||
@ -727,7 +728,7 @@ static void vapic_realize(DeviceState *dev, Error **errp)
|
||||
VAPICROMState *s = VAPIC(dev);
|
||||
|
||||
memory_region_init_io(&s->io, OBJECT(s), &vapic_ops, s, "kvmvapic", 2);
|
||||
sysbus_add_io(sbd, VAPIC_IO_PORT, &s->io);
|
||||
memory_region_add_subregion(get_system_io(), VAPIC_IO_PORT, &s->io);
|
||||
sysbus_init_ioports(sbd, VAPIC_IO_PORT, 2);
|
||||
|
||||
option_rom[nb_option_roms].name = "kvmvapic.bin";
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "qemu/osdep.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qemu/datadir.h"
|
||||
#include "exec/address-spaces.h"
|
||||
#include "hw/clock.h"
|
||||
#include "hw/mips/mips.h"
|
||||
#include "hw/char/serial.h"
|
||||
@ -226,7 +227,7 @@ mips_mipssim_init(MachineState *machine)
|
||||
qdev_prop_set_uint8(dev, "endianness", DEVICE_LITTLE_ENDIAN);
|
||||
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
|
||||
sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, env->irq[4]);
|
||||
sysbus_add_io(SYS_BUS_DEVICE(dev), 0x3f8,
|
||||
memory_region_add_subregion(get_system_io(), 0x3f8,
|
||||
sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0));
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -83,8 +83,6 @@ void sysbus_mmio_map(SysBusDevice *dev, int n, hwaddr addr);
|
||||
void sysbus_mmio_map_overlap(SysBusDevice *dev, int n, hwaddr addr,
|
||||
int priority);
|
||||
void sysbus_mmio_unmap(SysBusDevice *dev, int n);
|
||||
void sysbus_add_io(SysBusDevice *dev, hwaddr addr,
|
||||
MemoryRegion *mem);
|
||||
MemoryRegion *sysbus_address_space(SysBusDevice *dev);
|
||||
|
||||
bool sysbus_realize(SysBusDevice *dev, Error **errp);
|
||||
|
Loading…
Reference in New Issue
Block a user