xen: Rename xen_be_printf to xen_pv_printf
[qemu/kevin.git] / include / hw / xen / xen_pvdev.h
blob7aedc91a2a7c6c4912854e02ba596add2038f71e
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 const char *type;
33 int dom;
34 int dev;
35 char name[64];
36 int debug;
38 enum xenbus_state be_state;
39 enum xenbus_state fe_state;
40 int online;
41 char be[XEN_BUFSIZE];
42 char *fe;
43 char *protocol;
44 int remote_port;
45 int local_port;
47 xenevtchn_handle *evtchndev;
48 xengnttab_handle *gnttabdev;
50 struct XenDevOps *ops;
51 QTAILQ_ENTRY(XenDevice) next;
54 /* ------------------------------------------------------------- */
56 /* xenstore helper functions */
57 int xenstore_write_str(const char *base, const char *node, const char *val);
58 int xenstore_write_int(const char *base, const char *node, int ival);
59 int xenstore_write_int64(const char *base, const char *node, int64_t ival);
60 char *xenstore_read_str(const char *base, const char *node);
61 int xenstore_read_int(const char *base, const char *node, int *ival);
62 int xenstore_read_uint64(const char *base, const char *node, uint64_t *uval);
63 void xenstore_update(void *unused);
65 const char *xenbus_strstate(enum xenbus_state state);
67 void xen_be_evtchn_event(void *opaque);
68 void xen_pv_insert_xendev(struct XenDevice *xendev);
69 void xen_be_del_xendev(struct XenDevice *xendev);
70 struct XenDevice *xen_be_find_xendev(const char *type, int dom, int dev);
72 void xen_be_unbind_evtchn(struct XenDevice *xendev);
73 int xen_be_send_notify(struct XenDevice *xendev);
75 void xen_pv_printf(struct XenDevice *xendev, int msg_level,
76 const char *fmt, ...) GCC_FMT_ATTR(3, 4);
78 #endif /* QEMU_HW_XEN_PVDEV_H */