1 /*
2 * calxeda xgmac VFIO device
3 *
4 * Copyright Linaro Limited, 2014
5 *
6 * Authors:
7 * Eric Auger <eric.auger@linaro.org>
8 *
9 * This work is licensed under the terms of the GNU GPL, version 2. See
10 * the COPYING file in the top-level directory.
11 *
12 */
13
14 #include "qemu/osdep.h"
15 #include "hw/vfio/vfio-calxeda-xgmac.h"
16 #include "migration/vmstate.h"
17 #include "qemu/module.h"
18 #include "qemu/error-report.h"
19
calxeda_xgmac_realize(DeviceState * dev,Error ** errp)20 static void calxeda_xgmac_realize(DeviceState *dev, Error **errp)
21 {
22 VFIOPlatformDevice *vdev = VFIO_PLATFORM_DEVICE(dev);
23 VFIOCalxedaXgmacDeviceClass *k = VFIO_CALXEDA_XGMAC_DEVICE_GET_CLASS(dev);
24
25 warn_report("-device vfio-calxeda-xgmac is deprecated");
26 vdev->compat = g_strdup("calxeda,hb-xgmac");
27 vdev->num_compat = 1;
28
29 k->parent_realize(dev, errp);
30 }
31
32 static const VMStateDescription vfio_platform_calxeda_xgmac_vmstate = {
33 .name = "vfio-calxeda-xgmac",
34 .unmigratable = 1,
35 };
36
vfio_calxeda_xgmac_class_init(ObjectClass * klass,const void * data)37 static void vfio_calxeda_xgmac_class_init(ObjectClass *klass, const void *data)
38 {
39 DeviceClass *dc = DEVICE_CLASS(klass);
40 VFIOCalxedaXgmacDeviceClass *vcxc =
41 VFIO_CALXEDA_XGMAC_DEVICE_CLASS(klass);
42 device_class_set_parent_realize(dc, calxeda_xgmac_realize,
43 &vcxc->parent_realize);
44 dc->desc = "VFIO Calxeda XGMAC";
45 dc->vmsd = &vfio_platform_calxeda_xgmac_vmstate;
46 }
47
48 static const TypeInfo vfio_calxeda_xgmac_dev_info = {
49 .name = TYPE_VFIO_CALXEDA_XGMAC,
50 .parent = TYPE_VFIO_PLATFORM,
51 .instance_size = sizeof(VFIOCalxedaXgmacDevice),
52 .class_init = vfio_calxeda_xgmac_class_init,
53 .class_size = sizeof(VFIOCalxedaXgmacDeviceClass),
54 };
55
register_calxeda_xgmac_dev_type(void)56 static void register_calxeda_xgmac_dev_type(void)
57 {
58 type_register_static(&vfio_calxeda_xgmac_dev_info);
59 }
60
61 type_init(register_calxeda_xgmac_dev_type)
62