Initial commit
This commit is contained in:
+123
@@ -0,0 +1,123 @@
|
||||
From 99349f528ef005ed7ecda5d26e247387d28a9c7b Mon Sep 17 00:00:00 2001
|
||||
From: wangjue <jue.wang2@luxshare-ict.com>
|
||||
Date: Mon, 9 Sep 2024 13:52:35 +0800
|
||||
Subject: [PATCH] Modify LED update priority for Changxin's requiremen
|
||||
|
||||
Signed-off-by: wangjue <jue.wang2@luxshare-ict.com>
|
||||
---
|
||||
callback-manager/src/callback_manager.cpp | 56 ++++++++---------------
|
||||
1 file changed, 19 insertions(+), 37 deletions(-)
|
||||
|
||||
diff --git a/callback-manager/src/callback_manager.cpp b/callback-manager/src/callback_manager.cpp
|
||||
index d6a5dee..4f02986 100644
|
||||
--- a/callback-manager/src/callback_manager.cpp
|
||||
+++ b/callback-manager/src/callback_manager.cpp
|
||||
@@ -24,12 +24,10 @@
|
||||
|
||||
#include <variant>
|
||||
|
||||
-constexpr const char* fatalLedPath =
|
||||
- "/xyz/openbmc_project/led/groups/status_critical";
|
||||
-constexpr const char* criticalLedPath =
|
||||
- "/xyz/openbmc_project/led/groups/status_non_critical";
|
||||
-constexpr const char* warningLedPath =
|
||||
- "/xyz/openbmc_project/led/groups/status_degraded";
|
||||
+constexpr const char* faultLedPath =
|
||||
+ "/xyz/openbmc_project/led/groups/status_fault";
|
||||
+constexpr const char* dimmfaultLedPath =
|
||||
+ "/xyz/openbmc_project/led/groups/dimm_fault";
|
||||
constexpr const char* okLedPath = "/xyz/openbmc_project/led/groups/status_ok";
|
||||
|
||||
constexpr const char* ledIface = "xyz.openbmc_project.Led.Group";
|
||||
@@ -43,9 +41,8 @@ enum class StatusSetting
|
||||
{
|
||||
none,
|
||||
ok,
|
||||
- warn,
|
||||
- critical,
|
||||
- fatal
|
||||
+ dimmerr,
|
||||
+ fault
|
||||
};
|
||||
|
||||
constexpr const bool debug = false;
|
||||
@@ -102,9 +99,8 @@ void updateLedStatus(std::shared_ptr<sdbusplus::asio::connection>& conn,
|
||||
std::vector<std::pair<std::string, std::variant<bool>>> ledsToSet;
|
||||
if (forceRefresh)
|
||||
{
|
||||
- ledsToSet.push_back(std::make_pair(fatalLedPath, false));
|
||||
- ledsToSet.push_back(std::make_pair(criticalLedPath, false));
|
||||
- ledsToSet.push_back(std::make_pair(warningLedPath, false));
|
||||
+ ledsToSet.push_back(std::make_pair(faultLedPath, false));
|
||||
+ ledsToSet.push_back(std::make_pair(dimmfaultLedPath, false));
|
||||
ledsToSet.push_back(std::make_pair(okLedPath, false));
|
||||
for (const auto& ledPair : ledsToSet)
|
||||
{
|
||||
@@ -128,17 +124,14 @@ void updateLedStatus(std::shared_ptr<sdbusplus::asio::connection>& conn,
|
||||
ledAssertProp, ledPair.second);
|
||||
}
|
||||
}
|
||||
+
|
||||
if (fatal)
|
||||
{
|
||||
- currentPriority = StatusSetting::fatal;
|
||||
+ currentPriority = StatusSetting::fault;
|
||||
}
|
||||
else if (critical)
|
||||
{
|
||||
- currentPriority = StatusSetting::critical;
|
||||
- }
|
||||
- else if (warn)
|
||||
- {
|
||||
- currentPriority = StatusSetting::warn;
|
||||
+ currentPriority = StatusSetting::fault;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -149,35 +142,24 @@ void updateLedStatus(std::shared_ptr<sdbusplus::asio::connection>& conn,
|
||||
{
|
||||
switch (currentPriority)
|
||||
{
|
||||
- case (StatusSetting::fatal):
|
||||
- {
|
||||
- ledsToSet.push_back(std::make_pair(fatalLedPath, true));
|
||||
- ledsToSet.push_back(std::make_pair(criticalLedPath, false));
|
||||
- ledsToSet.push_back(std::make_pair(warningLedPath, false));
|
||||
- ledsToSet.push_back(std::make_pair(okLedPath, false));
|
||||
- break;
|
||||
- }
|
||||
- case (StatusSetting::critical):
|
||||
+ case (StatusSetting::fault):
|
||||
{
|
||||
- ledsToSet.push_back(std::make_pair(fatalLedPath, false));
|
||||
- ledsToSet.push_back(std::make_pair(criticalLedPath, true));
|
||||
- ledsToSet.push_back(std::make_pair(warningLedPath, false));
|
||||
ledsToSet.push_back(std::make_pair(okLedPath, false));
|
||||
+ ledsToSet.push_back(std::make_pair(dimmfaultLedPath, false));
|
||||
+ ledsToSet.push_back(std::make_pair(faultLedPath, true));
|
||||
break;
|
||||
}
|
||||
- case (StatusSetting::warn):
|
||||
+ case (StatusSetting::dimmerr):
|
||||
{
|
||||
- ledsToSet.push_back(std::make_pair(fatalLedPath, false));
|
||||
- ledsToSet.push_back(std::make_pair(criticalLedPath, false));
|
||||
- ledsToSet.push_back(std::make_pair(warningLedPath, true));
|
||||
ledsToSet.push_back(std::make_pair(okLedPath, false));
|
||||
+ ledsToSet.push_back(std::make_pair(faultLedPath, false));
|
||||
+ ledsToSet.push_back(std::make_pair(dimmfaultLedPath, true));
|
||||
break;
|
||||
}
|
||||
case (StatusSetting::ok):
|
||||
{
|
||||
- ledsToSet.push_back(std::make_pair(fatalLedPath, false));
|
||||
- ledsToSet.push_back(std::make_pair(criticalLedPath, false));
|
||||
- ledsToSet.push_back(std::make_pair(warningLedPath, false));
|
||||
+ ledsToSet.push_back(std::make_pair(faultLedPath, false));
|
||||
+ ledsToSet.push_back(std::make_pair(dimmfaultLedPath, false));
|
||||
ledsToSet.push_back(std::make_pair(okLedPath, true));
|
||||
break;
|
||||
}
|
||||
--
|
||||
2.34.1
|
||||
|
||||
+183
@@ -0,0 +1,183 @@
|
||||
From 68c17ec70055d351785b58d5e8f03970f31f5fe4 Mon Sep 17 00:00:00 2001
|
||||
From: wangjue <jue.wang2@luxshare-ict.com>
|
||||
Date: Thu, 24 Oct 2024 17:47:23 +0800
|
||||
Subject: [PATCH] Update callback-manager to support dimm_fault LED
|
||||
|
||||
Signed-off-by: wangjue <jue.wang2@luxshare-ict.com>
|
||||
---
|
||||
callback-manager/include/callback_manager.hpp | 8 +--
|
||||
callback-manager/src/callback_manager.cpp | 58 ++++++++++++++++---
|
||||
2 files changed, 55 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/callback-manager/include/callback_manager.hpp b/callback-manager/include/callback_manager.hpp
|
||||
index 78a70a0..688c457 100644
|
||||
--- a/callback-manager/include/callback_manager.hpp
|
||||
+++ b/callback-manager/include/callback_manager.hpp
|
||||
@@ -45,7 +45,7 @@ struct AssociationManager
|
||||
|
||||
void setLocalAssociations(const std::vector<std::string>& fatal,
|
||||
const std::vector<std::string>& critical,
|
||||
- const std::vector<std::string>& warning)
|
||||
+ const std::vector<std::string>& dimmerr)
|
||||
{
|
||||
std::set<Association> result;
|
||||
|
||||
@@ -57,11 +57,11 @@ struct AssociationManager
|
||||
}
|
||||
for (const std::string& path : critical)
|
||||
{
|
||||
- result.emplace(threshold::warning, "", path);
|
||||
+ result.emplace(threshold::critical, "", path);
|
||||
}
|
||||
- for (const std::string& path : warning)
|
||||
+ for (const std::string& path : dimmerr)
|
||||
{
|
||||
- result.emplace(threshold::warning, "", path);
|
||||
+ result.emplace("dimmFault", "", path);
|
||||
}
|
||||
association->set_property("Associations", result);
|
||||
}
|
||||
diff --git a/callback-manager/src/callback_manager.cpp b/callback-manager/src/callback_manager.cpp
|
||||
index 4f02986..d7934af 100644
|
||||
--- a/callback-manager/src/callback_manager.cpp
|
||||
+++ b/callback-manager/src/callback_manager.cpp
|
||||
@@ -60,6 +60,9 @@ boost::container::flat_map<std::string,
|
||||
boost::container::flat_map<std::string,
|
||||
boost::container::flat_map<std::string, bool>>
|
||||
warningAssertMap;
|
||||
+boost::container::flat_map<std::string,
|
||||
+ boost::container::flat_map<std::string, bool>>
|
||||
+ dimmerrAssertMap;
|
||||
|
||||
std::vector<std::string> assertedInMap(
|
||||
const boost::container::flat_map<
|
||||
@@ -92,8 +95,11 @@ void updateLedStatus(std::shared_ptr<sdbusplus::asio::connection>& conn,
|
||||
std::vector<std::string> warningVector = assertedInMap(warningAssertMap);
|
||||
bool warn = warningVector.size();
|
||||
|
||||
+ std::vector<std::string> dimmerrVector = assertedInMap(dimmerrAssertMap);
|
||||
+ bool dimmerr = dimmerrVector.size();
|
||||
+
|
||||
associationManager->setLocalAssociations(fatalVector, criticalVector,
|
||||
- warningVector);
|
||||
+ dimmerrVector);
|
||||
|
||||
StatusSetting last = currentPriority;
|
||||
std::vector<std::pair<std::string, std::variant<bool>>> ledsToSet;
|
||||
@@ -133,11 +139,20 @@ void updateLedStatus(std::shared_ptr<sdbusplus::asio::connection>& conn,
|
||||
{
|
||||
currentPriority = StatusSetting::fault;
|
||||
}
|
||||
+ else if (dimmerr)
|
||||
+ {
|
||||
+ currentPriority = StatusSetting::dimmerr;
|
||||
+ }
|
||||
else
|
||||
{
|
||||
currentPriority = StatusSetting::ok;
|
||||
}
|
||||
|
||||
+ if constexpr (debug)
|
||||
+ {
|
||||
+ std::cout << "last: " << (int)last << " currentPriority: " << int(currentPriority) << std::endl;
|
||||
+ }
|
||||
+
|
||||
if (last != currentPriority || forceRefresh)
|
||||
{
|
||||
switch (currentPriority)
|
||||
@@ -234,6 +249,7 @@ void createThresholdMatch(std::shared_ptr<sdbusplus::asio::connection>& conn)
|
||||
warningAssertMap[message.get_path()]["high"] = assert;
|
||||
}
|
||||
|
||||
+ warningAssertMap.clear(); //ignore warning asserts
|
||||
associationManager->setSensorAssociations(
|
||||
assertedInMap(criticalAssertMap),
|
||||
assertedInMap(warningAssertMap));
|
||||
@@ -250,7 +266,8 @@ void createAssociationMatch(std::shared_ptr<sdbusplus::asio::connection>& conn)
|
||||
"arg0namespace='" +
|
||||
std::string(associationIface) + "'",
|
||||
[&conn](sdbusplus::message_t& message) {
|
||||
- if (message.get_path() == rootPath)
|
||||
+ std::string getPath = message.get_path();
|
||||
+ if (getPath.find(rootPath) != std::string::npos)
|
||||
{
|
||||
return; // it's us
|
||||
}
|
||||
@@ -258,6 +275,7 @@ void createAssociationMatch(std::shared_ptr<sdbusplus::asio::connection>& conn)
|
||||
boost::container::flat_map<std::string,
|
||||
std::variant<std::vector<Association>>>
|
||||
values;
|
||||
+
|
||||
try
|
||||
{
|
||||
message.read(objectName, values);
|
||||
@@ -293,6 +311,8 @@ void createAssociationMatch(std::shared_ptr<sdbusplus::asio::connection>& conn)
|
||||
bool localCritical = false;
|
||||
bool globalWarning = false;
|
||||
bool globalCritical = false;
|
||||
+ bool localDimmFault = false;
|
||||
+ bool dimmfault = false;
|
||||
|
||||
for (const auto& [forward, reverse, path] : *associations)
|
||||
{
|
||||
@@ -301,10 +321,9 @@ void createAssociationMatch(std::shared_ptr<sdbusplus::asio::connection>& conn)
|
||||
globalWarning = globalWarning ? true : reverse == "warning";
|
||||
globalCritical =
|
||||
globalCritical ? true : reverse == "critical";
|
||||
-
|
||||
if constexpr (1)
|
||||
{
|
||||
- std::cerr << "got global ";
|
||||
+ //std::cerr << "got global ";
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -312,7 +331,15 @@ void createAssociationMatch(std::shared_ptr<sdbusplus::asio::connection>& conn)
|
||||
localWarning = localWarning ? true : reverse == "warning";
|
||||
localCritical =
|
||||
localCritical ? true : reverse == "critical";
|
||||
+ localDimmFault =
|
||||
+ localDimmFault ? true : reverse == "dimmfault";
|
||||
}
|
||||
+
|
||||
+ if(path.find("DIMM_CPU") != std::string::npos) {
|
||||
+ dimmfault = true;
|
||||
+ dimmerrAssertMap[path]["association"] = localDimmFault;
|
||||
+ }
|
||||
+
|
||||
if (globalCritical && localCritical)
|
||||
{
|
||||
break;
|
||||
@@ -323,9 +350,26 @@ void createAssociationMatch(std::shared_ptr<sdbusplus::asio::connection>& conn)
|
||||
bool critical = globalWarning && localCritical;
|
||||
bool warning = globalWarning && !critical;
|
||||
|
||||
- fatalAssertMap[message.get_path()]["association"] = fatal;
|
||||
- criticalAssertMap[message.get_path()]["association"] = critical;
|
||||
- warningAssertMap[message.get_path()]["association"] = warning;
|
||||
+ if(!dimmfault) {
|
||||
+ fatalAssertMap[message.get_path()]["association"] = fatal;
|
||||
+ criticalAssertMap[message.get_path()]["association"] = critical;
|
||||
+ warningAssertMap[message.get_path()]["association"] = warning;
|
||||
+ }
|
||||
+
|
||||
+ if constexpr (debug)
|
||||
+ {
|
||||
+ for (const auto& outerPair : dimmerrAssertMap) {
|
||||
+ const std::string& dimmpath = outerPair.first;
|
||||
+ const auto& innerMap = outerPair.second;
|
||||
+
|
||||
+ for (const auto& innerPair : innerMap) {
|
||||
+ const std::string& attributeName = innerPair.first;
|
||||
+ bool asserted = innerPair.second;
|
||||
+ std::cout << "dimmerrAssert path: " << dimmpath << ", attribute: " << attributeName
|
||||
+ << ", asserted: " << std::boolalpha << asserted << std::endl;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
|
||||
updateLedStatus(conn);
|
||||
});
|
||||
--
|
||||
2.34.1
|
||||
|
||||
Reference in New Issue
Block a user