File: /usr/src/linux/include/scsi/scsi.h

1     #ifndef _LINUX_SCSI_H
2     #define _LINUX_SCSI_H
3     
4     /*
5      * This header file contains public constants and structures used by
6      * the scsi code for linux.
7      */
8     
9     /*
10         $Header: /usr/src/linux/include/linux/RCS/scsi.h,v 1.3 1993/09/24 12:20:33 drew Exp $
11     
12         For documentation on the OPCODES, MESSAGES, and SENSE values,
13         please consult the SCSI standard.
14     
15     */
16     
17     /*
18      *      SCSI opcodes
19      */
20     
21     #define TEST_UNIT_READY       0x00
22     #define REZERO_UNIT           0x01
23     #define REQUEST_SENSE         0x03
24     #define FORMAT_UNIT           0x04
25     #define READ_BLOCK_LIMITS     0x05
26     #define REASSIGN_BLOCKS       0x07
27     #define READ_6                0x08
28     #define WRITE_6               0x0a
29     #define SEEK_6                0x0b
30     #define READ_REVERSE          0x0f
31     #define WRITE_FILEMARKS       0x10
32     #define SPACE                 0x11
33     #define INQUIRY               0x12
34     #define RECOVER_BUFFERED_DATA 0x14
35     #define MODE_SELECT           0x15
36     #define RESERVE               0x16
37     #define RELEASE               0x17
38     #define COPY                  0x18
39     #define ERASE                 0x19
40     #define MODE_SENSE            0x1a
41     #define START_STOP            0x1b
42     #define RECEIVE_DIAGNOSTIC    0x1c
43     #define SEND_DIAGNOSTIC       0x1d
44     #define ALLOW_MEDIUM_REMOVAL  0x1e
45     
46     #define SET_WINDOW            0x24
47     #define READ_CAPACITY         0x25
48     #define READ_10               0x28
49     #define WRITE_10              0x2a
50     #define SEEK_10               0x2b
51     #define WRITE_VERIFY          0x2e
52     #define VERIFY                0x2f
53     #define SEARCH_HIGH           0x30
54     #define SEARCH_EQUAL          0x31
55     #define SEARCH_LOW            0x32
56     #define SET_LIMITS            0x33
57     #define PRE_FETCH             0x34
58     #define READ_POSITION         0x34
59     #define SYNCHRONIZE_CACHE     0x35
60     #define LOCK_UNLOCK_CACHE     0x36
61     #define READ_DEFECT_DATA      0x37
62     #define MEDIUM_SCAN           0x38
63     #define COMPARE               0x39
64     #define COPY_VERIFY           0x3a
65     #define WRITE_BUFFER          0x3b
66     #define READ_BUFFER           0x3c
67     #define UPDATE_BLOCK          0x3d
68     #define READ_LONG             0x3e
69     #define WRITE_LONG            0x3f
70     #define CHANGE_DEFINITION     0x40
71     #define WRITE_SAME            0x41
72     #define READ_TOC              0x43
73     #define LOG_SELECT            0x4c
74     #define LOG_SENSE             0x4d
75     #define MODE_SELECT_10        0x55
76     #define RESERVE_10            0x56
77     #define RELEASE_10            0x57
78     #define MODE_SENSE_10         0x5a
79     #define PERSISTENT_RESERVE_IN 0x5e
80     #define PERSISTENT_RESERVE_OUT 0x5f
81     #define MOVE_MEDIUM           0xa5
82     #define READ_12               0xa8
83     #define WRITE_12              0xaa
84     #define WRITE_VERIFY_12       0xae
85     #define SEARCH_HIGH_12        0xb0
86     #define SEARCH_EQUAL_12       0xb1
87     #define SEARCH_LOW_12         0xb2
88     #define READ_ELEMENT_STATUS   0xb8
89     #define SEND_VOLUME_TAG       0xb6
90     #define WRITE_LONG_2          0xea
91     
92     /*
93      *  Status codes
94      */
95     
96     #define GOOD                 0x00
97     #define CHECK_CONDITION      0x01
98     #define CONDITION_GOOD       0x02
99     #define BUSY                 0x04
100     #define INTERMEDIATE_GOOD    0x08
101     #define INTERMEDIATE_C_GOOD  0x0a
102     #define RESERVATION_CONFLICT 0x0c
103     #define COMMAND_TERMINATED   0x11
104     #define QUEUE_FULL           0x14
105     
106     #define STATUS_MASK          0x3e
107     
108     /*
109      *  SENSE KEYS
110      */
111     
112     #define NO_SENSE            0x00
113     #define RECOVERED_ERROR     0x01
114     #define NOT_READY           0x02
115     #define MEDIUM_ERROR        0x03
116     #define HARDWARE_ERROR      0x04
117     #define ILLEGAL_REQUEST     0x05
118     #define UNIT_ATTENTION      0x06
119     #define DATA_PROTECT        0x07
120     #define BLANK_CHECK         0x08
121     #define COPY_ABORTED        0x0a
122     #define ABORTED_COMMAND     0x0b
123     #define VOLUME_OVERFLOW     0x0d
124     #define MISCOMPARE          0x0e
125     
126     
127     /*
128      *  DEVICE TYPES
129      */
130     
131     #define TYPE_DISK           0x00
132     #define TYPE_TAPE           0x01
133     #define TYPE_PROCESSOR      0x03    /* HP scanners use this */
134     #define TYPE_WORM           0x04    /* Treated as ROM by our system */
135     #define TYPE_ROM            0x05
136     #define TYPE_SCANNER        0x06
137     #define TYPE_MOD            0x07    /* Magneto-optical disk - 
138     				     * - treated as TYPE_DISK */
139     #define TYPE_MEDIUM_CHANGER 0x08
140     #define TYPE_COMM           0x09    /* Communications device */
141     #define TYPE_ENCLOSURE      0x0d    /* Enclosure Services Device */
142     #define TYPE_NO_LUN         0x7f
143     
144     /*
145      * standard mode-select header prepended to all mode-select commands
146      *
147      * moved here from cdrom.h -- kraxel
148      */
149     
150     struct ccs_modesel_head
151     {
152         u_char  _r1;    /* reserved */
153         u_char  medium; /* device-specific medium type */
154         u_char  _r2;    /* reserved */
155         u_char  block_desc_length; /* block descriptor length */
156         u_char  density; /* device-specific density code */
157         u_char  number_blocks_hi; /* number of blocks in this block desc */
158         u_char  number_blocks_med;
159         u_char  number_blocks_lo;
160         u_char  _r3;
161         u_char  block_length_hi; /* block length for blocks in this desc */
162         u_char  block_length_med;
163         u_char  block_length_lo;
164     };
165     
166     /*
167      *  MESSAGE CODES
168      */
169     
170     #define COMMAND_COMPLETE    0x00
171     #define EXTENDED_MESSAGE    0x01
172     #define     EXTENDED_MODIFY_DATA_POINTER    0x00
173     #define     EXTENDED_SDTR                   0x01
174     #define     EXTENDED_EXTENDED_IDENTIFY      0x02    /* SCSI-I only */
175     #define     EXTENDED_WDTR                   0x03
176     #define SAVE_POINTERS       0x02
177     #define RESTORE_POINTERS    0x03
178     #define DISCONNECT          0x04
179     #define INITIATOR_ERROR     0x05
180     #define ABORT               0x06
181     #define MESSAGE_REJECT      0x07
182     #define NOP                 0x08
183     #define MSG_PARITY_ERROR    0x09
184     #define LINKED_CMD_COMPLETE 0x0a
185     #define LINKED_FLG_CMD_COMPLETE 0x0b
186     #define BUS_DEVICE_RESET    0x0c
187     
188     #define INITIATE_RECOVERY   0x0f            /* SCSI-II only */
189     #define RELEASE_RECOVERY    0x10            /* SCSI-II only */
190     
191     #define SIMPLE_QUEUE_TAG    0x20
192     #define HEAD_OF_QUEUE_TAG   0x21
193     #define ORDERED_QUEUE_TAG   0x22
194     
195     /*
196      * Here are some scsi specific ioctl commands which are sometimes useful.
197      */
198     /* These are a few other constants  only used by scsi  devices */
199     /* Note that include/linux/cdrom.h also defines IOCTL 0x5300 - 0x5395 */
200     
201     #define SCSI_IOCTL_GET_IDLUN 0x5382	/* conflicts with CDROMAUDIOBUFSIZ */
202     
203     /* Used to turn on and off tagged queuing for scsi devices */
204     
205     #define SCSI_IOCTL_TAGGED_ENABLE 0x5383
206     #define SCSI_IOCTL_TAGGED_DISABLE 0x5384
207     
208     /* Used to obtain the host number of a device. */
209     #define SCSI_IOCTL_PROBE_HOST 0x5385
210     
211     /* Used to get the bus number for a device */
212     #define SCSI_IOCTL_GET_BUS_NUMBER 0x5386
213     
214     /* Used to get the PCI location of a device */
215     #define SCSI_IOCTL_GET_PCI 0x5387
216     
217     /*
218      * Overrides for Emacs so that we follow Linus's tabbing style.
219      * Emacs will notice this stuff at the end of the file and automatically
220      * adjust the settings for this buffer only.  This must remain at the end
221      * of the file.
222      * ---------------------------------------------------------------------------
223      * Local variables:
224      * c-indent-level: 4 
225      * c-brace-imaginary-offset: 0
226      * c-brace-offset: -4
227      * c-argdecl-indent: 4
228      * c-label-offset: -4
229      * c-continued-statement-offset: 4
230      * c-continued-brace-offset: 0
231      * indent-tabs-mode: nil
232      * tab-width: 8
233      * End:
234      */
235     
236     #endif
237