xref: /optee_os/core/arch/arm/plat-poplar/main.c (revision 2dd2ca5f39e6dd144a8be81f5e00badf79d362fe)
1 /*
2  * Copyright (c) 2017, Linaro Limited
3  * SPDX-License-Identifier: BSD-2-Clause
4  */
5 
6 #include <console.h>
7 #include <drivers/pl011.h>
8 #ifdef CFG_PL061
9 #include <drivers/pl061_gpio.h>
10 #endif
11 #include <kernel/generic_boot.h>
12 #include <kernel/panic.h>
13 #include <kernel/pm_stubs.h>
14 #include <mm/tee_pager.h>
15 #include <mm/core_memprot.h>
16 #include <platform_config.h>
17 #include <stdint.h>
18 #include <tee/entry_std.h>
19 #include <tee/entry_fast.h>
20 
21 static void main_fiq(void);
22 
23 static const struct thread_handlers handlers = {
24 	.fast_smc = tee_entry_fast,
25 	.nintr = main_fiq,
26 	.cpu_on = cpu_on_handler,
27 	.cpu_off = pm_do_nothing,
28 	.cpu_suspend = pm_do_nothing,
29 	.cpu_resume = pm_do_nothing,
30 	.system_off = pm_do_nothing,
31 	.system_reset = pm_do_nothing,
32 };
33 
34 static struct pl011_data console_data;
35 
36 register_phys_mem_pgdir(MEM_AREA_IO_NSEC, CONSOLE_UART_BASE, PL011_REG_SIZE);
37 /* for dynamic shared memory */
38 register_dynamic_shm(DRAM0_BASE_NSEC, DRAM0_SIZE_NSEC);
39 
40 const struct thread_handlers *generic_boot_get_handlers(void)
41 {
42 	return &handlers;
43 }
44 
45 static void main_fiq(void)
46 {
47 	panic();
48 }
49 
50 void console_init(void)
51 {
52 	pl011_init(&console_data, CONSOLE_UART_BASE,
53 		CONSOLE_UART_CLK_IN_HZ, CONSOLE_BAUDRATE);
54 	register_serial_console(&console_data.chip);
55 }
56