lpfc_hw.h 130 KB

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