summaryrefslogtreecommitdiff
path: root/src/cpu
diff options
context:
space:
mode:
authorFelix Held <felix.held@amd.corp-partner.google.com>2021-10-20 20:18:12 +0200
committerFelix Held <felix-coreboot@felixheld.de>2021-10-21 20:51:43 +0000
commitd27ef5bf6f5e444141dca6a89c46e667bca64652 (patch)
tree5625401e34f2a4f08175023de22172e4fa95589e /src/cpu
parente0e49c858bc603ac8216cd3d87c6a4a9996a8083 (diff)
cpu/x86/mp_init: use cb_err as mp_init_with_smm return type
Using cb_err as return type clarifies the meaning of the different return values. This patch also adds the types.h include that provides the definition of the cb_err enum and checks the return value of mp_init_with_smm against the enum values instead of either checking if it's non-zero or less than zero to handle the error case. Signed-off-by: Felix Held <felix-coreboot@felixheld.de> Change-Id: Ibcd4a9a63cc87fe176ba885ced0f00832587d492 Reviewed-on: https://review.coreboot.org/c/coreboot/+/58491 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Diffstat (limited to 'src/cpu')
-rw-r--r--src/cpu/intel/haswell/haswell_init.c3
-rw-r--r--src/cpu/intel/model_1067x/mp_init.c3
-rw-r--r--src/cpu/intel/model_2065x/model_2065x_init.c3
-rw-r--r--src/cpu/intel/model_206ax/model_206ax_init.c3
-rw-r--r--src/cpu/x86/mp_init.c12
5 files changed, 13 insertions, 11 deletions
diff --git a/src/cpu/intel/haswell/haswell_init.c b/src/cpu/intel/haswell/haswell_init.c
index 90db95b8df..40f5ce0013 100644
--- a/src/cpu/intel/haswell/haswell_init.c
+++ b/src/cpu/intel/haswell/haswell_init.c
@@ -17,6 +17,7 @@
#include <northbridge/intel/haswell/haswell.h>
#include <southbridge/intel/lynxpoint/pch.h>
#include <cpu/intel/common/common.h>
+#include <types.h>
#include "haswell.h"
#include "chip.h"
@@ -641,7 +642,7 @@ static const struct mp_ops mp_ops = {
void mp_init_cpus(struct bus *cpu_bus)
{
- if (mp_init_with_smm(cpu_bus, &mp_ops))
+ if (mp_init_with_smm(cpu_bus, &mp_ops) != CB_SUCCESS)
printk(BIOS_ERR, "MP initialization failure.\n");
}
diff --git a/src/cpu/intel/model_1067x/mp_init.c b/src/cpu/intel/model_1067x/mp_init.c
index fd6a82ac17..38d3735f14 100644
--- a/src/cpu/intel/model_1067x/mp_init.c
+++ b/src/cpu/intel/model_1067x/mp_init.c
@@ -7,6 +7,7 @@
#include <cpu/intel/smm_reloc.h>
#include <cpu/intel/common/common.h>
#include <device/device.h>
+#include <types.h>
/* Parallel MP initialization support. */
static void pre_mp_init(void)
@@ -97,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))
+ if (mp_init_with_smm(cpu_bus, &mp_ops) != CB_SUCCESS)
printk(BIOS_ERR, "MP initialization failure.\n");
}
diff --git a/src/cpu/intel/model_2065x/model_2065x_init.c b/src/cpu/intel/model_2065x/model_2065x_init.c
index f70d7b2f5f..a31f2cb692 100644
--- a/src/cpu/intel/model_2065x/model_2065x_init.c
+++ b/src/cpu/intel/model_2065x/model_2065x_init.c
@@ -19,6 +19,7 @@
#include <cpu/intel/smm_reloc.h>
#include <cpu/intel/common/common.h>
#include <smp/node.h>
+#include <types.h>
static void configure_thermal_target(void)
{
@@ -174,7 +175,7 @@ static const struct mp_ops mp_ops = {
void mp_init_cpus(struct bus *cpu_bus)
{
- if (mp_init_with_smm(cpu_bus, &mp_ops))
+ if (mp_init_with_smm(cpu_bus, &mp_ops) != CB_SUCCESS)
printk(BIOS_ERR, "MP initialization failure.\n");
}
diff --git a/src/cpu/intel/model_206ax/model_206ax_init.c b/src/cpu/intel/model_206ax/model_206ax_init.c
index 09cad24b8b..f3181cfaa6 100644
--- a/src/cpu/intel/model_206ax/model_206ax_init.c
+++ b/src/cpu/intel/model_206ax/model_206ax_init.c
@@ -19,6 +19,7 @@
#include <cpu/intel/smm_reloc.h>
#include <cpu/intel/common/common.h>
#include <smbios.h>
+#include <types.h>
/* Convert time in seconds to POWER_LIMIT_1_TIME MSR value */
static const u8 power_limit_time_sec_to_msr[] = {
@@ -430,7 +431,7 @@ static const struct mp_ops mp_ops = {
void mp_init_cpus(struct bus *cpu_bus)
{
- if (mp_init_with_smm(cpu_bus, &mp_ops))
+ if (mp_init_with_smm(cpu_bus, &mp_ops) != CB_SUCCESS)
printk(BIOS_ERR, "MP initialization failure.\n");
}
diff --git a/src/cpu/x86/mp_init.c b/src/cpu/x86/mp_init.c
index 3efff2f1b4..258b9df9da 100644
--- a/src/cpu/x86/mp_init.c
+++ b/src/cpu/x86/mp_init.c
@@ -1096,9 +1096,9 @@ static void fill_mp_state(struct mp_state *state, const struct mp_ops *ops)
mp_state.ops.per_cpu_smm_trigger = smm_initiate_relocation;
}
-int mp_init_with_smm(struct bus *cpu_bus, const struct mp_ops *mp_ops)
+enum cb_err mp_init_with_smm(struct bus *cpu_bus, const struct mp_ops *mp_ops)
{
- int ret;
+ enum cb_err ret;
void *default_smm_area;
struct mp_params mp_params;
@@ -1111,7 +1111,7 @@ int mp_init_with_smm(struct bus *cpu_bus, const struct mp_ops *mp_ops)
if (mp_state.cpu_count <= 0) {
printk(BIOS_ERR, "Invalid cpu_count: %d\n", mp_state.cpu_count);
- return -1;
+ return CB_ERR;
}
/* Sanity check SMM state. */
@@ -1133,14 +1133,12 @@ int mp_init_with_smm(struct bus *cpu_bus, const struct mp_ops *mp_ops)
/* Perform backup of default SMM area. */
default_smm_area = backup_default_smm_area();
- /* TODO: Remove this return value translation after changing the return type of
- mp_init_with_smm to enum cb_err */
- ret = mp_init(cpu_bus, &mp_params) == CB_SUCCESS ? 0 : -1;
+ ret = mp_init(cpu_bus, &mp_params);
restore_default_smm_area(default_smm_area);
/* Signal callback on success if it's provided. */
- if (ret == 0 && mp_state.ops.post_mp_init != NULL)
+ if (ret == CB_SUCCESS && mp_state.ops.post_mp_init != NULL)
mp_state.ops.post_mp_init();
return ret;