xhci-debugfs.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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 dentry *parent;
  73. struct list_head list;
  74. };
  75. struct xhci_file_map {
  76. const char *name;
  77. int (*show)(struct seq_file *s, void *unused);
  78. };
  79. struct xhci_ep_priv {
  80. char name[DEBUGFS_NAMELEN];
  81. struct dentry *root;
  82. };
  83. struct xhci_slot_priv {
  84. char name[DEBUGFS_NAMELEN];
  85. struct dentry *root;
  86. struct xhci_ep_priv *eps[31];
  87. struct xhci_virt_device *dev;
  88. };
  89. #ifdef CONFIG_DEBUG_FS
  90. void xhci_debugfs_init(struct xhci_hcd *xhci);
  91. void xhci_debugfs_exit(struct xhci_hcd *xhci);
  92. void __init xhci_debugfs_create_root(void);
  93. void __exit xhci_debugfs_remove_root(void);
  94. void xhci_debugfs_create_slot(struct xhci_hcd *xhci, int slot_id);
  95. void xhci_debugfs_remove_slot(struct xhci_hcd *xhci, int slot_id);
  96. void xhci_debugfs_create_endpoint(struct xhci_hcd *xhci,
  97. struct xhci_virt_device *virt_dev,
  98. int ep_index);
  99. void xhci_debugfs_remove_endpoint(struct xhci_hcd *xhci,
  100. struct xhci_virt_device *virt_dev,
  101. int ep_index);
  102. #else
  103. static inline void xhci_debugfs_init(struct xhci_hcd *xhci) { }
  104. static inline void xhci_debugfs_exit(struct xhci_hcd *xhci) { }
  105. static inline void __init xhci_debugfs_create_root(void) { }
  106. static inline void __exit xhci_debugfs_remove_root(void) { }
  107. static inline void xhci_debugfs_create_slot(struct xhci_hcd *x, int s) { }
  108. static inline void xhci_debugfs_remove_slot(struct xhci_hcd *x, int s) { }
  109. static inline void
  110. xhci_debugfs_create_endpoint(struct xhci_hcd *xhci,
  111. struct xhci_virt_device *virt_dev,
  112. int ep_index) { }
  113. static inline void
  114. xhci_debugfs_remove_endpoint(struct xhci_hcd *xhci,
  115. struct xhci_virt_device *virt_dev,
  116. int ep_index) { }
  117. #endif /* CONFIG_DEBUG_FS */
  118. #endif /* __LINUX_XHCI_DEBUGFS_H */