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