physical page list mapping
[lunaix-os.git] / lunaix-os / arch / aarch64 / includes / asm / aa64_mmu.h
1 #ifndef __LUNAIX_AA64_MMU_H
2 #define __LUNAIX_AA64_MMU_H
3
4 #include "aa64_asm.h"
5 #include <lunaix/bits.h>
6
7 #if    defined(CONFIG_AA64_PAGE_GRAN_4K)
8 #define _MMU_TG    0b01
9 #elif  defined(CONFIG_AA64_PAGE_GRAN_16K)
10 #define _MMU_TG    0b10
11 #elif  defined(CONFIG_AA64_PAGE_GRAN_64K)
12 #define _MMU_TG    0b11
13 #endif
14
15 #if CONFIG_AA_OA_SIZE == 52
16 #define _MMU_USE_OA52
17 #endif
18
19
20 #define TCR_DS              (1UL << 59)
21 #define TCR_E0PD1           (1UL << 56)
22 #define TCR_E0PD0           (1UL << 55)
23 #define TCR_TBID1           (1UL << 52)
24 #define TCR_TBID0           (1UL << 51)
25 #define TCR_HPD1            (1UL << 42)
26 #define TCR_HPD0            (1UL << 41)
27 #define TCR_HD              (1UL << 40)
28 #define TCR_HA              (1UL << 39)
29 #define TCR_TBI1            (1UL << 38)
30 #define TCR_TBI0            (1UL << 37)
31 #define TCR_AS              (1UL << 36)
32
33 #define TCR_G4K             (0b01)
34 #define TCR_G16K            (0b10)
35 #define TCR_G64K            (0b11)
36
37 #define TCR_SHNS            (0b00)
38 #define TCR_SHOS            (0b10)
39 #define TCR_SHIS            (0b11)
40
41 #define TCR_TG1(g)          (((g) & 0b11) << 30)
42 #define TCR_TG0(g)          (((g) & 0b11) << 14)
43
44 #define TCR_T1SZ(sz)        (((sz) & 0b111111) << 16)
45 #define TCR_T0SZ(sz)        (((sz) & 0b111111))
46
47 #define TCR_EPD1            (1UL << 23)
48 #define TCR_EPD0            (1UL << 7)
49 #define TCR_A1              (1UL << 22)
50
51 #define TTBR_ASID           BITFIELD(63, 48)
52 #define TTBR_BADDR          BITFIELD(47, 1)
53 #define TTBR_CnP            BITFLAG(0)
54
55 #endif /* __LUNAIX_AA64_MMU_H */