Unify reading pci paths

Signed-off-by: Kamil Diedrich <kamil.diedrich@intel.com>
This commit is contained in:
Kamil Diedrich
2021-03-29 13:43:50 +02:00
committed by Compute-Runtime-Automation
parent cee785f8a1
commit 7d64d8e00e
8 changed files with 63 additions and 27 deletions

View File

@@ -17,6 +17,7 @@
#include "shared/source/helpers/ptr_math.h"
#include "shared/source/os_interface/linux/hw_device_id.h"
#include "shared/source/os_interface/linux/os_inc.h"
#include "shared/source/os_interface/linux/os_interface.h"
#include "shared/source/os_interface/linux/sys_calls.h"
#include "shared/source/os_interface/linux/system_info.h"
#include "shared/source/os_interface/os_environment.h"
@@ -362,7 +363,10 @@ std::vector<std::unique_ptr<HwDeviceId>> OSInterface::discoverDevices(ExecutionE
for (unsigned int i = 0; i < maxDrmDevices; i++) {
std::string path = std::string(pathPrefix) + std::to_string(i + startNum);
int fileDescriptor = SysCalls::open(path.c_str(), O_RDWR);
appendHwDeviceId(hwDeviceIds, fileDescriptor, "00:02.0");
auto pciPath = OSInterface::OSInterfaceImpl::getPciPath(fileDescriptor);
appendHwDeviceId(hwDeviceIds, fileDescriptor, pciPath.value_or("00:02.0").c_str());
if (!hwDeviceIds.empty() && hwDeviceIds.size() == numRootDevices) {
break;
}