Implement new v3_memalloc romvec interface for allocating aligned memory.
[openbios.git] / drivers / scsi.h
blobcb975fc707f9e253d76651a2c023f695ca9624d7
1 #ifndef _LINUX_SCSI_H
2 #define _LINUX_SCSI_H
4 /*
5 * This header file contains public constants and structures used by
6 * the scsi code for linux.
7 */
9 /*
10 $Header: /usr/src/linux/include/linux/RCS/scsi.h,v 1.3 1993/09/24 12:20:33 drew Exp $
12 For documentation on the OPCODES, MESSAGES, and SENSE values,
13 please consult the SCSI standard.
18 * SCSI opcodes
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
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 REPORT_LUNS 0xa0
82 #define MOVE_MEDIUM 0xa5
83 #define READ_12 0xa8
84 #define WRITE_12 0xaa
85 #define WRITE_VERIFY_12 0xae
86 #define SEARCH_HIGH_12 0xb0
87 #define SEARCH_EQUAL_12 0xb1
88 #define SEARCH_LOW_12 0xb2
89 #define READ_ELEMENT_STATUS 0xb8
90 #define SEND_VOLUME_TAG 0xb6
91 #define WRITE_LONG_2 0xea
92 #define READ_16 0x88
93 #define WRITE_16 0x8a
94 #define VERIFY_16 0x8f
95 #define SERVICE_ACTION_IN 0x9e
96 /* values for service action in */
97 #define SAI_READ_CAPACITY_16 0x10
99 #define SCSI_RETRY_10(c) ((c) == READ_6 || (c) == WRITE_6 || (c) == SEEK_6)
102 * SCSI Architecture Model (SAM) Status codes. Taken from SAM-3 draft
103 * T10/1561-D Revision 4 Draft dated 7th November 2002.
105 #define SAM_STAT_GOOD 0x00
106 #define SAM_STAT_CHECK_CONDITION 0x02
107 #define SAM_STAT_CONDITION_MET 0x04
108 #define SAM_STAT_BUSY 0x08
109 #define SAM_STAT_INTERMEDIATE 0x10
110 #define SAM_STAT_INTERMEDIATE_CONDITION_MET 0x14
111 #define SAM_STAT_RESERVATION_CONFLICT 0x18
112 #define SAM_STAT_COMMAND_TERMINATED 0x22 /* obsolete in SAM-3 */
113 #define SAM_STAT_TASK_SET_FULL 0x28
114 #define SAM_STAT_ACA_ACTIVE 0x30
115 #define SAM_STAT_TASK_ABORTED 0x40
118 * Status codes
121 #define GOOD 0x00
122 #define CHECK_CONDITION 0x01
123 #define CONDITION_GOOD 0x02
124 #define BUSY 0x04
125 #define INTERMEDIATE_GOOD 0x08
126 #define INTERMEDIATE_C_GOOD 0x0a
127 #define RESERVATION_CONFLICT 0x0c
128 #define COMMAND_TERMINATED 0x11
129 #define QUEUE_FULL 0x14
131 #define STATUS_MASK 0x3e
134 * SENSE KEYS
137 #define NO_SENSE 0x00
138 #define RECOVERED_ERROR 0x01
139 #define NOT_READY 0x02
140 #define MEDIUM_ERROR 0x03
141 #define HARDWARE_ERROR 0x04
142 #define ILLEGAL_REQUEST 0x05
143 #define UNIT_ATTENTION 0x06
144 #define DATA_PROTECT 0x07
145 #define BLANK_CHECK 0x08
146 #define COPY_ABORTED 0x0a
147 #define ABORTED_COMMAND 0x0b
148 #define VOLUME_OVERFLOW 0x0d
149 #define MISCOMPARE 0x0e
153 * DEVICE TYPES
156 #define TYPE_DISK 0x00
157 #define TYPE_TAPE 0x01
158 #define TYPE_PRINTER 0x02
159 #define TYPE_PROCESSOR 0x03 /* HP scanners use this */
160 #define TYPE_WORM 0x04 /* Treated as ROM by our system */
161 #define TYPE_ROM 0x05
162 #define TYPE_SCANNER 0x06
163 #define TYPE_MOD 0x07 /* Magneto-optical disk -
164 * - treated as TYPE_DISK */
165 #define TYPE_MEDIUM_CHANGER 0x08
166 #define TYPE_COMM 0x09 /* Communications device */
167 #define TYPE_ENCLOSURE 0x0d /* Enclosure Services Device */
168 #define TYPE_NO_LUN 0x7f
171 * standard mode-select header prepended to all mode-select commands
173 * moved here from cdrom.h -- kraxel
176 struct ccs_modesel_head
178 uint8_t _r1; /* reserved */
179 uint8_t medium; /* device-specific medium type */
180 uint8_t _r2; /* reserved */
181 uint8_t block_desc_length; /* block descriptor length */
182 uint8_t density; /* device-specific density code */
183 uint8_t number_blocks_hi; /* number of blocks in this block desc */
184 uint8_t number_blocks_med;
185 uint8_t number_blocks_lo;
186 uint8_t _r3;
187 uint8_t block_length_hi; /* block length for blocks in this desc */
188 uint8_t block_length_med;
189 uint8_t block_length_lo;
193 * MESSAGE CODES
196 #define COMMAND_COMPLETE 0x00
197 #define EXTENDED_MESSAGE 0x01
198 #define EXTENDED_MODIFY_DATA_POINTER 0x00
199 #define EXTENDED_SDTR 0x01
200 #define EXTENDED_EXTENDED_IDENTIFY 0x02 /* SCSI-I only */
201 #define EXTENDED_WDTR 0x03
202 #define SAVE_POINTERS 0x02
203 #define RESTORE_POINTERS 0x03
204 #define DISCONNECT 0x04
205 #define INITIATOR_ERROR 0x05
206 #define ABORT 0x06
207 #define MESSAGE_REJECT 0x07
208 #define NOP 0x08
209 #define MSG_PARITY_ERROR 0x09
210 #define LINKED_CMD_COMPLETE 0x0a
211 #define LINKED_FLG_CMD_COMPLETE 0x0b
212 #define BUS_DEVICE_RESET 0x0c
214 #define INITIATE_RECOVERY 0x0f /* SCSI-II only */
215 #define RELEASE_RECOVERY 0x10 /* SCSI-II only */
217 #define SIMPLE_QUEUE_TAG 0x20
218 #define HEAD_OF_QUEUE_TAG 0x21
219 #define ORDERED_QUEUE_TAG 0x22
222 * Here are some scsi specific ioctl commands which are sometimes useful.
224 /* These are a few other constants only used by scsi devices */
225 /* Note that include/linux/cdrom.h also defines IOCTL 0x5300 - 0x5395 */
227 #define SCSI_IOCTL_GET_IDLUN 0x5382 /* conflicts with CDROMAUDIOBUFSIZ */
229 /* Used to turn on and off tagged queuing for scsi devices */
231 #define SCSI_IOCTL_TAGGED_ENABLE 0x5383
232 #define SCSI_IOCTL_TAGGED_DISABLE 0x5384
234 /* Used to obtain the host number of a device. */
235 #define SCSI_IOCTL_PROBE_HOST 0x5385
237 /* Used to get the bus number for a device */
238 #define SCSI_IOCTL_GET_BUS_NUMBER 0x5386
240 /* Used to get the PCI location of a device */
241 #define SCSI_IOCTL_GET_PCI 0x5387
244 * Overrides for Emacs so that we follow Linus's tabbing style.
245 * Emacs will notice this stuff at the end of the file and automatically
246 * adjust the settings for this buffer only. This must remain at the end
247 * of the file.
248 * ---------------------------------------------------------------------------
249 * Local variables:
250 * c-indent-level: 4
251 * c-brace-imaginary-offset: 0
252 * c-brace-offset: -4
253 * c-argdecl-indent: 4
254 * c-label-offset: -4
255 * c-continued-statement-offset: 4
256 * c-continued-brace-offset: 0
257 * indent-tabs-mode: nil
258 * tab-width: 8
259 * End:
262 #endif