1 /* SPDX-License-Identifier: GPL-2.0-only */
10 #define REGION_SIZE(name) (_e##name - _##name)
12 #define DECLARE_REGION(name) \
13 extern u8 _##name[]; \
17 DECLARE_REGION(timestamp
)
18 DECLARE_REGION(preram_cbmem_console
)
19 DECLARE_REGION(cbmem_init_hooks
)
21 DECLARE_REGION(preram_cbfs_cache
)
22 DECLARE_REGION(postram_cbfs_cache
)
23 DECLARE_REGION(cbfs_cache
)
24 DECLARE_REGION(fmap_cache
)
25 DECLARE_REGION(tpm_tcpa_log
)
27 /* Regions for execution units. */
29 DECLARE_REGION(payload
)
30 /* "program" always refers to the current execution unit. */
31 DECLARE_REGION(program
)
32 /* _<stage>_size is always the maximum amount allocated in memlayout, whereas
33 _program_size gives the actual memory footprint *used* by current stage. */
34 DECLARE_REGION(decompressor
)
35 DECLARE_REGION(bootblock
)
36 DECLARE_REGION(verstage
)
37 DECLARE_REGION(romstage
)
38 DECLARE_REGION(postcar
)
39 DECLARE_REGION(ramstage
)
41 /* Arch-specific, move to <arch/symbols.h> if they become too many. */
43 DECLARE_REGION(pagetables
)
45 DECLARE_REGION(ttb_subtables
)
46 DECLARE_REGION(dma_coherent
)
47 DECLARE_REGION(soc_registers
)
48 DECLARE_REGION(framebuffer
)
50 DECLARE_REGION(opensbi
)
54 * Put this into a .c file accessing a linker script region to mark that region
55 * as "optional". If it is defined in memlayout.ld (or anywhere else), the
56 * values from that definition will be used. If not, start, end and size will
57 * all evaluate to 0. (We can't explicitly assign the symbols to 0 in the
58 * assembly due to https://sourceware.org/bugzilla/show_bug.cgi?id=1038.)
60 #define DECLARE_OPTIONAL_REGION(name) asm (".weak _" #name ", _e" #name)
62 /* Returns true when pre-RAM symbols are known to the linker.
63 * (Does not necessarily mean that the memory is accessible.) */
64 static inline int preram_symbols_available(void)
66 return !ENV_X86
|| ENV_ROMSTAGE_OR_BEFORE
;
69 #endif /* __SYMBOLS_H */