Subject: Re: SCSI reference?
To: Kim Kyung-hwan <>
From: Manuel Bouyer <>
List: tech-kern
Date: 02/17/2001 19:12:24
On Fri, Feb 16, 2001 at 03:46:13PM +0900, Kim Kyung-hwan wrote:
> Yes, exactly!
> In fact, I should make a driver of my company product.
> Then what is the *easiest* SCSI driver that use scsipi?

I'd say sys/dev/isa/seagate.c. It's all in one file (no bus independant +
bus front-end split).

> And what is a good start point of understanding scsipi subsystem?

Really, reading one driver or two, plus scsipiconf.h and scsiconf.h
should give you all what's needed.
You need to provide a scsipi_device structure (which in general contains
only NULL), a properly initiallised scsipi_link and scsipi_adapter.
Again look at seagate.c for example.
The driver needs to provide a callback, (scsipi_cmd in scsipi_adapter)
which is called from the scsipi system to execute a command. It should either
return COMPLETE if the command is done (error in queuing the cmd, or
cmd executed in polled mode) or SUCCESSFULLY_QUEUED if the cmd has been
queued. In the second case the driver should call scsipi_done() once the
cmd is complete.

The driver can also handle ioctls, but it's not mandatory. See the siop driver
as example on how to use this (this one is split accross multiple files).

> I heard that initial NetBSD scsi structure has changed into scsipi.
> If there is a documentation or method to follow the change roadmap,
> I would like to take it.  It will be very appreciated.

No, there wasn't anything written at this time. The change from scsi to scsipi
was to allow atapi devices (which is close enouth to scsi to share large part
of codes). There wasn't big change in the interface with scsi HBA drivers.

Manuel Bouyer <>