DOSBox-X
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
src/dos/scsidefs.h
00001 /* Got it from Bochs */
00002 
00003 //
00004 // iodev/scsidefs.h
00005 //
00006 // This file was copied from ... ?
00007 //
00008 
00009 //***************************************************************************
00010 //
00011 // Name:            SCSIDEFS.H
00012 //
00013 // Description: SCSI definitions ('C' Language)
00014 //
00015 //***************************************************************************
00016 
00017 //***************************************************************************
00018 //                          %%% TARGET STATUS VALUES %%%
00019 //***************************************************************************
00020 #define STATUS_GOOD     0x00    // Status Good
00021 #define STATUS_CHKCOND  0x02    // Check Condition
00022 #define STATUS_CONDMET  0x04    // Condition Met
00023 #define STATUS_BUSY     0x08    // Busy
00024 #define STATUS_INTERM   0x10    // Intermediate
00025 #define STATUS_INTCDMET 0x14    // Intermediate-condition met
00026 #define STATUS_RESCONF  0x18    // Reservation conflict
00027 #define STATUS_COMTERM  0x22    // Command Terminated
00028 #define STATUS_QFULL    0x28    // Queue full
00029 
00030 //***************************************************************************
00031 //                      %%% SCSI MISCELLANEOUS EQUATES %%%
00032 //***************************************************************************
00033 #define MAXLUN          7       // Maximum Logical Unit Id
00034 #define MAXTARG         7       // Maximum Target Id
00035 #define MAX_SCSI_LUNS   64      // Maximum Number of SCSI LUNs
00036 #define MAX_NUM_HA      8       // Maximum Number of SCSI HA's
00037 
00038 //\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
00039 //
00040 //                          %%% SCSI COMMAND OPCODES %%%
00041 //
00043 
00044 //***************************************************************************
00045 //               %%% Commands for all Device Types %%%
00046 //***************************************************************************
00047 #define SCSI_CHANGE_DEF 0x40    // Change Definition (Optional)
00048 #define SCSI_COMPARE    0x39    // Compare (O)
00049 #define SCSI_COPY       0x18    // Copy (O)
00050 #define SCSI_COP_VERIFY 0x3A    // Copy and Verify (O)
00051 #define SCSI_INQUIRY    0x12    // Inquiry (MANDATORY)
00052 #define SCSI_LOG_SELECT 0x4C    // Log Select (O)
00053 #define SCSI_LOG_SENSE  0x4D    // Log Sense (O)
00054 #define SCSI_MODE_SEL6  0x15    // Mode Select 6-byte (Device Specific)
00055 #define SCSI_MODE_SEL10 0x55    // Mode Select 10-byte (Device Specific)
00056 #define SCSI_MODE_SEN6  0x1A    // Mode Sense 6-byte (Device Specific)
00057 #define SCSI_MODE_SEN10 0x5A    // Mode Sense 10-byte (Device Specific)
00058 #define SCSI_READ_BUFF  0x3C    // Read Buffer (O)
00059 #define SCSI_REQ_SENSE  0x03    // Request Sense (MANDATORY)
00060 #define SCSI_SEND_DIAG  0x1D    // Send Diagnostic (O)
00061 #define SCSI_TST_U_RDY  0x00    // Test Unit Ready (MANDATORY)
00062 #define SCSI_WRITE_BUFF 0x3B    // Write Buffer (O)
00063 
00064 //***************************************************************************
00065 //            %%% Commands Unique to Direct Access Devices %%%
00066 //***************************************************************************
00067 #define SCSI_COMPARE    0x39    // Compare (O)
00068 #define SCSI_FORMAT     0x04    // Format Unit (MANDATORY)
00069 #define SCSI_LCK_UN_CAC 0x36    // Lock Unlock Cache (O)
00070 #define SCSI_PREFETCH   0x34    // Prefetch (O)
00071 #define SCSI_MED_REMOVL 0x1E    // Prevent/Allow medium Removal (O)
00072 #define SCSI_READ6      0x08    // Read 6-byte (MANDATORY)
00073 #define SCSI_READ10     0x28    // Read 10-byte (MANDATORY)
00074 #define SCSI_RD_CAPAC   0x25    // Read Capacity (MANDATORY)
00075 #define SCSI_RD_DEFECT  0x37    // Read Defect Data (O)
00076 #define SCSI_READ_LONG  0x3E    // Read Long (O)
00077 #define SCSI_REASS_BLK  0x07    // Reassign Blocks (O)
00078 #define SCSI_RCV_DIAG   0x1C    // Receive Diagnostic Results (O)
00079 #define SCSI_RELEASE    0x17    // Release Unit (MANDATORY)
00080 #define SCSI_REZERO     0x01    // Rezero Unit (O)
00081 #define SCSI_SRCH_DAT_E 0x31    // Search Data Equal (O)
00082 #define SCSI_SRCH_DAT_H 0x30    // Search Data High (O)
00083 #define SCSI_SRCH_DAT_L 0x32    // Search Data Low (O)
00084 #define SCSI_SEEK6      0x0B    // Seek 6-Byte (O)
00085 #define SCSI_SEEK10     0x2B    // Seek 10-Byte (O)
00086 #define SCSI_SEND_DIAG  0x1D    // Send Diagnostics (MANDATORY)
00087 #define SCSI_SET_LIMIT  0x33    // Set Limits (O)
00088 #define SCSI_START_STP  0x1B    // Start/Stop Unit (O)
00089 #define SCSI_SYNC_CACHE 0x35    // Synchronize Cache (O)
00090 #define SCSI_VERIFY     0x2F    // Verify (O)
00091 #define SCSI_WRITE6     0x0A    // Write 6-Byte (MANDATORY)
00092 #define SCSI_WRITE10    0x2A    // Write 10-Byte (MANDATORY)
00093 #define SCSI_WRT_VERIFY 0x2E    // Write and Verify (O)
00094 #define SCSI_WRITE_LONG 0x3F    // Write Long (O)
00095 #define SCSI_WRITE_SAME 0x41    // Write Same (O)
00096 
00097 //***************************************************************************
00098 //          %%% Commands Unique to Sequential Access Devices %%%
00099 //***************************************************************************
00100 #define SCSI_ERASE      0x19    // Erase (MANDATORY)
00101 #define SCSI_LOAD_UN    0x1B    // Load/Unload (O)
00102 #define SCSI_LOCATE     0x2B    // Locate (O)
00103 #define SCSI_RD_BLK_LIM 0x05    // Read Block Limits (MANDATORY)
00104 #define SCSI_READ_POS   0x34    // Read Position (O)
00105 #define SCSI_READ_REV   0x0F    // Read Reverse (O)
00106 #define SCSI_REC_BF_DAT 0x14    // Recover Buffer Data (O)
00107 #define SCSI_RESERVE    0x16    // Reserve Unit (MANDATORY)
00108 #define SCSI_REWIND     0x01    // Rewind (MANDATORY)
00109 #define SCSI_SPACE      0x11    // Space (MANDATORY)
00110 #define SCSI_VERIFY_T   0x13    // Verify (Tape) (O)
00111 #define SCSI_WRT_FILE   0x10    // Write Filemarks (MANDATORY)
00112 
00113 //***************************************************************************
00114 //                %%% Commands Unique to Printer Devices %%%
00115 //***************************************************************************
00116 #define SCSI_PRINT      0x0A    // Print (MANDATORY)
00117 #define SCSI_SLEW_PNT   0x0B    // Slew and Print (O)
00118 #define SCSI_STOP_PNT   0x1B    // Stop Print (O)
00119 #define SCSI_SYNC_BUFF  0x10    // Synchronize Buffer (O)
00120 
00121 //***************************************************************************
00122 //               %%% Commands Unique to Processor Devices %%%
00123 //***************************************************************************
00124 #define SCSI_RECEIVE    0x08        // Receive (O)
00125 #define SCSI_SEND       0x0A        // Send (O)
00126 
00127 //***************************************************************************
00128 //              %%% Commands Unique to Write-Once Devices %%%
00129 //***************************************************************************
00130 #define SCSI_MEDIUM_SCN 0x38    // Medium Scan (O)
00131 #define SCSI_SRCHDATE10 0x31    // Search Data Equal 10-Byte (O)
00132 #define SCSI_SRCHDATE12 0xB1    // Search Data Equal 12-Byte (O)
00133 #define SCSI_SRCHDATH10 0x30    // Search Data High 10-Byte (O)
00134 #define SCSI_SRCHDATH12 0xB0    // Search Data High 12-Byte (O)
00135 #define SCSI_SRCHDATL10 0x32    // Search Data Low 10-Byte (O)
00136 #define SCSI_SRCHDATL12 0xB2    // Search Data Low 12-Byte (O)
00137 #define SCSI_SET_LIM_10 0x33    // Set Limits 10-Byte (O)
00138 #define SCSI_SET_LIM_12 0xB3    // Set Limits 10-Byte (O)
00139 #define SCSI_VERIFY10   0x2F    // Verify 10-Byte (O)
00140 #define SCSI_VERIFY12   0xAF    // Verify 12-Byte (O)
00141 #define SCSI_WRITE12    0xAA    // Write 12-Byte (O)
00142 #define SCSI_WRT_VER10  0x2E    // Write and Verify 10-Byte (O)
00143 #define SCSI_WRT_VER12  0xAE    // Write and Verify 12-Byte (O)
00144 
00145 //***************************************************************************
00146 //                %%% Commands Unique to CD-ROM Devices %%%
00147 //***************************************************************************
00148 #define SCSI_PLAYAUD_10 0x45    // Play Audio 10-Byte (O)
00149 #define SCSI_PLAYAUD_12 0xA5    // Play Audio 12-Byte 12-Byte (O)
00150 #define SCSI_PLAYAUDMSF 0x47    // Play Audio MSF (O)
00151 #define SCSI_PLAYA_TKIN 0x48    // Play Audio Track/Index (O)
00152 #define SCSI_PLYTKREL10 0x49    // Play Track Relative 10-Byte (O)
00153 #define SCSI_PLYTKREL12 0xA9    // Play Track Relative 12-Byte (O)
00154 #define SCSI_READCDCAP  0x25    // Read CD-ROM Capacity (MANDATORY)
00155 #define SCSI_READHEADER 0x44    // Read Header (O)
00156 #define SCSI_SUBCHANNEL 0x42    // Read Subchannel (O)
00157 #define SCSI_READ_TOC   0x43    // Read TOC (O)
00158 
00159 //***************************************************************************
00160 //                %%% Commands Unique to Scanner Devices %%%
00161 //***************************************************************************
00162 #define SCSI_GETDBSTAT  0x34    // Get Data Buffer Status (O)
00163 #define SCSI_GETWINDOW  0x25    // Get Window (O)
00164 #define SCSI_OBJECTPOS  0x31    // Object Postion (O)
00165 #define SCSI_SCAN       0x1B    // Scan (O)
00166 #define SCSI_SETWINDOW  0x24    // Set Window (MANDATORY)
00167 
00168 //***************************************************************************
00169 //           %%% Commands Unique to Optical Memory Devices %%%
00170 //***************************************************************************
00171 #define SCSI_UpdateBlk  0x3D    // Update Block (O)
00172 
00173 //***************************************************************************
00174 //           %%% Commands Unique to Medium Changer Devices %%%
00175 //***************************************************************************
00176 #define SCSI_EXCHMEDIUM 0xA6    // Exchange Medium (O)
00177 #define SCSI_INITELSTAT 0x07    // Initialize Element Status (O)
00178 #define SCSI_POSTOELEM  0x2B    // Position to Element (O)
00179 #define SCSI_REQ_VE_ADD 0xB5    // Request Volume Element Address (O)
00180 #define SCSI_SENDVOLTAG 0xB6    // Send Volume Tag (O)
00181 
00182 //***************************************************************************
00183 //            %%% Commands Unique to Communication Devices %%%
00184 //***************************************************************************
00185 #define SCSI_GET_MSG_6  0x08    // Get Message 6-Byte (MANDATORY)
00186 #define SCSI_GET_MSG_10 0x28    // Get Message 10-Byte (O)
00187 #define SCSI_GET_MSG_12 0xA8    // Get Message 12-Byte (O)
00188 #define SCSI_SND_MSG_6  0x0A    // Send Message 6-Byte (MANDATORY)
00189 #define SCSI_SND_MSG_10 0x2A    // Send Message 10-Byte (O)
00190 #define SCSI_SND_MSG_12 0xAA    // Send Message 12-Byte (O)
00191 
00192 //\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
00193 //
00194 //                    %%% END OF SCSI COMMAND OPCODES %%%
00195 //
00197 
00198 //***************************************************************************
00199 //                      %%% Request Sense Data Format %%%
00200 //***************************************************************************
00201 typedef struct {
00202 
00203     BYTE    ErrorCode;          // Error Code (70H or 71H)
00204     BYTE    SegmentNum;         // Number of current segment descriptor
00205     BYTE    SenseKey;           // Sense Key(See bit definitions too)
00206     BYTE    InfoByte0;          // Information MSB
00207     BYTE    InfoByte1;          // Information MID
00208     BYTE    InfoByte2;          // Information MID
00209     BYTE    InfoByte3;          // Information LSB
00210     BYTE    AddSenLen;          // Additional Sense Length
00211     BYTE    ComSpecInf0;        // Command Specific Information MSB
00212     BYTE    ComSpecInf1;        // Command Specific Information MID
00213     BYTE    ComSpecInf2;        // Command Specific Information MID
00214     BYTE    ComSpecInf3;        // Command Specific Information LSB
00215     BYTE    AddSenseCode;       // Additional Sense Code
00216     BYTE    AddSenQual;         // Additional Sense Code Qualifier
00217     BYTE    FieldRepUCode;      // Field Replaceable Unit Code
00218     BYTE    SenKeySpec15;       // Sense Key Specific 15th byte
00219     BYTE    SenKeySpec16;       // Sense Key Specific 16th byte
00220     BYTE    SenKeySpec17;       // Sense Key Specific 17th byte
00221     BYTE    AddSenseBytes;      // Additional Sense Bytes
00222 
00223 } SENSE_DATA_FMT;
00224 
00225 //***************************************************************************
00226 //                       %%% REQUEST SENSE ERROR CODE %%%
00227 //***************************************************************************
00228 #define SERROR_CURRENT  0x70    // Current Errors
00229 #define SERROR_DEFERED  0x71    // Deferred Errors
00230 
00231 //***************************************************************************
00232 //                   %%% REQUEST SENSE BIT DEFINITIONS %%%
00233 //***************************************************************************
00234 #define SENSE_VALID     0x80    // Byte 0 Bit 7
00235 #define SENSE_FILEMRK   0x80    // Byte 2 Bit 7
00236 #define SENSE_EOM       0x40    // Byte 2 Bit 6
00237 #define SENSE_ILI       0x20    // Byte 2 Bit 5
00238 
00239 //***************************************************************************
00240 //               %%% REQUEST SENSE SENSE KEY DEFINITIONS %%%
00241 //***************************************************************************
00242 #define KEY_NOSENSE     0x00    // No Sense
00243 #define KEY_RECERROR    0x01    // Recovered Error
00244 #define KEY_NOTREADY    0x02    // Not Ready
00245 #define KEY_MEDIUMERR   0x03    // Medium Error
00246 #define KEY_HARDERROR   0x04    // Hardware Error
00247 #define KEY_ILLGLREQ    0x05    // Illegal Request
00248 #define KEY_UNITATT     0x06    // Unit Attention
00249 #define KEY_DATAPROT    0x07    // Data Protect
00250 #define KEY_BLANKCHK    0x08    // Blank Check
00251 #define KEY_VENDSPEC    0x09    // Vendor Specific
00252 #define KEY_COPYABORT   0x0A    // Copy Abort
00253 #define KEY_EQUAL       0x0C    // Equal (Search)
00254 #define KEY_VOLOVRFLW   0x0D    // Volume Overflow
00255 #define KEY_MISCOMP     0x0E    // Miscompare (Search)
00256 #define KEY_RESERVED    0x0F    // Reserved
00257 
00258 //***************************************************************************
00259 //                %%% PERIPHERAL DEVICE TYPE DEFINITIONS %%%
00260 //***************************************************************************
00261 #define DTYPE_DASD      0x00    // Disk Device
00262 #define DTYPE_SEQD      0x01    // Tape Device
00263 #define DTYPE_PRNT      0x02    // Printer
00264 #define DTYPE_PROC      0x03    // Processor
00265 #define DTYPE_WORM      0x04    // Write-once read-multiple
00266 #define DTYPE_CROM      0x05    // CD-ROM device
00267 #define DTYPE_CDROM     0x05    // CD-ROM device
00268 #define DTYPE_SCAN      0x06    // Scanner device
00269 #define DTYPE_OPTI      0x07    // Optical memory device
00270 #define DTYPE_JUKE      0x08    // Medium Changer device
00271 #define DTYPE_COMM      0x09    // Communications device
00272 #define DTYPE_RESL      0x0A    // Reserved (low)
00273 #define DTYPE_RESH      0x1E    // Reserved (high)
00274 #define DTYPE_UNKNOWN   0x1F    // Unknown or no device type
00275 
00276 //***************************************************************************
00277 //                %%% ANSI APPROVED VERSION DEFINITIONS %%%
00278 //***************************************************************************
00279 #define ANSI_MAYBE      0x0     // Device may or may not be ANSI approved stand
00280 #define ANSI_SCSI1      0x1     // Device complies to ANSI X3.131-1986 (SCSI-1)
00281 #define ANSI_SCSI2      0x2     // Device complies to SCSI-2
00282 #define ANSI_RESLO      0x3     // Reserved (low)
00283 #define ANSI_RESHI      0x7     // Reserved (high)