cpu/x86/mp_init: move printing of failure message into mp_init_with_smm
Each CPU/SoC checks the return value of the mp_init_with_smm and prints the same error message if it wasn't successful, so move this check and printk to mp_init_with_smm. For this the original mp_init_with_smm function gets renamed to do_mp_init_with_smm and a new mp_init_with_smm function is created which then calls do_mp_init_with_smm, prints the error if it didn't return CB_SUCCESS and passes the return value of do_mp_init_with_smm to its caller. Since no CPU/SoC code handles a mp_init_with_smm failure apart from printing a message, also add a comment at the mp_init_with_smm call sites that the code might want to handle a failure. Signed-off-by: Felix Held <felix-coreboot@felixheld.de> Change-Id: I181602723c204f3e43eb43302921adf7a88c81ed Reviewed-on: https://review.coreboot.org/c/coreboot/+/58498 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Raul Rangel <rrangel@chromium.org>
This commit is contained in:
parent
82faefb339
commit
4dd7d11965
22 changed files with 53 additions and 43 deletions
|
@ -642,8 +642,8 @@ static const struct mp_ops mp_ops = {
|
|||
|
||||
void mp_init_cpus(struct bus *cpu_bus)
|
||||
{
|
||||
if (mp_init_with_smm(cpu_bus, &mp_ops) != CB_SUCCESS)
|
||||
printk(BIOS_ERR, "MP initialization failure.\n");
|
||||
/* TODO: Handle mp_init_with_smm failure? */
|
||||
mp_init_with_smm(cpu_bus, &mp_ops);
|
||||
}
|
||||
|
||||
static struct device_operations cpu_dev_ops = {
|
||||
|
|
|
@ -98,6 +98,6 @@ static const struct mp_ops mp_ops = {
|
|||
|
||||
void mp_init_cpus(struct bus *cpu_bus)
|
||||
{
|
||||
if (mp_init_with_smm(cpu_bus, &mp_ops) != CB_SUCCESS)
|
||||
printk(BIOS_ERR, "MP initialization failure.\n");
|
||||
/* TODO: Handle mp_init_with_smm failure? */
|
||||
mp_init_with_smm(cpu_bus, &mp_ops);
|
||||
}
|
||||
|
|
|
@ -175,8 +175,8 @@ static const struct mp_ops mp_ops = {
|
|||
|
||||
void mp_init_cpus(struct bus *cpu_bus)
|
||||
{
|
||||
if (mp_init_with_smm(cpu_bus, &mp_ops) != CB_SUCCESS)
|
||||
printk(BIOS_ERR, "MP initialization failure.\n");
|
||||
/* TODO: Handle mp_init_with_smm failure? */
|
||||
mp_init_with_smm(cpu_bus, &mp_ops);
|
||||
}
|
||||
|
||||
static struct device_operations cpu_dev_ops = {
|
||||
|
|
|
@ -431,8 +431,8 @@ static const struct mp_ops mp_ops = {
|
|||
|
||||
void mp_init_cpus(struct bus *cpu_bus)
|
||||
{
|
||||
if (mp_init_with_smm(cpu_bus, &mp_ops) != CB_SUCCESS)
|
||||
printk(BIOS_ERR, "MP initialization failure.\n");
|
||||
/* TODO: Handle mp_init_with_smm failure? */
|
||||
mp_init_with_smm(cpu_bus, &mp_ops);
|
||||
}
|
||||
|
||||
static struct device_operations cpu_dev_ops = {
|
||||
|
|
|
@ -1095,7 +1095,7 @@ static void fill_mp_state(struct mp_state *state, const struct mp_ops *ops)
|
|||
mp_state.ops.per_cpu_smm_trigger = smm_initiate_relocation;
|
||||
}
|
||||
|
||||
enum cb_err mp_init_with_smm(struct bus *cpu_bus, const struct mp_ops *mp_ops)
|
||||
static enum cb_err do_mp_init_with_smm(struct bus *cpu_bus, const struct mp_ops *mp_ops)
|
||||
{
|
||||
enum cb_err ret;
|
||||
void *default_smm_area;
|
||||
|
@ -1142,3 +1142,13 @@ enum cb_err mp_init_with_smm(struct bus *cpu_bus, const struct mp_ops *mp_ops)
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
enum cb_err mp_init_with_smm(struct bus *cpu_bus, const struct mp_ops *mp_ops)
|
||||
{
|
||||
enum cb_err ret = do_mp_init_with_smm(cpu_bus, mp_ops);
|
||||
|
||||
if (ret != CB_SUCCESS)
|
||||
printk(BIOS_ERR, "MP initialization failure.\n");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -251,8 +251,8 @@ void mp_init_cpus(struct bus *cpu_bus)
|
|||
{
|
||||
const struct mp_ops *ops = CONFIG(SMM_TSEG) ? &mp_ops_with_smm : &mp_ops_no_smm;
|
||||
|
||||
if (mp_init_with_smm(cpu_bus, ops) != CB_SUCCESS)
|
||||
printk(BIOS_ERR, "MP initialization failure.\n");
|
||||
/* TODO: Handle mp_init_with_smm failure? */
|
||||
mp_init_with_smm(cpu_bus, ops);
|
||||
}
|
||||
|
||||
static void cpu_bus_init(struct device *dev)
|
||||
|
|
|
@ -52,8 +52,8 @@ static const struct mp_ops mp_ops = {
|
|||
void mp_init_cpus(struct bus *cpu_bus)
|
||||
{
|
||||
/* Clear for take-off */
|
||||
if (mp_init_with_smm(cpu_bus, &mp_ops) != CB_SUCCESS)
|
||||
printk(BIOS_ERR, "MP initialization failure.\n");
|
||||
/* TODO: Handle mp_init_with_smm failure? */
|
||||
mp_init_with_smm(cpu_bus, &mp_ops);
|
||||
|
||||
/* pre_mp_init made the flash not cacheable. Reset to WP for performance. */
|
||||
mtrr_use_temp_range(FLASH_BASE_ADDR, CONFIG_ROM_SIZE, MTRR_TYPE_WRPROT);
|
||||
|
|
|
@ -56,8 +56,8 @@ static const struct mp_ops mp_ops = {
|
|||
void mp_init_cpus(struct bus *cpu_bus)
|
||||
{
|
||||
/* Clear for take-off */
|
||||
if (mp_init_with_smm(cpu_bus, &mp_ops) != CB_SUCCESS)
|
||||
printk(BIOS_ERR, "MP initialization failure.\n");
|
||||
/* TODO: Handle mp_init_with_smm failure? */
|
||||
mp_init_with_smm(cpu_bus, &mp_ops);
|
||||
|
||||
/* pre_mp_init made the flash not cacheable. Reset to WP for performance. */
|
||||
mtrr_use_temp_range(FLASH_BASE_ADDR, CONFIG_ROM_SIZE, MTRR_TYPE_WRPROT);
|
||||
|
|
|
@ -54,8 +54,8 @@ static const struct mp_ops mp_ops = {
|
|||
void mp_init_cpus(struct bus *cpu_bus)
|
||||
{
|
||||
/* Clear for take-off */
|
||||
if (mp_init_with_smm(cpu_bus, &mp_ops) != CB_SUCCESS)
|
||||
printk(BIOS_ERR, "MP initialization failure.\n");
|
||||
/* TODO: Handle mp_init_with_smm failure? */
|
||||
mp_init_with_smm(cpu_bus, &mp_ops);
|
||||
|
||||
/* The flash is now no longer cacheable. Reset to WP for performance. */
|
||||
mtrr_use_temp_range(FLASH_BASE_ADDR, CONFIG_ROM_SIZE, MTRR_TYPE_WRPROT);
|
||||
|
|
|
@ -127,8 +127,8 @@ static const struct mp_ops mp_ops = {
|
|||
|
||||
void soc_init_cpus(struct bus *cpu_bus)
|
||||
{
|
||||
if (mp_init_with_smm(cpu_bus, &mp_ops) != CB_SUCCESS)
|
||||
printk(BIOS_ERR, "MP initialization failure.\n");
|
||||
/* TODO: Handle mp_init_with_smm failure? */
|
||||
mp_init_with_smm(cpu_bus, &mp_ops);
|
||||
|
||||
/* Thermal throttle activation offset */
|
||||
configure_tcc_thermal_target();
|
||||
|
|
|
@ -251,8 +251,8 @@ static const struct mp_ops mp_ops = {
|
|||
void soc_init_cpus(struct bus *cpu_bus)
|
||||
{
|
||||
/* Clear for take-off */
|
||||
if (mp_init_with_smm(cpu_bus, &mp_ops) != CB_SUCCESS)
|
||||
printk(BIOS_ERR, "MP initialization failure.\n");
|
||||
/* TODO: Handle mp_init_with_smm failure? */
|
||||
mp_init_with_smm(cpu_bus, &mp_ops);
|
||||
}
|
||||
|
||||
void apollolake_init_cpus(struct device *dev)
|
||||
|
|
|
@ -197,6 +197,6 @@ void baytrail_init_cpus(struct device *dev)
|
|||
{
|
||||
struct bus *cpu_bus = dev->link_list;
|
||||
|
||||
if (mp_init_with_smm(cpu_bus, &mp_ops) != CB_SUCCESS)
|
||||
printk(BIOS_ERR, "MP initialization failure.\n");
|
||||
/* TODO: Handle mp_init_with_smm failure? */
|
||||
mp_init_with_smm(cpu_bus, &mp_ops);
|
||||
}
|
||||
|
|
|
@ -206,6 +206,6 @@ void soc_init_cpus(struct device *dev)
|
|||
{
|
||||
struct bus *cpu_bus = dev->link_list;
|
||||
|
||||
if (mp_init_with_smm(cpu_bus, &mp_ops) != CB_SUCCESS)
|
||||
printk(BIOS_ERR, "MP initialization failure.\n");
|
||||
/* TODO: Handle mp_init_with_smm failure? */
|
||||
mp_init_with_smm(cpu_bus, &mp_ops);
|
||||
}
|
||||
|
|
|
@ -190,8 +190,8 @@ static const struct mp_ops mp_ops = {
|
|||
|
||||
void soc_init_cpus(struct bus *cpu_bus)
|
||||
{
|
||||
if (mp_init_with_smm(cpu_bus, &mp_ops) != CB_SUCCESS)
|
||||
printk(BIOS_ERR, "MP initialization failure.\n");
|
||||
/* TODO: Handle mp_init_with_smm failure? */
|
||||
mp_init_with_smm(cpu_bus, &mp_ops);
|
||||
|
||||
/* Thermal throttle activation offset */
|
||||
configure_tcc_thermal_target();
|
||||
|
|
|
@ -297,6 +297,6 @@ void denverton_init_cpus(struct device *dev)
|
|||
add_more_links(dev, 1);
|
||||
|
||||
/* Clear for take-off */
|
||||
if (mp_init_with_smm(dev->link_list, &mp_ops) != CB_SUCCESS)
|
||||
printk(BIOS_ERR, "MP initialization failure.\n");
|
||||
/* TODO: Handle mp_init_with_smm failure? */
|
||||
mp_init_with_smm(dev->link_list, &mp_ops);
|
||||
}
|
||||
|
|
|
@ -118,8 +118,8 @@ static const struct mp_ops mp_ops = {
|
|||
|
||||
void soc_init_cpus(struct bus *cpu_bus)
|
||||
{
|
||||
if (mp_init_with_smm(cpu_bus, &mp_ops) != CB_SUCCESS)
|
||||
printk(BIOS_ERR, "MP initialization failure.\n");
|
||||
/* TODO: Handle mp_init_with_smm failure? */
|
||||
mp_init_with_smm(cpu_bus, &mp_ops);
|
||||
|
||||
/* Thermal throttle activation offset */
|
||||
configure_tcc_thermal_target();
|
||||
|
|
|
@ -154,6 +154,6 @@ static const struct mp_ops mp_ops = {
|
|||
|
||||
void soc_init_cpus(struct bus *cpu_bus)
|
||||
{
|
||||
if (mp_init_with_smm(cpu_bus, &mp_ops) != CB_SUCCESS)
|
||||
printk(BIOS_ERR, "MP initialization failure.\n");
|
||||
/* TODO: Handle mp_init_with_smm failure? */
|
||||
mp_init_with_smm(cpu_bus, &mp_ops);
|
||||
}
|
||||
|
|
|
@ -120,8 +120,8 @@ static const struct mp_ops mp_ops = {
|
|||
|
||||
void soc_init_cpus(struct bus *cpu_bus)
|
||||
{
|
||||
if (mp_init_with_smm(cpu_bus, &mp_ops) != CB_SUCCESS)
|
||||
printk(BIOS_ERR, "MP initialization failure.\n");
|
||||
/* TODO: Handle mp_init_with_smm failure? */
|
||||
mp_init_with_smm(cpu_bus, &mp_ops);
|
||||
|
||||
/* Thermal throttle activation offset */
|
||||
configure_tcc_thermal_target();
|
||||
|
|
|
@ -215,8 +215,8 @@ static const struct mp_ops mp_ops = {
|
|||
|
||||
void soc_init_cpus(struct bus *cpu_bus)
|
||||
{
|
||||
if (mp_init_with_smm(cpu_bus, &mp_ops) != CB_SUCCESS)
|
||||
printk(BIOS_ERR, "MP initialization failure.\n");
|
||||
/* TODO: Handle mp_init_with_smm failure? */
|
||||
mp_init_with_smm(cpu_bus, &mp_ops);
|
||||
|
||||
/* Thermal throttle activation offset */
|
||||
configure_tcc_thermal_target();
|
||||
|
|
|
@ -126,8 +126,8 @@ static const struct mp_ops mp_ops = {
|
|||
|
||||
void soc_init_cpus(struct bus *cpu_bus)
|
||||
{
|
||||
if (mp_init_with_smm(cpu_bus, &mp_ops) != CB_SUCCESS)
|
||||
printk(BIOS_ERR, "MP initialization failure.\n");
|
||||
/* TODO: Handle mp_init_with_smm failure? */
|
||||
mp_init_with_smm(cpu_bus, &mp_ops);
|
||||
|
||||
/* Thermal throttle activation offset */
|
||||
configure_tcc_thermal_target();
|
||||
|
|
|
@ -212,8 +212,8 @@ void cpx_init_cpus(struct device *dev)
|
|||
|
||||
intel_microcode_load_unlocked(microcode_patch);
|
||||
|
||||
if (mp_init_with_smm(dev->link_list, &mp_ops) != CB_SUCCESS)
|
||||
printk(BIOS_ERR, "MP initialization failure.\n");
|
||||
/* TODO: Handle mp_init_with_smm failure? */
|
||||
mp_init_with_smm(dev->link_list, &mp_ops);
|
||||
|
||||
/*
|
||||
* chip_config is used in cpu device callback. Other than cpu 0,
|
||||
|
|
|
@ -231,8 +231,8 @@ void xeon_sp_init_cpus(struct device *dev)
|
|||
config_reset_cpl3_csrs();
|
||||
|
||||
/* calls src/cpu/x86/mp_init.c */
|
||||
if (mp_init_with_smm(dev->link_list, &mp_ops) != CB_SUCCESS)
|
||||
printk(BIOS_ERR, "MP initialization failure.\n");
|
||||
/* TODO: Handle mp_init_with_smm failure? */
|
||||
mp_init_with_smm(dev->link_list, &mp_ops);
|
||||
|
||||
/* update numa domain for all cpu devices */
|
||||
xeonsp_init_cpu_config();
|
||||
|
|
Loading…
Reference in a new issue