PageRenderTime 70ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 1ms

/drivers/scsi/qla2xxx/qla_dbg.h

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