| * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| * SPDX-License-Identifier: GPL-2.0+ |
| * At least on G2 PowerPC cores, sequential accesses to non-existent |
| * memory must be synchronized. |
| # include <asm/io.h> /* for sync() */ |
| # define sync() /* nothing */ |
| * Check memory range for valid RAM. A simple memory test determines |
| * the actually available RAM size between addresses `base' and |
| long get_ram_size(long *base, long maxsize) |
| for (cnt = (maxsize / sizeof (long)) >> 1; cnt > 0; cnt >>= 1) { |
| addr = base + cnt; /* pointer arith! */ |
| if ((val = *addr) != 0) { |
| /* Restore the original data before leaving the function. |
| for (cnt = 1; cnt < maxsize / sizeof(long); cnt <<= 1) { |
| for (cnt = 1; cnt < maxsize / sizeof (long); cnt <<= 1) { |
| addr = base + cnt; /* pointer arith! */ |
| size = cnt * sizeof (long); |
| /* Restore the original data before leaving the function. |
| for (cnt <<= 1; cnt < maxsize / sizeof (long); cnt <<= 1) { |