drivers/intel/fsp2_0: Add boot mode strings
The FSP boot mode showing in serial log is a magic number.
In order to let user understand its meaning directly, add
the strings to describe the modes.
TEST=build, boot the device and check the logs:
without this change, the log is like:
[SPEW ] bootmode is set to: 2
with this change:
[SPEW ] bootmode is set to: 2 (boot assuming no config change)
Change-Id: I49a409edcde7f6ccb95eafb0b250f86329817cba
Signed-off-by: Marx Wang <marx.wang@intel.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/78683
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Eric Lai <ericllai@google.com>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Reviewed-by: Subrata Banik <subratabanik@google.com>
diff --git a/src/drivers/intel/fsp2_0/memory_init.c b/src/drivers/intel/fsp2_0/memory_init.c
index d0ddeaf..f5de5c3 100644
--- a/src/drivers/intel/fsp2_0/memory_init.c
+++ b/src/drivers/intel/fsp2_0/memory_init.c
@@ -160,6 +160,16 @@
* and are not related to FSP stack at all.
* Non-CAR FSP 2.0 platforms pass a DRAM location for the FSP stack.
*/
+ static const char * const fsp_bootmode_strings[] = {
+ [FSP_BOOT_WITH_FULL_CONFIGURATION] = "boot with full config",
+ [FSP_BOOT_WITH_MINIMAL_CONFIGURATION] = "boot with minimal config",
+ [FSP_BOOT_ASSUMING_NO_CONFIGURATION_CHANGES] = "boot assuming no config change",
+ [FSP_BOOT_ON_S4_RESUME] = "boot on s4 resume",
+ [FSP_BOOT_ON_S3_RESUME] = "boot on s3 resume",
+ [FSP_BOOT_ON_FLASH_UPDATE] = "boot on flash update",
+ [FSP_BOOT_IN_RECOVERY_MODE] = "boot in recovery mode",
+ };
+
if (CONFIG(FSP_USES_CB_STACK) || !ENV_CACHE_AS_RAM) {
arch_upd->StackBase = (uintptr_t)temp_ram;
arch_upd->StackSize = sizeof(temp_ram);
@@ -180,7 +190,12 @@
arch_upd->BootMode = FSP_BOOT_WITH_FULL_CONFIGURATION;
}
- printk(BIOS_SPEW, "bootmode is set to: %d\n", arch_upd->BootMode);
+ if (arch_upd->BootMode < ARRAY_SIZE(fsp_bootmode_strings) &&
+ fsp_bootmode_strings[arch_upd->BootMode] != NULL)
+ printk(BIOS_SPEW, "bootmode is set to: %d (%s)\n", arch_upd->BootMode,
+ fsp_bootmode_strings[arch_upd->BootMode]);
+ else
+ printk(BIOS_SPEW, "bootmode is set to: %d (unknown mode)\n", arch_upd->BootMode);
return CB_SUCCESS;
}