This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
Re: EDB7312 - Linux booting
>>>>> Gary Thomas writes:
> On Fri, 2003-02-07 at 04:04, Jonathan Larmour wrote:
>> Gary Thomas wrote:
>> > Index: hal/arm/arch/current/src/redboot_linux_exec.c
>> [snip]
>> > - params->u.mem.start = CYGARC_PHYSICAL_ADDRESS(CYGMEM_REGION_ram);
>> > /* Round up so there's only one bit set in the memory size.
>> > * Don't double it if it's already a power of two, though.
>> > */
>> > params->u.mem.size = 1<<hal_msbindex(CYGMEM_REGION_ram_SIZE);
>> > if (params->u.mem.size < CYGMEM_REGION_ram_SIZE)
>> > params->u.mem.size <<= 1;
>> > + params->u.mem.start = CYGARC_PHYSICAL_ADDRESS(CYGMEM_REGION_ram);
>> > + // Linux doesn't like physical RAM to start on odd boundary
>> > + params->u.mem.start &= ~(params->u.mem.size-1);
>>
>> Excuse my ignorance, but why is this a power of two? Physical memory may
>> not be a power of two certainly.
> Ask Mark, he wrote this [I think] :-)
You can't pin this one on me! :)
1.1 (jskov 25-Jan-02): /* Round up so there's only one bit set in the memory size.
1.1 (jskov 25-Jan-02): * Don't double it if it's already a power of two, though.
1.1 (jskov 25-Jan-02): */
1.1 (jskov 25-Jan-02): params->u.mem.size = 1<<hal_msbindex(CYGMEM_REGION_ram_SIZE);
I think what happened was that Jesper copied this code from the original
ipaq RedBoot code when he made it generic to all arm hals. But Jifl is
right, not all platforms will have a power of 2 memory size.
--Mark