Re: [U-Boot] [PATCH v8] [RFC] early_malloc for DM added.

2012-09-26 Thread Graeme Russ
Hi Tomas, On Wed, Sep 26, 2012 at 8:16 PM, Tomas Hlavacek wrote: > Hello Graeme, > > On Wed, Sep 26, 2012 at 1:04 AM, Graeme Russ wrote: >> Hi Tomas >> >> On Tue, Sep 25, 2012 at 7:09 PM, Graeme Russ wrote: >> >>> We should implement each of malloc(), free(), calloc(), and realloc(). >>> >>> Do

Re: [U-Boot] [PATCH v8] [RFC] early_malloc for DM added.

2012-09-26 Thread Tomas Hlavacek
Hello Graeme, On Wed, Sep 26, 2012 at 1:04 AM, Graeme Russ wrote: > Hi Tomas > > On Tue, Sep 25, 2012 at 7:09 PM, Graeme Russ wrote: > >> We should implement each of malloc(), free(), calloc(), and realloc(). >> >> Don't worry about reclaiming and reusing space with a proper free() >> implementa

Re: [U-Boot] [PATCH v8] [RFC] early_malloc for DM added.

2012-09-25 Thread Graeme Russ
Hi Tomas On Tue, Sep 25, 2012 at 7:09 PM, Graeme Russ wrote: > We should implement each of malloc(), free(), calloc(), and realloc(). > > Don't worry about reclaiming and reusing space with a proper free() > implementation. Remember, all memory allocated on the early heap must be > relocated any

Re: [U-Boot] [PATCH v8] [RFC] early_malloc for DM added.

2012-09-25 Thread Graeme Russ
Hi Thomas, On Sep 25, 2012 6:43 PM, "Tomas Hlavacek" wrote: > > Hello Graeme! > > On Tue, Sep 25, 2012 at 2:37 AM, Graeme Russ wrote: > > Hi Marek, > > [...] > > > The last two are NOPs for early heap as we have no way to track free'd blocks > > > > Keep in mind that 'real' realloc() has access

Re: [U-Boot] [PATCH v8] [RFC] early_malloc for DM added.

2012-09-25 Thread Tomas Hlavacek
Hello Graeme! On Tue, Sep 25, 2012 at 2:37 AM, Graeme Russ wrote: > Hi Marek, [...] > The last two are NOPs for early heap as we have no way to track free'd blocks > > Keep in mind that 'real' realloc() has access to information providing > the size of the source block of allocated memory, so i

Re: [U-Boot] [PATCH v8] [RFC] early_malloc for DM added.

