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 <dhendrix@chromium.org> Signed-off-by: Ronald G. Minnich <rminnich@gmail.com> Reviewed-on: http://review.coreboot.org/2086 Tested-by: build bot (Jenkins)
This commit is contained in:
parent
10c90d3126
commit
6a503b6a0f
|
@ -5,6 +5,13 @@ config SERIAL_CONSOLE
|
|||
help
|
||||
Send coreboot debug output to a serial port
|
||||
|
||||
config EARLY_SERIAL_CONSOLE
|
||||
bool
|
||||
depends on SERIAL_CONSOLE
|
||||
default n
|
||||
help
|
||||
Use serial console during early (pre-RAM) boot stages
|
||||
|
||||
config CONSOLE_SERIAL8250
|
||||
bool "Serial port console output (I/O mapped, 8250-compatible)"
|
||||
depends on SERIAL_CONSOLE
|
||||
|
|
|
@ -10,7 +10,7 @@ smm-y += vtxprintf.c
|
|||
smm-$(CONFIG_SMM_TSEG) += die.c
|
||||
|
||||
romstage-y += vtxprintf.c
|
||||
romstage-$(CONFIG_CACHE_AS_RAM) += console.c
|
||||
romstage-$(CONFIG_EARLY_SERIAL_CONSOLE) += console.c
|
||||
romstage-y += post.c
|
||||
romstage-y += die.c
|
||||
|
||||
|
|
|
@ -99,13 +99,15 @@ int console_tst_byte(void)
|
|||
|
||||
#else // __PRE_RAM__ ^^^ NOT defined vvv defined
|
||||
|
||||
#include <uart.h>
|
||||
|
||||
void console_init(void)
|
||||
{
|
||||
#if CONFIG_USBDEBUG
|
||||
enable_usbdebug(CONFIG_USBDEBUG_DEFAULT_PORT);
|
||||
early_usbdebug_init();
|
||||
#endif
|
||||
#if CONFIG_CONSOLE_SERIAL8250
|
||||
#if CONFIG_HAVE_UART_IO_MAPPED || CONFIG_HAVE_UART_MEMORY_MAPPED
|
||||
uart_init();
|
||||
#endif
|
||||
#if CONFIG_DRIVERS_OXFORD_OXPCIE && CONFIG_CONSOLE_SERIAL8250MEM
|
||||
|
|
|
@ -16,6 +16,7 @@ source src/cpu/x86/Kconfig
|
|||
|
||||
config CACHE_AS_RAM
|
||||
bool
|
||||
select EARLY_SERIAL_CONSOLE
|
||||
default !ROMCC
|
||||
|
||||
config DCACHE_RAM_BASE
|
||||
|
|
|
@ -5,6 +5,7 @@ config CPU_SAMSUNG_EXYNOS
|
|||
config CPU_SAMSUNG_EXYNOS5
|
||||
depends on ARCH_ARMV7
|
||||
select CPU_SAMSUNG_EXYNOS
|
||||
select EARLY_SERIAL_CONSOLE
|
||||
bool
|
||||
default n
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
//#include <common.h>
|
||||
//#include <linux/compiler.h>
|
||||
#include <types.h>
|
||||
#include <uart.h>
|
||||
#include <arch/io.h>
|
||||
//#include <asm/arch-exynos/spl.h>
|
||||
|
@ -34,7 +35,6 @@
|
|||
|
||||
#include <cpu/samsung/exynos5-common/exynos5-common.h>
|
||||
#include <cpu/samsung/exynos5250/clk.h>
|
||||
#include <cpu/samsung/exynos5250/uart.h>
|
||||
|
||||
#define RX_FIFO_COUNT_MASK 0xff
|
||||
#define RX_FIFO_FULL_MASK (1 << 8)
|
||||
|
@ -218,12 +218,12 @@ static const struct console_driver exynos5_uart_console __console = {
|
|||
//unsigned char (*uart_rx_byte)(unsigned base_port) = exynos5_uart_rx_byte;
|
||||
//void (*uart_tx_byte)(unsigned base_port, unsigned char data) = exynos5_uart_tx_byte;
|
||||
/* FIXME: trivial wrappers */
|
||||
void uart_init()
|
||||
void uart_init(void)
|
||||
{
|
||||
exynos5_init_dev();
|
||||
}
|
||||
|
||||
unsigned char uart_rx_byte()
|
||||
unsigned char uart_rx_byte(void)
|
||||
{
|
||||
return exynos5_uart_rx_byte();
|
||||
}
|
||||
|
|
|
@ -68,4 +68,5 @@ static inline int s5p_uart_divslot(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void uart_init(void);
|
||||
#endif
|
||||
|
|
|
@ -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 <uart8250.h>
|
||||
#endif
|
||||
|
||||
#if CONFIG_CPU_SAMSUNG_EXYNOS5
|
||||
#include <cpu/samsung/exynos5250/uart.h>
|
||||
#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 */
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue