lpfc_hw.h 91 KB

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