X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=bootdevice.c;h=1d225202f9726e536d3466a28a6eaa5a8304a41b;hb=2d49bacda00876736c746ce1fcea006a128bef6b;hp=c3a010c09448afbb366bc3cc398a7032efd7a59a;hpb=2559db069628981bfdc90637fac5bf1b4f4e8ef5;p=mirror_qemu.git diff --git a/bootdevice.c b/bootdevice.c index c3a010c094..1d225202f9 100644 --- a/bootdevice.c +++ b/bootdevice.c @@ -1,7 +1,7 @@ /* * QEMU Boot Device Implement * - * Copyright (c) 2014 HUAWEI TECHNOLOGIES CO.,LTD. + * Copyright (c) 2014 HUAWEI TECHNOLOGIES CO., LTD. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -22,10 +22,14 @@ * THE SOFTWARE. */ +#include "qemu/osdep.h" +#include "qapi/error.h" #include "sysemu/sysemu.h" #include "qapi/visitor.h" #include "qemu/error-report.h" -#include "hw/hw.h" +#include "sysemu/reset.h" +#include "hw/qdev-core.h" +#include "hw/boards.h" typedef struct FWBootEntry FWBootEntry; @@ -105,7 +109,9 @@ void restore_boot_order(void *opaque) return; } - qemu_boot_set(normal_boot_order, NULL); + if (boot_set_handler) { + qemu_boot_set(normal_boot_order, &error_abort); + } qemu_unregister_reset(restore_boot_order, normal_boot_order); g_free(normal_boot_order); @@ -203,11 +209,13 @@ DeviceState *get_boot_device(uint32_t position) * memory pointed by "size" is assigned total length of the array in bytes * */ -char *get_boot_devices_list(size_t *size, bool ignore_suffixes) +char *get_boot_devices_list(size_t *size) { FWBootEntry *i; size_t total = 0; char *list = NULL; + MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine()); + bool ignore_suffixes = mc->ignore_boot_device_suffixes; QTAILQ_FOREACH(i, &fw_boot_order, link) { char *devpath = NULL, *suffix = NULL; @@ -221,10 +229,15 @@ char *get_boot_devices_list(size_t *size, bool ignore_suffixes) } if (!ignore_suffixes) { - d = qdev_get_own_fw_dev_path_from_handler(i->dev->parent_bus, i->dev); - if (d) { - assert(!i->suffix); - suffix = d; + if (i->dev) { + d = qdev_get_own_fw_dev_path_from_handler(i->dev->parent_bus, + i->dev); + if (d) { + assert(!i->suffix); + suffix = d; + } else { + suffix = g_strdup(i->suffix); + } } else { suffix = g_strdup(i->suffix); } @@ -263,21 +276,21 @@ typedef struct { DeviceState *dev; } BootIndexProperty; -static void device_get_bootindex(Object *obj, Visitor *v, void *opaque, - const char *name, Error **errp) +static void device_get_bootindex(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) { BootIndexProperty *prop = opaque; - visit_type_int32(v, prop->bootindex, name, errp); + visit_type_int32(v, name, prop->bootindex, errp); } -static void device_set_bootindex(Object *obj, Visitor *v, void *opaque, - const char *name, Error **errp) +static void device_set_bootindex(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) { BootIndexProperty *prop = opaque; int32_t boot_index; Error *local_err = NULL; - visit_type_int32(v, &boot_index, name, &local_err); + visit_type_int32(v, name, &boot_index, &local_err); if (local_err) { goto out; } @@ -292,9 +305,7 @@ static void device_set_bootindex(Object *obj, Visitor *v, void *opaque, add_boot_device_path(*prop->bootindex, prop->dev, prop->suffix); out: - if (local_err) { - error_propagate(errp, local_err); - } + error_propagate(errp, local_err); } static void property_release_bootindex(Object *obj, const char *name,