diff options
Diffstat (limited to 'meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/0001-lev-add-poweron-monitor-feature.patch')
-rw-r--r-- | meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/0001-lev-add-poweron-monitor-feature.patch | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/0001-lev-add-poweron-monitor-feature.patch b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/0001-lev-add-poweron-monitor-feature.patch index dfe82ef8e..c279e0b81 100644 --- a/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/0001-lev-add-poweron-monitor-feature.patch +++ b/meta-quanta/meta-gbs/recipes-phosphor/sensors/phosphor-hwmon/0001-lev-add-poweron-monitor-feature.patch @@ -1,18 +1,18 @@ -From 58eec8f1f80e274ff669bd19c00b8f1ea8ceae0f Mon Sep 17 00:00:00 2001 -From: Duke Du <Duke.Du@quantatw.com> -Date: Mon, 18 May 2020 19:45:27 +0800 -Subject: [PATCH] lev-add-poweron-monitor-feature +From 2cea5d289b278db4468b16bf6b64102655811fd0 Mon Sep 17 00:00:00 2001 +From: Eddielu <Eddie.Lu@quantatw.com> +Date: Mon, 27 Jul 2020 20:30:22 +0800 +Subject: [PATCH] Update lev-add-poweron-monitor-feature patch. --- Makefile.am | 2 ++ - mainloop.cpp | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + mainloop.cpp | 102 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ sensor.cpp | 11 ++++++- sensor.hpp | 13 ++++++++ thresholds.hpp | 2 -- - 5 files changed, 126 insertions(+), 3 deletions(-) + 5 files changed, 127 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am -index 378c565..5fa230a 100644 +index 706a6cc..c620fa4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -46,6 +46,7 @@ libhwmon_la_LIBADD = \ @@ -22,8 +22,8 @@ index 378c565..5fa230a 100644 + $(PTHREAD_LIBS) \ $(GPIOPLUS_LIBS) \ $(STDPLUS_LIBS) \ - $(CODE_COVERAGE_LIBS) -@@ -54,6 +55,7 @@ libhwmon_la_CXXFLAGS = \ + $(CODE_COVERAGE_LIBS) \ +@@ -55,6 +56,7 @@ libhwmon_la_CXXFLAGS = \ $(SDEVENTPLUS_CFLAGS) \ $(PHOSPHOR_DBUS_INTERFACES_CFLAGS) \ $(PHOSPHOR_LOGGING_CFLAGS) \ @@ -32,10 +32,10 @@ index 378c565..5fa230a 100644 $(CODE_COVERAGE_CXXFLAGS) diff --git a/mainloop.cpp b/mainloop.cpp -index bd334a0..1769e94 100644 +index 3e7e0bf..4789a80 100644 --- a/mainloop.cpp +++ b/mainloop.cpp -@@ -39,6 +39,12 @@ +@@ -41,6 +41,12 @@ #include <string> #include <unordered_set> #include <xyz/openbmc_project/Sensor/Device/error.hpp> @@ -48,20 +48,20 @@ index bd334a0..1769e94 100644 using namespace phosphor::logging; -@@ -74,6 +80,12 @@ decltype( +@@ -76,6 +82,12 @@ decltype( Thresholds<CriticalObject>::alarmHi) Thresholds<CriticalObject>::alarmHi = &CriticalObject::criticalAlarmHigh; +static std::unique_ptr<phosphor::Timer> cacheTimer = nullptr; +static std::unique_ptr<sdbusplus::bus::match::match> powerMatch = nullptr; +static bool powerStatusOn = false; -+static boost::asio::io_service io; ++static boost::asio::io_service io; +static auto conn = std::make_shared<sdbusplus::asio::connection>(io); + - void updateSensorInterfaces(InterfaceMap& ifaces, int64_t value) + void updateSensorInterfaces(InterfaceMap& ifaces, SensorValueType value) { for (auto& iface : ifaces) -@@ -101,6 +113,83 @@ void updateSensorInterfaces(InterfaceMap& ifaces, int64_t value) +@@ -103,6 +115,84 @@ void updateSensorInterfaces(InterfaceMap& ifaces, SensorValueType value) } } @@ -134,18 +134,19 @@ index bd334a0..1769e94 100644 + powerStatusOn = + boost::ends_with(std::get<std::string>(state), "Running"); + }, -+ "xyz.openbmc_project.State.Host", -+ "/xyz/openbmc_project/state/host0", ++ "xyz.openbmc_project.State.Host", ++ "/xyz/openbmc_project/state/host0", + "org.freedesktop.DBus.Properties", "Get", + "xyz.openbmc_project.State.Host", "CurrentHostState"); + + createTimer(); +} + ++ std::string MainLoop::getID(SensorSet::container_t::const_reference sensor) { std::string id; -@@ -385,6 +474,7 @@ void MainLoop::init() +@@ -384,6 +474,7 @@ void MainLoop::init() _interval = std::strtoull(interval.c_str(), NULL, 10); } } @@ -153,7 +154,7 @@ index bd334a0..1769e94 100644 } void MainLoop::read() -@@ -429,6 +519,12 @@ void MainLoop::read() +@@ -428,6 +519,12 @@ void MainLoop::read() try { @@ -166,23 +167,23 @@ index bd334a0..1769e94 100644 if (sensor->hasFaultFile()) { auto fault = _ioAccess->read(sensorSysfsType, sensorSysfsNum, -@@ -491,6 +587,11 @@ void MainLoop::read() +@@ -490,6 +587,11 @@ void MainLoop::read() } } + if(sensor->pwrOnMonitor() && !isPowerOn()) + { + statusIface->functional(false); -+ continue; ++ continue; + } updateSensorInterfaces(obj, value); } catch (const std::system_error& e) diff --git a/sensor.cpp b/sensor.cpp -index 145ba6c..93bbb03 100644 +index 09aeca6..b1cb470 100644 --- a/sensor.cpp +++ b/sensor.cpp -@@ -41,7 +41,7 @@ Sensor::Sensor(const SensorSet::key_type& sensor, +@@ -31,7 +31,7 @@ Sensor::Sensor(const SensorSet::key_type& sensor, const hwmonio::HwmonIOInterface* ioAccess, const std::string& devPath) : _sensor(sensor), @@ -191,7 +192,7 @@ index 145ba6c..93bbb03 100644 { auto chip = env::getEnv("GPIOCHIP", sensor); auto access = env::getEnv("GPIO", sensor); -@@ -70,6 +70,15 @@ Sensor::Sensor(const SensorSet::key_type& sensor, +@@ -60,6 +60,15 @@ Sensor::Sensor(const SensorSet::key_type& sensor, auto senRmRCs = env::getEnv("REMOVERCS", sensor); // Add sensor removal return codes defined per sensor addRemoveRCs(senRmRCs); |