[U-Boot-Users] memsize.c patch
Sangmoon Kim
dogoil at etinsys.com
Fri Apr 2 11:25:54 CEST 2004
Hi,
>
> This is intentional. You can only find out how much mempory is
> installed when you test beyound the end - otrherwise there might be
> more memory, right? You must map more memory, then.
>
I know this is intentional.
But in case of MPC8245 which has 4 DBATs.
We need one DBAT for DCACHE, one for PCI and one for Flash.
Then there is only one DBAT left for SDRAM.
The maximum size of DBAT is 256M bytes.
So the maximum capacity of SDRAM that u-boot can handle is 256M bytes.
Now if the CFG_MAX_RAM_SIZE is set to 256M and 256M SDRAM is installed,
the get_ram_size routine tries to read some value at (base + 0x10000000)
which is outside of block address translation.
Then the board hangs.
The patch fixes the problem.
>
> Just a simple question: what happens if base != 0 ?
>
I forgot that.
Then how about this.
for (cnt = 1; cnt < maxsize / sizeof (long); cnt <<= 1) {
addr = base + cnt; /* pointer arith! */
- val = *addr;
- *addr = save[--i];
- if (val != ~cnt) {
+ if (addr < (base + maxsize)) {
+ val = *addr;
+ *addr = save[--i];
+ }
+ if ((val != ~cnt) || (addr >= base + maxsize)) {
Regards,
Sangmoon Kim
More information about the U-Boot
mailing list