u-boot-brain/arch/arm
Marek Vasut beee6a3083 ARM: socfpga: Add boot0 hook to prevent SPL corruption
Valid Altera SoCFPGA preloader image must contain special data at
offsets 0x40, 0x44, 0x48 and valid instructions at address 0x4c or
0x50. These addresses are by default used by U-Boot's vector table
and a piece of reset handler, thus a valid preloader corrupts those
addresses slightly. While this works most of the time, this can and
does prevent the board from rebooting sometimes and triggering this
issue may even depend on compiler.

The problem is that when SoCFPGA performs warm reset, it checks the
addresses 0x40..0x4b in SRAM for a valid preloader signature and
header checksum. If those are found, it jumps to address 0x4c or
0x50 (this is unclear). These addresses are populated by the first
few instructions of arch/arm/cpu/armv7/start.S:

ffff0040 <data_abort>:
ffff0040:       ebfffffe        bl      ffff0040 <data_abort>

ffff0044 <reset>:
ffff0044:       ea000012        b       ffff0094 <save_boot_params>

ffff0048 <save_boot_params_ret>:
ffff0048:       e10f0000        mrs     r0, CPSR
ffff004c:       e200101f        and     r1, r0, #31
ffff0050:       e331001a        teq     r1, #26

Without this patch, the CPU will enter the code at 0xffff004c or
0xffff0050 , at which point the value of r0 and r1 registers is
undefined. Moreover, jumping directly to the preloader entry point
at address 0xffff0000 will also fail, because address 0xffff004.
is invalid and contains the preloader magic.

Add BOOT0 hook which reserves the area at offset 0x40..0x5f and
populates offset 0x50 with jump to the entry point. This way, the
preloader signature is stored in reserved space and can not corrupt
the SPL code.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Chin Liang See <clsee@altera.com>
Cc: Dinh Nguyen <dinguyen@opensource.altera.com>
Cc: Stefan Roese <sr@denx.de>
Tested-by: Dinh Nguyen <dinguyen@opensource.altera.com>
2016-12-06 01:45:56 +01:00
..
cpu armv8: QSPI: Add AHB bus 16MB+ size support 2016-12-05 08:32:43 -08:00
dts socfpga: add support for Terasic DE1-SoC board 2016-12-06 01:45:56 +01:00
imx-common imx: make ipu's di configurable 2016-11-29 16:33:21 +01:00
include armv8: QSPI: Add AHB bus 16MB+ size support 2016-12-05 08:32:43 -08:00
lib libfdt: replace ARCH_FIXUP_FDT with ARCH_FIXUP_FDT_MEMORY 2016-12-02 20:54:34 -07:00
mach-at91 arm, at91: add icache support 2016-10-28 18:37:13 +02:00
mach-bcm283x ARM: bcm283x: Implement EFI RTS reset_system 2016-11-28 20:15:19 -05:00
mach-davinci davinci: omapl138_lcdk: configure ddr2 2016-12-03 13:21:14 -05:00
mach-exynos arm: exynos7420: remove custome low level init function 2016-11-22 11:40:24 -08:00
mach-highbank ARM: highbank: move SoC sources to mach-highbank 2015-02-21 08:23:51 -05:00
mach-integrator integrator: switch to DM serial port 2015-08-12 20:47:49 -04:00
mach-keystone ARM: K2G: DDR3: Fix up priv ID for MPU 2016-12-03 13:21:10 -05:00
mach-kirkwood arm: kirkwood: add support for Synology DS109 board 2016-10-09 10:55:32 +02:00
mach-meson arm: Disable HVC PSCI calls by default 2016-10-18 09:08:08 +02:00
mach-mvebu arm64: mvebu: Restrict memory size to a usable maximum 2016-12-05 13:34:33 +01:00
mach-omap2 ARM: OMAP4+: Add support for getting pbias info from board 2016-12-04 13:54:51 -05:00
mach-orion5x Use correct spelling of "U-Boot" 2016-02-06 12:00:59 +01:00
mach-rmobile armv8: Support loading 32-bit OS in AArch32 execution state 2016-11-22 11:40:24 -08:00
mach-rockchip rockchip: Add support for veyron-minnie (ASUS Chromebook Flip) 2016-11-25 17:59:32 -07:00
mach-s5pc1xx arm: s5pc1xx: move SoC to mach-s5pc1xx 2015-11-30 17:17:01 +09:00
mach-snapdragon drivers/sysreset: group sysreset drivers 2016-08-12 09:22:17 -04:00
mach-socfpga ARM: socfpga: Add boot0 hook to prevent SPL corruption 2016-12-06 01:45:56 +01:00
mach-stm32 Revert "stm32: Change USART port to USART6 for stm32f746 discovery board" 2016-07-21 15:38:13 -04:00
mach-sunxi sunxi: A64: enable USB support 2016-10-30 11:38:04 +01:00
mach-tegra Merge branch 'master' of git://git.denx.de/u-boot-tegra 2016-11-08 10:36:57 -05:00
mach-uniphier ARM: uniphier: update DRAM init code for LD11 SoC 2016-10-29 17:24:30 +09:00
mach-versatile arm: Remove versatileab board 2015-09-11 15:01:25 -04:00
mach-zynq zynq: nand: Runtime detection of nand buswidth through slcr 2016-11-15 15:27:51 +01:00
thumb1/include/asm/proc-armv arm: support Thumb-1 with CONFIG_SYS_THUMB_BUILD 2015-11-10 15:03:48 +01:00
config.mk TI: Remove CONFIG_OMAP_COMMON in favor of CONFIG_ARCH_OMAP2 2016-11-21 14:07:29 -05:00
Kconfig ARM: socfpga: Add boot0 hook to prevent SPL corruption 2016-12-06 01:45:56 +01:00
Kconfig.debug arm: debug: add Kconfig entries for lowlevel debug 2014-10-26 22:23:12 +01:00
Makefile arm: Introduce arch/arm/mach-omap2 for OMAP2 derivative platforms 2016-11-21 14:07:29 -05:00