diff options
author | Paul Brook <paul@codesourcery.com> | 2009-05-14 22:35:07 +0100 |
---|---|---|
committer | Paul Brook <paul@codesourcery.com> | 2009-05-14 22:35:07 +0100 |
commit | 9d07d7579bcaf01e05c511c63d091ed2ac310091 (patch) | |
tree | 20ed00454b9ddabf62cc673b14d1234cbc078287 /hw/qdev.c | |
parent | 9be5dafe488088bcff8f8365bc7dd35d3dac5186 (diff) |
PCI network qdev conversion
Signed-off-by: Paul Brook <paul@codesourcery.com>
Diffstat (limited to 'hw/qdev.c')
-rw-r--r-- | hw/qdev.c | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -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 |