Daisuke Nojiri | a6712f3 | 2015-01-23 10:06:19 -0800 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright 2015 Google Inc. |
| 5 | * |
| 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 |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * 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 |
| 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | */ |
| 19 | |
| 20 | #include <arch/cache.h> |
| 21 | #include <arch/exception.h> |
| 22 | #include <arch/stages.h> |
| 23 | #include <armv7.h> |
| 24 | #include <cbfs.h> |
| 25 | #include <cbmem.h> |
| 26 | #include <console/console.h> |
| 27 | #include <delay.h> |
| 28 | #include <program_loading.h> |
| 29 | #include <soc/sdram.h> |
| 30 | #include <stdlib.h> |
| 31 | #include <symbols.h> |
| 32 | #include <timestamp.h> |
| 33 | #include <types.h> |
| 34 | #include <vendorcode/google/chromeos/chromeos.h> |
| 35 | |
| 36 | void main(void) |
| 37 | { |
| 38 | #if CONFIG_COLLECT_TIMESTAMPS |
| 39 | uint64_t start_romstage_time; |
| 40 | uint64_t before_dram_time; |
| 41 | uint64_t after_dram_time; |
| 42 | uint64_t base_time = timestamp_get(); |
| 43 | start_romstage_time = timestamp_get(); |
| 44 | #endif |
| 45 | |
| 46 | console_init(); |
| 47 | |
| 48 | #if CONFIG_COLLECT_TIMESTAMPS |
| 49 | before_dram_time = timestamp_get(); |
| 50 | #endif |
| 51 | |
| 52 | sdram_init(); |
| 53 | |
| 54 | #if CONFIG_COLLECT_TIMESTAMPS |
| 55 | after_dram_time = timestamp_get(); |
| 56 | #endif |
| 57 | |
Daisuke Nojiri | 99d3956 | 2015-03-02 14:38:37 -0800 | [diff] [blame^] | 58 | /* Now that DRAM is up, add mappings for it and DMA coherency buffer. */ |
| 59 | mmu_config_range((uintptr_t)_dram/MiB, |
| 60 | sdram_size_mb(), DCACHE_WRITEBACK); |
| 61 | mmu_config_range((uintptr_t)_dma_coherent/MiB, |
| 62 | _dma_coherent_size/MiB, DCACHE_OFF); |
Daisuke Nojiri | a6712f3 | 2015-01-23 10:06:19 -0800 | [diff] [blame] | 63 | |
| 64 | cbmem_initialize_empty(); |
| 65 | |
| 66 | #if CONFIG_COLLECT_TIMESTAMPS |
| 67 | timestamp_init(base_time); |
| 68 | timestamp_add(TS_START_ROMSTAGE, start_romstage_time); |
| 69 | timestamp_add(TS_BEFORE_INITRAM, before_dram_time); |
| 70 | timestamp_add(TS_AFTER_INITRAM, after_dram_time); |
| 71 | |
| 72 | timestamp_add_now(TS_END_ROMSTAGE); |
| 73 | #endif |
| 74 | |
| 75 | run_ramstage(); |
| 76 | } |