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/rtl8139.c | |
parent | 9be5dafe488088bcff8f8365bc7dd35d3dac5186 (diff) |
PCI network qdev conversion
Signed-off-by: Paul Brook <paul@codesourcery.com>
Diffstat (limited to 'hw/rtl8139.c')
-rw-r--r-- | hw/rtl8139.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/hw/rtl8139.c b/hw/rtl8139.c index c0be1de829..d99f35c130 100644 --- a/hw/rtl8139.c +++ b/hw/rtl8139.c @@ -3441,19 +3441,12 @@ static int pci_rtl8139_uninit(PCIDevice *dev) return 0; } -PCIDevice *pci_rtl8139_init(PCIBus *bus, NICInfo *nd, int devfn) +static void pci_rtl8139_init(PCIDevice *dev) { - PCIRTL8139State *d; + PCIRTL8139State *d = (PCIRTL8139State *)dev; RTL8139State *s; uint8_t *pci_conf; - d = (PCIRTL8139State *)pci_register_device(bus, - "RTL8139", sizeof(PCIRTL8139State), - devfn, - NULL, NULL); - if (!d) - return NULL; - d->dev.unregister = pci_rtl8139_uninit; pci_conf = d->dev.config; @@ -3479,9 +3472,9 @@ PCIDevice *pci_rtl8139_init(PCIBus *bus, NICInfo *nd, int devfn) PCI_ADDRESS_SPACE_MEM, rtl8139_mmio_map); s->pci_dev = (PCIDevice *)d; - memcpy(s->macaddr, nd->macaddr, 6); + qdev_get_macaddr(&dev->qdev, s->macaddr); rtl8139_reset(s); - s->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, + s->vc = qdev_get_vlan_client(&dev->qdev, rtl8139_receive, rtl8139_can_receive, rtl8139_cleanup, s); @@ -3499,5 +3492,11 @@ PCIDevice *pci_rtl8139_init(PCIBus *bus, NICInfo *nd, int devfn) qemu_mod_timer(s->timer, rtl8139_get_next_tctr_time(s,qemu_get_clock(vm_clock))); #endif /* RTL8139_ONBOARD_TIMER */ - return (PCIDevice *)d; } + +static void rtl8139_register_devices(void) +{ + pci_qdev_register("rtl8139", sizeof(PCIRTL8139State), pci_rtl8139_init); +} + +device_init(rtl8139_register_devices) |