blob: 14b3fff9bab4de036c3a36725a1d8df605d41e0b [file] [log] [blame]
Eric Biederman8ca8d762003-04-22 19:02:15 +00001/*
Aaron Durbin7e35efa2013-04-24 15:14:01 -05002 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2013 Google, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Eric Biederman8ca8d762003-04-22 19:02:15 +000018 */
19
20
21/*
Stefan Reinauerf8ee1802008-01-18 15:08:58 +000022 * C Bootstrap code for the coreboot
Eric Biederman8ca8d762003-04-22 19:02:15 +000023 */
24
Aaron Durbin7e35efa2013-04-24 15:14:01 -050025#include <bootstate.h>
Eric Biederman8ca8d762003-04-22 19:02:15 +000026#include <console/console.h>
Eric Biederman8ca8d762003-04-22 19:02:15 +000027#include <version.h>
Eric Biederman5899fd82003-04-24 06:25:08 +000028#include <device/device.h>
29#include <device/pci.h>
Eric Biederman9b4336c2003-07-19 04:28:22 +000030#include <delay.h>
Eric Biedermanb78c1972004-10-14 20:54:17 +000031#include <stdlib.h>
Stefan Reinauerde3206a2010-02-22 06:09:43 +000032#include <reset.h>
Stefan Reinauer7e9771c2009-04-22 08:17:38 +000033#include <boot/tables.h>
Eric Biederman8ca8d762003-04-22 19:02:15 +000034#include <boot/elf.h>
Peter Stuge483b7bb2009-04-14 07:40:01 +000035#include <cbfs.h>
Ronald G. Minnich9764d4c2012-06-12 16:29:32 -070036#include <lib.h>
Stefan Reinauer08670622009-06-30 15:17:49 +000037#if CONFIG_HAVE_ACPI_RESUME
Rudolf Mareka572f832009-04-13 17:57:44 +000038#include <arch/acpi.h>
Stefan Reinauer3935b192009-04-14 06:38:15 +000039#endif
Aaron Durbin6b0fb0d2013-04-26 20:54:16 -050040#include <timer.h>
Stefan Reinauerbf729ba2011-11-04 12:31:58 -070041#include <timestamp.h>
Aaron Durbin4409a5e2013-05-06 12:20:52 -050042#include <thread.h>
Eric Biederman8ca8d762003-04-22 19:02:15 +000043
Aaron Durbin7e35efa2013-04-24 15:14:01 -050044#if BOOT_STATE_DEBUG
45#define BS_DEBUG_LVL BIOS_DEBUG
46#else
47#define BS_DEBUG_LVL BIOS_NEVER
48#endif
Rudolf Mareka572f832009-04-13 17:57:44 +000049
Aaron Durbin7e35efa2013-04-24 15:14:01 -050050static boot_state_t bs_pre_device(void *arg);
51static boot_state_t bs_dev_init_chips(void *arg);
52static boot_state_t bs_dev_enumerate(void *arg);
53static boot_state_t bs_dev_resources(void *arg);
54static boot_state_t bs_dev_eanble(void *arg);
55static boot_state_t bs_dev_init(void *arg);
56static boot_state_t bs_post_device(void *arg);
Aaron Durbin0a6c20a2013-04-24 22:33:08 -050057static boot_state_t bs_os_resume_check(void *arg);
Aaron Durbin7e35efa2013-04-24 15:14:01 -050058static boot_state_t bs_os_resume(void *arg);
59static boot_state_t bs_write_tables(void *arg);
60static boot_state_t bs_payload_load(void *arg);
61static boot_state_t bs_payload_boot(void *arg);
62
Aaron Durbin6b0fb0d2013-04-26 20:54:16 -050063/*
64 * Typically a state will take 4 time samples:
65 * 1. Before state entry callbacks
66 * 2. After state entry callbacks / Before state function.
67 * 3. After state function / Before state exit callbacks.
68 * 4. After state exit callbacks.
69 */
70#define MAX_TIME_SAMPLES 4
71struct boot_state_times {
72 int num_samples;
73 struct mono_time samples[MAX_TIME_SAMPLES];
74};
75
Aaron Durbin0748d302013-05-06 10:50:19 -050076/* The prologue (BS_ON_ENTRY) and epilogue (BS_ON_EXIT) of a state can be
77 * blocked from transitioning to the next (state,seq) pair. When the blockers
78 * field is 0 a transition may occur. */
79struct boot_phase {
80 struct boot_state_callback *callbacks;
81 int blockers;
82};
83
Aaron Durbin7e35efa2013-04-24 15:14:01 -050084struct boot_state {
85 const char *name;
86 boot_state_t id;
Aaron Durbin0748d302013-05-06 10:50:19 -050087 struct boot_phase phases[2];
Aaron Durbin7e35efa2013-04-24 15:14:01 -050088 boot_state_t (*run_state)(void *arg);
89 void *arg;
Aaron Durbin8fc41e12013-04-29 23:22:01 -050090 int complete : 1;
Aaron Durbin6b0fb0d2013-04-26 20:54:16 -050091#if CONFIG_HAVE_MONOTONIC_TIMER
92 struct boot_state_times times;
93#endif
Aaron Durbin7e35efa2013-04-24 15:14:01 -050094};
95
Aaron Durbin15c671e2013-05-06 10:52:24 -050096#define BS_INIT(state_, run_func_) \
Aaron Durbin8fc41e12013-04-29 23:22:01 -050097 { \
98 .name = #state_, \
99 .id = state_, \
Aaron Durbin0748d302013-05-06 10:50:19 -0500100 .phases = { { NULL, 0 }, { NULL, 0 } }, \
Aaron Durbin8fc41e12013-04-29 23:22:01 -0500101 .run_state = run_func_, \
102 .arg = NULL, \
103 .complete = 0, \
Aaron Durbin7e35efa2013-04-24 15:14:01 -0500104 }
105#define BS_INIT_ENTRY(state_, run_func_) \
Aaron Durbin15c671e2013-05-06 10:52:24 -0500106 [state_] = BS_INIT(state_, run_func_)
Aaron Durbin7e35efa2013-04-24 15:14:01 -0500107
108static struct boot_state boot_states[] = {
109 BS_INIT_ENTRY(BS_PRE_DEVICE, bs_pre_device),
110 BS_INIT_ENTRY(BS_DEV_INIT_CHIPS, bs_dev_init_chips),
111 BS_INIT_ENTRY(BS_DEV_ENUMERATE, bs_dev_enumerate),
112 BS_INIT_ENTRY(BS_DEV_RESOURCES, bs_dev_resources),
113 BS_INIT_ENTRY(BS_DEV_ENABLE, bs_dev_eanble),
114 BS_INIT_ENTRY(BS_DEV_INIT, bs_dev_init),
115 BS_INIT_ENTRY(BS_POST_DEVICE, bs_post_device),
Aaron Durbin0a6c20a2013-04-24 22:33:08 -0500116 BS_INIT_ENTRY(BS_OS_RESUME_CHECK, bs_os_resume_check),
Aaron Durbin15c671e2013-05-06 10:52:24 -0500117 BS_INIT_ENTRY(BS_OS_RESUME, bs_os_resume),
118 BS_INIT_ENTRY(BS_WRITE_TABLES, bs_write_tables),
119 BS_INIT_ENTRY(BS_PAYLOAD_LOAD, bs_payload_load),
120 BS_INIT_ENTRY(BS_PAYLOAD_BOOT, bs_payload_boot),
Aaron Durbin7e35efa2013-04-24 15:14:01 -0500121};
122
123static boot_state_t bs_pre_device(void *arg)
124{
Aaron Durbin7e35efa2013-04-24 15:14:01 -0500125 return BS_DEV_INIT_CHIPS;
126}
127
128static boot_state_t bs_dev_init_chips(void *arg)
129{
130 timestamp_stash(TS_DEVICE_ENUMERATE);
131
132 /* Initialize chips early, they might disable unused devices. */
133 dev_initialize_chips();
134
135 return BS_DEV_ENUMERATE;
136}
137
138static boot_state_t bs_dev_enumerate(void *arg)
139{
140 /* Find the devices we don't have hard coded knowledge about. */
141 dev_enumerate();
142 post_code(POST_DEVICE_ENUMERATION_COMPLETE);
143
144 return BS_DEV_RESOURCES;
145}
146
147static boot_state_t bs_dev_resources(void *arg)
148{
149 timestamp_stash(TS_DEVICE_CONFIGURE);
150 /* Now compute and assign the bus resources. */
151 dev_configure();
152 post_code(POST_DEVICE_CONFIGURATION_COMPLETE);
153
154 return BS_DEV_ENABLE;
155}
156
157static boot_state_t bs_dev_eanble(void *arg)
158{
159 timestamp_stash(TS_DEVICE_ENABLE);
160 /* Now actually enable devices on the bus */
161 dev_enable();
162 post_code(POST_DEVICES_ENABLED);
163
164 return BS_DEV_INIT;
165}
166
167static boot_state_t bs_dev_init(void *arg)
168{
169 timestamp_stash(TS_DEVICE_INITIALIZE);
170 /* And of course initialize devices on the bus */
171 dev_initialize();
172 post_code(POST_DEVICES_INITIALIZED);
173
174 return BS_POST_DEVICE;
175}
176
177static boot_state_t bs_post_device(void *arg)
178{
179 timestamp_stash(TS_DEVICE_DONE);
180
Aaron Durbin7e35efa2013-04-24 15:14:01 -0500181 timestamp_sync();
182
Aaron Durbin0a6c20a2013-04-24 22:33:08 -0500183 return BS_OS_RESUME_CHECK;
Aaron Durbin7e35efa2013-04-24 15:14:01 -0500184}
185
Aaron Durbin0a6c20a2013-04-24 22:33:08 -0500186static boot_state_t bs_os_resume_check(void *arg)
Aaron Durbin7e35efa2013-04-24 15:14:01 -0500187{
188#if CONFIG_HAVE_ACPI_RESUME
Aaron Durbin0a6c20a2013-04-24 22:33:08 -0500189 void *wake_vector;
190
191 wake_vector = acpi_find_wakeup_vector();
192
193 if (wake_vector != NULL) {
194 boot_states[BS_OS_RESUME].arg = wake_vector;
195 return BS_OS_RESUME;
196 }
Aaron Durbin7e35efa2013-04-24 15:14:01 -0500197 post_code(0x8a);
198#endif
Aaron Durbin7e35efa2013-04-24 15:14:01 -0500199 timestamp_add_now(TS_CBMEM_POST);
200
201 return BS_WRITE_TABLES;
202}
203
Aaron Durbin0a6c20a2013-04-24 22:33:08 -0500204static boot_state_t bs_os_resume(void *wake_vector)
205{
206#if CONFIG_HAVE_ACPI_RESUME
207 acpi_resume(wake_vector);
208#endif
209 return BS_WRITE_TABLES;
210}
211
Aaron Durbin7e35efa2013-04-24 15:14:01 -0500212static boot_state_t bs_write_tables(void *arg)
213{
Aaron Durbin7e35efa2013-04-24 15:14:01 -0500214 timestamp_add_now(TS_WRITE_TABLES);
215
216 /* Now that we have collected all of our information
217 * write our configuration tables.
218 */
219 write_tables();
220
221 return BS_PAYLOAD_LOAD;
222}
223
224static boot_state_t bs_payload_load(void *arg)
225{
226 void *payload;
Aaron Durbin001de1a2013-04-24 22:59:45 -0500227 void *entry;
Aaron Durbin7e35efa2013-04-24 15:14:01 -0500228
229 timestamp_add_now(TS_LOAD_PAYLOAD);
230
231 payload = cbfs_load_payload(CBFS_DEFAULT_MEDIA,
232 CONFIG_CBFS_PREFIX "/payload");
233 if (! payload)
234 die("Could not find a payload\n");
235
Aaron Durbin001de1a2013-04-24 22:59:45 -0500236 entry = selfload(get_lb_mem(), payload);
237
238 if (! entry)
239 die("Could not load payload\n");
240
Aaron Durbin7e35efa2013-04-24 15:14:01 -0500241 /* Pass the payload to the next state. */
Aaron Durbin001de1a2013-04-24 22:59:45 -0500242 boot_states[BS_PAYLOAD_BOOT].arg = entry;
Aaron Durbin7e35efa2013-04-24 15:14:01 -0500243
244 return BS_PAYLOAD_BOOT;
245}
246
Aaron Durbin001de1a2013-04-24 22:59:45 -0500247static boot_state_t bs_payload_boot(void *entry)
Aaron Durbin7e35efa2013-04-24 15:14:01 -0500248{
Aaron Durbin001de1a2013-04-24 22:59:45 -0500249 selfboot(entry);
Aaron Durbin7e35efa2013-04-24 15:14:01 -0500250
251 printk(BIOS_EMERG, "Boot failed");
252 /* Returning from this state will fail because the following signals
253 * return to a completed state. */
254 return BS_PAYLOAD_BOOT;
255}
256
Aaron Durbin6b0fb0d2013-04-26 20:54:16 -0500257#if CONFIG_HAVE_MONOTONIC_TIMER
258static void bs_sample_time(struct boot_state *state)
259{
260 struct mono_time *mt;
261
262 mt = &state->times.samples[state->times.num_samples];
263 timer_monotonic_get(mt);
264 state->times.num_samples++;
265}
266
267static void bs_report_time(struct boot_state *state)
268{
269 struct rela_time entry_time;
270 struct rela_time run_time;
271 struct rela_time exit_time;
272 struct boot_state_times *times;
273
274 times = &state->times;
275 entry_time = mono_time_diff(&times->samples[0], &times->samples[1]);
276 run_time = mono_time_diff(&times->samples[1], &times->samples[2]);
277 exit_time = mono_time_diff(&times->samples[2], &times->samples[3]);
278
279 printk(BIOS_DEBUG, "BS: %s times (us): entry %ld run %ld exit %ld\n",
280 state->name,
281 rela_time_in_microseconds(&entry_time),
282 rela_time_in_microseconds(&run_time),
283 rela_time_in_microseconds(&exit_time));
284}
285#else
286static inline void bs_sample_time(struct boot_state *state) {}
287static inline void bs_report_time(struct boot_state *state) {}
288#endif
289
Aaron Durbin8fc41e12013-04-29 23:22:01 -0500290#if CONFIG_TIMER_QUEUE
291static void bs_run_timers(int drain)
292{
293 /* Drain all timer callbacks until none are left, if directed.
294 * Otherwise run the timers only once. */
295 do {
296 if (!timers_run())
297 break;
298 } while (drain);
299}
300#else
301static void bs_run_timers(int drain) {}
302#endif
303
Aaron Durbin7e35efa2013-04-24 15:14:01 -0500304static void bs_call_callbacks(struct boot_state *state,
305 boot_state_sequence_t seq)
306{
Aaron Durbin0748d302013-05-06 10:50:19 -0500307 struct boot_phase *phase = &state->phases[seq];
Aaron Durbin7e35efa2013-04-24 15:14:01 -0500308
Aaron Durbin0748d302013-05-06 10:50:19 -0500309 while (1) {
310 if (phase->callbacks != NULL) {
311 struct boot_state_callback *bscb;
312
313 /* Remove the first callback. */
314 bscb = phase->callbacks;
315 phase->callbacks = bscb->next;
316 bscb->next = NULL;
Aaron Durbin7e35efa2013-04-24 15:14:01 -0500317
318#if BOOT_STATE_DEBUG
Aaron Durbin0748d302013-05-06 10:50:19 -0500319 printk(BS_DEBUG_LVL, "BS: callback (%p) @ %s.\n",
320 bscb, bscb->location);
Aaron Durbin7e35efa2013-04-24 15:14:01 -0500321#endif
Aaron Durbin0748d302013-05-06 10:50:19 -0500322 bscb->callback(bscb->arg);
323
324 continue;
325 }
326
327 /* All callbacks are complete and there are no blockers for
328 * this state. Therefore, this part of the state is complete. */
329 if (!phase->blockers)
330 break;
331
332 /* Something is blocking this state from transitioning. As
333 * there are no more callbacks a pending timer needs to be
334 * ran to unblock the state. */
335 bs_run_timers(0);
Aaron Durbin7e35efa2013-04-24 15:14:01 -0500336 }
337}
338
Aaron Durbin0748d302013-05-06 10:50:19 -0500339/* Keep track of the current state. */
340static struct state_tracker {
341 boot_state_t state_id;
342 boot_state_sequence_t seq;
343} current_phase = {
344 .state_id = BS_PRE_DEVICE,
345 .seq = BS_ON_ENTRY,
346};
347
348static void bs_walk_state_machine(void)
Aaron Durbin7e35efa2013-04-24 15:14:01 -0500349{
350
351 while (1) {
352 struct boot_state *state;
Aaron Durbin0748d302013-05-06 10:50:19 -0500353 boot_state_t next_id;
Aaron Durbin7e35efa2013-04-24 15:14:01 -0500354
Aaron Durbin0748d302013-05-06 10:50:19 -0500355 state = &boot_states[current_phase.state_id];
Aaron Durbin7e35efa2013-04-24 15:14:01 -0500356
357 if (state->complete) {
358 printk(BIOS_EMERG, "BS: %s state already executed.\n",
359 state->name);
360 break;
361 }
362
363 printk(BS_DEBUG_LVL, "BS: Entering %s state.\n", state->name);
Aaron Durbin6b0fb0d2013-04-26 20:54:16 -0500364
Aaron Durbin15c671e2013-05-06 10:52:24 -0500365 bs_run_timers(0);
Aaron Durbin8fc41e12013-04-29 23:22:01 -0500366
Aaron Durbin6b0fb0d2013-04-26 20:54:16 -0500367 bs_sample_time(state);
368
Aaron Durbin0748d302013-05-06 10:50:19 -0500369 bs_call_callbacks(state, current_phase.seq);
370 /* Update the current sequence so that any calls to block the
371 * current state from the run_state() function will place a
372 * block on the correct phase. */
373 current_phase.seq = BS_ON_EXIT;
Aaron Durbin7e35efa2013-04-24 15:14:01 -0500374
Aaron Durbin6b0fb0d2013-04-26 20:54:16 -0500375 bs_sample_time(state);
376
Aaron Durbin0748d302013-05-06 10:50:19 -0500377 next_id = state->run_state(state->arg);
Aaron Durbin7e35efa2013-04-24 15:14:01 -0500378
379 printk(BS_DEBUG_LVL, "BS: Exiting %s state.\n", state->name);
Aaron Durbin6b0fb0d2013-04-26 20:54:16 -0500380
381 bs_sample_time(state);
382
Aaron Durbin0748d302013-05-06 10:50:19 -0500383 bs_call_callbacks(state, current_phase.seq);
384
385 /* Update the current phase with new state id and sequence. */
386 current_phase.state_id = next_id;
387 current_phase.seq = BS_ON_ENTRY;
Aaron Durbin7e35efa2013-04-24 15:14:01 -0500388
Aaron Durbin6b0fb0d2013-04-26 20:54:16 -0500389 bs_sample_time(state);
390
391 bs_report_time(state);
392
Aaron Durbin7e35efa2013-04-24 15:14:01 -0500393 state->complete = 1;
394 }
395}
396
397static int boot_state_sched_callback(struct boot_state *state,
398 struct boot_state_callback *bscb,
399 boot_state_sequence_t seq)
400{
401 if (state->complete) {
402 printk(BIOS_WARNING,
403 "Tried to schedule callback on completed state %s.\n",
404 state->name);
405
406 return -1;
407 }
408
Aaron Durbin0748d302013-05-06 10:50:19 -0500409 bscb->next = state->phases[seq].callbacks;
410 state->phases[seq].callbacks = bscb;
Aaron Durbin7e35efa2013-04-24 15:14:01 -0500411
412 return 0;
413}
414
415int boot_state_sched_on_entry(struct boot_state_callback *bscb,
416 boot_state_t state_id)
417{
418 struct boot_state *state = &boot_states[state_id];
419
420 return boot_state_sched_callback(state, bscb, BS_ON_ENTRY);
421}
422
423int boot_state_sched_on_exit(struct boot_state_callback *bscb,
424 boot_state_t state_id)
425{
426 struct boot_state *state = &boot_states[state_id];
427
428 return boot_state_sched_callback(state, bscb, BS_ON_EXIT);
429}
Maciej Pijankaea921852009-10-27 14:29:29 +0000430
Aaron Durbina4feddf2013-04-24 16:12:52 -0500431static void boot_state_schedule_static_entries(void)
432{
433 extern struct boot_state_init_entry _bs_init_begin;
434 extern struct boot_state_init_entry _bs_init_end;
435 struct boot_state_init_entry *cur;
436
437 cur = &_bs_init_begin;
438
439 while (cur != &_bs_init_end) {
440 if (cur->when == BS_ON_ENTRY)
441 boot_state_sched_on_entry(&cur->bscb, cur->state);
442 else
443 boot_state_sched_on_exit(&cur->bscb, cur->state);
444 cur++;
445 }
446}
447
Stefan Reinauer2a3c1062013-05-06 16:49:56 -0700448void hardwaremain(void)
Eric Biederman8ca8d762003-04-22 19:02:15 +0000449{
Stefan Reinauer4221a192012-10-15 15:23:20 -0700450 timestamp_stash(TS_START_RAMSTAGE);
Alexandru Gagniuc5005bb062011-04-11 20:17:22 +0000451 post_code(POST_ENTRY_RAMSTAGE);
Li-Ta Lo6a8745ae2004-05-13 20:39:07 +0000452
Stefan Reinauer3b314022009-10-26 17:04:28 +0000453 /* console_init() MUST PRECEDE ALL printk()! */
Eric Biederman8ca8d762003-04-22 19:02:15 +0000454 console_init();
Stefan Reinauer14e22772010-04-27 06:56:47 +0000455
Alexandru Gagniuc5005bb062011-04-11 20:17:22 +0000456 post_code(POST_CONSOLE_READY);
arch import user (historical)54d6b082005-07-06 17:17:41 +0000457
Stefan Reinauer2a3c1062013-05-06 16:49:56 -0700458 printk(BIOS_NOTICE, "coreboot-%s%s %s booting...\n",
459 coreboot_version, coreboot_extra_version, coreboot_build);
Eric Biederman8ca8d762003-04-22 19:02:15 +0000460
Alexandru Gagniuc5005bb062011-04-11 20:17:22 +0000461 post_code(POST_CONSOLE_BOOT_MSG);
Eric Biederman8ca8d762003-04-22 19:02:15 +0000462
Aaron Durbin4409a5e2013-05-06 12:20:52 -0500463 threads_initialize();
464
Aaron Durbina4feddf2013-04-24 16:12:52 -0500465 /* Schedule the static boot state entries. */
466 boot_state_schedule_static_entries();
467
Eric Biederman7003ba42004-10-16 06:20:29 +0000468 /* FIXME: Is there a better way to handle this? */
Stefan Reinauer14e22772010-04-27 06:56:47 +0000469 init_timer();
Eric Biederman8ca8d762003-04-22 19:02:15 +0000470
Aaron Durbin0748d302013-05-06 10:50:19 -0500471 bs_walk_state_machine();
472
Aaron Durbin7e35efa2013-04-24 15:14:01 -0500473 die("Boot state machine failure.\n");
Eric Biederman8ca8d762003-04-22 19:02:15 +0000474}
475
Aaron Durbin0748d302013-05-06 10:50:19 -0500476
477int boot_state_block(boot_state_t state, boot_state_sequence_t seq)
478{
479 struct boot_phase *bp;
480
481 /* Blocking a previously ran state is not appropriate. */
482 if (current_phase.state_id > state ||
483 (current_phase.state_id == state && current_phase.seq > seq) ) {
484 printk(BIOS_WARNING,
485 "BS: Completed state (%d, %d) block attempted.\n",
486 state, seq);
487 return -1;
488 }
489
490 bp = &boot_states[state].phases[seq];
491 bp->blockers++;
492
493 return 0;
494}
495
496int boot_state_unblock(boot_state_t state, boot_state_sequence_t seq)
497{
498 struct boot_phase *bp;
499
500 /* Blocking a previously ran state is not appropriate. */
501 if (current_phase.state_id > state ||
502 (current_phase.state_id == state && current_phase.seq > seq) ) {
503 printk(BIOS_WARNING,
504 "BS: Completed state (%d, %d) unblock attempted.\n",
505 state, seq);
506 return -1;
507 }
508
509 bp = &boot_states[state].phases[seq];
510
511 if (bp->blockers == 0) {
512 printk(BIOS_WARNING,
513 "BS: Unblock attempted on non-blocked state (%d, %d).\n",
514 state, seq);
515 return -1;
516 }
517
518 bp->blockers--;
519
520 return 0;
521}
522
523void boot_state_current_block(void)
524{
525 boot_state_block(current_phase.state_id, current_phase.seq);
526}
527
528void boot_state_current_unblock(void)
529{
530 boot_state_unblock(current_phase.state_id, current_phase.seq);
531}