xref: /openbmc/qemu/hw/vfio/amd-xgbe.c (revision 39de9984)
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 "hw/vfio/vfio-amd-xgbe.h"
15 
16 static void amd_xgbe_realize(DeviceState *dev, Error **errp)
17 {
18     VFIOPlatformDevice *vdev = VFIO_PLATFORM_DEVICE(dev);
19     VFIOAmdXgbeDeviceClass *k = VFIO_AMD_XGBE_DEVICE_GET_CLASS(dev);
20 
21     vdev->compat = g_strdup("amd,xgbe-seattle-v1a");
22 
23     k->parent_realize(dev, errp);
24 }
25 
26 static const VMStateDescription vfio_platform_amd_xgbe_vmstate = {
27     .name = TYPE_VFIO_AMD_XGBE,
28     .unmigratable = 1,
29 };
30 
31 static void vfio_amd_xgbe_class_init(ObjectClass *klass, void *data)
32 {
33     DeviceClass *dc = DEVICE_CLASS(klass);
34     VFIOAmdXgbeDeviceClass *vcxc =
35         VFIO_AMD_XGBE_DEVICE_CLASS(klass);
36     vcxc->parent_realize = dc->realize;
37     dc->realize = amd_xgbe_realize;
38     dc->desc = "VFIO AMD XGBE";
39     dc->vmsd = &vfio_platform_amd_xgbe_vmstate;
40 }
41 
42 static const TypeInfo vfio_amd_xgbe_dev_info = {
43     .name = TYPE_VFIO_AMD_XGBE,
44     .parent = TYPE_VFIO_PLATFORM,
45     .instance_size = sizeof(VFIOAmdXgbeDevice),
46     .class_init = vfio_amd_xgbe_class_init,
47     .class_size = sizeof(VFIOAmdXgbeDeviceClass),
48 };
49 
50 static void register_amd_xgbe_dev_type(void)
51 {
52     type_register_static(&vfio_amd_xgbe_dev_info);
53 }
54 
55 type_init(register_amd_xgbe_dev_type)
56