0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef HVC_CONSOLE_H
0015 #define HVC_CONSOLE_H
0016 #include <linux/kref.h>
0017 #include <linux/tty.h>
0018 #include <linux/spinlock.h>
0019
0020
0021
0022
0023
0024
0025 #define MAX_NR_HVC_CONSOLES 16
0026
0027
0028
0029
0030
0031
0032
0033 #define HVC_ALLOC_TTY_ADAPTERS 8
0034
0035 struct hvc_struct {
0036 struct tty_port port;
0037 spinlock_t lock;
0038 int index;
0039 int do_wakeup;
0040 char *outbuf;
0041 int outbuf_size;
0042 int n_outbuf;
0043 uint32_t vtermno;
0044 const struct hv_ops *ops;
0045 int irq_requested;
0046 int data;
0047 struct winsize ws;
0048 struct work_struct tty_resize;
0049 struct list_head next;
0050 unsigned long flags;
0051 };
0052
0053
0054 struct hv_ops {
0055 int (*get_chars)(uint32_t vtermno, char *buf, int count);
0056 int (*put_chars)(uint32_t vtermno, const char *buf, int count);
0057 int (*flush)(uint32_t vtermno, bool wait);
0058
0059
0060 int (*notifier_add)(struct hvc_struct *hp, int irq);
0061 void (*notifier_del)(struct hvc_struct *hp, int irq);
0062 void (*notifier_hangup)(struct hvc_struct *hp, int irq);
0063
0064
0065 int (*tiocmget)(struct hvc_struct *hp);
0066 int (*tiocmset)(struct hvc_struct *hp, unsigned int set, unsigned int clear);
0067
0068
0069 void (*dtr_rts)(struct hvc_struct *hp, int raise);
0070 };
0071
0072
0073 extern int hvc_instantiate(uint32_t vtermno, int index,
0074 const struct hv_ops *ops);
0075
0076
0077 extern struct hvc_struct * hvc_alloc(uint32_t vtermno, int data,
0078 const struct hv_ops *ops, int outbuf_size);
0079
0080 extern int hvc_remove(struct hvc_struct *hp);
0081
0082
0083 int hvc_poll(struct hvc_struct *hp);
0084 void hvc_kick(void);
0085
0086
0087 extern void __hvc_resize(struct hvc_struct *hp, struct winsize ws);
0088
0089 static inline void hvc_resize(struct hvc_struct *hp, struct winsize ws)
0090 {
0091 unsigned long flags;
0092
0093 spin_lock_irqsave(&hp->lock, flags);
0094 __hvc_resize(hp, ws);
0095 spin_unlock_irqrestore(&hp->lock, flags);
0096 }
0097
0098
0099 extern int notifier_add_irq(struct hvc_struct *hp, int data);
0100 extern void notifier_del_irq(struct hvc_struct *hp, int data);
0101 extern void notifier_hangup_irq(struct hvc_struct *hp, int data);
0102
0103
0104 #if defined(CONFIG_XMON) && defined(CONFIG_SMP)
0105 #include <asm/xmon.h>
0106 #else
0107 static inline int cpus_are_in_xmon(void)
0108 {
0109 return 0;
0110 }
0111 #endif
0112
0113 #endif