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