coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
romstage_spd_cbfs.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <baseboard/variants.h>
5 #include <gpio.h>
6 #include <memory_info.h>
7 #include <soc/cnl_memcfg_init.h>
8 #include <soc/romstage.h>
9 #include <variant/gpio.h>
10 
11 /*
12  * GPIO_MEM_CH_SEL is set to 1 for single channel skus
13  * and 0 for dual channel skus.
14  */
15 #define GPIO_MEM_CH_SEL GPP_F2
16 
18 {
19  const gpio_t spd_gpios[] = {
24  };
25 
26  return gpio_base2_value(spd_gpios, ARRAY_SIZE(spd_gpios));
27 }
28 
29 void mainboard_memory_init_params(FSPM_UPD *memupd)
30 {
31  struct cnl_mb_cfg memcfg;
32  int mem_sku;
33  int is_single_ch_mem;
34 
36  mem_sku = variant_memory_sku();
37  /*
38  * GPP_F2 is the MEM_CH_SEL gpio, which is set to 1 for single
39  * channel skus and 0 for dual channel skus.
40  */
41  is_single_ch_mem = gpio_get(GPIO_MEM_CH_SEL);
42 
43  /*
44  * spd[0]-spd[3] map to CH0D0, CH0D1, CH1D0, CH1D1 respectively.
45  * Dual-DIMM memory is not used in hatch family, so we only
46  * fill in spd_info for CH0D0 and CH1D0 here.
47  */
49  memcfg.spd[0].spd_spec.spd_index = mem_sku;
50  if (!is_single_ch_mem) {
52  memcfg.spd[2].spd_spec.spd_index = mem_sku;
53  }
54 
55  cannonlake_memcfg_init(&memupd->FspmConfig, &memcfg);
56 }
#define ARRAY_SIZE(a)
Definition: helpers.h:12
void cannonlake_memcfg_init(FSP_M_CONFIG *mem_cfg, const struct cnl_mb_cfg *cnl_cfg)
@ READ_SPD_CBFS
int gpio_get(gpio_t gpio)
Definition: gpio.c:166
uint32_t gpio_base2_value(const gpio_t gpio[], int num_gpio)
Definition: gpio.c:30
static const struct cnl_mb_cfg memcfg
Definition: romstage.c:6
const struct mb_cfg *__weak variant_memory_params(void)
Definition: memory.c:67
#define GPIO_MEM_CONFIG_3
Definition: gpio.h:27
#define GPIO_MEM_CONFIG_0
Definition: gpio.h:24
#define GPIO_MEM_CONFIG_2
Definition: gpio.h:26
#define GPIO_MEM_CONFIG_1
Definition: gpio.h:25
void mainboard_memory_init_params(FSPM_UPD *memupd)
int __weak variant_memory_sku(void)
#define GPIO_MEM_CH_SEL
const struct smm_save_state_ops *legacy_ops __weak
Definition: save_state.c:8
struct spd_info spd[NUM_DIMM_SLOT]
union spd_info::spd_data_by spd_spec
enum mem_info_read_type read_type