1 /* SPDX-License-Identifier: GPL-2.0-only */
2 #include <acpi/acpigen_pci.h>
3 #include <arch/ioapic.h>
4 #include <console/console.h>
5 #include <console/debug.h>
6 #include <cpu/x86/mp.h>
7 #include <device/pci.h>
8 #include <device/pci_ids.h>
10 #include <intelblocks/acpi.h>
11 #include <intelblocks/lpc_lib.h>
12 #include <intelblocks/p2sb.h>
14 #include <soc/chip_common.h>
17 #include <soc/soc_pch.h>
18 #include <soc/ramstage.h>
20 #include <soc/soc_util.h>
22 #include <soc/pci_devs.h>
24 /* UPD parameters to be initialized before SiliconInit */
25 void platform_fsp_silicon_init_params_cb(FSPS_UPD
*silupd
)
27 mainboard_silicon_init_params(silupd
);
30 static struct device_operations cpu_bus_ops
= {
31 .read_resources
= noop_read_resources
,
32 .set_resources
= noop_set_resources
,
33 .init
= mp_cpu_bus_init
,
34 .acpi_fill_ssdt
= generate_cpu_entries
,
37 struct pci_operations soc_pci_ops
= {
38 .set_subsystem
= pci_dev_set_subsystem
,
41 static void chip_enable_dev(struct device
*dev
)
43 /* Set the operations if it is a special bus type */
44 if (dev
->path
.type
== DEVICE_PATH_DOMAIN
) {
45 /* domain ops are assigned at their creation */
46 } else if (dev
->path
.type
== DEVICE_PATH_CPU_CLUSTER
) {
47 dev
->ops
= &cpu_bus_ops
;
48 } else if (dev
->path
.type
== DEVICE_PATH_GPIO
) {
49 block_gpio_enable(dev
);
53 static void iio_write_mask(u16 bus
, u16 dev
, u8 func
)
55 pci_devfn_t device
= PCI_DEV(bus
, dev
, func
);
56 u32 val
= pci_s_read_config32(device
, IIO_XPUNCCERRMSK_REG
);
57 val
|= (SENT_PCIE_UNSUPP_MASK
| RCVD_PCIE_CA_STS_MASK
| RCVD_PCIE_UR_STS_MASK
);
58 pci_s_write_config32(device
, IIO_XPUNCCERRMSK_REG
, val
);
60 val
= pci_s_read_config32(device
, RP_UNCERRMSK
);
61 val
|= (SURPRISE_DWN_ERR_MSK
| UNSUPPORTED_REQ_ERR_MSK
);
62 pci_s_write_config32(device
, RP_UNCERRMSK
, val
);
65 static void iio_dmi_en_masks(void)
69 device
= PCI_DEV(DMI_BUS_INDEX
, DMI_DEV
, DMI_FUNC
);
70 val
= pci_s_read_config32(device
, IIO_XPUNCCERRMSK_REG
);
71 val
|= (SENT_PCIE_UNSUPP_MASK
| RCVD_PCIE_CA_STS_MASK
| RCVD_PCIE_UR_STS_MASK
);
72 pci_s_write_config32(device
, IIO_XPUNCCERRMSK_REG
, val
);
74 val
= pci_s_read_config32(device
, DMI_UNCERRMSK
);
75 val
|= (ECRC_ERR
| MLFRMD_TLP
| RCV_BUF_OVRFLOW
| FLOW_CNTR
| POISON_TLP
| DLL_PRT_ERR
);
76 pci_s_write_config32(device
, DMI_UNCERRMSK
, val
);
79 static void iio_enable_masks(void)
81 struct iiostack_resource iio
= {0};
82 get_iiostack_info(&iio
);
84 for (i
= 0; i
< iio
.no_of_stacks
; i
++) {
85 const STACK_RES
*st
= &iio
.res
[i
];
86 if (st
->BusBase
> 0 && st
->BusBase
!= 0xff) {
87 for (k
= 0; k
< DEVICES_PER_IIO_STACK
; k
++) {
88 printk(BIOS_DEBUG
, "%s: bus:%x dev:%x func:%x\n", __func__
,
90 iio_write_mask(st
->BusBase
, k
, 0);
97 static void set_imc_locks(void)
99 struct device
*dev
= 0;
100 while ((dev
= dev_find_device(PCI_VID_INTEL
, IMC_M2MEM_DEVID
, dev
)))
101 pci_or_config32(dev
, IMC_M2MEM_TIMEOUT
, TIMEOUT_LOCK
);
104 static void set_upi_locks(void)
106 struct device
*dev
= 0;
107 while ((dev
= dev_find_device(PCI_VID_INTEL
, UPI_LL_CR_DEVID
, dev
)))
108 pci_or_config32(dev
, UPI_LL_CR_KTIMISCMODLCK
, KTIMISCMODLCK_LOCK
);
111 static void chip_final(void *data
)
114 pci_or_config32(PCH_DEV_P2SB
, P2SBC
, SBILOCK
);
117 pci_or_config32(pcidev_path_on_root(PCI_DEVFN(0, 0)), 0x80, 1 << 0);
126 static void chip_init(void *data
)
128 printk(BIOS_DEBUG
, "coreboot: calling fsp_silicon_init\n");
134 override_hpet_ioapic_bdf();
140 struct chip_operations soc_intel_xeon_sp_cpx_ops
= {
141 .name
= "Intel Cooper Lake-SP",
142 .enable_dev
= chip_enable_dev
,