coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
symbols.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #ifndef __SYMBOLS_H
4 #define __SYMBOLS_H
5 
6 #include <types.h>
7 
8 extern u8 _dram[];
9 
10 #define REGION_SIZE(name) ((size_t)_##name##_size)
11 
12 #define DECLARE_REGION(name) \
13  extern u8 _##name[]; \
14  extern u8 _e##name[]; \
15  extern u8 _##name##_size[];
16 
17 /*
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.
24  */
25 #define DECLARE_OPTIONAL_REGION(name) \
26  __weak extern u8 _##name[]; \
27  __weak extern u8 _e##name[]; \
28  __weak extern u8 _##name##_size[];
29 
30 DECLARE_REGION(sram)
31 DECLARE_OPTIONAL_REGION(timestamp)
32 DECLARE_REGION(preram_cbmem_console)
33 DECLARE_REGION(cbmem_init_hooks)
34 DECLARE_REGION(stack)
35 DECLARE_OPTIONAL_REGION(preram_cbfs_cache)
36 DECLARE_OPTIONAL_REGION(postram_cbfs_cache)
38 DECLARE_REGION(cbfs_mcache)
40 DECLARE_REGION(tpm_tcpa_log)
41 
42 #if ENV_ROMSTAGE && CONFIG(ASAN_IN_ROMSTAGE)
43 DECLARE_REGION(bss)
44 DECLARE_REGION(asan_shadow)
45 #endif
46 
47 #if ENV_RAMSTAGE && CONFIG(ASAN_IN_RAMSTAGE)
48 DECLARE_REGION(data)
49 DECLARE_REGION(heap)
50 DECLARE_REGION(asan_shadow)
51 #endif
52 
53 /* Regions for execution units. */
54 
55 DECLARE_REGION(payload)
56 /* "program" always refers to the current execution unit. */
57 DECLARE_REGION(program)
58 /* _<stage>_size is always the maximum amount allocated in memlayout, whereas
59  _program_size gives the actual memory footprint *used* by current stage. */
60 DECLARE_REGION(decompressor)
61 DECLARE_REGION(bootblock)
62 DECLARE_REGION(verstage)
64 DECLARE_REGION(postcar)
65 DECLARE_REGION(ramstage)
66 
67 /* Arch-specific, move to <arch/symbols.h> if they become too many. */
68 
69 DECLARE_REGION(pagetables)
70 DECLARE_REGION(ttb)
71 DECLARE_OPTIONAL_REGION(ttb_subtables)
73 DECLARE_REGION(soc_registers)
74 DECLARE_REGION(framebuffer)
75 DECLARE_REGION(pdpt)
78 DECLARE_REGION(transfer_buffer)
79 DECLARE_OPTIONAL_REGION(watchdog_tombstone)
80 
81 /* Returns true when pre-RAM symbols are known to the linker.
82  * (Does not necessarily mean that the memory is accessible.) */
83 static inline int preram_symbols_available(void)
84 {
86 }
87 
88 #endif /* __SYMBOLS_H */
struct mem_pool cbfs_cache
Definition: cbfs.c:26
int dma_coherent(void *ptr)
static struct region_device fmap_cache
Definition: fmap.c:20
u8 _dram[]
#define DECLARE_OPTIONAL_REGION(name)
Definition: symbols.h:25
static int preram_symbols_available(void)
Definition: symbols.h:83
#define DECLARE_REGION(name)
Definition: symbols.h:12
static void romstage(void)
Definition: romstage.c:24
#define ENV_X86
Definition: rules.h:248
#define ENV_ROMSTAGE_OR_BEFORE
Definition: rules.h:263
uint8_t u8
Definition: stdint.h:45