summaryrefslogtreecommitdiffstats
path: root/hw/qdev.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/qdev.c')
-rw-r--r--hw/qdev.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/hw/qdev.c b/hw/qdev.c
index a97f425..a8de278 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -26,6 +26,7 @@
inherit from a particular bus (e.g. PCI or I2C) rather than
this API directly. */
+#include "net.h"
#include "qdev.h"
#include "sysemu.h"
@@ -135,6 +136,12 @@ void qdev_set_prop_ptr(DeviceState *dev, const char *name, void *value)
prop->value.ptr = value;
}
+void qdev_set_netdev(DeviceState *dev, NICInfo *nd)
+{
+ assert(!dev->nd);
+ dev->nd = nd;
+}
+
qemu_irq qdev_get_irq_sink(DeviceState *dev, int n)
{
@@ -225,6 +232,24 @@ void qdev_connect_gpio_out(DeviceState * dev, int n, qemu_irq pin)
dev->gpio_out[n] = pin;
}
+VLANClientState *qdev_get_vlan_client(DeviceState *dev,
+ IOReadHandler *fd_read,
+ IOCanRWHandler *fd_can_read,
+ NetCleanup *cleanup,
+ void *opaque)
+{
+ NICInfo *nd = dev->nd;
+ assert(nd);
+ return qemu_new_vlan_client(nd->vlan, nd->model, nd->name,
+ fd_read, fd_can_read, cleanup, opaque);
+}
+
+
+void qdev_get_macaddr(DeviceState *dev, uint8_t *macaddr)
+{
+ memcpy(macaddr, dev->nd->macaddr, 6);
+}
+
static int next_block_unit[IF_COUNT];
/* Get a block device. This should only be used for single-drive devices
OpenPOWER on IntegriCloud