lpfc_hw.h 76 KB

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