11bb92983SJerome Forissier /* SPDX-License-Identifier: BSD-2-Clause */ 24de4bebcSJens Wiklander /* 34de4bebcSJens Wiklander * Copyright (c) 2014, Linaro Limited 44de4bebcSJens Wiklander */ 54de4bebcSJens Wiklander 6d50fee03SEtienne Carriere #ifndef __CONSOLE_H 7d50fee03SEtienne Carriere #define __CONSOLE_H 84de4bebcSJens Wiklander 94dc31c52SJerome Forissier #include <compiler.h> 10770b2afaSEtienne Carriere #include <tee_api_types.h> 11770b2afaSEtienne Carriere 124dc31c52SJerome Forissier 136ef34537SSY Chiu void console_init(void); 144de4bebcSJens Wiklander void console_putc(int ch); 15db886a7fSJerome Forissier void console_flush(void); 164de4bebcSJens Wiklander 17*55ab8f06SAlvin Chang void plat_console_init(void); 18*55ab8f06SAlvin Chang 19756aea59SJerome Forissier struct serial_chip; 20756aea59SJerome Forissier void register_serial_console(struct serial_chip *chip); 21756aea59SJerome Forissier 224dc31c52SJerome Forissier #ifdef CFG_DT 23770b2afaSEtienne Carriere /* 24770b2afaSEtienne Carriere * Get console info from a reacheable DTB. Check the embedded DTB and fall 25770b2afaSEtienne Carriere * back to the external DTB. 26770b2afaSEtienne Carriere * 27770b2afaSEtienne Carriere * If the DTB does not specify a chosen (or secure-chosen) node, we assume 28770b2afaSEtienne Carriere * DTB does not provide specific console directive. Early console may remain. 29770b2afaSEtienne Carriere * If the DTB does not specify any console in the chosen (or secure-chosen) 30770b2afaSEtienne Carriere * node, we assume there is no console. Early console would be disabled. 31770b2afaSEtienne Carriere * 32770b2afaSEtienne Carriere * @fdt_out: Output DTB address where console directive is found 33770b2afaSEtienne Carriere * @offs_out: Output offset in the DTB where console directive is found 34d2c717b2SJerome Forissier * @path_out: Output string configuration of the console from the DTB. 35d2c717b2SJerome Forissier * (*path_out) shall be freed using nex_free(). 36d2c717b2SJerome Forissier * @params_out: Output console parameters found from the DTB. 37d2c717b2SJerome Forissier * (*params_out) shall be freed using nex_free(). 38770b2afaSEtienne Carriere * 39770b2afaSEtienne Carriere * Return a TEE_Result compliant return value 40770b2afaSEtienne Carriere * 41770b2afaSEtienne Carriere */ 42286c31d4SEtienne Carriere TEE_Result get_console_node_from_dt(void *fdt, int *offs_out, 43d2c717b2SJerome Forissier char **path_out, char **params_out); 44770b2afaSEtienne Carriere 45770b2afaSEtienne Carriere /* 46770b2afaSEtienne Carriere * Check if the /secure-chosen or /chosen node in the DT contains an 47770b2afaSEtienne Carriere * stdout-path value for which we have a compatible driver. If so, switch 48770b2afaSEtienne Carriere * the console to this device. 49770b2afaSEtienne Carriere */ 502f82082fSEdison Ai void configure_console_from_dt(void); 514dc31c52SJerome Forissier #else configure_console_from_dt(void)522f82082fSEdison Aistatic inline void configure_console_from_dt(void) 534dc31c52SJerome Forissier {} 544dc31c52SJerome Forissier #endif /* !CFG_DT */ 554dc31c52SJerome Forissier 56d50fee03SEtienne Carriere #endif /* __CONSOLE_H */ 574de4bebcSJens Wiklander 58