summaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/xhci-debugfs.h
blob: ac5bc40f5c3afc867a0336c57c9782a219e015b1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
// SPDX-License-Identifier: GPL-2.0
/*
 * xhci-debugfs.h - xHCI debugfs interface
 *
 * Copyright (C) 2017 Intel Corporation
 *
 * Author: Lu Baolu <baolu.lu@linux.intel.com>
 */

#ifndef __LINUX_XHCI_DEBUGFS_H
#define __LINUX_XHCI_DEBUGFS_H

#include <linux/debugfs.h>

#define DEBUGFS_NAMELEN 32

#define REG_CAPLENGTH					0x00
#define REG_HCSPARAMS1					0x04
#define REG_HCSPARAMS2					0x08
#define REG_HCSPARAMS3					0x0c
#define REG_HCCPARAMS1					0x10
#define REG_DOORBELLOFF					0x14
#define REG_RUNTIMEOFF					0x18
#define REG_HCCPARAMS2					0x1c

#define	REG_USBCMD					0x00
#define REG_USBSTS					0x04
#define REG_PAGESIZE					0x08
#define REG_DNCTRL					0x14
#define REG_CRCR					0x18
#define REG_DCBAAP_LOW					0x30
#define REG_DCBAAP_HIGH					0x34
#define REG_CONFIG					0x38

#define REG_MFINDEX					0x00
#define REG_IR0_IMAN					0x20
#define REG_IR0_IMOD					0x24
#define REG_IR0_ERSTSZ					0x28
#define REG_IR0_ERSTBA_LOW				0x30
#define REG_IR0_ERSTBA_HIGH				0x34
#define REG_IR0_ERDP_LOW				0x38
#define REG_IR0_ERDP_HIGH				0x3c

#define REG_EXTCAP_USBLEGSUP				0x00
#define REG_EXTCAP_USBLEGCTLSTS				0x04

#define REG_EXTCAP_REVISION				0x00
#define REG_EXTCAP_NAME					0x04
#define REG_EXTCAP_PORTINFO				0x08
#define REG_EXTCAP_PORTTYPE				0x0c
#define REG_EXTCAP_MANTISSA1				0x10
#define REG_EXTCAP_MANTISSA2				0x14
#define REG_EXTCAP_MANTISSA3				0x18
#define REG_EXTCAP_MANTISSA4				0x1c
#define REG_EXTCAP_MANTISSA5				0x20
#define REG_EXTCAP_MANTISSA6				0x24

#define REG_EXTCAP_DBC_CAPABILITY			0x00
#define REG_EXTCAP_DBC_DOORBELL				0x04
#define REG_EXTCAP_DBC_ERSTSIZE				0x08
#define REG_EXTCAP_DBC_ERST_LOW				0x10
#define REG_EXTCAP_DBC_ERST_HIGH			0x14
#define REG_EXTCAP_DBC_ERDP_LOW				0x18
#define REG_EXTCAP_DBC_ERDP_HIGH			0x1c
#define REG_EXTCAP_DBC_CONTROL				0x20
#define REG_EXTCAP_DBC_STATUS				0x24
#define REG_EXTCAP_DBC_PORTSC				0x28
#define REG_EXTCAP_DBC_CONT_LOW				0x30
#define REG_EXTCAP_DBC_CONT_HIGH			0x34
#define REG_EXTCAP_DBC_DEVINFO1				0x38
#define REG_EXTCAP_DBC_DEVINFO2				0x3c

#define dump_register(nm)				\
{							\
	.name	= __stringify(nm),			\
	.offset	= REG_ ##nm,				\
}

struct xhci_regset {
	char			name[DEBUGFS_NAMELEN];
	struct debugfs_regset32	regset;
	size_t			nregs;
	struct dentry		*parent;
	struct list_head	list;
};

struct xhci_file_map {
	const char		*name;
	int			(*show)(struct seq_file *s, void *unused);
};

struct xhci_ep_priv {
	char			name[DEBUGFS_NAMELEN];
	struct dentry		*root;
};

struct xhci_slot_priv {
	char			name[DEBUGFS_NAMELEN];
	struct dentry		*root;
	struct xhci_ep_priv	*eps[31];
	struct xhci_virt_device	*dev;
};

#ifdef CONFIG_DEBUG_FS
void xhci_debugfs_init(struct xhci_hcd *xhci);
void xhci_debugfs_exit(struct xhci_hcd *xhci);
void __init xhci_debugfs_create_root(void);
void __exit xhci_debugfs_remove_root(void);
void xhci_debugfs_create_slot(struct xhci_hcd *xhci, int slot_id);
void xhci_debugfs_remove_slot(struct xhci_hcd *xhci, int slot_id);
void xhci_debugfs_create_endpoint(struct xhci_hcd *xhci,
				  struct xhci_virt_device *virt_dev,
				  int ep_index);
void xhci_debugfs_remove_endpoint(struct xhci_hcd *xhci,
				  struct xhci_virt_device *virt_dev,
				  int ep_index);
#else
static inline void xhci_debugfs_init(struct xhci_hcd *xhci) { }
static inline void xhci_debugfs_exit(struct xhci_hcd *xhci) { }
static inline void __init xhci_debugfs_create_root(void) { }
static inline void __exit xhci_debugfs_remove_root(void) { }
static inline void xhci_debugfs_create_slot(struct xhci_hcd *x, int s) { }
static inline void xhci_debugfs_remove_slot(struct xhci_hcd *x, int s) { }
static inline void
xhci_debugfs_create_endpoint(struct xhci_hcd *xhci,
			     struct xhci_virt_device *virt_dev,
			     int ep_index) { }
static inline void
xhci_debugfs_remove_endpoint(struct xhci_hcd *xhci,
			     struct xhci_virt_device *virt_dev,
			     int ep_index) { }
#endif /* CONFIG_DEBUG_FS */

#endif /* __LINUX_XHCI_DEBUGFS_H */