Enable FRU support in libpldmresponder/base.cpp
pldmtool base GetPLDMtypes
Encode request successfully
Request Message:
08 01 80 00 04
Success in creating the socket : RC = 3
Success in connecting to socket : RC = 0
Success in sending message type as pldm to mctp : RC = 0
Received Msg
Buffer Data: 08 01 80 00 04
Sending Msg
Buffer Data: 00 00 04 00 1d 00 00 00 00 00 00 00
Received Msg
Buffer Data: 08 01 00 00 04 00 1d 00 00 00 00 00 00 00
Write to socket successful : RC = 5
Total length:5
Loopback response message:
08 01 80 00 04
On first recv(),response == request : RC = 0
Total length: 14
Shutdown Socket successful : RC = 0
Response Message:
08 01 00 00 04 00 1d 00 00 00 00 00 00 00
Supported types: 0(base) 2(platform) 3(bios) 4(fru)
pldmtool raw -d 0x80 0x00 0x05 0x04 0xF1 0XF0 0XF0 0X00
Encode request successfully
Request Message:
08 01 80 00 05 04 f1 f0 f0 00
Success in creating the socket : RC = 3
Success in connecting to socket : RC = 0
Success in sending message type as pldm to mctp : RC = 0
Received Msg
Buffer Data: 08 01 80 00 05 04 f1 f0 f0 00
Sending Msg
Buffer Data: 00 00 05 00 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Received Msg
Buffer Data: 08 01 00 00 05 00 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Write to socket successful : RC = 10
Total length:10
Loopback response message:
08 01 80 00 05 04 f1 f0 f0 00
On first recv(),response == request : RC = 0
Total length: 38
Shutdown Socket successful : RC = 0
Response Message:
08 01 00 00 05 00 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Signed-off-by: Sridevi Ramesh <sridevra@in.ibm.com>
Change-Id: I969a6f283cedc4029c756ba4c685955dd1c619d3
diff --git a/libpldmresponder/base.cpp b/libpldmresponder/base.cpp
index 0dfb420..8a932a8 100644
--- a/libpldmresponder/base.cpp
+++ b/libpldmresponder/base.cpp
@@ -9,6 +9,7 @@
#include <vector>
#include "libpldm/bios.h"
+#include "libpldm/fru.h"
#include "libpldm/platform.h"
namespace pldm
@@ -25,10 +26,11 @@
{PLDM_BASE,
{PLDM_GET_TID, PLDM_GET_PLDM_VERSION, PLDM_GET_PLDM_TYPES,
PLDM_GET_PLDM_COMMANDS}},
- {PLDM_PLATFORM, {PLDM_SET_STATE_EFFECTER_STATES}},
+ {PLDM_PLATFORM, {PLDM_GET_PDR, PLDM_SET_STATE_EFFECTER_STATES}},
{PLDM_BIOS,
- {PLDM_GET_DATE_TIME, PLDM_GET_BIOS_TABLE,
+ {PLDM_GET_DATE_TIME, PLDM_SET_DATE_TIME, PLDM_GET_BIOS_TABLE,
PLDM_GET_BIOS_ATTRIBUTE_CURRENT_VALUE_BY_HANDLE}},
+ {PLDM_FRU, {PLDM_GET_FRU_RECORD_TABLE_METADATA, PLDM_GET_FRU_RECORD_TABLE}},
};
static const std::map<Type, ver32_t> versions{
diff --git a/test/libpldmresponder_base_test.cpp b/test/libpldmresponder_base_test.cpp
index 885ef24..3baefdb 100644
--- a/test/libpldmresponder_base_test.cpp
+++ b/test/libpldmresponder_base_test.cpp
@@ -18,18 +18,17 @@
size_t requestPayloadLength = 0;
base::Handler handler;
auto response = handler.getPLDMTypes(request, requestPayloadLength);
- // Only base type supported at the moment
+ // Need to support OEM type.
auto responsePtr = reinterpret_cast<pldm_msg*>(response.data());
uint8_t* payload_ptr = responsePtr->payload;
ASSERT_EQ(payload_ptr[0], 0);
- ASSERT_EQ(payload_ptr[1], 13);
+ ASSERT_EQ(payload_ptr[1], 29); // 0b11101 see DSP0240 table11
ASSERT_EQ(payload_ptr[2], 0);
}
TEST(GetPLDMCommands, testGoodRequest)
{
- // Only base type supported at the moment, and commands -
- // GetPLDMTypes, GetPLDMCommands
+ // Need to support OEM type commands.
std::array<uint8_t, sizeof(pldm_msg_hdr) + PLDM_GET_COMMANDS_REQ_BYTES>
requestPayload{};
auto request = reinterpret_cast<pldm_msg*>(requestPayload.data());