Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/68842 )
Change subject: lib/ramdetect: Limit probe size to function argument ......................................................................
lib/ramdetect: Limit probe size to function argument
This avoids probing above the function argument where other things than DRAM could be mapped.
Change-Id: Ie7f915c6e150629eff235ee94719172467a54db2 Signed-off-by: Arthur Heymans arthur@aheymans.xyz --- M src/lib/ramdetect.c 1 file changed, 17 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/42/68842/1
diff --git a/src/lib/ramdetect.c b/src/lib/ramdetect.c index 328ca07..25bdbe9 100644 --- a/src/lib/ramdetect.c +++ b/src/lib/ramdetect.c @@ -57,9 +57,12 @@ msb = MIN(msb, MAX_ADDRESSABLE_SPACE);
/* Compact binary search. */ - for (i = msb; i >= 0; i--) + for (i = msb; i >= 0; i--) { + if ((discovered | (1ULL << i)) > probe_size) + continue; if (probe_mb(dram_start, (discovered | (1ULL << i)))) discovered |= (1ULL << i); + }
saved_result = discovered; printk(BIOS_DEBUG, "RAMDETECT: Found %zu MiB RAM\n", discovered);