| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _LINUX_HDREG_H | 
 | 2 | #define _LINUX_HDREG_H | 
 | 3 |  | 
 | 4 | #ifdef __KERNEL__ | 
 | 5 | #include <linux/ata.h> | 
 | 6 |  | 
 | 7 | /* | 
 | 8 |  * This file contains some defines for the AT-hd-controller. | 
 | 9 |  * Various sources. | 
 | 10 |  */ | 
 | 11 |  | 
 | 12 | /* ide.c has its own port definitions in "ide.h" */ | 
 | 13 |  | 
 | 14 | #define HD_IRQ		14 | 
 | 15 |  | 
 | 16 | /* Hd controller regs. Ref: IBM AT Bios-listing */ | 
 | 17 | #define HD_DATA		0x1f0		/* _CTL when writing */ | 
 | 18 | #define HD_ERROR	0x1f1		/* see err-bits */ | 
 | 19 | #define HD_NSECTOR	0x1f2		/* nr of sectors to read/write */ | 
 | 20 | #define HD_SECTOR	0x1f3		/* starting sector */ | 
 | 21 | #define HD_LCYL		0x1f4		/* starting cylinder */ | 
 | 22 | #define HD_HCYL		0x1f5		/* high byte of starting cyl */ | 
 | 23 | #define HD_CURRENT	0x1f6		/* 101dhhhh , d=drive, hhhh=head */ | 
 | 24 | #define HD_STATUS	0x1f7		/* see status-bits */ | 
 | 25 | #define HD_FEATURE	HD_ERROR	/* same io address, read=error, write=feature */ | 
 | 26 | #define HD_PRECOMP	HD_FEATURE	/* obsolete use of this port - predates IDE */ | 
 | 27 | #define HD_COMMAND	HD_STATUS	/* same io address, read=status, write=cmd */ | 
 | 28 |  | 
 | 29 | #define HD_CMD		0x3f6		/* used for resets */ | 
 | 30 | #define HD_ALTSTATUS	0x3f6		/* same as HD_STATUS but doesn't clear irq */ | 
 | 31 |  | 
 | 32 | /* remainder is shared between hd.c, ide.c, ide-cd.c, and the hdparm utility */ | 
 | 33 |  | 
 | 34 | /* Bits of HD_STATUS */ | 
 | 35 | #define ERR_STAT		0x01 | 
 | 36 | #define INDEX_STAT		0x02 | 
 | 37 | #define ECC_STAT		0x04	/* Corrected error */ | 
 | 38 | #define DRQ_STAT		0x08 | 
 | 39 | #define SEEK_STAT		0x10 | 
 | 40 | #define SRV_STAT		0x10 | 
 | 41 | #define WRERR_STAT		0x20 | 
 | 42 | #define READY_STAT		0x40 | 
 | 43 | #define BUSY_STAT		0x80 | 
 | 44 |  | 
 | 45 | /* Bits for HD_ERROR */ | 
 | 46 | #define MARK_ERR		0x01	/* Bad address mark */ | 
 | 47 | #define TRK0_ERR		0x02	/* couldn't find track 0 */ | 
 | 48 | #define ABRT_ERR		0x04	/* Command aborted */ | 
 | 49 | #define MCR_ERR			0x08	/* media change request */ | 
 | 50 | #define ID_ERR			0x10	/* ID field not found */ | 
 | 51 | #define MC_ERR			0x20	/* media changed */ | 
 | 52 | #define ECC_ERR			0x40	/* Uncorrectable ECC error */ | 
 | 53 | #define BBD_ERR			0x80	/* pre-EIDE meaning:  block marked bad */ | 
 | 54 | #define ICRC_ERR		0x80	/* new meaning:  CRC error during transfer */ | 
 | 55 |  | 
 | 56 | /* Bits of HD_NSECTOR */ | 
 | 57 | #define CD			0x01 | 
 | 58 | #define IO			0x02 | 
 | 59 | #define REL			0x04 | 
 | 60 | #define TAG_MASK		0xf8 | 
 | 61 | #endif /* __KERNEL__ */ | 
 | 62 |  | 
 | 63 | /* | 
 | 64 |  * Command Header sizes for IOCTL commands | 
 | 65 |  */ | 
 | 66 |  | 
 | 67 | #define HDIO_DRIVE_CMD_HDR_SIZE		(4 * sizeof(u8)) | 
 | 68 | #define HDIO_DRIVE_HOB_HDR_SIZE		(8 * sizeof(u8)) | 
 | 69 | #define HDIO_DRIVE_TASK_HDR_SIZE	(8 * sizeof(u8)) | 
 | 70 |  | 
 | 71 | #define IDE_DRIVE_TASK_INVALID		-1 | 
 | 72 | #define IDE_DRIVE_TASK_NO_DATA		0 | 
 | 73 | #define IDE_DRIVE_TASK_SET_XFER		1 | 
 | 74 |  | 
 | 75 | #define IDE_DRIVE_TASK_IN		2 | 
 | 76 |  | 
 | 77 | #define IDE_DRIVE_TASK_OUT		3 | 
 | 78 | #define IDE_DRIVE_TASK_RAW_WRITE	4 | 
 | 79 |  | 
 | 80 | /* | 
 | 81 |  * Define standard taskfile in/out register | 
 | 82 |  */ | 
 | 83 | #define IDE_TASKFILE_STD_OUT_FLAGS	0xFE | 
 | 84 | #define IDE_TASKFILE_STD_IN_FLAGS	0xFE | 
 | 85 | #define IDE_HOB_STD_OUT_FLAGS		0x3C | 
 | 86 | #define IDE_HOB_STD_IN_FLAGS		0x3C | 
 | 87 |  | 
 | 88 | typedef unsigned char task_ioreg_t; | 
 | 89 | typedef unsigned long sata_ioreg_t; | 
 | 90 |  | 
 | 91 | typedef union ide_reg_valid_s { | 
 | 92 | 	unsigned all				: 16; | 
 | 93 | 	struct { | 
 | 94 | 		unsigned data			: 1; | 
 | 95 | 		unsigned error_feature		: 1; | 
 | 96 | 		unsigned sector			: 1; | 
 | 97 | 		unsigned nsector		: 1; | 
 | 98 | 		unsigned lcyl			: 1; | 
 | 99 | 		unsigned hcyl			: 1; | 
 | 100 | 		unsigned select			: 1; | 
 | 101 | 		unsigned status_command		: 1; | 
 | 102 |  | 
 | 103 | 		unsigned data_hob		: 1; | 
 | 104 | 		unsigned error_feature_hob	: 1; | 
 | 105 | 		unsigned sector_hob		: 1; | 
 | 106 | 		unsigned nsector_hob		: 1; | 
 | 107 | 		unsigned lcyl_hob		: 1; | 
 | 108 | 		unsigned hcyl_hob		: 1; | 
 | 109 | 		unsigned select_hob		: 1; | 
 | 110 | 		unsigned control_hob		: 1; | 
 | 111 | 	} b; | 
 | 112 | } ide_reg_valid_t; | 
 | 113 |  | 
 | 114 | typedef struct ide_task_request_s { | 
 | 115 | 	task_ioreg_t	io_ports[8]; | 
 | 116 | 	task_ioreg_t	hob_ports[8]; | 
 | 117 | 	ide_reg_valid_t	out_flags; | 
 | 118 | 	ide_reg_valid_t	in_flags; | 
 | 119 | 	int		data_phase; | 
 | 120 | 	int		req_cmd; | 
 | 121 | 	unsigned long	out_size; | 
 | 122 | 	unsigned long	in_size; | 
 | 123 | } ide_task_request_t; | 
 | 124 |  | 
 | 125 | typedef struct ide_ioctl_request_s { | 
 | 126 | 	ide_task_request_t	*task_request; | 
 | 127 | 	unsigned char		*out_buffer; | 
 | 128 | 	unsigned char		*in_buffer; | 
 | 129 | } ide_ioctl_request_t; | 
 | 130 |  | 
 | 131 | struct hd_drive_cmd_hdr { | 
 | 132 | 	task_ioreg_t command; | 
 | 133 | 	task_ioreg_t sector_number; | 
 | 134 | 	task_ioreg_t feature; | 
 | 135 | 	task_ioreg_t sector_count; | 
 | 136 | }; | 
 | 137 |  | 
 | 138 | typedef struct hd_drive_task_hdr { | 
 | 139 | 	task_ioreg_t data; | 
 | 140 | 	task_ioreg_t feature; | 
 | 141 | 	task_ioreg_t sector_count; | 
 | 142 | 	task_ioreg_t sector_number; | 
 | 143 | 	task_ioreg_t low_cylinder; | 
 | 144 | 	task_ioreg_t high_cylinder; | 
 | 145 | 	task_ioreg_t device_head; | 
 | 146 | 	task_ioreg_t command; | 
 | 147 | } task_struct_t; | 
 | 148 |  | 
 | 149 | typedef struct hd_drive_hob_hdr { | 
 | 150 | 	task_ioreg_t data; | 
 | 151 | 	task_ioreg_t feature; | 
 | 152 | 	task_ioreg_t sector_count; | 
 | 153 | 	task_ioreg_t sector_number; | 
 | 154 | 	task_ioreg_t low_cylinder; | 
 | 155 | 	task_ioreg_t high_cylinder; | 
 | 156 | 	task_ioreg_t device_head; | 
 | 157 | 	task_ioreg_t control; | 
 | 158 | } hob_struct_t; | 
 | 159 |  | 
 | 160 | #define TASKFILE_INVALID		0x7fff | 
 | 161 | #define TASKFILE_48			0x8000 | 
 | 162 |  | 
 | 163 | #define TASKFILE_NO_DATA		0x0000 | 
 | 164 |  | 
 | 165 | #define TASKFILE_IN			0x0001 | 
 | 166 | #define TASKFILE_MULTI_IN		0x0002 | 
 | 167 |  | 
 | 168 | #define TASKFILE_OUT			0x0004 | 
 | 169 | #define TASKFILE_MULTI_OUT		0x0008 | 
 | 170 | #define TASKFILE_IN_OUT			0x0010 | 
 | 171 |  | 
 | 172 | #define TASKFILE_IN_DMA			0x0020 | 
 | 173 | #define TASKFILE_OUT_DMA		0x0040 | 
 | 174 | #define TASKFILE_IN_DMAQ		0x0080 | 
 | 175 | #define TASKFILE_OUT_DMAQ		0x0100 | 
 | 176 |  | 
 | 177 | #define TASKFILE_P_IN			0x0200 | 
 | 178 | #define TASKFILE_P_OUT			0x0400 | 
 | 179 | #define TASKFILE_P_IN_DMA		0x0800 | 
 | 180 | #define TASKFILE_P_OUT_DMA		0x1000 | 
 | 181 | #define TASKFILE_P_IN_DMAQ		0x2000 | 
 | 182 | #define TASKFILE_P_OUT_DMAQ		0x4000 | 
 | 183 |  | 
 | 184 | /* ATA/ATAPI Commands pre T13 Spec */ | 
 | 185 | #define WIN_NOP				0x00 | 
 | 186 | /* | 
 | 187 |  *	0x01->0x02 Reserved | 
 | 188 |  */ | 
 | 189 | #define CFA_REQ_EXT_ERROR_CODE		0x03 /* CFA Request Extended Error Code */ | 
 | 190 | /* | 
 | 191 |  *	0x04->0x07 Reserved | 
 | 192 |  */ | 
 | 193 | #define WIN_SRST			0x08 /* ATAPI soft reset command */ | 
 | 194 | #define WIN_DEVICE_RESET		0x08 | 
 | 195 | /* | 
 | 196 |  *	0x09->0x0F Reserved | 
 | 197 |  */ | 
 | 198 | #define WIN_RECAL			0x10 | 
 | 199 | #define WIN_RESTORE			WIN_RECAL | 
 | 200 | /* | 
 | 201 |  *	0x10->0x1F Reserved | 
 | 202 |  */ | 
 | 203 | #define WIN_READ			0x20 /* 28-Bit */ | 
 | 204 | #define WIN_READ_ONCE			0x21 /* 28-Bit without retries */ | 
 | 205 | #define WIN_READ_LONG			0x22 /* 28-Bit */ | 
 | 206 | #define WIN_READ_LONG_ONCE		0x23 /* 28-Bit without retries */ | 
 | 207 | #define WIN_READ_EXT			0x24 /* 48-Bit */ | 
 | 208 | #define WIN_READDMA_EXT			0x25 /* 48-Bit */ | 
 | 209 | #define WIN_READDMA_QUEUED_EXT		0x26 /* 48-Bit */ | 
 | 210 | #define WIN_READ_NATIVE_MAX_EXT		0x27 /* 48-Bit */ | 
 | 211 | /* | 
 | 212 |  *	0x28 | 
 | 213 |  */ | 
 | 214 | #define WIN_MULTREAD_EXT		0x29 /* 48-Bit */ | 
 | 215 | /* | 
 | 216 |  *	0x2A->0x2F Reserved | 
 | 217 |  */ | 
 | 218 | #define WIN_WRITE			0x30 /* 28-Bit */ | 
 | 219 | #define WIN_WRITE_ONCE			0x31 /* 28-Bit without retries */ | 
 | 220 | #define WIN_WRITE_LONG			0x32 /* 28-Bit */ | 
 | 221 | #define WIN_WRITE_LONG_ONCE		0x33 /* 28-Bit without retries */ | 
 | 222 | #define WIN_WRITE_EXT			0x34 /* 48-Bit */ | 
 | 223 | #define WIN_WRITEDMA_EXT		0x35 /* 48-Bit */ | 
 | 224 | #define WIN_WRITEDMA_QUEUED_EXT		0x36 /* 48-Bit */ | 
 | 225 | #define WIN_SET_MAX_EXT			0x37 /* 48-Bit */ | 
 | 226 | #define CFA_WRITE_SECT_WO_ERASE		0x38 /* CFA Write Sectors without erase */ | 
 | 227 | #define WIN_MULTWRITE_EXT		0x39 /* 48-Bit */ | 
 | 228 | /* | 
 | 229 |  *	0x3A->0x3B Reserved | 
 | 230 |  */ | 
 | 231 | #define WIN_WRITE_VERIFY		0x3C /* 28-Bit */ | 
 | 232 | /* | 
 | 233 |  *	0x3D->0x3F Reserved | 
 | 234 |  */ | 
 | 235 | #define WIN_VERIFY			0x40 /* 28-Bit - Read Verify Sectors */ | 
 | 236 | #define WIN_VERIFY_ONCE			0x41 /* 28-Bit - without retries */ | 
 | 237 | #define WIN_VERIFY_EXT			0x42 /* 48-Bit */ | 
 | 238 | /* | 
 | 239 |  *	0x43->0x4F Reserved | 
 | 240 |  */ | 
 | 241 | #define WIN_FORMAT			0x50 | 
 | 242 | /* | 
 | 243 |  *	0x51->0x5F Reserved | 
 | 244 |  */ | 
 | 245 | #define WIN_INIT			0x60 | 
 | 246 | /* | 
 | 247 |  *	0x61->0x5F Reserved | 
 | 248 |  */ | 
 | 249 | #define WIN_SEEK			0x70 /* 0x70-0x7F Reserved */ | 
 | 250 |  | 
 | 251 | #define CFA_TRANSLATE_SECTOR		0x87 /* CFA Translate Sector */ | 
 | 252 | #define WIN_DIAGNOSE			0x90 | 
 | 253 | #define WIN_SPECIFY			0x91 /* set drive geometry translation */ | 
 | 254 | #define WIN_DOWNLOAD_MICROCODE		0x92 | 
 | 255 | #define WIN_STANDBYNOW2			0x94 | 
 | 256 | #define WIN_STANDBY2			0x96 | 
 | 257 | #define WIN_SETIDLE2			0x97 | 
 | 258 | #define WIN_CHECKPOWERMODE2		0x98 | 
 | 259 | #define WIN_SLEEPNOW2			0x99 | 
 | 260 | /* | 
 | 261 |  *	0x9A VENDOR | 
 | 262 |  */ | 
 | 263 | #define WIN_PACKETCMD			0xA0 /* Send a packet command. */ | 
 | 264 | #define WIN_PIDENTIFY			0xA1 /* identify ATAPI device	*/ | 
 | 265 | #define WIN_QUEUED_SERVICE		0xA2 | 
 | 266 | #define WIN_SMART			0xB0 /* self-monitoring and reporting */ | 
 | 267 | #define CFA_ERASE_SECTORS		0xC0 | 
 | 268 | #define WIN_MULTREAD			0xC4 /* read sectors using multiple mode*/ | 
 | 269 | #define WIN_MULTWRITE			0xC5 /* write sectors using multiple mode */ | 
 | 270 | #define WIN_SETMULT			0xC6 /* enable/disable multiple mode */ | 
 | 271 | #define WIN_READDMA_QUEUED		0xC7 /* read sectors using Queued DMA transfers */ | 
 | 272 | #define WIN_READDMA			0xC8 /* read sectors using DMA transfers */ | 
 | 273 | #define WIN_READDMA_ONCE		0xC9 /* 28-Bit - without retries */ | 
 | 274 | #define WIN_WRITEDMA			0xCA /* write sectors using DMA transfers */ | 
 | 275 | #define WIN_WRITEDMA_ONCE		0xCB /* 28-Bit - without retries */ | 
 | 276 | #define WIN_WRITEDMA_QUEUED		0xCC /* write sectors using Queued DMA transfers */ | 
 | 277 | #define CFA_WRITE_MULTI_WO_ERASE	0xCD /* CFA Write multiple without erase */ | 
 | 278 | #define WIN_GETMEDIASTATUS		0xDA | 
 | 279 | #define WIN_ACKMEDIACHANGE		0xDB /* ATA-1, ATA-2 vendor */ | 
 | 280 | #define WIN_POSTBOOT			0xDC | 
 | 281 | #define WIN_PREBOOT 			0xDD | 
 | 282 | #define WIN_DOORLOCK			0xDE /* lock door on removable drives */ | 
 | 283 | #define WIN_DOORUNLOCK			0xDF /* unlock door on removable drives */ | 
 | 284 | #define WIN_STANDBYNOW1			0xE0 | 
 | 285 | #define WIN_IDLEIMMEDIATE		0xE1 /* force drive to become "ready" */ | 
 | 286 | #define WIN_STANDBY			0xE2 /* Set device in Standby Mode */ | 
 | 287 | #define WIN_SETIDLE1			0xE3 | 
 | 288 | #define WIN_READ_BUFFER			0xE4 /* force read only 1 sector */ | 
 | 289 | #define WIN_CHECKPOWERMODE1		0xE5 | 
 | 290 | #define WIN_SLEEPNOW1			0xE6 | 
 | 291 | #define WIN_FLUSH_CACHE			0xE7 | 
 | 292 | #define WIN_WRITE_BUFFER		0xE8 /* force write only 1 sector */ | 
 | 293 | #define WIN_WRITE_SAME			0xE9 /* read ata-2 to use */ | 
 | 294 | 	/* SET_FEATURES 0x22 or 0xDD */ | 
 | 295 | #define WIN_FLUSH_CACHE_EXT		0xEA /* 48-Bit */ | 
 | 296 | #define WIN_IDENTIFY			0xEC /* ask drive to identify itself	*/ | 
 | 297 | #define WIN_MEDIAEJECT			0xED | 
 | 298 | #define WIN_IDENTIFY_DMA		0xEE /* same as WIN_IDENTIFY, but DMA */ | 
 | 299 | #define WIN_SETFEATURES			0xEF /* set special drive features */ | 
 | 300 | #define EXABYTE_ENABLE_NEST		0xF0 | 
 | 301 | #define WIN_SECURITY_SET_PASS		0xF1 | 
 | 302 | #define WIN_SECURITY_UNLOCK		0xF2 | 
 | 303 | #define WIN_SECURITY_ERASE_PREPARE	0xF3 | 
 | 304 | #define WIN_SECURITY_ERASE_UNIT		0xF4 | 
 | 305 | #define WIN_SECURITY_FREEZE_LOCK	0xF5 | 
 | 306 | #define WIN_SECURITY_DISABLE		0xF6 | 
 | 307 | #define WIN_READ_NATIVE_MAX		0xF8 /* return the native maximum address */ | 
 | 308 | #define WIN_SET_MAX			0xF9 | 
 | 309 | #define DISABLE_SEAGATE			0xFB | 
 | 310 |  | 
 | 311 | /* WIN_SMART sub-commands */ | 
 | 312 |  | 
 | 313 | #define SMART_READ_VALUES		0xD0 | 
 | 314 | #define SMART_READ_THRESHOLDS		0xD1 | 
 | 315 | #define SMART_AUTOSAVE			0xD2 | 
 | 316 | #define SMART_SAVE			0xD3 | 
 | 317 | #define SMART_IMMEDIATE_OFFLINE		0xD4 | 
 | 318 | #define SMART_READ_LOG_SECTOR		0xD5 | 
 | 319 | #define SMART_WRITE_LOG_SECTOR		0xD6 | 
 | 320 | #define SMART_WRITE_THRESHOLDS		0xD7 | 
 | 321 | #define SMART_ENABLE			0xD8 | 
 | 322 | #define SMART_DISABLE			0xD9 | 
 | 323 | #define SMART_STATUS			0xDA | 
 | 324 | #define SMART_AUTO_OFFLINE		0xDB | 
 | 325 |  | 
 | 326 | /* Password used in TF4 & TF5 executing SMART commands */ | 
 | 327 |  | 
 | 328 | #define SMART_LCYL_PASS			0x4F | 
 | 329 | #define SMART_HCYL_PASS			0xC2 | 
 | 330 |  | 
 | 331 | /* WIN_SETFEATURES sub-commands */ | 
 | 332 | #define SETFEATURES_EN_8BIT	0x01	/* Enable 8-Bit Transfers */ | 
 | 333 | #define SETFEATURES_EN_WCACHE	0x02	/* Enable write cache */ | 
 | 334 | #define SETFEATURES_DIS_DEFECT	0x04	/* Disable Defect Management */ | 
 | 335 | #define SETFEATURES_EN_APM	0x05	/* Enable advanced power management */ | 
 | 336 | #define SETFEATURES_EN_SAME_R	0x22	/* for a region ATA-1 */ | 
 | 337 | #define SETFEATURES_DIS_MSN	0x31	/* Disable Media Status Notification */ | 
 | 338 | #define SETFEATURES_DIS_RETRY	0x33	/* Disable Retry */ | 
 | 339 | #define SETFEATURES_EN_AAM	0x42	/* Enable Automatic Acoustic Management */ | 
 | 340 | #define SETFEATURES_RW_LONG	0x44	/* Set Length of VS bytes */ | 
 | 341 | #define SETFEATURES_SET_CACHE	0x54	/* Set Cache segments to SC Reg. Val */ | 
 | 342 | #define SETFEATURES_DIS_RLA	0x55	/* Disable read look-ahead feature */ | 
 | 343 | #define SETFEATURES_EN_RI	0x5D	/* Enable release interrupt */ | 
 | 344 | #define SETFEATURES_EN_SI	0x5E	/* Enable SERVICE interrupt */ | 
 | 345 | #define SETFEATURES_DIS_RPOD	0x66	/* Disable reverting to power on defaults */ | 
 | 346 | #define SETFEATURES_DIS_ECC	0x77	/* Disable ECC byte count */ | 
 | 347 | #define SETFEATURES_DIS_8BIT	0x81	/* Disable 8-Bit Transfers */ | 
 | 348 | #define SETFEATURES_DIS_WCACHE	0x82	/* Disable write cache */ | 
 | 349 | #define SETFEATURES_EN_DEFECT	0x84	/* Enable Defect Management */ | 
 | 350 | #define SETFEATURES_DIS_APM	0x85	/* Disable advanced power management */ | 
 | 351 | #define SETFEATURES_EN_ECC	0x88	/* Enable ECC byte count */ | 
 | 352 | #define SETFEATURES_EN_MSN	0x95	/* Enable Media Status Notification */ | 
 | 353 | #define SETFEATURES_EN_RETRY	0x99	/* Enable Retry */ | 
 | 354 | #define SETFEATURES_EN_RLA	0xAA	/* Enable read look-ahead feature */ | 
 | 355 | #define SETFEATURES_PREFETCH	0xAB	/* Sets drive prefetch value */ | 
 | 356 | #define SETFEATURES_EN_REST	0xAC	/* ATA-1 */ | 
 | 357 | #define SETFEATURES_4B_RW_LONG	0xBB	/* Set Lenght of 4 bytes */ | 
 | 358 | #define SETFEATURES_DIS_AAM	0xC2	/* Disable Automatic Acoustic Management */ | 
 | 359 | #define SETFEATURES_EN_RPOD	0xCC	/* Enable reverting to power on defaults */ | 
 | 360 | #define SETFEATURES_DIS_RI	0xDD	/* Disable release interrupt ATAPI */ | 
 | 361 | #define SETFEATURES_EN_SAME_M	0xDD	/* for a entire device ATA-1 */ | 
 | 362 | #define SETFEATURES_DIS_SI	0xDE	/* Disable SERVICE interrupt ATAPI */ | 
 | 363 |  | 
 | 364 | /* WIN_SECURITY sub-commands */ | 
 | 365 |  | 
 | 366 | #define SECURITY_SET_PASSWORD		0xBA | 
 | 367 | #define SECURITY_UNLOCK			0xBB | 
 | 368 | #define SECURITY_ERASE_PREPARE		0xBC | 
 | 369 | #define SECURITY_ERASE_UNIT		0xBD | 
 | 370 | #define SECURITY_FREEZE_LOCK		0xBE | 
 | 371 | #define SECURITY_DISABLE_PASSWORD	0xBF | 
 | 372 |  | 
 | 373 | struct hd_geometry { | 
 | 374 |       unsigned char heads; | 
 | 375 |       unsigned char sectors; | 
 | 376 |       unsigned short cylinders; | 
 | 377 |       unsigned long start; | 
 | 378 | }; | 
 | 379 |  | 
 | 380 | /* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */ | 
 | 381 | #define HDIO_GETGEO		0x0301	/* get device geometry */ | 
 | 382 | #define HDIO_GET_UNMASKINTR	0x0302	/* get current unmask setting */ | 
 | 383 | #define HDIO_GET_MULTCOUNT	0x0304	/* get current IDE blockmode setting */ | 
 | 384 | #define HDIO_GET_QDMA		0x0305	/* get use-qdma flag */ | 
 | 385 |  | 
 | 386 | #define HDIO_SET_XFER		0x0306  /* set transfer rate via proc */ | 
 | 387 |  | 
 | 388 | #define HDIO_OBSOLETE_IDENTITY	0x0307	/* OBSOLETE, DO NOT USE: returns 142 bytes */ | 
 | 389 | #define HDIO_GET_KEEPSETTINGS	0x0308	/* get keep-settings-on-reset flag */ | 
 | 390 | #define HDIO_GET_32BIT		0x0309	/* get current io_32bit setting */ | 
 | 391 | #define HDIO_GET_NOWERR		0x030a	/* get ignore-write-error flag */ | 
 | 392 | #define HDIO_GET_DMA		0x030b	/* get use-dma flag */ | 
 | 393 | #define HDIO_GET_NICE		0x030c	/* get nice flags */ | 
 | 394 | #define HDIO_GET_IDENTITY	0x030d	/* get IDE identification info */ | 
 | 395 | #define HDIO_GET_WCACHE		0x030e	/* get write cache mode on|off */ | 
 | 396 | #define HDIO_GET_ACOUSTIC	0x030f	/* get acoustic value */ | 
 | 397 | #define	HDIO_GET_ADDRESS	0x0310	/* */ | 
 | 398 |  | 
 | 399 | #define HDIO_GET_BUSSTATE	0x031a	/* get the bus state of the hwif */ | 
 | 400 | #define HDIO_TRISTATE_HWIF	0x031b	/* execute a channel tristate */ | 
 | 401 | #define HDIO_DRIVE_RESET	0x031c	/* execute a device reset */ | 
 | 402 | #define HDIO_DRIVE_TASKFILE	0x031d	/* execute raw taskfile */ | 
 | 403 | #define HDIO_DRIVE_TASK		0x031e	/* execute task and special drive command */ | 
 | 404 | #define HDIO_DRIVE_CMD		0x031f	/* execute a special drive command */ | 
 | 405 | #define HDIO_DRIVE_CMD_AEB	HDIO_DRIVE_TASK | 
 | 406 |  | 
 | 407 | /* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */ | 
 | 408 | #define HDIO_SET_MULTCOUNT	0x0321	/* change IDE blockmode */ | 
 | 409 | #define HDIO_SET_UNMASKINTR	0x0322	/* permit other irqs during I/O */ | 
 | 410 | #define HDIO_SET_KEEPSETTINGS	0x0323	/* keep ioctl settings on reset */ | 
 | 411 | #define HDIO_SET_32BIT		0x0324	/* change io_32bit flags */ | 
 | 412 | #define HDIO_SET_NOWERR		0x0325	/* change ignore-write-error flag */ | 
 | 413 | #define HDIO_SET_DMA		0x0326	/* change use-dma flag */ | 
 | 414 | #define HDIO_SET_PIO_MODE	0x0327	/* reconfig interface to new speed */ | 
 | 415 | #define HDIO_SCAN_HWIF		0x0328	/* register and (re)scan interface */ | 
 | 416 | #define HDIO_SET_NICE		0x0329	/* set nice flags */ | 
 | 417 | #define HDIO_UNREGISTER_HWIF	0x032a  /* unregister interface */ | 
 | 418 | #define HDIO_SET_WCACHE		0x032b	/* change write cache enable-disable */ | 
 | 419 | #define HDIO_SET_ACOUSTIC	0x032c	/* change acoustic behavior */ | 
 | 420 | #define HDIO_SET_BUSSTATE	0x032d	/* set the bus state of the hwif */ | 
 | 421 | #define HDIO_SET_QDMA		0x032e	/* change use-qdma flag */ | 
 | 422 | #define HDIO_SET_ADDRESS	0x032f	/* change lba addressing modes */ | 
 | 423 |  | 
 | 424 | /* bus states */ | 
 | 425 | enum { | 
 | 426 | 	BUSSTATE_OFF = 0, | 
 | 427 | 	BUSSTATE_ON, | 
 | 428 | 	BUSSTATE_TRISTATE | 
 | 429 | }; | 
 | 430 |  | 
 | 431 | /* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x033n/0x033n */ | 
 | 432 | /* 0x330 is reserved - used to be HDIO_GETGEO_BIG */ | 
 | 433 | /* 0x331 is reserved - used to be HDIO_GETGEO_BIG_RAW */ | 
 | 434 | /* 0x338 is reserved - used to be HDIO_SET_IDE_SCSI */ | 
 | 435 | /* 0x339 is reserved - used to be HDIO_SET_SCSI_IDE */ | 
 | 436 |  | 
 | 437 | #define __NEW_HD_DRIVE_ID | 
 | 438 |  | 
 | 439 | /* | 
 | 440 |  * Structure returned by HDIO_GET_IDENTITY, as per ANSI NCITS ATA6 rev.1b spec. | 
 | 441 |  * | 
 | 442 |  * If you change something here, please remember to update fix_driveid() in | 
 | 443 |  * ide/probe.c. | 
 | 444 |  */ | 
 | 445 | struct hd_driveid { | 
 | 446 | 	unsigned short	config;		/* lots of obsolete bit flags */ | 
 | 447 | 	unsigned short	cyls;		/* Obsolete, "physical" cyls */ | 
 | 448 | 	unsigned short	reserved2;	/* reserved (word 2) */ | 
 | 449 | 	unsigned short	heads;		/* Obsolete, "physical" heads */ | 
 | 450 | 	unsigned short	track_bytes;	/* unformatted bytes per track */ | 
 | 451 | 	unsigned short	sector_bytes;	/* unformatted bytes per sector */ | 
 | 452 | 	unsigned short	sectors;	/* Obsolete, "physical" sectors per track */ | 
 | 453 | 	unsigned short	vendor0;	/* vendor unique */ | 
 | 454 | 	unsigned short	vendor1;	/* vendor unique */ | 
 | 455 | 	unsigned short	vendor2;	/* Retired vendor unique */ | 
 | 456 | 	unsigned char	serial_no[20];	/* 0 = not_specified */ | 
 | 457 | 	unsigned short	buf_type;	/* Retired */ | 
 | 458 | 	unsigned short	buf_size;	/* Retired, 512 byte increments | 
 | 459 | 					 * 0 = not_specified | 
 | 460 | 					 */ | 
 | 461 | 	unsigned short	ecc_bytes;	/* for r/w long cmds; 0 = not_specified */ | 
 | 462 | 	unsigned char	fw_rev[8];	/* 0 = not_specified */ | 
 | 463 | 	unsigned char	model[40];	/* 0 = not_specified */ | 
 | 464 | 	unsigned char	max_multsect;	/* 0=not_implemented */ | 
 | 465 | 	unsigned char	vendor3;	/* vendor unique */ | 
 | 466 | 	unsigned short	dword_io;	/* 0=not_implemented; 1=implemented */ | 
 | 467 | 	unsigned char	vendor4;	/* vendor unique */ | 
 | 468 | 	unsigned char	capability;	/* (upper byte of word 49) | 
 | 469 | 					 *  3:	IORDYsup | 
 | 470 | 					 *  2:	IORDYsw | 
 | 471 | 					 *  1:	LBA | 
 | 472 | 					 *  0:	DMA | 
 | 473 | 					 */ | 
 | 474 | 	unsigned short	reserved50;	/* reserved (word 50) */ | 
 | 475 | 	unsigned char	vendor5;	/* Obsolete, vendor unique */ | 
 | 476 | 	unsigned char	tPIO;		/* Obsolete, 0=slow, 1=medium, 2=fast */ | 
 | 477 | 	unsigned char	vendor6;	/* Obsolete, vendor unique */ | 
 | 478 | 	unsigned char	tDMA;		/* Obsolete, 0=slow, 1=medium, 2=fast */ | 
 | 479 | 	unsigned short	field_valid;	/* (word 53) | 
 | 480 | 					 *  2:	ultra_ok	word  88 | 
 | 481 | 					 *  1:	eide_ok		words 64-70 | 
 | 482 | 					 *  0:	cur_ok		words 54-58 | 
 | 483 | 					 */ | 
 | 484 | 	unsigned short	cur_cyls;	/* Obsolete, logical cylinders */ | 
 | 485 | 	unsigned short	cur_heads;	/* Obsolete, l heads */ | 
 | 486 | 	unsigned short	cur_sectors;	/* Obsolete, l sectors per track */ | 
 | 487 | 	unsigned short	cur_capacity0;	/* Obsolete, l total sectors on drive */ | 
 | 488 | 	unsigned short	cur_capacity1;	/* Obsolete, (2 words, misaligned int)     */ | 
 | 489 | 	unsigned char	multsect;	/* current multiple sector count */ | 
 | 490 | 	unsigned char	multsect_valid;	/* when (bit0==1) multsect is ok */ | 
 | 491 | 	unsigned int	lba_capacity;	/* Obsolete, total number of sectors */ | 
 | 492 | 	unsigned short	dma_1word;	/* Obsolete, single-word dma info */ | 
 | 493 | 	unsigned short	dma_mword;	/* multiple-word dma info */ | 
 | 494 | 	unsigned short  eide_pio_modes; /* bits 0:mode3 1:mode4 */ | 
 | 495 | 	unsigned short  eide_dma_min;	/* min mword dma cycle time (ns) */ | 
 | 496 | 	unsigned short  eide_dma_time;	/* recommended mword dma cycle time (ns) */ | 
 | 497 | 	unsigned short  eide_pio;       /* min cycle time (ns), no IORDY  */ | 
 | 498 | 	unsigned short  eide_pio_iordy; /* min cycle time (ns), with IORDY */ | 
 | 499 | 	unsigned short	words69_70[2];	/* reserved words 69-70 | 
 | 500 | 					 * future command overlap and queuing | 
 | 501 | 					 */ | 
 | 502 | 	/* HDIO_GET_IDENTITY currently returns only words 0 through 70 */ | 
 | 503 | 	unsigned short	words71_74[4];	/* reserved words 71-74 | 
 | 504 | 					 * for IDENTIFY PACKET DEVICE command | 
 | 505 | 					 */ | 
 | 506 | 	unsigned short  queue_depth;	/* (word 75) | 
 | 507 | 					 * 15:5	reserved | 
 | 508 | 					 *  4:0	Maximum queue depth -1 | 
 | 509 | 					 */ | 
 | 510 | 	unsigned short  words76_79[4];	/* reserved words 76-79 */ | 
 | 511 | 	unsigned short  major_rev_num;	/* (word 80) */ | 
 | 512 | 	unsigned short  minor_rev_num;	/* (word 81) */ | 
 | 513 | 	unsigned short  command_set_1;	/* (word 82) supported | 
 | 514 | 					 * 15:	Obsolete | 
 | 515 | 					 * 14:	NOP command | 
 | 516 | 					 * 13:	READ_BUFFER | 
 | 517 | 					 * 12:	WRITE_BUFFER | 
 | 518 | 					 * 11:	Obsolete | 
 | 519 | 					 * 10:	Host Protected Area | 
 | 520 | 					 *  9:	DEVICE Reset | 
 | 521 | 					 *  8:	SERVICE Interrupt | 
 | 522 | 					 *  7:	Release Interrupt | 
 | 523 | 					 *  6:	look-ahead | 
 | 524 | 					 *  5:	write cache | 
 | 525 | 					 *  4:	PACKET Command | 
 | 526 | 					 *  3:	Power Management Feature Set | 
 | 527 | 					 *  2:	Removable Feature Set | 
 | 528 | 					 *  1:	Security Feature Set | 
 | 529 | 					 *  0:	SMART Feature Set | 
 | 530 | 					 */ | 
 | 531 | 	unsigned short  command_set_2;	/* (word 83) | 
 | 532 | 					 * 15:	Shall be ZERO | 
 | 533 | 					 * 14:	Shall be ONE | 
 | 534 | 					 * 13:	FLUSH CACHE EXT | 
 | 535 | 					 * 12:	FLUSH CACHE | 
 | 536 | 					 * 11:	Device Configuration Overlay | 
 | 537 | 					 * 10:	48-bit Address Feature Set | 
 | 538 | 					 *  9:	Automatic Acoustic Management | 
 | 539 | 					 *  8:	SET MAX security | 
 | 540 | 					 *  7:	reserved 1407DT PARTIES | 
 | 541 | 					 *  6:	SetF sub-command Power-Up | 
 | 542 | 					 *  5:	Power-Up in Standby Feature Set | 
 | 543 | 					 *  4:	Removable Media Notification | 
 | 544 | 					 *  3:	APM Feature Set | 
 | 545 | 					 *  2:	CFA Feature Set | 
 | 546 | 					 *  1:	READ/WRITE DMA QUEUED | 
 | 547 | 					 *  0:	Download MicroCode | 
 | 548 | 					 */ | 
 | 549 | 	unsigned short  cfsse;		/* (word 84) | 
 | 550 | 					 * cmd set-feature supported extensions | 
 | 551 | 					 * 15:	Shall be ZERO | 
 | 552 | 					 * 14:	Shall be ONE | 
 | 553 | 					 * 13:6	reserved | 
 | 554 | 					 *  5:	General Purpose Logging | 
 | 555 | 					 *  4:	Streaming Feature Set | 
 | 556 | 					 *  3:	Media Card Pass Through | 
 | 557 | 					 *  2:	Media Serial Number Valid | 
 | 558 | 					 *  1:	SMART selt-test supported | 
 | 559 | 					 *  0:	SMART error logging | 
 | 560 | 					 */ | 
 | 561 | 	unsigned short  cfs_enable_1;	/* (word 85) | 
 | 562 | 					 * command set-feature enabled | 
 | 563 | 					 * 15:	Obsolete | 
 | 564 | 					 * 14:	NOP command | 
 | 565 | 					 * 13:	READ_BUFFER | 
 | 566 | 					 * 12:	WRITE_BUFFER | 
 | 567 | 					 * 11:	Obsolete | 
 | 568 | 					 * 10:	Host Protected Area | 
 | 569 | 					 *  9:	DEVICE Reset | 
 | 570 | 					 *  8:	SERVICE Interrupt | 
 | 571 | 					 *  7:	Release Interrupt | 
 | 572 | 					 *  6:	look-ahead | 
 | 573 | 					 *  5:	write cache | 
 | 574 | 					 *  4:	PACKET Command | 
 | 575 | 					 *  3:	Power Management Feature Set | 
 | 576 | 					 *  2:	Removable Feature Set | 
 | 577 | 					 *  1:	Security Feature Set | 
 | 578 | 					 *  0:	SMART Feature Set | 
 | 579 | 					 */ | 
 | 580 | 	unsigned short  cfs_enable_2;	/* (word 86) | 
 | 581 | 					 * command set-feature enabled | 
 | 582 | 					 * 15:	Shall be ZERO | 
 | 583 | 					 * 14:	Shall be ONE | 
 | 584 | 					 * 13:	FLUSH CACHE EXT | 
 | 585 | 					 * 12:	FLUSH CACHE | 
 | 586 | 					 * 11:	Device Configuration Overlay | 
 | 587 | 					 * 10:	48-bit Address Feature Set | 
 | 588 | 					 *  9:	Automatic Acoustic Management | 
 | 589 | 					 *  8:	SET MAX security | 
 | 590 | 					 *  7:	reserved 1407DT PARTIES | 
 | 591 | 					 *  6:	SetF sub-command Power-Up | 
 | 592 | 					 *  5:	Power-Up in Standby Feature Set | 
 | 593 | 					 *  4:	Removable Media Notification | 
 | 594 | 					 *  3:	APM Feature Set | 
 | 595 | 					 *  2:	CFA Feature Set | 
 | 596 | 					 *  1:	READ/WRITE DMA QUEUED | 
 | 597 | 					 *  0:	Download MicroCode | 
 | 598 | 					 */ | 
 | 599 | 	unsigned short  csf_default;	/* (word 87) | 
 | 600 | 					 * command set-feature default | 
 | 601 | 					 * 15:	Shall be ZERO | 
 | 602 | 					 * 14:	Shall be ONE | 
 | 603 | 					 * 13:6	reserved | 
 | 604 | 					 *  5:	General Purpose Logging enabled | 
 | 605 | 					 *  4:	Valid CONFIGURE STREAM executed | 
 | 606 | 					 *  3:	Media Card Pass Through enabled | 
 | 607 | 					 *  2:	Media Serial Number Valid | 
 | 608 | 					 *  1:	SMART selt-test supported | 
 | 609 | 					 *  0:	SMART error logging | 
 | 610 | 					 */ | 
 | 611 | 	unsigned short  dma_ultra;	/* (word 88) */ | 
 | 612 | 	unsigned short	trseuc;		/* time required for security erase */ | 
 | 613 | 	unsigned short	trsEuc;		/* time required for enhanced erase */ | 
 | 614 | 	unsigned short	CurAPMvalues;	/* current APM values */ | 
 | 615 | 	unsigned short	mprc;		/* master password revision code */ | 
 | 616 | 	unsigned short	hw_config;	/* hardware config (word 93) | 
 | 617 | 					 * 15:	Shall be ZERO | 
 | 618 | 					 * 14:	Shall be ONE | 
 | 619 | 					 * 13: | 
 | 620 | 					 * 12: | 
 | 621 | 					 * 11: | 
 | 622 | 					 * 10: | 
 | 623 | 					 *  9: | 
 | 624 | 					 *  8: | 
 | 625 | 					 *  7: | 
 | 626 | 					 *  6: | 
 | 627 | 					 *  5: | 
 | 628 | 					 *  4: | 
 | 629 | 					 *  3: | 
 | 630 | 					 *  2: | 
 | 631 | 					 *  1: | 
 | 632 | 					 *  0:	Shall be ONE | 
 | 633 | 					 */ | 
 | 634 | 	unsigned short	acoustic;	/* (word 94) | 
 | 635 | 					 * 15:8	Vendor's recommended value | 
 | 636 | 					 *  7:0	current value | 
 | 637 | 					 */ | 
 | 638 | 	unsigned short	msrqs;		/* min stream request size */ | 
 | 639 | 	unsigned short	sxfert;		/* stream transfer time */ | 
 | 640 | 	unsigned short	sal;		/* stream access latency */ | 
 | 641 | 	unsigned int	spg;		/* stream performance granularity */ | 
 | 642 | 	unsigned long long lba_capacity_2;/* 48-bit total number of sectors */ | 
 | 643 | 	unsigned short	words104_125[22];/* reserved words 104-125 */ | 
 | 644 | 	unsigned short	last_lun;	/* (word 126) */ | 
 | 645 | 	unsigned short	word127;	/* (word 127) Feature Set | 
 | 646 | 					 * Removable Media Notification | 
 | 647 | 					 * 15:2	reserved | 
 | 648 | 					 *  1:0	00 = not supported | 
 | 649 | 					 *	01 = supported | 
 | 650 | 					 *	10 = reserved | 
 | 651 | 					 *	11 = reserved | 
 | 652 | 					 */ | 
 | 653 | 	unsigned short	dlf;		/* (word 128) | 
 | 654 | 					 * device lock function | 
 | 655 | 					 * 15:9	reserved | 
 | 656 | 					 *  8	security level 1:max 0:high | 
 | 657 | 					 *  7:6	reserved | 
 | 658 | 					 *  5	enhanced erase | 
 | 659 | 					 *  4	expire | 
 | 660 | 					 *  3	frozen | 
 | 661 | 					 *  2	locked | 
 | 662 | 					 *  1	en/disabled | 
 | 663 | 					 *  0	capability | 
 | 664 | 					 */ | 
 | 665 | 	unsigned short  csfo;		/*  (word 129) | 
 | 666 | 					 * current set features options | 
 | 667 | 					 * 15:4	reserved | 
 | 668 | 					 *  3:	auto reassign | 
 | 669 | 					 *  2:	reverting | 
 | 670 | 					 *  1:	read-look-ahead | 
 | 671 | 					 *  0:	write cache | 
 | 672 | 					 */ | 
 | 673 | 	unsigned short	words130_155[26];/* reserved vendor words 130-155 */ | 
 | 674 | 	unsigned short	word156;	/* reserved vendor word 156 */ | 
 | 675 | 	unsigned short	words157_159[3];/* reserved vendor words 157-159 */ | 
 | 676 | 	unsigned short	cfa_power;	/* (word 160) CFA Power Mode | 
 | 677 | 					 * 15 word 160 supported | 
 | 678 | 					 * 14 reserved | 
 | 679 | 					 * 13 | 
 | 680 | 					 * 12 | 
 | 681 | 					 * 11:0 | 
 | 682 | 					 */ | 
 | 683 | 	unsigned short	words161_175[15];/* Reserved for CFA */ | 
 | 684 | 	unsigned short	words176_205[30];/* Current Media Serial Number */ | 
 | 685 | 	unsigned short	words206_254[49];/* reserved words 206-254 */ | 
 | 686 | 	unsigned short	integrity_word;	/* (word 255) | 
 | 687 | 					 * 15:8 Checksum | 
 | 688 | 					 *  7:0 Signature | 
 | 689 | 					 */ | 
 | 690 | }; | 
 | 691 |  | 
 | 692 | /* | 
 | 693 |  * IDE "nice" flags. These are used on a per drive basis to determine | 
 | 694 |  * when to be nice and give more bandwidth to the other devices which | 
 | 695 |  * share the same IDE bus. | 
 | 696 |  */ | 
 | 697 | #define IDE_NICE_DSC_OVERLAP	(0)	/* per the DSC overlap protocol */ | 
 | 698 | #define IDE_NICE_ATAPI_OVERLAP	(1)	/* not supported yet */ | 
 | 699 | #define IDE_NICE_0		(2)	/* when sure that it won't affect us */ | 
 | 700 | #define IDE_NICE_1		(3)	/* when probably won't affect us much */ | 
 | 701 | #define IDE_NICE_2		(4)	/* when we know it's on our expense */ | 
 | 702 |  | 
 | 703 | #endif	/* _LINUX_HDREG_H */ |