1 /*
2 * AMD XGBE VFIO device
3 *
4 * Copyright Linaro Limited, 2015
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-amd-xgbe.h"
16 #include "migration/vmstate.h"
17 #include "qemu/module.h"
18 #include "qemu/error-report.h"
19
amd_xgbe_realize(DeviceState * dev,Error ** errp)20 static void amd_xgbe_realize(DeviceState *dev, Error **errp)
21 {
22 VFIOPlatformDevice *vdev = VFIO_PLATFORM_DEVICE(dev);
23 VFIOAmdXgbeDeviceClass *k = VFIO_AMD_XGBE_DEVICE_GET_CLASS(dev);
24
25 warn_report("-device vfio-amd-xgbe is deprecated");
26 vdev->compat = g_strdup("amd,xgbe-seattle-v1a");
27 vdev->num_compat = 1;
28
29 k->parent_realize(dev, errp);
30 }
31
32 static const VMStateDescription vfio_platform_amd_xgbe_vmstate = {
33 .name = "vfio-amd-xgbe",
34 .unmigratable = 1,
35 };
36
vfio_amd_xgbe_class_init(ObjectClass * klass,const void * data)37 static void vfio_amd_xgbe_class_init(ObjectClass *klass, const void *data)
38 {
39 DeviceClass *dc = DEVICE_CLASS(klass);
40 VFIOAmdXgbeDeviceClass *vcxc =
41 VFIO_AMD_XGBE_DEVICE_CLASS(klass);
42 device_class_set_parent_realize(dc, amd_xgbe_realize,
43 &vcxc->parent_realize);
44 dc->desc = "VFIO AMD XGBE";
45 dc->vmsd = &vfio_platform_amd_xgbe_vmstate;
46 }
47
48 static const TypeInfo vfio_amd_xgbe_dev_info = {
49 .name = TYPE_VFIO_AMD_XGBE,
50 .parent = TYPE_VFIO_PLATFORM,
51 .instance_size = sizeof(VFIOAmdXgbeDevice),
52 .class_init = vfio_amd_xgbe_class_init,
53 .class_size = sizeof(VFIOAmdXgbeDeviceClass),
54 };
55
register_amd_xgbe_dev_type(void)56 static void register_amd_xgbe_dev_type(void)
57 {
58 type_register_static(&vfio_amd_xgbe_dev_info);
59 }
60
61 type_init(register_amd_xgbe_dev_type)
62