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. |
| 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 |
Patrick Georgi | b890a12 | 2015-03-26 15:17:45 +0100 | [diff] [blame] | 17 | * Foundation, Inc. |
Daisuke Nojiri | efddcfb | 2014-09-04 09:55:34 -0700 | [diff] [blame] | 18 | */ |
| 19 | |
Julius Werner | b5995b5 | 2014-12-01 13:28:47 -0800 | [diff] [blame] | 20 | #include <arch/exception.h> |
Aaron Durbin | 588ad7b | 2015-09-29 17:56:59 -0500 | [diff] [blame] | 21 | #include <arch/hlt.h> |
Daisuke Nojiri | bcc1d42 | 2014-06-19 19:16:24 -0700 | [diff] [blame] | 22 | #include <console/console.h> |
Aaron Durbin | 588ad7b | 2015-09-29 17:56:59 -0500 | [diff] [blame] | 23 | #include <program_loading.h> |
| 24 | #include "../vboot_common.h" |
Daisuke Nojiri | bcc1d42 | 2014-06-19 19:16:24 -0700 | [diff] [blame] | 25 | |
Aaron Durbin | 588ad7b | 2015-09-29 17:56:59 -0500 | [diff] [blame] | 26 | void __attribute__((weak)) verstage_mainboard_init(void) |
Daisuke Nojiri | 1989a53 | 2014-06-30 08:28:17 -0700 | [diff] [blame] | 27 | { |
Aaron Durbin | 588ad7b | 2015-09-29 17:56:59 -0500 | [diff] [blame] | 28 | /* Default empty implementation. */ |
Daisuke Nojiri | 1989a53 | 2014-06-30 08:28:17 -0700 | [diff] [blame] | 29 | } |
| 30 | |
Aaron Durbin | 588ad7b | 2015-09-29 17:56:59 -0500 | [diff] [blame] | 31 | void verstage(void) |
Julius Werner | b5995b5 | 2014-12-01 13:28:47 -0800 | [diff] [blame] | 32 | { |
| 33 | console_init(); |
| 34 | exception_init(); |
Aaron Durbin | 588ad7b | 2015-09-29 17:56:59 -0500 | [diff] [blame] | 35 | verstage_mainboard_init(); |
| 36 | |
| 37 | if (IS_ENABLED(CONFIG_RETURN_FROM_VERSTAGE)) { |
| 38 | verstage_main(); |
| 39 | } else { |
| 40 | run_romstage(); |
| 41 | hlt(); |
| 42 | } |
Julius Werner | b5995b5 | 2014-12-01 13:28:47 -0800 | [diff] [blame] | 43 | } |
Aaron Durbin | 588ad7b | 2015-09-29 17:56:59 -0500 | [diff] [blame] | 44 | |
Aaron Durbin | 3c96e80 | 2015-10-01 16:27:55 -0500 | [diff] [blame^] | 45 | #if !IS_ENABLED(CONFIG_CHIPSET_PROVIDES_VERSTAGE_MAIN_SYMBOL) |
Aaron Durbin | 588ad7b | 2015-09-29 17:56:59 -0500 | [diff] [blame] | 46 | /* This is for boards that rely on main() for an entry point of a stage. */ |
| 47 | void main(void) __attribute__((alias ("verstage"))); |
Aaron Durbin | 3c96e80 | 2015-10-01 16:27:55 -0500 | [diff] [blame^] | 48 | #endif |