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