Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/46555 )
Change subject: soc/intel/xeon_sp/cpx: Add txt_get_chipset_dpr callback ......................................................................
soc/intel/xeon_sp/cpx: Add txt_get_chipset_dpr callback
Change-Id: Id824324325d05b52fb2b9ced04fd3539cc37bd55 Signed-off-by: Arthur Heymans arthur@aheymans.xyz --- M src/soc/intel/xeon_sp/cpx/chip.c M src/soc/intel/xeon_sp/cpx/include/soc/pci_devs.h 2 files changed, 35 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/55/46555/1
diff --git a/src/soc/intel/xeon_sp/cpx/chip.c b/src/soc/intel/xeon_sp/cpx/chip.c index 11fe44b..c017d79 100644 --- a/src/soc/intel/xeon_sp/cpx/chip.c +++ b/src/soc/intel/xeon_sp/cpx/chip.c @@ -14,7 +14,9 @@ #include <soc/ramstage.h> #include <soc/pm.h> #include <soc/soc_util.h> +#include <soc/pci_devs.h> #include <stdlib.h> +#include <security/intel/txt/txt_platform.h>
/* C620 IOAPIC has 120 redirection entries */ #define C620_IOAPIC_REDIR_ENTRIES 120 @@ -558,6 +560,38 @@ DEV_FUNC_EXIT(dev); }
+union dpr_register txt_get_chipset_dpr(void) +{ + struct iiostack_resource info; + union dpr_register dpr; + const pci_devfn_t VTD = PCI_DEVFN(VTD_DEV, VTD_FUNC); + const struct device *dev = pcidev_path_on_root(VTD); + + if (dev == NULL) + die("Unable to find VTD PCI DEV"); + + dpr.raw = pci_read_config32(dev, VTD_LTDPR); + + get_iiostack_info(&info); + for (int s = 1; s < info.no_of_stacks; s++) { + uint8_t bus = info.res[s].BusBase; + dev = pcidev_path_on_bus(bus, VTD); + + if (dev == NULL) + die("Unable to find VTD PCI DEV"); + + union dpr_register test_dpr = { .raw = pci_read_config32(dev, VTD_LTDPR) }; + if (memcmp(&dpr, &test_dpr, sizeof(dpr))) { + printk(BIOS_ERR, "LTDPR not the same on all IIO's"); + /* TODO: Have the caller check this */ + dpr.raw = 0; + return dpr; + } + } + + return dpr; +} + struct pci_operations soc_pci_ops = { .set_subsystem = pci_dev_set_subsystem, }; diff --git a/src/soc/intel/xeon_sp/cpx/include/soc/pci_devs.h b/src/soc/intel/xeon_sp/cpx/include/soc/pci_devs.h index 965bb66..4d04105 100644 --- a/src/soc/intel/xeon_sp/cpx/include/soc/pci_devs.h +++ b/src/soc/intel/xeon_sp/cpx/include/soc/pci_devs.h @@ -70,6 +70,7 @@ #define VTD_CAP_LOW 0x08 #define VTD_CAP_HIGH 0x0C #define VTD_EXT_CAP_HIGH 0x14 +#define VTD_LTDPR 0x290
/* CPU Devices */ #define CBDMA_DEV_NUM 0x04