Add Thresholds Information to SDRs
This adds Assertion/Deassertion masks and threshold
values to the type 1 sdr records.
Tested: sensor list still worked and inspecting the fan
sensors I could see the threshold bits, compared with
legacy it looked the same
Change-Id: Ie6ee8d91d335aa22611797a54c948b89f95fdc1e
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/src/sensorcommands.cpp b/src/sensorcommands.cpp
index 844eef8..abc5609 100644
--- a/src/sensorcommands.cpp
+++ b/src/sensorcommands.cpp
@@ -1297,6 +1297,61 @@
std::strncpy(record.body.id_string, name.c_str(),
sizeof(record.body.id_string));
+ IPMIThresholds thresholdData;
+ try
+ {
+ thresholdData = getIPMIThresholds(sensorMap);
+ }
+ catch (std::exception &)
+ {
+ return ipmi::responseResponseError();
+ }
+
+ if (thresholdData.criticalHigh)
+ {
+ record.body.upper_critical_threshold = *thresholdData.criticalHigh;
+ record.body.supported_deassertions[1] |= static_cast<uint8_t>(
+ IPMISensorEventEnableThresholds::upperCriticalGoingHigh);
+ record.body.supported_assertions[1] |= static_cast<uint8_t>(
+ IPMISensorEventEnableThresholds::upperCriticalGoingHigh);
+ record.body.discrete_reading_setting_mask[0] |=
+ static_cast<uint8_t>(IPMISensorReadingByte3::upperCritical);
+ }
+ if (thresholdData.warningHigh)
+ {
+ record.body.upper_noncritical_threshold = *thresholdData.warningHigh;
+ record.body.supported_deassertions[0] |= static_cast<uint8_t>(
+ IPMISensorEventEnableThresholds::upperNonCriticalGoingHigh);
+ record.body.supported_assertions[0] |= static_cast<uint8_t>(
+ IPMISensorEventEnableThresholds::upperNonCriticalGoingHigh);
+ record.body.discrete_reading_setting_mask[0] |=
+ static_cast<uint8_t>(IPMISensorReadingByte3::upperNonCritical);
+ }
+ if (thresholdData.criticalLow)
+ {
+ record.body.lower_critical_threshold = *thresholdData.criticalLow;
+ record.body.supported_deassertions[0] |= static_cast<uint8_t>(
+ IPMISensorEventEnableThresholds::lowerCriticalGoingLow);
+ record.body.supported_assertions[0] |= static_cast<uint8_t>(
+ IPMISensorEventEnableThresholds::lowerCriticalGoingLow);
+ record.body.discrete_reading_setting_mask[0] |=
+ static_cast<uint8_t>(IPMISensorReadingByte3::lowerCritical);
+ }
+ if (thresholdData.warningLow)
+ {
+ record.body.lower_noncritical_threshold = *thresholdData.warningLow;
+ record.body.supported_deassertions[0] |= static_cast<uint8_t>(
+ IPMISensorEventEnableThresholds::lowerNonCriticalGoingLow);
+ record.body.supported_assertions[0] |= static_cast<uint8_t>(
+ IPMISensorEventEnableThresholds::lowerNonCriticalGoingLow);
+ record.body.discrete_reading_setting_mask[0] |=
+ static_cast<uint8_t>(IPMISensorReadingByte3::lowerNonCritical);
+ }
+
+ // everything that is readable is setable
+ record.body.discrete_reading_setting_mask[1] =
+ record.body.discrete_reading_setting_mask[0];
+
if (sizeof(get_sdr::SensorDataFullRecord) < (offset + bytesToRead))
{
bytesToRead = sizeof(get_sdr::SensorDataFullRecord) - offset;