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 "qemu/module.h" 17 18 static void calxeda_xgmac_realize(DeviceState *dev, Error **errp) 19 { 20 VFIOPlatformDevice *vdev = VFIO_PLATFORM_DEVICE(dev); 21 VFIOCalxedaXgmacDeviceClass *k = VFIO_CALXEDA_XGMAC_DEVICE_GET_CLASS(dev); 22 23 vdev->compat = g_strdup("calxeda,hb-xgmac"); 24 vdev->num_compat = 1; 25 26 k->parent_realize(dev, errp); 27 } 28 29 static const VMStateDescription vfio_platform_calxeda_xgmac_vmstate = { 30 .name = "vfio-calxeda-xgmac", 31 .unmigratable = 1, 32 }; 33 34 static void vfio_calxeda_xgmac_class_init(ObjectClass *klass, void *data) 35 { 36 DeviceClass *dc = DEVICE_CLASS(klass); 37 VFIOCalxedaXgmacDeviceClass *vcxc = 38 VFIO_CALXEDA_XGMAC_DEVICE_CLASS(klass); 39 device_class_set_parent_realize(dc, calxeda_xgmac_realize, 40 &vcxc->parent_realize); 41 dc->desc = "VFIO Calxeda XGMAC"; 42 dc->vmsd = &vfio_platform_calxeda_xgmac_vmstate; 43 /* Supported by TYPE_VIRT_MACHINE */ 44 dc->user_creatable = true; 45 } 46 47 static const TypeInfo vfio_calxeda_xgmac_dev_info = { 48 .name = TYPE_VFIO_CALXEDA_XGMAC, 49 .parent = TYPE_VFIO_PLATFORM, 50 .instance_size = sizeof(VFIOCalxedaXgmacDevice), 51 .class_init = vfio_calxeda_xgmac_class_init, 52 .class_size = sizeof(VFIOCalxedaXgmacDeviceClass), 53 }; 54 55 static void register_calxeda_xgmac_dev_type(void) 56 { 57 type_register_static(&vfio_calxeda_xgmac_dev_info); 58 } 59 60 type_init(register_calxeda_xgmac_dev_type) 61