Fred Reitberger has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/72751 )
Change subject: console: Add SimNow console logging ......................................................................
console: Add SimNow console logging
The AMD SimNow tool supports fast logging through an IO port. Add a new console to support SimNow logging through port 80.
TEST=observe significant speed improvements on SimNow console log
Signed-off-by: Fred Reitberger reitbergerfred@gmail.com Change-Id: I42a431f48ea14ba4adacbd4a32e15abe7c5e4951 --- M src/console/Kconfig M src/console/console.c M src/include/console/console.h A src/include/console/simnow.h A src/soc/amd/common/block/simnow/Makefile.inc A src/soc/amd/common/block/simnow/simnow_console.c 6 files changed, 86 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/51/72751/1
diff --git a/src/console/Kconfig b/src/console/Kconfig index c6aec18..721cc60 100644 --- a/src/console/Kconfig +++ b/src/console/Kconfig @@ -367,6 +367,14 @@ help Send coreboot debug output to a System76 embedded controller.
+config CONSOLE_AMD_SIMNOW + bool "AMD SimNow console output" + default n + depends on SOC_AMD_COMMON && !POST_IO + select CONSOLE_POST + help + Send coreboot debug output to IO ports for SimNow + config CONSOLE_OVERRIDE_LOGLEVEL bool help diff --git a/src/console/console.c b/src/console/console.c index 499a336..9a079ed 100644 --- a/src/console/console.c +++ b/src/console/console.c @@ -5,6 +5,7 @@ #include <console/i2c_smbus.h> #include <console/ne2k.h> #include <console/qemu_debugcon.h> +#include <console/simnow.h> #include <console/spi.h> #include <console/spkmodem.h> #include <console/streams.h> @@ -28,6 +29,7 @@ __flashconsole_init(); __system76_ec_init(); __i2c_smbus_console_init(); + __simnow_console_init(); }
void console_interactive_tx_byte(unsigned char byte, void *data_unused) @@ -47,6 +49,7 @@ __spiconsole_tx_byte(byte); __system76_ec_tx_byte(byte); __i2c_smbus_console_tx_byte(byte); + __simnow_console_tx_byte(byte); }
void console_stored_tx_byte(unsigned char byte, void *data_unused) diff --git a/src/include/console/console.h b/src/include/console/console.h index 6f44d7f..c69efcd 100644 --- a/src/include/console/console.h +++ b/src/include/console/console.h @@ -72,7 +72,7 @@ #define HAS_ONLY_FAST_CONSOLES !(CONFIG(SPKMODEM) || CONFIG(CONSOLE_QEMU_DEBUGCON) || \ CONFIG(CONSOLE_SERIAL) || CONFIG(CONSOLE_NE2K) || CONFIG(CONSOLE_USB) || \ CONFIG(EM100PRO_SPI_CONSOLE) || CONFIG(CONSOLE_SPI_FLASH) || \ - CONFIG(CONSOLE_SYSTEM76_EC)) + CONFIG(CONSOLE_SYSTEM76_EC) || CONFIG(CONSOLE_AMD_SIMNOW))
#else static inline int get_log_level(void) { return -1; } diff --git a/src/include/console/simnow.h b/src/include/console/simnow.h new file mode 100644 index 0000000..9a9d679 --- /dev/null +++ b/src/include/console/simnow.h @@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef CONSOLE_SIMNOW_H +#define CONSOLE_SIMNOW_H + +#include <stdint.h> + +void simnow_console_init(void); +void simnow_console_tx_byte(unsigned char data); + +#define __SIMNOW_CONSOLE_ENABLE__ CONFIG(CONSOLE_AMD_SIMNOW) + +#if __SIMNOW_CONSOLE_ENABLE__ +static inline void __simnow_console_init(void) +{ + simnow_console_init(); +} + +static inline void __simnow_console_tx_byte(u8 data) +{ + simnow_console_tx_byte(data); +} +#else +static inline void __simnow_console_init(void) {} +static inline void __simnow_console_tx_byte(u8 data) {} +#endif + +#endif /* CONSOLE_SIMNOW_H */ diff --git a/src/soc/amd/common/block/simnow/Makefile.inc b/src/soc/amd/common/block/simnow/Makefile.inc new file mode 100644 index 0000000..a109d4a --- /dev/null +++ b/src/soc/amd/common/block/simnow/Makefile.inc @@ -0,0 +1,7 @@ +## SPDX-License-Identifier: GPL-2.0-only + +all-$(CONFIG_CONSOLE_AMD_SIMNOW) += simnow_console.c + +ifeq ($(CONFIG_DEBUG_SMI),y) +smm-$(CONFIG_AMD_SOC_CONSOLE_UART) += simnow_console.c +endif diff --git a/src/soc/amd/common/block/simnow/simnow_console.c b/src/soc/amd/common/block/simnow/simnow_console.c new file mode 100644 index 0000000..478674a --- /dev/null +++ b/src/soc/amd/common/block/simnow/simnow_console.c @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include <arch/io.h> +#include <console/console.h> +#include <console/simnow.h> + +#define AMD_SIMNOW_PORT 0x80 +#define AMD_SIMNOW_PORT_DATA_BEGIN 0x5f535452ul +#define AMD_SIMNOW_PORT_DATA_END 0x5f454e44ul + +void simnow_console_init(void) +{ + outl(AMD_SIMNOW_PORT_DATA_BEGIN, AMD_SIMNOW_PORT); +} + +void simnow_console_tx_byte(unsigned char data) +{ + outb(data, AMD_SIMNOW_PORT); + + if (data == '\n') { + outl(AMD_SIMNOW_PORT_DATA_END, AMD_SIMNOW_PORT); + outl(AMD_SIMNOW_PORT_DATA_BEGIN, AMD_SIMNOW_PORT); + } +}