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