lpfc_debugfs.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672
  1. /*******************************************************************
  2. * This file is part of the Emulex Linux Device Driver for *
  3. * Fibre Channel Host Bus Adapters. *
  4. * Copyright (C) 2007-2011 Emulex. All rights reserved. *
  5. * EMULEX and SLI are trademarks of Emulex. *
  6. * www.emulex.com *
  7. * *
  8. * This program is free software; you can redistribute it and/or *
  9. * modify it under the terms of version 2 of the GNU General *
  10. * Public License as published by the Free Software Foundation. *
  11. * This program is distributed in the hope that it will be useful. *
  12. * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND *
  13. * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, *
  14. * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE *
  15. * DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD *
  16. * TO BE LEGALLY INVALID. See the GNU General Public License for *
  17. * more details, a copy of which can be found in the file COPYING *
  18. * included with this package. *
  19. *******************************************************************/
  20. #ifndef _H_LPFC_DEBUG_FS
  21. #define _H_LPFC_DEBUG_FS
  22. #ifdef CONFIG_SCSI_LPFC_DEBUG_FS
  23. /* size of output line, for discovery_trace and slow_ring_trace */
  24. #define LPFC_DEBUG_TRC_ENTRY_SIZE 100
  25. /* nodelist output buffer size */
  26. #define LPFC_NODELIST_SIZE 8192
  27. #define LPFC_NODELIST_ENTRY_SIZE 120
  28. /* dumpHBASlim output buffer size */
  29. #define LPFC_DUMPHBASLIM_SIZE 4096
  30. /* dumpHostSlim output buffer size */
  31. #define LPFC_DUMPHOSTSLIM_SIZE 4096
  32. /* dumpSLIqinfo output buffer size */
  33. #define LPFC_DUMPSLIQINFO_SIZE 4096
  34. /* hbqinfo output buffer size */
  35. #define LPFC_HBQINFO_SIZE 8192
  36. /*
  37. * For SLI4 iDiag debugfs diagnostics tool
  38. */
  39. /* pciConf */
  40. #define LPFC_PCI_CFG_BROWSE 0xffff
  41. #define LPFC_PCI_CFG_RD_CMD_ARG 2
  42. #define LPFC_PCI_CFG_WR_CMD_ARG 3
  43. #define LPFC_PCI_CFG_SIZE 4096
  44. #define LPFC_PCI_CFG_RD_SIZE (LPFC_PCI_CFG_SIZE/4)
  45. #define IDIAG_PCICFG_WHERE_INDX 0
  46. #define IDIAG_PCICFG_COUNT_INDX 1
  47. #define IDIAG_PCICFG_VALUE_INDX 2
  48. /* barAcc */
  49. #define LPFC_PCI_BAR_BROWSE 0xffff
  50. #define LPFC_PCI_BAR_RD_CMD_ARG 3
  51. #define LPFC_PCI_BAR_WR_CMD_ARG 3
  52. #define LPFC_PCI_IF0_BAR0_SIZE (1024 * 16)
  53. #define LPFC_PCI_IF0_BAR1_SIZE (1024 * 128)
  54. #define LPFC_PCI_IF0_BAR2_SIZE (1024 * 128)
  55. #define LPFC_PCI_IF2_BAR0_SIZE (1024 * 32)
  56. #define LPFC_PCI_BAR_RD_BUF_SIZE 4096
  57. #define LPFC_PCI_BAR_RD_SIZE (LPFC_PCI_BAR_RD_BUF_SIZE/4)
  58. #define LPFC_PCI_IF0_BAR0_RD_SIZE (LPFC_PCI_IF0_BAR0_SIZE/4)
  59. #define LPFC_PCI_IF0_BAR1_RD_SIZE (LPFC_PCI_IF0_BAR1_SIZE/4)
  60. #define LPFC_PCI_IF0_BAR2_RD_SIZE (LPFC_PCI_IF0_BAR2_SIZE/4)
  61. #define LPFC_PCI_IF2_BAR0_RD_SIZE (LPFC_PCI_IF2_BAR0_SIZE/4)
  62. #define IDIAG_BARACC_BAR_NUM_INDX 0
  63. #define IDIAG_BARACC_OFF_SET_INDX 1
  64. #define IDIAG_BARACC_ACC_MOD_INDX 2
  65. #define IDIAG_BARACC_REG_VAL_INDX 2
  66. #define IDIAG_BARACC_BAR_SZE_INDX 3
  67. #define IDIAG_BARACC_BAR_0 0
  68. #define IDIAG_BARACC_BAR_1 1
  69. #define IDIAG_BARACC_BAR_2 2
  70. #define SINGLE_WORD 1
  71. /* queue info */
  72. #define LPFC_QUE_INFO_GET_BUF_SIZE 4096
  73. /* queue acc */
  74. #define LPFC_QUE_ACC_BROWSE 0xffff
  75. #define LPFC_QUE_ACC_RD_CMD_ARG 4
  76. #define LPFC_QUE_ACC_WR_CMD_ARG 6
  77. #define LPFC_QUE_ACC_BUF_SIZE 4096
  78. #define LPFC_QUE_ACC_SIZE (LPFC_QUE_ACC_BUF_SIZE/2)
  79. #define LPFC_IDIAG_EQ 1
  80. #define LPFC_IDIAG_CQ 2
  81. #define LPFC_IDIAG_MQ 3
  82. #define LPFC_IDIAG_WQ 4
  83. #define LPFC_IDIAG_RQ 5
  84. #define IDIAG_QUEACC_QUETP_INDX 0
  85. #define IDIAG_QUEACC_QUEID_INDX 1
  86. #define IDIAG_QUEACC_INDEX_INDX 2
  87. #define IDIAG_QUEACC_COUNT_INDX 3
  88. #define IDIAG_QUEACC_OFFST_INDX 4
  89. #define IDIAG_QUEACC_VALUE_INDX 5
  90. /* doorbell register acc */
  91. #define LPFC_DRB_ACC_ALL 0xffff
  92. #define LPFC_DRB_ACC_RD_CMD_ARG 1
  93. #define LPFC_DRB_ACC_WR_CMD_ARG 2
  94. #define LPFC_DRB_ACC_BUF_SIZE 256
  95. #define LPFC_DRB_EQCQ 1
  96. #define LPFC_DRB_MQ 2
  97. #define LPFC_DRB_WQ 3
  98. #define LPFC_DRB_RQ 4
  99. #define LPFC_DRB_MAX 4
  100. #define IDIAG_DRBACC_REGID_INDX 0
  101. #define IDIAG_DRBACC_VALUE_INDX 1
  102. /* control register acc */
  103. #define LPFC_CTL_ACC_ALL 0xffff
  104. #define LPFC_CTL_ACC_RD_CMD_ARG 1
  105. #define LPFC_CTL_ACC_WR_CMD_ARG 2
  106. #define LPFC_CTL_ACC_BUF_SIZE 256
  107. #define LPFC_CTL_PORT_SEM 1
  108. #define LPFC_CTL_PORT_STA 2
  109. #define LPFC_CTL_PORT_CTL 3
  110. #define LPFC_CTL_PORT_ER1 4
  111. #define LPFC_CTL_PORT_ER2 5
  112. #define LPFC_CTL_PDEV_CTL 6
  113. #define LPFC_CTL_MAX 6
  114. #define IDIAG_CTLACC_REGID_INDX 0
  115. #define IDIAG_CTLACC_VALUE_INDX 1
  116. /* mailbox access */
  117. #define LPFC_MBX_DMP_ARG 4
  118. #define LPFC_MBX_ACC_BUF_SIZE 512
  119. #define LPFC_MBX_ACC_LBUF_SZ 128
  120. #define LPFC_MBX_DMP_MBX_WORD 0x00000001
  121. #define LPFC_MBX_DMP_MBX_BYTE 0x00000002
  122. #define LPFC_MBX_DMP_MBX_ALL (LPFC_MBX_DMP_MBX_WORD | LPFC_MBX_DMP_MBX_BYTE)
  123. #define LPFC_BSG_DMP_MBX_RD_MBX 0x00000001
  124. #define LPFC_BSG_DMP_MBX_RD_BUF 0x00000002
  125. #define LPFC_BSG_DMP_MBX_WR_MBX 0x00000004
  126. #define LPFC_BSG_DMP_MBX_WR_BUF 0x00000008
  127. #define LPFC_BSG_DMP_MBX_ALL (LPFC_BSG_DMP_MBX_RD_MBX | \
  128. LPFC_BSG_DMP_MBX_RD_BUF | \
  129. LPFC_BSG_DMP_MBX_WR_MBX | \
  130. LPFC_BSG_DMP_MBX_WR_BUF)
  131. #define LPFC_MBX_DMP_ALL 0xffff
  132. #define LPFC_MBX_ALL_CMD 0xff
  133. #define IDIAG_MBXACC_MBCMD_INDX 0
  134. #define IDIAG_MBXACC_DPMAP_INDX 1
  135. #define IDIAG_MBXACC_DPCNT_INDX 2
  136. #define IDIAG_MBXACC_WDCNT_INDX 3
  137. /* extents access */
  138. #define LPFC_EXT_ACC_CMD_ARG 1
  139. #define LPFC_EXT_ACC_BUF_SIZE 4096
  140. #define LPFC_EXT_ACC_AVAIL 0x1
  141. #define LPFC_EXT_ACC_ALLOC 0x2
  142. #define LPFC_EXT_ACC_DRIVR 0x4
  143. #define LPFC_EXT_ACC_ALL (LPFC_EXT_ACC_DRIVR | \
  144. LPFC_EXT_ACC_AVAIL | \
  145. LPFC_EXT_ACC_ALLOC)
  146. #define IDIAG_EXTACC_EXMAP_INDX 0
  147. #define SIZE_U8 sizeof(uint8_t)
  148. #define SIZE_U16 sizeof(uint16_t)
  149. #define SIZE_U32 sizeof(uint32_t)
  150. struct lpfc_debug {
  151. char *i_private;
  152. char op;
  153. #define LPFC_IDIAG_OP_RD 1
  154. #define LPFC_IDIAG_OP_WR 2
  155. char *buffer;
  156. int len;
  157. };
  158. struct lpfc_debugfs_trc {
  159. char *fmt;
  160. uint32_t data1;
  161. uint32_t data2;
  162. uint32_t data3;
  163. uint32_t seq_cnt;
  164. unsigned long jif;
  165. };
  166. struct lpfc_idiag_offset {
  167. uint32_t last_rd;
  168. };
  169. #define LPFC_IDIAG_CMD_DATA_SIZE 8
  170. struct lpfc_idiag_cmd {
  171. uint32_t opcode;
  172. #define LPFC_IDIAG_CMD_PCICFG_RD 0x00000001
  173. #define LPFC_IDIAG_CMD_PCICFG_WR 0x00000002
  174. #define LPFC_IDIAG_CMD_PCICFG_ST 0x00000003
  175. #define LPFC_IDIAG_CMD_PCICFG_CL 0x00000004
  176. #define LPFC_IDIAG_CMD_BARACC_RD 0x00000008
  177. #define LPFC_IDIAG_CMD_BARACC_WR 0x00000009
  178. #define LPFC_IDIAG_CMD_BARACC_ST 0x0000000a
  179. #define LPFC_IDIAG_CMD_BARACC_CL 0x0000000b
  180. #define LPFC_IDIAG_CMD_QUEACC_RD 0x00000011
  181. #define LPFC_IDIAG_CMD_QUEACC_WR 0x00000012
  182. #define LPFC_IDIAG_CMD_QUEACC_ST 0x00000013
  183. #define LPFC_IDIAG_CMD_QUEACC_CL 0x00000014
  184. #define LPFC_IDIAG_CMD_DRBACC_RD 0x00000021
  185. #define LPFC_IDIAG_CMD_DRBACC_WR 0x00000022
  186. #define LPFC_IDIAG_CMD_DRBACC_ST 0x00000023
  187. #define LPFC_IDIAG_CMD_DRBACC_CL 0x00000024
  188. #define LPFC_IDIAG_CMD_CTLACC_RD 0x00000031
  189. #define LPFC_IDIAG_CMD_CTLACC_WR 0x00000032
  190. #define LPFC_IDIAG_CMD_CTLACC_ST 0x00000033
  191. #define LPFC_IDIAG_CMD_CTLACC_CL 0x00000034
  192. #define LPFC_IDIAG_CMD_MBXACC_DP 0x00000041
  193. #define LPFC_IDIAG_BSG_MBXACC_DP 0x00000042
  194. #define LPFC_IDIAG_CMD_EXTACC_RD 0x00000051
  195. uint32_t data[LPFC_IDIAG_CMD_DATA_SIZE];
  196. };
  197. struct lpfc_idiag {
  198. uint32_t active;
  199. struct lpfc_idiag_cmd cmd;
  200. struct lpfc_idiag_offset offset;
  201. void *ptr_private;
  202. };
  203. #endif
  204. /* Mask for discovery_trace */
  205. #define LPFC_DISC_TRC_ELS_CMD 0x1 /* Trace ELS commands */
  206. #define LPFC_DISC_TRC_ELS_RSP 0x2 /* Trace ELS response */
  207. #define LPFC_DISC_TRC_ELS_UNSOL 0x4 /* Trace ELS rcv'ed */
  208. #define LPFC_DISC_TRC_ELS_ALL 0x7 /* Trace ELS */
  209. #define LPFC_DISC_TRC_MBOX_VPORT 0x8 /* Trace vport MBOXs */
  210. #define LPFC_DISC_TRC_MBOX 0x10 /* Trace other MBOXs */
  211. #define LPFC_DISC_TRC_MBOX_ALL 0x18 /* Trace all MBOXs */
  212. #define LPFC_DISC_TRC_CT 0x20 /* Trace disc CT requests */
  213. #define LPFC_DISC_TRC_DSM 0x40 /* Trace DSM events */
  214. #define LPFC_DISC_TRC_RPORT 0x80 /* Trace rport events */
  215. #define LPFC_DISC_TRC_NODE 0x100 /* Trace ndlp state changes */
  216. #define LPFC_DISC_TRC_DISCOVERY 0xef /* common mask for general
  217. * discovery */
  218. #endif /* H_LPFC_DEBUG_FS */
  219. /*
  220. * Driver debug utility routines outside of debugfs. The debug utility
  221. * routines implemented here is intended to be used in the instrumented
  222. * debug driver for debugging host or port issues.
  223. */
  224. /**
  225. * lpfc_debug_dump_qe - dump an specific entry from a queue
  226. * @q: Pointer to the queue descriptor.
  227. * @idx: Index to the entry on the queue.
  228. *
  229. * This function dumps an entry indexed by @idx from a queue specified by the
  230. * queue descriptor @q.
  231. **/
  232. static inline void
  233. lpfc_debug_dump_qe(struct lpfc_queue *q, uint32_t idx)
  234. {
  235. char line_buf[LPFC_LBUF_SZ];
  236. int i, esize, qe_word_cnt, len;
  237. uint32_t *pword;
  238. /* sanity checks */
  239. if (!q)
  240. return;
  241. if (idx >= q->entry_count)
  242. return;
  243. esize = q->entry_size;
  244. qe_word_cnt = esize / sizeof(uint32_t);
  245. pword = q->qe[idx].address;
  246. len = 0;
  247. len += snprintf(line_buf+len, LPFC_LBUF_SZ-len, "QE[%04d]: ", idx);
  248. if (qe_word_cnt > 8)
  249. printk(KERN_ERR "%s\n", line_buf);
  250. for (i = 0; i < qe_word_cnt; i++) {
  251. if (!(i % 8)) {
  252. if (i != 0)
  253. printk(KERN_ERR "%s\n", line_buf);
  254. if (qe_word_cnt > 8) {
  255. len = 0;
  256. memset(line_buf, 0, LPFC_LBUF_SZ);
  257. len += snprintf(line_buf+len, LPFC_LBUF_SZ-len,
  258. "%03d: ", i);
  259. }
  260. }
  261. len += snprintf(line_buf+len, LPFC_LBUF_SZ-len, "%08x ",
  262. ((uint32_t)*pword) & 0xffffffff);
  263. pword++;
  264. }
  265. if (qe_word_cnt <= 8 || (i - 1) % 8)
  266. printk(KERN_ERR "%s\n", line_buf);
  267. }
  268. /**
  269. * lpfc_debug_dump_q - dump all entries from an specific queue
  270. * @q: Pointer to the queue descriptor.
  271. *
  272. * This function dumps all entries from a queue specified by the queue
  273. * descriptor @q.
  274. **/
  275. static inline void
  276. lpfc_debug_dump_q(struct lpfc_queue *q)
  277. {
  278. int idx, entry_count;
  279. /* sanity check */
  280. if (!q)
  281. return;
  282. dev_printk(KERN_ERR, &(((q->phba))->pcidev)->dev,
  283. "%d: [qid:%d, type:%d, subtype:%d, "
  284. "qe_size:%d, qe_count:%d, "
  285. "host_index:%d, port_index:%d]\n",
  286. (q->phba)->brd_no,
  287. q->queue_id, q->type, q->subtype,
  288. q->entry_size, q->entry_count,
  289. q->host_index, q->hba_index);
  290. entry_count = q->entry_count;
  291. for (idx = 0; idx < entry_count; idx++)
  292. lpfc_debug_dump_qe(q, idx);
  293. printk(KERN_ERR "\n");
  294. }
  295. /**
  296. * lpfc_debug_dump_fcp_wq - dump all entries from a fcp work queue
  297. * @phba: Pointer to HBA context object.
  298. * @fcp_wqidx: Index to a FCP work queue.
  299. *
  300. * This function dumps all entries from a FCP work queue specified by the
  301. * @fcp_wqidx.
  302. **/
  303. static inline void
  304. lpfc_debug_dump_fcp_wq(struct lpfc_hba *phba, int fcp_wqidx)
  305. {
  306. /* sanity check */
  307. if (fcp_wqidx >= phba->cfg_fcp_io_channel)
  308. return;
  309. printk(KERN_ERR "FCP WQ: WQ[Idx:%d|Qid:%d]\n",
  310. fcp_wqidx, phba->sli4_hba.fcp_wq[fcp_wqidx]->queue_id);
  311. lpfc_debug_dump_q(phba->sli4_hba.fcp_wq[fcp_wqidx]);
  312. }
  313. /**
  314. * lpfc_debug_dump_fcp_cq - dump all entries from a fcp work queue's cmpl queue
  315. * @phba: Pointer to HBA context object.
  316. * @fcp_wqidx: Index to a FCP work queue.
  317. *
  318. * This function dumps all entries from a FCP complete queue which is
  319. * associated to the FCP work queue specified by the @fcp_wqidx.
  320. **/
  321. static inline void
  322. lpfc_debug_dump_fcp_cq(struct lpfc_hba *phba, int fcp_wqidx)
  323. {
  324. int fcp_cqidx, fcp_cqid;
  325. /* sanity check */
  326. if (fcp_wqidx >= phba->cfg_fcp_io_channel)
  327. return;
  328. fcp_cqid = phba->sli4_hba.fcp_wq[fcp_wqidx]->assoc_qid;
  329. for (fcp_cqidx = 0; fcp_cqidx < phba->cfg_fcp_io_channel; fcp_cqidx++)
  330. if (phba->sli4_hba.fcp_cq[fcp_cqidx]->queue_id == fcp_cqid)
  331. break;
  332. if (phba->intr_type == MSIX) {
  333. if (fcp_cqidx >= phba->cfg_fcp_io_channel)
  334. return;
  335. } else {
  336. if (fcp_cqidx > 0)
  337. return;
  338. }
  339. printk(KERN_ERR "FCP CQ: WQ[Idx:%d|Qid%d]->CQ[Idx%d|Qid%d]:\n",
  340. fcp_wqidx, phba->sli4_hba.fcp_wq[fcp_wqidx]->queue_id,
  341. fcp_cqidx, fcp_cqid);
  342. lpfc_debug_dump_q(phba->sli4_hba.fcp_cq[fcp_cqidx]);
  343. }
  344. /**
  345. * lpfc_debug_dump_hba_eq - dump all entries from a fcp work queue's evt queue
  346. * @phba: Pointer to HBA context object.
  347. * @fcp_wqidx: Index to a FCP work queue.
  348. *
  349. * This function dumps all entries from a FCP event queue which is
  350. * associated to the FCP work queue specified by the @fcp_wqidx.
  351. **/
  352. static inline void
  353. lpfc_debug_dump_hba_eq(struct lpfc_hba *phba, int fcp_wqidx)
  354. {
  355. struct lpfc_queue *qdesc;
  356. int fcp_eqidx, fcp_eqid;
  357. int fcp_cqidx, fcp_cqid;
  358. /* sanity check */
  359. if (fcp_wqidx >= phba->cfg_fcp_io_channel)
  360. return;
  361. fcp_cqid = phba->sli4_hba.fcp_wq[fcp_wqidx]->assoc_qid;
  362. for (fcp_cqidx = 0; fcp_cqidx < phba->cfg_fcp_io_channel; fcp_cqidx++)
  363. if (phba->sli4_hba.fcp_cq[fcp_cqidx]->queue_id == fcp_cqid)
  364. break;
  365. if (phba->intr_type == MSIX) {
  366. if (fcp_cqidx >= phba->cfg_fcp_io_channel)
  367. return;
  368. } else {
  369. if (fcp_cqidx > 0)
  370. return;
  371. }
  372. fcp_eqidx = fcp_cqidx;
  373. fcp_eqid = phba->sli4_hba.hba_eq[fcp_eqidx]->queue_id;
  374. qdesc = phba->sli4_hba.hba_eq[fcp_eqidx];
  375. printk(KERN_ERR "FCP EQ: WQ[Idx:%d|Qid:%d]->CQ[Idx:%d|Qid:%d]->"
  376. "EQ[Idx:%d|Qid:%d]\n",
  377. fcp_wqidx, phba->sli4_hba.fcp_wq[fcp_wqidx]->queue_id,
  378. fcp_cqidx, fcp_cqid, fcp_eqidx, fcp_eqid);
  379. lpfc_debug_dump_q(qdesc);
  380. }
  381. /**
  382. * lpfc_debug_dump_els_wq - dump all entries from the els work queue
  383. * @phba: Pointer to HBA context object.
  384. *
  385. * This function dumps all entries from the ELS work queue.
  386. **/
  387. static inline void
  388. lpfc_debug_dump_els_wq(struct lpfc_hba *phba)
  389. {
  390. printk(KERN_ERR "ELS WQ: WQ[Qid:%d]:\n",
  391. phba->sli4_hba.els_wq->queue_id);
  392. lpfc_debug_dump_q(phba->sli4_hba.els_wq);
  393. }
  394. /**
  395. * lpfc_debug_dump_mbx_wq - dump all entries from the mbox work queue
  396. * @phba: Pointer to HBA context object.
  397. *
  398. * This function dumps all entries from the MBOX work queue.
  399. **/
  400. static inline void
  401. lpfc_debug_dump_mbx_wq(struct lpfc_hba *phba)
  402. {
  403. printk(KERN_ERR "MBX WQ: WQ[Qid:%d]\n",
  404. phba->sli4_hba.mbx_wq->queue_id);
  405. lpfc_debug_dump_q(phba->sli4_hba.mbx_wq);
  406. }
  407. /**
  408. * lpfc_debug_dump_dat_rq - dump all entries from the receive data queue
  409. * @phba: Pointer to HBA context object.
  410. *
  411. * This function dumps all entries from the receive data queue.
  412. **/
  413. static inline void
  414. lpfc_debug_dump_dat_rq(struct lpfc_hba *phba)
  415. {
  416. printk(KERN_ERR "DAT RQ: RQ[Qid:%d]\n",
  417. phba->sli4_hba.dat_rq->queue_id);
  418. lpfc_debug_dump_q(phba->sli4_hba.dat_rq);
  419. }
  420. /**
  421. * lpfc_debug_dump_hdr_rq - dump all entries from the receive header queue
  422. * @phba: Pointer to HBA context object.
  423. *
  424. * This function dumps all entries from the receive header queue.
  425. **/
  426. static inline void
  427. lpfc_debug_dump_hdr_rq(struct lpfc_hba *phba)
  428. {
  429. printk(KERN_ERR "HDR RQ: RQ[Qid:%d]\n",
  430. phba->sli4_hba.hdr_rq->queue_id);
  431. lpfc_debug_dump_q(phba->sli4_hba.hdr_rq);
  432. }
  433. /**
  434. * lpfc_debug_dump_els_cq - dump all entries from the els complete queue
  435. * @phba: Pointer to HBA context object.
  436. *
  437. * This function dumps all entries from the els complete queue.
  438. **/
  439. static inline void
  440. lpfc_debug_dump_els_cq(struct lpfc_hba *phba)
  441. {
  442. printk(KERN_ERR "ELS CQ: WQ[Qid:%d]->CQ[Qid:%d]\n",
  443. phba->sli4_hba.els_wq->queue_id,
  444. phba->sli4_hba.els_cq->queue_id);
  445. lpfc_debug_dump_q(phba->sli4_hba.els_cq);
  446. }
  447. /**
  448. * lpfc_debug_dump_mbx_cq - dump all entries from the mbox complete queue
  449. * @phba: Pointer to HBA context object.
  450. *
  451. * This function dumps all entries from the mbox complete queue.
  452. **/
  453. static inline void
  454. lpfc_debug_dump_mbx_cq(struct lpfc_hba *phba)
  455. {
  456. printk(KERN_ERR "MBX CQ: WQ[Qid:%d]->CQ[Qid:%d]\n",
  457. phba->sli4_hba.mbx_wq->queue_id,
  458. phba->sli4_hba.mbx_cq->queue_id);
  459. lpfc_debug_dump_q(phba->sli4_hba.mbx_cq);
  460. }
  461. /**
  462. * lpfc_debug_dump_wq_by_id - dump all entries from a work queue by queue id
  463. * @phba: Pointer to HBA context object.
  464. * @qid: Work queue identifier.
  465. *
  466. * This function dumps all entries from a work queue identified by the queue
  467. * identifier.
  468. **/
  469. static inline void
  470. lpfc_debug_dump_wq_by_id(struct lpfc_hba *phba, int qid)
  471. {
  472. int wq_idx;
  473. for (wq_idx = 0; wq_idx < phba->cfg_fcp_io_channel; wq_idx++)
  474. if (phba->sli4_hba.fcp_wq[wq_idx]->queue_id == qid)
  475. break;
  476. if (wq_idx < phba->cfg_fcp_io_channel) {
  477. printk(KERN_ERR "FCP WQ[Idx:%d|Qid:%d]\n", wq_idx, qid);
  478. lpfc_debug_dump_q(phba->sli4_hba.fcp_wq[wq_idx]);
  479. return;
  480. }
  481. if (phba->sli4_hba.els_wq->queue_id == qid) {
  482. printk(KERN_ERR "ELS WQ[Qid:%d]\n", qid);
  483. lpfc_debug_dump_q(phba->sli4_hba.els_wq);
  484. }
  485. }
  486. /**
  487. * lpfc_debug_dump_mq_by_id - dump all entries from a mbox queue by queue id
  488. * @phba: Pointer to HBA context object.
  489. * @qid: Mbox work queue identifier.
  490. *
  491. * This function dumps all entries from a mbox work queue identified by the
  492. * queue identifier.
  493. **/
  494. static inline void
  495. lpfc_debug_dump_mq_by_id(struct lpfc_hba *phba, int qid)
  496. {
  497. if (phba->sli4_hba.mbx_wq->queue_id == qid) {
  498. printk(KERN_ERR "MBX WQ[Qid:%d]\n", qid);
  499. lpfc_debug_dump_q(phba->sli4_hba.mbx_wq);
  500. }
  501. }
  502. /**
  503. * lpfc_debug_dump_rq_by_id - dump all entries from a receive queue by queue id
  504. * @phba: Pointer to HBA context object.
  505. * @qid: Receive queue identifier.
  506. *
  507. * This function dumps all entries from a receive queue identified by the
  508. * queue identifier.
  509. **/
  510. static inline void
  511. lpfc_debug_dump_rq_by_id(struct lpfc_hba *phba, int qid)
  512. {
  513. if (phba->sli4_hba.hdr_rq->queue_id == qid) {
  514. printk(KERN_ERR "HDR RQ[Qid:%d]\n", qid);
  515. lpfc_debug_dump_q(phba->sli4_hba.hdr_rq);
  516. return;
  517. }
  518. if (phba->sli4_hba.dat_rq->queue_id == qid) {
  519. printk(KERN_ERR "DAT RQ[Qid:%d]\n", qid);
  520. lpfc_debug_dump_q(phba->sli4_hba.dat_rq);
  521. }
  522. }
  523. /**
  524. * lpfc_debug_dump_cq_by_id - dump all entries from a cmpl queue by queue id
  525. * @phba: Pointer to HBA context object.
  526. * @qid: Complete queue identifier.
  527. *
  528. * This function dumps all entries from a complete queue identified by the
  529. * queue identifier.
  530. **/
  531. static inline void
  532. lpfc_debug_dump_cq_by_id(struct lpfc_hba *phba, int qid)
  533. {
  534. int cq_idx = 0;
  535. do {
  536. if (phba->sli4_hba.fcp_cq[cq_idx]->queue_id == qid)
  537. break;
  538. } while (++cq_idx < phba->cfg_fcp_io_channel);
  539. if (cq_idx < phba->cfg_fcp_io_channel) {
  540. printk(KERN_ERR "FCP CQ[Idx:%d|Qid:%d]\n", cq_idx, qid);
  541. lpfc_debug_dump_q(phba->sli4_hba.fcp_cq[cq_idx]);
  542. return;
  543. }
  544. if (phba->sli4_hba.els_cq->queue_id == qid) {
  545. printk(KERN_ERR "ELS CQ[Qid:%d]\n", qid);
  546. lpfc_debug_dump_q(phba->sli4_hba.els_cq);
  547. return;
  548. }
  549. if (phba->sli4_hba.mbx_cq->queue_id == qid) {
  550. printk(KERN_ERR "MBX CQ[Qid:%d]\n", qid);
  551. lpfc_debug_dump_q(phba->sli4_hba.mbx_cq);
  552. }
  553. }
  554. /**
  555. * lpfc_debug_dump_eq_by_id - dump all entries from an event queue by queue id
  556. * @phba: Pointer to HBA context object.
  557. * @qid: Complete queue identifier.
  558. *
  559. * This function dumps all entries from an event queue identified by the
  560. * queue identifier.
  561. **/
  562. static inline void
  563. lpfc_debug_dump_eq_by_id(struct lpfc_hba *phba, int qid)
  564. {
  565. int eq_idx;
  566. for (eq_idx = 0; eq_idx < phba->cfg_fcp_io_channel; eq_idx++) {
  567. if (phba->sli4_hba.hba_eq[eq_idx]->queue_id == qid)
  568. break;
  569. }
  570. if (eq_idx < phba->cfg_fcp_io_channel) {
  571. printk(KERN_ERR "FCP EQ[Idx:%d|Qid:%d]\n", eq_idx, qid);
  572. lpfc_debug_dump_q(phba->sli4_hba.hba_eq[eq_idx]);
  573. return;
  574. }
  575. }
  576. void lpfc_debug_dump_all_queues(struct lpfc_hba *);