aboutsummaryrefslogtreecommitdiff
path: root/hw/qdev.c
diff options
context:
space:
mode:
authorGleb Natapov <gleb@redhat.com>2010-12-08 13:35:05 +0200
committerBlue Swirl <blauwirbel@gmail.com>2010-12-11 21:32:46 +0000
commit1ca4d09ae0bcc2fdd6aeef0fdc11f82394f7e757 (patch)
tree6ce3a2ba2b2f643935d12ca9765ec6e4847ca4a4 /hw/qdev.c
parentdb07c0f84ba2bedea4b8201ccb62602fd5e64c28 (diff)
Add bootindex parameter to net/block/fd device
If bootindex is specified on command line a string that describes device in firmware readable way is added into sorted list. Later this list will be passed into firmware to control boot order. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'hw/qdev.c')
-rw-r--r--hw/qdev.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/hw/qdev.c b/hw/qdev.c
index b65b63e10e..10e28df7a1 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -889,3 +889,35 @@ int do_device_del(Monitor *mon, const QDict *qdict, QObject **ret_data)
}
return qdev_unplug(dev);
}
+
+static int qdev_get_fw_dev_path_helper(DeviceState *dev, char *p, int size)
+{
+ int l = 0;
+
+ if (dev && dev->parent_bus) {
+ char *d;
+ l = qdev_get_fw_dev_path_helper(dev->parent_bus->parent, p, size);
+ if (dev->parent_bus->info->get_fw_dev_path) {
+ d = dev->parent_bus->info->get_fw_dev_path(dev);
+ l += snprintf(p + l, size - l, "%s", d);
+ qemu_free(d);
+ } else {
+ l += snprintf(p + l, size - l, "%s", dev->info->name);
+ }
+ }
+ l += snprintf(p + l , size - l, "/");
+
+ return l;
+}
+
+char* qdev_get_fw_dev_path(DeviceState *dev)
+{
+ char path[128];
+ int l;
+
+ l = qdev_get_fw_dev_path_helper(dev, path, 128);
+
+ path[l-1] = '\0';
+
+ return strdup(path);
+}