qla_nx.h 39 KB

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