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