From 1d7541feeba372ec3d1d441442238e1c65972bd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ky=C3=B6sti=20M=C3=A4lkki?= Date: Mon, 17 Feb 2014 21:34:42 +0200 Subject: console: Fix includes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-on: http://review.coreboot.org/5232 Tested-by: build bot (Jenkins) Reviewed-by: Edward O'Callaghan Reviewed-by: Paul Menzel Reviewed-by: Stefan Reinauer --- 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(-) create mode 100644 src/include/console/uart.h delete mode 100644 src/include/uart.h (limited to 'src') diff --git a/src/arch/armv7/early_console.c b/src/arch/armv7/early_console.c index b6339fcbf3..93ea38d43a 100644 --- a/src/arch/armv7/early_console.c +++ b/src/arch/armv7/early_console.c @@ -18,6 +18,8 @@ */ #include +#include +#include #include /* 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 c5e688258b..52b8a872a5 100644 --- a/src/arch/x86/lib/romcc_console.c +++ b/src/arch/x86/lib/romcc_console.c @@ -20,6 +20,7 @@ #include #include #include +#include /* __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 4ef702f603..4981f39ee7 100644 --- a/src/arch/x86/lib/romstage_console.c +++ b/src/arch/x86/lib/romstage_console.c @@ -19,20 +19,16 @@ #include #include +#include +#include +#include +#include +#include #include #if CONFIG_CONSOLE_SERIAL8250 || CONFIG_CONSOLE_SERIAL8250MEM #include #endif -#if CONFIG_USBDEBUG -#include -#endif -#if CONFIG_CONSOLE_NE2K -#include -#endif -#if CONFIG_SPKMODEM -#include -#endif void console_tx_byte(unsigned char byte) { diff --git a/src/console/cbmem_console.c b/src/console/cbmem_console.c index 2c43f5c967..870ce2f2c4 100644 --- a/src/console/cbmem_console.c +++ b/src/console/cbmem_console.c @@ -18,6 +18,7 @@ */ #include +#include static void cbmemc_init_(void) { diff --git a/src/console/console.c b/src/console/console.c index 081113c6db..334e14012a 100644 --- a/src/console/console.c +++ b/src/console/console.c @@ -18,6 +18,12 @@ */ #include +#include +#include +#include +#include +#include + #include #include #include diff --git a/src/console/uart8250_console.c b/src/console/uart8250_console.c index 196412c628..86f1401d8c 100644 --- a/src/console/uart8250_console.c +++ b/src/console/uart8250_console.c @@ -18,6 +18,7 @@ */ #include +#include #include static void ttyS0_init(void) diff --git a/src/console/uart8250mem_console.c b/src/console/uart8250mem_console.c index 3833e47a7b..eb4e0e0b7e 100644 --- a/src/console/uart8250mem_console.c +++ b/src/console/uart8250mem_console.c @@ -18,6 +18,7 @@ */ #include +#include #include static u32 uart_bar = 0; diff --git a/src/cpu/allwinner/a10/uart.c b/src/cpu/allwinner/a10/uart.c index 990026be26..10ea09af32 100644 --- a/src/cpu/allwinner/a10/uart.c +++ b/src/cpu/allwinner/a10/uart.c @@ -7,7 +7,7 @@ #include "uart.h" #include -#include +#include #include /** diff --git a/src/cpu/allwinner/a10/uart_console.c b/src/cpu/allwinner/a10/uart_console.c index f7bd3c6dc6..af66cb7f6b 100644 --- a/src/cpu/allwinner/a10/uart_console.c +++ b/src/cpu/allwinner/a10/uart_console.c @@ -8,7 +8,7 @@ #include #include -#include +#include #include #include diff --git a/src/cpu/samsung/exynos5250/uart.c b/src/cpu/samsung/exynos5250/uart.c index 10108a8139..c9d8d252ad 100644 --- a/src/cpu/samsung/exynos5250/uart.c +++ b/src/cpu/samsung/exynos5250/uart.c @@ -18,7 +18,7 @@ */ #include /* for __console definition */ -#include +#include #include #include "uart.h" #include "clk.h" diff --git a/src/cpu/samsung/exynos5420/uart.c b/src/cpu/samsung/exynos5420/uart.c index 2ca8271eac..f9dd26837f 100644 --- a/src/cpu/samsung/exynos5420/uart.c +++ b/src/cpu/samsung/exynos5420/uart.c @@ -18,7 +18,7 @@ */ #include /* for __console definition */ -#include +#include #include #include "uart.h" #include "clk.h" diff --git a/src/cpu/ti/am335x/uart.c b/src/cpu/ti/am335x/uart.c index 719215ec8c..f6f1a8d137 100644 --- a/src/cpu/ti/am335x/uart.c +++ b/src/cpu/ti/am335x/uart.c @@ -18,7 +18,7 @@ #include #include -#include +#include #include #include /* for __console definition */ diff --git a/src/cpu/x86/smm/smiutil.c b/src/cpu/x86/smm/smiutil.c index a50a16ab4d..98ef223073 100644 --- a/src/cpu/x86/smm/smiutil.c +++ b/src/cpu/x86/smm/smiutil.c @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/drivers/oxford/oxpcie/oxpcie.c b/src/drivers/oxford/oxpcie/oxpcie.c index f719fc7f2d..26d29f858b 100644 --- a/src/drivers/oxford/oxpcie/oxpcie.c +++ b/src/drivers/oxford/oxpcie/oxpcie.c @@ -22,6 +22,7 @@ #include #include #include +#include #include 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 4f6f9649f5..edb0523e52 100644 --- a/src/drivers/oxford/oxpcie/oxpcie_early.c +++ b/src/drivers/oxford/oxpcie/oxpcie_early.c @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/drivers/uart/pl011.c b/src/drivers/uart/pl011.c index af085acbea..376e95c0c8 100644 --- a/src/drivers/uart/pl011.c +++ b/src/drivers/uart/pl011.c @@ -14,7 +14,7 @@ */ #include -#include +#include static void pl011_uart_tx_byte(unsigned char data) { diff --git a/src/drivers/uart/util.c b/src/drivers/uart/util.c index e09b686a9c..72bf50e72b 100644 --- a/src/drivers/uart/util.c +++ b/src/drivers/uart/util.c @@ -16,7 +16,7 @@ */ #include -#include +#include #if CONFIG_USE_OPTION_TABLE #include #include "option_table.h" diff --git a/src/include/console/console.h b/src/include/console/console.h index 6fa624c799..dfeedda5e0 100644 --- a/src/include/console/console.h +++ b/src/include/console/console.h @@ -24,22 +24,6 @@ #include #include -#if CONFIG_CONSOLE_SERIAL -#include -#endif -#if CONFIG_USBDEBUG && !defined(__ROMCC__) -#include -#endif -#if CONFIG_CONSOLE_NE2K -#include -#endif -#if CONFIG_CONSOLE_CBMEM -#include -#endif -#if CONFIG_SPKMODEM -#include -#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 0000000000..9b52a78c69 --- /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 997fe185ce..0000000000 --- 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 112cd44945..af95796733 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 33fa721767..34168e394a 100644 --- a/src/lib/cbmem.c +++ b/src/lib/cbmem.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #if CONFIG_HAVE_ACPI_RESUME && !defined(__PRE_RAM__) #include diff --git a/src/lib/cbmem_console.c b/src/lib/cbmem_console.c index 83d44e3a13..9d5419a185 100644 --- a/src/lib/cbmem_console.c +++ b/src/lib/cbmem_console.c @@ -18,6 +18,7 @@ */ #include +#include #include #include #include diff --git a/src/lib/coreboot_table.c b/src/lib/coreboot_table.c index 667c685981..4d392191a4 100644 --- a/src/lib/coreboot_table.c +++ b/src/lib/coreboot_table.c @@ -21,6 +21,7 @@ */ #include +#include #include #include #include diff --git a/src/lib/uart8250.c b/src/lib/uart8250.c index d136eb8867..3171e00d13 100644 --- a/src/lib/uart8250.c +++ b/src/lib/uart8250.c @@ -19,7 +19,7 @@ */ #include -#include +#include #include #include diff --git a/src/lib/uart8250mem.c b/src/lib/uart8250mem.c index 5e96825834..f35da05ae5 100644 --- a/src/lib/uart8250mem.c +++ b/src/lib/uart8250mem.c @@ -19,7 +19,7 @@ */ #include -#include +#include #include #include #include diff --git a/src/mainboard/cubietech/cubieboard/bootblock.c b/src/mainboard/cubietech/cubieboard/bootblock.c index 2e5929c019..e22c1d8cf8 100644 --- a/src/mainboard/cubietech/cubieboard/bootblock.c +++ b/src/mainboard/cubietech/cubieboard/bootblock.c @@ -7,7 +7,7 @@ */ #include -#include +#include #include #include #include diff --git a/src/mainboard/ti/beaglebone/bootblock.c b/src/mainboard/ti/beaglebone/bootblock.c index dd46040847..9e0a62e719 100644 --- a/src/mainboard/ti/beaglebone/bootblock.c +++ b/src/mainboard/ti/beaglebone/bootblock.c @@ -19,7 +19,7 @@ #include #include -#include +#include #include #include diff --git a/src/northbridge/intel/sandybridge/raminit.c b/src/northbridge/intel/sandybridge/raminit.c index b9c3839e15..bfb403317a 100644 --- a/src/northbridge/intel/sandybridge/raminit.c +++ b/src/northbridge/intel/sandybridge/raminit.c @@ -18,6 +18,7 @@ */ #include +#include #include #include #include -- cgit v1.2.3