blob: 0c392a81383a1dd6c67f4cb9d32ffb2aa0803608 [file] [log] [blame]
Sampa Misra0db1dfa2019-03-19 00:15:31 -05001#ifndef PLATFORM_H
2#define PLATFORM_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <stddef.h>
9#include <stdint.h>
10
11#include "base.h"
Deepak Kodihalli5544ccd2020-03-15 23:36:16 -050012#include "pdr.h"
Sampa Misra0db1dfa2019-03-19 00:15:31 -050013
14/* Maximum size for request */
15#define PLDM_SET_STATE_EFFECTER_STATES_REQ_BYTES 19
Jolie Ku3557bad2020-03-02 16:22:57 +080016#define PLDM_GET_STATE_SENSOR_READINGS_REQ_BYTES 4
Jolie Ku6787f172020-03-19 11:15:53 +080017#define PLDM_GET_NUMERIC_EFFECTER_VALUE_REQ_BYTES 2
Jolie Kuf798c8f2020-04-14 11:18:06 +080018#define PLDM_GET_SENSOR_READING_REQ_BYTES 4
Sagar Srinivas535bccd2021-03-24 12:18:26 -050019#define PLDM_SET_EVENT_RECEIVER_REQ_BYTES 5
Sampa Misra0db1dfa2019-03-19 00:15:31 -050020/* Response lengths are inclusive of completion code */
21#define PLDM_SET_STATE_EFFECTER_STATES_RESP_BYTES 1
22
George Liu30b859f2020-01-07 15:03:22 +080023#define PLDM_SET_NUMERIC_EFFECTER_VALUE_RESP_BYTES 1
24#define PLDM_SET_NUMERIC_EFFECTER_VALUE_MIN_REQ_BYTES 4
25
Sampa Misra7fcfb662019-05-08 13:13:53 -050026#define PLDM_GET_PDR_REQ_BYTES 13
Sagar Srinivas535bccd2021-03-24 12:18:26 -050027
28#define PLDM_SET_EVENT_RECEIVER_RESP_BYTES 1
Sampa Misra7fcfb662019-05-08 13:13:53 -050029/* Minimum response length */
30#define PLDM_GET_PDR_MIN_RESP_BYTES 12
Jolie Ku6787f172020-03-19 11:15:53 +080031#define PLDM_GET_NUMERIC_EFFECTER_VALUE_MIN_RESP_BYTES 5
Jolie Kuf798c8f2020-04-14 11:18:06 +080032#define PLDM_GET_SENSOR_READING_MIN_RESP_BYTES 8
George Liu80237ef2020-07-10 15:16:39 +080033#define PLDM_GET_STATE_SENSOR_READINGS_MIN_RESP_BYTES 2
Sampa Misra7fcfb662019-05-08 13:13:53 -050034
Zahed Hossaind4abab12020-02-06 03:36:43 -060035/* Minimum length for PLDM PlatformEventMessage request */
36#define PLDM_PLATFORM_EVENT_MESSAGE_MIN_REQ_BYTES 3
37#define PLDM_PLATFORM_EVENT_MESSAGE_STATE_SENSOR_STATE_REQ_BYTES 6
Tom Joseph56e45c52020-03-16 10:01:45 +053038#define PLDM_PLATFORM_EVENT_MESSAGE_RESP_BYTES 2
Tom Joseph7f839f92020-09-21 10:20:44 +053039#define PLDM_PLATFORM_EVENT_MESSAGE_FORMAT_VERSION 1
Zahed Hossaind4abab12020-02-06 03:36:43 -060040
Zahed Hossain1c861712020-03-04 08:55:19 -060041/* Minumum length of senson event data */
42#define PLDM_SENSOR_EVENT_DATA_MIN_LENGTH 5
43#define PLDM_SENSOR_EVENT_SENSOR_OP_STATE_DATA_LENGTH 2
44#define PLDM_SENSOR_EVENT_STATE_SENSOR_STATE_DATA_LENGTH 3
45#define PLDM_SENSOR_EVENT_NUMERIC_SENSOR_STATE_MIN_DATA_LENGTH 4
46#define PLDM_SENSOR_EVENT_NUMERIC_SENSOR_STATE_MAX_DATA_LENGTH 7
47#define PLDM_SENSOR_EVENT_NUMERIC_SENSOR_STATE_8BIT_DATA_LENGTH 4
48#define PLDM_SENSOR_EVENT_NUMERIC_SENSOR_STATE_16BIT_DATA_LENGTH 5
49#define PLDM_SENSOR_EVENT_NUMERIC_SENSOR_STATE_32BIT_DATA_LENGTH 7
50
Zahed Hossain9be087c2020-04-02 02:26:41 -050051/* Minimum length of data for pldmPDRRepositoryChgEvent */
52#define PLDM_PDR_REPOSITORY_CHG_EVENT_MIN_LENGTH 2
53#define PLDM_PDR_REPOSITORY_CHANGE_RECORD_MIN_LENGTH 2
54
Tom Joseph250c4752020-04-15 10:32:45 +053055#define PLDM_INVALID_EFFECTER_ID 0xFFFF
Sampa Misra868c8792020-05-26 03:12:13 -050056#define PLDM_TID_RESERVED 0xFF
Tom Joseph250c4752020-04-15 10:32:45 +053057
George Liu30b859f2020-01-07 15:03:22 +080058enum pldm_effecter_data_size {
59 PLDM_EFFECTER_DATA_SIZE_UINT8,
60 PLDM_EFFECTER_DATA_SIZE_SINT8,
61 PLDM_EFFECTER_DATA_SIZE_UINT16,
62 PLDM_EFFECTER_DATA_SIZE_SINT16,
63 PLDM_EFFECTER_DATA_SIZE_UINT32,
64 PLDM_EFFECTER_DATA_SIZE_SINT32
65};
66
George Liu456c9a22020-01-13 11:36:22 +080067enum pldm_range_field_format {
68 PLDM_RANGE_FIELD_FORMAT_UINT8,
69 PLDM_RANGE_FIELD_FORMAT_SINT8,
70 PLDM_RANGE_FIELD_FORMAT_UINT16,
71 PLDM_RANGE_FIELD_FORMAT_SINT16,
72 PLDM_RANGE_FIELD_FORMAT_UINT32,
73 PLDM_RANGE_FIELD_FORMAT_SINT32,
74 PLDM_RANGE_FIELD_FORMAT_REAL32
75};
76
Sampa Misra0db1dfa2019-03-19 00:15:31 -050077enum set_request { PLDM_NO_CHANGE = 0x00, PLDM_REQUEST_SET = 0x01 };
78
79enum effecter_state { PLDM_INVALID_VALUE = 0xFF };
80
George Liu9d155022020-07-10 15:06:35 +080081enum pldm_sensor_present_state {
82 PLDM_SENSOR_UNKNOWN = 0x0,
83 PLDM_SENSOR_NORMAL = 0x01,
84 PLDM_SENSOR_WARNING = 0x02,
85 PLDM_SENSOR_CRITICAL = 0x03,
86 PLDM_SENSOR_FATAL = 0x04,
87 PLDM_SENSOR_LOWERWARNING = 0x05,
88 PLDM_SENSOR_LOWERCRITICAL = 0x06,
89 PLDM_SENSOR_LOWERFATAL = 0x07,
90 PLDM_SENSOR_UPPERWARNING = 0x08,
91 PLDM_SENSOR_UPPERCRITICAL = 0x09,
92 PLDM_SENSOR_UPPERFATAL = 0x0a
Jolie Ku3557bad2020-03-02 16:22:57 +080093};
94
Jolie Kuf798c8f2020-04-14 11:18:06 +080095enum pldm_sensor_event_message_enable {
96 PLDM_NO_EVENT_GENERATION,
97 PLDM_EVENTS_DISABLED,
98 PLDM_EVENTS_ENABLED,
99 PLDM_OP_EVENTS_ONLY_ENABLED,
100 PLDM_STATE_EVENTS_ONLY_ENABLED
101};
102
Jolie Ku6787f172020-03-19 11:15:53 +0800103enum pldm_effecter_oper_state {
104 EFFECTER_OPER_STATE_ENABLED_UPDATEPENDING,
105 EFFECTER_OPER_STATE_ENABLED_NOUPDATEPENDING,
106 EFFECTER_OPER_STATE_DISABLED,
107 EFFECTER_OPER_STATE_UNAVAILABLE,
108 EFFECTER_OPER_STATE_STATUSUNKNOWN,
109 EFFECTER_OPER_STATE_FAILED,
110 EFFECTER_OPER_STATE_INITIALIZING,
111 EFFECTER_OPER_STATE_SHUTTINGDOWN,
112 EFFECTER_OPER_STATE_INTEST
113};
114
Sampa Misra0db1dfa2019-03-19 00:15:31 -0500115enum pldm_platform_commands {
Sagar Srinivas535bccd2021-03-24 12:18:26 -0500116 PLDM_SET_EVENT_RECEIVER = 0x04,
Jolie Kuf798c8f2020-04-14 11:18:06 +0800117 PLDM_GET_SENSOR_READING = 0x11,
Jolie Ku3557bad2020-03-02 16:22:57 +0800118 PLDM_GET_STATE_SENSOR_READINGS = 0x21,
George Liu30b859f2020-01-07 15:03:22 +0800119 PLDM_SET_NUMERIC_EFFECTER_VALUE = 0x31,
Jolie Ku6787f172020-03-19 11:15:53 +0800120 PLDM_GET_NUMERIC_EFFECTER_VALUE = 0x32,
Sampa Misra0db1dfa2019-03-19 00:15:31 -0500121 PLDM_SET_STATE_EFFECTER_STATES = 0x39,
Sampa Misra7fcfb662019-05-08 13:13:53 -0500122 PLDM_GET_PDR = 0x51,
Zahed Hossaind4abab12020-02-06 03:36:43 -0600123 PLDM_PLATFORM_EVENT_MESSAGE = 0x0A
Sampa Misra0db1dfa2019-03-19 00:15:31 -0500124};
125
Deepak Kodihallic6e8fb52019-05-02 08:35:31 -0500126/** @brief PLDM PDR types
127 */
128enum pldm_pdr_types {
Sridevi Ramesha1bfb782020-07-14 02:51:23 -0500129 PLDM_TERMINUS_LOCATOR_PDR = 1,
130 PLDM_NUMERIC_SENSOR_PDR = 2,
131 PLDM_NUMERIC_SENSOR_INITIALIZATION_PDR = 3,
Tom Josephb4268602020-04-17 17:20:45 +0530132 PLDM_STATE_SENSOR_PDR = 4,
Sridevi Ramesha1bfb782020-07-14 02:51:23 -0500133 PLDM_STATE_SENSOR_INITIALIZATION_PDR = 5,
134 PLDM_SENSOR_AUXILIARY_NAMES_PDR = 6,
135 PLDM_OEM_UNIT_PDR = 7,
136 PLDM_OEM_STATE_SET_PDR = 8,
George Liu456c9a22020-01-13 11:36:22 +0800137 PLDM_NUMERIC_EFFECTER_PDR = 9,
Sridevi Ramesha1bfb782020-07-14 02:51:23 -0500138 PLDM_NUMERIC_EFFECTER_INITIALIZATION_PDR = 10,
Deepak Kodihallic6e8fb52019-05-02 08:35:31 -0500139 PLDM_STATE_EFFECTER_PDR = 11,
Sridevi Ramesha1bfb782020-07-14 02:51:23 -0500140 PLDM_STATE_EFFECTER_INITIALIZATION_PDR = 12,
141 PLDM_EFFECTER_AUXILIARY_NAMES_PDR = 13,
142 PLDM_EFFECTER_OEM_SEMANTIC_PDR = 14,
Deepak Kodihalli0a738f02020-03-10 01:56:21 -0500143 PLDM_PDR_ENTITY_ASSOCIATION = 15,
Sridevi Ramesha1bfb782020-07-14 02:51:23 -0500144 PLDM_ENTITY_AUXILIARY_NAMES_PDR = 16,
145 PLDM_OEM_ENTITY_ID_PDR = 17,
146 PLDM_INTERRUPT_ASSOCIATION_PDR = 18,
147 PLDM_EVENT_LOG_PDR = 19,
Deepak Kodihallidb914672020-02-07 02:47:45 -0600148 PLDM_PDR_FRU_RECORD_SET = 20,
Sridevi Ramesha1bfb782020-07-14 02:51:23 -0500149 PLDM_OEM_DEVICE_PDR = 126,
150 PLDM_OEM_PDR = 127,
Deepak Kodihallic6e8fb52019-05-02 08:35:31 -0500151};
152
153/** @brief PLDM effecter initialization schemes
154 */
155enum pldm_effecter_init {
156 PLDM_NO_INIT,
157 PLDM_USE_INIT_PDR,
158 PLDM_ENABLE_EFFECTER,
159 PLDM_DISABLE_EFECTER
160};
161
Deepak Kodihalli557dfb02019-05-12 13:11:17 +0530162/** @brief PLDM Platform M&C completion codes
163 */
164enum pldm_platform_completion_codes {
George Liu362c18d2020-05-14 09:46:36 +0800165 PLDM_PLATFORM_INVALID_SENSOR_ID = 0x80,
166 PLDM_PLATFORM_REARM_UNAVAILABLE_IN_PRESENT_STATE = 0x81,
167
Sampa Misraa2fa0702019-05-31 01:28:55 -0500168 PLDM_PLATFORM_INVALID_EFFECTER_ID = 0x80,
169 PLDM_PLATFORM_INVALID_STATE_VALUE = 0x81,
Zach Clark76728752020-03-31 10:44:09 -0500170
171 PLDM_PLATFORM_INVALID_DATA_TRANSFER_HANDLE = 0x80,
172 PLDM_PLATFORM_INVALID_TRANSFER_OPERATION_FLAG = 0x81,
Deepak Kodihalli557dfb02019-05-12 13:11:17 +0530173 PLDM_PLATFORM_INVALID_RECORD_HANDLE = 0x82,
Zach Clark76728752020-03-31 10:44:09 -0500174 PLDM_PLATFORM_INVALID_RECORD_CHANGE_NUMBER = 0x83,
175 PLDM_PLATFORM_TRANSFER_TIMEOUT = 0x84,
176
Sampa Misraa2fa0702019-05-31 01:28:55 -0500177 PLDM_PLATFORM_SET_EFFECTER_UNSUPPORTED_SENSORSTATE = 0x82,
Sagar Srinivas535bccd2021-03-24 12:18:26 -0500178
179 PLDM_PLATFORM_INVALID_PROTOCOL_TYPE = 0x80,
180 PLDM_PLATFORM_ENABLE_METHOD_NOT_SUPPORTED = 0x81,
181 PLDM_PLATFORM_HEARTBEAT_FREQUENCY_TOO_HIGH = 0x82,
Deepak Kodihalli557dfb02019-05-12 13:11:17 +0530182};
183
Zahed Hossaind4abab12020-02-06 03:36:43 -0600184/** @brief PLDM Event types
185 */
186enum pldm_event_types {
187 PLDM_SENSOR_EVENT = 0x00,
188 PLDM_EFFECTER_EVENT = 0x01,
189 PLDM_REDFISH_TASK_EXECUTED_EVENT = 0x02,
190 PLDM_REDFISH_MESSAGE_EVENT = 0x03,
191 PLDM_PDR_REPOSITORY_CHG_EVENT = 0x04,
192 PLDM_MESSAGE_POLL_EVENT = 0x05,
193 PLDM_HEARTBEAT_TIMER_ELAPSED_EVENT = 0x06
194};
195
196/** @brief PLDM sensorEventClass states
197 */
198enum sensor_event_class_states {
199 PLDM_SENSOR_OP_STATE,
200 PLDM_STATE_SENSOR_STATE,
201 PLDM_NUMERIC_SENSOR_STATE
202};
203
204/** @brief PLDM sensor supported states
205 */
206enum pldm_sensor_operational_state {
207 PLDM_SENSOR_ENABLED,
208 PLDM_SENSOR_DISABLED,
209 PLDM_SENSOR_UNAVAILABLE,
210 PLDM_SENSOR_STATUSUNKOWN,
211 PLDM_SENSOR_FAILED,
212 PLDM_SENSOR_INITIALIZING,
213 PLDM_SENSOR_SHUTTINGDOWN,
214 PLDM_SENSOR_INTEST
215};
216
217/** @brief PLDM pldmPDRRepositoryChgEvent class eventData format
218 */
219enum pldm_pdr_repository_chg_event_data_format {
220 REFRESH_ENTIRE_REPOSITORY,
221 FORMAT_IS_PDR_TYPES,
222 FORMAT_IS_PDR_HANDLES
223};
224
Zahed Hossain9be087c2020-04-02 02:26:41 -0500225/** @brief PLDM pldmPDRRepositoryChgEvent class changeRecord format
226 * eventDataOperation
227 */
228enum pldm_pdr_repository_chg_event_change_record_event_data_operation {
229 PLDM_REFRESH_ALL_RECORDS,
230 PLDM_RECORDS_DELETED,
231 PLDM_RECORDS_ADDED,
232 PLDM_RECORDS_MODIFIED
233};
234
Zahed Hossain1c861712020-03-04 08:55:19 -0600235/** @brief PLDM NumericSensorStatePresentReading data type
236 */
237enum pldm_sensor_readings_data_type {
238 PLDM_SENSOR_DATA_SIZE_UINT8,
239 PLDM_SENSOR_DATA_SIZE_SINT8,
240 PLDM_SENSOR_DATA_SIZE_UINT16,
241 PLDM_SENSOR_DATA_SIZE_SINT16,
242 PLDM_SENSOR_DATA_SIZE_UINT32,
243 PLDM_SENSOR_DATA_SIZE_SINT32
244};
245
Tom Joseph56e45c52020-03-16 10:01:45 +0530246/** @brief PLDM PlatformEventMessage response status
247 */
248enum pldm_platform_event_status {
249 PLDM_EVENT_NO_LOGGING = 0x00,
250 PLDM_EVENT_LOGGING_DISABLED = 0x01,
251 PLDM_EVENT_LOG_FULL = 0x02,
252 PLDM_EVENT_ACCEPTED_FOR_LOGGING = 0x03,
253 PLDM_EVENT_LOGGED = 0x04,
254 PLDM_EVENT_LOGGING_REJECTED = 0x05
255};
256
Sampa Misra12afe112020-05-25 11:40:44 -0500257/** @brief PLDM Terminus Locator PDR validity
258 */
259enum pldm_terminus_locator_pdr_validity {
260 PLDM_TL_PDR_NOT_VALID,
261 PLDM_TL_PDR_VALID
262};
263
264/** @brief PLDM Terminus Locator type
265 */
266enum pldm_terminus_locator_type {
267 PLDM_TERMINUS_LOCATOR_TYPE_UID,
268 PLDM_TERMINUS_LOCATOR_TYPE_MCTP_EID,
269 PLDM_TERMINUS_LOCATOR_TYPE_SMBUS_RELATIVE,
270 PLDM_TERMINUS_LOCATOR_TYPE_SYS_SW
271};
272
Sagar Srinivas535bccd2021-03-24 12:18:26 -0500273/** @brief PLDM event message global enable for
274 * SetEventReceiver command
275 */
276enum pldm_event_message_global_enable {
277 PLDM_EVENT_MESSAGE_GLOBAL_DISABLE,
278 PLDM_EVENT_MESSAGE_GLOBAL_ENABLE_ASYNC,
279 PLDM_EVENT_MESSAGE_GLOBAL_ENABLE_POLLING,
280 PLDM_EVENT_MESSAGE_GLOBAL_ENABLE_ASYNC_KEEP_ALIVE
281};
282
Deepak Kodihallic6e8fb52019-05-02 08:35:31 -0500283/** @struct pldm_pdr_hdr
284 *
285 * Structure representing PLDM common PDR header
286 */
287struct pldm_pdr_hdr {
288 uint32_t record_handle;
289 uint8_t version;
290 uint8_t type;
291 uint16_t record_change_num;
292 uint16_t length;
293} __attribute__((packed));
294
Sampa Misra12afe112020-05-25 11:40:44 -0500295/** @struct pldm_terminus_locator_pdr
296 *
297 * Structure representing PLDM terminus locator PDR
298 */
299struct pldm_terminus_locator_pdr {
300 struct pldm_pdr_hdr hdr;
301 uint16_t terminus_handle;
302 uint8_t validity;
303 uint8_t tid;
304 uint16_t container_id;
305 uint8_t terminus_locator_type;
306 uint8_t terminus_locator_value_size;
307 uint8_t terminus_locator_value[1];
308} __attribute__((packed));
309
310/** @struct pldm_terminus_locator_type_mctp_eid
311 *
312 * Structure representing terminus locator value for
313 * terminus locator type MCTP_EID
314 */
315struct pldm_terminus_locator_type_mctp_eid {
316 uint8_t eid;
317} __attribute__((packed));
318
Deepak Kodihalli5544ccd2020-03-15 23:36:16 -0500319/** @struct pldm_pdr_entity_association
320 *
321 * Structure representing PLDM Entity Association PDR
322 */
323struct pldm_pdr_entity_association {
324 uint16_t container_id;
325 uint8_t association_type;
326 pldm_entity container;
327 uint8_t num_children;
328 pldm_entity children[1];
329} __attribute__((packed));
330
Deepak Kodihallidb914672020-02-07 02:47:45 -0600331/** @struct pldm_pdr_fru_record_set
332 *
333 * Structure representing PLDM FRU record set PDR
334 */
335struct pldm_pdr_fru_record_set {
336 uint16_t terminus_handle;
337 uint16_t fru_rsi;
338 uint16_t entity_type;
339 uint16_t entity_instance_num;
340 uint16_t container_id;
341} __attribute__((packed));
342
Tom Josephb4268602020-04-17 17:20:45 +0530343/** @struct pldm_state_sensor_pdr
344 *
345 * Structure representing PLDM state sensor PDR
346 */
347struct pldm_state_sensor_pdr {
348 struct pldm_pdr_hdr hdr;
349 uint16_t terminus_handle;
350 uint16_t sensor_id;
351 uint16_t entity_type;
352 uint16_t entity_instance;
353 uint16_t container_id;
354 uint8_t sensor_init;
355 bool8_t sensor_auxiliary_names_pdr;
356 uint8_t composite_sensor_count;
357 uint8_t possible_states[1];
358} __attribute__((packed));
359
360/** @struct state_sensor_possible_states
361 *
362 * Structure representing state enums for state sensor
363 */
364struct state_sensor_possible_states {
365 uint16_t state_set_id;
366 uint8_t possible_states_size;
367 bitfield8_t states[1];
368} __attribute__((packed));
369
Deepak Kodihallic6e8fb52019-05-02 08:35:31 -0500370/** @struct pldm_state_effecter_pdr
371 *
372 * Structure representing PLDM state effecter PDR
373 */
374struct pldm_state_effecter_pdr {
375 struct pldm_pdr_hdr hdr;
376 uint16_t terminus_handle;
377 uint16_t effecter_id;
378 uint16_t entity_type;
379 uint16_t entity_instance;
380 uint16_t container_id;
381 uint16_t effecter_semantic_id;
382 uint8_t effecter_init;
383 bool8_t has_description_pdr;
384 uint8_t composite_effecter_count;
385 uint8_t possible_states[1];
386} __attribute__((packed));
387
Zach Clarkb728eee2020-06-18 10:01:31 -0500388/** @brief Encode PLDM state sensor PDR
389 *
390 * @param[in/out] sensor Structure to encode. All members of
391 * sensor, except those mentioned in the @note below, should be initialized by
392 * the caller.
393 * @param[in] allocation_size Size of sensor allocation in bytes
394 * @param[in] possible_states Possible sensor states
395 * @param[in] possible_states_size Size of possible sensor states in bytes
396 * @param[out] actual_size Size of sensor PDR. Set to 0 on error.
397 * @return int pldm_completion_codes
398 * PLDM_SUCCESS/PLDM_ERROR/PLDM_ERROR_INVALID_LENGTH
399 *
400 * @note The sensor parameter will be encoded in place.
401 * @note Caller is responsible for allocation of the sensor parameter. Caller
402 * must allocate enough space for the base structure and the
403 * sensor->possible_states array, otherwise the function will fail.
404 * @note sensor->hdr.length, .type, and .version will be set appropriately.
405 */
406int encode_state_sensor_pdr(
407 struct pldm_state_sensor_pdr *sensor, size_t allocation_size,
408 const struct state_sensor_possible_states *possible_states,
409 size_t possible_states_size, size_t *actual_size);
410
George Liu456c9a22020-01-13 11:36:22 +0800411/** @union union_effecter_data_size
412 *
413 * The bit width and format of reading and threshold values that the effecter
414 * returns.
415 * Refer to: DSP0248_1.2.0: 28.11 Table 87
416 */
417typedef union {
418 uint8_t value_u8;
419 int8_t value_s8;
420 uint16_t value_u16;
421 int16_t value_s16;
422 uint32_t value_u32;
423 int32_t value_s32;
424} union_effecter_data_size;
425
426/** @union union_range_field_format
427 *
428 * Indicates the format used for the nominalValue, normalMax, and normalMin
429 * fields.
430 * Refer to: DSP0248_1.2.0: 28.11 Table 87
431 */
432typedef union {
433 uint8_t value_u8;
434 int8_t value_s8;
435 uint16_t value_u16;
436 int16_t value_s16;
437 uint32_t value_u32;
438 int32_t value_s32;
439 real32_t value_f32;
440} union_range_field_format;
441
442/** @struct pldm_numeric_effecter_value_pdr
443 *
444 * Structure representing PLDM numeric effecter value PDR
445 */
446struct pldm_numeric_effecter_value_pdr {
447 struct pldm_pdr_hdr hdr;
448 uint16_t terminus_handle;
449 uint16_t effecter_id;
450 uint16_t entity_type;
451 uint16_t entity_instance;
452 uint16_t container_id;
453 uint16_t effecter_semantic_id;
454 uint8_t effecter_init;
455 bool8_t effecter_auxiliary_names;
456 uint8_t base_unit;
457 int8_t unit_modifier;
458 uint8_t rate_unit;
459 uint8_t base_oem_unit_handle;
460 uint8_t aux_unit;
461 int8_t aux_unit_modifier;
462 uint8_t aux_rate_unit;
463 uint8_t aux_oem_unit_handle;
464 bool8_t is_linear;
465 uint8_t effecter_data_size;
466 real32_t resolution;
467 real32_t offset;
468 uint16_t accuracy;
469 uint8_t plus_tolerance;
470 uint8_t minus_tolerance;
471 real32_t state_transition_interval;
472 real32_t transition_interval;
473 union_effecter_data_size max_set_table;
474 union_effecter_data_size min_set_table;
475 uint8_t range_field_format;
476 bitfield8_t range_field_support;
477 union_range_field_format nominal_value;
478 union_range_field_format normal_max;
479 union_range_field_format normal_min;
480 union_range_field_format rated_max;
481 union_range_field_format rated_min;
482} __attribute__((packed));
483
Deepak Kodihallic6e8fb52019-05-02 08:35:31 -0500484/** @struct state_effecter_possible_states
485 *
486 * Structure representing state enums for state effecter
487 */
488struct state_effecter_possible_states {
489 uint16_t state_set_id;
490 uint8_t possible_states_size;
491 bitfield8_t states[1];
492} __attribute__((packed));
493
Zach Clarkb728eee2020-06-18 10:01:31 -0500494/** @brief Encode PLDM state effecter PDR
495 *
496 * @param[in/out] effecter Structure to encode. All members of
497 * effecter, except those mentioned in
498 * the @note below, should be initialized
499 * by the caller.
500 * @param[in] allocation_size Size of effecter allocation in bytes
501 * @param[in] possible_states Possible effecter states
502 * @param[in] possible_states_size Size of possible effecter states in
503 * bytes
504 * @param[out] actual_size Size of effecter PDR. Set to 0 on
505 * error.
506 * @return int pldm_completion_codes
507 * PLDM_SUCCESS/PLDM_ERROR/PLDM_ERROR_INVALID_LENGTH
508 *
509 * @note The effecter parameter will be encoded in place.
510 * @note Caller is responsible for allocation of the effecter parameter. Caller
511 * must allocate enough space for the base structure and the
512 * effecter->possible_states array, otherwise the function will fail.
513 * @note effecter->hdr.length, .type, and .version will be set appropriately.
514 */
515int encode_state_effecter_pdr(
516 struct pldm_state_effecter_pdr *effecter, size_t allocation_size,
517 const struct state_effecter_possible_states *possible_states,
518 size_t possible_states_size, size_t *actual_size);
519
Sampa Misra0db1dfa2019-03-19 00:15:31 -0500520/** @struct set_effecter_state_field
521 *
522 * Structure representing a stateField in SetStateEffecterStates command */
523
524typedef struct state_field_for_state_effecter_set {
Deepak Kodihalli826c9d42020-05-26 01:58:06 -0500525 uint8_t set_request; //!< Whether to change the state
Sampa Misra0db1dfa2019-03-19 00:15:31 -0500526 uint8_t effecter_state; //!< Expected state of the effecter
527} __attribute__((packed)) set_effecter_state_field;
528
Jolie Ku3557bad2020-03-02 16:22:57 +0800529/** @struct get_sensor_readings_field
530 *
531 * Structure representing a stateField in GetStateSensorReadings command */
532
533typedef struct state_field_for_get_state_sensor_readings {
534 uint8_t sensor_op_state; //!< The state of the sensor itself
Deepak Kodihalli826c9d42020-05-26 01:58:06 -0500535 uint8_t present_state; //!< Return a state value
Jolie Ku3557bad2020-03-02 16:22:57 +0800536 uint8_t previous_state; //!< The state that the presentState was entered
537 //! from. This must be different from the
538 //! present state
Deepak Kodihalli826c9d42020-05-26 01:58:06 -0500539 uint8_t event_state; //!< Return a state value from a PLDM State Set
Jolie Ku3557bad2020-03-02 16:22:57 +0800540 //! that is associated with the sensor
541} __attribute__((packed)) get_sensor_state_field;
542
Priyanga7257fdf2019-06-10 01:59:45 -0500543/** @struct PLDM_SetStateEffecterStates_Request
544 *
545 * Structure representing PLDM set state effecter states request.
546 */
547struct pldm_set_state_effecter_states_req {
548 uint16_t effecter_id;
549 uint8_t comp_effecter_count;
550 set_effecter_state_field field[8];
551} __attribute__((packed));
552
Sampa Misra7fcfb662019-05-08 13:13:53 -0500553/** @struct pldm_get_pdr_resp
554 *
555 * structure representing GetPDR response packet
556 * transfer CRC is not part of the structure and will be
557 * added at the end of last packet in multipart transfer
558 */
559struct pldm_get_pdr_resp {
560 uint8_t completion_code;
561 uint32_t next_record_handle;
562 uint32_t next_data_transfer_handle;
563 uint8_t transfer_flag;
564 uint16_t response_count;
565 uint8_t record_data[1];
566} __attribute__((packed));
567
568/** @struct pldm_get_pdr_req
569 *
570 * structure representing GetPDR request packet
571 */
572struct pldm_get_pdr_req {
573 uint32_t record_handle;
574 uint32_t data_transfer_handle;
575 uint8_t transfer_op_flag;
576 uint16_t request_count;
577 uint16_t record_change_number;
578} __attribute__((packed));
579
Sagar Srinivas535bccd2021-03-24 12:18:26 -0500580/** @struct pldm_set_event_receiver_req
581 *
582 * Structure representing SetEventReceiver command.
583 * This structure applies only for MCTP as a transport type.
584 */
585struct pldm_set_event_receiver_req {
586 uint8_t event_message_global_enable;
587 uint8_t transport_protocol_type;
588 uint8_t event_receiver_address_info;
589 uint16_t heartbeat_timer;
590} __attribute__((packed));
591
George Liu30b859f2020-01-07 15:03:22 +0800592/** @struct pldm_set_numeric_effecter_value_req
593 *
594 * structure representing SetNumericEffecterValue request packet
595 */
596struct pldm_set_numeric_effecter_value_req {
597 uint16_t effecter_id;
598 uint8_t effecter_data_size;
599 uint8_t effecter_value[1];
600} __attribute__((packed));
601
Jolie Ku3557bad2020-03-02 16:22:57 +0800602/** @struct pldm_get_state_sensor_readings_req
603 *
604 * Structure representing PLDM get state sensor readings request.
605 */
606struct pldm_get_state_sensor_readings_req {
607 uint16_t sensor_id;
608 bitfield8_t sensor_rearm;
609 uint8_t reserved;
610} __attribute__((packed));
611
612/** @struct pldm_get_state_sensor_readings_resp
613 *
614 * Structure representing PLDM get state sensor readings response.
615 */
616struct pldm_get_state_sensor_readings_resp {
617 uint8_t completion_code;
618 uint8_t comp_sensor_count;
619 get_sensor_state_field field[1];
620} __attribute__((packed));
621
Zahed Hossaind4abab12020-02-06 03:36:43 -0600622/** @struct pldm_sensor_event
623 *
624 * structure representing sensorEventClass
625 */
626struct pldm_sensor_event_data {
627 uint16_t sensor_id;
628 uint8_t sensor_event_class_type;
629 uint8_t event_class[1];
630} __attribute__((packed));
631
632/** @struct pldm_state_sensor_state
633 *
634 * structure representing sensorEventClass for stateSensorState
635 */
636struct pldm_sensor_event_state_sensor_state {
637 uint8_t sensor_offset;
638 uint8_t event_state;
639 uint8_t previous_event_state;
640} __attribute__((packed));
641
642/** @struct pldm_sensor_event_numeric_sensor_state
643 *
644 * structure representing sensorEventClass for stateSensorState
645 */
646struct pldm_sensor_event_numeric_sensor_state {
647 uint8_t event_state;
648 uint8_t previous_event_state;
649 uint8_t sensor_data_size;
650 uint8_t present_reading[1];
651} __attribute__((packed));
652
653/** @struct pldm_sensor_event_sensor_op_state
654 *
655 * structure representing sensorEventClass for SensorOpState
656 */
657struct pldm_sensor_event_sensor_op_state {
658 uint8_t present_op_state;
659 uint8_t previous_op_state;
660} __attribute__((packed));
661
662/** @struct pldm_platform_event_message_req
663 *
664 * structure representing PlatformEventMessage command request data
665 */
666struct pldm_platform_event_message_req {
667 uint8_t format_version;
668 uint8_t tid;
669 uint8_t event_class;
670 uint8_t event_data[1];
671} __attribute__((packed));
672
673/** @struct pldm_platform_event_message_response
674 *
675 * structure representing PlatformEventMessage command response data
676 */
677struct pldm_platform_event_message_resp {
678 uint8_t completion_code;
Pavithra Barithaya2ea1f072020-04-03 09:30:23 -0500679 uint8_t platform_event_status;
Zahed Hossaind4abab12020-02-06 03:36:43 -0600680} __attribute__((packed));
681
682/** @struct pldm_pdr_repository_chg_event_data
683 *
684 * structure representing pldmPDRRepositoryChgEvent class eventData
685 */
686struct pldm_pdr_repository_chg_event_data {
687 uint8_t event_data_format;
688 uint8_t number_of_change_records;
689 uint8_t change_records[1];
690} __attribute__((packed));
691
692/** @struct pldm_pdr_repository_chg_event_change_record_data
693 *
694 * structure representing pldmPDRRepositoryChgEvent class eventData's change
695 * record data
696 */
697struct pldm_pdr_repository_change_record_data {
698 uint8_t event_data_operation;
699 uint8_t number_of_change_entries;
700 uint32_t change_entry[1];
701} __attribute__((packed));
702
Jolie Ku6787f172020-03-19 11:15:53 +0800703/** @struct pldm_get_numeric_effecter_value_req
704 *
705 * structure representing GetNumericEffecterValue request packet
706 */
707struct pldm_get_numeric_effecter_value_req {
708 uint16_t effecter_id;
709} __attribute__((packed));
710
711/** @struct pldm_get_numeric_effecter_value_resp
712 *
713 * structure representing GetNumericEffecterValue response packet
714 */
715struct pldm_get_numeric_effecter_value_resp {
716 uint8_t completion_code;
717 uint8_t effecter_data_size;
718 uint8_t effecter_oper_state;
719 uint8_t pending_and_present_values[1];
720} __attribute__((packed));
721
Jolie Kuf798c8f2020-04-14 11:18:06 +0800722/** @struct pldm_get_sensor_reading_req
723 *
724 * Structure representing PLDM get sensor reading request
725 */
726struct pldm_get_sensor_reading_req {
727 uint16_t sensor_id;
728 bool8_t rearm_event_state;
729} __attribute__((packed));
730
731/** @struct pldm_get_sensor_reading_resp
732 *
733 * Structure representing PLDM get sensor reading response
734 */
735struct pldm_get_sensor_reading_resp {
736 uint8_t completion_code;
737 uint8_t sensor_data_size;
738 uint8_t sensor_operational_state;
739 uint8_t sensor_event_message_enable;
740 uint8_t present_state;
741 uint8_t previous_state;
742 uint8_t event_state;
743 uint8_t present_reading[1];
744} __attribute__((packed));
745
Sampa Misra0db1dfa2019-03-19 00:15:31 -0500746/* Responder */
747
George Liu30b859f2020-01-07 15:03:22 +0800748/* SetNumericEffecterValue */
749
750/** @brief Decode SetNumericEffecterValue request data
751 *
752 * @param[in] msg - Request message
753 * @param[in] payload_length - Length of request message payload
754 * @param[out] effecter_id - used to identify and access the effecter
755 * @param[out] effecter_data_size - The bit width and format of the setting
756 * value for the effecter.
757 * value:{uint8,sint8,uint16,sint16,uint32,sint32}
758 * @param[out] effecter_value - The setting value of numeric effecter being
759 * requested.
760 * @return pldm_completion_codes
761 */
762int decode_set_numeric_effecter_value_req(const struct pldm_msg *msg,
763 size_t payload_length,
764 uint16_t *effecter_id,
765 uint8_t *effecter_data_size,
766 uint8_t *effecter_value);
767
768/** @brief Create a PLDM response message for SetNumericEffecterValue
769 *
770 * @param[in] instance_id - Message's instance id
771 * @param[in] completion_code - PLDM completion code
772 * @param[out] msg - Message will be written to this
773 * @param[in] payload_length - Length of request message payload
774 * @return pldm_completion_codes
775 * @note Caller is responsible for memory alloc and dealloc of param
776 * 'msg.body.payload'
777 */
778int encode_set_numeric_effecter_value_resp(uint8_t instance_id,
779 uint8_t completion_code,
780 struct pldm_msg *msg,
781 size_t payload_length);
782
Sampa Misra0db1dfa2019-03-19 00:15:31 -0500783/* SetStateEffecterStates */
784
785/** @brief Create a PLDM response message for SetStateEffecterStates
786 *
787 * @param[in] instance_id - Message's instance id
788 * @param[in] completion_code - PLDM completion code
789 * @param[out] msg - Message will be written to this
790 * @return pldm_completion_codes
791 * @note Caller is responsible for memory alloc and dealloc of param
792 * 'msg.body.payload'
793 */
794
795int encode_set_state_effecter_states_resp(uint8_t instance_id,
796 uint8_t completion_code,
797 struct pldm_msg *msg);
798
799/** @brief Decode SetStateEffecterStates request data
800 *
Zahed Hossain223a73d2019-07-04 12:46:18 -0500801 * @param[in] msg - Request message
vkaverapa6575b82019-04-03 05:33:52 -0500802 * @param[in] payload_length - Length of request message payload
Sampa Misra0db1dfa2019-03-19 00:15:31 -0500803 * @param[out] effecter_id - used to identify and access the effecter
804 * @param[out] comp_effecter_count - number of individual sets of effecter
805 * information. Upto eight sets of state effecter info can be accessed
806 * for a given effecter.
807 * @param[out] field - each unit is an instance of the stateFileld structure
808 * that is used to set the requested state for a particular effecter
809 * within the state effecter. This field holds the starting address of
810 * the stateField values. The user is responsible to allocate the
811 * memory prior to calling this command. Since the state field count is
812 * not known in advance, the user should allocate the maximum size
813 * always, which is 8 in number.
814 * @return pldm_completion_codes
815 */
vkaverapa6575b82019-04-03 05:33:52 -0500816
Zahed Hossain223a73d2019-07-04 12:46:18 -0500817int decode_set_state_effecter_states_req(const struct pldm_msg *msg,
vkaverapa6575b82019-04-03 05:33:52 -0500818 size_t payload_length,
Sampa Misra0db1dfa2019-03-19 00:15:31 -0500819 uint16_t *effecter_id,
820 uint8_t *comp_effecter_count,
821 set_effecter_state_field *field);
822
Sampa Misra7fcfb662019-05-08 13:13:53 -0500823/* GetPDR */
824
825/** @brief Create a PLDM response message for GetPDR
826 *
827 * @param[in] instance_id - Message's instance id
828 * @param[in] completion_code - PLDM completion code
829 * @param[in] next_record_hndl - The recordHandle for the PDR that is next in
830 * the PDR Repository
831 * @param[in] next_data_transfer_hndl - A handle that identifies the next
832 * portion of the PDR data to be transferred, if any
833 * @param[in] transfer_flag - Indicates the portion of PDR data being
834 * transferred
835 * @param[in] resp_cnt - The number of recordData bytes returned in this
836 * response
837 * @param[in] record_data - PDR data bytes of length resp_cnt
838 * @param[in] transfer_crc - A CRC-8 for the overall PDR. This is present only
839 * in the last part of a PDR being transferred
840 * @param[out] msg - Message will be written to this
841 * @return pldm_completion_codes
842 * @note Caller is responsible for memory alloc and dealloc of param
843 * 'msg.payload'
844 */
845int encode_get_pdr_resp(uint8_t instance_id, uint8_t completion_code,
846 uint32_t next_record_hndl,
847 uint32_t next_data_transfer_hndl, uint8_t transfer_flag,
848 uint16_t resp_cnt, const uint8_t *record_data,
849 uint8_t transfer_crc, struct pldm_msg *msg);
850
851/** @brief Decode GetPDR request data
852 *
853 * @param[in] msg - Request message
854 * @param[in] payload_length - Length of request message payload
855 * @param[out] record_hndl - The recordHandle value for the PDR to be retrieved
856 * @param[out] data_transfer_hndl - Handle used to identify a particular
857 * multipart PDR data transfer operation
858 * @param[out] transfer_op_flag - Flag to indicate the first or subsequent
859 * portion of transfer
860 * @param[out] request_cnt - The maximum number of record bytes requested
861 * @param[out] record_chg_num - Used to determine whether the PDR has changed
862 * while PDR transfer is going on
863 * @return pldm_completion_codes
864 */
865
866int decode_get_pdr_req(const struct pldm_msg *msg, size_t payload_length,
867 uint32_t *record_hndl, uint32_t *data_transfer_hndl,
868 uint8_t *transfer_op_flag, uint16_t *request_cnt,
869 uint16_t *record_chg_num);
870
Jolie Ku3557bad2020-03-02 16:22:57 +0800871/* GetStateSensorReadings */
872
873/** @brief Decode GetStateSensorReadings request data
874 *
875 * @param[in] msg - Request message
876 * @param[in] payload_length - Length of request message payload
877 * @param[out] sensor_id - used to identify and access the simple or composite
878 * sensor
879 * @param[out] sensor_rearm - Each bit location in this field corresponds to a
880 * particular sensor within the state sensor, where bit [0] corresponds
881 * to the first state sensor (sensor offset 0) and bit [7] corresponds
882 * to the eighth sensor (sensor offset 7), sequentially.
883 * @param[out] reserved - value: 0x00
884 * @return pldm_completion_codes
885 */
886
887int decode_get_state_sensor_readings_req(const struct pldm_msg *msg,
888 size_t payload_length,
889 uint16_t *sensor_id,
890 bitfield8_t *sensor_rearm,
891 uint8_t *reserved);
892
893/** @brief Encode GetStateSensorReadings response data
894 *
895 * @param[in] instance_id - Message's instance id
896 * @param[in] completion_code - PLDM completion code
897 * @param[out] comp_sensor_count - The number of individual sets of sensor
898 * information that this command accesses
899 * @param[out] field - Each stateField is an instance of a stateField structure
900 * that is used to return the present operational state setting and the
901 * present state and event state for a particular set of sensor
902 * information contained within the state sensor
903 * @param[out] msg - Message will be written to this
904 * @return pldm_completion_codes
905 */
906
907int encode_get_state_sensor_readings_resp(uint8_t instance_id,
908 uint8_t completion_code,
909 uint8_t comp_sensor_count,
910 get_sensor_state_field *field,
911 struct pldm_msg *msg);
912
Jolie Ku6787f172020-03-19 11:15:53 +0800913/* GetNumericEffecterValue */
914
915/** @brief Decode GetNumericEffecterValue request data
916 *
917 * @param[in] msg - Request message
918 * @param[in] payload_length - Length of request message payload
919 * @param[out] effecter_id - used to identify and access the effecter
920 * @return pldm_completion_codes
921 */
922int decode_get_numeric_effecter_value_req(const struct pldm_msg *msg,
923 size_t payload_length,
924 uint16_t *effecter_id);
925
926/** @brief Create a PLDM response message for GetNumericEffecterValue
927 *
928 * @param[in] instance_id - Message's instance id
929 * @param[in] completion_code - PLDM completion code
930 * @param[in] effecter_data_size - The bit width and format of the setting
931 * value for the effecter.
932 * value:{uint8,sint8,uint16,sint16,uint32,sint32}
933 * @param[in] effecter_oper_state - The state of the effecter itself
934 * @param[in] pending_value - The pending numeric value setting of the
935 * effecter. The effecterDataSize field indicates the number of
936 * bits used for this field
937 * @param[in] present_value - The present numeric value setting of the
938 * effecter. The effecterDataSize indicates the number of bits
939 * used for this field
940 * @param[out] msg - Message will be written to this
941 * @param[in] payload_length - Length of request message payload
942 * @return pldm_completion_codes
943 * @note Caller is responsible for memory alloc and dealloc of param
944 * 'msg.payload'
945 */
946int encode_get_numeric_effecter_value_resp(
947 uint8_t instance_id, uint8_t completion_code, uint8_t effecter_data_size,
948 uint8_t effecter_oper_state, uint8_t *pending_value, uint8_t *present_value,
949 struct pldm_msg *msg, size_t payload_length);
950
Jolie Kuf798c8f2020-04-14 11:18:06 +0800951/* GetSensorReading */
952
953/** @brief Decode GetSensorReading request data
954 *
955 * @param[in] msg - Request message
956 * @param[in] payload_length - Length of request message payload
957 * @param[out] sensor_id - A handle that is used to identify and access
958 * the sensor
959 * @param[out] rearm_event_state - true = manually re-arm EventState after
960 * responding to this request, false = no manual re-arm
961 * @return pldm_completion_codes
962 */
963
964int decode_get_sensor_reading_req(const struct pldm_msg *msg,
965 size_t payload_length, uint16_t *sensor_id,
966 bool8_t *rearm_event_state);
967
968/** @brief Encode GetSensorReading response data
969 *
970 * @param[in] instance_id - Message's instance id
971 * @param[in] completion_code - PLDM completion code
972 * @param[out] sensor_data_size - The bit width and format of reading and
973 * threshold values
974 * @param[out] sensor_operational_state - The state of the sensor itself
975 * @param[out] sensor_event_message_enable - value: { noEventGeneration,
976 * eventsDisabled, eventsEnabled, opEventsOnlyEnabled,
977 * stateEventsOnlyEnabled }
978 * @param[out] present_state - The most recently assessed state value monitored
979 * by the sensor
980 * @param[out] previous_state - The state that the presentState was entered
981 * from
982 * @param[out] event_state - Indicates which threshold crossing assertion
983 * events have been detected
984 * @param[out] present_reading - The present value indicated by the sensor
985 * @param[out] msg - Message will be written to this
986 * @param[in] payload_length - Length of request message payload
987 * @return pldm_completion_codes
988 */
989
990int encode_get_sensor_reading_resp(
991 uint8_t instance_id, uint8_t completion_code, uint8_t sensor_data_size,
992 uint8_t sensor_operational_state, uint8_t sensor_event_message_enable,
993 uint8_t present_state, uint8_t previous_state, uint8_t event_state,
994 uint8_t *present_reading, struct pldm_msg *msg, size_t payload_length);
995
Sampa Misra7fcfb662019-05-08 13:13:53 -0500996/* Requester */
997
George Liu820a9a52019-11-26 14:43:59 +0800998/* GetPDR */
999
1000/** @brief Create a PLDM request message for GetPDR
1001 *
1002 * @param[in] instance_id - Message's instance id
1003 * @param[in] record_hndl - The recordHandle value for the PDR to be retrieved
1004 * @param[in] data_transfer_hndl - Handle used to identify a particular
1005 * multipart PDR data transfer operation
1006 * @param[in] transfer_op_flag - Flag to indicate the first or subsequent
1007 * portion of transfer
1008 * @param[in] request_cnt - The maximum number of record bytes requested
1009 * @param[in] record_chg_num - Used to determine whether the PDR has changed
1010 * while PDR transfer is going on
1011 * @param[out] msg - Message will be written to this
1012 * @param[in] payload_length - Length of request message payload
1013 * @return pldm_completion_codes
1014 * @note Caller is responsible for memory alloc and dealloc of param
1015 * 'msg.payload'
1016 */
1017int encode_get_pdr_req(uint8_t instance_id, uint32_t record_hndl,
1018 uint32_t data_transfer_hndl, uint8_t transfer_op_flag,
1019 uint16_t request_cnt, uint16_t record_chg_num,
1020 struct pldm_msg *msg, size_t payload_length);
1021
1022/** @brief Decode GetPDR response data
1023 *
George Liu684a7162019-12-06 15:10:52 +08001024 * Note:
1025 * * If the return value is not PLDM_SUCCESS, it represents a
1026 * transport layer error.
1027 * * If the completion_code value is not PLDM_SUCCESS, it represents a
1028 * protocol layer error and all the out-parameters are invalid.
1029 *
George Liu820a9a52019-11-26 14:43:59 +08001030 * @param[in] msg - Request message
1031 * @param[in] payload_length - Length of request message payload
1032 * @param[out] completion_code - PLDM completion code
1033 * @param[out] next_record_hndl - The recordHandle for the PDR that is next in
1034 * the PDR Repository
1035 * @param[out] next_data_transfer_hndl - A handle that identifies the next
1036 * portion of the PDR data to be transferred, if any
1037 * @param[out] transfer_flag - Indicates the portion of PDR data being
1038 * transferred
1039 * @param[out] resp_cnt - The number of recordData bytes returned in this
1040 * response
Zach Clark3dba2bf2020-03-31 10:58:03 -05001041 * @param[out] record_data - PDR data bytes of length resp_cnt, or NULL to
1042 * skip the copy and place the actual length in resp_cnt.
George Liu820a9a52019-11-26 14:43:59 +08001043 * @param[in] record_data_length - Length of record_data
1044 * @param[out] transfer_crc - A CRC-8 for the overall PDR. This is present only
1045 * in the last part of a PDR being transferred
1046 * @return pldm_completion_codes
1047 */
1048int decode_get_pdr_resp(const struct pldm_msg *msg, size_t payload_length,
1049 uint8_t *completion_code, uint32_t *next_record_hndl,
1050 uint32_t *next_data_transfer_hndl,
1051 uint8_t *transfer_flag, uint16_t *resp_cnt,
1052 uint8_t *record_data, size_t record_data_length,
1053 uint8_t *transfer_crc);
1054
Sampa Misra7fcfb662019-05-08 13:13:53 -05001055/* SetStateEffecterStates */
1056
vkaverap98a2c192019-04-03 05:33:52 -05001057/** @brief Create a PLDM request message for SetStateEffecterStates
1058 *
1059 * @param[in] instance_id - Message's instance id
1060 * @param[in] effecter_id - used to identify and access the effecter
1061 * @param[in] comp_effecter_count - number of individual sets of effecter
1062 * information. Upto eight sets of state effecter info can be accessed
1063 * for a given effecter.
1064 * @param[in] field - each unit is an instance of the stateField structure
1065 * that is used to set the requested state for a particular effecter
1066 * within the state effecter. This field holds the starting address of
1067 * the stateField values. The user is responsible to allocate the
1068 * memory prior to calling this command. The user has to allocate the
1069 * field parameter as sizeof(set_effecter_state_field) *
1070 * comp_effecter_count
1071 * @param[out] msg - Message will be written to this
1072 * @return pldm_completion_codes
1073 * @note Caller is responsible for memory alloc and dealloc of param
vkaverapa6575b82019-04-03 05:33:52 -05001074 * 'msg.payload'
vkaverap98a2c192019-04-03 05:33:52 -05001075 */
1076
1077int encode_set_state_effecter_states_req(uint8_t instance_id,
1078 uint16_t effecter_id,
1079 uint8_t comp_effecter_count,
1080 set_effecter_state_field *field,
1081 struct pldm_msg *msg);
1082
1083/** @brief Decode SetStateEffecterStates response data
George Liu684a7162019-12-06 15:10:52 +08001084 *
1085 * Note:
1086 * * If the return value is not PLDM_SUCCESS, it represents a
1087 * transport layer error.
1088 * * If the completion_code value is not PLDM_SUCCESS, it represents a
1089 * protocol layer error and all the out-parameters are invalid.
1090 *
Zahed Hossain223a73d2019-07-04 12:46:18 -05001091 * @param[in] msg - Request message
vkaverapa6575b82019-04-03 05:33:52 -05001092 * @param[in] payload_length - Length of response message payload
vkaverap98a2c192019-04-03 05:33:52 -05001093 * @param[out] completion_code - PLDM completion code
1094 * @return pldm_completion_codes
1095 */
Zahed Hossain223a73d2019-07-04 12:46:18 -05001096int decode_set_state_effecter_states_resp(const struct pldm_msg *msg,
vkaverapa6575b82019-04-03 05:33:52 -05001097 size_t payload_length,
vkaverap98a2c192019-04-03 05:33:52 -05001098 uint8_t *completion_code);
George Liu30b859f2020-01-07 15:03:22 +08001099
1100/* SetNumericEffecterValue */
1101
1102/** @brief Create a PLDM request message for SetNumericEffecterValue
1103 *
1104 * @param[in] instance_id - Message's instance id
1105 * @param[in] effecter_id - used to identify and access the effecter
1106 * @param[in] effecter_data_size - The bit width and format of the setting
1107 * value for the effecter.
1108 * value:{uint8,sint8,uint16,sint16,uint32,sint32}
1109 * @param[in] effecter_value - The setting value of numeric effecter being
1110 * requested.
1111 * @param[in] payload_length - Length of request message payload
1112 * @param[out] msg - Message will be written to this
1113 * @return pldm_completion_codes
1114 * @note Caller is responsible for memory alloc and dealloc of param
1115 * 'msg.payload'
1116 */
1117int encode_set_numeric_effecter_value_req(
1118 uint8_t instance_id, uint16_t effecter_id, uint8_t effecter_data_size,
1119 uint8_t *effecter_value, struct pldm_msg *msg, size_t payload_length);
1120
1121/** @brief Decode SetNumericEffecterValue response data
1122 * @param[in] msg - Request message
1123 * @param[in] payload_length - Length of response message payload
1124 * @param[out] completion_code - PLDM completion code
1125 * @return pldm_completion_codes
1126 */
1127int decode_set_numeric_effecter_value_resp(const struct pldm_msg *msg,
1128 size_t payload_length,
1129 uint8_t *completion_code);
1130
Jolie Ku3557bad2020-03-02 16:22:57 +08001131/** @brief Create a PLDM request message for GetStateSensorReadings
1132 *
1133 * @param[in] instance_id - Message's instance id
1134 * @param[in] sensor_id - used to identify and access the simple or composite
1135 * sensor
1136 * @param[in] sensorRearm - Each bit location in this field corresponds to a
1137 * particular sensor within the state sensor, where bit [0] corresponds
1138 * to the first state sensor (sensor offset 0) and bit [7] corresponds
1139 * to the eighth sensor (sensor offset 7), sequentially
1140 * @param[in] reserved - value: 0x00
1141 * @param[out] msg - Message will be written to this
1142 * @return pldm_completion_codes
1143 * @note Caller is responsible for memory alloc and dealloc of param
1144 * 'msg.payload'
1145 */
Jolie Ku3557bad2020-03-02 16:22:57 +08001146int encode_get_state_sensor_readings_req(uint8_t instance_id,
1147 uint16_t sensor_id,
1148 bitfield8_t sensor_rearm,
1149 uint8_t reserved,
1150 struct pldm_msg *msg);
1151
1152/** @brief Decode GetStateSensorReadings response data
1153 *
1154 * @param[in] msg - Request message
1155 * @param[in] payload_length - Length of response message payload
1156 * @param[out] completion_code - PLDM completion code
1157 * @param[in,out] comp_sensor_count - The number of individual sets of sensor
1158 * information that this command accesses
1159 * @param[out] field - Each stateField is an instance of a stateField structure
1160 * that is used to return the present operational state setting and the
1161 * present state and event state for a particular set of sensor
1162 * information contained within the state sensor
1163 * @return pldm_completion_codes
1164 */
1165
1166int decode_get_state_sensor_readings_resp(const struct pldm_msg *msg,
1167 size_t payload_length,
1168 uint8_t *completion_code,
1169 uint8_t *comp_sensor_count,
1170 get_sensor_state_field *field);
1171
Zahed Hossaind4abab12020-02-06 03:36:43 -06001172/* PlatformEventMessage */
1173
1174/** @brief Decode PlatformEventMessage request data
1175 * @param[in] msg - Request message
1176 * @param[in] payload_length - Length of response message payload
1177 * @param[out] format_version - Version of the event format
1178 * @param[out] tid - Terminus ID for the terminus that originated the event
1179 * message
1180 * @param[out] event_class - The class of event being sent
1181 * @param[out] event_data_offset - Offset where the event data should be read
1182 * from pldm msg
1183 * @return pldm_completion_codes
1184 */
1185int decode_platform_event_message_req(const struct pldm_msg *msg,
1186 size_t payload_length,
1187 uint8_t *format_version, uint8_t *tid,
1188 uint8_t *event_class,
1189 size_t *event_data_offset);
1190
1191/** @brief Encode PlatformEventMessage response data
1192 * @param[in] instance_id - Message's instance id
1193 * @param[in] completion_code - PLDM completion code
Pavithra Barithaya2ea1f072020-04-03 09:30:23 -05001194 * @param[in] platform_event_status - Response status of the event message
1195 * command
Zahed Hossaind4abab12020-02-06 03:36:43 -06001196 * @param[out] msg - Message will be written to this
1197 * @return pldm_completion_codes
1198 * @note Caller is responsible for memory alloc and dealloc of param
1199 * 'msg.payload'
1200 */
1201int encode_platform_event_message_resp(uint8_t instance_id,
Pavithra Barithaya2ea1f072020-04-03 09:30:23 -05001202 uint8_t completion_code,
1203 uint8_t platform_event_status,
Zahed Hossaind4abab12020-02-06 03:36:43 -06001204 struct pldm_msg *msg);
1205
Pavithra Barithaya35f2b2c2020-04-08 01:35:56 -05001206/** @brief Encode PlatformEventMessage request data
1207 * @param[in] instance_id - Message's instance id
1208 * @param[in] format_version - Version of the event format
1209 * @param[in] tid - Terminus ID for the terminus that originated the event
1210 * message
1211 * @param[in] event_class - The class of event being sent
1212 * @param[in] event_data - the event data should be read from pldm msg
1213 * @param[in] event_data_length - Length of the event data
1214 * @param[out] msg - Request message
1215 * @return pldm_completion_codes
1216 * @note Caller is responsible for memory alloc and dealloc of param
1217 * 'msg.payload'
1218 */
Christian Geddes3bdb3c22020-05-01 14:55:39 -05001219int encode_platform_event_message_req(
1220 uint8_t instance_id, uint8_t format_version, uint8_t tid,
1221 uint8_t event_class, const uint8_t *event_data, size_t event_data_length,
1222 struct pldm_msg *msg, size_t payload_length);
Pavithra Barithaya35f2b2c2020-04-08 01:35:56 -05001223
1224/** @brief Decode PlatformEventMessage response data
1225 * @param[in] msg - Request message
1226 * @param[in] payload_length - Length of Response message payload
1227 * @param[out] completion_code - PLDM completion code
1228 * @param[out] platform_event_status - Response status of the event message
1229 * command
1230 * @return pldm_completion_codes
1231 */
1232int decode_platform_event_message_resp(const struct pldm_msg *msg,
1233 size_t payload_length,
1234 uint8_t *completion_code,
1235 uint8_t *platform_event_status);
1236
Zahed Hossain1c861712020-03-04 08:55:19 -06001237/** @brief Decode sensorEventData response data
1238 *
1239 * @param[in] event_data - event data from the response message
1240 * @param[in] event_data_length - length of the event data
1241 * @param[out] sensor_id - sensorID value of the sensor
1242 * @param[out] sensor_event_class_type - Type of sensor event class
1243 * @param[out] event_class_data_offset - Offset where the event class data
1244 * should be read from event data
1245 * @return pldm_completion_codes
1246 * @note Caller is responsible for memory alloc and dealloc of param
1247 * 'event_data'
1248 */
1249int decode_sensor_event_data(const uint8_t *event_data,
1250 size_t event_data_length, uint16_t *sensor_id,
1251 uint8_t *sensor_event_class_type,
1252 size_t *event_class_data_offset);
1253
1254/** @brief Decode sensorOpState response data
1255 *
1256 * @param[in] sensor_data - sensor_data for sensorEventClass = sensorOpState
1257 * @param[in] sensor_data_length - Length of sensor_data
1258 * @param[out] present_op_state - The sensorOperationalState value from the
1259 * state change that triggered the event message
1260 * @param[out] previous_op_state - The sensorOperationalState value for the
1261 * state from which the present state was entered
1262 * @return pldm_completion_codes
1263 * @note Caller is responsible for memory alloc and dealloc of param
1264 * 'sensor_data'
1265 */
1266int decode_sensor_op_data(const uint8_t *sensor_data, size_t sensor_data_length,
1267 uint8_t *present_op_state,
1268 uint8_t *previous_op_state);
1269
1270/** @brief Decode stateSensorState response data
1271 *
1272 * @param[in] sensor_data - sensor_data for sensorEventClass = stateSensorState
1273 * @param[in] sensor_data_length - Length of sensor_data
1274 * @param[out] sensor_offset - Identifies which state sensor within a composite
1275 * state sensor the event is being returned for
1276 * @param[out] event_state - The event state value from the state change that
1277 * triggered the event message
1278 * @param[out] previous_event_state - The event state value for the state from
1279 * which the present event state was entered
1280 * @return pldm_completion_codes
1281 * @note Caller is responsible for memory alloc and dealloc of param
1282 * 'sensor_data'
1283 */
1284int decode_state_sensor_data(const uint8_t *sensor_data,
1285 size_t sensor_data_length, uint8_t *sensor_offset,
1286 uint8_t *event_state,
1287 uint8_t *previous_event_state);
1288
1289/** @brief Decode numericSensorState response data
1290 *
1291 * @param[in] sensor_data - sensor_data for sensorEventClass =
1292 * numericSensorState
1293 * @param[in] sensor_data_length - Length of sensor_data
1294 * @param[out] event_state - The eventState value from the state change that
1295 * triggered the event message
1296 * @param[out] previous_event_state - The eventState value for the state from
1297 * which the present state was entered
1298 * @param[out] sensor_data_size - The bit width and format of reading and
1299 * threshold values that the sensor returns
1300 * @param[out] present_reading - The present value indicated by the sensor
1301 * @return pldm_completion_codes
1302 * @note Caller is responsible for memory alloc and dealloc of param
1303 * 'sensor_data'
1304 */
1305int decode_numeric_sensor_data(const uint8_t *sensor_data,
1306 size_t sensor_data_length, uint8_t *event_state,
1307 uint8_t *previous_event_state,
1308 uint8_t *sensor_data_size,
1309 uint32_t *present_reading);
1310
Jolie Ku6787f172020-03-19 11:15:53 +08001311/* GetNumericEffecterValue */
1312
1313/** @brief Create a PLDM request message for GetNumericEffecterValue
1314 *
1315 * @param[in] instance_id - Message's instance id
1316 * @param[in] effecter_id - used to identify and access the effecter
1317 * @param[out] msg - Message will be written to this
1318 * @return pldm_completion_codes
1319 * @note Caller is responsible for memory alloc and dealloc of param
1320 * 'msg.payload'
1321 */
1322int encode_get_numeric_effecter_value_req(uint8_t instance_id,
1323 uint16_t effecter_id,
1324 struct pldm_msg *msg);
1325
1326/** @brief Create a PLDM response message for GetNumericEffecterValue
1327 *
1328 * @param[in] msg - Request message
1329 * @param[in] payload_length - Length of request message payload
1330 * @param[out] completion_code - PLDM completion code
1331 * @param[out] effecter_data_size - The bit width and format of the setting
1332 * value for the effecter.
1333 * value:{uint8,sint8,uint16,sint16,uint32,sint32}
1334 * @param[out] effecter_oper_state - The state of the effecter itself
1335 * @param[out] pending_value - The pending numeric value setting of the
1336 * effecter. The effecterDataSize field indicates the number of
1337 * bits used for this field
1338 * @param[out] present_value - The present numeric value setting of the
1339 * effecter. The effecterDataSize indicates the number of bits
1340 * used for this field
1341 * @return pldm_completion_codes
1342 */
1343int decode_get_numeric_effecter_value_resp(
1344 const struct pldm_msg *msg, size_t payload_length, uint8_t *completion_code,
1345 uint8_t *effecter_data_size, uint8_t *effecter_oper_state,
1346 uint8_t *pending_value, uint8_t *present_value);
1347
Zahed Hossain9be087c2020-04-02 02:26:41 -05001348/** @brief Decode pldmPDRRepositoryChgEvent response data
1349 *
1350 * @param[in] event_data - eventData for pldmPDRRepositoryChgEvent
1351 * @param[in] event_data_size - Length of event_data
1352 * @param[out] event_data_format - This field indicates if the changedRecords
1353 * are of PDR Types or PDR Record Handles
1354 * @param[out] number_of_change_records - The number of changeRecords following
1355 * this field
1356 * @param[out] change_record_data_offset - Identifies where changeRecord data
1357 * is located within event_data
1358 * @return pldm_completion_codes
1359 * @note Caller is responsible for memory alloc and dealloc of param
1360 * 'event_data'
1361 */
1362int decode_pldm_pdr_repository_chg_event_data(
1363 const uint8_t *event_data, size_t event_data_size,
1364 uint8_t *event_data_format, uint8_t *number_of_change_records,
1365 size_t *change_record_data_offset);
1366
Zach Clark36ad1f52020-04-13 07:04:15 -05001367/** @brief Encode PLDM PDR Repository Change eventData
1368 * @param[in] event_data_format - Format of this event data (e.g.
1369 * FORMAT_IS_PDR_HANDLES)
1370 * @param[in] number_of_change_records - Number of changeRecords in this
1371 * eventData
1372 * @param[in] event_data_operations - Array of eventDataOperations
1373 * (e.g. RECORDS_ADDED) for each changeRecord in this eventData. This array
1374 * should contain number_of_change_records elements.
1375 * @param[in] numbers_of_change_entries - Array of numbers of changeEntrys
1376 * for each changeRecord in this eventData. This array should contain
1377 * number_of_change_records elements.
1378 * @param[in] change_entries - 2-dimensional array of arrays of changeEntrys,
1379 * one array per changeRecord in this eventData. The toplevel array should
1380 * contain number_of_change_records elements. Each subarray [i] should
1381 * contain numbers_of_change_entries[i] elements.
1382 * @param[in] event_data - The eventData will be encoded into this. This entire
1383 * structure must be max_change_records_size long. It must be large enough
1384 * to accomodate the data to be encoded. The caller is responsible for
1385 * allocating and deallocating it, including the variable-size
1386 * 'event_data.change_records' field. If this parameter is NULL,
1387 * PLDM_SUCCESS will be returned and actual_change_records_size will be set
1388 * to reflect the required size of the structure.
1389 * @param[out] actual_change_records_size - The actual number of meaningful
1390 * encoded bytes in event_data. The caller can over-allocate memory and use
1391 * this output to determine the real size of the structure.
1392 * @param[in] max_change_records_size - The size of event_data in bytes. If the
1393 * encoded message would be larger than this value, an error is returned.
1394 * @return pldm_completion_codes
1395 * @note Caller is responsible for memory alloc and dealloc of param
1396 * 'event_data.change_records'
1397 */
1398int encode_pldm_pdr_repository_chg_event_data(
1399 uint8_t event_data_format, uint8_t number_of_change_records,
1400 const uint8_t *event_data_operations,
1401 const uint8_t *numbers_of_change_entries,
1402 const uint32_t *const *change_entries,
1403 struct pldm_pdr_repository_chg_event_data *event_data,
1404 size_t *actual_change_records_size, size_t max_change_records_size);
1405
Zach Clarkb728eee2020-06-18 10:01:31 -05001406/** @brief Encode event data for a PLDM Sensor Event
1407 *
1408 * @param[out] event_data The object to store the encoded event in
1409 * @param[in] event_data_size Size of the allocation for event_data
1410 * @param[in] sensor_id Sensor ID
1411 * @param[in] sensor_event_class Sensor event class
1412 * @param[in] sensor_offset Offset
1413 * @param[in] event_state Event state
1414 * @param[in] previous_event_state Previous event state
1415 * @param[out] actual_event_data_size The real size in bytes of the event_data
1416 * @return int pldm_completion_codes PLDM_SUCCESS/PLDM_ERROR_INVALID_LENGTH
1417 * @note If event_data is NULL, then *actual_event_data_size will be set to
1418 * reflect the size of the event data, and PLDM_SUCCESS will be returned.
1419 * @note The caller is responsible for allocating and deallocating the
1420 * event_data
1421 */
1422int encode_sensor_event_data(struct pldm_sensor_event_data *event_data,
1423 size_t event_data_size, uint16_t sensor_id,
1424 enum sensor_event_class_states sensor_event_class,
1425 uint8_t sensor_offset, uint8_t event_state,
1426 uint8_t previous_event_state,
1427 size_t *actual_event_data_size);
1428
Zahed Hossain9be087c2020-04-02 02:26:41 -05001429/** @brief Decode PldmPDRRepositoryChangeRecord response data
1430 *
1431 * @param[in] change_record_data - changeRecordData for
1432 * pldmPDRRepositoryChgEvent
1433 * @param[in] change_record_data_size - Length of change_record_data
1434 * @param[out] event_data_operation - This field indicates the changeEntries
1435 * operation types
1436 * @param[out] number_of_change_entries - The number of changeEntries following
1437 * this field
1438 * @param[out] change_entry_data_offset - Identifies where changeEntries data
1439 * is located within change_record_data
1440 * @return pldm_completion_codes
1441 * @note Caller is responsible for memory alloc and dealloc of param
1442 * 'change_record_data'
1443 */
1444int decode_pldm_pdr_repository_change_record_data(
1445 const uint8_t *change_record_data, size_t change_record_data_size,
1446 uint8_t *event_data_operation, uint8_t *number_of_change_entries,
1447 size_t *change_entry_data_offset);
1448
Jolie Kuf798c8f2020-04-14 11:18:06 +08001449/* GetSensorReading */
1450
1451/** @brief Encode GetSensorReading request data
1452 *
1453 * @param[in] instance_id - Message's instance id
1454 * @param[in] sensor_id - A handle that is used to identify and access the
1455 * sensor
1456 * @param[in] rearm_event_state - true = manually re-arm EventState after
1457 * responding to this request, false = no manual re-arm
1458 * @param[out] msg - Message will be written to this
1459 * @return pldm_completion_codes
1460 * @note Caller is responsible for memory alloc and dealloc of param
1461 * 'msg.payload'
1462 */
1463int encode_get_sensor_reading_req(uint8_t instance_id, uint16_t sensor_id,
1464 bool8_t rearm_event_state,
1465 struct pldm_msg *msg);
1466
1467/** @brief Decode GetSensorReading response data
1468 *
1469 * @param[in] msg - Request message
1470 * @param[in] payload_length - Length of response message payload
1471 * @param[out] completion_code - PLDM completion code
1472 * @param[out] sensor_data_size - The bit width and format of reading and
1473 * threshold values
1474 * @param[out] sensor_operational_state - The state of the sensor itself
1475 * @param[out] sensor_event_message_enable - value: { noEventGeneration,
1476 * eventsDisabled, eventsEnabled, opEventsOnlyEnabled,
1477 * stateEventsOnlyEnabled }
1478 * @param[out] present_state - The most recently assessed state value monitored
1479 * by the sensor
1480 * @param[out] previous_state - The state that the presentState was entered
1481 * from
1482 * @param[out] event_state - Indicates which threshold crossing assertion
1483 * events have been detected
1484 * @param[out] present_reading - The present value indicated by the sensor
1485 * @return pldm_completion_codes
1486 */
1487
1488int decode_get_sensor_reading_resp(
1489 const struct pldm_msg *msg, size_t payload_length, uint8_t *completion_code,
1490 uint8_t *sensor_data_size, uint8_t *sensor_operational_state,
1491 uint8_t *sensor_event_message_enable, uint8_t *present_state,
1492 uint8_t *previous_state, uint8_t *event_state, uint8_t *present_reading);
1493
Sagar Srinivas535bccd2021-03-24 12:18:26 -05001494/** @brief Encode the SetEventReceiver request message
1495 *
1496 * @param[in] instance_id - Message's instance id
1497 * @param[in] event_message_global_enable - This value is used to enable or
1498 * disable event message generation from the terminus value: {
1499 * disable, enableAsync, enablePolling, enableAsyncKeepAlive }
1500 * @param[in] transport_protocol_type - This value is provided in the request
1501 * to help the responder verify that the content of the
1502 * eventReceiverAddressInfo field used in this request is correct for
1503 * the messaging protocol supported by the terminus.
1504 * @param[in] event_receiver_address_info - this value is a medium and
1505 * protocol-specific address that the responder should use when
1506 * transmitting event messages using the indicated protocol
1507 * @param[in] heartbeat_timer - Amount of time in seconds after each elapsing
1508 * of which the terminus shall emit a heartbeat event to the receiver
1509 * @param[out] msg - Argument to capture the Message
1510 * @return pldm_completion_codes
1511 */
1512int encode_set_event_receiver_req(uint8_t instance_id,
1513 uint8_t event_message_global_enable,
1514 uint8_t transport_protocol_type,
1515 uint8_t event_receiver_address_info,
1516 uint16_t heartbeat_timer,
1517 struct pldm_msg *msg);
1518
1519/** @brief Decode the SetEventReceiver response message
1520 *
1521 * @param[in] msg - Request message
1522 * @param[in] payload_length - Length of response message payload
1523 * @param[out] completion_code - PLDM completion code
1524 * @return pldm_completion_codes
1525 */
1526int decode_set_event_receiver_resp(const struct pldm_msg *msg,
1527 size_t payload_length,
1528 uint8_t *completion_code);
Sridevi Ramesh74187522021-04-08 09:50:22 -05001529
1530/** @brief Decode the SetEventReceiver request message
1531 *
1532 * @param[in] msg - Request message
1533 * @param[in] payload_length - Length of request message payload
1534 * @param[out] event_message_global_enable - This value is used to enable or
1535 * disable event message generation from the terminus value: {
1536 * disable, enableAsync, enablePolling, enableAsyncKeepAlive }
1537 * @param[out] transport_protocol_type - This value is provided in the request
1538 * to help the responder verify that the content of the
1539 * eventReceiverAddressInfo field used in this request is correct for
1540 * the messaging protocol supported by the terminus.
1541 * @param[out] event_receiver_address_info - This value is a medium and
1542 * protocol-specific address that the responder should use when
1543 * transmitting event messages using the indicated protocol
1544 * @param[out] heartbeat_timer - Amount of time in seconds after each elapsing
1545 * of which the terminus shall emit a heartbeat event to the receiver
1546 * @return pldm_completion_codes
1547 */
1548int decode_set_event_receiver_req(const struct pldm_msg *msg,
1549 size_t payload_length,
1550 uint8_t *event_message_global_enable,
1551 uint8_t *transport_protocol_type,
1552 uint8_t *event_receiver_address_info,
1553 uint16_t *heartbeat_timer);
1554
1555/** @brief Encode the SetEventReceiver response message
1556 *
1557 * @param[in] instance_id - Message's instance id
1558 * @param[in] completion_code - PLDM completion code
1559 * @param[out] msg - Argument to capture the Message
1560 * @return pldm_completion_codes
1561 */
1562int encode_set_event_receiver_resp(uint8_t instance_id, uint8_t completion_code,
1563 struct pldm_msg *msg);
1564
Sampa Misra0db1dfa2019-03-19 00:15:31 -05001565#ifdef __cplusplus
1566}
1567#endif
1568
1569#endif /* PLATFORM_H */