
Stallion Multiport Serial Driver Readme
---------------------------------------

Version: 1.1.2
Date:    22APR96



1. INTRODUCTION

This is a Linux driver for some of the Stallion Technologies range of
multiport serial boards. There are really two drivers in this package.
One is for the Stallion smart boards, the other for the true Stallion
intelligent multiport boards.

This version of the driver is supported in Linux kernel versions 1.2.5 and
later 1.2.X series kernels. Newer Linux kernel distributions (those with
Linux kernal versions 1.3.27 and above) contain updated versions of the
Stallion driver source. Use the version of the driver supplied with the
kernel in this case.

If you have any trouble getting Stallion boards to work in Linux systems,
please contact Stallion Technologies support department via email or
phone. Contact information for Stallion Technologies offices is included in
the file "Offices" contained in this distribution.

Please note the disclaimers set out in the GNU general public license
included with this driver package.

All host driver source is included in this package, and is copyrighted under
the GNU GPL. The board "firmware" code in this package is copyright Stallion
Technologies (the files cdk.sys and 2681.sys).


1.1 SMART MULTIPORT BOARD DRIVER

This driver supports the EasyIO and EasyConnection 8/32 range of boards.
These boards are not classic intelligent multiport boards, but are host
based multiport boards that use high performance Cirrus Logic CL-CD1400 RISC
UART's (they have built in FIFO's, automatic flow control and some other
good stuff).

The EasyIO range of cards comes in 3 forms, the EasyIO-4, EasyIO-8 and the
EasyIO-8M. All of these are non-expandable, low cost, ISA, multiport boards
with 4, 8 and 8 RS-232C ports respectively. Each EasyIO board requires 8
bytes of I/O address space and 1 interrupt. On an EISA system it is possible
to share 1 interrupt between multiple boards. The EasyIO-4 has 10 pin RJ
connectors, and the EasyIO-8 comes with a dongle cable with either 10 pin RJ
connectors or DB-25 connectors. The EasyIO-8M has 6 pin RJ connectors.

The EasyConnection 8/32 family of boards is a relatively low cost modular
range of multiport serial boards. The EasyConnection 8/32 boards can be
configured to have from 8 to 32 serial ports by plugging in external serial
port modules that contain either 8 or 16 ports each. There is a wide range
of external modules available that offer: DB-25 connectors, RJ-45 connectors
(both with RS-232 D and E compatible drivers), and also RS-422 and RS-485
ports. The EasyConnection 8/32 boards come in ISA, PCI and MCA bus versions.
The board takes the form of a host adapter card, with an external connector
cable that plugs into the external modules. The external modules just clip
together to add ports (BTW, they are NOT hot pluggable). Each ISA
EasyConnection 8/32 board requires two separate I/O address ranges, one two
bytes in size and a secondary region of 32 bytes. Each PCI EasyConnection
8/32 requires two regions of I/O address space, normally these will be
automatically allocated by the system BIOS at system power on time. Each MCA
EasyConnection board requires one I/O address region 64 bytes in size. All
board types also require one interrupt. On EISA systems multiple boards can
share one interrupt. The secondary I/O range of the ISA board (the 32 byte
range) can be shared between multiple boards on any bus type.


1.2 INTELLIGENT MULTIPORT BOARD DRIVER

This driver is for Stallion's range of true intelligent multiport boards.
It supports the EasyConnection 8/64, ONboard and Brumby families of multiport
boards. The EasyConnection 8/64 and ONboard boards come in ISA, EISA and
Microchannel bus versions. The Brumby boards are only available in ISA
versions. This driver can also work with the original Stallion board, but
these are no longer supported by Stallion Technologies.

The EasyConnection 8/64 family of boards is a medium cost, high performance,
modular range of intelligent multiport serial boards. The EasyConnection 8/64
boards can be configured to have from 8 to 64 serial ports by plugging in
external serial port modules that contain either 8 or 16 ports each (these
modules are the same used by the EasyConnection 8/32 board). There is a wide
range of external modules available that offer: DB-25 connectors, RJ-45
connectors (both with RS-232 D and E compatible drivers), and also RS-422 and
RS-485 ports. The board takes the form of a host adapter card, with an external
connector cable that plugs into the external modules. The external modules
just clip together to add ports (BTW, they are NOT hot pluggable). Each
EasyConnection 8/64 board requires 4 bytes of I/O address space and a region
of memory space. The size of the memory region required depends on the exact
board type. The EISA version requires 64 Kbytes of address space (that can
reside anywhere in the 4 Gigabyte physical address space). The ISA and MCA
boards require 4 Kbytes of address space (which must reside in the lower
1 Mbyte of physical address space - typically in the c8000 to e0000 range).
No interrupts are required. The physical memory region of multiple
EasyConnection 8/64 boards can be shared, but each board must have a separate
I/O address space.

The ONboard family of boards are traditional intelligent multiport serial
boards. They are Stallion's older range of boards with a limited expansion
capability. They come in 4, 8, 12, 16 and 32 port versions. The board uses
the same base card (which has 4 ports on it) and is expanded to more ports
via a mezzanine board that attaches directly onto the board. External panels
plug into the ONboard providing RS-232C ports with DB-25 plugs. An RS-422
DB-25 dual interface panel is also available. The ISA and microchannel
ONboards require 16 bytes of I/O address space and 64K bytes of memory
space. The memory space can be anywhere in the 16 Mbyte ISA bus address
range. No interrupt is required. The EISA ONboard requires 64 Kbytes of
memory space that can be anywhere in the 4 Gigabyte physical address space.
All ONboard boards can share their memory region with other ONboards (or
EasyConnection 8/64 boards).

The Brumby family of boards are traditional, low cost intelligent multiport
serial boards. They are non-expandable and come in 4, 8 and 16 port versions.
They are only available for the ISA bus. The serial ports are all on DB-25
"dongle" cables that attach to the rear of the board. Each Brumby board
requires 16 bytes of I/O address space and 16 Kbytes of memory space. No
interrupts are required.

The original Stallion boards are old. They went out of production some years
back and are no longer supported. They offer limited expandability and are
available in 8 or 16 port configurations. An external panel houses 16 RS-232C
ports with DB-9 connectors. They require 16 bytes of I/O address space, and
either 64K or 128K of memory space. No interrupt is required.

That's the boards supported by the second driver. The ONboard, Brumby and
Stallion boards are Stallion's older range of intelligent multiports - so
there are lots of them around. They only support a maximum baud rate of
38400. The EasyConnection 8/64 is a true high performance intelligent
multiport board, having much greater throughput than any of Stallion's
older boards. It also supports speeds up to 115200 baud.


1.3 HOW TO GET BOARDS

Stallion Technologies has offices all over the world, as well as many more
distributors and resellers. To find out about local availability please
contact the nearest Stallion office and they can give you all the information
you need. Look in the "Offices" file in the driver package for a current list
of Stallion Technologies offices.

Another good source of information about the Stallion range of boards and
local availability is on the Stallion Web page. Check it out at
http://www.stallion.com.



2. INSTALLATION

