Correct BSD License clause numbering from 1-2-4 to 1-2-3.
[dragonfly.git] / share / man / man4 / sio.4
1 .\" Copyright (c) 1990, 1991 The Regents of the University of California.
2 .\" All rights reserved.
3 .\"
4 .\" This code is derived from software contributed to Berkeley by
5 .\" the Systems Programming Group of the University of Utah Computer
6 .\" Science Department.
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
9 .\" are met:
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\"    notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\"    notice, this list of conditions and the following disclaimer in the
14 .\"    documentation and/or other materials provided with the distribution.
15 .\" 3. Neither the name of the University nor the names of its contributors
16 .\"    may be used to endorse or promote products derived from this software
17 .\"    without specific prior written permission.
18 .\"
19 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 .\" SUCH DAMAGE.
30 .\"
31 .\"     from: @(#)dca.4 5.2 (Berkeley) 3/27/91
32 .\"     from: com.4,v 1.1 1993/08/06 11:19:07 cgd Exp
33 .\" $FreeBSD: src/share/man/man4/sio.4,v 1.34.2.4 2002/12/18 13:31:17 keramida Exp $
34 .\" $DragonFly: src/share/man/man4/sio.4,v 1.3 2007/12/16 02:55:38 thomas Exp $
35 .\"
36 .Dd October 10, 1995
37 .Dt SIO 4
38 .Os
39 .Sh NAME
40 .Nm sio
41 .Nd "fast interrupt driven asynchronous serial communications interface"
42 .Sh SYNOPSIS
43 For standard ports:
44 .Cd "device sio0 at isa? port IO_COM1 irq 4"
45 .Cd "device sio1 at isa? port IO_COM2 irq 3"
46 .Cd "device sio2 at isa? port IO_COM3 irq 5"
47 .Cd "device sio3 at isa? port IO_COM4 irq 9"
48 .Pp
49 For AST compatible multiport cards with 4 ports:
50 .Cd "options COM_MULTIPORT"
51 .Cd "device sio4 at isa? port 0x2a0 flags 0x701"
52 .Cd "device sio5 at isa? port 0x2a8 flags 0x701"
53 .Cd "device sio6 at isa? port 0x2b0 flags 0x701"
54 .Cd "device sio7 at isa? port 0x2b8 flags 0x701 irq 12"
55 .Pp
56 For Boca Board compatible multiport cards with 8 ports:
57 .Cd "options COM_MULTIPORT"
58 .Cd "device sio4 at isa? port 0x100 flags 0xb05"
59 .Cd "..."
60 .Cd "device sio11 at isa? port 0x138 flags 0xb05 irq 12"
61 .Pp
62 For Netmos Nm9845 multiport cards with 6 ports:
63 .Cd "options COM_MULTIPORT"
64 .Cd "device sio4 at isa? port 0xb000 flags 0x901"
65 .Cd "device sio5 at isa? port 0xb400 flags 0x901"
66 .Cd "device sio6 at isa? port 0xb800 flags 0x901"
67 .Cd "device sio7 at isa? port 0xbc00 flags 0x901"
68 .Cd "device sio8 at isa? port 0xc000 flags 0x901"
69 .Cd "device sio9 at isa? port 0xac00 flags 0x901 irq 12"
70 .Pp
71 For Hayes ESP cards:
72 .Cd "options COM_ESP"
73 .Cd "..."
74 .Pp
75 Meaning of
76 .Ar flags :
77 .Bl -tag -offset indent -compact -width 0x000000
78 .It 0x00001
79 shared IRQs
80 .It 0x00002
81 disable FIFO
82 .It 0x00004
83 no AST/4 compatible IRQ control register
84 .It 0x00008
85 recover sooner from lost output interrupts
86 .It 0x00010
87 device is potential system console
88 .It 0x00020
89 device is forced to become system console
90 .It 0x00040
91 device is reserved for low-level IO (e. g. for remote kernel debugging)
92 .It 0x00080
93 use this port for remote kernel debugging
94 .It 0x0 Ns Em ?? Ns 00
95 minor number of master port
96 .It 0x20000
97 device is assumed to use a 16650A-type (extended FIFO) chip
98 .El
99 .Pp
100 Minor numbering:
101 .Bd -literal
102 0b\fIOLIMMMMM\fR
103   call\fBO\fRut
104    \fBL\fRock
105     \fBI\fRnitial
106      \fBMMMMM\fRinor
107 .Ed
108 .Sh DESCRIPTION
109 The
110 .Nm
111 driver provides support for NS8250-, NS16450-, NS16550 and NS16550A-based
112 .Tn EIA
113 .Tn RS-232C
114 .Pf ( Tn CCITT
115 .Tn V.24 )
116 communications interfaces.  The NS8250 and NS16450 have single character
117 buffers, the NS16550A has 16 character FIFO input and output buffers.
118 .Pp
119 Input and output for each line may set to one of following baud rates;
120 50, 75, 110, 134.5, 150, 300, 600, 1200, 1800, 2400, 4800, 9600,
121 19200, 38400, 57600, or 115200. Your hardware may limit your baud
122 rate choices.
123 .Pp
124 The driver supports `multiport' cards.
125 Multiport cards are those that have one or more groups of ports
126 that share an Interrupt Request (IRQ) line per group.
127 Shared IRQs on different cards are not supported.
128 Frequently 4 ports share 1 IRQ; some 8 port cards have 2 groups of 4 ports,
129 thus using 2 IRQs.
130 Some cards allow the first 2 serial ports to have separate IRQs per port
131 (as per DOS PC standard).
132 .Pp
133 Some cards have an IRQ control register for each group.
134 Some cards require special initialization related to such registers.
135 Only AST/4 compatible IRQ control registers are supported.
136 Some cards have an IRQ status register for each group.
137 The driver does not require or use such registers yet.
138 To work, the control and status registers for a group, if any,
139 must be mapped to the scratch register (register 7)
140 of a port in the group.
141 Such a port is called a
142 .Em master
143 port.
144 .Pp
145 The
146 .Em flags
147 keyword may be used on each
148 .Em device sio
149 line in the kernel configuration file
150 to disable the FIFO on 16550A UARTs
151 (see the synopsis).
152 Disabling the FIFO should rarely be necessary.
153 .Pp
154 The
155 .Em flags
156 keyword
157 .Em must
158 be used for all ports that are part of an IRQ sharing group.
159 One bit specifies IRQ sharing; another bit specifies whether the port does
160 .Em not
161 require AST/4 compatible initialization.
162 The minor number of the device corresponding a master port
163 for the group is encoded as a bitfield in the high byte.
164 The same master port must be specified for all ports in a group.
165 .Pp
166 The
167 .Em irq
168 specification must be given for master ports
169 and for ports that are not part of an IRQ sharing group,
170 and not for other ports.
171 .Pp
172 In the synopsis,
173 .Em flags 0x701
174 means that the 8th port (sio7) is the master
175 port, and that the port is on a multiport card with shared IRQs
176 and an AST/4 compatible IRQ control register.
177 .Pp
178 .Em flags 0xb05
179 means that the 12th port (sio11) is the master
180 port, and that the port is on a multiport card with shared IRQs
181 and no special IRQ control register.
182 .Pp
183 Which port is the master port depends on the card type.
184 Consult the hardware documentation of your card.
185 Since IRQ status registers are never used,
186 and IRQ control registers are only used for AST/4 compatible cards,
187 and some cards map the control/status registers to all ports in a group,
188 any port in a group will sometimes do for the master port.
189 Choose a port containing an IRQ status register for forwards compatibility,
190 and the highest possible port for consistency.
191 .Pp
192 Serial ports controlled by the
193 .Nm
194 driver can be used for both `callin' and `callout'.
195 For each port there is a callin device and a callout device.
196 The minor number of the callout device is 128 higher
197 than that of the corresponding callin port.
198 The callin device is general purpose.
199 Processes opening it normally wait for carrier
200 and for the callout device to become inactive.
201 The callout device is used to steal the port from
202 processes waiting for carrier on the callin device.
203 Processes opening it do not wait for carrier
204 and put any processes waiting for carrier on the callin device into
205 a deeper sleep so that they do not conflict with the callout session.
206 The callout device is abused for handling programs that are supposed
207 to work on general ports and need to open the port without waiting
208 but are too stupid to do so.
209 .Pp
210 The
211 .Nm
212 driver also supports an initial-state and a lock-state control
213 device for each of the callin and the callout "data" devices.
214 The minor number of the initial-state device is 32 higher
215 than that of the corresponding data device.
216 The minor number of the lock-state device is 64 higher
217 than that of the corresponding data device.
218 The termios settings of a data device are copied
219 from those of the corresponding initial-state device
220 on first opens and are not inherited from previous opens.
221 Use
222 .Xr stty 1
223 in the normal way on the initial-state devices to program
224 initial termios states suitable for your setup.
225 .Pp
226 The lock termios state acts as flags to disable changing
227 the termios state.  E.g., to lock a flag variable such as
228 CRTSCTS, use
229 .Em stty crtscts
230 on the lock-state device.  Speeds and special characters
231 may be locked by setting the corresponding value in the lock-state
232 device to any nonzero value.
233 .Pp
234 Correct programs talking to correctly wired external devices
235 work with almost arbitrary initial states and almost no locking,
236 but other setups may benefit from changing some of the default
237 initial state and locking the state.
238 In particular, the initial states for non (POSIX) standard flags
239 should be set to suit the devices attached and may need to be
240 locked to prevent buggy programs from changing them.
241 E.g., CRTSCTS should be locked on for devices that support
242 RTS/CTS handshaking at all times and off for devices that don't
243 support it at all.  CLOCAL should be locked on for devices
244 that don't support carrier.  HUPCL may be locked off if you don't
245 want to hang up for some reason.  In general, very bad things happen
246 if something is locked to the wrong state, and things should not
247 be locked for devices that support more than one setting.  The
248 CLOCAL flag on callin ports should be locked off for logins
249 to avoid certain security holes, but this needs to be done by
250 getty if the callin port is used for anything else.
251 .Sh FILES
252 .Bl -tag -width /dev/ttyid? -compact
253 .It Pa /dev/ttyd?
254 for callin ports
255 .It Pa /dev/ttyid?
256 .It Pa /dev/ttyld?
257 corresponding callin initial-state and lock-state devices
258 .Pp
259 .It Pa /dev/cuaa?
260 for callout ports
261 .It Pa /dev/cuaia?
262 .It Pa /dev/cuala?
263 corresponding callout initial-state and lock-state devices
264 .El
265 .Pp
266 .Bl -tag -width /etc/rc.d/serial -compact
267 .It Pa /etc/rc.d/serial
268 examples of setting the initial-state and lock-state devices
269 .El
270 .Pp
271 The device numbers are made from the set [0-9a-v] so that more than
272 10 ports can be supported.
273 .Sh DIAGNOSTICS
274 .Bl -diag
275 .It sio%d: silo overflow.
276 Problem in the interrupt handler.
277 .El
278 .Bl -diag
279 .It sio%d: interrupt-level buffer overflow.
280 Problem in the bottom half of the driver.
281 .El
282 .Bl -diag
283 .It sio%d: tty-level buffer overflow.
284 Problem in the application.
285 Input has arrived faster than the given module could process it
286 and some has been lost.
287 .El
288 .\" .Bl -diag
289 .\" .It sio%d: reduced fifo trigger level to %d.
290 .\" Attempting to avoid further silo overflows.
291 .\" .El
292 .Sh SEE ALSO
293 .Xr stty 1 ,
294 .Xr termios 4 ,
295 .Xr tty 4 ,
296 .Xr comcontrol 8
297 .Sh HISTORY
298 The
299 .Nm
300 driver is derived from the
301 .Tn HP9000/300
302 .Xr dca 4
303 driver and is
304 .Ud
305 .Sh BUGS
306 Data loss may occur at very high baud rates on slow systems,
307 or with too many ports on any system,
308 or on heavily loaded systems when crtscts cannot be used.
309 The use of NS16550A's reduces system load and helps to avoid data loss.
310 .Pp
311 Stay away from plain NS16550's. These are early
312 implementations of the chip with non-functional FIFO hardware.
313 .Pp
314 The constants which define the locations
315 of the various serial ports are holdovers from
316 .Tn DOS .
317 As shown, hex addresses can be and for clarity probably should be used instead.
318 .Pp
319 Note that on the AST/4 the card's dipswitches should
320 .Em not
321 be set to use interrupt sharing.
322 AST/4-like interrupt sharing is only used when
323 .Em multiple
324 AST/4 cards are installed in the same system.  The sio driver does not
325 support more than 1 AST/4 on one IRQ.
326 .Pp
327 The examples in the synopsis are too vendor-specific.