summaryrefslogtreecommitdiff
path: root/services
diff options
context:
space:
mode:
authorcyang29 <cheng.c.yang@intel.com>2018-10-18 20:42:08 +0300
committercyang29 <cheng.c.yang@intel.com>2018-10-18 21:00:11 +0300
commit9d43c8887b2bb3ce677e3cee253cb55a7af18897 (patch)
tree80238e9b16ee23f7c9138df0e9caf3f0f413cf7e /services
parentaeb90faa6c3e0cdfea9a1b3605f60673fcdff960 (diff)
downloadprovingground-9d43c8887b2bb3ce677e3cee253cb55a7af18897.tar.xz
Add DIMM and system dbus service for MDR V2
Add all DIMM information in smbios table and provide dbus interface for redfish to get DIMM information. Also add BIOS Version and System UUID dbus interface. Unit test: After enable this application and MDR V2 ipmi command lib and power on host, user can get all dimm and cpu information by commands - busctl introspect xyz.openbmc_project.Smbios.MDR_V2 /xyz/openbmc_project/inventory/system/chassis/motherboard/cpux and busctl introspect xyz.openbmc_project.Smbios.MDR_V2 /xyz/openbmc_project/inventory/system/chassis/motherboard/dimmx Change-Id: I49127b0b0e7213f65f64791957fbbcef764b54ae Signed-off-by: cyang29 <cheng.c.yang@intel.com>
Diffstat (limited to 'services')
-rw-r--r--services/smbios-mdrv2/CMakeLists.txt3
-rw-r--r--services/smbios-mdrv2/include/cpu.hpp39
-rw-r--r--services/smbios-mdrv2/include/dimm.hpp126
-rw-r--r--services/smbios-mdrv2/include/mdrv2.hpp7
-rw-r--r--services/smbios-mdrv2/include/smbios_mdrv2.hpp (renamed from services/smbios-mdrv2/include/smbios-mdrv2.hpp)6
-rw-r--r--services/smbios-mdrv2/include/system.hpp114
-rw-r--r--services/smbios-mdrv2/src/cpu.cpp5
-rw-r--r--services/smbios-mdrv2/src/dimm.cpp217
-rw-r--r--services/smbios-mdrv2/src/mdrv2.cpp54
-rw-r--r--services/smbios-mdrv2/src/smbios_mdrv2_main.cpp (renamed from services/smbios-mdrv2/src/smbios-mdrv2-main.cpp)0
-rw-r--r--services/smbios-mdrv2/src/system.cpp78
11 files changed, 626 insertions, 23 deletions
diff --git a/services/smbios-mdrv2/CMakeLists.txt b/services/smbios-mdrv2/CMakeLists.txt
index b707347..91612d6 100644
--- a/services/smbios-mdrv2/CMakeLists.txt
+++ b/services/smbios-mdrv2/CMakeLists.txt
@@ -31,7 +31,8 @@ pkg_check_modules (DBUSINTERFACE phosphor-dbus-interfaces REQUIRED)
include_directories (${DBUSINTERFACE_INCLUDE_DIRS})
link_directories (${DBUSINTERFACE_LIBRARY_DIRS})
-set (SRC_FILES src/mdrv2.cpp src/smbios-mdrv2-main.cpp src/cpu.cpp)
+set (SRC_FILES src/mdrv2.cpp src/smbios_mdrv2_main.cpp src/cpu.cpp src/dimm.cpp
+ src/system.cpp)
include_directories (${CMAKE_CURRENT_BINARY_DIR})
diff --git a/services/smbios-mdrv2/include/cpu.hpp b/services/smbios-mdrv2/include/cpu.hpp
index 3b12c41..9effb21 100644
--- a/services/smbios-mdrv2/include/cpu.hpp
+++ b/services/smbios-mdrv2/include/cpu.hpp
@@ -15,7 +15,7 @@
*/
#pragma once
-#include "smbios-mdrv2.hpp"
+#include "smbios_mdrv2.hpp"
#include <xyz/openbmc_project/Inventory/Item/Cpu/server.hpp>
@@ -26,13 +26,13 @@ namespace smbios
{
// Definition follow smbios spec DSP0134 3.0.0
-static const std::map<uint8_t, std::string> processorTypeTable = {
+static const std::map<uint8_t, const char *> processorTypeTable = {
{0x1, "Other"}, {0x2, "Unknown"}, {0x3, "Central Processor"},
{0x4, "Math Processor"}, {0x5, "DSP Processor"}, {0x6, "Video Processor"},
};
// Definition follow smbios spec DSP0134 3.0.0
-static const std::map<uint8_t, std::string> familyTable = {
+static const std::map<uint8_t, const char *> familyTable = {
{0x1, "Other"},
{0x2, "Unknown"},
{0x10, "Pentium II Xeon processor"},
@@ -68,22 +68,23 @@ static const std::map<uint8_t, std::string> familyTable = {
};
// Definition follow smbios spec DSP0134 3.0.0
-static const std::string characteristicsTable[16]{"Reserved",
- "Unknown",
- "64-bit Capable",
- "Multi-Core",
- "Hardware Thread",
- "Execute Protection",
- "Enhanced Virtualization",
- "Power/Performance Control",
- "Reserved",
- "Reserved",
- "Reserved",
- "Reserved",
- "Reserved",
- "Reserved",
- "Reserved",
- "Reserved"};
+static const std::array<std::string, 16> characteristicsTable{
+ "Reserved",
+ "Unknown",
+ "64-bit Capable",
+ "Multi-Core",
+ "Hardware Thread",
+ "Execute Protection",
+ "Enhanced Virtualization",
+ "Power/Performance Control",
+ "Reserved",
+ "Reserved",
+ "Reserved",
+ "Reserved",
+ "Reserved",
+ "Reserved",
+ "Reserved",
+ "Reserved"};
class Cpu : sdbusplus::server::object::object<
sdbusplus::xyz::openbmc_project::Inventory::Item::server::Cpu>
diff --git a/services/smbios-mdrv2/include/dimm.hpp b/services/smbios-mdrv2/include/dimm.hpp
new file mode 100644
index 0000000..05131f5
--- /dev/null
+++ b/services/smbios-mdrv2/include/dimm.hpp
@@ -0,0 +1,126 @@
+/*
+// Copyright (c) 2018 Intel Corporation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+*/
+
+#pragma once
+#include "smbios_mdrv2.hpp"
+
+#include <xyz/openbmc_project/Inventory/Item/Dimm/server.hpp>
+
+namespace phosphor
+{
+
+namespace smbios
+{
+
+class Dimm : sdbusplus::server::object::object<
+ sdbusplus::xyz::openbmc_project::Inventory::Item::server::Dimm>
+{
+ public:
+ Dimm() = delete;
+ ~Dimm() = default;
+ Dimm(const Dimm &) = delete;
+ Dimm &operator=(const Dimm &) = delete;
+ Dimm(Dimm &&) = default;
+ Dimm &operator=(Dimm &&) = default;
+
+ Dimm(sdbusplus::bus::bus &bus, const std::string &objPath,
+ const uint8_t &dimmId, uint8_t *smbiosTableStorage) :
+
+ sdbusplus::server::object::object<
+ sdbusplus::xyz::openbmc_project::Inventory::Item::server::Dimm>(
+ bus, objPath.c_str()),
+ dimmNum(dimmId), storage(smbiosTableStorage)
+ {
+ memoryInfoUpdate();
+ }
+
+ void memoryInfoUpdate(void);
+
+ uint16_t memoryDataWidth(uint16_t value) override;
+ uint32_t memorySizeInKB(uint32_t value) override;
+ std::string memoryDeviceLocator(std::string value) override;
+ std::string memoryType(std::string value) override;
+ std::string memoryTypeDetail(std::string value) override;
+ uint16_t memorySpeed(uint16_t value) override;
+ std::string memoryManufacturer(std::string value) override;
+ std::string memorySerialNum(std::string value) override;
+ std::string memoryPartNum(std::string value) override;
+ uint8_t memoryAttributes(uint8_t value) override;
+ uint16_t memoryConfClockSpeed(uint16_t value) override;
+
+ private:
+ uint8_t dimmNum;
+
+ uint8_t *storage;
+
+ void dimmSize(const uint16_t size);
+ void dimmSizeExt(const uint32_t size);
+ void dimmDeviceLocator(const uint8_t positionNum, const uint8_t structLen,
+ uint8_t *dataIn);
+ void dimmType(const uint8_t type);
+ void dimmTypeDetail(const uint16_t detail);
+ void dimmManufacturer(const uint8_t positionNum, const uint8_t structLen,
+ uint8_t *dataIn);
+ void dimmSerialNum(const uint8_t positionNum, const uint8_t structLen,
+ uint8_t *dataIn);
+ void dimmPartNum(const uint8_t positionNum, const uint8_t structLen,
+ uint8_t *dataIn);
+
+ struct MemoryInfo
+ {
+ uint8_t type;
+ uint8_t length;
+ uint16_t handle;
+ uint16_t phyArrayHandle;
+ uint16_t errInfoHandle;
+ uint16_t totalWidth;
+ uint16_t dataWidth;
+ uint16_t size;
+ uint8_t formFactor;
+ uint8_t deviceSet;
+ uint8_t deviceLocator;
+ uint8_t bankLocator;
+ uint8_t memoryType;
+ uint16_t typeDetail;
+ uint16_t speed;
+ uint8_t manufacturer;
+ uint8_t serialNum;
+ uint8_t assetTag;
+ uint8_t partNum;
+ uint8_t attributes;
+ uint32_t extendedSize;
+ uint16_t confClockSpeed;
+ } __attribute__((packed));
+};
+
+const std::map<uint8_t, const char *> dimmTypeTable = {
+ {0x1, "Other"}, {0x2, "Unknown"}, {0x3, "DRAM"}, {0x4, "EDRAM"},
+ {0x5, "VRAM"}, {0x6, "SRAM"}, {0x7, "RAM"}, {0x8, "ROM"},
+ {0x9, "FLASH"}, {0xa, "EEPROM"}, {0xb, "FEPROM"}, {0xc, "EPROM"},
+ {0xd, "CDRAM"}, {0xe, "3DRAM"}, {0xf, "SDRAM"}, {0x10, "SGRAM"},
+ {0x11, "RDRAM"}, {0x12, "DDR"}, {0x13, "DDR2"}, {0x14, "DDR2 FB-DIMM"},
+ {0x18, "DDR3"}, {0x19, "FBD2"}, {0x1a, "DDR4"}, {0x1b, "LPDDR"},
+ {0x1c, "LPDDR2"}, {0x1d, "LPDDR3"}, {0x1e, "LPDDR4"}};
+
+const std::array<std::string, 16> detailTable{
+ "Reserved", "Other", "Unknown", "Fast-paged",
+ "Static column", "Pseudo-static", "RAMBUS", "Synchronous",
+ "CMOS", "EDO", "Window DRAM", "Cache DRAM",
+ "Non-volatile", "Registered", "Unbuffered", "LRDIMM"};
+
+} // namespace smbios
+
+} // namespace phosphor
diff --git a/services/smbios-mdrv2/include/mdrv2.hpp b/services/smbios-mdrv2/include/mdrv2.hpp
index dbb4b10..bf953df 100644
--- a/services/smbios-mdrv2/include/mdrv2.hpp
+++ b/services/smbios-mdrv2/include/mdrv2.hpp
@@ -16,7 +16,9 @@
#pragma once
#include "cpu.hpp"
-#include "smbios-mdrv2.hpp"
+#include "dimm.hpp"
+#include "smbios_mdrv2.hpp"
+#include "system.hpp"
#include <sys/stat.h>
#include <sys/types.h>
@@ -108,7 +110,10 @@ class MDR_V2 : sdbusplus::xyz::openbmc_project::Smbios::server::MDR_V2
void systemInfoUpdate(void);
int getTotalCpuSlot(void);
+ int getTotalDimmSlot(void);
std::vector<std::unique_ptr<Cpu>> cpus;
+ std::vector<std::unique_ptr<Dimm>> dimms;
+ std::unique_ptr<System> system;
};
} // namespace smbios
diff --git a/services/smbios-mdrv2/include/smbios-mdrv2.hpp b/services/smbios-mdrv2/include/smbios_mdrv2.hpp
index b468ece..191b2a2 100644
--- a/services/smbios-mdrv2/include/smbios-mdrv2.hpp
+++ b/services/smbios-mdrv2/include/smbios_mdrv2.hpp
@@ -120,6 +120,12 @@ struct MDRSMBIOSHeader
static constexpr const char *cpuPath =
"/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu";
+static constexpr const char *dimmPath =
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/dimm";
+
+static constexpr const char *systemPath =
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/bios";
+
typedef enum
{
biosType = 0,
diff --git a/services/smbios-mdrv2/include/system.hpp b/services/smbios-mdrv2/include/system.hpp
new file mode 100644
index 0000000..4c04cdd
--- /dev/null
+++ b/services/smbios-mdrv2/include/system.hpp
@@ -0,0 +1,114 @@
+/*
+// Copyright (c) 2018 Intel Corporation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+*/
+
+#pragma once
+#include "smbios_mdrv2.hpp"
+
+#include <xyz/openbmc_project/Common/UUID/server.hpp>
+#include <xyz/openbmc_project/Inventory/Decorator/Revision/server.hpp>
+
+namespace phosphor
+{
+
+namespace smbios
+{
+
+class System : sdbusplus::server::object::object<
+ sdbusplus::xyz::openbmc_project::Common::server::UUID>,
+ sdbusplus::server::object::object<
+ sdbusplus::xyz::openbmc_project::Inventory::Decorator::
+ server::Revision>
+{
+ public:
+ System() = delete;
+ ~System() = default;
+ System(const System &) = delete;
+ System &operator=(const System &) = delete;
+ System(System &&) = default;
+ System &operator=(System &&) = default;
+
+ System(sdbusplus::bus::bus &bus, const std::string &objPath,
+ uint8_t *smbiosTableStorage) :
+ sdbusplus::server::object::object<
+ sdbusplus::xyz::openbmc_project::Common::server::UUID>(
+ bus, objPath.c_str()),
+ sdbusplus::server::object::object<
+ sdbusplus::xyz::openbmc_project::Inventory::Decorator::server::
+ Revision>(bus, objPath.c_str()),
+ path(objPath), storage(smbiosTableStorage)
+ {
+ std::string input = "0";
+ uUID(input);
+ version("0.00");
+ }
+
+ std::string uUID(std::string value) override;
+
+ std::string version(std::string value) override;
+
+ private:
+ /** @brief Path of the group instance */
+ std::string path;
+
+ uint8_t *storage;
+
+ struct BIOSInfo
+ {
+ uint8_t type;
+ uint8_t length;
+ uint16_t handle;
+ uint8_t vendor;
+ uint8_t biosVersion;
+ uint16_t startAddrSegment;
+ uint8_t releaseData;
+ uint8_t romSize;
+ uint64_t characteristics;
+ uint16_t externCharacteristics;
+ uint8_t systemBIOSMajor;
+ uint8_t systemBIOSMinor;
+ uint8_t embeddedFirmwareMajor;
+ uint8_t embeddedFirmwareMinor;
+ } __attribute__((packed));
+
+ struct UUID
+ {
+ uint32_t timeLow;
+ uint16_t timeMid;
+ uint16_t timeHiAndVer;
+ uint8_t clockSeqHi;
+ uint8_t clockSeqLow;
+ uint8_t node[6];
+ } __attribute__((packed));
+
+ struct SystemInfo
+ {
+ uint8_t type;
+ uint8_t length;
+ uint16_t handle;
+ uint8_t manufacturer;
+ uint8_t productName;
+ uint8_t version;
+ uint8_t serialNum;
+ struct UUID uUID;
+ uint8_t wakeupType;
+ uint8_t skuNum;
+ uint8_t family;
+ } __attribute__((packed));
+};
+
+} // namespace smbios
+
+} // namespace phosphor
diff --git a/services/smbios-mdrv2/src/cpu.cpp b/services/smbios-mdrv2/src/cpu.cpp
index 82f4bdc..a0e2840 100644
--- a/services/smbios-mdrv2/src/cpu.cpp
+++ b/services/smbios-mdrv2/src/cpu.cpp
@@ -39,7 +39,7 @@ std::string Cpu::processorSocket(std::string value)
void Cpu::cpuType(const uint8_t value)
{
- std::map<uint8_t, std::string>::const_iterator it =
+ std::map<uint8_t, const char *>::const_iterator it =
processorTypeTable.find(value);
if (it == processorTypeTable.end())
{
@@ -59,7 +59,8 @@ std::string Cpu::processorType(std::string value)
void Cpu::cpuFamily(const uint8_t value)
{
- std::map<uint8_t, std::string>::const_iterator it = familyTable.find(value);
+ std::map<uint8_t, const char *>::const_iterator it =
+ familyTable.find(value);
if (it == familyTable.end())
{
processorFamily("Unknown Processor Family");
diff --git a/services/smbios-mdrv2/src/dimm.cpp b/services/smbios-mdrv2/src/dimm.cpp
new file mode 100644
index 0000000..a1e0895
--- /dev/null
+++ b/services/smbios-mdrv2/src/dimm.cpp
@@ -0,0 +1,217 @@
+/*
+// Copyright (c) 2018 Intel Corporation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+*/
+
+#include "dimm.hpp"
+
+#include "mdrv2.hpp"
+
+namespace phosphor
+{
+namespace smbios
+{
+
+static constexpr uint16_t maxOldDimmSize = 0x7fff;
+void Dimm::memoryInfoUpdate(void)
+{
+ uint8_t *dataIn = storage;
+
+ dataIn = getSMBIOSTypePtr(dataIn, memoryDeviceType);
+ for (uint8_t index = 0; index < dimmNum; index++)
+ {
+ dataIn = smbiosNextPtr(dataIn);
+ if (dataIn == nullptr)
+ {
+ return;
+ }
+ dataIn = getSMBIOSTypePtr(dataIn, memoryDeviceType);
+ if (dataIn == nullptr)
+ {
+ return;
+ }
+ }
+
+ auto memoryInfo = reinterpret_cast<struct MemoryInfo *>(dataIn);
+
+ memoryDataWidth(memoryInfo->dataWidth);
+
+ if (memoryInfo->size == maxOldDimmSize)
+ {
+ dimmSizeExt(memoryInfo->extendedSize);
+ }
+ else
+ {
+ dimmSize(memoryInfo->size);
+ }
+
+ dimmDeviceLocator(memoryInfo->deviceLocator, memoryInfo->length, dataIn);
+ dimmType(memoryInfo->memoryType);
+ dimmTypeDetail(memoryInfo->typeDetail);
+ memorySpeed(memoryInfo->speed);
+ dimmManufacturer(memoryInfo->manufacturer, memoryInfo->length, dataIn);
+ dimmSerialNum(memoryInfo->serialNum, memoryInfo->length, dataIn);
+ dimmPartNum(memoryInfo->partNum, memoryInfo->length, dataIn);
+ memoryAttributes(memoryInfo->attributes);
+ memoryConfClockSpeed(memoryInfo->confClockSpeed);
+
+ return;
+}
+
+uint16_t Dimm::memoryDataWidth(uint16_t value)
+{
+ return sdbusplus::xyz::openbmc_project::Inventory::Item::server::Dimm::
+ memoryDataWidth(value);
+}
+
+static constexpr uint16_t baseNewVersionDimmSize = 0x8000;
+static constexpr uint16_t dimmSizeUnit = 1024;
+void Dimm::dimmSize(const uint16_t size)
+{
+ uint32_t result = size & maxOldDimmSize;
+ if (0 == (size & baseNewVersionDimmSize))
+ {
+ result = result * dimmSizeUnit;
+ }
+ memorySizeInKB(result);
+}
+
+void Dimm::dimmSizeExt(uint32_t size)
+{
+ size = size * dimmSizeUnit;
+ memorySizeInKB(size);
+}
+
+uint32_t Dimm::memorySizeInKB(uint32_t value)
+{
+ return sdbusplus::xyz::openbmc_project::Inventory::Item::server::Dimm::
+ memorySizeInKB(value);
+}
+
+void Dimm::dimmDeviceLocator(const uint8_t positionNum, const uint8_t structLen,
+ uint8_t *dataIn)
+{
+ std::string result = positionToString(positionNum, structLen, dataIn);
+
+ memoryDeviceLocator(result);
+}
+
+std::string Dimm::memoryDeviceLocator(std::string value)
+{
+ return sdbusplus::xyz::openbmc_project::Inventory::Item::server::Dimm::
+ memoryDeviceLocator(value);
+}
+
+void Dimm::dimmType(const uint8_t type)
+{
+ std::map<uint8_t, const char *>::const_iterator it =
+ dimmTypeTable.find(type);
+ if (it == dimmTypeTable.end())
+ {
+ memoryType("Unknown Memory Type");
+ }
+ else
+ {
+ memoryType(it->second);
+ }
+}
+
+std::string Dimm::memoryType(std::string value)
+{
+ return sdbusplus::xyz::openbmc_project::Inventory::Item::server::Dimm::
+ memoryType(value);
+}
+
+void Dimm::dimmTypeDetail(uint16_t detail)
+{
+ std::string result;
+ for (uint8_t index = 0; index < (8 * sizeof(detail)); index++)
+ {
+ if (detail & 0x01)
+ {
+ result += detailTable[index];
+ }
+ detail >>= 1;
+ }
+ memoryTypeDetail(result);
+}
+
+std::string Dimm::memoryTypeDetail(std::string value)
+{
+ return sdbusplus::xyz::openbmc_project::Inventory::Item::server::Dimm::
+ memoryTypeDetail(value);
+}
+
+uint16_t Dimm::memorySpeed(uint16_t value)
+{
+ return sdbusplus::xyz::openbmc_project::Inventory::Item::server::Dimm::
+ memorySpeed(value);
+}
+
+void Dimm::dimmManufacturer(const uint8_t positionNum, const uint8_t structLen,
+ uint8_t *dataIn)
+{
+ std::string result = positionToString(positionNum, structLen, dataIn);
+
+ memoryManufacturer(result);
+}
+
+std::string Dimm::memoryManufacturer(std::string value)
+{
+ return sdbusplus::xyz::openbmc_project::Inventory::Item::server::Dimm::
+ memoryManufacturer(value);
+}
+
+void Dimm::dimmSerialNum(const uint8_t positionNum, const uint8_t structLen,
+ uint8_t *dataIn)
+{
+ std::string result = positionToString(positionNum, structLen, dataIn);
+
+ memorySerialNum(result);
+}
+
+std::string Dimm::memorySerialNum(std::string value)
+{
+ return sdbusplus::xyz::openbmc_project::Inventory::Item::server::Dimm::
+ memorySerialNum(value);
+}
+
+void Dimm::dimmPartNum(const uint8_t positionNum, const uint8_t structLen,
+ uint8_t *dataIn)
+{
+ std::string result = positionToString(positionNum, structLen, dataIn);
+
+ memoryPartNum(result);
+}
+
+std::string Dimm::memoryPartNum(std::string value)
+{
+ return sdbusplus::xyz::openbmc_project::Inventory::Item::server::Dimm::
+ memoryPartNum(value);
+}
+
+uint8_t Dimm::memoryAttributes(uint8_t value)
+{
+ return sdbusplus::xyz::openbmc_project::Inventory::Item::server::Dimm::
+ memoryAttributes(value);
+}
+
+uint16_t Dimm::memoryConfClockSpeed(uint16_t value)
+{
+ return sdbusplus::xyz::openbmc_project::Inventory::Item::server::Dimm::
+ memoryConfClockSpeed(value);
+}
+
+} // namespace smbios
+} // namespace phosphor
diff --git a/services/smbios-mdrv2/src/mdrv2.cpp b/services/smbios-mdrv2/src/mdrv2.cpp
index 38e21e8..91fb617 100644
--- a/services/smbios-mdrv2/src/mdrv2.cpp
+++ b/services/smbios-mdrv2/src/mdrv2.cpp
@@ -375,6 +375,26 @@ void MDR_V2::systemInfoUpdate()
cpus.emplace_back(std::make_unique<phosphor::smbios::Cpu>(
bus, path, index, smbiosDir.dir[smbiosDirIndex].dataStorage));
}
+
+ dimms.clear();
+
+ num = getTotalDimmSlot();
+ if (num == -1)
+ {
+ phosphor::logging::log<phosphor::logging::level::ERR>(
+ "get dimm total slot failed");
+ return;
+ }
+
+ for (int index = 0; index < num; index++)
+ {
+ std::string path = dimmPath + std::to_string(index);
+ dimms.emplace_back(std::make_unique<phosphor::smbios::Dimm>(
+ bus, path, index, smbiosDir.dir[smbiosDirIndex].dataStorage));
+ }
+
+ system = std::make_unique<System>(
+ bus, systemPath, smbiosDir.dir[smbiosDirIndex].dataStorage);
}
int MDR_V2::getTotalCpuSlot()
@@ -411,6 +431,40 @@ int MDR_V2::getTotalCpuSlot()
return num;
}
+int MDR_V2::getTotalDimmSlot()
+{
+ uint8_t *dataIn = smbiosDir.dir[smbiosDirIndex].dataStorage;
+ uint8_t num = 0;
+
+ if (dataIn == nullptr)
+ {
+ phosphor::logging::log<phosphor::logging::level::ERR>(
+ "Fail to get dimm total slot - no storage data");
+ return -1;
+ }
+
+ while (1)
+ {
+ dataIn = getSMBIOSTypePtr(dataIn, memoryDeviceType);
+ if (dataIn == nullptr)
+ {
+ break;
+ }
+ num++;
+ dataIn = smbiosNextPtr(dataIn);
+ if (dataIn == nullptr)
+ {
+ break;
+ }
+ if (num >= limitEntryLen)
+ {
+ break;
+ }
+ }
+
+ return num;
+}
+
bool MDR_V2::agentSynchronizeData()
{
struct MDRSMBIOSHeader mdr2SMBIOS;
diff --git a/services/smbios-mdrv2/src/smbios-mdrv2-main.cpp b/services/smbios-mdrv2/src/smbios_mdrv2_main.cpp
index bb26ff6..bb26ff6 100644
--- a/services/smbios-mdrv2/src/smbios-mdrv2-main.cpp
+++ b/services/smbios-mdrv2/src/smbios_mdrv2_main.cpp
diff --git a/services/smbios-mdrv2/src/system.cpp b/services/smbios-mdrv2/src/system.cpp
new file mode 100644
index 0000000..de7517c
--- /dev/null
+++ b/services/smbios-mdrv2/src/system.cpp
@@ -0,0 +1,78 @@
+/*
+// Copyright (c) 2018 Intel Corporation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+*/
+
+#include "system.hpp"
+
+#include "mdrv2.hpp"
+
+namespace phosphor
+{
+namespace smbios
+{
+
+static std::string getNode(uint8_t *node, size_t len)
+{
+ std::string result;
+ for (int index = 0; index < len; index++)
+ {
+ result += std::to_string(node[index]);
+ }
+
+ return result;
+}
+
+std::string System::uUID(std::string value)
+{
+ std::string result = "No UUID";
+ uint8_t *dataIn = storage;
+ dataIn = getSMBIOSTypePtr(dataIn, systemType);
+ if (dataIn != nullptr)
+ {
+ auto systemInfo = reinterpret_cast<struct SystemInfo *>(dataIn);
+ struct UUID uUID = systemInfo->uUID;
+ std::string tempS = std::to_string(uUID.timeLow) + "-" +
+ std::to_string(uUID.timeMid) + "-" +
+ std::to_string(uUID.timeHiAndVer) + "-";
+ tempS += std::to_string(uUID.clockSeqHi) +
+ std::to_string(uUID.clockSeqLow) + "-";
+ tempS += getNode(uUID.node, sizeof(uUID.node) / sizeof(uUID.node[0]));
+
+ result = tempS;
+ }
+
+ return sdbusplus::xyz::openbmc_project::Common::server::UUID::uUID(result);
+}
+
+std::string System::version(std::string value)
+{
+ std::string result = "No BIOS Version";
+ uint8_t *dataIn = storage;
+ dataIn = getSMBIOSTypePtr(dataIn, biosType);
+ if (dataIn != nullptr)
+ {
+ auto biosInfo = reinterpret_cast<struct BIOSInfo *>(dataIn);
+ uint8_t biosVerByte = biosInfo->biosVersion;
+ std::string tempS =
+ positionToString(biosInfo->biosVersion, biosInfo->length, dataIn);
+ result = tempS;
+ }
+
+ return sdbusplus::xyz::openbmc_project::Inventory::Decorator::server::
+ Revision::version(result);
+}
+
+} // namespace smbios
+} // namespace phosphor