This version of the driver is intended for kernel versions 1.2.5 and later.
It will not work on earlier kernel versions, due to kernel changes. (Note
that it has in the past worked on earlier kernel versions, it's just that
it doesn't any more!). Also see the notes further down for using the drivers
with the newer 1.3.X Linux kernels.

The drivers can be used as loadable modules or compiled into the kernel.
So depending on which form of driver loading you decide to use, the
installation procedure will be a little different.

All ISA, EISA and MCA boards that you want to use need to be entered into
the driver(s) configuration structures. All PCI boards will be automatically
detected when you load the driver - so they do not need to be entered into
the driver(s) configuration structure. (Note that kernel PCI BIOS32 support
is required to use PCI boards.)

Entering ISA, EISA and MCA boards into the driver(s) configuration structure
involves editing the driver(s) source file. It's pretty easy if you follow
the instructions below. Both drivers can support up to 4 boards. The smart
card driver supports any combination of EasyIO and EasyConnection 8/32 boards
(up to a total of 4). The intelligent driver supports any combination of
ONboards, Brumbys, Stallions and EasyConnection 8/64 boards (up to a total
of 4).


2.1 LOADABLE MODULE DRIVERS

You will need the gcc compiler and make installed to make the driver modules.
You will also need to have the kernel source on the system, and have at least
done a "make config" and "make dep" on it. (If you haven't done this before
then you may want to read the kernel source README file, usually found in
/usr/src/linux.)

To build the driver modules:
1. Setup the driver configuration for the boards. If using EasyIO or
   EasyConnection 8/32 ISA or MCA boards, do:
   vi stallion.c
      - find the definition of the stl_brdconf array (of structures)
        near the top of the file
      - modify this to match the boards you are going to install
	(the comments before this structure should help)
      - save and exit
   If using ONboard, Brumby, Stallion or EasyConnection 8/64 boards then do:
   vi istallion.c
      - find the definition of the stli_brdconf array (of structures)
        near the top of the file
      - modify this to match the boards you are going to install
	(the comments before this structure should help)
      - save and exit
2. make module
   This will compile the driver modules, as stallion and istallion.

The stallion module is the EasyIO and EasyConnection 8/32 driver, the
istallion module is the ONboard, Brumby, Stallion and EasyConnection 8/64
driver.

To load up the smart board driver use:
    insmod ./stallion
This will load the EasyIO and EasyConnection 8/32 driver. It will output a
message to say that it loaded and print the driver version number. It
will also print out whether it found the configured boards or not. (These
messages may appear in your /var/adm/messages file depending on how the
klogd and syslogd daemons are setup on your system).

To load the intelligent board driver use:
    insmod ./istallion
It will output similar messages to the smart board driver.


2.2 STATIC DRIVERS (KERNEL LINKED)

You will need to build a new kernel to link in the Stallion drivers. The first
thing you need is to have the full kernel source. Most people will have this.
The following assumes that the kernel source is in /usr/src/linux.

To install the drivers:
1. cp stallion.c istallion.c cd1400.h cdk.h /usr/src/linux/drivers/char
2. cd /usr/src/linux/drivers/char
3. vi tty_io.c
      - goto the end of the file
      - add a line between the following lines:
          kmem_start = pty_init(kmem_start);
          return kmem_start;
      - depending on what type of boards you plan on using add one of the
        following lines (or both even!).
        To use EasyIO or EasyConnection 8/32:
          kmem_start = stl_init(kmem_start);
        To use ONboard, Brumby, Stallion or EasyConnection 8/86:
          kmem_start = stli_init(kmem_start);
      - so the result should look something like:
          kmem_start = pty_init(kmem_start);
          kmem_start = stl_init(kmem_start);
          return kmem_start;
      - save and exit
4. Setup the driver configuration for the boards. If using EasyIO or
   EasyConnection 8/32 boards, do:
   vi stallion.c
      - find the definition of the stl_brdconf array (of structures)
        near the top of the file
      - modify this to match the boards you are going to install
	(the comments before this structure should help)
      - save and exit
   If using ONboard, Brumby, Stallion or EasyConnection 8/64 boards then do:
   vi istallion.c
      - find the definition of the stli_brdconf array (of structures)
        near the top of the file
      - modify this to match the boards you are going to install
	(the comments before this structure should help)
      - save and exit
5. vi Makefile
      - add "stallion.o istallion.o" into the lines that list OBJS
      - add "stallion.c istallion.c" into the lines that list SRCS
        These lines already list all the other .o and .c files in
        this driver area, so just add stallion entries to the ends
      - save and exit
4. cd /usr/src/linux
5. build a new kernel - if you haven't done this before you may want to
   read the README file in /usr/src/linux.

Once you have a new kernel built, reboot to start it up. On startup the
driver will output a message to say it is operational (with the driver
version number). It will also print out if it could find the boards listed
in its configuration structure or not.


2.3 INTELLIGENT DRIVER OPERATION

The intelligent boards also need to have their "firmware" code downloaded
to them. This is done via a user level application supplied in the driver
package called "stlload". Compile this program where ever you dropped the
package files, by typing "make". In its simplest form you can then type
    ./stlload -i cdk.sys
in this directory and that will download board 0 (assuming board 0 is an
EasyConnection 8/64 board). To download to an ONboard, Brumby or Stallion do:
    ./stlload -i 2681.sys

Normally you would want all boards to be downloaded as part of the standard
system startup. To achieve this, add one of the lines above into the
/etc/rc.d/rc.S or /etc/rc.d/rc.serial file. To download each board just add
the "-b <brd-number>" option to the line. You will need to download code for
every board. You should probably move the stlload program into a system
directory, such as /usr/sbin. Also, the default location of the cdk.sys image
file in the stlload down-loader is /usr/lib/stallion. Create that directory
and put the cdk.sys and 2681.sys files in it. (It's a convenient place to put
them anyway). As an example your /etc/rc.d/rc.S file might have the
following lines added to it (if you had 3 boards):
    /usr/sbin/stlload -b 0 -i /usr/lib/stallion/cdk.sys
    /usr/sbin/stlload -b 1 -i /usr/lib/stallion/2681.sys
    /usr/sbin/stlload -b 2 -i /usr/lib/stallion/2681.sys

The image files cdk.sys and 2681.sys are specific to the board types. The
cdk.sys will only function correctly on an EasyConnection 8/64 board. Similarly
the 2681.sys image fill only operate on ONboard, Brumby and Stallion boards.
If you load the wrong image file into a board it will fail to start up, and
of course the ports will not be operational!

If you are using the module version of the driver you might want to put the
insmod calls in the startup script as well (before the download lines
obviously).


2.4 SHARING INTERRUPTS

As mentioned in the introduction, it is possible to share interrupts between
multiple EasyIO and EasyConnection 8/32 boards in an EISA system. To do this
you will need to do a couple of things:

1. When entering the board resources into the stallion.c file you need to
   mark the boards as using level triggered interrupts. Do this by replacing
   the "0" entry at field position 6 (the last field) in the board
   configuration structure with a "1". (This is the structure that defines
   the board type, I/O locations, etc. for each board). All
   boards that are sharing an interrupt must be set this way, and each board
   should have the same interrupt number specified here as well.
   Now build the module or kernel as you would normally.

2. When physically installing the boards into the system you must enter
   the system EISA configuration utility. You will need to install the EISA
   configuration files for *all* the EasyIO and EasyConnection 8/32 boards
   that are sharing interrupts. The Stallion EasyIO and EasyConnection 8/32
   EISA configuration files required are supplied by Stallion Technologies
   on the DOS Utilities floppy (usually supplied in the box with the board
   when purchased. If not, you can pick it up from Stallion's FTP site,
   ftp.stallion.com). You will need to edit the board resources to choose
   level triggered interrupts, and make sure to set each board's interrupt
   to the same IRQ number.

You must complete both the above steps for this to work. When you reboot
or load the driver your EasyIO and EasyConnection 8/32 boards will be
sharing interrupts.


2.5 USING HIGH SHARED MEMORY

The EasyConnection 8/64-EI, ONboard and Stallion boards are capable of
using shared memory addresses above the usual 640K - 1Mb range. The ONboard
ISA and the Stallion boards can be programmed to use memory addresses up to
16Mb (the ISA bus addressing limit), and the EasyConnection 8/64-EI and
ONboard/E can be programmed for memory addresses up to 4Gb (the EISA bus
addressing limit).

The istallion intelligent driver does offer support for these higher memory
addresses with a couple of limitations. The higher memory support can only
be used in the loadable module form of the driver, since the kernel memory
management routines it relies on can not be run from the drivers static
kernel init routine.

By default, support for these higher memory addresses is not compiled into
the driver. This is because it relies on kernel functions that are not
normally exported as part of the Linux loadable module system.

To add the appropriate symbols into the kernel export code you need to:

1. cd /usr/src/linux/kernel
   (assuming your Linux kernel code is in /usr/src/linux)
2. vi ksyms.c
   - find the line that reads
        X(vfree),
   - after this line insert the following line
        X(remap_page_range),
   - save and exit
3. cd ..
4. build a new kernel (usually just make)

This will export the "remap_page_range" function for loadable modules
which is required for the higher memory support code.

Finally you need to enable the code in the istallion driver. To do this
edit the istallion.c file and search for the symbol STLI_HIMEMORY. It is
near the top of the file in a line that looks like:

#define	STLI_HIMEMORY	0

Change the "0" to a "1". This enables the high memory support code in
the driver. You will then need to rebuild the module or rebuild the
kernel to incorporate the change. You will also need to modify
the board resource configuration information to use a higher memory
address.

Once these changes are in place the driver will work as it did before.
Note that the physical memory address range is software programmed on the
EasyConnection 8/64-EI and ONboards, but must be set via DIP switches on
the original Stallion boards.


2.6 LINUX KERNEL VERSIONS 1.3.X

From Linux kernel version 1.3.27 and later the stallion drivers are part
of the kernel source distribution. You will need to use some of the other
utilities included in this distribution to get everything going. The
"mkdevnods" script should still be used to create the driver device nodes,
and the "stlload" program should still be used to download the firmware to
the intelligent boards.

There may be some minor differences between the driver source code in this
package and that in the Linux kernel source. This will be due to changes
needed in the drivers so that they work correctly on newer kernels. The
driver source included in this package is intended primarily for use with
the 1.2.X series kernels. So if you have a kernel version later than
1.3.27 then you should use the Stallion drivers included with it.


2.7 TROUBLE SHOOTING

If a board is not found by the driver but is actually in the system then the
most likely problem is that the I/O address is wrong. Change it in the driver
stallion.c or istallion.c configuration structure and rebuild the kernel
or modules, or change it on the board. On EasyIO and EasyConnection 8/32
boards the IRQ is software programmable, so if there is a conflict you may
need to change the IRQ used for a board in the stallion.c configuration
structure. There are no interrupts to worry about for ONboard, Brumby, Stallion
or EasyConnection 8/64 boards. The memory region on EasyConnection 8/64 and
ONboard boards is software programmable, but not on the Brumbys or Stallions.



3. USING THE DRIVERS

Once the driver is installed you will need to setup some device nodes to
access the serial ports. Use the supplied "mkdevnods" script to automatically
create all possible device entries required for all 4 boards. This will
create the normal serial port devices as /dev/ttyE# where # is the port number
starting from 0. A bank of 64 minor device numbers is allocated to each board,
so the first port on the second board is port 64, etc. A set of callout type
devices is also created. They are created as the devices /dev/cue# where # is
the same as for the ttyE devices.

For the most part the Stallion driver tries to emulate the standard PC system
COM ports and the standard Linux serial driver. The idea is that you should
be able to use Stallion board ports and COM ports interchangeably without
modifying anything but the device name. Anything that doesn't work like that
should be considered a bug in this driver!

If you look at the driver code you will notice that it is fairly closely
based on the Linux serial driver (linux/drivers/char/serial.c). This is
intentional, obviously this is the easiest way to emulate its behavior!

Since this driver tries to emulate the standard serial ports as much as
possible, most system utilities should work as they do for the standard
COM ports. Most importantly "stty" works as expected and "setserial" can be
also be used (excepting the ability to auto-configure the I/O and IRQ
addresses of boards). Higher baud rates are supported in the usual fashion
through setserial or using the CBAUDEX extensions. Note that the EasyIO and
EasyConnection (all types) support 57600 and 115200 baud. The older boards
including ONboard, Brumby and the original Stallion support a maximum baud
rate of 38400.

This driver should work with anything that works on standard Linux serial
ports. Having said that, it has been used on at least the following types of
"things" under Linux:
    a) standard dumb terminals (using agetty, getty)
    b) serial mice (under X)
    c) modems (using cu, uucp, minicom, seyon, uugetty)
    d) slip and ppp connections

