1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #ifndef ARM_ARM64_MPU_H
4 #define ARM_ARM64_MPU_H
5 
6 #ifndef __ASSEMBLY__
7 
8 #define MPU_REGION_RES0        (0xFFFFULL << 48)
9 
10 /* Protection Region Base Address Register */
11 typedef union {
12     struct __packed {
13         unsigned long xn_0:1;     /* Execute-Never XN[0] */
14         unsigned long xn:1;       /* Execute-Never XN[1] */
15         unsigned long ap_0:1;     /* Access Permission AP[0] */
16         unsigned long ro:1;       /* Access Permission AP[1] */
17         unsigned long sh:2;       /* Shareability */
18         unsigned long base:42;    /* Base Address */
19         unsigned long res0:16;    /* RES0 */
20     } reg;
21     uint64_t bits;
22 } prbar_t;
23 
24 /* Protection Region Limit Address Register */
25 typedef union {
26     struct __packed {
27         unsigned long en:1;     /* Region enable */
28         unsigned long ai:3;     /* Memory Attribute Index */
29         unsigned long ns:1;     /* Not-Secure */
30         unsigned long res0:1;   /* RES0 */
31         unsigned long limit:42; /* Limit Address */
32         unsigned long res1:16;  /* RES0 */
33     } reg;
34     uint64_t bits;
35 } prlar_t;
36 
37 /* MPU Protection Region */
38 typedef struct {
39     prbar_t prbar;
40     prlar_t prlar;
41 } pr_t;
42 
43 #endif /* __ASSEMBLY__ */
44 
45 #endif /* ARM_ARM64_MPU_H */
46 
47 /*
48  * Local variables:
49  * mode: C
50  * c-file-style: "BSD"
51  * c-basic-offset: 4
52  * indent-tabs-mode: nil
53  * End:
54  */
55