soc/intel/xeon_sp/numa: Store pointer to device

Instead of a BDF number store a pointer to the device itself.

Change-Id: I3fef93c5e54c8af792102bcd25364c43b554a5f0
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/80257
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Shuo Liu <shuo.liu@intel.com>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
This commit is contained in:
Patrick Rudolph 2024-01-31 11:31:55 +01:00 committed by Felix Held
parent bb41e69588
commit f25d58c9a5
5 changed files with 9 additions and 8 deletions

View File

@ -41,7 +41,7 @@ struct proximity_domain {
/*
* Below fields are set to 0 for processor domains.
*/
uint32_t device_handle; /* This holds PCIe device segment, BDF info */
struct device *dev;
uint32_t base; /* Memory region base address in the unit of 64MB */
uint32_t size; /* Memory region size in the unit of 64MB */
};

View File

@ -199,7 +199,7 @@ static void rcec_init(struct device *dev)
for (i = 0; i < pds.num_pds; i++) {
if (pds.pds[i].pd_type == PD_TYPE_PROCESSOR)
continue;
ep_bus = pds.pds[i].device_handle >> 20;
ep_bus = PCI_BDF(pds.pds[i].dev) >> 20;
if (ep_bus == ecrc_bus + 1)
break;
}

View File

@ -19,7 +19,7 @@ void dump_pds(void)
printk(BIOS_DEBUG, "\tproximity domain %d:\n", i);
printk(BIOS_DEBUG, "\t\ttype:%d\n", pds.pds[i].pd_type);
printk(BIOS_DEBUG, "\t\tsocket_bitmap:0x%x\n", pds.pds[i].socket_bitmap);
printk(BIOS_DEBUG, "\t\tdevice_handle:0x%x\n", pds.pds[i].device_handle);
printk(BIOS_DEBUG, "\t\tdevice:%s\n", pds.pds[i].dev ? dev_path(pds.pds[i].dev) : "");
printk(BIOS_DEBUG, "\t\tbase(64MB):0x%x\n", pds.pds[i].base);
printk(BIOS_DEBUG, "\t\tsize(64MB):0x%x\n", pds.pds[i].size);
}
@ -85,7 +85,7 @@ enum cb_err fill_pds(void)
pds.pds[i].base = node.Address;
pds.pds[i].size = node.Size;
dev = pcie_find_dsn(node.SerialNumber, node.VendorId, 0);
pds.pds[i].device_handle = PCI_BDF(dev);
pds.pds[i].dev = dev;
pds.pds[i].distances = malloc(sizeof(uint8_t) * pds.num_pds);
if (!pds.pds[i].distances)
die("%s %d out of memory.", __FILE__, __LINE__);

View File

@ -91,7 +91,7 @@ bool is_iio_cxl_stack_res(const STACK_RES *res)
if (pds.pds[i].pd_type == PD_TYPE_PROCESSOR)
continue;
uint32_t bus = pds.pds[i].device_handle >> 20;
uint32_t bus = PCI_BDF(pds.pds[i].dev) >> 20;
if (bus >= res->BusBase && bus <= res->BusLimit)
return true;
}

View File

@ -1,5 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include <device/pci_ops.h>
#include <soc/acpi.h>
#include <soc/numa.h>
#include <soc/util.h>
@ -16,9 +17,9 @@ unsigned long cxl_fill_srat(unsigned long current)
uint8_t bus, dev, func;
uint32_t base, size;
for (uint8_t i = soc_get_num_cpus(); i < pds.num_pds; i++) {
bus = pds.pds[i].device_handle >> 20;
dev = (pds.pds[i].device_handle >> 15) & 0x1f;
func = (pds.pds[i].device_handle >> 12) & 0x07;
bus = PCI_BDF(pds.pds[i].dev) >> 20;
dev = (PCI_BDF(pds.pds[i].dev) >> 15) & 0x1f;
func = (PCI_BDF(pds.pds[i].dev) >> 12) & 0x07;
printk(BIOS_DEBUG,
"adding srat GIA ID: %d, seg: 0x%x, bus: 0x%x, dev: 0x%x, func: 0x%x\n",
i, seg, bus, dev, func);