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