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