Martin Roth (gaumless(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/8427
-gerrit
commit 859a044c262d3d1c222cbf125664235ad8cc08c8
Author: Martin Roth <gaumless(a)gmail.com>
Date: Thu Feb 12 19:34:11 2015 -0700
Only update submodules if the source is in a git repo
This change just adds a check to verify that the build is happening
inside a git repo and that git is a valid command before trying
to update the submodules.
Change-Id: Idfa27645c3dbfd684f90002ecb01626d71eacc8f
Signed-off-by: Martin Roth <gaumless(a)gmail.com>
---
Makefile.inc | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index a60df87..b8ab4be 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -19,7 +19,7 @@
#######################################################################
# misleadingly named, this is the coreboot version
-export KERNELVERSION := $(shell if [ -d "$(top)/.git" -a -f "`which git`" ]; \
+export KERNELVERSION := $(shell if [ -d "$(top)/.git" -a -f "$(command -v git)" ]; \
then git describe --dirty --always || git describe; \
else echo 4.0$(KERNELREVISION); fi)
@@ -139,12 +139,14 @@ ifeq ($(CONFIG_COVERAGE),y)
ramstage-c-ccopts+=-fprofile-arcs -ftest-coverage
endif
-# try to fetch non-optional submodules
-forgetthis:=$(shell git submodule update --init)
+# try to fetch non-optional submodules if the source is under git
+forgetthis:=$(shell if [ -d "$(top)/.git" -a -f "$(command -v git)" ]; \
+ then git submodule update --init; fi)
ifeq ($(CONFIG_USE_BLOBS),y)
# this is necessary because 3rdparty is update=none, and so is ignored
# unless explicitly requested and enabled through --checkout
-forgetthis:=$(shell git submodule update --init --checkout 3rdparty)
+forgetthis:=$(shell if [ -d "$(top)/.git" -a -f "$(command -v git)" ]; \
+ then git submodule update --init --checkout 3rdparty; fi)
endif
bootblock-c-ccopts:=-D__BOOT_BLOCK__ -D__PRE_RAM__
Martin Roth (gaumless(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/8428
-gerrit
commit ecb5a6baa0684a9d183639904f341a71f2d1086a
Author: Martin Roth <gaumless(a)gmail.com>
Date: Thu Feb 12 19:32:41 2015 -0700
Move generation of build.h into a shell script
Moving the routines that create build.h into a script offers
several advantages. We can create more complex functions to
run and we don't have to deal with both bash and Make at the same
time.
This script combines what is currently in Makefile.inc with a
couple of update.
- Update how it determines whether to use git for the timestamp
- Move the git revision string generation inside the routine
that checks to see if we have git.
- Add a timeout for the domain name check.
Change-Id: I93c131e8d01a0099eb13db720fa865c627985750
Signed-off-by: Martin Roth <gaumless(a)gmail.com>
---
Makefile.inc | 28 ++------------
util/genbuild_h/genbuild_h.sh | 87 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 90 insertions(+), 25 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index a60df87..f8bd813 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -272,31 +272,9 @@ additional-dirs := $(objutil)/cbfstool $(objutil)/romcc $(objutil)/ifdtool \
$(obj)/build.h: .xcompile
@printf " GEN build.h\n"
rm -f $(obj)/build.h
- printf "/* build system definitions (autogenerated) */\n" > $(obj)/build.ht
- printf "#ifndef __BUILD_H\n" >> $(obj)/build.ht
- printf "#define __BUILD_H\n\n" >> $(obj)/build.ht
- printf "#define COREBOOT_VERSION \"$(KERNELVERSION)\"\n" >> $(obj)/build.ht
- if git update-index -q --refresh >/dev/null; ! git diff-index --quiet HEAD; then \
- printf "/* `LANG= TZ=UTC git log --date=local --pretty=format:%cd -1` UTC */\n" >> $(obj)/build.ht; \
- printf "#define COREBOOT_VERSION_TIMESTAMP `LANG= git log --pretty=format:%ct -1`\n" >> $(obj)/build.ht; \
- else \
- printf "/* `LANG= TZ=UTC date` */\n" >> $(obj)/build.ht; \
- printf "#define COREBOOT_VERSION_TIMESTAMP `LANG= date +%s`\n" >> $(obj)/build.ht; \
- fi
- printf "#define COREBOOT_ORIGIN_GIT_REVISION \"`LANG= git log remotes/origin/master -1 --format=format:%h`\"\n" >> $(obj)/build.ht
- printf "#define COREBOOT_EXTRA_VERSION \"$(COREBOOT_EXTRA_VERSION)\"\n" >> $(obj)/build.ht
- printf "#define COREBOOT_BUILD \"`LANG= date`\"\n" >> $(obj)/build.ht
- printf "#define COREBOOT_BUILD_YEAR_BCD 0x`LANG= date +"%y"`\n" >> $(obj)/build.ht
- printf "#define COREBOOT_BUILD_MONTH_BCD 0x`LANG= date +"%m"`\n" >> $(obj)/build.ht
- printf "#define COREBOOT_BUILD_DAY_BCD 0x`LANG= date +"%d"`\n" >> $(obj)/build.ht
- printf "#define COREBOOT_BUILD_WEEKDAY_BCD 0x`LANG= date +"%w"`\n" >> $(obj)/build.ht
- printf "#define COREBOOT_DMI_DATE \"`LANG= date +"%m/%d/%Y"`\"\n" >> $(obj)/build.ht
- printf "\n" >> $(obj)/build.ht
- printf "#define COREBOOT_COMPILE_TIME \"`LANG= date +%T`\"\n" >> $(obj)/build.ht
- printf "#define COREBOOT_COMPILE_BY \"$(subst \,@,$(shell PATH=$$PATH:/usr/ucb whoami))\"\n" >> $(obj)/build.ht
- printf "#define COREBOOT_COMPILE_HOST \"$(shell hostname -s 2>/dev/null || hostname 2>/dev/null)\"\n" >> $(obj)/build.ht
- printf "#define COREBOOT_COMPILE_DOMAIN \"$(shell test `uname -s` = "Linux" && dnsdomainname || domainname 2>/dev/null)\"\n" >> $(obj)/build.ht
- printf "#endif\n" >> $(obj)/build.ht
+ export KERNELVERSION="$(KERNELVERSION)"
+ export COREBOOT_EXTRA_VERSION="$(COREBOOT_EXTRA_VERSION)"
+ util/genbuild_h/genbuild_h.sh > $(obj)/build.ht
mv $(obj)/build.ht $(obj)/build.h
$(obj)/ldoptions: $(obj)/config.h
diff --git a/util/genbuild_h/genbuild_h.sh b/util/genbuild_h/genbuild_h.sh
new file mode 100755
index 0000000..6a7f65e
--- /dev/null
+++ b/util/genbuild_h/genbuild_h.sh
@@ -0,0 +1,87 @@
+#!/bin/sh
+
+# This file is part of the coreboot project.
+#
+# Copyright (C) 2014 Sage Electronic Engineering, LLC.
+#
+# 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
+#
+
+#get the domain name without hanging the build for an extended period if
+#the build system doesn't return a domain name as can happen with the
+#dnsdomainname or domainname commands by themselves.
+get_domainname() {
+ MAX_DELAY=1 #maximum time to wait in seconds
+ TIMEOUT_HOSTNAME_TEXT=unknown.domain #text to return if domain name is not found
+ TEMPFILE_NAME=coreboot_hostname.txt #temp file to put the domain name into
+
+ # Find the domain name
+ if [ "$(uname -s)" = "Linux" ]
+ then
+ dnsdomainname 2>/dev/null > "$TEMPFILE_NAME" &
+ else
+ domainname 2>/dev/null >"$TEMPFILE_NAME" &
+ fi
+
+ # Get ready to kill the process if it's taking too long
+ PID=$!
+ sleep "$MAX_DELAY" && kill "$PID" 2>/dev/null &
+ wait "$PID" 2>/dev/null
+
+ # See what was found, print our timeout text if the process was killed
+ # or the domain name if we found one.
+ HN=$(cat "$TEMPFILE_NAME")
+ if [ "$HN" = "" ]
+ then
+ printf "%s" "$TIMEOUT_HOSTNAME_TEXT"
+ else
+ printf "%s" "$HN"
+ fi
+
+ # Clean up and exit.
+ rm -f "$TEMPFILE_NAME"
+}
+
+#Print out the information that goes into build.h
+printf "/* build system definitions (autogenerated) */\n"
+printf "#ifndef __BUILD_H\n"
+printf "#define __BUILD_H\n\n"
+printf "#define COREBOOT_VERSION %s\n" "\"$KERNELVERSION\""
+
+#See if the build is running in a git repo and the git command is available
+if [ -d "${top}/.git" ] && [ -f "$(which git)" ]; then
+ printf "/* %s UTC */\n" "$(LANG= TZ=UTC git log --date=local --pretty=format:%cd -1)"
+ printf "#define COREBOOT_VERSION_TIMESTAMP %s\n" "$(LANG= git log --pretty=format:%ct -1)"
+ printf "#define COREBOOT_ORIGIN_GIT_REVISION \"%s\"\n" "$(LANG= git log remotes/origin/master -1 --format=format:%h)"
+else
+ printf "/* `LANG= TZ=UTC date` */\n"
+ printf "#define COREBOOT_VERSION_TIMESTAMP %s\n" "$(LANG= date +%s)"
+ printf "#define COREBOOT_ORIGIN_GIT_REVISION \"Unknown\"\n"
+fi
+
+printf "#define COREBOOT_EXTRA_VERSION \"%s\"\n" "$COREBOOT_EXTRA_VERSION"
+printf "#define COREBOOT_BUILD \"%s\"\n" "$(date)"
+printf "#define COREBOOT_BUILD_YEAR_BCD 0x%s\n" "$(date +%y)"
+printf "#define COREBOOT_BUILD_MONTH_BCD 0x%s\n" "$(date +%m)"
+printf "#define COREBOOT_BUILD_DAY_BCD 0x%s\n" "$(date +%d)"
+printf "#define COREBOOT_BUILD_WEEKDAY_BCD 0x%s\n" "$(date +%w)"
+printf "#define COREBOOT_DMI_DATE \"%s\"\n" "$(date +%m/%d/%Y)"
+printf "\n"
+printf "#define COREBOOT_COMPILE_TIME \"%s\"\n" "$(date +%T)"
+printf "#define COREBOOT_COMPILE_BY \"%s\"\n" "$(whoami)"
+printf "#define COREBOOT_COMPILE_HOST \"%s\"\n" "$(hostname -s 2>/dev/null)"
+printf "#define COREBOOT_COMPILE_DOMAIN \""
+get_domainname
+printf "\"\n"
+printf "#endif\n"
Marc Jones (marc.jones(a)se-eng.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/8585
-gerrit
commit eaa9c1fd180cb8faefc197e244c3fb7630c6a19f
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Thu Jul 10 12:40:30 2014 -0500
arm64: use one stage_entry for all stages
Ramstage needs an assembly entry point for setting up
the initial state of the CPU. Therefore, a function is
provided, arm64_el3_startup(), that bootstraps the state
of the processor, initializes the stack pointer, and
branches to a defined entry symbol. To make this work
without adding too much preprocessor macro conditions
provide _stack and _estack for all the stages.
Currently the entry point after initialization is 'main',
however it can be changed/extended to do more work such
as seeding the stack contents with tombstones, etc.
It should be noted that romstage and bootblock weren't
tested. Only ramstage is known to work.
BUG=chrome-os-partner:29923
BRANCH=None
TEST=Brought up 64-bit ramstage on rush.
Original-Change-Id: I1f07d5b6656e13e6667b038cdc1f4be8843d1960
Original-Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/207262
Original-Reviewed-by: Furquan Shaikh <furquan(a)chromium.org>
(cherry picked from commit 7850ee3a7bf48c05f2e64147edb92161f8308f19)
Signed-off-by: Marc Jones <marc.jones(a)se-eng.com>
Change-Id: Ia87697f49638c8c249215d441d95f1ec621e0949
---
src/arch/arm64/Makefile.inc | 1 +
src/arch/arm64/armv8/bootblock.S | 62 ------------------------------------
src/arch/arm64/bootblock.ld | 8 +++--
src/arch/arm64/include/arch/stages.h | 2 +-
src/arch/arm64/ramstage.ld | 7 ++--
src/arch/arm64/romstage.ld | 6 +++-
src/arch/arm64/stage_entry.S | 57 +++++++++++++++++++++++++++++++++
src/arch/arm64/stages.c | 5 ---
8 files changed, 74 insertions(+), 74 deletions(-)
diff --git a/src/arch/arm64/Makefile.inc b/src/arch/arm64/Makefile.inc
index a080e23..5f778b2 100644
--- a/src/arch/arm64/Makefile.inc
+++ b/src/arch/arm64/Makefile.inc
@@ -109,6 +109,7 @@ ramstage-y += tables.c
ramstage-y += memset.S
ramstage-y += memcpy.S
ramstage-y += memmove.S
+ramstage-y += stage_entry.S
ramstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
ramstage-srcs += $(wildcard src/mainboard/$(MAINBOARDDIR)/mainboard.c)
diff --git a/src/arch/arm64/armv8/bootblock.S b/src/arch/arm64/armv8/bootblock.S
index e65515f..ef70645 100644
--- a/src/arch/arm64/armv8/bootblock.S
+++ b/src/arch/arm64/armv8/bootblock.S
@@ -19,68 +19,6 @@
* MA 02111-1307 USA
*/
-.section ".start", "a", %progbits
-.globl _start
-_start: b reset
- .balignl 16,0xdeadbeef
-
-_cbfs_master_header:
- /* 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.
- * Assumes 64-byte alignment.
- */
- .skip 128
-
-reset:
- /*
- * Set the cpu to SVC32 mode and unmask aborts. Aborts might happen
- * before logging is turned on and may crash the machine, but at least
- * the problem will show up near the code that causes it.
- */
- /* FIXME: Not using supervisor mode, does it apply for aarch64? */
-
- msr daifclr, #0xc /* Unmask Debug and System exceptions */
- msr daifset, #0x3 /* Mask IRQ, FIQ */
-
- bl arm_init_caches
-
- /*
- * Initialize the stack to a known value. This is used to check for
- * stack overflow later in the boot process.
- */
- ldr x0, .Stack
- ldr x1, .Stack_size
- sub x0, x0, x1
- ldr x1, .Stack
- ldr x2, =0xdeadbeefdeadbeef
-init_stack_loop:
- str x2, [x0]
- add x0, x0, #8
- cmp x0, x1
- bne init_stack_loop
-
-/* Set stackpointer in internal RAM to call bootblock main() */
-call_bootblock:
- ldr x0, .Stack /* Set up stack pointer */
- mov sp, x0
- ldr x0, =0x00000000
-
- sub sp, sp, #16
-
- /*
- * Switch to EL2 already because Linux requires to be
- * in EL1 or EL2, see its "Booting AArch64 Linux" doc
- */
- bl switch_el3_to_el2
- bl main
-
-.align 3
-.Stack:
- .word CONFIG_STACK_TOP
-.align 3
-.Stack_size:
- .word CONFIG_STACK_SIZE
.section ".id", "a", %progbits
.globl __id_start
diff --git a/src/arch/arm64/bootblock.ld b/src/arch/arm64/bootblock.ld
index 907d009..775111b 100644
--- a/src/arch/arm64/bootblock.ld
+++ b/src/arch/arm64/bootblock.ld
@@ -28,14 +28,14 @@ PHDRS
to_load PT_LOAD;
}
-ENTRY(_start)
+ENTRY(stage_entry)
TARGET(binary)
SECTIONS
{
. = CONFIG_BOOTBLOCK_BASE;
.bootblock . : {
- *(.text._start);
+ *(.text.stage_entry);
KEEP(*(.id));
*(.text);
*(.text.*);
@@ -49,6 +49,10 @@ SECTIONS
*(.sbss.*);
} : to_load = 0xff
+ /* arm64 chipsets need to define CONFIG_BOOTBLOCK_STACK_(TOP|BOTTOM) */
+ _stack = CONFIG_BOOTBLOCK_STACK_BOTTOM;
+ _estack = CONFIG_BOOTBLOCK_STACK_TOP;
+
preram_cbmem_console = CONFIG_CONSOLE_PRERAM_BUFFER_BASE;
/DISCARD/ : {
diff --git a/src/arch/arm64/include/arch/stages.h b/src/arch/arm64/include/arch/stages.h
index e7a2401..0f82450 100644
--- a/src/arch/arm64/include/arch/stages.h
+++ b/src/arch/arm64/include/arch/stages.h
@@ -22,7 +22,7 @@
extern void main(void);
-void stage_entry(void) __attribute__((section(".text.stage_entry.aarch64")));
+void stage_entry(void);
void stage_exit(void *);
void jmp_to_elf_entry(void *entry, unsigned long buffer, unsigned long size);
diff --git a/src/arch/arm64/ramstage.ld b/src/arch/arm64/ramstage.ld
index 5dc55ba..19c9309 100644
--- a/src/arch/arm64/ramstage.ld
+++ b/src/arch/arm64/ramstage.ld
@@ -39,7 +39,7 @@ SECTIONS
.text : {
_text = .;
_start = .;
- *(.text.stage_entry.aarch64);
+ *(.text.stage_entry);
*(.text);
*(.text.*);
. = ALIGN(16);
@@ -116,8 +116,9 @@ SECTIONS
}
_eheap = .;
- _stack = CONFIG_STACK_BOTTOM;
- _estack = CONFIG_STACK_TOP;
+ /* arm64 chipsets need to define CONFIG_RAMSTAGE_STACK_(TOP|BOTTOM) */
+ _stack = CONFIG_RAMSTAGE_STACK_BOTTOM;
+ _estack = CONFIG_RAMSTAGE_STACK_TOP;
/* The ram segment. This includes all memory used by the memory
* resident copy of coreboot, except the tables that are produced on
diff --git a/src/arch/arm64/romstage.ld b/src/arch/arm64/romstage.ld
index a8d092c..9e08464 100644
--- a/src/arch/arm64/romstage.ld
+++ b/src/arch/arm64/romstage.ld
@@ -42,7 +42,7 @@ SECTIONS
.romtext . : {
_start = .;
- *(.text.stage_entry.aarch64);
+ *(.text.stage_entry);
*(.text.startup);
*(.text);
*(.text.*);
@@ -76,6 +76,10 @@ SECTIONS
_end = .;
+ /* arm64 chipsets need to define CONFIG_ROMSTAGE_STACK_(TOP|BOTTOM) */
+ _stack = CONFIG_ROMSTAGE_STACK_BOTTOM;
+ _estack = CONFIG_ROMSTAGE_STACK_TOP;
+
preram_cbmem_console = CONFIG_CONSOLE_PRERAM_BUFFER_BASE;
/* Discard the sections we don't need/want */
diff --git a/src/arch/arm64/stage_entry.S b/src/arch/arm64/stage_entry.S
new file mode 100644
index 0000000..56eca77
--- /dev/null
+++ b/src/arch/arm64/stage_entry.S
@@ -0,0 +1,57 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2014 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/asm.h>
+
+ENTRY(arm64_el3_startup)
+ mov x0, xzr
+ msr SCTLR_EL3, x0
+ msr SCR_EL3, x0
+ /* Have stack pointer use SP_EL0. */
+ msr SPSel, #0
+ isb
+
+ /* Load up the stack if non-zero. */
+ ldr x0, .stack
+ cmp x0, #0
+ b.eq 1f
+ mov sp, x0
+ 1:
+
+ ldr x1, .entry
+ br x1
+
+ .align 4
+ /*
+ * By default branch to main() and initialize the stack according
+ * to the Kconfig option for cpu0. However, this code can be relocated
+ * and reused to start up secondary cpus.
+ */
+ .stack:
+ .quad _estack
+ .entry:
+ .quad main
+ENDPROC(arm64_el3_startup)
+.global arm64_el3_startup_end
+arm64_el3_startup_end:
+
+ENTRY(stage_entry)
+ b arm64_el3_startup
+ENDPROC(stage_entry)
diff --git a/src/arch/arm64/stages.c b/src/arch/arm64/stages.c
index e1ab21a..8316b22 100644
--- a/src/arch/arm64/stages.c
+++ b/src/arch/arm64/stages.c
@@ -31,11 +31,6 @@
#include <arch/stages.h>
#include <arch/cache.h>
-void stage_entry(void)
-{
- main();
-}
-
/* we had marked 'doit' as 'noreturn'.
* There is no apparent harm in leaving it as something we can return from, and in the one
* case where we call a payload, the payload is allowed to return.
Marc Jones (marc.jones(a)se-eng.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/8583
-gerrit
commit b4a7095bb00ea1147b007e8433cfdd43cfa4f7ae
Author: Furquan Shaikh <furquan(a)google.com>
Date: Mon Jul 7 11:45:15 2014 -0700
coreboot t132: Stack init re-work
1) In order to avoid stack from overflowing during ramstage decompression,
initialize stack right at the beginning of romstage.
2) Declare different Kconfig options for stack at each stage.
3) Provide a macro that does stack seeding if required and calls appropriate
function.
BUG=None
BRANCH=None
TEST=Compiles and runs successfully on rush.
Original-Change-Id: I55d6ce59ea91affba3e86d68406921497c83fb52
Original-Signed-off-by: Furquan Shaikh <furquan(a)google.com>
Original-Reviewed-on: https://chromium-review.googlesource.com/206880
Original-Tested-by: Furquan Shaikh <furquan(a)chromium.org>
Original-Reviewed-by: Aaron Durbin <adurbin(a)chromium.org>
Original-Commit-Queue: Furquan Shaikh <furquan(a)chromium.org>
(cherry picked from commit 5e32d73803a2a9d222fcc4ca5f58efd3abe95d34)
Signed-off-by: Marc Jones <marc.jones(a)se-eng.com>
Change-Id: Ib833a1badb170a33cbf20d232019425b59db60cd
---
src/soc/nvidia/tegra132/Kconfig | 20 ++++++++++++--
src/soc/nvidia/tegra132/Makefile.inc | 1 +
src/soc/nvidia/tegra132/bootblock_asm.S | 41 ++++------------------------
src/soc/nvidia/tegra132/romstage.c | 3 ++-
src/soc/nvidia/tegra132/romstage_asm.S | 39 +++++++++++++++++++++++++++
src/soc/nvidia/tegra132/stack.S | 47 +++++++++++++++++++++++++++++++++
6 files changed, 112 insertions(+), 39 deletions(-)
diff --git a/src/soc/nvidia/tegra132/Kconfig b/src/soc/nvidia/tegra132/Kconfig
index a8b9bdc..761685a 100644
--- a/src/soc/nvidia/tegra132/Kconfig
+++ b/src/soc/nvidia/tegra132/Kconfig
@@ -51,14 +51,30 @@ config RAMSTAGE_BASE
hex
default 0x80200000
-config STACK_TOP
+config BOOTBLOCK_STACK_TOP
hex
default 0x40020000
-config STACK_BOTTOM
+config BOOTBLOCK_STACK_BOTTOM
hex
default 0x4001c000
+config ROMSTAGE_STACK_TOP
+ hex
+ default 0x40020000
+
+config ROMSTAGE_STACK_BOTTOM
+ hex
+ default 0x4001c000
+
+config RAMSTAGE_STACK_TOP
+ hex
+ default 0x80020000
+
+config RAMSTAGE_STACK_BOTTOM
+ hex
+ default 0x8001c000
+
config CBFS_CACHE_ADDRESS
hex "memory address to put CBFS cache data"
default 0x40006000
diff --git a/src/soc/nvidia/tegra132/Makefile.inc b/src/soc/nvidia/tegra132/Makefile.inc
index c14f1c8..8c085a9 100644
--- a/src/soc/nvidia/tegra132/Makefile.inc
+++ b/src/soc/nvidia/tegra132/Makefile.inc
@@ -16,6 +16,7 @@ ifeq ($(CONFIG_BOOTBLOCK_CONSOLE),y)
bootblock-$(CONFIG_DRIVERS_UART) += uart.c
endif
+romstage-y += romstage_asm.S
romstage-y += cbfs.c
romstage-y += cbmem.c
romstage-y += timer.c
diff --git a/src/soc/nvidia/tegra132/bootblock_asm.S b/src/soc/nvidia/tegra132/bootblock_asm.S
index ebd64a7..1b2fbb7 100644
--- a/src/soc/nvidia/tegra132/bootblock_asm.S
+++ b/src/soc/nvidia/tegra132/bootblock_asm.S
@@ -31,6 +31,8 @@
#include <arch/asm.h>
+#include "stack.S"
+
ENTRY(_start)
/*
* Set the cpu to System mode with IRQ and FIQ disabled. Prefetch/Data
@@ -40,40 +42,7 @@ ENTRY(_start)
*/
msr cpsr_cxf, #0xdf
- /*
- * Initialize the stack to a known value. This is used to check for
- * stack overflow later in the boot process.
- */
- ldr r0, .Stack
- ldr r1, .Stack_size
- sub r0, r0, r1
- ldr r1, .Stack
- ldr r2, =0xdeadbeef
-init_stack_loop:
- str r2, [r0]
- add r0, #4
- cmp r0, r1
- bne init_stack_loop
-
-/* Set stackpointer in internal RAM to call bootblock main() */
-call_bootblock:
- ldr sp, .Stack /* Set up stack pointer */
- ldr r0,=0x00000000
- /*
- * The current design of cpu_info places the
- * struct at the top of the stack. The number of
- * words pushed must be at least as large as that
- * struct.
- */
- push {r0-r2}
- bic sp, sp, #7 /* 8-byte alignment for ABI compliance */
- /*
- * Use "bl" instead of "b" even though we do not intend to return.
- * "bl" gets compiled to "blx" if we're transitioning from ARM to
- * Thumb. However, "b" will not and GCC may attempt to create a
- * wrapper which is currently broken.
- */
- bl main
+ stack_init stack=.Stack size=.Stack_size seed=1 func=main
ENDPROC(_start)
/* we do it this way because it's a 32-bit constant and
@@ -82,8 +51,8 @@ ENDPROC(_start)
*/
.align 2
.Stack:
- .word CONFIG_STACK_TOP
+ .word CONFIG_BOOTBLOCK_STACK_TOP
.align 2
/* create this size the same way we do in ramstage.ld: top-bottom */
.Stack_size:
- .word CONFIG_STACK_TOP - CONFIG_STACK_BOTTOM
+ .word CONFIG_BOOTBLOCK_STACK_TOP - CONFIG_BOOTBLOCK_STACK_BOTTOM
diff --git a/src/soc/nvidia/tegra132/romstage.c b/src/soc/nvidia/tegra132/romstage.c
index 3bc2231..6d51403 100644
--- a/src/soc/nvidia/tegra132/romstage.c
+++ b/src/soc/nvidia/tegra132/romstage.c
@@ -26,7 +26,8 @@
#include "sdram.h"
#include "ccplex.h"
-void main(void)
+void romstage(void);
+void romstage(void)
{
void *entry;
diff --git a/src/soc/nvidia/tegra132/romstage_asm.S b/src/soc/nvidia/tegra132/romstage_asm.S
new file mode 100644
index 0000000..ac3c93e
--- /dev/null
+++ b/src/soc/nvidia/tegra132/romstage_asm.S
@@ -0,0 +1,39 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2014 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/asm.h>
+#include "stack.S"
+
+ .section ".text", "ax", %progbits
+
+ENTRY(main)
+ stack_init stack=.Stack size=.Stack_size seed=0 func=romstage
+ENDPROC(main)
+
+/* we do it this way because it's a 32-bit constant and
+ * in some cases too far away to be loaded as just an offset
+ * from IP
+ */
+.align 2
+.Stack:
+ .word CONFIG_ROMSTAGE_STACK_TOP
+.align 2
+.Stack_size:
+ .word CONFIG_ROMSTAGE_STACK_TOP - CONFIG_ROMSTAGE_STACK_BOTTOM
+
diff --git a/src/soc/nvidia/tegra132/stack.S b/src/soc/nvidia/tegra132/stack.S
new file mode 100644
index 0000000..6d3cd4e
--- /dev/null
+++ b/src/soc/nvidia/tegra132/stack.S
@@ -0,0 +1,47 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2014 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
+ */
+
+/* Macro to initialize stack, perform seeding if required and finally call the
+ * function provided
+ * @stack : Stack address
+ * @size : Stack size
+ * @seed : Stack seeding required (1=yes/otherwise=no)
+ * @func : Function to call after initializing stack
+ */
+.macro stack_init stack, size, seed, func
+ /* Check if stack seeding is required */
+ mov r0, #\seed
+ cmp r0, #1
+ bne call_func
+ /* Stack seeding */
+ ldr r0, \stack
+ ldr r1, \size
+ sub r0, r0, r1
+ ldr r1, \stack
+ ldr r2, =0xdeadbeef
+init_stack_loop:
+ str r2, [r0]
+ add r0, #4
+ cmp r0, r1
+ bne init_stack_loop
+
+call_func:
+ ldr sp, \stack /* Set up stack pointer */
+ bl \func
+.endm
Marc Jones (marc.jones(a)se-eng.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/8582
-gerrit
commit 134b1e30f5c1fbf88eaf192351da9e81e801c3e0
Author: Tom Warren <twarren(a)nvidia.com>
Date: Tue Jul 1 17:08:27 2014 -0700
rush: PMIC: initial AS3722 PMIC writes for Rush
Still waiting on VDD_CPU value, etc. from board guys, but this is a start.
BUG=None
BRANCH=None
TEST=Built and flashed rush, saw 'PMIC init done' string OK.
Original-Change-Id: I6f8b16c4ebf1e9c159f8175d59262119ef0e498f
Original-Signed-off-by: Tom Warren <twarren(a)nvidia.com>
Original-Reviewed-on: https://chromium-review.googlesource.com/206412
Original-Reviewed-by: Aaron Durbin <adurbin(a)chromium.org>
Original-Commit-Queue: Aaron Durbin <adurbin(a)chromium.org>
(cherry picked from commit 96a9ff8f632c2b9bf3f81f5b8fc4f3b6784a02bc)
Signed-off-by: Marc Jones <marc.jones(a)se-eng.com>
Change-Id: I9d3d7ff55f2d6ca88ebdcc8ad1d7de135f5136d2
---
src/mainboard/google/rush/pmic.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/src/mainboard/google/rush/pmic.c b/src/mainboard/google/rush/pmic.c
index c114066..7aa7dc9 100644
--- a/src/mainboard/google/rush/pmic.c
+++ b/src/mainboard/google/rush/pmic.c
@@ -92,19 +92,13 @@ void pmic_init(unsigned bus)
/* Restore PMIC POR defaults, in case kernel changed 'em */
pmic_slam_defaults(bus);
- /* First set VDD_CPU to 1.2V, then enable the VDD_CPU regulator. */
- if (board_id() == 0)
- pmic_write_reg(bus, 0x00, 0x3c, 1);
- else
- pmic_write_reg(bus, 0x00, 0x50, 1);
+ /* SDO0: Set VDD_CPU to 1.2V. */
+ pmic_write_reg(bus, 0x00, 0x50, 1);
- /* First set VDD_GPU to 1.0V, then enable the VDD_GPU regulator. */
+ /* SDO6: Set VDD_GPU to 1.0V. */
pmic_write_reg(bus, 0x06, 0x28, 1);
- /*
- * First set +1.2V_GEN_AVDD to 1.2V, then enable the +1.2V_GEN_AVDD
- * regulator.
- */
+ /* LDO2: Set +1.2V_GEN_AVDD to 1.2V */
pmic_write_reg(bus, 0x12, 0x10, 1);
/*
@@ -113,4 +107,6 @@ void pmic_init(unsigned bus)
*/
pmic_write_reg(bus, 0x0c, 0x07, 0);
pmic_write_reg(bus, 0x20, 0x10, 1);
+
+ printk(BIOS_DEBUG, "PMIC init done\n");
}
Marc Jones (marc.jones(a)se-eng.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/8580
-gerrit
commit e415fa9b16dd3bb7eca11e50d41702225e00beb0
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Mon Jun 30 16:37:13 2014 -0500
t132: load MTS microcode
The armv8 cores need to have microcode loaded before they can
be taken out of reset. Locate and load the MTS microcode at the
fixed address of 0x82000000. The ccplex, once enabled, will
decode and transfer the microcode to the carveout region.
BUG=chrome-os-partner:29922
BRANCH=None
TEST=Built and ran. Confirmed dump of MTS region after loading code.
Original-Change-Id: Ie5ab72e5363cbdb251d169356f718020d375fce6
Original-Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/206290
Original-Reviewed-by: Furquan Shaikh <furquan(a)chromium.org>
(cherry picked from commit 6726d8862c08b155b9218aa5e2e39428a105089e)
Signed-off-by: Marc Jones <marc.jones(a)se-eng.com>
Change-Id: I425c2e2fd1eaec49d81bef1ff4bf4f36da9296df
---
src/soc/nvidia/tegra132/Makefile.inc | 1 +
src/soc/nvidia/tegra132/ccplex.c | 61 ++++++++++++++++++++++++++++++++++++
src/soc/nvidia/tegra132/ccplex.h | 28 +++++++++++++++++
src/soc/nvidia/tegra132/romstage.c | 7 +++--
4 files changed, 95 insertions(+), 2 deletions(-)
diff --git a/src/soc/nvidia/tegra132/Makefile.inc b/src/soc/nvidia/tegra132/Makefile.inc
index a984674..c14f1c8 100644
--- a/src/soc/nvidia/tegra132/Makefile.inc
+++ b/src/soc/nvidia/tegra132/Makefile.inc
@@ -19,6 +19,7 @@ endif
romstage-y += cbfs.c
romstage-y += cbmem.c
romstage-y += timer.c
+romstage-y += ccplex.c
romstage-y += clock.c
romstage-y += spi.c
romstage-y += i2c.c
diff --git a/src/soc/nvidia/tegra132/ccplex.c b/src/soc/nvidia/tegra132/ccplex.c
new file mode 100644
index 0000000..b569bd2
--- /dev/null
+++ b/src/soc/nvidia/tegra132/ccplex.c
@@ -0,0 +1,61 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2014 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 <string.h>
+#include <console/console.h>
+#include <arch/io.h>
+#include <cbfs.h>
+#include <soc/addressmap.h>
+#include "ccplex.h"
+#include "mc.h"
+
+#define MTS_FILE_NAME "mts"
+
+int ccplex_load_mts(void)
+{
+ struct cbfs_file file;
+ ssize_t offset;
+ size_t nread;
+ /*
+ * MTS location is hard coded to this magic address. The hardware will
+ * take the MTS from this location and place it in the final resting
+ * place in the carveout region.
+ */
+ void * const mts = (void *)(uintptr_t)MTS_LOAD_ADDRESS;
+ struct cbfs_media *media = CBFS_DEFAULT_MEDIA;
+
+ offset = cbfs_locate_file(media, &file, MTS_FILE_NAME);
+ if (offset < 0) {
+ printk(BIOS_DEBUG, "MTS file not found: %s\n", MTS_FILE_NAME);
+ return -1;
+ }
+
+ /* Read MTS file into the carveout region. */
+ nread = cbfs_read(media, mts, offset, file.len);
+
+ if (nread != file.len) {
+ printk(BIOS_DEBUG, "MTS bytes read (%zu) != file length(%u)!\n",
+ nread, file.len);
+ return -1;
+ }
+
+ printk(BIOS_DEBUG, "MTS: %zu bytes loaded @ %p\n", nread, mts);
+
+ return 0;
+}
diff --git a/src/soc/nvidia/tegra132/ccplex.h b/src/soc/nvidia/tegra132/ccplex.h
new file mode 100644
index 0000000..6b9699c
--- /dev/null
+++ b/src/soc/nvidia/tegra132/ccplex.h
@@ -0,0 +1,28 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2014 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
+ */
+
+#ifndef __SOC_NVIDIA_TEGRA132_CCPLEX_H__
+#define __SOC_NVIDIA_TEGRA132_CCPLEX_H__
+
+#define MTS_LOAD_ADDRESS 0x82000000
+
+/* Loads the MTS microcode. Return 0 on success, < 0 on error. */
+int ccplex_load_mts(void);
+
+#endif /* __SOC_NVIDIA_TEGRA132_CCPLEX_H__ */
diff --git a/src/soc/nvidia/tegra132/romstage.c b/src/soc/nvidia/tegra132/romstage.c
index 20429a5..3bc2231 100644
--- a/src/soc/nvidia/tegra132/romstage.c
+++ b/src/soc/nvidia/tegra132/romstage.c
@@ -23,7 +23,8 @@
#include <arch/exception.h>
#include <soc/sdram_configs.h>
-#include <soc/nvidia/tegra132/sdram.h>
+#include "sdram.h"
+#include "ccplex.h"
void main(void)
{
@@ -35,9 +36,11 @@ void main(void)
printk(BIOS_INFO, "T132: romstage here\n");
sdram_init(get_sdram_config());
-
printk(BIOS_INFO, "T132 romstage: sdram_init done\n");
+ ccplex_load_mts();
+ printk(BIOS_INFO, "T132 romstage: MTS loading done\n");
+
while (1);
entry = cbfs_load_stage(CBFS_DEFAULT_MEDIA,