Subject: Re: SCSI/ATAPI (+tape drive)
To: Mason Loring Bliss <>
From: Manuel Bouyer <>
List: tech-kern
Date: 05/25/1999 15:59:04
On Sat, May 22, 1999 at 10:18:06AM -0400, Mason Loring Bliss wrote:
> Hi, all.
> I need to get some sort of backup in place, so I figured maybe a tape drive
> would do. I'm not quite flushed with cash to the point where I can grab a
> scsi controller and a tape drive both right now, never mind media, but I
> can afford an ATAPI tape drive.
> Looking around on the net, it looks like Linux supports ATAPI tape drives,
> but we don't.
> I'm wondering... I've been told that our SCSI and ATAPI subsystems are
> really well integrated, but looking in /usr/src/sys/dev/scsipi, it looks
> like there is a definite distinction.

Yes. Commands used by atapi devices and scsi devices can be different (but
most are common). Error codes format can also be different.
but for higth-level drivers (sd, st, cd, ...) the interface is the same.
The only distinction made can be for commands that exists in SCSI but
not ATAPI, or vice-versa.

> I've never delved into the kernel to any great degree, but I think it might
> be worthwhile to try to whack out ATAPI tape drive support. Can someone give
> me an initial idea of what such a project might involve? While I admit it's
> more respectable and traditional to just suck in the source and understand
> it on my own, I'd be just as happy taking the ignoble route and asking for
> help. (I'm looking at the source, but comments are... sparse... and I'm not
> completely sure what the bounds of the big picture are.)

Actually the jobs needs to be done in st.c. splitting it in st.c,
st_scsi.c and st_atapi.c so that it can attach to either scsi or atapi
is trivial (look at sd for an example).
The difficult part would be if the commands sets for scsi and atapi are really
different. You will then have to abstract sevices into functions, passed via
function pointers from the attach routine (look at cd for an example).
Hopefully this will not be the case. You can see this by looking at the
command set for scsi and atapi, at last for the commands used in
the NetBSD kernel.

In any case, this is much more easy than starting from scratch. I you start
such a project I'm willing to provide you the help you need. I would have done
it if I had an ATAPI tape drive, but DLT's with 15 cartridge changers are only
available as SCSI :)

Manuel Bouyer, LIP6, Universite Paris VI.