xref: /aosp_15_r20/external/coreboot/src/include/console/cbmem_console.h (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 #ifndef _CONSOLE_CBMEM_CONSOLE_H_
3 #define _CONSOLE_CBMEM_CONSOLE_H_
4 
5 #include <stdint.h>
6 #include <stddef.h>
7 
8 void cbmemc_init(void);
9 void cbmemc_tx_byte(unsigned char data);
10 
11 #define __CBMEM_CONSOLE_ENABLE__	(CONFIG(CONSOLE_CBMEM) && \
12 	(ENV_RAMSTAGE || ENV_SEPARATE_VERSTAGE || ENV_POSTCAR  || \
13 	 ENV_SEPARATE_ROMSTAGE || (ENV_BOOTBLOCK && CONFIG(BOOTBLOCK_CONSOLE)) || \
14 	 (ENV_SMM && CONFIG(DEBUG_SMI))))
15 
16 #if __CBMEM_CONSOLE_ENABLE__
__cbmemc_init(void)17 static inline void __cbmemc_init(void)	{ cbmemc_init(); }
__cbmemc_tx_byte(u8 data)18 static inline void __cbmemc_tx_byte(u8 data)	{ cbmemc_tx_byte(data); }
19 #else
__cbmemc_init(void)20 static inline void __cbmemc_init(void)	{}
__cbmemc_tx_byte(u8 data)21 static inline void __cbmemc_tx_byte(u8 data)	{}
22 #endif
23 
24 /*
25  * Copy an external cbmem_console into the active cbmem_console.
26  */
27 void cbmemc_copy_in(void *buffer, size_t size);
28 
29 void cbmem_dump_console_to_uart(void);
30 void cbmem_dump_console(void);
31 #endif
32 
33 /* Retrieves the location of the CBMEM Console buffer in SMM mode */
34 void smm_get_cbmemc_buffer(void **buffer_out, size_t *size_out);
35