blob: 751f58829207169beb9d06d40434a11411a4eac7 [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.
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 Georgib890a122015-03-26 15:17:45 +010017 * Foundation, Inc.
Daisuke Nojiriefddcfb2014-09-04 09:55:34 -070018 */
19
Julius Wernerb5995b52014-12-01 13:28:47 -080020#include <arch/exception.h>
Aaron Durbin588ad7b2015-09-29 17:56:59 -050021#include <arch/hlt.h>
Daisuke Nojiribcc1d422014-06-19 19:16:24 -070022#include <console/console.h>
Aaron Durbin588ad7b2015-09-29 17:56:59 -050023#include <program_loading.h>
24#include "../vboot_common.h"
Daisuke Nojiribcc1d422014-06-19 19:16:24 -070025
Aaron Durbin588ad7b2015-09-29 17:56:59 -050026void __attribute__((weak)) verstage_mainboard_init(void)
Daisuke Nojiri1989a532014-06-30 08:28:17 -070027{
Aaron Durbin588ad7b2015-09-29 17:56:59 -050028 /* Default empty implementation. */
Daisuke Nojiri1989a532014-06-30 08:28:17 -070029}
30
Aaron Durbin588ad7b2015-09-29 17:56:59 -050031void verstage(void)
Julius Wernerb5995b52014-12-01 13:28:47 -080032{
33 console_init();
34 exception_init();
Aaron Durbin588ad7b2015-09-29 17:56:59 -050035 verstage_mainboard_init();
36
37 if (IS_ENABLED(CONFIG_RETURN_FROM_VERSTAGE)) {
38 verstage_main();
39 } else {
40 run_romstage();
41 hlt();
42 }
Julius Wernerb5995b52014-12-01 13:28:47 -080043}
Aaron Durbin588ad7b2015-09-29 17:56:59 -050044
Aaron Durbin3c96e802015-10-01 16:27:55 -050045#if !IS_ENABLED(CONFIG_CHIPSET_PROVIDES_VERSTAGE_MAIN_SYMBOL)
Aaron Durbin588ad7b2015-09-29 17:56:59 -050046/* This is for boards that rely on main() for an entry point of a stage. */
47void main(void) __attribute__((alias ("verstage")));
Aaron Durbin3c96e802015-10-01 16:27:55 -050048#endif