home | help
SIO(4)			     Kernel Interfaces Manual			  SIO(4)

NAME
     sio -- fast interrupt driven asynchronous serial communications interface

SYNOPSIS
     For standard ports:
     device sio0 at isa? port IO_COM1 irq 4
     device sio1 at isa? port IO_COM2 irq 3
     device sio2 at isa? port IO_COM3 irq 5
     device sio3 at isa? port IO_COM4 irq 9

     For AST compatible multiport cards with 4 ports:
     options COM_MULTIPORT
     device sio4 at isa? port 0x2a0 flags 0x701
     device sio5 at isa? port 0x2a8 flags 0x701
     device sio6 at isa? port 0x2b0 flags 0x701
     device sio7 at isa? port 0x2b8 flags 0x701 irq 12

     For Boca Board compatible multiport cards with 8 ports:
     options COM_MULTIPORT
     device sio4 at isa? port 0x100 flags 0xb05
     ...
     device sio11 at isa? port 0x138 flags 0xb05 irq 12

     For Hayes ESP cards:
     options COM_ESP
     ...

     Meaning of flags:
	   0x00001   shared IRQs
	   0x00002   disable FIFO
	   0x00004   no AST/4 compatible IRQ control register
	   0x00008   recover sooner from lost output interrupts
	   0x00010   device is potential system console
	   0x00020   device is forced to become system console
	   0x00040   device is reserved for low-level IO (e. g. for remote
		     kernel debugging)
	   0x00080   use this port for remote kernel debugging
	   0x0??00   minor number of master port
	   0x20000   device is assumed to use a 16650A-type (extended FIFO) chip

     Minor numbering:

     0bOLIMMMMM
       callOut
	Lock
	 Initial
	  MMMMMinor

