From 5f83f6cb7a3f179482db54aaff38f23795dc1acf Mon Sep 17 00:00:00 2001 From: Hung-Te Lin Date: Mon, 4 Feb 2013 14:38:03 +0800 Subject: armv7: Clean up arm/snow bootblock build process. Remove duplicated / testing code and share more driver for bootblock, romstage and ramstage. The __PRE_RAM__ is now also defined in bootblock build stage, since bootblock is executed before RAM is initialized. Change-Id: I4f5469b1545631eee1cf9f2f5df93cbe3a58268b Signed-off-by: Hung-Te Lin Reviewed-on: http://review.coreboot.org/2282 Tested-by: build bot (Jenkins) Reviewed-by: Ronald G. Minnich --- src/arch/armv7/bootblock_exit.c | 28 ---------------------------- src/arch/armv7/bootblock_simple.c | 10 +++++----- src/arch/armv7/include/arch/bootblock_exit.h | 26 -------------------------- src/arch/armv7/include/arch/stages.h | 2 +- src/arch/armv7/lib/Makefile.inc | 2 +- src/arch/armv7/lib/romstage_console.c | 12 +++++------- src/arch/armv7/stages.c | 4 ++-- 7 files changed, 14 insertions(+), 70 deletions(-) delete mode 100644 src/arch/armv7/bootblock_exit.c delete mode 100644 src/arch/armv7/include/arch/bootblock_exit.h (limited to 'src/arch') diff --git a/src/arch/armv7/bootblock_exit.c b/src/arch/armv7/bootblock_exit.c deleted file mode 100644 index 8b97d6b6a3..0000000000 --- a/src/arch/armv7/bootblock_exit.c +++ /dev/null @@ -1,28 +0,0 @@ -/* - * This file is part of the coreboot project. - * - * Copyright (C) 2013 Google Inc - * - * 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 - */ - -#include - -void bootblock_exit(unsigned long addr) -{ - __attribute__((noreturn)) void (*doit)(void) = (void *)addr; - doit(); -} diff --git a/src/arch/armv7/bootblock_simple.c b/src/arch/armv7/bootblock_simple.c index e808edcd35..fe2662e022 100644 --- a/src/arch/armv7/bootblock_simple.c +++ b/src/arch/armv7/bootblock_simple.c @@ -38,19 +38,19 @@ static int boot_cpu(void) void main(void) { - const char *target1 = "fallback/romstage"; - unsigned long romstage_entry; + const char *stage_name = "fallback/romstage"; + void *entry; if (boot_cpu()) { bootblock_cpu_init(); bootblock_mainboard_init(); } + printk(BIOS_INFO, "hello from bootblock\n"); printk(BIOS_INFO, "bootblock main(): loading romstage\n"); - romstage_entry = (unsigned long)cbfs_load_stage( - CBFS_DEFAULT_MEDIA, target1); + entry = cbfs_load_stage(CBFS_DEFAULT_MEDIA, stage_name); printk(BIOS_INFO, "bootblock main(): jumping to romstage\n"); - if (romstage_entry) stage_exit(romstage_entry); + if (entry) stage_exit(entry); hlt(); } diff --git a/src/arch/armv7/include/arch/bootblock_exit.h b/src/arch/armv7/include/arch/bootblock_exit.h deleted file mode 100644 index 0a039e195d..0000000000 --- a/src/arch/armv7/include/arch/bootblock_exit.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * This file is part of the coreboot project. - * - * Copyright (C) 2013 Google Inc - * - * 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 - */ - -/** - * This is a shim that is to be compiled for the instruction set matching - * that of the entry point for the next boot stage (romstage). - */ -void bootblock_exit(unsigned long addr); diff --git a/src/arch/armv7/include/arch/stages.h b/src/arch/armv7/include/arch/stages.h index 215aaa8086..671c02b3dd 100644 --- a/src/arch/armv7/include/arch/stages.h +++ b/src/arch/armv7/include/arch/stages.h @@ -23,6 +23,6 @@ extern void main(void); void stage_entry(void) __attribute__((section(".text.stage_entry.armv7"))); -void stage_exit(unsigned long); +void stage_exit(void *); #endif diff --git a/src/arch/armv7/lib/Makefile.inc b/src/arch/armv7/lib/Makefile.inc index e33618bfc3..343e9f8378 100644 --- a/src/arch/armv7/lib/Makefile.inc +++ b/src/arch/armv7/lib/Makefile.inc @@ -1,4 +1,5 @@ bootblock-y += syslib.c +bootblock-y += romstage_console.c romstage-y += cache_v7.c romstage-y += cache-cp15.c @@ -8,7 +9,6 @@ romstage-y += romstage_console.c romstage-y += syslib.c #ramstage-y += printk_init.c -#romstage-y += walkcbfs.S ramstage-y += div0.c ramstage-y += div64.S diff --git a/src/arch/armv7/lib/romstage_console.c b/src/arch/armv7/lib/romstage_console.c index ead26f3521..42a96646b0 100644 --- a/src/arch/armv7/lib/romstage_console.c +++ b/src/arch/armv7/lib/romstage_console.c @@ -19,6 +19,7 @@ #include #include +// TODO Unify with x86 (CONFIG_CONSOLE_SERIAL8250) #if CONFIG_SERIAL_CONSOLE #include #endif @@ -43,18 +44,15 @@ void console_tx_byte(unsigned char byte) #endif } -/* FIXME(dhendrix): add this back in */ -#if 0 -static void console_tx_flush(void) +static void _console_tx_flush(void) { -#if CONFIG_CONSOLE_SERIAL - uart_tx_flush(CONFIG_CONSOLE_SERIAL_UART_ADDRESS); +#if CONFIG_SERIAL_CONSOLE + uart_tx_flush(); #endif #if CONFIG_USBDEBUG usbdebug_tx_flush(0); #endif } -#endif int do_printk(int msg_level, const char *fmt, ...) { @@ -69,7 +67,7 @@ int do_printk(int msg_level, const char *fmt, ...) i = vtxprintf(console_tx_byte, fmt, args); va_end(args); -// console_tx_flush(); + _console_tx_flush(); return i; } diff --git a/src/arch/armv7/stages.c b/src/arch/armv7/stages.c index fd4374ff9c..e8a47e52fe 100644 --- a/src/arch/armv7/stages.c +++ b/src/arch/armv7/stages.c @@ -38,8 +38,8 @@ void stage_entry(void) main(); } -void stage_exit(unsigned long addr) +void stage_exit(void *addr) { - __attribute__((noreturn)) void (*doit)(void) = (void *)addr; + __attribute__((noreturn)) void (*doit)(void) = addr; doit(); } -- cgit v1.2.3