Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 1 | /* |
Aaron Durbin | 7e35efa | 2013-04-24 15:14:01 -0500 | [diff] [blame] | 2 | * 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 Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 18 | */ |
| 19 | |
| 20 | |
| 21 | /* |
Stefan Reinauer | f8ee180 | 2008-01-18 15:08:58 +0000 | [diff] [blame] | 22 | * C Bootstrap code for the coreboot |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 23 | */ |
| 24 | |
Aaron Durbin | 7e35efa | 2013-04-24 15:14:01 -0500 | [diff] [blame] | 25 | #include <bootstate.h> |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 26 | #include <console/console.h> |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 27 | #include <version.h> |
Eric Biederman | 5899fd8 | 2003-04-24 06:25:08 +0000 | [diff] [blame] | 28 | #include <device/device.h> |
| 29 | #include <device/pci.h> |
Eric Biederman | 9b4336c | 2003-07-19 04:28:22 +0000 | [diff] [blame] | 30 | #include <delay.h> |
Eric Biederman | b78c197 | 2004-10-14 20:54:17 +0000 | [diff] [blame] | 31 | #include <stdlib.h> |
Stefan Reinauer | de3206a | 2010-02-22 06:09:43 +0000 | [diff] [blame] | 32 | #include <reset.h> |
Stefan Reinauer | 7e9771c | 2009-04-22 08:17:38 +0000 | [diff] [blame] | 33 | #include <boot/tables.h> |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 34 | #include <boot/elf.h> |
Peter Stuge | 483b7bb | 2009-04-14 07:40:01 +0000 | [diff] [blame] | 35 | #include <cbfs.h> |
Ronald G. Minnich | 9764d4c | 2012-06-12 16:29:32 -0700 | [diff] [blame] | 36 | #include <lib.h> |
Stefan Reinauer | 0867062 | 2009-06-30 15:17:49 +0000 | [diff] [blame] | 37 | #if CONFIG_HAVE_ACPI_RESUME |
Rudolf Marek | a572f83 | 2009-04-13 17:57:44 +0000 | [diff] [blame] | 38 | #include <arch/acpi.h> |
Stefan Reinauer | 3935b19 | 2009-04-14 06:38:15 +0000 | [diff] [blame] | 39 | #endif |
Aaron Durbin | 6b0fb0d | 2013-04-26 20:54:16 -0500 | [diff] [blame^] | 40 | #include <timer.h> |
Stefan Reinauer | bf729ba | 2011-11-04 12:31:58 -0700 | [diff] [blame] | 41 | #include <timestamp.h> |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 42 | |
Aaron Durbin | 7e35efa | 2013-04-24 15:14:01 -0500 | [diff] [blame] | 43 | #if BOOT_STATE_DEBUG |
| 44 | #define BS_DEBUG_LVL BIOS_DEBUG |
| 45 | #else |
| 46 | #define BS_DEBUG_LVL BIOS_NEVER |
| 47 | #endif |
Rudolf Marek | a572f83 | 2009-04-13 17:57:44 +0000 | [diff] [blame] | 48 | |
Aaron Durbin | 7e35efa | 2013-04-24 15:14:01 -0500 | [diff] [blame] | 49 | static boot_state_t bs_pre_device(void *arg); |
| 50 | static boot_state_t bs_dev_init_chips(void *arg); |
| 51 | static boot_state_t bs_dev_enumerate(void *arg); |
| 52 | static boot_state_t bs_dev_resources(void *arg); |
| 53 | static boot_state_t bs_dev_eanble(void *arg); |
| 54 | static boot_state_t bs_dev_init(void *arg); |
| 55 | static boot_state_t bs_post_device(void *arg); |
Aaron Durbin | 0a6c20a | 2013-04-24 22:33:08 -0500 | [diff] [blame] | 56 | static boot_state_t bs_os_resume_check(void *arg); |
Aaron Durbin | 7e35efa | 2013-04-24 15:14:01 -0500 | [diff] [blame] | 57 | static boot_state_t bs_os_resume(void *arg); |
| 58 | static boot_state_t bs_write_tables(void *arg); |
| 59 | static boot_state_t bs_payload_load(void *arg); |
| 60 | static boot_state_t bs_payload_boot(void *arg); |
| 61 | |
Aaron Durbin | 6b0fb0d | 2013-04-26 20:54:16 -0500 | [diff] [blame^] | 62 | /* |
| 63 | * Typically a state will take 4 time samples: |
| 64 | * 1. Before state entry callbacks |
| 65 | * 2. After state entry callbacks / Before state function. |
| 66 | * 3. After state function / Before state exit callbacks. |
| 67 | * 4. After state exit callbacks. |
| 68 | */ |
| 69 | #define MAX_TIME_SAMPLES 4 |
| 70 | struct boot_state_times { |
| 71 | int num_samples; |
| 72 | struct mono_time samples[MAX_TIME_SAMPLES]; |
| 73 | }; |
| 74 | |
Aaron Durbin | 7e35efa | 2013-04-24 15:14:01 -0500 | [diff] [blame] | 75 | struct boot_state { |
| 76 | const char *name; |
| 77 | boot_state_t id; |
| 78 | struct boot_state_callback *seq_callbacks[2]; |
| 79 | boot_state_t (*run_state)(void *arg); |
| 80 | void *arg; |
| 81 | int complete; |
Aaron Durbin | 6b0fb0d | 2013-04-26 20:54:16 -0500 | [diff] [blame^] | 82 | #if CONFIG_HAVE_MONOTONIC_TIMER |
| 83 | struct boot_state_times times; |
| 84 | #endif |
Aaron Durbin | 7e35efa | 2013-04-24 15:14:01 -0500 | [diff] [blame] | 85 | }; |
| 86 | |
| 87 | #define BS_INIT(state_, run_func_) \ |
| 88 | { \ |
| 89 | .name = #state_, \ |
| 90 | .id = state_, \ |
| 91 | .seq_callbacks = { NULL, NULL },\ |
| 92 | .run_state = run_func_, \ |
| 93 | .arg = NULL, \ |
| 94 | .complete = 0 \ |
| 95 | } |
| 96 | #define BS_INIT_ENTRY(state_, run_func_) \ |
| 97 | [state_] = BS_INIT(state_, run_func_) |
| 98 | |
| 99 | static struct boot_state boot_states[] = { |
| 100 | BS_INIT_ENTRY(BS_PRE_DEVICE, bs_pre_device), |
| 101 | BS_INIT_ENTRY(BS_DEV_INIT_CHIPS, bs_dev_init_chips), |
| 102 | BS_INIT_ENTRY(BS_DEV_ENUMERATE, bs_dev_enumerate), |
| 103 | BS_INIT_ENTRY(BS_DEV_RESOURCES, bs_dev_resources), |
| 104 | BS_INIT_ENTRY(BS_DEV_ENABLE, bs_dev_eanble), |
| 105 | BS_INIT_ENTRY(BS_DEV_INIT, bs_dev_init), |
| 106 | BS_INIT_ENTRY(BS_POST_DEVICE, bs_post_device), |
Aaron Durbin | 0a6c20a | 2013-04-24 22:33:08 -0500 | [diff] [blame] | 107 | BS_INIT_ENTRY(BS_OS_RESUME_CHECK, bs_os_resume_check), |
Aaron Durbin | 7e35efa | 2013-04-24 15:14:01 -0500 | [diff] [blame] | 108 | BS_INIT_ENTRY(BS_OS_RESUME, bs_os_resume), |
| 109 | BS_INIT_ENTRY(BS_WRITE_TABLES, bs_write_tables), |
| 110 | BS_INIT_ENTRY(BS_PAYLOAD_LOAD, bs_payload_load), |
| 111 | BS_INIT_ENTRY(BS_PAYLOAD_BOOT, bs_payload_boot), |
| 112 | }; |
| 113 | |
| 114 | static boot_state_t bs_pre_device(void *arg) |
| 115 | { |
Aaron Durbin | 7e35efa | 2013-04-24 15:14:01 -0500 | [diff] [blame] | 116 | return BS_DEV_INIT_CHIPS; |
| 117 | } |
| 118 | |
| 119 | static boot_state_t bs_dev_init_chips(void *arg) |
| 120 | { |
| 121 | timestamp_stash(TS_DEVICE_ENUMERATE); |
| 122 | |
| 123 | /* Initialize chips early, they might disable unused devices. */ |
| 124 | dev_initialize_chips(); |
| 125 | |
| 126 | return BS_DEV_ENUMERATE; |
| 127 | } |
| 128 | |
| 129 | static boot_state_t bs_dev_enumerate(void *arg) |
| 130 | { |
| 131 | /* Find the devices we don't have hard coded knowledge about. */ |
| 132 | dev_enumerate(); |
| 133 | post_code(POST_DEVICE_ENUMERATION_COMPLETE); |
| 134 | |
| 135 | return BS_DEV_RESOURCES; |
| 136 | } |
| 137 | |
| 138 | static boot_state_t bs_dev_resources(void *arg) |
| 139 | { |
| 140 | timestamp_stash(TS_DEVICE_CONFIGURE); |
| 141 | /* Now compute and assign the bus resources. */ |
| 142 | dev_configure(); |
| 143 | post_code(POST_DEVICE_CONFIGURATION_COMPLETE); |
| 144 | |
| 145 | return BS_DEV_ENABLE; |
| 146 | } |
| 147 | |
| 148 | static boot_state_t bs_dev_eanble(void *arg) |
| 149 | { |
| 150 | timestamp_stash(TS_DEVICE_ENABLE); |
| 151 | /* Now actually enable devices on the bus */ |
| 152 | dev_enable(); |
| 153 | post_code(POST_DEVICES_ENABLED); |
| 154 | |
| 155 | return BS_DEV_INIT; |
| 156 | } |
| 157 | |
| 158 | static boot_state_t bs_dev_init(void *arg) |
| 159 | { |
| 160 | timestamp_stash(TS_DEVICE_INITIALIZE); |
| 161 | /* And of course initialize devices on the bus */ |
| 162 | dev_initialize(); |
| 163 | post_code(POST_DEVICES_INITIALIZED); |
| 164 | |
| 165 | return BS_POST_DEVICE; |
| 166 | } |
| 167 | |
| 168 | static boot_state_t bs_post_device(void *arg) |
| 169 | { |
| 170 | timestamp_stash(TS_DEVICE_DONE); |
| 171 | |
Aaron Durbin | 7e35efa | 2013-04-24 15:14:01 -0500 | [diff] [blame] | 172 | timestamp_sync(); |
| 173 | |
Aaron Durbin | 0a6c20a | 2013-04-24 22:33:08 -0500 | [diff] [blame] | 174 | return BS_OS_RESUME_CHECK; |
Aaron Durbin | 7e35efa | 2013-04-24 15:14:01 -0500 | [diff] [blame] | 175 | } |
| 176 | |
Aaron Durbin | 0a6c20a | 2013-04-24 22:33:08 -0500 | [diff] [blame] | 177 | static boot_state_t bs_os_resume_check(void *arg) |
Aaron Durbin | 7e35efa | 2013-04-24 15:14:01 -0500 | [diff] [blame] | 178 | { |
| 179 | #if CONFIG_HAVE_ACPI_RESUME |
Aaron Durbin | 0a6c20a | 2013-04-24 22:33:08 -0500 | [diff] [blame] | 180 | void *wake_vector; |
| 181 | |
| 182 | wake_vector = acpi_find_wakeup_vector(); |
| 183 | |
| 184 | if (wake_vector != NULL) { |
| 185 | boot_states[BS_OS_RESUME].arg = wake_vector; |
| 186 | return BS_OS_RESUME; |
| 187 | } |
Aaron Durbin | 7e35efa | 2013-04-24 15:14:01 -0500 | [diff] [blame] | 188 | post_code(0x8a); |
| 189 | #endif |
Aaron Durbin | 7e35efa | 2013-04-24 15:14:01 -0500 | [diff] [blame] | 190 | timestamp_add_now(TS_CBMEM_POST); |
| 191 | |
| 192 | return BS_WRITE_TABLES; |
| 193 | } |
| 194 | |
Aaron Durbin | 0a6c20a | 2013-04-24 22:33:08 -0500 | [diff] [blame] | 195 | static boot_state_t bs_os_resume(void *wake_vector) |
| 196 | { |
| 197 | #if CONFIG_HAVE_ACPI_RESUME |
| 198 | acpi_resume(wake_vector); |
| 199 | #endif |
| 200 | return BS_WRITE_TABLES; |
| 201 | } |
| 202 | |
Aaron Durbin | 7e35efa | 2013-04-24 15:14:01 -0500 | [diff] [blame] | 203 | static boot_state_t bs_write_tables(void *arg) |
| 204 | { |
Aaron Durbin | 7e35efa | 2013-04-24 15:14:01 -0500 | [diff] [blame] | 205 | timestamp_add_now(TS_WRITE_TABLES); |
| 206 | |
| 207 | /* Now that we have collected all of our information |
| 208 | * write our configuration tables. |
| 209 | */ |
| 210 | write_tables(); |
| 211 | |
| 212 | return BS_PAYLOAD_LOAD; |
| 213 | } |
| 214 | |
| 215 | static boot_state_t bs_payload_load(void *arg) |
| 216 | { |
| 217 | void *payload; |
Aaron Durbin | 001de1a | 2013-04-24 22:59:45 -0500 | [diff] [blame] | 218 | void *entry; |
Aaron Durbin | 7e35efa | 2013-04-24 15:14:01 -0500 | [diff] [blame] | 219 | |
| 220 | timestamp_add_now(TS_LOAD_PAYLOAD); |
| 221 | |
| 222 | payload = cbfs_load_payload(CBFS_DEFAULT_MEDIA, |
| 223 | CONFIG_CBFS_PREFIX "/payload"); |
| 224 | if (! payload) |
| 225 | die("Could not find a payload\n"); |
| 226 | |
Aaron Durbin | 001de1a | 2013-04-24 22:59:45 -0500 | [diff] [blame] | 227 | entry = selfload(get_lb_mem(), payload); |
| 228 | |
| 229 | if (! entry) |
| 230 | die("Could not load payload\n"); |
| 231 | |
Aaron Durbin | 7e35efa | 2013-04-24 15:14:01 -0500 | [diff] [blame] | 232 | /* Pass the payload to the next state. */ |
Aaron Durbin | 001de1a | 2013-04-24 22:59:45 -0500 | [diff] [blame] | 233 | boot_states[BS_PAYLOAD_BOOT].arg = entry; |
Aaron Durbin | 7e35efa | 2013-04-24 15:14:01 -0500 | [diff] [blame] | 234 | |
| 235 | return BS_PAYLOAD_BOOT; |
| 236 | } |
| 237 | |
Aaron Durbin | 001de1a | 2013-04-24 22:59:45 -0500 | [diff] [blame] | 238 | static boot_state_t bs_payload_boot(void *entry) |
Aaron Durbin | 7e35efa | 2013-04-24 15:14:01 -0500 | [diff] [blame] | 239 | { |
Aaron Durbin | 001de1a | 2013-04-24 22:59:45 -0500 | [diff] [blame] | 240 | selfboot(entry); |
Aaron Durbin | 7e35efa | 2013-04-24 15:14:01 -0500 | [diff] [blame] | 241 | |
| 242 | printk(BIOS_EMERG, "Boot failed"); |
| 243 | /* Returning from this state will fail because the following signals |
| 244 | * return to a completed state. */ |
| 245 | return BS_PAYLOAD_BOOT; |
| 246 | } |
| 247 | |
Aaron Durbin | 6b0fb0d | 2013-04-26 20:54:16 -0500 | [diff] [blame^] | 248 | #if CONFIG_HAVE_MONOTONIC_TIMER |
| 249 | static void bs_sample_time(struct boot_state *state) |
| 250 | { |
| 251 | struct mono_time *mt; |
| 252 | |
| 253 | mt = &state->times.samples[state->times.num_samples]; |
| 254 | timer_monotonic_get(mt); |
| 255 | state->times.num_samples++; |
| 256 | } |
| 257 | |
| 258 | static void bs_report_time(struct boot_state *state) |
| 259 | { |
| 260 | struct rela_time entry_time; |
| 261 | struct rela_time run_time; |
| 262 | struct rela_time exit_time; |
| 263 | struct boot_state_times *times; |
| 264 | |
| 265 | times = &state->times; |
| 266 | entry_time = mono_time_diff(×->samples[0], ×->samples[1]); |
| 267 | run_time = mono_time_diff(×->samples[1], ×->samples[2]); |
| 268 | exit_time = mono_time_diff(×->samples[2], ×->samples[3]); |
| 269 | |
| 270 | printk(BIOS_DEBUG, "BS: %s times (us): entry %ld run %ld exit %ld\n", |
| 271 | state->name, |
| 272 | rela_time_in_microseconds(&entry_time), |
| 273 | rela_time_in_microseconds(&run_time), |
| 274 | rela_time_in_microseconds(&exit_time)); |
| 275 | } |
| 276 | #else |
| 277 | static inline void bs_sample_time(struct boot_state *state) {} |
| 278 | static inline void bs_report_time(struct boot_state *state) {} |
| 279 | #endif |
| 280 | |
Aaron Durbin | 7e35efa | 2013-04-24 15:14:01 -0500 | [diff] [blame] | 281 | static void bs_call_callbacks(struct boot_state *state, |
| 282 | boot_state_sequence_t seq) |
| 283 | { |
| 284 | while (state->seq_callbacks[seq] != NULL) { |
| 285 | struct boot_state_callback *bscb; |
| 286 | |
| 287 | /* Remove the first callback. */ |
| 288 | bscb = state->seq_callbacks[seq]; |
| 289 | state->seq_callbacks[seq] = bscb->next; |
| 290 | bscb->next = NULL; |
| 291 | |
| 292 | #if BOOT_STATE_DEBUG |
| 293 | printk(BS_DEBUG_LVL, "BS: callback (%p) @ %s.\n", |
| 294 | bscb, bscb->location); |
| 295 | #endif |
| 296 | bscb->callback(bscb->arg); |
| 297 | } |
| 298 | } |
| 299 | |
| 300 | static void bs_walk_state_machine(boot_state_t current_state_id) |
| 301 | { |
| 302 | |
| 303 | while (1) { |
| 304 | struct boot_state *state; |
| 305 | |
| 306 | state = &boot_states[current_state_id]; |
| 307 | |
| 308 | if (state->complete) { |
| 309 | printk(BIOS_EMERG, "BS: %s state already executed.\n", |
| 310 | state->name); |
| 311 | break; |
| 312 | } |
| 313 | |
| 314 | printk(BS_DEBUG_LVL, "BS: Entering %s state.\n", state->name); |
Aaron Durbin | 6b0fb0d | 2013-04-26 20:54:16 -0500 | [diff] [blame^] | 315 | |
| 316 | bs_sample_time(state); |
| 317 | |
Aaron Durbin | 7e35efa | 2013-04-24 15:14:01 -0500 | [diff] [blame] | 318 | bs_call_callbacks(state, BS_ON_ENTRY); |
| 319 | |
Aaron Durbin | 6b0fb0d | 2013-04-26 20:54:16 -0500 | [diff] [blame^] | 320 | bs_sample_time(state); |
| 321 | |
Aaron Durbin | 7e35efa | 2013-04-24 15:14:01 -0500 | [diff] [blame] | 322 | current_state_id = state->run_state(state->arg); |
| 323 | |
| 324 | printk(BS_DEBUG_LVL, "BS: Exiting %s state.\n", state->name); |
Aaron Durbin | 6b0fb0d | 2013-04-26 20:54:16 -0500 | [diff] [blame^] | 325 | |
| 326 | bs_sample_time(state); |
| 327 | |
Aaron Durbin | 7e35efa | 2013-04-24 15:14:01 -0500 | [diff] [blame] | 328 | bs_call_callbacks(state, BS_ON_EXIT); |
| 329 | |
Aaron Durbin | 6b0fb0d | 2013-04-26 20:54:16 -0500 | [diff] [blame^] | 330 | bs_sample_time(state); |
| 331 | |
| 332 | bs_report_time(state); |
| 333 | |
Aaron Durbin | 7e35efa | 2013-04-24 15:14:01 -0500 | [diff] [blame] | 334 | state->complete = 1; |
| 335 | } |
| 336 | } |
| 337 | |
| 338 | static int boot_state_sched_callback(struct boot_state *state, |
| 339 | struct boot_state_callback *bscb, |
| 340 | boot_state_sequence_t seq) |
| 341 | { |
| 342 | if (state->complete) { |
| 343 | printk(BIOS_WARNING, |
| 344 | "Tried to schedule callback on completed state %s.\n", |
| 345 | state->name); |
| 346 | |
| 347 | return -1; |
| 348 | } |
| 349 | |
| 350 | bscb->next = state->seq_callbacks[seq]; |
| 351 | state->seq_callbacks[seq] = bscb; |
| 352 | |
| 353 | return 0; |
| 354 | } |
| 355 | |
| 356 | int boot_state_sched_on_entry(struct boot_state_callback *bscb, |
| 357 | boot_state_t state_id) |
| 358 | { |
| 359 | struct boot_state *state = &boot_states[state_id]; |
| 360 | |
| 361 | return boot_state_sched_callback(state, bscb, BS_ON_ENTRY); |
| 362 | } |
| 363 | |
| 364 | int boot_state_sched_on_exit(struct boot_state_callback *bscb, |
| 365 | boot_state_t state_id) |
| 366 | { |
| 367 | struct boot_state *state = &boot_states[state_id]; |
| 368 | |
| 369 | return boot_state_sched_callback(state, bscb, BS_ON_EXIT); |
| 370 | } |
Maciej Pijanka | ea92185 | 2009-10-27 14:29:29 +0000 | [diff] [blame] | 371 | |
Aaron Durbin | a4feddf | 2013-04-24 16:12:52 -0500 | [diff] [blame] | 372 | static void boot_state_schedule_static_entries(void) |
| 373 | { |
| 374 | extern struct boot_state_init_entry _bs_init_begin; |
| 375 | extern struct boot_state_init_entry _bs_init_end; |
| 376 | struct boot_state_init_entry *cur; |
| 377 | |
| 378 | cur = &_bs_init_begin; |
| 379 | |
| 380 | while (cur != &_bs_init_end) { |
| 381 | if (cur->when == BS_ON_ENTRY) |
| 382 | boot_state_sched_on_entry(&cur->bscb, cur->state); |
| 383 | else |
| 384 | boot_state_sched_on_exit(&cur->bscb, cur->state); |
| 385 | cur++; |
| 386 | } |
| 387 | } |
| 388 | |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 389 | void hardwaremain(int boot_complete) |
| 390 | { |
Stefan Reinauer | 4221a19 | 2012-10-15 15:23:20 -0700 | [diff] [blame] | 391 | timestamp_stash(TS_START_RAMSTAGE); |
Alexandru Gagniuc | 5005bb06 | 2011-04-11 20:17:22 +0000 | [diff] [blame] | 392 | post_code(POST_ENTRY_RAMSTAGE); |
Li-Ta Lo | 6a8745ae | 2004-05-13 20:39:07 +0000 | [diff] [blame] | 393 | |
Stefan Reinauer | 3b31402 | 2009-10-26 17:04:28 +0000 | [diff] [blame] | 394 | /* console_init() MUST PRECEDE ALL printk()! */ |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 395 | console_init(); |
Stefan Reinauer | 14e2277 | 2010-04-27 06:56:47 +0000 | [diff] [blame] | 396 | |
Alexandru Gagniuc | 5005bb06 | 2011-04-11 20:17:22 +0000 | [diff] [blame] | 397 | post_code(POST_CONSOLE_READY); |
arch import user (historical) | 54d6b08 | 2005-07-06 17:17:41 +0000 | [diff] [blame] | 398 | |
Stefan Reinauer | 14e2277 | 2010-04-27 06:56:47 +0000 | [diff] [blame] | 399 | printk(BIOS_NOTICE, "coreboot-%s%s %s %s...\n", |
Stefan Reinauer | f8ee180 | 2008-01-18 15:08:58 +0000 | [diff] [blame] | 400 | coreboot_version, coreboot_extra_version, coreboot_build, |
Li-Ta Lo | 3a81285 | 2004-12-03 22:39:34 +0000 | [diff] [blame] | 401 | (boot_complete)?"rebooting":"booting"); |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 402 | |
Alexandru Gagniuc | 5005bb06 | 2011-04-11 20:17:22 +0000 | [diff] [blame] | 403 | post_code(POST_CONSOLE_BOOT_MSG); |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 404 | |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 405 | /* If we have already booted attempt a hard reboot */ |
| 406 | if (boot_complete) { |
| 407 | hard_reset(); |
| 408 | } |
Li-Ta Lo | e526669 | 2004-03-23 21:28:05 +0000 | [diff] [blame] | 409 | |
Aaron Durbin | a4feddf | 2013-04-24 16:12:52 -0500 | [diff] [blame] | 410 | /* Schedule the static boot state entries. */ |
| 411 | boot_state_schedule_static_entries(); |
| 412 | |
Eric Biederman | 7003ba4 | 2004-10-16 06:20:29 +0000 | [diff] [blame] | 413 | /* FIXME: Is there a better way to handle this? */ |
Stefan Reinauer | 14e2277 | 2010-04-27 06:56:47 +0000 | [diff] [blame] | 414 | init_timer(); |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 415 | |
Aaron Durbin | 7e35efa | 2013-04-24 15:14:01 -0500 | [diff] [blame] | 416 | bs_walk_state_machine(BS_PRE_DEVICE); |
| 417 | die("Boot state machine failure.\n"); |
Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 418 | } |
| 419 | |