diff options
author | Julius Werner <jwerner@chromium.org> | 2022-02-03 17:25:44 -0800 |
---|---|---|
committer | Julius Werner <jwerner@chromium.org> | 2022-02-07 23:28:46 +0000 |
commit | 266041f0e62296737617cc2fcfa97f31e2b43aea (patch) | |
tree | 77dbb232193c6c4db5c4233ae33a93126cab9e10 /src/include | |
parent | 984d03c492506af0fea22c7c8c94a6a87e1f5342 (diff) |
console: Add compile-time fast path when only CBMEM console is used
A common use case when running coreboot on production systems is that
only the CBMEM console (the one with the least impact on boot speed) is
enabled. In this case, some of the code in the console subsystem has no
effect. Due to the way it's all genericized over multiple consoles and
tied together with function pointers, not all of this can be
compile-time eliminated automatically, so this patch adds a little
helper to facilitate that. This results in roughly 200 (compressed)
bytes of savings per stage on an arm64 system.
Signed-off-by: Julius Werner <jwerner@chromium.org>
Change-Id: I1d5b8bda80d02a13ee0b7835e0805c4319fd21d8
Reviewed-on: https://review.coreboot.org/c/coreboot/+/61613
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Raul Rangel <rrangel@chromium.org>
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/console/console.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/include/console/console.h b/src/include/console/console.h index 5546aa98e5..e4090af48b 100644 --- a/src/include/console/console.h +++ b/src/include/console/console.h @@ -61,7 +61,18 @@ void do_putchar(unsigned char byte); long console_time_get_and_reset(void); void console_time_report(void); +/* + * "Fast" basically means only the CBMEM console right now. This is used to still + * print debug messages there when loglevel disables the other consoles. It is also + * used to compile-time eliminate code paths that only affect "interactive" consoles + * (which are all "slow") when none of those are enabled. + */ enum { CONSOLE_LOG_NONE = 0, CONSOLE_LOG_FAST, CONSOLE_LOG_ALL }; +#define HAS_ONLY_FAST_CONSOLES !(CONFIG(SPKMODEM) || CONFIG(CONSOLE_QEMU_DEBUGCON) || \ + CONFIG(CONSOLE_SERIAL) || CONFIG(CONSOLE_NE2K) || CONFIG(CONSOLE_USB) || \ + CONFIG(EM100PRO_SPI_CONSOLE) || CONFIG(CONSOLE_SPI_FLASH) || \ + CONFIG(CONSOLE_SYSTEM76_EC)) + #else static inline int get_log_level(void) { return -1; } static inline void console_init(void) {} |