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