ispmbox.h revision 1.2 1 1.2 cgd /* $NetBSD: ispmbox.h,v 1.2 1997/03/12 21:06:57 cgd Exp $ */
2 1.1 cgd
3 1.1 cgd /*
4 1.1 cgd * Mailbox and Command Definitions for for Qlogic ISP SCSI adapters.
5 1.1 cgd *
6 1.2 cgd * Copyright (c) 1997 by Matthew Jacob
7 1.2 cgd * NASA/Ames Research Center
8 1.1 cgd * All rights reserved.
9 1.1 cgd *
10 1.1 cgd * Redistribution and use in source and binary forms, with or without
11 1.1 cgd * modification, are permitted provided that the following conditions
12 1.1 cgd * are met:
13 1.1 cgd * 1. Redistributions of source code must retain the above copyright
14 1.1 cgd * notice immediately at the beginning of the file, without modification,
15 1.1 cgd * this list of conditions, and the following disclaimer.
16 1.1 cgd * 2. Redistributions in binary form must reproduce the above copyright
17 1.1 cgd * notice, this list of conditions and the following disclaimer in the
18 1.1 cgd * documentation and/or other materials provided with the distribution.
19 1.1 cgd * 3. The name of the author may not be used to endorse or promote products
20 1.1 cgd * derived from this software without specific prior written permission.
21 1.1 cgd *
22 1.1 cgd * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
23 1.1 cgd * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 1.1 cgd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 1.1 cgd * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
26 1.1 cgd * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 1.1 cgd * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 1.1 cgd * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 1.1 cgd * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 1.1 cgd * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 1.1 cgd * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 1.1 cgd * SUCH DAMAGE.
33 1.1 cgd */
34 1.2 cgd
35 1.1 cgd #ifndef _ISPMBOX_H
36 1.1 cgd #define _ISPMBOX_H
37 1.1 cgd
38 1.1 cgd /*
39 1.1 cgd * Mailbox Command Opcodes
40 1.1 cgd */
41 1.1 cgd
42 1.1 cgd #define MBOX_NO_OP 0x0000
43 1.1 cgd #define MBOX_LOAD_RAM 0x0001
44 1.1 cgd #define MBOX_EXEC_FIRMWARE 0x0002
45 1.1 cgd #define MBOX_DUMP_RAM 0x0003
46 1.1 cgd #define MBOX_WRITE_RAM_WORD 0x0004
47 1.1 cgd #define MBOX_READ_RAM_WORD 0x0005
48 1.1 cgd #define MBOX_MAILBOX_REG_TEST 0x0006
49 1.1 cgd #define MBOX_VERIFY_CHECKSUM 0x0007
50 1.1 cgd #define MBOX_ABOUT_FIRMWARE 0x0008
51 1.1 cgd /* 9 */
52 1.1 cgd /* a */
53 1.1 cgd /* b */
54 1.1 cgd /* c */
55 1.1 cgd /* d */
56 1.1 cgd #define MBOX_CHECK_FIRMWARE 0x000e
57 1.1 cgd /* f */
58 1.1 cgd #define MBOX_INIT_REQ_QUEUE 0x0010
59 1.1 cgd #define MBOX_INIT_RES_QUEUE 0x0011
60 1.1 cgd #define MBOX_EXECUTE_IOCB 0x0012
61 1.1 cgd #define MBOX_WAKE_UP 0x0013
62 1.1 cgd #define MBOX_STOP_FIRMWARE 0x0014
63 1.1 cgd #define MBOX_ABORT 0x0015
64 1.1 cgd #define MBOX_ABORT_DEVICE 0x0016
65 1.1 cgd #define MBOX_ABORT_TARGET 0x0017
66 1.1 cgd #define MBOX_BUS_RESET 0x0018
67 1.1 cgd #define MBOX_STOP_QUEUE 0x0019
68 1.1 cgd #define MBOX_START_QUEUE 0x001a
69 1.1 cgd #define MBOX_SINGLE_STEP_QUEUE 0x001b
70 1.1 cgd #define MBOX_ABORT_QUEUE 0x001c
71 1.1 cgd #define MBOX_GET_DEV_QUEUE_STATUS 0x001d
72 1.1 cgd /* 1e */
73 1.1 cgd #define MBOX_GET_FIRMWARE_STATUS 0x001f
74 1.1 cgd #define MBOX_GET_INIT_SCSI_ID 0x0020
75 1.1 cgd #define MBOX_GET_SELECT_TIMEOUT 0x0021
76 1.1 cgd #define MBOX_GET_RETRY_COUNT 0x0022
77 1.1 cgd #define MBOX_GET_TAG_AGE_LIMIT 0x0023
78 1.1 cgd #define MBOX_GET_CLOCK_RATE 0x0024
79 1.1 cgd #define MBOX_GET_ACT_NEG_STATE 0x0025
80 1.1 cgd #define MBOX_GET_ASYNC_DATA_SETUP_TIME 0x0026
81 1.1 cgd #define MBOX_GET_SBUS_PARAMS 0x0027
82 1.1 cgd #define MBOX_GET_TARGET_PARAMS 0x0028
83 1.1 cgd #define MBOX_GET_DEV_QUEUE_PARAMS 0x0029
84 1.1 cgd /* 2a */
85 1.1 cgd /* 2b */
86 1.1 cgd /* 2c */
87 1.1 cgd /* 2d */
88 1.1 cgd /* 2e */
89 1.1 cgd /* 2f */
90 1.1 cgd #define MBOX_SET_INIT_SCSI_ID 0x0030
91 1.1 cgd #define MBOX_SET_SELECT_TIMEOUT 0x0031
92 1.1 cgd #define MBOX_SET_RETRY_COUNT 0x0032
93 1.1 cgd #define MBOX_SET_TAG_AGE_LIMIT 0x0033
94 1.1 cgd #define MBOX_SET_CLOCK_RATE 0x0034
95 1.1 cgd #define MBOX_SET_ACTIVE_NEG_STATE 0x0035
96 1.1 cgd #define MBOX_SET_ASYNC_DATA_SETUP_TIME 0x0036
97 1.1 cgd #define MBOX_SET_SBUS_CONTROL_PARAMS 0x0037
98 1.1 cgd #define MBOX_SET_TARGET_PARAMS 0x0038
99 1.1 cgd #define MBOX_SET_DEV_QUEUE_PARAMS 0x0039
100 1.1 cgd /* 3a */
101 1.1 cgd /* 3b */
102 1.1 cgd /* 3c */
103 1.1 cgd /* 3d */
104 1.1 cgd /* 3e */
105 1.1 cgd /* 3f */
106 1.1 cgd #define MBOX_RETURN_BIOS_BLOCK_ADDR 0x0040
107 1.1 cgd #define MBOX_WRITE_FOUR_RAM_WORDS 0x0041
108 1.1 cgd #define MBOX_EXEC_BIOS_IOCB 0x0042
109 1.1 cgd
110 1.1 cgd #define MBOX_BUSY 0x04
111 1.1 cgd
112 1.1 cgd typedef struct {
113 1.1 cgd u_int16_t param[6];
114 1.1 cgd } mbreg_t;
115 1.1 cgd
116 1.1 cgd /*
117 1.1 cgd * Command Structure Definitions
118 1.1 cgd */
119 1.1 cgd
120 1.1 cgd typedef struct {
121 1.1 cgd u_int32_t ds_base;
122 1.1 cgd u_int32_t ds_count;
123 1.1 cgd } ispds_t;
124 1.1 cgd
125 1.1 cgd typedef struct {
126 1.1 cgd #if BYTE_ORDER == BIG_ENDIAN
127 1.1 cgd u_int8_t rqs_entry_count;
128 1.1 cgd u_int8_t rqs_entry_type;
129 1.1 cgd u_int8_t rqs_flags;
130 1.1 cgd u_int8_t rqs_seqno;
131 1.1 cgd #else
132 1.1 cgd u_int8_t rqs_entry_type;
133 1.1 cgd u_int8_t rqs_entry_count;
134 1.1 cgd u_int8_t rqs_seqno;
135 1.1 cgd u_int8_t rqs_flags;
136 1.1 cgd #endif
137 1.1 cgd } isphdr_t;
138 1.1 cgd
139 1.1 cgd /* RQS Flag definitions */
140 1.1 cgd #define RQSFLAG_CONTINUATION 0x01
141 1.1 cgd #define RQSFLAG_FULL 0x02
142 1.1 cgd #define RQSFLAG_BADHEADER 0x04
143 1.1 cgd #define RQSFLAG_BADPACKET 0x08
144 1.1 cgd /* RQS entry_type definitions */
145 1.1 cgd #define RQSTYPE_REQUEST 1
146 1.1 cgd #define RQSTYPE_DATASEG 2
147 1.1 cgd #define RQSTYPE_RESPONSE 3
148 1.1 cgd #define RQSTYPE_MARKER 4
149 1.1 cgd #define RQSTYPE_CMDONLY 5
150 1.1 cgd
151 1.1 cgd
152 1.1 cgd #define ISP_RQDSEG 4
153 1.1 cgd typedef struct {
154 1.1 cgd isphdr_t req_header;
155 1.1 cgd u_int32_t req_handle;
156 1.1 cgd #if BYTE_ORDER == BIG_ENDIAN
157 1.1 cgd u_int8_t req_target;
158 1.1 cgd u_int8_t req_lun_trn;
159 1.1 cgd #else
160 1.1 cgd u_int8_t req_lun_trn;
161 1.1 cgd u_int8_t req_target;
162 1.1 cgd #endif
163 1.1 cgd u_int16_t req_cdblen;
164 1.1 cgd #define req_modifier req_cdblen /* marker packet */
165 1.1 cgd u_int16_t req_flags;
166 1.1 cgd u_int16_t _res1;
167 1.1 cgd u_int16_t req_time;
168 1.1 cgd u_int16_t req_seg_count;
169 1.1 cgd u_int8_t req_cdb[12];
170 1.1 cgd ispds_t req_dataseg[ISP_RQDSEG];
171 1.1 cgd } ispreq_t;
172 1.1 cgd
173 1.1 cgd /* req_flag values */
174 1.1 cgd #define REQFLAG_NODISCON 0x0001
175 1.1 cgd #define REQFLAG_HTAG 0x0002
176 1.1 cgd #define REQFLAG_OTAG 0x0004
177 1.1 cgd #define REQFLAG_STAG 0x0008
178 1.1 cgd #define REQFLAG_TARGET_RTN 0x0010
179 1.1 cgd
180 1.1 cgd #define REQFLAG_NODATA 0x0000
181 1.1 cgd #define REQFLAG_DATA_IN 0x0020
182 1.1 cgd #define REQFLAG_DATA_OUT 0x0040
183 1.1 cgd #define REQFLAG_DATA_UNKNOWN 0x0060
184 1.1 cgd
185 1.1 cgd #define REQFLAG_DISARQ 0x0100
186 1.1 cgd
187 1.1 cgd typedef struct {
188 1.1 cgd isphdr_t req_header;
189 1.1 cgd u_int32_t req_handle;
190 1.1 cgd #if BYTE_ORDER == BIG_ENDIAN
191 1.1 cgd u_int8_t req_target;
192 1.1 cgd u_int8_t req_lun_trn;
193 1.1 cgd #else
194 1.1 cgd u_int8_t req_lun_trn;
195 1.1 cgd u_int8_t req_target;
196 1.1 cgd #endif
197 1.1 cgd u_int16_t req_cdblen;
198 1.1 cgd u_int16_t req_flags;
199 1.1 cgd u_int16_t _res1;
200 1.1 cgd u_int16_t req_time;
201 1.1 cgd u_int16_t req_seg_count;
202 1.1 cgd u_int8_t req_cdb[44];
203 1.1 cgd } ispextreq_t;
204 1.1 cgd
205 1.1 cgd #define ISP_CDSEG 7
206 1.1 cgd typedef struct {
207 1.1 cgd isphdr_t req_header;
208 1.1 cgd u_int32_t _res1;
209 1.1 cgd ispds_t req_dataseg[ISP_CDSEG];
210 1.1 cgd } ispcontreq_t;
211 1.1 cgd
212 1.1 cgd typedef struct {
213 1.1 cgd isphdr_t req_header;
214 1.1 cgd u_int32_t _res1;
215 1.1 cgd #if BYTE_ORDER == BIG_ENDIAN
216 1.1 cgd u_int8_t req_target;
217 1.1 cgd u_int8_t req_lun_trn;
218 1.1 cgd u_int8_t _res2;
219 1.1 cgd u_int8_t req_modifier;
220 1.1 cgd #else
221 1.1 cgd u_int8_t req_lun_trn;
222 1.1 cgd u_int8_t req_target;
223 1.1 cgd u_int8_t req_modifier;
224 1.1 cgd u_int8_t _res2;
225 1.1 cgd #endif
226 1.1 cgd } ipsmarkreq_t;
227 1.1 cgd
228 1.1 cgd #define SYNC_DEVICE 0
229 1.1 cgd #define SYNC_TARGET 1
230 1.1 cgd #define SYNC_ALL 2
231 1.1 cgd
232 1.1 cgd typedef struct {
233 1.1 cgd isphdr_t req_header;
234 1.1 cgd u_int32_t req_handle;
235 1.1 cgd u_int16_t req_scsi_status;
236 1.1 cgd u_int16_t req_completion_status;
237 1.1 cgd u_int16_t req_state_flags;
238 1.1 cgd u_int16_t req_status_flags;
239 1.1 cgd u_int16_t req_time;
240 1.1 cgd u_int16_t req_sense_len;
241 1.1 cgd u_int32_t req_resid;
242 1.1 cgd u_int8_t _res1[8];
243 1.1 cgd u_int8_t req_sense_data[32];
244 1.1 cgd } ispstatusreq_t;
245 1.1 cgd
246 1.1 cgd #define RQCS_COMPLETE 0x0000
247 1.1 cgd #define RQCS_INCOMPLETE 0x0001
248 1.1 cgd #define RQCS_DMA_ERROR 0x0002
249 1.1 cgd #define RQCS_TRANSPORT_ERROR 0x0003
250 1.1 cgd #define RQCS_RESET_OCCURRED 0x0004
251 1.1 cgd #define RQCS_ABORTED 0x0005
252 1.1 cgd #define RQCS_TIMEOUT 0x0006
253 1.1 cgd #define RQCS_DATA_OVERRUN 0x0007
254 1.1 cgd #define RQCS_COMMAND_OVERRUN 0x0008
255 1.1 cgd #define RQCS_STATUS_OVERRUN 0x0009
256 1.1 cgd #define RQCS_BAD_MESSAGE 0x000a
257 1.1 cgd #define RQCS_NO_MESSAGE_OUT 0x000b
258 1.1 cgd #define RQCS_EXT_ID_FAILED 0x000c
259 1.1 cgd #define RQCS_IDE_MSG_FAILED 0x000d
260 1.1 cgd #define RQCS_ABORT_MSG_FAILED 0x000e
261 1.1 cgd #define RQCS_REJECT_MSG_FAILED 0x000f
262 1.1 cgd #define RQCS_NOP_MSG_FAILED 0x0010
263 1.1 cgd #define RQCS_PARITY_ERROR_MSG_FAILED 0x0011
264 1.1 cgd #define RQCS_DEVICE_RESET_MSG_FAILED 0x0012
265 1.1 cgd #define RQCS_ID_MSG_FAILED 0x0013
266 1.1 cgd #define RQCS_UNEXP_BUS_FREE 0x0014
267 1.1 cgd #define RQCS_DATA_UNDERRUN 0x0015
268 1.1 cgd
269 1.1 cgd
270 1.1 cgd #define RQSF_GOT_BUS 0x0100
271 1.1 cgd #define RQSF_GOT_TARGET 0x0200
272 1.1 cgd #define RQSF_SENT_CDB 0x0400
273 1.1 cgd #define RQSF_TRANFERRED_DATA 0x0800
274 1.1 cgd #define RQSF_GOT_STATUS 0x1000
275 1.1 cgd #define RQSF_GOT_SENSE 0x2000
276 1.1 cgd
277 1.1 cgd #define RQSTF_DISCONNECT 0x0001
278 1.1 cgd #define RQSTF_SYNCHRONOUS 0x0002
279 1.1 cgd #define RQSTF_PARITY_ERROR 0x0004
280 1.1 cgd #define RQSTF_BUS_RESET 0x0008
281 1.1 cgd #define RQSTF_DEVICE_RESET 0x0010
282 1.1 cgd #define RQSTF_ABORTED 0x0020
283 1.1 cgd #define RQSTF_TIMEOUT 0x0040
284 1.1 cgd #define RQSTF_NEGOTIATION 0x0080
285 1.1 cgd
286 1.1 cgd #endif /* _ISPMBOX_H */
287