Tony Lee | 6c59501 | 2019-06-19 10:54:59 +0800 | [diff] [blame] | 1 | #include "nvmes.hpp" |
| 2 | |
Brandon Kim | d5838d1 | 2021-05-19 12:51:55 -0700 | [diff] [blame^] | 3 | #include <xyz/openbmc_project/Sensor/Threshold/Critical/server.hpp> |
| 4 | #include <xyz/openbmc_project/Sensor/Threshold/Warning/server.hpp> |
| 5 | #include <xyz/openbmc_project/Sensor/Value/server.hpp> |
| 6 | |
Tony Lee | 6c59501 | 2019-06-19 10:54:59 +0800 | [diff] [blame] | 7 | namespace phosphor |
| 8 | { |
| 9 | namespace nvme |
| 10 | { |
| 11 | |
| 12 | void NvmeSSD::checkSensorThreshold() |
| 13 | { |
| 14 | int8_t value = ValueIface::value(); |
| 15 | int8_t criticalHigh = CriticalInterface::criticalHigh(); |
| 16 | int8_t criticalLow = CriticalInterface::criticalLow(); |
| 17 | int8_t warningHigh = WarningInterface::warningHigh(); |
| 18 | int8_t warningLow = WarningInterface::warningLow(); |
| 19 | |
| 20 | CriticalInterface::criticalAlarmHigh(value > criticalHigh); |
| 21 | |
| 22 | CriticalInterface::criticalAlarmLow(value < criticalLow); |
| 23 | |
| 24 | WarningInterface::warningAlarmHigh(value > warningHigh); |
| 25 | |
| 26 | WarningInterface::warningAlarmLow(value < warningLow); |
| 27 | } |
| 28 | |
| 29 | void NvmeSSD::setSensorThreshold(int8_t criticalHigh, int8_t criticalLow, |
Tony Lee | 6c59501 | 2019-06-19 10:54:59 +0800 | [diff] [blame] | 30 | int8_t warningHigh, int8_t warningLow) |
| 31 | { |
Tony Lee | 6c59501 | 2019-06-19 10:54:59 +0800 | [diff] [blame] | 32 | CriticalInterface::criticalHigh(criticalHigh); |
| 33 | CriticalInterface::criticalLow(criticalLow); |
| 34 | |
| 35 | WarningInterface::warningHigh(warningHigh); |
| 36 | WarningInterface::warningLow(warningLow); |
George Hung | 831f204 | 2021-05-19 17:02:29 +0800 | [diff] [blame] | 37 | } |
Tony Lee | 6c59501 | 2019-06-19 10:54:59 +0800 | [diff] [blame] | 38 | |
George Hung | 831f204 | 2021-05-19 17:02:29 +0800 | [diff] [blame] | 39 | void NvmeSSD::setSensorMaxMin(int8_t maxValue, int8_t minValue) |
| 40 | { |
Tony Lee | 6c59501 | 2019-06-19 10:54:59 +0800 | [diff] [blame] | 41 | ValueIface::maxValue(maxValue); |
| 42 | ValueIface::minValue(minValue); |
| 43 | } |
| 44 | |
| 45 | void NvmeSSD::setSensorValueToDbus(const int8_t value) |
| 46 | { |
| 47 | ValueIface::value(value); |
| 48 | } |
| 49 | |
| 50 | } // namespace nvme |
George Hung | 831f204 | 2021-05-19 17:02:29 +0800 | [diff] [blame] | 51 | } // namespace phosphor |