DESCRIPTION
     The  sio  driver  provides  support  for  NS8250-,  NS16450-,  NS16550  and
     NS16550A-based EIA RS-232C (CCITT	V.24)  communications  interfaces.   The
     NS8250 and NS16450 have single character buffers, the NS16550A has 16 char-
     acter FIFO input and output buffers.

     Input  and output for each line may set to one of following baud rates; 50,
     75, 110, 134.5, 150, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200,  38400,
     57600, or 115200. Your hardware may limit your baud rate choices.

     The driver supports `multiport' cards.  Multiport cards are those that have
     one  or more groups of ports that share an Interrupt Request (IRQ) line per
     group.  Shared IRQs on different cards are  not  supported.   Frequently  4
     ports share 1 IRQ; some 8 port cards have 2 groups of 4 ports, thus using 2
     IRQs.   Some cards allow the first 2 serial ports to have separate IRQs per
     port (as per DOS PC standard).

     Some cards have an IRQ control register for each group.  Some cards require
     special initialization related to such registers.	 Only  AST/4  compatible
     IRQ  control registers are supported.  Some cards have an IRQ status regis-
     ter for each group.  The driver does not require or use such registers yet.
     To work, the control and status registers for a  group,  if  any,	must  be
     mapped to the scratch register (register 7) of a port in the group.  Such a
     port is called a master port.

     The flags keyword may be used on each device sio line in the kernel config-
     uration  file to disable the FIFO on 16550A UARTs (see the synopsis).  Dis-
     abling the FIFO should rarely be necessary.

     The flags keyword must be used for all ports that are part of an IRQ  shar-
     ing  group.   One	bit specifies IRQ sharing; another bit specifies whether
     the port does not require AST/4 compatible initialization.  The minor  num-
     ber of the device corresponding a master port for the group is encoded as a
     bitfield  in the high byte.  The same master port must be specified for all
     ports in a group.

     The irq specification must be given for master ports and for ports that are
     not part of an IRQ sharing group, and not for other ports.

     In the synopsis, flags 0x701 means that the 8th port (sio7) is  the  master
     port,  and  that  the  port  is on a multiport card with shared IRQs and an
     AST/4 compatible IRQ control register.

     flags 0xb05 means that the 12th port (sio11) is the master port,  and  that
     the port is on a multiport card with shared IRQs and no special IRQ control
     register.

     Which  port is the master port depends on the card type.  Consult the hard-
     ware documentation of your card.  Since  IRQ  status  registers  are  never
     used,  and  IRQ control registers are only used for AST/4 compatible cards,
     and some cards map the control/status registers to all ports  in  a  group,
     any  port	in a group will sometimes do for the master port.  Choose a port
     containing an IRQ status register for forwards compatibility, and the high-
     est possible port for consistency.

     Serial ports controlled by the sio driver can be used for both `callin' and
     `callout'.  For each port there is a callin device and  a	callout  device.
     The  minor number of the callout device is 128 higher than that of the cor-
     responding callin port.  The callin device is general  purpose.   Processes
     opening  it  normally wait for carrier and for the callout device to become
     inactive.	The callout device is used to  steal  the  port  from  processes
     waiting for carrier on the callin device.	Processes opening it do not wait
     for  carrier and put any processes waiting for carrier on the callin device
     into a deeper sleep so that they do not conflict with the callout	session.
     The  callout  device  is  abused for handling programs that are supposed to
     work on general ports and need to open the port without waiting but are too
     stupid to do so.

     The sio driver also supports an initial-state and a lock-state control  de-
     vice for each of the callin and the callout "data" devices.  The minor num-
     ber of the initial-state device is 32 higher than that of the corresponding
     data  device.   The minor number of the lock-state device is 64 higher than
     that of the corresponding data device.  The termios settings of a data  de-
     vice  are	copied	from  those of the corresponding initial-state device on
     first opens and are not inherited from previous opens.  Use stty(1) in  the
     normal  way  on the initial-state devices to program initial termios states
     suitable for your setup.

     The lock termios state acts as flags to disable changing the termios state.
     E.g., to lock a flag variable such as CRTSCTS,  use  stty	crtscts  on  the
     lock-state  device.  Speeds and special characters may be locked by setting
     the corresponding value in the lock-state device to any nonzero value.

     Correct programs talking to correctly wired external devices work with  al-
     most  arbitrary  initial states and almost no locking, but other setups may
     benefit from changing some of the default initial	state  and  locking  the
     state.   In  particular,  the initial states for non (POSIX) standard flags
     should be set to suit the devices attached and may need  to  be  locked  to
     prevent  buggy programs from changing them.  E.g., CRTSCTS should be locked
     on for devices that support RTS/CTS handshaking at all times  and	off  for
     devices  that  don't support it at all.  CLOCAL should be locked on for de-
     vices that don't support carrier.	HUPCL may be locked  off  if  you  don't
     want  to  hang  up  for some reason.  In general, very bad things happen if
     something is locked to the wrong state, and things should not be locked for
     devices that support more than one setting.   The	CLOCAL	flag  on  callin
     ports  should be locked off for logins to avoid certain security holes, but
     this needs to be done by getty if the callin  port  is  used  for	anything
     else.

FILES
     /dev/ttyd?   for callin ports
     /dev/ttyid?
     /dev/ttyld?  corresponding callin initial-state and lock-state devices

     /dev/cuaa?   for callout ports
     /dev/cuaia?
     /dev/cuala?  corresponding callout initial-state and lock-state devices

     /etc/rc.serial  examples  of  setting  the initial-state and lock-state de-
		     vices

     The devices numbers are made from the set [0-9a-v] so  that  more	than  10
     ports can be supported.

DIAGNOSTICS
     sio%d: silo overflow.  Problem in the interrupt handler.

     sio%d:  interrupt-level buffer overflow.  Problem in the bottom half of the
     driver.

     sio%d: tty-level buffer overflow.	Problem in the application.   Input  has
     arrived  faster  than  the  given module could process it and some has been
     lost.

SEE ALSO
     stty(1), termios(4), tty(4), comcontrol(8)

HISTORY
     The sio driver is derived from the HP9000/300 dca(4)  driver  and	is  cur-
     rently under development.

BUGS
     Data  loss  may  occur at very high baud rates on slow systems, or with too
     many ports on any system, or on heavily loaded systems when crtscts  cannot
     be used.  The use of NS16550A's reduces system load and helps to avoid data
     loss.

     Stay away from plain NS16550's. These are early implementations of the chip
     with non-functional FIFO hardware.

     The  constants  which  define the locations of the various serial ports are
     holdovers from DOS.  As shown, hex addresses can be and for clarity  proba-
     bly should be used instead.

     Note  that on the AST/4 the card's dipswitches should not be set to use in-
     terrupt sharing.  AST/4-like interrupt sharing is only used  when	multiple
     AST/4 cards are installed in the same system.  The sio driver does not sup-
     port more than 1 AST/4 on one IRQ.

     The examples in the synopsis are too vendor-specific.

FreeBSD 4.6			October 10, 1995			  SIO(4)

home | help