Revision b946a153 hw/rtl8139.c
b/hw/rtl8139.c | ||
---|---|---|
3414 | 3414 |
} |
3415 | 3415 |
#endif /* RTL8139_ONBOARD_TIMER */ |
3416 | 3416 |
|
3417 |
static void rtl8139_cleanup(VLANClientState *vc) |
|
3418 |
{ |
|
3419 |
RTL8139State *s = vc->opaque; |
|
3420 |
|
|
3421 |
if (s->cplus_txbuffer) { |
|
3422 |
qemu_free(s->cplus_txbuffer); |
|
3423 |
s->cplus_txbuffer = NULL; |
|
3424 |
} |
|
3425 |
|
|
3426 |
#ifdef RTL8139_ONBOARD_TIMER |
|
3427 |
qemu_del_timer(s->timer); |
|
3428 |
qemu_free_timer(s->timer); |
|
3429 |
#endif |
|
3430 |
|
|
3431 |
unregister_savevm("rtl8139", s); |
|
3432 |
} |
|
3433 |
|
|
3434 |
static int pci_rtl8139_uninit(PCIDevice *dev) |
|
3435 |
{ |
|
3436 |
PCIRTL8139State *d = (PCIRTL8139State *)dev; |
|
3437 |
RTL8139State *s = &d->rtl8139; |
|
3438 |
|
|
3439 |
cpu_unregister_io_memory(s->rtl8139_mmio_io_addr); |
|
3440 |
|
|
3441 |
return 0; |
|
3442 |
} |
|
3443 |
|
|
3417 | 3444 |
PCIDevice *pci_rtl8139_init(PCIBus *bus, NICInfo *nd, int devfn) |
3418 | 3445 |
{ |
3419 | 3446 |
PCIRTL8139State *d; |
... | ... | |
3424 | 3451 |
"RTL8139", sizeof(PCIRTL8139State), |
3425 | 3452 |
devfn, |
3426 | 3453 |
NULL, NULL); |
3454 |
d->dev.unregister = pci_rtl8139_uninit; |
|
3427 | 3455 |
pci_conf = d->dev.config; |
3428 | 3456 |
pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_REALTEK); |
3429 | 3457 |
pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_REALTEK_8139); |
... | ... | |
3450 | 3478 |
memcpy(s->macaddr, nd->macaddr, 6); |
3451 | 3479 |
rtl8139_reset(s); |
3452 | 3480 |
s->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, |
3453 |
rtl8139_receive, rtl8139_can_receive, s); |
|
3481 |
rtl8139_receive, rtl8139_can_receive, |
|
3482 |
rtl8139_cleanup, s); |
|
3454 | 3483 |
|
3455 | 3484 |
qemu_format_nic_info_str(s->vc, s->macaddr); |
3456 | 3485 |
|
Also available in: Unified diff