Attention is currently required from: Arthur Heymans, Christian Walter, Johnny Lin, Tim Chu.

Patrick Rudolph has uploaded this change for review.

View Change

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>
---
M src/soc/intel/xeon_sp/memmap.c
1 file changed, 10 insertions(+), 26 deletions(-)

git pull ssh://review.coreboot.org:29418/coreboot refs/changes/92/80092/1
diff --git a/src/soc/intel/xeon_sp/memmap.c b/src/soc/intel/xeon_sp/memmap.c
index e73143f..8fe21e8 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 @@
#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 @@

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 (!stack_needs_resource_alloc(ri))
- 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;

To view, visit change 80092. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: main
Gerrit-Change-Id: I1c24d26e105c3dcbd9cca0e7197ab1362344aa96
Gerrit-Change-Number: 80092
Gerrit-PatchSet: 1
Gerrit-Owner: Patrick Rudolph <patrick.rudolph@9elements.com>
Gerrit-Reviewer: Arthur Heymans <arthur@aheymans.xyz>
Gerrit-Reviewer: Christian Walter <christian.walter@9elements.com>
Gerrit-Reviewer: Johnny Lin <Johnny_Lin@wiwynn.com>
Gerrit-Reviewer: Tim Chu <Tim.Chu@quantatw.com>
Gerrit-Attention: Johnny Lin <Johnny_Lin@wiwynn.com>
Gerrit-Attention: Christian Walter <christian.walter@9elements.com>
Gerrit-Attention: Arthur Heymans <arthur@aheymans.xyz>
Gerrit-Attention: Tim Chu <Tim.Chu@quantatw.com>
Gerrit-MessageType: newchange