Re: Linux SCSI Driver for Mass Storage Device
From: David A.Lethe (davidATsantools.com)
Date: Fri, 20 Feb 2004 01:31:55 -0600
On 19 Feb 2004 19:49:48 -0800, email@example.com (YCWang) wrote:
>I wonder how to write a driver for a pci device which is a mass
>I think write a scsi low level driver is simpler than write a block
>device driver. But I don't know which scsi commands I should implement
>for my mass storage device. I know that my device belongs to scsi
>disk. Is it enough if I implement all scsi commands appears in sd.c?
>Thanks a lot& best regard
You must implement all of the commands that are mandatory for that
particular device class, according to the ANSI spec.
You should also assume that you can't assume that application software
would send invalid CDBs. As the ANSI spec is very specific on what
sense info gets returned for various types of invalid CDBs, you have
to make sure you process them correctly. The storage device should
already report the proper sense info if it receives munged or invalid
commands, so just pass them through.
If your device type (disk, tape, cd, controller, etc...) is the same
as one that is already supported by the O/S, then you would also have
to write code to prevent the O/S from loading the built-in driver.