summaryrefslogtreecommitdiff
path: root/src/cpu/x86
diff options
context:
space:
mode:
authorFelix Held <felix.held@amd.corp-partner.google.com>2021-10-20 20:50:58 +0200
committerFelix Held <felix-coreboot@felixheld.de>2021-10-22 01:26:30 +0000
commit82faefb339a0853dd49f10bafd2c4f5ca1723fb3 (patch)
treef53d53ffb151ab929b32dece690399d3d8e5f4a6 /src/cpu/x86
parent250988d943c322ac1720ae7cd6f88592f82a08c0 (diff)
cpu/x86/mp_init: use cb_err as status return type in remaining functions
Using cb_err as return type of mp_run_on_aps, mp_run_on_all_aps, mp_run_on_all_cpus and mp_park_aps 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 all 4 functions listed above 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: I4b3f03415a041d3ec9cd0e102980e53868b004b0 Reviewed-on: https://review.coreboot.org/c/coreboot/+/58494 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Raul Rangel <rrangel@chromium.org>
Diffstat (limited to 'src/cpu/x86')
-rw-r--r--src/cpu/x86/mp_init.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/cpu/x86/mp_init.c b/src/cpu/x86/mp_init.c
index 258b9df9da..0624176b75 100644
--- a/src/cpu/x86/mp_init.c
+++ b/src/cpu/x86/mp_init.c
@@ -974,17 +974,16 @@ static void ap_wait_for_instruction(void)
}
}
-int mp_run_on_aps(void (*func)(void *), void *arg, int logical_cpu_num,
+enum cb_err mp_run_on_aps(void (*func)(void *), void *arg, int logical_cpu_num,
long expire_us)
{
struct mp_callback lcb = { .func = func, .arg = arg,
.logical_cpu_number = logical_cpu_num};
- /* TODO: Remove this return value translation after changing the return type of
- mp_run_on_aps to enum cb_err */
- return run_ap_work(&lcb, expire_us) == CB_SUCCESS ? 0 : -1;
+ return run_ap_work(&lcb, expire_us);
}
-int mp_run_on_all_aps(void (*func)(void *), void *arg, long expire_us, bool run_parallel)
+enum cb_err mp_run_on_all_aps(void (*func)(void *), void *arg, long expire_us,
+ bool run_parallel)
{
int ap_index, bsp_index;
@@ -999,14 +998,14 @@ int mp_run_on_all_aps(void (*func)(void *), void *arg, long expire_us, bool run_
/* skip if BSP */
if (ap_index == bsp_index)
continue;
- if (mp_run_on_aps(func, arg, ap_index, expire_us))
+ if (mp_run_on_aps(func, arg, ap_index, expire_us) != CB_SUCCESS)
return CB_ERR;
}
return CB_SUCCESS;
}
-int mp_run_on_all_cpus(void (*func)(void *), void *arg)
+enum cb_err mp_run_on_all_cpus(void (*func)(void *), void *arg)
{
/* Run on BSP first. */
func(arg);
@@ -1015,10 +1014,10 @@ int mp_run_on_all_cpus(void (*func)(void *), void *arg)
return mp_run_on_aps(func, arg, MP_RUN_ON_ALL_CPUS, 1000 * USECS_PER_MSEC);
}
-int mp_park_aps(void)
+enum cb_err mp_park_aps(void)
{
struct stopwatch sw;
- int ret;
+ enum cb_err ret;
long duration_msecs;
stopwatch_init(&sw);
@@ -1028,7 +1027,7 @@ int mp_park_aps(void)
duration_msecs = stopwatch_duration_msecs(&sw);
- if (!ret)
+ if (ret == CB_SUCCESS)
printk(BIOS_DEBUG, "%s done after %ld msecs.\n", __func__,
duration_msecs);
else