[U-Boot] [PATCH] sandbox: Add improved RAM simulation
Simon Glass
sjg at chromium.org
Tue Nov 1 17:45:54 CET 2011
Hi Matthias,
On Tue, Nov 1, 2011 at 9:05 AM, Matthias Weisser <weisserm at arcor.de> wrote:
> Am 01.11.2011 16:28, schrieb Mike Frysinger:
>> On Tuesday 01 November 2011 10:07:31 Matthias Weisser wrote:
>>> --- a/arch/sandbox/cpu/os.c
>>> +++ b/arch/sandbox/cpu/os.c
>>>
>>> +void *os_mmap(void *addr, size_t length, int prot, int flags, int fd,
>>> + off_t offset)
>>> +{
>>> + return mmap((void *)addr, length, PROT_READ | PROT_WRITE,
>>
>> void cast here is unnecessary
>
> Right.
>
>>> --- a/arch/sandbox/lib/board.c
>>> +++ b/arch/sandbox/lib/board.c
>>>
>>> +static gd_t gd_mem;
>>
>> i don't think this indirection is necessary. probably can replace the static
>> gd_mem with:
>> gd_t gd;
>
> AFAIK gd is a pointer. So I think we always need some sort of memory
> where the actual structure is stored.
Yes I think that's right.
>
>>> +#define CONFIG_SYS_SDRAM_BASE 0x20000000
>>> ...
>>> - mem = malloc(size);
>>> + mem = os_mmap((void *)CONFIG_SYS_SDRAM_BASE, CONFIG_SYS_SDRAM_SIZE,
>>> + 0, 0, -1, 0);
>>
>> mmap() makes no guarantee that the requested address is what you'll get back.
>> so there's no point in having this SDRAM_BASE define. punt it and pass in NULL
>> instead.
>
> But it works in most cases :-) The point of adding it was that I really
> like to have memory aligned on a 256MB boundary or so like it is in most
> SOCs. But thats a personal preference. And if it doesn't work you can
> still get the address of physical memory from bdinfo.
Most?
>
>> also, with Simon's other patch to md to use the remap func, the address of our
>> memory backing store doesn't matter.
>
> Well, you are right. But with the posted patch you don't need any remap
> function and md/mm/mtest/mw works out of the box.
This is interesting. What is the test purpose of specifying a
particular virtual address for your memory?
If this is useful then we should make the mmap function fail if it
cannot honour the address, since otherwise presumably some tests will
fail.
Regards,
Simon
>
> Regards
> Matthias
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
More information about the U-Boot
mailing list