Debian Codegraph @

src/dos/scsidefs.h

raw symbols SCIP
1 /* Got it from Bochs */
2
3 /////////////////////////////////////////////////////////////////////////
4 // $Id: scsidefs.h,v 1.3 2005-07-21 12:49:52 qbix79 Exp $
5 /////////////////////////////////////////////////////////////////////////
6 //
7 //
8 // iodev/scsidefs.h
9 // $Id: scsidefs.h,v 1.3 2005-07-21 12:49:52 qbix79 Exp $
10 //
11 // This file was copied from ... ?
12 //
13
14 //***************************************************************************
15 //
16 // Name: SCSIDEFS.H
17 //
18 // Description: SCSI definitions ('C' Language)
19 //
20 //***************************************************************************
21
22 //***************************************************************************
23 // %%% TARGET STATUS VALUES %%%
24 //***************************************************************************
25 #define STATUS_GOOD 0x00 // Status Good
26 #define STATUS_CHKCOND 0x02 // Check Condition
27 #define STATUS_CONDMET 0x04 // Condition Met
28 #define STATUS_BUSY 0x08 // Busy
29 #define STATUS_INTERM 0x10 // Intermediate
30 #define STATUS_INTCDMET 0x14 // Intermediate-condition met
31 #define STATUS_RESCONF 0x18 // Reservation conflict
32 #define STATUS_COMTERM 0x22 // Command Terminated
33 #define STATUS_QFULL 0x28 // Queue full
34
35 //***************************************************************************
36 // %%% SCSI MISCELLANEOUS EQUATES %%%
37 //***************************************************************************
38 #define MAXLUN 7 // Maximum Logical Unit Id
39 #define MAXTARG 7 // Maximum Target Id
40 #define MAX_SCSI_LUNS 64 // Maximum Number of SCSI LUNs
41 #define MAX_NUM_HA 8 // Maximum Number of SCSI HA's
42
43 //\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
44 //
45 // %%% SCSI COMMAND OPCODES %%%
46 //
47 ///\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
48
49 //***************************************************************************
50 // %%% Commands for all Device Types %%%
51 //***************************************************************************
52 #define SCSI_CHANGE_DEF 0x40 // Change Definition (Optional)
53 #define SCSI_COMPARE 0x39 // Compare (O)
54 #define SCSI_COPY 0x18 // Copy (O)
55 #define SCSI_COP_VERIFY 0x3A // Copy and Verify (O)
56 #define SCSI_INQUIRY 0x12 // Inquiry (MANDATORY)
57 #define SCSI_LOG_SELECT 0x4C // Log Select (O)
58 #define SCSI_LOG_SENSE 0x4D // Log Sense (O)
59 #define SCSI_MODE_SEL6 0x15 // Mode Select 6-byte (Device Specific)
60 #define SCSI_MODE_SEL10 0x55 // Mode Select 10-byte (Device Specific)
61 #define SCSI_MODE_SEN6 0x1A // Mode Sense 6-byte (Device Specific)
62 #define SCSI_MODE_SEN10 0x5A // Mode Sense 10-byte (Device Specific)
63 #define SCSI_READ_BUFF 0x3C // Read Buffer (O)
64 #define SCSI_REQ_SENSE 0x03 // Request Sense (MANDATORY)
65 #define SCSI_SEND_DIAG 0x1D // Send Diagnostic (O)
66 #define SCSI_TST_U_RDY 0x00 // Test Unit Ready (MANDATORY)
67 #define SCSI_WRITE_BUFF 0x3B // Write Buffer (O)
68
69 //***************************************************************************
70 // %%% Commands Unique to Direct Access Devices %%%
71 //***************************************************************************
72 #define SCSI_COMPARE 0x39 // Compare (O)
73 #define SCSI_FORMAT 0x04 // Format Unit (MANDATORY)
74 #define SCSI_LCK_UN_CAC 0x36 // Lock Unlock Cache (O)
75 #define SCSI_PREFETCH 0x34 // Prefetch (O)
76 #define SCSI_MED_REMOVL 0x1E // Prevent/Allow medium Removal (O)
77 #define SCSI_READ6 0x08 // Read 6-byte (MANDATORY)
78 #define SCSI_READ10 0x28 // Read 10-byte (MANDATORY)
79 #define SCSI_RD_CAPAC 0x25 // Read Capacity (MANDATORY)
80 #define SCSI_RD_DEFECT 0x37 // Read Defect Data (O)
81 #define SCSI_READ_LONG 0x3E // Read Long (O)
82 #define SCSI_REASS_BLK 0x07 // Reassign Blocks (O)
83 #define SCSI_RCV_DIAG 0x1C // Receive Diagnostic Results (O)
84 #define SCSI_RELEASE 0x17 // Release Unit (MANDATORY)
85 #define SCSI_REZERO 0x01 // Rezero Unit (O)
86 #define SCSI_SRCH_DAT_E 0x31 // Search Data Equal (O)
87 #define SCSI_SRCH_DAT_H 0x30 // Search Data High (O)
88 #define SCSI_SRCH_DAT_L 0x32 // Search Data Low (O)
89 #define SCSI_SEEK6 0x0B // Seek 6-Byte (O)
90 #define SCSI_SEEK10 0x2B // Seek 10-Byte (O)
91 #define SCSI_SEND_DIAG 0x1D // Send Diagnostics (MANDATORY)
92 #define SCSI_SET_LIMIT 0x33 // Set Limits (O)
93 #define SCSI_START_STP 0x1B // Start/Stop Unit (O)
94 #define SCSI_SYNC_CACHE 0x35 // Synchronize Cache (O)
95 #define SCSI_VERIFY 0x2F // Verify (O)
96 #define SCSI_WRITE6 0x0A // Write 6-Byte (MANDATORY)
97 #define SCSI_WRITE10 0x2A // Write 10-Byte (MANDATORY)
98 #define SCSI_WRT_VERIFY 0x2E // Write and Verify (O)
99 #define SCSI_WRITE_LONG 0x3F // Write Long (O)
100 #define SCSI_WRITE_SAME 0x41 // Write Same (O)
101
102 //***************************************************************************
103 // %%% Commands Unique to Sequential Access Devices %%%
104 //***************************************************************************
105 #define SCSI_ERASE 0x19 // Erase (MANDATORY)
106 #define SCSI_LOAD_UN 0x1B // Load/Unload (O)
107 #define SCSI_LOCATE 0x2B // Locate (O)
108 #define SCSI_RD_BLK_LIM 0x05 // Read Block Limits (MANDATORY)
109 #define SCSI_READ_POS 0x34 // Read Position (O)
110 #define SCSI_READ_REV 0x0F // Read Reverse (O)
111 #define SCSI_REC_BF_DAT 0x14 // Recover Buffer Data (O)
112 #define SCSI_RESERVE 0x16 // Reserve Unit (MANDATORY)
113 #define SCSI_REWIND 0x01 // Rewind (MANDATORY)
114 #define SCSI_SPACE 0x11 // Space (MANDATORY)
115 #define SCSI_VERIFY_T 0x13 // Verify (Tape) (O)
116 #define SCSI_WRT_FILE 0x10 // Write Filemarks (MANDATORY)
117
118 //***************************************************************************
119 // %%% Commands Unique to Printer Devices %%%
120 //***************************************************************************
121 #define SCSI_PRINT 0x0A // Print (MANDATORY)
122 #define SCSI_SLEW_PNT 0x0B // Slew and Print (O)
123 #define SCSI_STOP_PNT 0x1B // Stop Print (O)
124 #define SCSI_SYNC_BUFF 0x10 // Synchronize Buffer (O)
125
126 //***************************************************************************
127 // %%% Commands Unique to Processor Devices %%%
128 //***************************************************************************
129 #define SCSI_RECEIVE 0x08 // Receive (O)
130 #define SCSI_SEND 0x0A // Send (O)
131
132 //***************************************************************************
133 // %%% Commands Unique to Write-Once Devices %%%
134 //***************************************************************************
135 #define SCSI_MEDIUM_SCN 0x38 // Medium Scan (O)
136 #define SCSI_SRCHDATE10 0x31 // Search Data Equal 10-Byte (O)
137 #define SCSI_SRCHDATE12 0xB1 // Search Data Equal 12-Byte (O)
138 #define SCSI_SRCHDATH10 0x30 // Search Data High 10-Byte (O)
139 #define SCSI_SRCHDATH12 0xB0 // Search Data High 12-Byte (O)
140 #define SCSI_SRCHDATL10 0x32 // Search Data Low 10-Byte (O)
141 #define SCSI_SRCHDATL12 0xB2 // Search Data Low 12-Byte (O)
142 #define SCSI_SET_LIM_10 0x33 // Set Limits 10-Byte (O)
143 #define SCSI_SET_LIM_12 0xB3 // Set Limits 10-Byte (O)
144 #define SCSI_VERIFY10 0x2F // Verify 10-Byte (O)
145 #define SCSI_VERIFY12 0xAF // Verify 12-Byte (O)
146 #define SCSI_WRITE12 0xAA // Write 12-Byte (O)
147 #define SCSI_WRT_VER10 0x2E // Write and Verify 10-Byte (O)
148 #define SCSI_WRT_VER12 0xAE // Write and Verify 12-Byte (O)
149
150 //***************************************************************************
151 // %%% Commands Unique to CD-ROM Devices %%%
152 //***************************************************************************
153 #define SCSI_PLAYAUD_10 0x45 // Play Audio 10-Byte (O)
154 #define SCSI_PLAYAUD_12 0xA5 // Play Audio 12-Byte 12-Byte (O)
155 #define SCSI_PLAYAUDMSF 0x47 // Play Audio MSF (O)
156 #define SCSI_PLAYA_TKIN 0x48 // Play Audio Track/Index (O)
157 #define SCSI_PLYTKREL10 0x49 // Play Track Relative 10-Byte (O)
158 #define SCSI_PLYTKREL12 0xA9 // Play Track Relative 12-Byte (O)
159 #define SCSI_READCDCAP 0x25 // Read CD-ROM Capacity (MANDATORY)
160 #define SCSI_READHEADER 0x44 // Read Header (O)
161 #define SCSI_SUBCHANNEL 0x42 // Read Subchannel (O)
162 #define SCSI_READ_TOC 0x43 // Read TOC (O)
163
164 //***************************************************************************
165 // %%% Commands Unique to Scanner Devices %%%
166 //***************************************************************************
167 #define SCSI_GETDBSTAT 0x34 // Get Data Buffer Status (O)
168 #define SCSI_GETWINDOW 0x25 // Get Window (O)
169 #define SCSI_OBJECTPOS 0x31 // Object Postion (O)
170 #define SCSI_SCAN 0x1B // Scan (O)
171 #define SCSI_SETWINDOW 0x24 // Set Window (MANDATORY)
172
173 //***************************************************************************
174 // %%% Commands Unique to Optical Memory Devices %%%
175 //***************************************************************************
176 #define SCSI_UpdateBlk 0x3D // Update Block (O)
177
178 //***************************************************************************
179 // %%% Commands Unique to Medium Changer Devices %%%
180 //***************************************************************************
181 #define SCSI_EXCHMEDIUM 0xA6 // Exchange Medium (O)
182 #define SCSI_INITELSTAT 0x07 // Initialize Element Status (O)
183 #define SCSI_POSTOELEM 0x2B // Position to Element (O)
184 #define SCSI_REQ_VE_ADD 0xB5 // Request Volume Element Address (O)
185 #define SCSI_SENDVOLTAG 0xB6 // Send Volume Tag (O)
186
187 //***************************************************************************
188 // %%% Commands Unique to Communication Devices %%%
189 //***************************************************************************
190 #define SCSI_GET_MSG_6 0x08 // Get Message 6-Byte (MANDATORY)
191 #define SCSI_GET_MSG_10 0x28 // Get Message 10-Byte (O)
192 #define SCSI_GET_MSG_12 0xA8 // Get Message 12-Byte (O)
193 #define SCSI_SND_MSG_6 0x0A // Send Message 6-Byte (MANDATORY)
194 #define SCSI_SND_MSG_10 0x2A // Send Message 10-Byte (O)
195 #define SCSI_SND_MSG_12 0xAA // Send Message 12-Byte (O)
196
197 //\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
198 //
199 // %%% END OF SCSI COMMAND OPCODES %%%
200 //
201 ///\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
202
203 //***************************************************************************
204 // %%% Request Sense Data Format %%%
205 //***************************************************************************
206 typedef struct {
207
208 BYTE ErrorCode; // Error Code (70H or 71H)
209 BYTE SegmentNum; // Number of current segment descriptor
210 BYTE SenseKey; // Sense Key(See bit definitions too)
211 BYTE InfoByte0; // Information MSB
212 BYTE InfoByte1; // Information MID
213 BYTE InfoByte2; // Information MID
214 BYTE InfoByte3; // Information LSB
215 BYTE AddSenLen; // Additional Sense Length
216 BYTE ComSpecInf0; // Command Specific Information MSB
217 BYTE ComSpecInf1; // Command Specific Information MID
218 BYTE ComSpecInf2; // Command Specific Information MID
219 BYTE ComSpecInf3; // Command Specific Information LSB
220 BYTE AddSenseCode; // Additional Sense Code
221 BYTE AddSenQual; // Additional Sense Code Qualifier
222 BYTE FieldRepUCode; // Field Replaceable Unit Code
223 BYTE SenKeySpec15; // Sense Key Specific 15th byte
224 BYTE SenKeySpec16; // Sense Key Specific 16th byte
225 BYTE SenKeySpec17; // Sense Key Specific 17th byte
226 BYTE AddSenseBytes; // Additional Sense Bytes
227
228 } SENSE_DATA_FMT;
229
230 //***************************************************************************
231 // %%% REQUEST SENSE ERROR CODE %%%
232 //***************************************************************************
233 #define SERROR_CURRENT 0x70 // Current Errors
234 #define SERROR_DEFERED 0x71 // Deferred Errors
235
236 //***************************************************************************
237 // %%% REQUEST SENSE BIT DEFINITIONS %%%
238 //***************************************************************************
239 #define SENSE_VALID 0x80 // Byte 0 Bit 7
240 #define SENSE_FILEMRK 0x80 // Byte 2 Bit 7
241 #define SENSE_EOM 0x40 // Byte 2 Bit 6
242 #define SENSE_ILI 0x20 // Byte 2 Bit 5
243
244 //***************************************************************************
245 // %%% REQUEST SENSE SENSE KEY DEFINITIONS %%%
246 //***************************************************************************
247 #define KEY_NOSENSE 0x00 // No Sense
248 #define KEY_RECERROR 0x01 // Recovered Error
249 #define KEY_NOTREADY 0x02 // Not Ready
250 #define KEY_MEDIUMERR 0x03 // Medium Error
251 #define KEY_HARDERROR 0x04 // Hardware Error
252 #define KEY_ILLGLREQ 0x05 // Illegal Request
253 #define KEY_UNITATT 0x06 // Unit Attention
254 #define KEY_DATAPROT 0x07 // Data Protect
255 #define KEY_BLANKCHK 0x08 // Blank Check
256 #define KEY_VENDSPEC 0x09 // Vendor Specific
257 #define KEY_COPYABORT 0x0A // Copy Abort
258 #define KEY_EQUAL 0x0C // Equal (Search)
259 #define KEY_VOLOVRFLW 0x0D // Volume Overflow
260 #define KEY_MISCOMP 0x0E // Miscompare (Search)
261 #define KEY_RESERVED 0x0F // Reserved
262
263 //***************************************************************************
264 // %%% PERIPHERAL DEVICE TYPE DEFINITIONS %%%
265 //***************************************************************************
266 #define DTYPE_DASD 0x00 // Disk Device
267 #define DTYPE_SEQD 0x01 // Tape Device
268 #define DTYPE_PRNT 0x02 // Printer
269 #define DTYPE_PROC 0x03 // Processor
270 #define DTYPE_WORM 0x04 // Write-once read-multiple
271 #define DTYPE_CROM 0x05 // CD-ROM device
272 #define DTYPE_CDROM 0x05 // CD-ROM device
273 #define DTYPE_SCAN 0x06 // Scanner device
274 #define DTYPE_OPTI 0x07 // Optical memory device
275 #define DTYPE_JUKE 0x08 // Medium Changer device
276 #define DTYPE_COMM 0x09 // Communications device
277 #define DTYPE_RESL 0x0A // Reserved (low)
278 #define DTYPE_RESH 0x1E // Reserved (high)
279 #define DTYPE_UNKNOWN 0x1F // Unknown or no device type
280
281 //***************************************************************************
282 // %%% ANSI APPROVED VERSION DEFINITIONS %%%
283 //***************************************************************************
284 #define ANSI_MAYBE 0x0 // Device may or may not be ANSI approved stand
285 #define ANSI_SCSI1 0x1 // Device complies to ANSI X3.131-1986 (SCSI-1)
286 #define ANSI_SCSI2 0x2 // Device complies to SCSI-2
287 #define ANSI_RESLO 0x3 // Reserved (low)
288 #define ANSI_RESHI 0x7 // Reserved (high)