blob: 098dd022a7ebeea240e264f08c059b8735413586 [file] [log] [blame]
dea31012005-04-17 16:05:31 -05001/*******************************************************************
2 * This file is part of the Emulex Linux Device Driver for *
James.Smart@Emulex.Comc44ce172005-06-25 10:34:39 -04003 * Fibre Channel Host Bus Adapters. *
James Smart9413aff2007-04-25 09:53:35 -04004 * Copyright (C) 2004-2007 Emulex. All rights reserved. *
James.Smart@Emulex.Comc44ce172005-06-25 10:34:39 -04005 * EMULEX and SLI are trademarks of Emulex. *
dea31012005-04-17 16:05:31 -05006 * www.emulex.com *
7 * *
8 * This program is free software; you can redistribute it and/or *
James.Smart@Emulex.Comc44ce172005-06-25 10:34:39 -04009 * modify it under the terms of version 2 of the GNU General *
10 * Public License as published by the Free Software Foundation. *
11 * This program is distributed in the hope that it will be useful. *
12 * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND *
13 * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, *
14 * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE *
15 * DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD *
16 * TO BE LEGALLY INVALID. See the GNU General Public License for *
17 * more details, a copy of which can be found in the file COPYING *
18 * included with this package. *
dea31012005-04-17 16:05:31 -050019 *******************************************************************/
20
dea31012005-04-17 16:05:31 -050021#define FDMI_DID 0xfffffaU
22#define NameServer_DID 0xfffffcU
23#define SCR_DID 0xfffffdU
24#define Fabric_DID 0xfffffeU
25#define Bcast_DID 0xffffffU
26#define Mask_DID 0xffffffU
27#define CT_DID_MASK 0xffff00U
28#define Fabric_DID_MASK 0xfff000U
29#define WELL_KNOWN_DID_MASK 0xfffff0U
30
31#define PT2PT_LocalID 1
32#define PT2PT_RemoteID 2
33
34#define FF_DEF_EDTOV 2000 /* Default E_D_TOV (2000ms) */
35#define FF_DEF_ALTOV 15 /* Default AL_TIME (15ms) */
36#define FF_DEF_RATOV 2 /* Default RA_TOV (2s) */
37#define FF_DEF_ARBTOV 1900 /* Default ARB_TOV (1900ms) */
38
39#define LPFC_BUF_RING0 64 /* Number of buffers to post to RING
40 0 */
41
42#define FCELSSIZE 1024 /* maximum ELS transfer size */
43
44#define LPFC_FCP_RING 0 /* ring 0 for FCP initiator commands */
James Smarta4bc3372006-12-02 13:34:16 -050045#define LPFC_EXTRA_RING 1 /* ring 1 for other protocols */
dea31012005-04-17 16:05:31 -050046#define LPFC_ELS_RING 2 /* ring 2 for ELS commands */
47#define LPFC_FCP_NEXT_RING 3
48
49#define SLI2_IOCB_CMD_R0_ENTRIES 172 /* SLI-2 FCP command ring entries */
50#define SLI2_IOCB_RSP_R0_ENTRIES 134 /* SLI-2 FCP response ring entries */
James Smarta4bc3372006-12-02 13:34:16 -050051#define SLI2_IOCB_CMD_R1_ENTRIES 4 /* SLI-2 extra command ring entries */
52#define SLI2_IOCB_RSP_R1_ENTRIES 4 /* SLI-2 extra response ring entries */
dea31012005-04-17 16:05:31 -050053#define SLI2_IOCB_CMD_R1XTRA_ENTRIES 36 /* SLI-2 extra FCP cmd ring entries */
54#define SLI2_IOCB_RSP_R1XTRA_ENTRIES 52 /* SLI-2 extra FCP rsp ring entries */
55#define SLI2_IOCB_CMD_R2_ENTRIES 20 /* SLI-2 ELS command ring entries */
56#define SLI2_IOCB_RSP_R2_ENTRIES 20 /* SLI-2 ELS response ring entries */
57#define SLI2_IOCB_CMD_R3_ENTRIES 0
58#define SLI2_IOCB_RSP_R3_ENTRIES 0
59#define SLI2_IOCB_CMD_R3XTRA_ENTRIES 24
60#define SLI2_IOCB_RSP_R3XTRA_ENTRIES 32
61
James Smarted957682007-06-17 19:56:37 -050062#define SLI2_IOCB_CMD_SIZE 32
63#define SLI2_IOCB_RSP_SIZE 32
64#define SLI3_IOCB_CMD_SIZE 128
65#define SLI3_IOCB_RSP_SIZE 64
66
James Smart92d7f7b2007-06-17 19:56:38 -050067
dea31012005-04-17 16:05:31 -050068/* Common Transport structures and definitions */
69
70union CtRevisionId {
71 /* Structure is in Big Endian format */
72 struct {
73 uint32_t Revision:8;
74 uint32_t InId:24;
75 } bits;
76 uint32_t word;
77};
78
79union CtCommandResponse {
80 /* Structure is in Big Endian format */
81 struct {
82 uint32_t CmdRsp:16;
83 uint32_t Size:16;
84 } bits;
85 uint32_t word;
86};
87
James Smart92d7f7b2007-06-17 19:56:38 -050088#define FC4_FEATURE_INIT 0x2
89#define FC4_FEATURE_TARGET 0x1
90
dea31012005-04-17 16:05:31 -050091struct lpfc_sli_ct_request {
92 /* Structure is in Big Endian format */
93 union CtRevisionId RevisionId;
94 uint8_t FsType;
95 uint8_t FsSubType;
96 uint8_t Options;
97 uint8_t Rsrvd1;
98 union CtCommandResponse CommandResponse;
99 uint8_t Rsrvd2;
100 uint8_t ReasonCode;
101 uint8_t Explanation;
102 uint8_t VendorUnique;
103
104 union {
105 uint32_t PortID;
106 struct gid {
107 uint8_t PortType; /* for GID_PT requests */
108 uint8_t DomainScope;
109 uint8_t AreaScope;
110 uint8_t Fc4Type; /* for GID_FT requests */
111 } gid;
112 struct rft {
113 uint32_t PortId; /* For RFT_ID requests */
114
115#ifdef __BIG_ENDIAN_BITFIELD
116 uint32_t rsvd0:16;
117 uint32_t rsvd1:7;
118 uint32_t fcpReg:1; /* Type 8 */
119 uint32_t rsvd2:2;
120 uint32_t ipReg:1; /* Type 5 */
121 uint32_t rsvd3:5;
122#else /* __LITTLE_ENDIAN_BITFIELD */
123 uint32_t rsvd0:16;
124 uint32_t fcpReg:1; /* Type 8 */
125 uint32_t rsvd1:7;
126 uint32_t rsvd3:5;
127 uint32_t ipReg:1; /* Type 5 */
128 uint32_t rsvd2:2;
129#endif
130
131 uint32_t rsvd[7];
132 } rft;
133 struct rnn {
134 uint32_t PortId; /* For RNN_ID requests */
135 uint8_t wwnn[8];
136 } rnn;
137 struct rsnn { /* For RSNN_ID requests */
138 uint8_t wwnn[8];
139 uint8_t len;
140 uint8_t symbname[255];
141 } rsnn;
James Smart92d7f7b2007-06-17 19:56:38 -0500142 struct rspn { /* For RSPN_ID requests */
143 uint32_t PortId;
144 uint8_t len;
145 uint8_t symbname[255];
146 } rspn;
147 struct gff {
148 uint32_t PortId;
149 } gff;
150 struct gff_acc {
151 uint8_t fbits[128];
152 } gff_acc;
James Smart51ef4c22007-08-02 11:10:31 -0400153#ifdef __BIG_ENDIAN_BITFIELD
154#define FCP_TYPE_FEATURE_OFFSET 7
155#else /* __LITTLE_ENDIAN_BITFIELD */
James Smart92d7f7b2007-06-17 19:56:38 -0500156#define FCP_TYPE_FEATURE_OFFSET 4
James Smart51ef4c22007-08-02 11:10:31 -0400157#endif
James Smart92d7f7b2007-06-17 19:56:38 -0500158 struct rff {
159 uint32_t PortId;
160 uint8_t reserved[2];
161 uint8_t fbits;
162 uint8_t type_code; /* type=8 for FCP */
163 } rff;
dea31012005-04-17 16:05:31 -0500164 } un;
165};
166
167#define SLI_CT_REVISION 1
James Smart92d7f7b2007-06-17 19:56:38 -0500168#define GID_REQUEST_SZ (offsetof(struct lpfc_sli_ct_request, un) + \
169 sizeof(struct gid))
170#define GFF_REQUEST_SZ (offsetof(struct lpfc_sli_ct_request, un) + \
171 sizeof(struct gff))
172#define RFT_REQUEST_SZ (offsetof(struct lpfc_sli_ct_request, un) + \
173 sizeof(struct rft))
174#define RFF_REQUEST_SZ (offsetof(struct lpfc_sli_ct_request, un) + \
175 sizeof(struct rff))
176#define RNN_REQUEST_SZ (offsetof(struct lpfc_sli_ct_request, un) + \
177 sizeof(struct rnn))
178#define RSNN_REQUEST_SZ (offsetof(struct lpfc_sli_ct_request, un) + \
179 sizeof(struct rsnn))
180#define RSPN_REQUEST_SZ (offsetof(struct lpfc_sli_ct_request, un) + \
181 sizeof(struct rspn))
dea31012005-04-17 16:05:31 -0500182
183/*
184 * FsType Definitions
185 */
186
187#define SLI_CT_MANAGEMENT_SERVICE 0xFA
188#define SLI_CT_TIME_SERVICE 0xFB
189#define SLI_CT_DIRECTORY_SERVICE 0xFC
190#define SLI_CT_FABRIC_CONTROLLER_SERVICE 0xFD
191
192/*
193 * Directory Service Subtypes
194 */
195
196#define SLI_CT_DIRECTORY_NAME_SERVER 0x02
197
198/*
199 * Response Codes
200 */
201
202#define SLI_CT_RESPONSE_FS_RJT 0x8001
203#define SLI_CT_RESPONSE_FS_ACC 0x8002
204
205/*
206 * Reason Codes
207 */
208
209#define SLI_CT_NO_ADDITIONAL_EXPL 0x0
210#define SLI_CT_INVALID_COMMAND 0x01
211#define SLI_CT_INVALID_VERSION 0x02
212#define SLI_CT_LOGICAL_ERROR 0x03
213#define SLI_CT_INVALID_IU_SIZE 0x04
214#define SLI_CT_LOGICAL_BUSY 0x05
215#define SLI_CT_PROTOCOL_ERROR 0x07
216#define SLI_CT_UNABLE_TO_PERFORM_REQ 0x09
217#define SLI_CT_REQ_NOT_SUPPORTED 0x0b
218#define SLI_CT_HBA_INFO_NOT_REGISTERED 0x10
219#define SLI_CT_MULTIPLE_HBA_ATTR_OF_SAME_TYPE 0x11
220#define SLI_CT_INVALID_HBA_ATTR_BLOCK_LEN 0x12
221#define SLI_CT_HBA_ATTR_NOT_PRESENT 0x13
222#define SLI_CT_PORT_INFO_NOT_REGISTERED 0x20
223#define SLI_CT_MULTIPLE_PORT_ATTR_OF_SAME_TYPE 0x21
224#define SLI_CT_INVALID_PORT_ATTR_BLOCK_LEN 0x22
225#define SLI_CT_VENDOR_UNIQUE 0xff
226
227/*
228 * Name Server SLI_CT_UNABLE_TO_PERFORM_REQ Explanations
229 */
230
231#define SLI_CT_NO_PORT_ID 0x01
232#define SLI_CT_NO_PORT_NAME 0x02
233#define SLI_CT_NO_NODE_NAME 0x03
234#define SLI_CT_NO_CLASS_OF_SERVICE 0x04
235#define SLI_CT_NO_IP_ADDRESS 0x05
236#define SLI_CT_NO_IPA 0x06
237#define SLI_CT_NO_FC4_TYPES 0x07
238#define SLI_CT_NO_SYMBOLIC_PORT_NAME 0x08
239#define SLI_CT_NO_SYMBOLIC_NODE_NAME 0x09
240#define SLI_CT_NO_PORT_TYPE 0x0A
241#define SLI_CT_ACCESS_DENIED 0x10
242#define SLI_CT_INVALID_PORT_ID 0x11
243#define SLI_CT_DATABASE_EMPTY 0x12
244
245/*
246 * Name Server Command Codes
247 */
248
249#define SLI_CTNS_GA_NXT 0x0100
250#define SLI_CTNS_GPN_ID 0x0112
251#define SLI_CTNS_GNN_ID 0x0113
252#define SLI_CTNS_GCS_ID 0x0114
253#define SLI_CTNS_GFT_ID 0x0117
254#define SLI_CTNS_GSPN_ID 0x0118
255#define SLI_CTNS_GPT_ID 0x011A
James Smart92d7f7b2007-06-17 19:56:38 -0500256#define SLI_CTNS_GFF_ID 0x011F
dea31012005-04-17 16:05:31 -0500257#define SLI_CTNS_GID_PN 0x0121
258#define SLI_CTNS_GID_NN 0x0131
259#define SLI_CTNS_GIP_NN 0x0135
260#define SLI_CTNS_GIPA_NN 0x0136
261#define SLI_CTNS_GSNN_NN 0x0139
262#define SLI_CTNS_GNN_IP 0x0153
263#define SLI_CTNS_GIPA_IP 0x0156
264#define SLI_CTNS_GID_FT 0x0171
265#define SLI_CTNS_GID_PT 0x01A1
266#define SLI_CTNS_RPN_ID 0x0212
267#define SLI_CTNS_RNN_ID 0x0213
268#define SLI_CTNS_RCS_ID 0x0214
269#define SLI_CTNS_RFT_ID 0x0217
270#define SLI_CTNS_RSPN_ID 0x0218
271#define SLI_CTNS_RPT_ID 0x021A
James Smart92d7f7b2007-06-17 19:56:38 -0500272#define SLI_CTNS_RFF_ID 0x021F
dea31012005-04-17 16:05:31 -0500273#define SLI_CTNS_RIP_NN 0x0235
274#define SLI_CTNS_RIPA_NN 0x0236
275#define SLI_CTNS_RSNN_NN 0x0239
276#define SLI_CTNS_DA_ID 0x0300
277
278/*
279 * Port Types
280 */
281
282#define SLI_CTPT_N_PORT 0x01
283#define SLI_CTPT_NL_PORT 0x02
284#define SLI_CTPT_FNL_PORT 0x03
285#define SLI_CTPT_IP 0x04
286#define SLI_CTPT_FCP 0x08
287#define SLI_CTPT_NX_PORT 0x7F
288#define SLI_CTPT_F_PORT 0x81
289#define SLI_CTPT_FL_PORT 0x82
290#define SLI_CTPT_E_PORT 0x84
291
292#define SLI_CT_LAST_ENTRY 0x80000000
293
294/* Fibre Channel Service Parameter definitions */
295
296#define FC_PH_4_0 6 /* FC-PH version 4.0 */
297#define FC_PH_4_1 7 /* FC-PH version 4.1 */
298#define FC_PH_4_2 8 /* FC-PH version 4.2 */
299#define FC_PH_4_3 9 /* FC-PH version 4.3 */
300
301#define FC_PH_LOW 8 /* Lowest supported FC-PH version */
302#define FC_PH_HIGH 9 /* Highest supported FC-PH version */
303#define FC_PH3 0x20 /* FC-PH-3 version */
304
305#define FF_FRAME_SIZE 2048
306
307struct lpfc_name {
Andrew Vasquezf631b4b2005-08-31 15:23:12 -0700308 union {
309 struct {
dea31012005-04-17 16:05:31 -0500310#ifdef __BIG_ENDIAN_BITFIELD
Andrew Vasquezf631b4b2005-08-31 15:23:12 -0700311 uint8_t nameType:4; /* FC Word 0, bit 28:31 */
James.Smart@Emulex.Com1de933f2005-11-28 11:41:15 -0500312 uint8_t IEEEextMsn:4; /* FC Word 0, bit 24:27, bit
313 8:11 of IEEE ext */
dea31012005-04-17 16:05:31 -0500314#else /* __LITTLE_ENDIAN_BITFIELD */
James.Smart@Emulex.Com1de933f2005-11-28 11:41:15 -0500315 uint8_t IEEEextMsn:4; /* FC Word 0, bit 24:27, bit
316 8:11 of IEEE ext */
Andrew Vasquezf631b4b2005-08-31 15:23:12 -0700317 uint8_t nameType:4; /* FC Word 0, bit 28:31 */
dea31012005-04-17 16:05:31 -0500318#endif
319
320#define NAME_IEEE 0x1 /* IEEE name - nameType */
321#define NAME_IEEE_EXT 0x2 /* IEEE extended name */
322#define NAME_FC_TYPE 0x3 /* FC native name type */
323#define NAME_IP_TYPE 0x4 /* IP address */
324#define NAME_CCITT_TYPE 0xC
325#define NAME_CCITT_GR_TYPE 0xE
James.Smart@Emulex.Com1de933f2005-11-28 11:41:15 -0500326 uint8_t IEEEextLsb; /* FC Word 0, bit 16:23, IEEE
327 extended Lsb */
Andrew Vasquezf631b4b2005-08-31 15:23:12 -0700328 uint8_t IEEE[6]; /* FC IEEE address */
Andrew Morton68ce1eb2005-09-21 09:46:54 -0700329 } s;
Andrew Vasquezf631b4b2005-08-31 15:23:12 -0700330 uint8_t wwn[8];
Andrew Morton68ce1eb2005-09-21 09:46:54 -0700331 } u;
dea31012005-04-17 16:05:31 -0500332};
333
334struct csp {
335 uint8_t fcphHigh; /* FC Word 0, byte 0 */
336 uint8_t fcphLow;
337 uint8_t bbCreditMsb;
338 uint8_t bbCreditlsb; /* FC Word 0, byte 3 */
339
340#ifdef __BIG_ENDIAN_BITFIELD
James Smart92d7f7b2007-06-17 19:56:38 -0500341 uint16_t request_multiple_Nport:1; /* FC Word 1, bit 31 */
342 uint16_t randomOffset:1; /* FC Word 1, bit 30 */
343 uint16_t response_multiple_NPort:1; /* FC Word 1, bit 29 */
dea31012005-04-17 16:05:31 -0500344 uint16_t fPort:1; /* FC Word 1, bit 28 */
345 uint16_t altBbCredit:1; /* FC Word 1, bit 27 */
346 uint16_t edtovResolution:1; /* FC Word 1, bit 26 */
347 uint16_t multicast:1; /* FC Word 1, bit 25 */
348 uint16_t broadcast:1; /* FC Word 1, bit 24 */
349
350 uint16_t huntgroup:1; /* FC Word 1, bit 23 */
351 uint16_t simplex:1; /* FC Word 1, bit 22 */
352 uint16_t word1Reserved1:3; /* FC Word 1, bit 21:19 */
353 uint16_t dhd:1; /* FC Word 1, bit 18 */
354 uint16_t contIncSeqCnt:1; /* FC Word 1, bit 17 */
355 uint16_t payloadlength:1; /* FC Word 1, bit 16 */
356#else /* __LITTLE_ENDIAN_BITFIELD */
357 uint16_t broadcast:1; /* FC Word 1, bit 24 */
358 uint16_t multicast:1; /* FC Word 1, bit 25 */
359 uint16_t edtovResolution:1; /* FC Word 1, bit 26 */
360 uint16_t altBbCredit:1; /* FC Word 1, bit 27 */
361 uint16_t fPort:1; /* FC Word 1, bit 28 */
James Smart92d7f7b2007-06-17 19:56:38 -0500362 uint16_t response_multiple_NPort:1; /* FC Word 1, bit 29 */
dea31012005-04-17 16:05:31 -0500363 uint16_t randomOffset:1; /* FC Word 1, bit 30 */
James Smart92d7f7b2007-06-17 19:56:38 -0500364 uint16_t request_multiple_Nport:1; /* FC Word 1, bit 31 */
dea31012005-04-17 16:05:31 -0500365
366 uint16_t payloadlength:1; /* FC Word 1, bit 16 */
367 uint16_t contIncSeqCnt:1; /* FC Word 1, bit 17 */
368 uint16_t dhd:1; /* FC Word 1, bit 18 */
369 uint16_t word1Reserved1:3; /* FC Word 1, bit 21:19 */
370 uint16_t simplex:1; /* FC Word 1, bit 22 */
371 uint16_t huntgroup:1; /* FC Word 1, bit 23 */
372#endif
373
374 uint8_t bbRcvSizeMsb; /* Upper nibble is reserved */
375 uint8_t bbRcvSizeLsb; /* FC Word 1, byte 3 */
376 union {
377 struct {
378 uint8_t word2Reserved1; /* FC Word 2 byte 0 */
379
380 uint8_t totalConcurrSeq; /* FC Word 2 byte 1 */
381 uint8_t roByCategoryMsb; /* FC Word 2 byte 2 */
382
383 uint8_t roByCategoryLsb; /* FC Word 2 byte 3 */
384 } nPort;
385 uint32_t r_a_tov; /* R_A_TOV must be in B.E. format */
386 } w2;
387
388 uint32_t e_d_tov; /* E_D_TOV must be in B.E. format */
389};
390
391struct class_parms {
392#ifdef __BIG_ENDIAN_BITFIELD
393 uint8_t classValid:1; /* FC Word 0, bit 31 */
394 uint8_t intermix:1; /* FC Word 0, bit 30 */
395 uint8_t stackedXparent:1; /* FC Word 0, bit 29 */
396 uint8_t stackedLockDown:1; /* FC Word 0, bit 28 */
397 uint8_t seqDelivery:1; /* FC Word 0, bit 27 */
398 uint8_t word0Reserved1:3; /* FC Word 0, bit 24:26 */
399#else /* __LITTLE_ENDIAN_BITFIELD */
400 uint8_t word0Reserved1:3; /* FC Word 0, bit 24:26 */
401 uint8_t seqDelivery:1; /* FC Word 0, bit 27 */
402 uint8_t stackedLockDown:1; /* FC Word 0, bit 28 */
403 uint8_t stackedXparent:1; /* FC Word 0, bit 29 */
404 uint8_t intermix:1; /* FC Word 0, bit 30 */
405 uint8_t classValid:1; /* FC Word 0, bit 31 */
406
407#endif
408
409 uint8_t word0Reserved2; /* FC Word 0, bit 16:23 */
410
411#ifdef __BIG_ENDIAN_BITFIELD
412 uint8_t iCtlXidReAssgn:2; /* FC Word 0, Bit 14:15 */
413 uint8_t iCtlInitialPa:2; /* FC Word 0, bit 12:13 */
414 uint8_t iCtlAck0capable:1; /* FC Word 0, bit 11 */
415 uint8_t iCtlAckNcapable:1; /* FC Word 0, bit 10 */
416 uint8_t word0Reserved3:2; /* FC Word 0, bit 8: 9 */
417#else /* __LITTLE_ENDIAN_BITFIELD */
418 uint8_t word0Reserved3:2; /* FC Word 0, bit 8: 9 */
419 uint8_t iCtlAckNcapable:1; /* FC Word 0, bit 10 */
420 uint8_t iCtlAck0capable:1; /* FC Word 0, bit 11 */
421 uint8_t iCtlInitialPa:2; /* FC Word 0, bit 12:13 */
422 uint8_t iCtlXidReAssgn:2; /* FC Word 0, Bit 14:15 */
423#endif
424
425 uint8_t word0Reserved4; /* FC Word 0, bit 0: 7 */
426
427#ifdef __BIG_ENDIAN_BITFIELD
428 uint8_t rCtlAck0capable:1; /* FC Word 1, bit 31 */
429 uint8_t rCtlAckNcapable:1; /* FC Word 1, bit 30 */
430 uint8_t rCtlXidInterlck:1; /* FC Word 1, bit 29 */
431 uint8_t rCtlErrorPolicy:2; /* FC Word 1, bit 27:28 */
432 uint8_t word1Reserved1:1; /* FC Word 1, bit 26 */
433 uint8_t rCtlCatPerSeq:2; /* FC Word 1, bit 24:25 */
434#else /* __LITTLE_ENDIAN_BITFIELD */
435 uint8_t rCtlCatPerSeq:2; /* FC Word 1, bit 24:25 */
436 uint8_t word1Reserved1:1; /* FC Word 1, bit 26 */
437 uint8_t rCtlErrorPolicy:2; /* FC Word 1, bit 27:28 */
438 uint8_t rCtlXidInterlck:1; /* FC Word 1, bit 29 */
439 uint8_t rCtlAckNcapable:1; /* FC Word 1, bit 30 */
440 uint8_t rCtlAck0capable:1; /* FC Word 1, bit 31 */
441#endif
442
443 uint8_t word1Reserved2; /* FC Word 1, bit 16:23 */
444 uint8_t rcvDataSizeMsb; /* FC Word 1, bit 8:15 */
445 uint8_t rcvDataSizeLsb; /* FC Word 1, bit 0: 7 */
446
447 uint8_t concurrentSeqMsb; /* FC Word 2, bit 24:31 */
448 uint8_t concurrentSeqLsb; /* FC Word 2, bit 16:23 */
449 uint8_t EeCreditSeqMsb; /* FC Word 2, bit 8:15 */
450 uint8_t EeCreditSeqLsb; /* FC Word 2, bit 0: 7 */
451
452 uint8_t openSeqPerXchgMsb; /* FC Word 3, bit 24:31 */
453 uint8_t openSeqPerXchgLsb; /* FC Word 3, bit 16:23 */
454 uint8_t word3Reserved1; /* Fc Word 3, bit 8:15 */
455 uint8_t word3Reserved2; /* Fc Word 3, bit 0: 7 */
456};
457
458struct serv_parm { /* Structure is in Big Endian format */
459 struct csp cmn;
460 struct lpfc_name portName;
461 struct lpfc_name nodeName;
462 struct class_parms cls1;
463 struct class_parms cls2;
464 struct class_parms cls3;
465 struct class_parms cls4;
466 uint8_t vendorVersion[16];
467};
468
469/*
470 * Extended Link Service LS_COMMAND codes (Payload Word 0)
471 */
472#ifdef __BIG_ENDIAN_BITFIELD
473#define ELS_CMD_MASK 0xffff0000
474#define ELS_RSP_MASK 0xff000000
475#define ELS_CMD_LS_RJT 0x01000000
476#define ELS_CMD_ACC 0x02000000
477#define ELS_CMD_PLOGI 0x03000000
478#define ELS_CMD_FLOGI 0x04000000
479#define ELS_CMD_LOGO 0x05000000
480#define ELS_CMD_ABTX 0x06000000
481#define ELS_CMD_RCS 0x07000000
482#define ELS_CMD_RES 0x08000000
483#define ELS_CMD_RSS 0x09000000
484#define ELS_CMD_RSI 0x0A000000
485#define ELS_CMD_ESTS 0x0B000000
486#define ELS_CMD_ESTC 0x0C000000
487#define ELS_CMD_ADVC 0x0D000000
488#define ELS_CMD_RTV 0x0E000000
489#define ELS_CMD_RLS 0x0F000000
490#define ELS_CMD_ECHO 0x10000000
491#define ELS_CMD_TEST 0x11000000
492#define ELS_CMD_RRQ 0x12000000
493#define ELS_CMD_PRLI 0x20100014
494#define ELS_CMD_PRLO 0x21100014
James Smart82d9a2a2006-04-15 11:53:05 -0400495#define ELS_CMD_PRLO_ACC 0x02100014
dea31012005-04-17 16:05:31 -0500496#define ELS_CMD_PDISC 0x50000000
497#define ELS_CMD_FDISC 0x51000000
498#define ELS_CMD_ADISC 0x52000000
499#define ELS_CMD_FARP 0x54000000
500#define ELS_CMD_FARPR 0x55000000
Jamie Wellnitz7bb3b132006-02-28 19:25:15 -0500501#define ELS_CMD_RPS 0x56000000
502#define ELS_CMD_RPL 0x57000000
dea31012005-04-17 16:05:31 -0500503#define ELS_CMD_FAN 0x60000000
504#define ELS_CMD_RSCN 0x61040000
505#define ELS_CMD_SCR 0x62000000
506#define ELS_CMD_RNID 0x78000000
Jamie Wellnitz7bb3b132006-02-28 19:25:15 -0500507#define ELS_CMD_LIRR 0x7A000000
dea31012005-04-17 16:05:31 -0500508#else /* __LITTLE_ENDIAN_BITFIELD */
509#define ELS_CMD_MASK 0xffff
510#define ELS_RSP_MASK 0xff
511#define ELS_CMD_LS_RJT 0x01
512#define ELS_CMD_ACC 0x02
513#define ELS_CMD_PLOGI 0x03
514#define ELS_CMD_FLOGI 0x04
515#define ELS_CMD_LOGO 0x05
516#define ELS_CMD_ABTX 0x06
517#define ELS_CMD_RCS 0x07
518#define ELS_CMD_RES 0x08
519#define ELS_CMD_RSS 0x09
520#define ELS_CMD_RSI 0x0A
521#define ELS_CMD_ESTS 0x0B
522#define ELS_CMD_ESTC 0x0C
523#define ELS_CMD_ADVC 0x0D
524#define ELS_CMD_RTV 0x0E
525#define ELS_CMD_RLS 0x0F
526#define ELS_CMD_ECHO 0x10
527#define ELS_CMD_TEST 0x11
528#define ELS_CMD_RRQ 0x12
529#define ELS_CMD_PRLI 0x14001020
530#define ELS_CMD_PRLO 0x14001021
James Smart82d9a2a2006-04-15 11:53:05 -0400531#define ELS_CMD_PRLO_ACC 0x14001002
dea31012005-04-17 16:05:31 -0500532#define ELS_CMD_PDISC 0x50
533#define ELS_CMD_FDISC 0x51
534#define ELS_CMD_ADISC 0x52
535#define ELS_CMD_FARP 0x54
536#define ELS_CMD_FARPR 0x55
Jamie Wellnitz7bb3b132006-02-28 19:25:15 -0500537#define ELS_CMD_RPS 0x56
538#define ELS_CMD_RPL 0x57
dea31012005-04-17 16:05:31 -0500539#define ELS_CMD_FAN 0x60
540#define ELS_CMD_RSCN 0x0461
541#define ELS_CMD_SCR 0x62
542#define ELS_CMD_RNID 0x78
Jamie Wellnitz7bb3b132006-02-28 19:25:15 -0500543#define ELS_CMD_LIRR 0x7A
dea31012005-04-17 16:05:31 -0500544#endif
545
546/*
547 * LS_RJT Payload Definition
548 */
549
550struct ls_rjt { /* Structure is in Big Endian format */
551 union {
552 uint32_t lsRjtError;
553 struct {
554 uint8_t lsRjtRsvd0; /* FC Word 0, bit 24:31 */
555
556 uint8_t lsRjtRsnCode; /* FC Word 0, bit 16:23 */
557 /* LS_RJT reason codes */
558#define LSRJT_INVALID_CMD 0x01
559#define LSRJT_LOGICAL_ERR 0x03
560#define LSRJT_LOGICAL_BSY 0x05
561#define LSRJT_PROTOCOL_ERR 0x07
562#define LSRJT_UNABLE_TPC 0x09 /* Unable to perform command */
563#define LSRJT_CMD_UNSUPPORTED 0x0B
564#define LSRJT_VENDOR_UNIQUE 0xFF /* See Byte 3 */
565
566 uint8_t lsRjtRsnCodeExp; /* FC Word 0, bit 8:15 */
567 /* LS_RJT reason explanation */
568#define LSEXP_NOTHING_MORE 0x00
569#define LSEXP_SPARM_OPTIONS 0x01
570#define LSEXP_SPARM_ICTL 0x03
571#define LSEXP_SPARM_RCTL 0x05
572#define LSEXP_SPARM_RCV_SIZE 0x07
573#define LSEXP_SPARM_CONCUR_SEQ 0x09
574#define LSEXP_SPARM_CREDIT 0x0B
575#define LSEXP_INVALID_PNAME 0x0D
576#define LSEXP_INVALID_NNAME 0x0E
577#define LSEXP_INVALID_CSP 0x0F
578#define LSEXP_INVALID_ASSOC_HDR 0x11
579#define LSEXP_ASSOC_HDR_REQ 0x13
580#define LSEXP_INVALID_O_SID 0x15
581#define LSEXP_INVALID_OX_RX 0x17
582#define LSEXP_CMD_IN_PROGRESS 0x19
583#define LSEXP_INVALID_NPORT_ID 0x1F
584#define LSEXP_INVALID_SEQ_ID 0x21
585#define LSEXP_INVALID_XCHG 0x23
586#define LSEXP_INACTIVE_XCHG 0x25
587#define LSEXP_RQ_REQUIRED 0x27
588#define LSEXP_OUT_OF_RESOURCE 0x29
589#define LSEXP_CANT_GIVE_DATA 0x2A
590#define LSEXP_REQ_UNSUPPORTED 0x2C
591 uint8_t vendorUnique; /* FC Word 0, bit 0: 7 */
592 } b;
593 } un;
594};
595
596/*
597 * N_Port Login (FLOGO/PLOGO Request) Payload Definition
598 */
599
600typedef struct _LOGO { /* Structure is in Big Endian format */
601 union {
602 uint32_t nPortId32; /* Access nPortId as a word */
603 struct {
604 uint8_t word1Reserved1; /* FC Word 1, bit 31:24 */
605 uint8_t nPortIdByte0; /* N_port ID bit 16:23 */
606 uint8_t nPortIdByte1; /* N_port ID bit 8:15 */
607 uint8_t nPortIdByte2; /* N_port ID bit 0: 7 */
608 } b;
609 } un;
610 struct lpfc_name portName; /* N_port name field */
611} LOGO;
612
613/*
614 * FCP Login (PRLI Request / ACC) Payload Definition
615 */
616
617#define PRLX_PAGE_LEN 0x10
618#define TPRLO_PAGE_LEN 0x14
619
620typedef struct _PRLI { /* Structure is in Big Endian format */
621 uint8_t prliType; /* FC Parm Word 0, bit 24:31 */
622
623#define PRLI_FCP_TYPE 0x08
624 uint8_t word0Reserved1; /* FC Parm Word 0, bit 16:23 */
625
626#ifdef __BIG_ENDIAN_BITFIELD
627 uint8_t origProcAssocV:1; /* FC Parm Word 0, bit 15 */
628 uint8_t respProcAssocV:1; /* FC Parm Word 0, bit 14 */
629 uint8_t estabImagePair:1; /* FC Parm Word 0, bit 13 */
630
631 /* ACC = imagePairEstablished */
632 uint8_t word0Reserved2:1; /* FC Parm Word 0, bit 12 */
633 uint8_t acceptRspCode:4; /* FC Parm Word 0, bit 8:11, ACC ONLY */
634#else /* __LITTLE_ENDIAN_BITFIELD */
635 uint8_t acceptRspCode:4; /* FC Parm Word 0, bit 8:11, ACC ONLY */
636 uint8_t word0Reserved2:1; /* FC Parm Word 0, bit 12 */
637 uint8_t estabImagePair:1; /* FC Parm Word 0, bit 13 */
638 uint8_t respProcAssocV:1; /* FC Parm Word 0, bit 14 */
639 uint8_t origProcAssocV:1; /* FC Parm Word 0, bit 15 */
640 /* ACC = imagePairEstablished */
641#endif
642
643#define PRLI_REQ_EXECUTED 0x1 /* acceptRspCode */
644#define PRLI_NO_RESOURCES 0x2
645#define PRLI_INIT_INCOMPLETE 0x3
646#define PRLI_NO_SUCH_PA 0x4
647#define PRLI_PREDEF_CONFIG 0x5
648#define PRLI_PARTIAL_SUCCESS 0x6
649#define PRLI_INVALID_PAGE_CNT 0x7
650 uint8_t word0Reserved3; /* FC Parm Word 0, bit 0:7 */
651
652 uint32_t origProcAssoc; /* FC Parm Word 1, bit 0:31 */
653
654 uint32_t respProcAssoc; /* FC Parm Word 2, bit 0:31 */
655
656 uint8_t word3Reserved1; /* FC Parm Word 3, bit 24:31 */
657 uint8_t word3Reserved2; /* FC Parm Word 3, bit 16:23 */
658
659#ifdef __BIG_ENDIAN_BITFIELD
660 uint16_t Word3bit15Resved:1; /* FC Parm Word 3, bit 15 */
661 uint16_t Word3bit14Resved:1; /* FC Parm Word 3, bit 14 */
662 uint16_t Word3bit13Resved:1; /* FC Parm Word 3, bit 13 */
663 uint16_t Word3bit12Resved:1; /* FC Parm Word 3, bit 12 */
664 uint16_t Word3bit11Resved:1; /* FC Parm Word 3, bit 11 */
665 uint16_t Word3bit10Resved:1; /* FC Parm Word 3, bit 10 */
666 uint16_t TaskRetryIdReq:1; /* FC Parm Word 3, bit 9 */
667 uint16_t Retry:1; /* FC Parm Word 3, bit 8 */
668 uint16_t ConfmComplAllowed:1; /* FC Parm Word 3, bit 7 */
669 uint16_t dataOverLay:1; /* FC Parm Word 3, bit 6 */
670 uint16_t initiatorFunc:1; /* FC Parm Word 3, bit 5 */
671 uint16_t targetFunc:1; /* FC Parm Word 3, bit 4 */
672 uint16_t cmdDataMixEna:1; /* FC Parm Word 3, bit 3 */
673 uint16_t dataRspMixEna:1; /* FC Parm Word 3, bit 2 */
674 uint16_t readXferRdyDis:1; /* FC Parm Word 3, bit 1 */
675 uint16_t writeXferRdyDis:1; /* FC Parm Word 3, bit 0 */
676#else /* __LITTLE_ENDIAN_BITFIELD */
677 uint16_t Retry:1; /* FC Parm Word 3, bit 8 */
678 uint16_t TaskRetryIdReq:1; /* FC Parm Word 3, bit 9 */
679 uint16_t Word3bit10Resved:1; /* FC Parm Word 3, bit 10 */
680 uint16_t Word3bit11Resved:1; /* FC Parm Word 3, bit 11 */
681 uint16_t Word3bit12Resved:1; /* FC Parm Word 3, bit 12 */
682 uint16_t Word3bit13Resved:1; /* FC Parm Word 3, bit 13 */
683 uint16_t Word3bit14Resved:1; /* FC Parm Word 3, bit 14 */
684 uint16_t Word3bit15Resved:1; /* FC Parm Word 3, bit 15 */
685 uint16_t writeXferRdyDis:1; /* FC Parm Word 3, bit 0 */
686 uint16_t readXferRdyDis:1; /* FC Parm Word 3, bit 1 */
687 uint16_t dataRspMixEna:1; /* FC Parm Word 3, bit 2 */
688 uint16_t cmdDataMixEna:1; /* FC Parm Word 3, bit 3 */
689 uint16_t targetFunc:1; /* FC Parm Word 3, bit 4 */
690 uint16_t initiatorFunc:1; /* FC Parm Word 3, bit 5 */
691 uint16_t dataOverLay:1; /* FC Parm Word 3, bit 6 */
692 uint16_t ConfmComplAllowed:1; /* FC Parm Word 3, bit 7 */
693#endif
694} PRLI;
695
696/*
697 * FCP Logout (PRLO Request / ACC) Payload Definition
698 */
699
700typedef struct _PRLO { /* Structure is in Big Endian format */
701 uint8_t prloType; /* FC Parm Word 0, bit 24:31 */
702
703#define PRLO_FCP_TYPE 0x08
704 uint8_t word0Reserved1; /* FC Parm Word 0, bit 16:23 */
705
706#ifdef __BIG_ENDIAN_BITFIELD
707 uint8_t origProcAssocV:1; /* FC Parm Word 0, bit 15 */
708 uint8_t respProcAssocV:1; /* FC Parm Word 0, bit 14 */
709 uint8_t word0Reserved2:2; /* FC Parm Word 0, bit 12:13 */
710 uint8_t acceptRspCode:4; /* FC Parm Word 0, bit 8:11, ACC ONLY */
711#else /* __LITTLE_ENDIAN_BITFIELD */
712 uint8_t acceptRspCode:4; /* FC Parm Word 0, bit 8:11, ACC ONLY */
713 uint8_t word0Reserved2:2; /* FC Parm Word 0, bit 12:13 */
714 uint8_t respProcAssocV:1; /* FC Parm Word 0, bit 14 */
715 uint8_t origProcAssocV:1; /* FC Parm Word 0, bit 15 */
716#endif
717
718#define PRLO_REQ_EXECUTED 0x1 /* acceptRspCode */
719#define PRLO_NO_SUCH_IMAGE 0x4
720#define PRLO_INVALID_PAGE_CNT 0x7
721
722 uint8_t word0Reserved3; /* FC Parm Word 0, bit 0:7 */
723
724 uint32_t origProcAssoc; /* FC Parm Word 1, bit 0:31 */
725
726 uint32_t respProcAssoc; /* FC Parm Word 2, bit 0:31 */
727
728 uint32_t word3Reserved1; /* FC Parm Word 3, bit 0:31 */
729} PRLO;
730
731typedef struct _ADISC { /* Structure is in Big Endian format */
732 uint32_t hardAL_PA;
733 struct lpfc_name portName;
734 struct lpfc_name nodeName;
735 uint32_t DID;
736} ADISC;
737
738typedef struct _FARP { /* Structure is in Big Endian format */
739 uint32_t Mflags:8;
740 uint32_t Odid:24;
741#define FARP_NO_ACTION 0 /* FARP information enclosed, no
742 action */
743#define FARP_MATCH_PORT 0x1 /* Match on Responder Port Name */
744#define FARP_MATCH_NODE 0x2 /* Match on Responder Node Name */
745#define FARP_MATCH_IP 0x4 /* Match on IP address, not supported */
746#define FARP_MATCH_IPV4 0x5 /* Match on IPV4 address, not
747 supported */
748#define FARP_MATCH_IPV6 0x6 /* Match on IPV6 address, not
749 supported */
750 uint32_t Rflags:8;
751 uint32_t Rdid:24;
752#define FARP_REQUEST_PLOGI 0x1 /* Request for PLOGI */
753#define FARP_REQUEST_FARPR 0x2 /* Request for FARP Response */
754 struct lpfc_name OportName;
755 struct lpfc_name OnodeName;
756 struct lpfc_name RportName;
757 struct lpfc_name RnodeName;
758 uint8_t Oipaddr[16];
759 uint8_t Ripaddr[16];
760} FARP;
761
762typedef struct _FAN { /* Structure is in Big Endian format */
763 uint32_t Fdid;
764 struct lpfc_name FportName;
765 struct lpfc_name FnodeName;
766} FAN;
767
768typedef struct _SCR { /* Structure is in Big Endian format */
769 uint8_t resvd1;
770 uint8_t resvd2;
771 uint8_t resvd3;
772 uint8_t Function;
773#define SCR_FUNC_FABRIC 0x01
774#define SCR_FUNC_NPORT 0x02
775#define SCR_FUNC_FULL 0x03
776#define SCR_CLEAR 0xff
777} SCR;
778
779typedef struct _RNID_TOP_DISC {
780 struct lpfc_name portName;
781 uint8_t resvd[8];
782 uint32_t unitType;
783#define RNID_HBA 0x7
784#define RNID_HOST 0xa
785#define RNID_DRIVER 0xd
786 uint32_t physPort;
787 uint32_t attachedNodes;
788 uint16_t ipVersion;
789#define RNID_IPV4 0x1
790#define RNID_IPV6 0x2
791 uint16_t UDPport;
792 uint8_t ipAddr[16];
793 uint16_t resvd1;
794 uint16_t flags;
795#define RNID_TD_SUPPORT 0x1
796#define RNID_LP_VALID 0x2
797} RNID_TOP_DISC;
798
799typedef struct _RNID { /* Structure is in Big Endian format */
800 uint8_t Format;
801#define RNID_TOPOLOGY_DISC 0xdf
802 uint8_t CommonLen;
803 uint8_t resvd1;
804 uint8_t SpecificLen;
805 struct lpfc_name portName;
806 struct lpfc_name nodeName;
807 union {
808 RNID_TOP_DISC topologyDisc; /* topology disc (0xdf) */
809 } un;
810} RNID;
811
James Smart311464e2007-08-02 11:10:37 -0400812typedef struct _RPS { /* Structure is in Big Endian format */
Jamie Wellnitz7bb3b132006-02-28 19:25:15 -0500813 union {
814 uint32_t portNum;
815 struct lpfc_name portName;
816 } un;
817} RPS;
818
819typedef struct _RPS_RSP { /* Structure is in Big Endian format */
820 uint16_t rsvd1;
821 uint16_t portStatus;
822 uint32_t linkFailureCnt;
823 uint32_t lossSyncCnt;
824 uint32_t lossSignalCnt;
825 uint32_t primSeqErrCnt;
826 uint32_t invalidXmitWord;
827 uint32_t crcCnt;
828} RPS_RSP;
829
James Smart311464e2007-08-02 11:10:37 -0400830typedef struct _RPL { /* Structure is in Big Endian format */
Jamie Wellnitz7bb3b132006-02-28 19:25:15 -0500831 uint32_t maxsize;
832 uint32_t index;
833} RPL;
834
835typedef struct _PORT_NUM_BLK {
836 uint32_t portNum;
837 uint32_t portID;
838 struct lpfc_name portName;
839} PORT_NUM_BLK;
840
James Smart311464e2007-08-02 11:10:37 -0400841typedef struct _RPL_RSP { /* Structure is in Big Endian format */
Jamie Wellnitz7bb3b132006-02-28 19:25:15 -0500842 uint32_t listLen;
843 uint32_t index;
844 PORT_NUM_BLK port_num_blk;
845} RPL_RSP;
dea31012005-04-17 16:05:31 -0500846
847/* This is used for RSCN command */
848typedef struct _D_ID { /* Structure is in Big Endian format */
849 union {
850 uint32_t word;
851 struct {
852#ifdef __BIG_ENDIAN_BITFIELD
853 uint8_t resv;
854 uint8_t domain;
855 uint8_t area;
856 uint8_t id;
857#else /* __LITTLE_ENDIAN_BITFIELD */
858 uint8_t id;
859 uint8_t area;
860 uint8_t domain;
861 uint8_t resv;
862#endif
863 } b;
864 } un;
865} D_ID;
866
867/*
868 * Structure to define all ELS Payload types
869 */
870
871typedef struct _ELS_PKT { /* Structure is in Big Endian format */
872 uint8_t elsCode; /* FC Word 0, bit 24:31 */
873 uint8_t elsByte1;
874 uint8_t elsByte2;
875 uint8_t elsByte3;
876 union {
877 struct ls_rjt lsRjt; /* Payload for LS_RJT ELS response */
878 struct serv_parm logi; /* Payload for PLOGI/FLOGI/PDISC/ACC */
879 LOGO logo; /* Payload for PLOGO/FLOGO/ACC */
880 PRLI prli; /* Payload for PRLI/ACC */
881 PRLO prlo; /* Payload for PRLO/ACC */
882 ADISC adisc; /* Payload for ADISC/ACC */
883 FARP farp; /* Payload for FARP/ACC */
884 FAN fan; /* Payload for FAN */
885 SCR scr; /* Payload for SCR/ACC */
dea31012005-04-17 16:05:31 -0500886 RNID rnid; /* Payload for RNID */
887 uint8_t pad[128 - 4]; /* Pad out to payload of 128 bytes */
888 } un;
889} ELS_PKT;
890
891/*
892 * FDMI
893 * HBA MAnagement Operations Command Codes
894 */
895#define SLI_MGMT_GRHL 0x100 /* Get registered HBA list */
896#define SLI_MGMT_GHAT 0x101 /* Get HBA attributes */
897#define SLI_MGMT_GRPL 0x102 /* Get registered Port list */
898#define SLI_MGMT_GPAT 0x110 /* Get Port attributes */
899#define SLI_MGMT_RHBA 0x200 /* Register HBA */
900#define SLI_MGMT_RHAT 0x201 /* Register HBA atttributes */
901#define SLI_MGMT_RPRT 0x210 /* Register Port */
902#define SLI_MGMT_RPA 0x211 /* Register Port attributes */
903#define SLI_MGMT_DHBA 0x300 /* De-register HBA */
904#define SLI_MGMT_DPRT 0x310 /* De-register Port */
905
906/*
907 * Management Service Subtypes
908 */
909#define SLI_CT_FDMI_Subtypes 0x10
910
911/*
912 * HBA Management Service Reject Code
913 */
914#define REJECT_CODE 0x9 /* Unable to perform command request */
915
916/*
917 * HBA Management Service Reject Reason Code
918 * Please refer to the Reason Codes above
919 */
920
921/*
922 * HBA Attribute Types
923 */
924#define NODE_NAME 0x1
925#define MANUFACTURER 0x2
926#define SERIAL_NUMBER 0x3
927#define MODEL 0x4
928#define MODEL_DESCRIPTION 0x5
929#define HARDWARE_VERSION 0x6
930#define DRIVER_VERSION 0x7
931#define OPTION_ROM_VERSION 0x8
932#define FIRMWARE_VERSION 0x9
933#define OS_NAME_VERSION 0xa
934#define MAX_CT_PAYLOAD_LEN 0xb
935
936/*
937 * Port Attrubute Types
938 */
939#define SUPPORTED_FC4_TYPES 0x1
940#define SUPPORTED_SPEED 0x2
941#define PORT_SPEED 0x3
942#define MAX_FRAME_SIZE 0x4
943#define OS_DEVICE_NAME 0x5
944#define HOST_NAME 0x6
945
946union AttributesDef {
947 /* Structure is in Big Endian format */
948 struct {
949 uint32_t AttrType:16;
950 uint32_t AttrLen:16;
951 } bits;
952 uint32_t word;
953};
954
955
956/*
957 * HBA Attribute Entry (8 - 260 bytes)
958 */
959typedef struct {
960 union AttributesDef ad;
961 union {
962 uint32_t VendorSpecific;
963 uint8_t Manufacturer[64];
964 uint8_t SerialNumber[64];
965 uint8_t Model[256];
966 uint8_t ModelDescription[256];
967 uint8_t HardwareVersion[256];
968 uint8_t DriverVersion[256];
969 uint8_t OptionROMVersion[256];
970 uint8_t FirmwareVersion[256];
971 struct lpfc_name NodeName;
972 uint8_t SupportFC4Types[32];
973 uint32_t SupportSpeed;
974 uint32_t PortSpeed;
975 uint32_t MaxFrameSize;
976 uint8_t OsDeviceName[256];
977 uint8_t OsNameVersion[256];
978 uint32_t MaxCTPayloadLen;
979 uint8_t HostName[256];
980 } un;
981} ATTRIBUTE_ENTRY;
982
983/*
984 * HBA Attribute Block
985 */
986typedef struct {
987 uint32_t EntryCnt; /* Number of HBA attribute entries */
988 ATTRIBUTE_ENTRY Entry; /* Variable-length array */
989} ATTRIBUTE_BLOCK;
990
991/*
992 * Port Entry
993 */
994typedef struct {
995 struct lpfc_name PortName;
996} PORT_ENTRY;
997
998/*
999 * HBA Identifier
1000 */
1001typedef struct {
1002 struct lpfc_name PortName;
1003} HBA_IDENTIFIER;
1004
1005/*
1006 * Registered Port List Format
1007 */
1008typedef struct {
1009 uint32_t EntryCnt;
1010 PORT_ENTRY pe; /* Variable-length array */
1011} REG_PORT_LIST;
1012
1013/*
1014 * Register HBA(RHBA)
1015 */
1016typedef struct {
1017 HBA_IDENTIFIER hi;
1018 REG_PORT_LIST rpl; /* variable-length array */
1019/* ATTRIBUTE_BLOCK ab; */
1020} REG_HBA;
1021
1022/*
1023 * Register HBA Attributes (RHAT)
1024 */
1025typedef struct {
1026 struct lpfc_name HBA_PortName;
1027 ATTRIBUTE_BLOCK ab;
1028} REG_HBA_ATTRIBUTE;
1029
1030/*
1031 * Register Port Attributes (RPA)
1032 */
1033typedef struct {
1034 struct lpfc_name PortName;
1035 ATTRIBUTE_BLOCK ab;
1036} REG_PORT_ATTRIBUTE;
1037
1038/*
1039 * Get Registered HBA List (GRHL) Accept Payload Format
1040 */
1041typedef struct {
1042 uint32_t HBA__Entry_Cnt; /* Number of Registered HBA Identifiers */
1043 struct lpfc_name HBA_PortName; /* Variable-length array */
1044} GRHL_ACC_PAYLOAD;
1045
1046/*
1047 * Get Registered Port List (GRPL) Accept Payload Format
1048 */
1049typedef struct {
1050 uint32_t RPL_Entry_Cnt; /* Number of Registered Port Entries */
1051 PORT_ENTRY Reg_Port_Entry[1]; /* Variable-length array */
1052} GRPL_ACC_PAYLOAD;
1053
1054/*
1055 * Get Port Attributes (GPAT) Accept Payload Format
1056 */
1057
1058typedef struct {
1059 ATTRIBUTE_BLOCK pab;
1060} GPAT_ACC_PAYLOAD;
1061
1062
1063/*
1064 * Begin HBA configuration parameters.
1065 * The PCI configuration register BAR assignments are:
1066 * BAR0, offset 0x10 - SLIM base memory address
1067 * BAR1, offset 0x14 - SLIM base memory high address
1068 * BAR2, offset 0x18 - REGISTER base memory address
1069 * BAR3, offset 0x1c - REGISTER base memory high address
1070 * BAR4, offset 0x20 - BIU I/O registers
1071 * BAR5, offset 0x24 - REGISTER base io high address
1072 */
1073
1074/* Number of rings currently used and available. */
1075#define MAX_CONFIGURED_RINGS 3
1076#define MAX_RINGS 4
1077
1078/* IOCB / Mailbox is owned by FireFly */
1079#define OWN_CHIP 1
1080
1081/* IOCB / Mailbox is owned by Host */
1082#define OWN_HOST 0
1083
1084/* Number of 4-byte words in an IOCB. */
1085#define IOCB_WORD_SZ 8
1086
1087/* defines for type field in fc header */
1088#define FC_ELS_DATA 0x1
1089#define FC_LLC_SNAP 0x5
1090#define FC_FCP_DATA 0x8
1091#define FC_COMMON_TRANSPORT_ULP 0x20
1092
1093/* defines for rctl field in fc header */
1094#define FC_DEV_DATA 0x0
1095#define FC_UNSOL_CTL 0x2
1096#define FC_SOL_CTL 0x3
1097#define FC_UNSOL_DATA 0x4
1098#define FC_FCP_CMND 0x6
1099#define FC_ELS_REQ 0x22
1100#define FC_ELS_RSP 0x23
1101
1102/* network headers for Dfctl field */
1103#define FC_NET_HDR 0x20
1104
1105/* Start FireFly Register definitions */
1106#define PCI_VENDOR_ID_EMULEX 0x10df
1107#define PCI_DEVICE_ID_FIREFLY 0x1ae5
James Smartb87eab32007-04-25 09:53:28 -04001108#define PCI_DEVICE_ID_SAT_SMB 0xf011
1109#define PCI_DEVICE_ID_SAT_MID 0xf015
dea31012005-04-17 16:05:31 -05001110#define PCI_DEVICE_ID_RFLY 0xf095
1111#define PCI_DEVICE_ID_PFLY 0xf098
James.Smart@Emulex.Come4adb202005-11-28 11:42:12 -05001112#define PCI_DEVICE_ID_LP101 0xf0a1
dea31012005-04-17 16:05:31 -05001113#define PCI_DEVICE_ID_TFLY 0xf0a5
James.Smart@Emulex.Come4adb202005-11-28 11:42:12 -05001114#define PCI_DEVICE_ID_BSMB 0xf0d1
1115#define PCI_DEVICE_ID_BMID 0xf0d5
1116#define PCI_DEVICE_ID_ZSMB 0xf0e1
1117#define PCI_DEVICE_ID_ZMID 0xf0e5
1118#define PCI_DEVICE_ID_NEPTUNE 0xf0f5
1119#define PCI_DEVICE_ID_NEPTUNE_SCSP 0xf0f6
1120#define PCI_DEVICE_ID_NEPTUNE_DCSP 0xf0f7
James Smartb87eab32007-04-25 09:53:28 -04001121#define PCI_DEVICE_ID_SAT 0xf100
1122#define PCI_DEVICE_ID_SAT_SCSP 0xf111
1123#define PCI_DEVICE_ID_SAT_DCSP 0xf112
James.Smart@Emulex.Come4adb202005-11-28 11:42:12 -05001124#define PCI_DEVICE_ID_SUPERFLY 0xf700
1125#define PCI_DEVICE_ID_DRAGONFLY 0xf800
dea31012005-04-17 16:05:31 -05001126#define PCI_DEVICE_ID_CENTAUR 0xf900
1127#define PCI_DEVICE_ID_PEGASUS 0xf980
1128#define PCI_DEVICE_ID_THOR 0xfa00
1129#define PCI_DEVICE_ID_VIPER 0xfb00
James.Smart@Emulex.Come4adb202005-11-28 11:42:12 -05001130#define PCI_DEVICE_ID_LP10000S 0xfc00
1131#define PCI_DEVICE_ID_LP11000S 0xfc10
1132#define PCI_DEVICE_ID_LPE11000S 0xfc20
James Smartb87eab32007-04-25 09:53:28 -04001133#define PCI_DEVICE_ID_SAT_S 0xfc40
dea31012005-04-17 16:05:31 -05001134#define PCI_DEVICE_ID_HELIOS 0xfd00
James.Smart@Emulex.Come4adb202005-11-28 11:42:12 -05001135#define PCI_DEVICE_ID_HELIOS_SCSP 0xfd11
1136#define PCI_DEVICE_ID_HELIOS_DCSP 0xfd12
dea31012005-04-17 16:05:31 -05001137#define PCI_DEVICE_ID_ZEPHYR 0xfe00
James.Smart@Emulex.Come4adb202005-11-28 11:42:12 -05001138#define PCI_DEVICE_ID_ZEPHYR_SCSP 0xfe11
1139#define PCI_DEVICE_ID_ZEPHYR_DCSP 0xfe12
dea31012005-04-17 16:05:31 -05001140
1141#define JEDEC_ID_ADDRESS 0x0080001c
1142#define FIREFLY_JEDEC_ID 0x1ACC
1143#define SUPERFLY_JEDEC_ID 0x0020
1144#define DRAGONFLY_JEDEC_ID 0x0021
1145#define DRAGONFLY_V2_JEDEC_ID 0x0025
1146#define CENTAUR_2G_JEDEC_ID 0x0026
1147#define CENTAUR_1G_JEDEC_ID 0x0028
1148#define PEGASUS_ORION_JEDEC_ID 0x0036
1149#define PEGASUS_JEDEC_ID 0x0038
1150#define THOR_JEDEC_ID 0x0012
1151#define HELIOS_JEDEC_ID 0x0364
1152#define ZEPHYR_JEDEC_ID 0x0577
1153#define VIPER_JEDEC_ID 0x4838
James Smartb87eab32007-04-25 09:53:28 -04001154#define SATURN_JEDEC_ID 0x1004
dea31012005-04-17 16:05:31 -05001155
1156#define JEDEC_ID_MASK 0x0FFFF000
1157#define JEDEC_ID_SHIFT 12
1158#define FC_JEDEC_ID(id) ((id & JEDEC_ID_MASK) >> JEDEC_ID_SHIFT)
1159
1160typedef struct { /* FireFly BIU registers */
1161 uint32_t hostAtt; /* See definitions for Host Attention
1162 register */
1163 uint32_t chipAtt; /* See definitions for Chip Attention
1164 register */
1165 uint32_t hostStatus; /* See definitions for Host Status register */
1166 uint32_t hostControl; /* See definitions for Host Control register */
1167 uint32_t buiConfig; /* See definitions for BIU configuration
1168 register */
1169} FF_REGS;
1170
1171/* IO Register size in bytes */
1172#define FF_REG_AREA_SIZE 256
1173
1174/* Host Attention Register */
1175
1176#define HA_REG_OFFSET 0 /* Byte offset from register base address */
1177
1178#define HA_R0RE_REQ 0x00000001 /* Bit 0 */
1179#define HA_R0CE_RSP 0x00000002 /* Bit 1 */
1180#define HA_R0ATT 0x00000008 /* Bit 3 */
1181#define HA_R1RE_REQ 0x00000010 /* Bit 4 */
1182#define HA_R1CE_RSP 0x00000020 /* Bit 5 */
1183#define HA_R1ATT 0x00000080 /* Bit 7 */
1184#define HA_R2RE_REQ 0x00000100 /* Bit 8 */
1185#define HA_R2CE_RSP 0x00000200 /* Bit 9 */
1186#define HA_R2ATT 0x00000800 /* Bit 11 */
1187#define HA_R3RE_REQ 0x00001000 /* Bit 12 */
1188#define HA_R3CE_RSP 0x00002000 /* Bit 13 */
1189#define HA_R3ATT 0x00008000 /* Bit 15 */
1190#define HA_LATT 0x20000000 /* Bit 29 */
1191#define HA_MBATT 0x40000000 /* Bit 30 */
1192#define HA_ERATT 0x80000000 /* Bit 31 */
1193
1194#define HA_RXRE_REQ 0x00000001 /* Bit 0 */
1195#define HA_RXCE_RSP 0x00000002 /* Bit 1 */
1196#define HA_RXATT 0x00000008 /* Bit 3 */
1197#define HA_RXMASK 0x0000000f
1198
1199/* Chip Attention Register */
1200
1201#define CA_REG_OFFSET 4 /* Byte offset from register base address */
1202
1203#define CA_R0CE_REQ 0x00000001 /* Bit 0 */
1204#define CA_R0RE_RSP 0x00000002 /* Bit 1 */
1205#define CA_R0ATT 0x00000008 /* Bit 3 */
1206#define CA_R1CE_REQ 0x00000010 /* Bit 4 */
1207#define CA_R1RE_RSP 0x00000020 /* Bit 5 */
1208#define CA_R1ATT 0x00000080 /* Bit 7 */
1209#define CA_R2CE_REQ 0x00000100 /* Bit 8 */
1210#define CA_R2RE_RSP 0x00000200 /* Bit 9 */
1211#define CA_R2ATT 0x00000800 /* Bit 11 */
1212#define CA_R3CE_REQ 0x00001000 /* Bit 12 */
1213#define CA_R3RE_RSP 0x00002000 /* Bit 13 */
1214#define CA_R3ATT 0x00008000 /* Bit 15 */
1215#define CA_MBATT 0x40000000 /* Bit 30 */
1216
1217/* Host Status Register */
1218
1219#define HS_REG_OFFSET 8 /* Byte offset from register base address */
1220
1221#define HS_MBRDY 0x00400000 /* Bit 22 */
1222#define HS_FFRDY 0x00800000 /* Bit 23 */
1223#define HS_FFER8 0x01000000 /* Bit 24 */
1224#define HS_FFER7 0x02000000 /* Bit 25 */
1225#define HS_FFER6 0x04000000 /* Bit 26 */
1226#define HS_FFER5 0x08000000 /* Bit 27 */
1227#define HS_FFER4 0x10000000 /* Bit 28 */
1228#define HS_FFER3 0x20000000 /* Bit 29 */
1229#define HS_FFER2 0x40000000 /* Bit 30 */
1230#define HS_FFER1 0x80000000 /* Bit 31 */
James Smart57127f12007-10-27 13:37:05 -04001231#define HS_CRIT_TEMP 0x00000100 /* Bit 8 */
1232#define HS_FFERM 0xFF000100 /* Mask for error bits 31:24 and 8 */
dea31012005-04-17 16:05:31 -05001233
1234/* Host Control Register */
1235
1236#define HC_REG_OFFSET 12 /* Word offset from register base address */
1237
1238#define HC_MBINT_ENA 0x00000001 /* Bit 0 */
1239#define HC_R0INT_ENA 0x00000002 /* Bit 1 */
1240#define HC_R1INT_ENA 0x00000004 /* Bit 2 */
1241#define HC_R2INT_ENA 0x00000008 /* Bit 3 */
1242#define HC_R3INT_ENA 0x00000010 /* Bit 4 */
1243#define HC_INITHBI 0x02000000 /* Bit 25 */
1244#define HC_INITMB 0x04000000 /* Bit 26 */
1245#define HC_INITFF 0x08000000 /* Bit 27 */
1246#define HC_LAINT_ENA 0x20000000 /* Bit 29 */
1247#define HC_ERINT_ENA 0x80000000 /* Bit 31 */
1248
1249/* Mailbox Commands */
1250#define MBX_SHUTDOWN 0x00 /* terminate testing */
1251#define MBX_LOAD_SM 0x01
1252#define MBX_READ_NV 0x02
1253#define MBX_WRITE_NV 0x03
1254#define MBX_RUN_BIU_DIAG 0x04
1255#define MBX_INIT_LINK 0x05
1256#define MBX_DOWN_LINK 0x06
1257#define MBX_CONFIG_LINK 0x07
1258#define MBX_CONFIG_RING 0x09
1259#define MBX_RESET_RING 0x0A
1260#define MBX_READ_CONFIG 0x0B
1261#define MBX_READ_RCONFIG 0x0C
1262#define MBX_READ_SPARM 0x0D
1263#define MBX_READ_STATUS 0x0E
1264#define MBX_READ_RPI 0x0F
1265#define MBX_READ_XRI 0x10
1266#define MBX_READ_REV 0x11
1267#define MBX_READ_LNK_STAT 0x12
1268#define MBX_REG_LOGIN 0x13
1269#define MBX_UNREG_LOGIN 0x14
1270#define MBX_READ_LA 0x15
1271#define MBX_CLEAR_LA 0x16
1272#define MBX_DUMP_MEMORY 0x17
1273#define MBX_DUMP_CONTEXT 0x18
1274#define MBX_RUN_DIAGS 0x19
1275#define MBX_RESTART 0x1A
1276#define MBX_UPDATE_CFG 0x1B
1277#define MBX_DOWN_LOAD 0x1C
1278#define MBX_DEL_LD_ENTRY 0x1D
1279#define MBX_RUN_PROGRAM 0x1E
1280#define MBX_SET_MASK 0x20
1281#define MBX_SET_SLIM 0x21
1282#define MBX_UNREG_D_ID 0x23
Jamie Wellnitz41415862006-02-28 19:25:27 -05001283#define MBX_KILL_BOARD 0x24
dea31012005-04-17 16:05:31 -05001284#define MBX_CONFIG_FARP 0x25
Jamie Wellnitz41415862006-02-28 19:25:27 -05001285#define MBX_BEACON 0x2A
James Smart57127f12007-10-27 13:37:05 -04001286#define MBX_ASYNCEVT_ENABLE 0x33
James Smart858c9f62007-06-17 19:56:39 -05001287#define MBX_HEARTBEAT 0x31
dea31012005-04-17 16:05:31 -05001288
James Smarted957682007-06-17 19:56:37 -05001289#define MBX_CONFIG_HBQ 0x7C
dea31012005-04-17 16:05:31 -05001290#define MBX_LOAD_AREA 0x81
1291#define MBX_RUN_BIU_DIAG64 0x84
1292#define MBX_CONFIG_PORT 0x88
1293#define MBX_READ_SPARM64 0x8D
1294#define MBX_READ_RPI64 0x8F
1295#define MBX_REG_LOGIN64 0x93
1296#define MBX_READ_LA64 0x95
James Smart92d7f7b2007-06-17 19:56:38 -05001297#define MBX_REG_VPI 0x96
1298#define MBX_UNREG_VPI 0x97
1299#define MBX_REG_VNPID 0x96
1300#define MBX_UNREG_VNPID 0x97
dea31012005-04-17 16:05:31 -05001301
1302#define MBX_FLASH_WR_ULA 0x98
1303#define MBX_SET_DEBUG 0x99
1304#define MBX_LOAD_EXP_ROM 0x9C
1305
1306#define MBX_MAX_CMDS 0x9D
1307#define MBX_SLI2_CMD_MASK 0x80
1308
1309/* IOCB Commands */
1310
1311#define CMD_RCV_SEQUENCE_CX 0x01
1312#define CMD_XMIT_SEQUENCE_CR 0x02
1313#define CMD_XMIT_SEQUENCE_CX 0x03
1314#define CMD_XMIT_BCAST_CN 0x04
1315#define CMD_XMIT_BCAST_CX 0x05
1316#define CMD_QUE_RING_BUF_CN 0x06
1317#define CMD_QUE_XRI_BUF_CX 0x07
1318#define CMD_IOCB_CONTINUE_CN 0x08
1319#define CMD_RET_XRI_BUF_CX 0x09
1320#define CMD_ELS_REQUEST_CR 0x0A
1321#define CMD_ELS_REQUEST_CX 0x0B
1322#define CMD_RCV_ELS_REQ_CX 0x0D
1323#define CMD_ABORT_XRI_CN 0x0E
1324#define CMD_ABORT_XRI_CX 0x0F
1325#define CMD_CLOSE_XRI_CN 0x10
1326#define CMD_CLOSE_XRI_CX 0x11
1327#define CMD_CREATE_XRI_CR 0x12
1328#define CMD_CREATE_XRI_CX 0x13
1329#define CMD_GET_RPI_CN 0x14
1330#define CMD_XMIT_ELS_RSP_CX 0x15
1331#define CMD_GET_RPI_CR 0x16
1332#define CMD_XRI_ABORTED_CX 0x17
1333#define CMD_FCP_IWRITE_CR 0x18
1334#define CMD_FCP_IWRITE_CX 0x19
1335#define CMD_FCP_IREAD_CR 0x1A
1336#define CMD_FCP_IREAD_CX 0x1B
1337#define CMD_FCP_ICMND_CR 0x1C
1338#define CMD_FCP_ICMND_CX 0x1D
James Smartf5603512006-12-02 13:35:43 -05001339#define CMD_FCP_TSEND_CX 0x1F
1340#define CMD_FCP_TRECEIVE_CX 0x21
1341#define CMD_FCP_TRSP_CX 0x23
1342#define CMD_FCP_AUTO_TRSP_CX 0x29
dea31012005-04-17 16:05:31 -05001343
1344#define CMD_ADAPTER_MSG 0x20
1345#define CMD_ADAPTER_DUMP 0x22
1346
1347/* SLI_2 IOCB Command Set */
1348
James Smart57127f12007-10-27 13:37:05 -04001349#define CMD_ASYNC_STATUS 0x7C
dea31012005-04-17 16:05:31 -05001350#define CMD_RCV_SEQUENCE64_CX 0x81
1351#define CMD_XMIT_SEQUENCE64_CR 0x82
1352#define CMD_XMIT_SEQUENCE64_CX 0x83
1353#define CMD_XMIT_BCAST64_CN 0x84
1354#define CMD_XMIT_BCAST64_CX 0x85
1355#define CMD_QUE_RING_BUF64_CN 0x86
1356#define CMD_QUE_XRI_BUF64_CX 0x87
1357#define CMD_IOCB_CONTINUE64_CN 0x88
1358#define CMD_RET_XRI_BUF64_CX 0x89
1359#define CMD_ELS_REQUEST64_CR 0x8A
1360#define CMD_ELS_REQUEST64_CX 0x8B
1361#define CMD_ABORT_MXRI64_CN 0x8C
1362#define CMD_RCV_ELS_REQ64_CX 0x8D
1363#define CMD_XMIT_ELS_RSP64_CX 0x95
1364#define CMD_FCP_IWRITE64_CR 0x98
1365#define CMD_FCP_IWRITE64_CX 0x99
1366#define CMD_FCP_IREAD64_CR 0x9A
1367#define CMD_FCP_IREAD64_CX 0x9B
1368#define CMD_FCP_ICMND64_CR 0x9C
1369#define CMD_FCP_ICMND64_CX 0x9D
James Smartf5603512006-12-02 13:35:43 -05001370#define CMD_FCP_TSEND64_CX 0x9F
1371#define CMD_FCP_TRECEIVE64_CX 0xA1
1372#define CMD_FCP_TRSP64_CX 0xA3
dea31012005-04-17 16:05:31 -05001373
James Smarted957682007-06-17 19:56:37 -05001374#define CMD_IOCB_RCV_SEQ64_CX 0xB5
1375#define CMD_IOCB_RCV_ELS64_CX 0xB7
1376#define CMD_IOCB_RCV_CONT64_CX 0xBB
1377
dea31012005-04-17 16:05:31 -05001378#define CMD_GEN_REQUEST64_CR 0xC2
1379#define CMD_GEN_REQUEST64_CX 0xC3
1380
1381#define CMD_MAX_IOCB_CMD 0xE6
1382#define CMD_IOCB_MASK 0xff
1383
1384#define MAX_MSG_DATA 28 /* max msg data in CMD_ADAPTER_MSG
1385 iocb */
1386#define LPFC_MAX_ADPTMSG 32 /* max msg data */
1387/*
1388 * Define Status
1389 */
1390#define MBX_SUCCESS 0
1391#define MBXERR_NUM_RINGS 1
1392#define MBXERR_NUM_IOCBS 2
1393#define MBXERR_IOCBS_EXCEEDED 3
1394#define MBXERR_BAD_RING_NUMBER 4
1395#define MBXERR_MASK_ENTRIES_RANGE 5
1396#define MBXERR_MASKS_EXCEEDED 6
1397#define MBXERR_BAD_PROFILE 7
1398#define MBXERR_BAD_DEF_CLASS 8
1399#define MBXERR_BAD_MAX_RESPONDER 9
1400#define MBXERR_BAD_MAX_ORIGINATOR 10
1401#define MBXERR_RPI_REGISTERED 11
1402#define MBXERR_RPI_FULL 12
1403#define MBXERR_NO_RESOURCES 13
1404#define MBXERR_BAD_RCV_LENGTH 14
1405#define MBXERR_DMA_ERROR 15
1406#define MBXERR_ERROR 16
1407#define MBX_NOT_FINISHED 255
1408
1409#define MBX_BUSY 0xffffff /* Attempted cmd to busy Mailbox */
1410#define MBX_TIMEOUT 0xfffffe /* time-out expired waiting for */
1411
James Smart57127f12007-10-27 13:37:05 -04001412#define TEMPERATURE_OFFSET 0xB0 /* Slim offset for critical temperature event */
1413
dea31012005-04-17 16:05:31 -05001414/*
1415 * Begin Structure Definitions for Mailbox Commands
1416 */
1417
1418typedef struct {
1419#ifdef __BIG_ENDIAN_BITFIELD
1420 uint8_t tval;
1421 uint8_t tmask;
1422 uint8_t rval;
1423 uint8_t rmask;
1424#else /* __LITTLE_ENDIAN_BITFIELD */
1425 uint8_t rmask;
1426 uint8_t rval;
1427 uint8_t tmask;
1428 uint8_t tval;
1429#endif
1430} RR_REG;
1431
1432struct ulp_bde {
1433 uint32_t bdeAddress;
1434#ifdef __BIG_ENDIAN_BITFIELD
1435 uint32_t bdeReserved:4;
1436 uint32_t bdeAddrHigh:4;
1437 uint32_t bdeSize:24;
1438#else /* __LITTLE_ENDIAN_BITFIELD */
1439 uint32_t bdeSize:24;
1440 uint32_t bdeAddrHigh:4;
1441 uint32_t bdeReserved:4;
1442#endif
1443};
1444
1445struct ulp_bde64 { /* SLI-2 */
1446 union ULP_BDE_TUS {
1447 uint32_t w;
1448 struct {
1449#ifdef __BIG_ENDIAN_BITFIELD
1450 uint32_t bdeFlags:8; /* BDE Flags 0 IS A SUPPORTED
1451 VALUE !! */
1452 uint32_t bdeSize:24; /* Size of buffer (in bytes) */
1453#else /* __LITTLE_ENDIAN_BITFIELD */
1454 uint32_t bdeSize:24; /* Size of buffer (in bytes) */
1455 uint32_t bdeFlags:8; /* BDE Flags 0 IS A SUPPORTED
1456 VALUE !! */
1457#endif
1458
1459#define BUFF_USE_RSVD 0x01 /* bdeFlags */
1460#define BUFF_USE_INTRPT 0x02 /* Not Implemented with LP6000 */
1461#define BUFF_USE_CMND 0x04 /* Optional, 1=cmd/rsp 0=data buffer */
1462#define BUFF_USE_RCV 0x08 /* "" "", 1=rcv buffer, 0=xmit
1463 buffer */
1464#define BUFF_TYPE_32BIT 0x10 /* "" "", 1=32 bit addr 0=64 bit
1465 addr */
1466#define BUFF_TYPE_SPECIAL 0x20 /* Not Implemented with LP6000 */
1467#define BUFF_TYPE_BDL 0x40 /* Optional, may be set in BDL */
1468#define BUFF_TYPE_INVALID 0x80 /* "" "" */
1469 } f;
1470 } tus;
1471 uint32_t addrLow;
1472 uint32_t addrHigh;
1473};
1474#define BDE64_SIZE_WORD 0
1475#define BPL64_SIZE_WORD 0x40
1476
1477typedef struct ULP_BDL { /* SLI-2 */
1478#ifdef __BIG_ENDIAN_BITFIELD
1479 uint32_t bdeFlags:8; /* BDL Flags */
1480 uint32_t bdeSize:24; /* Size of BDL array in host memory (bytes) */
1481#else /* __LITTLE_ENDIAN_BITFIELD */
1482 uint32_t bdeSize:24; /* Size of BDL array in host memory (bytes) */
1483 uint32_t bdeFlags:8; /* BDL Flags */
1484#endif
1485
1486 uint32_t addrLow; /* Address 0:31 */
1487 uint32_t addrHigh; /* Address 32:63 */
1488 uint32_t ulpIoTag32; /* Can be used for 32 bit I/O Tag */
1489} ULP_BDL;
1490
1491/* Structure for MB Command LOAD_SM and DOWN_LOAD */
1492
1493typedef struct {
1494#ifdef __BIG_ENDIAN_BITFIELD
1495 uint32_t rsvd2:25;
1496 uint32_t acknowledgment:1;
1497 uint32_t version:1;
1498 uint32_t erase_or_prog:1;
1499 uint32_t update_flash:1;
1500 uint32_t update_ram:1;
1501 uint32_t method:1;
1502 uint32_t load_cmplt:1;
1503#else /* __LITTLE_ENDIAN_BITFIELD */
1504 uint32_t load_cmplt:1;
1505 uint32_t method:1;
1506 uint32_t update_ram:1;
1507 uint32_t update_flash:1;
1508 uint32_t erase_or_prog:1;
1509 uint32_t version:1;
1510 uint32_t acknowledgment:1;
1511 uint32_t rsvd2:25;
1512#endif
1513
1514 uint32_t dl_to_adr_low;
1515 uint32_t dl_to_adr_high;
1516 uint32_t dl_len;
1517 union {
1518 uint32_t dl_from_mbx_offset;
1519 struct ulp_bde dl_from_bde;
1520 struct ulp_bde64 dl_from_bde64;
1521 } un;
1522
1523} LOAD_SM_VAR;
1524
1525/* Structure for MB Command READ_NVPARM (02) */
1526
1527typedef struct {
1528 uint32_t rsvd1[3]; /* Read as all one's */
1529 uint32_t rsvd2; /* Read as all zero's */
1530 uint32_t portname[2]; /* N_PORT name */
1531 uint32_t nodename[2]; /* NODE name */
1532
1533#ifdef __BIG_ENDIAN_BITFIELD
1534 uint32_t pref_DID:24;
1535 uint32_t hardAL_PA:8;
1536#else /* __LITTLE_ENDIAN_BITFIELD */
1537 uint32_t hardAL_PA:8;
1538 uint32_t pref_DID:24;
1539#endif
1540
1541 uint32_t rsvd3[21]; /* Read as all one's */
1542} READ_NV_VAR;
1543
1544/* Structure for MB Command WRITE_NVPARMS (03) */
1545
1546typedef struct {
1547 uint32_t rsvd1[3]; /* Must be all one's */
1548 uint32_t rsvd2; /* Must be all zero's */
1549 uint32_t portname[2]; /* N_PORT name */
1550 uint32_t nodename[2]; /* NODE name */
1551
1552#ifdef __BIG_ENDIAN_BITFIELD
1553 uint32_t pref_DID:24;
1554 uint32_t hardAL_PA:8;
1555#else /* __LITTLE_ENDIAN_BITFIELD */
1556 uint32_t hardAL_PA:8;
1557 uint32_t pref_DID:24;
1558#endif
1559
1560 uint32_t rsvd3[21]; /* Must be all one's */
1561} WRITE_NV_VAR;
1562
1563/* Structure for MB Command RUN_BIU_DIAG (04) */
1564/* Structure for MB Command RUN_BIU_DIAG64 (0x84) */
1565
1566typedef struct {
1567 uint32_t rsvd1;
1568 union {
1569 struct {
1570 struct ulp_bde xmit_bde;
1571 struct ulp_bde rcv_bde;
1572 } s1;
1573 struct {
1574 struct ulp_bde64 xmit_bde64;
1575 struct ulp_bde64 rcv_bde64;
1576 } s2;
1577 } un;
1578} BIU_DIAG_VAR;
1579
1580/* Structure for MB Command INIT_LINK (05) */
1581
1582typedef struct {
1583#ifdef __BIG_ENDIAN_BITFIELD
1584 uint32_t rsvd1:24;
1585 uint32_t lipsr_AL_PA:8; /* AL_PA to issue Lip Selective Reset to */
1586#else /* __LITTLE_ENDIAN_BITFIELD */
1587 uint32_t lipsr_AL_PA:8; /* AL_PA to issue Lip Selective Reset to */
1588 uint32_t rsvd1:24;
1589#endif
1590
1591#ifdef __BIG_ENDIAN_BITFIELD
1592 uint8_t fabric_AL_PA; /* If using a Fabric Assigned AL_PA */
1593 uint8_t rsvd2;
1594 uint16_t link_flags;
1595#else /* __LITTLE_ENDIAN_BITFIELD */
1596 uint16_t link_flags;
1597 uint8_t rsvd2;
1598 uint8_t fabric_AL_PA; /* If using a Fabric Assigned AL_PA */
1599#endif
1600
1601#define FLAGS_LOCAL_LB 0x01 /* link_flags (=1) ENDEC loopback */
1602#define FLAGS_TOPOLOGY_MODE_LOOP_PT 0x00 /* Attempt loop then pt-pt */
1603#define FLAGS_TOPOLOGY_MODE_PT_PT 0x02 /* Attempt pt-pt only */
1604#define FLAGS_TOPOLOGY_MODE_LOOP 0x04 /* Attempt loop only */
1605#define FLAGS_TOPOLOGY_MODE_PT_LOOP 0x06 /* Attempt pt-pt then loop */
James Smart92d7f7b2007-06-17 19:56:38 -05001606#define FLAGS_UNREG_LOGIN_ALL 0x08 /* UNREG_LOGIN all on link down */
dea31012005-04-17 16:05:31 -05001607#define FLAGS_LIRP_LILP 0x80 /* LIRP / LILP is disabled */
1608
1609#define FLAGS_TOPOLOGY_FAILOVER 0x0400 /* Bit 10 */
1610#define FLAGS_LINK_SPEED 0x0800 /* Bit 11 */
James Smart4b0b91d2006-04-15 11:53:00 -04001611#define FLAGS_IMED_ABORT 0x04000 /* Bit 14 */
dea31012005-04-17 16:05:31 -05001612
1613 uint32_t link_speed;
1614#define LINK_SPEED_AUTO 0 /* Auto selection */
1615#define LINK_SPEED_1G 1 /* 1 Gigabaud */
1616#define LINK_SPEED_2G 2 /* 2 Gigabaud */
1617#define LINK_SPEED_4G 4 /* 4 Gigabaud */
James Smartb87eab32007-04-25 09:53:28 -04001618#define LINK_SPEED_8G 8 /* 8 Gigabaud */
dea31012005-04-17 16:05:31 -05001619#define LINK_SPEED_10G 16 /* 10 Gigabaud */
1620
1621} INIT_LINK_VAR;
1622
1623/* Structure for MB Command DOWN_LINK (06) */
1624
1625typedef struct {
1626 uint32_t rsvd1;
1627} DOWN_LINK_VAR;
1628
1629/* Structure for MB Command CONFIG_LINK (07) */
1630
1631typedef struct {
1632#ifdef __BIG_ENDIAN_BITFIELD
1633 uint32_t cr:1;
1634 uint32_t ci:1;
1635 uint32_t cr_delay:6;
1636 uint32_t cr_count:8;
1637 uint32_t rsvd1:8;
1638 uint32_t MaxBBC:8;
1639#else /* __LITTLE_ENDIAN_BITFIELD */
1640 uint32_t MaxBBC:8;
1641 uint32_t rsvd1:8;
1642 uint32_t cr_count:8;
1643 uint32_t cr_delay:6;
1644 uint32_t ci:1;
1645 uint32_t cr:1;
1646#endif
1647
1648 uint32_t myId;
1649 uint32_t rsvd2;
1650 uint32_t edtov;
1651 uint32_t arbtov;
1652 uint32_t ratov;
1653 uint32_t rttov;
1654 uint32_t altov;
1655 uint32_t crtov;
1656 uint32_t citov;
1657#ifdef __BIG_ENDIAN_BITFIELD
1658 uint32_t rrq_enable:1;
1659 uint32_t rrq_immed:1;
1660 uint32_t rsvd4:29;
1661 uint32_t ack0_enable:1;
1662#else /* __LITTLE_ENDIAN_BITFIELD */
1663 uint32_t ack0_enable:1;
1664 uint32_t rsvd4:29;
1665 uint32_t rrq_immed:1;
1666 uint32_t rrq_enable:1;
1667#endif
1668} CONFIG_LINK;
1669
1670/* Structure for MB Command PART_SLIM (08)
1671 * will be removed since SLI1 is no longer supported!
1672 */
1673typedef struct {
1674#ifdef __BIG_ENDIAN_BITFIELD
1675 uint16_t offCiocb;
1676 uint16_t numCiocb;
1677 uint16_t offRiocb;
1678 uint16_t numRiocb;
1679#else /* __LITTLE_ENDIAN_BITFIELD */
1680 uint16_t numCiocb;
1681 uint16_t offCiocb;
1682 uint16_t numRiocb;
1683 uint16_t offRiocb;
1684#endif
1685} RING_DEF;
1686
1687typedef struct {
1688#ifdef __BIG_ENDIAN_BITFIELD
1689 uint32_t unused1:24;
1690 uint32_t numRing:8;
1691#else /* __LITTLE_ENDIAN_BITFIELD */
1692 uint32_t numRing:8;
1693 uint32_t unused1:24;
1694#endif
1695
1696 RING_DEF ringdef[4];
1697 uint32_t hbainit;
1698} PART_SLIM_VAR;
1699
1700/* Structure for MB Command CONFIG_RING (09) */
1701
1702typedef struct {
1703#ifdef __BIG_ENDIAN_BITFIELD
1704 uint32_t unused2:6;
1705 uint32_t recvSeq:1;
1706 uint32_t recvNotify:1;
1707 uint32_t numMask:8;
1708 uint32_t profile:8;
1709 uint32_t unused1:4;
1710 uint32_t ring:4;
1711#else /* __LITTLE_ENDIAN_BITFIELD */
1712 uint32_t ring:4;
1713 uint32_t unused1:4;
1714 uint32_t profile:8;
1715 uint32_t numMask:8;
1716 uint32_t recvNotify:1;
1717 uint32_t recvSeq:1;
1718 uint32_t unused2:6;
1719#endif
1720
1721#ifdef __BIG_ENDIAN_BITFIELD
1722 uint16_t maxRespXchg;
1723 uint16_t maxOrigXchg;
1724#else /* __LITTLE_ENDIAN_BITFIELD */
1725 uint16_t maxOrigXchg;
1726 uint16_t maxRespXchg;
1727#endif
1728
1729 RR_REG rrRegs[6];
1730} CONFIG_RING_VAR;
1731
1732/* Structure for MB Command RESET_RING (10) */
1733
1734typedef struct {
1735 uint32_t ring_no;
1736} RESET_RING_VAR;
1737
1738/* Structure for MB Command READ_CONFIG (11) */
1739
1740typedef struct {
1741#ifdef __BIG_ENDIAN_BITFIELD
1742 uint32_t cr:1;
1743 uint32_t ci:1;
1744 uint32_t cr_delay:6;
1745 uint32_t cr_count:8;
1746 uint32_t InitBBC:8;
1747 uint32_t MaxBBC:8;
1748#else /* __LITTLE_ENDIAN_BITFIELD */
1749 uint32_t MaxBBC:8;
1750 uint32_t InitBBC:8;
1751 uint32_t cr_count:8;
1752 uint32_t cr_delay:6;
1753 uint32_t ci:1;
1754 uint32_t cr:1;
1755#endif
1756
1757#ifdef __BIG_ENDIAN_BITFIELD
1758 uint32_t topology:8;
1759 uint32_t myDid:24;
1760#else /* __LITTLE_ENDIAN_BITFIELD */
1761 uint32_t myDid:24;
1762 uint32_t topology:8;
1763#endif
1764
1765 /* Defines for topology (defined previously) */
1766#ifdef __BIG_ENDIAN_BITFIELD
1767 uint32_t AR:1;
1768 uint32_t IR:1;
1769 uint32_t rsvd1:29;
1770 uint32_t ack0:1;
1771#else /* __LITTLE_ENDIAN_BITFIELD */
1772 uint32_t ack0:1;
1773 uint32_t rsvd1:29;
1774 uint32_t IR:1;
1775 uint32_t AR:1;
1776#endif
1777
1778 uint32_t edtov;
1779 uint32_t arbtov;
1780 uint32_t ratov;
1781 uint32_t rttov;
1782 uint32_t altov;
1783 uint32_t lmt;
Jamie Wellnitz74b72a52006-02-28 22:33:04 -05001784#define LMT_RESERVED 0x000 /* Not used */
1785#define LMT_1Gb 0x004
1786#define LMT_2Gb 0x008
1787#define LMT_4Gb 0x040
1788#define LMT_8Gb 0x080
1789#define LMT_10Gb 0x100
dea31012005-04-17 16:05:31 -05001790 uint32_t rsvd2;
1791 uint32_t rsvd3;
1792 uint32_t max_xri;
1793 uint32_t max_iocb;
1794 uint32_t max_rpi;
1795 uint32_t avail_xri;
1796 uint32_t avail_iocb;
1797 uint32_t avail_rpi;
James Smart858c9f62007-06-17 19:56:39 -05001798 uint32_t max_vpi;
1799 uint32_t rsvd4;
1800 uint32_t rsvd5;
1801 uint32_t avail_vpi;
dea31012005-04-17 16:05:31 -05001802} READ_CONFIG_VAR;
1803
1804/* Structure for MB Command READ_RCONFIG (12) */
1805
1806typedef struct {
1807#ifdef __BIG_ENDIAN_BITFIELD
1808 uint32_t rsvd2:7;
1809 uint32_t recvNotify:1;
1810 uint32_t numMask:8;
1811 uint32_t profile:8;
1812 uint32_t rsvd1:4;
1813 uint32_t ring:4;
1814#else /* __LITTLE_ENDIAN_BITFIELD */
1815 uint32_t ring:4;
1816 uint32_t rsvd1:4;
1817 uint32_t profile:8;
1818 uint32_t numMask:8;
1819 uint32_t recvNotify:1;
1820 uint32_t rsvd2:7;
1821#endif
1822
1823#ifdef __BIG_ENDIAN_BITFIELD
1824 uint16_t maxResp;
1825 uint16_t maxOrig;
1826#else /* __LITTLE_ENDIAN_BITFIELD */
1827 uint16_t maxOrig;
1828 uint16_t maxResp;
1829#endif
1830
1831 RR_REG rrRegs[6];
1832
1833#ifdef __BIG_ENDIAN_BITFIELD
1834 uint16_t cmdRingOffset;
1835 uint16_t cmdEntryCnt;
1836 uint16_t rspRingOffset;
1837 uint16_t rspEntryCnt;
1838 uint16_t nextCmdOffset;
1839 uint16_t rsvd3;
1840 uint16_t nextRspOffset;
1841 uint16_t rsvd4;
1842#else /* __LITTLE_ENDIAN_BITFIELD */
1843 uint16_t cmdEntryCnt;
1844 uint16_t cmdRingOffset;
1845 uint16_t rspEntryCnt;
1846 uint16_t rspRingOffset;
1847 uint16_t rsvd3;
1848 uint16_t nextCmdOffset;
1849 uint16_t rsvd4;
1850 uint16_t nextRspOffset;
1851#endif
1852} READ_RCONF_VAR;
1853
1854/* Structure for MB Command READ_SPARM (13) */
1855/* Structure for MB Command READ_SPARM64 (0x8D) */
1856
1857typedef struct {
1858 uint32_t rsvd1;
1859 uint32_t rsvd2;
1860 union {
1861 struct ulp_bde sp; /* This BDE points to struct serv_parm
1862 structure */
1863 struct ulp_bde64 sp64;
1864 } un;
James Smarted957682007-06-17 19:56:37 -05001865#ifdef __BIG_ENDIAN_BITFIELD
1866 uint16_t rsvd3;
1867 uint16_t vpi;
1868#else /* __LITTLE_ENDIAN_BITFIELD */
1869 uint16_t vpi;
1870 uint16_t rsvd3;
1871#endif
dea31012005-04-17 16:05:31 -05001872} READ_SPARM_VAR;
1873
1874/* Structure for MB Command READ_STATUS (14) */
1875
1876typedef struct {
1877#ifdef __BIG_ENDIAN_BITFIELD
1878 uint32_t rsvd1:31;
1879 uint32_t clrCounters:1;
1880 uint16_t activeXriCnt;
1881 uint16_t activeRpiCnt;
1882#else /* __LITTLE_ENDIAN_BITFIELD */
1883 uint32_t clrCounters:1;
1884 uint32_t rsvd1:31;
1885 uint16_t activeRpiCnt;
1886 uint16_t activeXriCnt;
1887#endif
1888
1889 uint32_t xmitByteCnt;
1890 uint32_t rcvByteCnt;
1891 uint32_t xmitFrameCnt;
1892 uint32_t rcvFrameCnt;
1893 uint32_t xmitSeqCnt;
1894 uint32_t rcvSeqCnt;
1895 uint32_t totalOrigExchanges;
1896 uint32_t totalRespExchanges;
1897 uint32_t rcvPbsyCnt;
1898 uint32_t rcvFbsyCnt;
1899} READ_STATUS_VAR;
1900
1901/* Structure for MB Command READ_RPI (15) */
1902/* Structure for MB Command READ_RPI64 (0x8F) */
1903
1904typedef struct {
1905#ifdef __BIG_ENDIAN_BITFIELD
1906 uint16_t nextRpi;
1907 uint16_t reqRpi;
1908 uint32_t rsvd2:8;
1909 uint32_t DID:24;
1910#else /* __LITTLE_ENDIAN_BITFIELD */
1911 uint16_t reqRpi;
1912 uint16_t nextRpi;
1913 uint32_t DID:24;
1914 uint32_t rsvd2:8;
1915#endif
1916
1917 union {
1918 struct ulp_bde sp;
1919 struct ulp_bde64 sp64;
1920 } un;
1921
1922} READ_RPI_VAR;
1923
1924/* Structure for MB Command READ_XRI (16) */
1925
1926typedef struct {
1927#ifdef __BIG_ENDIAN_BITFIELD
1928 uint16_t nextXri;
1929 uint16_t reqXri;
1930 uint16_t rsvd1;
1931 uint16_t rpi;
1932 uint32_t rsvd2:8;
1933 uint32_t DID:24;
1934 uint32_t rsvd3:8;
1935 uint32_t SID:24;
1936 uint32_t rsvd4;
1937 uint8_t seqId;
1938 uint8_t rsvd5;
1939 uint16_t seqCount;
1940 uint16_t oxId;
1941 uint16_t rxId;
1942 uint32_t rsvd6:30;
1943 uint32_t si:1;
1944 uint32_t exchOrig:1;
1945#else /* __LITTLE_ENDIAN_BITFIELD */
1946 uint16_t reqXri;
1947 uint16_t nextXri;
1948 uint16_t rpi;
1949 uint16_t rsvd1;
1950 uint32_t DID:24;
1951 uint32_t rsvd2:8;
1952 uint32_t SID:24;
1953 uint32_t rsvd3:8;
1954 uint32_t rsvd4;
1955 uint16_t seqCount;
1956 uint8_t rsvd5;
1957 uint8_t seqId;
1958 uint16_t rxId;
1959 uint16_t oxId;
1960 uint32_t exchOrig:1;
1961 uint32_t si:1;
1962 uint32_t rsvd6:30;
1963#endif
1964} READ_XRI_VAR;
1965
1966/* Structure for MB Command READ_REV (17) */
1967
1968typedef struct {
1969#ifdef __BIG_ENDIAN_BITFIELD
1970 uint32_t cv:1;
1971 uint32_t rr:1;
James Smarted957682007-06-17 19:56:37 -05001972 uint32_t rsvd2:2;
1973 uint32_t v3req:1;
1974 uint32_t v3rsp:1;
1975 uint32_t rsvd1:25;
dea31012005-04-17 16:05:31 -05001976 uint32_t rv:1;
1977#else /* __LITTLE_ENDIAN_BITFIELD */
1978 uint32_t rv:1;
James Smarted957682007-06-17 19:56:37 -05001979 uint32_t rsvd1:25;
1980 uint32_t v3rsp:1;
1981 uint32_t v3req:1;
1982 uint32_t rsvd2:2;
dea31012005-04-17 16:05:31 -05001983 uint32_t rr:1;
1984 uint32_t cv:1;
1985#endif
1986
1987 uint32_t biuRev;
1988 uint32_t smRev;
1989 union {
1990 uint32_t smFwRev;
1991 struct {
1992#ifdef __BIG_ENDIAN_BITFIELD
1993 uint8_t ProgType;
1994 uint8_t ProgId;
1995 uint16_t ProgVer:4;
1996 uint16_t ProgRev:4;
1997 uint16_t ProgFixLvl:2;
1998 uint16_t ProgDistType:2;
1999 uint16_t DistCnt:4;
2000#else /* __LITTLE_ENDIAN_BITFIELD */
2001 uint16_t DistCnt:4;
2002 uint16_t ProgDistType:2;
2003 uint16_t ProgFixLvl:2;
2004 uint16_t ProgRev:4;
2005 uint16_t ProgVer:4;
2006 uint8_t ProgId;
2007 uint8_t ProgType;
2008#endif
2009
2010 } b;
2011 } un;
2012 uint32_t endecRev;
2013#ifdef __BIG_ENDIAN_BITFIELD
2014 uint8_t feaLevelHigh;
2015 uint8_t feaLevelLow;
2016 uint8_t fcphHigh;
2017 uint8_t fcphLow;
2018#else /* __LITTLE_ENDIAN_BITFIELD */
2019 uint8_t fcphLow;
2020 uint8_t fcphHigh;
2021 uint8_t feaLevelLow;
2022 uint8_t feaLevelHigh;
2023#endif
2024
2025 uint32_t postKernRev;
2026 uint32_t opFwRev;
2027 uint8_t opFwName[16];
2028 uint32_t sli1FwRev;
2029 uint8_t sli1FwName[16];
2030 uint32_t sli2FwRev;
2031 uint8_t sli2FwName[16];
James Smarted957682007-06-17 19:56:37 -05002032 uint32_t sli3Feat;
2033 uint32_t RandomData[6];
dea31012005-04-17 16:05:31 -05002034} READ_REV_VAR;
2035
2036/* Structure for MB Command READ_LINK_STAT (18) */
2037
2038typedef struct {
2039 uint32_t rsvd1;
2040 uint32_t linkFailureCnt;
2041 uint32_t lossSyncCnt;
2042
2043 uint32_t lossSignalCnt;
2044 uint32_t primSeqErrCnt;
2045 uint32_t invalidXmitWord;
2046 uint32_t crcCnt;
2047 uint32_t primSeqTimeout;
2048 uint32_t elasticOverrun;
2049 uint32_t arbTimeout;
2050} READ_LNK_VAR;
2051
2052/* Structure for MB Command REG_LOGIN (19) */
2053/* Structure for MB Command REG_LOGIN64 (0x93) */
2054
2055typedef struct {
2056#ifdef __BIG_ENDIAN_BITFIELD
2057 uint16_t rsvd1;
2058 uint16_t rpi;
2059 uint32_t rsvd2:8;
2060 uint32_t did:24;
2061#else /* __LITTLE_ENDIAN_BITFIELD */
2062 uint16_t rpi;
2063 uint16_t rsvd1;
2064 uint32_t did:24;
2065 uint32_t rsvd2:8;
2066#endif
2067
2068 union {
2069 struct ulp_bde sp;
2070 struct ulp_bde64 sp64;
2071 } un;
2072
James Smarted957682007-06-17 19:56:37 -05002073#ifdef __BIG_ENDIAN_BITFIELD
2074 uint16_t rsvd6;
2075 uint16_t vpi;
2076#else /* __LITTLE_ENDIAN_BITFIELD */
2077 uint16_t vpi;
2078 uint16_t rsvd6;
2079#endif
2080
dea31012005-04-17 16:05:31 -05002081} REG_LOGIN_VAR;
2082
2083/* Word 30 contents for REG_LOGIN */
2084typedef union {
2085 struct {
2086#ifdef __BIG_ENDIAN_BITFIELD
2087 uint16_t rsvd1:12;
2088 uint16_t wd30_class:4;
2089 uint16_t xri;
2090#else /* __LITTLE_ENDIAN_BITFIELD */
2091 uint16_t xri;
2092 uint16_t wd30_class:4;
2093 uint16_t rsvd1:12;
2094#endif
2095 } f;
2096 uint32_t word;
2097} REG_WD30;
2098
2099/* Structure for MB Command UNREG_LOGIN (20) */
2100
2101typedef struct {
2102#ifdef __BIG_ENDIAN_BITFIELD
2103 uint16_t rsvd1;
2104 uint16_t rpi;
James Smarted957682007-06-17 19:56:37 -05002105 uint32_t rsvd2;
2106 uint32_t rsvd3;
2107 uint32_t rsvd4;
2108 uint32_t rsvd5;
2109 uint16_t rsvd6;
2110 uint16_t vpi;
dea31012005-04-17 16:05:31 -05002111#else /* __LITTLE_ENDIAN_BITFIELD */
2112 uint16_t rpi;
2113 uint16_t rsvd1;
James Smarted957682007-06-17 19:56:37 -05002114 uint32_t rsvd2;
2115 uint32_t rsvd3;
2116 uint32_t rsvd4;
2117 uint32_t rsvd5;
2118 uint16_t vpi;
2119 uint16_t rsvd6;
dea31012005-04-17 16:05:31 -05002120#endif
2121} UNREG_LOGIN_VAR;
2122
James Smart92d7f7b2007-06-17 19:56:38 -05002123/* Structure for MB Command REG_VPI (0x96) */
2124typedef struct {
2125#ifdef __BIG_ENDIAN_BITFIELD
2126 uint32_t rsvd1;
2127 uint32_t rsvd2:8;
2128 uint32_t sid:24;
2129 uint32_t rsvd3;
2130 uint32_t rsvd4;
2131 uint32_t rsvd5;
2132 uint16_t rsvd6;
2133 uint16_t vpi;
2134#else /* __LITTLE_ENDIAN */
2135 uint32_t rsvd1;
2136 uint32_t sid:24;
2137 uint32_t rsvd2:8;
2138 uint32_t rsvd3;
2139 uint32_t rsvd4;
2140 uint32_t rsvd5;
2141 uint16_t vpi;
2142 uint16_t rsvd6;
2143#endif
2144} REG_VPI_VAR;
2145
2146/* Structure for MB Command UNREG_VPI (0x97) */
2147typedef struct {
2148 uint32_t rsvd1;
2149 uint32_t rsvd2;
2150 uint32_t rsvd3;
2151 uint32_t rsvd4;
2152 uint32_t rsvd5;
2153#ifdef __BIG_ENDIAN_BITFIELD
2154 uint16_t rsvd6;
2155 uint16_t vpi;
2156#else /* __LITTLE_ENDIAN */
2157 uint16_t vpi;
2158 uint16_t rsvd6;
2159#endif
2160} UNREG_VPI_VAR;
2161
dea31012005-04-17 16:05:31 -05002162/* Structure for MB Command UNREG_D_ID (0x23) */
2163
2164typedef struct {
2165 uint32_t did;
James Smarted957682007-06-17 19:56:37 -05002166 uint32_t rsvd2;
2167 uint32_t rsvd3;
2168 uint32_t rsvd4;
2169 uint32_t rsvd5;
2170#ifdef __BIG_ENDIAN_BITFIELD
2171 uint16_t rsvd6;
2172 uint16_t vpi;
2173#else
2174 uint16_t vpi;
2175 uint16_t rsvd6;
2176#endif
dea31012005-04-17 16:05:31 -05002177} UNREG_D_ID_VAR;
2178
2179/* Structure for MB Command READ_LA (21) */
2180/* Structure for MB Command READ_LA64 (0x95) */
2181
2182typedef struct {
2183 uint32_t eventTag; /* Event tag */
2184#ifdef __BIG_ENDIAN_BITFIELD
2185 uint32_t rsvd1:22;
2186 uint32_t pb:1;
2187 uint32_t il:1;
2188 uint32_t attType:8;
2189#else /* __LITTLE_ENDIAN_BITFIELD */
2190 uint32_t attType:8;
2191 uint32_t il:1;
2192 uint32_t pb:1;
2193 uint32_t rsvd1:22;
2194#endif
2195
2196#define AT_RESERVED 0x00 /* Reserved - attType */
2197#define AT_LINK_UP 0x01 /* Link is up */
2198#define AT_LINK_DOWN 0x02 /* Link is down */
2199
2200#ifdef __BIG_ENDIAN_BITFIELD
2201 uint8_t granted_AL_PA;
2202 uint8_t lipAlPs;
2203 uint8_t lipType;
2204 uint8_t topology;
2205#else /* __LITTLE_ENDIAN_BITFIELD */
2206 uint8_t topology;
2207 uint8_t lipType;
2208 uint8_t lipAlPs;
2209 uint8_t granted_AL_PA;
2210#endif
2211
2212#define TOPOLOGY_PT_PT 0x01 /* Topology is pt-pt / pt-fabric */
2213#define TOPOLOGY_LOOP 0x02 /* Topology is FC-AL */
2214
2215 union {
2216 struct ulp_bde lilpBde; /* This BDE points to a 128 byte buffer
2217 to */
2218 /* store the LILP AL_PA position map into */
2219 struct ulp_bde64 lilpBde64;
2220 } un;
2221
2222#ifdef __BIG_ENDIAN_BITFIELD
2223 uint32_t Dlu:1;
2224 uint32_t Dtf:1;
2225 uint32_t Drsvd2:14;
2226 uint32_t DlnkSpeed:8;
2227 uint32_t DnlPort:4;
2228 uint32_t Dtx:2;
2229 uint32_t Drx:2;
2230#else /* __LITTLE_ENDIAN_BITFIELD */
2231 uint32_t Drx:2;
2232 uint32_t Dtx:2;
2233 uint32_t DnlPort:4;
2234 uint32_t DlnkSpeed:8;
2235 uint32_t Drsvd2:14;
2236 uint32_t Dtf:1;
2237 uint32_t Dlu:1;
2238#endif
2239
2240#ifdef __BIG_ENDIAN_BITFIELD
2241 uint32_t Ulu:1;
2242 uint32_t Utf:1;
2243 uint32_t Ursvd2:14;
2244 uint32_t UlnkSpeed:8;
2245 uint32_t UnlPort:4;
2246 uint32_t Utx:2;
2247 uint32_t Urx:2;
2248#else /* __LITTLE_ENDIAN_BITFIELD */
2249 uint32_t Urx:2;
2250 uint32_t Utx:2;
2251 uint32_t UnlPort:4;
2252 uint32_t UlnkSpeed:8;
2253 uint32_t Ursvd2:14;
2254 uint32_t Utf:1;
2255 uint32_t Ulu:1;
2256#endif
2257
2258#define LA_UNKNW_LINK 0x0 /* lnkSpeed */
2259#define LA_1GHZ_LINK 0x04 /* lnkSpeed */
2260#define LA_2GHZ_LINK 0x08 /* lnkSpeed */
2261#define LA_4GHZ_LINK 0x10 /* lnkSpeed */
2262#define LA_8GHZ_LINK 0x20 /* lnkSpeed */
2263#define LA_10GHZ_LINK 0x40 /* lnkSpeed */
2264
2265} READ_LA_VAR;
2266
2267/* Structure for MB Command CLEAR_LA (22) */
2268
2269typedef struct {
2270 uint32_t eventTag; /* Event tag */
2271 uint32_t rsvd1;
2272} CLEAR_LA_VAR;
2273
2274/* Structure for MB Command DUMP */
2275
2276typedef struct {
2277#ifdef __BIG_ENDIAN_BITFIELD
2278 uint32_t rsvd:25;
2279 uint32_t ra:1;
2280 uint32_t co:1;
2281 uint32_t cv:1;
2282 uint32_t type:4;
2283 uint32_t entry_index:16;
2284 uint32_t region_id:16;
2285#else /* __LITTLE_ENDIAN_BITFIELD */
2286 uint32_t type:4;
2287 uint32_t cv:1;
2288 uint32_t co:1;
2289 uint32_t ra:1;
2290 uint32_t rsvd:25;
2291 uint32_t region_id:16;
2292 uint32_t entry_index:16;
2293#endif
2294
2295 uint32_t rsvd1;
2296 uint32_t word_cnt;
2297 uint32_t resp_offset;
2298} DUMP_VAR;
2299
2300#define DMP_MEM_REG 0x1
2301#define DMP_NV_PARAMS 0x2
2302
2303#define DMP_REGION_VPD 0xe
2304#define DMP_VPD_SIZE 0x400 /* maximum amount of VPD */
2305#define DMP_RSP_OFFSET 0x14 /* word 5 contains first word of rsp */
2306#define DMP_RSP_SIZE 0x6C /* maximum of 27 words of rsp data */
2307
James Smarted957682007-06-17 19:56:37 -05002308struct hbq_mask {
2309#ifdef __BIG_ENDIAN_BITFIELD
2310 uint8_t tmatch;
2311 uint8_t tmask;
2312 uint8_t rctlmatch;
2313 uint8_t rctlmask;
2314#else /* __LITTLE_ENDIAN */
2315 uint8_t rctlmask;
2316 uint8_t rctlmatch;
2317 uint8_t tmask;
2318 uint8_t tmatch;
2319#endif
2320};
2321
2322
2323/* Structure for MB Command CONFIG_HBQ (7c) */
2324
2325struct config_hbq_var {
2326#ifdef __BIG_ENDIAN_BITFIELD
2327 uint32_t rsvd1 :7;
2328 uint32_t recvNotify :1; /* Receive Notification */
2329 uint32_t numMask :8; /* # Mask Entries */
2330 uint32_t profile :8; /* Selection Profile */
2331 uint32_t rsvd2 :8;
2332#else /* __LITTLE_ENDIAN */
2333 uint32_t rsvd2 :8;
2334 uint32_t profile :8; /* Selection Profile */
2335 uint32_t numMask :8; /* # Mask Entries */
2336 uint32_t recvNotify :1; /* Receive Notification */
2337 uint32_t rsvd1 :7;
2338#endif
2339
2340#ifdef __BIG_ENDIAN_BITFIELD
2341 uint32_t hbqId :16;
2342 uint32_t rsvd3 :12;
2343 uint32_t ringMask :4;
2344#else /* __LITTLE_ENDIAN */
2345 uint32_t ringMask :4;
2346 uint32_t rsvd3 :12;
2347 uint32_t hbqId :16;
2348#endif
2349
2350#ifdef __BIG_ENDIAN_BITFIELD
2351 uint32_t entry_count :16;
2352 uint32_t rsvd4 :8;
2353 uint32_t headerLen :8;
2354#else /* __LITTLE_ENDIAN */
2355 uint32_t headerLen :8;
2356 uint32_t rsvd4 :8;
2357 uint32_t entry_count :16;
2358#endif
2359
2360 uint32_t hbqaddrLow;
2361 uint32_t hbqaddrHigh;
2362
2363#ifdef __BIG_ENDIAN_BITFIELD
2364 uint32_t rsvd5 :31;
2365 uint32_t logEntry :1;
2366#else /* __LITTLE_ENDIAN */
2367 uint32_t logEntry :1;
2368 uint32_t rsvd5 :31;
2369#endif
2370
2371 uint32_t rsvd6; /* w7 */
2372 uint32_t rsvd7; /* w8 */
2373 uint32_t rsvd8; /* w9 */
2374
2375 struct hbq_mask hbqMasks[6];
2376
2377
2378 union {
2379 uint32_t allprofiles[12];
2380
2381 struct {
2382 #ifdef __BIG_ENDIAN_BITFIELD
2383 uint32_t seqlenoff :16;
2384 uint32_t maxlen :16;
2385 #else /* __LITTLE_ENDIAN */
2386 uint32_t maxlen :16;
2387 uint32_t seqlenoff :16;
2388 #endif
2389 #ifdef __BIG_ENDIAN_BITFIELD
2390 uint32_t rsvd1 :28;
2391 uint32_t seqlenbcnt :4;
2392 #else /* __LITTLE_ENDIAN */
2393 uint32_t seqlenbcnt :4;
2394 uint32_t rsvd1 :28;
2395 #endif
2396 uint32_t rsvd[10];
2397 } profile2;
2398
2399 struct {
2400 #ifdef __BIG_ENDIAN_BITFIELD
2401 uint32_t seqlenoff :16;
2402 uint32_t maxlen :16;
2403 #else /* __LITTLE_ENDIAN */
2404 uint32_t maxlen :16;
2405 uint32_t seqlenoff :16;
2406 #endif
2407 #ifdef __BIG_ENDIAN_BITFIELD
2408 uint32_t cmdcodeoff :28;
2409 uint32_t rsvd1 :12;
2410 uint32_t seqlenbcnt :4;
2411 #else /* __LITTLE_ENDIAN */
2412 uint32_t seqlenbcnt :4;
2413 uint32_t rsvd1 :12;
2414 uint32_t cmdcodeoff :28;
2415 #endif
2416 uint32_t cmdmatch[8];
2417
2418 uint32_t rsvd[2];
2419 } profile3;
2420
2421 struct {
2422 #ifdef __BIG_ENDIAN_BITFIELD
2423 uint32_t seqlenoff :16;
2424 uint32_t maxlen :16;
2425 #else /* __LITTLE_ENDIAN */
2426 uint32_t maxlen :16;
2427 uint32_t seqlenoff :16;
2428 #endif
2429 #ifdef __BIG_ENDIAN_BITFIELD
2430 uint32_t cmdcodeoff :28;
2431 uint32_t rsvd1 :12;
2432 uint32_t seqlenbcnt :4;
2433 #else /* __LITTLE_ENDIAN */
2434 uint32_t seqlenbcnt :4;
2435 uint32_t rsvd1 :12;
2436 uint32_t cmdcodeoff :28;
2437 #endif
2438 uint32_t cmdmatch[8];
2439
2440 uint32_t rsvd[2];
2441 } profile5;
2442
2443 } profiles;
2444
2445};
2446
2447
dea31012005-04-17 16:05:31 -05002448
James Smart2e0fef82007-06-17 19:56:36 -05002449/* Structure for MB Command CONFIG_PORT (0x88) */
dea31012005-04-17 16:05:31 -05002450typedef struct {
James Smarted957682007-06-17 19:56:37 -05002451#ifdef __BIG_ENDIAN_BITFIELD
2452 uint32_t cBE : 1;
2453 uint32_t cET : 1;
2454 uint32_t cHpcb : 1;
2455 uint32_t cMA : 1;
2456 uint32_t sli_mode : 4;
2457 uint32_t pcbLen : 24; /* bit 23:0 of memory based port
2458 * config block */
2459#else /* __LITTLE_ENDIAN */
2460 uint32_t pcbLen : 24; /* bit 23:0 of memory based port
2461 * config block */
2462 uint32_t sli_mode : 4;
2463 uint32_t cMA : 1;
2464 uint32_t cHpcb : 1;
2465 uint32_t cET : 1;
2466 uint32_t cBE : 1;
2467#endif
2468
dea31012005-04-17 16:05:31 -05002469 uint32_t pcbLow; /* bit 31:0 of memory based port config block */
2470 uint32_t pcbHigh; /* bit 63:32 of memory based port config block */
James Smarted957682007-06-17 19:56:37 -05002471 uint32_t hbainit[6];
2472
2473#ifdef __BIG_ENDIAN_BITFIELD
2474 uint32_t rsvd : 24; /* Reserved */
2475 uint32_t cmv : 1; /* Configure Max VPIs */
2476 uint32_t ccrp : 1; /* Config Command Ring Polling */
2477 uint32_t csah : 1; /* Configure Synchronous Abort Handling */
2478 uint32_t chbs : 1; /* Cofigure Host Backing store */
2479 uint32_t cinb : 1; /* Enable Interrupt Notification Block */
2480 uint32_t cerbm : 1; /* Configure Enhanced Receive Buf Mgmt */
2481 uint32_t cmx : 1; /* Configure Max XRIs */
2482 uint32_t cmr : 1; /* Configure Max RPIs */
2483#else /* __LITTLE_ENDIAN */
2484 uint32_t cmr : 1; /* Configure Max RPIs */
2485 uint32_t cmx : 1; /* Configure Max XRIs */
2486 uint32_t cerbm : 1; /* Configure Enhanced Receive Buf Mgmt */
2487 uint32_t cinb : 1; /* Enable Interrupt Notification Block */
2488 uint32_t chbs : 1; /* Cofigure Host Backing store */
2489 uint32_t csah : 1; /* Configure Synchronous Abort Handling */
2490 uint32_t ccrp : 1; /* Config Command Ring Polling */
2491 uint32_t cmv : 1; /* Configure Max VPIs */
2492 uint32_t rsvd : 24; /* Reserved */
2493#endif
2494#ifdef __BIG_ENDIAN_BITFIELD
2495 uint32_t rsvd2 : 24; /* Reserved */
2496 uint32_t gmv : 1; /* Grant Max VPIs */
2497 uint32_t gcrp : 1; /* Grant Command Ring Polling */
2498 uint32_t gsah : 1; /* Grant Synchronous Abort Handling */
2499 uint32_t ghbs : 1; /* Grant Host Backing Store */
2500 uint32_t ginb : 1; /* Grant Interrupt Notification Block */
2501 uint32_t gerbm : 1; /* Grant ERBM Request */
2502 uint32_t gmx : 1; /* Grant Max XRIs */
2503 uint32_t gmr : 1; /* Grant Max RPIs */
2504#else /* __LITTLE_ENDIAN */
2505 uint32_t gmr : 1; /* Grant Max RPIs */
2506 uint32_t gmx : 1; /* Grant Max XRIs */
2507 uint32_t gerbm : 1; /* Grant ERBM Request */
2508 uint32_t ginb : 1; /* Grant Interrupt Notification Block */
2509 uint32_t ghbs : 1; /* Grant Host Backing Store */
2510 uint32_t gsah : 1; /* Grant Synchronous Abort Handling */
2511 uint32_t gcrp : 1; /* Grant Command Ring Polling */
2512 uint32_t gmv : 1; /* Grant Max VPIs */
2513 uint32_t rsvd2 : 24; /* Reserved */
2514#endif
2515
2516#ifdef __BIG_ENDIAN_BITFIELD
2517 uint32_t max_rpi : 16; /* Max RPIs Port should configure */
2518 uint32_t max_xri : 16; /* Max XRIs Port should configure */
2519#else /* __LITTLE_ENDIAN */
2520 uint32_t max_xri : 16; /* Max XRIs Port should configure */
2521 uint32_t max_rpi : 16; /* Max RPIs Port should configure */
2522#endif
2523
2524#ifdef __BIG_ENDIAN_BITFIELD
2525 uint32_t max_hbq : 16; /* Max HBQs Host expect to configure */
2526 uint32_t rsvd3 : 16; /* Max HBQs Host expect to configure */
2527#else /* __LITTLE_ENDIAN */
2528 uint32_t rsvd3 : 16; /* Max HBQs Host expect to configure */
2529 uint32_t max_hbq : 16; /* Max HBQs Host expect to configure */
2530#endif
2531
2532 uint32_t rsvd4; /* Reserved */
2533
2534#ifdef __BIG_ENDIAN_BITFIELD
2535 uint32_t rsvd5 : 16; /* Reserved */
2536 uint32_t max_vpi : 16; /* Max number of virt N-Ports */
2537#else /* __LITTLE_ENDIAN */
2538 uint32_t max_vpi : 16; /* Max number of virt N-Ports */
2539 uint32_t rsvd5 : 16; /* Reserved */
2540#endif
2541
dea31012005-04-17 16:05:31 -05002542} CONFIG_PORT_VAR;
2543
2544/* SLI-2 Port Control Block */
2545
2546/* SLIM POINTER */
2547#define SLIMOFF 0x30 /* WORD */
2548
2549typedef struct _SLI2_RDSC {
2550 uint32_t cmdEntries;
2551 uint32_t cmdAddrLow;
2552 uint32_t cmdAddrHigh;
2553
2554 uint32_t rspEntries;
2555 uint32_t rspAddrLow;
2556 uint32_t rspAddrHigh;
2557} SLI2_RDSC;
2558
2559typedef struct _PCB {
2560#ifdef __BIG_ENDIAN_BITFIELD
2561 uint32_t type:8;
2562#define TYPE_NATIVE_SLI2 0x01;
2563 uint32_t feature:8;
2564#define FEATURE_INITIAL_SLI2 0x01;
2565 uint32_t rsvd:12;
2566 uint32_t maxRing:4;
2567#else /* __LITTLE_ENDIAN_BITFIELD */
2568 uint32_t maxRing:4;
2569 uint32_t rsvd:12;
2570 uint32_t feature:8;
2571#define FEATURE_INITIAL_SLI2 0x01;
2572 uint32_t type:8;
2573#define TYPE_NATIVE_SLI2 0x01;
2574#endif
2575
2576 uint32_t mailBoxSize;
2577 uint32_t mbAddrLow;
2578 uint32_t mbAddrHigh;
2579
2580 uint32_t hgpAddrLow;
2581 uint32_t hgpAddrHigh;
2582
2583 uint32_t pgpAddrLow;
2584 uint32_t pgpAddrHigh;
2585 SLI2_RDSC rdsc[MAX_RINGS];
2586} PCB_t;
2587
2588/* NEW_FEATURE */
2589typedef struct {
2590#ifdef __BIG_ENDIAN_BITFIELD
2591 uint32_t rsvd0:27;
2592 uint32_t discardFarp:1;
2593 uint32_t IPEnable:1;
2594 uint32_t nodeName:1;
2595 uint32_t portName:1;
2596 uint32_t filterEnable:1;
2597#else /* __LITTLE_ENDIAN_BITFIELD */
2598 uint32_t filterEnable:1;
2599 uint32_t portName:1;
2600 uint32_t nodeName:1;
2601 uint32_t IPEnable:1;
2602 uint32_t discardFarp:1;
2603 uint32_t rsvd:27;
2604#endif
2605
2606 uint8_t portname[8]; /* Used to be struct lpfc_name */
2607 uint8_t nodename[8];
2608 uint32_t rsvd1;
2609 uint32_t rsvd2;
2610 uint32_t rsvd3;
2611 uint32_t IPAddress;
2612} CONFIG_FARP_VAR;
2613
James Smart57127f12007-10-27 13:37:05 -04002614/* Structure for MB Command MBX_ASYNCEVT_ENABLE (0x33) */
2615
2616typedef struct {
2617#ifdef __BIG_ENDIAN_BITFIELD
2618 uint32_t rsvd:30;
2619 uint32_t ring:2; /* Ring for ASYNC_EVENT iocb Bits 0-1*/
2620#else /* __LITTLE_ENDIAN */
2621 uint32_t ring:2; /* Ring for ASYNC_EVENT iocb Bits 0-1*/
2622 uint32_t rsvd:30;
2623#endif
2624} ASYNCEVT_ENABLE_VAR;
2625
dea31012005-04-17 16:05:31 -05002626/* Union of all Mailbox Command types */
2627#define MAILBOX_CMD_WSIZE 32
2628#define MAILBOX_CMD_SIZE (MAILBOX_CMD_WSIZE * sizeof(uint32_t))
2629
2630typedef union {
James Smarted957682007-06-17 19:56:37 -05002631 uint32_t varWords[MAILBOX_CMD_WSIZE - 1]; /* first word is type/
2632 * feature/max ring number
2633 */
2634 LOAD_SM_VAR varLdSM; /* cmd = 1 (LOAD_SM) */
2635 READ_NV_VAR varRDnvp; /* cmd = 2 (READ_NVPARMS) */
2636 WRITE_NV_VAR varWTnvp; /* cmd = 3 (WRITE_NVPARMS) */
James Smart311464e2007-08-02 11:10:37 -04002637 BIU_DIAG_VAR varBIUdiag; /* cmd = 4 (RUN_BIU_DIAG) */
2638 INIT_LINK_VAR varInitLnk; /* cmd = 5 (INIT_LINK) */
dea31012005-04-17 16:05:31 -05002639 DOWN_LINK_VAR varDwnLnk; /* cmd = 6 (DOWN_LINK) */
James Smarted957682007-06-17 19:56:37 -05002640 CONFIG_LINK varCfgLnk; /* cmd = 7 (CONFIG_LINK) */
2641 PART_SLIM_VAR varSlim; /* cmd = 8 (PART_SLIM) */
dea31012005-04-17 16:05:31 -05002642 CONFIG_RING_VAR varCfgRing; /* cmd = 9 (CONFIG_RING) */
2643 RESET_RING_VAR varRstRing; /* cmd = 10 (RESET_RING) */
2644 READ_CONFIG_VAR varRdConfig; /* cmd = 11 (READ_CONFIG) */
2645 READ_RCONF_VAR varRdRConfig; /* cmd = 12 (READ_RCONFIG) */
2646 READ_SPARM_VAR varRdSparm; /* cmd = 13 (READ_SPARM(64)) */
2647 READ_STATUS_VAR varRdStatus; /* cmd = 14 (READ_STATUS) */
James Smarted957682007-06-17 19:56:37 -05002648 READ_RPI_VAR varRdRPI; /* cmd = 15 (READ_RPI(64)) */
2649 READ_XRI_VAR varRdXRI; /* cmd = 16 (READ_XRI) */
2650 READ_REV_VAR varRdRev; /* cmd = 17 (READ_REV) */
2651 READ_LNK_VAR varRdLnk; /* cmd = 18 (READ_LNK_STAT) */
dea31012005-04-17 16:05:31 -05002652 REG_LOGIN_VAR varRegLogin; /* cmd = 19 (REG_LOGIN(64)) */
2653 UNREG_LOGIN_VAR varUnregLogin; /* cmd = 20 (UNREG_LOGIN) */
James Smarted957682007-06-17 19:56:37 -05002654 READ_LA_VAR varReadLA; /* cmd = 21 (READ_LA(64)) */
dea31012005-04-17 16:05:31 -05002655 CLEAR_LA_VAR varClearLA; /* cmd = 22 (CLEAR_LA) */
James Smarted957682007-06-17 19:56:37 -05002656 DUMP_VAR varDmp; /* Warm Start DUMP mbx cmd */
2657 UNREG_D_ID_VAR varUnregDID; /* cmd = 0x23 (UNREG_D_ID) */
2658 CONFIG_FARP_VAR varCfgFarp; /* cmd = 0x25 (CONFIG_FARP)
2659 * NEW_FEATURE
2660 */
2661 struct config_hbq_var varCfgHbq;/* cmd = 0x7c (CONFIG_HBQ) */
2662 CONFIG_PORT_VAR varCfgPort; /* cmd = 0x88 (CONFIG_PORT) */
James Smart92d7f7b2007-06-17 19:56:38 -05002663 REG_VPI_VAR varRegVpi; /* cmd = 0x96 (REG_VPI) */
2664 UNREG_VPI_VAR varUnregVpi; /* cmd = 0x97 (UNREG_VPI) */
James Smart57127f12007-10-27 13:37:05 -04002665 ASYNCEVT_ENABLE_VAR varCfgAsyncEvent; /*cmd = x33 (CONFIG_ASYNC) */
dea31012005-04-17 16:05:31 -05002666} MAILVARIANTS;
2667
2668/*
2669 * SLI-2 specific structures
2670 */
2671
James.Smart@Emulex.Com4cc2da12005-06-25 10:34:00 -04002672struct lpfc_hgp {
2673 __le32 cmdPutInx;
2674 __le32 rspGetInx;
2675};
dea31012005-04-17 16:05:31 -05002676
James.Smart@Emulex.Com4cc2da12005-06-25 10:34:00 -04002677struct lpfc_pgp {
2678 __le32 cmdGetInx;
2679 __le32 rspPutInx;
2680};
dea31012005-04-17 16:05:31 -05002681
James Smarted957682007-06-17 19:56:37 -05002682struct sli2_desc {
dea31012005-04-17 16:05:31 -05002683 uint32_t unused1[16];
James Smarted957682007-06-17 19:56:37 -05002684 struct lpfc_hgp host[MAX_RINGS];
James.Smart@Emulex.Com4cc2da12005-06-25 10:34:00 -04002685 struct lpfc_pgp port[MAX_RINGS];
James Smarted957682007-06-17 19:56:37 -05002686};
2687
2688struct sli3_desc {
2689 struct lpfc_hgp host[MAX_RINGS];
2690 uint32_t reserved[8];
2691 uint32_t hbq_put[16];
2692};
2693
2694struct sli3_pgp {
2695 struct lpfc_pgp port[MAX_RINGS];
2696 uint32_t hbq_get[16];
2697};
dea31012005-04-17 16:05:31 -05002698
2699typedef union {
James Smarted957682007-06-17 19:56:37 -05002700 struct sli2_desc s2;
2701 struct sli3_desc s3;
2702 struct sli3_pgp s3_pgp;
dea31012005-04-17 16:05:31 -05002703} SLI_VAR;
2704
2705typedef struct {
2706#ifdef __BIG_ENDIAN_BITFIELD
2707 uint16_t mbxStatus;
2708 uint8_t mbxCommand;
2709 uint8_t mbxReserved:6;
2710 uint8_t mbxHc:1;
2711 uint8_t mbxOwner:1; /* Low order bit first word */
2712#else /* __LITTLE_ENDIAN_BITFIELD */
2713 uint8_t mbxOwner:1; /* Low order bit first word */
2714 uint8_t mbxHc:1;
2715 uint8_t mbxReserved:6;
2716 uint8_t mbxCommand;
2717 uint16_t mbxStatus;
2718#endif
2719
2720 MAILVARIANTS un;
2721 SLI_VAR us;
2722} MAILBOX_t;
2723
2724/*
2725 * Begin Structure Definitions for IOCB Commands
2726 */
2727
2728typedef struct {
2729#ifdef __BIG_ENDIAN_BITFIELD
2730 uint8_t statAction;
2731 uint8_t statRsn;
2732 uint8_t statBaExp;
2733 uint8_t statLocalError;
2734#else /* __LITTLE_ENDIAN_BITFIELD */
2735 uint8_t statLocalError;
2736 uint8_t statBaExp;
2737 uint8_t statRsn;
2738 uint8_t statAction;
2739#endif
2740 /* statRsn P/F_RJT reason codes */
2741#define RJT_BAD_D_ID 0x01 /* Invalid D_ID field */
2742#define RJT_BAD_S_ID 0x02 /* Invalid S_ID field */
2743#define RJT_UNAVAIL_TEMP 0x03 /* N_Port unavailable temp. */
2744#define RJT_UNAVAIL_PERM 0x04 /* N_Port unavailable perm. */
2745#define RJT_UNSUP_CLASS 0x05 /* Class not supported */
2746#define RJT_DELIM_ERR 0x06 /* Delimiter usage error */
2747#define RJT_UNSUP_TYPE 0x07 /* Type not supported */
2748#define RJT_BAD_CONTROL 0x08 /* Invalid link conrtol */
2749#define RJT_BAD_RCTL 0x09 /* R_CTL invalid */
2750#define RJT_BAD_FCTL 0x0A /* F_CTL invalid */
2751#define RJT_BAD_OXID 0x0B /* OX_ID invalid */
2752#define RJT_BAD_RXID 0x0C /* RX_ID invalid */
2753#define RJT_BAD_SEQID 0x0D /* SEQ_ID invalid */
2754#define RJT_BAD_DFCTL 0x0E /* DF_CTL invalid */
2755#define RJT_BAD_SEQCNT 0x0F /* SEQ_CNT invalid */
2756#define RJT_BAD_PARM 0x10 /* Param. field invalid */
2757#define RJT_XCHG_ERR 0x11 /* Exchange error */
2758#define RJT_PROT_ERR 0x12 /* Protocol error */
2759#define RJT_BAD_LENGTH 0x13 /* Invalid Length */
2760#define RJT_UNEXPECTED_ACK 0x14 /* Unexpected ACK */
2761#define RJT_LOGIN_REQUIRED 0x16 /* Login required */
2762#define RJT_TOO_MANY_SEQ 0x17 /* Excessive sequences */
2763#define RJT_XCHG_NOT_STRT 0x18 /* Exchange not started */
2764#define RJT_UNSUP_SEC_HDR 0x19 /* Security hdr not supported */
2765#define RJT_UNAVAIL_PATH 0x1A /* Fabric Path not available */
2766#define RJT_VENDOR_UNIQUE 0xFF /* Vendor unique error */
2767
2768#define IOERR_SUCCESS 0x00 /* statLocalError */
2769#define IOERR_MISSING_CONTINUE 0x01
2770#define IOERR_SEQUENCE_TIMEOUT 0x02
2771#define IOERR_INTERNAL_ERROR 0x03
2772#define IOERR_INVALID_RPI 0x04
2773#define IOERR_NO_XRI 0x05
2774#define IOERR_ILLEGAL_COMMAND 0x06
2775#define IOERR_XCHG_DROPPED 0x07
2776#define IOERR_ILLEGAL_FIELD 0x08
2777#define IOERR_BAD_CONTINUE 0x09
2778#define IOERR_TOO_MANY_BUFFERS 0x0A
2779#define IOERR_RCV_BUFFER_WAITING 0x0B
2780#define IOERR_NO_CONNECTION 0x0C
2781#define IOERR_TX_DMA_FAILED 0x0D
2782#define IOERR_RX_DMA_FAILED 0x0E
2783#define IOERR_ILLEGAL_FRAME 0x0F
2784#define IOERR_EXTRA_DATA 0x10
2785#define IOERR_NO_RESOURCES 0x11
2786#define IOERR_RESERVED 0x12
2787#define IOERR_ILLEGAL_LENGTH 0x13
2788#define IOERR_UNSUPPORTED_FEATURE 0x14
2789#define IOERR_ABORT_IN_PROGRESS 0x15
2790#define IOERR_ABORT_REQUESTED 0x16
2791#define IOERR_RECEIVE_BUFFER_TIMEOUT 0x17
2792#define IOERR_LOOP_OPEN_FAILURE 0x18
2793#define IOERR_RING_RESET 0x19
2794#define IOERR_LINK_DOWN 0x1A
2795#define IOERR_CORRUPTED_DATA 0x1B
2796#define IOERR_CORRUPTED_RPI 0x1C
2797#define IOERR_OUT_OF_ORDER_DATA 0x1D
2798#define IOERR_OUT_OF_ORDER_ACK 0x1E
2799#define IOERR_DUP_FRAME 0x1F
2800#define IOERR_LINK_CONTROL_FRAME 0x20 /* ACK_N received */
2801#define IOERR_BAD_HOST_ADDRESS 0x21
2802#define IOERR_RCV_HDRBUF_WAITING 0x22
2803#define IOERR_MISSING_HDR_BUFFER 0x23
2804#define IOERR_MSEQ_CHAIN_CORRUPTED 0x24
2805#define IOERR_ABORTMULT_REQUESTED 0x25
2806#define IOERR_BUFFER_SHORTAGE 0x28
2807#define IOERR_DEFAULT 0x29
2808#define IOERR_CNT 0x2A
2809
2810#define IOERR_DRVR_MASK 0x100
2811#define IOERR_SLI_DOWN 0x101 /* ulpStatus - Driver defined */
2812#define IOERR_SLI_BRESET 0x102
2813#define IOERR_SLI_ABORTED 0x103
2814} PARM_ERR;
2815
2816typedef union {
2817 struct {
2818#ifdef __BIG_ENDIAN_BITFIELD
2819 uint8_t Rctl; /* R_CTL field */
2820 uint8_t Type; /* TYPE field */
2821 uint8_t Dfctl; /* DF_CTL field */
2822 uint8_t Fctl; /* Bits 0-7 of IOCB word 5 */
2823#else /* __LITTLE_ENDIAN_BITFIELD */
2824 uint8_t Fctl; /* Bits 0-7 of IOCB word 5 */
2825 uint8_t Dfctl; /* DF_CTL field */
2826 uint8_t Type; /* TYPE field */
2827 uint8_t Rctl; /* R_CTL field */
2828#endif
2829
2830#define BC 0x02 /* Broadcast Received - Fctl */
2831#define SI 0x04 /* Sequence Initiative */
2832#define LA 0x08 /* Ignore Link Attention state */
2833#define LS 0x80 /* Last Sequence */
2834 } hcsw;
2835 uint32_t reserved;
2836} WORD5;
2837
2838/* IOCB Command template for a generic response */
2839typedef struct {
2840 uint32_t reserved[4];
2841 PARM_ERR perr;
2842} GENERIC_RSP;
2843
2844/* IOCB Command template for XMIT / XMIT_BCAST / RCV_SEQUENCE / XMIT_ELS */
2845typedef struct {
2846 struct ulp_bde xrsqbde[2];
2847 uint32_t xrsqRo; /* Starting Relative Offset */
2848 WORD5 w5; /* Header control/status word */
2849} XR_SEQ_FIELDS;
2850
2851/* IOCB Command template for ELS_REQUEST */
2852typedef struct {
2853 struct ulp_bde elsReq;
2854 struct ulp_bde elsRsp;
2855
2856#ifdef __BIG_ENDIAN_BITFIELD
2857 uint32_t word4Rsvd:7;
2858 uint32_t fl:1;
2859 uint32_t myID:24;
2860 uint32_t word5Rsvd:8;
2861 uint32_t remoteID:24;
2862#else /* __LITTLE_ENDIAN_BITFIELD */
2863 uint32_t myID:24;
2864 uint32_t fl:1;
2865 uint32_t word4Rsvd:7;
2866 uint32_t remoteID:24;
2867 uint32_t word5Rsvd:8;
2868#endif
2869} ELS_REQUEST;
2870
2871/* IOCB Command template for RCV_ELS_REQ */
2872typedef struct {
2873 struct ulp_bde elsReq[2];
2874 uint32_t parmRo;
2875
2876#ifdef __BIG_ENDIAN_BITFIELD
2877 uint32_t word5Rsvd:8;
2878 uint32_t remoteID:24;
2879#else /* __LITTLE_ENDIAN_BITFIELD */
2880 uint32_t remoteID:24;
2881 uint32_t word5Rsvd:8;
2882#endif
2883} RCV_ELS_REQ;
2884
2885/* IOCB Command template for ABORT / CLOSE_XRI */
2886typedef struct {
2887 uint32_t rsvd[3];
2888 uint32_t abortType;
2889#define ABORT_TYPE_ABTX 0x00000000
2890#define ABORT_TYPE_ABTS 0x00000001
2891 uint32_t parm;
2892#ifdef __BIG_ENDIAN_BITFIELD
2893 uint16_t abortContextTag; /* ulpContext from command to abort/close */
2894 uint16_t abortIoTag; /* ulpIoTag from command to abort/close */
2895#else /* __LITTLE_ENDIAN_BITFIELD */
2896 uint16_t abortIoTag; /* ulpIoTag from command to abort/close */
2897 uint16_t abortContextTag; /* ulpContext from command to abort/close */
2898#endif
2899} AC_XRI;
2900
2901/* IOCB Command template for ABORT_MXRI64 */
2902typedef struct {
2903 uint32_t rsvd[3];
2904 uint32_t abortType;
2905 uint32_t parm;
2906 uint32_t iotag32;
2907} A_MXRI64;
2908
2909/* IOCB Command template for GET_RPI */
2910typedef struct {
2911 uint32_t rsvd[4];
2912 uint32_t parmRo;
2913#ifdef __BIG_ENDIAN_BITFIELD
2914 uint32_t word5Rsvd:8;
2915 uint32_t remoteID:24;
2916#else /* __LITTLE_ENDIAN_BITFIELD */
2917 uint32_t remoteID:24;
2918 uint32_t word5Rsvd:8;
2919#endif
2920} GET_RPI;
2921
2922/* IOCB Command template for all FCP Initiator commands */
2923typedef struct {
2924 struct ulp_bde fcpi_cmnd; /* FCP_CMND payload descriptor */
2925 struct ulp_bde fcpi_rsp; /* Rcv buffer */
2926 uint32_t fcpi_parm;
2927 uint32_t fcpi_XRdy; /* transfer ready for IWRITE */
2928} FCPI_FIELDS;
2929
2930/* IOCB Command template for all FCP Target commands */
2931typedef struct {
2932 struct ulp_bde fcpt_Buffer[2]; /* FCP_CMND payload descriptor */
2933 uint32_t fcpt_Offset;
2934 uint32_t fcpt_Length; /* transfer ready for IWRITE */
2935} FCPT_FIELDS;
2936
2937/* SLI-2 IOCB structure definitions */
2938
2939/* IOCB Command template for 64 bit XMIT / XMIT_BCAST / XMIT_ELS */
2940typedef struct {
2941 ULP_BDL bdl;
2942 uint32_t xrsqRo; /* Starting Relative Offset */
2943 WORD5 w5; /* Header control/status word */
2944} XMT_SEQ_FIELDS64;
2945
2946/* IOCB Command template for 64 bit RCV_SEQUENCE64 */
2947typedef struct {
2948 struct ulp_bde64 rcvBde;
2949 uint32_t rsvd1;
2950 uint32_t xrsqRo; /* Starting Relative Offset */
2951 WORD5 w5; /* Header control/status word */
2952} RCV_SEQ_FIELDS64;
2953
2954/* IOCB Command template for ELS_REQUEST64 */
2955typedef struct {
2956 ULP_BDL bdl;
2957#ifdef __BIG_ENDIAN_BITFIELD
2958 uint32_t word4Rsvd:7;
2959 uint32_t fl:1;
2960 uint32_t myID:24;
2961 uint32_t word5Rsvd:8;
2962 uint32_t remoteID:24;
2963#else /* __LITTLE_ENDIAN_BITFIELD */
2964 uint32_t myID:24;
2965 uint32_t fl:1;
2966 uint32_t word4Rsvd:7;
2967 uint32_t remoteID:24;
2968 uint32_t word5Rsvd:8;
2969#endif
2970} ELS_REQUEST64;
2971
2972/* IOCB Command template for GEN_REQUEST64 */
2973typedef struct {
2974 ULP_BDL bdl;
2975 uint32_t xrsqRo; /* Starting Relative Offset */
2976 WORD5 w5; /* Header control/status word */
2977} GEN_REQUEST64;
2978
2979/* IOCB Command template for RCV_ELS_REQ64 */
2980typedef struct {
2981 struct ulp_bde64 elsReq;
2982 uint32_t rcvd1;
2983 uint32_t parmRo;
2984
2985#ifdef __BIG_ENDIAN_BITFIELD
2986 uint32_t word5Rsvd:8;
2987 uint32_t remoteID:24;
2988#else /* __LITTLE_ENDIAN_BITFIELD */
2989 uint32_t remoteID:24;
2990 uint32_t word5Rsvd:8;
2991#endif
2992} RCV_ELS_REQ64;
2993
2994/* IOCB Command template for all 64 bit FCP Initiator commands */
2995typedef struct {
2996 ULP_BDL bdl;
2997 uint32_t fcpi_parm;
2998 uint32_t fcpi_XRdy; /* transfer ready for IWRITE */
2999} FCPI_FIELDS64;
3000
3001/* IOCB Command template for all 64 bit FCP Target commands */
3002typedef struct {
3003 ULP_BDL bdl;
3004 uint32_t fcpt_Offset;
3005 uint32_t fcpt_Length; /* transfer ready for IWRITE */
3006} FCPT_FIELDS64;
3007
James Smart57127f12007-10-27 13:37:05 -04003008/* IOCB Command template for Async Status iocb commands */
3009typedef struct {
3010 uint32_t rsvd[4];
3011 uint32_t param;
3012#ifdef __BIG_ENDIAN_BITFIELD
3013 uint16_t evt_code; /* High order bits word 5 */
3014 uint16_t sub_ctxt_tag; /* Low order bits word 5 */
3015#else /* __LITTLE_ENDIAN_BITFIELD */
3016 uint16_t sub_ctxt_tag; /* High order bits word 5 */
3017 uint16_t evt_code; /* Low order bits word 5 */
3018#endif
3019} ASYNCSTAT_FIELDS;
3020#define ASYNC_TEMP_WARN 0x100
3021#define ASYNC_TEMP_SAFE 0x101
3022
James Smarted957682007-06-17 19:56:37 -05003023/* IOCB Command template for CMD_IOCB_RCV_ELS64_CX (0xB7)
3024 or CMD_IOCB_RCV_SEQ64_CX (0xB5) */
3025
3026struct rcv_sli3 {
3027 uint32_t word8Rsvd;
3028#ifdef __BIG_ENDIAN_BITFIELD
3029 uint16_t vpi;
3030 uint16_t word9Rsvd;
3031#else /* __LITTLE_ENDIAN */
3032 uint16_t word9Rsvd;
3033 uint16_t vpi;
3034#endif
3035 uint32_t word10Rsvd;
3036 uint32_t acc_len; /* accumulated length */
3037 struct ulp_bde64 bde2;
3038};
3039
James Smart92d7f7b2007-06-17 19:56:38 -05003040
3041
dea31012005-04-17 16:05:31 -05003042typedef struct _IOCB { /* IOCB structure */
3043 union {
3044 GENERIC_RSP grsp; /* Generic response */
3045 XR_SEQ_FIELDS xrseq; /* XMIT / BCAST / RCV_SEQUENCE cmd */
3046 struct ulp_bde cont[3]; /* up to 3 continuation bdes */
3047 RCV_ELS_REQ rcvels; /* RCV_ELS_REQ template */
3048 AC_XRI acxri; /* ABORT / CLOSE_XRI template */
3049 A_MXRI64 amxri; /* abort multiple xri command overlay */
3050 GET_RPI getrpi; /* GET_RPI template */
3051 FCPI_FIELDS fcpi; /* FCP Initiator template */
3052 FCPT_FIELDS fcpt; /* FCP target template */
3053
3054 /* SLI-2 structures */
3055
James Smarted957682007-06-17 19:56:37 -05003056 struct ulp_bde64 cont64[2]; /* up to 2 64 bit continuation
3057 * bde_64s */
dea31012005-04-17 16:05:31 -05003058 ELS_REQUEST64 elsreq64; /* ELS_REQUEST template */
3059 GEN_REQUEST64 genreq64; /* GEN_REQUEST template */
3060 RCV_ELS_REQ64 rcvels64; /* RCV_ELS_REQ template */
3061 XMT_SEQ_FIELDS64 xseq64; /* XMIT / BCAST cmd */
3062 FCPI_FIELDS64 fcpi64; /* FCP 64 bit Initiator template */
3063 FCPT_FIELDS64 fcpt64; /* FCP 64 bit target template */
James Smart57127f12007-10-27 13:37:05 -04003064 ASYNCSTAT_FIELDS asyncstat; /* async_status iocb */
dea31012005-04-17 16:05:31 -05003065
3066 uint32_t ulpWord[IOCB_WORD_SZ - 2]; /* generic 6 'words' */
3067 } un;
3068 union {
3069 struct {
3070#ifdef __BIG_ENDIAN_BITFIELD
3071 uint16_t ulpContext; /* High order bits word 6 */
3072 uint16_t ulpIoTag; /* Low order bits word 6 */
3073#else /* __LITTLE_ENDIAN_BITFIELD */
3074 uint16_t ulpIoTag; /* Low order bits word 6 */
3075 uint16_t ulpContext; /* High order bits word 6 */
3076#endif
3077 } t1;
3078 struct {
3079#ifdef __BIG_ENDIAN_BITFIELD
3080 uint16_t ulpContext; /* High order bits word 6 */
3081 uint16_t ulpIoTag1:2; /* Low order bits word 6 */
3082 uint16_t ulpIoTag0:14; /* Low order bits word 6 */
3083#else /* __LITTLE_ENDIAN_BITFIELD */
3084 uint16_t ulpIoTag0:14; /* Low order bits word 6 */
3085 uint16_t ulpIoTag1:2; /* Low order bits word 6 */
3086 uint16_t ulpContext; /* High order bits word 6 */
3087#endif
3088 } t2;
3089 } un1;
3090#define ulpContext un1.t1.ulpContext
3091#define ulpIoTag un1.t1.ulpIoTag
3092#define ulpIoTag0 un1.t2.ulpIoTag0
3093
3094#ifdef __BIG_ENDIAN_BITFIELD
3095 uint32_t ulpTimeout:8;
3096 uint32_t ulpXS:1;
3097 uint32_t ulpFCP2Rcvy:1;
3098 uint32_t ulpPU:2;
3099 uint32_t ulpIr:1;
3100 uint32_t ulpClass:3;
3101 uint32_t ulpCommand:8;
3102 uint32_t ulpStatus:4;
3103 uint32_t ulpBdeCount:2;
3104 uint32_t ulpLe:1;
3105 uint32_t ulpOwner:1; /* Low order bit word 7 */
3106#else /* __LITTLE_ENDIAN_BITFIELD */
3107 uint32_t ulpOwner:1; /* Low order bit word 7 */
3108 uint32_t ulpLe:1;
3109 uint32_t ulpBdeCount:2;
3110 uint32_t ulpStatus:4;
3111 uint32_t ulpCommand:8;
3112 uint32_t ulpClass:3;
3113 uint32_t ulpIr:1;
3114 uint32_t ulpPU:2;
3115 uint32_t ulpFCP2Rcvy:1;
3116 uint32_t ulpXS:1;
3117 uint32_t ulpTimeout:8;
3118#endif
James Smart92d7f7b2007-06-17 19:56:38 -05003119
James Smarted957682007-06-17 19:56:37 -05003120 union {
3121 struct rcv_sli3 rcvsli3; /* words 8 - 15 */
3122 uint32_t sli3Words[24]; /* 96 extra bytes for SLI-3 */
3123 } unsli3;
dea31012005-04-17 16:05:31 -05003124
James Smarted957682007-06-17 19:56:37 -05003125#define ulpCt_h ulpXS
3126#define ulpCt_l ulpFCP2Rcvy
3127
3128#define IOCB_FCP 1 /* IOCB is used for FCP ELS cmds-ulpRsvByte */
3129#define IOCB_IP 2 /* IOCB is used for IP ELS cmds */
dea31012005-04-17 16:05:31 -05003130#define PARM_UNUSED 0 /* PU field (Word 4) not used */
3131#define PARM_REL_OFF 1 /* PU field (Word 4) = R. O. */
3132#define PARM_READ_CHECK 2 /* PU field (Word 4) = Data Transfer Length */
James Smart92d7f7b2007-06-17 19:56:38 -05003133#define PARM_NPIV_DID 3
dea31012005-04-17 16:05:31 -05003134#define CLASS1 0 /* Class 1 */
3135#define CLASS2 1 /* Class 2 */
3136#define CLASS3 2 /* Class 3 */
3137#define CLASS_FCP_INTERMIX 7 /* FCP Data->Cls 1, all else->Cls 2 */
3138
3139#define IOSTAT_SUCCESS 0x0 /* ulpStatus - HBA defined */
3140#define IOSTAT_FCP_RSP_ERROR 0x1
3141#define IOSTAT_REMOTE_STOP 0x2
3142#define IOSTAT_LOCAL_REJECT 0x3
3143#define IOSTAT_NPORT_RJT 0x4
3144#define IOSTAT_FABRIC_RJT 0x5
3145#define IOSTAT_NPORT_BSY 0x6
3146#define IOSTAT_FABRIC_BSY 0x7
3147#define IOSTAT_INTERMED_RSP 0x8
3148#define IOSTAT_LS_RJT 0x9
3149#define IOSTAT_BA_RJT 0xA
3150#define IOSTAT_RSVD1 0xB
3151#define IOSTAT_RSVD2 0xC
3152#define IOSTAT_RSVD3 0xD
3153#define IOSTAT_RSVD4 0xE
James Smart92d7f7b2007-06-17 19:56:38 -05003154#define IOSTAT_NEED_BUFFER 0xF
dea31012005-04-17 16:05:31 -05003155#define IOSTAT_DRIVER_REJECT 0x10 /* ulpStatus - Driver defined */
3156#define IOSTAT_DEFAULT 0xF /* Same as rsvd5 for now */
3157#define IOSTAT_CNT 0x11
3158
3159} IOCB_t;
3160
James Smarted957682007-06-17 19:56:37 -05003161/* Structure used for a single HBQ entry */
3162struct lpfc_hbq_entry {
3163 struct ulp_bde64 bde;
3164 uint32_t buffer_tag;
3165};
3166
dea31012005-04-17 16:05:31 -05003167
3168#define SLI1_SLIM_SIZE (4 * 1024)
3169
3170/* Up to 498 IOCBs will fit into 16k
3171 * 256 (MAILBOX_t) + 140 (PCB_t) + ( 32 (IOCB_t) * 498 ) = < 16384
3172 */
James Smarted957682007-06-17 19:56:37 -05003173#define SLI2_SLIM_SIZE (64 * 1024)
dea31012005-04-17 16:05:31 -05003174
3175/* Maximum IOCBs that will fit in SLI2 slim */
3176#define MAX_SLI2_IOCB 498
James Smarted957682007-06-17 19:56:37 -05003177#define MAX_SLIM_IOCB_SIZE (SLI2_SLIM_SIZE - \
3178 (sizeof(MAILBOX_t) + sizeof(PCB_t)))
3179
3180/* HBQ entries are 4 words each = 4k */
3181#define LPFC_TOTAL_HBQ_SIZE (sizeof(struct lpfc_hbq_entry) * \
3182 lpfc_sli_hbq_count())
dea31012005-04-17 16:05:31 -05003183
3184struct lpfc_sli2_slim {
3185 MAILBOX_t mbx;
3186 PCB_t pcb;
James Smarted957682007-06-17 19:56:37 -05003187 IOCB_t IOCBs[MAX_SLIM_IOCB_SIZE];
dea31012005-04-17 16:05:31 -05003188};
3189
James Smart2e0fef82007-06-17 19:56:36 -05003190/*
3191 * This function checks PCI device to allow special handling for LC HBAs.
3192 *
3193 * Parameters:
3194 * device : struct pci_dev 's device field
3195 *
3196 * return 1 => TRUE
3197 * 0 => FALSE
3198 */
dea31012005-04-17 16:05:31 -05003199static inline int
3200lpfc_is_LC_HBA(unsigned short device)
3201{
3202 if ((device == PCI_DEVICE_ID_TFLY) ||
3203 (device == PCI_DEVICE_ID_PFLY) ||
3204 (device == PCI_DEVICE_ID_LP101) ||
3205 (device == PCI_DEVICE_ID_BMID) ||
3206 (device == PCI_DEVICE_ID_BSMB) ||
3207 (device == PCI_DEVICE_ID_ZMID) ||
3208 (device == PCI_DEVICE_ID_ZSMB) ||
3209 (device == PCI_DEVICE_ID_RFLY))
3210 return 1;
3211 else
3212 return 0;
3213}
James Smart858c9f62007-06-17 19:56:39 -05003214
3215/*
3216 * Determine if an IOCB failed because of a link event or firmware reset.
3217 */
3218
3219static inline int
3220lpfc_error_lost_link(IOCB_t *iocbp)
3221{
3222 return (iocbp->ulpStatus == IOSTAT_LOCAL_REJECT &&
3223 (iocbp->un.ulpWord[4] == IOERR_SLI_ABORTED ||
3224 iocbp->un.ulpWord[4] == IOERR_LINK_DOWN ||
3225 iocbp->un.ulpWord[4] == IOERR_SLI_DOWN));
3226}