Lines Matching +full:energy +full:- +full:empty

8 //      http://www.apache.org/licenses/LICENSE-2.0
19 #include "dbus-sdr/sensorcommands.hpp"
21 #include "dbus-sdr/sdrutils.hpp"
22 #include "dbus-sdr/sensorutils.hpp"
23 #include "dbus-sdr/storagecommands.hpp"
31 #include <phosphor-logging/lg2.hpp>
63 // Refer Table 6-14, DCMI Entity ID Extension, DCMI v1.5 spec
101 static constexpr size_t maxIPMISensors = ((3 * 256) - (3 * 1));
110 static constexpr int GENERAL_ERROR = -1;
128 {"energy", SensorUnits::joules}}};
161 if (!getSensorSubtree(sensorTree) && sensorTree.empty())
171 path = getPathFromSensorNumber((ctx->lun << 8) | sensnum);
172 if (path.empty())
181 connection = sensor.second.begin()->first;
183 *interfaces = sensor.second.begin()->second;
218 auto ptr = std::get_if<bool>(&(findAssert->second));
229 thresholdDeassertMap[m.get_path()][findAssert->first] = *ptr;
234 thresholdDeassertMap[m.get_path()][findAssert->first];
258 min = -128;
268 auto maxMap = sensorObject->second.find("MaxValue");
269 auto minMap = sensorObject->second.find("MinValue");
271 if (maxMap != sensorObject->second.end())
273 max = std::visit(VariantToDoubleVisitor(), maxMap->second);
275 if (minMap != sensorObject->second.end())
277 min = std::visit(VariantToDoubleVisitor(), minMap->second);
282 auto lower = critical->second.find("CriticalLow");
283 auto upper = critical->second.find("CriticalHigh");
284 if (lower != critical->second.end())
286 double value = std::visit(VariantToDoubleVisitor(), lower->second);
292 if (upper != critical->second.end())
294 double value = std::visit(VariantToDoubleVisitor(), upper->second);
303 auto lower = warning->second.find("WarningLow");
304 auto upper = warning->second.find("WarningHigh");
305 if (lower != warning->second.end())
307 double value = std::visit(VariantToDoubleVisitor(), lower->second);
313 if (upper != warning->second.end())
315 double value = std::visit(VariantToDoubleVisitor(), upper->second);
349 lastUpdate = updateFind->second;
354 if (std::chrono::duration_cast<std::chrono::seconds>(now - lastUpdate)
360 // Documented in the phosphor-dbus-interfaces repository.
400 auto path = connection->second.find(sensorPath);
401 if (path == connection->second.end())
405 sensorMap = path->second;
426 std::get_if<std::vector<std::string>>(&supportedProperty->second);
451 (assertOffset & (assertOffset - 1)))
464 if (index >= profiles->size())
470 return profiles->at(index);
516 name = path.substr(nameStart + 1, std::string::npos - nameStart);
570 auto itr = std::find(profiles->begin(), profiles->end(), mode);
571 if (itr == profiles->end())
578 static_cast<std::size_t>(std::distance(profiles->begin(), itr));
604 * The D-Bus sensors work well for generating Type 01 SDRs.
607 * insertion of non-Type 01 records.
608 * Manage non-Type 01 records:
610 * Create a new file: dbus-sdr/sensorcommands_oem.cpp
616 * Enable 'sensors-oem' in your phosphor-ipmi-host bbappend file
617 * 'EXTRA_OEMESON:append = " -Dsensors-oem=enabled"'
636 ->getIpmiEntityRecords();
655 ->getIpmiEntityRecords();
657 size_t sdrIndex(recordID - ipmi::getNumberOfSensors());
659 size_t fruCount{otherCount - ipmi::storage::type12Count - entityCount};
670 sdrIndex - fruCount - ipmi::storage::type12Count));
681 size_t type12Index = sdrIndex - fruCount;
726 if (ipmi::getChannelInfo(ctx->channel, chInfo) != ipmi::ccSuccess)
729 ctx->channel);
744 generatorID = (ctx->channel << 12) // Channel
746 | (0x0 << 8) // 0x0 for sys-soft ID
754 generatorID = (ctx->channel << 12) // Channel
756 | ((ctx->lun & 0x3) << 8) // Lun
757 | (ctx->rqSA << 1);
810 (ctx->lun << 8) | sensorNumber))
816 sensor::calculateValue(reading, sensorMap, sensorObject->second);
866 sensor::calculateVRMode(assertOffset, sensorObject->second);
914 (sensor->second.mutability & ipmi::sensor::Mutability::Read))
923 sensor->second.getFunc(sensor->second);
962 sensorObject->second.find("Value") == sensorObject->second.end())
966 auto& valueVariant = sensorObject->second["Value"];
998 auto findAvailable = availableObject->second.find("Available");
999 if (findAvailable != availableObject->second.end())
1001 bool* available = std::get_if<bool>(&(findAvailable->second));
1029 if (details::sdrStatsTable.updateReading((ctx->lun << 8) | sensnum,
1033 double step = (max - min) / 255.0;
1039 details::sdrStatsTable.getName((ctx->lun << 8) | sensnum),
1051 auto alarmHigh = warningObject->second.find("WarningAlarmHigh");
1052 auto alarmLow = warningObject->second.find("WarningAlarmLow");
1053 if (alarmHigh != warningObject->second.end())
1055 if (std::get<bool>(alarmHigh->second))
1061 if (alarmLow != warningObject->second.end())
1063 if (std::get<bool>(alarmLow->second))
1075 auto alarmHigh = criticalObject->second.find("CriticalAlarmHigh");
1076 auto alarmLow = criticalObject->second.find("CriticalAlarmLow");
1077 if (alarmHigh != criticalObject->second.end())
1079 if (std::get<bool>(alarmHigh->second))
1085 if (alarmLow != criticalObject->second.end())
1087 if (std::get<bool>(alarmLow->second))
1100 * @param sensorNumber - sensor number
1108 * @param lowerNonCritical - lower non-critical threshold
1109 * @param lowerCritical - Lower critical threshold
1110 * @param lowerNonRecoverable - Lower non recovarable threshold
1111 * @param upperNonCritical - Upper non-critical threshold
1112 * @param upperCritical - Upper critical
1113 * @param upperNonRecoverable - Upper Non-recoverable
1192 auto findLower = findThreshold->second.find("CriticalLow");
1193 if (findLower == findThreshold->second.end())
1198 findThreshold->first);
1202 auto findUpper = findThreshold->second.find("CriticalHigh");
1203 if (findUpper == findThreshold->second.end())
1208 findThreshold->first);
1221 auto findLower = findThreshold->second.find("WarningLow");
1222 if (findLower == findThreshold->second.end())
1227 findThreshold->first);
1231 auto findUpper = findThreshold->second.find("WarningHigh");
1232 if (findUpper == findThreshold->second.end())
1237 findThreshold->first);
1289 auto& warningMap = warningInterface->second;
1297 std::visit(VariantToDoubleVisitor(), warningHigh->second);
1307 std::visit(VariantToDoubleVisitor(), warningLow->second);
1317 auto& criticalMap = criticalInterface->second;
1325 std::visit(VariantToDoubleVisitor(), criticalHigh->second);
1335 std::visit(VariantToDoubleVisitor(), criticalLow->second);
1426 * @param sensorNumber - sensor number
1429 * - enabled - Sensor Event messages
1430 * - assertionEnabledLsb - Assertion event messages
1431 * - assertionEnabledMsb - Assertion event messages
1432 * - deassertionEnabledLsb - Deassertion event messages
1433 * - deassertionEnabledMsb - Deassertion event messages
1472 for (auto& offsetValMap : sensor->second.propertyInterfaces.begin()
1473 ->second.begin()
1474 ->second.second)
1505 auto& warningMap = warningInterface->second;
1512 std::visit(VariantToDoubleVisitor(), warningHigh->second);
1526 std::visit(VariantToDoubleVisitor(), warningLow->second);
1540 auto& criticalMap = criticalInterface->second;
1548 std::visit(VariantToDoubleVisitor(), criticalHigh->second);
1561 std::visit(VariantToDoubleVisitor(), criticalLow->second);
1580 * @param sensorNumber - sensor number, FFh = reserved
1583 * - sensorEventStatus - Sensor Event messages state
1584 * - assertions - Assertion event messages
1585 * - deassertions - Deassertion event messages
1616 sensor->second, path, sensor->second.sensorInterface);
1662 vrInterface->second, assertions))
1714 auto& warningMap = warningInterface->second;
1723 warningHighAlarm = std::get<bool>(warningHigh->second);
1727 warningLowAlarm = std::get<bool>(warningLow->second);
1744 auto& criticalMap = criticalInterface->second;
1753 criticalHighAlarm = std::get<bool>(criticalHigh->second);
1757 criticalLowAlarm = std::get<bool>(criticalLow->second);
1786 record.header.recordLength = sizeof(get_sdr::SensorDataFullRecord) -
1809 record.body.sensorCapabilities = 0x68; // auto rearm - todo hysteresis
1816 record.body.sensorUnits2Base = static_cast<uint8_t>(findUnits->second);
1856 // from sensorhandler.hpp in phosphor-ipmi-host.
1861 // Byte 22-24 are for other purposes
1908 get_sdr::body::setIdType(3, record.body); // "8-bit ASCII + Latin 1"
1921 mappedVariant<bool>(mutability->second, "Mutable", false);
2003 record.body.entityId = sensor->second.entityType;
2004 record.body.sensorType = sensor->second.sensorType;
2005 record.body.eventReadingType = sensor->second.sensorReadingType;
2006 record.body.entityInstance = sensor->second.instance;
2008 (sensor->second.mutability & ipmi::sensor::Mutability::Write))
2013 auto idString = sensor->second.sensorName;
2015 if (idString.empty())
2017 idString = sensor->second.sensorNameFunc(sensor->second);
2028 get_sdr::body::setIdType(3, &record.body); // "8-bit ASCII + Latin 1"
2044 record.header.recordLength = sizeof(get_sdr::SensorDataEventRecord) -
2091 get_sdr::body::setIdType(3, record.body); // "8-bit ASCII + Latin 1"
2114 ipmi::sensor::getOtherSensorsCount(ctx) - 1;
2155 ctx->lun = lun1;
2163 ctx->lun = lun3;
2187 (lun != ctx->lun))
2272 * - sdrCount - sensor/SDR count
2273 * - lunsAndDynamicPopulation - static/Dynamic sensor population flag
2289 if (!getSensorSubtree(sensorTree) || sensorTree.empty())
2296 sdrCount = numSensors + ipmi::sensor::getOtherSensorsCount(ctx) - 1;
2301 if ((ctx->lun == lun0) && (numSensors > 0))
2306 else if ((ctx->lun == lun1) && (numSensors > maxSensorsPerLUN))
2310 : (numSensors - maxSensorsPerLUN) & maxSensorsPerLUN;
2312 else if (ctx->lun == lun3)
2316 sdrCount = (numSensors - (2 * maxSensorsPerLUN)) &
2385 * - allocUnits - Number of possible allocation units
2386 * - allocUnitSize - Allocation unit size in bytes.
2387 * - allocUnitFree - Number of free allocation units
2388 * - allocUnitLargestFree - Largest free block in allocation units
2389 * - maxRecordSize - Maximum record size in allocation units.
2413 * - sdrReservationID
2441 if (!getSensorSubtree(sensorTree) && sensorTree.empty())
2468 sizeof(get_sdr::SensorDataRecordHeader) + hdr->recordLength;
2476 bytesToRead = sdrLength - offset;
2509 if (!getSensorSubtree(sensorTree) && sensorTree.empty())
2532 const auto& connection = sensor.second.begin()->first;
2549 * in the Entity-Manger.
2556 if (entityIdValue == match->first || entityIdValue == match->second)
2567 if (!sensorList.empty())
2640 scaleVal = std::visit(ipmi::VariantToDoubleVisitor(), scaleIt->second);
2654 tempVal = std::visit(ipmi::VariantToDoubleVisitor(), tempValIt->second);
2691 if (sensorList.empty())
2748 if (sensorList.empty())