blob: 3cfa2819c2242f8fb42e9d8a9fd10c03d0b83cdf [file] [log] [blame]
Rizwan Qureshi742c6fe2018-09-18 22:43:41 +05301/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2018 Intel Corp.
5 *
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.
9 *
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.
14 */
15
16#include <assert.h>
17#include <chip.h>
18#include <console/console.h>
19#include <fsp/util.h>
20#include <soc/iomap.h>
21#include <soc/pci_devs.h>
22#include <soc/romstage.h>
23
24static void soc_memory_init_params(FSP_M_CONFIG *m_cfg, const config_t *config)
25{
26 unsigned int i;
27 uint32_t mask = 0;
28
29 /* Set IGD stolen size to 64MB. */
30 m_cfg->IgdDvmt50PreAlloc = 2;
31 m_cfg->TsegSize = CONFIG_SMM_TSEG_SIZE;
32 m_cfg->IedSize = CONFIG_IED_REGION_SIZE;
33 m_cfg->SaGv = config->SaGv;
praveen hodagatta pranesh521e48c2018-09-27 00:00:13 +080034 if (IS_ENABLED(CONFIG_SOC_INTEL_CANNONLAKE_PCH_H))
praveen hodagatta praneshe26c4a42018-09-20 03:49:45 +080035 m_cfg->UserBd = BOARD_TYPE_DESKTOP;
36 else
37 m_cfg->UserBd = BOARD_TYPE_ULT_ULX;
Rizwan Qureshi742c6fe2018-09-18 22:43:41 +053038 m_cfg->RMT = config->RMT;
39
40 for (i = 0; i < ARRAY_SIZE(config->PcieRpEnable); i++) {
41 if (config->PcieRpEnable[i])
42 mask |= (1 << i);
43 }
44 m_cfg->PcieRpEnableMask = mask;
45 m_cfg->PrmrrSize = config->PrmrrSize;
46 m_cfg->EnableC6Dram = config->enable_c6dram;
47 /* Disable Cpu Ratio Override temporary. */
48 m_cfg->CpuRatio = 0;
49 m_cfg->PcdSerialIoUartNumber = CONFIG_UART_FOR_CONSOLE;
50 /* Disable Vmx if Vt-d is already disabled */
51 if (config->VtdDisable)
52 m_cfg->VmxEnable = 0;
53 else
54 m_cfg->VmxEnable = config->VmxEnable;
55#if IS_ENABLED(CONFIG_SOC_INTEL_COFFEELAKE)
56 m_cfg->SkipMpInit = !chip_get_fsp_mp_init();
57#endif
58}
59
60void platform_fsp_memory_init_params_cb(FSPM_UPD *mupd, uint32_t version)
61{
62 const struct device *dev = dev_find_slot(0, PCH_DEVFN_LPC);
63 assert(dev != NULL);
64 const config_t *config = dev->chip_info;
65 FSP_M_CONFIG *m_cfg = &mupd->FspmConfig;
66
67 soc_memory_init_params(m_cfg, config);
68
69 /* Enable SMBus controller based on config */
70 m_cfg->SmbusEnable = config->SmbusEnable;
71 /* Set debug probe type */
72 m_cfg->PlatformDebugConsent = config->DebugConsent;
73
74 mainboard_memory_init_params(mupd);
75}
76
77__weak void mainboard_memory_init_params(FSPM_UPD *mupd)
78{
79 printk(BIOS_DEBUG, "WEAK: %s/%s called\n", __FILE__, __func__);
80}