1 /* SPDX-License-Identifier: GPL-2.0-only */
10 #define REGION_SIZE(name) ((size_t)_##name##_size)
12 #define DECLARE_REGION(name) \
13 __maybe_unused extern u8 _##name[]; \
14 __maybe_unused extern u8 _e##name[]; \
15 __maybe_unused extern u8 _##name##_size[];
18 * Regions can be declared optional if not all configurations provide them in
19 * memlayout and you want code to be able to check for their existence at
20 * runtime. Not every region that is architecture or platform-specific should
21 * use this -- only declare regions optional if the code *accessing* them runs
22 * both on configurations that have the region and those that don't. That code
23 * should then check (REGION_SIZE(name) != 0) before accessing it.
25 #define DECLARE_OPTIONAL_REGION(name) \
26 __maybe_unused __weak extern u8 _##name[]; \
27 __maybe_unused __weak extern u8 _e##name[]; \
28 __maybe_unused __weak extern u8 _##name##_size[];
31 DECLARE_OPTIONAL_REGION(timestamp
)
32 DECLARE_REGION(preram_cbmem_console
)
33 DECLARE_REGION(cbmem_init_hooks
)
35 DECLARE_OPTIONAL_REGION(preram_cbfs_cache
)
36 DECLARE_OPTIONAL_REGION(postram_cbfs_cache
)
37 DECLARE_OPTIONAL_REGION(cbfs_cache
)
38 DECLARE_REGION(cbfs_mcache
)
39 DECLARE_REGION(fmap_cache
)
40 DECLARE_REGION(tpm_log
)
42 #if ENV_SEPARATE_ROMSTAGE && CONFIG(ASAN_IN_ROMSTAGE)
44 DECLARE_REGION(asan_shadow
)
47 #if ENV_RAMSTAGE && CONFIG(ASAN_IN_RAMSTAGE)
50 DECLARE_REGION(asan_shadow
)
53 #if ENV_SEPARATE_DATA_AND_BSS
55 DECLARE_REGION(data_load
)
58 /* Regions for execution units. */
60 DECLARE_REGION(payload
)
61 /* "program" always refers to the current execution unit. */
62 DECLARE_REGION(program
)
63 /* _<stage>_size is always the maximum amount allocated in memlayout, whereas
64 _program_size gives the actual memory footprint *used* by current stage. */
65 DECLARE_REGION(decompressor
)
66 DECLARE_REGION(bootblock
)
67 DECLARE_REGION(verstage
)
68 DECLARE_REGION(romstage
)
69 DECLARE_REGION(postcar
)
70 DECLARE_REGION(ramstage
)
72 /* Arch-specific, move to <arch/symbols.h> if they become too many. */
74 DECLARE_REGION(pagetables
)
76 DECLARE_OPTIONAL_REGION(ttb_subtables
)
77 DECLARE_REGION(dma_coherent
)
78 DECLARE_REGION(soc_registers
)
79 DECLARE_REGION(framebuffer
)
81 DECLARE_OPTIONAL_REGION(opensbi
)
82 DECLARE_OPTIONAL_REGION(bl31
)
83 DECLARE_REGION(transfer_buffer
)
84 DECLARE_OPTIONAL_REGION(watchdog_tombstone
)
86 /* Returns true when pre-RAM symbols are known to the linker.
87 * (Does not necessarily mean that the memory is accessible.) */
88 static inline int preram_symbols_available(void)
90 return !ENV_X86
|| ENV_ROMSTAGE_OR_BEFORE
;
93 #endif /* __SYMBOLS_H */