blob: db45ab202a2103fe475bc27112b596ae9e2fafba [file] [log] [blame]
Ronald G. Minniche0e784a2014-11-26 19:25:47 +00001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright 2014 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.
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000015 */
16
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000017#include <arch/cache.h>
18#include <arch/hlt.h>
19#include <arch/stages.h>
20#include <arch/exception.h>
21#include <cbfs.h>
22#include <console/console.h>
Aaron Durbinf5d7f602015-03-17 13:20:02 -050023#include <program_loading.h>
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000024
25static int boot_cpu(void)
26{
27 /*
28 * FIXME: This is a stub for now. All non-boot CPUs should be
29 * waiting for an interrupt. We could move the chunk of assembly
30 * which puts them to sleep in here...
31 */
32 return 1;
33}
34
35void main(void)
36{
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000037 /* Globally disable MMU, caches, and branch prediction (these should
38 * be disabled by default on reset) */
39 dcache_mmu_disable();
40
41 /*
42 * Re-enable icache and branch prediction. MMU and dcache will be
43 * set up later.
44 *
45 * Note: If booting from USB, we need to disable branch prediction
46 * before copying from USB into RAM (FIXME: why?)
47 */
48
49 if (boot_cpu()) {
50 //bootblock_cpu_init();
51 //bootblock_mainboard_init();
52 }
53
Martin Rothc4e49f62015-07-11 13:42:54 -060054#if IS_ENABLED(CONFIG_BOOTBLOCK_CONSOLE)
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000055 console_init();
56 exception_init();
57#endif
58
Aaron Durbinf5d7f602015-03-17 13:20:02 -050059 run_romstage();
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000060}