Furquan Shaikh | 2af76f4 | 2014-04-28 16:39:40 -0700 | [diff] [blame] | 1 | /* |
| 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. |
| 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 |
Patrick Georgi | b890a12 | 2015-03-26 15:17:45 +0100 | [diff] [blame] | 18 | * Foundation, Inc. |
Furquan Shaikh | 2af76f4 | 2014-04-28 16:39:40 -0700 | [diff] [blame] | 19 | */ |
| 20 | |
| 21 | #include <bootblock_common.h> |
| 22 | #include <arch/cache.h> |
Furquan Shaikh | 2af76f4 | 2014-04-28 16:39:40 -0700 | [diff] [blame] | 23 | #include <arch/stages.h> |
| 24 | #include <arch/exception.h> |
| 25 | #include <cbfs.h> |
| 26 | #include <console/console.h> |
Aaron Durbin | f5d7f60 | 2015-03-17 13:20:02 -0500 | [diff] [blame] | 27 | #include <program_loading.h> |
Furquan Shaikh | 2af76f4 | 2014-04-28 16:39:40 -0700 | [diff] [blame] | 28 | |
| 29 | static 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 | } |
| 38 | |
| 39 | void main(void) |
| 40 | { |
Furquan Shaikh | 2af76f4 | 2014-04-28 16:39:40 -0700 | [diff] [blame] | 41 | /* Globally disable MMU, caches, and branch prediction (these should |
| 42 | * be disabled by default on reset) */ |
| 43 | dcache_mmu_disable(); |
| 44 | |
| 45 | /* |
| 46 | * Re-enable icache and branch prediction. MMU and dcache will be |
| 47 | * set up later. |
| 48 | * |
| 49 | * Note: If booting from USB, we need to disable branch prediction |
| 50 | * before copying from USB into RAM (FIXME: why?) |
| 51 | */ |
| 52 | |
| 53 | if (boot_cpu()) { |
| 54 | //bootblock_cpu_init(); |
| 55 | //bootblock_mainboard_init(); |
| 56 | } |
| 57 | |
| 58 | #ifdef CONFIG_BOOTBLOCK_CONSOLE |
| 59 | console_init(); |
| 60 | exception_init(); |
| 61 | #endif |
| 62 | |
Aaron Durbin | f5d7f60 | 2015-03-17 13:20:02 -0500 | [diff] [blame] | 63 | run_romstage(); |
Furquan Shaikh | 2af76f4 | 2014-04-28 16:39:40 -0700 | [diff] [blame] | 64 | } |