[U-Boot] [PATCH] memsize: get correct memory size

Wolfgang Denk wd at denx.de
Tue Nov 24 23:08:17 CET 2009


Dear Minkyu Kang,

In message <1f3430fb0911232040k19ca1362r23664ec62ab8d158 at mail.gmail.com> you wrote:
> 
> > Well, could you please explain what "some cases" are, and how exactly
> > the code is failing for you? And especially, what "80M" has to do with
> > it?
> 
> If memory size is 80M, cnt is decrease 0xa00000 -> 0x500000 ->
> 0x280000 ... 0xa -> 0x5 -> 0x2 -> 0x1 when first for loop (line 49 to
> 55).

But size of a memory bank cannot be 80 MB. It must always be a power
of 2.

> > I guess you are aware that the code silently assumes that the size of
> > any memory bank is always a power of two, aren't you? So a size of
> > "80M" does not make any sense to me. If you have such a memory
> > configuration, it is most probably assembled from two separate memory
> > banks (64 + 16 MB), which of course need to be sized independently.
> 
> No, we use 1Gb OneDRAM,
> 80M is used by AP, 32M is used by CP and 16M is shared area.
> As you mentioned,  size of memory bank is always a power of two,
> but, size of "available" memory is not always a power of two.

This doe snot make any sense to me. It seems you are misunderstanding
or misinterpreting the purpose of this code.

The purpose is to give it the maximum possible size  of  memory  that
may  be populated in one bank of memory, and test how much of this is
actually there. Say you have a board where one bank of memory can  be
populated  with  256  MB, 512 MB or 1024 MB of RAM, then you will run
the test with a max size of 1024 MB and  find  out  which  of  the  3
versions  you  have  - and if there are eventually any (gross) memory
errors.

I have no idea what you mean by "available memory", nor why you think
you could use this function to test it.

> > Frankly, I don't understand which problem you're trying to fix, nor
> > what your fix is supposed to be, nor your changes.
> 
> My patch is fixing wrong address comparison.

This is caused by the fact that you misuse the code under  conditions
was not designed for. With a 80 MB region of memory, the whole theory
it's function is based on does not apply. You want to use some
different memory test, then (which one I don;t know, as I still fail
to understand why you would want to "auto-size" 80 MB out of 1 GB of
memory. This makes absolutely no sense to me.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
backups: always in season, never out of style.


More information about the U-Boot mailing list