aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'hw/ne2000-isa.c')
-rw-r--r--hw/ne2000-isa.c34
1 files changed, 25 insertions, 9 deletions
diff --git a/hw/ne2000-isa.c b/hw/ne2000-isa.c
index 729e8e225..d2e9283be 100644
--- a/hw/ne2000-isa.c
+++ b/hw/ne2000-isa.c
@@ -35,13 +35,32 @@ typedef struct ISANE2000State {
NE2000State ne2000;
} ISANE2000State;
-static void isa_ne2000_cleanup(VLANClientState *vc)
+static void isa_ne2000_cleanup(VLANClientState *nc)
{
- NE2000State *s = vc->opaque;
+ NE2000State *s = DO_UPCAST(NICState, nc, nc)->opaque;
- s->vc = NULL;
+ s->nic = NULL;
}
+static NetClientInfo net_ne2000_isa_info = {
+ .type = NET_CLIENT_TYPE_NIC,
+ .size = sizeof(NICState),
+ .can_receive = ne2000_can_receive,
+ .receive = ne2000_receive,
+ .cleanup = isa_ne2000_cleanup,
+};
+
+const VMStateDescription vmstate_isa_ne2000 = {
+ .name = "ne2000",
+ .version_id = 2,
+ .minimum_version_id = 0,
+ .minimum_version_id_old = 0,
+ .fields = (VMStateField []) {
+ VMSTATE_STRUCT(ne2000, ISANE2000State, 0, vmstate_ne2000, NE2000State),
+ VMSTATE_END_OF_LIST()
+ }
+};
+
static int isa_ne2000_initfn(ISADevice *dev)
{
ISANE2000State *isa = DO_UPCAST(ISANE2000State, dev, dev);
@@ -63,13 +82,10 @@ static int isa_ne2000_initfn(ISADevice *dev)
qemu_macaddr_default_if_unset(&s->c.macaddr);
ne2000_reset(s);
- s->vc = qemu_new_vlan_client(NET_CLIENT_TYPE_NIC, s->c.vlan, s->c.peer,
- dev->qdev.info->name, dev->qdev.id,
- ne2000_can_receive, ne2000_receive, NULL,
- NULL, isa_ne2000_cleanup, s);
- qemu_format_nic_info_str(s->vc, s->c.macaddr.a);
+ s->nic = qemu_new_nic(&net_ne2000_isa_info, &s->c,
+ dev->qdev.info->name, dev->qdev.id, s);
+ qemu_format_nic_info_str(&s->nic->nc, s->c.macaddr.a);
- vmstate_register(-1, &vmstate_ne2000, s);
return 0;
}