1 #ifndef QEMU_HW_XEN_PVDEV_H
2 #define QEMU_HW_XEN_PVDEV_H
4 #include "hw/xen/xen_common.h"
5 /* ------------------------------------------------------------- */
7 #define XEN_BUFSIZE 1024
11 /* driver uses grant tables -> open gntdev device (xendev->gnttabdev) */
12 #define DEVOPS_FLAG_NEED_GNTDEV 1
13 /* don't expect frontend doing correct state transitions (aka console quirk) */
14 #define DEVOPS_FLAG_IGNORE_STATE 2
19 void (*alloc
)(struct XenDevice
*xendev
);
20 int (*init
)(struct XenDevice
*xendev
);
21 int (*initialise
)(struct XenDevice
*xendev
);
22 void (*connected
)(struct XenDevice
*xendev
);
23 void (*event
)(struct XenDevice
*xendev
);
24 void (*disconnect
)(struct XenDevice
*xendev
);
25 int (*free
)(struct XenDevice
*xendev
);
26 void (*backend_changed
)(struct XenDevice
*xendev
, const char *node
);
27 void (*frontend_changed
)(struct XenDevice
*xendev
, const char *node
);
28 int (*backend_register
)(void);
39 enum xenbus_state be_state
;
40 enum xenbus_state fe_state
;
48 xenevtchn_handle
*evtchndev
;
49 xengnttab_handle
*gnttabdev
;
51 struct XenDevOps
*ops
;
52 QTAILQ_ENTRY(XenDevice
) next
;
55 /* ------------------------------------------------------------- */
57 /* xenstore helper functions */
58 int xenstore_write_str(const char *base
, const char *node
, const char *val
);
59 int xenstore_write_int(const char *base
, const char *node
, int ival
);
60 int xenstore_write_int64(const char *base
, const char *node
, int64_t ival
);
61 char *xenstore_read_str(const char *base
, const char *node
);
62 int xenstore_read_int(const char *base
, const char *node
, int *ival
);
63 int xenstore_read_uint64(const char *base
, const char *node
, uint64_t *uval
);
64 void xenstore_update(void *unused
);
66 const char *xenbus_strstate(enum xenbus_state state
);
68 void xen_pv_evtchn_event(void *opaque
);
69 void xen_pv_insert_xendev(struct XenDevice
*xendev
);
70 void xen_pv_del_xendev(struct XenDevice
*xendev
);
71 struct XenDevice
*xen_pv_find_xendev(const char *type
, int dom
, int dev
);
73 void xen_pv_unbind_evtchn(struct XenDevice
*xendev
);
74 int xen_pv_send_notify(struct XenDevice
*xendev
);
76 void xen_pv_printf(struct XenDevice
*xendev
, int msg_level
,
77 const char *fmt
, ...) GCC_FMT_ATTR(3, 4);
79 #endif /* QEMU_HW_XEN_PVDEV_H */