Path: blob/master/Documentation/blockdev/paride.txt
10821 views
1Linux and parallel port IDE devices23PARIDE v1.03 (c) 1997-8 Grant Guenther <[email protected]>451. Introduction67Owing to the simplicity and near universality of the parallel port interface8to personal computers, many external devices such as portable hard-disk,9CD-ROM, LS-120 and tape drives use the parallel port to connect to their10host computer. While some devices (notably scanners) use ad-hoc methods11to pass commands and data through the parallel port interface, most12external devices are actually identical to an internal model, but with13a parallel-port adapter chip added in. Some of the original parallel port14adapters were little more than mechanisms for multiplexing a SCSI bus.15(The Iomega PPA-3 adapter used in the ZIP drives is an example of this16approach). Most current designs, however, take a different approach.17The adapter chip reproduces a small ISA or IDE bus in the external device18and the communication protocol provides operations for reading and writing19device registers, as well as data block transfer functions. Sometimes,20the device being addressed via the parallel cable is a standard SCSI21controller like an NCR 5380. The "ditto" family of external tape22drives use the ISA replicator to interface a floppy disk controller,23which is then connected to a floppy-tape mechanism. The vast majority24of external parallel port devices, however, are now based on standard25IDE type devices, which require no intermediate controller. If one26were to open up a parallel port CD-ROM drive, for instance, one would27find a standard ATAPI CD-ROM drive, a power supply, and a single adapter28that interconnected a standard PC parallel port cable and a standard29IDE cable. It is usually possible to exchange the CD-ROM device with30any other device using the IDE interface.3132The document describes the support in Linux for parallel port IDE33devices. It does not cover parallel port SCSI devices, "ditto" tape34drives or scanners. Many different devices are supported by the35parallel port IDE subsystem, including:3637MicroSolutions backpack CD-ROM38MicroSolutions backpack PD/CD39MicroSolutions backpack hard-drives40MicroSolutions backpack 8000t tape drive41SyQuest EZ-135, EZ-230 & SparQ drives42Avatar Shark43Imation Superdisk LS-12044Maxell Superdisk LS-12045FreeCom Power CD46Hewlett-Packard 5GB and 8GB tape drives47Hewlett-Packard 7100 and 7200 CD-RW drives4849as well as most of the clone and no-name products on the market.5051To support such a wide range of devices, PARIDE, the parallel port IDE52subsystem, is actually structured in three parts. There is a base53paride module which provides a registry and some common methods for54accessing the parallel ports. The second component is a set of55high-level drivers for each of the different types of supported devices:5657pd IDE disk58pcd ATAPI CD-ROM59pf ATAPI disk60pt ATAPI tape61pg ATAPI generic6263(Currently, the pg driver is only used with CD-R drives).6465The high-level drivers function according to the relevant standards.66The third component of PARIDE is a set of low-level protocol drivers67for each of the parallel port IDE adapter chips. Thanks to the interest68and encouragement of Linux users from many parts of the world,69support is available for almost all known adapter protocols:7071aten ATEN EH-100 (HK)72bpck Microsolutions backpack (US)73comm DataStor (old-type) "commuter" adapter (TW)74dstr DataStor EP-2000 (TW)75epat Shuttle EPAT (UK)76epia Shuttle EPIA (UK)77fit2 FIT TD-2000 (US)78fit3 FIT TD-3000 (US)79friq Freecom IQ cable (DE)80frpw Freecom Power (DE)81kbic KingByte KBIC-951A and KBIC-971A (TW)82ktti KT Technology PHd adapter (SG)83on20 OnSpec 90c20 (US)84on26 OnSpec 90c26 (US)8586872. Using the PARIDE subsystem8889While configuring the Linux kernel, you may choose either to build90the PARIDE drivers into your kernel, or to build them as modules.9192In either case, you will need to select "Parallel port IDE device support"93as well as at least one of the high-level drivers and at least one94of the parallel port communication protocols. If you do not know95what kind of parallel port adapter is used in your drive, you could96begin by checking the file names and any text files on your DOS97installation floppy. Alternatively, you can look at the markings on98the adapter chip itself. That's usually sufficient to identify the99correct device.100101You can actually select all the protocol modules, and allow the PARIDE102subsystem to try them all for you.103104For the "brand-name" products listed above, here are the protocol105and high-level drivers that you would use:106107Manufacturer Model Driver Protocol108109MicroSolutions CD-ROM pcd bpck110MicroSolutions PD drive pf bpck111MicroSolutions hard-drive pd bpck112MicroSolutions 8000t tape pt bpck113SyQuest EZ, SparQ pd epat114Imation Superdisk pf epat115Maxell Superdisk pf friq116Avatar Shark pd epat117FreeCom CD-ROM pcd frpw118Hewlett-Packard 5GB Tape pt epat119Hewlett-Packard 7200e (CD) pcd epat120Hewlett-Packard 7200e (CD-R) pg epat1211222.1 Configuring built-in drivers123124We recommend that you get to know how the drivers work and how to125configure them as loadable modules, before attempting to compile a126kernel with the drivers built-in.127128If you built all of your PARIDE support directly into your kernel,129and you have just a single parallel port IDE device, your kernel should130locate it automatically for you. If you have more than one device,131you may need to give some command line options to your bootloader132(eg: LILO), how to do that is beyond the scope of this document.133134The high-level drivers accept a number of command line parameters, all135of which are documented in the source files in linux/drivers/block/paride.136By default, each driver will automatically try all parallel ports it137can find, and all protocol types that have been installed, until it finds138a parallel port IDE adapter. Once it finds one, the probe stops. So,139if you have more than one device, you will need to tell the drivers140how to identify them. This requires specifying the port address, the141protocol identification number and, for some devices, the drive's142chain ID. While your system is booting, a number of messages are143displayed on the console. Like all such messages, they can be144reviewed with the 'dmesg' command. Among those messages will be145some lines like:146147paride: bpck registered as protocol 0148paride: epat registered as protocol 1149150The numbers will always be the same until you build a new kernel with151different protocol selections. You should note these numbers as you152will need them to identify the devices.153154If you happen to be using a MicroSolutions backpack device, you will155also need to know the unit ID number for each drive. This is usually156the last two digits of the drive's serial number (but read MicroSolutions'157documentation about this).158159As an example, let's assume that you have a MicroSolutions PD/CD drive160with unit ID number 36 connected to the parallel port at 0x378, a SyQuest161EZ-135 connected to the chained port on the PD/CD drive and also an162Imation Superdisk connected to port 0x278. You could give the following163options on your boot command:164165pd.drive0=0x378,1 pf.drive0=0x278,1 pf.drive1=0x378,0,36166167In the last option, pf.drive1 configures device /dev/pf1, the 0x378168is the parallel port base address, the 0 is the protocol registration169number and 36 is the chain ID.170171Please note: while PARIDE will work both with and without the172PARPORT parallel port sharing system that is included by the173"Parallel port support" option, PARPORT must be included and enabled174if you want to use chains of devices on the same parallel port.1751762.2 Loading and configuring PARIDE as modules177178It is much faster and simpler to get to understand the PARIDE drivers179if you use them as loadable kernel modules.180181Note 1: using these drivers with the "kerneld" automatic module loading182system is not recommended for beginners, and is not documented here.183184Note 2: if you build PARPORT support as a loadable module, PARIDE must185also be built as loadable modules, and PARPORT must be loaded before the186PARIDE modules.187188To use PARIDE, you must begin by189190insmod paride191192this loads a base module which provides a registry for the protocols,193among other tasks.194195Then, load as many of the protocol modules as you think you might need.196As you load each module, it will register the protocols that it supports,197and print a log message to your kernel log file and your console. For198example:199200# insmod epat201paride: epat registered as protocol 0202# insmod kbic203paride: k951 registered as protocol 1204paride: k971 registered as protocol 2205206Finally, you can load high-level drivers for each kind of device that207you have connected. By default, each driver will autoprobe for a single208device, but you can support up to four similar devices by giving their209individual co-ordinates when you load the driver.210211For example, if you had two no-name CD-ROM drives both using the212KingByte KBIC-951A adapter, one on port 0x378 and the other on 0x3bc213you could give the following command:214215# insmod pcd drive0=0x378,1 drive1=0x3bc,1216217For most adapters, giving a port address and protocol number is sufficient,218but check the source files in linux/drivers/block/paride for more219information. (Hopefully someone will write some man pages one day !).220221As another example, here's what happens when PARPORT is installed, and222a SyQuest EZ-135 is attached to port 0x378:223224# insmod paride225paride: version 1.0 installed226# insmod epat227paride: epat registered as protocol 0228# insmod pd229pd: pd version 1.0, major 45, cluster 64, nice 0230pda: Sharing parport1 at 0x378231pda: epat 1.0, Shuttle EPAT chip c3 at 0x378, mode 5 (EPP-32), delay 1232pda: SyQuest EZ135A, 262144 blocks [128M], (512/16/32), removable media233pda: pda1234235Note that the last line is the output from the generic partition table236scanner - in this case it reports that it has found a disk with one partition.2372382.3 Using a PARIDE device239240Once the drivers have been loaded, you can access PARIDE devices in the241same way as their traditional counterparts. You will probably need to242create the device "special files". Here is a simple script that you can243cut to a file and execute:244245#!/bin/bash246#247# mkd -- a script to create the device special files for the PARIDE subsystem248#249function mkdev {250mknod $1 $2 $3 $4 ; chmod 0660 $1 ; chown root:disk $1251}252#253function pd {254D=$( printf \\$( printf "x%03x" $[ $1 + 97 ] ) )255mkdev pd$D b 45 $[ $1 * 16 ]256for P in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15257do mkdev pd$D$P b 45 $[ $1 * 16 + $P ]258done259}260#261cd /dev262#263for u in 0 1 2 3 ; do pd $u ; done264for u in 0 1 2 3 ; do mkdev pcd$u b 46 $u ; done265for u in 0 1 2 3 ; do mkdev pf$u b 47 $u ; done266for u in 0 1 2 3 ; do mkdev pt$u c 96 $u ; done267for u in 0 1 2 3 ; do mkdev npt$u c 96 $[ $u + 128 ] ; done268for u in 0 1 2 3 ; do mkdev pg$u c 97 $u ; done269#270# end of mkd271272With the device files and drivers in place, you can access PARIDE devices273like any other Linux device. For example, to mount a CD-ROM in pcd0, use:274275mount /dev/pcd0 /cdrom276277If you have a fresh Avatar Shark cartridge, and the drive is pda, you278might do something like:279280fdisk /dev/pda -- make a new partition table with281partition 1 of type 83282283mke2fs /dev/pda1 -- to build the file system284285mkdir /shark -- make a place to mount the disk286287mount /dev/pda1 /shark288289Devices like the Imation superdisk work in the same way, except that290they do not have a partition table. For example to make a 120MB291floppy that you could share with a DOS system:292293mkdosfs /dev/pf0294mount /dev/pf0 /mnt2952962972.4 The pf driver298299The pf driver is intended for use with parallel port ATAPI disk300devices. The most common devices in this category are PD drives301and LS-120 drives. Traditionally, media for these devices are not302partitioned. Consequently, the pf driver does not support partitioned303media. This may be changed in a future version of the driver.3043052.5 Using the pt driver306307The pt driver for parallel port ATAPI tape drives is a minimal driver.308It does not yet support many of the standard tape ioctl operations.309For best performance, a block size of 32KB should be used. You will310probably want to set the parallel port delay to 0, if you can.3113122.6 Using the pg driver313314The pg driver can be used in conjunction with the cdrecord program315to create CD-ROMs. Please get cdrecord version 1.6.1 or later316from ftp://ftp.fokus.gmd.de/pub/unix/cdrecord/ . To record CD-R media317your parallel port should ideally be set to EPP mode, and the "port delay"318should be set to 0. With those settings it is possible to record at 2x319speed without any buffer underruns. If you cannot get the driver to work320in EPP mode, try to use "bidirectional" or "PS/2" mode and 1x speeds only.3213223233. Troubleshooting3243253.1 Use EPP mode if you can326327The most common problems that people report with the PARIDE drivers328concern the parallel port CMOS settings. At this time, none of the329PARIDE protocol modules support ECP mode, or any ECP combination modes.330If you are able to do so, please set your parallel port into EPP mode331using your CMOS setup procedure.3323333.2 Check the port delay334335Some parallel ports cannot reliably transfer data at full speed. To336offset the errors, the PARIDE protocol modules introduce a "port337delay" between each access to the i/o ports. Each protocol sets338a default value for this delay. In most cases, the user can override339the default and set it to 0 - resulting in somewhat higher transfer340rates. In some rare cases (especially with older 486 systems) the341default delays are not long enough. if you experience corrupt data342transfers, or unexpected failures, you may wish to increase the343port delay. The delay can be programmed using the "driveN" parameters344to each of the high-level drivers. Please see the notes above, or345read the comments at the beginning of the driver source files in346linux/drivers/block/paride.3473483.3 Some drives need a printer reset349350There appear to be a number of "noname" external drives on the market351that do not always power up correctly. We have noticed this with some352drives based on OnSpec and older Freecom adapters. In these rare cases,353the adapter can often be reinitialised by issuing a "printer reset" on354the parallel port. As the reset operation is potentially disruptive in355multiple device environments, the PARIDE drivers will not do it356automatically. You can however, force a printer reset by doing:357358insmod lp reset=1359rmmod lp360361If you have one of these marginal cases, you should probably build362your paride drivers as modules, and arrange to do the printer reset363before loading the PARIDE drivers.3643653.4 Use the verbose option and dmesg if you need help366367While a lot of testing has gone into these drivers to make them work368as smoothly as possible, problems will arise. If you do have problems,369please check all the obvious things first: does the drive work in370DOS with the manufacturer's drivers ? If that doesn't yield any useful371clues, then please make sure that only one drive is hooked to your system,372and that either (a) PARPORT is enabled or (b) no other device driver373is using your parallel port (check in /proc/ioports). Then, load the374appropriate drivers (you can load several protocol modules if you want)375as in:376377# insmod paride378# insmod epat379# insmod bpck380# insmod kbic381...382# insmod pd verbose=1383384(using the correct driver for the type of device you have, of course).385The verbose=1 parameter will cause the drivers to log a trace of their386activity as they attempt to locate your drive.387388Use 'dmesg' to capture a log of all the PARIDE messages (any messages389beginning with paride:, a protocol module's name or a driver's name) and390include that with your bug report. You can submit a bug report in one391of two ways. Either send it directly to the author of the PARIDE suite,392by e-mail to [email protected], or join the linux-parport mailing list393and post your report there.3943953.5 For more information or help396397You can join the linux-parport mailing list by sending a mail message398to399[email protected]400401with the single word402403subscribe404405in the body of the mail message (not in the subject line). Please be406sure that your mail program is correctly set up when you do this, as407the list manager is a robot that will subscribe you using the reply408address in your mail headers. REMOVE any anti-spam gimmicks you may409have in your mail headers, when sending mail to the list server.410411You might also find some useful information on the linux-parport412web pages (although they are not always up to date) at413414http://web.archive.org/web/*/http://www.torque.net/parport/415416417418419