blob: 8df7e6a70d06de30b8d48dc23a379091986634de [file] [log] [blame]
Stefan Reinauer52db0b92012-12-07 17:15:04 -08001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2010 Google Inc
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; version 2 of
9 * the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
19 * MA 02110-1301 USA
20 */
21
Stefan Reinauer52db0b92012-12-07 17:15:04 -080022#include <bootblock_common.h>
David Hendricks3d7344a2013-01-08 21:05:06 -080023#include <arch/cbfs.h>
24#include <arch/hlt.h>
David Hendricks50c0a502013-01-31 17:05:50 -080025#include <arch/stages.h>
26
27#include "stages.c"
Stefan Reinauer52db0b92012-12-07 17:15:04 -080028
David Hendricks3d7344a2013-01-08 21:05:06 -080029static int boot_cpu(void)
30{
31 /*
32 * FIXME: This is a stub for now. All non-boot CPUs should be
33 * waiting for an interrupt. We could move the chunk of assembly
34 * which puts them to sleep in here...
35 */
36 return 1;
37}
Stefan Reinauer52db0b92012-12-07 17:15:04 -080038
David Hendricks50c0a502013-01-31 17:05:50 -080039void main(void)
Stefan Reinauer52db0b92012-12-07 17:15:04 -080040{
David Hendricks3d7344a2013-01-08 21:05:06 -080041 const char *target1 = "fallback/romstage";
David Hendricks35934412013-01-21 20:02:15 -080042 unsigned long romstage_entry;
Stefan Reinauer52db0b92012-12-07 17:15:04 -080043
44 if (boot_cpu()) {
David Hendricksfba42a72013-01-17 15:07:35 -080045 bootblock_cpu_init();
David Hendricks211a5d52013-01-17 20:52:21 -080046 bootblock_mainboard_init();
Stefan Reinauer52db0b92012-12-07 17:15:04 -080047 }
David Hendricks3d7344a2013-01-08 21:05:06 -080048
David Hendricks211a5d52013-01-17 20:52:21 -080049 printk(BIOS_INFO, "bootblock main(): loading romstage\n");
Hung-Te Lin6fe0cab2013-01-22 18:57:56 +080050 romstage_entry = (unsigned long)cbfs_load_stage(
51 CBFS_DEFAULT_MEDIA, target1);
52
David Hendricks211a5d52013-01-17 20:52:21 -080053 printk(BIOS_INFO, "bootblock main(): jumping to romstage\n");
David Hendricks50c0a502013-01-31 17:05:50 -080054 if (romstage_entry) stage_exit(romstage_entry);
Stefan Reinauer52db0b92012-12-07 17:15:04 -080055 hlt();
56}