Initial import from FreeBSD RELENG_4:
[dragonfly.git] / sys / i386 / isa / README.stl
1 $FreeBSD: src/sys/i386/isa/README.stl,v 1.3.6.2 2001/08/30 12:29:57 murray Exp $
2
3 Stallion Multiport Serial Driver Readme
4 ---------------------------------------
5
6 Version: 2.0.0
7 Date:    22JAN98
8 Author:  Greg Ungerer (gerg@stallion.com)
9
10
11
12 1. INTRODUCTION
13
14 This is a set of FreeBSD drivers for most of the Stallion Technologies
15 range of multiport serial boards.
16
17 This driver has not been developed by Stallion Technologies. I developed it
18 in my spare time in the hope that it would be useful. As such there is no
19 warranty or support of any form. What this means is that this driver is not
20 officially supported by Stallion Technologies, so don't ring their support
21 if you can't get it working. They will probably not be able to help you.
22 Instead email me if you have problems or bug reports and I will do what I
23 can... (Sorry to sound so heavy handed, but I need to stress that this driver
24 is not officially supported in any way.)
25
26 This package actually contains two drivers. One is for the true Stallion
27 intelligent multiport boards, and the other is for the smart range of boards.
28
29 All host driver source is included in this package, and is copyrighted under
30 a BSD style copyright. The board "firmware" code in this package is copyright
31 Stallion Technologies (the files cdk.sys and 2681.sys).
32
33
34 1.1 SMART MULTIPORT BOARD DRIVER
35
36 This driver supports the EasyIO, EasyConnection 8/32 and EasyConnection
37 8/64-PCI range of boards. These boards are not classic intelligent multiport
38 boards, but are host based multiport boards that use Cirrus Logic CL-CD1400
39 UART's, or on newer versions of the hardware use the Signetics 26C198 UART.
40 Both of these are high performance UART's with built in FIFO's, automatic
41 flow control and a host of other features.
42
43 The EasyIO range of cards comes in 4 forms, the EasyIO-4, EasyIO-8,
44 EasyIO-8M and EasyIO-8-PCI. The first three are ISA based boards while
45 the last is a PCI bus board. All of these are non-expandable, low cost,
46 multiport boards with 4 or 8 RS-232C ports. Each ISA EasyIO board requires 8
47 bytes of I/O address space and 1 interrupt. The PCI EasyIO board uses 64
48 bytes of I/O address space and 1 interrupt. On EISA and PCI systems it is
49 possible to share 1 interrupt between multiple boards. The EasyIO-4 has 10
50 pin RJ connectors, and the EasyIO-8 comes with a dongle cable with either 10
51 pin RJ connectors or DB-25 connectors. The EasyIO-8M has 6 pin RJ connectors.
52
53 The EasyConnection 8/32 family of boards is a relatively low cost modular
54 range of multiport serial boards. The EasyConnection 8/32 boards can be
55 configured to have from 8 to 32 serial ports by plugging in external serial
56 port modules that contain either 8 or 16 ports each. There is a wide range
57 of external modules available that offer: DB-25 connectors, RJ-45 connectors
58 (both with RS-232 D and E compatible drivers), and also RS-422 and RS-485
59 ports. The EasyConnection 8/32 boards come in ISA, PCI and MCA bus versions.
60 The board takes the form of a host adapter card, with an external connector
61 cable that plugs into the external modules. The external modules just clip
62 together to add ports (BTW, they are NOT hot pluggable). Each ISA
63 EasyConnection 8/32 board requires two separate I/O address ranges, one two
64 bytes in size and a secondary region of 32 bytes. Each PCI EasyConnection
65 8/32 requires two regions of I/O address space, normally these will be
66 automatically allocated by the system BIOS at power on time. Each MCA
67 EasyConnection board requires one I/O address region 64 bytes in size. All
68 board types also require one interrupt. On EISA systems multiple boards can
69 share one interrupt. The secondary I/O range of the ISA board (the 32 byte
70 range) can be shared between multiple boards on any bus type.
71
72 The EasyConnection 8/64-PCI family is similar to the EasyConnection 8/32-PCI
73 board, and uses the same external modules. It is supported by the smart
74 board driver - not the intelligent board driver. It uses 2 regions of I/O
75 address space, both 64 bytes in size, and 1 interrupt.
76
77
78 1.2 INTELLIGENT MULTIPORT BOARD DRIVER
79
80 This driver is for Stallion's range of true intelligent multiport boards.
81 It supports the EasyConnection 8/64, ONboard and Brumby families of multiport
82 boards. The EasyConnection 8/64 and ONboard boards come in ISA, EISA and
83 Microchannel bus versions. The Brumby boards are only available in ISA
84 versions. This driver can also work with the original Stallion board, but
85 these are no longer supported by Stallion Technologies.
86
87 The EasyConnection 8/64 family of boards is a medium cost, high performance,
88 modular range of intelligent multiport serial boards. The EasyConnection 8/64
89 boards can be configured to have from 8 to 64 serial ports by plugging in
90 external serial port modules that contain either 8 or 16 ports each (these
91 modules are the same used by the EasyConnection 8/32 board). There is a wide
92 range of external modules available that offer: DB-25 connectors, RJ-45
93 connectors (both with RS-232 D and E compatible drivers), and also RS-422 and
94 RS-485 ports. The board takes the form of a host adapter card, with an external
95 connector cable that plugs into the external modules. The external modules
96 just clip together to add ports (BTW, they are NOT hot pluggable). Each
97 EasyConnection 8/64 board requires 4 bytes of I/O address space and a region
98 of memory space. The size of the memory region required depends on the exact
99 board type. The EISA version requires 64 Kbytes of address space (that can
100 reside anywhere in the 4 Gigabyte physical address space). The ISA and MCA
101 boards require 4 Kbytes of address space (which must reside in the lower
102 1 Mbyte of physical address space - typically in the c8000 to e0000 range).
103 No interrupts are required. The physical memory region of multiple
104 EasyConnection 8/64 boards can be shared, but each board must have a separate
105 I/O address.
106
107 The ONboard family of boards are traditional intelligent multiport serial
108 boards. They are Stallion's older range of boards with a limited expansion
109 capability. They come in 4, 8, 12, 16 and 32 port versions. The board uses
110 the same base card (which has 4 ports on it) and is expanded to more ports via
111 a mezzanine board that attaches directly onto the base card. External panels
112 plug into the ONboard providing RS-232C ports with DB-25 plugs. An RS-422
113 DB-25 dual interface panel is also available. The ISA and microchannel
114 ONboards require 16 bytes of I/O address space and 64K bytes of memory
115 space. The memory space can be anywhere in the 16 Mbyte ISA bus address
116 range. No interrupt is required. The EISA ONboard requires 64 Kbytes of
117 memory space that can be anywhere in the 4 Gigabyte physical address space.
118 All ONboard boards can share their memory region with other ONboards (or
119 EasyConnection 8/64 boards).
120
121 The Brumby family of boards are traditional, low cost intelligent multiport
122 serial boards. They are non-expandable and come in 4, 8 and 16 port versions.
123 They are only available for the ISA bus. The serial ports are all on DB-25
124 "dongle" cables that attach to the rear of the board. Each Brumby board
125 requires 16 bytes of I/O address space and 16 Kbytes of memory space. No
126 interrupts are required.
127
128 The original Stallion boards are old. They went out of production some years
129 back and are no longer supported. They offer limited expandability and are
130 available in 8 or 16 port configurations. An external panel houses 16 RS-232C
131 ports with DB-9 connectors. They require 16 bytes of I/O address space, and
132 either 64K or 128K of memory space. No interrupt is required.
133
134 That's the boards supported by the second driver. The ONboard, Brumby and
135 Stallion boards are Stallion's older range of intelligent multiports - so
136 there are lots of them around. They only support a maximum baud rate of
137 38400. The EasyConnection 8/64 is a true high performance intelligent
138 multiport board, having much greater throughput than any of Stallion's
139 older boards. It also supports speeds up to 460800 baud.
140
141
142 1.3 HOW TO GET BOARDS
143
144 Stallion Technologies has offices all over the world, as well as many more
145 distributors and resellers. To find out about local availability please
146 contact the nearest Stallion office and they can give you all the information
147 you need. Look in the "Offices" file in the driver package for a current list
148 of Stallion Technologies offices.
149
150 Another good source of information about the Stallion range of boards and
151 local availability is on the Stallion Web page. Check it out at
152 http://www.stallion.com.
153
154
155
156 2. INSTALLATION
157
158 This driver, as is, will work on a FreeBSD 2.2.5 system. It will run on any
159 FreeBSD system version 2.0.5 and up, including -current version systems.
160 For systems other than 2.2.0 and 2.2.5  you will need to change the version
161 define in the driver source. Look for the symbol name VFREEBSD, then change
162 it to match the version number of your FreeBSD system (for example 2.2.5 is
163 225, 3.0.0 would be 300, etc).
164
165 Recent versions of FreeBSD 2.1.5 and above include the Stallion drivers
166 in the distribution. You may still need to use this source for these systems.
167 If the code in this package is newer than the version enclosed on your
168 FreeBSD installation then you should use this source instead.
169
170 You will need to build a new kernel to use this driver. So the first thing
171 you need is to have the full kernel source. Most people will have this
172 (I hope!). The following assumes that the kernel source is in /usr/src/sys.
173
174 The drivers can support up to 8 boards. For the smart board driver any
175 combination of EasyIO, EasyConnection 8/32 and EasyConnection 8/64-PCI
176 boards can be installed. For the intelligent any combination of
177 EasyConnection 8/64 (ISA and EISA), ONboard, Brumby or original Stallion.
178 So there is a theoretical maximum of 512 ports.
179
180 2.1 Instructions to install:
181
182 1. Copy the driver source files into the kernel source tree.
183
184         cp stallion.c istallion.c /usr/src/sys/i386/isa
185         cp cdk.h comstats.h /usr/src/sys/i386/include
186         cp scd1400.h sc26198.h /usr/src/sys/i386/isa/ic
187
188    Note: if you are NOT using FreeBSD 2.2.5 then you will need to edit the
189    stallion.c and istallion.c files and change the VFREEBSD define to match
190    your version. This define is near the top of the file, and should be
191    easy to find.
192
193 2. If you are using FreeBSD version 2.2.0 or above then jump to step 4 now.
194
195    Add a character device switch table entry for the driver that you wish
196    to use into the cdevsw table structure. This involves adding some code
197    into the kernel conf.c file. 
198
199    If you are using an EasyIO, EasyConnection 8/32 or EasyConnection 8/64-PCI
200    then you need to use the stallion.c driver. All other board types
201    (EasyConnection 8/64 (ISA and EISA), ONboard, Brumby, Stallion) use the
202    istallion.c driver. You can also have a mix of boards using both drivers.
203    You will need to use a different major device number for the second driver
204    though (not the default 72 - see below for more details on this).
205
206 2.1. If using the stallion.c driver then do:
207
208         cd /usr/src/sys/i386/i386
209         vi conf.c
210             - add the following lines (in 2.1.0 I put them at line 729):
211
212 /* Stallion Multiport Serial Driver */
213 #include "stl.h"
214 #if     NSTL > 0
215 d_open_t        stlopen;
216 d_close_t       stlclose;
217 d_read_t        stlread;
218 d_write_t       stlwrite;
219 d_ioctl_t       stlioctl;
220 d_stop_t        stlstop;
221 d_ttycv_t       stldevtotty;
222 #define stlreset        nxreset
223 #define stlmmap         nxmmap
224 #define stlstrategy     nxstrategy
225 #else
226 #define stlopen         nxopen
227 #define stlclose        nxclose
228 #define stlread         nxread
229 #define stlwrite        nxwrite
230 #define stlioctl        nxioctl
231 #define stlstop         nxstop
232 #define stlreset        nxreset
233 #define stlmmap         nxmmap
234 #define stlstrategy     nxstrategy
235 #define stldevtotty     nxdevtotty
236 #endif
237
238
239             - and then inside the actual cdevsw structure definition, at the
240               last entry add (this is now line 1384 in the 2.1 conf.c):
241
242         { stlopen,      stlclose,       stlread,        stlwrite,       /*72*/
243           stlioctl,     stlstop,        stlreset,       stldevtotty,/*stallion*/
244           ttselect,     stlmmap,        stlstrategy },
245
246             - the line above used major number 72, but this may be different
247               on your system. Take note of what major number you are using.
248               
249             - save the file and exit vi.
250
251
252 2.2. If using the istallion.c driver then do:
253
254         cd /usr/src/sys/i386/i386
255         vi conf.c
256             - add the following lines (in 2.1.0 I put them at line 729):
257
258 /* Stallion Intelligent Multiport Serial Driver */
259 #include "stl.h"
260 #if     NSTL > 0
261 d_open_t        stliopen;
262 d_close_t       stliclose;
263 d_read_t        stliread;
264 d_write_t       stliwrite;
265 d_ioctl_t       stliioctl;
266 d_stop_t        stlistop;
267 d_ttycv_t       stlidevtotty;
268 #define stlireset       nxreset
269 #define stlimmap        nxmmap
270 #define stlistrategy    nxstrategy
271 #else
272 #define stliopen        nxopen
273 #define stliclose       nxclose
274 #define stliread        nxread
275 #define stliwrite       nxwrite
276 #define stliioctl       nxioctl
277 #define stlistop        nxstop
278 #define stlireset       nxreset
279 #define stlimmap        nxmmap
280 #define stlistrategy    nxstrategy
281 #define stlidevtotty    nxdevtotty
282 #endif
283
284
285             - and then inside the actual cdevsw structure definition, at the
286               last entry add (this is now line 1384 in the 2.1 conf.c):
287
288         { stliopen,     stliclose,      stliread,     stliwrite,        /*72*/
289           stliioctl,    stlistop,       stlireset,    stlidevtotty,/*istallion*/
290           ttselect,     stlimmap,       stlistrategy },
291
292             - the line above used major number 72, but this may be different
293               on your system. Take note of what major number you are using.
294               
295             - save the file and exit vi.
296
297 3. Add the driver source files to the kernel files list:
298
299         cd /usr/src/sys/i386/conf
300         vi files.i386
301             - add the following definition lines into the list (it is stored
302               alphabetically, so insert them appropriately):
303
304 i386/isa/istallion.c            optional        stli    device-driver
305
306 i386/isa/stallion.c             optional        stl     device-driver
307
308             - save the file and exit vi.
309
310 4. Add board probe entries into the kernel configuration file:
311
312         cd /usr/src/sys/i386/conf
313         cp GENERIC MYKERNEL
314             - if you already have a kernel config that you use then you
315               could just use that (instead of MYKERNEL)
316         vi MYKERNEL
317             - if only using PCI boards then you don't need to enter a
318               configuration line, the kernel will automatically detect
319               the board at boot up, so skip to step 5.
320             - enter a line for each board that you want to use. For stallion.c
321               boards entries should look like:
322
323 device          stl0    at isa? port 0x2a0 tty irq 10 vector stlintr
324
325               For istallion.c boards, the entries should look like:
326
327 device          stli0   at isa? port 0x2a0 tty iomem 0xcc000 iosiz 0x1000 flags 23
328
329               (I suggest you put them after the sio entries)
330               (Don't enter lines for PCI boards)
331             - change the entry resources as required. For the stallion.c
332               entries this may involve changing the port address or irq.
333               For the istallion.c entries this may involve changing the port
334               address, iomem address, iosiz value and the flags. Select from
335               the following table for appropriate flags and iosiz values for
336               your board type:
337
338               EasyConnection 8/64 ISA:     flags 23         iosiz 0x1000
339               EasyConnection 8/64 EISA:    flags 24         iosiz 0x10000
340               EasyConnection 8/64 MCA:     flags 25         iosiz 0x1000
341               ONboard ISA:                 flags 4          iosiz 0x10000
342               ONboard EISA:                flags 7          iosiz 0x10000
343               ONboard MCA:                 flags 3          iosiz 0x10000
344               Brumby:                      flags 2          iosiz 0x4000
345               Stallion:                    flags 1          iosiz 0x10000
346
347             - save the file and exit
348             - more detailed information about board configuration and
349               some helpful examples are contained in the driver manual
350               pages.
351
352 5. Build a new kernel using this configuration.
353
354         cd /usr/src/sys/i386/conf
355         config MYKERNEL
356         cd ../../compile/MYKERNEL
357         make depend
358         make all
359         make install
360
361
362 And there you have it!
363
364 Once you have a new kernel built reboot to start it up. On startup the
365 Stallion board probes will report on whether the boards were found or not.
366 For each board found the driver will print out the type of board found,
367 and how many panels and ports it has. 
368
369 If a board is not found by the driver but is actually in the system then the
370 most likely problem is that the IO address is incorrect. The easiest thing to
371 do is change the DIP switches on the board to the desired address and reboot.
372
373 On EasyIO and EasyConnection 8/32 boards the IRQ is software programmable,
374 so if there is a conflict you may need to change the IRQ used for a board in
375 the MYKERNEL configuration file and rebuild the kernel.
376
377 Note that the secondary IO address of the EasyConnection 8/32 boards is hard
378 coded into the stallion.c driver code. It is currently set to IO address
379 0x280. If you need to use a different address then you will need to edit this
380 file and change the variable named stl_ioshared.
381
382 On intelligent boards it is possible that the board shared memory region is
383 clashing with that of some other device. Check for this and change the device
384 or kernel configuration as required.
385
386
387 2.2 INTELLIGENT DRIVER OPERATION
388
389 The intelligent boards also need to have their "firmware" code downloaded
390 to them. This is done via a user level application supplied in the driver
391 package called "stlload". Compile this program where ever you dropped the
392 package files, by typing "make". In its simplest form you can then type
393     ./stlload -i cdk.sys
394 in this directory and that will download board 0 (assuming board 0 is an
395 EasyConnection 8/64 board). To download to an ONboard, Brumby or Stallion do:
396     ./stlload -i 2681.sys
397
398 Normally you would want all boards to be downloaded as part of the standard
399 system startup. To achieve this, add one of the lines above into the
400 /etc/rc.serial file. To download each board just add the "-b <brd-number>"
401 option to the line. You will need to download code for every board. You should
402 probably move the stlload program into a system directory, such as /usr/sbin.
403 Also, the default location of the cdk.sys image file in the stlload
404 down-loader is /usr/libdata/stallion. Create that directory and put the
405 cdk.sys and 2681.sys files in it. (It's a convenient place to put them
406 anyway). As an example your /etc/rc.serial file might have the following
407 lines added to it (if you had 3 boards):
408     /usr/sbin/stlload -b 0 -i /usr/libdata/stallion/cdk.sys
409     /usr/sbin/stlload -b 1 -i /usr/libdata/stallion/2681.sys
410     /usr/sbin/stlload -b 2 -i /usr/libdata/stallion/2681.sys
411
412 The image files cdk.sys and 2681.sys are specific to the board types. The
413 cdk.sys will only function correctly on an EasyConnection 8/64 (ISA and EISA)
414 board. Similarly the 2681.sys image will only operate on ONboard, Brumby and
415 Stallion boards. If you load the wrong image file into a board it will fail
416 to start up, and of course the ports will not be operational!
417
418
419
420 3. USING THE DRIVER
421
422 Once the driver is installed you will need to setup some device nodes to
423 access the serial ports. Use the supplied "mkdevnods" script to automatically
424 create all required device entries for your boards. To make device nodes for
425 more than 1 board then just supply the number of boards you are using as a
426 command line parameter to mkdevnods and it will create nodes for that number
427 of boards. By default it will create device nodes for 1 board only.
428
429 Note that if the driver is not installed at character major number 72 then
430 you will need to edit the mkdevnods script and modify the STL_SERIALMAJOR
431 variable to the major number you are using.
432
433 Device nodes created for the normal serial port devices are named /dev/ttyEX
434 where X is the port number. (The second boards ports will start from ttyE64,
435 the third boards from ttyE128, etc). It will also create a set of modem call
436 out devices named cueX where again X is the port number.
437
438 For the most part the Stallion driver tries to emulate the standard PC system
439 com ports and the standard sio serial driver. The idea is that you should
440 be able to use Stallion board ports and com ports inter-changeably without
441 modifying anything but the device name. Anything that doesn't work like that
442 should be considered a bug in this driver!
443
444 Since this driver tries to emulate the standard serial ports as much as
445 possible then most system utilities should work as they do for the standard
446 com ports. Most importantly "stty" works as expected and "comcontrol" can be
447 used just like for the serial ports.
448
449 This driver should work with anything that works on standard com serial ports.
450 Having said that, I have used it on at least the following types of "things"
451 under FreeBSD:
452     a) standard dumb terminals (using getty)
453     b) modems (using cu, etc)
454     c) ppp (through pppd, kernel ppp)
455
456
457
458 4. NOTES
459
460 Please email me any feedback on bugs, problems, or even good experiences
461 with these drivers!
462
463 You can use both drivers at once if you have a mix of board types installed
464 in a system. On FreeBSD 2.1.5 and later systems each driver has been
465 assigned a different major number. On earlier FreeBSD versions you may
466 need to manually assign each driver a different major number. You will
467 also need to adjust the names of the device nodes for each board. To do
468 this modify the mkdevnods script to make device nodes based on those new
469 major numbers. For example, you could change the istallion.c driver to use
470 major number 75. You will also need to create device nodes with different
471 names for the ports, for eg ttyFXXX.
472
473 Currently the intelligent board driver (istallion.c) does not have the
474 ability to share a boards memory region with other boards (you can only do
475 this on EasyConnection 8/64 and ONboards normally anyway). It also does
476 not currently support any memory address ranges above the low 1Mb region.
477 These will be fixed in a future release of the driver.
478
479 Finding a free physical memory address range can be a problem. The older
480 boards like the Stallion and ONboard need large areas (64K or even 128K), so
481 they can be very difficult to get into a system. If you have 16 Mb of RAM
482 then you have no choice but to put them somewhere in the 640K -> 1Mb range.
483 ONboards require 64K, so typically 0xd0000 is good, or 0xe0000 on some
484 systems. If you have an original Stallion board, "V4.0" or Rev.O, then you
485 need a 64K memory address space, so again 0xd0000 and 0xe0000 are good. Older
486 Stallion boards are a much bigger problem. They need 128K of address space and
487 must be on a 128K boundary. If you don't have a VGA card then 0xc0000 might be
488 usable - there is really no other place you can put them below 1Mb.
489
490 Both the ONboard and old Stallion boards can use higher memory addresses as
491 well, but you must have less than 16Mb of RAM to be able to use them. Usual
492 high memory addresses used include 0xec0000 and 0xf00000.
493
494 The Brumby boards only require 16Kb of address space, so you can usually
495 squeeze them in somewhere. Common addresses are 0xc8000, 0xcc000, or in
496 the 0xd0000 range. EasyConnection 8/64 boards are even better, they only
497 require 4Kb of address space, again usually 0xc8000, 0xcc000 or 0xd0000
498 are good.
499
500 If you are using an EasyConnection 8/64-EI or ONboard/E then usually the
501 0xd0000 or 0xe0000 ranges are the best options below 1Mb. If neither of
502 them can be used then the high memory support to use the really high address
503 ranges is the best option. Typically the 2Gb range is convenient for them,
504 and gets them well out of the way.
505
506 The ports of the EasyIO-8M board do not have DCD or DTR signals. So these
507 ports cannot be used as real modem devices. Generally when using these
508 ports you should only use the cueX devices.
509
510 There is a utility in this package that reports statistics on the serial
511 ports. You will need to have the ncurses library installed on your system
512 to build it.
513
514 To build the statistics display program type:
515     make stlstats
516 Once compiled simply run it (you will need to be root) and it will display
517 a port summary for the first board and panel installed. Use the digits to
518 select different board numbers, or 'n' to cycle through the panels on a
519 board. To look at detailed port information then hit 'p', that will display
520 detailed port 0 information. Use the digits and letters 'a' through 'f' to
521 select the different ports (on this board and panel).
522
523
524
525 5. ACKNOWLEDGEMENTS
526
527 This driver is loosely based on the code of the FreeBSD sio serial driver.
528 A big thanks to Stallion Technologies for the use of their equipment.
529