[U-Boot-Users] Some puzzles on dram_size()
SAM SONG
samsongshu at yahoo.com.cn
Sun Jan 4 07:41:34 CET 2004
Hi,
Sorry for sending the same topic mail again.Pls delet
the former mail with the same topic for my mistaken
operation.
When porting u-boot on LITE_DW,I found that the
following code in RPXlite.c couldn't get through.I
traced the code by BDI2000 and DDD and knew that the
problem perhaps was save[32].In the "for" cycle,the
dimension of save[] must beyond 32 limit by
[maxsize/sizeof(long)]/2.I changed save[] dimension to
big enough but still in vain.I don't know
why.Finally,I masked the following code and booted
successfully.How does the following code work
normally?If I masked the code,is there any potential
danger?
ulong save[32];
for (cnt = maxsize/sizeof(long); cnt > 0; cnt >>= 1) {
addr = base + cnt; /* pointer arith! */
save[i++] = *addr;
*addr = ~cnt;
}
/* write 0 to base address */
addr = base;
save[i] = *addr;
*addr = 0;
/* check at base address */
if ((val = *addr) != 0) {
*addr = save[i];
return (0);
}
for (cnt = 1; cnt <= maxsize/sizeof(long); cnt <<= 1)
{
addr = base + cnt; /* pointer arith! */
val = *addr;
*addr = save[--i];
if (val != (~cnt)) {
return (cnt * sizeof(long));
}
}
Best regards,
Sam Song
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
More information about the U-Boot
mailing list