blob: e581a63356ba7dcb081db2ac3defbffca65c4aed [file] [log] [blame]
Daisuke Nojiria6712f32015-01-23 10:06:19 -08001/*
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
36void 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
58 mmu_init();
59 mmu_config_range(0, 4096, DCACHE_OFF);
60 dcache_mmu_enable();
61
62 cbmem_initialize_empty();
63
64#if CONFIG_COLLECT_TIMESTAMPS
65 timestamp_init(base_time);
66 timestamp_add(TS_START_ROMSTAGE, start_romstage_time);
67 timestamp_add(TS_BEFORE_INITRAM, before_dram_time);
68 timestamp_add(TS_AFTER_INITRAM, after_dram_time);
69
70 timestamp_add_now(TS_END_ROMSTAGE);
71#endif
72
73 run_ramstage();
74}