summaryrefslogtreecommitdiff
path: root/src/soc
diff options
context:
space:
mode:
authorPatrick Rudolph <patrick.rudolph@9elements.com>2024-03-14 09:24:12 +0100
committerFelix Held <felix-coreboot@felixheld.de>2024-04-18 11:25:32 +0000
commite56a41b33fd2e52a6bfeec5a0a845c9c2d4e9b01 (patch)
tree171adf5198c954d3ee87d434878f6b7f3a20d759 /src/soc
parent72b8d2fbc7e7ccf0c20c5bd49ffa3665e5e7c8cd (diff)
device/device_util: Use const qualifier
Allows to use the function in more places that expect the struct device to be readonly. TEST=Build and boot on intel/archercity CRB Change-Id: Iac04fe6931a43070f6638b399adbff2ce64829c9 Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Signed-off-by: Shuo Liu <shuo.liu@intel.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/81275 Reviewed-by: Nico Huber <nico.h@gmx.de> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/soc')
-rw-r--r--src/soc/intel/xeon_sp/chip_common.c23
-rw-r--r--src/soc/intel/xeon_sp/include/soc/chip_common.h12
-rw-r--r--src/soc/intel/xeon_sp/uncore_acpi.c2
3 files changed, 19 insertions, 18 deletions
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)