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 <dhendrix@chromium.org> Reviewed-on: http://review.coreboot.org/2180 Tested-by: build bot (Jenkins) Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
This commit is contained in:
parent
f5726ea544
commit
35934415c4
|
@ -239,10 +239,19 @@ $(objgenerated)/bootblock_inc.S: $$(bootblock_inc)
|
||||||
@printf " GEN $(subst $(obj)/,,$(@))\n"
|
@printf " GEN $(subst $(obj)/,,$(@))\n"
|
||||||
printf '$(foreach crt0,$(bootblock_inc),#include "$(crt0)"\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
|
$(objgenerated)/bootblock.o: $(objgenerated)/bootblock.s
|
||||||
@printf " CC $(subst $(obj)/,,$(@))\n"
|
@printf " CC $(subst $(obj)/,,$(@))\n"
|
||||||
$(CC) -Wa,-acdlns -c -o $@ $< > $(basename $@).disasm
|
$(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
|
$(objgenerated)/bootblock.s: $(objgenerated)/bootblock_inc.S $(obj)/config.h $(obj)/build.h
|
||||||
@printf " CC $(subst $(obj)/,,$(@))\n"
|
@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 $@
|
$(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
|
$< > $(objgenerated)/bootblock.inc.d
|
||||||
$(CC) -c -S $(CFLAGS) -I. $(INCLUDES) $< -o $@
|
$(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"
|
@printf " LINK $(subst $(obj)/,,$(@))\n"
|
||||||
ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y)
|
ifeq ($(CONFIG_COMPILER_LLVM_CLANG),y)
|
||||||
$(LD) -m armelf_linux_eabi -static -o $@.tmp -L$(obj) $< -T $(objgenerated)/bootblock.ld
|
$(LD) -m armelf_linux_eabi -static -o $@.tmp -L$(obj) $< -T $(objgenerated)/bootblock.ld
|
||||||
else
|
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
|
endif
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
|
@ -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 <arch/bootblock_exit.h>
|
||||||
|
|
||||||
|
void bootblock_exit(unsigned long addr)
|
||||||
|
{
|
||||||
|
__attribute__((noreturn)) void (*doit)(void) = (void *)addr;
|
||||||
|
doit();
|
||||||
|
}
|
|
@ -20,6 +20,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <bootblock_common.h>
|
#include <bootblock_common.h>
|
||||||
|
#include <arch/bootblock_exit.h>
|
||||||
#include <arch/cbfs.h>
|
#include <arch/cbfs.h>
|
||||||
#include <arch/hlt.h>
|
#include <arch/hlt.h>
|
||||||
|
|
||||||
|
@ -36,7 +37,7 @@ static int boot_cpu(void)
|
||||||
void main(unsigned long bist)
|
void main(unsigned long bist)
|
||||||
{
|
{
|
||||||
const char *target1 = "fallback/romstage";
|
const char *target1 = "fallback/romstage";
|
||||||
unsigned long entry;
|
unsigned long romstage_entry;
|
||||||
|
|
||||||
if (boot_cpu()) {
|
if (boot_cpu()) {
|
||||||
bootblock_cpu_init();
|
bootblock_cpu_init();
|
||||||
|
@ -44,8 +45,8 @@ void main(unsigned long bist)
|
||||||
}
|
}
|
||||||
|
|
||||||
printk(BIOS_INFO, "bootblock main(): loading romstage\n");
|
printk(BIOS_INFO, "bootblock main(): loading romstage\n");
|
||||||
entry = loadstage(target1);
|
romstage_entry = loadstage(target1);
|
||||||
printk(BIOS_INFO, "bootblock main(): jumping to romstage\n");
|
printk(BIOS_INFO, "bootblock main(): jumping to romstage\n");
|
||||||
if (entry) call(entry);
|
if (romstage_entry) bootblock_exit(romstage_entry);
|
||||||
hlt();
|
hlt();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
|
@ -98,21 +98,4 @@ static unsigned long loadstage(const char* target)
|
||||||
return 0;
|
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
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue