coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
fsp_params.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <assert.h>
4 #include <console/console.h>
5 #include <device/device.h>
6 #include <fsp/util.h>
7 #include <intelblocks/cpulib.h>
8 #include <soc/iomap.h>
9 #include <soc/pci_devs.h>
10 #include <soc/romstage.h>
11 #include <soc/soc_chip.h>
12 
15 {
16  unsigned int i;
17  uint32_t mask = 0;
18 
19  /*
20  * If IGD is enabled, set IGD stolen size to 60MB.
21  * Otherwise, skip IGD init in FSP.
22  */
23  m_cfg->InternalGfx = !CONFIG(SOC_INTEL_DISABLE_IGD) && is_devfn_enabled(SA_DEVFN_IGD);
24  m_cfg->IgdDvmt50PreAlloc = m_cfg->InternalGfx ? 0xFE : 0;
25 
26  m_cfg->TsegSize = CONFIG_SMM_TSEG_SIZE;
27  m_cfg->SaGv = config->SaGv;
28  m_cfg->RMT = config->RMT;
29 
30  /* PCIe root port configuration */
31  for (i = 0; i < ARRAY_SIZE(config->PcieRpEnable); i++) {
32  if (config->PcieRpEnable[i])
33  mask |= (1 << i);
34  }
35 
36  m_cfg->PcieRpEnableMask = mask;
37 
38  FSP_ARRAY_LOAD(m_cfg->PcieClkSrcUsage, config->PcieClkSrcUsage);
39  FSP_ARRAY_LOAD(m_cfg->PcieClkSrcClkReq, config->PcieClkSrcClkReq);
40 
41  m_cfg->PrmrrSize = get_valid_prmrr_size();
42 
43  /* Disable BIOS Guard */
44  m_cfg->BiosGuard = 0;
45 
46  /* Set CPU Ratio */
47  m_cfg->CpuRatio = 0;
48 
49  /* Set debug interface flags */
50  m_cfg->PcdDebugInterfaceFlags = CONFIG(DRIVERS_UART_8250IO) ?
51  DEBUG_INTERFACE_UART_8250IO : DEBUG_INTERFACE_LPSS_SERIAL_IO;
52 
53  /* TraceHub configuration */
54  if (is_devfn_enabled(PCH_DEVFN_TRACEHUB) && config->TraceHubMode) {
55  m_cfg->PcdDebugInterfaceFlags |= DEBUG_INTERFACE_TRACEHUB;
56  m_cfg->PchTraceHubMode = config->TraceHubMode;
57  m_cfg->CpuTraceHubMode = config->TraceHubMode;
58  }
59 
60  /* Change VmxEnable UPD value according to ENABLE_VMX Kconfig */
61  m_cfg->VmxEnable = CONFIG(ENABLE_VMX);
62 
63  /* PCH Master Gating Control */
64  m_cfg->PchMasterClockGating = 1;
65  m_cfg->PchMasterPowerGating = 1;
66 
67  /* Enable SMBus controller based on config */
68  m_cfg->SmbusEnable = config->SmbusEnable;
69 
70  /* Set debug probe type */
71  m_cfg->PlatformDebugConsent = CONFIG_SOC_INTEL_ELKHARTLAKE_DEBUG_CONSENT;
72 
73  /* DMAR related config */
74  m_cfg->VtdDisable = 0;
75  m_cfg->X2ApicOptOut = 0x1;
76  if (m_cfg->InternalGfx) {
77  m_cfg->VtdIgdEnable = 0x1;
78  m_cfg->DisableTeIgd = 0x1;
79  m_cfg->VtdBaseAddress[0] = GFXVT_BASE_ADDRESS;
80  }
81  m_cfg->VtdBaseAddress[2] = VTVC0_BASE_ADDRESS;
82 
83  /* DllBwEn0/1/2/3, per frequency */
84  m_cfg->DllBwEn0 = 0;
85  m_cfg->DllBwEn1 = 0;
86  m_cfg->DllBwEn2 = 0;
87  m_cfg->DllBwEn3 = 0;
88 
89  /* Disable and Lock Watch Dog Register */
90  m_cfg->WdtDisableAndLock = 0x1;
91 
92  m_cfg->HeciCommunication2 = config->Heci2Enable;
93  m_cfg->SerialIoUartDebugControllerNumber = CONFIG_UART_FOR_CONSOLE;
94 
95  /* Audio */
96  m_cfg->PchHdaEnable = is_devfn_enabled(PCH_DEVFN_HDA);
97  m_cfg->PchHdaDspEnable = config->PchHdaDspEnable;
98  m_cfg->PchHdaAudioLinkHdaEnable = config->PchHdaAudioLinkHdaEnable;
99 
100  FSP_ARRAY_LOAD(m_cfg->PchHdaSdiEnable, config->PchHdaSdiEnable);
101  FSP_ARRAY_LOAD(m_cfg->PchHdaAudioLinkDmicEnable, config->PchHdaAudioLinkDmicEnable);
102  FSP_ARRAY_LOAD(m_cfg->PchHdaAudioLinkSspEnable, config->PchHdaAudioLinkSspEnable);
103  FSP_ARRAY_LOAD(m_cfg->PchHdaAudioLinkSndwEnable, config->PchHdaAudioLinkSndwEnable);
104 
105  /* Skip the CPU replacement check */
106  m_cfg->SkipCpuReplacementCheck = config->SkipCpuReplacementCheck;
107 
108  /* Processor Early Power On Configuration FCLK setting */
109  m_cfg->FClkFrequency = 0x1;
110 
111  /* Ib-Band ECC configuration */
112  if (config->ibecc.enable) {
113  m_cfg->Ibecc = !!config->ibecc.enable;
114  m_cfg->IbeccParity = !!config->ibecc.parity_en;
115  m_cfg->IbeccOperationMode = config->ibecc.mode;
116  if (m_cfg->IbeccOperationMode == IBECC_PER_REGION) {
117  FSP_ARRAY_LOAD(m_cfg->IbeccProtectedRegionEnable,
118  config->ibecc.region_enable);
119  FSP_ARRAY_LOAD(m_cfg->IbeccProtectedRegionBase,
120  config->ibecc.region_base);
121  FSP_ARRAY_LOAD(m_cfg->IbeccProtectedRegionMask,
122  config->ibecc.region_mask);
123  }
124  }
125  /* PSE (Intel Programmable Services Engine) switch */
126  m_cfg->PchPseEnable = CONFIG(PSE_ENABLE) && cbfs_file_exists("pse.bin");
127 }
128 
130 {
132  FSP_M_CONFIG *m_cfg = &mupd->FspmConfig;
133 
135 
137 }
138 
140 {
141  printk(BIOS_DEBUG, "WEAK: %s/%s called\n", __FILE__, __func__);
142 }
__weak void mainboard_memory_init_params(FSPM_UPD *memupd)
Definition: fsp_params.c:389
void platform_fsp_memory_init_params_cb(FSPM_UPD *mupd, uint32_t version)
Definition: fsp_params.c:361
#define ARRAY_SIZE(a)
Definition: helpers.h:12
static bool cbfs_file_exists(const char *name)
Definition: cbfs.h:381
#define printk(level,...)
Definition: stdlib.h:16
int get_valid_prmrr_size(void)
Definition: cpulib.c:397
bool is_devfn_enabled(unsigned int devfn)
Definition: device_const.c:382
#define FSP_ARRAY_LOAD(dst, src)
Definition: util.h:20
@ CONFIG
Definition: dsi_common.h:201
static void soc_memory_init_params(FSP_M_CONFIG *m_cfg, const struct soc_intel_elkhartlake_config *config)
Definition: fsp_params.c:13
#define FSP_M_CONFIG
Definition: fsp_upd.h:8
#define config_of_soc()
Definition: device.h:394
unsigned int version[2]
Definition: edid.c:55
#define BIOS_DEBUG
BIOS_DEBUG - Verbose output.
Definition: loglevel.h:128
enum board_config config
Definition: memory.c:448
#define GFXVT_BASE_ADDRESS
Definition: memmap.h:18
#define VTVC0_BASE_ADDRESS
Definition: memmap.h:21
const struct smm_save_state_ops *legacy_ops __weak
Definition: save_state.c:8
#define PCH_DEVFN_TRACEHUB
Definition: pci_devs.h:222
#define PCH_DEVFN_HDA
Definition: pci_devs.h:218
#define SA_DEVFN_IGD
Definition: pci_devs.h:32
static const int mask[4]
Definition: gpio.c:308
@ IBECC_PER_REGION
Definition: chip.h:32
unsigned int uint32_t
Definition: stdint.h:14