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>
4
#include <
ec/google/chromeec/ec.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
17
int
__weak
variant_memory_sku
(
void
)
18
{
19
const
gpio_t
spd_gpios[] = {
20
GPIO_MEM_CONFIG_0
,
21
GPIO_MEM_CONFIG_1
,
22
GPIO_MEM_CONFIG_2
,
23
GPIO_MEM_CONFIG_3
,
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
35
variant_memory_params
(&
memcfg
);
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
*/
48
memcfg
.
spd
[0].
read_type
=
READ_SPD_CBFS
;
49
memcfg
.
spd
[0].
spd_spec
.
spd_index
= mem_sku;
50
if
(!is_single_ch_mem) {
51
memcfg
.
spd
[2].
read_type
=
READ_SPD_CBFS
;
52
memcfg
.
spd
[2].
spd_spec
.
spd_index
= mem_sku;
53
}
54
55
cannonlake_memcfg_init
(&memupd->FspmConfig, &
memcfg
);
56
}
ARRAY_SIZE
#define ARRAY_SIZE(a)
Definition:
helpers.h:12
cannonlake_memcfg_init
void cannonlake_memcfg_init(FSP_M_CONFIG *mem_cfg, const struct cnl_mb_cfg *cnl_cfg)
Definition:
cnl_memcfg_init.c:108
cnl_memcfg_init.h
READ_SPD_CBFS
@ READ_SPD_CBFS
Definition:
cnl_memcfg_init.h:36
ec.h
gpio_get
int gpio_get(gpio_t gpio)
Definition:
gpio.c:166
gpio_base2_value
uint32_t gpio_base2_value(const gpio_t gpio[], int num_gpio)
Definition:
gpio.c:30
memcfg
static const struct cnl_mb_cfg memcfg
Definition:
romstage.c:6
variant_memory_params
const struct mb_cfg *__weak variant_memory_params(void)
Definition:
memory.c:67
GPIO_MEM_CONFIG_3
#define GPIO_MEM_CONFIG_3
Definition:
gpio.h:27
GPIO_MEM_CONFIG_0
#define GPIO_MEM_CONFIG_0
Definition:
gpio.h:24
GPIO_MEM_CONFIG_2
#define GPIO_MEM_CONFIG_2
Definition:
gpio.h:26
GPIO_MEM_CONFIG_1
#define GPIO_MEM_CONFIG_1
Definition:
gpio.h:25
memory_info.h
mainboard_memory_init_params
void mainboard_memory_init_params(FSPM_UPD *memupd)
Definition:
romstage_spd_cbfs.c:29
variant_memory_sku
int __weak variant_memory_sku(void)
Definition:
romstage_spd_cbfs.c:17
GPIO_MEM_CH_SEL
#define GPIO_MEM_CH_SEL
Definition:
romstage_spd_cbfs.c:15
__weak
const struct smm_save_state_ops *legacy_ops __weak
Definition:
save_state.c:8
cnl_mb_cfg
Definition:
cnl_memcfg_init.h:55
cnl_mb_cfg::spd
struct spd_info spd[NUM_DIMM_SLOT]
Definition:
cnl_memcfg_init.h:57
gpio_t
Definition:
gpio_base.h:7
spd_info::spd_spec
union spd_info::spd_data_by spd_spec
spd_info::read_type
enum mem_info_read_type read_type
Definition:
cnl_memcfg_init.h:41
spd_info::spd_data_by::spd_index
int spd_index
Definition:
cnl_memcfg_init.h:47
src
mainboard
google
hatch
romstage_spd_cbfs.c
Generated by
1.9.1