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