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