From 4a8cb30222a34de760d38c7d13d54e24221d9fec Mon Sep 17 00:00:00 2001 From: Angel Pons Date: Wed, 23 Jun 2021 16:14:56 +0200 Subject: 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 Reviewed-on: https://review.coreboot.org/c/coreboot/+/55811 Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier --- src/mainboard/google/auron/spd.c | 18 ++++-------------- src/mainboard/google/auron/variants/buddy/spd/spd.c | 9 +++------ src/mainboard/google/jecht/spd/spd.c | 8 +++----- 3 files changed, 10 insertions(+), 25 deletions(-) (limited to 'src/mainboard/google') diff --git a/src/mainboard/google/auron/spd.c b/src/mainboard/google/auron/spd.c index 79a51f8900..0bb7dcbcd1 100644 --- a/src/mainboard/google/auron/spd.c +++ b/src/mainboard/google/auron/spd.c @@ -1,21 +1,11 @@ /* SPDX-License-Identifier: GPL-2.0-only */ #include -#include #include -#include -#include -/* Copy SPD data for on-board memory */ -void mainboard_fill_spd_data(struct pei_data *pei_data) +void mb_get_spd_map(struct spd_info *spdi) { - const unsigned int spd_index = variant_get_spd_index(); - - fill_spd_for_index(pei_data->spd_data[0][0], spd_index); - pei_data->spd_addresses[0] = SPD_MEMORY_DOWN; - - if (variant_is_dual_channel(spd_index)) { - memcpy(pei_data->spd_data[1][0], pei_data->spd_data[0][0], SPD_LEN); - pei_data->spd_addresses[2] = SPD_MEMORY_DOWN; - } + spdi->spd_index = variant_get_spd_index(); + spdi->addresses[0] = SPD_MEMORY_DOWN; + spdi->addresses[2] = variant_is_dual_channel(spdi->spd_index) ? SPD_MEMORY_DOWN : 0; } diff --git a/src/mainboard/google/auron/variants/buddy/spd/spd.c b/src/mainboard/google/auron/variants/buddy/spd/spd.c index 5281d82a4f..020bb8b46e 100644 --- a/src/mainboard/google/auron/variants/buddy/spd/spd.c +++ b/src/mainboard/google/auron/variants/buddy/spd/spd.c @@ -1,12 +1,9 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -#include -#include #include -/* Copy SPD data for on-board memory */ -void mainboard_fill_spd_data(struct pei_data *pei_data) +void mb_get_spd_map(struct spd_info *spdi) { - pei_data->spd_addresses[0] = 0xa0; - pei_data->spd_addresses[2] = 0xa4; + spdi->addresses[0] = 0x50; + spdi->addresses[2] = 0x52; } diff --git a/src/mainboard/google/jecht/spd/spd.c b/src/mainboard/google/jecht/spd/spd.c index 177e59a5d2..020bb8b46e 100644 --- a/src/mainboard/google/jecht/spd/spd.c +++ b/src/mainboard/google/jecht/spd/spd.c @@ -1,11 +1,9 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -#include #include -/* Copy SPD data for on-board memory */ -void mainboard_fill_spd_data(struct pei_data *pei_data) +void mb_get_spd_map(struct spd_info *spdi) { - pei_data->spd_addresses[0] = 0xa0; - pei_data->spd_addresses[2] = 0xa4; + spdi->addresses[0] = 0x50; + spdi->addresses[2] = 0x52; } -- cgit v1.2.3