From 271ee0745e4bc104949b20f433216f1f0a06fb46 Mon Sep 17 00:00:00 2001 From: Shuo Liu Date: Fri, 29 Mar 2024 00:42:28 +0800 Subject: device/device_util: Rename dev_get_pci_domain In coreboot, domain indicates hardware units that provide/group resource windows, For Xeon-SP, domains are PCIe compatible and further function in many aspects, e.g. PCIe, CXL, IOAT, UBOX. Rename dev_get_pci_domain to dev_get_domain to align with coreboot concept and distinguish from Xeon-SP concept. TEST=Build and boot on intel/archercity CRB Change-Id: I51b18b30fb41038869ea1384b01091da31a895b9 Signed-off-by: Shuo Liu Reviewed-on: https://review.coreboot.org/c/coreboot/+/81554 Tested-by: build bot (Jenkins) Reviewed-by: Felix Held --- src/device/device_util.c | 6 +++--- src/include/device/device.h | 2 +- src/soc/intel/xeon_sp/chip_common.c | 6 +++--- src/soc/intel/xeon_sp/include/soc/chip_common.h | 10 +++++----- src/soc/intel/xeon_sp/uncore_acpi.c | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/device/device_util.c b/src/device/device_util.c index 10e4a0dd1c..5e353c2734 100644 --- a/src/device/device_util.c +++ b/src/device/device_util.c @@ -247,10 +247,10 @@ const char *dev_name(const struct device *dev) return "unknown"; } -/* Returns the PCI domain for the given PCI device */ -const struct device *dev_get_pci_domain(const struct device *dev) +/* Returns the domain for the given device */ +const struct device *dev_get_domain(const struct device *dev) { - /* Walk up the tree up to the PCI domain */ + /* Walk up the tree up to the domain */ while (dev && dev->upstream && !is_root_device(dev)) { dev = dev->upstream->dev; if (dev->path.type == DEVICE_PATH_DOMAIN) diff --git a/src/include/device/device.h b/src/include/device/device.h index 7f73d2b362..ac7e86917e 100644 --- a/src/include/device/device.h +++ b/src/include/device/device.h @@ -182,7 +182,7 @@ void assign_resources(struct bus *bus); const char *dev_name(const struct device *dev); const char *dev_path(const struct device *dev); u32 dev_path_encode(const struct device *dev); -const struct device *dev_get_pci_domain(const struct device *dev); +const struct device *dev_get_domain(const struct device *dev); void dev_set_enabled(struct device *dev, int enable); void disable_children(struct bus *bus); bool dev_is_active_bridge(struct device *dev); diff --git a/src/soc/intel/xeon_sp/chip_common.c b/src/soc/intel/xeon_sp/chip_common.c index 0e9fcdcf1e..d8e7d143b0 100644 --- a/src/soc/intel/xeon_sp/chip_common.c +++ b/src/soc/intel/xeon_sp/chip_common.c @@ -44,7 +44,7 @@ static int filter_device_on_stack(struct device *dev, uint8_t socket, uint8_t st if (dev->path.type != DEVICE_PATH_PCI) return 0; - const struct device *domain = dev_get_pci_domain(dev); + const struct device *domain = dev_get_domain(dev); if (!domain) return 0; @@ -139,7 +139,7 @@ int iio_pci_domain_socket_from_dev(const struct device *dev) if (dev->path.type == DEVICE_PATH_DOMAIN) domain = dev; else - domain = dev_get_pci_domain(dev); + domain = dev_get_domain(dev); if (!domain) return -1; @@ -165,7 +165,7 @@ int iio_pci_domain_stack_from_dev(const struct device *dev) if (dev->path.type == DEVICE_PATH_DOMAIN) domain = dev; else - domain = dev_get_pci_domain(dev); + domain = dev_get_domain(dev); if (!domain) return -1; diff --git a/src/soc/intel/xeon_sp/include/soc/chip_common.h b/src/soc/intel/xeon_sp/include/soc/chip_common.h index 55e8a6c40e..5fd5dc6f18 100644 --- a/src/soc/intel/xeon_sp/include/soc/chip_common.h +++ b/src/soc/intel/xeon_sp/include/soc/chip_common.h @@ -78,14 +78,14 @@ bool is_ioat_domain(const struct device *dev); bool is_ubox_domain(const struct device *dev); bool is_cxl_domain(const struct device *dev); -#define is_dev_on_pcie_domain(dev) is_pcie_domain(dev_get_pci_domain(dev)) -#define is_dev_on_ioat_domain(dev) is_ioat_domain(dev_get_pci_domain(dev)) -#define is_dev_on_ubox_domain(dev) is_ubox_domain(dev_get_pci_domain(dev)) -#define is_dev_on_cxl_domain(dev) is_cxl_domain(dev_get_pci_domain(dev)) +#define is_dev_on_pcie_domain(dev) is_pcie_domain(dev_get_domain(dev)) +#define is_dev_on_ioat_domain(dev) is_ioat_domain(dev_get_domain(dev)) +#define is_dev_on_ubox_domain(dev) is_ubox_domain(dev_get_domain(dev)) +#define is_dev_on_cxl_domain(dev) is_cxl_domain(dev_get_domain(dev)) #define is_domain0(dev) (dev && dev->path.type == DEVICE_PATH_DOMAIN &&\ dev->path.domain.domain == 0) -#define is_dev_on_domain0(dev) (is_domain0(dev_get_pci_domain(dev))) +#define is_dev_on_domain0(dev) (is_domain0(dev_get_domain(dev))) #define is_stack0(socket, stack) (socket == 0 && stack == IioStack0) void unlock_pam_regions(void); diff --git a/src/soc/intel/xeon_sp/uncore_acpi.c b/src/soc/intel/xeon_sp/uncore_acpi.c index bf9a44af08..bcfb4da92d 100644 --- a/src/soc/intel/xeon_sp/uncore_acpi.c +++ b/src/soc/intel/xeon_sp/uncore_acpi.c @@ -315,7 +315,7 @@ static unsigned long acpi_create_drhd(unsigned long current, struct device *iomm // Add PCIe Ports if (!is_dev_on_domain0(iommu)) { - const struct device *domain = dev_get_pci_domain(iommu); + const struct device *domain = dev_get_domain(iommu); struct device *dev = NULL; while ((dev = dev_bus_each_child(domain->downstream, dev))) if ((dev->hdr_type & 0x7f) == PCI_HEADER_TYPE_BRIDGE) @@ -535,7 +535,7 @@ static unsigned long acpi_fill_dmar(unsigned long current) struct device *dev = NULL; struct device *iommu0 = NULL; while ((dev = dev_find_device(PCI_VID_INTEL, MMAP_VTD_CFG_REG_DEVID, dev))) { - if (is_domain0(dev_get_pci_domain(dev))) { + if (is_domain0(dev_get_domain(dev))) { iommu0 = dev; continue; } -- cgit v1.2.3