Add helper func in root cause filter
Signed-off-by: Caleb Palmer <cnpalmer@us.ibm.com>
Change-Id: I8a174d6e172ce2e6c0784198f06297fe4f0e3575
diff --git a/analyzer/filter-root-cause.cpp b/analyzer/filter-root-cause.cpp
index e501f9d..54d8eb7 100644
--- a/analyzer/filter-root-cause.cpp
+++ b/analyzer/filter-root-cause.cpp
@@ -1,6 +1,7 @@
#include <assert.h>
#include <analyzer/analyzer_main.hpp>
+#include <analyzer/plugins/plugin.hpp>
#include <analyzer/ras-data/ras-data-parser.hpp>
#include <hei_main.hpp>
#include <hei_util.hpp>
@@ -14,16 +15,38 @@
{
//------------------------------------------------------------------------------
-bool __findRcsOscError(const std::vector<libhei::Signature>& i_list,
- libhei::Signature& o_rootCause)
+bool __lookForBits(const std::vector<libhei::Signature>& i_sigList,
+ libhei::Signature& o_rootCause,
+ std::vector<libhei::ChipType_t> i_chipTypes,
+ const char* i_fir, std::vector<uint8_t> i_bitList)
{
- // TODO: Consider returning all of them instead of one as root cause.
- auto itr = std::find_if(i_list.begin(), i_list.end(), [&](const auto& t) {
- return (libhei::hash<libhei::NodeId_t>("TP_LOCAL_FIR") == t.getId() &&
- (42 == t.getBit() || 43 == t.getBit()));
- });
+ using func = libhei::NodeId_t (*)(const std::string& i_str);
+ func __hash = libhei::hash<libhei::NodeId_t>;
- if (i_list.end() != itr)
+ auto itr =
+ std::find_if(i_sigList.begin(), i_sigList.end(), [&](const auto& sig) {
+ for (const auto& type : i_chipTypes)
+ {
+ if (type != sig.getChip().getType())
+ {
+ continue;
+ }
+ for (const auto& bit : i_bitList)
+ {
+ if (__hash(i_fir) == sig.getId() && bit == sig.getBit())
+ {
+ return true;
+ }
+ else
+ {
+ continue;
+ }
+ }
+ }
+ return false;
+ });
+
+ if (i_sigList.end() != itr)
{
o_rootCause = *itr;
return true;
@@ -125,6 +148,8 @@
// configuration registers for a more accurate analysis.
if (libhei::ATTN_TYPE_UNIT_CS == s.getAttnType() &&
(mc_dstl_fir == s.getId() || mc_ustl_fir == s.getId()) &&
+ (s.getChip().getType() == analyzer::P10_10 ||
+ s.getChip().getType() == analyzer::P10_20) &&
!i_rasData.isFlagSet(s,
RasDataParser::RasDataFlags::ATTN_FROM_OCMB))
{
@@ -330,7 +355,8 @@
// First, look for any RCS OSC errors. This must always be first because
// they can cause downstream PLL unlock attentions.
- if (__findRcsOscError(list, o_rootCause))
+ if (__lookForBits(list, o_rootCause, {analyzer::P10_10, analyzer::P10_20},
+ "TP_LOCAL_FIR", {42, 43}))
{
return true;
}