summaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
authorArthur Heymans <arthur@aheymans.xyz>2021-05-29 08:10:49 +0200
committerFelix Held <felix-coreboot@felixheld.de>2023-11-09 13:20:18 +0000
commita2bc2540c2d004b475b401ccf0b162c2452857bb (patch)
tree902284670b43d9e06d7dccc64dbeec24073fca4e /src/include
parent4ce52f622ed7fbac4bf5545fd7d39256203cdefe (diff)
downloadcoreboot-a2bc2540c2d004b475b401ccf0b162c2452857bb.tar.gz
coreboot-a2bc2540c2d004b475b401ccf0b162c2452857bb.tar.bz2
coreboot-a2bc2540c2d004b475b401ccf0b162c2452857bb.zip
Allow to build romstage sources inside the bootblock
Having a separate romstage is only desirable: - with advanced setups like vboot or normal/fallback - boot medium is slow at startup (some ARM SOCs) - bootblock is limited in size (Intel APL 32K) When this is not the case there is no need for the extra complexity that romstage brings. Including the romstage sources inside the bootblock substantially reduces the total code footprint. Often the resulting code is 10-20k smaller. This is controlled via a Kconfig option. TESTED: works on qemu x86, arm and aarch64 with and without VBOOT. Change-Id: Id68390edc1ba228b121cca89b80c64a92553e284 Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/c/coreboot/+/55068 Reviewed-by: Julius Werner <jwerner@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/console/cbmem_console.h2
-rw-r--r--src/include/console/console.h2
-rw-r--r--src/include/console/qemu_debugcon.h2
-rw-r--r--src/include/console/system76_ec.h2
-rw-r--r--src/include/console/uart.h2
-rw-r--r--src/include/console/usb.h2
-rw-r--r--src/include/memlayout.h2
-rw-r--r--src/include/rules.h32
-rw-r--r--src/include/symbols.h2
-rw-r--r--src/include/timestamp.h2
10 files changed, 25 insertions, 25 deletions
diff --git a/src/include/console/cbmem_console.h b/src/include/console/cbmem_console.h
index 9a814b9a54fd..84a95dd593fc 100644
--- a/src/include/console/cbmem_console.h
+++ b/src/include/console/cbmem_console.h
@@ -10,7 +10,7 @@ void cbmemc_tx_byte(unsigned char data);
#define __CBMEM_CONSOLE_ENABLE__ (CONFIG(CONSOLE_CBMEM) && \
(ENV_RAMSTAGE || ENV_SEPARATE_VERSTAGE || ENV_POSTCAR || \
- ENV_ROMSTAGE || (ENV_BOOTBLOCK && CONFIG(BOOTBLOCK_CONSOLE)) || \
+ ENV_SEPARATE_ROMSTAGE || (ENV_BOOTBLOCK && CONFIG(BOOTBLOCK_CONSOLE)) || \
(ENV_SMM && CONFIG(DEBUG_SMI))))
#if __CBMEM_CONSOLE_ENABLE__
diff --git a/src/include/console/console.h b/src/include/console/console.h
index fb257ba16c3e..7e9a439c0739 100644
--- a/src/include/console/console.h
+++ b/src/include/console/console.h
@@ -44,7 +44,7 @@ static inline int get_console_loglevel(void)
#define __CONSOLE_ENABLE__ \
((ENV_BOOTBLOCK && CONFIG(BOOTBLOCK_CONSOLE)) || \
(ENV_POSTCAR && CONFIG(POSTCAR_CONSOLE)) || \
- ENV_SEPARATE_VERSTAGE || ENV_ROMSTAGE || ENV_RAMSTAGE || \
+ ENV_SEPARATE_VERSTAGE || ENV_SEPARATE_ROMSTAGE || ENV_RAMSTAGE || \
ENV_LIBAGESA || (ENV_SMM && CONFIG(DEBUG_SMI)))
#if __CONSOLE_ENABLE__
diff --git a/src/include/console/qemu_debugcon.h b/src/include/console/qemu_debugcon.h
index 155bfdaf2977..ed1d8e083670 100644
--- a/src/include/console/qemu_debugcon.h
+++ b/src/include/console/qemu_debugcon.h
@@ -9,7 +9,7 @@ void qemu_debugcon_init(void);
void qemu_debugcon_tx_byte(unsigned char data);
#if CONFIG(CONSOLE_QEMU_DEBUGCON) && \
- (ENV_ROMSTAGE || ENV_RAMSTAGE || ENV_POSTCAR || ENV_BOOTBLOCK)
+ (ENV_SEPARATE_ROMSTAGE || ENV_RAMSTAGE || ENV_POSTCAR || ENV_BOOTBLOCK)
static inline void __qemu_debugcon_init(void) { qemu_debugcon_init(); }
static inline void __qemu_debugcon_tx_byte(u8 data)
{
diff --git a/src/include/console/system76_ec.h b/src/include/console/system76_ec.h
index 2aa265a1ff82..6e9311a4b828 100644
--- a/src/include/console/system76_ec.h
+++ b/src/include/console/system76_ec.h
@@ -11,7 +11,7 @@ void system76_ec_flush(void);
void system76_ec_print(uint8_t byte);
#define __CONSOLE_SYSTEM76_EC_ENABLE__ (CONFIG(CONSOLE_SYSTEM76_EC) && \
- (ENV_BOOTBLOCK || ENV_ROMSTAGE || ENV_RAMSTAGE \
+ (ENV_BOOTBLOCK || ENV_SEPARATE_ROMSTAGE || ENV_RAMSTAGE \
|| ENV_SEPARATE_VERSTAGE || ENV_POSTCAR \
|| (ENV_SMM && CONFIG(DEBUG_SMI))))
diff --git a/src/include/console/uart.h b/src/include/console/uart.h
index ca03ecb77dbb..3f9e5b01da0c 100644
--- a/src/include/console/uart.h
+++ b/src/include/console/uart.h
@@ -62,7 +62,7 @@ static inline void *uart_platform_baseptr(unsigned int idx)
void oxford_remap(unsigned int new_base);
#define __CONSOLE_SERIAL_ENABLE__ (CONFIG(CONSOLE_SERIAL) && \
- (ENV_BOOTBLOCK || ENV_ROMSTAGE || ENV_RAMSTAGE || ENV_SEPARATE_VERSTAGE \
+ (ENV_BOOTBLOCK || ENV_SEPARATE_ROMSTAGE || ENV_RAMSTAGE || ENV_SEPARATE_VERSTAGE \
|| ENV_POSTCAR || (ENV_SMM && CONFIG(DEBUG_SMI))))
#if __CONSOLE_SERIAL_ENABLE__
diff --git a/src/include/console/usb.h b/src/include/console/usb.h
index 30591c2329df..fa8d511d35d9 100644
--- a/src/include/console/usb.h
+++ b/src/include/console/usb.h
@@ -15,7 +15,7 @@ int usb_can_rx_byte(int idx);
#define __CONSOLE_USB_ENABLE__ (CONFIG(CONSOLE_USB) && \
((ENV_BOOTBLOCK && CONFIG(USBDEBUG_IN_PRE_RAM)) || \
- (ENV_ROMSTAGE && CONFIG(USBDEBUG_IN_PRE_RAM)) || \
+ (ENV_SEPARATE_ROMSTAGE && CONFIG(USBDEBUG_IN_PRE_RAM)) || \
(ENV_POSTCAR && CONFIG(USBDEBUG_IN_PRE_RAM)) || \
(ENV_SEPARATE_VERSTAGE && CONFIG(USBDEBUG_IN_PRE_RAM)) || \
ENV_RAMSTAGE))
diff --git a/src/include/memlayout.h b/src/include/memlayout.h
index 0d84ec1481ca..6280b200ebaa 100644
--- a/src/include/memlayout.h
+++ b/src/include/memlayout.h
@@ -134,7 +134,7 @@
REGION(bootblock, addr, sz, 1)
#endif
-#if ENV_ROMSTAGE
+#if ENV_SEPARATE_ROMSTAGE
#define ROMSTAGE(addr, sz) \
SYMBOL(romstage, addr) \
_eromstage = ABSOLUTE(_romstage + sz); \
diff --git a/src/include/rules.h b/src/include/rules.h
index b30b21d3331d..7d32c779d6fc 100644
--- a/src/include/rules.h
+++ b/src/include/rules.h
@@ -22,7 +22,7 @@
#if defined(__DECOMPRESSOR__)
#define ENV_DECOMPRESSOR 1
#define ENV_BOOTBLOCK 0
-#define ENV_ROMSTAGE 0
+#define ENV_SEPARATE_ROMSTAGE 0
#define ENV_RAMSTAGE 0
#define ENV_SMM 0
#define ENV_SEPARATE_VERSTAGE 0
@@ -34,7 +34,7 @@
#elif defined(__BOOTBLOCK__)
#define ENV_DECOMPRESSOR 0
#define ENV_BOOTBLOCK 1
-#define ENV_ROMSTAGE 0
+#define ENV_SEPARATE_ROMSTAGE 0
#define ENV_RAMSTAGE 0
#define ENV_SMM 0
#define ENV_SEPARATE_VERSTAGE 0
@@ -46,7 +46,7 @@
#elif defined(__ROMSTAGE__)
#define ENV_DECOMPRESSOR 0
#define ENV_BOOTBLOCK 0
-#define ENV_ROMSTAGE 1
+#define ENV_SEPARATE_ROMSTAGE 1
#define ENV_RAMSTAGE 0
#define ENV_SMM 0
#define ENV_SEPARATE_VERSTAGE 0
@@ -58,7 +58,7 @@
#elif defined(__SMM__)
#define ENV_DECOMPRESSOR 0
#define ENV_BOOTBLOCK 0
-#define ENV_ROMSTAGE 0
+#define ENV_SEPARATE_ROMSTAGE 0
#define ENV_RAMSTAGE 0
#define ENV_SMM 1
#define ENV_SEPARATE_VERSTAGE 0
@@ -72,13 +72,13 @@
* bootblock/romstage, depending on the setting of the VBOOT_SEPARATE_VERSTAGE
* kconfig option. The ENV_SEPARATE_VERSTAGE macro will only return true for
* "verstage" code when CONFIG(VBOOT_SEPARATE_VERSTAGE) is true, otherwise that
- * code will have ENV_BOOTBLOCK or ENV_ROMSTAGE set (depending on the
+ * code will have ENV_BOOTBLOCK or ENV_SEPARATE_ROMSTAGE set (depending on the
* "VBOOT_STARTS_IN_"... kconfig options).
*/
#elif defined(__VERSTAGE__)
#define ENV_DECOMPRESSOR 0
#define ENV_BOOTBLOCK 0
-#define ENV_ROMSTAGE 0
+#define ENV_SEPARATE_ROMSTAGE 0
#define ENV_RAMSTAGE 0
#define ENV_SMM 0
#define ENV_SEPARATE_VERSTAGE 1
@@ -94,7 +94,7 @@
#elif defined(__RAMSTAGE__)
#define ENV_DECOMPRESSOR 0
#define ENV_BOOTBLOCK 0
-#define ENV_ROMSTAGE 0
+#define ENV_SEPARATE_ROMSTAGE 0
#define ENV_RAMSTAGE 1
#define ENV_SMM 0
#define ENV_SEPARATE_VERSTAGE 0
@@ -106,7 +106,7 @@
#elif defined(__RMODULE__)
#define ENV_DECOMPRESSOR 0
#define ENV_BOOTBLOCK 0
-#define ENV_ROMSTAGE 0
+#define ENV_SEPARATE_ROMSTAGE 0
#define ENV_RAMSTAGE 0
#define ENV_SMM 0
#define ENV_SEPARATE_VERSTAGE 0
@@ -118,7 +118,7 @@
#elif defined(__POSTCAR__)
#define ENV_DECOMPRESSOR 0
#define ENV_BOOTBLOCK 0
-#define ENV_ROMSTAGE 0
+#define ENV_SEPARATE_ROMSTAGE 0
#define ENV_RAMSTAGE 0
#define ENV_SMM 0
#define ENV_SEPARATE_VERSTAGE 0
@@ -130,7 +130,7 @@
#elif defined(__LIBAGESA__)
#define ENV_DECOMPRESSOR 0
#define ENV_BOOTBLOCK 0
-#define ENV_ROMSTAGE 0
+#define ENV_SEPARATE_ROMSTAGE 0
#define ENV_RAMSTAGE 0
#define ENV_SMM 0
#define ENV_SEPARATE_VERSTAGE 0
@@ -146,7 +146,7 @@
*/
#define ENV_DECOMPRESSOR 0
#define ENV_BOOTBLOCK 0
-#define ENV_ROMSTAGE 0
+#define ENV_SEPARATE_ROMSTAGE 0
#define ENV_RAMSTAGE 0
#define ENV_SMM 0
#define ENV_SEPARATE_VERSTAGE 0
@@ -268,7 +268,7 @@
#endif
#define ENV_ROMSTAGE_OR_BEFORE \
- (ENV_DECOMPRESSOR || ENV_BOOTBLOCK || ENV_ROMSTAGE || \
+ (ENV_DECOMPRESSOR || ENV_BOOTBLOCK || ENV_SEPARATE_ROMSTAGE || \
(ENV_SEPARATE_VERSTAGE && !CONFIG(VBOOT_STARTS_IN_ROMSTAGE)))
#if ENV_X86
@@ -299,9 +299,9 @@
#define ENV_INITIAL_STAGE ENV_BOOTBLOCK
#endif
-#define ENV_CREATES_CBMEM ENV_ROMSTAGE
-#define ENV_HAS_CBMEM (ENV_ROMSTAGE | ENV_POSTCAR | ENV_RAMSTAGE)
-#define ENV_RAMINIT ENV_ROMSTAGE
+#define ENV_CREATES_CBMEM (ENV_SEPARATE_ROMSTAGE || (ENV_BOOTBLOCK && !CONFIG(SEPARATE_ROMSTAGE)))
+#define ENV_HAS_CBMEM (ENV_CREATES_CBMEM || ENV_POSTCAR || ENV_RAMSTAGE)
+#define ENV_RAMINIT (ENV_SEPARATE_ROMSTAGE || (ENV_BOOTBLOCK && !CONFIG(SEPARATE_ROMSTAGE)))
#if ENV_X86
#define ENV_HAS_SPINLOCKS !ENV_ROMSTAGE_OR_BEFORE
@@ -314,7 +314,7 @@
/* When set <arch/smp/spinlock.h> is included for the spinlock implementation. */
#define ENV_SUPPORTS_SMP (CONFIG(SMP) && ENV_HAS_SPINLOCKS)
-#if ENV_X86 && CONFIG(COOP_MULTITASKING) && (ENV_RAMSTAGE || ENV_ROMSTAGE)
+#if ENV_X86 && CONFIG(COOP_MULTITASKING) && (ENV_RAMSTAGE || ENV_CREATES_CBMEM)
/* TODO: Enable in all x86 stages */
#define ENV_SUPPORTS_COOP 1
#else
diff --git a/src/include/symbols.h b/src/include/symbols.h
index 5410798f062a..b1e44e113ff1 100644
--- a/src/include/symbols.h
+++ b/src/include/symbols.h
@@ -39,7 +39,7 @@ DECLARE_REGION(cbfs_mcache)
DECLARE_REGION(fmap_cache)
DECLARE_REGION(tpm_log)
-#if ENV_ROMSTAGE && CONFIG(ASAN_IN_ROMSTAGE)
+#if ENV_SEPARATE_ROMSTAGE && CONFIG(ASAN_IN_ROMSTAGE)
DECLARE_REGION(bss)
DECLARE_REGION(asan_shadow)
#endif
diff --git a/src/include/timestamp.h b/src/include/timestamp.h
index cbe993406972..ec2364f0a876 100644
--- a/src/include/timestamp.h
+++ b/src/include/timestamp.h
@@ -11,7 +11,7 @@
* timestamp_init() needs to be called once in *one* of the ENV_ROMSTAGE_OR_BEFORE
* stages (bootblock, romstage, verstage, etc). It's up to the chipset/arch
* to make the call in the earliest stage, otherwise some timestamps will be lost.
- * For x86 ENV_ROMSTAGE call must be made before CAR is torn down.
+ * For x86 ENV_BOOTBLOCK / ENV_SEPARATE_ROMSTAGE call must be made before CAR is torn down.
*/
void timestamp_init(uint64_t base);
/*