lpfc_hw.h 124 KB

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