aboutsummaryrefslogtreecommitdiff
path: root/hw/qdev.c
diff options
context:
space:
mode:
authorPaul Brook <paul@codesourcery.com>2009-05-14 22:35:07 +0100
committerPaul Brook <paul@codesourcery.com>2009-05-14 22:35:07 +0100
commit9d07d7579bcaf01e05c511c63d091ed2ac310091 (patch)
tree20ed00454b9ddabf62cc673b14d1234cbc078287 /hw/qdev.c
parent9be5dafe488088bcff8f8365bc7dd35d3dac5186 (diff)
downloadqemu-9d07d7579bcaf01e05c511c63d091ed2ac310091.zip
qemu-9d07d7579bcaf01e05c511c63d091ed2ac310091.tar.gz
qemu-9d07d7579bcaf01e05c511c63d091ed2ac310091.tar.bz2
PCI network qdev conversion
Signed-off-by: Paul Brook <paul@codesourcery.com>
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