arm_tsp_setup.c 2.26 KB
Newer Older
1
/*
2
 * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
3
 *
dp-arm's avatar
dp-arm committed
4
 * SPDX-License-Identifier: BSD-3-Clause
5
6
7
8
9
 */

#include <arm_def.h>
#include <bl_common.h>
#include <console.h>
10
11
#include <debug.h>
#include <pl011.h>
12
#include <plat_arm.h>
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <platform_def.h>
#include <platform_tsp.h>

#define BL32_END (unsigned long)(&__BL32_END__)

/* Weak definitions may be overridden in specific ARM standard platform */
#pragma weak tsp_early_platform_setup
#pragma weak tsp_platform_setup
#pragma weak tsp_plat_arch_setup


/*******************************************************************************
 * Initialize the UART
 ******************************************************************************/
27
28
29
30
#if MULTI_CONSOLE_API
static console_pl011_t arm_tsp_runtime_console;
#endif

31
32
void arm_tsp_early_platform_setup(void)
{
33
#if MULTI_CONSOLE_API
34
35
36
37
	/*
	 * Initialize a different console than already in use to display
	 * messages from TSP
	 */
38
39
40
41
42
43
44
45
46
47
	int rc = console_pl011_register(PLAT_ARM_TSP_UART_BASE,
					PLAT_ARM_TSP_UART_CLK_IN_HZ,
					ARM_CONSOLE_BAUDRATE,
					&arm_tsp_runtime_console);
	if (rc == 0)
		panic();

	console_set_scope(&arm_tsp_runtime_console.console,
			  CONSOLE_FLAG_BOOT | CONSOLE_FLAG_RUNTIME);
#else
48
49
	console_init(PLAT_ARM_TSP_UART_BASE, PLAT_ARM_TSP_UART_CLK_IN_HZ,
			ARM_CONSOLE_BAUDRATE);
50
#endif /* MULTI_CONSOLE_API */
51
52
53
54
55
56
57
58
59
60
61
62
}

void tsp_early_platform_setup(void)
{
	arm_tsp_early_platform_setup();
}

/*******************************************************************************
 * Perform platform specific setup placeholder
 ******************************************************************************/
void tsp_platform_setup(void)
{
63
	plat_arm_gic_driver_init();
64
65
66
67
68
69
70
71
}

/*******************************************************************************
 * Perform the very early platform specific architectural setup here. At the
 * moment this is only intializes the MMU
 ******************************************************************************/
void tsp_plat_arch_setup(void)
{
72
73
74
	arm_setup_page_tables(BL32_BASE,
			      (BL32_END - BL32_BASE),
			      BL_CODE_BASE,
75
			      BL_CODE_END,
76
			      BL_RO_DATA_BASE,
77
			      BL_RO_DATA_END
78
#if USE_COHERENT_MEM
79
80
			      , BL_COHERENT_RAM_BASE,
			      BL_COHERENT_RAM_END
81
82
#endif
			      );
83
	enable_mmu_el1(0);
84
}