16
16
#include < regex>
17
17
namespace L0 {
18
18
19
- void LinuxRasSourceFabric::getNodes (std::vector<std::string> &nodes, uint32_t subdeviceId, FsAccess *fsAccess , const zes_ras_error_type_t &type) {
19
+ void LinuxRasSourceFabric::getNodes (std::vector<std::string> &nodes, uint32_t subdeviceId, LinuxSysmanImp *pSysmanImp , const zes_ras_error_type_t &type) {
20
20
const uint32_t minBoardStrappedNumber = 0 ;
21
21
const uint32_t maxBoardStrappedNumber = 31 ;
22
22
const uint32_t minPortId = 1 ;
@@ -27,18 +27,23 @@ void LinuxRasSourceFabric::getNodes(std::vector<std::string> &nodes, uint32_t su
27
27
const std::string iafPathStringAuxillary (" /sys/module/iaf/drivers/auxiliary:iaf/" );
28
28
std::string iafPathString (" " );
29
29
30
- if (fsAccess->directoryExists (iafPathStringMfd)) {
31
- iafPathString = iafPathStringMfd + " iaf." ;
32
- } else if (fsAccess->directoryExists (iafPathStringAuxillary)) {
33
- iafPathString = iafPathStringAuxillary + " i915.iaf." ;
30
+ if (pSysmanImp->getSysfsAccess ().getRealPath (" device/" , iafPathString) != ZE_RESULT_SUCCESS) {
31
+ return ;
32
+ }
33
+
34
+ auto &fsAccess = pSysmanImp->getFsAccess ();
35
+ if (fsAccess.directoryExists (iafPathStringMfd)) {
36
+ iafPathString = iafPathString + " /iaf." ;
37
+ } else if (fsAccess.directoryExists (iafPathStringAuxillary)) {
38
+ iafPathString = iafPathString + " /i915.iaf." ;
34
39
} else {
35
40
return ;
36
41
}
37
42
38
43
for (auto boardStrappedNumber = minBoardStrappedNumber; boardStrappedNumber <= maxBoardStrappedNumber; boardStrappedNumber++) {
39
44
40
45
const auto boardStrappedString (iafPathString + std::to_string (boardStrappedNumber));
41
- if (!fsAccess-> directoryExists (boardStrappedString)) {
46
+ if (!fsAccess. directoryExists (boardStrappedString)) {
42
47
continue ;
43
48
}
44
49
const auto subDeviceString (boardStrappedString + " /sd." + std::to_string (subdeviceId));
@@ -58,7 +63,7 @@ void LinuxRasSourceFabric::getNodes(std::vector<std::string> &nodes, uint32_t su
58
63
}
59
64
60
65
for (auto &subDeviceErrorNode : subDeviceErrorNodes) {
61
- if (ZE_RESULT_SUCCESS == fsAccess-> canRead (subDeviceErrorNode)) {
66
+ if (ZE_RESULT_SUCCESS == fsAccess. canRead (subDeviceErrorNode)) {
62
67
nodes.push_back (subDeviceErrorNode);
63
68
}
64
69
}
@@ -72,11 +77,11 @@ ze_result_t LinuxRasSourceFabric::getSupportedRasErrorTypes(std::set<zes_ras_err
72
77
uint32_t subDeviceIndex = neoDevice->isSubDevice () ? static_cast <NEO::SubDevice *>(neoDevice)->getSubDeviceIndex () : 0 ;
73
78
74
79
std::vector<std::string> nodes;
75
- getNodes (nodes, subDeviceIndex, & pLinuxSysmanImp-> getFsAccess () , ZES_RAS_ERROR_TYPE_UNCORRECTABLE);
80
+ getNodes (nodes, subDeviceIndex, pLinuxSysmanImp, ZES_RAS_ERROR_TYPE_UNCORRECTABLE);
76
81
if (nodes.size ()) {
77
82
errorType.insert (ZES_RAS_ERROR_TYPE_UNCORRECTABLE);
78
83
}
79
- getNodes (nodes, subDeviceIndex, & pLinuxSysmanImp-> getFsAccess () , ZES_RAS_ERROR_TYPE_CORRECTABLE);
84
+ getNodes (nodes, subDeviceIndex, pLinuxSysmanImp, ZES_RAS_ERROR_TYPE_CORRECTABLE);
80
85
if (nodes.size ()) {
81
86
errorType.insert (ZES_RAS_ERROR_TYPE_CORRECTABLE);
82
87
}
@@ -86,15 +91,16 @@ ze_result_t LinuxRasSourceFabric::getSupportedRasErrorTypes(std::set<zes_ras_err
86
91
87
92
LinuxRasSourceFabric::LinuxRasSourceFabric (OsSysman *pOsSysman, zes_ras_error_type_t type, uint32_t subDeviceId) {
88
93
89
- fsAccess = & static_cast <LinuxSysmanImp *>(pOsSysman)-> getFsAccess ( );
90
- getNodes (errorNodes, subDeviceId, fsAccess , type);
94
+ pLinuxSysmanImp = static_cast <LinuxSysmanImp *>(pOsSysman);
95
+ getNodes (errorNodes, subDeviceId, pLinuxSysmanImp , type);
91
96
}
92
97
93
98
uint64_t LinuxRasSourceFabric::getComputeErrorCount () {
94
99
uint64_t currentErrorCount = 0 ;
100
+ auto &fsAccess = pLinuxSysmanImp->getFsAccess ();
95
101
for (const auto &node : errorNodes) {
96
102
uint64_t errorCount = 0 ;
97
- fsAccess-> read (node, errorCount);
103
+ fsAccess. read (node, errorCount);
98
104
currentErrorCount += errorCount;
99
105
}
100
106
return currentErrorCount;
0 commit comments