xref: /openbmc/linux/arch/powerpc/mm/ptdump/8xx.c (revision c8ed9fc9)
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * From split of dump_linuxpagetables.c
4  * Copyright 2016, Rashmica Gupta, IBM Corp.
5  *
6  */
7 #include <linux/kernel.h>
8 #include <linux/pgtable.h>
9 
10 #include "ptdump.h"
11 
12 static const struct flag_info flag_array[] = {
13 	{
14 		.mask	= _PAGE_HUGE,
15 		.val	= _PAGE_HUGE,
16 		.set	= "huge",
17 		.clear	= "    ",
18 	}, {
19 		.mask	= _PAGE_SH,
20 		.val	= 0,
21 		.set	= "user",
22 		.clear	= "    ",
23 	}, {
24 		.mask	= _PAGE_RO | _PAGE_NA,
25 		.val	= 0,
26 		.set	= "rw",
27 	}, {
28 		.mask	= _PAGE_RO | _PAGE_NA,
29 		.val	= _PAGE_RO,
30 		.set	= "r ",
31 	}, {
32 		.mask	= _PAGE_RO | _PAGE_NA,
33 		.val	= _PAGE_NA,
34 		.set	= "  ",
35 	}, {
36 		.mask	= _PAGE_EXEC,
37 		.val	= _PAGE_EXEC,
38 		.set	= " X ",
39 		.clear	= "   ",
40 	}, {
41 		.mask	= _PAGE_PRESENT,
42 		.val	= _PAGE_PRESENT,
43 		.set	= "present",
44 		.clear	= "       ",
45 	}, {
46 		.mask	= _PAGE_GUARDED,
47 		.val	= _PAGE_GUARDED,
48 		.set	= "guarded",
49 		.clear	= "       ",
50 	}, {
51 		.mask	= _PAGE_DIRTY,
52 		.val	= _PAGE_DIRTY,
53 		.set	= "dirty",
54 		.clear	= "     ",
55 	}, {
56 		.mask	= _PAGE_ACCESSED,
57 		.val	= _PAGE_ACCESSED,
58 		.set	= "accessed",
59 		.clear	= "        ",
60 	}, {
61 		.mask	= _PAGE_NO_CACHE,
62 		.val	= _PAGE_NO_CACHE,
63 		.set	= "no cache",
64 		.clear	= "        ",
65 	}, {
66 		.mask	= _PAGE_SPECIAL,
67 		.val	= _PAGE_SPECIAL,
68 		.set	= "special",
69 	}
70 };
71 
72 struct pgtable_level pg_level[5] = {
73 	{
74 	}, { /* pgd */
75 		.flag	= flag_array,
76 		.num	= ARRAY_SIZE(flag_array),
77 	}, { /* pud */
78 		.flag	= flag_array,
79 		.num	= ARRAY_SIZE(flag_array),
80 	}, { /* pmd */
81 		.flag	= flag_array,
82 		.num	= ARRAY_SIZE(flag_array),
83 	}, { /* pte */
84 		.flag	= flag_array,
85 		.num	= ARRAY_SIZE(flag_array),
86 	},
87 };
88