lpfc_hw.h 125 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223
  1. /*******************************************************************
  2. * This file is part of the Emulex Linux Device Driver for *
  3. * Fibre Channel Host Bus Adapters. *
  4. * Copyright (C) 2004-2016 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 10 /* Default RA_TOV (10s) */
  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 LPFC_FCP_OAS_RING 3
  43. #define SLI2_IOCB_CMD_R0_ENTRIES 172 /* SLI-2 FCP command ring entries */
  44. #define SLI2_IOCB_RSP_R0_ENTRIES 134 /* SLI-2 FCP response ring entries */
  45. #define SLI2_IOCB_CMD_R1_ENTRIES 4 /* SLI-2 extra command ring entries */
  46. #define SLI2_IOCB_RSP_R1_ENTRIES 4 /* SLI-2 extra response ring entries */
  47. #define SLI2_IOCB_CMD_R1XTRA_ENTRIES 36 /* SLI-2 extra FCP cmd ring entries */
  48. #define SLI2_IOCB_RSP_R1XTRA_ENTRIES 52 /* SLI-2 extra FCP rsp ring entries */
  49. #define SLI2_IOCB_CMD_R2_ENTRIES 20 /* SLI-2 ELS command ring entries */
  50. #define SLI2_IOCB_RSP_R2_ENTRIES 20 /* SLI-2 ELS response ring entries */
  51. #define SLI2_IOCB_CMD_R3_ENTRIES 0
  52. #define SLI2_IOCB_RSP_R3_ENTRIES 0
  53. #define SLI2_IOCB_CMD_R3XTRA_ENTRIES 24
  54. #define SLI2_IOCB_RSP_R3XTRA_ENTRIES 32
  55. #define SLI2_IOCB_CMD_SIZE 32
  56. #define SLI2_IOCB_RSP_SIZE 32
  57. #define SLI3_IOCB_CMD_SIZE 128
  58. #define SLI3_IOCB_RSP_SIZE 64
  59. #define LPFC_UNREG_ALL_RPIS_VPORT 0xffff
  60. #define LPFC_UNREG_ALL_DFLT_RPIS 0xffffffff
  61. /* vendor ID used in SCSI netlink calls */
  62. #define LPFC_NL_VENDOR_ID (SCSI_NL_VID_TYPE_PCI | PCI_VENDOR_ID_EMULEX)
  63. #define FW_REV_STR_SIZE 32
  64. /* Common Transport structures and definitions */
  65. union CtRevisionId {
  66. /* Structure is in Big Endian format */
  67. struct {
  68. uint32_t Revision:8;
  69. uint32_t InId:24;
  70. } bits;
  71. uint32_t word;
  72. };
  73. union CtCommandResponse {
  74. /* Structure is in Big Endian format */
  75. struct {
  76. uint32_t CmdRsp:16;
  77. uint32_t Size:16;
  78. } bits;
  79. uint32_t word;
  80. };
  81. #define FC4_FEATURE_INIT 0x2
  82. #define FC4_FEATURE_TARGET 0x1
  83. struct lpfc_sli_ct_request {
  84. /* Structure is in Big Endian format */
  85. union CtRevisionId RevisionId;
  86. uint8_t FsType;
  87. uint8_t FsSubType;
  88. uint8_t Options;
  89. uint8_t Rsrvd1;
  90. union CtCommandResponse CommandResponse;
  91. uint8_t Rsrvd2;
  92. uint8_t ReasonCode;
  93. uint8_t Explanation;
  94. uint8_t VendorUnique;
  95. #define LPFC_CT_PREAMBLE 20 /* Size of CTReq + 4 up to here */
  96. union {
  97. uint32_t PortID;
  98. struct gid {
  99. uint8_t PortType; /* for GID_PT requests */
  100. uint8_t DomainScope;
  101. uint8_t AreaScope;
  102. uint8_t Fc4Type; /* for GID_FT requests */
  103. } gid;
  104. struct rft {
  105. uint32_t PortId; /* For RFT_ID requests */
  106. #ifdef __BIG_ENDIAN_BITFIELD
  107. uint32_t rsvd0:16;
  108. uint32_t rsvd1:7;
  109. uint32_t fcpReg:1; /* Type 8 */
  110. uint32_t rsvd2:2;
  111. uint32_t ipReg:1; /* Type 5 */
  112. uint32_t rsvd3:5;
  113. #else /* __LITTLE_ENDIAN_BITFIELD */
  114. uint32_t rsvd0:16;
  115. uint32_t fcpReg:1; /* Type 8 */
  116. uint32_t rsvd1:7;
  117. uint32_t rsvd3:5;
  118. uint32_t ipReg:1; /* Type 5 */
  119. uint32_t rsvd2:2;
  120. #endif
  121. uint32_t rsvd[7];
  122. } rft;
  123. struct rnn {
  124. uint32_t PortId; /* For RNN_ID requests */
  125. uint8_t wwnn[8];
  126. } rnn;
  127. struct rsnn { /* For RSNN_ID requests */
  128. uint8_t wwnn[8];
  129. uint8_t len;
  130. uint8_t symbname[255];
  131. } rsnn;
  132. struct da_id { /* For DA_ID requests */
  133. uint32_t port_id;
  134. } da_id;
  135. struct rspn { /* For RSPN_ID requests */
  136. uint32_t PortId;
  137. uint8_t len;
  138. uint8_t symbname[255];
  139. } rspn;
  140. struct gff {
  141. uint32_t PortId;
  142. } gff;
  143. struct gff_acc {
  144. uint8_t fbits[128];
  145. } gff_acc;
  146. #define FCP_TYPE_FEATURE_OFFSET 7
  147. struct rff {
  148. uint32_t PortId;
  149. uint8_t reserved[2];
  150. uint8_t fbits;
  151. uint8_t type_code; /* type=8 for FCP */
  152. } rff;
  153. } un;
  154. };
  155. #define LPFC_MAX_CT_SIZE (60 * 4096)
  156. #define SLI_CT_REVISION 1
  157. #define GID_REQUEST_SZ (offsetof(struct lpfc_sli_ct_request, un) + \
  158. sizeof(struct gid))
  159. #define GFF_REQUEST_SZ (offsetof(struct lpfc_sli_ct_request, un) + \
  160. sizeof(struct gff))
  161. #define RFT_REQUEST_SZ (offsetof(struct lpfc_sli_ct_request, un) + \
  162. sizeof(struct rft))
  163. #define RFF_REQUEST_SZ (offsetof(struct lpfc_sli_ct_request, un) + \
  164. sizeof(struct rff))
  165. #define RNN_REQUEST_SZ (offsetof(struct lpfc_sli_ct_request, un) + \
  166. sizeof(struct rnn))
  167. #define RSNN_REQUEST_SZ (offsetof(struct lpfc_sli_ct_request, un) + \
  168. sizeof(struct rsnn))
  169. #define DA_ID_REQUEST_SZ (offsetof(struct lpfc_sli_ct_request, un) + \
  170. sizeof(struct da_id))
  171. #define RSPN_REQUEST_SZ (offsetof(struct lpfc_sli_ct_request, un) + \
  172. sizeof(struct rspn))
  173. /*
  174. * FsType Definitions
  175. */
  176. #define SLI_CT_MANAGEMENT_SERVICE 0xFA
  177. #define SLI_CT_TIME_SERVICE 0xFB
  178. #define SLI_CT_DIRECTORY_SERVICE 0xFC
  179. #define SLI_CT_FABRIC_CONTROLLER_SERVICE 0xFD
  180. /*
  181. * Directory Service Subtypes
  182. */
  183. #define SLI_CT_DIRECTORY_NAME_SERVER 0x02
  184. /*
  185. * Response Codes
  186. */
  187. #define SLI_CT_RESPONSE_FS_RJT 0x8001
  188. #define SLI_CT_RESPONSE_FS_ACC 0x8002
  189. /*
  190. * Reason Codes
  191. */
  192. #define SLI_CT_NO_ADDITIONAL_EXPL 0x0
  193. #define SLI_CT_INVALID_COMMAND 0x01
  194. #define SLI_CT_INVALID_VERSION 0x02
  195. #define SLI_CT_LOGICAL_ERROR 0x03
  196. #define SLI_CT_INVALID_IU_SIZE 0x04
  197. #define SLI_CT_LOGICAL_BUSY 0x05
  198. #define SLI_CT_PROTOCOL_ERROR 0x07
  199. #define SLI_CT_UNABLE_TO_PERFORM_REQ 0x09
  200. #define SLI_CT_REQ_NOT_SUPPORTED 0x0b
  201. #define SLI_CT_HBA_INFO_NOT_REGISTERED 0x10
  202. #define SLI_CT_MULTIPLE_HBA_ATTR_OF_SAME_TYPE 0x11
  203. #define SLI_CT_INVALID_HBA_ATTR_BLOCK_LEN 0x12
  204. #define SLI_CT_HBA_ATTR_NOT_PRESENT 0x13
  205. #define SLI_CT_PORT_INFO_NOT_REGISTERED 0x20
  206. #define SLI_CT_MULTIPLE_PORT_ATTR_OF_SAME_TYPE 0x21
  207. #define SLI_CT_INVALID_PORT_ATTR_BLOCK_LEN 0x22
  208. #define SLI_CT_VENDOR_UNIQUE 0xff
  209. /*
  210. * Name Server SLI_CT_UNABLE_TO_PERFORM_REQ Explanations
  211. */
  212. #define SLI_CT_NO_PORT_ID 0x01
  213. #define SLI_CT_NO_PORT_NAME 0x02
  214. #define SLI_CT_NO_NODE_NAME 0x03
  215. #define SLI_CT_NO_CLASS_OF_SERVICE 0x04
  216. #define SLI_CT_NO_IP_ADDRESS 0x05
  217. #define SLI_CT_NO_IPA 0x06
  218. #define SLI_CT_NO_FC4_TYPES 0x07
  219. #define SLI_CT_NO_SYMBOLIC_PORT_NAME 0x08
  220. #define SLI_CT_NO_SYMBOLIC_NODE_NAME 0x09
  221. #define SLI_CT_NO_PORT_TYPE 0x0A
  222. #define SLI_CT_ACCESS_DENIED 0x10
  223. #define SLI_CT_INVALID_PORT_ID 0x11
  224. #define SLI_CT_DATABASE_EMPTY 0x12
  225. /*
  226. * Name Server Command Codes
  227. */
  228. #define SLI_CTNS_GA_NXT 0x0100
  229. #define SLI_CTNS_GPN_ID 0x0112
  230. #define SLI_CTNS_GNN_ID 0x0113
  231. #define SLI_CTNS_GCS_ID 0x0114
  232. #define SLI_CTNS_GFT_ID 0x0117
  233. #define SLI_CTNS_GSPN_ID 0x0118
  234. #define SLI_CTNS_GPT_ID 0x011A
  235. #define SLI_CTNS_GFF_ID 0x011F
  236. #define SLI_CTNS_GID_PN 0x0121
  237. #define SLI_CTNS_GID_NN 0x0131
  238. #define SLI_CTNS_GIP_NN 0x0135
  239. #define SLI_CTNS_GIPA_NN 0x0136
  240. #define SLI_CTNS_GSNN_NN 0x0139
  241. #define SLI_CTNS_GNN_IP 0x0153
  242. #define SLI_CTNS_GIPA_IP 0x0156
  243. #define SLI_CTNS_GID_FT 0x0171
  244. #define SLI_CTNS_GID_PT 0x01A1
  245. #define SLI_CTNS_RPN_ID 0x0212
  246. #define SLI_CTNS_RNN_ID 0x0213
  247. #define SLI_CTNS_RCS_ID 0x0214
  248. #define SLI_CTNS_RFT_ID 0x0217
  249. #define SLI_CTNS_RSPN_ID 0x0218
  250. #define SLI_CTNS_RPT_ID 0x021A
  251. #define SLI_CTNS_RFF_ID 0x021F
  252. #define SLI_CTNS_RIP_NN 0x0235
  253. #define SLI_CTNS_RIPA_NN 0x0236
  254. #define SLI_CTNS_RSNN_NN 0x0239
  255. #define SLI_CTNS_DA_ID 0x0300
  256. /*
  257. * Port Types
  258. */
  259. #define SLI_CTPT_N_PORT 0x01
  260. #define SLI_CTPT_NL_PORT 0x02
  261. #define SLI_CTPT_FNL_PORT 0x03
  262. #define SLI_CTPT_IP 0x04
  263. #define SLI_CTPT_FCP 0x08
  264. #define SLI_CTPT_NX_PORT 0x7F
  265. #define SLI_CTPT_F_PORT 0x81
  266. #define SLI_CTPT_FL_PORT 0x82
  267. #define SLI_CTPT_E_PORT 0x84
  268. #define SLI_CT_LAST_ENTRY 0x80000000
  269. /* Fibre Channel Service Parameter definitions */
  270. #define FC_PH_4_0 6 /* FC-PH version 4.0 */
  271. #define FC_PH_4_1 7 /* FC-PH version 4.1 */
  272. #define FC_PH_4_2 8 /* FC-PH version 4.2 */
  273. #define FC_PH_4_3 9 /* FC-PH version 4.3 */
  274. #define FC_PH_LOW 8 /* Lowest supported FC-PH version */
  275. #define FC_PH_HIGH 9 /* Highest supported FC-PH version */
  276. #define FC_PH3 0x20 /* FC-PH-3 version */
  277. #define FF_FRAME_SIZE 2048
  278. struct lpfc_name {
  279. union {
  280. struct {
  281. #ifdef __BIG_ENDIAN_BITFIELD
  282. uint8_t nameType:4; /* FC Word 0, bit 28:31 */
  283. uint8_t IEEEextMsn:4; /* FC Word 0, bit 24:27, bit
  284. 8:11 of IEEE ext */
  285. #else /* __LITTLE_ENDIAN_BITFIELD */
  286. uint8_t IEEEextMsn:4; /* FC Word 0, bit 24:27, bit
  287. 8:11 of IEEE ext */
  288. uint8_t nameType:4; /* FC Word 0, bit 28:31 */
  289. #endif
  290. #define NAME_IEEE 0x1 /* IEEE name - nameType */
  291. #define NAME_IEEE_EXT 0x2 /* IEEE extended name */
  292. #define NAME_FC_TYPE 0x3 /* FC native name type */
  293. #define NAME_IP_TYPE 0x4 /* IP address */
  294. #define NAME_CCITT_TYPE 0xC
  295. #define NAME_CCITT_GR_TYPE 0xE
  296. uint8_t IEEEextLsb; /* FC Word 0, bit 16:23, IEEE
  297. extended Lsb */
  298. uint8_t IEEE[6]; /* FC IEEE address */
  299. } s;
  300. uint8_t wwn[8];
  301. } u;
  302. };
  303. struct csp {
  304. uint8_t fcphHigh; /* FC Word 0, byte 0 */
  305. uint8_t fcphLow;
  306. uint8_t bbCreditMsb;
  307. uint8_t bbCreditLsb; /* FC Word 0, byte 3 */
  308. /*
  309. * Word 1 Bit 31 in common service parameter is overloaded.
  310. * Word 1 Bit 31 in FLOGI request is multiple NPort request
  311. * Word 1 Bit 31 in FLOGI response is clean address bit
  312. */
  313. #define clean_address_bit request_multiple_Nport /* Word 1, bit 31 */
  314. /*
  315. * Word 1 Bit 30 in common service parameter is overloaded.
  316. * Word 1 Bit 30 in FLOGI request is Virtual Fabrics
  317. * Word 1 Bit 30 in PLOGI request is random offset
  318. */
  319. #define virtual_fabric_support randomOffset /* Word 1, bit 30 */
  320. /*
  321. * Word 1 Bit 29 in common service parameter is overloaded.
  322. * Word 1 Bit 29 in FLOGI response is multiple NPort assignment
  323. * Word 1 Bit 29 in FLOGI/PLOGI request is Valid Vendor Version Level
  324. */
  325. #define valid_vendor_ver_level response_multiple_NPort /* Word 1, bit 29 */
  326. #ifdef __BIG_ENDIAN_BITFIELD
  327. uint16_t request_multiple_Nport:1; /* FC Word 1, bit 31 */
  328. uint16_t randomOffset:1; /* FC Word 1, bit 30 */
  329. uint16_t response_multiple_NPort:1; /* FC Word 1, bit 29 */
  330. uint16_t fPort:1; /* FC Word 1, bit 28 */
  331. uint16_t altBbCredit:1; /* FC Word 1, bit 27 */
  332. uint16_t edtovResolution:1; /* FC Word 1, bit 26 */
  333. uint16_t multicast:1; /* FC Word 1, bit 25 */
  334. uint16_t broadcast:1; /* FC Word 1, bit 24 */
  335. uint16_t huntgroup:1; /* FC Word 1, bit 23 */
  336. uint16_t simplex:1; /* FC Word 1, bit 22 */
  337. uint16_t word1Reserved1:3; /* FC Word 1, bit 21:19 */
  338. uint16_t dhd:1; /* FC Word 1, bit 18 */
  339. uint16_t contIncSeqCnt:1; /* FC Word 1, bit 17 */
  340. uint16_t payloadlength:1; /* FC Word 1, bit 16 */
  341. #else /* __LITTLE_ENDIAN_BITFIELD */
  342. uint16_t broadcast:1; /* FC Word 1, bit 24 */
  343. uint16_t multicast:1; /* FC Word 1, bit 25 */
  344. uint16_t edtovResolution:1; /* FC Word 1, bit 26 */
  345. uint16_t altBbCredit:1; /* FC Word 1, bit 27 */
  346. uint16_t fPort:1; /* FC Word 1, bit 28 */
  347. uint16_t response_multiple_NPort:1; /* FC Word 1, bit 29 */
  348. uint16_t randomOffset:1; /* FC Word 1, bit 30 */
  349. uint16_t request_multiple_Nport:1; /* FC Word 1, bit 31 */
  350. uint16_t payloadlength:1; /* FC Word 1, bit 16 */
  351. uint16_t contIncSeqCnt:1; /* FC Word 1, bit 17 */
  352. uint16_t dhd:1; /* FC Word 1, bit 18 */
  353. uint16_t word1Reserved1:3; /* FC Word 1, bit 21:19 */
  354. uint16_t simplex:1; /* FC Word 1, bit 22 */
  355. uint16_t huntgroup:1; /* FC Word 1, bit 23 */
  356. #endif
  357. uint8_t bbRcvSizeMsb; /* Upper nibble is reserved */
  358. uint8_t bbRcvSizeLsb; /* FC Word 1, byte 3 */
  359. union {
  360. struct {
  361. uint8_t word2Reserved1; /* FC Word 2 byte 0 */
  362. uint8_t totalConcurrSeq; /* FC Word 2 byte 1 */
  363. uint8_t roByCategoryMsb; /* FC Word 2 byte 2 */
  364. uint8_t roByCategoryLsb; /* FC Word 2 byte 3 */
  365. } nPort;
  366. uint32_t r_a_tov; /* R_A_TOV must be in B.E. format */
  367. } w2;
  368. uint32_t e_d_tov; /* E_D_TOV must be in B.E. format */
  369. };
  370. struct class_parms {
  371. #ifdef __BIG_ENDIAN_BITFIELD
  372. uint8_t classValid:1; /* FC Word 0, bit 31 */
  373. uint8_t intermix:1; /* FC Word 0, bit 30 */
  374. uint8_t stackedXparent:1; /* FC Word 0, bit 29 */
  375. uint8_t stackedLockDown:1; /* FC Word 0, bit 28 */
  376. uint8_t seqDelivery:1; /* FC Word 0, bit 27 */
  377. uint8_t word0Reserved1:3; /* FC Word 0, bit 24:26 */
  378. #else /* __LITTLE_ENDIAN_BITFIELD */
  379. uint8_t word0Reserved1:3; /* FC Word 0, bit 24:26 */
  380. uint8_t seqDelivery:1; /* FC Word 0, bit 27 */
  381. uint8_t stackedLockDown:1; /* FC Word 0, bit 28 */
  382. uint8_t stackedXparent:1; /* FC Word 0, bit 29 */
  383. uint8_t intermix:1; /* FC Word 0, bit 30 */
  384. uint8_t classValid:1; /* FC Word 0, bit 31 */
  385. #endif
  386. uint8_t word0Reserved2; /* FC Word 0, bit 16:23 */
  387. #ifdef __BIG_ENDIAN_BITFIELD
  388. uint8_t iCtlXidReAssgn:2; /* FC Word 0, Bit 14:15 */
  389. uint8_t iCtlInitialPa:2; /* FC Word 0, bit 12:13 */
  390. uint8_t iCtlAck0capable:1; /* FC Word 0, bit 11 */
  391. uint8_t iCtlAckNcapable:1; /* FC Word 0, bit 10 */
  392. uint8_t word0Reserved3:2; /* FC Word 0, bit 8: 9 */
  393. #else /* __LITTLE_ENDIAN_BITFIELD */
  394. uint8_t word0Reserved3:2; /* FC Word 0, bit 8: 9 */
  395. uint8_t iCtlAckNcapable:1; /* FC Word 0, bit 10 */
  396. uint8_t iCtlAck0capable:1; /* FC Word 0, bit 11 */
  397. uint8_t iCtlInitialPa:2; /* FC Word 0, bit 12:13 */
  398. uint8_t iCtlXidReAssgn:2; /* FC Word 0, Bit 14:15 */
  399. #endif
  400. uint8_t word0Reserved4; /* FC Word 0, bit 0: 7 */
  401. #ifdef __BIG_ENDIAN_BITFIELD
  402. uint8_t rCtlAck0capable:1; /* FC Word 1, bit 31 */
  403. uint8_t rCtlAckNcapable:1; /* FC Word 1, bit 30 */
  404. uint8_t rCtlXidInterlck:1; /* FC Word 1, bit 29 */
  405. uint8_t rCtlErrorPolicy:2; /* FC Word 1, bit 27:28 */
  406. uint8_t word1Reserved1:1; /* FC Word 1, bit 26 */
  407. uint8_t rCtlCatPerSeq:2; /* FC Word 1, bit 24:25 */
  408. #else /* __LITTLE_ENDIAN_BITFIELD */
  409. uint8_t rCtlCatPerSeq:2; /* FC Word 1, bit 24:25 */
  410. uint8_t word1Reserved1:1; /* FC Word 1, bit 26 */
  411. uint8_t rCtlErrorPolicy:2; /* FC Word 1, bit 27:28 */
  412. uint8_t rCtlXidInterlck:1; /* FC Word 1, bit 29 */
  413. uint8_t rCtlAckNcapable:1; /* FC Word 1, bit 30 */
  414. uint8_t rCtlAck0capable:1; /* FC Word 1, bit 31 */
  415. #endif
  416. uint8_t word1Reserved2; /* FC Word 1, bit 16:23 */
  417. uint8_t rcvDataSizeMsb; /* FC Word 1, bit 8:15 */
  418. uint8_t rcvDataSizeLsb; /* FC Word 1, bit 0: 7 */
  419. uint8_t concurrentSeqMsb; /* FC Word 2, bit 24:31 */
  420. uint8_t concurrentSeqLsb; /* FC Word 2, bit 16:23 */
  421. uint8_t EeCreditSeqMsb; /* FC Word 2, bit 8:15 */
  422. uint8_t EeCreditSeqLsb; /* FC Word 2, bit 0: 7 */
  423. uint8_t openSeqPerXchgMsb; /* FC Word 3, bit 24:31 */
  424. uint8_t openSeqPerXchgLsb; /* FC Word 3, bit 16:23 */
  425. uint8_t word3Reserved1; /* Fc Word 3, bit 8:15 */
  426. uint8_t word3Reserved2; /* Fc Word 3, bit 0: 7 */
  427. };
  428. struct serv_parm { /* Structure is in Big Endian format */
  429. struct csp cmn;
  430. struct lpfc_name portName;
  431. struct lpfc_name nodeName;
  432. struct class_parms cls1;
  433. struct class_parms cls2;
  434. struct class_parms cls3;
  435. struct class_parms cls4;
  436. uint8_t vendorVersion[16];
  437. };
  438. /*
  439. * Virtual Fabric Tagging Header
  440. */
  441. struct fc_vft_header {
  442. uint32_t word0;
  443. #define fc_vft_hdr_r_ctl_SHIFT 24
  444. #define fc_vft_hdr_r_ctl_MASK 0xFF
  445. #define fc_vft_hdr_r_ctl_WORD word0
  446. #define fc_vft_hdr_ver_SHIFT 22
  447. #define fc_vft_hdr_ver_MASK 0x3
  448. #define fc_vft_hdr_ver_WORD word0
  449. #define fc_vft_hdr_type_SHIFT 18
  450. #define fc_vft_hdr_type_MASK 0xF
  451. #define fc_vft_hdr_type_WORD word0
  452. #define fc_vft_hdr_e_SHIFT 16
  453. #define fc_vft_hdr_e_MASK 0x1
  454. #define fc_vft_hdr_e_WORD word0
  455. #define fc_vft_hdr_priority_SHIFT 13
  456. #define fc_vft_hdr_priority_MASK 0x7
  457. #define fc_vft_hdr_priority_WORD word0
  458. #define fc_vft_hdr_vf_id_SHIFT 1
  459. #define fc_vft_hdr_vf_id_MASK 0xFFF
  460. #define fc_vft_hdr_vf_id_WORD word0
  461. uint32_t word1;
  462. #define fc_vft_hdr_hopct_SHIFT 24
  463. #define fc_vft_hdr_hopct_MASK 0xFF
  464. #define fc_vft_hdr_hopct_WORD word1
  465. };
  466. /*
  467. * Extended Link Service LS_COMMAND codes (Payload Word 0)
  468. */
  469. #ifdef __BIG_ENDIAN_BITFIELD
  470. #define ELS_CMD_MASK 0xffff0000
  471. #define ELS_RSP_MASK 0xff000000
  472. #define ELS_CMD_LS_RJT 0x01000000
  473. #define ELS_CMD_ACC 0x02000000
  474. #define ELS_CMD_PLOGI 0x03000000
  475. #define ELS_CMD_FLOGI 0x04000000
  476. #define ELS_CMD_LOGO 0x05000000
  477. #define ELS_CMD_ABTX 0x06000000
  478. #define ELS_CMD_RCS 0x07000000
  479. #define ELS_CMD_RES 0x08000000
  480. #define ELS_CMD_RSS 0x09000000
  481. #define ELS_CMD_RSI 0x0A000000
  482. #define ELS_CMD_ESTS 0x0B000000
  483. #define ELS_CMD_ESTC 0x0C000000
  484. #define ELS_CMD_ADVC 0x0D000000
  485. #define ELS_CMD_RTV 0x0E000000
  486. #define ELS_CMD_RLS 0x0F000000
  487. #define ELS_CMD_ECHO 0x10000000
  488. #define ELS_CMD_TEST 0x11000000
  489. #define ELS_CMD_RRQ 0x12000000
  490. #define ELS_CMD_REC 0x13000000
  491. #define ELS_CMD_RDP 0x18000000
  492. #define ELS_CMD_PRLI 0x20100014
  493. #define ELS_CMD_PRLO 0x21100014
  494. #define ELS_CMD_PRLO_ACC 0x02100014
  495. #define ELS_CMD_PDISC 0x50000000
  496. #define ELS_CMD_FDISC 0x51000000
  497. #define ELS_CMD_ADISC 0x52000000
  498. #define ELS_CMD_FARP 0x54000000
  499. #define ELS_CMD_FARPR 0x55000000
  500. #define ELS_CMD_RPS 0x56000000
  501. #define ELS_CMD_RPL 0x57000000
  502. #define ELS_CMD_FAN 0x60000000
  503. #define ELS_CMD_RSCN 0x61040000
  504. #define ELS_CMD_SCR 0x62000000
  505. #define ELS_CMD_RNID 0x78000000
  506. #define ELS_CMD_LIRR 0x7A000000
  507. #define ELS_CMD_LCB 0x81000000
  508. #else /* __LITTLE_ENDIAN_BITFIELD */
  509. #define ELS_CMD_MASK 0xffff
  510. #define ELS_RSP_MASK 0xff
  511. #define ELS_CMD_LS_RJT 0x01
  512. #define ELS_CMD_ACC 0x02
  513. #define ELS_CMD_PLOGI 0x03
  514. #define ELS_CMD_FLOGI 0x04
  515. #define ELS_CMD_LOGO 0x05
  516. #define ELS_CMD_ABTX 0x06
  517. #define ELS_CMD_RCS 0x07
  518. #define ELS_CMD_RES 0x08
  519. #define ELS_CMD_RSS 0x09
  520. #define ELS_CMD_RSI 0x0A
  521. #define ELS_CMD_ESTS 0x0B
  522. #define ELS_CMD_ESTC 0x0C
  523. #define ELS_CMD_ADVC 0x0D
  524. #define ELS_CMD_RTV 0x0E
  525. #define ELS_CMD_RLS 0x0F
  526. #define ELS_CMD_ECHO 0x10
  527. #define ELS_CMD_TEST 0x11
  528. #define ELS_CMD_RRQ 0x12
  529. #define ELS_CMD_REC 0x13
  530. #define ELS_CMD_RDP 0x18
  531. #define ELS_CMD_PRLI 0x14001020
  532. #define ELS_CMD_PRLO 0x14001021
  533. #define ELS_CMD_PRLO_ACC 0x14001002
  534. #define ELS_CMD_PDISC 0x50
  535. #define ELS_CMD_FDISC 0x51
  536. #define ELS_CMD_ADISC 0x52
  537. #define ELS_CMD_FARP 0x54
  538. #define ELS_CMD_FARPR 0x55
  539. #define ELS_CMD_RPS 0x56
  540. #define ELS_CMD_RPL 0x57
  541. #define ELS_CMD_FAN 0x60
  542. #define ELS_CMD_RSCN 0x0461
  543. #define ELS_CMD_SCR 0x62
  544. #define ELS_CMD_RNID 0x78
  545. #define ELS_CMD_LIRR 0x7A
  546. #define ELS_CMD_LCB 0x81
  547. #endif
  548. /*
  549. * LS_RJT Payload Definition
  550. */
  551. struct ls_rjt { /* Structure is in Big Endian format */
  552. union {
  553. uint32_t lsRjtError;
  554. struct {
  555. uint8_t lsRjtRsvd0; /* FC Word 0, bit 24:31 */
  556. uint8_t lsRjtRsnCode; /* FC Word 0, bit 16:23 */
  557. /* LS_RJT reason codes */
  558. #define LSRJT_INVALID_CMD 0x01
  559. #define LSRJT_LOGICAL_ERR 0x03
  560. #define LSRJT_LOGICAL_BSY 0x05
  561. #define LSRJT_PROTOCOL_ERR 0x07
  562. #define LSRJT_UNABLE_TPC 0x09 /* Unable to perform command */
  563. #define LSRJT_CMD_UNSUPPORTED 0x0B
  564. #define LSRJT_VENDOR_UNIQUE 0xFF /* See Byte 3 */
  565. uint8_t lsRjtRsnCodeExp; /* FC Word 0, bit 8:15 */
  566. /* LS_RJT reason explanation */
  567. #define LSEXP_NOTHING_MORE 0x00
  568. #define LSEXP_SPARM_OPTIONS 0x01
  569. #define LSEXP_SPARM_ICTL 0x03
  570. #define LSEXP_SPARM_RCTL 0x05
  571. #define LSEXP_SPARM_RCV_SIZE 0x07
  572. #define LSEXP_SPARM_CONCUR_SEQ 0x09
  573. #define LSEXP_SPARM_CREDIT 0x0B
  574. #define LSEXP_INVALID_PNAME 0x0D
  575. #define LSEXP_INVALID_NNAME 0x0E
  576. #define LSEXP_INVALID_CSP 0x0F
  577. #define LSEXP_INVALID_ASSOC_HDR 0x11
  578. #define LSEXP_ASSOC_HDR_REQ 0x13
  579. #define LSEXP_INVALID_O_SID 0x15
  580. #define LSEXP_INVALID_OX_RX 0x17
  581. #define LSEXP_CMD_IN_PROGRESS 0x19
  582. #define LSEXP_PORT_LOGIN_REQ 0x1E
  583. #define LSEXP_INVALID_NPORT_ID 0x1F
  584. #define LSEXP_INVALID_SEQ_ID 0x21
  585. #define LSEXP_INVALID_XCHG 0x23
  586. #define LSEXP_INACTIVE_XCHG 0x25
  587. #define LSEXP_RQ_REQUIRED 0x27
  588. #define LSEXP_OUT_OF_RESOURCE 0x29
  589. #define LSEXP_CANT_GIVE_DATA 0x2A
  590. #define LSEXP_REQ_UNSUPPORTED 0x2C
  591. uint8_t vendorUnique; /* FC Word 0, bit 0: 7 */
  592. } b;
  593. } un;
  594. };
  595. /*
  596. * N_Port Login (FLOGO/PLOGO Request) Payload Definition
  597. */
  598. typedef struct _LOGO { /* Structure is in Big Endian format */
  599. union {
  600. uint32_t nPortId32; /* Access nPortId as a word */
  601. struct {
  602. uint8_t word1Reserved1; /* FC Word 1, bit 31:24 */
  603. uint8_t nPortIdByte0; /* N_port ID bit 16:23 */
  604. uint8_t nPortIdByte1; /* N_port ID bit 8:15 */
  605. uint8_t nPortIdByte2; /* N_port ID bit 0: 7 */
  606. } b;
  607. } un;
  608. struct lpfc_name portName; /* N_port name field */
  609. } LOGO;
  610. /*
  611. * FCP Login (PRLI Request / ACC) Payload Definition
  612. */
  613. #define PRLX_PAGE_LEN 0x10
  614. #define TPRLO_PAGE_LEN 0x14
  615. typedef struct _PRLI { /* Structure is in Big Endian format */
  616. uint8_t prliType; /* FC Parm Word 0, bit 24:31 */
  617. #define PRLI_FCP_TYPE 0x08
  618. uint8_t word0Reserved1; /* FC Parm Word 0, bit 16:23 */
  619. #ifdef __BIG_ENDIAN_BITFIELD
  620. uint8_t origProcAssocV:1; /* FC Parm Word 0, bit 15 */
  621. uint8_t respProcAssocV:1; /* FC Parm Word 0, bit 14 */
  622. uint8_t estabImagePair:1; /* FC Parm Word 0, bit 13 */
  623. /* ACC = imagePairEstablished */
  624. uint8_t word0Reserved2:1; /* FC Parm Word 0, bit 12 */
  625. uint8_t acceptRspCode:4; /* FC Parm Word 0, bit 8:11, ACC ONLY */
  626. #else /* __LITTLE_ENDIAN_BITFIELD */
  627. uint8_t acceptRspCode:4; /* FC Parm Word 0, bit 8:11, ACC ONLY */
  628. uint8_t word0Reserved2:1; /* FC Parm Word 0, bit 12 */
  629. uint8_t estabImagePair:1; /* FC Parm Word 0, bit 13 */
  630. uint8_t respProcAssocV:1; /* FC Parm Word 0, bit 14 */
  631. uint8_t origProcAssocV:1; /* FC Parm Word 0, bit 15 */
  632. /* ACC = imagePairEstablished */
  633. #endif
  634. #define PRLI_REQ_EXECUTED 0x1 /* acceptRspCode */
  635. #define PRLI_NO_RESOURCES 0x2
  636. #define PRLI_INIT_INCOMPLETE 0x3
  637. #define PRLI_NO_SUCH_PA 0x4
  638. #define PRLI_PREDEF_CONFIG 0x5
  639. #define PRLI_PARTIAL_SUCCESS 0x6
  640. #define PRLI_INVALID_PAGE_CNT 0x7
  641. uint8_t word0Reserved3; /* FC Parm Word 0, bit 0:7 */
  642. uint32_t origProcAssoc; /* FC Parm Word 1, bit 0:31 */
  643. uint32_t respProcAssoc; /* FC Parm Word 2, bit 0:31 */
  644. uint8_t word3Reserved1; /* FC Parm Word 3, bit 24:31 */
  645. uint8_t word3Reserved2; /* FC Parm Word 3, bit 16:23 */
  646. #ifdef __BIG_ENDIAN_BITFIELD
  647. uint16_t Word3bit15Resved:1; /* FC Parm Word 3, bit 15 */
  648. uint16_t Word3bit14Resved:1; /* FC Parm Word 3, bit 14 */
  649. uint16_t Word3bit13Resved:1; /* FC Parm Word 3, bit 13 */
  650. uint16_t Word3bit12Resved:1; /* FC Parm Word 3, bit 12 */
  651. uint16_t Word3bit11Resved:1; /* FC Parm Word 3, bit 11 */
  652. uint16_t Word3bit10Resved:1; /* FC Parm Word 3, bit 10 */
  653. uint16_t TaskRetryIdReq:1; /* FC Parm Word 3, bit 9 */
  654. uint16_t Retry:1; /* FC Parm Word 3, bit 8 */
  655. uint16_t ConfmComplAllowed:1; /* FC Parm Word 3, bit 7 */
  656. uint16_t dataOverLay:1; /* FC Parm Word 3, bit 6 */
  657. uint16_t initiatorFunc:1; /* FC Parm Word 3, bit 5 */
  658. uint16_t targetFunc:1; /* FC Parm Word 3, bit 4 */
  659. uint16_t cmdDataMixEna:1; /* FC Parm Word 3, bit 3 */
  660. uint16_t dataRspMixEna:1; /* FC Parm Word 3, bit 2 */
  661. uint16_t readXferRdyDis:1; /* FC Parm Word 3, bit 1 */
  662. uint16_t writeXferRdyDis:1; /* FC Parm Word 3, bit 0 */
  663. #else /* __LITTLE_ENDIAN_BITFIELD */
  664. uint16_t Retry:1; /* FC Parm Word 3, bit 8 */
  665. uint16_t TaskRetryIdReq:1; /* FC Parm Word 3, bit 9 */
  666. uint16_t Word3bit10Resved:1; /* FC Parm Word 3, bit 10 */
  667. uint16_t Word3bit11Resved:1; /* FC Parm Word 3, bit 11 */
  668. uint16_t Word3bit12Resved:1; /* FC Parm Word 3, bit 12 */
  669. uint16_t Word3bit13Resved:1; /* FC Parm Word 3, bit 13 */
  670. uint16_t Word3bit14Resved:1; /* FC Parm Word 3, bit 14 */
  671. uint16_t Word3bit15Resved:1; /* FC Parm Word 3, bit 15 */
  672. uint16_t writeXferRdyDis:1; /* FC Parm Word 3, bit 0 */
  673. uint16_t readXferRdyDis:1; /* FC Parm Word 3, bit 1 */
  674. uint16_t dataRspMixEna:1; /* FC Parm Word 3, bit 2 */
  675. uint16_t cmdDataMixEna:1; /* FC Parm Word 3, bit 3 */
  676. uint16_t targetFunc:1; /* FC Parm Word 3, bit 4 */
  677. uint16_t initiatorFunc:1; /* FC Parm Word 3, bit 5 */
  678. uint16_t dataOverLay:1; /* FC Parm Word 3, bit 6 */
  679. uint16_t ConfmComplAllowed:1; /* FC Parm Word 3, bit 7 */
  680. #endif
  681. } PRLI;
  682. /*
  683. * FCP Logout (PRLO Request / ACC) Payload Definition
  684. */
  685. typedef struct _PRLO { /* Structure is in Big Endian format */
  686. uint8_t prloType; /* FC Parm Word 0, bit 24:31 */
  687. #define PRLO_FCP_TYPE 0x08
  688. uint8_t word0Reserved1; /* FC Parm Word 0, bit 16:23 */
  689. #ifdef __BIG_ENDIAN_BITFIELD
  690. uint8_t origProcAssocV:1; /* FC Parm Word 0, bit 15 */
  691. uint8_t respProcAssocV:1; /* FC Parm Word 0, bit 14 */
  692. uint8_t word0Reserved2:2; /* FC Parm Word 0, bit 12:13 */
  693. uint8_t acceptRspCode:4; /* FC Parm Word 0, bit 8:11, ACC ONLY */
  694. #else /* __LITTLE_ENDIAN_BITFIELD */
  695. uint8_t acceptRspCode:4; /* FC Parm Word 0, bit 8:11, ACC ONLY */
  696. uint8_t word0Reserved2:2; /* FC Parm Word 0, bit 12:13 */
  697. uint8_t respProcAssocV:1; /* FC Parm Word 0, bit 14 */
  698. uint8_t origProcAssocV:1; /* FC Parm Word 0, bit 15 */
  699. #endif
  700. #define PRLO_REQ_EXECUTED 0x1 /* acceptRspCode */
  701. #define PRLO_NO_SUCH_IMAGE 0x4
  702. #define PRLO_INVALID_PAGE_CNT 0x7
  703. uint8_t word0Reserved3; /* FC Parm Word 0, bit 0:7 */
  704. uint32_t origProcAssoc; /* FC Parm Word 1, bit 0:31 */
  705. uint32_t respProcAssoc; /* FC Parm Word 2, bit 0:31 */
  706. uint32_t word3Reserved1; /* FC Parm Word 3, bit 0:31 */
  707. } PRLO;
  708. typedef struct _ADISC { /* Structure is in Big Endian format */
  709. uint32_t hardAL_PA;
  710. struct lpfc_name portName;
  711. struct lpfc_name nodeName;
  712. uint32_t DID;
  713. } ADISC;
  714. typedef struct _FARP { /* Structure is in Big Endian format */
  715. uint32_t Mflags:8;
  716. uint32_t Odid:24;
  717. #define FARP_NO_ACTION 0 /* FARP information enclosed, no
  718. action */
  719. #define FARP_MATCH_PORT 0x1 /* Match on Responder Port Name */
  720. #define FARP_MATCH_NODE 0x2 /* Match on Responder Node Name */
  721. #define FARP_MATCH_IP 0x4 /* Match on IP address, not supported */
  722. #define FARP_MATCH_IPV4 0x5 /* Match on IPV4 address, not
  723. supported */
  724. #define FARP_MATCH_IPV6 0x6 /* Match on IPV6 address, not
  725. supported */
  726. uint32_t Rflags:8;
  727. uint32_t Rdid:24;
  728. #define FARP_REQUEST_PLOGI 0x1 /* Request for PLOGI */
  729. #define FARP_REQUEST_FARPR 0x2 /* Request for FARP Response */
  730. struct lpfc_name OportName;
  731. struct lpfc_name OnodeName;
  732. struct lpfc_name RportName;
  733. struct lpfc_name RnodeName;
  734. uint8_t Oipaddr[16];
  735. uint8_t Ripaddr[16];
  736. } FARP;
  737. typedef struct _FAN { /* Structure is in Big Endian format */
  738. uint32_t Fdid;
  739. struct lpfc_name FportName;
  740. struct lpfc_name FnodeName;
  741. } FAN;
  742. typedef struct _SCR { /* Structure is in Big Endian format */
  743. uint8_t resvd1;
  744. uint8_t resvd2;
  745. uint8_t resvd3;
  746. uint8_t Function;
  747. #define SCR_FUNC_FABRIC 0x01
  748. #define SCR_FUNC_NPORT 0x02
  749. #define SCR_FUNC_FULL 0x03
  750. #define SCR_CLEAR 0xff
  751. } SCR;
  752. typedef struct _RNID_TOP_DISC {
  753. struct lpfc_name portName;
  754. uint8_t resvd[8];
  755. uint32_t unitType;
  756. #define RNID_HBA 0x7
  757. #define RNID_HOST 0xa
  758. #define RNID_DRIVER 0xd
  759. uint32_t physPort;
  760. uint32_t attachedNodes;
  761. uint16_t ipVersion;
  762. #define RNID_IPV4 0x1
  763. #define RNID_IPV6 0x2
  764. uint16_t UDPport;
  765. uint8_t ipAddr[16];
  766. uint16_t resvd1;
  767. uint16_t flags;
  768. #define RNID_TD_SUPPORT 0x1
  769. #define RNID_LP_VALID 0x2
  770. } RNID_TOP_DISC;
  771. typedef struct _RNID { /* Structure is in Big Endian format */
  772. uint8_t Format;
  773. #define RNID_TOPOLOGY_DISC 0xdf
  774. uint8_t CommonLen;
  775. uint8_t resvd1;
  776. uint8_t SpecificLen;
  777. struct lpfc_name portName;
  778. struct lpfc_name nodeName;
  779. union {
  780. RNID_TOP_DISC topologyDisc; /* topology disc (0xdf) */
  781. } un;
  782. } RNID;
  783. typedef struct _RPS { /* Structure is in Big Endian format */
  784. union {
  785. uint32_t portNum;
  786. struct lpfc_name portName;
  787. } un;
  788. } RPS;
  789. typedef struct _RPS_RSP { /* Structure is in Big Endian format */
  790. uint16_t rsvd1;
  791. uint16_t portStatus;
  792. uint32_t linkFailureCnt;
  793. uint32_t lossSyncCnt;
  794. uint32_t lossSignalCnt;
  795. uint32_t primSeqErrCnt;
  796. uint32_t invalidXmitWord;
  797. uint32_t crcCnt;
  798. } RPS_RSP;
  799. struct RLS { /* Structure is in Big Endian format */
  800. uint32_t rls;
  801. #define rls_rsvd_SHIFT 24
  802. #define rls_rsvd_MASK 0x000000ff
  803. #define rls_rsvd_WORD rls
  804. #define rls_did_SHIFT 0
  805. #define rls_did_MASK 0x00ffffff
  806. #define rls_did_WORD rls
  807. };
  808. struct RLS_RSP { /* Structure is in Big Endian format */
  809. uint32_t linkFailureCnt;
  810. uint32_t lossSyncCnt;
  811. uint32_t lossSignalCnt;
  812. uint32_t primSeqErrCnt;
  813. uint32_t invalidXmitWord;
  814. uint32_t crcCnt;
  815. };
  816. struct RRQ { /* Structure is in Big Endian format */
  817. uint32_t rrq;
  818. #define rrq_rsvd_SHIFT 24
  819. #define rrq_rsvd_MASK 0x000000ff
  820. #define rrq_rsvd_WORD rrq
  821. #define rrq_did_SHIFT 0
  822. #define rrq_did_MASK 0x00ffffff
  823. #define rrq_did_WORD rrq
  824. uint32_t rrq_exchg;
  825. #define rrq_oxid_SHIFT 16
  826. #define rrq_oxid_MASK 0xffff
  827. #define rrq_oxid_WORD rrq_exchg
  828. #define rrq_rxid_SHIFT 0
  829. #define rrq_rxid_MASK 0xffff
  830. #define rrq_rxid_WORD rrq_exchg
  831. };
  832. #define LPFC_MAX_VFN_PER_PFN 255 /* Maximum VFs allowed per ARI */
  833. #define LPFC_DEF_VFN_PER_PFN 0 /* Default VFs due to platform limitation*/
  834. struct RTV_RSP { /* Structure is in Big Endian format */
  835. uint32_t ratov;
  836. uint32_t edtov;
  837. uint32_t qtov;
  838. #define qtov_rsvd0_SHIFT 28
  839. #define qtov_rsvd0_MASK 0x0000000f
  840. #define qtov_rsvd0_WORD qtov /* reserved */
  841. #define qtov_edtovres_SHIFT 27
  842. #define qtov_edtovres_MASK 0x00000001
  843. #define qtov_edtovres_WORD qtov /* E_D_TOV Resolution */
  844. #define qtov__rsvd1_SHIFT 19
  845. #define qtov_rsvd1_MASK 0x0000003f
  846. #define qtov_rsvd1_WORD qtov /* reserved */
  847. #define qtov_rttov_SHIFT 18
  848. #define qtov_rttov_MASK 0x00000001
  849. #define qtov_rttov_WORD qtov /* R_T_TOV value */
  850. #define qtov_rsvd2_SHIFT 0
  851. #define qtov_rsvd2_MASK 0x0003ffff
  852. #define qtov_rsvd2_WORD qtov /* reserved */
  853. };
  854. typedef struct _RPL { /* Structure is in Big Endian format */
  855. uint32_t maxsize;
  856. uint32_t index;
  857. } RPL;
  858. typedef struct _PORT_NUM_BLK {
  859. uint32_t portNum;
  860. uint32_t portID;
  861. struct lpfc_name portName;
  862. } PORT_NUM_BLK;
  863. typedef struct _RPL_RSP { /* Structure is in Big Endian format */
  864. uint32_t listLen;
  865. uint32_t index;
  866. PORT_NUM_BLK port_num_blk;
  867. } RPL_RSP;
  868. /* This is used for RSCN command */
  869. typedef struct _D_ID { /* Structure is in Big Endian format */
  870. union {
  871. uint32_t word;
  872. struct {
  873. #ifdef __BIG_ENDIAN_BITFIELD
  874. uint8_t resv;
  875. uint8_t domain;
  876. uint8_t area;
  877. uint8_t id;
  878. #else /* __LITTLE_ENDIAN_BITFIELD */
  879. uint8_t id;
  880. uint8_t area;
  881. uint8_t domain;
  882. uint8_t resv;
  883. #endif
  884. } b;
  885. } un;
  886. } D_ID;
  887. #define RSCN_ADDRESS_FORMAT_PORT 0x0
  888. #define RSCN_ADDRESS_FORMAT_AREA 0x1
  889. #define RSCN_ADDRESS_FORMAT_DOMAIN 0x2
  890. #define RSCN_ADDRESS_FORMAT_FABRIC 0x3
  891. #define RSCN_ADDRESS_FORMAT_MASK 0x3
  892. /*
  893. * Structure to define all ELS Payload types
  894. */
  895. typedef struct _ELS_PKT { /* Structure is in Big Endian format */
  896. uint8_t elsCode; /* FC Word 0, bit 24:31 */
  897. uint8_t elsByte1;
  898. uint8_t elsByte2;
  899. uint8_t elsByte3;
  900. union {
  901. struct ls_rjt lsRjt; /* Payload for LS_RJT ELS response */
  902. struct serv_parm logi; /* Payload for PLOGI/FLOGI/PDISC/ACC */
  903. LOGO logo; /* Payload for PLOGO/FLOGO/ACC */
  904. PRLI prli; /* Payload for PRLI/ACC */
  905. PRLO prlo; /* Payload for PRLO/ACC */
  906. ADISC adisc; /* Payload for ADISC/ACC */
  907. FARP farp; /* Payload for FARP/ACC */
  908. FAN fan; /* Payload for FAN */
  909. SCR scr; /* Payload for SCR/ACC */
  910. RNID rnid; /* Payload for RNID */
  911. uint8_t pad[128 - 4]; /* Pad out to payload of 128 bytes */
  912. } un;
  913. } ELS_PKT;
  914. /*
  915. * Link Cable Beacon (LCB) ELS Frame
  916. */
  917. struct fc_lcb_request_frame {
  918. uint32_t lcb_command; /* ELS command opcode (0x81) */
  919. uint8_t lcb_sub_command;/* LCB Payload Word 1, bit 24:31 */
  920. #define LPFC_LCB_ON 0x1
  921. #define LPFC_LCB_OFF 0x2
  922. uint8_t reserved[3];
  923. uint8_t lcb_type; /* LCB Payload Word 2, bit 24:31 */
  924. #define LPFC_LCB_GREEN 0x1
  925. #define LPFC_LCB_AMBER 0x2
  926. uint8_t lcb_frequency; /* LCB Payload Word 2, bit 16:23 */
  927. uint16_t lcb_duration; /* LCB Payload Word 2, bit 15:0 */
  928. };
  929. /*
  930. * Link Cable Beacon (LCB) ELS Response Frame
  931. */
  932. struct fc_lcb_res_frame {
  933. uint32_t lcb_ls_acc; /* Acceptance of LCB request (0x02) */
  934. uint8_t lcb_sub_command;/* LCB Payload Word 1, bit 24:31 */
  935. uint8_t reserved[3];
  936. uint8_t lcb_type; /* LCB Payload Word 2, bit 24:31 */
  937. uint8_t lcb_frequency; /* LCB Payload Word 2, bit 16:23 */
  938. uint16_t lcb_duration; /* LCB Payload Word 2, bit 15:0 */
  939. };
  940. /*
  941. * Read Diagnostic Parameters (RDP) ELS frame.
  942. */
  943. #define SFF_PG0_IDENT_SFP 0x3
  944. #define SFP_FLAG_PT_OPTICAL 0x0
  945. #define SFP_FLAG_PT_SWLASER 0x01
  946. #define SFP_FLAG_PT_LWLASER_LC1310 0x02
  947. #define SFP_FLAG_PT_LWLASER_LL1550 0x03
  948. #define SFP_FLAG_PT_MASK 0x0F
  949. #define SFP_FLAG_PT_SHIFT 0
  950. #define SFP_FLAG_IS_OPTICAL_PORT 0x01
  951. #define SFP_FLAG_IS_OPTICAL_MASK 0x010
  952. #define SFP_FLAG_IS_OPTICAL_SHIFT 4
  953. #define SFP_FLAG_IS_DESC_VALID 0x01
  954. #define SFP_FLAG_IS_DESC_VALID_MASK 0x020
  955. #define SFP_FLAG_IS_DESC_VALID_SHIFT 5
  956. #define SFP_FLAG_CT_UNKNOWN 0x0
  957. #define SFP_FLAG_CT_SFP_PLUS 0x01
  958. #define SFP_FLAG_CT_MASK 0x3C
  959. #define SFP_FLAG_CT_SHIFT 6
  960. struct fc_rdp_port_name_info {
  961. uint8_t wwnn[8];
  962. uint8_t wwpn[8];
  963. };
  964. /*
  965. * Link Error Status Block Structure (FC-FS-3) for RDP
  966. * This similar to RPS ELS
  967. */
  968. struct fc_link_status {
  969. uint32_t link_failure_cnt;
  970. uint32_t loss_of_synch_cnt;
  971. uint32_t loss_of_signal_cnt;
  972. uint32_t primitive_seq_proto_err;
  973. uint32_t invalid_trans_word;
  974. uint32_t invalid_crc_cnt;
  975. };
  976. #define RDP_PORT_NAMES_DESC_TAG 0x00010003
  977. struct fc_rdp_port_name_desc {
  978. uint32_t tag; /* 0001 0003h */
  979. uint32_t length; /* set to size of payload struct */
  980. struct fc_rdp_port_name_info port_names;
  981. };
  982. struct fc_rdp_fec_info {
  983. uint32_t CorrectedBlocks;
  984. uint32_t UncorrectableBlocks;
  985. };
  986. #define RDP_FEC_DESC_TAG 0x00010005
  987. struct fc_fec_rdp_desc {
  988. uint32_t tag;
  989. uint32_t length;
  990. struct fc_rdp_fec_info info;
  991. };
  992. struct fc_rdp_link_error_status_payload_info {
  993. struct fc_link_status link_status; /* 24 bytes */
  994. uint32_t port_type; /* bits 31-30 only */
  995. };
  996. #define RDP_LINK_ERROR_STATUS_DESC_TAG 0x00010002
  997. struct fc_rdp_link_error_status_desc {
  998. uint32_t tag; /* 0001 0002h */
  999. uint32_t length; /* set to size of payload struct */
  1000. struct fc_rdp_link_error_status_payload_info info;
  1001. };
  1002. #define VN_PT_PHY_UNKNOWN 0x00
  1003. #define VN_PT_PHY_PF_PORT 0x01
  1004. #define VN_PT_PHY_ETH_MAC 0x10
  1005. #define VN_PT_PHY_SHIFT 30
  1006. #define RDP_PS_1GB 0x8000
  1007. #define RDP_PS_2GB 0x4000
  1008. #define RDP_PS_4GB 0x2000
  1009. #define RDP_PS_10GB 0x1000
  1010. #define RDP_PS_8GB 0x0800
  1011. #define RDP_PS_16GB 0x0400
  1012. #define RDP_PS_32GB 0x0200
  1013. #define RDP_CAP_USER_CONFIGURED 0x0002
  1014. #define RDP_CAP_UNKNOWN 0x0001
  1015. #define RDP_PS_UNKNOWN 0x0002
  1016. #define RDP_PS_NOT_ESTABLISHED 0x0001
  1017. struct fc_rdp_port_speed {
  1018. uint16_t capabilities;
  1019. uint16_t speed;
  1020. };
  1021. struct fc_rdp_port_speed_info {
  1022. struct fc_rdp_port_speed port_speed;
  1023. };
  1024. #define RDP_PORT_SPEED_DESC_TAG 0x00010001
  1025. struct fc_rdp_port_speed_desc {
  1026. uint32_t tag; /* 00010001h */
  1027. uint32_t length; /* set to size of payload struct */
  1028. struct fc_rdp_port_speed_info info;
  1029. };
  1030. #define RDP_NPORT_ID_SIZE 4
  1031. #define RDP_N_PORT_DESC_TAG 0x00000003
  1032. struct fc_rdp_nport_desc {
  1033. uint32_t tag; /* 0000 0003h, big endian */
  1034. uint32_t length; /* size of RDP_N_PORT_ID struct */
  1035. uint32_t nport_id : 12;
  1036. uint32_t reserved : 8;
  1037. };
  1038. struct fc_rdp_link_service_info {
  1039. uint32_t els_req; /* Request payload word 0 value.*/
  1040. };
  1041. #define RDP_LINK_SERVICE_DESC_TAG 0x00000001
  1042. struct fc_rdp_link_service_desc {
  1043. uint32_t tag; /* Descriptor tag 1 */
  1044. uint32_t length; /* set to size of payload struct. */
  1045. struct fc_rdp_link_service_info payload;
  1046. /* must be ELS req Word 0(0x18) */
  1047. };
  1048. struct fc_rdp_sfp_info {
  1049. uint16_t temperature;
  1050. uint16_t vcc;
  1051. uint16_t tx_bias;
  1052. uint16_t tx_power;
  1053. uint16_t rx_power;
  1054. uint16_t flags;
  1055. };
  1056. #define RDP_SFP_DESC_TAG 0x00010000
  1057. struct fc_rdp_sfp_desc {
  1058. uint32_t tag;
  1059. uint32_t length; /* set to size of sfp_info struct */
  1060. struct fc_rdp_sfp_info sfp_info;
  1061. };
  1062. /* Buffer Credit Descriptor */
  1063. struct fc_rdp_bbc_info {
  1064. uint32_t port_bbc; /* FC_Port buffer-to-buffer credit */
  1065. uint32_t attached_port_bbc;
  1066. uint32_t rtt; /* Round trip time */
  1067. };
  1068. #define RDP_BBC_DESC_TAG 0x00010006
  1069. struct fc_rdp_bbc_desc {
  1070. uint32_t tag;
  1071. uint32_t length;
  1072. struct fc_rdp_bbc_info bbc_info;
  1073. };
  1074. /* Optical Element Type Transgression Flags */
  1075. #define RDP_OET_LOW_WARNING 0x1
  1076. #define RDP_OET_HIGH_WARNING 0x2
  1077. #define RDP_OET_LOW_ALARM 0x4
  1078. #define RDP_OET_HIGH_ALARM 0x8
  1079. #define RDP_OED_TEMPERATURE 0x1
  1080. #define RDP_OED_VOLTAGE 0x2
  1081. #define RDP_OED_TXBIAS 0x3
  1082. #define RDP_OED_TXPOWER 0x4
  1083. #define RDP_OED_RXPOWER 0x5
  1084. #define RDP_OED_TYPE_SHIFT 28
  1085. /* Optical Element Data descriptor */
  1086. struct fc_rdp_oed_info {
  1087. uint16_t hi_alarm;
  1088. uint16_t lo_alarm;
  1089. uint16_t hi_warning;
  1090. uint16_t lo_warning;
  1091. uint32_t function_flags;
  1092. };
  1093. #define RDP_OED_DESC_TAG 0x00010007
  1094. struct fc_rdp_oed_sfp_desc {
  1095. uint32_t tag;
  1096. uint32_t length;
  1097. struct fc_rdp_oed_info oed_info;
  1098. };
  1099. /* Optical Product Data descriptor */
  1100. struct fc_rdp_opd_sfp_info {
  1101. uint8_t vendor_name[16];
  1102. uint8_t model_number[16];
  1103. uint8_t serial_number[16];
  1104. uint8_t revision[2];
  1105. uint8_t reserved[2];
  1106. uint8_t date[8];
  1107. };
  1108. #define RDP_OPD_DESC_TAG 0x00010008
  1109. struct fc_rdp_opd_sfp_desc {
  1110. uint32_t tag;
  1111. uint32_t length;
  1112. struct fc_rdp_opd_sfp_info opd_info;
  1113. };
  1114. struct fc_rdp_req_frame {
  1115. uint32_t rdp_command; /* ELS command opcode (0x18)*/
  1116. uint32_t rdp_des_length; /* RDP Payload Word 1 */
  1117. struct fc_rdp_nport_desc nport_id_desc; /* RDP Payload Word 2 - 4 */
  1118. };
  1119. struct fc_rdp_res_frame {
  1120. uint32_t reply_sequence; /* FC word0 LS_ACC or LS_RJT */
  1121. uint32_t length; /* FC Word 1 */
  1122. struct fc_rdp_link_service_desc link_service_desc; /* Word 2 -4 */
  1123. struct fc_rdp_sfp_desc sfp_desc; /* Word 5 -9 */
  1124. struct fc_rdp_port_speed_desc portspeed_desc; /* Word 10-12 */
  1125. struct fc_rdp_link_error_status_desc link_error_desc; /* Word 13-21 */
  1126. struct fc_rdp_port_name_desc diag_port_names_desc; /* Word 22-27 */
  1127. struct fc_rdp_port_name_desc attached_port_names_desc;/* Word 28-33 */
  1128. struct fc_fec_rdp_desc fec_desc; /* FC word 34-37*/
  1129. struct fc_rdp_bbc_desc bbc_desc; /* FC Word 38-42*/
  1130. struct fc_rdp_oed_sfp_desc oed_temp_desc; /* FC Word 43-47*/
  1131. struct fc_rdp_oed_sfp_desc oed_voltage_desc; /* FC word 48-52*/
  1132. struct fc_rdp_oed_sfp_desc oed_txbias_desc; /* FC word 53-57*/
  1133. struct fc_rdp_oed_sfp_desc oed_txpower_desc; /* FC word 58-62*/
  1134. struct fc_rdp_oed_sfp_desc oed_rxpower_desc; /* FC word 63-67*/
  1135. struct fc_rdp_opd_sfp_desc opd_desc; /* FC word 68-84*/
  1136. };
  1137. /******** FDMI ********/
  1138. /* lpfc_sli_ct_request defines the CT_IU preamble for FDMI commands */
  1139. #define SLI_CT_FDMI_Subtypes 0x10 /* Management Service Subtype */
  1140. /*
  1141. * Registered Port List Format
  1142. */
  1143. struct lpfc_fdmi_reg_port_list {
  1144. uint32_t EntryCnt;
  1145. uint32_t pe; /* Variable-length array */
  1146. };
  1147. /* Definitions for HBA / Port attribute entries */
  1148. struct lpfc_fdmi_attr_def { /* Defined in TLV format */
  1149. /* Structure is in Big Endian format */
  1150. uint32_t AttrType:16;
  1151. uint32_t AttrLen:16;
  1152. uint32_t AttrValue; /* Marks start of Value (ATTRIBUTE_ENTRY) */
  1153. };
  1154. /* Attribute Entry */
  1155. struct lpfc_fdmi_attr_entry {
  1156. union {
  1157. uint32_t AttrInt;
  1158. uint8_t AttrTypes[32];
  1159. uint8_t AttrString[256];
  1160. struct lpfc_name AttrWWN;
  1161. } un;
  1162. };
  1163. #define LPFC_FDMI_MAX_AE_SIZE sizeof(struct lpfc_fdmi_attr_entry)
  1164. /*
  1165. * HBA Attribute Block
  1166. */
  1167. struct lpfc_fdmi_attr_block {
  1168. uint32_t EntryCnt; /* Number of HBA attribute entries */
  1169. struct lpfc_fdmi_attr_entry Entry; /* Variable-length array */
  1170. };
  1171. /*
  1172. * Port Entry
  1173. */
  1174. struct lpfc_fdmi_port_entry {
  1175. struct lpfc_name PortName;
  1176. };
  1177. /*
  1178. * HBA Identifier
  1179. */
  1180. struct lpfc_fdmi_hba_ident {
  1181. struct lpfc_name PortName;
  1182. };
  1183. /*
  1184. * Register HBA(RHBA)
  1185. */
  1186. struct lpfc_fdmi_reg_hba {
  1187. struct lpfc_fdmi_hba_ident hi;
  1188. struct lpfc_fdmi_reg_port_list rpl; /* variable-length array */
  1189. /* struct lpfc_fdmi_attr_block ab; */
  1190. };
  1191. /*
  1192. * Register HBA Attributes (RHAT)
  1193. */
  1194. struct lpfc_fdmi_reg_hbaattr {
  1195. struct lpfc_name HBA_PortName;
  1196. struct lpfc_fdmi_attr_block ab;
  1197. };
  1198. /*
  1199. * Register Port Attributes (RPA)
  1200. */
  1201. struct lpfc_fdmi_reg_portattr {
  1202. struct lpfc_name PortName;
  1203. struct lpfc_fdmi_attr_block ab;
  1204. };
  1205. /*
  1206. * HBA MAnagement Operations Command Codes
  1207. */
  1208. #define SLI_MGMT_GRHL 0x100 /* Get registered HBA list */
  1209. #define SLI_MGMT_GHAT 0x101 /* Get HBA attributes */
  1210. #define SLI_MGMT_GRPL 0x102 /* Get registered Port list */
  1211. #define SLI_MGMT_GPAT 0x110 /* Get Port attributes */
  1212. #define SLI_MGMT_GPAS 0x120 /* Get Port Statistics */
  1213. #define SLI_MGMT_RHBA 0x200 /* Register HBA */
  1214. #define SLI_MGMT_RHAT 0x201 /* Register HBA attributes */
  1215. #define SLI_MGMT_RPRT 0x210 /* Register Port */
  1216. #define SLI_MGMT_RPA 0x211 /* Register Port attributes */
  1217. #define SLI_MGMT_DHBA 0x300 /* De-register HBA */
  1218. #define SLI_MGMT_DHAT 0x301 /* De-register HBA attributes */
  1219. #define SLI_MGMT_DPRT 0x310 /* De-register Port */
  1220. #define SLI_MGMT_DPA 0x311 /* De-register Port attributes */
  1221. #define LPFC_FDMI_MAX_RETRY 3 /* Max retries for a FDMI command */
  1222. /*
  1223. * HBA Attribute Types
  1224. */
  1225. #define RHBA_NODENAME 0x1 /* 8 byte WWNN */
  1226. #define RHBA_MANUFACTURER 0x2 /* 4 to 64 byte ASCII string */
  1227. #define RHBA_SERIAL_NUMBER 0x3 /* 4 to 64 byte ASCII string */
  1228. #define RHBA_MODEL 0x4 /* 4 to 256 byte ASCII string */
  1229. #define RHBA_MODEL_DESCRIPTION 0x5 /* 4 to 256 byte ASCII string */
  1230. #define RHBA_HARDWARE_VERSION 0x6 /* 4 to 256 byte ASCII string */
  1231. #define RHBA_DRIVER_VERSION 0x7 /* 4 to 256 byte ASCII string */
  1232. #define RHBA_OPTION_ROM_VERSION 0x8 /* 4 to 256 byte ASCII string */
  1233. #define RHBA_FIRMWARE_VERSION 0x9 /* 4 to 256 byte ASCII string */
  1234. #define RHBA_OS_NAME_VERSION 0xa /* 4 to 256 byte ASCII string */
  1235. #define RHBA_MAX_CT_PAYLOAD_LEN 0xb /* 32-bit unsigned int */
  1236. #define RHBA_SYM_NODENAME 0xc /* 4 to 256 byte ASCII string */
  1237. #define RHBA_VENDOR_INFO 0xd /* 32-bit unsigned int */
  1238. #define RHBA_NUM_PORTS 0xe /* 32-bit unsigned int */
  1239. #define RHBA_FABRIC_WWNN 0xf /* 8 byte WWNN */
  1240. #define RHBA_BIOS_VERSION 0x10 /* 4 to 256 byte ASCII string */
  1241. #define RHBA_BIOS_STATE 0x11 /* 32-bit unsigned int */
  1242. #define RHBA_VENDOR_ID 0xe0 /* 8 byte ASCII string */
  1243. /* Bit mask for all individual HBA attributes */
  1244. #define LPFC_FDMI_HBA_ATTR_wwnn 0x00000001
  1245. #define LPFC_FDMI_HBA_ATTR_manufacturer 0x00000002
  1246. #define LPFC_FDMI_HBA_ATTR_sn 0x00000004
  1247. #define LPFC_FDMI_HBA_ATTR_model 0x00000008
  1248. #define LPFC_FDMI_HBA_ATTR_description 0x00000010
  1249. #define LPFC_FDMI_HBA_ATTR_hdw_ver 0x00000020
  1250. #define LPFC_FDMI_HBA_ATTR_drvr_ver 0x00000040
  1251. #define LPFC_FDMI_HBA_ATTR_rom_ver 0x00000080
  1252. #define LPFC_FDMI_HBA_ATTR_fmw_ver 0x00000100
  1253. #define LPFC_FDMI_HBA_ATTR_os_ver 0x00000200
  1254. #define LPFC_FDMI_HBA_ATTR_ct_len 0x00000400
  1255. #define LPFC_FDMI_HBA_ATTR_symbolic_name 0x00000800
  1256. #define LPFC_FDMI_HBA_ATTR_vendor_info 0x00001000 /* Not used */
  1257. #define LPFC_FDMI_HBA_ATTR_num_ports 0x00002000
  1258. #define LPFC_FDMI_HBA_ATTR_fabric_wwnn 0x00004000
  1259. #define LPFC_FDMI_HBA_ATTR_bios_ver 0x00008000
  1260. #define LPFC_FDMI_HBA_ATTR_bios_state 0x00010000 /* Not used */
  1261. #define LPFC_FDMI_HBA_ATTR_vendor_id 0x00020000
  1262. /* Bit mask for FDMI-1 defined HBA attributes */
  1263. #define LPFC_FDMI1_HBA_ATTR 0x000007ff
  1264. /* Bit mask for FDMI-2 defined HBA attributes */
  1265. /* Skip vendor_info and bios_state */
  1266. #define LPFC_FDMI2_HBA_ATTR 0x0002efff
  1267. /*
  1268. * Port Attrubute Types
  1269. */
  1270. #define RPRT_SUPPORTED_FC4_TYPES 0x1 /* 32 byte binary array */
  1271. #define RPRT_SUPPORTED_SPEED 0x2 /* 32-bit unsigned int */
  1272. #define RPRT_PORT_SPEED 0x3 /* 32-bit unsigned int */
  1273. #define RPRT_MAX_FRAME_SIZE 0x4 /* 32-bit unsigned int */
  1274. #define RPRT_OS_DEVICE_NAME 0x5 /* 4 to 256 byte ASCII string */
  1275. #define RPRT_HOST_NAME 0x6 /* 4 to 256 byte ASCII string */
  1276. #define RPRT_NODENAME 0x7 /* 8 byte WWNN */
  1277. #define RPRT_PORTNAME 0x8 /* 8 byte WWPN */
  1278. #define RPRT_SYM_PORTNAME 0x9 /* 4 to 256 byte ASCII string */
  1279. #define RPRT_PORT_TYPE 0xa /* 32-bit unsigned int */
  1280. #define RPRT_SUPPORTED_CLASS 0xb /* 32-bit unsigned int */
  1281. #define RPRT_FABRICNAME 0xc /* 8 byte Fabric WWPN */
  1282. #define RPRT_ACTIVE_FC4_TYPES 0xd /* 32 byte binary array */
  1283. #define RPRT_PORT_STATE 0x101 /* 32-bit unsigned int */
  1284. #define RPRT_DISC_PORT 0x102 /* 32-bit unsigned int */
  1285. #define RPRT_PORT_ID 0x103 /* 32-bit unsigned int */
  1286. #define RPRT_SMART_SERVICE 0xf100 /* 4 to 256 byte ASCII string */
  1287. #define RPRT_SMART_GUID 0xf101 /* 8 byte WWNN + 8 byte WWPN */
  1288. #define RPRT_SMART_VERSION 0xf102 /* 4 to 256 byte ASCII string */
  1289. #define RPRT_SMART_MODEL 0xf103 /* 4 to 256 byte ASCII string */
  1290. #define RPRT_SMART_PORT_INFO 0xf104 /* 32-bit unsigned int */
  1291. #define RPRT_SMART_QOS 0xf105 /* 32-bit unsigned int */
  1292. #define RPRT_SMART_SECURITY 0xf106 /* 32-bit unsigned int */
  1293. /* Bit mask for all individual PORT attributes */
  1294. #define LPFC_FDMI_PORT_ATTR_fc4type 0x00000001
  1295. #define LPFC_FDMI_PORT_ATTR_support_speed 0x00000002
  1296. #define LPFC_FDMI_PORT_ATTR_speed 0x00000004
  1297. #define LPFC_FDMI_PORT_ATTR_max_frame 0x00000008
  1298. #define LPFC_FDMI_PORT_ATTR_os_devname 0x00000010
  1299. #define LPFC_FDMI_PORT_ATTR_host_name 0x00000020
  1300. #define LPFC_FDMI_PORT_ATTR_wwnn 0x00000040
  1301. #define LPFC_FDMI_PORT_ATTR_wwpn 0x00000080
  1302. #define LPFC_FDMI_PORT_ATTR_symbolic_name 0x00000100
  1303. #define LPFC_FDMI_PORT_ATTR_port_type 0x00000200
  1304. #define LPFC_FDMI_PORT_ATTR_class 0x00000400
  1305. #define LPFC_FDMI_PORT_ATTR_fabric_wwpn 0x00000800
  1306. #define LPFC_FDMI_PORT_ATTR_port_state 0x00001000
  1307. #define LPFC_FDMI_PORT_ATTR_active_fc4type 0x00002000
  1308. #define LPFC_FDMI_PORT_ATTR_num_disc 0x00004000
  1309. #define LPFC_FDMI_PORT_ATTR_nportid 0x00008000
  1310. #define LPFC_FDMI_SMART_ATTR_service 0x00010000 /* Vendor specific */
  1311. #define LPFC_FDMI_SMART_ATTR_guid 0x00020000 /* Vendor specific */
  1312. #define LPFC_FDMI_SMART_ATTR_version 0x00040000 /* Vendor specific */
  1313. #define LPFC_FDMI_SMART_ATTR_model 0x00080000 /* Vendor specific */
  1314. #define LPFC_FDMI_SMART_ATTR_port_info 0x00100000 /* Vendor specific */
  1315. #define LPFC_FDMI_SMART_ATTR_qos 0x00200000 /* Vendor specific */
  1316. #define LPFC_FDMI_SMART_ATTR_security 0x00400000 /* Vendor specific */
  1317. /* Bit mask for FDMI-1 defined PORT attributes */
  1318. #define LPFC_FDMI1_PORT_ATTR 0x0000003f
  1319. /* Bit mask for FDMI-2 defined PORT attributes */
  1320. #define LPFC_FDMI2_PORT_ATTR 0x0000ffff
  1321. /* Bit mask for Smart SAN defined PORT attributes */
  1322. #define LPFC_FDMI2_SMART_ATTR 0x007fffff
  1323. /* Defines for PORT port state attribute */
  1324. #define LPFC_FDMI_PORTSTATE_UNKNOWN 1
  1325. #define LPFC_FDMI_PORTSTATE_ONLINE 2
  1326. /* Defines for PORT port type attribute */
  1327. #define LPFC_FDMI_PORTTYPE_UNKNOWN 0
  1328. #define LPFC_FDMI_PORTTYPE_NPORT 1
  1329. #define LPFC_FDMI_PORTTYPE_NLPORT 2
  1330. /*
  1331. * Begin HBA configuration parameters.
  1332. * The PCI configuration register BAR assignments are:
  1333. * BAR0, offset 0x10 - SLIM base memory address
  1334. * BAR1, offset 0x14 - SLIM base memory high address
  1335. * BAR2, offset 0x18 - REGISTER base memory address
  1336. * BAR3, offset 0x1c - REGISTER base memory high address
  1337. * BAR4, offset 0x20 - BIU I/O registers
  1338. * BAR5, offset 0x24 - REGISTER base io high address
  1339. */
  1340. /* Number of rings currently used and available. */
  1341. #define MAX_SLI3_CONFIGURED_RINGS 3
  1342. #define MAX_SLI3_RINGS 4
  1343. /* IOCB / Mailbox is owned by FireFly */
  1344. #define OWN_CHIP 1
  1345. /* IOCB / Mailbox is owned by Host */
  1346. #define OWN_HOST 0
  1347. /* Number of 4-byte words in an IOCB. */
  1348. #define IOCB_WORD_SZ 8
  1349. /* network headers for Dfctl field */
  1350. #define FC_NET_HDR 0x20
  1351. /* Start FireFly Register definitions */
  1352. #define PCI_VENDOR_ID_EMULEX 0x10df
  1353. #define PCI_DEVICE_ID_FIREFLY 0x1ae5
  1354. #define PCI_DEVICE_ID_PROTEUS_VF 0xe100
  1355. #define PCI_DEVICE_ID_BALIUS 0xe131
  1356. #define PCI_DEVICE_ID_PROTEUS_PF 0xe180
  1357. #define PCI_DEVICE_ID_LANCER_FC 0xe200
  1358. #define PCI_DEVICE_ID_LANCER_FC_VF 0xe208
  1359. #define PCI_DEVICE_ID_LANCER_FCOE 0xe260
  1360. #define PCI_DEVICE_ID_LANCER_FCOE_VF 0xe268
  1361. #define PCI_DEVICE_ID_LANCER_G6_FC 0xe300
  1362. #define PCI_DEVICE_ID_SAT_SMB 0xf011
  1363. #define PCI_DEVICE_ID_SAT_MID 0xf015
  1364. #define PCI_DEVICE_ID_RFLY 0xf095
  1365. #define PCI_DEVICE_ID_PFLY 0xf098
  1366. #define PCI_DEVICE_ID_LP101 0xf0a1
  1367. #define PCI_DEVICE_ID_TFLY 0xf0a5
  1368. #define PCI_DEVICE_ID_BSMB 0xf0d1
  1369. #define PCI_DEVICE_ID_BMID 0xf0d5
  1370. #define PCI_DEVICE_ID_ZSMB 0xf0e1
  1371. #define PCI_DEVICE_ID_ZMID 0xf0e5
  1372. #define PCI_DEVICE_ID_NEPTUNE 0xf0f5
  1373. #define PCI_DEVICE_ID_NEPTUNE_SCSP 0xf0f6
  1374. #define PCI_DEVICE_ID_NEPTUNE_DCSP 0xf0f7
  1375. #define PCI_DEVICE_ID_SAT 0xf100
  1376. #define PCI_DEVICE_ID_SAT_SCSP 0xf111
  1377. #define PCI_DEVICE_ID_SAT_DCSP 0xf112
  1378. #define PCI_DEVICE_ID_FALCON 0xf180
  1379. #define PCI_DEVICE_ID_SUPERFLY 0xf700
  1380. #define PCI_DEVICE_ID_DRAGONFLY 0xf800
  1381. #define PCI_DEVICE_ID_CENTAUR 0xf900
  1382. #define PCI_DEVICE_ID_PEGASUS 0xf980
  1383. #define PCI_DEVICE_ID_THOR 0xfa00
  1384. #define PCI_DEVICE_ID_VIPER 0xfb00
  1385. #define PCI_DEVICE_ID_LP10000S 0xfc00
  1386. #define PCI_DEVICE_ID_LP11000S 0xfc10
  1387. #define PCI_DEVICE_ID_LPE11000S 0xfc20
  1388. #define PCI_DEVICE_ID_SAT_S 0xfc40
  1389. #define PCI_DEVICE_ID_PROTEUS_S 0xfc50
  1390. #define PCI_DEVICE_ID_HELIOS 0xfd00
  1391. #define PCI_DEVICE_ID_HELIOS_SCSP 0xfd11
  1392. #define PCI_DEVICE_ID_HELIOS_DCSP 0xfd12
  1393. #define PCI_DEVICE_ID_ZEPHYR 0xfe00
  1394. #define PCI_DEVICE_ID_HORNET 0xfe05
  1395. #define PCI_DEVICE_ID_ZEPHYR_SCSP 0xfe11
  1396. #define PCI_DEVICE_ID_ZEPHYR_DCSP 0xfe12
  1397. #define PCI_VENDOR_ID_SERVERENGINE 0x19a2
  1398. #define PCI_DEVICE_ID_TIGERSHARK 0x0704
  1399. #define PCI_DEVICE_ID_TOMCAT 0x0714
  1400. #define PCI_DEVICE_ID_SKYHAWK 0x0724
  1401. #define PCI_DEVICE_ID_SKYHAWK_VF 0x072c
  1402. #define JEDEC_ID_ADDRESS 0x0080001c
  1403. #define FIREFLY_JEDEC_ID 0x1ACC
  1404. #define SUPERFLY_JEDEC_ID 0x0020
  1405. #define DRAGONFLY_JEDEC_ID 0x0021
  1406. #define DRAGONFLY_V2_JEDEC_ID 0x0025
  1407. #define CENTAUR_2G_JEDEC_ID 0x0026
  1408. #define CENTAUR_1G_JEDEC_ID 0x0028
  1409. #define PEGASUS_ORION_JEDEC_ID 0x0036
  1410. #define PEGASUS_JEDEC_ID 0x0038
  1411. #define THOR_JEDEC_ID 0x0012
  1412. #define HELIOS_JEDEC_ID 0x0364
  1413. #define ZEPHYR_JEDEC_ID 0x0577
  1414. #define VIPER_JEDEC_ID 0x4838
  1415. #define SATURN_JEDEC_ID 0x1004
  1416. #define HORNET_JDEC_ID 0x2057706D
  1417. #define JEDEC_ID_MASK 0x0FFFF000
  1418. #define JEDEC_ID_SHIFT 12
  1419. #define FC_JEDEC_ID(id) ((id & JEDEC_ID_MASK) >> JEDEC_ID_SHIFT)
  1420. typedef struct { /* FireFly BIU registers */
  1421. uint32_t hostAtt; /* See definitions for Host Attention
  1422. register */
  1423. uint32_t chipAtt; /* See definitions for Chip Attention
  1424. register */
  1425. uint32_t hostStatus; /* See definitions for Host Status register */
  1426. uint32_t hostControl; /* See definitions for Host Control register */
  1427. uint32_t buiConfig; /* See definitions for BIU configuration
  1428. register */
  1429. } FF_REGS;
  1430. /* IO Register size in bytes */
  1431. #define FF_REG_AREA_SIZE 256
  1432. /* Host Attention Register */
  1433. #define HA_REG_OFFSET 0 /* Byte offset from register base address */
  1434. #define HA_R0RE_REQ 0x00000001 /* Bit 0 */
  1435. #define HA_R0CE_RSP 0x00000002 /* Bit 1 */
  1436. #define HA_R0ATT 0x00000008 /* Bit 3 */
  1437. #define HA_R1RE_REQ 0x00000010 /* Bit 4 */
  1438. #define HA_R1CE_RSP 0x00000020 /* Bit 5 */
  1439. #define HA_R1ATT 0x00000080 /* Bit 7 */
  1440. #define HA_R2RE_REQ 0x00000100 /* Bit 8 */
  1441. #define HA_R2CE_RSP 0x00000200 /* Bit 9 */
  1442. #define HA_R2ATT 0x00000800 /* Bit 11 */
  1443. #define HA_R3RE_REQ 0x00001000 /* Bit 12 */
  1444. #define HA_R3CE_RSP 0x00002000 /* Bit 13 */
  1445. #define HA_R3ATT 0x00008000 /* Bit 15 */
  1446. #define HA_LATT 0x20000000 /* Bit 29 */
  1447. #define HA_MBATT 0x40000000 /* Bit 30 */
  1448. #define HA_ERATT 0x80000000 /* Bit 31 */
  1449. #define HA_RXRE_REQ 0x00000001 /* Bit 0 */
  1450. #define HA_RXCE_RSP 0x00000002 /* Bit 1 */
  1451. #define HA_RXATT 0x00000008 /* Bit 3 */
  1452. #define HA_RXMASK 0x0000000f
  1453. #define HA_R0_CLR_MSK (HA_R0RE_REQ | HA_R0CE_RSP | HA_R0ATT)
  1454. #define HA_R1_CLR_MSK (HA_R1RE_REQ | HA_R1CE_RSP | HA_R1ATT)
  1455. #define HA_R2_CLR_MSK (HA_R2RE_REQ | HA_R2CE_RSP | HA_R2ATT)
  1456. #define HA_R3_CLR_MSK (HA_R3RE_REQ | HA_R3CE_RSP | HA_R3ATT)
  1457. #define HA_R0_POS 3
  1458. #define HA_R1_POS 7
  1459. #define HA_R2_POS 11
  1460. #define HA_R3_POS 15
  1461. #define HA_LE_POS 29
  1462. #define HA_MB_POS 30
  1463. #define HA_ER_POS 31
  1464. /* Chip Attention Register */
  1465. #define CA_REG_OFFSET 4 /* Byte offset from register base address */
  1466. #define CA_R0CE_REQ 0x00000001 /* Bit 0 */
  1467. #define CA_R0RE_RSP 0x00000002 /* Bit 1 */
  1468. #define CA_R0ATT 0x00000008 /* Bit 3 */
  1469. #define CA_R1CE_REQ 0x00000010 /* Bit 4 */
  1470. #define CA_R1RE_RSP 0x00000020 /* Bit 5 */
  1471. #define CA_R1ATT 0x00000080 /* Bit 7 */
  1472. #define CA_R2CE_REQ 0x00000100 /* Bit 8 */
  1473. #define CA_R2RE_RSP 0x00000200 /* Bit 9 */
  1474. #define CA_R2ATT 0x00000800 /* Bit 11 */
  1475. #define CA_R3CE_REQ 0x00001000 /* Bit 12 */
  1476. #define CA_R3RE_RSP 0x00002000 /* Bit 13 */
  1477. #define CA_R3ATT 0x00008000 /* Bit 15 */
  1478. #define CA_MBATT 0x40000000 /* Bit 30 */
  1479. /* Host Status Register */
  1480. #define HS_REG_OFFSET 8 /* Byte offset from register base address */
  1481. #define HS_MBRDY 0x00400000 /* Bit 22 */
  1482. #define HS_FFRDY 0x00800000 /* Bit 23 */
  1483. #define HS_FFER8 0x01000000 /* Bit 24 */
  1484. #define HS_FFER7 0x02000000 /* Bit 25 */
  1485. #define HS_FFER6 0x04000000 /* Bit 26 */
  1486. #define HS_FFER5 0x08000000 /* Bit 27 */
  1487. #define HS_FFER4 0x10000000 /* Bit 28 */
  1488. #define HS_FFER3 0x20000000 /* Bit 29 */
  1489. #define HS_FFER2 0x40000000 /* Bit 30 */
  1490. #define HS_FFER1 0x80000000 /* Bit 31 */
  1491. #define HS_CRIT_TEMP 0x00000100 /* Bit 8 */
  1492. #define HS_FFERM 0xFF000100 /* Mask for error bits 31:24 and 8 */
  1493. #define UNPLUG_ERR 0x00000001 /* Indicate pci hot unplug */
  1494. /* Host Control Register */
  1495. #define HC_REG_OFFSET 12 /* Byte offset from register base address */
  1496. #define HC_MBINT_ENA 0x00000001 /* Bit 0 */
  1497. #define HC_R0INT_ENA 0x00000002 /* Bit 1 */
  1498. #define HC_R1INT_ENA 0x00000004 /* Bit 2 */
  1499. #define HC_R2INT_ENA 0x00000008 /* Bit 3 */
  1500. #define HC_R3INT_ENA 0x00000010 /* Bit 4 */
  1501. #define HC_INITHBI 0x02000000 /* Bit 25 */
  1502. #define HC_INITMB 0x04000000 /* Bit 26 */
  1503. #define HC_INITFF 0x08000000 /* Bit 27 */
  1504. #define HC_LAINT_ENA 0x20000000 /* Bit 29 */
  1505. #define HC_ERINT_ENA 0x80000000 /* Bit 31 */
  1506. /* Message Signaled Interrupt eXtension (MSI-X) message identifiers */
  1507. #define MSIX_DFLT_ID 0
  1508. #define MSIX_RNG0_ID 0
  1509. #define MSIX_RNG1_ID 1
  1510. #define MSIX_RNG2_ID 2
  1511. #define MSIX_RNG3_ID 3
  1512. #define MSIX_LINK_ID 4
  1513. #define MSIX_MBOX_ID 5
  1514. #define MSIX_SPARE0_ID 6
  1515. #define MSIX_SPARE1_ID 7
  1516. /* Mailbox Commands */
  1517. #define MBX_SHUTDOWN 0x00 /* terminate testing */
  1518. #define MBX_LOAD_SM 0x01
  1519. #define MBX_READ_NV 0x02
  1520. #define MBX_WRITE_NV 0x03
  1521. #define MBX_RUN_BIU_DIAG 0x04
  1522. #define MBX_INIT_LINK 0x05
  1523. #define MBX_DOWN_LINK 0x06
  1524. #define MBX_CONFIG_LINK 0x07
  1525. #define MBX_CONFIG_RING 0x09
  1526. #define MBX_RESET_RING 0x0A
  1527. #define MBX_READ_CONFIG 0x0B
  1528. #define MBX_READ_RCONFIG 0x0C
  1529. #define MBX_READ_SPARM 0x0D
  1530. #define MBX_READ_STATUS 0x0E
  1531. #define MBX_READ_RPI 0x0F
  1532. #define MBX_READ_XRI 0x10
  1533. #define MBX_READ_REV 0x11
  1534. #define MBX_READ_LNK_STAT 0x12
  1535. #define MBX_REG_LOGIN 0x13
  1536. #define MBX_UNREG_LOGIN 0x14
  1537. #define MBX_CLEAR_LA 0x16
  1538. #define MBX_DUMP_MEMORY 0x17
  1539. #define MBX_DUMP_CONTEXT 0x18
  1540. #define MBX_RUN_DIAGS 0x19
  1541. #define MBX_RESTART 0x1A
  1542. #define MBX_UPDATE_CFG 0x1B
  1543. #define MBX_DOWN_LOAD 0x1C
  1544. #define MBX_DEL_LD_ENTRY 0x1D
  1545. #define MBX_RUN_PROGRAM 0x1E
  1546. #define MBX_SET_MASK 0x20
  1547. #define MBX_SET_VARIABLE 0x21
  1548. #define MBX_UNREG_D_ID 0x23
  1549. #define MBX_KILL_BOARD 0x24
  1550. #define MBX_CONFIG_FARP 0x25
  1551. #define MBX_BEACON 0x2A
  1552. #define MBX_CONFIG_MSI 0x30
  1553. #define MBX_HEARTBEAT 0x31
  1554. #define MBX_WRITE_VPARMS 0x32
  1555. #define MBX_ASYNCEVT_ENABLE 0x33
  1556. #define MBX_READ_EVENT_LOG_STATUS 0x37
  1557. #define MBX_READ_EVENT_LOG 0x38
  1558. #define MBX_WRITE_EVENT_LOG 0x39
  1559. #define MBX_PORT_CAPABILITIES 0x3B
  1560. #define MBX_PORT_IOV_CONTROL 0x3C
  1561. #define MBX_CONFIG_HBQ 0x7C
  1562. #define MBX_LOAD_AREA 0x81
  1563. #define MBX_RUN_BIU_DIAG64 0x84
  1564. #define MBX_CONFIG_PORT 0x88
  1565. #define MBX_READ_SPARM64 0x8D
  1566. #define MBX_READ_RPI64 0x8F
  1567. #define MBX_REG_LOGIN64 0x93
  1568. #define MBX_READ_TOPOLOGY 0x95
  1569. #define MBX_REG_VPI 0x96
  1570. #define MBX_UNREG_VPI 0x97
  1571. #define MBX_WRITE_WWN 0x98
  1572. #define MBX_SET_DEBUG 0x99
  1573. #define MBX_LOAD_EXP_ROM 0x9C
  1574. #define MBX_SLI4_CONFIG 0x9B
  1575. #define MBX_SLI4_REQ_FTRS 0x9D
  1576. #define MBX_MAX_CMDS 0x9E
  1577. #define MBX_RESUME_RPI 0x9E
  1578. #define MBX_SLI2_CMD_MASK 0x80
  1579. #define MBX_REG_VFI 0x9F
  1580. #define MBX_REG_FCFI 0xA0
  1581. #define MBX_UNREG_VFI 0xA1
  1582. #define MBX_UNREG_FCFI 0xA2
  1583. #define MBX_INIT_VFI 0xA3
  1584. #define MBX_INIT_VPI 0xA4
  1585. #define MBX_ACCESS_VDATA 0xA5
  1586. #define MBX_AUTH_PORT 0xF8
  1587. #define MBX_SECURITY_MGMT 0xF9
  1588. /* IOCB Commands */
  1589. #define CMD_RCV_SEQUENCE_CX 0x01
  1590. #define CMD_XMIT_SEQUENCE_CR 0x02
  1591. #define CMD_XMIT_SEQUENCE_CX 0x03
  1592. #define CMD_XMIT_BCAST_CN 0x04
  1593. #define CMD_XMIT_BCAST_CX 0x05
  1594. #define CMD_QUE_RING_BUF_CN 0x06
  1595. #define CMD_QUE_XRI_BUF_CX 0x07
  1596. #define CMD_IOCB_CONTINUE_CN 0x08
  1597. #define CMD_RET_XRI_BUF_CX 0x09
  1598. #define CMD_ELS_REQUEST_CR 0x0A
  1599. #define CMD_ELS_REQUEST_CX 0x0B
  1600. #define CMD_RCV_ELS_REQ_CX 0x0D
  1601. #define CMD_ABORT_XRI_CN 0x0E
  1602. #define CMD_ABORT_XRI_CX 0x0F
  1603. #define CMD_CLOSE_XRI_CN 0x10
  1604. #define CMD_CLOSE_XRI_CX 0x11
  1605. #define CMD_CREATE_XRI_CR 0x12
  1606. #define CMD_CREATE_XRI_CX 0x13
  1607. #define CMD_GET_RPI_CN 0x14
  1608. #define CMD_XMIT_ELS_RSP_CX 0x15
  1609. #define CMD_GET_RPI_CR 0x16
  1610. #define CMD_XRI_ABORTED_CX 0x17
  1611. #define CMD_FCP_IWRITE_CR 0x18
  1612. #define CMD_FCP_IWRITE_CX 0x19
  1613. #define CMD_FCP_IREAD_CR 0x1A
  1614. #define CMD_FCP_IREAD_CX 0x1B
  1615. #define CMD_FCP_ICMND_CR 0x1C
  1616. #define CMD_FCP_ICMND_CX 0x1D
  1617. #define CMD_FCP_TSEND_CX 0x1F
  1618. #define CMD_FCP_TRECEIVE_CX 0x21
  1619. #define CMD_FCP_TRSP_CX 0x23
  1620. #define CMD_FCP_AUTO_TRSP_CX 0x29
  1621. #define CMD_ADAPTER_MSG 0x20
  1622. #define CMD_ADAPTER_DUMP 0x22
  1623. /* SLI_2 IOCB Command Set */
  1624. #define CMD_ASYNC_STATUS 0x7C
  1625. #define CMD_RCV_SEQUENCE64_CX 0x81
  1626. #define CMD_XMIT_SEQUENCE64_CR 0x82
  1627. #define CMD_XMIT_SEQUENCE64_CX 0x83
  1628. #define CMD_XMIT_BCAST64_CN 0x84
  1629. #define CMD_XMIT_BCAST64_CX 0x85
  1630. #define CMD_QUE_RING_BUF64_CN 0x86
  1631. #define CMD_QUE_XRI_BUF64_CX 0x87
  1632. #define CMD_IOCB_CONTINUE64_CN 0x88
  1633. #define CMD_RET_XRI_BUF64_CX 0x89
  1634. #define CMD_ELS_REQUEST64_CR 0x8A
  1635. #define CMD_ELS_REQUEST64_CX 0x8B
  1636. #define CMD_ABORT_MXRI64_CN 0x8C
  1637. #define CMD_RCV_ELS_REQ64_CX 0x8D
  1638. #define CMD_XMIT_ELS_RSP64_CX 0x95
  1639. #define CMD_XMIT_BLS_RSP64_CX 0x97
  1640. #define CMD_FCP_IWRITE64_CR 0x98
  1641. #define CMD_FCP_IWRITE64_CX 0x99
  1642. #define CMD_FCP_IREAD64_CR 0x9A
  1643. #define CMD_FCP_IREAD64_CX 0x9B
  1644. #define CMD_FCP_ICMND64_CR 0x9C
  1645. #define CMD_FCP_ICMND64_CX 0x9D
  1646. #define CMD_FCP_TSEND64_CX 0x9F
  1647. #define CMD_FCP_TRECEIVE64_CX 0xA1
  1648. #define CMD_FCP_TRSP64_CX 0xA3
  1649. #define CMD_QUE_XRI64_CX 0xB3
  1650. #define CMD_IOCB_RCV_SEQ64_CX 0xB5
  1651. #define CMD_IOCB_RCV_ELS64_CX 0xB7
  1652. #define CMD_IOCB_RET_XRI64_CX 0xB9
  1653. #define CMD_IOCB_RCV_CONT64_CX 0xBB
  1654. #define CMD_GEN_REQUEST64_CR 0xC2
  1655. #define CMD_GEN_REQUEST64_CX 0xC3
  1656. /* Unhandled SLI-3 Commands */
  1657. #define CMD_IOCB_XMIT_MSEQ64_CR 0xB0
  1658. #define CMD_IOCB_XMIT_MSEQ64_CX 0xB1
  1659. #define CMD_IOCB_RCV_SEQ_LIST64_CX 0xC1
  1660. #define CMD_IOCB_RCV_ELS_LIST64_CX 0xCD
  1661. #define CMD_IOCB_CLOSE_EXTENDED_CN 0xB6
  1662. #define CMD_IOCB_ABORT_EXTENDED_CN 0xBA
  1663. #define CMD_IOCB_RET_HBQE64_CN 0xCA
  1664. #define CMD_IOCB_FCP_IBIDIR64_CR 0xAC
  1665. #define CMD_IOCB_FCP_IBIDIR64_CX 0xAD
  1666. #define CMD_IOCB_FCP_ITASKMGT64_CX 0xAF
  1667. #define CMD_IOCB_LOGENTRY_CN 0x94
  1668. #define CMD_IOCB_LOGENTRY_ASYNC_CN 0x96
  1669. /* Data Security SLI Commands */
  1670. #define DSSCMD_IWRITE64_CR 0xF8
  1671. #define DSSCMD_IWRITE64_CX 0xF9
  1672. #define DSSCMD_IREAD64_CR 0xFA
  1673. #define DSSCMD_IREAD64_CX 0xFB
  1674. #define CMD_MAX_IOCB_CMD 0xFB
  1675. #define CMD_IOCB_MASK 0xff
  1676. #define MAX_MSG_DATA 28 /* max msg data in CMD_ADAPTER_MSG
  1677. iocb */
  1678. #define LPFC_MAX_ADPTMSG 32 /* max msg data */
  1679. /*
  1680. * Define Status
  1681. */
  1682. #define MBX_SUCCESS 0
  1683. #define MBXERR_NUM_RINGS 1
  1684. #define MBXERR_NUM_IOCBS 2
  1685. #define MBXERR_IOCBS_EXCEEDED 3
  1686. #define MBXERR_BAD_RING_NUMBER 4
  1687. #define MBXERR_MASK_ENTRIES_RANGE 5
  1688. #define MBXERR_MASKS_EXCEEDED 6
  1689. #define MBXERR_BAD_PROFILE 7
  1690. #define MBXERR_BAD_DEF_CLASS 8
  1691. #define MBXERR_BAD_MAX_RESPONDER 9
  1692. #define MBXERR_BAD_MAX_ORIGINATOR 10
  1693. #define MBXERR_RPI_REGISTERED 11
  1694. #define MBXERR_RPI_FULL 12
  1695. #define MBXERR_NO_RESOURCES 13
  1696. #define MBXERR_BAD_RCV_LENGTH 14
  1697. #define MBXERR_DMA_ERROR 15
  1698. #define MBXERR_ERROR 16
  1699. #define MBXERR_LINK_DOWN 0x33
  1700. #define MBXERR_SEC_NO_PERMISSION 0xF02
  1701. #define MBX_NOT_FINISHED 255
  1702. #define MBX_BUSY 0xffffff /* Attempted cmd to busy Mailbox */
  1703. #define MBX_TIMEOUT 0xfffffe /* time-out expired waiting for */
  1704. #define TEMPERATURE_OFFSET 0xB0 /* Slim offset for critical temperature event */
  1705. /*
  1706. * return code Fail
  1707. */
  1708. #define FAILURE 1
  1709. /*
  1710. * Begin Structure Definitions for Mailbox Commands
  1711. */
  1712. typedef struct {
  1713. #ifdef __BIG_ENDIAN_BITFIELD
  1714. uint8_t tval;
  1715. uint8_t tmask;
  1716. uint8_t rval;
  1717. uint8_t rmask;
  1718. #else /* __LITTLE_ENDIAN_BITFIELD */
  1719. uint8_t rmask;
  1720. uint8_t rval;
  1721. uint8_t tmask;
  1722. uint8_t tval;
  1723. #endif
  1724. } RR_REG;
  1725. struct ulp_bde {
  1726. uint32_t bdeAddress;
  1727. #ifdef __BIG_ENDIAN_BITFIELD
  1728. uint32_t bdeReserved:4;
  1729. uint32_t bdeAddrHigh:4;
  1730. uint32_t bdeSize:24;
  1731. #else /* __LITTLE_ENDIAN_BITFIELD */
  1732. uint32_t bdeSize:24;
  1733. uint32_t bdeAddrHigh:4;
  1734. uint32_t bdeReserved:4;
  1735. #endif
  1736. };
  1737. typedef struct ULP_BDL { /* SLI-2 */
  1738. #ifdef __BIG_ENDIAN_BITFIELD
  1739. uint32_t bdeFlags:8; /* BDL Flags */
  1740. uint32_t bdeSize:24; /* Size of BDL array in host memory (bytes) */
  1741. #else /* __LITTLE_ENDIAN_BITFIELD */
  1742. uint32_t bdeSize:24; /* Size of BDL array in host memory (bytes) */
  1743. uint32_t bdeFlags:8; /* BDL Flags */
  1744. #endif
  1745. uint32_t addrLow; /* Address 0:31 */
  1746. uint32_t addrHigh; /* Address 32:63 */
  1747. uint32_t ulpIoTag32; /* Can be used for 32 bit I/O Tag */
  1748. } ULP_BDL;
  1749. /*
  1750. * BlockGuard Definitions
  1751. */
  1752. enum lpfc_protgrp_type {
  1753. LPFC_PG_TYPE_INVALID = 0, /* used to indicate errors */
  1754. LPFC_PG_TYPE_NO_DIF, /* no DIF data pointed to by prot grp */
  1755. LPFC_PG_TYPE_EMBD_DIF, /* DIF is embedded (inline) with data */
  1756. LPFC_PG_TYPE_DIF_BUF /* DIF has its own scatter/gather list */
  1757. };
  1758. /* PDE Descriptors */
  1759. #define LPFC_PDE5_DESCRIPTOR 0x85
  1760. #define LPFC_PDE6_DESCRIPTOR 0x86
  1761. #define LPFC_PDE7_DESCRIPTOR 0x87
  1762. /* BlockGuard Opcodes */
  1763. #define BG_OP_IN_NODIF_OUT_CRC 0x0
  1764. #define BG_OP_IN_CRC_OUT_NODIF 0x1
  1765. #define BG_OP_IN_NODIF_OUT_CSUM 0x2
  1766. #define BG_OP_IN_CSUM_OUT_NODIF 0x3
  1767. #define BG_OP_IN_CRC_OUT_CRC 0x4
  1768. #define BG_OP_IN_CSUM_OUT_CSUM 0x5
  1769. #define BG_OP_IN_CRC_OUT_CSUM 0x6
  1770. #define BG_OP_IN_CSUM_OUT_CRC 0x7
  1771. #define BG_OP_RAW_MODE 0x8
  1772. struct lpfc_pde5 {
  1773. uint32_t word0;
  1774. #define pde5_type_SHIFT 24
  1775. #define pde5_type_MASK 0x000000ff
  1776. #define pde5_type_WORD word0
  1777. #define pde5_rsvd0_SHIFT 0
  1778. #define pde5_rsvd0_MASK 0x00ffffff
  1779. #define pde5_rsvd0_WORD word0
  1780. uint32_t reftag; /* Reference Tag Value */
  1781. uint32_t reftagtr; /* Reference Tag Translation Value */
  1782. };
  1783. struct lpfc_pde6 {
  1784. uint32_t word0;
  1785. #define pde6_type_SHIFT 24
  1786. #define pde6_type_MASK 0x000000ff
  1787. #define pde6_type_WORD word0
  1788. #define pde6_rsvd0_SHIFT 0
  1789. #define pde6_rsvd0_MASK 0x00ffffff
  1790. #define pde6_rsvd0_WORD word0
  1791. uint32_t word1;
  1792. #define pde6_rsvd1_SHIFT 26
  1793. #define pde6_rsvd1_MASK 0x0000003f
  1794. #define pde6_rsvd1_WORD word1
  1795. #define pde6_na_SHIFT 25
  1796. #define pde6_na_MASK 0x00000001
  1797. #define pde6_na_WORD word1
  1798. #define pde6_rsvd2_SHIFT 16
  1799. #define pde6_rsvd2_MASK 0x000001FF
  1800. #define pde6_rsvd2_WORD word1
  1801. #define pde6_apptagtr_SHIFT 0
  1802. #define pde6_apptagtr_MASK 0x0000ffff
  1803. #define pde6_apptagtr_WORD word1
  1804. uint32_t word2;
  1805. #define pde6_optx_SHIFT 28
  1806. #define pde6_optx_MASK 0x0000000f
  1807. #define pde6_optx_WORD word2
  1808. #define pde6_oprx_SHIFT 24
  1809. #define pde6_oprx_MASK 0x0000000f
  1810. #define pde6_oprx_WORD word2
  1811. #define pde6_nr_SHIFT 23
  1812. #define pde6_nr_MASK 0x00000001
  1813. #define pde6_nr_WORD word2
  1814. #define pde6_ce_SHIFT 22
  1815. #define pde6_ce_MASK 0x00000001
  1816. #define pde6_ce_WORD word2
  1817. #define pde6_re_SHIFT 21
  1818. #define pde6_re_MASK 0x00000001
  1819. #define pde6_re_WORD word2
  1820. #define pde6_ae_SHIFT 20
  1821. #define pde6_ae_MASK 0x00000001
  1822. #define pde6_ae_WORD word2
  1823. #define pde6_ai_SHIFT 19
  1824. #define pde6_ai_MASK 0x00000001
  1825. #define pde6_ai_WORD word2
  1826. #define pde6_bs_SHIFT 16
  1827. #define pde6_bs_MASK 0x00000007
  1828. #define pde6_bs_WORD word2
  1829. #define pde6_apptagval_SHIFT 0
  1830. #define pde6_apptagval_MASK 0x0000ffff
  1831. #define pde6_apptagval_WORD word2
  1832. };
  1833. struct lpfc_pde7 {
  1834. uint32_t word0;
  1835. #define pde7_type_SHIFT 24
  1836. #define pde7_type_MASK 0x000000ff
  1837. #define pde7_type_WORD word0
  1838. #define pde7_rsvd0_SHIFT 0
  1839. #define pde7_rsvd0_MASK 0x00ffffff
  1840. #define pde7_rsvd0_WORD word0
  1841. uint32_t addrHigh;
  1842. uint32_t addrLow;
  1843. };
  1844. /* Structure for MB Command LOAD_SM and DOWN_LOAD */
  1845. typedef struct {
  1846. #ifdef __BIG_ENDIAN_BITFIELD
  1847. uint32_t rsvd2:25;
  1848. uint32_t acknowledgment:1;
  1849. uint32_t version:1;
  1850. uint32_t erase_or_prog:1;
  1851. uint32_t update_flash:1;
  1852. uint32_t update_ram:1;
  1853. uint32_t method:1;
  1854. uint32_t load_cmplt:1;
  1855. #else /* __LITTLE_ENDIAN_BITFIELD */
  1856. uint32_t load_cmplt:1;
  1857. uint32_t method:1;
  1858. uint32_t update_ram:1;
  1859. uint32_t update_flash:1;
  1860. uint32_t erase_or_prog:1;
  1861. uint32_t version:1;
  1862. uint32_t acknowledgment:1;
  1863. uint32_t rsvd2:25;
  1864. #endif
  1865. uint32_t dl_to_adr_low;
  1866. uint32_t dl_to_adr_high;
  1867. uint32_t dl_len;
  1868. union {
  1869. uint32_t dl_from_mbx_offset;
  1870. struct ulp_bde dl_from_bde;
  1871. struct ulp_bde64 dl_from_bde64;
  1872. } un;
  1873. } LOAD_SM_VAR;
  1874. /* Structure for MB Command READ_NVPARM (02) */
  1875. typedef struct {
  1876. uint32_t rsvd1[3]; /* Read as all one's */
  1877. uint32_t rsvd2; /* Read as all zero's */
  1878. uint32_t portname[2]; /* N_PORT name */
  1879. uint32_t nodename[2]; /* NODE name */
  1880. #ifdef __BIG_ENDIAN_BITFIELD
  1881. uint32_t pref_DID:24;
  1882. uint32_t hardAL_PA:8;
  1883. #else /* __LITTLE_ENDIAN_BITFIELD */
  1884. uint32_t hardAL_PA:8;
  1885. uint32_t pref_DID:24;
  1886. #endif
  1887. uint32_t rsvd3[21]; /* Read as all one's */
  1888. } READ_NV_VAR;
  1889. /* Structure for MB Command WRITE_NVPARMS (03) */
  1890. typedef struct {
  1891. uint32_t rsvd1[3]; /* Must be all one's */
  1892. uint32_t rsvd2; /* Must be all zero's */
  1893. uint32_t portname[2]; /* N_PORT name */
  1894. uint32_t nodename[2]; /* NODE name */
  1895. #ifdef __BIG_ENDIAN_BITFIELD
  1896. uint32_t pref_DID:24;
  1897. uint32_t hardAL_PA:8;
  1898. #else /* __LITTLE_ENDIAN_BITFIELD */
  1899. uint32_t hardAL_PA:8;
  1900. uint32_t pref_DID:24;
  1901. #endif
  1902. uint32_t rsvd3[21]; /* Must be all one's */
  1903. } WRITE_NV_VAR;
  1904. /* Structure for MB Command RUN_BIU_DIAG (04) */
  1905. /* Structure for MB Command RUN_BIU_DIAG64 (0x84) */
  1906. typedef struct {
  1907. uint32_t rsvd1;
  1908. union {
  1909. struct {
  1910. struct ulp_bde xmit_bde;
  1911. struct ulp_bde rcv_bde;
  1912. } s1;
  1913. struct {
  1914. struct ulp_bde64 xmit_bde64;
  1915. struct ulp_bde64 rcv_bde64;
  1916. } s2;
  1917. } un;
  1918. } BIU_DIAG_VAR;
  1919. /* Structure for MB command READ_EVENT_LOG (0x38) */
  1920. struct READ_EVENT_LOG_VAR {
  1921. uint32_t word1;
  1922. #define lpfc_event_log_SHIFT 29
  1923. #define lpfc_event_log_MASK 0x00000001
  1924. #define lpfc_event_log_WORD word1
  1925. #define USE_MAILBOX_RESPONSE 1
  1926. uint32_t offset;
  1927. struct ulp_bde64 rcv_bde64;
  1928. };
  1929. /* Structure for MB Command INIT_LINK (05) */
  1930. typedef struct {
  1931. #ifdef __BIG_ENDIAN_BITFIELD
  1932. uint32_t rsvd1:24;
  1933. uint32_t lipsr_AL_PA:8; /* AL_PA to issue Lip Selective Reset to */
  1934. #else /* __LITTLE_ENDIAN_BITFIELD */
  1935. uint32_t lipsr_AL_PA:8; /* AL_PA to issue Lip Selective Reset to */
  1936. uint32_t rsvd1:24;
  1937. #endif
  1938. #ifdef __BIG_ENDIAN_BITFIELD
  1939. uint8_t fabric_AL_PA; /* If using a Fabric Assigned AL_PA */
  1940. uint8_t rsvd2;
  1941. uint16_t link_flags;
  1942. #else /* __LITTLE_ENDIAN_BITFIELD */
  1943. uint16_t link_flags;
  1944. uint8_t rsvd2;
  1945. uint8_t fabric_AL_PA; /* If using a Fabric Assigned AL_PA */
  1946. #endif
  1947. #define FLAGS_TOPOLOGY_MODE_LOOP_PT 0x00 /* Attempt loop then pt-pt */
  1948. #define FLAGS_LOCAL_LB 0x01 /* link_flags (=1) ENDEC loopback */
  1949. #define FLAGS_TOPOLOGY_MODE_PT_PT 0x02 /* Attempt pt-pt only */
  1950. #define FLAGS_TOPOLOGY_MODE_LOOP 0x04 /* Attempt loop only */
  1951. #define FLAGS_TOPOLOGY_MODE_PT_LOOP 0x06 /* Attempt pt-pt then loop */
  1952. #define FLAGS_UNREG_LOGIN_ALL 0x08 /* UNREG_LOGIN all on link down */
  1953. #define FLAGS_LIRP_LILP 0x80 /* LIRP / LILP is disabled */
  1954. #define FLAGS_TOPOLOGY_FAILOVER 0x0400 /* Bit 10 */
  1955. #define FLAGS_LINK_SPEED 0x0800 /* Bit 11 */
  1956. #define FLAGS_IMED_ABORT 0x04000 /* Bit 14 */
  1957. uint32_t link_speed;
  1958. #define LINK_SPEED_AUTO 0x0 /* Auto selection */
  1959. #define LINK_SPEED_1G 0x1 /* 1 Gigabaud */
  1960. #define LINK_SPEED_2G 0x2 /* 2 Gigabaud */
  1961. #define LINK_SPEED_4G 0x4 /* 4 Gigabaud */
  1962. #define LINK_SPEED_8G 0x8 /* 8 Gigabaud */
  1963. #define LINK_SPEED_10G 0x10 /* 10 Gigabaud */
  1964. #define LINK_SPEED_16G 0x11 /* 16 Gigabaud */
  1965. #define LINK_SPEED_32G 0x14 /* 32 Gigabaud */
  1966. } INIT_LINK_VAR;
  1967. /* Structure for MB Command DOWN_LINK (06) */
  1968. typedef struct {
  1969. uint32_t rsvd1;
  1970. } DOWN_LINK_VAR;
  1971. /* Structure for MB Command CONFIG_LINK (07) */
  1972. typedef struct {
  1973. #ifdef __BIG_ENDIAN_BITFIELD
  1974. uint32_t cr:1;
  1975. uint32_t ci:1;
  1976. uint32_t cr_delay:6;
  1977. uint32_t cr_count:8;
  1978. uint32_t rsvd1:8;
  1979. uint32_t MaxBBC:8;
  1980. #else /* __LITTLE_ENDIAN_BITFIELD */
  1981. uint32_t MaxBBC:8;
  1982. uint32_t rsvd1:8;
  1983. uint32_t cr_count:8;
  1984. uint32_t cr_delay:6;
  1985. uint32_t ci:1;
  1986. uint32_t cr:1;
  1987. #endif
  1988. uint32_t myId;
  1989. uint32_t rsvd2;
  1990. uint32_t edtov;
  1991. uint32_t arbtov;
  1992. uint32_t ratov;
  1993. uint32_t rttov;
  1994. uint32_t altov;
  1995. uint32_t crtov;
  1996. uint32_t citov;
  1997. #ifdef __BIG_ENDIAN_BITFIELD
  1998. uint32_t rrq_enable:1;
  1999. uint32_t rrq_immed:1;
  2000. uint32_t rsvd4:29;
  2001. uint32_t ack0_enable:1;
  2002. #else /* __LITTLE_ENDIAN_BITFIELD */
  2003. uint32_t ack0_enable:1;
  2004. uint32_t rsvd4:29;
  2005. uint32_t rrq_immed:1;
  2006. uint32_t rrq_enable:1;
  2007. #endif
  2008. } CONFIG_LINK;
  2009. /* Structure for MB Command PART_SLIM (08)
  2010. * will be removed since SLI1 is no longer supported!
  2011. */
  2012. typedef struct {
  2013. #ifdef __BIG_ENDIAN_BITFIELD
  2014. uint16_t offCiocb;
  2015. uint16_t numCiocb;
  2016. uint16_t offRiocb;
  2017. uint16_t numRiocb;
  2018. #else /* __LITTLE_ENDIAN_BITFIELD */
  2019. uint16_t numCiocb;
  2020. uint16_t offCiocb;
  2021. uint16_t numRiocb;
  2022. uint16_t offRiocb;
  2023. #endif
  2024. } RING_DEF;
  2025. typedef struct {
  2026. #ifdef __BIG_ENDIAN_BITFIELD
  2027. uint32_t unused1:24;
  2028. uint32_t numRing:8;
  2029. #else /* __LITTLE_ENDIAN_BITFIELD */
  2030. uint32_t numRing:8;
  2031. uint32_t unused1:24;
  2032. #endif
  2033. RING_DEF ringdef[4];
  2034. uint32_t hbainit;
  2035. } PART_SLIM_VAR;
  2036. /* Structure for MB Command CONFIG_RING (09) */
  2037. typedef struct {
  2038. #ifdef __BIG_ENDIAN_BITFIELD
  2039. uint32_t unused2:6;
  2040. uint32_t recvSeq:1;
  2041. uint32_t recvNotify:1;
  2042. uint32_t numMask:8;
  2043. uint32_t profile:8;
  2044. uint32_t unused1:4;
  2045. uint32_t ring:4;
  2046. #else /* __LITTLE_ENDIAN_BITFIELD */
  2047. uint32_t ring:4;
  2048. uint32_t unused1:4;
  2049. uint32_t profile:8;
  2050. uint32_t numMask:8;
  2051. uint32_t recvNotify:1;
  2052. uint32_t recvSeq:1;
  2053. uint32_t unused2:6;
  2054. #endif
  2055. #ifdef __BIG_ENDIAN_BITFIELD
  2056. uint16_t maxRespXchg;
  2057. uint16_t maxOrigXchg;
  2058. #else /* __LITTLE_ENDIAN_BITFIELD */
  2059. uint16_t maxOrigXchg;
  2060. uint16_t maxRespXchg;
  2061. #endif
  2062. RR_REG rrRegs[6];
  2063. } CONFIG_RING_VAR;
  2064. /* Structure for MB Command RESET_RING (10) */
  2065. typedef struct {
  2066. uint32_t ring_no;
  2067. } RESET_RING_VAR;
  2068. /* Structure for MB Command READ_CONFIG (11) */
  2069. typedef struct {
  2070. #ifdef __BIG_ENDIAN_BITFIELD
  2071. uint32_t cr:1;
  2072. uint32_t ci:1;
  2073. uint32_t cr_delay:6;
  2074. uint32_t cr_count:8;
  2075. uint32_t InitBBC:8;
  2076. uint32_t MaxBBC:8;
  2077. #else /* __LITTLE_ENDIAN_BITFIELD */
  2078. uint32_t MaxBBC:8;
  2079. uint32_t InitBBC:8;
  2080. uint32_t cr_count:8;
  2081. uint32_t cr_delay:6;
  2082. uint32_t ci:1;
  2083. uint32_t cr:1;
  2084. #endif
  2085. #ifdef __BIG_ENDIAN_BITFIELD
  2086. uint32_t topology:8;
  2087. uint32_t myDid:24;
  2088. #else /* __LITTLE_ENDIAN_BITFIELD */
  2089. uint32_t myDid:24;
  2090. uint32_t topology:8;
  2091. #endif
  2092. /* Defines for topology (defined previously) */
  2093. #ifdef __BIG_ENDIAN_BITFIELD
  2094. uint32_t AR:1;
  2095. uint32_t IR:1;
  2096. uint32_t rsvd1:29;
  2097. uint32_t ack0:1;
  2098. #else /* __LITTLE_ENDIAN_BITFIELD */
  2099. uint32_t ack0:1;
  2100. uint32_t rsvd1:29;
  2101. uint32_t IR:1;
  2102. uint32_t AR:1;
  2103. #endif
  2104. uint32_t edtov;
  2105. uint32_t arbtov;
  2106. uint32_t ratov;
  2107. uint32_t rttov;
  2108. uint32_t altov;
  2109. uint32_t lmt;
  2110. #define LMT_RESERVED 0x000 /* Not used */
  2111. #define LMT_1Gb 0x004
  2112. #define LMT_2Gb 0x008
  2113. #define LMT_4Gb 0x040
  2114. #define LMT_8Gb 0x080
  2115. #define LMT_10Gb 0x100
  2116. #define LMT_16Gb 0x200
  2117. #define LMT_32Gb 0x400
  2118. uint32_t rsvd2;
  2119. uint32_t rsvd3;
  2120. uint32_t max_xri;
  2121. uint32_t max_iocb;
  2122. uint32_t max_rpi;
  2123. uint32_t avail_xri;
  2124. uint32_t avail_iocb;
  2125. uint32_t avail_rpi;
  2126. uint32_t max_vpi;
  2127. uint32_t rsvd4;
  2128. uint32_t rsvd5;
  2129. uint32_t avail_vpi;
  2130. } READ_CONFIG_VAR;
  2131. /* Structure for MB Command READ_RCONFIG (12) */
  2132. typedef struct {
  2133. #ifdef __BIG_ENDIAN_BITFIELD
  2134. uint32_t rsvd2:7;
  2135. uint32_t recvNotify:1;
  2136. uint32_t numMask:8;
  2137. uint32_t profile:8;
  2138. uint32_t rsvd1:4;
  2139. uint32_t ring:4;
  2140. #else /* __LITTLE_ENDIAN_BITFIELD */
  2141. uint32_t ring:4;
  2142. uint32_t rsvd1:4;
  2143. uint32_t profile:8;
  2144. uint32_t numMask:8;
  2145. uint32_t recvNotify:1;
  2146. uint32_t rsvd2:7;
  2147. #endif
  2148. #ifdef __BIG_ENDIAN_BITFIELD
  2149. uint16_t maxResp;
  2150. uint16_t maxOrig;
  2151. #else /* __LITTLE_ENDIAN_BITFIELD */
  2152. uint16_t maxOrig;
  2153. uint16_t maxResp;
  2154. #endif
  2155. RR_REG rrRegs[6];
  2156. #ifdef __BIG_ENDIAN_BITFIELD
  2157. uint16_t cmdRingOffset;
  2158. uint16_t cmdEntryCnt;
  2159. uint16_t rspRingOffset;
  2160. uint16_t rspEntryCnt;
  2161. uint16_t nextCmdOffset;
  2162. uint16_t rsvd3;
  2163. uint16_t nextRspOffset;
  2164. uint16_t rsvd4;
  2165. #else /* __LITTLE_ENDIAN_BITFIELD */
  2166. uint16_t cmdEntryCnt;
  2167. uint16_t cmdRingOffset;
  2168. uint16_t rspEntryCnt;
  2169. uint16_t rspRingOffset;
  2170. uint16_t rsvd3;
  2171. uint16_t nextCmdOffset;
  2172. uint16_t rsvd4;
  2173. uint16_t nextRspOffset;
  2174. #endif
  2175. } READ_RCONF_VAR;
  2176. /* Structure for MB Command READ_SPARM (13) */
  2177. /* Structure for MB Command READ_SPARM64 (0x8D) */
  2178. typedef struct {
  2179. uint32_t rsvd1;
  2180. uint32_t rsvd2;
  2181. union {
  2182. struct ulp_bde sp; /* This BDE points to struct serv_parm
  2183. structure */
  2184. struct ulp_bde64 sp64;
  2185. } un;
  2186. #ifdef __BIG_ENDIAN_BITFIELD
  2187. uint16_t rsvd3;
  2188. uint16_t vpi;
  2189. #else /* __LITTLE_ENDIAN_BITFIELD */
  2190. uint16_t vpi;
  2191. uint16_t rsvd3;
  2192. #endif
  2193. } READ_SPARM_VAR;
  2194. /* Structure for MB Command READ_STATUS (14) */
  2195. typedef struct {
  2196. #ifdef __BIG_ENDIAN_BITFIELD
  2197. uint32_t rsvd1:31;
  2198. uint32_t clrCounters:1;
  2199. uint16_t activeXriCnt;
  2200. uint16_t activeRpiCnt;
  2201. #else /* __LITTLE_ENDIAN_BITFIELD */
  2202. uint32_t clrCounters:1;
  2203. uint32_t rsvd1:31;
  2204. uint16_t activeRpiCnt;
  2205. uint16_t activeXriCnt;
  2206. #endif
  2207. uint32_t xmitByteCnt;
  2208. uint32_t rcvByteCnt;
  2209. uint32_t xmitFrameCnt;
  2210. uint32_t rcvFrameCnt;
  2211. uint32_t xmitSeqCnt;
  2212. uint32_t rcvSeqCnt;
  2213. uint32_t totalOrigExchanges;
  2214. uint32_t totalRespExchanges;
  2215. uint32_t rcvPbsyCnt;
  2216. uint32_t rcvFbsyCnt;
  2217. } READ_STATUS_VAR;
  2218. /* Structure for MB Command READ_RPI (15) */
  2219. /* Structure for MB Command READ_RPI64 (0x8F) */
  2220. typedef struct {
  2221. #ifdef __BIG_ENDIAN_BITFIELD
  2222. uint16_t nextRpi;
  2223. uint16_t reqRpi;
  2224. uint32_t rsvd2:8;
  2225. uint32_t DID:24;
  2226. #else /* __LITTLE_ENDIAN_BITFIELD */
  2227. uint16_t reqRpi;
  2228. uint16_t nextRpi;
  2229. uint32_t DID:24;
  2230. uint32_t rsvd2:8;
  2231. #endif
  2232. union {
  2233. struct ulp_bde sp;
  2234. struct ulp_bde64 sp64;
  2235. } un;
  2236. } READ_RPI_VAR;
  2237. /* Structure for MB Command READ_XRI (16) */
  2238. typedef struct {
  2239. #ifdef __BIG_ENDIAN_BITFIELD
  2240. uint16_t nextXri;
  2241. uint16_t reqXri;
  2242. uint16_t rsvd1;
  2243. uint16_t rpi;
  2244. uint32_t rsvd2:8;
  2245. uint32_t DID:24;
  2246. uint32_t rsvd3:8;
  2247. uint32_t SID:24;
  2248. uint32_t rsvd4;
  2249. uint8_t seqId;
  2250. uint8_t rsvd5;
  2251. uint16_t seqCount;
  2252. uint16_t oxId;
  2253. uint16_t rxId;
  2254. uint32_t rsvd6:30;
  2255. uint32_t si:1;
  2256. uint32_t exchOrig:1;
  2257. #else /* __LITTLE_ENDIAN_BITFIELD */
  2258. uint16_t reqXri;
  2259. uint16_t nextXri;
  2260. uint16_t rpi;
  2261. uint16_t rsvd1;
  2262. uint32_t DID:24;
  2263. uint32_t rsvd2:8;
  2264. uint32_t SID:24;
  2265. uint32_t rsvd3:8;
  2266. uint32_t rsvd4;
  2267. uint16_t seqCount;
  2268. uint8_t rsvd5;
  2269. uint8_t seqId;
  2270. uint16_t rxId;
  2271. uint16_t oxId;
  2272. uint32_t exchOrig:1;
  2273. uint32_t si:1;
  2274. uint32_t rsvd6:30;
  2275. #endif
  2276. } READ_XRI_VAR;
  2277. /* Structure for MB Command READ_REV (17) */
  2278. typedef struct {
  2279. #ifdef __BIG_ENDIAN_BITFIELD
  2280. uint32_t cv:1;
  2281. uint32_t rr:1;
  2282. uint32_t rsvd2:2;
  2283. uint32_t v3req:1;
  2284. uint32_t v3rsp:1;
  2285. uint32_t rsvd1:25;
  2286. uint32_t rv:1;
  2287. #else /* __LITTLE_ENDIAN_BITFIELD */
  2288. uint32_t rv:1;
  2289. uint32_t rsvd1:25;
  2290. uint32_t v3rsp:1;
  2291. uint32_t v3req:1;
  2292. uint32_t rsvd2:2;
  2293. uint32_t rr:1;
  2294. uint32_t cv:1;
  2295. #endif
  2296. uint32_t biuRev;
  2297. uint32_t smRev;
  2298. union {
  2299. uint32_t smFwRev;
  2300. struct {
  2301. #ifdef __BIG_ENDIAN_BITFIELD
  2302. uint8_t ProgType;
  2303. uint8_t ProgId;
  2304. uint16_t ProgVer:4;
  2305. uint16_t ProgRev:4;
  2306. uint16_t ProgFixLvl:2;
  2307. uint16_t ProgDistType:2;
  2308. uint16_t DistCnt:4;
  2309. #else /* __LITTLE_ENDIAN_BITFIELD */
  2310. uint16_t DistCnt:4;
  2311. uint16_t ProgDistType:2;
  2312. uint16_t ProgFixLvl:2;
  2313. uint16_t ProgRev:4;
  2314. uint16_t ProgVer:4;
  2315. uint8_t ProgId;
  2316. uint8_t ProgType;
  2317. #endif
  2318. } b;
  2319. } un;
  2320. uint32_t endecRev;
  2321. #ifdef __BIG_ENDIAN_BITFIELD
  2322. uint8_t feaLevelHigh;
  2323. uint8_t feaLevelLow;
  2324. uint8_t fcphHigh;
  2325. uint8_t fcphLow;
  2326. #else /* __LITTLE_ENDIAN_BITFIELD */
  2327. uint8_t fcphLow;
  2328. uint8_t fcphHigh;
  2329. uint8_t feaLevelLow;
  2330. uint8_t feaLevelHigh;
  2331. #endif
  2332. uint32_t postKernRev;
  2333. uint32_t opFwRev;
  2334. uint8_t opFwName[16];
  2335. uint32_t sli1FwRev;
  2336. uint8_t sli1FwName[16];
  2337. uint32_t sli2FwRev;
  2338. uint8_t sli2FwName[16];
  2339. uint32_t sli3Feat;
  2340. uint32_t RandomData[6];
  2341. } READ_REV_VAR;
  2342. /* Structure for MB Command READ_LINK_STAT (18) */
  2343. typedef struct {
  2344. uint32_t word0;
  2345. #define lpfc_read_link_stat_rec_SHIFT 0
  2346. #define lpfc_read_link_stat_rec_MASK 0x1
  2347. #define lpfc_read_link_stat_rec_WORD word0
  2348. #define lpfc_read_link_stat_gec_SHIFT 1
  2349. #define lpfc_read_link_stat_gec_MASK 0x1
  2350. #define lpfc_read_link_stat_gec_WORD word0
  2351. #define lpfc_read_link_stat_w02oftow23of_SHIFT 2
  2352. #define lpfc_read_link_stat_w02oftow23of_MASK 0x3FFFFF
  2353. #define lpfc_read_link_stat_w02oftow23of_WORD word0
  2354. #define lpfc_read_link_stat_rsvd_SHIFT 24
  2355. #define lpfc_read_link_stat_rsvd_MASK 0x1F
  2356. #define lpfc_read_link_stat_rsvd_WORD word0
  2357. #define lpfc_read_link_stat_gec2_SHIFT 29
  2358. #define lpfc_read_link_stat_gec2_MASK 0x1
  2359. #define lpfc_read_link_stat_gec2_WORD word0
  2360. #define lpfc_read_link_stat_clrc_SHIFT 30
  2361. #define lpfc_read_link_stat_clrc_MASK 0x1
  2362. #define lpfc_read_link_stat_clrc_WORD word0
  2363. #define lpfc_read_link_stat_clof_SHIFT 31
  2364. #define lpfc_read_link_stat_clof_MASK 0x1
  2365. #define lpfc_read_link_stat_clof_WORD word0
  2366. uint32_t linkFailureCnt;
  2367. uint32_t lossSyncCnt;
  2368. uint32_t lossSignalCnt;
  2369. uint32_t primSeqErrCnt;
  2370. uint32_t invalidXmitWord;
  2371. uint32_t crcCnt;
  2372. uint32_t primSeqTimeout;
  2373. uint32_t elasticOverrun;
  2374. uint32_t arbTimeout;
  2375. uint32_t advRecBufCredit;
  2376. uint32_t curRecBufCredit;
  2377. uint32_t advTransBufCredit;
  2378. uint32_t curTransBufCredit;
  2379. uint32_t recEofCount;
  2380. uint32_t recEofdtiCount;
  2381. uint32_t recEofniCount;
  2382. uint32_t recSofcount;
  2383. uint32_t rsvd1;
  2384. uint32_t rsvd2;
  2385. uint32_t recDrpXriCount;
  2386. uint32_t fecCorrBlkCount;
  2387. uint32_t fecUncorrBlkCount;
  2388. } READ_LNK_VAR;
  2389. /* Structure for MB Command REG_LOGIN (19) */
  2390. /* Structure for MB Command REG_LOGIN64 (0x93) */
  2391. typedef struct {
  2392. #ifdef __BIG_ENDIAN_BITFIELD
  2393. uint16_t rsvd1;
  2394. uint16_t rpi;
  2395. uint32_t rsvd2:8;
  2396. uint32_t did:24;
  2397. #else /* __LITTLE_ENDIAN_BITFIELD */
  2398. uint16_t rpi;
  2399. uint16_t rsvd1;
  2400. uint32_t did:24;
  2401. uint32_t rsvd2:8;
  2402. #endif
  2403. union {
  2404. struct ulp_bde sp;
  2405. struct ulp_bde64 sp64;
  2406. } un;
  2407. #ifdef __BIG_ENDIAN_BITFIELD
  2408. uint16_t rsvd6;
  2409. uint16_t vpi;
  2410. #else /* __LITTLE_ENDIAN_BITFIELD */
  2411. uint16_t vpi;
  2412. uint16_t rsvd6;
  2413. #endif
  2414. } REG_LOGIN_VAR;
  2415. /* Word 30 contents for REG_LOGIN */
  2416. typedef union {
  2417. struct {
  2418. #ifdef __BIG_ENDIAN_BITFIELD
  2419. uint16_t rsvd1:12;
  2420. uint16_t wd30_class:4;
  2421. uint16_t xri;
  2422. #else /* __LITTLE_ENDIAN_BITFIELD */
  2423. uint16_t xri;
  2424. uint16_t wd30_class:4;
  2425. uint16_t rsvd1:12;
  2426. #endif
  2427. } f;
  2428. uint32_t word;
  2429. } REG_WD30;
  2430. /* Structure for MB Command UNREG_LOGIN (20) */
  2431. typedef struct {
  2432. #ifdef __BIG_ENDIAN_BITFIELD
  2433. uint16_t rsvd1;
  2434. uint16_t rpi;
  2435. uint32_t rsvd2;
  2436. uint32_t rsvd3;
  2437. uint32_t rsvd4;
  2438. uint32_t rsvd5;
  2439. uint16_t rsvd6;
  2440. uint16_t vpi;
  2441. #else /* __LITTLE_ENDIAN_BITFIELD */
  2442. uint16_t rpi;
  2443. uint16_t rsvd1;
  2444. uint32_t rsvd2;
  2445. uint32_t rsvd3;
  2446. uint32_t rsvd4;
  2447. uint32_t rsvd5;
  2448. uint16_t vpi;
  2449. uint16_t rsvd6;
  2450. #endif
  2451. } UNREG_LOGIN_VAR;
  2452. /* Structure for MB Command REG_VPI (0x96) */
  2453. typedef struct {
  2454. #ifdef __BIG_ENDIAN_BITFIELD
  2455. uint32_t rsvd1;
  2456. uint32_t rsvd2:7;
  2457. uint32_t upd:1;
  2458. uint32_t sid:24;
  2459. uint32_t wwn[2];
  2460. uint32_t rsvd5;
  2461. uint16_t vfi;
  2462. uint16_t vpi;
  2463. #else /* __LITTLE_ENDIAN */
  2464. uint32_t rsvd1;
  2465. uint32_t sid:24;
  2466. uint32_t upd:1;
  2467. uint32_t rsvd2:7;
  2468. uint32_t wwn[2];
  2469. uint32_t rsvd5;
  2470. uint16_t vpi;
  2471. uint16_t vfi;
  2472. #endif
  2473. } REG_VPI_VAR;
  2474. /* Structure for MB Command UNREG_VPI (0x97) */
  2475. typedef struct {
  2476. uint32_t rsvd1;
  2477. #ifdef __BIG_ENDIAN_BITFIELD
  2478. uint16_t rsvd2;
  2479. uint16_t sli4_vpi;
  2480. #else /* __LITTLE_ENDIAN */
  2481. uint16_t sli4_vpi;
  2482. uint16_t rsvd2;
  2483. #endif
  2484. uint32_t rsvd3;
  2485. uint32_t rsvd4;
  2486. uint32_t rsvd5;
  2487. #ifdef __BIG_ENDIAN_BITFIELD
  2488. uint16_t rsvd6;
  2489. uint16_t vpi;
  2490. #else /* __LITTLE_ENDIAN */
  2491. uint16_t vpi;
  2492. uint16_t rsvd6;
  2493. #endif
  2494. } UNREG_VPI_VAR;
  2495. /* Structure for MB Command UNREG_D_ID (0x23) */
  2496. typedef struct {
  2497. uint32_t did;
  2498. uint32_t rsvd2;
  2499. uint32_t rsvd3;
  2500. uint32_t rsvd4;
  2501. uint32_t rsvd5;
  2502. #ifdef __BIG_ENDIAN_BITFIELD
  2503. uint16_t rsvd6;
  2504. uint16_t vpi;
  2505. #else
  2506. uint16_t vpi;
  2507. uint16_t rsvd6;
  2508. #endif
  2509. } UNREG_D_ID_VAR;
  2510. /* Structure for MB Command READ_TOPOLOGY (0x95) */
  2511. struct lpfc_mbx_read_top {
  2512. uint32_t eventTag; /* Event tag */
  2513. uint32_t word2;
  2514. #define lpfc_mbx_read_top_fa_SHIFT 12
  2515. #define lpfc_mbx_read_top_fa_MASK 0x00000001
  2516. #define lpfc_mbx_read_top_fa_WORD word2
  2517. #define lpfc_mbx_read_top_mm_SHIFT 11
  2518. #define lpfc_mbx_read_top_mm_MASK 0x00000001
  2519. #define lpfc_mbx_read_top_mm_WORD word2
  2520. #define lpfc_mbx_read_top_pb_SHIFT 9
  2521. #define lpfc_mbx_read_top_pb_MASK 0X00000001
  2522. #define lpfc_mbx_read_top_pb_WORD word2
  2523. #define lpfc_mbx_read_top_il_SHIFT 8
  2524. #define lpfc_mbx_read_top_il_MASK 0x00000001
  2525. #define lpfc_mbx_read_top_il_WORD word2
  2526. #define lpfc_mbx_read_top_att_type_SHIFT 0
  2527. #define lpfc_mbx_read_top_att_type_MASK 0x000000FF
  2528. #define lpfc_mbx_read_top_att_type_WORD word2
  2529. #define LPFC_ATT_RESERVED 0x00 /* Reserved - attType */
  2530. #define LPFC_ATT_LINK_UP 0x01 /* Link is up */
  2531. #define LPFC_ATT_LINK_DOWN 0x02 /* Link is down */
  2532. uint32_t word3;
  2533. #define lpfc_mbx_read_top_alpa_granted_SHIFT 24
  2534. #define lpfc_mbx_read_top_alpa_granted_MASK 0x000000FF
  2535. #define lpfc_mbx_read_top_alpa_granted_WORD word3
  2536. #define lpfc_mbx_read_top_lip_alps_SHIFT 16
  2537. #define lpfc_mbx_read_top_lip_alps_MASK 0x000000FF
  2538. #define lpfc_mbx_read_top_lip_alps_WORD word3
  2539. #define lpfc_mbx_read_top_lip_type_SHIFT 8
  2540. #define lpfc_mbx_read_top_lip_type_MASK 0x000000FF
  2541. #define lpfc_mbx_read_top_lip_type_WORD word3
  2542. #define lpfc_mbx_read_top_topology_SHIFT 0
  2543. #define lpfc_mbx_read_top_topology_MASK 0x000000FF
  2544. #define lpfc_mbx_read_top_topology_WORD word3
  2545. #define LPFC_TOPOLOGY_PT_PT 0x01 /* Topology is pt-pt / pt-fabric */
  2546. #define LPFC_TOPOLOGY_LOOP 0x02 /* Topology is FC-AL */
  2547. #define LPFC_TOPOLOGY_MM 0x05 /* maint mode zephtr to menlo */
  2548. /* store the LILP AL_PA position map into */
  2549. struct ulp_bde64 lilpBde64;
  2550. #define LPFC_ALPA_MAP_SIZE 128
  2551. uint32_t word7;
  2552. #define lpfc_mbx_read_top_ld_lu_SHIFT 31
  2553. #define lpfc_mbx_read_top_ld_lu_MASK 0x00000001
  2554. #define lpfc_mbx_read_top_ld_lu_WORD word7
  2555. #define lpfc_mbx_read_top_ld_tf_SHIFT 30
  2556. #define lpfc_mbx_read_top_ld_tf_MASK 0x00000001
  2557. #define lpfc_mbx_read_top_ld_tf_WORD word7
  2558. #define lpfc_mbx_read_top_ld_link_spd_SHIFT 8
  2559. #define lpfc_mbx_read_top_ld_link_spd_MASK 0x000000FF
  2560. #define lpfc_mbx_read_top_ld_link_spd_WORD word7
  2561. #define lpfc_mbx_read_top_ld_nl_port_SHIFT 4
  2562. #define lpfc_mbx_read_top_ld_nl_port_MASK 0x0000000F
  2563. #define lpfc_mbx_read_top_ld_nl_port_WORD word7
  2564. #define lpfc_mbx_read_top_ld_tx_SHIFT 2
  2565. #define lpfc_mbx_read_top_ld_tx_MASK 0x00000003
  2566. #define lpfc_mbx_read_top_ld_tx_WORD word7
  2567. #define lpfc_mbx_read_top_ld_rx_SHIFT 0
  2568. #define lpfc_mbx_read_top_ld_rx_MASK 0x00000003
  2569. #define lpfc_mbx_read_top_ld_rx_WORD word7
  2570. uint32_t word8;
  2571. #define lpfc_mbx_read_top_lu_SHIFT 31
  2572. #define lpfc_mbx_read_top_lu_MASK 0x00000001
  2573. #define lpfc_mbx_read_top_lu_WORD word8
  2574. #define lpfc_mbx_read_top_tf_SHIFT 30
  2575. #define lpfc_mbx_read_top_tf_MASK 0x00000001
  2576. #define lpfc_mbx_read_top_tf_WORD word8
  2577. #define lpfc_mbx_read_top_link_spd_SHIFT 8
  2578. #define lpfc_mbx_read_top_link_spd_MASK 0x000000FF
  2579. #define lpfc_mbx_read_top_link_spd_WORD word8
  2580. #define lpfc_mbx_read_top_nl_port_SHIFT 4
  2581. #define lpfc_mbx_read_top_nl_port_MASK 0x0000000F
  2582. #define lpfc_mbx_read_top_nl_port_WORD word8
  2583. #define lpfc_mbx_read_top_tx_SHIFT 2
  2584. #define lpfc_mbx_read_top_tx_MASK 0x00000003
  2585. #define lpfc_mbx_read_top_tx_WORD word8
  2586. #define lpfc_mbx_read_top_rx_SHIFT 0
  2587. #define lpfc_mbx_read_top_rx_MASK 0x00000003
  2588. #define lpfc_mbx_read_top_rx_WORD word8
  2589. #define LPFC_LINK_SPEED_UNKNOWN 0x0
  2590. #define LPFC_LINK_SPEED_1GHZ 0x04
  2591. #define LPFC_LINK_SPEED_2GHZ 0x08
  2592. #define LPFC_LINK_SPEED_4GHZ 0x10
  2593. #define LPFC_LINK_SPEED_8GHZ 0x20
  2594. #define LPFC_LINK_SPEED_10GHZ 0x40
  2595. #define LPFC_LINK_SPEED_16GHZ 0x80
  2596. #define LPFC_LINK_SPEED_32GHZ 0x90
  2597. };
  2598. /* Structure for MB Command CLEAR_LA (22) */
  2599. typedef struct {
  2600. uint32_t eventTag; /* Event tag */
  2601. uint32_t rsvd1;
  2602. } CLEAR_LA_VAR;
  2603. /* Structure for MB Command DUMP */
  2604. typedef struct {
  2605. #ifdef __BIG_ENDIAN_BITFIELD
  2606. uint32_t rsvd:25;
  2607. uint32_t ra:1;
  2608. uint32_t co:1;
  2609. uint32_t cv:1;
  2610. uint32_t type:4;
  2611. uint32_t entry_index:16;
  2612. uint32_t region_id:16;
  2613. #else /* __LITTLE_ENDIAN_BITFIELD */
  2614. uint32_t type:4;
  2615. uint32_t cv:1;
  2616. uint32_t co:1;
  2617. uint32_t ra:1;
  2618. uint32_t rsvd:25;
  2619. uint32_t region_id:16;
  2620. uint32_t entry_index:16;
  2621. #endif
  2622. uint32_t sli4_length;
  2623. uint32_t word_cnt;
  2624. uint32_t resp_offset;
  2625. } DUMP_VAR;
  2626. #define DMP_MEM_REG 0x1
  2627. #define DMP_NV_PARAMS 0x2
  2628. #define DMP_LMSD 0x3 /* Link Module Serial Data */
  2629. #define DMP_WELL_KNOWN 0x4
  2630. #define DMP_REGION_VPD 0xe
  2631. #define DMP_VPD_SIZE 0x400 /* maximum amount of VPD */
  2632. #define DMP_RSP_OFFSET 0x14 /* word 5 contains first word of rsp */
  2633. #define DMP_RSP_SIZE 0x6C /* maximum of 27 words of rsp data */
  2634. #define DMP_REGION_VPORT 0x16 /* VPort info region */
  2635. #define DMP_VPORT_REGION_SIZE 0x200
  2636. #define DMP_MBOX_OFFSET_WORD 0x5
  2637. #define DMP_REGION_23 0x17 /* fcoe param and port state region */
  2638. #define DMP_RGN23_SIZE 0x400
  2639. #define WAKE_UP_PARMS_REGION_ID 4
  2640. #define WAKE_UP_PARMS_WORD_SIZE 15
  2641. struct vport_rec {
  2642. uint8_t wwpn[8];
  2643. uint8_t wwnn[8];
  2644. };
  2645. #define VPORT_INFO_SIG 0x32324752
  2646. #define VPORT_INFO_REV_MASK 0xff
  2647. #define VPORT_INFO_REV 0x1
  2648. #define MAX_STATIC_VPORT_COUNT 16
  2649. struct static_vport_info {
  2650. uint32_t signature;
  2651. uint32_t rev;
  2652. struct vport_rec vport_list[MAX_STATIC_VPORT_COUNT];
  2653. uint32_t resvd[66];
  2654. };
  2655. /* Option rom version structure */
  2656. struct prog_id {
  2657. #ifdef __BIG_ENDIAN_BITFIELD
  2658. uint8_t type;
  2659. uint8_t id;
  2660. uint32_t ver:4; /* Major Version */
  2661. uint32_t rev:4; /* Revision */
  2662. uint32_t lev:2; /* Level */
  2663. uint32_t dist:2; /* Dist Type */
  2664. uint32_t num:4; /* number after dist type */
  2665. #else /* __LITTLE_ENDIAN_BITFIELD */
  2666. uint32_t num:4; /* number after dist type */
  2667. uint32_t dist:2; /* Dist Type */
  2668. uint32_t lev:2; /* Level */
  2669. uint32_t rev:4; /* Revision */
  2670. uint32_t ver:4; /* Major Version */
  2671. uint8_t id;
  2672. uint8_t type;
  2673. #endif
  2674. };
  2675. /* Structure for MB Command UPDATE_CFG (0x1B) */
  2676. struct update_cfg_var {
  2677. #ifdef __BIG_ENDIAN_BITFIELD
  2678. uint32_t rsvd2:16;
  2679. uint32_t type:8;
  2680. uint32_t rsvd:1;
  2681. uint32_t ra:1;
  2682. uint32_t co:1;
  2683. uint32_t cv:1;
  2684. uint32_t req:4;
  2685. uint32_t entry_length:16;
  2686. uint32_t region_id:16;
  2687. #else /* __LITTLE_ENDIAN_BITFIELD */
  2688. uint32_t req:4;
  2689. uint32_t cv:1;
  2690. uint32_t co:1;
  2691. uint32_t ra:1;
  2692. uint32_t rsvd:1;
  2693. uint32_t type:8;
  2694. uint32_t rsvd2:16;
  2695. uint32_t region_id:16;
  2696. uint32_t entry_length:16;
  2697. #endif
  2698. uint32_t resp_info;
  2699. uint32_t byte_cnt;
  2700. uint32_t data_offset;
  2701. };
  2702. struct hbq_mask {
  2703. #ifdef __BIG_ENDIAN_BITFIELD
  2704. uint8_t tmatch;
  2705. uint8_t tmask;
  2706. uint8_t rctlmatch;
  2707. uint8_t rctlmask;
  2708. #else /* __LITTLE_ENDIAN */
  2709. uint8_t rctlmask;
  2710. uint8_t rctlmatch;
  2711. uint8_t tmask;
  2712. uint8_t tmatch;
  2713. #endif
  2714. };
  2715. /* Structure for MB Command CONFIG_HBQ (7c) */
  2716. struct config_hbq_var {
  2717. #ifdef __BIG_ENDIAN_BITFIELD
  2718. uint32_t rsvd1 :7;
  2719. uint32_t recvNotify :1; /* Receive Notification */
  2720. uint32_t numMask :8; /* # Mask Entries */
  2721. uint32_t profile :8; /* Selection Profile */
  2722. uint32_t rsvd2 :8;
  2723. #else /* __LITTLE_ENDIAN */
  2724. uint32_t rsvd2 :8;
  2725. uint32_t profile :8; /* Selection Profile */
  2726. uint32_t numMask :8; /* # Mask Entries */
  2727. uint32_t recvNotify :1; /* Receive Notification */
  2728. uint32_t rsvd1 :7;
  2729. #endif
  2730. #ifdef __BIG_ENDIAN_BITFIELD
  2731. uint32_t hbqId :16;
  2732. uint32_t rsvd3 :12;
  2733. uint32_t ringMask :4;
  2734. #else /* __LITTLE_ENDIAN */
  2735. uint32_t ringMask :4;
  2736. uint32_t rsvd3 :12;
  2737. uint32_t hbqId :16;
  2738. #endif
  2739. #ifdef __BIG_ENDIAN_BITFIELD
  2740. uint32_t entry_count :16;
  2741. uint32_t rsvd4 :8;
  2742. uint32_t headerLen :8;
  2743. #else /* __LITTLE_ENDIAN */
  2744. uint32_t headerLen :8;
  2745. uint32_t rsvd4 :8;
  2746. uint32_t entry_count :16;
  2747. #endif
  2748. uint32_t hbqaddrLow;
  2749. uint32_t hbqaddrHigh;
  2750. #ifdef __BIG_ENDIAN_BITFIELD
  2751. uint32_t rsvd5 :31;
  2752. uint32_t logEntry :1;
  2753. #else /* __LITTLE_ENDIAN */
  2754. uint32_t logEntry :1;
  2755. uint32_t rsvd5 :31;
  2756. #endif
  2757. uint32_t rsvd6; /* w7 */
  2758. uint32_t rsvd7; /* w8 */
  2759. uint32_t rsvd8; /* w9 */
  2760. struct hbq_mask hbqMasks[6];
  2761. union {
  2762. uint32_t allprofiles[12];
  2763. struct {
  2764. #ifdef __BIG_ENDIAN_BITFIELD
  2765. uint32_t seqlenoff :16;
  2766. uint32_t maxlen :16;
  2767. #else /* __LITTLE_ENDIAN */
  2768. uint32_t maxlen :16;
  2769. uint32_t seqlenoff :16;
  2770. #endif
  2771. #ifdef __BIG_ENDIAN_BITFIELD
  2772. uint32_t rsvd1 :28;
  2773. uint32_t seqlenbcnt :4;
  2774. #else /* __LITTLE_ENDIAN */
  2775. uint32_t seqlenbcnt :4;
  2776. uint32_t rsvd1 :28;
  2777. #endif
  2778. uint32_t rsvd[10];
  2779. } profile2;
  2780. struct {
  2781. #ifdef __BIG_ENDIAN_BITFIELD
  2782. uint32_t seqlenoff :16;
  2783. uint32_t maxlen :16;
  2784. #else /* __LITTLE_ENDIAN */
  2785. uint32_t maxlen :16;
  2786. uint32_t seqlenoff :16;
  2787. #endif
  2788. #ifdef __BIG_ENDIAN_BITFIELD
  2789. uint32_t cmdcodeoff :28;
  2790. uint32_t rsvd1 :12;
  2791. uint32_t seqlenbcnt :4;
  2792. #else /* __LITTLE_ENDIAN */
  2793. uint32_t seqlenbcnt :4;
  2794. uint32_t rsvd1 :12;
  2795. uint32_t cmdcodeoff :28;
  2796. #endif
  2797. uint32_t cmdmatch[8];
  2798. uint32_t rsvd[2];
  2799. } profile3;
  2800. struct {
  2801. #ifdef __BIG_ENDIAN_BITFIELD
  2802. uint32_t seqlenoff :16;
  2803. uint32_t maxlen :16;
  2804. #else /* __LITTLE_ENDIAN */
  2805. uint32_t maxlen :16;
  2806. uint32_t seqlenoff :16;
  2807. #endif
  2808. #ifdef __BIG_ENDIAN_BITFIELD
  2809. uint32_t cmdcodeoff :28;
  2810. uint32_t rsvd1 :12;
  2811. uint32_t seqlenbcnt :4;
  2812. #else /* __LITTLE_ENDIAN */
  2813. uint32_t seqlenbcnt :4;
  2814. uint32_t rsvd1 :12;
  2815. uint32_t cmdcodeoff :28;
  2816. #endif
  2817. uint32_t cmdmatch[8];
  2818. uint32_t rsvd[2];
  2819. } profile5;
  2820. } profiles;
  2821. };
  2822. /* Structure for MB Command CONFIG_PORT (0x88) */
  2823. typedef struct {
  2824. #ifdef __BIG_ENDIAN_BITFIELD
  2825. uint32_t cBE : 1;
  2826. uint32_t cET : 1;
  2827. uint32_t cHpcb : 1;
  2828. uint32_t cMA : 1;
  2829. uint32_t sli_mode : 4;
  2830. uint32_t pcbLen : 24; /* bit 23:0 of memory based port
  2831. * config block */
  2832. #else /* __LITTLE_ENDIAN */
  2833. uint32_t pcbLen : 24; /* bit 23:0 of memory based port
  2834. * config block */
  2835. uint32_t sli_mode : 4;
  2836. uint32_t cMA : 1;
  2837. uint32_t cHpcb : 1;
  2838. uint32_t cET : 1;
  2839. uint32_t cBE : 1;
  2840. #endif
  2841. uint32_t pcbLow; /* bit 31:0 of memory based port config block */
  2842. uint32_t pcbHigh; /* bit 63:32 of memory based port config block */
  2843. uint32_t hbainit[5];
  2844. #ifdef __BIG_ENDIAN_BITFIELD
  2845. uint32_t hps : 1; /* bit 31 word9 Host Pointer in slim */
  2846. uint32_t rsvd : 31; /* least significant 31 bits of word 9 */
  2847. #else /* __LITTLE_ENDIAN */
  2848. uint32_t rsvd : 31; /* least significant 31 bits of word 9 */
  2849. uint32_t hps : 1; /* bit 31 word9 Host Pointer in slim */
  2850. #endif
  2851. #ifdef __BIG_ENDIAN_BITFIELD
  2852. uint32_t rsvd1 : 19; /* Reserved */
  2853. uint32_t cdss : 1; /* Configure Data Security SLI */
  2854. uint32_t casabt : 1; /* Configure async abts status notice */
  2855. uint32_t rsvd2 : 2; /* Reserved */
  2856. uint32_t cbg : 1; /* Configure BlockGuard */
  2857. uint32_t cmv : 1; /* Configure Max VPIs */
  2858. uint32_t ccrp : 1; /* Config Command Ring Polling */
  2859. uint32_t csah : 1; /* Configure Synchronous Abort Handling */
  2860. uint32_t chbs : 1; /* Cofigure Host Backing store */
  2861. uint32_t cinb : 1; /* Enable Interrupt Notification Block */
  2862. uint32_t cerbm : 1; /* Configure Enhanced Receive Buf Mgmt */
  2863. uint32_t cmx : 1; /* Configure Max XRIs */
  2864. uint32_t cmr : 1; /* Configure Max RPIs */
  2865. #else /* __LITTLE_ENDIAN */
  2866. uint32_t cmr : 1; /* Configure Max RPIs */
  2867. uint32_t cmx : 1; /* Configure Max XRIs */
  2868. uint32_t cerbm : 1; /* Configure Enhanced Receive Buf Mgmt */
  2869. uint32_t cinb : 1; /* Enable Interrupt Notification Block */
  2870. uint32_t chbs : 1; /* Cofigure Host Backing store */
  2871. uint32_t csah : 1; /* Configure Synchronous Abort Handling */
  2872. uint32_t ccrp : 1; /* Config Command Ring Polling */
  2873. uint32_t cmv : 1; /* Configure Max VPIs */
  2874. uint32_t cbg : 1; /* Configure BlockGuard */
  2875. uint32_t rsvd2 : 2; /* Reserved */
  2876. uint32_t casabt : 1; /* Configure async abts status notice */
  2877. uint32_t cdss : 1; /* Configure Data Security SLI */
  2878. uint32_t rsvd1 : 19; /* Reserved */
  2879. #endif
  2880. #ifdef __BIG_ENDIAN_BITFIELD
  2881. uint32_t rsvd3 : 19; /* Reserved */
  2882. uint32_t gdss : 1; /* Configure Data Security SLI */
  2883. uint32_t gasabt : 1; /* Grant async abts status notice */
  2884. uint32_t rsvd4 : 2; /* Reserved */
  2885. uint32_t gbg : 1; /* Grant BlockGuard */
  2886. uint32_t gmv : 1; /* Grant Max VPIs */
  2887. uint32_t gcrp : 1; /* Grant Command Ring Polling */
  2888. uint32_t gsah : 1; /* Grant Synchronous Abort Handling */
  2889. uint32_t ghbs : 1; /* Grant Host Backing Store */
  2890. uint32_t ginb : 1; /* Grant Interrupt Notification Block */
  2891. uint32_t gerbm : 1; /* Grant ERBM Request */
  2892. uint32_t gmx : 1; /* Grant Max XRIs */
  2893. uint32_t gmr : 1; /* Grant Max RPIs */
  2894. #else /* __LITTLE_ENDIAN */
  2895. uint32_t gmr : 1; /* Grant Max RPIs */
  2896. uint32_t gmx : 1; /* Grant Max XRIs */
  2897. uint32_t gerbm : 1; /* Grant ERBM Request */
  2898. uint32_t ginb : 1; /* Grant Interrupt Notification Block */
  2899. uint32_t ghbs : 1; /* Grant Host Backing Store */
  2900. uint32_t gsah : 1; /* Grant Synchronous Abort Handling */
  2901. uint32_t gcrp : 1; /* Grant Command Ring Polling */
  2902. uint32_t gmv : 1; /* Grant Max VPIs */
  2903. uint32_t gbg : 1; /* Grant BlockGuard */
  2904. uint32_t rsvd4 : 2; /* Reserved */
  2905. uint32_t gasabt : 1; /* Grant async abts status notice */
  2906. uint32_t gdss : 1; /* Configure Data Security SLI */
  2907. uint32_t rsvd3 : 19; /* Reserved */
  2908. #endif
  2909. #ifdef __BIG_ENDIAN_BITFIELD
  2910. uint32_t max_rpi : 16; /* Max RPIs Port should configure */
  2911. uint32_t max_xri : 16; /* Max XRIs Port should configure */
  2912. #else /* __LITTLE_ENDIAN */
  2913. uint32_t max_xri : 16; /* Max XRIs Port should configure */
  2914. uint32_t max_rpi : 16; /* Max RPIs Port should configure */
  2915. #endif
  2916. #ifdef __BIG_ENDIAN_BITFIELD
  2917. uint32_t max_hbq : 16; /* Max HBQs Host expect to configure */
  2918. uint32_t rsvd5 : 16; /* Max HBQs Host expect to configure */
  2919. #else /* __LITTLE_ENDIAN */
  2920. uint32_t rsvd5 : 16; /* Max HBQs Host expect to configure */
  2921. uint32_t max_hbq : 16; /* Max HBQs Host expect to configure */
  2922. #endif
  2923. uint32_t rsvd6; /* Reserved */
  2924. #ifdef __BIG_ENDIAN_BITFIELD
  2925. uint32_t fips_rev : 3; /* FIPS Spec Revision */
  2926. uint32_t fips_level : 4; /* FIPS Level */
  2927. uint32_t sec_err : 9; /* security crypto error */
  2928. uint32_t max_vpi : 16; /* Max number of virt N-Ports */
  2929. #else /* __LITTLE_ENDIAN */
  2930. uint32_t max_vpi : 16; /* Max number of virt N-Ports */
  2931. uint32_t sec_err : 9; /* security crypto error */
  2932. uint32_t fips_level : 4; /* FIPS Level */
  2933. uint32_t fips_rev : 3; /* FIPS Spec Revision */
  2934. #endif
  2935. } CONFIG_PORT_VAR;
  2936. /* Structure for MB Command CONFIG_MSI (0x30) */
  2937. struct config_msi_var {
  2938. #ifdef __BIG_ENDIAN_BITFIELD
  2939. uint32_t dfltMsgNum:8; /* Default message number */
  2940. uint32_t rsvd1:11; /* Reserved */
  2941. uint32_t NID:5; /* Number of secondary attention IDs */
  2942. uint32_t rsvd2:5; /* Reserved */
  2943. uint32_t dfltPresent:1; /* Default message number present */
  2944. uint32_t addFlag:1; /* Add association flag */
  2945. uint32_t reportFlag:1; /* Report association flag */
  2946. #else /* __LITTLE_ENDIAN_BITFIELD */
  2947. uint32_t reportFlag:1; /* Report association flag */
  2948. uint32_t addFlag:1; /* Add association flag */
  2949. uint32_t dfltPresent:1; /* Default message number present */
  2950. uint32_t rsvd2:5; /* Reserved */
  2951. uint32_t NID:5; /* Number of secondary attention IDs */
  2952. uint32_t rsvd1:11; /* Reserved */
  2953. uint32_t dfltMsgNum:8; /* Default message number */
  2954. #endif
  2955. uint32_t attentionConditions[2];
  2956. uint8_t attentionId[16];
  2957. uint8_t messageNumberByHA[64];
  2958. uint8_t messageNumberByID[16];
  2959. uint32_t autoClearHA[2];
  2960. #ifdef __BIG_ENDIAN_BITFIELD
  2961. uint32_t rsvd3:16;
  2962. uint32_t autoClearID:16;
  2963. #else /* __LITTLE_ENDIAN_BITFIELD */
  2964. uint32_t autoClearID:16;
  2965. uint32_t rsvd3:16;
  2966. #endif
  2967. uint32_t rsvd4;
  2968. };
  2969. /* SLI-2 Port Control Block */
  2970. /* SLIM POINTER */
  2971. #define SLIMOFF 0x30 /* WORD */
  2972. typedef struct _SLI2_RDSC {
  2973. uint32_t cmdEntries;
  2974. uint32_t cmdAddrLow;
  2975. uint32_t cmdAddrHigh;
  2976. uint32_t rspEntries;
  2977. uint32_t rspAddrLow;
  2978. uint32_t rspAddrHigh;
  2979. } SLI2_RDSC;
  2980. typedef struct _PCB {
  2981. #ifdef __BIG_ENDIAN_BITFIELD
  2982. uint32_t type:8;
  2983. #define TYPE_NATIVE_SLI2 0x01
  2984. uint32_t feature:8;
  2985. #define FEATURE_INITIAL_SLI2 0x01
  2986. uint32_t rsvd:12;
  2987. uint32_t maxRing:4;
  2988. #else /* __LITTLE_ENDIAN_BITFIELD */
  2989. uint32_t maxRing:4;
  2990. uint32_t rsvd:12;
  2991. uint32_t feature:8;
  2992. #define FEATURE_INITIAL_SLI2 0x01
  2993. uint32_t type:8;
  2994. #define TYPE_NATIVE_SLI2 0x01
  2995. #endif
  2996. uint32_t mailBoxSize;
  2997. uint32_t mbAddrLow;
  2998. uint32_t mbAddrHigh;
  2999. uint32_t hgpAddrLow;
  3000. uint32_t hgpAddrHigh;
  3001. uint32_t pgpAddrLow;
  3002. uint32_t pgpAddrHigh;
  3003. SLI2_RDSC rdsc[MAX_SLI3_RINGS];
  3004. } PCB_t;
  3005. /* NEW_FEATURE */
  3006. typedef struct {
  3007. #ifdef __BIG_ENDIAN_BITFIELD
  3008. uint32_t rsvd0:27;
  3009. uint32_t discardFarp:1;
  3010. uint32_t IPEnable:1;
  3011. uint32_t nodeName:1;
  3012. uint32_t portName:1;
  3013. uint32_t filterEnable:1;
  3014. #else /* __LITTLE_ENDIAN_BITFIELD */
  3015. uint32_t filterEnable:1;
  3016. uint32_t portName:1;
  3017. uint32_t nodeName:1;
  3018. uint32_t IPEnable:1;
  3019. uint32_t discardFarp:1;
  3020. uint32_t rsvd:27;
  3021. #endif
  3022. uint8_t portname[8]; /* Used to be struct lpfc_name */
  3023. uint8_t nodename[8];
  3024. uint32_t rsvd1;
  3025. uint32_t rsvd2;
  3026. uint32_t rsvd3;
  3027. uint32_t IPAddress;
  3028. } CONFIG_FARP_VAR;
  3029. /* Structure for MB Command MBX_ASYNCEVT_ENABLE (0x33) */
  3030. typedef struct {
  3031. #ifdef __BIG_ENDIAN_BITFIELD
  3032. uint32_t rsvd:30;
  3033. uint32_t ring:2; /* Ring for ASYNC_EVENT iocb Bits 0-1*/
  3034. #else /* __LITTLE_ENDIAN */
  3035. uint32_t ring:2; /* Ring for ASYNC_EVENT iocb Bits 0-1*/
  3036. uint32_t rsvd:30;
  3037. #endif
  3038. } ASYNCEVT_ENABLE_VAR;
  3039. /* Union of all Mailbox Command types */
  3040. #define MAILBOX_CMD_WSIZE 32
  3041. #define MAILBOX_CMD_SIZE (MAILBOX_CMD_WSIZE * sizeof(uint32_t))
  3042. /* ext_wsize times 4 bytes should not be greater than max xmit size */
  3043. #define MAILBOX_EXT_WSIZE 512
  3044. #define MAILBOX_EXT_SIZE (MAILBOX_EXT_WSIZE * sizeof(uint32_t))
  3045. #define MAILBOX_HBA_EXT_OFFSET 0x100
  3046. /* max mbox xmit size is a page size for sysfs IO operations */
  3047. #define MAILBOX_SYSFS_MAX 4096
  3048. typedef union {
  3049. uint32_t varWords[MAILBOX_CMD_WSIZE - 1]; /* first word is type/
  3050. * feature/max ring number
  3051. */
  3052. LOAD_SM_VAR varLdSM; /* cmd = 1 (LOAD_SM) */
  3053. READ_NV_VAR varRDnvp; /* cmd = 2 (READ_NVPARMS) */
  3054. WRITE_NV_VAR varWTnvp; /* cmd = 3 (WRITE_NVPARMS) */
  3055. BIU_DIAG_VAR varBIUdiag; /* cmd = 4 (RUN_BIU_DIAG) */
  3056. INIT_LINK_VAR varInitLnk; /* cmd = 5 (INIT_LINK) */
  3057. DOWN_LINK_VAR varDwnLnk; /* cmd = 6 (DOWN_LINK) */
  3058. CONFIG_LINK varCfgLnk; /* cmd = 7 (CONFIG_LINK) */
  3059. PART_SLIM_VAR varSlim; /* cmd = 8 (PART_SLIM) */
  3060. CONFIG_RING_VAR varCfgRing; /* cmd = 9 (CONFIG_RING) */
  3061. RESET_RING_VAR varRstRing; /* cmd = 10 (RESET_RING) */
  3062. READ_CONFIG_VAR varRdConfig; /* cmd = 11 (READ_CONFIG) */
  3063. READ_RCONF_VAR varRdRConfig; /* cmd = 12 (READ_RCONFIG) */
  3064. READ_SPARM_VAR varRdSparm; /* cmd = 13 (READ_SPARM(64)) */
  3065. READ_STATUS_VAR varRdStatus; /* cmd = 14 (READ_STATUS) */
  3066. READ_RPI_VAR varRdRPI; /* cmd = 15 (READ_RPI(64)) */
  3067. READ_XRI_VAR varRdXRI; /* cmd = 16 (READ_XRI) */
  3068. READ_REV_VAR varRdRev; /* cmd = 17 (READ_REV) */
  3069. READ_LNK_VAR varRdLnk; /* cmd = 18 (READ_LNK_STAT) */
  3070. REG_LOGIN_VAR varRegLogin; /* cmd = 19 (REG_LOGIN(64)) */
  3071. UNREG_LOGIN_VAR varUnregLogin; /* cmd = 20 (UNREG_LOGIN) */
  3072. CLEAR_LA_VAR varClearLA; /* cmd = 22 (CLEAR_LA) */
  3073. DUMP_VAR varDmp; /* Warm Start DUMP mbx cmd */
  3074. UNREG_D_ID_VAR varUnregDID; /* cmd = 0x23 (UNREG_D_ID) */
  3075. CONFIG_FARP_VAR varCfgFarp; /* cmd = 0x25 (CONFIG_FARP)
  3076. * NEW_FEATURE
  3077. */
  3078. struct config_hbq_var varCfgHbq;/* cmd = 0x7c (CONFIG_HBQ) */
  3079. struct update_cfg_var varUpdateCfg; /* cmd = 0x1B (UPDATE_CFG)*/
  3080. CONFIG_PORT_VAR varCfgPort; /* cmd = 0x88 (CONFIG_PORT) */
  3081. struct lpfc_mbx_read_top varReadTop; /* cmd = 0x95 (READ_TOPOLOGY) */
  3082. REG_VPI_VAR varRegVpi; /* cmd = 0x96 (REG_VPI) */
  3083. UNREG_VPI_VAR varUnregVpi; /* cmd = 0x97 (UNREG_VPI) */
  3084. ASYNCEVT_ENABLE_VAR varCfgAsyncEvent; /*cmd = x33 (CONFIG_ASYNC) */
  3085. struct READ_EVENT_LOG_VAR varRdEventLog; /* cmd = 0x38
  3086. * (READ_EVENT_LOG)
  3087. */
  3088. struct config_msi_var varCfgMSI;/* cmd = x30 (CONFIG_MSI) */
  3089. } MAILVARIANTS;
  3090. /*
  3091. * SLI-2 specific structures
  3092. */
  3093. struct lpfc_hgp {
  3094. __le32 cmdPutInx;
  3095. __le32 rspGetInx;
  3096. };
  3097. struct lpfc_pgp {
  3098. __le32 cmdGetInx;
  3099. __le32 rspPutInx;
  3100. };
  3101. struct sli2_desc {
  3102. uint32_t unused1[16];
  3103. struct lpfc_hgp host[MAX_SLI3_RINGS];
  3104. struct lpfc_pgp port[MAX_SLI3_RINGS];
  3105. };
  3106. struct sli3_desc {
  3107. struct lpfc_hgp host[MAX_SLI3_RINGS];
  3108. uint32_t reserved[8];
  3109. uint32_t hbq_put[16];
  3110. };
  3111. struct sli3_pgp {
  3112. struct lpfc_pgp port[MAX_SLI3_RINGS];
  3113. uint32_t hbq_get[16];
  3114. };
  3115. union sli_var {
  3116. struct sli2_desc s2;
  3117. struct sli3_desc s3;
  3118. struct sli3_pgp s3_pgp;
  3119. };
  3120. typedef struct {
  3121. #ifdef __BIG_ENDIAN_BITFIELD
  3122. uint16_t mbxStatus;
  3123. uint8_t mbxCommand;
  3124. uint8_t mbxReserved:6;
  3125. uint8_t mbxHc:1;
  3126. uint8_t mbxOwner:1; /* Low order bit first word */
  3127. #else /* __LITTLE_ENDIAN_BITFIELD */
  3128. uint8_t mbxOwner:1; /* Low order bit first word */
  3129. uint8_t mbxHc:1;
  3130. uint8_t mbxReserved:6;
  3131. uint8_t mbxCommand;
  3132. uint16_t mbxStatus;
  3133. #endif
  3134. MAILVARIANTS un;
  3135. union sli_var us;
  3136. } MAILBOX_t;
  3137. /*
  3138. * Begin Structure Definitions for IOCB Commands
  3139. */
  3140. typedef struct {
  3141. #ifdef __BIG_ENDIAN_BITFIELD
  3142. uint8_t statAction;
  3143. uint8_t statRsn;
  3144. uint8_t statBaExp;
  3145. uint8_t statLocalError;
  3146. #else /* __LITTLE_ENDIAN_BITFIELD */
  3147. uint8_t statLocalError;
  3148. uint8_t statBaExp;
  3149. uint8_t statRsn;
  3150. uint8_t statAction;
  3151. #endif
  3152. /* statRsn P/F_RJT reason codes */
  3153. #define RJT_BAD_D_ID 0x01 /* Invalid D_ID field */
  3154. #define RJT_BAD_S_ID 0x02 /* Invalid S_ID field */
  3155. #define RJT_UNAVAIL_TEMP 0x03 /* N_Port unavailable temp. */
  3156. #define RJT_UNAVAIL_PERM 0x04 /* N_Port unavailable perm. */
  3157. #define RJT_UNSUP_CLASS 0x05 /* Class not supported */
  3158. #define RJT_DELIM_ERR 0x06 /* Delimiter usage error */
  3159. #define RJT_UNSUP_TYPE 0x07 /* Type not supported */
  3160. #define RJT_BAD_CONTROL 0x08 /* Invalid link conrtol */
  3161. #define RJT_BAD_RCTL 0x09 /* R_CTL invalid */
  3162. #define RJT_BAD_FCTL 0x0A /* F_CTL invalid */
  3163. #define RJT_BAD_OXID 0x0B /* OX_ID invalid */
  3164. #define RJT_BAD_RXID 0x0C /* RX_ID invalid */
  3165. #define RJT_BAD_SEQID 0x0D /* SEQ_ID invalid */
  3166. #define RJT_BAD_DFCTL 0x0E /* DF_CTL invalid */
  3167. #define RJT_BAD_SEQCNT 0x0F /* SEQ_CNT invalid */
  3168. #define RJT_BAD_PARM 0x10 /* Param. field invalid */
  3169. #define RJT_XCHG_ERR 0x11 /* Exchange error */
  3170. #define RJT_PROT_ERR 0x12 /* Protocol error */
  3171. #define RJT_BAD_LENGTH 0x13 /* Invalid Length */
  3172. #define RJT_UNEXPECTED_ACK 0x14 /* Unexpected ACK */
  3173. #define RJT_LOGIN_REQUIRED 0x16 /* Login required */
  3174. #define RJT_TOO_MANY_SEQ 0x17 /* Excessive sequences */
  3175. #define RJT_XCHG_NOT_STRT 0x18 /* Exchange not started */
  3176. #define RJT_UNSUP_SEC_HDR 0x19 /* Security hdr not supported */
  3177. #define RJT_UNAVAIL_PATH 0x1A /* Fabric Path not available */
  3178. #define RJT_VENDOR_UNIQUE 0xFF /* Vendor unique error */
  3179. #define IOERR_SUCCESS 0x00 /* statLocalError */
  3180. #define IOERR_MISSING_CONTINUE 0x01
  3181. #define IOERR_SEQUENCE_TIMEOUT 0x02
  3182. #define IOERR_INTERNAL_ERROR 0x03
  3183. #define IOERR_INVALID_RPI 0x04
  3184. #define IOERR_NO_XRI 0x05
  3185. #define IOERR_ILLEGAL_COMMAND 0x06
  3186. #define IOERR_XCHG_DROPPED 0x07
  3187. #define IOERR_ILLEGAL_FIELD 0x08
  3188. #define IOERR_BAD_CONTINUE 0x09
  3189. #define IOERR_TOO_MANY_BUFFERS 0x0A
  3190. #define IOERR_RCV_BUFFER_WAITING 0x0B
  3191. #define IOERR_NO_CONNECTION 0x0C
  3192. #define IOERR_TX_DMA_FAILED 0x0D
  3193. #define IOERR_RX_DMA_FAILED 0x0E
  3194. #define IOERR_ILLEGAL_FRAME 0x0F
  3195. #define IOERR_EXTRA_DATA 0x10
  3196. #define IOERR_NO_RESOURCES 0x11
  3197. #define IOERR_RESERVED 0x12
  3198. #define IOERR_ILLEGAL_LENGTH 0x13
  3199. #define IOERR_UNSUPPORTED_FEATURE 0x14
  3200. #define IOERR_ABORT_IN_PROGRESS 0x15
  3201. #define IOERR_ABORT_REQUESTED 0x16
  3202. #define IOERR_RECEIVE_BUFFER_TIMEOUT 0x17
  3203. #define IOERR_LOOP_OPEN_FAILURE 0x18
  3204. #define IOERR_RING_RESET 0x19
  3205. #define IOERR_LINK_DOWN 0x1A
  3206. #define IOERR_CORRUPTED_DATA 0x1B
  3207. #define IOERR_CORRUPTED_RPI 0x1C
  3208. #define IOERR_OUT_OF_ORDER_DATA 0x1D
  3209. #define IOERR_OUT_OF_ORDER_ACK 0x1E
  3210. #define IOERR_DUP_FRAME 0x1F
  3211. #define IOERR_LINK_CONTROL_FRAME 0x20 /* ACK_N received */
  3212. #define IOERR_BAD_HOST_ADDRESS 0x21
  3213. #define IOERR_RCV_HDRBUF_WAITING 0x22
  3214. #define IOERR_MISSING_HDR_BUFFER 0x23
  3215. #define IOERR_MSEQ_CHAIN_CORRUPTED 0x24
  3216. #define IOERR_ABORTMULT_REQUESTED 0x25
  3217. #define IOERR_BUFFER_SHORTAGE 0x28
  3218. #define IOERR_DEFAULT 0x29
  3219. #define IOERR_CNT 0x2A
  3220. #define IOERR_SLER_FAILURE 0x46
  3221. #define IOERR_SLER_CMD_RCV_FAILURE 0x47
  3222. #define IOERR_SLER_REC_RJT_ERR 0x48
  3223. #define IOERR_SLER_REC_SRR_RETRY_ERR 0x49
  3224. #define IOERR_SLER_SRR_RJT_ERR 0x4A
  3225. #define IOERR_SLER_RRQ_RJT_ERR 0x4C
  3226. #define IOERR_SLER_RRQ_RETRY_ERR 0x4D
  3227. #define IOERR_SLER_ABTS_ERR 0x4E
  3228. #define IOERR_ELXSEC_KEY_UNWRAP_ERROR 0xF0
  3229. #define IOERR_ELXSEC_KEY_UNWRAP_COMPARE_ERROR 0xF1
  3230. #define IOERR_ELXSEC_CRYPTO_ERROR 0xF2
  3231. #define IOERR_ELXSEC_CRYPTO_COMPARE_ERROR 0xF3
  3232. #define IOERR_DRVR_MASK 0x100
  3233. #define IOERR_SLI_DOWN 0x101 /* ulpStatus - Driver defined */
  3234. #define IOERR_SLI_BRESET 0x102
  3235. #define IOERR_SLI_ABORTED 0x103
  3236. #define IOERR_PARAM_MASK 0x1ff
  3237. } PARM_ERR;
  3238. typedef union {
  3239. struct {
  3240. #ifdef __BIG_ENDIAN_BITFIELD
  3241. uint8_t Rctl; /* R_CTL field */
  3242. uint8_t Type; /* TYPE field */
  3243. uint8_t Dfctl; /* DF_CTL field */
  3244. uint8_t Fctl; /* Bits 0-7 of IOCB word 5 */
  3245. #else /* __LITTLE_ENDIAN_BITFIELD */
  3246. uint8_t Fctl; /* Bits 0-7 of IOCB word 5 */
  3247. uint8_t Dfctl; /* DF_CTL field */
  3248. uint8_t Type; /* TYPE field */
  3249. uint8_t Rctl; /* R_CTL field */
  3250. #endif
  3251. #define BC 0x02 /* Broadcast Received - Fctl */
  3252. #define SI 0x04 /* Sequence Initiative */
  3253. #define LA 0x08 /* Ignore Link Attention state */
  3254. #define LS 0x80 /* Last Sequence */
  3255. } hcsw;
  3256. uint32_t reserved;
  3257. } WORD5;
  3258. /* IOCB Command template for a generic response */
  3259. typedef struct {
  3260. uint32_t reserved[4];
  3261. PARM_ERR perr;
  3262. } GENERIC_RSP;
  3263. /* IOCB Command template for XMIT / XMIT_BCAST / RCV_SEQUENCE / XMIT_ELS */
  3264. typedef struct {
  3265. struct ulp_bde xrsqbde[2];
  3266. uint32_t xrsqRo; /* Starting Relative Offset */
  3267. WORD5 w5; /* Header control/status word */
  3268. } XR_SEQ_FIELDS;
  3269. /* IOCB Command template for ELS_REQUEST */
  3270. typedef struct {
  3271. struct ulp_bde elsReq;
  3272. struct ulp_bde elsRsp;
  3273. #ifdef __BIG_ENDIAN_BITFIELD
  3274. uint32_t word4Rsvd:7;
  3275. uint32_t fl:1;
  3276. uint32_t myID:24;
  3277. uint32_t word5Rsvd:8;
  3278. uint32_t remoteID:24;
  3279. #else /* __LITTLE_ENDIAN_BITFIELD */
  3280. uint32_t myID:24;
  3281. uint32_t fl:1;
  3282. uint32_t word4Rsvd:7;
  3283. uint32_t remoteID:24;
  3284. uint32_t word5Rsvd:8;
  3285. #endif
  3286. } ELS_REQUEST;
  3287. /* IOCB Command template for RCV_ELS_REQ */
  3288. typedef struct {
  3289. struct ulp_bde elsReq[2];
  3290. uint32_t parmRo;
  3291. #ifdef __BIG_ENDIAN_BITFIELD
  3292. uint32_t word5Rsvd:8;
  3293. uint32_t remoteID:24;
  3294. #else /* __LITTLE_ENDIAN_BITFIELD */
  3295. uint32_t remoteID:24;
  3296. uint32_t word5Rsvd:8;
  3297. #endif
  3298. } RCV_ELS_REQ;
  3299. /* IOCB Command template for ABORT / CLOSE_XRI */
  3300. typedef struct {
  3301. uint32_t rsvd[3];
  3302. uint32_t abortType;
  3303. #define ABORT_TYPE_ABTX 0x00000000
  3304. #define ABORT_TYPE_ABTS 0x00000001
  3305. uint32_t parm;
  3306. #ifdef __BIG_ENDIAN_BITFIELD
  3307. uint16_t abortContextTag; /* ulpContext from command to abort/close */
  3308. uint16_t abortIoTag; /* ulpIoTag from command to abort/close */
  3309. #else /* __LITTLE_ENDIAN_BITFIELD */
  3310. uint16_t abortIoTag; /* ulpIoTag from command to abort/close */
  3311. uint16_t abortContextTag; /* ulpContext from command to abort/close */
  3312. #endif
  3313. } AC_XRI;
  3314. /* IOCB Command template for ABORT_MXRI64 */
  3315. typedef struct {
  3316. uint32_t rsvd[3];
  3317. uint32_t abortType;
  3318. uint32_t parm;
  3319. uint32_t iotag32;
  3320. } A_MXRI64;
  3321. /* IOCB Command template for GET_RPI */
  3322. typedef struct {
  3323. uint32_t rsvd[4];
  3324. uint32_t parmRo;
  3325. #ifdef __BIG_ENDIAN_BITFIELD
  3326. uint32_t word5Rsvd:8;
  3327. uint32_t remoteID:24;
  3328. #else /* __LITTLE_ENDIAN_BITFIELD */
  3329. uint32_t remoteID:24;
  3330. uint32_t word5Rsvd:8;
  3331. #endif
  3332. } GET_RPI;
  3333. /* IOCB Command template for all FCP Initiator commands */
  3334. typedef struct {
  3335. struct ulp_bde fcpi_cmnd; /* FCP_CMND payload descriptor */
  3336. struct ulp_bde fcpi_rsp; /* Rcv buffer */
  3337. uint32_t fcpi_parm;
  3338. uint32_t fcpi_XRdy; /* transfer ready for IWRITE */
  3339. } FCPI_FIELDS;
  3340. /* IOCB Command template for all FCP Target commands */
  3341. typedef struct {
  3342. struct ulp_bde fcpt_Buffer[2]; /* FCP_CMND payload descriptor */
  3343. uint32_t fcpt_Offset;
  3344. uint32_t fcpt_Length; /* transfer ready for IWRITE */
  3345. } FCPT_FIELDS;
  3346. /* SLI-2 IOCB structure definitions */
  3347. /* IOCB Command template for 64 bit XMIT / XMIT_BCAST / XMIT_ELS */
  3348. typedef struct {
  3349. ULP_BDL bdl;
  3350. uint32_t xrsqRo; /* Starting Relative Offset */
  3351. WORD5 w5; /* Header control/status word */
  3352. } XMT_SEQ_FIELDS64;
  3353. /* This word is remote ports D_ID for XMIT_ELS_RSP64 */
  3354. #define xmit_els_remoteID xrsqRo
  3355. /* IOCB Command template for 64 bit RCV_SEQUENCE64 */
  3356. typedef struct {
  3357. struct ulp_bde64 rcvBde;
  3358. uint32_t rsvd1;
  3359. uint32_t xrsqRo; /* Starting Relative Offset */
  3360. WORD5 w5; /* Header control/status word */
  3361. } RCV_SEQ_FIELDS64;
  3362. /* IOCB Command template for ELS_REQUEST64 */
  3363. typedef struct {
  3364. ULP_BDL bdl;
  3365. #ifdef __BIG_ENDIAN_BITFIELD
  3366. uint32_t word4Rsvd:7;
  3367. uint32_t fl:1;
  3368. uint32_t myID:24;
  3369. uint32_t word5Rsvd:8;
  3370. uint32_t remoteID:24;
  3371. #else /* __LITTLE_ENDIAN_BITFIELD */
  3372. uint32_t myID:24;
  3373. uint32_t fl:1;
  3374. uint32_t word4Rsvd:7;
  3375. uint32_t remoteID:24;
  3376. uint32_t word5Rsvd:8;
  3377. #endif
  3378. } ELS_REQUEST64;
  3379. /* IOCB Command template for GEN_REQUEST64 */
  3380. typedef struct {
  3381. ULP_BDL bdl;
  3382. uint32_t xrsqRo; /* Starting Relative Offset */
  3383. WORD5 w5; /* Header control/status word */
  3384. } GEN_REQUEST64;
  3385. /* IOCB Command template for RCV_ELS_REQ64 */
  3386. typedef struct {
  3387. struct ulp_bde64 elsReq;
  3388. uint32_t rcvd1;
  3389. uint32_t parmRo;
  3390. #ifdef __BIG_ENDIAN_BITFIELD
  3391. uint32_t word5Rsvd:8;
  3392. uint32_t remoteID:24;
  3393. #else /* __LITTLE_ENDIAN_BITFIELD */
  3394. uint32_t remoteID:24;
  3395. uint32_t word5Rsvd:8;
  3396. #endif
  3397. } RCV_ELS_REQ64;
  3398. /* IOCB Command template for RCV_SEQ64 */
  3399. struct rcv_seq64 {
  3400. struct ulp_bde64 elsReq;
  3401. uint32_t hbq_1;
  3402. uint32_t parmRo;
  3403. #ifdef __BIG_ENDIAN_BITFIELD
  3404. uint32_t rctl:8;
  3405. uint32_t type:8;
  3406. uint32_t dfctl:8;
  3407. uint32_t ls:1;
  3408. uint32_t fs:1;
  3409. uint32_t rsvd2:3;
  3410. uint32_t si:1;
  3411. uint32_t bc:1;
  3412. uint32_t rsvd3:1;
  3413. #else /* __LITTLE_ENDIAN_BITFIELD */
  3414. uint32_t rsvd3:1;
  3415. uint32_t bc:1;
  3416. uint32_t si:1;
  3417. uint32_t rsvd2:3;
  3418. uint32_t fs:1;
  3419. uint32_t ls:1;
  3420. uint32_t dfctl:8;
  3421. uint32_t type:8;
  3422. uint32_t rctl:8;
  3423. #endif
  3424. };
  3425. /* IOCB Command template for all 64 bit FCP Initiator commands */
  3426. typedef struct {
  3427. ULP_BDL bdl;
  3428. uint32_t fcpi_parm;
  3429. uint32_t fcpi_XRdy; /* transfer ready for IWRITE */
  3430. } FCPI_FIELDS64;
  3431. /* IOCB Command template for all 64 bit FCP Target commands */
  3432. typedef struct {
  3433. ULP_BDL bdl;
  3434. uint32_t fcpt_Offset;
  3435. uint32_t fcpt_Length; /* transfer ready for IWRITE */
  3436. } FCPT_FIELDS64;
  3437. /* IOCB Command template for Async Status iocb commands */
  3438. typedef struct {
  3439. uint32_t rsvd[4];
  3440. uint32_t param;
  3441. #ifdef __BIG_ENDIAN_BITFIELD
  3442. uint16_t evt_code; /* High order bits word 5 */
  3443. uint16_t sub_ctxt_tag; /* Low order bits word 5 */
  3444. #else /* __LITTLE_ENDIAN_BITFIELD */
  3445. uint16_t sub_ctxt_tag; /* High order bits word 5 */
  3446. uint16_t evt_code; /* Low order bits word 5 */
  3447. #endif
  3448. } ASYNCSTAT_FIELDS;
  3449. #define ASYNC_TEMP_WARN 0x100
  3450. #define ASYNC_TEMP_SAFE 0x101
  3451. #define ASYNC_STATUS_CN 0x102
  3452. /* IOCB Command template for CMD_IOCB_RCV_ELS64_CX (0xB7)
  3453. or CMD_IOCB_RCV_SEQ64_CX (0xB5) */
  3454. struct rcv_sli3 {
  3455. #ifdef __BIG_ENDIAN_BITFIELD
  3456. uint16_t ox_id;
  3457. uint16_t seq_cnt;
  3458. uint16_t vpi;
  3459. uint16_t word9Rsvd;
  3460. #else /* __LITTLE_ENDIAN */
  3461. uint16_t seq_cnt;
  3462. uint16_t ox_id;
  3463. uint16_t word9Rsvd;
  3464. uint16_t vpi;
  3465. #endif
  3466. uint32_t word10Rsvd;
  3467. uint32_t acc_len; /* accumulated length */
  3468. struct ulp_bde64 bde2;
  3469. };
  3470. /* Structure used for a single HBQ entry */
  3471. struct lpfc_hbq_entry {
  3472. struct ulp_bde64 bde;
  3473. uint32_t buffer_tag;
  3474. };
  3475. /* IOCB Command template for QUE_XRI64_CX (0xB3) command */
  3476. typedef struct {
  3477. struct lpfc_hbq_entry buff;
  3478. uint32_t rsvd;
  3479. uint32_t rsvd1;
  3480. } QUE_XRI64_CX_FIELDS;
  3481. struct que_xri64cx_ext_fields {
  3482. uint32_t iotag64_low;
  3483. uint32_t iotag64_high;
  3484. uint32_t ebde_count;
  3485. uint32_t rsvd;
  3486. struct lpfc_hbq_entry buff[5];
  3487. };
  3488. struct sli3_bg_fields {
  3489. uint32_t filler[6]; /* word 8-13 in IOCB */
  3490. uint32_t bghm; /* word 14 - BlockGuard High Water Mark */
  3491. /* Bitfields for bgstat (BlockGuard Status - word 15 of IOCB) */
  3492. #define BGS_BIDIR_BG_PROF_MASK 0xff000000
  3493. #define BGS_BIDIR_BG_PROF_SHIFT 24
  3494. #define BGS_BIDIR_ERR_COND_FLAGS_MASK 0x003f0000
  3495. #define BGS_BIDIR_ERR_COND_SHIFT 16
  3496. #define BGS_BG_PROFILE_MASK 0x0000ff00
  3497. #define BGS_BG_PROFILE_SHIFT 8
  3498. #define BGS_INVALID_PROF_MASK 0x00000020
  3499. #define BGS_INVALID_PROF_SHIFT 5
  3500. #define BGS_UNINIT_DIF_BLOCK_MASK 0x00000010
  3501. #define BGS_UNINIT_DIF_BLOCK_SHIFT 4
  3502. #define BGS_HI_WATER_MARK_PRESENT_MASK 0x00000008
  3503. #define BGS_HI_WATER_MARK_PRESENT_SHIFT 3
  3504. #define BGS_REFTAG_ERR_MASK 0x00000004
  3505. #define BGS_REFTAG_ERR_SHIFT 2
  3506. #define BGS_APPTAG_ERR_MASK 0x00000002
  3507. #define BGS_APPTAG_ERR_SHIFT 1
  3508. #define BGS_GUARD_ERR_MASK 0x00000001
  3509. #define BGS_GUARD_ERR_SHIFT 0
  3510. uint32_t bgstat; /* word 15 - BlockGuard Status */
  3511. };
  3512. static inline uint32_t
  3513. lpfc_bgs_get_bidir_bg_prof(uint32_t bgstat)
  3514. {
  3515. return (bgstat & BGS_BIDIR_BG_PROF_MASK) >>
  3516. BGS_BIDIR_BG_PROF_SHIFT;
  3517. }
  3518. static inline uint32_t
  3519. lpfc_bgs_get_bidir_err_cond(uint32_t bgstat)
  3520. {
  3521. return (bgstat & BGS_BIDIR_ERR_COND_FLAGS_MASK) >>
  3522. BGS_BIDIR_ERR_COND_SHIFT;
  3523. }
  3524. static inline uint32_t
  3525. lpfc_bgs_get_bg_prof(uint32_t bgstat)
  3526. {
  3527. return (bgstat & BGS_BG_PROFILE_MASK) >>
  3528. BGS_BG_PROFILE_SHIFT;
  3529. }
  3530. static inline uint32_t
  3531. lpfc_bgs_get_invalid_prof(uint32_t bgstat)
  3532. {
  3533. return (bgstat & BGS_INVALID_PROF_MASK) >>
  3534. BGS_INVALID_PROF_SHIFT;
  3535. }
  3536. static inline uint32_t
  3537. lpfc_bgs_get_uninit_dif_block(uint32_t bgstat)
  3538. {
  3539. return (bgstat & BGS_UNINIT_DIF_BLOCK_MASK) >>
  3540. BGS_UNINIT_DIF_BLOCK_SHIFT;
  3541. }
  3542. static inline uint32_t
  3543. lpfc_bgs_get_hi_water_mark_present(uint32_t bgstat)
  3544. {
  3545. return (bgstat & BGS_HI_WATER_MARK_PRESENT_MASK) >>
  3546. BGS_HI_WATER_MARK_PRESENT_SHIFT;
  3547. }
  3548. static inline uint32_t
  3549. lpfc_bgs_get_reftag_err(uint32_t bgstat)
  3550. {
  3551. return (bgstat & BGS_REFTAG_ERR_MASK) >>
  3552. BGS_REFTAG_ERR_SHIFT;
  3553. }
  3554. static inline uint32_t
  3555. lpfc_bgs_get_apptag_err(uint32_t bgstat)
  3556. {
  3557. return (bgstat & BGS_APPTAG_ERR_MASK) >>
  3558. BGS_APPTAG_ERR_SHIFT;
  3559. }
  3560. static inline uint32_t
  3561. lpfc_bgs_get_guard_err(uint32_t bgstat)
  3562. {
  3563. return (bgstat & BGS_GUARD_ERR_MASK) >>
  3564. BGS_GUARD_ERR_SHIFT;
  3565. }
  3566. #define LPFC_EXT_DATA_BDE_COUNT 3
  3567. struct fcp_irw_ext {
  3568. uint32_t io_tag64_low;
  3569. uint32_t io_tag64_high;
  3570. #ifdef __BIG_ENDIAN_BITFIELD
  3571. uint8_t reserved1;
  3572. uint8_t reserved2;
  3573. uint8_t reserved3;
  3574. uint8_t ebde_count;
  3575. #else /* __LITTLE_ENDIAN */
  3576. uint8_t ebde_count;
  3577. uint8_t reserved3;
  3578. uint8_t reserved2;
  3579. uint8_t reserved1;
  3580. #endif
  3581. uint32_t reserved4;
  3582. struct ulp_bde64 rbde; /* response bde */
  3583. struct ulp_bde64 dbde[LPFC_EXT_DATA_BDE_COUNT]; /* data BDE or BPL */
  3584. uint8_t icd[32]; /* immediate command data (32 bytes) */
  3585. };
  3586. typedef struct _IOCB { /* IOCB structure */
  3587. union {
  3588. GENERIC_RSP grsp; /* Generic response */
  3589. XR_SEQ_FIELDS xrseq; /* XMIT / BCAST / RCV_SEQUENCE cmd */
  3590. struct ulp_bde cont[3]; /* up to 3 continuation bdes */
  3591. RCV_ELS_REQ rcvels; /* RCV_ELS_REQ template */
  3592. AC_XRI acxri; /* ABORT / CLOSE_XRI template */
  3593. A_MXRI64 amxri; /* abort multiple xri command overlay */
  3594. GET_RPI getrpi; /* GET_RPI template */
  3595. FCPI_FIELDS fcpi; /* FCP Initiator template */
  3596. FCPT_FIELDS fcpt; /* FCP target template */
  3597. /* SLI-2 structures */
  3598. struct ulp_bde64 cont64[2]; /* up to 2 64 bit continuation
  3599. * bde_64s */
  3600. ELS_REQUEST64 elsreq64; /* ELS_REQUEST template */
  3601. GEN_REQUEST64 genreq64; /* GEN_REQUEST template */
  3602. RCV_ELS_REQ64 rcvels64; /* RCV_ELS_REQ template */
  3603. XMT_SEQ_FIELDS64 xseq64; /* XMIT / BCAST cmd */
  3604. FCPI_FIELDS64 fcpi64; /* FCP 64 bit Initiator template */
  3605. FCPT_FIELDS64 fcpt64; /* FCP 64 bit target template */
  3606. ASYNCSTAT_FIELDS asyncstat; /* async_status iocb */
  3607. QUE_XRI64_CX_FIELDS quexri64cx; /* que_xri64_cx fields */
  3608. struct rcv_seq64 rcvseq64; /* RCV_SEQ64 and RCV_CONT64 */
  3609. struct sli4_bls_rsp bls_rsp; /* UNSOL ABTS BLS_RSP params */
  3610. uint32_t ulpWord[IOCB_WORD_SZ - 2]; /* generic 6 'words' */
  3611. } un;
  3612. union {
  3613. struct {
  3614. #ifdef __BIG_ENDIAN_BITFIELD
  3615. uint16_t ulpContext; /* High order bits word 6 */
  3616. uint16_t ulpIoTag; /* Low order bits word 6 */
  3617. #else /* __LITTLE_ENDIAN_BITFIELD */
  3618. uint16_t ulpIoTag; /* Low order bits word 6 */
  3619. uint16_t ulpContext; /* High order bits word 6 */
  3620. #endif
  3621. } t1;
  3622. struct {
  3623. #ifdef __BIG_ENDIAN_BITFIELD
  3624. uint16_t ulpContext; /* High order bits word 6 */
  3625. uint16_t ulpIoTag1:2; /* Low order bits word 6 */
  3626. uint16_t ulpIoTag0:14; /* Low order bits word 6 */
  3627. #else /* __LITTLE_ENDIAN_BITFIELD */
  3628. uint16_t ulpIoTag0:14; /* Low order bits word 6 */
  3629. uint16_t ulpIoTag1:2; /* Low order bits word 6 */
  3630. uint16_t ulpContext; /* High order bits word 6 */
  3631. #endif
  3632. } t2;
  3633. } un1;
  3634. #define ulpContext un1.t1.ulpContext
  3635. #define ulpIoTag un1.t1.ulpIoTag
  3636. #define ulpIoTag0 un1.t2.ulpIoTag0
  3637. #ifdef __BIG_ENDIAN_BITFIELD
  3638. uint32_t ulpTimeout:8;
  3639. uint32_t ulpXS:1;
  3640. uint32_t ulpFCP2Rcvy:1;
  3641. uint32_t ulpPU:2;
  3642. uint32_t ulpIr:1;
  3643. uint32_t ulpClass:3;
  3644. uint32_t ulpCommand:8;
  3645. uint32_t ulpStatus:4;
  3646. uint32_t ulpBdeCount:2;
  3647. uint32_t ulpLe:1;
  3648. uint32_t ulpOwner:1; /* Low order bit word 7 */
  3649. #else /* __LITTLE_ENDIAN_BITFIELD */
  3650. uint32_t ulpOwner:1; /* Low order bit word 7 */
  3651. uint32_t ulpLe:1;
  3652. uint32_t ulpBdeCount:2;
  3653. uint32_t ulpStatus:4;
  3654. uint32_t ulpCommand:8;
  3655. uint32_t ulpClass:3;
  3656. uint32_t ulpIr:1;
  3657. uint32_t ulpPU:2;
  3658. uint32_t ulpFCP2Rcvy:1;
  3659. uint32_t ulpXS:1;
  3660. uint32_t ulpTimeout:8;
  3661. #endif
  3662. union {
  3663. struct rcv_sli3 rcvsli3; /* words 8 - 15 */
  3664. /* words 8-31 used for que_xri_cx iocb */
  3665. struct que_xri64cx_ext_fields que_xri64cx_ext_words;
  3666. struct fcp_irw_ext fcp_ext;
  3667. uint32_t sli3Words[24]; /* 96 extra bytes for SLI-3 */
  3668. /* words 8-15 for BlockGuard */
  3669. struct sli3_bg_fields sli3_bg;
  3670. } unsli3;
  3671. #define ulpCt_h ulpXS
  3672. #define ulpCt_l ulpFCP2Rcvy
  3673. #define IOCB_FCP 1 /* IOCB is used for FCP ELS cmds-ulpRsvByte */
  3674. #define IOCB_IP 2 /* IOCB is used for IP ELS cmds */
  3675. #define PARM_UNUSED 0 /* PU field (Word 4) not used */
  3676. #define PARM_REL_OFF 1 /* PU field (Word 4) = R. O. */
  3677. #define PARM_READ_CHECK 2 /* PU field (Word 4) = Data Transfer Length */
  3678. #define PARM_NPIV_DID 3
  3679. #define CLASS1 0 /* Class 1 */
  3680. #define CLASS2 1 /* Class 2 */
  3681. #define CLASS3 2 /* Class 3 */
  3682. #define CLASS_FCP_INTERMIX 7 /* FCP Data->Cls 1, all else->Cls 2 */
  3683. #define IOSTAT_SUCCESS 0x0 /* ulpStatus - HBA defined */
  3684. #define IOSTAT_FCP_RSP_ERROR 0x1
  3685. #define IOSTAT_REMOTE_STOP 0x2
  3686. #define IOSTAT_LOCAL_REJECT 0x3
  3687. #define IOSTAT_NPORT_RJT 0x4
  3688. #define IOSTAT_FABRIC_RJT 0x5
  3689. #define IOSTAT_NPORT_BSY 0x6
  3690. #define IOSTAT_FABRIC_BSY 0x7
  3691. #define IOSTAT_INTERMED_RSP 0x8
  3692. #define IOSTAT_LS_RJT 0x9
  3693. #define IOSTAT_BA_RJT 0xA
  3694. #define IOSTAT_RSVD1 0xB
  3695. #define IOSTAT_RSVD2 0xC
  3696. #define IOSTAT_RSVD3 0xD
  3697. #define IOSTAT_RSVD4 0xE
  3698. #define IOSTAT_NEED_BUFFER 0xF
  3699. #define IOSTAT_DRIVER_REJECT 0x10 /* ulpStatus - Driver defined */
  3700. #define IOSTAT_DEFAULT 0xF /* Same as rsvd5 for now */
  3701. #define IOSTAT_CNT 0x11
  3702. } IOCB_t;
  3703. #define SLI1_SLIM_SIZE (4 * 1024)
  3704. /* Up to 498 IOCBs will fit into 16k
  3705. * 256 (MAILBOX_t) + 140 (PCB_t) + ( 32 (IOCB_t) * 498 ) = < 16384
  3706. */
  3707. #define SLI2_SLIM_SIZE (64 * 1024)
  3708. /* Maximum IOCBs that will fit in SLI2 slim */
  3709. #define MAX_SLI2_IOCB 498
  3710. #define MAX_SLIM_IOCB_SIZE (SLI2_SLIM_SIZE - \
  3711. (sizeof(MAILBOX_t) + sizeof(PCB_t) + \
  3712. sizeof(uint32_t) * MAILBOX_EXT_WSIZE))
  3713. /* HBQ entries are 4 words each = 4k */
  3714. #define LPFC_TOTAL_HBQ_SIZE (sizeof(struct lpfc_hbq_entry) * \
  3715. lpfc_sli_hbq_count())
  3716. struct lpfc_sli2_slim {
  3717. MAILBOX_t mbx;
  3718. uint32_t mbx_ext_words[MAILBOX_EXT_WSIZE];
  3719. PCB_t pcb;
  3720. IOCB_t IOCBs[MAX_SLIM_IOCB_SIZE];
  3721. };
  3722. /*
  3723. * This function checks PCI device to allow special handling for LC HBAs.
  3724. *
  3725. * Parameters:
  3726. * device : struct pci_dev 's device field
  3727. *
  3728. * return 1 => TRUE
  3729. * 0 => FALSE
  3730. */
  3731. static inline int
  3732. lpfc_is_LC_HBA(unsigned short device)
  3733. {
  3734. if ((device == PCI_DEVICE_ID_TFLY) ||
  3735. (device == PCI_DEVICE_ID_PFLY) ||
  3736. (device == PCI_DEVICE_ID_LP101) ||
  3737. (device == PCI_DEVICE_ID_BMID) ||
  3738. (device == PCI_DEVICE_ID_BSMB) ||
  3739. (device == PCI_DEVICE_ID_ZMID) ||
  3740. (device == PCI_DEVICE_ID_ZSMB) ||
  3741. (device == PCI_DEVICE_ID_SAT_MID) ||
  3742. (device == PCI_DEVICE_ID_SAT_SMB) ||
  3743. (device == PCI_DEVICE_ID_RFLY))
  3744. return 1;
  3745. else
  3746. return 0;
  3747. }
  3748. /*
  3749. * Determine if an IOCB failed because of a link event or firmware reset.
  3750. */
  3751. static inline int
  3752. lpfc_error_lost_link(IOCB_t *iocbp)
  3753. {
  3754. return (iocbp->ulpStatus == IOSTAT_LOCAL_REJECT &&
  3755. (iocbp->un.ulpWord[4] == IOERR_SLI_ABORTED ||
  3756. iocbp->un.ulpWord[4] == IOERR_LINK_DOWN ||
  3757. iocbp->un.ulpWord[4] == IOERR_SLI_DOWN));
  3758. }
  3759. #define MENLO_TRANSPORT_TYPE 0xfe
  3760. #define MENLO_CONTEXT 0
  3761. #define MENLO_PU 3
  3762. #define MENLO_TIMEOUT 30
  3763. #define SETVAR_MLOMNT 0x103107
  3764. #define SETVAR_MLORST 0x103007
  3765. #define BPL_ALIGN_SZ 8 /* 8 byte alignment for bpl and mbufs */