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: src/share/man/man4/sio.4,v 1.34.2.4 2002/12/18 13:31:17 keramida Exp $ 38.\" $DragonFly: src/share/man/man4/sio.4,v 1.2 2003/06/17 04:36:59 dillon Exp $ 39.\" 40.Dd October 10, 1995 41.Dt SIO 4 42.Os 43.Sh NAME 44.Nm sio 45.Nd "fast interrupt driven asynchronous serial communications interface" 46.Sh SYNOPSIS 47For 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 53For 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 60For 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 66For Netmos Nm9845 multiport cards with 6 ports: 67.Cd "options COM_MULTIPORT" 68.Cd "device sio4 at isa? port 0xb000 flags 0x901" 69.Cd "device sio5 at isa? port 0xb400 flags 0x901" 70.Cd "device sio6 at isa? port 0xb800 flags 0x901" 71.Cd "device sio7 at isa? port 0xbc00 flags 0x901" 72.Cd "device sio8 at isa? port 0xc000 flags 0x901" 73.Cd "device sio9 at isa? port 0xac00 flags 0x901 irq 12" 74.Pp 75For Hayes ESP cards: 76.Cd "options COM_ESP" 77.Cd "..." 78.Pp 79Meaning of 80.Ar flags : 81.Bl -tag -offset indent -compact -width 0x000000 82.It 0x00001 83shared IRQs 84.It 0x00002 85disable FIFO 86.It 0x00004 87no AST/4 compatible IRQ control register 88.It 0x00008 89recover sooner from lost output interrupts 90.It 0x00010 91device is potential system console 92.It 0x00020 93device is forced to become system console 94.It 0x00040 95device is reserved for low-level IO (e. g. for remote kernel debugging) 96.It 0x00080 97use this port for remote kernel debugging 98.It 0x0 Ns Em ?? Ns 00 99minor number of master port 100.It 0x20000 101device is assumed to use a 16650A-type (extended FIFO) chip 102.El 103.Pp 104Minor numbering: 105.Bd -literal 1060b\fIOLIMMMMM\fR 107 call\fBO\fRut 108 \fBL\fRock 109 \fBI\fRnitial 110 \fBMMMMM\fRinor 111.Ed 112.Sh DESCRIPTION 113The 114.Nm 115driver provides support for NS8250-, NS16450-, NS16550 and NS16550A-based 116.Tn EIA 117.Tn RS-232C 118.Pf ( Tn CCITT 119.Tn V.24 ) 120communications interfaces. The NS8250 and NS16450 have single character 121buffers, the NS16550A has 16 character FIFO input and output buffers. 122.Pp 123Input and output for each line may set to one of following baud rates; 12450, 75, 110, 134.5, 150, 300, 600, 1200, 1800, 2400, 4800, 9600, 12519200, 38400, 57600, or 115200. Your hardware may limit your baud 126rate choices. 127.Pp 128The driver supports `multiport' cards. 129Multiport cards are those that have one or more groups of ports 130that share an Interrupt Request (IRQ) line per group. 131Shared IRQs on different cards are not supported. 132Frequently 4 ports share 1 IRQ; some 8 port cards have 2 groups of 4 ports, 133thus using 2 IRQs. 134Some cards allow the first 2 serial ports to have separate IRQs per port 135(as per DOS PC standard). 136.Pp 137Some cards have an IRQ control register for each group. 138Some cards require special initialization related to such registers. 139Only AST/4 compatible IRQ control registers are supported. 140Some cards have an IRQ status register for each group. 141The driver does not require or use such registers yet. 142To work, the control and status registers for a group, if any, 143must be mapped to the scratch register (register 7) 144of a port in the group. 145Such a port is called a 146.Em master 147port. 148.Pp 149The 150.Em flags 151keyword may be used on each 152.Em device sio 153line in the kernel configuration file 154to disable the FIFO on 16550A UARTs 155(see the synopsis). 156Disabling the FIFO should rarely be necessary. 157.Pp 158The 159.Em flags 160keyword 161.Em must 162be used for all ports that are part of an IRQ sharing group. 163One bit specifies IRQ sharing; another bit specifies whether the port does 164.Em not 165require AST/4 compatible initialization. 166The minor number of the device corresponding a master port 167for the group is encoded as a bitfield in the high byte. 168The same master port must be specified for all ports in a group. 169.Pp 170The 171.Em irq 172specification must be given for master ports 173and for ports that are not part of an IRQ sharing group, 174and not for other ports. 175.Pp 176In the synopsis, 177.Em flags 0x701 178means that the 8th port (sio7) is the master 179port, and that the port is on a multiport card with shared IRQs 180and an AST/4 compatible IRQ control register. 181.Pp 182.Em flags 0xb05 183means that the 12th port (sio11) is the master 184port, and that the port is on a multiport card with shared IRQs 185and no special IRQ control register. 186.Pp 187Which port is the master port depends on the card type. 188Consult the hardware documentation of your card. 189Since IRQ status registers are never used, 190and IRQ control registers are only used for AST/4 compatible cards, 191and some cards map the control/status registers to all ports in a group, 192any port in a group will sometimes do for the master port. 193Choose a port containing an IRQ status register for forwards compatibility, 194and the highest possible port for consistency. 195.Pp 196Serial ports controlled by the 197.Nm 198driver can be used for both `callin' and `callout'. 199For each port there is a callin device and a callout device. 200The minor number of the callout device is 128 higher 201than that of the corresponding callin port. 202The callin device is general purpose. 203Processes opening it normally wait for carrier 204and for the callout device to become inactive. 205The callout device is used to steal the port from 206processes waiting for carrier on the callin device. 207Processes opening it do not wait for carrier 208and put any processes waiting for carrier on the callin device into 209a deeper sleep so that they do not conflict with the callout session. 210The callout device is abused for handling programs that are supposed 211to work on general ports and need to open the port without waiting 212but are too stupid to do so. 213.Pp 214The 215.Nm 216driver also supports an initial-state and a lock-state control 217device for each of the callin and the callout "data" devices. 218The minor number of the initial-state device is 32 higher 219than that of the corresponding data device. 220The minor number of the lock-state device is 64 higher 221than that of the corresponding data device. 222The termios settings of a data device are copied 223from those of the corresponding initial-state device 224on first opens and are not inherited from previous opens. 225Use 226.Xr stty 1 227in the normal way on the initial-state devices to program 228initial termios states suitable for your setup. 229.Pp 230The lock termios state acts as flags to disable changing 231the termios state. E.g., to lock a flag variable such as 232CRTSCTS, use 233.Em stty crtscts 234on the lock-state device. Speeds and special characters 235may be locked by setting the corresponding value in the lock-state 236device to any nonzero value. 237.Pp 238Correct programs talking to correctly wired external devices 239work with almost arbitrary initial states and almost no locking, 240but other setups may benefit from changing some of the default 241initial state and locking the state. 242In particular, the initial states for non (POSIX) standard flags 243should be set to suit the devices attached and may need to be 244locked to prevent buggy programs from changing them. 245E.g., CRTSCTS should be locked on for devices that support 246RTS/CTS handshaking at all times and off for devices that don't 247support it at all. CLOCAL should be locked on for devices 248that don't support carrier. HUPCL may be locked off if you don't 249want to hang up for some reason. In general, very bad things happen 250if something is locked to the wrong state, and things should not 251be locked for devices that support more than one setting. The 252CLOCAL flag on callin ports should be locked off for logins 253to avoid certain security holes, but this needs to be done by 254getty if the callin port is used for anything else. 255.Sh FILES 256.Bl -tag -width /dev/ttyid? -compact 257.It Pa /dev/ttyd? 258for callin ports 259.It Pa /dev/ttyid? 260.It Pa /dev/ttyld? 261corresponding callin initial-state and lock-state devices 262.Pp 263.It Pa /dev/cuaa? 264for callout ports 265.It Pa /dev/cuaia? 266.It Pa /dev/cuala? 267corresponding callout initial-state and lock-state devices 268.El 269.Pp 270.Bl -tag -width /etc/rc.serial -compact 271.It Pa /etc/rc.serial 272examples of setting the initial-state and lock-state devices 273.El 274.Pp 275The device numbers are made from the set [0-9a-v] so that more than 27610 ports can be supported. 277.Sh DIAGNOSTICS 278.Bl -diag 279.It sio%d: silo overflow. 280Problem in the interrupt handler. 281.El 282.Bl -diag 283.It sio%d: interrupt-level buffer overflow. 284Problem in the bottom half of the driver. 285.El 286.Bl -diag 287.It sio%d: tty-level buffer overflow. 288Problem in the application. 289Input has arrived faster than the given module could process it 290and some has been lost. 291.El 292.\" .Bl -diag 293.\" .It sio%d: reduced fifo trigger level to %d. 294.\" Attempting to avoid further silo overflows. 295.\" .El 296.Sh SEE ALSO 297.Xr stty 1 , 298.Xr termios 4 , 299.Xr tty 4 , 300.Xr comcontrol 8 301.Sh HISTORY 302The 303.Nm 304driver is derived from the 305.Tn HP9000/300 306.Xr dca 4 307driver and is 308.Ud 309.Sh BUGS 310Data loss may occur at very high baud rates on slow systems, 311or with too many ports on any system, 312or on heavily loaded systems when crtscts cannot be used. 313The use of NS16550A's reduces system load and helps to avoid data loss. 314.Pp 315Stay away from plain NS16550's. These are early 316implementations of the chip with non-functional FIFO hardware. 317.Pp 318The constants which define the locations 319of the various serial ports are holdovers from 320.Tn DOS . 321As shown, hex addresses can be and for clarity probably should be used instead. 322.Pp 323Note that on the AST/4 the card's dipswitches should 324.Em not 325be set to use interrupt sharing. 326AST/4-like interrupt sharing is only used when 327.Em multiple 328AST/4 cards are installed in the same system. The sio driver does not 329support more than 1 AST/4 on one IRQ. 330.Pp 331The examples in the synopsis are too vendor-specific. 332