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 |
| 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 |
| 31 | * terms of PLDM completion codes if fetching atleast one state |
| 32 | * fails |
| 33 | */ |
| 34 | virtual int getOemStateSensorReadingsHandler( |
Sagar Srinivas | d21b57d | 2023-02-09 22:11:55 -0600 | [diff] [blame] | 35 | pldm::pdr::EntityType entityType, |
| 36 | pldm::pdr::EntityInstance entityInstance, |
Brad Bishop | 5079ac4 | 2021-08-19 18:35:06 -0400 | [diff] [blame] | 37 | pldm::pdr::StateSetId stateSetId, |
| 38 | pldm::pdr::CompositeCount compSensorCnt, |
Sampa Misra | aea5dde | 2020-08-31 08:33:47 -0500 | [diff] [blame] | 39 | 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 Kaverappa | 3fbd39e | 2020-09-28 01:40:22 -0500 | [diff] [blame] | 49 | * @param[in] stateField - The state field data for each of the states, |
Sampa Misra | aea5dde | 2020-08-31 08:33:47 -0500 | [diff] [blame] | 50 | * equal to compEffecterCnt in number |
Varsha Kaverappa | 3fbd39e | 2020-09-28 01:40:22 -0500 | [diff] [blame] | 51 | * @param[in] effecterId - Effecter id |
Sampa Misra | aea5dde | 2020-08-31 08:33:47 -0500 | [diff] [blame] | 52 | * |
| 53 | * @return - Success or failure in setting the states.Returns failure in |
| 54 | * terms of PLDM completion codes if atleast one state fails to |
| 55 | * be set |
| 56 | */ |
Sampa Misra | 3a0e3b9 | 2020-10-21 05:58:00 -0500 | [diff] [blame] | 57 | virtual int oemSetStateEffecterStatesHandler( |
Varsha Kaverappa | 3fbd39e | 2020-09-28 01:40:22 -0500 | [diff] [blame] | 58 | 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 Misra | aea5dde | 2020-08-31 08:33:47 -0500 | [diff] [blame] | 62 | |
Sagar Srinivas | 78a225a | 2020-08-27 00:52:20 -0500 | [diff] [blame] | 63 | /** @brief Interface to generate the OEM PDRs |
| 64 | * |
| 65 | * @param[in] repo - instance of concrete implementation of Repo |
| 66 | */ |
Sagar Srinivas | d21b57d | 2023-02-09 22:11:55 -0600 | [diff] [blame] | 67 | virtual void buildOEMPDR(pldm::responder::pdr_utils::Repo& repo) = 0; |
Sagar Srinivas | 78a225a | 2020-08-27 00:52:20 -0500 | [diff] [blame] | 68 | |
Sagar Srinivas | 7f760b3 | 2021-05-12 07:46:56 -0500 | [diff] [blame] | 69 | /** @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 Srinivas | 79669c9 | 2021-04-28 15:43:30 -0500 | [diff] [blame] | 74 | /** @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 Srinivas | 7f760b3 | 2021-05-12 07:46:56 -0500 | [diff] [blame] | 83 | /** @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 Barithaya | 99854a7 | 2021-09-29 06:58:11 -0500 | [diff] [blame] | 90 | /** @brief Interface to check the BMC state */ |
| 91 | virtual int checkBMCState() = 0; |
| 92 | |
Sagar Srinivas | 3687e2b | 2023-04-10 05:08:28 -0500 | [diff] [blame] | 93 | /** @brief Interface to fetch the last BMC record from the PDR repository |
| 94 | * |
| 95 | * @param[in] repo - pointer to BMC's primary PDR repo |
| 96 | * |
| 97 | * @return the last BMC record from the repo |
| 98 | */ |
| 99 | virtual const pldm_pdr_record* fetchLastBMCRecord(const pldm_pdr* repo) = 0; |
| 100 | |
| 101 | /** @brief Interface to check if the record handle passed is in remote PDR |
| 102 | * record handle range |
| 103 | * |
| 104 | * @param[in] record_handle - record handle of the PDR |
| 105 | * |
| 106 | * @return true if record handle passed is in host PDR record handle range |
| 107 | */ |
| 108 | virtual bool checkRecordHandleInRange(const uint32_t& record_handle) = 0; |
| 109 | |
Sampa Misra | aea5dde | 2020-08-31 08:33:47 -0500 | [diff] [blame] | 110 | virtual ~Handler() = default; |
| 111 | |
| 112 | protected: |
| 113 | const pldm::utils::DBusHandler* dBusIntf; |
| 114 | }; |
| 115 | |
| 116 | } // namespace oem_platform |
| 117 | |
Sagar Srinivas | 11ce8d2 | 2022-07-28 11:32:34 -0500 | [diff] [blame] | 118 | namespace oem_bios |
| 119 | { |
| 120 | /** Interface to the oem bios Handler class*/ |
| 121 | class Handler : public CmdHandler |
| 122 | { |
| 123 | public: |
| 124 | Handler(const pldm::utils::DBusHandler* dBusIntf) : dBusIntf(dBusIntf) {} |
| 125 | |
| 126 | /** @brief Interface to get the system type information |
| 127 | * |
| 128 | * @return - the system type information |
| 129 | */ |
| 130 | virtual std::optional<std::string> getPlatformName() = 0; |
| 131 | |
| 132 | virtual ~Handler() = default; |
| 133 | |
| 134 | protected: |
| 135 | const pldm::utils::DBusHandler* dBusIntf; |
| 136 | }; |
| 137 | |
| 138 | } // namespace oem_bios |
| 139 | |
Sampa Misra | aea5dde | 2020-08-31 08:33:47 -0500 | [diff] [blame] | 140 | } // namespace responder |
| 141 | |
| 142 | } // namespace pldm |