Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
[qemu.git] / hw / vfio / calxeda-xgmac.c
blob24cee6d06512c1b65b29508282df8dcda09fd570
1 /*
2 * calxeda xgmac VFIO device
4 * Copyright Linaro Limited, 2014
6 * Authors:
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 "qemu/osdep.h"
15 #include "hw/vfio/vfio-calxeda-xgmac.h"
17 static void calxeda_xgmac_realize(DeviceState *dev, Error **errp)
19 VFIOPlatformDevice *vdev = VFIO_PLATFORM_DEVICE(dev);
20 VFIOCalxedaXgmacDeviceClass *k = VFIO_CALXEDA_XGMAC_DEVICE_GET_CLASS(dev);
22 vdev->compat = g_strdup("calxeda,hb-xgmac");
24 k->parent_realize(dev, errp);
27 static const VMStateDescription vfio_platform_calxeda_xgmac_vmstate = {
28 .name = TYPE_VFIO_CALXEDA_XGMAC,
29 .unmigratable = 1,
32 static void vfio_calxeda_xgmac_class_init(ObjectClass *klass, void *data)
34 DeviceClass *dc = DEVICE_CLASS(klass);
35 VFIOCalxedaXgmacDeviceClass *vcxc =
36 VFIO_CALXEDA_XGMAC_DEVICE_CLASS(klass);
37 device_class_set_parent_realize(dc, calxeda_xgmac_realize,
38 &vcxc->parent_realize);
39 dc->desc = "VFIO Calxeda XGMAC";
40 dc->vmsd = &vfio_platform_calxeda_xgmac_vmstate;
41 /* Supported by TYPE_VIRT_MACHINE */
42 dc->user_creatable = true;
45 static const TypeInfo vfio_calxeda_xgmac_dev_info = {
46 .name = TYPE_VFIO_CALXEDA_XGMAC,
47 .parent = TYPE_VFIO_PLATFORM,
48 .instance_size = sizeof(VFIOCalxedaXgmacDevice),
49 .class_init = vfio_calxeda_xgmac_class_init,
50 .class_size = sizeof(VFIOCalxedaXgmacDeviceClass),
53 static void register_calxeda_xgmac_dev_type(void)
55 type_register_static(&vfio_calxeda_xgmac_dev_info);
58 type_init(register_calxeda_xgmac_dev_type)