lpfc_hw.h 76 KB

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