Merge tag 'pull-loongarch-20241016' of https://gitlab.com/gaosong/qemu into staging
[qemu/armbru.git] / include / hw / xen / xen-block.h
blobd692ea7580255ddfe1f7fbcd1a444d4dfdcca278
1 /*
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.
6 */
8 #ifndef HW_XEN_BLOCK_H
9 #define HW_XEN_BLOCK_H
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"
15 #include "qom/object.h"
17 typedef enum XenBlockVdevType {
18 XEN_BLOCK_VDEV_TYPE_INVALID,
19 XEN_BLOCK_VDEV_TYPE_DP,
20 XEN_BLOCK_VDEV_TYPE_XVD,
21 XEN_BLOCK_VDEV_TYPE_HD,
22 XEN_BLOCK_VDEV_TYPE_SD,
23 XEN_BLOCK_VDEV_TYPE__MAX
24 } XenBlockVdevType;
26 typedef struct XenBlockVdev {
27 XenBlockVdevType type;
28 unsigned long disk;
29 unsigned long partition;
30 unsigned long number;
31 } XenBlockVdev;
34 typedef struct XenBlockProperties {
35 XenBlockVdev vdev;
36 BlockConf conf;
37 unsigned int max_ring_page_order;
38 IOThread *iothread;
39 } XenBlockProperties;
41 typedef struct XenBlockDrive {
42 char *id;
43 char *node_name;
44 } XenBlockDrive;
46 typedef struct XenBlockIOThread {
47 char *id;
48 } XenBlockIOThread;
50 struct XenBlockDevice {
51 XenDevice xendev;
52 XenBlockProperties props;
53 const char *device_type;
54 unsigned int info;
55 XenBlockDataPlane *dataplane;
56 XenBlockDrive *drive;
57 XenBlockIOThread *iothread;
59 typedef struct XenBlockDevice XenBlockDevice;
61 typedef void (*XenBlockDeviceRealize)(XenBlockDevice *blockdev, Error **errp);
62 typedef void (*XenBlockDeviceUnrealize)(XenBlockDevice *blockdev);
64 struct XenBlockDeviceClass {
65 /*< private >*/
66 XenDeviceClass parent_class;
67 /*< public >*/
68 XenBlockDeviceRealize realize;
69 XenBlockDeviceUnrealize unrealize;
72 #define TYPE_XEN_BLOCK_DEVICE "xen-block"
73 OBJECT_DECLARE_TYPE(XenBlockDevice, XenBlockDeviceClass, XEN_BLOCK_DEVICE)
75 struct XenDiskDevice {
76 XenBlockDevice blockdev;
79 #define TYPE_XEN_DISK_DEVICE "xen-disk"
80 OBJECT_DECLARE_SIMPLE_TYPE(XenDiskDevice, XEN_DISK_DEVICE)
82 struct XenCDRomDevice {
83 XenBlockDevice blockdev;
86 #define TYPE_XEN_CDROM_DEVICE "xen-cdrom"
87 OBJECT_DECLARE_SIMPLE_TYPE(XenCDRomDevice, XEN_CDROM_DEVICE)
89 #endif /* HW_XEN_BLOCK_H */