HDIO_DRIVE_CMD execute a special drive command Note: If you don't have a copy of the ANSI ATA specification handy, you should probably ignore this ioctl. usage: u8 args[4+XFER_SIZE]; ... ioctl(fd, HDIO_DRIVE_CMD, args); inputs: Commands other than WIN_SMART args[0] COMMAND args[1] NSECTOR args[2] FEATURE args[3] NSECTOR WIN_SMART args[0] COMMAND args[1] SECTOR args[2] FEATURE args[3] NSECTOR outputs: args[] buffer is filled with register values followed by any data returned by the disk. args[0] status args[1] error args[2] NSECTOR args[3] undefined args[4+] NSECTOR * 512 bytes of data returned by the command. error returns: EACCES Access denied: requires CAP_SYS_RAWIO ENOMEM Unable to allocate memory for task EIO Drive reports error notes: [1] For commands other than WIN_SMART, args[1] should equal args[3]. SECTOR, LCYL and HCYL are undefined. For WIN_SMART, 0x4f and 0xc2 are loaded into LCYL and HCYL respectively. In both cases SELECT will contain the default value for the drive. Please refer to HDIO_DRIVE_TASKFILE notes for the default value of SELECT. [2] If NSECTOR value is greater than zero and the drive sets DRQ when interrupting for the command, NSECTOR * 512 bytes are read from the device into the area following NSECTOR. In the above example, the area would be args[4..4+XFER_SIZE]. 16bit PIO is used regardless of HDIO_SET_32BIT setting. [3] If COMMAND == WIN_SETFEATURES && FEATURE == SETFEATURES_XFER && NSECTOR >= XFER_SW_DMA_0 && the drive supports any DMA mode, IDE driver will try to tune the transfer mode of the drive accordingly.
ioctl(fd, HDIO_DRIVE_CMD, args)
最新推荐文章于 2024-04-12 11:46:58 发布