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