[U-Boot] [PATCH v2] [RFC] memsize.c: adapt get_ram_size() for address spaces >32 bit
Wolfgang Denk
wd at denx.de
Thu May 27 20:16:28 CEST 2010
get_ram_size() used to use "long" data types for addresses and data,
which limited it to systems with less than 4 GiB memory. As more and
more systems are coming up with bigger memory resources, we adapt the
code to use phys_addr_t / phys_size_t data types instead.
Signed-off-by: Wolfgang Denk <wd at denx.de>
Cc: Timur Tabi <timur at freescale.com>
---
Note: this is only minimally tested - I just compiled a dozen of ppc
boards with it without appearent problems. Please review and test
carefully.
v2: - fix commit message
- change function prototype, too.
common/memsize.c | 14 +++++++-------
include/common.h | 2 +-
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/common/memsize.c b/common/memsize.c
index 6c275c9..b99e51b 100644
--- a/common/memsize.c
+++ b/common/memsize.c
@@ -37,14 +37,14 @@
* the actually available RAM size between addresses `base' and
* `base + maxsize'.
*/
-long get_ram_size(volatile long *base, long maxsize)
+phys_size_t get_ram_size(volatile phys_addr_t *base, phys_size_t maxsize)
{
- volatile long *addr;
- long save[32];
- long cnt;
- long val;
- long size;
- int i = 0;
+ volatile phys_addr_t *addr;
+ phys_size_t save[32];
+ phys_size_t cnt;
+ phys_size_t val;
+ phys_size_t size;
+ int i = 0;
for (cnt = (maxsize / sizeof (long)) >> 1; cnt > 0; cnt >>= 1) {
addr = base + cnt; /* pointer arith! */
diff --git a/include/common.h b/include/common.h
index 8bca04f..648e00f 100644
--- a/include/common.h
+++ b/include/common.h
@@ -316,7 +316,7 @@ const char *symbol_lookup(unsigned long addr, unsigned long *caddr);
void api_init (void);
/* common/memsize.c */
-long get_ram_size (volatile long *, long);
+phys_size_t get_ram_size(volatile phys_addr_t *, phys_size_t);
/* $(BOARD)/$(BOARD).c */
void reset_phy (void);
--
1.6.6.1
More information about the U-Boot
mailing list