blob: 80754762bdd99771676d2b9e08ec52b00fc904fa [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 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.
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000014 */
15
16/*
17 * This file contains entry/exit functions for each stage during coreboot
18 * execution (bootblock entry and ramstage exit will depend on external
19 * loading).
20 *
21 * Entry points must be placed at the location the previous stage jumps
22 * to (the lowest address in the stage image). This is done by giving
23 * stage_entry() its own section in .text and placing it first in the
24 * linker script.
25 */
26
Jonathan Neuschäfer042a8332018-02-16 13:36:47 +010027#include <arch/boot.h>
28#include <arch/encoding.h>
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000029#include <arch/stages.h>
Jonathan Neuschäfer042a8332018-02-16 13:36:47 +010030#include <rules.h>
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000031
32void stage_entry(void)
33{
Jonathan Neuschäfer042a8332018-02-16 13:36:47 +010034 /*
35 * Save the FDT pointer before entering ramstage, because mscratch
36 * might be overwritten in the trap handler, and there is code in
37 * ramstage that generates misaligned access faults.
38 */
39 if (ENV_RAMSTAGE)
40 rom_fdt = (const void *)read_csr(mscratch);
41
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000042 main();
43}