Subject: Driver for atapi cdrom aviable
To: current-users <current-users@NetBSD.ORG>
From: Manuel Bouyer <bouyer@ensta.fr>
List: current-users
Date: 01/12/1996 14:13:25
I have a working driver for atapi cdroms for beta-tests. There is no audio
support yet, but I can mount and read a cdrom. I've only tested it on
my p100 machine which has a IDE drive and atapi cdrom on its IDE bus.
The IDE drive supports my root, swap and /usr partitions. I also have 
a NCR scsi controller. The IDE controller is an PCI one. I think
the cdrom drive is a NEC but I'm not sure.

This needed an important rework of the wd/wdc drivers. The file wd.c
has been splitted into wd.c for "hight level" IDE drive operations
(probe/attach, read/write/strategy routines ...), and wdc.c
which manages the IDE and atapi commands. This has been done to be able
to set up a per-controller queue of operations. The atapi part is
copied from SCSI, there is a "atapibus" which is used by the atapi-devices
drivers to send generic commands. So it should be easy to have atapi support
on others types of controllers, although i don't know whether these exist.

Things which don't work yet:
	- core dumps on IDE drive (wddump don't compile), because I didn't made
		the few necessary changes (first I though this could be mixed
		with the ATAPI polled commands support, but ATAPI and IDE
		drives are to different).
	- audio commands for atapi cdrom drives.
	- atapi device with no IDE master (the controller doesn't get attached)
	- atapi in DMA mode

Things which should work, but have not yet been tested:
	- two IDE drives on two different controllers
	- IDE in DMA mode

The patch file is available from
ftp://lix.polytechnique.fr/pub/manu/atapi.tar.gz. These diffs are against
1.1 sources.
To install:
- BACKUP YOUR IDE DRIVE(S). I didn't have any problems, but who knows ...
- recompile your kernel with the two lines:
atapibus* at wdc?
acd* at atapibus? drive?
Just after the wdc/wd declaration in your kernel config file. (the patch file
adds theses to the GENERIC file).
- Create the devices in /dev, with major 17 for block device and 21 for
characters. The minors are as for other disk devices.

After reboot you should be able to mount your cdrom. If the mount fails
with a 'unit attention' message in the console, retry the mount.

For now I plan to upgrade my box to -current, and then add the following,
in priority order:
- support of 'ATAPI ONLY' busses and tests with two controllers,
- get a working wddump(),
- audio commands.

If someone makes any changes to this (audio support, wddump(), or bug
fixes) please send me a patch (e-mail: bouyer@ensta.fr). I'll update the
file on the ftp server with contributed patches and my own changes.

--
Manuel Bouyer, Ecole Nationale Superieure de Techniques Avancees, Paris
email: bouyer@ensta.fr
--