u-boot-brain/arch
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
..
arc libfdt: replace ARCH_FIXUP_FDT with ARCH_FIXUP_FDT_MEMORY 2016-12-02 20:54:34 -07:00
arm ARM: socfpga: Add boot0 hook to prevent SPL corruption 2016-12-06 01:45:56 +01:00
avr32 efi: Use asmlinkage for EFIAPI 2016-10-19 09:01:53 +02:00
blackfin common/Kconfig: Add DISPLAY_CPUINFO 2016-10-12 08:04:34 -04:00
m68k efi: Use asmlinkage for EFIAPI 2016-10-19 09:01:53 +02:00
microblaze libfdt: replace ARCH_FIXUP_FDT with ARCH_FIXUP_FDT_MEMORY 2016-12-02 20:54:34 -07:00
mips libfdt: replace ARCH_FIXUP_FDT with ARCH_FIXUP_FDT_MEMORY 2016-12-02 20:54:34 -07:00
nds32 nds32: Support relocation. 2016-09-29 15:38:10 +08:00
nios2 efi: Use asmlinkage for EFIAPI 2016-10-19 09:01:53 +02:00
openrisc efi: Use asmlinkage for EFIAPI 2016-10-19 09:01:53 +02:00
powerpc fsl/ddr: Add erratum_a009942_check_cpo and clean related erratum 2016-12-05 08:31:45 -08:00
sandbox libfdt: replace ARCH_FIXUP_FDT with ARCH_FIXUP_FDT_MEMORY 2016-12-02 20:54:34 -07:00
sh sh: generate position independent code for all platforms 2016-12-02 21:32:54 -05:00
sparc efi: Use asmlinkage for EFIAPI 2016-10-19 09:01:53 +02:00
x86 libfdt: replace ARCH_FIXUP_FDT with ARCH_FIXUP_FDT_MEMORY 2016-12-02 20:54:34 -07:00
xtensa Remove arch/${ARCH}/include/asm/errno.h 2016-09-23 17:56:18 -04:00
.gitignore .gitignore: drop include/asm/proc from ignore pattern 2014-06-19 11:18:54 -04:00
Kconfig sandbox, x86: select DM_KEYBOARD instead of default y entry 2016-10-01 20:04:33 -04:00