Revision b946a153 hw/mcf_fec.c
b/hw/mcf_fec.c | ||
---|---|---|
24 | 24 |
|
25 | 25 |
typedef struct { |
26 | 26 |
qemu_irq *irq; |
27 |
int mmio_index; |
|
27 | 28 |
VLANClientState *vc; |
28 | 29 |
uint32_t irq_state; |
29 | 30 |
uint32_t eir; |
... | ... | |
441 | 442 |
mcf_fec_write |
442 | 443 |
}; |
443 | 444 |
|
445 |
static void mcf_fec_cleanup(VLANClientState *vc) |
|
446 |
{ |
|
447 |
mcf_fec_state *s = vc->opaque; |
|
448 |
|
|
449 |
cpu_unregister_io_memory(s->mmio_index); |
|
450 |
|
|
451 |
qemu_free(s); |
|
452 |
} |
|
453 |
|
|
444 | 454 |
void mcf_fec_init(NICInfo *nd, target_phys_addr_t base, qemu_irq *irq) |
445 | 455 |
{ |
446 | 456 |
mcf_fec_state *s; |
447 |
int iomemtype; |
|
448 | 457 |
|
449 | 458 |
qemu_check_nic_model(nd, "mcf_fec"); |
450 | 459 |
|
451 | 460 |
s = (mcf_fec_state *)qemu_mallocz(sizeof(mcf_fec_state)); |
452 | 461 |
s->irq = irq; |
453 |
iomemtype = cpu_register_io_memory(0, mcf_fec_readfn,
|
|
454 |
mcf_fec_writefn, s); |
|
455 |
cpu_register_physical_memory(base, 0x400, iomemtype);
|
|
462 |
s->mmio_index = cpu_register_io_memory(0, mcf_fec_readfn,
|
|
463 |
mcf_fec_writefn, s);
|
|
464 |
cpu_register_physical_memory(base, 0x400, s->mmio_index);
|
|
456 | 465 |
|
457 | 466 |
s->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, |
458 |
mcf_fec_receive, mcf_fec_can_receive, s); |
|
467 |
mcf_fec_receive, mcf_fec_can_receive, |
|
468 |
mcf_fec_cleanup, s); |
|
459 | 469 |
memcpy(s->macaddr, nd->macaddr, 6); |
460 | 470 |
qemu_format_nic_info_str(s->vc, s->macaddr); |
461 | 471 |
} |
Also available in: Unified diff