lpfc_debugfs.h 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  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. /* hbqinfo output buffer size */
  33. #define LPFC_HBQINFO_SIZE 8192
  34. /*
  35. * For SLI4 iDiag debugfs diagnostics tool
  36. */
  37. /* pciConf */
  38. #define LPFC_PCI_CFG_BROWSE 0xffff
  39. #define LPFC_PCI_CFG_RD_CMD_ARG 2
  40. #define LPFC_PCI_CFG_WR_CMD_ARG 3
  41. #define LPFC_PCI_CFG_SIZE 4096
  42. #define LPFC_PCI_CFG_RD_SIZE (LPFC_PCI_CFG_SIZE/4)
  43. #define IDIAG_PCICFG_WHERE_INDX 0
  44. #define IDIAG_PCICFG_COUNT_INDX 1
  45. #define IDIAG_PCICFG_VALUE_INDX 2
  46. /* barAcc */
  47. #define LPFC_PCI_BAR_BROWSE 0xffff
  48. #define LPFC_PCI_BAR_RD_CMD_ARG 3
  49. #define LPFC_PCI_BAR_WR_CMD_ARG 3
  50. #define LPFC_PCI_IF0_BAR0_SIZE (1024 * 16)
  51. #define LPFC_PCI_IF0_BAR1_SIZE (1024 * 128)
  52. #define LPFC_PCI_IF0_BAR2_SIZE (1024 * 128)
  53. #define LPFC_PCI_IF2_BAR0_SIZE (1024 * 32)
  54. #define LPFC_PCI_BAR_RD_BUF_SIZE 4096
  55. #define LPFC_PCI_BAR_RD_SIZE (LPFC_PCI_BAR_RD_BUF_SIZE/4)
  56. #define LPFC_PCI_IF0_BAR0_RD_SIZE (LPFC_PCI_IF0_BAR0_SIZE/4)
  57. #define LPFC_PCI_IF0_BAR1_RD_SIZE (LPFC_PCI_IF0_BAR1_SIZE/4)
  58. #define LPFC_PCI_IF0_BAR2_RD_SIZE (LPFC_PCI_IF0_BAR2_SIZE/4)
  59. #define LPFC_PCI_IF2_BAR0_RD_SIZE (LPFC_PCI_IF2_BAR0_SIZE/4)
  60. #define IDIAG_BARACC_BAR_NUM_INDX 0
  61. #define IDIAG_BARACC_OFF_SET_INDX 1
  62. #define IDIAG_BARACC_ACC_MOD_INDX 2
  63. #define IDIAG_BARACC_REG_VAL_INDX 2
  64. #define IDIAG_BARACC_BAR_SZE_INDX 3
  65. #define IDIAG_BARACC_BAR_0 0
  66. #define IDIAG_BARACC_BAR_1 1
  67. #define IDIAG_BARACC_BAR_2 2
  68. #define SINGLE_WORD 1
  69. /* queue info */
  70. #define LPFC_QUE_INFO_GET_BUF_SIZE 4096
  71. /* queue acc */
  72. #define LPFC_QUE_ACC_BROWSE 0xffff
  73. #define LPFC_QUE_ACC_RD_CMD_ARG 4
  74. #define LPFC_QUE_ACC_WR_CMD_ARG 6
  75. #define LPFC_QUE_ACC_BUF_SIZE 4096
  76. #define LPFC_QUE_ACC_SIZE (LPFC_QUE_ACC_BUF_SIZE/2)
  77. #define LPFC_IDIAG_EQ 1
  78. #define LPFC_IDIAG_CQ 2
  79. #define LPFC_IDIAG_MQ 3
  80. #define LPFC_IDIAG_WQ 4
  81. #define LPFC_IDIAG_RQ 5
  82. #define IDIAG_QUEACC_QUETP_INDX 0
  83. #define IDIAG_QUEACC_QUEID_INDX 1
  84. #define IDIAG_QUEACC_INDEX_INDX 2
  85. #define IDIAG_QUEACC_COUNT_INDX 3
  86. #define IDIAG_QUEACC_OFFST_INDX 4
  87. #define IDIAG_QUEACC_VALUE_INDX 5
  88. /* doorbell register acc */
  89. #define LPFC_DRB_ACC_ALL 0xffff
  90. #define LPFC_DRB_ACC_RD_CMD_ARG 1
  91. #define LPFC_DRB_ACC_WR_CMD_ARG 2
  92. #define LPFC_DRB_ACC_BUF_SIZE 256
  93. #define LPFC_DRB_EQCQ 1
  94. #define LPFC_DRB_MQ 2
  95. #define LPFC_DRB_WQ 3
  96. #define LPFC_DRB_RQ 4
  97. #define LPFC_DRB_MAX 4
  98. #define IDIAG_DRBACC_REGID_INDX 0
  99. #define IDIAG_DRBACC_VALUE_INDX 1
  100. /* control register acc */
  101. #define LPFC_CTL_ACC_ALL 0xffff
  102. #define LPFC_CTL_ACC_RD_CMD_ARG 1
  103. #define LPFC_CTL_ACC_WR_CMD_ARG 2
  104. #define LPFC_CTL_ACC_BUF_SIZE 256
  105. #define LPFC_CTL_PORT_SEM 1
  106. #define LPFC_CTL_PORT_STA 2
  107. #define LPFC_CTL_PORT_CTL 3
  108. #define LPFC_CTL_PORT_ER1 4
  109. #define LPFC_CTL_PORT_ER2 5
  110. #define LPFC_CTL_PDEV_CTL 6
  111. #define LPFC_CTL_MAX 6
  112. #define IDIAG_CTLACC_REGID_INDX 0
  113. #define IDIAG_CTLACC_VALUE_INDX 1
  114. /* mailbox access */
  115. #define LPFC_MBX_DMP_ARG 4
  116. #define LPFC_MBX_ACC_BUF_SIZE 512
  117. #define LPFC_MBX_ACC_LBUF_SZ 128
  118. #define LPFC_MBX_DMP_MBX_WORD 0x00000001
  119. #define LPFC_MBX_DMP_MBX_BYTE 0x00000002
  120. #define LPFC_MBX_DMP_MBX_ALL (LPFC_MBX_DMP_MBX_WORD | LPFC_MBX_DMP_MBX_BYTE)
  121. #define LPFC_BSG_DMP_MBX_RD_MBX 0x00000001
  122. #define LPFC_BSG_DMP_MBX_RD_BUF 0x00000002
  123. #define LPFC_BSG_DMP_MBX_WR_MBX 0x00000004
  124. #define LPFC_BSG_DMP_MBX_WR_BUF 0x00000008
  125. #define LPFC_BSG_DMP_MBX_ALL (LPFC_BSG_DMP_MBX_RD_MBX | \
  126. LPFC_BSG_DMP_MBX_RD_BUF | \
  127. LPFC_BSG_DMP_MBX_WR_MBX | \
  128. LPFC_BSG_DMP_MBX_WR_BUF)
  129. #define LPFC_MBX_DMP_ALL 0xffff
  130. #define LPFC_MBX_ALL_CMD 0xff
  131. #define IDIAG_MBXACC_MBCMD_INDX 0
  132. #define IDIAG_MBXACC_DPMAP_INDX 1
  133. #define IDIAG_MBXACC_DPCNT_INDX 2
  134. #define IDIAG_MBXACC_WDCNT_INDX 3
  135. /* extents access */
  136. #define LPFC_EXT_ACC_CMD_ARG 1
  137. #define LPFC_EXT_ACC_BUF_SIZE 4096
  138. #define LPFC_EXT_ACC_AVAIL 0x1
  139. #define LPFC_EXT_ACC_ALLOC 0x2
  140. #define LPFC_EXT_ACC_DRIVR 0x4
  141. #define LPFC_EXT_ACC_ALL (LPFC_EXT_ACC_DRIVR | \
  142. LPFC_EXT_ACC_AVAIL | \
  143. LPFC_EXT_ACC_ALLOC)
  144. #define IDIAG_EXTACC_EXMAP_INDX 0
  145. #define SIZE_U8 sizeof(uint8_t)
  146. #define SIZE_U16 sizeof(uint16_t)
  147. #define SIZE_U32 sizeof(uint32_t)
  148. struct lpfc_debug {
  149. char *i_private;
  150. char op;
  151. #define LPFC_IDIAG_OP_RD 1
  152. #define LPFC_IDIAG_OP_WR 2
  153. char *buffer;
  154. int len;
  155. };
  156. struct lpfc_debugfs_trc {
  157. char *fmt;
  158. uint32_t data1;
  159. uint32_t data2;
  160. uint32_t data3;
  161. uint32_t seq_cnt;
  162. unsigned long jif;
  163. };
  164. struct lpfc_idiag_offset {
  165. uint32_t last_rd;
  166. };
  167. #define LPFC_IDIAG_CMD_DATA_SIZE 8
  168. struct lpfc_idiag_cmd {
  169. uint32_t opcode;
  170. #define LPFC_IDIAG_CMD_PCICFG_RD 0x00000001
  171. #define LPFC_IDIAG_CMD_PCICFG_WR 0x00000002
  172. #define LPFC_IDIAG_CMD_PCICFG_ST 0x00000003
  173. #define LPFC_IDIAG_CMD_PCICFG_CL 0x00000004
  174. #define LPFC_IDIAG_CMD_BARACC_RD 0x00000008
  175. #define LPFC_IDIAG_CMD_BARACC_WR 0x00000009
  176. #define LPFC_IDIAG_CMD_BARACC_ST 0x0000000a
  177. #define LPFC_IDIAG_CMD_BARACC_CL 0x0000000b
  178. #define LPFC_IDIAG_CMD_QUEACC_RD 0x00000011
  179. #define LPFC_IDIAG_CMD_QUEACC_WR 0x00000012
  180. #define LPFC_IDIAG_CMD_QUEACC_ST 0x00000013
  181. #define LPFC_IDIAG_CMD_QUEACC_CL 0x00000014
  182. #define LPFC_IDIAG_CMD_DRBACC_RD 0x00000021
  183. #define LPFC_IDIAG_CMD_DRBACC_WR 0x00000022
  184. #define LPFC_IDIAG_CMD_DRBACC_ST 0x00000023
  185. #define LPFC_IDIAG_CMD_DRBACC_CL 0x00000024
  186. #define LPFC_IDIAG_CMD_CTLACC_RD 0x00000031
  187. #define LPFC_IDIAG_CMD_CTLACC_WR 0x00000032
  188. #define LPFC_IDIAG_CMD_CTLACC_ST 0x00000033
  189. #define LPFC_IDIAG_CMD_CTLACC_CL 0x00000034
  190. #define LPFC_IDIAG_CMD_MBXACC_DP 0x00000041
  191. #define LPFC_IDIAG_BSG_MBXACC_DP 0x00000042
  192. #define LPFC_IDIAG_CMD_EXTACC_RD 0x00000051
  193. uint32_t data[LPFC_IDIAG_CMD_DATA_SIZE];
  194. };
  195. struct lpfc_idiag {
  196. uint32_t active;
  197. struct lpfc_idiag_cmd cmd;
  198. struct lpfc_idiag_offset offset;
  199. void *ptr_private;
  200. };
  201. #endif
  202. /* Mask for discovery_trace */
  203. #define LPFC_DISC_TRC_ELS_CMD 0x1 /* Trace ELS commands */
  204. #define LPFC_DISC_TRC_ELS_RSP 0x2 /* Trace ELS response */
  205. #define LPFC_DISC_TRC_ELS_UNSOL 0x4 /* Trace ELS rcv'ed */
  206. #define LPFC_DISC_TRC_ELS_ALL 0x7 /* Trace ELS */
  207. #define LPFC_DISC_TRC_MBOX_VPORT 0x8 /* Trace vport MBOXs */
  208. #define LPFC_DISC_TRC_MBOX 0x10 /* Trace other MBOXs */
  209. #define LPFC_DISC_TRC_MBOX_ALL 0x18 /* Trace all MBOXs */
  210. #define LPFC_DISC_TRC_CT 0x20 /* Trace disc CT requests */
  211. #define LPFC_DISC_TRC_DSM 0x40 /* Trace DSM events */
  212. #define LPFC_DISC_TRC_RPORT 0x80 /* Trace rport events */
  213. #define LPFC_DISC_TRC_NODE 0x100 /* Trace ndlp state changes */
  214. #define LPFC_DISC_TRC_DISCOVERY 0xef /* common mask for general
  215. * discovery */
  216. #endif /* H_LPFC_DEBUG_FS */