hw/arm/virt: fdt: generate distance-map when needed
[qemu/ar7.git] / include / hw / xen / xen_pvdev.h
blobd473e9b34d16747448aaf627c421ba0664e9b890
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 XenDevice;
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 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);
31 struct XenDevice {
32 DeviceState qdev;
33 const char *type;
34 int dom;
35 int dev;
36 char name[64];
37 int debug;
39 enum xenbus_state be_state;
40 enum xenbus_state fe_state;
41 int online;
42 char be[XEN_BUFSIZE];
43 char *fe;
44 char *protocol;
45 int remote_port;
46 int local_port;
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 */