coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
romstage_fsp_params.c
Go to the documentation of this file.
1
/* SPDX-License-Identifier: GPL-2.0-only */
2
3
#include <
assert.h
>
4
#include <
console/console.h
>
5
#include <fsp/api.h>
6
#include <soc/romstage.h>
7
#include <
spd_bin.h
>
8
#include <soc/meminit.h>
9
#include <baseboard/variants.h>
10
#include "
board_id.h
"
11
12
#define SPD_ID_MASK 0x7
13
14
static
size_t
get_spd_index
(
void
)
15
{
16
uint8_t
board_id
=
get_board_id
();
17
size_t
spd_index
;
18
19
printk
(
BIOS_INFO
,
"board id is 0x%x\n"
,
board_id
);
20
21
spd_index
=
board_id
&
SPD_ID_MASK
;
22
23
printk
(
BIOS_INFO
,
"SPD index is 0x%x\n"
, (
unsigned
int
)
spd_index
);
24
return
spd_index
;
25
}
26
27
/*
28
* ADL-P silicon can support 7 SRC CLK's and 10 CLKREQ signals. Out of 7 SRCCLK's
29
* 3 will be used for CPU, the rest are for PCH. If more than 4 PCH devices are
30
* connected on the platform, an external differential buffer chip needs to be placed at
31
* the platform level.
32
*
33
* GEN3_EXTERNAL_CLOCK_BUFFER Kconfig is selected for ADL-P RVP (not applicable for
34
* ADL-M/N RVP)
35
*
36
* CONFIG_CLKSRC_FOR_EXTERNAL_BUFFER provides the CLKSRC that feed clock to discrete
37
* buffer for further distribution to platform.
38
*/
39
static
void
configure_external_clksrc
(
FSP_M_CONFIG
*m_cfg)
40
{
41
for
(
unsigned
int
i = CONFIG_MAX_PCIE_CLOCK_SRC; i < CONFIG_MAX_PCIE_CLOCK_REQ; i++)
42
m_cfg->PcieClkSrcUsage[i] = CONFIG_CLKSRC_FOR_EXTERNAL_BUFFER;
43
}
44
45
void
mainboard_memory_init_params
(FSPM_UPD *memupd)
46
{
47
FSP_M_CONFIG
*m_cfg = &memupd->FspmConfig;
48
const
struct
mb_cfg
*
mem_config
=
variant_memory_params
();
49
int
board_id
=
get_board_id
();
50
51
/*
52
* Alder Lake common meminit block driver considers bus width to be 128-bit and
53
* populates the meminit data accordingly. Alder Lake-N has single memory controller
54
* with 64-bit bus width. By setting half_populated to true, only the bottom half is
55
* populated.
56
* TODO: Implement __weak variant_is_half_populated(void) function.
57
*/
58
const
bool
half_populated = (
CONFIG
(BOARD_INTEL_ADLRVP_N_EXT_EC)
59
||
CONFIG
(BOARD_INTEL_ADLRVP_N));
60
61
const
struct
mem_spd
memory_down_spd_info = {
62
.
topo
=
MEM_TOPO_MEMORY_DOWN
,
63
.cbfs_index =
get_spd_index
(),
64
};
65
66
const
struct
mem_spd
dimm_module_spd_info = {
67
.
topo
=
MEM_TOPO_DIMM_MODULE
,
68
.smbus = {
69
[0] = {
70
.addr_dimm[0] = 0x50,
71
.addr_dimm[1] = 0x51,
72
},
73
[1] = {
74
.addr_dimm[0] = 0x52,
75
.addr_dimm[1] = 0x53,
76
},
77
},
78
};
79
80
switch
(
board_id
) {
81
case
ADL_P_DDR4_1
:
82
case
ADL_P_DDR4_2
:
83
case
ADL_P_DDR5_1
:
84
memcfg_init
(memupd,
mem_config
, &dimm_module_spd_info, half_populated);
85
break
;
86
case
ADL_P_DDR5_2
:
87
case
ADL_P_LP4_1
:
88
case
ADL_P_LP4_2
:
89
case
ADL_P_LP5_1
:
90
case
ADL_P_LP5_2
:
91
case
ADL_M_LP4
:
92
case
ADL_M_LP5
:
93
case
ADL_N_LP5
:
94
memcfg_init
(memupd,
mem_config
, &memory_down_spd_info, half_populated);
95
break
;
96
default
:
97
die
(
"Unknown board id = 0x%x\n"
,
board_id
);
98
break
;
99
}
100
101
if
(
CONFIG
(GEN3_EXTERNAL_CLOCK_BUFFER))
102
configure_external_clksrc
(m_cfg);
103
}
memcfg_init
void memcfg_init(FSPM_UPD *memupd, const struct mb_cfg *mb_cfg, const struct mem_spd *spd_info, bool half_populated)
Definition:
meminit.c:238
assert.h
MEM_TOPO_DIMM_MODULE
@ MEM_TOPO_DIMM_MODULE
Definition:
meminit.h:26
MEM_TOPO_MEMORY_DOWN
@ MEM_TOPO_MEMORY_DOWN
Definition:
meminit.h:25
printk
#define printk(level,...)
Definition:
stdlib.h:16
die
void __noreturn die(const char *fmt,...)
Definition:
die.c:17
console.h
CONFIG
@ CONFIG
Definition:
dsi_common.h:201
board_id
uint32_t board_id(void)
board_id() - Get the board version
Definition:
ec_boardid.c:6
FSP_M_CONFIG
#define FSP_M_CONFIG
Definition:
fsp_upd.h:8
ADL_M_LP4
@ ADL_M_LP4
Definition:
variants.h:24
ADL_P_DDR5_2
@ ADL_P_DDR5_2
Definition:
variants.h:16
ADL_P_LP4_1
@ ADL_P_LP4_1
Definition:
variants.h:12
ADL_P_LP4_2
@ ADL_P_LP4_2
Definition:
variants.h:13
ADL_N_LP5
@ ADL_N_LP5
Definition:
variants.h:27
ADL_P_LP5_1
@ ADL_P_LP5_1
Definition:
variants.h:18
ADL_P_DDR4_2
@ ADL_P_DDR4_2
Definition:
variants.h:22
ADL_M_LP5
@ ADL_M_LP5
Definition:
variants.h:25
ADL_P_DDR5_1
@ ADL_P_DDR5_1
Definition:
variants.h:15
ADL_P_DDR4_1
@ ADL_P_DDR4_1
Definition:
variants.h:21
ADL_P_LP5_2
@ ADL_P_LP5_2
Definition:
variants.h:19
configure_external_clksrc
static void configure_external_clksrc(FSP_M_CONFIG *m_cfg)
Definition:
romstage_fsp_params.c:39
mainboard_memory_init_params
void mainboard_memory_init_params(FSPM_UPD *memupd)
Definition:
romstage_fsp_params.c:45
get_spd_index
static size_t get_spd_index(void)
Definition:
romstage_fsp_params.c:14
SPD_ID_MASK
#define SPD_ID_MASK
Definition:
romstage_fsp_params.c:12
BIOS_INFO
#define BIOS_INFO
BIOS_INFO - Expected events.
Definition:
loglevel.h:113
variant_memory_params
const struct mb_cfg *__weak variant_memory_params(void)
Definition:
memory.c:67
spd_index
static const int spd_index[32]
Definition:
memory.c:10
get_board_id
static uint8_t get_board_id(void)
Definition:
boardid.c:14
mem_config
static const struct mb_cfg mem_config
Definition:
memory.c:11
spd_bin.h
uint8_t
unsigned char uint8_t
Definition:
stdint.h:8
mb_cfg
Definition:
meminit.h:71
mem_spd
Definition:
meminit.h:37
mem_spd::topo
enum mem_topology topo
Definition:
meminit.h:38
board_id.h
src
mainboard
intel
adlrvp
romstage_fsp_params.c
Generated by
1.9.1