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 <arch/mmio.h>
4
#include <baseboard/variants.h>
5
#include <
console/console.h
>
6
#include <
device/dram/common.h
>
7
#include <hwilib.h>
8
#include <soc/meminit.h>
9
#include <soc/romstage.h>
10
#include <
string.h
>
11
#include <types.h>
12
13
void
mainboard_memory_init_params
(FSPM_UPD *memupd)
14
{
15
static
struct
spd_info
spd_info
;
16
const
struct
mb_cfg
*
board_cfg
=
variant_memcfg_config
();
17
static
uint8_t
spd_data
[CONFIG_DIMM_SPD_SIZE];
18
const
char
*cbfs_hwi_name =
"hwinfo.hex"
;
19
20
/* Initialize SPD information for LPDDR4x from HW-Info primarily with a fallback to
21
spd.bin in the case where the SPD data in HW-Info is not available or invalid. */
22
memset
(
spd_data
, 0,
sizeof
(
spd_data
));
23
if
((hwilib_find_blocks(cbfs_hwi_name) ==
CB_SUCCESS
) &&
24
(hwilib_get_field(SPD,
spd_data
, 0x80) == 0x80) &&
25
(
ddr_crc16
(
spd_data
, 126) ==
read16
((
void
*)&
spd_data
[126]))) {
26
spd_info
.
spd_spec
.
spd_data_ptr_info
.
spd_data_ptr
= (
uintptr_t
)
spd_data
;
27
spd_info
.
spd_spec
.
spd_data_ptr_info
.
spd_data_len
= CONFIG_DIMM_SPD_SIZE;
28
spd_info
.
read_type
=
READ_SPD_MEMPTR
;
29
}
else
{
30
printk
(
BIOS_WARNING
,
"SPD in HW-Info not valid, fall back to spd.bin!\n"
);
31
spd_info
.
read_type
=
READ_SPD_CBFS
;
32
spd_info
.
spd_spec
.
spd_index
= 0x00;
33
}
34
/* Initialize variant specific configurations */
35
memcfg_init
(&memupd->FspmConfig,
board_cfg
, &
spd_info
,
false
);
36
37
/* Enable Row-Hammer prevention */
38
memupd->FspmConfig.RhPrevention = 1;
39
}
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
read16
static uint16_t read16(const void *addr)
Definition:
mmio.h:17
memset
void * memset(void *dstpp, int c, size_t len)
Definition:
memset.c:12
CB_SUCCESS
@ CB_SUCCESS
Call completed successfully.
Definition:
cb_err.h:16
READ_SPD_MEMPTR
@ READ_SPD_MEMPTR
Definition:
cnl_memcfg_init.h:37
READ_SPD_CBFS
@ READ_SPD_CBFS
Definition:
cnl_memcfg_init.h:36
printk
#define printk(level,...)
Definition:
stdlib.h:16
console.h
ddr_crc16
u16 ddr_crc16(const u8 *ptr, int n_crc)
Calculate the CRC of a DDR SPD data.
Definition:
ddr_common.c:14
variant_memcfg_config
const struct mb_cfg * variant_memcfg_config(void)
Definition:
memory.c:46
common.h
mainboard_memory_init_params
void mainboard_memory_init_params(FSPM_UPD *memupd)
Definition:
romstage_fsp_params.c:45
BIOS_WARNING
#define BIOS_WARNING
BIOS_WARNING - Bad configuration.
Definition:
loglevel.h:86
board_cfg
static const struct mb_cfg board_cfg
Definition:
romstage.c:8
spd_data
static u8 spd_data[CONFIG_DIMM_MAX *CONFIG_DIMM_SPD_SIZE]
Definition:
smbuslib.c:70
uintptr_t
unsigned long uintptr_t
Definition:
stdint.h:21
uint8_t
unsigned char uint8_t
Definition:
stdint.h:8
string.h
mb_cfg
Definition:
meminit.h:71
spd_by_pointer::spd_data_ptr
uintptr_t spd_data_ptr
Definition:
cnl_memcfg_init.h:30
spd_by_pointer::spd_data_len
size_t spd_data_len
Definition:
cnl_memcfg_init.h:29
spd_info
Definition:
spd.h:11
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
spd_info::spd_data_by::spd_data_ptr_info
struct spd_by_pointer spd_data_ptr_info
Definition:
cnl_memcfg_init.h:50
src
mainboard
siemens
mc_ehl
romstage_fsp_params.c
Generated by
1.9.1