MAINTAINERS: Make section QOM cover hw/core/*bus.c as well
[qemu/armbru.git] / include / hw / xen / xen_pvdev.h
blob83e5174d902951cff64c87dfcc82f62af0b7d9b5
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
9 struct XenLegacyDevice;
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
16 struct XenDevOps {
17 size_t size;
18 uint32_t flags;
19 void (*alloc)(struct XenLegacyDevice *xendev);
20 int (*init)(struct XenLegacyDevice *xendev);
21 int (*initialise)(struct XenLegacyDevice *xendev);
22 void (*connected)(struct XenLegacyDevice *xendev);
23 void (*event)(struct XenLegacyDevice *xendev);
24 void (*disconnect)(struct XenLegacyDevice *xendev);
25 int (*free)(struct XenLegacyDevice *xendev);
26 void (*backend_changed)(struct XenLegacyDevice *xendev,
27 const char *node);
28 void (*frontend_changed)(struct XenLegacyDevice *xendev,
29 const char *node);
30 int (*backend_register)(void);
33 struct XenLegacyDevice {
34 DeviceState qdev;
35 const char *type;
36 int dom;
37 int dev;
38 char name[64];
39 int debug;
41 enum xenbus_state be_state;
42 enum xenbus_state fe_state;
43 int online;
44 char be[XEN_BUFSIZE];
45 char *fe;
46 char *protocol;
47 int remote_port;
48 int local_port;
50 xenevtchn_handle *evtchndev;
51 xengnttab_handle *gnttabdev;
53 struct XenDevOps *ops;
54 QTAILQ_ENTRY(XenLegacyDevice) next;
57 /* ------------------------------------------------------------- */
59 /* xenstore helper functions */
60 int xenstore_write_str(const char *base, const char *node, const char *val);
61 int xenstore_write_int(const char *base, const char *node, int ival);
62 int xenstore_write_int64(const char *base, const char *node, int64_t ival);
63 char *xenstore_read_str(const char *base, const char *node);
64 int xenstore_read_int(const char *base, const char *node, int *ival);
65 int xenstore_read_uint64(const char *base, const char *node, uint64_t *uval);
66 void xenstore_update(void *unused);
68 const char *xenbus_strstate(enum xenbus_state state);
70 void xen_pv_evtchn_event(void *opaque);
71 void xen_pv_insert_xendev(struct XenLegacyDevice *xendev);
72 void xen_pv_del_xendev(struct XenLegacyDevice *xendev);
73 struct XenLegacyDevice *xen_pv_find_xendev(const char *type, int dom, int dev);
75 void xen_pv_unbind_evtchn(struct XenLegacyDevice *xendev);
76 int xen_pv_send_notify(struct XenLegacyDevice *xendev);
78 void xen_pv_printf(struct XenLegacyDevice *xendev, int msg_level,
79 const char *fmt, ...) GCC_FMT_ATTR(3, 4);
81 #endif /* QEMU_HW_XEN_PVDEV_H */