lpfc_hw.h 77 KB

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