Commit c3624e6ed0a36f54aa0b3e7f32d30a6fde434f51
Committed by
Gerald Van Baren
1 parent
590d3cacb9
Exists in
master
and in
54 other branches
Default to bootm_size() when CONFIG_SYS_BOOTMAPSZ is not defined
This patch adds a function getenv_bootm_mapsize() for obtaining the size of the early mapped region accessible by the kernel during early boot. It defaults to CONFIG_SYS_BOOTMAPSZ, or if not defined, defaults to getenv_bootm_size(), which in turn defaults to the size of RAM. getenv_bootm_mapsize() can also be overridden with a "bootm_mapsize" environmental variable. Signed-off-by: Grant Likely <grant.likely@linaro.org>
Showing 4 changed files with 35 additions and 6 deletions Side-by-side Diff
README
... | ... | @@ -2348,7 +2348,10 @@ |
2348 | 2348 | used) must be put below this limit, unless "bootm_low" |
2349 | 2349 | enviroment variable is defined and non-zero. In such case |
2350 | 2350 | all data for the Linux kernel must be between "bootm_low" |
2351 | - and "bootm_low" + CONFIG_SYS_BOOTMAPSZ. | |
2351 | + and "bootm_low" + CONFIG_SYS_BOOTMAPSZ. The environment | |
2352 | + variable "bootm_mapsize" will override the value of | |
2353 | + CONFIG_SYS_BOOTMAPSZ. If CONFIG_SYS_BOOTMAPSZ is undefined, | |
2354 | + then the value in "bootm_size" will be used instead. | |
2352 | 2355 | |
2353 | 2356 | - CONFIG_SYS_BOOT_RAMDISK_HIGH: |
2354 | 2357 | Enable initrd_high functionality. If defined then the |
... | ... | @@ -3184,7 +3187,16 @@ |
3184 | 3187 | for use by the bootm command. See also "bootm_size" |
3185 | 3188 | environment variable. Address defined by "bootm_low" is |
3186 | 3189 | also the base of the initial memory mapping for the Linux |
3187 | - kernel -- see the description of CONFIG_SYS_BOOTMAPSZ. | |
3190 | + kernel -- see the description of CONFIG_SYS_BOOTMAPSZ and | |
3191 | + bootm_mapsize. | |
3192 | + | |
3193 | + bootm_mapsize - Size of the initial memory mapping for the Linux kernel. | |
3194 | + This variable is given as a hexadecimal number and it | |
3195 | + defines the size of the memory region starting at base | |
3196 | + address bootm_low that is accessible by the Linux kernel | |
3197 | + during early boot. If unset, CONFIG_SYS_BOOTMAPSZ is used | |
3198 | + as the default value if it is defined, and bootm_size is | |
3199 | + used otherwise. | |
3188 | 3200 | |
3189 | 3201 | bootm_size - Memory range available for image processing in the bootm |
3190 | 3202 | command can be restricted. This variable is given as |
arch/powerpc/lib/bootm.c
common/image.c
... | ... | @@ -454,6 +454,22 @@ |
454 | 454 | #endif |
455 | 455 | } |
456 | 456 | |
457 | +phys_size_t getenv_bootm_mapsize(void) | |
458 | +{ | |
459 | + phys_size_t tmp; | |
460 | + char *s = getenv ("bootm_mapsize"); | |
461 | + if (s) { | |
462 | + tmp = (phys_size_t)simple_strtoull (s, NULL, 16); | |
463 | + return tmp; | |
464 | + } | |
465 | + | |
466 | +#if defined(CONFIG_SYS_BOOTMAPSZ) | |
467 | + return CONFIG_SYS_BOOTMAPSZ; | |
468 | +#else | |
469 | + return getenv_bootm_size(); | |
470 | +#endif | |
471 | +} | |
472 | + | |
457 | 473 | void memmove_wd (void *to, void *from, size_t len, ulong chunksz) |
458 | 474 | { |
459 | 475 | if (to == from) |
... | ... | @@ -1207,7 +1223,7 @@ |
1207 | 1223 | /* Pad the FDT by a specified amount */ |
1208 | 1224 | of_len = *of_size + CONFIG_SYS_FDT_PAD; |
1209 | 1225 | of_start = (void *)(unsigned long)lmb_alloc_base(lmb, of_len, 0x1000, |
1210 | - CONFIG_SYS_BOOTMAPSZ + getenv_bootm_low()); | |
1226 | + getenv_bootm_mapsize() + getenv_bootm_low()); | |
1211 | 1227 | |
1212 | 1228 | if (of_start == 0) { |
1213 | 1229 | puts("device tree - allocation error\n"); |
... | ... | @@ -1581,7 +1597,7 @@ |
1581 | 1597 | char *s; |
1582 | 1598 | |
1583 | 1599 | cmdline = (char *)(ulong)lmb_alloc_base(lmb, CONFIG_SYS_BARGSIZE, 0xf, |
1584 | - CONFIG_SYS_BOOTMAPSZ + getenv_bootm_low()); | |
1600 | + getenv_bootm_mapsize() + getenv_bootm_low()); | |
1585 | 1601 | |
1586 | 1602 | if (cmdline == NULL) |
1587 | 1603 | return -1; |
... | ... | @@ -1617,7 +1633,7 @@ |
1617 | 1633 | int boot_get_kbd (struct lmb *lmb, bd_t **kbd) |
1618 | 1634 | { |
1619 | 1635 | *kbd = (bd_t *)(ulong)lmb_alloc_base(lmb, sizeof(bd_t), 0xf, |
1620 | - CONFIG_SYS_BOOTMAPSZ + getenv_bootm_low()); | |
1636 | + getenv_bootm_mapsize() + getenv_bootm_low()); | |
1621 | 1637 | if (*kbd == NULL) |
1622 | 1638 | return -1; |
1623 | 1639 |
include/image.h