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/5232
-gerrit
commit 02017ff3ad76d30effd2b9fe97534090c79eb70b Author: Kyösti Mälkki kyosti.malkki@gmail.com Date: Mon Feb 17 21:34:42 2014 +0200
console: Fix includes
Do not pull in console hw-specific prototypes everywhere with console.h as those are not needed for higher levels.
Move prototypes for UARTs next to other consoles.
Change-Id: Icbc9cd3e5bdfdab85d7dccd7c3827bba35248fb8 Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com --- src/arch/armv7/early_console.c | 2 ++ src/arch/x86/lib/romcc_console.c | 1 + src/arch/x86/lib/romstage_console.c | 14 +++----- src/console/cbmem_console.c | 1 + src/console/console.c | 6 ++++ src/console/uart8250_console.c | 1 + src/console/uart8250mem_console.c | 1 + src/cpu/allwinner/a10/uart.c | 2 +- src/cpu/allwinner/a10/uart_console.c | 2 +- src/cpu/samsung/exynos5250/uart.c | 2 +- src/cpu/samsung/exynos5420/uart.c | 2 +- src/cpu/ti/am335x/uart.c | 2 +- src/cpu/x86/smm/smiutil.c | 2 +- src/drivers/oxford/oxpcie/oxpcie.c | 1 + src/drivers/oxford/oxpcie/oxpcie_early.c | 2 +- src/drivers/uart/pl011.c | 2 +- src/drivers/uart/util.c | 2 +- src/include/console/console.h | 16 --------- src/include/console/uart.h | 49 ++++++++++++++++++++++++++ src/include/uart.h | 47 ------------------------ src/include/uart8250.h | 2 -- src/lib/cbmem.c | 1 + src/lib/cbmem_console.c | 1 + src/lib/coreboot_table.c | 1 + src/lib/uart8250.c | 2 +- src/lib/uart8250mem.c | 2 +- src/mainboard/cubietech/cubieboard/bootblock.c | 2 +- src/mainboard/ti/beaglebone/bootblock.c | 2 +- src/northbridge/intel/sandybridge/raminit.c | 1 + 29 files changed, 84 insertions(+), 87 deletions(-)
diff --git a/src/arch/armv7/early_console.c b/src/arch/armv7/early_console.c index b6339fc..93ea38d 100644 --- a/src/arch/armv7/early_console.c +++ b/src/arch/armv7/early_console.c @@ -18,6 +18,8 @@ */
#include <console/console.h> +#include <console/cbmem_console.h> +#include <console/uart.h> #include <console/vtxprintf.h>
/* FIXME: need to make console driver more generic */ diff --git a/src/arch/x86/lib/romcc_console.c b/src/arch/x86/lib/romcc_console.c index c5e6882..52b8a87 100644 --- a/src/arch/x86/lib/romcc_console.c +++ b/src/arch/x86/lib/romcc_console.c @@ -20,6 +20,7 @@ #include <stdint.h> #include <console/loglevel.h> #include <console/post_codes.h> +#include <console/ne2k.h>
/* __PRE_RAM__ */ /* Using a global varible can cause problems when we reset the stack diff --git a/src/arch/x86/lib/romstage_console.c b/src/arch/x86/lib/romstage_console.c index 4ef702f..4981f39 100644 --- a/src/arch/x86/lib/romstage_console.c +++ b/src/arch/x86/lib/romstage_console.c @@ -19,20 +19,16 @@
#include <smp/node.h> #include <console/console.h> +#include <console/cbmem_console.h> +#include <console/uart.h> +#include <console/usb.h> +#include <console/ne2k.h> +#include <console/spkmodem.h> #include <console/vtxprintf.h>
#if CONFIG_CONSOLE_SERIAL8250 || CONFIG_CONSOLE_SERIAL8250MEM #include <uart8250.h> #endif -#if CONFIG_USBDEBUG -#include <console/usb.h> -#endif -#if CONFIG_CONSOLE_NE2K -#include <console/ne2k.h> -#endif -#if CONFIG_SPKMODEM -#include <console/spkmodem.h> -#endif
void console_tx_byte(unsigned char byte) { diff --git a/src/console/cbmem_console.c b/src/console/cbmem_console.c index 2c43f5c..870ce2f 100644 --- a/src/console/cbmem_console.c +++ b/src/console/cbmem_console.c @@ -18,6 +18,7 @@ */
#include <console/console.h> +#include <console/cbmem_console.h>
static void cbmemc_init_(void) { diff --git a/src/console/console.c b/src/console/console.c index 081113c..334e140 100644 --- a/src/console/console.c +++ b/src/console/console.c @@ -18,6 +18,12 @@ */
#include <console/console.h> +#include <console/cbmem_console.h> +#include <console/uart.h> +#include <console/usb.h> +#include <console/ne2k.h> +#include <console/spkmodem.h> + #include <build.h> #include <arch/hlt.h> #include <arch/io.h> diff --git a/src/console/uart8250_console.c b/src/console/uart8250_console.c index 196412c..86f1401 100644 --- a/src/console/uart8250_console.c +++ b/src/console/uart8250_console.c @@ -18,6 +18,7 @@ */
#include <console/console.h> +#include <console/uart.h> #include <uart8250.h>
static void ttyS0_init(void) diff --git a/src/console/uart8250mem_console.c b/src/console/uart8250mem_console.c index 3833e47..eb4e0e0 100644 --- a/src/console/uart8250mem_console.c +++ b/src/console/uart8250mem_console.c @@ -18,6 +18,7 @@ */
#include <console/console.h> +#include <console/uart.h> #include <uart8250.h>
static u32 uart_bar = 0; diff --git a/src/cpu/allwinner/a10/uart.c b/src/cpu/allwinner/a10/uart.c index 990026b..10ea09a 100644 --- a/src/cpu/allwinner/a10/uart.c +++ b/src/cpu/allwinner/a10/uart.c @@ -7,7 +7,7 @@
#include "uart.h" #include <arch/io.h> -#include <uart.h> +#include <console/uart.h> #include <uart8250.h>
/** diff --git a/src/cpu/allwinner/a10/uart_console.c b/src/cpu/allwinner/a10/uart_console.c index f7bd3c6..af66cb7 100644 --- a/src/cpu/allwinner/a10/uart_console.c +++ b/src/cpu/allwinner/a10/uart_console.c @@ -8,7 +8,7 @@
#include <config.h> #include <types.h> -#include <uart.h> +#include <console/uart.h> #include <arch/io.h>
#include <console/console.h> diff --git a/src/cpu/samsung/exynos5250/uart.c b/src/cpu/samsung/exynos5250/uart.c index 10108a8..c9d8d25 100644 --- a/src/cpu/samsung/exynos5250/uart.c +++ b/src/cpu/samsung/exynos5250/uart.c @@ -18,7 +18,7 @@ */
#include <console/console.h> /* for __console definition */ -#include <uart.h> +#include <console/uart.h> #include <arch/io.h> #include "uart.h" #include "clk.h" diff --git a/src/cpu/samsung/exynos5420/uart.c b/src/cpu/samsung/exynos5420/uart.c index 2ca8271..f9dd268 100644 --- a/src/cpu/samsung/exynos5420/uart.c +++ b/src/cpu/samsung/exynos5420/uart.c @@ -18,7 +18,7 @@ */
#include <console/console.h> /* for __console definition */ -#include <uart.h> +#include <console/uart.h> #include <arch/io.h> #include "uart.h" #include "clk.h" diff --git a/src/cpu/ti/am335x/uart.c b/src/cpu/ti/am335x/uart.c index 719215e..f6f1a8d 100644 --- a/src/cpu/ti/am335x/uart.c +++ b/src/cpu/ti/am335x/uart.c @@ -18,7 +18,7 @@
#include <config.h> #include <types.h> -#include <uart.h> +#include <console/uart.h> #include <arch/io.h>
#include <console/console.h> /* for __console definition */ diff --git a/src/cpu/x86/smm/smiutil.c b/src/cpu/x86/smm/smiutil.c index a50a16a..98ef223 100644 --- a/src/cpu/x86/smm/smiutil.c +++ b/src/cpu/x86/smm/smiutil.c @@ -23,7 +23,7 @@ #include <cpu/x86/cache.h> #include <cpu/x86/smm.h> #include <console/console.h> -#include <uart.h> +#include <console/uart.h> #include <uart8250.h> #include <console/vtxprintf.h>
diff --git a/src/drivers/oxford/oxpcie/oxpcie.c b/src/drivers/oxford/oxpcie/oxpcie.c index f719fc7..26d29f8 100644 --- a/src/drivers/oxford/oxpcie/oxpcie.c +++ b/src/drivers/oxford/oxpcie/oxpcie.c @@ -22,6 +22,7 @@ #include <device/pci.h> #include <device/pci_ids.h> #include <console/console.h> +#include <uart8250.h> #include <arch/io.h>
static void oxford_oxpcie_enable(device_t dev) diff --git a/src/drivers/oxford/oxpcie/oxpcie_early.c b/src/drivers/oxford/oxpcie/oxpcie_early.c index 4f6f964..edb0523 100644 --- a/src/drivers/oxford/oxpcie/oxpcie_early.c +++ b/src/drivers/oxford/oxpcie/oxpcie_early.c @@ -21,7 +21,7 @@ #include <arch/io.h> #include <arch/early_variables.h> #include <delay.h> -#include <uart.h> +#include <console/uart.h> #include <uart8250.h> #include <device/pci_def.h>
diff --git a/src/drivers/uart/pl011.c b/src/drivers/uart/pl011.c index af085ac..376e95c 100644 --- a/src/drivers/uart/pl011.c +++ b/src/drivers/uart/pl011.c @@ -14,7 +14,7 @@ */
#include <console/console.h> -#include <uart.h> +#include <console/uart.h>
static void pl011_uart_tx_byte(unsigned char data) { diff --git a/src/drivers/uart/util.c b/src/drivers/uart/util.c index e09b686..72bf50e 100644 --- a/src/drivers/uart/util.c +++ b/src/drivers/uart/util.c @@ -16,7 +16,7 @@ */
#include <console/console.h> -#include <uart.h> +#include <console/uart.h> #if CONFIG_USE_OPTION_TABLE #include <option.h> #include "option_table.h" diff --git a/src/include/console/console.h b/src/include/console/console.h index 6fa624c..dfeedda 100644 --- a/src/include/console/console.h +++ b/src/include/console/console.h @@ -24,22 +24,6 @@ #include <console/loglevel.h> #include <console/post_codes.h>
-#if CONFIG_CONSOLE_SERIAL -#include <uart.h> -#endif -#if CONFIG_USBDEBUG && !defined(__ROMCC__) -#include <console/usb.h> -#endif -#if CONFIG_CONSOLE_NE2K -#include <console/ne2k.h> -#endif -#if CONFIG_CONSOLE_CBMEM -#include <console/cbmem_console.h> -#endif -#if CONFIG_SPKMODEM -#include <console/spkmodem.h> -#endif - #ifndef __PRE_RAM__ unsigned char console_rx_byte(void); int console_tst_byte(void); diff --git a/src/include/console/uart.h b/src/include/console/uart.h new file mode 100644 index 0000000..9b52a78 --- /dev/null +++ b/src/include/console/uart.h @@ -0,0 +1,49 @@ +/* + * This file is part of the coreboot project. + * + * Copyright (C) 2012 The ChromiumOS Authors. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * 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. + * + * 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 + */ + +#ifndef CONSOLE_UART_H +#define CONSOLE_UART_H + +/* Return the clock frequency UART uses as reference clock for + * baudrate generator. */ +unsigned int uart_platform_refclk(void); + +/* Return the baudrate determined from option_table, or when that is + * not used, CONFIG_TTYS0_BAUD. + */ +unsigned int default_baudrate(void); + +/* Returns the divisor value for a given baudrate. + * The formula to satisfy is: + * refclk / divisor = baudrate * oversample + */ +unsigned int uart_baudrate_divisor(unsigned int baudrate, + unsigned int refclk, unsigned int oversample); + + +unsigned char uart_rx_byte(void); +void uart_tx_byte(unsigned char data); +void uart_tx_flush(void); +void uart_init(void); + +uint32_t uartmem_getbaseaddr(void); + +void oxford_init(void); + +#endif /* CONSOLE_UART_H */ diff --git a/src/include/uart.h b/src/include/uart.h deleted file mode 100644 index 997fe18..0000000 --- a/src/include/uart.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * This file is part of the coreboot project. - * - * Copyright (C) 2012 The ChromiumOS Authors. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * 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. - * - * 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 - */ - -#ifndef UART_H -#define UART_H - -/* Return the clock frequency UART uses as reference clock for - * baudrate generator. */ -unsigned int uart_platform_refclk(void); - -/* Return the baudrate determined from option_table, or when that is - * not used, CONFIG_TTYS0_BAUD. - */ -unsigned int default_baudrate(void); - -/* Returns the divisor value for a given baudrate. - * The formula to satisfy is: - * refclk / divisor = baudrate * oversample - */ -unsigned int uart_baudrate_divisor(unsigned int baudrate, - unsigned int refclk, unsigned int oversample); - - -unsigned char uart_rx_byte(void); -void uart_tx_byte(unsigned char data); -void uart_tx_flush(void); -void uart_init(void); - -uint32_t uartmem_getbaseaddr(void); - -#endif /* UART_H */ diff --git a/src/include/uart8250.h b/src/include/uart8250.h index 112cd44..af95796 100644 --- a/src/include/uart8250.h +++ b/src/include/uart8250.h @@ -129,8 +129,6 @@ u32 uart_mem_init(void); #if defined(__PRE_RAM__) && CONFIG_DRIVERS_OXFORD_OXPCIE /* and special init for OXPCIe based cards */ extern int oxford_oxpcie_present; - -void oxford_init(void); #endif #endif
diff --git a/src/lib/cbmem.c b/src/lib/cbmem.c index d97f6af..3fea49a 100644 --- a/src/lib/cbmem.c +++ b/src/lib/cbmem.c @@ -23,6 +23,7 @@ #include <cbmem.h> #include <boot/coreboot_tables.h> #include <console/console.h> +#include <console/cbmem_console.h> #include <arch/early_variables.h> #if CONFIG_HAVE_ACPI_RESUME && !defined(__PRE_RAM__) #include <arch/acpi.h> diff --git a/src/lib/cbmem_console.c b/src/lib/cbmem_console.c index 83d44e3..9d5419a 100644 --- a/src/lib/cbmem_console.c +++ b/src/lib/cbmem_console.c @@ -18,6 +18,7 @@ */
#include <console/console.h> +#include <console/cbmem_console.h> #include <cbmem.h> #include <arch/early_variables.h> #include <string.h> diff --git a/src/lib/coreboot_table.c b/src/lib/coreboot_table.c index d5dc14c..167eda0 100644 --- a/src/lib/coreboot_table.c +++ b/src/lib/coreboot_table.c @@ -21,6 +21,7 @@ */
#include <console/console.h> +#include <console/uart.h> #include <ip_checksum.h> #include <boot/coreboot_tables.h> #include <string.h> diff --git a/src/lib/uart8250.c b/src/lib/uart8250.c index d136eb8..3171e00 100644 --- a/src/lib/uart8250.c +++ b/src/lib/uart8250.c @@ -19,7 +19,7 @@ */
#include <arch/io.h> -#include <uart.h> +#include <console/uart.h> #include <uart8250.h> #include <trace.h>
diff --git a/src/lib/uart8250mem.c b/src/lib/uart8250mem.c index 5e96825..f35da05 100644 --- a/src/lib/uart8250mem.c +++ b/src/lib/uart8250mem.c @@ -19,7 +19,7 @@ */
#include <arch/io.h> -#include <uart.h> +#include <console/uart.h> #include <uart8250.h> #include <device/device.h> #include <delay.h> diff --git a/src/mainboard/cubietech/cubieboard/bootblock.c b/src/mainboard/cubietech/cubieboard/bootblock.c index 2e5929c..e22c1d8 100644 --- a/src/mainboard/cubietech/cubieboard/bootblock.c +++ b/src/mainboard/cubietech/cubieboard/bootblock.c @@ -7,7 +7,7 @@ */
#include <arch/io.h> -#include <uart.h> +#include <console/uart.h> #include <console/console.h> #include <delay.h> #include <cpu/allwinner/a10/gpio.h> diff --git a/src/mainboard/ti/beaglebone/bootblock.c b/src/mainboard/ti/beaglebone/bootblock.c index dd46040..9e0a62e 100644 --- a/src/mainboard/ti/beaglebone/bootblock.c +++ b/src/mainboard/ti/beaglebone/bootblock.c @@ -19,7 +19,7 @@
#include <arch/io.h> #include <types.h> -#include <uart.h> +#include <console/uart.h> #include <console/console.h> #include <cpu/ti/am335x/pinmux.h>
diff --git a/src/northbridge/intel/sandybridge/raminit.c b/src/northbridge/intel/sandybridge/raminit.c index b9c3839..bfb4033 100644 --- a/src/northbridge/intel/sandybridge/raminit.c +++ b/src/northbridge/intel/sandybridge/raminit.c @@ -18,6 +18,7 @@ */
#include <console/console.h> +#include <console/usb.h> #include <string.h> #include <arch/hlt.h> #include <arch/io.h>