blob: 4bfc2f3bea65e6bd04ac616cf2084d0b43b9577b [file] [log] [blame]
Lee Leahyc4210412015-06-29 11:37:56 -07001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2014 Google Inc.
5 * Copyright (C) 2015 Intel Corporation.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
Lee Leahyb993d2f2015-07-17 11:07:54 -070018 * Foundation, Inc.
Lee Leahyc4210412015-06-29 11:37:56 -070019 */
20
21#include <stdint.h>
22#include <string.h>
23#include <soc/pei_data.h>
24#include <soc/pei_wrapper.h>
pchandrie57e7262015-09-14 14:11:38 -070025#include "boardid.h"
26
27/* PCH_MEM_CFG[3:0] */
28#define MAX_MEMORY_CONFIG 0x10
29#define RCOMP_TARGET_PARAMS 0x5
Lee Leahyc4210412015-06-29 11:37:56 -070030
31void mainboard_fill_pei_data(struct pei_data *pei_data)
32{
Duncan Laurie74b964e2015-09-04 10:41:02 -070033 /* DQ byte map */
Lee Leahyc4210412015-06-29 11:37:56 -070034 const u8 dq_map[2][12] = {
Duncan Laurie74b964e2015-09-04 10:41:02 -070035 { 0x0F, 0xF0, 0x00, 0xF0, 0x0F, 0xF0 ,
36 0x0F, 0x00, 0xFF, 0x00, 0xFF, 0x00 },
37 { 0x0F, 0xF0, 0x00, 0xF0, 0x0F, 0xF0 ,
38 0x0F, 0x00, 0xFF, 0x00, 0xFF, 0x00 } };
39 /* DQS CPU<>DRAM map */
Lee Leahyc4210412015-06-29 11:37:56 -070040 const u8 dqs_map[2][8] = {
Duncan Laurie74b964e2015-09-04 10:41:02 -070041 { 0, 1, 3, 2, 6, 5, 4, 7 },
42 { 2, 3, 0, 1, 6, 7, 4, 5 } };
Lee Leahyc4210412015-06-29 11:37:56 -070043
Duncan Laurie74b964e2015-09-04 10:41:02 -070044 /* Rcomp resistor */
45 const u16 RcompResistor[3] = { 200, 81, 162 };
Lee Leahyc4210412015-06-29 11:37:56 -070046
Duncan Laurie74b964e2015-09-04 10:41:02 -070047 /* Rcomp target */
pchandrie57e7262015-09-14 14:11:38 -070048 static const u16 RcompTarget[MAX_MEMORY_CONFIG][RCOMP_TARGET_PARAMS] = {
49 { 100, 40, 40, 23, 40 },
50 { 100, 40, 40, 23, 40 },
51 { 100, 40, 40, 23, 40 },
52 /*Strengthen the Rcomp Target Ctrl for 8GB K4E6E304EE -EGCF*/
53 { 100, 40, 40, 21, 40 }, };
54
Lee Leahyc4210412015-06-29 11:37:56 -070055
56 memcpy(pei_data->dq_map, dq_map, sizeof(dq_map));
57 memcpy(pei_data->dqs_map, dqs_map, sizeof(dqs_map));
58 memcpy(pei_data->RcompResistor, RcompResistor,
59 sizeof(RcompResistor));
pchandrie57e7262015-09-14 14:11:38 -070060 memcpy(pei_data->RcompTarget, &RcompTarget[pei_data->mem_cfg_id][0],
61 sizeof(RcompTarget[pei_data->mem_cfg_id]));
62
Lee Leahyc4210412015-06-29 11:37:56 -070063}