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 <boardid.h>
4 #include <string.h>
5 #include <fsp/soc_binding.h>
6 #include <soc/romstage.h>
7 #include <console/console.h>
8 #include "spd/spd.h"
9 
10 void mainboard_memory_init_params(FSPM_UPD *mupd)
11 {
12  FSP_M_CONFIG *mem_cfg = &mupd->FspmConfig;
13  /* DQ byte map */
14  const u8 dq_map[2][12] = {
15  { 0x0F, 0xF0, 0x00, 0xF0, 0x0F, 0xF0,
16  0x0F, 0x00, 0xFF, 0x00, 0xFF, 0x00 },
17  { 0x33, 0xCC, 0x00, 0xCC, 0x33, 0xCC,
18  0x33, 0x00, 0xFF, 0x00, 0xFF, 0x00 } };
19  /* DQS CPU<>DRAM map */
20  const u8 dqs_map[2][8] = {
21  { 1, 0, 2, 3, 4, 5, 6, 7 },
22  { 1, 0, 5, 4, 2, 3, 7, 6 } };
23  /* Rcomp resistor */
24  const u16 rcomp_resistor[] = { 200, 81, 162 };
25  /* Rcomp target */
26  const u16 rcomp_target[] = { 100, 40, 40, 23, 40 };
27 
28  memcpy(&mem_cfg->DqByteMapCh0, dq_map[0], sizeof(dq_map[0]));
29  memcpy(&mem_cfg->DqByteMapCh1, dq_map[1], sizeof(dq_map[1]));
30  memcpy(&mem_cfg->DqsMapCpu2DramCh0, dqs_map[0], sizeof(dqs_map[0]));
31  memcpy(&mem_cfg->DqsMapCpu2DramCh1, dqs_map[1], sizeof(dqs_map[1]));
32  memcpy(&mem_cfg->RcompResistor, rcomp_resistor, sizeof(rcomp_resistor));
33  memcpy(&mem_cfg->RcompTarget, rcomp_target, sizeof(rcomp_target));
34 
35  mem_cfg->MemorySpdPtr00 = mainboard_get_spd_data();
36  mem_cfg->MemorySpdPtr10 = mem_cfg->MemorySpdPtr00;
37  mem_cfg->MemorySpdDataLen = SPD_LEN;
38 
39  /* Limit K4EBE304EB-EGCF memory to 1600MHz for stability */
40  if (board_id() < 6 && mainboard_get_spd_index() == 5) {
41  printk(BIOS_WARNING, "Limiting memory to 1600MHz\n");
42  mem_cfg->DdrFreqLimit = 1600;
43  }
44 }
void * memcpy(void *dest, const void *src, size_t n)
Definition: memcpy.c:7
#define printk(level,...)
Definition: stdlib.h:16
uint32_t board_id(void)
board_id() - Get the board version
Definition: ec_boardid.c:6
#define FSP_M_CONFIG
Definition: fsp_upd.h:8
#define BIOS_WARNING
BIOS_WARNING - Bad configuration.
Definition: loglevel.h:86
void mainboard_memory_init_params(FSPM_UPD *mupd)
Definition: romstage.c:22
#define SPD_LEN
Definition: spd.c:22
int mainboard_get_spd_index(void)
Definition: spd.c:64
static uintptr_t mainboard_get_spd_data(enum memory_type type, bool use_sec_spd)
Definition: romstage.c:102
static const u16 rcomp_target[]
Definition: memory.c:26
static const u8 dqs_map[][8]
Definition: memory.c:17
static const u16 rcomp_resistor[]
Definition: memory.c:23
static const u8 dq_map[][12]
Definition: memory.c:9
uint16_t u16
Definition: stdint.h:48
uint8_t u8
Definition: stdint.h:45