blob: 0ec9ca6d27eec2ce87bb444aae608280b504526e [file] [log] [blame]
Daisuke Nojiriefddcfb2014-09-04 09:55:34 -07001/*
2 * This file is part of the coreboot project.
3 *
Aaron Durbin588ad7b2015-09-29 17:56:59 -05004 * Copyright 2015 Google Inc.
Daisuke Nojiriefddcfb2014-09-04 09:55:34 -07005 *
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 Durbin588ad7b2015-09-29 17:56:59 -050012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Daisuke Nojiriefddcfb2014-09-04 09:55:34 -070013 * GNU General Public License for more details.
Daisuke Nojiriefddcfb2014-09-04 09:55:34 -070014 */
15
Julius Wernerb5995b52014-12-01 13:28:47 -080016#include <arch/exception.h>
Aaron Durbin588ad7b2015-09-29 17:56:59 -050017#include <arch/hlt.h>
Daisuke Nojiribcc1d422014-06-19 19:16:24 -070018#include <console/console.h>
Aaron Durbin588ad7b2015-09-29 17:56:59 -050019#include <program_loading.h>
Furquan Shaikh2a12e2e2016-07-25 11:48:03 -070020#include <vboot/vboot_common.h>
Daisuke Nojiribcc1d422014-06-19 19:16:24 -070021
Aaron Durbin588ad7b2015-09-29 17:56:59 -050022void __attribute__((weak)) verstage_mainboard_init(void)
Daisuke Nojiri1989a532014-06-30 08:28:17 -070023{
Aaron Durbin588ad7b2015-09-29 17:56:59 -050024 /* Default empty implementation. */
Daisuke Nojiri1989a532014-06-30 08:28:17 -070025}
26
Aaron Durbin588ad7b2015-09-29 17:56:59 -050027void verstage(void)
Julius Wernerb5995b52014-12-01 13:28:47 -080028{
29 console_init();
30 exception_init();
Aaron Durbin588ad7b2015-09-29 17:56:59 -050031 verstage_mainboard_init();
32
33 if (IS_ENABLED(CONFIG_RETURN_FROM_VERSTAGE)) {
34 verstage_main();
35 } else {
36 run_romstage();
37 hlt();
38 }
Julius Wernerb5995b52014-12-01 13:28:47 -080039}
Aaron Durbin588ad7b2015-09-29 17:56:59 -050040
Aaron Durbin3c96e802015-10-01 16:27:55 -050041#if !IS_ENABLED(CONFIG_CHIPSET_PROVIDES_VERSTAGE_MAIN_SYMBOL)
Aaron Durbin588ad7b2015-09-29 17:56:59 -050042/* This is for boards that rely on main() for an entry point of a stage. */
43void main(void) __attribute__((alias ("verstage")));
Aaron Durbin3c96e802015-10-01 16:27:55 -050044#endif