summaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
authorGleb Natapov <gleb@redhat.com>2010-12-08 13:35:09 +0200
committerBlue Swirl <blauwirbel@gmail.com>2010-12-11 21:32:48 +0000
commit962630f207a33b7de4316022884b5241e05491cd (patch)
tree456f98659094302366c6caa495b2511cd69b647b /vl.c
parent4cab946a4adc3094a846dd3c7ea104abe7bdc5f1 (diff)
downloadqemu-962630f207a33b7de4316022884b5241e05491cd.tar.gz
Pass boot device list to firmware.
Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/vl.c b/vl.c
index 0d20d26180..c4d3fc0d3d 100644
--- a/vl.c
+++ b/vl.c
@@ -736,6 +736,54 @@ void add_boot_device_path(int32_t bootindex, DeviceState *dev,
QTAILQ_INSERT_TAIL(&fw_boot_order, node, link);
}
+/*
+ * This function returns null terminated string that consist of new line
+ * separated device pathes.
+ *
+ * memory pointed by "size" is assigned total length of the array in bytes
+ *
+ */
+char *get_boot_devices_list(uint32_t *size)
+{
+ FWBootEntry *i;
+ uint32_t total = 0;
+ char *list = NULL;
+
+ QTAILQ_FOREACH(i, &fw_boot_order, link) {
+ char *devpath = NULL, *bootpath;
+ int len;
+
+ if (i->dev) {
+ devpath = qdev_get_fw_dev_path(i->dev);
+ assert(devpath);
+ }
+
+ if (i->suffix && devpath) {
+ bootpath = qemu_malloc(strlen(devpath) + strlen(i->suffix) + 1);
+ sprintf(bootpath, "%s%s", devpath, i->suffix);
+ qemu_free(devpath);
+ } else if (devpath) {
+ bootpath = devpath;
+ } else {
+ bootpath = strdup(i->suffix);
+ assert(bootpath);
+ }
+
+ if (total) {
+ list[total-1] = '\n';
+ }
+ len = strlen(bootpath) + 1;
+ list = qemu_realloc(list, total + len);
+ memcpy(&list[total], bootpath, len);
+ total += len;
+ qemu_free(bootpath);
+ }
+
+ *size = total;
+
+ return list;
+}
+
static void numa_add(const char *optarg)
{
char option[128];