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