xref: /freebsd/sys/dev/mpt/mpilib/mpi_lan.h (revision 39ee7a7a6bdd1557b1c3532abf60d139798ac88b)
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_lan.h
34  *          Title:  MPI LAN messages and structures
35  *  Creation Date:  June 30, 2000
36  *
37  *    mpi_lan.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  *  05-24-00  00.10.02  Added LANStatus field to _MSG_LAN_SEND_REPLY.
46  *                      Added LANStatus field to _MSG_LAN_RECEIVE_POST_REPLY.
47  *                      Moved ListCount field in _MSG_LAN_RECEIVE_POST_REPLY.
48  *  06-06-00  01.00.01  Update version number for 1.0 release.
49  *  06-12-00  01.00.02  Added MPI_ to BUCKETSTATUS_ definitions.
50  *  06-22-00  01.00.03  Major changes to match new LAN definition in 1.0 spec.
51  *  06-30-00  01.00.04  Added Context Reply definitions per revised proposal.
52  *                      Changed transaction context usage to bucket/buffer.
53  *  07-05-00  01.00.05  Removed LAN_RECEIVE_POST_BUCKET_CONTEXT_MASK definition
54  *                      to lan private header file
55  *  11-02-00  01.01.01  Original release for post 1.0 work
56  *  02-20-01  01.01.02  Started using MPI_POINTER.
57  *  03-27-01  01.01.03  Added structure offset comments.
58  *  08-08-01  01.02.01  Original release for v1.2 work.
59  *  05-11-04  01.03.01  Original release for MPI v1.3.
60  *  08-19-04  01.05.01  Original release for MPI v1.5.
61  *  --------------------------------------------------------------------------
62  */
63 
64 #ifndef MPI_LAN_H
65 #define MPI_LAN_H
66 
67 
68 /******************************************************************************
69 *
70 *               L A N    M e s s a g e s
71 *
72 *******************************************************************************/
73 
74 /* LANSend messages */
75 
76 typedef struct _MSG_LAN_SEND_REQUEST
77 {
78     U16                     Reserved;           /* 00h */
79     U8                      ChainOffset;        /* 02h */
80     U8                      Function;           /* 03h */
81     U16                     Reserved2;          /* 04h */
82     U8                      PortNumber;         /* 06h */
83     U8                      MsgFlags;           /* 07h */
84     U32                     MsgContext;         /* 08h */
85     SGE_MPI_UNION           SG_List[1];         /* 0Ch */
86 } MSG_LAN_SEND_REQUEST, MPI_POINTER PTR_MSG_LAN_SEND_REQUEST,
87   LANSendRequest_t, MPI_POINTER pLANSendRequest_t;
88 
89 
90 typedef struct _MSG_LAN_SEND_REPLY
91 {
92     U16                     Reserved;           /* 00h */
93     U8                      MsgLength;          /* 02h */
94     U8                      Function;           /* 03h */
95     U8                      Reserved2;          /* 04h */
96     U8                      NumberOfContexts;   /* 05h */
97     U8                      PortNumber;         /* 06h */
98     U8                      MsgFlags;           /* 07h */
99     U32                     MsgContext;         /* 08h */
100     U16                     Reserved3;          /* 0Ch */
101     U16                     IOCStatus;          /* 0Eh */
102     U32                     IOCLogInfo;         /* 10h */
103     U32                     BufferContext;      /* 14h */
104 } MSG_LAN_SEND_REPLY, MPI_POINTER PTR_MSG_LAN_SEND_REPLY,
105   LANSendReply_t, MPI_POINTER pLANSendReply_t;
106 
107 
108 /* LANReceivePost */
109 
110 typedef struct _MSG_LAN_RECEIVE_POST_REQUEST
111 {
112     U16                     Reserved;           /* 00h */
113     U8                      ChainOffset;        /* 02h */
114     U8                      Function;           /* 03h */
115     U16                     Reserved2;          /* 04h */
116     U8                      PortNumber;         /* 06h */
117     U8                      MsgFlags;           /* 07h */
118     U32                     MsgContext;         /* 08h */
119     U32                     BucketCount;        /* 0Ch */
120     SGE_MPI_UNION           SG_List[1];         /* 10h */
121 } MSG_LAN_RECEIVE_POST_REQUEST, MPI_POINTER PTR_MSG_LAN_RECEIVE_POST_REQUEST,
122   LANReceivePostRequest_t, MPI_POINTER pLANReceivePostRequest_t;
123 
124 
125 typedef struct _MSG_LAN_RECEIVE_POST_REPLY
126 {
127     U16                     Reserved;           /* 00h */
128     U8                      MsgLength;          /* 02h */
129     U8                      Function;           /* 03h */
130     U8                      Reserved2;          /* 04h */
131     U8                      NumberOfContexts;   /* 05h */
132     U8                      PortNumber;         /* 06h */
133     U8                      MsgFlags;           /* 07h */
134     U32                     MsgContext;         /* 08h */
135     U16                     Reserved3;          /* 0Ch */
136     U16                     IOCStatus;          /* 0Eh */
137     U32                     IOCLogInfo;         /* 10h */
138     U32                     BucketsRemaining;   /* 14h */
139     U32                     PacketOffset;       /* 18h */
140     U32                     PacketLength;       /* 1Ch */
141     U32                     BucketContext[1];   /* 20h */
142 } MSG_LAN_RECEIVE_POST_REPLY, MPI_POINTER PTR_MSG_LAN_RECEIVE_POST_REPLY,
143   LANReceivePostReply_t, MPI_POINTER pLANReceivePostReply_t;
144 
145 
146 /* LANReset */
147 
148 typedef struct _MSG_LAN_RESET_REQUEST
149 {
150     U16                     Reserved;           /* 00h */
151     U8                      ChainOffset;        /* 02h */
152     U8                      Function;           /* 03h */
153     U16                     Reserved2;          /* 04h */
154     U8                      PortNumber;         /* 05h */
155     U8                      MsgFlags;           /* 07h */
156     U32                     MsgContext;         /* 08h */
157 } MSG_LAN_RESET_REQUEST, MPI_POINTER PTR_MSG_LAN_RESET_REQUEST,
158   LANResetRequest_t, MPI_POINTER pLANResetRequest_t;
159 
160 
161 typedef struct _MSG_LAN_RESET_REPLY
162 {
163     U16                     Reserved;           /* 00h */
164     U8                      MsgLength;          /* 02h */
165     U8                      Function;           /* 03h */
166     U16                     Reserved2;          /* 04h */
167     U8                      PortNumber;         /* 06h */
168     U8                      MsgFlags;           /* 07h */
169     U32                     MsgContext;         /* 08h */
170     U16                     Reserved3;          /* 0Ch */
171     U16                     IOCStatus;          /* 0Eh */
172     U32                     IOCLogInfo;         /* 10h */
173 } MSG_LAN_RESET_REPLY, MPI_POINTER PTR_MSG_LAN_RESET_REPLY,
174   LANResetReply_t, MPI_POINTER pLANResetReply_t;
175 
176 
177 /****************************************************************************/
178 /* LAN Context Reply defines and macros                                     */
179 /****************************************************************************/
180 
181 #define LAN_REPLY_PACKET_LENGTH_MASK            (0x0000FFFF)
182 #define LAN_REPLY_PACKET_LENGTH_SHIFT           (0)
183 #define LAN_REPLY_BUCKET_CONTEXT_MASK           (0x07FF0000)
184 #define LAN_REPLY_BUCKET_CONTEXT_SHIFT          (16)
185 #define LAN_REPLY_BUFFER_CONTEXT_MASK           (0x07FFFFFF)
186 #define LAN_REPLY_BUFFER_CONTEXT_SHIFT          (0)
187 #define LAN_REPLY_FORM_MASK                     (0x18000000)
188 #define LAN_REPLY_FORM_RECEIVE_SINGLE           (0x00)
189 #define LAN_REPLY_FORM_RECEIVE_MULTIPLE         (0x01)
190 #define LAN_REPLY_FORM_SEND_SINGLE              (0x02)
191 #define LAN_REPLY_FORM_MESSAGE_CONTEXT          (0x03)
192 #define LAN_REPLY_FORM_SHIFT                    (27)
193 
194 #define GET_LAN_PACKET_LENGTH(x)    (((x) & LAN_REPLY_PACKET_LENGTH_MASK)   \
195                                         >> LAN_REPLY_PACKET_LENGTH_SHIFT)
196 
197 #define SET_LAN_PACKET_LENGTH(x, lth)                                       \
198             ((x) = ((x) & ~LAN_REPLY_PACKET_LENGTH_MASK) |                  \
199                             (((lth) << LAN_REPLY_PACKET_LENGTH_SHIFT) &     \
200                                         LAN_REPLY_PACKET_LENGTH_MASK))
201 
202 #define GET_LAN_BUCKET_CONTEXT(x)   (((x) & LAN_REPLY_BUCKET_CONTEXT_MASK)  \
203                                         >> LAN_REPLY_BUCKET_CONTEXT_SHIFT)
204 
205 #define SET_LAN_BUCKET_CONTEXT(x, ctx)                                      \
206             ((x) = ((x) & ~LAN_REPLY_BUCKET_CONTEXT_MASK) |                 \
207                             (((ctx) << LAN_REPLY_BUCKET_CONTEXT_SHIFT) &    \
208                                         LAN_REPLY_BUCKET_CONTEXT_MASK))
209 
210 #define GET_LAN_BUFFER_CONTEXT(x)   (((x) & LAN_REPLY_BUFFER_CONTEXT_MASK)  \
211                                         >> LAN_REPLY_BUFFER_CONTEXT_SHIFT)
212 
213 #define SET_LAN_BUFFER_CONTEXT(x, ctx)                                      \
214             ((x) = ((x) & ~LAN_REPLY_BUFFER_CONTEXT_MASK) |                 \
215                             (((ctx) << LAN_REPLY_BUFFER_CONTEXT_SHIFT) &    \
216                                         LAN_REPLY_BUFFER_CONTEXT_MASK))
217 
218 #define GET_LAN_FORM(x)             (((x) & LAN_REPLY_FORM_MASK)            \
219                                         >> LAN_REPLY_FORM_SHIFT)
220 
221 #define SET_LAN_FORM(x, frm)                                                \
222             ((x) = ((x) & ~LAN_REPLY_FORM_MASK) |                           \
223                             (((frm) << LAN_REPLY_FORM_SHIFT) &              \
224                                         LAN_REPLY_FORM_MASK))
225 
226 
227 /****************************************************************************/
228 /* LAN Current Device State defines                                         */
229 /****************************************************************************/
230 
231 #define MPI_LAN_DEVICE_STATE_RESET                     (0x00)
232 #define MPI_LAN_DEVICE_STATE_OPERATIONAL               (0x01)
233 
234 
235 /****************************************************************************/
236 /* LAN Loopback defines                                                     */
237 /****************************************************************************/
238 
239 #define MPI_LAN_TX_MODES_ENABLE_LOOPBACK_SUPPRESSION   (0x01)
240 
241 #endif
242 
243