3a4356c0c0
When CPU1 is brought out of reset, it's MMU is not turned on yet, so it will only be able to use physical addresses. For systems with that have the MMU page configured for 0xC0000000, 0x80000000, or 0x40000000 "BIC 0x40000000" will work just fine, as it was just converting the virtual address of &cpu1start_addr into a physical address, ie. 0xC0000000 became 0x80000000. So for systems where the SDRAM controller was able to do a wrap-around access, this was working fine, as it was just dropping the MSB, but for systems where out of bounds memory access is not allowed, this would not allow CPU1 to correctly fetch &cpu1start_addr. This patch fixes the secondary_trampoline code to correctly fetch the physical address of cpu1start_addr directly. The patch will subtract the correct PAGE_OFFSET from &cpu1start_addr. And since on this platform, the physical memory will always start at 0x0, subtracting PAGE_OFFSET from &cpu1start_addr will allow CPU1 to correctly fetch the value of cpu1start_addr. While at it, change the name of cpu1start_addr to socfpga_cpu1start_addr to avoid any future naming collisions for multiplatform image. Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com> --- v4: Updated commit log to correctly lay out the usage of PAGE_OFFSET and add comments to the same effect. v3: Used PAGE_OFFSET to get the physical address v2: Correctly get the physical address instead of just a BIC hack.
38 lines
1011 B
ArmAsm
38 lines
1011 B
ArmAsm
/*
|
|
* Copyright (c) 2003 ARM Limited
|
|
* Copyright (c) u-boot contributors
|
|
* Copyright (c) 2012 Pavel Machek <pavel@denx.de>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*/
|
|
#include <linux/linkage.h>
|
|
#include <linux/init.h>
|
|
#include <asm/memory.h>
|
|
|
|
.arch armv7-a
|
|
|
|
ENTRY(secondary_trampoline)
|
|
/* CPU1 will always fetch from 0x0 when it is brought out of reset.
|
|
* Thus, we can just subtract the PAGE_OFFSET to get the physical
|
|
* address of &cpu1start_addr. This would not work for platforms
|
|
* where the physical memory does not start at 0x0.
|
|
*/
|
|
adr r0, 1f
|
|
ldmia r0, {r1, r2}
|
|
sub r2, r2, #PAGE_OFFSET
|
|
ldr r3, [r2]
|
|
ldr r4, [r3]
|
|
bx r4
|
|
|
|
.align
|
|
1: .long .
|
|
.long socfpga_cpu1start_addr
|
|
ENTRY(secondary_trampoline_end)
|
|
|
|
ENTRY(socfpga_secondary_startup)
|
|
bl v7_invalidate_l1
|
|
b secondary_startup
|
|
ENDPROC(socfpga_secondary_startup)
|