summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2015-09-03 22:49:36 -0500
committerAaron Durbin <adurbin@chromium.org>2015-09-09 19:34:37 +0000
commit4de29d48edb2c760332def9004989d6cdf002f02 (patch)
tree9cae98f1752ff5f5d843eb5deeb61d51b9c7a177 /src/include
parent4b34909d099e395161b90c5528382450dc9937fc (diff)
linking: lay the groundwork for a unified linking approach
Though coreboot started as x86 only, the current approach to x86 linking is out of the norm with respect to other architectures. To start alleviating that the way ramstage is linked is partially unified. A new file, program.ld, was added to provide a common way to link stages by deferring to per-stage architectural overrides. The previous ramstage.ld is no longer required. Note that this change doesn't handle RELOCATABLE_RAMSTAGE because that is handled by rmodule.ld. Future convergence can be achieved, but for the time being that's being left out. BUG=chrome-os-partner:44827 BRANCH=None TEST=Built a myriad of boards. Change-Id: I5d689bfa7e0e9aff3a148178515ef241b5f70661 Signed-off-by: Aaron Durbin <adubin@chromium.org> Reviewed-on: http://review.coreboot.org/11507 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <pgeorgi@google.com> Tested-by: Raptor Engineering Automated Test Stand <noreply@raptorengineeringinc.com> Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/memlayout.h35
-rw-r--r--src/include/symbols.h15
2 files changed, 32 insertions, 18 deletions
diff --git a/src/include/memlayout.h b/src/include/memlayout.h
index a5296286b2..f0ee3d3f77 100644
--- a/src/include/memlayout.h
+++ b/src/include/memlayout.h
@@ -22,10 +22,37 @@
#ifndef __MEMLAYOUT_H
#define __MEMLAYOUT_H
+#include <rules.h>
#include <arch/memlayout.h>
+/* Macros that the architecture can override. */
+#ifndef ARCH_POINTER_ALIGN_SIZE
+#define ARCH_POINTER_ALIGN_SIZE 8
+#endif
+
+#ifndef ARCH_CACHELINE_ALIGN_SIZE
+#define ARCH_CACHELINE_ALIGN_SIZE 64
+#endif
+
+/* Default to data as well as bss. */
+#ifndef ARCH_STAGE_HAS_DATA_SECTION
+#define ARCH_STAGE_HAS_DATA_SECTION 1
+#endif
+
+#ifndef ARCH_STAGE_HAS_BSS_SECTION
+#define ARCH_STAGE_HAS_BSS_SECTION 1
+#endif
+
+/* Default is that currently ramstage and smm only has a heap. */
+#ifndef ARCH_STAGE_HAS_HEAP_SECTION
+#define ARCH_STAGE_HAS_HEAP_SECTION (ENV_RAMSTAGE || ENV_SMM)
+#endif
+
#define STR(x) #x
+#define ALIGN_COUNTER(align) \
+ . = ALIGN(align);
+
#define SET_COUNTER(name, addr) \
_ = ASSERT(. <= addr, STR(name overlaps the previous region!)); \
. = addr;
@@ -58,7 +85,7 @@
/* TODO: This only works if you never access CBFS in romstage before RAM is up!
* If you need to change that assumption, you have some work ahead of you... */
-#if defined(__PRE_RAM__) && !defined(__ROMSTAGE__)
+#if defined(__PRE_RAM__) && !ENV_ROMSTAGE
#define PRERAM_CBFS_CACHE(addr, size) CBFS_CACHE(addr, size)
#define POSTRAM_CBFS_CACHE(addr, size) \
REGION(unused_cbfs_cache, addr, size, 4)
@@ -93,12 +120,12 @@
. += sz;
#endif
-#ifdef __RAMSTAGE__
+#if ENV_RAMSTAGE
#define RAMSTAGE(addr, sz) \
SET_COUNTER(ramstage, addr) \
- _ = ASSERT(_eramstage - _ramstage <= sz, \
+ _ = ASSERT(_eprogram - _program <= sz, \
STR(Ramstage exceeded its allotted size! (sz))); \
- INCLUDE "lib/ramstage.ramstage.ld"
+ INCLUDE "lib/program.ramstage.ld"
#else
#define RAMSTAGE(addr, sz) \
SET_COUNTER(ramstage, addr) \
diff --git a/src/include/symbols.h b/src/include/symbols.h
index 3fbf819902..22cd575034 100644
--- a/src/include/symbols.h
+++ b/src/include/symbols.h
@@ -53,20 +53,7 @@ extern u8 _payload[];
extern u8 _epayload[];
#define _payload_size (_epayload - _payload)
-/* Careful: _e<stage> and _<stage>_size only defined for the current stage! */
-extern u8 _bootblock[];
-extern u8 _ebootblock[];
-#define _bootblock_size (_ebootblock - _bootblock)
-
-extern u8 _romstage[];
-extern u8 _eromstage[];
-#define _romstage_size (_eromstage - _romstage)
-
-extern u8 _ramstage[];
-extern u8 _eramstage[];
-#define _ramstage_size (_eramstage - _ramstage)
-
-/* "program" always refers to the current execution unit, except for x86 ROM. */
+/* "program" always refers to the current execution unit. */
extern u8 _program[];
extern u8 _eprogram[];
#define _program_size (_eprogram - _program)