Statistics
| Branch: | Revision:

root / hw / scsi-defs.h @ 9077f01b

History | View | Annotate | Download (10.3 kB)

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
15
   License along with this library; if not, see <http://www.gnu.org/licenses/>.
16
*/
17

    
18
/*
19
 * This header file contains public constants and structures used by
20
 * the scsi code for linux.
21
 */
22

    
23
/*
24
 *      SCSI opcodes
25
 */
26

    
27
#define TEST_UNIT_READY       0x00
28
#define REWIND                0x01
29
#define REQUEST_SENSE         0x03
30
#define FORMAT_UNIT           0x04
31
#define READ_BLOCK_LIMITS     0x05
32
#define REASSIGN_BLOCKS       0x07
33
#define READ_6                0x08
34
#define WRITE_6               0x0a
35
#define SET_CAPACITY          0x0b
36
#define READ_REVERSE          0x0f
37
#define WRITE_FILEMARKS       0x10
38
#define SPACE                 0x11
39
#define INQUIRY               0x12
40
#define RECOVER_BUFFERED_DATA 0x14
41
#define MODE_SELECT           0x15
42
#define RESERVE               0x16
43
#define RELEASE               0x17
44
#define COPY                  0x18
45
#define ERASE                 0x19
46
#define MODE_SENSE            0x1a
47
#define START_STOP            0x1b
48
#define RECEIVE_DIAGNOSTIC    0x1c
49
#define SEND_DIAGNOSTIC       0x1d
50
#define ALLOW_MEDIUM_REMOVAL  0x1e
51
#define READ_CAPACITY_10      0x25
52
#define READ_10               0x28
53
#define WRITE_10              0x2a
54
#define SEEK_10               0x2b
55
#define LOCATE_10             0x2b
56
#define WRITE_VERIFY_10       0x2e
57
#define VERIFY_10             0x2f
58
#define SEARCH_HIGH           0x30
59
#define SEARCH_EQUAL          0x31
60
#define SEARCH_LOW            0x32
61
#define SET_LIMITS            0x33
62
#define PRE_FETCH             0x34
63
#define READ_POSITION         0x34
64
#define SYNCHRONIZE_CACHE     0x35
65
#define LOCK_UNLOCK_CACHE     0x36
66
#define READ_DEFECT_DATA      0x37
67
#define MEDIUM_SCAN           0x38
68
#define COMPARE               0x39
69
#define COPY_VERIFY           0x3a
70
#define WRITE_BUFFER          0x3b
71
#define READ_BUFFER           0x3c
72
#define UPDATE_BLOCK          0x3d
73
#define READ_LONG_10          0x3e
74
#define WRITE_LONG_10         0x3f
75
#define CHANGE_DEFINITION     0x40
76
#define WRITE_SAME_10         0x41
77
#define UNMAP                 0x42
78
#define READ_TOC              0x43
79
#define REPORT_DENSITY_SUPPORT 0x44
80
#define GET_CONFIGURATION     0x46
81
#define SANITIZE              0x48
82
#define GET_EVENT_STATUS_NOTIFICATION 0x4a
83
#define LOG_SELECT            0x4c
84
#define LOG_SENSE             0x4d
85
#define RESERVE_TRACK         0x53
86
#define MODE_SELECT_10        0x55
87
#define RESERVE_10            0x56
88
#define RELEASE_10            0x57
89
#define MODE_SENSE_10         0x5a
90
#define SEND_CUE_SHEET        0x5d
91
#define PERSISTENT_RESERVE_IN 0x5e
92
#define PERSISTENT_RESERVE_OUT 0x5f
93
#define VARLENGTH_CDB         0x7f
94
#define WRITE_FILEMARKS_16    0x80
95
#define READ_REVERSE_16       0x81
96
#define ALLOW_OVERWRITE       0x82
97
#define EXTENDED_COPY         0x83
98
#define ATA_PASSTHROUGH       0x85
99
#define ACCESS_CONTROL_IN     0x86
100
#define ACCESS_CONTROL_OUT    0x87
101
#define READ_16               0x88
102
#define COMPARE_AND_WRITE     0x89
103
#define WRITE_16              0x8a
104
#define WRITE_VERIFY_16       0x8e
105
#define VERIFY_16             0x8f
106
#define PRE_FETCH_16          0x90
107
#define SPACE_16              0x91
108
#define SYNCHRONIZE_CACHE_16  0x91
109
#define LOCATE_16             0x92
110
#define WRITE_SAME_16         0x93
111
#define ERASE_16              0x93
112
#define SERVICE_ACTION_IN_16  0x9e
113
#define WRITE_LONG_16         0x9f
114
#define REPORT_LUNS           0xa0
115
#define BLANK                 0xa1
116
#define MAINTENANCE_IN        0xa3
117
#define MAINTENANCE_OUT       0xa4
118
#define MOVE_MEDIUM           0xa5
119
#define LOAD_UNLOAD           0xa6
120
#define SET_READ_AHEAD        0xa7
121
#define READ_12               0xa8
122
#define WRITE_12              0xaa
123
#define SERVICE_ACTION_IN_12  0xab
124
#define ERASE_12              0xac
125
#define READ_DVD_STRUCTURE    0xad
126
#define WRITE_VERIFY_12       0xae
127
#define VERIFY_12             0xaf
128
#define SEARCH_HIGH_12        0xb0
129
#define SEARCH_EQUAL_12       0xb1
130
#define SEARCH_LOW_12         0xb2
131
#define READ_ELEMENT_STATUS   0xb8
132
#define SEND_VOLUME_TAG       0xb6
133
#define READ_DEFECT_DATA_12   0xb7
134
#define SET_CD_SPEED          0xbb
135
#define MECHANISM_STATUS      0xbd
136
#define READ_CD               0xbe
137
#define SEND_DVD_STRUCTURE    0xbf
138

    
139
/*
140
 * SERVICE ACTION IN subcodes
141
 */
