soc/intel/xeon_sp: Lock down IIO DFX Global registers
This is required for CbNT.
Change-Id: I565a95cd2e76cb1c648884be6d1954288f6e4804
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/47447
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
diff --git a/src/soc/intel/xeon_sp/uncore.c b/src/soc/intel/xeon_sp/uncore.c
index 2663023..7679f2f 100644
--- a/src/soc/intel/xeon_sp/uncore.c
+++ b/src/soc/intel/xeon_sp/uncore.c
@@ -374,3 +374,34 @@
.vendor = PCI_VENDOR_ID_INTEL,
.device = DMI3_DEVID,
};
+
+static void iio_dfx_global_init(struct device *dev)
+{
+ uint16_t reg16;
+ pci_or_config16(dev, IIO_DFX_LCK_CTL, 0x3ff);
+ reg16 = pci_read_config16(dev, IIO_DFX_TSWCTL0);
+ reg16 &= ~(1 << 4); // allow ib mmio cfg
+ reg16 &= ~(1 << 5); // ignore acs p2p ma lpbk
+ reg16 |= (1 << 3); // me disable
+ pci_write_config16(dev, IIO_DFX_TSWCTL0, reg16);
+}
+
+static const unsigned short iio_dfx_global_ids[] = {
+ 0x202d,
+ 0x203d,
+ 0
+};
+
+static struct device_operations iio_dfx_global_ops = {
+ .read_resources = pci_dev_read_resources,
+ .set_resources = pci_dev_set_resources,
+ .enable_resources = pci_dev_enable_resources,
+ .init = iio_dfx_global_init,
+ .ops_pci = &soc_pci_ops,
+};
+
+static const struct pci_driver iio_dfx_global_driver __pci_driver = {
+ .ops = &iio_dfx_global_ops,
+ .vendor = PCI_VENDOR_ID_INTEL,
+ .devices = iio_dfx_global_ids,
+};