Debian Codegraph @

src/mainboard/google/kahlee/variants/baseboard/memory.c

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #include <baseboard/variants.h>
4 #include <console/console.h>
5 #include <gpio.h>
6 #include <spd_bin.h>
7 #include <string.h>
8 #include <variant/gpio.h>
9 #include <amdblocks/dimm_spd.h>
10
11 uint8_t __weak variant_memory_sku(void)
12 {
13 gpio_t pads[] = {
14 [3] = MEM_CONFIG3,
15 [2] = MEM_CONFIG2,
16 [1] = MEM_CONFIG1,
17 [0] = MEM_CONFIG0,
18 };
19
20 return gpio_base2_value(pads, ARRAY_SIZE(pads));
21 }
22
23 int __weak variant_mainboard_read_spd(uint8_t spdAddress,
24 char *buf, size_t len)
25 {
26 u8 spd_index = variant_memory_sku();
27
28 printk(BIOS_INFO, "%s SPD index %d\n", __func__, spd_index);
29
30 void *spd = (void *)spd_cbfs_map(spd_index);
31 if (!spd) {
32 printk(BIOS_ERR, "spd.bin not found\n");
33 return -1;
34 }
35
36 if (len != CONFIG_DIMM_SPD_SIZE) {
37 printk(BIOS_ERR, "spd.bin is not the correct size\n");
38 return -1;
39 }
40
41 memcpy(buf, spd, len);
42
43 return 0;
44 }