[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v11 30/34] nvma: ide: add bootindex to qom property
From: |
arei.gonglei |
Subject: |
[Qemu-devel] [PATCH v11 30/34] nvma: ide: add bootindex to qom property |
Date: |
Tue, 7 Oct 2014 16:00:34 +0800 |
From: Gonglei <address@hidden>
At present, nvma cannot boot. However, it provides already
a bootindex property, so change bootindex to qom for nvma
device, but not call add_boot_device_path.
Signed-off-by: Gonglei <address@hidden>
---
hw/block/nvme.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/hw/block/nvme.c b/hw/block/nvme.c
index b010c9b..9a95f75 100644
--- a/hw/block/nvme.c
+++ b/hw/block/nvme.c
@@ -24,6 +24,8 @@
#include <hw/hw.h>
#include <hw/pci/msix.h>
#include <hw/pci/pci.h>
+#include "sysemu/sysemu.h"
+#include "qapi/visitor.h"
#include "nvme.h"
@@ -871,11 +873,53 @@ static void nvme_class_init(ObjectClass *oc, void *data)
dc->vmsd = &nvme_vmstate;
}
+static void nvme_get_bootindex(Object *obj, Visitor *v, void *opaque,
+ const char *name, Error **errp)
+{
+ NvmeCtrl *s = NVME(obj);
+
+ visit_type_int32(v, &s->conf.bootindex, name, errp);
+}
+
+static void nvme_set_bootindex(Object *obj, Visitor *v, void *opaque,
+ const char *name, Error **errp)
+{
+ NvmeCtrl *s = NVME(obj);
+ int32_t boot_index;
+ Error *local_err = NULL;
+
+ visit_type_int32(v, &boot_index, name, &local_err);
+ if (local_err) {
+ goto out;
+ }
+ /* check whether bootindex is present in fw_boot_order list */
+ check_boot_index(boot_index, &local_err);
+ if (local_err) {
+ goto out;
+ }
+ /* change bootindex to a new one */
+ s->conf.bootindex = boot_index;
+
+out:
+ if (local_err) {
+ error_propagate(errp, local_err);
+ }
+}
+
+static void nvme_instance_init(Object *obj)
+{
+ object_property_add(obj, "bootindex", "int32",
+ nvme_get_bootindex,
+ nvme_set_bootindex, NULL, NULL, NULL);
+ object_property_set_int(obj, -1, "bootindex", NULL);
+}
+
static const TypeInfo nvme_info = {
.name = "nvme",
.parent = TYPE_PCI_DEVICE,
.instance_size = sizeof(NvmeCtrl),
.class_init = nvme_class_init,
+ .instance_init = nvme_instance_init,
};
static void nvme_register_types(void)
--
1.7.12.4
- [Qemu-devel] [PATCH v11 18/34] virtio-net: alias bootindex property explicitly for virt-net-pci/ccw/s390, (continued)
- [Qemu-devel] [PATCH v11 18/34] virtio-net: alias bootindex property explicitly for virt-net-pci/ccw/s390, arei.gonglei, 2014/10/07
- [Qemu-devel] [PATCH v11 12/34] pcnet: add bootindex to qom property, arei.gonglei, 2014/10/07
- [Qemu-devel] [PATCH v11 19/34] host-libusb: remove bootindex property from qdev to qom, arei.gonglei, 2014/10/07
- [Qemu-devel] [PATCH v11 15/34] vmxnet3: add bootindex to qom property, arei.gonglei, 2014/10/07
- [Qemu-devel] [PATCH v11 01/34] bootdevice: move bootdevice related code to new file bootdevice.c, arei.gonglei, 2014/10/07
- [Qemu-devel] [PATCH v11 16/34] usb-net: add bootindex to qom property, arei.gonglei, 2014/10/07
- [Qemu-devel] [PATCH v11 31/34] ide: add calling add_boot_device_patch in bootindex setter function, arei.gonglei, 2014/10/07
- [Qemu-devel] [PATCH v11 09/34] e1000: add bootindex to qom property, arei.gonglei, 2014/10/07
- [Qemu-devel] [PATCH v11 06/34] bootindex: support to set a existent device's bootindex to -1, arei.gonglei, 2014/10/07
- [Qemu-devel] [PATCH v11 24/34] scsi: add bootindex to qom property, arei.gonglei, 2014/10/07
- [Qemu-devel] [PATCH v11 30/34] nvma: ide: add bootindex to qom property,
arei.gonglei <=
- [Qemu-devel] [PATCH v11 22/34] redirect: remove bootindex property from qdev to qom, arei.gonglei, 2014/10/07
- [Qemu-devel] [PATCH v11 21/34] vfio: remove bootindex property from qdev to qom, arei.gonglei, 2014/10/07
- [Qemu-devel] [PATCH v11 26/34] virtio-blk: add bootindex to qom property, arei.gonglei, 2014/10/07
- [Qemu-devel] [PATCH v11 33/34] bootindex: delete bootindex when device is removed, arei.gonglei, 2014/10/07
- [Qemu-devel] [PATCH v11 05/34] bootindex: rework add_boot_device_path function, arei.gonglei, 2014/10/07
- [Qemu-devel] [PATCH v11 04/34] fw_cfg: add fw_cfg_machine_reset function, arei.gonglei, 2014/10/07
- [Qemu-devel] [PATCH v11 17/34] net: remove bootindex property from qdev to qom, arei.gonglei, 2014/10/07