142
#define SAI_READ_CAPACITY_16  0x10
143

    
144
/*
145
 *  SAM Status codes
146
 */
147

    
148
#define GOOD                 0x00
149
#define CHECK_CONDITION      0x02
150
#define CONDITION_GOOD       0x04
151
#define BUSY                 0x08
152
#define INTERMEDIATE_GOOD    0x10
153
#define INTERMEDIATE_C_GOOD  0x14
154
#define RESERVATION_CONFLICT 0x18
155
#define COMMAND_TERMINATED   0x22
156
#define TASK_SET_FULL        0x28
157
#define ACA_ACTIVE           0x30
158
#define TASK_ABORTED         0x40
159

    
160
#define STATUS_MASK          0x3e
161

    
162
/*
163
 *  SENSE KEYS
164
 */
165

    
166
#define NO_SENSE            0x00
167
#define RECOVERED_ERROR     0x01
168
#define NOT_READY           0x02
169
#define MEDIUM_ERROR        0x03
170
#define HARDWARE_ERROR      0x04
171
#define ILLEGAL_REQUEST     0x05
172
#define UNIT_ATTENTION      0x06
173
#define DATA_PROTECT        0x07
174
#define BLANK_CHECK         0x08
175
#define COPY_ABORTED        0x0a
176
#define ABORTED_COMMAND     0x0b
177
#define VOLUME_OVERFLOW     0x0d
178
#define MISCOMPARE          0x0e
179

    
180

    
181
/*
182
 *  DEVICE TYPES
183
 */
184

    
185
#define TYPE_DISK           0x00
186
#define TYPE_TAPE           0x01
187
#define TYPE_PRINTER        0x02
188
#define TYPE_PROCESSOR      0x03    /* HP scanners use this */
189
#define TYPE_WORM           0x04    /* Treated as ROM by our system */
190
#define TYPE_ROM            0x05
191
#define TYPE_SCANNER        0x06
192
#define TYPE_MOD            0x07    /* Magneto-optical disk -
193
                                     * - treated as TYPE_DISK */
194
#define TYPE_MEDIUM_CHANGER 0x08
195
#define TYPE_STORAGE_ARRAY  0x0c    /* Storage array device */
196
#define TYPE_ENCLOSURE      0x0d    /* Enclosure Services Device */
197
#define TYPE_RBC            0x0e    /* Simplified Direct-Access Device */
198
#define TYPE_OSD            0x11    /* Object-storage Device */
199
#define TYPE_WLUN           0x1e    /* Well known LUN */
200
#define TYPE_NOT_PRESENT    0x1f
201
#define TYPE_INACTIVE       0x20
202
#define TYPE_NO_LUN         0x7f
203

    
204
/* Mode page codes for mode sense/set */
205
#define MODE_PAGE_R_W_ERROR                   0x01
206
#define MODE_PAGE_HD_GEOMETRY                 0x04
207
#define MODE_PAGE_FLEXIBLE_DISK_GEOMETRY      0x05
208
#define MODE_PAGE_CACHING                     0x08
209
#define MODE_PAGE_AUDIO_CTL                   0x0e
210
#define MODE_PAGE_POWER                       0x1a
211
#define MODE_PAGE_FAULT_FAIL                  0x1c
212
#define MODE_PAGE_TO_PROTECT                  0x1d
213
#define MODE_PAGE_CAPABILITIES                0x2a
214
#define MODE_PAGE_ALLS                        0x3f
215
/* Not in Mt. Fuji, but in ATAPI 2.6 -- depricated now in favor
216
 * of MODE_PAGE_SENSE_POWER */
