From 35934415c4d36e094f4c53f155cb9efa3aef977e Mon Sep 17 00:00:00 2001 From: David Hendricks Date: Mon, 21 Jan 2013 20:02:15 -0800 Subject: armv7: add ARM-encoded bootblock_exit() stub This replaces the call() function with a stub which is compiled separately using -marm. See http://review.coreboot.org/#/c/2175/ for details. Change-Id: I7f8c45b5e63ec97b0a82294488129d1c97ec0cbf Signed-off-by: David Hendricks Reviewed-on: http://review.coreboot.org/2180 Tested-by: build bot (Jenkins) Reviewed-by: Ronald G. Minnich --- src/arch/armv7/Makefile.inc | 13 +++++++++++-- src/arch/armv7/bootblock_exit.c | 28 ++++++++++++++++++++++++++++ src/arch/armv7/bootblock_simple.c | 7 ++++--- src/arch/armv7/include/arch/bootblock_exit.h | 26 ++++++++++++++++++++++++++ src/arch/armv7/include/arch/cbfs.h | 17 ----------------- 5 files changed, 69 insertions(+), 22 deletions(-) create mode 100644 src/arch/armv7/bootblock_exit.c create mode 100644 src/arch/armv7/include/arch/bootblock_exit.h (limited to 'src') diff --git a/src/arch/armv7/Makefile.inc b/src/arch/armv7/Makefile.inc index 2cf6ed942f..872365c1ad 100644 --- a/src/arch/armv7/Makefile.inc +++ b/src/arch/armv7/Makefile.inc @@ -239,10 +239,19 @@ $(objgenerated)/bootblock_inc.S: $$(bootblock_inc) @printf " GEN $(subst $(obj)/,,$(@))\n" printf '$(foreach crt0,$(bootblock_inc),#include "$(crt0)"\n)' > $@ +bootblock_exit_c = $(src)/arch/armv7/bootblock_exit.c +bootblock_exit_o = $(obj)/arch/armv7/bootblock_exit.o + +$(bootblock_exit_o): $(bootblock_exit_c) + @printf " CC $(subst $(obj)/,,$(@))\n" + $(CC) -Wa,-acdlns -I. $(INCLUDES) -c -o $@ $< -marm + $(objgenerated)/bootblock.o: $(objgenerated)/bootblock.s @printf " CC $(subst $(obj)/,,$(@))\n" $(CC) -Wa,-acdlns -c -o $@ $< > $(basename $@).disasm +BOOTBLOCK_OBJS = $(objgenerated)/bootblock.o $(bootblock_exit_o) + $(objgenerated)/bootblock.s: $(objgenerated)/bootblock_inc.S $(obj)/config.h $(obj)/build.h @printf " CC $(subst $(obj)/,,$(@))\n" $(CC) -MMD -x assembler-with-cpp -E -I$(src)/include -I$(src)/arch/armv7/include -I$(obj) -include $(obj)/build.h -include $(obj)/config.h -I. -I$(src) $< -o $@ @@ -253,12 +262,12 @@ $(objgenerated)/bootblock.inc: $(src)/arch/armv7/$(subst ",,$(CONFIG_BOOTBLOCK_S $< > $(objgenerated)/bootblock.inc.d $(CC) -c -S $(CFLAGS) -I. $(INCLUDES) $< -o $@ -$(objcbfs)/bootblock.debug: $(objgenerated)/bootblock.o $(objgenerated)/bootblock.ld +$(objcbfs)/bootblock.debug: $(BOOTBLOCK_OBJS) $(objgenerated)/bootblock.ld @printf " LINK $(subst $(obj)/,,$(@))\n" ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y) $(LD) -m armelf_linux_eabi -static -o $@.tmp -L$(obj) $< -T $(objgenerated)/bootblock.ld else - $(CC) -nostdlib -nostartfiles -static -o $@ -L$(obj) -T $(objgenerated)/bootblock.ld -Wl,--start-group $< $(LIBGCC_FILE_NAME) -Wl,--end-group + $(CC) -nostdlib -nostartfiles -static -o $@ -L$(obj) -T $(objgenerated)/bootblock.ld -Wl,--start-group $(BOOTBLOCK_OBJS) $(LIBGCC_FILE_NAME) -Wl,--end-group endif ################################################################################ diff --git a/src/arch/armv7/bootblock_exit.c b/src/arch/armv7/bootblock_exit.c new file mode 100644 index 0000000000..8b97d6b6a3 --- /dev/null +++ b/src/arch/armv7/bootblock_exit.c @@ -0,0 +1,28 @@ +/* + * 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 f6bcf980b1..af76d4c973 100644 --- a/src/arch/armv7/bootblock_simple.c +++ b/src/arch/armv7/bootblock_simple.c @@ -20,6 +20,7 @@ */ #include +#include #include #include @@ -36,7 +37,7 @@ static int boot_cpu(void) void main(unsigned long bist) { const char *target1 = "fallback/romstage"; - unsigned long entry; + unsigned long romstage_entry; if (boot_cpu()) { bootblock_cpu_init(); @@ -44,8 +45,8 @@ void main(unsigned long bist) } printk(BIOS_INFO, "bootblock main(): loading romstage\n"); - entry = loadstage(target1); + romstage_entry = loadstage(target1); printk(BIOS_INFO, "bootblock main(): jumping to romstage\n"); - if (entry) call(entry); + if (romstage_entry) bootblock_exit(romstage_entry); hlt(); } diff --git a/src/arch/armv7/include/arch/bootblock_exit.h b/src/arch/armv7/include/arch/bootblock_exit.h new file mode 100644 index 0000000000..0a039e195d --- /dev/null +++ b/src/arch/armv7/include/arch/bootblock_exit.h @@ -0,0 +1,26 @@ +/* + * 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/cbfs.h b/src/arch/armv7/include/arch/cbfs.h index 99b7b43e66..f060643936 100644 --- a/src/arch/armv7/include/arch/cbfs.h +++ b/src/arch/armv7/include/arch/cbfs.h @@ -98,21 +98,4 @@ static unsigned long loadstage(const char* target) return 0; } } - -static inline void call(unsigned long addr) -{ - __attribute__((noreturn)) void (*doit)(void) = (void *)addr; - printk(BIOS_INFO, "addr: %08lx, doit: %p\n", addr, doit); - /* FIXME: dumping SRAM content for sanity checking */ - int i; - for (i = 0; i < 128; i++) { - if (i % 16 == 0) - printk(BIOS_INFO, "\n0x%08lx: ", addr + i); - else - printk(BIOS_INFO, " "); - printk(BIOS_INFO, "%02x", *(uint8_t *)(addr + i)); - } - /* FIXME: do we need to change to/from arm/thumb? */ - doit(); -} #endif -- cgit v1.2.3