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