1*4882a593Smuzhiyun // SPDX-License-Identifier: GPL-2.0
2*4882a593Smuzhiyun #include <linux/debugfs.h>
3*4882a593Smuzhiyun #include <linux/seq_file.h>
4*4882a593Smuzhiyun
5*4882a593Smuzhiyun #include <asm/ptdump.h>
6*4882a593Smuzhiyun
ptdump_show(struct seq_file * m,void * v)7*4882a593Smuzhiyun static int ptdump_show(struct seq_file *m, void *v)
8*4882a593Smuzhiyun {
9*4882a593Smuzhiyun struct ptdump_info *info = m->private;
10*4882a593Smuzhiyun
11*4882a593Smuzhiyun ptdump_walk_pgd(m, info);
12*4882a593Smuzhiyun return 0;
13*4882a593Smuzhiyun }
14*4882a593Smuzhiyun
ptdump_open(struct inode * inode,struct file * file)15*4882a593Smuzhiyun static int ptdump_open(struct inode *inode, struct file *file)
16*4882a593Smuzhiyun {
17*4882a593Smuzhiyun return single_open(file, ptdump_show, inode->i_private);
18*4882a593Smuzhiyun }
19*4882a593Smuzhiyun
20*4882a593Smuzhiyun static const struct file_operations ptdump_fops = {
21*4882a593Smuzhiyun .open = ptdump_open,
22*4882a593Smuzhiyun .read = seq_read,
23*4882a593Smuzhiyun .llseek = seq_lseek,
24*4882a593Smuzhiyun .release = single_release,
25*4882a593Smuzhiyun };
26*4882a593Smuzhiyun
ptdump_debugfs_register(struct ptdump_info * info,const char * name)27*4882a593Smuzhiyun void ptdump_debugfs_register(struct ptdump_info *info, const char *name)
28*4882a593Smuzhiyun {
29*4882a593Smuzhiyun debugfs_create_file(name, 0400, NULL, info, &ptdump_fops);
30*4882a593Smuzhiyun }
31