#ifndef _SYS_XENCONS_H
#define _SYS_XENCONS_H
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/tty.h>
#include <sys/ksynch.h>
#include <sys/dditypes.h>
#include <xen/public/io/console.h>
#ifdef DEBUG
#define DEBUGWARN0(fac, format) \
if (debug & (fac)) \
cmn_err(CE_WARN, format)
#define DEBUGNOTE0(fac, format) \
if (debug & (fac)) \
cmn_err(CE_NOTE, format)
#define DEBUGNOTE1(fac, format, arg1) \
if (debug & (fac)) \
cmn_err(CE_NOTE, format, arg1)
#define DEBUGNOTE2(fac, format, arg1, arg2) \
if (debug & (fac)) \
cmn_err(CE_NOTE, format, arg1, arg2)
#define DEBUGNOTE3(fac, format, arg1, arg2, arg3) \
if (debug & (fac)) \
cmn_err(CE_NOTE, format, arg1, arg2, arg3)
#define DEBUGCONT0(fac, format) \
if (debug & (fac)) \
cmn_err(CE_CONT, format)
#define DEBUGCONT1(fac, format, arg1) \
if (debug & (fac)) \
cmn_err(CE_CONT, format, arg1)
#define DEBUGCONT2(fac, format, arg1, arg2) \
if (debug & (fac)) \
cmn_err(CE_CONT, format, arg1, arg2)
#define DEBUGCONT3(fac, format, arg1, arg2, arg3) \
if (debug & (fac)) \
cmn_err(CE_CONT, format, arg1, arg2, arg3)
#define DEBUGCONT4(fac, format, arg1, arg2, arg3, arg4) \
if (debug & (fac)) \
cmn_err(CE_CONT, format, arg1, arg2, arg3, arg4)
#define DEBUGCONT10(fac, format, \
arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) \
if (debug & (fac)) \
cmn_err(CE_CONT, format, \
arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10)
#else
#define DEBUGWARN0(fac, format)
#define DEBUGNOTE0(fac, format)
#define DEBUGNOTE1(fac, format, arg1)
#define DEBUGNOTE2(fac, format, arg1, arg2)
#define DEBUGNOTE3(fac, format, arg1, arg2, arg3)
#define DEBUGCONT0(fac, format)
#define DEBUGCONT1(fac, format, arg1)
#define DEBUGCONT2(fac, format, arg1, arg2)
#define DEBUGCONT3(fac, format, arg1, arg2, arg3)
#define DEBUGCONT4(fac, format, arg1, arg2, arg3, arg4)
#define DEBUGCONT10(fac, format, \
arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10)
#endif
typedef enum {
FLOW_CHECK,
FLOW_STOP,
FLOW_START
} async_flowc_action;
#define async_stopc async_ttycommon.t_stopc
#define async_startc async_ttycommon.t_startc
struct xencons {
int flags;
struct asyncline *priv;
dev_info_t *dip;
int unit;
kmutex_t excl;
kcondvar_t excl_cv;
struct cons_polledio polledio;
unsigned char pollbuf[60];
int polldix;
int polllen;
volatile struct xencons_interface *ifp;
int console_irq;
int evtchn;
};
struct asyncline {
int async_flags;
kcondvar_t async_flags_cv;
dev_t async_dev;
mblk_t *async_xmitblk;
struct xencons *async_common;
tty_common_t async_ttycommon;
bufcall_id_t async_wbufcid;
timeout_id_t async_polltid;
timeout_id_t async_dtrtid;
timeout_id_t async_utbrktid;
uchar_t *async_optr;
int async_ocnt;
ushort_t async_rput;
ushort_t async_rget;
int async_inflow_source;
union {
struct {
uchar_t _hw;
uchar_t _sw;
} _a;
ushort_t uover_overrun;
} async_uover;
#define async_overrun async_uover._a.uover_overrun
#define async_hw_overrun async_uover._a._hw
#define async_sw_overrun async_uover._a._sw
short async_ext;
short async_work;
};
#define ASYNC_EXCL_OPEN 0x10000000
#define ASYNC_WOPEN 0x00000001
#define ASYNC_ISOPEN 0x00000002
#define ASYNC_STOPPED 0x00000010
#define ASYNC_PROGRESS 0x00001000
#define ASYNC_CLOSING 0x00002000
#define ASYNC_SW_IN_FLOW 0x00020000
#define ASYNC_SW_OUT_FLW 0x00040000
#define ASYNC_SW_IN_NEEDED 0x00080000
#define ASYNC_OUT_FLW_RESUME 0x00100000
#define ASY_CONSOLE 0x00000080
#define IN_FLOW_NULL 0x00000000
#define IN_FLOW_STREAMS 0x00000002
#define IN_FLOW_USER 0x00000004
#define XENCONS_BURST 128
#ifdef __cplusplus
}
#endif
#endif