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