1: /*
2: * os_generic.h
3: *
4: * Home page of code is: http://smartmontools.sourceforge.net
5: *
6: * Copyright (C) Joerg Hering <smartmontools-support@lists.sourceforge.net>
7: * Copyright (C) 2003-8 Bruce Allen <smartmontools-support@lists.sourceforge.net>
8: *
9: * This program is free software; you can redistribute it and/or modify
10: * it under the terms of the GNU General Public License as published by
11: * the Free Software Foundation; either version 2, or (at your option)
12: * any later version.
13: *
14: * You should have received a copy of the GNU General Public License
15: * (for example COPYING); if not, write to the Free Software Foundation,
16: * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17: *
18: * This code was originally developed as a Senior Thesis by Michael Cornwell
19: * at the Concurrent Systems Laboratory (now part of the Storage Systems
20: * Research Center), Jack Baskin School of Engineering, University of
21: * California, Santa Cruz. http://ssrc.soe.ucsc.edu/
22: *
23: */
24: #ifndef OS_QNXNTO_H_
25: #define OS_QNXNTO_H_
26: #define OS_QNXNTO_H_CVSID "$Id: os_qnxnto.h,v 1.1.1.2 2013/07/22 01:17:35 misho Exp $\n"
27:
28: // Additional material should start here. Note: to keep the '-V' CVS
29: // reporting option working as intended, you should only #include
30: // system include files <something.h>. Local #include files
31: // <"something.h"> should be #included in os_generic.c
32: #include <sys/cpt.h>
33:
34: #ifndef __TYPES_H_INCLUDED
35: #include <sys/types.h>
36: #endif
37:
38: #include <stdio.h>
39: #include <fcntl.h>
40: #include <gulliver.h>
41: #include <sys/cpt.h>
42: #include <sys/dcmd_cam.h>
43: #include <sys/cam_device.h>
44: #include "atacmds.h"
45:
46: //----------------------------------------------------------------------------------------------------------
47: typedef struct _ata_pass_thru ATA_PASS_THRU;
48: typedef struct _eide_identify EIDE_IDENTIFY;
49: typedef struct _ata_sense ATA_SENSE;
50:
51: typedef void CCB;
52: struct _sim_hba;
53: struct _resmgr_context;
54:
55:
56: typedef struct _drive_attribute
57: {
58: int id;
59: int threshold;
60: char *name;
61: }DRIVE_ATTRIBUTE;
62:
63: //----------------------------------------------------------------------------------------------------------
64: /* UNIVOS OSD defines and data structures. */
65:
66: #define INQLEN 36 /* Inquiry string length to store. */
67:
68: #define CAM_SUCCESS 0 /* For signaling general success */
69: #define CAM_FAILURE 1 /* For signaling general failure */
70:
71: #define CAM_FALSE 0 /* General purpose flag value */
72: #define CAM_TRUE 1 /* General purpose flag value */
73:
74: //----------------------------------------------------------------------------------------------------------
75: // Group 3 and 4, command codes 60H-9FH are reserved
76: #define SC_ATA_PT16 0x85 // ATA Pass-through
77: //----------------------------------------------------------------------------------------------------------
78: #define ATA_SMART_LBA_MID_SIG 0x4f
79: #define ATA_SMART_LBA_HI_SIG 0xc2
80: #define ATA_SMART_SIG 0xc24f
81: //----------------------------------------------------------------------------------------------------------
82: struct _ata_pass_thru {
83: uchar_t opcode;
84: #define ATA_PROTO_MSK 0x1e
85: #define ATA_PROTO_RESPONSE (15 << 1)
86: #define ATA_PROTO_FPDMA (12 << 1)
87: #define ATA_PROTO_UDMA_DATA_OUT (11 << 1)
88: #define ATA_PROTO_UDMA_DATA_IN (10 << 1)
89: #define ATA_PROTO_DEVICE_RESET (9 << 1)
90: #define ATA_PROTO_DEVICE_DIAGNOSTIC (8 << 1)
91: #define ATA_PROTO_DMA_QUEUED (7 << 1)
92: #define ATA_PROTO_DMA (6 << 1)
93: #define ATA_PROTO_PIO_DATA_OUT (5 << 1)
94: #define ATA_PROTO_PIO_DATA_IN (4 << 1)
95: #define ATA_PROTO_DATA_NONE (3 << 1)
96: #define ATA_PROTO_SRST (1 << 1)
97: #define ATA_PROTO_HRST (0 << 1)
98: #define ATA_PROTO_EXTEND 0x01
99: uchar_t protocol; // multiple count, protocol
100: #define ATA_MCOUNT_MSK 0xe0
101:
102: #define ATA_FLG_CK_COND 0x20
103: #define ATA_FLG_T_DIR 0x08 // data from device
104: #define ATA_FLG_BYT_BLOK 0x04
105: #define ATA_FLG_TLEN_STPSIU 0x03
106: #define ATA_FLG_TLEN_SECTOR_COUNT 0x02
107: #define ATA_FLG_TLEN_FEATURE 0x01
108: uchar_t flags;
109:
110: uchar_t efeatures;
111: uchar_t features;
112: uchar_t esector_count;
113: uchar_t sector_count;
114: uchar_t elba_low;
115: uchar_t lba_low;
116: uchar_t elba_mid;
117: uchar_t lba_mid;
118: uchar_t elba_high;
119: uchar_t lba_high;
120: uchar_t device;
121: uchar_t command;
122: uchar_t control;
123: } ata_pass_thru_;
124: //----------------------------------------------------------------------------------------------------------
125: #define SENSE_DATA_FMT_DESCRIPTOR 0x02
126:
127: // Fixed Format Sense Data Structure
128: // Note: The field "error" has the following format:
129: // bit 7 - Address valid bit
130: // bits 6-4 - Error class
131: // bits 3-0 - Error code
132: //
133: // Error classes 0-6 are vendor unique and also indicate that the
134: // sense data is in _nonextended_ format. (i.e. not usually used)
135: // struct _scsi_nonextended_sense {
136: // uchar_t sd_err;
137: // ulong_t sd_block_address;
138: // };
139: //
140: // An error class of 7 and an error code of 0 (70H) indicate SCSI-1
141: // extended sense data format (or SCSI-2 sense data format).
142: //
143: // An error class of 7 and an error code of 1 (71H) indicate SCSI-2
144: // deferred errors.
145: //
146: // Error codes 74H to 7EH are reserved and error code 7FH indicates
147: // a vendor-specific sense data format.
148: typedef struct _scsi_sense {
149: uchar_t error; // Error Code
150: uchar_t segment; // Segment number
151: uchar_t sense; // Sense key/flags
152: uchar_t info[4]; // Information (32bit big-endian value)
153: uchar_t asl; // Additional Sense Length
154: uchar_t csinfo[4]; // Command-Specific Information
155: uchar_t asc; // Additional Sense Code
156: uchar_t ascq; // Additional Sense Code Qualifier
157: uchar_t fruc; // Field Replaceable Unit Code
158: uchar_t sks; // Sense Key Specific
159: ushort_t sks_data; // Sense Key Specific Data (16bit big-endian)
160: ushort_t asb; // Additional Sense uchar_ts (Max 256-18)
161: } SCSI_SENSE;
162:
163: // Descriptor Format Sense Data Structure
164: // error code of 72 current, 73 deferred
165: // extended sense data format (or SCSI-2 sense data format).
166: typedef struct _scsi_sense_descriptor {
167: uchar_t error; // Error Code
168: uchar_t sense; // Sense key/flags
169: uchar_t asc; // Additional Sense Code
170: uchar_t ascq; // Additional Sense Code Qualifier
171: uchar_t rsvd[3];
172: uchar_t asl; // Additional Sense Length
173: } SCSI_SENSE_DESCRIPTOR;
174:
175: typedef struct _scsi_sense_desriptor_header {
176: uchar_t descriptor_type;
177: uchar_t descriptor_len;
178: } SCSI_SENSE_DESCRIPTOR_HEADER;
179:
180: #define SENSE_DTYPE_INFORMATION 0x00
181: #define SENSE_DTYPE_CSI 0x01 // Command Specific Information
182: #define SENSE_DTYPE_SKS 0x02 // Sense Key Specific
183: #define SENSE_DTYPE_FRU 0x03 // Field Replaceable Unit
184: #define SENSE_DTYPE_STREAM 0x04
185: #define SENSE_DTYPE_BLOCK 0x05
186: #define SENSE_DTYPE_OSD_OBJ_IDENT 0x06 // OSD Object Identification
187: #define SENSE_DTYPE_OSD_INTEGRITY 0x07 // OSD Response Integrity Check Value
188: #define SENSE_DTYPE_OSD_ATR_IDENT 0x08 // OSD Attribute Identification
189: #define SENSE_DTYPE_ATA 0x09
190:
191: typedef struct _ata_status_descriptor {
192: uchar_t descriptor_type;
193: #define ATA_SD_DLEN 0x0c
194: uchar_t descriptor_len; /* 0xc */
195: #define ATA_SD_FLG_EXTEND 0x01
196: uchar_t flags;
197: uchar_t error;
198: uchar_t esector_count; /* (15:8) */
199: uchar_t sector_count; /* (7:0) */
200: uchar_t elba_low; /* (15:8) */
201: uchar_t lba_low; /* (7:0) */
202: uchar_t elba_mid; /* (15:8) */
203: uchar_t lba_mid; /* (7:0) */
204: uchar_t elba_high; /* (15:8) */
205: uchar_t lba_high; /* (7:0) */
206: uchar_t device;
207: uchar_t status;
208: } ATA_STATUS_DESCRIPTOR;
209:
210: //----------------------------------------------------------------------------------------------------------
211: // Sense Keys
212: #define SK_MSK 0x0F // mask to sd_sense field for key
213:
214: #define SK_NO_SENSE 0 // No sense data (no error)
215: #define ASCQ_FILEMARK_DETECTED 0x01
216: #define ASCQ_EOPM_DETECTED 0x02 // End of Partition/Medium Detected
217: #define ASCQ_SETMARK_DETECTED 0x03
218: #define ASCQ_BOPM_DETECTED 0x04 // Beginning of Partition/Medium Detected
219:
220: #define SK_RECOVERED 1 // Recovered error
221: #define ASC_ATA_PASS_THRU 0x00
222: #define ASCQ_ATA_PASS_THRU_INFO_AVAIL 0x1d
223:
224: #define SK_NOT_RDY 2 // Device not ready
225: #define ASC_NO_SEEK_COMPLETE 0x02
226: #define ASC_NOT_READY 0x04
227: #define ASCQ_CAUSE_NOT_REPORTABLE 0x00
228: #define ASCQ_BECOMING_READY 0x01
229: #define ASCQ_INIT_COMMAND_REQUIRED 0x02
230: #define ASCQ_MANUAL_INTERVENTION_REQUIRED 0x03
231: #define ASCQ_FORMAT_IN_PROGRESS 0x04
232: #define ASCQ_UNKNOWN_CHANGED 0xff // NTO extension for fdc's
233: #define ASC_MEDIA_FORMAT 0x30 // bad format
234: #define ASC_MEDIA_NOT_PRESENT 0x3a
235: #define ASC_NOT_CONFIGURED 0x3e
236:
237: #define SK_MEDIUM 3 // Medium error
238: #define ASC_UNRECOVERABLE_READ_ERROR 0x11
239: #define ASC_RECORD_NOT_FOUND 0x14
240: #define ASCQ_RECORD_NOT_FOUND 0x01
241: #define ASC_UNABLE_TO_RECOVER_TOC 0x57
242: #define ASC_INCOMPATIBLE_MEDIUM 0x64
243:
244: #define SK_HARDWARE 4 // Hardware error
245: #define ASC_INTERNAL_TARGET_FAILURE 0x44
246: #define ASC_MEDIA_LOAD_EJECT_FAILURE 0x53
247: #define ASCQ_UNRECOVERABLE_CIRC 0x06
248:
249: #define SK_ILLEGAL 5 // Illegal Request (bad command)
250: #define ASC_INVALID_COMMAND 0x20
251: #define ASC_INVALID_FIELD 0x24
252: #define ASC_INVALID_FIELD_PARAMETER 0x26
253: #define ASC_COMMAND_SEQUENCE_ERROR 0x2c
254: #define ASCQ_READ_SCRAMBLED 0x03
255: #define ASC_ILLEGAL_MODE 0x64
256: #define ASC_COPY_PROTECTION 0x6f
257:
258: #define SK_UNIT_ATN 6 // Unit Attention
259: #define ASC_MEDIUM_CHANGED 0x28
260: #define ASC_BUS_RESET 0x29
261: #define ASC_INSUFFICIENT_TIME_FOR_OPERATION 0x2e
262: #define ASC_OPERATOR_REQUEST 0x5a
263: #define ASCQ_OPERATOR_MEDIUM_REMOVAL 0x01
264:
265: #define SK_DATA_PROT 7 // Data Protect
266: #define ASC_WRITE_PROTECTED 0x27
267:
268: #define SK_BLNK_CHK 8 // Blank Check
269: #define SK_VENDOR 9 // Vendor Specific
270: #define SK_CPY_ABORT 10 // Copy Aborted
271: #define SK_CMD_ABORT 11 // Aborted Command
272: #define SK_EQUAL 12 // Equal
273: #define SK_VOL_OFL 13 // Volume Overflow
274: #define SK_MISCMP 14 // Miscompare
275: #define SK_RESERVED 15 // Reserved
276: //----------------------------------------------------------------------------------------------------------
277: // Command Descriptor Block structure definitions
278:
279: // CDB Flags
280: #define CF_LINK 0x01 // Linked-command indication
281: #define CF_FLAG 0x02 // Linked-command with flag bit
282: #define CF_VENDOR0 0x40 // Vendor unique bits
283: #define CF_VENDOR1 0x80
284:
285: #define CF_FUA 0x08
286: #define CF_DPO 0x10
287:
288: typedef union _cdb {
289: // generic 6 byte command descriptor block
290: struct {
291: uchar_t opcode;
292: uchar_t lun_opt;
293: uchar_t lba_byte1;
294: uchar_t lba_byte0; // LSB
295: uchar_t transfer_len;
296: uchar_t control;
297: } gen6;
298:
299: // generic 10 byte command descriptor block
300: struct {
301: uchar_t opcode;
302: uchar_t lun_opt;
303: uchar_t lba_byte3;
304: uchar_t lba_byte4;
305: uchar_t lba_byte1;
306: uchar_t lba_byte0;
307: uchar_t rsvd;
308: uchar_t transfer_len[2];
309: uchar_t control;
310: } gen10;
311:
312: // generic 12 byte command descriptor block
313: struct {
314: uchar_t opcode;
315: uchar_t lun_opt;
316: uchar_t lba_byte3;
317: uchar_t lba_byte4;
318: uchar_t lba_byte1;
319: uchar_t lba_byte0;
320: uchar_t transfer_len[4];
321: uchar_t rsvd10;
322: uchar_t control;
323: } gen12;
324:
325: struct _format_unit {
326: uchar_t op_code;
327: #define FU_RSVD0 0xc0 // reserved bits
328: #define FU_FMTDAT 0x10
329: #define FU_CMPLIST 0x08
330: uchar_t defect_list_fmt;
331: uchar_t track_num;
332: ushort_t interleave;
333: uchar_t rsvd1[7];
334: } format_unit;
335:
336: struct _format_unit_old {
337: uchar_t op_code;
338: uchar_t rsvd0;
339: uchar_t medium_type_code;
340: uchar_t rsvd1;
341: uchar_t interleave;
342: uchar_t rsvd2;
343: #define FMT_RSVD3 0x80
344: #define FMT_SECT_SIZE_CD 0x70
345: #define FMT_IMMED 0x08
346: #define FMT_HEAD 0x04
347: #define FMT_ST 0x02
348: #define FMT_CERT 0x01
349: uchar_t cert;
350: uchar_t track_addr;
351: uchar_t rsvd4[4];
352: } format_unit_old;
353:
354: #define RW_OPT_RELADR 0x01
355: #define RW_OPT_CORRCT 0x02 // Disable Corrections
356: #define RW_OPT_FUA 0x08 // Force Unit Access
357: #define RW_OPT_DPO 0x10 // Disable Page Out
358: struct {
359: uchar_t opcode;
360: uchar_t lun_lba;
361: uchar_t lba[2];
362: uchar_t transfer_len;
363: uchar_t control;
364: } read_write6;
365:
366: struct {
367: uchar_t opcode;
368: uchar_t lun_opt;
369: uchar_t lba[4];
370: uchar_t rsvd2;
371: uchar_t transfer_len[2];
372: uchar_t control;
373: } read_write10;
374:
375: struct {
376: uchar_t opcode;
377: uchar_t lun_opt;
378: uchar_t lba[4];
379: uchar_t transfer_len[4];
380: uchar_t rsvd2;
381: uchar_t control;
382: } read_write12;
383:
384: #define MSEL_OPT_PF 0x10 // Page Format
385: #define MSEL_OPT_SP 0x01 // Save Page
386: struct {
387: uchar_t opcode;
388: uchar_t lun_opt;
389: uchar_t rsvd2;
390: uchar_t rsvd3;
391: uchar_t param_length;
392: uchar_t control;
393: } mode_select;
394:
395: struct {
396: uchar_t opcode;
397: uchar_t lun_opt;
398: uchar_t rsvd2;
399: uchar_t rsvd3;
400: uchar_t rsvd4;
401: uchar_t rsvd5;
402: uchar_t rsvd6;
403: uchar_t param_length[2];
404: uchar_t control;
405: } mode_select10;
406:
407: struct {
408: uchar_t opcode;
409: #define LS_OPT_SP 0x01 // Save Parameters
410: #define LS_OPT_PCR 0x02 // Parameter Code Reset
411: uchar_t lun_opt;
412: #define LS_PC_CUR_THRESHOLD 0x00
413: #define LS_PC_CUR_CUMULATIVE 0x01
414: #define LS_PC_DFLT_THRESHOLD 0x02
415: #define LS_PC_DFLT_CUMULATIVE 0x03
416: uchar_t pc; // Page Control
417: uchar_t rsvd3;
418: uchar_t rsvd4;
419: uchar_t rsvd5;
420: uchar_t rsvd6;
421: uchar_t param_length[2];
422: uchar_t control;
423: } log_select;
424:
425: struct {
426: uchar_t opcode;
427: #define MSNS_OPT_DBD 0x08 // Disable Block Descriptors
428: uchar_t lun_opt;
429: #define PC_CURRENT 0x00
430: #define PC_CHANGEABLE 0x40
431: #define PC_DEFAULT 0x80
432: #define PC_SAVED 0xC0
433: #define PC_MSK 0xC0
434: uchar_t pc_page;
435: uchar_t subpage;
436: uchar_t allocation_length;
437: uchar_t control;
438: } mode_sense;
439:
440: struct _mode_sense10 {
441: uchar_t opcode;
442: uchar_t lun_opt;
443: uchar_t pc_page;
444: uchar_t subpage;
445: uchar_t rsvd4;
446: uchar_t rsvd5;
447: uchar_t rsvd6;
448: uchar_t allocation_length[2];
449: uchar_t control;
450: } mode_sense10;
451:
452: struct {
453: uchar_t opcode;
454: uchar_t lun_opt;
455: uchar_t pc_page;
456: uchar_t rsvd3;
457: uchar_t rsvd4;
458: uchar_t parameter_pointer[2];
459: uchar_t allocation_length[2];
460: uchar_t control;
461: } log_sense;
462:
463: struct {
464: uchar_t opcode;
465: uchar_t lun_opt;
466: uchar_t rsvd2;
467: uchar_t rsvd3;
468: uchar_t prevent;
469: uchar_t control;
470: } removal;
471:
472: struct {
473: uchar_t opcode;
474: #define LD_OPT_IMMED 0x01
475: uchar_t lun_opt;
476: uchar_t rsvd2;
477: uchar_t rsvd3;
478: #define LD_CMD_START 0x01
479: #define LD_CMD_LOEJ 0x02
480: #define LD_CMD_STOP 0x00
481: #define LD_CMD_EJECT 0x02
482: #define LD_CMD_LOAD 0x03
483:
484: // Sequential-Access
485: #define LD_CMD_SA_HOLD 0x08
486: #define LD_CMD_SA_EOT 0x04
487: #define LD_CMD_SA_RT 0x02 // re-tension
488: #define LD_CMD_SA_LOEJ 0x01
489:
490: // Block
491: #define LD_CMD_PC_MSK 0xf0
492: #define LD_CMD_PC_NC 0
493: #define LD_CMD_PC_ACTIVE 1
494: #define LD_CMD_PC_IDLE 2
495: #define LD_CMD_PC_STANDBY 3
496: #define LD_CMD_PC_SLEEP 5
497:
498: uchar_t cmd;
499: uchar_t control;
500: } load;
501:
502: struct {
503: uchar_t opcode;
504: uchar_t lun_opt;
505: #define SC_OPT_RELADR 0x01
506: #define SC_OPT_IMMED 0x02
507: uchar_t lba[4];
508: uchar_t num_blocks[2];
509: uchar_t control;
510: } synchronize_cache;
511:
512: // cdrom commands
513: struct {
514: uchar_t opcode;
515: uchar_t rsvd1;
516: uchar_t rsvd2;
517: uchar_t rsvd3;
518: uchar_t rsvd4;
519: uchar_t rsvd5;
520: uchar_t rsvd6;
521: uchar_t allocation_length[2];
522: uchar_t control;
523: } read_disc_information;
524:
525: struct {
526: uchar_t opcode;
527: uchar_t lun_opt;
528: uchar_t rsvd2;
529: uchar_t rsvd3;
530: uchar_t rsvd4;
531: uchar_t rsvd5;
532: uchar_t rsvd6;
533: uchar_t rsvd7;
534: uchar_t resume;
535: uchar_t control;
536: } pause_resume;
537:
538: struct {
539: uchar_t opcode;
540: uchar_t lun_opt;
541: uchar_t rsvd2;
542: uchar_t start_minute;
543: uchar_t start_second;
544: uchar_t start_frame;
545: uchar_t end_minute;
546: uchar_t end_second;
547: uchar_t end_frame;
548: uchar_t control;
549: } play_audio_msf;
550:
551: struct {
552: uchar_t opcode;
553: uchar_t lun_opt;
554: uchar_t rsvd2;
555: uchar_t rsvd3;
556: uchar_t start_track;
557: uchar_t start_index;
558: uchar_t rsvd6;
559: uchar_t end_track;
560: uchar_t end_index;
561: uchar_t control;
562: } play_audio_ti;
563:
564: struct {
565: uchar_t opcode;
566: #define CD_SCAN_DIR_FORWARD 0x00
567: #define CD_SCAN_DIR_REVERSE 0x10
568: uchar_t opt;
569: uchar_t start_address[4];
570: #define CD_SCAN_TYPE_LBA 0x00
571: #define CD_SCAN_TYPE_MSF 0x40
572: #define CD_SCAN_TYPE_TRK 0x80
573: #define CD_SCAN_TYPE_MSK 0xc0
574: uchar_t rsvd6;
575: uchar_t rsvd7;
576: uchar_t rsvd8;
577: uchar_t type;
578: uchar_t rsvd10;
579: uchar_t rsvd11;
580: } cd_scan;
581:
582: struct {
583: uchar_t opcode;
584: #define RTOC_OPT_MSF 0x02
585: uchar_t lun_opt;
586: #define RTOC_FMT_TOC 0x0
587: #define RTOC_FMT_SESSION 0x1
588: #define RTOC_FMT_QSUBCODE 0x2
589: #define RTOC_FMT_QSUBCHNL 0x3
590: #define RTOC_FMT_ATIP 0x4
591: #define RTOC_FMT_CDTEXT 0x5
592: uchar_t format;
593: uchar_t rsvd3;
594: uchar_t rsvd4;
595: uchar_t rsvd5;
596: uchar_t start_track;
597: uchar_t allocation_length[2];
598: #define RTOC_CNTL_FMT_SESSION 0x40
599: uchar_t control_format;
600: } read_toc;
601:
602: struct {
603: uchar_t opcode;
604: uchar_t lun_opt;
605: uchar_t rsvd2[6];
606: uchar_t allocation_length[2];
607: uchar_t rsvd3[2];
608: } mechanism_status;
609:
610: struct {
611: uchar_t opcode;
612: #define EXCHANGE_OPT_IMMED 0x01
613: uchar_t lun_opt;
614: uchar_t rsvd2;
615: uchar_t rsvd3;
616: #define EXCHANGE_CMD_START 0x01
617: #define EXCHANGE_CMD_LOEJ 0x02
618: uchar_t cmd;
619: uchar_t rsvd5;
620: uchar_t rsvd6;
621: uchar_t rsvd7;
622: uchar_t slot;
623: uchar_t rsvd9;
624: uchar_t rsvd10;
625: uchar_t rsvd11;
626: } exchange;
627:
628: struct {
629: uchar_t opcode;
630: uchar_t rt;
631: uchar_t feature_number[2];
632: uchar_t rsvd4;
633: uchar_t rsvd5;
634: uchar_t rsvd6;
635: uchar_t allocation_length[2];
636: uchar_t control;
637: } get_configuration;
638:
639: struct {
640: uchar_t opcode;
641: #define GE_OPT_POLLED 0x01
642: uchar_t opt;
643: uchar_t rsvd2;
644: uchar_t rsvd3;
645: #define NCR_OPERATIONAL_CHANGE 0x02
646: #define NCR_POWER_MANAGEMENT 0x04
647: #define NCR_EXTERNAL_REQUEST 0x08
648: #define NCR_MEDIA 0x10
649: #define NCR_MULTI_INITIATOR 0x20
650: #define NCR_DEVICE_BUSY 0x40
651: uchar_t ncr; // notification class request
652: uchar_t rsvd5;
653: uchar_t rsvd6;
654: uchar_t allocation_length[2];
655: uchar_t control;
656: } get_event;
657:
658: struct {
659: uchar_t opcode;
660: uchar_t lun_opt;
661: uchar_t rsvd2;
662: uchar_t rsvd3;
663: uchar_t rsvd4;
664: uchar_t rsvd5;
665: uchar_t rsvd6;
666: uchar_t allocation_length[2];
667: uchar_t control;
668: } read_formated_capacities;
669:
670: struct {
671: uchar_t opcode;
672: uchar_t lun_opt;
673: uchar_t read_speed[2];
674: uchar_t write_speed[2];
675: uchar_t rsvd2[6];
676: } cd_speed;
677:
678: struct {
679: uchar_t opcode;
680: #define RSCHNL_OPT_MSF 0x02
681: uchar_t lun_opt;
682: #define RSCHNL_DATA_SUBQ 0x40
683: uchar_t data;
684: uchar_t data_format;
685: uchar_t rsvd4;
686: uchar_t rsvd5;
687: uchar_t track;
688: uchar_t allocation_length[2];
689: uchar_t control;
690: } read_subchannel;
691:
692: #define CD_FRAME_SYNC_SIZE 12
693: #define CD_FRAME_HDR_SIZE 4
694: #define CD_FRAME_SUB_HDR_SIZE 8
695: #define CD_FRAME_EDC_SIZE 4
696: #define CD_FRAME_ECC_SIZE 276
697: #define CD_FRAME_AUX_SIZE 8
698: #define CD_FRAME_ZERO_SIZE 8
699: #define CD_FRAME_SPARE_SIZE 4
700: #define CD_FRAME_C2_ERR_SIZE 294
701: #define CD_FRAME_BLOCK_ERR_SIZE 2
702:
703: struct {
704: uchar_t opcode;
705: uchar_t lun_stype;
706: // expected sector type
707: #define RDCD_EST_ANY_SECTOR (0 << 2)
708: #define RDCD_EST_CDDA_SECTOR (1 << 2)
709: #define RDCD_EST_YELLOW_MODE1_SECTOR (2 << 2)
710: #define RDCD_EST_YELLOW_MODE2_SECTOR (3 << 2)
711: #define RDCD_EST_XA_SECTOR (4 << 2)
712: #define RDCD_EST_XA_FORM2_SECTOR (5 << 2)
713: #define RDCD_EST_MSK (7 << 2)
714: uchar_t lba[4];
715: uchar_t transfer_len[3];
716: uchar_t flags;
717: #define RDCD_FLG_SYNC 0x80
718: #define RDCD_FLG_UDATA 0x10
719: #define RDCD_FLG_ECC 0x08
720: #define RDCD_FLG_CD_ERR 0x02
721: #define RDCD_FLG_CD_BLOCK_ERR 0x04
722: #define RDCD_FLG_HC_NONE ( 0x00 << 5 )
723: #define RDCD_FLG_HC_HDR ( 0x01 << 5 )
724: #define RDCD_FLG_HC_SUBHEADER ( 0x02 << 5 )
725: #define RDCD_FLG_HC_ALL_HEADERS ( 0x03 << 5 )
726: uchar_t subch_selection;
727: uchar_t rsvd3;
728: } read_cd;
729:
730: struct {
731: uchar_t opcode;
732: uchar_t lun_stype;
733: uchar_t rsvd2;
734: uchar_t start_minute;
735: uchar_t start_second;
736: uchar_t start_frame;
737: uchar_t end_minute;
738: uchar_t end_second;
739: uchar_t end_frame;
740: uchar_t flags;
741: uchar_t subch_selection;
742: uchar_t rsvd11;
743: } read_cd_msf;
744:
745: struct _ata_pass_thru {
746: uchar_t opcode;
747: #define ATA_PROTO_MSK 0x1e
748: #define ATA_PROTO_RESPONSE (15 << 1)
749: #define ATA_PROTO_FPDMA (12 << 1)
750: #define ATA_PROTO_UDMA_DATA_OUT (11 << 1)
751: #define ATA_PROTO_UDMA_DATA_IN (10 << 1)
752: #define ATA_PROTO_DEVICE_RESET (9 << 1)
753: #define ATA_PROTO_DEVICE_DIAGNOSTIC (8 << 1)
754: #define ATA_PROTO_DMA_QUEUED (7 << 1)
755: #define ATA_PROTO_DMA (6 << 1)
756: #define ATA_PROTO_PIO_DATA_OUT (5 << 1)
757: #define ATA_PROTO_PIO_DATA_IN (4 << 1)
758: #define ATA_PROTO_DATA_NONE (3 << 1)
759: #define ATA_PROTO_SRST (1 << 1)
760: #define ATA_PROTO_HRST (0 << 1)
761: #define ATA_PROTO_EXTEND 0x01
762: uchar_t protocol; // multiple count, protocol
763: #define ATA_MCOUNT_MSK 0xe0
764:
765: #define ATA_FLG_CK_COND 0x20
766: #define ATA_FLG_T_DIR 0x08 // data from device
767: #define ATA_FLG_BYT_BLOK 0x04
768: #define ATA_FLG_TLEN_STPSIU 0x03
769: #define ATA_FLG_TLEN_SECTOR_COUNT 0x02
770: #define ATA_FLG_TLEN_FEATURE 0x01
771: uchar_t flags;
772:
773: uchar_t efeatures;
774: uchar_t features;
775: uchar_t esector_count;
776: uchar_t sector_count;
777: uchar_t elba_low;
778: uchar_t lba_low;
779: uchar_t elba_mid;
780: uchar_t lba_mid;
781: uchar_t elba_high;
782: uchar_t lba_high;
783: uchar_t device;
784: uchar_t command;
785: uchar_t control;
786: } ata_pass_thru;
787:
788: // sequential access commands
789: struct {
790: uchar_t opcode;
791: #define ERASE_OPT_LONG 0x01
792: uchar_t opt;
793: uchar_t rsvd[3];
794: uchar_t control;
795: } erase;
796:
797: struct {
798: uchar_t opcode;
799: #define LOCATE_OPT_CP 0x2
800: #define LOCATE_OPT_BT 0x4
801: uchar_t opt;
802: uchar_t rsvd2;
803: uchar_t ba[4]; // block address
804: uchar_t rsvd7;
805: uchar_t partition;
806: uchar_t control;
807: } locate;
808:
809: struct {
810: uchar_t opcode;
811: uchar_t opt;
812: uchar_t rsvd2[3];
813: uchar_t control;
814: } read_block_limits;
815:
816: #define RP_OPT_BT 0x01 // block address type
817: #define RP_OPT_LNG 0x02 // long format
818: #define RP_OPT_TCLP 0x04 // total current logical position
819: struct {
820: uchar_t opcode;
821: uchar_t lun_opt;
822: uchar_t rsvd2[7];
823: uchar_t control;
824: } read_position;
825:
826: #define SRW_OPT_FIXED 0x01
827: #define SRW_OPT_SILI 0x02
828: struct {
829: uchar_t opcode;
830: uchar_t opt;
831: uchar_t transfer_len[3];
832: uchar_t control;
833: } sa_read_write;
834:
835: struct {
836: uchar_t opcode;
837: uchar_t opt;
838: uchar_t rsvd[3];
839: uchar_t control;
840: } rewind;
841:
842: struct {
843: uchar_t opcode;
844: #define SPACE_CODE_BLOCKS 0x00
845: #define SPACE_CODE_FMRKS 0x01
846: #define SPACE_CODE_SEQ_FMRKS 0x02
847: #define SPACE_CODE_EOD 0x03
848: #define SPACE_CODE_SMRKS 0x04
849: #define SPACE_CODE_SEQ_SMRKS 0x05
850: uchar_t lun_code;
851: uchar_t count[3];
852: uchar_t control;
853: } space;
854:
855: struct {
856: uchar_t opcode;
857: #define WF_OPT_IMMED 0x01
858: #define WF_OPT_WSMK 0x02
859: uchar_t opt;
860: uchar_t transfer_length[3];
861: uchar_t control;
862: } write_filemarks;
863:
864: struct {
865: uchar_t opcode;
866: #define RD_OPT_MEDIA 0x01
867: uchar_t opt;
868: uchar_t rsvd[5];
869: uchar_t allocation_length[2];
870: uchar_t control;
871: } report_density;
872:
873: struct {
874: uchar_t opcode;
875: #define FM_OPT_IMMED 0x01
876: #define FM_OPT_VERIFY 0x02
877: uchar_t opt;
878: #define FM_FMT_DFLT 0x00
879: #define FM_FMT_PARTITION 0x01
880: #define FM_FMT_FORMAT_PARTITION 0x02
881: uchar_t format;
882: uchar_t transfer_length[2];
883: uchar_t control;
884: } format_media;
885: } CDB;
886: //----------------------------------------------------------------------------------------------------------
887:
888: struct _ata_sense
889: {
890: SCSI_SENSE_DESCRIPTOR sense;
891: ATA_STATUS_DESCRIPTOR desc;
892: };
893: //----------------------------------------------------------------------------------------------------------
894:
895:
896: #endif /* OS_QNXNTO_H_ */
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>