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 11 struct intel_gt; 12 13 #define DEFINE_INTEL_GT_DEBUGFS_ATTRIBUTE(__name) \ 14 static int __name ## _open(struct inode *inode, struct file *file) \ 15 { \ 16 return single_open(file, __name ## _show, inode->i_private); \ 17 } \ 18 static const struct file_operations __name ## _fops = { \ 19 .owner = THIS_MODULE, \ 20 .open = __name ## _open, \ 21 .read = seq_read, \ 22 .llseek = seq_lseek, \ 23 .release = single_release, \ 24 } 25 26 void intel_gt_debugfs_register(struct intel_gt *gt); 27 28 struct intel_gt_debugfs_file { 29 const char *name; 30 const struct file_operations *fops; 31 bool (*eval)(void *data); 32 }; 33 34 void intel_gt_debugfs_register_files(struct dentry *root, 35 const struct intel_gt_debugfs_file *files, 36 unsigned long count, void *data); 37 38 /* functions that need to be accessed by the upper level non-gt interfaces */ 39 int intel_gt_debugfs_reset_show(struct intel_gt *gt, u64 *val); 40 int intel_gt_debugfs_reset_store(struct intel_gt *gt, u64 val); 41 42 #endif /* INTEL_GT_DEBUGFS_H */ 43