summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/soc/intel/xeon_sp/chip_common.c38
-rw-r--r--src/soc/intel/xeon_sp/include/soc/chip_common.h11
2 files changed, 49 insertions, 0 deletions
diff --git a/src/soc/intel/xeon_sp/chip_common.c b/src/soc/intel/xeon_sp/chip_common.c
index b461f0e05d..d0e01bc7cf 100644
--- a/src/soc/intel/xeon_sp/chip_common.c
+++ b/src/soc/intel/xeon_sp/chip_common.c
@@ -400,3 +400,41 @@ void attach_iio_stacks(void)
}
}
}
+
+bool is_pcie_domain(struct device *dev)
+{
+ if ((!dev) || (dev->path.type != DEVICE_PATH_DOMAIN))
+ return false;
+
+ return strstr(dev->name, DOMAIN_TYPE_PCIE);
+}
+
+bool is_ioat_domain(struct device *dev)
+{
+ if ((!dev) || (dev->path.type != DEVICE_PATH_DOMAIN))
+ return false;
+
+ return (strstr(dev->name, DOMAIN_TYPE_CPM0) ||
+ strstr(dev->name, DOMAIN_TYPE_CPM1) ||
+ strstr(dev->name, DOMAIN_TYPE_DINO) ||
+ strstr(dev->name, DOMAIN_TYPE_HQM0) ||
+ strstr(dev->name, DOMAIN_TYPE_HQM1));
+}
+
+bool is_ubox_domain(struct device *dev)
+{
+ if ((!dev) || (dev->path.type != DEVICE_PATH_DOMAIN))
+ return false;
+
+ return (strstr(dev->name, DOMAIN_TYPE_UBX0) ||
+ strstr(dev->name, DOMAIN_TYPE_UBX1));
+
+}
+
+bool is_cxl_domain(struct device *dev)
+{
+ if ((!dev) || (dev->path.type != DEVICE_PATH_DOMAIN))
+ return false;
+
+ return strstr(dev->name, DOMAIN_TYPE_CXL);
+}
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 4dae5501fa..40c7ffa377 100644
--- a/src/soc/intel/xeon_sp/include/soc/chip_common.h
+++ b/src/soc/intel/xeon_sp/include/soc/chip_common.h
@@ -3,6 +3,7 @@
#ifndef _CHIP_COMMON_H_
#define _CHIP_COMMON_H_
+#include <device/device.h>
#include <device/path.h>
#include <hob_iiouds.h>
@@ -66,4 +67,14 @@ struct device *dev_find_all_devices_on_domain(struct device *domain,
int iio_pci_domain_socket_from_dev(struct device *dev);
int iio_pci_domain_stack_from_dev(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);
+
+#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))
+
#endif /* _CHIP_COMMON_H_ */