blob: bd65dd2b0c878b152065964538dc5a11bd3e9d65 [file] [log] [blame]
Sampa Misraaea5dde2020-08-31 08:33:47 -05001#pragma once
2
3#include "common/types.hpp"
4#include "common/utils.hpp"
Sagar Srinivas11ce8d22022-07-28 11:32:34 -05005#include "libpldmresponder/pdr_utils.hpp"
Sampa Misraaea5dde2020-08-31 08:33:47 -05006#include "pldmd/handler.hpp"
7
8namespace pldm
9{
Sampa Misraaea5dde2020-08-31 08:33:47 -050010namespace responder
11{
Sampa Misraaea5dde2020-08-31 08:33:47 -050012namespace oem_platform
13{
Sampa Misraaea5dde2020-08-31 08:33:47 -050014class Handler : public CmdHandler
15{
16 public:
Patrick Williams6da4f912023-05-10 07:50:53 -050017 Handler(const pldm::utils::DBusHandler* dBusIntf) : dBusIntf(dBusIntf) {}
Sampa Misraaea5dde2020-08-31 08:33:47 -050018
19 /** @brief Interface to get the state sensor readings requested by pldm
20 * requester for OEM types. Each specific type should implement a handler
21 * of it's own
22 *
23 * @param[in] entityType - entity type corresponding to the sensor
24 * @param[in] entityInstance - entity instance number
25 * @param[in] stateSetId - state set id
26 * @param[in] compSensorCnt - composite sensor count
27 * @param[out] stateField - The state field data for each of the states,
28 * equal to composite sensor count in number
29 *
30 * @return - Success or failure in getting the states. Returns failure in
Manojkiran Eda2576aec2024-06-17 12:05:17 +053031 * terms of PLDM completion codes if fetching at least one state
Sampa Misraaea5dde2020-08-31 08:33:47 -050032 * fails
33 */
34 virtual int getOemStateSensorReadingsHandler(
Sagar Srinivasd21b57d2023-02-09 22:11:55 -060035 pldm::pdr::EntityType entityType,
36 pldm::pdr::EntityInstance entityInstance,
Brad Bishop5079ac42021-08-19 18:35:06 -040037 pldm::pdr::StateSetId stateSetId,
38 pldm::pdr::CompositeCount compSensorCnt,
Sampa Misraaea5dde2020-08-31 08:33:47 -050039 std::vector<get_sensor_state_field>& stateField) = 0;
40
41 /** @brief Interface to set the effecter requested by pldm requester
42 * for OEM types. Each individual oem type should implement
43 * it's own handler.
44 *
45 * @param[in] entityType - entity type corresponding to the effecter id
46 * @param[in] entityInstance - entity instance
47 * @param[in] stateSetId - state set id
48 * @param[in] compEffecterCnt - composite effecter count
Varsha Kaverappa3fbd39e2020-09-28 01:40:22 -050049 * @param[in] stateField - The state field data for each of the states,
Sampa Misraaea5dde2020-08-31 08:33:47 -050050 * equal to compEffecterCnt in number
Varsha Kaverappa3fbd39e2020-09-28 01:40:22 -050051 * @param[in] effecterId - Effecter id
Sampa Misraaea5dde2020-08-31 08:33:47 -050052 *
53 * @return - Success or failure in setting the states.Returns failure in
Manojkiran Eda2576aec2024-06-17 12:05:17 +053054 * terms of PLDM completion codes if at least one state fails to
Sampa Misraaea5dde2020-08-31 08:33:47 -050055 * be set
56 */
Sampa Misra3a0e3b92020-10-21 05:58:00 -050057 virtual int oemSetStateEffecterStatesHandler(
Varsha Kaverappa3fbd39e2020-09-28 01:40:22 -050058 uint16_t entityType, uint16_t entityInstance, uint16_t stateSetId,
59 uint8_t compEffecterCnt,
60 std::vector<set_effecter_state_field>& stateField,
61 uint16_t effecterId) = 0;
Sampa Misraaea5dde2020-08-31 08:33:47 -050062
Sagar Srinivas78a225a2020-08-27 00:52:20 -050063 /** @brief Interface to generate the OEM PDRs
64 *
65 * @param[in] repo - instance of concrete implementation of Repo
66 */
Sagar Srinivasd21b57d2023-02-09 22:11:55 -060067 virtual void buildOEMPDR(pldm::responder::pdr_utils::Repo& repo) = 0;
Sagar Srinivas78a225a2020-08-27 00:52:20 -050068
Sagar Srinivas7f760b32021-05-12 07:46:56 -050069 /** @brief Interface to check if setEventReceiver is sent to host already.
70 * If sent then then disableWatchDogTimer() would be called to
71 * disable the watchdog timer */
72 virtual void checkAndDisableWatchDog() = 0;
73
Sagar Srinivas79669c92021-04-28 15:43:30 -050074 /** @brief Interface to check if the watchdog timer is running
75 *
76 * @return - true if watchdog is running, false otherwise
77 * */
78 virtual bool watchDogRunning() = 0;
79
80 /** @brief Interface to reset the watchdog timer */
81 virtual void resetWatchDogTimer() = 0;
82
Sagar Srinivas7f760b32021-05-12 07:46:56 -050083 /** @brief Interface to disable the watchdog timer */
84 virtual void disableWatchDogTimer() = 0;
85
86 /** @brief Interface to keep track of how many times setEventReceiver
87 * is sent to host */
88 virtual void countSetEventReceiver() = 0;
89
Pavithra Barithaya99854a72021-09-29 06:58:11 -050090 /** @brief Interface to check the BMC state */
91 virtual int checkBMCState() = 0;
92
Kamalkumar Patel15ce5a12024-05-07 11:45:11 -050093 /** @brief update the dbus object paths */
94 virtual void updateOemDbusPaths(std::string& dbusPath) = 0;
95
Sagar Srinivas3687e2b2023-04-10 05:08:28 -050096 /** @brief Interface to fetch the last BMC record from the PDR repository
97 *
98 * @param[in] repo - pointer to BMC's primary PDR repo
99 *
100 * @return the last BMC record from the repo
101 */
102 virtual const pldm_pdr_record* fetchLastBMCRecord(const pldm_pdr* repo) = 0;
103
104 /** @brief Interface to check if the record handle passed is in remote PDR
105 * record handle range
106 *
107 * @param[in] record_handle - record handle of the PDR
108 *
109 * @return true if record handle passed is in host PDR record handle range
110 */
111 virtual bool checkRecordHandleInRange(const uint32_t& record_handle) = 0;
112
Sagar Srinivas90314a32023-10-17 10:38:03 -0500113 /** @brief Interface to the process setEventReceiver*/
114 virtual void processSetEventReceiver() = 0;
115
Sagar Srinivas18145f72022-04-11 07:38:26 -0500116 /** @brief Interface to monitor the surveillance pings from remote terminus
117 *
118 * @param[in] tid - TID of the remote terminus
119 * @param[in] value - true or false, to indicate if the timer is
120 * running or not
121 * */
122 virtual void setSurvTimer(uint8_t tid, bool value) = 0;
123
Sampa Misraaea5dde2020-08-31 08:33:47 -0500124 virtual ~Handler() = default;
125
126 protected:
127 const pldm::utils::DBusHandler* dBusIntf;
128};
129
130} // namespace oem_platform
131
Pavithra Barithayaa410c652021-07-22 01:32:47 -0500132namespace oem_fru
133{
134
135class Handler : public CmdHandler
136{
137 public:
138 Handler() {}
139
140 /** @brief Process OEM FRU record
141 *
142 * @param[in] fruData - the data of the fru
143 *
144 * @return success or failure
145 */
146 virtual int processOEMFRUTable(const std::vector<uint8_t>& fruData) = 0;
147
148 virtual ~Handler() = default;
149};
150
151} // namespace oem_fru
152
Kamalkumar Pateleb43d6c2024-05-01 06:11:31 -0500153namespace oem_utils
154{
155using namespace pldm::utils;
156
157class Handler : public CmdHandler
158{
159 public:
160 Handler(const pldm::utils::DBusHandler* dBusIntf) : dBusIntf(dBusIntf) {}
161
162 /** @brief Collecting core count data and setting to Dbus properties
163 *
164 * @param[in] associations - the data of entity association
165 * @param[in] entityMaps - the mapping of entity to DBus string
166 *
167 */
168 virtual int setCoreCount(const EntityAssociations& associations,
169 const EntityMaps entityMaps) = 0;
170
171 virtual ~Handler() = default;
172
173 protected:
174 const pldm::utils::DBusHandler* dBusIntf;
175};
176
177} // namespace oem_utils
178
Sampa Misraaea5dde2020-08-31 08:33:47 -0500179} // namespace responder
180
181} // namespace pldm