base: GetTID responder implementation
A pldm terminus is defined as the point of communication termination
for PLDM messages and the PLDM functions associated with those messages.
The Terminus ID(TID) is a value that identifies a PLDM terminus.
This commit assignes 1 to the BMC as the TID.
Signed-off-by: John Wang <wangzqbj@inspur.com>
Change-Id: I7adb0e1274f326fe6cf148771f230f530c9a567c
diff --git a/libpldmresponder/base.cpp b/libpldmresponder/base.cpp
index fc4ddf6..d0c3551 100644
--- a/libpldmresponder/base.cpp
+++ b/libpldmresponder/base.cpp
@@ -21,7 +21,8 @@
static const std::map<Type, Cmd> capabilities{
{PLDM_BASE,
- {PLDM_GET_PLDM_VERSION, PLDM_GET_PLDM_TYPES, PLDM_GET_PLDM_COMMANDS}},
+ {PLDM_GET_TID, PLDM_GET_PLDM_VERSION, PLDM_GET_PLDM_TYPES,
+ PLDM_GET_PLDM_COMMANDS}},
{PLDM_PLATFORM, {PLDM_SET_STATE_EFFECTER_STATES}},
{PLDM_BIOS, {PLDM_GET_DATE_TIME}}};
@@ -41,6 +42,7 @@
std::move(getPLDMCommands));
registerHandler(PLDM_BASE, PLDM_GET_PLDM_VERSION,
std::move(getPLDMVersion));
+ registerHandler(PLDM_BASE, PLDM_GET_TID, std::move(getTID));
}
} // namespace base
@@ -144,5 +146,18 @@
return response;
}
+Response getTID(const pldm_msg* request, size_t payloadLength)
+{
+ // assigned 1 to the bmc as the PLDM terminus
+ uint8_t tid = 1;
+
+ Response response(sizeof(pldm_msg_hdr) + PLDM_GET_TID_RESP_BYTES, 0);
+ auto responsePtr = reinterpret_cast<pldm_msg*>(response.data());
+ encode_get_tid_resp(request->hdr.instance_id, PLDM_SUCCESS, tid,
+ responsePtr);
+
+ return response;
+}
+
} // namespace responder
} // namespace pldm