[U-Boot] [PATCH] Make it possible to allocate physical address 0 with lmb

Grant Likely grant.likely at secretlab.ca
Wed Jan 26 19:39:44 CET 2011


On Wed, Jan 26, 2011 at 11:30 AM, Wolfgang Denk <wd at denx.de> wrote:
> Dear Grant Likely,
>
> In message <20110126165340.14306.98359.stgit at localhost6.localdomain6> you wrote:
>> LMB doesn't currently handle allocating regions based at physical
>> address 0.  This patch reworks the lmb_alloc functions to return
>> all ones when allocation fails instead of zero so that callers can
>> differentiate between a region allocated at zero and a failed
>> allocation
>>
>> Signed-off-by: Grant Likely <grant.likely at secretlab.ca>
> ...
>> --- a/lib/lmb.c
>> +++ b/lib/lmb.c
>> @@ -114,6 +114,9 @@ static long lmb_add_region(struct lmb_region *rgn, phys_addr_t base, phys_size_t
> ...
>> -     if (alloc == 0)
>> -             printf("ERROR: Failed to allocate 0x%lx bytes below 0x%lx.\n",
>> +     if (alloc == LMB_ALLOC_ERROR) {
>> +             debug("ERROR: Failed to allocate 0x%lx bytes below 0x%lx.\n",
>>                     (ulong)size, (ulong)max_addr);
>> +             lmb_dump_all(lmb);
>> +     }
>
> Do you intentionally change the printf() into a debug() here?  If yes,
> what is your rationale for not printing a proper error message in
> production code?

No, that was a mistake.  I'll correct it.

g.

>
> 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
> "I knew then (in 1970) that a 4-kbyte minicomputer would cost as much
> as a house. So I reasoned  that  after  college,  I'd  have  to  live
> cheaply in an apartment and put all my money into owning a computer."
>      - Apple co-founder Steve Wozniak, EE Times, June 6, 1988, pg 45
>



-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.


More information about the U-Boot mailing list