aboutsummaryrefslogtreecommitdiff
path: root/hw/syborg_virtio.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2011-12-05 08:43:38 -0600
committerAnthony Liguori <aliguori@us.ibm.com>2011-12-05 08:43:38 -0600
commit01e7a53aed945adafc3ee54e2159227839daf0b4 (patch)
tree992b5c4a38316289ed5b2fa6ddf486cb3d59bead /hw/syborg_virtio.c
parent4eb2d2d900eb6f63cad2b5cb6ca4273bfb9b230c (diff)
parentf44336c594c7e7887ee43ece3b53ba68b827fd1d (diff)
Merge remote-tracking branch 'qemu-kvm/memory/batch' into staging
Diffstat (limited to 'hw/syborg_virtio.c')
-rw-r--r--hw/syborg_virtio.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/hw/syborg_virtio.c b/hw/syborg_virtio.c
index 6de952c938..96a0ee651f 100644
--- a/hw/syborg_virtio.c
+++ b/hw/syborg_virtio.c
@@ -62,6 +62,7 @@ enum {
typedef struct {
SysBusDevice busdev;
VirtIODevice *vdev;
+ MemoryRegion iomem;
qemu_irq irq;
uint32_t int_enable;
uint32_t id;
@@ -221,16 +222,12 @@ static void syborg_virtio_writeb(void *opaque, target_phys_addr_t offset,
BADF("Bad byte write offset 0x%x\n", (int)offset);
}
-static CPUReadMemoryFunc * const syborg_virtio_readfn[] = {
- syborg_virtio_readb,
- syborg_virtio_readw,
- syborg_virtio_readl
-};
-
-static CPUWriteMemoryFunc * const syborg_virtio_writefn[] = {
- syborg_virtio_writeb,
- syborg_virtio_writew,
- syborg_virtio_writel
+static const MemoryRegionOps syborg_virtio_ops = {
+ .old_mmio = {
+ .read = { syborg_virtio_readb, syborg_virtio_readw, syborg_virtio_readl },
+ .write = { syborg_virtio_writeb, syborg_virtio_writew, syborg_virtio_writel },
+ },
+ .endianness = DEVICE_NATIVE_ENDIAN,
};
static void syborg_virtio_update_irq(void *opaque, uint16_t vector)
@@ -256,17 +253,14 @@ static VirtIOBindings syborg_virtio_bindings = {
static int syborg_virtio_init(SyborgVirtIOProxy *proxy, VirtIODevice *vdev)
{
- int iomemtype;
-
proxy->vdev = vdev;
/* Don't support multiple vectors */
proxy->vdev->nvectors = 0;
sysbus_init_irq(&proxy->busdev, &proxy->irq);
- iomemtype = cpu_register_io_memory(syborg_virtio_readfn,
- syborg_virtio_writefn, proxy,
- DEVICE_NATIVE_ENDIAN);
- sysbus_init_mmio(&proxy->busdev, 0x1000, iomemtype);
+ memory_region_init_io(&proxy->iomem, &syborg_virtio_ops, proxy,
+ "virtio", 0x1000);
+ sysbus_init_mmio(&proxy->busdev, &proxy->iomem);
proxy->id = ((uint32_t)0x1af4 << 16) | vdev->device_id;