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 spinlock_t lock;
50 int index;
51 struct tty_struct *tty;
52 int count;
53 int do_wakeup;
54 char *outbuf;
55 int outbuf_size;
56 int n_outbuf;
57 uint32_t vtermno;
58 const struct hv_ops *ops;
59 int irq_requested;
60 int data;
61 struct winsize ws;
62 struct work_struct tty_resize;
63 struct list_head next;
64 struct kref kref;
65};
66
67
68struct hv_ops {
69 int (*get_chars)(uint32_t vtermno, char *buf, int count);
70 int (*put_chars)(uint32_t vtermno, const char *buf, int count);
71
72
73 int (*notifier_add)(struct hvc_struct *hp, int irq);
74 void (*notifier_del)(struct hvc_struct *hp, int irq);
75 void (*notifier_hangup)(struct hvc_struct *hp, int irq);
76};
77
78
79extern int hvc_instantiate(uint32_t vtermno, int index,
80 const struct hv_ops *ops);
81
82
83extern struct hvc_struct * hvc_alloc(uint32_t vtermno, int data,
84 const struct hv_ops *ops, int outbuf_size);
85
86extern int hvc_remove(struct hvc_struct *hp);
87
88
89int hvc_poll(struct hvc_struct *hp);
90void hvc_kick(void);
91
92
93extern void __hvc_resize(struct hvc_struct *hp, struct winsize ws);
94
95static inline void hvc_resize(struct hvc_struct *hp, struct winsize ws)
96{
97 unsigned long flags;
98
99 spin_lock_irqsave(&hp->lock, flags);
100 __hvc_resize(hp, ws);
101 spin_unlock_irqrestore(&hp->lock, flags);
102}
103
104
105extern int notifier_add_irq(struct hvc_struct *hp, int data);
106extern void notifier_del_irq(struct hvc_struct *hp, int data);
107extern void notifier_hangup_irq(struct hvc_struct *hp, int data);
108
109
110#if defined(CONFIG_XMON) && defined(CONFIG_SMP)
111#include <asm/xmon.h>
112#else
113static inline int cpus_are_in_xmon(void)
114{
115 return 0;
116}
117#endif
118
119#endif
120