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

Minkyu Kang promsoft at gmail.com
Tue Nov 24 05:40:48 CET 2009


Dear Wolfgang,

2009/11/24 Wolfgang Denk <wd at denx.de>:
> Dear Minkyu Kang,
>
> In message <1f3430fb0911222304pa45554epc7e46c49a9cc70f7 at mail.gmail.com> you wrote:
>>
>> > In some case, saved address and compared address are different. (e.g: 80M)
>> > So, it can be get wrong memory size.
>
> 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).
So, save[2] is ~0x5.
And second for loop(line 77 to 91), cnt is increase 0x1 -> 0x2 -> 0x4
-> 0x8 ... 0x1000000 -> 0x2000000 ...
So, will be compare ~0x5 and ~0x4.
That is problem.

>
> 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 patch fix the such problem, and fix style problems also.
> ...
>> Any comments?
>
> 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.

>
> I don't want to imply that your patch is bad, but I don't understand
> it.
>
> 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
> Pig: An animal (Porcus omnivorous) closely allied to the  human  race
> by  the splendor and vivacity of its appetite, which, however, is in-
> ferior in scope, for it balks at pig.                - Ambrose Bierce
>

Thanks
Minkyu Kang
-- 
from. prom.
www.promsoft.net


More information about the U-Boot mailing list