18c2ecf20Sopenharmony_ci/*******************************************************************
28c2ecf20Sopenharmony_ci * This file is part of the Emulex Linux Device Driver for         *
38c2ecf20Sopenharmony_ci * Fibre Channel Host Bus Adapters.                                *
48c2ecf20Sopenharmony_ci * Copyright (C) 2017-2019 Broadcom. All Rights Reserved. The term *
58c2ecf20Sopenharmony_ci * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.     *
68c2ecf20Sopenharmony_ci * Copyright (C) 2007-2011 Emulex.  All rights reserved.           *
78c2ecf20Sopenharmony_ci * EMULEX and SLI are trademarks of Emulex.                        *
88c2ecf20Sopenharmony_ci * www.broadcom.com                                                *
98c2ecf20Sopenharmony_ci *                                                                 *
108c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or   *
118c2ecf20Sopenharmony_ci * modify it under the terms of version 2 of the GNU General       *
128c2ecf20Sopenharmony_ci * Public License as published by the Free Software Foundation.    *
138c2ecf20Sopenharmony_ci * This program is distributed in the hope that it will be useful. *
148c2ecf20Sopenharmony_ci * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND          *
158c2ecf20Sopenharmony_ci * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY,  *
168c2ecf20Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE      *
178c2ecf20Sopenharmony_ci * DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD *
188c2ecf20Sopenharmony_ci * TO BE LEGALLY INVALID.  See the GNU General Public License for  *
198c2ecf20Sopenharmony_ci * more details, a copy of which can be found in the file COPYING  *
208c2ecf20Sopenharmony_ci * included with this package.                                     *
218c2ecf20Sopenharmony_ci *******************************************************************/
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci#ifndef _H_LPFC_DEBUG_FS
248c2ecf20Sopenharmony_ci#define _H_LPFC_DEBUG_FS
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci#ifdef CONFIG_SCSI_LPFC_DEBUG_FS
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci/* size of output line, for discovery_trace and slow_ring_trace */
298c2ecf20Sopenharmony_ci#define LPFC_DEBUG_TRC_ENTRY_SIZE 100
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci/* nodelist output buffer size */
328c2ecf20Sopenharmony_ci#define LPFC_NODELIST_SIZE 8192
338c2ecf20Sopenharmony_ci#define LPFC_NODELIST_ENTRY_SIZE 120
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci/* dumpHBASlim output buffer size */
368c2ecf20Sopenharmony_ci#define LPFC_DUMPHBASLIM_SIZE 4096
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci/* dumpHostSlim output buffer size */
398c2ecf20Sopenharmony_ci#define LPFC_DUMPHOSTSLIM_SIZE 4096
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci/* dumpSLIqinfo output buffer size */
428c2ecf20Sopenharmony_ci#define	LPFC_DUMPSLIQINFO_SIZE 4096
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci/* hbqinfo output buffer size */
458c2ecf20Sopenharmony_ci#define LPFC_HBQINFO_SIZE 8192
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci/* nvmestat output buffer size */
488c2ecf20Sopenharmony_ci#define LPFC_NVMESTAT_SIZE 8192
498c2ecf20Sopenharmony_ci#define LPFC_IOKTIME_SIZE 8192
508c2ecf20Sopenharmony_ci#define LPFC_NVMEIO_TRC_SIZE 8192
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci/* scsistat output buffer size */
538c2ecf20Sopenharmony_ci#define LPFC_SCSISTAT_SIZE 8192
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci#define LPFC_DEBUG_OUT_LINE_SZ	80
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci/*
588c2ecf20Sopenharmony_ci * For SLI4 iDiag debugfs diagnostics tool
598c2ecf20Sopenharmony_ci */
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci/* pciConf */
628c2ecf20Sopenharmony_ci#define LPFC_PCI_CFG_BROWSE 0xffff
638c2ecf20Sopenharmony_ci#define LPFC_PCI_CFG_RD_CMD_ARG 2
648c2ecf20Sopenharmony_ci#define LPFC_PCI_CFG_WR_CMD_ARG 3
658c2ecf20Sopenharmony_ci#define LPFC_PCI_CFG_SIZE 4096
668c2ecf20Sopenharmony_ci#define LPFC_PCI_CFG_RD_SIZE (LPFC_PCI_CFG_SIZE/4)
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ci#define IDIAG_PCICFG_WHERE_INDX 0
698c2ecf20Sopenharmony_ci#define IDIAG_PCICFG_COUNT_INDX 1
708c2ecf20Sopenharmony_ci#define IDIAG_PCICFG_VALUE_INDX 2
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci/* barAcc */
738c2ecf20Sopenharmony_ci#define LPFC_PCI_BAR_BROWSE 0xffff
748c2ecf20Sopenharmony_ci#define LPFC_PCI_BAR_RD_CMD_ARG 3
758c2ecf20Sopenharmony_ci#define LPFC_PCI_BAR_WR_CMD_ARG 3
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci#define LPFC_PCI_IF0_BAR0_SIZE (1024 *  16)
788c2ecf20Sopenharmony_ci#define LPFC_PCI_IF0_BAR1_SIZE (1024 * 128)
798c2ecf20Sopenharmony_ci#define LPFC_PCI_IF0_BAR2_SIZE (1024 * 128)
808c2ecf20Sopenharmony_ci#define LPFC_PCI_IF2_BAR0_SIZE (1024 *  32)
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ci#define LPFC_PCI_BAR_RD_BUF_SIZE 4096
838c2ecf20Sopenharmony_ci#define LPFC_PCI_BAR_RD_SIZE (LPFC_PCI_BAR_RD_BUF_SIZE/4)
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ci#define LPFC_PCI_IF0_BAR0_RD_SIZE (LPFC_PCI_IF0_BAR0_SIZE/4)
868c2ecf20Sopenharmony_ci#define LPFC_PCI_IF0_BAR1_RD_SIZE (LPFC_PCI_IF0_BAR1_SIZE/4)
878c2ecf20Sopenharmony_ci#define LPFC_PCI_IF0_BAR2_RD_SIZE (LPFC_PCI_IF0_BAR2_SIZE/4)
888c2ecf20Sopenharmony_ci#define LPFC_PCI_IF2_BAR0_RD_SIZE (LPFC_PCI_IF2_BAR0_SIZE/4)
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_ci#define IDIAG_BARACC_BAR_NUM_INDX 0
918c2ecf20Sopenharmony_ci#define IDIAG_BARACC_OFF_SET_INDX 1
928c2ecf20Sopenharmony_ci#define IDIAG_BARACC_ACC_MOD_INDX 2
938c2ecf20Sopenharmony_ci#define IDIAG_BARACC_REG_VAL_INDX 2
948c2ecf20Sopenharmony_ci#define IDIAG_BARACC_BAR_SZE_INDX 3
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_ci#define IDIAG_BARACC_BAR_0 0
978c2ecf20Sopenharmony_ci#define IDIAG_BARACC_BAR_1 1
988c2ecf20Sopenharmony_ci#define IDIAG_BARACC_BAR_2 2
998c2ecf20Sopenharmony_ci
1008c2ecf20Sopenharmony_ci#define SINGLE_WORD 1
1018c2ecf20Sopenharmony_ci
1028c2ecf20Sopenharmony_ci/* queue info */
1038c2ecf20Sopenharmony_ci#define LPFC_QUE_INFO_GET_BUF_SIZE 4096
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_ci/* queue acc */
1068c2ecf20Sopenharmony_ci#define LPFC_QUE_ACC_BROWSE 0xffff
1078c2ecf20Sopenharmony_ci#define LPFC_QUE_ACC_RD_CMD_ARG 4
1088c2ecf20Sopenharmony_ci#define LPFC_QUE_ACC_WR_CMD_ARG 6
1098c2ecf20Sopenharmony_ci#define LPFC_QUE_ACC_BUF_SIZE 4096
1108c2ecf20Sopenharmony_ci#define LPFC_QUE_ACC_SIZE (LPFC_QUE_ACC_BUF_SIZE/2)
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_ci#define LPFC_IDIAG_EQ 1
1138c2ecf20Sopenharmony_ci#define LPFC_IDIAG_CQ 2
1148c2ecf20Sopenharmony_ci#define LPFC_IDIAG_MQ 3
1158c2ecf20Sopenharmony_ci#define LPFC_IDIAG_WQ 4
1168c2ecf20Sopenharmony_ci#define LPFC_IDIAG_RQ 5
1178c2ecf20Sopenharmony_ci
1188c2ecf20Sopenharmony_ci#define IDIAG_QUEACC_QUETP_INDX 0
1198c2ecf20Sopenharmony_ci#define IDIAG_QUEACC_QUEID_INDX 1
1208c2ecf20Sopenharmony_ci#define IDIAG_QUEACC_INDEX_INDX 2
1218c2ecf20Sopenharmony_ci#define IDIAG_QUEACC_COUNT_INDX 3
1228c2ecf20Sopenharmony_ci#define IDIAG_QUEACC_OFFST_INDX 4
1238c2ecf20Sopenharmony_ci#define IDIAG_QUEACC_VALUE_INDX 5
1248c2ecf20Sopenharmony_ci
1258c2ecf20Sopenharmony_ci/* doorbell register acc */
1268c2ecf20Sopenharmony_ci#define LPFC_DRB_ACC_ALL 0xffff
1278c2ecf20Sopenharmony_ci#define LPFC_DRB_ACC_RD_CMD_ARG 1
1288c2ecf20Sopenharmony_ci#define LPFC_DRB_ACC_WR_CMD_ARG 2
1298c2ecf20Sopenharmony_ci#define LPFC_DRB_ACC_BUF_SIZE 256
1308c2ecf20Sopenharmony_ci
1318c2ecf20Sopenharmony_ci#define LPFC_DRB_EQ   1
1328c2ecf20Sopenharmony_ci#define LPFC_DRB_CQ   2
1338c2ecf20Sopenharmony_ci#define LPFC_DRB_MQ   3
1348c2ecf20Sopenharmony_ci#define LPFC_DRB_WQ   4
1358c2ecf20Sopenharmony_ci#define LPFC_DRB_RQ   5
1368c2ecf20Sopenharmony_ci
1378c2ecf20Sopenharmony_ci#define LPFC_DRB_MAX  5
1388c2ecf20Sopenharmony_ci
1398c2ecf20Sopenharmony_ci#define IDIAG_DRBACC_REGID_INDX 0
1408c2ecf20Sopenharmony_ci#define IDIAG_DRBACC_VALUE_INDX 1
1418c2ecf20Sopenharmony_ci
1428c2ecf20Sopenharmony_ci/* control register acc */
1438c2ecf20Sopenharmony_ci#define LPFC_CTL_ACC_ALL 0xffff
1448c2ecf20Sopenharmony_ci#define LPFC_CTL_ACC_RD_CMD_ARG 1
1458c2ecf20Sopenharmony_ci#define LPFC_CTL_ACC_WR_CMD_ARG 2
1468c2ecf20Sopenharmony_ci#define LPFC_CTL_ACC_BUF_SIZE 256
1478c2ecf20Sopenharmony_ci
1488c2ecf20Sopenharmony_ci#define LPFC_CTL_PORT_SEM  1
1498c2ecf20Sopenharmony_ci#define LPFC_CTL_PORT_STA  2
1508c2ecf20Sopenharmony_ci#define LPFC_CTL_PORT_CTL  3
1518c2ecf20Sopenharmony_ci#define LPFC_CTL_PORT_ER1  4
1528c2ecf20Sopenharmony_ci#define LPFC_CTL_PORT_ER2  5
1538c2ecf20Sopenharmony_ci#define LPFC_CTL_PDEV_CTL  6
1548c2ecf20Sopenharmony_ci
1558c2ecf20Sopenharmony_ci#define LPFC_CTL_MAX  6
1568c2ecf20Sopenharmony_ci
1578c2ecf20Sopenharmony_ci#define IDIAG_CTLACC_REGID_INDX 0
1588c2ecf20Sopenharmony_ci#define IDIAG_CTLACC_VALUE_INDX 1
1598c2ecf20Sopenharmony_ci
1608c2ecf20Sopenharmony_ci/* mailbox access */
1618c2ecf20Sopenharmony_ci#define LPFC_MBX_DMP_ARG 4
1628c2ecf20Sopenharmony_ci
1638c2ecf20Sopenharmony_ci#define LPFC_MBX_ACC_BUF_SIZE 512
1648c2ecf20Sopenharmony_ci#define LPFC_MBX_ACC_LBUF_SZ 128
1658c2ecf20Sopenharmony_ci
1668c2ecf20Sopenharmony_ci#define LPFC_MBX_DMP_MBX_WORD 0x00000001
1678c2ecf20Sopenharmony_ci#define LPFC_MBX_DMP_MBX_BYTE 0x00000002
1688c2ecf20Sopenharmony_ci#define LPFC_MBX_DMP_MBX_ALL (LPFC_MBX_DMP_MBX_WORD | LPFC_MBX_DMP_MBX_BYTE)
1698c2ecf20Sopenharmony_ci
1708c2ecf20Sopenharmony_ci#define LPFC_BSG_DMP_MBX_RD_MBX 0x00000001
1718c2ecf20Sopenharmony_ci#define LPFC_BSG_DMP_MBX_RD_BUF 0x00000002
1728c2ecf20Sopenharmony_ci#define LPFC_BSG_DMP_MBX_WR_MBX 0x00000004
1738c2ecf20Sopenharmony_ci#define LPFC_BSG_DMP_MBX_WR_BUF 0x00000008
1748c2ecf20Sopenharmony_ci#define LPFC_BSG_DMP_MBX_ALL (LPFC_BSG_DMP_MBX_RD_MBX | \
1758c2ecf20Sopenharmony_ci			      LPFC_BSG_DMP_MBX_RD_BUF | \
1768c2ecf20Sopenharmony_ci			      LPFC_BSG_DMP_MBX_WR_MBX | \
1778c2ecf20Sopenharmony_ci			      LPFC_BSG_DMP_MBX_WR_BUF)
1788c2ecf20Sopenharmony_ci
1798c2ecf20Sopenharmony_ci#define LPFC_MBX_DMP_ALL 0xffff
1808c2ecf20Sopenharmony_ci#define LPFC_MBX_ALL_CMD 0xff
1818c2ecf20Sopenharmony_ci
1828c2ecf20Sopenharmony_ci#define IDIAG_MBXACC_MBCMD_INDX 0
1838c2ecf20Sopenharmony_ci#define IDIAG_MBXACC_DPMAP_INDX 1
1848c2ecf20Sopenharmony_ci#define IDIAG_MBXACC_DPCNT_INDX 2
1858c2ecf20Sopenharmony_ci#define IDIAG_MBXACC_WDCNT_INDX 3
1868c2ecf20Sopenharmony_ci
1878c2ecf20Sopenharmony_ci/* extents access */
1888c2ecf20Sopenharmony_ci#define LPFC_EXT_ACC_CMD_ARG 1
1898c2ecf20Sopenharmony_ci#define LPFC_EXT_ACC_BUF_SIZE 4096
1908c2ecf20Sopenharmony_ci
1918c2ecf20Sopenharmony_ci#define LPFC_EXT_ACC_AVAIL 0x1
1928c2ecf20Sopenharmony_ci#define LPFC_EXT_ACC_ALLOC 0x2
1938c2ecf20Sopenharmony_ci#define LPFC_EXT_ACC_DRIVR 0x4
1948c2ecf20Sopenharmony_ci#define LPFC_EXT_ACC_ALL   (LPFC_EXT_ACC_DRIVR | \
1958c2ecf20Sopenharmony_ci			    LPFC_EXT_ACC_AVAIL | \
1968c2ecf20Sopenharmony_ci			    LPFC_EXT_ACC_ALLOC)
1978c2ecf20Sopenharmony_ci
1988c2ecf20Sopenharmony_ci#define IDIAG_EXTACC_EXMAP_INDX 0
1998c2ecf20Sopenharmony_ci
2008c2ecf20Sopenharmony_ci#define SIZE_U8  sizeof(uint8_t)
2018c2ecf20Sopenharmony_ci#define SIZE_U16 sizeof(uint16_t)
2028c2ecf20Sopenharmony_ci#define SIZE_U32 sizeof(uint32_t)
2038c2ecf20Sopenharmony_ci
2048c2ecf20Sopenharmony_ci#define lpfc_nvmeio_data(phba, fmt, arg...) \
2058c2ecf20Sopenharmony_ci	{ \
2068c2ecf20Sopenharmony_ci	if (phba->nvmeio_trc_on) \
2078c2ecf20Sopenharmony_ci		lpfc_debugfs_nvme_trc(phba, fmt, ##arg); \
2088c2ecf20Sopenharmony_ci	}
2098c2ecf20Sopenharmony_ci
2108c2ecf20Sopenharmony_cistruct lpfc_debug {
2118c2ecf20Sopenharmony_ci	char *i_private;
2128c2ecf20Sopenharmony_ci	char op;
2138c2ecf20Sopenharmony_ci#define LPFC_IDIAG_OP_RD 1
2148c2ecf20Sopenharmony_ci#define LPFC_IDIAG_OP_WR 2
2158c2ecf20Sopenharmony_ci	char *buffer;
2168c2ecf20Sopenharmony_ci	int  len;
2178c2ecf20Sopenharmony_ci};
2188c2ecf20Sopenharmony_ci
2198c2ecf20Sopenharmony_cistruct lpfc_debugfs_trc {
2208c2ecf20Sopenharmony_ci	char *fmt;
2218c2ecf20Sopenharmony_ci	uint32_t data1;
2228c2ecf20Sopenharmony_ci	uint32_t data2;
2238c2ecf20Sopenharmony_ci	uint32_t data3;
2248c2ecf20Sopenharmony_ci	uint32_t seq_cnt;
2258c2ecf20Sopenharmony_ci	unsigned long jif;
2268c2ecf20Sopenharmony_ci};
2278c2ecf20Sopenharmony_ci
2288c2ecf20Sopenharmony_cistruct lpfc_debugfs_nvmeio_trc {
2298c2ecf20Sopenharmony_ci	char *fmt;
2308c2ecf20Sopenharmony_ci	uint16_t data1;
2318c2ecf20Sopenharmony_ci	uint16_t data2;
2328c2ecf20Sopenharmony_ci	uint32_t data3;
2338c2ecf20Sopenharmony_ci};
2348c2ecf20Sopenharmony_ci
2358c2ecf20Sopenharmony_cistruct lpfc_idiag_offset {
2368c2ecf20Sopenharmony_ci	uint32_t last_rd;
2378c2ecf20Sopenharmony_ci};
2388c2ecf20Sopenharmony_ci
2398c2ecf20Sopenharmony_ci#define LPFC_IDIAG_CMD_DATA_SIZE 8
2408c2ecf20Sopenharmony_cistruct lpfc_idiag_cmd {
2418c2ecf20Sopenharmony_ci	uint32_t opcode;
2428c2ecf20Sopenharmony_ci#define LPFC_IDIAG_CMD_PCICFG_RD 0x00000001
2438c2ecf20Sopenharmony_ci#define LPFC_IDIAG_CMD_PCICFG_WR 0x00000002
2448c2ecf20Sopenharmony_ci#define LPFC_IDIAG_CMD_PCICFG_ST 0x00000003
2458c2ecf20Sopenharmony_ci#define LPFC_IDIAG_CMD_PCICFG_CL 0x00000004
2468c2ecf20Sopenharmony_ci
2478c2ecf20Sopenharmony_ci#define LPFC_IDIAG_CMD_BARACC_RD 0x00000008
2488c2ecf20Sopenharmony_ci#define LPFC_IDIAG_CMD_BARACC_WR 0x00000009
2498c2ecf20Sopenharmony_ci#define LPFC_IDIAG_CMD_BARACC_ST 0x0000000a
2508c2ecf20Sopenharmony_ci#define LPFC_IDIAG_CMD_BARACC_CL 0x0000000b
2518c2ecf20Sopenharmony_ci
2528c2ecf20Sopenharmony_ci#define LPFC_IDIAG_CMD_QUEACC_RD 0x00000011
2538c2ecf20Sopenharmony_ci#define LPFC_IDIAG_CMD_QUEACC_WR 0x00000012
2548c2ecf20Sopenharmony_ci#define LPFC_IDIAG_CMD_QUEACC_ST 0x00000013
2558c2ecf20Sopenharmony_ci#define LPFC_IDIAG_CMD_QUEACC_CL 0x00000014
2568c2ecf20Sopenharmony_ci
2578c2ecf20Sopenharmony_ci#define LPFC_IDIAG_CMD_DRBACC_RD 0x00000021
2588c2ecf20Sopenharmony_ci#define LPFC_IDIAG_CMD_DRBACC_WR 0x00000022
2598c2ecf20Sopenharmony_ci#define LPFC_IDIAG_CMD_DRBACC_ST 0x00000023
2608c2ecf20Sopenharmony_ci#define LPFC_IDIAG_CMD_DRBACC_CL 0x00000024
2618c2ecf20Sopenharmony_ci
2628c2ecf20Sopenharmony_ci#define LPFC_IDIAG_CMD_CTLACC_RD 0x00000031
2638c2ecf20Sopenharmony_ci#define LPFC_IDIAG_CMD_CTLACC_WR 0x00000032
2648c2ecf20Sopenharmony_ci#define LPFC_IDIAG_CMD_CTLACC_ST 0x00000033
2658c2ecf20Sopenharmony_ci#define LPFC_IDIAG_CMD_CTLACC_CL 0x00000034
2668c2ecf20Sopenharmony_ci
2678c2ecf20Sopenharmony_ci#define LPFC_IDIAG_CMD_MBXACC_DP 0x00000041
2688c2ecf20Sopenharmony_ci#define LPFC_IDIAG_BSG_MBXACC_DP 0x00000042
2698c2ecf20Sopenharmony_ci
2708c2ecf20Sopenharmony_ci#define LPFC_IDIAG_CMD_EXTACC_RD 0x00000051
2718c2ecf20Sopenharmony_ci
2728c2ecf20Sopenharmony_ci	uint32_t data[LPFC_IDIAG_CMD_DATA_SIZE];
2738c2ecf20Sopenharmony_ci};
2748c2ecf20Sopenharmony_ci
2758c2ecf20Sopenharmony_cistruct lpfc_idiag {
2768c2ecf20Sopenharmony_ci	uint32_t active;
2778c2ecf20Sopenharmony_ci	struct lpfc_idiag_cmd cmd;
2788c2ecf20Sopenharmony_ci	struct lpfc_idiag_offset offset;
2798c2ecf20Sopenharmony_ci	void *ptr_private;
2808c2ecf20Sopenharmony_ci};
2818c2ecf20Sopenharmony_ci
2828c2ecf20Sopenharmony_ci#else
2838c2ecf20Sopenharmony_ci
2848c2ecf20Sopenharmony_ci#define lpfc_nvmeio_data(phba, fmt, arg...) \
2858c2ecf20Sopenharmony_ci	no_printk(fmt, ##arg)
2868c2ecf20Sopenharmony_ci
2878c2ecf20Sopenharmony_ci#endif
2888c2ecf20Sopenharmony_ci
2898c2ecf20Sopenharmony_ci/* multixripool output buffer size */
2908c2ecf20Sopenharmony_ci#define LPFC_DUMP_MULTIXRIPOOL_SIZE 8192
2918c2ecf20Sopenharmony_ci
2928c2ecf20Sopenharmony_cienum {
2938c2ecf20Sopenharmony_ci	DUMP_IO,
2948c2ecf20Sopenharmony_ci	DUMP_MBX,
2958c2ecf20Sopenharmony_ci	DUMP_ELS,
2968c2ecf20Sopenharmony_ci	DUMP_NVMELS,
2978c2ecf20Sopenharmony_ci};
2988c2ecf20Sopenharmony_ci
2998c2ecf20Sopenharmony_ci/* Mask for discovery_trace */
3008c2ecf20Sopenharmony_ci#define LPFC_DISC_TRC_ELS_CMD		0x1	/* Trace ELS commands */
3018c2ecf20Sopenharmony_ci#define LPFC_DISC_TRC_ELS_RSP		0x2	/* Trace ELS response */
3028c2ecf20Sopenharmony_ci#define LPFC_DISC_TRC_ELS_UNSOL		0x4	/* Trace ELS rcv'ed   */
3038c2ecf20Sopenharmony_ci#define LPFC_DISC_TRC_ELS_ALL		0x7	/* Trace ELS */
3048c2ecf20Sopenharmony_ci#define LPFC_DISC_TRC_MBOX_VPORT	0x8	/* Trace vport MBOXs */
3058c2ecf20Sopenharmony_ci#define LPFC_DISC_TRC_MBOX		0x10	/* Trace other MBOXs */
3068c2ecf20Sopenharmony_ci#define LPFC_DISC_TRC_MBOX_ALL		0x18	/* Trace all MBOXs */
3078c2ecf20Sopenharmony_ci#define LPFC_DISC_TRC_CT		0x20	/* Trace disc CT requests */
3088c2ecf20Sopenharmony_ci#define LPFC_DISC_TRC_DSM		0x40    /* Trace DSM events */
3098c2ecf20Sopenharmony_ci#define LPFC_DISC_TRC_RPORT		0x80    /* Trace rport events */
3108c2ecf20Sopenharmony_ci#define LPFC_DISC_TRC_NODE		0x100   /* Trace ndlp state changes */
3118c2ecf20Sopenharmony_ci
3128c2ecf20Sopenharmony_ci#define LPFC_DISC_TRC_DISCOVERY		0xef    /* common mask for general
3138c2ecf20Sopenharmony_ci						 * discovery */
3148c2ecf20Sopenharmony_ci#endif /* H_LPFC_DEBUG_FS */
3158c2ecf20Sopenharmony_ci
3168c2ecf20Sopenharmony_ci
3178c2ecf20Sopenharmony_ci/*
3188c2ecf20Sopenharmony_ci * Driver debug utility routines outside of debugfs. The debug utility
3198c2ecf20Sopenharmony_ci * routines implemented here is intended to be used in the instrumented
3208c2ecf20Sopenharmony_ci * debug driver for debugging host or port issues.
3218c2ecf20Sopenharmony_ci */
3228c2ecf20Sopenharmony_ci
3238c2ecf20Sopenharmony_ci/**
3248c2ecf20Sopenharmony_ci * lpfc_debug_dump_qe - dump an specific entry from a queue
3258c2ecf20Sopenharmony_ci * @q: Pointer to the queue descriptor.
3268c2ecf20Sopenharmony_ci * @idx: Index to the entry on the queue.
3278c2ecf20Sopenharmony_ci *
3288c2ecf20Sopenharmony_ci * This function dumps an entry indexed by @idx from a queue specified by the
3298c2ecf20Sopenharmony_ci * queue descriptor @q.
3308c2ecf20Sopenharmony_ci **/
3318c2ecf20Sopenharmony_cistatic void
3328c2ecf20Sopenharmony_cilpfc_debug_dump_qe(struct lpfc_queue *q, uint32_t idx)
3338c2ecf20Sopenharmony_ci{
3348c2ecf20Sopenharmony_ci	char line_buf[LPFC_LBUF_SZ];
3358c2ecf20Sopenharmony_ci	int i, esize, qe_word_cnt, len;
3368c2ecf20Sopenharmony_ci	uint32_t *pword;
3378c2ecf20Sopenharmony_ci
3388c2ecf20Sopenharmony_ci	/* sanity checks */
3398c2ecf20Sopenharmony_ci	if (!q)
3408c2ecf20Sopenharmony_ci		return;
3418c2ecf20Sopenharmony_ci	if (idx >= q->entry_count)
3428c2ecf20Sopenharmony_ci		return;
3438c2ecf20Sopenharmony_ci
3448c2ecf20Sopenharmony_ci	esize = q->entry_size;
3458c2ecf20Sopenharmony_ci	qe_word_cnt = esize / sizeof(uint32_t);
3468c2ecf20Sopenharmony_ci	pword = lpfc_sli4_qe(q, idx);
3478c2ecf20Sopenharmony_ci
3488c2ecf20Sopenharmony_ci	len = 0;
3498c2ecf20Sopenharmony_ci	len += scnprintf(line_buf+len, LPFC_LBUF_SZ-len, "QE[%04d]: ", idx);
3508c2ecf20Sopenharmony_ci	if (qe_word_cnt > 8)
3518c2ecf20Sopenharmony_ci		printk(KERN_ERR "%s\n", line_buf);
3528c2ecf20Sopenharmony_ci
3538c2ecf20Sopenharmony_ci	for (i = 0; i < qe_word_cnt; i++) {
3548c2ecf20Sopenharmony_ci		if (!(i % 8)) {
3558c2ecf20Sopenharmony_ci			if (i != 0)
3568c2ecf20Sopenharmony_ci				printk(KERN_ERR "%s\n", line_buf);
3578c2ecf20Sopenharmony_ci			if (qe_word_cnt > 8) {
3588c2ecf20Sopenharmony_ci				len = 0;
3598c2ecf20Sopenharmony_ci				memset(line_buf, 0, LPFC_LBUF_SZ);
3608c2ecf20Sopenharmony_ci				len += scnprintf(line_buf+len, LPFC_LBUF_SZ-len,
3618c2ecf20Sopenharmony_ci						"%03d: ", i);
3628c2ecf20Sopenharmony_ci			}
3638c2ecf20Sopenharmony_ci		}
3648c2ecf20Sopenharmony_ci		len += scnprintf(line_buf+len, LPFC_LBUF_SZ-len, "%08x ",
3658c2ecf20Sopenharmony_ci				((uint32_t)*pword) & 0xffffffff);
3668c2ecf20Sopenharmony_ci		pword++;
3678c2ecf20Sopenharmony_ci	}
3688c2ecf20Sopenharmony_ci	if (qe_word_cnt <= 8 || (i - 1) % 8)
3698c2ecf20Sopenharmony_ci		printk(KERN_ERR "%s\n", line_buf);
3708c2ecf20Sopenharmony_ci}
3718c2ecf20Sopenharmony_ci
3728c2ecf20Sopenharmony_ci/**
3738c2ecf20Sopenharmony_ci * lpfc_debug_dump_q - dump all entries from an specific queue
3748c2ecf20Sopenharmony_ci * @q: Pointer to the queue descriptor.
3758c2ecf20Sopenharmony_ci *
3768c2ecf20Sopenharmony_ci * This function dumps all entries from a queue specified by the queue
3778c2ecf20Sopenharmony_ci * descriptor @q.
3788c2ecf20Sopenharmony_ci **/
3798c2ecf20Sopenharmony_cistatic inline void
3808c2ecf20Sopenharmony_cilpfc_debug_dump_q(struct lpfc_queue *q)
3818c2ecf20Sopenharmony_ci{
3828c2ecf20Sopenharmony_ci	int idx, entry_count;
3838c2ecf20Sopenharmony_ci
3848c2ecf20Sopenharmony_ci	/* sanity check */
3858c2ecf20Sopenharmony_ci	if (!q)
3868c2ecf20Sopenharmony_ci		return;
3878c2ecf20Sopenharmony_ci
3888c2ecf20Sopenharmony_ci	dev_printk(KERN_ERR, &(((q->phba))->pcidev)->dev,
3898c2ecf20Sopenharmony_ci		"%d: [qid:%d, type:%d, subtype:%d, "
3908c2ecf20Sopenharmony_ci		"qe_size:%d, qe_count:%d, "
3918c2ecf20Sopenharmony_ci		"host_index:%d, port_index:%d]\n",
3928c2ecf20Sopenharmony_ci		(q->phba)->brd_no,
3938c2ecf20Sopenharmony_ci		q->queue_id, q->type, q->subtype,
3948c2ecf20Sopenharmony_ci		q->entry_size, q->entry_count,
3958c2ecf20Sopenharmony_ci		q->host_index, q->hba_index);
3968c2ecf20Sopenharmony_ci	entry_count = q->entry_count;
3978c2ecf20Sopenharmony_ci	for (idx = 0; idx < entry_count; idx++)
3988c2ecf20Sopenharmony_ci		lpfc_debug_dump_qe(q, idx);
3998c2ecf20Sopenharmony_ci	printk(KERN_ERR "\n");
4008c2ecf20Sopenharmony_ci}
4018c2ecf20Sopenharmony_ci
4028c2ecf20Sopenharmony_ci/**
4038c2ecf20Sopenharmony_ci * lpfc_debug_dump_wq - dump all entries from the fcp or nvme work queue
4048c2ecf20Sopenharmony_ci * @phba: Pointer to HBA context object.
4058c2ecf20Sopenharmony_ci * @wqidx: Index to a FCP or NVME work queue.
4068c2ecf20Sopenharmony_ci *
4078c2ecf20Sopenharmony_ci * This function dumps all entries from a FCP or NVME work queue specified
4088c2ecf20Sopenharmony_ci * by the wqidx.
4098c2ecf20Sopenharmony_ci **/
4108c2ecf20Sopenharmony_cistatic inline void
4118c2ecf20Sopenharmony_cilpfc_debug_dump_wq(struct lpfc_hba *phba, int qtype, int wqidx)
4128c2ecf20Sopenharmony_ci{
4138c2ecf20Sopenharmony_ci	struct lpfc_queue *wq;
4148c2ecf20Sopenharmony_ci	char *qtypestr;
4158c2ecf20Sopenharmony_ci
4168c2ecf20Sopenharmony_ci	if (qtype == DUMP_IO) {
4178c2ecf20Sopenharmony_ci		wq = phba->sli4_hba.hdwq[wqidx].io_wq;
4188c2ecf20Sopenharmony_ci		qtypestr = "IO";
4198c2ecf20Sopenharmony_ci	} else if (qtype == DUMP_MBX) {
4208c2ecf20Sopenharmony_ci		wq = phba->sli4_hba.mbx_wq;
4218c2ecf20Sopenharmony_ci		qtypestr = "MBX";
4228c2ecf20Sopenharmony_ci	} else if (qtype == DUMP_ELS) {
4238c2ecf20Sopenharmony_ci		wq = phba->sli4_hba.els_wq;
4248c2ecf20Sopenharmony_ci		qtypestr = "ELS";
4258c2ecf20Sopenharmony_ci	} else if (qtype == DUMP_NVMELS) {
4268c2ecf20Sopenharmony_ci		wq = phba->sli4_hba.nvmels_wq;
4278c2ecf20Sopenharmony_ci		qtypestr = "NVMELS";
4288c2ecf20Sopenharmony_ci	} else
4298c2ecf20Sopenharmony_ci		return;
4308c2ecf20Sopenharmony_ci
4318c2ecf20Sopenharmony_ci	if (qtype == DUMP_IO)
4328c2ecf20Sopenharmony_ci		pr_err("%s WQ: WQ[Idx:%d|Qid:%d]\n",
4338c2ecf20Sopenharmony_ci			qtypestr, wqidx, wq->queue_id);
4348c2ecf20Sopenharmony_ci	else
4358c2ecf20Sopenharmony_ci		pr_err("%s WQ: WQ[Qid:%d]\n",
4368c2ecf20Sopenharmony_ci			qtypestr, wq->queue_id);
4378c2ecf20Sopenharmony_ci
4388c2ecf20Sopenharmony_ci	lpfc_debug_dump_q(wq);
4398c2ecf20Sopenharmony_ci}
4408c2ecf20Sopenharmony_ci
4418c2ecf20Sopenharmony_ci/**
4428c2ecf20Sopenharmony_ci * lpfc_debug_dump_cq - dump all entries from a fcp or nvme work queue's
4438c2ecf20Sopenharmony_ci * cmpl queue
4448c2ecf20Sopenharmony_ci * @phba: Pointer to HBA context object.
4458c2ecf20Sopenharmony_ci * @wqidx: Index to a FCP work queue.
4468c2ecf20Sopenharmony_ci *
4478c2ecf20Sopenharmony_ci * This function dumps all entries from a FCP or NVME completion queue
4488c2ecf20Sopenharmony_ci * which is associated to the work queue specified by the @wqidx.
4498c2ecf20Sopenharmony_ci **/
4508c2ecf20Sopenharmony_cistatic inline void
4518c2ecf20Sopenharmony_cilpfc_debug_dump_cq(struct lpfc_hba *phba, int qtype, int wqidx)
4528c2ecf20Sopenharmony_ci{
4538c2ecf20Sopenharmony_ci	struct lpfc_queue *wq, *cq, *eq;
4548c2ecf20Sopenharmony_ci	char *qtypestr;
4558c2ecf20Sopenharmony_ci	int eqidx;
4568c2ecf20Sopenharmony_ci
4578c2ecf20Sopenharmony_ci	/* io wq and cq are 1:1, thus same indexes */
4588c2ecf20Sopenharmony_ci	eq = NULL;
4598c2ecf20Sopenharmony_ci
4608c2ecf20Sopenharmony_ci	if (qtype == DUMP_IO) {
4618c2ecf20Sopenharmony_ci		wq = phba->sli4_hba.hdwq[wqidx].io_wq;
4628c2ecf20Sopenharmony_ci		cq = phba->sli4_hba.hdwq[wqidx].io_cq;
4638c2ecf20Sopenharmony_ci		qtypestr = "IO";
4648c2ecf20Sopenharmony_ci	} else if (qtype == DUMP_MBX) {
4658c2ecf20Sopenharmony_ci		wq = phba->sli4_hba.mbx_wq;
4668c2ecf20Sopenharmony_ci		cq = phba->sli4_hba.mbx_cq;
4678c2ecf20Sopenharmony_ci		qtypestr = "MBX";
4688c2ecf20Sopenharmony_ci	} else if (qtype == DUMP_ELS) {
4698c2ecf20Sopenharmony_ci		wq = phba->sli4_hba.els_wq;
4708c2ecf20Sopenharmony_ci		cq = phba->sli4_hba.els_cq;
4718c2ecf20Sopenharmony_ci		qtypestr = "ELS";
4728c2ecf20Sopenharmony_ci	} else if (qtype == DUMP_NVMELS) {
4738c2ecf20Sopenharmony_ci		wq = phba->sli4_hba.nvmels_wq;
4748c2ecf20Sopenharmony_ci		cq = phba->sli4_hba.nvmels_cq;
4758c2ecf20Sopenharmony_ci		qtypestr = "NVMELS";
4768c2ecf20Sopenharmony_ci	} else
4778c2ecf20Sopenharmony_ci		return;
4788c2ecf20Sopenharmony_ci
4798c2ecf20Sopenharmony_ci	for (eqidx = 0; eqidx < phba->cfg_hdw_queue; eqidx++) {
4808c2ecf20Sopenharmony_ci		eq = phba->sli4_hba.hdwq[eqidx].hba_eq;
4818c2ecf20Sopenharmony_ci		if (cq->assoc_qid == eq->queue_id)
4828c2ecf20Sopenharmony_ci			break;
4838c2ecf20Sopenharmony_ci	}
4848c2ecf20Sopenharmony_ci	if (eqidx == phba->cfg_hdw_queue) {
4858c2ecf20Sopenharmony_ci		pr_err("Couldn't find EQ for CQ. Using EQ[0]\n");
4868c2ecf20Sopenharmony_ci		eqidx = 0;
4878c2ecf20Sopenharmony_ci		eq = phba->sli4_hba.hdwq[0].hba_eq;
4888c2ecf20Sopenharmony_ci	}
4898c2ecf20Sopenharmony_ci
4908c2ecf20Sopenharmony_ci	if (qtype == DUMP_IO)
4918c2ecf20Sopenharmony_ci		pr_err("%s CQ: WQ[Idx:%d|Qid%d]->CQ[Idx%d|Qid%d]"
4928c2ecf20Sopenharmony_ci			"->EQ[Idx:%d|Qid:%d]:\n",
4938c2ecf20Sopenharmony_ci			qtypestr, wqidx, wq->queue_id, wqidx, cq->queue_id,
4948c2ecf20Sopenharmony_ci			eqidx, eq->queue_id);
4958c2ecf20Sopenharmony_ci	else
4968c2ecf20Sopenharmony_ci		pr_err("%s CQ: WQ[Qid:%d]->CQ[Qid:%d]"
4978c2ecf20Sopenharmony_ci			"->EQ[Idx:%d|Qid:%d]:\n",
4988c2ecf20Sopenharmony_ci			qtypestr, wq->queue_id, cq->queue_id,
4998c2ecf20Sopenharmony_ci			eqidx, eq->queue_id);
5008c2ecf20Sopenharmony_ci
5018c2ecf20Sopenharmony_ci	lpfc_debug_dump_q(cq);
5028c2ecf20Sopenharmony_ci}
5038c2ecf20Sopenharmony_ci
5048c2ecf20Sopenharmony_ci/**
5058c2ecf20Sopenharmony_ci * lpfc_debug_dump_hba_eq - dump all entries from a fcp work queue's evt queue
5068c2ecf20Sopenharmony_ci * @phba: Pointer to HBA context object.
5078c2ecf20Sopenharmony_ci * @fcp_wqidx: Index to a FCP work queue.
5088c2ecf20Sopenharmony_ci *
5098c2ecf20Sopenharmony_ci * This function dumps all entries from a FCP event queue which is
5108c2ecf20Sopenharmony_ci * associated to the FCP work queue specified by the @fcp_wqidx.
5118c2ecf20Sopenharmony_ci **/
5128c2ecf20Sopenharmony_cistatic inline void
5138c2ecf20Sopenharmony_cilpfc_debug_dump_hba_eq(struct lpfc_hba *phba, int qidx)
5148c2ecf20Sopenharmony_ci{
5158c2ecf20Sopenharmony_ci	struct lpfc_queue *qp;
5168c2ecf20Sopenharmony_ci
5178c2ecf20Sopenharmony_ci	qp = phba->sli4_hba.hdwq[qidx].hba_eq;
5188c2ecf20Sopenharmony_ci
5198c2ecf20Sopenharmony_ci	pr_err("EQ[Idx:%d|Qid:%d]\n", qidx, qp->queue_id);
5208c2ecf20Sopenharmony_ci
5218c2ecf20Sopenharmony_ci	lpfc_debug_dump_q(qp);
5228c2ecf20Sopenharmony_ci}
5238c2ecf20Sopenharmony_ci
5248c2ecf20Sopenharmony_ci/**
5258c2ecf20Sopenharmony_ci * lpfc_debug_dump_dat_rq - dump all entries from the receive data queue
5268c2ecf20Sopenharmony_ci * @phba: Pointer to HBA context object.
5278c2ecf20Sopenharmony_ci *
5288c2ecf20Sopenharmony_ci * This function dumps all entries from the receive data queue.
5298c2ecf20Sopenharmony_ci **/
5308c2ecf20Sopenharmony_cistatic inline void
5318c2ecf20Sopenharmony_cilpfc_debug_dump_dat_rq(struct lpfc_hba *phba)
5328c2ecf20Sopenharmony_ci{
5338c2ecf20Sopenharmony_ci	printk(KERN_ERR "DAT RQ: RQ[Qid:%d]\n",
5348c2ecf20Sopenharmony_ci		phba->sli4_hba.dat_rq->queue_id);
5358c2ecf20Sopenharmony_ci	lpfc_debug_dump_q(phba->sli4_hba.dat_rq);
5368c2ecf20Sopenharmony_ci}
5378c2ecf20Sopenharmony_ci
5388c2ecf20Sopenharmony_ci/**
5398c2ecf20Sopenharmony_ci * lpfc_debug_dump_hdr_rq - dump all entries from the receive header queue
5408c2ecf20Sopenharmony_ci * @phba: Pointer to HBA context object.
5418c2ecf20Sopenharmony_ci *
5428c2ecf20Sopenharmony_ci * This function dumps all entries from the receive header queue.
5438c2ecf20Sopenharmony_ci **/
5448c2ecf20Sopenharmony_cistatic inline void
5458c2ecf20Sopenharmony_cilpfc_debug_dump_hdr_rq(struct lpfc_hba *phba)
5468c2ecf20Sopenharmony_ci{
5478c2ecf20Sopenharmony_ci	printk(KERN_ERR "HDR RQ: RQ[Qid:%d]\n",
5488c2ecf20Sopenharmony_ci		phba->sli4_hba.hdr_rq->queue_id);
5498c2ecf20Sopenharmony_ci	lpfc_debug_dump_q(phba->sli4_hba.hdr_rq);
5508c2ecf20Sopenharmony_ci}
5518c2ecf20Sopenharmony_ci
5528c2ecf20Sopenharmony_ci/**
5538c2ecf20Sopenharmony_ci * lpfc_debug_dump_wq_by_id - dump all entries from a work queue by queue id
5548c2ecf20Sopenharmony_ci * @phba: Pointer to HBA context object.
5558c2ecf20Sopenharmony_ci * @qid: Work queue identifier.
5568c2ecf20Sopenharmony_ci *
5578c2ecf20Sopenharmony_ci * This function dumps all entries from a work queue identified by the queue
5588c2ecf20Sopenharmony_ci * identifier.
5598c2ecf20Sopenharmony_ci **/
5608c2ecf20Sopenharmony_cistatic inline void
5618c2ecf20Sopenharmony_cilpfc_debug_dump_wq_by_id(struct lpfc_hba *phba, int qid)
5628c2ecf20Sopenharmony_ci{
5638c2ecf20Sopenharmony_ci	int wq_idx;
5648c2ecf20Sopenharmony_ci
5658c2ecf20Sopenharmony_ci	for (wq_idx = 0; wq_idx < phba->cfg_hdw_queue; wq_idx++)
5668c2ecf20Sopenharmony_ci		if (phba->sli4_hba.hdwq[wq_idx].io_wq->queue_id == qid)
5678c2ecf20Sopenharmony_ci			break;
5688c2ecf20Sopenharmony_ci	if (wq_idx < phba->cfg_hdw_queue) {
5698c2ecf20Sopenharmony_ci		pr_err("IO WQ[Idx:%d|Qid:%d]\n", wq_idx, qid);
5708c2ecf20Sopenharmony_ci		lpfc_debug_dump_q(phba->sli4_hba.hdwq[wq_idx].io_wq);
5718c2ecf20Sopenharmony_ci		return;
5728c2ecf20Sopenharmony_ci	}
5738c2ecf20Sopenharmony_ci
5748c2ecf20Sopenharmony_ci	if (phba->sli4_hba.els_wq->queue_id == qid) {
5758c2ecf20Sopenharmony_ci		pr_err("ELS WQ[Qid:%d]\n", qid);
5768c2ecf20Sopenharmony_ci		lpfc_debug_dump_q(phba->sli4_hba.els_wq);
5778c2ecf20Sopenharmony_ci		return;
5788c2ecf20Sopenharmony_ci	}
5798c2ecf20Sopenharmony_ci
5808c2ecf20Sopenharmony_ci	if (phba->sli4_hba.nvmels_wq->queue_id == qid) {
5818c2ecf20Sopenharmony_ci		pr_err("NVME LS WQ[Qid:%d]\n", qid);
5828c2ecf20Sopenharmony_ci		lpfc_debug_dump_q(phba->sli4_hba.nvmels_wq);
5838c2ecf20Sopenharmony_ci	}
5848c2ecf20Sopenharmony_ci}
5858c2ecf20Sopenharmony_ci
5868c2ecf20Sopenharmony_ci/**
5878c2ecf20Sopenharmony_ci * lpfc_debug_dump_mq_by_id - dump all entries from a mbox queue by queue id
5888c2ecf20Sopenharmony_ci * @phba: Pointer to HBA context object.
5898c2ecf20Sopenharmony_ci * @qid: Mbox work queue identifier.
5908c2ecf20Sopenharmony_ci *
5918c2ecf20Sopenharmony_ci * This function dumps all entries from a mbox work queue identified by the
5928c2ecf20Sopenharmony_ci * queue identifier.
5938c2ecf20Sopenharmony_ci **/
5948c2ecf20Sopenharmony_cistatic inline void
5958c2ecf20Sopenharmony_cilpfc_debug_dump_mq_by_id(struct lpfc_hba *phba, int qid)
5968c2ecf20Sopenharmony_ci{
5978c2ecf20Sopenharmony_ci	if (phba->sli4_hba.mbx_wq->queue_id == qid) {
5988c2ecf20Sopenharmony_ci		printk(KERN_ERR "MBX WQ[Qid:%d]\n", qid);
5998c2ecf20Sopenharmony_ci		lpfc_debug_dump_q(phba->sli4_hba.mbx_wq);
6008c2ecf20Sopenharmony_ci	}
6018c2ecf20Sopenharmony_ci}
6028c2ecf20Sopenharmony_ci
6038c2ecf20Sopenharmony_ci/**
6048c2ecf20Sopenharmony_ci * lpfc_debug_dump_rq_by_id - dump all entries from a receive queue by queue id
6058c2ecf20Sopenharmony_ci * @phba: Pointer to HBA context object.
6068c2ecf20Sopenharmony_ci * @qid: Receive queue identifier.
6078c2ecf20Sopenharmony_ci *
6088c2ecf20Sopenharmony_ci * This function dumps all entries from a receive queue identified by the
6098c2ecf20Sopenharmony_ci * queue identifier.
6108c2ecf20Sopenharmony_ci **/
6118c2ecf20Sopenharmony_cistatic inline void
6128c2ecf20Sopenharmony_cilpfc_debug_dump_rq_by_id(struct lpfc_hba *phba, int qid)
6138c2ecf20Sopenharmony_ci{
6148c2ecf20Sopenharmony_ci	if (phba->sli4_hba.hdr_rq->queue_id == qid) {
6158c2ecf20Sopenharmony_ci		printk(KERN_ERR "HDR RQ[Qid:%d]\n", qid);
6168c2ecf20Sopenharmony_ci		lpfc_debug_dump_q(phba->sli4_hba.hdr_rq);
6178c2ecf20Sopenharmony_ci		return;
6188c2ecf20Sopenharmony_ci	}
6198c2ecf20Sopenharmony_ci	if (phba->sli4_hba.dat_rq->queue_id == qid) {
6208c2ecf20Sopenharmony_ci		printk(KERN_ERR "DAT RQ[Qid:%d]\n", qid);
6218c2ecf20Sopenharmony_ci		lpfc_debug_dump_q(phba->sli4_hba.dat_rq);
6228c2ecf20Sopenharmony_ci	}
6238c2ecf20Sopenharmony_ci}
6248c2ecf20Sopenharmony_ci
6258c2ecf20Sopenharmony_ci/**
6268c2ecf20Sopenharmony_ci * lpfc_debug_dump_cq_by_id - dump all entries from a cmpl queue by queue id
6278c2ecf20Sopenharmony_ci * @phba: Pointer to HBA context object.
6288c2ecf20Sopenharmony_ci * @qid: Complete queue identifier.
6298c2ecf20Sopenharmony_ci *
6308c2ecf20Sopenharmony_ci * This function dumps all entries from a complete queue identified by the
6318c2ecf20Sopenharmony_ci * queue identifier.
6328c2ecf20Sopenharmony_ci **/
6338c2ecf20Sopenharmony_cistatic inline void
6348c2ecf20Sopenharmony_cilpfc_debug_dump_cq_by_id(struct lpfc_hba *phba, int qid)
6358c2ecf20Sopenharmony_ci{
6368c2ecf20Sopenharmony_ci	int cq_idx;
6378c2ecf20Sopenharmony_ci
6388c2ecf20Sopenharmony_ci	for (cq_idx = 0; cq_idx < phba->cfg_hdw_queue; cq_idx++)
6398c2ecf20Sopenharmony_ci		if (phba->sli4_hba.hdwq[cq_idx].io_cq->queue_id == qid)
6408c2ecf20Sopenharmony_ci			break;
6418c2ecf20Sopenharmony_ci
6428c2ecf20Sopenharmony_ci	if (cq_idx < phba->cfg_hdw_queue) {
6438c2ecf20Sopenharmony_ci		pr_err("IO CQ[Idx:%d|Qid:%d]\n", cq_idx, qid);
6448c2ecf20Sopenharmony_ci		lpfc_debug_dump_q(phba->sli4_hba.hdwq[cq_idx].io_cq);
6458c2ecf20Sopenharmony_ci		return;
6468c2ecf20Sopenharmony_ci	}
6478c2ecf20Sopenharmony_ci
6488c2ecf20Sopenharmony_ci	if (phba->sli4_hba.els_cq->queue_id == qid) {
6498c2ecf20Sopenharmony_ci		pr_err("ELS CQ[Qid:%d]\n", qid);
6508c2ecf20Sopenharmony_ci		lpfc_debug_dump_q(phba->sli4_hba.els_cq);
6518c2ecf20Sopenharmony_ci		return;
6528c2ecf20Sopenharmony_ci	}
6538c2ecf20Sopenharmony_ci
6548c2ecf20Sopenharmony_ci	if (phba->sli4_hba.nvmels_cq->queue_id == qid) {
6558c2ecf20Sopenharmony_ci		pr_err("NVME LS CQ[Qid:%d]\n", qid);
6568c2ecf20Sopenharmony_ci		lpfc_debug_dump_q(phba->sli4_hba.nvmels_cq);
6578c2ecf20Sopenharmony_ci		return;
6588c2ecf20Sopenharmony_ci	}
6598c2ecf20Sopenharmony_ci
6608c2ecf20Sopenharmony_ci	if (phba->sli4_hba.mbx_cq->queue_id == qid) {
6618c2ecf20Sopenharmony_ci		pr_err("MBX CQ[Qid:%d]\n", qid);
6628c2ecf20Sopenharmony_ci		lpfc_debug_dump_q(phba->sli4_hba.mbx_cq);
6638c2ecf20Sopenharmony_ci	}
6648c2ecf20Sopenharmony_ci}
6658c2ecf20Sopenharmony_ci
6668c2ecf20Sopenharmony_ci/**
6678c2ecf20Sopenharmony_ci * lpfc_debug_dump_eq_by_id - dump all entries from an event queue by queue id
6688c2ecf20Sopenharmony_ci * @phba: Pointer to HBA context object.
6698c2ecf20Sopenharmony_ci * @qid: Complete queue identifier.
6708c2ecf20Sopenharmony_ci *
6718c2ecf20Sopenharmony_ci * This function dumps all entries from an event queue identified by the
6728c2ecf20Sopenharmony_ci * queue identifier.
6738c2ecf20Sopenharmony_ci **/
6748c2ecf20Sopenharmony_cistatic inline void
6758c2ecf20Sopenharmony_cilpfc_debug_dump_eq_by_id(struct lpfc_hba *phba, int qid)
6768c2ecf20Sopenharmony_ci{
6778c2ecf20Sopenharmony_ci	int eq_idx;
6788c2ecf20Sopenharmony_ci
6798c2ecf20Sopenharmony_ci	for (eq_idx = 0; eq_idx < phba->cfg_hdw_queue; eq_idx++)
6808c2ecf20Sopenharmony_ci		if (phba->sli4_hba.hdwq[eq_idx].hba_eq->queue_id == qid)
6818c2ecf20Sopenharmony_ci			break;
6828c2ecf20Sopenharmony_ci
6838c2ecf20Sopenharmony_ci	if (eq_idx < phba->cfg_hdw_queue) {
6848c2ecf20Sopenharmony_ci		printk(KERN_ERR "FCP EQ[Idx:%d|Qid:%d]\n", eq_idx, qid);
6858c2ecf20Sopenharmony_ci		lpfc_debug_dump_q(phba->sli4_hba.hdwq[eq_idx].hba_eq);
6868c2ecf20Sopenharmony_ci		return;
6878c2ecf20Sopenharmony_ci	}
6888c2ecf20Sopenharmony_ci}
6898c2ecf20Sopenharmony_ci
6908c2ecf20Sopenharmony_civoid lpfc_debug_dump_all_queues(struct lpfc_hba *);
691