2012-09-24 Thread Graeme Russ
Hi Marek, On Tue, Sep 25, 2012 at 12:19 AM, Marek Vasut wrote: > Dear Tomas Hlavacek, > > [...] > >> >> +static inline void *dmrealloc(void *oldmem, size_t bytes) >> >> +{ >> >> +#ifdef CONFIG_SYS_EARLY_MALLOC >> >> + if (early_malloc_active()) >> >> + return NULL; >> > >> > I won

Re: [U-Boot] [PATCH v8] [RFC] early_malloc for DM added.

2012-09-24 Thread Tom Rini
On Sun, Sep 23, 2012 at 06:47:34PM +0200, Tomas Hlavacek wrote: > Dear Wolfgang Denk, > > On Sun, Sep 23, 2012 at 6:32 PM, Wolfgang Denk wrote: > >> > >> Changelog since v7: > >> dmcalloc() implmentation added. > >> Comments added to header. > > > > Your change log does not make much sense to me.

Re: [U-Boot] [PATCH v8] [RFC] early_malloc for DM added.

2012-09-24 Thread Marek Vasut
Dear Tomas Hlavacek, [...] > >> +static inline void *dmrealloc(void *oldmem, size_t bytes) > >> +{ > >> +#ifdef CONFIG_SYS_EARLY_MALLOC > >> + if (early_malloc_active()) > >> + return NULL; > > > > I wonder how should this be implemented ... maybe early_malloc + standard > > memc

Re: [U-Boot] [PATCH v8] [RFC] early_malloc for DM added.

2012-09-24 Thread Tomas Hlavacek
Hello Marek, On Mon, Sep 24, 2012 at 1:11 AM, Marek Vasut wrote: > Dear Tomas Hlavacek, > > [..] >> + >> + if (early_malloc_active()) { >> + addr = early_malloc(size); >> + for (i=0; i> + addr[i] = 0; > > memset() ? Yes, sure. Thanks. > >> + >> +

Re: [U-Boot] [PATCH v8] [RFC] early_malloc for DM added.

2012-09-23 Thread Graeme Russ
Hi Thomas, On Mon, Sep 24, 2012 at 10:35 AM, Tomas Hlavacek wrote: > Hi Graeme! > > On Mon, Sep 24, 2012 at 2:00 AM, Graeme Russ wrote: >> Hi Tomas, >> >> On Mon, Sep 24, 2012 at 2:15 AM, Tomas Hlavacek wrote: >>> early_malloc for DM with support for more heaps and lightweight >>> first heap in

Re: [U-Boot] [PATCH v8] [RFC] early_malloc for DM added.

2012-09-23 Thread Tomas Hlavacek
Hi Graeme! On Mon, Sep 24, 2012 at 2:00 AM, Graeme Russ wrote: > Hi Tomas, > > On Mon, Sep 24, 2012 at 2:15 AM, Tomas Hlavacek wrote: >> early_malloc for DM with support for more heaps and lightweight >> first heap in the same memory as an early stack. >> >> Adaptation layer for seamless calling

Re: [U-Boot] [PATCH v8] [RFC] early_malloc for DM added.

2012-09-23 Thread Graeme Russ
Hi Tomas, On Mon, Sep 24, 2012 at 2:15 AM, Tomas Hlavacek wrote: > early_malloc for DM with support for more heaps and lightweight > first heap in the same memory as an early stack. > > Adaptation layer for seamless calling of early_malloc or dlmalloc from > DM based on init stage added (dmmalloc

Re: [U-Boot] [PATCH v8] [RFC] early_malloc for DM added.

2012-09-23 Thread Marek Vasut
Dear Tomas Hlavacek, [..] > + > + if (early_malloc_active()) { > + addr = early_malloc(size); > + for (i=0; i + addr[i] = 0; memset() ? > + > + return addr; > + } > +#endif /* CONFIG_SYS_EARLY_MALLOC */ > + return calloc(n, elem

Re: [U-Boot] [PATCH v8] [RFC] early_malloc for DM added.

2012-09-23 Thread Tomas Hlavacek
Dear Wolfgang Denk, On Sun, Sep 23, 2012 at 6:32 PM, Wolfgang Denk wrote: >> >> Changelog since v7: >> dmcalloc() implmentation added. >> Comments added to header. > > Your change log does not make much sense to me. It appears there has > been some dmcalloc() implementation already in v5 (and ee

Re: [U-Boot] [PATCH v8] [RFC] early_malloc for DM added.

2012-09-23 Thread Wolfgang Denk
Dear Tomas Hlavacek, In message <1348416940-20319-1-git-send-email-tmshl...@gmail.com> you wrote: > early_malloc for DM with support for more heaps and lightweight > first heap in the same memory as an early stack. > > Adaptation layer for seamless calling of early_malloc or dlmalloc from > DM ba

[U-Boot] [PATCH v8] [RFC] early_malloc for DM added.

2012-09-23 Thread Tomas Hlavacek
early_malloc for DM with support for more heaps and lightweight first heap in the same memory as an early stack. Adaptation layer for seamless calling of early_malloc or dlmalloc from DM based on init stage added (dmmalloc() and related functions). Signed-off-by: Tomas Hlavacek --- Changelog sin