Julius Werner | ec5e5e0 | 2014-08-20 15:29:56 -0700 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright 2014 Google Inc. |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; version 2 of the License. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
Julius Werner | ec5e5e0 | 2014-08-20 15:29:56 -0700 | [diff] [blame] | 14 | */ |
| 15 | |
| 16 | #ifndef __SYMBOLS_H |
| 17 | #define __SYMBOLS_H |
| 18 | |
| 19 | #include <types.h> |
| 20 | |
| 21 | extern u8 _sram[]; |
| 22 | extern u8 _esram[]; |
| 23 | #define _sram_size (_esram - _sram) |
| 24 | |
| 25 | extern u8 _dram[]; |
| 26 | |
Aaron Durbin | 1936f6c | 2015-07-03 17:04:21 -0500 | [diff] [blame] | 27 | extern u8 _timestamp[]; |
| 28 | extern u8 _etimestamp[]; |
| 29 | #define _timestamp_size (_etimestamp - _timestamp) |
| 30 | |
Julius Werner | ec5e5e0 | 2014-08-20 15:29:56 -0700 | [diff] [blame] | 31 | extern u8 _preram_cbmem_console[]; |
| 32 | extern u8 _epreram_cbmem_console[]; |
| 33 | #define _preram_cbmem_console_size \ |
| 34 | (_epreram_cbmem_console - _preram_cbmem_console) |
| 35 | |
Kyösti Mälkki | 4fbac46 | 2015-01-07 04:48:43 +0200 | [diff] [blame] | 36 | extern u8 _cbmem_init_hooks[]; |
| 37 | extern u8 _ecbmem_init_hooks[]; |
| 38 | #define _cbmem_init_hooks_size (_ecbmem_init_hooks - _cbmem_init_hooks) |
| 39 | |
Julius Werner | ec5e5e0 | 2014-08-20 15:29:56 -0700 | [diff] [blame] | 40 | extern u8 _stack[]; |
| 41 | extern u8 _estack[]; |
| 42 | #define _stack_size (_estack - _stack) |
| 43 | |
Ronald G. Minnich | 5965cba | 2016-10-19 08:07:13 -0700 | [diff] [blame] | 44 | extern u8 _pagetables[]; |
| 45 | extern u8 _epagetables[]; |
| 46 | #define _pagetables_size (_epagetables - _pagetables) |
| 47 | |
Julius Werner | 757943c | 2015-12-16 16:07:39 -0800 | [diff] [blame] | 48 | extern u8 _preram_cbfs_cache[]; |
| 49 | extern u8 _epreram_cbfs_cache[]; |
| 50 | #define _preram_cbfs_cache_size (_epreram_cbfs_cache - _preram_cbfs_cache) |
| 51 | |
Mary Ruthven | a8aef3a | 2015-11-24 09:43:27 -0800 | [diff] [blame] | 52 | extern u8 _postram_cbfs_cache[]; |
| 53 | extern u8 _epostram_cbfs_cache[]; |
| 54 | #define _postram_cbfs_cache_size (_epostram_cbfs_cache - _postram_cbfs_cache) |
Mary Ruthven | f82e8ab | 2015-11-13 14:05:27 -0800 | [diff] [blame] | 55 | |
Julius Werner | ec5e5e0 | 2014-08-20 15:29:56 -0700 | [diff] [blame] | 56 | extern u8 _cbfs_cache[]; |
| 57 | extern u8 _ecbfs_cache[]; |
| 58 | #define _cbfs_cache_size (_ecbfs_cache - _cbfs_cache) |
| 59 | |
| 60 | extern u8 _payload[]; |
| 61 | extern u8 _epayload[]; |
| 62 | #define _payload_size (_epayload - _payload) |
| 63 | |
Aaron Durbin | 4de29d4 | 2015-09-03 22:49:36 -0500 | [diff] [blame] | 64 | /* "program" always refers to the current execution unit. */ |
Julius Werner | ec5e5e0 | 2014-08-20 15:29:56 -0700 | [diff] [blame] | 65 | extern u8 _program[]; |
| 66 | extern u8 _eprogram[]; |
| 67 | #define _program_size (_eprogram - _program) |
| 68 | |
Julius Werner | 862c385 | 2016-02-18 15:46:15 -0800 | [diff] [blame] | 69 | /* _<stage>_size is always the maximum amount allocated in memlayout, whereas |
| 70 | * _program_size gives the actual memory footprint *used* by current stage. */ |
Julius Werner | 99f4683 | 2018-05-16 14:14:04 -0700 | [diff] [blame] | 71 | extern u8 _decompressor[]; |
| 72 | extern u8 _edecompressor[]; |
| 73 | #define _decompressor_size (_edecompressor - _decompressor) |
| 74 | |
Julius Werner | 862c385 | 2016-02-18 15:46:15 -0800 | [diff] [blame] | 75 | extern u8 _bootblock[]; |
| 76 | extern u8 _ebootblock[]; |
| 77 | #define _bootblock_size (_ebootblock - _bootblock) |
| 78 | |
| 79 | extern u8 _romstage[]; |
| 80 | extern u8 _eromstage[]; |
| 81 | #define _romstage_size (_eromstage - _romstage) |
| 82 | |
| 83 | extern u8 _ramstage[]; |
| 84 | extern u8 _eramstage[]; |
| 85 | #define _ramstage_size (_eramstage - _ramstage) |
| 86 | |
| 87 | extern u8 _verstage[]; |
| 88 | extern u8 _everstage[]; |
| 89 | #define _verstage_size (_everstage - _verstage) |
| 90 | |
Julius Werner | ec5e5e0 | 2014-08-20 15:29:56 -0700 | [diff] [blame] | 91 | /* Arch-specific, move to <arch/symbols.h> if they become too many. */ |
| 92 | |
| 93 | extern u8 _ttb[]; |
| 94 | extern u8 _ettb[]; |
| 95 | #define _ttb_size (_ettb - _ttb) |
| 96 | |
Julius Werner | 108548a | 2014-10-09 17:31:45 -0700 | [diff] [blame] | 97 | extern u8 _ttb_subtables[]; |
| 98 | extern u8 _ettb_subtables[]; |
| 99 | #define _ttb_subtables_size (_ettb_subtables - _ttb_subtables) |
| 100 | |
Julius Werner | ec5e5e0 | 2014-08-20 15:29:56 -0700 | [diff] [blame] | 101 | extern u8 _dma_coherent[]; |
| 102 | extern u8 _edma_coherent[]; |
| 103 | #define _dma_coherent_size (_edma_coherent - _dma_coherent) |
| 104 | |
Ionela Voinescu | 7100cf2 | 2015-07-24 14:29:06 +0100 | [diff] [blame] | 105 | extern u8 _soc_registers[]; |
| 106 | extern u8 _esoc_registers[]; |
| 107 | #define _soc_registers_size (_esoc_registers - _soc_registers) |
| 108 | |
Julius Werner | 249f9cc | 2015-01-14 14:53:59 -0800 | [diff] [blame] | 109 | extern u8 _framebuffer[]; |
| 110 | extern u8 _eframebuffer[]; |
| 111 | #define _framebuffer_size (_eframebuffer - _framebuffer) |
| 112 | |
Aaron Durbin | 0f35af8f | 2018-04-18 01:00:27 -0600 | [diff] [blame] | 113 | extern u8 _pdpt[]; |
| 114 | extern u8 _epdpt[]; |
| 115 | #define _pdpt_size (_epdpt - _pdpt) |
| 116 | |
Ting Shen | dff29e0 | 2019-01-28 18:15:00 +0800 | [diff] [blame] | 117 | extern u8 _bl31[]; |
| 118 | extern u8 _ebl31[]; |
| 119 | #define _bl31_size (_ebl31 - _bl31) |
| 120 | |
Julius Werner | 8c09377 | 2016-02-09 16:09:15 -0800 | [diff] [blame] | 121 | /* Put this into a .c file accessing a linker script region to mark that region |
| 122 | * as "optional". If it is defined in memlayout.ld (or anywhere else), the |
| 123 | * values from that definition will be used. If not, start, end and size will |
| 124 | * all evaluate to 0. (We can't explicitly assign the symbols to 0 in the |
| 125 | * assembly due to https://sourceware.org/bugzilla/show_bug.cgi?id=1038.) */ |
Lee Leahy | 91d1e76 | 2017-03-07 14:31:19 -0800 | [diff] [blame] | 126 | #define DECLARE_OPTIONAL_REGION(name) asm (".weak _" #name ", _e" #name) |
Julius Werner | 8c09377 | 2016-02-09 16:09:15 -0800 | [diff] [blame] | 127 | |
Julius Werner | ec5e5e0 | 2014-08-20 15:29:56 -0700 | [diff] [blame] | 128 | #endif /* __SYMBOLS_H */ |