Enabling NVMe sensor support
This commit introduces the support for NVMe drives for sensors.
All the NVMe drives which are detected by the FRU manager and are
present in the inventory are scanned at regular interval for reading
the temperature values of the NVMe devices.
Tested:
NAME TYPE SIGNATURE RESULT/VALUE
org.freedesktop.DBus.Introspectable interface - -
.Introspect method - s
org.freedesktop.DBus.Peer interface - -
.GetMachineId method - s
.Ping method - -
org.freedesktop.DBus.Properties interface - -
.Get method ss v
.GetAll method s a{sv}
.Set method ssv -
.PropertiesChanged signal sa{sv}as -
xyz.openbmc_project.Association.Definitions interface - -
.Associations property a(sss) 1 "chassis" "all_sensors" "/xyz/openb...
xyz.openbmc_project.Sensor.Threshold.Critical interface - -
.CriticalAlarmHigh property b false
.CriticalAlarmLow property b false
.CriticalHigh property d 115
.CriticalLow property d 0
xyz.openbmc_project.Sensor.Threshold.Warning interface - -
.WarningAlarmHigh property b false
.WarningAlarmLow property b false
.WarningHigh property d 110
.WarningLow property d 5
xyz.openbmc_project.Sensor.Value interface - -
.MaxValue property d 127
.MinValue property d -60
.Value property d 22
Change-Id: Icb119b424234d548c8ff5cda9c7a9517ec9696bb
Signed-off-by: Nikhil Potade <nikhil.potade@linux.intel.com>
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/include/NVMeSensor.hpp b/include/NVMeSensor.hpp
new file mode 100644
index 0000000..ec0bfd1
--- /dev/null
+++ b/include/NVMeSensor.hpp
@@ -0,0 +1,54 @@
+#pragma once
+
+#include <libmctp-smbus.h>
+#include <libmctp.h>
+
+#include <sensor.hpp>
+
+class NVMeSensor : public Sensor
+{
+ public:
+ NVMeSensor(sdbusplus::asio::object_server& objectServer,
+ boost::asio::io_service& io,
+ std::shared_ptr<sdbusplus::asio::connection>& conn,
+ const std::string& sensorName,
+ std::vector<thresholds::Threshold>&& _thresholds,
+ const std::string& sensorConfiguration, const int busNumber);
+ virtual ~NVMeSensor();
+
+ NVMeSensor& operator=(const NVMeSensor& other) = delete;
+
+ size_t errorCount;
+ int bus;
+
+ private:
+ sdbusplus::asio::object_server& objServer;
+
+ void checkThresholds(void) override;
+};
+
+struct NVMeContext : std::enable_shared_from_this<NVMeContext>
+{
+ NVMeContext(boost::asio::io_service& io, int rootBus);
+
+ virtual ~NVMeContext();
+
+ void pollNVMeDevices();
+
+ boost::asio::deadline_timer scanTimer;
+ int rootBus; // Root bus for this drive
+ boost::asio::deadline_timer mctpResponseTimer;
+ boost::asio::ip::tcp::socket nvmeSlaveSocket;
+ std::list<std::shared_ptr<NVMeSensor>> sensors; // used as a poll queue
+};
+
+using NVMEMap = boost::container::flat_map<int, std::shared_ptr<NVMeContext>>;
+
+int verifyIntegrity(uint8_t* msg, size_t len);
+
+namespace nvmeMCTP
+{
+void init(void);
+}
+
+NVMEMap& getNVMEMap(void);