responder: Add PollForPlatformEventMessage APIs
Added APIs to encode/decode PollForPlatformEventMessage command(0x0B)
which is defined in DSP0248 Version 1.2.2 sec:16.7.
Signed-off-by: Dung Cao <dung@os.amperecomputing.com>
Signed-off-by: Thu Nguyen <thu@os.amperecomputing.com>
Change-Id: Ic4a91625c9e30b49a9a3ea99755dffff2c667ca8
diff --git a/include/libpldm/platform.h b/include/libpldm/platform.h
index 514dbe9..9149da2 100644
--- a/include/libpldm/platform.h
+++ b/include/libpldm/platform.h
@@ -37,6 +37,8 @@
#define PLDM_POLL_FOR_PLATFORM_EVENT_MESSAGE_REQ_BYTES 8
#define PLDM_POLL_FOR_PLATFORM_EVENT_MESSAGE_MIN_RESP_BYTES 4
+#define PLDM_POLL_FOR_PLATFORM_EVENT_MESSAGE_RESP_BYTES 14
+#define PLDM_POLL_FOR_PLATFORM_EVENT_MESSAGE_CHECKSUM_BYTES 4
/* Minimum response length */
#define PLDM_GET_PDR_MIN_RESP_BYTES 12
@@ -1600,6 +1602,21 @@
uint8_t *event_class,
size_t *event_data_offset);
+/** @brief Decode PollForEventMessage request data
+ * @param[in] msg - Request message
+ * @param[in] payload_length - Length of response message payload
+ * @param[out] format_version - Version of the event format
+ * @param[out] transfer_operation_flag - The transfer operation flag
+ * @param[out] data_transfer_handle - The data transfer handle
+ * @param[out] event_id_to_acknowledge - The class of event being sent
+ * from pldm msg
+ * @return pldm_completion_codes
+ */
+int decode_poll_for_platform_event_message_req(
+ const struct pldm_msg *msg, size_t payload_length, uint8_t *format_version,
+ uint8_t *transfer_operation_flag, uint32_t *data_transfer_handle,
+ uint16_t *event_id_to_acknowledge);
+
/** @brief Encode PlatformEventMessage response data
* @param[in] instance_id - Message's instance id
* @param[in] completion_code - PLDM completion code
@@ -1615,6 +1632,30 @@
uint8_t platform_event_status,
struct pldm_msg *msg);
+/** @brief Encode PollForPlatformEventMessage response data
+ * @param[in] instance_id - Message's instance id
+ * @param[in] completion_code - PLDM completion code
+ * @param[in] tid - Terminus ID
+ * @param[in] event_id - The event id
+ * @param[in] next_data_transfer_handle - The next data transfer handle
+ * @param[in] transfer_flag - The transfer flag
+ * @param[in] event_class - The event class
+ * @param[in] event_data_size - The event data size
+ * @param[in] event_data - The event data
+ * @param[in] checksum - The checksum
+ * @param[out] msg - Message will be written to this
+ * @param[in] payload_length - Length of Response message payload
+ * @return pldm_completion_codes
+ * @note Caller is responsible for memory alloc and dealloc of param
+ * 'msg.payload'
+ */
+int encode_poll_for_platform_event_message_resp(
+ uint8_t instance_id, uint8_t completion_code, uint8_t tid,
+ uint16_t event_id, uint32_t next_data_transfer_handle,
+ uint8_t transfer_flag, uint8_t event_class, uint32_t event_data_size,
+ uint8_t *event_data, uint32_t checksum, struct pldm_msg *msg,
+ size_t payload_length);
+
/** @brief Encode PlatformEventMessage request data
* @param[in] instance_id - Message's instance id
* @param[in] format_version - Version of the event format