intel sandy/ivy: Improve DIMM replacement detection

When MRC cache is available, first read only the SPD unique
identifier bytes required to detect possible DIMM replacement.
As this is 11 vs 256 bytes with slow SMBus operations, we save
about 70ms for every installed DIMM on normal boot path.

In the DIMM replacement case this adds some 10ms per installed DIMM
as some SPD gets read twice, but we are on slow RAM training boot path
anyways.

Change-Id: I294a56e7b7562c3dea322c644b21a15abb033870
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/17491
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
diff --git a/src/mainboard/lenovo/t420/romstage.c b/src/mainboard/lenovo/t420/romstage.c
index ec5fec5..d25ce45 100644
--- a/src/mainboard/lenovo/t420/romstage.c
+++ b/src/mainboard/lenovo/t420/romstage.c
@@ -60,10 +60,10 @@
 	{ 1, 1, -1 }, /* P13: camera (LCD), no OC */
 };
 
-void mainboard_get_spd(spd_raw_data *spd)
+void mainboard_get_spd(spd_raw_data *spd, bool id_only)
 {
-	read_spd(&spd[0], 0x50);
-	read_spd(&spd[2], 0x51);
+	read_spd(&spd[0], 0x50, id_only);
+	read_spd(&spd[2], 0x51, id_only);
 }
 
 void mainboard_early_init(int s3resume)
diff --git a/src/mainboard/lenovo/t420s/romstage.c b/src/mainboard/lenovo/t420s/romstage.c
index e5e1416..27b45fd 100644
--- a/src/mainboard/lenovo/t420s/romstage.c
+++ b/src/mainboard/lenovo/t420s/romstage.c
@@ -63,9 +63,9 @@
 	{ 1, 1, -1 }, /* P13: camera (LCD), no OC */
 };
 
-void mainboard_get_spd(spd_raw_data *spd) {
-	read_spd(&spd[0], 0x50);
-	read_spd(&spd[2], 0x51);
+void mainboard_get_spd(spd_raw_data *spd, bool id_only) {
+	read_spd(&spd[0], 0x50, id_only);
+	read_spd(&spd[2], 0x51, id_only);
 }
 
 void mainboard_early_init(int s3resume) {
diff --git a/src/mainboard/lenovo/t430s/romstage.c b/src/mainboard/lenovo/t430s/romstage.c
index d1bcc3b..92f9e62 100644
--- a/src/mainboard/lenovo/t430s/romstage.c
+++ b/src/mainboard/lenovo/t430s/romstage.c
@@ -63,9 +63,9 @@
 	{ 1, 1, -1 }, /* P13: camera, no OC */
 };
 
-void mainboard_get_spd(spd_raw_data *spd) {
-	read_spd(&spd[0], 0x50);
-	read_spd(&spd[2], 0x51);
+void mainboard_get_spd(spd_raw_data *spd, bool id_only) {
+	read_spd(&spd[0], 0x50, id_only);
+	read_spd(&spd[2], 0x51, id_only);
 }
 
 void mainboard_early_init(int s3resume) {
diff --git a/src/mainboard/lenovo/t520/romstage.c b/src/mainboard/lenovo/t520/romstage.c
index 34171e0..5ba4873 100644
--- a/src/mainboard/lenovo/t520/romstage.c
+++ b/src/mainboard/lenovo/t520/romstage.c
@@ -78,9 +78,9 @@
 	{ 1, 1, -1 }, /* P13: CAMERA (LCD), no OC */
 };
 
-void mainboard_get_spd(spd_raw_data *spd) {
-	read_spd (&spd[0], 0x50);
-	read_spd (&spd[2], 0x51);
+void mainboard_get_spd(spd_raw_data *spd, bool id_only) {
+	read_spd (&spd[0], 0x50, id_only);
+	read_spd (&spd[2], 0x51, id_only);
 }
 
 void mainboard_early_init(int s3resume) {
diff --git a/src/mainboard/lenovo/t530/romstage.c b/src/mainboard/lenovo/t530/romstage.c
index 7bbb2a8..3d603c5 100644
--- a/src/mainboard/lenovo/t530/romstage.c
+++ b/src/mainboard/lenovo/t530/romstage.c
@@ -65,9 +65,9 @@
 	{ 1, 1, -1 }, /* P13: camera, no OC */
 };
 
-void mainboard_get_spd(spd_raw_data *spd) {
-	read_spd (&spd[0], 0x50);
-	read_spd (&spd[2], 0x51);
+void mainboard_get_spd(spd_raw_data *spd, bool id_only) {
+	read_spd (&spd[0], 0x50, id_only);
+	read_spd (&spd[2], 0x51, id_only);
 }
 
 void mainboard_early_init(int s3resume) {
diff --git a/src/mainboard/lenovo/x220/romstage.c b/src/mainboard/lenovo/x220/romstage.c
index 71ed1a8..5a1c90a 100644
--- a/src/mainboard/lenovo/x220/romstage.c
+++ b/src/mainboard/lenovo/x220/romstage.c
@@ -75,10 +75,10 @@
 	{ 1, 1, 6 },
 };
 
-void mainboard_get_spd(spd_raw_data *spd)
+void mainboard_get_spd(spd_raw_data *spd, bool id_only)
 {
-	read_spd (&spd[0], 0x50);
-	read_spd (&spd[2], 0x51);
+	read_spd (&spd[0], 0x50, id_only);
+	read_spd (&spd[2], 0x51, id_only);
 }
 
 void mainboard_early_init(int s3resume)
diff --git a/src/mainboard/lenovo/x230/romstage.c b/src/mainboard/lenovo/x230/romstage.c
index a2c43e0..53ad9ac 100644
--- a/src/mainboard/lenovo/x230/romstage.c
+++ b/src/mainboard/lenovo/x230/romstage.c
@@ -78,9 +78,9 @@
 	{ 1, 1, -1 }, /* P13: webcam, no OC */
 };
 
-void mainboard_get_spd(spd_raw_data *spd) {
-	read_spd (&spd[0], 0x50);
-	read_spd (&spd[2], 0x51);
+void mainboard_get_spd(spd_raw_data *spd, bool id_only) {
+	read_spd (&spd[0], 0x50, id_only);
+	read_spd (&spd[2], 0x51, id_only);
 }
 
 void mainboard_early_init(int s3resume) {