Report correct PCI width from API zetSysmanPciGetProperties

If system reports incorrect PCI width, then check width against valid
value, and report correct PCI width accordingly.

Change-Id: I56f8fe96785ccd22032860d55dd96b81d5fc53f7
Signed-off-by: Jitendra Sharma <jitendra.sharma@intel.com>
This commit is contained in:
Jitendra Sharma
2020-06-05 15:18:46 +05:30
committed by sys_ocldev
parent 87b9c5f4e6
commit 8dff60b6a5
3 changed files with 39 additions and 8 deletions

View File

@@ -19,6 +19,8 @@ const std::string LinuxPciImp::resourceFile("device/resource");
const std::string LinuxPciImp::maxLinkSpeedFile("device/max_link_speed");
const std::string LinuxPciImp::maxLinkWidthFile("device/max_link_width");
constexpr uint8_t maxPciBars = 6;
// Linux kernel would report 255 link width, as an indication of unknown.
constexpr uint32_t unknownPcieLinkWidth = 255u;
ze_result_t LinuxPciImp::getPciBdf(std::string &bdf) {
std::string bdfDir;
@@ -50,6 +52,9 @@ ze_result_t LinuxPciImp::getMaxLinkWidth(uint32_t &maxLinkwidth) {
if (ZE_RESULT_SUCCESS != result) {
return result;
}
if (intVal == static_cast<int>(unknownPcieLinkWidth)) {
intVal = 0;
}
maxLinkwidth = intVal;
return ZE_RESULT_SUCCESS;
}