blob: 2220adb604c6dafb6186422a2774513d54636dab [file] [log] [blame]
Sampa Misraaea5dde2020-08-31 08:33:47 -05001#pragma once
2
3#include "inband_code_update.hpp"
4#include "libpldmresponder/oem_handler.hpp"
5#include "libpldmresponder/platform.hpp"
6
7namespace pldm
8{
Sampa Misraaea5dde2020-08-31 08:33:47 -05009namespace responder
10{
Sampa Misraaea5dde2020-08-31 08:33:47 -050011namespace oem_ibm_platform
12{
13
14#define PLDM_OEM_IBM_FIRMWARE_UPDATE_STATE 32768
15#define PLDM_OEM_IBM_BOOT_STATE 32769
16
Sagar Srinivas78a225a2020-08-27 00:52:20 -050017static constexpr auto PLDM_OEM_IBM_ENTITY_FIRMWARE_UPDATE = 24577;
18constexpr uint16_t ENTITY_INSTANCE_0 = 0;
19constexpr uint16_t ENTITY_INSTANCE_1 = 1;
20
Sampa Misraaea5dde2020-08-31 08:33:47 -050021class Handler : public oem_platform::Handler
22{
23 public:
24 Handler(const pldm::utils::DBusHandler* dBusIntf,
25 pldm::responder::CodeUpdate* codeUpdate) :
26 oem_platform::Handler(dBusIntf),
27 codeUpdate(codeUpdate), platformHandler(nullptr)
28 {
29 codeUpdate->setVersions();
30 }
31
32 int getOemStateSensorReadingsHandler(
33 EntityType entityType, EntityInstance entityInstance,
34 StateSetId stateSetId, CompositeCount compSensorCnt,
35 std::vector<get_sensor_state_field>& stateField);
36
37 int oemSetStateEffecterStatesHandler(
38 EntityType entityType, EntityInstance entityInstance,
39 StateSetId stateSetId, CompositeCount compEffecterCnt,
40 const std::vector<set_effecter_state_field>& stateField);
41
42 /** @brief Method to set the platform handler in the
43 * oem_ibm_handler class
44 * @param[in] handler - pointer to PLDM platform handler
45 */
46 void setPlatformHandler(pldm::responder::platform::Handler* handler);
47
Sagar Srinivas78a225a2020-08-27 00:52:20 -050048 /** @brief Method to fetch the effecter ID of the code update PDRs
49 *
50 * @return platformHandler->getNextEffecterId() - returns the
51 * effecter ID from the platform handler
52 */
53 uint16_t getNextEffecterId()
54 {
55 return platformHandler->getNextEffecterId();
56 }
57
58 /** @brief Method to fetch the sensor ID of the code update PDRs
59 *
60 * @return platformHandler->getNextSensorId() - returns the
61 * Sensor ID from the platform handler
62 */
63 uint16_t getNextSensorId()
64 {
65 return platformHandler->getNextSensorId();
66 }
67
68 /** @brief Method to Generate the OEM PDRs
69 *
70 * @param[in] repo - instance of concrete implementation of Repo
71 */
72 void buildOEMPDR(pdr_utils::Repo& repo);
73
Sampa Misraaea5dde2020-08-31 08:33:47 -050074 ~Handler() = default;
75
76 pldm::responder::CodeUpdate* codeUpdate; //!< pointer to CodeUpdate object
77 pldm::responder::platform::Handler*
78 platformHandler; //!< pointer to PLDM platform handler
79};
80
81} // namespace oem_ibm_platform
82
83} // namespace responder
84
85} // namespace pldm