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
;
32 typedef struct XenBlockProperties
{
35 unsigned int max_ring_page_order
;
39 typedef struct XenBlockDevice
{
41 XenBlockProperties props
;
42 const char *device_type
;
44 XenBlockDataPlane
*dataplane
;
47 typedef void (*XenBlockDeviceRealize
)(XenBlockDevice
*blockdev
, Error
**errp
);
48 typedef void (*XenBlockDeviceUnrealize
)(XenBlockDevice
*blockdev
, Error
**errp
);
50 typedef struct XenBlockDeviceClass
{
52 XenDeviceClass parent_class
;
54 XenBlockDeviceRealize realize
;
55 XenBlockDeviceUnrealize unrealize
;
56 } XenBlockDeviceClass
;
58 #define TYPE_XEN_BLOCK_DEVICE "xen-block"
59 #define XEN_BLOCK_DEVICE(obj) \
60 OBJECT_CHECK(XenBlockDevice, (obj), TYPE_XEN_BLOCK_DEVICE)
61 #define XEN_BLOCK_DEVICE_CLASS(class) \
62 OBJECT_CLASS_CHECK(XenBlockDeviceClass, (class), TYPE_XEN_BLOCK_DEVICE)
63 #define XEN_BLOCK_DEVICE_GET_CLASS(obj) \
64 OBJECT_GET_CLASS(XenBlockDeviceClass, (obj), TYPE_XEN_BLOCK_DEVICE)
66 typedef struct XenDiskDevice
{
67 XenBlockDevice blockdev
;
70 #define TYPE_XEN_DISK_DEVICE "xen-disk"
71 #define XEN_DISK_DEVICE(obj) \
72 OBJECT_CHECK(XenDiskDevice, (obj), TYPE_XEN_DISK_DEVICE)
74 typedef struct XenCDRomDevice
{
75 XenBlockDevice blockdev
;
78 #define TYPE_XEN_CDROM_DEVICE "xen-cdrom"
79 #define XEN_CDROM_DEVICE(obj) \
80 OBJECT_CHECK(XenCDRomDevice, (obj), TYPE_XEN_CDROM_DEVICE)
82 #endif /* HW_XEN_BLOCK_H */