2 * This file is part of the coreboot project.
4 * Copyright (C) 2016-2018 Intel Corporation.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
17 #include <console/console.h>
21 #include <soc/romstage.h>
28 void mainboard_memory_init_params(FSPM_UPD
*mupd
)
30 FSP_M_CONFIG
*mem_cfg
;
31 mem_cfg
= &mupd
->FspmConfig
;
33 if (get_spd_index(&spd_index
) < 0)
36 printk(BIOS_INFO
, "SPD index %d\n", spd_index
);
38 mainboard_fill_dq_map_data(&mem_cfg
->DqByteMapCh0
,
39 &mem_cfg
->DqByteMapCh1
);
40 mainboard_fill_dqs_map_data(&mem_cfg
->DqsMapCpu2DramCh0
,
41 &mem_cfg
->DqsMapCpu2DramCh1
);
42 mainboard_fill_rcomp_res_data(&mem_cfg
->RcompResistor
);
43 mainboard_fill_rcomp_strength_data(&mem_cfg
->RcompTarget
);
45 if (CONFIG(BOARD_INTEL_KBLRVP3
)) {
46 struct region_device spd_rdev
;
48 mem_cfg
->DqPinsInterleaved
= 0;
49 if (get_spd_cbfs_rdev(&spd_rdev
, spd_index
) < 0)
50 die("spd.bin not found\n");
51 mem_cfg
->MemorySpdDataLen
= region_device_sz(&spd_rdev
);
52 /* Memory leak is ok since we have memory mapped boot media */
53 mem_cfg
->MemorySpdPtr00
= (uintptr_t)rdev_mmap_full(&spd_rdev
);
54 } else { /* CONFIG_BOARD_INTEL_KBLRVP7 and CONFIG_BOARD_INTEL_KBLRVP8 */
55 struct spd_block blk
= {
56 .addr_map
= { 0x50, 0x51, 0x52, 0x53, },
59 mem_cfg
->DqPinsInterleaved
= 1;
61 mem_cfg
->MemorySpdDataLen
= blk
.len
;
62 mem_cfg
->MemorySpdPtr00
= (uintptr_t)blk
.spd_array
[0];
63 mem_cfg
->MemorySpdPtr10
= (uintptr_t)blk
.spd_array
[2];
65 switch (get_board_id()) {
66 case BOARD_ID_KBL_RVP8
:
67 case BOARD_ID_KBL_RVP11
:
68 mem_cfg
->MemorySpdPtr01
= (uintptr_t)blk
.spd_array
[1];
69 mem_cfg
->MemorySpdPtr11
= (uintptr_t)blk
.spd_array
[3];
70 mem_cfg
->UserBd
= BOARD_TYPE_DESKTOP
;
76 mupd
->FspmTestConfig
.DmiVc1
= 1;