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