If you are unfamiliar with how to use serial ports, then get the Serial-HOWTO
by Greg Hankins. It will explain everything you need to know!



4. NOTES

The major device numbers used by this driver are conformant with the Linux
Device Registry, so they shouldn't clash with any other devices. Also the
device naming scheme is the "standard" used by most Linux serial port
devices.

You can use both drivers at once if you have a mix of board types installed
in a system. However to do this you will need to change the major numbers
used by one of the drivers. Currently both drivers use major numbers 24, 25
and 28 for their devices. Change one driver to use some other major numbers,
and then modify the mkdevnods script to make device nodes based on those new
major numbers. For example, you could change the istallion.c driver to use
major numbers 60, 61 and 62. You will also need to create device nodes with
different names for the ports, for example ttyF# and cuf#.

Finding a free physical memory address range can be a problem. The older
boards like the Stallion and ONboard need large areas (64K or even 128K), so
they can be very difficult to get into a system. If you have 16 Mb of RAM
then you have no choice but to put them somewhere in the 640K -> 1Mb range.
ONboards require 64K, so typically 0xd0000 is good, or 0xe0000 on some
systems. If you have an original Stallion board, "V4.0" or Rev.O,
then you need a 64K memory address space, so again 0xd0000 and 0xe0000 are
good. Older Stallion boards are a much bigger problem. They need 128K of
address space and must be on a 128K boundary. If you don't have a VGA card
then 0xc0000 might be usable - there is really no other place you can put
them below 1Mb.

