xhci-debugfs.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * xhci-debugfs.h - xHCI debugfs interface
  4. *
  5. * Copyright (C) 2017 Intel Corporation
  6. *
  7. * Author: Lu Baolu <baolu.lu@linux.intel.com>
  8. */
  9. #ifndef __LINUX_XHCI_DEBUGFS_H
  10. #define __LINUX_XHCI_DEBUGFS_H
  11. #include <linux/debugfs.h>
  12. #define DEBUGFS_NAMELEN 32
  13. #define REG_CAPLENGTH 0x00
  14. #define REG_HCSPARAMS1 0x04
  15. #define REG_HCSPARAMS2 0x08
  16. #define REG_HCSPARAMS3 0x0c
  17. #define REG_HCCPARAMS1 0x10
  18. #define REG_DOORBELLOFF 0x14
  19. #define REG_RUNTIMEOFF 0x18
  20. #define REG_HCCPARAMS2 0x1c
  21. #define REG_USBCMD 0x00
  22. #define REG_USBSTS 0x04
  23. #define REG_PAGESIZE 0x08
  24. #define REG_DNCTRL 0x14
  25. #define REG_CRCR 0x18
  26. #define REG_DCBAAP_LOW 0x30
  27. #define REG_DCBAAP_HIGH 0x34
  28. #define REG_CONFIG 0x38
  29. #define REG_MFINDEX 0x00
  30. #define REG_IR0_IMAN 0x20
  31. #define REG_IR0_IMOD 0x24
  32. #define REG_IR0_ERSTSZ 0x28
  33. #define REG_IR0_ERSTBA_LOW 0x30
  34. #define REG_IR0_ERSTBA_HIGH 0x34
  35. #define REG_IR0_ERDP_LOW 0x38
  36. #define REG_IR0_ERDP_HIGH 0x3c
  37. #define REG_EXTCAP_USBLEGSUP 0x00
  38. #define REG_EXTCAP_USBLEGCTLSTS 0x04
  39. #define REG_EXTCAP_REVISION 0x00
  40. #define REG_EXTCAP_NAME 0x04
  41. #define REG_EXTCAP_PORTINFO 0x08
  42. #define REG_EXTCAP_PORTTYPE 0x0c
  43. #define REG_EXTCAP_MANTISSA1 0x10
  44. #define REG_EXTCAP_MANTISSA2 0x14
  45. #define REG_EXTCAP_MANTISSA3 0x18
  46. #define REG_EXTCAP_MANTISSA4 0x1c
  47. #define REG_EXTCAP_MANTISSA5 0x20
  48. #define REG_EXTCAP_MANTISSA6 0x24
  49. #define REG_EXTCAP_DBC_CAPABILITY 0x00
  50. #define REG_EXTCAP_DBC_DOORBELL 0x04
  51. #define REG_EXTCAP_DBC_ERSTSIZE 0x08
  52. #define REG_EXTCAP_DBC_ERST_LOW 0x10
  53. #define REG_EXTCAP_DBC_ERST_HIGH 0x14
  54. #define REG_EXTCAP_DBC_ERDP_LOW 0x18
  55. #define REG_EXTCAP_DBC_ERDP_HIGH 0x1c
  56. #define REG_EXTCAP_DBC_CONTROL 0x20
  57. #define REG_EXTCAP_DBC_STATUS 0x24
  58. #define REG_EXTCAP_DBC_PORTSC 0x28
  59. #define REG_EXTCAP_DBC_CONT_LOW 0x30
  60. #define REG_EXTCAP_DBC_CONT_HIGH 0x34
  61. #define REG_EXTCAP_DBC_DEVINFO1 0x38
  62. #define REG_EXTCAP_DBC_DEVINFO2 0x3c
  63. #define dump_register(nm) \
  64. { \
  65. .name = __stringify(nm), \
  66. .offset = REG_ ##nm, \
  67. }
  68. struct xhci_regset {
  69. char name[DEBUGFS_NAMELEN];
  70. struct debugfs_regset32 regset;
  71. size_t nregs;
  72. struct list_head list;
  73. };
  74. struct xhci_file_map {
  75. const char *name;
  76. int (*show)(struct seq_file *s, void *unused);
  77. };
  78. struct xhci_ep_priv {
  79. char name[DEBUGFS_NAMELEN];
  80. struct dentry *root;
  81. struct xhci_stream_info *stream_info;
  82. struct xhci_ring *show_ring;
  83. unsigned int stream_id;
  84. };
  85. struct xhci_slot_priv {
  86. char name[DEBUGFS_NAMELEN];
  87. struct dentry *root;
  88. struct xhci_ep_priv *eps[31];
  89. struct xhci_virt_device *dev;
  90. };
  91. #ifdef CONFIG_DEBUG_FS
  92. void xhci_debugfs_init(struct xhci_hcd *xhci);
  93. void xhci_debugfs_exit(struct xhci_hcd *xhci);
  94. void __init xhci_debugfs_create_root(void);
  95. void __exit xhci_debugfs_remove_root(void);
  96. void xhci_debugfs_create_slot(struct xhci_hcd *xhci, int slot_id);
  97. void xhci_debugfs_remove_slot(struct xhci_hcd *xhci, int slot_id);
  98. void xhci_debugfs_create_endpoint(struct xhci_hcd *xhci,
  99. struct xhci_virt_device *virt_dev,
  100. int ep_index);
  101. void xhci_debugfs_remove_endpoint(struct xhci_hcd *xhci,
  102. struct xhci_virt_device *virt_dev,
  103. int ep_index);
  104. void xhci_debugfs_create_stream_files(struct xhci_hcd *xhci,
  105. struct xhci_virt_device *virt_dev,
  106. int ep_index);
  107. #else
  108. static inline void xhci_debugfs_init(struct xhci_hcd *xhci) { }
  109. static inline void xhci_debugfs_exit(struct xhci_hcd *xhci) { }
  110. static inline void __init xhci_debugfs_create_root(void) { }
  111. static inline void __exit xhci_debugfs_remove_root(void) { }
  112. static inline void xhci_debugfs_create_slot(struct xhci_hcd *x, int s) { }
  113. static inline void xhci_debugfs_remove_slot(struct xhci_hcd *x, int s) { }
  114. static inline void
  115. xhci_debugfs_create_endpoint(struct xhci_hcd *xhci,
  116. struct xhci_virt_device *virt_dev,
  117. int ep_index) { }
  118. static inline void
  119. xhci_debugfs_remove_endpoint(struct xhci_hcd *xhci,
  120. struct xhci_virt_device *virt_dev,
  121. int ep_index) { }
  122. static inline void
  123. xhci_debugfs_create_stream_files(struct xhci_hcd *xhci,
  124. struct xhci_virt_device *virt_dev,
  125. int ep_index) { }
  126. #endif /* CONFIG_DEBUG_FS */
  127. #endif /* __LINUX_XHCI_DEBUGFS_H */