1 /* SPDX-License-Identifier: GPL-2.0-only */
4 #include <cpu/intel/microcode.h>
6 #include <fsp/fsp_debug_event.h>
7 #include <fsp/fsp_gop_blt.h>
8 #include <fsp/ppi/mp_service_ppi.h>
9 #include <intelblocks/irq.h>
10 #include <intelblocks/mp_init.h>
11 #include <intelblocks/systemagent.h>
12 #include <intelblocks/xdci.h>
13 #include <intelpch/lockdown.h>
16 #include <soc/intel/common/vbt.h>
18 #include <soc/ramstage.h>
21 #define MAX_ONBOARD_PCIE_DEVICES 256
23 /* THC assignment definition */
30 /* LPSS UART Power Gating mode */
32 LPSS_UART_PG_DISABLED
,
37 static const pci_devfn_t i2c_dev
[] = {
46 static const pci_devfn_t uart_dev
[] = {
52 static const pci_devfn_t gspi_dev
[] = {
59 * Chip config parameter PcieRpL1Substates uses (UPD value + 1)
60 * because UPD value of 0 for PcieRpL1Substates means disabled for FSP.
61 * In order to ensure that mainboard setting does not disable L1 substates
62 * incorrectly, chip config parameter values are offset by 1 with 0 meaning
63 * use FSP UPD default. get_l1_substate_control() ensures that the right UPD
64 * value is set in fsp_params.
65 * 0: Use FSP UPD default
66 * 1: Disable L1 substates
68 * 3: Use L1.2 (FSP UPD default)
70 static int get_l1_substate_control(enum L1_substates_control ctl
)
72 if (CONFIG(SOC_INTEL_COMPLIANCE_TEST_MODE
))
74 else if (ctl
> L1_SS_L1_2
|| ctl
== L1_SS_FSP_DEFAULT
)
80 * Chip config parameter pcie_rp_aspm uses (UPD value + 1) because
81 * a UPD value of 0 for pcie_rp_aspm means disabled. In order to ensure
82 * that the mainboard setting does not disable ASPM incorrectly, chip
83 * config parameter values are offset by 1 with 0 meaning use FSP UPD default.
84 * get_aspm_control() ensures that the right UPD value is set in fsp_params.
85 * 0: Use FSP UPD default
90 * 5: Auto configuration
92 static unsigned int get_aspm_control(enum ASPM_control ctl
)
94 if (ctl
> ASPM_AUTO
|| ctl
== ASPM_DEFAULT
)
99 __weak
void mainboard_update_soc_chip_config(struct soc_intel_pantherlake_config
*config
)
101 /* Override settings per board. */
104 static const struct slot_irq_constraints irq_constraints
[] = {
106 .slot
= PCI_DEV_SLOT_IGD
,
108 /* INTERRUPT_PIN is RO/0x01 */
109 FIXED_INT_ANY_PIRQ(PCI_DEVFN_IGD
, PCI_INT_A
),
113 .slot
= PCI_DEV_SLOT_DPTF
,
115 /* Dynamic Tuning Technology (DTT) device IRQ is not
116 programmable and is INT_A/PIRQ_A (IRQ 16) */
117 FIXED_INT_PIRQ(PCI_DEVFN_DPTF
, PCI_INT_A
, PIRQ_A
),
121 .slot
= PCI_DEV_SLOT_IPU
,
123 /* INTERRUPT_PIN is RO/0x01, and INTERRUPT_LINE is RW,
124 but S0ix fails when not set to 16 (b/193434192) */
125 FIXED_INT_PIRQ(PCI_DEVFN_IPU
, PCI_INT_A
, PIRQ_A
),
129 .slot
= PCI_DEV_SLOT_PCIE_2
,
131 FIXED_INT_PIRQ(PCI_DEVFN_PCIE9
, PCI_INT_A
, PIRQ_A
),
132 FIXED_INT_PIRQ(PCI_DEVFN_PCIE10
, PCI_INT_B
, PIRQ_B
),
133 #if CONFIG(SOC_INTEL_PANTHERLAKE_H)
134 FIXED_INT_PIRQ(PCI_DEVFN_PCIE11
, PCI_INT_C
, PIRQ_C
),
135 FIXED_INT_PIRQ(PCI_DEVFN_PCIE12
, PCI_INT_D
, PIRQ_D
),
140 .slot
= PCI_DEV_SLOT_TBT
,
142 ANY_PIRQ(PCI_DEVFN_TBT0
),
143 ANY_PIRQ(PCI_DEVFN_TBT1
),
144 ANY_PIRQ(PCI_DEVFN_TBT2
),
145 ANY_PIRQ(PCI_DEVFN_TBT3
),
149 .slot
= PCI_DEV_SLOT_NPU
,
151 /* INTERRUPT_PIN is RO/0x01 */
152 FIXED_INT_ANY_PIRQ(PCI_DEVFN_NPU
, PCI_INT_A
),
156 .slot
= PCI_DEV_SLOT_TCSS
,
158 ANY_PIRQ(PCI_DEVFN_TCSS_XHCI
),
162 .slot
= PCI_DEV_SLOT_THC
,
164 ANY_PIRQ(PCI_DEVFN_THC0
),
165 ANY_PIRQ(PCI_DEVFN_THC1
),
169 .slot
= PCI_DEV_SLOT_ISH
,
171 DIRECT_IRQ(PCI_DEVFN_ISH
),
175 .slot
= PCI_DEV_SLOT_XHCI
,
177 ANY_PIRQ(PCI_DEVFN_XHCI
),
178 DIRECT_IRQ(PCI_DEVFN_USBOTG
),
179 ANY_PIRQ(PCI_DEVFN_CNVI_WIFI
),
183 .slot
= PCI_DEV_SLOT_SIO0
,
185 DIRECT_IRQ(PCI_DEVFN_I2C0
),
186 DIRECT_IRQ(PCI_DEVFN_I2C1
),
187 DIRECT_IRQ(PCI_DEVFN_I2C2
),
188 DIRECT_IRQ(PCI_DEVFN_I2C3
),
192 .slot
= PCI_DEV_SLOT_CSE
,
194 ANY_PIRQ(PCI_DEVFN_CSE
),
195 ANY_PIRQ(PCI_DEVFN_CSE_2
),
196 ANY_PIRQ(PCI_DEVFN_CSE_IDER
),
197 ANY_PIRQ(PCI_DEVFN_CSE_KT
),
198 ANY_PIRQ(PCI_DEVFN_CSE_3
),
199 ANY_PIRQ(PCI_DEVFN_CSE_4
),
202 #if CONFIG(SOC_INTEL_PANTHERLAKE_U_H)
204 .slot
= PCI_DEV_SLOT_UFS
,
206 ANY_PIRQ(PCI_DEVFN_UFS
),
211 .slot
= PCI_DEV_SLOT_SIO1
,
213 DIRECT_IRQ(PCI_DEVFN_I2C4
),
214 DIRECT_IRQ(PCI_DEVFN_I2C5
),
215 DIRECT_IRQ(PCI_DEVFN_UART2
),
219 .slot
= PCI_DEV_SLOT_PCIE_1
,
221 FIXED_INT_PIRQ(PCI_DEVFN_PCIE1
, PCI_INT_A
, PIRQ_A
),
222 FIXED_INT_PIRQ(PCI_DEVFN_PCIE2
, PCI_INT_B
, PIRQ_B
),
223 FIXED_INT_PIRQ(PCI_DEVFN_PCIE3
, PCI_INT_C
, PIRQ_C
),
224 FIXED_INT_PIRQ(PCI_DEVFN_PCIE4
, PCI_INT_D
, PIRQ_D
),
225 FIXED_INT_PIRQ(PCI_DEVFN_PCIE5
, PCI_INT_A
, PIRQ_A
),
226 FIXED_INT_PIRQ(PCI_DEVFN_PCIE6
, PCI_INT_B
, PIRQ_B
),
227 FIXED_INT_PIRQ(PCI_DEVFN_PCIE7
, PCI_INT_C
, PIRQ_C
),
228 FIXED_INT_PIRQ(PCI_DEVFN_PCIE8
, PCI_INT_D
, PIRQ_D
),
232 .slot
= PCI_DEV_SLOT_SIO2
,
234 /* UART0 shares an interrupt line with TSN0, so must use
236 FIXED_INT_ANY_PIRQ(PCI_DEVFN_UART0
, PCI_INT_A
),
237 /* UART1 shares an interrupt line with TSN1, so must use
239 FIXED_INT_ANY_PIRQ(PCI_DEVFN_UART1
, PCI_INT_B
),
240 DIRECT_IRQ(PCI_DEVFN_GSPI0
),
241 DIRECT_IRQ(PCI_DEVFN_GSPI1
),
245 .slot
= PCI_DEV_SLOT_ESPI
,
247 ANY_PIRQ(PCI_DEVFN_HDA
),
248 ANY_PIRQ(PCI_DEVFN_SMBUS
),
249 ANY_PIRQ(PCI_DEVFN_GBE
),
250 /* INTERRUPT_PIN is RO/0x01 */
251 FIXED_INT_ANY_PIRQ(PCI_DEVFN_NPK
, PCI_INT_A
),
256 static void fill_fsps_lpss_params(FSP_S_CONFIG
*s_cfg
,
257 const struct soc_intel_pantherlake_config
*config
)
261 for (i
= 0; i
< CONFIG_SOC_INTEL_I2C_DEV_MAX
; i
++)
262 s_cfg
->SerialIoI2cMode
[i
] =
263 is_devfn_enabled(i2c_dev
[i
]) ? config
->serial_io_i2c_mode
[i
] : 0;
265 for (i
= 0; i
< CONFIG_SOC_INTEL_COMMON_BLOCK_GSPI_MAX
; i
++) {
266 s_cfg
->SerialIoLpssSpiCsMode
[i
] = config
->serial_io_gspi_cs_mode
[i
];
267 s_cfg
->SerialIoLpssSpiCsState
[i
] = config
->serial_io_gspi_cs_state
[i
];
268 s_cfg
->SerialIoLpssSpiMode
[i
] =
269 is_devfn_enabled(gspi_dev
[i
]) ? config
->serial_io_gspi_mode
[i
] : 0;
272 for (i
= 0; i
< CONFIG_SOC_INTEL_UART_DEV_MAX
; i
++) {
273 s_cfg
->SerialIoUartMode
[i
] = is_devfn_enabled(uart_dev
[i
]) ?
274 config
->serial_io_uart_mode
[i
] : 0;
275 s_cfg
->SerialIoUartPowerGating
[i
] = is_devfn_enabled(uart_dev
[i
]) ?
276 LPSS_UART_PG_ENABLED
: LPSS_UART_PG_AUTO
;
280 static void fill_fsps_cpu_params(FSP_S_CONFIG
*s_cfg
,
281 const struct soc_intel_pantherlake_config
*config
)
283 if (!CONFIG(USE_INTEL_FSP_TO_CALL_COREBOOT_PUBLISH_MP_PPI
))
286 s_cfg
->CpuMpPpi
= (uintptr_t)mp_fill_ppi_services_data();
289 static void fill_fsps_microcode_params(FSP_S_CONFIG
*s_cfg
,
290 const struct soc_intel_pantherlake_config
*config
)
292 const struct microcode
*microcode
;
295 if (!CONFIG(USE_FSP_FEATURE_PROGRAM_ON_APS
))
298 /* Locate microcode and pass to FSP-S for 2nd microcode loading */
299 microcode
= intel_microcode_find();
303 length
= get_microcode_size(microcode
);
307 /* Update CPU Microcode patch base address/size */
308 s_cfg
->MicrocodeRegionBase
= (uint32_t)(uintptr_t)microcode
;
309 s_cfg
->MicrocodeRegionSize
= (uint32_t)length
;
312 static void fill_fsps_igd_params(FSP_S_CONFIG
*s_cfg
,
313 const struct soc_intel_pantherlake_config
*config
)
315 /* Load VBT before devicetree-specific config. */
316 s_cfg
->GraphicsConfigPtr
= (uintptr_t)vbt_get();
318 /* Check if IGD is present and fill Graphics init param accordingly */
319 s_cfg
->PeiGraphicsPeimInit
= CONFIG(RUN_FSP_GOP
) && is_devfn_enabled(PCI_DEVFN_IGD
);
320 s_cfg
->LidStatus
= CONFIG(VBOOT_LID_SWITCH
) ? get_lid_switch() : CONFIG(RUN_FSP_GOP
);
321 s_cfg
->PavpEnable
= CONFIG(PAVP
);
324 static void fill_fsps_tcss_params(FSP_S_CONFIG
*s_cfg
,
325 const struct soc_intel_pantherlake_config
*config
)
327 s_cfg
->TcssAuxOri
= config
->tcss_aux_ori
;
329 /* Explicitly clear this field to avoid using defaults */
330 memset(s_cfg
->IomTypeCPortPadCfg
, 0, sizeof(s_cfg
->IomTypeCPortPadCfg
));
332 /* D3Cold for TCSS */
333 s_cfg
->D3ColdEnable
= !config
->tcss_d3_cold_disable
;
334 s_cfg
->UsbTcPortEn
= 0;
336 for (size_t i
= 0; i
< MAX_TYPE_C_PORTS
; i
++)
337 if (config
->tcss_ports
[i
].enable
)
338 s_cfg
->UsbTcPortEn
|= BIT(i
);
341 static void fill_fsps_chipset_lockdown_params(FSP_S_CONFIG
*s_cfg
,
342 const struct soc_intel_pantherlake_config
*config
)
344 /* Chipset Lockdown */
345 const bool lockdown_by_fsp
= get_lockdown_config() == CHIPSET_LOCKDOWN_FSP
;
347 s_cfg
->PchLockDownGlobalSmi
= lockdown_by_fsp
;
348 s_cfg
->PchLockDownBiosInterface
= lockdown_by_fsp
;
349 s_cfg
->PchUnlockGpioPads
= !lockdown_by_fsp
;
350 s_cfg
->RtcMemoryLock
= lockdown_by_fsp
;
351 s_cfg
->SkipPamLock
= !lockdown_by_fsp
;
353 /* coreboot will send EOP before loading payload */
354 s_cfg
->EndOfPostMessage
= 0; /* EOP disable */
356 s_cfg
->CpuCrashLogEnable
= CONFIG(SOC_INTEL_CRASHLOG
);
359 static void fill_fsps_xhci_params(FSP_S_CONFIG
*s_cfg
,
360 const struct soc_intel_pantherlake_config
*config
)
364 for (i
= 0; i
< CONFIG_SOC_INTEL_USB2_DEV_MAX
; i
++) {
365 s_cfg
->PortUsb20Enable
[i
] = config
->usb2_ports
[i
].enable
;
366 s_cfg
->Usb2PhyPetxiset
[i
] = config
->usb2_ports
[i
].pre_emp_bias
;
367 s_cfg
->Usb2PhyTxiset
[i
] = config
->usb2_ports
[i
].tx_bias
;
368 s_cfg
->Usb2PhyPredeemp
[i
] = config
->usb2_ports
[i
].tx_emp_enable
;
369 s_cfg
->Usb2PhyPehalfbit
[i
] = config
->usb2_ports
[i
].pre_emp_bit
;
371 if (config
->usb2_ports
[i
].enable
)
372 s_cfg
->Usb2OverCurrentPin
[i
] = config
->usb2_ports
[i
].ocpin
;
374 s_cfg
->Usb2OverCurrentPin
[i
] = OC_SKIP
;
376 s_cfg
->PortResetMessageEnable
[i
] = config
->usb2_ports
[i
].type_c
;
379 for (i
= 0; i
< CONFIG_SOC_INTEL_USB3_DEV_MAX
; i
++) {
380 s_cfg
->PortUsb30Enable
[i
] = config
->usb3_ports
[i
].enable
;
381 if (config
->usb3_ports
[i
].enable
)
382 s_cfg
->Usb3OverCurrentPin
[i
] = config
->usb3_ports
[i
].ocpin
;
384 s_cfg
->Usb3OverCurrentPin
[i
] = OC_SKIP
;
386 if (config
->usb3_ports
[i
].tx_de_emp
) {
387 s_cfg
->Usb3HsioTxDeEmphEnable
[i
] = 1;
388 s_cfg
->Usb3HsioTxDeEmph
[i
] = config
->usb3_ports
[i
].tx_de_emp
;
390 if (config
->usb3_ports
[i
].tx_downscale_amp
) {
391 s_cfg
->Usb3HsioTxDownscaleAmpEnable
[i
] = 1;
392 s_cfg
->Usb3HsioTxDownscaleAmp
[i
] =
393 config
->usb3_ports
[i
].tx_downscale_amp
;
397 for (i
= 0; i
< MAX_TYPE_C_PORTS
; i
++)
398 if (config
->tcss_ports
[i
].enable
)
399 s_cfg
->CpuUsb3OverCurrentPin
[i
] = config
->tcss_ports
[i
].ocpin
;
402 static void fill_fsps_xdci_params(FSP_S_CONFIG
*s_cfg
,
403 const struct soc_intel_pantherlake_config
*config
)
405 s_cfg
->XdciEnable
= xdci_can_enable(PCI_DEVFN_USBOTG
);
408 static void fill_fsps_thermal_params(FSP_S_CONFIG
*s_cfg
,
409 const struct soc_intel_pantherlake_config
*config
)
411 s_cfg
->Device4Enable
= is_devfn_enabled(PCI_DEVFN_DPTF
);
414 static const SI_PCH_DEVICE_INTERRUPT_CONFIG
*pci_irq_to_fsp(size_t *out_count
)
416 const struct pci_irq_entry
*entry
= get_cached_pci_irqs();
417 SI_PCH_DEVICE_INTERRUPT_CONFIG
*config
;
418 size_t pch_total
= 0, cfg_count
= 0;
423 /* Count PCH devices */
425 if (is_pch_slot(entry
->devfn
))
430 /* Convert PCH device entries to FSP format */
431 config
= calloc(pch_total
, sizeof(*config
));
432 entry
= get_cached_pci_irqs();
434 if (!is_pch_slot(entry
->devfn
)) {
439 config
[cfg_count
].Device
= PCI_SLOT(entry
->devfn
);
440 config
[cfg_count
].Function
= PCI_FUNC(entry
->devfn
);
441 config
[cfg_count
].IntX
= (SI_PCH_INT_PIN
)entry
->pin
;
442 config
[cfg_count
].Irq
= entry
->irq
;
448 *out_count
= cfg_count
;
453 static void fill_fsps_irq_params(FSP_S_CONFIG
*s_cfg
,
454 const struct soc_intel_pantherlake_config
*config
)
456 if (!assign_pci_irqs(irq_constraints
, ARRAY_SIZE(irq_constraints
)))
457 die("ERROR: Unable to assign PCI IRQs, and no _PRT table available\n");
459 size_t pch_count
= 0;
460 const SI_PCH_DEVICE_INTERRUPT_CONFIG
*upd_irqs
= pci_irq_to_fsp(&pch_count
);
462 s_cfg
->DevIntConfigPtr
= (UINT32
)((uintptr_t)upd_irqs
);
463 s_cfg
->NumOfDevIntConfig
= pch_count
;
464 printk(BIOS_INFO
, "IRQ: Using dynamically assigned PCI IO-APIC IRQs\n");
467 static void evaluate_ssid(const struct device
*dev
, uint16_t *svid
, uint16_t *ssid
)
469 if (!(dev
&& svid
&& ssid
))
472 *svid
= CONFIG_SUBSYSTEM_VENDOR_ID
? : (dev
->subsystem_vendor
? : 0x8086);
473 *ssid
= CONFIG_SUBSYSTEM_DEVICE_ID
? : (dev
->subsystem_device
? : 0xfffe);
477 * Programming SSID before FSP-S is important because SSID registers of a few PCIE
478 * devices (e.g. IPU, Crashlog, XHCI, TCSS_XHCI etc.) are locked after FSP-S hence
479 * provide a custom SSID (same as DID by default) value via UPD.
481 static void fill_fsps_pci_ssid_params(FSP_S_CONFIG
*s_cfg
,
482 const struct soc_intel_pantherlake_config
*config
)
484 struct svid_ssid_init_entry
{
504 static struct svid_ssid_init_entry ssid_table
[MAX_ONBOARD_PCIE_DEVICES
];
505 const struct device
*dev
;
508 for (dev
= all_devices
; dev
; dev
= dev
->next
) {
509 if (!(is_dev_enabled(dev
) && dev
->path
.type
== DEVICE_PATH_PCI
&&
510 dev
->upstream
->secondary
== 0))
513 if (dev
->path
.pci
.devfn
== PCI_DEVFN_ROOT
) {
514 evaluate_ssid(dev
, &s_cfg
->SiCustomizedSvid
, &s_cfg
->SiCustomizedSsid
);
516 ssid_table
[i
].reg
= PCI_SUBSYSTEM_VENDOR_ID
;
517 ssid_table
[i
].device
= PCI_SLOT(dev
->path
.pci
.devfn
);
518 ssid_table
[i
].function
= PCI_FUNC(dev
->path
.pci
.devfn
);
519 evaluate_ssid(dev
, &ssid_table
[i
].svid
, &ssid_table
[i
].ssid
);
524 s_cfg
->SiSsidTablePtr
= (uintptr_t)ssid_table
;
525 s_cfg
->SiNumberOfSsidTableEntry
= i
;
527 /* Ensure FSP will program the registers */
528 s_cfg
->SiSkipSsidProgramming
= 0;
531 static void fill_fsps_lan_params(FSP_S_CONFIG
*s_cfg
,
532 const struct soc_intel_pantherlake_config
*config
)
534 s_cfg
->PchLanEnable
= is_devfn_enabled(PCI_DEVFN_GBE
);
537 static void fill_fsps_cnvi_params(FSP_S_CONFIG
*s_cfg
,
538 const struct soc_intel_pantherlake_config
*config
)
540 s_cfg
->CnviMode
= is_devfn_enabled(PCI_DEVFN_CNVI_WIFI
);
541 s_cfg
->CnviWifiCore
= config
->cnvi_wifi_core
;
542 s_cfg
->CnviBtCore
= config
->cnvi_bt_core
;
543 s_cfg
->CnviBtAudioOffload
= config
->cnvi_bt_audio_offload
;
545 if (!s_cfg
->CnviMode
&& s_cfg
->CnviWifiCore
) {
546 printk(BIOS_ERR
, "CNVi WiFi is enabled without CNVi being enabled\n");
547 s_cfg
->CnviWifiCore
= 0;
549 if (!s_cfg
->CnviBtCore
&& s_cfg
->CnviBtAudioOffload
) {
550 printk(BIOS_ERR
, "BT offload is enabled without CNVi BT being enabled\n");
551 s_cfg
->CnviBtAudioOffload
= 0;
553 if (!s_cfg
->CnviMode
&& s_cfg
->CnviBtCore
) {
554 printk(BIOS_ERR
, "CNVi BT is enabled without CNVi being enabled\n");
555 s_cfg
->CnviBtCore
= 0;
556 s_cfg
->CnviBtAudioOffload
= 0;
559 s_cfg
->CnviBtInterface
= is_devfn_enabled(PCI_DEVFN_CNVI_BT
) ? 2 : 1;
562 static void fill_fsps_pmcpd_params(FSP_S_CONFIG
*s_cfg
,
563 const struct soc_intel_pantherlake_config
*config
)
565 s_cfg
->PmcPdEnable
= 1;
568 static void fill_fsps_thc_params(FSP_S_CONFIG
*s_cfg
,
569 const struct soc_intel_pantherlake_config
*config
)
571 s_cfg
->ThcAssignment
[0] = is_devfn_enabled(PCI_DEVFN_THC0
) ? THC_0
: THC_NONE
;
572 s_cfg
->ThcAssignment
[1] = is_devfn_enabled(PCI_DEVFN_THC1
) ? THC_1
: THC_NONE
;
575 static void fill_fsps_8254_params(FSP_S_CONFIG
*s_cfg
,
576 const struct soc_intel_pantherlake_config
*config
)
578 bool use_8254
= get_uint_option("legacy_8254_timer", CONFIG(USE_LEGACY_8254_TIMER
));
579 s_cfg
->Enable8254ClockGating
= !use_8254
;
580 s_cfg
->Enable8254ClockGatingOnS3
= !use_8254
;
583 static void fill_fsps_pm_timer_params(FSP_S_CONFIG
*s_cfg
,
584 const struct soc_intel_pantherlake_config
*config
)
587 * Legacy PM ACPI Timer (and TCO Timer)
588 * This *must* be 1 in any case to keep FSP from
589 * 1) enabling PM ACPI Timer emulation in uCode.
590 * 2) disabling the PM ACPI Timer.
591 * We handle both by ourself!
593 s_cfg
->EnableTcoTimer
= 1;
596 static void fill_fsps_pcie_params(FSP_S_CONFIG
*s_cfg
,
597 const struct soc_intel_pantherlake_config
*config
)
599 uint32_t enable_mask
= pcie_rp_enable_mask(get_pcie_rp_table());
601 for (size_t i
= 0; i
< CONFIG_MAX_ROOT_PORTS
; i
++) {
602 const struct pcie_rp_config
*rp_cfg
= &config
->pcie_rp
[i
];
603 if (!(enable_mask
& BIT(i
)))
605 s_cfg
->PcieRpL1Substates
[i
] =
606 get_l1_substate_control(rp_cfg
->PcieRpL1Substates
);
607 s_cfg
->PcieRpLtrEnable
[i
] = !!(rp_cfg
->flags
& PCIE_RP_LTR
);
608 s_cfg
->PcieRpAdvancedErrorReporting
[i
] = !!(rp_cfg
->flags
& PCIE_RP_AER
);
609 s_cfg
->PcieRpHotPlug
[i
] =
610 !!(rp_cfg
->flags
& PCIE_RP_HOTPLUG
) || CONFIG(SOC_INTEL_COMPLIANCE_TEST_MODE
);
611 s_cfg
->PcieRpClkReqDetect
[i
] = !!(rp_cfg
->flags
& PCIE_RP_CLK_REQ_DETECT
);
612 if (rp_cfg
->pcie_rp_aspm
)
613 s_cfg
->PcieRpAspm
[i
] = get_aspm_control(rp_cfg
->pcie_rp_aspm
);
616 s_cfg
->PcieComplianceTestMode
= CONFIG(SOC_INTEL_COMPLIANCE_TEST_MODE
);
619 static void fill_fsps_misc_power_params(FSP_S_CONFIG
*s_cfg
,
620 const struct soc_intel_pantherlake_config
*config
)
622 /* Skip setting D0I3 bit for all HECI devices */
623 s_cfg
->DisableD0I3SettingForHeci
= 1;
627 /* Enable the energy efficient turbo mode */
628 s_cfg
->EnergyEfficientTurbo
= 1;
629 s_cfg
->PmcLpmS0ixSubStateEnableMask
= get_supported_lpm_mask();
630 /* Un-Demotion from Demoted C1 need to be disable when
631 C1 auto demotion is disabled. */
632 s_cfg
->C1StateUnDemotion
= !config
->disable_c1_state_auto_demotion
;
633 s_cfg
->C1StateAutoDemotion
= !config
->disable_c1_state_auto_demotion
;
634 s_cfg
->PkgCStateDemotion
= !config
->disable_package_c_state_demotion
;
635 s_cfg
->PkgCStateUnDemotion
= !config
->disable_package_c_state_demotion
;
636 s_cfg
->PmcV1p05PhyExtFetControlEn
= 1;
638 /* Enable/Disable PCH to CPU energy report feature. */
639 s_cfg
->PchPmDisableEnergyReport
= !config
->pch_pm_energy_report_enable
;
642 static void fill_fsps_npu_params(FSP_S_CONFIG
*s_cfg
,
643 const struct soc_intel_pantherlake_config
*config
)
645 s_cfg
->NpuEnable
= is_devfn_enabled(PCI_DEVFN_NPU
);
648 static void fill_fsps_audio_params(FSP_S_CONFIG
*s_cfg
,
649 const struct soc_intel_pantherlake_config
*config
)
651 if (!is_devfn_enabled(PCI_DEVFN_HDA
))
654 /* Fill MIC privacy settings */
655 s_cfg
->PchHdaMicPrivacyHwModeSoundWire0
= 1;
656 s_cfg
->PchHdaMicPrivacyHwModeSoundWire1
= 1;
657 s_cfg
->PchHdaMicPrivacyHwModeSoundWire2
= 1;
658 s_cfg
->PchHdaMicPrivacyHwModeSoundWire3
= 1;
659 s_cfg
->PchHdaMicPrivacyHwModeSoundWire4
= 1;
660 s_cfg
->PchHdaMicPrivacyHwModeDmic
= 1;
663 static void fill_fsps_iax_params(FSP_S_CONFIG
*s_cfg
,
664 const struct soc_intel_pantherlake_config
*config
)
666 s_cfg
->IaxEnable
= is_devfn_enabled(PCI_DEVFN_IAA
);
669 static void fill_fsps_ufs_params(FSP_S_CONFIG
*s_cfg
,
670 const struct soc_intel_pantherlake_config
*config
)
672 #if CONFIG(SOC_INTEL_PANTHERLAKE_U_H)
673 /* Setting FSP UPD (1,0) to enable controller 0 */
674 s_cfg
->UfsEnable
[0] = is_devfn_enabled(PCI_DEVFN_UFS
);
675 s_cfg
->UfsEnable
[1] = 0;
677 /* Setting FSP UPD (0,0) to keep both controllers disabled */
678 s_cfg
->UfsEnable
[0] = 0;
679 s_cfg
->UfsEnable
[1] = 0;
683 static void arch_silicon_init_params(FSPS_ARCH2_UPD
*s_arch_cfg
)
685 /* Assign FspEventHandler arch Upd to use coreboot debug event handler */
686 if (CONFIG(FSP_USES_CB_DEBUG_EVENT_HANDLER
)
687 && CONFIG(CONSOLE_SERIAL
)
688 && CONFIG(FSP_ENABLE_SERIAL_DEBUG
))
689 s_arch_cfg
->FspEventHandler
= (uintptr_t)((FSP_EVENT_HANDLER
*)
690 fsp_debug_event_handler
);
694 static void soc_silicon_init_params(FSP_S_CONFIG
*s_cfg
,
695 const struct soc_intel_pantherlake_config
*config
)
697 void (*fill_fsps_params
[])(FSP_S_CONFIG
*s_cfg
,
698 const struct soc_intel_pantherlake_config
*config
) = {
699 fill_fsps_lpss_params
,
700 fill_fsps_cpu_params
,
701 fill_fsps_microcode_params
,
702 fill_fsps_igd_params
,
703 fill_fsps_tcss_params
,
704 fill_fsps_chipset_lockdown_params
,
705 fill_fsps_xhci_params
,
706 fill_fsps_xdci_params
,
707 fill_fsps_thermal_params
,
708 fill_fsps_irq_params
,
709 fill_fsps_pci_ssid_params
,
710 fill_fsps_lan_params
,
711 fill_fsps_cnvi_params
,
712 fill_fsps_pmcpd_params
,
713 fill_fsps_thc_params
,
714 fill_fsps_8254_params
,
715 fill_fsps_pm_timer_params
,
716 fill_fsps_pcie_params
,
717 fill_fsps_misc_power_params
,
718 fill_fsps_npu_params
,
719 fill_fsps_audio_params
,
720 fill_fsps_iax_params
,
721 fill_fsps_ufs_params
,
724 for (size_t i
= 0; i
< ARRAY_SIZE(fill_fsps_params
); i
++)
725 fill_fsps_params
[i
](s_cfg
, config
);
728 /* UPD parameters to be initialized before SiliconInit */
729 void platform_fsp_silicon_init_params_cb(FSPS_UPD
*supd
)
731 struct soc_intel_pantherlake_config
*config
;
732 FSP_S_CONFIG
*s_cfg
= &supd
->FspsConfig
;
733 FSPS_ARCH2_UPD
*s_arch_cfg
= &supd
->FspsArchUpd
;
735 config
= config_of_soc();
736 arch_silicon_init_params(s_arch_cfg
);
737 /* Override settings per board if required. */
738 mainboard_update_soc_chip_config(config
);
739 soc_silicon_init_params(s_cfg
, config
);
740 mainboard_silicon_init_params(s_cfg
);
744 * Callbacks for SoC/Mainboard specific overrides for FspMultiPhaseSiInit
745 * This platform supports below MultiPhaseSIInit Phase(s):
747 * Phase | FSP return point | Purpose
748 * ----- + -------------------------------------+ ------------------------
749 * 1 | After TCSS initialization completed | for TCSS specific init
751 void platform_fsp_silicon_multi_phase_init_cb(uint32_t phase_index
)
753 switch (phase_index
) {
755 /* TCSS specific initialization here */
756 printk(BIOS_DEBUG
, "FSP MultiPhaseSiInit %s/%s called\n",
759 if (CONFIG(SOC_INTEL_COMMON_BLOCK_TCSS
)) {
760 const struct soc_intel_pantherlake_config
*config
= config_of_soc();
761 tcss_configure(config
->typec_aux_bias_pads
);
769 /* Mainboard GPIO Configuration */
770 __weak
void mainboard_silicon_init_params(FSP_S_CONFIG
*s_cfg
)
772 printk(BIOS_DEBUG
, "WEAK: %s/%s called\n", __FILE__
, __func__
);
775 /* Handle FSP logo params */
776 void soc_load_logo(FSPS_UPD
*supd
)
778 efi_uintn_t logo
, blt_size
;
781 fsp_convert_bmp_to_gop_blt(&logo
, &logo_size
,
782 &supd
->FspsConfig
.BltBufferAddress
,
784 &supd
->FspsConfig
.LogoPixelHeight
,
785 &supd
->FspsConfig
.LogoPixelWidth
);