Attention is currently required from: Andrey Petrov, Patrick Rudolph. Subrata Banik has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/60471 )
Change subject: drivers/intel/fsp: Creates map between FSP and coreboot console level ......................................................................
drivers/intel/fsp: Creates map between FSP and coreboot console level
This patch performs a map between coreboot console level and FSP debug level. This would be useful to suppress MRC (FSP-M) debug logs.
Users to select HAVE_DEBUG_RAM_SETUP config to get verbose MRC debug log,
Signed-off-by: Subrata Banik subratabanik@google.com Change-Id: I398d576fad68a0d0fc931c175bbc04fcbc2e54ec --- M src/drivers/intel/fsp2_0/debug.c M src/drivers/intel/fsp2_0/include/fsp/debug.h 2 files changed, 46 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/71/60471/1
diff --git a/src/drivers/intel/fsp2_0/debug.c b/src/drivers/intel/fsp2_0/debug.c index 323c799..8d11e5f 100644 --- a/src/drivers/intel/fsp2_0/debug.c +++ b/src/drivers/intel/fsp2_0/debug.c @@ -1,10 +1,20 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */
+#include <commonlib/helpers.h> #include <console/console.h> #include <console/streams.h> #include <cpu/x86/mtrr.h> #include <fsp/util.h>
+enum { + FSP_LOG_LEVEL_DISABLE = 0, + FSP_LOG_LEVEL_ERR, + FSP_LOG_LEVEL_ERR_WARN, + FSP_LOG_LEVEL_ERR_WARN_INFO, + FSP_LOG_LEVEL_ERR_WARN_INFO_EVENT, + FSP_LOG_LEVEL_VERBOSE +}; + asmlinkage size_t fsp_write_line(uint8_t *buffer, size_t number_of_bytes) { console_write_line(buffer, number_of_bytes); @@ -32,6 +42,41 @@ } }
+int fsp_map_console_log_level(void) +{ + int fsp_debug_level; + + switch (get_max_console_log_level(CONSOLE_LOG_ALL)) { + case BIOS_EMERG: + case BIOS_ALERT: + case BIOS_CRIT: + case BIOS_ERR: + fsp_debug_level = FSP_LOG_LEVEL_ERR; + break; + case BIOS_WARNING: + fsp_debug_level = FSP_LOG_LEVEL_ERR_WARN; + break; + case BIOS_NOTICE: + fsp_debug_level = FSP_LOG_LEVEL_ERR_WARN_INFO; + break; + case BIOS_INFO: + fsp_debug_level = FSP_LOG_LEVEL_ERR_WARN_INFO_EVENT; + break; + case BIOS_DEBUG: + case BIOS_SPEW: + fsp_debug_level = FSP_LOG_LEVEL_VERBOSE; + break; + default: + fsp_debug_level = FSP_LOG_LEVEL_DISABLE; + break; + } + + if (!CONFIG(DEBUG_RAM_SETUP)) + fsp_debug_level = MIN(fsp_debug_level, FSP_LOG_LEVEL_ERR_WARN); + + return fsp_debug_level; +} + /*----------- * MemoryInit *----------- diff --git a/src/drivers/intel/fsp2_0/include/fsp/debug.h b/src/drivers/intel/fsp2_0/include/fsp/debug.h index be7dd3a..3b531bc 100644 --- a/src/drivers/intel/fsp2_0/include/fsp/debug.h +++ b/src/drivers/intel/fsp2_0/include/fsp/debug.h @@ -6,6 +6,7 @@ #include <fsp/util.h>
/* FSP debug API */ +int fsp_map_console_log_level(void); void fsp_debug_before_memory_init(fsp_memory_init_fn memory_init, const FSPM_UPD *fspm_old_upd, const FSPM_UPD *fspm_new_upd);