hdreg.h
001: #ifndef _LINUX_HDREG_H
002: #define _LINUX_HDREG_H
003:
004: #include <linux/types.h>
005:
006:
007:
008:
009:
010: #define HDIO_DRIVE_CMD_HDR_SIZE (4 * sizeof(__u8))
011: #define HDIO_DRIVE_HOB_HDR_SIZE (8 * sizeof(__u8))
012: #define HDIO_DRIVE_TASK_HDR_SIZE (8 * sizeof(__u8))
013:
014: #define IDE_DRIVE_TASK_NO_DATA 0
015: #define IDE_DRIVE_TASK_INVALID -1
016: #define IDE_DRIVE_TASK_SET_XFER 1
017: #define IDE_DRIVE_TASK_IN 2
018: #define IDE_DRIVE_TASK_OUT 3
019: #define IDE_DRIVE_TASK_RAW_WRITE 4
020:
021:
022:
023:
024: #define IDE_TASKFILE_STD_IN_FLAGS 0xFE
025: #define IDE_HOB_STD_IN_FLAGS 0x3C
026: #define IDE_TASKFILE_STD_OUT_FLAGS 0xFE
027: #define IDE_HOB_STD_OUT_FLAGS 0x3C
028:
029: typedef unsigned char task_ioreg_t;
030: typedef unsigned long sata_ioreg_t;
031:
032: typedef union ide_reg_valid_s {
033: unsigned all : 16;
034: struct {
035: unsigned data : 1;
036: unsigned error_feature : 1;
037: unsigned sector : 1;
038: unsigned nsector : 1;
039: unsigned lcyl : 1;
040: unsigned hcyl : 1;
041: unsigned select : 1;
042: unsigned status_command : 1;
043:
044: unsigned data_hob : 1;
045: unsigned error_feature_hob : 1;
046: unsigned sector_hob : 1;
047: unsigned nsector_hob : 1;
048: unsigned lcyl_hob : 1;
049: unsigned hcyl_hob : 1;
050: unsigned select_hob : 1;
051: unsigned control_hob : 1;
052: } b;
053: } ide_reg_valid_t;
054:
055: typedef struct ide_task_request_s {
056: __u8 io_ports[8];
057: __u8 hob_ports[8];
058: ide_reg_valid_t out_flags;
059: ide_reg_valid_t in_flags;
060: int data_phase;
061: int req_cmd;
062: unsigned long out_size;
063: unsigned long in_size;
064: } ide_task_request_t;
065:
066: typedef struct ide_ioctl_request_s {
067: ide_task_request_t *task_request;
068: unsigned char *out_buffer;
069: unsigned char *in_buffer;
070: } ide_ioctl_request_t;
071:
072: struct hd_drive_cmd_hdr {
073: __u8 command;
074: __u8 sector_number;
075: __u8 feature;
076: __u8 sector_count;
077: };
078:
079: typedef struct hd_drive_task_hdr {
080: __u8 data;
081: __u8 feature;
082: __u8 sector_count;
083: __u8 sector_number;
084: __u8 low_cylinder;
085: __u8 high_cylinder;
086: __u8 device_head;
087: __u8 command;
088: } task_struct_t;
089:
090: typedef struct hd_drive_hob_hdr {
091: __u8 data;
092: __u8 feature;
093: __u8 sector_count;
094: __u8 sector_number;
095: __u8 low_cylinder;
096: __u8 high_cylinder;
097: __u8 device_head;
098: __u8 control;
099: } hob_struct_t;
100:
101: #define TASKFILE_NO_DATA 0x0000
102:
103: #define TASKFILE_IN 0x0001
104: #define TASKFILE_MULTI_IN 0x0002
105:
106: #define TASKFILE_OUT 0x0004
107: #define TASKFILE_MULTI_OUT 0x0008
108: #define TASKFILE_IN_OUT 0x0010
109:
110: #define TASKFILE_IN_DMA 0x0020
111: #define TASKFILE_OUT_DMA 0x0040
112: #define TASKFILE_IN_DMAQ 0x0080
113: #define TASKFILE_OUT_DMAQ 0x0100
114:
115: #define TASKFILE_P_IN 0x0200
116: #define TASKFILE_P_OUT 0x0400
117: #define TASKFILE_P_IN_DMA 0x0800
118: #define TASKFILE_P_OUT_DMA 0x1000
119: #define TASKFILE_P_IN_DMAQ 0x2000
120: #define TASKFILE_P_OUT_DMAQ 0x4000
121: #define TASKFILE_48 0x8000
122: #define TASKFILE_INVALID 0x7fff
123:
124:
125: #define WIN_NOP 0x00
126:
127:
128:
129: #define CFA_REQ_EXT_ERROR_CODE 0x03
130:
131:
132:
133: #define WIN_SRST 0x08
134: #define WIN_DEVICE_RESET 0x08
135:
136:
137:
138: #define WIN_RECAL 0x10
139: #define WIN_RESTORE WIN_RECAL
140:
141:
142:
143: #define WIN_READ 0x20
144: #define WIN_READ_ONCE 0x21
145: #define WIN_READ_LONG 0x22
146: #define WIN_READ_LONG_ONCE 0x23
147: #define WIN_READ_EXT 0x24
148: #define WIN_READDMA_EXT 0x25
149: #define WIN_READDMA_QUEUED_EXT 0x26
150: #define WIN_READ_NATIVE_MAX_EXT 0x27
151:
152:
153:
154: #define WIN_MULTREAD_EXT 0x29
155:
156:
157:
158: #define WIN_WRITE 0x30
159: #define WIN_WRITE_ONCE 0x31
160: #define WIN_WRITE_LONG 0x32
161: #define WIN_WRITE_LONG_ONCE 0x33
162: #define WIN_WRITE_EXT 0x34
163: #define WIN_WRITEDMA_EXT 0x35
164: #define WIN_WRITEDMA_QUEUED_EXT 0x36
165: #define WIN_SET_MAX_EXT 0x37
166: #define CFA_WRITE_SECT_WO_ERASE 0x38
167: #define WIN_MULTWRITE_EXT 0x39
168:
169:
170:
171: #define WIN_WRITE_VERIFY 0x3C
172:
173:
174:
175: #define WIN_VERIFY 0x40
176: #define WIN_VERIFY_ONCE 0x41
177: #define WIN_VERIFY_EXT 0x42
178:
179:
180:
181: #define WIN_FORMAT 0x50
182:
183:
184:
185: #define WIN_INIT 0x60
186:
187:
188:
189: #define WIN_SEEK 0x70
190:
191: #define CFA_TRANSLATE_SECTOR 0x87
192: #define WIN_DIAGNOSE 0x90
193: #define WIN_SPECIFY 0x91
194: #define WIN_DOWNLOAD_MICROCODE 0x92
195: #define WIN_STANDBYNOW2 0x94
196: #define WIN_STANDBY2 0x96
197: #define WIN_SETIDLE2 0x97
198: #define WIN_CHECKPOWERMODE2 0x98
199: #define WIN_SLEEPNOW2 0x99
200:
201:
202:
203: #define WIN_PACKETCMD 0xA0
204: #define WIN_PIDENTIFY 0xA1
205: #define WIN_QUEUED_SERVICE 0xA2
206: #define WIN_SMART 0xB0
207: #define CFA_ERASE_SECTORS 0xC0
208: #define WIN_MULTREAD 0xC4
209: #define WIN_MULTWRITE 0xC5
210: #define WIN_SETMULT 0xC6
211: #define WIN_READDMA_QUEUED 0xC7
212: #define WIN_READDMA 0xC8
213: #define WIN_READDMA_ONCE 0xC9
214: #define WIN_WRITEDMA 0xCA
215: #define WIN_WRITEDMA_ONCE 0xCB
216: #define WIN_WRITEDMA_QUEUED 0xCC
217: #define CFA_WRITE_MULTI_WO_ERASE 0xCD
218: #define WIN_GETMEDIASTATUS 0xDA
219: #define WIN_ACKMEDIACHANGE 0xDB
220: #define WIN_POSTBOOT 0xDC
221: #define WIN_PREBOOT 0xDD
222: #define WIN_DOORLOCK 0xDE
223: #define WIN_DOORUNLOCK 0xDF
224: #define WIN_STANDBYNOW1 0xE0
225: #define WIN_IDLEIMMEDIATE 0xE1
226: #define WIN_STANDBY 0xE2
227: #define WIN_SETIDLE1 0xE3
228: #define WIN_READ_BUFFER 0xE4
229: #define WIN_CHECKPOWERMODE1 0xE5
230: #define WIN_SLEEPNOW1 0xE6
231: #define WIN_FLUSH_CACHE 0xE7
232: #define WIN_WRITE_BUFFER 0xE8
233: #define WIN_WRITE_SAME 0xE9
234:
235: #define WIN_FLUSH_CACHE_EXT 0xEA
236: #define WIN_IDENTIFY 0xEC
237: #define WIN_MEDIAEJECT 0xED
238: #define WIN_IDENTIFY_DMA 0xEE
239: #define WIN_SETFEATURES 0xEF
240: #define EXABYTE_ENABLE_NEST 0xF0
241: #define WIN_SECURITY_SET_PASS 0xF1
242: #define WIN_SECURITY_UNLOCK 0xF2
243: #define WIN_SECURITY_ERASE_PREPARE 0xF3
244: #define WIN_SECURITY_ERASE_UNIT 0xF4
245: #define WIN_SECURITY_FREEZE_LOCK 0xF5
246: #define WIN_SECURITY_DISABLE 0xF6
247: #define WIN_READ_NATIVE_MAX 0xF8
248: #define WIN_SET_MAX 0xF9
249: #define DISABLE_SEAGATE 0xFB
250:
251:
252:
253: #define SMART_READ_VALUES 0xD0
254: #define SMART_READ_THRESHOLDS 0xD1
255: #define SMART_AUTOSAVE 0xD2
256: #define SMART_SAVE 0xD3
257: #define SMART_IMMEDIATE_OFFLINE 0xD4
258: #define SMART_READ_LOG_SECTOR 0xD5
259: #define SMART_WRITE_LOG_SECTOR 0xD6
260: #define SMART_WRITE_THRESHOLDS 0xD7
261: #define SMART_ENABLE 0xD8
262: #define SMART_DISABLE 0xD9
263: #define SMART_STATUS 0xDA
264: #define SMART_AUTO_OFFLINE 0xDB
265:
266:
267:
268: #define SMART_LCYL_PASS 0x4F
269: #define SMART_HCYL_PASS 0xC2
270:
271:
272: #define SETFEATURES_EN_8BIT 0x01
273: #define SETFEATURES_EN_WCACHE 0x02
274: #define SETFEATURES_DIS_DEFECT 0x04
275: #define SETFEATURES_EN_APM 0x05
276: #define SETFEATURES_EN_SAME_R 0x22
277: #define SETFEATURES_DIS_MSN 0x31
278: #define SETFEATURES_DIS_RETRY 0x33
279: #define SETFEATURES_EN_AAM 0x42
280: #define SETFEATURES_RW_LONG 0x44
281: #define SETFEATURES_SET_CACHE 0x54
282: #define SETFEATURES_DIS_RLA 0x55
283: #define SETFEATURES_EN_RI 0x5D
284: #define SETFEATURES_EN_SI 0x5E
285: #define SETFEATURES_DIS_RPOD 0x66
286: #define SETFEATURES_DIS_ECC 0x77
287: #define SETFEATURES_DIS_8BIT 0x81
288: #define SETFEATURES_DIS_WCACHE 0x82
289: #define SETFEATURES_EN_DEFECT 0x84
290: #define SETFEATURES_DIS_APM 0x85
291: #define SETFEATURES_EN_ECC 0x88
292: #define SETFEATURES_EN_MSN 0x95
293: #define SETFEATURES_EN_RETRY 0x99
294: #define SETFEATURES_EN_RLA 0xAA
295: #define SETFEATURES_PREFETCH 0xAB
296: #define SETFEATURES_EN_REST 0xAC
297: #define SETFEATURES_4B_RW_LONG 0xBB
298: #define SETFEATURES_DIS_AAM 0xC2
299: #define SETFEATURES_EN_RPOD 0xCC
300: #define SETFEATURES_DIS_RI 0xDD
301: #define SETFEATURES_EN_SAME_M 0xDD
302: #define SETFEATURES_DIS_SI 0xDE
303:
304:
305:
306: #define SECURITY_SET_PASSWORD 0xBA
307: #define SECURITY_UNLOCK 0xBB
308: #define SECURITY_ERASE_PREPARE 0xBC
309: #define SECURITY_ERASE_UNIT 0xBD
310: #define SECURITY_FREEZE_LOCK 0xBE
311: #define SECURITY_DISABLE_PASSWORD 0xBF
312:
313: struct hd_geometry {
314: unsigned char heads;
315: unsigned char sectors;
316: unsigned short cylinders;
317: unsigned long start;
318: };
319:
320:
321: #define HDIO_GETGEO 0x0301
322: #define HDIO_GET_UNMASKINTR 0x0302
323: #define HDIO_GET_MULTCOUNT 0x0304
324: #define HDIO_GET_QDMA 0x0305
325:
326: #define HDIO_SET_XFER 0x0306
327:
328: #define HDIO_OBSOLETE_IDENTITY 0x0307
329: #define HDIO_GET_KEEPSETTINGS 0x0308
330: #define HDIO_GET_32BIT 0x0309
331: #define HDIO_GET_NOWERR 0x030a
332: #define HDIO_GET_DMA 0x030b
333: #define HDIO_GET_NICE 0x030c
334: #define HDIO_GET_IDENTITY 0x030d
335: #define HDIO_GET_WCACHE 0x030e
336: #define HDIO_GET_ACOUSTIC 0x030f
337: #define HDIO_GET_ADDRESS 0x0310
338:
339: #define HDIO_GET_BUSSTATE 0x031a
340: #define HDIO_TRISTATE_HWIF 0x031b
341: #define HDIO_DRIVE_RESET 0x031c
342: #define HDIO_DRIVE_TASKFILE 0x031d
343: #define HDIO_DRIVE_TASK 0x031e
344: #define HDIO_DRIVE_CMD 0x031f
345: #define HDIO_DRIVE_CMD_AEB HDIO_DRIVE_TASK
346:
347:
348: #define HDIO_SET_MULTCOUNT 0x0321
349: #define HDIO_SET_UNMASKINTR 0x0322
350: #define HDIO_SET_KEEPSETTINGS 0x0323
351: #define HDIO_SET_32BIT 0x0324
352: #define HDIO_SET_NOWERR 0x0325
353: #define HDIO_SET_DMA 0x0326
354: #define HDIO_SET_PIO_MODE 0x0327
355: #define HDIO_SCAN_HWIF 0x0328
356: #define HDIO_UNREGISTER_HWIF 0x032a
357: #define HDIO_SET_NICE 0x0329
358: #define HDIO_SET_WCACHE 0x032b
359: #define HDIO_SET_ACOUSTIC 0x032c
360: #define HDIO_SET_BUSSTATE 0x032d
361: #define HDIO_SET_QDMA 0x032e
362: #define HDIO_SET_ADDRESS 0x032f
363:
364:
365: enum {
366: BUSSTATE_OFF = 0,
367: BUSSTATE_ON,
368: BUSSTATE_TRISTATE
369: };
370:
371:
372:
373:
374:
375:
376:
377: #define __NEW_HD_DRIVE_ID
378:
379:
380:
381:
382:
383:
384:
385: struct hd_driveid {
386: unsigned short config;
387: unsigned short cyls;
388: unsigned short reserved2;
389: unsigned short heads;
390: unsigned short track_bytes;
391: unsigned short sector_bytes;
392: unsigned short sectors;
393: unsigned short vendor0;
394: unsigned short vendor1;
395: unsigned short vendor2;
396: unsigned char serial_no[20];
397: unsigned short buf_type;
398: unsigned short buf_size;
399:
400:
401: unsigned short ecc_bytes;
402: unsigned char fw_rev[8];
403: unsigned char model[40];
404: unsigned char max_multsect;
405: unsigned char vendor3;
406: unsigned short dword_io;
407: unsigned char vendor4;
408: unsigned char capability;
409:
410:
411:
412:
413:
414: unsigned short reserved50;
415: unsigned char vendor5;
416: unsigned char tPIO;
417: unsigned char vendor6;
418: unsigned char tDMA;
419: unsigned short field_valid;
420:
421:
422:
423:
424: unsigned short cur_cyls;
425: unsigned short cur_heads;
426: unsigned short cur_sectors;
427: unsigned short cur_capacity0;
428: unsigned short cur_capacity1;
429: unsigned char multsect;
430: unsigned char multsect_valid;
431: unsigned int lba_capacity;
432: unsigned short dma_1word;
433: unsigned short dma_mword;
434: unsigned short eide_pio_modes;
435: unsigned short eide_dma_min;
436: unsigned short eide_dma_time;
437: unsigned short eide_pio;
438: unsigned short eide_pio_iordy;
439: unsigned short words69_70[2];
440:
441:
442: unsigned short words71_74[4];
443:
444:
445: unsigned short queue_depth;
446:
447:
448:
449: unsigned short words76_79[4];
450: unsigned short major_rev_num;
451: unsigned short minor_rev_num;
452: unsigned short command_set_1;
453:
454:
455:
456:
457:
458:
459:
460:
461:
462:
463:
464:
465:
466:
467:
468:
469:
470: unsigned short command_set_2;
471:
472:
473:
474:
475:
476:
477:
478:
479:
480:
481:
482:
483:
484:
485:
486:
487:
488: unsigned short cfsse;
489:
490:
491:
492:
493:
494:
495:
496:
497:
498:
499:
500: unsigned short cfs_enable_1;
501:
502:
503:
504:
505:
506:
507:
508:
509:
510:
511:
512:
513:
514:
515:
516:
517:
518:
519: unsigned short cfs_enable_2;
520:
521:
522:
523:
524:
525:
526:
527:
528:
529:
530:
531:
532:
533:
534:
535:
536:
537:
538: unsigned short csf_default;
539:
540:
541:
542:
543:
544:
545:
546:
547:
548:
549:
550: unsigned short dma_ultra;
551: unsigned short trseuc;
552: unsigned short trsEuc;
553: unsigned short CurAPMvalues;
554: unsigned short mprc;
555: unsigned short hw_config;
556:
557:
558:
559:
560:
561:
562:
563:
564:
565:
566:
567:
568:
569:
570:
571:
572:
573: unsigned short acoustic;
574:
575:
576:
577: unsigned short msrqs;
578: unsigned short sxfert;
579: unsigned short sal;
580: unsigned int spg;
581: unsigned long long lba_capacity_2;
582: unsigned short words104_125[22];
583: unsigned short last_lun;
584: unsigned short word127;
585:
586:
587:
588:
589:
590:
591:
592: unsigned short dlf;
593:
594:
595:
596:
597:
598:
599:
600:
601:
602:
603:
604: unsigned short csfo;
605:
606:
607:
608:
609:
610:
611:
612: unsigned short words130_155[26];
613: unsigned short word156;
614: unsigned short words157_159[3];
615: unsigned short cfa_power;
616:
617:
618:
619:
620:
621:
622: unsigned short words161_175[15];
623: unsigned short words176_205[30];
624: unsigned short words206_254[49];
625: unsigned short integrity_word;
626:
627:
628:
629: };
630:
631:
632:
633:
634:
635:
636: #define IDE_NICE_DSC_OVERLAP (0)
637: #define IDE_NICE_ATAPI_OVERLAP (1)
638: #define IDE_NICE_1 (3)
639: #define IDE_NICE_0 (2)
640: #define IDE_NICE_2 (4)
641:
642: #endif
643:
© Andrew Scott 2006 -
2024,
All Rights Reserved