xref: /netbsd-src/sys/external/bsd/drm2/dist/drm/i915/gt/debugfs_gt.h (revision 41ec02673d281bbb3d38e6c78504ce6e30c228c1)
1 /*	$NetBSD: debugfs_gt.h,v 1.2 2021/12/18 23:45:30 riastradh Exp $	*/
2 
3 /* SPDX-License-Identifier: MIT */
4 /*
5  * Copyright © 2019 Intel Corporation
6  */
7 
8 #ifndef DEBUGFS_GT_H
9 #define DEBUGFS_GT_H
10 
11 #include <linux/file.h>
12 
13 struct intel_gt;
14 
15 #define DEFINE_GT_DEBUGFS_ATTRIBUTE(__name)				\
16 	static int __name ## _open(struct inode *inode, struct file *file) \
17 {									\
18 	return single_open(file, __name ## _show, inode->i_private);	\
19 }									\
20 static const struct file_operations __name ## _fops = {			\
21 	.owner = THIS_MODULE,						\
22 	.open = __name ## _open,					\
23 	.read = seq_read,						\
24 	.llseek = seq_lseek,						\
25 	.release = single_release,					\
26 }
27 
28 void debugfs_gt_register(struct intel_gt *gt);
29 
30 struct debugfs_gt_file {
31 	const char *name;
32 	const struct file_operations *fops;
33 	bool (*eval)(const struct intel_gt *gt);
34 };
35 
36 void debugfs_gt_register_files(struct intel_gt *gt,
37 			       struct dentry *root,
38 			       const struct debugfs_gt_file *files,
39 			       unsigned long count);
40 
41 #endif /* DEBUGFS_GT_H */
42