xref: /optee_os/core/include/console.h (revision 3d3b05918ec9052ba13de82fbcaba204766eb636)
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 in the DTB
33  * @params_out: Output console parameters found from the DTB
34  *
35  * Return a TEE_Result compliant return value
36  *
37  */
38 TEE_Result get_console_node_from_dt(void **fdt_out, int *offs_out,
39 				    const char **path_out,
40 				    const char **params_out);
41 
42 /*
43  * Check if the /secure-chosen or /chosen node in the DT contains an
44  * stdout-path value for which we have a compatible driver. If so, switch
45  * the console to this device.
46  */
47 void configure_console_from_dt(void);
48 #else
49 static inline void configure_console_from_dt(void)
50 {}
51 #endif /* !CFG_DT */
52 
53 #endif /* CONSOLE_H */
54 
55