[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v9 12/30] pcnet: add bootindex to qom property
From: |
arei.gonglei |
Subject: |
[Qemu-devel] [PATCH v9 12/30] pcnet: add bootindex to qom property |
Date: |
Wed, 10 Sep 2014 20:31:08 +0800 |
From: Gonglei <address@hidden>
Add a qom property with the same name 'bootindex',
when we remove it form qdev property, things will
continue to work just fine, and we can use qom features
which are not supported by qdev property.
Signed-off-by: Gonglei <address@hidden>
---
hw/net/lance.c | 12 ++++++++++++
hw/net/pcnet-pci.c | 12 ++++++++++++
hw/net/pcnet.h | 1 -
3 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/hw/net/lance.c b/hw/net/lance.c
index 7811a9e..a1c49f1 100644
--- a/hw/net/lance.c
+++ b/hw/net/lance.c
@@ -42,6 +42,7 @@
#include "hw/sparc/sun4m.h"
#include "pcnet.h"
#include "trace.h"
+#include "sysemu/sysemu.h"
#define TYPE_LANCE "lance"
#define SYSBUS_PCNET(obj) \
@@ -143,6 +144,16 @@ static void lance_reset(DeviceState *dev)
pcnet_h_reset(&d->state);
}
+static void lance_instance_init(Object *obj)
+{
+ SysBusPCNetState *d = SYSBUS_PCNET(obj);
+ PCNetState *s = &d->state;
+
+ device_add_bootindex_property(obj, &s->conf.bootindex,
+ "bootindex", "/address@hidden",
+ DEVICE(obj), NULL);
+}
+
static Property lance_properties[] = {
DEFINE_PROP_PTR("dma", SysBusPCNetState, state.dma_opaque),
DEFINE_NIC_PROPERTIES(SysBusPCNetState, state.conf),
@@ -169,6 +180,7 @@ static const TypeInfo lance_info = {
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(SysBusPCNetState),
.class_init = lance_class_init,
+ .instance_init = lance_instance_init,
};
static void lance_register_types(void)
diff --git a/hw/net/pcnet-pci.c b/hw/net/pcnet-pci.c
index 50ffe91..fb5f5d6 100644
--- a/hw/net/pcnet-pci.c
+++ b/hw/net/pcnet-pci.c
@@ -32,6 +32,7 @@
#include "hw/loader.h"
#include "qemu/timer.h"
#include "sysemu/dma.h"
+#include "sysemu/sysemu.h"
#include "pcnet.h"
@@ -344,6 +345,16 @@ static void pci_reset(DeviceState *dev)
pcnet_h_reset(&d->state);
}
+static void pcnet_instance_init(Object *obj)
+{
+ PCIPCNetState *d = PCI_PCNET(obj);
+ PCNetState *s = &d->state;
+
+ device_add_bootindex_property(obj, &s->conf.bootindex,
+ "bootindex", "/address@hidden",
+ DEVICE(obj), NULL);
+}
+
static Property pcnet_properties[] = {
DEFINE_NIC_PROPERTIES(PCIPCNetState, state.conf),
DEFINE_PROP_END_OF_LIST(),
@@ -372,6 +383,7 @@ static const TypeInfo pcnet_info = {
.parent = TYPE_PCI_DEVICE,
.instance_size = sizeof(PCIPCNetState),
.class_init = pcnet_class_init,
+ .instance_init = pcnet_instance_init,
};
static void pci_pcnet_register_types(void)
diff --git a/hw/net/pcnet.h b/hw/net/pcnet.h
index 9dee6f3..f8e8a6f 100644
--- a/hw/net/pcnet.h
+++ b/hw/net/pcnet.h
@@ -66,5 +66,4 @@ void pcnet_set_link_status(NetClientState *nc);
void pcnet_common_cleanup(PCNetState *d);
int pcnet_common_init(DeviceState *dev, PCNetState *s, NetClientInfo *info);
extern const VMStateDescription vmstate_pcnet;
-
#endif
--
1.7.12.4
- [Qemu-devel] [PATCH v9 00/30] modify boot order of guest, and take effect after rebooting, arei.gonglei, 2014/09/10
- [Qemu-devel] [PATCH v9 02/30] bootindex: add check bootindex function, arei.gonglei, 2014/09/10
- [Qemu-devel] [PATCH v9 03/30] bootindex: add del_boot_device_path function, arei.gonglei, 2014/09/10
- [Qemu-devel] [PATCH v9 01/30] bootdevice: move bootdevice related code to new file bootdevice.c, arei.gonglei, 2014/09/10
- [Qemu-devel] [PATCH v9 06/30] bootindex: support to set a existent device's bootindex to -1, arei.gonglei, 2014/09/10
- [Qemu-devel] [PATCH v9 07/30] bootindex: add a setter/getter functions wrapper for bootindex property, arei.gonglei, 2014/09/10
- [Qemu-devel] [PATCH v9 05/30] bootindex: rework add_boot_device_path function, arei.gonglei, 2014/09/10
- [Qemu-devel] [PATCH v9 08/30] virtio-net: add bootindex to qom property, arei.gonglei, 2014/09/10
- [Qemu-devel] [PATCH v9 04/30] fw_cfg: add fw_cfg_machine_reset function, arei.gonglei, 2014/09/10
- [Qemu-devel] [PATCH v9 12/30] pcnet: add bootindex to qom property,
arei.gonglei <=
- [Qemu-devel] [PATCH v9 13/30] rtl8139: add bootindex to qom property, arei.gonglei, 2014/09/10
- [Qemu-devel] [PATCH v9 14/30] spapr_lian: add bootindex to qom property, arei.gonglei, 2014/09/10
- [Qemu-devel] [PATCH v9 10/30] eepro100: add bootindex to qom property, arei.gonglei, 2014/09/10
- [Qemu-devel] [PATCH v9 15/30] vmxnet3: add bootindex to qom property, arei.gonglei, 2014/09/10
- [Qemu-devel] [PATCH v9 09/30] e1000: add bootindex to qom property, arei.gonglei, 2014/09/10
- [Qemu-devel] [PATCH v9 18/30] virtio-net: alias bootindex property explicitly for virt-net-pci/ccw/s390, arei.gonglei, 2014/09/10
- [Qemu-devel] [PATCH v9 17/30] net: remove bootindex property from qdev to qom, arei.gonglei, 2014/09/10
- [Qemu-devel] [PATCH v9 16/30] usb-net: add bootindex to qom property, arei.gonglei, 2014/09/10
- [Qemu-devel] [PATCH v9 20/30] pci-assign: remove bootindex property from qdev to qom, arei.gonglei, 2014/09/10
- [Qemu-devel] [PATCH v9 19/30] host-libusb: remove bootindex property from qdev to qom, arei.gonglei, 2014/09/10