aboutsummaryrefslogtreecommitdiff
path: root/src/mainboard/google/auron/variants/samus/spd
diff options
context:
space:
mode:
authorAngel Pons <th3fanbus@gmail.com>2021-01-20 22:24:22 +0100
committerAngel Pons <th3fanbus@gmail.com>2021-01-23 11:25:59 +0000
commit292a7641418bbd653f8097419578793a9c758623 (patch)
tree3e181602f2f756fcd272b9dea74ba633cd158855 /src/mainboard/google/auron/variants/samus/spd
parente23b0abe30f3cf026a931cfd145d568cddf37ffc (diff)
mb/google/auron: Factor out SPD indexing
The code to read the SPD file and index it is not variant-specific. Change-Id: Iaee0a77934a45c65bf32dd0dba23cec654abc0b9 Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/49773 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Matt DeVillier <matt.devillier@gmail.com> Reviewed-by: Michael Niewöhner <foss@mniewoehner.de>
Diffstat (limited to 'src/mainboard/google/auron/variants/samus/spd')
-rw-r--r--src/mainboard/google/auron/variants/samus/spd/spd.c24
1 files changed, 2 insertions, 22 deletions
diff --git a/src/mainboard/google/auron/variants/samus/spd/spd.c b/src/mainboard/google/auron/variants/samus/spd/spd.c
index 70e55cf635..25ff928b6d 100644
--- a/src/mainboard/google/auron/variants/samus/spd/spd.c
+++ b/src/mainboard/google/auron/variants/samus/spd/spd.c
@@ -28,8 +28,6 @@ void mainboard_fill_spd_data(struct pei_data *pei_data)
};
int spd_gpio[4];
int spd_index;
- size_t spd_file_len;
- char *spd_file;
spd_gpio[0] = get_gpio(spd_bits[0]);
spd_gpio[1] = get_gpio(spd_bits[1]);
@@ -44,26 +42,8 @@ void mainboard_fill_spd_data(struct pei_data *pei_data)
spd_bits[3], spd_gpio[3], spd_bits[2], spd_gpio[2],
spd_bits[1], spd_gpio[1], spd_bits[0], spd_gpio[0]);
- spd_file = cbfs_map("spd.bin", &spd_file_len);
- if (!spd_file)
- die("SPD data not found.");
-
- if (spd_file_len < ((spd_index + 1) * SPD_LEN)) {
- printk(BIOS_ERR, "SPD index override to 0 - old hardware?\n");
- spd_index = 0;
- }
-
- if (spd_file_len < SPD_LEN)
- die("Missing SPD data.");
+ fill_spd_for_index(pei_data->spd_data[0][0], spd_index);
/* Assume same memory in both channels */
- spd_index *= SPD_LEN;
- memcpy(pei_data->spd_data[0][0], spd_file + spd_index, SPD_LEN);
- memcpy(pei_data->spd_data[1][0], spd_file + spd_index, SPD_LEN);
-
- /* Make sure a valid SPD was found */
- if (pei_data->spd_data[0][0][0] == 0)
- die("Invalid SPD data.");
-
- mainboard_print_spd_info(pei_data->spd_data[0][0]);
+ memcpy(pei_data->spd_data[1][0], pei_data->spd_data[0][0], SPD_LEN);
}