---
hw/device-hotplug.c | 43 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 43 insertions(+), 0 deletions(-)
diff --git a/hw/device-hotplug.c b/hw/device-hotplug.c
index c1a9a56..f311c7f 100644
--- a/hw/device-hotplug.c
+++ b/hw/device-hotplug.c
@@ -25,6 +25,9 @@
#include "hw.h"
#include "boards.h"
#include "net.h"
+#include "qemu-config.h"
+#include "sysemu.h"
+#include "monitor.h"
DriveInfo *add_init_drive(const char *optstr)
{
@@ -44,3 +47,43 @@ DriveInfo *add_init_drive(const char *optstr)
return dinfo;
}
+
+#if !defined(TARGET_I386)
+
+/*
+ * This version of drive_hot_add does not know anything about PCI specifics.
+ * It is used as fallback on architectures that don't implement pci-hotplug.
+ */
+void drive_hot_add(Monitor *mon, const QDict *qdict)
+{
+ int type;
+ DriveInfo *dinfo = NULL;
+ const char *opts = qdict_get_str(qdict, "opts");
+
+ dinfo = add_init_drive(opts);
+ if (!dinfo)
+ goto err;
+ if (dinfo->devaddr) {
+ monitor_printf(mon, "Parameter addr not supported\n");
+ goto err;
+ }
+ type = dinfo->type;
+
+ switch (type) {
+ case IF_NONE:
+ monitor_printf(mon, "OK\n");
+ break;
+ default:
+ monitor_printf(mon, "Can't hot-add drive to type %d\n", type);
+ goto err;
+ }
+ return;
+
+err:
+ if (dinfo)
+ drive_uninit(dinfo);
+ return;
+}
+
+#endif /* !defined(TARGET_I386) */
+