xref: /freebsd/sys/dev/mpt/mpilib/mpi_lan.h (revision 262e143bd46171a6415a5b28af260a5efa2a3db8)
1 /* $FreeBSD$ */
2 /*-
3  * Copyright (c) 2000-2005, 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.02.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  *  --------------------------------------------------------------------------
60  */
61 
62 #ifndef MPI_LAN_H
63 #define MPI_LAN_H
64 
65 
66 /******************************************************************************
67 *
68 *               L A N    M e s s a g e s
69 *
70 *******************************************************************************/
71 
72 /* LANSend messages */
73 
74 typedef struct _MSG_LAN_SEND_REQUEST
75 {
76     U16                     Reserved;           /* 00h */
77     U8                      ChainOffset;        /* 02h */
78     U8                      Function;           /* 03h */
79     U16                     Reserved2;          /* 04h */
80     U8                      PortNumber;         /* 06h */
81     U8                      MsgFlags;           /* 07h */
82     U32                     MsgContext;         /* 08h */
83     SGE_MPI_UNION           SG_List[1];         /* 0Ch */
84 } MSG_LAN_SEND_REQUEST, MPI_POINTER PTR_MSG_LAN_SEND_REQUEST,
85   LANSendRequest_t, MPI_POINTER pLANSendRequest_t;
86 
87 
88 typedef struct _MSG_LAN_SEND_REPLY
89 {
90     U16                     Reserved;           /* 00h */
91     U8                      MsgLength;          /* 02h */
92     U8                      Function;           /* 03h */
93     U8                      Reserved2;          /* 04h */
94     U8                      NumberOfContexts;   /* 05h */
95     U8                      PortNumber;         /* 06h */
96     U8                      MsgFlags;           /* 07h */
97     U32                     MsgContext;         /* 08h */
98     U16                     Reserved3;          /* 0Ch */
99     U16                     IOCStatus;          /* 0Eh */
100     U32                     IOCLogInfo;         /* 10h */
101     U32                     BufferContext;      /* 14h */
102 } MSG_LAN_SEND_REPLY, MPI_POINTER PTR_MSG_LAN_SEND_REPLY,
103   LANSendReply_t, MPI_POINTER pLANSendReply_t;
104 
105 
106 /* LANReceivePost */
107 
108 typedef struct _MSG_LAN_RECEIVE_POST_REQUEST
109 {
110     U16                     Reserved;           /* 00h */
111     U8                      ChainOffset;        /* 02h */
112     U8                      Function;           /* 03h */
113     U16                     Reserved2;          /* 04h */
114     U8                      PortNumber;         /* 06h */
115     U8                      MsgFlags;           /* 07h */
116     U32                     MsgContext;         /* 08h */
117     U32                     BucketCount;        /* 0Ch */
118     SGE_MPI_UNION           SG_List[1];         /* 10h */
119 } MSG_LAN_RECEIVE_POST_REQUEST, MPI_POINTER PTR_MSG_LAN_RECEIVE_POST_REQUEST,
120   LANReceivePostRequest_t, MPI_POINTER pLANReceivePostRequest_t;
121 
122 
123 typedef struct _MSG_LAN_RECEIVE_POST_REPLY
124 {
125     U16                     Reserved;           /* 00h */
126     U8                      MsgLength;          /* 02h */
127     U8                      Function;           /* 03h */
128     U8                      Reserved2;          /* 04h */
129     U8                      NumberOfContexts;   /* 05h */
130     U8                      PortNumber;         /* 06h */
131     U8                      MsgFlags;           /* 07h */
132     U32                     MsgContext;         /* 08h */
133     U16                     Reserved3;          /* 0Ch */
134     U16                     IOCStatus;          /* 0Eh */
135     U32                     IOCLogInfo;         /* 10h */
136     U32                     BucketsRemaining;   /* 14h */
137     U32                     PacketOffset;       /* 18h */
138     U32                     PacketLength;       /* 1Ch */
139     U32                     BucketContext[1];   /* 20h */
140 } MSG_LAN_RECEIVE_POST_REPLY, MPI_POINTER PTR_MSG_LAN_RECEIVE_POST_REPLY,
141   LANReceivePostReply_t, MPI_POINTER pLANReceivePostReply_t;
142 
143 
144 /* LANReset */
145 
146 typedef struct _MSG_LAN_RESET_REQUEST
147 {
148     U16                     Reserved;           /* 00h */
149     U8                      ChainOffset;        /* 02h */
150     U8                      Function;           /* 03h */
151     U16                     Reserved2;          /* 04h */
152     U8                      PortNumber;         /* 05h */
153     U8                      MsgFlags;           /* 07h */
154     U32                     MsgContext;         /* 08h */
155 } MSG_LAN_RESET_REQUEST, MPI_POINTER PTR_MSG_LAN_RESET_REQUEST,
156   LANResetRequest_t, MPI_POINTER pLANResetRequest_t;
157 
158 
159 typedef struct _MSG_LAN_RESET_REPLY
160 {
161     U16                     Reserved;           /* 00h */
162     U8                      MsgLength;          /* 02h */
163     U8                      Function;           /* 03h */
164     U16                     Reserved2;          /* 04h */
165     U8                      PortNumber;         /* 06h */
166     U8                      MsgFlags;           /* 07h */
167     U32                     MsgContext;         /* 08h */
168     U16                     Reserved3;          /* 0Ch */
169     U16                     IOCStatus;          /* 0Eh */
170     U32                     IOCLogInfo;         /* 10h */
171 } MSG_LAN_RESET_REPLY, MPI_POINTER PTR_MSG_LAN_RESET_REPLY,
172   LANResetReply_t, MPI_POINTER pLANResetReply_t;
173 
174 
175 /****************************************************************************/
176 /* LAN Context Reply defines and macros                                     */
177 /****************************************************************************/
178 
179 #define LAN_REPLY_PACKET_LENGTH_MASK            (0x0000FFFF)
180 #define LAN_REPLY_PACKET_LENGTH_SHIFT           (0)
181 #define LAN_REPLY_BUCKET_CONTEXT_MASK           (0x07FF0000)
182 #define LAN_REPLY_BUCKET_CONTEXT_SHIFT          (16)
183 #define LAN_REPLY_BUFFER_CONTEXT_MASK           (0x07FFFFFF)
184 #define LAN_REPLY_BUFFER_CONTEXT_SHIFT          (0)
185 #define LAN_REPLY_FORM_MASK                     (0x18000000)
186 #define LAN_REPLY_FORM_RECEIVE_SINGLE           (0x00)
187 #define LAN_REPLY_FORM_RECEIVE_MULTIPLE         (0x01)
188 #define LAN_REPLY_FORM_SEND_SINGLE              (0x02)
189 #define LAN_REPLY_FORM_MESSAGE_CONTEXT          (0x03)
190 #define LAN_REPLY_FORM_SHIFT                    (27)
191 
192 #define GET_LAN_PACKET_LENGTH(x)    (((x) & LAN_REPLY_PACKET_LENGTH_MASK)   \
193                                         >> LAN_REPLY_PACKET_LENGTH_SHIFT)
194 
195 #define SET_LAN_PACKET_LENGTH(x, lth)                                       \
196             ((x) = ((x) & ~LAN_REPLY_PACKET_LENGTH_MASK) |                  \
197                             (((lth) << LAN_REPLY_PACKET_LENGTH_SHIFT) &     \
198                                         LAN_REPLY_PACKET_LENGTH_MASK))
199 
200 #define GET_LAN_BUCKET_CONTEXT(x)   (((x) & LAN_REPLY_BUCKET_CONTEXT_MASK)  \
201                                         >> LAN_REPLY_BUCKET_CONTEXT_SHIFT)
202 
203 #define SET_LAN_BUCKET_CONTEXT(x, ctx)                                      \
204             ((x) = ((x) & ~LAN_REPLY_BUCKET_CONTEXT_MASK) |                 \
205                             (((ctx) << LAN_REPLY_BUCKET_CONTEXT_SHIFT) &    \
206                                         LAN_REPLY_BUCKET_CONTEXT_MASK))
207 
208 #define GET_LAN_BUFFER_CONTEXT(x)   (((x) & LAN_REPLY_BUFFER_CONTEXT_MASK)  \
209                                         >> LAN_REPLY_BUFFER_CONTEXT_SHIFT)
210 
211 #define SET_LAN_BUFFER_CONTEXT(x, ctx)                                      \
212             ((x) = ((x) & ~LAN_REPLY_BUFFER_CONTEXT_MASK) |                 \
213                             (((ctx) << LAN_REPLY_BUFFER_CONTEXT_SHIFT) &    \
214                                         LAN_REPLY_BUFFER_CONTEXT_MASK))
215 
216 #define GET_LAN_FORM(x)             (((x) & LAN_REPLY_FORM_MASK)            \
217                                         >> LAN_REPLY_FORM_SHIFT)
218 
219 #define SET_LAN_FORM(x, frm)                                                \
220             ((x) = ((x) & ~LAN_REPLY_FORM_MASK) |                           \
221                             (((frm) << LAN_REPLY_FORM_SHIFT) &              \
222                                         LAN_REPLY_FORM_MASK))
223 
224 
225 /****************************************************************************/
226 /* LAN Current Device State defines                                         */
227 /****************************************************************************/
228 
229 #define MPI_LAN_DEVICE_STATE_RESET                     (0x00)
230 #define MPI_LAN_DEVICE_STATE_OPERATIONAL               (0x01)
231 
232 
233 /****************************************************************************/
234 /* LAN Loopback defines                                                     */
235 /****************************************************************************/
236 
237 #define MPI_LAN_TX_MODES_ENABLE_LOOPBACK_SUPPRESSION   (0x01)
238 
239 #endif
240 
241