]>
Commit | Line | Data |
---|---|---|
7a8d15d7 EA |
1 | /* |
2 | * calxeda xgmac VFIO device | |
3 | * | |
4 | * Copyright Linaro Limited, 2014 | |
5 | * | |
6 | * Authors: | |
7 | * Eric Auger <[email protected]> | |
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 | ||
c6eacb1a | 14 | #include "qemu/osdep.h" |
7a8d15d7 | 15 | #include "hw/vfio/vfio-calxeda-xgmac.h" |
d6454270 | 16 | #include "migration/vmstate.h" |
0b8fa32f | 17 | #include "qemu/module.h" |
7a8d15d7 EA |
18 | |
19 | static void calxeda_xgmac_realize(DeviceState *dev, Error **errp) | |
20 | { | |
21 | VFIOPlatformDevice *vdev = VFIO_PLATFORM_DEVICE(dev); | |
22 | VFIOCalxedaXgmacDeviceClass *k = VFIO_CALXEDA_XGMAC_DEVICE_GET_CLASS(dev); | |
23 | ||
24 | vdev->compat = g_strdup("calxeda,hb-xgmac"); | |
a49531eb | 25 | vdev->num_compat = 1; |
7a8d15d7 EA |
26 | |
27 | k->parent_realize(dev, errp); | |
28 | } | |
29 | ||
30 | static const VMStateDescription vfio_platform_calxeda_xgmac_vmstate = { | |
da56e330 | 31 | .name = "vfio-calxeda-xgmac", |
7a8d15d7 EA |
32 | .unmigratable = 1, |
33 | }; | |
34 | ||
35 | static void vfio_calxeda_xgmac_class_init(ObjectClass *klass, void *data) | |
36 | { | |
37 | DeviceClass *dc = DEVICE_CLASS(klass); | |
38 | VFIOCalxedaXgmacDeviceClass *vcxc = | |
39 | VFIO_CALXEDA_XGMAC_DEVICE_CLASS(klass); | |
bf853881 PMD |
40 | device_class_set_parent_realize(dc, calxeda_xgmac_realize, |
41 | &vcxc->parent_realize); | |
7a8d15d7 EA |
42 | dc->desc = "VFIO Calxeda XGMAC"; |
43 | dc->vmsd = &vfio_platform_calxeda_xgmac_vmstate; | |
e4f4fb1e EH |
44 | /* Supported by TYPE_VIRT_MACHINE */ |
45 | dc->user_creatable = true; | |
7a8d15d7 EA |
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 | ||
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) |