Emit the threshold alarm signals to trigger SEL logs
Emit the thresold alarm signals on sensor threshold interface:
https://gerrit.openbmc-project.xyz/39899
Signed-off-by: George Hung <george.hung@quantatw.com>
Change-Id: I107f756eab790bed2416e7c0c8d7193a79ed7954
diff --git a/nvmes.cpp b/nvmes.cpp
index b936f8a..7bd8c6c 100644
--- a/nvmes.cpp
+++ b/nvmes.cpp
@@ -16,14 +16,67 @@
int8_t criticalLow = CriticalInterface::criticalLow();
int8_t warningHigh = WarningInterface::warningHigh();
int8_t warningLow = WarningInterface::warningLow();
+ auto criticalAlarmLowState = CriticalInterface::criticalAlarmLow();
+ auto criticalAlarmHighState = CriticalInterface::criticalAlarmHigh();
+ auto warningAlarmLowState = WarningInterface::warningAlarmLow();
+ auto warningAlarmHighState = WarningInterface::warningAlarmHigh();
+ bool criticalAlarmLow = (value <= criticalLow);
+ bool criticalAlarmHigh = (value >= criticalHigh);
+ bool warningAlarmLow = (value <= warningLow);
+ bool warningAlarmHigh = (value >= warningHigh);
- CriticalInterface::criticalAlarmHigh(value > criticalHigh);
+ CriticalInterface::criticalAlarmHigh(criticalAlarmHigh);
- CriticalInterface::criticalAlarmLow(value < criticalLow);
+ CriticalInterface::criticalAlarmLow(criticalAlarmLow);
- WarningInterface::warningAlarmHigh(value > warningHigh);
+ WarningInterface::warningAlarmHigh(warningAlarmHigh);
- WarningInterface::warningAlarmLow(value < warningLow);
+ WarningInterface::warningAlarmLow(warningAlarmLow);
+
+ if (criticalAlarmHighState != criticalAlarmHigh)
+ {
+ if (criticalAlarmHigh)
+ {
+ CriticalInterface::criticalHighAlarmAsserted(value);
+ }
+ else
+ {
+ CriticalInterface::criticalHighAlarmDeasserted(value);
+ }
+ }
+ if (criticalAlarmLowState != criticalAlarmLow)
+ {
+ if (criticalAlarmLow)
+ {
+ CriticalInterface::criticalLowAlarmAsserted(value);
+ }
+ else
+ {
+ CriticalInterface::criticalLowAlarmDeasserted(value);
+ }
+ }
+ if (warningAlarmHighState != warningAlarmHigh)
+ {
+ if (warningAlarmHigh)
+ {
+ WarningInterface::warningHighAlarmAsserted(value);
+ }
+ else
+ {
+ WarningInterface::warningHighAlarmDeasserted(value);
+ }
+ }
+ if (warningAlarmLowState != warningAlarmLow)
+ {
+ if (warningAlarmLow)
+ {
+ WarningInterface::warningLowAlarmAsserted(value);
+ }
+ else
+ {
+ WarningInterface::warningLowAlarmDeasserted(value);
+ }
+ }
}
void NvmeSSD::setSensorThreshold(int8_t criticalHigh, int8_t criticalLow,