]>
git.ipfire.org Git - people/ms/u-boot.git/blob - common/memsize.c
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * SPDX-License-Identifier: GPL-2.0+
11 * At least on G2 PowerPC cores, sequential accesses to non-existent
12 * memory must be synchronized.
14 # include <asm/io.h> /* for sync() */
16 # define sync() /* nothing */
20 * Check memory range for valid RAM. A simple memory test determines
21 * the actually available RAM size between addresses `base' and
24 long get_ram_size(long *base
, long maxsize
)
33 for (cnt
= (maxsize
/ sizeof (long)) >> 1; cnt
> 0; cnt
>>= 1) {
34 addr
= base
+ cnt
; /* pointer arith! */
48 if ((val
= *addr
) != 0) {
49 /* Restore the original data before leaving the function.
53 for (cnt
= 1; cnt
< maxsize
/ sizeof(long); cnt
<<= 1) {
61 for (cnt
= 1; cnt
< maxsize
/ sizeof (long); cnt
<<= 1) {
62 addr
= base
+ cnt
; /* pointer arith! */
66 size
= cnt
* sizeof (long);
67 /* Restore the original data before leaving the function.
69 for (cnt
<<= 1; cnt
< maxsize
/ sizeof (long); cnt
<<= 1) {