Arthur Heymans has uploaded this change for review.

View Change

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);

To view, visit change 68842. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Ie7f915c6e150629eff235ee94719172467a54db2
Gerrit-Change-Number: 68842
Gerrit-PatchSet: 1
Gerrit-Owner: Arthur Heymans <arthur@aheymans.xyz>
Gerrit-MessageType: newchange