[U-Boot] [PATCH] sandbox: Add improved RAM simulation

Mike Frysinger vapier at gentoo.org
Tue Nov 1 16:28:55 CET 2011


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

> --- 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;

> +#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.

also, with Simon's other patch to md to use the remap func, the address of our 
memory backing store doesn't matter.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20111101/4c9c0588/attachment.pgp 


More information about the U-Boot mailing list