X-Git-Url: http://git.maemo.org/git/?p=qemu;a=blobdiff_plain;f=hw%2Fne2000.c;fp=hw%2Fne2000.c;h=2af0d109b9e70695ca71a55b3002959da13dc915;hp=d778cb4ca8470a0d7c25b3eedc5a4ff7143e6b5f;hb=a03c3bde4e288e790eccfb8cd45abd8ecbf467dc;hpb=e2ffa1bf065fa199f27d661d495573e9d6059bf1 diff --git a/hw/ne2000.c b/hw/ne2000.c index d778cb4..2af0d10 100644 --- a/hw/ne2000.c +++ b/hw/ne2000.c @@ -800,19 +800,12 @@ static void ne2000_cleanup(VLANClientState *vc) unregister_savevm("ne2000", s); } -PCIDevice *pci_ne2000_init(PCIBus *bus, NICInfo *nd, int devfn) +static void pci_ne2000_init(PCIDevice *pci_dev) { - PCINE2000State *d; + PCINE2000State *d = (PCINE2000State *)pci_dev; NE2000State *s; uint8_t *pci_conf; - d = (PCINE2000State *)pci_register_device(bus, - "NE2000", sizeof(PCINE2000State), - devfn, - NULL, NULL); - if (!d) - return NULL; - pci_conf = d->dev.config; pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_REALTEK); pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_REALTEK_8029); @@ -825,15 +818,20 @@ PCIDevice *pci_ne2000_init(PCIBus *bus, NICInfo *nd, int devfn) s = &d->ne2000; s->irq = d->dev.irq[0]; s->pci_dev = (PCIDevice *)d; - memcpy(s->macaddr, nd->macaddr, 6); + qdev_get_macaddr(&d->dev.qdev, s->macaddr); ne2000_reset(s); - s->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, + s->vc = qdev_get_vlan_client(&d->dev.qdev, ne2000_receive, ne2000_can_receive, ne2000_cleanup, s); qemu_format_nic_info_str(s->vc, s->macaddr); register_savevm("ne2000", -1, 3, ne2000_save, ne2000_load, s); +} - return (PCIDevice *)d; +static void ne2000_register_devices(void) +{ + pci_qdev_register("ne2k_pci", sizeof(PCINE2000State), pci_ne2000_init); } + +device_init(ne2000_register_devices)