Eric Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 1 | /* |
Stefan Reinauer | 2a8ad41 | 2010-09-27 18:49:46 +0000 | [diff] [blame] | 2 | * 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 Biederman | 8ca8d76 | 2003-04-22 19:02:15 +0000 | [diff] [blame] | 14 | */ |
| 15 | |
Kyösti Mälkki | 1d7541f | 2014-02-17 21:34:42 +0200 | [diff] [blame] | 16 | #include <console/cbmem_console.h> |
Edward O'Callaghan | 0ddb826 | 2014-06-17 18:37:08 +1000 | [diff] [blame] | 17 | #include <console/ne2k.h> |
| 18 | #include <console/qemu_debugcon.h> |
| 19 | #include <console/spkmodem.h> |
| 20 | #include <console/streams.h> |
Kyösti Mälkki | 1d7541f | 2014-02-17 21:34:42 +0200 | [diff] [blame] | 21 | #include <console/uart.h> |
| 22 | #include <console/usb.h> |
Martin Roth | 3a54318 | 2015-09-28 15:27:24 -0600 | [diff] [blame] | 23 | #include <console/spi.h> |
Edward O'Callaghan | 0ddb826 | 2014-06-17 18:37:08 +1000 | [diff] [blame] | 24 | #include <rules.h> |
Kyösti Mälkki | 1d7541f | 2014-02-17 21:34:42 +0200 | [diff] [blame] | 25 | |
Kyösti Mälkki | 21333f9 | 2014-02-14 10:04:31 +0200 | [diff] [blame] | 26 | void console_hw_init(void) |
Stefan Reinauer | 5a1f597 | 2010-03-31 14:34:40 +0000 | [diff] [blame] | 27 | { |
Kyösti Mälkki | f339086 | 2014-02-26 15:19:04 +0200 | [diff] [blame] | 28 | __cbmemc_init(); |
| 29 | __spkmodem_init(); |
| 30 | __qemu_debugcon_init(); |
| 31 | |
| 32 | __uart_init(); |
| 33 | __ne2k_init(); |
| 34 | __usbdebug_init(); |
Martin Roth | 3a54318 | 2015-09-28 15:27:24 -0600 | [diff] [blame] | 35 | __spiconsole_init(); |
Stefan Reinauer | 5a1f597 | 2010-03-31 14:34:40 +0000 | [diff] [blame] | 36 | } |
Kyösti Mälkki | fd95624 | 2014-02-03 17:04:22 +0200 | [diff] [blame] | 37 | |
Kyösti Mälkki | fd95624 | 2014-02-03 17:04:22 +0200 | [diff] [blame] | 38 | void console_tx_byte(unsigned char byte) |
| 39 | { |
Kyösti Mälkki | f339086 | 2014-02-26 15:19:04 +0200 | [diff] [blame] | 40 | __cbmemc_tx_byte(byte); |
| 41 | __spkmodem_tx_byte(byte); |
| 42 | __qemu_debugcon_tx_byte(byte); |
| 43 | |
Kyösti Mälkki | d4a72f7 | 2015-05-13 20:20:00 +0300 | [diff] [blame] | 44 | /* 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älkki | f339086 | 2014-02-26 15:19:04 +0200 | [diff] [blame] | 52 | __uart_tx_byte(byte); |
| 53 | __ne2k_tx_byte(byte); |
| 54 | __usb_tx_byte(byte); |
Martin Roth | 3a54318 | 2015-09-28 15:27:24 -0600 | [diff] [blame] | 55 | __spiconsole_tx_byte(byte); |
Kyösti Mälkki | fd95624 | 2014-02-03 17:04:22 +0200 | [diff] [blame] | 56 | } |
| 57 | |
| 58 | void console_tx_flush(void) |
| 59 | { |
Kyösti Mälkki | f339086 | 2014-02-26 15:19:04 +0200 | [diff] [blame] | 60 | __uart_tx_flush(); |
| 61 | __ne2k_tx_flush(); |
| 62 | __usb_tx_flush(); |
Kyösti Mälkki | 4076072 | 2014-02-27 19:30:18 +0200 | [diff] [blame] | 63 | } |
Kyösti Mälkki | f2f7f03 | 2014-04-04 15:05:28 +0300 | [diff] [blame] | 64 | |
| 65 | |
| 66 | #if CONFIG_GDB_STUB && (ENV_ROMSTAGE || ENV_RAMSTAGE) |
| 67 | void gdb_hw_init(void) |
| 68 | { |
| 69 | __gdb_hw_init(); |
| 70 | } |
| 71 | |
| 72 | void gdb_tx_byte(unsigned char byte) |
| 73 | { |
| 74 | __gdb_tx_byte(byte); |
| 75 | } |
| 76 | |
| 77 | void gdb_tx_flush(void) |
| 78 | { |
| 79 | __gdb_tx_flush(); |
| 80 | } |
| 81 | |
| 82 | unsigned char gdb_rx_byte(void) |
| 83 | { |
| 84 | return __gdb_rx_byte(); |
| 85 | } |
| 86 | #endif |