Skip to content

Commit

Permalink
Utilize 'Bank Locator' memory device table field
Browse files Browse the repository at this point in the history
SMBIOS specification defines the following fields in the
'Memory Device (Type 17)' table:

'''
Device Locator
String number of the string that identifies the physically-labeled
socket or board position where the memory device is located.
EXAMPLE: "DIMM 0"

Bank Locator
String number of the string that identifies the physically labeled
bank where the memory device is located.
EXAMPLE: "Bank 0" or "A"
'''

Currently smbios-mdr uses only 'Device Locator' field for the
'Dimm::MemoryDeviceLocator' value.
Utilize both 'Bank Locator' and 'Device Locator' fields to construct
more complete locator value.

Tested:
Tested on the AMD EthanolX board. Example of the locator fields in
one of the Type 17 tables:
Bank Locator: "P0 CHANNEL A",
Device Locator: "DIMM 0".

Before the patch "MemoryDeviceLocator" property on the
"xyz.openbmc_project.Inventory.Item.Dimm" interface is equal to
the "DIMM 0".
After the patch it is equal to the "P0 CHANNEL A DIMM 0".

Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
Change-Id: I0e4913b8ac0639a9549c217ca9dfbfe34ea82c68
  • Loading branch information
Kostr committed Nov 2, 2022
1 parent 7393e48 commit 744b35a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
5 changes: 3 additions & 2 deletions include/dimm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,9 @@ class Dimm :

void dimmSize(const uint16_t size);
void dimmSizeExt(const size_t size);
void dimmDeviceLocator(const uint8_t positionNum, const uint8_t structLen,
uint8_t* dataIn);
void dimmDeviceLocator(const uint8_t bankLocatorPositionNum,
const uint8_t deviceLocatorPositionNum,
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,
Expand Down
23 changes: 19 additions & 4 deletions src/dimm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ void Dimm::memoryInfoUpdate(void)
dimmSize(memoryInfo->size);
}

dimmDeviceLocator(memoryInfo->deviceLocator, memoryInfo->length, dataIn);
dimmDeviceLocator(memoryInfo->bankLocator, memoryInfo->deviceLocator,
memoryInfo->length, dataIn);
dimmType(memoryInfo->memoryType);
dimmTypeDetail(memoryInfo->typeDetail);
maxMemorySpeedInMhz(memoryInfo->speed);
Expand Down Expand Up @@ -165,10 +166,24 @@ size_t Dimm::memorySizeInKB(size_t value)
memorySizeInKB(value);
}

void Dimm::dimmDeviceLocator(const uint8_t positionNum, const uint8_t structLen,
uint8_t* dataIn)
void Dimm::dimmDeviceLocator(const uint8_t bankLocatorPositionNum,
const uint8_t deviceLocatorPositionNum,
const uint8_t structLen, uint8_t* dataIn)
{
std::string result = positionToString(positionNum, structLen, dataIn);
std::string deviceLocator =
positionToString(deviceLocatorPositionNum, structLen, dataIn);
std::string bankLocator =
positionToString(bankLocatorPositionNum, structLen, dataIn);

std::string result;
if (!bankLocator.empty())
{
result = bankLocator + " " + deviceLocator;
}
else
{
result = deviceLocator;
}

memoryDeviceLocator(result);

Expand Down

0 comments on commit 744b35a

Please sign in to comment.