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