1/* SPDX-License-Identifier: MIT */
2/*
3 * Copyright © 2019 Intel Corporation
4 */
5
6#ifndef INTEL_GT_DEBUGFS_H
7#define INTEL_GT_DEBUGFS_H
8
9#include <linux/file.h>
10
11struct intel_gt;
12
13#define __GT_DEBUGFS_ATTRIBUTE_FOPS(__name) \
14static const struct file_operations __name ## _fops = { \
15 .owner = THIS_MODULE, \
16 .open = __name ## _open, \
17 .read = seq_read, \
18 .llseek = seq_lseek, \
19 .release = single_release, \
20}
21
22#define DEFINE_INTEL_GT_DEBUGFS_ATTRIBUTE(__name) \
23static int __name ## _open(struct inode *inode, struct file *file) \
24{ \
25 return single_open(file, __name ## _show, inode->i_private); \
26} \
27__GT_DEBUGFS_ATTRIBUTE_FOPS(__name)
28
29#define DEFINE_INTEL_GT_DEBUGFS_ATTRIBUTE_WITH_SIZE(__name, __size_vf) \
30static int __name ## _open(struct inode *inode, struct file *file) \
31{ \
32 return single_open_size(file, __name ## _show, inode->i_private, \
33 __size_vf(inode->i_private)); \
34} \
35__GT_DEBUGFS_ATTRIBUTE_FOPS(__name)
36
37void intel_gt_debugfs_register(struct intel_gt *gt);
38
39struct intel_gt_debugfs_file {
40 const char *name;
41 const struct file_operations *fops;
42 bool (*eval)(void *data);
43};
44
45void intel_gt_debugfs_register_files(struct dentry *root,
46 const struct intel_gt_debugfs_file *files,
47 unsigned long count, void *data);
48
49/* functions that need to be accessed by the upper level non-gt interfaces */
50int intel_gt_debugfs_reset_show(struct intel_gt *gt, u64 *val);
51void intel_gt_debugfs_reset_store(struct intel_gt *gt, u64 val);
52
53#endif /* INTEL_GT_DEBUGFS_H */
54

source code of linux/drivers/gpu/drm/i915/gt/intel_gt_debugfs.h