blob: 9ae2c4b5fd127ea93de4a5c29ca0e9c017c5e27d [file] [log] [blame]
James Smart858c9f62007-06-17 19:56:39 -05001/*******************************************************************
2 * This file is part of the Emulex Linux Device Driver for *
3 * Fibre Channel Host Bus Adapters. *
James Smart2a622bf2011-02-16 12:40:06 -05004 * Copyright (C) 2007-2011 Emulex. All rights reserved. *
James Smart858c9f62007-06-17 19:56:39 -05005 * 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
21#ifndef _H_LPFC_DEBUG_FS
22#define _H_LPFC_DEBUG_FS
23
James Smart923e4b62008-12-04 22:40:07 -050024#ifdef CONFIG_SCSI_LPFC_DEBUG_FS
James Smart2a622bf2011-02-16 12:40:06 -050025
26/* size of output line, for discovery_trace and slow_ring_trace */
27#define LPFC_DEBUG_TRC_ENTRY_SIZE 100
28
29/* nodelist output buffer size */
30#define LPFC_NODELIST_SIZE 8192
31#define LPFC_NODELIST_ENTRY_SIZE 120
32
33/* dumpHBASlim output buffer size */
34#define LPFC_DUMPHBASLIM_SIZE 4096
35
36/* dumpHostSlim output buffer size */
37#define LPFC_DUMPHOSTSLIM_SIZE 4096
38
James Smartb84daac2012-08-03 12:35:13 -040039/* dumpSLIqinfo output buffer size */
40#define LPFC_DUMPSLIQINFO_SIZE 4096
41
James Smart2a622bf2011-02-16 12:40:06 -050042/* hbqinfo output buffer size */
43#define LPFC_HBQINFO_SIZE 8192
44
James Smart1d9d5a92017-02-12 13:52:29 -080045enum {
46 DUMP_FCP,
47 DUMP_MBX,
48 DUMP_ELS,
49};
50
James Smartb76f2dc2011-07-22 18:37:42 -040051/*
52 * For SLI4 iDiag debugfs diagnostics tool
53 */
54
James Smart86a80842011-04-16 11:03:04 -040055/* pciConf */
56#define LPFC_PCI_CFG_BROWSE 0xffff
57#define LPFC_PCI_CFG_RD_CMD_ARG 2
58#define LPFC_PCI_CFG_WR_CMD_ARG 3
James Smart2a622bf2011-02-16 12:40:06 -050059#define LPFC_PCI_CFG_SIZE 4096
James Smart2a622bf2011-02-16 12:40:06 -050060#define LPFC_PCI_CFG_RD_SIZE (LPFC_PCI_CFG_SIZE/4)
61
James Smartb76f2dc2011-07-22 18:37:42 -040062#define IDIAG_PCICFG_WHERE_INDX 0
63#define IDIAG_PCICFG_COUNT_INDX 1
64#define IDIAG_PCICFG_VALUE_INDX 2
65
66/* barAcc */
67#define LPFC_PCI_BAR_BROWSE 0xffff
68#define LPFC_PCI_BAR_RD_CMD_ARG 3
69#define LPFC_PCI_BAR_WR_CMD_ARG 3
70
71#define LPFC_PCI_IF0_BAR0_SIZE (1024 * 16)
72#define LPFC_PCI_IF0_BAR1_SIZE (1024 * 128)
73#define LPFC_PCI_IF0_BAR2_SIZE (1024 * 128)
74#define LPFC_PCI_IF2_BAR0_SIZE (1024 * 32)
75
76#define LPFC_PCI_BAR_RD_BUF_SIZE 4096
77#define LPFC_PCI_BAR_RD_SIZE (LPFC_PCI_BAR_RD_BUF_SIZE/4)
78
79#define LPFC_PCI_IF0_BAR0_RD_SIZE (LPFC_PCI_IF0_BAR0_SIZE/4)
80#define LPFC_PCI_IF0_BAR1_RD_SIZE (LPFC_PCI_IF0_BAR1_SIZE/4)
81#define LPFC_PCI_IF0_BAR2_RD_SIZE (LPFC_PCI_IF0_BAR2_SIZE/4)
82#define LPFC_PCI_IF2_BAR0_RD_SIZE (LPFC_PCI_IF2_BAR0_SIZE/4)
83
84#define IDIAG_BARACC_BAR_NUM_INDX 0
85#define IDIAG_BARACC_OFF_SET_INDX 1
86#define IDIAG_BARACC_ACC_MOD_INDX 2
87#define IDIAG_BARACC_REG_VAL_INDX 2
88#define IDIAG_BARACC_BAR_SZE_INDX 3
89
90#define IDIAG_BARACC_BAR_0 0
91#define IDIAG_BARACC_BAR_1 1
92#define IDIAG_BARACC_BAR_2 2
93
94#define SINGLE_WORD 1
95
James Smart86a80842011-04-16 11:03:04 -040096/* queue info */
97#define LPFC_QUE_INFO_GET_BUF_SIZE 4096
98
99/* queue acc */
100#define LPFC_QUE_ACC_BROWSE 0xffff
101#define LPFC_QUE_ACC_RD_CMD_ARG 4
102#define LPFC_QUE_ACC_WR_CMD_ARG 6
103#define LPFC_QUE_ACC_BUF_SIZE 4096
104#define LPFC_QUE_ACC_SIZE (LPFC_QUE_ACC_BUF_SIZE/2)
105
106#define LPFC_IDIAG_EQ 1
107#define LPFC_IDIAG_CQ 2
108#define LPFC_IDIAG_MQ 3
109#define LPFC_IDIAG_WQ 4
110#define LPFC_IDIAG_RQ 5
111
James Smartb76f2dc2011-07-22 18:37:42 -0400112#define IDIAG_QUEACC_QUETP_INDX 0
113#define IDIAG_QUEACC_QUEID_INDX 1
114#define IDIAG_QUEACC_INDEX_INDX 2
115#define IDIAG_QUEACC_COUNT_INDX 3
116#define IDIAG_QUEACC_OFFST_INDX 4
117#define IDIAG_QUEACC_VALUE_INDX 5
118
119/* doorbell register acc */
James Smart86a80842011-04-16 11:03:04 -0400120#define LPFC_DRB_ACC_ALL 0xffff
121#define LPFC_DRB_ACC_RD_CMD_ARG 1
122#define LPFC_DRB_ACC_WR_CMD_ARG 2
123#define LPFC_DRB_ACC_BUF_SIZE 256
124
125#define LPFC_DRB_EQCQ 1
126#define LPFC_DRB_MQ 2
127#define LPFC_DRB_WQ 3
128#define LPFC_DRB_RQ 4
129
130#define LPFC_DRB_MAX 4
James Smart2a622bf2011-02-16 12:40:06 -0500131
James Smartb76f2dc2011-07-22 18:37:42 -0400132#define IDIAG_DRBACC_REGID_INDX 0
133#define IDIAG_DRBACC_VALUE_INDX 1
134
135/* control register acc */
136#define LPFC_CTL_ACC_ALL 0xffff
137#define LPFC_CTL_ACC_RD_CMD_ARG 1
138#define LPFC_CTL_ACC_WR_CMD_ARG 2
139#define LPFC_CTL_ACC_BUF_SIZE 256
140
141#define LPFC_CTL_PORT_SEM 1
142#define LPFC_CTL_PORT_STA 2
143#define LPFC_CTL_PORT_CTL 3
144#define LPFC_CTL_PORT_ER1 4
145#define LPFC_CTL_PORT_ER2 5
146#define LPFC_CTL_PDEV_CTL 6
147
148#define LPFC_CTL_MAX 6
149
150#define IDIAG_CTLACC_REGID_INDX 0
151#define IDIAG_CTLACC_VALUE_INDX 1
152
153/* mailbox access */
154#define LPFC_MBX_DMP_ARG 4
155
156#define LPFC_MBX_ACC_BUF_SIZE 512
157#define LPFC_MBX_ACC_LBUF_SZ 128
158
159#define LPFC_MBX_DMP_MBX_WORD 0x00000001
160#define LPFC_MBX_DMP_MBX_BYTE 0x00000002
161#define LPFC_MBX_DMP_MBX_ALL (LPFC_MBX_DMP_MBX_WORD | LPFC_MBX_DMP_MBX_BYTE)
162
163#define LPFC_BSG_DMP_MBX_RD_MBX 0x00000001
164#define LPFC_BSG_DMP_MBX_RD_BUF 0x00000002
165#define LPFC_BSG_DMP_MBX_WR_MBX 0x00000004
166#define LPFC_BSG_DMP_MBX_WR_BUF 0x00000008
167#define LPFC_BSG_DMP_MBX_ALL (LPFC_BSG_DMP_MBX_RD_MBX | \
168 LPFC_BSG_DMP_MBX_RD_BUF | \
169 LPFC_BSG_DMP_MBX_WR_MBX | \
170 LPFC_BSG_DMP_MBX_WR_BUF)
171
172#define LPFC_MBX_DMP_ALL 0xffff
173#define LPFC_MBX_ALL_CMD 0xff
174
175#define IDIAG_MBXACC_MBCMD_INDX 0
176#define IDIAG_MBXACC_DPMAP_INDX 1
177#define IDIAG_MBXACC_DPCNT_INDX 2
178#define IDIAG_MBXACC_WDCNT_INDX 3
179
180/* extents access */
181#define LPFC_EXT_ACC_CMD_ARG 1
182#define LPFC_EXT_ACC_BUF_SIZE 4096
183
184#define LPFC_EXT_ACC_AVAIL 0x1
185#define LPFC_EXT_ACC_ALLOC 0x2
186#define LPFC_EXT_ACC_DRIVR 0x4
187#define LPFC_EXT_ACC_ALL (LPFC_EXT_ACC_DRIVR | \
188 LPFC_EXT_ACC_AVAIL | \
189 LPFC_EXT_ACC_ALLOC)
190
191#define IDIAG_EXTACC_EXMAP_INDX 0
192
James Smart2a622bf2011-02-16 12:40:06 -0500193#define SIZE_U8 sizeof(uint8_t)
194#define SIZE_U16 sizeof(uint16_t)
195#define SIZE_U32 sizeof(uint32_t)
196
197struct lpfc_debug {
198 char *i_private;
199 char op;
200#define LPFC_IDIAG_OP_RD 1
201#define LPFC_IDIAG_OP_WR 2
202 char *buffer;
203 int len;
204};
205
James Smarta58cbd52007-08-02 11:09:43 -0400206struct lpfc_debugfs_trc {
James Smart858c9f62007-06-17 19:56:39 -0500207 char *fmt;
208 uint32_t data1;
209 uint32_t data2;
210 uint32_t data3;
211 uint32_t seq_cnt;
212 unsigned long jif;
213};
James Smart2a622bf2011-02-16 12:40:06 -0500214
215struct lpfc_idiag_offset {
216 uint32_t last_rd;
217};
218
James Smart86a80842011-04-16 11:03:04 -0400219#define LPFC_IDIAG_CMD_DATA_SIZE 8
James Smart2a622bf2011-02-16 12:40:06 -0500220struct lpfc_idiag_cmd {
221 uint32_t opcode;
222#define LPFC_IDIAG_CMD_PCICFG_RD 0x00000001
223#define LPFC_IDIAG_CMD_PCICFG_WR 0x00000002
224#define LPFC_IDIAG_CMD_PCICFG_ST 0x00000003
225#define LPFC_IDIAG_CMD_PCICFG_CL 0x00000004
James Smart86a80842011-04-16 11:03:04 -0400226
James Smartb76f2dc2011-07-22 18:37:42 -0400227#define LPFC_IDIAG_CMD_BARACC_RD 0x00000008
228#define LPFC_IDIAG_CMD_BARACC_WR 0x00000009
229#define LPFC_IDIAG_CMD_BARACC_ST 0x0000000a
230#define LPFC_IDIAG_CMD_BARACC_CL 0x0000000b
231
James Smart86a80842011-04-16 11:03:04 -0400232#define LPFC_IDIAG_CMD_QUEACC_RD 0x00000011
233#define LPFC_IDIAG_CMD_QUEACC_WR 0x00000012
234#define LPFC_IDIAG_CMD_QUEACC_ST 0x00000013
235#define LPFC_IDIAG_CMD_QUEACC_CL 0x00000014
236
237#define LPFC_IDIAG_CMD_DRBACC_RD 0x00000021
238#define LPFC_IDIAG_CMD_DRBACC_WR 0x00000022
239#define LPFC_IDIAG_CMD_DRBACC_ST 0x00000023
240#define LPFC_IDIAG_CMD_DRBACC_CL 0x00000024
James Smartb76f2dc2011-07-22 18:37:42 -0400241
242#define LPFC_IDIAG_CMD_CTLACC_RD 0x00000031
243#define LPFC_IDIAG_CMD_CTLACC_WR 0x00000032
244#define LPFC_IDIAG_CMD_CTLACC_ST 0x00000033
245#define LPFC_IDIAG_CMD_CTLACC_CL 0x00000034
246
247#define LPFC_IDIAG_CMD_MBXACC_DP 0x00000041
248#define LPFC_IDIAG_BSG_MBXACC_DP 0x00000042
249
250#define LPFC_IDIAG_CMD_EXTACC_RD 0x00000051
251
James Smart2a622bf2011-02-16 12:40:06 -0500252 uint32_t data[LPFC_IDIAG_CMD_DATA_SIZE];
253};
254
255struct lpfc_idiag {
256 uint32_t active;
257 struct lpfc_idiag_cmd cmd;
258 struct lpfc_idiag_offset offset;
James Smart86a80842011-04-16 11:03:04 -0400259 void *ptr_private;
James Smart2a622bf2011-02-16 12:40:06 -0500260};
James Smart858c9f62007-06-17 19:56:39 -0500261#endif
262
263/* Mask for discovery_trace */
264#define LPFC_DISC_TRC_ELS_CMD 0x1 /* Trace ELS commands */
265#define LPFC_DISC_TRC_ELS_RSP 0x2 /* Trace ELS response */
266#define LPFC_DISC_TRC_ELS_UNSOL 0x4 /* Trace ELS rcv'ed */
267#define LPFC_DISC_TRC_ELS_ALL 0x7 /* Trace ELS */
268#define LPFC_DISC_TRC_MBOX_VPORT 0x8 /* Trace vport MBOXs */
269#define LPFC_DISC_TRC_MBOX 0x10 /* Trace other MBOXs */
270#define LPFC_DISC_TRC_MBOX_ALL 0x18 /* Trace all MBOXs */
271#define LPFC_DISC_TRC_CT 0x20 /* Trace disc CT requests */
272#define LPFC_DISC_TRC_DSM 0x40 /* Trace DSM events */
273#define LPFC_DISC_TRC_RPORT 0x80 /* Trace rport events */
274#define LPFC_DISC_TRC_NODE 0x100 /* Trace ndlp state changes */
275
276#define LPFC_DISC_TRC_DISCOVERY 0xef /* common mask for general
277 * discovery */
278#endif /* H_LPFC_DEBUG_FS */
James Smart809c7532012-05-09 21:19:25 -0400279
280
281/*
282 * Driver debug utility routines outside of debugfs. The debug utility
283 * routines implemented here is intended to be used in the instrumented
284 * debug driver for debugging host or port issues.
285 */
286
287/**
288 * lpfc_debug_dump_qe - dump an specific entry from a queue
289 * @q: Pointer to the queue descriptor.
290 * @idx: Index to the entry on the queue.
291 *
292 * This function dumps an entry indexed by @idx from a queue specified by the
293 * queue descriptor @q.
294 **/
295static inline void
296lpfc_debug_dump_qe(struct lpfc_queue *q, uint32_t idx)
297{
298 char line_buf[LPFC_LBUF_SZ];
299 int i, esize, qe_word_cnt, len;
300 uint32_t *pword;
301
302 /* sanity checks */
303 if (!q)
304 return;
305 if (idx >= q->entry_count)
306 return;
307
308 esize = q->entry_size;
309 qe_word_cnt = esize / sizeof(uint32_t);
310 pword = q->qe[idx].address;
311
312 len = 0;
313 len += snprintf(line_buf+len, LPFC_LBUF_SZ-len, "QE[%04d]: ", idx);
314 if (qe_word_cnt > 8)
315 printk(KERN_ERR "%s\n", line_buf);
316
317 for (i = 0; i < qe_word_cnt; i++) {
318 if (!(i % 8)) {
319 if (i != 0)
320 printk(KERN_ERR "%s\n", line_buf);
321 if (qe_word_cnt > 8) {
322 len = 0;
323 memset(line_buf, 0, LPFC_LBUF_SZ);
324 len += snprintf(line_buf+len, LPFC_LBUF_SZ-len,
325 "%03d: ", i);
326 }
327 }
328 len += snprintf(line_buf+len, LPFC_LBUF_SZ-len, "%08x ",
329 ((uint32_t)*pword) & 0xffffffff);
330 pword++;
331 }
332 if (qe_word_cnt <= 8 || (i - 1) % 8)
333 printk(KERN_ERR "%s\n", line_buf);
334}
335
336/**
337 * lpfc_debug_dump_q - dump all entries from an specific queue
338 * @q: Pointer to the queue descriptor.
339 *
340 * This function dumps all entries from a queue specified by the queue
341 * descriptor @q.
342 **/
343static inline void
344lpfc_debug_dump_q(struct lpfc_queue *q)
345{
346 int idx, entry_count;
347
348 /* sanity check */
349 if (!q)
350 return;
351
352 dev_printk(KERN_ERR, &(((q->phba))->pcidev)->dev,
353 "%d: [qid:%d, type:%d, subtype:%d, "
354 "qe_size:%d, qe_count:%d, "
355 "host_index:%d, port_index:%d]\n",
356 (q->phba)->brd_no,
357 q->queue_id, q->type, q->subtype,
358 q->entry_size, q->entry_count,
359 q->host_index, q->hba_index);
360 entry_count = q->entry_count;
361 for (idx = 0; idx < entry_count; idx++)
362 lpfc_debug_dump_qe(q, idx);
363 printk(KERN_ERR "\n");
364}
365
366/**
James Smart1d9d5a92017-02-12 13:52:29 -0800367 * lpfc_debug_dump_wq - dump all entries from the fcp work queue
James Smart809c7532012-05-09 21:19:25 -0400368 * @phba: Pointer to HBA context object.
James Smart1d9d5a92017-02-12 13:52:29 -0800369 * @wqidx: Index to a FCP work queue.
James Smart809c7532012-05-09 21:19:25 -0400370 *
James Smart1d9d5a92017-02-12 13:52:29 -0800371 * This function dumps all entries from a FCP work queue specified
372 * by the wqidx.
James Smart809c7532012-05-09 21:19:25 -0400373 **/
374static inline void
James Smart1d9d5a92017-02-12 13:52:29 -0800375lpfc_debug_dump_wq(struct lpfc_hba *phba, int qtype, int wqidx)
James Smart809c7532012-05-09 21:19:25 -0400376{
James Smart1d9d5a92017-02-12 13:52:29 -0800377 struct lpfc_queue *wq;
378 char *qtypestr;
379
380 if (qtype == DUMP_FCP) {
381 wq = phba->sli4_hba.fcp_wq[wqidx];
382 qtypestr = "FCP";
383 } else if (qtype == DUMP_MBX) {
384 wq = phba->sli4_hba.mbx_wq;
385 qtypestr = "MBX";
386 } else if (qtype == DUMP_ELS) {
387 wq = phba->sli4_hba.els_wq;
388 qtypestr = "ELS";
389 } else
James Smart809c7532012-05-09 21:19:25 -0400390 return;
391
James Smart1d9d5a92017-02-12 13:52:29 -0800392 if (qtype == DUMP_FCP)
393 pr_err("%s WQ: WQ[Idx:%d|Qid:%d]\n",
394 qtypestr, wqidx, wq->queue_id);
395 else
396 pr_err("%s WQ: WQ[Qid:%d]\n",
397 qtypestr, wq->queue_id);
398
399 lpfc_debug_dump_q(wq);
James Smart809c7532012-05-09 21:19:25 -0400400}
401
402/**
James Smart1d9d5a92017-02-12 13:52:29 -0800403 * lpfc_debug_dump_cq - dump all entries from a fcp work queue's
404 * cmpl queue
James Smart809c7532012-05-09 21:19:25 -0400405 * @phba: Pointer to HBA context object.
James Smart1d9d5a92017-02-12 13:52:29 -0800406 * @wqidx: Index to a FCP work queue.
James Smart809c7532012-05-09 21:19:25 -0400407 *
James Smart1d9d5a92017-02-12 13:52:29 -0800408 * This function dumps all entries from a FCP completion queue
409 * which is associated to the work queue specified by the @wqidx.
James Smart809c7532012-05-09 21:19:25 -0400410 **/
411static inline void
James Smart1d9d5a92017-02-12 13:52:29 -0800412lpfc_debug_dump_cq(struct lpfc_hba *phba, int qtype, int wqidx)
James Smart809c7532012-05-09 21:19:25 -0400413{
James Smart1d9d5a92017-02-12 13:52:29 -0800414 struct lpfc_queue *wq, *cq, *eq;
415 char *qtypestr;
416 int eqidx;
James Smart809c7532012-05-09 21:19:25 -0400417
James Smart1d9d5a92017-02-12 13:52:29 -0800418 /* fcp wq and cq are 1:1, thus same indexes */
419
420 if (qtype == DUMP_FCP) {
421 wq = phba->sli4_hba.fcp_wq[wqidx];
422 cq = phba->sli4_hba.fcp_cq[wqidx];
423 qtypestr = "FCP";
424 } else if (qtype == DUMP_MBX) {
425 wq = phba->sli4_hba.mbx_wq;
426 cq = phba->sli4_hba.mbx_cq;
427 qtypestr = "MBX";
428 } else if (qtype == DUMP_ELS) {
429 wq = phba->sli4_hba.els_wq;
430 cq = phba->sli4_hba.els_cq;
431 qtypestr = "ELS";
432 } else
James Smart809c7532012-05-09 21:19:25 -0400433 return;
434
James Smart1d9d5a92017-02-12 13:52:29 -0800435 for (eqidx = 0; eqidx < phba->cfg_fcp_io_channel; eqidx++) {
436 eq = phba->sli4_hba.hba_eq[eqidx];
437 if (cq->assoc_qid == eq->queue_id)
James Smart809c7532012-05-09 21:19:25 -0400438 break;
James Smart1d9d5a92017-02-12 13:52:29 -0800439 }
440 if (eqidx == phba->cfg_fcp_io_channel) {
441 pr_err("Couldn't find EQ for CQ. Using EQ[0]\n");
442 eqidx = 0;
443 eq = phba->sli4_hba.hba_eq[0];
James Smart3b3da6a2012-06-12 13:54:20 -0400444 }
James Smart809c7532012-05-09 21:19:25 -0400445
James Smart1d9d5a92017-02-12 13:52:29 -0800446 if (qtype == DUMP_FCP)
447 pr_err("%s CQ: WQ[Idx:%d|Qid%d]->CQ[Idx%d|Qid%d]"
448 "->EQ[Idx:%d|Qid:%d]:\n",
449 qtypestr, wqidx, wq->queue_id, wqidx, cq->queue_id,
450 eqidx, eq->queue_id);
451 else
452 pr_err("%s CQ: WQ[Qid:%d]->CQ[Qid:%d]"
453 "->EQ[Idx:%d|Qid:%d]:\n",
454 qtypestr, wq->queue_id, cq->queue_id,
455 eqidx, eq->queue_id);
456
457 lpfc_debug_dump_q(cq);
James Smart809c7532012-05-09 21:19:25 -0400458}
459
460/**
James Smart67d12732012-08-03 12:36:13 -0400461 * lpfc_debug_dump_hba_eq - dump all entries from a fcp work queue's evt queue
James Smart809c7532012-05-09 21:19:25 -0400462 * @phba: Pointer to HBA context object.
463 * @fcp_wqidx: Index to a FCP work queue.
464 *
465 * This function dumps all entries from a FCP event queue which is
466 * associated to the FCP work queue specified by the @fcp_wqidx.
467 **/
468static inline void
James Smart1d9d5a92017-02-12 13:52:29 -0800469lpfc_debug_dump_hba_eq(struct lpfc_hba *phba, int qidx)
James Smart809c7532012-05-09 21:19:25 -0400470{
James Smart1d9d5a92017-02-12 13:52:29 -0800471 struct lpfc_queue *qp;
James Smart809c7532012-05-09 21:19:25 -0400472
James Smart1d9d5a92017-02-12 13:52:29 -0800473 qp = phba->sli4_hba.hba_eq[qidx];
James Smart809c7532012-05-09 21:19:25 -0400474
James Smart1d9d5a92017-02-12 13:52:29 -0800475 pr_err("EQ[Idx:%d|Qid:%d]\n", qidx, qp->queue_id);
James Smart809c7532012-05-09 21:19:25 -0400476
James Smart1d9d5a92017-02-12 13:52:29 -0800477 lpfc_debug_dump_q(qp);
James Smart809c7532012-05-09 21:19:25 -0400478}
479
480/**
481 * lpfc_debug_dump_dat_rq - dump all entries from the receive data queue
482 * @phba: Pointer to HBA context object.
483 *
484 * This function dumps all entries from the receive data queue.
485 **/
486static inline void
487lpfc_debug_dump_dat_rq(struct lpfc_hba *phba)
488{
489 printk(KERN_ERR "DAT RQ: RQ[Qid:%d]\n",
490 phba->sli4_hba.dat_rq->queue_id);
491 lpfc_debug_dump_q(phba->sli4_hba.dat_rq);
492}
493
494/**
495 * lpfc_debug_dump_hdr_rq - dump all entries from the receive header queue
496 * @phba: Pointer to HBA context object.
497 *
498 * This function dumps all entries from the receive header queue.
499 **/
500static inline void
501lpfc_debug_dump_hdr_rq(struct lpfc_hba *phba)
502{
503 printk(KERN_ERR "HDR RQ: RQ[Qid:%d]\n",
504 phba->sli4_hba.hdr_rq->queue_id);
505 lpfc_debug_dump_q(phba->sli4_hba.hdr_rq);
506}
507
508/**
James Smart809c7532012-05-09 21:19:25 -0400509 * lpfc_debug_dump_wq_by_id - dump all entries from a work queue by queue id
510 * @phba: Pointer to HBA context object.
511 * @qid: Work queue identifier.
512 *
513 * This function dumps all entries from a work queue identified by the queue
514 * identifier.
515 **/
516static inline void
517lpfc_debug_dump_wq_by_id(struct lpfc_hba *phba, int qid)
518{
519 int wq_idx;
520
James Smart67d12732012-08-03 12:36:13 -0400521 for (wq_idx = 0; wq_idx < phba->cfg_fcp_io_channel; wq_idx++)
James Smart809c7532012-05-09 21:19:25 -0400522 if (phba->sli4_hba.fcp_wq[wq_idx]->queue_id == qid)
523 break;
James Smart67d12732012-08-03 12:36:13 -0400524 if (wq_idx < phba->cfg_fcp_io_channel) {
James Smart1d9d5a92017-02-12 13:52:29 -0800525 pr_err("FCP WQ[Idx:%d|Qid:%d]\n", wq_idx, qid);
James Smart809c7532012-05-09 21:19:25 -0400526 lpfc_debug_dump_q(phba->sli4_hba.fcp_wq[wq_idx]);
527 return;
528 }
529
530 if (phba->sli4_hba.els_wq->queue_id == qid) {
James Smart1d9d5a92017-02-12 13:52:29 -0800531 pr_err("ELS WQ[Qid:%d]\n", qid);
James Smart809c7532012-05-09 21:19:25 -0400532 lpfc_debug_dump_q(phba->sli4_hba.els_wq);
James Smart1d9d5a92017-02-12 13:52:29 -0800533 return;
James Smart809c7532012-05-09 21:19:25 -0400534 }
535}
536
537/**
538 * lpfc_debug_dump_mq_by_id - dump all entries from a mbox queue by queue id
539 * @phba: Pointer to HBA context object.
540 * @qid: Mbox work queue identifier.
541 *
542 * This function dumps all entries from a mbox work queue identified by the
543 * queue identifier.
544 **/
545static inline void
546lpfc_debug_dump_mq_by_id(struct lpfc_hba *phba, int qid)
547{
548 if (phba->sli4_hba.mbx_wq->queue_id == qid) {
549 printk(KERN_ERR "MBX WQ[Qid:%d]\n", qid);
550 lpfc_debug_dump_q(phba->sli4_hba.mbx_wq);
551 }
552}
553
554/**
555 * lpfc_debug_dump_rq_by_id - dump all entries from a receive queue by queue id
556 * @phba: Pointer to HBA context object.
557 * @qid: Receive queue identifier.
558 *
559 * This function dumps all entries from a receive queue identified by the
560 * queue identifier.
561 **/
562static inline void
563lpfc_debug_dump_rq_by_id(struct lpfc_hba *phba, int qid)
564{
565 if (phba->sli4_hba.hdr_rq->queue_id == qid) {
566 printk(KERN_ERR "HDR RQ[Qid:%d]\n", qid);
567 lpfc_debug_dump_q(phba->sli4_hba.hdr_rq);
568 return;
569 }
570 if (phba->sli4_hba.dat_rq->queue_id == qid) {
571 printk(KERN_ERR "DAT RQ[Qid:%d]\n", qid);
572 lpfc_debug_dump_q(phba->sli4_hba.dat_rq);
573 }
574}
575
576/**
577 * lpfc_debug_dump_cq_by_id - dump all entries from a cmpl queue by queue id
578 * @phba: Pointer to HBA context object.
579 * @qid: Complete queue identifier.
580 *
581 * This function dumps all entries from a complete queue identified by the
582 * queue identifier.
583 **/
584static inline void
585lpfc_debug_dump_cq_by_id(struct lpfc_hba *phba, int qid)
586{
James Smart1d9d5a92017-02-12 13:52:29 -0800587 int cq_idx;
James Smart809c7532012-05-09 21:19:25 -0400588
James Smart1d9d5a92017-02-12 13:52:29 -0800589 for (cq_idx = 0; cq_idx < phba->cfg_fcp_io_channel; cq_idx++)
James Smart809c7532012-05-09 21:19:25 -0400590 if (phba->sli4_hba.fcp_cq[cq_idx]->queue_id == qid)
591 break;
James Smart809c7532012-05-09 21:19:25 -0400592
James Smart67d12732012-08-03 12:36:13 -0400593 if (cq_idx < phba->cfg_fcp_io_channel) {
James Smart1d9d5a92017-02-12 13:52:29 -0800594 pr_err("FCP CQ[Idx:%d|Qid:%d]\n", cq_idx, qid);
James Smart809c7532012-05-09 21:19:25 -0400595 lpfc_debug_dump_q(phba->sli4_hba.fcp_cq[cq_idx]);
596 return;
597 }
598
599 if (phba->sli4_hba.els_cq->queue_id == qid) {
James Smart1d9d5a92017-02-12 13:52:29 -0800600 pr_err("ELS CQ[Qid:%d]\n", qid);
James Smart809c7532012-05-09 21:19:25 -0400601 lpfc_debug_dump_q(phba->sli4_hba.els_cq);
602 return;
603 }
604
605 if (phba->sli4_hba.mbx_cq->queue_id == qid) {
James Smart1d9d5a92017-02-12 13:52:29 -0800606 pr_err("MBX CQ[Qid:%d]\n", qid);
James Smart809c7532012-05-09 21:19:25 -0400607 lpfc_debug_dump_q(phba->sli4_hba.mbx_cq);
608 }
609}
610
611/**
612 * lpfc_debug_dump_eq_by_id - dump all entries from an event queue by queue id
613 * @phba: Pointer to HBA context object.
614 * @qid: Complete queue identifier.
615 *
616 * This function dumps all entries from an event queue identified by the
617 * queue identifier.
618 **/
619static inline void
620lpfc_debug_dump_eq_by_id(struct lpfc_hba *phba, int qid)
621{
622 int eq_idx;
623
James Smart67d12732012-08-03 12:36:13 -0400624 for (eq_idx = 0; eq_idx < phba->cfg_fcp_io_channel; eq_idx++) {
625 if (phba->sli4_hba.hba_eq[eq_idx]->queue_id == qid)
James Smart809c7532012-05-09 21:19:25 -0400626 break;
627 }
628
James Smart67d12732012-08-03 12:36:13 -0400629 if (eq_idx < phba->cfg_fcp_io_channel) {
James Smart809c7532012-05-09 21:19:25 -0400630 printk(KERN_ERR "FCP EQ[Idx:%d|Qid:%d]\n", eq_idx, qid);
James Smart67d12732012-08-03 12:36:13 -0400631 lpfc_debug_dump_q(phba->sli4_hba.hba_eq[eq_idx]);
James Smart809c7532012-05-09 21:19:25 -0400632 return;
633 }
634
James Smart809c7532012-05-09 21:19:25 -0400635}
636
637void lpfc_debug_dump_all_queues(struct lpfc_hba *);