blob: 0371d1c1a76fbdaa1ee2662bab131fa7daa29ed4 [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"
12
13/* Maximum size for request */
14#define PLDM_SET_STATE_EFFECTER_STATES_REQ_BYTES 19
Jolie Ku3557bad2020-03-02 16:22:57 +080015#define PLDM_GET_STATE_SENSOR_READINGS_REQ_BYTES 4
Sampa Misra0db1dfa2019-03-19 00:15:31 -050016/* Response lengths are inclusive of completion code */
17#define PLDM_SET_STATE_EFFECTER_STATES_RESP_BYTES 1
Jolie Ku3557bad2020-03-02 16:22:57 +080018#define PLDM_GET_STATE_SENSOR_READINGS_RESP_BYTES 34
Sampa Misra0db1dfa2019-03-19 00:15:31 -050019
George Liu30b859f2020-01-07 15:03:22 +080020#define PLDM_SET_NUMERIC_EFFECTER_VALUE_RESP_BYTES 1
21#define PLDM_SET_NUMERIC_EFFECTER_VALUE_MIN_REQ_BYTES 4
22
Sampa Misra7fcfb662019-05-08 13:13:53 -050023#define PLDM_GET_PDR_REQ_BYTES 13
24/* Minimum response length */
25#define PLDM_GET_PDR_MIN_RESP_BYTES 12
26
George Liu30b859f2020-01-07 15:03:22 +080027enum pldm_effecter_data_size {
28 PLDM_EFFECTER_DATA_SIZE_UINT8,
29 PLDM_EFFECTER_DATA_SIZE_SINT8,
30 PLDM_EFFECTER_DATA_SIZE_UINT16,
31 PLDM_EFFECTER_DATA_SIZE_SINT16,
32 PLDM_EFFECTER_DATA_SIZE_UINT32,
33 PLDM_EFFECTER_DATA_SIZE_SINT32
34};
35
Sampa Misra0db1dfa2019-03-19 00:15:31 -050036enum set_request { PLDM_NO_CHANGE = 0x00, PLDM_REQUEST_SET = 0x01 };
37
38enum effecter_state { PLDM_INVALID_VALUE = 0xFF };
39
Jolie Ku3557bad2020-03-02 16:22:57 +080040enum sensor_operational_state {
41 ENABLED = 0x00,
42 DISABLED = 0x01,
43 UNAVAILABLE = 0x02,
44 STATUSUNKNOWN = 0x03,
45 FAILED = 0x04,
46 INITIALIZING = 0x05,
47 SHUTTINGDOWN = 0x06,
48 INTEST = 0x07
49};
50
51enum present_state {
52 UNKNOWN = 0x0,
53 NORMAL = 0x01,
54 WARNING = 0x02,
55 CRITICAL = 0x03,
56 FATAL = 0x04,
57 LOWERWARNING = 0x05,
58 LOWERCRITICAL = 0x06,
59 LOWERFATAL = 0x07,
60 UPPERWARNING = 0x08,
61 UPPERCRITICAL = 0x09,
62 UPPERFATAL = 0x0a
63};
64
Sampa Misra0db1dfa2019-03-19 00:15:31 -050065enum pldm_platform_commands {
Jolie Ku3557bad2020-03-02 16:22:57 +080066 PLDM_GET_STATE_SENSOR_READINGS = 0x21,
George Liu30b859f2020-01-07 15:03:22 +080067 PLDM_SET_NUMERIC_EFFECTER_VALUE = 0x31,
Sampa Misra0db1dfa2019-03-19 00:15:31 -050068 PLDM_SET_STATE_EFFECTER_STATES = 0x39,
Sampa Misra7fcfb662019-05-08 13:13:53 -050069 PLDM_GET_PDR = 0x51,
Sampa Misra0db1dfa2019-03-19 00:15:31 -050070};
71
Deepak Kodihallic6e8fb52019-05-02 08:35:31 -050072/** @brief PLDM PDR types
73 */
74enum pldm_pdr_types {
75 PLDM_STATE_EFFECTER_PDR = 11,
Deepak Kodihallidb914672020-02-07 02:47:45 -060076 PLDM_PDR_FRU_RECORD_SET = 20,
Deepak Kodihallic6e8fb52019-05-02 08:35:31 -050077};
78
79/** @brief PLDM effecter initialization schemes
80 */
81enum pldm_effecter_init {
82 PLDM_NO_INIT,
83 PLDM_USE_INIT_PDR,
84 PLDM_ENABLE_EFFECTER,
85 PLDM_DISABLE_EFECTER
86};
87
Deepak Kodihalli557dfb02019-05-12 13:11:17 +053088/** @brief PLDM Platform M&C completion codes
89 */
90enum pldm_platform_completion_codes {
Sampa Misraa2fa0702019-05-31 01:28:55 -050091 PLDM_PLATFORM_INVALID_EFFECTER_ID = 0x80,
92 PLDM_PLATFORM_INVALID_STATE_VALUE = 0x81,
Deepak Kodihalli557dfb02019-05-12 13:11:17 +053093 PLDM_PLATFORM_INVALID_RECORD_HANDLE = 0x82,
Sampa Misraa2fa0702019-05-31 01:28:55 -050094 PLDM_PLATFORM_SET_EFFECTER_UNSUPPORTED_SENSORSTATE = 0x82,
Deepak Kodihalli557dfb02019-05-12 13:11:17 +053095};
96
Deepak Kodihallic6e8fb52019-05-02 08:35:31 -050097/** @struct pldm_pdr_hdr
98 *
99 * Structure representing PLDM common PDR header
100 */
101struct pldm_pdr_hdr {
102 uint32_t record_handle;
103 uint8_t version;
104 uint8_t type;
105 uint16_t record_change_num;
106 uint16_t length;
107} __attribute__((packed));
108
Deepak Kodihallidb914672020-02-07 02:47:45 -0600109/** @struct pldm_pdr_fru_record_set
110 *
111 * Structure representing PLDM FRU record set PDR
112 */
113struct pldm_pdr_fru_record_set {
114 uint16_t terminus_handle;
115 uint16_t fru_rsi;
116 uint16_t entity_type;
117 uint16_t entity_instance_num;
118 uint16_t container_id;
119} __attribute__((packed));
120
Deepak Kodihallic6e8fb52019-05-02 08:35:31 -0500121/** @struct pldm_state_effecter_pdr
122 *
123 * Structure representing PLDM state effecter PDR
124 */
125struct pldm_state_effecter_pdr {
126 struct pldm_pdr_hdr hdr;
127 uint16_t terminus_handle;
128 uint16_t effecter_id;
129 uint16_t entity_type;
130 uint16_t entity_instance;
131 uint16_t container_id;
132 uint16_t effecter_semantic_id;
133 uint8_t effecter_init;
134 bool8_t has_description_pdr;
135 uint8_t composite_effecter_count;
136 uint8_t possible_states[1];
137} __attribute__((packed));
138
139/** @struct state_effecter_possible_states
140 *
141 * Structure representing state enums for state effecter
142 */
143struct state_effecter_possible_states {
144 uint16_t state_set_id;
145 uint8_t possible_states_size;
146 bitfield8_t states[1];
147} __attribute__((packed));
148
Sampa Misra0db1dfa2019-03-19 00:15:31 -0500149/** @struct set_effecter_state_field
150 *
151 * Structure representing a stateField in SetStateEffecterStates command */
152
153typedef struct state_field_for_state_effecter_set {
154 uint8_t set_request; //!< Whether to change the state
155 uint8_t effecter_state; //!< Expected state of the effecter
156} __attribute__((packed)) set_effecter_state_field;
157
Jolie Ku3557bad2020-03-02 16:22:57 +0800158/** @struct get_sensor_readings_field
159 *
160 * Structure representing a stateField in GetStateSensorReadings command */
161
162typedef struct state_field_for_get_state_sensor_readings {
163 uint8_t sensor_op_state; //!< The state of the sensor itself
164 uint8_t present_state; //!< Return a state value
165 uint8_t previous_state; //!< The state that the presentState was entered
166 //! from. This must be different from the
167 //! present state
168 uint8_t event_state; //!< Return a state value from a PLDM State Set
169 //! that is associated with the sensor
170} __attribute__((packed)) get_sensor_state_field;
171
Priyanga7257fdf2019-06-10 01:59:45 -0500172/** @struct PLDM_SetStateEffecterStates_Request
173 *
174 * Structure representing PLDM set state effecter states request.
175 */
176struct pldm_set_state_effecter_states_req {
177 uint16_t effecter_id;
178 uint8_t comp_effecter_count;
179 set_effecter_state_field field[8];
180} __attribute__((packed));
181
Sampa Misra7fcfb662019-05-08 13:13:53 -0500182/** @struct pldm_get_pdr_resp
183 *
184 * structure representing GetPDR response packet
185 * transfer CRC is not part of the structure and will be
186 * added at the end of last packet in multipart transfer
187 */
188struct pldm_get_pdr_resp {
189 uint8_t completion_code;
190 uint32_t next_record_handle;
191 uint32_t next_data_transfer_handle;
192 uint8_t transfer_flag;
193 uint16_t response_count;
194 uint8_t record_data[1];
195} __attribute__((packed));
196
197/** @struct pldm_get_pdr_req
198 *
199 * structure representing GetPDR request packet
200 */
201struct pldm_get_pdr_req {
202 uint32_t record_handle;
203 uint32_t data_transfer_handle;
204 uint8_t transfer_op_flag;
205 uint16_t request_count;
206 uint16_t record_change_number;
207} __attribute__((packed));
208
George Liu30b859f2020-01-07 15:03:22 +0800209/** @struct pldm_set_numeric_effecter_value_req
210 *
211 * structure representing SetNumericEffecterValue request packet
212 */
213struct pldm_set_numeric_effecter_value_req {
214 uint16_t effecter_id;
215 uint8_t effecter_data_size;
216 uint8_t effecter_value[1];
217} __attribute__((packed));
218
Jolie Ku3557bad2020-03-02 16:22:57 +0800219/** @struct pldm_get_state_sensor_readings_req
220 *
221 * Structure representing PLDM get state sensor readings request.
222 */
223struct pldm_get_state_sensor_readings_req {
224 uint16_t sensor_id;
225 bitfield8_t sensor_rearm;
226 uint8_t reserved;
227} __attribute__((packed));
228
229/** @struct pldm_get_state_sensor_readings_resp
230 *
231 * Structure representing PLDM get state sensor readings response.
232 */
233struct pldm_get_state_sensor_readings_resp {
234 uint8_t completion_code;
235 uint8_t comp_sensor_count;
236 get_sensor_state_field field[1];
237} __attribute__((packed));
238
Sampa Misra0db1dfa2019-03-19 00:15:31 -0500239/* Responder */
240
George Liu30b859f2020-01-07 15:03:22 +0800241/* SetNumericEffecterValue */
242
243/** @brief Decode SetNumericEffecterValue request data
244 *
245 * @param[in] msg - Request message
246 * @param[in] payload_length - Length of request message payload
247 * @param[out] effecter_id - used to identify and access the effecter
248 * @param[out] effecter_data_size - The bit width and format of the setting
249 * value for the effecter.
250 * value:{uint8,sint8,uint16,sint16,uint32,sint32}
251 * @param[out] effecter_value - The setting value of numeric effecter being
252 * requested.
253 * @return pldm_completion_codes
254 */
255int decode_set_numeric_effecter_value_req(const struct pldm_msg *msg,
256 size_t payload_length,
257 uint16_t *effecter_id,
258 uint8_t *effecter_data_size,
259 uint8_t *effecter_value);
260
261/** @brief Create a PLDM response message for SetNumericEffecterValue
262 *
263 * @param[in] instance_id - Message's instance id
264 * @param[in] completion_code - PLDM completion code
265 * @param[out] msg - Message will be written to this
266 * @param[in] payload_length - Length of request message payload
267 * @return pldm_completion_codes
268 * @note Caller is responsible for memory alloc and dealloc of param
269 * 'msg.body.payload'
270 */
271int encode_set_numeric_effecter_value_resp(uint8_t instance_id,
272 uint8_t completion_code,
273 struct pldm_msg *msg,
274 size_t payload_length);
275
Sampa Misra0db1dfa2019-03-19 00:15:31 -0500276/* SetStateEffecterStates */
277
278/** @brief Create a PLDM response message for SetStateEffecterStates
279 *
280 * @param[in] instance_id - Message's instance id
281 * @param[in] completion_code - PLDM completion code
282 * @param[out] msg - Message will be written to this
283 * @return pldm_completion_codes
284 * @note Caller is responsible for memory alloc and dealloc of param
285 * 'msg.body.payload'
286 */
287
288int encode_set_state_effecter_states_resp(uint8_t instance_id,
289 uint8_t completion_code,
290 struct pldm_msg *msg);
291
292/** @brief Decode SetStateEffecterStates request data
293 *
Zahed Hossain223a73d2019-07-04 12:46:18 -0500294 * @param[in] msg - Request message
vkaverapa6575b82019-04-03 05:33:52 -0500295 * @param[in] payload_length - Length of request message payload
Sampa Misra0db1dfa2019-03-19 00:15:31 -0500296 * @param[out] effecter_id - used to identify and access the effecter
297 * @param[out] comp_effecter_count - number of individual sets of effecter
298 * information. Upto eight sets of state effecter info can be accessed
299 * for a given effecter.
300 * @param[out] field - each unit is an instance of the stateFileld structure
301 * that is used to set the requested state for a particular effecter
302 * within the state effecter. This field holds the starting address of
303 * the stateField values. The user is responsible to allocate the
304 * memory prior to calling this command. Since the state field count is
305 * not known in advance, the user should allocate the maximum size
306 * always, which is 8 in number.
307 * @return pldm_completion_codes
308 */
vkaverapa6575b82019-04-03 05:33:52 -0500309
Zahed Hossain223a73d2019-07-04 12:46:18 -0500310int decode_set_state_effecter_states_req(const struct pldm_msg *msg,
vkaverapa6575b82019-04-03 05:33:52 -0500311 size_t payload_length,
Sampa Misra0db1dfa2019-03-19 00:15:31 -0500312 uint16_t *effecter_id,
313 uint8_t *comp_effecter_count,
314 set_effecter_state_field *field);
315
Sampa Misra7fcfb662019-05-08 13:13:53 -0500316/* GetPDR */
317
318/** @brief Create a PLDM response message for GetPDR
319 *
320 * @param[in] instance_id - Message's instance id
321 * @param[in] completion_code - PLDM completion code
322 * @param[in] next_record_hndl - The recordHandle for the PDR that is next in
323 * the PDR Repository
324 * @param[in] next_data_transfer_hndl - A handle that identifies the next
325 * portion of the PDR data to be transferred, if any
326 * @param[in] transfer_flag - Indicates the portion of PDR data being
327 * transferred
328 * @param[in] resp_cnt - The number of recordData bytes returned in this
329 * response
330 * @param[in] record_data - PDR data bytes of length resp_cnt
331 * @param[in] transfer_crc - A CRC-8 for the overall PDR. This is present only
332 * in the last part of a PDR being transferred
333 * @param[out] msg - Message will be written to this
334 * @return pldm_completion_codes
335 * @note Caller is responsible for memory alloc and dealloc of param
336 * 'msg.payload'
337 */
338int encode_get_pdr_resp(uint8_t instance_id, uint8_t completion_code,
339 uint32_t next_record_hndl,
340 uint32_t next_data_transfer_hndl, uint8_t transfer_flag,
341 uint16_t resp_cnt, const uint8_t *record_data,
342 uint8_t transfer_crc, struct pldm_msg *msg);
343
344/** @brief Decode GetPDR request data
345 *
346 * @param[in] msg - Request message
347 * @param[in] payload_length - Length of request message payload
348 * @param[out] record_hndl - The recordHandle value for the PDR to be retrieved
349 * @param[out] data_transfer_hndl - Handle used to identify a particular
350 * multipart PDR data transfer operation
351 * @param[out] transfer_op_flag - Flag to indicate the first or subsequent
352 * portion of transfer
353 * @param[out] request_cnt - The maximum number of record bytes requested
354 * @param[out] record_chg_num - Used to determine whether the PDR has changed
355 * while PDR transfer is going on
356 * @return pldm_completion_codes
357 */
358
359int decode_get_pdr_req(const struct pldm_msg *msg, size_t payload_length,
360 uint32_t *record_hndl, uint32_t *data_transfer_hndl,
361 uint8_t *transfer_op_flag, uint16_t *request_cnt,
362 uint16_t *record_chg_num);
363
Jolie Ku3557bad2020-03-02 16:22:57 +0800364/* GetStateSensorReadings */
365
366/** @brief Decode GetStateSensorReadings request data
367 *
368 * @param[in] msg - Request message
369 * @param[in] payload_length - Length of request message payload
370 * @param[out] sensor_id - used to identify and access the simple or composite
371 * sensor
372 * @param[out] sensor_rearm - Each bit location in this field corresponds to a
373 * particular sensor within the state sensor, where bit [0] corresponds
374 * to the first state sensor (sensor offset 0) and bit [7] corresponds
375 * to the eighth sensor (sensor offset 7), sequentially.
376 * @param[out] reserved - value: 0x00
377 * @return pldm_completion_codes
378 */
379
380int decode_get_state_sensor_readings_req(const struct pldm_msg *msg,
381 size_t payload_length,
382 uint16_t *sensor_id,
383 bitfield8_t *sensor_rearm,
384 uint8_t *reserved);
385
386/** @brief Encode GetStateSensorReadings response data
387 *
388 * @param[in] instance_id - Message's instance id
389 * @param[in] completion_code - PLDM completion code
390 * @param[out] comp_sensor_count - The number of individual sets of sensor
391 * information that this command accesses
392 * @param[out] field - Each stateField is an instance of a stateField structure
393 * that is used to return the present operational state setting and the
394 * present state and event state for a particular set of sensor
395 * information contained within the state sensor
396 * @param[out] msg - Message will be written to this
397 * @return pldm_completion_codes
398 */
399
400int encode_get_state_sensor_readings_resp(uint8_t instance_id,
401 uint8_t completion_code,
402 uint8_t comp_sensor_count,
403 get_sensor_state_field *field,
404 struct pldm_msg *msg);
405
Sampa Misra7fcfb662019-05-08 13:13:53 -0500406/* Requester */
407
George Liu820a9a52019-11-26 14:43:59 +0800408/* GetPDR */
409
410/** @brief Create a PLDM request message for GetPDR
411 *
412 * @param[in] instance_id - Message's instance id
413 * @param[in] record_hndl - The recordHandle value for the PDR to be retrieved
414 * @param[in] data_transfer_hndl - Handle used to identify a particular
415 * multipart PDR data transfer operation
416 * @param[in] transfer_op_flag - Flag to indicate the first or subsequent
417 * portion of transfer
418 * @param[in] request_cnt - The maximum number of record bytes requested
419 * @param[in] record_chg_num - Used to determine whether the PDR has changed
420 * while PDR transfer is going on
421 * @param[out] msg - Message will be written to this
422 * @param[in] payload_length - Length of request message payload
423 * @return pldm_completion_codes
424 * @note Caller is responsible for memory alloc and dealloc of param
425 * 'msg.payload'
426 */
427int encode_get_pdr_req(uint8_t instance_id, uint32_t record_hndl,
428 uint32_t data_transfer_hndl, uint8_t transfer_op_flag,
429 uint16_t request_cnt, uint16_t record_chg_num,
430 struct pldm_msg *msg, size_t payload_length);
431
432/** @brief Decode GetPDR response data
433 *
George Liu684a7162019-12-06 15:10:52 +0800434 * Note:
435 * * If the return value is not PLDM_SUCCESS, it represents a
436 * transport layer error.
437 * * If the completion_code value is not PLDM_SUCCESS, it represents a
438 * protocol layer error and all the out-parameters are invalid.
439 *
George Liu820a9a52019-11-26 14:43:59 +0800440 * @param[in] msg - Request message
441 * @param[in] payload_length - Length of request message payload
442 * @param[out] completion_code - PLDM completion code
443 * @param[out] next_record_hndl - The recordHandle for the PDR that is next in
444 * the PDR Repository
445 * @param[out] next_data_transfer_hndl - A handle that identifies the next
446 * portion of the PDR data to be transferred, if any
447 * @param[out] transfer_flag - Indicates the portion of PDR data being
448 * transferred
449 * @param[out] resp_cnt - The number of recordData bytes returned in this
450 * response
451 * @param[out] record_data - PDR data bytes of length resp_cnt
452 * @param[in] record_data_length - Length of record_data
453 * @param[out] transfer_crc - A CRC-8 for the overall PDR. This is present only
454 * in the last part of a PDR being transferred
455 * @return pldm_completion_codes
456 */
457int decode_get_pdr_resp(const struct pldm_msg *msg, size_t payload_length,
458 uint8_t *completion_code, uint32_t *next_record_hndl,
459 uint32_t *next_data_transfer_hndl,
460 uint8_t *transfer_flag, uint16_t *resp_cnt,
461 uint8_t *record_data, size_t record_data_length,
462 uint8_t *transfer_crc);
463
Sampa Misra7fcfb662019-05-08 13:13:53 -0500464/* SetStateEffecterStates */
465
vkaverap98a2c192019-04-03 05:33:52 -0500466/** @brief Create a PLDM request message for SetStateEffecterStates
467 *
468 * @param[in] instance_id - Message's instance id
469 * @param[in] effecter_id - used to identify and access the effecter
470 * @param[in] comp_effecter_count - number of individual sets of effecter
471 * information. Upto eight sets of state effecter info can be accessed
472 * for a given effecter.
473 * @param[in] field - each unit is an instance of the stateField structure
474 * that is used to set the requested state for a particular effecter
475 * within the state effecter. This field holds the starting address of
476 * the stateField values. The user is responsible to allocate the
477 * memory prior to calling this command. The user has to allocate the
478 * field parameter as sizeof(set_effecter_state_field) *
479 * comp_effecter_count
480 * @param[out] msg - Message will be written to this
481 * @return pldm_completion_codes
482 * @note Caller is responsible for memory alloc and dealloc of param
vkaverapa6575b82019-04-03 05:33:52 -0500483 * 'msg.payload'
vkaverap98a2c192019-04-03 05:33:52 -0500484 */
485
486int encode_set_state_effecter_states_req(uint8_t instance_id,
487 uint16_t effecter_id,
488 uint8_t comp_effecter_count,
489 set_effecter_state_field *field,
490 struct pldm_msg *msg);
491
492/** @brief Decode SetStateEffecterStates response data
George Liu684a7162019-12-06 15:10:52 +0800493 *
494 * Note:
495 * * If the return value is not PLDM_SUCCESS, it represents a
496 * transport layer error.
497 * * If the completion_code value is not PLDM_SUCCESS, it represents a
498 * protocol layer error and all the out-parameters are invalid.
499 *
Zahed Hossain223a73d2019-07-04 12:46:18 -0500500 * @param[in] msg - Request message
vkaverapa6575b82019-04-03 05:33:52 -0500501 * @param[in] payload_length - Length of response message payload
vkaverap98a2c192019-04-03 05:33:52 -0500502 * @param[out] completion_code - PLDM completion code
503 * @return pldm_completion_codes
504 */
Zahed Hossain223a73d2019-07-04 12:46:18 -0500505int decode_set_state_effecter_states_resp(const struct pldm_msg *msg,
vkaverapa6575b82019-04-03 05:33:52 -0500506 size_t payload_length,
vkaverap98a2c192019-04-03 05:33:52 -0500507 uint8_t *completion_code);
George Liu30b859f2020-01-07 15:03:22 +0800508
509/* SetNumericEffecterValue */
510
511/** @brief Create a PLDM request message for SetNumericEffecterValue
512 *
513 * @param[in] instance_id - Message's instance id
514 * @param[in] effecter_id - used to identify and access the effecter
515 * @param[in] effecter_data_size - The bit width and format of the setting
516 * value for the effecter.
517 * value:{uint8,sint8,uint16,sint16,uint32,sint32}
518 * @param[in] effecter_value - The setting value of numeric effecter being
519 * requested.
520 * @param[in] payload_length - Length of request message payload
521 * @param[out] msg - Message will be written to this
522 * @return pldm_completion_codes
523 * @note Caller is responsible for memory alloc and dealloc of param
524 * 'msg.payload'
525 */
526int encode_set_numeric_effecter_value_req(
527 uint8_t instance_id, uint16_t effecter_id, uint8_t effecter_data_size,
528 uint8_t *effecter_value, struct pldm_msg *msg, size_t payload_length);
529
530/** @brief Decode SetNumericEffecterValue response data
531 * @param[in] msg - Request message
532 * @param[in] payload_length - Length of response message payload
533 * @param[out] completion_code - PLDM completion code
534 * @return pldm_completion_codes
535 */
536int decode_set_numeric_effecter_value_resp(const struct pldm_msg *msg,
537 size_t payload_length,
538 uint8_t *completion_code);
539
Jolie Ku3557bad2020-03-02 16:22:57 +0800540/** @brief Create a PLDM request message for GetStateSensorReadings
541 *
542 * @param[in] instance_id - Message's instance id
543 * @param[in] sensor_id - used to identify and access the simple or composite
544 * sensor
545 * @param[in] sensorRearm - Each bit location in this field corresponds to a
546 * particular sensor within the state sensor, where bit [0] corresponds
547 * to the first state sensor (sensor offset 0) and bit [7] corresponds
548 * to the eighth sensor (sensor offset 7), sequentially
549 * @param[in] reserved - value: 0x00
550 * @param[out] msg - Message will be written to this
551 * @return pldm_completion_codes
552 * @note Caller is responsible for memory alloc and dealloc of param
553 * 'msg.payload'
554 */
555
556int encode_get_state_sensor_readings_req(uint8_t instance_id,
557 uint16_t sensor_id,
558 bitfield8_t sensor_rearm,
559 uint8_t reserved,
560 struct pldm_msg *msg);
561
562/** @brief Decode GetStateSensorReadings response data
563 *
564 * @param[in] msg - Request message
565 * @param[in] payload_length - Length of response message payload
566 * @param[out] completion_code - PLDM completion code
567 * @param[in,out] comp_sensor_count - The number of individual sets of sensor
568 * information that this command accesses
569 * @param[out] field - Each stateField is an instance of a stateField structure
570 * that is used to return the present operational state setting and the
571 * present state and event state for a particular set of sensor
572 * information contained within the state sensor
573 * @return pldm_completion_codes
574 */
575
576int decode_get_state_sensor_readings_resp(const struct pldm_msg *msg,
577 size_t payload_length,
578 uint8_t *completion_code,
579 uint8_t *comp_sensor_count,
580 get_sensor_state_field *field);
581
Sampa Misra0db1dfa2019-03-19 00:15:31 -0500582#ifdef __cplusplus
583}
584#endif
585
586#endif /* PLATFORM_H */