Revision 9d07d757 hw/ne2000.c
b/hw/ne2000.c | ||
---|---|---|
800 | 800 |
unregister_savevm("ne2000", s); |
801 | 801 |
} |
802 | 802 |
|
803 |
PCIDevice *pci_ne2000_init(PCIBus *bus, NICInfo *nd, int devfn)
|
|
803 |
static void pci_ne2000_init(PCIDevice *pci_dev)
|
|
804 | 804 |
{ |
805 |
PCINE2000State *d; |
|
805 |
PCINE2000State *d = (PCINE2000State *)pci_dev;
|
|
806 | 806 |
NE2000State *s; |
807 | 807 |
uint8_t *pci_conf; |
808 | 808 |
|
809 |
d = (PCINE2000State *)pci_register_device(bus, |
|
810 |
"NE2000", sizeof(PCINE2000State), |
|
811 |
devfn, |
|
812 |
NULL, NULL); |
|
813 |
if (!d) |
|
814 |
return NULL; |
|
815 |
|
|
816 | 809 |
pci_conf = d->dev.config; |
817 | 810 |
pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_REALTEK); |
818 | 811 |
pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_REALTEK_8029); |
... | ... | |
825 | 818 |
s = &d->ne2000; |
826 | 819 |
s->irq = d->dev.irq[0]; |
827 | 820 |
s->pci_dev = (PCIDevice *)d; |
828 |
memcpy(s->macaddr, nd->macaddr, 6);
|
|
821 |
qdev_get_macaddr(&d->dev.qdev, s->macaddr);
|
|
829 | 822 |
ne2000_reset(s); |
830 |
s->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name,
|
|
823 |
s->vc = qdev_get_vlan_client(&d->dev.qdev,
|
|
831 | 824 |
ne2000_receive, ne2000_can_receive, |
832 | 825 |
ne2000_cleanup, s); |
833 | 826 |
|
834 | 827 |
qemu_format_nic_info_str(s->vc, s->macaddr); |
835 | 828 |
|
836 | 829 |
register_savevm("ne2000", -1, 3, ne2000_save, ne2000_load, s); |
830 |
} |
|
837 | 831 |
|
838 |
return (PCIDevice *)d; |
|
832 |
static void ne2000_register_devices(void) |
|
833 |
{ |
|
834 |
pci_qdev_register("ne2k_pci", sizeof(PCINE2000State), pci_ne2000_init); |
|
839 | 835 |
} |
836 |
|
|
837 |
device_init(ne2000_register_devices) |
Also available in: Unified diff