lpfc_hw.h 96 KB

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