1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27#ifndef HVC_CONSOLE_H
28#define HVC_CONSOLE_H
29#include <linux/kref.h>
30#include <linux/tty.h>
31#include <linux/spinlock.h>
32
33
34
35
36
37
38#define MAX_NR_HVC_CONSOLES 16
39
40
41
42
43
44
45
46#define HVC_ALLOC_TTY_ADAPTERS 8
47
48struct hvc_struct {
49 struct tty_port port;
50 spinlock_t lock;
51 int index;
52 int do_wakeup;
53 char *outbuf;
54 int outbuf_size;
55 int n_outbuf;
56 uint32_t vtermno;
57 const struct hv_ops *ops;
58 int irq_requested;
59 int data;
60 struct winsize ws;
61 struct work_struct tty_resize;
62 struct list_head next;
63};
64
65
66struct hv_ops {
67 int (*get_chars)(uint32_t vtermno, char *buf, int count);
68 int (*put_chars)(uint32_t vtermno, const char *buf, int count);
69
70
71 int (*notifier_add)(struct hvc_struct *hp, int irq);
72 void (*notifier_del)(struct hvc_struct *hp, int irq);
73 void (*notifier_hangup)(struct hvc_struct *hp, int irq);
74
75
76 int (*tiocmget)(struct hvc_struct *hp);
77 int (*tiocmset)(struct hvc_struct *hp, unsigned int set, unsigned int clear);
78
79
80 void (*dtr_rts)(struct hvc_struct *hp, int raise);
81};
82
83
84extern int hvc_instantiate(uint32_t vtermno, int index,
85 const struct hv_ops *ops);
86
87
88extern struct hvc_struct * hvc_alloc(uint32_t vtermno, int data,
89 const struct hv_ops *ops, int outbuf_size);
90
91extern int hvc_remove(struct hvc_struct *hp);
92
93
94int hvc_poll(struct hvc_struct *hp);
95void hvc_kick(void);
96
97
98extern void __hvc_resize(struct hvc_struct *hp, struct winsize ws);
99
100static inline void hvc_resize(struct hvc_struct *hp, struct winsize ws)
101{
102 unsigned long flags;
103
104 spin_lock_irqsave(&hp->lock, flags);
105 __hvc_resize(hp, ws);
106 spin_unlock_irqrestore(&hp->lock, flags);
107}
108
109
110extern int notifier_add_irq(struct hvc_struct *hp, int data);
111extern void notifier_del_irq(struct hvc_struct *hp, int data);
112extern void notifier_hangup_irq(struct hvc_struct *hp, int data);
113
114
115#if defined(CONFIG_XMON) && defined(CONFIG_SMP)
116#include <asm/xmon.h>
117#else
118static inline int cpus_are_in_xmon(void)
119{
120 return 0;
121}
122#endif
123
124#endif
125