1 // SPDX-License-Identifier: MIT
2 /*
3  * Copyright © 2020 Intel Corporation
4  */
5 
6 #include <drm/drm_print.h>
7 
8 #include "gt/intel_gt_debugfs.h"
9 #include "intel_huc.h"
10 #include "intel_huc_debugfs.h"
11 
12 static int huc_info_show(struct seq_file *m, void *data)
13 {
14 	struct intel_huc *huc = m->private;
15 	struct drm_printer p = drm_seq_file_printer(m);
16 
17 	if (!intel_huc_is_supported(huc))
18 		return -ENODEV;
19 
20 	intel_huc_load_status(huc, &p);
21 
22 	return 0;
23 }
24 DEFINE_INTEL_GT_DEBUGFS_ATTRIBUTE(huc_info);
25 
26 void intel_huc_debugfs_register(struct intel_huc *huc, struct dentry *root)
27 {
28 	static const struct intel_gt_debugfs_file files[] = {
29 		{ "huc_info", &huc_info_fops, NULL },
30 	};
31 
32 	if (!intel_huc_is_supported(huc))
33 		return;
34 
35 	intel_gt_debugfs_register_files(root, files, ARRAY_SIZE(files), huc);
36 }
37