xref: /optee_os/core/arch/arm/plat-poplar/main.c (revision 5b25c76ac40f830867e3d60800120ffd7874e8dc)
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 const struct thread_handlers handlers = {
22 	.cpu_on = cpu_on_handler,
23 	.cpu_off = pm_do_nothing,
24 	.cpu_suspend = pm_do_nothing,
25 	.cpu_resume = pm_do_nothing,
26 	.system_off = pm_do_nothing,
27 	.system_reset = pm_do_nothing,
28 };
29 
30 static struct pl011_data console_data;
31 
32 register_phys_mem_pgdir(MEM_AREA_IO_NSEC, CONSOLE_UART_BASE, PL011_REG_SIZE);
33 /* for dynamic shared memory */
34 register_dynamic_shm(DRAM0_BASE_NSEC, DRAM0_SIZE_NSEC);
35 
36 const struct thread_handlers *generic_boot_get_handlers(void)
37 {
38 	return &handlers;
39 }
40 
41 void console_init(void)
42 {
43 	pl011_init(&console_data, CONSOLE_UART_BASE,
44 		CONSOLE_UART_CLK_IN_HZ, CONSOLE_BAUDRATE);
45 	register_serial_console(&console_data.chip);
46 }
47