qla_dbg.h 9.1 KB

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