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