Merge branch '2021-11-18-regression-fixes'

- An assortment of fixes related to GD, GD_FLG_SKIP_RELOC, and the lmb
- Environment fix on synquacer developmentbox
- Fix for get_info is not valid in partition code
This commit is contained in:
Tom Rini 2021-11-18 18:25:19 -05:00
commit 8391a0f3d9
6 changed files with 39 additions and 16 deletions

View File

@ -104,6 +104,10 @@ ENTRY(_main)
bic sp, x0, #0xf /* 16-byte alignment for ABI compliance */ bic sp, x0, #0xf /* 16-byte alignment for ABI compliance */
ldr x18, [x18, #GD_NEW_GD] /* x18 <- gd->new_gd */ ldr x18, [x18, #GD_NEW_GD] /* x18 <- gd->new_gd */
/* Skip relocation in case gd->gd_flags & GD_FLG_SKIP_RELOC */
ldr x0, [x18, #GD_FLAGS] /* x0 <- gd->flags */
tbnz x0, 11, relocation_return /* GD_FLG_SKIP_RELOC is bit 11 */
adr lr, relocation_return adr lr, relocation_return
#if CONFIG_POSITION_INDEPENDENT #if CONFIG_POSITION_INDEPENDENT
/* Add in link-vs-runtime offset */ /* Add in link-vs-runtime offset */

View File

@ -82,6 +82,8 @@ int board_init(void)
{ {
gd->bd->bi_boot_params = CONFIG_SYS_LOAD_ADDR + LOAD_OFFSET; gd->bd->bi_boot_params = CONFIG_SYS_LOAD_ADDR + LOAD_OFFSET;
gd->env_addr = (ulong)&default_environment[0];
synquacer_setup_scbm_smmu(); synquacer_setup_scbm_smmu();
return 0; return 0;

View File

@ -673,30 +673,32 @@ static int reloc_bloblist(void)
static int setup_reloc(void) static int setup_reloc(void)
{ {
if (gd->flags & GD_FLG_SKIP_RELOC) { if (!(gd->flags & GD_FLG_SKIP_RELOC)) {
debug("Skipping relocation due to flag\n");
return 0;
}
#ifdef CONFIG_SYS_TEXT_BASE #ifdef CONFIG_SYS_TEXT_BASE
#ifdef ARM #ifdef ARM
gd->reloc_off = gd->relocaddr - (unsigned long)__image_copy_start; gd->reloc_off = gd->relocaddr - (unsigned long)__image_copy_start;
#elif defined(CONFIG_M68K) #elif defined(CONFIG_M68K)
/* /*
* On all ColdFire arch cpu, monitor code starts always * On all ColdFire arch cpu, monitor code starts always
* just after the default vector table location, so at 0x400 * just after the default vector table location, so at 0x400
*/ */
gd->reloc_off = gd->relocaddr - (CONFIG_SYS_TEXT_BASE + 0x400); gd->reloc_off = gd->relocaddr - (CONFIG_SYS_TEXT_BASE + 0x400);
#elif !defined(CONFIG_SANDBOX) #elif !defined(CONFIG_SANDBOX)
gd->reloc_off = gd->relocaddr - CONFIG_SYS_TEXT_BASE; gd->reloc_off = gd->relocaddr - CONFIG_SYS_TEXT_BASE;
#endif #endif
#endif #endif
}
memcpy(gd->new_gd, (char *)gd, sizeof(gd_t)); memcpy(gd->new_gd, (char *)gd, sizeof(gd_t));
debug("Relocation Offset is: %08lx\n", gd->reloc_off); if (gd->flags & GD_FLG_SKIP_RELOC) {
debug("Relocating to %08lx, new gd at %08lx, sp at %08lx\n", debug("Skipping relocation due to flag\n");
gd->relocaddr, (ulong)map_to_sysmem(gd->new_gd), } else {
gd->start_addr_sp); debug("Relocation Offset is: %08lx\n", gd->reloc_off);
debug("Relocating to %08lx, new gd at %08lx, sp at %08lx\n",
gd->relocaddr, (ulong)map_to_sysmem(gd->new_gd),
gd->start_addr_sp);
}
return 0; return 0;
} }

View File

@ -668,6 +668,13 @@ int part_get_info_by_name_type(struct blk_desc *dev_desc, const char *name,
part_drv = part_driver_lookup_type(dev_desc); part_drv = part_driver_lookup_type(dev_desc);
if (!part_drv) if (!part_drv)
return -1; return -1;
if (!part_drv->get_info) {
log_debug("## Driver %s does not have the get_info() method\n",
part_drv->name);
return -ENOSYS;
}
for (i = 1; i < part_drv->max_entries; i++) { for (i = 1; i < part_drv->max_entries; i++) {
ret = part_drv->get_info(dev_desc, i, info); ret = part_drv->get_info(dev_desc, i, info);
if (ret != 0) { if (ret != 0) {

View File

@ -29,6 +29,9 @@ int main(void)
DEFINE(GD_SIZE, sizeof(struct global_data)); DEFINE(GD_SIZE, sizeof(struct global_data));
DEFINE(GD_BD, offsetof(struct global_data, bd)); DEFINE(GD_BD, offsetof(struct global_data, bd));
DEFINE(GD_FLAGS, offsetof(struct global_data, flags));
#if CONFIG_VAL(SYS_MALLOC_F_LEN) #if CONFIG_VAL(SYS_MALLOC_F_LEN)
DEFINE(GD_MALLOC_BASE, offsetof(struct global_data, malloc_base)); DEFINE(GD_MALLOC_BASE, offsetof(struct global_data, malloc_base));
#endif #endif

View File

@ -13,6 +13,7 @@
#include <malloc.h> #include <malloc.h>
#include <asm/global_data.h> #include <asm/global_data.h>
#include <asm/sections.h>
DECLARE_GLOBAL_DATA_PTR; DECLARE_GLOBAL_DATA_PTR;
@ -144,6 +145,10 @@ void arch_lmb_reserve_generic(struct lmb *lmb, ulong sp, ulong end, ulong align)
bank_end = end - 1; bank_end = end - 1;
lmb_reserve(lmb, sp, bank_end - sp + 1); lmb_reserve(lmb, sp, bank_end - sp + 1);
if (gd->flags & GD_FLG_SKIP_RELOC)
lmb_reserve(lmb, (phys_addr_t)(uintptr_t)_start, gd->mon_len);
break; break;
} }
} }