Revision 93db6685

b/hw/ne2000-isa.c
38 38
static void isa_ne2000_cleanup(VLANClientState *vc)
39 39
{
40 40
    NE2000State *s = vc->opaque;
41
    ISANE2000State *isa = container_of(s, ISANE2000State, ne2000);
42 41

  
43
    unregister_savevm("ne2000", s);
44

  
45
    isa_unassign_ioport(isa->iobase, 16);
46
    isa_unassign_ioport(isa->iobase + 0x10, 2);
47
    isa_unassign_ioport(isa->iobase + 0x1f, 1);
42
    s->vc = NULL;
48 43
}
49 44

  
50 45
static int isa_ne2000_initfn(ISADevice *dev)
......
65 60

  
66 61
    isa_init_irq(dev, &s->irq, isa->isairq);
67 62

  
68
    qdev_get_macaddr(&dev->qdev, s->macaddr);
63
    qemu_macaddr_default_if_unset(&s->c.macaddr);
69 64
    ne2000_reset(s);
70 65

  
71
    s->vc = qdev_get_vlan_client(&dev->qdev,
66
    s->vc = qemu_new_vlan_client(NET_CLIENT_TYPE_NIC, s->c.vlan, s->c.peer,
67
                                 dev->qdev.info->name, dev->qdev.id,
72 68
                                 ne2000_can_receive, ne2000_receive, NULL,
73
                                 isa_ne2000_cleanup, s);
74
    qemu_format_nic_info_str(s->vc, s->macaddr);
69
                                 NULL, isa_ne2000_cleanup, s);
70
    qemu_format_nic_info_str(s->vc, s->c.macaddr.a);
75 71

  
76 72
    register_savevm("ne2000", -1, 2, ne2000_save, ne2000_load, s);
77 73
    return 0;
......
84 80
    qemu_check_nic_model(nd, "ne2k_isa");
85 81

  
86 82
    dev = isa_create("ne2k_isa");
87
    dev->qdev.nd = nd; /* hack alert */
88 83
    qdev_prop_set_uint32(&dev->qdev, "iobase", base);
89 84
    qdev_prop_set_uint32(&dev->qdev, "irq",    irq);
85
    qdev_set_nic_properties(&dev->qdev, nd);
90 86
    qdev_init_nofail(&dev->qdev);
91 87
}
92 88

  
......
97 93
    .qdev.props = (Property[]) {
98 94
        DEFINE_PROP_HEX32("iobase", ISANE2000State, iobase, 0x300),
99 95
        DEFINE_PROP_UINT32("irq",   ISANE2000State, isairq, 9),
96
        DEFINE_NIC_PROPERTIES(ISANE2000State, ne2000.c),
100 97
        DEFINE_PROP_END_OF_LIST(),
101 98
    },
102 99
};
b/hw/ne2000.c
126 126
    int i;
127 127

  
128 128
    s->isr = ENISR_RESET;
129
    memcpy(s->mem, s->macaddr, 6);
129
    memcpy(s->mem, &s->c.macaddr, 6);
130 130
    s->mem[14] = 0x57;
131 131
    s->mem[15] = 0x57;
132 132

  
......
758 758
                           PCI_ADDRESS_SPACE_IO, ne2000_map);
759 759
    s = &d->ne2000;
760 760
    s->irq = d->dev.irq[0];
761
    qdev_get_macaddr(&d->dev.qdev, s->macaddr);
761
    qdev_get_macaddr(&d->dev.qdev, s->c.macaddr.a);
762 762
    ne2000_reset(s);
763 763
    s->vc = qdev_get_vlan_client(&d->dev.qdev,
764 764
                                 ne2000_can_receive, ne2000_receive, NULL,
765 765
                                 ne2000_cleanup, s);
766 766

  
767
    qemu_format_nic_info_str(s->vc, s->macaddr);
767
    qemu_format_nic_info_str(s->vc, s->c.macaddr.a);
768 768

  
769 769
    register_savevm("ne2000", -1, 3, pci_ne2000_save, pci_ne2000_load, d);
770 770
    return 0;
b/hw/ne2000.h
23 23
    uint8_t mult[8]; /* multicast mask array */
24 24
    qemu_irq irq;
25 25
    VLANClientState *vc;
26
    uint8_t macaddr[6];
26
    NICConf c;
27 27
    uint8_t mem[NE2000_MEM_SIZE];
28 28
} NE2000State;
29 29

  

Also available in: Unified diff