Home | History | Annotate | Line # | Download | only in gt
      1  1.1  riastrad /*	$NetBSD: debugfs_gt.c,v 1.2 2021/12/18 23:45:30 riastradh Exp $	*/
      2  1.1  riastrad 
      3  1.1  riastrad // SPDX-License-Identifier: MIT
      4  1.1  riastrad 
      5  1.1  riastrad /*
      6  1.1  riastrad  * Copyright  2019 Intel Corporation
      7  1.1  riastrad  */
      8  1.1  riastrad 
      9  1.1  riastrad #include <sys/cdefs.h>
     10  1.1  riastrad __KERNEL_RCSID(0, "$NetBSD: debugfs_gt.c,v 1.2 2021/12/18 23:45:30 riastradh Exp $");
     11  1.1  riastrad 
     12  1.1  riastrad #include <linux/debugfs.h>
     13  1.1  riastrad 
     14  1.1  riastrad #include "debugfs_engines.h"
     15  1.1  riastrad #include "debugfs_gt.h"
     16  1.1  riastrad #include "debugfs_gt_pm.h"
     17  1.1  riastrad #include "i915_drv.h"
     18  1.1  riastrad 
     19  1.1  riastrad void debugfs_gt_register(struct intel_gt *gt)
     20  1.1  riastrad {
     21  1.1  riastrad 	struct dentry *root;
     22  1.1  riastrad 
     23  1.1  riastrad 	if (!gt->i915->drm.primary->debugfs_root)
     24  1.1  riastrad 		return;
     25  1.1  riastrad 
     26  1.1  riastrad 	root = debugfs_create_dir("gt", gt->i915->drm.primary->debugfs_root);
     27  1.1  riastrad 	if (IS_ERR(root))
     28  1.1  riastrad 		return;
     29  1.1  riastrad 
     30  1.1  riastrad 	debugfs_engines_register(gt, root);
     31  1.1  riastrad 	debugfs_gt_pm_register(gt, root);
     32  1.1  riastrad }
     33  1.1  riastrad 
     34  1.1  riastrad void debugfs_gt_register_files(struct intel_gt *gt,
     35  1.1  riastrad 			       struct dentry *root,
     36  1.1  riastrad 			       const struct debugfs_gt_file *files,
     37  1.1  riastrad 			       unsigned long count)
     38  1.1  riastrad {
     39  1.1  riastrad 	while (count--) {
     40  1.1  riastrad 		if (!files->eval || files->eval(gt))
     41  1.1  riastrad 			debugfs_create_file(files->name,
     42  1.1  riastrad 					    0444, root, gt,
     43  1.1  riastrad 					    files->fops);
     44  1.1  riastrad 
     45  1.1  riastrad 		files++;
     46  1.1  riastrad 	}
     47  1.1  riastrad }
     48