changes to the IOCATAREQUEST request

Alexander Motin mav at FreeBSD.org
Fri Feb 19 16:55:03 UTC 2010


Hi.

Alex Samorukov wrote:
> The following additions are required for a reasonable pass-through ioctl:
> 
> sys/ata.h:
> 
> struct ata_ioc_request {
> ...
> int count;
> int flags;
> #define ATA_CMD_CONTROL 0x01
> #define ATA_CMD_READ 0x02
> #define ATA_CMD_WRITE 0x04
> #define ATA_CMD_ATAPI 0x08
> +#define ATA_CMD_48BIT 0x10 // 48-bit command
> +#define ATA_CMD_NO_MULTIPLE 0x20 // one DRQ/sector
> int timeout;
> int error;
> };

The only who really knows command format and meaning are the application
and the device. SCSI is more standardized there, but ATA isn't. I think
submitting flags from user-level is the only way. I did the same in CAM ATA.

> Here a list of 48-bit commands (provided by  Christian Franke from
> latest ACS 2 draft (T13/2015-D Revision 2). The FreeBSD function
> ata_modify_if_48bit() selects commands marked with *** if their 28-bit
> variants are requested and 48 bit addressing is actually required. Only
> in this case ATA_D_48BIT_ACTIVE is set. The other commands are not
> supported, I presume.

Alike approach with hardware command decoding is used in SiliconImage
SATA controllers. Adding new DSM commands in ACS-2 broke them, requiring
right protocol to be specifically enforced for that commands. So
compiling this into stack is probably a bad idea also.

Small attached patch should handle the issue.

PS: Not very understand what do you mean by ATA_CMD_NO_MULTIPLE.

-- 
Alexander Motin
-------------- next part --------------
+++ sys/ata.h.prev	2010-02-03 12:20:36.000000000 +0200
--- sys/ata.h	2010-02-19 18:37:01.000000000 +0200
@@ -496,8 +496,6 @@ struct ata_ioc_request {
 #define ATA_CMD_READ                    0x02
 #define ATA_CMD_WRITE                   0x04
 #define ATA_CMD_ATAPI                   0x08
+#define ATA_CMD_DMA                     0x10
+#define ATA_CMD_48BIT                   0x20
 
     int                 timeout;
     int                 error;
--- dev/ata.prev/ata-all.c	2010-02-02 13:20:13.000000000 +0200
+++ dev/ata/ata-all.c	2010-02-19 18:38:33.000000000 +0200
@@ -718,6 +718,10 @@ ata_device_ioctl(device_t dev, u_long cm
 	    request->flags |= ATA_R_READ;
 	if (ioc_request->flags & ATA_CMD_WRITE)
 	    request->flags |= ATA_R_WRITE;
+	if (ioc_request->flags & ATA_CMD_DMA)
+	    request->flags |= ATA_R_DMA;
+	if (ioc_request->flags & ATA_CMD_48BIT)
+	    request->flags |= ATA_R_48BIT;
 	ata_queue_request(request);
 	if (request->flags & ATA_R_ATAPI) {
 	    bcopy(&request->u.atapi.sense, &ioc_request->u.atapi.sense,


More information about the freebsd-arch mailing list