Commit fb5cf7f16be725aec7ab0016268b3b4e26460bee

Authored by Simon Glass
1 parent 0879361fd3

Move initf_malloc() to a common place

To allow this function to be used from SPL, move it to the malloc()
code.

Signed-off-by: Simon Glass <sjg@chromium.org>

Showing 3 changed files with 15 additions and 11 deletions Side-by-side Diff

... ... @@ -23,6 +23,7 @@
23 23 #include <i2c.h>
24 24 #include <initcall.h>
25 25 #include <logbuff.h>
  26 +#include <malloc.h>
26 27 #include <mapmem.h>
27 28  
28 29 /* TODO: Can we move these into arch/ headers? */
... ... @@ -717,17 +718,6 @@
717 718 static int mark_bootstage(void)
718 719 {
719 720 bootstage_mark_name(BOOTSTAGE_ID_START_UBOOT_F, "board_init_f");
720   -
721   - return 0;
722   -}
723   -
724   -static int initf_malloc(void)
725   -{
726   -#ifdef CONFIG_SYS_MALLOC_F_LEN
727   - assert(gd->malloc_base); /* Set up by crt0.S */
728   - gd->malloc_limit = gd->malloc_base + CONFIG_SYS_MALLOC_F_LEN;
729   - gd->malloc_ptr = 0;
730   -#endif
731 721  
732 722 return 0;
733 723 }
... ... @@ -3261,6 +3261,17 @@
3261 3261 }
3262 3262 }
3263 3263  
  3264 +int initf_malloc(void)
  3265 +{
  3266 +#ifdef CONFIG_SYS_MALLOC_F_LEN
  3267 + assert(gd->malloc_base); /* Set up by crt0.S */
  3268 + gd->malloc_limit = CONFIG_SYS_MALLOC_F_LEN;
  3269 + gd->malloc_ptr = 0;
  3270 +#endif
  3271 +
  3272 + return 0;
  3273 +}
  3274 +
3264 3275 /*
3265 3276  
3266 3277 History:
... ... @@ -906,6 +906,9 @@
906 906  
907 907 #endif
908 908  
  909 +/* Set up pre-relocation malloc() ready for use */
  910 +int initf_malloc(void);
  911 +
909 912 /* Public routines */
910 913  
911 914 /* Simple versions which can be used when space is tight */