diff options
| author | roy zang <tie-fei.zang@freescale.com> | 2006-12-04 23:57:35 +0800 |
|---|---|---|
| committer | Zang Tiefei <roy@bus.ap.freescale.net> | 2006-12-04 23:57:35 +0800 |
| commit | d3bb5ec198edad4869ac5276a5899881b7bf5433 (patch) | |
| tree | 409a70e937d5f826df7929d11cb08a7cd207f5cd /common/memsize.c | |
| parent | 41862d13a87ec58c21166b10fcb754c963bc46f2 (diff) | |
| parent | 9d27b3a0685ff99fc477983f315c04d49f657a8a (diff) | |
| download | olio-uboot-2014.01-d3bb5ec198edad4869ac5276a5899881b7bf5433.tar.xz olio-uboot-2014.01-d3bb5ec198edad4869ac5276a5899881b7bf5433.zip | |
Merge /home/roy/CVS/7448/Open_Source/u-boot.git.dev
Diffstat (limited to 'common/memsize.c')
| -rw-r--r-- | common/memsize.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/common/memsize.c b/common/memsize.c index dbc812dfc..6c275c9b2 100644 --- a/common/memsize.c +++ b/common/memsize.c @@ -21,6 +21,16 @@ * MA 02111-1307 USA */ +#include <config.h> +#ifdef __PPC__ +/* + * At least on G2 PowerPC cores, sequential accesses to non-existent + * memory must be synchronized. + */ +# include <asm/io.h> /* for sync() */ +#else +# define sync() /* nothing */ +#endif /* * Check memory range for valid RAM. A simple memory test determines @@ -38,20 +48,27 @@ long get_ram_size(volatile long *base, long maxsize) for (cnt = (maxsize / sizeof (long)) >> 1; cnt > 0; cnt >>= 1) { addr = base + cnt; /* pointer arith! */ + sync (); save[i++] = *addr; + sync (); *addr = ~cnt; } addr = base; + sync (); save[i] = *addr; + sync (); *addr = 0; + sync (); if ((val = *addr) != 0) { /* Restore the original data before leaving the function. */ + sync (); *addr = save[i]; for (cnt = 1; cnt < maxsize / sizeof(long); cnt <<= 1) { addr = base + cnt; + sync (); *addr = save[--i]; } return (0); |