Lean Sheng Tan has submitted this change. ( https://review.coreboot.org/c/coreboot/+/81046?usp=email )
(
14 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: soc/intel/xeon_sp: Add domain role checking utils ......................................................................
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 --- M src/soc/intel/xeon_sp/chip_common.c M src/soc/intel/xeon_sp/include/soc/chip_common.h 2 files changed, 49 insertions(+), 0 deletions(-)
Approvals: Patrick Rudolph: Looks good to me, approved build bot (Jenkins): Verified
diff --git a/src/soc/intel/xeon_sp/chip_common.c b/src/soc/intel/xeon_sp/chip_common.c index b461f0e..d0e01bc 100644 --- a/src/soc/intel/xeon_sp/chip_common.c +++ b/src/soc/intel/xeon_sp/chip_common.c @@ -400,3 +400,41 @@ } } } + +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 4dae550..40c7ffa 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 @@ 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_ */