#ifndef _LINUX_HDREG_H
#define _LINUX_HDREG_H
#include <linux/types.h>
#define HDIO_DRIVE_CMD_HDR_SIZE (4 * sizeof(__u8))
#define HDIO_DRIVE_HOB_HDR_SIZE (8 * sizeof(__u8))
#define HDIO_DRIVE_TASK_HDR_SIZE (8 * sizeof(__u8))
#define IDE_DRIVE_TASK_NO_DATA 0
#ifndef __KERNEL__
#define IDE_DRIVE_TASK_INVALID -1
#define IDE_DRIVE_TASK_SET_XFER 1
#define IDE_DRIVE_TASK_IN 2
#define IDE_DRIVE_TASK_OUT 3
#endif
#define IDE_DRIVE_TASK_RAW_WRITE 4
#define IDE_TASKFILE_STD_IN_FLAGS 0xFE
#define IDE_HOB_STD_IN_FLAGS 0x3C
#ifndef __KERNEL__
#define IDE_TASKFILE_STD_OUT_FLAGS 0xFE
#define IDE_HOB_STD_OUT_FLAGS 0x3C
typedef unsigned char task_ioreg_t;
typedef unsigned long sata_ioreg_t;
#endif
typedef union ide_reg_valid_s {
unsigned all : 16;
struct {
unsigned data : 1;
unsigned error_feature : 1;
unsigned sector : 1;
unsigned nsector : 1;
unsigned lcyl : 1;
unsigned hcyl : 1;
unsigned select : 1;
unsigned status_command : 1;
unsigned data_hob : 1;
unsigned error_feature_hob : 1;
unsigned sector_hob : 1;
unsigned nsector_hob : 1;
unsigned lcyl_hob : 1;
unsigned hcyl_hob : 1;
unsigned select_hob : 1;
unsigned control_hob : 1;
} b;
} ide_reg_valid_t;
typedef struct ide_task_request_s {
__u8 io_ports[8];
__u8 hob_ports[8];
ide_reg_valid_t out_flags;
ide_reg_valid_t in_flags;
int data_phase;
int req_cmd;
unsigned long out_size;
unsigned long in_size;
} ide_task_request_t;
typedef struct ide_ioctl_request_s {
ide_task_request_t *task_request;
unsigned char *out_buffer;
unsigned char *in_buffer;
} ide_ioctl_request_t;
struct hd_drive_cmd_hdr {
__u8 command;
__u8 sector_number;
__u8 feature;
__u8 sector_count;
};
#ifndef __KERNEL__
typedef struct hd_drive_task_hdr {
__u8 data;
__u8 feature;
__u8 sector_count;
__u8 sector_number;
__u8 low_cylinder;
__u8 high_cylinder;
__u8 device_head;
__u8 command;
} task_struct_t;
typedef struct hd_drive_hob_hdr {
__u8 data;
__u8 feature;
__u8 sector_count;
__u8 sector_number;
__u8 low_cylinder;
__u8 high_cylinder;
__u8 device_head;
__u8 control;
} hob_struct_t;
#endif
#define TASKFILE_NO_DATA 0x0000
#define TASKFILE_IN 0x0001
#define TASKFILE_MULTI_IN 0x0002
#define TASKFILE_OUT 0x0004
#define TASKFILE_MULTI_OUT 0x0008
#define TASKFILE_IN_OUT 0x0010
#define TASKFILE_IN_DMA 0x0020
#define TASKFILE_OUT_DMA 0x0040
#define TASKFILE_IN_DMAQ 0x0080
#define TASKFILE_OUT_DMAQ 0x0100
#ifndef __KERNEL__
#define TASKFILE_P_IN 0x0200
#define TASKFILE_P_OUT 0x0400
#define TASKFILE_P_IN_DMA 0x0800
#define TASKFILE_P_OUT_DMA 0x1000
#define TASKFILE_P_IN_DMAQ 0x2000
#define TASKFILE_P_OUT_DMAQ 0x4000
#define TASKFILE_48 0x8000
#define TASKFILE_INVALID 0x7fff
#endif
#ifndef __KERNEL__
#define WIN_NOP 0x00
#define CFA_REQ_EXT_ERROR_CODE 0x03 /* CFA Request Extended Error Code */
#define WIN_SRST 0x08 /* ATAPI soft reset command */
#define WIN_DEVICE_RESET 0x08
#define WIN_RECAL 0x10
#define WIN_RESTORE WIN_RECAL
#define WIN_READ 0x20 /* 28-Bit */
#define WIN_READ_ONCE 0x21 /* 28-Bit without retries */
#define WIN_READ_LONG 0x22 /* 28-Bit */
#define WIN_READ_LONG_ONCE 0x23 /* 28-Bit without retries */
#define WIN_READ_EXT 0x24 /* 48-Bit */
#define WIN_READDMA_EXT 0x25 /* 48-Bit */
#define WIN_READDMA_QUEUED_EXT 0x26 /* 48-Bit */
#define WIN_READ_NATIVE_MAX_EXT 0x27 /* 48-Bit */
#define WIN_MULTREAD_EXT 0x29 /* 48-Bit */
#define WIN_WRITE 0x30 /* 28-Bit */
#define WIN_WRITE_ONCE 0x31 /* 28-Bit without retries */
#define WIN_WRITE_LONG 0x32 /* 28-Bit */
#define WIN_WRITE_LONG_ONCE 0x33 /* 28-Bit without retries */
#define WIN_WRITE_EXT 0x34 /* 48-Bit */
#define WIN_WRITEDMA_EXT 0x35 /* 48-Bit */
#define WIN_WRITEDMA_QUEUED_EXT 0x36 /* 48-Bit */
#define WIN_SET_MAX_EXT 0x37 /* 48-Bit */
#define CFA_WRITE_SECT_WO_ERASE 0x38 /* CFA Write Sectors without erase */
#define WIN_MULTWRITE_EXT 0x39 /* 48-Bit */
#define WIN_WRITE_VERIFY 0x3C /* 28-Bit */
#define WIN_VERIFY 0x40 /* 28-Bit - Read Verify Sectors */
#define WIN_VERIFY_ONCE 0x41 /* 28-Bit - without retries */
#define WIN_VERIFY_EXT 0x42 /* 48-Bit */
#define WIN_FORMAT 0x50
#define WIN_INIT 0x60
#define WIN_SEEK 0x70 /* 0x70-0x7F Reserved */
#define CFA_TRANSLATE_SECTOR 0x87 /* CFA Translate Sector */
#define WIN_DIAGNOSE 0x90
#define WIN_SPECIFY 0x91 /* set drive geometry translation */
#define WIN_DOWNLOAD_MICROCODE 0x92
#define WIN_STANDBYNOW2 0x94
#define WIN_STANDBY2 0x96
#define WIN_SETIDLE2 0x97
#define WIN_CHECKPOWERMODE2 0x98
#define WIN_SLEEPNOW2 0x99
#define WIN_PACKETCMD 0xA0 /* Send a packet command. */
#define WIN_PIDENTIFY 0xA1 /* identify ATAPI device */
#define WIN_QUEUED_SERVICE 0xA2
#define WIN_SMART 0xB0 /* self-monitoring and reporting */
#define CFA_ERASE_SECTORS 0xC0
#define WIN_MULTREAD 0xC4 /* read sectors using multiple mode*/
#define WIN_MULTWRITE 0xC5 /* write sectors using multiple mode */
#define WIN_SETMULT 0xC6 /* enable/disable multiple mode */
#define WIN_READDMA_QUEUED 0xC7 /* read sectors using Queued DMA transfers */
#define WIN_READDMA 0xC8 /* read sectors using DMA transfers */
#define WIN_READDMA_ONCE 0xC9 /* 28-Bit - without retries */
#define WIN_WRITEDMA 0xCA /* write sectors using DMA transfers */
#define WIN_WRITEDMA_ONCE 0xCB /* 28-Bit - without retries */
#define WIN_WRITEDMA_QUEUED 0xCC /* write sectors using Queued DMA transfers */
#define CFA_WRITE_MULTI_WO_ERASE 0xCD /* CFA Write multiple without erase */
#define WIN_GETMEDIASTATUS 0xDA
#define WIN_ACKMEDIACHANGE 0xDB /* ATA-1, ATA-2 vendor */
#define WIN_POSTBOOT 0xDC
#define WIN_PREBOOT 0xDD
#define WIN_DOORLOCK 0xDE /* lock door on removable drives */
#define WIN_DOORUNLOCK 0xDF /* unlock door on removable drives */
#define WIN_STANDBYNOW1 0xE0
#define WIN_IDLEIMMEDIATE 0xE1 /* force drive to become "ready" */
#define WIN_STANDBY 0xE2 /* Set device in Standby Mode */
#define WIN_SETIDLE1 0xE3
#define WIN_READ_BUFFER 0xE4 /* force read only 1 sector */
#define WIN_CHECKPOWERMODE1 0xE5
#define WIN_SLEEPNOW1 0xE6
#define WIN_FLUSH_CACHE 0xE7
#define WIN_WRITE_BUFFER 0xE8 /* force write only 1 sector */
#define WIN_WRITE_SAME 0xE9 /* read ata-2 to use */
#define WIN_FLUSH_CACHE_EXT 0xEA /* 48-Bit */
#define WIN_IDENTIFY 0xEC /* ask drive to identify itself */
#define WIN_MEDIAEJECT 0xED
#define WIN_IDENTIFY_DMA 0xEE /* same as WIN_IDENTIFY, but DMA */
#define WIN_SETFEATURES 0xEF /* set special drive features */
#define EXABYTE_ENABLE_NEST 0xF0
#define WIN_SECURITY_SET_PASS 0xF1
#define WIN_SECURITY_UNLOCK 0xF2
#define WIN_SECURITY_ERASE_PREPARE 0xF3
#define WIN_SECURITY_ERASE_UNIT 0xF4
#define WIN_SECURITY_FREEZE_LOCK 0xF5
#define WIN_SECURITY_DISABLE 0xF6
#define WIN_READ_NATIVE_MAX 0xF8 /* return the native maximum address */
#define WIN_SET_MAX 0xF9
#define DISABLE_SEAGATE 0xFB
#define SMART_READ_VALUES 0xD0
#define SMART_READ_THRESHOLDS 0xD1
#define SMART_AUTOSAVE 0xD2
#define SMART_SAVE 0xD3
#define SMART_IMMEDIATE_OFFLINE 0xD4
#define SMART_READ_LOG_SECTOR 0xD5
#define SMART_WRITE_LOG_SECTOR 0xD6
#define SMART_WRITE_THRESHOLDS 0xD7
#define SMART_ENABLE 0xD8
#define SMART_DISABLE 0xD9
#define SMART_STATUS 0xDA
#define SMART_AUTO_OFFLINE 0xDB
#define SMART_LCYL_PASS 0x4F
#define SMART_HCYL_PASS 0xC2
#define SETFEATURES_EN_8BIT 0x01 /* Enable 8-Bit Transfers */
#define SETFEATURES_EN_WCACHE 0x02 /* Enable write cache */
#define SETFEATURES_DIS_DEFECT 0x04 /* Disable Defect Management */
#define SETFEATURES_EN_APM 0x05 /* Enable advanced power management */
#define SETFEATURES_EN_SAME_R 0x22 /* for a region ATA-1 */
#define SETFEATURES_DIS_MSN 0x31 /* Disable Media Status Notification */
#define SETFEATURES_DIS_RETRY 0x33 /* Disable Retry */
#define SETFEATURES_EN_AAM 0x42 /* Enable Automatic Acoustic Management */
#define SETFEATURES_RW_LONG 0x44 /* Set Length of VS bytes */
#define SETFEATURES_SET_CACHE 0x54 /* Set Cache segments to SC Reg. Val */
#define SETFEATURES_DIS_RLA 0x55 /* Disable read look-ahead feature */
#define SETFEATURES_EN_RI 0x5D /* Enable release interrupt */
#define SETFEATURES_EN_SI 0x5E /* Enable SERVICE interrupt */
#define SETFEATURES_DIS_RPOD 0x66 /* Disable reverting to power on defaults */
#define SETFEATURES_DIS_ECC 0x77 /* Disable ECC byte count */
#define SETFEATURES_DIS_8BIT 0x81 /* Disable 8-Bit Transfers */
#define SETFEATURES_DIS_WCACHE 0x82 /* Disable write cache */
#define SETFEATURES_EN_DEFECT 0x84 /* Enable Defect Management */
#define SETFEATURES_DIS_APM 0x85 /* Disable advanced power management */
#define SETFEATURES_EN_ECC 0x88 /* Enable ECC byte count */
#define SETFEATURES_EN_MSN 0x95 /* Enable Media Status Notification */
#define SETFEATURES_EN_RETRY 0x99 /* Enable Retry */
#define SETFEATURES_EN_RLA 0xAA /* Enable read look-ahead feature */
#define SETFEATURES_PREFETCH 0xAB /* Sets drive prefetch value */
#define SETFEATURES_EN_REST 0xAC /* ATA-1 */
#define SETFEATURES_4B_RW_LONG 0xBB /* Set Length of 4 bytes */
#define SETFEATURES_DIS_AAM 0xC2 /* Disable Automatic Acoustic Management */
#define SETFEATURES_EN_RPOD 0xCC /* Enable reverting to power on defaults */
#define SETFEATURES_DIS_RI 0xDD /* Disable release interrupt ATAPI */
#define SETFEATURES_EN_SAME_M 0xDD /* for a entire device ATA-1 */
#define SETFEATURES_DIS_SI 0xDE /* Disable SERVICE interrupt ATAPI */
#define SECURITY_SET_PASSWORD 0xBA
#define SECURITY_UNLOCK 0xBB
#define SECURITY_ERASE_PREPARE 0xBC
#define SECURITY_ERASE_UNIT 0xBD
#define SECURITY_FREEZE_LOCK 0xBE
#define SECURITY_DISABLE_PASSWORD 0xBF
#endif /* __KERNEL__ */
struct hd_geometry {
unsigned char heads;
unsigned char sectors;
unsigned short cylinders;
unsigned long start;
};
#define HDIO_GETGEO 0x0301 /* get device geometry */
#define HDIO_GET_UNMASKINTR 0x0302 /* get current unmask setting */
#define HDIO_GET_MULTCOUNT 0x0304 /* get current IDE blockmode setting */
#define HDIO_GET_QDMA 0x0305 /* get use-qdma flag */
#define HDIO_SET_XFER 0x0306 /* set transfer rate via proc */
#define HDIO_OBSOLETE_IDENTITY 0x0307 /* OBSOLETE, DO NOT USE: returns 142 bytes */
#define HDIO_GET_KEEPSETTINGS 0x0308 /* get keep-settings-on-reset flag */
#define HDIO_GET_32BIT 0x0309 /* get current io_32bit setting */
#define HDIO_GET_NOWERR 0x030a /* get ignore-write-error flag */
#define HDIO_GET_DMA 0x030b /* get use-dma flag */
#define HDIO_GET_NICE 0x030c /* get nice flags */
#define HDIO_GET_IDENTITY 0x030d /* get IDE identification info */
#define HDIO_GET_WCACHE 0x030e /* get write cache mode on|off */
#define HDIO_GET_ACOUSTIC 0x030f /* get acoustic value */
#define HDIO_GET_ADDRESS 0x0310 /* */
#define HDIO_GET_BUSSTATE 0x031a /* get the bus state of the hwif */
#define HDIO_TRISTATE_HWIF 0x031b /* execute a channel tristate */
#define HDIO_DRIVE_RESET 0x031c /* execute a device reset */
#define HDIO_DRIVE_TASKFILE 0x031d /* execute raw taskfile */
#define HDIO_DRIVE_TASK 0x031e /* execute task and special drive command */
#define HDIO_DRIVE_CMD 0x031f /* execute a special drive command */
#define HDIO_DRIVE_CMD_AEB HDIO_DRIVE_TASK
#define HDIO_SET_MULTCOUNT 0x0321 /* change IDE blockmode */
#define HDIO_SET_UNMASKINTR 0x0322 /* permit other irqs during I/O */
#define HDIO_SET_KEEPSETTINGS 0x0323 /* keep ioctl settings on reset */
#define HDIO_SET_32BIT 0x0324 /* change io_32bit flags */
#define HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */
#define HDIO_SET_DMA 0x0326 /* change use-dma flag */
#define HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */
#ifndef __KERNEL__
#define HDIO_SCAN_HWIF 0x0328 /* register and (re)scan interface */
#define HDIO_UNREGISTER_HWIF 0x032a /* unregister interface */
#endif
#define HDIO_SET_NICE 0x0329 /* set nice flags */
#define HDIO_SET_WCACHE 0x032b /* change write cache enable-disable */
#define HDIO_SET_ACOUSTIC 0x032c /* change acoustic behavior */
#define HDIO_SET_BUSSTATE 0x032d /* set the bus state of the hwif */
#define HDIO_SET_QDMA 0x032e /* change use-qdma flag */
#define HDIO_SET_ADDRESS 0x032f /* change lba addressing modes */
enum {
BUSSTATE_OFF = 0,
BUSSTATE_ON,
BUSSTATE_TRISTATE
};
#define __NEW_HD_DRIVE_ID
#ifndef __KERNEL__
struct hd_driveid {
unsigned short config;
unsigned short cyls;
unsigned short reserved2;
unsigned short heads;
unsigned short track_bytes;
unsigned short sector_bytes;
unsigned short sectors;
unsigned short vendor0;
unsigned short vendor1;
unsigned short vendor2;
unsigned char serial_no[20];
unsigned short buf_type;
unsigned short buf_size;
unsigned short ecc_bytes;
unsigned char fw_rev[8];
unsigned char model[40];
unsigned char max_multsect;
unsigned char vendor3;
unsigned short dword_io;
unsigned char vendor4;
unsigned char capability;
unsigned short reserved50;
unsigned char vendor5;
unsigned char tPIO;
unsigned char vendor6;
unsigned char tDMA;
unsigned short field_valid;
unsigned short cur_cyls;
unsigned short cur_heads;
unsigned short cur_sectors;
unsigned short cur_capacity0;
unsigned short cur_capacity1;
unsigned char multsect;
unsigned char multsect_valid;
unsigned int lba_capacity;
unsigned short dma_1word;
unsigned short dma_mword;
unsigned short eide_pio_modes;
unsigned short eide_dma_min;
unsigned short eide_dma_time;
unsigned short eide_pio;
unsigned short eide_pio_iordy;
unsigned short words69_70[2];
unsigned short words71_74[4];
unsigned short queue_depth;
unsigned short words76_79[4];
unsigned short major_rev_num;
unsigned short minor_rev_num;
unsigned short command_set_1;
unsigned short command_set_2;
unsigned short cfsse;
unsigned short cfs_enable_1;
unsigned short cfs_enable_2;
unsigned short csf_default;
unsigned short dma_ultra;
unsigned short trseuc;
unsigned short trsEuc;
unsigned short CurAPMvalues;
unsigned short mprc;
unsigned short hw_config;
unsigned short acoustic;
unsigned short msrqs;
unsigned short sxfert;
unsigned short sal;
unsigned int spg;
unsigned long long lba_capacity_2;
unsigned short words104_125[22];
unsigned short last_lun;
unsigned short word127;
unsigned short dlf;
unsigned short csfo;
unsigned short words130_155[26];
unsigned short word156;
unsigned short words157_159[3];
unsigned short cfa_power;
unsigned short words161_175[15];
unsigned short words176_205[30];
unsigned short words206_254[49];
unsigned short integrity_word;
};
#endif /* __KERNEL__ */
#define IDE_NICE_DSC_OVERLAP (0) /* per the DSC overlap protocol */
#define IDE_NICE_ATAPI_OVERLAP (1) /* not supported yet */
#define IDE_NICE_1 (3) /* when probably won't affect us much */
#ifndef __KERNEL__
#define IDE_NICE_0 (2) /* when sure that it won't affect us */
#define IDE_NICE_2 (4) /* when we know it's on our expense */
#endif
#endif /* _LINUX_HDREG_H */