xref: /optee_os/core/arch/arm/plat-d02/main.c (revision 612791d01ca4d6aa33a97953e7716b74d3d653e9)
1 // SPDX-License-Identifier: BSD-2-Clause
2 /*
3  * Copyright (c) 2015, Linaro Limited
4  */
5 
6 #include <console.h>
7 #include <drivers/hi16xx_uart.h>
8 #include <kernel/generic_boot.h>
9 #include <kernel/panic.h>
10 #include <kernel/pm_stubs.h>
11 #include <mm/tee_pager.h>
12 #include <mm/core_memprot.h>
13 #include <platform_config.h>
14 #include <stdint.h>
15 #include <tee/entry_std.h>
16 #include <tee/entry_fast.h>
17 
18 static void main_fiq(void);
19 
20 static const struct thread_handlers handlers = {
21 	.nintr = main_fiq,
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 hi16xx_uart_data console_data;
31 
32 register_phys_mem_pgdir(MEM_AREA_IO_NSEC, CONSOLE_UART_BASE,
33 			HI16XX_UART_REG_SIZE);
34 
35 const struct thread_handlers *generic_boot_get_handlers(void)
36 {
37 	return &handlers;
38 }
39 
40 static void main_fiq(void)
41 {
42 	panic();
43 }
44 
45 void console_init(void)
46 {
47 	hi16xx_uart_init(&console_data, CONSOLE_UART_BASE,
48 			 CONSOLE_UART_CLK_IN_HZ, CONSOLE_BAUDRATE);
49 	register_serial_console(&console_data.chip);
50 }
51