Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: MIT */
0002 /*
0003  * Copyright © 2019 Intel Corporation
0004  */
0005 
0006 #ifndef INTEL_GT_DEBUGFS_H
0007 #define INTEL_GT_DEBUGFS_H
0008 
0009 #include <linux/file.h>
0010 
0011 struct intel_gt;
0012 
0013 #define __GT_DEBUGFS_ATTRIBUTE_FOPS(__name)             \
0014 static const struct file_operations __name ## _fops = {         \
0015     .owner = THIS_MODULE,                       \
0016     .open = __name ## _open,                    \
0017     .read = seq_read,                       \
0018     .llseek = seq_lseek,                        \
0019     .release = single_release,                  \
0020 }
0021 
0022 #define DEFINE_INTEL_GT_DEBUGFS_ATTRIBUTE(__name)           \
0023 static int __name ## _open(struct inode *inode, struct file *file)  \
0024 {                                   \
0025     return single_open(file, __name ## _show, inode->i_private);    \
0026 }                                   \
0027 __GT_DEBUGFS_ATTRIBUTE_FOPS(__name)
0028 
0029 #define DEFINE_INTEL_GT_DEBUGFS_ATTRIBUTE_WITH_SIZE(__name, __size_vf)      \
0030 static int __name ## _open(struct inode *inode, struct file *file)      \
0031 {                                       \
0032     return single_open_size(file, __name ## _show, inode->i_private,    \
0033                 __size_vf(inode->i_private));           \
0034 }                                       \
0035 __GT_DEBUGFS_ATTRIBUTE_FOPS(__name)
0036 
0037 void intel_gt_debugfs_register(struct intel_gt *gt);
0038 
0039 struct intel_gt_debugfs_file {
0040     const char *name;
0041     const struct file_operations *fops;
0042     bool (*eval)(void *data);
0043 };
0044 
0045 void intel_gt_debugfs_register_files(struct dentry *root,
0046                      const struct intel_gt_debugfs_file *files,
0047                      unsigned long count, void *data);
0048 
0049 /* functions that need to be accessed by the upper level non-gt interfaces */
0050 int intel_gt_debugfs_reset_show(struct intel_gt *gt, u64 *val);
0051 void intel_gt_debugfs_reset_store(struct intel_gt *gt, u64 val);
0052 
0053 #endif /* INTEL_GT_DEBUGFS_H */