u-boot/common
Marek Bykowski 9297e366d6 malloc: dlmalloc: add an ability for the malloc to be re-init/init multiple times
Malloc gets initialized with a call to mem_malloc_init() with the address
the allocation starts to and its size. Currently it is not possible to
move the malloc from one memory area to another as the malloc would eventually
fail.

This patch adds in the ability to re-init the malloc with the updated
start address and the size.

One of the use cases of this feature is SPL U-Boot running from within
the static memory and calling to malloc init from within board_init_f():

	arch/arm/cpu/armv8/start.S:reset vector
	arch/arm/cpu/armv8/start.S:main()
	arch/arm/lib/crt0_64.S:board_init_f()
	board/<my_board>/common/spl.c:board_init_f()
        board/<my_board>/common/spl.c:mem_malloc_init((ulong)CONFIG_SYS_SPL_MALLOC_START,
                        CONFIG_SYS_SPL_MALLOC_SIZE);

Shortly after the DDR (main) memory is init and ready we call to malloc init
again but this time with the start address in the DDR memory and a much greater
size for moving the allocation off the static to the DDR memory:

	board/<my_board>/common/spl.c:mem_malloc_init((ulong)CONFIG_SPL_MALLOC_OFFSET,
			CONFIG_SPL_MALLOC_SIZE);

Where CONFIG_SYS_SPL_MALLOC_START and CONFIG_SPL_MALLOC_OFFSET are the start
addresses of the malloc in the static and DDR memories respectively and
CONFIG_SYS_SPL_MALLOC_SIZE=SZ_16K and CONFIG_SPL_MALLOC_SIZE=SZ_2M are
the sizes of the mallocs in these memories. Note, now we have a much greater
memory, enlarging from 16K to 2M, available for allocation.

There is an alternative approach already existing in U-Boot with the use of
an early (simplified) malloc and the proper (dlamalloc) malloc however
necessitating managing the two mallocs whereas this approach proposes using
a single dlmalloc.

