xref: /freebsd/sys/dev/mpt/mpilib/mpi_fc.h (revision fcb560670601b2a4d87bb31d7531c8dcc37ee71b)
1 /* $FreeBSD$ */
2 /*-
3  * Copyright (c) 2000-2010, LSI Logic Corporation and its contributors.
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are
8  * met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
12  *    substantially similar to the "NO WARRANTY" disclaimer below
13  *    ("Disclaimer") and any redistribution must be conditioned upon including
14  *    a substantially similar Disclaimer requirement for further binary
15  *    redistribution.
16  * 3. Neither the name of the LSI Logic Corporation nor the names of its
17  *    contributors may be used to endorse or promote products derived from
18  *    this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT
30  * OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  *
33  *           Name:  mpi_fc.h
34  *          Title:  MPI Fibre Channel messages and structures
35  *  Creation Date:  June 12, 2000
36  *
37  *    mpi_fc.h Version:  01.05.01
38  *
39  *  Version History
40  *  ---------------
41  *
42  *  Date      Version   Description
43  *  --------  --------  ------------------------------------------------------
44  *  05-08-00  00.10.01  Original release for 0.10 spec dated 4/26/2000.
45  *  06-06-00  01.00.01  Update version number for 1.0 release.
46  *  06-12-00  01.00.02  Added _MSG_FC_ABORT_REPLY structure.
47  *  11-02-00  01.01.01  Original release for post 1.0 work
48  *  12-04-00  01.01.02  Added messages for Common Transport Send and
49  *                      Primitive Send.
50  *  01-09-01  01.01.03  Modifed some of the new flags to have an MPI prefix
51  *                      and modified the FcPrimitiveSend flags.
52  *  01-25-01  01.01.04  Move InitiatorIndex in LinkServiceRsp reply to a larger
53  *                      field.
54  *                      Added FC_ABORT_TYPE_CT_SEND_REQUEST and
55  *                      FC_ABORT_TYPE_EXLINKSEND_REQUEST for FcAbort request.
56  *                      Added MPI_FC_PRIM_SEND_FLAGS_STOP_SEND.
57  *  02-20-01  01.01.05  Started using MPI_POINTER.
58  *  03-27-01  01.01.06  Added Flags field to MSG_LINK_SERVICE_BUFFER_POST_REPLY
59  *                      and defined MPI_LS_BUF_POST_REPLY_FLAG_NO_RSP_NEEDED.
60  *                      Added MPI_FC_PRIM_SEND_FLAGS_RESET_LINK define.
61  *                      Added structure offset comments.
62  *  04-09-01  01.01.07  Added RspLength field to MSG_LINK_SERVICE_RSP_REQUEST.
63  *  08-08-01  01.02.01  Original release for v1.2 work.
64  *  09-28-01  01.02.02  Change name of reserved field in
65  *                      MSG_LINK_SERVICE_RSP_REPLY.
66  *  05-31-02  01.02.03  Adding AliasIndex to FC Direct Access requests.
67  *  01-16-04  01.02.04  Added define for MPI_FC_PRIM_SEND_FLAGS_ML_RESET_LINK.
68  *  05-11-04  01.03.01  Original release for MPI v1.3.
69  *  08-19-04  01.05.01  Original release for MPI v1.5.
70  *  --------------------------------------------------------------------------
71  */
72 
73 #ifndef MPI_FC_H
74 #define MPI_FC_H
75 
76 
77 /*****************************************************************************
78 *
79 *        F C    D i r e c t    A c c e s s     M e s s a g e s
80 *
81 *****************************************************************************/
82 
83 /****************************************************************************/
84 /* Link Service Buffer Post messages                                        */
85 /****************************************************************************/
86 
87 typedef struct _MSG_LINK_SERVICE_BUFFER_POST_REQUEST
88 {
89     U8                      BufferPostFlags;    /* 00h */
90     U8                      BufferCount;        /* 01h */
91     U8                      ChainOffset;        /* 02h */
92     U8                      Function;           /* 03h */
93     U16                     Reserved;           /* 04h */
94     U8                      Reserved1;          /* 06h */
95     U8                      MsgFlags;           /* 07h */
96     U32                     MsgContext;         /* 08h */
97     SGE_TRANS_SIMPLE_UNION  SGL;
98 } MSG_LINK_SERVICE_BUFFER_POST_REQUEST,
99  MPI_POINTER PTR_MSG_LINK_SERVICE_BUFFER_POST_REQUEST,
100   LinkServiceBufferPostRequest_t, MPI_POINTER pLinkServiceBufferPostRequest_t;
101 
102 #define LINK_SERVICE_BUFFER_POST_FLAGS_PORT_MASK (0x01)
103 
104 typedef struct _WWNFORMAT
105 {
106     U32                     PortNameHigh;       /* 00h */
107     U32                     PortNameLow;        /* 04h */
108     U32                     NodeNameHigh;       /* 08h */
109     U32                     NodeNameLow;        /* 0Ch */
110 } WWNFORMAT,
111   WwnFormat_t;
112 
113 /* Link Service Buffer Post Reply */
114 typedef struct _MSG_LINK_SERVICE_BUFFER_POST_REPLY
115 {
116     U8                      Flags;              /* 00h */
117     U8                      Reserved;           /* 01h */
118     U8                      MsgLength;          /* 02h */
119     U8                      Function;           /* 03h */
120     U16                     Reserved1;          /* 04h */
121     U8                      PortNumber;         /* 06h */
122     U8                      MsgFlags;           /* 07h */
123     U32                     MsgContext;         /* 08h */
124     U16                     Reserved2;          /* 0Ch */
125     U16                     IOCStatus;          /* 0Eh */
126     U32                     IOCLogInfo;         /* 10h */
127     U32                     TransferLength;     /* 14h */
128     U32                     TransactionContext; /* 18h */
129     U32                     Rctl_Did;           /* 1Ch */
130     U32                     Csctl_Sid;          /* 20h */
131     U32                     Type_Fctl;          /* 24h */
132     U16                     SeqCnt;             /* 28h */
133     U8                      Dfctl;              /* 2Ah */
134     U8                      SeqId;              /* 2Bh */
135     U16                     Rxid;               /* 2Ch */
136     U16                     Oxid;               /* 2Eh */
137     U32                     Parameter;          /* 30h */
138     WWNFORMAT               Wwn;                /* 34h */
139 } MSG_LINK_SERVICE_BUFFER_POST_REPLY, MPI_POINTER PTR_MSG_LINK_SERVICE_BUFFER_POST_REPLY,
140   LinkServiceBufferPostReply_t, MPI_POINTER pLinkServiceBufferPostReply_t;
141 
142 #define MPI_LS_BUF_POST_REPLY_FLAG_NO_RSP_NEEDED    (0x80)
143 
144 #define MPI_FC_DID_MASK                             (0x00FFFFFF)
145 #define MPI_FC_DID_SHIFT                            (0)
146 #define MPI_FC_RCTL_MASK                            (0xFF000000)
147 #define MPI_FC_RCTL_SHIFT                           (24)
148 #define MPI_FC_SID_MASK                             (0x00FFFFFF)
149 #define MPI_FC_SID_SHIFT                            (0)
150 #define MPI_FC_CSCTL_MASK                           (0xFF000000)
151 #define MPI_FC_CSCTL_SHIFT                          (24)
152 #define MPI_FC_FCTL_MASK                            (0x00FFFFFF)
153 #define MPI_FC_FCTL_SHIFT                           (0)
154 #define MPI_FC_TYPE_MASK                            (0xFF000000)
155 #define MPI_FC_TYPE_SHIFT                           (24)
156 
157 /* obsolete name for the above */
158 #define FCP_TARGET_DID_MASK                         (0x00FFFFFF)
159 #define FCP_TARGET_DID_SHIFT                        (0)
160 #define FCP_TARGET_RCTL_MASK                        (0xFF000000)
161 #define FCP_TARGET_RCTL_SHIFT                       (24)
162 #define FCP_TARGET_SID_MASK                         (0x00FFFFFF)
163 #define FCP_TARGET_SID_SHIFT                        (0)
164 #define FCP_TARGET_CSCTL_MASK                       (0xFF000000)
165 #define FCP_TARGET_CSCTL_SHIFT                      (24)
166 #define FCP_TARGET_FCTL_MASK                        (0x00FFFFFF)
167 #define FCP_TARGET_FCTL_SHIFT                       (0)
168 #define FCP_TARGET_TYPE_MASK                        (0xFF000000)
169 #define FCP_TARGET_TYPE_SHIFT                       (24)
170 
171 
172 /****************************************************************************/
173 /* Link Service Response messages                                           */
174 /****************************************************************************/
175 
176 typedef struct _MSG_LINK_SERVICE_RSP_REQUEST
177 {
178     U8                      RspFlags;           /* 00h */
179     U8                      RspLength;          /* 01h */
180     U8                      ChainOffset;        /* 02h */
181     U8                      Function;           /* 03h */
182     U16                     Reserved1;          /* 04h */
183     U8                      Reserved2;          /* 06h */
184     U8                      MsgFlags;           /* 07h */
185     U32                     MsgContext;         /* 08h */
186     U32                     Rctl_Did;           /* 0Ch */
187     U32                     Csctl_Sid;          /* 10h */
188     U32                     Type_Fctl;          /* 14h */
189     U16                     SeqCnt;             /* 18h */
190     U8                      Dfctl;              /* 1Ah */
191     U8                      SeqId;              /* 1Bh */
192     U16                     Rxid;               /* 1Ch */
193     U16                     Oxid;               /* 1Eh */
194     U32                     Parameter;          /* 20h */
195     SGE_SIMPLE_UNION        SGL;                /* 24h */
196 } MSG_LINK_SERVICE_RSP_REQUEST, MPI_POINTER PTR_MSG_LINK_SERVICE_RSP_REQUEST,
197   LinkServiceRspRequest_t, MPI_POINTER pLinkServiceRspRequest_t;
198 
199 #define LINK_SERVICE_RSP_FLAGS_IMMEDIATE        (0x80)
200 #define LINK_SERVICE_RSP_FLAGS_PORT_MASK        (0x01)
201 
202 
203 /* Link Service Response Reply  */
204 typedef struct _MSG_LINK_SERVICE_RSP_REPLY
205 {
206     U16                     Reserved;           /* 00h */
207     U8                      MsgLength;          /* 02h */
208     U8                      Function;           /* 03h */
209     U16                     Reserved1;          /* 04h */
210     U8                      Reserved_0100_InitiatorIndex; /* 06h */ /* obsolete InitiatorIndex */
211     U8                      MsgFlags;           /* 07h */
212     U32                     MsgContext;         /* 08h */
213     U16                     Reserved3;          /* 0Ch */
214     U16                     IOCStatus;          /* 0Eh */
215     U32                     IOCLogInfo;         /* 10h */
216     U32                     InitiatorIndex;     /* 14h */
217 } MSG_LINK_SERVICE_RSP_REPLY, MPI_POINTER PTR_MSG_LINK_SERVICE_RSP_REPLY,
218   LinkServiceRspReply_t, MPI_POINTER pLinkServiceRspReply_t;
219 
220 
221 /****************************************************************************/
222 /* Extended Link Service Send messages                                      */
223 /****************************************************************************/
224 
225 typedef struct _MSG_EXLINK_SERVICE_SEND_REQUEST
226 {
227     U8                      SendFlags;          /* 00h */
228     U8                      AliasIndex;         /* 01h */
229     U8                      ChainOffset;        /* 02h */
230     U8                      Function;           /* 03h */
231     U32                     MsgFlags_Did;       /* 04h */
232     U32                     MsgContext;         /* 08h */
233     U32                     ElsCommandCode;     /* 0Ch */
234     SGE_SIMPLE_UNION        SGL;                /* 10h */
235 } MSG_EXLINK_SERVICE_SEND_REQUEST, MPI_POINTER PTR_MSG_EXLINK_SERVICE_SEND_REQUEST,
236   ExLinkServiceSendRequest_t, MPI_POINTER pExLinkServiceSendRequest_t;
237 
238 #define EX_LINK_SERVICE_SEND_DID_MASK           (0x00FFFFFF)
239 #define EX_LINK_SERVICE_SEND_DID_SHIFT          (0)
240 #define EX_LINK_SERVICE_SEND_MSGFLAGS_MASK      (0xFF000000)
241 #define EX_LINK_SERVICE_SEND_MSGFLAGS_SHIFT     (24)
242 
243 
244 /* Extended Link Service Send Reply */
245 typedef struct _MSG_EXLINK_SERVICE_SEND_REPLY
246 {
247     U8                      Reserved;           /* 00h */
248     U8                      AliasIndex;         /* 01h */
249     U8                      MsgLength;          /* 02h */
250     U8                      Function;           /* 03h */
251     U16                     Reserved1;          /* 04h */
252     U8                      Reserved2;          /* 06h */
253     U8                      MsgFlags;           /* 07h */
254     U32                     MsgContext;         /* 08h */
255     U16                     Reserved3;          /* 0Ch */
256     U16                     IOCStatus;          /* 0Eh */
257     U32                     IOCLogInfo;         /* 10h */
258     U32                     ResponseLength;     /* 14h */
259 } MSG_EXLINK_SERVICE_SEND_REPLY, MPI_POINTER PTR_MSG_EXLINK_SERVICE_SEND_REPLY,
260   ExLinkServiceSendReply_t, MPI_POINTER pExLinkServiceSendReply_t;
261 
262 /****************************************************************************/
263 /* FC Abort messages                                                        */
264 /****************************************************************************/
265 
266 typedef struct _MSG_FC_ABORT_REQUEST
267 {
268     U8                      AbortFlags;                 /* 00h */
269     U8                      AbortType;                  /* 01h */
270     U8                      ChainOffset;                /* 02h */
271     U8                      Function;                   /* 03h */
272     U16                     Reserved1;                  /* 04h */
273     U8                      Reserved2;                  /* 06h */
274     U8                      MsgFlags;                   /* 07h */
275     U32                     MsgContext;                 /* 08h */
276     U32                     TransactionContextToAbort;  /* 0Ch */
277 } MSG_FC_ABORT_REQUEST, MPI_POINTER PTR_MSG_FC_ABORT_REQUEST,
278   FcAbortRequest_t, MPI_POINTER pFcAbortRequest_t;
279 
280 #define FC_ABORT_FLAG_PORT_MASK                 (0x01)
281 
282 #define FC_ABORT_TYPE_ALL_FC_BUFFERS            (0x00)
283 #define FC_ABORT_TYPE_EXACT_FC_BUFFER           (0x01)
284 #define FC_ABORT_TYPE_CT_SEND_REQUEST           (0x02)
285 #define FC_ABORT_TYPE_EXLINKSEND_REQUEST        (0x03)
286 
287 /* FC Abort Reply */
288 typedef struct _MSG_FC_ABORT_REPLY
289 {
290     U16                     Reserved;           /* 00h */
291     U8                      MsgLength;          /* 02h */
292     U8                      Function;           /* 03h */
293     U16                     Reserved1;          /* 04h */
294     U8                      Reserved2;          /* 06h */
295     U8                      MsgFlags;           /* 07h */
296     U32                     MsgContext;         /* 08h */
297     U16                     Reserved3;          /* 0Ch */
298     U16                     IOCStatus;          /* 0Eh */
299     U32                     IOCLogInfo;         /* 10h */
300 } MSG_FC_ABORT_REPLY, MPI_POINTER PTR_MSG_FC_ABORT_REPLY,
301   FcAbortReply_t, MPI_POINTER pFcAbortReply_t;
302 
303 
304 /****************************************************************************/
305 /* FC Common Transport Send messages                                        */
306 /****************************************************************************/
307 
308 typedef struct _MSG_FC_COMMON_TRANSPORT_SEND_REQUEST
309 {
310     U8                      SendFlags;          /* 00h */
311     U8                      AliasIndex;         /* 01h */
312     U8                      ChainOffset;        /* 02h */
313     U8                      Function;           /* 03h */
314     U32                     MsgFlags_Did;       /* 04h */
315     U32                     MsgContext;         /* 08h */
316     U16                     CTCommandCode;      /* 0Ch */
317     U8                      FsType;             /* 0Eh */
318     U8                      Reserved1;          /* 0Fh */
319     SGE_SIMPLE_UNION        SGL;                /* 10h */
320 } MSG_FC_COMMON_TRANSPORT_SEND_REQUEST,
321  MPI_POINTER PTR_MSG_FC_COMMON_TRANSPORT_SEND_REQUEST,
322   FcCommonTransportSendRequest_t, MPI_POINTER pFcCommonTransportSendRequest_t;
323 
324 #define MPI_FC_CT_SEND_DID_MASK                 (0x00FFFFFF)
325 #define MPI_FC_CT_SEND_DID_SHIFT                (0)
326 #define MPI_FC_CT_SEND_MSGFLAGS_MASK            (0xFF000000)
327 #define MPI_FC_CT_SEND_MSGFLAGS_SHIFT           (24)
328 
329 
330 /* FC Common Transport Send Reply */
331 typedef struct _MSG_FC_COMMON_TRANSPORT_SEND_REPLY
332 {
333     U8                      Reserved;           /* 00h */
334     U8                      AliasIndex;         /* 01h */
335     U8                      MsgLength;          /* 02h */
336     U8                      Function;           /* 03h */
337     U16                     Reserved1;          /* 04h */
338     U8                      Reserved2;          /* 06h */
339     U8                      MsgFlags;           /* 07h */
340     U32                     MsgContext;         /* 08h */
341     U16                     Reserved3;          /* 0Ch */
342     U16                     IOCStatus;          /* 0Eh */
343     U32                     IOCLogInfo;         /* 10h */
344     U32                     ResponseLength;     /* 14h */
345 } MSG_FC_COMMON_TRANSPORT_SEND_REPLY, MPI_POINTER PTR_MSG_FC_COMMON_TRANSPORT_SEND_REPLY,
346   FcCommonTransportSendReply_t, MPI_POINTER pFcCommonTransportSendReply_t;
347 
348 
349 /****************************************************************************/
350 /* FC Primitive Send messages                                               */
351 /****************************************************************************/
352 
353 typedef struct _MSG_FC_PRIMITIVE_SEND_REQUEST
354 {
355     U8                      SendFlags;          /* 00h */
356     U8                      Reserved;           /* 01h */
357     U8                      ChainOffset;        /* 02h */
358     U8                      Function;           /* 03h */
359     U16                     Reserved1;          /* 04h */
360     U8                      Reserved2;          /* 06h */
361     U8                      MsgFlags;           /* 07h */
362     U32                     MsgContext;         /* 08h */
363     U8                      FcPrimitive[4];     /* 0Ch */
364 } MSG_FC_PRIMITIVE_SEND_REQUEST, MPI_POINTER PTR_MSG_FC_PRIMITIVE_SEND_REQUEST,
365   FcPrimitiveSendRequest_t, MPI_POINTER pFcPrimitiveSendRequest_t;
366 
367 #define MPI_FC_PRIM_SEND_FLAGS_PORT_MASK       (0x01)
368 #define MPI_FC_PRIM_SEND_FLAGS_ML_RESET_LINK   (0x02)
369 #define MPI_FC_PRIM_SEND_FLAGS_RESET_LINK      (0x04)
370 #define MPI_FC_PRIM_SEND_FLAGS_STOP_SEND       (0x08)
371 #define MPI_FC_PRIM_SEND_FLAGS_SEND_ONCE       (0x10)
372 #define MPI_FC_PRIM_SEND_FLAGS_SEND_AROUND     (0x20)
373 #define MPI_FC_PRIM_SEND_FLAGS_UNTIL_FULL      (0x40)
374 #define MPI_FC_PRIM_SEND_FLAGS_FOREVER         (0x80)
375 
376 /* FC Primitive Send Reply */
377 typedef struct _MSG_FC_PRIMITIVE_SEND_REPLY
378 {
379     U8                      SendFlags;          /* 00h */
380     U8                      Reserved;           /* 01h */
381     U8                      MsgLength;          /* 02h */
382     U8                      Function;           /* 03h */
383     U16                     Reserved1;          /* 04h */
384     U8                      Reserved2;          /* 06h */
385     U8                      MsgFlags;           /* 07h */
386     U32                     MsgContext;         /* 08h */
387     U16                     Reserved3;          /* 0Ch */
388     U16                     IOCStatus;          /* 0Eh */
389     U32                     IOCLogInfo;         /* 10h */
390 } MSG_FC_PRIMITIVE_SEND_REPLY, MPI_POINTER PTR_MSG_FC_PRIMITIVE_SEND_REPLY,
391   FcPrimitiveSendReply_t, MPI_POINTER pFcPrimitiveSendReply_t;
392 
393 #endif
394 
395