payloads/edk2: Disable the CPU Timer Lib unless supported
[coreboot.git] / src / mainboard / intel / harcuvar / spd / spd.c
bloba66c10b032f86545dea223430a5ad7ea92a4ac52
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <cbfs.h>
4 #include <console/console.h>
6 #include "spd.h"
8 /* Get SPD data for on-board memory */
9 uint8_t *mainboard_find_spd_data()
11 uint8_t *spd_data;
12 int spd_index;
13 size_t spd_file_len;
14 char *spd_file;
16 spd_index = 0;
18 spd_file = cbfs_map("spd.bin", &spd_file_len);
19 if (!spd_file)
20 die("SPD data not found.");
22 if (spd_file_len < ((spd_index + 1) * SPD_LEN)) {
23 printk(BIOS_ERR,
24 "SPD index override to 0 due to incorrect SPD index.\n");
25 spd_index = 0;
28 if (spd_file_len < SPD_LEN)
29 die("Missing SPD data.");
31 /* Assume same memory in both channels */
32 spd_index *= SPD_LEN;
33 spd_data = (uint8_t *)(spd_file + spd_index);
35 /* Make sure a valid SPD was found */
36 if (spd_data[0] == 0)
37 die("Invalid SPD data.");
39 return spd_data;