Stefan Reinauer | 52db0b9 | 2012-12-07 17:15:04 -0800 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
Stefan Reinauer | 08dc357 | 2013-05-14 16:57:50 -0700 | [diff] [blame] | 4 | * Copyright 2010 Google Inc. |
Stefan Reinauer | 52db0b9 | 2012-12-07 17:15:04 -0800 | [diff] [blame] | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License as |
| 8 | * published by the Free Software Foundation; version 2 of |
| 9 | * the License. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
Stefan Reinauer | 52db0b9 | 2012-12-07 17:15:04 -0800 | [diff] [blame] | 15 | */ |
| 16 | |
Julius Werner | 85620db | 2013-11-13 18:22:15 -0800 | [diff] [blame] | 17 | #include <arch/exception.h> |
Gabe Black | 8b68539 | 2013-09-29 03:02:55 -0700 | [diff] [blame] | 18 | #include <bootblock_common.h> |
Hung-Te Lin | b868d40 | 2013-02-06 22:01:18 +0800 | [diff] [blame] | 19 | #include <console/console.h> |
Julius Werner | 44cf870 | 2014-12-08 13:39:14 -0800 | [diff] [blame] | 20 | #include <delay.h> |
Aaron Durbin | f5d7f60 | 2015-03-17 13:20:02 -0500 | [diff] [blame] | 21 | #include <program_loading.h> |
Julius Werner | 8c09377 | 2016-02-09 16:09:15 -0800 | [diff] [blame^] | 22 | #include <symbols.h> |
Julius Werner | 44cf870 | 2014-12-08 13:39:14 -0800 | [diff] [blame] | 23 | #include <timestamp.h> |
David Hendricks | 50c0a50 | 2013-01-31 17:05:50 -0800 | [diff] [blame] | 24 | |
Julius Werner | 8c09377 | 2016-02-09 16:09:15 -0800 | [diff] [blame^] | 25 | DECLARE_OPTIONAL_REGION(timestamp); |
| 26 | |
Julius Werner | f1e3210 | 2014-11-25 13:22:20 -0800 | [diff] [blame] | 27 | __attribute__((weak)) void bootblock_mainboard_early_init(void) { /* no-op */ } |
Vadim Bendebury | 0b341b3 | 2014-04-23 11:09:44 -0700 | [diff] [blame] | 28 | __attribute__((weak)) void bootblock_soc_init(void) { /* do nothing */ } |
| 29 | __attribute__((weak)) void bootblock_mainboard_init(void) { /* do nothing */ } |
| 30 | |
David Hendricks | 50c0a50 | 2013-01-31 17:05:50 -0800 | [diff] [blame] | 31 | void main(void) |
Stefan Reinauer | 52db0b9 | 2012-12-07 17:15:04 -0800 | [diff] [blame] | 32 | { |
Julius Werner | 44cf870 | 2014-12-08 13:39:14 -0800 | [diff] [blame] | 33 | init_timer(); |
Julius Werner | 8c09377 | 2016-02-09 16:09:15 -0800 | [diff] [blame^] | 34 | |
| 35 | /* Initialize timestamps if we have TIMESTAMP region in memlayout.ld. */ |
| 36 | if (IS_ENABLED(CONFIG_COLLECT_TIMESTAMPS) && _timestamp_size > 0) |
Julius Werner | 44cf870 | 2014-12-08 13:39:14 -0800 | [diff] [blame] | 37 | timestamp_init(timestamp_get()); |
| 38 | |
Julius Werner | f1e3210 | 2014-11-25 13:22:20 -0800 | [diff] [blame] | 39 | bootblock_mainboard_early_init(); |
David Hendricks | 3d7344a | 2013-01-08 21:05:06 -0800 | [diff] [blame] | 40 | |
Julius Werner | 86fc11d | 2015-10-09 13:37:58 -0700 | [diff] [blame] | 41 | if (IS_ENABLED(CONFIG_BOOTBLOCK_CONSOLE)) { |
| 42 | console_init(); |
| 43 | exception_init(); |
| 44 | } |
Stefan Reinauer | 919c804 | 2013-05-16 10:57:15 -0700 | [diff] [blame] | 45 | |
Julius Werner | f1e3210 | 2014-11-25 13:22:20 -0800 | [diff] [blame] | 46 | bootblock_soc_init(); |
| 47 | bootblock_mainboard_init(); |
| 48 | |
Aaron Durbin | f5d7f60 | 2015-03-17 13:20:02 -0500 | [diff] [blame] | 49 | run_romstage(); |
Stefan Reinauer | 52db0b9 | 2012-12-07 17:15:04 -0800 | [diff] [blame] | 50 | } |