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