public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [RFC] ARM: U-boot and 2 GiB of ram with get_ram_size only being long
@ 2013-10-03 21:15 Oliver Schinagl
  2013-10-07  2:41 ` Oliver Schinagl
  2013-10-15 18:01 ` Scott Wood
  0 siblings, 2 replies; 20+ messages in thread
From: Oliver Schinagl @ 2013-10-03 21:15 UTC (permalink / raw)
  To: u-boot

Hey all,

I just yesterday received my CubieTruck (cubieboard3) with 2 GiB of Ram 
and added support for it to the sunxi-u-boot branch. While I know this 
isn't merged into the main u-boot tree (yet), I ran into the following 
problem.

At the end of the dram init code, it is customary to call get_ram_size() 
and return its value. This is then used to print the DRAM size and also 
is passed to the Linux kernel.

However the return size of get_ram_size() is a long. While I don't 
understand why not unsigned long or even u64 was chosen, this causes 
get_dram_size to overflow when having a ramsize of 2 GiB. While only 
printing of the value isn't hugely important, this does indicate u-boot 
seems to be somewhat artificially limited to 2 GiB of Ram? This only 
seems to affect the SPL as, if I understood correctly, there it stores 
the ram_size into the gd struct which I think is unsigned long.

I've started working on a patch to convert common/memsize.c's 
get_ram_size(), to be completely unsigned long, however there seems to 
be quite a lot of code that calls this. So my question is now before 
going over all drivers and change that and submit a big patch-set, did I 
overlook anything and are my conclusions correct, get_ram_size should 
return unsigned long.

Finally, a long is 32 bits on x86 and armv7, but how will that relate to 
64bits armv8? As I understood, Windows treats long's as 4 bytes no 
matter if it's 32 bit or 64 bit. Linux is better and a long is 4 bytes 
on 32 bits, and 8 bytes on 64 bits versions. So how will u-boot work on 
armv8? Will the long datatype work well, or should I consider changing 
things more future proof? (u32 and u64 come to mind).

Thank you for any input regarding that issue.

Oliver

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2014-03-24 10:14 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-03 21:15 [U-Boot] [RFC] ARM: U-boot and 2 GiB of ram with get_ram_size only being long Oliver Schinagl
2013-10-07  2:41 ` Oliver Schinagl
2013-10-15  7:12   ` Albert ARIBAUD
2013-10-15 17:57     ` Scott Wood
2013-10-17  6:27       ` Albert ARIBAUD
2013-10-18  0:04         ` Oliver Schinagl
2013-10-18 16:43           ` Scott Wood
2013-10-18 20:26             ` Wolfgang Denk
2013-10-18 21:04               ` Scott Wood
2013-10-18 21:53                 ` Wolfgang Denk
2013-10-18 23:11               ` Oliver Schinagl
2013-10-18 23:07             ` Oliver Schinagl
2013-10-18 23:25               ` Scott Wood
2013-10-18 23:25                 ` Scott Wood
2013-10-19  9:21                   ` Oliver Schinagl
2013-10-19  9:07                 ` Oliver Schinagl
2013-10-19 18:25                   ` Tom Rini
2013-10-21 19:44                 ` Wolfgang Denk
2014-03-24 10:14                   ` Olliver Schinagl
2013-10-15 18:01 ` Scott Wood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox