1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 3 #include <cpu/x86/smm.h> 4 #include <console/console.h> 5 #include <drivers/vpd/vpd.h> 6 #include <drivers/ocp/include/vpd.h> 7 get_loglevel_from_vpd(const char * const key,const int fallback)8int get_loglevel_from_vpd(const char *const key, const int fallback) 9 { 10 int log_level = fallback; 11 12 if (vpd_get_int(key, VPD_RW_THEN_RO, &log_level)) { 13 if (log_level < 0 || log_level >= BIOS_NEVER) 14 log_level = fallback; 15 } 16 return log_level; 17 } 18 get_console_loglevel(void)19int get_console_loglevel(void) 20 { 21 return get_loglevel_from_vpd(COREBOOT_LOG_LEVEL, COREBOOT_LOG_LEVEL_DEFAULT); 22 } 23 24 #if ENV_RAMSTAGE && CONFIG(RUNTIME_CONFIGURABLE_SMM_LOGLEVEL) 25 /* Read VPD for SMM settings in ramstage because we don't want to do this in SMM */ mainboard_set_smm_log_level(void)26int mainboard_set_smm_log_level(void) 27 { 28 return get_loglevel_from_vpd(SMM_LOG_LEVEL, SMM_LOG_LEVEL_DEFAULT); 29 } 30 #endif 31