Daisuke Nojiri | efddcfb | 2014-09-04 09:55:34 -0700 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
Aaron Durbin | 588ad7b | 2015-09-29 17:56:59 -0500 | [diff] [blame] | 4 | * Copyright 2015 Google Inc. |
Daisuke Nojiri | efddcfb | 2014-09-04 09:55:34 -0700 | [diff] [blame] | 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 |
Aaron Durbin | 588ad7b | 2015-09-29 17:56:59 -0500 | [diff] [blame] | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
Daisuke Nojiri | efddcfb | 2014-09-04 09:55:34 -0700 | [diff] [blame] | 13 | * GNU General Public License for more details. |
Daisuke Nojiri | efddcfb | 2014-09-04 09:55:34 -0700 | [diff] [blame] | 14 | */ |
| 15 | |
Julius Werner | b5995b5 | 2014-12-01 13:28:47 -0800 | [diff] [blame] | 16 | #include <arch/exception.h> |
Aaron Durbin | 588ad7b | 2015-09-29 17:56:59 -0500 | [diff] [blame] | 17 | #include <arch/hlt.h> |
Aaron Durbin | 6403167 | 2018-04-21 14:45:32 -0600 | [diff] [blame] | 18 | #include <compiler.h> |
Daisuke Nojiri | bcc1d42 | 2014-06-19 19:16:24 -0700 | [diff] [blame] | 19 | #include <console/console.h> |
Aaron Durbin | 588ad7b | 2015-09-29 17:56:59 -0500 | [diff] [blame] | 20 | #include <program_loading.h> |
Philipp Deppenwiese | fea2429 | 2017-10-17 17:02:29 +0200 | [diff] [blame] | 21 | #include <security/vboot/vboot_common.h> |
Daisuke Nojiri | bcc1d42 | 2014-06-19 19:16:24 -0700 | [diff] [blame] | 22 | |
Aaron Durbin | 6403167 | 2018-04-21 14:45:32 -0600 | [diff] [blame] | 23 | void __weak verstage_mainboard_init(void) |
Daisuke Nojiri | 1989a53 | 2014-06-30 08:28:17 -0700 | [diff] [blame] | 24 | { |
Aaron Durbin | 588ad7b | 2015-09-29 17:56:59 -0500 | [diff] [blame] | 25 | /* Default empty implementation. */ |
Daisuke Nojiri | 1989a53 | 2014-06-30 08:28:17 -0700 | [diff] [blame] | 26 | } |
| 27 | |
Julius Werner | 94d9411 | 2017-03-16 19:21:51 -0700 | [diff] [blame] | 28 | void main(void) |
Julius Werner | b5995b5 | 2014-12-01 13:28:47 -0800 | [diff] [blame] | 29 | { |
| 30 | console_init(); |
| 31 | exception_init(); |
Aaron Durbin | 588ad7b | 2015-09-29 17:56:59 -0500 | [diff] [blame] | 32 | verstage_mainboard_init(); |
| 33 | |
Julius Werner | 58c3938 | 2017-02-13 17:53:29 -0800 | [diff] [blame] | 34 | if (IS_ENABLED(CONFIG_VBOOT_RETURN_FROM_VERSTAGE)) { |
Aaron Durbin | 588ad7b | 2015-09-29 17:56:59 -0500 | [diff] [blame] | 35 | verstage_main(); |
| 36 | } else { |
| 37 | run_romstage(); |
| 38 | hlt(); |
| 39 | } |
Julius Werner | b5995b5 | 2014-12-01 13:28:47 -0800 | [diff] [blame] | 40 | } |