coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
ramstage.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <arch/lib_helpers.h>
4 #include <arch/stages.h>
5 #include <cbmem.h>
6 #include <console/console.h>
7 #include <device/mmio.h>
8 #include <soc/addressmap.h>
9 #include <soc/clock.h>
10 #include <soc/mmu_operations.h>
11 #include <soc/mtc.h>
12 
13 static void arm64_arch_timer_init(void)
14 {
15  uint32_t freq = clock_get_osc_khz() * 1000;
16  // Set the cntfrq register.
17  raw_write_cntfrq_el0(freq);
18 }
19 
20 static void mselect_enable_wrap(void)
21 {
22  uint32_t reg;
23 
24 #define ERR_RESP_EN_SLAVE1 (0x1 << 24)
25 #define ERR_RESP_EN_SLAVE2 (0x1 << 25)
26 #define WRAP_TO_INCR_SLAVE0 (0x1 << 27)
27 #define WRAP_TO_INCR_SLAVE1 (0x1 << 28)
28 #define WRAP_TO_INCR_SLAVE2 (0x1 << 29)
29 
30  reg = read32((void *)TEGRA_MSELECT_CONFIG);
31  /* Disable error mechanism */
33  /* Enable WRAP type conversion */
36  write32((void *)TEGRA_MSELECT_CONFIG, reg);
37 }
38 
39 /* Tegra-specific entry point, called from assembly in stage_entry.S */
40 void ramstage_entry(void);
41 void ramstage_entry(void)
42 {
43  /* TODO: Move arch timer setup to BL31? */
45 
46  /* Enable WRAP to INCR burst type conversion in MSELECT */
48 
49  /* TODO: Move TrustZone setup to BL31? */
51 
53 
55 
56  if (tegra210_run_mtc() != 0)
57  printk(BIOS_ERR, "MTC: No training data.\n");
58 
59  /* Ramstage is run on a different core, so passing cbmem_top
60  via calling arguments is not an option, but it is not a problem
61  to call cbmem_top_chipset() again here to populate _cbmem_top_ptr. */
63 
64  /* Jump to boot state machine in common code. */
65  main();
66 }
void trustzone_region_init(void)
Definition: addressmap.c:233
void main(void)
Definition: romstage.c:13
static void write32(void *addr, uint32_t val)
Definition: mmio.h:40
static uint32_t read32(const void *addr)
Definition: mmio.h:22
uintptr_t _cbmem_top_ptr
Definition: imd_cbmem.c:14
#define printk(level,...)
Definition: stdlib.h:16
void * cbmem_top_chipset(void)
Definition: romstage.c:108
#define BIOS_ERR
BIOS_ERR - System in incomplete state.
Definition: loglevel.h:72
int tegra210_run_mtc(void)
Definition: mtc.c:16
void tegra210_mmu_init(void)
int clock_get_osc_khz(void)
Definition: clock.c:155
void clock_init_arm_generic_timer(void)
Definition: clock.c:168
@ TEGRA_MSELECT_CONFIG
Definition: addressmap.h:20
#define WRAP_TO_INCR_SLAVE2
#define WRAP_TO_INCR_SLAVE0
#define ERR_RESP_EN_SLAVE2
#define ERR_RESP_EN_SLAVE1
static void arm64_arch_timer_init(void)
Definition: ramstage.c:13
void ramstage_entry(void)
Definition: ramstage.c:41
static void mselect_enable_wrap(void)
Definition: ramstage.c:20
#define WRAP_TO_INCR_SLAVE1
unsigned int uint32_t
Definition: stdint.h:14
unsigned long uintptr_t
Definition: stdint.h:21
Definition: dw_i2c.c:39