lpfc_hw.h 76 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687
  1. /*******************************************************************
  2. * This file is part of the Emulex Linux Device Driver for *
  3. * Enterprise Fibre Channel Host Bus Adapters. *
  4. * Refer to the README file included with this package for *
  5. * driver version and adapter support. *
  6. * Copyright (C) 2004 Emulex Corporation. *
  7. * www.emulex.com *
  8. * *
  9. * This program is free software; you can redistribute it and/or *
  10. * modify it under the terms of the GNU General Public License *
  11. * as published by the Free Software Foundation; either version 2 *
  12. * of the License, or (at your option) any later version. *
  13. * *
  14. * This program is distributed in the hope that it will be useful, *
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  17. * GNU General Public License for more details, a copy of which *
  18. * can be found in the file COPYING included with this package. *
  19. *******************************************************************/
  20. /*
  21. * $Id: lpfc_hw.h 1.37 2005/03/29 19:51:45EST sf_support Exp $
  22. */
  23. #define FDMI_DID 0xfffffaU
  24. #define NameServer_DID 0xfffffcU
  25. #define SCR_DID 0xfffffdU
  26. #define Fabric_DID 0xfffffeU
  27. #define Bcast_DID 0xffffffU
  28. #define Mask_DID 0xffffffU
  29. #define CT_DID_MASK 0xffff00U
  30. #define Fabric_DID_MASK 0xfff000U
  31. #define WELL_KNOWN_DID_MASK 0xfffff0U
  32. #define PT2PT_LocalID 1
  33. #define PT2PT_RemoteID 2
  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. #define LPFC_BUF_RING0 64 /* Number of buffers to post to RING
  39. 0 */
  40. #define FCELSSIZE 1024 /* maximum ELS transfer size */
  41. #define LPFC_FCP_RING 0 /* ring 0 for FCP initiator commands */
  42. #define LPFC_IP_RING 1 /* ring 1 for IP commands */
  43. #define LPFC_ELS_RING 2 /* ring 2 for ELS commands */
  44. #define LPFC_FCP_NEXT_RING 3
  45. #define SLI2_IOCB_CMD_R0_ENTRIES 172 /* SLI-2 FCP command ring entries */
  46. #define SLI2_IOCB_RSP_R0_ENTRIES 134 /* SLI-2 FCP response ring entries */
  47. #define SLI2_IOCB_CMD_R1_ENTRIES 4 /* SLI-2 IP command ring entries */
  48. #define SLI2_IOCB_RSP_R1_ENTRIES 4 /* SLI-2 IP response ring entries */
  49. #define SLI2_IOCB_CMD_R1XTRA_ENTRIES 36 /* SLI-2 extra FCP cmd ring entries */
  50. #define SLI2_IOCB_RSP_R1XTRA_ENTRIES 52 /* SLI-2 extra FCP rsp ring entries */
  51. #define SLI2_IOCB_CMD_R2_ENTRIES 20 /* SLI-2 ELS command ring entries */
  52. #define SLI2_IOCB_RSP_R2_ENTRIES 20 /* SLI-2 ELS response ring entries */
  53. #define SLI2_IOCB_CMD_R3_ENTRIES 0
  54. #define SLI2_IOCB_RSP_R3_ENTRIES 0
  55. #define SLI2_IOCB_CMD_R3XTRA_ENTRIES 24
  56. #define SLI2_IOCB_RSP_R3XTRA_ENTRIES 32
  57. /* Common Transport structures and definitions */
  58. union CtRevisionId {
  59. /* Structure is in Big Endian format */
  60. struct {
  61. uint32_t Revision:8;
  62. uint32_t InId:24;
  63. } bits;
  64. uint32_t word;
  65. };
  66. union CtCommandResponse {
  67. /* Structure is in Big Endian format */
  68. struct {
  69. uint32_t CmdRsp:16;
  70. uint32_t Size:16;
  71. } bits;
  72. uint32_t word;
  73. };
  74. struct lpfc_sli_ct_request {
  75. /* Structure is in Big Endian format */
  76. union CtRevisionId RevisionId;
  77. uint8_t FsType;
  78. uint8_t FsSubType;
  79. uint8_t Options;
  80. uint8_t Rsrvd1;
  81. union CtCommandResponse CommandResponse;
  82. uint8_t Rsrvd2;
  83. uint8_t ReasonCode;
  84. uint8_t Explanation;
  85. uint8_t VendorUnique;
  86. union {
  87. uint32_t PortID;
  88. struct gid {
  89. uint8_t PortType; /* for GID_PT requests */
  90. uint8_t DomainScope;
  91. uint8_t AreaScope;
  92. uint8_t Fc4Type; /* for GID_FT requests */
  93. } gid;
  94. struct rft {
  95. uint32_t PortId; /* For RFT_ID requests */
  96. #ifdef __BIG_ENDIAN_BITFIELD
  97. uint32_t rsvd0:16;
  98. uint32_t rsvd1:7;
  99. uint32_t fcpReg:1; /* Type 8 */
  100. uint32_t rsvd2:2;
  101. uint32_t ipReg:1; /* Type 5 */
  102. uint32_t rsvd3:5;
  103. #else /* __LITTLE_ENDIAN_BITFIELD */
  104. uint32_t rsvd0:16;
  105. uint32_t fcpReg:1; /* Type 8 */
  106. uint32_t rsvd1:7;
  107. uint32_t rsvd3:5;
  108. uint32_t ipReg:1; /* Type 5 */
  109. uint32_t rsvd2:2;
  110. #endif
  111. uint32_t rsvd[7];
  112. } rft;
  113. struct rnn {
  114. uint32_t PortId; /* For RNN_ID requests */
  115. uint8_t wwnn[8];
  116. } rnn;
  117. struct rsnn { /* For RSNN_ID requests */
  118. uint8_t wwnn[8];
  119. uint8_t len;
  120. uint8_t symbname[255];
  121. } rsnn;
  122. } un;
  123. };
  124. #define SLI_CT_REVISION 1
  125. #define GID_REQUEST_SZ (sizeof(struct lpfc_sli_ct_request) - 260)
  126. #define RFT_REQUEST_SZ (sizeof(struct lpfc_sli_ct_request) - 228)
  127. #define RNN_REQUEST_SZ (sizeof(struct lpfc_sli_ct_request) - 252)
  128. #define RSNN_REQUEST_SZ (sizeof(struct lpfc_sli_ct_request))
  129. /*
  130. * FsType Definitions
  131. */
  132. #define SLI_CT_MANAGEMENT_SERVICE 0xFA
  133. #define SLI_CT_TIME_SERVICE 0xFB
  134. #define SLI_CT_DIRECTORY_SERVICE 0xFC
  135. #define SLI_CT_FABRIC_CONTROLLER_SERVICE 0xFD
  136. /*
  137. * Directory Service Subtypes
  138. */
  139. #define SLI_CT_DIRECTORY_NAME_SERVER 0x02
  140. /*
  141. * Response Codes
  142. */
  143. #define SLI_CT_RESPONSE_FS_RJT 0x8001
  144. #define SLI_CT_RESPONSE_FS_ACC 0x8002
  145. /*
  146. * Reason Codes
  147. */
  148. #define SLI_CT_NO_ADDITIONAL_EXPL 0x0
  149. #define SLI_CT_INVALID_COMMAND 0x01
  150. #define SLI_CT_INVALID_VERSION 0x02
  151. #define SLI_CT_LOGICAL_ERROR 0x03
  152. #define SLI_CT_INVALID_IU_SIZE 0x04
  153. #define SLI_CT_LOGICAL_BUSY 0x05
  154. #define SLI_CT_PROTOCOL_ERROR 0x07
  155. #define SLI_CT_UNABLE_TO_PERFORM_REQ 0x09
  156. #define SLI_CT_REQ_NOT_SUPPORTED 0x0b
  157. #define SLI_CT_HBA_INFO_NOT_REGISTERED 0x10
  158. #define SLI_CT_MULTIPLE_HBA_ATTR_OF_SAME_TYPE 0x11
  159. #define SLI_CT_INVALID_HBA_ATTR_BLOCK_LEN 0x12
  160. #define SLI_CT_HBA_ATTR_NOT_PRESENT 0x13
  161. #define SLI_CT_PORT_INFO_NOT_REGISTERED 0x20
  162. #define SLI_CT_MULTIPLE_PORT_ATTR_OF_SAME_TYPE 0x21
  163. #define SLI_CT_INVALID_PORT_ATTR_BLOCK_LEN 0x22
  164. #define SLI_CT_VENDOR_UNIQUE 0xff
  165. /*
  166. * Name Server SLI_CT_UNABLE_TO_PERFORM_REQ Explanations
  167. */
  168. #define SLI_CT_NO_PORT_ID 0x01
  169. #define SLI_CT_NO_PORT_NAME 0x02
  170. #define SLI_CT_NO_NODE_NAME 0x03
  171. #define SLI_CT_NO_CLASS_OF_SERVICE 0x04
  172. #define SLI_CT_NO_IP_ADDRESS 0x05
  173. #define SLI_CT_NO_IPA 0x06
  174. #define SLI_CT_NO_FC4_TYPES 0x07
  175. #define SLI_CT_NO_SYMBOLIC_PORT_NAME 0x08
  176. #define SLI_CT_NO_SYMBOLIC_NODE_NAME 0x09
  177. #define SLI_CT_NO_PORT_TYPE 0x0A
  178. #define SLI_CT_ACCESS_DENIED 0x10
  179. #define SLI_CT_INVALID_PORT_ID 0x11
  180. #define SLI_CT_DATABASE_EMPTY 0x12
  181. /*
  182. * Name Server Command Codes
  183. */
  184. #define SLI_CTNS_GA_NXT 0x0100
  185. #define SLI_CTNS_GPN_ID 0x0112
  186. #define SLI_CTNS_GNN_ID 0x0113
  187. #define SLI_CTNS_GCS_ID 0x0114
  188. #define SLI_CTNS_GFT_ID 0x0117
  189. #define SLI_CTNS_GSPN_ID 0x0118
  190. #define SLI_CTNS_GPT_ID 0x011A
  191. #define SLI_CTNS_GID_PN 0x0121
  192. #define SLI_CTNS_GID_NN 0x0131
  193. #define SLI_CTNS_GIP_NN 0x0135
  194. #define SLI_CTNS_GIPA_NN 0x0136
  195. #define SLI_CTNS_GSNN_NN 0x0139
  196. #define SLI_CTNS_GNN_IP 0x0153
  197. #define SLI_CTNS_GIPA_IP 0x0156
  198. #define SLI_CTNS_GID_FT 0x0171
  199. #define SLI_CTNS_GID_PT 0x01A1
  200. #define SLI_CTNS_RPN_ID 0x0212
  201. #define SLI_CTNS_RNN_ID 0x0213
  202. #define SLI_CTNS_RCS_ID 0x0214
  203. #define SLI_CTNS_RFT_ID 0x0217
  204. #define SLI_CTNS_RSPN_ID 0x0218
  205. #define SLI_CTNS_RPT_ID 0x021A
  206. #define SLI_CTNS_RIP_NN 0x0235
  207. #define SLI_CTNS_RIPA_NN 0x0236
  208. #define SLI_CTNS_RSNN_NN 0x0239
  209. #define SLI_CTNS_DA_ID 0x0300
  210. /*
  211. * Port Types
  212. */
  213. #define SLI_CTPT_N_PORT 0x01
  214. #define SLI_CTPT_NL_PORT 0x02
  215. #define SLI_CTPT_FNL_PORT 0x03
  216. #define SLI_CTPT_IP 0x04
  217. #define SLI_CTPT_FCP 0x08
  218. #define SLI_CTPT_NX_PORT 0x7F
  219. #define SLI_CTPT_F_PORT 0x81
  220. #define SLI_CTPT_FL_PORT 0x82
  221. #define SLI_CTPT_E_PORT 0x84
  222. #define SLI_CT_LAST_ENTRY 0x80000000
  223. /* Fibre Channel Service Parameter definitions */
  224. #define FC_PH_4_0 6 /* FC-PH version 4.0 */
  225. #define FC_PH_4_1 7 /* FC-PH version 4.1 */
  226. #define FC_PH_4_2 8 /* FC-PH version 4.2 */
  227. #define FC_PH_4_3 9 /* FC-PH version 4.3 */
  228. #define FC_PH_LOW 8 /* Lowest supported FC-PH version */
  229. #define FC_PH_HIGH 9 /* Highest supported FC-PH version */
  230. #define FC_PH3 0x20 /* FC-PH-3 version */
  231. #define FF_FRAME_SIZE 2048
  232. struct lpfc_name {
  233. #ifdef __BIG_ENDIAN_BITFIELD
  234. uint8_t nameType:4; /* FC Word 0, bit 28:31 */
  235. uint8_t IEEEextMsn:4; /* FC Word 0, bit 24:27, bit 8:11 of IEEE ext */
  236. #else /* __LITTLE_ENDIAN_BITFIELD */
  237. uint8_t IEEEextMsn:4; /* FC Word 0, bit 24:27, bit 8:11 of IEEE ext */
  238. uint8_t nameType:4; /* FC Word 0, bit 28:31 */
  239. #endif
  240. #define NAME_IEEE 0x1 /* IEEE name - nameType */
  241. #define NAME_IEEE_EXT 0x2 /* IEEE extended name */
  242. #define NAME_FC_TYPE 0x3 /* FC native name type */
  243. #define NAME_IP_TYPE 0x4 /* IP address */
  244. #define NAME_CCITT_TYPE 0xC
  245. #define NAME_CCITT_GR_TYPE 0xE
  246. uint8_t IEEEextLsb; /* FC Word 0, bit 16:23, IEEE extended Lsb */
  247. uint8_t IEEE[6]; /* FC IEEE address */
  248. };
  249. struct csp {
  250. uint8_t fcphHigh; /* FC Word 0, byte 0 */
  251. uint8_t fcphLow;
  252. uint8_t bbCreditMsb;
  253. uint8_t bbCreditlsb; /* FC Word 0, byte 3 */
  254. #ifdef __BIG_ENDIAN_BITFIELD
  255. uint16_t increasingOffset:1; /* FC Word 1, bit 31 */
  256. uint16_t randomOffset:1; /* FC Word 1, bit 30 */
  257. uint16_t word1Reserved2:1; /* FC Word 1, bit 29 */
  258. uint16_t fPort:1; /* FC Word 1, bit 28 */
  259. uint16_t altBbCredit:1; /* FC Word 1, bit 27 */
  260. uint16_t edtovResolution:1; /* FC Word 1, bit 26 */
  261. uint16_t multicast:1; /* FC Word 1, bit 25 */
  262. uint16_t broadcast:1; /* FC Word 1, bit 24 */
  263. uint16_t huntgroup:1; /* FC Word 1, bit 23 */
  264. uint16_t simplex:1; /* FC Word 1, bit 22 */
  265. uint16_t word1Reserved1:3; /* FC Word 1, bit 21:19 */
  266. uint16_t dhd:1; /* FC Word 1, bit 18 */
  267. uint16_t contIncSeqCnt:1; /* FC Word 1, bit 17 */
  268. uint16_t payloadlength:1; /* FC Word 1, bit 16 */
  269. #else /* __LITTLE_ENDIAN_BITFIELD */
  270. uint16_t broadcast:1; /* FC Word 1, bit 24 */
  271. uint16_t multicast:1; /* FC Word 1, bit 25 */
  272. uint16_t edtovResolution:1; /* FC Word 1, bit 26 */
  273. uint16_t altBbCredit:1; /* FC Word 1, bit 27 */
  274. uint16_t fPort:1; /* FC Word 1, bit 28 */
  275. uint16_t word1Reserved2:1; /* FC Word 1, bit 29 */
  276. uint16_t randomOffset:1; /* FC Word 1, bit 30 */
  277. uint16_t increasingOffset:1; /* FC Word 1, bit 31 */
  278. uint16_t payloadlength:1; /* FC Word 1, bit 16 */
  279. uint16_t contIncSeqCnt:1; /* FC Word 1, bit 17 */
  280. uint16_t dhd:1; /* FC Word 1, bit 18 */
  281. uint16_t word1Reserved1:3; /* FC Word 1, bit 21:19 */
  282. uint16_t simplex:1; /* FC Word 1, bit 22 */
  283. uint16_t huntgroup:1; /* FC Word 1, bit 23 */
  284. #endif
  285. uint8_t bbRcvSizeMsb; /* Upper nibble is reserved */
  286. uint8_t bbRcvSizeLsb; /* FC Word 1, byte 3 */
  287. union {
  288. struct {
  289. uint8_t word2Reserved1; /* FC Word 2 byte 0 */
  290. uint8_t totalConcurrSeq; /* FC Word 2 byte 1 */
  291. uint8_t roByCategoryMsb; /* FC Word 2 byte 2 */
  292. uint8_t roByCategoryLsb; /* FC Word 2 byte 3 */
  293. } nPort;
  294. uint32_t r_a_tov; /* R_A_TOV must be in B.E. format */
  295. } w2;
  296. uint32_t e_d_tov; /* E_D_TOV must be in B.E. format */
  297. };
  298. struct class_parms {
  299. #ifdef __BIG_ENDIAN_BITFIELD
  300. uint8_t classValid:1; /* FC Word 0, bit 31 */
  301. uint8_t intermix:1; /* FC Word 0, bit 30 */
  302. uint8_t stackedXparent:1; /* FC Word 0, bit 29 */
  303. uint8_t stackedLockDown:1; /* FC Word 0, bit 28 */
  304. uint8_t seqDelivery:1; /* FC Word 0, bit 27 */
  305. uint8_t word0Reserved1:3; /* FC Word 0, bit 24:26 */
  306. #else /* __LITTLE_ENDIAN_BITFIELD */
  307. uint8_t word0Reserved1:3; /* FC Word 0, bit 24:26 */
  308. uint8_t seqDelivery:1; /* FC Word 0, bit 27 */
  309. uint8_t stackedLockDown:1; /* FC Word 0, bit 28 */
  310. uint8_t stackedXparent:1; /* FC Word 0, bit 29 */
  311. uint8_t intermix:1; /* FC Word 0, bit 30 */
  312. uint8_t classValid:1; /* FC Word 0, bit 31 */
  313. #endif
  314. uint8_t word0Reserved2; /* FC Word 0, bit 16:23 */
  315. #ifdef __BIG_ENDIAN_BITFIELD
  316. uint8_t iCtlXidReAssgn:2; /* FC Word 0, Bit 14:15 */
  317. uint8_t iCtlInitialPa:2; /* FC Word 0, bit 12:13 */
  318. uint8_t iCtlAck0capable:1; /* FC Word 0, bit 11 */
  319. uint8_t iCtlAckNcapable:1; /* FC Word 0, bit 10 */
  320. uint8_t word0Reserved3:2; /* FC Word 0, bit 8: 9 */
  321. #else /* __LITTLE_ENDIAN_BITFIELD */
  322. uint8_t word0Reserved3:2; /* FC Word 0, bit 8: 9 */
  323. uint8_t iCtlAckNcapable:1; /* FC Word 0, bit 10 */
  324. uint8_t iCtlAck0capable:1; /* FC Word 0, bit 11 */
  325. uint8_t iCtlInitialPa:2; /* FC Word 0, bit 12:13 */
  326. uint8_t iCtlXidReAssgn:2; /* FC Word 0, Bit 14:15 */
  327. #endif
  328. uint8_t word0Reserved4; /* FC Word 0, bit 0: 7 */
  329. #ifdef __BIG_ENDIAN_BITFIELD
  330. uint8_t rCtlAck0capable:1; /* FC Word 1, bit 31 */
  331. uint8_t rCtlAckNcapable:1; /* FC Word 1, bit 30 */
  332. uint8_t rCtlXidInterlck:1; /* FC Word 1, bit 29 */
  333. uint8_t rCtlErrorPolicy:2; /* FC Word 1, bit 27:28 */
  334. uint8_t word1Reserved1:1; /* FC Word 1, bit 26 */
  335. uint8_t rCtlCatPerSeq:2; /* FC Word 1, bit 24:25 */
  336. #else /* __LITTLE_ENDIAN_BITFIELD */
  337. uint8_t rCtlCatPerSeq:2; /* FC Word 1, bit 24:25 */
  338. uint8_t word1Reserved1:1; /* FC Word 1, bit 26 */
  339. uint8_t rCtlErrorPolicy:2; /* FC Word 1, bit 27:28 */
  340. uint8_t rCtlXidInterlck:1; /* FC Word 1, bit 29 */
  341. uint8_t rCtlAckNcapable:1; /* FC Word 1, bit 30 */
  342. uint8_t rCtlAck0capable:1; /* FC Word 1, bit 31 */
  343. #endif
  344. uint8_t word1Reserved2; /* FC Word 1, bit 16:23 */
  345. uint8_t rcvDataSizeMsb; /* FC Word 1, bit 8:15 */
  346. uint8_t rcvDataSizeLsb; /* FC Word 1, bit 0: 7 */
  347. uint8_t concurrentSeqMsb; /* FC Word 2, bit 24:31 */
  348. uint8_t concurrentSeqLsb; /* FC Word 2, bit 16:23 */
  349. uint8_t EeCreditSeqMsb; /* FC Word 2, bit 8:15 */
  350. uint8_t EeCreditSeqLsb; /* FC Word 2, bit 0: 7 */
  351. uint8_t openSeqPerXchgMsb; /* FC Word 3, bit 24:31 */
  352. uint8_t openSeqPerXchgLsb; /* FC Word 3, bit 16:23 */
  353. uint8_t word3Reserved1; /* Fc Word 3, bit 8:15 */
  354. uint8_t word3Reserved2; /* Fc Word 3, bit 0: 7 */
  355. };
  356. struct serv_parm { /* Structure is in Big Endian format */
  357. struct csp cmn;
  358. struct lpfc_name portName;
  359. struct lpfc_name nodeName;
  360. struct class_parms cls1;
  361. struct class_parms cls2;
  362. struct class_parms cls3;
  363. struct class_parms cls4;
  364. uint8_t vendorVersion[16];
  365. };
  366. /*
  367. * Extended Link Service LS_COMMAND codes (Payload Word 0)
  368. */
  369. #ifdef __BIG_ENDIAN_BITFIELD
  370. #define ELS_CMD_MASK 0xffff0000
  371. #define ELS_RSP_MASK 0xff000000
  372. #define ELS_CMD_LS_RJT 0x01000000
  373. #define ELS_CMD_ACC 0x02000000
  374. #define ELS_CMD_PLOGI 0x03000000
  375. #define ELS_CMD_FLOGI 0x04000000
  376. #define ELS_CMD_LOGO 0x05000000
  377. #define ELS_CMD_ABTX 0x06000000
  378. #define ELS_CMD_RCS 0x07000000
  379. #define ELS_CMD_RES 0x08000000
  380. #define ELS_CMD_RSS 0x09000000
  381. #define ELS_CMD_RSI 0x0A000000
  382. #define ELS_CMD_ESTS 0x0B000000
  383. #define ELS_CMD_ESTC 0x0C000000
  384. #define ELS_CMD_ADVC 0x0D000000
  385. #define ELS_CMD_RTV 0x0E000000
  386. #define ELS_CMD_RLS 0x0F000000
  387. #define ELS_CMD_ECHO 0x10000000
  388. #define ELS_CMD_TEST 0x11000000
  389. #define ELS_CMD_RRQ 0x12000000
  390. #define ELS_CMD_PRLI 0x20100014
  391. #define ELS_CMD_PRLO 0x21100014
  392. #define ELS_CMD_PDISC 0x50000000
  393. #define ELS_CMD_FDISC 0x51000000
  394. #define ELS_CMD_ADISC 0x52000000
  395. #define ELS_CMD_FARP 0x54000000
  396. #define ELS_CMD_FARPR 0x55000000
  397. #define ELS_CMD_FAN 0x60000000
  398. #define ELS_CMD_RSCN 0x61040000
  399. #define ELS_CMD_SCR 0x62000000
  400. #define ELS_CMD_RNID 0x78000000
  401. #else /* __LITTLE_ENDIAN_BITFIELD */
  402. #define ELS_CMD_MASK 0xffff
  403. #define ELS_RSP_MASK 0xff
  404. #define ELS_CMD_LS_RJT 0x01
  405. #define ELS_CMD_ACC 0x02
  406. #define ELS_CMD_PLOGI 0x03
  407. #define ELS_CMD_FLOGI 0x04
  408. #define ELS_CMD_LOGO 0x05
  409. #define ELS_CMD_ABTX 0x06
  410. #define ELS_CMD_RCS 0x07
  411. #define ELS_CMD_RES 0x08
  412. #define ELS_CMD_RSS 0x09
  413. #define ELS_CMD_RSI 0x0A
  414. #define ELS_CMD_ESTS 0x0B
  415. #define ELS_CMD_ESTC 0x0C
  416. #define ELS_CMD_ADVC 0x0D
  417. #define ELS_CMD_RTV 0x0E
  418. #define ELS_CMD_RLS 0x0F
  419. #define ELS_CMD_ECHO 0x10
  420. #define ELS_CMD_TEST 0x11
  421. #define ELS_CMD_RRQ 0x12
  422. #define ELS_CMD_PRLI 0x14001020
  423. #define ELS_CMD_PRLO 0x14001021
  424. #define ELS_CMD_PDISC 0x50
  425. #define ELS_CMD_FDISC 0x51
  426. #define ELS_CMD_ADISC 0x52
  427. #define ELS_CMD_FARP 0x54
  428. #define ELS_CMD_FARPR 0x55
  429. #define ELS_CMD_FAN 0x60
  430. #define ELS_CMD_RSCN 0x0461
  431. #define ELS_CMD_SCR 0x62
  432. #define ELS_CMD_RNID 0x78
  433. #endif
  434. /*
  435. * LS_RJT Payload Definition
  436. */
  437. struct ls_rjt { /* Structure is in Big Endian format */
  438. union {
  439. uint32_t lsRjtError;
  440. struct {
  441. uint8_t lsRjtRsvd0; /* FC Word 0, bit 24:31 */
  442. uint8_t lsRjtRsnCode; /* FC Word 0, bit 16:23 */
  443. /* LS_RJT reason codes */
  444. #define LSRJT_INVALID_CMD 0x01
  445. #define LSRJT_LOGICAL_ERR 0x03
  446. #define LSRJT_LOGICAL_BSY 0x05
  447. #define LSRJT_PROTOCOL_ERR 0x07
  448. #define LSRJT_UNABLE_TPC 0x09 /* Unable to perform command */
  449. #define LSRJT_CMD_UNSUPPORTED 0x0B
  450. #define LSRJT_VENDOR_UNIQUE 0xFF /* See Byte 3 */
  451. uint8_t lsRjtRsnCodeExp; /* FC Word 0, bit 8:15 */
  452. /* LS_RJT reason explanation */
  453. #define LSEXP_NOTHING_MORE 0x00
  454. #define LSEXP_SPARM_OPTIONS 0x01
  455. #define LSEXP_SPARM_ICTL 0x03
  456. #define LSEXP_SPARM_RCTL 0x05
  457. #define LSEXP_SPARM_RCV_SIZE 0x07
  458. #define LSEXP_SPARM_CONCUR_SEQ 0x09
  459. #define LSEXP_SPARM_CREDIT 0x0B
  460. #define LSEXP_INVALID_PNAME 0x0D
  461. #define LSEXP_INVALID_NNAME 0x0E
  462. #define LSEXP_INVALID_CSP 0x0F
  463. #define LSEXP_INVALID_ASSOC_HDR 0x11
  464. #define LSEXP_ASSOC_HDR_REQ 0x13
  465. #define LSEXP_INVALID_O_SID 0x15
  466. #define LSEXP_INVALID_OX_RX 0x17
  467. #define LSEXP_CMD_IN_PROGRESS 0x19
  468. #define LSEXP_INVALID_NPORT_ID 0x1F
  469. #define LSEXP_INVALID_SEQ_ID 0x21
  470. #define LSEXP_INVALID_XCHG 0x23
  471. #define LSEXP_INACTIVE_XCHG 0x25
  472. #define LSEXP_RQ_REQUIRED 0x27
  473. #define LSEXP_OUT_OF_RESOURCE 0x29
  474. #define LSEXP_CANT_GIVE_DATA 0x2A
  475. #define LSEXP_REQ_UNSUPPORTED 0x2C
  476. uint8_t vendorUnique; /* FC Word 0, bit 0: 7 */
  477. } b;
  478. } un;
  479. };
  480. /*
  481. * N_Port Login (FLOGO/PLOGO Request) Payload Definition
  482. */
  483. typedef struct _LOGO { /* Structure is in Big Endian format */
  484. union {
  485. uint32_t nPortId32; /* Access nPortId as a word */
  486. struct {
  487. uint8_t word1Reserved1; /* FC Word 1, bit 31:24 */
  488. uint8_t nPortIdByte0; /* N_port ID bit 16:23 */
  489. uint8_t nPortIdByte1; /* N_port ID bit 8:15 */
  490. uint8_t nPortIdByte2; /* N_port ID bit 0: 7 */
  491. } b;
  492. } un;
  493. struct lpfc_name portName; /* N_port name field */
  494. } LOGO;
  495. /*
  496. * FCP Login (PRLI Request / ACC) Payload Definition
  497. */
  498. #define PRLX_PAGE_LEN 0x10
  499. #define TPRLO_PAGE_LEN 0x14
  500. typedef struct _PRLI { /* Structure is in Big Endian format */
  501. uint8_t prliType; /* FC Parm Word 0, bit 24:31 */
  502. #define PRLI_FCP_TYPE 0x08
  503. uint8_t word0Reserved1; /* FC Parm Word 0, bit 16:23 */
  504. #ifdef __BIG_ENDIAN_BITFIELD
  505. uint8_t origProcAssocV:1; /* FC Parm Word 0, bit 15 */
  506. uint8_t respProcAssocV:1; /* FC Parm Word 0, bit 14 */
  507. uint8_t estabImagePair:1; /* FC Parm Word 0, bit 13 */
  508. /* ACC = imagePairEstablished */
  509. uint8_t word0Reserved2:1; /* FC Parm Word 0, bit 12 */
  510. uint8_t acceptRspCode:4; /* FC Parm Word 0, bit 8:11, ACC ONLY */
  511. #else /* __LITTLE_ENDIAN_BITFIELD */
  512. uint8_t acceptRspCode:4; /* FC Parm Word 0, bit 8:11, ACC ONLY */
  513. uint8_t word0Reserved2:1; /* FC Parm Word 0, bit 12 */
  514. uint8_t estabImagePair:1; /* FC Parm Word 0, bit 13 */
  515. uint8_t respProcAssocV:1; /* FC Parm Word 0, bit 14 */
  516. uint8_t origProcAssocV:1; /* FC Parm Word 0, bit 15 */
  517. /* ACC = imagePairEstablished */
  518. #endif
  519. #define PRLI_REQ_EXECUTED 0x1 /* acceptRspCode */
  520. #define PRLI_NO_RESOURCES 0x2
  521. #define PRLI_INIT_INCOMPLETE 0x3
  522. #define PRLI_NO_SUCH_PA 0x4
  523. #define PRLI_PREDEF_CONFIG 0x5
  524. #define PRLI_PARTIAL_SUCCESS 0x6
  525. #define PRLI_INVALID_PAGE_CNT 0x7
  526. uint8_t word0Reserved3; /* FC Parm Word 0, bit 0:7 */
  527. uint32_t origProcAssoc; /* FC Parm Word 1, bit 0:31 */
  528. uint32_t respProcAssoc; /* FC Parm Word 2, bit 0:31 */
  529. uint8_t word3Reserved1; /* FC Parm Word 3, bit 24:31 */
  530. uint8_t word3Reserved2; /* FC Parm Word 3, bit 16:23 */
  531. #ifdef __BIG_ENDIAN_BITFIELD
  532. uint16_t Word3bit15Resved:1; /* FC Parm Word 3, bit 15 */
  533. uint16_t Word3bit14Resved:1; /* FC Parm Word 3, bit 14 */
  534. uint16_t Word3bit13Resved:1; /* FC Parm Word 3, bit 13 */
  535. uint16_t Word3bit12Resved:1; /* FC Parm Word 3, bit 12 */
  536. uint16_t Word3bit11Resved:1; /* FC Parm Word 3, bit 11 */
  537. uint16_t Word3bit10Resved:1; /* FC Parm Word 3, bit 10 */
  538. uint16_t TaskRetryIdReq:1; /* FC Parm Word 3, bit 9 */
  539. uint16_t Retry:1; /* FC Parm Word 3, bit 8 */
  540. uint16_t ConfmComplAllowed:1; /* FC Parm Word 3, bit 7 */
  541. uint16_t dataOverLay:1; /* FC Parm Word 3, bit 6 */
  542. uint16_t initiatorFunc:1; /* FC Parm Word 3, bit 5 */
  543. uint16_t targetFunc:1; /* FC Parm Word 3, bit 4 */
  544. uint16_t cmdDataMixEna:1; /* FC Parm Word 3, bit 3 */
  545. uint16_t dataRspMixEna:1; /* FC Parm Word 3, bit 2 */
  546. uint16_t readXferRdyDis:1; /* FC Parm Word 3, bit 1 */
  547. uint16_t writeXferRdyDis:1; /* FC Parm Word 3, bit 0 */
  548. #else /* __LITTLE_ENDIAN_BITFIELD */
  549. uint16_t Retry:1; /* FC Parm Word 3, bit 8 */
  550. uint16_t TaskRetryIdReq:1; /* FC Parm Word 3, bit 9 */
  551. uint16_t Word3bit10Resved:1; /* FC Parm Word 3, bit 10 */
  552. uint16_t Word3bit11Resved:1; /* FC Parm Word 3, bit 11 */
  553. uint16_t Word3bit12Resved:1; /* FC Parm Word 3, bit 12 */
  554. uint16_t Word3bit13Resved:1; /* FC Parm Word 3, bit 13 */
  555. uint16_t Word3bit14Resved:1; /* FC Parm Word 3, bit 14 */
  556. uint16_t Word3bit15Resved:1; /* FC Parm Word 3, bit 15 */
  557. uint16_t writeXferRdyDis:1; /* FC Parm Word 3, bit 0 */
  558. uint16_t readXferRdyDis:1; /* FC Parm Word 3, bit 1 */
  559. uint16_t dataRspMixEna:1; /* FC Parm Word 3, bit 2 */
  560. uint16_t cmdDataMixEna:1; /* FC Parm Word 3, bit 3 */
  561. uint16_t targetFunc:1; /* FC Parm Word 3, bit 4 */
  562. uint16_t initiatorFunc:1; /* FC Parm Word 3, bit 5 */
  563. uint16_t dataOverLay:1; /* FC Parm Word 3, bit 6 */
  564. uint16_t ConfmComplAllowed:1; /* FC Parm Word 3, bit 7 */
  565. #endif
  566. } PRLI;
  567. /*
  568. * FCP Logout (PRLO Request / ACC) Payload Definition
  569. */
  570. typedef struct _PRLO { /* Structure is in Big Endian format */
  571. uint8_t prloType; /* FC Parm Word 0, bit 24:31 */
  572. #define PRLO_FCP_TYPE 0x08
  573. uint8_t word0Reserved1; /* FC Parm Word 0, bit 16:23 */
  574. #ifdef __BIG_ENDIAN_BITFIELD
  575. uint8_t origProcAssocV:1; /* FC Parm Word 0, bit 15 */
  576. uint8_t respProcAssocV:1; /* FC Parm Word 0, bit 14 */
  577. uint8_t word0Reserved2:2; /* FC Parm Word 0, bit 12:13 */
  578. uint8_t acceptRspCode:4; /* FC Parm Word 0, bit 8:11, ACC ONLY */
  579. #else /* __LITTLE_ENDIAN_BITFIELD */
  580. uint8_t acceptRspCode:4; /* FC Parm Word 0, bit 8:11, ACC ONLY */
  581. uint8_t word0Reserved2:2; /* FC Parm Word 0, bit 12:13 */
  582. uint8_t respProcAssocV:1; /* FC Parm Word 0, bit 14 */
  583. uint8_t origProcAssocV:1; /* FC Parm Word 0, bit 15 */
  584. #endif
  585. #define PRLO_REQ_EXECUTED 0x1 /* acceptRspCode */
  586. #define PRLO_NO_SUCH_IMAGE 0x4
  587. #define PRLO_INVALID_PAGE_CNT 0x7
  588. uint8_t word0Reserved3; /* FC Parm Word 0, bit 0:7 */
  589. uint32_t origProcAssoc; /* FC Parm Word 1, bit 0:31 */
  590. uint32_t respProcAssoc; /* FC Parm Word 2, bit 0:31 */
  591. uint32_t word3Reserved1; /* FC Parm Word 3, bit 0:31 */
  592. } PRLO;
  593. typedef struct _ADISC { /* Structure is in Big Endian format */
  594. uint32_t hardAL_PA;
  595. struct lpfc_name portName;
  596. struct lpfc_name nodeName;
  597. uint32_t DID;
  598. } ADISC;
  599. typedef struct _FARP { /* Structure is in Big Endian format */
  600. uint32_t Mflags:8;
  601. uint32_t Odid:24;
  602. #define FARP_NO_ACTION 0 /* FARP information enclosed, no
  603. action */
  604. #define FARP_MATCH_PORT 0x1 /* Match on Responder Port Name */
  605. #define FARP_MATCH_NODE 0x2 /* Match on Responder Node Name */
  606. #define FARP_MATCH_IP 0x4 /* Match on IP address, not supported */
  607. #define FARP_MATCH_IPV4 0x5 /* Match on IPV4 address, not
  608. supported */
  609. #define FARP_MATCH_IPV6 0x6 /* Match on IPV6 address, not
  610. supported */
  611. uint32_t Rflags:8;
  612. uint32_t Rdid:24;
  613. #define FARP_REQUEST_PLOGI 0x1 /* Request for PLOGI */
  614. #define FARP_REQUEST_FARPR 0x2 /* Request for FARP Response */
  615. struct lpfc_name OportName;
  616. struct lpfc_name OnodeName;
  617. struct lpfc_name RportName;
  618. struct lpfc_name RnodeName;
  619. uint8_t Oipaddr[16];
  620. uint8_t Ripaddr[16];
  621. } FARP;
  622. typedef struct _FAN { /* Structure is in Big Endian format */
  623. uint32_t Fdid;
  624. struct lpfc_name FportName;
  625. struct lpfc_name FnodeName;
  626. } FAN;
  627. typedef struct _SCR { /* Structure is in Big Endian format */
  628. uint8_t resvd1;
  629. uint8_t resvd2;
  630. uint8_t resvd3;
  631. uint8_t Function;
  632. #define SCR_FUNC_FABRIC 0x01
  633. #define SCR_FUNC_NPORT 0x02
  634. #define SCR_FUNC_FULL 0x03
  635. #define SCR_CLEAR 0xff
  636. } SCR;
  637. typedef struct _RNID_TOP_DISC {
  638. struct lpfc_name portName;
  639. uint8_t resvd[8];
  640. uint32_t unitType;
  641. #define RNID_HBA 0x7
  642. #define RNID_HOST 0xa
  643. #define RNID_DRIVER 0xd
  644. uint32_t physPort;
  645. uint32_t attachedNodes;
  646. uint16_t ipVersion;
  647. #define RNID_IPV4 0x1
  648. #define RNID_IPV6 0x2
  649. uint16_t UDPport;
  650. uint8_t ipAddr[16];
  651. uint16_t resvd1;
  652. uint16_t flags;
  653. #define RNID_TD_SUPPORT 0x1
  654. #define RNID_LP_VALID 0x2
  655. } RNID_TOP_DISC;
  656. typedef struct _RNID { /* Structure is in Big Endian format */
  657. uint8_t Format;
  658. #define RNID_TOPOLOGY_DISC 0xdf
  659. uint8_t CommonLen;
  660. uint8_t resvd1;
  661. uint8_t SpecificLen;
  662. struct lpfc_name portName;
  663. struct lpfc_name nodeName;
  664. union {
  665. RNID_TOP_DISC topologyDisc; /* topology disc (0xdf) */
  666. } un;
  667. } RNID;
  668. typedef struct _RRQ { /* Structure is in Big Endian format */
  669. uint32_t SID;
  670. uint16_t Oxid;
  671. uint16_t Rxid;
  672. uint8_t resv[32]; /* optional association hdr */
  673. } RRQ;
  674. /* This is used for RSCN command */
  675. typedef struct _D_ID { /* Structure is in Big Endian format */
  676. union {
  677. uint32_t word;
  678. struct {
  679. #ifdef __BIG_ENDIAN_BITFIELD
  680. uint8_t resv;
  681. uint8_t domain;
  682. uint8_t area;
  683. uint8_t id;
  684. #else /* __LITTLE_ENDIAN_BITFIELD */
  685. uint8_t id;
  686. uint8_t area;
  687. uint8_t domain;
  688. uint8_t resv;
  689. #endif
  690. } b;
  691. } un;
  692. } D_ID;
  693. /*
  694. * Structure to define all ELS Payload types
  695. */
  696. typedef struct _ELS_PKT { /* Structure is in Big Endian format */
  697. uint8_t elsCode; /* FC Word 0, bit 24:31 */
  698. uint8_t elsByte1;
  699. uint8_t elsByte2;
  700. uint8_t elsByte3;
  701. union {
  702. struct ls_rjt lsRjt; /* Payload for LS_RJT ELS response */
  703. struct serv_parm logi; /* Payload for PLOGI/FLOGI/PDISC/ACC */
  704. LOGO logo; /* Payload for PLOGO/FLOGO/ACC */
  705. PRLI prli; /* Payload for PRLI/ACC */
  706. PRLO prlo; /* Payload for PRLO/ACC */
  707. ADISC adisc; /* Payload for ADISC/ACC */
  708. FARP farp; /* Payload for FARP/ACC */
  709. FAN fan; /* Payload for FAN */
  710. SCR scr; /* Payload for SCR/ACC */
  711. RRQ rrq; /* Payload for RRQ */
  712. RNID rnid; /* Payload for RNID */
  713. uint8_t pad[128 - 4]; /* Pad out to payload of 128 bytes */
  714. } un;
  715. } ELS_PKT;
  716. /*
  717. * FDMI
  718. * HBA MAnagement Operations Command Codes
  719. */
  720. #define SLI_MGMT_GRHL 0x100 /* Get registered HBA list */
  721. #define SLI_MGMT_GHAT 0x101 /* Get HBA attributes */
  722. #define SLI_MGMT_GRPL 0x102 /* Get registered Port list */
  723. #define SLI_MGMT_GPAT 0x110 /* Get Port attributes */
  724. #define SLI_MGMT_RHBA 0x200 /* Register HBA */
  725. #define SLI_MGMT_RHAT 0x201 /* Register HBA atttributes */
  726. #define SLI_MGMT_RPRT 0x210 /* Register Port */
  727. #define SLI_MGMT_RPA 0x211 /* Register Port attributes */
  728. #define SLI_MGMT_DHBA 0x300 /* De-register HBA */
  729. #define SLI_MGMT_DPRT 0x310 /* De-register Port */
  730. /*
  731. * Management Service Subtypes
  732. */
  733. #define SLI_CT_FDMI_Subtypes 0x10
  734. /*
  735. * HBA Management Service Reject Code
  736. */
  737. #define REJECT_CODE 0x9 /* Unable to perform command request */
  738. /*
  739. * HBA Management Service Reject Reason Code
  740. * Please refer to the Reason Codes above
  741. */
  742. /*
  743. * HBA Attribute Types
  744. */
  745. #define NODE_NAME 0x1
  746. #define MANUFACTURER 0x2
  747. #define SERIAL_NUMBER 0x3
  748. #define MODEL 0x4
  749. #define MODEL_DESCRIPTION 0x5
  750. #define HARDWARE_VERSION 0x6
  751. #define DRIVER_VERSION 0x7
  752. #define OPTION_ROM_VERSION 0x8
  753. #define FIRMWARE_VERSION 0x9
  754. #define OS_NAME_VERSION 0xa
  755. #define MAX_CT_PAYLOAD_LEN 0xb
  756. /*
  757. * Port Attrubute Types
  758. */
  759. #define SUPPORTED_FC4_TYPES 0x1
  760. #define SUPPORTED_SPEED 0x2
  761. #define PORT_SPEED 0x3
  762. #define MAX_FRAME_SIZE 0x4
  763. #define OS_DEVICE_NAME 0x5
  764. #define HOST_NAME 0x6
  765. union AttributesDef {
  766. /* Structure is in Big Endian format */
  767. struct {
  768. uint32_t AttrType:16;
  769. uint32_t AttrLen:16;
  770. } bits;
  771. uint32_t word;
  772. };
  773. /*
  774. * HBA Attribute Entry (8 - 260 bytes)
  775. */
  776. typedef struct {
  777. union AttributesDef ad;
  778. union {
  779. uint32_t VendorSpecific;
  780. uint8_t Manufacturer[64];
  781. uint8_t SerialNumber[64];
  782. uint8_t Model[256];
  783. uint8_t ModelDescription[256];
  784. uint8_t HardwareVersion[256];
  785. uint8_t DriverVersion[256];
  786. uint8_t OptionROMVersion[256];
  787. uint8_t FirmwareVersion[256];
  788. struct lpfc_name NodeName;
  789. uint8_t SupportFC4Types[32];
  790. uint32_t SupportSpeed;
  791. uint32_t PortSpeed;
  792. uint32_t MaxFrameSize;
  793. uint8_t OsDeviceName[256];
  794. uint8_t OsNameVersion[256];
  795. uint32_t MaxCTPayloadLen;
  796. uint8_t HostName[256];
  797. } un;
  798. } ATTRIBUTE_ENTRY;
  799. /*
  800. * HBA Attribute Block
  801. */
  802. typedef struct {
  803. uint32_t EntryCnt; /* Number of HBA attribute entries */
  804. ATTRIBUTE_ENTRY Entry; /* Variable-length array */
  805. } ATTRIBUTE_BLOCK;
  806. /*
  807. * Port Entry
  808. */
  809. typedef struct {
  810. struct lpfc_name PortName;
  811. } PORT_ENTRY;
  812. /*
  813. * HBA Identifier
  814. */
  815. typedef struct {
  816. struct lpfc_name PortName;
  817. } HBA_IDENTIFIER;
  818. /*
  819. * Registered Port List Format
  820. */
  821. typedef struct {
  822. uint32_t EntryCnt;
  823. PORT_ENTRY pe; /* Variable-length array */
  824. } REG_PORT_LIST;
  825. /*
  826. * Register HBA(RHBA)
  827. */
  828. typedef struct {
  829. HBA_IDENTIFIER hi;
  830. REG_PORT_LIST rpl; /* variable-length array */
  831. /* ATTRIBUTE_BLOCK ab; */
  832. } REG_HBA;
  833. /*
  834. * Register HBA Attributes (RHAT)
  835. */
  836. typedef struct {
  837. struct lpfc_name HBA_PortName;
  838. ATTRIBUTE_BLOCK ab;
  839. } REG_HBA_ATTRIBUTE;
  840. /*
  841. * Register Port Attributes (RPA)
  842. */
  843. typedef struct {
  844. struct lpfc_name PortName;
  845. ATTRIBUTE_BLOCK ab;
  846. } REG_PORT_ATTRIBUTE;
  847. /*
  848. * Get Registered HBA List (GRHL) Accept Payload Format
  849. */
  850. typedef struct {
  851. uint32_t HBA__Entry_Cnt; /* Number of Registered HBA Identifiers */
  852. struct lpfc_name HBA_PortName; /* Variable-length array */
  853. } GRHL_ACC_PAYLOAD;
  854. /*
  855. * Get Registered Port List (GRPL) Accept Payload Format
  856. */
  857. typedef struct {
  858. uint32_t RPL_Entry_Cnt; /* Number of Registered Port Entries */
  859. PORT_ENTRY Reg_Port_Entry[1]; /* Variable-length array */
  860. } GRPL_ACC_PAYLOAD;
  861. /*
  862. * Get Port Attributes (GPAT) Accept Payload Format
  863. */
  864. typedef struct {
  865. ATTRIBUTE_BLOCK pab;
  866. } GPAT_ACC_PAYLOAD;
  867. /*
  868. * Begin HBA configuration parameters.
  869. * The PCI configuration register BAR assignments are:
  870. * BAR0, offset 0x10 - SLIM base memory address
  871. * BAR1, offset 0x14 - SLIM base memory high address
  872. * BAR2, offset 0x18 - REGISTER base memory address
  873. * BAR3, offset 0x1c - REGISTER base memory high address
  874. * BAR4, offset 0x20 - BIU I/O registers
  875. * BAR5, offset 0x24 - REGISTER base io high address
  876. */
  877. /* Number of rings currently used and available. */
  878. #define MAX_CONFIGURED_RINGS 3
  879. #define MAX_RINGS 4
  880. /* IOCB / Mailbox is owned by FireFly */
  881. #define OWN_CHIP 1
  882. /* IOCB / Mailbox is owned by Host */
  883. #define OWN_HOST 0
  884. /* Number of 4-byte words in an IOCB. */
  885. #define IOCB_WORD_SZ 8
  886. /* defines for type field in fc header */
  887. #define FC_ELS_DATA 0x1
  888. #define FC_LLC_SNAP 0x5
  889. #define FC_FCP_DATA 0x8
  890. #define FC_COMMON_TRANSPORT_ULP 0x20
  891. /* defines for rctl field in fc header */
  892. #define FC_DEV_DATA 0x0
  893. #define FC_UNSOL_CTL 0x2
  894. #define FC_SOL_CTL 0x3
  895. #define FC_UNSOL_DATA 0x4
  896. #define FC_FCP_CMND 0x6
  897. #define FC_ELS_REQ 0x22
  898. #define FC_ELS_RSP 0x23
  899. /* network headers for Dfctl field */
  900. #define FC_NET_HDR 0x20
  901. /* Start FireFly Register definitions */
  902. #define PCI_VENDOR_ID_EMULEX 0x10df
  903. #define PCI_DEVICE_ID_FIREFLY 0x1ae5
  904. #define PCI_DEVICE_ID_SUPERFLY 0xf700
  905. #define PCI_DEVICE_ID_DRAGONFLY 0xf800
  906. #define PCI_DEVICE_ID_RFLY 0xf095
  907. #define PCI_DEVICE_ID_PFLY 0xf098
  908. #define PCI_DEVICE_ID_TFLY 0xf0a5
  909. #define PCI_DEVICE_ID_CENTAUR 0xf900
  910. #define PCI_DEVICE_ID_PEGASUS 0xf980
  911. #define PCI_DEVICE_ID_THOR 0xfa00
  912. #define PCI_DEVICE_ID_VIPER 0xfb00
  913. #define PCI_DEVICE_ID_HELIOS 0xfd00
  914. #define PCI_DEVICE_ID_BMID 0xf0d5
  915. #define PCI_DEVICE_ID_BSMB 0xf0d1
  916. #define PCI_DEVICE_ID_ZEPHYR 0xfe00
  917. #define PCI_DEVICE_ID_ZMID 0xf0e5
  918. #define PCI_DEVICE_ID_ZSMB 0xf0e1
  919. #define PCI_DEVICE_ID_LP101 0xf0a1
  920. #define PCI_DEVICE_ID_LP10000S 0xfc00
  921. #define JEDEC_ID_ADDRESS 0x0080001c
  922. #define FIREFLY_JEDEC_ID 0x1ACC
  923. #define SUPERFLY_JEDEC_ID 0x0020
  924. #define DRAGONFLY_JEDEC_ID 0x0021
  925. #define DRAGONFLY_V2_JEDEC_ID 0x0025
  926. #define CENTAUR_2G_JEDEC_ID 0x0026
  927. #define CENTAUR_1G_JEDEC_ID 0x0028
  928. #define PEGASUS_ORION_JEDEC_ID 0x0036
  929. #define PEGASUS_JEDEC_ID 0x0038
  930. #define THOR_JEDEC_ID 0x0012
  931. #define HELIOS_JEDEC_ID 0x0364
  932. #define ZEPHYR_JEDEC_ID 0x0577
  933. #define VIPER_JEDEC_ID 0x4838
  934. #define JEDEC_ID_MASK 0x0FFFF000
  935. #define JEDEC_ID_SHIFT 12
  936. #define FC_JEDEC_ID(id) ((id & JEDEC_ID_MASK) >> JEDEC_ID_SHIFT)
  937. typedef struct { /* FireFly BIU registers */
  938. uint32_t hostAtt; /* See definitions for Host Attention
  939. register */
  940. uint32_t chipAtt; /* See definitions for Chip Attention
  941. register */
  942. uint32_t hostStatus; /* See definitions for Host Status register */
  943. uint32_t hostControl; /* See definitions for Host Control register */
  944. uint32_t buiConfig; /* See definitions for BIU configuration
  945. register */
  946. } FF_REGS;
  947. /* IO Register size in bytes */
  948. #define FF_REG_AREA_SIZE 256
  949. /* Host Attention Register */
  950. #define HA_REG_OFFSET 0 /* Byte offset from register base address */
  951. #define HA_R0RE_REQ 0x00000001 /* Bit 0 */
  952. #define HA_R0CE_RSP 0x00000002 /* Bit 1 */
  953. #define HA_R0ATT 0x00000008 /* Bit 3 */
  954. #define HA_R1RE_REQ 0x00000010 /* Bit 4 */
  955. #define HA_R1CE_RSP 0x00000020 /* Bit 5 */
  956. #define HA_R1ATT 0x00000080 /* Bit 7 */
  957. #define HA_R2RE_REQ 0x00000100 /* Bit 8 */
  958. #define HA_R2CE_RSP 0x00000200 /* Bit 9 */
  959. #define HA_R2ATT 0x00000800 /* Bit 11 */
  960. #define HA_R3RE_REQ 0x00001000 /* Bit 12 */
  961. #define HA_R3CE_RSP 0x00002000 /* Bit 13 */
  962. #define HA_R3ATT 0x00008000 /* Bit 15 */
  963. #define HA_LATT 0x20000000 /* Bit 29 */
  964. #define HA_MBATT 0x40000000 /* Bit 30 */
  965. #define HA_ERATT 0x80000000 /* Bit 31 */
  966. #define HA_RXRE_REQ 0x00000001 /* Bit 0 */
  967. #define HA_RXCE_RSP 0x00000002 /* Bit 1 */
  968. #define HA_RXATT 0x00000008 /* Bit 3 */
  969. #define HA_RXMASK 0x0000000f
  970. /* Chip Attention Register */
  971. #define CA_REG_OFFSET 4 /* Byte offset from register base address */
  972. #define CA_R0CE_REQ 0x00000001 /* Bit 0 */
  973. #define CA_R0RE_RSP 0x00000002 /* Bit 1 */
  974. #define CA_R0ATT 0x00000008 /* Bit 3 */
  975. #define CA_R1CE_REQ 0x00000010 /* Bit 4 */
  976. #define CA_R1RE_RSP 0x00000020 /* Bit 5 */
  977. #define CA_R1ATT 0x00000080 /* Bit 7 */
  978. #define CA_R2CE_REQ 0x00000100 /* Bit 8 */
  979. #define CA_R2RE_RSP 0x00000200 /* Bit 9 */
  980. #define CA_R2ATT 0x00000800 /* Bit 11 */
  981. #define CA_R3CE_REQ 0x00001000 /* Bit 12 */
  982. #define CA_R3RE_RSP 0x00002000 /* Bit 13 */
  983. #define CA_R3ATT 0x00008000 /* Bit 15 */
  984. #define CA_MBATT 0x40000000 /* Bit 30 */
  985. /* Host Status Register */
  986. #define HS_REG_OFFSET 8 /* Byte offset from register base address */
  987. #define HS_MBRDY 0x00400000 /* Bit 22 */
  988. #define HS_FFRDY 0x00800000 /* Bit 23 */
  989. #define HS_FFER8 0x01000000 /* Bit 24 */
  990. #define HS_FFER7 0x02000000 /* Bit 25 */
  991. #define HS_FFER6 0x04000000 /* Bit 26 */
  992. #define HS_FFER5 0x08000000 /* Bit 27 */
  993. #define HS_FFER4 0x10000000 /* Bit 28 */
  994. #define HS_FFER3 0x20000000 /* Bit 29 */
  995. #define HS_FFER2 0x40000000 /* Bit 30 */
  996. #define HS_FFER1 0x80000000 /* Bit 31 */
  997. #define HS_FFERM 0xFF000000 /* Mask for error bits 31:24 */
  998. /* Host Control Register */
  999. #define HC_REG_OFFSET 12 /* Word offset from register base address */
  1000. #define HC_MBINT_ENA 0x00000001 /* Bit 0 */
  1001. #define HC_R0INT_ENA 0x00000002 /* Bit 1 */
  1002. #define HC_R1INT_ENA 0x00000004 /* Bit 2 */
  1003. #define HC_R2INT_ENA 0x00000008 /* Bit 3 */
  1004. #define HC_R3INT_ENA 0x00000010 /* Bit 4 */
  1005. #define HC_INITHBI 0x02000000 /* Bit 25 */
  1006. #define HC_INITMB 0x04000000 /* Bit 26 */
  1007. #define HC_INITFF 0x08000000 /* Bit 27 */
  1008. #define HC_LAINT_ENA 0x20000000 /* Bit 29 */
  1009. #define HC_ERINT_ENA 0x80000000 /* Bit 31 */
  1010. /* Mailbox Commands */
  1011. #define MBX_SHUTDOWN 0x00 /* terminate testing */
  1012. #define MBX_LOAD_SM 0x01
  1013. #define MBX_READ_NV 0x02
  1014. #define MBX_WRITE_NV 0x03
  1015. #define MBX_RUN_BIU_DIAG 0x04
  1016. #define MBX_INIT_LINK 0x05
  1017. #define MBX_DOWN_LINK 0x06
  1018. #define MBX_CONFIG_LINK 0x07
  1019. #define MBX_CONFIG_RING 0x09
  1020. #define MBX_RESET_RING 0x0A
  1021. #define MBX_READ_CONFIG 0x0B
  1022. #define MBX_READ_RCONFIG 0x0C
  1023. #define MBX_READ_SPARM 0x0D
  1024. #define MBX_READ_STATUS 0x0E
  1025. #define MBX_READ_RPI 0x0F
  1026. #define MBX_READ_XRI 0x10
  1027. #define MBX_READ_REV 0x11
  1028. #define MBX_READ_LNK_STAT 0x12
  1029. #define MBX_REG_LOGIN 0x13
  1030. #define MBX_UNREG_LOGIN 0x14
  1031. #define MBX_READ_LA 0x15
  1032. #define MBX_CLEAR_LA 0x16
  1033. #define MBX_DUMP_MEMORY 0x17
  1034. #define MBX_DUMP_CONTEXT 0x18
  1035. #define MBX_RUN_DIAGS 0x19
  1036. #define MBX_RESTART 0x1A
  1037. #define MBX_UPDATE_CFG 0x1B
  1038. #define MBX_DOWN_LOAD 0x1C
  1039. #define MBX_DEL_LD_ENTRY 0x1D
  1040. #define MBX_RUN_PROGRAM 0x1E
  1041. #define MBX_SET_MASK 0x20
  1042. #define MBX_SET_SLIM 0x21
  1043. #define MBX_UNREG_D_ID 0x23
  1044. #define MBX_CONFIG_FARP 0x25
  1045. #define MBX_LOAD_AREA 0x81
  1046. #define MBX_RUN_BIU_DIAG64 0x84
  1047. #define MBX_CONFIG_PORT 0x88
  1048. #define MBX_READ_SPARM64 0x8D
  1049. #define MBX_READ_RPI64 0x8F
  1050. #define MBX_REG_LOGIN64 0x93
  1051. #define MBX_READ_LA64 0x95
  1052. #define MBX_FLASH_WR_ULA 0x98
  1053. #define MBX_SET_DEBUG 0x99
  1054. #define MBX_LOAD_EXP_ROM 0x9C
  1055. #define MBX_MAX_CMDS 0x9D
  1056. #define MBX_SLI2_CMD_MASK 0x80
  1057. /* IOCB Commands */
  1058. #define CMD_RCV_SEQUENCE_CX 0x01
  1059. #define CMD_XMIT_SEQUENCE_CR 0x02
  1060. #define CMD_XMIT_SEQUENCE_CX 0x03
  1061. #define CMD_XMIT_BCAST_CN 0x04
  1062. #define CMD_XMIT_BCAST_CX 0x05
  1063. #define CMD_QUE_RING_BUF_CN 0x06
  1064. #define CMD_QUE_XRI_BUF_CX 0x07
  1065. #define CMD_IOCB_CONTINUE_CN 0x08
  1066. #define CMD_RET_XRI_BUF_CX 0x09
  1067. #define CMD_ELS_REQUEST_CR 0x0A
  1068. #define CMD_ELS_REQUEST_CX 0x0B
  1069. #define CMD_RCV_ELS_REQ_CX 0x0D
  1070. #define CMD_ABORT_XRI_CN 0x0E
  1071. #define CMD_ABORT_XRI_CX 0x0F
  1072. #define CMD_CLOSE_XRI_CN 0x10
  1073. #define CMD_CLOSE_XRI_CX 0x11
  1074. #define CMD_CREATE_XRI_CR 0x12
  1075. #define CMD_CREATE_XRI_CX 0x13
  1076. #define CMD_GET_RPI_CN 0x14
  1077. #define CMD_XMIT_ELS_RSP_CX 0x15
  1078. #define CMD_GET_RPI_CR 0x16
  1079. #define CMD_XRI_ABORTED_CX 0x17
  1080. #define CMD_FCP_IWRITE_CR 0x18
  1081. #define CMD_FCP_IWRITE_CX 0x19
  1082. #define CMD_FCP_IREAD_CR 0x1A
  1083. #define CMD_FCP_IREAD_CX 0x1B
  1084. #define CMD_FCP_ICMND_CR 0x1C
  1085. #define CMD_FCP_ICMND_CX 0x1D
  1086. #define CMD_ADAPTER_MSG 0x20
  1087. #define CMD_ADAPTER_DUMP 0x22
  1088. /* SLI_2 IOCB Command Set */
  1089. #define CMD_RCV_SEQUENCE64_CX 0x81
  1090. #define CMD_XMIT_SEQUENCE64_CR 0x82
  1091. #define CMD_XMIT_SEQUENCE64_CX 0x83
  1092. #define CMD_XMIT_BCAST64_CN 0x84
  1093. #define CMD_XMIT_BCAST64_CX 0x85
  1094. #define CMD_QUE_RING_BUF64_CN 0x86
  1095. #define CMD_QUE_XRI_BUF64_CX 0x87
  1096. #define CMD_IOCB_CONTINUE64_CN 0x88
  1097. #define CMD_RET_XRI_BUF64_CX 0x89
  1098. #define CMD_ELS_REQUEST64_CR 0x8A
  1099. #define CMD_ELS_REQUEST64_CX 0x8B
  1100. #define CMD_ABORT_MXRI64_CN 0x8C
  1101. #define CMD_RCV_ELS_REQ64_CX 0x8D
  1102. #define CMD_XMIT_ELS_RSP64_CX 0x95
  1103. #define CMD_FCP_IWRITE64_CR 0x98
  1104. #define CMD_FCP_IWRITE64_CX 0x99
  1105. #define CMD_FCP_IREAD64_CR 0x9A
  1106. #define CMD_FCP_IREAD64_CX 0x9B
  1107. #define CMD_FCP_ICMND64_CR 0x9C
  1108. #define CMD_FCP_ICMND64_CX 0x9D
  1109. #define CMD_GEN_REQUEST64_CR 0xC2
  1110. #define CMD_GEN_REQUEST64_CX 0xC3
  1111. #define CMD_MAX_IOCB_CMD 0xE6
  1112. #define CMD_IOCB_MASK 0xff
  1113. #define MAX_MSG_DATA 28 /* max msg data in CMD_ADAPTER_MSG
  1114. iocb */
  1115. #define LPFC_MAX_ADPTMSG 32 /* max msg data */
  1116. /*
  1117. * Define Status
  1118. */
  1119. #define MBX_SUCCESS 0
  1120. #define MBXERR_NUM_RINGS 1
  1121. #define MBXERR_NUM_IOCBS 2
  1122. #define MBXERR_IOCBS_EXCEEDED 3
  1123. #define MBXERR_BAD_RING_NUMBER 4
  1124. #define MBXERR_MASK_ENTRIES_RANGE 5
  1125. #define MBXERR_MASKS_EXCEEDED 6
  1126. #define MBXERR_BAD_PROFILE 7
  1127. #define MBXERR_BAD_DEF_CLASS 8
  1128. #define MBXERR_BAD_MAX_RESPONDER 9
  1129. #define MBXERR_BAD_MAX_ORIGINATOR 10
  1130. #define MBXERR_RPI_REGISTERED 11
  1131. #define MBXERR_RPI_FULL 12
  1132. #define MBXERR_NO_RESOURCES 13
  1133. #define MBXERR_BAD_RCV_LENGTH 14
  1134. #define MBXERR_DMA_ERROR 15
  1135. #define MBXERR_ERROR 16
  1136. #define MBX_NOT_FINISHED 255
  1137. #define MBX_BUSY 0xffffff /* Attempted cmd to busy Mailbox */
  1138. #define MBX_TIMEOUT 0xfffffe /* time-out expired waiting for */
  1139. /*
  1140. * Begin Structure Definitions for Mailbox Commands
  1141. */
  1142. typedef struct {
  1143. #ifdef __BIG_ENDIAN_BITFIELD
  1144. uint8_t tval;
  1145. uint8_t tmask;
  1146. uint8_t rval;
  1147. uint8_t rmask;
  1148. #else /* __LITTLE_ENDIAN_BITFIELD */
  1149. uint8_t rmask;
  1150. uint8_t rval;
  1151. uint8_t tmask;
  1152. uint8_t tval;
  1153. #endif
  1154. } RR_REG;
  1155. struct ulp_bde {
  1156. uint32_t bdeAddress;
  1157. #ifdef __BIG_ENDIAN_BITFIELD
  1158. uint32_t bdeReserved:4;
  1159. uint32_t bdeAddrHigh:4;
  1160. uint32_t bdeSize:24;
  1161. #else /* __LITTLE_ENDIAN_BITFIELD */
  1162. uint32_t bdeSize:24;
  1163. uint32_t bdeAddrHigh:4;
  1164. uint32_t bdeReserved:4;
  1165. #endif
  1166. };
  1167. struct ulp_bde64 { /* SLI-2 */
  1168. union ULP_BDE_TUS {
  1169. uint32_t w;
  1170. struct {
  1171. #ifdef __BIG_ENDIAN_BITFIELD
  1172. uint32_t bdeFlags:8; /* BDE Flags 0 IS A SUPPORTED
  1173. VALUE !! */
  1174. uint32_t bdeSize:24; /* Size of buffer (in bytes) */
  1175. #else /* __LITTLE_ENDIAN_BITFIELD */
  1176. uint32_t bdeSize:24; /* Size of buffer (in bytes) */
  1177. uint32_t bdeFlags:8; /* BDE Flags 0 IS A SUPPORTED
  1178. VALUE !! */
  1179. #endif
  1180. #define BUFF_USE_RSVD 0x01 /* bdeFlags */
  1181. #define BUFF_USE_INTRPT 0x02 /* Not Implemented with LP6000 */
  1182. #define BUFF_USE_CMND 0x04 /* Optional, 1=cmd/rsp 0=data buffer */
  1183. #define BUFF_USE_RCV 0x08 /* "" "", 1=rcv buffer, 0=xmit
  1184. buffer */
  1185. #define BUFF_TYPE_32BIT 0x10 /* "" "", 1=32 bit addr 0=64 bit
  1186. addr */
  1187. #define BUFF_TYPE_SPECIAL 0x20 /* Not Implemented with LP6000 */
  1188. #define BUFF_TYPE_BDL 0x40 /* Optional, may be set in BDL */
  1189. #define BUFF_TYPE_INVALID 0x80 /* "" "" */
  1190. } f;
  1191. } tus;
  1192. uint32_t addrLow;
  1193. uint32_t addrHigh;
  1194. };
  1195. #define BDE64_SIZE_WORD 0
  1196. #define BPL64_SIZE_WORD 0x40
  1197. typedef struct ULP_BDL { /* SLI-2 */
  1198. #ifdef __BIG_ENDIAN_BITFIELD
  1199. uint32_t bdeFlags:8; /* BDL Flags */
  1200. uint32_t bdeSize:24; /* Size of BDL array in host memory (bytes) */
  1201. #else /* __LITTLE_ENDIAN_BITFIELD */
  1202. uint32_t bdeSize:24; /* Size of BDL array in host memory (bytes) */
  1203. uint32_t bdeFlags:8; /* BDL Flags */
  1204. #endif
  1205. uint32_t addrLow; /* Address 0:31 */
  1206. uint32_t addrHigh; /* Address 32:63 */
  1207. uint32_t ulpIoTag32; /* Can be used for 32 bit I/O Tag */
  1208. } ULP_BDL;
  1209. /* Structure for MB Command LOAD_SM and DOWN_LOAD */
  1210. typedef struct {
  1211. #ifdef __BIG_ENDIAN_BITFIELD
  1212. uint32_t rsvd2:25;
  1213. uint32_t acknowledgment:1;
  1214. uint32_t version:1;
  1215. uint32_t erase_or_prog:1;
  1216. uint32_t update_flash:1;
  1217. uint32_t update_ram:1;
  1218. uint32_t method:1;
  1219. uint32_t load_cmplt:1;
  1220. #else /* __LITTLE_ENDIAN_BITFIELD */
  1221. uint32_t load_cmplt:1;
  1222. uint32_t method:1;
  1223. uint32_t update_ram:1;
  1224. uint32_t update_flash:1;
  1225. uint32_t erase_or_prog:1;
  1226. uint32_t version:1;
  1227. uint32_t acknowledgment:1;
  1228. uint32_t rsvd2:25;
  1229. #endif
  1230. uint32_t dl_to_adr_low;
  1231. uint32_t dl_to_adr_high;
  1232. uint32_t dl_len;
  1233. union {
  1234. uint32_t dl_from_mbx_offset;
  1235. struct ulp_bde dl_from_bde;
  1236. struct ulp_bde64 dl_from_bde64;
  1237. } un;
  1238. } LOAD_SM_VAR;
  1239. /* Structure for MB Command READ_NVPARM (02) */
  1240. typedef struct {
  1241. uint32_t rsvd1[3]; /* Read as all one's */
  1242. uint32_t rsvd2; /* Read as all zero's */
  1243. uint32_t portname[2]; /* N_PORT name */
  1244. uint32_t nodename[2]; /* NODE name */
  1245. #ifdef __BIG_ENDIAN_BITFIELD
  1246. uint32_t pref_DID:24;
  1247. uint32_t hardAL_PA:8;
  1248. #else /* __LITTLE_ENDIAN_BITFIELD */
  1249. uint32_t hardAL_PA:8;
  1250. uint32_t pref_DID:24;
  1251. #endif
  1252. uint32_t rsvd3[21]; /* Read as all one's */
  1253. } READ_NV_VAR;
  1254. /* Structure for MB Command WRITE_NVPARMS (03) */
  1255. typedef struct {
  1256. uint32_t rsvd1[3]; /* Must be all one's */
  1257. uint32_t rsvd2; /* Must be all zero's */
  1258. uint32_t portname[2]; /* N_PORT name */
  1259. uint32_t nodename[2]; /* NODE name */
  1260. #ifdef __BIG_ENDIAN_BITFIELD
  1261. uint32_t pref_DID:24;
  1262. uint32_t hardAL_PA:8;
  1263. #else /* __LITTLE_ENDIAN_BITFIELD */
  1264. uint32_t hardAL_PA:8;
  1265. uint32_t pref_DID:24;
  1266. #endif
  1267. uint32_t rsvd3[21]; /* Must be all one's */
  1268. } WRITE_NV_VAR;
  1269. /* Structure for MB Command RUN_BIU_DIAG (04) */
  1270. /* Structure for MB Command RUN_BIU_DIAG64 (0x84) */
  1271. typedef struct {
  1272. uint32_t rsvd1;
  1273. union {
  1274. struct {
  1275. struct ulp_bde xmit_bde;
  1276. struct ulp_bde rcv_bde;
  1277. } s1;
  1278. struct {
  1279. struct ulp_bde64 xmit_bde64;
  1280. struct ulp_bde64 rcv_bde64;
  1281. } s2;
  1282. } un;
  1283. } BIU_DIAG_VAR;
  1284. /* Structure for MB Command INIT_LINK (05) */
  1285. typedef struct {
  1286. #ifdef __BIG_ENDIAN_BITFIELD
  1287. uint32_t rsvd1:24;
  1288. uint32_t lipsr_AL_PA:8; /* AL_PA to issue Lip Selective Reset to */
  1289. #else /* __LITTLE_ENDIAN_BITFIELD */
  1290. uint32_t lipsr_AL_PA:8; /* AL_PA to issue Lip Selective Reset to */
  1291. uint32_t rsvd1:24;
  1292. #endif
  1293. #ifdef __BIG_ENDIAN_BITFIELD
  1294. uint8_t fabric_AL_PA; /* If using a Fabric Assigned AL_PA */
  1295. uint8_t rsvd2;
  1296. uint16_t link_flags;
  1297. #else /* __LITTLE_ENDIAN_BITFIELD */
  1298. uint16_t link_flags;
  1299. uint8_t rsvd2;
  1300. uint8_t fabric_AL_PA; /* If using a Fabric Assigned AL_PA */
  1301. #endif
  1302. #define FLAGS_LOCAL_LB 0x01 /* link_flags (=1) ENDEC loopback */
  1303. #define FLAGS_TOPOLOGY_MODE_LOOP_PT 0x00 /* Attempt loop then pt-pt */
  1304. #define FLAGS_TOPOLOGY_MODE_PT_PT 0x02 /* Attempt pt-pt only */
  1305. #define FLAGS_TOPOLOGY_MODE_LOOP 0x04 /* Attempt loop only */
  1306. #define FLAGS_TOPOLOGY_MODE_PT_LOOP 0x06 /* Attempt pt-pt then loop */
  1307. #define FLAGS_LIRP_LILP 0x80 /* LIRP / LILP is disabled */
  1308. #define FLAGS_TOPOLOGY_FAILOVER 0x0400 /* Bit 10 */
  1309. #define FLAGS_LINK_SPEED 0x0800 /* Bit 11 */
  1310. uint32_t link_speed;
  1311. #define LINK_SPEED_AUTO 0 /* Auto selection */
  1312. #define LINK_SPEED_1G 1 /* 1 Gigabaud */
  1313. #define LINK_SPEED_2G 2 /* 2 Gigabaud */
  1314. #define LINK_SPEED_4G 4 /* 4 Gigabaud */
  1315. #define LINK_SPEED_8G 8 /* 4 Gigabaud */
  1316. #define LINK_SPEED_10G 16 /* 10 Gigabaud */
  1317. } INIT_LINK_VAR;
  1318. /* Structure for MB Command DOWN_LINK (06) */
  1319. typedef struct {
  1320. uint32_t rsvd1;
  1321. } DOWN_LINK_VAR;
  1322. /* Structure for MB Command CONFIG_LINK (07) */
  1323. typedef struct {
  1324. #ifdef __BIG_ENDIAN_BITFIELD
  1325. uint32_t cr:1;
  1326. uint32_t ci:1;
  1327. uint32_t cr_delay:6;
  1328. uint32_t cr_count:8;
  1329. uint32_t rsvd1:8;
  1330. uint32_t MaxBBC:8;
  1331. #else /* __LITTLE_ENDIAN_BITFIELD */
  1332. uint32_t MaxBBC:8;
  1333. uint32_t rsvd1:8;
  1334. uint32_t cr_count:8;
  1335. uint32_t cr_delay:6;
  1336. uint32_t ci:1;
  1337. uint32_t cr:1;
  1338. #endif
  1339. uint32_t myId;
  1340. uint32_t rsvd2;
  1341. uint32_t edtov;
  1342. uint32_t arbtov;
  1343. uint32_t ratov;
  1344. uint32_t rttov;
  1345. uint32_t altov;
  1346. uint32_t crtov;
  1347. uint32_t citov;
  1348. #ifdef __BIG_ENDIAN_BITFIELD
  1349. uint32_t rrq_enable:1;
  1350. uint32_t rrq_immed:1;
  1351. uint32_t rsvd4:29;
  1352. uint32_t ack0_enable:1;
  1353. #else /* __LITTLE_ENDIAN_BITFIELD */
  1354. uint32_t ack0_enable:1;
  1355. uint32_t rsvd4:29;
  1356. uint32_t rrq_immed:1;
  1357. uint32_t rrq_enable:1;
  1358. #endif
  1359. } CONFIG_LINK;
  1360. /* Structure for MB Command PART_SLIM (08)
  1361. * will be removed since SLI1 is no longer supported!
  1362. */
  1363. typedef struct {
  1364. #ifdef __BIG_ENDIAN_BITFIELD
  1365. uint16_t offCiocb;
  1366. uint16_t numCiocb;
  1367. uint16_t offRiocb;
  1368. uint16_t numRiocb;
  1369. #else /* __LITTLE_ENDIAN_BITFIELD */
  1370. uint16_t numCiocb;
  1371. uint16_t offCiocb;
  1372. uint16_t numRiocb;
  1373. uint16_t offRiocb;
  1374. #endif
  1375. } RING_DEF;
  1376. typedef struct {
  1377. #ifdef __BIG_ENDIAN_BITFIELD
  1378. uint32_t unused1:24;
  1379. uint32_t numRing:8;
  1380. #else /* __LITTLE_ENDIAN_BITFIELD */
  1381. uint32_t numRing:8;
  1382. uint32_t unused1:24;
  1383. #endif
  1384. RING_DEF ringdef[4];
  1385. uint32_t hbainit;
  1386. } PART_SLIM_VAR;
  1387. /* Structure for MB Command CONFIG_RING (09) */
  1388. typedef struct {
  1389. #ifdef __BIG_ENDIAN_BITFIELD
  1390. uint32_t unused2:6;
  1391. uint32_t recvSeq:1;
  1392. uint32_t recvNotify:1;
  1393. uint32_t numMask:8;
  1394. uint32_t profile:8;
  1395. uint32_t unused1:4;
  1396. uint32_t ring:4;
  1397. #else /* __LITTLE_ENDIAN_BITFIELD */
  1398. uint32_t ring:4;
  1399. uint32_t unused1:4;
  1400. uint32_t profile:8;
  1401. uint32_t numMask:8;
  1402. uint32_t recvNotify:1;
  1403. uint32_t recvSeq:1;
  1404. uint32_t unused2:6;
  1405. #endif
  1406. #ifdef __BIG_ENDIAN_BITFIELD
  1407. uint16_t maxRespXchg;
  1408. uint16_t maxOrigXchg;
  1409. #else /* __LITTLE_ENDIAN_BITFIELD */
  1410. uint16_t maxOrigXchg;
  1411. uint16_t maxRespXchg;
  1412. #endif
  1413. RR_REG rrRegs[6];
  1414. } CONFIG_RING_VAR;
  1415. /* Structure for MB Command RESET_RING (10) */
  1416. typedef struct {
  1417. uint32_t ring_no;
  1418. } RESET_RING_VAR;
  1419. /* Structure for MB Command READ_CONFIG (11) */
  1420. typedef struct {
  1421. #ifdef __BIG_ENDIAN_BITFIELD
  1422. uint32_t cr:1;
  1423. uint32_t ci:1;
  1424. uint32_t cr_delay:6;
  1425. uint32_t cr_count:8;
  1426. uint32_t InitBBC:8;
  1427. uint32_t MaxBBC:8;
  1428. #else /* __LITTLE_ENDIAN_BITFIELD */
  1429. uint32_t MaxBBC:8;
  1430. uint32_t InitBBC:8;
  1431. uint32_t cr_count:8;
  1432. uint32_t cr_delay:6;
  1433. uint32_t ci:1;
  1434. uint32_t cr:1;
  1435. #endif
  1436. #ifdef __BIG_ENDIAN_BITFIELD
  1437. uint32_t topology:8;
  1438. uint32_t myDid:24;
  1439. #else /* __LITTLE_ENDIAN_BITFIELD */
  1440. uint32_t myDid:24;
  1441. uint32_t topology:8;
  1442. #endif
  1443. /* Defines for topology (defined previously) */
  1444. #ifdef __BIG_ENDIAN_BITFIELD
  1445. uint32_t AR:1;
  1446. uint32_t IR:1;
  1447. uint32_t rsvd1:29;
  1448. uint32_t ack0:1;
  1449. #else /* __LITTLE_ENDIAN_BITFIELD */
  1450. uint32_t ack0:1;
  1451. uint32_t rsvd1:29;
  1452. uint32_t IR:1;
  1453. uint32_t AR:1;
  1454. #endif
  1455. uint32_t edtov;
  1456. uint32_t arbtov;
  1457. uint32_t ratov;
  1458. uint32_t rttov;
  1459. uint32_t altov;
  1460. uint32_t lmt;
  1461. #define LMT_RESERVED 0x0 /* Not used */
  1462. #define LMT_266_10bit 0x1 /* 265.625 Mbaud 10 bit iface */
  1463. #define LMT_532_10bit 0x2 /* 531.25 Mbaud 10 bit iface */
  1464. #define LMT_1063_20bit 0x3 /* 1062.5 Mbaud 20 bit iface */
  1465. #define LMT_1063_10bit 0x4 /* 1062.5 Mbaud 10 bit iface */
  1466. #define LMT_2125_10bit 0x8 /* 2125 Mbaud 10 bit iface */
  1467. #define LMT_4250_10bit 0x40 /* 4250 Mbaud 10 bit iface */
  1468. uint32_t rsvd2;
  1469. uint32_t rsvd3;
  1470. uint32_t max_xri;
  1471. uint32_t max_iocb;
  1472. uint32_t max_rpi;
  1473. uint32_t avail_xri;
  1474. uint32_t avail_iocb;
  1475. uint32_t avail_rpi;
  1476. uint32_t default_rpi;
  1477. } READ_CONFIG_VAR;
  1478. /* Structure for MB Command READ_RCONFIG (12) */
  1479. typedef struct {
  1480. #ifdef __BIG_ENDIAN_BITFIELD
  1481. uint32_t rsvd2:7;
  1482. uint32_t recvNotify:1;
  1483. uint32_t numMask:8;
  1484. uint32_t profile:8;
  1485. uint32_t rsvd1:4;
  1486. uint32_t ring:4;
  1487. #else /* __LITTLE_ENDIAN_BITFIELD */
  1488. uint32_t ring:4;
  1489. uint32_t rsvd1:4;
  1490. uint32_t profile:8;
  1491. uint32_t numMask:8;
  1492. uint32_t recvNotify:1;
  1493. uint32_t rsvd2:7;
  1494. #endif
  1495. #ifdef __BIG_ENDIAN_BITFIELD
  1496. uint16_t maxResp;
  1497. uint16_t maxOrig;
  1498. #else /* __LITTLE_ENDIAN_BITFIELD */
  1499. uint16_t maxOrig;
  1500. uint16_t maxResp;
  1501. #endif
  1502. RR_REG rrRegs[6];
  1503. #ifdef __BIG_ENDIAN_BITFIELD
  1504. uint16_t cmdRingOffset;
  1505. uint16_t cmdEntryCnt;
  1506. uint16_t rspRingOffset;
  1507. uint16_t rspEntryCnt;
  1508. uint16_t nextCmdOffset;
  1509. uint16_t rsvd3;
  1510. uint16_t nextRspOffset;
  1511. uint16_t rsvd4;
  1512. #else /* __LITTLE_ENDIAN_BITFIELD */
  1513. uint16_t cmdEntryCnt;
  1514. uint16_t cmdRingOffset;
  1515. uint16_t rspEntryCnt;
  1516. uint16_t rspRingOffset;
  1517. uint16_t rsvd3;
  1518. uint16_t nextCmdOffset;
  1519. uint16_t rsvd4;
  1520. uint16_t nextRspOffset;
  1521. #endif
  1522. } READ_RCONF_VAR;
  1523. /* Structure for MB Command READ_SPARM (13) */
  1524. /* Structure for MB Command READ_SPARM64 (0x8D) */
  1525. typedef struct {
  1526. uint32_t rsvd1;
  1527. uint32_t rsvd2;
  1528. union {
  1529. struct ulp_bde sp; /* This BDE points to struct serv_parm
  1530. structure */
  1531. struct ulp_bde64 sp64;
  1532. } un;
  1533. } READ_SPARM_VAR;
  1534. /* Structure for MB Command READ_STATUS (14) */
  1535. typedef struct {
  1536. #ifdef __BIG_ENDIAN_BITFIELD
  1537. uint32_t rsvd1:31;
  1538. uint32_t clrCounters:1;
  1539. uint16_t activeXriCnt;
  1540. uint16_t activeRpiCnt;
  1541. #else /* __LITTLE_ENDIAN_BITFIELD */
  1542. uint32_t clrCounters:1;
  1543. uint32_t rsvd1:31;
  1544. uint16_t activeRpiCnt;
  1545. uint16_t activeXriCnt;
  1546. #endif
  1547. uint32_t xmitByteCnt;
  1548. uint32_t rcvByteCnt;
  1549. uint32_t xmitFrameCnt;
  1550. uint32_t rcvFrameCnt;
  1551. uint32_t xmitSeqCnt;
  1552. uint32_t rcvSeqCnt;
  1553. uint32_t totalOrigExchanges;
  1554. uint32_t totalRespExchanges;
  1555. uint32_t rcvPbsyCnt;
  1556. uint32_t rcvFbsyCnt;
  1557. } READ_STATUS_VAR;
  1558. /* Structure for MB Command READ_RPI (15) */
  1559. /* Structure for MB Command READ_RPI64 (0x8F) */
  1560. typedef struct {
  1561. #ifdef __BIG_ENDIAN_BITFIELD
  1562. uint16_t nextRpi;
  1563. uint16_t reqRpi;
  1564. uint32_t rsvd2:8;
  1565. uint32_t DID:24;
  1566. #else /* __LITTLE_ENDIAN_BITFIELD */
  1567. uint16_t reqRpi;
  1568. uint16_t nextRpi;
  1569. uint32_t DID:24;
  1570. uint32_t rsvd2:8;
  1571. #endif
  1572. union {
  1573. struct ulp_bde sp;
  1574. struct ulp_bde64 sp64;
  1575. } un;
  1576. } READ_RPI_VAR;
  1577. /* Structure for MB Command READ_XRI (16) */
  1578. typedef struct {
  1579. #ifdef __BIG_ENDIAN_BITFIELD
  1580. uint16_t nextXri;
  1581. uint16_t reqXri;
  1582. uint16_t rsvd1;
  1583. uint16_t rpi;
  1584. uint32_t rsvd2:8;
  1585. uint32_t DID:24;
  1586. uint32_t rsvd3:8;
  1587. uint32_t SID:24;
  1588. uint32_t rsvd4;
  1589. uint8_t seqId;
  1590. uint8_t rsvd5;
  1591. uint16_t seqCount;
  1592. uint16_t oxId;
  1593. uint16_t rxId;
  1594. uint32_t rsvd6:30;
  1595. uint32_t si:1;
  1596. uint32_t exchOrig:1;
  1597. #else /* __LITTLE_ENDIAN_BITFIELD */
  1598. uint16_t reqXri;
  1599. uint16_t nextXri;
  1600. uint16_t rpi;
  1601. uint16_t rsvd1;
  1602. uint32_t DID:24;
  1603. uint32_t rsvd2:8;
  1604. uint32_t SID:24;
  1605. uint32_t rsvd3:8;
  1606. uint32_t rsvd4;
  1607. uint16_t seqCount;
  1608. uint8_t rsvd5;
  1609. uint8_t seqId;
  1610. uint16_t rxId;
  1611. uint16_t oxId;
  1612. uint32_t exchOrig:1;
  1613. uint32_t si:1;
  1614. uint32_t rsvd6:30;
  1615. #endif
  1616. } READ_XRI_VAR;
  1617. /* Structure for MB Command READ_REV (17) */
  1618. typedef struct {
  1619. #ifdef __BIG_ENDIAN_BITFIELD
  1620. uint32_t cv:1;
  1621. uint32_t rr:1;
  1622. uint32_t rsvd1:29;
  1623. uint32_t rv:1;
  1624. #else /* __LITTLE_ENDIAN_BITFIELD */
  1625. uint32_t rv:1;
  1626. uint32_t rsvd1:29;
  1627. uint32_t rr:1;
  1628. uint32_t cv:1;
  1629. #endif
  1630. uint32_t biuRev;
  1631. uint32_t smRev;
  1632. union {
  1633. uint32_t smFwRev;
  1634. struct {
  1635. #ifdef __BIG_ENDIAN_BITFIELD
  1636. uint8_t ProgType;
  1637. uint8_t ProgId;
  1638. uint16_t ProgVer:4;
  1639. uint16_t ProgRev:4;
  1640. uint16_t ProgFixLvl:2;
  1641. uint16_t ProgDistType:2;
  1642. uint16_t DistCnt:4;
  1643. #else /* __LITTLE_ENDIAN_BITFIELD */
  1644. uint16_t DistCnt:4;
  1645. uint16_t ProgDistType:2;
  1646. uint16_t ProgFixLvl:2;
  1647. uint16_t ProgRev:4;
  1648. uint16_t ProgVer:4;
  1649. uint8_t ProgId;
  1650. uint8_t ProgType;
  1651. #endif
  1652. } b;
  1653. } un;
  1654. uint32_t endecRev;
  1655. #ifdef __BIG_ENDIAN_BITFIELD
  1656. uint8_t feaLevelHigh;
  1657. uint8_t feaLevelLow;
  1658. uint8_t fcphHigh;
  1659. uint8_t fcphLow;
  1660. #else /* __LITTLE_ENDIAN_BITFIELD */
  1661. uint8_t fcphLow;
  1662. uint8_t fcphHigh;
  1663. uint8_t feaLevelLow;
  1664. uint8_t feaLevelHigh;
  1665. #endif
  1666. uint32_t postKernRev;
  1667. uint32_t opFwRev;
  1668. uint8_t opFwName[16];
  1669. uint32_t sli1FwRev;
  1670. uint8_t sli1FwName[16];
  1671. uint32_t sli2FwRev;
  1672. uint8_t sli2FwName[16];
  1673. uint32_t rsvd2;
  1674. uint32_t RandomData[7];
  1675. } READ_REV_VAR;
  1676. /* Structure for MB Command READ_LINK_STAT (18) */
  1677. typedef struct {
  1678. uint32_t rsvd1;
  1679. uint32_t linkFailureCnt;
  1680. uint32_t lossSyncCnt;
  1681. uint32_t lossSignalCnt;
  1682. uint32_t primSeqErrCnt;
  1683. uint32_t invalidXmitWord;
  1684. uint32_t crcCnt;
  1685. uint32_t primSeqTimeout;
  1686. uint32_t elasticOverrun;
  1687. uint32_t arbTimeout;
  1688. } READ_LNK_VAR;
  1689. /* Structure for MB Command REG_LOGIN (19) */
  1690. /* Structure for MB Command REG_LOGIN64 (0x93) */
  1691. typedef struct {
  1692. #ifdef __BIG_ENDIAN_BITFIELD
  1693. uint16_t rsvd1;
  1694. uint16_t rpi;
  1695. uint32_t rsvd2:8;
  1696. uint32_t did:24;
  1697. #else /* __LITTLE_ENDIAN_BITFIELD */
  1698. uint16_t rpi;
  1699. uint16_t rsvd1;
  1700. uint32_t did:24;
  1701. uint32_t rsvd2:8;
  1702. #endif
  1703. union {
  1704. struct ulp_bde sp;
  1705. struct ulp_bde64 sp64;
  1706. } un;
  1707. } REG_LOGIN_VAR;
  1708. /* Word 30 contents for REG_LOGIN */
  1709. typedef union {
  1710. struct {
  1711. #ifdef __BIG_ENDIAN_BITFIELD
  1712. uint16_t rsvd1:12;
  1713. uint16_t wd30_class:4;
  1714. uint16_t xri;
  1715. #else /* __LITTLE_ENDIAN_BITFIELD */
  1716. uint16_t xri;
  1717. uint16_t wd30_class:4;
  1718. uint16_t rsvd1:12;
  1719. #endif
  1720. } f;
  1721. uint32_t word;
  1722. } REG_WD30;
  1723. /* Structure for MB Command UNREG_LOGIN (20) */
  1724. typedef struct {
  1725. #ifdef __BIG_ENDIAN_BITFIELD
  1726. uint16_t rsvd1;
  1727. uint16_t rpi;
  1728. #else /* __LITTLE_ENDIAN_BITFIELD */
  1729. uint16_t rpi;
  1730. uint16_t rsvd1;
  1731. #endif
  1732. } UNREG_LOGIN_VAR;
  1733. /* Structure for MB Command UNREG_D_ID (0x23) */
  1734. typedef struct {
  1735. uint32_t did;
  1736. } UNREG_D_ID_VAR;
  1737. /* Structure for MB Command READ_LA (21) */
  1738. /* Structure for MB Command READ_LA64 (0x95) */
  1739. typedef struct {
  1740. uint32_t eventTag; /* Event tag */
  1741. #ifdef __BIG_ENDIAN_BITFIELD
  1742. uint32_t rsvd1:22;
  1743. uint32_t pb:1;
  1744. uint32_t il:1;
  1745. uint32_t attType:8;
  1746. #else /* __LITTLE_ENDIAN_BITFIELD */
  1747. uint32_t attType:8;
  1748. uint32_t il:1;
  1749. uint32_t pb:1;
  1750. uint32_t rsvd1:22;
  1751. #endif
  1752. #define AT_RESERVED 0x00 /* Reserved - attType */
  1753. #define AT_LINK_UP 0x01 /* Link is up */
  1754. #define AT_LINK_DOWN 0x02 /* Link is down */
  1755. #ifdef __BIG_ENDIAN_BITFIELD
  1756. uint8_t granted_AL_PA;
  1757. uint8_t lipAlPs;
  1758. uint8_t lipType;
  1759. uint8_t topology;
  1760. #else /* __LITTLE_ENDIAN_BITFIELD */
  1761. uint8_t topology;
  1762. uint8_t lipType;
  1763. uint8_t lipAlPs;
  1764. uint8_t granted_AL_PA;
  1765. #endif
  1766. #define TOPOLOGY_PT_PT 0x01 /* Topology is pt-pt / pt-fabric */
  1767. #define TOPOLOGY_LOOP 0x02 /* Topology is FC-AL */
  1768. union {
  1769. struct ulp_bde lilpBde; /* This BDE points to a 128 byte buffer
  1770. to */
  1771. /* store the LILP AL_PA position map into */
  1772. struct ulp_bde64 lilpBde64;
  1773. } un;
  1774. #ifdef __BIG_ENDIAN_BITFIELD
  1775. uint32_t Dlu:1;
  1776. uint32_t Dtf:1;
  1777. uint32_t Drsvd2:14;
  1778. uint32_t DlnkSpeed:8;
  1779. uint32_t DnlPort:4;
  1780. uint32_t Dtx:2;
  1781. uint32_t Drx:2;
  1782. #else /* __LITTLE_ENDIAN_BITFIELD */
  1783. uint32_t Drx:2;
  1784. uint32_t Dtx:2;
  1785. uint32_t DnlPort:4;
  1786. uint32_t DlnkSpeed:8;
  1787. uint32_t Drsvd2:14;
  1788. uint32_t Dtf:1;
  1789. uint32_t Dlu:1;
  1790. #endif
  1791. #ifdef __BIG_ENDIAN_BITFIELD
  1792. uint32_t Ulu:1;
  1793. uint32_t Utf:1;
  1794. uint32_t Ursvd2:14;
  1795. uint32_t UlnkSpeed:8;
  1796. uint32_t UnlPort:4;
  1797. uint32_t Utx:2;
  1798. uint32_t Urx:2;
  1799. #else /* __LITTLE_ENDIAN_BITFIELD */
  1800. uint32_t Urx:2;
  1801. uint32_t Utx:2;
  1802. uint32_t UnlPort:4;
  1803. uint32_t UlnkSpeed:8;
  1804. uint32_t Ursvd2:14;
  1805. uint32_t Utf:1;
  1806. uint32_t Ulu:1;
  1807. #endif
  1808. #define LA_UNKNW_LINK 0x0 /* lnkSpeed */
  1809. #define LA_1GHZ_LINK 0x04 /* lnkSpeed */
  1810. #define LA_2GHZ_LINK 0x08 /* lnkSpeed */
  1811. #define LA_4GHZ_LINK 0x10 /* lnkSpeed */
  1812. #define LA_8GHZ_LINK 0x20 /* lnkSpeed */
  1813. #define LA_10GHZ_LINK 0x40 /* lnkSpeed */
  1814. } READ_LA_VAR;
  1815. /* Structure for MB Command CLEAR_LA (22) */
  1816. typedef struct {
  1817. uint32_t eventTag; /* Event tag */
  1818. uint32_t rsvd1;
  1819. } CLEAR_LA_VAR;
  1820. /* Structure for MB Command DUMP */
  1821. typedef struct {
  1822. #ifdef __BIG_ENDIAN_BITFIELD
  1823. uint32_t rsvd:25;
  1824. uint32_t ra:1;
  1825. uint32_t co:1;
  1826. uint32_t cv:1;
  1827. uint32_t type:4;
  1828. uint32_t entry_index:16;
  1829. uint32_t region_id:16;
  1830. #else /* __LITTLE_ENDIAN_BITFIELD */
  1831. uint32_t type:4;
  1832. uint32_t cv:1;
  1833. uint32_t co:1;
  1834. uint32_t ra:1;
  1835. uint32_t rsvd:25;
  1836. uint32_t region_id:16;
  1837. uint32_t entry_index:16;
  1838. #endif
  1839. uint32_t rsvd1;
  1840. uint32_t word_cnt;
  1841. uint32_t resp_offset;
  1842. } DUMP_VAR;
  1843. #define DMP_MEM_REG 0x1
  1844. #define DMP_NV_PARAMS 0x2
  1845. #define DMP_REGION_VPD 0xe
  1846. #define DMP_VPD_SIZE 0x400 /* maximum amount of VPD */
  1847. #define DMP_RSP_OFFSET 0x14 /* word 5 contains first word of rsp */
  1848. #define DMP_RSP_SIZE 0x6C /* maximum of 27 words of rsp data */
  1849. /* Structure for MB Command CONFIG_PORT (0x88) */
  1850. typedef struct {
  1851. uint32_t pcbLen;
  1852. uint32_t pcbLow; /* bit 31:0 of memory based port config block */
  1853. uint32_t pcbHigh; /* bit 63:32 of memory based port config block */
  1854. uint32_t hbainit[5];
  1855. } CONFIG_PORT_VAR;
  1856. /* SLI-2 Port Control Block */
  1857. /* SLIM POINTER */
  1858. #define SLIMOFF 0x30 /* WORD */
  1859. typedef struct _SLI2_RDSC {
  1860. uint32_t cmdEntries;
  1861. uint32_t cmdAddrLow;
  1862. uint32_t cmdAddrHigh;
  1863. uint32_t rspEntries;
  1864. uint32_t rspAddrLow;
  1865. uint32_t rspAddrHigh;
  1866. } SLI2_RDSC;
  1867. typedef struct _PCB {
  1868. #ifdef __BIG_ENDIAN_BITFIELD
  1869. uint32_t type:8;
  1870. #define TYPE_NATIVE_SLI2 0x01;
  1871. uint32_t feature:8;
  1872. #define FEATURE_INITIAL_SLI2 0x01;
  1873. uint32_t rsvd:12;
  1874. uint32_t maxRing:4;
  1875. #else /* __LITTLE_ENDIAN_BITFIELD */
  1876. uint32_t maxRing:4;
  1877. uint32_t rsvd:12;
  1878. uint32_t feature:8;
  1879. #define FEATURE_INITIAL_SLI2 0x01;
  1880. uint32_t type:8;
  1881. #define TYPE_NATIVE_SLI2 0x01;
  1882. #endif
  1883. uint32_t mailBoxSize;
  1884. uint32_t mbAddrLow;
  1885. uint32_t mbAddrHigh;
  1886. uint32_t hgpAddrLow;
  1887. uint32_t hgpAddrHigh;
  1888. uint32_t pgpAddrLow;
  1889. uint32_t pgpAddrHigh;
  1890. SLI2_RDSC rdsc[MAX_RINGS];
  1891. } PCB_t;
  1892. /* NEW_FEATURE */
  1893. typedef struct {
  1894. #ifdef __BIG_ENDIAN_BITFIELD
  1895. uint32_t rsvd0:27;
  1896. uint32_t discardFarp:1;
  1897. uint32_t IPEnable:1;
  1898. uint32_t nodeName:1;
  1899. uint32_t portName:1;
  1900. uint32_t filterEnable:1;
  1901. #else /* __LITTLE_ENDIAN_BITFIELD */
  1902. uint32_t filterEnable:1;
  1903. uint32_t portName:1;
  1904. uint32_t nodeName:1;
  1905. uint32_t IPEnable:1;
  1906. uint32_t discardFarp:1;
  1907. uint32_t rsvd:27;
  1908. #endif
  1909. uint8_t portname[8]; /* Used to be struct lpfc_name */
  1910. uint8_t nodename[8];
  1911. uint32_t rsvd1;
  1912. uint32_t rsvd2;
  1913. uint32_t rsvd3;
  1914. uint32_t IPAddress;
  1915. } CONFIG_FARP_VAR;
  1916. /* Union of all Mailbox Command types */
  1917. #define MAILBOX_CMD_WSIZE 32
  1918. #define MAILBOX_CMD_SIZE (MAILBOX_CMD_WSIZE * sizeof(uint32_t))
  1919. typedef union {
  1920. uint32_t varWords[MAILBOX_CMD_WSIZE - 1];
  1921. LOAD_SM_VAR varLdSM; /* cmd = 1 (LOAD_SM) */
  1922. READ_NV_VAR varRDnvp; /* cmd = 2 (READ_NVPARMS) */
  1923. WRITE_NV_VAR varWTnvp; /* cmd = 3 (WRITE_NVPARMS) */
  1924. BIU_DIAG_VAR varBIUdiag; /* cmd = 4 (RUN_BIU_DIAG) */
  1925. INIT_LINK_VAR varInitLnk; /* cmd = 5 (INIT_LINK) */
  1926. DOWN_LINK_VAR varDwnLnk; /* cmd = 6 (DOWN_LINK) */
  1927. CONFIG_LINK varCfgLnk; /* cmd = 7 (CONFIG_LINK) */
  1928. PART_SLIM_VAR varSlim; /* cmd = 8 (PART_SLIM) */
  1929. CONFIG_RING_VAR varCfgRing; /* cmd = 9 (CONFIG_RING) */
  1930. RESET_RING_VAR varRstRing; /* cmd = 10 (RESET_RING) */
  1931. READ_CONFIG_VAR varRdConfig; /* cmd = 11 (READ_CONFIG) */
  1932. READ_RCONF_VAR varRdRConfig; /* cmd = 12 (READ_RCONFIG) */
  1933. READ_SPARM_VAR varRdSparm; /* cmd = 13 (READ_SPARM(64)) */
  1934. READ_STATUS_VAR varRdStatus; /* cmd = 14 (READ_STATUS) */
  1935. READ_RPI_VAR varRdRPI; /* cmd = 15 (READ_RPI(64)) */
  1936. READ_XRI_VAR varRdXRI; /* cmd = 16 (READ_XRI) */
  1937. READ_REV_VAR varRdRev; /* cmd = 17 (READ_REV) */
  1938. READ_LNK_VAR varRdLnk; /* cmd = 18 (READ_LNK_STAT) */
  1939. REG_LOGIN_VAR varRegLogin; /* cmd = 19 (REG_LOGIN(64)) */
  1940. UNREG_LOGIN_VAR varUnregLogin; /* cmd = 20 (UNREG_LOGIN) */
  1941. READ_LA_VAR varReadLA; /* cmd = 21 (READ_LA(64)) */
  1942. CLEAR_LA_VAR varClearLA; /* cmd = 22 (CLEAR_LA) */
  1943. DUMP_VAR varDmp; /* Warm Start DUMP mbx cmd */
  1944. UNREG_D_ID_VAR varUnregDID; /* cmd = 0x23 (UNREG_D_ID) */
  1945. CONFIG_FARP_VAR varCfgFarp; /* cmd = 0x25 (CONFIG_FARP) NEW_FEATURE */
  1946. CONFIG_PORT_VAR varCfgPort; /* cmd = 0x88 (CONFIG_PORT) */
  1947. } MAILVARIANTS;
  1948. /*
  1949. * SLI-2 specific structures
  1950. */
  1951. typedef struct {
  1952. uint32_t cmdPutInx;
  1953. uint32_t rspGetInx;
  1954. } HGP;
  1955. typedef struct {
  1956. uint32_t cmdGetInx;
  1957. uint32_t rspPutInx;
  1958. } PGP;
  1959. typedef struct _SLI2_DESC {
  1960. HGP host[MAX_RINGS];
  1961. uint32_t unused1[16];
  1962. PGP port[MAX_RINGS];
  1963. } SLI2_DESC;
  1964. typedef union {
  1965. SLI2_DESC s2;
  1966. } SLI_VAR;
  1967. typedef struct {
  1968. #ifdef __BIG_ENDIAN_BITFIELD
  1969. uint16_t mbxStatus;
  1970. uint8_t mbxCommand;
  1971. uint8_t mbxReserved:6;
  1972. uint8_t mbxHc:1;
  1973. uint8_t mbxOwner:1; /* Low order bit first word */
  1974. #else /* __LITTLE_ENDIAN_BITFIELD */
  1975. uint8_t mbxOwner:1; /* Low order bit first word */
  1976. uint8_t mbxHc:1;
  1977. uint8_t mbxReserved:6;
  1978. uint8_t mbxCommand;
  1979. uint16_t mbxStatus;
  1980. #endif
  1981. MAILVARIANTS un;
  1982. SLI_VAR us;
  1983. } MAILBOX_t;
  1984. /*
  1985. * Begin Structure Definitions for IOCB Commands
  1986. */
  1987. typedef struct {
  1988. #ifdef __BIG_ENDIAN_BITFIELD
  1989. uint8_t statAction;
  1990. uint8_t statRsn;
  1991. uint8_t statBaExp;
  1992. uint8_t statLocalError;
  1993. #else /* __LITTLE_ENDIAN_BITFIELD */
  1994. uint8_t statLocalError;
  1995. uint8_t statBaExp;
  1996. uint8_t statRsn;
  1997. uint8_t statAction;
  1998. #endif
  1999. /* statRsn P/F_RJT reason codes */
  2000. #define RJT_BAD_D_ID 0x01 /* Invalid D_ID field */
  2001. #define RJT_BAD_S_ID 0x02 /* Invalid S_ID field */
  2002. #define RJT_UNAVAIL_TEMP 0x03 /* N_Port unavailable temp. */
  2003. #define RJT_UNAVAIL_PERM 0x04 /* N_Port unavailable perm. */
  2004. #define RJT_UNSUP_CLASS 0x05 /* Class not supported */
  2005. #define RJT_DELIM_ERR 0x06 /* Delimiter usage error */
  2006. #define RJT_UNSUP_TYPE 0x07 /* Type not supported */
  2007. #define RJT_BAD_CONTROL 0x08 /* Invalid link conrtol */
  2008. #define RJT_BAD_RCTL 0x09 /* R_CTL invalid */
  2009. #define RJT_BAD_FCTL 0x0A /* F_CTL invalid */
  2010. #define RJT_BAD_OXID 0x0B /* OX_ID invalid */
  2011. #define RJT_BAD_RXID 0x0C /* RX_ID invalid */
  2012. #define RJT_BAD_SEQID 0x0D /* SEQ_ID invalid */
  2013. #define RJT_BAD_DFCTL 0x0E /* DF_CTL invalid */
  2014. #define RJT_BAD_SEQCNT 0x0F /* SEQ_CNT invalid */
  2015. #define RJT_BAD_PARM 0x10 /* Param. field invalid */
  2016. #define RJT_XCHG_ERR 0x11 /* Exchange error */
  2017. #define RJT_PROT_ERR 0x12 /* Protocol error */
  2018. #define RJT_BAD_LENGTH 0x13 /* Invalid Length */
  2019. #define RJT_UNEXPECTED_ACK 0x14 /* Unexpected ACK */
  2020. #define RJT_LOGIN_REQUIRED 0x16 /* Login required */
  2021. #define RJT_TOO_MANY_SEQ 0x17 /* Excessive sequences */
  2022. #define RJT_XCHG_NOT_STRT 0x18 /* Exchange not started */
  2023. #define RJT_UNSUP_SEC_HDR 0x19 /* Security hdr not supported */
  2024. #define RJT_UNAVAIL_PATH 0x1A /* Fabric Path not available */
  2025. #define RJT_VENDOR_UNIQUE 0xFF /* Vendor unique error */
  2026. #define IOERR_SUCCESS 0x00 /* statLocalError */
  2027. #define IOERR_MISSING_CONTINUE 0x01
  2028. #define IOERR_SEQUENCE_TIMEOUT 0x02
  2029. #define IOERR_INTERNAL_ERROR 0x03
  2030. #define IOERR_INVALID_RPI 0x04
  2031. #define IOERR_NO_XRI 0x05
  2032. #define IOERR_ILLEGAL_COMMAND 0x06
  2033. #define IOERR_XCHG_DROPPED 0x07
  2034. #define IOERR_ILLEGAL_FIELD 0x08
  2035. #define IOERR_BAD_CONTINUE 0x09
  2036. #define IOERR_TOO_MANY_BUFFERS 0x0A
  2037. #define IOERR_RCV_BUFFER_WAITING 0x0B
  2038. #define IOERR_NO_CONNECTION 0x0C
  2039. #define IOERR_TX_DMA_FAILED 0x0D
  2040. #define IOERR_RX_DMA_FAILED 0x0E
  2041. #define IOERR_ILLEGAL_FRAME 0x0F
  2042. #define IOERR_EXTRA_DATA 0x10
  2043. #define IOERR_NO_RESOURCES 0x11
  2044. #define IOERR_RESERVED 0x12
  2045. #define IOERR_ILLEGAL_LENGTH 0x13
  2046. #define IOERR_UNSUPPORTED_FEATURE 0x14
  2047. #define IOERR_ABORT_IN_PROGRESS 0x15
  2048. #define IOERR_ABORT_REQUESTED 0x16
  2049. #define IOERR_RECEIVE_BUFFER_TIMEOUT 0x17
  2050. #define IOERR_LOOP_OPEN_FAILURE 0x18
  2051. #define IOERR_RING_RESET 0x19
  2052. #define IOERR_LINK_DOWN 0x1A
  2053. #define IOERR_CORRUPTED_DATA 0x1B
  2054. #define IOERR_CORRUPTED_RPI 0x1C
  2055. #define IOERR_OUT_OF_ORDER_DATA 0x1D
  2056. #define IOERR_OUT_OF_ORDER_ACK 0x1E
  2057. #define IOERR_DUP_FRAME 0x1F
  2058. #define IOERR_LINK_CONTROL_FRAME 0x20 /* ACK_N received */
  2059. #define IOERR_BAD_HOST_ADDRESS 0x21
  2060. #define IOERR_RCV_HDRBUF_WAITING 0x22
  2061. #define IOERR_MISSING_HDR_BUFFER 0x23
  2062. #define IOERR_MSEQ_CHAIN_CORRUPTED 0x24
  2063. #define IOERR_ABORTMULT_REQUESTED 0x25
  2064. #define IOERR_BUFFER_SHORTAGE 0x28
  2065. #define IOERR_DEFAULT 0x29
  2066. #define IOERR_CNT 0x2A
  2067. #define IOERR_DRVR_MASK 0x100
  2068. #define IOERR_SLI_DOWN 0x101 /* ulpStatus - Driver defined */
  2069. #define IOERR_SLI_BRESET 0x102
  2070. #define IOERR_SLI_ABORTED 0x103
  2071. } PARM_ERR;
  2072. typedef union {
  2073. struct {
  2074. #ifdef __BIG_ENDIAN_BITFIELD
  2075. uint8_t Rctl; /* R_CTL field */
  2076. uint8_t Type; /* TYPE field */
  2077. uint8_t Dfctl; /* DF_CTL field */
  2078. uint8_t Fctl; /* Bits 0-7 of IOCB word 5 */
  2079. #else /* __LITTLE_ENDIAN_BITFIELD */
  2080. uint8_t Fctl; /* Bits 0-7 of IOCB word 5 */
  2081. uint8_t Dfctl; /* DF_CTL field */
  2082. uint8_t Type; /* TYPE field */
  2083. uint8_t Rctl; /* R_CTL field */
  2084. #endif
  2085. #define BC 0x02 /* Broadcast Received - Fctl */
  2086. #define SI 0x04 /* Sequence Initiative */
  2087. #define LA 0x08 /* Ignore Link Attention state */
  2088. #define LS 0x80 /* Last Sequence */
  2089. } hcsw;
  2090. uint32_t reserved;
  2091. } WORD5;
  2092. /* IOCB Command template for a generic response */
  2093. typedef struct {
  2094. uint32_t reserved[4];
  2095. PARM_ERR perr;
  2096. } GENERIC_RSP;
  2097. /* IOCB Command template for XMIT / XMIT_BCAST / RCV_SEQUENCE / XMIT_ELS */
  2098. typedef struct {
  2099. struct ulp_bde xrsqbde[2];
  2100. uint32_t xrsqRo; /* Starting Relative Offset */
  2101. WORD5 w5; /* Header control/status word */
  2102. } XR_SEQ_FIELDS;
  2103. /* IOCB Command template for ELS_REQUEST */
  2104. typedef struct {
  2105. struct ulp_bde elsReq;
  2106. struct ulp_bde elsRsp;
  2107. #ifdef __BIG_ENDIAN_BITFIELD
  2108. uint32_t word4Rsvd:7;
  2109. uint32_t fl:1;
  2110. uint32_t myID:24;
  2111. uint32_t word5Rsvd:8;
  2112. uint32_t remoteID:24;
  2113. #else /* __LITTLE_ENDIAN_BITFIELD */
  2114. uint32_t myID:24;
  2115. uint32_t fl:1;
  2116. uint32_t word4Rsvd:7;
  2117. uint32_t remoteID:24;
  2118. uint32_t word5Rsvd:8;
  2119. #endif
  2120. } ELS_REQUEST;
  2121. /* IOCB Command template for RCV_ELS_REQ */
  2122. typedef struct {
  2123. struct ulp_bde elsReq[2];
  2124. uint32_t parmRo;
  2125. #ifdef __BIG_ENDIAN_BITFIELD
  2126. uint32_t word5Rsvd:8;
  2127. uint32_t remoteID:24;
  2128. #else /* __LITTLE_ENDIAN_BITFIELD */
  2129. uint32_t remoteID:24;
  2130. uint32_t word5Rsvd:8;
  2131. #endif
  2132. } RCV_ELS_REQ;
  2133. /* IOCB Command template for ABORT / CLOSE_XRI */
  2134. typedef struct {
  2135. uint32_t rsvd[3];
  2136. uint32_t abortType;
  2137. #define ABORT_TYPE_ABTX 0x00000000
  2138. #define ABORT_TYPE_ABTS 0x00000001
  2139. uint32_t parm;
  2140. #ifdef __BIG_ENDIAN_BITFIELD
  2141. uint16_t abortContextTag; /* ulpContext from command to abort/close */
  2142. uint16_t abortIoTag; /* ulpIoTag from command to abort/close */
  2143. #else /* __LITTLE_ENDIAN_BITFIELD */
  2144. uint16_t abortIoTag; /* ulpIoTag from command to abort/close */
  2145. uint16_t abortContextTag; /* ulpContext from command to abort/close */
  2146. #endif
  2147. } AC_XRI;
  2148. /* IOCB Command template for ABORT_MXRI64 */
  2149. typedef struct {
  2150. uint32_t rsvd[3];
  2151. uint32_t abortType;
  2152. uint32_t parm;
  2153. uint32_t iotag32;
  2154. } A_MXRI64;
  2155. /* IOCB Command template for GET_RPI */
  2156. typedef struct {
  2157. uint32_t rsvd[4];
  2158. uint32_t parmRo;
  2159. #ifdef __BIG_ENDIAN_BITFIELD
  2160. uint32_t word5Rsvd:8;
  2161. uint32_t remoteID:24;
  2162. #else /* __LITTLE_ENDIAN_BITFIELD */
  2163. uint32_t remoteID:24;
  2164. uint32_t word5Rsvd:8;
  2165. #endif
  2166. } GET_RPI;
  2167. /* IOCB Command template for all FCP Initiator commands */
  2168. typedef struct {
  2169. struct ulp_bde fcpi_cmnd; /* FCP_CMND payload descriptor */
  2170. struct ulp_bde fcpi_rsp; /* Rcv buffer */
  2171. uint32_t fcpi_parm;
  2172. uint32_t fcpi_XRdy; /* transfer ready for IWRITE */
  2173. } FCPI_FIELDS;
  2174. /* IOCB Command template for all FCP Target commands */
  2175. typedef struct {
  2176. struct ulp_bde fcpt_Buffer[2]; /* FCP_CMND payload descriptor */
  2177. uint32_t fcpt_Offset;
  2178. uint32_t fcpt_Length; /* transfer ready for IWRITE */
  2179. } FCPT_FIELDS;
  2180. /* SLI-2 IOCB structure definitions */
  2181. /* IOCB Command template for 64 bit XMIT / XMIT_BCAST / XMIT_ELS */
  2182. typedef struct {
  2183. ULP_BDL bdl;
  2184. uint32_t xrsqRo; /* Starting Relative Offset */
  2185. WORD5 w5; /* Header control/status word */
  2186. } XMT_SEQ_FIELDS64;
  2187. /* IOCB Command template for 64 bit RCV_SEQUENCE64 */
  2188. typedef struct {
  2189. struct ulp_bde64 rcvBde;
  2190. uint32_t rsvd1;
  2191. uint32_t xrsqRo; /* Starting Relative Offset */
  2192. WORD5 w5; /* Header control/status word */
  2193. } RCV_SEQ_FIELDS64;
  2194. /* IOCB Command template for ELS_REQUEST64 */
  2195. typedef struct {
  2196. ULP_BDL bdl;
  2197. #ifdef __BIG_ENDIAN_BITFIELD
  2198. uint32_t word4Rsvd:7;
  2199. uint32_t fl:1;
  2200. uint32_t myID:24;
  2201. uint32_t word5Rsvd:8;
  2202. uint32_t remoteID:24;
  2203. #else /* __LITTLE_ENDIAN_BITFIELD */
  2204. uint32_t myID:24;
  2205. uint32_t fl:1;
  2206. uint32_t word4Rsvd:7;
  2207. uint32_t remoteID:24;
  2208. uint32_t word5Rsvd:8;
  2209. #endif
  2210. } ELS_REQUEST64;
  2211. /* IOCB Command template for GEN_REQUEST64 */
  2212. typedef struct {
  2213. ULP_BDL bdl;
  2214. uint32_t xrsqRo; /* Starting Relative Offset */
  2215. WORD5 w5; /* Header control/status word */
  2216. } GEN_REQUEST64;
  2217. /* IOCB Command template for RCV_ELS_REQ64 */
  2218. typedef struct {
  2219. struct ulp_bde64 elsReq;
  2220. uint32_t rcvd1;
  2221. uint32_t parmRo;
  2222. #ifdef __BIG_ENDIAN_BITFIELD
  2223. uint32_t word5Rsvd:8;
  2224. uint32_t remoteID:24;
  2225. #else /* __LITTLE_ENDIAN_BITFIELD */
  2226. uint32_t remoteID:24;
  2227. uint32_t word5Rsvd:8;
  2228. #endif
  2229. } RCV_ELS_REQ64;
  2230. /* IOCB Command template for all 64 bit FCP Initiator commands */
  2231. typedef struct {
  2232. ULP_BDL bdl;
  2233. uint32_t fcpi_parm;
  2234. uint32_t fcpi_XRdy; /* transfer ready for IWRITE */
  2235. } FCPI_FIELDS64;
  2236. /* IOCB Command template for all 64 bit FCP Target commands */
  2237. typedef struct {
  2238. ULP_BDL bdl;
  2239. uint32_t fcpt_Offset;
  2240. uint32_t fcpt_Length; /* transfer ready for IWRITE */
  2241. } FCPT_FIELDS64;
  2242. typedef struct _IOCB { /* IOCB structure */
  2243. union {
  2244. GENERIC_RSP grsp; /* Generic response */
  2245. XR_SEQ_FIELDS xrseq; /* XMIT / BCAST / RCV_SEQUENCE cmd */
  2246. struct ulp_bde cont[3]; /* up to 3 continuation bdes */
  2247. RCV_ELS_REQ rcvels; /* RCV_ELS_REQ template */
  2248. AC_XRI acxri; /* ABORT / CLOSE_XRI template */
  2249. A_MXRI64 amxri; /* abort multiple xri command overlay */
  2250. GET_RPI getrpi; /* GET_RPI template */
  2251. FCPI_FIELDS fcpi; /* FCP Initiator template */
  2252. FCPT_FIELDS fcpt; /* FCP target template */
  2253. /* SLI-2 structures */
  2254. struct ulp_bde64 cont64[2]; /* up to 2 64 bit continuation
  2255. bde_64s */
  2256. ELS_REQUEST64 elsreq64; /* ELS_REQUEST template */
  2257. GEN_REQUEST64 genreq64; /* GEN_REQUEST template */
  2258. RCV_ELS_REQ64 rcvels64; /* RCV_ELS_REQ template */
  2259. XMT_SEQ_FIELDS64 xseq64; /* XMIT / BCAST cmd */
  2260. FCPI_FIELDS64 fcpi64; /* FCP 64 bit Initiator template */
  2261. FCPT_FIELDS64 fcpt64; /* FCP 64 bit target template */
  2262. uint32_t ulpWord[IOCB_WORD_SZ - 2]; /* generic 6 'words' */
  2263. } un;
  2264. union {
  2265. struct {
  2266. #ifdef __BIG_ENDIAN_BITFIELD
  2267. uint16_t ulpContext; /* High order bits word 6 */
  2268. uint16_t ulpIoTag; /* Low order bits word 6 */
  2269. #else /* __LITTLE_ENDIAN_BITFIELD */
  2270. uint16_t ulpIoTag; /* Low order bits word 6 */
  2271. uint16_t ulpContext; /* High order bits word 6 */
  2272. #endif
  2273. } t1;
  2274. struct {
  2275. #ifdef __BIG_ENDIAN_BITFIELD
  2276. uint16_t ulpContext; /* High order bits word 6 */
  2277. uint16_t ulpIoTag1:2; /* Low order bits word 6 */
  2278. uint16_t ulpIoTag0:14; /* Low order bits word 6 */
  2279. #else /* __LITTLE_ENDIAN_BITFIELD */
  2280. uint16_t ulpIoTag0:14; /* Low order bits word 6 */
  2281. uint16_t ulpIoTag1:2; /* Low order bits word 6 */
  2282. uint16_t ulpContext; /* High order bits word 6 */
  2283. #endif
  2284. } t2;
  2285. } un1;
  2286. #define ulpContext un1.t1.ulpContext
  2287. #define ulpIoTag un1.t1.ulpIoTag
  2288. #define ulpIoTag0 un1.t2.ulpIoTag0
  2289. #ifdef __BIG_ENDIAN_BITFIELD
  2290. uint32_t ulpTimeout:8;
  2291. uint32_t ulpXS:1;
  2292. uint32_t ulpFCP2Rcvy:1;
  2293. uint32_t ulpPU:2;
  2294. uint32_t ulpIr:1;
  2295. uint32_t ulpClass:3;
  2296. uint32_t ulpCommand:8;
  2297. uint32_t ulpStatus:4;
  2298. uint32_t ulpBdeCount:2;
  2299. uint32_t ulpLe:1;
  2300. uint32_t ulpOwner:1; /* Low order bit word 7 */
  2301. #else /* __LITTLE_ENDIAN_BITFIELD */
  2302. uint32_t ulpOwner:1; /* Low order bit word 7 */
  2303. uint32_t ulpLe:1;
  2304. uint32_t ulpBdeCount:2;
  2305. uint32_t ulpStatus:4;
  2306. uint32_t ulpCommand:8;
  2307. uint32_t ulpClass:3;
  2308. uint32_t ulpIr:1;
  2309. uint32_t ulpPU:2;
  2310. uint32_t ulpFCP2Rcvy:1;
  2311. uint32_t ulpXS:1;
  2312. uint32_t ulpTimeout:8;
  2313. #endif
  2314. #define PARM_UNUSED 0 /* PU field (Word 4) not used */
  2315. #define PARM_REL_OFF 1 /* PU field (Word 4) = R. O. */
  2316. #define PARM_READ_CHECK 2 /* PU field (Word 4) = Data Transfer Length */
  2317. #define CLASS1 0 /* Class 1 */
  2318. #define CLASS2 1 /* Class 2 */
  2319. #define CLASS3 2 /* Class 3 */
  2320. #define CLASS_FCP_INTERMIX 7 /* FCP Data->Cls 1, all else->Cls 2 */
  2321. #define IOSTAT_SUCCESS 0x0 /* ulpStatus - HBA defined */
  2322. #define IOSTAT_FCP_RSP_ERROR 0x1
  2323. #define IOSTAT_REMOTE_STOP 0x2
  2324. #define IOSTAT_LOCAL_REJECT 0x3
  2325. #define IOSTAT_NPORT_RJT 0x4
  2326. #define IOSTAT_FABRIC_RJT 0x5
  2327. #define IOSTAT_NPORT_BSY 0x6
  2328. #define IOSTAT_FABRIC_BSY 0x7
  2329. #define IOSTAT_INTERMED_RSP 0x8
  2330. #define IOSTAT_LS_RJT 0x9
  2331. #define IOSTAT_BA_RJT 0xA
  2332. #define IOSTAT_RSVD1 0xB
  2333. #define IOSTAT_RSVD2 0xC
  2334. #define IOSTAT_RSVD3 0xD
  2335. #define IOSTAT_RSVD4 0xE
  2336. #define IOSTAT_RSVD5 0xF
  2337. #define IOSTAT_DRIVER_REJECT 0x10 /* ulpStatus - Driver defined */
  2338. #define IOSTAT_DEFAULT 0xF /* Same as rsvd5 for now */
  2339. #define IOSTAT_CNT 0x11
  2340. } IOCB_t;
  2341. #define SLI1_SLIM_SIZE (4 * 1024)
  2342. /* Up to 498 IOCBs will fit into 16k
  2343. * 256 (MAILBOX_t) + 140 (PCB_t) + ( 32 (IOCB_t) * 498 ) = < 16384
  2344. */
  2345. #define SLI2_SLIM_SIZE (16 * 1024)
  2346. /* Maximum IOCBs that will fit in SLI2 slim */
  2347. #define MAX_SLI2_IOCB 498
  2348. struct lpfc_sli2_slim {
  2349. MAILBOX_t mbx;
  2350. PCB_t pcb;
  2351. IOCB_t IOCBs[MAX_SLI2_IOCB];
  2352. };
  2353. /*******************************************************************
  2354. This macro check PCI device to allow special handling for LC HBAs.
  2355. Parameters:
  2356. device : struct pci_dev 's device field
  2357. return 1 => TRUE
  2358. 0 => FALSE
  2359. *******************************************************************/
  2360. static inline int
  2361. lpfc_is_LC_HBA(unsigned short device)
  2362. {
  2363. if ((device == PCI_DEVICE_ID_TFLY) ||
  2364. (device == PCI_DEVICE_ID_PFLY) ||
  2365. (device == PCI_DEVICE_ID_LP101) ||
  2366. (device == PCI_DEVICE_ID_BMID) ||
  2367. (device == PCI_DEVICE_ID_BSMB) ||
  2368. (device == PCI_DEVICE_ID_ZMID) ||
  2369. (device == PCI_DEVICE_ID_ZSMB) ||
  2370. (device == PCI_DEVICE_ID_RFLY))
  2371. return 1;
  2372. else
  2373. return 0;
  2374. }