lpfc_hw.h 78 KB

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