blob: 6f9468f957d94b84218517286bd90d99f2b52f4b [file] [log] [blame]
Eddie Jamescc5c22d2021-11-18 11:38:05 -06001#include "oem/ibm/libpldm/state_set_oem_ibm.h"
Pavithra Barithayaa2b964f2021-10-06 07:46:19 -05002
Sridevi Rameshdcdcd3b2021-06-15 04:06:49 -05003#include "oem/ibm/libpldmresponder/oem_ibm_handler.hpp"
4
Brad Bishop869b7762021-12-03 13:56:23 -05005#include <libpldm/entity.h>
6
Sridevi Rameshdcdcd3b2021-06-15 04:06:49 -05007/** @brief PLDM OEM State Set range as per DSP0249_1.1.0 specification
8 */
9enum pldm_oem_state_set_id_codes
10{
11 PLDM_OEM_STATE_SET_START = 32768,
12 PLDM_OEM_STATE_SET_END = 65535,
13
14};
15
16/** @brief PLDM OEM IBM Code Update possible state set values
17 */
18enum pldm_oem_ibm_cu_state_set_values
19{
20 OEM_IBM_STATE_SET_CU_START = 1,
21 OEM_IBM_STATE_SET_CU_END = 2,
22 OEM_IBM_STATE_SET_CU_FAIL = 3,
23 OEM_IBM_STATE_SET_CU_ABORT = 4,
24 OEM_IBM_STATE_SET_CU_ACCEPT = 5,
25 OEM_IBM_STATE_SET_CU_REJECT = 6,
26};
27
28/** @brief PLDM OEM IBM Verification possible state set values
29 */
30enum pldm_oem_ibm_verification_state_set_values
31{
32 OEM_IBM_STATE_SET_VERFICATION_VALID = 0,
33 OEM_IBM_STATE_SET_VERFICATION_ENTITLEMENT_FAIL = 1,
34 OEM_IBM_STATE_SET_VERFICATION_BANNED_PLATFORM_FAIL = 2,
35 OEM_IBM_STATE_SET_VERFICATION_MIN_MIF_FAIL = 4,
36};
37
38/** @brief PLDM OEM IBM system power state possible state set values
39 */
40enum pldm_oem_ibm_sys_power_state_set_values
41{
42 OEM_IBM_STATE_SET_SYS_PWR_STATE_RECYCLE_HARD = 1,
43};
44
45/** @brief PLDM OEM IBM boot state possible state set values
46 */
47enum pldm_oem_ibm_boot_state_set_values
48{
49 OEM_IBM_STATE_SET_BOOT_STATE_P_SIDE = 1,
50 OEM_IBM_STATE_SET_BOOT_STATE_T_SIDE = 2,
51};
52
53/** @brief Map for PLDM OEM IBM Entity Types
54 */
55extern const std::map<uint8_t, std::string> OemIBMEntityType{
Brad Bishop5079ac42021-08-19 18:35:06 -040056 {pldm::responder::oem_ibm_platform::PLDM_OEM_IBM_ENTITY_FIRMWARE_UPDATE,
57 "OEM IBM Firmware Update"},
Sridevi Rameshdcdcd3b2021-06-15 04:06:49 -050058 {PLDM_OEM_ENTITY_TYPE_START, "OEM IBM Entity Type Start"},
59 {PLDM_OEM_ENTITY_TYPE_END, "OEM IBM Entity Type End"},
60};
61
62/** @brief Map for PLDM OEM IBM State Sets
63 */
64extern const std::map<uint16_t, std::string> OemIBMstateSet{
65 {PLDM_OEM_IBM_FIRMWARE_UPDATE_STATE, "OEM IBM Firmware Update State"},
66 {PLDM_OEM_IBM_BOOT_STATE, "OEM IBM Boot State"},
Pavithra Barithayaa2b964f2021-10-06 07:46:19 -050067 {PLDM_OEM_IBM_VERIFICATION_STATE, "OEM IBM Verification State"},
Sridevi Rameshdcdcd3b2021-06-15 04:06:49 -050068 {PLDM_OEM_IBM_SYSTEM_POWER_STATE, "OEM IBM System Power State"}};
69
70/** @brief Map for PLDM OEM IBM firmware update possible state values
71 */
72extern const std::map<uint8_t, std::string> SetOemIBMFWUpdateStateValues{
73 {OEM_IBM_STATE_SET_CU_START, "Start"},
74 {OEM_IBM_STATE_SET_CU_END, "End"},
75 {OEM_IBM_STATE_SET_CU_FAIL, "Fail"},
76 {OEM_IBM_STATE_SET_CU_ABORT, "Abort"},
77 {OEM_IBM_STATE_SET_CU_ACCEPT, "Accept"},
78 {OEM_IBM_STATE_SET_CU_REJECT, "Reject"}};
79
80/** @brief Map for PLDM OEM IBM verification state possible state values
81 */
82extern const std::map<uint8_t, std::string> SetOemIBMVerStateValues{
83 {OEM_IBM_STATE_SET_VERFICATION_VALID, "Valid"},
84 {OEM_IBM_STATE_SET_VERFICATION_ENTITLEMENT_FAIL, "Entitlement Fail"},
85 {OEM_IBM_STATE_SET_VERFICATION_BANNED_PLATFORM_FAIL,
86 "Banned Platform Fail"},
87 {OEM_IBM_STATE_SET_VERFICATION_MIN_MIF_FAIL, "Minimum MIF Fail"}};
88
89/** @brief Map for PLDM OEM IBM systerm power state possible state values
90 */
91extern const std::map<uint8_t, std::string> SetOemIBMSysPowerStatesValues{
92 {OEM_IBM_STATE_SET_SYS_PWR_STATE_RECYCLE_HARD, "Power Cycle Hard"}};
93
94/** @brief Map for PLDM OEM IBM boot state possible state values
95 */
96extern const std::map<uint8_t, std::string> SetOemIBMBootStateValues{
97 {OEM_IBM_STATE_SET_BOOT_STATE_P_SIDE, "P Side"},
98 {OEM_IBM_STATE_SET_BOOT_STATE_T_SIDE, "T side"}};
99
100/** @brief Map for populating PLDM OEM IBM state sets with possible state values
101 */
102extern const std::map<uint16_t, const std::map<uint8_t, std::string>>
103 populateOemIBMStateMaps{
Pavithra Barithayaa2b964f2021-10-06 07:46:19 -0500104 {PLDM_OEM_IBM_VERIFICATION_STATE, SetOemIBMVerStateValues},
Sridevi Rameshdcdcd3b2021-06-15 04:06:49 -0500105 {PLDM_OEM_IBM_SYSTEM_POWER_STATE, SetOemIBMSysPowerStatesValues},
106 {PLDM_OEM_IBM_BOOT_STATE, SetOemIBMBootStateValues},
107 {PLDM_OEM_IBM_FIRMWARE_UPDATE_STATE, SetOemIBMFWUpdateStateValues},
108 };