xref: /freebsd/sys/dev/mpt/mpilib/mpi_lan.h (revision d0b2dbfa0ecf2bbc9709efc5e20baf8e4b44bbbf)
1 /*-
2  * SPDX-License-Identifier: BSD-3-Clause
3  *
4  * Copyright (c) 2000-2010, LSI Logic Corporation and its contributors.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are
9  * met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
13  *    substantially similar to the "NO WARRANTY" disclaimer below
14  *    ("Disclaimer") and any redistribution must be conditioned upon including
15  *    a substantially similar Disclaimer requirement for further binary
16  *    redistribution.
17  * 3. Neither the name of the LSI Logic Corporation nor the names of its
18  *    contributors may be used to endorse or promote products derived from
19  *    this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT
31  * OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  *
33  *
34  *           Name:  mpi_lan.h
35  *          Title:  MPI LAN messages and structures
36  *  Creation Date:  June 30, 2000
37  *
38  *    mpi_lan.h Version:  01.05.01
39  *
40  *  Version History
41  *  ---------------
42  *
43  *  Date      Version   Description
44  *  --------  --------  ------------------------------------------------------
45  *  05-08-00  00.10.01  Original release for 0.10 spec dated 4/26/2000.
46  *  05-24-00  00.10.02  Added LANStatus field to _MSG_LAN_SEND_REPLY.
47  *                      Added LANStatus field to _MSG_LAN_RECEIVE_POST_REPLY.
48  *                      Moved ListCount field in _MSG_LAN_RECEIVE_POST_REPLY.
49  *  06-06-00  01.00.01  Update version number for 1.0 release.
50  *  06-12-00  01.00.02  Added MPI_ to BUCKETSTATUS_ definitions.
51  *  06-22-00  01.00.03  Major changes to match new LAN definition in 1.0 spec.
52  *  06-30-00  01.00.04  Added Context Reply definitions per revised proposal.
53  *                      Changed transaction context usage to bucket/buffer.
54  *  07-05-00  01.00.05  Removed LAN_RECEIVE_POST_BUCKET_CONTEXT_MASK definition
55  *                      to lan private header file
56  *  11-02-00  01.01.01  Original release for post 1.0 work
57  *  02-20-01  01.01.02  Started using MPI_POINTER.
58  *  03-27-01  01.01.03  Added structure offset comments.
59  *  08-08-01  01.02.01  Original release for v1.2 work.
60  *  05-11-04  01.03.01  Original release for MPI v1.3.
61  *  08-19-04  01.05.01  Original release for MPI v1.5.
62  *  --------------------------------------------------------------------------
63  */
64 
65 #ifndef MPI_LAN_H
66 #define MPI_LAN_H
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 typedef struct _MSG_LAN_SEND_REPLY
90 {
91     U16                     Reserved;           /* 00h */
92     U8                      MsgLength;          /* 02h */
93     U8                      Function;           /* 03h */
94     U8                      Reserved2;          /* 04h */
95     U8                      NumberOfContexts;   /* 05h */
96     U8                      PortNumber;         /* 06h */
97     U8                      MsgFlags;           /* 07h */
98     U32                     MsgContext;         /* 08h */
99     U16                     Reserved3;          /* 0Ch */
100     U16                     IOCStatus;          /* 0Eh */
101     U32                     IOCLogInfo;         /* 10h */
102     U32                     BufferContext;      /* 14h */
103 } MSG_LAN_SEND_REPLY, MPI_POINTER PTR_MSG_LAN_SEND_REPLY,
104   LANSendReply_t, MPI_POINTER pLANSendReply_t;
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 typedef struct _MSG_LAN_RECEIVE_POST_REPLY
123 {
124     U16                     Reserved;           /* 00h */
125     U8                      MsgLength;          /* 02h */
126     U8                      Function;           /* 03h */
127     U8                      Reserved2;          /* 04h */
128     U8                      NumberOfContexts;   /* 05h */
129     U8                      PortNumber;         /* 06h */
130     U8                      MsgFlags;           /* 07h */
131     U32                     MsgContext;         /* 08h */
132     U16                     Reserved3;          /* 0Ch */
133     U16                     IOCStatus;          /* 0Eh */
134     U32                     IOCLogInfo;         /* 10h */
135     U32                     BucketsRemaining;   /* 14h */
136     U32                     PacketOffset;       /* 18h */
137     U32                     PacketLength;       /* 1Ch */
138     U32                     BucketContext[1];   /* 20h */
139 } MSG_LAN_RECEIVE_POST_REPLY, MPI_POINTER PTR_MSG_LAN_RECEIVE_POST_REPLY,
140   LANReceivePostReply_t, MPI_POINTER pLANReceivePostReply_t;
141 
142 /* LANReset */
143 
144 typedef struct _MSG_LAN_RESET_REQUEST
145 {
146     U16                     Reserved;           /* 00h */
147     U8                      ChainOffset;        /* 02h */
148     U8                      Function;           /* 03h */
149     U16                     Reserved2;          /* 04h */
150     U8                      PortNumber;         /* 05h */
151     U8                      MsgFlags;           /* 07h */
152     U32                     MsgContext;         /* 08h */
153 } MSG_LAN_RESET_REQUEST, MPI_POINTER PTR_MSG_LAN_RESET_REQUEST,
154   LANResetRequest_t, MPI_POINTER pLANResetRequest_t;
155 
156 typedef struct _MSG_LAN_RESET_REPLY
157 {
158     U16                     Reserved;           /* 00h */
159     U8                      MsgLength;          /* 02h */
160     U8                      Function;           /* 03h */
161     U16                     Reserved2;          /* 04h */
162     U8                      PortNumber;         /* 06h */
163     U8                      MsgFlags;           /* 07h */
164     U32                     MsgContext;         /* 08h */
165     U16                     Reserved3;          /* 0Ch */
166     U16                     IOCStatus;          /* 0Eh */
167     U32                     IOCLogInfo;         /* 10h */
168 } MSG_LAN_RESET_REPLY, MPI_POINTER PTR_MSG_LAN_RESET_REPLY,
169   LANResetReply_t, MPI_POINTER pLANResetReply_t;
170 
171 /****************************************************************************/
172 /* LAN Context Reply defines and macros                                     */
173 /****************************************************************************/
174 
175 #define LAN_REPLY_PACKET_LENGTH_MASK            (0x0000FFFF)
176 #define LAN_REPLY_PACKET_LENGTH_SHIFT           (0)
177 #define LAN_REPLY_BUCKET_CONTEXT_MASK           (0x07FF0000)
178 #define LAN_REPLY_BUCKET_CONTEXT_SHIFT          (16)
179 #define LAN_REPLY_BUFFER_CONTEXT_MASK           (0x07FFFFFF)
180 #define LAN_REPLY_BUFFER_CONTEXT_SHIFT          (0)
181 #define LAN_REPLY_FORM_MASK                     (0x18000000)
182 #define LAN_REPLY_FORM_RECEIVE_SINGLE           (0x00)
183 #define LAN_REPLY_FORM_RECEIVE_MULTIPLE         (0x01)
184 #define LAN_REPLY_FORM_SEND_SINGLE              (0x02)
185 #define LAN_REPLY_FORM_MESSAGE_CONTEXT          (0x03)
186 #define LAN_REPLY_FORM_SHIFT                    (27)
187 
188 #define GET_LAN_PACKET_LENGTH(x)    (((x) & LAN_REPLY_PACKET_LENGTH_MASK)   \
189                                         >> LAN_REPLY_PACKET_LENGTH_SHIFT)
190 
191 #define SET_LAN_PACKET_LENGTH(x, lth)                                       \
192             ((x) = ((x) & ~LAN_REPLY_PACKET_LENGTH_MASK) |                  \
193                             (((lth) << LAN_REPLY_PACKET_LENGTH_SHIFT) &     \
194                                         LAN_REPLY_PACKET_LENGTH_MASK))
195 
196 #define GET_LAN_BUCKET_CONTEXT(x)   (((x) & LAN_REPLY_BUCKET_CONTEXT_MASK)  \
197                                         >> LAN_REPLY_BUCKET_CONTEXT_SHIFT)
198 
199 #define SET_LAN_BUCKET_CONTEXT(x, ctx)                                      \
200             ((x) = ((x) & ~LAN_REPLY_BUCKET_CONTEXT_MASK) |                 \
201                             (((ctx) << LAN_REPLY_BUCKET_CONTEXT_SHIFT) &    \
202                                         LAN_REPLY_BUCKET_CONTEXT_MASK))
203 
204 #define GET_LAN_BUFFER_CONTEXT(x)   (((x) & LAN_REPLY_BUFFER_CONTEXT_MASK)  \
205                                         >> LAN_REPLY_BUFFER_CONTEXT_SHIFT)
206 
207 #define SET_LAN_BUFFER_CONTEXT(x, ctx)                                      \
208             ((x) = ((x) & ~LAN_REPLY_BUFFER_CONTEXT_MASK) |                 \
209                             (((ctx) << LAN_REPLY_BUFFER_CONTEXT_SHIFT) &    \
210                                         LAN_REPLY_BUFFER_CONTEXT_MASK))
211 
212 #define GET_LAN_FORM(x)             (((x) & LAN_REPLY_FORM_MASK)            \
213                                         >> LAN_REPLY_FORM_SHIFT)
214 
215 #define SET_LAN_FORM(x, frm)                                                \
216             ((x) = ((x) & ~LAN_REPLY_FORM_MASK) |                           \
217                             (((frm) << LAN_REPLY_FORM_SHIFT) &              \
218                                         LAN_REPLY_FORM_MASK))
219 
220 /****************************************************************************/
221 /* LAN Current Device State defines                                         */
222 /****************************************************************************/
223 
224 #define MPI_LAN_DEVICE_STATE_RESET                     (0x00)
225 #define MPI_LAN_DEVICE_STATE_OPERATIONAL               (0x01)
226 
227 /****************************************************************************/
228 /* LAN Loopback defines                                                     */
229 /****************************************************************************/
230 
231 #define MPI_LAN_TX_MODES_ENABLE_LOOPBACK_SUPPRESSION   (0x01)
232 
233 #endif
234