diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/device/device_util.c | 2 | ||||
-rw-r--r-- | src/include/device/device.h | 2 | ||||
-rw-r--r-- | src/soc/intel/xeon_sp/chip_common.c | 23 | ||||
-rw-r--r-- | src/soc/intel/xeon_sp/include/soc/chip_common.h | 12 | ||||
-rw-r--r-- | src/soc/intel/xeon_sp/uncore_acpi.c | 2 |
5 files changed, 21 insertions, 20 deletions
diff --git a/src/device/device_util.c b/src/device/device_util.c index 02641c162e..10e4a0dd1c 100644 --- a/src/device/device_util.c +++ b/src/device/device_util.c @@ -248,7 +248,7 @@ const char *dev_name(const struct device *dev) } /* Returns the PCI domain for the given PCI device */ -struct device *dev_get_pci_domain(struct device *dev) +const struct device *dev_get_pci_domain(const struct device *dev) { /* Walk up the tree up to the PCI domain */ while (dev && dev->upstream && !is_root_device(dev)) { diff --git a/src/include/device/device.h b/src/include/device/device.h index 7bc1c0a6dd..7f73d2b362 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); -struct device *dev_get_pci_domain(struct device *dev); +const struct device *dev_get_pci_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 a2de2d4711..0e9fcdcf1e 100644 --- a/src/soc/intel/xeon_sp/chip_common.c +++ b/src/soc/intel/xeon_sp/chip_common.c @@ -41,12 +41,13 @@ struct device *dev_find_device_on_socket(uint8_t socket, u16 vendor, u16 device) static int filter_device_on_stack(struct device *dev, uint8_t socket, uint8_t stack, u16 vendor, u16 device) { - struct device *domain = dev_get_pci_domain(dev); - if (!domain) - return 0; if (dev->path.type != DEVICE_PATH_PCI) return 0; + const struct device *domain = dev_get_pci_domain(dev); + if (!domain) + return 0; + union xeon_domain_path dn; dn.domain_path = domain->path.domain.domain; @@ -130,9 +131,9 @@ struct device *dev_find_all_devices_on_domain(struct device *domain, u16 vendor, * * @return Socket ID the device is attached to, negative number on error. */ -int iio_pci_domain_socket_from_dev(struct device *dev) +int iio_pci_domain_socket_from_dev(const struct device *dev) { - struct device *domain; + const struct device *domain; union xeon_domain_path dn; if (dev->path.type == DEVICE_PATH_DOMAIN) @@ -156,9 +157,9 @@ int iio_pci_domain_socket_from_dev(struct device *dev) * * @return Stack ID the device is attached to, negative number on error. */ -int iio_pci_domain_stack_from_dev(struct device *dev) +int iio_pci_domain_stack_from_dev(const struct device *dev) { - struct device *domain; + const struct device *domain; union xeon_domain_path dn; if (dev->path.type == DEVICE_PATH_DOMAIN) @@ -224,7 +225,7 @@ void attach_iio_stacks(void) } } -bool is_pcie_domain(struct device *dev) +bool is_pcie_domain(const struct device *dev) { if ((!dev) || (dev->path.type != DEVICE_PATH_DOMAIN)) return false; @@ -232,7 +233,7 @@ bool is_pcie_domain(struct device *dev) return strstr(dev->name, DOMAIN_TYPE_PCIE); } -bool is_ioat_domain(struct device *dev) +bool is_ioat_domain(const struct device *dev) { if ((!dev) || (dev->path.type != DEVICE_PATH_DOMAIN)) return false; @@ -244,7 +245,7 @@ bool is_ioat_domain(struct device *dev) strstr(dev->name, DOMAIN_TYPE_HQM1)); } -bool is_ubox_domain(struct device *dev) +bool is_ubox_domain(const struct device *dev) { if ((!dev) || (dev->path.type != DEVICE_PATH_DOMAIN)) return false; @@ -253,7 +254,7 @@ bool is_ubox_domain(struct device *dev) strstr(dev->name, DOMAIN_TYPE_UBX1)); } -bool is_cxl_domain(struct device *dev) +bool is_cxl_domain(const struct device *dev) { if ((!dev) || (dev->path.type != DEVICE_PATH_DOMAIN)) return false; 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 0c0258af9c..55e8a6c40e 100644 --- a/src/soc/intel/xeon_sp/include/soc/chip_common.h +++ b/src/soc/intel/xeon_sp/include/soc/chip_common.h @@ -70,13 +70,13 @@ struct device *dev_find_all_devices_on_stack(uint8_t socket, uint8_t stack, struct device *dev_find_all_devices_on_domain(struct device *domain, u16 vendor, u16 device, struct device *from); -int iio_pci_domain_socket_from_dev(struct device *dev); -int iio_pci_domain_stack_from_dev(struct device *dev); +int iio_pci_domain_socket_from_dev(const struct device *dev); +int iio_pci_domain_stack_from_dev(const struct device *dev); -bool is_pcie_domain(struct device *dev); -bool is_ioat_domain(struct device *dev); -bool is_ubox_domain(struct device *dev); -bool is_cxl_domain(struct device *dev); +bool is_pcie_domain(const struct device *dev); +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)) diff --git a/src/soc/intel/xeon_sp/uncore_acpi.c b/src/soc/intel/xeon_sp/uncore_acpi.c index 29dc3ecf32..bf9a44af08 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)) { - struct device *domain = dev_get_pci_domain(iommu); + const struct device *domain = dev_get_pci_domain(iommu); struct device *dev = NULL; while ((dev = dev_bus_each_child(domain->downstream, dev))) if ((dev->hdr_type & 0x7f) == PCI_HEADER_TYPE_BRIDGE) |