217
#define MODE_PAGE_CDROM                       0x0d
218

    
219
/* Event notification classes for GET EVENT STATUS NOTIFICATION */
220
#define GESN_NO_EVENTS                0
221
#define GESN_OPERATIONAL_CHANGE       1
222
#define GESN_POWER_MANAGEMENT         2
223
#define GESN_EXTERNAL_REQUEST         3
224
#define GESN_MEDIA                    4
225
#define GESN_MULTIPLE_HOSTS           5
226
#define GESN_DEVICE_BUSY              6
227

    
228
/* Event codes for MEDIA event status notification */
229
#define MEC_NO_CHANGE                 0
230
#define MEC_EJECT_REQUESTED           1
231
#define MEC_NEW_MEDIA                 2
232
#define MEC_MEDIA_REMOVAL             3 /* only for media changers */
233
#define MEC_MEDIA_CHANGED             4 /* only for media changers */
234
#define MEC_BG_FORMAT_COMPLETED       5 /* MRW or DVD+RW b/g format completed */
235
#define MEC_BG_FORMAT_RESTARTED       6 /* MRW or DVD+RW b/g format restarted */
236

    
237
#define MS_TRAY_OPEN                  1
238
#define MS_MEDIA_PRESENT              2
239

    
240
/*
241
 * Based on values from <linux/cdrom.h> but extending CD_MINS
242
 * to the maximum common size allowed by the Orange's Book ATIP
243
 *
244
 * 90 and 99 min CDs are also available but using them as the
245
 * upper limit reduces the effectiveness of the heuristic to
246
 * detect DVDs burned to less than 25% of their maximum capacity
247
 */
248

    
249
/* Some generally useful CD-ROM information */
250
#define CD_MINS                       80 /* max. minutes per CD */
251
#define CD_SECS                       60 /* seconds per minute */
252
#define CD_FRAMES                     75 /* frames per second */
253
#define CD_FRAMESIZE                2048 /* bytes per frame, "cooked" mode */
254
#define CD_MAX_BYTES       (CD_MINS * CD_SECS * CD_FRAMES * CD_FRAMESIZE)
255
#define CD_MAX_SECTORS     (CD_MAX_BYTES / 512)
256

    
257
/*
258
 * The MMC values are not IDE specific and might need to be moved
259
 * to a common header if they are also needed for the SCSI emulation
260
 */
261

    
262
/* Profile list from MMC-6 revision 1 table 91 */
263
#define MMC_PROFILE_NONE                0x0000
264
#define MMC_PROFILE_CD_ROM              0x0008
265
#define MMC_PROFILE_CD_R                0x0009
266
#define MMC_PROFILE_CD_RW               0x000A
267
#define MMC_PROFILE_DVD_ROM             0x0010
268
#define MMC_PROFILE_DVD_R_SR            0x0011
269
#define MMC_PROFILE_DVD_RAM             0x0012
270
#define MMC_PROFILE_DVD_RW_RO           0x0013
271
#define MMC_PROFILE_DVD_RW_SR           0x0014
272
#define MMC_PROFILE_DVD_R_DL_SR         0x0015
273
#define MMC_PROFILE_DVD_R_DL_JR         0x0016
274
#define MMC_PROFILE_DVD_RW_DL           0x0017
275
#define MMC_PROFILE_DVD_DDR             0x0018
276
#define MMC_PROFILE_DVD_PLUS_RW         0x001A
277
#define MMC_PROFILE_DVD_PLUS_R          0x001B
278
#define MMC_PROFILE_DVD_PLUS_RW_DL      0x002A
279
#define MMC_PROFILE_DVD_PLUS_R_DL       0x002B
280
#define MMC_PROFILE_BD_ROM              0x0040
281
#define MMC_PROFILE_BD_R_SRM            0x0041
282
#define MMC_PROFILE_BD_R_RRM            0x0042
283
#define MMC_PROFILE_BD_RE               0x0043
284
#define MMC_PROFILE_HDDVD_ROM           0x0050
285
#define MMC_PROFILE_HDDVD_R             0x0051
286
#define MMC_PROFILE_HDDVD_RAM           0x0052
287
#define MMC_PROFILE_HDDVD_RW            0x0053
288
#define MMC_PROFILE_HDDVD_R_DL          0x0058
289
#define MMC_PROFILE_HDDVD_RW_DL         0x005A
290
#define MMC_PROFILE_INVALID             0xFFFF