Home | History | Annotate | Download | only in linux
      1 /****************************************************************************
      2  ****************************************************************************
      3  ***
      4  ***   This header was automatically generated from a Linux kernel header
      5  ***   of the same name, to make information necessary for userspace to
      6  ***   call into the kernel available to libc.  It contains only constants,
      7  ***   structures, and macros generated from the original header, and thus,
      8  ***   contains no copyrightable information.
      9  ***
     10  ****************************************************************************
     11  ****************************************************************************/
     12 #ifndef _LINUX_HDREG_H
     13 #define _LINUX_HDREG_H
     14 
     15 #define HDIO_DRIVE_CMD_HDR_SIZE (4 * sizeof(u8))
     16 #define HDIO_DRIVE_HOB_HDR_SIZE (8 * sizeof(u8))
     17 #define HDIO_DRIVE_TASK_HDR_SIZE (8 * sizeof(u8))
     18 
     19 #define IDE_DRIVE_TASK_INVALID -1
     20 #define IDE_DRIVE_TASK_NO_DATA 0
     21 #define IDE_DRIVE_TASK_SET_XFER 1
     22 
     23 #define IDE_DRIVE_TASK_IN 2
     24 
     25 #define IDE_DRIVE_TASK_OUT 3
     26 #define IDE_DRIVE_TASK_RAW_WRITE 4
     27 
     28 #define IDE_TASKFILE_STD_IN_FLAGS 0xFE
     29 #define IDE_HOB_STD_IN_FLAGS 0x3C
     30 #define IDE_TASKFILE_STD_OUT_FLAGS 0xFE
     31 #define IDE_HOB_STD_OUT_FLAGS 0x3C
     32 
     33 typedef unsigned char task_ioreg_t;
     34 typedef unsigned long sata_ioreg_t;
     35 
     36 typedef union ide_reg_valid_s {
     37  unsigned all : 16;
     38  struct {
     39  unsigned data : 1;
     40  unsigned error_feature : 1;
     41  unsigned sector : 1;
     42  unsigned nsector : 1;
     43  unsigned lcyl : 1;
     44  unsigned hcyl : 1;
     45  unsigned select : 1;
     46  unsigned status_command : 1;
     47 
     48  unsigned data_hob : 1;
     49  unsigned error_feature_hob : 1;
     50  unsigned sector_hob : 1;
     51  unsigned nsector_hob : 1;
     52  unsigned lcyl_hob : 1;
     53  unsigned hcyl_hob : 1;
     54  unsigned select_hob : 1;
     55  unsigned control_hob : 1;
     56  } b;
     57 } ide_reg_valid_t;
     58 
     59 typedef struct ide_task_request_s {
     60  task_ioreg_t io_ports[8];
     61  task_ioreg_t hob_ports[8];
     62  ide_reg_valid_t out_flags;
     63  ide_reg_valid_t in_flags;
     64  int data_phase;
     65  int req_cmd;
     66  unsigned long out_size;
     67  unsigned long in_size;
     68 } ide_task_request_t;
     69 
     70 typedef struct ide_ioctl_request_s {
     71  ide_task_request_t *task_request;
     72  unsigned char *out_buffer;
     73  unsigned char *in_buffer;
     74 } ide_ioctl_request_t;
     75 
     76 struct hd_drive_cmd_hdr {
     77  task_ioreg_t command;
     78  task_ioreg_t sector_number;
     79  task_ioreg_t feature;
     80  task_ioreg_t sector_count;
     81 };
     82 
     83 typedef struct hd_drive_task_hdr {
     84  task_ioreg_t data;
     85  task_ioreg_t feature;
     86  task_ioreg_t sector_count;
     87  task_ioreg_t sector_number;
     88  task_ioreg_t low_cylinder;
     89  task_ioreg_t high_cylinder;
     90  task_ioreg_t device_head;
     91  task_ioreg_t command;
     92 } task_struct_t;
     93 
     94 typedef struct hd_drive_hob_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 control;
    103 } hob_struct_t;
    104 
    105 #define TASKFILE_INVALID 0x7fff
    106 #define TASKFILE_48 0x8000
    107 
    108 #define TASKFILE_NO_DATA 0x0000
    109 
    110 #define TASKFILE_IN 0x0001
    111 #define TASKFILE_MULTI_IN 0x0002
    112 
    113 #define TASKFILE_OUT 0x0004
    114 #define TASKFILE_MULTI_OUT 0x0008
    115 #define TASKFILE_IN_OUT 0x0010
    116 
    117 #define TASKFILE_IN_DMA 0x0020
    118 #define TASKFILE_OUT_DMA 0x0040
    119 #define TASKFILE_IN_DMAQ 0x0080
    120 #define TASKFILE_OUT_DMAQ 0x0100
    121 
    122 #define TASKFILE_P_IN 0x0200
    123 #define TASKFILE_P_OUT 0x0400
    124 #define TASKFILE_P_IN_DMA 0x0800
    125 #define TASKFILE_P_OUT_DMA 0x1000
    126 #define TASKFILE_P_IN_DMAQ 0x2000
    127 #define TASKFILE_P_OUT_DMAQ 0x4000
    128 
    129 #define WIN_NOP 0x00
    130 
    131 #define CFA_REQ_EXT_ERROR_CODE 0x03
    132 
    133 #define WIN_SRST 0x08
    134 #define WIN_DEVICE_RESET 0x08
    135 
    136 #define WIN_RECAL 0x10
    137 #define WIN_RESTORE WIN_RECAL
    138 
    139 #define WIN_READ 0x20
    140 #define WIN_READ_ONCE 0x21
    141 #define WIN_READ_LONG 0x22
    142 #define WIN_READ_LONG_ONCE 0x23
    143 #define WIN_READ_EXT 0x24
    144 #define WIN_READDMA_EXT 0x25
    145 #define WIN_READDMA_QUEUED_EXT 0x26
    146 #define WIN_READ_NATIVE_MAX_EXT 0x27
    147 
    148 #define WIN_MULTREAD_EXT 0x29
    149 
    150 #define WIN_WRITE 0x30
    151 #define WIN_WRITE_ONCE 0x31
    152 #define WIN_WRITE_LONG 0x32
    153 #define WIN_WRITE_LONG_ONCE 0x33
    154 #define WIN_WRITE_EXT 0x34
    155 #define WIN_WRITEDMA_EXT 0x35
    156 #define WIN_WRITEDMA_QUEUED_EXT 0x36
    157 #define WIN_SET_MAX_EXT 0x37
    158 #define CFA_WRITE_SECT_WO_ERASE 0x38
    159 #define WIN_MULTWRITE_EXT 0x39
    160 
    161 #define WIN_WRITE_VERIFY 0x3C
    162 
    163 #define WIN_VERIFY 0x40
    164 #define WIN_VERIFY_ONCE 0x41
    165 #define WIN_VERIFY_EXT 0x42
    166 
    167 #define WIN_FORMAT 0x50
    168 
    169 #define WIN_INIT 0x60
    170 
    171 #define WIN_SEEK 0x70
    172 
    173 #define CFA_TRANSLATE_SECTOR 0x87
    174 #define WIN_DIAGNOSE 0x90
    175 #define WIN_SPECIFY 0x91
    176 #define WIN_DOWNLOAD_MICROCODE 0x92
    177 #define WIN_STANDBYNOW2 0x94
    178 #define WIN_STANDBY2 0x96
    179 #define WIN_SETIDLE2 0x97
    180 #define WIN_CHECKPOWERMODE2 0x98
    181 #define WIN_SLEEPNOW2 0x99
    182 
    183 #define WIN_PACKETCMD 0xA0
    184 #define WIN_PIDENTIFY 0xA1
    185 #define WIN_QUEUED_SERVICE 0xA2
    186 #define WIN_SMART 0xB0
    187 #define CFA_ERASE_SECTORS 0xC0
    188 #define WIN_MULTREAD 0xC4
    189 #define WIN_MULTWRITE 0xC5
    190 #define WIN_SETMULT 0xC6
    191 #define WIN_READDMA_QUEUED 0xC7
    192 #define WIN_READDMA 0xC8
    193 #define WIN_READDMA_ONCE 0xC9
    194 #define WIN_WRITEDMA 0xCA
    195 #define WIN_WRITEDMA_ONCE 0xCB
    196 #define WIN_WRITEDMA_QUEUED 0xCC
    197 #define CFA_WRITE_MULTI_WO_ERASE 0xCD
    198 #define WIN_GETMEDIASTATUS 0xDA
    199 #define WIN_ACKMEDIACHANGE 0xDB
    200 #define WIN_POSTBOOT 0xDC
    201 #define WIN_PREBOOT 0xDD
    202 #define WIN_DOORLOCK 0xDE
    203 #define WIN_DOORUNLOCK 0xDF
    204 #define WIN_STANDBYNOW1 0xE0
    205 #define WIN_IDLEIMMEDIATE 0xE1
    206 #define WIN_STANDBY 0xE2
    207 #define WIN_SETIDLE1 0xE3
    208 #define WIN_READ_BUFFER 0xE4
    209 #define WIN_CHECKPOWERMODE1 0xE5
    210 #define WIN_SLEEPNOW1 0xE6
    211 #define WIN_FLUSH_CACHE 0xE7
    212 #define WIN_WRITE_BUFFER 0xE8
    213 #define WIN_WRITE_SAME 0xE9
    214 
    215 #define WIN_FLUSH_CACHE_EXT 0xEA
    216 #define WIN_IDENTIFY 0xEC
    217 #define WIN_MEDIAEJECT 0xED
    218 #define WIN_IDENTIFY_DMA 0xEE
    219 #define WIN_SETFEATURES 0xEF
    220 #define EXABYTE_ENABLE_NEST 0xF0
    221 #define WIN_SECURITY_SET_PASS 0xF1
    222 #define WIN_SECURITY_UNLOCK 0xF2
    223 #define WIN_SECURITY_ERASE_PREPARE 0xF3
    224 #define WIN_SECURITY_ERASE_UNIT 0xF4
    225 #define WIN_SECURITY_FREEZE_LOCK 0xF5
    226 #define WIN_SECURITY_DISABLE 0xF6
    227 #define WIN_READ_NATIVE_MAX 0xF8
    228 #define WIN_SET_MAX 0xF9
    229 #define DISABLE_SEAGATE 0xFB
    230 
    231 #define SMART_READ_VALUES 0xD0
    232 #define SMART_READ_THRESHOLDS 0xD1
    233 #define SMART_AUTOSAVE 0xD2
    234 #define SMART_SAVE 0xD3
    235 #define SMART_IMMEDIATE_OFFLINE 0xD4
    236 #define SMART_READ_LOG_SECTOR 0xD5
    237 #define SMART_WRITE_LOG_SECTOR 0xD6
    238 #define SMART_WRITE_THRESHOLDS 0xD7
    239 #define SMART_ENABLE 0xD8
    240 #define SMART_DISABLE 0xD9
    241 #define SMART_STATUS 0xDA
    242 #define SMART_AUTO_OFFLINE 0xDB
    243 
    244 #define SMART_LCYL_PASS 0x4F
    245 #define SMART_HCYL_PASS 0xC2
    246 
    247 #define SETFEATURES_EN_8BIT 0x01
    248 #define SETFEATURES_EN_WCACHE 0x02
    249 #define SETFEATURES_DIS_DEFECT 0x04
    250 #define SETFEATURES_EN_APM 0x05
    251 #define SETFEATURES_EN_SAME_R 0x22
    252 #define SETFEATURES_DIS_MSN 0x31
    253 #define SETFEATURES_DIS_RETRY 0x33
    254 #define SETFEATURES_EN_AAM 0x42
    255 #define SETFEATURES_RW_LONG 0x44
    256 #define SETFEATURES_SET_CACHE 0x54
    257 #define SETFEATURES_DIS_RLA 0x55
    258 #define SETFEATURES_EN_RI 0x5D
    259 #define SETFEATURES_EN_SI 0x5E
    260 #define SETFEATURES_DIS_RPOD 0x66
    261 #define SETFEATURES_DIS_ECC 0x77
    262 #define SETFEATURES_DIS_8BIT 0x81
    263 #define SETFEATURES_DIS_WCACHE 0x82
    264 #define SETFEATURES_EN_DEFECT 0x84
    265 #define SETFEATURES_DIS_APM 0x85
    266 #define SETFEATURES_EN_ECC 0x88
    267 #define SETFEATURES_EN_MSN 0x95
    268 #define SETFEATURES_EN_RETRY 0x99
    269 #define SETFEATURES_EN_RLA 0xAA
    270 #define SETFEATURES_PREFETCH 0xAB
    271 #define SETFEATURES_EN_REST 0xAC
    272 #define SETFEATURES_4B_RW_LONG 0xBB
    273 #define SETFEATURES_DIS_AAM 0xC2
    274 #define SETFEATURES_EN_RPOD 0xCC
    275 #define SETFEATURES_DIS_RI 0xDD
    276 #define SETFEATURES_EN_SAME_M 0xDD
    277 #define SETFEATURES_DIS_SI 0xDE
    278 
    279 #define SECURITY_SET_PASSWORD 0xBA
    280 #define SECURITY_UNLOCK 0xBB
    281 #define SECURITY_ERASE_PREPARE 0xBC
    282 #define SECURITY_ERASE_UNIT 0xBD
    283 #define SECURITY_FREEZE_LOCK 0xBE
    284 #define SECURITY_DISABLE_PASSWORD 0xBF
    285 
    286 struct hd_geometry {
    287  unsigned char heads;
    288  unsigned char sectors;
    289  unsigned short cylinders;
    290  unsigned long start;
    291 };
    292 
    293 #define HDIO_GETGEO 0x0301
    294 #define HDIO_GET_UNMASKINTR 0x0302
    295 #define HDIO_GET_MULTCOUNT 0x0304
    296 #define HDIO_GET_QDMA 0x0305
    297 
    298 #define HDIO_SET_XFER 0x0306
    299 
    300 #define HDIO_OBSOLETE_IDENTITY 0x0307
    301 #define HDIO_GET_KEEPSETTINGS 0x0308
    302 #define HDIO_GET_32BIT 0x0309
    303 #define HDIO_GET_NOWERR 0x030a
    304 #define HDIO_GET_DMA 0x030b
    305 #define HDIO_GET_NICE 0x030c
    306 #define HDIO_GET_IDENTITY 0x030d
    307 #define HDIO_GET_WCACHE 0x030e
    308 #define HDIO_GET_ACOUSTIC 0x030f
    309 #define HDIO_GET_ADDRESS 0x0310
    310 
    311 #define HDIO_GET_BUSSTATE 0x031a
    312 #define HDIO_TRISTATE_HWIF 0x031b
    313 #define HDIO_DRIVE_RESET 0x031c
    314 #define HDIO_DRIVE_TASKFILE 0x031d
    315 #define HDIO_DRIVE_TASK 0x031e
    316 #define HDIO_DRIVE_CMD 0x031f
    317 #define HDIO_DRIVE_CMD_AEB HDIO_DRIVE_TASK
    318 
    319 #define HDIO_SET_MULTCOUNT 0x0321
    320 #define HDIO_SET_UNMASKINTR 0x0322
    321 #define HDIO_SET_KEEPSETTINGS 0x0323
    322 #define HDIO_SET_32BIT 0x0324
    323 #define HDIO_SET_NOWERR 0x0325
    324 #define HDIO_SET_DMA 0x0326
    325 #define HDIO_SET_PIO_MODE 0x0327
    326 #define HDIO_SCAN_HWIF 0x0328
    327 #define HDIO_SET_NICE 0x0329
    328 #define HDIO_UNREGISTER_HWIF 0x032a
    329 #define HDIO_SET_WCACHE 0x032b
    330 #define HDIO_SET_ACOUSTIC 0x032c
    331 #define HDIO_SET_BUSSTATE 0x032d
    332 #define HDIO_SET_QDMA 0x032e
    333 #define HDIO_SET_ADDRESS 0x032f
    334 
    335 enum {
    336  BUSSTATE_OFF = 0,
    337  BUSSTATE_ON,
    338  BUSSTATE_TRISTATE
    339 };
    340 
    341 #define __NEW_HD_DRIVE_ID
    342 
    343 struct hd_driveid {
    344  unsigned short config;
    345  unsigned short cyls;
    346  unsigned short reserved2;
    347  unsigned short heads;
    348  unsigned short track_bytes;
    349  unsigned short sector_bytes;
    350  unsigned short sectors;
    351  unsigned short vendor0;
    352  unsigned short vendor1;
    353  unsigned short vendor2;
    354  unsigned char serial_no[20];
    355  unsigned short buf_type;
    356  unsigned short buf_size;
    357  unsigned short ecc_bytes;
    358  unsigned char fw_rev[8];
    359  unsigned char model[40];
    360  unsigned char max_multsect;
    361  unsigned char vendor3;
    362  unsigned short dword_io;
    363  unsigned char vendor4;
    364  unsigned char capability;
    365  unsigned short reserved50;
    366  unsigned char vendor5;
    367  unsigned char tPIO;
    368  unsigned char vendor6;
    369  unsigned char tDMA;
    370  unsigned short field_valid;
    371  unsigned short cur_cyls;
    372  unsigned short cur_heads;
    373  unsigned short cur_sectors;
    374  unsigned short cur_capacity0;
    375  unsigned short cur_capacity1;
    376  unsigned char multsect;
    377  unsigned char multsect_valid;
    378  unsigned int lba_capacity;
    379  unsigned short dma_1word;
    380  unsigned short dma_mword;
    381  unsigned short eide_pio_modes;
    382  unsigned short eide_dma_min;
    383  unsigned short eide_dma_time;
    384  unsigned short eide_pio;
    385  unsigned short eide_pio_iordy;
    386  unsigned short words69_70[2];
    387 
    388  unsigned short words71_74[4];
    389  unsigned short queue_depth;
    390  unsigned short words76_79[4];
    391  unsigned short major_rev_num;
    392  unsigned short minor_rev_num;
    393  unsigned short command_set_1;
    394  unsigned short command_set_2;
    395  unsigned short cfsse;
    396  unsigned short cfs_enable_1;
    397  unsigned short cfs_enable_2;
    398  unsigned short csf_default;
    399  unsigned short dma_ultra;
    400  unsigned short trseuc;
    401  unsigned short trsEuc;
    402  unsigned short CurAPMvalues;
    403  unsigned short mprc;
    404  unsigned short hw_config;
    405  unsigned short acoustic;
    406  unsigned short msrqs;
    407  unsigned short sxfert;
    408  unsigned short sal;
    409  unsigned int spg;
    410  unsigned long long lba_capacity_2;
    411  unsigned short words104_125[22];
    412  unsigned short last_lun;
    413  unsigned short word127;
    414  unsigned short dlf;
    415  unsigned short csfo;
    416  unsigned short words130_155[26];
    417  unsigned short word156;
    418  unsigned short words157_159[3];
    419  unsigned short cfa_power;
    420  unsigned short words161_175[15];
    421  unsigned short words176_205[30];
    422  unsigned short words206_254[49];
    423  unsigned short integrity_word;
    424 };
    425 
    426 #define IDE_NICE_DSC_OVERLAP (0)
    427 #define IDE_NICE_ATAPI_OVERLAP (1)
    428 #define IDE_NICE_0 (2)
    429 #define IDE_NICE_1 (3)
    430 #define IDE_NICE_2 (4)
    431 
    432 #endif
    433