]> git.proxmox.com Git - mirror_edk2.git/blob - ArmVirtPkg/Library/ArmPlatformLibQemu/IdMap.S
ArmVirtPkg/ArmVirtQemu: enlarge initial flash mapping
[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_XIP, TT_TYPE_BLOCK | TT_MT_MEM | TT_AF | TT_RO | TT_NG
19 .set BLOCK_DEV, TT_TYPE_BLOCK | TT_MT_DEV | TT_AF | TT_XN | TT_NG
20 .set BLOCK_MEM, TT_TYPE_BLOCK | TT_MT_MEM | TT_AF | TT_XN | TT_NG
21
22 .globl idmap
23 .section ".rodata.idmap", "a", %progbits
24 .align 12
25
26 idmap: /* level 0 */
27 .quad 1f + TT_TYPE_TABLE
28 .fill 511, 8, 0x0
29
30 1: /* level 1 */
31 .quad 20f + TT_TYPE_TABLE // 1 GB of flash and device mappings
32 .quad 21f + TT_TYPE_TABLE // up to 1 GB of DRAM
33 .fill 510, 8, 0x0 // 510 GB of remaining VA space
34
35 20: /* level 2 */
36 .quad 3f + TT_TYPE_TABLE // up to 2 MB of flash
37 .quad BLOCK_XIP | (0x1 << 21) // another 2 MB of flash
38 .fill 62, 8, 0x0 // 124 MB of unused flash
39 .set idx, 64
40 .rept 448
41 .quad BLOCK_DEV | (idx << 21) // 896 MB of RW- device mappings
42 .set idx, idx + 1
43 .endr
44
45 21: /* level 2 */
46 .set idx, 0x40000000 >> 21
47 .rept 64
48 .quad BLOCK_MEM | (idx << 21) // 128 MB of RW- memory mappings
49 .set idx, idx + 1
50 .endr
51 .fill 448, 8, 0x0
52
53 3: /* level 3 */
54 .quad 0x0 // omit first 4k page
55 .set idx, 1
56 .rept 511
57 .quad PAGE_XIP | (idx << 12) // 2044 KiB of R-X flash mappings
58 .set idx, idx + 1
59 .endr