MCPcopy Create free account
hub / github.com/coreboot/coreboot / bs_call_callbacks

Function bs_call_callbacks

src/lib/hardwaremain.c:264–308  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

262#endif
263
264static void bs_call_callbacks(struct boot_state *state,
265 boot_state_sequence_t seq)
266{
267 struct boot_phase *phase = &state->phases[seq];
268 struct mono_time mt_start, mt_stop;
269
270 while (1) {
271 if (phase->callbacks != NULL) {
272 struct boot_state_callback *bscb;
273
274 /* Remove the first callback. */
275 bscb = phase->callbacks;
276 phase->callbacks = bscb->next;
277 bscb->next = NULL;
278
279 if (CONFIG(DEBUG_BOOT_STATE)) {
280 printk(BIOS_DEBUG, "BS: callback (%p) @ %s.\n",
281 bscb, bscb_location(bscb));
282 timer_monotonic_get(&mt_start);
283 }
284 bscb->callback(bscb->arg);
285 if (CONFIG(DEBUG_BOOT_STATE)) {
286 timer_monotonic_get(&mt_stop);
287 printk(BIOS_DEBUG, "BS: callback (%p) @ %s (%lld ms).\n", bscb,
288 bscb_location(bscb),
289 mono_time_diff_microseconds(&mt_start, &mt_stop)
290 / USECS_PER_MSEC);
291 }
292
293 bs_run_timers(0);
294
295 continue;
296 }
297
298 /* All callbacks are complete and there are no blockers for
299 * this state. Therefore, this part of the state is complete. */
300 if (!phase->blockers)
301 break;
302
303 /* Something is blocking this state from transitioning. As
304 * there are no more callbacks a pending timer needs to be
305 * ran to unblock the state. */
306 bs_run_timers(0);
307 }
308}
309
310/* Keep track of the current state. */
311static struct state_tracker {

Callers 1

bs_walk_state_machineFunction · 0.85

Calls 5

bscb_locationFunction · 0.85
bs_run_timersFunction · 0.85
printkFunction · 0.50
timer_monotonic_getFunction · 0.50

Tested by

no test coverage detected