Define pldm data types
This commit defines some data types as per PLDM DSP0240. Only types that
are used are defined.
Change-Id: Id932d638587b4b34c2941d6d0714cd0e1f1be264
Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
diff --git a/libpldmresponder/base.cpp b/libpldmresponder/base.cpp
index 9489d47..6ae8ba6 100644
--- a/libpldmresponder/base.cpp
+++ b/libpldmresponder/base.cpp
@@ -18,20 +18,20 @@
static const std::map<Type, Cmd> capabilities{
{PLDM_BASE, {PLDM_GET_PLDM_TYPES, PLDM_GET_PLDM_COMMANDS}}};
-static const std::map<Type, pldm_version> versions{
+static const std::map<Type, ver32_t> versions{
{PLDM_BASE, {0xF1, 0xF0, 0xF0, 0x00}},
};
void getPLDMTypes(const pldm_msg_payload* request, pldm_msg* response)
{
// DSP0240 has this as a bitfield8[N], where N = 0 to 7
- std::array<uint8_t, 8> types{};
+ std::array<bitfield8_t, 8> types{};
for (const auto& type : capabilities)
{
auto index = type.first / 8;
// <Type Number> = <Array Index> * 8 + <bit position>
auto bit = type.first - (index * 8);
- types[index] |= 1 << bit;
+ types[index].byte |= 1 << bit;
}
encode_get_types_resp(0, PLDM_SUCCESS, types.data(), response);
@@ -39,7 +39,7 @@
void getPLDMCommands(const pldm_msg_payload* request, pldm_msg* response)
{
- pldm_version version{};
+ ver32_t version{};
Type type;
if (request->payload_length != (sizeof(version) + sizeof(type)))
@@ -52,7 +52,7 @@
decode_get_commands_req(request, &type, &version);
// DSP0240 has this as a bitfield8[N], where N = 0 to 31
- std::array<uint8_t, 32> cmds{};
+ std::array<bitfield8_t, 32> cmds{};
if (capabilities.find(type) == capabilities.end())
{
encode_get_commands_resp(0, PLDM_ERROR_INVALID_PLDM_TYPE, nullptr,
@@ -65,7 +65,7 @@
auto index = cmd / 8;
// <Type Number> = <Array Index> * 8 + <bit position>
auto bit = cmd - (index * 8);
- cmds[index] |= 1 << bit;
+ cmds[index].byte |= 1 << bit;
}
encode_get_commands_resp(0, PLDM_SUCCESS, cmds.data(), response);
@@ -87,7 +87,7 @@
decode_get_version_req(request, &transferHandle, &transferFlag, &type);
- pldm_version version{};
+ ver32_t version{};
auto search = versions.find(type);
if (search == versions.end())