]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/man/man4/sio.4
This commit was generated by cvs2svn to compensate for changes in r146299,
[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 17, 2004
40 .Dt SIO 4
41 .Os
42 .Sh NAME
43 .Nm sio
44 .Nd "fast interrupt driven asynchronous serial communications interface"
45 .Sh SYNOPSIS
46 For standard ISA ports:
47 .Bd -ragged -offset indent -compact
48 .Cd "device sio"
49 .Pp
50 In
51 .Pa /boot/device.hints :
52 .Cd hint.sio.0.at="isa"
53 .Cd hint.sio.0.port="0x3f8"
54 .Cd hint.sio.0.flags="0x10"
55 .Cd hint.sio.0.irq="4"
56 .Cd hint.sio.1.at="isa"
57 .Cd hint.sio.1.port="0x2f8"
58 .Cd hint.sio.1.flags="0x0"
59 .Cd hint.sio.1.irq="3"
60 .Ed
61 .Pp
62 For AST compatible multiport cards with 4 ports:
63 .Bd -ragged -offset indent -compact
64 .Cd "options COM_MULTIPORT"
65 .Cd "device sio"
66 .Pp
67 In
68 .Pa /boot/device.hints :
69 .Cd hint.sio.4.at="isa"
70 .Cd hint.sio.4.port="0x2a0"
71 .Cd hint.sio.4.flags="0x701"
72 .Cd hint.sio.5.at="isa"
73 .Cd hint.sio.5.port="0x2a8"
74 .Cd hint.sio.5.flags="0x701"
75 .Cd hint.sio.6.at="isa"
76 .Cd hint.sio.6.port="0x2b0"
77 .Cd hint.sio.6.flags="0x701"
78 .Cd hint.sio.7.at="isa"
79 .Cd hint.sio.7.port="0x2b8"
80 .Cd hint.sio.7.flags="0x701"
81 .Cd hint.sio.7.irq="12"
82 .Ed
83 .Pp
84 For Boca Board compatible multiport cards with 8 ports:
85 .Bd -ragged -offset indent -compact
86 .Cd "options COM_MULTIPORT"
87 .Cd "device sio"
88 .Pp
89 In
90 .Pa /boot/device.hints :
91 .Cd hint.sio.4.at="isa"
92 .Cd hint.sio.4.port="0x100"
93 .Cd hint.sio.4.flags="0xb05"
94 .Cd "..."
95 .Cd hint.sio.11.at="isa"
96 .Cd hint.sio.11.port="0x138"
97 .Cd hint.sio.11.flags="0xb05"
98 .Cd hint.sio.11.irq="12"
99 .Ed
100 .Pp
101 For Netmos Nm9845 multiport cards with 6 ports:
102 .Bd -ragged -offset indent -compact
103 .Cd "options COM_MULTIPORT"
104 .Cd "device sio"
105 .Pp
106 In
107 .Pa /boot/device.hints :
108 .Cd hint.sio.4.at="isa"
109 .Cd hint.sio.4.port="0xb000"
110 .Cd hint.sio.4.flags="0x901"
111 .Cd hint.sio.5.at="isa"
112 .Cd hint.sio.5.port="0xb400"
113 .Cd hint.sio.5.flags="0x901"
114 .Cd hint.sio.6.at="isa"
115 .Cd hint.sio.6.port="0xb800"
116 .Cd hint.sio.6.flags="0x901"
117 .Cd hint.sio.7.at="isa"
118 .Cd hint.sio.7.port="0xbc00"
119 .Cd hint.sio.7.flags="0x901"
120 .Cd hint.sio.8.at="isa"
121 .Cd hint.sio.8.port="0xc000"
122 .Cd hint.sio.8.flags="0x901"
123 .Cd hint.sio.9.at="isa"
124 .Cd hint.sio.9.port="0xac00"
125 .Cd hint.sio.9.flags="0x901"
126 .Cd hint.sio.9.irq="12"
127 .Ed
128 .Pp
129 For Hayes ESP cards:
130 .Bd -ragged -offset indent -compact
131 .Cd "options COM_ESP"
132 .Cd "device sio"
133 .Cd "..."
134 .Ed
135 .Pp
136 For single port PCI and PCCARD cards:
137 .Bd -ragged -offset indent -compact
138 .Cd "device sio"
139 .Pp
140 No lines are required in
141 .Pa /boot/device.hints
142 for these cards.
143 .Ed
144 .Pp
145 For dual port PCI cards that share an interrupt:
146 .Bd -ragged -offset indent -compact
147 .Cd "device sio"
148 .Cd "options COM_MULTIPORT"
149 .Pp
150 In
151 .Pa /boot/device.hints :
152 .Cd hint.sio.2.flags="0x201"
153 .Cd hint.sio.3.flags="0x201"
154 .Ed
155 .Pp
156 Meaning of
157 .Ar flags :
158 .Bl -tag -offset indent -compact -width 0x000000
159 .It 0x00001
160 shared IRQs
161 .It 0x00002
162 disable FIFO
163 .It 0x00004
164 no AST/4 compatible IRQ control register
165 .It 0x00008
166 recover sooner from lost output interrupts
167 .It 0x00010
168 device is potential system console
169 .It 0x00020
170 device is forced to become system console
171 .It 0x00040
172 device is reserved for low-level IO (e.g.\& for remote kernel debugging)
173 .It 0x00080
174 use this port for remote kernel debugging
175 .It 0x0 Ns Em ?? Ns 00
176 minor number of master port
177 .It 0x10000
178 PPS timestamping on CTS instead of DCD
179 .It 0x20000
180 device is assumed to use a 16650A-type (extended FIFO) chip
181 .El
182 .Pp
183 Minor numbering:
184 .Bd -literal -offset indent -compact
185 0b\fIOLIMMMMM\fR
186   call\fBO\fRut
187    \fBL\fRock
188     \fBI\fRnitial
189      \fBMMMMM\fRinor
190 .Ed
191 .Sh DESCRIPTION
192 The
193 .Nm
194 driver provides support for NS8250-, NS16450-, NS16550 and NS16550A-based
195 .Tn EIA
196 .Tn RS-232C
197 .Pf ( Tn CCITT
198 .Tn V.24 )
199 communications interfaces.
200 The NS8250 and NS16450 have single character
201 buffers, the NS16550A has 16 character FIFO input and output buffers.
202 .Pp
203 Input and output for each line may set to one of following baud rates;
204 50, 75, 110, 134.5, 150, 300, 600, 1200, 1800, 2400, 4800, 9600,
205 19200, 28800, 38400, 57600, or 115200.
206 Your hardware may limit your baud rate choices.
207 .Pp
208 The driver supports `multiport' cards.
209 Multiport cards are those that have one or more groups of ports
210 that share an Interrupt Request (IRQ) line per group.
211 Shared IRQs on different cards are not supported.
212 Frequently 4 ports share 1 IRQ; some 8 port cards have 2 groups of 4 ports,
213 thus using 2 IRQs.
214 Some cards allow the first 2 serial ports to have separate IRQs per port
215 (as per DOS PC standard).
216 .Pp
217 Some cards have an IRQ control register for each group.
218 Some cards require special initialization related to such registers.
219 Only AST/4 compatible IRQ control registers are supported.
220 Some cards have an IRQ status register for each group.
221 The driver does not require or use such registers yet.
222 To work, the control and status registers for a group, if any,
223 must be mapped to the scratch register (register 7)
224 of a port in the group.
225 Such a port is called a
226 .Em master
227 port.
228 .Pp
229 The driver supports controller based PCI modems.
230 The 3Com FaxModem PCI and the Advantec 56k Voice Messaging PCI
231 FaxModem are the only cards supported.
232 WinModems, softmodems, hfc modems and any other modems that are not
233 controller based are not supported.
234 .Pp
235 The
236 .Em flags
237 keyword may be used on each
238 .Em device sio
239 line in the kernel configuration file
240 to disable the FIFO on 16550A UARTs
241 (see the synopsis).
242 Disabling the FIFO should rarely be necessary.
243 .Pp
244 The
245 .Em flags
246 keyword
247 .Em must
248 be used for all ports that are part of an IRQ sharing group.
249 One bit specifies IRQ sharing; another bit specifies whether the port does
250 .Em not
251 require AST/4 compatible initialization.
252 The minor number of the device corresponding a master port
253 for the group is encoded as a bitfield in the high byte.
254 The same master port must be specified for all ports in a group.
255 .Pp
256 The
257 .Em irq
258 specification must be given for master ports
259 and for ports that are not part of an IRQ sharing group,
260 and not for other ports.
261 .Pp
262 In the synopsis,
263 .Em flags 0x701
264 means that the 8th port (sio7) is the master
265 port, and that the port is on a multiport card with shared IRQs
266 and an AST/4 compatible IRQ control register.
267 .Pp
268 .Em flags 0xb05
269 means that the 12th port (sio11) is the master
270 port, and that the port is on a multiport card with shared IRQs
271 and no special IRQ control register.
272 .Pp
273 Which port is the master port depends on the card type.
274 Consult the hardware documentation of your card.
275 Since IRQ status registers are never used,
276 and IRQ control registers are only used for AST/4 compatible cards,
277 and some cards map the control/status registers to all ports in a group,
278 any port in a group will sometimes do for the master port.
279 Choose a port containing an IRQ status register for forwards compatibility,
280 and the highest possible port for consistency.
281 .Pp
282 Serial ports controlled by the
283 .Nm
284 driver can be used for both `callin' and `callout'.
285 For each port there is a callin device and a callout device.
286 The minor number of the callout device is 128 higher
287 than that of the corresponding callin port.
288 The callin device is general purpose.
289 Processes opening it normally wait for carrier
290 and for the callout device to become inactive.
291 The callout device is used to steal the port from
292 processes waiting for carrier on the callin device.
293 Processes opening it do not wait for carrier
294 and put any processes waiting for carrier on the callin device into
295 a deeper sleep so that they do not conflict with the callout session.
296 The callout device is abused for handling programs that are supposed
297 to work on general ports and need to open the port without waiting
298 but are too stupid to do so.
299 .Pp
300 The
301 .Nm
302 driver also supports an initial-state and a lock-state control
303 device for each of the callin and the callout "data" devices.
304 The minor number of the initial-state device is 32 higher
305 than that of the corresponding data device.
306 The minor number of the lock-state device is 64 higher
307 than that of the corresponding data device.
308 The termios settings of a data device are copied
309 from those of the corresponding initial-state device
310 on first opens and are not inherited from previous opens.
311 Use
312 .Xr stty 1
313 in the normal way on the initial-state devices to program
314 initial termios states suitable for your setup.
315 .Pp
316 The lock termios state acts as flags to disable changing
317 the termios state.
318 E.g., to lock a flag variable such as CRTSCTS, use
319 .Em stty crtscts
320 on the lock-state device.
321 Speeds and special characters
322 may be locked by setting the corresponding value in the lock-state
323 device to any nonzero value.
324 .Pp
325 Correct programs talking to correctly wired external devices
326 work with almost arbitrary initial states and almost no locking,
327 but other setups may benefit from changing some of the default
328 initial state and locking the state.
329 In particular, the initial states for non (POSIX) standard flags
330 should be set to suit the devices attached and may need to be
331 locked to prevent buggy programs from changing them.
332 E.g., CRTSCTS should be locked on for devices that support
333 RTS/CTS handshaking at all times and off for devices that do not
334 support it at all.
335 CLOCAL should be locked on for devices that do not support carrier.
336 HUPCL may be locked off if you do not
337 want to hang up for some reason.
338 In general, very bad things happen
339 if something is locked to the wrong state, and things should not
340 be locked for devices that support more than one setting.
341 The CLOCAL flag on callin ports should be locked off for logins
342 to avoid certain security holes, but this needs to be done by
343 getty if the callin port is used for anything else.
344 .Sh FILES
345 .Bl -tag -width /dev/ttyd?.init -compact
346 .It Pa /dev/ttyd?
347 for callin ports
348 .It Pa /dev/ttyd?.init
349 .It Pa /dev/ttyd?.lock
350 corresponding callin initial-state and lock-state devices
351 .Pp
352 .It Pa /dev/cuad?
353 for callout ports
354 .It Pa /dev/cuad?.init
355 .It Pa /dev/cuad?.lock
356 corresponding callout initial-state and lock-state devices
357 .El
358 .Pp
359 .Bl -tag -width /etc/rc.d/serial -compact
360 .It Pa /etc/rc.d/serial
361 examples of setting the initial-state and lock-state devices
362 .El
363 .Pp
364 The device numbers are made from the set [0-9a-v] so that more than
365 10 ports can be supported.
366 .Sh DIAGNOSTICS
367 .Bl -diag
368 .It sio%d: silo overflow.
369 Problem in the interrupt handler.
370 .El
371 .Bl -diag
372 .It sio%d: interrupt-level buffer overflow.
373 Problem in the bottom half of the driver.
374 .El
375 .Bl -diag
376 .It sio%d: tty-level buffer overflow.
377 Problem in the application.
378 Input has arrived faster than the given module could process it
379 and some has been lost.
380 .El
381 .\" .Bl -diag
382 .\" .It sio%d: reduced fifo trigger level to %d.
383 .\" Attempting to avoid further silo overflows.
384 .\" .El
385 .Sh SEE ALSO
386 .Xr stty 1 ,
387 .Xr termios 4 ,
388 .Xr tty 4 ,
389 .Xr comcontrol 8
390 .Sh HISTORY
391 The
392 .Nm
393 driver is derived from the
394 .Tn HP9000/300
395 .Xr dca 4
396 driver and is
397 .Ud
398 .Sh BUGS
399 Data loss may occur at very high baud rates on slow systems,
400 or with too many ports on any system,
401 or on heavily loaded systems when crtscts cannot be used.
402 The use of NS16550A's reduces system load and helps to avoid data loss.
403 .Pp
404 Stay away from plain NS16550's.
405 These are early implementations of the chip with non-functional FIFO hardware.
406 .Pp
407 The constants which define the locations
408 of the various serial ports are holdovers from
409 .Tn DOS .
410 As shown, hex addresses can be and for clarity probably should be used instead.
411 .Pp
412 Note that on the AST/4 the card's dipswitches should
413 .Em not
414 be set to use interrupt sharing.
415 AST/4-like interrupt sharing is only used when
416 .Em multiple
417 AST/4 cards are installed in the same system.
418 The
419 .Nm
420 driver does not support more than 1 AST/4 on one IRQ.
421 .Pp
422 The examples in the synopsis are too vendor-specific.