pldmtool: Adding support for Device Power State
As per the spec DSP0249 the PLDM state set Device
Power State [Set ID: 257] can have four enumeration
values defined. This commit adds the unknown and
all the possible device power state in
state effecter and sensor PDRs.
Test: Collected PDRs and verified the states being
reflected.
Dependency: https://gerrit.openbmc.org/c/openbmc/pldm/+/68811/14
Change-Id: I4d7cb8761f76a0dc70b008924002a3036e4550f5
Signed-off-by: Riya Dixit <riyadixitagra@gmail.com>
diff --git a/pldmtool/pldm_platform_cmd.cpp b/pldmtool/pldm_platform_cmd.cpp
index 52cbe9f..46d0744 100644
--- a/pldmtool/pldm_platform_cmd.cpp
+++ b/pldmtool/pldm_platform_cmd.cpp
@@ -573,6 +573,15 @@
{PLDM_STATE_SET_OPERATIONAL_RUNNING_STATUS_ABORTED, "Aborted"},
{PLDM_STATE_SET_OPERATIONAL_RUNNING_STATUS_DORMANT, "Dormant"}};
+ static inline const std::map<uint8_t, std::string> setPowerDeviceState{
+ {PLDM_STATE_SET_ACPI_DEVICE_POWER_STATE_UNKNOWN, "Unknown"},
+ {PLDM_STATE_SET_ACPI_DEVICE_POWER_STATE_FULLY_ON, "Fully-On"},
+ {PLDM_STATE_SET_ACPI_DEVICE_POWER_STATE_INTERMEDIATE_1,
+ "Intermediate State-1"},
+ {PLDM_STATE_SET_ACPI_DEVICE_POWER_STATE_INTERMEDIATE_2,
+ "Intermediate State-2"},
+ {PLDM_STATE_SET_ACPI_DEVICE_POWER_STATE_OFF, "Off"}};
+
static inline const std::map<uint16_t, const std::map<uint8_t, std::string>>
populatePStateMaps{
{PLDM_STATE_SET_THERMAL_TRIP, setThermalTrip},
@@ -585,6 +594,7 @@
{PLDM_STATE_SET_HEALTH_STATE, setHealthState},
{PLDM_STATE_SET_OPERATIONAL_RUNNING_STATUS,
setOperationalRunningState},
+ {PLDM_STATE_SET_DEVICE_POWER_STATE, setPowerDeviceState},
};
const std::map<std::string, uint8_t> strToPdrType = {