Fix memory extendedSize type
Modify "extendedSize" type to support 64-bit environment.
The size_t type uses 8 bytes in a 64-bit environment, the
properties "MemorySizeInKB" and "MemoryConfiguredSpeedInMhz"
will get wrong values from smbios file.
Tested:
```
root@qbmc:~# busctl introspect xyz.openbmc_project.Smbios.MDR_V2 \
> /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0 \
> xyz.openbmc_project.Inventory.Item.Dimm
.AllowedSpeedsMT property aq 0 emits-change writable
.CASLatencies property q 0 emits-change writable
.ECC property s "xyz.openbmc_project.Inventory.Item.D... emits-change writable
.FormFactor property s "xyz.openbmc_project.Inventory.Item.D... emits-change writable
.MaxMemorySpeedInMhz property q 4800 emits-change writable
.MemoryAttributes property y 2 emits-change writable
.MemoryConfiguredSpeedInMhz property q 1100 emits-change writable
.MemoryDataWidth property q 64 emits-change writable
.MemoryDeviceLocator property s "P0 CHANNEL A DIMM0" emits-change writable
.MemoryMedia property s "xyz.openbmc_project.Inventory.Item.D... emits-change writable
.MemorySizeInKB property t 3479875137107394560 emits-change writable
.MemoryTotalWidth property q 0 emits-change writable
...
```
After
```
root@qbmc:~# busctl introspect xyz.openbmc_project.Smbios.MDR_V2 \
> /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0 \
> xyz.openbmc_project.Inventory.Item.Dimm
NAME TYPE SIGNATURE RESULT/VALUE FLAGS
.AllowedSpeedsMT property aq 0 emits-change writable
.CASLatencies property q 0 emits-change writable
.ECC property s "xyz.openbmc_project.Inventory.Item.D... emits-change writable
.FormFactor property s "xyz.openbmc_project.Inventory.Item.D... emits-change writable
.MaxMemorySpeedInMhz property q 4800 emits-change writable
.MemoryAttributes property y 2 emits-change writable
.MemoryConfiguredSpeedInMhz property q 4800 emits-change writable
.MemoryDataWidth property q 64 emits-change writable
.MemoryDeviceLocator property s "P0 CHANNEL A DIMM0" emits-change writable
.MemoryMedia property s "xyz.openbmc_project.Inventory.Item.D... emits-change writable
.MemorySizeInKB property t 33554432 emits-change writable
.MemoryTotalWidth property q 0 emits-change writable
...
```
Change-Id: I205de7df72269e472143ea3a3fc2f6f9e4af56ee
Signed-off-by: Joseph Fu <joseph.fu@quantatw.com>
diff --git a/src/dimm.cpp b/src/dimm.cpp
index 8690969..6102627 100644
--- a/src/dimm.cpp
+++ b/src/dimm.cpp
@@ -156,7 +156,7 @@
static constexpr uint16_t dimmSizeUnit = 1024;
void Dimm::dimmSize(const uint16_t size)
{
- size_t result = size & maxOldDimmSize;
+ uint32_t result = size & maxOldDimmSize;
if (0 == (size & baseNewVersionDimmSize))
{
result = result * dimmSizeUnit;
@@ -164,7 +164,7 @@
memorySizeInKB(result);
}
-void Dimm::dimmSizeExt(size_t size)
+void Dimm::dimmSizeExt(uint32_t size)
{
size = size * dimmSizeUnit;
memorySizeInKB(size);