lpfc_hw4.h 76 KB

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