paride.txt 17 KB

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