1 // SPDX-License-Identifier: MIT
2 /*
3 * Copyright © 2023 Intel Corporation
4 */
5
6 #include <drm/drm_print.h>
7
8 #include "gt/intel_gt.h"
9 #include "gt/intel_gt_debugfs.h"
10 #include "gt/intel_gt_print.h"
11 #include "intel_gsc_uc.h"
12 #include "intel_gsc_uc_debugfs.h"
13 #include "i915_drv.h"
14
gsc_info_show(struct seq_file * m,void * data)15 static int gsc_info_show(struct seq_file *m, void *data)
16 {
17 struct drm_printer p = drm_seq_file_printer(m);
18 struct intel_gsc_uc *gsc = m->private;
19
20 if (!intel_gsc_uc_is_supported(gsc))
21 return -ENODEV;
22
23 intel_gsc_uc_load_status(gsc, &p);
24
25 return 0;
26 }
27 DEFINE_INTEL_GT_DEBUGFS_ATTRIBUTE(gsc_info);
28
intel_gsc_uc_debugfs_register(struct intel_gsc_uc * gsc_uc,struct dentry * root)29 void intel_gsc_uc_debugfs_register(struct intel_gsc_uc *gsc_uc, struct dentry *root)
30 {
31 static const struct intel_gt_debugfs_file files[] = {
32 { "gsc_info", &gsc_info_fops, NULL },
33 };
34
35 if (!intel_gsc_uc_is_supported(gsc_uc))
36 return;
37
38 intel_gt_debugfs_register_files(root, files, ARRAY_SIZE(files), gsc_uc);
39 }
40