| 1 |
|
| 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> |
| 9 |
#include <gpio.h> |
| 10 |
#include <intelblocks/acpi.h> |
| 11 |
#include <intelblocks/lpc_lib.h> |
| 12 |
#include <intelblocks/p2sb.h> |
| 13 |
#include <soc/acpi.h> |
| 14 |
#include <soc/chip_common.h> |
| 15 |
#include <soc/numa.h> |
| 16 |
#include <soc/pch.h> |
| 17 |
#include <soc/soc_pch.h> |
| 18 |
#include <soc/ramstage.h> |
| 19 |
#include <soc/p2sb.h> |
| 20 |
#include <soc/soc_util.h> |
| 21 |
#include <soc/util.h> |
| 22 |
#include <soc/pci_devs.h> |
| 23 |
|
| 24 |
|
| 25 |
void platform_fsp_silicon_init_params_cb(FSPS_UPD *silupd) |
| 26 |
{ |
| 27 |
mainboard_silicon_init_params(silupd); |
| 28 |
} |
| 29 |
|
| 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, |
| 35 |
}; |
| 36 |
|
| 37 |
struct pci_operations soc_pci_ops = { |
| 38 |
.set_subsystem = pci_dev_set_subsystem, |
| 39 |
}; |
| 40 |
|
| 41 |
static void chip_enable_dev(struct device *dev) |
| 42 |
{ |
| 43 |
|
| 44 |
if (dev->path.type == DEVICE_PATH_DOMAIN) { |
| 45 |
|
| 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); |
| 50 |
} |
| 51 |
} |
| 52 |
|
| 53 |
static void iio_write_mask(u16 bus, u16 dev, u8 func) |
| 54 |
{ |
| 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); |
| 59 |
|
| 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); |
| 63 |
} |
| 64 |
|
| 65 |
static void iio_dmi_en_masks(void) |
| 66 |
{ |
| 67 |
pci_devfn_t device; |
| 68 |
u32 val; |
| 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); |
| 73 |
|
| 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); |
| 77 |
} |
| 78 |
|
| 79 |
static void iio_enable_masks(void) |
| 80 |
{ |
| 81 |
struct iiostack_resource iio = {0}; |
| 82 |
get_iiostack_info(&iio); |
| 83 |
int i, k; |
| 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__, |
| 89 |
st->BusBase, k, 0); |
| 90 |
iio_write_mask(st->BusBase, k, 0); |
| 91 |
} |
| 92 |
} |
| 93 |
} |
| 94 |
iio_dmi_en_masks(); |
| 95 |
} |
| 96 |
|
| 97 |
static void set_imc_locks(void) |
| 98 |
{ |
| 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); |
| 102 |
} |
| 103 |
|
| 104 |
static void set_upi_locks(void) |
| 105 |
{ |
| 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); |
| 109 |
} |
| 110 |
|
| 111 |
static void chip_final(void *data) |
| 112 |
{ |
| 113 |
|
| 114 |
pci_or_config32(PCH_DEV_P2SB, P2SBC, SBILOCK); |
| 115 |
|
| 116 |
|
| 117 |
pci_or_config32(pcidev_path_on_root(PCI_DEVFN(0, 0)), 0x80, 1 << 0); |
| 118 |
|
| 119 |
set_imc_locks(); |
| 120 |
set_upi_locks(); |
| 121 |
|
| 122 |
p2sb_hide(); |
| 123 |
iio_enable_masks(); |
| 124 |
} |
| 125 |
|
| 126 |
static void chip_init(void *data) |
| 127 |
{ |
| 128 |
printk(BIOS_DEBUG, "coreboot: calling fsp_silicon_init\n"); |
| 129 |
fsp_silicon_init(); |
| 130 |
|
| 131 |
setup_pds(); |
| 132 |
attach_iio_stacks(); |
| 133 |
|
| 134 |
override_hpet_ioapic_bdf(); |
| 135 |
pch_enable_ioapic(); |
| 136 |
pch_lock_dmictl(); |
| 137 |
p2sb_unhide(); |
| 138 |
} |
| 139 |
|
| 140 |
struct chip_operations soc_intel_xeon_sp_cpx_ops = { |
| 141 |
.name = "Intel Cooper Lake-SP", |
| 142 |
.enable_dev = chip_enable_dev, |
| 143 |
.init = chip_init, |
| 144 |
.final = chip_final, |
| 145 |
}; |