summaryrefslogtreecommitdiff
path: root/src/soc/intel/broadwell/spd.c
diff options
context:
space:
mode:
authorAngel Pons <th3fanbus@gmail.com>2021-06-23 16:14:56 +0200
committerAngel Pons <th3fanbus@gmail.com>2022-08-14 10:53:47 +0000
commit4a8cb30222a34de760d38c7d13d54e24221d9fec (patch)
tree66036e3c07862166c9ae78acac453e4242c07d11 /src/soc/intel/broadwell/spd.c
parentae626d30355b4744762d2c434e159ba9c3998783 (diff)
soc/intel/broadwell: Consolidate SPD handling
Mainboards do not need to know about `pei_data` to tell northbridge code where to find the SPD data. As done on Haswell, add the `mb_get_spd_map` function and the `struct spd_info` type to retrieve SPD information from mainboard code without having to use `pei_data` in said mainboard code. Unlike Haswell MRC, Broadwell MRC uses all positions of the `spd_data` array, not just the first. The placeholder SPD address for memory-down seems to be different as well. Adapt the existing code to handle these variations. Once complete, the abstraction layer for both MRC binaries will have the same API. Change-Id: I92a05003a319c354675368cae8e34980bd2f9e10 Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/55811 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Diffstat (limited to 'src/soc/intel/broadwell/spd.c')
-rw-r--r--src/soc/intel/broadwell/spd.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/soc/intel/broadwell/spd.c b/src/soc/intel/broadwell/spd.c
index 97cac38f9c..1af66f1d67 100644
--- a/src/soc/intel/broadwell/spd.c
+++ b/src/soc/intel/broadwell/spd.c
@@ -17,6 +17,8 @@
#define SPD_PART_OFF 128
#define SPD_PART_LEN 18
+#define SPD_LEN 256
+
static void print_spd_info(uint8_t spd[])
{
const int spd_banks[8] = { 8, 16, 32, 64, -1, -1, -1, -1 };
@@ -67,12 +69,12 @@ static void print_spd_info(uint8_t spd[])
}
}
-void fill_spd_for_index(uint8_t spd[], unsigned int spd_index)
+void copy_spd(struct pei_data *pei_data, struct spd_info *spdi)
{
size_t spd_file_len;
uint8_t *spd_file = cbfs_map("spd.bin", &spd_file_len);
- printk(BIOS_DEBUG, "SPD index %d\n", spd_index);
+ printk(BIOS_DEBUG, "SPD index %d\n", spdi->spd_index);
if (!spd_file)
die("SPD data not found.");
@@ -80,16 +82,21 @@ void fill_spd_for_index(uint8_t spd[], unsigned int spd_index)
if (spd_file_len < SPD_LEN)
die("Missing SPD data.");
- if (spd_file_len < ((spd_index + 1) * SPD_LEN)) {
+ if (spd_file_len < ((spdi->spd_index + 1) * SPD_LEN)) {
printk(BIOS_ERR, "SPD index override to 0 - old hardware?\n");
- spd_index = 0;
+ spdi->spd_index = 0;
}
- memcpy(spd, spd_file + (spd_index * SPD_LEN), SPD_LEN);
+ uint8_t *const spd = spd_file + (spdi->spd_index * SPD_LEN);
/* Make sure a valid SPD was found */
if (spd[0] == 0)
die("Invalid SPD data.");
print_spd_info(spd);
+
+ for (size_t i = 0; i < ARRAY_SIZE(spdi->addresses); i++) {
+ if (spdi->addresses[i] == SPD_MEMORY_DOWN)
+ memcpy(pei_data->spd_data[i / 2][i % 2], spd, SPD_LEN);
+ }
}