qla_dbg.h 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  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. #include "qla_def.h"
  8. /*
  9. * Firmware Dump structure definition
  10. */
  11. struct qla2300_fw_dump {
  12. uint16_t hccr;
  13. uint16_t pbiu_reg[8];
  14. uint16_t risc_host_reg[8];
  15. uint16_t mailbox_reg[32];
  16. uint16_t resp_dma_reg[32];
  17. uint16_t dma_reg[48];
  18. uint16_t risc_hdw_reg[16];
  19. uint16_t risc_gp0_reg[16];
  20. uint16_t risc_gp1_reg[16];
  21. uint16_t risc_gp2_reg[16];
  22. uint16_t risc_gp3_reg[16];
  23. uint16_t risc_gp4_reg[16];
  24. uint16_t risc_gp5_reg[16];
  25. uint16_t risc_gp6_reg[16];
  26. uint16_t risc_gp7_reg[16];
  27. uint16_t frame_buf_hdw_reg[64];
  28. uint16_t fpm_b0_reg[64];
  29. uint16_t fpm_b1_reg[64];
  30. uint16_t risc_ram[0xf800];
  31. uint16_t stack_ram[0x1000];
  32. uint16_t data_ram[1];
  33. };
  34. struct qla2100_fw_dump {
  35. uint16_t hccr;
  36. uint16_t pbiu_reg[8];
  37. uint16_t mailbox_reg[32];
  38. uint16_t dma_reg[48];
  39. uint16_t risc_hdw_reg[16];
  40. uint16_t risc_gp0_reg[16];
  41. uint16_t risc_gp1_reg[16];
  42. uint16_t risc_gp2_reg[16];
  43. uint16_t risc_gp3_reg[16];
  44. uint16_t risc_gp4_reg[16];
  45. uint16_t risc_gp5_reg[16];
  46. uint16_t risc_gp6_reg[16];
  47. uint16_t risc_gp7_reg[16];
  48. uint16_t frame_buf_hdw_reg[16];
  49. uint16_t fpm_b0_reg[64];
  50. uint16_t fpm_b1_reg[64];
  51. uint16_t risc_ram[0xf000];
  52. };
  53. struct qla24xx_fw_dump {
  54. uint32_t host_status;
  55. uint32_t host_reg[32];
  56. uint32_t shadow_reg[7];
  57. uint16_t mailbox_reg[32];
  58. uint32_t xseq_gp_reg[128];
  59. uint32_t xseq_0_reg[16];
  60. uint32_t xseq_1_reg[16];
  61. uint32_t rseq_gp_reg[128];
  62. uint32_t rseq_0_reg[16];
  63. uint32_t rseq_1_reg[16];
  64. uint32_t rseq_2_reg[16];
  65. uint32_t cmd_dma_reg[16];
  66. uint32_t req0_dma_reg[15];
  67. uint32_t resp0_dma_reg[15];
  68. uint32_t req1_dma_reg[15];
  69. uint32_t xmt0_dma_reg[32];
  70. uint32_t xmt1_dma_reg[32];
  71. uint32_t xmt2_dma_reg[32];
  72. uint32_t xmt3_dma_reg[32];
  73. uint32_t xmt4_dma_reg[32];
  74. uint32_t xmt_data_dma_reg[16];
  75. uint32_t rcvt0_data_dma_reg[32];
  76. uint32_t rcvt1_data_dma_reg[32];
  77. uint32_t risc_gp_reg[128];
  78. uint32_t lmc_reg[112];
  79. uint32_t fpm_hdw_reg[192];
  80. uint32_t fb_hdw_reg[176];
  81. uint32_t code_ram[0x2000];
  82. uint32_t ext_mem[1];
  83. };
  84. struct qla25xx_fw_dump {
  85. uint32_t host_status;
  86. uint32_t host_risc_reg[32];
  87. uint32_t pcie_regs[4];
  88. uint32_t host_reg[32];
  89. uint32_t shadow_reg[11];
  90. uint32_t risc_io_reg;
  91. uint16_t mailbox_reg[32];
  92. uint32_t xseq_gp_reg[128];
  93. uint32_t xseq_0_reg[48];
  94. uint32_t xseq_1_reg[16];
  95. uint32_t rseq_gp_reg[128];
  96. uint32_t rseq_0_reg[32];
  97. uint32_t rseq_1_reg[16];
  98. uint32_t rseq_2_reg[16];
  99. uint32_t aseq_gp_reg[128];
  100. uint32_t aseq_0_reg[32];
  101. uint32_t aseq_1_reg[16];
  102. uint32_t aseq_2_reg[16];
  103. uint32_t cmd_dma_reg[16];
  104. uint32_t req0_dma_reg[15];
  105. uint32_t resp0_dma_reg[15];
  106. uint32_t req1_dma_reg[15];
  107. uint32_t xmt0_dma_reg[32];
  108. uint32_t xmt1_dma_reg[32];
  109. uint32_t xmt2_dma_reg[32];
  110. uint32_t xmt3_dma_reg[32];
  111. uint32_t xmt4_dma_reg[32];
  112. uint32_t xmt_data_dma_reg[16];
  113. uint32_t rcvt0_data_dma_reg[32];
  114. uint32_t rcvt1_data_dma_reg[32];
  115. uint32_t risc_gp_reg[128];
  116. uint32_t lmc_reg[128];
  117. uint32_t fpm_hdw_reg[192];
  118. uint32_t fb_hdw_reg[192];
  119. uint32_t code_ram[0x2000];
  120. uint32_t ext_mem[1];
  121. };
  122. struct qla81xx_fw_dump {
  123. uint32_t host_status;
  124. uint32_t host_risc_reg[32];
  125. uint32_t pcie_regs[4];
  126. uint32_t host_reg[32];
  127. uint32_t shadow_reg[11];
  128. uint32_t risc_io_reg;
  129. uint16_t mailbox_reg[32];
  130. uint32_t xseq_gp_reg[128];
  131. uint32_t xseq_0_reg[48];
  132. uint32_t xseq_1_reg[16];
  133. uint32_t rseq_gp_reg[128];
  134. uint32_t rseq_0_reg[32];
  135. uint32_t rseq_1_reg[16];
  136. uint32_t rseq_2_reg[16];
  137. uint32_t aseq_gp_reg[128];
  138. uint32_t aseq_0_reg[32];
  139. uint32_t aseq_1_reg[16];
  140. uint32_t aseq_2_reg[16];
  141. uint32_t cmd_dma_reg[16];
  142. uint32_t req0_dma_reg[15];
  143. uint32_t resp0_dma_reg[15];
  144. uint32_t req1_dma_reg[15];
  145. uint32_t xmt0_dma_reg[32];
  146. uint32_t xmt1_dma_reg[32];
  147. uint32_t xmt2_dma_reg[32];
  148. uint32_t xmt3_dma_reg[32];
  149. uint32_t xmt4_dma_reg[32];
  150. uint32_t xmt_data_dma_reg[16];
  151. uint32_t rcvt0_data_dma_reg[32];
  152. uint32_t rcvt1_data_dma_reg[32];
  153. uint32_t risc_gp_reg[128];
  154. uint32_t lmc_reg[128];
  155. uint32_t fpm_hdw_reg[224];
  156. uint32_t fb_hdw_reg[208];
  157. uint32_t code_ram[0x2000];
  158. uint32_t ext_mem[1];
  159. };
  160. struct qla83xx_fw_dump {
  161. uint32_t host_status;
  162. uint32_t host_risc_reg[48];
  163. uint32_t pcie_regs[4];
  164. uint32_t host_reg[32];
  165. uint32_t shadow_reg[11];
  166. uint32_t risc_io_reg;
  167. uint16_t mailbox_reg[32];
  168. uint32_t xseq_gp_reg[256];
  169. uint32_t xseq_0_reg[48];
  170. uint32_t xseq_1_reg[16];
  171. uint32_t xseq_2_reg[16];
  172. uint32_t rseq_gp_reg[256];
  173. uint32_t rseq_0_reg[32];
  174. uint32_t rseq_1_reg[16];
  175. uint32_t rseq_2_reg[16];
  176. uint32_t rseq_3_reg[16];
  177. uint32_t aseq_gp_reg[256];
  178. uint32_t aseq_0_reg[32];
  179. uint32_t aseq_1_reg[16];
  180. uint32_t aseq_2_reg[16];
  181. uint32_t aseq_3_reg[16];
  182. uint32_t cmd_dma_reg[64];
  183. uint32_t req0_dma_reg[15];
  184. uint32_t resp0_dma_reg[15];
  185. uint32_t req1_dma_reg[15];
  186. uint32_t xmt0_dma_reg[32];
  187. uint32_t xmt1_dma_reg[32];
  188. uint32_t xmt2_dma_reg[32];
  189. uint32_t xmt3_dma_reg[32];
  190. uint32_t xmt4_dma_reg[32];
  191. uint32_t xmt_data_dma_reg[16];
  192. uint32_t rcvt0_data_dma_reg[32];
  193. uint32_t rcvt1_data_dma_reg[32];
  194. uint32_t risc_gp_reg[128];
  195. uint32_t lmc_reg[128];
  196. uint32_t fpm_hdw_reg[256];
  197. uint32_t rq0_array_reg[256];
  198. uint32_t rq1_array_reg[256];
  199. uint32_t rp0_array_reg[256];
  200. uint32_t rp1_array_reg[256];
  201. uint32_t queue_control_reg[16];
  202. uint32_t fb_hdw_reg[432];
  203. uint32_t at0_array_reg[128];
  204. uint32_t code_ram[0x2400];
  205. uint32_t ext_mem[1];
  206. };
  207. #define EFT_NUM_BUFFERS 4
  208. #define EFT_BYTES_PER_BUFFER 0x4000
  209. #define EFT_SIZE ((EFT_BYTES_PER_BUFFER) * (EFT_NUM_BUFFERS))
  210. #define FCE_NUM_BUFFERS 64
  211. #define FCE_BYTES_PER_BUFFER 0x400
  212. #define FCE_SIZE ((FCE_BYTES_PER_BUFFER) * (FCE_NUM_BUFFERS))
  213. #define fce_calc_size(b) ((FCE_BYTES_PER_BUFFER) * (b))
  214. struct qla2xxx_fce_chain {
  215. uint32_t type;
  216. uint32_t chain_size;
  217. uint32_t size;
  218. uint32_t addr_l;
  219. uint32_t addr_h;
  220. uint32_t eregs[8];
  221. };
  222. struct qla2xxx_mq_chain {
  223. uint32_t type;
  224. uint32_t chain_size;
  225. uint32_t count;
  226. uint32_t qregs[4 * QLA_MQ_SIZE];
  227. };
  228. struct qla2xxx_mqueue_header {
  229. uint32_t queue;
  230. #define TYPE_REQUEST_QUEUE 0x1
  231. #define TYPE_RESPONSE_QUEUE 0x2
  232. #define TYPE_ATIO_QUEUE 0x3
  233. uint32_t number;
  234. uint32_t size;
  235. };
  236. struct qla2xxx_mqueue_chain {
  237. uint32_t type;
  238. uint32_t chain_size;
  239. };
  240. #define DUMP_CHAIN_VARIANT 0x80000000
  241. #define DUMP_CHAIN_FCE 0x7FFFFAF0
  242. #define DUMP_CHAIN_MQ 0x7FFFFAF1
  243. #define DUMP_CHAIN_QUEUE 0x7FFFFAF2
  244. #define DUMP_CHAIN_LAST 0x80000000
  245. struct qla2xxx_fw_dump {
  246. uint8_t signature[4];
  247. uint32_t version;
  248. uint32_t fw_major_version;
  249. uint32_t fw_minor_version;
  250. uint32_t fw_subminor_version;
  251. uint32_t fw_attributes;
  252. uint32_t vendor;
  253. uint32_t device;
  254. uint32_t subsystem_vendor;
  255. uint32_t subsystem_device;
  256. uint32_t fixed_size;
  257. uint32_t mem_size;
  258. uint32_t req_q_size;
  259. uint32_t rsp_q_size;
  260. uint32_t eft_size;
  261. uint32_t eft_addr_l;
  262. uint32_t eft_addr_h;
  263. uint32_t header_size;
  264. union {
  265. struct qla2100_fw_dump isp21;
  266. struct qla2300_fw_dump isp23;
  267. struct qla24xx_fw_dump isp24;
  268. struct qla25xx_fw_dump isp25;
  269. struct qla81xx_fw_dump isp81;
  270. struct qla83xx_fw_dump isp83;
  271. } isp;
  272. };
  273. #define QL_MSGHDR "qla2xxx"
  274. #define QL_DBG_DEFAULT1_MASK 0x1e400000
  275. #define ql_log_fatal 0 /* display fatal errors */
  276. #define ql_log_warn 1 /* display critical errors */
  277. #define ql_log_info 2 /* display all recovered errors */
  278. #define ql_log_all 3 /* This value is only used by ql_errlev.
  279. * No messages will use this value.
  280. * This should be always highest value
  281. * as compared to other log levels.
  282. */
  283. extern int ql_errlev;
  284. void __attribute__((format (printf, 4, 5)))
  285. ql_dbg(uint32_t, scsi_qla_host_t *vha, int32_t, const char *fmt, ...);
  286. void __attribute__((format (printf, 4, 5)))
  287. ql_dbg_pci(uint32_t, struct pci_dev *pdev, int32_t, const char *fmt, ...);
  288. void __attribute__((format (printf, 4, 5)))
  289. ql_log(uint32_t, scsi_qla_host_t *vha, int32_t, const char *fmt, ...);
  290. void __attribute__((format (printf, 4, 5)))
  291. ql_log_pci(uint32_t, struct pci_dev *pdev, int32_t, const char *fmt, ...);
  292. /* Debug Levels */
  293. /* The 0x40000000 is the max value any debug level can have
  294. * as ql2xextended_error_logging is of type signed int
  295. */
  296. #define ql_dbg_init 0x40000000 /* Init Debug */
  297. #define ql_dbg_mbx 0x20000000 /* MBX Debug */
  298. #define ql_dbg_disc 0x10000000 /* Device Discovery Debug */
  299. #define ql_dbg_io 0x08000000 /* IO Tracing Debug */
  300. #define ql_dbg_dpc 0x04000000 /* DPC Thead Debug */
  301. #define ql_dbg_async 0x02000000 /* Async events Debug */
  302. #define ql_dbg_timer 0x01000000 /* Timer Debug */
  303. #define ql_dbg_user 0x00800000 /* User Space Interations Debug */
  304. #define ql_dbg_taskm 0x00400000 /* Task Management Debug */
  305. #define ql_dbg_aer 0x00200000 /* AER/EEH Debug */
  306. #define ql_dbg_multiq 0x00100000 /* MultiQ Debug */
  307. #define ql_dbg_p3p 0x00080000 /* P3P specific Debug */
  308. #define ql_dbg_vport 0x00040000 /* Virtual Port Debug */
  309. #define ql_dbg_buffer 0x00020000 /* For dumping the buffer/regs */
  310. #define ql_dbg_misc 0x00010000 /* For dumping everything that is not
  311. * not covered by upper categories
  312. */
  313. #define ql_dbg_verbose 0x00008000 /* More verbosity for each level
  314. * This is to be used with other levels where
  315. * more verbosity is required. It might not
  316. * be applicable to all the levels.
  317. */
  318. #define ql_dbg_tgt 0x00004000 /* Target mode */
  319. #define ql_dbg_tgt_mgt 0x00002000 /* Target mode management */
  320. #define ql_dbg_tgt_tmr 0x00001000 /* Target mode task management */
  321. extern int qla27xx_dump_mpi_ram(struct qla_hw_data *, uint32_t, uint32_t *,
  322. uint32_t, void **);
  323. extern int qla24xx_dump_ram(struct qla_hw_data *, uint32_t, uint32_t *,
  324. uint32_t, void **);
  325. extern void qla24xx_pause_risc(struct device_reg_24xx __iomem *,
  326. struct qla_hw_data *);
  327. extern int qla24xx_soft_reset(struct qla_hw_data *);