1 /* SPDX-License-Identifier: BSD-2-Clause */ 2 /* 3 * Copyright (c) 2014, Linaro Limited 4 */ 5 6 #ifndef __CONSOLE_H 7 #define __CONSOLE_H 8 9 #include <compiler.h> 10 #include <tee_api_types.h> 11 12 13 void console_init(void); 14 void console_putc(int ch); 15 void console_flush(void); 16 17 struct serial_chip; 18 void register_serial_console(struct serial_chip *chip); 19 20 #ifdef CFG_DT 21 /* 22 * Get console info from a reacheable DTB. Check the embedded DTB and fall 23 * back to the external DTB. 24 * 25 * If the DTB does not specify a chosen (or secure-chosen) node, we assume 26 * DTB does not provide specific console directive. Early console may remain. 27 * If the DTB does not specify any console in the chosen (or secure-chosen) 28 * node, we assume there is no console. Early console would be disabled. 29 * 30 * @fdt_out: Output DTB address where console directive is found 31 * @offs_out: Output offset in the DTB where console directive is found 32 * @path_out: Output string configuration of the console from the DTB. 33 * (*path_out) shall be freed using nex_free(). 34 * @params_out: Output console parameters found from the DTB. 35 * (*params_out) shall be freed using nex_free(). 36 * 37 * Return a TEE_Result compliant return value 38 * 39 */ 40 TEE_Result get_console_node_from_dt(void *fdt, int *offs_out, 41 char **path_out, char **params_out); 42 43 /* 44 * Check if the /secure-chosen or /chosen node in the DT contains an 45 * stdout-path value for which we have a compatible driver. If so, switch 46 * the console to this device. 47 */ 48 void configure_console_from_dt(void); 49 #else 50 static inline void configure_console_from_dt(void) 51 {} 52 #endif /* !CFG_DT */ 53 54 #endif /* __CONSOLE_H */ 55 56