qla_nx.h 39 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202
  1. /*
  2. * QLogic Fibre Channel HBA Driver
  3. * Copyright (c) 2003-2014 QLogic Corporation
  4. *
  5. * See LICENSE.qla2xxx for copyright and licensing details.
  6. */
  7. #ifndef __QLA_NX_H
  8. #define __QLA_NX_H
  9. /*
  10. * Following are the states of the Phantom. Phantom will set them and
  11. * Host will read to check if the fields are correct.
  12. */
  13. #define PHAN_INITIALIZE_FAILED 0xffff
  14. #define PHAN_INITIALIZE_COMPLETE 0xff01
  15. /* Host writes the following to notify that it has done the init-handshake */
  16. #define PHAN_INITIALIZE_ACK 0xf00f
  17. #define PHAN_PEG_RCV_INITIALIZED 0xff01
  18. /*CRB_RELATED*/
  19. #define QLA82XX_CRB_BASE QLA82XX_CAM_RAM(0x200)
  20. #define QLA82XX_REG(X) (QLA82XX_CRB_BASE+(X))
  21. #define CRB_CMDPEG_STATE QLA82XX_REG(0x50)
  22. #define CRB_RCVPEG_STATE QLA82XX_REG(0x13c)
  23. #define BOOT_LOADER_DIMM_STATUS QLA82XX_REG(0x54)
  24. #define CRB_DMA_SHIFT QLA82XX_REG(0xcc)
  25. #define CRB_TEMP_STATE QLA82XX_REG(0x1b4)
  26. #define QLA82XX_DMA_SHIFT_VALUE 0x55555555
  27. #define QLA82XX_HW_H0_CH_HUB_ADR 0x05
  28. #define QLA82XX_HW_H1_CH_HUB_ADR 0x0E
  29. #define QLA82XX_HW_H2_CH_HUB_ADR 0x03
  30. #define QLA82XX_HW_H3_CH_HUB_ADR 0x01
  31. #define QLA82XX_HW_H4_CH_HUB_ADR 0x06
  32. #define QLA82XX_HW_H5_CH_HUB_ADR 0x07
  33. #define QLA82XX_HW_H6_CH_HUB_ADR 0x08
  34. /* Hub 0 */
  35. #define QLA82XX_HW_MN_CRB_AGT_ADR 0x15
  36. #define QLA82XX_HW_MS_CRB_AGT_ADR 0x25
  37. /* Hub 1 */
  38. #define QLA82XX_HW_PS_CRB_AGT_ADR 0x73
  39. #define QLA82XX_HW_QMS_CRB_AGT_ADR 0x00
  40. #define QLA82XX_HW_RPMX3_CRB_AGT_ADR 0x0b
  41. #define QLA82XX_HW_SQGS0_CRB_AGT_ADR 0x01
  42. #define QLA82XX_HW_SQGS1_CRB_AGT_ADR 0x02
  43. #define QLA82XX_HW_SQGS2_CRB_AGT_ADR 0x03
  44. #define QLA82XX_HW_SQGS3_CRB_AGT_ADR 0x04
  45. #define QLA82XX_HW_C2C0_CRB_AGT_ADR 0x58
  46. #define QLA82XX_HW_C2C1_CRB_AGT_ADR 0x59
  47. #define QLA82XX_HW_C2C2_CRB_AGT_ADR 0x5a
  48. #define QLA82XX_HW_RPMX2_CRB_AGT_ADR 0x0a
  49. #define QLA82XX_HW_RPMX4_CRB_AGT_ADR 0x0c
  50. #define QLA82XX_HW_RPMX7_CRB_AGT_ADR 0x0f
  51. #define QLA82XX_HW_RPMX9_CRB_AGT_ADR 0x12
  52. #define QLA82XX_HW_SMB_CRB_AGT_ADR 0x18
  53. /* Hub 2 */
  54. #define QLA82XX_HW_NIU_CRB_AGT_ADR 0x31
  55. #define QLA82XX_HW_I2C0_CRB_AGT_ADR 0x19
  56. #define QLA82XX_HW_I2C1_CRB_AGT_ADR 0x29
  57. #define QLA82XX_HW_SN_CRB_AGT_ADR 0x10
  58. #define QLA82XX_HW_I2Q_CRB_AGT_ADR 0x20
  59. #define QLA82XX_HW_LPC_CRB_AGT_ADR 0x22
  60. #define QLA82XX_HW_ROMUSB_CRB_AGT_ADR 0x21
  61. #define QLA82XX_HW_QM_CRB_AGT_ADR 0x66
  62. #define QLA82XX_HW_SQG0_CRB_AGT_ADR 0x60
  63. #define QLA82XX_HW_SQG1_CRB_AGT_ADR 0x61
  64. #define QLA82XX_HW_SQG2_CRB_AGT_ADR 0x62
  65. #define QLA82XX_HW_SQG3_CRB_AGT_ADR 0x63
  66. #define QLA82XX_HW_RPMX1_CRB_AGT_ADR 0x09
  67. #define QLA82XX_HW_RPMX5_CRB_AGT_ADR 0x0d
  68. #define QLA82XX_HW_RPMX6_CRB_AGT_ADR 0x0e
  69. #define QLA82XX_HW_RPMX8_CRB_AGT_ADR 0x11
  70. /* Hub 3 */
  71. #define QLA82XX_HW_PH_CRB_AGT_ADR 0x1A
  72. #define QLA82XX_HW_SRE_CRB_AGT_ADR 0x50
  73. #define QLA82XX_HW_EG_CRB_AGT_ADR 0x51
  74. #define QLA82XX_HW_RPMX0_CRB_AGT_ADR 0x08
  75. /* Hub 4 */
  76. #define QLA82XX_HW_PEGN0_CRB_AGT_ADR 0x40
  77. #define QLA82XX_HW_PEGN1_CRB_AGT_ADR 0x41
  78. #define QLA82XX_HW_PEGN2_CRB_AGT_ADR 0x42
  79. #define QLA82XX_HW_PEGN3_CRB_AGT_ADR 0x43
  80. #define QLA82XX_HW_PEGNI_CRB_AGT_ADR 0x44
  81. #define QLA82XX_HW_PEGND_CRB_AGT_ADR 0x45
  82. #define QLA82XX_HW_PEGNC_CRB_AGT_ADR 0x46
  83. #define QLA82XX_HW_PEGR0_CRB_AGT_ADR 0x47
  84. #define QLA82XX_HW_PEGR1_CRB_AGT_ADR 0x48
  85. #define QLA82XX_HW_PEGR2_CRB_AGT_ADR 0x49
  86. #define QLA82XX_HW_PEGR3_CRB_AGT_ADR 0x4a
  87. #define QLA82XX_HW_PEGN4_CRB_AGT_ADR 0x4b
  88. /* Hub 5 */
  89. #define QLA82XX_HW_PEGS0_CRB_AGT_ADR 0x40
  90. #define QLA82XX_HW_PEGS1_CRB_AGT_ADR 0x41
  91. #define QLA82XX_HW_PEGS2_CRB_AGT_ADR 0x42
  92. #define QLA82XX_HW_PEGS3_CRB_AGT_ADR 0x43
  93. #define QLA82XX_HW_PEGSI_CRB_AGT_ADR 0x44
  94. #define QLA82XX_HW_PEGSD_CRB_AGT_ADR 0x45
  95. #define QLA82XX_HW_PEGSC_CRB_AGT_ADR 0x46
  96. /* Hub 6 */
  97. #define QLA82XX_HW_CAS0_CRB_AGT_ADR 0x46
  98. #define QLA82XX_HW_CAS1_CRB_AGT_ADR 0x47
  99. #define QLA82XX_HW_CAS2_CRB_AGT_ADR 0x48
  100. #define QLA82XX_HW_CAS3_CRB_AGT_ADR 0x49
  101. #define QLA82XX_HW_NCM_CRB_AGT_ADR 0x16
  102. #define QLA82XX_HW_TMR_CRB_AGT_ADR 0x17
  103. #define QLA82XX_HW_XDMA_CRB_AGT_ADR 0x05
  104. #define QLA82XX_HW_OCM0_CRB_AGT_ADR 0x06
  105. #define QLA82XX_HW_OCM1_CRB_AGT_ADR 0x07
  106. /* This field defines PCI/X adr [25:20] of agents on the CRB */
  107. /* */
  108. #define QLA82XX_HW_PX_MAP_CRB_PH 0
  109. #define QLA82XX_HW_PX_MAP_CRB_PS 1
  110. #define QLA82XX_HW_PX_MAP_CRB_MN 2
  111. #define QLA82XX_HW_PX_MAP_CRB_MS 3
  112. #define QLA82XX_HW_PX_MAP_CRB_SRE 5
  113. #define QLA82XX_HW_PX_MAP_CRB_NIU 6
  114. #define QLA82XX_HW_PX_MAP_CRB_QMN 7
  115. #define QLA82XX_HW_PX_MAP_CRB_SQN0 8
  116. #define QLA82XX_HW_PX_MAP_CRB_SQN1 9
  117. #define QLA82XX_HW_PX_MAP_CRB_SQN2 10
  118. #define QLA82XX_HW_PX_MAP_CRB_SQN3 11
  119. #define QLA82XX_HW_PX_MAP_CRB_QMS 12
  120. #define QLA82XX_HW_PX_MAP_CRB_SQS0 13
  121. #define QLA82XX_HW_PX_MAP_CRB_SQS1 14
  122. #define QLA82XX_HW_PX_MAP_CRB_SQS2 15
  123. #define QLA82XX_HW_PX_MAP_CRB_SQS3 16
  124. #define QLA82XX_HW_PX_MAP_CRB_PGN0 17
  125. #define QLA82XX_HW_PX_MAP_CRB_PGN1 18
  126. #define QLA82XX_HW_PX_MAP_CRB_PGN2 19
  127. #define QLA82XX_HW_PX_MAP_CRB_PGN3 20
  128. #define QLA82XX_HW_PX_MAP_CRB_PGN4 QLA82XX_HW_PX_MAP_CRB_SQS2
  129. #define QLA82XX_HW_PX_MAP_CRB_PGND 21
  130. #define QLA82XX_HW_PX_MAP_CRB_PGNI 22
  131. #define QLA82XX_HW_PX_MAP_CRB_PGS0 23
  132. #define QLA82XX_HW_PX_MAP_CRB_PGS1 24
  133. #define QLA82XX_HW_PX_MAP_CRB_PGS2 25
  134. #define QLA82XX_HW_PX_MAP_CRB_PGS3 26
  135. #define QLA82XX_HW_PX_MAP_CRB_PGSD 27
  136. #define QLA82XX_HW_PX_MAP_CRB_PGSI 28
  137. #define QLA82XX_HW_PX_MAP_CRB_SN 29
  138. #define QLA82XX_HW_PX_MAP_CRB_EG 31
  139. #define QLA82XX_HW_PX_MAP_CRB_PH2 32
  140. #define QLA82XX_HW_PX_MAP_CRB_PS2 33
  141. #define QLA82XX_HW_PX_MAP_CRB_CAM 34
  142. #define QLA82XX_HW_PX_MAP_CRB_CAS0 35
  143. #define QLA82XX_HW_PX_MAP_CRB_CAS1 36
  144. #define QLA82XX_HW_PX_MAP_CRB_CAS2 37
  145. #define QLA82XX_HW_PX_MAP_CRB_C2C0 38
  146. #define QLA82XX_HW_PX_MAP_CRB_C2C1 39
  147. #define QLA82XX_HW_PX_MAP_CRB_TIMR 40
  148. #define QLA82XX_HW_PX_MAP_CRB_RPMX1 42
  149. #define QLA82XX_HW_PX_MAP_CRB_RPMX2 43
  150. #define QLA82XX_HW_PX_MAP_CRB_RPMX3 44
  151. #define QLA82XX_HW_PX_MAP_CRB_RPMX4 45
  152. #define QLA82XX_HW_PX_MAP_CRB_RPMX5 46
  153. #define QLA82XX_HW_PX_MAP_CRB_RPMX6 47
  154. #define QLA82XX_HW_PX_MAP_CRB_RPMX7 48
  155. #define QLA82XX_HW_PX_MAP_CRB_XDMA 49
  156. #define QLA82XX_HW_PX_MAP_CRB_I2Q 50
  157. #define QLA82XX_HW_PX_MAP_CRB_ROMUSB 51
  158. #define QLA82XX_HW_PX_MAP_CRB_CAS3 52
  159. #define QLA82XX_HW_PX_MAP_CRB_RPMX0 53
  160. #define QLA82XX_HW_PX_MAP_CRB_RPMX8 54
  161. #define QLA82XX_HW_PX_MAP_CRB_RPMX9 55
  162. #define QLA82XX_HW_PX_MAP_CRB_OCM0 56
  163. #define QLA82XX_HW_PX_MAP_CRB_OCM1 57
  164. #define QLA82XX_HW_PX_MAP_CRB_SMB 58
  165. #define QLA82XX_HW_PX_MAP_CRB_I2C0 59
  166. #define QLA82XX_HW_PX_MAP_CRB_I2C1 60
  167. #define QLA82XX_HW_PX_MAP_CRB_LPC 61
  168. #define QLA82XX_HW_PX_MAP_CRB_PGNC 62
  169. #define QLA82XX_HW_PX_MAP_CRB_PGR0 63
  170. #define QLA82XX_HW_PX_MAP_CRB_PGR1 4
  171. #define QLA82XX_HW_PX_MAP_CRB_PGR2 30
  172. #define QLA82XX_HW_PX_MAP_CRB_PGR3 41
  173. /* This field defines CRB adr [31:20] of the agents */
  174. /* */
  175. #define QLA82XX_HW_CRB_HUB_AGT_ADR_MN ((QLA82XX_HW_H0_CH_HUB_ADR << 7) | \
  176. QLA82XX_HW_MN_CRB_AGT_ADR)
  177. #define QLA82XX_HW_CRB_HUB_AGT_ADR_PH ((QLA82XX_HW_H0_CH_HUB_ADR << 7) | \
  178. QLA82XX_HW_PH_CRB_AGT_ADR)
  179. #define QLA82XX_HW_CRB_HUB_AGT_ADR_MS ((QLA82XX_HW_H0_CH_HUB_ADR << 7) | \
  180. QLA82XX_HW_MS_CRB_AGT_ADR)
  181. #define QLA82XX_HW_CRB_HUB_AGT_ADR_PS ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
  182. QLA82XX_HW_PS_CRB_AGT_ADR)
  183. #define QLA82XX_HW_CRB_HUB_AGT_ADR_SS ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
  184. QLA82XX_HW_SS_CRB_AGT_ADR)
  185. #define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX3 ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
  186. QLA82XX_HW_RPMX3_CRB_AGT_ADR)
  187. #define QLA82XX_HW_CRB_HUB_AGT_ADR_QMS ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
  188. QLA82XX_HW_QMS_CRB_AGT_ADR)
  189. #define QLA82XX_HW_CRB_HUB_AGT_ADR_SQS0 ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
  190. QLA82XX_HW_SQGS0_CRB_AGT_ADR)
  191. #define QLA82XX_HW_CRB_HUB_AGT_ADR_SQS1 ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
  192. QLA82XX_HW_SQGS1_CRB_AGT_ADR)
  193. #define QLA82XX_HW_CRB_HUB_AGT_ADR_SQS2 ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
  194. QLA82XX_HW_SQGS2_CRB_AGT_ADR)
  195. #define QLA82XX_HW_CRB_HUB_AGT_ADR_SQS3 ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
  196. QLA82XX_HW_SQGS3_CRB_AGT_ADR)
  197. #define QLA82XX_HW_CRB_HUB_AGT_ADR_C2C0 ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
  198. QLA82XX_HW_C2C0_CRB_AGT_ADR)
  199. #define QLA82XX_HW_CRB_HUB_AGT_ADR_C2C1 ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
  200. QLA82XX_HW_C2C1_CRB_AGT_ADR)
  201. #define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX2 ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
  202. QLA82XX_HW_RPMX2_CRB_AGT_ADR)
  203. #define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX4 ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
  204. QLA82XX_HW_RPMX4_CRB_AGT_ADR)
  205. #define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX7 ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
  206. QLA82XX_HW_RPMX7_CRB_AGT_ADR)
  207. #define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX9 ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
  208. QLA82XX_HW_RPMX9_CRB_AGT_ADR)
  209. #define QLA82XX_HW_CRB_HUB_AGT_ADR_SMB ((QLA82XX_HW_H1_CH_HUB_ADR << 7) | \
  210. QLA82XX_HW_SMB_CRB_AGT_ADR)
  211. #define QLA82XX_HW_CRB_HUB_AGT_ADR_NIU ((QLA82XX_HW_H2_CH_HUB_ADR << 7) | \
  212. QLA82XX_HW_NIU_CRB_AGT_ADR)
  213. #define QLA82XX_HW_CRB_HUB_AGT_ADR_I2C0 ((QLA82XX_HW_H2_CH_HUB_ADR << 7) | \
  214. QLA82XX_HW_I2C0_CRB_AGT_ADR)
  215. #define QLA82XX_HW_CRB_HUB_AGT_ADR_I2C1 ((QLA82XX_HW_H2_CH_HUB_ADR << 7) | \
  216. QLA82XX_HW_I2C1_CRB_AGT_ADR)
  217. #define QLA82XX_HW_CRB_HUB_AGT_ADR_SRE ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
  218. QLA82XX_HW_SRE_CRB_AGT_ADR)
  219. #define QLA82XX_HW_CRB_HUB_AGT_ADR_EG ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
  220. QLA82XX_HW_EG_CRB_AGT_ADR)
  221. #define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX0 ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
  222. QLA82XX_HW_RPMX0_CRB_AGT_ADR)
  223. #define QLA82XX_HW_CRB_HUB_AGT_ADR_QMN ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
  224. QLA82XX_HW_QM_CRB_AGT_ADR)
  225. #define QLA82XX_HW_CRB_HUB_AGT_ADR_SQN0 ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
  226. QLA82XX_HW_SQG0_CRB_AGT_ADR)
  227. #define QLA82XX_HW_CRB_HUB_AGT_ADR_SQN1 ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
  228. QLA82XX_HW_SQG1_CRB_AGT_ADR)
  229. #define QLA82XX_HW_CRB_HUB_AGT_ADR_SQN2 ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
  230. QLA82XX_HW_SQG2_CRB_AGT_ADR)
  231. #define QLA82XX_HW_CRB_HUB_AGT_ADR_SQN3 ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
  232. QLA82XX_HW_SQG3_CRB_AGT_ADR)
  233. #define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX1 ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
  234. QLA82XX_HW_RPMX1_CRB_AGT_ADR)
  235. #define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX5 ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
  236. QLA82XX_HW_RPMX5_CRB_AGT_ADR)
  237. #define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX6 ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
  238. QLA82XX_HW_RPMX6_CRB_AGT_ADR)
  239. #define QLA82XX_HW_CRB_HUB_AGT_ADR_RPMX8 ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
  240. QLA82XX_HW_RPMX8_CRB_AGT_ADR)
  241. #define QLA82XX_HW_CRB_HUB_AGT_ADR_CAS0 ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
  242. QLA82XX_HW_CAS0_CRB_AGT_ADR)
  243. #define QLA82XX_HW_CRB_HUB_AGT_ADR_CAS1 ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
  244. QLA82XX_HW_CAS1_CRB_AGT_ADR)
  245. #define QLA82XX_HW_CRB_HUB_AGT_ADR_CAS2 ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
  246. QLA82XX_HW_CAS2_CRB_AGT_ADR)
  247. #define QLA82XX_HW_CRB_HUB_AGT_ADR_CAS3 ((QLA82XX_HW_H3_CH_HUB_ADR << 7) | \
  248. QLA82XX_HW_CAS3_CRB_AGT_ADR)
  249. #define QLA82XX_HW_CRB_HUB_AGT_ADR_PGNI ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
  250. QLA82XX_HW_PEGNI_CRB_AGT_ADR)
  251. #define QLA82XX_HW_CRB_HUB_AGT_ADR_PGND ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
  252. QLA82XX_HW_PEGND_CRB_AGT_ADR)
  253. #define QLA82XX_HW_CRB_HUB_AGT_ADR_PGN0 ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
  254. QLA82XX_HW_PEGN0_CRB_AGT_ADR)
  255. #define QLA82XX_HW_CRB_HUB_AGT_ADR_PGN1 ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
  256. QLA82XX_HW_PEGN1_CRB_AGT_ADR)
  257. #define QLA82XX_HW_CRB_HUB_AGT_ADR_PGN2 ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
  258. QLA82XX_HW_PEGN2_CRB_AGT_ADR)
  259. #define QLA82XX_HW_CRB_HUB_AGT_ADR_PGN3 ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
  260. QLA82XX_HW_PEGN3_CRB_AGT_ADR)
  261. #define QLA82XX_HW_CRB_HUB_AGT_ADR_PGN4 ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
  262. QLA82XX_HW_PEGN4_CRB_AGT_ADR)
  263. #define QLA82XX_HW_CRB_HUB_AGT_ADR_PGNC ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
  264. QLA82XX_HW_PEGNC_CRB_AGT_ADR)
  265. #define QLA82XX_HW_CRB_HUB_AGT_ADR_PGR0 ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
  266. QLA82XX_HW_PEGR0_CRB_AGT_ADR)
  267. #define QLA82XX_HW_CRB_HUB_AGT_ADR_PGR1 ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
  268. QLA82XX_HW_PEGR1_CRB_AGT_ADR)
  269. #define QLA82XX_HW_CRB_HUB_AGT_ADR_PGR2 ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
  270. QLA82XX_HW_PEGR2_CRB_AGT_ADR)
  271. #define QLA82XX_HW_CRB_HUB_AGT_ADR_PGR3 ((QLA82XX_HW_H4_CH_HUB_ADR << 7) | \
  272. QLA82XX_HW_PEGR3_CRB_AGT_ADR)
  273. #define QLA82XX_HW_CRB_HUB_AGT_ADR_PGSI ((QLA82XX_HW_H5_CH_HUB_ADR << 7) | \
  274. QLA82XX_HW_PEGSI_CRB_AGT_ADR)
  275. #define QLA82XX_HW_CRB_HUB_AGT_ADR_PGSD ((QLA82XX_HW_H5_CH_HUB_ADR << 7) | \
  276. QLA82XX_HW_PEGSD_CRB_AGT_ADR)
  277. #define QLA82XX_HW_CRB_HUB_AGT_ADR_PGS0 ((QLA82XX_HW_H5_CH_HUB_ADR << 7) | \
  278. QLA82XX_HW_PEGS0_CRB_AGT_ADR)
  279. #define QLA82XX_HW_CRB_HUB_AGT_ADR_PGS1 ((QLA82XX_HW_H5_CH_HUB_ADR << 7) | \
  280. QLA82XX_HW_PEGS1_CRB_AGT_ADR)
  281. #define QLA82XX_HW_CRB_HUB_AGT_ADR_PGS2 ((QLA82XX_HW_H5_CH_HUB_ADR << 7) | \
  282. QLA82XX_HW_PEGS2_CRB_AGT_ADR)
  283. #define QLA82XX_HW_CRB_HUB_AGT_ADR_PGS3 ((QLA82XX_HW_H5_CH_HUB_ADR << 7) | \
  284. QLA82XX_HW_PEGS3_CRB_AGT_ADR)
  285. #define QLA82XX_HW_CRB_HUB_AGT_ADR_PGSC ((QLA82XX_HW_H5_CH_HUB_ADR << 7) | \
  286. QLA82XX_HW_PEGSC_CRB_AGT_ADR)
  287. #define QLA82XX_HW_CRB_HUB_AGT_ADR_CAM ((QLA82XX_HW_H6_CH_HUB_ADR << 7) | \
  288. QLA82XX_HW_NCM_CRB_AGT_ADR)
  289. #define QLA82XX_HW_CRB_HUB_AGT_ADR_TIMR ((QLA82XX_HW_H6_CH_HUB_ADR << 7) | \
  290. QLA82XX_HW_TMR_CRB_AGT_ADR)
  291. #define QLA82XX_HW_CRB_HUB_AGT_ADR_XDMA ((QLA82XX_HW_H6_CH_HUB_ADR << 7) | \
  292. QLA82XX_HW_XDMA_CRB_AGT_ADR)
  293. #define QLA82XX_HW_CRB_HUB_AGT_ADR_SN ((QLA82XX_HW_H6_CH_HUB_ADR << 7) | \
  294. QLA82XX_HW_SN_CRB_AGT_ADR)
  295. #define QLA82XX_HW_CRB_HUB_AGT_ADR_I2Q ((QLA82XX_HW_H6_CH_HUB_ADR << 7) | \
  296. QLA82XX_HW_I2Q_CRB_AGT_ADR)
  297. #define QLA82XX_HW_CRB_HUB_AGT_ADR_ROMUSB ((QLA82XX_HW_H6_CH_HUB_ADR << 7) | \
  298. QLA82XX_HW_ROMUSB_CRB_AGT_ADR)
  299. #define QLA82XX_HW_CRB_HUB_AGT_ADR_OCM0 ((QLA82XX_HW_H6_CH_HUB_ADR << 7) | \
  300. QLA82XX_HW_OCM0_CRB_AGT_ADR)
  301. #define QLA82XX_HW_CRB_HUB_AGT_ADR_OCM1 ((QLA82XX_HW_H6_CH_HUB_ADR << 7) | \
  302. QLA82XX_HW_OCM1_CRB_AGT_ADR)
  303. #define QLA82XX_HW_CRB_HUB_AGT_ADR_LPC ((QLA82XX_HW_H6_CH_HUB_ADR << 7) | \
  304. QLA82XX_HW_LPC_CRB_AGT_ADR)
  305. #define ROMUSB_GLB (QLA82XX_CRB_ROMUSB + 0x00000)
  306. #define QLA82XX_ROMUSB_GLB_PEGTUNE_DONE (ROMUSB_GLB + 0x005c)
  307. #define QLA82XX_ROMUSB_GLB_STATUS (ROMUSB_GLB + 0x0004)
  308. #define QLA82XX_ROMUSB_GLB_SW_RESET (ROMUSB_GLB + 0x0008)
  309. #define QLA82XX_ROMUSB_ROM_ADDRESS (ROMUSB_ROM + 0x0008)
  310. #define QLA82XX_ROMUSB_ROM_WDATA (ROMUSB_ROM + 0x000c)
  311. #define QLA82XX_ROMUSB_ROM_ABYTE_CNT (ROMUSB_ROM + 0x0010)
  312. #define QLA82XX_ROMUSB_ROM_DUMMY_BYTE_CNT (ROMUSB_ROM + 0x0014)
  313. #define QLA82XX_ROMUSB_ROM_RDATA (ROMUSB_ROM + 0x0018)
  314. #define ROMUSB_ROM (QLA82XX_CRB_ROMUSB + 0x10000)
  315. #define QLA82XX_ROMUSB_ROM_INSTR_OPCODE (ROMUSB_ROM + 0x0004)
  316. #define QLA82XX_ROMUSB_GLB_CAS_RST (ROMUSB_GLB + 0x0038)
  317. #define QLA82XX_PCI_CRB_WINDOWSIZE 0x00100000 /* all are 1MB windows */
  318. #define QLA82XX_PCI_CRB_WINDOW(A) \
  319. (QLA82XX_PCI_CRBSPACE + (A)*QLA82XX_PCI_CRB_WINDOWSIZE)
  320. #define QLA82XX_CRB_C2C_0 \
  321. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_C2C0)
  322. #define QLA82XX_CRB_C2C_1 \
  323. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_C2C1)
  324. #define QLA82XX_CRB_C2C_2 \
  325. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_C2C2)
  326. #define QLA82XX_CRB_CAM \
  327. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_CAM)
  328. #define QLA82XX_CRB_CASPER \
  329. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_CAS)
  330. #define QLA82XX_CRB_CASPER_0 \
  331. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_CAS0)
  332. #define QLA82XX_CRB_CASPER_1 \
  333. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_CAS1)
  334. #define QLA82XX_CRB_CASPER_2 \
  335. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_CAS2)
  336. #define QLA82XX_CRB_DDR_MD \
  337. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_MS)
  338. #define QLA82XX_CRB_DDR_NET \
  339. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_MN)
  340. #define QLA82XX_CRB_EPG \
  341. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_EG)
  342. #define QLA82XX_CRB_I2Q \
  343. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_I2Q)
  344. #define QLA82XX_CRB_NIU \
  345. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_NIU)
  346. #define QLA82XX_CRB_PCIX_HOST \
  347. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PH)
  348. #define QLA82XX_CRB_PCIX_HOST2 \
  349. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PH2)
  350. #define QLA82XX_CRB_PCIX_MD \
  351. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PS)
  352. #define QLA82XX_CRB_PCIE \
  353. QLA82XX_CRB_PCIX_MD
  354. /* window 1 pcie slot */
  355. #define QLA82XX_CRB_PCIE2 \
  356. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PS2)
  357. #define QLA82XX_CRB_PEG_MD_0 \
  358. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGS0)
  359. #define QLA82XX_CRB_PEG_MD_1 \
  360. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGS1)
  361. #define QLA82XX_CRB_PEG_MD_2 \
  362. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGS2)
  363. #define QLA82XX_CRB_PEG_MD_3 \
  364. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGS3)
  365. #define QLA82XX_CRB_PEG_MD_3 \
  366. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGS3)
  367. #define QLA82XX_CRB_PEG_MD_D \
  368. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGSD)
  369. #define QLA82XX_CRB_PEG_MD_I \
  370. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGSI)
  371. #define QLA82XX_CRB_PEG_NET_0 \
  372. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGN0)
  373. #define QLA82XX_CRB_PEG_NET_1 \
  374. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGN1)
  375. #define QLA82XX_CRB_PEG_NET_2 \
  376. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGN2)
  377. #define QLA82XX_CRB_PEG_NET_3 \
  378. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGN3)
  379. #define QLA82XX_CRB_PEG_NET_4 \
  380. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGN4)
  381. #define QLA82XX_CRB_PEG_NET_D \
  382. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGND)
  383. #define QLA82XX_CRB_PEG_NET_I \
  384. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_PGNI)
  385. #define QLA82XX_CRB_PQM_MD \
  386. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_QMS)
  387. #define QLA82XX_CRB_PQM_NET \
  388. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_QMN)
  389. #define QLA82XX_CRB_QDR_MD \
  390. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SS)
  391. #define QLA82XX_CRB_QDR_NET \
  392. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SN)
  393. #define QLA82XX_CRB_ROMUSB \
  394. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_ROMUSB)
  395. #define QLA82XX_CRB_RPMX_0 \
  396. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_RPMX0)
  397. #define QLA82XX_CRB_RPMX_1 \
  398. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_RPMX1)
  399. #define QLA82XX_CRB_RPMX_2 \
  400. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_RPMX2)
  401. #define QLA82XX_CRB_RPMX_3 \
  402. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_RPMX3)
  403. #define QLA82XX_CRB_RPMX_4 \
  404. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_RPMX4)
  405. #define QLA82XX_CRB_RPMX_5 \
  406. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_RPMX5)
  407. #define QLA82XX_CRB_RPMX_6 \
  408. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_RPMX6)
  409. #define QLA82XX_CRB_RPMX_7 \
  410. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_RPMX7)
  411. #define QLA82XX_CRB_SQM_MD_0 \
  412. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SQS0)
  413. #define QLA82XX_CRB_SQM_MD_1 \
  414. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SQS1)
  415. #define QLA82XX_CRB_SQM_MD_2 \
  416. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SQS2)
  417. #define QLA82XX_CRB_SQM_MD_3 \
  418. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SQS3)
  419. #define QLA82XX_CRB_SQM_NET_0 \
  420. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SQN0)
  421. #define QLA82XX_CRB_SQM_NET_1 \
  422. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SQN1)
  423. #define QLA82XX_CRB_SQM_NET_2 \
  424. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SQN2)
  425. #define QLA82XX_CRB_SQM_NET_3 \
  426. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SQN3)
  427. #define QLA82XX_CRB_SRE \
  428. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SRE)
  429. #define QLA82XX_CRB_TIMER \
  430. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_TIMR)
  431. #define QLA82XX_CRB_XDMA \
  432. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_XDMA)
  433. #define QLA82XX_CRB_I2C0 \
  434. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_I2C0)
  435. #define QLA82XX_CRB_I2C1 \
  436. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_I2C1)
  437. #define QLA82XX_CRB_OCM0 \
  438. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_OCM0)
  439. #define QLA82XX_CRB_SMB \
  440. QLA82XX_PCI_CRB_WINDOW(QLA82XX_HW_PX_MAP_CRB_SMB)
  441. #define QLA82XX_CRB_MAX \
  442. QLA82XX_PCI_CRB_WINDOW(64)
  443. /*
  444. * ====================== BASE ADDRESSES ON-CHIP ======================
  445. * Base addresses of major components on-chip.
  446. * ====================== BASE ADDRESSES ON-CHIP ======================
  447. */
  448. #define QLA82XX_ADDR_DDR_NET (0x0000000000000000ULL)
  449. #define QLA82XX_ADDR_DDR_NET_MAX (0x000000000fffffffULL)
  450. /* Imbus address bit used to indicate a host address. This bit is
  451. * eliminated by the pcie bar and bar select before presentation
  452. * over pcie. */
  453. /* host memory via IMBUS */
  454. #define QLA82XX_P2_ADDR_PCIE (0x0000000800000000ULL)
  455. #define QLA82XX_P3_ADDR_PCIE (0x0000008000000000ULL)
  456. #define QLA82XX_ADDR_PCIE_MAX (0x0000000FFFFFFFFFULL)
  457. #define QLA82XX_ADDR_OCM0 (0x0000000200000000ULL)
  458. #define QLA82XX_ADDR_OCM0_MAX (0x00000002000fffffULL)
  459. #define QLA82XX_ADDR_OCM1 (0x0000000200400000ULL)
  460. #define QLA82XX_ADDR_OCM1_MAX (0x00000002004fffffULL)
  461. #define QLA82XX_ADDR_QDR_NET (0x0000000300000000ULL)
  462. #define QLA82XX_P3_ADDR_QDR_NET_MAX (0x0000000303ffffffULL)
  463. #define QLA82XX_PCI_CRBSPACE (unsigned long)0x06000000
  464. #define QLA82XX_PCI_DIRECT_CRB (unsigned long)0x04400000
  465. #define QLA82XX_PCI_CAMQM (unsigned long)0x04800000
  466. #define QLA82XX_PCI_CAMQM_MAX (unsigned long)0x04ffffff
  467. #define QLA82XX_PCI_DDR_NET (unsigned long)0x00000000
  468. #define QLA82XX_PCI_QDR_NET (unsigned long)0x04000000
  469. #define QLA82XX_PCI_QDR_NET_MAX (unsigned long)0x043fffff
  470. /*
  471. * Register offsets for MN
  472. */
  473. #define MIU_CONTROL (0x000)
  474. #define MIU_TAG (0x004)
  475. #define MIU_TEST_AGT_CTRL (0x090)
  476. #define MIU_TEST_AGT_ADDR_LO (0x094)
  477. #define MIU_TEST_AGT_ADDR_HI (0x098)
  478. #define MIU_TEST_AGT_WRDATA_LO (0x0a0)
  479. #define MIU_TEST_AGT_WRDATA_HI (0x0a4)
  480. #define MIU_TEST_AGT_WRDATA(i) (0x0a0+(4*(i)))
  481. #define MIU_TEST_AGT_RDDATA_LO (0x0a8)
  482. #define MIU_TEST_AGT_RDDATA_HI (0x0ac)
  483. #define MIU_TEST_AGT_RDDATA(i) (0x0a8+(4*(i)))
  484. #define MIU_TEST_AGT_ADDR_MASK 0xfffffff8
  485. #define MIU_TEST_AGT_UPPER_ADDR(off) (0)
  486. /* MIU_TEST_AGT_CTRL flags. work for SIU as well */
  487. #define MIU_TA_CTL_START 1
  488. #define MIU_TA_CTL_ENABLE 2
  489. #define MIU_TA_CTL_WRITE 4
  490. #define MIU_TA_CTL_BUSY 8
  491. /*CAM RAM */
  492. # define QLA82XX_CAM_RAM_BASE (QLA82XX_CRB_CAM + 0x02000)
  493. # define QLA82XX_CAM_RAM(reg) (QLA82XX_CAM_RAM_BASE + (reg))
  494. #define QLA82XX_PORT_MODE_ADDR (QLA82XX_CAM_RAM(0x24))
  495. #define QLA82XX_PEG_HALT_STATUS1 (QLA82XX_CAM_RAM(0xa8))
  496. #define QLA82XX_PEG_HALT_STATUS2 (QLA82XX_CAM_RAM(0xac))
  497. #define QLA82XX_PEG_ALIVE_COUNTER (QLA82XX_CAM_RAM(0xb0))
  498. #define QLA82XX_CAMRAM_DB1 (QLA82XX_CAM_RAM(0x1b8))
  499. #define QLA82XX_CAMRAM_DB2 (QLA82XX_CAM_RAM(0x1bc))
  500. #define HALT_STATUS_UNRECOVERABLE 0x80000000
  501. #define HALT_STATUS_RECOVERABLE 0x40000000
  502. /* Driver Coexistence Defines */
  503. #define QLA82XX_CRB_DRV_ACTIVE (QLA82XX_CAM_RAM(0x138))
  504. #define QLA82XX_CRB_DEV_STATE (QLA82XX_CAM_RAM(0x140))
  505. #define QLA82XX_CRB_DRV_STATE (QLA82XX_CAM_RAM(0x144))
  506. #define QLA82XX_CRB_DRV_SCRATCH (QLA82XX_CAM_RAM(0x148))
  507. #define QLA82XX_CRB_DEV_PART_INFO (QLA82XX_CAM_RAM(0x14c))
  508. #define QLA82XX_CRB_DRV_IDC_VERSION (QLA82XX_CAM_RAM(0x174))
  509. /* Every driver should use these Device State */
  510. #define QLA8XXX_DEV_COLD 1
  511. #define QLA8XXX_DEV_INITIALIZING 2
  512. #define QLA8XXX_DEV_READY 3
  513. #define QLA8XXX_DEV_NEED_RESET 4
  514. #define QLA8XXX_DEV_NEED_QUIESCENT 5
  515. #define QLA8XXX_DEV_FAILED 6
  516. #define QLA8XXX_DEV_QUIESCENT 7
  517. #define MAX_STATES 8 /* Increment if new state added */
  518. #define QLA8XXX_BAD_VALUE 0xbad0bad0
  519. #define QLA82XX_IDC_VERSION 1
  520. #define QLA82XX_ROM_DEV_INIT_TIMEOUT 30
  521. #define QLA82XX_ROM_DRV_RESET_ACK_TIMEOUT 10
  522. #define QLA82XX_ROM_LOCK_ID (QLA82XX_CAM_RAM(0x100))
  523. #define QLA82XX_CRB_WIN_LOCK_ID (QLA82XX_CAM_RAM(0x124))
  524. #define QLA82XX_FW_VERSION_MAJOR (QLA82XX_CAM_RAM(0x150))
  525. #define QLA82XX_FW_VERSION_MINOR (QLA82XX_CAM_RAM(0x154))
  526. #define QLA82XX_FW_VERSION_SUB (QLA82XX_CAM_RAM(0x158))
  527. #define QLA82XX_PCIE_REG(reg) (QLA82XX_CRB_PCIE + (reg))
  528. #define PCIE_SETUP_FUNCTION (0x12040)
  529. #define PCIE_SETUP_FUNCTION2 (0x12048)
  530. #define QLA82XX_PCIX_PS_REG(reg) (QLA82XX_CRB_PCIX_MD + (reg))
  531. #define QLA82XX_PCIX_PS2_REG(reg) (QLA82XX_CRB_PCIE2 + (reg))
  532. #define PCIE_SEM2_LOCK (0x1c010) /* Flash lock */
  533. #define PCIE_SEM2_UNLOCK (0x1c014) /* Flash unlock */
  534. #define PCIE_SEM5_LOCK (0x1c028) /* Coexistence lock */
  535. #define PCIE_SEM5_UNLOCK (0x1c02c) /* Coexistence unlock */
  536. #define PCIE_SEM7_LOCK (0x1c038) /* crb win lock */
  537. #define PCIE_SEM7_UNLOCK (0x1c03c) /* crbwin unlock*/
  538. /* Different drive state */
  539. #define QLA82XX_DRVST_NOT_RDY 0
  540. #define QLA82XX_DRVST_RST_RDY 1
  541. #define QLA82XX_DRVST_QSNT_RDY 2
  542. /* Different drive active state */
  543. #define QLA82XX_DRV_NOT_ACTIVE 0
  544. #define QLA82XX_DRV_ACTIVE 1
  545. /*
  546. * The PCI VendorID and DeviceID for our board.
  547. */
  548. #define PCI_DEVICE_ID_QLOGIC_ISP8021 0x8021
  549. #define PCI_DEVICE_ID_QLOGIC_ISP8044 0x8044
  550. #define QLA82XX_MSIX_TBL_SPACE 8192
  551. #define QLA82XX_PCI_REG_MSIX_TBL 0x44
  552. #define QLA82XX_PCI_MSIX_CONTROL 0x40
  553. struct crb_128M_2M_sub_block_map {
  554. unsigned valid;
  555. unsigned start_128M;
  556. unsigned end_128M;
  557. unsigned start_2M;
  558. };
  559. struct crb_128M_2M_block_map {
  560. struct crb_128M_2M_sub_block_map sub_block[16];
  561. };
  562. struct crb_addr_pair {
  563. long addr;
  564. long data;
  565. };
  566. #define ADDR_ERROR ((unsigned long) 0xffffffff)
  567. #define MAX_CTL_CHECK 1000
  568. /***************************************************************************
  569. * PCI related defines.
  570. **************************************************************************/
  571. /*
  572. * Interrupt related defines.
  573. */
  574. #define PCIX_TARGET_STATUS (0x10118)
  575. #define PCIX_TARGET_STATUS_F1 (0x10160)
  576. #define PCIX_TARGET_STATUS_F2 (0x10164)
  577. #define PCIX_TARGET_STATUS_F3 (0x10168)
  578. #define PCIX_TARGET_STATUS_F4 (0x10360)
  579. #define PCIX_TARGET_STATUS_F5 (0x10364)
  580. #define PCIX_TARGET_STATUS_F6 (0x10368)
  581. #define PCIX_TARGET_STATUS_F7 (0x1036c)
  582. #define PCIX_TARGET_MASK (0x10128)
  583. #define PCIX_TARGET_MASK_F1 (0x10170)
  584. #define PCIX_TARGET_MASK_F2 (0x10174)
  585. #define PCIX_TARGET_MASK_F3 (0x10178)
  586. #define PCIX_TARGET_MASK_F4 (0x10370)
  587. #define PCIX_TARGET_MASK_F5 (0x10374)
  588. #define PCIX_TARGET_MASK_F6 (0x10378)
  589. #define PCIX_TARGET_MASK_F7 (0x1037c)
  590. /*
  591. * Message Signaled Interrupts
  592. */
  593. #define PCIX_MSI_F0 (0x13000)
  594. #define PCIX_MSI_F1 (0x13004)
  595. #define PCIX_MSI_F2 (0x13008)
  596. #define PCIX_MSI_F3 (0x1300c)
  597. #define PCIX_MSI_F4 (0x13010)
  598. #define PCIX_MSI_F5 (0x13014)
  599. #define PCIX_MSI_F6 (0x13018)
  600. #define PCIX_MSI_F7 (0x1301c)
  601. #define PCIX_MSI_F(FUNC) (0x13000 + ((FUNC) * 4))
  602. #define PCIX_INT_VECTOR (0x10100)
  603. #define PCIX_INT_MASK (0x10104)
  604. /*
  605. * Interrupt state machine and other bits.
  606. */
  607. #define PCIE_MISCCFG_RC (0x1206c)
  608. #define ISR_INT_TARGET_STATUS \
  609. (QLA82XX_PCIX_PS_REG(PCIX_TARGET_STATUS))
  610. #define ISR_INT_TARGET_STATUS_F1 \
  611. (QLA82XX_PCIX_PS_REG(PCIX_TARGET_STATUS_F1))
  612. #define ISR_INT_TARGET_STATUS_F2 \
  613. (QLA82XX_PCIX_PS_REG(PCIX_TARGET_STATUS_F2))
  614. #define ISR_INT_TARGET_STATUS_F3 \
  615. (QLA82XX_PCIX_PS_REG(PCIX_TARGET_STATUS_F3))
  616. #define ISR_INT_TARGET_STATUS_F4 \
  617. (QLA82XX_PCIX_PS_REG(PCIX_TARGET_STATUS_F4))
  618. #define ISR_INT_TARGET_STATUS_F5 \
  619. (QLA82XX_PCIX_PS_REG(PCIX_TARGET_STATUS_F5))
  620. #define ISR_INT_TARGET_STATUS_F6 \
  621. (QLA82XX_PCIX_PS_REG(PCIX_TARGET_STATUS_F6))
  622. #define ISR_INT_TARGET_STATUS_F7 \
  623. (QLA82XX_PCIX_PS_REG(PCIX_TARGET_STATUS_F7))
  624. #define ISR_INT_TARGET_MASK \
  625. (QLA82XX_PCIX_PS_REG(PCIX_TARGET_MASK))
  626. #define ISR_INT_TARGET_MASK_F1 \
  627. (QLA82XX_PCIX_PS_REG(PCIX_TARGET_MASK_F1))
  628. #define ISR_INT_TARGET_MASK_F2 \
  629. (QLA82XX_PCIX_PS_REG(PCIX_TARGET_MASK_F2))
  630. #define ISR_INT_TARGET_MASK_F3 \
  631. (QLA82XX_PCIX_PS_REG(PCIX_TARGET_MASK_F3))
  632. #define ISR_INT_TARGET_MASK_F4 \
  633. (QLA82XX_PCIX_PS_REG(PCIX_TARGET_MASK_F4))
  634. #define ISR_INT_TARGET_MASK_F5 \
  635. (QLA82XX_PCIX_PS_REG(PCIX_TARGET_MASK_F5))
  636. #define ISR_INT_TARGET_MASK_F6 \
  637. (QLA82XX_PCIX_PS_REG(PCIX_TARGET_MASK_F6))
  638. #define ISR_INT_TARGET_MASK_F7 \
  639. (QLA82XX_PCIX_PS_REG(PCIX_TARGET_MASK_F7))
  640. #define ISR_INT_VECTOR \
  641. (QLA82XX_PCIX_PS_REG(PCIX_INT_VECTOR))
  642. #define ISR_INT_MASK \
  643. (QLA82XX_PCIX_PS_REG(PCIX_INT_MASK))
  644. #define ISR_INT_STATE_REG \
  645. (QLA82XX_PCIX_PS_REG(PCIE_MISCCFG_RC))
  646. #define ISR_MSI_INT_TRIGGER(FUNC) \
  647. (QLA82XX_PCIX_PS_REG(PCIX_MSI_F(FUNC)))
  648. #define ISR_IS_LEGACY_INTR_IDLE(VAL) (((VAL) & 0x300) == 0)
  649. #define ISR_IS_LEGACY_INTR_TRIGGERED(VAL) (((VAL) & 0x300) == 0x200)
  650. /*
  651. * PCI Interrupt Vector Values.
  652. */
  653. #define PCIX_INT_VECTOR_BIT_F0 0x0080
  654. #define PCIX_INT_VECTOR_BIT_F1 0x0100
  655. #define PCIX_INT_VECTOR_BIT_F2 0x0200
  656. #define PCIX_INT_VECTOR_BIT_F3 0x0400
  657. #define PCIX_INT_VECTOR_BIT_F4 0x0800
  658. #define PCIX_INT_VECTOR_BIT_F5 0x1000
  659. #define PCIX_INT_VECTOR_BIT_F6 0x2000
  660. #define PCIX_INT_VECTOR_BIT_F7 0x4000
  661. struct qla82xx_legacy_intr_set {
  662. uint32_t int_vec_bit;
  663. uint32_t tgt_status_reg;
  664. uint32_t tgt_mask_reg;
  665. uint32_t pci_int_reg;
  666. };
  667. #define QLA82XX_LEGACY_INTR_CONFIG \
  668. { \
  669. { \
  670. .int_vec_bit = PCIX_INT_VECTOR_BIT_F0, \
  671. .tgt_status_reg = ISR_INT_TARGET_STATUS, \
  672. .tgt_mask_reg = ISR_INT_TARGET_MASK, \
  673. .pci_int_reg = ISR_MSI_INT_TRIGGER(0) }, \
  674. \
  675. { \
  676. .int_vec_bit = PCIX_INT_VECTOR_BIT_F1, \
  677. .tgt_status_reg = ISR_INT_TARGET_STATUS_F1, \
  678. .tgt_mask_reg = ISR_INT_TARGET_MASK_F1, \
  679. .pci_int_reg = ISR_MSI_INT_TRIGGER(1) }, \
  680. \
  681. { \
  682. .int_vec_bit = PCIX_INT_VECTOR_BIT_F2, \
  683. .tgt_status_reg = ISR_INT_TARGET_STATUS_F2, \
  684. .tgt_mask_reg = ISR_INT_TARGET_MASK_F2, \
  685. .pci_int_reg = ISR_MSI_INT_TRIGGER(2) }, \
  686. \
  687. { \
  688. .int_vec_bit = PCIX_INT_VECTOR_BIT_F3, \
  689. .tgt_status_reg = ISR_INT_TARGET_STATUS_F3, \
  690. .tgt_mask_reg = ISR_INT_TARGET_MASK_F3, \
  691. .pci_int_reg = ISR_MSI_INT_TRIGGER(3) }, \
  692. \
  693. { \
  694. .int_vec_bit = PCIX_INT_VECTOR_BIT_F4, \
  695. .tgt_status_reg = ISR_INT_TARGET_STATUS_F4, \
  696. .tgt_mask_reg = ISR_INT_TARGET_MASK_F4, \
  697. .pci_int_reg = ISR_MSI_INT_TRIGGER(4) }, \
  698. \
  699. { \
  700. .int_vec_bit = PCIX_INT_VECTOR_BIT_F5, \
  701. .tgt_status_reg = ISR_INT_TARGET_STATUS_F5, \
  702. .tgt_mask_reg = ISR_INT_TARGET_MASK_F5, \
  703. .pci_int_reg = ISR_MSI_INT_TRIGGER(5) }, \
  704. \
  705. { \
  706. .int_vec_bit = PCIX_INT_VECTOR_BIT_F6, \
  707. .tgt_status_reg = ISR_INT_TARGET_STATUS_F6, \
  708. .tgt_mask_reg = ISR_INT_TARGET_MASK_F6, \
  709. .pci_int_reg = ISR_MSI_INT_TRIGGER(6) }, \
  710. \
  711. { \
  712. .int_vec_bit = PCIX_INT_VECTOR_BIT_F7, \
  713. .tgt_status_reg = ISR_INT_TARGET_STATUS_F7, \
  714. .tgt_mask_reg = ISR_INT_TARGET_MASK_F7, \
  715. .pci_int_reg = ISR_MSI_INT_TRIGGER(7) }, \
  716. }
  717. #define BRDCFG_START 0x4000
  718. #define BOOTLD_START 0x10000
  719. #define IMAGE_START 0x100000
  720. #define FLASH_ADDR_START 0x43000
  721. /* Magic number to let user know flash is programmed */
  722. #define QLA82XX_BDINFO_MAGIC 0x12345678
  723. #define QLA82XX_FW_MAGIC_OFFSET (BRDCFG_START + 0x128)
  724. #define FW_SIZE_OFFSET (0x3e840c)
  725. #define QLA82XX_FW_MIN_SIZE 0x3fffff
  726. /* UNIFIED ROMIMAGE START */
  727. #define QLA82XX_URI_FW_MIN_SIZE 0xc8000
  728. #define QLA82XX_URI_DIR_SECT_PRODUCT_TBL 0x0
  729. #define QLA82XX_URI_DIR_SECT_BOOTLD 0x6
  730. #define QLA82XX_URI_DIR_SECT_FW 0x7
  731. /* Offsets */
  732. #define QLA82XX_URI_CHIP_REV_OFF 10
  733. #define QLA82XX_URI_FLAGS_OFF 11
  734. #define QLA82XX_URI_BIOS_VERSION_OFF 12
  735. #define QLA82XX_URI_BOOTLD_IDX_OFF 27
  736. #define QLA82XX_URI_FIRMWARE_IDX_OFF 29
  737. struct qla82xx_uri_table_desc{
  738. uint32_t findex;
  739. uint32_t num_entries;
  740. uint32_t entry_size;
  741. uint32_t reserved[5];
  742. };
  743. struct qla82xx_uri_data_desc{
  744. uint32_t findex;
  745. uint32_t size;
  746. uint32_t reserved[5];
  747. };
  748. /* UNIFIED ROMIMAGE END */
  749. #define QLA82XX_UNIFIED_ROMIMAGE 3
  750. #define QLA82XX_FLASH_ROMIMAGE 4
  751. #define QLA82XX_UNKNOWN_ROMIMAGE 0xff
  752. #define MIU_TEST_AGT_WRDATA_UPPER_LO (0x0b0)
  753. #define MIU_TEST_AGT_WRDATA_UPPER_HI (0x0b4)
  754. #ifndef readq
  755. static inline u64 readq(void __iomem *addr)
  756. {
  757. return readl(addr) | (((u64) readl(addr + 4)) << 32LL);
  758. }
  759. #endif
  760. #ifndef writeq
  761. static inline void writeq(u64 val, void __iomem *addr)
  762. {
  763. writel(((u32) (val)), (addr));
  764. writel(((u32) (val >> 32)), (addr + 4));
  765. }
  766. #endif
  767. /* Request and response queue size */
  768. #define REQUEST_ENTRY_CNT_82XX 128 /* Number of request entries. */
  769. #define RESPONSE_ENTRY_CNT_82XX 128 /* Number of response entries.*/
  770. /*
  771. * ISP 8021 I/O Register Set structure definitions.
  772. */
  773. struct device_reg_82xx {
  774. uint32_t req_q_out[64]; /* Request Queue out-Pointer (64 * 4) */
  775. uint32_t rsp_q_in[64]; /* Response Queue In-Pointer. */
  776. uint32_t rsp_q_out[64]; /* Response Queue Out-Pointer. */
  777. uint16_t mailbox_in[32]; /* Mail box In registers */
  778. uint16_t unused_1[32];
  779. uint32_t hint; /* Host interrupt register */
  780. #define HINT_MBX_INT_PENDING BIT_0
  781. uint16_t unused_2[62];
  782. uint16_t mailbox_out[32]; /* Mail box Out registers */
  783. uint32_t unused_3[48];
  784. uint32_t host_status; /* host status */
  785. #define HSRX_RISC_INT BIT_15 /* RISC to Host interrupt. */
  786. #define HSRX_RISC_PAUSED BIT_8 /* RISC Paused. */
  787. uint32_t host_int; /* Interrupt status. */
  788. #define ISRX_NX_RISC_INT BIT_0 /* RISC interrupt. */
  789. };
  790. struct fcp_cmnd {
  791. struct scsi_lun lun;
  792. uint8_t crn;
  793. uint8_t task_attribute;
  794. uint8_t task_management;
  795. uint8_t additional_cdb_len;
  796. uint8_t cdb[260]; /* 256 for CDB len and 4 for FCP_DL */
  797. };
  798. struct dsd_dma {
  799. struct list_head list;
  800. dma_addr_t dsd_list_dma;
  801. void *dsd_addr;
  802. };
  803. #define QLA_DSDS_PER_IOCB 37
  804. #define QLA_DSD_SIZE 12
  805. struct ct6_dsd {
  806. uint16_t fcp_cmnd_len;
  807. dma_addr_t fcp_cmnd_dma;
  808. struct fcp_cmnd *fcp_cmnd;
  809. int dsd_use_cnt;
  810. struct list_head dsd_list;
  811. };
  812. #define MBC_TOGGLE_INTERRUPT 0x10
  813. #define MBC_SET_LED_CONFIG 0x125 /* FCoE specific LED control */
  814. #define MBC_GET_LED_CONFIG 0x126 /* FCoE specific LED control */
  815. /* Flash offset */
  816. #define FLT_REG_BOOTLOAD_82XX 0x72
  817. #define FLT_REG_BOOT_CODE_82XX 0x78
  818. #define FLT_REG_FW_82XX 0x74
  819. #define FLT_REG_GOLD_FW_82XX 0x75
  820. #define FLT_REG_VPD_8XXX 0x81
  821. #define FA_VPD_SIZE_82XX 0x400
  822. #define FA_FLASH_LAYOUT_ADDR_82 0xFC400
  823. /******************************************************************************
  824. *
  825. * Definitions specific to M25P flash
  826. *
  827. *******************************************************************************
  828. * Instructions
  829. */
  830. #define M25P_INSTR_WREN 0x06
  831. #define M25P_INSTR_WRDI 0x04
  832. #define M25P_INSTR_RDID 0x9f
  833. #define M25P_INSTR_RDSR 0x05
  834. #define M25P_INSTR_WRSR 0x01
  835. #define M25P_INSTR_READ 0x03
  836. #define M25P_INSTR_FAST_READ 0x0b
  837. #define M25P_INSTR_PP 0x02
  838. #define M25P_INSTR_SE 0xd8
  839. #define M25P_INSTR_BE 0xc7
  840. #define M25P_INSTR_DP 0xb9
  841. #define M25P_INSTR_RES 0xab
  842. /* Minidump related */
  843. /*
  844. * Version of the template
  845. * 4 Bytes
  846. * X.Major.Minor.RELEASE
  847. */
  848. #define QLA82XX_MINIDUMP_VERSION 0x10101
  849. /*
  850. * Entry Type Defines
  851. */
  852. #define QLA82XX_RDNOP 0
  853. #define QLA82XX_RDCRB 1
  854. #define QLA82XX_RDMUX 2
  855. #define QLA82XX_QUEUE 3
  856. #define QLA82XX_BOARD 4
  857. #define QLA82XX_RDSRE 5
  858. #define QLA82XX_RDOCM 6
  859. #define QLA82XX_CACHE 10
  860. #define QLA82XX_L1DAT 11
  861. #define QLA82XX_L1INS 12
  862. #define QLA82XX_L2DTG 21
  863. #define QLA82XX_L2ITG 22
  864. #define QLA82XX_L2DAT 23
  865. #define QLA82XX_L2INS 24
  866. #define QLA82XX_RDROM 71
  867. #define QLA82XX_RDMEM 72
  868. #define QLA82XX_CNTRL 98
  869. #define QLA82XX_TLHDR 99
  870. #define QLA82XX_RDEND 255
  871. #define QLA8044_POLLRD 35
  872. #define QLA8044_RDMUX2 36
  873. #define QLA8044_L1DTG 8
  874. #define QLA8044_L1ITG 9
  875. #define QLA8044_POLLRDMWR 37
  876. /*
  877. * Opcodes for Control Entries.
  878. * These Flags are bit fields.
  879. */
  880. #define QLA82XX_DBG_OPCODE_WR 0x01
  881. #define QLA82XX_DBG_OPCODE_RW 0x02
  882. #define QLA82XX_DBG_OPCODE_AND 0x04
  883. #define QLA82XX_DBG_OPCODE_OR 0x08
  884. #define QLA82XX_DBG_OPCODE_POLL 0x10
  885. #define QLA82XX_DBG_OPCODE_RDSTATE 0x20
  886. #define QLA82XX_DBG_OPCODE_WRSTATE 0x40
  887. #define QLA82XX_DBG_OPCODE_MDSTATE 0x80
  888. /*
  889. * Template Header and Entry Header definitions start here.
  890. */
  891. /*
  892. * Template Header
  893. * Parts of the template header can be modified by the driver.
  894. * These include the saved_state_array, capture_debug_level, driver_timestamp
  895. */
  896. #define QLA82XX_DBG_STATE_ARRAY_LEN 16
  897. #define QLA82XX_DBG_CAP_SIZE_ARRAY_LEN 8
  898. #define QLA82XX_DBG_RSVD_ARRAY_LEN 8
  899. /*
  900. * Driver Flags
  901. */
  902. #define QLA82XX_DBG_SKIPPED_FLAG 0x80 /* driver skipped this entry */
  903. #define QLA82XX_DEFAULT_CAP_MASK 0xFF /* default capture mask */
  904. struct qla82xx_md_template_hdr {
  905. uint32_t entry_type;
  906. uint32_t first_entry_offset;
  907. uint32_t size_of_template;
  908. uint32_t capture_debug_level;
  909. uint32_t num_of_entries;
  910. uint32_t version;
  911. uint32_t driver_timestamp;
  912. uint32_t template_checksum;
  913. uint32_t driver_capture_mask;
  914. uint32_t driver_info[3];
  915. uint32_t saved_state_array[QLA82XX_DBG_STATE_ARRAY_LEN];
  916. uint32_t capture_size_array[QLA82XX_DBG_CAP_SIZE_ARRAY_LEN];
  917. /* markers_array used to capture some special locations on board */
  918. uint32_t markers_array[QLA82XX_DBG_RSVD_ARRAY_LEN];
  919. uint32_t num_of_free_entries; /* For internal use */
  920. uint32_t free_entry_offset; /* For internal use */
  921. uint32_t total_table_size; /* For internal use */
  922. uint32_t bkup_table_offset; /* For internal use */
  923. } __packed;
  924. /*
  925. * Entry Header: Common to All Entry Types
  926. */
  927. /*
  928. * Driver Code is for driver to write some info about the entry.
  929. * Currently not used.
  930. */
  931. typedef struct qla82xx_md_entry_hdr {
  932. uint32_t entry_type;
  933. uint32_t entry_size;
  934. uint32_t entry_capture_size;
  935. struct {
  936. uint8_t entry_capture_mask;
  937. uint8_t entry_code;
  938. uint8_t driver_code;
  939. uint8_t driver_flags;
  940. } d_ctrl;
  941. } __packed qla82xx_md_entry_hdr_t;
  942. /*
  943. * Read CRB entry header
  944. */
  945. struct qla82xx_md_entry_crb {
  946. qla82xx_md_entry_hdr_t h;
  947. uint32_t addr;
  948. struct {
  949. uint8_t addr_stride;
  950. uint8_t state_index_a;
  951. uint16_t poll_timeout;
  952. } crb_strd;
  953. uint32_t data_size;
  954. uint32_t op_count;
  955. struct {
  956. uint8_t opcode;
  957. uint8_t state_index_v;
  958. uint8_t shl;
  959. uint8_t shr;
  960. } crb_ctrl;
  961. uint32_t value_1;
  962. uint32_t value_2;
  963. uint32_t value_3;
  964. } __packed;
  965. /*
  966. * Cache entry header
  967. */
  968. struct qla82xx_md_entry_cache {
  969. qla82xx_md_entry_hdr_t h;
  970. uint32_t tag_reg_addr;
  971. struct {
  972. uint16_t tag_value_stride;
  973. uint16_t init_tag_value;
  974. } addr_ctrl;
  975. uint32_t data_size;
  976. uint32_t op_count;
  977. uint32_t control_addr;
  978. struct {
  979. uint16_t write_value;
  980. uint8_t poll_mask;
  981. uint8_t poll_wait;
  982. } cache_ctrl;
  983. uint32_t read_addr;
  984. struct {
  985. uint8_t read_addr_stride;
  986. uint8_t read_addr_cnt;
  987. uint16_t rsvd_1;
  988. } read_ctrl;
  989. } __packed;
  990. /*
  991. * Read OCM
  992. */
  993. struct qla82xx_md_entry_rdocm {
  994. qla82xx_md_entry_hdr_t h;
  995. uint32_t rsvd_0;
  996. uint32_t rsvd_1;
  997. uint32_t data_size;
  998. uint32_t op_count;
  999. uint32_t rsvd_2;
  1000. uint32_t rsvd_3;
  1001. uint32_t read_addr;
  1002. uint32_t read_addr_stride;
  1003. uint32_t read_addr_cntrl;
  1004. } __packed;
  1005. /*
  1006. * Read Memory
  1007. */
  1008. struct qla82xx_md_entry_rdmem {
  1009. qla82xx_md_entry_hdr_t h;
  1010. uint32_t rsvd[6];
  1011. uint32_t read_addr;
  1012. uint32_t read_data_size;
  1013. } __packed;
  1014. /*
  1015. * Read ROM
  1016. */
  1017. struct qla82xx_md_entry_rdrom {
  1018. qla82xx_md_entry_hdr_t h;
  1019. uint32_t rsvd[6];
  1020. uint32_t read_addr;
  1021. uint32_t read_data_size;
  1022. } __packed;
  1023. struct qla82xx_md_entry_mux {
  1024. qla82xx_md_entry_hdr_t h;
  1025. uint32_t select_addr;
  1026. uint32_t rsvd_0;
  1027. uint32_t data_size;
  1028. uint32_t op_count;
  1029. uint32_t select_value;
  1030. uint32_t select_value_stride;
  1031. uint32_t read_addr;
  1032. uint32_t rsvd_1;
  1033. } __packed;
  1034. struct qla82xx_md_entry_queue {
  1035. qla82xx_md_entry_hdr_t h;
  1036. uint32_t select_addr;
  1037. struct {
  1038. uint16_t queue_id_stride;
  1039. uint16_t rsvd_0;
  1040. } q_strd;
  1041. uint32_t data_size;
  1042. uint32_t op_count;
  1043. uint32_t rsvd_1;
  1044. uint32_t rsvd_2;
  1045. uint32_t read_addr;
  1046. struct {
  1047. uint8_t read_addr_stride;
  1048. uint8_t read_addr_cnt;
  1049. uint16_t rsvd_3;
  1050. } rd_strd;
  1051. } __packed;
  1052. #define MBC_DIAGNOSTIC_MINIDUMP_TEMPLATE 0x129
  1053. #define RQST_TMPLT_SIZE 0x0
  1054. #define RQST_TMPLT 0x1
  1055. #define MD_DIRECT_ROM_WINDOW 0x42110030
  1056. #define MD_DIRECT_ROM_READ_BASE 0x42150000
  1057. #define MD_MIU_TEST_AGT_CTRL 0x41000090
  1058. #define MD_MIU_TEST_AGT_ADDR_LO 0x41000094
  1059. #define MD_MIU_TEST_AGT_ADDR_HI 0x41000098
  1060. static const int MD_MIU_TEST_AGT_RDDATA[] = { 0x410000A8, 0x410000AC,
  1061. 0x410000B8, 0x410000BC };
  1062. #define CRB_NIU_XG_PAUSE_CTL_P0 0x1
  1063. #define CRB_NIU_XG_PAUSE_CTL_P1 0x8
  1064. #define qla82xx_get_temp_val(x) ((x) >> 16)
  1065. #define qla82xx_get_temp_state(x) ((x) & 0xffff)
  1066. #define qla82xx_encode_temp(val, state) (((val) << 16) | (state))
  1067. /*
  1068. * Temperature control.
  1069. */
  1070. enum {
  1071. QLA82XX_TEMP_NORMAL = 0x1, /* Normal operating range */
  1072. QLA82XX_TEMP_WARN, /* Sound alert, temperature getting high */
  1073. QLA82XX_TEMP_PANIC /* Fatal error, hardware has shut down. */
  1074. };
  1075. #define LEG_INTR_PTR_OFFSET 0x38C0
  1076. #define LEG_INTR_TRIG_OFFSET 0x38C4
  1077. #define LEG_INTR_MASK_OFFSET 0x38C8
  1078. #endif