static int bsp_do_flight_plan(struct udevice *cpu, struct mp_params *mp_params) { int i; int ret = 0; const int timeout_us = 100000; const int step_us = 100; int num_aps = num_cpus - 1; for (i = 0; i < mp_params->num_records; i++) { struct mp_flight_record *rec = &mp_params->flight_plan[i]; /* Wait for APs if the record is not released */ if (atomic_read(&rec->barrier) == 0) { /* Wait for the APs to check in */ if (wait_for_aps(&rec->cpus_entered, num_aps, timeout_us, step_us)) { debug("MP record %d timeout.\n", i); ret = -1; } } if (rec->bsp_call != NULL) rec->bsp_call(cpu, rec->bsp_arg); release_barrier(&rec->barrier); } return ret; }
int main (int argc, char **argv) { int key, bd, ret; if (argc < 2) { printf("Usage: releaser <barrier_key> \n"); return -1; } key = atoi(argv[1]); bd = get_barrier(key, 0); if (bd == -1) { printf("Error: the barrier doesn't exist \n"); return -1; } ret = release_barrier(bd); if (ret == -1) { printf("Error: impossible to release the barrier\n"); return -1; } printf("Barrier correctly released \n"); return 0; }