2011-04-27 01:47:04 +02:00
|
|
|
/*
|
|
|
|
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <console/console.h>
|
2014-02-17 20:34:42 +01:00
|
|
|
#include <console/uart.h>
|
2011-04-27 01:47:04 +02:00
|
|
|
|
2014-02-15 09:19:23 +01:00
|
|
|
static void uartmem_init(void)
|
2011-06-23 01:39:19 +02:00
|
|
|
{
|
2014-02-15 09:19:23 +01:00
|
|
|
uart_init();
|
2011-06-23 01:39:19 +02:00
|
|
|
}
|
|
|
|
|
2011-04-27 01:47:04 +02:00
|
|
|
static void uartmem_tx_byte(unsigned char data)
|
|
|
|
{
|
2014-02-15 09:19:23 +01:00
|
|
|
uart_tx_byte(data);
|
2011-04-27 01:47:04 +02:00
|
|
|
}
|
|
|
|
|
2011-07-10 02:22:21 +02:00
|
|
|
static void uartmem_tx_flush(void)
|
|
|
|
{
|
2014-02-15 09:19:23 +01:00
|
|
|
uart_tx_flush();
|
2011-07-10 02:22:21 +02:00
|
|
|
}
|
|
|
|
|
2011-04-27 01:47:04 +02:00
|
|
|
static unsigned char uartmem_rx_byte(void)
|
|
|
|
{
|
2014-02-15 09:19:23 +01:00
|
|
|
return uart_rx_byte();
|
2011-04-27 01:47:04 +02:00
|
|
|
}
|
|
|
|
|
2014-02-14 09:31:38 +01:00
|
|
|
/* This only relevant with x86 with GDB_STUB enabled.*/
|
2011-04-27 01:47:04 +02:00
|
|
|
static int uartmem_tst_byte(void)
|
|
|
|
{
|
2014-02-13 16:16:22 +01:00
|
|
|
#if CONFIG_DRIVERS_UART_8250IO || CONFIG_DRIVERS_UART_8250MEM
|
2014-02-15 09:19:23 +01:00
|
|
|
return uart_can_rx_byte();
|
2014-02-14 09:31:38 +01:00
|
|
|
#else
|
|
|
|
return 0;
|
|
|
|
#endif
|
2011-04-27 01:47:04 +02:00
|
|
|
}
|
|
|
|
|
2014-02-14 09:31:38 +01:00
|
|
|
static const struct console_driver uart_console __console = {
|
2011-04-27 01:47:04 +02:00
|
|
|
.init = uartmem_init,
|
|
|
|
.tx_byte = uartmem_tx_byte,
|
2011-07-10 02:22:21 +02:00
|
|
|
.tx_flush = uartmem_tx_flush,
|
2011-04-27 01:47:04 +02:00
|
|
|
.rx_byte = uartmem_rx_byte,
|
|
|
|
.tst_byte = uartmem_tst_byte,
|
|
|
|
};
|