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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58 #include <sys/timeout.h>
59
60 struct commulti_attach_args {
61 int ca_slave;
62
63 bus_space_tag_t ca_iot;
64 bus_space_handle_t ca_ioh;
65 int ca_iobase;
66 int ca_noien;
67 };
68
69 #define COM_IBUFSIZE (2 * 512)
70 #define COM_IHIGHWATER ((3 * COM_IBUFSIZE) / 4)
71
72 struct com_softc {
73 struct device sc_dev;
74 void *sc_ih;
75 bus_space_tag_t sc_iot;
76 struct tty *sc_tty;
77 struct timeout sc_dtr_tmo;
78 struct timeout sc_diag_tmo;
79 #ifdef __HAVE_GENERIC_SOFT_INTERRUPTS
80 void *sc_si;
81 #else
82 struct timeout sc_comsoft_tmo;
83 #endif
84
85 int sc_overflows;
86 int sc_floods;
87 int sc_errors;
88
89 int sc_halt;
90
91 bus_addr_t sc_iobase;
92 int sc_frequency;
93
94 bus_space_handle_t sc_ioh;
95
96 u_char sc_uarttype;
97 #define COM_UART_UNKNOWN 0x00
98 #define COM_UART_8250 0x01
99 #define COM_UART_16450 0x02
100 #define COM_UART_16550 0x03
101 #define COM_UART_16550A 0x04
102 #define COM_UART_ST16650 0x05
103 #define COM_UART_ST16650V2 0x06
104 #define COM_UART_TI16750 0x07
105 #define COM_UART_ST16C654 0x08
106 #define COM_UART_XR16850 0x10
107 #define COM_UART_PXA2X0 0x11
108 #define COM_UART_OX16C950 0x12
109
110 u_char sc_hwflags;
111 #define COM_HW_NOIEN 0x01
112 #define COM_HW_FIFO 0x02
113 #define COM_HW_SIR 0x20
114 #define COM_HW_CONSOLE 0x40
115 #define COM_HW_KGDB 0x80
116 u_char sc_swflags;
117 #define COM_SW_SOFTCAR 0x01
118 #define COM_SW_CLOCAL 0x02
119 #define COM_SW_CRTSCTS 0x04
120 #define COM_SW_MDMBUF 0x08
121 #define COM_SW_PPS 0x10
122 #define COM_SW_DEAD 0x20
123 int sc_fifolen;
124 u_char sc_msr, sc_mcr, sc_lcr, sc_ier;
125 u_char sc_dtr;
126
127 u_char sc_cua;
128
129 u_char sc_initialize;
130
131 u_char *sc_ibuf, *sc_ibufp, *sc_ibufhigh, *sc_ibufend;
132 u_char sc_ibufs[2][COM_IBUFSIZE];
133
134
135 int (*enable)(struct com_softc *);
136 void (*disable)(struct com_softc *);
137 int enabled;
138 };
139
140 int comprobe1(bus_space_tag_t, bus_space_handle_t);
141 int comstop(struct tty *, int);
142 int comintr(void *);
143 int com_detach(struct device *, int);
144 int com_activate(struct device *, enum devact);
145
146 void comdiag(void *);
147 int comspeed(long, long);
148 u_char com_cflag2lcr(tcflag_t);
149 int comparam(struct tty *, struct termios *);
150 void comstart(struct tty *);
151 void comsoft(void *);
152
153 struct consdev;
154 int comcnattach(bus_space_tag_t, bus_addr_t, int, int, tcflag_t);
155 void comcnprobe(struct consdev *);
156 void comcninit(struct consdev *);
157 int comcngetc(dev_t);
158 void comcnputc(dev_t, int);
159 void comcnpollc(dev_t, int);
160 int com_common_getc(bus_space_tag_t, bus_space_handle_t);
161 void com_common_putc(bus_space_tag_t, bus_space_handle_t, int);
162 void com_raisedtr(void *);
163
164 #ifdef KGDB
165 extern bus_addr_t com_kgdb_addr;
166 extern bus_space_tag_t com_kgdb_iot;
167 extern bus_space_handle_t com_kgdb_ioh;
168
169 int com_kgdb_attach(bus_space_tag_t, bus_addr_t, int, int, tcflag_t);
170 int kgdbintr(void *);
171 #endif
172
173 void com_attach_subr(struct com_softc *);
174
175 extern int comdefaultrate;
176 extern int comconsfreq;
177 extern bus_addr_t comconsaddr;
178 extern bus_addr_t comsiraddr;
179 extern int comconsinit;
180 extern int comconsattached;
181 extern bus_space_tag_t comconsiot;
182 extern bus_space_handle_t comconsioh;
183 extern tcflag_t comconscflag;