lpfc_hw.h 89 KB

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