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