Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [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. |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 15 | */ |
| 16 | |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 17 | #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 Durbin | f5d7f60 | 2015-03-17 13:20:02 -0500 | [diff] [blame] | 23 | #include <program_loading.h> |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 24 | |
| 25 | static 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 | |
| 35 | void main(void) |
| 36 | { |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 37 | /* 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 Roth | c4e49f6 | 2015-07-11 13:42:54 -0600 | [diff] [blame] | 54 | #if IS_ENABLED(CONFIG_BOOTBLOCK_CONSOLE) |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 55 | console_init(); |
| 56 | exception_init(); |
| 57 | #endif |
| 58 | |
Aaron Durbin | f5d7f60 | 2015-03-17 13:20:02 -0500 | [diff] [blame] | 59 | run_romstage(); |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 60 | } |