1 // SPDX-License-Identifier: MIT
2 /*
3 * Copyright © 2020 Intel Corporation
4 */
5
6 #include <drm/drm_print.h>
7
8 #include "gt/debugfs_gt.h"
9 #include "intel_guc.h"
10 #include "intel_guc_debugfs.h"
11 #include "intel_guc_log_debugfs.h"
12
guc_info_show(struct seq_file * m,void * data)13 static int guc_info_show(struct seq_file *m, void *data)
14 {
15 struct intel_guc *guc = m->private;
16 struct drm_printer p = drm_seq_file_printer(m);
17
18 if (!intel_guc_is_supported(guc))
19 return -ENODEV;
20
21 intel_guc_load_status(guc, &p);
22 drm_puts(&p, "\n");
23 intel_guc_log_info(&guc->log, &p);
24
25 /* Add more as required ... */
26
27 return 0;
28 }
29 DEFINE_GT_DEBUGFS_ATTRIBUTE(guc_info);
30
intel_guc_debugfs_register(struct intel_guc * guc,struct dentry * root)31 void intel_guc_debugfs_register(struct intel_guc *guc, struct dentry *root)
32 {
33 static const struct debugfs_gt_file files[] = {
34 { "guc_info", &guc_info_fops, NULL },
35 };
36
37 if (!intel_guc_is_supported(guc))
38 return;
39
40 intel_gt_debugfs_register_files(root, files, ARRAY_SIZE(files), guc);
41 intel_guc_log_debugfs_register(&guc->log, root);
42 }
43