platform-mc: Set the local terminus as event receiver
Send `SetEventReceiver` to the discoveried terminus with the
configurable local EID to set the local terminus as event receiver.
Before send `SetEventReceiver` the local terminus also send
`EventMessageSupported` to get the `synchronyConfigurationSupported`.
The `eventMessageGlobalEnable` and `heartbeatTimer` options in the
`SetEventReceiver` command will depend on the responded
`synchronyConfigurationSupported`.
Signed-off-by: Thu Nguyen <thu@os.amperecomputing.com>
Signed-off-by: Gilbert Chen <gilbertc@nvidia.com>
Change-Id: Ia798c1cd5d946ac519933bca60620e970fe10b0a
diff --git a/platform-mc/platform_manager.hpp b/platform-mc/platform_manager.hpp
index 8d6e7b4..641f16a 100644
--- a/platform-mc/platform_manager.hpp
+++ b/platform-mc/platform_manager.hpp
@@ -40,6 +40,13 @@
*/
exec::task<int> initTerminus();
+ /** @brief Helper to get the supported event messages and set event receiver
+ *
+ * @param[in] tid - Destination TID
+ * @return coroutine return_value - PLDM completion code
+ */
+ exec::task<int> configEventReceiver(pldm_tid_t tid);
+
private:
/** @brief Fetch all PDRs from terminus.
*
@@ -86,6 +93,41 @@
const pldm_tid_t tid, uint8_t& repositoryState, uint32_t& recordCount,
uint32_t& repositorySize, uint32_t& largestRecordSize);
+ /** @brief Send setEventReceiver command to destination EID.
+ *
+ * @param[in] tid - Destination TID
+ * @param[in] eventMessageGlobalEnable - Enable/disable event message
+ * generation from the terminus
+ * @param[in] eventReceiverEid - The EID of eventReceiver that terminus
+ * should send event message to
+ * @param[in] protocolType - Provided in the request to help the responder
+ * verify that the content of the eventReceiverAddressInfo field
+ * @param[in] heartbeatTimer - Amount of time in seconds after each
+ * elapsing of which the terminus shall emit a heartbeat event.
+ * @return coroutine return_value - PLDM completion code
+ */
+ exec::task<int> setEventReceiver(
+ pldm_tid_t tid,
+ pldm_event_message_global_enable eventMessageGlobalEnable,
+ pldm_transport_protocol_type protocolType, uint16_t heartbeatTimer);
+
+ /** @brief send eventMessageSupported
+ * @param[in] tid - Destination TID
+ * @param[in] formatVersion - version of the event format
+ * @param[out] synchronyConfiguration - messaging style most recently
+ * configured via the setEventReceiver command
+ * @param[out] synchronyConfigurationSupported - event messaging styles
+ * supported by the terminus
+ * @param[out] numerEventClassReturned - number of eventClass enumerated
+ * bytes
+ * @param[out] eventClass - vector of eventClass the device can generate
+ * @return coroutine return_value - PLDM completion code
+ */
+ exec::task<int> eventMessageSupported(
+ pldm_tid_t tid, uint8_t formatVersion, uint8_t& synchronyConfiguration,
+ bitfield8_t& synchronyConfigurationSupported,
+ uint8_t& numerEventClassReturned, std::vector<uint8_t>& eventClass);
+
/** reference of TerminusManager for sending PLDM request to terminus*/
TerminusManager& terminusManager;