David Hendricks (dhendrix(a)chromium.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/2118
-gerrit
commit ab4b4509543612ffccfff26a325ff47b809f6684
Author: David Hendricks <dhendrix(a)chromium.org>
Date: Tue Jan 8 21:05:06 2013 -0800
ARM bootblock approach
This lays out the groundwork for using a proper bootblock on ARM.
Currently we bypass the bootblock entirely and go straight to
romstage. However we want to utilize CBFS to maximize flexibility
of placing code without relying on a lot of magic numbers which
will break depending on the SoC in use.
Change-Id: I9cc2a8191d2db38b27b6363ba673e5a360de9684
Signed-off-by: Stefan Reinauer <reinauer(a)google.com>
Signed-off-by: David Hendricks <dhendrix(a)chromium.org>
---
src/arch/armv7/Makefile.inc | 24 ++++-------
src/arch/armv7/bootblock.inc | 7 +--
src/arch/armv7/bootblock.lds | 49 +++++++++++++++++++++
src/arch/armv7/bootblock_simple.c | 34 +++++++--------
src/arch/armv7/include/arch/cbfs.h | 68 +++++++++++++++++++++++++++++
src/arch/armv7/include/bootblock_common.h | 71 ++++---------------------------
src/arch/armv7/lib/id.lds | 3 +-
src/cpu/samsung/exynos5250/Kconfig | 7 ---
8 files changed, 153 insertions(+), 110 deletions(-)
diff --git a/src/arch/armv7/Makefile.inc b/src/arch/armv7/Makefile.inc
index 4cb97a6..a4f57f3 100644
--- a/src/arch/armv7/Makefile.inc
+++ b/src/arch/armv7/Makefile.inc
@@ -149,7 +149,6 @@ CFLAGS += \
# For various headers imported from Linux
CFLAGS += -D__LINUX_ARM_ARCH__=7
-crt0s = $(src)/arch/armv7/bootblock.inc
ldscripts =
ldscripts += $(src)/arch/armv7/romstage.ld
@@ -223,19 +222,14 @@ $(obj)/coreboot.pre: $(objcbfs)/romstage_xip.elf $(obj)/coreboot.pre1 $(CBFSTOOL
################################################################################
# Build the bootblock
-#bootblock_lds = $(src)/arch/armv7/ldscript_fallback_cbfs.lb
-bootblock_lds = $(src)/arch/armv7/lib/id.lds
-#bootblock_lds = $(src)/arch/armv7/romstage.ld
+bootblock_lds = $(src)/arch/armv7/bootblock.lds
+bootblock_lds += $(src)/arch/armv7/lib/id.lds
bootblock_lds += $(chipset_bootblock_lds)
+bootblock_inc += $(src)/arch/armv7/bootblock.inc
bootblock_inc += $(src)/arch/armv7/lib/id.inc
bootblock_inc += $(chipset_bootblock_inc)
-
-# FIXME: CONFIG_NEON or something similar for ARM?
-#ifeq ($(CONFIG_SSE),y)
-#bootblock_inc += $(src)/cpu/x86/sse_enable.inc
-#endif
-#bootblock_inc += $(objgenerated)/bootblock.inc
+bootblock_inc += $(objgenerated)/bootblock.inc
$(objgenerated)/bootblock.ld: $$(bootblock_lds) $(obj)/ldoptions
@printf " GEN $(subst $(obj)/,,$(@))\n"
@@ -253,11 +247,11 @@ $(objgenerated)/bootblock.s: $(objgenerated)/bootblock_inc.S $(obj)/config.h $(o
@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 $@
-#$(objgenerated)/bootblock.inc: $(src)/arch/armv7/init/$(subst ",,$(CONFIG_BOOTBLOCK_SOURCE)) $(objutil)/romcc/romcc $(OPTION_TABLE_H)
-# @printf " ROMCC $(subst $(obj)/,,$(@))\n"
-# $(CC) $(INCLUDES) -MM -MT$(objgenerated)/bootblock.inc \
-# $< > $(objgenerated)/bootblock.inc.d
-# $(ROMCC) -c -S $(bootblock_romccflags) $(ROMCCFLAGS) -I. $(INCLUDES) $< -o $@
+$(objgenerated)/bootblock.inc: $(src)/arch/armv7/$(subst ",,$(CONFIG_BOOTBLOCK_SOURCE)) $(OPTION_TABLE_H)
+ @printf " CC $(subst $(obj)/,,$(@))\n"
+ $(CC) $(INCLUDES) -MM -MT$(objgenerated)/bootblock.inc \
+ $< > $(objgenerated)/bootblock.inc.d
+ $(CC) -c -S $(CFLAGS) -I. $(INCLUDES) $< -o $@
$(objcbfs)/bootblock.debug: $(objgenerated)/bootblock.o $(objgenerated)/bootblock.ld
@printf " LINK $(subst $(obj)/,,$(@))\n"
diff --git a/src/arch/armv7/bootblock.inc b/src/arch/armv7/bootblock.inc
index f76391b..90850d6 100644
--- a/src/arch/armv7/bootblock.inc
+++ b/src/arch/armv7/bootblock.inc
@@ -36,8 +36,7 @@ _bl1:
* on ARM, which is 8KB in size and it is prepended to the
* reset vector
*/
- /* this comes a bit later. */
-// .skip 8192
+ .skip 8192
.globl _start
_start: b reset
@@ -81,10 +80,6 @@ call_bootblock:
* Thumb. However, "b" will not and GCC may attempt to create a
* wrapper which is currently broken.
*/
- /* for now call board_init_f; change later. We're trying to get as much into ToT as
- * we can
- */
- bl board_init_f
bl main
wait_for_interrupt:
diff --git a/src/arch/armv7/bootblock.lds b/src/arch/armv7/bootblock.lds
new file mode 100644
index 0000000..90e37a0
--- /dev/null
+++ b/src/arch/armv7/bootblock.lds
@@ -0,0 +1,49 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2006 Advanced Micro Devices, Inc.
+ * Copyright (C) 2008-2010 coresystems GmbH
+ *
+ * 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
+ */
+
+/* We use ELF as output format. So that we can debug the code in some form. */
+OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
+OUTPUT_ARCH(arm)
+
+TARGET(binary)
+SECTIONS
+{
+ ROMLOC = 0x2023400 - 8192;
+
+ /* This section might be better named .setup */
+ .rom ROMLOC : {
+ _rom = .;
+ *(.text);
+ *(.text.*);
+ *(.rom.text);
+ *(.rom.data);
+ *(.rom.data.*);
+ *(.rodata.*);
+ _erom = .;
+ } = 0xff
+
+ /DISCARD/ : {
+ *(.comment)
+ *(.note)
+ *(.comment.*)
+ *(.note.*)
+ *(.ARM.*)
+ }
+}
diff --git a/src/arch/armv7/bootblock_simple.c b/src/arch/armv7/bootblock_simple.c
index f447a29..c10ee1f 100644
--- a/src/arch/armv7/bootblock_simple.c
+++ b/src/arch/armv7/bootblock_simple.c
@@ -19,33 +19,31 @@
* MA 02110-1301 USA
*/
-
-
#include <bootblock_common.h>
+#include <arch/cbfs.h>
+#include <arch/hlt.h>
-
-#include "../../lib/uart8250.c"
-#include "lib/div.c"
-
-struct uart8250 uart = {
- 115200
-};
+static int boot_cpu(void)
+{
+ /*
+ * FIXME: This is a stub for now. All non-boot CPUs should be
+ * waiting for an interrupt. We could move the chunk of assembly
+ * which puts them to sleep in here...
+ */
+ return 1;
+}
void main(unsigned long bist)
{
- init_uart8250(CONFIG_TTYS0_BASE, &uart);
- uart8250_tx_byte(CONFIG_TTYS0_BASE, '@');
+ const char *target1 = "fallback/romstage";
+ unsigned long entry;
if (boot_cpu()) {
- bootblock_cpu_init();
- bootblock_northbridge_init();
- bootblock_southbridge_init();
+ bootblock_mainboard_init();
}
- const char* target1 = "fallback/romstage";
- unsigned long entry;
+
entry = findstage(target1);
- if (entry) call(entry, bist);
+ if (entry) call(entry);
hlt();
}
-
diff --git a/src/arch/armv7/include/arch/cbfs.h b/src/arch/armv7/include/arch/cbfs.h
new file mode 100644
index 0000000..afcfa6a
--- /dev/null
+++ b/src/arch/armv7/include/arch/cbfs.h
@@ -0,0 +1,68 @@
+/*
+ * 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 __INCLUDE_ARCH_CBFS__
+#define __INCLUDE_ARCH_CBFS__
+
+#include <string.h>
+#include <types.h>
+#include <cbfs_core.h>
+#include <arch/byteorder.h>
+#include <arch/cbfs.h>
+
+static int cbfs_check_magic(struct cbfs_file *file)
+{
+ return !strcmp(file->magic, CBFS_FILE_MAGIC) ? 1 : 0;
+}
+
+static unsigned long findstage(const char* target)
+{
+ unsigned long offset;
+ void *ptr = (void *)*((unsigned long *) CBFS_HEADPTR_ADDR);
+ struct cbfs_header *header = (struct cbfs_header *) ptr;
+ // if (ntohl(header->magic) != CBFS_HEADER_MAGIC)
+ // printk(BIOS_ERR, "ERROR: No valid CBFS header found!\n");
+
+ /* FIXME(dhendrix,reinauer): should this be ntohl(header->offset)? */
+ offset = 0 - ntohl(header->romsize) + ntohl(header->offset);
+ int align = ntohl(header->align);
+ while(1) {
+ struct cbfs_file *file = (struct cbfs_file *) offset;
+ if (!cbfs_check_magic(file))
+ return 0;
+ if (!strcmp(CBFS_NAME(file), target))
+ return (unsigned long)CBFS_SUBHEADER(file);
+ int flen = ntohl(file->len);
+ int foffset = ntohl(file->offset);
+ unsigned long oldoffset = offset;
+ offset = ALIGN(offset + foffset + flen, align);
+ if (offset <= oldoffset)
+ return 0;
+ /* FIXME(dhendrix,reinauer): calculate the limit correctly */
+ if (offset < 0xFFFFFFFF - ntohl(header->romsize))
+ return 0;
+ }
+}
+
+static inline void call(unsigned long addr)
+{
+ void (*doit)(void) = (void *)addr;
+ doit();
+}
+#endif
diff --git a/src/arch/armv7/include/bootblock_common.h b/src/arch/armv7/include/bootblock_common.h
index f5c7129..39af453 100644
--- a/src/arch/armv7/include/bootblock_common.h
+++ b/src/arch/armv7/include/bootblock_common.h
@@ -1,69 +1,14 @@
-#include <types.h>
-#include <cbfs.h>
-#include <string.h>
-#include <arch/byteorder.h>
-
-
-#define boot_cpu(x) 1
-
#ifdef CONFIG_BOOTBLOCK_CPU_INIT
#include CONFIG_BOOTBLOCK_CPU_INIT
-#else
-static void bootblock_cpu_init(void) { }
-#endif
-#ifdef CONFIG_BOOTBLOCK_NORTHBRIDGE_INIT
-#include CONFIG_BOOTBLOCK_NORTHBRIDGE_INIT
-#else
-static void bootblock_northbridge_init(void) { }
#endif
-#ifdef CONFIG_BOOTBLOCK_SOUTHBRIDGE_INIT
-#include CONFIG_BOOTBLOCK_SOUTHBRIDGE_INIT
-#else
-static void bootblock_southbridge_init(void) { }
-#endif
-
-static int cbfs_check_magic(struct cbfs_file *file)
-{
- return !strcmp(file->magic, CBFS_FILE_MAGIC) ? 1 : 0;
-}
-
-static unsigned long findstage(const char* target)
-{
- unsigned long offset;
-
- void *ptr = (void *)*((unsigned long *) CBFS_HEADPTR_ADDR);
- struct cbfs_header *header = (struct cbfs_header *) ptr;
- // if (ntohl(header->magic) != CBFS_HEADER_MAGIC)
- // printk(BIOS_ERR, "ERROR: No valid CBFS header found!\n");
-
- offset = 0 - ntohl(header->romsize) + ntohl(header->offset);
- int align = ntohl(header->align);
- while(1) {
- struct cbfs_file *file = (struct cbfs_file *) offset;
- if (!cbfs_check_magic(file))
- return 0;
- if (!strcmp(CBFS_NAME(file), target))
- return (unsigned long)CBFS_SUBHEADER(file);
- int flen = ntohl(file->len);
- int foffset = ntohl(file->offset);
- unsigned long oldoffset = offset;
- offset = ALIGN(offset + foffset + flen, align);
- if (offset <= oldoffset)
- return 0;
- if (offset < 0xFFFFFFFF - ntohl(header->romsize))
- return 0;
- }
-}
-
-
-static void call(unsigned long addr, unsigned long bist)
-{
- asm volatile ("mov r0, %1\nbx %0\n" : : "r" (addr), "r" (bist));
-}
-static void hlt(void)
+#ifdef CONFIG_BOOTBLOCK_MAINBOARD_INIT
+#include CONFIG_BOOTBLOCK_MAINBOARD_INIT
+#else
+static void bootblock_mainboard_init(void)
{
- /* is there such a thing as hlt on ARM? */
- // asm volatile ("1:\n\thlt\n\tjmp 1b\n\t");
- asm volatile ("1:\nb 1b\n\t");
+#ifdef CONFIG_BOOTBLOCK_CPU_INIT
+ bootblock_cpu_init();
+#endif
}
+#endif
diff --git a/src/arch/armv7/lib/id.lds b/src/arch/armv7/lib/id.lds
index 9e31ee6..f2b794a 100644
--- a/src/arch/armv7/lib/id.lds
+++ b/src/arch/armv7/lib/id.lds
@@ -1,5 +1,6 @@
SECTIONS {
- . = (0x100000000 - CONFIG_ID_SECTION_OFFSET) - (__id_end - __id_start);
+ /* FIXME: determine a sensible location... */
+ . = (0x2024000) - (__id_end - __id_start);
.id (.): {
*(.id)
}
diff --git a/src/cpu/samsung/exynos5250/Kconfig b/src/cpu/samsung/exynos5250/Kconfig
index 360c57f..c2d9b9f 100644
--- a/src/cpu/samsung/exynos5250/Kconfig
+++ b/src/cpu/samsung/exynos5250/Kconfig
@@ -1,10 +1,3 @@
-config BOOTBLOCK_OFFSET
- hex "Bootblock offset"
- default 0x3400
- help
- This is where the Coreboot bootblock resides. For Exynos5250,
- this value is pre-determined by the vendor-provided BL1.
-
config EXYNOS_ACE_SHA
bool
default n
David Hendricks (dhendrix(a)chromium.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/2148
-gerrit
commit 325172e32b4c94972159e443765123dd5764fea1
Author: David Hendricks <dhendrix(a)chromium.org>
Date: Mon Jan 14 20:58:50 2013 -0800
armv7: Place reset vector + CBFS header + bootblock dynamically
This replaces hard-coded bootblock offsets using the new scheme.
The assembler will place the initial branch instruction after BL1,
skip 2 aligned chunks, and place the remaining bootblock code after.
It will also leave an anchor string, currently 0xdeadbeef which
cbfstool will find. Once found, cbfstool will place the master CBFS
header at the next aligned offset.
Here is how it looks:
0x0000 |--------------|
| BL1 |
0x2000 |--------------|
| branch |
0x2000 + align |--------------|
| CBFS header |
0x2000 + align * 2 |--------------|
| bootblock |
|--------------|
TODO: The option for alignment passed into cbfstool has always been
64. Can we set it to 16 instead?
Change-Id: Icbe817cbd8a37f11990aaf060aab77d2dc113cb1
Signed-off-by: David Hendricks <dhendrix(a)chromium.org>
---
src/arch/armv7/Makefile.inc | 3 +--
src/arch/armv7/bootblock.inc | 8 ++++----
util/cbfstool/common.c | 37 +++++++++++++++++++++++--------------
3 files changed, 28 insertions(+), 20 deletions(-)
diff --git a/src/arch/armv7/Makefile.inc b/src/arch/armv7/Makefile.inc
index a4f57f3..cc30633 100644
--- a/src/arch/armv7/Makefile.inc
+++ b/src/arch/armv7/Makefile.inc
@@ -48,8 +48,7 @@ prebuilt-files = $(foreach file,$(cbfs-files), $(call extract_nth,1,$(file)))
$(obj)/coreboot.pre1: $(objcbfs)/bootblock.bin $$(prebuilt-files) $(CBFSTOOL)
$(CBFSTOOL) $@.tmp create -m armv7 -s $(CONFIG_COREBOOT_ROMSIZE_KB)K \
- -B $(objcbfs)/bootblock.bin -a 64 \
- -o $$(( $(CONFIG_ROM_SIZE) - $(CONFIG_CBFS_SIZE) ))
+ -B $(objcbfs)/bootblock.bin -a 64
$(prebuild-files) true
mv $@.tmp $@
else
diff --git a/src/arch/armv7/bootblock.inc b/src/arch/armv7/bootblock.inc
index 90850d6..e1b8b19 100644
--- a/src/arch/armv7/bootblock.inc
+++ b/src/arch/armv7/bootblock.inc
@@ -43,11 +43,11 @@ _start: b reset
.balignl 16,0xdeadbeef
_cbfs_master_header:
- /* The CBFS master header is inserted here by cbfstool
- * when coreboot.rom is being created. Hence, we leave
- * some space for it.
+ /* The CBFS master header is inserted by cbfstool at the first
+ * aligned offset after the above anchor string is found.
+ * Hence, we leave some space for it.
*/
- .skip 64
+ .skip 128 @ Assumes 64-byte alignment
reset:
/*
diff --git a/util/cbfstool/common.c b/util/cbfstool/common.c
index 195cda1..5413958 100644
--- a/util/cbfstool/common.c
+++ b/util/cbfstool/common.c
@@ -565,23 +565,32 @@ int create_cbfs_image(const char *romfile, uint32_t _romsize,
/* Set up physical/virtual mapping */
offset = romarea;
- // should be aligned to align
- uint32_t *arm_vec = (uint32_t *)(romarea + offs);
- master_header = (struct cbfs_header *)(romarea + offs + 0x20);
- loadfile(bootblock, &bootblocksize, romarea + offs + 0x20 +
- sizeof(struct cbfs_header), SEEK_SET);
-
/*
- * Encoding for this branch instruction is:
- * 31:28 - condition (0xe for always/unconditional)
- * 27:24 - Branch (0xa, encoding A1)
- * 23: 0 - sign-extended offset (in multiples of 4)
+ * The initial jump instruction and bootblock will be placed
+ * before and after the master header, respectively. The
+ * bootblock image must contain a blank, aligned region large
+ * enough for the master header to fit.
*
- * When executing the branch, the PC will read as the address
- * of current instruction + 8.
+ * An anchor string must be left such that when cbfstool is run
+ * we can find it and insert the master header at the next
+ * aligned boundary.
*/
- uint32_t imm = ((0x20 + sizeof(struct cbfs_header)) - 8) / 4;
- arm_vec[0] = imm | (0xa << 24) | (0xe << 28);
+ loadfile(bootblock, &bootblocksize, romarea + offs, SEEK_SET);
+
+ unsigned char *p = romarea + offs;
+ while (1) {
+ /* FIXME: assumes little endian... */
+ if (*(uint32_t *)p == 0xdeadbeef)
+ break;
+ if (p >= (romarea + _romsize)) {
+ fprintf(stderr, "E: Could not determine CBFS "
+ "header location.\n", bootblock);
+ return 1;
+ }
+ p += (sizeof(unsigned int));
+ }
+ unsigned int u = ALIGN((unsigned int)(p - romarea), align);
+ master_header = (struct cbfs_header *)(romarea + u);
master_header->magic = ntohl(CBFS_HEADER_MAGIC);
master_header->version = ntohl(CBFS_HEADER_VERSION);
Martin Roth (martin.roth(a)se-eng.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/2160
-gerrit
commit 5d061f1d59c81a6660c2fd83cd99d166168b58c6
Author: Martin Roth <martin(a)se-eng.com>
Date: Thu Jan 10 12:41:40 2013 -0700
F15tn: Modify devicetree to fix S3 resume on F15tn
The way that devicetree.cb was configured for the family15tn boards
was doing... interesting things to the video device initialization.
This was causing S3 resume to fail.
There is a disconnect between how the devicetree should be configured
if there are multiple HT links on the CPU and how it's configured if
there's only one HT link. These platforms were set up as if they
had the multiple HT links, which was causing duplicate instances of
devices in the device list.
The scan for the IO Hub was removed from the northbridge code which
isn't a problem for f15tn devices.
Change-Id: I3556b43027746e36b07de7cb1bece4d1b37a3c34
Signed-off-by: Martin Roth <martin(a)se-eng.com>
---
src/mainboard/amd/parmer/devicetree.cb | 4 +---
src/mainboard/amd/thatcher/devicetree.cb | 4 +---
src/northbridge/amd/agesa/family15tn/northbridge.c | 23 ----------------------
3 files changed, 2 insertions(+), 29 deletions(-)
diff --git a/src/mainboard/amd/parmer/devicetree.cb b/src/mainboard/amd/parmer/devicetree.cb
index 4a59b51..32f5484 100644
--- a/src/mainboard/amd/parmer/devicetree.cb
+++ b/src/mainboard/amd/parmer/devicetree.cb
@@ -25,7 +25,6 @@ chip northbridge/amd/agesa/family15tn/root_complex
device pci_domain 0 on
subsystemid 0x1022 0x1410 inherit
chip northbridge/amd/agesa/family15tn # CPU side of HT root complex
- device pci 18.0 on # northbridge
chip northbridge/amd/agesa/family15tn # PCI side of HT root complex
device pci 0.0 on end # Root Complex
device pci 1.0 on end # Internal Graphics P2P bridge 0x9804
@@ -38,7 +37,6 @@ chip northbridge/amd/agesa/family15tn/root_complex
device pci 7.0 on end # LAN
device pci 8.0 off end # NB/SB Link P2P bridge
end
- end
chip southbridge/amd/agesa/hudson # it is under NB/SB Link, but on the same pci bus
device pci 10.0 on end # XHCI HC0
device pci 10.1 on end # XHCI HC1
@@ -75,7 +73,7 @@ chip northbridge/amd/agesa/family15tn/root_complex
register "boot_switch_sata_ide" = "0" # 0: boot from SATA. 1: IDE
register "gpp_configuration" = "4"
end #southbridge/amd/hudson
-# device pci 18.0 on end
+ device pci 18.0 on end
#device pci 18.0 on end
device pci 18.1 on end
device pci 18.2 on end
diff --git a/src/mainboard/amd/thatcher/devicetree.cb b/src/mainboard/amd/thatcher/devicetree.cb
index 2a91e1a..561a5b2 100644
--- a/src/mainboard/amd/thatcher/devicetree.cb
+++ b/src/mainboard/amd/thatcher/devicetree.cb
@@ -25,7 +25,6 @@ chip northbridge/amd/agesa/family15tn/root_complex
device pci_domain 0 on
subsystemid 0x1022 0x1410 inherit
chip northbridge/amd/agesa/family15tn # CPU side of HT root complex
- device pci 18.0 on # northbridge
chip northbridge/amd/agesa/family15tn # PCI side of HT root complex
device pci 0.0 on end # Root Complex
device pci 1.0 on end # Internal Graphics P2P bridge 0x9804
@@ -38,7 +37,6 @@ chip northbridge/amd/agesa/family15tn/root_complex
device pci 7.0 on end # LAN
device pci 8.0 off end # NB/SB Link P2P bridge
end
- end
chip southbridge/amd/agesa/hudson # it is under NB/SB Link, but on the same pci bus
device pci 10.0 on end # XHCI HC0
device pci 10.1 on end # XHCI HC1
@@ -92,7 +90,7 @@ chip northbridge/amd/agesa/family15tn/root_complex
register "boot_switch_sata_ide" = "0" # 0: boot from SATA. 1: IDE
register "gpp_configuration" = "4"
end #southbridge/amd/hudson
-# device pci 18.0 on end
+ device pci 18.0 on end
#device pci 18.0 on end
device pci 18.1 on end
device pci 18.2 on end
diff --git a/src/northbridge/amd/agesa/family15tn/northbridge.c b/src/northbridge/amd/agesa/family15tn/northbridge.c
index 9318164..df632e3 100644
--- a/src/northbridge/amd/agesa/family15tn/northbridge.c
+++ b/src/northbridge/amd/agesa/family15tn/northbridge.c
@@ -446,35 +446,12 @@ static void northbridge_init(struct device *dev)
{
}
-static unsigned scan_chains(device_t dev, unsigned max)
-{
- unsigned nodeid;
- struct bus *link;
- device_t io_hub = NULL;
- u32 next_unitid = 0x18;
- nodeid = amdfam15_nodeid(dev);
- if (nodeid == 0) {
- for (link = dev->link_list; link; link = link->next) {
- //if (link->link_num == sblink) { /* devicetree put IO Hub on link_lsit[sblink] */
- if (link->link_num == 0) { /* devicetree put IO Hub on link_lsit[0] */
- io_hub = link->children;
- if (!io_hub || !io_hub->enabled) {
- die("I can't find the IO Hub, or IO Hub not enabled, please check the device tree.\n");
- }
- /* Now that nothing is overlapping it is safe to scan the children. */
- max = pci_scan_bus(link, 0x00, ((next_unitid - 1) << 3) | 7, 0);
- }
- }
- }
- return max;
-}
static struct device_operations northbridge_operations = {
.read_resources = read_resources,
.set_resources = set_resources,
.enable_resources = pci_dev_enable_resources,
.init = northbridge_init,
- .scan_bus = scan_chains,
.enable = 0,
.ops_pci = 0,
};
Ronald G. Minnich (rminnich(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/2159
-gerrit
commit 3fea571fd08bacd8c22f9d4caa94b746c8f73106
Author: Ronald G. Minnich <rminnich(a)gmail.com>
Date: Wed Jan 16 11:59:34 2013 -0600
Utility to run the snow bios in user mode
This program lets you test run a snow coreboot image in user mode
on a properly equipped arm system (usually an ARM chromebook).
This is a real time saver as you don't have to flash each time.
We've found and fixed some nasty bugs with this one.
Sorry about the wrong dependency ...
Anyway, the instructions on how to use this are in the binary.
Change-Id: Ib555ef51fd7e930905a2ee5cbfda1cc6f068278e
Signed-off-by: Ronald G. Minnich <rminnich(a)gmail.com>
---
util/runarmbios/runbios.c | 129 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 129 insertions(+)
diff --git a/util/runarmbios/runbios.c b/util/runarmbios/runbios.c
new file mode 100644
index 0000000..b8b57b0
--- /dev/null
+++ b/util/runarmbios/runbios.c
@@ -0,0 +1,129 @@
+#include <stdio.h>
+#include <err.h>
+#include <sys/mman.h>
+
+#include <string.h>
+
+enum addresses {
+ restart = 0x10040000,
+ rom = 0x20002000,
+ sram = 0x2003400,
+};
+
+// 0x20234b0
+main(int argc, char *argv[])
+{
+ int fd;
+ int devmem;
+ unsigned long *p, val, i, ret;
+ unsigned long * restart, *spi, *i2c;
+ void *sram;
+ void (*coreboot)(void) = (void *)0x2023400;
+
+ if (argc != 3)
+ errx(1, "usage: runbios rom-file start-address");
+
+ fd = open(argv[1], 2);
+ if (fd < 0)
+ err(1, argv[1]);
+ devmem = open("/dev/mem", 2);
+ if (devmem < 0)
+ err(1, argv[1]);
+ sram = mmap((void *)0x2020000, 378*1024, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
+ if (-1 == (int)sram)
+ err(1, "mmap");
+ memset((void *)0x2020000, 0xff, (size_t)(378*1024));
+
+ restart = mmap((void *)0x10040000, 0x10000, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, devmem, (off_t) 0x10040000);
+ if (-1 == (int)restart)
+ err(1, "mmap restart");
+
+ spi = mmap((void *)0x12d30000, 0x10000, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, devmem, (off_t) 0x12d30000);
+ if (-1 == (int)spi)
+ err(1, "mmap spi");
+
+ i2c = mmap((void *)0x12c60000, 0x10000, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, devmem, (off_t) 0x12c60000);
+ if (-1 == (int)i2c)
+ err(1, "mmap i2c");
+
+ /* now sort of do what bl1 does: read the 'rom' into the sram */
+ if (pread(fd, coreboot, 30*1024, 0x2000) < 30*1024)
+ err(1, "read 'rom'");
+ /* you want to be in gdb at this point. */
+ coreboot = (void *) strtoull(argv[2], 0, 0);
+ coreboot();
+}
+
+/* cc -g runbios.c */
+/* typical run
+gdb a.out
+(gdb) list 50
+
+45 i2c = mmap((void *)0x12c60000, 0x10000, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, devmem, (off_t) 0x12c60000);
+46 if (-1 == (int)i2c)
+47 err(1, "mmap i2c");
+48
+49 /* now sort of do what bl1 does: read the 'rom' into the sram */
+50 if (pread(fd, coreboot, 30*1024, 0x2000) < 30*1024)
+51 err(1, "read 'rom'");
+52 /* you want to be in gdb at this point. */
+53 coreboot = (void *) strtoull(argv[2], 0, 0);
+54 coreboot();
+(gdb) br 54
+Breakpoint 3 at 0x8798: file runbios.c, line 54.
+(gdb) run ~/coreboot/build/coreboot.rom 0x020234b0
+The program being debugged has been started already.
+Start it from the beginning? (y or n) y
+
+Starting program: /root/coreboot/util/runarmbios/a.out ~/coreboot/build/coreboot.rom 0x020234b0
+
+Breakpoint 3, main (argc=3, argv=0x7efff7c4) at runbios.c:54
+54 coreboot();
+(gdb) symbol-file ~/coreboot/build/cbfs/fallback/bootblock.debug
+Load new symbol table from "/root/coreboot/build/cbfs/fallback/bootblock.debug"? (y or n) y
+Reading symbols from /root/coreboot/build/cbfs/fallback/bootblock.debug...done.
+Error in re-setting breakpoint 3: No source file named runbios.c.
+(gdb) display/i $pc
+1: x/i $pc
+=> 0x8798: ldr r3, [r11, #-8]
+(gdb) stepi
+0x0000879c in ?? ()
+1: x/i $pc
+=> 0x879c: blx r3
+(gdb)
+0x020234b0 in call_bootblock ()
+1: x/i $pc
+=> 0x20234b0 <call_bootblock>: ldr sp, [pc, #3800] ; 0x2024390
+(gdb)
+0x020234b4 in call_bootblock ()
+1: x/i $pc
+=> 0x20234b4 <call_bootblock+4>: bic sp, sp, #7
+(gdb)
+0x020234b8 in call_bootblock ()
+1: x/i $pc
+=> 0x20234b8 <call_bootblock+8>: mov r0, #0
+(gdb)
+0x020234bc in call_bootblock ()
+1: x/i $pc
+=> 0x20234bc <call_bootblock+12>: blx 0x20244b8 <main>
+(gdb)
+main (bist=0) at src/arch/armv7/bootblock_simple.c:37
+37 {
+1: x/i $pc
+=> 0x20244b8 <main>: push {r3, lr}
+(gdb)
+42 bootblock_mainboard_init();
+1: x/i $pc
+=> 0x20244ba <main+2>: bl 0x2023c08 <bootblock_mainboard_init>
+(gdb)
+bootblock_mainboard_init () at src/mainboard/google/snow/bootblock.c:2124
+2124 {
+1: x/i $pc
+=> 0x2023c08 <bootblock_mainboard_init>: stmdb sp!, {r4, r5, r6, r7, r9, r10, r11, lr}
+(gdb)
+2127 i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+1: x/i $pc
+=> 0x2023c0c <bootblock_mainboard_init+4>: movs r1, #0
+
+Note you are now debugging source, and pretty much all commands work.
+*/
Ronald G. Minnich (rminnich(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/2138
-gerrit
commit a85a2f673990f754a26f3eaa1231e1c17313ba04
Author: David Hendricks <dhendrix(a)chromium.org>
Date: Fri Jan 11 11:34:06 2013 -0800
bootblock_cpu_init() stub for exynos5250
This adds a stub for bootblock_cpu_init() for exynos5250. It will
eventually contain code to copy ROM content from SPI to SRAM.
Change-Id: I26ee62a1e701013f38f76f200579faa680530860
Signed-off-by: David Hendricks <dhendrix(a)chromium.org>
---
src/cpu/samsung/exynos5250/Kconfig | 8 ++++++++
src/cpu/samsung/exynos5250/bootblock.c | 32 ++++++++++++++++++++++++++++++++
2 files changed, 40 insertions(+)
diff --git a/src/cpu/samsung/exynos5250/Kconfig b/src/cpu/samsung/exynos5250/Kconfig
index c2d9b9f..3d66c77 100644
--- a/src/cpu/samsung/exynos5250/Kconfig
+++ b/src/cpu/samsung/exynos5250/Kconfig
@@ -1,3 +1,11 @@
+config BOOTBLOCK_CPU_INIT
+ string
+ default "cpu/samsung/exynos5250/bootblock.c"
+ help
+ CPU/SoC-specific bootblock code. This is useful if the
+ bootblock must load microcode or copy data from ROM before
+ searching for the bootblock.
+
config EXYNOS_ACE_SHA
bool
default n
diff --git a/src/cpu/samsung/exynos5250/bootblock.c b/src/cpu/samsung/exynos5250/bootblock.c
new file mode 100644
index 0000000..58d0919
--- /dev/null
+++ b/src/cpu/samsung/exynos5250/bootblock.c
@@ -0,0 +1,32 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2013 The Chromium OS Authors
+ *
+ * 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
+ */
+
+void bootblock_cpu_init(void);
+void bootblock_cpu_init(void)
+{
+ /*
+ * FIXME: this is a stub for now. It should eventually copy
+ * romstage data (and maybe more) from SPI to SRAM.
+ */
+#if 0
+ volatile unsigned long *addr = (unsigned long *)0x1004330c;
+ *addr |= 0x100;
+ while (1) ;
+#endif
+}
Ronald G. Minnich (rminnich(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/2118
-gerrit
commit b46cb751f23c31b495262f9904f119bdb4e26595
Author: David Hendricks <dhendrix(a)chromium.org>
Date: Tue Jan 8 21:05:06 2013 -0800
ARM bootblock approach (incomplete)
Do not attempt to commit, just making this available so it doesn't get lost
Change-Id: I9cc2a8191d2db38b27b6363ba673e5a360de9684
Signed-off-by: Stefan Reinauer <reinauer(a)google.com>
Signed-off-by: David Hendricks <dhendrix(a)chromium.org>
---
src/arch/armv7/Makefile.inc | 26 +++++------
src/arch/armv7/bootblock.inc | 7 +--
src/arch/armv7/bootblock.lds | 49 +++++++++++++++++++++
src/arch/armv7/bootblock_simple.c | 34 +++++++--------
src/arch/armv7/include/arch/cbfs.h | 68 +++++++++++++++++++++++++++++
src/arch/armv7/include/bootblock_common.h | 71 ++++---------------------------
src/arch/armv7/lib/id.lds | 2 +-
src/cpu/samsung/exynos5250/Kconfig | 7 ---
8 files changed, 153 insertions(+), 111 deletions(-)
diff --git a/src/arch/armv7/Makefile.inc b/src/arch/armv7/Makefile.inc
index 4cb97a6..b783ac6 100644
--- a/src/arch/armv7/Makefile.inc
+++ b/src/arch/armv7/Makefile.inc
@@ -49,7 +49,7 @@ prebuilt-files = $(foreach file,$(cbfs-files), $(call extract_nth,1,$(file)))
$(obj)/coreboot.pre1: $(objcbfs)/bootblock.bin $$(prebuilt-files) $(CBFSTOOL)
$(CBFSTOOL) $@.tmp create -m armv7 -s $(CONFIG_COREBOOT_ROMSIZE_KB)K \
-B $(objcbfs)/bootblock.bin -a 64 \
- -o $$(( $(CONFIG_ROM_SIZE) - $(CONFIG_CBFS_SIZE) ))
+ -o $(CONFIG_BOOTBLOCK_OFFSET)
$(prebuild-files) true
mv $@.tmp $@
else
@@ -149,7 +149,6 @@ CFLAGS += \
# For various headers imported from Linux
CFLAGS += -D__LINUX_ARM_ARCH__=7
-crt0s = $(src)/arch/armv7/bootblock.inc
ldscripts =
ldscripts += $(src)/arch/armv7/romstage.ld
@@ -223,19 +222,14 @@ $(obj)/coreboot.pre: $(objcbfs)/romstage_xip.elf $(obj)/coreboot.pre1 $(CBFSTOOL
################################################################################
# Build the bootblock
-#bootblock_lds = $(src)/arch/armv7/ldscript_fallback_cbfs.lb
-bootblock_lds = $(src)/arch/armv7/lib/id.lds
-#bootblock_lds = $(src)/arch/armv7/romstage.ld
+bootblock_lds = $(src)/arch/armv7/bootblock.lds
+bootblock_lds += $(src)/arch/armv7/lib/id.lds
bootblock_lds += $(chipset_bootblock_lds)
+bootblock_inc += $(src)/arch/armv7/bootblock.inc
bootblock_inc += $(src)/arch/armv7/lib/id.inc
bootblock_inc += $(chipset_bootblock_inc)
-
-# FIXME: CONFIG_NEON or something similar for ARM?
-#ifeq ($(CONFIG_SSE),y)
-#bootblock_inc += $(src)/cpu/x86/sse_enable.inc
-#endif
-#bootblock_inc += $(objgenerated)/bootblock.inc
+bootblock_inc += $(objgenerated)/bootblock.inc
$(objgenerated)/bootblock.ld: $$(bootblock_lds) $(obj)/ldoptions
@printf " GEN $(subst $(obj)/,,$(@))\n"
@@ -253,11 +247,11 @@ $(objgenerated)/bootblock.s: $(objgenerated)/bootblock_inc.S $(obj)/config.h $(o
@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 $@
-#$(objgenerated)/bootblock.inc: $(src)/arch/armv7/init/$(subst ",,$(CONFIG_BOOTBLOCK_SOURCE)) $(objutil)/romcc/romcc $(OPTION_TABLE_H)
-# @printf " ROMCC $(subst $(obj)/,,$(@))\n"
-# $(CC) $(INCLUDES) -MM -MT$(objgenerated)/bootblock.inc \
-# $< > $(objgenerated)/bootblock.inc.d
-# $(ROMCC) -c -S $(bootblock_romccflags) $(ROMCCFLAGS) -I. $(INCLUDES) $< -o $@
+$(objgenerated)/bootblock.inc: $(src)/arch/armv7/$(subst ",,$(CONFIG_BOOTBLOCK_SOURCE)) $(OPTION_TABLE_H)
+ @printf " CC $(subst $(obj)/,,$(@))\n"
+ $(CC) $(INCLUDES) -MM -MT$(objgenerated)/bootblock.inc \
+ $< > $(objgenerated)/bootblock.inc.d
+ $(CC) -c -S $(CFLAGS) -I. $(INCLUDES) $< -o $@
$(objcbfs)/bootblock.debug: $(objgenerated)/bootblock.o $(objgenerated)/bootblock.ld
@printf " LINK $(subst $(obj)/,,$(@))\n"
diff --git a/src/arch/armv7/bootblock.inc b/src/arch/armv7/bootblock.inc
index f76391b..90850d6 100644
--- a/src/arch/armv7/bootblock.inc
+++ b/src/arch/armv7/bootblock.inc
@@ -36,8 +36,7 @@ _bl1:
* on ARM, which is 8KB in size and it is prepended to the
* reset vector
*/
- /* this comes a bit later. */
-// .skip 8192
+ .skip 8192
.globl _start
_start: b reset
@@ -81,10 +80,6 @@ call_bootblock:
* Thumb. However, "b" will not and GCC may attempt to create a
* wrapper which is currently broken.
*/
- /* for now call board_init_f; change later. We're trying to get as much into ToT as
- * we can
- */
- bl board_init_f
bl main
wait_for_interrupt:
diff --git a/src/arch/armv7/bootblock.lds b/src/arch/armv7/bootblock.lds
new file mode 100644
index 0000000..90e37a0
--- /dev/null
+++ b/src/arch/armv7/bootblock.lds
@@ -0,0 +1,49 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2006 Advanced Micro Devices, Inc.
+ * Copyright (C) 2008-2010 coresystems GmbH
+ *
+ * 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
+ */
+
+/* We use ELF as output format. So that we can debug the code in some form. */
+OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
+OUTPUT_ARCH(arm)
+
+TARGET(binary)
+SECTIONS
+{
+ ROMLOC = 0x2023400 - 8192;
+
+ /* This section might be better named .setup */
+ .rom ROMLOC : {
+ _rom = .;
+ *(.text);
+ *(.text.*);
+ *(.rom.text);
+ *(.rom.data);
+ *(.rom.data.*);
+ *(.rodata.*);
+ _erom = .;
+ } = 0xff
+
+ /DISCARD/ : {
+ *(.comment)
+ *(.note)
+ *(.comment.*)
+ *(.note.*)
+ *(.ARM.*)
+ }
+}
diff --git a/src/arch/armv7/bootblock_simple.c b/src/arch/armv7/bootblock_simple.c
index f447a29..c10ee1f 100644
--- a/src/arch/armv7/bootblock_simple.c
+++ b/src/arch/armv7/bootblock_simple.c
@@ -19,33 +19,31 @@
* MA 02110-1301 USA
*/
-
-
#include <bootblock_common.h>
+#include <arch/cbfs.h>
+#include <arch/hlt.h>
-
-#include "../../lib/uart8250.c"
-#include "lib/div.c"
-
-struct uart8250 uart = {
- 115200
-};
+static int boot_cpu(void)
+{
+ /*
+ * FIXME: This is a stub for now. All non-boot CPUs should be
+ * waiting for an interrupt. We could move the chunk of assembly
+ * which puts them to sleep in here...
+ */
+ return 1;
+}
void main(unsigned long bist)
{
- init_uart8250(CONFIG_TTYS0_BASE, &uart);
- uart8250_tx_byte(CONFIG_TTYS0_BASE, '@');
+ const char *target1 = "fallback/romstage";
+ unsigned long entry;
if (boot_cpu()) {
- bootblock_cpu_init();
- bootblock_northbridge_init();
- bootblock_southbridge_init();
+ bootblock_mainboard_init();
}
- const char* target1 = "fallback/romstage";
- unsigned long entry;
+
entry = findstage(target1);
- if (entry) call(entry, bist);
+ if (entry) call(entry);
hlt();
}
-
diff --git a/src/arch/armv7/include/arch/cbfs.h b/src/arch/armv7/include/arch/cbfs.h
new file mode 100644
index 0000000..afcfa6a
--- /dev/null
+++ b/src/arch/armv7/include/arch/cbfs.h
@@ -0,0 +1,68 @@
+/*
+ * 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 __INCLUDE_ARCH_CBFS__
+#define __INCLUDE_ARCH_CBFS__
+
+#include <string.h>
+#include <types.h>
+#include <cbfs_core.h>
+#include <arch/byteorder.h>
+#include <arch/cbfs.h>
+
+static int cbfs_check_magic(struct cbfs_file *file)
+{
+ return !strcmp(file->magic, CBFS_FILE_MAGIC) ? 1 : 0;
+}
+
+static unsigned long findstage(const char* target)
+{
+ unsigned long offset;
+ void *ptr = (void *)*((unsigned long *) CBFS_HEADPTR_ADDR);
+ struct cbfs_header *header = (struct cbfs_header *) ptr;
+ // if (ntohl(header->magic) != CBFS_HEADER_MAGIC)
+ // printk(BIOS_ERR, "ERROR: No valid CBFS header found!\n");
+
+ /* FIXME(dhendrix,reinauer): should this be ntohl(header->offset)? */
+ offset = 0 - ntohl(header->romsize) + ntohl(header->offset);
+ int align = ntohl(header->align);
+ while(1) {
+ struct cbfs_file *file = (struct cbfs_file *) offset;
+ if (!cbfs_check_magic(file))
+ return 0;
+ if (!strcmp(CBFS_NAME(file), target))
+ return (unsigned long)CBFS_SUBHEADER(file);
+ int flen = ntohl(file->len);
+ int foffset = ntohl(file->offset);
+ unsigned long oldoffset = offset;
+ offset = ALIGN(offset + foffset + flen, align);
+ if (offset <= oldoffset)
+ return 0;
+ /* FIXME(dhendrix,reinauer): calculate the limit correctly */
+ if (offset < 0xFFFFFFFF - ntohl(header->romsize))
+ return 0;
+ }
+}
+
+static inline void call(unsigned long addr)
+{
+ void (*doit)(void) = (void *)addr;
+ doit();
+}
+#endif
diff --git a/src/arch/armv7/include/bootblock_common.h b/src/arch/armv7/include/bootblock_common.h
index f5c7129..39af453 100644
--- a/src/arch/armv7/include/bootblock_common.h
+++ b/src/arch/armv7/include/bootblock_common.h
@@ -1,69 +1,14 @@
-#include <types.h>
-#include <cbfs.h>
-#include <string.h>
-#include <arch/byteorder.h>
-
-
-#define boot_cpu(x) 1
-
#ifdef CONFIG_BOOTBLOCK_CPU_INIT
#include CONFIG_BOOTBLOCK_CPU_INIT
-#else
-static void bootblock_cpu_init(void) { }
-#endif
-#ifdef CONFIG_BOOTBLOCK_NORTHBRIDGE_INIT
-#include CONFIG_BOOTBLOCK_NORTHBRIDGE_INIT
-#else
-static void bootblock_northbridge_init(void) { }
#endif
-#ifdef CONFIG_BOOTBLOCK_SOUTHBRIDGE_INIT
-#include CONFIG_BOOTBLOCK_SOUTHBRIDGE_INIT
-#else
-static void bootblock_southbridge_init(void) { }
-#endif
-
-static int cbfs_check_magic(struct cbfs_file *file)
-{
- return !strcmp(file->magic, CBFS_FILE_MAGIC) ? 1 : 0;
-}
-
-static unsigned long findstage(const char* target)
-{
- unsigned long offset;
-
- void *ptr = (void *)*((unsigned long *) CBFS_HEADPTR_ADDR);
- struct cbfs_header *header = (struct cbfs_header *) ptr;
- // if (ntohl(header->magic) != CBFS_HEADER_MAGIC)
- // printk(BIOS_ERR, "ERROR: No valid CBFS header found!\n");
-
- offset = 0 - ntohl(header->romsize) + ntohl(header->offset);
- int align = ntohl(header->align);
- while(1) {
- struct cbfs_file *file = (struct cbfs_file *) offset;
- if (!cbfs_check_magic(file))
- return 0;
- if (!strcmp(CBFS_NAME(file), target))
- return (unsigned long)CBFS_SUBHEADER(file);
- int flen = ntohl(file->len);
- int foffset = ntohl(file->offset);
- unsigned long oldoffset = offset;
- offset = ALIGN(offset + foffset + flen, align);
- if (offset <= oldoffset)
- return 0;
- if (offset < 0xFFFFFFFF - ntohl(header->romsize))
- return 0;
- }
-}
-
-
-static void call(unsigned long addr, unsigned long bist)
-{
- asm volatile ("mov r0, %1\nbx %0\n" : : "r" (addr), "r" (bist));
-}
-static void hlt(void)
+#ifdef CONFIG_BOOTBLOCK_MAINBOARD_INIT
+#include CONFIG_BOOTBLOCK_MAINBOARD_INIT
+#else
+static void bootblock_mainboard_init(void)
{
- /* is there such a thing as hlt on ARM? */
- // asm volatile ("1:\n\thlt\n\tjmp 1b\n\t");
- asm volatile ("1:\nb 1b\n\t");
+#ifdef CONFIG_BOOTBLOCK_CPU_INIT
+ bootblock_cpu_init();
+#endif
}
+#endif
diff --git a/src/arch/armv7/lib/id.lds b/src/arch/armv7/lib/id.lds
index 9e31ee6..22b4a02 100644
--- a/src/arch/armv7/lib/id.lds
+++ b/src/arch/armv7/lib/id.lds
@@ -1,5 +1,5 @@
SECTIONS {
- . = (0x100000000 - CONFIG_ID_SECTION_OFFSET) - (__id_end - __id_start);
+ . = (0x2024000) - (__id_end - __id_start);
.id (.): {
*(.id)
}
diff --git a/src/cpu/samsung/exynos5250/Kconfig b/src/cpu/samsung/exynos5250/Kconfig
index 360c57f..c2d9b9f 100644
--- a/src/cpu/samsung/exynos5250/Kconfig
+++ b/src/cpu/samsung/exynos5250/Kconfig
@@ -1,10 +1,3 @@
-config BOOTBLOCK_OFFSET
- hex "Bootblock offset"
- default 0x3400
- help
- This is where the Coreboot bootblock resides. For Exynos5250,
- this value is pre-determined by the vendor-provided BL1.
-
config EXYNOS_ACE_SHA
bool
default n
Ronald G. Minnich (rminnich(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/2148
-gerrit
commit 179faec26027501d6ebd348db156fca32fa150f5
Author: David Hendricks <dhendrix(a)chromium.org>
Date: Mon Jan 14 20:58:50 2013 -0800
armv7: Place reset vector + CBFS header + bootblock dynamically
This replaces hard-coded bootblock offsets using the new scheme.
The assembler will place the initial branch instruction after BL1,
skip 2 aligned chunks, and place the remaining bootblock code after.
It will also leave an anchor string, currently 0xdeadbeef which
cbfstool will find. Once found, cbfstool will place the master CBFS
header at the next aligned offset.
Here is how it looks:
0x0000 |--------------|
| BL1 |
0x2000 |--------------|
| branch |
0x2000 + align |--------------|
| CBFS header |
0x2000 + align * 2 |--------------|
| bootblock |
|--------------|
TODO: The option for alignment passed into cbfstool has always been
64. Can we set it to 16 instead?
Change-Id: Icbe817cbd8a37f11990aaf060aab77d2dc113cb1
Signed-off-by: David Hendricks <dhendrix(a)chromium.org>
---
src/arch/armv7/Makefile.inc | 3 +--
src/arch/armv7/bootblock.inc | 8 ++++----
util/cbfstool/common.c | 37 +++++++++++++++++++++++--------------
3 files changed, 28 insertions(+), 20 deletions(-)
diff --git a/src/arch/armv7/Makefile.inc b/src/arch/armv7/Makefile.inc
index b783ac6..cc30633 100644
--- a/src/arch/armv7/Makefile.inc
+++ b/src/arch/armv7/Makefile.inc
@@ -48,8 +48,7 @@ prebuilt-files = $(foreach file,$(cbfs-files), $(call extract_nth,1,$(file)))
$(obj)/coreboot.pre1: $(objcbfs)/bootblock.bin $$(prebuilt-files) $(CBFSTOOL)
$(CBFSTOOL) $@.tmp create -m armv7 -s $(CONFIG_COREBOOT_ROMSIZE_KB)K \
- -B $(objcbfs)/bootblock.bin -a 64 \
- -o $(CONFIG_BOOTBLOCK_OFFSET)
+ -B $(objcbfs)/bootblock.bin -a 64
$(prebuild-files) true
mv $@.tmp $@
else
diff --git a/src/arch/armv7/bootblock.inc b/src/arch/armv7/bootblock.inc
index 90850d6..e1b8b19 100644
--- a/src/arch/armv7/bootblock.inc
+++ b/src/arch/armv7/bootblock.inc
@@ -43,11 +43,11 @@ _start: b reset
.balignl 16,0xdeadbeef
_cbfs_master_header:
- /* The CBFS master header is inserted here by cbfstool
- * when coreboot.rom is being created. Hence, we leave
- * some space for it.
+ /* The CBFS master header is inserted by cbfstool at the first
+ * aligned offset after the above anchor string is found.
+ * Hence, we leave some space for it.
*/
- .skip 64
+ .skip 128 @ Assumes 64-byte alignment
reset:
/*
diff --git a/util/cbfstool/common.c b/util/cbfstool/common.c
index 195cda1..5413958 100644
--- a/util/cbfstool/common.c
+++ b/util/cbfstool/common.c
@@ -565,23 +565,32 @@ int create_cbfs_image(const char *romfile, uint32_t _romsize,
/* Set up physical/virtual mapping */
offset = romarea;
- // should be aligned to align
- uint32_t *arm_vec = (uint32_t *)(romarea + offs);
- master_header = (struct cbfs_header *)(romarea + offs + 0x20);
- loadfile(bootblock, &bootblocksize, romarea + offs + 0x20 +
- sizeof(struct cbfs_header), SEEK_SET);
-
/*
- * Encoding for this branch instruction is:
- * 31:28 - condition (0xe for always/unconditional)
- * 27:24 - Branch (0xa, encoding A1)
- * 23: 0 - sign-extended offset (in multiples of 4)
+ * The initial jump instruction and bootblock will be placed
+ * before and after the master header, respectively. The
+ * bootblock image must contain a blank, aligned region large
+ * enough for the master header to fit.
*
- * When executing the branch, the PC will read as the address
- * of current instruction + 8.
+ * An anchor string must be left such that when cbfstool is run
+ * we can find it and insert the master header at the next
+ * aligned boundary.
*/
- uint32_t imm = ((0x20 + sizeof(struct cbfs_header)) - 8) / 4;
- arm_vec[0] = imm | (0xa << 24) | (0xe << 28);
+ loadfile(bootblock, &bootblocksize, romarea + offs, SEEK_SET);
+
+ unsigned char *p = romarea + offs;
+ while (1) {
+ /* FIXME: assumes little endian... */
+ if (*(uint32_t *)p == 0xdeadbeef)
+ break;
+ if (p >= (romarea + _romsize)) {
+ fprintf(stderr, "E: Could not determine CBFS "
+ "header location.\n", bootblock);
+ return 1;
+ }
+ p += (sizeof(unsigned int));
+ }
+ unsigned int u = ALIGN((unsigned int)(p - romarea), align);
+ master_header = (struct cbfs_header *)(romarea + u);
master_header->magic = ntohl(CBFS_HEADER_MAGIC);
master_header->version = ntohl(CBFS_HEADER_VERSION);
Stefan Reinauer (stefan.reinauer(a)coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/2158
-gerrit
commit 4b7650ea99362905b1e8782b88e43e873b377646
Author: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Date: Wed Jan 16 09:47:54 2013 -0800
Update gcov patch in documentation
.. to reflect the recent changes w.r.t avoiding
trouble with the coreboot pre-commit hooks.
Change-Id: I6c94e95dd439940cf3b44231c8aab5126e9d45c7
Signed-off-by: Stefan Reinauer <reinauer(a)google.com>
---
documentation/gcov.txt | 54 ++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 52 insertions(+), 2 deletions(-)
diff --git a/documentation/gcov.txt b/documentation/gcov.txt
index 795f827..b7c98a6 100644
--- a/documentation/gcov.txt
+++ b/documentation/gcov.txt
@@ -3,7 +3,7 @@ The file gcov-iov.h is taken from a gcc build (produced at compile
time). The file gcov-io.c is unchanged.
--- gcc-4.7.2/gcc/gcov-io.h 2011-12-04 10:27:19.000000000 -0800
-+++ coreboot/src/lib/gcov-io.h 2013-01-09 15:29:19.000000000 -0800
++++ coreboot/src/lib/gcov-io.h 2013-01-12 16:45:57.000000000 -0800
@@ -163,6 +163,24 @@
#ifndef GCC_GCOV_IO_H
#define GCC_GCOV_IO_H
@@ -51,7 +51,7 @@ time). The file gcov-io.c is unchanged.
/* The merge function that just sums the counters. */
extern void __gcov_merge_add (gcov_type *, unsigned) ATTRIBUTE_HIDDEN;
--- gcc-4.7.2/libgcc/libgcov.c 2012-01-11 10:50:21.000000000 -0800
-+++ coreboot/src/lib/libgcov.c 2013-01-09 15:32:37.000000000 -0800
++++ coreboot/src/lib/libgcov.c 2013-01-16 09:45:11.000000000 -0800
@@ -25,12 +25,41 @@
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
@@ -175,3 +175,53 @@ time). The file gcov-io.c is unchanged.
info->next = gcov_list;
gcov_list = info;
+@@ -767,14 +811,15 @@
+
+ #ifdef L_gcov_merge_single
+ /* The profile merging function for choosing the most common value.
+- It is given an array COUNTERS of N_COUNTERS old counters and it
+- reads the same number of counters from the gcov file. The counters
+- are split into 3-tuples where the members of the tuple have
+- meanings:
+-
+- -- the stored candidate on the most common value of the measured entity
+- -- counter
+- -- total number of evaluations of the value */
++ * It is given an array COUNTERS of N_COUNTERS old counters and it
++ * reads the same number of counters from the gcov file. The counters
++ * are split into 3-tuples where the members of the tuple have
++ * meanings:
++ *
++ * -- the stored candidate on the most common value of the measured entity
++ * -- counter
++ * -- total number of evaluations of the value
++ */
+ void
+ __gcov_merge_single (gcov_type *counters, unsigned n_counters)
+ {
+@@ -805,15 +850,16 @@
+
+ #ifdef L_gcov_merge_delta
+ /* The profile merging function for choosing the most common
+- difference between two consecutive evaluations of the value. It is
+- given an array COUNTERS of N_COUNTERS old counters and it reads the
+- same number of counters from the gcov file. The counters are split
+- into 4-tuples where the members of the tuple have meanings:
+-
+- -- the last value of the measured entity
+- -- the stored candidate on the most common difference
+- -- counter
+- -- total number of evaluations of the value */
++ * difference between two consecutive evaluations of the value. It is
++ * given an array COUNTERS of N_COUNTERS old counters and it reads the
++ * same number of counters from the gcov file. The counters are split
++ * into 4-tuples where the members of the tuple have meanings:
++ *
++ * -- the last value of the measured entity
++ * -- the stored candidate on the most common difference
++ * -- counter
++ * -- total number of evaluations of the value
++ */
+ void
+ __gcov_merge_delta (gcov_type *counters, unsigned n_counters)
+ {