Signed-off-by: Marek Bykowski <marek.bykowski@gmail.com>
2020-05-01 11:34:01 -04:00
..
eeprom SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
init board_init: remove meaningless increment in board_init_f_init_reserve() 2020-01-23 07:29:58 -05:00
spl spl: spl_legacy: Add lzma decompression support for legacy image 2020-04-27 20:29:33 +02:00
android_ab.c dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
autoboot.c dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
avb_verify.c common: Move ARM cache operations out of common.h 2019-12-02 18:24:58 -05:00
bedbug.c Consolidate bool type 2013-04-01 16:33:52 -04:00
bloblist.c bloblist: Zero records when adding 2020-02-05 19:33:46 -07:00
board_f.c common/board_f: Make reserve_mmu generic 2020-04-24 15:17:14 -04:00
board_info.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
board_r.c common: fix regression on block cache init 2020-01-26 13:36:14 -05:00
boot_fit.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
bootm_os.c bootm: Add a bootm command for type IH_OS_EFI 2020-01-07 18:08:21 +01:00
bootm.c image: Load the correct configuration in fit_check_sign 2020-04-01 07:45:09 -06:00
bootretry.c common: Move get_ticks() function out of common.h 2019-12-02 18:23:13 -05:00
bootstage.c common: Move hang() to the same header as panic() 2020-01-24 23:06:49 +05:30
bouncebuf.c common: bouncebuf: Permit passing custom alignment check function 2020-04-22 20:41:56 +08:00
cli_hush.c hush: avoid NULL check before free() 2020-05-01 11:34:01 -04:00
cli_readline.c common: Move get_ticks() function out of common.h 2019-12-02 18:23:13 -05:00
cli_simple.c common: Move command functions out of common.h 2019-12-02 18:25:02 -05:00
cli.c cli: Make the sandbox board_run_command the default 2020-02-05 19:33:46 -07:00
command.c common: Move and rename CONFIG_SYS_SUPPORT_64BIT_DATA 2020-01-24 23:06:49 +05:30
common_fit.c common: Compile error with CONFIG_MULTI_DTB_FIT and not SPL 2018-11-09 10:44:50 -05:00
console.c common/console.c: discard volatile 2020-02-13 10:10:50 -05:00
cros_ec.c sandbox: cros_ec: exynos: Drop use of cros_ec_get_error() 2018-11-20 19:14:22 -07:00
ddr_spd.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
dfu.c dfu: Add optional timeout parameter 2020-01-07 14:37:50 +01:00
dlmalloc.c malloc: dlmalloc: add an ability for the malloc to be re-init/init multiple times 2020-05-01 11:34:01 -04:00
dlmalloc.src Consolidate bool type 2013-04-01 16:33:52 -04:00
edid.c edid: fix edid_get_timing_validate() mode_valid lookup 2019-07-29 19:14:58 +02:00
exports.c exports: Add the malloc.h header 2020-02-05 19:33:46 -07:00
fdt_region.c libfdt: split fdt_region declarations out to <fdt_region.h> 2020-04-26 14:24:08 -06:00
fdt_support.c common: fdt_support: add support for setting usable memory 2019-12-06 12:09:25 +01:00
flash.c common: Move flash_perror() to flash.h 2020-01-24 23:06:47 +05:30
hash.c crc32: Use the crc.h header for crc functions 2019-12-02 18:23:08 -05:00
hwconfig.c env: Move env_set() to env.h 2019-08-11 16:43:41 -04:00
image-android-dt.c common: image-android-dt: Fix logic in print fdt info routine 2019-08-07 15:31:05 -04:00
image-android.c image: android: Add routine to get dtbo params 2020-02-04 09:07:24 +05:30
image-cipher.c image: Use constants for 'required' and 'key-name-hint' 2020-04-01 07:45:09 -06:00
image-fdt.c dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
image-fit-sig.c rsa: sig: fix config signature check for fit with padding 2020-05-01 11:34:01 -04:00
image-fit.c Xilinx changes for v2020.07 2020-04-07 17:13:35 -04:00
image-sig.c image: Use constants for 'required' and 'key-name-hint' 2020-04-01 07:45:09 -06:00
image.c image: Add a common compression type detection function. 2020-04-17 12:32:36 -04:00
iomux.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
iotrace.c common: Move get_ticks() function out of common.h 2019-12-02 18:23:13 -05:00
kallsyms.c
Kconfig common: image_sign_info helper functions in SPL 2020-04-24 10:51:32 -04:00
kgdb_stubs.c common: Move some cache and MMU functions out of common.h 2019-12-02 18:23:55 -05:00
kgdb.c Fix spelling of "occurred". 2016-05-02 18:37:09 -04:00
lcd_console_rotation.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
lcd_console.c common: Move serial functions out of common.h 2019-12-02 18:23:11 -05:00
lcd_simplefb.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
lcd.c common: Move ARM cache operations out of common.h 2019-12-02 18:24:58 -05:00
log_console.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
log_syslog.c log: syslog driver 2020-04-16 08:07:58 -06:00
log.c log: remove useless cast 2020-04-26 14:25:21 -06:00
lynxkdi.c Remove unnecessary instances of DECLARE_GLOBAL_DATA_PTR 2018-04-27 14:54:48 -04:00
main.c main: Drop show_boot_progress() prototype 2020-04-10 21:21:06 -04:00
Makefile fdt_region: move fdt_region.c to common/ from lib/libfdt/ 2020-04-26 14:23:55 -06:00
malloc_simple.c malloc_simple: Add logging of allocations 2018-11-29 09:30:05 -07:00
memsize.c common: Move RAM-sizing functions to init.h 2020-01-24 23:06:49 +05:30
menu.c menu: don't bother going interactive with just one menu item 2019-07-24 13:16:29 -04:00
miiphyutil.c miiphy: Add function to retrieve MDIO bus list head 2018-10-24 14:45:36 -05:00
s_record.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
splash_source.c common: Move command functions out of common.h 2019-12-02 18:25:02 -05:00
splash.c splash: fix build breakage with newer llvm-7 2019-10-31 09:10:34 +01:00
stdio.c splash: display splash in DM_VIDEO configurations 2019-06-04 23:20:43 +02:00
system_map.c
update.c common: Move the image globals into image.h 2020-01-24 23:06:49 +05:30
usb_hub.c dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
usb_kbd.c usb: kbd: move USB_KBD_BOOT_REPORT_SIZE to usb.h 2019-11-25 13:28:53 +01:00
usb_storage.c usb: Keep async schedule running only across mass storage xfers 2020-04-09 15:26:59 -04:00
usb.c usb: Keep async schedule running only across mass storage xfers 2020-04-09 15:26:59 -04:00
xyzModem.c spl: Allow tiny printf() to be controlled in SPL and TPL 2019-10-08 13:57:45 +08:00