mirror of
https://github.com/AsahiLinux/u-boot
synced 2025-03-14 05:46:58 +00:00
global_data: Reduce size of early-malloc vars
The early malloc region is normally quite small and is certainly less than 4GB, so use a 32-bit value for the limit and pointer. Update the comments for clarity while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
c283a2664e
commit
92aa3ec321
5 changed files with 10 additions and 10 deletions
|
@ -58,7 +58,7 @@ void arch_print_bdinfo(void)
|
|||
printf("Board Type = %ld\n", gd->board_type);
|
||||
#endif
|
||||
#if CONFIG_IS_ENABLED(SYS_MALLOC_F)
|
||||
printf("Early malloc usage: %lx / %x\n", gd->malloc_ptr,
|
||||
printf("Early malloc usage: %x / %x\n", gd->malloc_ptr,
|
||||
CONFIG_VAL(SYS_MALLOC_F_LEN));
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -192,7 +192,7 @@ static int initr_malloc(void)
|
|||
ulong start;
|
||||
|
||||
#if CONFIG_IS_ENABLED(SYS_MALLOC_F)
|
||||
debug("Pre-reloc malloc() used %#lx bytes (%ld KB)\n", gd->malloc_ptr,
|
||||
debug("Pre-reloc malloc() used %#x bytes (%d KB)\n", gd->malloc_ptr,
|
||||
gd->malloc_ptr / 1024);
|
||||
#endif
|
||||
/* The malloc area is immediately below the monitor copy in DRAM */
|
||||
|
|
|
@ -23,7 +23,7 @@ static void *alloc_simple(size_t bytes, int align)
|
|||
|
||||
addr = ALIGN(gd->malloc_base + gd->malloc_ptr, align);
|
||||
new_ptr = addr + bytes - gd->malloc_base;
|
||||
log_debug("size=%lx, ptr=%lx, limit=%lx: ", (ulong)bytes, new_ptr,
|
||||
log_debug("size=%lx, ptr=%lx, limit=%x: ", (ulong)bytes, new_ptr,
|
||||
gd->malloc_limit);
|
||||
if (new_ptr > gd->malloc_limit) {
|
||||
log_err("alloc space exhausted\n");
|
||||
|
@ -87,6 +87,6 @@ void free_simple(void *ptr)
|
|||
|
||||
void malloc_simple_info(void)
|
||||
{
|
||||
log_info("malloc_simple: %lx bytes used, %lx remain\n", gd->malloc_ptr,
|
||||
log_info("malloc_simple: %x bytes used, %x remain\n", gd->malloc_ptr,
|
||||
CONFIG_VAL(SYS_MALLOC_F_LEN) - gd->malloc_ptr);
|
||||
}
|
||||
|
|
|
@ -782,7 +782,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
|
|||
}
|
||||
if (CONFIG_IS_ENABLED(SYS_MALLOC_F) &&
|
||||
!IS_ENABLED(CONFIG_SPL_SYS_MALLOC_SIZE))
|
||||
debug("SPL malloc() used 0x%lx bytes (%ld KB)\n",
|
||||
debug("SPL malloc() used 0x%x bytes (%d KB)\n",
|
||||
gd_malloc_ptr(), gd_malloc_ptr() / 1024);
|
||||
|
||||
bootstage_mark_name(get_bootstage_id(false), "end phase");
|
||||
|
@ -901,7 +901,7 @@ ulong spl_relocate_stack_gd(void)
|
|||
|
||||
#if defined(CONFIG_SPL_SYS_MALLOC_SIMPLE) && CONFIG_IS_ENABLED(SYS_MALLOC_F)
|
||||
if (CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN) {
|
||||
debug("SPL malloc() before relocation used 0x%lx bytes (%ld KB)\n",
|
||||
debug("SPL malloc() before relocation used 0x%x bytes (%d KB)\n",
|
||||
gd->malloc_ptr, gd->malloc_ptr / 1024);
|
||||
ptr -= CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN;
|
||||
gd->malloc_base = ptr;
|
||||
|
|
|
@ -299,13 +299,13 @@ struct global_data {
|
|||
*/
|
||||
unsigned long malloc_base;
|
||||
/**
|
||||
* @malloc_limit: limit address of early malloc()
|
||||
* @malloc_limit: maximum size of early malloc()
|
||||
*/
|
||||
unsigned long malloc_limit;
|
||||
unsigned int malloc_limit;
|
||||
/**
|
||||
* @malloc_ptr: current address of early malloc()
|
||||
* @malloc_ptr: currently used bytes of early malloc()
|
||||
*/
|
||||
unsigned long malloc_ptr;
|
||||
unsigned int malloc_ptr;
|
||||
#endif
|
||||
#ifdef CONFIG_CONSOLE_RECORD
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue