qla_dbg.h 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. /*
  2. * QLogic Fibre Channel HBA Driver
  3. * Copyright (c) 2003-2008 QLogic Corporation
  4. *
  5. * See LICENSE.qla2xxx for copyright and licensing details.
  6. */
  7. /*
  8. * Driver debug definitions.
  9. */
  10. /* #define QL_DEBUG_LEVEL_1 */ /* Output register accesses to COM1 */
  11. /* #define QL_DEBUG_LEVEL_2 */ /* Output error msgs to COM1 */
  12. /* #define QL_DEBUG_LEVEL_3 */ /* Output function trace msgs to COM1 */
  13. /* #define QL_DEBUG_LEVEL_4 */ /* Output NVRAM trace msgs to COM1 */
  14. /* #define QL_DEBUG_LEVEL_5 */ /* Output ring trace msgs to COM1 */
  15. /* #define QL_DEBUG_LEVEL_6 */ /* Output WATCHDOG timer trace to COM1 */
  16. /* #define QL_DEBUG_LEVEL_7 */ /* Output RISC load trace msgs to COM1 */
  17. /* #define QL_DEBUG_LEVEL_8 */ /* Output ring saturation msgs to COM1 */
  18. /* #define QL_DEBUG_LEVEL_9 */ /* Output IOCTL trace msgs */
  19. /* #define QL_DEBUG_LEVEL_10 */ /* Output IOCTL error msgs */
  20. /* #define QL_DEBUG_LEVEL_11 */ /* Output Mbx Cmd trace msgs */
  21. /* #define QL_DEBUG_LEVEL_12 */ /* Output IP trace msgs */
  22. /* #define QL_DEBUG_LEVEL_13 */ /* Output fdmi function trace msgs */
  23. /* #define QL_DEBUG_LEVEL_14 */ /* Output RSCN trace msgs */
  24. /* #define QL_DEBUG_LEVEL_15 */ /* Output NPIV trace msgs */
  25. /* #define QL_DEBUG_LEVEL_16 */ /* Output ISP84XX trace msgs */
  26. /*
  27. * Macros use for debugging the driver.
  28. */
  29. #define DEBUG(x) do { if (ql2xextended_error_logging) { x; } } while (0)
  30. #if defined(QL_DEBUG_LEVEL_1)
  31. #define DEBUG1(x) do {x;} while (0)
  32. #else
  33. #define DEBUG1(x) do {} while (0)
  34. #endif
  35. #define DEBUG2(x) do { if (ql2xextended_error_logging) { x; } } while (0)
  36. #define DEBUG2_3(x) do { if (ql2xextended_error_logging) { x; } } while (0)
  37. #define DEBUG2_3_11(x) do { if (ql2xextended_error_logging) { x; } } while (0)
  38. #define DEBUG2_9_10(x) do { if (ql2xextended_error_logging) { x; } } while (0)
  39. #define DEBUG2_11(x) do { if (ql2xextended_error_logging) { x; } } while (0)
  40. #define DEBUG2_13(x) do { if (ql2xextended_error_logging) { x; } } while (0)
  41. #define DEBUG2_16(x) do { if (ql2xextended_error_logging) { x; } } while (0)
  42. #if defined(QL_DEBUG_LEVEL_3)
  43. #define DEBUG3(x) do {x;} while (0)
  44. #define DEBUG3_11(x) do {x;} while (0)
  45. #else
  46. #define DEBUG3(x) do {} while (0)
  47. #endif
  48. #if defined(QL_DEBUG_LEVEL_4)
  49. #define DEBUG4(x) do {x;} while (0)
  50. #else
  51. #define DEBUG4(x) do {} while (0)
  52. #endif
  53. #if defined(QL_DEBUG_LEVEL_5)
  54. #define DEBUG5(x) do {x;} while (0)
  55. #else
  56. #define DEBUG5(x) do {} while (0)
  57. #endif
  58. #if defined(QL_DEBUG_LEVEL_7)
  59. #define DEBUG7(x) do {x;} while (0)
  60. #else
  61. #define DEBUG7(x) do {} while (0)
  62. #endif
  63. #if defined(QL_DEBUG_LEVEL_9)
  64. #define DEBUG9(x) do {x;} while (0)
  65. #define DEBUG9_10(x) do {x;} while (0)
  66. #else
  67. #define DEBUG9(x) do {} while (0)
  68. #endif
  69. #if defined(QL_DEBUG_LEVEL_10)
  70. #define DEBUG10(x) do {x;} while (0)
  71. #define DEBUG9_10(x) do {x;} while (0)
  72. #else
  73. #define DEBUG10(x) do {} while (0)
  74. #if !defined(DEBUG9_10)
  75. #define DEBUG9_10(x) do {} while (0)
  76. #endif
  77. #endif
  78. #if defined(QL_DEBUG_LEVEL_11)
  79. #define DEBUG11(x) do{x;} while(0)
  80. #if !defined(DEBUG3_11)
  81. #define DEBUG3_11(x) do{x;} while(0)
  82. #endif
  83. #else
  84. #define DEBUG11(x) do{} while(0)
  85. #if !defined(QL_DEBUG_LEVEL_3)
  86. #define DEBUG3_11(x) do{} while(0)
  87. #endif
  88. #endif
  89. #if defined(QL_DEBUG_LEVEL_12)
  90. #define DEBUG12(x) do {x;} while (0)
  91. #else
  92. #define DEBUG12(x) do {} while (0)
  93. #endif
  94. #if defined(QL_DEBUG_LEVEL_13)
  95. #define DEBUG13(x) do {x;} while (0)
  96. #else
  97. #define DEBUG13(x) do {} while (0)
  98. #endif
  99. #if defined(QL_DEBUG_LEVEL_14)
  100. #define DEBUG14(x) do {x;} while (0)
  101. #else
  102. #define DEBUG14(x) do {} while (0)
  103. #endif
  104. #if defined(QL_DEBUG_LEVEL_15)
  105. #define DEBUG15(x) do {x;} while (0)
  106. #else
  107. #define DEBUG15(x) do {} while (0)
  108. #endif
  109. #if defined(QL_DEBUG_LEVEL_16)
  110. #define DEBUG16(x) do {x;} while (0)
  111. #else
  112. #define DEBUG16(x) do {} while (0)
  113. #endif
  114. /*
  115. * Firmware Dump structure definition
  116. */
  117. struct qla2300_fw_dump {
  118. uint16_t hccr;
  119. uint16_t pbiu_reg[8];
  120. uint16_t risc_host_reg[8];
  121. uint16_t mailbox_reg[32];
  122. uint16_t resp_dma_reg[32];
  123. uint16_t dma_reg[48];
  124. uint16_t risc_hdw_reg[16];
  125. uint16_t risc_gp0_reg[16];
  126. uint16_t risc_gp1_reg[16];
  127. uint16_t risc_gp2_reg[16];
  128. uint16_t risc_gp3_reg[16];
  129. uint16_t risc_gp4_reg[16];
  130. uint16_t risc_gp5_reg[16];
  131. uint16_t risc_gp6_reg[16];
  132. uint16_t risc_gp7_reg[16];
  133. uint16_t frame_buf_hdw_reg[64];
  134. uint16_t fpm_b0_reg[64];
  135. uint16_t fpm_b1_reg[64];
  136. uint16_t risc_ram[0xf800];
  137. uint16_t stack_ram[0x1000];
  138. uint16_t data_ram[1];
  139. };
  140. struct qla2100_fw_dump {
  141. uint16_t hccr;
  142. uint16_t pbiu_reg[8];
  143. uint16_t mailbox_reg[32];
  144. uint16_t dma_reg[48];
  145. uint16_t risc_hdw_reg[16];
  146. uint16_t risc_gp0_reg[16];
  147. uint16_t risc_gp1_reg[16];
  148. uint16_t risc_gp2_reg[16];
  149. uint16_t risc_gp3_reg[16];
  150. uint16_t risc_gp4_reg[16];
  151. uint16_t risc_gp5_reg[16];
  152. uint16_t risc_gp6_reg[16];
  153. uint16_t risc_gp7_reg[16];
  154. uint16_t frame_buf_hdw_reg[16];
  155. uint16_t fpm_b0_reg[64];
  156. uint16_t fpm_b1_reg[64];
  157. uint16_t risc_ram[0xf000];
  158. };
  159. struct qla24xx_fw_dump {
  160. uint32_t host_status;
  161. uint32_t host_reg[32];
  162. uint32_t shadow_reg[7];
  163. uint16_t mailbox_reg[32];
  164. uint32_t xseq_gp_reg[128];
  165. uint32_t xseq_0_reg[16];
  166. uint32_t xseq_1_reg[16];
  167. uint32_t rseq_gp_reg[128];
  168. uint32_t rseq_0_reg[16];
  169. uint32_t rseq_1_reg[16];
  170. uint32_t rseq_2_reg[16];
  171. uint32_t cmd_dma_reg[16];
  172. uint32_t req0_dma_reg[15];
  173. uint32_t resp0_dma_reg[15];
  174. uint32_t req1_dma_reg[15];
  175. uint32_t xmt0_dma_reg[32];
  176. uint32_t xmt1_dma_reg[32];
  177. uint32_t xmt2_dma_reg[32];
  178. uint32_t xmt3_dma_reg[32];
  179. uint32_t xmt4_dma_reg[32];
  180. uint32_t xmt_data_dma_reg[16];
  181. uint32_t rcvt0_data_dma_reg[32];
  182. uint32_t rcvt1_data_dma_reg[32];
  183. uint32_t risc_gp_reg[128];
  184. uint32_t lmc_reg[112];
  185. uint32_t fpm_hdw_reg[192];
  186. uint32_t fb_hdw_reg[176];
  187. uint32_t code_ram[0x2000];
  188. uint32_t ext_mem[1];
  189. };
  190. struct qla25xx_fw_dump {
  191. uint32_t host_status;
  192. uint32_t host_risc_reg[32];
  193. uint32_t pcie_regs[4];
  194. uint32_t host_reg[32];
  195. uint32_t shadow_reg[11];
  196. uint32_t risc_io_reg;
  197. uint16_t mailbox_reg[32];
  198. uint32_t xseq_gp_reg[128];
  199. uint32_t xseq_0_reg[48];
  200. uint32_t xseq_1_reg[16];
  201. uint32_t rseq_gp_reg[128];
  202. uint32_t rseq_0_reg[32];
  203. uint32_t rseq_1_reg[16];
  204. uint32_t rseq_2_reg[16];
  205. uint32_t aseq_gp_reg[128];
  206. uint32_t aseq_0_reg[32];
  207. uint32_t aseq_1_reg[16];
  208. uint32_t aseq_2_reg[16];
  209. uint32_t cmd_dma_reg[16];
  210. uint32_t req0_dma_reg[15];
  211. uint32_t resp0_dma_reg[15];
  212. uint32_t req1_dma_reg[15];
  213. uint32_t xmt0_dma_reg[32];
  214. uint32_t xmt1_dma_reg[32];
  215. uint32_t xmt2_dma_reg[32];
  216. uint32_t xmt3_dma_reg[32];
  217. uint32_t xmt4_dma_reg[32];
  218. uint32_t xmt_data_dma_reg[16];
  219. uint32_t rcvt0_data_dma_reg[32];
  220. uint32_t rcvt1_data_dma_reg[32];
  221. uint32_t risc_gp_reg[128];
  222. uint32_t lmc_reg[128];
  223. uint32_t fpm_hdw_reg[192];
  224. uint32_t fb_hdw_reg[192];
  225. uint32_t code_ram[0x2000];
  226. uint32_t ext_mem[1];
  227. };
  228. #define EFT_NUM_BUFFERS 4
  229. #define EFT_BYTES_PER_BUFFER 0x4000
  230. #define EFT_SIZE ((EFT_BYTES_PER_BUFFER) * (EFT_NUM_BUFFERS))
  231. #define FCE_NUM_BUFFERS 64
  232. #define FCE_BYTES_PER_BUFFER 0x400
  233. #define FCE_SIZE ((FCE_BYTES_PER_BUFFER) * (FCE_NUM_BUFFERS))
  234. #define fce_calc_size(b) ((FCE_BYTES_PER_BUFFER) * (b))
  235. struct qla2xxx_fce_chain {
  236. uint32_t type;
  237. uint32_t chain_size;
  238. uint32_t size;
  239. uint32_t addr_l;
  240. uint32_t addr_h;
  241. uint32_t eregs[8];
  242. };
  243. #define DUMP_CHAIN_VARIANT 0x80000000
  244. #define DUMP_CHAIN_FCE 0x7FFFFAF0
  245. #define DUMP_CHAIN_LAST 0x80000000
  246. struct qla2xxx_fw_dump {
  247. uint8_t signature[4];
  248. uint32_t version;
  249. uint32_t fw_major_version;
  250. uint32_t fw_minor_version;
  251. uint32_t fw_subminor_version;
  252. uint32_t fw_attributes;
  253. uint32_t vendor;
  254. uint32_t device;
  255. uint32_t subsystem_vendor;
  256. uint32_t subsystem_device;
  257. uint32_t fixed_size;
  258. uint32_t mem_size;
  259. uint32_t req_q_size;
  260. uint32_t rsp_q_size;
  261. uint32_t eft_size;
  262. uint32_t eft_addr_l;
  263. uint32_t eft_addr_h;
  264. uint32_t header_size;
  265. union {
  266. struct qla2100_fw_dump isp21;
  267. struct qla2300_fw_dump isp23;
  268. struct qla24xx_fw_dump isp24;
  269. struct qla25xx_fw_dump isp25;
  270. } isp;
  271. };