|
smartmontools SVN Rev 3317
Utility to control and monitor storage systems with "S.M.A.R.T."
|
00001 /* 00002 * os_generic.h 00003 * 00004 * Home page of code is: http://smartmontools.sourceforge.net 00005 * 00006 * Copyright (C) Joerg Hering <smartmontools-support@lists.sourceforge.net> 00007 * Copyright (C) 2003-8 Bruce Allen <smartmontools-support@lists.sourceforge.net> 00008 * 00009 * This program is free software; you can redistribute it and/or modify 00010 * it under the terms of the GNU General Public License as published by 00011 * the Free Software Foundation; either version 2, or (at your option) 00012 * any later version. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * (for example COPYING); if not, write to the Free Software Foundation, 00016 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00017 * 00018 * This code was originally developed as a Senior Thesis by Michael Cornwell 00019 * at the Concurrent Systems Laboratory (now part of the Storage Systems 00020 * Research Center), Jack Baskin School of Engineering, University of 00021 * California, Santa Cruz. http://ssrc.soe.ucsc.edu/ 00022 * 00023 */ 00024 #ifndef OS_QNXNTO_H_ 00025 #define OS_QNXNTO_H_ 00026 #define OS_QNXNTO_H_CVSID "$Id: os_qnxnto.h 3728 2012-12-13 17:57:50Z chrfranke $\n" 00027 00028 // Additional material should start here. Note: to keep the '-V' CVS 00029 // reporting option working as intended, you should only #include 00030 // system include files <something.h>. Local #include files 00031 // <"something.h"> should be #included in os_generic.c 00032 #include <sys/cpt.h> 00033 00034 #ifndef __TYPES_H_INCLUDED 00035 #include <sys/types.h> 00036 #endif 00037 00038 #include <stdio.h> 00039 #include <fcntl.h> 00040 #include <gulliver.h> 00041 #include <sys/cpt.h> 00042 #include <sys/dcmd_cam.h> 00043 #include <sys/cam_device.h> 00044 #include "atacmds.h" 00045 00046 //---------------------------------------------------------------------------------------------------------- 00047 typedef struct _ata_pass_thru ATA_PASS_THRU; 00048 typedef struct _eide_identify EIDE_IDENTIFY; 00049 typedef struct _ata_sense ATA_SENSE; 00050 00051 typedef void CCB; 00052 struct _sim_hba; 00053 struct _resmgr_context; 00054 00055 00056 typedef struct _drive_attribute 00057 { 00058 int id; 00059 int threshold; 00060 char *name; 00061 }DRIVE_ATTRIBUTE; 00062 00063 //---------------------------------------------------------------------------------------------------------- 00064 /* UNIVOS OSD defines and data structures. */ 00065 00066 #define INQLEN 36 /* Inquiry string length to store. */ 00067 00068 #define CAM_SUCCESS 0 /* For signaling general success */ 00069 #define CAM_FAILURE 1 /* For signaling general failure */ 00070 00071 #define CAM_FALSE 0 /* General purpose flag value */ 00072 #define CAM_TRUE 1 /* General purpose flag value */ 00073 00074 //---------------------------------------------------------------------------------------------------------- 00075 // Group 3 and 4, command codes 60H-9FH are reserved 00076 #define SC_ATA_PT16 0x85 // ATA Pass-through 00077 //---------------------------------------------------------------------------------------------------------- 00078 #define ATA_SMART_LBA_MID_SIG 0x4f 00079 #define ATA_SMART_LBA_HI_SIG 0xc2 00080 #define ATA_SMART_SIG 0xc24f 00081 //---------------------------------------------------------------------------------------------------------- 00082 struct _ata_pass_thru { 00083 uchar_t opcode; 00084 #define ATA_PROTO_MSK 0x1e 00085 #define ATA_PROTO_RESPONSE (15 << 1) 00086 #define ATA_PROTO_FPDMA (12 << 1) 00087 #define ATA_PROTO_UDMA_DATA_OUT (11 << 1) 00088 #define ATA_PROTO_UDMA_DATA_IN (10 << 1) 00089 #define ATA_PROTO_DEVICE_RESET (9 << 1) 00090 #define ATA_PROTO_DEVICE_DIAGNOSTIC (8 << 1) 00091 #define ATA_PROTO_DMA_QUEUED (7 << 1) 00092 #define ATA_PROTO_DMA (6 << 1) 00093 #define ATA_PROTO_PIO_DATA_OUT (5 << 1) 00094 #define ATA_PROTO_PIO_DATA_IN (4 << 1) 00095 #define ATA_PROTO_DATA_NONE (3 << 1) 00096 #define ATA_PROTO_SRST (1 << 1) 00097 #define ATA_PROTO_HRST (0 << 1) 00098 #define ATA_PROTO_EXTEND 0x01 00099 uchar_t protocol; // multiple count, protocol 00100 #define ATA_MCOUNT_MSK 0xe0 00101 00102 #define ATA_FLG_CK_COND 0x20 00103 #define ATA_FLG_T_DIR 0x08 // data from device 00104 #define ATA_FLG_BYT_BLOK 0x04 00105 #define ATA_FLG_TLEN_STPSIU 0x03 00106 #define ATA_FLG_TLEN_SECTOR_COUNT 0x02 00107 #define ATA_FLG_TLEN_FEATURE 0x01 00108 uchar_t flags; 00109 00110 uchar_t efeatures; 00111 uchar_t features; 00112 uchar_t esector_count; 00113 uchar_t sector_count; 00114 uchar_t elba_low; 00115 uchar_t lba_low; 00116 uchar_t elba_mid; 00117 uchar_t lba_mid; 00118 uchar_t elba_high; 00119 uchar_t lba_high; 00120 uchar_t device; 00121 uchar_t command; 00122 uchar_t control; 00123 } ata_pass_thru_; 00124 //---------------------------------------------------------------------------------------------------------- 00125 #define SENSE_DATA_FMT_DESCRIPTOR 0x02 00126 00127 // Fixed Format Sense Data Structure 00128 // Note: The field "error" has the following format: 00129 // bit 7 - Address valid bit 00130 // bits 6-4 - Error class 00131 // bits 3-0 - Error code 00132 // 00133 // Error classes 0-6 are vendor unique and also indicate that the 00134 // sense data is in _nonextended_ format. (i.e. not usually used) 00135 // struct _scsi_nonextended_sense { 00136 // uchar_t sd_err; 00137 // ulong_t sd_block_address; 00138 // }; 00139 // 00140 // An error class of 7 and an error code of 0 (70H) indicate SCSI-1 00141 // extended sense data format (or SCSI-2 sense data format). 00142 // 00143 // An error class of 7 and an error code of 1 (71H) indicate SCSI-2 00144 // deferred errors. 00145 // 00146 // Error codes 74H to 7EH are reserved and error code 7FH indicates 00147 // a vendor-specific sense data format. 00148 typedef struct _scsi_sense { 00149 uchar_t error; // Error Code 00150 uchar_t segment; // Segment number 00151 uchar_t sense; // Sense key/flags 00152 uchar_t info[4]; // Information (32bit big-endian value) 00153 uchar_t asl; // Additional Sense Length 00154 uchar_t csinfo[4]; // Command-Specific Information 00155 uchar_t asc; // Additional Sense Code 00156 uchar_t ascq; // Additional Sense Code Qualifier 00157 uchar_t fruc; // Field Replaceable Unit Code 00158 uchar_t sks; // Sense Key Specific 00159 ushort_t sks_data; // Sense Key Specific Data (16bit big-endian) 00160 ushort_t asb; // Additional Sense uchar_ts (Max 256-18) 00161 } SCSI_SENSE; 00162 00163 // Descriptor Format Sense Data Structure 00164 // error code of 72 current, 73 deferred 00165 // extended sense data format (or SCSI-2 sense data format). 00166 typedef struct _scsi_sense_descriptor { 00167 uchar_t error; // Error Code 00168 uchar_t sense; // Sense key/flags 00169 uchar_t asc; // Additional Sense Code 00170 uchar_t ascq; // Additional Sense Code Qualifier 00171 uchar_t rsvd[3]; 00172 uchar_t asl; // Additional Sense Length 00173 } SCSI_SENSE_DESCRIPTOR; 00174 00175 typedef struct _scsi_sense_desriptor_header { 00176 uchar_t descriptor_type; 00177 uchar_t descriptor_len; 00178 } SCSI_SENSE_DESCRIPTOR_HEADER; 00179 00180 #define SENSE_DTYPE_INFORMATION 0x00 00181 #define SENSE_DTYPE_CSI 0x01 // Command Specific Information 00182 #define SENSE_DTYPE_SKS 0x02 // Sense Key Specific 00183 #define SENSE_DTYPE_FRU 0x03 // Field Replaceable Unit 00184 #define SENSE_DTYPE_STREAM 0x04 00185 #define SENSE_DTYPE_BLOCK 0x05 00186 #define SENSE_DTYPE_OSD_OBJ_IDENT 0x06 // OSD Object Identification 00187 #define SENSE_DTYPE_OSD_INTEGRITY 0x07 // OSD Response Integrity Check Value 00188 #define SENSE_DTYPE_OSD_ATR_IDENT 0x08 // OSD Attribute Identification 00189 #define SENSE_DTYPE_ATA 0x09 00190 00191 typedef struct _ata_status_descriptor { 00192 uchar_t descriptor_type; 00193 #define ATA_SD_DLEN 0x0c 00194 uchar_t descriptor_len; /* 0xc */ 00195 #define ATA_SD_FLG_EXTEND 0x01 00196 uchar_t flags; 00197 uchar_t error; 00198 uchar_t esector_count; /* (15:8) */ 00199 uchar_t sector_count; /* (7:0) */ 00200 uchar_t elba_low; /* (15:8) */ 00201 uchar_t lba_low; /* (7:0) */ 00202 uchar_t elba_mid; /* (15:8) */ 00203 uchar_t lba_mid; /* (7:0) */ 00204 uchar_t elba_high; /* (15:8) */ 00205 uchar_t lba_high; /* (7:0) */ 00206 uchar_t device; 00207 uchar_t status; 00208 } ATA_STATUS_DESCRIPTOR; 00209 00210 //---------------------------------------------------------------------------------------------------------- 00211 // Sense Keys 00212 #define SK_MSK 0x0F // mask to sd_sense field for key 00213 00214 #define SK_NO_SENSE 0 // No sense data (no error) 00215 #define ASCQ_FILEMARK_DETECTED 0x01 00216 #define ASCQ_EOPM_DETECTED 0x02 // End of Partition/Medium Detected 00217 #define ASCQ_SETMARK_DETECTED 0x03 00218 #define ASCQ_BOPM_DETECTED 0x04 // Beginning of Partition/Medium Detected 00219 00220 #define SK_RECOVERED 1 // Recovered error 00221 #define ASC_ATA_PASS_THRU 0x00 00222 #define ASCQ_ATA_PASS_THRU_INFO_AVAIL 0x1d 00223 00224 #define SK_NOT_RDY 2 // Device not ready 00225 #define ASC_NO_SEEK_COMPLETE 0x02 00226 #define ASC_NOT_READY 0x04 00227 #define ASCQ_CAUSE_NOT_REPORTABLE 0x00 00228 #define ASCQ_BECOMING_READY 0x01 00229 #define ASCQ_INIT_COMMAND_REQUIRED 0x02 00230 #define ASCQ_MANUAL_INTERVENTION_REQUIRED 0x03 00231 #define ASCQ_FORMAT_IN_PROGRESS 0x04 00232 #define ASCQ_UNKNOWN_CHANGED 0xff // NTO extension for fdc's 00233 #define ASC_MEDIA_FORMAT 0x30 // bad format 00234 #define ASC_MEDIA_NOT_PRESENT 0x3a 00235 #define ASC_NOT_CONFIGURED 0x3e 00236 00237 #define SK_MEDIUM 3 // Medium error 00238 #define ASC_UNRECOVERABLE_READ_ERROR 0x11 00239 #define ASC_RECORD_NOT_FOUND 0x14 00240 #define ASCQ_RECORD_NOT_FOUND 0x01 00241 #define ASC_UNABLE_TO_RECOVER_TOC 0x57 00242 #define ASC_INCOMPATIBLE_MEDIUM 0x64 00243 00244 #define SK_HARDWARE 4 // Hardware error 00245 #define ASC_INTERNAL_TARGET_FAILURE 0x44 00246 #define ASC_MEDIA_LOAD_EJECT_FAILURE 0x53 00247 #define ASCQ_UNRECOVERABLE_CIRC 0x06 00248 00249 #define SK_ILLEGAL 5 // Illegal Request (bad command) 00250 #define ASC_INVALID_COMMAND 0x20 00251 #define ASC_INVALID_FIELD 0x24 00252 #define ASC_INVALID_FIELD_PARAMETER 0x26 00253 #define ASC_COMMAND_SEQUENCE_ERROR 0x2c 00254 #define ASCQ_READ_SCRAMBLED 0x03 00255 #define ASC_ILLEGAL_MODE 0x64 00256 #define ASC_COPY_PROTECTION 0x6f 00257 00258 #define SK_UNIT_ATN 6 // Unit Attention 00259 #define ASC_MEDIUM_CHANGED 0x28 00260 #define ASC_BUS_RESET 0x29 00261 #define ASC_INSUFFICIENT_TIME_FOR_OPERATION 0x2e 00262 #define ASC_OPERATOR_REQUEST 0x5a 00263 #define ASCQ_OPERATOR_MEDIUM_REMOVAL 0x01 00264 00265 #define SK_DATA_PROT 7 // Data Protect 00266 #define ASC_WRITE_PROTECTED 0x27 00267 00268 #define SK_BLNK_CHK 8 // Blank Check 00269 #define SK_VENDOR 9 // Vendor Specific 00270 #define SK_CPY_ABORT 10 // Copy Aborted 00271 #define SK_CMD_ABORT 11 // Aborted Command 00272 #define SK_EQUAL 12 // Equal 00273 #define SK_VOL_OFL 13 // Volume Overflow 00274 #define SK_MISCMP 14 // Miscompare 00275 #define SK_RESERVED 15 // Reserved 00276 //---------------------------------------------------------------------------------------------------------- 00277 // Command Descriptor Block structure definitions 00278 00279 // CDB Flags 00280 #define CF_LINK 0x01 // Linked-command indication 00281 #define CF_FLAG 0x02 // Linked-command with flag bit 00282 #define CF_VENDOR0 0x40 // Vendor unique bits 00283 #define CF_VENDOR1 0x80 00284 00285 #define CF_FUA 0x08 00286 #define CF_DPO 0x10 00287 00288 typedef union _cdb { 00289 // generic 6 byte command descriptor block 00290 struct { 00291 uchar_t opcode; 00292 uchar_t lun_opt; 00293 uchar_t lba_byte1; 00294 uchar_t lba_byte0; // LSB 00295 uchar_t transfer_len; 00296 uchar_t control; 00297 } gen6; 00298 00299 // generic 10 byte command descriptor block 00300 struct { 00301 uchar_t opcode; 00302 uchar_t lun_opt; 00303 uchar_t lba_byte3; 00304 uchar_t lba_byte4; 00305 uchar_t lba_byte1; 00306 uchar_t lba_byte0; 00307 uchar_t rsvd; 00308 uchar_t transfer_len[2]; 00309 uchar_t control; 00310 } gen10; 00311 00312 // generic 12 byte command descriptor block 00313 struct { 00314 uchar_t opcode; 00315 uchar_t lun_opt; 00316 uchar_t lba_byte3; 00317 uchar_t lba_byte4; 00318 uchar_t lba_byte1; 00319 uchar_t lba_byte0; 00320 uchar_t transfer_len[4]; 00321 uchar_t rsvd10; 00322 uchar_t control; 00323 } gen12; 00324 00325 struct _format_unit { 00326 uchar_t op_code; 00327 #define FU_RSVD0 0xc0 // reserved bits 00328 #define FU_FMTDAT 0x10 00329 #define FU_CMPLIST 0x08 00330 uchar_t defect_list_fmt; 00331 uchar_t track_num; 00332 ushort_t interleave; 00333 uchar_t rsvd1[7]; 00334 } format_unit; 00335 00336 struct _format_unit_old { 00337 uchar_t op_code; 00338 uchar_t rsvd0; 00339 uchar_t medium_type_code; 00340 uchar_t rsvd1; 00341 uchar_t interleave; 00342 uchar_t rsvd2; 00343 #define FMT_RSVD3 0x80 00344 #define FMT_SECT_SIZE_CD 0x70 00345 #define FMT_IMMED 0x08 00346 #define FMT_HEAD 0x04 00347 #define FMT_ST 0x02 00348 #define FMT_CERT 0x01 00349 uchar_t cert; 00350 uchar_t track_addr; 00351 uchar_t rsvd4[4]; 00352 } format_unit_old; 00353 00354 #define RW_OPT_RELADR 0x01 00355 #define RW_OPT_CORRCT 0x02 // Disable Corrections 00356 #define RW_OPT_FUA 0x08 // Force Unit Access 00357 #define RW_OPT_DPO 0x10 // Disable Page Out 00358 struct { 00359 uchar_t opcode; 00360 uchar_t lun_lba; 00361 uchar_t lba[2]; 00362 uchar_t transfer_len; 00363 uchar_t control; 00364 } read_write6; 00365 00366 struct { 00367 uchar_t opcode; 00368 uchar_t lun_opt; 00369 uchar_t lba[4]; 00370 uchar_t rsvd2; 00371 uchar_t transfer_len[2]; 00372 uchar_t control; 00373 } read_write10; 00374 00375 struct { 00376 uchar_t opcode; 00377 uchar_t lun_opt; 00378 uchar_t lba[4]; 00379 uchar_t transfer_len[4]; 00380 uchar_t rsvd2; 00381 uchar_t control; 00382 } read_write12; 00383 00384 #define MSEL_OPT_PF 0x10 // Page Format 00385 #define MSEL_OPT_SP 0x01 // Save Page 00386 struct { 00387 uchar_t opcode; 00388 uchar_t lun_opt; 00389 uchar_t rsvd2; 00390 uchar_t rsvd3; 00391 uchar_t param_length; 00392 uchar_t control; 00393 } mode_select; 00394 00395 struct { 00396 uchar_t opcode; 00397 uchar_t lun_opt; 00398 uchar_t rsvd2; 00399 uchar_t rsvd3; 00400 uchar_t rsvd4; 00401 uchar_t rsvd5; 00402 uchar_t rsvd6; 00403 uchar_t param_length[2]; 00404 uchar_t control; 00405 } mode_select10; 00406 00407 struct { 00408 uchar_t opcode; 00409 #define LS_OPT_SP 0x01 // Save Parameters 00410 #define LS_OPT_PCR 0x02 // Parameter Code Reset 00411 uchar_t lun_opt; 00412 #define LS_PC_CUR_THRESHOLD 0x00 00413 #define LS_PC_CUR_CUMULATIVE 0x01 00414 #define LS_PC_DFLT_THRESHOLD 0x02 00415 #define LS_PC_DFLT_CUMULATIVE 0x03 00416 uchar_t pc; // Page Control 00417 uchar_t rsvd3; 00418 uchar_t rsvd4; 00419 uchar_t rsvd5; 00420 uchar_t rsvd6; 00421 uchar_t param_length[2]; 00422 uchar_t control; 00423 } log_select; 00424 00425 struct { 00426 uchar_t opcode; 00427 #define MSNS_OPT_DBD 0x08 // Disable Block Descriptors 00428 uchar_t lun_opt; 00429 #define PC_CURRENT 0x00 00430 #define PC_CHANGEABLE 0x40 00431 #define PC_DEFAULT 0x80 00432 #define PC_SAVED 0xC0 00433 #define PC_MSK 0xC0 00434 uchar_t pc_page; 00435 uchar_t subpage; 00436 uchar_t allocation_length; 00437 uchar_t control; 00438 } mode_sense; 00439 00440 struct _mode_sense10 { 00441 uchar_t opcode; 00442 uchar_t lun_opt; 00443 uchar_t pc_page; 00444 uchar_t subpage; 00445 uchar_t rsvd4; 00446 uchar_t rsvd5; 00447 uchar_t rsvd6; 00448 uchar_t allocation_length[2]; 00449 uchar_t control; 00450 } mode_sense10; 00451 00452 struct { 00453 uchar_t opcode; 00454 uchar_t lun_opt; 00455 uchar_t pc_page; 00456 uchar_t rsvd3; 00457 uchar_t rsvd4; 00458 uchar_t parameter_pointer[2]; 00459 uchar_t allocation_length[2]; 00460 uchar_t control; 00461 } log_sense; 00462 00463 struct { 00464 uchar_t opcode; 00465 uchar_t lun_opt; 00466 uchar_t rsvd2; 00467 uchar_t rsvd3; 00468 uchar_t prevent; 00469 uchar_t control; 00470 } removal; 00471 00472 struct { 00473 uchar_t opcode; 00474 #define LD_OPT_IMMED 0x01 00475 uchar_t lun_opt; 00476 uchar_t rsvd2; 00477 uchar_t rsvd3; 00478 #define LD_CMD_START 0x01 00479 #define LD_CMD_LOEJ 0x02 00480 #define LD_CMD_STOP 0x00 00481 #define LD_CMD_EJECT 0x02 00482 #define LD_CMD_LOAD 0x03 00483 00484 // Sequential-Access 00485 #define LD_CMD_SA_HOLD 0x08 00486 #define LD_CMD_SA_EOT 0x04 00487 #define LD_CMD_SA_RT 0x02 // re-tension 00488 #define LD_CMD_SA_LOEJ 0x01 00489 00490 // Block 00491 #define LD_CMD_PC_MSK 0xf0 00492 #define LD_CMD_PC_NC 0 00493 #define LD_CMD_PC_ACTIVE 1 00494 #define LD_CMD_PC_IDLE 2 00495 #define LD_CMD_PC_STANDBY 3 00496 #define LD_CMD_PC_SLEEP 5 00497 00498 uchar_t cmd; 00499 uchar_t control; 00500 } load; 00501 00502 struct { 00503 uchar_t opcode; 00504 uchar_t lun_opt; 00505 #define SC_OPT_RELADR 0x01 00506 #define SC_OPT_IMMED 0x02 00507 uchar_t lba[4]; 00508 uchar_t num_blocks[2]; 00509 uchar_t control; 00510 } synchronize_cache; 00511 00512 // cdrom commands 00513 struct { 00514 uchar_t opcode; 00515 uchar_t rsvd1; 00516 uchar_t rsvd2; 00517 uchar_t rsvd3; 00518 uchar_t rsvd4; 00519 uchar_t rsvd5; 00520 uchar_t rsvd6; 00521 uchar_t allocation_length[2]; 00522 uchar_t control; 00523 } read_disc_information; 00524 00525 struct { 00526 uchar_t opcode; 00527 uchar_t lun_opt; 00528 uchar_t rsvd2; 00529 uchar_t rsvd3; 00530 uchar_t rsvd4; 00531 uchar_t rsvd5; 00532 uchar_t rsvd6; 00533 uchar_t rsvd7; 00534 uchar_t resume; 00535 uchar_t control; 00536 } pause_resume; 00537 00538 struct { 00539 uchar_t opcode; 00540 uchar_t lun_opt; 00541 uchar_t rsvd2; 00542 uchar_t start_minute; 00543 uchar_t start_second; 00544 uchar_t start_frame; 00545 uchar_t end_minute; 00546 uchar_t end_second; 00547 uchar_t end_frame; 00548 uchar_t control; 00549 } play_audio_msf; 00550 00551 struct { 00552 uchar_t opcode; 00553 uchar_t lun_opt; 00554 uchar_t rsvd2; 00555 uchar_t rsvd3; 00556 uchar_t start_track; 00557 uchar_t start_index; 00558 uchar_t rsvd6; 00559 uchar_t end_track; 00560 uchar_t end_index; 00561 uchar_t control; 00562 } play_audio_ti; 00563 00564 struct { 00565 uchar_t opcode; 00566 #define CD_SCAN_DIR_FORWARD 0x00 00567 #define CD_SCAN_DIR_REVERSE 0x10 00568 uchar_t opt; 00569 uchar_t start_address[4]; 00570 #define CD_SCAN_TYPE_LBA 0x00 00571 #define CD_SCAN_TYPE_MSF 0x40 00572 #define CD_SCAN_TYPE_TRK 0x80 00573 #define CD_SCAN_TYPE_MSK 0xc0 00574 uchar_t rsvd6; 00575 uchar_t rsvd7; 00576 uchar_t rsvd8; 00577 uchar_t type; 00578 uchar_t rsvd10; 00579 uchar_t rsvd11; 00580 } cd_scan; 00581 00582 struct { 00583 uchar_t opcode; 00584 #define RTOC_OPT_MSF 0x02 00585 uchar_t lun_opt; 00586 #define RTOC_FMT_TOC 0x0 00587 #define RTOC_FMT_SESSION 0x1 00588 #define RTOC_FMT_QSUBCODE 0x2 00589 #define RTOC_FMT_QSUBCHNL 0x3 00590 #define RTOC_FMT_ATIP 0x4 00591 #define RTOC_FMT_CDTEXT 0x5 00592 uchar_t format; 00593 uchar_t rsvd3; 00594 uchar_t rsvd4; 00595 uchar_t rsvd5; 00596 uchar_t start_track; 00597 uchar_t allocation_length[2]; 00598 #define RTOC_CNTL_FMT_SESSION 0x40 00599 uchar_t control_format; 00600 } read_toc; 00601 00602 struct { 00603 uchar_t opcode; 00604 uchar_t lun_opt; 00605 uchar_t rsvd2[6]; 00606 uchar_t allocation_length[2]; 00607 uchar_t rsvd3[2]; 00608 } mechanism_status; 00609 00610 struct { 00611 uchar_t opcode; 00612 #define EXCHANGE_OPT_IMMED 0x01 00613 uchar_t lun_opt; 00614 uchar_t rsvd2; 00615 uchar_t rsvd3; 00616 #define EXCHANGE_CMD_START 0x01 00617 #define EXCHANGE_CMD_LOEJ 0x02 00618 uchar_t cmd; 00619 uchar_t rsvd5; 00620 uchar_t rsvd6; 00621 uchar_t rsvd7; 00622 uchar_t slot; 00623 uchar_t rsvd9; 00624 uchar_t rsvd10; 00625 uchar_t rsvd11; 00626 } exchange; 00627 00628 struct { 00629 uchar_t opcode; 00630 uchar_t rt; 00631 uchar_t feature_number[2]; 00632 uchar_t rsvd4; 00633 uchar_t rsvd5; 00634 uchar_t rsvd6; 00635 uchar_t allocation_length[2]; 00636 uchar_t control; 00637 } get_configuration; 00638 00639 struct { 00640 uchar_t opcode; 00641 #define GE_OPT_POLLED 0x01 00642 uchar_t opt; 00643 uchar_t rsvd2; 00644 uchar_t rsvd3; 00645 #define NCR_OPERATIONAL_CHANGE 0x02 00646 #define NCR_POWER_MANAGEMENT 0x04 00647 #define NCR_EXTERNAL_REQUEST 0x08 00648 #define NCR_MEDIA 0x10 00649 #define NCR_MULTI_INITIATOR 0x20 00650 #define NCR_DEVICE_BUSY 0x40 00651 uchar_t ncr; // notification class request 00652 uchar_t rsvd5; 00653 uchar_t rsvd6; 00654 uchar_t allocation_length[2]; 00655 uchar_t control; 00656 } get_event; 00657 00658 struct { 00659 uchar_t opcode; 00660 uchar_t lun_opt; 00661 uchar_t rsvd2; 00662 uchar_t rsvd3; 00663 uchar_t rsvd4; 00664 uchar_t rsvd5; 00665 uchar_t rsvd6; 00666 uchar_t allocation_length[2]; 00667 uchar_t control; 00668 } read_formated_capacities; 00669 00670 struct { 00671 uchar_t opcode; 00672 uchar_t lun_opt; 00673 uchar_t read_speed[2]; 00674 uchar_t write_speed[2]; 00675 uchar_t rsvd2[6]; 00676 } cd_speed; 00677 00678 struct { 00679 uchar_t opcode; 00680 #define RSCHNL_OPT_MSF 0x02 00681 uchar_t lun_opt; 00682 #define RSCHNL_DATA_SUBQ 0x40 00683 uchar_t data; 00684 uchar_t data_format; 00685 uchar_t rsvd4; 00686 uchar_t rsvd5; 00687 uchar_t track; 00688 uchar_t allocation_length[2]; 00689 uchar_t control; 00690 } read_subchannel; 00691 00692 #define CD_FRAME_SYNC_SIZE 12 00693 #define CD_FRAME_HDR_SIZE 4 00694 #define CD_FRAME_SUB_HDR_SIZE 8 00695 #define CD_FRAME_EDC_SIZE 4 00696 #define CD_FRAME_ECC_SIZE 276 00697 #define CD_FRAME_AUX_SIZE 8 00698 #define CD_FRAME_ZERO_SIZE 8 00699 #define CD_FRAME_SPARE_SIZE 4 00700 #define CD_FRAME_C2_ERR_SIZE 294 00701 #define CD_FRAME_BLOCK_ERR_SIZE 2 00702 00703 struct { 00704 uchar_t opcode; 00705 uchar_t lun_stype; 00706 // expected sector type 00707 #define RDCD_EST_ANY_SECTOR (0 << 2) 00708 #define RDCD_EST_CDDA_SECTOR (1 << 2) 00709 #define RDCD_EST_YELLOW_MODE1_SECTOR (2 << 2) 00710 #define RDCD_EST_YELLOW_MODE2_SECTOR (3 << 2) 00711 #define RDCD_EST_XA_SECTOR (4 << 2) 00712 #define RDCD_EST_XA_FORM2_SECTOR (5 << 2) 00713 #define RDCD_EST_MSK (7 << 2) 00714 uchar_t lba[4]; 00715 uchar_t transfer_len[3]; 00716 uchar_t flags; 00717 #define RDCD_FLG_SYNC 0x80 00718 #define RDCD_FLG_UDATA 0x10 00719 #define RDCD_FLG_ECC 0x08 00720 #define RDCD_FLG_CD_ERR 0x02 00721 #define RDCD_FLG_CD_BLOCK_ERR 0x04 00722 #define RDCD_FLG_HC_NONE ( 0x00 << 5 ) 00723 #define RDCD_FLG_HC_HDR ( 0x01 << 5 ) 00724 #define RDCD_FLG_HC_SUBHEADER ( 0x02 << 5 ) 00725 #define RDCD_FLG_HC_ALL_HEADERS ( 0x03 << 5 ) 00726 uchar_t subch_selection; 00727 uchar_t rsvd3; 00728 } read_cd; 00729 00730 struct { 00731 uchar_t opcode; 00732 uchar_t lun_stype; 00733 uchar_t rsvd2; 00734 uchar_t start_minute; 00735 uchar_t start_second; 00736 uchar_t start_frame; 00737 uchar_t end_minute; 00738 uchar_t end_second; 00739 uchar_t end_frame; 00740 uchar_t flags; 00741 uchar_t subch_selection; 00742 uchar_t rsvd11; 00743 } read_cd_msf; 00744 00745 struct _ata_pass_thru { 00746 uchar_t opcode; 00747 #define ATA_PROTO_MSK 0x1e 00748 #define ATA_PROTO_RESPONSE (15 << 1) 00749 #define ATA_PROTO_FPDMA (12 << 1) 00750 #define ATA_PROTO_UDMA_DATA_OUT (11 << 1) 00751 #define ATA_PROTO_UDMA_DATA_IN (10 << 1) 00752 #define ATA_PROTO_DEVICE_RESET (9 << 1) 00753 #define ATA_PROTO_DEVICE_DIAGNOSTIC (8 << 1) 00754 #define ATA_PROTO_DMA_QUEUED (7 << 1) 00755 #define ATA_PROTO_DMA (6 << 1) 00756 #define ATA_PROTO_PIO_DATA_OUT (5 << 1) 00757 #define ATA_PROTO_PIO_DATA_IN (4 << 1) 00758 #define ATA_PROTO_DATA_NONE (3 << 1) 00759 #define ATA_PROTO_SRST (1 << 1) 00760 #define ATA_PROTO_HRST (0 << 1) 00761 #define ATA_PROTO_EXTEND 0x01 00762 uchar_t protocol; // multiple count, protocol 00763 #define ATA_MCOUNT_MSK 0xe0 00764 00765 #define ATA_FLG_CK_COND 0x20 00766 #define ATA_FLG_T_DIR 0x08 // data from device 00767 #define ATA_FLG_BYT_BLOK 0x04 00768 #define ATA_FLG_TLEN_STPSIU 0x03 00769 #define ATA_FLG_TLEN_SECTOR_COUNT 0x02 00770 #define ATA_FLG_TLEN_FEATURE 0x01 00771 uchar_t flags; 00772 00773 uchar_t efeatures; 00774 uchar_t features; 00775 uchar_t esector_count; 00776 uchar_t sector_count; 00777 uchar_t elba_low; 00778 uchar_t lba_low; 00779 uchar_t elba_mid; 00780 uchar_t lba_mid; 00781 uchar_t elba_high; 00782 uchar_t lba_high; 00783 uchar_t device; 00784 uchar_t command; 00785 uchar_t control; 00786 } ata_pass_thru; 00787 00788 // sequential access commands 00789 struct { 00790 uchar_t opcode; 00791 #define ERASE_OPT_LONG 0x01 00792 uchar_t opt; 00793 uchar_t rsvd[3]; 00794 uchar_t control; 00795 } erase; 00796 00797 struct { 00798 uchar_t opcode; 00799 #define LOCATE_OPT_CP 0x2 00800 #define LOCATE_OPT_BT 0x4 00801 uchar_t opt; 00802 uchar_t rsvd2; 00803 uchar_t ba[4]; // block address 00804 uchar_t rsvd7; 00805 uchar_t partition; 00806 uchar_t control; 00807 } locate; 00808 00809 struct { 00810 uchar_t opcode; 00811 uchar_t opt; 00812 uchar_t rsvd2[3]; 00813 uchar_t control; 00814 } read_block_limits; 00815 00816 #define RP_OPT_BT 0x01 // block address type 00817 #define RP_OPT_LNG 0x02 // long format 00818 #define RP_OPT_TCLP 0x04 // total current logical position 00819 struct { 00820 uchar_t opcode; 00821 uchar_t lun_opt; 00822 uchar_t rsvd2[7]; 00823 uchar_t control; 00824 } read_position; 00825 00826 #define SRW_OPT_FIXED 0x01 00827 #define SRW_OPT_SILI 0x02 00828 struct { 00829 uchar_t opcode; 00830 uchar_t opt; 00831 uchar_t transfer_len[3]; 00832 uchar_t control; 00833 } sa_read_write; 00834 00835 struct { 00836 uchar_t opcode; 00837 uchar_t opt; 00838 uchar_t rsvd[3]; 00839 uchar_t control; 00840 } rewind; 00841 00842 struct { 00843 uchar_t opcode; 00844 #define SPACE_CODE_BLOCKS 0x00 00845 #define SPACE_CODE_FMRKS 0x01 00846 #define SPACE_CODE_SEQ_FMRKS 0x02 00847 #define SPACE_CODE_EOD 0x03 00848 #define SPACE_CODE_SMRKS 0x04 00849 #define SPACE_CODE_SEQ_SMRKS 0x05 00850 uchar_t lun_code; 00851 uchar_t count[3]; 00852 uchar_t control; 00853 } space; 00854 00855 struct { 00856 uchar_t opcode; 00857 #define WF_OPT_IMMED 0x01 00858 #define WF_OPT_WSMK 0x02 00859 uchar_t opt; 00860 uchar_t transfer_length[3]; 00861 uchar_t control; 00862 } write_filemarks; 00863 00864 struct { 00865 uchar_t opcode; 00866 #define RD_OPT_MEDIA 0x01 00867 uchar_t opt; 00868 uchar_t rsvd[5]; 00869 uchar_t allocation_length[2]; 00870 uchar_t control; 00871 } report_density; 00872 00873 struct { 00874 uchar_t opcode; 00875 #define FM_OPT_IMMED 0x01 00876 #define FM_OPT_VERIFY 0x02 00877 uchar_t opt; 00878 #define FM_FMT_DFLT 0x00 00879 #define FM_FMT_PARTITION 0x01 00880 #define FM_FMT_FORMAT_PARTITION 0x02 00881 uchar_t format; 00882 uchar_t transfer_length[2]; 00883 uchar_t control; 00884 } format_media; 00885 } CDB; 00886 //---------------------------------------------------------------------------------------------------------- 00887 00888 struct _ata_sense 00889 { 00890 SCSI_SENSE_DESCRIPTOR sense; 00891 ATA_STATUS_DESCRIPTOR desc; 00892 }; 00893 //---------------------------------------------------------------------------------------------------------- 00894 00895 00896 #endif /* OS_QNXNTO_H_ */
1.7.4