summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShuo Liu <shuo.liu@intel.com>2024-03-08 02:11:36 +0800
committerLean Sheng Tan <sheng.tan@9elements.com>2024-03-14 18:58:32 +0000
commite0c935b0dc8d029c987127ad6edf71a4f987d065 (patch)
treec653d7b7ab38fd85eaf8d5ff92a14aedd9450860
parente357ac3321d219eb6e7f7687f7ceda0e7e63391c (diff)
soc/intel/xeon_sp: Add domain role checking utils
For Xeon-SP, there are 4 main domain roles (PCIe/CXL/IOAT/UBOX). This patch adds util function to check whether a given domain belongs to one of these roles, or a give device belongs to a domain of the specific role. TEST=intel/archercity CRB Change-Id: I6b31c29564c774c27e86f55749ca9eca057a0cfe Signed-off-by: Shuo Liu <shuo.liu@intel.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/81046 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Patrick Rudolph <patrick.rudolph@9elements.com>
-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_ */