Debian Codegraph @

src/soc/qualcomm/x1p42100/memlayout.ld

raw
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #include <memlayout.h>
4 #include <arch/header.ld>
5 #include <soc/memlayout.h>
6
7
8 /*
9 * The linker script below configures the memory layout for the Qualcomm X1P42100 SoC.
10 *
11 * The memory map and addressing scheme are implemented according to the official Qualcomm
12 * Hardware Reference Document (HRD) for this specific SoC.
13 *
14 * 0x10000000000 +----------------------------------------------------------+ <--------------
15 * | dram_space_2 | DRAM Space 2 ^
16 * 0x8800000000 +----------------------------------------------------------+ <--------- |
17 * | ... (Memory not mapped: Unavailable) ... | XXXXXXXXX |
18 * 0x1000000000 +----------------------------------------------------------+ <--------- |
19 * | dram_space_1 | DRAM Space 1 |
20 * 0x880000000 +----------------------------------------------------------+ <--------- |
21 * | ... (Memory not mapped: Unavailable) ... | XXXXXXXXX |
22 * 0x100000000 +----------------------------------------------------------+ <--------- |
23 * | dram_smem (Shared Memory) | ^ |
24 * 0xFF800000 +----------------------------------------------------------+ | |
25 * | CBMEM | | |
26 * +----------------------------------------------------------+ | |
27 * | ... Usable memory ... | | |
28 * 0xD8600000 +----------------------------------------------------------+ | |
29 * | BL31 (ARM Trusted Firmware) | | |
30 * 0xD856A000 +----------------------------------------------------------+ | |
31 * | dram_tz_rem (TrustZone Remainder) | | |
32 * 0xD81D6000 +----------------------------------------------------------+ | |
33 * | dram_tz (TrustZone) | | |
34 * 0xD8000000 +----------------------------------------------------------+ | DRAM
35 * | ... Usable memory ... | | |
36 * 0xD7800000 +----------------------------------------------------------+ | |
37 * | Linux Kernel Reserve | | |
38 * 0xC7800000 +----------------------------------------------------------+ | |
39 * | ... Usable memory ... | | |
40 * 0xA1800000 +----------------------------------------------------------+ | |
41 * | RAMSTAGE | DRAM Space 0 |
42 * 0xA0800000 +----------------------------------------------------------+ | |
43 * | POSTRAM_CBFS_CACHE | | |
44 * 0x9F800000 +----------------------------------------------------------+ | |
45 * | ... Usable memory ... | | |
46 * 0x91380000 +----------------------------------------------------------+ | |
47 * | dram_aop | | |
48 * 0x81C00000 +----------------------------------------------------------+ | |
49 * | dram_ramdump | | |
50 * 0x81A00000 +----------------------------------------------------------+ | |
51 * | ... Usable memory ... | | |
52 * 0x815A0000 +----------------------------------------------------------+ | |
53 * | dram_cpucp | | |
54 * 0x80A00000 +----------------------------------------------------------+ | |
55 * | ... Usable memory ... | v v
56 * 0x80000000 +----------------------------------------------------------+ <--------------
57 * | ... (Memory not mapped: Unavailable) ... | XXXXXXXXX
58 * 0x24060000 +----------------------------------------------------------+ <---------
59 * | shrm | SHRM
60 * 0x24040000 +----------------------------------------------------------+ <---------
61 * | ... (Memory not mapped: Unavailable) ... | XXXXXXXXX
62 * 0x14A80000 +----------------------------------------------------------+ <---------
63 * | debug_policy | ^
64 * 0x14A7F000 +----------------------------------------------------------+ |
65 * | auth_metadata | |
66 * 0x14A7D000 +----------------------------------------------------------+ |
67 * | ... Usable memory ... | |
68 * 0x14A59000 +----------------------------------------------------------+ |
69 * | OVERLAP_DECOMPRESSOR_VERSTAGE_ROMSTAGE | |
70 * 0x14A38000 +----------------------------------------------------------+ |
71 * | PRERAM_CBMEM_CONSOLE | |
72 * 0x14A30000 +----------------------------------------------------------+ |
73 * | ... Usable memory ... | |
74 * 0x14A1A000 +----------------------------------------------------------+ |
75 * | CPR | |
76 * 0x14A17000 +----------------------------------------------------------+ |
77 * | qclib | |
78 * 0x14897000 +----------------------------------------------------------+ |
79 * | ... Usable memory ... | |
80 * 0x1488C000 +----------------------------------------------------------+ |
81 * | qc_blob_meta | |
82 * 0x14888000 +----------------------------------------------------------+ |
83 * | ddr_training | |
84 * 0x14878000 +----------------------------------------------------------+ |
85 * | dtb (Device Tree Blob) | |
86 * 0x14870000 +----------------------------------------------------------+ |
87 * | dcb (DDR Config Block) | |
88 * 0x14862000 +----------------------------------------------------------+ |
89 * | ... Usable memory ... | |
90 * 0x14860C00 +----------------------------------------------------------+ |
91 * | FMAP_CACHE | |
92 * 0x14860400 +----------------------------------------------------------+ |
93 * | ddr_information | |
94 * 0x14860000 +----------------------------------------------------------+ BSRAM
95 * | CBFS_MCACHE | |
96 * 0x1485C000 +----------------------------------------------------------+ |
97 * | qclib_serial_log | |
98 * 0x1485B000 +----------------------------------------------------------+ |
99 * | ... Usable memory ... | |
100 * 0x14859000 +----------------------------------------------------------+ |
101 * | DMA_COHERENT | |
102 * 0x14857000 +----------------------------------------------------------+ |
103 * | VBOOT2_WORK | |
104 * 0x14854000 +----------------------------------------------------------+ |
105 * | STACK | |
106 * 0x14850000 +----------------------------------------------------------+ |
107 * | TTB (Translation Table Base) | |
108 * 0x14842000 +----------------------------------------------------------+ |
109 * | TIMESTAMP | |
110 * 0x14841C00 +----------------------------------------------------------+ |
111 * | PRERAM_CBFS_CACHE | |
112 * 0x14828000 +----------------------------------------------------------+ |
113 * | BOOTBLOCK | |
114 * 0x14819000 +----------------------------------------------------------+ |
115 * | WATCHDOG_TOMBSTONE | |
116 * 0x14818FFC +----------------------------------------------------------+ |
117 * | ... Usable memory ... | |
118 * 0x14815000 +----------------------------------------------------------+ |
119 * | pbl_timestamps | v
120 * 0x14800000 +----------------------------------------------------------+ <---------
121 * | ... (Large Address Gap) ... |
122 * 0x146AB000 +----------------------------------------------------------+ <---------
123 * | shared_imem | ^
124 * 0x146A8000 +----------------------------------------------------------+ |
125 * | ... Usable memory ... | SSRAM
126 * 0x146A5000 +----------------------------------------------------------+ |
127 * | qcsdi | v
128 * 0x14699000 +----------------------------------------------------------+ <---------
129 * | ... (Memory not mapped: Unavailable) ... | XXXXXXXXX
130 * 0x0B100000 +----------------------------------------------------------+ <---------
131 * | aop_data_ram | ^
132 * 0x0B0E0000 +----------------------------------------------------------+ |
133 * | ... Usable memory ... | AOP SRAM
134 * 0x0B080000 +----------------------------------------------------------+ |
135 * | aop_code_ram | v
136 * 0x0B000000 +----------------------------------------------------------+ <---------
137 *
138 */
139
140 SECTIONS
141 {
142 AOPSRAM_START(0x0B000000)
143 REGION(aop_code_ram, 0x0B000000, 0x80000, 4K)
144 REGION(aop_data_ram, 0x0B0E0000, 0x20000, 4K)
145 AOPSRAM_END(0x0B100000)
146
147 SSRAM_START(0x14680000)
148 REGION(qcsdi, 0x14699000, 48K, 4K)
149 REGION(shared_imem, 0x146A8000, 12K, 4K)
150 SSRAM_END(0x146AB000)
151
152 BSRAM_START(0x14800000)
153 REGION(pbl_timestamps, 0x14800000, 84K, 4K)
154 WATCHDOG_TOMBSTONE(0x14818FFC, 4)
155 BOOTBLOCK(0x14819000, 60K)
156 PRERAM_CBFS_CACHE(0x14828000, 103K)
157 TIMESTAMP(0x14841C00, 1K)
158 TTB(0x14842000, 56K)
159 STACK(0x14850000, 16K)
160 VBOOT2_WORK(0x14854000, 12K)
161 DMA_COHERENT(0x14857000, 8K)
162 REGION(qclib_serial_log, 0x1485B000, 4K, 4K)
163 CBFS_MCACHE(0x1485C000,16K)
164 REGION(ddr_information, 0x14860000, 1K, 1K)
165 FMAP_CACHE(0x14860400, 2K)
166 REGION(dcb, 0x14862000, 56K, 4K)
167 REGION(dtb, 0x14870000, 32K, 4K)
168 REGION(ddr_training, 0x14878000, 64K, 4K)
169 REGION(qc_blob_meta, 0x14888000, 16K, 4K)
170 REGION(aop_blob_meta, 0x1488c000, 16K, 4K)
171 REGION(qclib, 0x14897000, 1536K, 4K)
172 REGION(cpr_settings, 0x14A17000, 12K, 4K)
173 PRERAM_CBMEM_CONSOLE(0x14A30000, 32K)
174 OVERLAP_DECOMPRESSOR_VERSTAGE_ROMSTAGE(0x14A38000, 132K)
175 REGION(auth_metadata,0x14A7D000 , 8K, 4K)
176 REGION(debug_policy, 0x14A7F000, 4K, 4K)
177 BSRAM_END(0x14A80000)
178
179 REGION(shrm, 0x24040000, 128K , 4K)
180
181 DRAM_START(0x80000000)
182 REGION(dram_cpucp, 0x80A00000, 0xBA0000, 4K)
183 REGION(dram_ramdump, 0x81A00000, 0x200000, 4K)
184 REGION(dram_aop, 0x81C00000, 0xF780000, 4K)
185 POSTRAM_CBFS_CACHE(0x9F800000, 16M)
186 RAMSTAGE(0xA0800000, 16M)
187 REGION(dram_tz, 0xD8000000, 0xD6000, 4K)
188 REGION(dram_tz_rem, 0xD81D6000, 0x394000, 4K)
189 BL31(0xD856A000, 600K)
190 REGION(dram_smem, 0xFF800000, 0x800000, 4K)
191 DRAM_END(0x100000000)
192
193 /*
194 * Define the address range limits for fragmented DRAM regions.
195 *
196 * These regions, `dram_space_1` and `dram_space_2`, are used to map physical
197 * memory beyond the initial `_dram` region. The MMU configuration logic in
198 * `mmu.c` uses `REGION_SIZE()` to dynamically size these ranges based on the
199 * total system DRAM capacity, which is determined by the QCLib.
200 *
201 * Example for a 16GB DRAM system:
202 * - `_dram` (2GB): 0x80000000 - 0x100000000
203 * - `_dram_space_1` (14GB): 0x880000000 - 0x440000000 (0x880000000 + 14GB)
204 *
205 * Note: The example memory addresses are for illustration and depend on the
206 * platform's specific memory map.
207 */
208 REGION(dram_space_1, 0x880000000, 0x780000000, 4K)
209 REGION(dram_space_2, 0x8800000000, 0x7800000000, 4K)
210 }