coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
romstage.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <assert.h>
4 #include <fsp/soc_binding.h>
5 #include <soc/romstage.h>
6 #include <spd_bin.h>
7 #include <string.h>
8 #include <types.h>
9 
10 /* Rcomp resistors are located on the CPU package */
11 static const u16 rcomp_resistors[3] = { 121, 75, 100 };
12 
13 /* Rcomp targets for RdOdt, WrDS, WrDSCmd, WrDSCtl, WrDSClk */
14 static const u16 rcomp_targets[5] = { 50, 26, 20, 20, 26 };
15 
16 void mainboard_memory_init_params(FSPM_UPD *mupd)
17 {
18  FSP_M_CONFIG *const mem_cfg = &mupd->FspmConfig;
19 
20  struct spd_block blk = {
21  .addr_map = { 0x51, 0x50 },
22  };
23 
24  get_spd_smbus(&blk);
25 
26  mem_cfg->CaVrefConfig = 2;
27  mem_cfg->DqPinsInterleaved = true;
28 
29  mem_cfg->MemorySpdDataLen = blk.len;
30  mem_cfg->MemorySpdPtr00 = (u32)blk.spd_array[0];
31  mem_cfg->MemorySpdPtr10 = (u32)blk.spd_array[1];
32 
33  assert(sizeof(mem_cfg->RcompResistor) == sizeof(rcomp_resistors));
34  assert(sizeof(mem_cfg->RcompTarget) == sizeof(rcomp_targets));
35 
36  memcpy(mem_cfg->RcompResistor, rcomp_resistors, sizeof(mem_cfg->RcompResistor));
37  memcpy(mem_cfg->RcompTarget, rcomp_targets, sizeof(mem_cfg->RcompTarget));
38 
39  /* These settings are most likely useless if using a release build of FSP */
40  mem_cfg->PcdDebugInterfaceFlags = 2; /* Enable UART */
41  mem_cfg->PcdSerialIoUartNumber = 2; /* Use UART #2 */
42  mem_cfg->PcdSerialDebugBaudRate = 7; /* 115200 baud */
43  mem_cfg->PcdSerialDebugLevel = 3; /* Log <= Info */
44 
45  /* Trace Hub */
46  mem_cfg->PcdDebugInterfaceFlags |= 1 << 5;
47 
48  /* Allow changing memory timings after MRC is done */
49  mem_cfg->RealtimeMemoryTiming = 1;
50  mem_cfg->SaOcSupport = 1;
51 }
void * memcpy(void *dest, const void *src, size_t n)
Definition: memcpy.c:7
#define assert(statement)
Definition: assert.h:74
#define FSP_M_CONFIG
Definition: fsp_upd.h:8
void mainboard_memory_init_params(FSPM_UPD *mupd)
Definition: romstage.c:22
static const u16 rcomp_targets[5]
Definition: romstage.c:14
static const u16 rcomp_resistors[3]
Definition: romstage.c:11
void get_spd_smbus(struct spd_block *blk)
Definition: smbuslib.c:72
uint32_t u32
Definition: stdint.h:51
uint16_t u16
Definition: stdint.h:48
Definition: ddr4.c:86
u8 addr_map[CONFIG_DIMM_MAX]
Definition: spd_bin.h:39
u8 * spd_array[CONFIG_DIMM_MAX]
Definition: spd_bin.h:40
uint16_t len
Definition: ddr4.c:89