0001
0002 #ifndef _LINUX_HDREG_H
0003 #define _LINUX_HDREG_H
0004
0005 #include <linux/types.h>
0006
0007
0008
0009
0010
0011 #define HDIO_DRIVE_CMD_HDR_SIZE (4 * sizeof(__u8))
0012 #define HDIO_DRIVE_HOB_HDR_SIZE (8 * sizeof(__u8))
0013 #define HDIO_DRIVE_TASK_HDR_SIZE (8 * sizeof(__u8))
0014
0015 #define IDE_DRIVE_TASK_NO_DATA 0
0016 #ifndef __KERNEL__
0017 #define IDE_DRIVE_TASK_INVALID -1
0018 #define IDE_DRIVE_TASK_SET_XFER 1
0019 #define IDE_DRIVE_TASK_IN 2
0020 #define IDE_DRIVE_TASK_OUT 3
0021 #endif
0022 #define IDE_DRIVE_TASK_RAW_WRITE 4
0023
0024
0025
0026
0027 #define IDE_TASKFILE_STD_IN_FLAGS 0xFE
0028 #define IDE_HOB_STD_IN_FLAGS 0x3C
0029 #ifndef __KERNEL__
0030 #define IDE_TASKFILE_STD_OUT_FLAGS 0xFE
0031 #define IDE_HOB_STD_OUT_FLAGS 0x3C
0032
0033 typedef unsigned char task_ioreg_t;
0034 typedef unsigned long sata_ioreg_t;
0035 #endif
0036
0037 typedef union ide_reg_valid_s {
0038 unsigned all : 16;
0039 struct {
0040 unsigned data : 1;
0041 unsigned error_feature : 1;
0042 unsigned sector : 1;
0043 unsigned nsector : 1;
0044 unsigned lcyl : 1;
0045 unsigned hcyl : 1;
0046 unsigned select : 1;
0047 unsigned status_command : 1;
0048
0049 unsigned data_hob : 1;
0050 unsigned error_feature_hob : 1;
0051 unsigned sector_hob : 1;
0052 unsigned nsector_hob : 1;
0053 unsigned lcyl_hob : 1;
0054 unsigned hcyl_hob : 1;
0055 unsigned select_hob : 1;
0056 unsigned control_hob : 1;
0057 } b;
0058 } ide_reg_valid_t;
0059
0060 typedef struct ide_task_request_s {
0061 __u8 io_ports[8];
0062 __u8 hob_ports[8];
0063 ide_reg_valid_t out_flags;
0064 ide_reg_valid_t in_flags;
0065 int data_phase;
0066 int req_cmd;
0067 unsigned long out_size;
0068 unsigned long in_size;
0069 } ide_task_request_t;
0070
0071 typedef struct ide_ioctl_request_s {
0072 ide_task_request_t *task_request;
0073 unsigned char *out_buffer;
0074 unsigned char *in_buffer;
0075 } ide_ioctl_request_t;
0076
0077 struct hd_drive_cmd_hdr {
0078 __u8 command;
0079 __u8 sector_number;
0080 __u8 feature;
0081 __u8 sector_count;
0082 };
0083
0084 #ifndef __KERNEL__
0085 typedef struct hd_drive_task_hdr {
0086 __u8 data;
0087 __u8 feature;
0088 __u8 sector_count;
0089 __u8 sector_number;
0090 __u8 low_cylinder;
0091 __u8 high_cylinder;
0092 __u8 device_head;
0093 __u8 command;
0094 } task_struct_t;
0095
0096 typedef struct hd_drive_hob_hdr {
0097 __u8 data;
0098 __u8 feature;
0099 __u8 sector_count;
0100 __u8 sector_number;
0101 __u8 low_cylinder;
0102 __u8 high_cylinder;
0103 __u8 device_head;
0104 __u8 control;
0105 } hob_struct_t;
0106 #endif
0107
0108 #define TASKFILE_NO_DATA 0x0000
0109
0110 #define TASKFILE_IN 0x0001
0111 #define TASKFILE_MULTI_IN 0x0002
0112
0113 #define TASKFILE_OUT 0x0004
0114 #define TASKFILE_MULTI_OUT 0x0008
0115 #define TASKFILE_IN_OUT 0x0010
0116
0117 #define TASKFILE_IN_DMA 0x0020
0118 #define TASKFILE_OUT_DMA 0x0040
0119 #define TASKFILE_IN_DMAQ 0x0080
0120 #define TASKFILE_OUT_DMAQ 0x0100
0121
0122 #ifndef __KERNEL__
0123 #define TASKFILE_P_IN 0x0200
0124 #define TASKFILE_P_OUT 0x0400
0125 #define TASKFILE_P_IN_DMA 0x0800
0126 #define TASKFILE_P_OUT_DMA 0x1000
0127 #define TASKFILE_P_IN_DMAQ 0x2000
0128 #define TASKFILE_P_OUT_DMAQ 0x4000
0129 #define TASKFILE_48 0x8000
0130 #define TASKFILE_INVALID 0x7fff
0131 #endif
0132
0133 #ifndef __KERNEL__
0134
0135 #define WIN_NOP 0x00
0136
0137
0138
0139 #define CFA_REQ_EXT_ERROR_CODE 0x03
0140
0141
0142
0143 #define WIN_SRST 0x08
0144 #define WIN_DEVICE_RESET 0x08
0145
0146
0147
0148 #define WIN_RECAL 0x10
0149 #define WIN_RESTORE WIN_RECAL
0150
0151
0152
0153 #define WIN_READ 0x20
0154 #define WIN_READ_ONCE 0x21
0155 #define WIN_READ_LONG 0x22
0156 #define WIN_READ_LONG_ONCE 0x23
0157 #define WIN_READ_EXT 0x24
0158 #define WIN_READDMA_EXT 0x25
0159 #define WIN_READDMA_QUEUED_EXT 0x26
0160 #define WIN_READ_NATIVE_MAX_EXT 0x27
0161
0162
0163
0164 #define WIN_MULTREAD_EXT 0x29
0165
0166
0167
0168 #define WIN_WRITE 0x30
0169 #define WIN_WRITE_ONCE 0x31
0170 #define WIN_WRITE_LONG 0x32
0171 #define WIN_WRITE_LONG_ONCE 0x33
0172 #define WIN_WRITE_EXT 0x34
0173 #define WIN_WRITEDMA_EXT 0x35
0174 #define WIN_WRITEDMA_QUEUED_EXT 0x36
0175 #define WIN_SET_MAX_EXT 0x37
0176 #define CFA_WRITE_SECT_WO_ERASE 0x38
0177 #define WIN_MULTWRITE_EXT 0x39
0178
0179
0180
0181 #define WIN_WRITE_VERIFY 0x3C
0182
0183
0184
0185 #define WIN_VERIFY 0x40
0186 #define WIN_VERIFY_ONCE 0x41
0187 #define WIN_VERIFY_EXT 0x42
0188
0189
0190
0191 #define WIN_FORMAT 0x50
0192
0193
0194
0195 #define WIN_INIT 0x60
0196
0197
0198
0199 #define WIN_SEEK 0x70
0200
0201 #define CFA_TRANSLATE_SECTOR 0x87
0202 #define WIN_DIAGNOSE 0x90
0203 #define WIN_SPECIFY 0x91
0204 #define WIN_DOWNLOAD_MICROCODE 0x92
0205 #define WIN_STANDBYNOW2 0x94
0206 #define WIN_STANDBY2 0x96
0207 #define WIN_SETIDLE2 0x97
0208 #define WIN_CHECKPOWERMODE2 0x98
0209 #define WIN_SLEEPNOW2 0x99
0210
0211
0212
0213 #define WIN_PACKETCMD 0xA0
0214 #define WIN_PIDENTIFY 0xA1
0215 #define WIN_QUEUED_SERVICE 0xA2
0216 #define WIN_SMART 0xB0
0217 #define CFA_ERASE_SECTORS 0xC0
0218 #define WIN_MULTREAD 0xC4
0219 #define WIN_MULTWRITE 0xC5
0220 #define WIN_SETMULT 0xC6
0221 #define WIN_READDMA_QUEUED 0xC7
0222 #define WIN_READDMA 0xC8
0223 #define WIN_READDMA_ONCE 0xC9
0224 #define WIN_WRITEDMA 0xCA
0225 #define WIN_WRITEDMA_ONCE 0xCB
0226 #define WIN_WRITEDMA_QUEUED 0xCC
0227 #define CFA_WRITE_MULTI_WO_ERASE 0xCD
0228 #define WIN_GETMEDIASTATUS 0xDA
0229 #define WIN_ACKMEDIACHANGE 0xDB
0230 #define WIN_POSTBOOT 0xDC
0231 #define WIN_PREBOOT 0xDD
0232 #define WIN_DOORLOCK 0xDE
0233 #define WIN_DOORUNLOCK 0xDF
0234 #define WIN_STANDBYNOW1 0xE0
0235 #define WIN_IDLEIMMEDIATE 0xE1
0236 #define WIN_STANDBY 0xE2
0237 #define WIN_SETIDLE1 0xE3
0238 #define WIN_READ_BUFFER 0xE4
0239 #define WIN_CHECKPOWERMODE1 0xE5
0240 #define WIN_SLEEPNOW1 0xE6
0241 #define WIN_FLUSH_CACHE 0xE7
0242 #define WIN_WRITE_BUFFER 0xE8
0243 #define WIN_WRITE_SAME 0xE9
0244
0245 #define WIN_FLUSH_CACHE_EXT 0xEA
0246 #define WIN_IDENTIFY 0xEC
0247 #define WIN_MEDIAEJECT 0xED
0248 #define WIN_IDENTIFY_DMA 0xEE
0249 #define WIN_SETFEATURES 0xEF
0250 #define EXABYTE_ENABLE_NEST 0xF0
0251 #define WIN_SECURITY_SET_PASS 0xF1
0252 #define WIN_SECURITY_UNLOCK 0xF2
0253 #define WIN_SECURITY_ERASE_PREPARE 0xF3
0254 #define WIN_SECURITY_ERASE_UNIT 0xF4
0255 #define WIN_SECURITY_FREEZE_LOCK 0xF5
0256 #define WIN_SECURITY_DISABLE 0xF6
0257 #define WIN_READ_NATIVE_MAX 0xF8
0258 #define WIN_SET_MAX 0xF9
0259 #define DISABLE_SEAGATE 0xFB
0260
0261
0262
0263 #define SMART_READ_VALUES 0xD0
0264 #define SMART_READ_THRESHOLDS 0xD1
0265 #define SMART_AUTOSAVE 0xD2
0266 #define SMART_SAVE 0xD3
0267 #define SMART_IMMEDIATE_OFFLINE 0xD4
0268 #define SMART_READ_LOG_SECTOR 0xD5
0269 #define SMART_WRITE_LOG_SECTOR 0xD6
0270 #define SMART_WRITE_THRESHOLDS 0xD7
0271 #define SMART_ENABLE 0xD8
0272 #define SMART_DISABLE 0xD9
0273 #define SMART_STATUS 0xDA
0274 #define SMART_AUTO_OFFLINE 0xDB
0275
0276
0277
0278 #define SMART_LCYL_PASS 0x4F
0279 #define SMART_HCYL_PASS 0xC2
0280
0281
0282 #define SETFEATURES_EN_8BIT 0x01
0283 #define SETFEATURES_EN_WCACHE 0x02
0284 #define SETFEATURES_DIS_DEFECT 0x04
0285 #define SETFEATURES_EN_APM 0x05
0286 #define SETFEATURES_EN_SAME_R 0x22
0287 #define SETFEATURES_DIS_MSN 0x31
0288 #define SETFEATURES_DIS_RETRY 0x33
0289 #define SETFEATURES_EN_AAM 0x42
0290 #define SETFEATURES_RW_LONG 0x44
0291 #define SETFEATURES_SET_CACHE 0x54
0292 #define SETFEATURES_DIS_RLA 0x55
0293 #define SETFEATURES_EN_RI 0x5D
0294 #define SETFEATURES_EN_SI 0x5E
0295 #define SETFEATURES_DIS_RPOD 0x66
0296 #define SETFEATURES_DIS_ECC 0x77
0297 #define SETFEATURES_DIS_8BIT 0x81
0298 #define SETFEATURES_DIS_WCACHE 0x82
0299 #define SETFEATURES_EN_DEFECT 0x84
0300 #define SETFEATURES_DIS_APM 0x85
0301 #define SETFEATURES_EN_ECC 0x88
0302 #define SETFEATURES_EN_MSN 0x95
0303 #define SETFEATURES_EN_RETRY 0x99
0304 #define SETFEATURES_EN_RLA 0xAA
0305 #define SETFEATURES_PREFETCH 0xAB
0306 #define SETFEATURES_EN_REST 0xAC
0307 #define SETFEATURES_4B_RW_LONG 0xBB
0308 #define SETFEATURES_DIS_AAM 0xC2
0309 #define SETFEATURES_EN_RPOD 0xCC
0310 #define SETFEATURES_DIS_RI 0xDD
0311 #define SETFEATURES_EN_SAME_M 0xDD
0312 #define SETFEATURES_DIS_SI 0xDE
0313
0314
0315
0316 #define SECURITY_SET_PASSWORD 0xBA
0317 #define SECURITY_UNLOCK 0xBB
0318 #define SECURITY_ERASE_PREPARE 0xBC
0319 #define SECURITY_ERASE_UNIT 0xBD
0320 #define SECURITY_FREEZE_LOCK 0xBE
0321 #define SECURITY_DISABLE_PASSWORD 0xBF
0322 #endif
0323
0324 struct hd_geometry {
0325 unsigned char heads;
0326 unsigned char sectors;
0327 unsigned short cylinders;
0328 unsigned long start;
0329 };
0330
0331
0332 #define HDIO_GETGEO 0x0301
0333 #define HDIO_GET_UNMASKINTR 0x0302
0334 #define HDIO_GET_MULTCOUNT 0x0304
0335 #define HDIO_GET_QDMA 0x0305
0336
0337 #define HDIO_SET_XFER 0x0306
0338
0339 #define HDIO_OBSOLETE_IDENTITY 0x0307
0340 #define HDIO_GET_KEEPSETTINGS 0x0308
0341 #define HDIO_GET_32BIT 0x0309
0342 #define HDIO_GET_NOWERR 0x030a
0343 #define HDIO_GET_DMA 0x030b
0344 #define HDIO_GET_NICE 0x030c
0345 #define HDIO_GET_IDENTITY 0x030d
0346 #define HDIO_GET_WCACHE 0x030e
0347 #define HDIO_GET_ACOUSTIC 0x030f
0348 #define HDIO_GET_ADDRESS 0x0310
0349
0350 #define HDIO_GET_BUSSTATE 0x031a
0351 #define HDIO_TRISTATE_HWIF 0x031b
0352 #define HDIO_DRIVE_RESET 0x031c
0353 #define HDIO_DRIVE_TASKFILE 0x031d
0354 #define HDIO_DRIVE_TASK 0x031e
0355 #define HDIO_DRIVE_CMD 0x031f
0356 #define HDIO_DRIVE_CMD_AEB HDIO_DRIVE_TASK
0357
0358
0359 #define HDIO_SET_MULTCOUNT 0x0321
0360 #define HDIO_SET_UNMASKINTR 0x0322
0361 #define HDIO_SET_KEEPSETTINGS 0x0323
0362 #define HDIO_SET_32BIT 0x0324
0363 #define HDIO_SET_NOWERR 0x0325
0364 #define HDIO_SET_DMA 0x0326
0365 #define HDIO_SET_PIO_MODE 0x0327
0366 #ifndef __KERNEL__
0367 #define HDIO_SCAN_HWIF 0x0328
0368 #define HDIO_UNREGISTER_HWIF 0x032a
0369 #endif
0370 #define HDIO_SET_NICE 0x0329
0371 #define HDIO_SET_WCACHE 0x032b
0372 #define HDIO_SET_ACOUSTIC 0x032c
0373 #define HDIO_SET_BUSSTATE 0x032d
0374 #define HDIO_SET_QDMA 0x032e
0375 #define HDIO_SET_ADDRESS 0x032f
0376
0377
0378 enum {
0379 BUSSTATE_OFF = 0,
0380 BUSSTATE_ON,
0381 BUSSTATE_TRISTATE
0382 };
0383
0384
0385
0386
0387
0388
0389
0390 #define __NEW_HD_DRIVE_ID
0391
0392 #ifndef __KERNEL__
0393
0394
0395
0396
0397
0398
0399 struct hd_driveid {
0400 unsigned short config;
0401 unsigned short cyls;
0402 unsigned short reserved2;
0403 unsigned short heads;
0404 unsigned short track_bytes;
0405 unsigned short sector_bytes;
0406 unsigned short sectors;
0407 unsigned short vendor0;
0408 unsigned short vendor1;
0409 unsigned short vendor2;
0410 unsigned char serial_no[20];
0411 unsigned short buf_type;
0412 unsigned short buf_size;
0413
0414
0415 unsigned short ecc_bytes;
0416 unsigned char fw_rev[8];
0417 unsigned char model[40];
0418 unsigned char max_multsect;
0419 unsigned char vendor3;
0420 unsigned short dword_io;
0421 unsigned char vendor4;
0422 unsigned char capability;
0423
0424
0425
0426
0427
0428 unsigned short reserved50;
0429 unsigned char vendor5;
0430 unsigned char tPIO;
0431 unsigned char vendor6;
0432 unsigned char tDMA;
0433 unsigned short field_valid;
0434
0435
0436
0437
0438 unsigned short cur_cyls;
0439 unsigned short cur_heads;
0440 unsigned short cur_sectors;
0441 unsigned short cur_capacity0;
0442 unsigned short cur_capacity1;
0443 unsigned char multsect;
0444 unsigned char multsect_valid;
0445 unsigned int lba_capacity;
0446 unsigned short dma_1word;
0447 unsigned short dma_mword;
0448 unsigned short eide_pio_modes;
0449 unsigned short eide_dma_min;
0450 unsigned short eide_dma_time;
0451 unsigned short eide_pio;
0452 unsigned short eide_pio_iordy;
0453 unsigned short words69_70[2];
0454
0455
0456 unsigned short words71_74[4];
0457
0458
0459 unsigned short queue_depth;
0460
0461
0462
0463 unsigned short words76_79[4];
0464 unsigned short major_rev_num;
0465 unsigned short minor_rev_num;
0466 unsigned short command_set_1;
0467
0468
0469
0470
0471
0472
0473
0474
0475
0476
0477
0478
0479
0480
0481
0482
0483
0484 unsigned short command_set_2;
0485
0486
0487
0488
0489
0490
0491
0492
0493
0494
0495
0496
0497
0498
0499
0500
0501
0502 unsigned short cfsse;
0503
0504
0505
0506
0507
0508
0509
0510
0511
0512
0513
0514 unsigned short cfs_enable_1;
0515
0516
0517
0518
0519
0520
0521
0522
0523
0524
0525
0526
0527
0528
0529
0530
0531
0532
0533 unsigned short cfs_enable_2;
0534
0535
0536
0537
0538
0539
0540
0541
0542
0543
0544
0545
0546
0547
0548
0549
0550
0551
0552 unsigned short csf_default;
0553
0554
0555
0556
0557
0558
0559
0560
0561
0562
0563
0564 unsigned short dma_ultra;
0565 unsigned short trseuc;
0566 unsigned short trsEuc;
0567 unsigned short CurAPMvalues;
0568 unsigned short mprc;
0569 unsigned short hw_config;
0570
0571
0572
0573
0574
0575
0576
0577
0578
0579
0580
0581
0582
0583
0584
0585
0586
0587 unsigned short acoustic;
0588
0589
0590
0591 unsigned short msrqs;
0592 unsigned short sxfert;
0593 unsigned short sal;
0594 unsigned int spg;
0595 unsigned long long lba_capacity_2;
0596 unsigned short words104_125[22];
0597 unsigned short last_lun;
0598 unsigned short word127;
0599
0600
0601
0602
0603
0604
0605
0606 unsigned short dlf;
0607
0608
0609
0610
0611
0612
0613
0614
0615
0616
0617
0618 unsigned short csfo;
0619
0620
0621
0622
0623
0624
0625
0626 unsigned short words130_155[26];
0627 unsigned short word156;
0628 unsigned short words157_159[3];
0629 unsigned short cfa_power;
0630
0631
0632
0633
0634
0635
0636 unsigned short words161_175[15];
0637 unsigned short words176_205[30];
0638 unsigned short words206_254[49];
0639 unsigned short integrity_word;
0640
0641
0642
0643 };
0644 #endif
0645
0646
0647
0648
0649
0650
0651 #define IDE_NICE_DSC_OVERLAP (0)
0652 #define IDE_NICE_ATAPI_OVERLAP (1)
0653 #define IDE_NICE_1 (3)
0654 #ifndef __KERNEL__
0655 #define IDE_NICE_0 (2)
0656 #define IDE_NICE_2 (4)
0657 #endif
0658
0659 #endif