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