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