Documentation: Fix sphinx configuration
[coreboot.git] / src / include / symbols.h
blobf84672ed2299ec51bf019d25bdbc30afb5911289
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #ifndef __SYMBOLS_H
4 #define __SYMBOLS_H
6 #include <types.h>
8 extern u8 _dram[];
10 #define REGION_SIZE(name) (_e##name - _##name)
12 #define DECLARE_REGION(name) \
13 extern u8 _##name[]; \
14 extern u8 _e##name[];
16 DECLARE_REGION(sram)
17 DECLARE_REGION(timestamp)
18 DECLARE_REGION(preram_cbmem_console)
19 DECLARE_REGION(cbmem_init_hooks)
20 DECLARE_REGION(stack)
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)
44 DECLARE_REGION(ttb)
45 DECLARE_REGION(ttb_subtables)
46 DECLARE_REGION(dma_coherent)
47 DECLARE_REGION(soc_registers)
48 DECLARE_REGION(framebuffer)
49 DECLARE_REGION(pdpt)
50 DECLARE_REGION(opensbi)
51 DECLARE_REGION(bl31)
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 */