sysmem: fdt: reserve more CONFIG_SYS_FDT_PAD size for fdt

Sometimes, framework or user would call fdt_increase_size() to update
fdt size, it's better reserve more space to avoid sysmem gives the fdt
region overflow report.

The CONFIG_SYS_FDT_PAD default value is sync with bootm framework
in: common/image-fdt.c

Change-Id: I363e9a4182e13b1628a76666acd8272d25db659d
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
This commit is contained in:
Joseph Chen 2019-01-29 21:22:38 +08:00 committed by Jianhong Chen
parent d01ceddd38
commit 2c9d117912
5 changed files with 14 additions and 4 deletions

View File

@ -648,7 +648,7 @@ int rockchip_read_dtb_file(void *fdt_addr)
return size;
if (!sysmem_alloc_base("fdt", (phys_addr_t)fdt_addr,
ALIGN(size, RK_BLK_SIZE)))
ALIGN(size, RK_BLK_SIZE) + CONFIG_SYS_FDT_PAD))
return -ENOMEM;
ret = rockchip_read_resource_file((void *)fdt_addr, dtb_name, 0, 0);

View File

@ -811,9 +811,10 @@ int android_fdt_overlay_apply(void *fdt_addr)
fdt_totalsize((void *)fdt_dtbo);
if (sysmem_free((phys_addr_t)fdt_addr))
goto out;
if (!sysmem_alloc_base("fdt(dtbo)",
(phys_addr_t)fdt_addr,
fdt_size))
fdt_size + CONFIG_SYS_FDT_PAD))
goto out;
fdt_increase_size(fdt_addr, fdt_totalsize((void *)fdt_dtbo));
ret = fdt_overlay_apply(fdt_addr, (void *)fdt_dtbo);

View File

@ -349,7 +349,8 @@ static int android_image_load_separate(struct blk_desc *dev_desc,
blk_cnt = DIV_ROUND_UP(hdr->second_size, dev_desc->blksz);
if (!sysmem_alloc_base("fdt(AOSP)",
fdt_addr_r,
blk_cnt * dev_desc->blksz))
blk_cnt * dev_desc->blksz +
CONFIG_SYS_FDT_PAD))
return -ENXIO;
ret = blk_dread(dev_desc, blk_start, blk_cnt, (void *)fdt_addr_r);

View File

@ -13,6 +13,14 @@
#undef MAX_LMB_REGIONS
#define MAX_LMB_REGIONS MAX_SYSMEM_REGIONS
/*
* CONFIG_SYS_FDT_PAD default value is sync with bootm framework in:
* common/image-fdt.c
*/
#ifndef CONFIG_SYS_FDT_PAD
#define CONFIG_SYS_FDT_PAD 0x3000
#endif
struct sysmem_property {
const char *name;
phys_addr_t base;

View File

@ -373,7 +373,7 @@ int sysmem_free(phys_addr_t base)
ret = lmb_free(&sysmem->lmb, prop->base, prop->size);
if (ret >= 0) {
SYSMEM_I("Free: \"%s\", paddr=0x%lx, size=0x%lx\n",
SYSMEM_D("Free: \"%s\", paddr=0x%lx, size=0x%lx\n",
prop->name, (ulong)prop->base, (ulong)prop->size);
sysmem->allocated_cnt--;
list_del(&prop->node);