lpfc_hw.h 105 KB

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