Support LED control for phosphor-nvme
- Add logic control of the LED
- Set inventory of NVMe drive to D-bus inventory manager
Change-Id: Ie1ef6b1a4523fcc80c3c2e9d274edd6fd02b2990
Signed-off-by: Tony Lee <tony.lee@quantatw.com>
diff --git a/nvme_manager.hpp b/nvme_manager.hpp
index 2b0e27d..85389e4 100644
--- a/nvme_manager.hpp
+++ b/nvme_manager.hpp
@@ -3,6 +3,7 @@
#include "config.h"
#include "nvmes.hpp"
+#include "sdbusplus.hpp"
#include <fstream>
#include <sdbusplus/bus.hpp>
@@ -32,7 +33,7 @@
/** @brief Constructs Nvme
*
* @param[in] bus - Handle to system dbus
- * @param[in] objPath - The Dbus path of nvme
+ * @param[in] objPath - The dbus path of nvme
*/
Nvme(sdbusplus::bus::bus& bus) :
bus(bus), _event(sdeventplus::Event::get_default()),
@@ -49,8 +50,12 @@
{
std::string index;
uint8_t busID;
+ std::string faultLedGroupPath;
uint8_t presentPin;
uint8_t pwrGoodPin;
+ std::string locateLedControllerBusName;
+ std::string locateLedControllerPath;
+ std::string locateLedGroupPath;
int8_t criticalHigh;
int8_t criticalLow;
int8_t maxValue;
@@ -87,6 +92,33 @@
std::unordered_map<std::string, std::shared_ptr<phosphor::nvme::NvmeSSD>>
nvmes;
+ /** @brief Set locate and fault LED status of SSD
+ *
+ * @param[in] config - Nvme configure data
+ * @param[in] success - Success or not that get NVMe Info by SMbus
+ * @param[in] nvmeData - Nvme information
+ */
+ void setLEDsStatus(const phosphor::nvme::Nvme::NVMeConfig& config,
+ bool success,
+ const phosphor::nvme::Nvme::NVMeData& nvmeData);
+
+ /** @brief Set SSD fault LED status */
+ void setFaultLED(const std::string& locateLedGroupPath,
+ const std::string& ledPath, bool request);
+ /** @brief Set SSD locate LED status */
+ void setLocateLED(const std::string& ledPath,
+ const std::string& locateLedBusName,
+ const std::string& locateLedPath, bool ispresent);
+ /** @brief Get Identify State*/
+ bool getLEDGroupState(const std::string& ledPath);
+
+ /** @brief Set inventory properties of nvme */
+ void setNvmeInventoryProperties(
+ bool present, const phosphor::nvme::Nvme::NVMeData& nvmeData,
+ const std::string& inventoryPath);
+
+ void createNVMeInventory();
+
private:
/** @brief sdbusplus bus client connection. */
sdbusplus::bus::bus& bus;