UPSTREAM: cpu/x86/mp_init: report correct count of AP acceptance
The previous implementation was using a for loop. By it's
very definition the last statement in the for loop declaration
is done at the end of the loop. Therefore, if the conditional for
breaking out of the for loop because of a timeout would always
see a value of 0 for the number of APs accepted. Correct this
by changing to a while loop with an explicit timeout condition
at the end of the loop.
BUG=none
BRANCH=none
TEST=none
Change-Id: If8dfd7e5a73480dbd23c29a6e9f07b8369731646
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Original-Commit-Id: 046848ce1f
Original-Change-Id: I503953c46c2a65f7e264ed49c94c0a46d6c41c57
Original-Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Original-Reviewed-on: https://review.coreboot.org/20225
Original-Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Original-Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://chromium-review.googlesource.com/539233
Commit-Ready: Patrick Georgi <pgeorgi@chromium.org>
Tested-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-by: Patrick Georgi <pgeorgi@chromium.org>
This commit is contained in:
parent
2fcdae2dc0
commit
f017aa887f
1 changed files with 7 additions and 1 deletions
|
|
@ -891,15 +891,21 @@ static int run_ap_work(mp_callback_t func, long expire_us)
|
|||
|
||||
/* Wait for all the APs to signal back that call has been accepted. */
|
||||
stopwatch_init_usecs_expire(&sw, expire_us);
|
||||
for (cpus_accepted = 0; !stopwatch_expired(&sw); cpus_accepted = 0) {
|
||||
while (1) {
|
||||
cpus_accepted = 0;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(ap_callbacks); i++) {
|
||||
if (cur_cpu == i)
|
||||
continue;
|
||||
if (read_callback(&ap_callbacks[i]) == NULL)
|
||||
cpus_accepted++;
|
||||
}
|
||||
|
||||
if (cpus_accepted == global_num_aps)
|
||||
return 0;
|
||||
|
||||
if (stopwatch_expired(&sw))
|
||||
break;
|
||||
}
|
||||
|
||||
printk(BIOS_ERR, "AP call expired. %d/%d CPUs accepted.\n",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue