[coreboot-gerrit] New patch to review for coreboot: 4d18ef6 build rules: Identify build stage with simple variables
Kyösti Mälkki (kyosti.malkki@gmail.com)
gerrit at coreboot.org
Thu Mar 27 15:04:28 CET 2014
Kyösti Mälkki (kyosti.malkki at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/5410
-gerrit
commit 4d18ef6f5d2a3a92f9efb579d193c061cd7313f0
Author: Kyösti Mälkki <kyosti.malkki at gmail.com>
Date: Wed Feb 26 15:19:04 2014 +0200
build rules: Identify build stage with simple variables
Provide simple environment variables telling which stage of boot is
being built.
Change-Id: I8cbb5cf91f53e01c06e7d672b5be3f5c235f911d
Signed-off-by: Kyösti Mälkki <kyosti.malkki at gmail.com>
---
src/arch/armv7/include/arch/rules.h | 25 +++++++++++++++++++++++++
src/arch/x86/Makefile.inc | 4 ++--
src/arch/x86/include/arch/rules.h | 28 ++++++++++++++++++++++++++++
3 files changed, 55 insertions(+), 2 deletions(-)
diff --git a/src/arch/armv7/include/arch/rules.h b/src/arch/armv7/include/arch/rules.h
index a790365..f9d0ad5 100644
--- a/src/arch/armv7/include/arch/rules.h
+++ b/src/arch/armv7/include/arch/rules.h
@@ -31,4 +31,29 @@
#define __SIMPLE_DEVICE__
#endif
+/* Useful helpers to tell whether the code is executing in bootblock,
+ * romstage, ramstage or SMM.
+ */
+
+#if defined(__BOOT_BLOCK__)
+#define ENV_BOOTBLOCK 1
+#else
+#define ENV_BOOTBLOCK 0
+#endif
+
+#if defined(__PRE_RAM__) && !defined(__BOOT_BLOCK__)
+#define ENV_ROMSTAGE 1
+#else
+#define ENV_ROMSTAGE 0
+#endif
+
+#if !defined(__PRE_RAM__)
+#define ENV_RAMSTAGE 1
+#else
+#define ENV_RAMSTAGE 0
+#endif
+
+/* SMM not implemented. */
+#define ENV_SMM 0
+
#endif /* _ARCH_RULES_H */
diff --git a/src/arch/x86/Makefile.inc b/src/arch/x86/Makefile.inc
index acb4e98..cdd1b8e 100644
--- a/src/arch/x86/Makefile.inc
+++ b/src/arch/x86/Makefile.inc
@@ -366,9 +366,9 @@ endif
bootblock_inc += $(objgenerated)/bootblock.inc
bootblock_inc += $(src)/arch/x86/lib/walkcbfs.S
-bootblock_romccflags := -mcpu=i386 -O2 -D__PRE_RAM__
+bootblock_romccflags := -mcpu=i386 -O2 -D__PRE_RAM__ -D__BOOT_BLOCK__
ifeq ($(CONFIG_SSE),y)
-bootblock_romccflags := -mcpu=k7 -msse -O2 -D__PRE_RAM__
+bootblock_romccflags := -mcpu=k7 -msse -O2 -D__PRE_RAM__ -D__BOOT_BLOCK__
endif
$(objgenerated)/bootblock.ld: $$(bootblock_lds) $(obj)/ldoptions
diff --git a/src/arch/x86/include/arch/rules.h b/src/arch/x86/include/arch/rules.h
index 4b84677..8860705 100644
--- a/src/arch/x86/include/arch/rules.h
+++ b/src/arch/x86/include/arch/rules.h
@@ -31,4 +31,32 @@
#define __SIMPLE_DEVICE__
#endif
+/* Useful helpers to tell whether the code is executing in bootblock,
+ * romstage, ramstage or SMM.
+ */
+
+#if defined(__BOOT_BLOCK__)
+#define ENV_BOOTBLOCK 1
+#else
+#define ENV_BOOTBLOCK 0
+#endif
+
+#if defined(__PRE_RAM__) && !defined(__BOOT_BLOCK__)
+#define ENV_ROMSTAGE 1
+#else
+#define ENV_ROMSTAGE 0
+#endif
+
+#if !defined(__PRE_RAM__) && !defined(__SMM__)
+#define ENV_RAMSTAGE 1
+#else
+#define ENV_RAMSTAGE 0
+#endif
+
+#if defined(__SMM__)
+#define ENV_SMM 1
+#else
+#define ENV_SMM 0
+#endif
+
#endif /* _ARCH_RULES_H */
More information about the coreboot-gerrit
mailing list