summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCheng C Yang <cheng.c.yang@intel.com>2019-11-28 18:44:01 +0300
committerYang, Cheng C <cheng.c.yang@intel.com>2019-12-05 03:49:12 +0300
commit8dfc93ce3b2672aca85af76235552dc7075c0349 (patch)
tree089797d059390363f6caa3ed0c403a577fa10cd1
parent4213b26002f644927efdae94e0f8627c80df59a4 (diff)
downloadprovingground-8dfc93ce3b2672aca85af76235552dc7075c0349.tar.xz
Change mdrv1 to match upstream dimm properties
According to the commit change e59bc11535c21ca8134bc390403dc085d015837 in phosphor-dbus-interface, update mdrv1 to match the new dimm properties. Tested: Redfish can show correct DIMM information. Change-Id: I93f68755d2b8d1f8b3cfbb0ffa037da41915b407 Signed-off-by: Cheng C Yang <cheng.c.yang@intel.com>
-rw-r--r--services/smbios/include/dimm.hpp33
-rw-r--r--services/smbios/src/dimm.cpp22
2 files changed, 34 insertions, 21 deletions
diff --git a/services/smbios/include/dimm.hpp b/services/smbios/include/dimm.hpp
index 5ca7a05..caac229 100644
--- a/services/smbios/include/dimm.hpp
+++ b/services/smbios/include/dimm.hpp
@@ -25,6 +25,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;
@@ -111,14 +114,22 @@ class Dimm
} __attribute__((packed));
};
-const std::map<uint8_t, std::string> 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<uint8_t, DeviceType> 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::string detailTable[16]{
"Reserved", "Other", "Unknown", "Fast-paged",
diff --git a/services/smbios/src/dimm.cpp b/services/smbios/src/dimm.cpp
index a3c3603..346c701 100644
--- a/services/smbios/src/dimm.cpp
+++ b/services/smbios/src/dimm.cpp
@@ -22,6 +22,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)
{
@@ -63,12 +66,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;
}
@@ -121,11 +124,10 @@ std::string Dimm::memoryDeviceLocator(std::string value)
void Dimm::dimmType(uint8_t type)
{
- std::map<uint8_t, std::string>::const_iterator it =
- dimmTypeTable.find(type);
+ std::map<uint8_t, DeviceType>::const_iterator it = dimmTypeTable.find(type);
if (it == dimmTypeTable.end())
{
- memoryType("Unknown Memory Type");
+ memoryType(DeviceType::Unknown);
}
else
{
@@ -133,7 +135,7 @@ void Dimm::dimmType(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);
@@ -159,10 +161,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(uint8_t positionNum, uint8_t structLen,
@@ -218,10 +220,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