coreboot-kgpe-d16/src/console/console.c
Martin Roth 3a54318856 Add EM100 'hyper term' spi console support in ramstage & smm
The EM100Pro allows the debug console to be sent over the SPI bus.
This is not yet working in romstage due to the use of static variables
in the SPI driver code.  It is also not working on chipsets that have
SPI write buffers of less than 10 characters due to the 9 byte
command/header length specified by the EM100 protocol.

While this currently works only with the EM100, it seems like it would
be useful on any logic analyzer with SPI debug - just filter on command
bytes of 0x11.

Change-Id: Icd42ccd96cab0a10a4e70f4b02ecf9de8169564b
Signed-off-by: Martin Roth <martinroth@google.com>
Reviewed-on: http://review.coreboot.org/11743
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2015-10-05 17:43:11 +00:00

90 lines
1.8 KiB
C

/*
* This file is part of the coreboot project.
*
* Copyright (C) 2003 Eric Biederman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc.
*/
#include <console/cbmem_console.h>
#include <console/ne2k.h>
#include <console/qemu_debugcon.h>
#include <console/spkmodem.h>
#include <console/streams.h>
#include <console/uart.h>
#include <console/usb.h>
#include <console/spi.h>
#include <rules.h>
void console_hw_init(void)
{
__cbmemc_init();
__spkmodem_init();
__qemu_debugcon_init();
__uart_init();
__ne2k_init();
__usbdebug_init();
__spiconsole_init();
}
void console_tx_byte(unsigned char byte)
{
__cbmemc_tx_byte(byte);
__spkmodem_tx_byte(byte);
__qemu_debugcon_tx_byte(byte);
/* Some consoles want newline conversion
* to keep terminals happy.
*/
if (byte == '\n') {
__uart_tx_byte('\r');
__usb_tx_byte('\r');
}
__uart_tx_byte(byte);
__ne2k_tx_byte(byte);
__usb_tx_byte(byte);
__spiconsole_tx_byte(byte);
}
void console_tx_flush(void)
{
__uart_tx_flush();
__ne2k_tx_flush();
__usb_tx_flush();
}
#if CONFIG_GDB_STUB && (ENV_ROMSTAGE || ENV_RAMSTAGE)
void gdb_hw_init(void)
{
__gdb_hw_init();
}
void gdb_tx_byte(unsigned char byte)
{
__gdb_tx_byte(byte);
}
void gdb_tx_flush(void)
{
__gdb_tx_flush();
}
unsigned char gdb_rx_byte(void)
{
return __gdb_rx_byte();
}
#endif