Revision 2fa30aba hw/net/stellaris_enet.c
b/hw/net/stellaris_enet.c | ||
---|---|---|
42 | 42 |
#define SE_TCTL_CRC 0x04 |
43 | 43 |
#define SE_TCTL_DUPLEX 0x08 |
44 | 44 |
|
45 |
#define TYPE_STELLARIS_ENET "stellaris_enet" |
|
46 |
#define STELLARIS_ENET(obj) \ |
|
47 |
OBJECT_CHECK(stellaris_enet_state, (obj), TYPE_STELLARIS_ENET) |
|
48 |
|
|
45 | 49 |
typedef struct { |
46 |
SysBusDevice busdev; |
|
50 |
SysBusDevice parent_obj; |
|
51 |
|
|
47 | 52 |
uint32_t ris; |
48 | 53 |
uint32_t im; |
49 | 54 |
uint32_t rctl; |
... | ... | |
386 | 391 |
{ |
387 | 392 |
stellaris_enet_state *s = qemu_get_nic_opaque(nc); |
388 | 393 |
|
389 |
unregister_savevm(&s->busdev.qdev, "stellaris_enet", s);
|
|
394 |
unregister_savevm(DEVICE(s), "stellaris_enet", s);
|
|
390 | 395 |
|
391 | 396 |
memory_region_destroy(&s->mmio); |
392 | 397 |
|
... | ... | |
401 | 406 |
.cleanup = stellaris_enet_cleanup, |
402 | 407 |
}; |
403 | 408 |
|
404 |
static int stellaris_enet_init(SysBusDevice *dev)
|
|
409 |
static int stellaris_enet_init(SysBusDevice *sbd)
|
|
405 | 410 |
{ |
406 |
stellaris_enet_state *s = FROM_SYSBUS(stellaris_enet_state, dev); |
|
411 |
DeviceState *dev = DEVICE(sbd); |
|
412 |
stellaris_enet_state *s = STELLARIS_ENET(dev); |
|
407 | 413 |
|
408 | 414 |
memory_region_init_io(&s->mmio, OBJECT(s), &stellaris_enet_ops, s, |
409 | 415 |
"stellaris_enet", 0x1000); |
410 |
sysbus_init_mmio(dev, &s->mmio);
|
|
411 |
sysbus_init_irq(dev, &s->irq);
|
|
416 |
sysbus_init_mmio(sbd, &s->mmio);
|
|
417 |
sysbus_init_irq(sbd, &s->irq);
|
|
412 | 418 |
qemu_macaddr_default_if_unset(&s->conf.macaddr); |
413 | 419 |
|
414 | 420 |
s->nic = qemu_new_nic(&net_stellaris_enet_info, &s->conf, |
415 |
object_get_typename(OBJECT(dev)), dev->qdev.id, s);
|
|
421 |
object_get_typename(OBJECT(dev)), dev->id, s); |
|
416 | 422 |
qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a); |
417 | 423 |
|
418 | 424 |
stellaris_enet_reset(s); |
419 |
register_savevm(&s->busdev.qdev, "stellaris_enet", -1, 1,
|
|
425 |
register_savevm(dev, "stellaris_enet", -1, 1, |
|
420 | 426 |
stellaris_enet_save, stellaris_enet_load, s); |
421 | 427 |
return 0; |
422 | 428 |
} |
... | ... | |
436 | 442 |
} |
437 | 443 |
|
438 | 444 |
static const TypeInfo stellaris_enet_info = { |
439 |
.name = "stellaris_enet",
|
|
445 |
.name = TYPE_STELLARIS_ENET,
|
|
440 | 446 |
.parent = TYPE_SYS_BUS_DEVICE, |
441 | 447 |
.instance_size = sizeof(stellaris_enet_state), |
442 | 448 |
.class_init = stellaris_enet_class_init, |
Also available in: Unified diff