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