]> git.proxmox.com Git - mirror_edk2.git/blob - ArmVirtPkg/Library/ArmPlatformLibQemu/IdMap.S
4a4b7b77ed836c8bcfa3bb232c7f28c4559a8667
[mirror_edk2.git] / ArmVirtPkg / Library / ArmPlatformLibQemu / IdMap.S
1 // SPDX-License-Identifier: BSD-2-Clause-Patent
2 // Copyright 2022 Google LLC
3 // Author: Ard Biesheuvel <ardb@google.com>
4
5 .set TT_TYPE_BLOCK, 0x1
6 .set TT_TYPE_PAGE, 0x3
7 .set TT_TYPE_TABLE, 0x3
8
9 .set TT_AF, 0x1 << 10
10 .set TT_NG, 0x1 << 11
11 .set TT_RO, 0x2 << 6
12 .set TT_XN, 0x3 << 53
13
14 .set TT_MT_DEV, 0x0 << 2 // MAIR #0
15 .set TT_MT_MEM, (0x3 << 2) | (0x3 << 8) // MAIR #3
16
17 .set PAGE_XIP, TT_TYPE_PAGE | TT_MT_MEM | TT_AF | TT_RO | TT_NG
18 .set BLOCK_DEV, TT_TYPE_BLOCK | TT_MT_DEV | TT_AF | TT_XN | TT_NG
19 .set BLOCK_MEM, TT_TYPE_BLOCK | TT_MT_MEM | TT_AF | TT_XN | TT_NG
20
21 .globl idmap
22 .section ".rodata.idmap", "a", %progbits
23 .align 12
24
25 idmap: /* level 0 */
26 .quad 1f + TT_TYPE_TABLE
27 .fill 511, 8, 0x0
28
29 1: /* level 1 */
30 .quad 20f + TT_TYPE_TABLE // 1 GB of flash and device mappings
31 .quad 21f + TT_TYPE_TABLE // up to 1 GB of DRAM
32 .fill 510, 8, 0x0 // 510 GB of remaining VA space
33
34 20: /* level 2 */
35 .quad 3f + TT_TYPE_TABLE // up to 2 MB of flash
36 .fill 63, 8, 0x0 // 126 MB of unused flash
37 .set idx, 64
38 .rept 448
39 .quad BLOCK_DEV | (idx << 21) // 896 MB of RW- device mappings
40 .set idx, idx + 1
41 .endr
42
43 21: /* level 2 */
44 .set idx, 0x40000000 >> 21
45 .rept 64
46 .quad BLOCK_MEM | (idx << 21) // 128 MB of RW- memory mappings
47 .set idx, idx + 1
48 .endr
49 .fill 448, 8, 0x0
50
51 3: /* level 3 */
52 .quad 0x0 // omit first 4k page
53 .set idx, 1
54 .rept 511
55 .quad PAGE_XIP | (idx << 12) // 2044 KiB of R-X flash mappings
56 .set idx, idx + 1
57 .endr