1
2
3
4
5
6
7
8
9
10
11
12
13
14#include "qemu/osdep.h"
15#include "hw/vfio/vfio-calxeda-xgmac.h"
16
17static void calxeda_xgmac_realize(DeviceState *dev, Error **errp)
18{
19 VFIOPlatformDevice *vdev = VFIO_PLATFORM_DEVICE(dev);
20 VFIOCalxedaXgmacDeviceClass *k = VFIO_CALXEDA_XGMAC_DEVICE_GET_CLASS(dev);
21
22 vdev->compat = g_strdup("calxeda,hb-xgmac");
23
24 k->parent_realize(dev, errp);
25}
26
27static const VMStateDescription vfio_platform_calxeda_xgmac_vmstate = {
28 .name = TYPE_VFIO_CALXEDA_XGMAC,
29 .unmigratable = 1,
30};
31
32static void vfio_calxeda_xgmac_class_init(ObjectClass *klass, void *data)
33{
34 DeviceClass *dc = DEVICE_CLASS(klass);
35 VFIOCalxedaXgmacDeviceClass *vcxc =
36 VFIO_CALXEDA_XGMAC_DEVICE_CLASS(klass);
37 vcxc->parent_realize = dc->realize;
38 dc->realize = calxeda_xgmac_realize;
39 dc->desc = "VFIO Calxeda XGMAC";
40 dc->vmsd = &vfio_platform_calxeda_xgmac_vmstate;
41}
42
43static const TypeInfo vfio_calxeda_xgmac_dev_info = {
44 .name = TYPE_VFIO_CALXEDA_XGMAC,
45 .parent = TYPE_VFIO_PLATFORM,
46 .instance_size = sizeof(VFIOCalxedaXgmacDevice),
47 .class_init = vfio_calxeda_xgmac_class_init,
48 .class_size = sizeof(VFIOCalxedaXgmacDeviceClass),
49};
50
51static void register_calxeda_xgmac_dev_type(void)
52{
53 type_register_static(&vfio_calxeda_xgmac_dev_info);
54}
55
56type_init(register_calxeda_xgmac_dev_type)
57