Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | /* |
2 | * ========== Copyright Header Begin ========================================== | |
3 | * | |
4 | * OpenSPARC T2 Processor File: mpi.h | |
5 | * Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. | |
6 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES. | |
7 | * | |
8 | * The above named program is free software; you can redistribute it and/or | |
9 | * modify it under the terms of the GNU General Public | |
10 | * License version 2 as published by the Free Software Foundation. | |
11 | * | |
12 | * The above named program is distributed in the hope that it will be | |
13 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 | * General Public License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU General Public | |
18 | * License along with this work; if not, write to the Free Software | |
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. | |
20 | * | |
21 | * ========== Copyright Header End ============================================ | |
22 | */ | |
23 | /* | |
24 | * Copyright 2004 Sun Microsystems, Inc. All rights reserved. | |
25 | * Use is subject to license terms. | |
26 | */ | |
27 | ||
28 | #ifndef _SYS_MPI_H | |
29 | #define _SYS_MPI_H | |
30 | ||
31 | #pragma ident "@(#)mpi.h 1.2 04/11/08 SMI" | |
32 | ||
33 | #ifdef __cplusplus | |
34 | extern "C" { | |
35 | #endif | |
36 | ||
37 | /* | |
38 | * This header file is based on Version 1.2 of the MPT | |
39 | * Specification by LSI Logic, Inc. | |
40 | */ | |
41 | ||
42 | /* | |
43 | * MPI Version Definitions | |
44 | */ | |
45 | #define MPI_VERSION_MAJOR (0x01) | |
46 | #define MPI_VERSION_MINOR (0x05) | |
47 | #define MPI_VERSION_MAJOR_MASK (0xFF00) | |
48 | #define MPI_VERSION_MAJOR_SHIFT (8) | |
49 | #define MPI_VERSION_MINOR_MASK (0x00FF) | |
50 | #define MPI_VERSION_MINOR_SHIFT (0) | |
51 | #define MPI_VERSION ((MPI_VERSION_MAJOR << MPI_VERSION_MAJOR_SHIFT) | \ | |
52 | MPI_VERSION_MINOR) | |
53 | ||
54 | #define MPI_HEADER_VERSION_UNIT (0x00) | |
55 | #define MPI_HEADER_VERSION_DEV (0x00) | |
56 | #define MPI_HEADER_VERSION_UNIT_MASK (0xFF00) | |
57 | #define MPI_HEADER_VERSION_UNIT_SHIFT (8) | |
58 | #define MPI_HEADER_VERSION_DEV_MASK (0x00FF) | |
59 | #define MPI_HEADER_VERSION_DEV_SHIFT (0) | |
60 | #define MPI_HEADER_VERSION ((MPI_HEADER_VERSION_UNIT << 8) | \ | |
61 | MPI_HEADER_VERSION_DEV) | |
62 | /* Note: The major versions of 0xe0 through 0xff are reserved */ | |
63 | ||
64 | /* | |
65 | * IOC State Definitions | |
66 | */ | |
67 | #define MPI_IOC_STATE_RESET 0x00000000 | |
68 | #define MPI_IOC_STATE_READY 0x10000000 | |
69 | #define MPI_IOC_STATE_OPERATIONAL 0x20000000 | |
70 | #define MPI_IOC_STATE_FAULT 0x40000000 | |
71 | ||
72 | #define MPI_IOC_STATE_MASK 0xF0000000 | |
73 | #define MPI_IOC_STATE_SHIFT 28 | |
74 | ||
75 | /* | |
76 | * Fault state codes (product independent range 0x8000-0xFFFF) | |
77 | */ | |
78 | #define MPI_FAULT_REQUEST_MESSAGE_PCI_PARITY_ERROR 0x8111 | |
79 | #define MPI_FAULT_REQUEST_MESSAGE_PCI_BUS_FAULT 0x8112 | |
80 | #define MPI_FAULT_REPLY_MESSAGE_PCI_PARITY_ERROR 0x8113 | |
81 | #define MPI_FAULT_REPLY_MESSAGE_PCI_BUS_FAULT 0x8114 | |
82 | #define MPI_FAULT_DATA_SEND_PCI_PARITY_ERROR 0x8115 | |
83 | #define MPI_FAULT_DATA_SEND_PCI_BUS_FAULT 0x8116 | |
84 | #define MPI_FAULT_DATA_RECEIVE_PCI_PARITY_ERROR 0x8117 | |
85 | #define MPI_FAULT_DATA_RECEIVE_PCI_BUS_FAULT 0x8118 | |
86 | ||
87 | ||
88 | /* | |
89 | * System Doorbell | |
90 | */ | |
91 | #define MPI_DOORBELL_OFFSET 0x00000000 | |
92 | #define MPI_DOORBELL_ACTIVE 0x08000000 | |
93 | #define MPI_DOORBELL_USED MPI_DOORBELL_ACTIVE | |
94 | #define MPI_DOORBELL_ACTIVE_SHIFT 27 | |
95 | #define MPI_DOORBELL_WHO_INIT_MASK 0x07000000 | |
96 | #define MPI_DOORBELL_WHO_INIT_SHIFT 24 | |
97 | #define MPI_DOORBELL_FUNCTION_MASK 0xFF000000 | |
98 | #define MPI_DOORBELL_FUNCTION_SHIFT 24 | |
99 | #define MPI_DOORBELL_ADD_DWORDS_MASK 0x00FF0000 | |
100 | #define MPI_DOORBELL_ADD_DWORDS_SHIFT 16 | |
101 | #define MPI_DOORBELL_DATA_MASK 0x0000FFFF | |
102 | ||
103 | ||
104 | /* | |
105 | * PCI System Interface Registers | |
106 | */ | |
107 | #define MPI_WRITE_SEQUENCE_OFFSET 0x00000004 | |
108 | #define MPI_WRSEQ_KEY_VALUE_MASK 0x0000000F | |
109 | #define MPI_WRSEQ_1ST_KEY_VALUE 0x04 | |
110 | #define MPI_WRSEQ_2ND_KEY_VALUE 0x0B | |
111 | #define MPI_WRSEQ_3RD_KEY_VALUE 0x02 | |
112 | #define MPI_WRSEQ_4TH_KEY_VALUE 0x07 | |
113 | #define MPI_WRSEQ_5TH_KEY_VALUE 0x0D | |
114 | ||
115 | #define MPI_DIAGNOSTIC_OFFSET 0x00000008 | |
116 | #define MPI_DIAG_CLEAR_FLASH_BAD_SIG 0x00000400 | |
117 | #define MPI_DIAG_PREVENT_IOC_BOOT 0x00000200 | |
118 | #define MPI_DIAG_DRWE 0x00000080 | |
119 | #define MPI_DIAG_FLASH_BAD_SIG 0x00000040 | |
120 | #define MPI_DIAG_RESET_HISTORY 0x00000020 | |
121 | #define MPI_DIAG_RW_ENABLE 0x00000010 | |
122 | #define MPI_DIAG_RESET_ADAPTER 0x00000004 | |
123 | #define MPI_DIAG_DISABLE_ARM 0x00000002 | |
124 | #define MPI_DIAG_MEM_ENABLE 0x00000001 | |
125 | ||
126 | #define MPI_TEST_BASE_ADDRESS_OFFSET 0x0000000C | |
127 | ||
128 | #define MPI_DIAG_RW_DATA_OFFSET 0x00000010 | |
129 | ||
130 | #define MPI_DIAG_RW_ADDRESS_OFFSET 0x00000014 | |
131 | ||
132 | #define MPI_HOST_INTERRUPT_STATUS_OFFSET 0x00000030 | |
133 | #define MPI_HIS_IOP_DOORBELL_STATUS 0x80000000 | |
134 | #define MPI_HIS_REPLY_MESSAGE_INTERRUPT 0x00000008 | |
135 | #define MPI_HIS_DOORBELL_INTERRUPT 0x00000001 | |
136 | ||
137 | #define MPI_HOST_INTERRUPT_MASK_OFFSET 0x00000034 | |
138 | #define MPI_HIM_RIM 0x00000008 | |
139 | #define MPI_HIM_DIM 0x00000001 | |
140 | ||
141 | #define MPI_REQUEST_QUEUE_OFFSET 0x00000040 | |
142 | #define MPI_REQUEST_POST_FIFO_OFFSET 0x00000040 | |
143 | ||
144 | #define MPI_REPLY_QUEUE_OFFSET 0x00000044 | |
145 | #define MPI_REPLY_POST_FIFO_OFFSET 0x00000044 | |
146 | #define MPI_REPLY_FREE_FIFO_OFFSET 0x00000044 | |
147 | ||
148 | #define MPI_HI_PRI_REQUEST_QUEUE_OFFSET 0x00000048 | |
149 | ||
150 | /* | |
151 | * Message Frame Descriptors | |
152 | */ | |
153 | #define MPI_REQ_MF_DESCRIPTOR_NB_MASK 0x00000003 | |
154 | #define MPI_REQ_MF_DESCRIPTOR_F_BIT 0x00000004 | |
155 | #define MPI_REQ_MF_DESCRIPTOR_ADDRESS_MASK 0xFFFFFFF8 | |
156 | ||
157 | #define MPI_ADDRESS_REPLY_A_BIT 0x80000000 | |
158 | #define MPI_ADDRESS_REPLY_ADDRESS_MASK 0x7FFFFFFF | |
159 | ||
160 | #define MPI_CONTEXT_REPLY_A_BIT 0x80000000 | |
161 | #define MPI_CONTEXT_REPLY_TYPE_MASK 0x60000000 | |
162 | #define MPI_CONTEXT_REPLY_TYPE_SCSI_INIT 0x00 | |
163 | #define MPI_CONTEXT_REPLY_TYPE_SCSI_TARGET 0x01 | |
164 | #define MPI_CONTEXT_REPLY_TYPE_LAN 0x02 | |
165 | #define MPI_CONTEXT_REPLY_TYPE_SHIFT 29 | |
166 | #define MPI_CONTEXT_REPLY_CONTEXT_MASK 0x1FFFFFFF | |
167 | ||
168 | ||
169 | /* | |
170 | * Context Reply macros | |
171 | */ | |
172 | #define MPI_GET_CONTEXT_REPLY_TYPE(x) \ | |
173 | (((x) & MPI_CONTEXT_REPLY_TYPE_MASK) \ | |
174 | >> MPI_CONTEXT_REPLY_TYPE_SHIFT) | |
175 | ||
176 | #define MPI_SET_CONTEXT_REPLY_TYPE(x, typ) \ | |
177 | ((x) = ((x) & ~MPI_CONTEXT_REPLY_TYPE_MASK) | \ | |
178 | (((typ) << MPI_CONTEXT_REPLY_TYPE_SHIFT) & \ | |
179 | MPI_CONTEXT_REPLY_TYPE_MASK)) | |
180 | ||
181 | ||
182 | /* | |
183 | * Message Functions | |
184 | * 0x80 -> 0x8F reserved for private message use per product | |
185 | */ | |
186 | #define MPI_FUNCTION_SCSI_IO_REQUEST 0x00 | |
187 | #define MPI_FUNCTION_SCSI_TASK_MGMT 0x01 | |
188 | #define MPI_FUNCTION_IOC_INIT 0x02 | |
189 | #define MPI_FUNCTION_IOC_FACTS 0x03 | |
190 | #define MPI_FUNCTION_CONFIG 0x04 | |
191 | #define MPI_FUNCTION_PORT_FACTS 0x05 | |
192 | #define MPI_FUNCTION_PORT_ENABLE 0x06 | |
193 | #define MPI_FUNCTION_EVENT_NOTIFICATION 0x07 | |
194 | #define MPI_FUNCTION_EVENT_ACK 0x08 | |
195 | #define MPI_FUNCTION_FW_DOWNLOAD 0x09 | |
196 | #define MPI_FUNCTION_TARGET_CMD_BUFFER_POST 0x0A | |
197 | #define MPI_FUNCTION_TARGET_ASSIST 0x0B | |
198 | #define MPI_FUNCTION_TARGET_STATUS_SEND 0x0C | |
199 | #define MPI_FUNCTION_TARGET_MODE_ABORT 0x0D | |
200 | #define MPI_FUNCTION_FC_LINK_SRVC_BUF_POST 0x0E | |
201 | #define MPI_FUNCTION_FC_LINK_SRVC_RSP 0x0F | |
202 | #define MPI_FUNCTION_FC_EX_LINK_SRVC_SEND 0x10 | |
203 | #define MPI_FUNCTION_FC_ABORT 0x11 | |
204 | #define MPI_FUNCTION_FW_UPLOAD 0x12 | |
205 | #define MPI_FUNCTION_FC_COMMON_TRANSPORT_SEND 0x13 | |
206 | #define MPI_FUNCTION_FC_PRIMITIVE_SEND 0x14 | |
207 | ||
208 | #define MPI_FUNCTION_RAID_ACTION 0x15 | |
209 | #define MPI_FUNCTION_RAID_SCSI_IO_PASSTHROUGH 0x16 | |
210 | ||
211 | #define MPI_FUNCTION_TOOLBOX 0x17 | |
212 | ||
213 | #define MPI_FUNCTION_SCSI_ENCLOSURE_PROCESSOR 0x18 | |
214 | ||
215 | #define MPI_FUNCTION_MAILBOX 0x19 | |
216 | ||
217 | #define MPI_FUNCTION_SMP_PASSTHROUGH 0x1A | |
218 | #define MPI_FUNCTION_SAS_IO_UNIT_CONTROL 0x1B | |
219 | ||
220 | #define MPI_DIAG_BUFFER_POST 0x1D | |
221 | #define MPI_DIAG_RELEASE 0x1E | |
222 | ||
223 | #define MPI_FUNCTION_SCSI_IO_32 0x1F | |
224 | ||
225 | #define MPI_FUNCTION_LAN_SEND 0x20 | |
226 | #define MPI_FUNCTION_LAN_RECEIVE 0x21 | |
227 | #define MPI_FUNCTION_LAN_RESET 0x22 | |
228 | ||
229 | #define MPI_FUNCTION_INBAND_BUFFER_POST 0x28 | |
230 | #define MPI_FUNCTION_INBAND_SEND 0x29 | |
231 | #define MPI_FUNCTION_INBAND_RSP 0x2A | |
232 | #define MPI_FUNCTION_INBAND_ABORT 0x2B | |
233 | ||
234 | #define MPI_FUNCTION_IOC_MESSAGE_UNIT_RESET 0x40 | |
235 | #define MPI_FUNCTION_IO_UNIT_RESET 0x41 | |
236 | #define MPI_FUNCTION_HANDSHAKE 0x42 | |
237 | #define MPI_FUNCTION_REPLY_FRAME_REMOVAL 0x43 | |
238 | #define MPI_FUNCTION_HOST_PAGEBUF_ACCESS_CONTROL 0x44 | |
239 | ||
240 | /* | |
241 | * Version format | |
242 | */ | |
243 | typedef struct mpi_version_struct { | |
244 | uint8_t Dev; | |
245 | uint8_t Unit; | |
246 | uint8_t Minor; | |
247 | uint8_t Major; | |
248 | } mpi_version_struct_t; | |
249 | ||
250 | typedef union mpi_version_format { | |
251 | mpi_version_struct_t Struct; | |
252 | uint32_t Word; | |
253 | } mpi_version_format_t; | |
254 | ||
255 | /* | |
256 | * Scatter Gather Elements | |
257 | */ | |
258 | ||
259 | /* | |
260 | * Simple element structures | |
261 | */ | |
262 | typedef struct sge_simple32 { | |
263 | uint32_t FlagsLength; | |
264 | uint32_t Address; | |
265 | } sge_simple32_t; | |
266 | ||
267 | typedef struct sge_simple64 { | |
268 | uint32_t FlagsLength; | |
269 | uint32_t Address_Low; | |
270 | uint32_t Address_High; | |
271 | } sge_simple64_t; | |
272 | ||
273 | typedef struct sge_simple_union { | |
274 | uint32_t FlagsLength; | |
275 | union { | |
276 | uint32_t Address32; | |
277 | uint32_t Address64_Low; | |
278 | uint32_t Address64_High; | |
279 | } u1; | |
280 | } sge_simple_union_t; | |
281 | ||
282 | /* | |
283 | * Chain element structures | |
284 | */ | |
285 | typedef struct sge_chain32 { | |
286 | uint16_t Length; | |
287 | uint8_t NextChainOffset; | |
288 | uint8_t Flags; | |
289 | uint32_t Address; | |
290 | } sge_chain32_t; | |
291 | ||
292 | typedef struct sge_chain64 { | |
293 | uint16_t Length; | |
294 | uint8_t NextChainOffset; | |
295 | uint8_t Flags; | |
296 | uint32_t Address64_Low; | |
297 | uint32_t Address64_High; | |
298 | } sge_chain64_t; | |
299 | ||
300 | typedef struct sge_chain_union { | |
301 | uint16_t Length; | |
302 | uint8_t NextChainOffset; | |
303 | uint8_t Flags; | |
304 | union { | |
305 | uint32_t Address32; | |
306 | uint32_t Address64_Low; | |
307 | uint32_t Address64_High; | |
308 | } u1; | |
309 | } sge_chain_union_t; | |
310 | ||
311 | /* | |
312 | * Transaction Context element | |
313 | */ | |
314 | typedef struct sge_transaction32 { | |
315 | uint8_t Reserved; | |
316 | uint8_t ContextSize; | |
317 | uint8_t DetailsLength; | |
318 | uint8_t Flags; | |
319 | uint32_t TransactionContext[1]; | |
320 | uint32_t TransactionDetails[1]; | |
321 | } sge_transaction32_t; | |
322 | ||
323 | typedef struct sge_transaction64 { | |
324 | uint8_t Reserved; | |
325 | uint8_t ContextSize; | |
326 | uint8_t DetailsLength; | |
327 | uint8_t Flags; | |
328 | uint32_t TransactionContext[2]; | |
329 | uint32_t TransactionDetails[1]; | |
330 | } sge_transaction64_t; | |
331 | ||
332 | typedef struct sge_transaction96 { | |
333 | uint8_t Reserved; | |
334 | uint8_t ContextSize; | |
335 | uint8_t DetailsLength; | |
336 | uint8_t Flags; | |
337 | uint32_t TransactionContext[3]; | |
338 | uint32_t TransactionDetails[1]; | |
339 | } sge_transaction96_t; | |
340 | ||
341 | typedef struct sge_transaction128 { | |
342 | uint8_t Reserved; | |
343 | uint8_t ContextSize; | |
344 | uint8_t DetailsLength; | |
345 | uint8_t Flags; | |
346 | uint32_t TransactionContext[4]; | |
347 | uint32_t TransactionDetails[1]; | |
348 | } sge_transaction128_t; | |
349 | ||
350 | typedef struct sge_transaction_union { | |
351 | uint8_t Reserved; | |
352 | uint8_t ContextSize; | |
353 | uint8_t DetailsLength; | |
354 | uint8_t Flags; | |
355 | union { | |
356 | uint32_t TransactionContext32[1]; | |
357 | uint32_t TransactionContext64[2]; | |
358 | uint32_t TransactionContext96[3]; | |
359 | uint32_t TransactionContext128[4]; | |
360 | } u1; | |
361 | uint32_t TransactionDetails[1]; | |
362 | } sge_transaction_union_t; | |
363 | ||
364 | ||
365 | /* | |
366 | * SGE IO types union for IO SGL's | |
367 | */ | |
368 | typedef struct sge_io_union { | |
369 | union { | |
370 | sge_simple_union_t Simple; | |
371 | sge_chain_union_t Chain; | |
372 | } u1; | |
373 | } sge_io_union_t; | |
374 | ||
375 | /* | |
376 | * SGE union for SGL's with Simple and Transaction elements | |
377 | */ | |
378 | typedef struct sge_trans_simple_union { | |
379 | union { | |
380 | sge_simple_union_t Simple; | |
381 | sge_transaction_union_t Transaction; | |
382 | } u1; | |
383 | } sge_trans_simple_union_t; | |
384 | ||
385 | /* | |
386 | * All SGE types union | |
387 | */ | |
388 | typedef struct sge_mpi_union { | |
389 | union { | |
390 | sge_simple_union_t Simple; | |
391 | sge_chain_union_t Chain; | |
392 | sge_transaction_union_t Transaction; | |
393 | } u1; | |
394 | } sge_mpi_union_t; | |
395 | ||
396 | ||
397 | /* | |
398 | * SGE field definition and masks | |
399 | */ | |
400 | ||
401 | /* | |
402 | * Flags field bit definitions | |
403 | */ | |
404 | #define MPI_SGE_FLAGS_LAST_ELEMENT 0x80 | |
405 | #define MPI_SGE_FLAGS_END_OF_BUFFER 0x40 | |
406 | #define MPI_SGE_FLAGS_ELEMENT_TYPE_MASK 0x30 | |
407 | #define MPI_SGE_FLAGS_LOCAL_ADDRESS 0x08 | |
408 | #define MPI_SGE_FLAGS_DIRECTION 0x04 | |
409 | #define MPI_SGE_FLAGS_ADDRESS_SIZE 0x02 | |
410 | #define MPI_SGE_FLAGS_END_OF_LIST 0x01 | |
411 | ||
412 | #define MPI_SGE_FLAGS_SHIFT 24 | |
413 | ||
414 | #define MPI_SGE_LENGTH_MASK 0x00FFFFFF | |
415 | #define MPI_SGE_CHAIN_LENGTH_MASK 0x0000FFFF | |
416 | ||
417 | /* | |
418 | * Element Type | |
419 | */ | |
420 | #define MPI_SGE_FLAGS_TRANSACTION_ELEMENT 0x00 | |
421 | #define MPI_SGE_FLAGS_SIMPLE_ELEMENT 0x10 | |
422 | #define MPI_SGE_FLAGS_CHAIN_ELEMENT 0x30 | |
423 | #define MPI_SGE_FLAGS_ELEMENT_MASK 0x30 | |
424 | ||
425 | /* | |
426 | * Address location | |
427 | */ | |
428 | #define MPI_SGE_FLAGS_SYSTEM_ADDRESS 0x00 | |
429 | ||
430 | /* | |
431 | * Direction | |
432 | */ | |
433 | #define MPI_SGE_FLAGS_IOC_TO_HOST 0x00 | |
434 | #define MPI_SGE_FLAGS_HOST_TO_IOC 0x04 | |
435 | ||
436 | /* | |
437 | * Address Size | |
438 | */ | |
439 | #define MPI_SGE_FLAGS_32_BIT_ADDRESSING 0x00 | |
440 | #define MPI_SGE_FLAGS_64_BIT_ADDRESSING 0x02 | |
441 | ||
442 | /* | |
443 | * Context Size | |
444 | */ | |
445 | #define MPI_SGE_FLAGS_32_BIT_CONTEXT 0x00 | |
446 | #define MPI_SGE_FLAGS_64_BIT_CONTEXT 0x02 | |
447 | #define MPI_SGE_FLAGS_96_BIT_CONTEXT 0x04 | |
448 | #define MPI_SGE_FLAGS_128_BIT_CONTEXT 0x06 | |
449 | ||
450 | #define MPI_SGE_CHAIN_OFFSET_MASK 0x00FF0000 | |
451 | #define MPI_SGE_CHAIN_OFFSET_SHIFT 16 | |
452 | ||
453 | ||
454 | /* | |
455 | * SGE operation Macros | |
456 | */ | |
457 | ||
458 | /* | |
459 | * SIMPLE FlagsLength manipulations... | |
460 | */ | |
461 | #define MPI_SGE_SET_FLAGS(f) ((uint32_t)(f) << MPI_SGE_FLAGS_SHIFT) | |
462 | #define MPI_SGE_GET_FLAGS(fl) \ | |
463 | (((fl) & ~MPI_SGE_LENGTH_MASK) >> MPI_SGE_FLAGS_SHIFT) | |
464 | #define MPI_SGE_LENGTH(fl) ((fl) & MPI_SGE_LENGTH_MASK) | |
465 | #define MPI_SGE_CHAIN_LENGTH(fl) ((fl) & MPI_SGE_CHAIN_LENGTH_MASK) | |
466 | ||
467 | #define MPI_SGE_SET_FLAGS_LENGTH(f, l) \ | |
468 | (MPI_SGE_SET_FLAGS(f) | MPI_SGE_LENGTH(l)) | |
469 | ||
470 | #define MPI_pSGE_GET_FLAGS(psg) MPI_SGE_GET_FLAGS((psg)->FlagsLength) | |
471 | #define MPI_pSGE_GET_LENGTH(psg) MPI_SGE_LENGTH((psg)->FlagsLength) | |
472 | #define MPI_pSGE_SET_FLAGS_LENGTH(psg, f, l) \ | |
473 | (psg)->FlagsLength = MPI_SGE_SET_FLAGS_LENGTH(f, l) | |
474 | ||
475 | /* | |
476 | * CAUTION - The following are READ-MODIFY-WRITE! | |
477 | */ | |
478 | #define MPI_pSGE_SET_FLAGS(psg, f) \ | |
479 | (psg)->FlagsLength |= MPI_SGE_SET_FLAGS(f) | |
480 | #define MPI_pSGE_SET_LENGTH(psg, l) \ | |
481 | (psg)->FlagsLength |= MPI_SGE_LENGTH(l) | |
482 | ||
483 | #define MPI_GET_CHAIN_OFFSET(x) \ | |
484 | ((x&MPI_SGE_CHAIN_OFFSET_MASK)>>MPI_SGE_CHAIN_OFFSET_SHIFT) | |
485 | ||
486 | ||
487 | /* | |
488 | * Standard Message Structures | |
489 | */ | |
490 | ||
491 | /* | |
492 | * Standard message request header for all request messages | |
493 | */ | |
494 | typedef struct msg_request_header { | |
495 | uint8_t Reserved[2]; /* function specific */ | |
496 | uint8_t ChainOffset; | |
497 | uint8_t Function; | |
498 | uint8_t Reserved1[3]; /* function specific */ | |
499 | uint8_t MsgFlags; | |
500 | uint32_t MsgContext; | |
501 | } msg_request_header_t; | |
502 | ||
503 | ||
504 | /* | |
505 | * Default Reply | |
506 | */ | |
507 | typedef struct msg_default_reply { | |
508 | uint8_t Reserved[2]; /* function specific */ | |
509 | uint8_t MsgLength; | |
510 | uint8_t Function; | |
511 | uint8_t Reserved1[3]; /* function specific */ | |
512 | uint8_t MsgFlags; | |
513 | uint32_t MsgContext; | |
514 | uint8_t Reserved2[2]; /* function specific */ | |
515 | uint16_t IOCStatus; | |
516 | uint32_t IOCLogInfo; | |
517 | } msg_default_reply_t; | |
518 | ||
519 | /* | |
520 | * MsgFlags definition for all replies | |
521 | */ | |
522 | #define MPI_MSGFLAGS_CONTINUATION_REPLY 0x80 | |
523 | ||
524 | ||
525 | /* | |
526 | * IOC Status Values | |
527 | */ | |
528 | ||
529 | /* | |
530 | * Common IOCStatus values for all replies | |
531 | */ | |
532 | #define MPI_IOCSTATUS_SUCCESS 0x0000 | |
533 | #define MPI_IOCSTATUS_INVALID_FUNCTION 0x0001 | |
534 | #define MPI_IOCSTATUS_BUSY 0x0002 | |
535 | #define MPI_IOCSTATUS_INVALID_SGL 0x0003 | |
536 | #define MPI_IOCSTATUS_INTERNAL_ERROR 0x0004 | |
537 | #define MPI_IOCSTATUS_RESERVED 0x0005 | |
538 | #define MPI_IOCSTATUS_INSUFFICIENT_RESOURCES 0x0006 | |
539 | #define MPI_IOCSTATUS_INVALID_FIELD 0x0007 | |
540 | #define MPI_IOCSTATUS_INVALID_STATE 0x0008 | |
541 | #define MPI_IOCSTATUS_OP_STATE_NOT_SUPPORTED 0x0009 | |
542 | ||
543 | /* | |
544 | * Config IOCStatus values | |
545 | */ | |
546 | #define MPI_IOCSTATUS_CONFIG_INVALID_ACTION 0x0020 | |
547 | #define MPI_IOCSTATUS_CONFIG_INVALID_TYPE 0x0021 | |
548 | #define MPI_IOCSTATUS_CONFIG_INVALID_PAGE 0x0022 | |
549 | #define MPI_IOCSTATUS_CONFIG_INVALID_DATA 0x0023 | |
550 | #define MPI_IOCSTATUS_CONFIG_NO_DEFAULTS 0x0024 | |
551 | #define MPI_IOCSTATUS_CONFIG_CANT_COMMIT 0x0025 | |
552 | ||
553 | /* | |
554 | * SCSIIO Reply (SPI & FCP) initiator values | |
555 | */ | |
556 | #define MPI_IOCSTATUS_SCSI_RECOVERED_ERROR 0x0040 | |
557 | #define MPI_IOCSTATUS_SCSI_INVALID_BUS 0x0041 | |
558 | #define MPI_IOCSTATUS_SCSI_INVALID_TARGETID 0x0042 | |
559 | #define MPI_IOCSTATUS_SCSI_DEVICE_NOT_THERE 0x0043 | |
560 | #define MPI_IOCSTATUS_SCSI_DATA_OVERRUN 0x0044 | |
561 | #define MPI_IOCSTATUS_SCSI_DATA_UNDERRUN 0x0045 | |
562 | #define MPI_IOCSTATUS_SCSI_IO_DATA_ERROR 0x0046 | |
563 | #define MPI_IOCSTATUS_SCSI_PROTOCOL_ERROR 0x0047 | |
564 | #define MPI_IOCSTATUS_SCSI_TASK_TERMINATED 0x0048 | |
565 | #define MPI_IOCSTATUS_SCSI_RESIDUAL_MISMATCH 0x0049 | |
566 | #define MPI_IOCSTATUS_SCSI_TASK_MGMT_FAILED 0x004A | |
567 | #define MPI_IOCSTATUS_SCSI_IOC_TERMINATED 0x004B | |
568 | #define MPI_IOCSTATUS_SCSI_EXT_TERMINATED 0x004C | |
569 | ||
570 | /* | |
571 | * SCSI Initiator/Target end-to-end data protection | |
572 | */ | |
573 | #define MPI_IOCSTATUS_EEDP_CRC_ERROR 0x004D | |
574 | #define MPI_IOCSTATUS_EEDP_LBA_TAG_ERROR 0x004E | |
575 | #define MPI_IOCSTATUS_EEDP_APP_TAG_ERROR 0x004F | |
576 | /* | |
577 | * SCSI (SPI & FCP) target values | |
578 | */ | |
579 | #define MPI_IOCSTATUS_TARGET_PRIORITY_IO 0x0060 | |
580 | #define MPI_IOCSTATUS_TARGET_INVALID_PORT 0x0061 | |
581 | #define MPI_IOCSTATUS_TARGET_INVALID_IOCINDEX 0x0062 | |
582 | #define MPI_IOCSTATUS_TARGET_ABORTED 0x0063 | |
583 | #define MPI_IOCSTATUS_TARGET_NO_CONN_RETRYABLE 0x0064 | |
584 | #define MPI_IOCSTATUS_TARGET_NO_CONNECTION 0x0065 | |
585 | #define MPI_IOCSTATUS_TARGET_XFER_COUNT_MISMATCH 0x006A | |
586 | #define MPI_IOCSTATUS_TARGET_STS_DATA_NOT_SENT 0x006B | |
587 | ||
588 | /* | |
589 | * Additional FCP target values | |
590 | */ | |
591 | #define MPI_IOCSTATUS_TARGET_FC_ABORTED 0x0066 /* obsolete */ | |
592 | #define MPI_IOCSTATUS_TARGET_FC_RX_ID_INVALID 0x0067 /* obsolete */ | |
593 | #define MPI_IOCSTATUS_TARGET_FC_DID_INVALID 0x0068 /* obsolete */ | |
594 | #define MPI_IOCSTATUS_TARGET_FC_NODE_LOGGED_OUT 0x0069 /* obsolete */ | |
595 | ||
596 | /* | |
597 | * Fibre Channel Direct Access values | |
598 | */ | |
599 | #define MPI_IOCSTATUS_FC_ABORTED 0x0066 | |
600 | #define MPI_IOCSTATUS_FC_RX_ID_INVALID 0x0067 | |
601 | #define MPI_IOCSTATUS_FC_DID_INVALID 0x0068 | |
602 | #define MPI_IOCSTATUS_FC_NODE_LOGGED_OUT 0x0069 | |
603 | #define MPI_IOCSTATUS_FC_EXCHANGE_CANCELED 0x006C | |
604 | ||
605 | /* | |
606 | * LAN values | |
607 | */ | |
608 | #define MPI_IOCSTATUS_LAN_DEVICE_NOT_FOUND 0x0080 | |
609 | #define MPI_IOCSTATUS_LAN_DEVICE_FAILURE 0x0081 | |
610 | #define MPI_IOCSTATUS_LAN_TRANSMIT_ERROR 0x0082 | |
611 | #define MPI_IOCSTATUS_LAN_TRANSMIT_ABORTED 0x0083 | |
612 | #define MPI_IOCSTATUS_LAN_RECEIVE_ERROR 0x0084 | |
613 | #define MPI_IOCSTATUS_LAN_RECEIVE_ABORTED 0x0085 | |
614 | #define MPI_IOCSTATUS_LAN_PARTIAL_PACKET 0x0086 | |
615 | #define MPI_IOCSTATUS_LAN_CANCELED 0x0087 | |
616 | ||
617 | /* | |
618 | * SAS values | |
619 | */ | |
620 | #define MPI_IOCSTATUS_SAS_SMP_REQUEST_FAILED 0x0090 | |
621 | ||
622 | /* | |
623 | * Inband values | |
624 | */ | |
625 | #define MPI_IOCSTATUS_INBAND_ABORTED 0x0098 | |
626 | #define MPI_IOCSTATUS_INBAND_NO_CONNECTION 0x0099 | |
627 | ||
628 | /* | |
629 | * Diagnostic Tools values | |
630 | */ | |
631 | #define MPI_IOCSTATUS_DIAGNOSTIC_RELEASED 0x00A0 | |
632 | ||
633 | /* | |
634 | * IOCStatus flag to indicate that log info is available | |
635 | */ | |
636 | #define MPI_IOCSTATUS_FLAG_LOG_INFO_AVAILABLE 0x8000 | |
637 | #define MPI_IOCSTATUS_MASK 0x7FFF | |
638 | ||
639 | /* | |
640 | * LogInfo Types | |
641 | */ | |
642 | #define MPI_IOCLOGINFO_TYPE_MASK 0xF0000000 | |
643 | #define MPI_IOCLOGINFO_TYPE_NONE 0x0 | |
644 | #define MPI_IOCLOGINFO_TYPE_SCSI 0x1 | |
645 | #define MPI_IOCLOGINFO_TYPE_FC 0x2 | |
646 | #define MPI_IOCLOGINFO_TYPE_SAS 0x3 | |
647 | #define MPI_IOCLOGINFO_TYPE_ISCSI 0x4 | |
648 | #define MPI_IOCLOGINFO_LOG_DATA_MASK 0x0FFFFFFF | |
649 | ||
650 | #ifdef __cplusplus | |
651 | } | |
652 | #endif | |
653 | ||
654 | #endif /* _SYS_MPI_H */ |