Revision a783cc3e

b/hw/ne2000.c
25 25
#include "pci.h"
26 26
#include "net.h"
27 27
#include "ne2000.h"
28
#include "loader.h"
28 29

  
29 30
/* debug NE2000 card */
30 31
//#define DEBUG_NE2000
......
738 739
{
739 740
    NE2000State *s = vc->opaque;
740 741

  
741
    unregister_savevm("ne2000", s);
742
    s->vc = NULL;
742 743
}
743 744

  
744 745
static int pci_ne2000_init(PCIDevice *pci_dev)
......
758 759
                           PCI_ADDRESS_SPACE_IO, ne2000_map);
759 760
    s = &d->ne2000;
760 761
    s->irq = d->dev.irq[0];
761
    qdev_get_macaddr(&d->dev.qdev, s->c.macaddr.a);
762

  
763
    qemu_macaddr_default_if_unset(&s->c.macaddr);
762 764
    ne2000_reset(s);
763
    s->vc = qdev_get_vlan_client(&d->dev.qdev,
765
    s->vc = qemu_new_vlan_client(NET_CLIENT_TYPE_NIC, s->c.vlan, s->c.peer,
766
                                 pci_dev->qdev.info->name, pci_dev->qdev.id,
764 767
                                 ne2000_can_receive, ne2000_receive, NULL,
765
                                 ne2000_cleanup, s);
766

  
768
                                 NULL, ne2000_cleanup, s);
767 769
    qemu_format_nic_info_str(s->vc, s->c.macaddr.a);
768 770

  
771
    if (!pci_dev->qdev.hotplugged) {
772
        static int loaded = 0;
773
        if (!loaded) {
774
            rom_add_option("pxe-ne2k_pci.bin");
775
            loaded = 1;
776
        }
777
    }
778

  
769 779
    register_savevm("ne2000", -1, 3, pci_ne2000_save, pci_ne2000_load, d);
770 780
    return 0;
771 781
}
772 782

  
783
static int pci_ne2000_exit(PCIDevice *pci_dev)
784
{
785
    PCINE2000State *d = DO_UPCAST(PCINE2000State, dev, pci_dev);
786
    NE2000State *s = &d->ne2000;
787

  
788
    unregister_savevm("ne2000", s);
789
    qemu_del_vlan_client(s->vc);
790
    return 0;
791
}
792

  
773 793
static PCIDeviceInfo ne2000_info = {
774
    .qdev.name = "ne2k_pci",
775
    .qdev.size = sizeof(PCINE2000State),
776
    .init      = pci_ne2000_init,
794
    .qdev.name  = "ne2k_pci",
795
    .qdev.size  = sizeof(PCINE2000State),
796
    .init       = pci_ne2000_init,
797
    .exit       = pci_ne2000_exit,
798
    .qdev.props = (Property[]) {
799
        DEFINE_NIC_PROPERTIES(PCINE2000State, ne2000.c),
800
        DEFINE_PROP_END_OF_LIST(),
801
    }
777 802
};
778 803

  
779 804
static void ne2000_register_devices(void)

Also available in: Unified diff