diff options
author | Patrick Rudolph <patrick.rudolph@9elements.com> | 2024-01-16 08:44:25 +0100 |
---|---|---|
committer | Lean Sheng Tan <sheng.tan@9elements.com> | 2024-01-31 17:05:05 +0000 |
commit | 8cfb4dc489ad30476b4c6ae57636e7a1e25398b0 (patch) | |
tree | e0d266999e3b77266dbcf2ff8006694dcacdfa2d /src/soc/intel | |
parent | 15672599e411bb39b9f63b8fc2fb8233f3c62ece (diff) |
soc/intel/xeon_sp: Find VTD devices by PCI DEV ID
Instead of manually crafting S:B:D:F numbers for every
VTD device loop over the entire devicetree by PCI DEV IDs.
This adds PCI multi-segment support without any further code
modifications, since the correct PCI segment will be stored in the
devicetree.
Change-Id: I1c24d26e105c3dcbd9cca0e7197ab1362344aa96
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/80092
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Shuo Liu <shuo.liu@intel.com>
Diffstat (limited to 'src/soc/intel')
-rw-r--r-- | src/soc/intel/xeon_sp/memmap.c | 36 |
1 files changed, 10 insertions, 26 deletions
diff --git a/src/soc/intel/xeon_sp/memmap.c b/src/soc/intel/xeon_sp/memmap.c index a9236a90a9..8fe21e8430 100644 --- a/src/soc/intel/xeon_sp/memmap.c +++ b/src/soc/intel/xeon_sp/memmap.c @@ -4,6 +4,7 @@ #include <cbmem.h> #include <console/console.h> #include <device/pci_ops.h> +#include <device/pci_ids.h> #include <cpu/x86/smm.h> #include <soc/soc_util.h> #include <soc/pci_devs.h> @@ -53,7 +54,6 @@ void fill_postcar_frame(struct postcar_frame *pcf) #if !defined(__SIMPLE_DEVICE__) union dpr_register txt_get_chipset_dpr(void) { - const IIO_UDS *hob = get_iio_uds(); union dpr_register dpr; struct device *dev = VTD_DEV(0); @@ -66,31 +66,15 @@ union dpr_register txt_get_chipset_dpr(void) dpr.raw = pci_read_config32(dev, VTD_LTDPR); - /* Compare the LTDPR register on all iio stacks */ - for (int socket = 0, iio = 0; iio < hob->PlatformData.numofIIO; ++socket) { - if (!soc_cpu_is_enabled(socket)) - continue; - iio++; - for (int stack = 0; stack < MAX_IIO_STACK; ++stack) { - const STACK_RES *ri = - &hob->PlatformData.IIO_resource[socket].StackRes[stack]; - if (ri->VtdBarAddress == 0) - continue; - uint8_t bus = ri->BusBase; - dev = VTD_DEV(bus); - - if (!dev) { - printk(BIOS_ERR, "BUS %x: Unable to find VTD PCI dev\n", bus); - dpr.raw = 0; - return dpr; - } - - union dpr_register test_dpr = { .raw = pci_read_config32(dev, VTD_LTDPR) }; - if (dpr.raw != test_dpr.raw) { - printk(BIOS_ERR, "LTDPR not the same on all IIO's"); - dpr.raw = 0; - return dpr; - } + dev = NULL; + /* Look for VTD devices on all sockets */ + while ((dev = dev_find_device(PCI_VID_INTEL, MMAP_VTD_STACK_CFG_REG_DEVID, dev))) { + /* Compare the LTDPR register on all iio stacks */ + union dpr_register test_dpr = { .raw = pci_read_config32(dev, VTD_LTDPR) }; + if (dpr.raw != test_dpr.raw) { + printk(BIOS_ERR, "LTDPR not the same on all IIO's"); + dpr.raw = 0; + return dpr; } } return dpr; |