fix(sysman): Align board number string sequence

Related-To: LOCI-4631

Signed-off-by: Bellekallu Rajkiran <bellekallu.rajkiran@intel.com>
This commit is contained in:
Bellekallu Rajkiran
2023-07-17 08:06:04 +00:00
committed by Compute-Runtime-Automation
parent 3070fed574
commit 461ecc9b3b
4 changed files with 22 additions and 2 deletions

View File

@@ -125,6 +125,16 @@ bool LinuxGlobalOperationsImp::getBoardNumber(char (&boardNumber)[ZES_STRING_PRO
std::array<uint8_t, boardNumberSize> value;
ssize_t bytesRead = NEO::PmtUtil::readTelem(telemDir.data(), boardNumberSize, offset, value.data());
if (bytesRead == boardNumberSize) {
// Board Number from PMT is available as multiple uint32_t integers, We need to swap (i.e convert each uint32_t
// to big endian) elements of each uint32_t to get proper board number string.
// For instance, Board Number stored in PMT space is as follows (stored as uint32_t - Little endian):
// 1. BoardNumber0 - 2PTW
// 2. BoardNumber1 - 0503
// 3. BoardNumber2 - 0130. BoardNumber is actual combination of all 0, 1 and 2 i.e WTP230500310.
for (uint32_t i = 0; i < boardNumberSize; i += 4) {
std::swap(value[i], value[i + 3]);
std::swap(value[i + 1], value[i + 2]);
}
memcpy_s(boardNumber, ZES_STRING_PROPERTY_SIZE, value.data(), bytesRead);
return true;
}

View File

@@ -214,7 +214,7 @@ TEST_F(SysmanGlobalOperationsFixture, GivenValidDeviceHandleWhenCallingzesGlobal
zes_device_properties_t properties;
const std::string expectedSerialNumber("0x3e8c9dfe1c2e4d5c");
const std::string expectedBoardNumber("0821VPTW910091000821VPTW91009100");
const std::string expectedBoardNumber("1280WTPV001900191280WTPV00190019");
ze_result_t result = zesDeviceGetProperties(device, &properties);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);