Subject: Re: scsipi woes: can't call scsi command from kernel by ioctl?
To: Manuel Bouyer <bouyer@antioche.eu.org>
From: Reinoud Zandijk <reinoud@netbsd.org>
List: tech-kern
Date: 08/30/2005 18:10:46
--PEIAKu/WMn1b1Hv9
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hiya Manuel,

On Mon, Aug 29, 2005 at 08:38:10PM +0200, Manuel Bouyer wrote:
> > but then i'd have to figure out the struct scsipi_periph wich is a big NONO 
> > IMHO since it breaks abstraction and i'd be cleaner to use VOP_IOCTL(). I 
> > could offcource encode all nessisary SCSI commands to CDIOCTL's but 
> > wouldn't that explode the number of IOCTL's unnessisary?
> 
> BTW, what command do you need to send from the kernel ? Maybe we need to
> define a new ioctl to retrieve this information ? I would expect your
> kernel code to also work for non-scsi devices.

I'm planning of at least implementing and using the following SCSI/ATAPI 
commands :
	TEST UNIT READY			(trivial)
	MODE REQUEST/MODE SELECT page 5 (CD recording parameters)
	MODE REQUEST/MODE SELECT page 3	(CD-MRW/DVD+MRW address space)
	SYNCHONISE CACHE		(nessisary for swich r/w)
	CD READ RECORDED CAPACITY
	GET CONFIGURATION (0x46)	(for several features)
	READ DISC INFORMATION (0x51)
	READ TRACK INFORMATION (0x52)
	READ TOC/PMA/ATIP format 2	(nessisary for CD/DVD-ROM drives or old pre-MMC drives)
	READ/WRITE			(prolly/hopefully possible trough bread/bwrite)

and optional :
	SET CD SPEED (0xBB)
	CLOSE SESSION
	CLOSE TRACK
	REPAIR TRACK
	RESERVE TRACK
	WRITE AND VERIFY
	READ/WRITE				(with streaming bit)

For UDF reading/writing on non CD/DVD/BD i.e. on files, harddiscs or 
floppies etc. access to bread/bwrite and a method of detecting the size of 
the partion/file and *its sector size* is enough using f.e. 
disklabel/wedge/stat info. UDF disc sector sizes are all multiples of 512 
bytes though 2048 is very common.

Esp. `get configuration' can be lengthy if implemented by IOCTL for the 
structures have to be made for most of the features for completeness though 
in my implementation just being able to see if a feature is current or not 
reveals normally enough. This is media type detection and accompanied 
features like does it have RMW or can i only write in ECC blocks of 
(normally) 32 sectors, do i have to synchronise caches before being able to 
read again etc. etc.

So i'll prolly have to start coding IOCTL's for all 12+ them :-S Some of 
them could also be implemented in scsipi_ioctl.c for not all are nessisary 
only found on cd/mmc devices.

Cheers,
Reinoud


--PEIAKu/WMn1b1Hv9
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (NetBSD)

iQEVAwUBQxSE9YKcNwBDyKpoAQLs7Qf/dD0KZ4ZHB+Innk7X7FOS40yqaKhkgstP
DpLKghP1Arr3kzdvUFYmJA2hlvtzMuBUy+nk1dmV+NEiIJu4j4W3StfsULtmLogW
Z4wS2WU6UoAT12Fo5+e4k8UpN7d5t2MZBDS8KW60bDqi94q+lVPWBbKfk7EfvvQ6
MMY2w3y2rwJZVHwYIExUJ28eYfITKRAVFXZLAdz/d3VtS9SfjR42lK+No95om3b0
YdR9SQqyRWZg0YDk7SaNBUdMt3I6OIi+SUpxFsDcx67eCJc2kyTHRdGfwnFl6jfO
G/uu95SsRbEC2+tluxluV8e/h9pNPjOQcvGE8TQfK+c0WB+VO/SQfw==
=tvgw
-----END PGP SIGNATURE-----

--PEIAKu/WMn1b1Hv9--