Commit aabd7ddb889aec3c6c4139974f66a44e2ce46ba5
1 parent
c107c0c05c
Exists in
v2017.01-smarct4x
and in
30 other branches
common: Rewrite hiding the end of memory
As the name may be confusing, the CONFIG_SYS_MEM_TOP_HIDE reserves some memory from the end of ram, tracked by gd->ram_size. It is not always the top of u-boot visible memory. Rewrite the macro with a weak function to provide flexibility for complex calcuation. Legacy use of this macro is still supported. Signed-off-by: York Sun <yorksun@freescale.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Showing 2 changed files with 16 additions and 9 deletions Side-by-side Diff
README
... | ... | @@ -3877,7 +3877,7 @@ |
3877 | 3877 | the RAM base is not zero, or RAM is divided into banks, |
3878 | 3878 | this variable needs to be recalcuated to get the address. |
3879 | 3879 | |
3880 | -- CONFIG_SYS_MEM_TOP_HIDE (PPC only): | |
3880 | +- CONFIG_SYS_MEM_TOP_HIDE: | |
3881 | 3881 | If CONFIG_SYS_MEM_TOP_HIDE is defined in the board config header, |
3882 | 3882 | this specified memory area will get subtracted from the top |
3883 | 3883 | (end) of RAM and won't get "touched" at all by U-Boot. By |
common/board_f.c
... | ... | @@ -317,6 +317,15 @@ |
317 | 317 | return gd->ram_top; |
318 | 318 | } |
319 | 319 | |
320 | +__weak phys_size_t board_reserve_ram_top(phys_size_t ram_size) | |
321 | +{ | |
322 | +#ifdef CONFIG_SYS_MEM_TOP_HIDE | |
323 | + return ram_size - CONFIG_SYS_MEM_TOP_HIDE; | |
324 | +#else | |
325 | + return ram_size; | |
326 | +#endif | |
327 | +} | |
328 | + | |
320 | 329 | static int setup_dest_addr(void) |
321 | 330 | { |
322 | 331 | debug("Monitor len: %08lX\n", gd->mon_len); |
323 | 332 | |
324 | 333 | |
... | ... | @@ -333,19 +342,17 @@ |
333 | 342 | */ |
334 | 343 | gd->secure_ram = gd->ram_size; |
335 | 344 | #endif |
336 | -#if defined(CONFIG_SYS_MEM_TOP_HIDE) | |
337 | 345 | /* |
338 | 346 | * Subtract specified amount of memory to hide so that it won't |
339 | 347 | * get "touched" at all by U-Boot. By fixing up gd->ram_size |
340 | 348 | * the Linux kernel should now get passed the now "corrected" |
341 | - * memory size and won't touch it either. This should work | |
342 | - * for arch/ppc and arch/powerpc. Only Linux board ports in | |
343 | - * arch/powerpc with bootwrapper support, that recalculate the | |
344 | - * memory size from the SDRAM controller setup will have to | |
345 | - * get fixed. | |
349 | + * memory size and won't touch it either. This has been used | |
350 | + * by arch/powerpc exclusively. Now ARMv8 takes advantage of | |
351 | + * thie mechanism. If memory is split into banks, addresses | |
352 | + * need to be calculated. | |
346 | 353 | */ |
347 | - gd->ram_size -= CONFIG_SYS_MEM_TOP_HIDE; | |
348 | -#endif | |
354 | + gd->ram_size = board_reserve_ram_top(gd->ram_size); | |
355 | + | |
349 | 356 | #ifdef CONFIG_SYS_SDRAM_BASE |
350 | 357 | gd->ram_top = CONFIG_SYS_SDRAM_BASE; |
351 | 358 | #endif |
-
mentioned in commit 36cc0d
-
mentioned in commit 36cc0d
-
mentioned in commit 36cc0d
-
mentioned in commit 36cc0d
-
mentioned in commit 36cc0d
-
mentioned in commit 36cc0d
-
mentioned in commit 36cc0d
-
mentioned in commit 36cc0d
-
mentioned in commit 36cc0d
-
mentioned in commit 36cc0d
-
mentioned in commit 36cc0d
-
mentioned in commit 36cc0d
-
mentioned in commit 36cc0d
-
mentioned in commit 36cc0d
-
mentioned in commit 36cc0d
-
mentioned in commit 36cc0d
-
mentioned in commit 36cc0d
-
mentioned in commit 36cc0d
-
mentioned in commit 36cc0d
-
mentioned in commit 36cc0d