diff options
Diffstat (limited to 'hw/sysbus.c')
-rw-r--r-- | hw/sysbus.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/hw/sysbus.c b/hw/sysbus.c index f8f1746658..1e57f0922a 100644 --- a/hw/sysbus.c +++ b/hw/sysbus.c @@ -53,6 +53,8 @@ void sysbus_mmio_map(SysBusDevice *dev, int n, target_phys_addr_t addr) if (dev->mmio[n].memory) { memory_region_del_subregion(get_system_memory(), dev->mmio[n].memory); + } else if (dev->mmio[n].unmap) { + dev->mmio[n].unmap(dev, dev->mmio[n].addr); } else { cpu_register_physical_memory(dev->mmio[n].addr, dev->mmio[n].size, IO_MEM_UNASSIGNED); @@ -117,6 +119,19 @@ void sysbus_init_mmio_cb(SysBusDevice *dev, target_phys_addr_t size, dev->mmio[n].cb = cb; } +void sysbus_init_mmio_cb2(SysBusDevice *dev, + mmio_mapfunc cb, mmio_mapfunc unmap) +{ + int n; + + assert(dev->num_mmio < QDEV_MAX_MMIO); + n = dev->num_mmio++; + dev->mmio[n].addr = -1; + dev->mmio[n].size = 0; + dev->mmio[n].cb = cb; + dev->mmio[n].unmap = unmap; +} + void sysbus_init_mmio_region(SysBusDevice *dev, MemoryRegion *memory) { int n; |