qcom: ipq: Fix relocation global data size

The board goes into hung state when the GD_SIZE more than
GENERATED_GLOBAL_DATA_SIZE. In this case, the stack poninter
address will be pointing to the unknown address which leads to
hung state. Fixed the hung state to point to correct address.

Change-Id: I0efc807ca07c16ae0b79ea6c606fde931f02a220
Signed-off-by: Sham Muthayyan <smuthayy@codeaurora.org>
This commit is contained in:
Sham Muthayyan 2016-08-29 20:32:26 +05:30 committed by Gerrit - the friendly Code Review server
parent 8d3d5c2071
commit b8cda662ff
3 changed files with 6 additions and 4 deletions

View file

@ -128,7 +128,7 @@ clbss_l:cmp r0, r1 /* while not at end of BSS */
bic sp, sp, #7 /* 8-byte alignment for ABI compliance */
#endif
ldr r9, [r9, #GD_BD] /* r9 = gd->bd */
sub r9, r9, #GD_SIZE /* new GD is below bd */
sub r9, r9, #GENERATED_GBL_DATA_SIZE /* new GD is below bd */
adr lr, here
ldr r0, [r9, #GD_RELOC_OFF] /* r0 = gd->reloc_off */

View file

@ -59,6 +59,7 @@
#endif
#include <dm/root.h>
#include <linux/compiler.h>
#include <generated/asm-offsets.h>
/*
* Pointer to initial global data area
@ -533,6 +534,7 @@ static int reserve_board(void)
gd->start_addr_sp -= 0x40;
gd->start_addr_sp -= sizeof(bd_t);
gd->start_addr_sp = ALIGN(gd->start_addr_sp, 16);
gd->bd = (bd_t *)map_sysmem(gd->start_addr_sp, sizeof(bd_t));
memset(gd->bd, '\0', sizeof(bd_t));
debug("Reserving %zu Bytes for Board Info at: %08lx\n",
@ -552,7 +554,7 @@ static int setup_machine(void)
static int reserve_global_data(void)
{
gd->start_addr_sp -= sizeof(gd_t);
gd->start_addr_sp -= GENERATED_GBL_DATA_SIZE;
gd->new_gd = (gd_t *)map_sysmem(gd->start_addr_sp, sizeof(gd_t));
debug("Reserving %zu Bytes for Global Data at: %08lx\n",
sizeof(gd_t), gd->start_addr_sp);

View file

@ -8,6 +8,7 @@
*/
#include <common.h>
#include <generated/asm-offsets.h>
DECLARE_GLOBAL_DATA_PTR;
#define STACK_MARKER_LEN 32
@ -40,8 +41,7 @@ ulong board_init_f_mem(ulong top)
/* Leave space for the stack we are running with now */
top -= 0x40;
top -= sizeof(struct global_data);
top = ALIGN(top, 16);
top -= GENERATED_GBL_DATA_SIZE;
gd_ptr = (struct global_data *)top;
#ifdef _USE_MEMCPY
memset(gd_ptr, '\0', sizeof(*gd));