1 // SPDX-License-Identifier: BSD-2-Clause 2 /* 3 * Copyright (c) 2015, Linaro Limited 4 */ 5 6 #include <console.h> 7 #include <drivers/gic.h> 8 #include <drivers/serial8250_uart.h> 9 #include <kernel/boot.h> 10 #include <kernel/panic.h> 11 #include <mm/core_memprot.h> 12 #include <platform_config.h> 13 #include <stdint.h> 14 15 register_phys_mem_pgdir(MEM_AREA_IO_NSEC, 16 CONSOLE_UART_BASE, SERIAL8250_UART_REG_SIZE); 17 18 static struct serial8250_uart_data console_data; 19 20 register_ddr(CFG_DRAM_BASE, CFG_DRAM_SIZE); 21 22 #ifdef CFG_GIC 23 register_phys_mem_pgdir(MEM_AREA_IO_SEC, GIC_BASE + GICD_OFFSET, 24 CORE_MMU_PGDIR_SIZE); 25 register_phys_mem_pgdir(MEM_AREA_IO_SEC, GIC_BASE + GICC_OFFSET, 26 CORE_MMU_PGDIR_SIZE); 27 28 void boot_primary_init_intc(void) 29 { 30 gic_init(GIC_BASE + GICC_OFFSET, GIC_BASE + GICD_OFFSET); 31 } 32 #endif 33 34 void console_init(void) 35 { 36 serial8250_uart_init(&console_data, CONSOLE_UART_BASE, 37 CONSOLE_UART_CLK_IN_HZ, CONSOLE_BAUDRATE); 38 register_serial_console(&console_data.chip); 39 } 40