|
@@ -273,10 +273,17 @@ out:
|
|
|
error_propagate(errp, local_err);
|
|
|
}
|
|
|
|
|
|
-void memory_device_plug_region(MachineState *ms, MemoryRegion *mr,
|
|
|
- uint64_t addr)
|
|
|
+void memory_device_plug(MemoryDeviceState *md, MachineState *ms)
|
|
|
{
|
|
|
- /* we expect a previous call to memory_device_get_free_addr() */
|
|
|
+ const MemoryDeviceClass *mdc = MEMORY_DEVICE_GET_CLASS(md);
|
|
|
+ const uint64_t addr = mdc->get_addr(md);
|
|
|
+ MemoryRegion *mr;
|
|
|
+
|
|
|
+ /*
|
|
|
+ * We expect that a previous call to memory_device_pre_plug() succeeded, so
|
|
|
+ * it can't fail at this point.
|
|
|
+ */
|
|
|
+ mr = mdc->get_memory_region(md, &error_abort);
|
|
|
g_assert(ms->device_memory);
|
|
|
|
|
|
memory_region_add_subregion(&ms->device_memory->mr,
|