1293a5548SDaniele Ceraolo Spurio // SPDX-License-Identifier: MIT
2293a5548SDaniele Ceraolo Spurio /*
3293a5548SDaniele Ceraolo Spurio  * Copyright © 2020 Intel Corporation
4293a5548SDaniele Ceraolo Spurio  */
5293a5548SDaniele Ceraolo Spurio 
6293a5548SDaniele Ceraolo Spurio #include <drm/drm_print.h>
7293a5548SDaniele Ceraolo Spurio 
8*022f324cSLucas De Marchi #include "gt/intel_gt_debugfs.h"
9293a5548SDaniele Ceraolo Spurio #include "intel_huc.h"
10293a5548SDaniele Ceraolo Spurio #include "intel_huc_debugfs.h"
11293a5548SDaniele Ceraolo Spurio 
huc_info_show(struct seq_file * m,void * data)12293a5548SDaniele Ceraolo Spurio static int huc_info_show(struct seq_file *m, void *data)
13293a5548SDaniele Ceraolo Spurio {
14293a5548SDaniele Ceraolo Spurio 	struct intel_huc *huc = m->private;
15293a5548SDaniele Ceraolo Spurio 	struct drm_printer p = drm_seq_file_printer(m);
16293a5548SDaniele Ceraolo Spurio 
17293a5548SDaniele Ceraolo Spurio 	if (!intel_huc_is_supported(huc))
18293a5548SDaniele Ceraolo Spurio 		return -ENODEV;
19293a5548SDaniele Ceraolo Spurio 
20293a5548SDaniele Ceraolo Spurio 	intel_huc_load_status(huc, &p);
21293a5548SDaniele Ceraolo Spurio 
22293a5548SDaniele Ceraolo Spurio 	return 0;
23293a5548SDaniele Ceraolo Spurio }
24*022f324cSLucas De Marchi DEFINE_INTEL_GT_DEBUGFS_ATTRIBUTE(huc_info);
25293a5548SDaniele Ceraolo Spurio 
intel_huc_debugfs_register(struct intel_huc * huc,struct dentry * root)26293a5548SDaniele Ceraolo Spurio void intel_huc_debugfs_register(struct intel_huc *huc, struct dentry *root)
27293a5548SDaniele Ceraolo Spurio {
28*022f324cSLucas De Marchi 	static const struct intel_gt_debugfs_file files[] = {
29293a5548SDaniele Ceraolo Spurio 		{ "huc_info", &huc_info_fops, NULL },
30293a5548SDaniele Ceraolo Spurio 	};
31293a5548SDaniele Ceraolo Spurio 
32293a5548SDaniele Ceraolo Spurio 	if (!intel_huc_is_supported(huc))
33293a5548SDaniele Ceraolo Spurio 		return;
34293a5548SDaniele Ceraolo Spurio 
35293a5548SDaniele Ceraolo Spurio 	intel_gt_debugfs_register_files(root, files, ARRAY_SIZE(files), huc);
36293a5548SDaniele Ceraolo Spurio }
37