2 * Copyright (c) 2018 Citrix Systems Inc.
4 * This work is licensed under the terms of the GNU GPL, version 2 or later.
5 * See the COPYING file in the top-level directory.
11 #include "hw/xen/xen-bus.h"
12 #include "hw/block/block.h"
13 #include "hw/block/dataplane/xen-block.h"
14 #include "sysemu/iothread.h"
16 typedef enum XenBlockVdevType
{
17 XEN_BLOCK_VDEV_TYPE_INVALID
,
18 XEN_BLOCK_VDEV_TYPE_DP
,
19 XEN_BLOCK_VDEV_TYPE_XVD
,
20 XEN_BLOCK_VDEV_TYPE_HD
,
21 XEN_BLOCK_VDEV_TYPE_SD
,
22 XEN_BLOCK_VDEV_TYPE__MAX
25 typedef struct XenBlockVdev
{
26 XenBlockVdevType type
;
28 unsigned long partition
;
33 typedef struct XenBlockProperties
{
36 unsigned int max_ring_page_order
;
40 typedef struct XenBlockDrive
{
45 typedef struct XenBlockIOThread
{
49 typedef struct XenBlockDevice
{
51 XenBlockProperties props
;
52 const char *device_type
;
54 XenBlockDataPlane
*dataplane
;
56 XenBlockIOThread
*iothread
;
59 typedef void (*XenBlockDeviceRealize
)(XenBlockDevice
*blockdev
, Error
**errp
);
60 typedef void (*XenBlockDeviceUnrealize
)(XenBlockDevice
*blockdev
);
62 typedef struct XenBlockDeviceClass
{
64 XenDeviceClass parent_class
;
66 XenBlockDeviceRealize realize
;
67 XenBlockDeviceUnrealize unrealize
;
68 } XenBlockDeviceClass
;
70 #define TYPE_XEN_BLOCK_DEVICE "xen-block"
71 #define XEN_BLOCK_DEVICE(obj) \
72 OBJECT_CHECK(XenBlockDevice, (obj), TYPE_XEN_BLOCK_DEVICE)
73 #define XEN_BLOCK_DEVICE_CLASS(class) \
74 OBJECT_CLASS_CHECK(XenBlockDeviceClass, (class), TYPE_XEN_BLOCK_DEVICE)
75 #define XEN_BLOCK_DEVICE_GET_CLASS(obj) \
76 OBJECT_GET_CLASS(XenBlockDeviceClass, (obj), TYPE_XEN_BLOCK_DEVICE)
78 typedef struct XenDiskDevice
{
79 XenBlockDevice blockdev
;
82 #define TYPE_XEN_DISK_DEVICE "xen-disk"
83 #define XEN_DISK_DEVICE(obj) \
84 OBJECT_CHECK(XenDiskDevice, (obj), TYPE_XEN_DISK_DEVICE)
86 typedef struct XenCDRomDevice
{
87 XenBlockDevice blockdev
;
90 #define TYPE_XEN_CDROM_DEVICE "xen-cdrom"
91 #define XEN_CDROM_DEVICE(obj) \
92 OBJECT_CHECK(XenCDRomDevice, (obj), TYPE_XEN_CDROM_DEVICE)
94 #endif /* HW_XEN_BLOCK_H */