11bb92983SJerome Forissier // SPDX-License-Identifier: BSD-2-Clause
266d9cacfSPhilip Attfield /*
366d9cacfSPhilip Attfield * Copyright (c) 2016, Sequitur Labs Inc. All rights reserved.
466d9cacfSPhilip Attfield * All rights reserved.
566d9cacfSPhilip Attfield *
666d9cacfSPhilip Attfield * Redistribution and use in source and binary forms, with or without
766d9cacfSPhilip Attfield * modification, are permitted provided that the following conditions are met:
866d9cacfSPhilip Attfield *
966d9cacfSPhilip Attfield * 1. Redistributions of source code must retain the above copyright notice,
1066d9cacfSPhilip Attfield * this list of conditions and the following disclaimer.
1166d9cacfSPhilip Attfield *
1266d9cacfSPhilip Attfield * 2. Redistributions in binary form must reproduce the above copyright notice,
1366d9cacfSPhilip Attfield * this list of conditions and the following disclaimer in the documentation
1466d9cacfSPhilip Attfield * and/or other materials provided with the distribution.
1566d9cacfSPhilip Attfield *
1666d9cacfSPhilip Attfield * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
1766d9cacfSPhilip Attfield * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1866d9cacfSPhilip Attfield * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1966d9cacfSPhilip Attfield * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
2066d9cacfSPhilip Attfield * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2166d9cacfSPhilip Attfield * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2266d9cacfSPhilip Attfield * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2366d9cacfSPhilip Attfield * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2466d9cacfSPhilip Attfield * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2566d9cacfSPhilip Attfield * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2666d9cacfSPhilip Attfield * POSSIBILITY OF SUCH DAMAGE.
2766d9cacfSPhilip Attfield */
2866d9cacfSPhilip Attfield
2966d9cacfSPhilip Attfield #include <console.h>
3066d9cacfSPhilip Attfield #include <drivers/serial8250_uart.h>
3166d9cacfSPhilip Attfield #include <kernel/panic.h>
3266d9cacfSPhilip Attfield #include <mm/core_memprot.h>
3366d9cacfSPhilip Attfield #include <mm/tee_pager.h>
3466d9cacfSPhilip Attfield #include <platform_config.h>
3566d9cacfSPhilip Attfield #include <stdint.h>
3666d9cacfSPhilip Attfield
37a5e82dc7SJerome Forissier register_phys_mem_pgdir(MEM_AREA_IO_NSEC,
38303753faSEtienne Carriere CONSOLE_UART_BASE, SERIAL8250_UART_REG_SIZE);
3959fffc71SEtienne Carriere
4023660121SJerome Forissier static struct serial8250_uart_data console_data;
41d66fa083SJerome Forissier
plat_console_init(void)42*55ab8f06SAlvin Chang void plat_console_init(void)
4366d9cacfSPhilip Attfield {
44d66fa083SJerome Forissier serial8250_uart_init(&console_data, CONSOLE_UART_BASE,
45d66fa083SJerome Forissier CONSOLE_UART_CLK_IN_HZ, CONSOLE_BAUDRATE);
46756aea59SJerome Forissier register_serial_console(&console_data.chip);
4766d9cacfSPhilip Attfield }
48