soc/intel/skylake: Correct address of I2C5 Device
[coreboot.git] / src / include / memlayout.h
blob43a1caca75cd1b2d3347e037f0160cd52c778abe
1 /*
2 * This file is part of the coreboot project.
4 * Copyright 2014 Google Inc.
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.
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.
16 /* This file contains macro definitions for memlayout.ld linker scripts. */
18 #ifndef __MEMLAYOUT_H
19 #define __MEMLAYOUT_H
21 #include <rules.h>
22 #include <arch/memlayout.h>
24 /* Macros that the architecture can override. */
25 #ifndef ARCH_POINTER_ALIGN_SIZE
26 #define ARCH_POINTER_ALIGN_SIZE 8
27 #endif
29 #ifndef ARCH_CACHELINE_ALIGN_SIZE
30 #define ARCH_CACHELINE_ALIGN_SIZE 64
31 #endif
33 /* Default to data as well as bss. */
34 #ifndef ARCH_STAGE_HAS_DATA_SECTION
35 #define ARCH_STAGE_HAS_DATA_SECTION 1
36 #endif
38 #ifndef ARCH_STAGE_HAS_BSS_SECTION
39 #define ARCH_STAGE_HAS_BSS_SECTION 1
40 #endif
42 /* Default is that currently ramstage, smm, and rmodules have a heap. */
43 #ifndef ARCH_STAGE_HAS_HEAP_SECTION
44 #define ARCH_STAGE_HAS_HEAP_SECTION (ENV_RAMSTAGE || ENV_SMM || ENV_RMODULE)
45 #endif
47 #define STR(x) #x
49 #define ALIGN_COUNTER(align) \
50 . = ALIGN(align);
52 #define SET_COUNTER(name, addr) \
53 _ = ASSERT(. <= addr, STR(name overlaps the previous region!)); \
54 . = addr;
56 #define SYMBOL(name, addr) \
57 SET_COUNTER(name, addr) \
58 _##name = .;
60 #define REGION(name, addr, size, expected_align) \
61 SYMBOL(name, addr) \
62 _ = ASSERT(. == ALIGN(expected_align), \
63 STR(name must be aligned to expected_align!)); \
64 SYMBOL(e##name, addr + size)
66 #define ALIAS_REGION(name, alias) \
67 _##alias = _##name; \
68 _e##alias = _e##name;
70 /* Declare according to SRAM/DRAM ranges in SoC hardware-defined address map. */
71 #define SRAM_START(addr) SYMBOL(sram, addr)
73 #define SRAM_END(addr) SYMBOL(esram, addr)
75 #define DRAM_START(addr) SYMBOL(dram, addr)
77 #define TIMESTAMP(addr, size) \
78 REGION(timestamp, addr, size, 8)
80 #define PRERAM_CBMEM_CONSOLE(addr, size) \
81 REGION(preram_cbmem_console, addr, size, 4)
83 /* Use either CBFS_CACHE (unified) or both (PRERAM|POSTRAM)_CBFS_CACHE */
84 #define CBFS_CACHE(addr, size) \
85 REGION(cbfs_cache, addr, size, 4) \
86 ALIAS_REGION(cbfs_cache, preram_cbfs_cache) \
87 ALIAS_REGION(cbfs_cache, postram_cbfs_cache)
89 #if defined(__PRE_RAM__)
90 #define PRERAM_CBFS_CACHE(addr, size) \
91 REGION(preram_cbfs_cache, addr, size, 4) \
92 ALIAS_REGION(preram_cbfs_cache, cbfs_cache)
93 #define POSTRAM_CBFS_CACHE(addr, size) \
94 REGION(postram_cbfs_cache, addr, size, 4)
95 #else
96 #define PRERAM_CBFS_CACHE(addr, size) \
97 REGION(preram_cbfs_cache, addr, size, 4)
98 #define POSTRAM_CBFS_CACHE(addr, size) \
99 REGION(postram_cbfs_cache, addr, size, 4) \
100 ALIAS_REGION(postram_cbfs_cache, cbfs_cache)
101 #endif
103 /* Careful: 'INCLUDE <filename>' must always be at the end of the output line */
104 #if ENV_BOOTBLOCK
105 #define BOOTBLOCK(addr, sz) \
106 SYMBOL(bootblock, addr) \
107 _ebootblock = _bootblock + sz; \
108 _ = ASSERT(_eprogram - _program <= sz, \
109 STR(Bootblock exceeded its allotted size! (sz))); \
110 INCLUDE "bootblock/lib/program.ld"
111 #else
112 #define BOOTBLOCK(addr, sz) \
113 REGION(bootblock, addr, sz, 1)
114 #endif
116 #if ENV_ROMSTAGE
117 #define ROMSTAGE(addr, sz) \
118 SYMBOL(romstage, addr) \
119 _eromstage = _romstage + sz; \
120 _ = ASSERT(_eprogram - _program <= sz, \
121 STR(Romstage exceeded its allotted size! (sz))); \
122 INCLUDE "romstage/lib/program.ld"
123 #else
124 #define ROMSTAGE(addr, sz) \
125 REGION(romstage, addr, sz, 1)
126 #endif
128 #if ENV_RAMSTAGE
129 #define RAMSTAGE(addr, sz) \
130 SYMBOL(ramstage, addr) \
131 _eramstage = _ramstage + sz; \
132 _ = ASSERT(_eprogram - _program <= sz, \
133 STR(Ramstage exceeded its allotted size! (sz))); \
134 INCLUDE "ramstage/lib/program.ld"
135 #else
136 #define RAMSTAGE(addr, sz) \
137 REGION(ramstage, addr, sz, 1)
138 #endif
140 /* Careful: required work buffer size depends on RW properties such as key size
141 * and algorithm -- what works for you might stop working after an update. Do
142 * NOT lower the asserted minimum without consulting vboot devs (rspangler)! */
143 #define VBOOT2_WORK(addr, size) \
144 REGION(vboot2_work, addr, size, 16) \
145 _ = ASSERT(size >= 12K, "vboot2 work buffer must be at least 12K!");
147 #if ENV_VERSTAGE
148 #define VERSTAGE(addr, sz) \
149 SYMBOL(verstage, addr) \
150 _everstage = _verstage + sz; \
151 _ = ASSERT(_eprogram - _program <= sz, \
152 STR(Verstage exceeded its allotted size! (sz))); \
153 INCLUDE "verstage/lib/program.ld"
155 #define OVERLAP_VERSTAGE_ROMSTAGE(addr, size) VERSTAGE(addr, size)
156 #else
157 #define VERSTAGE(addr, sz) \
158 REGION(verstage, addr, sz, 1)
160 #define OVERLAP_VERSTAGE_ROMSTAGE(addr, size) ROMSTAGE(addr, size)
161 #endif
163 #if ENV_POSTCAR
164 #define POSTCAR(addr, sz) \
165 SYMBOL(postcar, addr) \
166 _epostcar = _postcar + sz; \
167 _ = ASSERT(_eprogram - _program <= sz, \
168 STR(Aftercar exceeded its allotted size! (sz))); \
169 INCLUDE "postcar/lib/program.ld"
170 #else
171 #define POSTCAR(addr, sz) \
172 REGION(postcar, addr, sz, 1)
173 #endif
175 #define WATCHDOG_TOMBSTONE(addr, size) \
176 REGION(watchdog_tombstone, addr, size, 4) \
177 _ = ASSERT(size == 4, "watchdog tombstones should be exactly 4 byte!");
179 #endif /* __MEMLAYOUT_H */