aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2020-05-01 16:43:15 -0400
committerTom Rini <trini@konsulko.com>2020-05-01 16:43:15 -0400
commitc693f212c5b0433b3a49a89d87cbff28bf78eb87 (patch)
treefba202b549b53e536feb5d7b60e6313074d93a55 /common
parentb641dd3ec8dc3f6b18d2fa945ac3ab597063d191 (diff)
parent14b7004532a41cbb2dc82cc1a5687e8e88e1ba0d (diff)
Merge branch '2020-05-01-master-imports'
- Assorted bug fixes - Framework for enabling D-CACHE in SPL on ARM
Diffstat (limited to 'common')
-rw-r--r--common/board_r.c23
-rw-r--r--common/cli_hush.c3
-rw-r--r--common/dlmalloc.c41
-rw-r--r--common/image-fit-sig.c2
4 files changed, 41 insertions, 28 deletions
diff --git a/common/board_r.c b/common/board_r.c
index 0bbeaa7594..d9015cd057 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -518,15 +518,6 @@ static int initr_api(void)
}
#endif
-/* enable exceptions */
-#ifdef CONFIG_ARM
-static int initr_enable_interrupts(void)
-{
- enable_interrupts();
- return 0;
-}
-#endif
-
#ifdef CONFIG_CMD_NET
static int initr_ethaddr(void)
{
@@ -646,15 +637,6 @@ int initr_mem(void)
}
#endif
-#ifdef CONFIG_CMD_BEDBUG
-static int initr_bedbug(void)
-{
- bedbug_init();
-
- return 0;
-}
-#endif
-
static int run_main_loop(void)
{
#ifdef CONFIG_SANDBOX
@@ -813,9 +795,6 @@ static init_fnc_t init_sequence_r[] = {
initr_kgdb,
#endif
interrupt_init,
-#ifdef CONFIG_ARM
- initr_enable_interrupts,
-#endif
#if defined(CONFIG_MICROBLAZE) || defined(CONFIG_M68K)
timer_init, /* initialize timer */
#endif
@@ -860,7 +839,7 @@ static init_fnc_t init_sequence_r[] = {
#endif
#ifdef CONFIG_CMD_BEDBUG
INIT_FUNC_WATCHDOG_RESET
- initr_bedbug,
+ bedbug_init,
#endif
#if defined(CONFIG_PRAM)
initr_mem,
diff --git a/common/cli_hush.c b/common/cli_hush.c
index cf1e273485..a62af07cc5 100644
--- a/common/cli_hush.c
+++ b/common/cli_hush.c
@@ -1849,8 +1849,7 @@ static int run_list_real(struct pipe *pi)
continue;
} else {
/* insert new value from list for variable */
- if (pi->progs->argv[0])
- free(pi->progs->argv[0]);
+ free(pi->progs->argv[0]);
pi->progs->argv[0] = *list++;
#ifndef __U_BOOT__
pi->progs->glob_result.gl_pathv[0] =
diff --git a/common/dlmalloc.c b/common/dlmalloc.c
index db5ab55ed3..e8f07f14f9 100644
--- a/common/dlmalloc.c
+++ b/common/dlmalloc.c
@@ -280,6 +280,7 @@ nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Unused space (may be 0 bytes long) .
. .
. |
+
nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
`foot:' | Size of chunk, in bytes |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
@@ -574,6 +575,10 @@ static void malloc_bin_reloc(void)
static inline void malloc_bin_reloc(void) {}
#endif
+#ifdef CONFIG_SYS_MALLOC_DEFAULT_TO_INIT
+static void malloc_init(void);
+#endif
+
ulong mem_malloc_start = 0;
ulong mem_malloc_end = 0;
ulong mem_malloc_brk = 0;
@@ -604,6 +609,10 @@ void mem_malloc_init(ulong start, ulong size)
mem_malloc_end = start + size;
mem_malloc_brk = start;
+#ifdef CONFIG_SYS_MALLOC_DEFAULT_TO_INIT
+ malloc_init();
+#endif
+
debug("using memory %#lx-%#lx for malloc()\n", mem_malloc_start,
mem_malloc_end);
#ifdef CONFIG_SYS_MALLOC_CLEAR_ON_INIT
@@ -708,7 +717,36 @@ static unsigned int max_n_mmaps = 0;
static unsigned long max_mmapped_mem = 0;
#endif
+#ifdef CONFIG_SYS_MALLOC_DEFAULT_TO_INIT
+static void malloc_init(void)
+{
+ int i, j;
+
+ debug("bins (av_ array) are at %p\n", (void *)av_);
+
+ av_[0] = NULL; av_[1] = NULL;
+ for (i = 2, j = 2; i < NAV * 2 + 2; i += 2, j++) {
+ av_[i] = bin_at(j - 2);
+ av_[i + 1] = bin_at(j - 2);
+
+ /* Just print the first few bins so that
+ * we can see there are alright.
+ */
+ if (i < 10)
+ debug("av_[%d]=%lx av_[%d]=%lx\n",
+ i, (ulong)av_[i],
+ i + 1, (ulong)av_[i + 1]);
+ }
+ /* Init the static bookkeeping as well */
+ sbrk_base = (char *)(-1);
+ max_sbrked_mem = 0;
+ max_total_mem = 0;
+#ifdef DEBUG
+ memset((void *)&current_mallinfo, 0, sizeof(struct mallinfo));
+#endif
+}
+#endif
/*
Debugging support
@@ -1051,9 +1089,6 @@ static mchunkptr mremap_chunk(p, new_size) mchunkptr p; size_t new_size;
#endif /* HAVE_MMAP */
-
-
-
/*
Extend the top-most chunk by obtaining memory from system.
Main interface to sbrk (but see also malloc_trim).
diff --git a/common/image-fit-sig.c b/common/image-fit-sig.c
index 3e73578594..a3a0c61bcb 100644
--- a/common/image-fit-sig.c
+++ b/common/image-fit-sig.c
@@ -249,7 +249,7 @@ static int fit_config_check_sig(const void *fit, int noffset,
int required_keynode, int conf_noffset,
char **err_msgp)
{
- char * const exc_prop[] = {"data"};
+ char * const exc_prop[] = {"data", "data-size", "data-position"};
const char *prop, *end, *name;
struct image_sign_info info;
const uint32_t *strings;