
Dear Scott,
In message 1382130258.7979.896.camel@snotra.buserror.net you wrote:
This is NOT a better approach. Reading the memory controller just tells you what is supposed to be there, i. e. what you programmed into the controller. get_ram_size() shows you what is _actually_ there,
That may be useful with simpler memory controllers where there isn't much to get wrong other than size, but on modern DDR controllers you're pretty screwed anyway if you don't know what's actually there. If you
The standard approach here is to go through all expected memory configurations...
don't get the size right, what are the odds you got the timing right? We hard code a lot of other things in U-Boot such as the address of various I/O...
You sound as if you were proud of that? I don't think this is any special kind of "acchievement".
And if RAM is socketed (or the board designer was nice enough to include it with non-socketed RAM), the information should be coming from SPD EEPROMs, not hardcoded in the U-Boot image.
Agreed - but then, still, get_ram_size() is a pretty efficient test if your memory is actually working as expected. Even DIMMs with SPD EEPROMs tend to fail every now and then. And when you know you have fit a 1 GB module, and U-Boot recognizes only 128 MB, you might start to think...
get_ram_size() is a very efficient memory test that detects 95% or more of all RAM related hardware issues.
So call it something like test_ram_simple() and bound it by the maximum
Actually the _primary_ function is the memory sizing. The testimg is just a pleasant side effect.
amount of RAM that you expect to be there, so you don't accidentally touch I/O. For RAM beyond 2G, either leave it untested or use the MMU to test it, but don't tell the rest of the system that RAM beyond that doesn't exist. For RAM that ends on a non-power-of-2 (below 2G), do one final test at the end of the supplied size.
Patches welcoem :-)
And if the test finds missing/bad RAM below the supplied limit, the caller should generally make noise that there's a problem rather than just use less RAM.
Well, it reports the working RAM size. You can check that, if you like.
Best regards,
Wolfgang Denk