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