]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
This patch adds a function getenv_bootm_mapsize() for obtaining the
authorGrant Likely <grant.likely at linaro.org>
Fri, 13 Jul 2012 08:22:25 +0000 (13:52 +0530)
committerJagan <jaganna@xilinx.com>
Fri, 13 Jul 2012 08:22:25 +0000 (13:52 +0530)
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 at linaro.org>
README
arch/powerpc/lib/bootm.c
common/image.c
include/image.h

diff --git a/README b/README
index 21cd71b297854b36c8777d644b8790aa14a9be4b..b8c1833d786444e89b4b5ecec74ee9d1a5f0e485 100644 (file)
--- a/README
+++ b/README
@@ -2311,7 +2311,10 @@ Configuration Settings:
                used) must be put below this limit, unless "bootm_low"
                enviroment variable is defined and non-zero. In such case
                all data for the Linux kernel must be between "bootm_low"
-               and "bootm_low" + CONFIG_SYS_BOOTMAPSZ.
+               and "bootm_low" + CONFIG_SYS_BOOTMAPSZ.  The environment
+               variable "bootm_mapsize" will override the value of
+               CONFIG_SYS_BOOTMAPSZ.  If CONFIG_SYS_BOOTMAPSZ is undefined,
+               then the value in "bootm_size" will be used instead.
 
 - CONFIG_SYS_BOOT_RAMDISK_HIGH:
                Enable initrd_high functionality.  If defined then the
@@ -3147,7 +3150,16 @@ List of environment variables (most likely not complete):
                  for use by the bootm command. See also "bootm_size"
                  environment variable. Address defined by "bootm_low" is
                  also the base of the initial memory mapping for the Linux
-                 kernel -- see the description of CONFIG_SYS_BOOTMAPSZ.
+                 kernel -- see the description of CONFIG_SYS_BOOTMAPSZ and
+                 bootm_mapsize.
+
+  bootm_mapsize        - Size of the initial memory mapping for the Linux kernel.
+                 This variable is given as a hexadecimal number and it
+                 defines the size of the memory region starting at base
+                 address bootm_low that is accessible by the Linux kernel
+                 during early boot.  If unset, CONFIG_SYS_BOOTMAPSZ is used
+                 as the default value if it is defined, and bootm_size is
+                 used otherwise.
 
   bootm_size   - Memory range available for image processing in the bootm
                  command can be restricted. This variable is given as
index 11a574ab8bccbcdaa48b969e698c585e2034cc81..1ee4f794fbe0675e0d3af9a6b88f0c1b8244de0d 100644 (file)
@@ -95,7 +95,7 @@ static void boot_jump_linux(bootm_headers_t *images)
                debug ("   Booting using OF flat tree...\n");
                WATCHDOG_RESET ();
                (*kernel) ((bd_t *)of_flat_tree, 0, 0, EPAPR_MAGIC,
-                          CONFIG_SYS_BOOTMAPSZ, 0, 0);
+                          getenv_bootm_mapsize(), 0, 0);
                /* does not return */
        } else
 #endif
index c86b86fbe70f4316d95e0c5e74dff31b9ce7f527..a6247d8bb2c575560ca6de1c6810be13aabac203 100644 (file)
@@ -454,6 +454,22 @@ phys_size_t getenv_bootm_size(void)
 #endif
 }
 
+phys_size_t getenv_bootm_mapsize(void)
+{
+       phys_size_t tmp;
+       char *s = getenv ("bootm_mapsize");
+       if (s) {
+               tmp = (phys_size_t)simple_strtoull (s, NULL, 16);
+               return tmp;
+       }
+
+#if defined(CONFIG_SYS_BOOTMAPSZ)
+       return CONFIG_SYS_BOOTMAPSZ;
+#else
+       return getenv_bootm_size();
+#endif
+}
+
 void memmove_wd (void *to, void *from, size_t len, ulong chunksz)
 {
        if (to == from)
@@ -1207,7 +1223,7 @@ int boot_relocate_fdt (struct lmb *lmb, char **of_flat_tree, ulong *of_size)
        /* Pad the FDT by a specified amount */
        of_len = *of_size + CONFIG_SYS_FDT_PAD;
        of_start = (void *)(unsigned long)lmb_alloc_base(lmb, of_len, 0x1000,
-                       CONFIG_SYS_BOOTMAPSZ + getenv_bootm_low());
+                       getenv_bootm_mapsize() + getenv_bootm_low());
 
        if (of_start == 0) {
                puts("device tree - allocation error\n");
@@ -1581,7 +1597,7 @@ int boot_get_cmdline (struct lmb *lmb, ulong *cmd_start, ulong *cmd_end)
        char *s;
 
        cmdline = (char *)(ulong)lmb_alloc_base(lmb, CONFIG_SYS_BARGSIZE, 0xf,
-                                    CONFIG_SYS_BOOTMAPSZ + getenv_bootm_low());
+                               getenv_bootm_mapsize() + getenv_bootm_base());
 
        if (cmdline == NULL)
                return -1;
@@ -1617,7 +1633,7 @@ int boot_get_cmdline (struct lmb *lmb, ulong *cmd_start, ulong *cmd_end)
 int boot_get_kbd (struct lmb *lmb, bd_t **kbd)
 {
        *kbd = (bd_t *)(ulong)lmb_alloc_base(lmb, sizeof(bd_t), 0xf,
-                                    CONFIG_SYS_BOOTMAPSZ + getenv_bootm_low());
+                               getenv_bootm_mapsize() + getenv_bootm_low());
        if (*kbd == NULL)
                return -1;
 
index aa1d7df3ae8507d2d65631de9dc2a46d5245c513..b77cb7912a8812b142b2040bad5369a774de128d 100644 (file)
@@ -451,6 +451,7 @@ int image_check_dcrc (const image_header_t *hdr);
 int getenv_yesno (char *var);
 ulong getenv_bootm_low(void);
 phys_size_t getenv_bootm_size(void);
+phys_size_t getenv_bootm_mapsize(void);
 void memmove_wd (void *to, void *from, size_t len, ulong chunksz);
 #endif