Both the ONboard and old Stallion boards can use higher memory addresses as
well, but you must have less than 16Mb of RAM to be able to use them. Usual
high memory addresses used include 0xec0000 and 0xf00000.

The Brumby boards only require 16Kb of address space, so you can usually
squeeze them in somewhere. Common addresses are 0xc8000, 0xcc000, or in
the 0xd0000 range. EasyConnection 8/64 boards are even better, they only
require 4Kb of address space, again usually 0xc8000, 0xcc000 or 0xd0000
are good.

If you are using an EasyConnection 8/64-EI or ONboard/E then usually the
0xd0000 or 0xe0000 ranges are the best options below 1Mb. If neither of
them can be used then the high memory support to use the really high address
ranges is the best option. Typically the 2Gb range is convenient for them,
and gets them well out of the way.

There is a new utility program included called "stlstty". Most people
will not need to use this. If you have an ONboard/16 which has partial
signals on the upper 12 ports then this program can be used to set the
upper ports to have modem control instead of hardware flow control. Use
the "mapcts maprts" flag options to this utility on the port(s) that you
wish to do this mapping on, eg
    ./stlstty maprts mapcts < /dev/cue0
This enables RTS to act like DTR and CTS to act like DCD on the specified
port.

The ports of the EasyIO-8M board do not have DCD or DTR signals. So these
ports cannot be used as real modem devices. Generally when using these
ports you should only use the cueX devices.

There is another new utility in this package that reports statistics on
the serial ports. You will need to have the curses libray installed on
your system to build it.

To build the statistics display program type:
    make stlstats
Once compiled simply run it (you will need to be root) and it will display
a port sumary for the first board and panel installed. Use the digits to
select different board numbers, or 'n' to cycle through the panels on a
board. To look at detailed port information then hit 'p', that will display
detailed port 0 information. Use the digits and letteres 'a' through 'f' to
select the different ports (on this board and panel).



5. ACKNOWLEDGEMENTS

This driver is loosely based on code written by Theodore T'so, Linus
Torvalds, and others, so a big thanks to them all.



6. DISCLAIMER

The information contained in this document is beleived to be accurate and
reliable. However, no responsibility is assumed by Stallion Technologies
Pty. Ltd. for its use, nor any infringements of patents or other rights
of third parties resulting from its use. Stallion Technologies reserves
the right to modify the design of its products and will endeavour to change
the information in manuals and accompanying documentation accordingly.

