Get Present property for Dimms
From smbios file, for physically not present dimms details are filled
as "NO DIMM". Using which populating Present property under
xyz.openbmc_project.Inventory.Item interface with
true/false that indicates presence of dimms and making manufacturer
value empty for no dimm presence.
Tested:
Checked property is filled via dbus call.
Signed-off-by: Joshi-Mansi <mansi.joshi@linux.intel.com>
Change-Id: I84b05aeef3f77353fee1b663d39f3451c8faa337
diff --git a/include/dimm.hpp b/include/dimm.hpp
index 7d69a29..79da4cf 100644
--- a/include/dimm.hpp
+++ b/include/dimm.hpp
@@ -19,6 +19,7 @@
#include <xyz/openbmc_project/Inventory/Decorator/Asset/server.hpp>
#include <xyz/openbmc_project/Inventory/Item/Dimm/server.hpp>
+#include <xyz/openbmc_project/Inventory/Item/server.hpp>
namespace phosphor
{
@@ -33,7 +34,9 @@
sdbusplus::server::object::object<
sdbusplus::xyz::openbmc_project::Inventory::Item::server::Dimm>,
sdbusplus::server::object::object<
- sdbusplus::xyz::openbmc_project::Inventory::Decorator::server::Asset>
+ sdbusplus::xyz::openbmc_project::Inventory::Decorator::server::Asset>,
+ sdbusplus::server::object::object<
+ sdbusplus::xyz::openbmc_project::Inventory::server::Item>
{
public:
Dimm() = delete;
@@ -52,6 +55,9 @@
sdbusplus::server::object::object<
sdbusplus::xyz::openbmc_project::Inventory::Decorator::server::
Asset>(bus, objPath.c_str()),
+ sdbusplus::server::object::object<
+ sdbusplus::xyz::openbmc_project::Inventory::server::Item>(
+ bus, objPath.c_str()),
dimmNum(dimmId), storage(smbiosTableStorage)
{
memoryInfoUpdate();
@@ -66,6 +72,7 @@
std::string memoryTypeDetail(std::string value) override;
uint16_t maxMemorySpeedInMhz(uint16_t value) override;
std::string manufacturer(std::string value) override;
+ bool present(bool value) override;
std::string serialNumber(std::string value) override;
std::string partNumber(std::string value) override;
uint8_t memoryAttributes(uint8_t value) override;
diff --git a/src/dimm.cpp b/src/dimm.cpp
index 71123d2..a1763dc 100644
--- a/src/dimm.cpp
+++ b/src/dimm.cpp
@@ -171,7 +171,18 @@
{
std::string result = positionToString(positionNum, structLen, dataIn);
+ bool val = true;
+ if (result == "NO DIMM")
+ {
+ val = false;
+
+ // No dimm presence so making manufacturer value as "" (instead of
+ // NO DIMM - as there won't be any manufacturer for DIMM which is not
+ // present).
+ result = "";
+ }
manufacturer(result);
+ present(val);
}
std::string Dimm::manufacturer(std::string value)
@@ -180,6 +191,12 @@
Asset::manufacturer(value);
}
+bool Dimm::present(bool value)
+{
+ return sdbusplus::xyz::openbmc_project::Inventory::server::Item::present(
+ value);
+}
+
void Dimm::dimmSerialNum(const uint8_t positionNum, const uint8_t structLen,
uint8_t* dataIn)
{