diff options
author | Ye Li <ye.li@nxp.com> | 2018-09-11 01:14:41 -0700 |
---|---|---|
committer | Ye Li <ye.li@nxp.com> | 2018-09-11 21:56:56 -0700 |
commit | 13fccde4c694453a3a038c4fb5fdb38cb7327747 (patch) | |
tree | 20872e32d98ecce88717624339dce46a2ade16c0 | |
parent | 0fc24973f5f8d32d0925bf0cf1eb3d8b75ae18b4 (diff) |
MLK-19546 imx8qm/qxp: Fix issue in get_effective_memsize
When Trusty OS allocates the mem region from 0xfe0000000-0xffffffff, the get_effective_memsize
does not return correct memory size. There is a check in get_effective_memsize to find the memreg
where the u-boot is running, and return the size of that memreg as the result of get_effective_memsize.
When using aligned start, the value is 0x80200000 since it is 2MB aligned. Thus the finding of memreg
will fail and return the PHYS_SDRAM_1_SIZE because u-boot text base is 0x80020000.
This cause u-boot relocating to the high memory where has been occupied by Trusty OS.
Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
-rw-r--r-- | arch/arm/mach-imx/imx8/cpu.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/arm/mach-imx/imx8/cpu.c b/arch/arm/mach-imx/imx8/cpu.c index 69cc773723..2715596082 100644 --- a/arch/arm/mach-imx/imx8/cpu.c +++ b/arch/arm/mach-imx/imx8/cpu.c @@ -1357,7 +1357,7 @@ static int get_owned_memreg(sc_rm_mr_t mr, sc_faddr_t *addr_start, sc_faddr_t *a phys_size_t get_effective_memsize(void) { sc_rm_mr_t mr; - sc_faddr_t start, end; + sc_faddr_t start, end, start_aligned; int err; if (IS_ENABLED(CONFIG_XEN)) @@ -1366,8 +1366,8 @@ phys_size_t get_effective_memsize(void) for (mr = 0; mr < 64; mr++) { err = get_owned_memreg(mr, &start, &end); if (!err) { - start = roundup(start, MEMSTART_ALIGNMENT); - if (start > end) /* Too small memory region, not use it */ + start_aligned = roundup(start, MEMSTART_ALIGNMENT); + if (start_aligned > end) /* Too small memory region, not use it */ continue; /* Find the memory region runs the u-boot */ |