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 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, struct hv_ops *ops);
80
81
82extern struct hvc_struct * __devinit hvc_alloc(uint32_t vtermno, int data,
83 struct hv_ops *ops, int outbuf_size);
84
85extern int hvc_remove(struct hvc_struct *hp);
86
87
88int hvc_poll(struct hvc_struct *hp);
89void hvc_kick(void);
90
91
92extern void __hvc_resize(struct hvc_struct *hp, struct winsize ws);
93
94static inline void hvc_resize(struct hvc_struct *hp, struct winsize ws)
95{
96 unsigned long flags;
97
98 spin_lock_irqsave(&hp->lock, flags);
99 __hvc_resize(hp, ws);
100 spin_unlock_irqrestore(&hp->lock, flags);
101}
102
103
104extern int notifier_add_irq(struct hvc_struct *hp, int data);
105extern void notifier_del_irq(struct hvc_struct *hp, int data);
106extern void notifier_hangup_irq(struct hvc_struct *hp, int data);
107
108
109#if defined(CONFIG_XMON) && defined(CONFIG_SMP)
110#include <asm/xmon.h>
111#else
112static inline int cpus_are_in_xmon(void)
113{
114 return 0;
115}
116#endif
117
118#endif
119