Kyösti Mälkki (kyosti.malkki@gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/5162
-gerrit
commit db947a0e891bc177a0f4436ae4c430966172b4ca Author: Kyösti Mälkki kyosti.malkki@gmail.com Date: Fri Feb 7 10:44:41 2014 +0200
QEMU pl011 console: Move under drivers/emulation/qemu
Also make this console under Kconfig control.
Change-Id: I3f20b7f944bc7d0e5ace9d22198d4c16a3839d2c Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com --- src/console/Kconfig | 12 +++++-- src/drivers/emulation/qemu/Makefile.inc | 13 ++++++-- src/drivers/emulation/qemu/qemu_pl011_uart.c | 37 +++++++++++++++++++++ src/mainboard/emulation/qemu-armv7/Makefile.inc | 2 ++ src/mainboard/emulation/qemu-armv7/uart.c | 43 +++++++------------------ 5 files changed, 70 insertions(+), 37 deletions(-)
diff --git a/src/console/Kconfig b/src/console/Kconfig index 40903c1..e22af05 100644 --- a/src/console/Kconfig +++ b/src/console/Kconfig @@ -314,19 +314,25 @@ config CONSOLE_CAR_BUFFER_SIZE
config CONSOLE_QEMU_DEBUGCON bool "QEMU debug console output" - depends on BOARD_EMULATION_QEMU_X86 + depends on BOARD_EMULATION_QEMU_X86 || BOARD_EMULATION_QEMU_ARMV7 default y help - Send coreboot debug output to QEMU's isa-debugcon device: + Send coreboot debug output to QEMU debug console.
+ For qemu-x86: qemu-system-x86_64 \ -chardev file,id=debugcon,path=/dir/file.log \ -device isa-debugcon,iobase=0x402,chardev=debugcon
+ For qemu-armv7: + qemu-system-arm -M vexpress-a9 \ + -m 1024M -serial stdio -kernel build/coreboot.rom + config CONSOLE_QEMU_DEBUGCON_PORT hex "QEMU debug console port" depends on CONSOLE_QEMU_DEBUGCON - default 0x402 + default 0x402 if BOARD_EMULATION_QEMU_X86 + default 0x10009000 if BOARD_EMULATION_QEMU_ARMV7
choice prompt "Default console log level" diff --git a/src/drivers/emulation/qemu/Makefile.inc b/src/drivers/emulation/qemu/Makefile.inc index 3351627..16364f6 100644 --- a/src/drivers/emulation/qemu/Makefile.inc +++ b/src/drivers/emulation/qemu/Makefile.inc @@ -1,5 +1,14 @@ -romstage-$(CONFIG_CONSOLE_QEMU_DEBUGCON) += qemu_debugcon.c -ramstage-$(CONFIG_CONSOLE_QEMU_DEBUGCON) += qemu_debugcon.c +ifeq ($(CONFIG_CONSOLE_QEMU_DEBUGCON),y) +ifeq ($(CONFIG_BOARD_EMULATION_QEMU_X86),y) +romstage-$(CONFIG_EARLY_CONSOLE) += qemu_debugcon.c +ramstage-y += qemu_debugcon.c +endif +ifeq ($(CONFIG_BOARD_EMULATION_QEMU_ARMV7),y) +bootblock-$(CONFIG_BOOTBLOCK_CONSOLE) += qemu_pl011_uart.c +romstage-$(CONFIG_EARLY_CONSOLE) += qemu_pl011_uart.c +ramstage-y += qemu_pl011_uart.c +endif +endif
ramstage-$(CONFIG_DRIVERS_EMULATION_QEMU_BOCHS) += bochs.c ramstage-$(CONFIG_DRIVERS_EMULATION_QEMU_BOCHS) += cirrus.c diff --git a/src/drivers/emulation/qemu/qemu_pl011_uart.c b/src/drivers/emulation/qemu/qemu_pl011_uart.c new file mode 100644 index 0000000..88f1ffe --- /dev/null +++ b/src/drivers/emulation/qemu/qemu_pl011_uart.c @@ -0,0 +1,37 @@ +/* + * This file is part of the coreboot project. + * + * Copyright (C) 2013 Google, Inc. + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * 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. + */ + +#include <console/console.h> +#include <console/qemu_debugcon.h> +#include <uart.h> + +void qemu_debugcon_init(void) +{ +} + +void qemu_debugcon_tx_byte(unsigned char data) +{ + volatile unsigned int *uart0_address = + (unsigned int *)CONFIG_CONSOLE_QEMU_DEBUGCON_PORT; + + *uart0_address = (unsigned int)data; +} + +#if !defined(__PRE_RAM__) +uint32_t uartmem_getbaseaddr(void) +{ + return CONFIG_CONSOLE_QEMU_DEBUGCON_PORT; +} +#endif diff --git a/src/mainboard/emulation/qemu-armv7/Makefile.inc b/src/mainboard/emulation/qemu-armv7/Makefile.inc index 431d9ab..a3bac27 100644 --- a/src/mainboard/emulation/qemu-armv7/Makefile.inc +++ b/src/mainboard/emulation/qemu-armv7/Makefile.inc @@ -22,6 +22,8 @@ bootblock-y += timer.c romstage-y += timer.c ramstage-y += timer.c
+ifeq ($(CONFIG_CONSOLE_QEMU_DEBUGCON),y) bootblock-$(CONFIG_BOOTBLOCK_CONSOLE) += uart.c romstage-$(CONFIG_EARLY_CONSOLE) += uart.c ramstage-y += uart.c +endif diff --git a/src/mainboard/emulation/qemu-armv7/uart.c b/src/mainboard/emulation/qemu-armv7/uart.c index dfe5d0a..5710150 100644 --- a/src/mainboard/emulation/qemu-armv7/uart.c +++ b/src/mainboard/emulation/qemu-armv7/uart.c @@ -14,47 +14,26 @@ */
#include <console/console.h> +#include <console/qemu_debugcon.h> #include <uart.h>
-#define VEXPRESS_UART0_IO_ADDRESS (0x10009000) - -static void pl011_init_dev(void) { -} - -static void pl011_uart_tx_byte(unsigned char data) { - static volatile unsigned int *uart0_address = - (unsigned int *)VEXPRESS_UART0_IO_ADDRESS; - - *uart0_address = (unsigned int)data; -} - -static void pl011_uart_tx_flush(void) { -} - -#if !defined(__PRE_RAM__) - -static const struct console_driver pl011_uart_console __console = { - .init = pl011_init_dev, - .tx_byte = pl011_uart_tx_byte, - .tx_flush = pl011_uart_tx_flush, -}; - -uint32_t uartmem_getbaseaddr(void) -{ - return VEXPRESS_UART0_IO_ADDRESS; -} -#else void uart_init(void) { - pl011_init_dev(); }
void uart_tx_byte(unsigned char data) { - pl011_uart_tx_byte(data); + qemu_debugcon_tx_byte(data); }
-void uart_tx_flush(void) { - pl011_uart_tx_flush(); +void uart_tx_flush(void) +{ } + +#if !defined(__PRE_RAM__) +static const struct console_driver pl011_uart_console __console = { + .init = uart_init, + .tx_byte = uart_tx_byte, + .tx_flush = uart_tx_flush, +}; #endif