xref: /optee_os/core/arch/arm/plat-versal2/main.c (revision c3deb3d6f3b13d0e17fc9efe5880aec039e47594)
1 // SPDX-License-Identifier: BSD-2-Clause
2 /*
3  * Copyright (c) 2023-2024, Advanced Micro Devices, Inc. All rights reserved.
4  */
5 
6 #include <arm.h>
7 #include <assert.h>
8 #include <console.h>
9 #include <drivers/gic.h>
10 #include <drivers/pl011.h>
11 #include <drivers/versal_pm.h>
12 #include <io.h>
13 #include <kernel/boot.h>
14 #include <kernel/misc.h>
15 #include <kernel/tee_time.h>
16 #include <mm/core_memprot.h>
17 #include <platform_config.h>
18 #include <stdint.h>
19 #include <string.h>
20 #include <tee/tee_fs.h>
21 #include <trace.h>
22 
23 static struct pl011_data console_data;
24 
25 register_phys_mem_pgdir(MEM_AREA_IO_SEC,
26 			ROUNDDOWN(CONSOLE_UART_BASE, CORE_MMU_PGDIR_SIZE),
27 			CORE_MMU_PGDIR_SIZE);
28 
29 register_phys_mem_pgdir(MEM_AREA_IO_SEC, GICD_BASE, GIC_DIST_REG_SIZE);
30 register_phys_mem_pgdir(MEM_AREA_IO_SEC, GICR_BASE, GIC_DIST_REG_SIZE);
31 
32 register_ddr(DRAM0_BASE, DRAM0_SIZE);
33 
34 void boot_primary_init_intc(void)
35 {
36 	gic_init_v3(0, GICD_BASE, GICR_BASE);
37 }
38 
39 void plat_console_init(void)
40 {
41 	pl011_init(&console_data, CONSOLE_UART_BASE,
42 		   CONSOLE_UART_CLK_IN_HZ, CONSOLE_BAUDRATE);
43 	register_serial_console(&console_data.chip);
44 }
45 
46 static TEE_Result platform_banner(void)
47 {
48 	IMSG("OP-TEE OS Running on Platform AMD Versal Gen 2");
49 
50 	return TEE_SUCCESS;
51 }
52 
53 service_init(platform_banner);
54