blob: ec3ceaf218b6afe40abfa275e40495f652b0acbf [file] [log] [blame]
Andrew Walbran267f6c12022-03-24 11:26:36 +00001/*
2 * Copyright 2022 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * https://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17.set .L_TT_TYPE_BLOCK, 0x1
18.set .L_TT_TYPE_PAGE, 0x3
19.set .L_TT_TYPE_TABLE, 0x3
20
21/* Access flag. */
22.set .L_TT_AF, 0x1 << 10
23/* Not global. */
24.set .L_TT_NG, 0x1 << 11
25.set .L_TT_RO, 0x2 << 6
26.set .L_TT_XN, 0x3 << 53
27
28.set .L_TT_MT_DEV, 0x0 << 2 // MAIR #0 (DEV_nGnRE)
29.set .L_TT_MT_MEM, (0x1 << 2) | (0x3 << 8) // MAIR #1 (MEM_WBWA), inner shareable
30
31.set .L_BLOCK_RO, .L_TT_TYPE_BLOCK | .L_TT_MT_MEM | .L_TT_AF | .L_TT_RO | .L_TT_XN
32.set .L_BLOCK_DEV, .L_TT_TYPE_BLOCK | .L_TT_MT_DEV | .L_TT_AF | .L_TT_XN
Andrew Walbrana0ecabd2022-04-11 14:26:18 +000033.set .L_BLOCK_MEM, .L_TT_TYPE_BLOCK | .L_TT_MT_MEM | .L_TT_AF | .L_TT_XN | .L_TT_NG
34.set .L_BLOCK_MEM_XIP, .L_TT_TYPE_BLOCK | .L_TT_MT_MEM | .L_TT_AF | .L_TT_NG | .L_TT_RO
Andrew Walbran267f6c12022-03-24 11:26:36 +000035
36.section ".rodata.idmap", "a", %progbits
37.global idmap
38.align 12
39idmap:
40 /* level 1 */
41 .quad .L_BLOCK_DEV | 0x0 // 1 GB of device mappings
Andrew Walbran3280f5f2022-04-28 15:05:16 +000042 .quad .L_TT_TYPE_TABLE + 0f // Unmapped device memory, and pVM firmware
43 .quad .L_TT_TYPE_TABLE + 1f // up to 1 GB of DRAM
Andrew Walbran267f6c12022-03-24 11:26:36 +000044 .fill 509, 8, 0x0 // 509 GB of remaining VA space
45
46 /* level 2 */
Andrew Walbranebd40c82022-04-28 15:05:16 +0000470: .fill 510, 8, 0x0
48 .quad .L_BLOCK_MEM_XIP | 0x7fc00000 // pVM firmware image
49 .quad .L_BLOCK_MEM | 0x7fe00000 // Writable memory for stack, heap &c.
Andrew Walbran3280f5f2022-04-28 15:05:16 +0000501: .quad .L_BLOCK_RO | 0x80000000 // DT provided by VMM
51 .quad .L_BLOCK_RO | 0x80200000 // 2 MB of DRAM containing payload image
Andrew Walbranebd40c82022-04-28 15:05:16 +000052 .fill 510, 8, 0x0