home *** CD-ROM | disk | FTP | other *** search
/ Freelog 2 / Freelog002.iso / Linux / Slackware / docs / linux-2.0.35 / paride.txt < prev    next >
Encoding:
Text File  |  1999-02-08  |  13.9 KB  |  361 lines

  1.  
  2.         Linux and parallel port IDE devices
  3.  
  4.  
  5. PARIDE-2.0.35   (c) 1997-8  Grant Guenther <grant@torque.net>
  6.  
  7. *************************************************************************
  8.  
  9. Special notes for the 2.0.35 version:
  10.  
  11. (i)   This is the paride from 2.1.107 retrofitted to work with 2.0.34.
  12.      
  13. (ii)  PARPORT is _not_ supported.  If you obtain the PARPORT patches
  14.       for 2.0 and try to use them, it might work.  I have not tried
  15.       it.
  16.  
  17. (iii) There is no guarantee of any ongoing support or future development
  18.       for this special retrofit.
  19.  
  20. (iv)  I have not built or tested PARIDE with SMP support in 2.0.35,
  21.       use it at your own risk.
  22.  
  23. *************************************************************************
  24.  
  25. 1. Introduction
  26.  
  27. Owing to the simplicity and near universality of the parallel port interface
  28. to personal computers, many external devices such as portable hard-disk,
  29. CD-ROM, LS-120 and tape drives use the parallel port to connect to their
  30. host computer.  While some devices (notably scanners) use ad-hoc methods
  31. to pass commands and data through the parallel port interface, most 
  32. external devices are actually identical to an internal model, but with
  33. a parallel-port adapter chip added in.  Some of the original parallel port
  34. adapters were little more than mechanisms for multiplexing a SCSI bus.
  35. (The Iomega PPA-3 adapter used in the ZIP drives is an example of this
  36. approach).  Most current designs, however, take a different approach.
  37. The adapter chip reproduces a small ISA or IDE bus in the external device
  38. and the communication protocol provides operations for reading and writing
  39. device registers, as well as data block transfer functions.  Sometimes,
  40. the device being addressed via the parallel cable is a standard SCSI
  41. controller like an NCR 5380.  The "ditto" family of external tape
  42. drives use the ISA replicator to interface a floppy disk controller,
  43. which is then connected to a floppy-tape mechanism.  The vast majority
  44. of external parallel port devices, however, are now based on standard
  45. IDE type devices, which require no intermediate controller.  If one
  46. were to open up a parallel port CD-ROM drive, for instance, one would
  47. find a standard ATAPI CD-ROM drive, a power supply, and a single adapter
  48. that interconnected a standard PC parallel port cable and a standard
  49. IDE cable.  It is usually possible to exchange the CD-ROM device with
  50. any other device using the IDE interface. 
  51.  
  52. The document describes the support in Linux for parallel port IDE
  53. devices.  It does not cover parallel port SCSI devices, "ditto" tape
  54. drives or scanners.  Many different devices are supported by the 
  55. parallel port IDE subsystem, including:
  56.  
  57.     MicroSolutions backpack CD-ROM
  58.     MicroSolutions backpack PD/CD
  59.     MicroSolutions backpack hard-drives
  60.     MicroSolutions backpack 8000t tape drive
  61.     SyQuest EZ-135, EZ-230 & SparQ drives
  62.     Avatar Shark
  63.     Imation Superdisk LS-120
  64.     FreeCom Power CD
  65.     Hewlett-Packard 5GB tape drive
  66.     Hewlett-Packard 7100 and 7200 CD-RW drives
  67.  
  68. as well as most of the clone and no-name products on the market.
  69.  
  70. To support such a wide range of devices, PARIDE, the parallel port IDE
  71. subsystem, is actually structured in three parts.   There is a base
  72. paride module which provides a registry and some common methods for
  73. accessing the parallel ports.  The second component is a set of 
  74. high-level drivers for each of the different type of supported device: 
  75.  
  76.     pd    IDE disk
  77.     pcd    ATAPI CD-ROM
  78.     pf    ATAPI disk
  79.     pt    ATAPI tape
  80.     pg    ATAPI generic
  81.  
  82. (Currently, the pg driver is only used with CD-R drives).
  83.  
  84. The high-level drivers function according to the relevant standards.
  85. The third component of PARIDE is a set of low-level protocol drivers
  86. for each of the parallel port IDE adapter chips.  Thanks to the interest
  87. and encouragement of Linux users from many parts of the world, 
  88. support is available for almost all known adapter protocols:
  89.  
  90.         aten    ATEN EH-100                            (HK)
  91.         bpck    Microsolutions backpack                (US)
  92.         comm    DataStor (old-type) "commuter" adapter (TW)
  93.         dstr    DataStor EP-2000                       (TW)
  94.         epat    Shuttle EPAT                           (UK)
  95.         epia    Shuttle EPIA                           (UK)
  96.     fit2    FIT TD-2000                   (US)
  97.     fit3    FIT TD-3000                   (US)
  98.         frpw    Freecom Power                          (DE)
  99.         kbic    KingByte KBIC-951A and KBIC-971A       (TW)
  100.     ktti    KT Technology PHd adapter              (SG)
  101.         on20    OnSpec 90c20                           (US)
  102.         on26    OnSpec 90c26                           (US)
  103.  
  104.  
  105. 2. Using the PARIDE subsystem
  106.  
  107. While configuring the Linux kernel, you may choose either to build
  108. the PARIDE drivers into your kernel, or to build them as modules.
  109.  
  110. In either case, you will need to select "Parallel port IDE device support"
  111. as well as at least one of the high-level drivers and at least one
  112. of the parallel port communication protocols.  If you do not know
  113. what kind of parallel port adapter is used in your drive, you could
  114. begin by checking the file names and any text files on your DOS 
  115. installation floppy.  Alternatively, you can look at the markings on
  116. the adapter chip itself.  That's usually sufficient to identify the
  117. correct device.  
  118.  
  119. You can actually select all the protocol modules, and allow the PARIDE
  120. subsystem to try them all for you.
  121.  
  122. For the "brand-name" products listed above, here are the protocol
  123. and high-level drivers that you would use:
  124.  
  125.     Manufacturer        Model        Driver    Protocol
  126.     
  127.     MicroSolutions        CD-ROM        pcd    bpck
  128.     MicroSolutions        PD drive    pf    bpck
  129.     MicroSolutions        hard-drive    pd    bpck
  130.     MicroSolutions          8000t tape      pt      bpck
  131.     SyQuest            EZ, SparQ    pd    epat
  132.     Imation            Superdisk    pf    epat
  133.     Avatar            Shark        pd    epat
  134.     FreeCom            CD-ROM        pcd    frpw
  135.     Hewlett-Packard        5GB Tape    pt    epat
  136.     Hewlett-Packard        7100/7200    pg    epat
  137.  
  138. 2.1  Configuring built-in drivers
  139.  
  140. We recommend that you get to know how the drivers work and how to
  141. configure them as loadable modules, before attempting to compile a
  142. kernel with the drivers built-in.
  143.  
  144. If you built all of your PARIDE support directly into your kernel,
  145. and you have just a single parallel port IDE device, your kernel should
  146. locate it automatically for you.  If you have more than one device,
  147. you may need to give some command line options to your bootloader
  148. (eg: LILO), how to do that is beyond the scope of this document.
  149.  
  150. The high-level drivers accept a number of command line parameters, all
  151. of which are documented in the source files in linux/drivers/block/paride.
  152. By default, each driver will automatically try all parallel ports it
  153. can find, and all protocol types that have been installed, until it finds
  154. a parallel port IDE adapter.  Once it finds one, the probe stops.  So,
  155. if you have more than one device, you will need to tell the drivers
  156. how to identify them.  This requires specifying the port address, the
  157. protocol identification number and, for some devices, the drive's
  158. chain ID.  While your system is booting, a number of messages are
  159. displayed on the console.  Like all such messages, they can be
  160. reviewed with the 'dmesg' command.  Among those messages will be
  161. some lines like:
  162.  
  163.     paride: bpck registered as protocol 0
  164.     paride: epat registered as protocol 1
  165.  
  166. The numbers will always be the same until you build a new kernel with
  167. different protocol selections.  You should note these numbers as you
  168. will need them to identify the devices.
  169.  
  170. If you happen to be using a MicroSolutions backpack device, you will
  171. also need to know the unit ID number for each drive.  This is usually
  172. the last two digits of the drive's serial number (but read MicroSolutions'
  173. documentation about this).
  174.  
  175. As an example, let's assume that you have a MicroSolutions PD/CD drive
  176. with unit ID number 36 connected to the parallel port at 0x378, a SyQuest 
  177. EZ-135 connected to the chained port on the PD/CD drive and also an 
  178. Imation Superdisk connected to port 0x278.  You could give the following 
  179. options on your boot command:
  180.  
  181.     pd.drive0=0x378,1 pf.drive0=0x278,1 pf.drive1=0x378,0,36
  182.  
  183. In the last option, pf.drive1 configures device /dev/pf1, the 0x378
  184. is the parallel port base address, the 0 is the protocol registration
  185. number and 36 is the chain ID.
  186.  
  187. This (2.0.34) version of PARIDE does not support chained devices on the
  188. same parallel port.
  189.  
  190. 2.2  Loading and configuring PARIDE as modules
  191.  
  192. It is much faster and simpler to get to understand the PARIDE drivers
  193. if you use them as loadable kernel modules.   
  194.  
  195. Note:  using these drivers with the "kerneld" automatic module loading
  196. system is not recommended, and is not documented here.  
  197.  
  198. To use PARIDE, you must begin by 
  199.  
  200.     insmod paride
  201.  
  202. this loads a base module which provides a registry for the protocols,
  203. among other tasks.
  204.  
  205. Then, load as many of the protocol modules as you think you might need.
  206. As you load each module, it will register the protocols that it supports,
  207. and print a log message to your kernel log file and your console. For 
  208. example:
  209.  
  210.     # insmod epat
  211.     paride: epat registered as protocol 0
  212.     # insmod kbic
  213.     paride: k951 registered as protocol 1
  214.         paride: k971 registered as protocol 2
  215.  
  216. Finally, you can load high-level drivers for each kind of device that
  217. you have connected.  By default, each driver will autoprobe for a single 
  218. device, but you can support up to four similar devices by giving their
  219. individual co-ordinates when you load the driver.
  220.  
  221. For example, if you had two no-name CD-ROM drives both using the
  222. KingByte KBIC-951A adapter, one on port 0x378 and the other on 0x3bc
  223. you could give the following command:
  224.  
  225.     # insmod pcd drive0=0x378,1 drive1=0x3bc,1
  226.  
  227. For most adapters, giving a port address and protocol number is sufficient,
  228. but check the source files in linux/drivers/block/paride for more 
  229. information.  (Hopefully someone will write some man pages one day !).
  230.  
  231. As another example, here's what happens when PARPORT is installed, and
  232. a SyQuest EZ-135 is attached to port 0x378:
  233.  
  234.     # insmod paride
  235.     paride: version 1.0 installed
  236.     # insmod epat
  237.     paride: epat registered as protocol 0
  238.     # insmod pd
  239.     pd: pd version 1.0, major 45, cluster 64, nice 0
  240.     pda: Sharing parport1 at 0x378
  241.     pda: epat 1.0, Shuttle EPAT chip c3 at 0x378, mode 5 (EPP-32), delay 1
  242.     pda: SyQuest EZ135A, 262144 blocks [128M], (512/16/32), removable media
  243.      pda: pda1
  244.  
  245. Note that the last line is the output from the generic partition table
  246. scanner - in this case it reports that it has found a disk with one partition.
  247.  
  248. 2.3  Using a PARIDE device
  249.  
  250. Once the drivers have been loaded, you can access PARIDE devices in the
  251. same way as their traditional counterparts.  You will probably need to
  252. create the device "special files".  Here is a simple script that you can
  253. cut to a file and execute:
  254.  
  255. #!/bin/bash
  256. #
  257. # mkd -- a script to create the device special files for the PARIDE subsystem
  258. #
  259. function mkdev {
  260.   mknod $1 $2 $3 $4 ; chmod 0660 $1 ; chown root:disk $1
  261. }
  262. #
  263. function pd {
  264.   D=$( printf \\$( printf "x%03x" $[ $1 + 97 ] ) )
  265.   mkdev pd$D b 45 $[ $1 * 16 ]
  266.   for P in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
  267.   do mkdev pd$D$P b 45 $[ $1 * 16 + $P ]
  268.   done
  269. }
  270. #
  271. cd /dev
  272. #
  273. for u in 0 1 2 3 ; do pd $u ; done
  274. for u in 0 1 2 3 ; do mkdev pcd$u b 46 $u ; done 
  275. for u in 0 1 2 3 ; do mkdev pf$u  b 47 $u ; done 
  276. for u in 0 1 2 3 ; do mkdev pt$u  c 96 $u ; done 
  277. for u in 0 1 2 3 ; do mkdev npt$u c 96 $[ $u + 128 ] ; done 
  278. for u in 0 1 2 3 ; do mkdev pg$u  c 97 $u ; done 
  279. #
  280. # end of mkd
  281.  
  282. With the device files and drivers in place, you can access PARIDE devices
  283. like any other Linux device.   For example, to mount a CD-ROM in pcd0, use:
  284.  
  285.     mount /dev/pcd0 /cdrom
  286.  
  287. If you have a fresh Avatar Shark cartridge, and the drive is pda, you
  288. might do something like:
  289.  
  290.     fdisk /dev/pda        -- make a new partition table with
  291.                    partition 1 of type 83
  292.  
  293.     mke2fs /dev/pda1    -- to build the file system
  294.  
  295.     mkdir /shark        -- make a place to mount the disk
  296.  
  297.     mount /dev/pda1 /shark
  298.  
  299. Devices like the Imation superdisk work in the same way, except that
  300. they do not have a partition table.  For example to make a 120MB
  301. floppy that you could share with a DOS system:
  302.  
  303.     mkdosfs /dev/pf0
  304.     mount /dev/pf0 /mnt
  305.  
  306. 2.4  Using the pg driver
  307.  
  308. The pg driver can be used in conjunction with the cdrecord program
  309. to create CD-ROMs.  For more information, and the required patches 
  310. to cdrecord, please visit http://www.torque.net/parport/cdr.html .
  311.  
  312. 3. Troubleshooting
  313.  
  314. While a lot of testing has gone into these drivers to make them work
  315. as smoothly as possible, problems will arise.  If you do have problems,
  316. please check all the obvious things first:  does the drive work in
  317. DOS with the manufacturer's drivers ?  If that doesn't yield any useful
  318. clues, then please make sure that only one drive is hooked to your system,
  319. and that no other device driver is using your parallel port (check in 
  320. /proc/ioports).  Then, load the appropriate drivers (you can load several 
  321. protocol modules if you want) as in:
  322.  
  323.     # insmod paride
  324.     # insmod epat
  325.     # insmod bpck
  326.     # insmod kbic
  327.     ...
  328.     # insmod pd verbose=1
  329.  
  330. (using the correct driver for the type of device you have, of course).
  331. The verbose=1 parameter will cause the drivers to log a trace of their
  332. activity as they attempt to locate your drive.
  333.  
  334. Use 'dmesg' to capture a log of all the PARIDE messages (any messages
  335. beginning with paride:, a protocol module's name or a driver's name) and
  336. include that with your bug report.  You can submit a bug report in one
  337. of two ways.  Either send it directly to the author of the PARIDE suite,
  338. by e-mail to grant@torque.net, or join the linux-parport mailing list
  339. and post your report there.
  340.  
  341. You can join the linux-parport mailing list by sending a mail message
  342. to 
  343.         linux-parport-request@torque.net
  344.  
  345. with the single word 
  346.  
  347.         subscribe
  348.  
  349. in the body of the mail message (not in the subject line).   Please be
  350. sure that your mail program is correctly set up when you do this,  as
  351. the list manager is a robot that will subscribe you using the reply
  352. address in your mail headers.  REMOVE any anti-spam gimmicks you may
  353. have in your mail headers, when sending mail to the list server.
  354.  
  355. You might also find some useful information on the linux-parport
  356. web pages (although they are not always up to date) at
  357.  
  358.     http://www.torque.net/parport/
  359.  
  360.  
  361.