Sampa Misra | aea5dde | 2020-08-31 08:33:47 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include "common/types.hpp" |
| 4 | #include "common/utils.hpp" |
Sagar Srinivas | 11ce8d2 | 2022-07-28 11:32:34 -0500 | [diff] [blame] | 5 | #include "libpldmresponder/pdr_utils.hpp" |
Sampa Misra | aea5dde | 2020-08-31 08:33:47 -0500 | [diff] [blame] | 6 | #include "pldmd/handler.hpp" |
| 7 | |
| 8 | namespace pldm |
| 9 | { |
Sampa Misra | aea5dde | 2020-08-31 08:33:47 -0500 | [diff] [blame] | 10 | namespace responder |
| 11 | { |
Sampa Misra | aea5dde | 2020-08-31 08:33:47 -0500 | [diff] [blame] | 12 | namespace oem_platform |
| 13 | { |
Sampa Misra | aea5dde | 2020-08-31 08:33:47 -0500 | [diff] [blame] | 14 | class Handler : public CmdHandler |
| 15 | { |
| 16 | public: |
Patrick Williams | 6da4f91 | 2023-05-10 07:50:53 -0500 | [diff] [blame] | 17 | Handler(const pldm::utils::DBusHandler* dBusIntf) : dBusIntf(dBusIntf) {} |
Sampa Misra | aea5dde | 2020-08-31 08:33:47 -0500 | [diff] [blame] | 18 | |
| 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 |
Manojkiran Eda | a31ceb9 | 2021-07-22 09:19:02 +0530 | [diff] [blame] | 25 | * @param[in] entityContainerID - container id |
Sampa Misra | aea5dde | 2020-08-31 08:33:47 -0500 | [diff] [blame] | 26 | * @param[in] stateSetId - state set id |
| 27 | * @param[in] compSensorCnt - composite sensor count |
Manojkiran Eda | a31ceb9 | 2021-07-22 09:19:02 +0530 | [diff] [blame] | 28 | * @param[in] sensorId - sensor ID |
Sampa Misra | aea5dde | 2020-08-31 08:33:47 -0500 | [diff] [blame] | 29 | * @param[out] stateField - The state field data for each of the states, |
| 30 | * equal to composite sensor count in number |
| 31 | * |
| 32 | * @return - Success or failure in getting the states. Returns failure in |
Manojkiran Eda | 2576aec | 2024-06-17 12:05:17 +0530 | [diff] [blame] | 33 | * terms of PLDM completion codes if fetching at least one state |
Sampa Misra | aea5dde | 2020-08-31 08:33:47 -0500 | [diff] [blame] | 34 | * fails |
| 35 | */ |
| 36 | virtual int getOemStateSensorReadingsHandler( |
Sagar Srinivas | d21b57d | 2023-02-09 22:11:55 -0600 | [diff] [blame] | 37 | pldm::pdr::EntityType entityType, |
| 38 | pldm::pdr::EntityInstance entityInstance, |
Manojkiran Eda | a31ceb9 | 2021-07-22 09:19:02 +0530 | [diff] [blame] | 39 | pldm::pdr::ContainerID entityContainerId, |
Brad Bishop | 5079ac4 | 2021-08-19 18:35:06 -0400 | [diff] [blame] | 40 | pldm::pdr::StateSetId stateSetId, |
Manojkiran Eda | a31ceb9 | 2021-07-22 09:19:02 +0530 | [diff] [blame] | 41 | pldm::pdr::CompositeCount compSensorCnt, uint16_t sensorId, |
Sampa Misra | aea5dde | 2020-08-31 08:33:47 -0500 | [diff] [blame] | 42 | std::vector<get_sensor_state_field>& stateField) = 0; |
| 43 | |
| 44 | /** @brief Interface to set the effecter requested by pldm requester |
| 45 | * for OEM types. Each individual oem type should implement |
| 46 | * it's own handler. |
| 47 | * |
| 48 | * @param[in] entityType - entity type corresponding to the effecter id |
| 49 | * @param[in] entityInstance - entity instance |
| 50 | * @param[in] stateSetId - state set id |
| 51 | * @param[in] compEffecterCnt - composite effecter count |
Varsha Kaverappa | 3fbd39e | 2020-09-28 01:40:22 -0500 | [diff] [blame] | 52 | * @param[in] stateField - The state field data for each of the states, |
Sampa Misra | aea5dde | 2020-08-31 08:33:47 -0500 | [diff] [blame] | 53 | * equal to compEffecterCnt in number |
Varsha Kaverappa | 3fbd39e | 2020-09-28 01:40:22 -0500 | [diff] [blame] | 54 | * @param[in] effecterId - Effecter id |
Sampa Misra | aea5dde | 2020-08-31 08:33:47 -0500 | [diff] [blame] | 55 | * |
| 56 | * @return - Success or failure in setting the states.Returns failure in |
Manojkiran Eda | 2576aec | 2024-06-17 12:05:17 +0530 | [diff] [blame] | 57 | * terms of PLDM completion codes if at least one state fails to |
Sampa Misra | aea5dde | 2020-08-31 08:33:47 -0500 | [diff] [blame] | 58 | * be set |
| 59 | */ |
Sampa Misra | 3a0e3b9 | 2020-10-21 05:58:00 -0500 | [diff] [blame] | 60 | virtual int oemSetStateEffecterStatesHandler( |
Varsha Kaverappa | 3fbd39e | 2020-09-28 01:40:22 -0500 | [diff] [blame] | 61 | uint16_t entityType, uint16_t entityInstance, uint16_t stateSetId, |
| 62 | uint8_t compEffecterCnt, |
| 63 | std::vector<set_effecter_state_field>& stateField, |
| 64 | uint16_t effecterId) = 0; |
Sampa Misra | aea5dde | 2020-08-31 08:33:47 -0500 | [diff] [blame] | 65 | |
Sagar Srinivas | 78a225a | 2020-08-27 00:52:20 -0500 | [diff] [blame] | 66 | /** @brief Interface to generate the OEM PDRs |
| 67 | * |
| 68 | * @param[in] repo - instance of concrete implementation of Repo |
| 69 | */ |
Sagar Srinivas | d21b57d | 2023-02-09 22:11:55 -0600 | [diff] [blame] | 70 | virtual void buildOEMPDR(pldm::responder::pdr_utils::Repo& repo) = 0; |
Sagar Srinivas | 78a225a | 2020-08-27 00:52:20 -0500 | [diff] [blame] | 71 | |
Sagar Srinivas | 7f760b3 | 2021-05-12 07:46:56 -0500 | [diff] [blame] | 72 | /** @brief Interface to check if setEventReceiver is sent to host already. |
| 73 | * If sent then then disableWatchDogTimer() would be called to |
| 74 | * disable the watchdog timer */ |
| 75 | virtual void checkAndDisableWatchDog() = 0; |
| 76 | |
Sagar Srinivas | 79669c9 | 2021-04-28 15:43:30 -0500 | [diff] [blame] | 77 | /** @brief Interface to check if the watchdog timer is running |
| 78 | * |
| 79 | * @return - true if watchdog is running, false otherwise |
| 80 | * */ |
| 81 | virtual bool watchDogRunning() = 0; |
| 82 | |
| 83 | /** @brief Interface to reset the watchdog timer */ |
| 84 | virtual void resetWatchDogTimer() = 0; |
| 85 | |
Sagar Srinivas | 7f760b3 | 2021-05-12 07:46:56 -0500 | [diff] [blame] | 86 | /** @brief Interface to disable the watchdog timer */ |
| 87 | virtual void disableWatchDogTimer() = 0; |
| 88 | |
| 89 | /** @brief Interface to keep track of how many times setEventReceiver |
| 90 | * is sent to host */ |
| 91 | virtual void countSetEventReceiver() = 0; |
| 92 | |
Pavithra Barithaya | 99854a7 | 2021-09-29 06:58:11 -0500 | [diff] [blame] | 93 | /** @brief Interface to check the BMC state */ |
| 94 | virtual int checkBMCState() = 0; |
| 95 | |
Kamalkumar Patel | 15ce5a1 | 2024-05-07 11:45:11 -0500 | [diff] [blame] | 96 | /** @brief update the dbus object paths */ |
| 97 | virtual void updateOemDbusPaths(std::string& dbusPath) = 0; |
| 98 | |
Sagar Srinivas | 3687e2b | 2023-04-10 05:08:28 -0500 | [diff] [blame] | 99 | /** @brief Interface to fetch the last BMC record from the PDR repository |
| 100 | * |
| 101 | * @param[in] repo - pointer to BMC's primary PDR repo |
| 102 | * |
| 103 | * @return the last BMC record from the repo |
| 104 | */ |
| 105 | virtual const pldm_pdr_record* fetchLastBMCRecord(const pldm_pdr* repo) = 0; |
| 106 | |
| 107 | /** @brief Interface to check if the record handle passed is in remote PDR |
| 108 | * record handle range |
| 109 | * |
| 110 | * @param[in] record_handle - record handle of the PDR |
| 111 | * |
| 112 | * @return true if record handle passed is in host PDR record handle range |
| 113 | */ |
| 114 | virtual bool checkRecordHandleInRange(const uint32_t& record_handle) = 0; |
| 115 | |
Sagar Srinivas | 90314a3 | 2023-10-17 10:38:03 -0500 | [diff] [blame] | 116 | /** @brief Interface to the process setEventReceiver*/ |
| 117 | virtual void processSetEventReceiver() = 0; |
| 118 | |
Sagar Srinivas | 18145f7 | 2022-04-11 07:38:26 -0500 | [diff] [blame] | 119 | /** @brief Interface to monitor the surveillance pings from remote terminus |
| 120 | * |
| 121 | * @param[in] tid - TID of the remote terminus |
| 122 | * @param[in] value - true or false, to indicate if the timer is |
| 123 | * running or not |
| 124 | * */ |
| 125 | virtual void setSurvTimer(uint8_t tid, bool value) = 0; |
| 126 | |
Sampa Misra | aea5dde | 2020-08-31 08:33:47 -0500 | [diff] [blame] | 127 | virtual ~Handler() = default; |
| 128 | |
| 129 | protected: |
| 130 | const pldm::utils::DBusHandler* dBusIntf; |
| 131 | }; |
| 132 | |
| 133 | } // namespace oem_platform |
| 134 | |
Pavithra Barithaya | a410c65 | 2021-07-22 01:32:47 -0500 | [diff] [blame] | 135 | namespace oem_fru |
| 136 | { |
| 137 | |
| 138 | class Handler : public CmdHandler |
| 139 | { |
| 140 | public: |
| 141 | Handler() {} |
| 142 | |
| 143 | /** @brief Process OEM FRU record |
| 144 | * |
| 145 | * @param[in] fruData - the data of the fru |
| 146 | * |
| 147 | * @return success or failure |
| 148 | */ |
| 149 | virtual int processOEMFRUTable(const std::vector<uint8_t>& fruData) = 0; |
| 150 | |
| 151 | virtual ~Handler() = default; |
| 152 | }; |
| 153 | |
| 154 | } // namespace oem_fru |
| 155 | |
Kamalkumar Patel | eb43d6c | 2024-05-01 06:11:31 -0500 | [diff] [blame] | 156 | namespace oem_utils |
| 157 | { |
| 158 | using namespace pldm::utils; |
| 159 | |
| 160 | class Handler : public CmdHandler |
| 161 | { |
| 162 | public: |
| 163 | Handler(const pldm::utils::DBusHandler* dBusIntf) : dBusIntf(dBusIntf) {} |
| 164 | |
| 165 | /** @brief Collecting core count data and setting to Dbus properties |
| 166 | * |
| 167 | * @param[in] associations - the data of entity association |
| 168 | * @param[in] entityMaps - the mapping of entity to DBus string |
| 169 | * |
| 170 | */ |
| 171 | virtual int setCoreCount(const EntityAssociations& associations, |
| 172 | const EntityMaps entityMaps) = 0; |
| 173 | |
| 174 | virtual ~Handler() = default; |
| 175 | |
| 176 | protected: |
| 177 | const pldm::utils::DBusHandler* dBusIntf; |
| 178 | }; |
| 179 | |
| 180 | } // namespace oem_utils |
| 181 | |
Sampa Misra | aea5dde | 2020-08-31 08:33:47 -0500 | [diff] [blame] | 182 | } // namespace responder |
| 183 | |
| 184 | } // namespace pldm |