aboutsummaryrefslogtreecommitdiff
path: root/hw/mipsnet.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/mipsnet.c')
-rw-r--r--hw/mipsnet.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/hw/mipsnet.c b/hw/mipsnet.c
index 415b04e2ce..e842984219 100644
--- a/hw/mipsnet.c
+++ b/hw/mipsnet.c
@@ -33,6 +33,7 @@ typedef struct MIPSnetState {
uint32_t intctl;
uint8_t rx_buffer[MAX_ETH_FRAME_SIZE];
uint8_t tx_buffer[MAX_ETH_FRAME_SIZE];
+ int io_base;
qemu_irq irq;
VLANClientState *vc;
} MIPSnetState;
@@ -231,6 +232,17 @@ static int mipsnet_load(QEMUFile *f, void *opaque, int version_id)
return 0;
}
+static void mipsnet_cleanup(VLANClientState *vc)
+{
+ MIPSnetState *s = vc->opaque;
+
+ unregister_savevm("mipsnet", s);
+
+ isa_unassign_ioport(s->io_base, 36);
+
+ qemu_free(s);
+}
+
void mipsnet_init (int base, qemu_irq irq, NICInfo *nd)
{
MIPSnetState *s;
@@ -246,10 +258,12 @@ void mipsnet_init (int base, qemu_irq irq, NICInfo *nd)
register_ioport_write(base, 36, 4, mipsnet_ioport_write, s);
register_ioport_read(base, 36, 4, mipsnet_ioport_read, s);
+ s->io_base = base;
s->irq = irq;
if (nd && nd->vlan) {
s->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name,
- mipsnet_receive, mipsnet_can_receive, s);
+ mipsnet_receive, mipsnet_can_receive,
+ mipsnet_cleanup, s);
} else {
s->vc = NULL;
}