2 * calxeda xgmac VFIO device
4 * Copyright Linaro Limited, 2014
7 * Eric Auger <eric.auger@linaro.org>
9 * This work is licensed under the terms of the GNU GPL, version 2. See
10 * the COPYING file in the top-level directory.
14 #include "hw/vfio/vfio-calxeda-xgmac.h"
16 static void calxeda_xgmac_realize(DeviceState
*dev
, Error
**errp
)
18 VFIOPlatformDevice
*vdev
= VFIO_PLATFORM_DEVICE(dev
);
19 VFIOCalxedaXgmacDeviceClass
*k
= VFIO_CALXEDA_XGMAC_DEVICE_GET_CLASS(dev
);
21 vdev
->compat
= g_strdup("calxeda,hb-xgmac");
23 k
->parent_realize(dev
, errp
);
26 static const VMStateDescription vfio_platform_calxeda_xgmac_vmstate
= {
27 .name
= TYPE_VFIO_CALXEDA_XGMAC
,
31 static void vfio_calxeda_xgmac_class_init(ObjectClass
*klass
, void *data
)
33 DeviceClass
*dc
= DEVICE_CLASS(klass
);
34 VFIOCalxedaXgmacDeviceClass
*vcxc
=
35 VFIO_CALXEDA_XGMAC_DEVICE_CLASS(klass
);
36 vcxc
->parent_realize
= dc
->realize
;
37 dc
->realize
= calxeda_xgmac_realize
;
38 dc
->desc
= "VFIO Calxeda XGMAC";
39 dc
->vmsd
= &vfio_platform_calxeda_xgmac_vmstate
;
42 static const TypeInfo vfio_calxeda_xgmac_dev_info
= {
43 .name
= TYPE_VFIO_CALXEDA_XGMAC
,
44 .parent
= TYPE_VFIO_PLATFORM
,
45 .instance_size
= sizeof(VFIOCalxedaXgmacDevice
),
46 .class_init
= vfio_calxeda_xgmac_class_init
,
47 .class_size
= sizeof(VFIOCalxedaXgmacDeviceClass
),
50 static void register_calxeda_xgmac_dev_type(void)
52 type_register_static(&vfio_calxeda_xgmac_dev_info
);
55 type_init(register_calxeda_xgmac_dev_type
)