From e1dbcef575309efeb04d275565a6e9649f3b89dd Mon Sep 17 00:00:00 2001 From: Cheng C Yang Date: Thu, 28 Nov 2019 23:37:31 +0800 Subject: Change mdrv2 to match upstream dimm properties According to the commit change e59bc11535c21ca8134bc390403dc085d015837e in phosphor-dbus-interface, update mdrv2 to match the new dimm properties. Tested: Redfish can show correct DIMM information. Change-Id: I0727a195a988cbeae7d5706ae080c739617302ee Signed-off-by: Cheng C Yang --- services/smbios-mdrv2/include/dimm.hpp | 33 ++++++++++++++++++++++----------- services/smbios-mdrv2/src/dimm.cpp | 22 ++++++++++++---------- 2 files changed, 34 insertions(+), 21 deletions(-) diff --git a/services/smbios-mdrv2/include/dimm.hpp b/services/smbios-mdrv2/include/dimm.hpp index 45a71d7..129db3f 100644 --- a/services/smbios-mdrv2/include/dimm.hpp +++ b/services/smbios-mdrv2/include/dimm.hpp @@ -26,6 +26,9 @@ namespace phosphor namespace smbios { +using DeviceType = + sdbusplus::xyz::openbmc_project::Inventory::Item::server::Dimm::DeviceType; + class Dimm : sdbusplus::server::object::object< sdbusplus::xyz::openbmc_project::Inventory::Item::server::Dimm>, @@ -59,14 +62,14 @@ class Dimm 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; + DeviceType memoryType(DeviceType value) override; std::string memoryTypeDetail(std::string value) override; - uint16_t memorySpeed(uint16_t value) override; + uint16_t maxMemorySpeedInMhz(uint16_t value) override; std::string manufacturer(std::string value) override; std::string serialNumber(std::string value) override; std::string partNumber(std::string value) override; uint8_t memoryAttributes(uint8_t value) override; - uint16_t memoryConfClockSpeed(uint16_t value) override; + uint16_t memoryConfiguredSpeedInMhz(uint16_t value) override; private: uint8_t dimmNum; @@ -113,14 +116,22 @@ class Dimm } __attribute__((packed)); }; -const std::map 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::map dimmTypeTable = { + {0x1, DeviceType::Other}, {0x2, DeviceType::Unknown}, + {0x3, DeviceType::DRAM}, {0x4, DeviceType::EDRAM}, + {0x5, DeviceType::VRAM}, {0x6, DeviceType::SRAM}, + {0x7, DeviceType::RAM}, {0x8, DeviceType::ROM}, + {0x9, DeviceType::FLASH}, {0xa, DeviceType::EEPROM}, + {0xb, DeviceType::FEPROM}, {0xc, DeviceType::EPROM}, + {0xd, DeviceType::CDRAM}, {0xe, DeviceType::ThreeDRAM}, + {0xf, DeviceType::SDRAM}, {0x10, DeviceType::DDR_SGRAM}, + {0x11, DeviceType::RDRAM}, {0x12, DeviceType::DDR}, + {0x13, DeviceType::DDR2}, {0x14, DeviceType::DDR2_SDRAM_FB_DIMM}, + {0x18, DeviceType::DDR3}, {0x19, DeviceType::FBD2}, + {0x1a, DeviceType::DDR4}, {0x1b, DeviceType::LPDDR_SDRAM}, + {0x1c, DeviceType::LPDDR2_SDRAM}, {0x1d, DeviceType::LPDDR3_SDRAM}, + {0x1e, DeviceType::LPDDR4_SDRAM}, {0x1f, DeviceType::Logical}, + {0x20, DeviceType::HBM}, {0x21, DeviceType::HBM2}}; const std::array detailTable{ "Reserved", "Other", "Unknown", "Fast-paged", diff --git a/services/smbios-mdrv2/src/dimm.cpp b/services/smbios-mdrv2/src/dimm.cpp index fdd7ca7..db4170a 100644 --- a/services/smbios-mdrv2/src/dimm.cpp +++ b/services/smbios-mdrv2/src/dimm.cpp @@ -23,6 +23,9 @@ namespace phosphor namespace smbios { +using DeviceType = + sdbusplus::xyz::openbmc_project::Inventory::Item::server::Dimm::DeviceType; + static constexpr uint16_t maxOldDimmSize = 0x7fff; void Dimm::memoryInfoUpdate(void) { @@ -64,12 +67,12 @@ void Dimm::memoryInfoUpdate(void) dimmDeviceLocator(memoryInfo->deviceLocator, memoryInfo->length, dataIn); dimmType(memoryInfo->memoryType); dimmTypeDetail(memoryInfo->typeDetail); - memorySpeed(memoryInfo->speed); + maxMemorySpeedInMhz(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); + memoryConfiguredSpeedInMhz(memoryInfo->confClockSpeed); return; } @@ -120,11 +123,10 @@ std::string Dimm::memoryDeviceLocator(std::string value) void Dimm::dimmType(const uint8_t type) { - std::map::const_iterator it = - dimmTypeTable.find(type); + std::map::const_iterator it = dimmTypeTable.find(type); if (it == dimmTypeTable.end()) { - memoryType("Unknown Memory Type"); + memoryType(DeviceType::Unknown); } else { @@ -132,7 +134,7 @@ void Dimm::dimmType(const uint8_t type) } } -std::string Dimm::memoryType(std::string value) +DeviceType Dimm::memoryType(DeviceType value) { return sdbusplus::xyz::openbmc_project::Inventory::Item::server::Dimm:: memoryType(value); @@ -158,10 +160,10 @@ std::string Dimm::memoryTypeDetail(std::string value) memoryTypeDetail(value); } -uint16_t Dimm::memorySpeed(uint16_t value) +uint16_t Dimm::maxMemorySpeedInMhz(uint16_t value) { return sdbusplus::xyz::openbmc_project::Inventory::Item::server::Dimm:: - memorySpeed(value); + maxMemorySpeedInMhz(value); } void Dimm::dimmManufacturer(const uint8_t positionNum, const uint8_t structLen, @@ -212,10 +214,10 @@ uint8_t Dimm::memoryAttributes(uint8_t value) memoryAttributes(value); } -uint16_t Dimm::memoryConfClockSpeed(uint16_t value) +uint16_t Dimm::memoryConfiguredSpeedInMhz(uint16_t value) { return sdbusplus::xyz::openbmc_project::Inventory::Item::server::Dimm:: - memoryConfClockSpeed(value); + memoryConfiguredSpeedInMhz(value); } } // namespace smbios -- cgit v1.2.3