aboutsummaryrefslogtreecommitdiff
path: root/hw/core/sysbus.c
diff options
context:
space:
mode:
authorCédric Le Goater <clg@kaod.org>2019-05-13 10:42:39 +0200
committerDavid Gibson <david@gibson.dropbear.id.au>2019-05-29 11:39:46 +1000
commit90c20e1e2ce0fb52975ff4d6590620ef0129790e (patch)
treebd7fb156517aa76a8542d0f17082e97870266cb2 /hw/core/sysbus.c
parent0dc9f5f8496a23da375a3b19556e265ba22478e0 (diff)
sysbus: add a sysbus_mmio_unmap() helper
This will be used to remove the MMIO regions of the POWER9 XIVE interrupt controller when the sPAPR machine is reseted. Signed-off-by: Cédric Le Goater <clg@kaod.org> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Message-Id: <20190513084245.25755-9-clg@kaod.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw/core/sysbus.c')
-rw-r--r--hw/core/sysbus.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c
index 307cf90a51..689a867a22 100644
--- a/hw/core/sysbus.c
+++ b/hw/core/sysbus.c
@@ -153,6 +153,16 @@ static void sysbus_mmio_map_common(SysBusDevice *dev, int n, hwaddr addr,
}
}
+void sysbus_mmio_unmap(SysBusDevice *dev, int n)
+{
+ assert(n >= 0 && n < dev->num_mmio);
+
+ if (dev->mmio[n].addr != (hwaddr)-1) {
+ memory_region_del_subregion(get_system_memory(), dev->mmio[n].memory);
+ dev->mmio[n].addr = (hwaddr)-1;
+ }
+}
+
void sysbus_mmio_map(SysBusDevice *dev, int n, hwaddr addr)
{
sysbus_mmio_map_common(dev, n, addr, false, 0);