0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef __LINUX_XHCI_DEBUGFS_H
0011 #define __LINUX_XHCI_DEBUGFS_H
0012
0013 #include <linux/debugfs.h>
0014
0015 #define DEBUGFS_NAMELEN 32
0016
0017 #define REG_CAPLENGTH 0x00
0018 #define REG_HCSPARAMS1 0x04
0019 #define REG_HCSPARAMS2 0x08
0020 #define REG_HCSPARAMS3 0x0c
0021 #define REG_HCCPARAMS1 0x10
0022 #define REG_DOORBELLOFF 0x14
0023 #define REG_RUNTIMEOFF 0x18
0024 #define REG_HCCPARAMS2 0x1c
0025
0026 #define REG_USBCMD 0x00
0027 #define REG_USBSTS 0x04
0028 #define REG_PAGESIZE 0x08
0029 #define REG_DNCTRL 0x14
0030 #define REG_CRCR 0x18
0031 #define REG_DCBAAP_LOW 0x30
0032 #define REG_DCBAAP_HIGH 0x34
0033 #define REG_CONFIG 0x38
0034
0035 #define REG_MFINDEX 0x00
0036 #define REG_IR0_IMAN 0x20
0037 #define REG_IR0_IMOD 0x24
0038 #define REG_IR0_ERSTSZ 0x28
0039 #define REG_IR0_ERSTBA_LOW 0x30
0040 #define REG_IR0_ERSTBA_HIGH 0x34
0041 #define REG_IR0_ERDP_LOW 0x38
0042 #define REG_IR0_ERDP_HIGH 0x3c
0043
0044 #define REG_EXTCAP_USBLEGSUP 0x00
0045 #define REG_EXTCAP_USBLEGCTLSTS 0x04
0046
0047 #define REG_EXTCAP_REVISION 0x00
0048 #define REG_EXTCAP_NAME 0x04
0049 #define REG_EXTCAP_PORTINFO 0x08
0050 #define REG_EXTCAP_PORTTYPE 0x0c
0051 #define REG_EXTCAP_MANTISSA1 0x10
0052 #define REG_EXTCAP_MANTISSA2 0x14
0053 #define REG_EXTCAP_MANTISSA3 0x18
0054 #define REG_EXTCAP_MANTISSA4 0x1c
0055 #define REG_EXTCAP_MANTISSA5 0x20
0056 #define REG_EXTCAP_MANTISSA6 0x24
0057
0058 #define REG_EXTCAP_DBC_CAPABILITY 0x00
0059 #define REG_EXTCAP_DBC_DOORBELL 0x04
0060 #define REG_EXTCAP_DBC_ERSTSIZE 0x08
0061 #define REG_EXTCAP_DBC_ERST_LOW 0x10
0062 #define REG_EXTCAP_DBC_ERST_HIGH 0x14
0063 #define REG_EXTCAP_DBC_ERDP_LOW 0x18
0064 #define REG_EXTCAP_DBC_ERDP_HIGH 0x1c
0065 #define REG_EXTCAP_DBC_CONTROL 0x20
0066 #define REG_EXTCAP_DBC_STATUS 0x24
0067 #define REG_EXTCAP_DBC_PORTSC 0x28
0068 #define REG_EXTCAP_DBC_CONT_LOW 0x30
0069 #define REG_EXTCAP_DBC_CONT_HIGH 0x34
0070 #define REG_EXTCAP_DBC_DEVINFO1 0x38
0071 #define REG_EXTCAP_DBC_DEVINFO2 0x3c
0072
0073 #define dump_register(nm) \
0074 { \
0075 .name = __stringify(nm), \
0076 .offset = REG_ ##nm, \
0077 }
0078
0079 struct xhci_regset {
0080 char name[DEBUGFS_NAMELEN];
0081 struct debugfs_regset32 regset;
0082 size_t nregs;
0083 struct list_head list;
0084 };
0085
0086 struct xhci_file_map {
0087 const char *name;
0088 int (*show)(struct seq_file *s, void *unused);
0089 };
0090
0091 struct xhci_ep_priv {
0092 char name[DEBUGFS_NAMELEN];
0093 struct dentry *root;
0094 struct xhci_stream_info *stream_info;
0095 struct xhci_ring *show_ring;
0096 unsigned int stream_id;
0097 };
0098
0099 struct xhci_slot_priv {
0100 char name[DEBUGFS_NAMELEN];
0101 struct dentry *root;
0102 struct xhci_ep_priv *eps[31];
0103 struct xhci_virt_device *dev;
0104 };
0105
0106 #ifdef CONFIG_DEBUG_FS
0107 void xhci_debugfs_init(struct xhci_hcd *xhci);
0108 void xhci_debugfs_exit(struct xhci_hcd *xhci);
0109 void __init xhci_debugfs_create_root(void);
0110 void __exit xhci_debugfs_remove_root(void);
0111 void xhci_debugfs_create_slot(struct xhci_hcd *xhci, int slot_id);
0112 void xhci_debugfs_remove_slot(struct xhci_hcd *xhci, int slot_id);
0113 void xhci_debugfs_create_endpoint(struct xhci_hcd *xhci,
0114 struct xhci_virt_device *virt_dev,
0115 int ep_index);
0116 void xhci_debugfs_remove_endpoint(struct xhci_hcd *xhci,
0117 struct xhci_virt_device *virt_dev,
0118 int ep_index);
0119 void xhci_debugfs_create_stream_files(struct xhci_hcd *xhci,
0120 struct xhci_virt_device *virt_dev,
0121 int ep_index);
0122 #else
0123 static inline void xhci_debugfs_init(struct xhci_hcd *xhci) { }
0124 static inline void xhci_debugfs_exit(struct xhci_hcd *xhci) { }
0125 static inline void __init xhci_debugfs_create_root(void) { }
0126 static inline void __exit xhci_debugfs_remove_root(void) { }
0127 static inline void xhci_debugfs_create_slot(struct xhci_hcd *x, int s) { }
0128 static inline void xhci_debugfs_remove_slot(struct xhci_hcd *x, int s) { }
0129 static inline void
0130 xhci_debugfs_create_endpoint(struct xhci_hcd *xhci,
0131 struct xhci_virt_device *virt_dev,
0132 int ep_index) { }
0133 static inline void
0134 xhci_debugfs_remove_endpoint(struct xhci_hcd *xhci,
0135 struct xhci_virt_device *virt_dev,
0136 int ep_index) { }
0137 static inline void
0138 xhci_debugfs_create_stream_files(struct xhci_hcd *xhci,
0139 struct xhci_virt_device *virt_dev,
0140 int ep_index) { }
0141 #endif
0142
0143 #endif