| #include "oem_ibm_handler.hpp" |
| |
| #include "libpldm/entity.h" |
| |
| namespace pldm |
| { |
| |
| namespace responder |
| { |
| |
| namespace oem_ibm_platform |
| { |
| |
| int pldm::responder::oem_ibm_platform::Handler:: |
| getOemStateSensorReadingsHandler( |
| EntityType entityType, EntityInstance entityInstance, |
| StateSetId stateSetId, CompositeCount compSensorCnt, |
| std::vector<get_sensor_state_field>& stateField) |
| { |
| int rc = PLDM_SUCCESS; |
| stateField.clear(); |
| |
| for (size_t i = 0; i < compSensorCnt; i++) |
| { |
| uint8_t sensorOpState{}; |
| if (entityType == PLDM_ENTITY_VIRTUAL_MACHINE_MANAGER && |
| stateSetId == PLDM_OEM_IBM_BOOT_STATE) |
| { |
| sensorOpState = fetchBootSide(entityInstance, codeUpdate); |
| } |
| else |
| { |
| rc = PLDM_PLATFORM_INVALID_STATE_VALUE; |
| break; |
| } |
| stateField.push_back({PLDM_SENSOR_ENABLED, PLDM_SENSOR_UNKNOWN, |
| PLDM_SENSOR_UNKNOWN, sensorOpState}); |
| } |
| return rc; |
| } |
| |
| int pldm::responder::oem_ibm_platform::Handler:: |
| oemSetStateEffecterStatesHandler( |
| EntityType entityType, EntityInstance entityInstance, |
| StateSetId stateSetId, CompositeCount compEffecterCnt, |
| const std::vector<set_effecter_state_field>& stateField) |
| { |
| int rc = PLDM_SUCCESS; |
| |
| for (uint8_t currState = 0; currState < compEffecterCnt; ++currState) |
| { |
| if (stateField[currState].set_request == PLDM_REQUEST_SET) |
| { |
| if (entityType == PLDM_ENTITY_VIRTUAL_MACHINE_MANAGER && |
| stateSetId == PLDM_OEM_IBM_BOOT_STATE) |
| { |
| rc = setBootSide(entityInstance, currState, stateField, |
| codeUpdate); |
| } |
| else |
| { |
| rc = PLDM_PLATFORM_SET_EFFECTER_UNSUPPORTED_SENSORSTATE; |
| } |
| } |
| if (rc != PLDM_SUCCESS) |
| { |
| break; |
| } |
| } |
| return rc; |
| } |
| |
| void pldm::responder::oem_ibm_platform::Handler::setPlatformHandler( |
| pldm::responder::platform::Handler* handler) |
| { |
| platformHandler = handler; |
| } |
| |
| } // namespace oem_ibm_platform |
| |
| } // namespace responder |
| |
| } // namespace pldm |