From 6a503b6a0f08bf4236c4c37d75c67182a7af4b02 Mon Sep 17 00:00:00 2001 From: David Hendricks Date: Mon, 31 Dec 2012 17:28:43 -0800 Subject: make early serial console support more generic This patch makes pre-RAM serial init more generic, particularly for platforms which do not necessarily need cache-as-RAM in order to use the serial console and do not have a standard 8250 serial port. This adds a Kconfig variable to set romstage-* for very early serial console init. The current method assumes that cache-as-RAM should enable this, so to maintain compatibility selecting CACHE_AS_RAM will also select EARLY_SERIAL_CONSOLE. The UART code structure needs some rework, but the use of ROMCC, romstage, and then ramstage makes things complex. uart.h now includes all .h files for all uarts. All 2 of them. This is actually a simplifying change. Change-Id: I089e7af633c227baf3c06c685f005e9d0e4b38ce Signed-off-by: David Hendricks Signed-off-by: Ronald G. Minnich Reviewed-on: http://review.coreboot.org/2086 Tested-by: build bot (Jenkins) --- src/include/uart.h | 22 ++++++++++++++++------ src/include/uart8250.h | 1 - 2 files changed, 16 insertions(+), 7 deletions(-) (limited to 'src/include') diff --git a/src/include/uart.h b/src/include/uart.h index 931d6dce82..6628314ae2 100644 --- a/src/include/uart.h +++ b/src/include/uart.h @@ -15,19 +15,29 @@ * 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 - * - * FIXME(dhendrix): This file contains generic prototypes for UART functions. - * The existing headers are too specific to the 8250, so we need a better - * abstraction for use with non-8250 UARTs. */ +/* madness. Uarts are a mess. If you include this file, it + * includes ALL uart implementations which may be needed. + * No need to include them separately, and include this file FIRST. + * At least one (but at most one) of the files needs to define + * uart_init(). + */ #ifndef UART_H #define UART_H +#if CONFIG_CONSOLE_SERIAL8250 +#include +#endif + +#if CONFIG_CPU_SAMSUNG_EXYNOS5 +#include +#endif + +#ifndef __ROMCC__ unsigned char uart_rx_byte(void); void uart_tx_byte(unsigned char data); void uart_tx_flush(void); - -void uart_init(void); +#endif #endif /* UART_H */ diff --git a/src/include/uart8250.h b/src/include/uart8250.h index b00ff48006..9af43f264b 100644 --- a/src/include/uart8250.h +++ b/src/include/uart8250.h @@ -120,7 +120,6 @@ unsigned char uart8250_rx_byte(unsigned base_port); int uart8250_can_rx_byte(unsigned base_port); void uart8250_tx_byte(unsigned base_port, unsigned char data); void uart8250_tx_flush(unsigned base_port); - /* Yes it is silly to have three different uart init functions. But we used to * have three different sets of uart code, so it's an improvement. */ -- cgit v1.2.3