xref: /optee_os/core/include/console.h (revision e031c4e562023fd9f199e39fd2e85797e4cbdca9)
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 void plat_console_init(void);
18 void plat_trace_init(void);
19 
20 struct serial_chip;
21 void register_serial_console(struct serial_chip *chip);
22 
23 #ifdef CFG_DT
24 /*
25  * Get console info from a reacheable DTB. Check the embedded DTB and fall
26  * back to the external DTB.
27  *
28  * If the DTB does not specify a chosen (or secure-chosen) node, we assume
29  * DTB does not provide specific console directive. Early console may remain.
30  * If the DTB does not specify any console in the chosen (or secure-chosen)
31  * node, we assume there is no console. Early console would be disabled.
32  *
33  * @fdt_out: Output DTB address where console directive is found
34  * @offs_out: Output offset in the DTB where console directive is found
35  * @path_out: Output string configuration of the console from the DTB.
36  * (*path_out) shall be freed using nex_free().
37  * @params_out: Output console parameters found from the DTB.
38  * (*params_out) shall be freed using nex_free().
39  *
40  * Return a TEE_Result compliant return value
41  *
42  */
43 TEE_Result get_console_node_from_dt(void *fdt, int *offs_out,
44 				    char **path_out, char **params_out);
45 
46 /*
47  * Check if the /secure-chosen or /chosen node in the DT contains an
48  * stdout-path value for which we have a compatible driver. If so, switch
49  * the console to this device.
50  */
51 void configure_console_from_dt(void);
52 #else
53 static inline void configure_console_from_dt(void)
54 {}
55 #endif /* !CFG_DT */
56 
57 #endif /* __CONSOLE_H */
58 
59