]>
Commit | Line | Data |
---|---|---|
0d65e1f8 GH |
1 | /* Copyright (C) 1998, 1999 Free Software Foundation, Inc. |
2 | This file is part of the GNU C Library. | |
3 | ||
4 | The GNU C Library is free software; you can redistribute it and/or | |
5 | modify it under the terms of the GNU Lesser General Public | |
6 | License as published by the Free Software Foundation; either | |
7 | version 2.1 of the License, or (at your option) any later version. | |
8 | ||
9 | The GNU C Library is distributed in the hope that it will be useful, | |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 | Lesser General Public License for more details. | |
13 | ||
14 | You should have received a copy of the GNU Lesser General Public | |
70539e18 BS |
15 | License along with this library; if not, see <http://www.gnu.org/licenses/>. |
16 | */ | |
0d65e1f8 GH |
17 | |
18 | /* | |
19 | * This header file contains public constants and structures used by | |
20 | * the scsi code for linux. | |
21 | */ | |
cb9c377f PB |
22 | #ifndef HW_SCSI_DEFS_H |
23 | #define HW_SCSI_DEFS_H 1 | |
0d65e1f8 GH |
24 | |
25 | /* | |
26 | * SCSI opcodes | |
27 | */ | |
28 | ||
29 | #define TEST_UNIT_READY 0x00 | |
5e30a07d | 30 | #define REWIND 0x01 |
0d65e1f8 GH |
31 | #define REQUEST_SENSE 0x03 |
32 | #define FORMAT_UNIT 0x04 | |
33 | #define READ_BLOCK_LIMITS 0x05 | |
40723a99 | 34 | #define INITIALIZE_ELEMENT_STATUS 0x07 |
0d65e1f8 GH |
35 | #define REASSIGN_BLOCKS 0x07 |
36 | #define READ_6 0x08 | |
37 | #define WRITE_6 0x0a | |
00a01ad4 | 38 | #define SET_CAPACITY 0x0b |
0d65e1f8 GH |
39 | #define READ_REVERSE 0x0f |
40 | #define WRITE_FILEMARKS 0x10 | |
41 | #define SPACE 0x11 | |
42 | #define INQUIRY 0x12 | |
43 | #define RECOVER_BUFFERED_DATA 0x14 | |
44 | #define MODE_SELECT 0x15 | |
45 | #define RESERVE 0x16 | |
46 | #define RELEASE 0x17 | |
47 | #define COPY 0x18 | |
48 | #define ERASE 0x19 | |
49 | #define MODE_SENSE 0x1a | |
15e58a21 | 50 | #define LOAD_UNLOAD 0x1b |
0d65e1f8 GH |
51 | #define START_STOP 0x1b |
52 | #define RECEIVE_DIAGNOSTIC 0x1c | |
53 | #define SEND_DIAGNOSTIC 0x1d | |
54 | #define ALLOW_MEDIUM_REMOVAL 0x1e | |
5e30a07d | 55 | #define READ_CAPACITY_10 0x25 |
0d65e1f8 GH |
56 | #define READ_10 0x28 |
57 | #define WRITE_10 0x2a | |
58 | #define SEEK_10 0x2b | |
5e30a07d | 59 | #define LOCATE_10 0x2b |
40723a99 | 60 | #define POSITION_TO_ELEMENT 0x2b |
5e30a07d HR |
61 | #define WRITE_VERIFY_10 0x2e |
62 | #define VERIFY_10 0x2f | |
0d65e1f8 GH |
63 | #define SEARCH_HIGH 0x30 |
64 | #define SEARCH_EQUAL 0x31 | |
65 | #define SEARCH_LOW 0x32 | |
66 | #define SET_LIMITS 0x33 | |
67 | #define PRE_FETCH 0x34 | |
68 | #define READ_POSITION 0x34 | |
69 | #define SYNCHRONIZE_CACHE 0x35 | |
70 | #define LOCK_UNLOCK_CACHE 0x36 | |
40723a99 | 71 | #define INITIALIZE_ELEMENT_STATUS_WITH_RANGE 0x37 |
0d65e1f8 GH |
72 | #define READ_DEFECT_DATA 0x37 |
73 | #define MEDIUM_SCAN 0x38 | |
74 | #define COMPARE 0x39 | |
75 | #define COPY_VERIFY 0x3a | |
76 | #define WRITE_BUFFER 0x3b | |
77 | #define READ_BUFFER 0x3c | |
78 | #define UPDATE_BLOCK 0x3d | |
5e30a07d HR |
79 | #define READ_LONG_10 0x3e |
80 | #define WRITE_LONG_10 0x3f | |
0d65e1f8 | 81 | #define CHANGE_DEFINITION 0x40 |
5e30a07d HR |
82 | #define WRITE_SAME_10 0x41 |
83 | #define UNMAP 0x42 | |
0d65e1f8 | 84 | #define READ_TOC 0x43 |
5e30a07d HR |
85 | #define REPORT_DENSITY_SUPPORT 0x44 |
86 | #define GET_CONFIGURATION 0x46 | |
3e46d87d | 87 | #define SANITIZE 0x48 |
6dc06f08 | 88 | #define GET_EVENT_STATUS_NOTIFICATION 0x4a |
0d65e1f8 GH |
89 | #define LOG_SELECT 0x4c |
90 | #define LOG_SENSE 0x4d | |
1a4f0c3a | 91 | #define READ_DISC_INFORMATION 0x51 |
00a01ad4 | 92 | #define RESERVE_TRACK 0x53 |
0d65e1f8 GH |
93 | #define MODE_SELECT_10 0x55 |
94 | #define RESERVE_10 0x56 | |
95 | #define RELEASE_10 0x57 | |
96 | #define MODE_SENSE_10 0x5a | |
00a01ad4 | 97 | #define SEND_CUE_SHEET 0x5d |
0d65e1f8 GH |
98 | #define PERSISTENT_RESERVE_IN 0x5e |
99 | #define PERSISTENT_RESERVE_OUT 0x5f | |
5e30a07d HR |
100 | #define VARLENGTH_CDB 0x7f |
101 | #define WRITE_FILEMARKS_16 0x80 | |
065c2599 | 102 | #define READ_REVERSE_16 0x81 |
00a01ad4 | 103 | #define ALLOW_OVERWRITE 0x82 |
5e30a07d | 104 | #define EXTENDED_COPY 0x83 |
e4b65262 | 105 | #define ATA_PASSTHROUGH_16 0x85 |
5e30a07d HR |
106 | #define ACCESS_CONTROL_IN 0x86 |
107 | #define ACCESS_CONTROL_OUT 0x87 | |
108 | #define READ_16 0x88 | |
109 | #define COMPARE_AND_WRITE 0x89 | |
110 | #define WRITE_16 0x8a | |
111 | #define WRITE_VERIFY_16 0x8e | |
112 | #define VERIFY_16 0x8f | |
00a01ad4 PB |
113 | #define PRE_FETCH_16 0x90 |
114 | #define SPACE_16 0x91 | |
5e30a07d HR |
115 | #define SYNCHRONIZE_CACHE_16 0x91 |
116 | #define LOCATE_16 0x92 | |
ea3bd56f | 117 | #define WRITE_SAME_16 0x93 |
5e30a07d | 118 | #define ERASE_16 0x93 |
f6515262 | 119 | #define SERVICE_ACTION_IN_16 0x9e |
5e30a07d HR |
120 | #define WRITE_LONG_16 0x9f |
121 | #define REPORT_LUNS 0xa0 | |
e4b65262 | 122 | #define ATA_PASSTHROUGH_12 0xa1 |
c7126d5b NB |
123 | #define MAINTENANCE_IN 0xa3 |
124 | #define MAINTENANCE_OUT 0xa4 | |
0d65e1f8 | 125 | #define MOVE_MEDIUM 0xa5 |
40723a99 | 126 | #define EXCHANGE_MEDIUM 0xa6 |
00a01ad4 | 127 | #define SET_READ_AHEAD 0xa7 |
0d65e1f8 GH |
128 | #define READ_12 0xa8 |
129 | #define WRITE_12 0xaa | |
f6515262 | 130 | #define SERVICE_ACTION_IN_12 0xab |
00a01ad4 | 131 | #define ERASE_12 0xac |
b6c251ab | 132 | #define READ_DVD_STRUCTURE 0xad |
0d65e1f8 | 133 | #define WRITE_VERIFY_12 0xae |
5e30a07d | 134 | #define VERIFY_12 0xaf |
0d65e1f8 GH |
135 | #define SEARCH_HIGH_12 0xb0 |
136 | #define SEARCH_EQUAL_12 0xb1 | |
137 | #define SEARCH_LOW_12 0xb2 | |
138 | #define READ_ELEMENT_STATUS 0xb8 | |
139 | #define SEND_VOLUME_TAG 0xb6 | |
5e30a07d HR |
140 | #define READ_DEFECT_DATA_12 0xb7 |
141 | #define SET_CD_SPEED 0xbb | |
b6c251ab PB |
142 | #define MECHANISM_STATUS 0xbd |
143 | #define READ_CD 0xbe | |
00a01ad4 | 144 | #define SEND_DVD_STRUCTURE 0xbf |
0d65e1f8 | 145 | |
b9e77bc7 AK |
146 | const char *scsi_command_name(uint8_t cmd); |
147 | ||
f6515262 PB |
148 | /* |
149 | * SERVICE ACTION IN subcodes | |
150 | */ | |
151 | #define SAI_READ_CAPACITY_16 0x10 | |
152 | ||
9ce1bb2d CH |
153 | /* |
154 | * READ POSITION service action codes | |
155 | */ | |
156 | #define SHORT_FORM_BLOCK_ID 0x00 | |
157 | #define SHORT_FORM_VENDOR_SPECIFIC 0x01 | |
158 | #define LONG_FORM 0x06 | |
159 | #define EXTENDED_FORM 0x08 | |
160 | ||
0d65e1f8 | 161 | /* |
f0171327 | 162 | * SAM Status codes |
0d65e1f8 GH |
163 | */ |
164 | ||
165 | #define GOOD 0x00 | |
f0171327 HR |
166 | #define CHECK_CONDITION 0x02 |
167 | #define CONDITION_GOOD 0x04 | |
168 | #define BUSY 0x08 | |
169 | #define INTERMEDIATE_GOOD 0x10 | |
170 | #define INTERMEDIATE_C_GOOD 0x14 | |
171 | #define RESERVATION_CONFLICT 0x18 | |
172 | #define COMMAND_TERMINATED 0x22 | |
173 | #define TASK_SET_FULL 0x28 | |
174 | #define ACA_ACTIVE 0x30 | |
175 | #define TASK_ABORTED 0x40 | |
0d65e1f8 GH |
176 | |
177 | #define STATUS_MASK 0x3e | |
178 | ||
179 | /* | |
180 | * SENSE KEYS | |
181 | */ | |
182 | ||
183 | #define NO_SENSE 0x00 | |
184 | #define RECOVERED_ERROR 0x01 | |
185 | #define NOT_READY 0x02 | |
186 | #define MEDIUM_ERROR 0x03 | |
187 | #define HARDWARE_ERROR 0x04 | |
188 | #define ILLEGAL_REQUEST 0x05 | |
189 | #define UNIT_ATTENTION 0x06 | |
190 | #define DATA_PROTECT 0x07 | |
191 | #define BLANK_CHECK 0x08 | |
192 | #define COPY_ABORTED 0x0a | |
193 | #define ABORTED_COMMAND 0x0b | |
194 | #define VOLUME_OVERFLOW 0x0d | |
195 | #define MISCOMPARE 0x0e | |
196 | ||
197 | ||
198 | /* | |
199 | * DEVICE TYPES | |
200 | */ | |
201 | ||
202 | #define TYPE_DISK 0x00 | |
203 | #define TYPE_TAPE 0x01 | |
f37bd73b | 204 | #define TYPE_PRINTER 0x02 |
0d65e1f8 GH |
205 | #define TYPE_PROCESSOR 0x03 /* HP scanners use this */ |
206 | #define TYPE_WORM 0x04 /* Treated as ROM by our system */ | |
207 | #define TYPE_ROM 0x05 | |
208 | #define TYPE_SCANNER 0x06 | |
209 | #define TYPE_MOD 0x07 /* Magneto-optical disk - | |
210 | * - treated as TYPE_DISK */ | |
211 | #define TYPE_MEDIUM_CHANGER 0x08 | |
f37bd73b HR |
212 | #define TYPE_STORAGE_ARRAY 0x0c /* Storage array device */ |
213 | #define TYPE_ENCLOSURE 0x0d /* Enclosure Services Device */ | |
214 | #define TYPE_RBC 0x0e /* Simplified Direct-Access Device */ | |
215 | #define TYPE_OSD 0x11 /* Object-storage Device */ | |
fdaef069 PB |
216 | #define TYPE_WLUN 0x1e /* Well known LUN */ |
217 | #define TYPE_NOT_PRESENT 0x1f | |
218 | #define TYPE_INACTIVE 0x20 | |
0d65e1f8 GH |
219 | #define TYPE_NO_LUN 0x7f |
220 | ||
67cc61e4 PB |
221 | /* Mode page codes for mode sense/set */ |
222 | #define MODE_PAGE_R_W_ERROR 0x01 | |
223 | #define MODE_PAGE_HD_GEOMETRY 0x04 | |
224 | #define MODE_PAGE_FLEXIBLE_DISK_GEOMETRY 0x05 | |
225 | #define MODE_PAGE_CACHING 0x08 | |
226 | #define MODE_PAGE_AUDIO_CTL 0x0e | |
227 | #define MODE_PAGE_POWER 0x1a | |
228 | #define MODE_PAGE_FAULT_FAIL 0x1c | |
229 | #define MODE_PAGE_TO_PROTECT 0x1d | |
230 | #define MODE_PAGE_CAPABILITIES 0x2a | |
231 | #define MODE_PAGE_ALLS 0x3f | |
232 | /* Not in Mt. Fuji, but in ATAPI 2.6 -- depricated now in favor | |
233 | * of MODE_PAGE_SENSE_POWER */ | |
234 | #define MODE_PAGE_CDROM 0x0d | |
235 | ||
f0f992e6 PB |
236 | /* Event notification classes for GET EVENT STATUS NOTIFICATION */ |
237 | #define GESN_NO_EVENTS 0 | |
238 | #define GESN_OPERATIONAL_CHANGE 1 | |
239 | #define GESN_POWER_MANAGEMENT 2 | |
240 | #define GESN_EXTERNAL_REQUEST 3 | |
241 | #define GESN_MEDIA 4 | |
242 | #define GESN_MULTIPLE_HOSTS 5 | |
243 | #define GESN_DEVICE_BUSY 6 | |
244 | ||
245 | /* Event codes for MEDIA event status notification */ | |
246 | #define MEC_NO_CHANGE 0 | |
247 | #define MEC_EJECT_REQUESTED 1 | |
248 | #define MEC_NEW_MEDIA 2 | |
249 | #define MEC_MEDIA_REMOVAL 3 /* only for media changers */ | |
250 | #define MEC_MEDIA_CHANGED 4 /* only for media changers */ | |
251 | #define MEC_BG_FORMAT_COMPLETED 5 /* MRW or DVD+RW b/g format completed */ | |
252 | #define MEC_BG_FORMAT_RESTARTED 6 /* MRW or DVD+RW b/g format restarted */ | |
253 | ||
254 | #define MS_TRAY_OPEN 1 | |
255 | #define MS_MEDIA_PRESENT 2 | |
256 | ||
67cc61e4 PB |
257 | /* |
258 | * Based on values from <linux/cdrom.h> but extending CD_MINS | |
259 | * to the maximum common size allowed by the Orange's Book ATIP | |
260 | * | |
261 | * 90 and 99 min CDs are also available but using them as the | |
262 | * upper limit reduces the effectiveness of the heuristic to | |
263 | * detect DVDs burned to less than 25% of their maximum capacity | |
264 | */ | |
265 | ||
266 | /* Some generally useful CD-ROM information */ | |
267 | #define CD_MINS 80 /* max. minutes per CD */ | |
268 | #define CD_SECS 60 /* seconds per minute */ | |
269 | #define CD_FRAMES 75 /* frames per second */ | |
270 | #define CD_FRAMESIZE 2048 /* bytes per frame, "cooked" mode */ | |
271 | #define CD_MAX_BYTES (CD_MINS * CD_SECS * CD_FRAMES * CD_FRAMESIZE) | |
272 | #define CD_MAX_SECTORS (CD_MAX_BYTES / 512) | |
273 | ||
274 | /* | |
275 | * The MMC values are not IDE specific and might need to be moved | |
276 | * to a common header if they are also needed for the SCSI emulation | |
277 | */ | |
278 | ||
279 | /* Profile list from MMC-6 revision 1 table 91 */ | |
280 | #define MMC_PROFILE_NONE 0x0000 | |
281 | #define MMC_PROFILE_CD_ROM 0x0008 | |
282 | #define MMC_PROFILE_CD_R 0x0009 | |
283 | #define MMC_PROFILE_CD_RW 0x000A | |
284 | #define MMC_PROFILE_DVD_ROM 0x0010 | |
285 | #define MMC_PROFILE_DVD_R_SR 0x0011 | |
286 | #define MMC_PROFILE_DVD_RAM 0x0012 | |
287 | #define MMC_PROFILE_DVD_RW_RO 0x0013 | |
288 | #define MMC_PROFILE_DVD_RW_SR 0x0014 | |
289 | #define MMC_PROFILE_DVD_R_DL_SR 0x0015 | |
290 | #define MMC_PROFILE_DVD_R_DL_JR 0x0016 | |
291 | #define MMC_PROFILE_DVD_RW_DL 0x0017 | |
292 | #define MMC_PROFILE_DVD_DDR 0x0018 | |
293 | #define MMC_PROFILE_DVD_PLUS_RW 0x001A | |
294 | #define MMC_PROFILE_DVD_PLUS_R 0x001B | |
295 | #define MMC_PROFILE_DVD_PLUS_RW_DL 0x002A | |
296 | #define MMC_PROFILE_DVD_PLUS_R_DL 0x002B | |
297 | #define MMC_PROFILE_BD_ROM 0x0040 | |
298 | #define MMC_PROFILE_BD_R_SRM 0x0041 | |
299 | #define MMC_PROFILE_BD_R_RRM 0x0042 | |
300 | #define MMC_PROFILE_BD_RE 0x0043 | |
301 | #define MMC_PROFILE_HDDVD_ROM 0x0050 | |
302 | #define MMC_PROFILE_HDDVD_R 0x0051 | |
303 | #define MMC_PROFILE_HDDVD_RAM 0x0052 | |
304 | #define MMC_PROFILE_HDDVD_RW 0x0053 | |
305 | #define MMC_PROFILE_HDDVD_R_DL 0x0058 | |
306 | #define MMC_PROFILE_HDDVD_RW_DL 0x005A | |
307 | #define MMC_PROFILE_INVALID 0xFFFF | |
cb9c377f PB |
308 | |
309 | #endif |