blob: c4365f3e6d9cf1c173983fa6c992149a9add181b [file] [log] [blame]
Eric Biederman8ca8d762003-04-22 19:02:15 +00001/*
Stefan Reinauer2a8ad412010-09-27 18:49:46 +00002 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2003 Eric Biederman
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
Eric Biederman8ca8d762003-04-22 19:02:15 +000014 */
15
Kyösti Mälkki1d7541f2014-02-17 21:34:42 +020016#include <console/cbmem_console.h>
Edward O'Callaghan0ddb8262014-06-17 18:37:08 +100017#include <console/ne2k.h>
18#include <console/qemu_debugcon.h>
19#include <console/spkmodem.h>
20#include <console/streams.h>
Kyösti Mälkki1d7541f2014-02-17 21:34:42 +020021#include <console/uart.h>
22#include <console/usb.h>
Martin Roth3a543182015-09-28 15:27:24 -060023#include <console/spi.h>
Edward O'Callaghan0ddb8262014-06-17 18:37:08 +100024#include <rules.h>
Kyösti Mälkki1d7541f2014-02-17 21:34:42 +020025
Kyösti Mälkki21333f92014-02-14 10:04:31 +020026void console_hw_init(void)
Stefan Reinauer5a1f5972010-03-31 14:34:40 +000027{
Kyösti Mälkkif3390862014-02-26 15:19:04 +020028 __cbmemc_init();
29 __spkmodem_init();
30 __qemu_debugcon_init();
31
32 __uart_init();
33 __ne2k_init();
34 __usbdebug_init();
Martin Roth3a543182015-09-28 15:27:24 -060035 __spiconsole_init();
Stefan Reinauer5a1f5972010-03-31 14:34:40 +000036}
Kyösti Mälkkifd956242014-02-03 17:04:22 +020037
Kyösti Mälkkifd956242014-02-03 17:04:22 +020038void console_tx_byte(unsigned char byte)
39{
Kyösti Mälkkif3390862014-02-26 15:19:04 +020040 __cbmemc_tx_byte(byte);
41 __spkmodem_tx_byte(byte);
42 __qemu_debugcon_tx_byte(byte);
43
Kyösti Mälkkid4a72f72015-05-13 20:20:00 +030044 /* Some consoles want newline conversion
45 * to keep terminals happy.
46 */
47 if (byte == '\n') {
48 __uart_tx_byte('\r');
49 __usb_tx_byte('\r');
50 }
51
Kyösti Mälkkif3390862014-02-26 15:19:04 +020052 __uart_tx_byte(byte);
53 __ne2k_tx_byte(byte);
54 __usb_tx_byte(byte);
Martin Roth3a543182015-09-28 15:27:24 -060055 __spiconsole_tx_byte(byte);
Kyösti Mälkkifd956242014-02-03 17:04:22 +020056}
57
58void console_tx_flush(void)
59{
Kyösti Mälkkif3390862014-02-26 15:19:04 +020060 __uart_tx_flush();
61 __ne2k_tx_flush();
62 __usb_tx_flush();
Kyösti Mälkki40760722014-02-27 19:30:18 +020063}
Kyösti Mälkkif2f7f032014-04-04 15:05:28 +030064
65
66#if CONFIG_GDB_STUB && (ENV_ROMSTAGE || ENV_RAMSTAGE)
67void gdb_hw_init(void)
68{
69 __gdb_hw_init();
70}
71
72void gdb_tx_byte(unsigned char byte)
73{
74 __gdb_tx_byte(byte);
75}
76
77void gdb_tx_flush(void)
78{
79 __gdb_tx_flush();
80}
81
82unsigned char gdb_rx_byte(void)
83{
84 return __gdb_rx_byte();
85}
86#endif