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>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
@@ -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_ */
|
||||
|
Reference in New Issue
Block a user