xref: /aosp_15_r20/external/coreboot/src/include/console/system76_ec.h (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #ifndef CONSOLE_SYSTEM76_EC_H
4 #define CONSOLE_SYSTEM76_EC_H 1
5 
6 #include <stddef.h>
7 #include <stdint.h>
8 
9 void system76_ec_init(void);
10 void system76_ec_flush(void);
11 void system76_ec_print(uint8_t byte);
12 
13 #define __CONSOLE_SYSTEM76_EC_ENABLE__	(CONFIG(CONSOLE_SYSTEM76_EC) && \
14 	(ENV_BOOTBLOCK || ENV_SEPARATE_ROMSTAGE || ENV_RAMSTAGE \
15 	 || ENV_SEPARATE_VERSTAGE || ENV_POSTCAR \
16 	 || (ENV_SMM && CONFIG(DEBUG_SMI))))
17 
18 #if __CONSOLE_SYSTEM76_EC_ENABLE__
__system76_ec_init(void)19 static inline void __system76_ec_init(void)
20 {
21 	system76_ec_init();
22 }
__system76_ec_tx_flush(void)23 static inline void __system76_ec_tx_flush(void)
24 {
25 	system76_ec_flush();
26 }
__system76_ec_tx_byte(unsigned char byte)27 static inline void __system76_ec_tx_byte(unsigned char byte)
28 {
29 	system76_ec_print(byte);
30 }
31 #else
__system76_ec_init(void)32 static inline void __system76_ec_init(void) {}
__system76_ec_tx_flush(void)33 static inline void __system76_ec_tx_flush(void) {}
__system76_ec_tx_byte(unsigned char byte)34 static inline void __system76_ec_tx_byte(unsigned char byte) {}
35 #endif
36 
37 #endif
38