[U-Boot] [PATCH 5/6] DLMALLOC:!X86: add av_ initialization

Peter Tyser
2009-09-19T17:30:55Z

On Sat, 2009-09-19 at 10:37 -0500, Nishanth Menon wrote:
> Peter Tyser said the following on 09/19/2009 09:03 AM:
> > On Fri, 2009-09-18 at 21:21 -0500, Nishanth Menon wrote:
> >
> >> This is questionable if this is really required
> >> as the av_ static initalized values should have
> >> been loaded to sdram as part of the boot process
> >> and initialization should have been done.
> >>
> >
> > Is there a reason you need to do this fixup? Based on your commit
> > message its unclear if this patch is really needed...
> >
> >
> Essentially, the loaded memory from the NOR looks all corrupted.
> I am unable to convince myself why the SDRAM is not updated
> with the static default inits - SDRAM corruption would have
> cracked everything else and scope measurement looks good too.
> >> Signed-off-by: Nishanth Menon <nm
> >> void mem_malloc_init(ulong start, ulong size)
> >> {
> >> + u8 i;
> >> + av_[0] = av_[1] = 0;
> >> + for (i = 0; i < 128; i++)
> >> + av_[2 + i * 2] = av_[2 + i * 2 + 1] = bin_at(i);
> >> +
> >> mem_malloc_start = start;
> >> mem_malloc_end = start + size;
> >> mem_malloc_brk = start;
> >>
> >
> > If you are going to do this fixup, av_ should not be initialized with
> > values (you're currently doing the same initialization 2 times). In
> > general, we could probably shave a bit off of U-Boot's size by leaving
> > av_ uninitialized and implementing your manual calculation of av_ above,
> >
> yep.. missed finishing that out.. :(
> > but I'm not sure why this change should be included in this patch
> > series.
> >
> This patch is need for booting SDP3430 from NOR flash.

Once the initialized values for av_ are removed, this patch would be
useful for everyone. It looks like it removes a few hundred bytes of
code size, so I'm all for it. I'd be a bit concerned about why your
board wasn't loading the initialized av_ table though. Seems like it
would be indicative of a larger problem...

So in any case, I like the patch because it reduces code size, but I
don't think the explanation or commit message of "for an unknown reason
it makes my board work" commit message is the best. Its affecting every
board, so at a minimum it should describe how it benefits them - eg
changing static initialization into dynamic initialization saves some
space.

That's my $.02, feel free to proceed as you see fit as I don't have any
real power here:)

Best,
Peter