diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2014-08-07 06:15:23 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2014-08-07 13:13:31 +0200 |
commit | 38c3b2455edea648f38d3e11baf478488fd698ed (patch) | |
tree | a66280a235dfd3fdb5c0411f4efc64b2b98aec0c /common | |
parent | 5b7b7ee5d943c6b58d9b7f974167d0105ca1b787 (diff) | |
parent | ca22ccd7cdbb6b2bd720dd7e14280ee1efa29074 (diff) | |
download | barebox-38c3b2455edea648f38d3e11baf478488fd698ed.tar.gz barebox-38c3b2455edea648f38d3e11baf478488fd698ed.tar.xz |
Merge branch 'for-next/misc'
Conflicts:
lib/Makefile
Diffstat (limited to 'common')
-rw-r--r-- | common/Kconfig | 19 | ||||
-rw-r--r-- | common/dlmalloc.c | 169 | ||||
-rw-r--r-- | common/hush.c | 2 | ||||
-rw-r--r-- | common/resource.c | 2 |
4 files changed, 21 insertions, 171 deletions
diff --git a/common/Kconfig b/common/Kconfig index d3f9801647..d3d9b884cf 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -25,6 +25,22 @@ config ENV_HANDLING select CRC32 bool +config HAS_CACHE + bool + help + This allows you do run "make ARCH=sandbox allyesconfig". + + Drivers that depend on a cache implementation can depend on this + config, so that you don't get a compilation error. + +config HAS_DMA + bool + help + This allows you do run "make ARCH=sandbox allyesconfig". + + Drivers that depend on a DMA implementation can depend on this + config, so that you don't get a compilation error. + config GENERIC_GPIO bool @@ -657,6 +673,7 @@ config BAREBOXENV_TARGET config BAREBOXCRC32_TARGET bool prompt "build bareboxcrc32 tool for target" + depends on !SANDBOX help 'bareboxcrc32' is a userspacetool to generate the crc32 checksums the same way barebox does. Say yes here to build it for the target. @@ -691,6 +708,7 @@ config COMPILE_LOGLEVEL 5 normal but significant condition (notice) 6 informational (info) 7 debug-level messages (debug) + 8 verbose debug messages (vdebug) config DEFAULT_LOGLEVEL int "default loglevel" @@ -707,6 +725,7 @@ config DEFAULT_LOGLEVEL 5 normal but significant condition (notice) 6 informational (info) 7 debug-level messages (debug) + 8 verbose debug messages (vdebug) config DEBUG_INFO bool diff --git a/common/dlmalloc.c b/common/dlmalloc.c index d831e90fe3..499ec93c28 100644 --- a/common/dlmalloc.c +++ b/common/dlmalloc.c @@ -1712,29 +1712,6 @@ void *memalign(size_t alignment, size_t bytes) return chunk2mem(p); } -#if 0 -/* - * valloc just invokes memalign with alignment argument equal - * to the page size of the system (or as near to this as can - * be figured out from all the includes/defines above.) - */ -void *valloc(size_t bytes) -{ - return memalign(malloc_getpagesize, bytes); -} -#endif - -/* - * pvalloc just invokes valloc for the nearest pagesize - * that will accommodate request - */ -void *pvalloc (size_t bytes) -{ - size_t pagesize = malloc_getpagesize; - - return memalign(pagesize, (bytes + pagesize - 1) & ~(pagesize - 1)); -} - /* * * calloc calls malloc, then zeroes out the allocated chunk. @@ -1774,115 +1751,6 @@ void *calloc(size_t n, size_t elem_size) } } -/* - * - * cfree just calls free. It is needed/defined on some systems - * that pair it with calloc, presumably for odd historical reasons. - */ -#if !defined(INTERNAL_LINUX_C_LIB) || !defined(__ELF__) -void cfree(void *mem) -{ - free(mem); -} -#endif - -/* - Malloc_trim gives memory back to the system (via negative - arguments to sbrk) if there is unused memory at the `high' end of - the malloc pool. You can call this after freeing large blocks of - memory to potentially reduce the system-level memory requirements - of a program. However, it cannot guarantee to reduce memory. Under - some allocation patterns, some large free blocks of memory will be - locked between two used chunks, so they cannot be given back to - the system. - - The `pad' argument to malloc_trim represents the amount of free - trailing space to leave untrimmed. If this argument is zero, - only the minimum amount of memory to maintain internal data - structures will be left (one page or less). Non-zero arguments - can be supplied to maintain enough trailing space to service - future expected allocations without having to re-obtain memory - from the system. - - Malloc_trim returns 1 if it actually released any memory, else 0. -*/ -#ifdef USE_MALLOC_TRIM -int malloc_trim(size_t pad) -{ - long top_size; /* Amount of top-most memory */ - long extra; /* Amount to release */ - char *current_brk; /* address returned by pre-check sbrk call */ - char *new_brk; /* address returned by negative sbrk call */ - - unsigned long pagesz = malloc_getpagesize; - - top_size = chunksize(top); - extra = ((top_size - pad - MINSIZE + (pagesz - 1)) / pagesz - - 1) * pagesz; - - if (extra < (long)pagesz) /* Not enough memory to release */ - return 0; - - else { - /* Test to make sure no one else called sbrk */ - current_brk = (char*)(sbrk(0)); - if (current_brk != (char*)(top) + top_size) - return 0; /* Apparently we don't own memory; must fail */ - - else { - new_brk = (char *) (sbrk(-extra)); - - if (new_brk == (char*)(NULL)) { /* sbrk failed? */ - /* Try to figure out what we have */ - current_brk = (char*)(sbrk (0)); - top_size = current_brk - (char*) top; - if (top_size >= (long)MINSIZE) { /* if not, we are very very dead! */ - sbrked_mem = current_brk - sbrk_base; - set_head(top, top_size | PREV_INUSE); - } - return 0; - } - - else { - /* Success. Adjust top accordingly. */ - set_head(top, (top_size - extra) | PREV_INUSE); - sbrked_mem -= extra; - return 1; - } - } - } -} -#endif - -/* - * malloc_usable_size: - * - * This routine tells you how many bytes you can actually use in an - * allocated chunk, which may be more than you requested (although - * often not). You can use this many bytes without worrying about - * overwriting other allocated objects. Not a particularly great - * programming practice, but still sometimes useful. - */ -size_t malloc_usable_size(void *mem) -{ - mchunkptr p; - - if (!mem) - return 0; - else { - p = mem2chunk(mem); - if (!chunk_is_mmapped(p)) { - if (!inuse(p)) - return 0; - return chunksize(p) - SIZE_SZ; - } - return chunksize(p) - 2 * SIZE_SZ; - } -} - - - - /* Utility to update current_mallinfo for malloc_stats and mallinfo() */ #ifdef CONFIG_CMD_MEMINFO @@ -1956,43 +1824,6 @@ void malloc_stats(void) #endif /* CONFIG_CMD_MEMINFO */ /* - mallopt: - - mallopt is the general SVID/XPG interface to tunable parameters. - The format is to provide a (parameter-number, parameter-value) pair. - mallopt then sets the corresponding parameter to the argument - value if it can (i.e., so long as the value is meaningful), - and returns 1 if successful else 0. - - See descriptions of tunable parameters above. -*/ -#ifndef __BAREBOX__ -int mallopt(int param_number, int value) -{ - switch (param_number) { - case M_TRIM_THRESHOLD: - trim_threshold = value; - return 1; - case M_TOP_PAD: - top_pad = value; - return 1; - case M_MMAP_THRESHOLD: - mmap_threshold = value; - return 1; - case M_MMAP_MAX: - if (value != 0) - return 0; - else - n_mmaps_max = value; - return 1; - - default: - return 0; - } -} -#endif - -/* History: diff --git a/common/hush.c b/common/hush.c index 09d9326c85..b23b3f6633 100644 --- a/common/hush.c +++ b/common/hush.c @@ -1725,7 +1725,7 @@ static int parse_stream_outer(struct p_context *ctx, struct in_str *inp, int fla b_free(&temp); } while (rcode != -1 && !(flag & FLAG_EXIT_FROM_LOOP)); /* loop on syntax errors, return on EOF */ - return (code != 0) ? 1 : 0; + return code; } static int parse_string_outer(struct p_context *ctx, const char *s, int flag) diff --git a/common/resource.c b/common/resource.c index 1ea2a7522a..fe4680e3bd 100644 --- a/common/resource.c +++ b/common/resource.c @@ -71,7 +71,7 @@ struct resource *__request_region(struct resource *parent, goto ok; if (start > r->end) continue; - pr_warn("%s: 0x%08llx:0x%08llx conflicts with 0x%08llx:0x%08llx\n", + debug("%s: 0x%08llx:0x%08llx conflicts with 0x%08llx:0x%08llx\n", __func__, (unsigned long long)start, (unsigned long long)end, |