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 unsigned long flags;
64};
65
66
67struct hv_ops {
68 int (*get_chars)(uint32_t vtermno, char *buf, int count);
69 int (*put_chars)(uint32_t vtermno, const char *buf, int count);
70
71
72 int (*notifier_add)(struct hvc_struct *hp, int irq);
73 void (*notifier_del)(struct hvc_struct *hp, int irq);
74 void (*notifier_hangup)(struct hvc_struct *hp, int irq);
75
76
77 int (*tiocmget)(struct hvc_struct *hp);
78 int (*tiocmset)(struct hvc_struct *hp, unsigned int set, unsigned int clear);
79
80
81 void (*dtr_rts)(struct hvc_struct *hp, int raise);
82};
83
84
85extern int hvc_instantiate(uint32_t vtermno, int index,
86 const struct hv_ops *ops);
87
88
89extern struct hvc_struct * hvc_alloc(uint32_t vtermno, int data,
90 const struct hv_ops *ops, int outbuf_size);
91
92extern int hvc_remove(struct hvc_struct *hp);
93
94
95int hvc_poll(struct hvc_struct *hp);
96void hvc_kick(void);
97
98
99extern void __hvc_resize(struct hvc_struct *hp, struct winsize ws);
100
101static inline void hvc_resize(struct hvc_struct *hp, struct winsize ws)
102{
103 unsigned long flags;
104
105 spin_lock_irqsave(&hp->lock, flags);
106 __hvc_resize(hp, ws);
107 spin_unlock_irqrestore(&hp->lock, flags);
108}
109
110
111extern int notifier_add_irq(struct hvc_struct *hp, int data);
112extern void notifier_del_irq(struct hvc_struct *hp, int data);
113extern void notifier_hangup_irq(struct hvc_struct *hp, int data);
114
115
116#if defined(CONFIG_XMON) && defined(CONFIG_SMP)
117#include <asm/xmon.h>
118#else
119static inline int cpus_are_in_xmon(void)
120{
121 return 0;
122}
123#endif
124
125#endif
126