From: Oliver Schinagl <oliver+list@schinagl.nl>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC] ARM: U-boot and 2 GiB of ram with get_ram_size only being long
Date: Thu, 03 Oct 2013 23:15:00 +0200 [thread overview]
Message-ID: <524DDE54.7090709@schinagl.nl> (raw)
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
next reply other threads:[~2013-10-03 21:15 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-03 21:15 Oliver Schinagl [this message]
2013-10-07 2:41 ` [U-Boot] [RFC] ARM: U-boot and 2 GiB of ram with get_ram_size only being long 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=524DDE54.7090709@schinagl.nl \
--to=oliver+list@schinagl.nl \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox