diff options
author | Felix Held <felix.held@amd.corp-partner.google.com> | 2021-10-20 19:46:14 +0200 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2021-10-21 18:24:26 +0000 |
commit | e198880732fd272715388afb8f6cc7edca502006 (patch) | |
tree | e5defd00d8e142ff2975a5cc499e847908cbc153 /src/cpu | |
parent | c6f0ed789baaf102c128d1d45ddd531a2e6fcf4e (diff) |
cpu/x86/mp_init: use cb_err as run_ap_work return type
Using cb_err as return type clarifies the meaning of the different
return values. To not change the return types of mp_run_on_aps which is
exposed outside of this compilation unit to keep the scope of this patch
limited, the return value of run_ap_work gets translated to the int
values in mp_run_on_aps. This could also be done by a cast of the
run_ap_work return value to int, but an explicit translation of the
return values should be clearer about what it does there.
Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Change-Id: Id346c8edf06229a929b4783498d8c6774f54a8b1
Reviewed-on: https://review.coreboot.org/c/coreboot/+/58490
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Diffstat (limited to 'src/cpu')
-rw-r--r-- | src/cpu/x86/mp_init.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/cpu/x86/mp_init.c b/src/cpu/x86/mp_init.c index dd0cac073e..3efff2f1b4 100644 --- a/src/cpu/x86/mp_init.c +++ b/src/cpu/x86/mp_init.c @@ -886,7 +886,7 @@ static void store_callback(struct mp_callback **slot, struct mp_callback *val) ); } -static int run_ap_work(struct mp_callback *val, long expire_us) +static enum cb_err run_ap_work(struct mp_callback *val, long expire_us) { int i; int cpus_accepted; @@ -895,14 +895,14 @@ static int run_ap_work(struct mp_callback *val, long expire_us) if (!CONFIG(PARALLEL_MP_AP_WORK)) { printk(BIOS_ERR, "APs already parked. PARALLEL_MP_AP_WORK not selected.\n"); - return -1; + return CB_ERR; } cur_cpu = cpu_index(); if (cur_cpu < 0) { printk(BIOS_ERR, "Invalid CPU index.\n"); - return -1; + return CB_ERR; } /* Signal to all the APs to run the func. */ @@ -928,12 +928,12 @@ static int run_ap_work(struct mp_callback *val, long expire_us) } if (cpus_accepted == global_num_aps) - return 0; + return CB_SUCCESS; } while (expire_us <= 0 || !stopwatch_expired(&sw)); printk(BIOS_CRIT, "CRITICAL ERROR: AP call expired. %d/%d CPUs accepted.\n", cpus_accepted, global_num_aps); - return -1; + return CB_ERR; } static void ap_wait_for_instruction(void) @@ -979,7 +979,9 @@ int mp_run_on_aps(void (*func)(void *), void *arg, int logical_cpu_num, { struct mp_callback lcb = { .func = func, .arg = arg, .logical_cpu_number = logical_cpu_num}; - return run_ap_work(&lcb, expire_us); + /* 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; } int mp_run_on_all_aps(void (*func)(void *), void *arg, long expire_us, bool run_parallel) |