lpfc_hw.h 78 KB

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