lpfc_hw.h 89 KB

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