lpfc_hw4.h 75 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263
  1. /*******************************************************************
  2. * This file is part of the Emulex Linux Device Driver for *
  3. * Fibre Channel Host Bus Adapters. *
  4. * Copyright (C) 2009 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. /* Macros to deal with bit fields. Each bit field must have 3 #defines
  21. * associated with it (_SHIFT, _MASK, and _WORD).
  22. * EG. For a bit field that is in the 7th bit of the "field4" field of a
  23. * structure and is 2 bits in size the following #defines must exist:
  24. * struct temp {
  25. * uint32_t field1;
  26. * uint32_t field2;
  27. * uint32_t field3;
  28. * uint32_t field4;
  29. * #define example_bit_field_SHIFT 7
  30. * #define example_bit_field_MASK 0x03
  31. * #define example_bit_field_WORD field4
  32. * uint32_t field5;
  33. * };
  34. * Then the macros below may be used to get or set the value of that field.
  35. * EG. To get the value of the bit field from the above example:
  36. * struct temp t1;
  37. * value = bf_get(example_bit_field, &t1);
  38. * And then to set that bit field:
  39. * bf_set(example_bit_field, &t1, 2);
  40. * Or clear that bit field:
  41. * bf_set(example_bit_field, &t1, 0);
  42. */
  43. #define bf_get(name, ptr) \
  44. (((ptr)->name##_WORD >> name##_SHIFT) & name##_MASK)
  45. #define bf_set(name, ptr, value) \
  46. ((ptr)->name##_WORD = ((((value) & name##_MASK) << name##_SHIFT) | \
  47. ((ptr)->name##_WORD & ~(name##_MASK << name##_SHIFT))))
  48. struct dma_address {
  49. uint32_t addr_lo;
  50. uint32_t addr_hi;
  51. };
  52. #define LPFC_SLIREV_CONF_WORD 0x58
  53. struct lpfc_sli_intf {
  54. uint32_t word0;
  55. #define lpfc_sli_intf_iftype_MASK 0x00000007
  56. #define lpfc_sli_intf_iftype_SHIFT 0
  57. #define lpfc_sli_intf_iftype_WORD word0
  58. #define lpfc_sli_intf_rev_MASK 0x0000000f
  59. #define lpfc_sli_intf_rev_SHIFT 4
  60. #define lpfc_sli_intf_rev_WORD word0
  61. #define LPFC_SLIREV_CONF_SLI4 4
  62. #define lpfc_sli_intf_family_MASK 0x000000ff
  63. #define lpfc_sli_intf_family_SHIFT 8
  64. #define lpfc_sli_intf_family_WORD word0
  65. #define lpfc_sli_intf_feat1_MASK 0x000000ff
  66. #define lpfc_sli_intf_feat1_SHIFT 16
  67. #define lpfc_sli_intf_feat1_WORD word0
  68. #define lpfc_sli_intf_feat2_MASK 0x0000001f
  69. #define lpfc_sli_intf_feat2_SHIFT 24
  70. #define lpfc_sli_intf_feat2_WORD word0
  71. #define lpfc_sli_intf_valid_MASK 0x00000007
  72. #define lpfc_sli_intf_valid_SHIFT 29
  73. #define lpfc_sli_intf_valid_WORD word0
  74. #define LPFC_SLI_INTF_VALID 6
  75. };
  76. #define LPFC_SLI4_BAR0 1
  77. #define LPFC_SLI4_BAR1 2
  78. #define LPFC_SLI4_BAR2 4
  79. #define LPFC_SLI4_MBX_EMBED true
  80. #define LPFC_SLI4_MBX_NEMBED false
  81. #define LPFC_SLI4_MB_WORD_COUNT 64
  82. #define LPFC_MAX_MQ_PAGE 8
  83. #define LPFC_MAX_WQ_PAGE 8
  84. #define LPFC_MAX_CQ_PAGE 4
  85. #define LPFC_MAX_EQ_PAGE 8
  86. #define LPFC_VIR_FUNC_MAX 32 /* Maximum number of virtual functions */
  87. #define LPFC_PCI_FUNC_MAX 5 /* Maximum number of PCI functions */
  88. #define LPFC_VFR_PAGE_SIZE 0x1000 /* 4KB BAR2 per-VF register page size */
  89. /* Define SLI4 Alignment requirements. */
  90. #define LPFC_ALIGN_16_BYTE 16
  91. #define LPFC_ALIGN_64_BYTE 64
  92. /* Define SLI4 specific definitions. */
  93. #define LPFC_MQ_CQE_BYTE_OFFSET 256
  94. #define LPFC_MBX_CMD_HDR_LENGTH 16
  95. #define LPFC_MBX_ERROR_RANGE 0x4000
  96. #define LPFC_BMBX_BIT1_ADDR_HI 0x2
  97. #define LPFC_BMBX_BIT1_ADDR_LO 0
  98. #define LPFC_RPI_HDR_COUNT 64
  99. #define LPFC_HDR_TEMPLATE_SIZE 4096
  100. #define LPFC_RPI_ALLOC_ERROR 0xFFFF
  101. #define LPFC_FCF_RECORD_WD_CNT 132
  102. #define LPFC_ENTIRE_FCF_DATABASE 0
  103. #define LPFC_DFLT_FCF_INDEX 0
  104. /* Virtual function numbers */
  105. #define LPFC_VF0 0
  106. #define LPFC_VF1 1
  107. #define LPFC_VF2 2
  108. #define LPFC_VF3 3
  109. #define LPFC_VF4 4
  110. #define LPFC_VF5 5
  111. #define LPFC_VF6 6
  112. #define LPFC_VF7 7
  113. #define LPFC_VF8 8
  114. #define LPFC_VF9 9
  115. #define LPFC_VF10 10
  116. #define LPFC_VF11 11
  117. #define LPFC_VF12 12
  118. #define LPFC_VF13 13
  119. #define LPFC_VF14 14
  120. #define LPFC_VF15 15
  121. #define LPFC_VF16 16
  122. #define LPFC_VF17 17
  123. #define LPFC_VF18 18
  124. #define LPFC_VF19 19
  125. #define LPFC_VF20 20
  126. #define LPFC_VF21 21
  127. #define LPFC_VF22 22
  128. #define LPFC_VF23 23
  129. #define LPFC_VF24 24
  130. #define LPFC_VF25 25
  131. #define LPFC_VF26 26
  132. #define LPFC_VF27 27
  133. #define LPFC_VF28 28
  134. #define LPFC_VF29 29
  135. #define LPFC_VF30 30
  136. #define LPFC_VF31 31
  137. /* PCI function numbers */
  138. #define LPFC_PCI_FUNC0 0
  139. #define LPFC_PCI_FUNC1 1
  140. #define LPFC_PCI_FUNC2 2
  141. #define LPFC_PCI_FUNC3 3
  142. #define LPFC_PCI_FUNC4 4
  143. /* Active interrupt test count */
  144. #define LPFC_ACT_INTR_CNT 4
  145. /* Delay Multiplier constant */
  146. #define LPFC_DMULT_CONST 651042
  147. #define LPFC_MIM_IMAX 636
  148. #define LPFC_FP_DEF_IMAX 10000
  149. #define LPFC_SP_DEF_IMAX 10000
  150. struct ulp_bde64 {
  151. union ULP_BDE_TUS {
  152. uint32_t w;
  153. struct {
  154. #ifdef __BIG_ENDIAN_BITFIELD
  155. uint32_t bdeFlags:8; /* BDE Flags 0 IS A SUPPORTED
  156. VALUE !! */
  157. uint32_t bdeSize:24; /* Size of buffer (in bytes) */
  158. #else /* __LITTLE_ENDIAN_BITFIELD */
  159. uint32_t bdeSize:24; /* Size of buffer (in bytes) */
  160. uint32_t bdeFlags:8; /* BDE Flags 0 IS A SUPPORTED
  161. VALUE !! */
  162. #endif
  163. #define BUFF_TYPE_BDE_64 0x00 /* BDE (Host_resident) */
  164. #define BUFF_TYPE_BDE_IMMED 0x01 /* Immediate Data BDE */
  165. #define BUFF_TYPE_BDE_64P 0x02 /* BDE (Port-resident) */
  166. #define BUFF_TYPE_BDE_64I 0x08 /* Input BDE (Host-resident) */
  167. #define BUFF_TYPE_BDE_64IP 0x0A /* Input BDE (Port-resident) */
  168. #define BUFF_TYPE_BLP_64 0x40 /* BLP (Host-resident) */
  169. #define BUFF_TYPE_BLP_64P 0x42 /* BLP (Port-resident) */
  170. } f;
  171. } tus;
  172. uint32_t addrLow;
  173. uint32_t addrHigh;
  174. };
  175. struct lpfc_sli4_flags {
  176. uint32_t word0;
  177. #define lpfc_fip_flag_SHIFT 0
  178. #define lpfc_fip_flag_MASK 0x00000001
  179. #define lpfc_fip_flag_WORD word0
  180. };
  181. /* event queue entry structure */
  182. struct lpfc_eqe {
  183. uint32_t word0;
  184. #define lpfc_eqe_resource_id_SHIFT 16
  185. #define lpfc_eqe_resource_id_MASK 0x000000FF
  186. #define lpfc_eqe_resource_id_WORD word0
  187. #define lpfc_eqe_minor_code_SHIFT 4
  188. #define lpfc_eqe_minor_code_MASK 0x00000FFF
  189. #define lpfc_eqe_minor_code_WORD word0
  190. #define lpfc_eqe_major_code_SHIFT 1
  191. #define lpfc_eqe_major_code_MASK 0x00000007
  192. #define lpfc_eqe_major_code_WORD word0
  193. #define lpfc_eqe_valid_SHIFT 0
  194. #define lpfc_eqe_valid_MASK 0x00000001
  195. #define lpfc_eqe_valid_WORD word0
  196. };
  197. /* completion queue entry structure (common fields for all cqe types) */
  198. struct lpfc_cqe {
  199. uint32_t reserved0;
  200. uint32_t reserved1;
  201. uint32_t reserved2;
  202. uint32_t word3;
  203. #define lpfc_cqe_valid_SHIFT 31
  204. #define lpfc_cqe_valid_MASK 0x00000001
  205. #define lpfc_cqe_valid_WORD word3
  206. #define lpfc_cqe_code_SHIFT 16
  207. #define lpfc_cqe_code_MASK 0x000000FF
  208. #define lpfc_cqe_code_WORD word3
  209. };
  210. /* Completion Queue Entry Status Codes */
  211. #define CQE_STATUS_SUCCESS 0x0
  212. #define CQE_STATUS_FCP_RSP_FAILURE 0x1
  213. #define CQE_STATUS_REMOTE_STOP 0x2
  214. #define CQE_STATUS_LOCAL_REJECT 0x3
  215. #define CQE_STATUS_NPORT_RJT 0x4
  216. #define CQE_STATUS_FABRIC_RJT 0x5
  217. #define CQE_STATUS_NPORT_BSY 0x6
  218. #define CQE_STATUS_FABRIC_BSY 0x7
  219. #define CQE_STATUS_INTERMED_RSP 0x8
  220. #define CQE_STATUS_LS_RJT 0x9
  221. #define CQE_STATUS_CMD_REJECT 0xb
  222. #define CQE_STATUS_FCP_TGT_LENCHECK 0xc
  223. #define CQE_STATUS_NEED_BUFF_ENTRY 0xf
  224. /* Status returned by hardware (valid only if status = CQE_STATUS_SUCCESS). */
  225. #define CQE_HW_STATUS_NO_ERR 0x0
  226. #define CQE_HW_STATUS_UNDERRUN 0x1
  227. #define CQE_HW_STATUS_OVERRUN 0x2
  228. /* Completion Queue Entry Codes */
  229. #define CQE_CODE_COMPL_WQE 0x1
  230. #define CQE_CODE_RELEASE_WQE 0x2
  231. #define CQE_CODE_RECEIVE 0x4
  232. #define CQE_CODE_XRI_ABORTED 0x5
  233. /* completion queue entry for wqe completions */
  234. struct lpfc_wcqe_complete {
  235. uint32_t word0;
  236. #define lpfc_wcqe_c_request_tag_SHIFT 16
  237. #define lpfc_wcqe_c_request_tag_MASK 0x0000FFFF
  238. #define lpfc_wcqe_c_request_tag_WORD word0
  239. #define lpfc_wcqe_c_status_SHIFT 8
  240. #define lpfc_wcqe_c_status_MASK 0x000000FF
  241. #define lpfc_wcqe_c_status_WORD word0
  242. #define lpfc_wcqe_c_hw_status_SHIFT 0
  243. #define lpfc_wcqe_c_hw_status_MASK 0x000000FF
  244. #define lpfc_wcqe_c_hw_status_WORD word0
  245. uint32_t total_data_placed;
  246. uint32_t parameter;
  247. uint32_t word3;
  248. #define lpfc_wcqe_c_valid_SHIFT lpfc_cqe_valid_SHIFT
  249. #define lpfc_wcqe_c_valid_MASK lpfc_cqe_valid_MASK
  250. #define lpfc_wcqe_c_valid_WORD lpfc_cqe_valid_WORD
  251. #define lpfc_wcqe_c_xb_SHIFT 28
  252. #define lpfc_wcqe_c_xb_MASK 0x00000001
  253. #define lpfc_wcqe_c_xb_WORD word3
  254. #define lpfc_wcqe_c_pv_SHIFT 27
  255. #define lpfc_wcqe_c_pv_MASK 0x00000001
  256. #define lpfc_wcqe_c_pv_WORD word3
  257. #define lpfc_wcqe_c_priority_SHIFT 24
  258. #define lpfc_wcqe_c_priority_MASK 0x00000007
  259. #define lpfc_wcqe_c_priority_WORD word3
  260. #define lpfc_wcqe_c_code_SHIFT lpfc_cqe_code_SHIFT
  261. #define lpfc_wcqe_c_code_MASK lpfc_cqe_code_MASK
  262. #define lpfc_wcqe_c_code_WORD lpfc_cqe_code_WORD
  263. };
  264. /* completion queue entry for wqe release */
  265. struct lpfc_wcqe_release {
  266. uint32_t reserved0;
  267. uint32_t reserved1;
  268. uint32_t word2;
  269. #define lpfc_wcqe_r_wq_id_SHIFT 16
  270. #define lpfc_wcqe_r_wq_id_MASK 0x0000FFFF
  271. #define lpfc_wcqe_r_wq_id_WORD word2
  272. #define lpfc_wcqe_r_wqe_index_SHIFT 0
  273. #define lpfc_wcqe_r_wqe_index_MASK 0x0000FFFF
  274. #define lpfc_wcqe_r_wqe_index_WORD word2
  275. uint32_t word3;
  276. #define lpfc_wcqe_r_valid_SHIFT lpfc_cqe_valid_SHIFT
  277. #define lpfc_wcqe_r_valid_MASK lpfc_cqe_valid_MASK
  278. #define lpfc_wcqe_r_valid_WORD lpfc_cqe_valid_WORD
  279. #define lpfc_wcqe_r_code_SHIFT lpfc_cqe_code_SHIFT
  280. #define lpfc_wcqe_r_code_MASK lpfc_cqe_code_MASK
  281. #define lpfc_wcqe_r_code_WORD lpfc_cqe_code_WORD
  282. };
  283. struct sli4_wcqe_xri_aborted {
  284. uint32_t word0;
  285. #define lpfc_wcqe_xa_status_SHIFT 8
  286. #define lpfc_wcqe_xa_status_MASK 0x000000FF
  287. #define lpfc_wcqe_xa_status_WORD word0
  288. uint32_t parameter;
  289. uint32_t word2;
  290. #define lpfc_wcqe_xa_remote_xid_SHIFT 16
  291. #define lpfc_wcqe_xa_remote_xid_MASK 0x0000FFFF
  292. #define lpfc_wcqe_xa_remote_xid_WORD word2
  293. #define lpfc_wcqe_xa_xri_SHIFT 0
  294. #define lpfc_wcqe_xa_xri_MASK 0x0000FFFF
  295. #define lpfc_wcqe_xa_xri_WORD word2
  296. uint32_t word3;
  297. #define lpfc_wcqe_xa_valid_SHIFT lpfc_cqe_valid_SHIFT
  298. #define lpfc_wcqe_xa_valid_MASK lpfc_cqe_valid_MASK
  299. #define lpfc_wcqe_xa_valid_WORD lpfc_cqe_valid_WORD
  300. #define lpfc_wcqe_xa_ia_SHIFT 30
  301. #define lpfc_wcqe_xa_ia_MASK 0x00000001
  302. #define lpfc_wcqe_xa_ia_WORD word3
  303. #define CQE_XRI_ABORTED_IA_REMOTE 0
  304. #define CQE_XRI_ABORTED_IA_LOCAL 1
  305. #define lpfc_wcqe_xa_br_SHIFT 29
  306. #define lpfc_wcqe_xa_br_MASK 0x00000001
  307. #define lpfc_wcqe_xa_br_WORD word3
  308. #define CQE_XRI_ABORTED_BR_BA_ACC 0
  309. #define CQE_XRI_ABORTED_BR_BA_RJT 1
  310. #define lpfc_wcqe_xa_eo_SHIFT 28
  311. #define lpfc_wcqe_xa_eo_MASK 0x00000001
  312. #define lpfc_wcqe_xa_eo_WORD word3
  313. #define CQE_XRI_ABORTED_EO_REMOTE 0
  314. #define CQE_XRI_ABORTED_EO_LOCAL 1
  315. #define lpfc_wcqe_xa_code_SHIFT lpfc_cqe_code_SHIFT
  316. #define lpfc_wcqe_xa_code_MASK lpfc_cqe_code_MASK
  317. #define lpfc_wcqe_xa_code_WORD lpfc_cqe_code_WORD
  318. };
  319. /* completion queue entry structure for rqe completion */
  320. struct lpfc_rcqe {
  321. uint32_t word0;
  322. #define lpfc_rcqe_bindex_SHIFT 16
  323. #define lpfc_rcqe_bindex_MASK 0x0000FFF
  324. #define lpfc_rcqe_bindex_WORD word0
  325. #define lpfc_rcqe_status_SHIFT 8
  326. #define lpfc_rcqe_status_MASK 0x000000FF
  327. #define lpfc_rcqe_status_WORD word0
  328. #define FC_STATUS_RQ_SUCCESS 0x10 /* Async receive successful */
  329. #define FC_STATUS_RQ_BUF_LEN_EXCEEDED 0x11 /* payload truncated */
  330. #define FC_STATUS_INSUFF_BUF_NEED_BUF 0x12 /* Insufficient buffers */
  331. #define FC_STATUS_INSUFF_BUF_FRM_DISC 0x13 /* Frame Discard */
  332. uint32_t reserved1;
  333. uint32_t word2;
  334. #define lpfc_rcqe_length_SHIFT 16
  335. #define lpfc_rcqe_length_MASK 0x0000FFFF
  336. #define lpfc_rcqe_length_WORD word2
  337. #define lpfc_rcqe_rq_id_SHIFT 6
  338. #define lpfc_rcqe_rq_id_MASK 0x000003FF
  339. #define lpfc_rcqe_rq_id_WORD word2
  340. #define lpfc_rcqe_fcf_id_SHIFT 0
  341. #define lpfc_rcqe_fcf_id_MASK 0x0000003F
  342. #define lpfc_rcqe_fcf_id_WORD word2
  343. uint32_t word3;
  344. #define lpfc_rcqe_valid_SHIFT lpfc_cqe_valid_SHIFT
  345. #define lpfc_rcqe_valid_MASK lpfc_cqe_valid_MASK
  346. #define lpfc_rcqe_valid_WORD lpfc_cqe_valid_WORD
  347. #define lpfc_rcqe_port_SHIFT 30
  348. #define lpfc_rcqe_port_MASK 0x00000001
  349. #define lpfc_rcqe_port_WORD word3
  350. #define lpfc_rcqe_hdr_length_SHIFT 24
  351. #define lpfc_rcqe_hdr_length_MASK 0x0000001F
  352. #define lpfc_rcqe_hdr_length_WORD word3
  353. #define lpfc_rcqe_code_SHIFT lpfc_cqe_code_SHIFT
  354. #define lpfc_rcqe_code_MASK lpfc_cqe_code_MASK
  355. #define lpfc_rcqe_code_WORD lpfc_cqe_code_WORD
  356. #define lpfc_rcqe_eof_SHIFT 8
  357. #define lpfc_rcqe_eof_MASK 0x000000FF
  358. #define lpfc_rcqe_eof_WORD word3
  359. #define FCOE_EOFn 0x41
  360. #define FCOE_EOFt 0x42
  361. #define FCOE_EOFni 0x49
  362. #define FCOE_EOFa 0x50
  363. #define lpfc_rcqe_sof_SHIFT 0
  364. #define lpfc_rcqe_sof_MASK 0x000000FF
  365. #define lpfc_rcqe_sof_WORD word3
  366. #define FCOE_SOFi2 0x2d
  367. #define FCOE_SOFi3 0x2e
  368. #define FCOE_SOFn2 0x35
  369. #define FCOE_SOFn3 0x36
  370. };
  371. struct lpfc_wqe_generic{
  372. struct ulp_bde64 bde;
  373. uint32_t word3;
  374. uint32_t word4;
  375. uint32_t word5;
  376. uint32_t word6;
  377. #define lpfc_wqe_gen_context_SHIFT 16
  378. #define lpfc_wqe_gen_context_MASK 0x0000FFFF
  379. #define lpfc_wqe_gen_context_WORD word6
  380. #define lpfc_wqe_gen_xri_SHIFT 0
  381. #define lpfc_wqe_gen_xri_MASK 0x0000FFFF
  382. #define lpfc_wqe_gen_xri_WORD word6
  383. uint32_t word7;
  384. #define lpfc_wqe_gen_lnk_SHIFT 23
  385. #define lpfc_wqe_gen_lnk_MASK 0x00000001
  386. #define lpfc_wqe_gen_lnk_WORD word7
  387. #define lpfc_wqe_gen_erp_SHIFT 22
  388. #define lpfc_wqe_gen_erp_MASK 0x00000001
  389. #define lpfc_wqe_gen_erp_WORD word7
  390. #define lpfc_wqe_gen_pu_SHIFT 20
  391. #define lpfc_wqe_gen_pu_MASK 0x00000003
  392. #define lpfc_wqe_gen_pu_WORD word7
  393. #define lpfc_wqe_gen_class_SHIFT 16
  394. #define lpfc_wqe_gen_class_MASK 0x00000007
  395. #define lpfc_wqe_gen_class_WORD word7
  396. #define lpfc_wqe_gen_command_SHIFT 8
  397. #define lpfc_wqe_gen_command_MASK 0x000000FF
  398. #define lpfc_wqe_gen_command_WORD word7
  399. #define lpfc_wqe_gen_status_SHIFT 4
  400. #define lpfc_wqe_gen_status_MASK 0x0000000F
  401. #define lpfc_wqe_gen_status_WORD word7
  402. #define lpfc_wqe_gen_ct_SHIFT 2
  403. #define lpfc_wqe_gen_ct_MASK 0x00000003
  404. #define lpfc_wqe_gen_ct_WORD word7
  405. uint32_t abort_tag;
  406. uint32_t word9;
  407. #define lpfc_wqe_gen_request_tag_SHIFT 0
  408. #define lpfc_wqe_gen_request_tag_MASK 0x0000FFFF
  409. #define lpfc_wqe_gen_request_tag_WORD word9
  410. uint32_t word10;
  411. #define lpfc_wqe_gen_ccp_SHIFT 24
  412. #define lpfc_wqe_gen_ccp_MASK 0x000000FF
  413. #define lpfc_wqe_gen_ccp_WORD word10
  414. #define lpfc_wqe_gen_ccpe_SHIFT 23
  415. #define lpfc_wqe_gen_ccpe_MASK 0x00000001
  416. #define lpfc_wqe_gen_ccpe_WORD word10
  417. #define lpfc_wqe_gen_pv_SHIFT 19
  418. #define lpfc_wqe_gen_pv_MASK 0x00000001
  419. #define lpfc_wqe_gen_pv_WORD word10
  420. #define lpfc_wqe_gen_pri_SHIFT 16
  421. #define lpfc_wqe_gen_pri_MASK 0x00000007
  422. #define lpfc_wqe_gen_pri_WORD word10
  423. uint32_t word11;
  424. #define lpfc_wqe_gen_cq_id_SHIFT 16
  425. #define lpfc_wqe_gen_cq_id_MASK 0x0000FFFF
  426. #define lpfc_wqe_gen_cq_id_WORD word11
  427. #define LPFC_WQE_CQ_ID_DEFAULT 0xffff
  428. #define lpfc_wqe_gen_wqec_SHIFT 7
  429. #define lpfc_wqe_gen_wqec_MASK 0x00000001
  430. #define lpfc_wqe_gen_wqec_WORD word11
  431. #define lpfc_wqe_gen_cmd_type_SHIFT 0
  432. #define lpfc_wqe_gen_cmd_type_MASK 0x0000000F
  433. #define lpfc_wqe_gen_cmd_type_WORD word11
  434. uint32_t payload[4];
  435. };
  436. struct lpfc_rqe {
  437. uint32_t address_hi;
  438. uint32_t address_lo;
  439. };
  440. /* buffer descriptors */
  441. struct lpfc_bde4 {
  442. uint32_t addr_hi;
  443. uint32_t addr_lo;
  444. uint32_t word2;
  445. #define lpfc_bde4_last_SHIFT 31
  446. #define lpfc_bde4_last_MASK 0x00000001
  447. #define lpfc_bde4_last_WORD word2
  448. #define lpfc_bde4_sge_offset_SHIFT 0
  449. #define lpfc_bde4_sge_offset_MASK 0x000003FF
  450. #define lpfc_bde4_sge_offset_WORD word2
  451. uint32_t word3;
  452. #define lpfc_bde4_length_SHIFT 0
  453. #define lpfc_bde4_length_MASK 0x000000FF
  454. #define lpfc_bde4_length_WORD word3
  455. };
  456. struct lpfc_register {
  457. uint32_t word0;
  458. };
  459. #define LPFC_UERR_STATUS_HI 0x00A4
  460. #define LPFC_UERR_STATUS_LO 0x00A0
  461. #define LPFC_ONLINE0 0x00B0
  462. #define LPFC_ONLINE1 0x00B4
  463. #define LPFC_SCRATCHPAD 0x0058
  464. /* BAR0 Registers */
  465. #define LPFC_HST_STATE 0x00AC
  466. #define lpfc_hst_state_perr_SHIFT 31
  467. #define lpfc_hst_state_perr_MASK 0x1
  468. #define lpfc_hst_state_perr_WORD word0
  469. #define lpfc_hst_state_sfi_SHIFT 30
  470. #define lpfc_hst_state_sfi_MASK 0x1
  471. #define lpfc_hst_state_sfi_WORD word0
  472. #define lpfc_hst_state_nip_SHIFT 29
  473. #define lpfc_hst_state_nip_MASK 0x1
  474. #define lpfc_hst_state_nip_WORD word0
  475. #define lpfc_hst_state_ipc_SHIFT 28
  476. #define lpfc_hst_state_ipc_MASK 0x1
  477. #define lpfc_hst_state_ipc_WORD word0
  478. #define lpfc_hst_state_xrom_SHIFT 27
  479. #define lpfc_hst_state_xrom_MASK 0x1
  480. #define lpfc_hst_state_xrom_WORD word0
  481. #define lpfc_hst_state_dl_SHIFT 26
  482. #define lpfc_hst_state_dl_MASK 0x1
  483. #define lpfc_hst_state_dl_WORD word0
  484. #define lpfc_hst_state_port_status_SHIFT 0
  485. #define lpfc_hst_state_port_status_MASK 0xFFFF
  486. #define lpfc_hst_state_port_status_WORD word0
  487. #define LPFC_POST_STAGE_POWER_ON_RESET 0x0000
  488. #define LPFC_POST_STAGE_AWAITING_HOST_RDY 0x0001
  489. #define LPFC_POST_STAGE_HOST_RDY 0x0002
  490. #define LPFC_POST_STAGE_BE_RESET 0x0003
  491. #define LPFC_POST_STAGE_SEEPROM_CS_START 0x0100
  492. #define LPFC_POST_STAGE_SEEPROM_CS_DONE 0x0101
  493. #define LPFC_POST_STAGE_DDR_CONFIG_START 0x0200
  494. #define LPFC_POST_STAGE_DDR_CONFIG_DONE 0x0201
  495. #define LPFC_POST_STAGE_DDR_CALIBRATE_START 0x0300
  496. #define LPFC_POST_STAGE_DDR_CALIBRATE_DONE 0x0301
  497. #define LPFC_POST_STAGE_DDR_TEST_START 0x0400
  498. #define LPFC_POST_STAGE_DDR_TEST_DONE 0x0401
  499. #define LPFC_POST_STAGE_REDBOOT_INIT_START 0x0600
  500. #define LPFC_POST_STAGE_REDBOOT_INIT_DONE 0x0601
  501. #define LPFC_POST_STAGE_FW_IMAGE_LOAD_START 0x0700
  502. #define LPFC_POST_STAGE_FW_IMAGE_LOAD_DONE 0x0701
  503. #define LPFC_POST_STAGE_ARMFW_START 0x0800
  504. #define LPFC_POST_STAGE_DHCP_QUERY_START 0x0900
  505. #define LPFC_POST_STAGE_DHCP_QUERY_DONE 0x0901
  506. #define LPFC_POST_STAGE_BOOT_TARGET_DISCOVERY_START 0x0A00
  507. #define LPFC_POST_STAGE_BOOT_TARGET_DISCOVERY_DONE 0x0A01
  508. #define LPFC_POST_STAGE_RC_OPTION_SET 0x0B00
  509. #define LPFC_POST_STAGE_SWITCH_LINK 0x0B01
  510. #define LPFC_POST_STAGE_SEND_ICDS_MESSAGE 0x0B02
  511. #define LPFC_POST_STAGE_PERFROM_TFTP 0x0B03
  512. #define LPFC_POST_STAGE_PARSE_XML 0x0B04
  513. #define LPFC_POST_STAGE_DOWNLOAD_IMAGE 0x0B05
  514. #define LPFC_POST_STAGE_FLASH_IMAGE 0x0B06
  515. #define LPFC_POST_STAGE_RC_DONE 0x0B07
  516. #define LPFC_POST_STAGE_REBOOT_SYSTEM 0x0B08
  517. #define LPFC_POST_STAGE_MAC_ADDRESS 0x0C00
  518. #define LPFC_POST_STAGE_ARMFW_READY 0xC000
  519. #define LPFC_POST_STAGE_ARMFW_UE 0xF000
  520. #define lpfc_scratchpad_slirev_SHIFT 4
  521. #define lpfc_scratchpad_slirev_MASK 0xF
  522. #define lpfc_scratchpad_slirev_WORD word0
  523. #define lpfc_scratchpad_chiptype_SHIFT 8
  524. #define lpfc_scratchpad_chiptype_MASK 0xFF
  525. #define lpfc_scratchpad_chiptype_WORD word0
  526. #define lpfc_scratchpad_featurelevel1_SHIFT 16
  527. #define lpfc_scratchpad_featurelevel1_MASK 0xFF
  528. #define lpfc_scratchpad_featurelevel1_WORD word0
  529. #define lpfc_scratchpad_featurelevel2_SHIFT 24
  530. #define lpfc_scratchpad_featurelevel2_MASK 0xFF
  531. #define lpfc_scratchpad_featurelevel2_WORD word0
  532. /* BAR1 Registers */
  533. #define LPFC_IMR_MASK_ALL 0xFFFFFFFF
  534. #define LPFC_ISCR_CLEAR_ALL 0xFFFFFFFF
  535. #define LPFC_HST_ISR0 0x0C18
  536. #define LPFC_HST_ISR1 0x0C1C
  537. #define LPFC_HST_ISR2 0x0C20
  538. #define LPFC_HST_ISR3 0x0C24
  539. #define LPFC_HST_ISR4 0x0C28
  540. #define LPFC_HST_IMR0 0x0C48
  541. #define LPFC_HST_IMR1 0x0C4C
  542. #define LPFC_HST_IMR2 0x0C50
  543. #define LPFC_HST_IMR3 0x0C54
  544. #define LPFC_HST_IMR4 0x0C58
  545. #define LPFC_HST_ISCR0 0x0C78
  546. #define LPFC_HST_ISCR1 0x0C7C
  547. #define LPFC_HST_ISCR2 0x0C80
  548. #define LPFC_HST_ISCR3 0x0C84
  549. #define LPFC_HST_ISCR4 0x0C88
  550. #define LPFC_SLI4_INTR0 BIT0
  551. #define LPFC_SLI4_INTR1 BIT1
  552. #define LPFC_SLI4_INTR2 BIT2
  553. #define LPFC_SLI4_INTR3 BIT3
  554. #define LPFC_SLI4_INTR4 BIT4
  555. #define LPFC_SLI4_INTR5 BIT5
  556. #define LPFC_SLI4_INTR6 BIT6
  557. #define LPFC_SLI4_INTR7 BIT7
  558. #define LPFC_SLI4_INTR8 BIT8
  559. #define LPFC_SLI4_INTR9 BIT9
  560. #define LPFC_SLI4_INTR10 BIT10
  561. #define LPFC_SLI4_INTR11 BIT11
  562. #define LPFC_SLI4_INTR12 BIT12
  563. #define LPFC_SLI4_INTR13 BIT13
  564. #define LPFC_SLI4_INTR14 BIT14
  565. #define LPFC_SLI4_INTR15 BIT15
  566. #define LPFC_SLI4_INTR16 BIT16
  567. #define LPFC_SLI4_INTR17 BIT17
  568. #define LPFC_SLI4_INTR18 BIT18
  569. #define LPFC_SLI4_INTR19 BIT19
  570. #define LPFC_SLI4_INTR20 BIT20
  571. #define LPFC_SLI4_INTR21 BIT21
  572. #define LPFC_SLI4_INTR22 BIT22
  573. #define LPFC_SLI4_INTR23 BIT23
  574. #define LPFC_SLI4_INTR24 BIT24
  575. #define LPFC_SLI4_INTR25 BIT25
  576. #define LPFC_SLI4_INTR26 BIT26
  577. #define LPFC_SLI4_INTR27 BIT27
  578. #define LPFC_SLI4_INTR28 BIT28
  579. #define LPFC_SLI4_INTR29 BIT29
  580. #define LPFC_SLI4_INTR30 BIT30
  581. #define LPFC_SLI4_INTR31 BIT31
  582. /* BAR2 Registers */
  583. #define LPFC_RQ_DOORBELL 0x00A0
  584. #define lpfc_rq_doorbell_num_posted_SHIFT 16
  585. #define lpfc_rq_doorbell_num_posted_MASK 0x3FFF
  586. #define lpfc_rq_doorbell_num_posted_WORD word0
  587. #define LPFC_RQ_POST_BATCH 8 /* RQEs to post at one time */
  588. #define lpfc_rq_doorbell_id_SHIFT 0
  589. #define lpfc_rq_doorbell_id_MASK 0x03FF
  590. #define lpfc_rq_doorbell_id_WORD word0
  591. #define LPFC_WQ_DOORBELL 0x0040
  592. #define lpfc_wq_doorbell_num_posted_SHIFT 24
  593. #define lpfc_wq_doorbell_num_posted_MASK 0x00FF
  594. #define lpfc_wq_doorbell_num_posted_WORD word0
  595. #define lpfc_wq_doorbell_index_SHIFT 16
  596. #define lpfc_wq_doorbell_index_MASK 0x00FF
  597. #define lpfc_wq_doorbell_index_WORD word0
  598. #define lpfc_wq_doorbell_id_SHIFT 0
  599. #define lpfc_wq_doorbell_id_MASK 0xFFFF
  600. #define lpfc_wq_doorbell_id_WORD word0
  601. #define LPFC_EQCQ_DOORBELL 0x0120
  602. #define lpfc_eqcq_doorbell_arm_SHIFT 29
  603. #define lpfc_eqcq_doorbell_arm_MASK 0x0001
  604. #define lpfc_eqcq_doorbell_arm_WORD word0
  605. #define lpfc_eqcq_doorbell_num_released_SHIFT 16
  606. #define lpfc_eqcq_doorbell_num_released_MASK 0x1FFF
  607. #define lpfc_eqcq_doorbell_num_released_WORD word0
  608. #define lpfc_eqcq_doorbell_qt_SHIFT 10
  609. #define lpfc_eqcq_doorbell_qt_MASK 0x0001
  610. #define lpfc_eqcq_doorbell_qt_WORD word0
  611. #define LPFC_QUEUE_TYPE_COMPLETION 0
  612. #define LPFC_QUEUE_TYPE_EVENT 1
  613. #define lpfc_eqcq_doorbell_eqci_SHIFT 9
  614. #define lpfc_eqcq_doorbell_eqci_MASK 0x0001
  615. #define lpfc_eqcq_doorbell_eqci_WORD word0
  616. #define lpfc_eqcq_doorbell_cqid_SHIFT 0
  617. #define lpfc_eqcq_doorbell_cqid_MASK 0x03FF
  618. #define lpfc_eqcq_doorbell_cqid_WORD word0
  619. #define lpfc_eqcq_doorbell_eqid_SHIFT 0
  620. #define lpfc_eqcq_doorbell_eqid_MASK 0x01FF
  621. #define lpfc_eqcq_doorbell_eqid_WORD word0
  622. #define LPFC_BMBX 0x0160
  623. #define lpfc_bmbx_addr_SHIFT 2
  624. #define lpfc_bmbx_addr_MASK 0x3FFFFFFF
  625. #define lpfc_bmbx_addr_WORD word0
  626. #define lpfc_bmbx_hi_SHIFT 1
  627. #define lpfc_bmbx_hi_MASK 0x0001
  628. #define lpfc_bmbx_hi_WORD word0
  629. #define lpfc_bmbx_rdy_SHIFT 0
  630. #define lpfc_bmbx_rdy_MASK 0x0001
  631. #define lpfc_bmbx_rdy_WORD word0
  632. #define LPFC_MQ_DOORBELL 0x0140
  633. #define lpfc_mq_doorbell_num_posted_SHIFT 16
  634. #define lpfc_mq_doorbell_num_posted_MASK 0x3FFF
  635. #define lpfc_mq_doorbell_num_posted_WORD word0
  636. #define lpfc_mq_doorbell_id_SHIFT 0
  637. #define lpfc_mq_doorbell_id_MASK 0x03FF
  638. #define lpfc_mq_doorbell_id_WORD word0
  639. struct lpfc_sli4_cfg_mhdr {
  640. uint32_t word1;
  641. #define lpfc_mbox_hdr_emb_SHIFT 0
  642. #define lpfc_mbox_hdr_emb_MASK 0x00000001
  643. #define lpfc_mbox_hdr_emb_WORD word1
  644. #define lpfc_mbox_hdr_sge_cnt_SHIFT 3
  645. #define lpfc_mbox_hdr_sge_cnt_MASK 0x0000001F
  646. #define lpfc_mbox_hdr_sge_cnt_WORD word1
  647. uint32_t payload_length;
  648. uint32_t tag_lo;
  649. uint32_t tag_hi;
  650. uint32_t reserved5;
  651. };
  652. union lpfc_sli4_cfg_shdr {
  653. struct {
  654. uint32_t word6;
  655. #define lpfc_mbox_hdr_opcode_SHIFT 0
  656. #define lpfc_mbox_hdr_opcode_MASK 0x000000FF
  657. #define lpfc_mbox_hdr_opcode_WORD word6
  658. #define lpfc_mbox_hdr_subsystem_SHIFT 8
  659. #define lpfc_mbox_hdr_subsystem_MASK 0x000000FF
  660. #define lpfc_mbox_hdr_subsystem_WORD word6
  661. #define lpfc_mbox_hdr_port_number_SHIFT 16
  662. #define lpfc_mbox_hdr_port_number_MASK 0x000000FF
  663. #define lpfc_mbox_hdr_port_number_WORD word6
  664. #define lpfc_mbox_hdr_domain_SHIFT 24
  665. #define lpfc_mbox_hdr_domain_MASK 0x000000FF
  666. #define lpfc_mbox_hdr_domain_WORD word6
  667. uint32_t timeout;
  668. uint32_t request_length;
  669. uint32_t reserved9;
  670. } request;
  671. struct {
  672. uint32_t word6;
  673. #define lpfc_mbox_hdr_opcode_SHIFT 0
  674. #define lpfc_mbox_hdr_opcode_MASK 0x000000FF
  675. #define lpfc_mbox_hdr_opcode_WORD word6
  676. #define lpfc_mbox_hdr_subsystem_SHIFT 8
  677. #define lpfc_mbox_hdr_subsystem_MASK 0x000000FF
  678. #define lpfc_mbox_hdr_subsystem_WORD word6
  679. #define lpfc_mbox_hdr_domain_SHIFT 24
  680. #define lpfc_mbox_hdr_domain_MASK 0x000000FF
  681. #define lpfc_mbox_hdr_domain_WORD word6
  682. uint32_t word7;
  683. #define lpfc_mbox_hdr_status_SHIFT 0
  684. #define lpfc_mbox_hdr_status_MASK 0x000000FF
  685. #define lpfc_mbox_hdr_status_WORD word7
  686. #define lpfc_mbox_hdr_add_status_SHIFT 8
  687. #define lpfc_mbox_hdr_add_status_MASK 0x000000FF
  688. #define lpfc_mbox_hdr_add_status_WORD word7
  689. uint32_t response_length;
  690. uint32_t actual_response_length;
  691. } response;
  692. };
  693. /* Mailbox structures */
  694. struct mbox_header {
  695. struct lpfc_sli4_cfg_mhdr cfg_mhdr;
  696. union lpfc_sli4_cfg_shdr cfg_shdr;
  697. };
  698. /* Subsystem Definitions */
  699. #define LPFC_MBOX_SUBSYSTEM_COMMON 0x1
  700. #define LPFC_MBOX_SUBSYSTEM_FCOE 0xC
  701. /* Device Specific Definitions */
  702. /* The HOST ENDIAN defines are in Big Endian format. */
  703. #define HOST_ENDIAN_LOW_WORD0 0xFF3412FF
  704. #define HOST_ENDIAN_HIGH_WORD1 0xFF7856FF
  705. /* Common Opcodes */
  706. #define LPFC_MBOX_OPCODE_CQ_CREATE 0x0C
  707. #define LPFC_MBOX_OPCODE_EQ_CREATE 0x0D
  708. #define LPFC_MBOX_OPCODE_MQ_CREATE 0x15
  709. #define LPFC_MBOX_OPCODE_GET_CNTL_ATTRIBUTES 0x20
  710. #define LPFC_MBOX_OPCODE_NOP 0x21
  711. #define LPFC_MBOX_OPCODE_MQ_DESTROY 0x35
  712. #define LPFC_MBOX_OPCODE_CQ_DESTROY 0x36
  713. #define LPFC_MBOX_OPCODE_EQ_DESTROY 0x37
  714. #define LPFC_MBOX_OPCODE_QUERY_FW_CFG 0x3A
  715. #define LPFC_MBOX_OPCODE_FUNCTION_RESET 0x3D
  716. /* FCoE Opcodes */
  717. #define LPFC_MBOX_OPCODE_FCOE_WQ_CREATE 0x01
  718. #define LPFC_MBOX_OPCODE_FCOE_WQ_DESTROY 0x02
  719. #define LPFC_MBOX_OPCODE_FCOE_POST_SGL_PAGES 0x03
  720. #define LPFC_MBOX_OPCODE_FCOE_REMOVE_SGL_PAGES 0x04
  721. #define LPFC_MBOX_OPCODE_FCOE_RQ_CREATE 0x05
  722. #define LPFC_MBOX_OPCODE_FCOE_RQ_DESTROY 0x06
  723. #define LPFC_MBOX_OPCODE_FCOE_READ_FCF_TABLE 0x08
  724. #define LPFC_MBOX_OPCODE_FCOE_ADD_FCF 0x09
  725. #define LPFC_MBOX_OPCODE_FCOE_DELETE_FCF 0x0A
  726. #define LPFC_MBOX_OPCODE_FCOE_POST_HDR_TEMPLATE 0x0B
  727. /* Mailbox command structures */
  728. struct eq_context {
  729. uint32_t word0;
  730. #define lpfc_eq_context_size_SHIFT 31
  731. #define lpfc_eq_context_size_MASK 0x00000001
  732. #define lpfc_eq_context_size_WORD word0
  733. #define LPFC_EQE_SIZE_4 0x0
  734. #define LPFC_EQE_SIZE_16 0x1
  735. #define lpfc_eq_context_valid_SHIFT 29
  736. #define lpfc_eq_context_valid_MASK 0x00000001
  737. #define lpfc_eq_context_valid_WORD word0
  738. uint32_t word1;
  739. #define lpfc_eq_context_count_SHIFT 26
  740. #define lpfc_eq_context_count_MASK 0x00000003
  741. #define lpfc_eq_context_count_WORD word1
  742. #define LPFC_EQ_CNT_256 0x0
  743. #define LPFC_EQ_CNT_512 0x1
  744. #define LPFC_EQ_CNT_1024 0x2
  745. #define LPFC_EQ_CNT_2048 0x3
  746. #define LPFC_EQ_CNT_4096 0x4
  747. uint32_t word2;
  748. #define lpfc_eq_context_delay_multi_SHIFT 13
  749. #define lpfc_eq_context_delay_multi_MASK 0x000003FF
  750. #define lpfc_eq_context_delay_multi_WORD word2
  751. uint32_t reserved3;
  752. };
  753. struct sgl_page_pairs {
  754. uint32_t sgl_pg0_addr_lo;
  755. uint32_t sgl_pg0_addr_hi;
  756. uint32_t sgl_pg1_addr_lo;
  757. uint32_t sgl_pg1_addr_hi;
  758. };
  759. struct lpfc_mbx_post_sgl_pages {
  760. struct mbox_header header;
  761. uint32_t word0;
  762. #define lpfc_post_sgl_pages_xri_SHIFT 0
  763. #define lpfc_post_sgl_pages_xri_MASK 0x0000FFFF
  764. #define lpfc_post_sgl_pages_xri_WORD word0
  765. #define lpfc_post_sgl_pages_xricnt_SHIFT 16
  766. #define lpfc_post_sgl_pages_xricnt_MASK 0x0000FFFF
  767. #define lpfc_post_sgl_pages_xricnt_WORD word0
  768. struct sgl_page_pairs sgl_pg_pairs[1];
  769. };
  770. /* word0 of page-1 struct shares the same SHIFT/MASK/WORD defines as above */
  771. struct lpfc_mbx_post_uembed_sgl_page1 {
  772. union lpfc_sli4_cfg_shdr cfg_shdr;
  773. uint32_t word0;
  774. struct sgl_page_pairs sgl_pg_pairs;
  775. };
  776. struct lpfc_mbx_sge {
  777. uint32_t pa_lo;
  778. uint32_t pa_hi;
  779. uint32_t length;
  780. };
  781. struct lpfc_mbx_nembed_cmd {
  782. struct lpfc_sli4_cfg_mhdr cfg_mhdr;
  783. #define LPFC_SLI4_MBX_SGE_MAX_PAGES 19
  784. struct lpfc_mbx_sge sge[LPFC_SLI4_MBX_SGE_MAX_PAGES];
  785. };
  786. struct lpfc_mbx_nembed_sge_virt {
  787. void *addr[LPFC_SLI4_MBX_SGE_MAX_PAGES];
  788. };
  789. struct lpfc_mbx_eq_create {
  790. struct mbox_header header;
  791. union {
  792. struct {
  793. uint32_t word0;
  794. #define lpfc_mbx_eq_create_num_pages_SHIFT 0
  795. #define lpfc_mbx_eq_create_num_pages_MASK 0x0000FFFF
  796. #define lpfc_mbx_eq_create_num_pages_WORD word0
  797. struct eq_context context;
  798. struct dma_address page[LPFC_MAX_EQ_PAGE];
  799. } request;
  800. struct {
  801. uint32_t word0;
  802. #define lpfc_mbx_eq_create_q_id_SHIFT 0
  803. #define lpfc_mbx_eq_create_q_id_MASK 0x0000FFFF
  804. #define lpfc_mbx_eq_create_q_id_WORD word0
  805. } response;
  806. } u;
  807. };
  808. struct lpfc_mbx_eq_destroy {
  809. struct mbox_header header;
  810. union {
  811. struct {
  812. uint32_t word0;
  813. #define lpfc_mbx_eq_destroy_q_id_SHIFT 0
  814. #define lpfc_mbx_eq_destroy_q_id_MASK 0x0000FFFF
  815. #define lpfc_mbx_eq_destroy_q_id_WORD word0
  816. } request;
  817. struct {
  818. uint32_t word0;
  819. } response;
  820. } u;
  821. };
  822. struct lpfc_mbx_nop {
  823. struct mbox_header header;
  824. uint32_t context[2];
  825. };
  826. struct cq_context {
  827. uint32_t word0;
  828. #define lpfc_cq_context_event_SHIFT 31
  829. #define lpfc_cq_context_event_MASK 0x00000001
  830. #define lpfc_cq_context_event_WORD word0
  831. #define lpfc_cq_context_valid_SHIFT 29
  832. #define lpfc_cq_context_valid_MASK 0x00000001
  833. #define lpfc_cq_context_valid_WORD word0
  834. #define lpfc_cq_context_count_SHIFT 27
  835. #define lpfc_cq_context_count_MASK 0x00000003
  836. #define lpfc_cq_context_count_WORD word0
  837. #define LPFC_CQ_CNT_256 0x0
  838. #define LPFC_CQ_CNT_512 0x1
  839. #define LPFC_CQ_CNT_1024 0x2
  840. uint32_t word1;
  841. #define lpfc_cq_eq_id_SHIFT 22
  842. #define lpfc_cq_eq_id_MASK 0x000000FF
  843. #define lpfc_cq_eq_id_WORD word1
  844. uint32_t reserved0;
  845. uint32_t reserved1;
  846. };
  847. struct lpfc_mbx_cq_create {
  848. struct mbox_header header;
  849. union {
  850. struct {
  851. uint32_t word0;
  852. #define lpfc_mbx_cq_create_num_pages_SHIFT 0
  853. #define lpfc_mbx_cq_create_num_pages_MASK 0x0000FFFF
  854. #define lpfc_mbx_cq_create_num_pages_WORD word0
  855. struct cq_context context;
  856. struct dma_address page[LPFC_MAX_CQ_PAGE];
  857. } request;
  858. struct {
  859. uint32_t word0;
  860. #define lpfc_mbx_cq_create_q_id_SHIFT 0
  861. #define lpfc_mbx_cq_create_q_id_MASK 0x0000FFFF
  862. #define lpfc_mbx_cq_create_q_id_WORD word0
  863. } response;
  864. } u;
  865. };
  866. struct lpfc_mbx_cq_destroy {
  867. struct mbox_header header;
  868. union {
  869. struct {
  870. uint32_t word0;
  871. #define lpfc_mbx_cq_destroy_q_id_SHIFT 0
  872. #define lpfc_mbx_cq_destroy_q_id_MASK 0x0000FFFF
  873. #define lpfc_mbx_cq_destroy_q_id_WORD word0
  874. } request;
  875. struct {
  876. uint32_t word0;
  877. } response;
  878. } u;
  879. };
  880. struct wq_context {
  881. uint32_t reserved0;
  882. uint32_t reserved1;
  883. uint32_t reserved2;
  884. uint32_t reserved3;
  885. };
  886. struct lpfc_mbx_wq_create {
  887. struct mbox_header header;
  888. union {
  889. struct {
  890. uint32_t word0;
  891. #define lpfc_mbx_wq_create_num_pages_SHIFT 0
  892. #define lpfc_mbx_wq_create_num_pages_MASK 0x0000FFFF
  893. #define lpfc_mbx_wq_create_num_pages_WORD word0
  894. #define lpfc_mbx_wq_create_cq_id_SHIFT 16
  895. #define lpfc_mbx_wq_create_cq_id_MASK 0x0000FFFF
  896. #define lpfc_mbx_wq_create_cq_id_WORD word0
  897. struct dma_address page[LPFC_MAX_WQ_PAGE];
  898. } request;
  899. struct {
  900. uint32_t word0;
  901. #define lpfc_mbx_wq_create_q_id_SHIFT 0
  902. #define lpfc_mbx_wq_create_q_id_MASK 0x0000FFFF
  903. #define lpfc_mbx_wq_create_q_id_WORD word0
  904. } response;
  905. } u;
  906. };
  907. struct lpfc_mbx_wq_destroy {
  908. struct mbox_header header;
  909. union {
  910. struct {
  911. uint32_t word0;
  912. #define lpfc_mbx_wq_destroy_q_id_SHIFT 0
  913. #define lpfc_mbx_wq_destroy_q_id_MASK 0x0000FFFF
  914. #define lpfc_mbx_wq_destroy_q_id_WORD word0
  915. } request;
  916. struct {
  917. uint32_t word0;
  918. } response;
  919. } u;
  920. };
  921. #define LPFC_HDR_BUF_SIZE 128
  922. #define LPFC_DATA_BUF_SIZE 4096
  923. struct rq_context {
  924. uint32_t word0;
  925. #define lpfc_rq_context_rq_size_SHIFT 16
  926. #define lpfc_rq_context_rq_size_MASK 0x0000000F
  927. #define lpfc_rq_context_rq_size_WORD word0
  928. #define LPFC_RQ_RING_SIZE_512 9 /* 512 entries */
  929. #define LPFC_RQ_RING_SIZE_1024 10 /* 1024 entries */
  930. #define LPFC_RQ_RING_SIZE_2048 11 /* 2048 entries */
  931. #define LPFC_RQ_RING_SIZE_4096 12 /* 4096 entries */
  932. uint32_t reserved1;
  933. uint32_t word2;
  934. #define lpfc_rq_context_cq_id_SHIFT 16
  935. #define lpfc_rq_context_cq_id_MASK 0x000003FF
  936. #define lpfc_rq_context_cq_id_WORD word2
  937. #define lpfc_rq_context_buf_size_SHIFT 0
  938. #define lpfc_rq_context_buf_size_MASK 0x0000FFFF
  939. #define lpfc_rq_context_buf_size_WORD word2
  940. uint32_t reserved3;
  941. };
  942. struct lpfc_mbx_rq_create {
  943. struct mbox_header header;
  944. union {
  945. struct {
  946. uint32_t word0;
  947. #define lpfc_mbx_rq_create_num_pages_SHIFT 0
  948. #define lpfc_mbx_rq_create_num_pages_MASK 0x0000FFFF
  949. #define lpfc_mbx_rq_create_num_pages_WORD word0
  950. struct rq_context context;
  951. struct dma_address page[LPFC_MAX_WQ_PAGE];
  952. } request;
  953. struct {
  954. uint32_t word0;
  955. #define lpfc_mbx_rq_create_q_id_SHIFT 0
  956. #define lpfc_mbx_rq_create_q_id_MASK 0x0000FFFF
  957. #define lpfc_mbx_rq_create_q_id_WORD word0
  958. } response;
  959. } u;
  960. };
  961. struct lpfc_mbx_rq_destroy {
  962. struct mbox_header header;
  963. union {
  964. struct {
  965. uint32_t word0;
  966. #define lpfc_mbx_rq_destroy_q_id_SHIFT 0
  967. #define lpfc_mbx_rq_destroy_q_id_MASK 0x0000FFFF
  968. #define lpfc_mbx_rq_destroy_q_id_WORD word0
  969. } request;
  970. struct {
  971. uint32_t word0;
  972. } response;
  973. } u;
  974. };
  975. struct mq_context {
  976. uint32_t word0;
  977. #define lpfc_mq_context_cq_id_SHIFT 22
  978. #define lpfc_mq_context_cq_id_MASK 0x000003FF
  979. #define lpfc_mq_context_cq_id_WORD word0
  980. #define lpfc_mq_context_count_SHIFT 16
  981. #define lpfc_mq_context_count_MASK 0x0000000F
  982. #define lpfc_mq_context_count_WORD word0
  983. #define LPFC_MQ_CNT_16 0x5
  984. #define LPFC_MQ_CNT_32 0x6
  985. #define LPFC_MQ_CNT_64 0x7
  986. #define LPFC_MQ_CNT_128 0x8
  987. uint32_t word1;
  988. #define lpfc_mq_context_valid_SHIFT 31
  989. #define lpfc_mq_context_valid_MASK 0x00000001
  990. #define lpfc_mq_context_valid_WORD word1
  991. uint32_t reserved2;
  992. uint32_t reserved3;
  993. };
  994. struct lpfc_mbx_mq_create {
  995. struct mbox_header header;
  996. union {
  997. struct {
  998. uint32_t word0;
  999. #define lpfc_mbx_mq_create_num_pages_SHIFT 0
  1000. #define lpfc_mbx_mq_create_num_pages_MASK 0x0000FFFF
  1001. #define lpfc_mbx_mq_create_num_pages_WORD word0
  1002. struct mq_context context;
  1003. struct dma_address page[LPFC_MAX_MQ_PAGE];
  1004. } request;
  1005. struct {
  1006. uint32_t word0;
  1007. #define lpfc_mbx_mq_create_q_id_SHIFT 0
  1008. #define lpfc_mbx_mq_create_q_id_MASK 0x0000FFFF
  1009. #define lpfc_mbx_mq_create_q_id_WORD word0
  1010. } response;
  1011. } u;
  1012. };
  1013. struct lpfc_mbx_mq_destroy {
  1014. struct mbox_header header;
  1015. union {
  1016. struct {
  1017. uint32_t word0;
  1018. #define lpfc_mbx_mq_destroy_q_id_SHIFT 0
  1019. #define lpfc_mbx_mq_destroy_q_id_MASK 0x0000FFFF
  1020. #define lpfc_mbx_mq_destroy_q_id_WORD word0
  1021. } request;
  1022. struct {
  1023. uint32_t word0;
  1024. } response;
  1025. } u;
  1026. };
  1027. struct lpfc_mbx_post_hdr_tmpl {
  1028. struct mbox_header header;
  1029. uint32_t word10;
  1030. #define lpfc_mbx_post_hdr_tmpl_rpi_offset_SHIFT 0
  1031. #define lpfc_mbx_post_hdr_tmpl_rpi_offset_MASK 0x0000FFFF
  1032. #define lpfc_mbx_post_hdr_tmpl_rpi_offset_WORD word10
  1033. #define lpfc_mbx_post_hdr_tmpl_page_cnt_SHIFT 16
  1034. #define lpfc_mbx_post_hdr_tmpl_page_cnt_MASK 0x0000FFFF
  1035. #define lpfc_mbx_post_hdr_tmpl_page_cnt_WORD word10
  1036. uint32_t rpi_paddr_lo;
  1037. uint32_t rpi_paddr_hi;
  1038. };
  1039. struct sli4_sge { /* SLI-4 */
  1040. uint32_t addr_hi;
  1041. uint32_t addr_lo;
  1042. uint32_t word2;
  1043. #define lpfc_sli4_sge_offset_SHIFT 0 /* Offset of buffer - Not used*/
  1044. #define lpfc_sli4_sge_offset_MASK 0x00FFFFFF
  1045. #define lpfc_sli4_sge_offset_WORD word2
  1046. #define lpfc_sli4_sge_last_SHIFT 31 /* Last SEG in the SGL sets
  1047. this flag !! */
  1048. #define lpfc_sli4_sge_last_MASK 0x00000001
  1049. #define lpfc_sli4_sge_last_WORD word2
  1050. uint32_t word3;
  1051. #define lpfc_sli4_sge_len_SHIFT 0
  1052. #define lpfc_sli4_sge_len_MASK 0x0001FFFF
  1053. #define lpfc_sli4_sge_len_WORD word3
  1054. };
  1055. struct fcf_record {
  1056. uint32_t max_rcv_size;
  1057. uint32_t fka_adv_period;
  1058. uint32_t fip_priority;
  1059. uint32_t word3;
  1060. #define lpfc_fcf_record_mac_0_SHIFT 0
  1061. #define lpfc_fcf_record_mac_0_MASK 0x000000FF
  1062. #define lpfc_fcf_record_mac_0_WORD word3
  1063. #define lpfc_fcf_record_mac_1_SHIFT 8
  1064. #define lpfc_fcf_record_mac_1_MASK 0x000000FF
  1065. #define lpfc_fcf_record_mac_1_WORD word3
  1066. #define lpfc_fcf_record_mac_2_SHIFT 16
  1067. #define lpfc_fcf_record_mac_2_MASK 0x000000FF
  1068. #define lpfc_fcf_record_mac_2_WORD word3
  1069. #define lpfc_fcf_record_mac_3_SHIFT 24
  1070. #define lpfc_fcf_record_mac_3_MASK 0x000000FF
  1071. #define lpfc_fcf_record_mac_3_WORD word3
  1072. uint32_t word4;
  1073. #define lpfc_fcf_record_mac_4_SHIFT 0
  1074. #define lpfc_fcf_record_mac_4_MASK 0x000000FF
  1075. #define lpfc_fcf_record_mac_4_WORD word4
  1076. #define lpfc_fcf_record_mac_5_SHIFT 8
  1077. #define lpfc_fcf_record_mac_5_MASK 0x000000FF
  1078. #define lpfc_fcf_record_mac_5_WORD word4
  1079. #define lpfc_fcf_record_fcf_avail_SHIFT 16
  1080. #define lpfc_fcf_record_fcf_avail_MASK 0x000000FF
  1081. #define lpfc_fcf_record_fcf_avail_WORD word4
  1082. #define lpfc_fcf_record_mac_addr_prov_SHIFT 24
  1083. #define lpfc_fcf_record_mac_addr_prov_MASK 0x000000FF
  1084. #define lpfc_fcf_record_mac_addr_prov_WORD word4
  1085. #define LPFC_FCF_FPMA 1 /* Fabric Provided MAC Address */
  1086. #define LPFC_FCF_SPMA 2 /* Server Provided MAC Address */
  1087. uint32_t word5;
  1088. #define lpfc_fcf_record_fab_name_0_SHIFT 0
  1089. #define lpfc_fcf_record_fab_name_0_MASK 0x000000FF
  1090. #define lpfc_fcf_record_fab_name_0_WORD word5
  1091. #define lpfc_fcf_record_fab_name_1_SHIFT 8
  1092. #define lpfc_fcf_record_fab_name_1_MASK 0x000000FF
  1093. #define lpfc_fcf_record_fab_name_1_WORD word5
  1094. #define lpfc_fcf_record_fab_name_2_SHIFT 16
  1095. #define lpfc_fcf_record_fab_name_2_MASK 0x000000FF
  1096. #define lpfc_fcf_record_fab_name_2_WORD word5
  1097. #define lpfc_fcf_record_fab_name_3_SHIFT 24
  1098. #define lpfc_fcf_record_fab_name_3_MASK 0x000000FF
  1099. #define lpfc_fcf_record_fab_name_3_WORD word5
  1100. uint32_t word6;
  1101. #define lpfc_fcf_record_fab_name_4_SHIFT 0
  1102. #define lpfc_fcf_record_fab_name_4_MASK 0x000000FF
  1103. #define lpfc_fcf_record_fab_name_4_WORD word6
  1104. #define lpfc_fcf_record_fab_name_5_SHIFT 8
  1105. #define lpfc_fcf_record_fab_name_5_MASK 0x000000FF
  1106. #define lpfc_fcf_record_fab_name_5_WORD word6
  1107. #define lpfc_fcf_record_fab_name_6_SHIFT 16
  1108. #define lpfc_fcf_record_fab_name_6_MASK 0x000000FF
  1109. #define lpfc_fcf_record_fab_name_6_WORD word6
  1110. #define lpfc_fcf_record_fab_name_7_SHIFT 24
  1111. #define lpfc_fcf_record_fab_name_7_MASK 0x000000FF
  1112. #define lpfc_fcf_record_fab_name_7_WORD word6
  1113. uint32_t word7;
  1114. #define lpfc_fcf_record_fc_map_0_SHIFT 0
  1115. #define lpfc_fcf_record_fc_map_0_MASK 0x000000FF
  1116. #define lpfc_fcf_record_fc_map_0_WORD word7
  1117. #define lpfc_fcf_record_fc_map_1_SHIFT 8
  1118. #define lpfc_fcf_record_fc_map_1_MASK 0x000000FF
  1119. #define lpfc_fcf_record_fc_map_1_WORD word7
  1120. #define lpfc_fcf_record_fc_map_2_SHIFT 16
  1121. #define lpfc_fcf_record_fc_map_2_MASK 0x000000FF
  1122. #define lpfc_fcf_record_fc_map_2_WORD word7
  1123. #define lpfc_fcf_record_fcf_valid_SHIFT 24
  1124. #define lpfc_fcf_record_fcf_valid_MASK 0x000000FF
  1125. #define lpfc_fcf_record_fcf_valid_WORD word7
  1126. uint32_t word8;
  1127. #define lpfc_fcf_record_fcf_index_SHIFT 0
  1128. #define lpfc_fcf_record_fcf_index_MASK 0x0000FFFF
  1129. #define lpfc_fcf_record_fcf_index_WORD word8
  1130. #define lpfc_fcf_record_fcf_state_SHIFT 16
  1131. #define lpfc_fcf_record_fcf_state_MASK 0x0000FFFF
  1132. #define lpfc_fcf_record_fcf_state_WORD word8
  1133. uint8_t vlan_bitmap[512];
  1134. uint32_t word137;
  1135. #define lpfc_fcf_record_switch_name_0_SHIFT 0
  1136. #define lpfc_fcf_record_switch_name_0_MASK 0x000000FF
  1137. #define lpfc_fcf_record_switch_name_0_WORD word137
  1138. #define lpfc_fcf_record_switch_name_1_SHIFT 8
  1139. #define lpfc_fcf_record_switch_name_1_MASK 0x000000FF
  1140. #define lpfc_fcf_record_switch_name_1_WORD word137
  1141. #define lpfc_fcf_record_switch_name_2_SHIFT 16
  1142. #define lpfc_fcf_record_switch_name_2_MASK 0x000000FF
  1143. #define lpfc_fcf_record_switch_name_2_WORD word137
  1144. #define lpfc_fcf_record_switch_name_3_SHIFT 24
  1145. #define lpfc_fcf_record_switch_name_3_MASK 0x000000FF
  1146. #define lpfc_fcf_record_switch_name_3_WORD word137
  1147. uint32_t word138;
  1148. #define lpfc_fcf_record_switch_name_4_SHIFT 0
  1149. #define lpfc_fcf_record_switch_name_4_MASK 0x000000FF
  1150. #define lpfc_fcf_record_switch_name_4_WORD word138
  1151. #define lpfc_fcf_record_switch_name_5_SHIFT 8
  1152. #define lpfc_fcf_record_switch_name_5_MASK 0x000000FF
  1153. #define lpfc_fcf_record_switch_name_5_WORD word138
  1154. #define lpfc_fcf_record_switch_name_6_SHIFT 16
  1155. #define lpfc_fcf_record_switch_name_6_MASK 0x000000FF
  1156. #define lpfc_fcf_record_switch_name_6_WORD word138
  1157. #define lpfc_fcf_record_switch_name_7_SHIFT 24
  1158. #define lpfc_fcf_record_switch_name_7_MASK 0x000000FF
  1159. #define lpfc_fcf_record_switch_name_7_WORD word138
  1160. };
  1161. struct lpfc_mbx_read_fcf_tbl {
  1162. union lpfc_sli4_cfg_shdr cfg_shdr;
  1163. union {
  1164. struct {
  1165. uint32_t word10;
  1166. #define lpfc_mbx_read_fcf_tbl_indx_SHIFT 0
  1167. #define lpfc_mbx_read_fcf_tbl_indx_MASK 0x0000FFFF
  1168. #define lpfc_mbx_read_fcf_tbl_indx_WORD word10
  1169. } request;
  1170. struct {
  1171. uint32_t eventag;
  1172. } response;
  1173. } u;
  1174. uint32_t word11;
  1175. #define lpfc_mbx_read_fcf_tbl_nxt_vindx_SHIFT 0
  1176. #define lpfc_mbx_read_fcf_tbl_nxt_vindx_MASK 0x0000FFFF
  1177. #define lpfc_mbx_read_fcf_tbl_nxt_vindx_WORD word11
  1178. };
  1179. struct lpfc_mbx_add_fcf_tbl_entry {
  1180. union lpfc_sli4_cfg_shdr cfg_shdr;
  1181. uint32_t word10;
  1182. #define lpfc_mbx_add_fcf_tbl_fcfi_SHIFT 0
  1183. #define lpfc_mbx_add_fcf_tbl_fcfi_MASK 0x0000FFFF
  1184. #define lpfc_mbx_add_fcf_tbl_fcfi_WORD word10
  1185. struct lpfc_mbx_sge fcf_sge;
  1186. };
  1187. struct lpfc_mbx_del_fcf_tbl_entry {
  1188. struct mbox_header header;
  1189. uint32_t word10;
  1190. #define lpfc_mbx_del_fcf_tbl_count_SHIFT 0
  1191. #define lpfc_mbx_del_fcf_tbl_count_MASK 0x0000FFFF
  1192. #define lpfc_mbx_del_fcf_tbl_count_WORD word10
  1193. #define lpfc_mbx_del_fcf_tbl_index_SHIFT 16
  1194. #define lpfc_mbx_del_fcf_tbl_index_MASK 0x0000FFFF
  1195. #define lpfc_mbx_del_fcf_tbl_index_WORD word10
  1196. };
  1197. struct lpfc_mbx_query_fw_cfg {
  1198. struct mbox_header header;
  1199. uint32_t config_number;
  1200. uint32_t asic_rev;
  1201. uint32_t phys_port;
  1202. uint32_t function_mode;
  1203. /* firmware Function Mode */
  1204. #define lpfc_function_mode_toe_SHIFT 0
  1205. #define lpfc_function_mode_toe_MASK 0x00000001
  1206. #define lpfc_function_mode_toe_WORD function_mode
  1207. #define lpfc_function_mode_nic_SHIFT 1
  1208. #define lpfc_function_mode_nic_MASK 0x00000001
  1209. #define lpfc_function_mode_nic_WORD function_mode
  1210. #define lpfc_function_mode_rdma_SHIFT 2
  1211. #define lpfc_function_mode_rdma_MASK 0x00000001
  1212. #define lpfc_function_mode_rdma_WORD function_mode
  1213. #define lpfc_function_mode_vm_SHIFT 3
  1214. #define lpfc_function_mode_vm_MASK 0x00000001
  1215. #define lpfc_function_mode_vm_WORD function_mode
  1216. #define lpfc_function_mode_iscsi_i_SHIFT 4
  1217. #define lpfc_function_mode_iscsi_i_MASK 0x00000001
  1218. #define lpfc_function_mode_iscsi_i_WORD function_mode
  1219. #define lpfc_function_mode_iscsi_t_SHIFT 5
  1220. #define lpfc_function_mode_iscsi_t_MASK 0x00000001
  1221. #define lpfc_function_mode_iscsi_t_WORD function_mode
  1222. #define lpfc_function_mode_fcoe_i_SHIFT 6
  1223. #define lpfc_function_mode_fcoe_i_MASK 0x00000001
  1224. #define lpfc_function_mode_fcoe_i_WORD function_mode
  1225. #define lpfc_function_mode_fcoe_t_SHIFT 7
  1226. #define lpfc_function_mode_fcoe_t_MASK 0x00000001
  1227. #define lpfc_function_mode_fcoe_t_WORD function_mode
  1228. #define lpfc_function_mode_dal_SHIFT 8
  1229. #define lpfc_function_mode_dal_MASK 0x00000001
  1230. #define lpfc_function_mode_dal_WORD function_mode
  1231. #define lpfc_function_mode_lro_SHIFT 9
  1232. #define lpfc_function_mode_lro_MASK 0x00000001
  1233. #define lpfc_function_mode_lro_WORD function_mode9
  1234. #define lpfc_function_mode_flex10_SHIFT 10
  1235. #define lpfc_function_mode_flex10_MASK 0x00000001
  1236. #define lpfc_function_mode_flex10_WORD function_mode
  1237. #define lpfc_function_mode_ncsi_SHIFT 11
  1238. #define lpfc_function_mode_ncsi_MASK 0x00000001
  1239. #define lpfc_function_mode_ncsi_WORD function_mode
  1240. };
  1241. /* Status field for embedded SLI_CONFIG mailbox command */
  1242. #define STATUS_SUCCESS 0x0
  1243. #define STATUS_FAILED 0x1
  1244. #define STATUS_ILLEGAL_REQUEST 0x2
  1245. #define STATUS_ILLEGAL_FIELD 0x3
  1246. #define STATUS_INSUFFICIENT_BUFFER 0x4
  1247. #define STATUS_UNAUTHORIZED_REQUEST 0x5
  1248. #define STATUS_FLASHROM_SAVE_FAILED 0x17
  1249. #define STATUS_FLASHROM_RESTORE_FAILED 0x18
  1250. #define STATUS_ICCBINDEX_ALLOC_FAILED 0x1a
  1251. #define STATUS_IOCTLHANDLE_ALLOC_FAILED 0x1b
  1252. #define STATUS_INVALID_PHY_ADDR_FROM_OSM 0x1c
  1253. #define STATUS_INVALID_PHY_ADDR_LEN_FROM_OSM 0x1d
  1254. #define STATUS_ASSERT_FAILED 0x1e
  1255. #define STATUS_INVALID_SESSION 0x1f
  1256. #define STATUS_INVALID_CONNECTION 0x20
  1257. #define STATUS_BTL_PATH_EXCEEDS_OSM_LIMIT 0x21
  1258. #define STATUS_BTL_NO_FREE_SLOT_PATH 0x24
  1259. #define STATUS_BTL_NO_FREE_SLOT_TGTID 0x25
  1260. #define STATUS_OSM_DEVSLOT_NOT_FOUND 0x26
  1261. #define STATUS_FLASHROM_READ_FAILED 0x27
  1262. #define STATUS_POLL_IOCTL_TIMEOUT 0x28
  1263. #define STATUS_ERROR_ACITMAIN 0x2a
  1264. #define STATUS_REBOOT_REQUIRED 0x2c
  1265. #define STATUS_FCF_IN_USE 0x3a
  1266. struct lpfc_mbx_sli4_config {
  1267. struct mbox_header header;
  1268. };
  1269. struct lpfc_mbx_init_vfi {
  1270. uint32_t word1;
  1271. #define lpfc_init_vfi_vr_SHIFT 31
  1272. #define lpfc_init_vfi_vr_MASK 0x00000001
  1273. #define lpfc_init_vfi_vr_WORD word1
  1274. #define lpfc_init_vfi_vt_SHIFT 30
  1275. #define lpfc_init_vfi_vt_MASK 0x00000001
  1276. #define lpfc_init_vfi_vt_WORD word1
  1277. #define lpfc_init_vfi_vf_SHIFT 29
  1278. #define lpfc_init_vfi_vf_MASK 0x00000001
  1279. #define lpfc_init_vfi_vf_WORD word1
  1280. #define lpfc_init_vfi_vfi_SHIFT 0
  1281. #define lpfc_init_vfi_vfi_MASK 0x0000FFFF
  1282. #define lpfc_init_vfi_vfi_WORD word1
  1283. uint32_t word2;
  1284. #define lpfc_init_vfi_fcfi_SHIFT 0
  1285. #define lpfc_init_vfi_fcfi_MASK 0x0000FFFF
  1286. #define lpfc_init_vfi_fcfi_WORD word2
  1287. uint32_t word3;
  1288. #define lpfc_init_vfi_pri_SHIFT 13
  1289. #define lpfc_init_vfi_pri_MASK 0x00000007
  1290. #define lpfc_init_vfi_pri_WORD word3
  1291. #define lpfc_init_vfi_vf_id_SHIFT 1
  1292. #define lpfc_init_vfi_vf_id_MASK 0x00000FFF
  1293. #define lpfc_init_vfi_vf_id_WORD word3
  1294. uint32_t word4;
  1295. #define lpfc_init_vfi_hop_count_SHIFT 24
  1296. #define lpfc_init_vfi_hop_count_MASK 0x000000FF
  1297. #define lpfc_init_vfi_hop_count_WORD word4
  1298. };
  1299. struct lpfc_mbx_reg_vfi {
  1300. uint32_t word1;
  1301. #define lpfc_reg_vfi_vp_SHIFT 28
  1302. #define lpfc_reg_vfi_vp_MASK 0x00000001
  1303. #define lpfc_reg_vfi_vp_WORD word1
  1304. #define lpfc_reg_vfi_vfi_SHIFT 0
  1305. #define lpfc_reg_vfi_vfi_MASK 0x0000FFFF
  1306. #define lpfc_reg_vfi_vfi_WORD word1
  1307. uint32_t word2;
  1308. #define lpfc_reg_vfi_vpi_SHIFT 16
  1309. #define lpfc_reg_vfi_vpi_MASK 0x0000FFFF
  1310. #define lpfc_reg_vfi_vpi_WORD word2
  1311. #define lpfc_reg_vfi_fcfi_SHIFT 0
  1312. #define lpfc_reg_vfi_fcfi_MASK 0x0000FFFF
  1313. #define lpfc_reg_vfi_fcfi_WORD word2
  1314. uint32_t word3_rsvd;
  1315. uint32_t word4_rsvd;
  1316. struct ulp_bde64 bde;
  1317. uint32_t word8_rsvd;
  1318. uint32_t word9_rsvd;
  1319. uint32_t word10;
  1320. #define lpfc_reg_vfi_nport_id_SHIFT 0
  1321. #define lpfc_reg_vfi_nport_id_MASK 0x00FFFFFF
  1322. #define lpfc_reg_vfi_nport_id_WORD word10
  1323. };
  1324. struct lpfc_mbx_init_vpi {
  1325. uint32_t word1;
  1326. #define lpfc_init_vpi_vfi_SHIFT 16
  1327. #define lpfc_init_vpi_vfi_MASK 0x0000FFFF
  1328. #define lpfc_init_vpi_vfi_WORD word1
  1329. #define lpfc_init_vpi_vpi_SHIFT 0
  1330. #define lpfc_init_vpi_vpi_MASK 0x0000FFFF
  1331. #define lpfc_init_vpi_vpi_WORD word1
  1332. };
  1333. struct lpfc_mbx_read_vpi {
  1334. uint32_t word1_rsvd;
  1335. uint32_t word2;
  1336. #define lpfc_mbx_read_vpi_vnportid_SHIFT 0
  1337. #define lpfc_mbx_read_vpi_vnportid_MASK 0x00FFFFFF
  1338. #define lpfc_mbx_read_vpi_vnportid_WORD word2
  1339. uint32_t word3_rsvd;
  1340. uint32_t word4;
  1341. #define lpfc_mbx_read_vpi_acq_alpa_SHIFT 0
  1342. #define lpfc_mbx_read_vpi_acq_alpa_MASK 0x000000FF
  1343. #define lpfc_mbx_read_vpi_acq_alpa_WORD word4
  1344. #define lpfc_mbx_read_vpi_pb_SHIFT 15
  1345. #define lpfc_mbx_read_vpi_pb_MASK 0x00000001
  1346. #define lpfc_mbx_read_vpi_pb_WORD word4
  1347. #define lpfc_mbx_read_vpi_spec_alpa_SHIFT 16
  1348. #define lpfc_mbx_read_vpi_spec_alpa_MASK 0x000000FF
  1349. #define lpfc_mbx_read_vpi_spec_alpa_WORD word4
  1350. #define lpfc_mbx_read_vpi_ns_SHIFT 30
  1351. #define lpfc_mbx_read_vpi_ns_MASK 0x00000001
  1352. #define lpfc_mbx_read_vpi_ns_WORD word4
  1353. #define lpfc_mbx_read_vpi_hl_SHIFT 31
  1354. #define lpfc_mbx_read_vpi_hl_MASK 0x00000001
  1355. #define lpfc_mbx_read_vpi_hl_WORD word4
  1356. uint32_t word5_rsvd;
  1357. uint32_t word6;
  1358. #define lpfc_mbx_read_vpi_vpi_SHIFT 0
  1359. #define lpfc_mbx_read_vpi_vpi_MASK 0x0000FFFF
  1360. #define lpfc_mbx_read_vpi_vpi_WORD word6
  1361. uint32_t word7;
  1362. #define lpfc_mbx_read_vpi_mac_0_SHIFT 0
  1363. #define lpfc_mbx_read_vpi_mac_0_MASK 0x000000FF
  1364. #define lpfc_mbx_read_vpi_mac_0_WORD word7
  1365. #define lpfc_mbx_read_vpi_mac_1_SHIFT 8
  1366. #define lpfc_mbx_read_vpi_mac_1_MASK 0x000000FF
  1367. #define lpfc_mbx_read_vpi_mac_1_WORD word7
  1368. #define lpfc_mbx_read_vpi_mac_2_SHIFT 16
  1369. #define lpfc_mbx_read_vpi_mac_2_MASK 0x000000FF
  1370. #define lpfc_mbx_read_vpi_mac_2_WORD word7
  1371. #define lpfc_mbx_read_vpi_mac_3_SHIFT 24
  1372. #define lpfc_mbx_read_vpi_mac_3_MASK 0x000000FF
  1373. #define lpfc_mbx_read_vpi_mac_3_WORD word7
  1374. uint32_t word8;
  1375. #define lpfc_mbx_read_vpi_mac_4_SHIFT 0
  1376. #define lpfc_mbx_read_vpi_mac_4_MASK 0x000000FF
  1377. #define lpfc_mbx_read_vpi_mac_4_WORD word8
  1378. #define lpfc_mbx_read_vpi_mac_5_SHIFT 8
  1379. #define lpfc_mbx_read_vpi_mac_5_MASK 0x000000FF
  1380. #define lpfc_mbx_read_vpi_mac_5_WORD word8
  1381. #define lpfc_mbx_read_vpi_vlan_tag_SHIFT 16
  1382. #define lpfc_mbx_read_vpi_vlan_tag_MASK 0x00000FFF
  1383. #define lpfc_mbx_read_vpi_vlan_tag_WORD word8
  1384. #define lpfc_mbx_read_vpi_vv_SHIFT 28
  1385. #define lpfc_mbx_read_vpi_vv_MASK 0x0000001
  1386. #define lpfc_mbx_read_vpi_vv_WORD word8
  1387. };
  1388. struct lpfc_mbx_unreg_vfi {
  1389. uint32_t word1_rsvd;
  1390. uint32_t word2;
  1391. #define lpfc_unreg_vfi_vfi_SHIFT 0
  1392. #define lpfc_unreg_vfi_vfi_MASK 0x0000FFFF
  1393. #define lpfc_unreg_vfi_vfi_WORD word2
  1394. };
  1395. struct lpfc_mbx_resume_rpi {
  1396. uint32_t word1;
  1397. #define lpfc_resume_rpi_index_SHIFT 0
  1398. #define lpfc_resume_rpi_index_MASK 0x0000FFFF
  1399. #define lpfc_resume_rpi_index_WORD word1
  1400. #define lpfc_resume_rpi_ii_SHIFT 30
  1401. #define lpfc_resume_rpi_ii_MASK 0x00000003
  1402. #define lpfc_resume_rpi_ii_WORD word1
  1403. #define RESUME_INDEX_RPI 0
  1404. #define RESUME_INDEX_VPI 1
  1405. #define RESUME_INDEX_VFI 2
  1406. #define RESUME_INDEX_FCFI 3
  1407. uint32_t event_tag;
  1408. };
  1409. #define REG_FCF_INVALID_QID 0xFFFF
  1410. struct lpfc_mbx_reg_fcfi {
  1411. uint32_t word1;
  1412. #define lpfc_reg_fcfi_info_index_SHIFT 0
  1413. #define lpfc_reg_fcfi_info_index_MASK 0x0000FFFF
  1414. #define lpfc_reg_fcfi_info_index_WORD word1
  1415. #define lpfc_reg_fcfi_fcfi_SHIFT 16
  1416. #define lpfc_reg_fcfi_fcfi_MASK 0x0000FFFF
  1417. #define lpfc_reg_fcfi_fcfi_WORD word1
  1418. uint32_t word2;
  1419. #define lpfc_reg_fcfi_rq_id1_SHIFT 0
  1420. #define lpfc_reg_fcfi_rq_id1_MASK 0x0000FFFF
  1421. #define lpfc_reg_fcfi_rq_id1_WORD word2
  1422. #define lpfc_reg_fcfi_rq_id0_SHIFT 16
  1423. #define lpfc_reg_fcfi_rq_id0_MASK 0x0000FFFF
  1424. #define lpfc_reg_fcfi_rq_id0_WORD word2
  1425. uint32_t word3;
  1426. #define lpfc_reg_fcfi_rq_id3_SHIFT 0
  1427. #define lpfc_reg_fcfi_rq_id3_MASK 0x0000FFFF
  1428. #define lpfc_reg_fcfi_rq_id3_WORD word3
  1429. #define lpfc_reg_fcfi_rq_id2_SHIFT 16
  1430. #define lpfc_reg_fcfi_rq_id2_MASK 0x0000FFFF
  1431. #define lpfc_reg_fcfi_rq_id2_WORD word3
  1432. uint32_t word4;
  1433. #define lpfc_reg_fcfi_type_match0_SHIFT 24
  1434. #define lpfc_reg_fcfi_type_match0_MASK 0x000000FF
  1435. #define lpfc_reg_fcfi_type_match0_WORD word4
  1436. #define lpfc_reg_fcfi_type_mask0_SHIFT 16
  1437. #define lpfc_reg_fcfi_type_mask0_MASK 0x000000FF
  1438. #define lpfc_reg_fcfi_type_mask0_WORD word4
  1439. #define lpfc_reg_fcfi_rctl_match0_SHIFT 8
  1440. #define lpfc_reg_fcfi_rctl_match0_MASK 0x000000FF
  1441. #define lpfc_reg_fcfi_rctl_match0_WORD word4
  1442. #define lpfc_reg_fcfi_rctl_mask0_SHIFT 0
  1443. #define lpfc_reg_fcfi_rctl_mask0_MASK 0x000000FF
  1444. #define lpfc_reg_fcfi_rctl_mask0_WORD word4
  1445. uint32_t word5;
  1446. #define lpfc_reg_fcfi_type_match1_SHIFT 24
  1447. #define lpfc_reg_fcfi_type_match1_MASK 0x000000FF
  1448. #define lpfc_reg_fcfi_type_match1_WORD word5
  1449. #define lpfc_reg_fcfi_type_mask1_SHIFT 16
  1450. #define lpfc_reg_fcfi_type_mask1_MASK 0x000000FF
  1451. #define lpfc_reg_fcfi_type_mask1_WORD word5
  1452. #define lpfc_reg_fcfi_rctl_match1_SHIFT 8
  1453. #define lpfc_reg_fcfi_rctl_match1_MASK 0x000000FF
  1454. #define lpfc_reg_fcfi_rctl_match1_WORD word5
  1455. #define lpfc_reg_fcfi_rctl_mask1_SHIFT 0
  1456. #define lpfc_reg_fcfi_rctl_mask1_MASK 0x000000FF
  1457. #define lpfc_reg_fcfi_rctl_mask1_WORD word5
  1458. uint32_t word6;
  1459. #define lpfc_reg_fcfi_type_match2_SHIFT 24
  1460. #define lpfc_reg_fcfi_type_match2_MASK 0x000000FF
  1461. #define lpfc_reg_fcfi_type_match2_WORD word6
  1462. #define lpfc_reg_fcfi_type_mask2_SHIFT 16
  1463. #define lpfc_reg_fcfi_type_mask2_MASK 0x000000FF
  1464. #define lpfc_reg_fcfi_type_mask2_WORD word6
  1465. #define lpfc_reg_fcfi_rctl_match2_SHIFT 8
  1466. #define lpfc_reg_fcfi_rctl_match2_MASK 0x000000FF
  1467. #define lpfc_reg_fcfi_rctl_match2_WORD word6
  1468. #define lpfc_reg_fcfi_rctl_mask2_SHIFT 0
  1469. #define lpfc_reg_fcfi_rctl_mask2_MASK 0x000000FF
  1470. #define lpfc_reg_fcfi_rctl_mask2_WORD word6
  1471. uint32_t word7;
  1472. #define lpfc_reg_fcfi_type_match3_SHIFT 24
  1473. #define lpfc_reg_fcfi_type_match3_MASK 0x000000FF
  1474. #define lpfc_reg_fcfi_type_match3_WORD word7
  1475. #define lpfc_reg_fcfi_type_mask3_SHIFT 16
  1476. #define lpfc_reg_fcfi_type_mask3_MASK 0x000000FF
  1477. #define lpfc_reg_fcfi_type_mask3_WORD word7
  1478. #define lpfc_reg_fcfi_rctl_match3_SHIFT 8
  1479. #define lpfc_reg_fcfi_rctl_match3_MASK 0x000000FF
  1480. #define lpfc_reg_fcfi_rctl_match3_WORD word7
  1481. #define lpfc_reg_fcfi_rctl_mask3_SHIFT 0
  1482. #define lpfc_reg_fcfi_rctl_mask3_MASK 0x000000FF
  1483. #define lpfc_reg_fcfi_rctl_mask3_WORD word7
  1484. uint32_t word8;
  1485. #define lpfc_reg_fcfi_mam_SHIFT 13
  1486. #define lpfc_reg_fcfi_mam_MASK 0x00000003
  1487. #define lpfc_reg_fcfi_mam_WORD word8
  1488. #define LPFC_MAM_BOTH 0 /* Both SPMA and FPMA */
  1489. #define LPFC_MAM_SPMA 1 /* Server Provided MAC Address */
  1490. #define LPFC_MAM_FPMA 2 /* Fabric Provided MAC Address */
  1491. #define lpfc_reg_fcfi_vv_SHIFT 12
  1492. #define lpfc_reg_fcfi_vv_MASK 0x00000001
  1493. #define lpfc_reg_fcfi_vv_WORD word8
  1494. #define lpfc_reg_fcfi_vlan_tag_SHIFT 0
  1495. #define lpfc_reg_fcfi_vlan_tag_MASK 0x00000FFF
  1496. #define lpfc_reg_fcfi_vlan_tag_WORD word8
  1497. };
  1498. struct lpfc_mbx_unreg_fcfi {
  1499. uint32_t word1_rsv;
  1500. uint32_t word2;
  1501. #define lpfc_unreg_fcfi_SHIFT 0
  1502. #define lpfc_unreg_fcfi_MASK 0x0000FFFF
  1503. #define lpfc_unreg_fcfi_WORD word2
  1504. };
  1505. struct lpfc_mbx_read_rev {
  1506. uint32_t word1;
  1507. #define lpfc_mbx_rd_rev_sli_lvl_SHIFT 16
  1508. #define lpfc_mbx_rd_rev_sli_lvl_MASK 0x0000000F
  1509. #define lpfc_mbx_rd_rev_sli_lvl_WORD word1
  1510. #define lpfc_mbx_rd_rev_fcoe_SHIFT 20
  1511. #define lpfc_mbx_rd_rev_fcoe_MASK 0x00000001
  1512. #define lpfc_mbx_rd_rev_fcoe_WORD word1
  1513. #define lpfc_mbx_rd_rev_cee_ver_SHIFT 21
  1514. #define lpfc_mbx_rd_rev_cee_ver_MASK 0x00000003
  1515. #define lpfc_mbx_rd_rev_cee_ver_WORD word1
  1516. #define LPFC_PREDCBX_CEE_MODE 0
  1517. #define LPFC_DCBX_CEE_MODE 1
  1518. #define lpfc_mbx_rd_rev_vpd_SHIFT 29
  1519. #define lpfc_mbx_rd_rev_vpd_MASK 0x00000001
  1520. #define lpfc_mbx_rd_rev_vpd_WORD word1
  1521. uint32_t first_hw_rev;
  1522. uint32_t second_hw_rev;
  1523. uint32_t word4_rsvd;
  1524. uint32_t third_hw_rev;
  1525. uint32_t word6;
  1526. #define lpfc_mbx_rd_rev_fcph_low_SHIFT 0
  1527. #define lpfc_mbx_rd_rev_fcph_low_MASK 0x000000FF
  1528. #define lpfc_mbx_rd_rev_fcph_low_WORD word6
  1529. #define lpfc_mbx_rd_rev_fcph_high_SHIFT 8
  1530. #define lpfc_mbx_rd_rev_fcph_high_MASK 0x000000FF
  1531. #define lpfc_mbx_rd_rev_fcph_high_WORD word6
  1532. #define lpfc_mbx_rd_rev_ftr_lvl_low_SHIFT 16
  1533. #define lpfc_mbx_rd_rev_ftr_lvl_low_MASK 0x000000FF
  1534. #define lpfc_mbx_rd_rev_ftr_lvl_low_WORD word6
  1535. #define lpfc_mbx_rd_rev_ftr_lvl_high_SHIFT 24
  1536. #define lpfc_mbx_rd_rev_ftr_lvl_high_MASK 0x000000FF
  1537. #define lpfc_mbx_rd_rev_ftr_lvl_high_WORD word6
  1538. uint32_t word7_rsvd;
  1539. uint32_t fw_id_rev;
  1540. uint8_t fw_name[16];
  1541. uint32_t ulp_fw_id_rev;
  1542. uint8_t ulp_fw_name[16];
  1543. uint32_t word18_47_rsvd[30];
  1544. uint32_t word48;
  1545. #define lpfc_mbx_rd_rev_avail_len_SHIFT 0
  1546. #define lpfc_mbx_rd_rev_avail_len_MASK 0x00FFFFFF
  1547. #define lpfc_mbx_rd_rev_avail_len_WORD word48
  1548. uint32_t vpd_paddr_low;
  1549. uint32_t vpd_paddr_high;
  1550. uint32_t avail_vpd_len;
  1551. uint32_t rsvd_52_63[12];
  1552. };
  1553. struct lpfc_mbx_read_config {
  1554. uint32_t word1;
  1555. #define lpfc_mbx_rd_conf_max_bbc_SHIFT 0
  1556. #define lpfc_mbx_rd_conf_max_bbc_MASK 0x000000FF
  1557. #define lpfc_mbx_rd_conf_max_bbc_WORD word1
  1558. #define lpfc_mbx_rd_conf_init_bbc_SHIFT 8
  1559. #define lpfc_mbx_rd_conf_init_bbc_MASK 0x000000FF
  1560. #define lpfc_mbx_rd_conf_init_bbc_WORD word1
  1561. uint32_t word2;
  1562. #define lpfc_mbx_rd_conf_nport_did_SHIFT 0
  1563. #define lpfc_mbx_rd_conf_nport_did_MASK 0x00FFFFFF
  1564. #define lpfc_mbx_rd_conf_nport_did_WORD word2
  1565. #define lpfc_mbx_rd_conf_topology_SHIFT 24
  1566. #define lpfc_mbx_rd_conf_topology_MASK 0x000000FF
  1567. #define lpfc_mbx_rd_conf_topology_WORD word2
  1568. uint32_t word3;
  1569. #define lpfc_mbx_rd_conf_ao_SHIFT 0
  1570. #define lpfc_mbx_rd_conf_ao_MASK 0x00000001
  1571. #define lpfc_mbx_rd_conf_ao_WORD word3
  1572. #define lpfc_mbx_rd_conf_bb_scn_SHIFT 8
  1573. #define lpfc_mbx_rd_conf_bb_scn_MASK 0x0000000F
  1574. #define lpfc_mbx_rd_conf_bb_scn_WORD word3
  1575. #define lpfc_mbx_rd_conf_cbb_scn_SHIFT 12
  1576. #define lpfc_mbx_rd_conf_cbb_scn_MASK 0x0000000F
  1577. #define lpfc_mbx_rd_conf_cbb_scn_WORD word3
  1578. #define lpfc_mbx_rd_conf_mc_SHIFT 29
  1579. #define lpfc_mbx_rd_conf_mc_MASK 0x00000001
  1580. #define lpfc_mbx_rd_conf_mc_WORD word3
  1581. uint32_t word4;
  1582. #define lpfc_mbx_rd_conf_e_d_tov_SHIFT 0
  1583. #define lpfc_mbx_rd_conf_e_d_tov_MASK 0x0000FFFF
  1584. #define lpfc_mbx_rd_conf_e_d_tov_WORD word4
  1585. uint32_t word5;
  1586. #define lpfc_mbx_rd_conf_lp_tov_SHIFT 0
  1587. #define lpfc_mbx_rd_conf_lp_tov_MASK 0x0000FFFF
  1588. #define lpfc_mbx_rd_conf_lp_tov_WORD word5
  1589. uint32_t word6;
  1590. #define lpfc_mbx_rd_conf_r_a_tov_SHIFT 0
  1591. #define lpfc_mbx_rd_conf_r_a_tov_MASK 0x0000FFFF
  1592. #define lpfc_mbx_rd_conf_r_a_tov_WORD word6
  1593. uint32_t word7;
  1594. #define lpfc_mbx_rd_conf_r_t_tov_SHIFT 0
  1595. #define lpfc_mbx_rd_conf_r_t_tov_MASK 0x000000FF
  1596. #define lpfc_mbx_rd_conf_r_t_tov_WORD word7
  1597. uint32_t word8;
  1598. #define lpfc_mbx_rd_conf_al_tov_SHIFT 0
  1599. #define lpfc_mbx_rd_conf_al_tov_MASK 0x0000000F
  1600. #define lpfc_mbx_rd_conf_al_tov_WORD word8
  1601. uint32_t word9;
  1602. #define lpfc_mbx_rd_conf_lmt_SHIFT 0
  1603. #define lpfc_mbx_rd_conf_lmt_MASK 0x0000FFFF
  1604. #define lpfc_mbx_rd_conf_lmt_WORD word9
  1605. uint32_t word10;
  1606. #define lpfc_mbx_rd_conf_max_alpa_SHIFT 0
  1607. #define lpfc_mbx_rd_conf_max_alpa_MASK 0x000000FF
  1608. #define lpfc_mbx_rd_conf_max_alpa_WORD word10
  1609. uint32_t word11_rsvd;
  1610. uint32_t word12;
  1611. #define lpfc_mbx_rd_conf_xri_base_SHIFT 0
  1612. #define lpfc_mbx_rd_conf_xri_base_MASK 0x0000FFFF
  1613. #define lpfc_mbx_rd_conf_xri_base_WORD word12
  1614. #define lpfc_mbx_rd_conf_xri_count_SHIFT 16
  1615. #define lpfc_mbx_rd_conf_xri_count_MASK 0x0000FFFF
  1616. #define lpfc_mbx_rd_conf_xri_count_WORD word12
  1617. uint32_t word13;
  1618. #define lpfc_mbx_rd_conf_rpi_base_SHIFT 0
  1619. #define lpfc_mbx_rd_conf_rpi_base_MASK 0x0000FFFF
  1620. #define lpfc_mbx_rd_conf_rpi_base_WORD word13
  1621. #define lpfc_mbx_rd_conf_rpi_count_SHIFT 16
  1622. #define lpfc_mbx_rd_conf_rpi_count_MASK 0x0000FFFF
  1623. #define lpfc_mbx_rd_conf_rpi_count_WORD word13
  1624. uint32_t word14;
  1625. #define lpfc_mbx_rd_conf_vpi_base_SHIFT 0
  1626. #define lpfc_mbx_rd_conf_vpi_base_MASK 0x0000FFFF
  1627. #define lpfc_mbx_rd_conf_vpi_base_WORD word14
  1628. #define lpfc_mbx_rd_conf_vpi_count_SHIFT 16
  1629. #define lpfc_mbx_rd_conf_vpi_count_MASK 0x0000FFFF
  1630. #define lpfc_mbx_rd_conf_vpi_count_WORD word14
  1631. uint32_t word15;
  1632. #define lpfc_mbx_rd_conf_vfi_base_SHIFT 0
  1633. #define lpfc_mbx_rd_conf_vfi_base_MASK 0x0000FFFF
  1634. #define lpfc_mbx_rd_conf_vfi_base_WORD word15
  1635. #define lpfc_mbx_rd_conf_vfi_count_SHIFT 16
  1636. #define lpfc_mbx_rd_conf_vfi_count_MASK 0x0000FFFF
  1637. #define lpfc_mbx_rd_conf_vfi_count_WORD word15
  1638. uint32_t word16;
  1639. #define lpfc_mbx_rd_conf_fcfi_base_SHIFT 0
  1640. #define lpfc_mbx_rd_conf_fcfi_base_MASK 0x0000FFFF
  1641. #define lpfc_mbx_rd_conf_fcfi_base_WORD word16
  1642. #define lpfc_mbx_rd_conf_fcfi_count_SHIFT 16
  1643. #define lpfc_mbx_rd_conf_fcfi_count_MASK 0x0000FFFF
  1644. #define lpfc_mbx_rd_conf_fcfi_count_WORD word16
  1645. uint32_t word17;
  1646. #define lpfc_mbx_rd_conf_rq_count_SHIFT 0
  1647. #define lpfc_mbx_rd_conf_rq_count_MASK 0x0000FFFF
  1648. #define lpfc_mbx_rd_conf_rq_count_WORD word17
  1649. #define lpfc_mbx_rd_conf_eq_count_SHIFT 16
  1650. #define lpfc_mbx_rd_conf_eq_count_MASK 0x0000FFFF
  1651. #define lpfc_mbx_rd_conf_eq_count_WORD word17
  1652. uint32_t word18;
  1653. #define lpfc_mbx_rd_conf_wq_count_SHIFT 0
  1654. #define lpfc_mbx_rd_conf_wq_count_MASK 0x0000FFFF
  1655. #define lpfc_mbx_rd_conf_wq_count_WORD word18
  1656. #define lpfc_mbx_rd_conf_cq_count_SHIFT 16
  1657. #define lpfc_mbx_rd_conf_cq_count_MASK 0x0000FFFF
  1658. #define lpfc_mbx_rd_conf_cq_count_WORD word18
  1659. };
  1660. struct lpfc_mbx_request_features {
  1661. uint32_t word1;
  1662. #define lpfc_mbx_rq_ftr_qry_SHIFT 0
  1663. #define lpfc_mbx_rq_ftr_qry_MASK 0x00000001
  1664. #define lpfc_mbx_rq_ftr_qry_WORD word1
  1665. uint32_t word2;
  1666. #define lpfc_mbx_rq_ftr_rq_iaab_SHIFT 0
  1667. #define lpfc_mbx_rq_ftr_rq_iaab_MASK 0x00000001
  1668. #define lpfc_mbx_rq_ftr_rq_iaab_WORD word2
  1669. #define lpfc_mbx_rq_ftr_rq_npiv_SHIFT 1
  1670. #define lpfc_mbx_rq_ftr_rq_npiv_MASK 0x00000001
  1671. #define lpfc_mbx_rq_ftr_rq_npiv_WORD word2
  1672. #define lpfc_mbx_rq_ftr_rq_dif_SHIFT 2
  1673. #define lpfc_mbx_rq_ftr_rq_dif_MASK 0x00000001
  1674. #define lpfc_mbx_rq_ftr_rq_dif_WORD word2
  1675. #define lpfc_mbx_rq_ftr_rq_vf_SHIFT 3
  1676. #define lpfc_mbx_rq_ftr_rq_vf_MASK 0x00000001
  1677. #define lpfc_mbx_rq_ftr_rq_vf_WORD word2
  1678. #define lpfc_mbx_rq_ftr_rq_fcpi_SHIFT 4
  1679. #define lpfc_mbx_rq_ftr_rq_fcpi_MASK 0x00000001
  1680. #define lpfc_mbx_rq_ftr_rq_fcpi_WORD word2
  1681. #define lpfc_mbx_rq_ftr_rq_fcpt_SHIFT 5
  1682. #define lpfc_mbx_rq_ftr_rq_fcpt_MASK 0x00000001
  1683. #define lpfc_mbx_rq_ftr_rq_fcpt_WORD word2
  1684. #define lpfc_mbx_rq_ftr_rq_fcpc_SHIFT 6
  1685. #define lpfc_mbx_rq_ftr_rq_fcpc_MASK 0x00000001
  1686. #define lpfc_mbx_rq_ftr_rq_fcpc_WORD word2
  1687. #define lpfc_mbx_rq_ftr_rq_ifip_SHIFT 7
  1688. #define lpfc_mbx_rq_ftr_rq_ifip_MASK 0x00000001
  1689. #define lpfc_mbx_rq_ftr_rq_ifip_WORD word2
  1690. uint32_t word3;
  1691. #define lpfc_mbx_rq_ftr_rsp_iaab_SHIFT 0
  1692. #define lpfc_mbx_rq_ftr_rsp_iaab_MASK 0x00000001
  1693. #define lpfc_mbx_rq_ftr_rsp_iaab_WORD word3
  1694. #define lpfc_mbx_rq_ftr_rsp_npiv_SHIFT 1
  1695. #define lpfc_mbx_rq_ftr_rsp_npiv_MASK 0x00000001
  1696. #define lpfc_mbx_rq_ftr_rsp_npiv_WORD word3
  1697. #define lpfc_mbx_rq_ftr_rsp_dif_SHIFT 2
  1698. #define lpfc_mbx_rq_ftr_rsp_dif_MASK 0x00000001
  1699. #define lpfc_mbx_rq_ftr_rsp_dif_WORD word3
  1700. #define lpfc_mbx_rq_ftr_rsp_vf_SHIFT 3
  1701. #define lpfc_mbx_rq_ftr_rsp_vf__MASK 0x00000001
  1702. #define lpfc_mbx_rq_ftr_rsp_vf_WORD word3
  1703. #define lpfc_mbx_rq_ftr_rsp_fcpi_SHIFT 4
  1704. #define lpfc_mbx_rq_ftr_rsp_fcpi_MASK 0x00000001
  1705. #define lpfc_mbx_rq_ftr_rsp_fcpi_WORD word3
  1706. #define lpfc_mbx_rq_ftr_rsp_fcpt_SHIFT 5
  1707. #define lpfc_mbx_rq_ftr_rsp_fcpt_MASK 0x00000001
  1708. #define lpfc_mbx_rq_ftr_rsp_fcpt_WORD word3
  1709. #define lpfc_mbx_rq_ftr_rsp_fcpc_SHIFT 6
  1710. #define lpfc_mbx_rq_ftr_rsp_fcpc_MASK 0x00000001
  1711. #define lpfc_mbx_rq_ftr_rsp_fcpc_WORD word3
  1712. #define lpfc_mbx_rq_ftr_rsp_ifip_SHIFT 7
  1713. #define lpfc_mbx_rq_ftr_rsp_ifip_MASK 0x00000001
  1714. #define lpfc_mbx_rq_ftr_rsp_ifip_WORD word3
  1715. };
  1716. /* Mailbox Completion Queue Error Messages */
  1717. #define MB_CQE_STATUS_SUCCESS 0x0
  1718. #define MB_CQE_STATUS_INSUFFICIENT_PRIVILEGES 0x1
  1719. #define MB_CQE_STATUS_INVALID_PARAMETER 0x2
  1720. #define MB_CQE_STATUS_INSUFFICIENT_RESOURCES 0x3
  1721. #define MB_CEQ_STATUS_QUEUE_FLUSHING 0x4
  1722. #define MB_CQE_STATUS_DMA_FAILED 0x5
  1723. /* mailbox queue entry structure */
  1724. struct lpfc_mqe {
  1725. uint32_t word0;
  1726. #define lpfc_mqe_status_SHIFT 16
  1727. #define lpfc_mqe_status_MASK 0x0000FFFF
  1728. #define lpfc_mqe_status_WORD word0
  1729. #define lpfc_mqe_command_SHIFT 8
  1730. #define lpfc_mqe_command_MASK 0x000000FF
  1731. #define lpfc_mqe_command_WORD word0
  1732. union {
  1733. uint32_t mb_words[LPFC_SLI4_MB_WORD_COUNT - 1];
  1734. /* sli4 mailbox commands */
  1735. struct lpfc_mbx_sli4_config sli4_config;
  1736. struct lpfc_mbx_init_vfi init_vfi;
  1737. struct lpfc_mbx_reg_vfi reg_vfi;
  1738. struct lpfc_mbx_reg_vfi unreg_vfi;
  1739. struct lpfc_mbx_init_vpi init_vpi;
  1740. struct lpfc_mbx_resume_rpi resume_rpi;
  1741. struct lpfc_mbx_read_fcf_tbl read_fcf_tbl;
  1742. struct lpfc_mbx_add_fcf_tbl_entry add_fcf_entry;
  1743. struct lpfc_mbx_del_fcf_tbl_entry del_fcf_entry;
  1744. struct lpfc_mbx_reg_fcfi reg_fcfi;
  1745. struct lpfc_mbx_unreg_fcfi unreg_fcfi;
  1746. struct lpfc_mbx_mq_create mq_create;
  1747. struct lpfc_mbx_eq_create eq_create;
  1748. struct lpfc_mbx_cq_create cq_create;
  1749. struct lpfc_mbx_wq_create wq_create;
  1750. struct lpfc_mbx_rq_create rq_create;
  1751. struct lpfc_mbx_mq_destroy mq_destroy;
  1752. struct lpfc_mbx_eq_destroy eq_destroy;
  1753. struct lpfc_mbx_cq_destroy cq_destroy;
  1754. struct lpfc_mbx_wq_destroy wq_destroy;
  1755. struct lpfc_mbx_rq_destroy rq_destroy;
  1756. struct lpfc_mbx_post_sgl_pages post_sgl_pages;
  1757. struct lpfc_mbx_nembed_cmd nembed_cmd;
  1758. struct lpfc_mbx_read_rev read_rev;
  1759. struct lpfc_mbx_read_vpi read_vpi;
  1760. struct lpfc_mbx_read_config rd_config;
  1761. struct lpfc_mbx_request_features req_ftrs;
  1762. struct lpfc_mbx_post_hdr_tmpl hdr_tmpl;
  1763. struct lpfc_mbx_query_fw_cfg query_fw_cfg;
  1764. struct lpfc_mbx_nop nop;
  1765. } un;
  1766. };
  1767. struct lpfc_mcqe {
  1768. uint32_t word0;
  1769. #define lpfc_mcqe_status_SHIFT 0
  1770. #define lpfc_mcqe_status_MASK 0x0000FFFF
  1771. #define lpfc_mcqe_status_WORD word0
  1772. #define lpfc_mcqe_ext_status_SHIFT 16
  1773. #define lpfc_mcqe_ext_status_MASK 0x0000FFFF
  1774. #define lpfc_mcqe_ext_status_WORD word0
  1775. uint32_t mcqe_tag0;
  1776. uint32_t mcqe_tag1;
  1777. uint32_t trailer;
  1778. #define lpfc_trailer_valid_SHIFT 31
  1779. #define lpfc_trailer_valid_MASK 0x00000001
  1780. #define lpfc_trailer_valid_WORD trailer
  1781. #define lpfc_trailer_async_SHIFT 30
  1782. #define lpfc_trailer_async_MASK 0x00000001
  1783. #define lpfc_trailer_async_WORD trailer
  1784. #define lpfc_trailer_hpi_SHIFT 29
  1785. #define lpfc_trailer_hpi_MASK 0x00000001
  1786. #define lpfc_trailer_hpi_WORD trailer
  1787. #define lpfc_trailer_completed_SHIFT 28
  1788. #define lpfc_trailer_completed_MASK 0x00000001
  1789. #define lpfc_trailer_completed_WORD trailer
  1790. #define lpfc_trailer_consumed_SHIFT 27
  1791. #define lpfc_trailer_consumed_MASK 0x00000001
  1792. #define lpfc_trailer_consumed_WORD trailer
  1793. #define lpfc_trailer_type_SHIFT 16
  1794. #define lpfc_trailer_type_MASK 0x000000FF
  1795. #define lpfc_trailer_type_WORD trailer
  1796. #define lpfc_trailer_code_SHIFT 8
  1797. #define lpfc_trailer_code_MASK 0x000000FF
  1798. #define lpfc_trailer_code_WORD trailer
  1799. #define LPFC_TRAILER_CODE_LINK 0x1
  1800. #define LPFC_TRAILER_CODE_FCOE 0x2
  1801. #define LPFC_TRAILER_CODE_DCBX 0x3
  1802. };
  1803. struct lpfc_acqe_link {
  1804. uint32_t word0;
  1805. #define lpfc_acqe_link_speed_SHIFT 24
  1806. #define lpfc_acqe_link_speed_MASK 0x000000FF
  1807. #define lpfc_acqe_link_speed_WORD word0
  1808. #define LPFC_ASYNC_LINK_SPEED_ZERO 0x0
  1809. #define LPFC_ASYNC_LINK_SPEED_10MBPS 0x1
  1810. #define LPFC_ASYNC_LINK_SPEED_100MBPS 0x2
  1811. #define LPFC_ASYNC_LINK_SPEED_1GBPS 0x3
  1812. #define LPFC_ASYNC_LINK_SPEED_10GBPS 0x4
  1813. #define lpfc_acqe_link_duplex_SHIFT 16
  1814. #define lpfc_acqe_link_duplex_MASK 0x000000FF
  1815. #define lpfc_acqe_link_duplex_WORD word0
  1816. #define LPFC_ASYNC_LINK_DUPLEX_NONE 0x0
  1817. #define LPFC_ASYNC_LINK_DUPLEX_HALF 0x1
  1818. #define LPFC_ASYNC_LINK_DUPLEX_FULL 0x2
  1819. #define lpfc_acqe_link_status_SHIFT 8
  1820. #define lpfc_acqe_link_status_MASK 0x000000FF
  1821. #define lpfc_acqe_link_status_WORD word0
  1822. #define LPFC_ASYNC_LINK_STATUS_DOWN 0x0
  1823. #define LPFC_ASYNC_LINK_STATUS_UP 0x1
  1824. #define LPFC_ASYNC_LINK_STATUS_LOGICAL_DOWN 0x2
  1825. #define LPFC_ASYNC_LINK_STATUS_LOGICAL_UP 0x3
  1826. #define lpfc_acqe_link_physical_SHIFT 0
  1827. #define lpfc_acqe_link_physical_MASK 0x000000FF
  1828. #define lpfc_acqe_link_physical_WORD word0
  1829. #define LPFC_ASYNC_LINK_PORT_A 0x0
  1830. #define LPFC_ASYNC_LINK_PORT_B 0x1
  1831. uint32_t word1;
  1832. #define lpfc_acqe_link_fault_SHIFT 0
  1833. #define lpfc_acqe_link_fault_MASK 0x000000FF
  1834. #define lpfc_acqe_link_fault_WORD word1
  1835. #define LPFC_ASYNC_LINK_FAULT_NONE 0x0
  1836. #define LPFC_ASYNC_LINK_FAULT_LOCAL 0x1
  1837. #define LPFC_ASYNC_LINK_FAULT_REMOTE 0x2
  1838. uint32_t event_tag;
  1839. uint32_t trailer;
  1840. };
  1841. struct lpfc_acqe_fcoe {
  1842. uint32_t index;
  1843. uint32_t word1;
  1844. #define lpfc_acqe_fcoe_fcf_count_SHIFT 0
  1845. #define lpfc_acqe_fcoe_fcf_count_MASK 0x0000FFFF
  1846. #define lpfc_acqe_fcoe_fcf_count_WORD word1
  1847. #define lpfc_acqe_fcoe_event_type_SHIFT 16
  1848. #define lpfc_acqe_fcoe_event_type_MASK 0x0000FFFF
  1849. #define lpfc_acqe_fcoe_event_type_WORD word1
  1850. #define LPFC_FCOE_EVENT_TYPE_NEW_FCF 0x1
  1851. #define LPFC_FCOE_EVENT_TYPE_FCF_TABLE_FULL 0x2
  1852. #define LPFC_FCOE_EVENT_TYPE_FCF_DEAD 0x3
  1853. #define LPFC_FCOE_EVENT_TYPE_CVL 0x4
  1854. uint32_t event_tag;
  1855. uint32_t trailer;
  1856. };
  1857. struct lpfc_acqe_dcbx {
  1858. uint32_t tlv_ttl;
  1859. uint32_t reserved;
  1860. uint32_t event_tag;
  1861. uint32_t trailer;
  1862. };
  1863. /*
  1864. * Define the bootstrap mailbox (bmbx) region used to communicate
  1865. * mailbox command between the host and port. The mailbox consists
  1866. * of a payload area of 256 bytes and a completion queue of length
  1867. * 16 bytes.
  1868. */
  1869. struct lpfc_bmbx_create {
  1870. struct lpfc_mqe mqe;
  1871. struct lpfc_mcqe mcqe;
  1872. };
  1873. #define SGL_ALIGN_SZ 64
  1874. #define SGL_PAGE_SIZE 4096
  1875. /* align SGL addr on a size boundary - adjust address up */
  1876. #define NO_XRI ((uint16_t)-1)
  1877. struct wqe_common {
  1878. uint32_t word6;
  1879. #define wqe_xri_tag_SHIFT 0
  1880. #define wqe_xri_tag_MASK 0x0000FFFF
  1881. #define wqe_xri_tag_WORD word6
  1882. #define wqe_ctxt_tag_SHIFT 16
  1883. #define wqe_ctxt_tag_MASK 0x0000FFFF
  1884. #define wqe_ctxt_tag_WORD word6
  1885. uint32_t word7;
  1886. #define wqe_ct_SHIFT 2
  1887. #define wqe_ct_MASK 0x00000003
  1888. #define wqe_ct_WORD word7
  1889. #define wqe_status_SHIFT 4
  1890. #define wqe_status_MASK 0x0000000f
  1891. #define wqe_status_WORD word7
  1892. #define wqe_cmnd_SHIFT 8
  1893. #define wqe_cmnd_MASK 0x000000ff
  1894. #define wqe_cmnd_WORD word7
  1895. #define wqe_class_SHIFT 16
  1896. #define wqe_class_MASK 0x00000007
  1897. #define wqe_class_WORD word7
  1898. #define wqe_pu_SHIFT 20
  1899. #define wqe_pu_MASK 0x00000003
  1900. #define wqe_pu_WORD word7
  1901. #define wqe_erp_SHIFT 22
  1902. #define wqe_erp_MASK 0x00000001
  1903. #define wqe_erp_WORD word7
  1904. #define wqe_lnk_SHIFT 23
  1905. #define wqe_lnk_MASK 0x00000001
  1906. #define wqe_lnk_WORD word7
  1907. #define wqe_tmo_SHIFT 24
  1908. #define wqe_tmo_MASK 0x000000ff
  1909. #define wqe_tmo_WORD word7
  1910. uint32_t abort_tag; /* word 8 in WQE */
  1911. uint32_t word9;
  1912. #define wqe_reqtag_SHIFT 0
  1913. #define wqe_reqtag_MASK 0x0000FFFF
  1914. #define wqe_reqtag_WORD word9
  1915. #define wqe_rcvoxid_SHIFT 16
  1916. #define wqe_rcvoxid_MASK 0x0000FFFF
  1917. #define wqe_rcvoxid_WORD word9
  1918. uint32_t word10;
  1919. #define wqe_pri_SHIFT 16
  1920. #define wqe_pri_MASK 0x00000007
  1921. #define wqe_pri_WORD word10
  1922. #define wqe_pv_SHIFT 19
  1923. #define wqe_pv_MASK 0x00000001
  1924. #define wqe_pv_WORD word10
  1925. #define wqe_xc_SHIFT 21
  1926. #define wqe_xc_MASK 0x00000001
  1927. #define wqe_xc_WORD word10
  1928. #define wqe_ccpe_SHIFT 23
  1929. #define wqe_ccpe_MASK 0x00000001
  1930. #define wqe_ccpe_WORD word10
  1931. #define wqe_ccp_SHIFT 24
  1932. #define wqe_ccp_MASK 0x000000ff
  1933. #define wqe_ccp_WORD word10
  1934. uint32_t word11;
  1935. #define wqe_cmd_type_SHIFT 0
  1936. #define wqe_cmd_type_MASK 0x0000000f
  1937. #define wqe_cmd_type_WORD word11
  1938. #define wqe_wqec_SHIFT 7
  1939. #define wqe_wqec_MASK 0x00000001
  1940. #define wqe_wqec_WORD word11
  1941. #define wqe_cqid_SHIFT 16
  1942. #define wqe_cqid_MASK 0x0000ffff
  1943. #define wqe_cqid_WORD word11
  1944. };
  1945. struct wqe_did {
  1946. uint32_t word5;
  1947. #define wqe_els_did_SHIFT 0
  1948. #define wqe_els_did_MASK 0x00FFFFFF
  1949. #define wqe_els_did_WORD word5
  1950. #define wqe_xmit_bls_pt_SHIFT 28
  1951. #define wqe_xmit_bls_pt_MASK 0x00000003
  1952. #define wqe_xmit_bls_pt_WORD word5
  1953. #define wqe_xmit_bls_ar_SHIFT 30
  1954. #define wqe_xmit_bls_ar_MASK 0x00000001
  1955. #define wqe_xmit_bls_ar_WORD word5
  1956. #define wqe_xmit_bls_xo_SHIFT 31
  1957. #define wqe_xmit_bls_xo_MASK 0x00000001
  1958. #define wqe_xmit_bls_xo_WORD word5
  1959. };
  1960. struct els_request64_wqe {
  1961. struct ulp_bde64 bde;
  1962. uint32_t payload_len;
  1963. uint32_t word4;
  1964. #define els_req64_sid_SHIFT 0
  1965. #define els_req64_sid_MASK 0x00FFFFFF
  1966. #define els_req64_sid_WORD word4
  1967. #define els_req64_sp_SHIFT 24
  1968. #define els_req64_sp_MASK 0x00000001
  1969. #define els_req64_sp_WORD word4
  1970. #define els_req64_vf_SHIFT 25
  1971. #define els_req64_vf_MASK 0x00000001
  1972. #define els_req64_vf_WORD word4
  1973. struct wqe_did wqe_dest;
  1974. struct wqe_common wqe_com; /* words 6-11 */
  1975. uint32_t word12;
  1976. #define els_req64_vfid_SHIFT 1
  1977. #define els_req64_vfid_MASK 0x00000FFF
  1978. #define els_req64_vfid_WORD word12
  1979. #define els_req64_pri_SHIFT 13
  1980. #define els_req64_pri_MASK 0x00000007
  1981. #define els_req64_pri_WORD word12
  1982. uint32_t word13;
  1983. #define els_req64_hopcnt_SHIFT 24
  1984. #define els_req64_hopcnt_MASK 0x000000ff
  1985. #define els_req64_hopcnt_WORD word13
  1986. uint32_t reserved[2];
  1987. };
  1988. struct xmit_els_rsp64_wqe {
  1989. struct ulp_bde64 bde;
  1990. uint32_t rsvd3;
  1991. uint32_t rsvd4;
  1992. struct wqe_did wqe_dest;
  1993. struct wqe_common wqe_com; /* words 6-11 */
  1994. uint32_t rsvd_12_15[4];
  1995. };
  1996. struct xmit_bls_rsp64_wqe {
  1997. uint32_t payload0;
  1998. /* Payload0 for BA_ACC */
  1999. #define xmit_bls_rsp64_acc_seq_id_SHIFT 16
  2000. #define xmit_bls_rsp64_acc_seq_id_MASK 0x000000ff
  2001. #define xmit_bls_rsp64_acc_seq_id_WORD payload0
  2002. #define xmit_bls_rsp64_acc_seq_id_vald_SHIFT 24
  2003. #define xmit_bls_rsp64_acc_seq_id_vald_MASK 0x000000ff
  2004. #define xmit_bls_rsp64_acc_seq_id_vald_WORD payload0
  2005. /* Payload0 for BA_RJT */
  2006. #define xmit_bls_rsp64_rjt_vspec_SHIFT 0
  2007. #define xmit_bls_rsp64_rjt_vspec_MASK 0x000000ff
  2008. #define xmit_bls_rsp64_rjt_vspec_WORD payload0
  2009. #define xmit_bls_rsp64_rjt_expc_SHIFT 8
  2010. #define xmit_bls_rsp64_rjt_expc_MASK 0x000000ff
  2011. #define xmit_bls_rsp64_rjt_expc_WORD payload0
  2012. #define xmit_bls_rsp64_rjt_rsnc_SHIFT 16
  2013. #define xmit_bls_rsp64_rjt_rsnc_MASK 0x000000ff
  2014. #define xmit_bls_rsp64_rjt_rsnc_WORD payload0
  2015. uint32_t word1;
  2016. #define xmit_bls_rsp64_rxid_SHIFT 0
  2017. #define xmit_bls_rsp64_rxid_MASK 0x0000ffff
  2018. #define xmit_bls_rsp64_rxid_WORD word1
  2019. #define xmit_bls_rsp64_oxid_SHIFT 16
  2020. #define xmit_bls_rsp64_oxid_MASK 0x0000ffff
  2021. #define xmit_bls_rsp64_oxid_WORD word1
  2022. uint32_t word2;
  2023. #define xmit_bls_rsp64_seqcnthi_SHIFT 0
  2024. #define xmit_bls_rsp64_seqcnthi_MASK 0x0000ffff
  2025. #define xmit_bls_rsp64_seqcnthi_WORD word2
  2026. #define xmit_bls_rsp64_seqcntlo_SHIFT 16
  2027. #define xmit_bls_rsp64_seqcntlo_MASK 0x0000ffff
  2028. #define xmit_bls_rsp64_seqcntlo_WORD word2
  2029. uint32_t rsrvd3;
  2030. uint32_t rsrvd4;
  2031. struct wqe_did wqe_dest;
  2032. struct wqe_common wqe_com; /* words 6-11 */
  2033. uint32_t rsvd_12_15[4];
  2034. };
  2035. struct wqe_rctl_dfctl {
  2036. uint32_t word5;
  2037. #define wqe_si_SHIFT 2
  2038. #define wqe_si_MASK 0x000000001
  2039. #define wqe_si_WORD word5
  2040. #define wqe_la_SHIFT 3
  2041. #define wqe_la_MASK 0x000000001
  2042. #define wqe_la_WORD word5
  2043. #define wqe_ls_SHIFT 7
  2044. #define wqe_ls_MASK 0x000000001
  2045. #define wqe_ls_WORD word5
  2046. #define wqe_dfctl_SHIFT 8
  2047. #define wqe_dfctl_MASK 0x0000000ff
  2048. #define wqe_dfctl_WORD word5
  2049. #define wqe_type_SHIFT 16
  2050. #define wqe_type_MASK 0x0000000ff
  2051. #define wqe_type_WORD word5
  2052. #define wqe_rctl_SHIFT 24
  2053. #define wqe_rctl_MASK 0x0000000ff
  2054. #define wqe_rctl_WORD word5
  2055. };
  2056. struct xmit_seq64_wqe {
  2057. struct ulp_bde64 bde;
  2058. uint32_t paylaod_offset;
  2059. uint32_t relative_offset;
  2060. struct wqe_rctl_dfctl wge_ctl;
  2061. struct wqe_common wqe_com; /* words 6-11 */
  2062. /* Note: word10 different REVISIT */
  2063. uint32_t xmit_len;
  2064. uint32_t rsvd_12_15[3];
  2065. };
  2066. struct xmit_bcast64_wqe {
  2067. struct ulp_bde64 bde;
  2068. uint32_t paylaod_len;
  2069. uint32_t rsvd4;
  2070. struct wqe_rctl_dfctl wge_ctl; /* word 5 */
  2071. struct wqe_common wqe_com; /* words 6-11 */
  2072. uint32_t rsvd_12_15[4];
  2073. };
  2074. struct gen_req64_wqe {
  2075. struct ulp_bde64 bde;
  2076. uint32_t command_len;
  2077. uint32_t payload_len;
  2078. struct wqe_rctl_dfctl wge_ctl; /* word 5 */
  2079. struct wqe_common wqe_com; /* words 6-11 */
  2080. uint32_t rsvd_12_15[4];
  2081. };
  2082. struct create_xri_wqe {
  2083. uint32_t rsrvd[5]; /* words 0-4 */
  2084. struct wqe_did wqe_dest; /* word 5 */
  2085. struct wqe_common wqe_com; /* words 6-11 */
  2086. uint32_t rsvd_12_15[4]; /* word 12-15 */
  2087. };
  2088. #define T_REQUEST_TAG 3
  2089. #define T_XRI_TAG 1
  2090. struct abort_cmd_wqe {
  2091. uint32_t rsrvd[3];
  2092. uint32_t word3;
  2093. #define abort_cmd_ia_SHIFT 0
  2094. #define abort_cmd_ia_MASK 0x000000001
  2095. #define abort_cmd_ia_WORD word3
  2096. #define abort_cmd_criteria_SHIFT 8
  2097. #define abort_cmd_criteria_MASK 0x0000000ff
  2098. #define abort_cmd_criteria_WORD word3
  2099. uint32_t rsrvd4;
  2100. uint32_t rsrvd5;
  2101. struct wqe_common wqe_com; /* words 6-11 */
  2102. uint32_t rsvd_12_15[4]; /* word 12-15 */
  2103. };
  2104. struct fcp_iwrite64_wqe {
  2105. struct ulp_bde64 bde;
  2106. uint32_t payload_len;
  2107. uint32_t total_xfer_len;
  2108. uint32_t initial_xfer_len;
  2109. struct wqe_common wqe_com; /* words 6-11 */
  2110. uint32_t rsvd_12_15[4]; /* word 12-15 */
  2111. };
  2112. struct fcp_iread64_wqe {
  2113. struct ulp_bde64 bde;
  2114. uint32_t payload_len; /* word 3 */
  2115. uint32_t total_xfer_len; /* word 4 */
  2116. uint32_t rsrvd5; /* word 5 */
  2117. struct wqe_common wqe_com; /* words 6-11 */
  2118. uint32_t rsvd_12_15[4]; /* word 12-15 */
  2119. };
  2120. struct fcp_icmnd64_wqe {
  2121. struct ulp_bde64 bde; /* words 0-2 */
  2122. uint32_t rsrvd[3]; /* words 3-5 */
  2123. struct wqe_common wqe_com; /* words 6-11 */
  2124. uint32_t rsvd_12_15[4]; /* word 12-15 */
  2125. };
  2126. union lpfc_wqe {
  2127. uint32_t words[16];
  2128. struct lpfc_wqe_generic generic;
  2129. struct fcp_icmnd64_wqe fcp_icmd;
  2130. struct fcp_iread64_wqe fcp_iread;
  2131. struct fcp_iwrite64_wqe fcp_iwrite;
  2132. struct abort_cmd_wqe abort_cmd;
  2133. struct create_xri_wqe create_xri;
  2134. struct xmit_bcast64_wqe xmit_bcast64;
  2135. struct xmit_seq64_wqe xmit_sequence;
  2136. struct xmit_bls_rsp64_wqe xmit_bls_rsp;
  2137. struct xmit_els_rsp64_wqe xmit_els_rsp;
  2138. struct els_request64_wqe els_req;
  2139. struct gen_req64_wqe gen_req;
  2140. };
  2141. #define FCP_COMMAND 0x0
  2142. #define FCP_COMMAND_DATA_OUT 0x1
  2143. #define ELS_COMMAND_NON_FIP 0xC
  2144. #define ELS_COMMAND_FIP 0xD
  2145. #define OTHER_COMMAND 0x8