1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_POWERPC_SET_MEMORY_H
3 #define _ASM_POWERPC_SET_MEMORY_H
4 
5 #define SET_MEMORY_RO	0
6 #define SET_MEMORY_RW	1
7 #define SET_MEMORY_NX	2
8 #define SET_MEMORY_X	3
9 #define SET_MEMORY_NP	4	/* Set memory non present */
10 #define SET_MEMORY_P	5	/* Set memory present */
11 
12 int change_memory_attr(unsigned long addr, int numpages, long action);
13 
14 static inline int set_memory_ro(unsigned long addr, int numpages)
15 {
16 	return change_memory_attr(addr, numpages, SET_MEMORY_RO);
17 }
18 
19 static inline int set_memory_rw(unsigned long addr, int numpages)
20 {
21 	return change_memory_attr(addr, numpages, SET_MEMORY_RW);
22 }
23 
24 static inline int set_memory_nx(unsigned long addr, int numpages)
25 {
26 	return change_memory_attr(addr, numpages, SET_MEMORY_NX);
27 }
28 
29 static inline int set_memory_x(unsigned long addr, int numpages)
30 {
31 	return change_memory_attr(addr, numpages, SET_MEMORY_X);
32 }
33 
34 static inline int set_memory_np(unsigned long addr, int numpages)
35 {
36 	return change_memory_attr(addr, numpages, SET_MEMORY_NP);
37 }
38 
39 static inline int set_memory_p(unsigned long addr, int numpages)
40 {
41 	return change_memory_attr(addr, numpages, SET_MEMORY_P);
42 }
43 
44 #endif
45